code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public Tree<T> findPreOrderNext(){
if( hasChildren() ){
return getFirstChild();
}
if( hasNext() ){
return getNext();
}
Tree<T> parent = getParent();
while( parent != null ){
if( parent.hasNext() ){
return parent.getNext();
}
parent = parent.getParent();
}
return null;
} } | public class class_name {
public Tree<T> findPreOrderNext(){
if( hasChildren() ){
return getFirstChild(); // depends on control dependency: [if], data = [none]
}
if( hasNext() ){
return getNext(); // depends on control dependency: [if], data = [none]
}
Tree<T> parent = getParent();
while( parent != null ){
if( parent.hasNext() ){
return parent.getNext(); // depends on control dependency: [if], data = [none]
}
parent = parent.getParent(); // depends on control dependency: [while], data = [none]
}
return null;
} } |
public class class_name {
public HyperParameterTuningJobWarmStartConfig withParentHyperParameterTuningJobs(ParentHyperParameterTuningJob... parentHyperParameterTuningJobs) {
if (this.parentHyperParameterTuningJobs == null) {
setParentHyperParameterTuningJobs(new java.util.ArrayList<ParentHyperParameterTuningJob>(parentHyperParameterTuningJobs.length));
}
for (ParentHyperParameterTuningJob ele : parentHyperParameterTuningJobs) {
this.parentHyperParameterTuningJobs.add(ele);
}
return this;
} } | public class class_name {
public HyperParameterTuningJobWarmStartConfig withParentHyperParameterTuningJobs(ParentHyperParameterTuningJob... parentHyperParameterTuningJobs) {
if (this.parentHyperParameterTuningJobs == null) {
setParentHyperParameterTuningJobs(new java.util.ArrayList<ParentHyperParameterTuningJob>(parentHyperParameterTuningJobs.length)); // depends on control dependency: [if], data = [none]
}
for (ParentHyperParameterTuningJob ele : parentHyperParameterTuningJobs) {
this.parentHyperParameterTuningJobs.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private AMethodWithItsArgs findBestMethodByParamsNode(Set<Method> methods, JsonNode paramsNode) {
if (hasNoParameters(paramsNode)) {
return findBestMethodUsingParamIndexes(methods, 0, null);
}
AMethodWithItsArgs matchedMethod;
if (paramsNode.isArray()) {
matchedMethod = findBestMethodUsingParamIndexes(methods, paramsNode.size(), ArrayNode.class.cast(paramsNode));
} else if (paramsNode.isObject()) {
matchedMethod = findBestMethodUsingParamNames(methods, collectFieldNames(paramsNode), ObjectNode.class.cast(paramsNode));
} else {
throw new IllegalArgumentException("Unknown params node type: " + paramsNode.toString());
}
if (matchedMethod == null) {
matchedMethod = findBestMethodForVarargs(methods, paramsNode);
}
return matchedMethod;
} } | public class class_name {
private AMethodWithItsArgs findBestMethodByParamsNode(Set<Method> methods, JsonNode paramsNode) {
if (hasNoParameters(paramsNode)) {
return findBestMethodUsingParamIndexes(methods, 0, null); // depends on control dependency: [if], data = [none]
}
AMethodWithItsArgs matchedMethod;
if (paramsNode.isArray()) {
matchedMethod = findBestMethodUsingParamIndexes(methods, paramsNode.size(), ArrayNode.class.cast(paramsNode)); // depends on control dependency: [if], data = [none]
} else if (paramsNode.isObject()) {
matchedMethod = findBestMethodUsingParamNames(methods, collectFieldNames(paramsNode), ObjectNode.class.cast(paramsNode)); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown params node type: " + paramsNode.toString());
}
if (matchedMethod == null) {
matchedMethod = findBestMethodForVarargs(methods, paramsNode); // depends on control dependency: [if], data = [none]
}
return matchedMethod;
} } |
public class class_name {
public static String deidentify(String text, int left, int right, int fromLeft, int fromRight) {
if (left == 0 && right == 0 && fromLeft == 0 && fromRight == 0) {
return StringUtils.repeat('*', text.length());
} else if (left > 0 && right == 0 && fromLeft == 0 && fromRight == 0) {
return deidentifyLeft(text, left);
} else if (left == 0 && right > 0 && fromLeft == 0 && fromRight == 0) {
return deidentifyRight(text, right);
}else if (left > 0 && right > 0 && fromLeft == 0 && fromRight == 0) {
return deidentifyEdge(text, left, right);
}else if (left == 0 && right == 0 && fromLeft > 0 && fromRight == 0) {
return deidentifyFromLeft(text, fromLeft);
}else if (left == 0 && right == 0 && fromLeft == 0 && fromRight > 0) {
return deidentifyFromRight(text, fromRight);
}else if (left == 0 && right == 0 && fromLeft > 0 && fromRight > 0) {
return deidentifyMiddle(text, fromLeft, fromRight);
}
return text;
} } | public class class_name {
public static String deidentify(String text, int left, int right, int fromLeft, int fromRight) {
if (left == 0 && right == 0 && fromLeft == 0 && fromRight == 0) {
return StringUtils.repeat('*', text.length()); // depends on control dependency: [if], data = [none]
} else if (left > 0 && right == 0 && fromLeft == 0 && fromRight == 0) {
return deidentifyLeft(text, left); // depends on control dependency: [if], data = [none]
} else if (left == 0 && right > 0 && fromLeft == 0 && fromRight == 0) {
return deidentifyRight(text, right); // depends on control dependency: [if], data = [none]
}else if (left > 0 && right > 0 && fromLeft == 0 && fromRight == 0) {
return deidentifyEdge(text, left, right); // depends on control dependency: [if], data = [none]
}else if (left == 0 && right == 0 && fromLeft > 0 && fromRight == 0) {
return deidentifyFromLeft(text, fromLeft); // depends on control dependency: [if], data = [none]
}else if (left == 0 && right == 0 && fromLeft == 0 && fromRight > 0) {
return deidentifyFromRight(text, fromRight); // depends on control dependency: [if], data = [none]
}else if (left == 0 && right == 0 && fromLeft > 0 && fromRight > 0) {
return deidentifyMiddle(text, fromLeft, fromRight); // depends on control dependency: [if], data = [none]
}
return text;
} } |
public class class_name {
public void logDebug(@Nullable final String text) {
if (text != null && this.preprocessorLogger != null) {
this.preprocessorLogger.debug(text);
}
} } | public class class_name {
public void logDebug(@Nullable final String text) {
if (text != null && this.preprocessorLogger != null) {
this.preprocessorLogger.debug(text); // depends on control dependency: [if], data = [(text]
}
} } |
public class class_name {
public void marshall(AudioPidSelection audioPidSelection, ProtocolMarshaller protocolMarshaller) {
if (audioPidSelection == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(audioPidSelection.getPid(), PID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AudioPidSelection audioPidSelection, ProtocolMarshaller protocolMarshaller) {
if (audioPidSelection == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(audioPidSelection.getPid(), PID_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 processBeanPoolLimits(BeanMetaData bmd) throws EJBConfigurationException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "processBeanPoolLimits");
}
boolean checkAppConfigCustom = bmd.isCheckConfig(); // F743-33178
//------------------------------------------------------------------------
// The following default values are documented in the info center
// changing them may affect existing customer applicatioins.
//
// Arguments can be made about the following values. No great
// science was used in determining these numbers.
//------------------------------------------------------------------------
int defaultMinPoolSize = 50;
int defaultMaxPoolSize = 500;
long defaultMaxCreationTimeout = 300000; // 5 minutes
String minStr = null;
String maxStr = null;
String timeoutStr = null;
String poolSizeSpec = null;
boolean noEJBPool = false; // d262413 PK20648
//------------------------------------------------------------------------
// Determine if the noEJBPool or poolSize java system properties have
// been specified. noEJBPool overrides everything, so the poolSize
// property is not needed when noEJBPool is enabled. d262413 PK20648
// Property access & default now handled by ContainerProperties. 391302
//------------------------------------------------------------------------
if (NoEJBPool)
noEJBPool = true;
else
poolSizeSpec = PoolSize; // 121700
if (poolSizeSpec != null) {
StringTokenizer st = new StringTokenizer(poolSizeSpec, ":");
while (st.hasMoreTokens()) {
String token = st.nextToken();
int assignmentPivot = token.indexOf('=');
if (assignmentPivot > 0) {
String lh = token.substring(0, assignmentPivot).trim();
// Now Z/OS does not allow "#" in java properties so we also
// must allow "%". If those are used we will switch them to "#" before
// proceeding. //d434795
lh = lh.replaceAll("%", "#");
if (lh.equals(bmd.j2eeName.toString())) { // d130438
String rh = token.substring(assignmentPivot + 1).trim();
StringTokenizer sizeTokens = new StringTokenizer(rh, ",");
if (sizeTokens.hasMoreTokens()) {
// min parm was specified
minStr = sizeTokens.nextToken().trim();
}
if (sizeTokens.hasMoreTokens()) {
// max parm was specified
maxStr = sizeTokens.nextToken().trim();
}
if (sizeTokens.hasMoreTokens()) {
// timeout parm was specified
timeoutStr = sizeTokens.nextToken().trim();
}
} else if (lh.equals("*") && (minStr == null || maxStr == null || timeoutStr == null)) {
String rh = token.substring(assignmentPivot + 1).trim();
StringTokenizer sizeTokens = new StringTokenizer(rh, ",");
if (sizeTokens.hasMoreTokens()) {
// min parm was specified
String defaultMinStr = sizeTokens.nextToken();
if (minStr == null) {
minStr = defaultMinStr.trim();
}
}
if (sizeTokens.hasMoreTokens()) {
// max parm was specified
String defaultMaxStr = sizeTokens.nextToken();
if (maxStr == null) {
maxStr = defaultMaxStr.trim();
}
}
if (sizeTokens.hasMoreTokens()) {
// timeout parm was specified
String defaultTimeoutStr = sizeTokens.nextToken();
if (timeoutStr == null) {
timeoutStr = defaultTimeoutStr.trim();
}
}
}
} else {
// Syntax error -- token did not include an equals sign....
Tr.warning(tc, "POOLSIZE_MISSING_EQUALS_SIGN_CNTR0062W", new Object[] { token });
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("An equals sign was not found in the pool size specification string " +
token + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} // while loop
} // poolSizeSpec not null
int tmpMinPoolSize, tmpMaxPoolSize;
long tmpMaxCreationTimeout;
boolean setInitialPoolSize = false; // PK20648
boolean setMaxCreation = false; // PK20648
if (minStr != null) {
try {
// An H prefix indicates a hard limit (pre-load pool). PK20648
if (minStr.startsWith("H")) {
setInitialPoolSize = true;
minStr = minStr.substring(1);
}
tmpMinPoolSize = Integer.parseInt(minStr);
if (tmpMinPoolSize < 1) {
Tr.warning(tc, "INVALID_MIN_POOLSIZE_CNTR0057W", new Object[] { (bmd.j2eeName).toString(), Integer.toString(tmpMinPoolSize) });
tmpMinPoolSize = defaultMinPoolSize;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Minimum pool size specified for bean " + bmd.j2eeName +
" not a valid positive integer: " + tmpMinPoolSize + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} catch (NumberFormatException e) {
FFDCFilter.processException(e, CLASS_NAME + ".processBeanPoolLimits", "2594", this);
Tr.warning(tc, "INVALID_MIN_POOLSIZE_CNTR0057W", new Object[] { (bmd.j2eeName).toString(), minStr });
tmpMinPoolSize = defaultMinPoolSize;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Minimum pool size specified for bean " + bmd.j2eeName +
" not a valid integer: " + minStr + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} else {
tmpMinPoolSize = defaultMinPoolSize;
}
if (maxStr != null) {
try {
// An H prefix indicates a hard limit (Max Creation). PK20648
if (maxStr.startsWith("H")) {
setMaxCreation = true;
maxStr = maxStr.substring(1);
}
tmpMaxPoolSize = Integer.parseInt(maxStr);
if (tmpMaxPoolSize < 1) {
Tr.warning(tc, "INVALID_MAX_POOLSIZE_CNTR0058W", new Object[] { (bmd.j2eeName).toString(), Integer.toString(tmpMaxPoolSize) });
tmpMaxPoolSize = defaultMaxPoolSize;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Maximum pool size specified for bean " + bmd.j2eeName +
" not a valid positive integer: " + tmpMaxPoolSize + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} catch (NumberFormatException e) {
FFDCFilter.processException(e, CLASS_NAME + ".processBeanPoolLimits", "2616", this);
Tr.warning(tc, "INVALID_MAX_POOLSIZE_CNTR0058W", new Object[] { (bmd.j2eeName).toString(), maxStr });
tmpMaxPoolSize = defaultMaxPoolSize;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Maximum pool size specified for bean " + bmd.j2eeName +
" not a valid integer: " + maxStr + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} else {
tmpMaxPoolSize = defaultMaxPoolSize;
}
if (setMaxCreation && timeoutStr != null) {
try {
tmpMaxCreationTimeout = Integer.parseInt(timeoutStr) * 1000;
if (tmpMaxCreationTimeout < 0) {
Tr.warning(tc, "INVALID_MAX_POOLTIMEOUT_CNTR0127W", new Object[] { (bmd.j2eeName).toString(), timeoutStr, "300" });
tmpMaxCreationTimeout = defaultMaxCreationTimeout;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Maximum pool size timeout specified for bean " + bmd.j2eeName +
" not a valid positive integer: " + timeoutStr + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} catch (NumberFormatException e) {
FFDCFilter.processException(e, CLASS_NAME + ".processBeanPoolLimits", "2573", this);
Tr.warning(tc, "INVALID_MAX_POOLTIMEOUT_CNTR0127W", new Object[] { (bmd.j2eeName).toString(), timeoutStr, "300" });
tmpMaxCreationTimeout = defaultMaxCreationTimeout;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Maximum pool size timeout specified for bean " + bmd.j2eeName +
" not a valid integer: " + timeoutStr + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} else {
tmpMaxCreationTimeout = defaultMaxCreationTimeout;
}
// If the noEJBPool system property has been set to "true", then a
// no-capacity ejb pool will be created. (This should only be used
// for development / debug purposes) // d262413 PK20648
if (noEJBPool) {
bmd.minPoolSize = 0;
bmd.maxPoolSize = 0;
}
// Otherwise, if an invalid min/max pair was specified, then the
// defaults will be used, and a warning issued.
else if (tmpMaxPoolSize < tmpMinPoolSize) {
Tr.warning(tc, "INVALID_POOLSIZE_COMBO_CNTR0059W", new Object[] { (bmd.j2eeName).toString(), Integer.toString(tmpMinPoolSize), Integer.toString(tmpMaxPoolSize) });
bmd.minPoolSize = defaultMinPoolSize;
bmd.maxPoolSize = defaultMaxPoolSize;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Minimum pool size specified for bean " + bmd.j2eeName +
" is greater than maximum pool size specified: (" +
tmpMinPoolSize + "," + tmpMaxPoolSize + ")");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
// And finally, everything looks good, so the configured sizes
// and pre-load / max creation limit values will be used.
else {
bmd.minPoolSize = tmpMinPoolSize;
bmd.maxPoolSize = tmpMaxPoolSize;
// Set the pre-load and max creation values to the min/max pool
// size values if 'H' (hard) specified, and the values were
// otherwise valid. PK20648
if (setInitialPoolSize)
bmd.ivInitialPoolSize = bmd.minPoolSize;
if (setMaxCreation) {
bmd.ivMaxCreation = bmd.maxPoolSize;
bmd.ivMaxCreationTimeout = tmpMaxCreationTimeout;
}
}
if (poolSizeSpec != null || noEJBPool) {
// Log an Info message indicating pool min/max values, including
// whether or not they are 'hard' limits. PK20648
String minPoolSizeStr = Integer.toString(bmd.minPoolSize);
if (bmd.ivInitialPoolSize > 0)
minPoolSizeStr = "H " + minPoolSizeStr;
String maxPoolSizeStr = Integer.toString(bmd.maxPoolSize);
if (bmd.ivMaxCreation > 0) {
maxPoolSizeStr = "H " + maxPoolSizeStr;
String maxPoolTimeoutStr = Long.toString(bmd.ivMaxCreationTimeout / 1000);
Tr.info(tc, "POOLSIZE_VALUES_CNTR0128I",
new Object[] { minPoolSizeStr, maxPoolSizeStr, maxPoolTimeoutStr, bmd.enterpriseBeanClassName });
} else {
Tr.info(tc, "POOLSIZE_VALUES_CNTR0060I",
new Object[] { minPoolSizeStr, maxPoolSizeStr, bmd.enterpriseBeanClassName });
}
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "processBeanPoolLimits");
}
} } | public class class_name {
private void processBeanPoolLimits(BeanMetaData bmd) throws EJBConfigurationException {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "processBeanPoolLimits");
}
boolean checkAppConfigCustom = bmd.isCheckConfig(); // F743-33178
//------------------------------------------------------------------------
// The following default values are documented in the info center
// changing them may affect existing customer applicatioins.
//
// Arguments can be made about the following values. No great
// science was used in determining these numbers.
//------------------------------------------------------------------------
int defaultMinPoolSize = 50;
int defaultMaxPoolSize = 500;
long defaultMaxCreationTimeout = 300000; // 5 minutes
String minStr = null;
String maxStr = null;
String timeoutStr = null;
String poolSizeSpec = null;
boolean noEJBPool = false; // d262413 PK20648
//------------------------------------------------------------------------
// Determine if the noEJBPool or poolSize java system properties have
// been specified. noEJBPool overrides everything, so the poolSize
// property is not needed when noEJBPool is enabled. d262413 PK20648
// Property access & default now handled by ContainerProperties. 391302
//------------------------------------------------------------------------
if (NoEJBPool)
noEJBPool = true;
else
poolSizeSpec = PoolSize; // 121700
if (poolSizeSpec != null) {
StringTokenizer st = new StringTokenizer(poolSizeSpec, ":");
while (st.hasMoreTokens()) {
String token = st.nextToken();
int assignmentPivot = token.indexOf('=');
if (assignmentPivot > 0) {
String lh = token.substring(0, assignmentPivot).trim();
// Now Z/OS does not allow "#" in java properties so we also
// must allow "%". If those are used we will switch them to "#" before
// proceeding. //d434795
lh = lh.replaceAll("%", "#");
if (lh.equals(bmd.j2eeName.toString())) { // d130438
String rh = token.substring(assignmentPivot + 1).trim();
StringTokenizer sizeTokens = new StringTokenizer(rh, ",");
if (sizeTokens.hasMoreTokens()) {
// min parm was specified
minStr = sizeTokens.nextToken().trim(); // depends on control dependency: [if], data = [none]
}
if (sizeTokens.hasMoreTokens()) {
// max parm was specified
maxStr = sizeTokens.nextToken().trim(); // depends on control dependency: [if], data = [none]
}
if (sizeTokens.hasMoreTokens()) {
// timeout parm was specified
timeoutStr = sizeTokens.nextToken().trim(); // depends on control dependency: [if], data = [none]
}
} else if (lh.equals("*") && (minStr == null || maxStr == null || timeoutStr == null)) {
String rh = token.substring(assignmentPivot + 1).trim();
StringTokenizer sizeTokens = new StringTokenizer(rh, ",");
if (sizeTokens.hasMoreTokens()) {
// min parm was specified
String defaultMinStr = sizeTokens.nextToken();
if (minStr == null) {
minStr = defaultMinStr.trim(); // depends on control dependency: [if], data = [none]
}
}
if (sizeTokens.hasMoreTokens()) {
// max parm was specified
String defaultMaxStr = sizeTokens.nextToken();
if (maxStr == null) {
maxStr = defaultMaxStr.trim(); // depends on control dependency: [if], data = [none]
}
}
if (sizeTokens.hasMoreTokens()) {
// timeout parm was specified
String defaultTimeoutStr = sizeTokens.nextToken();
if (timeoutStr == null) {
timeoutStr = defaultTimeoutStr.trim(); // depends on control dependency: [if], data = [none]
}
}
}
} else {
// Syntax error -- token did not include an equals sign....
Tr.warning(tc, "POOLSIZE_MISSING_EQUALS_SIGN_CNTR0062W", new Object[] { token });
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("An equals sign was not found in the pool size specification string " +
token + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} // while loop
} // poolSizeSpec not null
int tmpMinPoolSize, tmpMaxPoolSize;
long tmpMaxCreationTimeout;
boolean setInitialPoolSize = false; // PK20648
boolean setMaxCreation = false; // PK20648
if (minStr != null) {
try {
// An H prefix indicates a hard limit (pre-load pool). PK20648
if (minStr.startsWith("H")) {
setInitialPoolSize = true;
minStr = minStr.substring(1);
}
tmpMinPoolSize = Integer.parseInt(minStr);
if (tmpMinPoolSize < 1) {
Tr.warning(tc, "INVALID_MIN_POOLSIZE_CNTR0057W", new Object[] { (bmd.j2eeName).toString(), Integer.toString(tmpMinPoolSize) });
tmpMinPoolSize = defaultMinPoolSize;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Minimum pool size specified for bean " + bmd.j2eeName +
" not a valid positive integer: " + tmpMinPoolSize + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} catch (NumberFormatException e) {
FFDCFilter.processException(e, CLASS_NAME + ".processBeanPoolLimits", "2594", this);
Tr.warning(tc, "INVALID_MIN_POOLSIZE_CNTR0057W", new Object[] { (bmd.j2eeName).toString(), minStr });
tmpMinPoolSize = defaultMinPoolSize;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Minimum pool size specified for bean " + bmd.j2eeName +
" not a valid integer: " + minStr + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} else {
tmpMinPoolSize = defaultMinPoolSize;
}
if (maxStr != null) {
try {
// An H prefix indicates a hard limit (Max Creation). PK20648
if (maxStr.startsWith("H")) {
setMaxCreation = true;
maxStr = maxStr.substring(1);
}
tmpMaxPoolSize = Integer.parseInt(maxStr);
if (tmpMaxPoolSize < 1) {
Tr.warning(tc, "INVALID_MAX_POOLSIZE_CNTR0058W", new Object[] { (bmd.j2eeName).toString(), Integer.toString(tmpMaxPoolSize) });
tmpMaxPoolSize = defaultMaxPoolSize;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Maximum pool size specified for bean " + bmd.j2eeName +
" not a valid positive integer: " + tmpMaxPoolSize + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} catch (NumberFormatException e) {
FFDCFilter.processException(e, CLASS_NAME + ".processBeanPoolLimits", "2616", this);
Tr.warning(tc, "INVALID_MAX_POOLSIZE_CNTR0058W", new Object[] { (bmd.j2eeName).toString(), maxStr });
tmpMaxPoolSize = defaultMaxPoolSize;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Maximum pool size specified for bean " + bmd.j2eeName +
" not a valid integer: " + maxStr + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} else {
tmpMaxPoolSize = defaultMaxPoolSize;
}
if (setMaxCreation && timeoutStr != null) {
try {
tmpMaxCreationTimeout = Integer.parseInt(timeoutStr) * 1000;
if (tmpMaxCreationTimeout < 0) {
Tr.warning(tc, "INVALID_MAX_POOLTIMEOUT_CNTR0127W", new Object[] { (bmd.j2eeName).toString(), timeoutStr, "300" });
tmpMaxCreationTimeout = defaultMaxCreationTimeout;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Maximum pool size timeout specified for bean " + bmd.j2eeName +
" not a valid positive integer: " + timeoutStr + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} catch (NumberFormatException e) {
FFDCFilter.processException(e, CLASS_NAME + ".processBeanPoolLimits", "2573", this);
Tr.warning(tc, "INVALID_MAX_POOLTIMEOUT_CNTR0127W", new Object[] { (bmd.j2eeName).toString(), timeoutStr, "300" });
tmpMaxCreationTimeout = defaultMaxCreationTimeout;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Maximum pool size timeout specified for bean " + bmd.j2eeName +
" not a valid integer: " + timeoutStr + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
} else {
tmpMaxCreationTimeout = defaultMaxCreationTimeout;
}
// If the noEJBPool system property has been set to "true", then a
// no-capacity ejb pool will be created. (This should only be used
// for development / debug purposes) // d262413 PK20648
if (noEJBPool) {
bmd.minPoolSize = 0;
bmd.maxPoolSize = 0;
}
// Otherwise, if an invalid min/max pair was specified, then the
// defaults will be used, and a warning issued.
else if (tmpMaxPoolSize < tmpMinPoolSize) {
Tr.warning(tc, "INVALID_POOLSIZE_COMBO_CNTR0059W", new Object[] { (bmd.j2eeName).toString(), Integer.toString(tmpMinPoolSize), Integer.toString(tmpMaxPoolSize) });
bmd.minPoolSize = defaultMinPoolSize;
bmd.maxPoolSize = defaultMaxPoolSize;
if (isValidationFailable(checkAppConfigCustom)) {
EJBConfigurationException ecex = new EJBConfigurationException("Minimum pool size specified for bean " + bmd.j2eeName +
" is greater than maximum pool size specified: (" +
tmpMinPoolSize + "," + tmpMaxPoolSize + ")");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "processBeanPoolLimits : " + ecex);
throw ecex;
}
}
// And finally, everything looks good, so the configured sizes
// and pre-load / max creation limit values will be used.
else {
bmd.minPoolSize = tmpMinPoolSize;
bmd.maxPoolSize = tmpMaxPoolSize;
// Set the pre-load and max creation values to the min/max pool
// size values if 'H' (hard) specified, and the values were
// otherwise valid. PK20648
if (setInitialPoolSize)
bmd.ivInitialPoolSize = bmd.minPoolSize;
if (setMaxCreation) {
bmd.ivMaxCreation = bmd.maxPoolSize;
bmd.ivMaxCreationTimeout = tmpMaxCreationTimeout;
}
}
if (poolSizeSpec != null || noEJBPool) {
// Log an Info message indicating pool min/max values, including
// whether or not they are 'hard' limits. PK20648
String minPoolSizeStr = Integer.toString(bmd.minPoolSize);
if (bmd.ivInitialPoolSize > 0)
minPoolSizeStr = "H " + minPoolSizeStr;
String maxPoolSizeStr = Integer.toString(bmd.maxPoolSize);
if (bmd.ivMaxCreation > 0) {
maxPoolSizeStr = "H " + maxPoolSizeStr;
String maxPoolTimeoutStr = Long.toString(bmd.ivMaxCreationTimeout / 1000);
Tr.info(tc, "POOLSIZE_VALUES_CNTR0128I",
new Object[] { minPoolSizeStr, maxPoolSizeStr, maxPoolTimeoutStr, bmd.enterpriseBeanClassName });
} else {
Tr.info(tc, "POOLSIZE_VALUES_CNTR0060I",
new Object[] { minPoolSizeStr, maxPoolSizeStr, bmd.enterpriseBeanClassName });
}
}
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "processBeanPoolLimits");
}
} } |
public class class_name {
private int getSelectedTab() {
String theme = "default";
List<PageParameters.NamedPair> pairs = getPageParameters().getAllNamed();
theme = pairs.get(0).getValue();
if ("grid".equals(theme)) {
return 1;
} else if ("skies".equals(theme)) {
return 2;
} else if ("gray".equals(theme)) {
return 3;
} else if ("darkblue".equals(theme)) {
return 4;
} else if ("darkgreen".equals(theme)) {
return 5;
} else {
return 0;
}
} } | public class class_name {
private int getSelectedTab() {
String theme = "default";
List<PageParameters.NamedPair> pairs = getPageParameters().getAllNamed();
theme = pairs.get(0).getValue();
if ("grid".equals(theme)) {
return 1; // depends on control dependency: [if], data = [none]
} else if ("skies".equals(theme)) {
return 2; // depends on control dependency: [if], data = [none]
} else if ("gray".equals(theme)) {
return 3; // depends on control dependency: [if], data = [none]
} else if ("darkblue".equals(theme)) {
return 4; // depends on control dependency: [if], data = [none]
} else if ("darkgreen".equals(theme)) {
return 5; // depends on control dependency: [if], data = [none]
} else {
return 0; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void close() {
if (minor != null)
minor.cancel(true);
if (major != null)
major.cancel(true);
executor.shutdown();
try {
executor.awaitTermination(30, TimeUnit.SECONDS);
} catch (InterruptedException e) {
}
} } | public class class_name {
@Override
public void close() {
if (minor != null)
minor.cancel(true);
if (major != null)
major.cancel(true);
executor.shutdown();
try {
executor.awaitTermination(30, TimeUnit.SECONDS); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private JobTaskVertex createSingleInputVertex(SingleInputPlanNode node) throws CompilerException {
final String taskName = node.getNodeName();
final DriverStrategy ds = node.getDriverStrategy();
// check, whether chaining is possible
boolean chaining = false;
{
Channel inConn = node.getInput();
PlanNode pred = inConn.getSource();
chaining = ds.getPushChainDriverClass() != null &&
!(pred instanceof NAryUnionPlanNode) && // first op after union is stand-alone, because union is merged
!(pred instanceof BulkPartialSolutionPlanNode) && // partial solution merges anyways
!(pred instanceof WorksetPlanNode) && // workset merges anyways
!(pred instanceof IterationPlanNode) && // cannot chain with iteration heads currently
inConn.getShipStrategy() == ShipStrategyType.FORWARD &&
inConn.getLocalStrategy() == LocalStrategy.NONE &&
pred.getOutgoingChannels().size() == 1 &&
node.getDegreeOfParallelism() == pred.getDegreeOfParallelism() &&
node.getSubtasksPerInstance() == pred.getSubtasksPerInstance() &&
node.getBroadcastInputs().isEmpty();
// cannot chain the nodes that produce the next workset or the next solution set, if they are not the
// in a tail
if (this.currentIteration != null && this.currentIteration instanceof WorksetIterationPlanNode &&
node.getOutgoingChannels().size() > 0)
{
WorksetIterationPlanNode wspn = (WorksetIterationPlanNode) this.currentIteration;
if (wspn.getSolutionSetDeltaPlanNode() == pred || wspn.getNextWorkSetPlanNode() == pred) {
chaining = false;
}
}
// cannot chain the nodes that produce the next workset in a bulk iteration if a termination criterion follows
if (this.currentIteration != null && this.currentIteration instanceof BulkIterationPlanNode)
{
BulkIterationPlanNode wspn = (BulkIterationPlanNode) this.currentIteration;
if (node == wspn.getRootOfTerminationCriterion() && wspn.getRootOfStepFunction() == pred){
chaining = false;
}else if(node.getOutgoingChannels().size() > 0 &&(wspn.getRootOfStepFunction() == pred ||
wspn.getRootOfTerminationCriterion() == pred)) {
chaining = false;
}
}
}
final JobTaskVertex vertex;
final TaskConfig config;
if (chaining) {
vertex = null;
config = new TaskConfig(new Configuration());
this.chainedTasks.put(node, new TaskInChain(ds.getPushChainDriverClass(), config, taskName));
} else {
// create task vertex
vertex = new JobTaskVertex(taskName, this.jobGraph);
vertex.setTaskClass( (this.currentIteration != null && node.isOnDynamicPath()) ? IterationIntermediatePactTask.class : RegularPactTask.class);
config = new TaskConfig(vertex.getConfiguration());
config.setDriver(ds.getDriverClass());
}
// set user code
config.setStubWrapper(node.getPactContract().getUserCodeWrapper());
config.setStubParameters(node.getPactContract().getParameters());
// set the driver strategy
config.setDriverStrategy(ds);
if (node.getComparator() != null) {
config.setDriverComparator(node.getComparator(), 0);
}
// assign memory, file-handles, etc.
assignDriverResources(node, config);
return vertex;
} } | public class class_name {
private JobTaskVertex createSingleInputVertex(SingleInputPlanNode node) throws CompilerException {
final String taskName = node.getNodeName();
final DriverStrategy ds = node.getDriverStrategy();
// check, whether chaining is possible
boolean chaining = false;
{
Channel inConn = node.getInput();
PlanNode pred = inConn.getSource();
chaining = ds.getPushChainDriverClass() != null &&
!(pred instanceof NAryUnionPlanNode) && // first op after union is stand-alone, because union is merged
!(pred instanceof BulkPartialSolutionPlanNode) && // partial solution merges anyways
!(pred instanceof WorksetPlanNode) && // workset merges anyways
!(pred instanceof IterationPlanNode) && // cannot chain with iteration heads currently
inConn.getShipStrategy() == ShipStrategyType.FORWARD &&
inConn.getLocalStrategy() == LocalStrategy.NONE &&
pred.getOutgoingChannels().size() == 1 &&
node.getDegreeOfParallelism() == pred.getDegreeOfParallelism() &&
node.getSubtasksPerInstance() == pred.getSubtasksPerInstance() &&
node.getBroadcastInputs().isEmpty();
// cannot chain the nodes that produce the next workset or the next solution set, if they are not the
// in a tail
if (this.currentIteration != null && this.currentIteration instanceof WorksetIterationPlanNode &&
node.getOutgoingChannels().size() > 0)
{
WorksetIterationPlanNode wspn = (WorksetIterationPlanNode) this.currentIteration;
if (wspn.getSolutionSetDeltaPlanNode() == pred || wspn.getNextWorkSetPlanNode() == pred) {
chaining = false; // depends on control dependency: [if], data = [none]
}
}
// cannot chain the nodes that produce the next workset in a bulk iteration if a termination criterion follows
if (this.currentIteration != null && this.currentIteration instanceof BulkIterationPlanNode)
{
BulkIterationPlanNode wspn = (BulkIterationPlanNode) this.currentIteration;
if (node == wspn.getRootOfTerminationCriterion() && wspn.getRootOfStepFunction() == pred){
chaining = false; // depends on control dependency: [if], data = [none]
}else if(node.getOutgoingChannels().size() > 0 &&(wspn.getRootOfStepFunction() == pred ||
wspn.getRootOfTerminationCriterion() == pred)) {
chaining = false; // depends on control dependency: [if], data = [none]
}
}
}
final JobTaskVertex vertex;
final TaskConfig config;
if (chaining) {
vertex = null;
config = new TaskConfig(new Configuration());
this.chainedTasks.put(node, new TaskInChain(ds.getPushChainDriverClass(), config, taskName));
} else {
// create task vertex
vertex = new JobTaskVertex(taskName, this.jobGraph);
vertex.setTaskClass( (this.currentIteration != null && node.isOnDynamicPath()) ? IterationIntermediatePactTask.class : RegularPactTask.class);
config = new TaskConfig(vertex.getConfiguration());
config.setDriver(ds.getDriverClass());
}
// set user code
config.setStubWrapper(node.getPactContract().getUserCodeWrapper());
config.setStubParameters(node.getPactContract().getParameters());
// set the driver strategy
config.setDriverStrategy(ds);
if (node.getComparator() != null) {
config.setDriverComparator(node.getComparator(), 0);
}
// assign memory, file-handles, etc.
assignDriverResources(node, config);
return vertex;
} } |
public class class_name {
@Override
public int compareTo(Object other) {
if (other == null) {
return -1;
}
FlowKey otherKey = (FlowKey)other;
return new CompareToBuilder()
.appendSuper(super.compareTo(other))
.append(getEncodedRunId(), otherKey.getEncodedRunId())
.toComparison();
} } | public class class_name {
@Override
public int compareTo(Object other) {
if (other == null) {
return -1; // depends on control dependency: [if], data = [none]
}
FlowKey otherKey = (FlowKey)other;
return new CompareToBuilder()
.appendSuper(super.compareTo(other))
.append(getEncodedRunId(), otherKey.getEncodedRunId())
.toComparison();
} } |
public class class_name {
@SuppressWarnings("unused")
private String getTextValue(Element ele, String tagName) {
String textVal = null;
NodeList nl = ele.getElementsByTagName(tagName);
if(nl != null && nl.getLength() > 0) {
Element el = (Element)nl.item(0);
textVal = el.getFirstChild().getNodeValue();
}
return textVal;
} } | public class class_name {
@SuppressWarnings("unused")
private String getTextValue(Element ele, String tagName) {
String textVal = null;
NodeList nl = ele.getElementsByTagName(tagName);
if(nl != null && nl.getLength() > 0) {
Element el = (Element)nl.item(0);
textVal = el.getFirstChild().getNodeValue(); // depends on control dependency: [if], data = [none]
}
return textVal;
} } |
public class class_name {
void evictAll(EntityType entityType) {
CombinedEntityCache entityCache = caches.get();
if (entityCache != null) {
LOG.trace("Removing all entities from L1 cache that belong to {}", entityType.getId());
entityCache.evictAll(entityType);
}
} } | public class class_name {
void evictAll(EntityType entityType) {
CombinedEntityCache entityCache = caches.get();
if (entityCache != null) {
LOG.trace("Removing all entities from L1 cache that belong to {}", entityType.getId()); // depends on control dependency: [if], data = [none]
entityCache.evictAll(entityType); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<PortletType<PortletAppType<T>>> getAllPortlet()
{
List<PortletType<PortletAppType<T>>> list = new ArrayList<PortletType<PortletAppType<T>>>();
List<Node> nodeList = childNode.get("portlet");
for(Node node: nodeList)
{
PortletType<PortletAppType<T>> type = new PortletTypeImpl<PortletAppType<T>>(this, "portlet", childNode, node);
list.add(type);
}
return list;
} } | public class class_name {
public List<PortletType<PortletAppType<T>>> getAllPortlet()
{
List<PortletType<PortletAppType<T>>> list = new ArrayList<PortletType<PortletAppType<T>>>();
List<Node> nodeList = childNode.get("portlet");
for(Node node: nodeList)
{
PortletType<PortletAppType<T>> type = new PortletTypeImpl<PortletAppType<T>>(this, "portlet", childNode, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} } |
public class class_name {
public static boolean isSafeString(String string0) {
for (int i = 0; i < string0.length(); i++) {
if (!isSafeChar(string0.charAt(i))) {
return false;
}
}
return true;
} } | public class class_name {
public static boolean isSafeString(String string0) {
for (int i = 0; i < string0.length(); i++) {
if (!isSafeChar(string0.charAt(i))) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public Actions contextClick() {
if (isBuildingActions()) {
action.addAction(new ContextClickAction(jsonMouse, null));
}
return clickInTicks(RIGHT);
} } | public class class_name {
public Actions contextClick() {
if (isBuildingActions()) {
action.addAction(new ContextClickAction(jsonMouse, null)); // depends on control dependency: [if], data = [none]
}
return clickInTicks(RIGHT);
} } |
public class class_name {
@Override
public void contextInitialized(ServletContextEvent sce) {
try {
ServletContext sc;
synchronized(servletContextLock) {
servletContext = sce.getServletContext();
sc = servletContext;
}
// Find the top level directory
String gitToplevelPath = sc.getInitParameter(GIT_TOPLEVEL_CONTEXT_PARAM);
File gitToplevelRaw;
if(gitToplevelPath == null || gitToplevelPath.isEmpty()) {
// Default to web root
String rootRealPath = sc.getRealPath("/");
if(rootRealPath == null) throw new IllegalStateException("Unable to find web root and " + GIT_TOPLEVEL_CONTEXT_PARAM + " context parameter not provided");
gitToplevelRaw = new File(rootRealPath);
} else {
if(gitToplevelPath.startsWith("~/")) {
gitToplevelRaw = new File(System.getProperty("user.home"), gitToplevelPath.substring(2));
} else {
gitToplevelRaw = new File(gitToplevelPath);
}
}
if(DEBUG) sc.log("gitToplevelRaw: " + gitToplevelRaw);
Path gtl;
synchronized(gitToplevelLock) {
gitToplevel = gitToplevelRaw.getCanonicalFile().toPath();
gtl = gitToplevel;
}
if(DEBUG) sc.log("gitToplevel: " + gtl);
// Make sure root exists and is readable
if(!Files.isDirectory(gtl, LinkOption.NOFOLLOW_LINKS)) throw new IOException("Git toplevel is not a directory: " + gtl);
if(!Files.isReadable(gtl)) throw new IOException("Unable to read Git toplevel directory: " + gtl);
// Recursively watch for any changes in the directory
if(DEBUG) sc.log("Starting watcher");
WatchService w;
synchronized(watcherLock) {
watcher = gtl.getFileSystem().newWatchService();
w = watcher;
}
resync();
if(DEBUG) sc.log("Starting watchThread");
synchronized(watcherThreadLock) {
watcherThread = new Thread(watcherRunnable);
watcherThread.start();
}
if(DEBUG) sc.log("Starting changeThread");
synchronized(changedThreadLock) {
changedThread = new Thread(changedRunnable);
changedThread.start();
}
sc.setAttribute(APPLICATION_SCOPE_KEY, this);
} catch(IOException e) {
throw new WrappedException(e);
}
} } | public class class_name {
@Override
public void contextInitialized(ServletContextEvent sce) {
try {
ServletContext sc;
synchronized(servletContextLock) { // depends on control dependency: [try], data = [none]
servletContext = sce.getServletContext();
sc = servletContext;
}
// Find the top level directory
String gitToplevelPath = sc.getInitParameter(GIT_TOPLEVEL_CONTEXT_PARAM);
File gitToplevelRaw;
if(gitToplevelPath == null || gitToplevelPath.isEmpty()) {
// Default to web root
String rootRealPath = sc.getRealPath("/");
if(rootRealPath == null) throw new IllegalStateException("Unable to find web root and " + GIT_TOPLEVEL_CONTEXT_PARAM + " context parameter not provided");
gitToplevelRaw = new File(rootRealPath); // depends on control dependency: [if], data = [none]
} else {
if(gitToplevelPath.startsWith("~/")) {
gitToplevelRaw = new File(System.getProperty("user.home"), gitToplevelPath.substring(2)); // depends on control dependency: [if], data = [none]
} else {
gitToplevelRaw = new File(gitToplevelPath); // depends on control dependency: [if], data = [none]
}
}
if(DEBUG) sc.log("gitToplevelRaw: " + gitToplevelRaw);
Path gtl;
synchronized(gitToplevelLock) { // depends on control dependency: [try], data = [none]
gitToplevel = gitToplevelRaw.getCanonicalFile().toPath();
gtl = gitToplevel;
}
if(DEBUG) sc.log("gitToplevel: " + gtl);
// Make sure root exists and is readable
if(!Files.isDirectory(gtl, LinkOption.NOFOLLOW_LINKS)) throw new IOException("Git toplevel is not a directory: " + gtl);
if(!Files.isReadable(gtl)) throw new IOException("Unable to read Git toplevel directory: " + gtl);
// Recursively watch for any changes in the directory
if(DEBUG) sc.log("Starting watcher");
WatchService w;
synchronized(watcherLock) { // depends on control dependency: [try], data = [none]
watcher = gtl.getFileSystem().newWatchService();
w = watcher;
}
resync(); // depends on control dependency: [try], data = [none]
if(DEBUG) sc.log("Starting watchThread");
synchronized(watcherThreadLock) { // depends on control dependency: [try], data = [none]
watcherThread = new Thread(watcherRunnable);
watcherThread.start();
}
if(DEBUG) sc.log("Starting changeThread");
synchronized(changedThreadLock) { // depends on control dependency: [try], data = [none]
changedThread = new Thread(changedRunnable);
changedThread.start();
}
sc.setAttribute(APPLICATION_SCOPE_KEY, this); // depends on control dependency: [try], data = [none]
} catch(IOException e) {
throw new WrappedException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private String checkSkipBuildInString(Map<Pattern, String> patterns, String string) {
// check for skip build phrase in the passed string
if (!patterns.isEmpty() && StringUtils.isNotBlank(string)) {
for (Map.Entry<Pattern, String> e : patterns.entrySet()) {
if (e.getKey().matcher(string).matches()) {
return e.getValue();
}
}
}
return null;
} } | public class class_name {
private String checkSkipBuildInString(Map<Pattern, String> patterns, String string) {
// check for skip build phrase in the passed string
if (!patterns.isEmpty() && StringUtils.isNotBlank(string)) {
for (Map.Entry<Pattern, String> e : patterns.entrySet()) {
if (e.getKey().matcher(string).matches()) {
return e.getValue(); // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public static Map<String, Map<String, Expression>> getConstraintMetadata(final ClosureExpression closureExpression) {
final List<MethodCallExpression> methodExpressions = new ArrayList<MethodCallExpression>();
final Map<String, Map<String, Expression>> results = new LinkedHashMap<String, Map<String, Expression>>();
final Statement closureCode = closureExpression.getCode();
if (closureCode instanceof BlockStatement) {
final List<Statement> closureStatements = ((BlockStatement) closureCode).getStatements();
for (final Statement closureStatement : closureStatements) {
if (closureStatement instanceof ExpressionStatement) {
final Expression expression = ((ExpressionStatement) closureStatement).getExpression();
if (expression instanceof MethodCallExpression) {
methodExpressions.add((MethodCallExpression) expression);
}
} else if (closureStatement instanceof ReturnStatement) {
final ReturnStatement returnStatement = (ReturnStatement) closureStatement;
Expression expression = returnStatement.getExpression();
if (expression instanceof MethodCallExpression) {
methodExpressions.add((MethodCallExpression) expression);
}
}
for (final MethodCallExpression methodCallExpression : methodExpressions) {
final Expression objectExpression = methodCallExpression.getObjectExpression();
if (objectExpression instanceof VariableExpression && "this".equals(((VariableExpression)objectExpression).getName())) {
final Expression methodCallArguments = methodCallExpression.getArguments();
if (methodCallArguments instanceof TupleExpression) {
final List<Expression> methodCallArgumentExpressions = ((TupleExpression) methodCallArguments).getExpressions();
if (methodCallArgumentExpressions != null && methodCallArgumentExpressions.size() == 1 && methodCallArgumentExpressions.get(0) instanceof NamedArgumentListExpression) {
final Map<String, Expression> constraintNameToExpression = new LinkedHashMap<String, Expression>();
final List<MapEntryExpression> mapEntryExpressions = ((NamedArgumentListExpression) methodCallArgumentExpressions.get(0)).getMapEntryExpressions();
for (final MapEntryExpression mapEntryExpression : mapEntryExpressions) {
final Expression keyExpression = mapEntryExpression.getKeyExpression();
if (keyExpression instanceof ConstantExpression) {
final Object value = ((ConstantExpression) keyExpression).getValue();
if (value instanceof String) {
constraintNameToExpression.put((String)value, mapEntryExpression.getValueExpression());
}
}
}
results.put(methodCallExpression.getMethodAsString(), constraintNameToExpression);
}
}
}
}
}
}
return results;
} } | public class class_name {
public static Map<String, Map<String, Expression>> getConstraintMetadata(final ClosureExpression closureExpression) {
final List<MethodCallExpression> methodExpressions = new ArrayList<MethodCallExpression>();
final Map<String, Map<String, Expression>> results = new LinkedHashMap<String, Map<String, Expression>>();
final Statement closureCode = closureExpression.getCode();
if (closureCode instanceof BlockStatement) {
final List<Statement> closureStatements = ((BlockStatement) closureCode).getStatements();
for (final Statement closureStatement : closureStatements) {
if (closureStatement instanceof ExpressionStatement) {
final Expression expression = ((ExpressionStatement) closureStatement).getExpression();
if (expression instanceof MethodCallExpression) {
methodExpressions.add((MethodCallExpression) expression); // depends on control dependency: [if], data = [none]
}
} else if (closureStatement instanceof ReturnStatement) {
final ReturnStatement returnStatement = (ReturnStatement) closureStatement;
Expression expression = returnStatement.getExpression();
if (expression instanceof MethodCallExpression) {
methodExpressions.add((MethodCallExpression) expression); // depends on control dependency: [if], data = [none]
}
}
for (final MethodCallExpression methodCallExpression : methodExpressions) {
final Expression objectExpression = methodCallExpression.getObjectExpression();
if (objectExpression instanceof VariableExpression && "this".equals(((VariableExpression)objectExpression).getName())) {
final Expression methodCallArguments = methodCallExpression.getArguments();
if (methodCallArguments instanceof TupleExpression) {
final List<Expression> methodCallArgumentExpressions = ((TupleExpression) methodCallArguments).getExpressions();
if (methodCallArgumentExpressions != null && methodCallArgumentExpressions.size() == 1 && methodCallArgumentExpressions.get(0) instanceof NamedArgumentListExpression) {
final Map<String, Expression> constraintNameToExpression = new LinkedHashMap<String, Expression>();
final List<MapEntryExpression> mapEntryExpressions = ((NamedArgumentListExpression) methodCallArgumentExpressions.get(0)).getMapEntryExpressions();
for (final MapEntryExpression mapEntryExpression : mapEntryExpressions) {
final Expression keyExpression = mapEntryExpression.getKeyExpression();
if (keyExpression instanceof ConstantExpression) {
final Object value = ((ConstantExpression) keyExpression).getValue();
if (value instanceof String) {
constraintNameToExpression.put((String)value, mapEntryExpression.getValueExpression()); // depends on control dependency: [if], data = [none]
}
}
}
results.put(methodCallExpression.getMethodAsString(), constraintNameToExpression); // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
return results;
} } |
public class class_name {
public static void setSearchArgumentKryo(Configuration conf, String searchArgumentKryo) {
if (searchArgumentKryo != null) {
conf.set(SEARCH_ARGUMENT, searchArgumentKryo);
}
} } | public class class_name {
public static void setSearchArgumentKryo(Configuration conf, String searchArgumentKryo) {
if (searchArgumentKryo != null) {
conf.set(SEARCH_ARGUMENT, searchArgumentKryo); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean failSafeRemove(Node parent, Element child) {
//noinspection SimplifiableIfStatement
if (parent != null && child != null && parent.contains(child)) {
return parent.removeChild(child) != null;
}
return false;
} } | public class class_name {
public static boolean failSafeRemove(Node parent, Element child) {
//noinspection SimplifiableIfStatement
if (parent != null && child != null && parent.contains(child)) {
return parent.removeChild(child) != null; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
int removeExpired(TimeoutHandler expireHandler)
{
// ensure the clock never goes backwards
long t = ticker.currentTimeMillis();
int expired = 0;
for (int i = 0; i < slotCount; i++)
{
expired += slots[i].removeExpired(t, expireHandler);
}
return expired;
} } | public class class_name {
int removeExpired(TimeoutHandler expireHandler)
{
// ensure the clock never goes backwards
long t = ticker.currentTimeMillis();
int expired = 0;
for (int i = 0; i < slotCount; i++)
{
expired += slots[i].removeExpired(t, expireHandler); // depends on control dependency: [for], data = [i]
}
return expired;
} } |
public class class_name {
public static double[][] plusEquals(final double[][] m1, final double[][] m2) {
final int rowdim = m1.length, coldim = getColumnDimensionality(m1);
assert getRowDimensionality(m1) == getRowDimensionality(m2) && coldim == getColumnDimensionality(m2) : ERR_MATRIX_DIMENSIONS;
for(int i = 0; i < rowdim; i++) {
final double[] row1 = m1[i], row2 = m2[i];
for(int j = 0; j < coldim; j++) {
row1[j] += row2[j];
}
}
return m1;
} } | public class class_name {
public static double[][] plusEquals(final double[][] m1, final double[][] m2) {
final int rowdim = m1.length, coldim = getColumnDimensionality(m1);
assert getRowDimensionality(m1) == getRowDimensionality(m2) && coldim == getColumnDimensionality(m2) : ERR_MATRIX_DIMENSIONS;
for(int i = 0; i < rowdim; i++) {
final double[] row1 = m1[i], row2 = m2[i];
for(int j = 0; j < coldim; j++) {
row1[j] += row2[j]; // depends on control dependency: [for], data = [j]
}
}
return m1;
} } |
public class class_name {
protected Boolean _hasSideEffects(XTryCatchFinallyExpression expression, ISideEffectContext context) {
final List<Map<String, List<XExpression>>> buffers = new ArrayList<>();
Map<String, List<XExpression>> buffer = context.createVariableAssignmentBufferForBranch();
if (hasSideEffects(expression.getExpression(), context.branch(buffer))) {
return true;
}
buffers.add(buffer);
for (final XCatchClause clause : expression.getCatchClauses()) {
context.open();
buffer = context.createVariableAssignmentBufferForBranch();
if (hasSideEffects(clause.getExpression(), context.branch(buffer))) {
return true;
}
buffers.add(buffer);
context.close();
}
context.mergeBranchVariableAssignments(buffers);
if (hasSideEffects(expression.getFinallyExpression(), context)) {
return true;
}
return false;
} } | public class class_name {
protected Boolean _hasSideEffects(XTryCatchFinallyExpression expression, ISideEffectContext context) {
final List<Map<String, List<XExpression>>> buffers = new ArrayList<>();
Map<String, List<XExpression>> buffer = context.createVariableAssignmentBufferForBranch();
if (hasSideEffects(expression.getExpression(), context.branch(buffer))) {
return true; // depends on control dependency: [if], data = [none]
}
buffers.add(buffer);
for (final XCatchClause clause : expression.getCatchClauses()) {
context.open(); // depends on control dependency: [for], data = [none]
buffer = context.createVariableAssignmentBufferForBranch(); // depends on control dependency: [for], data = [none]
if (hasSideEffects(clause.getExpression(), context.branch(buffer))) {
return true; // depends on control dependency: [if], data = [none]
}
buffers.add(buffer); // depends on control dependency: [for], data = [none]
context.close(); // depends on control dependency: [for], data = [none]
}
context.mergeBranchVariableAssignments(buffers);
if (hasSideEffects(expression.getFinallyExpression(), context)) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static long byteArrayToLongLE( byte[] data ) {
if (data == null)
return 0x0;
long accum = 0;
int shiftBy = 0;
for( byte b : data ) {
accum |= (long) (b & 0xff) << shiftBy;
shiftBy += 8;
}
return accum;
} } | public class class_name {
public static long byteArrayToLongLE( byte[] data ) {
if (data == null)
return 0x0;
long accum = 0;
int shiftBy = 0;
for( byte b : data ) {
accum |= (long) (b & 0xff) << shiftBy; // depends on control dependency: [for], data = [b]
shiftBy += 8; // depends on control dependency: [for], data = [none]
}
return accum;
} } |
public class class_name {
public DescribeRetentionConfigurationsRequest withRetentionConfigurationNames(String... retentionConfigurationNames) {
if (this.retentionConfigurationNames == null) {
setRetentionConfigurationNames(new com.amazonaws.internal.SdkInternalList<String>(retentionConfigurationNames.length));
}
for (String ele : retentionConfigurationNames) {
this.retentionConfigurationNames.add(ele);
}
return this;
} } | public class class_name {
public DescribeRetentionConfigurationsRequest withRetentionConfigurationNames(String... retentionConfigurationNames) {
if (this.retentionConfigurationNames == null) {
setRetentionConfigurationNames(new com.amazonaws.internal.SdkInternalList<String>(retentionConfigurationNames.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : retentionConfigurationNames) {
this.retentionConfigurationNames.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void marshall(LogGroup logGroup, ProtocolMarshaller protocolMarshaller) {
if (logGroup == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(logGroup.getLogGroupName(), LOGGROUPNAME_BINDING);
protocolMarshaller.marshall(logGroup.getCreationTime(), CREATIONTIME_BINDING);
protocolMarshaller.marshall(logGroup.getRetentionInDays(), RETENTIONINDAYS_BINDING);
protocolMarshaller.marshall(logGroup.getMetricFilterCount(), METRICFILTERCOUNT_BINDING);
protocolMarshaller.marshall(logGroup.getArn(), ARN_BINDING);
protocolMarshaller.marshall(logGroup.getStoredBytes(), STOREDBYTES_BINDING);
protocolMarshaller.marshall(logGroup.getKmsKeyId(), KMSKEYID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(LogGroup logGroup, ProtocolMarshaller protocolMarshaller) {
if (logGroup == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(logGroup.getLogGroupName(), LOGGROUPNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logGroup.getCreationTime(), CREATIONTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logGroup.getRetentionInDays(), RETENTIONINDAYS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logGroup.getMetricFilterCount(), METRICFILTERCOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logGroup.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logGroup.getStoredBytes(), STOREDBYTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(logGroup.getKmsKeyId(), KMSKEYID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public TransformersSubRegistration registerSubsystemTransformers(final String name, final ModelVersionRange range, final ResourceTransformer subsystemTransformer, final OperationTransformer operationTransformer, boolean placeholder) {
final PathAddress subsystemAddress = PathAddress.EMPTY_ADDRESS.append(PathElement.pathElement(SUBSYSTEM, name));
for(final ModelVersion version : range.getVersions()) {
subsystem.createChildRegistry(subsystemAddress, version, subsystemTransformer, operationTransformer, placeholder);
}
return new TransformersSubRegistrationImpl(range, subsystem, subsystemAddress);
} } | public class class_name {
public TransformersSubRegistration registerSubsystemTransformers(final String name, final ModelVersionRange range, final ResourceTransformer subsystemTransformer, final OperationTransformer operationTransformer, boolean placeholder) {
final PathAddress subsystemAddress = PathAddress.EMPTY_ADDRESS.append(PathElement.pathElement(SUBSYSTEM, name));
for(final ModelVersion version : range.getVersions()) {
subsystem.createChildRegistry(subsystemAddress, version, subsystemTransformer, operationTransformer, placeholder); // depends on control dependency: [for], data = [version]
}
return new TransformersSubRegistrationImpl(range, subsystem, subsystemAddress);
} } |
public class class_name {
public void marshall(ListResourcesRequest listResourcesRequest, ProtocolMarshaller protocolMarshaller) {
if (listResourcesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listResourcesRequest.getResourceOwner(), RESOURCEOWNER_BINDING);
protocolMarshaller.marshall(listResourcesRequest.getPrincipal(), PRINCIPAL_BINDING);
protocolMarshaller.marshall(listResourcesRequest.getResourceType(), RESOURCETYPE_BINDING);
protocolMarshaller.marshall(listResourcesRequest.getResourceArns(), RESOURCEARNS_BINDING);
protocolMarshaller.marshall(listResourcesRequest.getResourceShareArns(), RESOURCESHAREARNS_BINDING);
protocolMarshaller.marshall(listResourcesRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listResourcesRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListResourcesRequest listResourcesRequest, ProtocolMarshaller protocolMarshaller) {
if (listResourcesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listResourcesRequest.getResourceOwner(), RESOURCEOWNER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listResourcesRequest.getPrincipal(), PRINCIPAL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listResourcesRequest.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listResourcesRequest.getResourceArns(), RESOURCEARNS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listResourcesRequest.getResourceShareArns(), RESOURCESHAREARNS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listResourcesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listResourcesRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
void completeCandidates(CommandContext ctx, String buffer, int cursor, List<String> candidates) {
if (candidates.isEmpty()) {
if (buffer.startsWith("\"") && buffer.length() >= 2) {
// Quotes are added back by super class.
buffer = buffer.substring(1);
}
if (buffer.length() == 2 && buffer.endsWith(":")) {
candidates.add(buffer + File.separator);
}
}
} } | public class class_name {
@Override
void completeCandidates(CommandContext ctx, String buffer, int cursor, List<String> candidates) {
if (candidates.isEmpty()) {
if (buffer.startsWith("\"") && buffer.length() >= 2) {
// Quotes are added back by super class.
buffer = buffer.substring(1); // depends on control dependency: [if], data = [none]
}
if (buffer.length() == 2 && buffer.endsWith(":")) {
candidates.add(buffer + File.separator); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void removeServletTimer(ServletTimer servletTimer, boolean updateAppSessionReadyToInvalidateState){
if(servletTimers != null) {
servletTimers.remove(servletTimer.getId());
}
if(updateAppSessionReadyToInvalidateState) {
updateReadyToInvalidateState();
}
} } | public class class_name {
public void removeServletTimer(ServletTimer servletTimer, boolean updateAppSessionReadyToInvalidateState){
if(servletTimers != null) {
servletTimers.remove(servletTimer.getId());
// depends on control dependency: [if], data = [none]
}
if(updateAppSessionReadyToInvalidateState) {
updateReadyToInvalidateState();
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
void encode(
DEROutputStream out)
throws IOException
{
if (out instanceof ASN1OutputStream || out instanceof BEROutputStream)
{
out.write(SEQUENCE | CONSTRUCTED);
out.write(0x80);
Enumeration e = getObjects();
while (e.hasMoreElements())
{
out.writeObject(e.nextElement());
}
out.write(0x00);
out.write(0x00);
}
else
{
super.encode(out);
}
} } | public class class_name {
void encode(
DEROutputStream out)
throws IOException
{
if (out instanceof ASN1OutputStream || out instanceof BEROutputStream)
{
out.write(SEQUENCE | CONSTRUCTED);
out.write(0x80);
Enumeration e = getObjects();
while (e.hasMoreElements())
{
out.writeObject(e.nextElement());
// depends on control dependency: [while], data = [none]
}
out.write(0x00);
out.write(0x00);
}
else
{
super.encode(out);
}
} } |
public class class_name {
private void adjustRequest(GetObjectRequest req) {
long[] range = req.getRange();
long lastByte = range[1];
long totalBytesToDownload = lastByte - this.origStartingByte + 1;
if (dstfile.exists()) {
if (!FileLocks.lock(dstfile)) {
throw new FileLockException("Fail to lock " + dstfile
+ " for range adjustment");
}
try {
expectedFileLength = dstfile.length();
long startingByte = this.origStartingByte + expectedFileLength;
LOG.info("Adjusting request range from " + Arrays.toString(range)
+ " to "
+ Arrays.toString(new long[] {startingByte, lastByte})
+ " for file " + dstfile);
req.setRange(startingByte, lastByte);
totalBytesToDownload = lastByte - startingByte + 1;
} finally {
FileLocks.unlock(dstfile);
}
}
if (totalBytesToDownload < 0) {
throw new IllegalArgumentException(
"Unable to determine the range for download operation. lastByte="
+ lastByte + ", origStartingByte=" + origStartingByte
+ ", expectedFileLength=" + expectedFileLength
+ ", totalBytesToDownload=" + totalBytesToDownload);
}
} } | public class class_name {
private void adjustRequest(GetObjectRequest req) {
long[] range = req.getRange();
long lastByte = range[1];
long totalBytesToDownload = lastByte - this.origStartingByte + 1;
if (dstfile.exists()) {
if (!FileLocks.lock(dstfile)) {
throw new FileLockException("Fail to lock " + dstfile
+ " for range adjustment");
}
try {
expectedFileLength = dstfile.length(); // depends on control dependency: [try], data = [none]
long startingByte = this.origStartingByte + expectedFileLength;
LOG.info("Adjusting request range from " + Arrays.toString(range)
+ " to "
+ Arrays.toString(new long[] {startingByte, lastByte})
+ " for file " + dstfile); // depends on control dependency: [try], data = [none]
req.setRange(startingByte, lastByte); // depends on control dependency: [try], data = [none]
totalBytesToDownload = lastByte - startingByte + 1; // depends on control dependency: [try], data = [none]
} finally {
FileLocks.unlock(dstfile);
}
}
if (totalBytesToDownload < 0) {
throw new IllegalArgumentException(
"Unable to determine the range for download operation. lastByte="
+ lastByte + ", origStartingByte=" + origStartingByte
+ ", expectedFileLength=" + expectedFileLength
+ ", totalBytesToDownload=" + totalBytesToDownload);
}
} } |
public class class_name {
public static Set<String> getFixedURLs(final ContentSpec contentSpec) {
final Set<String> fixedUrls = new HashSet<String>();
for (final Node childNode : contentSpec.getNodes()) {
if (childNode instanceof SpecNode) {
final SpecNode specNode = ((SpecNode) childNode);
if (!isNullOrEmpty(specNode.getFixedUrl())) {
fixedUrls.add(specNode.getFixedUrl());
}
}
if (childNode instanceof Level) {
fixedUrls.addAll(getFixedURLs((Level) childNode));
}
}
fixedUrls.addAll(getFixedURLs(contentSpec.getBaseLevel()));
return fixedUrls;
} } | public class class_name {
public static Set<String> getFixedURLs(final ContentSpec contentSpec) {
final Set<String> fixedUrls = new HashSet<String>();
for (final Node childNode : contentSpec.getNodes()) {
if (childNode instanceof SpecNode) {
final SpecNode specNode = ((SpecNode) childNode);
if (!isNullOrEmpty(specNode.getFixedUrl())) {
fixedUrls.add(specNode.getFixedUrl()); // depends on control dependency: [if], data = [none]
}
}
if (childNode instanceof Level) {
fixedUrls.addAll(getFixedURLs((Level) childNode)); // depends on control dependency: [if], data = [none]
}
}
fixedUrls.addAll(getFixedURLs(contentSpec.getBaseLevel()));
return fixedUrls;
} } |
public class class_name {
public java.util.List<String> getVersions() {
if (versions == null) {
versions = new com.amazonaws.internal.SdkInternalList<String>();
}
return versions;
} } | public class class_name {
public java.util.List<String> getVersions() {
if (versions == null) {
versions = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return versions;
} } |
public class class_name {
protected void addDirectory( JarArchiver jarArchiver, File directory, String prefix )
{
if ( directory != null && directory.exists() )
{
final DefaultFileSet fileSet = new DefaultFileSet();
fileSet.setPrefix( endWithSlash( prefix ) );
fileSet.setDirectory( directory );
// XXX: trying to avoid duplicated sources
fileSet.setExcludes( new String[] { "**/R.java", "**/BuildConfig.java" } );
jarArchiver.addFileSet( fileSet );
getLog().debug( "Added files from " + directory );
}
} } | public class class_name {
protected void addDirectory( JarArchiver jarArchiver, File directory, String prefix )
{
if ( directory != null && directory.exists() )
{
final DefaultFileSet fileSet = new DefaultFileSet();
fileSet.setPrefix( endWithSlash( prefix ) ); // depends on control dependency: [if], data = [none]
fileSet.setDirectory( directory ); // depends on control dependency: [if], data = [( directory]
// XXX: trying to avoid duplicated sources
fileSet.setExcludes( new String[] { "**/R.java", "**/BuildConfig.java" } ); // depends on control dependency: [if], data = [none]
jarArchiver.addFileSet( fileSet ); // depends on control dependency: [if], data = [none]
getLog().debug( "Added files from " + directory ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final EObject ruleXEqualityExpression() throws RecognitionException {
EObject current = null;
EObject this_XRelationalExpression_0 = null;
EObject lv_rightOperand_3_0 = null;
enterRule();
try {
// InternalSARL.g:12510:2: ( (this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )* ) )
// InternalSARL.g:12511:2: (this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )* )
{
// InternalSARL.g:12511:2: (this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )* )
// InternalSARL.g:12512:3: this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )*
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXEqualityExpressionAccess().getXRelationalExpressionParserRuleCall_0());
}
pushFollow(FOLLOW_117);
this_XRelationalExpression_0=ruleXRelationalExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current = this_XRelationalExpression_0;
afterParserOrEnumRuleCall();
}
// InternalSARL.g:12520:3: ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )*
loop304:
do {
int alt304=2;
switch ( input.LA(1) ) {
case 115:
{
int LA304_2 = input.LA(2);
if ( (synpred33_InternalSARL()) ) {
alt304=1;
}
}
break;
case 116:
{
int LA304_3 = input.LA(2);
if ( (synpred33_InternalSARL()) ) {
alt304=1;
}
}
break;
case 117:
{
int LA304_4 = input.LA(2);
if ( (synpred33_InternalSARL()) ) {
alt304=1;
}
}
break;
case 118:
{
int LA304_5 = input.LA(2);
if ( (synpred33_InternalSARL()) ) {
alt304=1;
}
}
break;
}
switch (alt304) {
case 1 :
// InternalSARL.g:12521:4: ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) )
{
// InternalSARL.g:12521:4: ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) )
// InternalSARL.g:12522:5: ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) )
{
// InternalSARL.g:12532:5: ( () ( ( ruleOpEquality ) ) )
// InternalSARL.g:12533:6: () ( ( ruleOpEquality ) )
{
// InternalSARL.g:12533:6: ()
// InternalSARL.g:12534:7:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElementAndSet(
grammarAccess.getXEqualityExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0(),
current);
}
}
// InternalSARL.g:12540:6: ( ( ruleOpEquality ) )
// InternalSARL.g:12541:7: ( ruleOpEquality )
{
// InternalSARL.g:12541:7: ( ruleOpEquality )
// InternalSARL.g:12542:8: ruleOpEquality
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXEqualityExpressionRule());
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXEqualityExpressionAccess().getFeatureJvmIdentifiableElementCrossReference_1_0_0_1_0());
}
pushFollow(FOLLOW_45);
ruleOpEquality();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall();
}
}
}
}
}
// InternalSARL.g:12558:4: ( (lv_rightOperand_3_0= ruleXRelationalExpression ) )
// InternalSARL.g:12559:5: (lv_rightOperand_3_0= ruleXRelationalExpression )
{
// InternalSARL.g:12559:5: (lv_rightOperand_3_0= ruleXRelationalExpression )
// InternalSARL.g:12560:6: lv_rightOperand_3_0= ruleXRelationalExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXEqualityExpressionAccess().getRightOperandXRelationalExpressionParserRuleCall_1_1_0());
}
pushFollow(FOLLOW_117);
lv_rightOperand_3_0=ruleXRelationalExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXEqualityExpressionRule());
}
set(
current,
"rightOperand",
lv_rightOperand_3_0,
"org.eclipse.xtext.xbase.Xbase.XRelationalExpression");
afterParserOrEnumRuleCall();
}
}
}
}
break;
default :
break loop304;
}
} while (true);
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleXEqualityExpression() throws RecognitionException {
EObject current = null;
EObject this_XRelationalExpression_0 = null;
EObject lv_rightOperand_3_0 = null;
enterRule();
try {
// InternalSARL.g:12510:2: ( (this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )* ) )
// InternalSARL.g:12511:2: (this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )* )
{
// InternalSARL.g:12511:2: (this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )* )
// InternalSARL.g:12512:3: this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )*
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXEqualityExpressionAccess().getXRelationalExpressionParserRuleCall_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_117);
this_XRelationalExpression_0=ruleXRelationalExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current = this_XRelationalExpression_0; // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
// InternalSARL.g:12520:3: ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )*
loop304:
do {
int alt304=2;
switch ( input.LA(1) ) {
case 115:
{
int LA304_2 = input.LA(2);
if ( (synpred33_InternalSARL()) ) {
alt304=1; // depends on control dependency: [if], data = [none]
}
}
break;
case 116:
{
int LA304_3 = input.LA(2);
if ( (synpred33_InternalSARL()) ) {
alt304=1; // depends on control dependency: [if], data = [none]
}
}
break;
case 117:
{
int LA304_4 = input.LA(2);
if ( (synpred33_InternalSARL()) ) {
alt304=1; // depends on control dependency: [if], data = [none]
}
}
break;
case 118:
{
int LA304_5 = input.LA(2);
if ( (synpred33_InternalSARL()) ) {
alt304=1; // depends on control dependency: [if], data = [none]
}
}
break;
}
switch (alt304) {
case 1 :
// InternalSARL.g:12521:4: ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) )
{
// InternalSARL.g:12521:4: ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) )
// InternalSARL.g:12522:5: ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) )
{
// InternalSARL.g:12532:5: ( () ( ( ruleOpEquality ) ) )
// InternalSARL.g:12533:6: () ( ( ruleOpEquality ) )
{
// InternalSARL.g:12533:6: ()
// InternalSARL.g:12534:7:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElementAndSet(
grammarAccess.getXEqualityExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0(),
current); // depends on control dependency: [if], data = [none]
}
}
// InternalSARL.g:12540:6: ( ( ruleOpEquality ) )
// InternalSARL.g:12541:7: ( ruleOpEquality )
{
// InternalSARL.g:12541:7: ( ruleOpEquality )
// InternalSARL.g:12542:8: ruleOpEquality
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXEqualityExpressionRule()); // depends on control dependency: [if], data = [none]
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXEqualityExpressionAccess().getFeatureJvmIdentifiableElementCrossReference_1_0_0_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_45);
ruleOpEquality();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
// InternalSARL.g:12558:4: ( (lv_rightOperand_3_0= ruleXRelationalExpression ) )
// InternalSARL.g:12559:5: (lv_rightOperand_3_0= ruleXRelationalExpression )
{
// InternalSARL.g:12559:5: (lv_rightOperand_3_0= ruleXRelationalExpression )
// InternalSARL.g:12560:6: lv_rightOperand_3_0= ruleXRelationalExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXEqualityExpressionAccess().getRightOperandXRelationalExpressionParserRuleCall_1_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_117);
lv_rightOperand_3_0=ruleXRelationalExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXEqualityExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"rightOperand",
lv_rightOperand_3_0,
"org.eclipse.xtext.xbase.Xbase.XRelationalExpression"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
default :
break loop304;
}
} while (true);
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
public void createChildAccessors(ClassIndex index, ClassPlan plan, JavaClassSource javaClass) {
Inflector inflector = new Inflector();
ResourceMetaData resourceMetaData = plan.getMetaData();
final JavaClassSource subresourceClass = getOrCreateSubresourceClass(plan, javaClass);
// For each subresource create a getter/mutator/list-mutator
final ResourceDescription resourceMetaDataDescription = resourceMetaData.getDescription();
final Set<String> childrenNames = resourceMetaDataDescription.getChildrenTypes();
for (String childName : childrenNames) {
this.names.add(childName);
final AddressTemplate childAddress = resourceMetaData.getAddress().append(childName + "=*");
final ClassPlan childClass = index.lookup(childAddress);
//javaClass.addImport(childClass);
javaClass.addImport(childClass.getFullyQualifiedClassName() + "Consumer");
javaClass.addImport(childClass.getFullyQualifiedClassName() + "Supplier");
final String childClassName = childClass.getClassName();
javaClass.addImport(childClass.getFullyQualifiedClassName());
final String propType = "java.util.List<" + childClassName + ">";
String propName = CaseFormat.UPPER_CAMEL.to(
CaseFormat.LOWER_CAMEL,
Keywords.escape(childClass.getOriginalClassName())
);
String singularName = propName;
String pluralName = inflector.pluralize(singularName);
if (!propName.endsWith("s")) {
propName = pluralName;
}
javaClass.addImport(SubresourceInfo.class);
// Add a property and an initializer for this subresource to the class
final String resourceText = resourceMetaDataDescription.getChildDescription(childName).getText();
FieldSource<JavaClassSource> field = subresourceClass.addField();
field.setName(propName)
.setType(propType)
.setPrivate()
.setLiteralInitializer("new java.util.ArrayList<>();")
.getJavaDoc().setText(resourceText);
AnnotationSource attributeAnnotation = field.addAnnotation();
attributeAnnotation.setName(ResourceDocumentation.class.getSimpleName());
attributeAnnotation.setStringValue(resourceText);
field.addAnnotation(SubresourceInfo.class).setStringValue(singularName);
// Add an accessor method
final MethodSource<JavaClassSource> accessor = subresourceClass.addMethod();
accessor.getJavaDoc()
.setText("Get the list of " + childClassName + " resources")
.addTagValue("@return", "the list of resources");
accessor.setPublic()
.setName(propName)
.setReturnType(propType)
.setBody("return this." + propName + ";");
final MethodSource<JavaClassSource> getByKey = subresourceClass.addMethod();
getByKey.addParameter(String.class, "key");
getByKey.setPublic()
.setName(singularName)
.setReturnType(childClassName)
.setBody("return this." + propName + ".stream().filter( e->e.getKey().equals(key) ).findFirst().orElse(null);");
// Add a mutator method that takes a list of resources. Mutators are added to the containing class
final MethodSource<JavaClassSource> listMutator = javaClass.addMethod();
listMutator.getJavaDoc()
.setText("Add all " + childClassName + " objects to this subresource")
.addTagValue("@return", "this")
.addTagValue("@param", "value List of " + childClassName + " objects.");
listMutator.addParameter(propType, "value");
listMutator.setPublic()
.setName(propName)
.setReturnType("T")
.setBody("this.subresources." + propName + " = value;\nreturn (T) this;")
.addAnnotation("SuppressWarnings").setStringValue("unchecked");
// Add a mutator method that takes a single resource. Mutators are added to the containing class
final MethodSource<JavaClassSource> mutator = javaClass.addMethod();
mutator.getJavaDoc()
.setText("Add the " + childClassName + " object to the list of subresources")
.addTagValue("@param", "value The " + childClassName + " to add")
.addTagValue("@return", "this");
mutator.addParameter(childClassName, "value");
mutator.setPublic()
.setName(singularName)
.setReturnType("T")
.setBody("this.subresources." + propName + ".add(value);\nreturn (T) this;")
.addAnnotation("SuppressWarnings").setStringValue("unchecked");
// Add a mutator method that factories a single resource and applies a supplied configurator. Mutators are added to the containing class
final MethodSource<JavaClassSource> configurator = javaClass.addMethod();
configurator.getJavaDoc()
.setText("Create and configure a " + childClassName + " object to the list of subresources")
.addTagValue("@param", "key The key for the " + childClassName + " resource")
.addTagValue("@param", "config The " + childClassName + "Consumer to use")
.addTagValue("@return", "this");
configurator.addParameter(String.class, "childKey");
configurator.addParameter(childClassName + "Consumer", "consumer");
//configurator.addParameter(childClassName + "Consumer", "consumer");
configurator.setPublic()
.setName(singularName)
.setReturnType("T")
.setBody(childClassName + "<? extends " + childClassName + "> child = new " + childClassName + "<>(childKey);\n if ( consumer != null ) { consumer.accept(child); }\n" + singularName + "(child);\nreturn (T) this;")
.addAnnotation("SuppressWarnings").setStringValue("unchecked");
// Add a mutator method that factories a single resource and applies a supplied configurator. Mutators are added to the containing class
final MethodSource<JavaClassSource> nonConfigurator = javaClass.addMethod();
nonConfigurator.getJavaDoc()
.setText("Create and configure a " + childClassName + " object to the list of subresources")
.addTagValue("@param", "key The key for the " + childClassName + " resource")
.addTagValue("@return", "this");
nonConfigurator.addParameter(String.class, "childKey");
nonConfigurator.setPublic()
.setName(singularName)
.setReturnType("T")
.setBody(singularName + "(childKey, null);\nreturn (T) this;\n")
.addAnnotation("SuppressWarnings").setStringValue("unchecked");
// Add a supplier to create
final MethodSource<JavaClassSource> supplier = javaClass.addMethod();
supplier.getJavaDoc()
.setText("Install a supplied " + childClassName + " object to the list of subresources");
//supplier.addParameter(childClassName + "Supplier", "supplier");
supplier.addParameter(childClassName + "Supplier", "supplier");
supplier.setPublic()
.setName(singularName)
.setReturnType("T")
.setBody(singularName + "(supplier.get()); return (T) this;")
.addAnnotation("SuppressWarnings").setStringValue("unchecked");
final AnnotationSource<JavaClassSource> subresourceMeta = accessor.addAnnotation();
subresourceMeta.setName("Subresource");
}
// initialize the collections
} } | public class class_name {
public void createChildAccessors(ClassIndex index, ClassPlan plan, JavaClassSource javaClass) {
Inflector inflector = new Inflector();
ResourceMetaData resourceMetaData = plan.getMetaData();
final JavaClassSource subresourceClass = getOrCreateSubresourceClass(plan, javaClass);
// For each subresource create a getter/mutator/list-mutator
final ResourceDescription resourceMetaDataDescription = resourceMetaData.getDescription();
final Set<String> childrenNames = resourceMetaDataDescription.getChildrenTypes();
for (String childName : childrenNames) {
this.names.add(childName); // depends on control dependency: [for], data = [childName]
final AddressTemplate childAddress = resourceMetaData.getAddress().append(childName + "=*");
final ClassPlan childClass = index.lookup(childAddress);
//javaClass.addImport(childClass);
javaClass.addImport(childClass.getFullyQualifiedClassName() + "Consumer"); // depends on control dependency: [for], data = [none]
javaClass.addImport(childClass.getFullyQualifiedClassName() + "Supplier"); // depends on control dependency: [for], data = [none]
final String childClassName = childClass.getClassName();
javaClass.addImport(childClass.getFullyQualifiedClassName()); // depends on control dependency: [for], data = [none]
final String propType = "java.util.List<" + childClassName + ">";
String propName = CaseFormat.UPPER_CAMEL.to(
CaseFormat.LOWER_CAMEL,
Keywords.escape(childClass.getOriginalClassName())
);
String singularName = propName;
String pluralName = inflector.pluralize(singularName);
if (!propName.endsWith("s")) {
propName = pluralName; // depends on control dependency: [if], data = [none]
}
javaClass.addImport(SubresourceInfo.class); // depends on control dependency: [for], data = [none]
// Add a property and an initializer for this subresource to the class
final String resourceText = resourceMetaDataDescription.getChildDescription(childName).getText();
FieldSource<JavaClassSource> field = subresourceClass.addField();
field.setName(propName)
.setType(propType)
.setPrivate()
.setLiteralInitializer("new java.util.ArrayList<>();")
.getJavaDoc().setText(resourceText); // depends on control dependency: [for], data = [none]
AnnotationSource attributeAnnotation = field.addAnnotation();
attributeAnnotation.setName(ResourceDocumentation.class.getSimpleName()); // depends on control dependency: [for], data = [none]
attributeAnnotation.setStringValue(resourceText); // depends on control dependency: [for], data = [none]
field.addAnnotation(SubresourceInfo.class).setStringValue(singularName); // depends on control dependency: [for], data = [none]
// Add an accessor method
final MethodSource<JavaClassSource> accessor = subresourceClass.addMethod();
accessor.getJavaDoc()
.setText("Get the list of " + childClassName + " resources")
.addTagValue("@return", "the list of resources"); // depends on control dependency: [for], data = [none]
accessor.setPublic()
.setName(propName)
.setReturnType(propType)
.setBody("return this." + propName + ";"); // depends on control dependency: [for], data = [none]
final MethodSource<JavaClassSource> getByKey = subresourceClass.addMethod();
getByKey.addParameter(String.class, "key"); // depends on control dependency: [for], data = [none]
getByKey.setPublic()
.setName(singularName)
.setReturnType(childClassName)
.setBody("return this." + propName + ".stream().filter( e->e.getKey().equals(key) ).findFirst().orElse(null);"); // depends on control dependency: [for], data = [none]
// Add a mutator method that takes a list of resources. Mutators are added to the containing class
final MethodSource<JavaClassSource> listMutator = javaClass.addMethod();
listMutator.getJavaDoc()
.setText("Add all " + childClassName + " objects to this subresource")
.addTagValue("@return", "this")
.addTagValue("@param", "value List of " + childClassName + " objects."); // depends on control dependency: [for], data = [none]
listMutator.addParameter(propType, "value"); // depends on control dependency: [for], data = [none]
listMutator.setPublic()
.setName(propName)
.setReturnType("T")
.setBody("this.subresources." + propName + " = value;\nreturn (T) this;")
.addAnnotation("SuppressWarnings").setStringValue("unchecked"); // depends on control dependency: [for], data = [none]
// Add a mutator method that takes a single resource. Mutators are added to the containing class
final MethodSource<JavaClassSource> mutator = javaClass.addMethod();
mutator.getJavaDoc()
.setText("Add the " + childClassName + " object to the list of subresources")
.addTagValue("@param", "value The " + childClassName + " to add")
.addTagValue("@return", "this"); // depends on control dependency: [for], data = [none]
mutator.addParameter(childClassName, "value"); // depends on control dependency: [for], data = [none]
mutator.setPublic()
.setName(singularName)
.setReturnType("T")
.setBody("this.subresources." + propName + ".add(value);\nreturn (T) this;")
.addAnnotation("SuppressWarnings").setStringValue("unchecked"); // depends on control dependency: [for], data = [none]
// Add a mutator method that factories a single resource and applies a supplied configurator. Mutators are added to the containing class
final MethodSource<JavaClassSource> configurator = javaClass.addMethod();
configurator.getJavaDoc()
.setText("Create and configure a " + childClassName + " object to the list of subresources")
.addTagValue("@param", "key The key for the " + childClassName + " resource")
.addTagValue("@param", "config The " + childClassName + "Consumer to use")
.addTagValue("@return", "this"); // depends on control dependency: [for], data = [none]
configurator.addParameter(String.class, "childKey"); // depends on control dependency: [for], data = [none]
configurator.addParameter(childClassName + "Consumer", "consumer"); // depends on control dependency: [for], data = [none]
//configurator.addParameter(childClassName + "Consumer", "consumer");
configurator.setPublic()
.setName(singularName)
.setReturnType("T")
.setBody(childClassName + "<? extends " + childClassName + "> child = new " + childClassName + "<>(childKey);\n if ( consumer != null ) { consumer.accept(child); }\n" + singularName + "(child);\nreturn (T) this;")
.addAnnotation("SuppressWarnings").setStringValue("unchecked"); // depends on control dependency: [for], data = [none]
// Add a mutator method that factories a single resource and applies a supplied configurator. Mutators are added to the containing class
final MethodSource<JavaClassSource> nonConfigurator = javaClass.addMethod();
nonConfigurator.getJavaDoc()
.setText("Create and configure a " + childClassName + " object to the list of subresources")
.addTagValue("@param", "key The key for the " + childClassName + " resource")
.addTagValue("@return", "this"); // depends on control dependency: [for], data = [none]
nonConfigurator.addParameter(String.class, "childKey"); // depends on control dependency: [for], data = [none]
nonConfigurator.setPublic()
.setName(singularName)
.setReturnType("T")
.setBody(singularName + "(childKey, null);\nreturn (T) this;\n") // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none]
.addAnnotation("SuppressWarnings").setStringValue("unchecked"); // depends on control dependency: [for], data = [none]
// Add a supplier to create
final MethodSource<JavaClassSource> supplier = javaClass.addMethod();
supplier.getJavaDoc()
.setText("Install a supplied " + childClassName + " object to the list of subresources"); // depends on control dependency: [for], data = [none]
//supplier.addParameter(childClassName + "Supplier", "supplier");
supplier.addParameter(childClassName + "Supplier", "supplier"); // depends on control dependency: [for], data = [none]
supplier.setPublic()
.setName(singularName)
.setReturnType("T")
.setBody(singularName + "(supplier.get()); return (T) this;") // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none]
.addAnnotation("SuppressWarnings").setStringValue("unchecked"); // depends on control dependency: [for], data = [none]
final AnnotationSource<JavaClassSource> subresourceMeta = accessor.addAnnotation();
subresourceMeta.setName("Subresource"); // depends on control dependency: [for], data = [none]
}
// initialize the collections
} } |
public class class_name {
public CmsObject getOfflineCmsObject(CmsObject cms) {
CmsObject res = null;
try {
if (!cms.getRequestContext().getCurrentProject().isOnlineProject()) {
return OpenCms.initCmsObject(cms);
}
res = OpenCms.initCmsObject(cms);
List<CmsProject> projects = OpenCms.getOrgUnitManager().getAllAccessibleProjects(res, "/", true);
Iterator<CmsProject> projIterator = projects.iterator();
boolean offFound = false;
while (projIterator.hasNext() & !offFound) {
CmsProject offP = projIterator.next();
if (!offP.isOnlineProject()) {
res.getRequestContext().setCurrentProject(offP);
offFound = true;
}
}
} catch (CmsException e) {
return cms;
}
return res;
} } | public class class_name {
public CmsObject getOfflineCmsObject(CmsObject cms) {
CmsObject res = null;
try {
if (!cms.getRequestContext().getCurrentProject().isOnlineProject()) {
return OpenCms.initCmsObject(cms); // depends on control dependency: [if], data = [none]
}
res = OpenCms.initCmsObject(cms); // depends on control dependency: [try], data = [none]
List<CmsProject> projects = OpenCms.getOrgUnitManager().getAllAccessibleProjects(res, "/", true);
Iterator<CmsProject> projIterator = projects.iterator();
boolean offFound = false;
while (projIterator.hasNext() & !offFound) {
CmsProject offP = projIterator.next();
if (!offP.isOnlineProject()) {
res.getRequestContext().setCurrentProject(offP); // depends on control dependency: [if], data = [none]
offFound = true; // depends on control dependency: [if], data = [none]
}
}
} catch (CmsException e) {
return cms;
} // depends on control dependency: [catch], data = [none]
return res;
} } |
public class class_name {
public Response invokeSignedRequest(Client apiClient, String accessKey, String secretKey,
String httpMethod, String endpointURL, String reqPath, Map<String, String> headers,
MultivaluedMap<String, String> params, Entity<?> entity) {
byte[] jsonEntity = null;
if (entity != null) {
try {
jsonEntity = ParaObjectUtils.getJsonWriter().writeValueAsBytes(entity.getEntity());
} catch (JsonProcessingException ex) {
jsonEntity = null;
logger.error(null, ex);
}
}
return invokeSignedRequest(apiClient, accessKey, secretKey, httpMethod,
endpointURL, reqPath, headers, params, jsonEntity);
} } | public class class_name {
public Response invokeSignedRequest(Client apiClient, String accessKey, String secretKey,
String httpMethod, String endpointURL, String reqPath, Map<String, String> headers,
MultivaluedMap<String, String> params, Entity<?> entity) {
byte[] jsonEntity = null;
if (entity != null) {
try {
jsonEntity = ParaObjectUtils.getJsonWriter().writeValueAsBytes(entity.getEntity()); // depends on control dependency: [try], data = [none]
} catch (JsonProcessingException ex) {
jsonEntity = null;
logger.error(null, ex);
} // depends on control dependency: [catch], data = [none]
}
return invokeSignedRequest(apiClient, accessKey, secretKey, httpMethod,
endpointURL, reqPath, headers, params, jsonEntity);
} } |
public class class_name {
public FieldElement invert() {
FieldElement t0, t1, t2, t3;
// 2 == 2 * 1
t0 = square();
// 4 == 2 * 2
t1 = t0.square();
// 8 == 2 * 4
t1 = t1.square();
// 9 == 8 + 1
t1 = multiply(t1);
// 11 == 9 + 2
t0 = t0.multiply(t1);
// 22 == 2 * 11
t2 = t0.square();
// 31 == 22 + 9
t1 = t1.multiply(t2);
// 2^6 - 2^1
t2 = t1.square();
// 2^10 - 2^5
for (int i = 1; i < 5; ++i) {
t2 = t2.square();
}
// 2^10 - 2^0
t1 = t2.multiply(t1);
// 2^11 - 2^1
t2 = t1.square();
// 2^20 - 2^10
for (int i = 1; i < 10; ++i) {
t2 = t2.square();
}
// 2^20 - 2^0
t2 = t2.multiply(t1);
// 2^21 - 2^1
t3 = t2.square();
// 2^40 - 2^20
for (int i = 1; i < 20; ++i) {
t3 = t3.square();
}
// 2^40 - 2^0
t2 = t3.multiply(t2);
// 2^41 - 2^1
t2 = t2.square();
// 2^50 - 2^10
for (int i = 1; i < 10; ++i) {
t2 = t2.square();
}
// 2^50 - 2^0
t1 = t2.multiply(t1);
// 2^51 - 2^1
t2 = t1.square();
// 2^100 - 2^50
for (int i = 1; i < 50; ++i) {
t2 = t2.square();
}
// 2^100 - 2^0
t2 = t2.multiply(t1);
// 2^101 - 2^1
t3 = t2.square();
// 2^200 - 2^100
for (int i = 1; i < 100; ++i) {
t3 = t3.square();
}
// 2^200 - 2^0
t2 = t3.multiply(t2);
// 2^201 - 2^1
t2 = t2.square();
// 2^250 - 2^50
for (int i = 1; i < 50; ++i) {
t2 = t2.square();
}
// 2^250 - 2^0
t1 = t2.multiply(t1);
// 2^251 - 2^1
t1 = t1.square();
// 2^255 - 2^5
for (int i = 1; i < 5; ++i) {
t1 = t1.square();
}
// 2^255 - 21
return t1.multiply(t0);
} } | public class class_name {
public FieldElement invert() {
FieldElement t0, t1, t2, t3;
// 2 == 2 * 1
t0 = square();
// 4 == 2 * 2
t1 = t0.square();
// 8 == 2 * 4
t1 = t1.square();
// 9 == 8 + 1
t1 = multiply(t1);
// 11 == 9 + 2
t0 = t0.multiply(t1);
// 22 == 2 * 11
t2 = t0.square();
// 31 == 22 + 9
t1 = t1.multiply(t2);
// 2^6 - 2^1
t2 = t1.square();
// 2^10 - 2^5
for (int i = 1; i < 5; ++i) {
t2 = t2.square(); // depends on control dependency: [for], data = [none]
}
// 2^10 - 2^0
t1 = t2.multiply(t1);
// 2^11 - 2^1
t2 = t1.square();
// 2^20 - 2^10
for (int i = 1; i < 10; ++i) {
t2 = t2.square(); // depends on control dependency: [for], data = [none]
}
// 2^20 - 2^0
t2 = t2.multiply(t1);
// 2^21 - 2^1
t3 = t2.square();
// 2^40 - 2^20
for (int i = 1; i < 20; ++i) {
t3 = t3.square(); // depends on control dependency: [for], data = [none]
}
// 2^40 - 2^0
t2 = t3.multiply(t2);
// 2^41 - 2^1
t2 = t2.square();
// 2^50 - 2^10
for (int i = 1; i < 10; ++i) {
t2 = t2.square(); // depends on control dependency: [for], data = [none]
}
// 2^50 - 2^0
t1 = t2.multiply(t1);
// 2^51 - 2^1
t2 = t1.square();
// 2^100 - 2^50
for (int i = 1; i < 50; ++i) {
t2 = t2.square(); // depends on control dependency: [for], data = [none]
}
// 2^100 - 2^0
t2 = t2.multiply(t1);
// 2^101 - 2^1
t3 = t2.square();
// 2^200 - 2^100
for (int i = 1; i < 100; ++i) {
t3 = t3.square(); // depends on control dependency: [for], data = [none]
}
// 2^200 - 2^0
t2 = t3.multiply(t2);
// 2^201 - 2^1
t2 = t2.square();
// 2^250 - 2^50
for (int i = 1; i < 50; ++i) {
t2 = t2.square(); // depends on control dependency: [for], data = [none]
}
// 2^250 - 2^0
t1 = t2.multiply(t1);
// 2^251 - 2^1
t1 = t1.square();
// 2^255 - 2^5
for (int i = 1; i < 5; ++i) {
t1 = t1.square(); // depends on control dependency: [for], data = [none]
}
// 2^255 - 21
return t1.multiply(t0);
} } |
public class class_name {
public void init(Record record, String startFieldName, BaseField fldStart, String endFieldName, BaseField fldEnd, int iPadfldEnd)
{
super.init(record);
this.setMasterSlaveFlag(FileListener.RUN_IN_SLAVE); // This runs on the slave (if there is a slave)
m_fldStart = fldStart;
m_fldEnd = fldEnd;
this.startFieldName = startFieldName;
this.endFieldName = endFieldName;
if (this.endFieldName == null)
this.endFieldName = this.startFieldName;
if (m_fldEnd == null)
m_fldEnd = m_fldStart;
m_iPadfldEnd = iPadfldEnd;
if (iPadfldEnd == PAD_DEFAULT)
{ // Default to false, unless start = end, then default to true
m_iPadfldEnd = DONT_PAD_END_FIELD;
if (m_fldEnd == m_fldStart)
m_iPadfldEnd = PAD_END_FIELD;
}
if (m_fldEnd != null) if (!(m_fldEnd instanceof StringField))
m_iPadfldEnd = DONT_PAD_END_FIELD; // Can't pad these types
} } | public class class_name {
public void init(Record record, String startFieldName, BaseField fldStart, String endFieldName, BaseField fldEnd, int iPadfldEnd)
{
super.init(record);
this.setMasterSlaveFlag(FileListener.RUN_IN_SLAVE); // This runs on the slave (if there is a slave)
m_fldStart = fldStart;
m_fldEnd = fldEnd;
this.startFieldName = startFieldName;
this.endFieldName = endFieldName;
if (this.endFieldName == null)
this.endFieldName = this.startFieldName;
if (m_fldEnd == null)
m_fldEnd = m_fldStart;
m_iPadfldEnd = iPadfldEnd;
if (iPadfldEnd == PAD_DEFAULT)
{ // Default to false, unless start = end, then default to true
m_iPadfldEnd = DONT_PAD_END_FIELD; // depends on control dependency: [if], data = [none]
if (m_fldEnd == m_fldStart)
m_iPadfldEnd = PAD_END_FIELD;
}
if (m_fldEnd != null) if (!(m_fldEnd instanceof StringField))
m_iPadfldEnd = DONT_PAD_END_FIELD; // Can't pad these types
} } |
public class class_name {
protected void processSprintData(Feature feature, Sprint sprint) {
// sSprintChangeDate - does not exist in Jira
feature.setsSprintChangeDate("");
// sSprintIsDeleted - does not exist in Jira
feature.setsSprintIsDeleted("False");
feature.setsSprintID(sprint.getId());
feature.setsSprintName(sprint.getName());
feature.setsSprintBeginDate(sprint.getStartDateStr());
feature.setsSprintEndDate(sprint.getEndDateStr());
feature.setsSprintAssetState(sprint.getState());
String rapidViewId = sprint.getRapidViewId();
if (!StringUtils.isEmpty(rapidViewId) && !StringUtils.isEmpty(feature.getsSprintID())) {
feature.setsSprintUrl(featureSettings.getJiraBaseUrl()
+ (Objects.equals(featureSettings.getJiraBaseUrl().substring(featureSettings.getJiraBaseUrl().length() - 1), "/") ? "" : "/")
+ "secure/RapidBoard.jspa?rapidView=" + rapidViewId
+ "&view=reporting&chart=sprintRetrospective&sprint=" + feature.getsSprintID());
}
} } | public class class_name {
protected void processSprintData(Feature feature, Sprint sprint) {
// sSprintChangeDate - does not exist in Jira
feature.setsSprintChangeDate("");
// sSprintIsDeleted - does not exist in Jira
feature.setsSprintIsDeleted("False");
feature.setsSprintID(sprint.getId());
feature.setsSprintName(sprint.getName());
feature.setsSprintBeginDate(sprint.getStartDateStr());
feature.setsSprintEndDate(sprint.getEndDateStr());
feature.setsSprintAssetState(sprint.getState());
String rapidViewId = sprint.getRapidViewId();
if (!StringUtils.isEmpty(rapidViewId) && !StringUtils.isEmpty(feature.getsSprintID())) {
feature.setsSprintUrl(featureSettings.getJiraBaseUrl()
+ (Objects.equals(featureSettings.getJiraBaseUrl().substring(featureSettings.getJiraBaseUrl().length() - 1), "/") ? "" : "/")
+ "secure/RapidBoard.jspa?rapidView=" + rapidViewId
+ "&view=reporting&chart=sprintRetrospective&sprint=" + feature.getsSprintID()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public synchronized void stopNow() { // can be called if unscheduled, disappeared, so don't use mutable variable
verifyCanStopState();
final List<TaskExecutor> executorList = findNativeExecutorList();
if (JobChangeLog.isEnabled()) {
JobChangeLog.log("#job ...Stopping {} execution(s) now: {}", executorList.size(), toString());
}
if (!executorList.isEmpty()) {
executorList.forEach(executor -> executor.stop());
}
} } | public class class_name {
@Override
public synchronized void stopNow() { // can be called if unscheduled, disappeared, so don't use mutable variable
verifyCanStopState();
final List<TaskExecutor> executorList = findNativeExecutorList();
if (JobChangeLog.isEnabled()) {
JobChangeLog.log("#job ...Stopping {} execution(s) now: {}", executorList.size(), toString()); // depends on control dependency: [if], data = [none]
}
if (!executorList.isEmpty()) {
executorList.forEach(executor -> executor.stop()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:52:47+02:00", comments = "JAXB RI v2.2.11")
public WohnungKategorienTyp getWohnungKategorie() {
if (wohnungKategorie == null) {
return WohnungKategorienTyp.KEINE_ANGABE;
} else {
return wohnungKategorie;
}
} } | public class class_name {
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:52:47+02:00", comments = "JAXB RI v2.2.11")
public WohnungKategorienTyp getWohnungKategorie() {
if (wohnungKategorie == null) {
return WohnungKategorienTyp.KEINE_ANGABE; // depends on control dependency: [if], data = [none]
} else {
return wohnungKategorie; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public float floatValue(){
if(intCompact != INFLATED) {
if (scale == 0) {
return (float)intCompact;
} else {
/*
* If both intCompact and the scale can be exactly
* represented as float values, perform a single float
* multiply or divide to compute the (properly
* rounded) result.
*/
if (Math.abs(intCompact) < 1L<<22 ) {
// Don't have too guard against
// Math.abs(MIN_VALUE) because of outer check
// against INFLATED.
if (scale > 0 && scale < float10pow.length) {
return (float)intCompact / float10pow[scale];
} else if (scale < 0 && scale > -float10pow.length) {
return (float)intCompact * float10pow[-scale];
}
}
}
}
// Somewhat inefficient, but guaranteed to work.
return Float.parseFloat(this.toString());
} } | public class class_name {
public float floatValue(){
if(intCompact != INFLATED) {
if (scale == 0) {
return (float)intCompact; // depends on control dependency: [if], data = [none]
} else {
/*
* If both intCompact and the scale can be exactly
* represented as float values, perform a single float
* multiply or divide to compute the (properly
* rounded) result.
*/
if (Math.abs(intCompact) < 1L<<22 ) {
// Don't have too guard against
// Math.abs(MIN_VALUE) because of outer check
// against INFLATED.
if (scale > 0 && scale < float10pow.length) {
return (float)intCompact / float10pow[scale]; // depends on control dependency: [if], data = [none]
} else if (scale < 0 && scale > -float10pow.length) {
return (float)intCompact * float10pow[-scale]; // depends on control dependency: [if], data = [none]
}
}
}
}
// Somewhat inefficient, but guaranteed to work.
return Float.parseFloat(this.toString());
} } |
public class class_name {
private void doRedBlackDeleteFixup(final Node<K,V> replacementNode,
final int index) {
Node<K,V> currentNode = replacementNode;
while ((currentNode != rootNode[index])
&& (isBlack(currentNode, index))) {
if (isLeftChild(currentNode, index)) {
Node<K,V> siblingNode =
getRightChild(getParent(currentNode, index), index);
if (isRed(siblingNode, index)) {
makeBlack(siblingNode, index);
makeRed(getParent(currentNode, index), index);
rotateLeft(getParent(currentNode, index), index);
siblingNode = getRightChild(getParent(currentNode, index), index);
}
if (isBlack(getLeftChild(siblingNode, index), index)
&& isBlack(getRightChild(siblingNode, index),
index)) {
makeRed(siblingNode, index);
currentNode = getParent(currentNode, index);
} else {
if (isBlack(getRightChild(siblingNode, index), index)) {
makeBlack(getLeftChild(siblingNode, index), index);
makeRed(siblingNode, index);
rotateRight(siblingNode, index);
siblingNode =
getRightChild(getParent(currentNode, index), index);
}
copyColor(getParent(currentNode, index), siblingNode,
index);
makeBlack(getParent(currentNode, index), index);
makeBlack(getRightChild(siblingNode, index), index);
rotateLeft(getParent(currentNode, index), index);
currentNode = rootNode[index];
}
} else {
Node<K,V> siblingNode = getLeftChild(getParent(currentNode, index), index);
if (isRed(siblingNode, index)) {
makeBlack(siblingNode, index);
makeRed(getParent(currentNode, index), index);
rotateRight(getParent(currentNode, index), index);
siblingNode = getLeftChild(getParent(currentNode, index), index);
}
if (isBlack(getRightChild(siblingNode, index), index)
&& isBlack(getLeftChild(siblingNode, index), index)) {
makeRed(siblingNode, index);
currentNode = getParent(currentNode, index);
} else {
if (isBlack(getLeftChild(siblingNode, index), index)) {
makeBlack(getRightChild(siblingNode, index), index);
makeRed(siblingNode, index);
rotateLeft(siblingNode, index);
siblingNode =
getLeftChild(getParent(currentNode, index), index);
}
copyColor(getParent(currentNode, index), siblingNode,
index);
makeBlack(getParent(currentNode, index), index);
makeBlack(getLeftChild(siblingNode, index), index);
rotateRight(getParent(currentNode, index), index);
currentNode = rootNode[index];
}
}
}
makeBlack(currentNode, index);
} } | public class class_name {
private void doRedBlackDeleteFixup(final Node<K,V> replacementNode,
final int index) {
Node<K,V> currentNode = replacementNode;
while ((currentNode != rootNode[index])
&& (isBlack(currentNode, index))) {
if (isLeftChild(currentNode, index)) {
Node<K,V> siblingNode =
getRightChild(getParent(currentNode, index), index);
if (isRed(siblingNode, index)) {
makeBlack(siblingNode, index);
// depends on control dependency: [if], data = [none]
makeRed(getParent(currentNode, index), index);
// depends on control dependency: [if], data = [none]
rotateLeft(getParent(currentNode, index), index);
// depends on control dependency: [if], data = [none]
siblingNode = getRightChild(getParent(currentNode, index), index);
// depends on control dependency: [if], data = [none]
}
if (isBlack(getLeftChild(siblingNode, index), index)
&& isBlack(getRightChild(siblingNode, index),
index)) {
makeRed(siblingNode, index);
// depends on control dependency: [if], data = [none]
currentNode = getParent(currentNode, index);
// depends on control dependency: [if], data = [none]
} else {
if (isBlack(getRightChild(siblingNode, index), index)) {
makeBlack(getLeftChild(siblingNode, index), index);
// depends on control dependency: [if], data = [none]
makeRed(siblingNode, index);
// depends on control dependency: [if], data = [none]
rotateRight(siblingNode, index);
// depends on control dependency: [if], data = [none]
siblingNode =
getRightChild(getParent(currentNode, index), index);
// depends on control dependency: [if], data = [none]
}
copyColor(getParent(currentNode, index), siblingNode,
index);
// depends on control dependency: [if], data = [none]
makeBlack(getParent(currentNode, index), index);
// depends on control dependency: [if], data = [none]
makeBlack(getRightChild(siblingNode, index), index);
// depends on control dependency: [if], data = [none]
rotateLeft(getParent(currentNode, index), index);
// depends on control dependency: [if], data = [none]
currentNode = rootNode[index];
// depends on control dependency: [if], data = [none]
}
} else {
Node<K,V> siblingNode = getLeftChild(getParent(currentNode, index), index);
if (isRed(siblingNode, index)) {
makeBlack(siblingNode, index);
// depends on control dependency: [if], data = [none]
makeRed(getParent(currentNode, index), index);
// depends on control dependency: [if], data = [none]
rotateRight(getParent(currentNode, index), index);
// depends on control dependency: [if], data = [none]
siblingNode = getLeftChild(getParent(currentNode, index), index);
// depends on control dependency: [if], data = [none]
}
if (isBlack(getRightChild(siblingNode, index), index)
&& isBlack(getLeftChild(siblingNode, index), index)) {
makeRed(siblingNode, index);
// depends on control dependency: [if], data = [none]
currentNode = getParent(currentNode, index);
// depends on control dependency: [if], data = [none]
} else {
if (isBlack(getLeftChild(siblingNode, index), index)) {
makeBlack(getRightChild(siblingNode, index), index);
// depends on control dependency: [if], data = [none]
makeRed(siblingNode, index);
// depends on control dependency: [if], data = [none]
rotateLeft(siblingNode, index);
// depends on control dependency: [if], data = [none]
siblingNode =
getLeftChild(getParent(currentNode, index), index);
// depends on control dependency: [if], data = [none]
}
copyColor(getParent(currentNode, index), siblingNode,
index);
// depends on control dependency: [if], data = [none]
makeBlack(getParent(currentNode, index), index);
// depends on control dependency: [if], data = [none]
makeBlack(getLeftChild(siblingNode, index), index);
// depends on control dependency: [if], data = [none]
rotateRight(getParent(currentNode, index), index);
// depends on control dependency: [if], data = [none]
currentNode = rootNode[index];
// depends on control dependency: [if], data = [none]
}
}
}
makeBlack(currentNode, index);
} } |
public class class_name {
protected boolean deleteProxy(
DestinationHandler destination,
MESubscription subscription,
Neighbour neighbour,
SIBUuid12 topicSpace,
String topic,
boolean wasRecovered,
boolean deleteHandler )
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"deleteProxy",
new Object[] { destination, neighbour, subscription, topicSpace, topic });
boolean outputHandlerDeleted = false;
/*
* If the destination object is not null, then we can remove
* the PubSubOutputHandler for this Neighbour for this topic.
*/
if (destination != null)
{
PubSubOutputHandler handler = destination.getPubSubOutputHandler(neighbour.getUUID());
// If the handler is null, then it has already been removed,
// otherwise need to remove this instance from the MatchSpace.
if (handler != null)
{
// Remove the topic from the output handler.
handler.removeTopic(topic);
// If we were asked not to delete the PubSubOuptutHandler then pass null into
// registerForPostCommit() which will prevent the eventPostRemove code from deleting it
if( !deleteHandler )
handler = null;
// Register for a commit, but only if the neighbour is in the active state.
if (wasRecovered)
subscription.registerForPostCommit(_proxyHandler, destination, handler, neighbour);
else
subscription.registerForPostCommit(null, destination, handler, neighbour);
outputHandlerDeleted = true;
}
else
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "PubSubOutputHandler not found");
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Destination object not found");
// Register on the subscription
if (wasRecovered)
subscription.registerForPostCommit(neighbour, this);
else
subscription.registerForPostCommit(null, destination, null, neighbour);
// Clear up the topic Space references for this topic on this ME.
removeTopicSpaceReference(neighbour.getUUID(), subscription, topicSpace, topic);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deleteProxy", new Boolean(outputHandlerDeleted));
return outputHandlerDeleted;
} } | public class class_name {
protected boolean deleteProxy(
DestinationHandler destination,
MESubscription subscription,
Neighbour neighbour,
SIBUuid12 topicSpace,
String topic,
boolean wasRecovered,
boolean deleteHandler )
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"deleteProxy",
new Object[] { destination, neighbour, subscription, topicSpace, topic });
boolean outputHandlerDeleted = false;
/*
* If the destination object is not null, then we can remove
* the PubSubOutputHandler for this Neighbour for this topic.
*/
if (destination != null)
{
PubSubOutputHandler handler = destination.getPubSubOutputHandler(neighbour.getUUID());
// If the handler is null, then it has already been removed,
// otherwise need to remove this instance from the MatchSpace.
if (handler != null)
{
// Remove the topic from the output handler.
handler.removeTopic(topic); // depends on control dependency: [if], data = [none]
// If we were asked not to delete the PubSubOuptutHandler then pass null into
// registerForPostCommit() which will prevent the eventPostRemove code from deleting it
if( !deleteHandler )
handler = null;
// Register for a commit, but only if the neighbour is in the active state.
if (wasRecovered)
subscription.registerForPostCommit(_proxyHandler, destination, handler, neighbour);
else
subscription.registerForPostCommit(null, destination, handler, neighbour);
outputHandlerDeleted = true; // depends on control dependency: [if], data = [none]
}
else
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "PubSubOutputHandler not found");
}
else
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Destination object not found");
// Register on the subscription
if (wasRecovered)
subscription.registerForPostCommit(neighbour, this);
else
subscription.registerForPostCommit(null, destination, null, neighbour);
// Clear up the topic Space references for this topic on this ME.
removeTopicSpaceReference(neighbour.getUUID(), subscription, topicSpace, topic); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "deleteProxy", new Boolean(outputHandlerDeleted));
return outputHandlerDeleted;
} } |
public class class_name {
protected ResourceBundle getResourceBundle(String basename, Locale locale) {
if (this.cacheMillis >= 0) {
// Fresh ResourceBundle.getBundle call in order to let ResourceBundle
// do its native caching, at the expense of more extensive lookup steps.
return doGetBundle(basename, locale);
} else {
// Cache forever: prefer locale cache over repeated getBundle calls.
Map<Locale, ResourceBundle> localeMap = this.cachedResourceBundles.get(basename);
if (localeMap != null) {
ResourceBundle bundle = localeMap.get(locale);
if (bundle != null) {
return bundle;
}
}
try {
ResourceBundle bundle = doGetBundle(basename, locale);
if (localeMap == null) {
localeMap = new ConcurrentHashMap<>();
Map<Locale, ResourceBundle> existing = this.cachedResourceBundles.putIfAbsent(basename, localeMap);
if (existing != null) {
localeMap = existing;
}
}
localeMap.put(locale, bundle);
return bundle;
} catch (MissingResourceException ex) {
log.warn("ResourceBundle [" + basename + "] not found for MessageSource: " + ex.getMessage());
// Assume bundle not found
// -> do NOT throw the exception to allow for checking parent message source.
return null;
}
}
} } | public class class_name {
protected ResourceBundle getResourceBundle(String basename, Locale locale) {
if (this.cacheMillis >= 0) {
// Fresh ResourceBundle.getBundle call in order to let ResourceBundle
// do its native caching, at the expense of more extensive lookup steps.
return doGetBundle(basename, locale); // depends on control dependency: [if], data = [none]
} else {
// Cache forever: prefer locale cache over repeated getBundle calls.
Map<Locale, ResourceBundle> localeMap = this.cachedResourceBundles.get(basename);
if (localeMap != null) {
ResourceBundle bundle = localeMap.get(locale);
if (bundle != null) {
return bundle; // depends on control dependency: [if], data = [none]
}
}
try {
ResourceBundle bundle = doGetBundle(basename, locale);
if (localeMap == null) {
localeMap = new ConcurrentHashMap<>(); // depends on control dependency: [if], data = [none]
Map<Locale, ResourceBundle> existing = this.cachedResourceBundles.putIfAbsent(basename, localeMap);
if (existing != null) {
localeMap = existing; // depends on control dependency: [if], data = [none]
}
}
localeMap.put(locale, bundle); // depends on control dependency: [try], data = [none]
return bundle; // depends on control dependency: [try], data = [none]
} catch (MissingResourceException ex) {
log.warn("ResourceBundle [" + basename + "] not found for MessageSource: " + ex.getMessage());
// Assume bundle not found
// -> do NOT throw the exception to allow for checking parent message source.
return null;
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private static String addScriptDirectives(Element scriptElement) throws IOException, DocumentTemplateException {
String scriptReplacement = "";
List scriptParts = parseScriptParts(scriptElement.getValue());
for (int index = 0; index < scriptParts.size(); index++) {
ScriptPart scriptPart = (ScriptPart) scriptParts.get(index);
if (scriptPart.getLocation() == null) {
scriptReplacement = scriptPart.getText();
}
else {
Element enclosingElement = findEnclosingElement(scriptElement, scriptPart.getLocation());
if (scriptPart.isTagAttribute()) {
String[] nameValue = scriptPart.getText().split("=", 2);
if (nameValue.length != 2) {
throw new DocumentTemplateException("script error: # attribute name=value not found");
}
String attributeNamespace = enclosingElement.getNamespaceURI();
if (nameValue[0].contains(":")) {
String prefix = nameValue[0].split(":")[0];
if (!prefix.equals(enclosingElement.getNamespacePrefix())) {
attributeNamespace = XPATH_CONTEXT.lookup(prefix);
if (attributeNamespace == null) {
throw new DocumentTemplateException("unsupported attribute namespace: " + prefix);
}
}
}
enclosingElement.addAttribute(new Attribute(nameValue[0], attributeNamespace, nameValue[1]));
}
else {
ParentNode parent = enclosingElement.getParent();
int parentIndex = parent.indexOf(enclosingElement);
if (scriptPart.afterEndTag()) {
parentIndex++;
}
parent.insertChild(newNode(scriptPart.getText()), parentIndex);
}
}
}
return scriptReplacement;
} } | public class class_name {
private static String addScriptDirectives(Element scriptElement) throws IOException, DocumentTemplateException {
String scriptReplacement = "";
List scriptParts = parseScriptParts(scriptElement.getValue());
for (int index = 0; index < scriptParts.size(); index++) {
ScriptPart scriptPart = (ScriptPart) scriptParts.get(index);
if (scriptPart.getLocation() == null) {
scriptReplacement = scriptPart.getText();
}
else {
Element enclosingElement = findEnclosingElement(scriptElement, scriptPart.getLocation());
if (scriptPart.isTagAttribute()) {
String[] nameValue = scriptPart.getText().split("=", 2);
if (nameValue.length != 2) {
throw new DocumentTemplateException("script error: # attribute name=value not found");
}
String attributeNamespace = enclosingElement.getNamespaceURI();
if (nameValue[0].contains(":")) {
String prefix = nameValue[0].split(":")[0];
if (!prefix.equals(enclosingElement.getNamespacePrefix())) {
attributeNamespace = XPATH_CONTEXT.lookup(prefix); // depends on control dependency: [if], data = [none]
if (attributeNamespace == null) {
throw new DocumentTemplateException("unsupported attribute namespace: " + prefix);
}
}
}
enclosingElement.addAttribute(new Attribute(nameValue[0], attributeNamespace, nameValue[1]));
}
else {
ParentNode parent = enclosingElement.getParent();
int parentIndex = parent.indexOf(enclosingElement);
if (scriptPart.afterEndTag()) {
parentIndex++; // depends on control dependency: [if], data = [none]
}
parent.insertChild(newNode(scriptPart.getText()), parentIndex);
}
}
}
return scriptReplacement;
} } |
public class class_name {
public double[] solve(double[] b) {
if(b.length != m) {
throw new IllegalArgumentException(ERR_MATRIX_DIMENSIONS);
}
if(!this.isNonsingular()) {
throw new ArithmeticException(ERR_SINGULAR);
}
double[] bc = new double[piv.length];
for(int i = 0; i < piv.length; i++) {
bc[i] = b[piv[i]];
}
solveInplace(bc);
return n < bc.length ? Arrays.copyOf(bc, n) : bc;
} } | public class class_name {
public double[] solve(double[] b) {
if(b.length != m) {
throw new IllegalArgumentException(ERR_MATRIX_DIMENSIONS);
}
if(!this.isNonsingular()) {
throw new ArithmeticException(ERR_SINGULAR);
}
double[] bc = new double[piv.length];
for(int i = 0; i < piv.length; i++) {
bc[i] = b[piv[i]]; // depends on control dependency: [for], data = [i]
}
solveInplace(bc);
return n < bc.length ? Arrays.copyOf(bc, n) : bc;
} } |
public class class_name {
public OSchemaHelper oDocument(String pkField, Object pkValue)
{
checkOClass();
List<ODocument> docs = db.query(new OSQLSynchQuery<ODocument>("select from "+lastClass.getName()+" where "+pkField+" = ?", 1), pkValue);
if(docs!=null && !docs.isEmpty())
{
lastDocument = docs.get(0);
}
else
{
lastDocument = new ODocument(lastClass);
lastDocument.field(pkField, pkValue);
}
return this;
} } | public class class_name {
public OSchemaHelper oDocument(String pkField, Object pkValue)
{
checkOClass();
List<ODocument> docs = db.query(new OSQLSynchQuery<ODocument>("select from "+lastClass.getName()+" where "+pkField+" = ?", 1), pkValue);
if(docs!=null && !docs.isEmpty())
{
lastDocument = docs.get(0); // depends on control dependency: [if], data = [none]
}
else
{
lastDocument = new ODocument(lastClass); // depends on control dependency: [if], data = [none]
lastDocument.field(pkField, pkValue); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
synchronized void trimList(int toLimit){
int listSize = errorList.size();
List<CaughtError> newList = new CopyOnWriteArrayList<CaughtError>();
for (int i=listSize - toLimit; i<listSize; i++){
newList.add(errorList.get(i));
}
errorList = newList;
} } | public class class_name {
synchronized void trimList(int toLimit){
int listSize = errorList.size();
List<CaughtError> newList = new CopyOnWriteArrayList<CaughtError>();
for (int i=listSize - toLimit; i<listSize; i++){
newList.add(errorList.get(i)); // depends on control dependency: [for], data = [i]
}
errorList = newList;
} } |
public class class_name {
private List<DoubleSolution> getNonDominatedSolutions(ExperimentProblem<?> problem) throws FileNotFoundException {
NonDominatedSolutionListArchive<DoubleSolution> nonDominatedSolutionArchive =
new NonDominatedSolutionListArchive<DoubleSolution>() ;
for (ExperimentAlgorithm<?,?> algorithm : experiment.getAlgorithmList()
.stream()
.filter(s->s.getProblemTag().equals(problem.getTag()))
.collect(Collectors.toCollection(ArrayList::new))) {
String problemDirectory = experiment.getExperimentBaseDirectory() + "/data/" +
algorithm.getAlgorithmTag() + "/" + problem.getTag() ;
String frontFileName = problemDirectory + "/" + experiment.getOutputParetoFrontFileName() +
algorithm.getRunId() + ".tsv";
String paretoSetFileName = problemDirectory + "/" + experiment.getOutputParetoSetFileName() +
algorithm.getRunId() + ".tsv";
Front frontWithObjectiveValues = new ArrayFront(frontFileName) ;
Front frontWithVariableValues = new ArrayFront(paretoSetFileName) ;
List<DoubleSolution> solutionList =
createSolutionListFrontFiles(algorithm.getAlgorithmTag(), frontWithVariableValues, frontWithObjectiveValues) ;
for (DoubleSolution solution : solutionList) {
nonDominatedSolutionArchive.add(solution) ;
}
}
return nonDominatedSolutionArchive.getSolutionList() ;
} } | public class class_name {
private List<DoubleSolution> getNonDominatedSolutions(ExperimentProblem<?> problem) throws FileNotFoundException {
NonDominatedSolutionListArchive<DoubleSolution> nonDominatedSolutionArchive =
new NonDominatedSolutionListArchive<DoubleSolution>() ;
for (ExperimentAlgorithm<?,?> algorithm : experiment.getAlgorithmList()
.stream()
.filter(s->s.getProblemTag().equals(problem.getTag()))
.collect(Collectors.toCollection(ArrayList::new))) {
String problemDirectory = experiment.getExperimentBaseDirectory() + "/data/" +
algorithm.getAlgorithmTag() + "/" + problem.getTag() ;
String frontFileName = problemDirectory + "/" + experiment.getOutputParetoFrontFileName() +
algorithm.getRunId() + ".tsv";
String paretoSetFileName = problemDirectory + "/" + experiment.getOutputParetoSetFileName() +
algorithm.getRunId() + ".tsv";
Front frontWithObjectiveValues = new ArrayFront(frontFileName) ;
Front frontWithVariableValues = new ArrayFront(paretoSetFileName) ;
List<DoubleSolution> solutionList =
createSolutionListFrontFiles(algorithm.getAlgorithmTag(), frontWithVariableValues, frontWithObjectiveValues) ;
for (DoubleSolution solution : solutionList) {
nonDominatedSolutionArchive.add(solution) ; // depends on control dependency: [for], data = [solution]
}
}
return nonDominatedSolutionArchive.getSolutionList() ;
} } |
public class class_name {
public void setRotation(String rotation) {
if (rotation != null) {
try {
setRotation(Integer.parseInt(rotation));
} catch (NumberFormatException e) {
setRotation(-1);
}
}
} } | public class class_name {
public void setRotation(String rotation) {
if (rotation != null) {
try {
setRotation(Integer.parseInt(rotation));
// depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
setRotation(-1);
}
// depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void registerTable(String tableName,
GeoPackageCursorWrapper cursorWrapper) {
// Remove an existing cursor wrapper
tableCursors.remove(tableName);
// Add the wrapper
tableCursors.put(tableName, cursorWrapper);
String quotedTableName = CoreSQLUtils.quoteWrap(tableName);
tableCursors.put(quotedTableName, cursorWrapper);
// The Android android.database.sqlite.SQLiteDatabase findEditTable method
// finds the new cursor edit table name based upon the first space or comma.
// Fix (hopefully temporary) to wrap with the expected cursor type
int spacePosition = tableName.indexOf(' ');
if (spacePosition > 0) {
tableCursors.put(tableName.substring(0, spacePosition), cursorWrapper);
tableCursors.put(quotedTableName.substring(0, quotedTableName.indexOf(' ')), cursorWrapper);
}
} } | public class class_name {
public void registerTable(String tableName,
GeoPackageCursorWrapper cursorWrapper) {
// Remove an existing cursor wrapper
tableCursors.remove(tableName);
// Add the wrapper
tableCursors.put(tableName, cursorWrapper);
String quotedTableName = CoreSQLUtils.quoteWrap(tableName);
tableCursors.put(quotedTableName, cursorWrapper);
// The Android android.database.sqlite.SQLiteDatabase findEditTable method
// finds the new cursor edit table name based upon the first space or comma.
// Fix (hopefully temporary) to wrap with the expected cursor type
int spacePosition = tableName.indexOf(' ');
if (spacePosition > 0) {
tableCursors.put(tableName.substring(0, spacePosition), cursorWrapper); // depends on control dependency: [if], data = [none]
tableCursors.put(quotedTableName.substring(0, quotedTableName.indexOf(' ')), cursorWrapper); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static ManagedEntity[] createManagedEntities(ServerConnection sc, ManagedObjectReference[] mors) {
if (mors == null) {
return new ManagedEntity[0];
}
ManagedEntity[] mes = new ManagedEntity[mors.length];
for (int i = 0; i < mors.length; i++) {
mes[i] = createExactManagedEntity(sc, mors[i]);
}
return mes;
} } | public class class_name {
public static ManagedEntity[] createManagedEntities(ServerConnection sc, ManagedObjectReference[] mors) {
if (mors == null) {
return new ManagedEntity[0];
// depends on control dependency: [if], data = [none]
}
ManagedEntity[] mes = new ManagedEntity[mors.length];
for (int i = 0; i < mors.length; i++) {
mes[i] = createExactManagedEntity(sc, mors[i]);
// depends on control dependency: [for], data = [i]
}
return mes;
} } |
public class class_name {
private void recordTokenString(Vector targetStrings)
{
int tokPos = getTokenQueuePosFromMap(m_patternMapSize - 1);
resetTokenMark(tokPos + 1);
if (m_processor.lookahead('(', 1))
{
int tok = getKeywordToken(m_processor.m_token);
switch (tok)
{
case OpCodes.NODETYPE_COMMENT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_COMMENT);
break;
case OpCodes.NODETYPE_TEXT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_TEXT);
break;
case OpCodes.NODETYPE_NODE :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
break;
case OpCodes.NODETYPE_ROOT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ROOT);
break;
case OpCodes.NODETYPE_ANYELEMENT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
break;
case OpCodes.NODETYPE_PI :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
break;
default :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
}
}
else
{
if (m_processor.tokenIs('@'))
{
tokPos++;
resetTokenMark(tokPos + 1);
}
if (m_processor.lookahead(':', 1))
{
tokPos += 2;
}
targetStrings.addElement(m_compiler.getTokenQueue().elementAt(tokPos));
}
} } | public class class_name {
private void recordTokenString(Vector targetStrings)
{
int tokPos = getTokenQueuePosFromMap(m_patternMapSize - 1);
resetTokenMark(tokPos + 1);
if (m_processor.lookahead('(', 1))
{
int tok = getKeywordToken(m_processor.m_token);
switch (tok)
{
case OpCodes.NODETYPE_COMMENT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_COMMENT);
break;
case OpCodes.NODETYPE_TEXT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_TEXT);
break;
case OpCodes.NODETYPE_NODE :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
break;
case OpCodes.NODETYPE_ROOT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ROOT);
break;
case OpCodes.NODETYPE_ANYELEMENT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
break;
case OpCodes.NODETYPE_PI :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
break;
default :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
}
}
else
{
if (m_processor.tokenIs('@'))
{
tokPos++; // depends on control dependency: [if], data = [none]
resetTokenMark(tokPos + 1); // depends on control dependency: [if], data = [none]
}
if (m_processor.lookahead(':', 1))
{
tokPos += 2; // depends on control dependency: [if], data = [none]
}
targetStrings.addElement(m_compiler.getTokenQueue().elementAt(tokPos)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static BigInteger bigForString(String str, int sigchars)
{
assert str.length() <= sigchars;
BigInteger big = BigInteger.ZERO;
for (int i = 0; i < str.length(); i++)
{
int charpos = 16 * (sigchars - (i + 1));
BigInteger charbig = BigInteger.valueOf(str.charAt(i) & 0xFFFF);
big = big.or(charbig.shiftLeft(charpos));
}
return big;
} } | public class class_name {
private static BigInteger bigForString(String str, int sigchars)
{
assert str.length() <= sigchars;
BigInteger big = BigInteger.ZERO;
for (int i = 0; i < str.length(); i++)
{
int charpos = 16 * (sigchars - (i + 1));
BigInteger charbig = BigInteger.valueOf(str.charAt(i) & 0xFFFF);
big = big.or(charbig.shiftLeft(charpos)); // depends on control dependency: [for], data = [none]
}
return big;
} } |
public class class_name {
public static List<Tuple2<Se3_F64,Vector3D_F64>> decomposeHomography( DMatrixRMaj H ) {
DecomposeHomography d = new DecomposeHomography();
d.decompose(H);
List<Vector3D_F64> solutionsN = d.getSolutionsN();
List<Se3_F64> solutionsSe = d.getSolutionsSE();
List<Tuple2<Se3_F64,Vector3D_F64>> ret = new ArrayList<>();
for( int i = 0; i < 4; i++ ) {
ret.add(new Tuple2<>(solutionsSe.get(i), solutionsN.get(i)));
}
return ret;
} } | public class class_name {
public static List<Tuple2<Se3_F64,Vector3D_F64>> decomposeHomography( DMatrixRMaj H ) {
DecomposeHomography d = new DecomposeHomography();
d.decompose(H);
List<Vector3D_F64> solutionsN = d.getSolutionsN();
List<Se3_F64> solutionsSe = d.getSolutionsSE();
List<Tuple2<Se3_F64,Vector3D_F64>> ret = new ArrayList<>();
for( int i = 0; i < 4; i++ ) {
ret.add(new Tuple2<>(solutionsSe.get(i), solutionsN.get(i))); // depends on control dependency: [for], data = [i]
}
return ret;
} } |
public class class_name {
public static RealMatrix shuffleRows (RealMatrix matrix, RandomGenerator randomGenerator) {
// Create an index vector to be shuffled:
int[] index = MathArrays.sequence(matrix.getRowDimension(), 0, 1);
MathArrays.shuffle(index, randomGenerator);
// Create a new matrix:
RealMatrix retval = MatrixUtils.createRealMatrix(matrix.getRowDimension(), matrix.getColumnDimension());
// Populate:
for (int row = 0; row < index.length; row++) {
retval.setRowVector(row, matrix.getRowVector(index[row]));
}
// Done, return:
return retval;
} } | public class class_name {
public static RealMatrix shuffleRows (RealMatrix matrix, RandomGenerator randomGenerator) {
// Create an index vector to be shuffled:
int[] index = MathArrays.sequence(matrix.getRowDimension(), 0, 1);
MathArrays.shuffle(index, randomGenerator);
// Create a new matrix:
RealMatrix retval = MatrixUtils.createRealMatrix(matrix.getRowDimension(), matrix.getColumnDimension());
// Populate:
for (int row = 0; row < index.length; row++) {
retval.setRowVector(row, matrix.getRowVector(index[row])); // depends on control dependency: [for], data = [row]
}
// Done, return:
return retval;
} } |
public class class_name {
private void addPostParams(final Request request) {
if (reservationStatus != null) {
request.addPostParam("ReservationStatus", reservationStatus.toString());
}
if (workerActivitySid != null) {
request.addPostParam("WorkerActivitySid", workerActivitySid);
}
if (instruction != null) {
request.addPostParam("Instruction", instruction);
}
if (dequeuePostWorkActivitySid != null) {
request.addPostParam("DequeuePostWorkActivitySid", dequeuePostWorkActivitySid);
}
if (dequeueFrom != null) {
request.addPostParam("DequeueFrom", dequeueFrom);
}
if (dequeueRecord != null) {
request.addPostParam("DequeueRecord", dequeueRecord);
}
if (dequeueTimeout != null) {
request.addPostParam("DequeueTimeout", dequeueTimeout.toString());
}
if (dequeueTo != null) {
request.addPostParam("DequeueTo", dequeueTo);
}
if (dequeueStatusCallbackUrl != null) {
request.addPostParam("DequeueStatusCallbackUrl", dequeueStatusCallbackUrl.toString());
}
if (callFrom != null) {
request.addPostParam("CallFrom", callFrom);
}
if (callRecord != null) {
request.addPostParam("CallRecord", callRecord);
}
if (callTimeout != null) {
request.addPostParam("CallTimeout", callTimeout.toString());
}
if (callTo != null) {
request.addPostParam("CallTo", callTo);
}
if (callUrl != null) {
request.addPostParam("CallUrl", callUrl.toString());
}
if (callStatusCallbackUrl != null) {
request.addPostParam("CallStatusCallbackUrl", callStatusCallbackUrl.toString());
}
if (callAccept != null) {
request.addPostParam("CallAccept", callAccept.toString());
}
if (redirectCallSid != null) {
request.addPostParam("RedirectCallSid", redirectCallSid);
}
if (redirectAccept != null) {
request.addPostParam("RedirectAccept", redirectAccept.toString());
}
if (redirectUrl != null) {
request.addPostParam("RedirectUrl", redirectUrl.toString());
}
if (to != null) {
request.addPostParam("To", to);
}
if (from != null) {
request.addPostParam("From", from);
}
if (statusCallback != null) {
request.addPostParam("StatusCallback", statusCallback.toString());
}
if (statusCallbackMethod != null) {
request.addPostParam("StatusCallbackMethod", statusCallbackMethod.toString());
}
if (statusCallbackEvent != null) {
for (Reservation.CallStatus prop : statusCallbackEvent) {
request.addPostParam("StatusCallbackEvent", prop.toString());
}
}
if (timeout != null) {
request.addPostParam("Timeout", timeout.toString());
}
if (record != null) {
request.addPostParam("Record", record.toString());
}
if (muted != null) {
request.addPostParam("Muted", muted.toString());
}
if (beep != null) {
request.addPostParam("Beep", beep);
}
if (startConferenceOnEnter != null) {
request.addPostParam("StartConferenceOnEnter", startConferenceOnEnter.toString());
}
if (endConferenceOnExit != null) {
request.addPostParam("EndConferenceOnExit", endConferenceOnExit.toString());
}
if (waitUrl != null) {
request.addPostParam("WaitUrl", waitUrl.toString());
}
if (waitMethod != null) {
request.addPostParam("WaitMethod", waitMethod.toString());
}
if (earlyMedia != null) {
request.addPostParam("EarlyMedia", earlyMedia.toString());
}
if (maxParticipants != null) {
request.addPostParam("MaxParticipants", maxParticipants.toString());
}
if (conferenceStatusCallback != null) {
request.addPostParam("ConferenceStatusCallback", conferenceStatusCallback.toString());
}
if (conferenceStatusCallbackMethod != null) {
request.addPostParam("ConferenceStatusCallbackMethod", conferenceStatusCallbackMethod.toString());
}
if (conferenceStatusCallbackEvent != null) {
for (Reservation.ConferenceEvent prop : conferenceStatusCallbackEvent) {
request.addPostParam("ConferenceStatusCallbackEvent", prop.toString());
}
}
if (conferenceRecord != null) {
request.addPostParam("ConferenceRecord", conferenceRecord);
}
if (conferenceTrim != null) {
request.addPostParam("ConferenceTrim", conferenceTrim);
}
if (recordingChannels != null) {
request.addPostParam("RecordingChannels", recordingChannels);
}
if (recordingStatusCallback != null) {
request.addPostParam("RecordingStatusCallback", recordingStatusCallback.toString());
}
if (recordingStatusCallbackMethod != null) {
request.addPostParam("RecordingStatusCallbackMethod", recordingStatusCallbackMethod.toString());
}
if (conferenceRecordingStatusCallback != null) {
request.addPostParam("ConferenceRecordingStatusCallback", conferenceRecordingStatusCallback.toString());
}
if (conferenceRecordingStatusCallbackMethod != null) {
request.addPostParam("ConferenceRecordingStatusCallbackMethod", conferenceRecordingStatusCallbackMethod.toString());
}
if (region != null) {
request.addPostParam("Region", region);
}
if (sipAuthUsername != null) {
request.addPostParam("SipAuthUsername", sipAuthUsername);
}
if (sipAuthPassword != null) {
request.addPostParam("SipAuthPassword", sipAuthPassword);
}
if (dequeueStatusCallbackEvent != null) {
for (String prop : dequeueStatusCallbackEvent) {
request.addPostParam("DequeueStatusCallbackEvent", prop);
}
}
if (postWorkActivitySid != null) {
request.addPostParam("PostWorkActivitySid", postWorkActivitySid);
}
if (supervisorMode != null) {
request.addPostParam("SupervisorMode", supervisorMode.toString());
}
if (supervisor != null) {
request.addPostParam("Supervisor", supervisor);
}
if (endConferenceOnCustomerExit != null) {
request.addPostParam("EndConferenceOnCustomerExit", endConferenceOnCustomerExit.toString());
}
if (beepOnCustomerEntrance != null) {
request.addPostParam("BeepOnCustomerEntrance", beepOnCustomerEntrance.toString());
}
} } | public class class_name {
private void addPostParams(final Request request) {
if (reservationStatus != null) {
request.addPostParam("ReservationStatus", reservationStatus.toString()); // depends on control dependency: [if], data = [none]
}
if (workerActivitySid != null) {
request.addPostParam("WorkerActivitySid", workerActivitySid); // depends on control dependency: [if], data = [none]
}
if (instruction != null) {
request.addPostParam("Instruction", instruction); // depends on control dependency: [if], data = [none]
}
if (dequeuePostWorkActivitySid != null) {
request.addPostParam("DequeuePostWorkActivitySid", dequeuePostWorkActivitySid); // depends on control dependency: [if], data = [none]
}
if (dequeueFrom != null) {
request.addPostParam("DequeueFrom", dequeueFrom); // depends on control dependency: [if], data = [none]
}
if (dequeueRecord != null) {
request.addPostParam("DequeueRecord", dequeueRecord); // depends on control dependency: [if], data = [none]
}
if (dequeueTimeout != null) {
request.addPostParam("DequeueTimeout", dequeueTimeout.toString()); // depends on control dependency: [if], data = [none]
}
if (dequeueTo != null) {
request.addPostParam("DequeueTo", dequeueTo); // depends on control dependency: [if], data = [none]
}
if (dequeueStatusCallbackUrl != null) {
request.addPostParam("DequeueStatusCallbackUrl", dequeueStatusCallbackUrl.toString()); // depends on control dependency: [if], data = [none]
}
if (callFrom != null) {
request.addPostParam("CallFrom", callFrom); // depends on control dependency: [if], data = [none]
}
if (callRecord != null) {
request.addPostParam("CallRecord", callRecord); // depends on control dependency: [if], data = [none]
}
if (callTimeout != null) {
request.addPostParam("CallTimeout", callTimeout.toString()); // depends on control dependency: [if], data = [none]
}
if (callTo != null) {
request.addPostParam("CallTo", callTo); // depends on control dependency: [if], data = [none]
}
if (callUrl != null) {
request.addPostParam("CallUrl", callUrl.toString()); // depends on control dependency: [if], data = [none]
}
if (callStatusCallbackUrl != null) {
request.addPostParam("CallStatusCallbackUrl", callStatusCallbackUrl.toString()); // depends on control dependency: [if], data = [none]
}
if (callAccept != null) {
request.addPostParam("CallAccept", callAccept.toString()); // depends on control dependency: [if], data = [none]
}
if (redirectCallSid != null) {
request.addPostParam("RedirectCallSid", redirectCallSid); // depends on control dependency: [if], data = [none]
}
if (redirectAccept != null) {
request.addPostParam("RedirectAccept", redirectAccept.toString()); // depends on control dependency: [if], data = [none]
}
if (redirectUrl != null) {
request.addPostParam("RedirectUrl", redirectUrl.toString()); // depends on control dependency: [if], data = [none]
}
if (to != null) {
request.addPostParam("To", to); // depends on control dependency: [if], data = [none]
}
if (from != null) {
request.addPostParam("From", from); // depends on control dependency: [if], data = [none]
}
if (statusCallback != null) {
request.addPostParam("StatusCallback", statusCallback.toString()); // depends on control dependency: [if], data = [none]
}
if (statusCallbackMethod != null) {
request.addPostParam("StatusCallbackMethod", statusCallbackMethod.toString()); // depends on control dependency: [if], data = [none]
}
if (statusCallbackEvent != null) {
for (Reservation.CallStatus prop : statusCallbackEvent) {
request.addPostParam("StatusCallbackEvent", prop.toString()); // depends on control dependency: [for], data = [prop]
}
}
if (timeout != null) {
request.addPostParam("Timeout", timeout.toString()); // depends on control dependency: [if], data = [none]
}
if (record != null) {
request.addPostParam("Record", record.toString()); // depends on control dependency: [if], data = [none]
}
if (muted != null) {
request.addPostParam("Muted", muted.toString()); // depends on control dependency: [if], data = [none]
}
if (beep != null) {
request.addPostParam("Beep", beep); // depends on control dependency: [if], data = [none]
}
if (startConferenceOnEnter != null) {
request.addPostParam("StartConferenceOnEnter", startConferenceOnEnter.toString()); // depends on control dependency: [if], data = [none]
}
if (endConferenceOnExit != null) {
request.addPostParam("EndConferenceOnExit", endConferenceOnExit.toString()); // depends on control dependency: [if], data = [none]
}
if (waitUrl != null) {
request.addPostParam("WaitUrl", waitUrl.toString()); // depends on control dependency: [if], data = [none]
}
if (waitMethod != null) {
request.addPostParam("WaitMethod", waitMethod.toString()); // depends on control dependency: [if], data = [none]
}
if (earlyMedia != null) {
request.addPostParam("EarlyMedia", earlyMedia.toString()); // depends on control dependency: [if], data = [none]
}
if (maxParticipants != null) {
request.addPostParam("MaxParticipants", maxParticipants.toString()); // depends on control dependency: [if], data = [none]
}
if (conferenceStatusCallback != null) {
request.addPostParam("ConferenceStatusCallback", conferenceStatusCallback.toString()); // depends on control dependency: [if], data = [none]
}
if (conferenceStatusCallbackMethod != null) {
request.addPostParam("ConferenceStatusCallbackMethod", conferenceStatusCallbackMethod.toString()); // depends on control dependency: [if], data = [none]
}
if (conferenceStatusCallbackEvent != null) {
for (Reservation.ConferenceEvent prop : conferenceStatusCallbackEvent) {
request.addPostParam("ConferenceStatusCallbackEvent", prop.toString()); // depends on control dependency: [for], data = [prop]
}
}
if (conferenceRecord != null) {
request.addPostParam("ConferenceRecord", conferenceRecord); // depends on control dependency: [if], data = [none]
}
if (conferenceTrim != null) {
request.addPostParam("ConferenceTrim", conferenceTrim); // depends on control dependency: [if], data = [none]
}
if (recordingChannels != null) {
request.addPostParam("RecordingChannels", recordingChannels); // depends on control dependency: [if], data = [none]
}
if (recordingStatusCallback != null) {
request.addPostParam("RecordingStatusCallback", recordingStatusCallback.toString()); // depends on control dependency: [if], data = [none]
}
if (recordingStatusCallbackMethod != null) {
request.addPostParam("RecordingStatusCallbackMethod", recordingStatusCallbackMethod.toString()); // depends on control dependency: [if], data = [none]
}
if (conferenceRecordingStatusCallback != null) {
request.addPostParam("ConferenceRecordingStatusCallback", conferenceRecordingStatusCallback.toString()); // depends on control dependency: [if], data = [none]
}
if (conferenceRecordingStatusCallbackMethod != null) {
request.addPostParam("ConferenceRecordingStatusCallbackMethod", conferenceRecordingStatusCallbackMethod.toString()); // depends on control dependency: [if], data = [none]
}
if (region != null) {
request.addPostParam("Region", region); // depends on control dependency: [if], data = [none]
}
if (sipAuthUsername != null) {
request.addPostParam("SipAuthUsername", sipAuthUsername); // depends on control dependency: [if], data = [none]
}
if (sipAuthPassword != null) {
request.addPostParam("SipAuthPassword", sipAuthPassword); // depends on control dependency: [if], data = [none]
}
if (dequeueStatusCallbackEvent != null) {
for (String prop : dequeueStatusCallbackEvent) {
request.addPostParam("DequeueStatusCallbackEvent", prop); // depends on control dependency: [for], data = [prop]
}
}
if (postWorkActivitySid != null) {
request.addPostParam("PostWorkActivitySid", postWorkActivitySid); // depends on control dependency: [if], data = [none]
}
if (supervisorMode != null) {
request.addPostParam("SupervisorMode", supervisorMode.toString()); // depends on control dependency: [if], data = [none]
}
if (supervisor != null) {
request.addPostParam("Supervisor", supervisor); // depends on control dependency: [if], data = [none]
}
if (endConferenceOnCustomerExit != null) {
request.addPostParam("EndConferenceOnCustomerExit", endConferenceOnCustomerExit.toString()); // depends on control dependency: [if], data = [none]
}
if (beepOnCustomerEntrance != null) {
request.addPostParam("BeepOnCustomerEntrance", beepOnCustomerEntrance.toString()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getValue() {
String value = null;
if (fixedValue != null) {
value = fixedValue;
} else if (currentValue != null) {
value = currentValue;
} else if (constraint != null) {
value = constraint.initValues(null);
}
if (value == null) {
value = "";
}
return configuration.processPropertyValue(value);
} } | public class class_name {
public String getValue() {
String value = null;
if (fixedValue != null) {
value = fixedValue;
// depends on control dependency: [if], data = [none]
} else if (currentValue != null) {
value = currentValue;
// depends on control dependency: [if], data = [none]
} else if (constraint != null) {
value = constraint.initValues(null);
// depends on control dependency: [if], data = [null)]
}
if (value == null) {
value = "";
// depends on control dependency: [if], data = [none]
}
return configuration.processPropertyValue(value);
} } |
public class class_name {
static private StringBuilder serializeChannel(StringBuilder buffer, OutboundChannelDefinition ocd, int order) throws NotSerializableException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Serializing channel: " + order + " " + ocd.getOutboundFactory().getName());
}
buffer.append(" <channel order=\"");
buffer.append(order);
buffer.append("\" factory=\"");
buffer.append(ocd.getOutboundFactory().getName());
buffer.append("\">\n");
Map<Object, Object> props = ocd.getOutboundChannelProperties();
if (null != props) {
for (Entry<Object, Object> entry : props.entrySet()) {
if (null == entry.getValue()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property value [" + entry.getKey() + "] is null, " + ocd.toString());
}
throw new NotSerializableException("Property value for [" + entry.getKey() + "] is null");
}
// TODO should pass around the one big stringbuffer instead
// of creating all these intermediate ones
StringBuilder kBuff = determineType("key", entry.getKey());
if (null != kBuff) {
StringBuilder vBuff = determineType("value", entry.getValue());
if (null != vBuff) {
buffer.append(" <property ");
buffer.append(kBuff);
buffer.append(" ");
buffer.append(vBuff);
buffer.append("/>\n");
}
}
}
}
buffer.append(" </channel>\n");
return buffer;
} } | public class class_name {
static private StringBuilder serializeChannel(StringBuilder buffer, OutboundChannelDefinition ocd, int order) throws NotSerializableException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Serializing channel: " + order + " " + ocd.getOutboundFactory().getName());
}
buffer.append(" <channel order=\"");
buffer.append(order);
buffer.append("\" factory=\"");
buffer.append(ocd.getOutboundFactory().getName());
buffer.append("\">\n");
Map<Object, Object> props = ocd.getOutboundChannelProperties();
if (null != props) {
for (Entry<Object, Object> entry : props.entrySet()) {
if (null == entry.getValue()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property value [" + entry.getKey() + "] is null, " + ocd.toString()); // depends on control dependency: [if], data = [none]
}
throw new NotSerializableException("Property value for [" + entry.getKey() + "] is null");
}
// TODO should pass around the one big stringbuffer instead
// of creating all these intermediate ones
StringBuilder kBuff = determineType("key", entry.getKey());
if (null != kBuff) {
StringBuilder vBuff = determineType("value", entry.getValue());
if (null != vBuff) {
buffer.append(" <property "); // depends on control dependency: [if], data = [none]
buffer.append(kBuff); // depends on control dependency: [if], data = [none]
buffer.append(" "); // depends on control dependency: [if], data = [none]
buffer.append(vBuff); // depends on control dependency: [if], data = [vBuff)]
buffer.append("/>\n"); // depends on control dependency: [if], data = [none]
}
}
}
}
buffer.append(" </channel>\n");
return buffer;
} } |
public class class_name {
public Date getNextInvalidTimeAfter(final Date date) {
long difference = 999;
//move back to the nearest second so differences will be accurate
final Calendar adjustCal = Calendar.getInstance(getTimeZone());
adjustCal.setTime(date);
adjustCal.set(Calendar.MILLISECOND, 0);
Date lastDate = adjustCal.getTime();
Date newDate;
//FUTURE_TODO: (QUARTZ-481) IMPROVE THIS! The following is a BAD solution to this problem. Performance will be very bad here, depending on the cron expression. It is, however A solution.
//keep getting the next included time until it's farther than one second
// apart. At that point, lastDate is the last valid fire time. We return
// the second immediately following it.
while (difference == 999) {
newDate = getTimeAfter(lastDate);
if (newDate == null)
break;
difference = newDate.getTime() - lastDate.getTime();
if (difference == 999) {
lastDate = newDate;
}
}
return new Date(
lastDate.getTime() + 1000);
} } | public class class_name {
public Date getNextInvalidTimeAfter(final Date date) {
long difference = 999;
//move back to the nearest second so differences will be accurate
final Calendar adjustCal = Calendar.getInstance(getTimeZone());
adjustCal.setTime(date);
adjustCal.set(Calendar.MILLISECOND, 0);
Date lastDate = adjustCal.getTime();
Date newDate;
//FUTURE_TODO: (QUARTZ-481) IMPROVE THIS! The following is a BAD solution to this problem. Performance will be very bad here, depending on the cron expression. It is, however A solution.
//keep getting the next included time until it's farther than one second
// apart. At that point, lastDate is the last valid fire time. We return
// the second immediately following it.
while (difference == 999) {
newDate = getTimeAfter(lastDate); // depends on control dependency: [while], data = [none]
if (newDate == null)
break;
difference = newDate.getTime() - lastDate.getTime(); // depends on control dependency: [while], data = [none]
if (difference == 999) {
lastDate = newDate; // depends on control dependency: [if], data = [none]
}
}
return new Date(
lastDate.getTime() + 1000);
} } |
public class class_name {
public E poll() {
lock.lock();
try {
if (open) {
if (elements.size() > 0) {
return elements.removeFirst();
} else {
return null;
}
} else {
throw new IllegalStateException("queue is closed");
}
} finally {
lock.unlock();
}
} } | public class class_name {
public E poll() {
lock.lock();
try {
if (open) {
if (elements.size() > 0) {
return elements.removeFirst(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} else {
throw new IllegalStateException("queue is closed");
}
} finally {
lock.unlock();
}
} } |
public class class_name {
private void init(Context context, AttributeSet attrs, int defStyle) {
// Initialize paint objects
paint = new Paint();
paint.setAntiAlias(true);
paintBorder = new Paint();
paintBorder.setAntiAlias(true);
paintBorder.setStyle(Paint.Style.STROKE);
paintSelectorBorder = new Paint();
paintSelectorBorder.setAntiAlias(true);
// Enable software rendering on HoneyComb and up. (needed for shadow)
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
setLayerType(LAYER_TYPE_SOFTWARE, null);
// Load the styled attributes and set their properties
TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.CircularImageView, defStyle, 0);
// Check for extra features being enabled
hasBorder = attributes.getBoolean(R.styleable.CircularImageView_civ_border, false);
hasSelector = attributes.getBoolean(R.styleable.CircularImageView_civ_selector, false);
shadowEnabled = attributes.getBoolean(R.styleable.CircularImageView_civ_shadow, SHADOW_ENABLED);
// Set border properties, if enabled
if(hasBorder) {
int defaultBorderSize = (int) (2 * context.getResources().getDisplayMetrics().density + 0.5f);
setBorderWidth(attributes.getDimensionPixelOffset(R.styleable.CircularImageView_civ_borderWidth, defaultBorderSize));
setBorderColor(attributes.getColor(R.styleable.CircularImageView_civ_borderColor, Color.WHITE));
}
// Set selector properties, if enabled
if(hasSelector) {
int defaultSelectorSize = (int) (2 * context.getResources().getDisplayMetrics().density + 0.5f);
setSelectorColor(attributes.getColor(R.styleable.CircularImageView_civ_selectorColor, Color.TRANSPARENT));
setSelectorStrokeWidth(attributes.getDimensionPixelOffset(R.styleable.CircularImageView_civ_selectorStrokeWidth, defaultSelectorSize));
setSelectorStrokeColor(attributes.getColor(R.styleable.CircularImageView_civ_selectorStrokeColor, Color.BLUE));
}
// Set shadow properties, if enabled
if(shadowEnabled) {
shadowRadius = attributes.getFloat(R.styleable.CircularImageView_civ_shadowRadius, SHADOW_RADIUS);
shadowDx = attributes.getFloat(R.styleable.CircularImageView_civ_shadowDx, SHADOW_DX);
shadowDy = attributes.getFloat(R.styleable.CircularImageView_civ_shadowDy, SHADOW_DY);
shadowColor = attributes.getColor(R.styleable.CircularImageView_civ_shadowColor, SHADOW_COLOR);
setShadowEnabled(true);
}
// We no longer need our attributes TypedArray, give it back to cache
attributes.recycle();
} } | public class class_name {
private void init(Context context, AttributeSet attrs, int defStyle) {
// Initialize paint objects
paint = new Paint();
paint.setAntiAlias(true);
paintBorder = new Paint();
paintBorder.setAntiAlias(true);
paintBorder.setStyle(Paint.Style.STROKE);
paintSelectorBorder = new Paint();
paintSelectorBorder.setAntiAlias(true);
// Enable software rendering on HoneyComb and up. (needed for shadow)
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
setLayerType(LAYER_TYPE_SOFTWARE, null);
// Load the styled attributes and set their properties
TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.CircularImageView, defStyle, 0);
// Check for extra features being enabled
hasBorder = attributes.getBoolean(R.styleable.CircularImageView_civ_border, false);
hasSelector = attributes.getBoolean(R.styleable.CircularImageView_civ_selector, false);
shadowEnabled = attributes.getBoolean(R.styleable.CircularImageView_civ_shadow, SHADOW_ENABLED);
// Set border properties, if enabled
if(hasBorder) {
int defaultBorderSize = (int) (2 * context.getResources().getDisplayMetrics().density + 0.5f);
setBorderWidth(attributes.getDimensionPixelOffset(R.styleable.CircularImageView_civ_borderWidth, defaultBorderSize)); // depends on control dependency: [if], data = [none]
setBorderColor(attributes.getColor(R.styleable.CircularImageView_civ_borderColor, Color.WHITE)); // depends on control dependency: [if], data = [none]
}
// Set selector properties, if enabled
if(hasSelector) {
int defaultSelectorSize = (int) (2 * context.getResources().getDisplayMetrics().density + 0.5f);
setSelectorColor(attributes.getColor(R.styleable.CircularImageView_civ_selectorColor, Color.TRANSPARENT)); // depends on control dependency: [if], data = [none]
setSelectorStrokeWidth(attributes.getDimensionPixelOffset(R.styleable.CircularImageView_civ_selectorStrokeWidth, defaultSelectorSize)); // depends on control dependency: [if], data = [none]
setSelectorStrokeColor(attributes.getColor(R.styleable.CircularImageView_civ_selectorStrokeColor, Color.BLUE)); // depends on control dependency: [if], data = [none]
}
// Set shadow properties, if enabled
if(shadowEnabled) {
shadowRadius = attributes.getFloat(R.styleable.CircularImageView_civ_shadowRadius, SHADOW_RADIUS); // depends on control dependency: [if], data = [none]
shadowDx = attributes.getFloat(R.styleable.CircularImageView_civ_shadowDx, SHADOW_DX); // depends on control dependency: [if], data = [none]
shadowDy = attributes.getFloat(R.styleable.CircularImageView_civ_shadowDy, SHADOW_DY); // depends on control dependency: [if], data = [none]
shadowColor = attributes.getColor(R.styleable.CircularImageView_civ_shadowColor, SHADOW_COLOR); // depends on control dependency: [if], data = [none]
setShadowEnabled(true); // depends on control dependency: [if], data = [none]
}
// We no longer need our attributes TypedArray, give it back to cache
attributes.recycle();
} } |
public class class_name {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (position == super.getCount() && isEnableRefreshing()) {
return (mFooter);
}
return (super.getView(position, convertView, parent));
} } | public class class_name {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (position == super.getCount() && isEnableRefreshing()) {
return (mFooter); // depends on control dependency: [if], data = [none]
}
return (super.getView(position, convertView, parent));
} } |
public class class_name {
protected void processStop(Endpoint endpoint, EventTypeEnum eventType) {
if (!sendLifecycleEvent) {
return;
}
Event event = createEvent(endpoint, eventType);
monitoringServiceClient.putEvents(Collections.singletonList(event));
if (LOG.isLoggable(Level.INFO)) {
LOG.info("Send " + eventType + " event to SAM Server successful!");
}
} } | public class class_name {
protected void processStop(Endpoint endpoint, EventTypeEnum eventType) {
if (!sendLifecycleEvent) {
return; // depends on control dependency: [if], data = [none]
}
Event event = createEvent(endpoint, eventType);
monitoringServiceClient.putEvents(Collections.singletonList(event));
if (LOG.isLoggable(Level.INFO)) {
LOG.info("Send " + eventType + " event to SAM Server successful!"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean recordReturnType(JSTypeExpression jsType) {
if (jsType != null && currentInfo.getReturnType() == null
&& !hasAnySingletonTypeTags()) {
currentInfo.setReturnType(jsType);
populated = true;
return true;
} else {
return false;
}
} } | public class class_name {
public boolean recordReturnType(JSTypeExpression jsType) {
if (jsType != null && currentInfo.getReturnType() == null
&& !hasAnySingletonTypeTags()) {
currentInfo.setReturnType(jsType); // depends on control dependency: [if], data = [(jsType]
populated = true; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void parse(final String... parameters) {
if (parameters.length >= 1) {
pathProperty().set(parameters[0]);
}
if (parameters.length >= 2) {
nameProperty().set(parameters[1]);
}
if (parameters.length == 3) {
skipStylesFolderProperty().set(readBoolean(parameters[2]));
}
} } | public class class_name {
@Override
public void parse(final String... parameters) {
if (parameters.length >= 1) {
pathProperty().set(parameters[0]);
// depends on control dependency: [if], data = [none]
}
if (parameters.length >= 2) {
nameProperty().set(parameters[1]);
// depends on control dependency: [if], data = [none]
}
if (parameters.length == 3) {
skipStylesFolderProperty().set(readBoolean(parameters[2]));
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ListResourceDefinitionsResult withDefinitions(DefinitionInformation... definitions) {
if (this.definitions == null) {
setDefinitions(new java.util.ArrayList<DefinitionInformation>(definitions.length));
}
for (DefinitionInformation ele : definitions) {
this.definitions.add(ele);
}
return this;
} } | public class class_name {
public ListResourceDefinitionsResult withDefinitions(DefinitionInformation... definitions) {
if (this.definitions == null) {
setDefinitions(new java.util.ArrayList<DefinitionInformation>(definitions.length)); // depends on control dependency: [if], data = [none]
}
for (DefinitionInformation ele : definitions) {
this.definitions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static boolean isNullOrWhiteSpace(String arg) {
if (Strings.isNullOrEmpty(arg) || arg.trim().isEmpty()) {
return true;
}
return false;
} } | public class class_name {
public static boolean isNullOrWhiteSpace(String arg) {
if (Strings.isNullOrEmpty(arg) || arg.trim().isEmpty()) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
protected void addLabel(ResponseWriter rw, String clientId, SelectOneMenu menu, String outerClientId)
throws IOException {
String label = menu.getLabel();
{
if (!menu.isRenderLabel()) {
label = null;
}
}
if (label != null) {
rw.startElement("label", menu);
rw.writeAttribute("for", clientId, "for");
generateErrorAndRequiredClass(menu, rw, outerClientId, menu.getLabelStyleClass(),
Responsive.getResponsiveLabelClass(menu), "control-label");
writeAttribute(rw, "style", menu.getLabelStyle());
rw.writeText(label, null);
rw.endElement("label");
}
} } | public class class_name {
protected void addLabel(ResponseWriter rw, String clientId, SelectOneMenu menu, String outerClientId)
throws IOException {
String label = menu.getLabel();
{
if (!menu.isRenderLabel()) {
label = null; // depends on control dependency: [if], data = [none]
}
}
if (label != null) {
rw.startElement("label", menu);
rw.writeAttribute("for", clientId, "for");
generateErrorAndRequiredClass(menu, rw, outerClientId, menu.getLabelStyleClass(),
Responsive.getResponsiveLabelClass(menu), "control-label");
writeAttribute(rw, "style", menu.getLabelStyle());
rw.writeText(label, null);
rw.endElement("label");
}
} } |
public class class_name {
public boolean isEmpty(short sessionId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isEmpty", ""+sessionId);
boolean queueEmpty = false;
synchronized (this)
{
synchronized(queue)
{
queueEmpty = queue.isEmpty();
if (!queueEmpty)
{
//System.out.println(" isEmpty(): Got has data on");
// The queue is not empty. Make sure there is a complete message available
QueueData data = queue.getLast();
//System.out.println(" isEmpty(): First item: " + data);
// If the data is not complete, the queue is still regarded as empty
queueEmpty = !data.isComplete();
//System.out.println(" ** isEmpty(): " + queueEmpty);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isEmpty", ""+queueEmpty);
return queueEmpty;
} } | public class class_name {
public boolean isEmpty(short sessionId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isEmpty", ""+sessionId);
boolean queueEmpty = false;
synchronized (this)
{
synchronized(queue)
{
queueEmpty = queue.isEmpty();
if (!queueEmpty)
{
//System.out.println(" isEmpty(): Got has data on");
// The queue is not empty. Make sure there is a complete message available
QueueData data = queue.getLast();
//System.out.println(" isEmpty(): First item: " + data);
// If the data is not complete, the queue is still regarded as empty
queueEmpty = !data.isComplete(); // depends on control dependency: [if], data = [none]
//System.out.println(" ** isEmpty(): " + queueEmpty);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isEmpty", ""+queueEmpty);
return queueEmpty;
} } |
public class class_name {
public static Set<String> getUsers()
{
final Set<String> ret = new HashSet<>();
for (final UserSession userSession : RegistryManager.getCache().values()) {
ret.add(userSession.getUserName());
}
return ret;
} } | public class class_name {
public static Set<String> getUsers()
{
final Set<String> ret = new HashSet<>();
for (final UserSession userSession : RegistryManager.getCache().values()) {
ret.add(userSession.getUserName()); // depends on control dependency: [for], data = [userSession]
}
return ret;
} } |
public class class_name {
public void addEntry(CatalogEntry entry) {
int type = entry.getEntryType();
if (type == BASE) {
String value = entry.getEntryArg(0);
URL newbase = null;
catalogManager.debug.message(5, "BASE CUR", base.toString());
catalogManager.debug.message(4, "BASE STR", value);
try {
value = fixSlashes(value);
newbase = new URL(base, value);
} catch (MalformedURLException e) {
try {
newbase = new URL("file:" + value);
} catch (MalformedURLException e2) {
catalogManager.debug.message(1, "Malformed URL on base", value);
newbase = null;
}
}
if (newbase != null) {
base = newbase;
}
catalogManager.debug.message(5, "BASE NEW", base.toString());
} else if (type == CATALOG) {
String fsi = makeAbsolute(entry.getEntryArg(0));
catalogManager.debug.message(4, "CATALOG", fsi);
localCatalogFiles.addElement(fsi);
} else if (type == PUBLIC) {
String publicid = PublicId.normalize(entry.getEntryArg(0));
String systemid = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(0, publicid);
entry.setEntryArg(1, systemid);
catalogManager.debug.message(4, "PUBLIC", publicid, systemid);
catalogEntries.addElement(entry);
} else if (type == SYSTEM) {
String systemid = normalizeURI(entry.getEntryArg(0));
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi);
catalogManager.debug.message(4, "SYSTEM", systemid, fsi);
catalogEntries.addElement(entry);
} else if (type == URI) {
String uri = normalizeURI(entry.getEntryArg(0));
String altURI = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, altURI);
catalogManager.debug.message(4, "URI", uri, altURI);
catalogEntries.addElement(entry);
} else if (type == DOCUMENT) {
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0)));
entry.setEntryArg(0, fsi);
catalogManager.debug.message(4, "DOCUMENT", fsi);
catalogEntries.addElement(entry);
} else if (type == OVERRIDE) {
catalogManager.debug.message(4, "OVERRIDE", entry.getEntryArg(0));
catalogEntries.addElement(entry);
} else if (type == SGMLDECL) {
// meaningless in XML
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0)));
entry.setEntryArg(0, fsi);
catalogManager.debug.message(4, "SGMLDECL", fsi);
catalogEntries.addElement(entry);
} else if (type == DELEGATE_PUBLIC) {
String ppi = PublicId.normalize(entry.getEntryArg(0));
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(0, ppi);
entry.setEntryArg(1, fsi);
catalogManager.debug.message(4, "DELEGATE_PUBLIC", ppi, fsi);
addDelegate(entry);
} else if (type == DELEGATE_SYSTEM) {
String psi = normalizeURI(entry.getEntryArg(0));
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(0, psi);
entry.setEntryArg(1, fsi);
catalogManager.debug.message(4, "DELEGATE_SYSTEM", psi, fsi);
addDelegate(entry);
} else if (type == DELEGATE_URI) {
String pui = normalizeURI(entry.getEntryArg(0));
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(0, pui);
entry.setEntryArg(1, fsi);
catalogManager.debug.message(4, "DELEGATE_URI", pui, fsi);
addDelegate(entry);
} else if (type == REWRITE_SYSTEM) {
String psi = normalizeURI(entry.getEntryArg(0));
String rpx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(0, psi);
entry.setEntryArg(1, rpx);
catalogManager.debug.message(4, "REWRITE_SYSTEM", psi, rpx);
catalogEntries.addElement(entry);
} else if (type == REWRITE_URI) {
String pui = normalizeURI(entry.getEntryArg(0));
String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(0, pui);
entry.setEntryArg(1, upx);
catalogManager.debug.message(4, "REWRITE_URI", pui, upx);
catalogEntries.addElement(entry);
} else if (type == DOCTYPE) {
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi);
catalogManager.debug.message(4, "DOCTYPE", entry.getEntryArg(0), fsi);
catalogEntries.addElement(entry);
} else if (type == DTDDECL) {
// meaningless in XML
String fpi = PublicId.normalize(entry.getEntryArg(0));
entry.setEntryArg(0, fpi);
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi);
catalogManager.debug.message(4, "DTDDECL", fpi, fsi);
catalogEntries.addElement(entry);
} else if (type == ENTITY) {
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi);
catalogManager.debug.message(4, "ENTITY", entry.getEntryArg(0), fsi);
catalogEntries.addElement(entry);
} else if (type == LINKTYPE) {
// meaningless in XML
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi);
catalogManager.debug.message(4, "LINKTYPE", entry.getEntryArg(0), fsi);
catalogEntries.addElement(entry);
} else if (type == NOTATION) {
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi);
catalogManager.debug.message(4, "NOTATION", entry.getEntryArg(0), fsi);
catalogEntries.addElement(entry);
} else {
catalogEntries.addElement(entry);
}
} } | public class class_name {
public void addEntry(CatalogEntry entry) {
int type = entry.getEntryType();
if (type == BASE) {
String value = entry.getEntryArg(0);
URL newbase = null;
catalogManager.debug.message(5, "BASE CUR", base.toString()); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "BASE STR", value); // depends on control dependency: [if], data = [none]
try {
value = fixSlashes(value); // depends on control dependency: [try], data = [none]
newbase = new URL(base, value); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
try {
newbase = new URL("file:" + value); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e2) {
catalogManager.debug.message(1, "Malformed URL on base", value);
newbase = null;
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
if (newbase != null) {
base = newbase; // depends on control dependency: [if], data = [none]
}
catalogManager.debug.message(5, "BASE NEW", base.toString()); // depends on control dependency: [if], data = [none]
} else if (type == CATALOG) {
String fsi = makeAbsolute(entry.getEntryArg(0));
catalogManager.debug.message(4, "CATALOG", fsi); // depends on control dependency: [if], data = [none]
localCatalogFiles.addElement(fsi); // depends on control dependency: [if], data = [none]
} else if (type == PUBLIC) {
String publicid = PublicId.normalize(entry.getEntryArg(0));
String systemid = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(0, publicid); // depends on control dependency: [if], data = [none]
entry.setEntryArg(1, systemid); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "PUBLIC", publicid, systemid); // depends on control dependency: [if], data = [none]
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
} else if (type == SYSTEM) {
String systemid = normalizeURI(entry.getEntryArg(0));
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "SYSTEM", systemid, fsi); // depends on control dependency: [if], data = [none]
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
} else if (type == URI) {
String uri = normalizeURI(entry.getEntryArg(0));
String altURI = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, altURI); // depends on control dependency: [if], data = [URI)]
catalogManager.debug.message(4, "URI", uri, altURI); // depends on control dependency: [if], data = [URI)]
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
} else if (type == DOCUMENT) {
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0)));
entry.setEntryArg(0, fsi); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "DOCUMENT", fsi); // depends on control dependency: [if], data = [none]
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
} else if (type == OVERRIDE) {
catalogManager.debug.message(4, "OVERRIDE", entry.getEntryArg(0)); // depends on control dependency: [if], data = [none]
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
} else if (type == SGMLDECL) {
// meaningless in XML
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(0)));
entry.setEntryArg(0, fsi); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "SGMLDECL", fsi); // depends on control dependency: [if], data = [none]
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
} else if (type == DELEGATE_PUBLIC) {
String ppi = PublicId.normalize(entry.getEntryArg(0));
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(0, ppi); // depends on control dependency: [if], data = [none]
entry.setEntryArg(1, fsi); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "DELEGATE_PUBLIC", ppi, fsi); // depends on control dependency: [if], data = [none]
addDelegate(entry); // depends on control dependency: [if], data = [none]
} else if (type == DELEGATE_SYSTEM) {
String psi = normalizeURI(entry.getEntryArg(0));
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(0, psi); // depends on control dependency: [if], data = [none]
entry.setEntryArg(1, fsi); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "DELEGATE_SYSTEM", psi, fsi); // depends on control dependency: [if], data = [none]
addDelegate(entry); // depends on control dependency: [if], data = [none]
} else if (type == DELEGATE_URI) {
String pui = normalizeURI(entry.getEntryArg(0));
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(0, pui); // depends on control dependency: [if], data = [none]
entry.setEntryArg(1, fsi); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "DELEGATE_URI", pui, fsi); // depends on control dependency: [if], data = [none]
addDelegate(entry); // depends on control dependency: [if], data = [none]
} else if (type == REWRITE_SYSTEM) {
String psi = normalizeURI(entry.getEntryArg(0));
String rpx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(0, psi); // depends on control dependency: [if], data = [none]
entry.setEntryArg(1, rpx); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "REWRITE_SYSTEM", psi, rpx); // depends on control dependency: [if], data = [none]
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
} else if (type == REWRITE_URI) {
String pui = normalizeURI(entry.getEntryArg(0));
String upx = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(0, pui); // depends on control dependency: [if], data = [none]
entry.setEntryArg(1, upx); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "REWRITE_URI", pui, upx); // depends on control dependency: [if], data = [none]
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
} else if (type == DOCTYPE) {
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "DOCTYPE", entry.getEntryArg(0), fsi); // depends on control dependency: [if], data = [none]
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
} else if (type == DTDDECL) {
// meaningless in XML
String fpi = PublicId.normalize(entry.getEntryArg(0));
entry.setEntryArg(0, fpi); // depends on control dependency: [if], data = [none]
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "DTDDECL", fpi, fsi); // depends on control dependency: [if], data = [none]
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
} else if (type == ENTITY) {
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "ENTITY", entry.getEntryArg(0), fsi); // depends on control dependency: [if], data = [none]
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
} else if (type == LINKTYPE) {
// meaningless in XML
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "LINKTYPE", entry.getEntryArg(0), fsi); // depends on control dependency: [if], data = [none]
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
} else if (type == NOTATION) {
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "NOTATION", entry.getEntryArg(0), fsi); // depends on control dependency: [if], data = [none]
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
} else {
catalogEntries.addElement(entry); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean isValidPropertyNotNull(final GraphObject node, final PropertyKey key, final ErrorBuffer errorBuffer) {
final String type = node.getType();
if (key == null) {
errorBuffer.add(new EmptyPropertyToken(type, UnknownType));
return false;
}
final Object value = node.getProperty(key);
if (value != null) {
if (value instanceof Iterable) {
if (((Iterable) value).iterator().hasNext()) {
return true;
}
} else {
return true;
}
}
errorBuffer.add(new EmptyPropertyToken(type, key));
return false;
} } | public class class_name {
public static boolean isValidPropertyNotNull(final GraphObject node, final PropertyKey key, final ErrorBuffer errorBuffer) {
final String type = node.getType();
if (key == null) {
errorBuffer.add(new EmptyPropertyToken(type, UnknownType)); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
final Object value = node.getProperty(key);
if (value != null) {
if (value instanceof Iterable) {
if (((Iterable) value).iterator().hasNext()) {
return true; // depends on control dependency: [if], data = [none]
}
} else {
return true; // depends on control dependency: [if], data = [none]
}
}
errorBuffer.add(new EmptyPropertyToken(type, key));
return false;
} } |
public class class_name {
@SuppressWarnings("rawtypes")
public static boolean isPropertyInherited(Class clz, String propertyName) {
if (clz == null) return false;
Assert.isTrue(StringUtils.hasText(propertyName), "Argument [propertyName] cannot be null or blank");
Class<?> superClass = clz.getSuperclass();
PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(superClass, propertyName);
if (pd != null && pd.getReadMethod() != null) {
return true;
}
return false;
} } | public class class_name {
@SuppressWarnings("rawtypes")
public static boolean isPropertyInherited(Class clz, String propertyName) {
if (clz == null) return false;
Assert.isTrue(StringUtils.hasText(propertyName), "Argument [propertyName] cannot be null or blank");
Class<?> superClass = clz.getSuperclass();
PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(superClass, propertyName);
if (pd != null && pd.getReadMethod() != null) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void configure(CompilerConfiguration configuration) {
super.configure(configuration);
this.debug = configuration.getDebug();
if (!this.configured && this.classLoader instanceof GroovyClassLoader) {
appendCompilerConfigurationClasspathToClassLoader(configuration, (GroovyClassLoader) this.classLoader);
}
this.configured = true;
} } | public class class_name {
public void configure(CompilerConfiguration configuration) {
super.configure(configuration);
this.debug = configuration.getDebug();
if (!this.configured && this.classLoader instanceof GroovyClassLoader) {
appendCompilerConfigurationClasspathToClassLoader(configuration, (GroovyClassLoader) this.classLoader); // depends on control dependency: [if], data = [none]
}
this.configured = true;
} } |
public class class_name {
public static Map<String,ExportedVariable> findExportedVariables( String exportedVariablesDecl, File sourceFile, int lineNumber ) {
Map<String,ExportedVariable> result = new HashMap<> ();
Pattern pattern = Pattern.compile( ParsingConstants.PROPERTY_GRAPH_RANDOM_PATTERN, Pattern.CASE_INSENSITIVE );
ExportedVariablesParser exportsParser = new ExportedVariablesParser();
exportsParser.parse( exportedVariablesDecl, sourceFile, lineNumber );
for( Map.Entry<String,String> entry : exportsParser.rawNameToVariables.entrySet()) {
ExportedVariable var = new ExportedVariable();
String variableName = entry.getKey();
Matcher m = pattern.matcher( variableName );
if( m.matches()) {
var.setRandom( true );
var.setRawKind( m.group( 1 ));
variableName = m.group( 2 ).trim();
}
var.setName( variableName );
var.setValue( entry.getValue());
result.put( var.getName(), var );
}
return result;
} } | public class class_name {
public static Map<String,ExportedVariable> findExportedVariables( String exportedVariablesDecl, File sourceFile, int lineNumber ) {
Map<String,ExportedVariable> result = new HashMap<> ();
Pattern pattern = Pattern.compile( ParsingConstants.PROPERTY_GRAPH_RANDOM_PATTERN, Pattern.CASE_INSENSITIVE );
ExportedVariablesParser exportsParser = new ExportedVariablesParser();
exportsParser.parse( exportedVariablesDecl, sourceFile, lineNumber );
for( Map.Entry<String,String> entry : exportsParser.rawNameToVariables.entrySet()) {
ExportedVariable var = new ExportedVariable();
String variableName = entry.getKey();
Matcher m = pattern.matcher( variableName );
if( m.matches()) {
var.setRandom( true ); // depends on control dependency: [if], data = [none]
var.setRawKind( m.group( 1 )); // depends on control dependency: [if], data = [none]
variableName = m.group( 2 ).trim(); // depends on control dependency: [if], data = [none]
}
var.setName( variableName ); // depends on control dependency: [for], data = [none]
var.setValue( entry.getValue()); // depends on control dependency: [for], data = [entry]
result.put( var.getName(), var ); // depends on control dependency: [for], data = [none]
}
return result;
} } |
public class class_name {
private static Object stringTypeToPig(Object value) {
if (value instanceof String) {
return value;
}
if (value instanceof byte[]) {
byte[] buf = (byte[])value;
return new DataByteArray(Arrays.copyOf(buf, buf.length));
}
if (value instanceof ByteBuffer) {
ByteBuffer bin = (ByteBuffer)value;
byte[] buf = new byte[bin.remaining()];
bin.mark();
bin.get(buf);
bin.reset();
return new DataByteArray(buf);
}
return null;
} } | public class class_name {
private static Object stringTypeToPig(Object value) {
if (value instanceof String) {
return value; // depends on control dependency: [if], data = [none]
}
if (value instanceof byte[]) {
byte[] buf = (byte[])value;
return new DataByteArray(Arrays.copyOf(buf, buf.length)); // depends on control dependency: [if], data = [none]
}
if (value instanceof ByteBuffer) {
ByteBuffer bin = (ByteBuffer)value;
byte[] buf = new byte[bin.remaining()];
bin.mark(); // depends on control dependency: [if], data = [none]
bin.get(buf); // depends on control dependency: [if], data = [none]
bin.reset(); // depends on control dependency: [if], data = [none]
return new DataByteArray(buf); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public String getGeometryProperty(TableRef tableRef) {
TableMapping tableMapping = mappedClasses.get(tableRef);
if (tableMapping == null) {
return null;
}
for (ColumnMetaData columnMetaData : tableMapping.getMappedColumns()) {
if (columnMetaData.isGeometry()) {
ColumnMapping cm = tableMapping.getColumnMapping(columnMetaData);
return cm.getPropertyName();
}
}
return null;
} } | public class class_name {
public String getGeometryProperty(TableRef tableRef) {
TableMapping tableMapping = mappedClasses.get(tableRef);
if (tableMapping == null) {
return null; // depends on control dependency: [if], data = [none]
}
for (ColumnMetaData columnMetaData : tableMapping.getMappedColumns()) {
if (columnMetaData.isGeometry()) {
ColumnMapping cm = tableMapping.getColumnMapping(columnMetaData);
return cm.getPropertyName(); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static String relativize(final String path,
final File parentDir,
final boolean removeInitialFileSep) {
// Check sanity
Validate.notNull(path, "path");
Validate.notNull(parentDir, "parentDir");
final String basedirPath = FileSystemUtilities.getCanonicalPath(parentDir);
String toReturn = path;
// Compare case insensitive
if (path.toLowerCase().startsWith(basedirPath.toLowerCase())) {
toReturn = path.substring(basedirPath.length());
}
// Handle whitespace in the argument.
return removeInitialFileSep && toReturn.startsWith(File.separator)
? toReturn.substring(File.separator.length())
: toReturn;
} } | public class class_name {
public static String relativize(final String path,
final File parentDir,
final boolean removeInitialFileSep) {
// Check sanity
Validate.notNull(path, "path");
Validate.notNull(parentDir, "parentDir");
final String basedirPath = FileSystemUtilities.getCanonicalPath(parentDir);
String toReturn = path;
// Compare case insensitive
if (path.toLowerCase().startsWith(basedirPath.toLowerCase())) {
toReturn = path.substring(basedirPath.length()); // depends on control dependency: [if], data = [none]
}
// Handle whitespace in the argument.
return removeInitialFileSep && toReturn.startsWith(File.separator)
? toReturn.substring(File.separator.length())
: toReturn;
} } |
public class class_name {
private void setListIdForColumn(CmsListColumnDefinition col) {
col.setListId(getListId());
// default actions
Iterator<CmsListDefaultAction> itDefaultActions = col.getDefaultActions().iterator();
while (itDefaultActions.hasNext()) {
itDefaultActions.next().setListId(getListId());
}
// direct actions
Iterator<I_CmsListDirectAction> itDirectActions = col.getDirectActions().iterator();
while (itDirectActions.hasNext()) {
itDirectActions.next().setListId(getListId());
}
} } | public class class_name {
private void setListIdForColumn(CmsListColumnDefinition col) {
col.setListId(getListId());
// default actions
Iterator<CmsListDefaultAction> itDefaultActions = col.getDefaultActions().iterator();
while (itDefaultActions.hasNext()) {
itDefaultActions.next().setListId(getListId()); // depends on control dependency: [while], data = [none]
}
// direct actions
Iterator<I_CmsListDirectAction> itDirectActions = col.getDirectActions().iterator();
while (itDirectActions.hasNext()) {
itDirectActions.next().setListId(getListId()); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
private synchronized void defaultInit()
{
if (!_initialized)
{
_initialized = true;
String sinkClasses = System.getProperty("LOG_SINKS","org.browsermob.proxy.jetty.log.OutputStreamLogSink");
StringTokenizer sinkTokens = new StringTokenizer(sinkClasses, ";, ");
LogSink sink= null;
while (sinkTokens.hasMoreTokens())
{
String sinkClassName = sinkTokens.nextToken();
try
{
Class sinkClass = Loader.loadClass(this.getClass(),sinkClassName);
if (org.browsermob.proxy.jetty.log.LogSink.class.isAssignableFrom(sinkClass)) {
sink = (LogSink)sinkClass.newInstance();
sink.start();
add(sink);
}
else
// Can't use Code.fail here, that's what we're setting up
System.err.println(sinkClass+" is not a org.browsermob.proxy.jetty.log.LogSink");
}
catch (Exception e) {
e.printStackTrace();
}
}
}
} } | public class class_name {
private synchronized void defaultInit()
{
if (!_initialized)
{
_initialized = true; // depends on control dependency: [if], data = [none]
String sinkClasses = System.getProperty("LOG_SINKS","org.browsermob.proxy.jetty.log.OutputStreamLogSink");
StringTokenizer sinkTokens = new StringTokenizer(sinkClasses, ";, ");
LogSink sink= null;
while (sinkTokens.hasMoreTokens())
{
String sinkClassName = sinkTokens.nextToken();
try
{
Class sinkClass = Loader.loadClass(this.getClass(),sinkClassName); // depends on control dependency: [try], data = [none]
if (org.browsermob.proxy.jetty.log.LogSink.class.isAssignableFrom(sinkClass)) {
sink = (LogSink)sinkClass.newInstance(); // depends on control dependency: [if], data = [none]
sink.start(); // depends on control dependency: [if], data = [none]
add(sink); // depends on control dependency: [if], data = [none]
}
else
// Can't use Code.fail here, that's what we're setting up
System.err.println(sinkClass+" is not a org.browsermob.proxy.jetty.log.LogSink");
}
catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public int countCurrentDockerSlaves(final DockerSlaveTemplate template) throws Exception {
int count = 0;
List<Container> containers = getClient().listContainersCmd().exec();
for (Container container : containers) {
final Map<String, String> labels = container.getLabels();
if (labels.containsKey(DOCKER_CLOUD_LABEL) && labels.get(DOCKER_CLOUD_LABEL).equals(getDisplayName())) {
if (template == null) {
// count only total cloud capacity
count++;
} else if (labels.containsKey(DOCKER_TEMPLATE_LABEL) &&
labels.get(DOCKER_TEMPLATE_LABEL).equals(template.getId())) {
count++;
}
}
}
return count;
} } | public class class_name {
public int countCurrentDockerSlaves(final DockerSlaveTemplate template) throws Exception {
int count = 0;
List<Container> containers = getClient().listContainersCmd().exec();
for (Container container : containers) {
final Map<String, String> labels = container.getLabels();
if (labels.containsKey(DOCKER_CLOUD_LABEL) && labels.get(DOCKER_CLOUD_LABEL).equals(getDisplayName())) {
if (template == null) {
// count only total cloud capacity
count++; // depends on control dependency: [if], data = [none]
} else if (labels.containsKey(DOCKER_TEMPLATE_LABEL) &&
labels.get(DOCKER_TEMPLATE_LABEL).equals(template.getId())) {
count++; // depends on control dependency: [if], data = [none]
}
}
}
return count;
} } |
public class class_name {
static <T> Entry<T> applyQuery(Entry<T> entry, Query<T> query) {
requireNonNull(query, "query");
entry.content(); // Ensure that content is not null.
final EntryType entryType = entry.type();
final QueryType queryType = query.type();
if (!queryType.supportedEntryTypes().contains(entryType)) {
throw new QueryExecutionException("Unsupported entry type: " + entryType +
" (query: " + query + ')');
}
if (queryType == IDENTITY) {
return entry;
} else if (queryType == JSON_PATH) {
return Entry.of(entry.revision(), query.path(), entryType, query.apply(entry.content()));
} else {
throw new QueryExecutionException("Unsupported entry type: " + entryType +
" (query: " + query + ')');
}
} } | public class class_name {
static <T> Entry<T> applyQuery(Entry<T> entry, Query<T> query) {
requireNonNull(query, "query");
entry.content(); // Ensure that content is not null.
final EntryType entryType = entry.type();
final QueryType queryType = query.type();
if (!queryType.supportedEntryTypes().contains(entryType)) {
throw new QueryExecutionException("Unsupported entry type: " + entryType +
" (query: " + query + ')');
}
if (queryType == IDENTITY) {
return entry; // depends on control dependency: [if], data = [none]
} else if (queryType == JSON_PATH) {
return Entry.of(entry.revision(), query.path(), entryType, query.apply(entry.content())); // depends on control dependency: [if], data = [none]
} else {
throw new QueryExecutionException("Unsupported entry type: " + entryType +
" (query: " + query + ')');
}
} } |
public class class_name {
public MockResponse setChunkedBody(String body, int maxChunkSize) {
try {
return setChunkedBody(body.getBytes("UTF-8"), maxChunkSize);
} catch (UnsupportedEncodingException e) {
throw new AssertionError();
}
} } | public class class_name {
public MockResponse setChunkedBody(String body, int maxChunkSize) {
try {
return setChunkedBody(body.getBytes("UTF-8"), maxChunkSize); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new AssertionError();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void bindStateStyle (Value<Boolean> value, final String onStyle,
final String offStyle, final Widget... targets)
{
value.addListenerAndTrigger(new Value.Listener<Boolean>() {
public void valueChanged (Boolean value) {
String add, remove;
if (value) {
remove = offStyle;
add = onStyle;
} else {
remove = onStyle;
add = offStyle;
}
for (Widget target : targets) {
if (remove != null) {
target.removeStyleName(remove);
}
if (add != null) {
target.addStyleName(add);
}
}
}
});
} } | public class class_name {
public static void bindStateStyle (Value<Boolean> value, final String onStyle,
final String offStyle, final Widget... targets)
{
value.addListenerAndTrigger(new Value.Listener<Boolean>() {
public void valueChanged (Boolean value) {
String add, remove;
if (value) {
remove = offStyle; // depends on control dependency: [if], data = [none]
add = onStyle; // depends on control dependency: [if], data = [none]
} else {
remove = onStyle; // depends on control dependency: [if], data = [none]
add = offStyle; // depends on control dependency: [if], data = [none]
}
for (Widget target : targets) {
if (remove != null) {
target.removeStyleName(remove); // depends on control dependency: [if], data = [(remove]
}
if (add != null) {
target.addStyleName(add); // depends on control dependency: [if], data = [(add]
}
}
}
});
} } |
public class class_name {
public static INDArray toMatrix(List<Row> rows) {
INDArray ret = Nd4j.create(rows.size(), rows.get(0).size());
for (int i = 0; i < ret.rows(); i++) {
for (int j = 0; j < ret.columns(); j++) {
ret.putScalar(i, j, rows.get(i).getDouble(j));
}
}
return ret;
} } | public class class_name {
public static INDArray toMatrix(List<Row> rows) {
INDArray ret = Nd4j.create(rows.size(), rows.get(0).size());
for (int i = 0; i < ret.rows(); i++) {
for (int j = 0; j < ret.columns(); j++) {
ret.putScalar(i, j, rows.get(i).getDouble(j)); // depends on control dependency: [for], data = [j]
}
}
return ret;
} } |
public class class_name {
@Override
public boolean isMatch(final CommonCell cell) {
if(!cell.isNumber()) {
return false;
}
final long zeroTime = ExcelDateUtils.getExcelZeroDateTime(cell.isDateStart1904());
final Date date = cell.getDateCellValue();
final long value = date.getTime() - zeroTime;
if(logger.isDebugEnabled()) {
logger.debug("isMatch::date={}, zeroTime={}, diff={}",
ExcelDateUtils.formatDate(date), ExcelDateUtils.formatDate(new Date(zeroTime)), value);
}
return getOperator().isMatch(value);
} } | public class class_name {
@Override
public boolean isMatch(final CommonCell cell) {
if(!cell.isNumber()) {
return false;
// depends on control dependency: [if], data = [none]
}
final long zeroTime = ExcelDateUtils.getExcelZeroDateTime(cell.isDateStart1904());
final Date date = cell.getDateCellValue();
final long value = date.getTime() - zeroTime;
if(logger.isDebugEnabled()) {
logger.debug("isMatch::date={}, zeroTime={}, diff={}",
ExcelDateUtils.formatDate(date), ExcelDateUtils.formatDate(new Date(zeroTime)), value);
// depends on control dependency: [if], data = [none]
}
return getOperator().isMatch(value);
} } |
public class class_name {
public static String trimWhitespace(String str) {
if (!hasLength(str)) {
return str;
}
StringBuilder buf = new StringBuilder(str);
while (buf.length() > 0 && Character.isWhitespace(buf.charAt(0))) {
buf.deleteCharAt(0);
}
while (buf.length() > 0 && Character.isWhitespace(buf.charAt(buf.length() - 1))) {
buf.deleteCharAt(buf.length() - 1);
}
return buf.toString();
} } | public class class_name {
public static String trimWhitespace(String str) {
if (!hasLength(str)) {
return str; // depends on control dependency: [if], data = [none]
}
StringBuilder buf = new StringBuilder(str);
while (buf.length() > 0 && Character.isWhitespace(buf.charAt(0))) {
buf.deleteCharAt(0); // depends on control dependency: [while], data = [none]
}
while (buf.length() > 0 && Character.isWhitespace(buf.charAt(buf.length() - 1))) {
buf.deleteCharAt(buf.length() - 1); // depends on control dependency: [while], data = [(buf.length()]
}
return buf.toString();
} } |
public class class_name {
private void checkMQLinkExists(boolean condition, String mqlinkName)
throws SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkMQLinkExists",
new Object[] { new Boolean(condition), mqlinkName });
if (!condition)
{
SIMPNotPossibleInCurrentConfigurationException e =
new SIMPNotPossibleInCurrentConfigurationException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_42",
new Object[] { mqlinkName, messageProcessor.getMessagingEngineName(),
messageProcessor.getMessagingEngineBus() },
null));
e.setExceptionInserts(new String[] { mqlinkName, messageProcessor.getMessagingEngineName(), messageProcessor.getMessagingEngineBus() });
e.setExceptionReason(SIRCConstants.SIRC0042_MQ_LINK_NOT_FOUND_ERROR);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkMQLinkExists", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkMQLinkExists");
} } | public class class_name {
private void checkMQLinkExists(boolean condition, String mqlinkName)
throws SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkMQLinkExists",
new Object[] { new Boolean(condition), mqlinkName });
if (!condition)
{
SIMPNotPossibleInCurrentConfigurationException e =
new SIMPNotPossibleInCurrentConfigurationException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_42",
new Object[] { mqlinkName, messageProcessor.getMessagingEngineName(),
messageProcessor.getMessagingEngineBus() },
null));
e.setExceptionInserts(new String[] { mqlinkName, messageProcessor.getMessagingEngineName(), messageProcessor.getMessagingEngineBus() }); // depends on control dependency: [if], data = [none]
e.setExceptionReason(SIRCConstants.SIRC0042_MQ_LINK_NOT_FOUND_ERROR); // depends on control dependency: [if], data = [none]
SibTr.exception(tc, e); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkMQLinkExists", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkMQLinkExists");
} } |
public class class_name {
@Override
public void validate(ValidationHelper helper, Context context, String key, Parameter t) {
if (t != null) {
String reference = t.getRef();
if (reference != null && !reference.isEmpty()) {
ValidatorUtils.referenceValidatorHelper(reference, t, helper, context, key);
return;
}
ValidatorUtils.validateRequiredField(t.getName(), context, "name").ifPresent(helper::addValidationEvent);
In in = t.getIn();
ValidatorUtils.validateRequiredField(in, context, "in").ifPresent(helper::addValidationEvent);
if (in != null && in != In.COOKIE && in != In.HEADER && in != In.PATH && in != In.QUERY) {
final String message = Tr.formatMessage(tc, "parameterInFieldInvalid", in, t.getName());
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("in"), message));
}
// The examples object is mutually exclusive of the example object.
if ((t.getExample() != null) && (t.getExamples() != null && !t.getExamples().isEmpty())) {
final String message = Tr.formatMessage(tc, "parameterExampleOrExamples", t.getName());
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.WARNING, context.getLocation(), message));
}
Schema schema = t.getSchema();
Content content = t.getContent();
// A parameter MUST contain either a schema property, or a content property, but not both.
if (schema == null && content == null) {
final String message = Tr.formatMessage(tc, "parameterSchemaOrContent", t.getName());
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
}
if (schema != null && content != null) {
final String message = Tr.formatMessage(tc, "parameterSchemaAndContent", t.getName());
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));
}
// The 'content' map MUST only contain one entry.
if (content != null && content.size() > 1) {
final String message = Tr.formatMessage(tc, "parameterContentMapMustNotBeEmpty", t.getName());
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("content"), message));
}
}
} } | public class class_name {
@Override
public void validate(ValidationHelper helper, Context context, String key, Parameter t) {
if (t != null) {
String reference = t.getRef();
if (reference != null && !reference.isEmpty()) {
ValidatorUtils.referenceValidatorHelper(reference, t, helper, context, key); // depends on control dependency: [if], data = [(reference]
return; // depends on control dependency: [if], data = [none]
}
ValidatorUtils.validateRequiredField(t.getName(), context, "name").ifPresent(helper::addValidationEvent); // depends on control dependency: [if], data = [(t]
In in = t.getIn();
ValidatorUtils.validateRequiredField(in, context, "in").ifPresent(helper::addValidationEvent); // depends on control dependency: [if], data = [none]
if (in != null && in != In.COOKIE && in != In.HEADER && in != In.PATH && in != In.QUERY) {
final String message = Tr.formatMessage(tc, "parameterInFieldInvalid", in, t.getName());
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("in"), message)); // depends on control dependency: [if], data = [none]
}
// The examples object is mutually exclusive of the example object.
if ((t.getExample() != null) && (t.getExamples() != null && !t.getExamples().isEmpty())) {
final String message = Tr.formatMessage(tc, "parameterExampleOrExamples", t.getName());
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.WARNING, context.getLocation(), message)); // depends on control dependency: [if], data = [none]
}
Schema schema = t.getSchema();
Content content = t.getContent();
// A parameter MUST contain either a schema property, or a content property, but not both.
if (schema == null && content == null) {
final String message = Tr.formatMessage(tc, "parameterSchemaOrContent", t.getName());
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message)); // depends on control dependency: [if], data = [none]
}
if (schema != null && content != null) {
final String message = Tr.formatMessage(tc, "parameterSchemaAndContent", t.getName());
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message)); // depends on control dependency: [if], data = [none]
}
// The 'content' map MUST only contain one entry.
if (content != null && content.size() > 1) {
final String message = Tr.formatMessage(tc, "parameterContentMapMustNotBeEmpty", t.getName());
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("content"), message)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Deprecated
@Override
public boolean getFlag(int flagType) {
boolean val = false;
boolean leftFlag = left.getFlag(flagType);
if (right != null) {
if ("and".equals(operator) && leftFlag) {
boolean rightFlag = right.getFlag(flagType);
val = leftFlag && rightFlag;
} else if ("or".equals(operator)) {
boolean rightFlag = right.getFlag(flagType);
val = leftFlag || rightFlag;
}
} else {
if ("not".equals(operator)) {
val = (!leftFlag);
} else {
val = leftFlag;
}
}
return val;
} } | public class class_name {
@Deprecated
@Override
public boolean getFlag(int flagType) {
boolean val = false;
boolean leftFlag = left.getFlag(flagType);
if (right != null) {
if ("and".equals(operator) && leftFlag) {
boolean rightFlag = right.getFlag(flagType);
val = leftFlag && rightFlag; // depends on control dependency: [if], data = [none]
} else if ("or".equals(operator)) {
boolean rightFlag = right.getFlag(flagType);
val = leftFlag || rightFlag; // depends on control dependency: [if], data = [none]
}
} else {
if ("not".equals(operator)) {
val = (!leftFlag); // depends on control dependency: [if], data = [none]
} else {
val = leftFlag; // depends on control dependency: [if], data = [none]
}
}
return val;
} } |
public class class_name {
public ExtendedSwidProcessor setExtendedInformation(final JAXBElement<Object>... extendedInformationList) {
ExtendedInformationComplexType eict = new ExtendedInformationComplexType();
if (extendedInformationList.length > 0) {
for (JAXBElement<Object> extendedInformation : extendedInformationList) {
eict.getAny().add(extendedInformation);
}
}
swidTag.getExtendedInformation().add(eict);
return this;
} } | public class class_name {
public ExtendedSwidProcessor setExtendedInformation(final JAXBElement<Object>... extendedInformationList) {
ExtendedInformationComplexType eict = new ExtendedInformationComplexType();
if (extendedInformationList.length > 0) {
for (JAXBElement<Object> extendedInformation : extendedInformationList) {
eict.getAny().add(extendedInformation); // depends on control dependency: [for], data = [extendedInformation]
}
}
swidTag.getExtendedInformation().add(eict);
return this;
} } |
public class class_name {
public static synchronized Random getThreadLocalRandom() {
if(threadLocalRandom == null) {
threadLocalRandom = new ThreadLocal<Random>() {
/**
* Builds a Random object using the globalSeed (if available).
*
* @return
*/
@Override
protected Random initialValue() {
if(globalSeed == null) {
return new Random();
}
else {
return new Random(globalSeed);
}
}
};
}
return threadLocalRandom.get();
} } | public class class_name {
public static synchronized Random getThreadLocalRandom() {
if(threadLocalRandom == null) {
threadLocalRandom = new ThreadLocal<Random>() {
/**
* Builds a Random object using the globalSeed (if available).
*
* @return
*/
@Override
protected Random initialValue() {
if(globalSeed == null) {
return new Random(); // depends on control dependency: [if], data = [none]
}
else {
return new Random(globalSeed); // depends on control dependency: [if], data = [(globalSeed]
}
}
}; // depends on control dependency: [if], data = [none]
}
return threadLocalRandom.get();
} } |
public class class_name {
@Override
public EClass getIfcShapeRepresentation() {
if (ifcShapeRepresentationEClass == null) {
ifcShapeRepresentationEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(597);
}
return ifcShapeRepresentationEClass;
} } | public class class_name {
@Override
public EClass getIfcShapeRepresentation() {
if (ifcShapeRepresentationEClass == null) {
ifcShapeRepresentationEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(597);
// depends on control dependency: [if], data = [none]
}
return ifcShapeRepresentationEClass;
} } |
public class class_name {
public static void error(Object obj) {
if (obj instanceof Throwable) {
Throwable e = (Throwable) obj;
error(e, e.getMessage());
} else {
error("{}", obj);
}
} } | public class class_name {
public static void error(Object obj) {
if (obj instanceof Throwable) {
Throwable e = (Throwable) obj;
error(e, e.getMessage());
// depends on control dependency: [if], data = [none]
} else {
error("{}", obj);
// depends on control dependency: [if], data = [none]
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.