code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void genDef(JCTree tree, Env<GenContext> env) {
Env<GenContext> prevEnv = this.env;
try {
this.env = env;
tree.accept(this);
} catch (CompletionFailure ex) {
chk.completionError(tree.pos(), ex);
} finally {
this.env = prevEnv;
}
} } | public class class_name {
public void genDef(JCTree tree, Env<GenContext> env) {
Env<GenContext> prevEnv = this.env;
try {
this.env = env; // depends on control dependency: [try], data = [none]
tree.accept(this); // depends on control dependency: [try], data = [none]
} catch (CompletionFailure ex) {
chk.completionError(tree.pos(), ex);
} finally { // depends on control dependency: [catch], data = [none]
this.env = prevEnv;
}
} } |
public class class_name {
public double computeAverageDerivative(Point2D_F64 a, Point2D_F64 b, double tanX, double tanY) {
samplesInside = 0;
averageUp = averageDown = 0;
for (int i = 0; i < numSamples; i++) {
double x = (b.x-a.x)*i/(numSamples-1) + a.x;
double y = (b.y-a.y)*i/(numSamples-1) + a.y;
double x0 = x+tanX;
double y0 = y+tanY;
if(!BoofMiscOps.checkInside(integralImage.getWidth(),integralImage.getHeight(),x0,y0))
continue;
double x1 = x-tanX;
double y1 = y-tanY;
if(!BoofMiscOps.checkInside(integralImage.getWidth(),integralImage.getHeight(),x1,y1))
continue;
samplesInside++;
double up = integral.compute(x,y,x0,y0);
double down = integral.compute(x,y,x1,y1);
// don't take the abs here and require that a high score involves it being entirely black or white around
// the edge. Otherwise a random image would score high
averageUp += up;
averageDown += down;
}
if( samplesInside == 0 )
return 0;
averageUp /= samplesInside;
averageDown /= samplesInside;
return averageUp-averageDown;
} } | public class class_name {
public double computeAverageDerivative(Point2D_F64 a, Point2D_F64 b, double tanX, double tanY) {
samplesInside = 0;
averageUp = averageDown = 0;
for (int i = 0; i < numSamples; i++) {
double x = (b.x-a.x)*i/(numSamples-1) + a.x;
double y = (b.y-a.y)*i/(numSamples-1) + a.y;
double x0 = x+tanX;
double y0 = y+tanY;
if(!BoofMiscOps.checkInside(integralImage.getWidth(),integralImage.getHeight(),x0,y0))
continue;
double x1 = x-tanX;
double y1 = y-tanY;
if(!BoofMiscOps.checkInside(integralImage.getWidth(),integralImage.getHeight(),x1,y1))
continue;
samplesInside++; // depends on control dependency: [for], data = [none]
double up = integral.compute(x,y,x0,y0);
double down = integral.compute(x,y,x1,y1);
// don't take the abs here and require that a high score involves it being entirely black or white around
// the edge. Otherwise a random image would score high
averageUp += up; // depends on control dependency: [for], data = [none]
averageDown += down; // depends on control dependency: [for], data = [none]
}
if( samplesInside == 0 )
return 0;
averageUp /= samplesInside;
averageDown /= samplesInside;
return averageUp-averageDown;
} } |
public class class_name {
private static ComapiChatClient createShared(Application app, @NonNull RxComapiClient comapiClient, @NonNull final ChatConfig chatConfig, @NonNull final EventsHandler eventsHandler, @NonNull final CallbackAdapter adapter) {
if (instance == null) {
synchronized (ComapiChatClient.class) {
if (instance == null) {
instance = new ComapiChatClient(app, comapiClient, chatConfig, eventsHandler, adapter);
}
}
}
return instance;
} } | public class class_name {
private static ComapiChatClient createShared(Application app, @NonNull RxComapiClient comapiClient, @NonNull final ChatConfig chatConfig, @NonNull final EventsHandler eventsHandler, @NonNull final CallbackAdapter adapter) {
if (instance == null) {
synchronized (ComapiChatClient.class) { // depends on control dependency: [if], data = [none]
if (instance == null) {
instance = new ComapiChatClient(app, comapiClient, chatConfig, eventsHandler, adapter); // depends on control dependency: [if], data = [none]
}
}
}
return instance;
} } |
public class class_name {
private void setFormerInstitutionNameAndChangeOfInstitution(
PHS398Checklist13 phsChecklist) {
String answer = getAnswer(PROPOSAL_YNQ_QUESTION_116,answerHeaders);
String explanation = getAnswer(PROPOSAL_YNQ_QUESTION_117,answerHeaders);
if (YnqConstant.YES.code().equals(answer)) {
phsChecklist.setIsChangeOfInstitution(YesNoDataType.Y_YES);
if (explanation != null) {
phsChecklist.setFormerInstitutionName(explanation);
}
else {
phsChecklist.setFormerInstitutionName(null);
}
} else {
phsChecklist.setIsChangeOfInstitution(YesNoDataType.N_NO);
}
} } | public class class_name {
private void setFormerInstitutionNameAndChangeOfInstitution(
PHS398Checklist13 phsChecklist) {
String answer = getAnswer(PROPOSAL_YNQ_QUESTION_116,answerHeaders);
String explanation = getAnswer(PROPOSAL_YNQ_QUESTION_117,answerHeaders);
if (YnqConstant.YES.code().equals(answer)) {
phsChecklist.setIsChangeOfInstitution(YesNoDataType.Y_YES); // depends on control dependency: [if], data = [none]
if (explanation != null) {
phsChecklist.setFormerInstitutionName(explanation); // depends on control dependency: [if], data = [(explanation]
}
else {
phsChecklist.setFormerInstitutionName(null); // depends on control dependency: [if], data = [null)]
}
} else {
phsChecklist.setIsChangeOfInstitution(YesNoDataType.N_NO); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static IBlockState applyFacing(IBlockState state, Facing facing)
{
for (IProperty prop : state.getProperties().keySet())
{
if (prop.getName().equals("facing"))
{
if (prop.getValueClass() == EnumFacing.class)
{
EnumFacing current = (EnumFacing) state.getValue(prop);
if (!current.getName().equalsIgnoreCase(facing.name()))
{
return state.withProperty(prop, EnumFacing.valueOf(facing.name()));
}
}
else if (prop.getValueClass() == EnumOrientation.class)
{
EnumOrientation current = (EnumOrientation) state.getValue(prop);
if (!current.getName().equalsIgnoreCase(facing.name()))
{
return state.withProperty(prop, EnumOrientation.valueOf(facing.name()));
}
}
}
}
return state;
} } | public class class_name {
static IBlockState applyFacing(IBlockState state, Facing facing)
{
for (IProperty prop : state.getProperties().keySet())
{
if (prop.getName().equals("facing"))
{
if (prop.getValueClass() == EnumFacing.class)
{
EnumFacing current = (EnumFacing) state.getValue(prop);
if (!current.getName().equalsIgnoreCase(facing.name()))
{
return state.withProperty(prop, EnumFacing.valueOf(facing.name())); // depends on control dependency: [if], data = [none]
}
}
else if (prop.getValueClass() == EnumOrientation.class)
{
EnumOrientation current = (EnumOrientation) state.getValue(prop);
if (!current.getName().equalsIgnoreCase(facing.name()))
{
return state.withProperty(prop, EnumOrientation.valueOf(facing.name())); // depends on control dependency: [if], data = [none]
}
}
}
}
return state;
} } |
public class class_name {
JMFSchema[] getEncodingSchemas() throws MessageEncodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getEncodingSchemas");
JMFSchema[] result;
try {
JMFSchema[] result1 = ((JMFMessage)headerPart.jmfPart).getSchemata();
JMFSchema[] result2 = null;
int resultSize = result1.length;
if (payloadPart != null) {
result2 = ((JMFMessage)payloadPart.jmfPart).getSchemata();
resultSize += result2.length;
}
result = new JMFSchema[resultSize];
System.arraycopy(result1, 0, result, 0, result1.length);
if (payloadPart != null) {
System.arraycopy(result2, 0, result, result1.length, result2.length);
}
} catch (JMFException e) {
// Dump whatever we can of both message parts
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsMsgObject.getEncodingSchemas", "jmo700", this,
new Object[] {
new Object[] { MfpConstants.DM_MESSAGE, headerPart.jmfPart, theMessage },
new Object[] { MfpConstants.DM_MESSAGE, payloadPart.jmfPart, theMessage }
}
);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "getEncodingSchemas failed: " + e);
throw new MessageEncodeFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getEncodingSchemas");
return result;
} } | public class class_name {
JMFSchema[] getEncodingSchemas() throws MessageEncodeFailedException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getEncodingSchemas");
JMFSchema[] result;
try {
JMFSchema[] result1 = ((JMFMessage)headerPart.jmfPart).getSchemata();
JMFSchema[] result2 = null;
int resultSize = result1.length;
if (payloadPart != null) {
result2 = ((JMFMessage)payloadPart.jmfPart).getSchemata(); // depends on control dependency: [if], data = [none]
resultSize += result2.length; // depends on control dependency: [if], data = [none]
}
result = new JMFSchema[resultSize];
System.arraycopy(result1, 0, result, 0, result1.length);
if (payloadPart != null) {
System.arraycopy(result2, 0, result, result1.length, result2.length); // depends on control dependency: [if], data = [none]
}
} catch (JMFException e) {
// Dump whatever we can of both message parts
FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsMsgObject.getEncodingSchemas", "jmo700", this,
new Object[] {
new Object[] { MfpConstants.DM_MESSAGE, headerPart.jmfPart, theMessage },
new Object[] { MfpConstants.DM_MESSAGE, payloadPart.jmfPart, theMessage }
}
);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "getEncodingSchemas failed: " + e);
throw new MessageEncodeFailedException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getEncodingSchemas");
return result;
} } |
public class class_name {
private boolean run(I_CmsReport report, Collection<CmsSite> sites, Collection<String> workplaceUrls) {
try {
DomainGrouping domainGrouping = computeDomainGrouping(sites, workplaceUrls);
if (domainGrouping.isEmpty()) {
report.println(
org.opencms.ui.apps.Messages.get().container(
org.opencms.ui.apps.Messages.RPT_LETSENCRYPT_NO_DOMAINS_0));
return false;
}
String certConfig = domainGrouping.generateCertJson();
if (!m_configUpdater.update(certConfig)) {
report.println(
org.opencms.ui.apps.Messages.get().container(
org.opencms.ui.apps.Messages.RPT_LETSENCRYPT_UPDATE_FAILED_0),
I_CmsReport.FORMAT_WARNING);
return false;
}
return true;
} catch (Exception e) {
report.println(e);
return false;
}
} } | public class class_name {
private boolean run(I_CmsReport report, Collection<CmsSite> sites, Collection<String> workplaceUrls) {
try {
DomainGrouping domainGrouping = computeDomainGrouping(sites, workplaceUrls);
if (domainGrouping.isEmpty()) {
report.println(
org.opencms.ui.apps.Messages.get().container(
org.opencms.ui.apps.Messages.RPT_LETSENCRYPT_NO_DOMAINS_0)); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
String certConfig = domainGrouping.generateCertJson();
if (!m_configUpdater.update(certConfig)) {
report.println(
org.opencms.ui.apps.Messages.get().container(
org.opencms.ui.apps.Messages.RPT_LETSENCRYPT_UPDATE_FAILED_0),
I_CmsReport.FORMAT_WARNING); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
report.println(e);
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
protected SuperColumn getSuperColumnForRow(ConsistencyLevel consistencyLevel, String columnFamilyName,
String rowKey, byte[] superColumnName, String persistenceUnit)
{
ColumnPath cp = new ColumnPath(columnFamilyName);
cp.setSuper_column(superColumnName);
ColumnOrSuperColumn cosc = null;
Connection conn = thriftClient.getConnection();
try
{
cosc = conn.getClient().get(ByteBuffer.wrap(rowKey.getBytes()), cp, consistencyLevel);
}
catch (InvalidRequestException e)
{
log.error("Unable to search from inverted index, Caused by: .", e);
throw new IndexingException(e);
}
catch (NotFoundException e)
{
log.warn("Not found any record in inverted index table.");
}
catch (UnavailableException e)
{
log.error("Unable to search from inverted index, Caused by: .", e);
throw new IndexingException(e);
}
catch (TimedOutException e)
{
log.error("Unable to search from inverted index, Caused by: .", e);
throw new IndexingException(e);
}
catch (TException e)
{
log.error("Unable to search from inverted index, Caused by: .", e);
throw new IndexingException(e);
}
finally
{
thriftClient.releaseConnection(conn);
}
SuperColumn thriftSuperColumn = ThriftDataResultHelper.transformThriftResult(cosc,
ColumnFamilyType.SUPER_COLUMN, null);
return thriftSuperColumn;
} } | public class class_name {
@Override
protected SuperColumn getSuperColumnForRow(ConsistencyLevel consistencyLevel, String columnFamilyName,
String rowKey, byte[] superColumnName, String persistenceUnit)
{
ColumnPath cp = new ColumnPath(columnFamilyName);
cp.setSuper_column(superColumnName);
ColumnOrSuperColumn cosc = null;
Connection conn = thriftClient.getConnection();
try
{
cosc = conn.getClient().get(ByteBuffer.wrap(rowKey.getBytes()), cp, consistencyLevel); // depends on control dependency: [try], data = [none]
}
catch (InvalidRequestException e)
{
log.error("Unable to search from inverted index, Caused by: .", e);
throw new IndexingException(e);
} // depends on control dependency: [catch], data = [none]
catch (NotFoundException e)
{
log.warn("Not found any record in inverted index table.");
} // depends on control dependency: [catch], data = [none]
catch (UnavailableException e)
{
log.error("Unable to search from inverted index, Caused by: .", e);
throw new IndexingException(e);
} // depends on control dependency: [catch], data = [none]
catch (TimedOutException e)
{
log.error("Unable to search from inverted index, Caused by: .", e);
throw new IndexingException(e);
} // depends on control dependency: [catch], data = [none]
catch (TException e)
{
log.error("Unable to search from inverted index, Caused by: .", e);
throw new IndexingException(e);
} // depends on control dependency: [catch], data = [none]
finally
{
thriftClient.releaseConnection(conn);
}
SuperColumn thriftSuperColumn = ThriftDataResultHelper.transformThriftResult(cosc,
ColumnFamilyType.SUPER_COLUMN, null);
return thriftSuperColumn;
} } |
public class class_name {
public void dev_import(final Connection connection) throws DevFailed {
Database db;
if (connection.url.host == null) {
db = ApiUtil.get_db_obj();
} else {
db = ApiUtil.get_db_obj(connection.url.host, connection.url.strPort);
}
// Check if device must be imported directly from IOR
String local_ior = null;
boolean ior_read = false;
if (connection.ior == null) {
final DbDevImportInfo info = db.import_device(connection.devname);
if (info.exported) {
local_ior = info.ior;
ior_read = true;
} else {
Except.throw_connection_failed("TangoApi_DEVICE_NOT_EXPORTED",
connection.devname + " Not Exported !",
"Connection(" + connection.devname + ")");
}
} else {
local_ior = connection.ior;
}
try {
// Import the TANGO device
try {
createDevice(connection, local_ior);
}
catch(final Exception e0) {
if (ior_read || connection.isAlready_connected())
throw e0; // Has already been connected
if (e0.toString().startsWith("org.omg.CORBA.TRANSIENT")) {
throw e0; // Connection failed (Hard killed)
}
// Else it is the first time, retry (ior could have changed)
connection.ior = null;
dev_import(connection);
}
connection.setAlready_connected(true);
connection.ior = local_ior;
} catch (final DevFailed e) {
connection.device = null;
connection.device_2 = null;
connection.device_3 = null;
connection.device_4 = null;
connection.device_5 = null;
connection.ior = null;
throw e;
} catch (final Exception e) {
connection.device = null;
connection.device_2 = null;
connection.device_3 = null;
connection.device_4 = null;
connection.device_5 = null;
connection.ior = null;
final String reason = "TangoApi_CANNOT_IMPORT_DEVICE";
final String s = connection.isAlready_connected() ? "Re-" : "";
final String desc = "Cannot " + s + "import " + connection.devname + " :\n\t"
+ e.toString();
final String origin = "Connection.dev_import(" + connection.devname + ")";
// e.printStackTrace();
Except.throw_connection_failed(reason, desc, origin);
}
} } | public class class_name {
public void dev_import(final Connection connection) throws DevFailed {
Database db;
if (connection.url.host == null) {
db = ApiUtil.get_db_obj();
} else {
db = ApiUtil.get_db_obj(connection.url.host, connection.url.strPort);
}
// Check if device must be imported directly from IOR
String local_ior = null;
boolean ior_read = false;
if (connection.ior == null) {
final DbDevImportInfo info = db.import_device(connection.devname);
if (info.exported) {
local_ior = info.ior;
ior_read = true;
} else {
Except.throw_connection_failed("TangoApi_DEVICE_NOT_EXPORTED",
connection.devname + " Not Exported !",
"Connection(" + connection.devname + ")");
}
} else {
local_ior = connection.ior;
}
try {
// Import the TANGO device
try {
createDevice(connection, local_ior); // depends on control dependency: [try], data = [none]
}
catch(final Exception e0) {
if (ior_read || connection.isAlready_connected())
throw e0; // Has already been connected
if (e0.toString().startsWith("org.omg.CORBA.TRANSIENT")) {
throw e0; // Connection failed (Hard killed)
} // depends on control dependency: [catch], data = [none]
// Else it is the first time, retry (ior could have changed)
connection.ior = null;
dev_import(connection);
}
connection.setAlready_connected(true);
connection.ior = local_ior;
} catch (final DevFailed e) {
connection.device = null;
connection.device_2 = null;
connection.device_3 = null;
connection.device_4 = null;
connection.device_5 = null;
connection.ior = null;
throw e;
} catch (final Exception e) {
connection.device = null;
connection.device_2 = null;
connection.device_3 = null;
connection.device_4 = null;
connection.device_5 = null;
connection.ior = null;
final String reason = "TangoApi_CANNOT_IMPORT_DEVICE";
final String s = connection.isAlready_connected() ? "Re-" : "";
final String desc = "Cannot " + s + "import " + connection.devname + " :\n\t"
+ e.toString();
final String origin = "Connection.dev_import(" + connection.devname + ")";
// e.printStackTrace();
Except.throw_connection_failed(reason, desc, origin);
}
} } |
public class class_name {
static int lowerEdgeIndex( SquareNode node ) {
for (int i = 0; i < node.square.size(); i++) {
if( isOpenEdge(node,i) ) {
int next = addOffset(i,1,node.square.size());
if( isOpenEdge(node,next)) {
return i;
}
if( i == 0 ) {
int previous = node.square.size()-1;
if( isOpenEdge(node,previous)) {
return previous;
}
}
return i;
}
}
throw new RuntimeException("BUG!");
} } | public class class_name {
static int lowerEdgeIndex( SquareNode node ) {
for (int i = 0; i < node.square.size(); i++) {
if( isOpenEdge(node,i) ) {
int next = addOffset(i,1,node.square.size());
if( isOpenEdge(node,next)) {
return i; // depends on control dependency: [if], data = [none]
}
if( i == 0 ) {
int previous = node.square.size()-1;
if( isOpenEdge(node,previous)) {
return previous; // depends on control dependency: [if], data = [none]
}
}
return i; // depends on control dependency: [if], data = [none]
}
}
throw new RuntimeException("BUG!");
} } |
public class class_name {
@Override
public void destroy(Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "destroy(exc)");
}
if (null != udpNetworkLayer) {
workQueueMgr.removeChannel(udpNetworkLayer.getDatagramChannel());
udpNetworkLayer.destroy();
udpNetworkLayer = null;
}
if (udpChannel != null) {
udpChannel.removeConnLink(this);
}
//
// Cleanup anything else that needs to be cleaned up.
//
super.destroy(e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "destroy(exc)");
}
} } | public class class_name {
@Override
public void destroy(Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "destroy(exc)"); // depends on control dependency: [if], data = [none]
}
if (null != udpNetworkLayer) {
workQueueMgr.removeChannel(udpNetworkLayer.getDatagramChannel()); // depends on control dependency: [if], data = [none]
udpNetworkLayer.destroy(); // depends on control dependency: [if], data = [none]
udpNetworkLayer = null; // depends on control dependency: [if], data = [none]
}
if (udpChannel != null) {
udpChannel.removeConnLink(this); // depends on control dependency: [if], data = [none]
}
//
// Cleanup anything else that needs to be cleaned up.
//
super.destroy(e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "destroy(exc)"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static Date string2Date(String date) {
if (date == null) {
return null;
}
int year = Integer.parseInt(date.substring(0, 2));
int month = Integer.parseInt(date.substring(2, 4));
int day = Integer.parseInt(date.substring(4, 6));
int hour = Integer.parseInt(date.substring(6, 8));
int minute = Integer.parseInt(date.substring(8, 10));
int second = 0;
if (date.length() >= 12){
second = Integer.parseInt(date.substring(10, 12));
}
Calendar cal = Calendar.getInstance();
cal.set(convertTwoDigitYear(year), month - 1, day, hour, minute, second);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTime();
} } | public class class_name {
private static Date string2Date(String date) {
if (date == null) {
return null; // depends on control dependency: [if], data = [none]
}
int year = Integer.parseInt(date.substring(0, 2));
int month = Integer.parseInt(date.substring(2, 4));
int day = Integer.parseInt(date.substring(4, 6));
int hour = Integer.parseInt(date.substring(6, 8));
int minute = Integer.parseInt(date.substring(8, 10));
int second = 0;
if (date.length() >= 12){
second = Integer.parseInt(date.substring(10, 12)); // depends on control dependency: [if], data = [none]
}
Calendar cal = Calendar.getInstance();
cal.set(convertTwoDigitYear(year), month - 1, day, hour, minute, second);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTime();
} } |
public class class_name {
static long computeWrappedEuclideanSquared(
IntTuple t0, IntTuple t1, IntTuple size)
{
Utils.checkForEqualSize(t0, t1);
Utils.checkForEqualSize(t0, size);
long sum = 0;
for (int i=0; i<t0.getSize(); i++)
{
int d = MathUtils.wrappedDistance(
t0.get(i), t1.get(i), size.get(i));
sum += d*d;
}
return sum;
} } | public class class_name {
static long computeWrappedEuclideanSquared(
IntTuple t0, IntTuple t1, IntTuple size)
{
Utils.checkForEqualSize(t0, t1);
Utils.checkForEqualSize(t0, size);
long sum = 0;
for (int i=0; i<t0.getSize(); i++)
{
int d = MathUtils.wrappedDistance(
t0.get(i), t1.get(i), size.get(i));
sum += d*d;
// depends on control dependency: [for], data = [none]
}
return sum;
} } |
public class class_name {
private void genGoogMsgCodeForSelectNode(
SoyMsgSelectPart selectPart, MsgNode msgNode, GoogMsgPlaceholderCodeGenInfo codeGenInfo) {
// we need to always traverse into children in case any of the cases have unique placeholder
MsgSelectNode reprNode = msgNode.getRepSelectNode(selectPart.getSelectVarName());
if (!codeGenInfo.pluralsAndSelects.contains(selectPart.getSelectVarName())) {
codeGenInfo.pluralsAndSelects.put(
selectPart.getSelectVarName(), translateExpr(reprNode.getExpr()));
}
for (SoyMsgPart.Case<String> child : selectPart.getCases()) {
genGoogMsgCodeForChildren(child.parts(), msgNode, codeGenInfo);
}
} } | public class class_name {
private void genGoogMsgCodeForSelectNode(
SoyMsgSelectPart selectPart, MsgNode msgNode, GoogMsgPlaceholderCodeGenInfo codeGenInfo) {
// we need to always traverse into children in case any of the cases have unique placeholder
MsgSelectNode reprNode = msgNode.getRepSelectNode(selectPart.getSelectVarName());
if (!codeGenInfo.pluralsAndSelects.contains(selectPart.getSelectVarName())) {
codeGenInfo.pluralsAndSelects.put(
selectPart.getSelectVarName(), translateExpr(reprNode.getExpr())); // depends on control dependency: [if], data = [none]
}
for (SoyMsgPart.Case<String> child : selectPart.getCases()) {
genGoogMsgCodeForChildren(child.parts(), msgNode, codeGenInfo); // depends on control dependency: [for], data = [child]
}
} } |
public class class_name {
public boolean contains(final LocalDate date) {
if (date == null){
return false;
}
if (endDate() == null) {
if (startDate() == null) {
return true;
}
if (date.isEqual(startDate()) || date.isAfter(startDate())) {
return true;
}
return false;
}
return asInterval().contains(date.toInterval());
} } | public class class_name {
public boolean contains(final LocalDate date) {
if (date == null){
return false; // depends on control dependency: [if], data = [none]
}
if (endDate() == null) {
if (startDate() == null) {
return true; // depends on control dependency: [if], data = [none]
}
if (date.isEqual(startDate()) || date.isAfter(startDate())) {
return true; // depends on control dependency: [if], data = [none]
}
return false; // depends on control dependency: [if], data = [none]
}
return asInterval().contains(date.toInterval());
} } |
public class class_name {
public boolean register(Invocation invocation) {
final long callId;
boolean force = invocation.op.isUrgent() || invocation.isRetryCandidate();
try {
callId = force ? callIdSequence.forceNext() : callIdSequence.next();
} catch (HazelcastOverloadException e) {
throw new HazelcastOverloadException("Failed to start invocation due to overload: " + invocation, e);
}
try {
// fails with IllegalStateException if the operation is already active
setCallId(invocation.op, callId);
} catch (IllegalStateException e) {
callIdSequence.complete();
throw e;
}
invocations.put(callId, invocation);
if (!alive) {
invocation.notifyError(new HazelcastInstanceNotActiveException());
return false;
}
return true;
} } | public class class_name {
public boolean register(Invocation invocation) {
final long callId;
boolean force = invocation.op.isUrgent() || invocation.isRetryCandidate();
try {
callId = force ? callIdSequence.forceNext() : callIdSequence.next(); // depends on control dependency: [try], data = [none]
} catch (HazelcastOverloadException e) {
throw new HazelcastOverloadException("Failed to start invocation due to overload: " + invocation, e);
} // depends on control dependency: [catch], data = [none]
try {
// fails with IllegalStateException if the operation is already active
setCallId(invocation.op, callId); // depends on control dependency: [try], data = [none]
} catch (IllegalStateException e) {
callIdSequence.complete();
throw e;
} // depends on control dependency: [catch], data = [none]
invocations.put(callId, invocation);
if (!alive) {
invocation.notifyError(new HazelcastInstanceNotActiveException()); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
private boolean processModifiers(GroovySourceAST t, SimpleGroovyAbstractableElementDoc memberOrClass) {
GroovySourceAST modifiers = t.childOfType(MODIFIERS);
boolean hasNonPublicVisibility = false;
boolean hasPublicVisibility = false;
if (modifiers != null) {
AST currentModifier = modifiers.getFirstChild();
while (currentModifier != null) {
int type = currentModifier.getType();
switch (type) {
case LITERAL_public:
memberOrClass.setPublic(true);
hasPublicVisibility = true;
break;
case LITERAL_protected:
memberOrClass.setProtected(true);
hasNonPublicVisibility = true;
break;
case LITERAL_private:
memberOrClass.setPrivate(true);
hasNonPublicVisibility = true;
break;
case LITERAL_static:
memberOrClass.setStatic(true);
break;
case FINAL:
memberOrClass.setFinal(true);
break;
case ABSTRACT:
memberOrClass.setAbstract(true);
break;
}
currentModifier = currentModifier.getNextSibling();
}
if (!hasNonPublicVisibility && isGroovy && !(memberOrClass instanceof GroovyFieldDoc)) {
// in groovy, methods and classes are assumed public, unless informed otherwise
if (isPackageScope(modifiers)) {
memberOrClass.setPackagePrivate(true);
hasNonPublicVisibility = true;
} else {
memberOrClass.setPublic(true);
}
} else if (!hasNonPublicVisibility && !hasPublicVisibility && !isGroovy) {
if (insideInterface(memberOrClass) || insideAnnotationDef(memberOrClass)) {
memberOrClass.setPublic(true);
} else {
memberOrClass.setPackagePrivate(true);
}
}
if (memberOrClass instanceof GroovyFieldDoc && isGroovy && !hasNonPublicVisibility & !hasPublicVisibility) {
if (isPackageScope(modifiers)) {
memberOrClass.setPackagePrivate(true);
hasNonPublicVisibility = true;
}
}
if (memberOrClass instanceof GroovyFieldDoc && !hasNonPublicVisibility && !hasPublicVisibility && isGroovy) return true;
} else if (isGroovy && !(memberOrClass instanceof GroovyFieldDoc)) {
// in groovy, methods and classes are assumed public, unless informed otherwise
memberOrClass.setPublic(true);
} else if (!isGroovy) {
if (insideInterface(memberOrClass) || insideAnnotationDef(memberOrClass)) {
memberOrClass.setPublic(true);
} else {
memberOrClass.setPackagePrivate(true);
}
}
return memberOrClass instanceof GroovyFieldDoc && isGroovy && !hasNonPublicVisibility & !hasPublicVisibility;
} } | public class class_name {
private boolean processModifiers(GroovySourceAST t, SimpleGroovyAbstractableElementDoc memberOrClass) {
GroovySourceAST modifiers = t.childOfType(MODIFIERS);
boolean hasNonPublicVisibility = false;
boolean hasPublicVisibility = false;
if (modifiers != null) {
AST currentModifier = modifiers.getFirstChild();
while (currentModifier != null) {
int type = currentModifier.getType();
switch (type) {
case LITERAL_public:
memberOrClass.setPublic(true);
hasPublicVisibility = true;
break;
case LITERAL_protected:
memberOrClass.setProtected(true);
hasNonPublicVisibility = true;
break;
case LITERAL_private:
memberOrClass.setPrivate(true);
hasNonPublicVisibility = true;
break;
case LITERAL_static:
memberOrClass.setStatic(true);
break;
case FINAL:
memberOrClass.setFinal(true);
break;
case ABSTRACT:
memberOrClass.setAbstract(true);
break;
}
currentModifier = currentModifier.getNextSibling(); // depends on control dependency: [while], data = [none]
}
if (!hasNonPublicVisibility && isGroovy && !(memberOrClass instanceof GroovyFieldDoc)) {
// in groovy, methods and classes are assumed public, unless informed otherwise
if (isPackageScope(modifiers)) {
memberOrClass.setPackagePrivate(true); // depends on control dependency: [if], data = [none]
hasNonPublicVisibility = true; // depends on control dependency: [if], data = [none]
} else {
memberOrClass.setPublic(true); // depends on control dependency: [if], data = [none]
}
} else if (!hasNonPublicVisibility && !hasPublicVisibility && !isGroovy) {
if (insideInterface(memberOrClass) || insideAnnotationDef(memberOrClass)) {
memberOrClass.setPublic(true); // depends on control dependency: [if], data = [none]
} else {
memberOrClass.setPackagePrivate(true); // depends on control dependency: [if], data = [none]
}
}
if (memberOrClass instanceof GroovyFieldDoc && isGroovy && !hasNonPublicVisibility & !hasPublicVisibility) {
if (isPackageScope(modifiers)) {
memberOrClass.setPackagePrivate(true); // depends on control dependency: [if], data = [none]
hasNonPublicVisibility = true; // depends on control dependency: [if], data = [none]
}
}
if (memberOrClass instanceof GroovyFieldDoc && !hasNonPublicVisibility && !hasPublicVisibility && isGroovy) return true;
} else if (isGroovy && !(memberOrClass instanceof GroovyFieldDoc)) {
// in groovy, methods and classes are assumed public, unless informed otherwise
memberOrClass.setPublic(true); // depends on control dependency: [if], data = [none]
} else if (!isGroovy) {
if (insideInterface(memberOrClass) || insideAnnotationDef(memberOrClass)) {
memberOrClass.setPublic(true); // depends on control dependency: [if], data = [none]
} else {
memberOrClass.setPackagePrivate(true); // depends on control dependency: [if], data = [none]
}
}
return memberOrClass instanceof GroovyFieldDoc && isGroovy && !hasNonPublicVisibility & !hasPublicVisibility;
} } |
public class class_name {
@SuppressWarnings("static-method")
protected void printSynopsis(HelpAppender out, String name, String argumentSynopsis) {
out.printSectionName(SYNOPSIS);
assert name != null;
if (Strings.isNullOrEmpty(argumentSynopsis)) {
out.printText(name, OPTION_SYNOPSIS);
} else {
out.printText(name, OPTION_SYNOPSIS, argumentSynopsis);
}
} } | public class class_name {
@SuppressWarnings("static-method")
protected void printSynopsis(HelpAppender out, String name, String argumentSynopsis) {
out.printSectionName(SYNOPSIS);
assert name != null;
if (Strings.isNullOrEmpty(argumentSynopsis)) {
out.printText(name, OPTION_SYNOPSIS); // depends on control dependency: [if], data = [none]
} else {
out.printText(name, OPTION_SYNOPSIS, argumentSynopsis); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int size() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "size");
/* Because the table could be 'resized' (and therefore replaced) during */
/* the method we get a local ref to the current one & use it throughout. */
Entry[] safeTable = table;
long count = 0;
Entry current;
/* Go through the linked lists in the table, counting non-null entries */
for (int i = 0; i < safeTable.length; i++) {
current = safeTable[i];
while (current != null) {
count++;
current = current.next;
}
}
if (count > Integer.MAX_VALUE) {
count = Integer.MAX_VALUE;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "size", (int)count);
return (int)count;
} } | public class class_name {
public int size() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "size");
/* Because the table could be 'resized' (and therefore replaced) during */
/* the method we get a local ref to the current one & use it throughout. */
Entry[] safeTable = table;
long count = 0;
Entry current;
/* Go through the linked lists in the table, counting non-null entries */
for (int i = 0; i < safeTable.length; i++) {
current = safeTable[i]; // depends on control dependency: [for], data = [i]
while (current != null) {
count++; // depends on control dependency: [while], data = [none]
current = current.next; // depends on control dependency: [while], data = [none]
}
}
if (count > Integer.MAX_VALUE) {
count = Integer.MAX_VALUE; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "size", (int)count);
return (int)count;
} } |
public class class_name {
public static double Exp(double x, int nTerms) {
if (nTerms < 2) return 1 + x;
if (nTerms == 2) {
return 1 + x + (x * x) / 2;
} else {
double mult = x * x;
double fact = 2;
double result = 1 + x + mult / fact;
for (int i = 3; i <= nTerms; i++) {
mult *= x;
fact *= i;
result += mult / fact;
}
return result;
}
} } | public class class_name {
public static double Exp(double x, int nTerms) {
if (nTerms < 2) return 1 + x;
if (nTerms == 2) {
return 1 + x + (x * x) / 2;
// depends on control dependency: [if], data = [none]
} else {
double mult = x * x;
double fact = 2;
double result = 1 + x + mult / fact;
for (int i = 3; i <= nTerms; i++) {
mult *= x;
// depends on control dependency: [for], data = [none]
fact *= i;
// depends on control dependency: [for], data = [i]
result += mult / fact;
// depends on control dependency: [for], data = [none]
}
return result;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
Class<?> getGenericType(Type type) {
if (type instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) type;
Type[] ts = pt.getActualTypeArguments();
if (ts.length == 1) {
return (Class<?>) ts[0];
}
}
Class<?> clazz = (Class<?>) type;
if (clazz.isArray()) {
return clazz.getComponentType();
}
return Object.class;
} } | public class class_name {
Class<?> getGenericType(Type type) {
if (type instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) type;
Type[] ts = pt.getActualTypeArguments();
if (ts.length == 1) {
return (Class<?>) ts[0]; // depends on control dependency: [if], data = [none]
}
}
Class<?> clazz = (Class<?>) type;
if (clazz.isArray()) {
return clazz.getComponentType();
}
return Object.class;
} } |
public class class_name {
private void addCommonCacheKeyParts(StringBuilder builder) {
builder.append("kind=").append(getKind());
List<FilterPredicate> predicates = query.getFilterPredicates();
if (predicates.size() > 0) {
builder.append(",pred=").append(predicates);
}
} } | public class class_name {
private void addCommonCacheKeyParts(StringBuilder builder) {
builder.append("kind=").append(getKind());
List<FilterPredicate> predicates = query.getFilterPredicates();
if (predicates.size() > 0) {
builder.append(",pred=").append(predicates); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public List<DoubleSolution> execute(List<DoubleSolution> parentSolutions) {
DoubleSolution child;
int jrand;
child = (DoubleSolution)currentSolution.copy() ;
int numberOfVariables = parentSolutions.get(0).getNumberOfVariables();
jrand = jRandomGenerator.getRandomValue(0, numberOfVariables - 1);
// STEP 4. Checking the DE variant
if ((DEFAULT_DE_VARIANT.equals(variant)) ||
"best/1/bin".equals(variant)) {
for (int j = 0; j < numberOfVariables; j++) {
if (crRandomGenerator.getRandomValue(0.0, 1.0) < cr || j == jrand) {
double value;
value = parentSolutions.get(2).getVariableValue(j) + f * (parentSolutions.get(0).getVariableValue(
j) -
parentSolutions.get(1).getVariableValue(j));
if (value < child.getLowerBound(j)) {
value = child.getLowerBound(j);
}
if (value > child.getUpperBound(j)) {
value = child.getUpperBound(j);
}
child.setVariableValue(j, value);
} else {
double value;
value = currentSolution.getVariableValue(j);
child.setVariableValue(j, value);
}
}
} else if ("rand/1/exp".equals(variant) ||
"best/1/exp".equals(variant)) {
for (int j = 0; j < numberOfVariables; j++) {
if (crRandomGenerator.getRandomValue(0.0, 1.0) < cr || j == jrand) {
double value;
value = parentSolutions.get(2).getVariableValue(j) + f * (parentSolutions.get(0).getVariableValue(j) -
parentSolutions.get(1).getVariableValue(j));
if (value < child.getLowerBound(j)) {
value = child.getLowerBound(j);
}
if (value > child.getUpperBound(j)) {
value = child.getUpperBound(j);
}
child.setVariableValue(j, value);
} else {
cr = 0.0;
double value;
value = currentSolution.getVariableValue(j);
child.setVariableValue(j, value);
}
}
} else if ("current-to-rand/1".equals(variant) ||
"current-to-best/1".equals(variant)) {
for (int j = 0; j < numberOfVariables; j++) {
double value;
value = currentSolution.getVariableValue(j) + k * (parentSolutions.get(2).getVariableValue(j) -
currentSolution.getVariableValue(j)) +
f * (parentSolutions.get(0).getVariableValue(j) - parentSolutions.get(1).getVariableValue(j));
if (value < child.getLowerBound(j)) {
value = child.getLowerBound(j);
}
if (value > child.getUpperBound(j)) {
value = child.getUpperBound(j);
}
child.setVariableValue(j, value);
}
} else if ("current-to-rand/1/bin".equals(variant) ||
"current-to-best/1/bin".equals(variant)) {
for (int j = 0; j < numberOfVariables; j++) {
if (crRandomGenerator.getRandomValue(0.0, 1.0) < cr || j == jrand) {
double value;
value = currentSolution.getVariableValue(j) + k * (parentSolutions.get(2).getVariableValue(j) -
currentSolution.getVariableValue(j)) +
f * (parentSolutions.get(0).getVariableValue(j) - parentSolutions.get(1).getVariableValue(j));
if (value < child.getLowerBound(j)) {
value = child.getLowerBound(j);
}
if (value > child.getUpperBound(j)) {
value = child.getUpperBound(j);
}
child.setVariableValue(j, value);
} else {
double value;
value = currentSolution.getVariableValue(j);
child.setVariableValue(j, value);
}
}
} else if ("current-to-rand/1/exp".equals(variant) ||
"current-to-best/1/exp".equals(variant)) {
for (int j = 0; j < numberOfVariables; j++) {
if (crRandomGenerator.getRandomValue(0.0, 1.0) < cr || j == jrand) {
double value;
value = currentSolution.getVariableValue(j) + k * (parentSolutions.get(2).getVariableValue(j) -
currentSolution.getVariableValue(j)) +
f * (parentSolutions.get(0).getVariableValue(j) - parentSolutions.get(1).getVariableValue(j));
if (value < child.getLowerBound(j)) {
value = child.getLowerBound(j);
}
if (value > child.getUpperBound(j)) {
value = child.getUpperBound(j);
}
child.setVariableValue(j, value);
} else {
cr = 0.0;
double value;
value = currentSolution.getVariableValue(j);
child.setVariableValue(j, value);
}
}
} else {
JMetalLogger.logger.severe("DifferentialEvolutionCrossover.execute: " +
" unknown DE variant (" + variant + ")");
Class<String> cls = String.class;
String name = cls.getName();
throw new JMetalException("Exception in " + name + ".execute()");
}
List<DoubleSolution> result = new ArrayList<>(1) ;
result.add(child) ;
return result;
} } | public class class_name {
@Override
public List<DoubleSolution> execute(List<DoubleSolution> parentSolutions) {
DoubleSolution child;
int jrand;
child = (DoubleSolution)currentSolution.copy() ;
int numberOfVariables = parentSolutions.get(0).getNumberOfVariables();
jrand = jRandomGenerator.getRandomValue(0, numberOfVariables - 1);
// STEP 4. Checking the DE variant
if ((DEFAULT_DE_VARIANT.equals(variant)) ||
"best/1/bin".equals(variant)) {
for (int j = 0; j < numberOfVariables; j++) {
if (crRandomGenerator.getRandomValue(0.0, 1.0) < cr || j == jrand) {
double value;
value = parentSolutions.get(2).getVariableValue(j) + f * (parentSolutions.get(0).getVariableValue(
j) -
parentSolutions.get(1).getVariableValue(j)); // depends on control dependency: [if], data = [none]
if (value < child.getLowerBound(j)) {
value = child.getLowerBound(j); // depends on control dependency: [if], data = [none]
}
if (value > child.getUpperBound(j)) {
value = child.getUpperBound(j); // depends on control dependency: [if], data = [none]
}
child.setVariableValue(j, value); // depends on control dependency: [if], data = [none]
} else {
double value;
value = currentSolution.getVariableValue(j); // depends on control dependency: [if], data = [none]
child.setVariableValue(j, value); // depends on control dependency: [if], data = [none]
}
}
} else if ("rand/1/exp".equals(variant) ||
"best/1/exp".equals(variant)) {
for (int j = 0; j < numberOfVariables; j++) {
if (crRandomGenerator.getRandomValue(0.0, 1.0) < cr || j == jrand) {
double value;
value = parentSolutions.get(2).getVariableValue(j) + f * (parentSolutions.get(0).getVariableValue(j) -
parentSolutions.get(1).getVariableValue(j)); // depends on control dependency: [if], data = [none]
if (value < child.getLowerBound(j)) {
value = child.getLowerBound(j); // depends on control dependency: [if], data = [none]
}
if (value > child.getUpperBound(j)) {
value = child.getUpperBound(j); // depends on control dependency: [if], data = [none]
}
child.setVariableValue(j, value); // depends on control dependency: [if], data = [none]
} else {
cr = 0.0; // depends on control dependency: [if], data = [none]
double value;
value = currentSolution.getVariableValue(j); // depends on control dependency: [if], data = [none]
child.setVariableValue(j, value); // depends on control dependency: [if], data = [none]
}
}
} else if ("current-to-rand/1".equals(variant) ||
"current-to-best/1".equals(variant)) {
for (int j = 0; j < numberOfVariables; j++) {
double value;
value = currentSolution.getVariableValue(j) + k * (parentSolutions.get(2).getVariableValue(j) -
currentSolution.getVariableValue(j)) +
f * (parentSolutions.get(0).getVariableValue(j) - parentSolutions.get(1).getVariableValue(j)); // depends on control dependency: [for], data = [j]
if (value < child.getLowerBound(j)) {
value = child.getLowerBound(j); // depends on control dependency: [if], data = [none]
}
if (value > child.getUpperBound(j)) {
value = child.getUpperBound(j); // depends on control dependency: [if], data = [none]
}
child.setVariableValue(j, value); // depends on control dependency: [for], data = [j]
}
} else if ("current-to-rand/1/bin".equals(variant) ||
"current-to-best/1/bin".equals(variant)) {
for (int j = 0; j < numberOfVariables; j++) {
if (crRandomGenerator.getRandomValue(0.0, 1.0) < cr || j == jrand) {
double value;
value = currentSolution.getVariableValue(j) + k * (parentSolutions.get(2).getVariableValue(j) -
currentSolution.getVariableValue(j)) +
f * (parentSolutions.get(0).getVariableValue(j) - parentSolutions.get(1).getVariableValue(j)); // depends on control dependency: [if], data = [none]
if (value < child.getLowerBound(j)) {
value = child.getLowerBound(j); // depends on control dependency: [if], data = [none]
}
if (value > child.getUpperBound(j)) {
value = child.getUpperBound(j); // depends on control dependency: [if], data = [none]
}
child.setVariableValue(j, value); // depends on control dependency: [if], data = [none]
} else {
double value;
value = currentSolution.getVariableValue(j); // depends on control dependency: [if], data = [none]
child.setVariableValue(j, value); // depends on control dependency: [if], data = [none]
}
}
} else if ("current-to-rand/1/exp".equals(variant) ||
"current-to-best/1/exp".equals(variant)) {
for (int j = 0; j < numberOfVariables; j++) {
if (crRandomGenerator.getRandomValue(0.0, 1.0) < cr || j == jrand) {
double value;
value = currentSolution.getVariableValue(j) + k * (parentSolutions.get(2).getVariableValue(j) -
currentSolution.getVariableValue(j)) +
f * (parentSolutions.get(0).getVariableValue(j) - parentSolutions.get(1).getVariableValue(j)); // depends on control dependency: [if], data = [none]
if (value < child.getLowerBound(j)) {
value = child.getLowerBound(j); // depends on control dependency: [if], data = [none]
}
if (value > child.getUpperBound(j)) {
value = child.getUpperBound(j); // depends on control dependency: [if], data = [none]
}
child.setVariableValue(j, value); // depends on control dependency: [if], data = [none]
} else {
cr = 0.0; // depends on control dependency: [if], data = [none]
double value;
value = currentSolution.getVariableValue(j); // depends on control dependency: [if], data = [none]
child.setVariableValue(j, value); // depends on control dependency: [if], data = [none]
}
}
} else {
JMetalLogger.logger.severe("DifferentialEvolutionCrossover.execute: " +
" unknown DE variant (" + variant + ")");
Class<String> cls = String.class;
String name = cls.getName();
throw new JMetalException("Exception in " + name + ".execute()");
}
List<DoubleSolution> result = new ArrayList<>(1) ;
result.add(child) ;
return result;
} } |
public class class_name {
public synchronized final void activateOptions() {
this.deactivateOptions();
super.activateOptions();
if (getFilterEmptyMessages()) {
addFilter(new EmptyMessageFilter());
}
// rollables
this.setFileRollable(new CompositeRoller(this, this.getProperties()));
// scavenger
LogFileScavenger fileScavenger = this.getLogFileScavenger();
if (fileScavenger == null) {
fileScavenger = this.initLogFileScavenger(new DefaultLogFileScavenger());
}
fileScavenger.begin();
// compressor
final LogFileCompressor logFileCompressor = new LogFileCompressor(this, this.getProperties());
this.setLogFileCompressor(logFileCompressor);
this.getFileRollable().addFileRollEventListener(logFileCompressor);
logFileCompressor.begin();
// guest listener
this.registerGuestFileRollEventListener();
// roll enforcer
final TimeBasedRollEnforcer logRollEnforcer = new TimeBasedRollEnforcer(this, this.getProperties());
this.setLogRollEnforcer(logRollEnforcer);
logRollEnforcer.begin();
// roll on start-up
if (this.getProperties().shouldRollOnActivation()) {
synchronized (this) {
this.rollFile(new StartupFileRollEvent());
}
}
} } | public class class_name {
public synchronized final void activateOptions() {
this.deactivateOptions();
super.activateOptions();
if (getFilterEmptyMessages()) {
addFilter(new EmptyMessageFilter()); // depends on control dependency: [if], data = [none]
}
// rollables
this.setFileRollable(new CompositeRoller(this, this.getProperties()));
// scavenger
LogFileScavenger fileScavenger = this.getLogFileScavenger();
if (fileScavenger == null) {
fileScavenger = this.initLogFileScavenger(new DefaultLogFileScavenger()); // depends on control dependency: [if], data = [none]
}
fileScavenger.begin();
// compressor
final LogFileCompressor logFileCompressor = new LogFileCompressor(this, this.getProperties());
this.setLogFileCompressor(logFileCompressor);
this.getFileRollable().addFileRollEventListener(logFileCompressor);
logFileCompressor.begin();
// guest listener
this.registerGuestFileRollEventListener();
// roll enforcer
final TimeBasedRollEnforcer logRollEnforcer = new TimeBasedRollEnforcer(this, this.getProperties());
this.setLogRollEnforcer(logRollEnforcer);
logRollEnforcer.begin();
// roll on start-up
if (this.getProperties().shouldRollOnActivation()) {
synchronized (this) { // depends on control dependency: [if], data = [none]
this.rollFile(new StartupFileRollEvent());
}
}
} } |
public class class_name {
public static synchronized void register(Class<?> clazz, boolean indexable)
{
if (!resources.containsKey(clazz))
{
resources.put(clazz, new RestResource(clazz));
// Optionally register this service as Indexable
if (indexable)
{
IndexableServiceRegistry.register(clazz);
}
revision++;
}
} } | public class class_name {
public static synchronized void register(Class<?> clazz, boolean indexable)
{
if (!resources.containsKey(clazz))
{
resources.put(clazz, new RestResource(clazz)); // depends on control dependency: [if], data = [none]
// Optionally register this service as Indexable
if (indexable)
{
IndexableServiceRegistry.register(clazz); // depends on control dependency: [if], data = [none]
}
revision++; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public DBCollection createCollection(final String collectionName, @Nullable final DBObject options) {
if (options != null) {
try {
executor.execute(getCreateCollectionOperation(collectionName, options), getReadConcern());
} catch (MongoWriteConcernException e) {
throw createWriteConcernException(e);
}
}
return getCollection(collectionName);
} } | public class class_name {
public DBCollection createCollection(final String collectionName, @Nullable final DBObject options) {
if (options != null) {
try {
executor.execute(getCreateCollectionOperation(collectionName, options), getReadConcern()); // depends on control dependency: [try], data = [none]
} catch (MongoWriteConcernException e) {
throw createWriteConcernException(e);
} // depends on control dependency: [catch], data = [none]
}
return getCollection(collectionName);
} } |
public class class_name {
public void marshall(UpdateRelationalDatabaseRequest updateRelationalDatabaseRequest, ProtocolMarshaller protocolMarshaller) {
if (updateRelationalDatabaseRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getRelationalDatabaseName(), RELATIONALDATABASENAME_BINDING);
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getMasterUserPassword(), MASTERUSERPASSWORD_BINDING);
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getRotateMasterUserPassword(), ROTATEMASTERUSERPASSWORD_BINDING);
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getPreferredBackupWindow(), PREFERREDBACKUPWINDOW_BINDING);
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getPreferredMaintenanceWindow(), PREFERREDMAINTENANCEWINDOW_BINDING);
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getEnableBackupRetention(), ENABLEBACKUPRETENTION_BINDING);
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getDisableBackupRetention(), DISABLEBACKUPRETENTION_BINDING);
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getPubliclyAccessible(), PUBLICLYACCESSIBLE_BINDING);
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getApplyImmediately(), APPLYIMMEDIATELY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateRelationalDatabaseRequest updateRelationalDatabaseRequest, ProtocolMarshaller protocolMarshaller) {
if (updateRelationalDatabaseRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getRelationalDatabaseName(), RELATIONALDATABASENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getMasterUserPassword(), MASTERUSERPASSWORD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getRotateMasterUserPassword(), ROTATEMASTERUSERPASSWORD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getPreferredBackupWindow(), PREFERREDBACKUPWINDOW_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getPreferredMaintenanceWindow(), PREFERREDMAINTENANCEWINDOW_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getEnableBackupRetention(), ENABLEBACKUPRETENTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getDisableBackupRetention(), DISABLEBACKUPRETENTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getPubliclyAccessible(), PUBLICLYACCESSIBLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateRelationalDatabaseRequest.getApplyImmediately(), APPLYIMMEDIATELY_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 String getPropertyKey() {
if (StringUtils.isNullOrEmpty(captureStateIdentifier)) {
if (lastModifiedColumn.isPhysicalColumn()) {
Table table = lastModifiedColumn.getPhysicalColumn().getTable();
if (table != null && !StringUtils.isNullOrEmpty(table.getName())) {
return table.getName() + "." + lastModifiedColumn.getName() + ".GreatestLastModifiedTimestamp";
}
}
return lastModifiedColumn.getName() + ".GreatestLastModifiedTimestamp";
}
return captureStateIdentifier.trim() + ".GreatestLastModifiedTimestamp";
} } | public class class_name {
private String getPropertyKey() {
if (StringUtils.isNullOrEmpty(captureStateIdentifier)) {
if (lastModifiedColumn.isPhysicalColumn()) {
Table table = lastModifiedColumn.getPhysicalColumn().getTable();
if (table != null && !StringUtils.isNullOrEmpty(table.getName())) {
return table.getName() + "." + lastModifiedColumn.getName() + ".GreatestLastModifiedTimestamp"; // depends on control dependency: [if], data = [none]
}
}
return lastModifiedColumn.getName() + ".GreatestLastModifiedTimestamp"; // depends on control dependency: [if], data = [none]
}
return captureStateIdentifier.trim() + ".GreatestLastModifiedTimestamp";
} } |
public class class_name {
public TypeInfo getSchemaTypeInfo() {
// dynamic load to support jre 1.4 and 1.5
try {
Method m = element.getClass().getMethod("getSchemaTypeInfo", new Class[] {});
return (TypeInfo) m.invoke(element, ArrayUtil.OBJECT_EMPTY);
}
catch (Exception e) {
throw new PageRuntimeException(Caster.toPageException(e));
}
} } | public class class_name {
public TypeInfo getSchemaTypeInfo() {
// dynamic load to support jre 1.4 and 1.5
try {
Method m = element.getClass().getMethod("getSchemaTypeInfo", new Class[] {});
return (TypeInfo) m.invoke(element, ArrayUtil.OBJECT_EMPTY); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw new PageRuntimeException(Caster.toPageException(e));
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public ConfigurationListing getAllConfigurations()
{
Configuration configuration = new Configuration();
if(this.serviceTicket != null)
{
configuration.setServiceTicket(this.serviceTicket);
}
return new ConfigurationListing(this.postJson(
configuration, WS.Path.Configuration.Version1.getAllConfigurations()));
} } | public class class_name {
public ConfigurationListing getAllConfigurations()
{
Configuration configuration = new Configuration();
if(this.serviceTicket != null)
{
configuration.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [(this.serviceTicket]
}
return new ConfigurationListing(this.postJson(
configuration, WS.Path.Configuration.Version1.getAllConfigurations()));
} } |
public class class_name {
public LatLonRect getLatLonBoundingBox() {
if (llbb == null) {
if ((getXHorizAxis() instanceof CoordinateAxis2D) && (getYHorizAxis() instanceof CoordinateAxis2D)) {
return null;
}
CoordinateAxis horizXaxis = getXHorizAxis();
CoordinateAxis horizYaxis = getYHorizAxis();
if (isLatLon()) {
double startLat = horizYaxis.getMinValue();
double startLon = horizXaxis.getMinValue();
double deltaLat = horizYaxis.getMaxValue() - startLat;
double deltaLon = horizXaxis.getMaxValue() - startLon;
LatLonPoint llpt = new LatLonPointImpl(startLat, startLon);
llbb = new LatLonRect(llpt, deltaLat, deltaLon);
} else {
ProjectionImpl dataProjection = getProjection();
ProjectionRect bb = getBoundingBox();
if (bb != null)
llbb = dataProjection.projToLatLonBB(bb);
}
}
return llbb;
/* // look at all 4 corners of the bounding box
LatLonPointImpl llpt = (LatLonPointImpl) dataProjection.projToLatLon(bb.getLowerLeftPoint(), new LatLonPointImpl());
LatLonPointImpl lrpt = (LatLonPointImpl) dataProjection.projToLatLon(bb.getLowerRightPoint(), new LatLonPointImpl());
LatLonPointImpl urpt = (LatLonPointImpl) dataProjection.projToLatLon(bb.getUpperRightPoint(), new LatLonPointImpl());
LatLonPointImpl ulpt = (LatLonPointImpl) dataProjection.projToLatLon(bb.getUpperLeftPoint(), new LatLonPointImpl());
// Check if grid contains poles.
boolean includesNorthPole = false;
int[] resultNP;
resultNP = findXYindexFromLatLon(90.0, 0, null);
if (resultNP[0] != -1 && resultNP[1] != -1)
includesNorthPole = true;
boolean includesSouthPole = false;
int[] resultSP;
resultSP = findXYindexFromLatLon(-90.0, 0, null);
if (resultSP[0] != -1 && resultSP[1] != -1)
includesSouthPole = true;
if (includesNorthPole && !includesSouthPole) {
llbb = new LatLonRect(llpt, new LatLonPointImpl(90.0, 0.0)); // ??? lon=???
llbb.extend(lrpt);
llbb.extend(urpt);
llbb.extend(ulpt);
// OR
//llbb.extend( new LatLonRect( llpt, lrpt ));
//llbb.extend( new LatLonRect( lrpt, urpt ) );
//llbb.extend( new LatLonRect( urpt, ulpt ) );
//llbb.extend( new LatLonRect( ulpt, llpt ) );
} else if (includesSouthPole && !includesNorthPole) {
llbb = new LatLonRect(llpt, new LatLonPointImpl(-90.0, -180.0)); // ??? lon=???
llbb.extend(lrpt);
llbb.extend(urpt);
llbb.extend(ulpt);
} else {
double latMin = Math.min(llpt.getLatitude(), lrpt.getLatitude());
double latMax = Math.max(ulpt.getLatitude(), urpt.getLatitude());
// longitude is a bit tricky as usual
double lonMin = getMinOrMaxLon(llpt.getLongitude(), ulpt.getLongitude(), true);
double lonMax = getMinOrMaxLon(lrpt.getLongitude(), urpt.getLongitude(), false);
llpt.set(latMin, lonMin);
urpt.set(latMax, lonMax);
llbb = new LatLonRect(llpt, urpt);
}
}
} */
} } | public class class_name {
public LatLonRect getLatLonBoundingBox() {
if (llbb == null) {
if ((getXHorizAxis() instanceof CoordinateAxis2D) && (getYHorizAxis() instanceof CoordinateAxis2D)) {
return null; // depends on control dependency: [if], data = [none]
}
CoordinateAxis horizXaxis = getXHorizAxis();
CoordinateAxis horizYaxis = getYHorizAxis();
if (isLatLon()) {
double startLat = horizYaxis.getMinValue();
double startLon = horizXaxis.getMinValue();
double deltaLat = horizYaxis.getMaxValue() - startLat;
double deltaLon = horizXaxis.getMaxValue() - startLon;
LatLonPoint llpt = new LatLonPointImpl(startLat, startLon);
llbb = new LatLonRect(llpt, deltaLat, deltaLon); // depends on control dependency: [if], data = [none]
} else {
ProjectionImpl dataProjection = getProjection();
ProjectionRect bb = getBoundingBox();
if (bb != null)
llbb = dataProjection.projToLatLonBB(bb);
}
}
return llbb;
/* // look at all 4 corners of the bounding box
LatLonPointImpl llpt = (LatLonPointImpl) dataProjection.projToLatLon(bb.getLowerLeftPoint(), new LatLonPointImpl());
LatLonPointImpl lrpt = (LatLonPointImpl) dataProjection.projToLatLon(bb.getLowerRightPoint(), new LatLonPointImpl());
LatLonPointImpl urpt = (LatLonPointImpl) dataProjection.projToLatLon(bb.getUpperRightPoint(), new LatLonPointImpl());
LatLonPointImpl ulpt = (LatLonPointImpl) dataProjection.projToLatLon(bb.getUpperLeftPoint(), new LatLonPointImpl());
// Check if grid contains poles.
boolean includesNorthPole = false;
int[] resultNP;
resultNP = findXYindexFromLatLon(90.0, 0, null);
if (resultNP[0] != -1 && resultNP[1] != -1)
includesNorthPole = true;
boolean includesSouthPole = false;
int[] resultSP;
resultSP = findXYindexFromLatLon(-90.0, 0, null);
if (resultSP[0] != -1 && resultSP[1] != -1)
includesSouthPole = true;
if (includesNorthPole && !includesSouthPole) {
llbb = new LatLonRect(llpt, new LatLonPointImpl(90.0, 0.0)); // ??? lon=???
llbb.extend(lrpt);
llbb.extend(urpt);
llbb.extend(ulpt);
// OR
//llbb.extend( new LatLonRect( llpt, lrpt ));
//llbb.extend( new LatLonRect( lrpt, urpt ) );
//llbb.extend( new LatLonRect( urpt, ulpt ) );
//llbb.extend( new LatLonRect( ulpt, llpt ) );
} else if (includesSouthPole && !includesNorthPole) {
llbb = new LatLonRect(llpt, new LatLonPointImpl(-90.0, -180.0)); // ??? lon=???
llbb.extend(lrpt);
llbb.extend(urpt);
llbb.extend(ulpt);
} else {
double latMin = Math.min(llpt.getLatitude(), lrpt.getLatitude());
double latMax = Math.max(ulpt.getLatitude(), urpt.getLatitude());
// longitude is a bit tricky as usual
double lonMin = getMinOrMaxLon(llpt.getLongitude(), ulpt.getLongitude(), true);
double lonMax = getMinOrMaxLon(lrpt.getLongitude(), urpt.getLongitude(), false);
llpt.set(latMin, lonMin);
urpt.set(latMax, lonMax);
llbb = new LatLonRect(llpt, urpt);
}
}
} */
} } |
public class class_name {
public static Properties loadPropertiesFromInputStream(InputStream fin) throws IOException {
Properties props = new Properties();
InputStreamReader reader = new InputStreamReader(fin, "UTF-8");
try {
props.load(reader);
return props;
} finally {
if (reader != null) {
reader.close();
}
if (fin != null) {
fin.close();
}
}
} } | public class class_name {
public static Properties loadPropertiesFromInputStream(InputStream fin) throws IOException {
Properties props = new Properties();
InputStreamReader reader = new InputStreamReader(fin, "UTF-8");
try {
props.load(reader);
return props;
} finally {
if (reader != null) {
reader.close(); // depends on control dependency: [if], data = [none]
}
if (fin != null) {
fin.close(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
Object obj = jTextField1.getSelectedItem();
if (obj != null && evt.getActionCommand().equals("comboBoxEdited")) {
generateResult();
}
} } | public class class_name {
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
Object obj = jTextField1.getSelectedItem();
if (obj != null && evt.getActionCommand().equals("comboBoxEdited")) {
generateResult(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void put(NumberVector val, double weight) {
assert (val.getDimensionality() == elements.length);
if(weight == 0) {
return; // Skip zero weights.
}
final double nwsum = weight + wsum;
for(int i = 0; i < elements.length; i++) {
final double delta = val.doubleValue(i) - elements[i];
final double rval = delta * weight / nwsum;
elements[i] += rval;
}
wsum = nwsum;
} } | public class class_name {
public void put(NumberVector val, double weight) {
assert (val.getDimensionality() == elements.length);
if(weight == 0) {
return; // Skip zero weights. // depends on control dependency: [if], data = [none]
}
final double nwsum = weight + wsum;
for(int i = 0; i < elements.length; i++) {
final double delta = val.doubleValue(i) - elements[i];
final double rval = delta * weight / nwsum;
elements[i] += rval; // depends on control dependency: [for], data = [i]
}
wsum = nwsum;
} } |
public class class_name {
public void selectScreenFields()
{
if (this.isOpen())
return; // Can't select after it's open
//x this.setSelected(false);
// for (Enumeration e = m_SFieldList.elements() ; e.hasMoreElements() ;)
{ // This should only be called for Imaged GridScreens (Child windows would be deleted by now if Component)
// ScreenField sField = (ScreenField)e.nextElement();
// if (sField.getConverter() != null) if (sField.getConverter().getField() != null)
// ((BaseField)sField.getConverter().getField()).setSelected(true);
}
Record recordBase = this.getBaseRecord(); // Get an actual Record to add/edit/etc...
if (recordBase != null)
{ // Make sure the main key area's keys are selected
for (int iIndex = DBConstants.MAIN_FIELD; iIndex < recordBase.getFieldCount(); iIndex++)
{
boolean bSelect = false; // By default
BaseField field = recordBase.getField(iIndex);
if (field.isVirtual())
continue; // Who cares if a virtual field is selected or not? (actually, I sometimes need to auto-cache virtuals).
if (field.getComponent(0) != null)
bSelect = true; // If you are linked to a screen field, you should be selected
else
{
FieldListener listener = field.getListener();
while (listener != null)
{
if (listener.respondsToMode(DBConstants.READ_MOVE))
{
if ((!field.isVirtual())
|| (listener instanceof ReadSecondaryHandler))
bSelect = true;
}
listener = (FieldListener)listener.getNextListener(); // Next listener in chain
}
}
field.setSelected(bSelect); // Select/deselect field
}
KeyArea keyArea = recordBase.getKeyArea(DBConstants.MAIN_KEY_AREA);
int iLastIndex = keyArea.getKeyFields() + DBConstants.MAIN_FIELD;
for (int iIndexSeq = DBConstants.MAIN_FIELD; iIndexSeq < iLastIndex; iIndexSeq++)
{ // Make sure the index key is selected!
keyArea.getField(iIndexSeq).setSelected(true);
}
}
this.selectFields(); // This will do nothing, unless there is a specific selection method
} } | public class class_name {
public void selectScreenFields()
{
if (this.isOpen())
return; // Can't select after it's open
//x this.setSelected(false);
// for (Enumeration e = m_SFieldList.elements() ; e.hasMoreElements() ;)
{ // This should only be called for Imaged GridScreens (Child windows would be deleted by now if Component)
// ScreenField sField = (ScreenField)e.nextElement();
// if (sField.getConverter() != null) if (sField.getConverter().getField() != null)
// ((BaseField)sField.getConverter().getField()).setSelected(true);
}
Record recordBase = this.getBaseRecord(); // Get an actual Record to add/edit/etc...
if (recordBase != null)
{ // Make sure the main key area's keys are selected
for (int iIndex = DBConstants.MAIN_FIELD; iIndex < recordBase.getFieldCount(); iIndex++)
{
boolean bSelect = false; // By default
BaseField field = recordBase.getField(iIndex);
if (field.isVirtual())
continue; // Who cares if a virtual field is selected or not? (actually, I sometimes need to auto-cache virtuals).
if (field.getComponent(0) != null)
bSelect = true; // If you are linked to a screen field, you should be selected
else
{
FieldListener listener = field.getListener();
while (listener != null)
{
if (listener.respondsToMode(DBConstants.READ_MOVE))
{
if ((!field.isVirtual())
|| (listener instanceof ReadSecondaryHandler))
bSelect = true;
}
listener = (FieldListener)listener.getNextListener(); // Next listener in chain // depends on control dependency: [while], data = [none]
}
}
field.setSelected(bSelect); // Select/deselect field // depends on control dependency: [for], data = [none]
}
KeyArea keyArea = recordBase.getKeyArea(DBConstants.MAIN_KEY_AREA);
int iLastIndex = keyArea.getKeyFields() + DBConstants.MAIN_FIELD;
for (int iIndexSeq = DBConstants.MAIN_FIELD; iIndexSeq < iLastIndex; iIndexSeq++)
{ // Make sure the index key is selected!
keyArea.getField(iIndexSeq).setSelected(true); // depends on control dependency: [for], data = [iIndexSeq]
}
}
this.selectFields(); // This will do nothing, unless there is a specific selection method
} } |
public class class_name {
private void notifyFlusherException(Throwable t) {
if (flusherException == null) {
LOG.error("An exception happened while flushing the outputs", t);
flusherException = t;
}
} } | public class class_name {
private void notifyFlusherException(Throwable t) {
if (flusherException == null) {
LOG.error("An exception happened while flushing the outputs", t); // depends on control dependency: [if], data = [none]
flusherException = t; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void inject(Configuration config) throws InjectionException {
Object context = config.getContext();
Set<Field> fields = config.getInjectionTargets(InjectionCategory.APPLICATION);
for (Field field : fields) {
try {
if(!field.isAccessible()) field.setAccessible(true);
field.set(context, field.getType().cast(ContextUtils.asActivity(context).getApplication()));
}
catch (Exception e) {
Log.e(getClass().getName(), "Injection Failed!", e);
}
}
} } | public class class_name {
@Override
public void inject(Configuration config) throws InjectionException {
Object context = config.getContext();
Set<Field> fields = config.getInjectionTargets(InjectionCategory.APPLICATION);
for (Field field : fields) {
try {
if(!field.isAccessible()) field.setAccessible(true);
field.set(context, field.getType().cast(ContextUtils.asActivity(context).getApplication())); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
Log.e(getClass().getName(), "Injection Failed!", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public int dot(LongIntVector y) {
if (y instanceof LongIntSortedVector) {
LongIntSortedVector other = ((LongIntSortedVector) y);
int dot = 0;
int oc = 0;
for (int c = 0; c < used; c++) {
while (oc < other.used) {
if (other.indices[oc] < indices[c]) {
oc++;
} else if (indices[c] == other.indices[oc]) {
dot += values[c] * other.values[oc];
break;
} else {
break;
}
}
}
return dot;
} else {
int dot = 0;
for (int c = 0; c < used; c++) {
dot += this.values[c] * y.get(indices[c]);
}
return dot;
}
} } | public class class_name {
public int dot(LongIntVector y) {
if (y instanceof LongIntSortedVector) {
LongIntSortedVector other = ((LongIntSortedVector) y);
int dot = 0;
int oc = 0;
for (int c = 0; c < used; c++) {
while (oc < other.used) {
if (other.indices[oc] < indices[c]) {
oc++; // depends on control dependency: [if], data = [none]
} else if (indices[c] == other.indices[oc]) {
dot += values[c] * other.values[oc]; // depends on control dependency: [if], data = [none]
break;
} else {
break;
}
}
}
return dot; // depends on control dependency: [if], data = [none]
} else {
int dot = 0;
for (int c = 0; c < used; c++) {
dot += this.values[c] * y.get(indices[c]); // depends on control dependency: [for], data = [c]
}
return dot; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public <T> void addQueryParameters( List<? extends Object> paramList, String listId, Class<T> type, String fieldName,
String joinClause, boolean union ) {
List<T> listIdParams;
if( paramList != null && paramList.size() > 0 ) {
Object inputObject = paramList.get(0);
listIdParams = checkAndConvertListToType(paramList, inputObject, listId, type);
} else {
return;
}
String paramName = generateParamName();
StringBuilder queryClause = new StringBuilder("( " + fieldName + " IN (:" + paramName + ")");
if( joinClause != null ) {
queryClause.append(" AND " + joinClause);
}
queryClause.append(" )");
addToQueryBuilder(queryClause.toString(), union, paramName, listIdParams );
} } | public class class_name {
public <T> void addQueryParameters( List<? extends Object> paramList, String listId, Class<T> type, String fieldName,
String joinClause, boolean union ) {
List<T> listIdParams;
if( paramList != null && paramList.size() > 0 ) {
Object inputObject = paramList.get(0);
listIdParams = checkAndConvertListToType(paramList, inputObject, listId, type); // depends on control dependency: [if], data = [none]
} else {
return; // depends on control dependency: [if], data = [none]
}
String paramName = generateParamName();
StringBuilder queryClause = new StringBuilder("( " + fieldName + " IN (:" + paramName + ")");
if( joinClause != null ) {
queryClause.append(" AND " + joinClause);
}
queryClause.append(" )");
addToQueryBuilder(queryClause.toString(), union, paramName, listIdParams );
} } |
public class class_name {
void start() {
// if health script path is not configured don't start the thread.
if (!shouldRun(conf)) {
LOG.info("Not starting node health monitor");
return;
}
nodeHealthScriptScheduler = new Timer("NodeHealthMonitor-Timer", true);
// Start the timer task immediately and
// then periodically at interval time.
nodeHealthScriptScheduler.scheduleAtFixedRate(timer, 0, intervalTime);
} } | public class class_name {
void start() {
// if health script path is not configured don't start the thread.
if (!shouldRun(conf)) {
LOG.info("Not starting node health monitor"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
nodeHealthScriptScheduler = new Timer("NodeHealthMonitor-Timer", true);
// Start the timer task immediately and
// then periodically at interval time.
nodeHealthScriptScheduler.scheduleAtFixedRate(timer, 0, intervalTime);
} } |
public class class_name {
public java.util.List<OperatingSystemConfigurationManager> getConfigurationManagers() {
if (configurationManagers == null) {
configurationManagers = new com.amazonaws.internal.SdkInternalList<OperatingSystemConfigurationManager>();
}
return configurationManagers;
} } | public class class_name {
public java.util.List<OperatingSystemConfigurationManager> getConfigurationManagers() {
if (configurationManagers == null) {
configurationManagers = new com.amazonaws.internal.SdkInternalList<OperatingSystemConfigurationManager>(); // depends on control dependency: [if], data = [none]
}
return configurationManagers;
} } |
public class class_name {
public DesignDocument getFromDesk(String id) {
assertNotEmpty(id, "id");
final DesignDocument dd = new DesignDocument();
final String rootPath = format("%s/%s/", DESIGN_DOCS_DIR, id);
final List<String> elements = listResources(rootPath);
if(elements == null) {
throw new IllegalArgumentException("Design docs directory cannot be empty.");
}
// Views
Map<String, MapReduce> views = null;
if(elements.contains(VIEWS)) {
views = new HashMap<String, MapReduce>();
final String viewsPath = format("%s%s/", rootPath, VIEWS);
for (String viewDirName : listResources(viewsPath)) { // views sub-dirs
final MapReduce mr = new MapReduce();
final String viewPath = format("%s%s/", viewsPath, viewDirName);
final List<String> dirList = listResources(viewPath);
for (String fileName : dirList) { // view files
final String def = readFile(format("/%s%s", viewPath, fileName));
if(MAP_JS.equals(fileName))
mr.setMap(def);
else if(REDUCE_JS.equals(fileName))
mr.setReduce(def);
} // /foreach view files
views.put(viewDirName, mr);
} // /foreach views sub-dirs
} // /views
dd.setId(DESIGN_PREFIX + id);
dd.setLanguage(JAVASCRIPT);
dd.setViews(views);
dd.setFilters(populateMap(rootPath, elements, FILTERS));
dd.setShows(populateMap(rootPath, elements, SHOWS));
dd.setLists(populateMap(rootPath, elements, LISTS));
dd.setUpdates(populateMap(rootPath, elements, UPDATES));
dd.setValidateDocUpdate(readContent(elements, rootPath, VALIDATE_DOC));
dd.setRewrites(dbc.getGson().fromJson(readContent(elements, rootPath, REWRITES), JsonArray.class));
dd.setFulltext(dbc.getGson().fromJson(readContent(elements, rootPath, FULLTEXT), JsonObject.class));
dd.setIndexes(dbc.getGson().fromJson(readContent(elements, rootPath, INDEXES), JsonObject.class));
return dd;
} } | public class class_name {
public DesignDocument getFromDesk(String id) {
assertNotEmpty(id, "id");
final DesignDocument dd = new DesignDocument();
final String rootPath = format("%s/%s/", DESIGN_DOCS_DIR, id);
final List<String> elements = listResources(rootPath);
if(elements == null) {
throw new IllegalArgumentException("Design docs directory cannot be empty.");
}
// Views
Map<String, MapReduce> views = null;
if(elements.contains(VIEWS)) {
views = new HashMap<String, MapReduce>(); // depends on control dependency: [if], data = [none]
final String viewsPath = format("%s%s/", rootPath, VIEWS);
for (String viewDirName : listResources(viewsPath)) { // views sub-dirs
final MapReduce mr = new MapReduce();
final String viewPath = format("%s%s/", viewsPath, viewDirName);
final List<String> dirList = listResources(viewPath);
for (String fileName : dirList) { // view files
final String def = readFile(format("/%s%s", viewPath, fileName));
if(MAP_JS.equals(fileName))
mr.setMap(def);
else if(REDUCE_JS.equals(fileName))
mr.setReduce(def);
} // /foreach view files
views.put(viewDirName, mr); // depends on control dependency: [for], data = [viewDirName]
} // /foreach views sub-dirs
} // /views
dd.setId(DESIGN_PREFIX + id);
dd.setLanguage(JAVASCRIPT);
dd.setViews(views);
dd.setFilters(populateMap(rootPath, elements, FILTERS));
dd.setShows(populateMap(rootPath, elements, SHOWS));
dd.setLists(populateMap(rootPath, elements, LISTS));
dd.setUpdates(populateMap(rootPath, elements, UPDATES));
dd.setValidateDocUpdate(readContent(elements, rootPath, VALIDATE_DOC));
dd.setRewrites(dbc.getGson().fromJson(readContent(elements, rootPath, REWRITES), JsonArray.class));
dd.setFulltext(dbc.getGson().fromJson(readContent(elements, rootPath, FULLTEXT), JsonObject.class));
dd.setIndexes(dbc.getGson().fromJson(readContent(elements, rootPath, INDEXES), JsonObject.class));
return dd;
} } |
public class class_name {
public void setIso6391(String iso6391) {
if(iso6391 != null) {
iso6391 = iso6391.trim();
}
this.iso6391 = iso6391;
} } | public class class_name {
public void setIso6391(String iso6391) {
if(iso6391 != null) {
iso6391 = iso6391.trim(); // depends on control dependency: [if], data = [none]
}
this.iso6391 = iso6391;
} } |
public class class_name {
public void marshall(DeleteSubnetGroupRequest deleteSubnetGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteSubnetGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteSubnetGroupRequest.getSubnetGroupName(), SUBNETGROUPNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteSubnetGroupRequest deleteSubnetGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteSubnetGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteSubnetGroupRequest.getSubnetGroupName(), SUBNETGROUPNAME_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 void captureFiducialPoints() {
Polygon2D_F64 p = regions.grow();
p.vertexes.resize(sidesCollision.size());
for (int i = 0; i < sidesCollision.size(); i++) {
p.get(i).set( sidesCollision.get(i) );
}
quality.addObservations(detector.getDetectedPoints());
gui.getInfoPanel().updateGeometry(quality.getScore());
// once the user has sufficient geometric variation enable save
geometryTrigger |= quality.getScore() >= 1.0;
if( geometryTrigger && magnets.isEmpty() ) {
gui.getInfoPanel().enabledFinishedButton();
}
} } | public class class_name {
private void captureFiducialPoints() {
Polygon2D_F64 p = regions.grow();
p.vertexes.resize(sidesCollision.size());
for (int i = 0; i < sidesCollision.size(); i++) {
p.get(i).set( sidesCollision.get(i) ); // depends on control dependency: [for], data = [i]
}
quality.addObservations(detector.getDetectedPoints());
gui.getInfoPanel().updateGeometry(quality.getScore());
// once the user has sufficient geometric variation enable save
geometryTrigger |= quality.getScore() >= 1.0;
if( geometryTrigger && magnets.isEmpty() ) {
gui.getInfoPanel().enabledFinishedButton(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void createTrashSnapshot() throws IOException {
FileStatus[] pathsInTrash = this.fs.listStatus(this.trashLocation, TRASH_NOT_SNAPSHOT_PATH_FILTER);
if (pathsInTrash.length <= 0) {
LOG.info("Nothing in trash. Will not create snapshot.");
return;
}
Path snapshotDir = new Path(this.trashLocation, new DateTime().toString(TRASH_SNAPSHOT_NAME_FORMATTER));
if (this.fs.exists(snapshotDir)) {
throw new IOException("New snapshot directory " + snapshotDir.toString() + " already exists.");
}
if (!safeFsMkdir(fs, snapshotDir, PERM)) {
throw new IOException("Failed to create new snapshot directory at " + snapshotDir.toString());
}
LOG.info(String.format("Moving %d paths in Trash directory to newly created snapshot at %s.", pathsInTrash.length,
snapshotDir.toString()));
int pathsFailedToMove = 0;
for (FileStatus fileStatus : pathsInTrash) {
Path pathRelativeToTrash = PathUtils.relativizePath(fileStatus.getPath(), this.trashLocation);
Path targetPath = new Path(snapshotDir, pathRelativeToTrash);
boolean movedThisPath = true;
try {
movedThisPath = this.fs.rename(fileStatus.getPath(), targetPath);
} catch (IOException exception) {
LOG.error("Failed to move path " + fileStatus.getPath().toString() + " to snapshot.", exception);
pathsFailedToMove += 1;
continue;
}
if (!movedThisPath) {
LOG.error("Failed to move path " + fileStatus.getPath().toString() + " to snapshot.");
pathsFailedToMove += 1;
}
}
if (pathsFailedToMove > 0) {
LOG.error(
String.format("Failed to move %d paths to the snapshot at %s.", pathsFailedToMove, snapshotDir.toString()));
}
} } | public class class_name {
public void createTrashSnapshot() throws IOException {
FileStatus[] pathsInTrash = this.fs.listStatus(this.trashLocation, TRASH_NOT_SNAPSHOT_PATH_FILTER);
if (pathsInTrash.length <= 0) {
LOG.info("Nothing in trash. Will not create snapshot.");
return;
}
Path snapshotDir = new Path(this.trashLocation, new DateTime().toString(TRASH_SNAPSHOT_NAME_FORMATTER));
if (this.fs.exists(snapshotDir)) {
throw new IOException("New snapshot directory " + snapshotDir.toString() + " already exists.");
}
if (!safeFsMkdir(fs, snapshotDir, PERM)) {
throw new IOException("Failed to create new snapshot directory at " + snapshotDir.toString());
}
LOG.info(String.format("Moving %d paths in Trash directory to newly created snapshot at %s.", pathsInTrash.length,
snapshotDir.toString()));
int pathsFailedToMove = 0;
for (FileStatus fileStatus : pathsInTrash) {
Path pathRelativeToTrash = PathUtils.relativizePath(fileStatus.getPath(), this.trashLocation);
Path targetPath = new Path(snapshotDir, pathRelativeToTrash);
boolean movedThisPath = true;
try {
movedThisPath = this.fs.rename(fileStatus.getPath(), targetPath); // depends on control dependency: [try], data = [none]
} catch (IOException exception) {
LOG.error("Failed to move path " + fileStatus.getPath().toString() + " to snapshot.", exception);
pathsFailedToMove += 1;
continue;
} // depends on control dependency: [catch], data = [none]
if (!movedThisPath) {
LOG.error("Failed to move path " + fileStatus.getPath().toString() + " to snapshot."); // depends on control dependency: [if], data = [none]
pathsFailedToMove += 1; // depends on control dependency: [if], data = [none]
}
}
if (pathsFailedToMove > 0) {
LOG.error(
String.format("Failed to move %d paths to the snapshot at %s.", pathsFailedToMove, snapshotDir.toString()));
}
} } |
public class class_name {
public static void alertUserOnFlowFinished(final ExecutableFlow flow, final AlerterHolder
alerterHolder, final String[] extraReasons) {
final ExecutionOptions options = flow.getExecutionOptions();
final Alerter mailAlerter = alerterHolder.get("email");
if (flow.getStatus() != Status.SUCCEEDED) {
if (options.getFailureEmails() != null && !options.getFailureEmails().isEmpty()) {
try {
mailAlerter.alertOnError(flow, extraReasons);
} catch (final Exception e) {
logger.error("Failed to alert on error for execution " + flow.getExecutionId(), e);
}
}
if (options.getFlowParameters().containsKey("alert.type")) {
final String alertType = options.getFlowParameters().get("alert.type");
final Alerter alerter = alerterHolder.get(alertType);
if (alerter != null) {
try {
alerter.alertOnError(flow, extraReasons);
} catch (final Exception e) {
logger.error("Failed to alert on error by " + alertType + " for execution " + flow
.getExecutionId(), e);
}
} else {
logger.error("Alerter type " + alertType + " doesn't exist. Failed to alert.");
}
}
} else {
if (options.getSuccessEmails() != null && !options.getSuccessEmails().isEmpty()) {
try {
mailAlerter.alertOnSuccess(flow);
} catch (final Exception e) {
logger.error("Failed to alert on success for execution " + flow.getExecutionId(), e);
}
}
if (options.getFlowParameters().containsKey("alert.type")) {
final String alertType = options.getFlowParameters().get("alert.type");
final Alerter alerter = alerterHolder.get(alertType);
if (alerter != null) {
try {
alerter.alertOnSuccess(flow);
} catch (final Exception e) {
logger.error("Failed to alert on success by " + alertType + " for execution " + flow
.getExecutionId(), e);
}
} else {
logger.error("Alerter type " + alertType + " doesn't exist. Failed to alert.");
}
}
}
} } | public class class_name {
public static void alertUserOnFlowFinished(final ExecutableFlow flow, final AlerterHolder
alerterHolder, final String[] extraReasons) {
final ExecutionOptions options = flow.getExecutionOptions();
final Alerter mailAlerter = alerterHolder.get("email");
if (flow.getStatus() != Status.SUCCEEDED) {
if (options.getFailureEmails() != null && !options.getFailureEmails().isEmpty()) {
try {
mailAlerter.alertOnError(flow, extraReasons); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
logger.error("Failed to alert on error for execution " + flow.getExecutionId(), e);
} // depends on control dependency: [catch], data = [none]
}
if (options.getFlowParameters().containsKey("alert.type")) {
final String alertType = options.getFlowParameters().get("alert.type");
final Alerter alerter = alerterHolder.get(alertType);
if (alerter != null) {
try {
alerter.alertOnError(flow, extraReasons); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
logger.error("Failed to alert on error by " + alertType + " for execution " + flow
.getExecutionId(), e);
} // depends on control dependency: [catch], data = [none]
} else {
logger.error("Alerter type " + alertType + " doesn't exist. Failed to alert.");
}
}
} else {
if (options.getSuccessEmails() != null && !options.getSuccessEmails().isEmpty()) {
try {
mailAlerter.alertOnSuccess(flow);
} catch (final Exception e) {
logger.error("Failed to alert on success for execution " + flow.getExecutionId(), e);
}
}
if (options.getFlowParameters().containsKey("alert.type")) {
final String alertType = options.getFlowParameters().get("alert.type");
final Alerter alerter = alerterHolder.get(alertType);
if (alerter != null) {
try {
alerter.alertOnSuccess(flow);
} catch (final Exception e) {
logger.error("Failed to alert on success by " + alertType + " for execution " + flow
.getExecutionId(), e);
}
} else {
logger.error("Alerter type " + alertType + " doesn't exist. Failed to alert."); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public byte[] getColor(float cat)
{
/* First check to see if the category
* value is within the range of this rule. */
float diff = cat - low;
if (diff <= 0f)
return catColor;
// else if (diff < 0)
// {
// /* Category value below lowest value in this rule. */
// return new byte[]{(byte)catColor[0], (byte)catColor[1],
// (byte)catColor[2], (byte)catColor[3]};
// }
else if (diff > range)
{
return new byte[]{(byte)((int)(rmul*range)+(int)catColor[0]),
(byte)((int)(gmul*range)+(int)catColor[1]),
(byte)((int)(bmul*range)+(int)catColor[2]),
(byte)catColor[3]};
}
/* Calculate the color from the gradient */
return new byte[]{(byte)((int)(rmul*diff)+(int)catColor[0]),
(byte)((int)(gmul*diff)+(int)catColor[1]),
(byte)((int)(bmul*diff)+(int)catColor[2]),
(byte)catColor[3]};
} } | public class class_name {
public byte[] getColor(float cat)
{
/* First check to see if the category
* value is within the range of this rule. */
float diff = cat - low;
if (diff <= 0f)
return catColor;
// else if (diff < 0)
// {
// /* Category value below lowest value in this rule. */
// return new byte[]{(byte)catColor[0], (byte)catColor[1],
// (byte)catColor[2], (byte)catColor[3]};
// }
else if (diff > range)
{
return new byte[]{(byte)((int)(rmul*range)+(int)catColor[0]),
(byte)((int)(gmul*range)+(int)catColor[1]),
(byte)((int)(bmul*range)+(int)catColor[2]),
(byte)catColor[3]}; // depends on control dependency: [if], data = [none]
}
/* Calculate the color from the gradient */
return new byte[]{(byte)((int)(rmul*diff)+(int)catColor[0]),
(byte)((int)(gmul*diff)+(int)catColor[1]),
(byte)((int)(bmul*diff)+(int)catColor[2]),
(byte)catColor[3]};
} } |
public class class_name {
public void updateDrawableState(int state, boolean flag) {
final int oldState = mCombinedState;
// Update the combined state flag
if (flag) mCombinedState |= state;
else mCombinedState &= ~state;
// Set the combined state
if (oldState != mCombinedState) {
setState(VIEW_STATE_SETS[mCombinedState]);
}
} } | public class class_name {
public void updateDrawableState(int state, boolean flag) {
final int oldState = mCombinedState;
// Update the combined state flag
if (flag) mCombinedState |= state;
else mCombinedState &= ~state;
// Set the combined state
if (oldState != mCombinedState) {
setState(VIEW_STATE_SETS[mCombinedState]); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static UrlEncodedContent getContent(HttpRequest request) {
HttpContent content = request.getContent();
if (content != null) {
return (UrlEncodedContent) content;
}
UrlEncodedContent result = new UrlEncodedContent(new HashMap<String, Object>());
request.setContent(result);
return result;
} } | public class class_name {
public static UrlEncodedContent getContent(HttpRequest request) {
HttpContent content = request.getContent();
if (content != null) {
return (UrlEncodedContent) content; // depends on control dependency: [if], data = [none]
}
UrlEncodedContent result = new UrlEncodedContent(new HashMap<String, Object>());
request.setContent(result);
return result;
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Override
public Boolean execute() {
User sfsSender = CommandUtil.getSfsUser(sender, api);
User sfsRecipient = CommandUtil.getSfsUser(recipient, api);
if(sfsSender == null || sfsRecipient == null)
return Boolean.FALSE;
message = (message == null) ? "" : message;
ISFSObject sfsParams = null;
if(params != null) {
MessageParamsClass clazz = context.getMessageParamsClass(params.getClass());
if(clazz != null)
sfsParams = new ResponseParamSerializer().object2params(clazz.getUnwrapper(), params);
}
if(sfsParams == null) sfsParams = new SFSObject();
try {
api.sendBuddyMessage(sfsSender, sfsRecipient, message, sfsParams);
} catch (SFSBuddyListException e) {
throw new IllegalStateException(e);
}
return Boolean.TRUE;
} } | public class class_name {
@SuppressWarnings("unchecked")
@Override
public Boolean execute() {
User sfsSender = CommandUtil.getSfsUser(sender, api);
User sfsRecipient = CommandUtil.getSfsUser(recipient, api);
if(sfsSender == null || sfsRecipient == null)
return Boolean.FALSE;
message = (message == null) ? "" : message;
ISFSObject sfsParams = null;
if(params != null) {
MessageParamsClass clazz = context.getMessageParamsClass(params.getClass());
if(clazz != null)
sfsParams = new ResponseParamSerializer().object2params(clazz.getUnwrapper(), params);
}
if(sfsParams == null) sfsParams = new SFSObject();
try {
api.sendBuddyMessage(sfsSender, sfsRecipient, message, sfsParams); // depends on control dependency: [try], data = [none]
} catch (SFSBuddyListException e) {
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
return Boolean.TRUE;
} } |
public class class_name {
public void close() {
//log.debug("Stream close: {}", publishedName);
if (closed.compareAndSet(false, true)) {
if (livePipe != null) {
livePipe.unsubscribe((IProvider) this);
}
// if we have a recording listener, inform that this stream is done
if (recordingListener != null) {
sendRecordStopNotify();
notifyRecordingStop();
// inform the listener to finish and close
recordingListener.get().stop();
}
sendPublishStopNotify();
// TODO: can we send the client something to make sure he stops sending data?
if (connMsgOut != null) {
connMsgOut.unsubscribe(this);
}
notifyBroadcastClose();
// clear the listener after all the notifications have been sent
if (recordingListener != null) {
recordingListener.clear();
}
// clear listeners
if (!listeners.isEmpty()) {
listeners.clear();
}
// deregister with jmx
unregisterJMX();
setState(StreamState.CLOSED);
}
} } | public class class_name {
public void close() {
//log.debug("Stream close: {}", publishedName);
if (closed.compareAndSet(false, true)) {
if (livePipe != null) {
livePipe.unsubscribe((IProvider) this);
// depends on control dependency: [if], data = [none]
}
// if we have a recording listener, inform that this stream is done
if (recordingListener != null) {
sendRecordStopNotify();
// depends on control dependency: [if], data = [none]
notifyRecordingStop();
// depends on control dependency: [if], data = [none]
// inform the listener to finish and close
recordingListener.get().stop();
// depends on control dependency: [if], data = [none]
}
sendPublishStopNotify();
// depends on control dependency: [if], data = [none]
// TODO: can we send the client something to make sure he stops sending data?
if (connMsgOut != null) {
connMsgOut.unsubscribe(this);
// depends on control dependency: [if], data = [none]
}
notifyBroadcastClose();
// depends on control dependency: [if], data = [none]
// clear the listener after all the notifications have been sent
if (recordingListener != null) {
recordingListener.clear();
// depends on control dependency: [if], data = [none]
}
// clear listeners
if (!listeners.isEmpty()) {
listeners.clear();
// depends on control dependency: [if], data = [none]
}
// deregister with jmx
unregisterJMX();
// depends on control dependency: [if], data = [none]
setState(StreamState.CLOSED);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@VisibleForTesting
List<Name> names(Iterable<String> names) {
List<Name> result = new ArrayList<>();
for (String name : names) {
result.add(name(name));
}
return result;
} } | public class class_name {
@VisibleForTesting
List<Name> names(Iterable<String> names) {
List<Name> result = new ArrayList<>();
for (String name : names) {
result.add(name(name)); // depends on control dependency: [for], data = [name]
}
return result;
} } |
public class class_name {
public BindingFactory getBindingFactory() {
if (bindingFactory == null) {
bindingFactory = getApplicationConfig().bindingFactoryProvider().getBindingFactory(formModel);
}
return bindingFactory;
} } | public class class_name {
public BindingFactory getBindingFactory() {
if (bindingFactory == null) {
bindingFactory = getApplicationConfig().bindingFactoryProvider().getBindingFactory(formModel); // depends on control dependency: [if], data = [none]
}
return bindingFactory;
} } |
public class class_name {
protected String getLdapPrincipalIdentifier(final String username, final LdapEntry ldapEntry) throws LoginException {
if (StringUtils.isNotBlank(this.principalIdAttribute)) {
val principalAttr = ldapEntry.getAttribute(this.principalIdAttribute);
if (principalAttr == null || principalAttr.size() == 0) {
if (this.allowMissingPrincipalAttributeValue) {
LOGGER.warn("The principal id attribute [{}] is not found. CAS cannot construct the final authenticated principal "
+ "if it's unable to locate the attribute that is designated as the principal id. "
+ "Attributes available on the LDAP entry are [{}]. Since principal id attribute is not available, CAS will "
+ "fall back to construct the principal based on the provided user id: [{}]",
this.principalIdAttribute, ldapEntry.getAttributes(), username);
return username;
}
LOGGER.error("The principal id attribute [{}] is not found. CAS is configured to disallow missing principal attributes",
this.principalIdAttribute);
throw new LoginException("Principal id attribute is not found for " + principalAttr);
}
val value = principalAttr.getStringValue();
if (principalAttr.size() > 1) {
if (!this.allowMultiplePrincipalAttributeValues) {
throw new LoginException("Multiple principal values are not allowed: " + principalAttr);
}
LOGGER.warn("Found multiple values for principal id attribute: [{}]. Using first value=[{}].", principalAttr, value);
}
LOGGER.debug("Retrieved principal id attribute [{}]", value);
return value;
}
LOGGER.debug("Principal id attribute is not defined. Using the default provided user id [{}]", username);
return username;
} } | public class class_name {
protected String getLdapPrincipalIdentifier(final String username, final LdapEntry ldapEntry) throws LoginException {
if (StringUtils.isNotBlank(this.principalIdAttribute)) {
val principalAttr = ldapEntry.getAttribute(this.principalIdAttribute);
if (principalAttr == null || principalAttr.size() == 0) {
if (this.allowMissingPrincipalAttributeValue) {
LOGGER.warn("The principal id attribute [{}] is not found. CAS cannot construct the final authenticated principal "
+ "if it's unable to locate the attribute that is designated as the principal id. "
+ "Attributes available on the LDAP entry are [{}]. Since principal id attribute is not available, CAS will "
+ "fall back to construct the principal based on the provided user id: [{}]",
this.principalIdAttribute, ldapEntry.getAttributes(), username); // depends on control dependency: [if], data = [none]
return username; // depends on control dependency: [if], data = [none]
}
LOGGER.error("The principal id attribute [{}] is not found. CAS is configured to disallow missing principal attributes",
this.principalIdAttribute); // depends on control dependency: [if], data = [none]
throw new LoginException("Principal id attribute is not found for " + principalAttr);
}
val value = principalAttr.getStringValue();
if (principalAttr.size() > 1) {
if (!this.allowMultiplePrincipalAttributeValues) {
throw new LoginException("Multiple principal values are not allowed: " + principalAttr);
}
LOGGER.warn("Found multiple values for principal id attribute: [{}]. Using first value=[{}].", principalAttr, value); // depends on control dependency: [if], data = [none]
}
LOGGER.debug("Retrieved principal id attribute [{}]", value);
return value;
}
LOGGER.debug("Principal id attribute is not defined. Using the default provided user id [{}]", username);
return username;
} } |
public class class_name {
private void orthes (double[][] V, double[][] H) {
double[] ort=new double[n];
// This is derived from the Algol procedures orthes and ortran,
// by Martin and Wilkinson, Handbook for Auto. Comp.,
// Vol.ii-Linear Algebra, and the corresponding
// Fortran subroutines in EISPACK.
int low = 0;
int high = n-1;
for (int m = low+1; m <= high-1; m++) {
// Scale column.
double scale = 0.0;
for (int i = m; i <= high; i++) {
scale = scale + Math.abs(H[i][m-1]);
}
if (scale != 0.0) {
// Compute Householder transformation.
double h = 0.0;
for (int i = high; i >= m; i--) {
ort[i] = H[i][m-1]/scale;
h += ort[i] * ort[i];
}
double g = Math.sqrt(h);
if (ort[m] > 0) {
g = -g;
}
h = h - ort[m] * g;
ort[m] = ort[m] - g;
// Apply Householder similarity transformation
// H = (I-u*u'/h)*H*(I-u*u')/h)
for (int j = m; j < n; j++) {
double f = 0.0;
for (int i = high; i >= m; i--) {
f += ort[i]*H[i][j];
}
f = f/h;
for (int i = m; i <= high; i++) {
H[i][j] -= f*ort[i];
}
}
for (int i = 0; i <= high; i++) {
double f = 0.0;
for (int j = high; j >= m; j--) {
f += ort[j]*H[i][j];
}
f = f/h;
for (int j = m; j <= high; j++) {
H[i][j] -= f*ort[j];
}
}
ort[m] = scale*ort[m];
H[m][m-1] = scale*g;
}
}
// Accumulate transformations (Algol's ortran).
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
V[i][j] = (i == j ? 1.0 : 0.0);
}
}
for (int m = high-1; m >= low+1; m--) {
if (H[m][m-1] != 0.0) {
for (int i = m+1; i <= high; i++) {
ort[i] = H[i][m-1];
}
for (int j = m; j <= high; j++) {
double g = 0.0;
for (int i = m; i <= high; i++) {
g += ort[i] * V[i][j];
}
// Double division avoids possible underflow
g = (g / ort[m]) / H[m][m-1];
for (int i = m; i <= high; i++) {
V[i][j] += g * ort[i];
}
}
}
}
} } | public class class_name {
private void orthes (double[][] V, double[][] H) {
double[] ort=new double[n];
// This is derived from the Algol procedures orthes and ortran,
// by Martin and Wilkinson, Handbook for Auto. Comp.,
// Vol.ii-Linear Algebra, and the corresponding
// Fortran subroutines in EISPACK.
int low = 0;
int high = n-1;
for (int m = low+1; m <= high-1; m++) {
// Scale column.
double scale = 0.0;
for (int i = m; i <= high; i++) {
scale = scale + Math.abs(H[i][m-1]); // depends on control dependency: [for], data = [i]
}
if (scale != 0.0) {
// Compute Householder transformation.
double h = 0.0;
for (int i = high; i >= m; i--) {
ort[i] = H[i][m-1]/scale; // depends on control dependency: [for], data = [i]
h += ort[i] * ort[i]; // depends on control dependency: [for], data = [i]
}
double g = Math.sqrt(h);
if (ort[m] > 0) {
g = -g; // depends on control dependency: [if], data = [none]
}
h = h - ort[m] * g; // depends on control dependency: [if], data = [none]
ort[m] = ort[m] - g; // depends on control dependency: [if], data = [none]
// Apply Householder similarity transformation
// H = (I-u*u'/h)*H*(I-u*u')/h)
for (int j = m; j < n; j++) {
double f = 0.0;
for (int i = high; i >= m; i--) {
f += ort[i]*H[i][j]; // depends on control dependency: [for], data = [i]
}
f = f/h; // depends on control dependency: [for], data = [none]
for (int i = m; i <= high; i++) {
H[i][j] -= f*ort[i]; // depends on control dependency: [for], data = [i]
}
}
for (int i = 0; i <= high; i++) {
double f = 0.0;
for (int j = high; j >= m; j--) {
f += ort[j]*H[i][j]; // depends on control dependency: [for], data = [j]
}
f = f/h; // depends on control dependency: [for], data = [none]
for (int j = m; j <= high; j++) {
H[i][j] -= f*ort[j]; // depends on control dependency: [for], data = [j]
}
}
ort[m] = scale*ort[m]; // depends on control dependency: [if], data = [none]
H[m][m-1] = scale*g; // depends on control dependency: [if], data = [none]
}
}
// Accumulate transformations (Algol's ortran).
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
V[i][j] = (i == j ? 1.0 : 0.0); // depends on control dependency: [for], data = [j]
}
}
for (int m = high-1; m >= low+1; m--) {
if (H[m][m-1] != 0.0) {
for (int i = m+1; i <= high; i++) {
ort[i] = H[i][m-1]; // depends on control dependency: [for], data = [i]
}
for (int j = m; j <= high; j++) {
double g = 0.0;
for (int i = m; i <= high; i++) {
g += ort[i] * V[i][j]; // depends on control dependency: [for], data = [i]
}
// Double division avoids possible underflow
g = (g / ort[m]) / H[m][m-1]; // depends on control dependency: [for], data = [none]
for (int i = m; i <= high; i++) {
V[i][j] += g * ort[i]; // depends on control dependency: [for], data = [i]
}
}
}
}
} } |
public class class_name {
public void setup() {
introspector = JadeAgentIntrospector.getMyInstance(this);
// Initializes the message count
// introspector.storeBeliefValue(this, Definitions.RECEIVED_MESSAGE_COUNT, 0);
// introspector.storeBeliefValue(this, Definitions.SENDED_MESSAGE_COUNT, 0);
MockConfiguration configuration = (MockConfiguration) this
.getArguments()[0];
LogActivator.logToFile(logger, this.getName(), Level.ALL);
behaviour = configuration.getBehaviour();
// Attempts to register the agent.
registered = false;
try {
System.out.println(this.getLocalName());
AgentRegistration.registerAgent(this, configuration.getDFservice(),
this.getLocalName());
registered = true;
System.out.println("Registered");
} catch (FIPAException e) {
System.out.println("Exception while registring the BridgeMock");
logger.warning("Exception while registring the BridgeMock");
logger.warning(e.getMessage()); // Will this show anything useful?
}
// Creates the instrospector
introspector = (JadeAgentIntrospector) PlatformSelector.getAgentIntrospector("jade");
// Adds the behavior to store the messages.
addBehaviour(new MessageReceiver());
} } | public class class_name {
public void setup() {
introspector = JadeAgentIntrospector.getMyInstance(this);
// Initializes the message count
// introspector.storeBeliefValue(this, Definitions.RECEIVED_MESSAGE_COUNT, 0);
// introspector.storeBeliefValue(this, Definitions.SENDED_MESSAGE_COUNT, 0);
MockConfiguration configuration = (MockConfiguration) this
.getArguments()[0];
LogActivator.logToFile(logger, this.getName(), Level.ALL);
behaviour = configuration.getBehaviour();
// Attempts to register the agent.
registered = false;
try {
System.out.println(this.getLocalName()); // depends on control dependency: [try], data = [none]
AgentRegistration.registerAgent(this, configuration.getDFservice(),
this.getLocalName()); // depends on control dependency: [try], data = [none]
registered = true; // depends on control dependency: [try], data = [none]
System.out.println("Registered"); // depends on control dependency: [try], data = [none]
} catch (FIPAException e) {
System.out.println("Exception while registring the BridgeMock");
logger.warning("Exception while registring the BridgeMock");
logger.warning(e.getMessage()); // Will this show anything useful?
} // depends on control dependency: [catch], data = [none]
// Creates the instrospector
introspector = (JadeAgentIntrospector) PlatformSelector.getAgentIntrospector("jade");
// Adds the behavior to store the messages.
addBehaviour(new MessageReceiver());
} } |
public class class_name {
static CMARichNode resolveRichNode(Map<String, Object> rawNode) {
final String type = (String) rawNode.get("nodeType");
if (RESOLVER_MAP.containsKey(type)) {
return RESOLVER_MAP.get(type).resolve(rawNode);
} else {
return null;
}
} } | public class class_name {
static CMARichNode resolveRichNode(Map<String, Object> rawNode) {
final String type = (String) rawNode.get("nodeType");
if (RESOLVER_MAP.containsKey(type)) {
return RESOLVER_MAP.get(type).resolve(rawNode); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private Object deserializeKeyAsColumn(String fieldName, byte[] family,
String prefix, Result result) {
// Construct a map of keyAsColumn field values. From this we'll be able
// to use the entityComposer to construct the entity field value.
byte[] prefixBytes = prefix != null ? prefix.getBytes() : null;
Map<CharSequence, Object> fieldValueAsMap = new HashMap<CharSequence, Object>();
Map<byte[], byte[]> familyMap = result.getFamilyMap(family);
for (Map.Entry<byte[], byte[]> entry : familyMap.entrySet()) {
byte[] qualifier = entry.getKey();
// if the qualifier of this column has a prefix that matches the
// field prefix, then remove the prefix from the qualifier.
if (prefixBytes != null
&& qualifier.length > prefixBytes.length
&& Arrays.equals(Arrays.copyOf(qualifier, prefixBytes.length),
prefixBytes)) {
qualifier = Arrays.copyOfRange(qualifier, prefixBytes.length,
qualifier.length);
}
byte[] columnBytes = entry.getValue();
CharSequence keyAsColumnKey = deserializeKeyAsColumnKeyFromBytes(
fieldName, qualifier);
Object keyAsColumnValue = deserializeKeyAsColumnValueFromBytes(fieldName,
qualifier, columnBytes);
fieldValueAsMap.put(keyAsColumnKey, keyAsColumnValue);
}
// Now build the entity field from the fieldValueAsMap.
return entityComposer.buildKeyAsColumnField(fieldName, fieldValueAsMap);
} } | public class class_name {
private Object deserializeKeyAsColumn(String fieldName, byte[] family,
String prefix, Result result) {
// Construct a map of keyAsColumn field values. From this we'll be able
// to use the entityComposer to construct the entity field value.
byte[] prefixBytes = prefix != null ? prefix.getBytes() : null;
Map<CharSequence, Object> fieldValueAsMap = new HashMap<CharSequence, Object>();
Map<byte[], byte[]> familyMap = result.getFamilyMap(family);
for (Map.Entry<byte[], byte[]> entry : familyMap.entrySet()) {
byte[] qualifier = entry.getKey();
// if the qualifier of this column has a prefix that matches the
// field prefix, then remove the prefix from the qualifier.
if (prefixBytes != null
&& qualifier.length > prefixBytes.length
&& Arrays.equals(Arrays.copyOf(qualifier, prefixBytes.length),
prefixBytes)) {
qualifier = Arrays.copyOfRange(qualifier, prefixBytes.length,
qualifier.length); // depends on control dependency: [if], data = [none]
}
byte[] columnBytes = entry.getValue();
CharSequence keyAsColumnKey = deserializeKeyAsColumnKeyFromBytes(
fieldName, qualifier);
Object keyAsColumnValue = deserializeKeyAsColumnValueFromBytes(fieldName,
qualifier, columnBytes);
fieldValueAsMap.put(keyAsColumnKey, keyAsColumnValue); // depends on control dependency: [for], data = [none]
}
// Now build the entity field from the fieldValueAsMap.
return entityComposer.buildKeyAsColumnField(fieldName, fieldValueAsMap);
} } |
public class class_name {
@SuppressWarnings({"unchecked"})
public Map<PersistentObject, PermissionCollection> findAllUserPermissionsOfUser(User user) {
Criteria criteria = getSession().createCriteria(PersistentObject.class);
// by only setting the alias, we will only get those entities where
// there is at least one permission set...
// it is hard (or even impossible in this scenario) to create a
// restriction that filters for permissions of the given user only.
// using HQL here is no option as the PersistentObject is
// a MappedSuperclass (without table).
// another efficient way would be a SQL query, but then the SQL
// would be written in an explicit SQL dialect...
criteria.createAlias("userPermissions", "up");
criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
List<PersistentObject> entitiesWithPermissions = criteria.list();
Map<PersistentObject, PermissionCollection> userPermissions = new HashMap<PersistentObject, PermissionCollection>();
// TODO find a better way than iterating over all entities of the system
// that have at least one permission (for any user) (see comment above)
for (PersistentObject entity : entitiesWithPermissions) {
Map<User, PermissionCollection> entityUserPermissions = entity.getUserPermissions();
if (entityUserPermissions.containsKey(user)) {
userPermissions.put(entity, entityUserPermissions.get(user));
}
}
return userPermissions;
} } | public class class_name {
@SuppressWarnings({"unchecked"})
public Map<PersistentObject, PermissionCollection> findAllUserPermissionsOfUser(User user) {
Criteria criteria = getSession().createCriteria(PersistentObject.class);
// by only setting the alias, we will only get those entities where
// there is at least one permission set...
// it is hard (or even impossible in this scenario) to create a
// restriction that filters for permissions of the given user only.
// using HQL here is no option as the PersistentObject is
// a MappedSuperclass (without table).
// another efficient way would be a SQL query, but then the SQL
// would be written in an explicit SQL dialect...
criteria.createAlias("userPermissions", "up");
criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
List<PersistentObject> entitiesWithPermissions = criteria.list();
Map<PersistentObject, PermissionCollection> userPermissions = new HashMap<PersistentObject, PermissionCollection>();
// TODO find a better way than iterating over all entities of the system
// that have at least one permission (for any user) (see comment above)
for (PersistentObject entity : entitiesWithPermissions) {
Map<User, PermissionCollection> entityUserPermissions = entity.getUserPermissions();
if (entityUserPermissions.containsKey(user)) {
userPermissions.put(entity, entityUserPermissions.get(user)); // depends on control dependency: [if], data = [none]
}
}
return userPermissions;
} } |
public class class_name {
@Override
public com.ibm.websphere.security.UserRegistry getExternalUserRegistry(UserRegistry userRegistry) {
if (userRegistry instanceof ExternalUserRegistryWrapper) {
return ((ExternalUserRegistryWrapper) userRegistry).getExternalUserRegistry();
}
return new UserRegistryWrapper(userRegistry);
} } | public class class_name {
@Override
public com.ibm.websphere.security.UserRegistry getExternalUserRegistry(UserRegistry userRegistry) {
if (userRegistry instanceof ExternalUserRegistryWrapper) {
return ((ExternalUserRegistryWrapper) userRegistry).getExternalUserRegistry(); // depends on control dependency: [if], data = [none]
}
return new UserRegistryWrapper(userRegistry);
} } |
public class class_name {
private boolean findNextBucket()
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
while (ivBucketCount < ivCache.getNumBuckets())
{
ivBucketIndex = (ivBucketIndex + 1) % ivCache.getNumBuckets();
Bucket bucket = ivCache.getBucketForKey(ivBucketIndex);
ivBucketCount++;
if (bucket == null) // d739870
{
// Collect Performance data if debug is enabled.
if (isTraceOn && tc.isDebugEnabled())
{
++ivBucketSizeStats[0];
}
continue;
}
synchronized (bucket)
{
if (!bucket.isEmpty())
{
ivBucketSize = bucket.size();
// Make sure the internal copy is big enough to hold
// the new bucket, or the copy will fail.
if (ivBucket.length < ivBucketSize)
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, ivCache.getName() +
": Expanding internal bucket from " +
ivBucket.length + " to " + (ivBucketSize + 20));
ivBucket = new Element[ivBucketSize + 20];
}
bucket.toArray(ivBucket); // d133110
ivElementIndex = 0;
// Collect Performance data if debug is enabled. d119287
if (isTraceOn && tc.isDebugEnabled())
{
if (ivBucketSize > ivMaxBucketSize)
ivMaxBucketSize = ivBucketSize;
// Keep track of how many buckets are each size. d119287
if (ivBucketSize < ivBucketSizeStats.length)
++ivBucketSizeStats[ivBucketSize];
else
++ivBucketSizeStats[ivBucketSizeStats.length - 1];
// Add the number of lookups to find all elements. d119287
for (int j = 1; j <= ivBucketSize; ++j)
ivTotalLookups += j;
if (ivBucketSize > 100)
Tr.debug(tc, ivCache.getName() + ": Hash = " + ivBucketIndex +
", size = " + ivBucketSize);
}
return true;
}
else
{
// Collect Performance data if debug is enabled. d119287
if (isTraceOn && tc.isDebugEnabled())
{
++ivBucketSizeStats[0];
}
}
}
}
// When the end of the enumerator has been hit, dump out some
// performance/tuning info if trace is enabled and the enumeration
// actually enumerated through some elements.
if (isTraceOn && tc.isDebugEnabled() &&
ivElementsReturned > 0)
{
int pCapacity = (int) ((((float) ivElementsReturned) / ivBucketCount) * 100);
Tr.debug(tc, "Empty : " + ivCache.getName() + " returned = " +
ivElementsReturned + ", " + pCapacity + "% capacity" +
" (lookup avg = " + ((float) ivTotalLookups / ivElementsReturned) +
", max = " + ivMaxBucketSize + ")");
// Dump how many buckets were each size. d119287
String bucketStats = "0[" + ivBucketSizeStats[0] + "]";
for (int i = 1; i < ivBucketSizeStats.length; ++i)
{
if (ivBucketSizeStats[i] > 0)
{
bucketStats = bucketStats + ", " + i;
if (i == ivBucketSizeStats.length - 1)
bucketStats = bucketStats + "+";
bucketStats = bucketStats + "[" + ivBucketSizeStats[i] + "]";
}
}
Tr.debug(tc, "Empty : " + ivCache.getName() + " size[buckets] = " + bucketStats);
}
return false;
} } | public class class_name {
private boolean findNextBucket()
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
while (ivBucketCount < ivCache.getNumBuckets())
{
ivBucketIndex = (ivBucketIndex + 1) % ivCache.getNumBuckets(); // depends on control dependency: [while], data = [none]
Bucket bucket = ivCache.getBucketForKey(ivBucketIndex);
ivBucketCount++; // depends on control dependency: [while], data = [none]
if (bucket == null) // d739870
{
// Collect Performance data if debug is enabled.
if (isTraceOn && tc.isDebugEnabled())
{
++ivBucketSizeStats[0]; // depends on control dependency: [if], data = [none]
}
continue;
}
synchronized (bucket) // depends on control dependency: [while], data = [none]
{
if (!bucket.isEmpty())
{
ivBucketSize = bucket.size(); // depends on control dependency: [if], data = [none]
// Make sure the internal copy is big enough to hold
// the new bucket, or the copy will fail.
if (ivBucket.length < ivBucketSize)
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, ivCache.getName() +
": Expanding internal bucket from " +
ivBucket.length + " to " + (ivBucketSize + 20));
ivBucket = new Element[ivBucketSize + 20]; // depends on control dependency: [if], data = [none]
}
bucket.toArray(ivBucket); // d133110 // depends on control dependency: [if], data = [none]
ivElementIndex = 0; // depends on control dependency: [if], data = [none]
// Collect Performance data if debug is enabled. d119287
if (isTraceOn && tc.isDebugEnabled())
{
if (ivBucketSize > ivMaxBucketSize)
ivMaxBucketSize = ivBucketSize;
// Keep track of how many buckets are each size. d119287
if (ivBucketSize < ivBucketSizeStats.length)
++ivBucketSizeStats[ivBucketSize];
else
++ivBucketSizeStats[ivBucketSizeStats.length - 1];
// Add the number of lookups to find all elements. d119287
for (int j = 1; j <= ivBucketSize; ++j)
ivTotalLookups += j;
if (ivBucketSize > 100)
Tr.debug(tc, ivCache.getName() + ": Hash = " + ivBucketIndex +
", size = " + ivBucketSize);
}
return true; // depends on control dependency: [if], data = [none]
}
else
{
// Collect Performance data if debug is enabled. d119287
if (isTraceOn && tc.isDebugEnabled())
{
++ivBucketSizeStats[0]; // depends on control dependency: [if], data = [none]
}
}
}
}
// When the end of the enumerator has been hit, dump out some
// performance/tuning info if trace is enabled and the enumeration
// actually enumerated through some elements.
if (isTraceOn && tc.isDebugEnabled() &&
ivElementsReturned > 0)
{
int pCapacity = (int) ((((float) ivElementsReturned) / ivBucketCount) * 100);
Tr.debug(tc, "Empty : " + ivCache.getName() + " returned = " +
ivElementsReturned + ", " + pCapacity + "% capacity" +
" (lookup avg = " + ((float) ivTotalLookups / ivElementsReturned) +
", max = " + ivMaxBucketSize + ")");
// Dump how many buckets were each size. d119287
String bucketStats = "0[" + ivBucketSizeStats[0] + "]";
for (int i = 1; i < ivBucketSizeStats.length; ++i)
{
if (ivBucketSizeStats[i] > 0)
{
bucketStats = bucketStats + ", " + i;
if (i == ivBucketSizeStats.length - 1)
bucketStats = bucketStats + "+";
bucketStats = bucketStats + "[" + ivBucketSizeStats[i] + "]";
}
}
Tr.debug(tc, "Empty : " + ivCache.getName() + " size[buckets] = " + bucketStats);
}
return false;
} } |
public class class_name {
public EClass getBPS() {
if (bpsEClass == null) {
bpsEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(219);
}
return bpsEClass;
} } | public class class_name {
public EClass getBPS() {
if (bpsEClass == null) {
bpsEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(219); // depends on control dependency: [if], data = [none]
}
return bpsEClass;
} } |
public class class_name {
public List<E> getEditors() {
if (list == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(list.getEditors());
} } | public class class_name {
public List<E> getEditors() {
if (list == null) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableList(list.getEditors());
} } |
public class class_name {
@Override
public List<String> purgeDatastream(String pid,
String dsID,
String startDT,
String endDT,
String logMessage,
boolean force) {
LOG.debug("start: purgeDatastream, {}, {}", pid, dsID);
assertInitialized();
try {
MessageContext ctx = context.getMessageContext();
return toStringList(m_management.purgeDatastream(ReadOnlyContext
.getSoapContext(ctx), pid, dsID, DateUtility
.parseDateOrNull(startDT), DateUtility
.parseDateOrNull(endDT), logMessage));
} catch (Throwable th) {
LOG.error("Error purging datastream", th);
throw CXFUtility.getFault(th);
} finally {
LOG.debug("end: purgeDatastream, {}, {}", pid, dsID);
}
} } | public class class_name {
@Override
public List<String> purgeDatastream(String pid,
String dsID,
String startDT,
String endDT,
String logMessage,
boolean force) {
LOG.debug("start: purgeDatastream, {}, {}", pid, dsID);
assertInitialized();
try {
MessageContext ctx = context.getMessageContext();
return toStringList(m_management.purgeDatastream(ReadOnlyContext
.getSoapContext(ctx), pid, dsID, DateUtility
.parseDateOrNull(startDT), DateUtility
.parseDateOrNull(endDT), logMessage)); // depends on control dependency: [try], data = [none]
} catch (Throwable th) {
LOG.error("Error purging datastream", th);
throw CXFUtility.getFault(th);
} finally { // depends on control dependency: [catch], data = [none]
LOG.debug("end: purgeDatastream, {}, {}", pid, dsID);
}
} } |
public class class_name {
private void requestProbes(ImmutableMember suspect) {
Collection<SwimMember> members = selectRandomMembers(config.getSuspectProbes() - 1, suspect);
if (!members.isEmpty()) {
AtomicInteger counter = new AtomicInteger();
AtomicBoolean succeeded = new AtomicBoolean();
for (SwimMember member : members) {
requestProbe(member, suspect).whenCompleteAsync((success, error) -> {
int count = counter.incrementAndGet();
if (error == null && success) {
succeeded.set(true);
}
// If the count is equal to the number of probe peers and no probe has succeeded, the node is unreachable.
else if (count == members.size() && !succeeded.get()) {
failProbes(suspect);
}
}, swimScheduler);
}
} else {
failProbes(suspect);
}
} } | public class class_name {
private void requestProbes(ImmutableMember suspect) {
Collection<SwimMember> members = selectRandomMembers(config.getSuspectProbes() - 1, suspect);
if (!members.isEmpty()) {
AtomicInteger counter = new AtomicInteger();
AtomicBoolean succeeded = new AtomicBoolean();
for (SwimMember member : members) {
requestProbe(member, suspect).whenCompleteAsync((success, error) -> {
int count = counter.incrementAndGet();
if (error == null && success) {
succeeded.set(true); // depends on control dependency: [if], data = [none]
}
// If the count is equal to the number of probe peers and no probe has succeeded, the node is unreachable.
else if (count == members.size() && !succeeded.get()) {
failProbes(suspect); // depends on control dependency: [if], data = [none]
}
}, swimScheduler); // depends on control dependency: [for], data = [none]
}
} else {
failProbes(suspect); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void initModule() {
Object o;
if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) {
// this is the initial dialog call
if (CmsStringUtil.isNotEmpty(m_paramModule)) {
// edit an existing module, get it from manager
o = OpenCms.getModuleManager().getModule(m_paramModule);
} else {
// create a new module
o = null;
}
} else {
// this is not the initial call, get module from session
o = getDialogObject();
}
if (!(o instanceof CmsModule)) {
// create a new module
m_module = new CmsModule();
} else {
// reuse module stored in session
m_module = (CmsModule)((CmsModule)o).clone();
}
} } | public class class_name {
protected void initModule() {
Object o;
if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) {
// this is the initial dialog call
if (CmsStringUtil.isNotEmpty(m_paramModule)) {
// edit an existing module, get it from manager
o = OpenCms.getModuleManager().getModule(m_paramModule); // depends on control dependency: [if], data = [none]
} else {
// create a new module
o = null; // depends on control dependency: [if], data = [none]
}
} else {
// this is not the initial call, get module from session
o = getDialogObject(); // depends on control dependency: [if], data = [none]
}
if (!(o instanceof CmsModule)) {
// create a new module
m_module = new CmsModule(); // depends on control dependency: [if], data = [none]
} else {
// reuse module stored in session
m_module = (CmsModule)((CmsModule)o).clone(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private ImmutableSet<JSType> getTypesToSkipForType(JSType type) {
type = type.restrictByNotNullOrUndefined();
if (type.isUnionType()) {
ImmutableSet.Builder<JSType> types = ImmutableSet.builder();
types.add(type);
for (JSType alt : type.getUnionMembers()) {
types.addAll(getTypesToSkipForTypeNonUnion(alt));
}
return types.build();
} else if (type.isEnumElementType()) {
return getTypesToSkipForType(type.getEnumeratedTypeOfEnumElement());
}
return ImmutableSet.copyOf(getTypesToSkipForTypeNonUnion(type));
} } | public class class_name {
private ImmutableSet<JSType> getTypesToSkipForType(JSType type) {
type = type.restrictByNotNullOrUndefined();
if (type.isUnionType()) {
ImmutableSet.Builder<JSType> types = ImmutableSet.builder();
types.add(type); // depends on control dependency: [if], data = [none]
for (JSType alt : type.getUnionMembers()) {
types.addAll(getTypesToSkipForTypeNonUnion(alt)); // depends on control dependency: [for], data = [alt]
}
return types.build(); // depends on control dependency: [if], data = [none]
} else if (type.isEnumElementType()) {
return getTypesToSkipForType(type.getEnumeratedTypeOfEnumElement()); // depends on control dependency: [if], data = [none]
}
return ImmutableSet.copyOf(getTypesToSkipForTypeNonUnion(type));
} } |
public class class_name {
private Tick getIndeciesData(byte[] bin, int x){
int dec = 100;
Tick tick = new Tick();
tick.setMode(modeFull);
tick.setTradable(false);
tick.setInstrumentToken(x);
tick.setLastTradedPrice(convertToDouble(getBytes(bin, 4, 8)) / dec);
tick.setHighPrice(convertToDouble(getBytes(bin, 8, 12)) / dec);
tick.setLowPrice(convertToDouble(getBytes(bin, 12, 16)) / dec);
tick.setOpenPrice(convertToDouble(getBytes(bin, 16, 20)) / dec);
tick.setClosePrice(convertToDouble(getBytes(bin, 20, 24)) / dec);
tick.setNetPriceChangeFromClosingPrice(convertToDouble(getBytes(bin, 24, 28)) / dec);
if(bin.length > 28) {
long tickTimeStamp = convertToLong(getBytes(bin, 28, 32)) * 1000;
if(isValidDate(tickTimeStamp)) {
tick.setTickTimestamp(new Date(tickTimeStamp));
} else {
tick.setTickTimestamp(null);
}
}
return tick;
} } | public class class_name {
private Tick getIndeciesData(byte[] bin, int x){
int dec = 100;
Tick tick = new Tick();
tick.setMode(modeFull);
tick.setTradable(false);
tick.setInstrumentToken(x);
tick.setLastTradedPrice(convertToDouble(getBytes(bin, 4, 8)) / dec);
tick.setHighPrice(convertToDouble(getBytes(bin, 8, 12)) / dec);
tick.setLowPrice(convertToDouble(getBytes(bin, 12, 16)) / dec);
tick.setOpenPrice(convertToDouble(getBytes(bin, 16, 20)) / dec);
tick.setClosePrice(convertToDouble(getBytes(bin, 20, 24)) / dec);
tick.setNetPriceChangeFromClosingPrice(convertToDouble(getBytes(bin, 24, 28)) / dec);
if(bin.length > 28) {
long tickTimeStamp = convertToLong(getBytes(bin, 28, 32)) * 1000;
if(isValidDate(tickTimeStamp)) {
tick.setTickTimestamp(new Date(tickTimeStamp)); // depends on control dependency: [if], data = [none]
} else {
tick.setTickTimestamp(null); // depends on control dependency: [if], data = [none]
}
}
return tick;
} } |
public class class_name {
private void checkSystemInput()
throws IOException
{
while ( System.in.available() > 0 )
{
int input = System.in.read();
if ( input >= 0 )
{
char c = (char) input;
if ( c == '\n' )
{
synchronized ( lock )
{
finished = true;
lock.notifyAll();
}
}
}
else
{
synchronized ( lock )
{
finished = true;
lock.notifyAll();
}
}
}
} } | public class class_name {
private void checkSystemInput()
throws IOException
{
while ( System.in.available() > 0 )
{
int input = System.in.read();
if ( input >= 0 )
{
char c = (char) input;
if ( c == '\n' )
{
synchronized ( lock ) // depends on control dependency: [if], data = [none]
{
finished = true;
lock.notifyAll();
}
}
}
else
{
synchronized ( lock )
{
finished = true;
lock.notifyAll();
}
}
}
} } |
public class class_name {
public Calendar getSharedCalendar(TimeZone timeZone) {
if (timeZone == null) {
timeZone = getDefaultTz();
}
Calendar tmp = calendarWithUserTz;
tmp.setTimeZone(timeZone);
return tmp;
} } | public class class_name {
public Calendar getSharedCalendar(TimeZone timeZone) {
if (timeZone == null) {
timeZone = getDefaultTz(); // depends on control dependency: [if], data = [none]
}
Calendar tmp = calendarWithUserTz;
tmp.setTimeZone(timeZone);
return tmp;
} } |
public class class_name {
public T attachments(final List<EmailAttachment<? extends DataSource>> attachments) {
for (final EmailAttachment<?> attachment : attachments) {
attachment(attachment);
}
return _this();
} } | public class class_name {
public T attachments(final List<EmailAttachment<? extends DataSource>> attachments) {
for (final EmailAttachment<?> attachment : attachments) {
attachment(attachment); // depends on control dependency: [for], data = [attachment]
}
return _this();
} } |
public class class_name {
public static byte[] getBytes(String string) {
byte[] result = new byte[utf8Length(string)];
try { // avoid sync'd allocations
writeChars(result, string, 0, string.length());
} catch (IOException e) {
throw new RuntimeException(e);
}
return result;
} } | public class class_name {
public static byte[] getBytes(String string) {
byte[] result = new byte[utf8Length(string)];
try { // avoid sync'd allocations
writeChars(result, string, 0, string.length()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
return result;
} } |
public class class_name {
final public JSTuple Tuple(Map refs) throws ParseException {
JSTuple ans = new JSTuple(); JSType mem;
jj_consume_token(8);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 3:
case 5:
case 8:
case 10:
case 11:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
case 28:
case 29:
case 30:
case 31:
case 32:
case 33:
case 34:
case 35:
case 36:
case 37:
case 38:
case 39:
case 40:
case 41:
case 42:
case 43:
case 44:
case 45:
case 46:
case 47:
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
case 58:
case 59:
case IDENTIFIER:
mem = TypeDecl(refs);
ans.addField(mem);
label_3:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 1:
;
break;
default:
jj_la1[4] = jj_gen;
break label_3;
}
jj_consume_token(1);
mem = TypeDecl(refs);
ans.addField(mem);
}
break;
default:
jj_la1[5] = jj_gen;
;
}
jj_consume_token(9);
{if (true) return ans;}
throw new Error("Missing return statement in function");
} } | public class class_name {
final public JSTuple Tuple(Map refs) throws ParseException {
JSTuple ans = new JSTuple(); JSType mem;
jj_consume_token(8);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 3:
case 5:
case 8:
case 10:
case 11:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
case 28:
case 29:
case 30:
case 31:
case 32:
case 33:
case 34:
case 35:
case 36:
case 37:
case 38:
case 39:
case 40:
case 41:
case 42:
case 43:
case 44:
case 45:
case 46:
case 47:
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
case 58:
case 59:
case IDENTIFIER:
mem = TypeDecl(refs);
ans.addField(mem);
label_3:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 1:
;
break;
default:
jj_la1[4] = jj_gen;
break label_3;
}
jj_consume_token(1); // depends on control dependency: [while], data = [none]
mem = TypeDecl(refs); // depends on control dependency: [while], data = [none]
ans.addField(mem); // depends on control dependency: [while], data = [none]
}
break;
default:
jj_la1[5] = jj_gen;
;
}
jj_consume_token(9);
{if (true) return ans;}
throw new Error("Missing return statement in function");
} } |
public class class_name {
@Override
protected void extractAndTakeAction(String timestamp, JSONArray jsonAllRows, List<String> joinFields, RequestType requestType, ActionType action) {
Map<Object, T> newBaseAllRows = new LinkedHashMap<>();
JSONObject eachRow = null;
for (int i = 0; i < jsonAllRows.length(); i++) {
JSONObject jsonItem = jsonAllRows.getJSONObject(i);
eachRow = dataItemAt(jsonItem, requestType, action);
String actualTimestamp = timestamp;
if (timestamp == null) {
if (requestType == RequestType.SELECT) {
actualTimestamp = eachRow.optString("timestamp");
// Because the timestamp is within each row remove them once you extract it.
eachRow.remove("timestamp");
} else {
actualTimestamp = jsonItem.optString("timestamp");
}
}
Tuple2<Object, T> row = mapPkToRow(actualTimestamp, eachRow, joinFields);
Object pk = row._1();// Primary key.
T rowVal = row._2();
if (action == ActionType.FIRST_CUT) {
baseAllRows.put(pk, rowVal);
} else {
if (baseAllRows.containsKey(pk)) {// Merge with existing row.
for (Object jsonKey:eachRow.keySet()) {
if (baseFieldNames.contains(jsonKey.toString())) {
try {
Method setterMethod = rowVal.getClass().getMethod(Util.setterMethodName(jsonKey.toString()), rowVal.getClass().getDeclaredField(jsonKey.toString()).getType());
setterMethod.invoke(baseAllRows.get(pk), eachRow.get(jsonKey.toString()));
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchFieldException ex) {
Logger.getLogger(Joiner4Bean.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
if (action == ActionType.JOIN || action == ActionType.RIGHT_JOIN) {
newBaseAllRows.put(pk, baseAllRows.remove(pk));// Remove from existing map and add to new map.
}
} else {
if (action == ActionType.RIGHT_JOIN) {// Right join
newBaseAllRows.put(pk, rowVal);
}
}
}
if (i == 0) {// Fill headers (only once)
fillHeaders(eachRow, joinFields, action);
}
}
if (!newBaseAllRows.isEmpty()) {
baseAllRows = newBaseAllRows;
}
} } | public class class_name {
@Override
protected void extractAndTakeAction(String timestamp, JSONArray jsonAllRows, List<String> joinFields, RequestType requestType, ActionType action) {
Map<Object, T> newBaseAllRows = new LinkedHashMap<>();
JSONObject eachRow = null;
for (int i = 0; i < jsonAllRows.length(); i++) {
JSONObject jsonItem = jsonAllRows.getJSONObject(i);
eachRow = dataItemAt(jsonItem, requestType, action); // depends on control dependency: [for], data = [none]
String actualTimestamp = timestamp;
if (timestamp == null) {
if (requestType == RequestType.SELECT) {
actualTimestamp = eachRow.optString("timestamp"); // depends on control dependency: [if], data = [none]
// Because the timestamp is within each row remove them once you extract it.
eachRow.remove("timestamp"); // depends on control dependency: [if], data = [none]
} else {
actualTimestamp = jsonItem.optString("timestamp"); // depends on control dependency: [if], data = [none]
}
}
Tuple2<Object, T> row = mapPkToRow(actualTimestamp, eachRow, joinFields);
Object pk = row._1();// Primary key.
T rowVal = row._2();
if (action == ActionType.FIRST_CUT) {
baseAllRows.put(pk, rowVal); // depends on control dependency: [if], data = [none]
} else {
if (baseAllRows.containsKey(pk)) {// Merge with existing row.
for (Object jsonKey:eachRow.keySet()) {
if (baseFieldNames.contains(jsonKey.toString())) {
try {
Method setterMethod = rowVal.getClass().getMethod(Util.setterMethodName(jsonKey.toString()), rowVal.getClass().getDeclaredField(jsonKey.toString()).getType());
setterMethod.invoke(baseAllRows.get(pk), eachRow.get(jsonKey.toString())); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchFieldException ex) {
Logger.getLogger(Joiner4Bean.class.getName()).log(Level.SEVERE, null, ex);
} // depends on control dependency: [catch], data = [none]
}
}
if (action == ActionType.JOIN || action == ActionType.RIGHT_JOIN) {
newBaseAllRows.put(pk, baseAllRows.remove(pk));// Remove from existing map and add to new map. // depends on control dependency: [if], data = [none]
}
} else {
if (action == ActionType.RIGHT_JOIN) {// Right join
newBaseAllRows.put(pk, rowVal); // depends on control dependency: [if], data = [none]
}
}
}
if (i == 0) {// Fill headers (only once)
fillHeaders(eachRow, joinFields, action); // depends on control dependency: [if], data = [none]
}
}
if (!newBaseAllRows.isEmpty()) {
baseAllRows = newBaseAllRows; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void addEnv(final Environment.Variable var) {
if (this.env == null) {
this.env = new Environment();
this.newEnvironment = true;
if (this.processor != null) {
// Change the environment in the processor
setProcessor(this.processor);
}
}
this.env.addVariable(var);
} } | public class class_name {
public void addEnv(final Environment.Variable var) {
if (this.env == null) {
this.env = new Environment(); // depends on control dependency: [if], data = [none]
this.newEnvironment = true; // depends on control dependency: [if], data = [none]
if (this.processor != null) {
// Change the environment in the processor
setProcessor(this.processor); // depends on control dependency: [if], data = [(this.processor]
}
}
this.env.addVariable(var);
} } |
public class class_name {
@Override
public InputStream getResourceAsStream(String resourceName, boolean processingBundle) {
InputStream is = null;
try {
File resource = new File(baseDir, resourceName);
is = new FileInputStream(resource);
} catch (FileNotFoundException e) {
// Nothing to do
}
return is;
} } | public class class_name {
@Override
public InputStream getResourceAsStream(String resourceName, boolean processingBundle) {
InputStream is = null;
try {
File resource = new File(baseDir, resourceName);
is = new FileInputStream(resource); // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException e) {
// Nothing to do
} // depends on control dependency: [catch], data = [none]
return is;
} } |
public class class_name {
public FeatureCollection createCollection(JSONObject jsonObject, FeaturesSupported layer) {
FeatureCollection dto = new FeatureCollection(layer);
String type = JsonService.getStringValue(jsonObject, "type");
if ("FeatureCollection".equals(type)) {
JSONArray features = JsonService.getChildArray(jsonObject, "features");
for (int i = 0; i < features.size(); i++) {
dto.getFeatures().add(createFeature((JSONObject) features.get(i), layer));
}
} else if ("Feature".equals(type)) {
dto.getFeatures().add(createFeature(jsonObject, layer));
}
return dto;
} } | public class class_name {
public FeatureCollection createCollection(JSONObject jsonObject, FeaturesSupported layer) {
FeatureCollection dto = new FeatureCollection(layer);
String type = JsonService.getStringValue(jsonObject, "type");
if ("FeatureCollection".equals(type)) {
JSONArray features = JsonService.getChildArray(jsonObject, "features");
for (int i = 0; i < features.size(); i++) {
dto.getFeatures().add(createFeature((JSONObject) features.get(i), layer)); // depends on control dependency: [for], data = [i]
}
} else if ("Feature".equals(type)) {
dto.getFeatures().add(createFeature(jsonObject, layer)); // depends on control dependency: [if], data = [none]
}
return dto;
} } |
public class class_name {
public String doGetDemo()
{
if (!gpUtil.isServerReady())
{
LOGGER.error("Server is not correctly configured.");
addActionError(ConfluenceGreenPepper.SERVER_NOCONFIGURATION);
return SUCCESS;
}
return SUCCESS;
} } | public class class_name {
public String doGetDemo()
{
if (!gpUtil.isServerReady())
{
LOGGER.error("Server is not correctly configured."); // depends on control dependency: [if], data = [none]
addActionError(ConfluenceGreenPepper.SERVER_NOCONFIGURATION); // depends on control dependency: [if], data = [none]
return SUCCESS; // depends on control dependency: [if], data = [none]
}
return SUCCESS;
} } |
public class class_name {
public static <E> Collection<E> filterColl(Iterable<E> coll,
Predicate<E> pred,
Collection<E> newColl) {
for(E elem : coll) {
if(pred.check(elem)) {
newColl.add(elem);
}
}
return newColl;
} } | public class class_name {
public static <E> Collection<E> filterColl(Iterable<E> coll,
Predicate<E> pred,
Collection<E> newColl) {
for(E elem : coll) {
if(pred.check(elem)) {
newColl.add(elem); // depends on control dependency: [if], data = [none]
}
}
return newColl;
} } |
public class class_name {
private List<String> adjustModuleResourcePaths(
List<String> targetResources,
String sourceModuleName,
String targetModuleName,
String sourcePathPart,
String targetPathPart,
Map<String, String> iconPaths) {
List<String> newTargetResources = new ArrayList<String>();
for (String modRes : targetResources) {
String nIcon = iconPaths.get(modRes.substring(modRes.lastIndexOf('/') + 1));
if (nIcon != null) {
// the referenced resource is an resource type icon, add the new icon path
newTargetResources.add(ICON_PATH + nIcon);
} else if (modRes.contains(sourceModuleName)) {
// there is the name in it
newTargetResources.add(modRes.replaceAll(sourceModuleName, targetModuleName));
} else if (modRes.contains(sourcePathPart)) {
// there is a path in it
newTargetResources.add(modRes.replaceAll(sourcePathPart, targetPathPart));
} else {
// there is whether the path nor the name in it
newTargetResources.add(modRes);
}
}
return newTargetResources;
} } | public class class_name {
private List<String> adjustModuleResourcePaths(
List<String> targetResources,
String sourceModuleName,
String targetModuleName,
String sourcePathPart,
String targetPathPart,
Map<String, String> iconPaths) {
List<String> newTargetResources = new ArrayList<String>();
for (String modRes : targetResources) {
String nIcon = iconPaths.get(modRes.substring(modRes.lastIndexOf('/') + 1));
if (nIcon != null) {
// the referenced resource is an resource type icon, add the new icon path
newTargetResources.add(ICON_PATH + nIcon); // depends on control dependency: [if], data = [none]
} else if (modRes.contains(sourceModuleName)) {
// there is the name in it
newTargetResources.add(modRes.replaceAll(sourceModuleName, targetModuleName)); // depends on control dependency: [if], data = [none]
} else if (modRes.contains(sourcePathPart)) {
// there is a path in it
newTargetResources.add(modRes.replaceAll(sourcePathPart, targetPathPart)); // depends on control dependency: [if], data = [none]
} else {
// there is whether the path nor the name in it
newTargetResources.add(modRes); // depends on control dependency: [if], data = [none]
}
}
return newTargetResources;
} } |
public class class_name {
@Override
public BreakpointInfo findAnotherInfoFromCompare(@NonNull DownloadTask task,
@NonNull BreakpointInfo ignored) {
final SparseArray<BreakpointInfo> clonedMap;
synchronized (this) {
clonedMap = storedInfos.clone();
}
final int size = clonedMap.size();
for (int i = 0; i < size; i++) {
final BreakpointInfo info = clonedMap.valueAt(i);
if (info == ignored) continue;
if (info.isSameFrom(task)) {
return info;
}
}
return null;
} } | public class class_name {
@Override
public BreakpointInfo findAnotherInfoFromCompare(@NonNull DownloadTask task,
@NonNull BreakpointInfo ignored) {
final SparseArray<BreakpointInfo> clonedMap;
synchronized (this) {
clonedMap = storedInfos.clone();
}
final int size = clonedMap.size();
for (int i = 0; i < size; i++) {
final BreakpointInfo info = clonedMap.valueAt(i);
if (info == ignored) continue;
if (info.isSameFrom(task)) {
return info; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private void _improve (final ColumnVector b, final ColumnVector x) throws MatrixException
{
// Find the largest x element.
float largestX = 0;
for (int r = 0; r < m_nRows; ++r)
{
final float absX = Math.abs (x.m_aValues[r][0]);
if (largestX < absX)
largestX = absX;
}
// Is x already as good as possible?
if (largestX == 0)
return;
final ColumnVector residuals = new ColumnVector (m_nRows);
// Iterate to improve x.
for (int iter = 0; iter < MAX_ITER; ++iter)
{
// Compute residuals = b - Ax.
// Must use double precision!
for (int r = 0; r < m_nRows; ++r)
{
double dot = 0;
for (int c = 0; c < m_nRows; ++c)
{
final double elmt = at (r, c);
dot += elmt * x.at (c); // dbl.prec. *
}
final double value = b.at (r) - dot; // dbl.prec. -
residuals.set (r, (float) value);
}
// Solve Az = residuals for z.
final ColumnVector z = solve (residuals, false);
// Set x = x + z.
// Find largest the largest difference.
float largestDiff = 0;
for (int r = 0; r < m_nRows; ++r)
{
final float oldX = x.at (r);
x.set (r, oldX + z.at (r));
final float diff = Math.abs (x.at (r) - oldX);
if (largestDiff < diff)
largestDiff = diff;
}
// Is any further improvement possible?
if (largestDiff < largestX * TOLERANCE)
return;
}
// Failed to converge because A is nearly singular.
throw new MatrixException (MatrixException.NO_CONVERGENCE);
} } | public class class_name {
private void _improve (final ColumnVector b, final ColumnVector x) throws MatrixException
{
// Find the largest x element.
float largestX = 0;
for (int r = 0; r < m_nRows; ++r)
{
final float absX = Math.abs (x.m_aValues[r][0]);
if (largestX < absX)
largestX = absX;
}
// Is x already as good as possible?
if (largestX == 0)
return;
final ColumnVector residuals = new ColumnVector (m_nRows);
// Iterate to improve x.
for (int iter = 0; iter < MAX_ITER; ++iter)
{
// Compute residuals = b - Ax.
// Must use double precision!
for (int r = 0; r < m_nRows; ++r)
{
double dot = 0;
for (int c = 0; c < m_nRows; ++c)
{
final double elmt = at (r, c);
dot += elmt * x.at (c); // dbl.prec. * // depends on control dependency: [for], data = [c]
}
final double value = b.at (r) - dot; // dbl.prec. -
residuals.set (r, (float) value); // depends on control dependency: [for], data = [r]
}
// Solve Az = residuals for z.
final ColumnVector z = solve (residuals, false);
// Set x = x + z.
// Find largest the largest difference.
float largestDiff = 0;
for (int r = 0; r < m_nRows; ++r)
{
final float oldX = x.at (r);
x.set (r, oldX + z.at (r)); // depends on control dependency: [for], data = [r]
final float diff = Math.abs (x.at (r) - oldX);
if (largestDiff < diff)
largestDiff = diff;
}
// Is any further improvement possible?
if (largestDiff < largestX * TOLERANCE)
return;
}
// Failed to converge because A is nearly singular.
throw new MatrixException (MatrixException.NO_CONVERGENCE);
} } |
public class class_name {
@Override
public void onNewRestClient(MicroProfileClientProxyImpl clientProxy) {
// install outbound Client Config handler
LibertyJaxRsClientConfigInterceptor configInterceptor = new LibertyJaxRsClientConfigInterceptor(Phase.PRE_LOGICAL);
ClientConfiguration ccfg = WebClient.getConfig(clientProxy);
ccfg.getOutInterceptors().add(configInterceptor);
if (canLoadFTTimeoutClass()) {
LibertyFTTimeoutInterceptor timeoutInterceptor = new LibertyFTTimeoutInterceptor(Phase.PRE_LOGICAL);
ccfg.getOutInterceptors().add(timeoutInterceptor);
}
} } | public class class_name {
@Override
public void onNewRestClient(MicroProfileClientProxyImpl clientProxy) {
// install outbound Client Config handler
LibertyJaxRsClientConfigInterceptor configInterceptor = new LibertyJaxRsClientConfigInterceptor(Phase.PRE_LOGICAL);
ClientConfiguration ccfg = WebClient.getConfig(clientProxy);
ccfg.getOutInterceptors().add(configInterceptor);
if (canLoadFTTimeoutClass()) {
LibertyFTTimeoutInterceptor timeoutInterceptor = new LibertyFTTimeoutInterceptor(Phase.PRE_LOGICAL);
ccfg.getOutInterceptors().add(timeoutInterceptor); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public SequencePoint2Transform2_F32 copy() {
Point2Transform2_F32[] s = new Point2Transform2_F32[ sequence.length ];
for (int i = 0; i < sequence.length; i++) {
s[i] = sequence[i].copy();
}
return new SequencePoint2Transform2_F32(s);
} } | public class class_name {
@Override
public SequencePoint2Transform2_F32 copy() {
Point2Transform2_F32[] s = new Point2Transform2_F32[ sequence.length ];
for (int i = 0; i < sequence.length; i++) {
s[i] = sequence[i].copy(); // depends on control dependency: [for], data = [i]
}
return new SequencePoint2Transform2_F32(s);
} } |
public class class_name {
public void serviceUninstall(ServiceComponent serviceComponent) {
// remove sbb object pools
for (SbbID sbbID : serviceComponent.getSbbIDs(sleeContainer.getComponentRepository())) {
// remove the pool for the given SbbID
sbbPoolManagement.removeObjectPool(serviceComponent.getServiceID(), sleeContainer.getComponentRepository().getComponentByID(sbbID),
sleeContainer.getTransactionManager());
}
} } | public class class_name {
public void serviceUninstall(ServiceComponent serviceComponent) {
// remove sbb object pools
for (SbbID sbbID : serviceComponent.getSbbIDs(sleeContainer.getComponentRepository())) {
// remove the pool for the given SbbID
sbbPoolManagement.removeObjectPool(serviceComponent.getServiceID(), sleeContainer.getComponentRepository().getComponentByID(sbbID),
sleeContainer.getTransactionManager()); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public PropertyInjectionPoint[] resolve(Class type, final boolean autowire) {
final List<PropertyInjectionPoint> list = new ArrayList<>();
final Set<String> usedPropertyNames = new HashSet<>();
// lookup fields
while (type != Object.class) {
final ClassDescriptor cd = ClassIntrospector.get().lookup(type);
final PropertyDescriptor[] allPropertyDescriptors = cd.getAllPropertyDescriptors();
for (PropertyDescriptor propertyDescriptor : allPropertyDescriptors) {
if (propertyDescriptor.isGetterOnly()) {
continue;
}
if (usedPropertyNames.contains(propertyDescriptor.getName())) {
continue;
}
Class propertyType = propertyDescriptor.getType();
if (ClassUtil.isTypeOf(propertyType, Collection.class)) {
continue;
}
BeanReferences reference = referencesResolver.readReferenceFromAnnotation(propertyDescriptor);
if (reference == null) {
if (!autowire) {
continue;
} else {
reference = referencesResolver.buildDefaultReference(propertyDescriptor);
}
}
list.add(new PropertyInjectionPoint(propertyDescriptor, reference));
usedPropertyNames.add(propertyDescriptor.getName());
}
// go to the supertype
type = type.getSuperclass();
}
final PropertyInjectionPoint[] fields;
if (list.isEmpty()) {
fields = PropertyInjectionPoint.EMPTY;
} else {
fields = list.toArray(new PropertyInjectionPoint[0]);
}
return fields;
} } | public class class_name {
public PropertyInjectionPoint[] resolve(Class type, final boolean autowire) {
final List<PropertyInjectionPoint> list = new ArrayList<>();
final Set<String> usedPropertyNames = new HashSet<>();
// lookup fields
while (type != Object.class) {
final ClassDescriptor cd = ClassIntrospector.get().lookup(type);
final PropertyDescriptor[] allPropertyDescriptors = cd.getAllPropertyDescriptors();
for (PropertyDescriptor propertyDescriptor : allPropertyDescriptors) {
if (propertyDescriptor.isGetterOnly()) {
continue;
}
if (usedPropertyNames.contains(propertyDescriptor.getName())) {
continue;
}
Class propertyType = propertyDescriptor.getType();
if (ClassUtil.isTypeOf(propertyType, Collection.class)) {
continue;
}
BeanReferences reference = referencesResolver.readReferenceFromAnnotation(propertyDescriptor);
if (reference == null) {
if (!autowire) {
continue;
} else {
reference = referencesResolver.buildDefaultReference(propertyDescriptor); // depends on control dependency: [if], data = [none]
}
}
list.add(new PropertyInjectionPoint(propertyDescriptor, reference)); // depends on control dependency: [for], data = [propertyDescriptor]
usedPropertyNames.add(propertyDescriptor.getName()); // depends on control dependency: [for], data = [propertyDescriptor]
}
// go to the supertype
type = type.getSuperclass(); // depends on control dependency: [while], data = [none]
}
final PropertyInjectionPoint[] fields;
if (list.isEmpty()) {
fields = PropertyInjectionPoint.EMPTY; // depends on control dependency: [if], data = [none]
} else {
fields = list.toArray(new PropertyInjectionPoint[0]); // depends on control dependency: [if], data = [none]
}
return fields;
} } |
public class class_name {
public static Object tryClone(Object toBeCloned) {
if (toBeCloned == null) {
return null;
}
Object clonedObj = null;
if (toBeCloned instanceof Cloneable) {
try {
Method method = Object.class.getDeclaredMethod("clone");
method.setAccessible(true);
clonedObj = method.invoke(toBeCloned);
} catch (Exception e) {
if (e instanceof CloneNotSupportedException) {
clonedObj = toBeCloned;
} else {
throw e instanceof RuntimeException ? (RuntimeException) e
: new RuntimeException(e);
}
}
} else {
clonedObj = toBeCloned;
}
return clonedObj;
} } | public class class_name {
public static Object tryClone(Object toBeCloned) {
if (toBeCloned == null) {
return null; // depends on control dependency: [if], data = [none]
}
Object clonedObj = null;
if (toBeCloned instanceof Cloneable) {
try {
Method method = Object.class.getDeclaredMethod("clone");
method.setAccessible(true); // depends on control dependency: [try], data = [none]
clonedObj = method.invoke(toBeCloned); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (e instanceof CloneNotSupportedException) {
clonedObj = toBeCloned; // depends on control dependency: [if], data = [none]
} else {
throw e instanceof RuntimeException ? (RuntimeException) e
: new RuntimeException(e);
}
} // depends on control dependency: [catch], data = [none]
} else {
clonedObj = toBeCloned; // depends on control dependency: [if], data = [none]
}
return clonedObj;
} } |
public class class_name {
private static boolean isScript(String base, ZipFile zip) {
Enumeration<? extends ZipEntry> files = zip.entries();
while (files.hasMoreElements()) {
ZipEntry f = files.nextElement();
if ((f.getName()).equals(base + ".bat") || (f.getName()).contains("/" + base + ".bat")) {
return true;
}
}
return false;
} } | public class class_name {
private static boolean isScript(String base, ZipFile zip) {
Enumeration<? extends ZipEntry> files = zip.entries();
while (files.hasMoreElements()) {
ZipEntry f = files.nextElement();
if ((f.getName()).equals(base + ".bat") || (f.getName()).contains("/" + base + ".bat")) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
Properties getJavadoc() {
if(javadoc!=null) return javadoc;
synchronized(this) {
if(javadoc!=null) return javadoc;
// load
Properties p = new Properties();
InputStream is = type.getClassLoader().getResourceAsStream(type.getName().replace('$', '/').replace('.', '/') + ".javadoc");
if(is!=null) {
try {
try {
p.load(is);
} finally {
is.close();
}
} catch (IOException e) {
throw new RuntimeException("Unable to load javadoc for "+type,e);
}
}
javadoc = p;
return javadoc;
}
} } | public class class_name {
Properties getJavadoc() {
if(javadoc!=null) return javadoc;
synchronized(this) {
if(javadoc!=null) return javadoc;
// load
Properties p = new Properties();
InputStream is = type.getClassLoader().getResourceAsStream(type.getName().replace('$', '/').replace('.', '/') + ".javadoc");
if(is!=null) {
try {
try {
p.load(is); // depends on control dependency: [try], data = [none]
} finally {
is.close();
}
} catch (IOException e) {
throw new RuntimeException("Unable to load javadoc for "+type,e);
} // depends on control dependency: [catch], data = [none]
}
javadoc = p;
return javadoc;
}
} } |
public class class_name {
public ServiceCall<TrainingExample> createTrainingExample(CreateTrainingExampleOptions createTrainingExampleOptions) {
Validator.notNull(createTrainingExampleOptions, "createTrainingExampleOptions cannot be null");
String[] pathSegments = { "v1/environments", "collections", "training_data", "examples" };
String[] pathParameters = { createTrainingExampleOptions.environmentId(), createTrainingExampleOptions
.collectionId(), createTrainingExampleOptions.queryId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createTrainingExample");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (createTrainingExampleOptions.documentId() != null) {
contentJson.addProperty("document_id", createTrainingExampleOptions.documentId());
}
if (createTrainingExampleOptions.crossReference() != null) {
contentJson.addProperty("cross_reference", createTrainingExampleOptions.crossReference());
}
if (createTrainingExampleOptions.relevance() != null) {
contentJson.addProperty("relevance", createTrainingExampleOptions.relevance());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(TrainingExample.class));
} } | public class class_name {
public ServiceCall<TrainingExample> createTrainingExample(CreateTrainingExampleOptions createTrainingExampleOptions) {
Validator.notNull(createTrainingExampleOptions, "createTrainingExampleOptions cannot be null");
String[] pathSegments = { "v1/environments", "collections", "training_data", "examples" };
String[] pathParameters = { createTrainingExampleOptions.environmentId(), createTrainingExampleOptions
.collectionId(), createTrainingExampleOptions.queryId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createTrainingExample");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
if (createTrainingExampleOptions.documentId() != null) {
contentJson.addProperty("document_id", createTrainingExampleOptions.documentId()); // depends on control dependency: [if], data = [none]
}
if (createTrainingExampleOptions.crossReference() != null) {
contentJson.addProperty("cross_reference", createTrainingExampleOptions.crossReference()); // depends on control dependency: [if], data = [none]
}
if (createTrainingExampleOptions.relevance() != null) {
contentJson.addProperty("relevance", createTrainingExampleOptions.relevance()); // depends on control dependency: [if], data = [none]
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(TrainingExample.class));
} } |
public class class_name {
protected int addConfirmPopupMessage (SmartTable contents, int row)
{
if (_confirmHTML) {
contents.setHTML(row, 0, _confirmMessage, 2, "Message");
} else {
contents.setText(row, 0, _confirmMessage, 2, "Message");
}
return row + 1;
} } | public class class_name {
protected int addConfirmPopupMessage (SmartTable contents, int row)
{
if (_confirmHTML) {
contents.setHTML(row, 0, _confirmMessage, 2, "Message"); // depends on control dependency: [if], data = [none]
} else {
contents.setText(row, 0, _confirmMessage, 2, "Message"); // depends on control dependency: [if], data = [none]
}
return row + 1;
} } |
public class class_name {
public int set(int pos) {
while (pos >= capacity) {
doubleCapacity();
}
if (pos >= limitPos) {
limitPos = pos + 1;
}
int windex = pos >> 5;
int mask = 0x80000000 >>> (pos & 0x1F);
int word = map[windex];
int result = (word & mask) == 0 ? 0
: 1;
map[windex] = (word | mask);
return result;
} } | public class class_name {
public int set(int pos) {
while (pos >= capacity) {
doubleCapacity(); // depends on control dependency: [while], data = [none]
}
if (pos >= limitPos) {
limitPos = pos + 1; // depends on control dependency: [if], data = [none]
}
int windex = pos >> 5;
int mask = 0x80000000 >>> (pos & 0x1F);
int word = map[windex];
int result = (word & mask) == 0 ? 0
: 1;
map[windex] = (word | mask);
return result;
} } |
public class class_name {
private List loadRecentList() {
try {
InputStream in = new BufferedInputStream(new FileInputStream(
RECENT_FILE_NAME));
XMLDecoder d = new XMLDecoder(in);
Object result = d.readObject();
d.close();
return (List) result;
} catch (FileNotFoundException ex) {
// This is ok, it's probably the first time the picker has been used.
return new ArrayList();
}
} } | public class class_name {
private List loadRecentList() {
try {
InputStream in = new BufferedInputStream(new FileInputStream(
RECENT_FILE_NAME));
XMLDecoder d = new XMLDecoder(in);
Object result = d.readObject();
d.close(); // depends on control dependency: [try], data = [none]
return (List) result; // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException ex) {
// This is ok, it's probably the first time the picker has been used.
return new ArrayList();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public EEnum getIfcEnvironmentalImpactCategoryEnum() {
if (ifcEnvironmentalImpactCategoryEnumEEnum == null) {
ifcEnvironmentalImpactCategoryEnumEEnum = (EEnum) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(833);
}
return ifcEnvironmentalImpactCategoryEnumEEnum;
} } | public class class_name {
public EEnum getIfcEnvironmentalImpactCategoryEnum() {
if (ifcEnvironmentalImpactCategoryEnumEEnum == null) {
ifcEnvironmentalImpactCategoryEnumEEnum = (EEnum) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(833);
// depends on control dependency: [if], data = [none]
}
return ifcEnvironmentalImpactCategoryEnumEEnum;
} } |
public class class_name {
public final void removeChildRouter(@NonNull Router childRouter) {
if ((childRouter instanceof ControllerHostedRouter) && childRouters.remove(childRouter)) {
childRouter.destroy(true);
}
} } | public class class_name {
public final void removeChildRouter(@NonNull Router childRouter) {
if ((childRouter instanceof ControllerHostedRouter) && childRouters.remove(childRouter)) {
childRouter.destroy(true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean mapContainsKeys(Map<?, ?> _map, Object... _keys) {
if (_map == null) {
return false;
} else if (_keys == null) {
return true;
}
for (Object key : _keys) {
if (key != null && !_map.containsKey(key)) {
return false;
}
}
return true;
} } | public class class_name {
public static boolean mapContainsKeys(Map<?, ?> _map, Object... _keys) {
if (_map == null) {
return false; // depends on control dependency: [if], data = [none]
} else if (_keys == null) {
return true; // depends on control dependency: [if], data = [none]
}
for (Object key : _keys) {
if (key != null && !_map.containsKey(key)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public static double[] Abs(ComplexNumber[] z) {
double[] values = new double[z.length];
for (int i = 0; i < values.length; i++) {
values[i] = z[i].getMagnitude();
}
return values;
} } | public class class_name {
public static double[] Abs(ComplexNumber[] z) {
double[] values = new double[z.length];
for (int i = 0; i < values.length; i++) {
values[i] = z[i].getMagnitude();
// depends on control dependency: [for], data = [i]
}
return values;
} } |
public class class_name {
static List<String> getExecutableNames() {
List<String> executableNames = new ArrayList<>();
if (Platform.getCurrent().is(Platform.WINDOWS)) {
Collections.addAll(executableNames, ProcessNames.PHANTOMJS.getWindowsImageName(),
ProcessNames.CHROMEDRIVER.getWindowsImageName(), ProcessNames.IEDRIVER.getWindowsImageName(),
ProcessNames.EDGEDRIVER.getWindowsImageName(), ProcessNames.GECKODRIVER.getWindowsImageName());
} else {
Collections.addAll(executableNames, ProcessNames.PHANTOMJS.getUnixImageName(),
ProcessNames.CHROMEDRIVER.getUnixImageName(), ProcessNames.GECKODRIVER.getUnixImageName());
}
return executableNames;
} } | public class class_name {
static List<String> getExecutableNames() {
List<String> executableNames = new ArrayList<>();
if (Platform.getCurrent().is(Platform.WINDOWS)) {
Collections.addAll(executableNames, ProcessNames.PHANTOMJS.getWindowsImageName(),
ProcessNames.CHROMEDRIVER.getWindowsImageName(), ProcessNames.IEDRIVER.getWindowsImageName(),
ProcessNames.EDGEDRIVER.getWindowsImageName(), ProcessNames.GECKODRIVER.getWindowsImageName()); // depends on control dependency: [if], data = [none]
} else {
Collections.addAll(executableNames, ProcessNames.PHANTOMJS.getUnixImageName(),
ProcessNames.CHROMEDRIVER.getUnixImageName(), ProcessNames.GECKODRIVER.getUnixImageName()); // depends on control dependency: [if], data = [none]
}
return executableNames;
} } |
public class class_name {
public static String escapeHiveType(String type) {
TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromTypeString(type);
// Primitve
if (ObjectInspector.Category.PRIMITIVE.equals(typeInfo.getCategory())) {
return type;
}
// List
else if (ObjectInspector.Category.LIST.equals(typeInfo.getCategory())) {
ListTypeInfo listTypeInfo = (ListTypeInfo) typeInfo;
return org.apache.hadoop.hive.serde.serdeConstants.LIST_TYPE_NAME + "<"
+ escapeHiveType(listTypeInfo.getListElementTypeInfo().getTypeName()) + ">";
}
// Map
else if (ObjectInspector.Category.MAP.equals(typeInfo.getCategory())) {
MapTypeInfo mapTypeInfo = (MapTypeInfo) typeInfo;
return org.apache.hadoop.hive.serde.serdeConstants.MAP_TYPE_NAME + "<"
+ escapeHiveType(mapTypeInfo.getMapKeyTypeInfo().getTypeName()) + ","
+ escapeHiveType(mapTypeInfo.getMapValueTypeInfo().getTypeName()) + ">";
}
// Struct
else if (ObjectInspector.Category.STRUCT.equals(typeInfo.getCategory())) {
StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
List<String> allStructFieldNames = structTypeInfo.getAllStructFieldNames();
List<TypeInfo> allStructFieldTypeInfos = structTypeInfo.getAllStructFieldTypeInfos();
StringBuilder sb = new StringBuilder();
sb.append(serdeConstants.STRUCT_TYPE_NAME + "<");
for (int i = 0; i < allStructFieldNames.size(); i++) {
if (i > 0) {
sb.append(",");
}
sb.append("`");
sb.append(allStructFieldNames.get(i));
sb.append("`");
sb.append(":");
sb.append(escapeHiveType(allStructFieldTypeInfos.get(i).getTypeName()));
}
sb.append(">");
return sb.toString();
}
// Union
else if (ObjectInspector.Category.UNION.equals(typeInfo.getCategory())) {
UnionTypeInfo unionTypeInfo = (UnionTypeInfo) typeInfo;
List<TypeInfo> allUnionObjectTypeInfos = unionTypeInfo.getAllUnionObjectTypeInfos();
StringBuilder sb = new StringBuilder();
sb.append(serdeConstants.UNION_TYPE_NAME + "<");
for (int i = 0; i < allUnionObjectTypeInfos.size(); i++) {
if (i > 0) {
sb.append(",");
}
sb.append(escapeHiveType(allUnionObjectTypeInfos.get(i).getTypeName()));
}
sb.append(">");
return sb.toString();
} else {
throw new RuntimeException("Unknown type encountered: " + type);
}
} } | public class class_name {
public static String escapeHiveType(String type) {
TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromTypeString(type);
// Primitve
if (ObjectInspector.Category.PRIMITIVE.equals(typeInfo.getCategory())) {
return type; // depends on control dependency: [if], data = [none]
}
// List
else if (ObjectInspector.Category.LIST.equals(typeInfo.getCategory())) {
ListTypeInfo listTypeInfo = (ListTypeInfo) typeInfo;
return org.apache.hadoop.hive.serde.serdeConstants.LIST_TYPE_NAME + "<"
+ escapeHiveType(listTypeInfo.getListElementTypeInfo().getTypeName()) + ">"; // depends on control dependency: [if], data = [none]
}
// Map
else if (ObjectInspector.Category.MAP.equals(typeInfo.getCategory())) {
MapTypeInfo mapTypeInfo = (MapTypeInfo) typeInfo;
return org.apache.hadoop.hive.serde.serdeConstants.MAP_TYPE_NAME + "<"
+ escapeHiveType(mapTypeInfo.getMapKeyTypeInfo().getTypeName()) + ","
+ escapeHiveType(mapTypeInfo.getMapValueTypeInfo().getTypeName()) + ">"; // depends on control dependency: [if], data = [none]
}
// Struct
else if (ObjectInspector.Category.STRUCT.equals(typeInfo.getCategory())) {
StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
List<String> allStructFieldNames = structTypeInfo.getAllStructFieldNames();
List<TypeInfo> allStructFieldTypeInfos = structTypeInfo.getAllStructFieldTypeInfos();
StringBuilder sb = new StringBuilder();
sb.append(serdeConstants.STRUCT_TYPE_NAME + "<"); // depends on control dependency: [if], data = [none]
for (int i = 0; i < allStructFieldNames.size(); i++) {
if (i > 0) {
sb.append(","); // depends on control dependency: [if], data = [none]
}
sb.append("`"); // depends on control dependency: [for], data = [none]
sb.append(allStructFieldNames.get(i)); // depends on control dependency: [for], data = [i]
sb.append("`"); // depends on control dependency: [for], data = [none]
sb.append(":"); // depends on control dependency: [for], data = [none]
sb.append(escapeHiveType(allStructFieldTypeInfos.get(i).getTypeName())); // depends on control dependency: [for], data = [i]
}
sb.append(">"); // depends on control dependency: [if], data = [none]
return sb.toString(); // depends on control dependency: [if], data = [none]
}
// Union
else if (ObjectInspector.Category.UNION.equals(typeInfo.getCategory())) {
UnionTypeInfo unionTypeInfo = (UnionTypeInfo) typeInfo;
List<TypeInfo> allUnionObjectTypeInfos = unionTypeInfo.getAllUnionObjectTypeInfos();
StringBuilder sb = new StringBuilder();
sb.append(serdeConstants.UNION_TYPE_NAME + "<"); // depends on control dependency: [if], data = [none]
for (int i = 0; i < allUnionObjectTypeInfos.size(); i++) {
if (i > 0) {
sb.append(","); // depends on control dependency: [if], data = [none]
}
sb.append(escapeHiveType(allUnionObjectTypeInfos.get(i).getTypeName())); // depends on control dependency: [for], data = [i]
}
sb.append(">"); // depends on control dependency: [if], data = [none]
return sb.toString(); // depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException("Unknown type encountered: " + type);
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.