code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@SneakyThrows(DurableDataLogException.class) // Because this is an arg to SequentialAsyncProcessor, which wants a Runnable.
private void rollover() {
if (this.closed.get()) {
// BookKeeperLog is closed; no point in running this.
return;
}
long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "rollover");
val l = getWriteLedger().ledger;
if (!l.isClosed() && l.getLength() < this.config.getBkLedgerMaxSize()) {
// Nothing to do. Trigger the write processor just in case this rollover was invoked because the write
// processor got a pointer to a LedgerHandle that was just closed by a previous run of the rollover processor.
this.writeProcessor.runAsync();
LoggerHelpers.traceLeave(log, this.traceObjectId, "rollover", traceId, false);
return;
}
try {
// Create new ledger.
LedgerHandle newLedger = Ledgers.create(this.bookKeeper, this.config);
log.debug("{}: Rollover: created new ledger {}.", this.traceObjectId, newLedger.getId());
// Update the metadata.
LogMetadata metadata = getLogMetadata();
metadata = updateMetadata(metadata, newLedger, false);
LedgerMetadata ledgerMetadata = metadata.getLedger(newLedger.getId());
assert ledgerMetadata != null : "cannot find newly added ledger metadata";
log.debug("{}: Rollover: updated metadata '{}.", this.traceObjectId, metadata);
// Update pointers to the new ledger and metadata.
LedgerHandle oldLedger;
synchronized (this.lock) {
oldLedger = this.writeLedger.ledger;
if (!oldLedger.isClosed()) {
// Only mark the old ledger as Rolled Over if it is still open. Otherwise it means it was closed
// because of some failure and should not be marked as such.
this.writeLedger.setRolledOver(true);
}
this.writeLedger = new WriteLedger(newLedger, ledgerMetadata);
this.logMetadata = metadata;
}
// Close the old ledger. This must be done outside of the lock, otherwise the pending writes (and their callbacks)
// will be invoked within the lock, thus likely candidates for deadlocks.
Ledgers.close(oldLedger);
log.info("{}: Rollover: swapped ledger and metadata pointers (Old = {}, New = {}) and closed old ledger.",
this.traceObjectId, oldLedger.getId(), newLedger.getId());
} finally {
// It's possible that we have writes in the queue that didn't get picked up because they exceeded the predicted
// ledger length. Invoke the Write Processor to execute them.
this.writeProcessor.runAsync();
LoggerHelpers.traceLeave(log, this.traceObjectId, "rollover", traceId, true);
}
} } | public class class_name {
@SneakyThrows(DurableDataLogException.class) // Because this is an arg to SequentialAsyncProcessor, which wants a Runnable.
private void rollover() {
if (this.closed.get()) {
// BookKeeperLog is closed; no point in running this.
return; // depends on control dependency: [if], data = [none]
}
long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "rollover");
val l = getWriteLedger().ledger;
if (!l.isClosed() && l.getLength() < this.config.getBkLedgerMaxSize()) {
// Nothing to do. Trigger the write processor just in case this rollover was invoked because the write
// processor got a pointer to a LedgerHandle that was just closed by a previous run of the rollover processor.
this.writeProcessor.runAsync(); // depends on control dependency: [if], data = [none]
LoggerHelpers.traceLeave(log, this.traceObjectId, "rollover", traceId, false); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
try {
// Create new ledger.
LedgerHandle newLedger = Ledgers.create(this.bookKeeper, this.config);
log.debug("{}: Rollover: created new ledger {}.", this.traceObjectId, newLedger.getId());
// Update the metadata.
LogMetadata metadata = getLogMetadata();
metadata = updateMetadata(metadata, newLedger, false);
LedgerMetadata ledgerMetadata = metadata.getLedger(newLedger.getId());
assert ledgerMetadata != null : "cannot find newly added ledger metadata";
log.debug("{}: Rollover: updated metadata '{}.", this.traceObjectId, metadata);
// Update pointers to the new ledger and metadata.
LedgerHandle oldLedger;
synchronized (this.lock) {
oldLedger = this.writeLedger.ledger;
if (!oldLedger.isClosed()) {
// Only mark the old ledger as Rolled Over if it is still open. Otherwise it means it was closed
// because of some failure and should not be marked as such.
this.writeLedger.setRolledOver(true);
}
this.writeLedger = new WriteLedger(newLedger, ledgerMetadata);
this.logMetadata = metadata;
}
// Close the old ledger. This must be done outside of the lock, otherwise the pending writes (and their callbacks)
// will be invoked within the lock, thus likely candidates for deadlocks.
Ledgers.close(oldLedger);
log.info("{}: Rollover: swapped ledger and metadata pointers (Old = {}, New = {}) and closed old ledger.",
this.traceObjectId, oldLedger.getId(), newLedger.getId());
} finally {
// It's possible that we have writes in the queue that didn't get picked up because they exceeded the predicted
// ledger length. Invoke the Write Processor to execute them.
this.writeProcessor.runAsync();
LoggerHelpers.traceLeave(log, this.traceObjectId, "rollover", traceId, true);
}
} } |
public class class_name {
private boolean validatePath(String rootKey, String toolPath, boolean full) {
if (toolPath.equals(TOOLPATH_SEPARATOR)) {
return true;
}
if (!toolPath.startsWith(TOOLPATH_SEPARATOR)) {
return false;
}
List<String> groups = CmsStringUtil.splitAsList(toolPath, TOOLPATH_SEPARATOR);
Iterator<String> itGroups = groups.iterator();
String subpath = "";
while (itGroups.hasNext()) {
String group = itGroups.next();
if (subpath.length() != TOOLPATH_SEPARATOR.length()) {
subpath += TOOLPATH_SEPARATOR + group;
} else {
subpath += group;
}
if (itGroups.hasNext() || full) {
try {
// just check if the tool is available
resolveAdminTool(rootKey, subpath).toString();
} catch (Exception e) {
return false;
}
}
}
return true;
} } | public class class_name {
private boolean validatePath(String rootKey, String toolPath, boolean full) {
if (toolPath.equals(TOOLPATH_SEPARATOR)) {
return true; // depends on control dependency: [if], data = [none]
}
if (!toolPath.startsWith(TOOLPATH_SEPARATOR)) {
return false; // depends on control dependency: [if], data = [none]
}
List<String> groups = CmsStringUtil.splitAsList(toolPath, TOOLPATH_SEPARATOR);
Iterator<String> itGroups = groups.iterator();
String subpath = "";
while (itGroups.hasNext()) {
String group = itGroups.next();
if (subpath.length() != TOOLPATH_SEPARATOR.length()) {
subpath += TOOLPATH_SEPARATOR + group; // depends on control dependency: [if], data = [none]
} else {
subpath += group; // depends on control dependency: [if], data = [none]
}
if (itGroups.hasNext() || full) {
try {
// just check if the tool is available
resolveAdminTool(rootKey, subpath).toString(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return false;
} // depends on control dependency: [catch], data = [none]
}
}
return true;
} } |
public class class_name {
public String getLocalParameter( String paramName )
{
if ( _additionalParameters != null )
{
String overrideParam = ( String ) _additionalParameters.get( paramName );
if ( overrideParam != null )
{
return overrideParam;
}
}
ServletRequest request = getRequest();
String retVal = request.getParameter( _scopedContainer.getScopedName( paramName ) );
if ( retVal == null && _isActiveRequest && paramName.startsWith( AUTOSCOPE_PREFIX ) )
{
retVal = request.getParameter( paramName );
}
return retVal;
} } | public class class_name {
public String getLocalParameter( String paramName )
{
if ( _additionalParameters != null )
{
String overrideParam = ( String ) _additionalParameters.get( paramName );
if ( overrideParam != null )
{
return overrideParam; // depends on control dependency: [if], data = [none]
}
}
ServletRequest request = getRequest();
String retVal = request.getParameter( _scopedContainer.getScopedName( paramName ) );
if ( retVal == null && _isActiveRequest && paramName.startsWith( AUTOSCOPE_PREFIX ) )
{
retVal = request.getParameter( paramName ); // depends on control dependency: [if], data = [none]
}
return retVal;
} } |
public class class_name {
public float dotProduct(HashSparseVector sv) {
float v =0f;
if(sv.size() < data.size()){
TIntFloatIterator it = sv.data.iterator();
while(it.hasNext()){
it.advance();
v += data.get(it.key())*it.value();
}
}else{
TIntFloatIterator it = data.iterator();
while(it.hasNext()){
it.advance();
v += sv.data.get(it.key())*it.value();
}
}
return v;
} } | public class class_name {
public float dotProduct(HashSparseVector sv) {
float v =0f;
if(sv.size() < data.size()){
TIntFloatIterator it = sv.data.iterator();
while(it.hasNext()){
it.advance();
// depends on control dependency: [while], data = [none]
v += data.get(it.key())*it.value();
// depends on control dependency: [while], data = [none]
}
}else{
TIntFloatIterator it = data.iterator();
while(it.hasNext()){
it.advance();
// depends on control dependency: [while], data = [none]
v += sv.data.get(it.key())*it.value();
// depends on control dependency: [while], data = [none]
}
}
return v;
} } |
public class class_name {
@Override
public EClass getIfcSubContractResourceType() {
if (ifcSubContractResourceTypeEClass == null) {
ifcSubContractResourceTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(669);
}
return ifcSubContractResourceTypeEClass;
} } | public class class_name {
@Override
public EClass getIfcSubContractResourceType() {
if (ifcSubContractResourceTypeEClass == null) {
ifcSubContractResourceTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(669);
// depends on control dependency: [if], data = [none]
}
return ifcSubContractResourceTypeEClass;
} } |
public class class_name {
public static DoubleSupplier softenDoubleSupplier(final CheckedDoubleSupplier s) {
return () -> {
try {
return s.getAsDouble();
} catch (final Throwable e) {
throw throwSoftenedException(e);
}
};
} } | public class class_name {
public static DoubleSupplier softenDoubleSupplier(final CheckedDoubleSupplier s) {
return () -> {
try {
return s.getAsDouble(); // depends on control dependency: [try], data = [none]
} catch (final Throwable e) {
throw throwSoftenedException(e);
} // depends on control dependency: [catch], data = [none]
};
} } |
public class class_name {
public PrintWriter openTrainLogFile() {
String filename = modelDir + File.separator + trainLogFile;
PrintWriter fout = null;
try {
fout = new PrintWriter(new OutputStreamWriter( (new FileOutputStream(filename)), "UTF-8"));
} catch (IOException e) {
System.out.println(e.toString());
return null;
}
return fout;
} } | public class class_name {
public PrintWriter openTrainLogFile() {
String filename = modelDir + File.separator + trainLogFile;
PrintWriter fout = null;
try {
fout = new PrintWriter(new OutputStreamWriter( (new FileOutputStream(filename)), "UTF-8")); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
System.out.println(e.toString());
return null;
} // depends on control dependency: [catch], data = [none]
return fout;
} } |
public class class_name {
public void setSection(MaterialSection section) {
section.select();
syncSectionsState(section);
switch (section.getTarget()) {
case MaterialSection.TARGET_FRAGMENT:
// se l'utente clicca sulla stessa schermata in cui si trova si chiude il drawer e basta
if(section == currentSection) {
if(!deviceSupportMultiPane())
layout.closeDrawer(drawer);
return;
}
changeToolbarColor(section);
setFragment((Fragment) section.getTargetFragment(), section.getTitle(), (Fragment) currentSection.getTargetFragment());
afterFragmentSetted((Fragment) section.getTargetFragment(),section.getTitle());
break;
case MaterialSection.TARGET_ACTIVITY:
this.startActivity(section.getTargetIntent());
if (!deviceSupportMultiPane())
layout.closeDrawer(drawer);
break;
case MaterialSection.TARGET_LISTENER:
// call the section listener
section.getTargetListener().onClick(section);
if (!deviceSupportMultiPane())
layout.closeDrawer(drawer);
default:
break;
}
// se il target e' un activity la sezione corrente rimane quella precedente
if(section.getTarget() != MaterialSection.TARGET_ACTIVITY ) {
syncSectionsState(section);
}
} } | public class class_name {
public void setSection(MaterialSection section) {
section.select();
syncSectionsState(section);
switch (section.getTarget()) {
case MaterialSection.TARGET_FRAGMENT:
// se l'utente clicca sulla stessa schermata in cui si trova si chiude il drawer e basta
if(section == currentSection) {
if(!deviceSupportMultiPane())
layout.closeDrawer(drawer);
return; // depends on control dependency: [if], data = [none]
}
changeToolbarColor(section);
setFragment((Fragment) section.getTargetFragment(), section.getTitle(), (Fragment) currentSection.getTargetFragment());
afterFragmentSetted((Fragment) section.getTargetFragment(),section.getTitle());
break;
case MaterialSection.TARGET_ACTIVITY:
this.startActivity(section.getTargetIntent());
if (!deviceSupportMultiPane())
layout.closeDrawer(drawer);
break;
case MaterialSection.TARGET_LISTENER:
// call the section listener
section.getTargetListener().onClick(section);
if (!deviceSupportMultiPane())
layout.closeDrawer(drawer);
default:
break;
}
// se il target e' un activity la sezione corrente rimane quella precedente
if(section.getTarget() != MaterialSection.TARGET_ACTIVITY ) {
syncSectionsState(section);
}
} } |
public class class_name {
public double getProgressFromResponse(ResponseOnSingeRequest myResponse) {
double progress = 0.0;
try {
if (myResponse == null || myResponse.isFailObtainResponse()) {
return progress;
}
String responseBody = myResponse.getResponseBody();
Pattern regex = Pattern.compile(progressRegex);
Matcher matcher = regex.matcher(responseBody);
if (matcher.matches()) {
String progressStr = matcher.group(1);
progress = Double.parseDouble(progressStr);
}
} catch (Exception t) {
logger.error("fail " + t);
}
return progress;
} } | public class class_name {
public double getProgressFromResponse(ResponseOnSingeRequest myResponse) {
double progress = 0.0;
try {
if (myResponse == null || myResponse.isFailObtainResponse()) {
return progress; // depends on control dependency: [if], data = [none]
}
String responseBody = myResponse.getResponseBody();
Pattern regex = Pattern.compile(progressRegex);
Matcher matcher = regex.matcher(responseBody);
if (matcher.matches()) {
String progressStr = matcher.group(1);
progress = Double.parseDouble(progressStr); // depends on control dependency: [if], data = [none]
}
} catch (Exception t) {
logger.error("fail " + t);
} // depends on control dependency: [catch], data = [none]
return progress;
} } |
public class class_name {
@Override
protected FilterChainResolver createFilterChainResolver() {
FilterChainResolver originalFilterChainResolver = super.createFilterChainResolver();
if (originalFilterChainResolver == null) {
return null;
}
return getFilterChainResolverFactory(originalFilterChainResolver).getInstance();
} } | public class class_name {
@Override
protected FilterChainResolver createFilterChainResolver() {
FilterChainResolver originalFilterChainResolver = super.createFilterChainResolver();
if (originalFilterChainResolver == null) {
return null; // depends on control dependency: [if], data = [none]
}
return getFilterChainResolverFactory(originalFilterChainResolver).getInstance();
} } |
public class class_name {
private ExecuteResult execute(HttpConnection connection) {
InputStream inputStream = null; // input stream - response from server on success
InputStream errorStream = null; // error stream - response from server for a 500 etc
String responseMessage = null;
int responseCode = -1;
Throwable cause = null;
// first try to execute our request and get the input stream with the server's response
// we want to catch IOException because HttpUrlConnection throws these for non-success
// responses (eg 404 throws a FileNotFoundException) but we need to map to our own
// specific exceptions
try {
inputStream = connection.execute().responseAsInputStream();
} catch (IOException ioe) {
cause = ioe;
}
// response code and message will generally be present together or not all
try {
responseCode = connection.getConnection().getResponseCode();
responseMessage = connection.getConnection().getResponseMessage();
} catch (IOException ioe) {
responseMessage = "Error retrieving server response message";
}
// error stream will be present or null if not applicable
errorStream = connection.getConnection().getErrorStream();
try {
ExecuteResult executeResult = new ExecuteResult(inputStream,
errorStream,
responseCode,
responseMessage,
cause
);
return executeResult;
} finally {
// don't close inputStream as the callee still needs it
IOUtils.closeQuietly(errorStream);
}
} } | public class class_name {
private ExecuteResult execute(HttpConnection connection) {
InputStream inputStream = null; // input stream - response from server on success
InputStream errorStream = null; // error stream - response from server for a 500 etc
String responseMessage = null;
int responseCode = -1;
Throwable cause = null;
// first try to execute our request and get the input stream with the server's response
// we want to catch IOException because HttpUrlConnection throws these for non-success
// responses (eg 404 throws a FileNotFoundException) but we need to map to our own
// specific exceptions
try {
inputStream = connection.execute().responseAsInputStream(); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
cause = ioe;
} // depends on control dependency: [catch], data = [none]
// response code and message will generally be present together or not all
try {
responseCode = connection.getConnection().getResponseCode(); // depends on control dependency: [try], data = [none]
responseMessage = connection.getConnection().getResponseMessage(); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
responseMessage = "Error retrieving server response message";
} // depends on control dependency: [catch], data = [none]
// error stream will be present or null if not applicable
errorStream = connection.getConnection().getErrorStream();
try {
ExecuteResult executeResult = new ExecuteResult(inputStream,
errorStream,
responseCode,
responseMessage,
cause
);
return executeResult; // depends on control dependency: [try], data = [none]
} finally {
// don't close inputStream as the callee still needs it
IOUtils.closeQuietly(errorStream);
}
} } |
public class class_name {
private void reInitLayoutElements() {
m_panel.clear();
for (CmsCheckBox cb : m_checkBoxes) {
m_panel.add(setStyle(m_onlyLabels ? new Label(cb.getText()) : cb));
}
} } | public class class_name {
private void reInitLayoutElements() {
m_panel.clear();
for (CmsCheckBox cb : m_checkBoxes) {
m_panel.add(setStyle(m_onlyLabels ? new Label(cb.getText()) : cb)); // depends on control dependency: [for], data = [cb]
}
} } |
public class class_name {
@Override
public Set<? extends Integer> getSubsumerPositions(
IndexedClassExpressionList disjoint) {
if (disjointnessAxioms_ == null) {
return null;
}
return disjointnessAxioms_.get(disjoint);
} } | public class class_name {
@Override
public Set<? extends Integer> getSubsumerPositions(
IndexedClassExpressionList disjoint) {
if (disjointnessAxioms_ == null) {
return null; // depends on control dependency: [if], data = [none]
}
return disjointnessAxioms_.get(disjoint);
} } |
public class class_name {
@Override
void setScanResult(final ScanResult scanResult) {
super.setScanResult(scanResult);
if (value != null) {
value.setScanResult(scanResult);
}
} } | public class class_name {
@Override
void setScanResult(final ScanResult scanResult) {
super.setScanResult(scanResult);
if (value != null) {
value.setScanResult(scanResult); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void addLineOffset(int offset) {
if (numLines >= lineNumberMap.length) {
// Grow the line number map.
int capacity = lineNumberMap.length * 2;
int[] newLineNumberMap = new int[capacity];
System.arraycopy(lineNumberMap, 0, newLineNumberMap, 0, lineNumberMap.length);
lineNumberMap = newLineNumberMap;
}
lineNumberMap[numLines++] = offset;
} } | public class class_name {
public void addLineOffset(int offset) {
if (numLines >= lineNumberMap.length) {
// Grow the line number map.
int capacity = lineNumberMap.length * 2;
int[] newLineNumberMap = new int[capacity];
System.arraycopy(lineNumberMap, 0, newLineNumberMap, 0, lineNumberMap.length); // depends on control dependency: [if], data = [none]
lineNumberMap = newLineNumberMap; // depends on control dependency: [if], data = [none]
}
lineNumberMap[numLines++] = offset;
} } |
public class class_name {
@GwtIncompatible // java.lang.reflect
@NullableDecl
private static Method getSizeMethod() {
try {
Method getStackTraceDepth = getJlaMethod("getStackTraceDepth", Throwable.class);
if (getStackTraceDepth == null) {
return null;
}
getStackTraceDepth.invoke(getJLA(), new Throwable());
return getStackTraceDepth;
} catch (UnsupportedOperationException | IllegalAccessException | InvocationTargetException e) {
return null;
}
} } | public class class_name {
@GwtIncompatible // java.lang.reflect
@NullableDecl
private static Method getSizeMethod() {
try {
Method getStackTraceDepth = getJlaMethod("getStackTraceDepth", Throwable.class);
if (getStackTraceDepth == null) {
return null; // depends on control dependency: [if], data = [none]
}
getStackTraceDepth.invoke(getJLA(), new Throwable()); // depends on control dependency: [try], data = [none]
return getStackTraceDepth; // depends on control dependency: [try], data = [none]
} catch (UnsupportedOperationException | IllegalAccessException | InvocationTargetException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setThemeIfCurrentEmpty(String themeName) {
if (themeName == null || themeName.isEmpty()) return;
String theme = getTheme();
if (theme == null || theme.isEmpty()) {
setTheme(themeName);
}
} } | public class class_name {
public void setThemeIfCurrentEmpty(String themeName) {
if (themeName == null || themeName.isEmpty()) return;
String theme = getTheme();
if (theme == null || theme.isEmpty()) {
setTheme(themeName); // depends on control dependency: [if], data = [(theme]
}
} } |
public class class_name {
@Override
@SuppressWarnings("unchecked")
public <QT extends Enum> QT convert(String value, Class<QT> enumType) {
try {
Enum enumInstance = Enum.valueOf(enumType, value);
return enumType.cast(enumInstance);
}
catch (Exception cause) {
throw newConversionException(cause, "[%1$s] is not a valid enumerated value of Enum [%2$s]",
value, enumType.getName());
}
} } | public class class_name {
@Override
@SuppressWarnings("unchecked")
public <QT extends Enum> QT convert(String value, Class<QT> enumType) {
try {
Enum enumInstance = Enum.valueOf(enumType, value);
return enumType.cast(enumInstance); // depends on control dependency: [try], data = [none]
}
catch (Exception cause) {
throw newConversionException(cause, "[%1$s] is not a valid enumerated value of Enum [%2$s]",
value, enumType.getName());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int getNumSetBits(ByteBuffer bfBuffer, int start)
{
ByteBuffer view = bfBuffer.duplicate().order(ByteOrder.BIG_ENDIAN);
view.position(start);
int numLongs = view.getInt(1 + start);
int setBits = 0;
for (int i = 0, pos = START_OF_SERIALIZED_LONGS + start; i < numLongs; i++, pos += Long.BYTES) {
setBits += Long.bitCount(view.getLong(pos));
}
return setBits;
} } | public class class_name {
public static int getNumSetBits(ByteBuffer bfBuffer, int start)
{
ByteBuffer view = bfBuffer.duplicate().order(ByteOrder.BIG_ENDIAN);
view.position(start);
int numLongs = view.getInt(1 + start);
int setBits = 0;
for (int i = 0, pos = START_OF_SERIALIZED_LONGS + start; i < numLongs; i++, pos += Long.BYTES) {
setBits += Long.bitCount(view.getLong(pos)); // depends on control dependency: [for], data = [none]
}
return setBits;
} } |
public class class_name {
public static List<MethodNode> findMethodsWithName(Collection<MethodNode> methodNodes, String name) {
Validate.notNull(methodNodes);
Validate.notNull(name);
Validate.noNullElements(methodNodes);
List<MethodNode> ret = new ArrayList<>();
for (MethodNode methodNode : methodNodes) {
if (methodNode.name.equals(name)) {
ret.add(methodNode);
}
}
return ret;
} } | public class class_name {
public static List<MethodNode> findMethodsWithName(Collection<MethodNode> methodNodes, String name) {
Validate.notNull(methodNodes);
Validate.notNull(name);
Validate.noNullElements(methodNodes);
List<MethodNode> ret = new ArrayList<>();
for (MethodNode methodNode : methodNodes) {
if (methodNode.name.equals(name)) {
ret.add(methodNode); // depends on control dependency: [if], data = [none]
}
}
return ret;
} } |
public class class_name {
public boolean supportsClustering(final AbstractType<?> type) {
for (AbstractType<?> supportedClusteringType : supportedClusteringTypes) {
if (type.getClass() == supportedClusteringType.getClass()) {
return true;
}
}
return false;
} } | public class class_name {
public boolean supportsClustering(final AbstractType<?> type) {
for (AbstractType<?> supportedClusteringType : supportedClusteringTypes) {
if (type.getClass() == supportedClusteringType.getClass()) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
private int prepareCanvasWithClosestCachedFrame(int previousFrameNumber, Canvas canvas) {
for (int index = previousFrameNumber; index >= 0; index--) {
FrameNeededResult neededResult = isFrameNeededForRendering(index);
switch (neededResult) {
case REQUIRED:
AnimatedDrawableFrameInfo frameInfo = mAnimatedDrawableBackend.getFrameInfo(index);
CloseableReference<Bitmap> startBitmap = mCallback.getCachedBitmap(index);
if (startBitmap != null) {
try {
canvas.drawBitmap(startBitmap.get(), 0, 0, null);
if (frameInfo.disposalMethod == DisposalMethod.DISPOSE_TO_BACKGROUND) {
disposeToBackground(canvas, frameInfo);
}
return index + 1;
} finally {
startBitmap.close();
}
} else {
if (isKeyFrame(index)) {
return index;
} else {
// Keep going.
break;
}
}
case NOT_REQUIRED:
return index + 1;
case ABORT:
return index;
case SKIP:
default:
// Keep going.
}
}
return 0;
} } | public class class_name {
private int prepareCanvasWithClosestCachedFrame(int previousFrameNumber, Canvas canvas) {
for (int index = previousFrameNumber; index >= 0; index--) {
FrameNeededResult neededResult = isFrameNeededForRendering(index);
switch (neededResult) {
case REQUIRED:
AnimatedDrawableFrameInfo frameInfo = mAnimatedDrawableBackend.getFrameInfo(index);
CloseableReference<Bitmap> startBitmap = mCallback.getCachedBitmap(index);
if (startBitmap != null) {
try {
canvas.drawBitmap(startBitmap.get(), 0, 0, null); // depends on control dependency: [try], data = [none]
if (frameInfo.disposalMethod == DisposalMethod.DISPOSE_TO_BACKGROUND) {
disposeToBackground(canvas, frameInfo); // depends on control dependency: [if], data = [none]
}
return index + 1; // depends on control dependency: [try], data = [none]
} finally {
startBitmap.close();
}
} else {
if (isKeyFrame(index)) {
return index; // depends on control dependency: [if], data = [none]
} else {
// Keep going.
break;
}
}
case NOT_REQUIRED:
return index + 1;
case ABORT:
return index;
case SKIP:
default:
// Keep going.
}
}
return 0;
} } |
public class class_name {
public synchronized Iterator idIterator()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "idIterator");
final LinkedList<Integer> linkedList = new LinkedList<Integer>();
final Iterator iterator = table.values().iterator();
while(iterator.hasNext())
{
final RequestIdTableEntry tableEntry = (RequestIdTableEntry)iterator.next();
linkedList.add(Integer.valueOf(tableEntry.requestId));
}
final Iterator result = linkedList.iterator();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "idIterator", result);
return result;
} } | public class class_name {
public synchronized Iterator idIterator()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "idIterator");
final LinkedList<Integer> linkedList = new LinkedList<Integer>();
final Iterator iterator = table.values().iterator();
while(iterator.hasNext())
{
final RequestIdTableEntry tableEntry = (RequestIdTableEntry)iterator.next();
linkedList.add(Integer.valueOf(tableEntry.requestId)); // depends on control dependency: [while], data = [none]
}
final Iterator result = linkedList.iterator();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "idIterator", result);
return result;
} } |
public class class_name {
private static FaxJobMonitor getFaxJobMonitor()
{
//get system configuration
Map<String,String> systemConfig=LibraryConfigurationLoader.getSystemConfiguration();
if(FaxClientSpiFactory.faxJobMonitor==null)
{
synchronized(FaxClientSpiFactory.class)
{
if(FaxClientSpiFactory.faxJobMonitor==null)
{
//create fax job monitor
FaxJobMonitor localFaxJobMonitor=FaxClientSpiFactory.createFaxJobMonitor(systemConfig);
//get logger
Logger localLogger=FaxClientSpiFactory.getLogger();
//initialize
localFaxJobMonitor.initialize(systemConfig,localLogger);
//keep reference
FaxClientSpiFactory.faxJobMonitor=localFaxJobMonitor;
}
}
}
return FaxClientSpiFactory.faxJobMonitor;
} } | public class class_name {
private static FaxJobMonitor getFaxJobMonitor()
{
//get system configuration
Map<String,String> systemConfig=LibraryConfigurationLoader.getSystemConfiguration();
if(FaxClientSpiFactory.faxJobMonitor==null)
{
synchronized(FaxClientSpiFactory.class) // depends on control dependency: [if], data = [none]
{
if(FaxClientSpiFactory.faxJobMonitor==null)
{
//create fax job monitor
FaxJobMonitor localFaxJobMonitor=FaxClientSpiFactory.createFaxJobMonitor(systemConfig);
//get logger
Logger localLogger=FaxClientSpiFactory.getLogger();
//initialize
localFaxJobMonitor.initialize(systemConfig,localLogger); // depends on control dependency: [if], data = [none]
//keep reference
FaxClientSpiFactory.faxJobMonitor=localFaxJobMonitor; // depends on control dependency: [if], data = [none]
}
}
}
return FaxClientSpiFactory.faxJobMonitor;
} } |
public class class_name {
public String getPageHtml(String url) {
HttpClient httpClient = new HttpClient();
httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(2000);
httpClient.getHttpConnectionManager().getParams().setSoTimeout(3000);
GetMethod getMethod = new GetMethod(url);
try {
int statusCode = httpClient.executeMethod(getMethod);
if (statusCode != HttpStatus.SC_OK) {
LOG.warn("HttpStatus not equal to 200, some problems may occurred:"
+ getMethod.getStatusLine());
}
InputStream inputStream = getMethod.getResponseBodyAsStream();
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
StringBuffer stringBuffer = new StringBuffer();
String html = "";
while ((html = br.readLine()) != null) {
stringBuffer.append(html);
}
return stringBuffer.toString();
} catch (Exception e) {
LOG.error("Error to get html of url=" + url + " due to " + e.getMessage());
throw new RuntimeException("Get html failed, " + e.getMessage(), e);
} finally {
try {
getMethod.releaseConnection();
} catch (Exception e2) {
// TODO: handle exception
}
}
} } | public class class_name {
public String getPageHtml(String url) {
HttpClient httpClient = new HttpClient();
httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(2000);
httpClient.getHttpConnectionManager().getParams().setSoTimeout(3000);
GetMethod getMethod = new GetMethod(url);
try {
int statusCode = httpClient.executeMethod(getMethod);
if (statusCode != HttpStatus.SC_OK) {
LOG.warn("HttpStatus not equal to 200, some problems may occurred:"
+ getMethod.getStatusLine()); // depends on control dependency: [if], data = [none]
}
InputStream inputStream = getMethod.getResponseBodyAsStream();
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
StringBuffer stringBuffer = new StringBuffer();
String html = "";
while ((html = br.readLine()) != null) {
stringBuffer.append(html); // depends on control dependency: [while], data = [none]
}
return stringBuffer.toString(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("Error to get html of url=" + url + " due to " + e.getMessage());
throw new RuntimeException("Get html failed, " + e.getMessage(), e);
} finally { // depends on control dependency: [catch], data = [none]
try {
getMethod.releaseConnection(); // depends on control dependency: [try], data = [none]
} catch (Exception e2) {
// TODO: handle exception
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static String repeat(char ch, int repeat) {
if (repeat <= 0) return Empty;
char[] buf = new char[repeat];
for (int i = repeat - 1; i >= 0; i--) {
buf[i] = ch;
}
return new String(buf);
} } | public class class_name {
public static String repeat(char ch, int repeat) {
if (repeat <= 0) return Empty;
char[] buf = new char[repeat];
for (int i = repeat - 1; i >= 0; i--) {
buf[i] = ch; // depends on control dependency: [for], data = [i]
}
return new String(buf);
} } |
public class class_name {
public void hangup(boolean shouldSendHangupSignal) {
if (!isHangingUp) {
isHangingUp = true;
if (shouldSendHangupSignal) {
try {
JSONObject data = new JSONObject("{'signalType':'bye','version':'1.0'}");
data.put("target", directConnectionOnly ? "directConnection" : "call");
data.put("sessionId", sessionID);
data.put("signalId", Respoke.makeGUID());
// Keep a second reference to the listener since the disconnect method will clear it before the success handler is fired
final WeakReference<Listener> hangupListener = listenerReference;
if (null != signalingChannel) {
signalingChannel.sendSignal(data, toEndpointId, toConnection, toType, true, new Respoke.TaskCompletionListener() {
@Override
public void onSuccess() {
if (null != hangupListener) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() {
Listener listener = hangupListener.get();
if (null != listener) {
listener.onHangup(RespokeCall.this);
}
}
});
}
}
@Override
public void onError(String errorMessage) {
postErrorToListener(errorMessage);
}
});
}
} catch (JSONException e) {
postErrorToListener("Error encoding signal to json");
}
}
disconnect();
}
} } | public class class_name {
public void hangup(boolean shouldSendHangupSignal) {
if (!isHangingUp) {
isHangingUp = true; // depends on control dependency: [if], data = [none]
if (shouldSendHangupSignal) {
try {
JSONObject data = new JSONObject("{'signalType':'bye','version':'1.0'}");
data.put("target", directConnectionOnly ? "directConnection" : "call"); // depends on control dependency: [try], data = [none]
data.put("sessionId", sessionID); // depends on control dependency: [try], data = [none]
data.put("signalId", Respoke.makeGUID()); // depends on control dependency: [try], data = [none]
// Keep a second reference to the listener since the disconnect method will clear it before the success handler is fired
final WeakReference<Listener> hangupListener = listenerReference;
if (null != signalingChannel) {
signalingChannel.sendSignal(data, toEndpointId, toConnection, toType, true, new Respoke.TaskCompletionListener() {
@Override
public void onSuccess() {
if (null != hangupListener) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
public void run() {
Listener listener = hangupListener.get();
if (null != listener) {
listener.onHangup(RespokeCall.this); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
}
}
@Override
public void onError(String errorMessage) {
postErrorToListener(errorMessage);
}
}); // depends on control dependency: [if], data = [none]
}
} catch (JSONException e) {
postErrorToListener("Error encoding signal to json");
} // depends on control dependency: [catch], data = [none]
}
disconnect(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean hasModelGroupAncestor(CmsJspStandardContextBean standardContext) {
boolean result = false;
if (!standardContext.isModelGroupPage()) {
CmsContainerElementWrapper parent = standardContext.getElement();
while ((parent != null) && !result) {
result = parent.isModelGroup();
parent = parent.getParent();
}
}
return result;
} } | public class class_name {
private boolean hasModelGroupAncestor(CmsJspStandardContextBean standardContext) {
boolean result = false;
if (!standardContext.isModelGroupPage()) {
CmsContainerElementWrapper parent = standardContext.getElement();
while ((parent != null) && !result) {
result = parent.isModelGroup(); // depends on control dependency: [while], data = [none]
parent = parent.getParent(); // depends on control dependency: [while], data = [none]
}
}
return result;
} } |
public class class_name {
private void initTables(final JdbcTemplate jdbcTemplate) {
this.tables = OtterMigrateMap.makeSoftValueComputingMap(new Function<List<String>, Table>() {
public Table apply(List<String> names) {
Assert.isTrue(names.size() == 2);
try {
beforeFindTable(jdbcTemplate, names.get(0), names.get(0), names.get(1));
DdlUtilsFilter filter = getDdlUtilsFilter(jdbcTemplate, names.get(0), names.get(0), names.get(1));
Table table = DdlUtils.findTable(jdbcTemplate, names.get(0), names.get(0), names.get(1), filter);
afterFindTable(table, jdbcTemplate, names.get(0), names.get(0), names.get(1));
if (table == null) {
throw new NestableRuntimeException("no found table [" + names.get(0) + "." + names.get(1)
+ "] , pls check");
} else {
return table;
}
} catch (Exception e) {
throw new NestableRuntimeException("find table [" + names.get(0) + "." + names.get(1) + "] error",
e);
}
}
});
} } | public class class_name {
private void initTables(final JdbcTemplate jdbcTemplate) {
this.tables = OtterMigrateMap.makeSoftValueComputingMap(new Function<List<String>, Table>() {
public Table apply(List<String> names) {
Assert.isTrue(names.size() == 2);
try {
beforeFindTable(jdbcTemplate, names.get(0), names.get(0), names.get(1)); // depends on control dependency: [try], data = [none]
DdlUtilsFilter filter = getDdlUtilsFilter(jdbcTemplate, names.get(0), names.get(0), names.get(1));
Table table = DdlUtils.findTable(jdbcTemplate, names.get(0), names.get(0), names.get(1), filter);
afterFindTable(table, jdbcTemplate, names.get(0), names.get(0), names.get(1)); // depends on control dependency: [try], data = [none]
if (table == null) {
throw new NestableRuntimeException("no found table [" + names.get(0) + "." + names.get(1)
+ "] , pls check");
} else {
return table; // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
throw new NestableRuntimeException("find table [" + names.get(0) + "." + names.get(1) + "] error",
e);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public Object getObject(int columnIndex) throws SQLException {
checkColumn(columnIndex);
Type sourceType = resultMetaData.columnTypes[columnIndex - 1];
switch (sourceType.typeCode) {
case Types.SQL_DATE :
return getDate(columnIndex);
case Types.SQL_TIME :
case Types.SQL_TIME_WITH_TIME_ZONE :
return getTime(columnIndex);
case Types.SQL_TIMESTAMP :
case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
return getTimestamp(columnIndex);
case Types.SQL_BINARY :
case Types.SQL_VARBINARY :
return getBytes(columnIndex);
case Types.OTHER :
case Types.JAVA_OBJECT : {
Object o = getColumnInType(columnIndex, sourceType);
if (o == null) {
return null;
}
try {
return ((JavaObjectData) o).getObject();
} catch (HsqlException e) {
throw Util.sqlException(e);
}
}
default :
return getColumnInType(columnIndex, sourceType);
}
} } | public class class_name {
public Object getObject(int columnIndex) throws SQLException {
checkColumn(columnIndex);
Type sourceType = resultMetaData.columnTypes[columnIndex - 1];
switch (sourceType.typeCode) {
case Types.SQL_DATE :
return getDate(columnIndex);
case Types.SQL_TIME :
case Types.SQL_TIME_WITH_TIME_ZONE :
return getTime(columnIndex);
case Types.SQL_TIMESTAMP :
case Types.SQL_TIMESTAMP_WITH_TIME_ZONE :
return getTimestamp(columnIndex);
case Types.SQL_BINARY :
case Types.SQL_VARBINARY :
return getBytes(columnIndex);
case Types.OTHER :
case Types.JAVA_OBJECT : {
Object o = getColumnInType(columnIndex, sourceType);
if (o == null) {
return null; // depends on control dependency: [if], data = [none]
}
try {
return ((JavaObjectData) o).getObject(); // depends on control dependency: [try], data = [none]
} catch (HsqlException e) {
throw Util.sqlException(e);
} // depends on control dependency: [catch], data = [none]
}
default :
return getColumnInType(columnIndex, sourceType);
}
} } |
public class class_name {
@Override
protected void estimateFeatureScores(Map<Object, Double> featureScores, int N, Map<Object, Integer> classCounts, Map<List<Object>, Integer> featureClassCounts, Map<Object, Double> featureCounts) {
logger.debug("estimateFeatureScores()");
final double log2 = Math.log(2.0);
streamExecutor.forEach(StreamMethods.stream(featureCounts.entrySet().stream(), isParallelized()), featureCount -> {
Object feature = featureCount.getKey();
double N1_ = featureCount.getValue(); //calculate the N1. (number of records that has the feature)
double N0_ = N - N1_; //also the N0. (number of records that DONT have the feature)
double bestScore = Double.NEGATIVE_INFINITY;
for(Map.Entry<Object, Integer> classCount : classCounts.entrySet()) {
Object theClass = classCount.getKey();
double N_1 = classCount.getValue();
double N_0 = N - N_1;
Integer featureClassC = featureClassCounts.get(Arrays.asList(feature, theClass));
double N11 = (featureClassC!=null)?featureClassC.doubleValue():0.0; //N11 is the number of records that have the feature and belong on the specific class
double N01 = N_1 - N11; //N01 is the total number of records that do not have the particular feature BUT they belong to the specific class
double N00 = N0_ - N01;
double N10 = N1_ - N11;
//calculate Mutual Information
//Note we calculate it partially because if one of the N.. is zero the log will not be defined and it will return NAN.
double scorevalue=0.0;
if(N11>0.0) {
scorevalue+=(N11/N)*Math.log((N/N1_)*(N11/N_1))/log2;
}
if(N01>0.0) {
scorevalue+=(N01/N)*Math.log((N/N0_)*(N01/N_1))/log2;
}
if(N10>0.0) {
scorevalue+=(N10/N)*Math.log((N/N1_)*(N10/N_0))/log2;
}
if(N00>0.0) {
scorevalue+=(N00/N)*Math.log((N/N0_)*(N00/N_0))/log2;
}
if(scorevalue>bestScore) {
bestScore = scorevalue;
}
}
featureScores.put(feature, bestScore); //This Map is concurrent and there are no overlaping keys between threads
});
} } | public class class_name {
@Override
protected void estimateFeatureScores(Map<Object, Double> featureScores, int N, Map<Object, Integer> classCounts, Map<List<Object>, Integer> featureClassCounts, Map<Object, Double> featureCounts) {
logger.debug("estimateFeatureScores()");
final double log2 = Math.log(2.0);
streamExecutor.forEach(StreamMethods.stream(featureCounts.entrySet().stream(), isParallelized()), featureCount -> {
Object feature = featureCount.getKey();
double N1_ = featureCount.getValue(); //calculate the N1. (number of records that has the feature)
double N0_ = N - N1_; //also the N0. (number of records that DONT have the feature)
double bestScore = Double.NEGATIVE_INFINITY;
for(Map.Entry<Object, Integer> classCount : classCounts.entrySet()) {
Object theClass = classCount.getKey();
double N_1 = classCount.getValue();
double N_0 = N - N_1;
Integer featureClassC = featureClassCounts.get(Arrays.asList(feature, theClass));
double N11 = (featureClassC!=null)?featureClassC.doubleValue():0.0; //N11 is the number of records that have the feature and belong on the specific class
double N01 = N_1 - N11; //N01 is the total number of records that do not have the particular feature BUT they belong to the specific class
double N00 = N0_ - N01;
double N10 = N1_ - N11;
//calculate Mutual Information
//Note we calculate it partially because if one of the N.. is zero the log will not be defined and it will return NAN.
double scorevalue=0.0;
if(N11>0.0) {
scorevalue+=(N11/N)*Math.log((N/N1_)*(N11/N_1))/log2; // depends on control dependency: [if], data = [(N11]
}
if(N01>0.0) {
scorevalue+=(N01/N)*Math.log((N/N0_)*(N01/N_1))/log2; // depends on control dependency: [if], data = [(N01]
}
if(N10>0.0) {
scorevalue+=(N10/N)*Math.log((N/N1_)*(N10/N_0))/log2; // depends on control dependency: [if], data = [(N10]
}
if(N00>0.0) {
scorevalue+=(N00/N)*Math.log((N/N0_)*(N00/N_0))/log2; // depends on control dependency: [if], data = [(N00]
}
if(scorevalue>bestScore) {
bestScore = scorevalue; // depends on control dependency: [if], data = [none]
}
}
featureScores.put(feature, bestScore); //This Map is concurrent and there are no overlaping keys between threads
});
} } |
public class class_name {
private double compare_(String s1, String s2) {
// before we begin, note the length of the strings
int shortlen = Math.min(s1.length(), s2.length());
int longlen = Math.max(s1.length(), s2.length());
int removed = 0; // total length of common substrings
while (true) {
// first, we identify the longest common substring
int longest = 0;
int longesti = 0;
int longestj = 0;
int[][] matrix = new int[s1.length()][s2.length()];
for (int i = 0; i < s1.length(); i++) {
for (int j = 0; j < s2.length(); j++) {
if (s1.charAt(i) == s2.charAt(j)) {
if (i == 0 || j == 0)
matrix[i][j] = 1;
else
matrix[i][j] = matrix[i - 1][j - 1] + 1;
if (matrix[i][j] > longest) {
longest = matrix[i][j];
longesti = i;
longestj = j;
}
} else
matrix[i][j] = 0;
}
}
longesti++; // this solves an off-by-one problem
longestj++; // this solves an off-by-one problem
// at this point we know the length of the longest common
// substring, and also its location, since it ends at indexes
// longesti and longestj.
if (longest < minlen)
break; // all remaining common substrings are too short, so we stop
// now we slice away the common substrings
s1 = s1.substring(0, longesti - longest) + s1.substring(longesti);
s2 = s2.substring(0, longestj - longest) + s2.substring(longestj);
removed += longest;
}
return formula.compute(removed, shortlen, longlen);
} } | public class class_name {
private double compare_(String s1, String s2) {
// before we begin, note the length of the strings
int shortlen = Math.min(s1.length(), s2.length());
int longlen = Math.max(s1.length(), s2.length());
int removed = 0; // total length of common substrings
while (true) {
// first, we identify the longest common substring
int longest = 0;
int longesti = 0;
int longestj = 0;
int[][] matrix = new int[s1.length()][s2.length()];
for (int i = 0; i < s1.length(); i++) {
for (int j = 0; j < s2.length(); j++) {
if (s1.charAt(i) == s2.charAt(j)) {
if (i == 0 || j == 0)
matrix[i][j] = 1;
else
matrix[i][j] = matrix[i - 1][j - 1] + 1;
if (matrix[i][j] > longest) {
longest = matrix[i][j]; // depends on control dependency: [if], data = [none]
longesti = i; // depends on control dependency: [if], data = [none]
longestj = j; // depends on control dependency: [if], data = [none]
}
} else
matrix[i][j] = 0;
}
}
longesti++; // this solves an off-by-one problem // depends on control dependency: [while], data = [none]
longestj++; // this solves an off-by-one problem // depends on control dependency: [while], data = [none]
// at this point we know the length of the longest common
// substring, and also its location, since it ends at indexes
// longesti and longestj.
if (longest < minlen)
break; // all remaining common substrings are too short, so we stop
// now we slice away the common substrings
s1 = s1.substring(0, longesti - longest) + s1.substring(longesti); // depends on control dependency: [while], data = [none]
s2 = s2.substring(0, longestj - longest) + s2.substring(longestj); // depends on control dependency: [while], data = [none]
removed += longest; // depends on control dependency: [while], data = [none]
}
return formula.compute(removed, shortlen, longlen);
} } |
public class class_name {
public HMM<O> learn(int[][] observations, int iterations) {
HMM<O> hmm = this;
for (int iter = 0; iter < iterations; iter++) {
hmm = hmm.iterate(observations);
}
return hmm;
} } | public class class_name {
public HMM<O> learn(int[][] observations, int iterations) {
HMM<O> hmm = this;
for (int iter = 0; iter < iterations; iter++) {
hmm = hmm.iterate(observations); // depends on control dependency: [for], data = [none]
}
return hmm;
} } |
public class class_name {
private String findQualifierName(VariableElement element) {
String name = null;
if (element.getAnnotationMirrors().isEmpty()) {
return name;
}
for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) {
TypeElement annotationTypeElement = (TypeElement) annotationMirror.getAnnotationType().asElement();
if (isSameType(annotationTypeElement, "javax.inject.Named")) {
checkIfAlreadyHasName(element, name);
name = getValueOfAnnotation(annotationMirror);
} else if (annotationTypeElement.getAnnotation(javax.inject.Qualifier.class) != null) {
checkIfAlreadyHasName(element, name);
name = annotationTypeElement.getQualifiedName().toString();
}
}
return name;
} } | public class class_name {
private String findQualifierName(VariableElement element) {
String name = null;
if (element.getAnnotationMirrors().isEmpty()) {
return name; // depends on control dependency: [if], data = [none]
}
for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) {
TypeElement annotationTypeElement = (TypeElement) annotationMirror.getAnnotationType().asElement();
if (isSameType(annotationTypeElement, "javax.inject.Named")) {
checkIfAlreadyHasName(element, name);
name = getValueOfAnnotation(annotationMirror);
} else if (annotationTypeElement.getAnnotation(javax.inject.Qualifier.class) != null) {
checkIfAlreadyHasName(element, name);
name = annotationTypeElement.getQualifiedName().toString(); // depends on control dependency: [for], data = [none]
}
}
return name;
} } |
public class class_name {
public static FlowControlSupplier unicastFlowControlSupplier()
{
FlowControlSupplier supplier = null;
try
{
final String className = getProperty(UNICAST_FLOW_CONTROL_STRATEGY_SUPPLIER_PROP_NAME);
if (null == className)
{
return new DefaultUnicastFlowControlSupplier();
}
supplier = (FlowControlSupplier)Class.forName(className).getConstructor().newInstance();
}
catch (final Exception ex)
{
LangUtil.rethrowUnchecked(ex);
}
return supplier;
} } | public class class_name {
public static FlowControlSupplier unicastFlowControlSupplier()
{
FlowControlSupplier supplier = null;
try
{
final String className = getProperty(UNICAST_FLOW_CONTROL_STRATEGY_SUPPLIER_PROP_NAME);
if (null == className)
{
return new DefaultUnicastFlowControlSupplier(); // depends on control dependency: [if], data = [none]
}
supplier = (FlowControlSupplier)Class.forName(className).getConstructor().newInstance(); // depends on control dependency: [try], data = [none]
}
catch (final Exception ex)
{
LangUtil.rethrowUnchecked(ex);
} // depends on control dependency: [catch], data = [none]
return supplier;
} } |
public class class_name {
public void setEnableCloudwatchLogsExports(java.util.Collection<String> enableCloudwatchLogsExports) {
if (enableCloudwatchLogsExports == null) {
this.enableCloudwatchLogsExports = null;
return;
}
this.enableCloudwatchLogsExports = new java.util.ArrayList<String>(enableCloudwatchLogsExports);
} } | public class class_name {
public void setEnableCloudwatchLogsExports(java.util.Collection<String> enableCloudwatchLogsExports) {
if (enableCloudwatchLogsExports == null) {
this.enableCloudwatchLogsExports = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.enableCloudwatchLogsExports = new java.util.ArrayList<String>(enableCloudwatchLogsExports);
} } |
public class class_name {
public static void orToContainer(final BitmapStorage container,
final EWAHCompressedBitmap... bitmaps) {
if (bitmaps.length < 2)
throw new IllegalArgumentException(
"We need at least two bitmaps");
PriorityQueue<EWAHCompressedBitmap> pq = new PriorityQueue<EWAHCompressedBitmap>(
bitmaps.length, new Comparator<EWAHCompressedBitmap>() {
@Override
public int compare(EWAHCompressedBitmap a,
EWAHCompressedBitmap b) {
return a.sizeInBytes()
- b.sizeInBytes();
}
}
);
Collections.addAll(pq, bitmaps);
while (pq.size() > 2) {
EWAHCompressedBitmap x1 = pq.poll();
EWAHCompressedBitmap x2 = pq.poll();
pq.add(x1.or(x2));
}
pq.poll().orToContainer(pq.poll(), container);
} } | public class class_name {
public static void orToContainer(final BitmapStorage container,
final EWAHCompressedBitmap... bitmaps) {
if (bitmaps.length < 2)
throw new IllegalArgumentException(
"We need at least two bitmaps");
PriorityQueue<EWAHCompressedBitmap> pq = new PriorityQueue<EWAHCompressedBitmap>(
bitmaps.length, new Comparator<EWAHCompressedBitmap>() {
@Override
public int compare(EWAHCompressedBitmap a,
EWAHCompressedBitmap b) {
return a.sizeInBytes()
- b.sizeInBytes();
}
}
);
Collections.addAll(pq, bitmaps);
while (pq.size() > 2) {
EWAHCompressedBitmap x1 = pq.poll();
EWAHCompressedBitmap x2 = pq.poll();
pq.add(x1.or(x2)); // depends on control dependency: [while], data = [2)]
}
pq.poll().orToContainer(pq.poll(), container);
} } |
public class class_name {
public final double getDouble() {
if (count == 0) {
return 0.0;
}
StringBuffer temp = getStringBuffer();
temp.append('.');
temp.append(digits, 0, count);
temp.append('E');
temp.append(decimalAt);
return Double.parseDouble(temp.toString());
} } | public class class_name {
public final double getDouble() {
if (count == 0) {
return 0.0; // depends on control dependency: [if], data = [none]
}
StringBuffer temp = getStringBuffer();
temp.append('.');
temp.append(digits, 0, count);
temp.append('E');
temp.append(decimalAt);
return Double.parseDouble(temp.toString());
} } |
public class class_name {
private void addUserProvidersToMap(Map<String, String> propertiesMap) {
if (userDefinedProviders.length != 0) {
for (PropertiesProvider provider : userDefinedProviders) {
propertiesMap.putAll(provider.getProperties());
}
}
} } | public class class_name {
private void addUserProvidersToMap(Map<String, String> propertiesMap) {
if (userDefinedProviders.length != 0) {
for (PropertiesProvider provider : userDefinedProviders) {
propertiesMap.putAll(provider.getProperties()); // depends on control dependency: [for], data = [provider]
}
}
} } |
public class class_name {
public static boolean copy(InputStream input, OutputStream output, int bufferSize)
{
try
{
byte[] buffer = new byte[bufferSize];
int read = input.read(buffer);
while (read != -1) {
output.write(buffer, 0, read);
read = input.read(buffer);
}
output.flush();
}
catch (IOException e) {
return false;
}
return true;
} } | public class class_name {
public static boolean copy(InputStream input, OutputStream output, int bufferSize)
{
try
{
byte[] buffer = new byte[bufferSize];
int read = input.read(buffer);
while (read != -1) {
output.write(buffer, 0, read); // depends on control dependency: [while], data = [none]
read = input.read(buffer); // depends on control dependency: [while], data = [none]
}
output.flush(); // depends on control dependency: [try], data = [none]
}
catch (IOException e) {
return false;
} // depends on control dependency: [catch], data = [none]
return true;
} } |
public class class_name {
public BaseField[][] getDataMap(Record recSummary, Record recBasis)
{
int iFieldSeq = 0;
if (recSummary.getField(iFieldSeq) == recSummary.getCounterField())
iFieldSeq++;
int iLength = recSummary.getFieldCount();
iLength = iLength - recSummary.getKeyArea().getKeyFields() - iFieldSeq;
BaseField[][] mxDataFields = new BaseField[iLength][2];
for (int i = 0; i < mxDataFields.length; i++)
{
mxDataFields[i][SUMMARY] = recSummary.getField(iFieldSeq);
mxDataFields[i][BASIS] = this.getBasisField(mxDataFields[i][SUMMARY], recBasis, i);
iFieldSeq++;
for (int j = 0; j < recSummary.getKeyArea().getKeyFields(); j++)
{
if (mxDataFields[i][SUMMARY] == recSummary.getKeyArea().getField(j))
{
i--; // Skip this one, it is in the key area.
break;
}
}
}
return mxDataFields;
} } | public class class_name {
public BaseField[][] getDataMap(Record recSummary, Record recBasis)
{
int iFieldSeq = 0;
if (recSummary.getField(iFieldSeq) == recSummary.getCounterField())
iFieldSeq++;
int iLength = recSummary.getFieldCount();
iLength = iLength - recSummary.getKeyArea().getKeyFields() - iFieldSeq;
BaseField[][] mxDataFields = new BaseField[iLength][2];
for (int i = 0; i < mxDataFields.length; i++)
{
mxDataFields[i][SUMMARY] = recSummary.getField(iFieldSeq); // depends on control dependency: [for], data = [i]
mxDataFields[i][BASIS] = this.getBasisField(mxDataFields[i][SUMMARY], recBasis, i); // depends on control dependency: [for], data = [i]
iFieldSeq++; // depends on control dependency: [for], data = [none]
for (int j = 0; j < recSummary.getKeyArea().getKeyFields(); j++)
{
if (mxDataFields[i][SUMMARY] == recSummary.getKeyArea().getField(j))
{
i--; // Skip this one, it is in the key area. // depends on control dependency: [if], data = [none]
break;
}
}
}
return mxDataFields;
} } |
public class class_name {
protected boolean parseDefaultClause( DdlTokenStream tokens,
AstNode columnNode ) throws ParsingException {
assert tokens != null;
assert columnNode != null;
// defaultClause
// : defaultOption
// ;
// defaultOption : <literal> | datetimeValueFunction
// | USER | CURRENT_USER | SESSION_USER | SYSTEM_USER | NULL;
//
// <datetime value function> ::=
// <current date value function>
// | <current time value function>
// | <current timestamp value function>
//
// <current date value function> ::= CURRENT_DATE
//
// <current time value function> ::=
// CURRENT_TIME [ <left paren> <time precision> <right paren> ]
//
// <current timestamp value function> ::=
// CURRENT_TIMESTAMP [ <left paren> <timestamp precision> <right paren> ]
String defaultValue = "";
if (tokens.canConsume("DEFAULT")) {
String optionID;
int precision = -1;
if (tokens.canConsume("CURRENT_DATE") || tokens.canConsume("'CURRENT_DATE'")) {
optionID = DEFAULT_ID_DATETIME;
defaultValue = "CURRENT_DATE";
} else if (tokens.canConsume("CURRENT_TIME") || tokens.canConsume("'CURRENT_TIME'")) {
optionID = DEFAULT_ID_DATETIME;
defaultValue = "CURRENT_TIME";
if (tokens.canConsume(L_PAREN)) {
// EXPECT INTEGER
precision = integer(tokens.consume());
tokens.canConsume(R_PAREN);
}
} else if (tokens.canConsume("CURRENT_TIMESTAMP") || tokens.canConsume("'CURRENT_TIMESTAMP'")) {
optionID = DEFAULT_ID_DATETIME;
defaultValue = "CURRENT_TIMESTAMP";
if (tokens.canConsume(L_PAREN)) {
// EXPECT INTEGER
precision = integer(tokens.consume());
tokens.canConsume(R_PAREN);
}
} else if (tokens.canConsume("USER") || tokens.canConsume("'USER'")) {
optionID = DEFAULT_ID_USER;
defaultValue = "USER";
} else if (tokens.canConsume("CURRENT_USER") || tokens.canConsume("'CURRENT_USER'")) {
optionID = DEFAULT_ID_CURRENT_USER;
defaultValue = "CURRENT_USER";
} else if (tokens.canConsume("SESSION_USER") || tokens.canConsume("'SESSION_USER'")) {
optionID = DEFAULT_ID_SESSION_USER;
defaultValue = "SESSION_USER";
} else if (tokens.canConsume("SYSTEM_USER") || tokens.canConsume("'SYSTEM_USER'")) {
optionID = DEFAULT_ID_SYSTEM_USER;
defaultValue = "SYSTEM_USER";
} else if (tokens.canConsume("NULL") || tokens.canConsume("NULL")) {
optionID = DEFAULT_ID_NULL;
defaultValue = "NULL";
} else if (tokens.canConsume(L_PAREN)) {
optionID = DEFAULT_ID_LITERAL;
while (!tokens.canConsume(R_PAREN)) {
defaultValue = defaultValue + tokens.consume();
}
} else {
optionID = DEFAULT_ID_LITERAL;
// Assume default was EMPTY or ''
defaultValue = tokens.consume();
// strip quotes if necessary
if (defaultValue.startsWith("'") && defaultValue.endsWith("'")) {
if (defaultValue.length() > 2) {
defaultValue = defaultValue.substring(1, defaultValue.lastIndexOf('\''));
} else {
defaultValue = "";
}
}
// NOTE: default value could be a Real number as well as an integer, so
// 1000.00 is valid
if (tokens.canConsume(".")) {
defaultValue = defaultValue + '.' + tokens.consume();
}
}
columnNode.setProperty(DEFAULT_OPTION, optionID);
columnNode.setProperty(DEFAULT_VALUE, defaultValue);
if (precision > -1) {
columnNode.setProperty(DEFAULT_PRECISION, precision);
}
return true;
}
return false;
} } | public class class_name {
protected boolean parseDefaultClause( DdlTokenStream tokens,
AstNode columnNode ) throws ParsingException {
assert tokens != null;
assert columnNode != null;
// defaultClause
// : defaultOption
// ;
// defaultOption : <literal> | datetimeValueFunction
// | USER | CURRENT_USER | SESSION_USER | SYSTEM_USER | NULL;
//
// <datetime value function> ::=
// <current date value function>
// | <current time value function>
// | <current timestamp value function>
//
// <current date value function> ::= CURRENT_DATE
//
// <current time value function> ::=
// CURRENT_TIME [ <left paren> <time precision> <right paren> ]
//
// <current timestamp value function> ::=
// CURRENT_TIMESTAMP [ <left paren> <timestamp precision> <right paren> ]
String defaultValue = "";
if (tokens.canConsume("DEFAULT")) {
String optionID;
int precision = -1;
if (tokens.canConsume("CURRENT_DATE") || tokens.canConsume("'CURRENT_DATE'")) {
optionID = DEFAULT_ID_DATETIME;
defaultValue = "CURRENT_DATE";
} else if (tokens.canConsume("CURRENT_TIME") || tokens.canConsume("'CURRENT_TIME'")) {
optionID = DEFAULT_ID_DATETIME; // depends on control dependency: [if], data = [none]
defaultValue = "CURRENT_TIME"; // depends on control dependency: [if], data = [none]
if (tokens.canConsume(L_PAREN)) {
// EXPECT INTEGER
precision = integer(tokens.consume()); // depends on control dependency: [if], data = [none]
tokens.canConsume(R_PAREN); // depends on control dependency: [if], data = [none]
}
} else if (tokens.canConsume("CURRENT_TIMESTAMP") || tokens.canConsume("'CURRENT_TIMESTAMP'")) {
optionID = DEFAULT_ID_DATETIME;
defaultValue = "CURRENT_TIMESTAMP";
if (tokens.canConsume(L_PAREN)) {
// EXPECT INTEGER
precision = integer(tokens.consume());
tokens.canConsume(R_PAREN);
}
} else if (tokens.canConsume("USER") || tokens.canConsume("'USER'")) {
optionID = DEFAULT_ID_USER; // depends on control dependency: [if], data = [none]
defaultValue = "USER"; // depends on control dependency: [if], data = [none]
} else if (tokens.canConsume("CURRENT_USER") || tokens.canConsume("'CURRENT_USER'")) {
optionID = DEFAULT_ID_CURRENT_USER;
defaultValue = "CURRENT_USER";
} else if (tokens.canConsume("SESSION_USER") || tokens.canConsume("'SESSION_USER'")) {
optionID = DEFAULT_ID_SESSION_USER; // depends on control dependency: [if], data = [none]
defaultValue = "SESSION_USER"; // depends on control dependency: [if], data = [none]
} else if (tokens.canConsume("SYSTEM_USER") || tokens.canConsume("'SYSTEM_USER'")) {
optionID = DEFAULT_ID_SYSTEM_USER;
defaultValue = "SYSTEM_USER";
} else if (tokens.canConsume("NULL") || tokens.canConsume("NULL")) {
optionID = DEFAULT_ID_NULL;
defaultValue = "NULL";
} else if (tokens.canConsume(L_PAREN)) {
optionID = DEFAULT_ID_LITERAL;
while (!tokens.canConsume(R_PAREN)) {
defaultValue = defaultValue + tokens.consume();
}
} else {
optionID = DEFAULT_ID_LITERAL;
// Assume default was EMPTY or ''
defaultValue = tokens.consume();
// strip quotes if necessary
if (defaultValue.startsWith("'") && defaultValue.endsWith("'")) {
if (defaultValue.length() > 2) {
defaultValue = defaultValue.substring(1, defaultValue.lastIndexOf('\'')); // depends on control dependency: [if], data = [none]
} else {
defaultValue = ""; // depends on control dependency: [if], data = [none]
}
}
// NOTE: default value could be a Real number as well as an integer, so
// 1000.00 is valid
if (tokens.canConsume(".")) {
defaultValue = defaultValue + '.' + tokens.consume(); // depends on control dependency: [if], data = [none]
}
}
columnNode.setProperty(DEFAULT_OPTION, optionID);
columnNode.setProperty(DEFAULT_VALUE, defaultValue);
if (precision > -1) {
columnNode.setProperty(DEFAULT_PRECISION, precision);
}
return true;
}
return false;
} } |
public class class_name {
@Override
protected Object deserialize(InvocationContext context, HttpResponse response) {
if(unavailable || incompatible) {
throw new IllegalStateException(unavailable? ERROR_CONTEXT_UNAVAILABLE :ERROR_CONTEXT_INCOMPATIBLE);
}
try {
HttpEntity entity = response.getEntity();
return entity == null? null :Persister_read.invoke(persister,
context.getRequest().getGenericReturnType(), EntityUtils.toString(entity));
}
catch(Exception e) {
throw new DeserializerException(new StringBuilder("XML deserialization failed for request <")
.append(context.getRequest().getName())
.append("> on endpoint <")
.append(context.getEndpoint().getName())
.append(">").toString(), e);
}
} } | public class class_name {
@Override
protected Object deserialize(InvocationContext context, HttpResponse response) {
if(unavailable || incompatible) {
throw new IllegalStateException(unavailable? ERROR_CONTEXT_UNAVAILABLE :ERROR_CONTEXT_INCOMPATIBLE);
}
try {
HttpEntity entity = response.getEntity();
return entity == null? null :Persister_read.invoke(persister,
context.getRequest().getGenericReturnType(), EntityUtils.toString(entity)); // depends on control dependency: [try], data = [none]
}
catch(Exception e) {
throw new DeserializerException(new StringBuilder("XML deserialization failed for request <")
.append(context.getRequest().getName())
.append("> on endpoint <")
.append(context.getEndpoint().getName())
.append(">").toString(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected final void flushWriter() throws org.xml.sax.SAXException
{
final java.io.Writer writer = m_writer;
if (null != writer)
{
try
{
if (writer instanceof WriterToUTF8Buffered)
{
if (m_shouldFlush)
((WriterToUTF8Buffered) writer).flush();
else
((WriterToUTF8Buffered) writer).flushBuffer();
}
if (writer instanceof WriterToASCI)
{
if (m_shouldFlush)
writer.flush();
}
else
{
// Flush always.
// Not a great thing if the writer was created
// by this class, but don't have a choice.
writer.flush();
}
}
catch (IOException ioe)
{
throw new org.xml.sax.SAXException(ioe);
}
}
} } | public class class_name {
protected final void flushWriter() throws org.xml.sax.SAXException
{
final java.io.Writer writer = m_writer;
if (null != writer)
{
try
{
if (writer instanceof WriterToUTF8Buffered)
{
if (m_shouldFlush)
((WriterToUTF8Buffered) writer).flush();
else
((WriterToUTF8Buffered) writer).flushBuffer();
}
if (writer instanceof WriterToASCI)
{
if (m_shouldFlush)
writer.flush();
}
else
{
// Flush always.
// Not a great thing if the writer was created
// by this class, but don't have a choice.
writer.flush(); // depends on control dependency: [if], data = [none]
}
}
catch (IOException ioe)
{
throw new org.xml.sax.SAXException(ioe);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public double[] toArray() {
double[] dense = new double[length()];
for (IndexValue item : values) {
dense[item.index] = item.value;
}
return dense;
} } | public class class_name {
public double[] toArray() {
double[] dense = new double[length()];
for (IndexValue item : values) {
dense[item.index] = item.value; // depends on control dependency: [for], data = [item]
}
return dense;
} } |
public class class_name {
public void setEscapeHtml(String value) {
if (value != null) {
m_escapeHtml = Boolean.valueOf(value.trim()).booleanValue();
}
} } | public class class_name {
public void setEscapeHtml(String value) {
if (value != null) {
m_escapeHtml = Boolean.valueOf(value.trim()).booleanValue(); // depends on control dependency: [if], data = [(value]
}
} } |
public class class_name {
public boolean isDayExcluded (final Calendar day)
{
if (day == null)
{
throw new IllegalArgumentException ("Parameter day must not be null");
}
// Check baseCalendar first
if (!super.isTimeIncluded (day.getTime ().getTime ()))
{
return true;
}
final int dmonth = day.get (Calendar.MONTH);
final int dday = day.get (Calendar.DAY_OF_MONTH);
if (m_bDataSorted == false)
{
Collections.sort (m_aExcludeDays, new CalendarComparator ());
m_bDataSorted = true;
}
final Iterator <Calendar> iter = m_aExcludeDays.iterator ();
while (iter.hasNext ())
{
final Calendar cl = iter.next ();
// remember, the list is sorted
if (dmonth < cl.get (Calendar.MONTH))
{
return false;
}
if (dday != cl.get (Calendar.DAY_OF_MONTH))
{
continue;
}
if (dmonth != cl.get (Calendar.MONTH))
{
continue;
}
return true;
}
return false;
} } | public class class_name {
public boolean isDayExcluded (final Calendar day)
{
if (day == null)
{
throw new IllegalArgumentException ("Parameter day must not be null");
}
// Check baseCalendar first
if (!super.isTimeIncluded (day.getTime ().getTime ()))
{
return true; // depends on control dependency: [if], data = [none]
}
final int dmonth = day.get (Calendar.MONTH);
final int dday = day.get (Calendar.DAY_OF_MONTH);
if (m_bDataSorted == false)
{
Collections.sort (m_aExcludeDays, new CalendarComparator ()); // depends on control dependency: [if], data = [none]
m_bDataSorted = true; // depends on control dependency: [if], data = [none]
}
final Iterator <Calendar> iter = m_aExcludeDays.iterator ();
while (iter.hasNext ())
{
final Calendar cl = iter.next ();
// remember, the list is sorted
if (dmonth < cl.get (Calendar.MONTH))
{
return false; // depends on control dependency: [if], data = [none]
}
if (dday != cl.get (Calendar.DAY_OF_MONTH))
{
continue;
}
if (dmonth != cl.get (Calendar.MONTH))
{
continue;
}
return true; // depends on control dependency: [while], data = [none]
}
return false;
} } |
public class class_name {
public void box(Type type) {
if (TypeUtils.isPrimitive(type)) {
if (type == Type.VOID_TYPE) {
aconst_null();
} else {
Type boxed = TypeUtils.getBoxedType(type);
new_instance(boxed);
if (type.getSize() == 2) {
// Pp -> Ppo -> oPpo -> ooPpo -> ooPp -> o
dup_x2();
dup_x2();
pop();
} else {
// p -> po -> opo -> oop -> o
dup_x1();
swap();
}
invoke_constructor(boxed, new Signature(Constants.CONSTRUCTOR_NAME, Type.VOID_TYPE, new Type[]{ type }));
}
}
} } | public class class_name {
public void box(Type type) {
if (TypeUtils.isPrimitive(type)) {
if (type == Type.VOID_TYPE) {
aconst_null(); // depends on control dependency: [if], data = [none]
} else {
Type boxed = TypeUtils.getBoxedType(type);
new_instance(boxed); // depends on control dependency: [if], data = [none]
if (type.getSize() == 2) {
// Pp -> Ppo -> oPpo -> ooPpo -> ooPp -> o
dup_x2(); // depends on control dependency: [if], data = [none]
dup_x2(); // depends on control dependency: [if], data = [none]
pop(); // depends on control dependency: [if], data = [none]
} else {
// p -> po -> opo -> oop -> o
dup_x1(); // depends on control dependency: [if], data = [none]
swap(); // depends on control dependency: [if], data = [none]
}
invoke_constructor(boxed, new Signature(Constants.CONSTRUCTOR_NAME, Type.VOID_TYPE, new Type[]{ type })); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void marshall(DescribeThingRegistrationTaskRequest describeThingRegistrationTaskRequest, ProtocolMarshaller protocolMarshaller) {
if (describeThingRegistrationTaskRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeThingRegistrationTaskRequest.getTaskId(), TASKID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeThingRegistrationTaskRequest describeThingRegistrationTaskRequest, ProtocolMarshaller protocolMarshaller) {
if (describeThingRegistrationTaskRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeThingRegistrationTaskRequest.getTaskId(), TASKID_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 Entry convertToEntries(String newAddress) {
byte[] ba = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "convertToEntries");
}
try {
ba = newAddress.getBytes("ISO-8859-1");
} catch (UnsupportedEncodingException x) {
// should never happen, log a message and use default encoding
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "ISO-8859-1 encoding not supported. Exception: " + x);
}
ba = newAddress.getBytes();
}
int baLength = ba.length;
int hashValue = 0;
int hashLength = 0;
int e31 = 1;
Entry oEntry = new Entry();
for (int i = 0; i < baLength; i++) {
if (ba[i] == WILDCARD_VALUE) {
boolean valid = true;
// make sure it is the first entry, followed by a ".", or nothing
if (i != 0) {
valid = false;
}
if (baLength >= 2) {
if (ba[1] != PERIOD_VALUE) {
valid = false;
}
}
if (valid) {
// if isolated, then store it, and continue to next word.
// Store as wildcard entry
oEntry.addEntry(0, 0);
// jump over next period to avoid processing this char again
i = 1;
// go back to start of for loop
continue;
}
}
if (ba[i] != PERIOD_VALUE) {
// continue calculating hashcode for this entry
hashValue += e31 * ba[i];
e31 = e31 * 31;
hashLength++;
}
if ((ba[i] == PERIOD_VALUE) || (i == baLength - 1)) {
// end of a "word", need to add if length is non-zero
if (hashLength > 0) {
oEntry.addEntry(hashValue, hashLength);
}
// prepare to calculate next entry
hashLength = 0;
e31 = 1;
hashValue = 0;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "convertToEntries");
}
return oEntry;
} } | public class class_name {
private Entry convertToEntries(String newAddress) {
byte[] ba = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "convertToEntries"); // depends on control dependency: [if], data = [none]
}
try {
ba = newAddress.getBytes("ISO-8859-1"); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException x) {
// should never happen, log a message and use default encoding
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "ISO-8859-1 encoding not supported. Exception: " + x); // depends on control dependency: [if], data = [none]
}
ba = newAddress.getBytes();
} // depends on control dependency: [catch], data = [none]
int baLength = ba.length;
int hashValue = 0;
int hashLength = 0;
int e31 = 1;
Entry oEntry = new Entry();
for (int i = 0; i < baLength; i++) {
if (ba[i] == WILDCARD_VALUE) {
boolean valid = true;
// make sure it is the first entry, followed by a ".", or nothing
if (i != 0) {
valid = false; // depends on control dependency: [if], data = [none]
}
if (baLength >= 2) {
if (ba[1] != PERIOD_VALUE) {
valid = false; // depends on control dependency: [if], data = [none]
}
}
if (valid) {
// if isolated, then store it, and continue to next word.
// Store as wildcard entry
oEntry.addEntry(0, 0); // depends on control dependency: [if], data = [none]
// jump over next period to avoid processing this char again
i = 1; // depends on control dependency: [if], data = [none]
// go back to start of for loop
continue;
}
}
if (ba[i] != PERIOD_VALUE) {
// continue calculating hashcode for this entry
hashValue += e31 * ba[i]; // depends on control dependency: [if], data = [none]
e31 = e31 * 31; // depends on control dependency: [if], data = [none]
hashLength++; // depends on control dependency: [if], data = [none]
}
if ((ba[i] == PERIOD_VALUE) || (i == baLength - 1)) {
// end of a "word", need to add if length is non-zero
if (hashLength > 0) {
oEntry.addEntry(hashValue, hashLength); // depends on control dependency: [if], data = [none]
}
// prepare to calculate next entry
hashLength = 0; // depends on control dependency: [if], data = [none]
e31 = 1; // depends on control dependency: [if], data = [none]
hashValue = 0; // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "convertToEntries"); // depends on control dependency: [if], data = [none]
}
return oEntry;
} } |
public class class_name {
public void setTokens(java.util.Collection<String> tokens) {
if (tokens == null) {
this.tokens = null;
return;
}
this.tokens = new java.util.ArrayList<String>(tokens);
} } | public class class_name {
public void setTokens(java.util.Collection<String> tokens) {
if (tokens == null) {
this.tokens = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.tokens = new java.util.ArrayList<String>(tokens);
} } |
public class class_name {
private Ref[] functionArg(String name, boolean checkLibrary, FunctionLibFunction flf, char end) throws PageException {
// get Function Library
checkLibrary = checkLibrary && flf != null;
// Function Attributes
List<Ref> arr = new ArrayList<Ref>();
List<FunctionLibFunctionArg> arrFuncLibAtt = null;
int libLen = 0;
if (checkLibrary) {
arrFuncLibAtt = flf.getArg();
libLen = arrFuncLibAtt.size();
}
int count = 0;
Ref ref;
do {
cfml.next();
cfml.removeSpace();
// finish
if (cfml.isCurrent(end)) break;
// too many Attributes
boolean isDynamic = false;
int max = -1;
if (checkLibrary) {
isDynamic = isDynamic(flf);
max = flf.getArgMax();
// Dynamic
if (isDynamic) {
if (max != -1 && max <= count) throw new InterpreterException("too many Attributes in function [" + name + "]");
}
// Fix
else {
if (libLen <= count) throw new InterpreterException("too many Attributes in function [" + name + "]");
}
}
if (checkLibrary && !isDynamic) {
// current attribues from library
FunctionLibFunctionArg funcLibAtt = (FunctionLibFunctionArg) arrFuncLibAtt.get(count);
short type = CFTypes.toShort(funcLibAtt.getTypeAsString(), false, CFTypes.TYPE_UNKNOW);
if (type == CFTypes.TYPE_VARIABLE_STRING) {
arr.add(functionArgDeclarationVarString());
}
else {
ref = functionArgDeclaration();
arr.add(new Casting(funcLibAtt.getTypeAsString(), type, ref));
}
}
else {
arr.add(functionArgDeclaration());
}
cfml.removeSpace();
count++;
}
while (cfml.isCurrent(','));
// end with ) ??
if (!cfml.forwardIfCurrent(end)) {
if (name.startsWith("_json")) throw new InterpreterException("Invalid Syntax Closing [" + end + "] not found");
throw new InterpreterException("Invalid Syntax Closing [" + end + "] for function [" + name + "] not found");
}
// check min attributes
if (checkLibrary && flf.getArgMin() > count) throw new InterpreterException("to less Attributes in function [" + name + "]");
cfml.removeSpace();
return (Ref[]) arr.toArray(new Ref[arr.size()]);
} } | public class class_name {
private Ref[] functionArg(String name, boolean checkLibrary, FunctionLibFunction flf, char end) throws PageException {
// get Function Library
checkLibrary = checkLibrary && flf != null;
// Function Attributes
List<Ref> arr = new ArrayList<Ref>();
List<FunctionLibFunctionArg> arrFuncLibAtt = null;
int libLen = 0;
if (checkLibrary) {
arrFuncLibAtt = flf.getArg();
libLen = arrFuncLibAtt.size();
}
int count = 0;
Ref ref;
do {
cfml.next();
cfml.removeSpace();
// finish
if (cfml.isCurrent(end)) break;
// too many Attributes
boolean isDynamic = false;
int max = -1;
if (checkLibrary) {
isDynamic = isDynamic(flf); // depends on control dependency: [if], data = [none]
max = flf.getArgMax(); // depends on control dependency: [if], data = [none]
// Dynamic
if (isDynamic) {
if (max != -1 && max <= count) throw new InterpreterException("too many Attributes in function [" + name + "]");
}
// Fix
else {
if (libLen <= count) throw new InterpreterException("too many Attributes in function [" + name + "]");
}
}
if (checkLibrary && !isDynamic) {
// current attribues from library
FunctionLibFunctionArg funcLibAtt = (FunctionLibFunctionArg) arrFuncLibAtt.get(count);
short type = CFTypes.toShort(funcLibAtt.getTypeAsString(), false, CFTypes.TYPE_UNKNOW);
if (type == CFTypes.TYPE_VARIABLE_STRING) {
arr.add(functionArgDeclarationVarString()); // depends on control dependency: [if], data = [none]
}
else {
ref = functionArgDeclaration(); // depends on control dependency: [if], data = [none]
arr.add(new Casting(funcLibAtt.getTypeAsString(), type, ref)); // depends on control dependency: [if], data = [none]
}
}
else {
arr.add(functionArgDeclaration()); // depends on control dependency: [if], data = [none]
}
cfml.removeSpace();
count++;
}
while (cfml.isCurrent(','));
// end with ) ??
if (!cfml.forwardIfCurrent(end)) {
if (name.startsWith("_json")) throw new InterpreterException("Invalid Syntax Closing [" + end + "] not found");
throw new InterpreterException("Invalid Syntax Closing [" + end + "] for function [" + name + "] not found");
}
// check min attributes
if (checkLibrary && flf.getArgMin() > count) throw new InterpreterException("to less Attributes in function [" + name + "]");
cfml.removeSpace();
return (Ref[]) arr.toArray(new Ref[arr.size()]);
} } |
public class class_name {
@Override
public T next(long systemCurrentTimeMillis) {
// drain all the waiting messages from the source (up to 10k)
while (delayed.size() < 10000) {
T event = source.next(systemCurrentTimeMillis);
if (event == null) {
break;
}
transformAndQueue(event, systemCurrentTimeMillis);
}
return delayed.nextReady(systemCurrentTimeMillis);
} } | public class class_name {
@Override
public T next(long systemCurrentTimeMillis) {
// drain all the waiting messages from the source (up to 10k)
while (delayed.size() < 10000) {
T event = source.next(systemCurrentTimeMillis);
if (event == null) {
break;
}
transformAndQueue(event, systemCurrentTimeMillis); // depends on control dependency: [while], data = [none]
}
return delayed.nextReady(systemCurrentTimeMillis);
} } |
public class class_name {
private Object internal_call(String method, String actual_objectId, int flags, boolean checkMethodName, Object... parameters) throws PickleException, PyroException, IOException {
if(actual_objectId==null) actual_objectId=this.objectid;
synchronized (this) {
connect();
sequenceNr=(sequenceNr+1)&0xffff; // stay within an unsigned short 0-65535
}
if(pyroAttrs.contains(method)) {
throw new PyroException("cannot call an attribute");
}
if(pyroOneway.contains(method)) {
flags |= Message.FLAGS_ONEWAY;
}
if(checkMethodName && Config.METADATA && !pyroMethods.contains(method)) {
throw new PyroException(String.format("remote object '%s' has no exposed attribute or method '%s'", actual_objectId, method));
}
if (parameters == null)
parameters = new Object[] {};
PyroSerializer ser = PyroSerializer.getFor(Config.SERIALIZER);
byte[] pickle = ser.serializeCall(actual_objectId, method, parameters, Collections.emptyMap());
Message msg = new Message(Message.MSG_INVOKE, pickle, ser.getSerializerId(), flags, sequenceNr, annotations(), pyroHmacKey);
Message resultmsg;
synchronized (this.sock) {
IOUtil.send(sock_out, msg.to_bytes());
if(Config.MSG_TRACE_DIR!=null) {
Message.TraceMessageSend(sequenceNr, msg.get_header_bytes(), msg.get_annotations_bytes(), msg.data);
}
pickle = null;
if ((flags & Message.FLAGS_ONEWAY) != 0)
return null;
resultmsg = Message.recv(sock_in, new int[]{Message.MSG_RESULT}, pyroHmacKey);
}
if (resultmsg.seq != sequenceNr) {
throw new PyroException("result msg out of sync");
}
responseAnnotations(resultmsg.annotations, resultmsg.type);
if ((resultmsg.flags & Message.FLAGS_COMPRESSED) != 0) {
_decompressMessageData(resultmsg);
}
if ((resultmsg.flags & Message.FLAGS_ITEMSTREAMRESULT) != 0) {
byte[] streamId = resultmsg.annotations.get("STRM");
if(streamId==null)
throw new PyroException("result of call is an iterator, but the server is not configured to allow streaming");
return new PyroProxy.StreamResultIterable(new String(streamId), this);
}
if ((resultmsg.flags & Message.FLAGS_EXCEPTION) != 0) {
Throwable rx = (Throwable) ser.deserializeData(resultmsg.data);
if (rx instanceof PyroException) {
throw (PyroException) rx;
} else {
PyroException px;
// if the source was a PythonException, copy its message and python exception type
if(rx instanceof PythonException) {
PythonException rxp = (PythonException)rx;
px = new PyroException(rxp.getMessage(), rxp);
px.pythonExceptionType = rxp.pythonExceptionType;
} else {
px = new PyroException(null, rx);
}
try {
Field remotetbField = rx.getClass().getDeclaredField("_pyroTraceback");
String remotetb = (String) remotetbField.get(rx);
px._pyroTraceback = remotetb;
} catch (Exception e) {
// exception didn't provide a pyro remote traceback
}
throw px;
}
}
return ser.deserializeData(resultmsg.data);
} } | public class class_name {
private Object internal_call(String method, String actual_objectId, int flags, boolean checkMethodName, Object... parameters) throws PickleException, PyroException, IOException {
if(actual_objectId==null) actual_objectId=this.objectid;
synchronized (this) {
connect();
sequenceNr=(sequenceNr+1)&0xffff; // stay within an unsigned short 0-65535
}
if(pyroAttrs.contains(method)) {
throw new PyroException("cannot call an attribute");
}
if(pyroOneway.contains(method)) {
flags |= Message.FLAGS_ONEWAY; // depends on control dependency: [if], data = [none]
}
if(checkMethodName && Config.METADATA && !pyroMethods.contains(method)) {
throw new PyroException(String.format("remote object '%s' has no exposed attribute or method '%s'", actual_objectId, method));
}
if (parameters == null)
parameters = new Object[] {};
PyroSerializer ser = PyroSerializer.getFor(Config.SERIALIZER);
byte[] pickle = ser.serializeCall(actual_objectId, method, parameters, Collections.emptyMap());
Message msg = new Message(Message.MSG_INVOKE, pickle, ser.getSerializerId(), flags, sequenceNr, annotations(), pyroHmacKey);
Message resultmsg;
synchronized (this.sock) {
IOUtil.send(sock_out, msg.to_bytes());
if(Config.MSG_TRACE_DIR!=null) {
Message.TraceMessageSend(sequenceNr, msg.get_header_bytes(), msg.get_annotations_bytes(), msg.data); // depends on control dependency: [if], data = [none]
}
pickle = null;
if ((flags & Message.FLAGS_ONEWAY) != 0)
return null;
resultmsg = Message.recv(sock_in, new int[]{Message.MSG_RESULT}, pyroHmacKey);
}
if (resultmsg.seq != sequenceNr) {
throw new PyroException("result msg out of sync");
}
responseAnnotations(resultmsg.annotations, resultmsg.type);
if ((resultmsg.flags & Message.FLAGS_COMPRESSED) != 0) {
_decompressMessageData(resultmsg); // depends on control dependency: [if], data = [none]
}
if ((resultmsg.flags & Message.FLAGS_ITEMSTREAMRESULT) != 0) {
byte[] streamId = resultmsg.annotations.get("STRM");
if(streamId==null)
throw new PyroException("result of call is an iterator, but the server is not configured to allow streaming");
return new PyroProxy.StreamResultIterable(new String(streamId), this); // depends on control dependency: [if], data = [none]
}
if ((resultmsg.flags & Message.FLAGS_EXCEPTION) != 0) {
Throwable rx = (Throwable) ser.deserializeData(resultmsg.data);
if (rx instanceof PyroException) {
throw (PyroException) rx;
} else {
PyroException px;
// if the source was a PythonException, copy its message and python exception type
if(rx instanceof PythonException) {
PythonException rxp = (PythonException)rx;
px = new PyroException(rxp.getMessage(), rxp); // depends on control dependency: [if], data = [none]
px.pythonExceptionType = rxp.pythonExceptionType; // depends on control dependency: [if], data = [none]
} else {
px = new PyroException(null, rx); // depends on control dependency: [if], data = [none]
}
try {
Field remotetbField = rx.getClass().getDeclaredField("_pyroTraceback");
String remotetb = (String) remotetbField.get(rx);
px._pyroTraceback = remotetb; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// exception didn't provide a pyro remote traceback
} // depends on control dependency: [catch], data = [none]
throw px;
}
}
return ser.deserializeData(resultmsg.data);
} } |
public class class_name {
public void setTargetDirectory(String directory) {
if (directory != null && directory.length() > 0) {
this.targetDirectory = new File(directory);
} else {
this.targetDirectory = null;
}
} } | public class class_name {
public void setTargetDirectory(String directory) {
if (directory != null && directory.length() > 0) {
this.targetDirectory = new File(directory); // depends on control dependency: [if], data = [(directory]
} else {
this.targetDirectory = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(DeleteResourceDataSyncRequest deleteResourceDataSyncRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteResourceDataSyncRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteResourceDataSyncRequest.getSyncName(), SYNCNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteResourceDataSyncRequest deleteResourceDataSyncRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteResourceDataSyncRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteResourceDataSyncRequest.getSyncName(), SYNCNAME_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 update() {
TreeViewer viewer = getTreeViewer();
if (viewer != null) {
Control control = viewer.getControl();
if (control != null && !control.isDisposed()) {
initRules();
populatePackageTreeNode();
viewer.refresh();
control.setRedraw(false);
viewer.expandToLevel(2);
control.setRedraw(true);
}
}
} } | public class class_name {
public void update() {
TreeViewer viewer = getTreeViewer();
if (viewer != null) {
Control control = viewer.getControl();
if (control != null && !control.isDisposed()) {
initRules(); // depends on control dependency: [if], data = [none]
populatePackageTreeNode(); // depends on control dependency: [if], data = [none]
viewer.refresh(); // depends on control dependency: [if], data = [none]
control.setRedraw(false); // depends on control dependency: [if], data = [none]
viewer.expandToLevel(2); // depends on control dependency: [if], data = [none]
control.setRedraw(true); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static String stripNonLongChars(final String value) {
final StringBuilder newString = new StringBuilder();
for (int i = 0; i < value.length(); i++) {
final char c = value.charAt(i);
if (c == '.') {
// stop if we hit a decimal point
break;
} else if (c >= '0' && c <= '9' || c == '-') {
newString.append(c);
}
}
// check to make sure we do not have a single length string with
// just a minus sign
final int sLen = newString.length();
final String s = newString.toString();
if (sLen == 0 || sLen == 1 && "-".equals(s)) {
return "0";
}
return newString.toString();
} } | public class class_name {
public static String stripNonLongChars(final String value) {
final StringBuilder newString = new StringBuilder();
for (int i = 0; i < value.length(); i++) {
final char c = value.charAt(i);
if (c == '.') {
// stop if we hit a decimal point
break;
} else if (c >= '0' && c <= '9' || c == '-') {
newString.append(c);
// depends on control dependency: [if], data = [none]
}
}
// check to make sure we do not have a single length string with
// just a minus sign
final int sLen = newString.length();
final String s = newString.toString();
if (sLen == 0 || sLen == 1 && "-".equals(s)) {
return "0";
// depends on control dependency: [if], data = [none]
}
return newString.toString();
} } |
public class class_name {
protected boolean isButtonEnabledForHttpMessageContainerState(HttpMessageContainer httpMessageContainer) {
boolean enabled = isButtonEnabledForNumberOfSelectedMessages(httpMessageContainer);
if (enabled) {
enabled = isButtonEnabledForSelectedMessages(httpMessageContainer);
}
return enabled;
} } | public class class_name {
protected boolean isButtonEnabledForHttpMessageContainerState(HttpMessageContainer httpMessageContainer) {
boolean enabled = isButtonEnabledForNumberOfSelectedMessages(httpMessageContainer);
if (enabled) {
enabled = isButtonEnabledForSelectedMessages(httpMessageContainer); // depends on control dependency: [if], data = [none]
}
return enabled;
} } |
public class class_name {
public java.util.List<String> getInvalidUserList() {
if (invalidUserList == null) {
invalidUserList = new com.amazonaws.internal.SdkInternalList<String>();
}
return invalidUserList;
} } | public class class_name {
public java.util.List<String> getInvalidUserList() {
if (invalidUserList == null) {
invalidUserList = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return invalidUserList;
} } |
public class class_name {
private void fixAfterInsertion(TreeMapEntry<K,V> x) {
x.color = RED;
while (x != null && x != root && x.parent.color == RED) {
if (parentOf(x) == leftOf(parentOf(parentOf(x)))) {
TreeMapEntry<K,V> y = rightOf(parentOf(parentOf(x)));
if (colorOf(y) == RED) {
setColor(parentOf(x), BLACK);
setColor(y, BLACK);
setColor(parentOf(parentOf(x)), RED);
x = parentOf(parentOf(x));
} else {
if (x == rightOf(parentOf(x))) {
x = parentOf(x);
rotateLeft(x);
}
setColor(parentOf(x), BLACK);
setColor(parentOf(parentOf(x)), RED);
rotateRight(parentOf(parentOf(x)));
}
} else {
TreeMapEntry<K,V> y = leftOf(parentOf(parentOf(x)));
if (colorOf(y) == RED) {
setColor(parentOf(x), BLACK);
setColor(y, BLACK);
setColor(parentOf(parentOf(x)), RED);
x = parentOf(parentOf(x));
} else {
if (x == leftOf(parentOf(x))) {
x = parentOf(x);
rotateRight(x);
}
setColor(parentOf(x), BLACK);
setColor(parentOf(parentOf(x)), RED);
rotateLeft(parentOf(parentOf(x)));
}
}
}
root.color = BLACK;
} } | public class class_name {
private void fixAfterInsertion(TreeMapEntry<K,V> x) {
x.color = RED;
while (x != null && x != root && x.parent.color == RED) {
if (parentOf(x) == leftOf(parentOf(parentOf(x)))) {
TreeMapEntry<K,V> y = rightOf(parentOf(parentOf(x)));
if (colorOf(y) == RED) {
setColor(parentOf(x), BLACK); // depends on control dependency: [if], data = [none]
setColor(y, BLACK); // depends on control dependency: [if], data = [none]
setColor(parentOf(parentOf(x)), RED); // depends on control dependency: [if], data = [RED)]
x = parentOf(parentOf(x)); // depends on control dependency: [if], data = [none]
} else {
if (x == rightOf(parentOf(x))) {
x = parentOf(x); // depends on control dependency: [if], data = [(x]
rotateLeft(x); // depends on control dependency: [if], data = [(x]
}
setColor(parentOf(x), BLACK); // depends on control dependency: [if], data = [none]
setColor(parentOf(parentOf(x)), RED); // depends on control dependency: [if], data = [RED)]
rotateRight(parentOf(parentOf(x))); // depends on control dependency: [if], data = [none]
}
} else {
TreeMapEntry<K,V> y = leftOf(parentOf(parentOf(x)));
if (colorOf(y) == RED) {
setColor(parentOf(x), BLACK); // depends on control dependency: [if], data = [none]
setColor(y, BLACK); // depends on control dependency: [if], data = [none]
setColor(parentOf(parentOf(x)), RED); // depends on control dependency: [if], data = [RED)]
x = parentOf(parentOf(x)); // depends on control dependency: [if], data = [none]
} else {
if (x == leftOf(parentOf(x))) {
x = parentOf(x); // depends on control dependency: [if], data = [(x]
rotateRight(x); // depends on control dependency: [if], data = [(x]
}
setColor(parentOf(x), BLACK); // depends on control dependency: [if], data = [none]
setColor(parentOf(parentOf(x)), RED); // depends on control dependency: [if], data = [RED)]
rotateLeft(parentOf(parentOf(x))); // depends on control dependency: [if], data = [none]
}
}
}
root.color = BLACK;
} } |
public class class_name {
public Future<Channel> renegotiate(final Promise<Channel> promise) {
if (promise == null) {
throw new NullPointerException("promise");
}
ChannelHandlerContext ctx = this.ctx;
if (ctx == null) {
throw new IllegalStateException();
}
EventExecutor executor = ctx.executor();
if (!executor.inEventLoop()) {
executor.execute(new Runnable() {
@Override
public void run() {
renegotiateOnEventLoop(promise);
}
});
return promise;
}
renegotiateOnEventLoop(promise);
return promise;
} } | public class class_name {
public Future<Channel> renegotiate(final Promise<Channel> promise) {
if (promise == null) {
throw new NullPointerException("promise");
}
ChannelHandlerContext ctx = this.ctx;
if (ctx == null) {
throw new IllegalStateException();
}
EventExecutor executor = ctx.executor();
if (!executor.inEventLoop()) {
executor.execute(new Runnable() {
@Override
public void run() {
renegotiateOnEventLoop(promise);
}
}); // depends on control dependency: [if], data = [none]
return promise; // depends on control dependency: [if], data = [none]
}
renegotiateOnEventLoop(promise);
return promise;
} } |
public class class_name {
private void setDxDy(double startx, double starty, ProjectionImpl proj) {
double Lo2 = gds.getDouble(GridDefRecord.LO2);
double La2 = gds.getDouble(GridDefRecord.LA2);
if (Double.isNaN(Lo2) || Double.isNaN(La2)) {
return;
}
LatLonPointImpl endLL = new LatLonPointImpl(La2, Lo2);
ProjectionPointImpl end =
(ProjectionPointImpl) proj.latLonToProj(endLL);
double dx = Math.abs(end.getX() - startx)
/ (gds.getInt(GridDefRecord.NX) - 1);
double dy = Math.abs(end.getY() - starty)
/ (gds.getInt(GridDefRecord.NY) - 1);
gds.addParam(GridDefRecord.DX, String.valueOf(dx));
gds.addParam(GridDefRecord.DY, String.valueOf(dy));
gds.addParam(GridDefRecord.GRID_UNITS, "km");
} } | public class class_name {
private void setDxDy(double startx, double starty, ProjectionImpl proj) {
double Lo2 = gds.getDouble(GridDefRecord.LO2);
double La2 = gds.getDouble(GridDefRecord.LA2);
if (Double.isNaN(Lo2) || Double.isNaN(La2)) {
return; // depends on control dependency: [if], data = [none]
}
LatLonPointImpl endLL = new LatLonPointImpl(La2, Lo2);
ProjectionPointImpl end =
(ProjectionPointImpl) proj.latLonToProj(endLL);
double dx = Math.abs(end.getX() - startx)
/ (gds.getInt(GridDefRecord.NX) - 1);
double dy = Math.abs(end.getY() - starty)
/ (gds.getInt(GridDefRecord.NY) - 1);
gds.addParam(GridDefRecord.DX, String.valueOf(dx));
gds.addParam(GridDefRecord.DY, String.valueOf(dy));
gds.addParam(GridDefRecord.GRID_UNITS, "km");
} } |
public class class_name {
public double getMaximumRadial() {
if (maxRadial == 0.0) {
try {
Array radialData = getRadialAxisDataCached();
maxRadial = MAMath.getMaximum( radialData);
String units = getRadialAxis().getUnitsString();
SimpleUnit radialUnit = SimpleUnit.factory(units);
maxRadial = radialUnit.convertTo(maxRadial, SimpleUnit.kmUnit); // convert to km
} catch (IOException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
}
return maxRadial;
} } | public class class_name {
public double getMaximumRadial() {
if (maxRadial == 0.0) {
try {
Array radialData = getRadialAxisDataCached();
maxRadial = MAMath.getMaximum( radialData); // depends on control dependency: [try], data = [none]
String units = getRadialAxis().getUnitsString();
SimpleUnit radialUnit = SimpleUnit.factory(units);
maxRadial = radialUnit.convertTo(maxRadial, SimpleUnit.kmUnit); // convert to km // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return maxRadial;
} } |
public class class_name {
@Deprecated
public void removeResolveInfosForIntent(Intent intent, String packageName) {
List<ResolveInfo> infoList = resolveInfoForIntent.get(intent);
if (infoList == null) {
infoList = new ArrayList<>();
resolveInfoForIntent.put(intent, infoList);
}
for (Iterator<ResolveInfo> iterator = infoList.iterator(); iterator.hasNext(); ) {
ResolveInfo resolveInfo = iterator.next();
if (getPackageName(resolveInfo).equals(packageName)) {
iterator.remove();
}
}
} } | public class class_name {
@Deprecated
public void removeResolveInfosForIntent(Intent intent, String packageName) {
List<ResolveInfo> infoList = resolveInfoForIntent.get(intent);
if (infoList == null) {
infoList = new ArrayList<>(); // depends on control dependency: [if], data = [none]
resolveInfoForIntent.put(intent, infoList); // depends on control dependency: [if], data = [none]
}
for (Iterator<ResolveInfo> iterator = infoList.iterator(); iterator.hasNext(); ) {
ResolveInfo resolveInfo = iterator.next();
if (getPackageName(resolveInfo).equals(packageName)) {
iterator.remove(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected void consumeUntilGreedy(Parser recognizer, IntervalSet set, CSSLexerState.RecoveryMode mode) {
CSSToken t;
do {
Token next = recognizer.getInputStream().LT(1);
if (next instanceof CSSToken) {
t = (CSSToken) recognizer.getInputStream().LT(1);
if (t.getType() == Token.EOF) {
logger.trace("token eof ");
break;
}
} else
break; /* not a CSSToken, probably EOF */
logger.trace("Skipped greedy: {}", t.getText());
// consume token even if it will match
recognizer.consume();
}
while (!(t.getLexerState().isBalanced(mode, null, t) && set.contains(t.getType())));
} } | public class class_name {
protected void consumeUntilGreedy(Parser recognizer, IntervalSet set, CSSLexerState.RecoveryMode mode) {
CSSToken t;
do {
Token next = recognizer.getInputStream().LT(1);
if (next instanceof CSSToken) {
t = (CSSToken) recognizer.getInputStream().LT(1); // depends on control dependency: [if], data = [none]
if (t.getType() == Token.EOF) {
logger.trace("token eof "); // depends on control dependency: [if], data = [none]
break;
}
} else
break; /* not a CSSToken, probably EOF */
logger.trace("Skipped greedy: {}", t.getText());
// consume token even if it will match
recognizer.consume();
}
while (!(t.getLexerState().isBalanced(mode, null, t) && set.contains(t.getType())));
} } |
public class class_name {
public Node item(int index) {
int handle=m_firstChild;
while(--index>=0 && handle!=DTM.NULL) {
handle=m_parentDTM.getNextSibling(handle);
}
if (handle == DTM.NULL) {
return null;
}
return m_parentDTM.getNode(handle);
} } | public class class_name {
public Node item(int index) {
int handle=m_firstChild;
while(--index>=0 && handle!=DTM.NULL) {
handle=m_parentDTM.getNextSibling(handle); // depends on control dependency: [while], data = [none]
}
if (handle == DTM.NULL) {
return null; // depends on control dependency: [if], data = [none]
}
return m_parentDTM.getNode(handle);
} } |
public class class_name {
public final void remove(ObservableDoubleValue dependency) {
requireNonNull(dependency, "Parameter 'dependency' is null");
if (dependencies.contains(dependency)) {
dependencies.remove(dependency);
unbind(dependency);
invalidate();
} else {
LOGGER.warn("Dependency not included: " + dependency + ", Skipping.");
}
} } | public class class_name {
public final void remove(ObservableDoubleValue dependency) {
requireNonNull(dependency, "Parameter 'dependency' is null");
if (dependencies.contains(dependency)) {
dependencies.remove(dependency); // depends on control dependency: [if], data = [none]
unbind(dependency); // depends on control dependency: [if], data = [none]
invalidate(); // depends on control dependency: [if], data = [none]
} else {
LOGGER.warn("Dependency not included: " + dependency + ", Skipping."); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean sleep(long milliseconds) {
//checking if we got pre-interrupted.
boolean interrupted = Thread.interrupted();
if (!interrupted) {
try {
Thread.sleep(milliseconds);
} catch (InterruptedException ex) {
interrupted = true;
// clearing the interrupt flag
Thread.interrupted();
}
}
return !interrupted;
} } | public class class_name {
public static boolean sleep(long milliseconds) {
//checking if we got pre-interrupted.
boolean interrupted = Thread.interrupted();
if (!interrupted) {
try {
Thread.sleep(milliseconds); // depends on control dependency: [try], data = [none]
} catch (InterruptedException ex) {
interrupted = true;
// clearing the interrupt flag
Thread.interrupted();
} // depends on control dependency: [catch], data = [none]
}
return !interrupted;
} } |
public class class_name {
@Override
public AuthenticationManager getAuthenticationManager() {
if(ValkyrieRepository.getInstance().getApplicationConfig().applicationContext().getBeansOfType(AuthenticationManager.class).size() != 0)
return ValkyrieRepository.getInstance().getBean(AuthenticationManager.class);
else {
return null;
}
} } | public class class_name {
@Override
public AuthenticationManager getAuthenticationManager() {
if(ValkyrieRepository.getInstance().getApplicationConfig().applicationContext().getBeansOfType(AuthenticationManager.class).size() != 0)
return ValkyrieRepository.getInstance().getBean(AuthenticationManager.class);
else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void disable() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "disable chain " + this);
}
enabled = false;
} } | public class class_name {
public void disable() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "disable chain " + this); // depends on control dependency: [if], data = [none]
}
enabled = false;
} } |
public class class_name {
public ReservedInstancesModification withReservedInstancesIds(ReservedInstancesId... reservedInstancesIds) {
if (this.reservedInstancesIds == null) {
setReservedInstancesIds(new com.amazonaws.internal.SdkInternalList<ReservedInstancesId>(reservedInstancesIds.length));
}
for (ReservedInstancesId ele : reservedInstancesIds) {
this.reservedInstancesIds.add(ele);
}
return this;
} } | public class class_name {
public ReservedInstancesModification withReservedInstancesIds(ReservedInstancesId... reservedInstancesIds) {
if (this.reservedInstancesIds == null) {
setReservedInstancesIds(new com.amazonaws.internal.SdkInternalList<ReservedInstancesId>(reservedInstancesIds.length)); // depends on control dependency: [if], data = [none]
}
for (ReservedInstancesId ele : reservedInstancesIds) {
this.reservedInstancesIds.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public Object next()
{
if(tc.isEntryEnabled())
SibTr.entry(tc, "next");
StreamSet targetStreamSet = (StreamSet)super.next();
TargetStreamSetControl targetStreamSetControl =
(TargetStreamSetControl)targetStreamSet.getControlAdapter();
if(targetStreamSetControl != null)
{
targetStreamSetControl.setTargetStreamManager(tsm);
}
if(tc.isEntryEnabled())
SibTr.exit(tc, "next", targetStreamSetControl);
return targetStreamSetControl;
} } | public class class_name {
public Object next()
{
if(tc.isEntryEnabled())
SibTr.entry(tc, "next");
StreamSet targetStreamSet = (StreamSet)super.next();
TargetStreamSetControl targetStreamSetControl =
(TargetStreamSetControl)targetStreamSet.getControlAdapter();
if(targetStreamSetControl != null)
{
targetStreamSetControl.setTargetStreamManager(tsm); // depends on control dependency: [if], data = [none]
}
if(tc.isEntryEnabled())
SibTr.exit(tc, "next", targetStreamSetControl);
return targetStreamSetControl;
} } |
public class class_name {
private Set<Tuple> getBinaryTupledSet() {
List<byte[]> membersWithScores = client.getBinaryMultiBulkReply();
Set<Tuple> set = new LinkedHashSet<Tuple>();
if (membersWithScores == null) {
return set;
}
Iterator<byte[]> iterator = membersWithScores.iterator();
if (iterator == null) {
return set;
}
while (iterator.hasNext()) {
set.add(new Tuple(iterator.next(), Double.valueOf(SafeEncoder.encode(iterator.next()))));
}
return set;
} } | public class class_name {
private Set<Tuple> getBinaryTupledSet() {
List<byte[]> membersWithScores = client.getBinaryMultiBulkReply();
Set<Tuple> set = new LinkedHashSet<Tuple>();
if (membersWithScores == null) {
return set; // depends on control dependency: [if], data = [none]
}
Iterator<byte[]> iterator = membersWithScores.iterator();
if (iterator == null) {
return set; // depends on control dependency: [if], data = [none]
}
while (iterator.hasNext()) {
set.add(new Tuple(iterator.next(), Double.valueOf(SafeEncoder.encode(iterator.next())))); // depends on control dependency: [while], data = [none]
}
return set;
} } |
public class class_name {
@InterfaceAudience.Public
public QueryEnumerator getRows() {
start();
if (rows == null) {
return null;
}
else {
// Have to return a copy because the enumeration has to start at item #0 every time
return new QueryEnumerator(rows);
}
} } | public class class_name {
@InterfaceAudience.Public
public QueryEnumerator getRows() {
start();
if (rows == null) {
return null; // depends on control dependency: [if], data = [none]
}
else {
// Have to return a copy because the enumeration has to start at item #0 every time
return new QueryEnumerator(rows); // depends on control dependency: [if], data = [(rows]
}
} } |
public class class_name {
public Content getSummaryTableTree(AbstractMemberWriter mw, TypeElement typeElement,
List<Content> tableContents, boolean showTabs) {
Content caption;
if (showTabs) {
caption = getTableCaption(mw.methodTypes);
generateTableTabTypesScript(mw.typeMap, mw.methodTypes, "methods");
}
else {
caption = getTableCaption(mw.getCaption());
}
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.memberSummary, caption)
: HtmlTree.TABLE(HtmlStyle.memberSummary, mw.getTableSummary(), caption);
table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(typeElement), "col"));
for (Content tableContent : tableContents) {
table.addContent(tableContent);
}
return table;
} } | public class class_name {
public Content getSummaryTableTree(AbstractMemberWriter mw, TypeElement typeElement,
List<Content> tableContents, boolean showTabs) {
Content caption;
if (showTabs) {
caption = getTableCaption(mw.methodTypes); // depends on control dependency: [if], data = [none]
generateTableTabTypesScript(mw.typeMap, mw.methodTypes, "methods"); // depends on control dependency: [if], data = [none]
}
else {
caption = getTableCaption(mw.getCaption()); // depends on control dependency: [if], data = [none]
}
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.memberSummary, caption)
: HtmlTree.TABLE(HtmlStyle.memberSummary, mw.getTableSummary(), caption);
table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(typeElement), "col"));
for (Content tableContent : tableContents) {
table.addContent(tableContent); // depends on control dependency: [for], data = [tableContent]
}
return table;
} } |
public class class_name {
public Normalizer2Impl load(ByteBuffer bytes) {
try {
dataVersion=ICUBinary.readHeaderAndDataVersion(bytes, DATA_FORMAT, IS_ACCEPTABLE);
int indexesLength=bytes.getInt()/4; // inIndexes[IX_NORM_TRIE_OFFSET]/4
if(indexesLength<=IX_MIN_MAYBE_YES) {
throw new ICUUncheckedIOException("Normalizer2 data: not enough indexes");
}
int[] inIndexes=new int[indexesLength];
inIndexes[0]=indexesLength*4;
for(int i=1; i<indexesLength; ++i) {
inIndexes[i]=bytes.getInt();
}
minDecompNoCP=inIndexes[IX_MIN_DECOMP_NO_CP];
minCompNoMaybeCP=inIndexes[IX_MIN_COMP_NO_MAYBE_CP];
minYesNo=inIndexes[IX_MIN_YES_NO];
minYesNoMappingsOnly=inIndexes[IX_MIN_YES_NO_MAPPINGS_ONLY];
minNoNo=inIndexes[IX_MIN_NO_NO];
limitNoNo=inIndexes[IX_LIMIT_NO_NO];
minMaybeYes=inIndexes[IX_MIN_MAYBE_YES];
// Read the normTrie.
int offset=inIndexes[IX_NORM_TRIE_OFFSET];
int nextOffset=inIndexes[IX_EXTRA_DATA_OFFSET];
normTrie=Trie2_16.createFromSerialized(bytes);
int trieLength=normTrie.getSerializedLength();
if(trieLength>(nextOffset-offset)) {
throw new ICUUncheckedIOException("Normalizer2 data: not enough bytes for normTrie");
}
ICUBinary.skipBytes(bytes, (nextOffset-offset)-trieLength); // skip padding after trie bytes
// Read the composition and mapping data.
offset=nextOffset;
nextOffset=inIndexes[IX_SMALL_FCD_OFFSET];
int numChars=(nextOffset-offset)/2;
if(numChars!=0) {
maybeYesCompositions=ICUBinary.getString(bytes, numChars, 0);
extraData=maybeYesCompositions.substring(MIN_NORMAL_MAYBE_YES-minMaybeYes);
}
// smallFCD: new in formatVersion 2
offset=nextOffset;
smallFCD=new byte[0x100];
bytes.get(smallFCD);
// Build tccc180[].
// gennorm2 enforces lccc=0 for c<MIN_CCC_LCCC_CP=U+0300.
tccc180=new int[0x180];
int bits=0;
for(int c=0; c<0x180; bits>>=1) {
if((c&0xff)==0) {
bits=smallFCD[c>>8]; // one byte per 0x100 code points
}
if((bits&1)!=0) {
for(int i=0; i<0x20; ++i, ++c) {
tccc180[c]=getFCD16FromNormData(c)&0xff;
}
} else {
c+=0x20;
}
}
return this;
} catch(IOException e) {
throw new ICUUncheckedIOException(e);
}
} } | public class class_name {
public Normalizer2Impl load(ByteBuffer bytes) {
try {
dataVersion=ICUBinary.readHeaderAndDataVersion(bytes, DATA_FORMAT, IS_ACCEPTABLE); // depends on control dependency: [try], data = [none]
int indexesLength=bytes.getInt()/4; // inIndexes[IX_NORM_TRIE_OFFSET]/4
if(indexesLength<=IX_MIN_MAYBE_YES) {
throw new ICUUncheckedIOException("Normalizer2 data: not enough indexes");
}
int[] inIndexes=new int[indexesLength];
inIndexes[0]=indexesLength*4; // depends on control dependency: [try], data = [none]
for(int i=1; i<indexesLength; ++i) {
inIndexes[i]=bytes.getInt(); // depends on control dependency: [for], data = [i]
}
minDecompNoCP=inIndexes[IX_MIN_DECOMP_NO_CP]; // depends on control dependency: [try], data = [none]
minCompNoMaybeCP=inIndexes[IX_MIN_COMP_NO_MAYBE_CP]; // depends on control dependency: [try], data = [none]
minYesNo=inIndexes[IX_MIN_YES_NO]; // depends on control dependency: [try], data = [none]
minYesNoMappingsOnly=inIndexes[IX_MIN_YES_NO_MAPPINGS_ONLY]; // depends on control dependency: [try], data = [none]
minNoNo=inIndexes[IX_MIN_NO_NO]; // depends on control dependency: [try], data = [none]
limitNoNo=inIndexes[IX_LIMIT_NO_NO]; // depends on control dependency: [try], data = [none]
minMaybeYes=inIndexes[IX_MIN_MAYBE_YES]; // depends on control dependency: [try], data = [none]
// Read the normTrie.
int offset=inIndexes[IX_NORM_TRIE_OFFSET];
int nextOffset=inIndexes[IX_EXTRA_DATA_OFFSET];
normTrie=Trie2_16.createFromSerialized(bytes); // depends on control dependency: [try], data = [none]
int trieLength=normTrie.getSerializedLength();
if(trieLength>(nextOffset-offset)) {
throw new ICUUncheckedIOException("Normalizer2 data: not enough bytes for normTrie");
}
ICUBinary.skipBytes(bytes, (nextOffset-offset)-trieLength); // skip padding after trie bytes // depends on control dependency: [try], data = [none]
// Read the composition and mapping data.
offset=nextOffset; // depends on control dependency: [try], data = [none]
nextOffset=inIndexes[IX_SMALL_FCD_OFFSET]; // depends on control dependency: [try], data = [none]
int numChars=(nextOffset-offset)/2;
if(numChars!=0) {
maybeYesCompositions=ICUBinary.getString(bytes, numChars, 0); // depends on control dependency: [if], data = [0)]
extraData=maybeYesCompositions.substring(MIN_NORMAL_MAYBE_YES-minMaybeYes); // depends on control dependency: [if], data = [none]
}
// smallFCD: new in formatVersion 2
offset=nextOffset; // depends on control dependency: [try], data = [none]
smallFCD=new byte[0x100]; // depends on control dependency: [try], data = [none]
bytes.get(smallFCD); // depends on control dependency: [try], data = [none]
// Build tccc180[].
// gennorm2 enforces lccc=0 for c<MIN_CCC_LCCC_CP=U+0300.
tccc180=new int[0x180]; // depends on control dependency: [try], data = [none]
int bits=0;
for(int c=0; c<0x180; bits>>=1) {
if((c&0xff)==0) {
bits=smallFCD[c>>8]; // one byte per 0x100 code points // depends on control dependency: [if], data = [none]
}
if((bits&1)!=0) {
for(int i=0; i<0x20; ++i, ++c) {
tccc180[c]=getFCD16FromNormData(c)&0xff; // depends on control dependency: [for], data = [none]
}
} else {
c+=0x20; // depends on control dependency: [if], data = [none]
}
}
return this; // depends on control dependency: [try], data = [none]
} catch(IOException e) {
throw new ICUUncheckedIOException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public CommerceRegion fetchByCommerceCountryId_First(
long commerceCountryId,
OrderByComparator<CommerceRegion> orderByComparator) {
List<CommerceRegion> list = findByCommerceCountryId(commerceCountryId,
0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CommerceRegion fetchByCommerceCountryId_First(
long commerceCountryId,
OrderByComparator<CommerceRegion> orderByComparator) {
List<CommerceRegion> list = findByCommerceCountryId(commerceCountryId,
0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Override
protected int findPrototypeId(String s)
{
int id;
// #generated# Last update: 2018-07-02 19:08:32 MESZ
L0: { id = 0; String X = null; int c;
L: switch (s.length()) {
case 1: if (s.charAt(0)=='E') {id=Id_E; break L0;} break L;
case 2: if (s.charAt(0)=='P' && s.charAt(1)=='I') {id=Id_PI; break L0;} break L;
case 3: switch (s.charAt(0)) {
case 'L': if (s.charAt(2)=='2' && s.charAt(1)=='N') {id=Id_LN2; break L0;} break L;
case 'a': if (s.charAt(2)=='s' && s.charAt(1)=='b') {id=Id_abs; break L0;} break L;
case 'c': if (s.charAt(2)=='s' && s.charAt(1)=='o') {id=Id_cos; break L0;} break L;
case 'e': if (s.charAt(2)=='p' && s.charAt(1)=='x') {id=Id_exp; break L0;} break L;
case 'l': if (s.charAt(2)=='g' && s.charAt(1)=='o') {id=Id_log; break L0;} break L;
case 'm': c=s.charAt(2);
if (c=='n') { if (s.charAt(1)=='i') {id=Id_min; break L0;} }
else if (c=='x') { if (s.charAt(1)=='a') {id=Id_max; break L0;} }
break L;
case 'p': if (s.charAt(2)=='w' && s.charAt(1)=='o') {id=Id_pow; break L0;} break L;
case 's': if (s.charAt(2)=='n' && s.charAt(1)=='i') {id=Id_sin; break L0;} break L;
case 't': if (s.charAt(2)=='n' && s.charAt(1)=='a') {id=Id_tan; break L0;} break L;
} break L;
case 4: switch (s.charAt(1)) {
case 'N': X="LN10";id=Id_LN10; break L;
case 'a': X="tanh";id=Id_tanh; break L;
case 'b': X="cbrt";id=Id_cbrt; break L;
case 'c': X="acos";id=Id_acos; break L;
case 'e': X="ceil";id=Id_ceil; break L;
case 'i': c=s.charAt(3);
if (c=='h') { if (s.charAt(0)=='s' && s.charAt(2)=='n') {id=Id_sinh; break L0;} }
else if (c=='n') { if (s.charAt(0)=='s' && s.charAt(2)=='g') {id=Id_sign; break L0;} }
break L;
case 'm': X="imul";id=Id_imul; break L;
case 'o': c=s.charAt(0);
if (c=='c') { if (s.charAt(2)=='s' && s.charAt(3)=='h') {id=Id_cosh; break L0;} }
else if (c=='l') { if (s.charAt(2)=='g' && s.charAt(3)=='2') {id=Id_log2; break L0;} }
break L;
case 'q': X="sqrt";id=Id_sqrt; break L;
case 's': X="asin";id=Id_asin; break L;
case 't': X="atan";id=Id_atan; break L;
} break L;
case 5: switch (s.charAt(0)) {
case 'L': X="LOG2E";id=Id_LOG2E; break L;
case 'S': X="SQRT2";id=Id_SQRT2; break L;
case 'a': c=s.charAt(1);
if (c=='c') { X="acosh";id=Id_acosh; }
else if (c=='s') { X="asinh";id=Id_asinh; }
else if (c=='t') {
c=s.charAt(4);
if (c=='2') { if (s.charAt(2)=='a' && s.charAt(3)=='n') {id=Id_atan2; break L0;} }
else if (c=='h') { if (s.charAt(2)=='a' && s.charAt(3)=='n') {id=Id_atanh; break L0;} }
}
break L;
case 'c': X="clz32";id=Id_clz32; break L;
case 'e': X="expm1";id=Id_expm1; break L;
case 'f': X="floor";id=Id_floor; break L;
case 'h': X="hypot";id=Id_hypot; break L;
case 'l': c=s.charAt(4);
if (c=='0') { X="log10";id=Id_log10; }
else if (c=='p') { X="log1p";id=Id_log1p; }
break L;
case 'r': X="round";id=Id_round; break L;
case 't': X="trunc";id=Id_trunc; break L;
} break L;
case 6: c=s.charAt(0);
if (c=='L') { X="LOG10E";id=Id_LOG10E; }
else if (c=='f') { X="fround";id=Id_fround; }
else if (c=='r') { X="random";id=Id_random; }
break L;
case 7: X="SQRT1_2";id=Id_SQRT1_2; break L;
case 8: X="toSource";id=Id_toSource; break L;
}
if (X!=null && X!=s && !X.equals(s)) id = 0;
break L0;
}
// #/generated#
return id;
} } | public class class_name {
@Override
protected int findPrototypeId(String s)
{
int id;
// #generated# Last update: 2018-07-02 19:08:32 MESZ
L0: { id = 0; String X = null; int c;
L: switch (s.length()) {
case 1: if (s.charAt(0)=='E') {id=Id_E; break L0;} break L; // depends on control dependency: [if], data = [none]
case 2: if (s.charAt(0)=='P' && s.charAt(1)=='I') {id=Id_PI; break L0;} break L; // depends on control dependency: [if], data = [none]
case 3: switch (s.charAt(0)) {
case 'L': if (s.charAt(2)=='2' && s.charAt(1)=='N') {id=Id_LN2; break L0;} break L; // depends on control dependency: [if], data = [none]
case 'a': if (s.charAt(2)=='s' && s.charAt(1)=='b') {id=Id_abs; break L0;} break L; // depends on control dependency: [if], data = [none]
case 'c': if (s.charAt(2)=='s' && s.charAt(1)=='o') {id=Id_cos; break L0;} break L; // depends on control dependency: [if], data = [none]
case 'e': if (s.charAt(2)=='p' && s.charAt(1)=='x') {id=Id_exp; break L0;} break L; // depends on control dependency: [if], data = [none]
case 'l': if (s.charAt(2)=='g' && s.charAt(1)=='o') {id=Id_log; break L0;} break L; // depends on control dependency: [if], data = [none]
case 'm': c=s.charAt(2);
if (c=='n') { if (s.charAt(1)=='i') {id=Id_min; break L0;} } // depends on control dependency: [if], data = [none]
else if (c=='x') { if (s.charAt(1)=='a') {id=Id_max; break L0;} } // depends on control dependency: [if], data = [none]
break L;
case 'p': if (s.charAt(2)=='w' && s.charAt(1)=='o') {id=Id_pow; break L0;} break L; // depends on control dependency: [if], data = [none]
case 's': if (s.charAt(2)=='n' && s.charAt(1)=='i') {id=Id_sin; break L0;} break L; // depends on control dependency: [if], data = [none]
case 't': if (s.charAt(2)=='n' && s.charAt(1)=='a') {id=Id_tan; break L0;} break L; // depends on control dependency: [if], data = [none]
} break L;
case 4: switch (s.charAt(1)) {
case 'N': X="LN10";id=Id_LN10; break L;
case 'a': X="tanh";id=Id_tanh; break L;
case 'b': X="cbrt";id=Id_cbrt; break L;
case 'c': X="acos";id=Id_acos; break L;
case 'e': X="ceil";id=Id_ceil; break L;
case 'i': c=s.charAt(3);
if (c=='h') { if (s.charAt(0)=='s' && s.charAt(2)=='n') {id=Id_sinh; break L0;} } // depends on control dependency: [if], data = [none]
else if (c=='n') { if (s.charAt(0)=='s' && s.charAt(2)=='g') {id=Id_sign; break L0;} } // depends on control dependency: [if], data = [none]
break L;
case 'm': X="imul";id=Id_imul; break L;
case 'o': c=s.charAt(0);
if (c=='c') { if (s.charAt(2)=='s' && s.charAt(3)=='h') {id=Id_cosh; break L0;} } // depends on control dependency: [if], data = [none]
else if (c=='l') { if (s.charAt(2)=='g' && s.charAt(3)=='2') {id=Id_log2; break L0;} } // depends on control dependency: [if], data = [none]
break L;
case 'q': X="sqrt";id=Id_sqrt; break L;
case 's': X="asin";id=Id_asin; break L;
case 't': X="atan";id=Id_atan; break L;
} break L;
case 5: switch (s.charAt(0)) {
case 'L': X="LOG2E";id=Id_LOG2E; break L;
case 'S': X="SQRT2";id=Id_SQRT2; break L;
case 'a': c=s.charAt(1);
if (c=='c') { X="acosh";id=Id_acosh; } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
else if (c=='s') { X="asinh";id=Id_asinh; } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
else if (c=='t') {
c=s.charAt(4); // depends on control dependency: [if], data = [none]
if (c=='2') { if (s.charAt(2)=='a' && s.charAt(3)=='n') {id=Id_atan2; break L0;} } // depends on control dependency: [if], data = [none]
else if (c=='h') { if (s.charAt(2)=='a' && s.charAt(3)=='n') {id=Id_atanh; break L0;} } // depends on control dependency: [if], data = [none]
}
break L;
case 'c': X="clz32";id=Id_clz32; break L;
case 'e': X="expm1";id=Id_expm1; break L;
case 'f': X="floor";id=Id_floor; break L;
case 'h': X="hypot";id=Id_hypot; break L;
case 'l': c=s.charAt(4);
if (c=='0') { X="log10";id=Id_log10; } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
else if (c=='p') { X="log1p";id=Id_log1p; } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
break L;
case 'r': X="round";id=Id_round; break L;
case 't': X="trunc";id=Id_trunc; break L;
} break L;
case 6: c=s.charAt(0);
if (c=='L') { X="LOG10E";id=Id_LOG10E; } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
else if (c=='f') { X="fround";id=Id_fround; } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
else if (c=='r') { X="random";id=Id_random; } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
break L;
case 7: X="SQRT1_2";id=Id_SQRT1_2; break L;
case 8: X="toSource";id=Id_toSource; break L;
}
if (X!=null && X!=s && !X.equals(s)) id = 0;
break L0;
}
// #/generated#
return id;
} } |
public class class_name {
public void marshall(StopLoggingRequest stopLoggingRequest, ProtocolMarshaller protocolMarshaller) {
if (stopLoggingRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stopLoggingRequest.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(StopLoggingRequest stopLoggingRequest, ProtocolMarshaller protocolMarshaller) {
if (stopLoggingRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stopLoggingRequest.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<List<Vertex>> biSegment(char[] sSentence, int nKind, WordNet wordNetOptimum, WordNet wordNetAll)
{
List<List<Vertex>> coarseResult = new LinkedList<List<Vertex>>();
////////////////生成词网////////////////////
generateWordNet(wordNetAll);
// logger.trace("词网大小:" + wordNetAll.size());
// logger.trace("打印词网:\n" + wordNetAll);
///////////////生成词图////////////////////
Graph graph = generateBiGraph(wordNetAll);
// logger.trace(graph.toString());
if (HanLP.Config.DEBUG)
{
System.out.printf("打印词图:%s\n", graph.printByTo());
}
///////////////N-最短路径////////////////////
NShortPath nShortPath = new NShortPath(graph, nKind);
List<int[]> spResult = nShortPath.getNPaths(nKind * 2);
if (spResult.size() == 0)
{
throw new RuntimeException(nKind + "-最短路径求解失败,请检查上面的词网是否存在负圈或悬孤节点");
}
// logger.trace(nKind + "-最短路径");
// for (int[] path : spResult)
// {
// logger.trace(Graph.parseResult(graph.parsePath(path)));
// }
//////////////日期、数字合并策略
for (int[] path : spResult)
{
List<Vertex> vertexes = graph.parsePath(path);
generateWord(vertexes, wordNetOptimum);
coarseResult.add(vertexes);
}
return coarseResult;
} } | public class class_name {
public List<List<Vertex>> biSegment(char[] sSentence, int nKind, WordNet wordNetOptimum, WordNet wordNetAll)
{
List<List<Vertex>> coarseResult = new LinkedList<List<Vertex>>();
////////////////生成词网////////////////////
generateWordNet(wordNetAll);
// logger.trace("词网大小:" + wordNetAll.size());
// logger.trace("打印词网:\n" + wordNetAll);
///////////////生成词图////////////////////
Graph graph = generateBiGraph(wordNetAll);
// logger.trace(graph.toString());
if (HanLP.Config.DEBUG)
{
System.out.printf("打印词图:%s\n", graph.printByTo()); // depends on control dependency: [if], data = [none]
}
///////////////N-最短路径////////////////////
NShortPath nShortPath = new NShortPath(graph, nKind);
List<int[]> spResult = nShortPath.getNPaths(nKind * 2);
if (spResult.size() == 0)
{
throw new RuntimeException(nKind + "-最短路径求解失败,请检查上面的词网是否存在负圈或悬孤节点");
}
// logger.trace(nKind + "-最短路径");
// for (int[] path : spResult)
// {
// logger.trace(Graph.parseResult(graph.parsePath(path)));
// }
//////////////日期、数字合并策略
for (int[] path : spResult)
{
List<Vertex> vertexes = graph.parsePath(path);
generateWord(vertexes, wordNetOptimum); // depends on control dependency: [for], data = [none]
coarseResult.add(vertexes); // depends on control dependency: [for], data = [none]
}
return coarseResult;
} } |
public class class_name {
private void addPathColumn() {
Column<CmsHistoryResourceBean, ?> col = new TextColumn<CmsHistoryResourceBean>() {
@Override
public String getValue(CmsHistoryResourceBean historyRes) {
String path = historyRes.getRootPath();
String siteRoot = CmsCoreProvider.get().getSiteRoot();
if (path.startsWith(siteRoot)) {
path = path.substring(siteRoot.length());
if (!path.startsWith("/")) {
path = "/" + path;
}
}
return path;
}
};
addColumn(col, CmsHistoryMessages.columnPath());
setColumnWidth(col, 100, Unit.PCT);
} } | public class class_name {
private void addPathColumn() {
Column<CmsHistoryResourceBean, ?> col = new TextColumn<CmsHistoryResourceBean>() {
@Override
public String getValue(CmsHistoryResourceBean historyRes) {
String path = historyRes.getRootPath();
String siteRoot = CmsCoreProvider.get().getSiteRoot();
if (path.startsWith(siteRoot)) {
path = path.substring(siteRoot.length()); // depends on control dependency: [if], data = [none]
if (!path.startsWith("/")) {
path = "/" + path; // depends on control dependency: [if], data = [none]
}
}
return path;
}
};
addColumn(col, CmsHistoryMessages.columnPath());
setColumnWidth(col, 100, Unit.PCT);
} } |
public class class_name {
public T floor(T T) {
if (T == null) {
return null;
}
NodeIterator<T> iterator = new NodeIterator<>(root, -1, T.start(), false);
if (iterator.hasNext()) {
return iterator.next();
}
return null;
} } | public class class_name {
public T floor(T T) {
if (T == null) {
return null; // depends on control dependency: [if], data = [none]
}
NodeIterator<T> iterator = new NodeIterator<>(root, -1, T.start(), false);
if (iterator.hasNext()) {
return iterator.next(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
protected void createAndStartGrpcServer() throws IOException {
final Server localServer = this.server;
if (localServer == null) {
this.server = this.factory.createServer();
this.server.start();
log.info("gRPC Server started, listening on address: " + this.factory.getAddress() + ", port: "
+ this.factory.getPort());
final Thread awaitThread = new Thread("container-" + (serverCounter.incrementAndGet())) {
@Override
public void run() {
try {
GrpcServerLifecycle.this.server.awaitTermination();
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
}
}
};
awaitThread.setDaemon(false);
awaitThread.start();
}
} } | public class class_name {
protected void createAndStartGrpcServer() throws IOException {
final Server localServer = this.server;
if (localServer == null) {
this.server = this.factory.createServer();
this.server.start();
log.info("gRPC Server started, listening on address: " + this.factory.getAddress() + ", port: "
+ this.factory.getPort());
final Thread awaitThread = new Thread("container-" + (serverCounter.incrementAndGet())) {
@Override
public void run() {
try {
GrpcServerLifecycle.this.server.awaitTermination(); // depends on control dependency: [try], data = [none]
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
} // depends on control dependency: [catch], data = [none]
}
};
awaitThread.setDaemon(false);
awaitThread.start();
}
} } |
public class class_name {
private TimeUnit[] TimeEx(String tar,String timebase)
{
Matcher match;
int startline=-1,endline=-1;
String [] temp = new String[99];
int rpointer=0;
TimeUnit[] Time_Result = null;
match=patterns.matcher(tar);
boolean startmark=true;
while(match.find())
{
startline=match.start();
if (endline==startline)
{
rpointer--;
temp[rpointer]=temp[rpointer]+match.group();
}
else
{
if(!startmark)
{
rpointer--;
//System.out.println(temp[rpointer]);
rpointer++;
}
startmark=false;
temp[rpointer]=match.group();
}
endline=match.end();
rpointer++;
}
if(rpointer>0)
{
rpointer--;
//System.out.println(temp[rpointer]);
rpointer++;
}
Time_Result=new TimeUnit[rpointer];
// System.out.println("Basic Data is " + timebase);
for(int j=0;j<rpointer;j++)
{
Time_Result[j]=new TimeUnit(temp[j],this);
//System.out.println(result[j]);
}
return Time_Result;
} } | public class class_name {
private TimeUnit[] TimeEx(String tar,String timebase)
{
Matcher match;
int startline=-1,endline=-1;
String [] temp = new String[99];
int rpointer=0;
TimeUnit[] Time_Result = null;
match=patterns.matcher(tar);
boolean startmark=true;
while(match.find())
{
startline=match.start();
// depends on control dependency: [while], data = [none]
if (endline==startline)
{
rpointer--;
// depends on control dependency: [if], data = [none]
temp[rpointer]=temp[rpointer]+match.group();
// depends on control dependency: [if], data = [none]
}
else
{
if(!startmark)
{
rpointer--;
// depends on control dependency: [if], data = [none]
//System.out.println(temp[rpointer]);
rpointer++;
// depends on control dependency: [if], data = [none]
}
startmark=false;
// depends on control dependency: [if], data = [none]
temp[rpointer]=match.group();
// depends on control dependency: [if], data = [none]
}
endline=match.end();
// depends on control dependency: [while], data = [none]
rpointer++;
// depends on control dependency: [while], data = [none]
}
if(rpointer>0)
{
rpointer--;
// depends on control dependency: [if], data = [none]
//System.out.println(temp[rpointer]);
rpointer++;
// depends on control dependency: [if], data = [none]
}
Time_Result=new TimeUnit[rpointer];
// System.out.println("Basic Data is " + timebase);
for(int j=0;j<rpointer;j++)
{
Time_Result[j]=new TimeUnit(temp[j],this);
// depends on control dependency: [for], data = [j]
//System.out.println(result[j]);
}
return Time_Result;
} } |
public class class_name {
public static Map<String, String> getSubmap(Map<String, String> mapIn, String subkey) {
if (mapIn == null || mapIn.isEmpty()) {
return Collections.emptyMap();
}
// Get map sub-element.
return mapIn.entrySet().stream()
.filter(entry -> entry.getKey().toLowerCase().startsWith(subkey.toLowerCase()))
.map(entry -> {
String newKey = entry.getKey().substring(subkey.length(), entry.getKey().length());
return new AbstractMap.SimpleImmutableEntry<>(newKey, entry.getValue());
})
.collect(Collectors.toMap(Entry::getKey, Entry::getValue));
} } | public class class_name {
public static Map<String, String> getSubmap(Map<String, String> mapIn, String subkey) {
if (mapIn == null || mapIn.isEmpty()) {
return Collections.emptyMap(); // depends on control dependency: [if], data = [none]
}
// Get map sub-element.
return mapIn.entrySet().stream()
.filter(entry -> entry.getKey().toLowerCase().startsWith(subkey.toLowerCase()))
.map(entry -> {
String newKey = entry.getKey().substring(subkey.length(), entry.getKey().length());
return new AbstractMap.SimpleImmutableEntry<>(newKey, entry.getValue());
})
.collect(Collectors.toMap(Entry::getKey, Entry::getValue));
} } |
public class class_name {
E get(E key)
{
int idx = indexOf(key);
if (idx >= 0)
{
return list.get(idx);
}
return null;
} } | public class class_name {
E get(E key)
{
int idx = indexOf(key);
if (idx >= 0)
{
return list.get(idx);
// depends on control dependency: [if], data = [(idx]
}
return null;
} } |
public class class_name {
private Set<String> doSearch(String resourceLocation, Pattern pattern) {
// get opened namespace
JDBMNamespaceLookup il = openNamespaces.get(resourceLocation);
Set<String> results = new HashSet<String>();
for (String value : il.getKeySet()) {
if (pattern.matcher(value).matches()) {
results.add(value);
}
}
return results;
} } | public class class_name {
private Set<String> doSearch(String resourceLocation, Pattern pattern) {
// get opened namespace
JDBMNamespaceLookup il = openNamespaces.get(resourceLocation);
Set<String> results = new HashSet<String>();
for (String value : il.getKeySet()) {
if (pattern.matcher(value).matches()) {
results.add(value); // depends on control dependency: [if], data = [none]
}
}
return results;
} } |
public class class_name {
public String callRPC(String name, boolean async, int timeout, RPCParameters params) {
ensureConnection();
String version = "";
String context = connectionParams.getAppid();
if (name.contains(":")) {
String pcs[] = StrUtil.split(name, ":", 3, true);
name = pcs[0];
version = pcs[1];
context = pcs[2].isEmpty() ? context : pcs[2];
}
Request request = new Request(Action.RPC);
request.addParameter("UID", id);
request.addParameter("CTX", context);
request.addParameter("VER", version);
request.addParameter("RPC", name);
request.addParameter("ASY", async);
if (params != null) {
request.addParameters(params);
}
Response response = netCall(request, timeout);
return response.getData();
} } | public class class_name {
public String callRPC(String name, boolean async, int timeout, RPCParameters params) {
ensureConnection();
String version = "";
String context = connectionParams.getAppid();
if (name.contains(":")) {
String pcs[] = StrUtil.split(name, ":", 3, true);
name = pcs[0]; // depends on control dependency: [if], data = [none]
version = pcs[1]; // depends on control dependency: [if], data = [none]
context = pcs[2].isEmpty() ? context : pcs[2]; // depends on control dependency: [if], data = [none]
}
Request request = new Request(Action.RPC);
request.addParameter("UID", id);
request.addParameter("CTX", context);
request.addParameter("VER", version);
request.addParameter("RPC", name);
request.addParameter("ASY", async);
if (params != null) {
request.addParameters(params); // depends on control dependency: [if], data = [(params]
}
Response response = netCall(request, timeout);
return response.getData();
} } |
public class class_name {
public static HttpRequestor.Response startPostRaw(DbxRequestConfig requestConfig,
String sdkUserAgentIdentifier,
String host,
String path,
byte[] body,
/*@Nullable*/List<HttpRequestor.Header> headers)
throws NetworkIOException {
String uri = buildUri(host, path);
headers = copyHeaders(headers);
headers = addUserAgentHeader(headers, requestConfig, sdkUserAgentIdentifier);
headers.add(new HttpRequestor.Header("Content-Length", Integer.toString(body.length)));
try {
HttpRequestor.Uploader uploader = requestConfig.getHttpRequestor().startPost(uri, headers);
try {
uploader.upload(body);
return uploader.finish();
} finally {
uploader.close();
}
} catch (IOException ex) {
throw new NetworkIOException(ex);
}
} } | public class class_name {
public static HttpRequestor.Response startPostRaw(DbxRequestConfig requestConfig,
String sdkUserAgentIdentifier,
String host,
String path,
byte[] body,
/*@Nullable*/List<HttpRequestor.Header> headers)
throws NetworkIOException {
String uri = buildUri(host, path);
headers = copyHeaders(headers);
headers = addUserAgentHeader(headers, requestConfig, sdkUserAgentIdentifier);
headers.add(new HttpRequestor.Header("Content-Length", Integer.toString(body.length)));
try {
HttpRequestor.Uploader uploader = requestConfig.getHttpRequestor().startPost(uri, headers);
try {
uploader.upload(body); // depends on control dependency: [try], data = [none]
return uploader.finish(); // depends on control dependency: [try], data = [none]
} finally {
uploader.close();
}
} catch (IOException ex) {
throw new NetworkIOException(ex);
}
} } |
public class class_name {
@Override
public void clearMemory(boolean clearDisk) {
final String methodName = "clearDisk";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called");
}
} } | public class class_name {
@Override
public void clearMemory(boolean clearDisk) {
final String methodName = "clearDisk";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void printAppletHtmlScreen(PrintWriter out, ResourceBundle reg)
throws DBException
{
reg = ((BaseApplication)this.getTask().getApplication()).getResources("HtmlApplet", false);
Map<String,Object> propApplet = new Hashtable<String,Object>();
Task task = this.getTask();
Map<String,Object> properties = null;
if (task instanceof ServletTask)
properties = ((ServletTask)task).getRequestProperties(((ServletTask)task).getServletRequest(), true);
else
properties = task.getProperties();
properties = ((AppletHtmlScreen)this.getScreenField()).getAppletProperties(propApplet, properties);
out.println("<center>");
char DEFAULT = ' ';
char ch = ScreenFieldViewAdapter.getFirstToUpper(this.getProperty(DBParams.JAVA), DEFAULT);
if (ch == DEFAULT)
if (this.getTask() instanceof ServletTask)
{ // Default - 'P'lug-in/'A'pplet depends on browser
ch = 'P'; // by Default - use plug-in
HttpServletRequest req = ((ServletTask)this.getTask()).getServletRequest();
Enumeration<?> e = req.getHeaderNames();
while (e.hasMoreElements())
{
String name = (String)e.nextElement();
String value = req.getHeader(name);
if ((name != null) && (name.equalsIgnoreCase("User-Agent")) && (value != null))
{ // This is what I'm looking for... the browser type
value = value.toUpperCase();
if (value.indexOf("MOZILLA/5") != -1)
ch = UserInfoModel.WEBSTART.charAt(0); // Browser 5.x... Use plug-in (yeah!)
if (value.indexOf("MOZILLA/4") != -1)
ch = UserInfoModel.WEBSTART.charAt(0); // Browser 4.x... must use plug-in
if (value.indexOf("MSIE") != -1)
ch = UserInfoModel.WEBSTART.charAt(0); // Microsoft... must use plug-in
if (value.indexOf("WEBKIT") != -1)
ch = UserInfoModel.WEBSTART.charAt(0); // Chrome/Safari... must use plug-in
if (value.indexOf("CHROME") != -1)
ch = UserInfoModel.WEBSTART.charAt(0); // Chrome... must use plug-in
if (value.indexOf("SAFARI") != -1)
ch = UserInfoModel.WEBSTART.charAt(0); // Safari... must use plug-in
break;
}
}
}
if (ch != UserInfoModel.PLUG_IN.charAt(0))
{ // Not the plug-in, use jnlp applet tags
String strWebStartResourceName = this.getProperty("webStart");
if (strWebStartResourceName == null)
strWebStartResourceName = "webStart";
String strApplet = reg.getString(strWebStartResourceName);
String strJnlpURL = reg.getString(strWebStartResourceName + "Jnlp");
if ((strApplet == null) || (strApplet.length() == 0))
strApplet = WEB_START_DEFAULT;
StringBuilder sb = new StringBuilder(strApplet);
StringBuffer sbParams = new StringBuffer();
for (Map.Entry<String,Object> entry : properties.entrySet())
{
String strKey = (String)entry.getKey();
Object objValue = entry.getValue();
String strValue = null;
if (objValue != null)
strValue = objValue.toString();
if (strValue != null)
//x if (strValue.length() > 0)
sbParams.append(strKey + ":\"" + strValue + "\",\n");
}
if (propApplet.get(HtmlConstants.ARCHIVE) != null)
sbParams.append("archive:\"" + propApplet.get(HtmlConstants.ARCHIVE) + "\", \n");
if (propApplet.get(HtmlConstants.NAME) != null)
if (sbParams.indexOf("name:") == -1)
sbParams.append("name:\"" + propApplet.get(HtmlConstants.NAME) + "\", \n");
if (propApplet.get(HtmlConstants.ID) != null)
sbParams.append("id:\"" + propApplet.get(HtmlConstants.ID) + "\", \n");
if (sbParams.indexOf("hash:") == -1)
sbParams.append("hash:location.hash,\n");
if (sbParams.indexOf("draggable:") == -1)
sbParams.append("draggable:true,");
Utility.replace(sb, "{other}", sbParams.toString());
strJnlpURL = Utility.encodeXML(this.getJnlpURL(strJnlpURL, propApplet, properties));
Utility.replace(sb, "{jnlpURL}", strJnlpURL);
Utility.replaceResources(sb, reg, propApplet, null);
out.println(sb.toString());
}
else
{
out.println("<OBJECT classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\"");
out.println(" width=\"" + propApplet.get(HtmlConstants.WIDTH) + "\"");
out.println(" height=\"" + propApplet.get(HtmlConstants.HEIGHT) + "\"");
if (propApplet.get(HtmlConstants.NAME) != null)
out.println(" name=\"" + propApplet.get(HtmlConstants.NAME) + "\"");
out.println(" codebase=\"http://java.sun.com/update/1.5.0/jinstall-1_6_0-windows-i586.cab#Version=1,6,0,0\">");
if (propApplet.get(HtmlConstants.ARCHIVE) != null)
out.println("<param name=\"ARCHIVE\" value=\"" + propApplet.get(HtmlConstants.ARCHIVE) + "\">");
out.println("<param name=\"CODE\" value=\"" + propApplet.get(DBParams.APPLET) + "\">");
out.println("<param name=\"CODEBASE\" value=\"" + propApplet.get(HtmlConstants.CODEBASE) + "\">");
for (Map.Entry<String,Object> entry : properties.entrySet())
{
String strKey = (String)entry.getKey();
Object objValue = entry.getValue();
String strValue = null;
if (objValue != null)
strValue = objValue.toString();
if (strValue != null)
if (strValue.length() > 0)
out.println("<param name=\"" + strKey + "\" value=\"" + strValue + "\">");
}
out.println("<param name=\"type\" value=\"application/x-java-applet;version=1.6.0\">");
out.println("<COMMENT>");
out.println("<EMBED type=\"application/x-java-applet;version=1.6\"");
if (propApplet.get(HtmlConstants.ARCHIVE) != null)
out.println(" java_ARCHIVE=\"" + propApplet.get(HtmlConstants.ARCHIVE) + "\"");
out.println(" java_CODE=\"" + propApplet.get(DBParams.APPLET) + "\"");
out.println(" width=\"" + propApplet.get(HtmlConstants.WIDTH) + "\"");
out.println(" height=\"" + propApplet.get(HtmlConstants.HEIGHT) + "\"");
if (propApplet.get(HtmlConstants.NAME) != null)
out.println(" name=\"" + propApplet.get(HtmlConstants.NAME) + "\"");
out.println(" java_CODEBASE=\"" + propApplet.get(HtmlConstants.CODEBASE) + "\"");
for (Map.Entry<String,Object> entry : properties.entrySet())
{
String strKey = (String)entry.getKey();
Object objValue = entry.getValue();
String strValue = null;
if (objValue != null)
strValue = objValue.toString();
if (strValue != null)
if (strValue.length() > 0)
out.println(" " + strKey + " =\"" + strValue + "\"");
}
out.println(" pluginspage=\"http://java.sun.com/javase/downloads/ea.jsp\"><NOEMBED></COMMENT>");
out.println(" alt=\"Your browser understands the <APPLET> tag but is not running the applet, for some reason.\"");
out.println(" Your browser is completely ignoring the <APPLET> tag!");
out.println("</NOEMBED></EMBED>");
out.println("</OBJECT>");
}
out.println("</center>");
} } | public class class_name {
public void printAppletHtmlScreen(PrintWriter out, ResourceBundle reg)
throws DBException
{
reg = ((BaseApplication)this.getTask().getApplication()).getResources("HtmlApplet", false);
Map<String,Object> propApplet = new Hashtable<String,Object>();
Task task = this.getTask();
Map<String,Object> properties = null;
if (task instanceof ServletTask)
properties = ((ServletTask)task).getRequestProperties(((ServletTask)task).getServletRequest(), true);
else
properties = task.getProperties();
properties = ((AppletHtmlScreen)this.getScreenField()).getAppletProperties(propApplet, properties);
out.println("<center>");
char DEFAULT = ' ';
char ch = ScreenFieldViewAdapter.getFirstToUpper(this.getProperty(DBParams.JAVA), DEFAULT);
if (ch == DEFAULT)
if (this.getTask() instanceof ServletTask)
{ // Default - 'P'lug-in/'A'pplet depends on browser
ch = 'P'; // by Default - use plug-in
HttpServletRequest req = ((ServletTask)this.getTask()).getServletRequest();
Enumeration<?> e = req.getHeaderNames();
while (e.hasMoreElements())
{
String name = (String)e.nextElement();
String value = req.getHeader(name);
if ((name != null) && (name.equalsIgnoreCase("User-Agent")) && (value != null))
{ // This is what I'm looking for... the browser type
value = value.toUpperCase(); // depends on control dependency: [if], data = [none]
if (value.indexOf("MOZILLA/5") != -1)
ch = UserInfoModel.WEBSTART.charAt(0); // Browser 5.x... Use plug-in (yeah!)
if (value.indexOf("MOZILLA/4") != -1)
ch = UserInfoModel.WEBSTART.charAt(0); // Browser 4.x... must use plug-in
if (value.indexOf("MSIE") != -1)
ch = UserInfoModel.WEBSTART.charAt(0); // Microsoft... must use plug-in
if (value.indexOf("WEBKIT") != -1)
ch = UserInfoModel.WEBSTART.charAt(0); // Chrome/Safari... must use plug-in
if (value.indexOf("CHROME") != -1)
ch = UserInfoModel.WEBSTART.charAt(0); // Chrome... must use plug-in
if (value.indexOf("SAFARI") != -1)
ch = UserInfoModel.WEBSTART.charAt(0); // Safari... must use plug-in
break;
}
}
}
if (ch != UserInfoModel.PLUG_IN.charAt(0))
{ // Not the plug-in, use jnlp applet tags
String strWebStartResourceName = this.getProperty("webStart");
if (strWebStartResourceName == null)
strWebStartResourceName = "webStart";
String strApplet = reg.getString(strWebStartResourceName);
String strJnlpURL = reg.getString(strWebStartResourceName + "Jnlp");
if ((strApplet == null) || (strApplet.length() == 0))
strApplet = WEB_START_DEFAULT;
StringBuilder sb = new StringBuilder(strApplet);
StringBuffer sbParams = new StringBuffer();
for (Map.Entry<String,Object> entry : properties.entrySet())
{
String strKey = (String)entry.getKey();
Object objValue = entry.getValue();
String strValue = null;
if (objValue != null)
strValue = objValue.toString();
if (strValue != null)
//x if (strValue.length() > 0)
sbParams.append(strKey + ":\"" + strValue + "\",\n");
}
if (propApplet.get(HtmlConstants.ARCHIVE) != null)
sbParams.append("archive:\"" + propApplet.get(HtmlConstants.ARCHIVE) + "\", \n");
if (propApplet.get(HtmlConstants.NAME) != null)
if (sbParams.indexOf("name:") == -1)
sbParams.append("name:\"" + propApplet.get(HtmlConstants.NAME) + "\", \n");
if (propApplet.get(HtmlConstants.ID) != null)
sbParams.append("id:\"" + propApplet.get(HtmlConstants.ID) + "\", \n");
if (sbParams.indexOf("hash:") == -1)
sbParams.append("hash:location.hash,\n");
if (sbParams.indexOf("draggable:") == -1)
sbParams.append("draggable:true,");
Utility.replace(sb, "{other}", sbParams.toString());
strJnlpURL = Utility.encodeXML(this.getJnlpURL(strJnlpURL, propApplet, properties));
Utility.replace(sb, "{jnlpURL}", strJnlpURL);
Utility.replaceResources(sb, reg, propApplet, null);
out.println(sb.toString());
}
else
{
out.println("<OBJECT classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\"");
out.println(" width=\"" + propApplet.get(HtmlConstants.WIDTH) + "\"");
out.println(" height=\"" + propApplet.get(HtmlConstants.HEIGHT) + "\"");
if (propApplet.get(HtmlConstants.NAME) != null)
out.println(" name=\"" + propApplet.get(HtmlConstants.NAME) + "\"");
out.println(" codebase=\"http://java.sun.com/update/1.5.0/jinstall-1_6_0-windows-i586.cab#Version=1,6,0,0\">");
if (propApplet.get(HtmlConstants.ARCHIVE) != null)
out.println("<param name=\"ARCHIVE\" value=\"" + propApplet.get(HtmlConstants.ARCHIVE) + "\">");
out.println("<param name=\"CODE\" value=\"" + propApplet.get(DBParams.APPLET) + "\">");
out.println("<param name=\"CODEBASE\" value=\"" + propApplet.get(HtmlConstants.CODEBASE) + "\">");
for (Map.Entry<String,Object> entry : properties.entrySet())
{
String strKey = (String)entry.getKey();
Object objValue = entry.getValue();
String strValue = null;
if (objValue != null)
strValue = objValue.toString();
if (strValue != null)
if (strValue.length() > 0)
out.println("<param name=\"" + strKey + "\" value=\"" + strValue + "\">");
}
out.println("<param name=\"type\" value=\"application/x-java-applet;version=1.6.0\">");
out.println("<COMMENT>");
out.println("<EMBED type=\"application/x-java-applet;version=1.6\"");
if (propApplet.get(HtmlConstants.ARCHIVE) != null)
out.println(" java_ARCHIVE=\"" + propApplet.get(HtmlConstants.ARCHIVE) + "\"");
out.println(" java_CODE=\"" + propApplet.get(DBParams.APPLET) + "\"");
out.println(" width=\"" + propApplet.get(HtmlConstants.WIDTH) + "\"");
out.println(" height=\"" + propApplet.get(HtmlConstants.HEIGHT) + "\"");
if (propApplet.get(HtmlConstants.NAME) != null)
out.println(" name=\"" + propApplet.get(HtmlConstants.NAME) + "\"");
out.println(" java_CODEBASE=\"" + propApplet.get(HtmlConstants.CODEBASE) + "\"");
for (Map.Entry<String,Object> entry : properties.entrySet())
{
String strKey = (String)entry.getKey();
Object objValue = entry.getValue();
String strValue = null;
if (objValue != null)
strValue = objValue.toString();
if (strValue != null)
if (strValue.length() > 0)
out.println(" " + strKey + " =\"" + strValue + "\"");
}
out.println(" pluginspage=\"http://java.sun.com/javase/downloads/ea.jsp\"><NOEMBED></COMMENT>");
out.println(" alt=\"Your browser understands the <APPLET> tag but is not running the applet, for some reason.\"");
out.println(" Your browser is completely ignoring the <APPLET> tag!");
out.println("</NOEMBED></EMBED>");
out.println("</OBJECT>");
}
out.println("</center>");
} } |
public class class_name {
@BeforeExperiment void setUp() {
final long seed = 99;
final Random rnd = new Random(seed);
strings = new String[STRING_COUNT];
for (int i = 0; i < STRING_COUNT; i++) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < charCount; j++) {
int codePoint;
// discard illegal surrogate "codepoints"
do {
codePoint = rnd.nextInt(maxCodePoint.value);
} while (isSurrogate(codePoint));
sb.appendCodePoint(codePoint);
}
strings[i] = sb.toString();
}
// The reps will continue until the non-determinism detector is pacified!
getBytes(100);
} } | public class class_name {
@BeforeExperiment void setUp() {
final long seed = 99;
final Random rnd = new Random(seed);
strings = new String[STRING_COUNT];
for (int i = 0; i < STRING_COUNT; i++) {
StringBuilder sb = new StringBuilder();
for (int j = 0; j < charCount; j++) {
int codePoint;
// discard illegal surrogate "codepoints"
do {
codePoint = rnd.nextInt(maxCodePoint.value);
} while (isSurrogate(codePoint));
sb.appendCodePoint(codePoint); // depends on control dependency: [for], data = [none]
}
strings[i] = sb.toString(); // depends on control dependency: [for], data = [i]
}
// The reps will continue until the non-determinism detector is pacified!
getBytes(100);
} } |
public class class_name {
protected void addAllClasses(Content content, boolean wantFrames) {
for (int i = 0; i < indexbuilder.elements().length; i++) {
Character unicode = (Character)((indexbuilder.elements())[i]);
addContents(indexbuilder.getMemberList(unicode), wantFrames, content);
}
} } | public class class_name {
protected void addAllClasses(Content content, boolean wantFrames) {
for (int i = 0; i < indexbuilder.elements().length; i++) {
Character unicode = (Character)((indexbuilder.elements())[i]);
addContents(indexbuilder.getMemberList(unicode), wantFrames, content); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
private void setArc(int x, int y, int width, int height, int startAngle,
int arcAngle) {
if (this.arc == null) {
this.arc = new Arc2D.Double(x, y, width, height, startAngle,
arcAngle, Arc2D.PIE);
} else {
this.arc.setArc(x, y, width, height, startAngle, arcAngle,
Arc2D.PIE);
}
} } | public class class_name {
private void setArc(int x, int y, int width, int height, int startAngle,
int arcAngle) {
if (this.arc == null) {
this.arc = new Arc2D.Double(x, y, width, height, startAngle,
arcAngle, Arc2D.PIE); // depends on control dependency: [if], data = [none]
} else {
this.arc.setArc(x, y, width, height, startAngle, arcAngle,
Arc2D.PIE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void addPlugin(ComponentPlugin plugin)
{
if (plugin instanceof AddActionsPlugin)
{
AddActionsPlugin cplugin = (AddActionsPlugin)plugin;
for (ActionConfiguration ac : cplugin.getActions())
{
try
{
SessionEventMatcher matcher =
new SessionEventMatcher(getEventTypes(ac.getEventTypes()), getPaths(ac.getPath()), ac.isDeep(),
getWorkspaces(ac.getWorkspace()), getNames(ac.getNodeTypes()), typeDataManager);
Action action =
ac.getAction() != null ? ac.getAction() : (Action)ClassLoading.forName(ac.getActionClassName(), this)
.newInstance();
addAction(matcher, action);
}
catch (Exception e)
{
log.error(e.getLocalizedMessage(), e);
}
}
}
} } | public class class_name {
public void addPlugin(ComponentPlugin plugin)
{
if (plugin instanceof AddActionsPlugin)
{
AddActionsPlugin cplugin = (AddActionsPlugin)plugin;
for (ActionConfiguration ac : cplugin.getActions())
{
try
{
SessionEventMatcher matcher =
new SessionEventMatcher(getEventTypes(ac.getEventTypes()), getPaths(ac.getPath()), ac.isDeep(),
getWorkspaces(ac.getWorkspace()), getNames(ac.getNodeTypes()), typeDataManager);
Action action =
ac.getAction() != null ? ac.getAction() : (Action)ClassLoading.forName(ac.getActionClassName(), this)
.newInstance();
addAction(matcher, action); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
log.error(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public IndexGroup[] process(final IndexEntry[] theIndexEntries, final IndexConfiguration theIndexConfiguration,
final Locale theLocale) {
final IndexCollator collator = new IndexCollator(theLocale);
final ArrayList<MyIndexGroup> result = new ArrayList<MyIndexGroup>();
final ConfigEntry[] entries = theIndexConfiguration.getEntries();
final HashMap<String, IndexEntry> indexMap = createMap(theIndexEntries);
//Creating array of index groups
for (final ConfigEntry configEntry : entries) {
final String label = configEntry.getLabel();
final MyIndexGroup group = new MyIndexGroup(label,configEntry);
result.add(group);
}
final MyIndexGroup[] IndexGroups = (MyIndexGroup[]) result.toArray(new MyIndexGroup[result.size()]);
//Adding dependecies to group array
for (int i = 0; i < IndexGroups.length; i++) {
final MyIndexGroup thisGroup = IndexGroups[i];
final String[] thisGroupMembers = thisGroup.getConfigEntry().getGroupMembers();
for (int j = 0; j < IndexGroups.length; j++) {
if (j != i) {
final MyIndexGroup compGroup = IndexGroups[j];
final String[] compGroupMembers = compGroup.getConfigEntry().getGroupMembers();
if (doesStart(compGroupMembers, thisGroupMembers)) {
thisGroup.addChild(compGroup);
}
}
}
}
/*
for (int i = 0; i < IndexGroups.length; i++) {
IndexGroups[i].printDebug();
}
*/
for (int i = 0; i < IndexGroups.length; i++) {
final MyIndexGroup group = IndexGroups[i];
final ConfigEntry configEntry = group.getConfigEntry();
final String[] groupMembers = configEntry.getGroupMembers();
if (groupMembers.length > 0) {
//Find entries by comaping first letter with a chars in current config entry
for (final String key : new ArrayList<String>(indexMap.keySet())) {
if (key.length() > 0) {
final String value = getValue((IndexEntry) indexMap.get(key));
// final char c = value.charAt(0);
if (configEntry.isInRange(value,collator)) {
final IndexEntry entry = (IndexEntry) indexMap.remove(key);
group.addEntry(entry);
}
}
}
} else {
//Get index entries by range specified by two keys
final String key1 = configEntry.getKey();
String key2 = null;
if ((i + 1) < entries.length) {
final ConfigEntry nextEntry = entries[i + 1];
key2 = nextEntry.getKey();
}
final String[] indexMapKeys = getIndexKeysOfIndexesInRange(key1, key2, collator, indexMap);
for (final String mapKey : indexMapKeys) {
final IndexEntry entry = (IndexEntry) indexMap.remove(mapKey);
group.addEntry(entry);
}
}
/*
if (group.getEntries().length > 0) {
result.add(group);
}
*/
}
//If some terms remain uncategorized, and a recognized special character
//group is available, place remaining terms in that group
for (int i = 0; i < IndexGroups.length; i++) {
final MyIndexGroup group = IndexGroups[i];
final ConfigEntry configEntry = group.getConfigEntry();
final String configKey = configEntry.getKey();
if (configKey.equals(SPECIAL_CHARACTER_GROUP_KEY)) {
for (final String key : new ArrayList<String>(indexMap.keySet())) {
if (key.length() > 0) {
final String value = getValue((IndexEntry) indexMap.get(key));
// final char c = value.charAt(0);
logger.info(MessageUtils.getMessage("PDFJ003I", value).toString());
final IndexEntry entry = (IndexEntry) indexMap.remove(key);
group.addEntry(entry);
}
}
}
}
//No recognized "Special characters" group; uncategorized terms have no place to go, must be dropped
if (!indexMap.isEmpty()) {
for (final String key : new ArrayList<String>(indexMap.keySet())) {
if (key.length() > 0) {
final IndexEntry entry = (IndexEntry) indexMap.get(key);
logger.error(MessageUtils.getMessage("PDFJ001E", entry.toString()).toString());
}
}
if (IndexPreprocessorTask.failOnError) {
logger.error(MessageUtils.getMessage("PDFJ002E").toString());
IndexPreprocessorTask.processingFaild=true;
}
}
final ArrayList<MyIndexGroup> cleanResult = new ArrayList<MyIndexGroup>();
for (final MyIndexGroup indexGroup : IndexGroups) {
if (indexGroup.getEntries().length > 0) {
cleanResult.add(indexGroup);
}
}
final MyIndexGroup[] cleanIndexGroups = (MyIndexGroup[]) cleanResult.toArray(new MyIndexGroup[cleanResult.size()]);
return cleanIndexGroups;
} } | public class class_name {
public IndexGroup[] process(final IndexEntry[] theIndexEntries, final IndexConfiguration theIndexConfiguration,
final Locale theLocale) {
final IndexCollator collator = new IndexCollator(theLocale);
final ArrayList<MyIndexGroup> result = new ArrayList<MyIndexGroup>();
final ConfigEntry[] entries = theIndexConfiguration.getEntries();
final HashMap<String, IndexEntry> indexMap = createMap(theIndexEntries);
//Creating array of index groups
for (final ConfigEntry configEntry : entries) {
final String label = configEntry.getLabel();
final MyIndexGroup group = new MyIndexGroup(label,configEntry);
result.add(group); // depends on control dependency: [for], data = [none]
}
final MyIndexGroup[] IndexGroups = (MyIndexGroup[]) result.toArray(new MyIndexGroup[result.size()]);
//Adding dependecies to group array
for (int i = 0; i < IndexGroups.length; i++) {
final MyIndexGroup thisGroup = IndexGroups[i];
final String[] thisGroupMembers = thisGroup.getConfigEntry().getGroupMembers();
for (int j = 0; j < IndexGroups.length; j++) {
if (j != i) {
final MyIndexGroup compGroup = IndexGroups[j];
final String[] compGroupMembers = compGroup.getConfigEntry().getGroupMembers();
if (doesStart(compGroupMembers, thisGroupMembers)) {
thisGroup.addChild(compGroup); // depends on control dependency: [if], data = [none]
}
}
}
}
/*
for (int i = 0; i < IndexGroups.length; i++) {
IndexGroups[i].printDebug();
}
*/
for (int i = 0; i < IndexGroups.length; i++) {
final MyIndexGroup group = IndexGroups[i];
final ConfigEntry configEntry = group.getConfigEntry();
final String[] groupMembers = configEntry.getGroupMembers();
if (groupMembers.length > 0) {
//Find entries by comaping first letter with a chars in current config entry
for (final String key : new ArrayList<String>(indexMap.keySet())) {
if (key.length() > 0) {
final String value = getValue((IndexEntry) indexMap.get(key));
// final char c = value.charAt(0);
if (configEntry.isInRange(value,collator)) {
final IndexEntry entry = (IndexEntry) indexMap.remove(key);
group.addEntry(entry); // depends on control dependency: [if], data = [none]
}
}
}
} else {
//Get index entries by range specified by two keys
final String key1 = configEntry.getKey();
String key2 = null;
if ((i + 1) < entries.length) {
final ConfigEntry nextEntry = entries[i + 1];
key2 = nextEntry.getKey(); // depends on control dependency: [if], data = [none]
}
final String[] indexMapKeys = getIndexKeysOfIndexesInRange(key1, key2, collator, indexMap);
for (final String mapKey : indexMapKeys) {
final IndexEntry entry = (IndexEntry) indexMap.remove(mapKey);
group.addEntry(entry); // depends on control dependency: [for], data = [none]
}
}
/*
if (group.getEntries().length > 0) {
result.add(group);
}
*/
}
//If some terms remain uncategorized, and a recognized special character
//group is available, place remaining terms in that group
for (int i = 0; i < IndexGroups.length; i++) {
final MyIndexGroup group = IndexGroups[i];
final ConfigEntry configEntry = group.getConfigEntry();
final String configKey = configEntry.getKey();
if (configKey.equals(SPECIAL_CHARACTER_GROUP_KEY)) {
for (final String key : new ArrayList<String>(indexMap.keySet())) {
if (key.length() > 0) {
final String value = getValue((IndexEntry) indexMap.get(key));
// final char c = value.charAt(0);
logger.info(MessageUtils.getMessage("PDFJ003I", value).toString()); // depends on control dependency: [if], data = [none]
final IndexEntry entry = (IndexEntry) indexMap.remove(key);
group.addEntry(entry); // depends on control dependency: [if], data = [none]
}
}
}
}
//No recognized "Special characters" group; uncategorized terms have no place to go, must be dropped
if (!indexMap.isEmpty()) {
for (final String key : new ArrayList<String>(indexMap.keySet())) {
if (key.length() > 0) {
final IndexEntry entry = (IndexEntry) indexMap.get(key);
logger.error(MessageUtils.getMessage("PDFJ001E", entry.toString()).toString()); // depends on control dependency: [if], data = [none]
}
}
if (IndexPreprocessorTask.failOnError) {
logger.error(MessageUtils.getMessage("PDFJ002E").toString()); // depends on control dependency: [if], data = [none]
IndexPreprocessorTask.processingFaild=true; // depends on control dependency: [if], data = [none]
}
}
final ArrayList<MyIndexGroup> cleanResult = new ArrayList<MyIndexGroup>();
for (final MyIndexGroup indexGroup : IndexGroups) {
if (indexGroup.getEntries().length > 0) {
cleanResult.add(indexGroup); // depends on control dependency: [if], data = [none]
}
}
final MyIndexGroup[] cleanIndexGroups = (MyIndexGroup[]) cleanResult.toArray(new MyIndexGroup[cleanResult.size()]);
return cleanIndexGroups;
} } |
public class class_name {
private static byte[] bytes(int... vals) {
final byte[] octets = new byte[vals.length];
for (int i = 0; i < vals.length; i++) {
octets[i] = (byte) vals[i];
}
return octets;
} } | public class class_name {
private static byte[] bytes(int... vals) {
final byte[] octets = new byte[vals.length];
for (int i = 0; i < vals.length; i++) {
octets[i] = (byte) vals[i]; // depends on control dependency: [for], data = [i]
}
return octets;
} } |
public class class_name {
private @Nullable String parseRequest(String line) {
if (!isRead(line)) {
return null;
}
String url = getRequestUrl(line);
if (url.length() > 12) {
String path = getPath(url);
if (isAllowed(path)) {
return path;
}
}
return null;
} } | public class class_name {
private @Nullable String parseRequest(String line) {
if (!isRead(line)) {
return null; // depends on control dependency: [if], data = [none]
}
String url = getRequestUrl(line);
if (url.length() > 12) {
String path = getPath(url);
if (isAllowed(path)) {
return path; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public D plus(D duration) {
if (duration.isEmpty()) {
return this.self();
}
long value = this.amount;
return this.with(MathUtils.safeCast(value + duration.getAmount()));
} } | public class class_name {
public D plus(D duration) {
if (duration.isEmpty()) {
return this.self(); // depends on control dependency: [if], data = [none]
}
long value = this.amount;
return this.with(MathUtils.safeCast(value + duration.getAmount()));
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.