code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private void buildCustomMetricReporters(Properties properties) {
String reporterClasses = properties.getProperty(ConfigurationKeys.METRICS_CUSTOM_BUILDERS);
if (Strings.isNullOrEmpty(reporterClasses)) {
return;
}
for (String reporterClass : Splitter.on(",").split(reporterClasses)) {
buildScheduledReporter(properties, reporterClass, Optional.<String>absent());
}
} } | public class class_name {
private void buildCustomMetricReporters(Properties properties) {
String reporterClasses = properties.getProperty(ConfigurationKeys.METRICS_CUSTOM_BUILDERS);
if (Strings.isNullOrEmpty(reporterClasses)) {
return; // depends on control dependency: [if], data = [none]
}
for (String reporterClass : Splitter.on(",").split(reporterClasses)) {
buildScheduledReporter(properties, reporterClass, Optional.<String>absent()); // depends on control dependency: [for], data = [reporterClass]
}
} } |
public class class_name {
public ContainerOverride withEnvironment(KeyValuePair... environment) {
if (this.environment == null) {
setEnvironment(new com.amazonaws.internal.SdkInternalList<KeyValuePair>(environment.length));
}
for (KeyValuePair ele : environment) {
this.environment.add(ele);
}
return this;
} } | public class class_name {
public ContainerOverride withEnvironment(KeyValuePair... environment) {
if (this.environment == null) {
setEnvironment(new com.amazonaws.internal.SdkInternalList<KeyValuePair>(environment.length)); // depends on control dependency: [if], data = [none]
}
for (KeyValuePair ele : environment) {
this.environment.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public EEnum getIfcFootingTypeEnum() {
if (ifcFootingTypeEnumEEnum == null) {
ifcFootingTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(842);
}
return ifcFootingTypeEnumEEnum;
} } | public class class_name {
public EEnum getIfcFootingTypeEnum() {
if (ifcFootingTypeEnumEEnum == null) {
ifcFootingTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(842);
// depends on control dependency: [if], data = [none]
}
return ifcFootingTypeEnumEEnum;
} } |
public class class_name {
protected String escapeObjectName(@Nonnull ObjectName objectName) {
StringBuilder result = new StringBuilder();
StringUtils2.appendEscapedNonAlphaNumericChars(objectName.getDomain(), result);
result.append('.');
List<String> keys = Collections.list(objectName.getKeyPropertyList().keys());
Collections.sort(keys);
for (Iterator<String> it = keys.iterator(); it.hasNext(); ) {
String key = it.next();
StringUtils2.appendEscapedNonAlphaNumericChars(key, result);
result.append("__");
StringUtils2.appendEscapedNonAlphaNumericChars(objectName.getKeyProperty(key), result);
if (it.hasNext()) {
result.append('.');
}
}
if (logger.isLoggable(Level.FINEST))
logger.log(Level.FINEST, "escapeObjectName(" + objectName + "): " + result);
return result.toString();
} } | public class class_name {
protected String escapeObjectName(@Nonnull ObjectName objectName) {
StringBuilder result = new StringBuilder();
StringUtils2.appendEscapedNonAlphaNumericChars(objectName.getDomain(), result);
result.append('.');
List<String> keys = Collections.list(objectName.getKeyPropertyList().keys());
Collections.sort(keys);
for (Iterator<String> it = keys.iterator(); it.hasNext(); ) {
String key = it.next();
StringUtils2.appendEscapedNonAlphaNumericChars(key, result); // depends on control dependency: [for], data = [none]
result.append("__"); // depends on control dependency: [for], data = [none]
StringUtils2.appendEscapedNonAlphaNumericChars(objectName.getKeyProperty(key), result); // depends on control dependency: [for], data = [none]
if (it.hasNext()) {
result.append('.'); // depends on control dependency: [if], data = [none]
}
}
if (logger.isLoggable(Level.FINEST))
logger.log(Level.FINEST, "escapeObjectName(" + objectName + "): " + result);
return result.toString();
} } |
public class class_name {
public void marshall(CreateGroupMembershipRequest createGroupMembershipRequest, ProtocolMarshaller protocolMarshaller) {
if (createGroupMembershipRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createGroupMembershipRequest.getMemberName(), MEMBERNAME_BINDING);
protocolMarshaller.marshall(createGroupMembershipRequest.getGroupName(), GROUPNAME_BINDING);
protocolMarshaller.marshall(createGroupMembershipRequest.getAwsAccountId(), AWSACCOUNTID_BINDING);
protocolMarshaller.marshall(createGroupMembershipRequest.getNamespace(), NAMESPACE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateGroupMembershipRequest createGroupMembershipRequest, ProtocolMarshaller protocolMarshaller) {
if (createGroupMembershipRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createGroupMembershipRequest.getMemberName(), MEMBERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createGroupMembershipRequest.getGroupName(), GROUPNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createGroupMembershipRequest.getAwsAccountId(), AWSACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createGroupMembershipRequest.getNamespace(), NAMESPACE_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 HttpResponse close() {
HttpConnection httpConnection = httpRequest.httpConnection;
if (httpConnection != null) {
httpConnection.close();
httpRequest.httpConnection = null;
}
return this;
} } | public class class_name {
public HttpResponse close() {
HttpConnection httpConnection = httpRequest.httpConnection;
if (httpConnection != null) {
httpConnection.close(); // depends on control dependency: [if], data = [none]
httpRequest.httpConnection = null; // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
@Override
public String save(Object pData) {
String id =GUID.newGUID();
if(pData instanceof TemplateModel)
{
TemplateModel entity =(TemplateModel)pData;
entity.setId(id);
entity.setRev(System.currentTimeMillis());
}
else if(pData instanceof CommonModel)
{
CommonModel entity =(CommonModel)pData;
entity.setId(id);
}
mDao.insert(pData);
return id;
} } | public class class_name {
@Override
public String save(Object pData) {
String id =GUID.newGUID();
if(pData instanceof TemplateModel)
{
TemplateModel entity =(TemplateModel)pData;
entity.setId(id); // depends on control dependency: [if], data = [none]
entity.setRev(System.currentTimeMillis()); // depends on control dependency: [if], data = [none]
}
else if(pData instanceof CommonModel)
{
CommonModel entity =(CommonModel)pData;
entity.setId(id); // depends on control dependency: [if], data = [none]
}
mDao.insert(pData);
return id;
} } |
public class class_name {
private ArrayList<Track> parseTopTracks(String json) {
ArrayList<Track> tracks = new ArrayList<>();
try {
JsonNode jsonNode = this.objectMapper.readTree(json);
for (JsonNode trackNode : jsonNode.get("tracks")) {
JsonNode albumNode = trackNode.get("album");
String albumName = albumNode.get("name").asText();
String artistName = trackNode.get("artists").get(0).get("name").asText();
String trackName = trackNode.get("name").asText();
tracks.add(new Track(trackName, new Album(albumName, new Artist(artistName))));
}
} catch (IOException e) {
throw new RuntimeException("Failed to parse JSON", e);
}
return tracks;
} } | public class class_name {
private ArrayList<Track> parseTopTracks(String json) {
ArrayList<Track> tracks = new ArrayList<>();
try {
JsonNode jsonNode = this.objectMapper.readTree(json);
for (JsonNode trackNode : jsonNode.get("tracks")) {
JsonNode albumNode = trackNode.get("album");
String albumName = albumNode.get("name").asText();
String artistName = trackNode.get("artists").get(0).get("name").asText();
String trackName = trackNode.get("name").asText();
tracks.add(new Track(trackName, new Album(albumName, new Artist(artistName)))); // depends on control dependency: [for], data = [none]
}
} catch (IOException e) {
throw new RuntimeException("Failed to parse JSON", e);
} // depends on control dependency: [catch], data = [none]
return tracks;
} } |
public class class_name {
public String createSyslogHeader(int facility, int level, String localName, boolean sendLocalTimestamp, boolean sendLocalName) {
StringBuffer buffer = new StringBuffer();
appendPriority(buffer, facility, level);
if (sendLocalTimestamp) {
appendTimestamp(buffer, new Date());
}
if (sendLocalName) {
appendLocalName(buffer, localName);
}
return buffer.toString();
} } | public class class_name {
public String createSyslogHeader(int facility, int level, String localName, boolean sendLocalTimestamp, boolean sendLocalName) {
StringBuffer buffer = new StringBuffer();
appendPriority(buffer, facility, level);
if (sendLocalTimestamp) {
appendTimestamp(buffer, new Date());
// depends on control dependency: [if], data = [none]
}
if (sendLocalName) {
appendLocalName(buffer, localName);
// depends on control dependency: [if], data = [none]
}
return buffer.toString();
} } |
public class class_name {
public void marshall(DeleteDataSourceRequest deleteDataSourceRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteDataSourceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteDataSourceRequest.getDataSourceId(), DATASOURCEID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteDataSourceRequest deleteDataSourceRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteDataSourceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteDataSourceRequest.getDataSourceId(), DATASOURCEID_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 static void renewCCTokenAsync(final Jwt jwt) {
// Not expired yet, try to renew async but let requests use the old token.
logger.trace("In renew window but token is not expired yet.");
if(!jwt.isRenewing() || System.currentTimeMillis() > jwt.getEarlyRetryTimeout()) {
jwt.setRenewing(true);
jwt.setEarlyRetryTimeout(System.currentTimeMillis() + jwt.getEarlyRefreshRetryDelay());
logger.trace("Retrieve token async is called while token is not expired yet");
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
executor.schedule(() -> {
Result<Jwt> result = getCCTokenRemotely(jwt);
if(result.isFailure()) {
// swallow the exception here as it is on a best effort basis.
logger.error("Async retrieve token error with status: {}", result.getError().toString());
}
//set renewing flag to false after response, doesn't matter if it's success or fail.
jwt.setRenewing(false);
}, 50, TimeUnit.MILLISECONDS);
executor.shutdown();
}
} } | public class class_name {
private static void renewCCTokenAsync(final Jwt jwt) {
// Not expired yet, try to renew async but let requests use the old token.
logger.trace("In renew window but token is not expired yet.");
if(!jwt.isRenewing() || System.currentTimeMillis() > jwt.getEarlyRetryTimeout()) {
jwt.setRenewing(true); // depends on control dependency: [if], data = [none]
jwt.setEarlyRetryTimeout(System.currentTimeMillis() + jwt.getEarlyRefreshRetryDelay()); // depends on control dependency: [if], data = [none]
logger.trace("Retrieve token async is called while token is not expired yet"); // depends on control dependency: [if], data = [none]
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
executor.schedule(() -> {
Result<Jwt> result = getCCTokenRemotely(jwt); // depends on control dependency: [if], data = [none]
if(result.isFailure()) {
// swallow the exception here as it is on a best effort basis.
logger.error("Async retrieve token error with status: {}", result.getError().toString()); // depends on control dependency: [if], data = [none]
}
//set renewing flag to false after response, doesn't matter if it's success or fail.
jwt.setRenewing(false); // depends on control dependency: [if], data = [none]
}, 50, TimeUnit.MILLISECONDS);
executor.shutdown();
}
} } |
public class class_name {
public Object getValue(String k) {
if (values == null) {
return null;
} else {
return values.get(k);
}
} } | public class class_name {
public Object getValue(String k) {
if (values == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
return values.get(k); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public FileUpload[] getFiles(final String paramName) {
if (requestFiles == null) {
return null;
}
return requestFiles.get(paramName);
} } | public class class_name {
public FileUpload[] getFiles(final String paramName) {
if (requestFiles == null) {
return null; // depends on control dependency: [if], data = [none]
}
return requestFiles.get(paramName);
} } |
public class class_name {
@Override
public void clear() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Clearing ISC: " + this);
}
super.clear();
this.bCheckedAcceptEncoding = false;
this.bContainsLargeMessage = false;
this.remoteUser = "";
this.forwardedHeaderInitialized = false;
this.forwardedHost = null;
this.forwardedProto = null;
this.forwardedRemoteAddress = null;
this.forwardedRemotePort = -1;
if (getHttpConfig().runningOnZOS()) {
// @311734 - clean the statemap of the final write mark
getVC().getStateMap().remove(HttpConstants.FINAL_WRITE_MARK);
}
} } | public class class_name {
@Override
public void clear() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Clearing ISC: " + this); // depends on control dependency: [if], data = [none]
}
super.clear();
this.bCheckedAcceptEncoding = false;
this.bContainsLargeMessage = false;
this.remoteUser = "";
this.forwardedHeaderInitialized = false;
this.forwardedHost = null;
this.forwardedProto = null;
this.forwardedRemoteAddress = null;
this.forwardedRemotePort = -1;
if (getHttpConfig().runningOnZOS()) {
// @311734 - clean the statemap of the final write mark
getVC().getStateMap().remove(HttpConstants.FINAL_WRITE_MARK); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static Optional<Exception> tryExecute(final Runnable runnable, final SagaModule module) {
Exception executionException;
try {
runnable.run();
executionException = null;
} catch (Exception ex) {
executionException = ex;
LOG.error("Error executing function on module {}", module, ex);
}
return Optional.ofNullable(executionException);
} } | public class class_name {
private static Optional<Exception> tryExecute(final Runnable runnable, final SagaModule module) {
Exception executionException;
try {
runnable.run(); // depends on control dependency: [try], data = [none]
executionException = null; // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
executionException = ex;
LOG.error("Error executing function on module {}", module, ex);
} // depends on control dependency: [catch], data = [none]
return Optional.ofNullable(executionException);
} } |
public class class_name {
public static BufferedImage multiply(Object bgIm, Object itemIm, int x, int y) {
BufferedImage viewportImage = read(bgIm);
BufferedImage itemImage = read(itemIm);
BufferedImage muImage = new BufferedImage(viewportImage.getWidth(),
viewportImage.getHeight(),
viewportImage.getType());
// 背景图为视口范围,上层图不能超过视口进行绘制, 只有重合部分进行计算叠底
int xMin = x;
int xMax = x + itemImage.getWidth();
int yMin = y;
int yMax = y + itemImage.getHeight();
for (int i = 0; i < viewportImage.getWidth(); i++) {
for (int j = 0; j < viewportImage.getHeight(); j++) {
int rgb = 0;
// 判断是否重合
if (i >= xMin && i < xMax && j >= yMin && j < yMax) {
// 获取两个图rgb值
int vpRGB = viewportImage.getRGB(i, j);
int imRGB = itemImage.getRGB(i - x, j - y);
rgb = Colors.getMultiply(vpRGB, imRGB);
} else {
rgb = viewportImage.getRGB(i, j);
}
muImage.setRGB(i, j, rgb);
}
}
return muImage;
} } | public class class_name {
public static BufferedImage multiply(Object bgIm, Object itemIm, int x, int y) {
BufferedImage viewportImage = read(bgIm);
BufferedImage itemImage = read(itemIm);
BufferedImage muImage = new BufferedImage(viewportImage.getWidth(),
viewportImage.getHeight(),
viewportImage.getType());
// 背景图为视口范围,上层图不能超过视口进行绘制, 只有重合部分进行计算叠底
int xMin = x;
int xMax = x + itemImage.getWidth();
int yMin = y;
int yMax = y + itemImage.getHeight();
for (int i = 0; i < viewportImage.getWidth(); i++) {
for (int j = 0; j < viewportImage.getHeight(); j++) {
int rgb = 0;
// 判断是否重合
if (i >= xMin && i < xMax && j >= yMin && j < yMax) {
// 获取两个图rgb值
int vpRGB = viewportImage.getRGB(i, j);
int imRGB = itemImage.getRGB(i - x, j - y);
rgb = Colors.getMultiply(vpRGB, imRGB); // depends on control dependency: [if], data = [none]
} else {
rgb = viewportImage.getRGB(i, j); // depends on control dependency: [if], data = [(i]
}
muImage.setRGB(i, j, rgb); // depends on control dependency: [for], data = [j]
}
}
return muImage;
} } |
public class class_name {
private static List<String> split(String str) {
List<String> result = new ArrayList<String>();
int genericCount = 0;
int startPos = 0;
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) == ',' && genericCount == 0) {
result.add(str.substring(startPos, i).trim());
startPos = i + 1;
} else if (str.charAt(i) == '<') {
genericCount++;
} else if (str.charAt(i) == '>') {
genericCount--;
}
}
result.add(str.substring(startPos).trim());
return result;
} } | public class class_name {
private static List<String> split(String str) {
List<String> result = new ArrayList<String>();
int genericCount = 0;
int startPos = 0;
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) == ',' && genericCount == 0) {
result.add(str.substring(startPos, i).trim()); // depends on control dependency: [if], data = [none]
startPos = i + 1; // depends on control dependency: [if], data = [none]
} else if (str.charAt(i) == '<') {
genericCount++; // depends on control dependency: [if], data = [none]
} else if (str.charAt(i) == '>') {
genericCount--; // depends on control dependency: [if], data = [none]
}
}
result.add(str.substring(startPos).trim());
return result;
} } |
public class class_name {
public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) {
if (mv != null) {
mv.visitLookupSwitchInsn(dflt, keys, labels);
}
} } | public class class_name {
public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) {
if (mv != null) {
mv.visitLookupSwitchInsn(dflt, keys, labels); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private String getPropertyValueToWrite(Object obj) {
String value;
String valueToWrite = null;
if (obj instanceof List<?>) {
String[] values = {};
values = CmsCollectionsGenericWrapper.list(obj).toArray(values);
// write it
valueToWrite = "\\\n" + createValueString(values);
} else {
value = String.valueOf(obj).trim();
// escape commas and equals in value
value = CmsStringUtil.substitute(value, ",", "\\,");
// value = CmsStringUtil.substitute(value, "=", "\\=");
// write it
valueToWrite = value;
}
return valueToWrite;
} } | public class class_name {
private String getPropertyValueToWrite(Object obj) {
String value;
String valueToWrite = null;
if (obj instanceof List<?>) {
String[] values = {};
values = CmsCollectionsGenericWrapper.list(obj).toArray(values); // depends on control dependency: [if], data = [)]
// write it
valueToWrite = "\\\n" + createValueString(values); // depends on control dependency: [if], data = [)]
} else {
value = String.valueOf(obj).trim(); // depends on control dependency: [if], data = [)]
// escape commas and equals in value
value = CmsStringUtil.substitute(value, ",", "\\,"); // depends on control dependency: [if], data = [)]
// value = CmsStringUtil.substitute(value, "=", "\\=");
// write it
valueToWrite = value; // depends on control dependency: [if], data = [none]
}
return valueToWrite;
} } |
public class class_name {
public static <T> int lowerBound(List<? extends Comparable<? super T>> list,
T key) {
int low = 0;
int high = list.size();
while (low < high) {
int mid = (low + high) >>> 1;
Comparable<? super T> midVal = list.get(mid);
int ret = midVal.compareTo(key);
if (ret < 0)
low = mid + 1;
else high = mid;
}
return low;
} } | public class class_name {
public static <T> int lowerBound(List<? extends Comparable<? super T>> list,
T key) {
int low = 0;
int high = list.size();
while (low < high) {
int mid = (low + high) >>> 1;
Comparable<? super T> midVal = list.get(mid); // depends on control dependency: [while], data = [none]
int ret = midVal.compareTo(key);
if (ret < 0)
low = mid + 1;
else high = mid;
}
return low;
} } |
public class class_name {
private void identifyBonds() {
IAtomContainer spt = getSpanningTree();
IRing ring;
int nBasicRings = 0;
for (int i = 0; i < totalEdgeCount; i++) {
if (!bondsInTree[i]) {
ring = getRing(spt, molecule.getBond(i));
for (int b = 0; b < ring.getBondCount(); b++) {
int m = molecule.indexOf(ring.getBond(b));
cb[nBasicRings][m] = 1;
}
nBasicRings++;
}
}
bondsAcyclicCount = 0;
bondsCyclicCount = 0;
for (int i = 0; i < totalEdgeCount; i++) {
int s = 0;
for (int j = 0; j < nBasicRings; j++) {
s += cb[j][i];
}
switch (s) {
case (0): {
bondsAcyclicCount++;
break;
}
case (1): {
bondsCyclicCount++;
break;
}
default: {
bondsCyclicCount++;
}
}
}
identifiedBonds = true;
} } | public class class_name {
private void identifyBonds() {
IAtomContainer spt = getSpanningTree();
IRing ring;
int nBasicRings = 0;
for (int i = 0; i < totalEdgeCount; i++) {
if (!bondsInTree[i]) {
ring = getRing(spt, molecule.getBond(i)); // depends on control dependency: [if], data = [none]
for (int b = 0; b < ring.getBondCount(); b++) {
int m = molecule.indexOf(ring.getBond(b));
cb[nBasicRings][m] = 1; // depends on control dependency: [for], data = [none]
}
nBasicRings++; // depends on control dependency: [if], data = [none]
}
}
bondsAcyclicCount = 0;
bondsCyclicCount = 0;
for (int i = 0; i < totalEdgeCount; i++) {
int s = 0;
for (int j = 0; j < nBasicRings; j++) {
s += cb[j][i]; // depends on control dependency: [for], data = [j]
}
switch (s) {
case (0): {
bondsAcyclicCount++;
break;
}
case (1): {
bondsCyclicCount++;
break;
}
default: {
bondsCyclicCount++;
}
}
}
identifiedBonds = true;
} } |
public class class_name {
private static EnvVars inherit(@CheckForNull String[] env) {
// convert String[] to Map first
EnvVars m = new EnvVars();
if(env!=null) {
for (String e : env) {
int index = e.indexOf('=');
m.put(e.substring(0,index), e.substring(index+1));
}
}
// then do the inheritance
return inherit(m);
} } | public class class_name {
private static EnvVars inherit(@CheckForNull String[] env) {
// convert String[] to Map first
EnvVars m = new EnvVars();
if(env!=null) {
for (String e : env) {
int index = e.indexOf('=');
m.put(e.substring(0,index), e.substring(index+1)); // depends on control dependency: [for], data = [e]
}
}
// then do the inheritance
return inherit(m);
} } |
public class class_name {
private AppRequestToken issueAppRequestToken(
String serviceTicketBase64Param,
String usernameParam,
AuthEncryptedData authEncryptDataParam)
{
byte[] iv = AES256Local.generateRandom(AES256Local.IV_SIZE_BYTES);
byte[] seed = AES256Local.generateRandom(AES256Local.SEED_SIZE_BYTES);
byte[] sessionKey = UtilGlobal.decodeBase64(
authEncryptDataParam.getSessionKeyBase64());
byte[] dataToEncrypt = usernameParam.getBytes();
byte[] encryptedData = AES256Local.encrypt(
sessionKey,
dataToEncrypt,
iv);
byte[] encryptedDataHMac =
AES256Local.generateLocalHMACForReqToken(encryptedData, sessionKey, seed);
AppRequestToken requestToServer = new AppRequestToken();
requestToServer.setEncryptedDataBase64(UtilGlobal.encodeBase64(encryptedData));
requestToServer.setEncryptedDataHmacBase64(UtilGlobal.encodeBase64(encryptedDataHMac));
requestToServer.setIvBase64(UtilGlobal.encodeBase64(iv));
requestToServer.setSeedBase64(UtilGlobal.encodeBase64(seed));
requestToServer.setServiceTicket(serviceTicketBase64Param);
try {
return new AppRequestToken(
this.postJson(requestToServer, WS.Path.User.Version1.userIssueToken()));
}
//
catch (JSONException jsonExcept) {
throw new FluidClientException(jsonExcept.getMessage(),
jsonExcept, FluidClientException.ErrorCode.JSON_PARSING);
}
} } | public class class_name {
private AppRequestToken issueAppRequestToken(
String serviceTicketBase64Param,
String usernameParam,
AuthEncryptedData authEncryptDataParam)
{
byte[] iv = AES256Local.generateRandom(AES256Local.IV_SIZE_BYTES);
byte[] seed = AES256Local.generateRandom(AES256Local.SEED_SIZE_BYTES);
byte[] sessionKey = UtilGlobal.decodeBase64(
authEncryptDataParam.getSessionKeyBase64());
byte[] dataToEncrypt = usernameParam.getBytes();
byte[] encryptedData = AES256Local.encrypt(
sessionKey,
dataToEncrypt,
iv);
byte[] encryptedDataHMac =
AES256Local.generateLocalHMACForReqToken(encryptedData, sessionKey, seed);
AppRequestToken requestToServer = new AppRequestToken();
requestToServer.setEncryptedDataBase64(UtilGlobal.encodeBase64(encryptedData));
requestToServer.setEncryptedDataHmacBase64(UtilGlobal.encodeBase64(encryptedDataHMac));
requestToServer.setIvBase64(UtilGlobal.encodeBase64(iv));
requestToServer.setSeedBase64(UtilGlobal.encodeBase64(seed));
requestToServer.setServiceTicket(serviceTicketBase64Param);
try {
return new AppRequestToken(
this.postJson(requestToServer, WS.Path.User.Version1.userIssueToken())); // depends on control dependency: [try], data = [none]
}
//
catch (JSONException jsonExcept) {
throw new FluidClientException(jsonExcept.getMessage(),
jsonExcept, FluidClientException.ErrorCode.JSON_PARSING);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void replayLogs(Collection<TransactionLog> logs) {
for (TransactionLog log : logs) {
LOG.info("Replaying edits from transaction log " + log.getName());
int editCnt = 0;
try {
TransactionLogReader reader = log.getReader();
// reader may be null in the case of an empty file
if (reader == null) {
continue;
}
TransactionEdit edit = null;
while ((edit = reader.next()) != null) {
editCnt++;
switch (edit.getState()) {
case INPROGRESS:
long expiration = edit.getExpiration();
TransactionType type = edit.getType();
// Check if transaction needs to be migrated to have expiration and type. Previous version of
// long running transactions were represented with expiration time as -1.
// This can be removed when we stop supporting TransactionEditCodecV2.
if (expiration < 0) {
expiration = getTxExpirationFromWritePointer(edit.getWritePointer(), defaultLongTimeout);
type = TransactionType.LONG;
} else if (type == null) {
type = TransactionType.SHORT;
}
addInProgressAndAdvance(edit.getWritePointer(), edit.getVisibilityUpperBound(),
expiration, type);
break;
case COMMITTING:
addCommittingChangeSet(edit.getWritePointer(), edit.getChanges());
break;
case COMMITTED:
// TODO: need to reconcile usage of transaction id v/s write pointer TEPHRA-140
long transactionId = edit.getWritePointer();
long[] checkpointPointers = edit.getCheckpointPointers();
long writePointer = checkpointPointers == null || checkpointPointers.length == 0 ?
transactionId : checkpointPointers[checkpointPointers.length - 1];
doCommit(transactionId, writePointer, edit.getChanges(),
edit.getCommitPointer(), edit.getCanCommit());
break;
case INVALID:
doInvalidate(edit.getWritePointer());
break;
case ABORTED:
type = edit.getType();
// Check if transaction edit needs to be migrated to have type. Previous versions of
// ABORTED edits did not contain type.
// This can be removed when we stop supporting TransactionEditCodecV2.
if (type == null) {
InProgressTx inProgressTx = inProgress.get(edit.getWritePointer());
if (inProgressTx != null) {
type = inProgressTx.getType();
} else {
// If transaction is not in-progress, then it has either been already aborted or invalidated.
// We cannot determine the transaction's state based on current information, to be safe invalidate it.
LOG.warn("Invalidating transaction {} as it's type cannot be determined during replay",
edit.getWritePointer());
doInvalidate(edit.getWritePointer());
break;
}
}
doAbort(edit.getWritePointer(), edit.getCheckpointPointers(), type);
break;
case TRUNCATE_INVALID_TX:
if (edit.getTruncateInvalidTxTime() != 0) {
doTruncateInvalidTxBefore(edit.getTruncateInvalidTxTime());
} else {
doTruncateInvalidTx(edit.getTruncateInvalidTx());
}
break;
case CHECKPOINT:
doCheckpoint(edit.getWritePointer(), edit.getParentWritePointer());
break;
default:
// unknown type!
throw new IllegalArgumentException("Invalid state for WAL entry: " + edit.getState());
}
}
} catch (IOException ioe) {
throw Throwables.propagate(ioe);
} catch (InvalidTruncateTimeException e) {
throw Throwables.propagate(e);
}
LOG.info("Read " + editCnt + " edits from log " + log.getName());
}
} } | public class class_name {
private void replayLogs(Collection<TransactionLog> logs) {
for (TransactionLog log : logs) {
LOG.info("Replaying edits from transaction log " + log.getName());
int editCnt = 0;
try {
TransactionLogReader reader = log.getReader();
// reader may be null in the case of an empty file
if (reader == null) {
continue;
}
TransactionEdit edit = null;
while ((edit = reader.next()) != null) {
editCnt++;
switch (edit.getState()) {
case INPROGRESS:
long expiration = edit.getExpiration();
TransactionType type = edit.getType();
// Check if transaction needs to be migrated to have expiration and type. Previous version of
// long running transactions were represented with expiration time as -1.
// This can be removed when we stop supporting TransactionEditCodecV2.
if (expiration < 0) {
expiration = getTxExpirationFromWritePointer(edit.getWritePointer(), defaultLongTimeout); // depends on control dependency: [if], data = [none]
type = TransactionType.LONG; // depends on control dependency: [if], data = [none]
} else if (type == null) {
type = TransactionType.SHORT; // depends on control dependency: [if], data = [none]
}
addInProgressAndAdvance(edit.getWritePointer(), edit.getVisibilityUpperBound(),
expiration, type);
break;
case COMMITTING:
addCommittingChangeSet(edit.getWritePointer(), edit.getChanges());
break;
case COMMITTED:
// TODO: need to reconcile usage of transaction id v/s write pointer TEPHRA-140
long transactionId = edit.getWritePointer();
long[] checkpointPointers = edit.getCheckpointPointers();
long writePointer = checkpointPointers == null || checkpointPointers.length == 0 ?
transactionId : checkpointPointers[checkpointPointers.length - 1];
doCommit(transactionId, writePointer, edit.getChanges(),
edit.getCommitPointer(), edit.getCanCommit());
break;
case INVALID:
doInvalidate(edit.getWritePointer());
break;
case ABORTED:
type = edit.getType();
// Check if transaction edit needs to be migrated to have type. Previous versions of
// ABORTED edits did not contain type.
// This can be removed when we stop supporting TransactionEditCodecV2.
if (type == null) {
InProgressTx inProgressTx = inProgress.get(edit.getWritePointer());
if (inProgressTx != null) {
type = inProgressTx.getType();
} else {
// If transaction is not in-progress, then it has either been already aborted or invalidated.
// We cannot determine the transaction's state based on current information, to be safe invalidate it.
LOG.warn("Invalidating transaction {} as it's type cannot be determined during replay",
edit.getWritePointer());
doInvalidate(edit.getWritePointer());
break;
}
}
doAbort(edit.getWritePointer(), edit.getCheckpointPointers(), type);
break;
case TRUNCATE_INVALID_TX:
if (edit.getTruncateInvalidTxTime() != 0) {
doTruncateInvalidTxBefore(edit.getTruncateInvalidTxTime());
} else {
doTruncateInvalidTx(edit.getTruncateInvalidTx());
}
break;
case CHECKPOINT:
doCheckpoint(edit.getWritePointer(), edit.getParentWritePointer());
break;
default:
// unknown type!
throw new IllegalArgumentException("Invalid state for WAL entry: " + edit.getState());
}
}
} catch (IOException ioe) {
throw Throwables.propagate(ioe);
} catch (InvalidTruncateTimeException e) {
throw Throwables.propagate(e);
}
LOG.info("Read " + editCnt + " edits from log " + log.getName());
}
} } |
public class class_name {
public void marshall(Scte35TimeSignalScheduleActionSettings scte35TimeSignalScheduleActionSettings, ProtocolMarshaller protocolMarshaller) {
if (scte35TimeSignalScheduleActionSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(scte35TimeSignalScheduleActionSettings.getScte35Descriptors(), SCTE35DESCRIPTORS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Scte35TimeSignalScheduleActionSettings scte35TimeSignalScheduleActionSettings, ProtocolMarshaller protocolMarshaller) {
if (scte35TimeSignalScheduleActionSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(scte35TimeSignalScheduleActionSettings.getScte35Descriptors(), SCTE35DESCRIPTORS_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 static String chop(String target) {
if (isEmpty(target)) { return EMPTY; }
int len = target.length(), lastIdx = -1;
if (len >= 2 && target.charAt(len - 1) == LF && target.charAt(len - 2) == CR) {
if (len == 2) { return EMPTY; } lastIdx = -2;
}
return replace(target).afters(lastIdx).byNone().last();
} } | public class class_name {
public static String chop(String target) {
if (isEmpty(target)) { return EMPTY; } // depends on control dependency: [if], data = [none]
int len = target.length(), lastIdx = -1;
if (len >= 2 && target.charAt(len - 1) == LF && target.charAt(len - 2) == CR) {
if (len == 2) { return EMPTY; } lastIdx = -2; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
return replace(target).afters(lastIdx).byNone().last();
} } |
public class class_name {
public void setHeader(String name, String s, boolean checkInclude) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.entering(CLASS_NAME,"setHeader", " name --> " + name + " value --> " + PasswordNullifier.nullifyParams(s) + " checkInclude --> " + checkInclude + " ["+this+"]");
}
// d151464 - check the include flag
WebAppDispatcherContext dispatchContext = (WebAppDispatcherContext) getRequest().getWebAppDispatcherContext();
if (checkInclude&&dispatchContext.isInclude() == true) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"setHeader", nls.getString("Illegal.from.included.servlet", "Illegal from included servlet"), "setHeader name --> " + name + " value --> " + PasswordNullifier.nullifyParams(s) + " checkInclude --> " + checkInclude); //311717
}
}
else {
// make sure we don't have a null name...
if (name == null) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.exiting(CLASS_NAME,"setHeader","name is null");
}
return;
}
// d128646 - if we're not ignoring state errors and response is committed or closed, throw an exception
if (!_ignoreStateErrors && isCommitted()) {
// log a warning (only the first time)...ignore headers set after response is committed
IServletWrapper wrapper = dispatchContext.getCurrentServletReference();
if (logWarningActionNow(wrapper)) {
Throwable t = new Throwable();
logAlreadyCommittedWarning(t, "setHeader");
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.exiting(CLASS_NAME,"setHeader","Response already committed");
}
return;
}
if (s == null) {
removeHeader(name);
}
else {
if (name.equalsIgnoreCase(WebContainerConstants.HEADER_CONTENT_TYPE)) {
// need to specially handle the content-type header
String value = s.toLowerCase();
int index = value.indexOf("charset=");
if (index != -1) {
_encoding = s.substring(index + 8);
s = s.substring(0, index) + "charset=" + _encoding;
}
else {
if (dispatchContext.isAutoRequestEncoding()) { //306998.15
// only set default charset if auto response encoding is true.
// otherwise cts test will fail.
if (s.endsWith(";")) {
s = s + "charset=" + getCharacterEncoding();
}
else {
s = s + ";charset=" + getCharacterEncoding();
}
}
}
_contentType = s;
}
_response.setHeader(name, s);
}
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.exiting(CLASS_NAME,"setHeader", " name --> " + name + " value --> " + PasswordNullifier.nullifyParams(s));
}
} } | public class class_name {
public void setHeader(String name, String s, boolean checkInclude) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.entering(CLASS_NAME,"setHeader", " name --> " + name + " value --> " + PasswordNullifier.nullifyParams(s) + " checkInclude --> " + checkInclude + " ["+this+"]"); // depends on control dependency: [if], data = [none]
}
// d151464 - check the include flag
WebAppDispatcherContext dispatchContext = (WebAppDispatcherContext) getRequest().getWebAppDispatcherContext();
if (checkInclude&&dispatchContext.isInclude() == true) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"setHeader", nls.getString("Illegal.from.included.servlet", "Illegal from included servlet"), "setHeader name --> " + name + " value --> " + PasswordNullifier.nullifyParams(s) + " checkInclude --> " + checkInclude); //311717 // depends on control dependency: [if], data = [none]
}
}
else {
// make sure we don't have a null name...
if (name == null) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.exiting(CLASS_NAME,"setHeader","name is null"); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
// d128646 - if we're not ignoring state errors and response is committed or closed, throw an exception
if (!_ignoreStateErrors && isCommitted()) {
// log a warning (only the first time)...ignore headers set after response is committed
IServletWrapper wrapper = dispatchContext.getCurrentServletReference();
if (logWarningActionNow(wrapper)) {
Throwable t = new Throwable();
logAlreadyCommittedWarning(t, "setHeader"); // depends on control dependency: [if], data = [none]
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.exiting(CLASS_NAME,"setHeader","Response already committed"); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
if (s == null) {
removeHeader(name); // depends on control dependency: [if], data = [none]
}
else {
if (name.equalsIgnoreCase(WebContainerConstants.HEADER_CONTENT_TYPE)) {
// need to specially handle the content-type header
String value = s.toLowerCase();
int index = value.indexOf("charset=");
if (index != -1) {
_encoding = s.substring(index + 8); // depends on control dependency: [if], data = [(index]
s = s.substring(0, index) + "charset=" + _encoding; // depends on control dependency: [if], data = [none]
}
else {
if (dispatchContext.isAutoRequestEncoding()) { //306998.15
// only set default charset if auto response encoding is true.
// otherwise cts test will fail.
if (s.endsWith(";")) {
s = s + "charset=" + getCharacterEncoding(); // depends on control dependency: [if], data = [none]
}
else {
s = s + ";charset=" + getCharacterEncoding(); // depends on control dependency: [if], data = [none]
}
}
}
_contentType = s; // depends on control dependency: [if], data = [none]
}
_response.setHeader(name, s); // depends on control dependency: [if], data = [none]
}
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.exiting(CLASS_NAME,"setHeader", " name --> " + name + " value --> " + PasswordNullifier.nullifyParams(s)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public <T> Constructor<T> createConstructor() {
try {
return this.<T>createClass().getConstructor(InvocationHandler.class);
} catch (NoSuchMethodException noSuchMethodException) {
throw new ProxyException(noSuchMethodException);
}
} } | public class class_name {
public <T> Constructor<T> createConstructor() {
try {
return this.<T>createClass().getConstructor(InvocationHandler.class); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException noSuchMethodException) {
throw new ProxyException(noSuchMethodException);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public JobListPreparationAndReleaseTaskStatusNextOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null;
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate);
}
return this;
} } | public class class_name {
public JobListPreparationAndReleaseTaskStatusNextOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null; // depends on control dependency: [if], data = [none]
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate]
}
return this;
} } |
public class class_name {
public Location getExceptionThrowerLocation(Edge exceptionEdge) {
if (!exceptionEdge.isExceptionEdge()) {
throw new IllegalArgumentException();
}
InstructionHandle handle = exceptionEdge.getSource().getExceptionThrower();
if (handle == null) {
throw new IllegalStateException();
}
BasicBlock basicBlock = (handle.getInstruction() instanceof ATHROW) ? exceptionEdge.getSource()
: getSuccessorWithEdgeType(exceptionEdge.getSource(), EdgeTypes.FALL_THROUGH_EDGE);
if (basicBlock == null && removedEdgeList != null) {
// The fall-through edge might have been removed during
// CFG pruning. Look for it in the removed edge list.
for (Edge removedEdge : removedEdgeList) {
if (removedEdge.getType() == EdgeTypes.FALL_THROUGH_EDGE
&& removedEdge.getSource() == exceptionEdge.getSource()) {
basicBlock = removedEdge.getTarget();
break;
}
}
}
if (basicBlock == null) {
throw new IllegalStateException("No basic block for thrower " + handle + " in " + this.methodGen.getClassName() + "."
+ this.methodName + " : " + this.methodGen.getSignature());
}
return new Location(handle, basicBlock);
} } | public class class_name {
public Location getExceptionThrowerLocation(Edge exceptionEdge) {
if (!exceptionEdge.isExceptionEdge()) {
throw new IllegalArgumentException();
}
InstructionHandle handle = exceptionEdge.getSource().getExceptionThrower();
if (handle == null) {
throw new IllegalStateException();
}
BasicBlock basicBlock = (handle.getInstruction() instanceof ATHROW) ? exceptionEdge.getSource()
: getSuccessorWithEdgeType(exceptionEdge.getSource(), EdgeTypes.FALL_THROUGH_EDGE);
if (basicBlock == null && removedEdgeList != null) {
// The fall-through edge might have been removed during
// CFG pruning. Look for it in the removed edge list.
for (Edge removedEdge : removedEdgeList) {
if (removedEdge.getType() == EdgeTypes.FALL_THROUGH_EDGE
&& removedEdge.getSource() == exceptionEdge.getSource()) {
basicBlock = removedEdge.getTarget(); // depends on control dependency: [if], data = [none]
break;
}
}
}
if (basicBlock == null) {
throw new IllegalStateException("No basic block for thrower " + handle + " in " + this.methodGen.getClassName() + "."
+ this.methodName + " : " + this.methodGen.getSignature());
}
return new Location(handle, basicBlock);
} } |
public class class_name {
protected void createSamplePoints(int numSamples) {
for( int y = 0; y < numSamples; y++ ) {
float regionY = (y/(numSamples-1.0f) - 0.5f);
for( int x = 0; x < numSamples; x++ ) {
float regionX = (x/(numSamples-1.0f) - 0.5f);
samplePts.add( new Point2D_F32(regionX,regionY));
}
}
} } | public class class_name {
protected void createSamplePoints(int numSamples) {
for( int y = 0; y < numSamples; y++ ) {
float regionY = (y/(numSamples-1.0f) - 0.5f);
for( int x = 0; x < numSamples; x++ ) {
float regionX = (x/(numSamples-1.0f) - 0.5f);
samplePts.add( new Point2D_F32(regionX,regionY)); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public void remove(@NonNull T object) {
synchronized (mLock) {
final int position = getPosition(object);
final boolean removed = mObjects.remove(object);
if (removed) {
notifyItemRemoved(position);
}
}
} } | public class class_name {
public void remove(@NonNull T object) {
synchronized (mLock) {
final int position = getPosition(object);
final boolean removed = mObjects.remove(object);
if (removed) {
notifyItemRemoved(position); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private Content processParamTag(boolean isNonTypeParams,
TagletWriter writer, ParamTag paramTag, String name,
boolean isFirstParam) {
Content result = writer.getOutputInstance();
String header = writer.configuration().getText(
isNonTypeParams ? "doclet.Parameters" : "doclet.TypeParameters");
if (isFirstParam) {
result.addContent(writer.getParamHeader(header));
}
result.addContent(writer.paramTagOutput(paramTag,
name));
return result;
} } | public class class_name {
private Content processParamTag(boolean isNonTypeParams,
TagletWriter writer, ParamTag paramTag, String name,
boolean isFirstParam) {
Content result = writer.getOutputInstance();
String header = writer.configuration().getText(
isNonTypeParams ? "doclet.Parameters" : "doclet.TypeParameters");
if (isFirstParam) {
result.addContent(writer.getParamHeader(header)); // depends on control dependency: [if], data = [none]
}
result.addContent(writer.paramTagOutput(paramTag,
name));
return result;
} } |
public class class_name {
@Override
public void remove() {
final OrientBaseGraph graph = getGraph();
if (!isLightweight())
checkClass();
graph.setCurrentGraphInThreadLocal();
graph.autoStartTransaction();
for (final Index<? extends Element> index : graph.getIndices()) {
if (Edge.class.isAssignableFrom(index.getIndexClass())) {
OrientIndex<OrientEdge> idx = (OrientIndex<OrientEdge>) index;
idx.removeElement(this);
}
}
if (graph != null)
graph.removeEdgeInternal(this);
else
// IN MEMORY CHANGES ONLY: USE NOTX CLASS
OrientGraphNoTx.removeEdgeInternal(null, this);
} } | public class class_name {
@Override
public void remove() {
final OrientBaseGraph graph = getGraph();
if (!isLightweight())
checkClass();
graph.setCurrentGraphInThreadLocal();
graph.autoStartTransaction();
for (final Index<? extends Element> index : graph.getIndices()) {
if (Edge.class.isAssignableFrom(index.getIndexClass())) {
OrientIndex<OrientEdge> idx = (OrientIndex<OrientEdge>) index;
idx.removeElement(this); // depends on control dependency: [if], data = [none]
}
}
if (graph != null)
graph.removeEdgeInternal(this);
else
// IN MEMORY CHANGES ONLY: USE NOTX CLASS
OrientGraphNoTx.removeEdgeInternal(null, this);
} } |
public class class_name {
public static int getAgeByIdCard(String idCard) {
int iAge;
if (idCard.length() == CHINA_ID_MIN_LENGTH) {
idCard = conver15CardTo18(idCard);
}
String year = idCard.substring(6, 10);
Calendar cal = Calendar.getInstance();
int iCurrYear = cal.get(Calendar.YEAR);
iAge = iCurrYear - Integer.valueOf(year);
return iAge;
} } | public class class_name {
public static int getAgeByIdCard(String idCard) {
int iAge;
if (idCard.length() == CHINA_ID_MIN_LENGTH) {
idCard = conver15CardTo18(idCard); // depends on control dependency: [if], data = [none]
}
String year = idCard.substring(6, 10);
Calendar cal = Calendar.getInstance();
int iCurrYear = cal.get(Calendar.YEAR);
iAge = iCurrYear - Integer.valueOf(year);
return iAge;
} } |
public class class_name {
public void add(IdentityByState param) {
for (int i = 0; i < ibs.length; i++) {
ibs[i] += param.ibs[i];
}
} } | public class class_name {
public void add(IdentityByState param) {
for (int i = 0; i < ibs.length; i++) {
ibs[i] += param.ibs[i]; // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
Event createFailedEvent(Throwable t) {
synchronized (terminated) {
if (terminated.get()) {
return null;
}
if (setState(State.FAILED)) {
installer.removeWabFromEligibleForCollisionResolution(this);
installer.attemptRedeployOfPreviouslyCollidedContextPath(this.wabContextPath);
return createEvent(State.FAILED, t, null, null);
}
}
return null;
} } | public class class_name {
Event createFailedEvent(Throwable t) {
synchronized (terminated) {
if (terminated.get()) {
return null; // depends on control dependency: [if], data = [none]
}
if (setState(State.FAILED)) {
installer.removeWabFromEligibleForCollisionResolution(this); // depends on control dependency: [if], data = [none]
installer.attemptRedeployOfPreviouslyCollidedContextPath(this.wabContextPath); // depends on control dependency: [if], data = [none]
return createEvent(State.FAILED, t, null, null); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static List<UserCustomColumn> createRequiredColumns(
int startingIndex, String idColumnName) {
if (idColumnName == null) {
idColumnName = COLUMN_ID;
}
List<UserCustomColumn> columns = new ArrayList<>();
columns.add(createIdColumn(startingIndex++, idColumnName));
columns.add(createDataColumn(startingIndex++));
columns.add(createContentTypeColumn(startingIndex++));
return columns;
} } | public class class_name {
public static List<UserCustomColumn> createRequiredColumns(
int startingIndex, String idColumnName) {
if (idColumnName == null) {
idColumnName = COLUMN_ID; // depends on control dependency: [if], data = [none]
}
List<UserCustomColumn> columns = new ArrayList<>();
columns.add(createIdColumn(startingIndex++, idColumnName));
columns.add(createDataColumn(startingIndex++));
columns.add(createContentTypeColumn(startingIndex++));
return columns;
} } |
public class class_name {
@SuppressWarnings("unchecked")
private LinkedHashMap<String, XMLObject> initializeSession() {
Optional<LinkedHashMap<String, XMLObject>> messages = (Optional<LinkedHashMap<String, XMLObject>>)
context.getSessionStore().get(context, SAML_STORAGE_KEY);
if (!messages.isPresent()) {
synchronized (context) {
messages = (Optional<LinkedHashMap<String, XMLObject>>) context.getSessionStore().get(context, SAML_STORAGE_KEY);
if (!messages.isPresent()) {
messages = Optional.of(new LinkedHashMap<>());
updateSession(messages.get());
}
}
}
return messages.get();
} } | public class class_name {
@SuppressWarnings("unchecked")
private LinkedHashMap<String, XMLObject> initializeSession() {
Optional<LinkedHashMap<String, XMLObject>> messages = (Optional<LinkedHashMap<String, XMLObject>>)
context.getSessionStore().get(context, SAML_STORAGE_KEY);
if (!messages.isPresent()) {
synchronized (context) { // depends on control dependency: [if], data = [none]
messages = (Optional<LinkedHashMap<String, XMLObject>>) context.getSessionStore().get(context, SAML_STORAGE_KEY);
if (!messages.isPresent()) {
messages = Optional.of(new LinkedHashMap<>()); // depends on control dependency: [if], data = [none]
updateSession(messages.get()); // depends on control dependency: [if], data = [none]
}
}
}
return messages.get();
} } |
public class class_name {
@DataProvider(name = "generateData")
Object[][] generateData() {
final Random ran = new Random();
final Object[][] intData = new Object[Config.RUNS][];
for (int i = 0; i < intData.length; i++) {
final List<Integer> data = new ArrayList<Integer>();
int counter = 0;
while (counter < ARRAYSIZE) {
data.add(ran.nextInt());
counter++;
}
intData[i] = new Object[]{data};
}
return intData;
} } | public class class_name {
@DataProvider(name = "generateData")
Object[][] generateData() {
final Random ran = new Random();
final Object[][] intData = new Object[Config.RUNS][];
for (int i = 0; i < intData.length; i++) {
final List<Integer> data = new ArrayList<Integer>();
int counter = 0;
while (counter < ARRAYSIZE) {
data.add(ran.nextInt()); // depends on control dependency: [while], data = [none]
counter++; // depends on control dependency: [while], data = [none]
}
intData[i] = new Object[]{data}; // depends on control dependency: [for], data = [i]
}
return intData;
} } |
public class class_name {
public static void installInOneColumn(JTable table, int colViewIndex, int alignment) {
TableColumn tableColumn = table.getColumnModel().getColumn(colViewIndex);
TableCellRenderer headerRenderer = tableColumn.getHeaderRenderer();
if (headerRenderer == null) {
headerRenderer = table.getTableHeader().getDefaultRenderer();
}
if (!(headerRenderer instanceof RendererAlignmentDecorator)) { // Don't install a redundant decorator.
tableColumn.setHeaderRenderer(new RendererAlignmentDecorator(headerRenderer, alignment));
}
TableCellRenderer cellRenderer = tableColumn.getCellRenderer();
if (cellRenderer == null) {
cellRenderer = table.getDefaultRenderer(table.getColumnClass(colViewIndex));
}
if (!(cellRenderer instanceof RendererAlignmentDecorator)) { // Don't install a redundant decorator.
tableColumn.setCellRenderer(new RendererAlignmentDecorator(cellRenderer, alignment));
}
} } | public class class_name {
public static void installInOneColumn(JTable table, int colViewIndex, int alignment) {
TableColumn tableColumn = table.getColumnModel().getColumn(colViewIndex);
TableCellRenderer headerRenderer = tableColumn.getHeaderRenderer();
if (headerRenderer == null) {
headerRenderer = table.getTableHeader().getDefaultRenderer(); // depends on control dependency: [if], data = [none]
}
if (!(headerRenderer instanceof RendererAlignmentDecorator)) { // Don't install a redundant decorator.
tableColumn.setHeaderRenderer(new RendererAlignmentDecorator(headerRenderer, alignment)); // depends on control dependency: [if], data = [none]
}
TableCellRenderer cellRenderer = tableColumn.getCellRenderer();
if (cellRenderer == null) {
cellRenderer = table.getDefaultRenderer(table.getColumnClass(colViewIndex)); // depends on control dependency: [if], data = [none]
}
if (!(cellRenderer instanceof RendererAlignmentDecorator)) { // Don't install a redundant decorator.
tableColumn.setCellRenderer(new RendererAlignmentDecorator(cellRenderer, alignment)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public boolean onEvent(EventMessage<?> event) {
AuthorizationResultEvent resultEvent;
if (!(event.getPayload() instanceof AuthorizationResultEvent)) {
// not the right type of event... not 'handled'
return false;
}
resultEvent = (AuthorizationResultEvent) event.getPayload();
Transaction transaction = domainService.createTransaction(startTransactionInfo.getEvseId());
NumberedTransactionId transactionId = new NumberedTransactionId(chargingStationId, protocolIdentifier, transaction.getId().intValue());
IdentifyingToken identifyingToken = resultEvent.getIdentifyingToken();
StartTransactionInfo extendedStartTransactionInfo = new StartTransactionInfo(startTransactionInfo.getEvseId(), startTransactionInfo.getMeterStart(), startTransactionInfo.getTimestamp(), identifyingToken, startTransactionInfo.getAttributes());
domainService.startTransactionNoAuthorize(chargingStationId, transactionId, extendedStartTransactionInfo, addOnIdentity);
IdTagInfo__ idTagInfo = new IdTagInfo__();
idTagInfo.setStatus(convert(resultEvent.getAuthenticationStatus()));
StarttransactionResponse response = new StarttransactionResponse();
response.setTransactionId(transactionId.getNumber());
response.setIdTagInfo(idTagInfo);
writeResult(response);
return true;
} } | public class class_name {
@Override
public boolean onEvent(EventMessage<?> event) {
AuthorizationResultEvent resultEvent;
if (!(event.getPayload() instanceof AuthorizationResultEvent)) {
// not the right type of event... not 'handled'
return false; // depends on control dependency: [if], data = [none]
}
resultEvent = (AuthorizationResultEvent) event.getPayload();
Transaction transaction = domainService.createTransaction(startTransactionInfo.getEvseId());
NumberedTransactionId transactionId = new NumberedTransactionId(chargingStationId, protocolIdentifier, transaction.getId().intValue());
IdentifyingToken identifyingToken = resultEvent.getIdentifyingToken();
StartTransactionInfo extendedStartTransactionInfo = new StartTransactionInfo(startTransactionInfo.getEvseId(), startTransactionInfo.getMeterStart(), startTransactionInfo.getTimestamp(), identifyingToken, startTransactionInfo.getAttributes());
domainService.startTransactionNoAuthorize(chargingStationId, transactionId, extendedStartTransactionInfo, addOnIdentity);
IdTagInfo__ idTagInfo = new IdTagInfo__();
idTagInfo.setStatus(convert(resultEvent.getAuthenticationStatus()));
StarttransactionResponse response = new StarttransactionResponse();
response.setTransactionId(transactionId.getNumber());
response.setIdTagInfo(idTagInfo);
writeResult(response);
return true;
} } |
public class class_name {
private int binaryFindDelete(
int lower,
int upper,
Object delKey)
{
java.util.Comparator comp = insertComparator();
int xcc; /* Current compare result */
int i;
int idx = -1; /* Returned index (-1 if not found) */
while (lower <= upper) /* Until they cross */
{
i = (lower + upper) >>> 1; /* Mid-point of current range */
xcc = comp.compare(delKey, _nodeKey[i]);
if (xcc < 0) /* SEARCH_KEY < NODE_KEY */
upper = i - 1; /* Discard upper half of range */
else /* SEARCH_KEY >= NODE_KEY */
{
if (xcc > 0) /* SEARCH_KEY > NODE_KEY */
lower = i + 1; /* Discard lower half of range */
else /* SEARCH_KEY FOUND */
{
idx = i; /* Remember the index */
break; /* We're done */
}
}
}
return idx;
} } | public class class_name {
private int binaryFindDelete(
int lower,
int upper,
Object delKey)
{
java.util.Comparator comp = insertComparator();
int xcc; /* Current compare result */
int i;
int idx = -1; /* Returned index (-1 if not found) */
while (lower <= upper) /* Until they cross */
{
i = (lower + upper) >>> 1; /* Mid-point of current range */ // depends on control dependency: [while], data = [(lower]
xcc = comp.compare(delKey, _nodeKey[i]); // depends on control dependency: [while], data = [none]
if (xcc < 0) /* SEARCH_KEY < NODE_KEY */
upper = i - 1; /* Discard upper half of range */
else /* SEARCH_KEY >= NODE_KEY */
{
if (xcc > 0) /* SEARCH_KEY > NODE_KEY */
lower = i + 1; /* Discard lower half of range */
else /* SEARCH_KEY FOUND */
{
idx = i; /* Remember the index */ // depends on control dependency: [if], data = [none]
break; /* We're done */
}
}
}
return idx;
} } |
public class class_name {
public static boolean areOverloadedJSONExpressionLists(
String jsontext1, String jsontext2) {
try {
List<AbstractExpression> list1 = fromJSONArrayString(jsontext1, null);
List<AbstractExpression> list2 = fromJSONArrayString(jsontext2, null);
return list1.equals(list2);
}
catch (JSONException je) {
return false;
}
} } | public class class_name {
public static boolean areOverloadedJSONExpressionLists(
String jsontext1, String jsontext2) {
try {
List<AbstractExpression> list1 = fromJSONArrayString(jsontext1, null);
List<AbstractExpression> list2 = fromJSONArrayString(jsontext2, null);
return list1.equals(list2); // depends on control dependency: [try], data = [none]
}
catch (JSONException je) {
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public int sizeOfIn(String expr, Map<String, Object> map) {
int result;
Object val = getValue(map, expr);
if (val instanceof Map) {
result = ((Map) val).size();
} else if (val instanceof Collection) {
result = ((Collection) val).size();
} else {
throw new SlimFixtureException(false, expr + " is not a collection");
}
return result;
} } | public class class_name {
public int sizeOfIn(String expr, Map<String, Object> map) {
int result;
Object val = getValue(map, expr);
if (val instanceof Map) {
result = ((Map) val).size(); // depends on control dependency: [if], data = [none]
} else if (val instanceof Collection) {
result = ((Collection) val).size(); // depends on control dependency: [if], data = [none]
} else {
throw new SlimFixtureException(false, expr + " is not a collection");
}
return result;
} } |
public class class_name {
public StatementGroup copy(StatementGroup object) {
List<Statement> statements = new ArrayList<>(object.getStatements().size());
for (Statement statement : object.getStatements()) {
statements.add(copy(statement));
}
return dataObjectFactory.getStatementGroup(statements);
} } | public class class_name {
public StatementGroup copy(StatementGroup object) {
List<Statement> statements = new ArrayList<>(object.getStatements().size());
for (Statement statement : object.getStatements()) {
statements.add(copy(statement)); // depends on control dependency: [for], data = [statement]
}
return dataObjectFactory.getStatementGroup(statements);
} } |
public class class_name {
@Override
public void setID(String id){
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify a frozen OlsonTimeZone instance.");
}
// Before updating the ID, preserve the original ID's canonical ID.
if (canonicalID == null) {
canonicalID = getCanonicalID(getID());
assert(canonicalID != null);
if (canonicalID == null) {
// This should never happen...
canonicalID = getID();
}
}
if (finalZone != null){
finalZone.setID(id);
}
super.setID(id);
transitionRulesInitialized = false;
} } | public class class_name {
@Override
public void setID(String id){
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify a frozen OlsonTimeZone instance.");
}
// Before updating the ID, preserve the original ID's canonical ID.
if (canonicalID == null) {
canonicalID = getCanonicalID(getID()); // depends on control dependency: [if], data = [none]
assert(canonicalID != null); // depends on control dependency: [if], data = [(canonicalID]
if (canonicalID == null) {
// This should never happen...
canonicalID = getID(); // depends on control dependency: [if], data = [none]
}
}
if (finalZone != null){
finalZone.setID(id); // depends on control dependency: [if], data = [none]
}
super.setID(id);
transitionRulesInitialized = false;
} } |
public class class_name {
@Override
public void evaluate(DoubleSolution solution) {
int numberOfVariables = solution.getNumberOfVariables();
int numberOfObjectives = solution.getNumberOfObjectives();
double[] x = new double[numberOfVariables];
double[] f = new double[numberOfObjectives];
for (int i = 0; i < numberOfVariables; i++) {
x[i] = solution.getVariableValue(i);
}
// change x
for (int i = numberOfObjectives - 1; i < numberOfVariables; i++) {
x[i] = (1 + Math.cos((i + 1) / (double) numberOfVariables * Math.PI / 2)) * x[i] - 10 * x[0];
}
// evaluate eta,g
double[] g = new double[numberOfObjectives];
double sub1;
for (int i = 0; i < numberOfObjectives; i = i + 2) {
double[] tx = new double[sublen15[i]];
sub1 = 0;
for (int j = 0; j < nk15; j++) {
System
.arraycopy(x, len15[i] + numberOfObjectives - 1 + j * sublen15[i], tx, 0, sublen15[i]);
sub1 += Griewank(tx);
}
g[i] = sub1 / (nk15 * sublen15[i]);
}
for (int i = 1; i < numberOfObjectives; i = i + 2) {
double[] tx = new double[sublen15[i]];
sub1 = 0;
for (int j = 0; j < nk15; j++) {
System
.arraycopy(x, len15[i] + numberOfObjectives - 1 + j * sublen15[i], tx, 0, sublen15[i]);
sub1 += Sphere(tx);
}
g[i] = sub1 / (nk15 * sublen15[i]);
}
// evaluate fm,fm-1,...,2,f1
double subf1 = 1;
f[numberOfObjectives - 1] =
(1 - Math.sin(Math.PI * x[0] / 2)) * (1 + g[numberOfObjectives - 1]);
for (int i = numberOfObjectives - 2; i > 0; i--) {
subf1 *= Math.cos(Math.PI * x[numberOfObjectives - i - 2] / 2);
f[i] = (1 - subf1 * Math.sin(Math.PI * x[numberOfObjectives - i - 1] / 2)) * (1 + g[i] + g[i
+ 1]);
}
f[0] = (1 - subf1 * Math.cos(Math.PI * x[numberOfObjectives - 2] / 2)) * (1 + g[0] + g[1]);
for (int i = 0; i < numberOfObjectives; i++) {
solution.setObjective(i, f[i]);
}
} } | public class class_name {
@Override
public void evaluate(DoubleSolution solution) {
int numberOfVariables = solution.getNumberOfVariables();
int numberOfObjectives = solution.getNumberOfObjectives();
double[] x = new double[numberOfVariables];
double[] f = new double[numberOfObjectives];
for (int i = 0; i < numberOfVariables; i++) {
x[i] = solution.getVariableValue(i);
// depends on control dependency: [for], data = [i]
}
// change x
for (int i = numberOfObjectives - 1; i < numberOfVariables; i++) {
x[i] = (1 + Math.cos((i + 1) / (double) numberOfVariables * Math.PI / 2)) * x[i] - 10 * x[0];
// depends on control dependency: [for], data = [i]
}
// evaluate eta,g
double[] g = new double[numberOfObjectives];
double sub1;
for (int i = 0; i < numberOfObjectives; i = i + 2) {
double[] tx = new double[sublen15[i]];
sub1 = 0;
// depends on control dependency: [for], data = [none]
for (int j = 0; j < nk15; j++) {
System
.arraycopy(x, len15[i] + numberOfObjectives - 1 + j * sublen15[i], tx, 0, sublen15[i]);
// depends on control dependency: [for], data = [none]
sub1 += Griewank(tx);
// depends on control dependency: [for], data = [none]
}
g[i] = sub1 / (nk15 * sublen15[i]);
// depends on control dependency: [for], data = [i]
}
for (int i = 1; i < numberOfObjectives; i = i + 2) {
double[] tx = new double[sublen15[i]];
sub1 = 0;
// depends on control dependency: [for], data = [none]
for (int j = 0; j < nk15; j++) {
System
.arraycopy(x, len15[i] + numberOfObjectives - 1 + j * sublen15[i], tx, 0, sublen15[i]);
// depends on control dependency: [for], data = [none]
sub1 += Sphere(tx);
// depends on control dependency: [for], data = [none]
}
g[i] = sub1 / (nk15 * sublen15[i]);
// depends on control dependency: [for], data = [i]
}
// evaluate fm,fm-1,...,2,f1
double subf1 = 1;
f[numberOfObjectives - 1] =
(1 - Math.sin(Math.PI * x[0] / 2)) * (1 + g[numberOfObjectives - 1]);
for (int i = numberOfObjectives - 2; i > 0; i--) {
subf1 *= Math.cos(Math.PI * x[numberOfObjectives - i - 2] / 2);
// depends on control dependency: [for], data = [i]
f[i] = (1 - subf1 * Math.sin(Math.PI * x[numberOfObjectives - i - 1] / 2)) * (1 + g[i] + g[i
+ 1]);
// depends on control dependency: [for], data = [i]
}
f[0] = (1 - subf1 * Math.cos(Math.PI * x[numberOfObjectives - 2] / 2)) * (1 + g[0] + g[1]);
for (int i = 0; i < numberOfObjectives; i++) {
solution.setObjective(i, f[i]);
// depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
private Collection<Resource> parseGroup(final Element element) {
final String name = element.getAttribute(ATTR_GROUP_NAME);
final String isAbstractAsString = element.getAttribute(ATTR_GROUP_ABSTRACT);
final boolean isAbstractGroup = StringUtils.isNotEmpty(isAbstractAsString) && Boolean.valueOf(isAbstractAsString);
if (groupsInProcess.contains(name)) {
throw new RecursiveGroupDefinitionException("Infinite Recursion detected for the group: " + name
+ ". Recursion path: " + groupsInProcess);
}
LOG.debug("\tadding group: {}", name);
groupsInProcess.add(name);
// skip if this group is already parsed
final Group parsedGroup = new WroModelInspector(model).getGroupByName(name);
if (parsedGroup != null) {
// remove before returning
// this group is parsed, remove from unparsed groups collection
groupsInProcess.remove(name);
return parsedGroup.getResources();
}
final Group group = createGroup(element);
// this group is parsed, remove from unparsed collection
groupsInProcess.remove(name);
if (!isAbstractGroup) {
// add only non abstract groups
model.addGroup(group);
}
return group.getResources();
} } | public class class_name {
private Collection<Resource> parseGroup(final Element element) {
final String name = element.getAttribute(ATTR_GROUP_NAME);
final String isAbstractAsString = element.getAttribute(ATTR_GROUP_ABSTRACT);
final boolean isAbstractGroup = StringUtils.isNotEmpty(isAbstractAsString) && Boolean.valueOf(isAbstractAsString);
if (groupsInProcess.contains(name)) {
throw new RecursiveGroupDefinitionException("Infinite Recursion detected for the group: " + name
+ ". Recursion path: " + groupsInProcess);
}
LOG.debug("\tadding group: {}", name);
groupsInProcess.add(name);
// skip if this group is already parsed
final Group parsedGroup = new WroModelInspector(model).getGroupByName(name);
if (parsedGroup != null) {
// remove before returning
// this group is parsed, remove from unparsed groups collection
groupsInProcess.remove(name);
// depends on control dependency: [if], data = [none]
return parsedGroup.getResources();
// depends on control dependency: [if], data = [none]
}
final Group group = createGroup(element);
// this group is parsed, remove from unparsed collection
groupsInProcess.remove(name);
if (!isAbstractGroup) {
// add only non abstract groups
model.addGroup(group);
// depends on control dependency: [if], data = [none]
}
return group.getResources();
} } |
public class class_name {
void removeMixin() {
int idx = state.stackIdx - 1;
Scope current = state.stack.get( idx );
if( idx > 0 ) {
Scope previous = state.stack.get( idx - 1 );
Map<String, Expression> currentReturn = previous.returns;
Map<String, Expression> vars = current.variables;
if( vars != null ) {
for( Entry<String, Expression> entry : vars.entrySet() ) {
if( previous.getVariable( entry.getKey() ) == null ) {
currentReturn.put( entry.getKey(), ValueExpression.eval( this, entry.getValue() ) );
}
}
}
vars = current.returns;
if( vars != null ) {
for( Entry<String, Expression> entry : vars.entrySet() ) {
if( previous.getVariable( entry.getKey() ) == null ) {
currentReturn.put( entry.getKey(), ValueExpression.eval( this, entry.getValue() ) );
}
}
}
}
state.stackIdx--;
state.rulesStackModCount++;
} } | public class class_name {
void removeMixin() {
int idx = state.stackIdx - 1;
Scope current = state.stack.get( idx );
if( idx > 0 ) {
Scope previous = state.stack.get( idx - 1 );
Map<String, Expression> currentReturn = previous.returns;
Map<String, Expression> vars = current.variables;
if( vars != null ) {
for( Entry<String, Expression> entry : vars.entrySet() ) {
if( previous.getVariable( entry.getKey() ) == null ) {
currentReturn.put( entry.getKey(), ValueExpression.eval( this, entry.getValue() ) ); // depends on control dependency: [if], data = [none]
}
}
}
vars = current.returns; // depends on control dependency: [if], data = [none]
if( vars != null ) {
for( Entry<String, Expression> entry : vars.entrySet() ) {
if( previous.getVariable( entry.getKey() ) == null ) {
currentReturn.put( entry.getKey(), ValueExpression.eval( this, entry.getValue() ) ); // depends on control dependency: [if], data = [none]
}
}
}
}
state.stackIdx--;
state.rulesStackModCount++;
} } |
public class class_name {
@Override protected void dumpData(PrintWriter pw)
{
if (m_options != null)
{
pw.println(" [Options");
for (String item : m_options)
{
pw.println(" " + item);
}
pw.println(" ]");
}
pw.println(" [Data");
for (Object item : m_data)
{
pw.println(" " + item);
}
pw.println(" ]");
} } | public class class_name {
@Override protected void dumpData(PrintWriter pw)
{
if (m_options != null)
{
pw.println(" [Options"); // depends on control dependency: [if], data = [none]
for (String item : m_options)
{
pw.println(" " + item); // depends on control dependency: [for], data = [item]
}
pw.println(" ]"); // depends on control dependency: [if], data = [none]
}
pw.println(" [Data");
for (Object item : m_data)
{
pw.println(" " + item); // depends on control dependency: [for], data = [item]
}
pw.println(" ]");
} } |
public class class_name {
public static Double[] getColumnDoubleValues(CSTable t, String columnName) {
int col = columnIndex(t, columnName);
if (col == -1) {
throw new IllegalArgumentException("No such column: " + columnName);
}
List<Double> l = new ArrayList<Double>();
for (String[] s : t.rows()) {
l.add(new Double(s[col]));
}
return l.toArray(new Double[0]);
} } | public class class_name {
public static Double[] getColumnDoubleValues(CSTable t, String columnName) {
int col = columnIndex(t, columnName);
if (col == -1) {
throw new IllegalArgumentException("No such column: " + columnName);
}
List<Double> l = new ArrayList<Double>();
for (String[] s : t.rows()) {
l.add(new Double(s[col])); // depends on control dependency: [for], data = [s]
}
return l.toArray(new Double[0]);
} } |
public class class_name {
@Override
public void visit(Class<?> clazz)
{
ClassContextImpl context = new ClassContextImpl(builder, clazz);
context.put(clazz, payload);
if (log.isTraceEnabled())
{
log.trace("Scanning class: {}", clazz.getName());
}
// first process the class
visit(clazz, context);
// only process fields and classes if a rule building has been started
if (context.hasRuleBuildingStarted()) {
// walk up the inheritance hierarchy
Class<?> currentType = clazz;
while (currentType != null) {
// then process the fields
for (Field field : currentType.getDeclaredFields())
{
visit(field, new FieldContextImpl(context, field));
}
// then the methods
for (Method method : currentType.getDeclaredMethods())
{
MethodContextImpl methodContext = new MethodContextImpl(context, method);
visit(method, methodContext);
// then the method parameters
for (int i = 0; i < method.getParameterTypes().length; i++)
{
ParameterImpl parameter = new ParameterImpl(method, method.getParameterTypes()[i],
method.getParameterAnnotations()[i], i);
visit(parameter, new ParameterContextImpl(methodContext, parameter));
}
}
currentType = currentType.getSuperclass();
}
}
} } | public class class_name {
@Override
public void visit(Class<?> clazz)
{
ClassContextImpl context = new ClassContextImpl(builder, clazz);
context.put(clazz, payload);
if (log.isTraceEnabled())
{
log.trace("Scanning class: {}", clazz.getName()); // depends on control dependency: [if], data = [none]
}
// first process the class
visit(clazz, context);
// only process fields and classes if a rule building has been started
if (context.hasRuleBuildingStarted()) {
// walk up the inheritance hierarchy
Class<?> currentType = clazz;
while (currentType != null) {
// then process the fields
for (Field field : currentType.getDeclaredFields())
{
visit(field, new FieldContextImpl(context, field)); // depends on control dependency: [for], data = [field]
}
// then the methods
for (Method method : currentType.getDeclaredMethods())
{
MethodContextImpl methodContext = new MethodContextImpl(context, method);
visit(method, methodContext); // depends on control dependency: [for], data = [method]
// then the method parameters
for (int i = 0; i < method.getParameterTypes().length; i++)
{
ParameterImpl parameter = new ParameterImpl(method, method.getParameterTypes()[i],
method.getParameterAnnotations()[i], i);
visit(parameter, new ParameterContextImpl(methodContext, parameter)); // depends on control dependency: [for], data = [none]
}
}
currentType = currentType.getSuperclass(); // depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
private void handle(SelectionKey key) {
// 有客户端接入此服务端
if (key.isAcceptable()) {
// 获取通道 转化为要处理的类型
final ServerSocketChannel server = (ServerSocketChannel) key.channel();
SocketChannel socketChannel;
try {
// 获取连接到此服务器的客户端通道
socketChannel = server.accept();
} catch (IOException e) {
throw new IORuntimeException(e);
}
// SocketChannel通道的可读事件注册到Selector中
registerChannel(selector, socketChannel, Operation.READ);
}
// 读事件就绪
if (key.isReadable()) {
final SocketChannel socketChannel = (SocketChannel) key.channel();
read(socketChannel);
// SocketChannel通道的可写事件注册到Selector中
registerChannel(selector, socketChannel, Operation.WRITE);
}
// 写事件就绪
if (key.isWritable()) {
final SocketChannel socketChannel = (SocketChannel) key.channel();
write(socketChannel);
// SocketChannel通道的可读事件注册到Selector中
registerChannel(selector, socketChannel, Operation.READ);
}
} } | public class class_name {
private void handle(SelectionKey key) {
// 有客户端接入此服务端
if (key.isAcceptable()) {
// 获取通道 转化为要处理的类型
final ServerSocketChannel server = (ServerSocketChannel) key.channel();
SocketChannel socketChannel;
try {
// 获取连接到此服务器的客户端通道
socketChannel = server.accept();
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IORuntimeException(e);
}
// depends on control dependency: [catch], data = [none]
// SocketChannel通道的可读事件注册到Selector中
registerChannel(selector, socketChannel, Operation.READ);
// depends on control dependency: [if], data = [none]
}
// 读事件就绪
if (key.isReadable()) {
final SocketChannel socketChannel = (SocketChannel) key.channel();
read(socketChannel);
// depends on control dependency: [if], data = [none]
// SocketChannel通道的可写事件注册到Selector中
registerChannel(selector, socketChannel, Operation.WRITE);
// depends on control dependency: [if], data = [none]
}
// 写事件就绪
if (key.isWritable()) {
final SocketChannel socketChannel = (SocketChannel) key.channel();
write(socketChannel);
// depends on control dependency: [if], data = [none]
// SocketChannel通道的可读事件注册到Selector中
registerChannel(selector, socketChannel, Operation.READ);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private SortedSet<String> findIdsPerName(final String indexName,
final SortedMap<String, SortedSet<String>> names) {
if (names.containsKey(indexName)) {
return names.get(indexName);
}
final TreeSet<String> idsPerName = new TreeSet<String>();
names.put(indexName, idsPerName);
return idsPerName;
} } | public class class_name {
private SortedSet<String> findIdsPerName(final String indexName,
final SortedMap<String, SortedSet<String>> names) {
if (names.containsKey(indexName)) {
return names.get(indexName); // depends on control dependency: [if], data = [none]
}
final TreeSet<String> idsPerName = new TreeSet<String>();
names.put(indexName, idsPerName);
return idsPerName;
} } |
public class class_name {
public static void insertDataIntoDatabase(List<? extends RedGEntity> gObjects, final Connection connection,
PreparedStatementParameterSetter preparedStatementParameterSetter) {
final Map<Class<? extends RedGEntity>, PreparedStatement> statementMap = gObjects.stream()
.filter(distinctByKey(RedGEntity::getClass))
.collect(HashMap::new, (m, obj) -> m.put(obj.getClass(), prepareStatement(connection).apply(obj)), HashMap::putAll);
for (final RedGEntity obj : gObjects) {
final PreparedStatement statement = statementMap.get(obj.getClass());
if (statement == null) {
throw new InsertionFailedException("Could not get prepared statement for class " + obj.getClass().getName());
}
final Object[] values = obj.getPreparedStatementValues();
for (int i = 0; i < values.length; i++) {
try {
AttributeMetaInfo[] preparedStatementValueMetaInfo = obj.getPreparedStatementValuesMetaInfos();
if (values[i] == null) {
statement.setNull(i + 1, preparedStatementValueMetaInfo[i].getSqlTypeInt());
} else {
preparedStatementParameterSetter.setParameter(statement,
i + 1, values[i], preparedStatementValueMetaInfo[i], connection);
}
} catch (SQLException e) {
throw new InsertionFailedException("Setting value for statement failed", e);
}
}
try {
final boolean resultType = statement.execute();
if (resultType) {
// resultType == true means that a ResultSet was returned that can be obtained by calling getResultSet()
// as an INSERT does not return a ResultSet, this means that this statement was used to check if a entry specified as already existing
// does really exist.
final ResultSet rs = statement.getResultSet();
rs.next();
if (rs.getInt(1) != 1) {
LOG.error(
"The entry of type {} was specified as existing (PKs: {}) but could not be found/identified in the database."
+ " The test query found {} matches. "
+ " If you modelled the searched entity via RedG, you should call findSingleEntity() instead.",
obj.getClass(), obj.getPreparedStatementValues(), rs.getInt(1));
throw new ExistingEntryMissingException("The entry of type " + obj.getClass()
+ ", identified by " + Arrays.toString(obj.getPreparedStatementValues()) + " was not found!");
}
} else {
// resultType == false means that no ResultSet was returned. Thus the executed statement was a regular insert.
if (statement.getUpdateCount() != 1) {
LOG.warn("Insert statement updated more that one database entry. {} entries were updated", statement.getUpdateCount());
}
}
statement.clearParameters();
//LOG.debug("Executed statement");
} catch (SQLException e) {
throw new InsertionFailedException("SQL execution failed", e);
}
}
} } | public class class_name {
public static void insertDataIntoDatabase(List<? extends RedGEntity> gObjects, final Connection connection,
PreparedStatementParameterSetter preparedStatementParameterSetter) {
final Map<Class<? extends RedGEntity>, PreparedStatement> statementMap = gObjects.stream()
.filter(distinctByKey(RedGEntity::getClass))
.collect(HashMap::new, (m, obj) -> m.put(obj.getClass(), prepareStatement(connection).apply(obj)), HashMap::putAll);
for (final RedGEntity obj : gObjects) {
final PreparedStatement statement = statementMap.get(obj.getClass());
if (statement == null) {
throw new InsertionFailedException("Could not get prepared statement for class " + obj.getClass().getName());
}
final Object[] values = obj.getPreparedStatementValues();
for (int i = 0; i < values.length; i++) {
try {
AttributeMetaInfo[] preparedStatementValueMetaInfo = obj.getPreparedStatementValuesMetaInfos();
if (values[i] == null) {
statement.setNull(i + 1, preparedStatementValueMetaInfo[i].getSqlTypeInt());
// depends on control dependency: [if], data = [none]
} else {
preparedStatementParameterSetter.setParameter(statement,
i + 1, values[i], preparedStatementValueMetaInfo[i], connection);
// depends on control dependency: [if], data = [none]
}
} catch (SQLException e) {
throw new InsertionFailedException("Setting value for statement failed", e);
}
// depends on control dependency: [catch], data = [none]
}
try {
final boolean resultType = statement.execute();
if (resultType) {
// resultType == true means that a ResultSet was returned that can be obtained by calling getResultSet()
// as an INSERT does not return a ResultSet, this means that this statement was used to check if a entry specified as already existing
// does really exist.
final ResultSet rs = statement.getResultSet();
rs.next();
// depends on control dependency: [if], data = [none]
if (rs.getInt(1) != 1) {
LOG.error(
"The entry of type {} was specified as existing (PKs: {}) but could not be found/identified in the database."
+ " The test query found {} matches. "
+ " If you modelled the searched entity via RedG, you should call findSingleEntity() instead.",
obj.getClass(), obj.getPreparedStatementValues(), rs.getInt(1));
// depends on control dependency: [if], data = [none]
throw new ExistingEntryMissingException("The entry of type " + obj.getClass()
+ ", identified by " + Arrays.toString(obj.getPreparedStatementValues()) + " was not found!");
}
} else {
// resultType == false means that no ResultSet was returned. Thus the executed statement was a regular insert.
if (statement.getUpdateCount() != 1) {
LOG.warn("Insert statement updated more that one database entry. {} entries were updated", statement.getUpdateCount());
// depends on control dependency: [if], data = [none]
}
}
statement.clearParameters();
// depends on control dependency: [try], data = [none]
//LOG.debug("Executed statement");
} catch (SQLException e) {
throw new InsertionFailedException("SQL execution failed", e);
}
// depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected void resetCreateSubscriptionMessage(MESubscription subscription, boolean isLocalBus)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "resetCreateSubscriptionMessage", new Object[]{subscription, new Boolean(isLocalBus)});
// Reset the state
reset();
// Indicate that this is a create message
iSubscriptionMessage.setSubscriptionMessageType(
SubscriptionMessageType.CREATE);
// Add the subscription related information.
iTopics.add(subscription.getTopic());
if(isLocalBus)
{
//see defect 267686:
//local bus subscriptions expect the subscribing ME's
//detination uuid to be set in the iTopicSpaces field
iTopicSpaces.add(subscription.getTopicSpaceUuid().toString());
}
else
{
//see defect 267686:
//foreign bus subscriptions need to set the subscribers's topic space name.
//This is because the messages sent to this topic over the link
//will need to have a routing destination set, which requires
//this value.
iTopicSpaces.add(subscription.getTopicSpaceName().toString());
}
iTopicSpaceMappings.add(subscription.getForeignTSName());
if (tc.isEntryEnabled())
SibTr.exit(tc, "resetCreateSubscriptionMessage");
} } | public class class_name {
protected void resetCreateSubscriptionMessage(MESubscription subscription, boolean isLocalBus)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "resetCreateSubscriptionMessage", new Object[]{subscription, new Boolean(isLocalBus)});
// Reset the state
reset();
// Indicate that this is a create message
iSubscriptionMessage.setSubscriptionMessageType(
SubscriptionMessageType.CREATE);
// Add the subscription related information.
iTopics.add(subscription.getTopic());
if(isLocalBus)
{
//see defect 267686:
//local bus subscriptions expect the subscribing ME's
//detination uuid to be set in the iTopicSpaces field
iTopicSpaces.add(subscription.getTopicSpaceUuid().toString()); // depends on control dependency: [if], data = [none]
}
else
{
//see defect 267686:
//foreign bus subscriptions need to set the subscribers's topic space name.
//This is because the messages sent to this topic over the link
//will need to have a routing destination set, which requires
//this value.
iTopicSpaces.add(subscription.getTopicSpaceName().toString()); // depends on control dependency: [if], data = [none]
}
iTopicSpaceMappings.add(subscription.getForeignTSName());
if (tc.isEntryEnabled())
SibTr.exit(tc, "resetCreateSubscriptionMessage");
} } |
public class class_name {
public void put(K key, V value) {
Set<V> set = storage.get(key);
if (set == null) {
set = new HashSet<>();
storage.put(key, set);
}
set.add(value);
} } | public class class_name {
public void put(K key, V value) {
Set<V> set = storage.get(key);
if (set == null) {
set = new HashSet<>(); // depends on control dependency: [if], data = [none]
storage.put(key, set); // depends on control dependency: [if], data = [none]
}
set.add(value);
} } |
public class class_name {
public <T> String getChangeVectorFor(T instance) {
if (instance == null) {
throw new IllegalArgumentException("instance cannot be null");
}
DocumentInfo documentInfo = getDocumentInfo(instance);
JsonNode changeVector = documentInfo.getMetadata().get(Constants.Documents.Metadata.CHANGE_VECTOR);
if (changeVector != null) {
return changeVector.asText();
}
return null;
} } | public class class_name {
public <T> String getChangeVectorFor(T instance) {
if (instance == null) {
throw new IllegalArgumentException("instance cannot be null");
}
DocumentInfo documentInfo = getDocumentInfo(instance);
JsonNode changeVector = documentInfo.getMetadata().get(Constants.Documents.Metadata.CHANGE_VECTOR);
if (changeVector != null) {
return changeVector.asText(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void setRunning(boolean running)
{
if (tc.isEntryEnabled())
{
SibTr.entry(tc, "setRunning");
SibTr.exit(tc, "setRunning");
}
_isRunning = running;
return;
} } | public class class_name {
public void setRunning(boolean running)
{
if (tc.isEntryEnabled())
{
SibTr.entry(tc, "setRunning"); // depends on control dependency: [if], data = [none]
SibTr.exit(tc, "setRunning"); // depends on control dependency: [if], data = [none]
}
_isRunning = running;
return;
} } |
public class class_name {
private <T> Provider<T> lookupProvider(InjectionPoint<T> ip)
{
Key<T> key = ip.key();
BindingInject<T> bean = findBean(key);
if (bean != null) {
return bean.provider(ip);
}
BindingAmp<T> provider = findBinding(key);
if (provider != null) {
return provider.provider(ip);
}
provider = findObjectBinding(key);
if (provider != null) {
return provider.provider(ip);
}
return null;
} } | public class class_name {
private <T> Provider<T> lookupProvider(InjectionPoint<T> ip)
{
Key<T> key = ip.key();
BindingInject<T> bean = findBean(key);
if (bean != null) {
return bean.provider(ip); // depends on control dependency: [if], data = [none]
}
BindingAmp<T> provider = findBinding(key);
if (provider != null) {
return provider.provider(ip); // depends on control dependency: [if], data = [none]
}
provider = findObjectBinding(key);
if (provider != null) {
return provider.provider(ip); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Override
public Object unmarshall(Type feelType, String value) {
if ( "null".equals( value ) ) {
return null;
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.NUMBER ) ) {
return BuiltInFunctions.getFunction( NumberFunction.class ).invoke( value, null, null ).cata( justNull(), Function.identity() );
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.STRING ) ) {
return value;
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.DATE ) ) {
return BuiltInFunctions.getFunction( DateFunction.class ).invoke( value ).cata( justNull(), Function.identity() );
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.TIME ) ) {
return BuiltInFunctions.getFunction( TimeFunction.class ).invoke( value ).cata( justNull(), Function.identity() );
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.DATE_TIME ) ) {
return BuiltInFunctions.getFunction( DateAndTimeFunction.class ).invoke( value ).cata( justNull(), Function.identity() );
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.DURATION ) ) {
return BuiltInFunctions.getFunction( DurationFunction.class ).invoke( value ).cata( justNull(), Function.identity() );
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.BOOLEAN ) ) {
return Boolean.parseBoolean( value );
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.RANGE ) || feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.FUNCTION ) || feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.LIST )
|| feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.CONTEXT ) || feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.UNARY_TEST ) ) {
throw new UnsupportedOperationException( "FEELStringMarshaller is unable to unmarshall complex types like: "+feelType.getName() );
}
return null;
} } | public class class_name {
@Override
public Object unmarshall(Type feelType, String value) {
if ( "null".equals( value ) ) {
return null; // depends on control dependency: [if], data = [none]
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.NUMBER ) ) {
return BuiltInFunctions.getFunction( NumberFunction.class ).invoke( value, null, null ).cata( justNull(), Function.identity() ); // depends on control dependency: [if], data = [none]
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.STRING ) ) {
return value; // depends on control dependency: [if], data = [none]
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.DATE ) ) {
return BuiltInFunctions.getFunction( DateFunction.class ).invoke( value ).cata( justNull(), Function.identity() ); // depends on control dependency: [if], data = [none]
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.TIME ) ) {
return BuiltInFunctions.getFunction( TimeFunction.class ).invoke( value ).cata( justNull(), Function.identity() ); // depends on control dependency: [if], data = [none]
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.DATE_TIME ) ) {
return BuiltInFunctions.getFunction( DateAndTimeFunction.class ).invoke( value ).cata( justNull(), Function.identity() ); // depends on control dependency: [if], data = [none]
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.DURATION ) ) {
return BuiltInFunctions.getFunction( DurationFunction.class ).invoke( value ).cata( justNull(), Function.identity() ); // depends on control dependency: [if], data = [none]
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.BOOLEAN ) ) {
return Boolean.parseBoolean( value ); // depends on control dependency: [if], data = [none]
} else if ( feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.RANGE ) || feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.FUNCTION ) || feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.LIST )
|| feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.CONTEXT ) || feelType.equals( org.kie.dmn.feel.lang.types.BuiltInType.UNARY_TEST ) ) {
throw new UnsupportedOperationException( "FEELStringMarshaller is unable to unmarshall complex types like: "+feelType.getName() );
}
return null;
} } |
public class class_name {
private String catalogCond(String columnName, String catalog) {
if (catalog == null) {
/* Treat null catalog as current */
if (connection.nullCatalogMeansCurrent) {
return "(ISNULL(database()) OR (" + columnName + " = database()))";
}
return "(1 = 1)";
}
if (catalog.isEmpty()) {
return "(ISNULL(database()) OR (" + columnName + " = database()))";
}
return "(" + columnName + " = " + escapeQuote(catalog) + ")";
} } | public class class_name {
private String catalogCond(String columnName, String catalog) {
if (catalog == null) {
/* Treat null catalog as current */
if (connection.nullCatalogMeansCurrent) {
return "(ISNULL(database()) OR (" + columnName + " = database()))"; // depends on control dependency: [if], data = [none]
}
return "(1 = 1)"; // depends on control dependency: [if], data = [none]
}
if (catalog.isEmpty()) {
return "(ISNULL(database()) OR (" + columnName + " = database()))"; // depends on control dependency: [if], data = [none]
}
return "(" + columnName + " = " + escapeQuote(catalog) + ")";
} } |
public class class_name {
private FilterChain getChainForName(int requestType, ServletHolder servletHolder) {
if (servletHolder == null) {
throw new IllegalStateException("Named dispatch must be to an explicitly named servlet");
}
if (_filterChainsCached)
{
synchronized(this)
{
if (_namedChainCache[requestType].containsKey(servletHolder.getName()))
return (FilterChain)_namedChainCache[requestType].get(servletHolder.getName());
}
}
// Build list of filters
Object filters= null;
if (jsr154Filter!=null)
{
// Slight hack for Named servlets
// TODO query JSR how to apply filter to all dispatches
filters=LazyList.add(filters,jsr154FilterHolder);
}
// Servlet filters
if (_servletFilterMap.size() > 0)
{
Object o= _servletFilterMap.get(servletHolder.getName());
for (int i=0; i<LazyList.size(o);i++)
{
FilterMapping mapping = (FilterMapping)LazyList.get(o,i);
if (mapping.appliesTo(null,requestType))
filters=LazyList.add(filters,mapping.getHolder());
}
}
FilterChain chain = null;
if (_filterChainsCached)
{
synchronized(this)
{
if (LazyList.size(filters) > 0)
chain= new CachedChain(filters, servletHolder);
_namedChainCache[requestType].put(servletHolder.getName(),chain);
}
}
else if (LazyList.size(filters) > 0)
chain = new Chain(filters, servletHolder);
return chain;
} } | public class class_name {
private FilterChain getChainForName(int requestType, ServletHolder servletHolder) {
if (servletHolder == null) {
throw new IllegalStateException("Named dispatch must be to an explicitly named servlet");
}
if (_filterChainsCached)
{
synchronized(this) // depends on control dependency: [if], data = [none]
{
if (_namedChainCache[requestType].containsKey(servletHolder.getName()))
return (FilterChain)_namedChainCache[requestType].get(servletHolder.getName());
}
}
// Build list of filters
Object filters= null;
if (jsr154Filter!=null)
{
// Slight hack for Named servlets
// TODO query JSR how to apply filter to all dispatches
filters=LazyList.add(filters,jsr154FilterHolder); // depends on control dependency: [if], data = [none]
}
// Servlet filters
if (_servletFilterMap.size() > 0)
{
Object o= _servletFilterMap.get(servletHolder.getName());
for (int i=0; i<LazyList.size(o);i++)
{
FilterMapping mapping = (FilterMapping)LazyList.get(o,i);
if (mapping.appliesTo(null,requestType))
filters=LazyList.add(filters,mapping.getHolder());
}
}
FilterChain chain = null;
if (_filterChainsCached)
{
synchronized(this) // depends on control dependency: [if], data = [none]
{
if (LazyList.size(filters) > 0)
chain= new CachedChain(filters, servletHolder);
_namedChainCache[requestType].put(servletHolder.getName(),chain);
}
}
else if (LazyList.size(filters) > 0)
chain = new Chain(filters, servletHolder);
return chain;
} } |
public class class_name {
public void free()
{
super.free();
try {
if (m_con != null)
m_con.close();
} catch (SOAPException ex) {
ex.printStackTrace();
}
} } | public class class_name {
public void free()
{
super.free();
try {
if (m_con != null)
m_con.close();
} catch (SOAPException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void stringToUnicodeBytes(HsqlByteArrayOutputStream b,
String s, boolean doubleSingleQuotes) {
final int len = s.length();
char[] chars;
int extras = 0;
if (s == null || len == 0) {
return;
}
chars = s.toCharArray();
b.ensureRoom(len * 2 + 5);
for (int i = 0; i < len; i++) {
char c = chars[i];
if (c == '\\') {
if ((i < len - 1) && (chars[i + 1] == 'u')) {
b.writeNoCheck(c); // encode the \ as unicode, so 'u' is ignored
b.writeNoCheck('u');
b.writeNoCheck('0');
b.writeNoCheck('0');
b.writeNoCheck('5');
b.writeNoCheck('c');
extras += 5;
} else {
b.write(c);
}
} else if ((c >= 0x0020) && (c <= 0x007f)) {
b.writeNoCheck(c); // this is 99%
if (c == '\'' && doubleSingleQuotes) {
b.writeNoCheck(c);
extras++;
}
} else {
b.writeNoCheck('\\');
b.writeNoCheck('u');
b.writeNoCheck(HEXBYTES[(c >> 12) & 0xf]);
b.writeNoCheck(HEXBYTES[(c >> 8) & 0xf]);
b.writeNoCheck(HEXBYTES[(c >> 4) & 0xf]);
b.writeNoCheck(HEXBYTES[c & 0xf]);
extras += 5;
}
if (extras > len) {
b.ensureRoom(len + extras + 5);
extras = 0;
}
}
} } | public class class_name {
public static void stringToUnicodeBytes(HsqlByteArrayOutputStream b,
String s, boolean doubleSingleQuotes) {
final int len = s.length();
char[] chars;
int extras = 0;
if (s == null || len == 0) {
return; // depends on control dependency: [if], data = [none]
}
chars = s.toCharArray();
b.ensureRoom(len * 2 + 5);
for (int i = 0; i < len; i++) {
char c = chars[i];
if (c == '\\') {
if ((i < len - 1) && (chars[i + 1] == 'u')) {
b.writeNoCheck(c); // encode the \ as unicode, so 'u' is ignored // depends on control dependency: [if], data = [none]
b.writeNoCheck('u'); // depends on control dependency: [if], data = [none]
b.writeNoCheck('0'); // depends on control dependency: [if], data = [none]
b.writeNoCheck('0'); // depends on control dependency: [if], data = [none]
b.writeNoCheck('5'); // depends on control dependency: [if], data = [none]
b.writeNoCheck('c'); // depends on control dependency: [if], data = [none]
extras += 5; // depends on control dependency: [if], data = [none]
} else {
b.write(c); // depends on control dependency: [if], data = [none]
}
} else if ((c >= 0x0020) && (c <= 0x007f)) {
b.writeNoCheck(c); // this is 99% // depends on control dependency: [if], data = [none]
if (c == '\'' && doubleSingleQuotes) {
b.writeNoCheck(c); // depends on control dependency: [if], data = [(c]
extras++; // depends on control dependency: [if], data = [none]
}
} else {
b.writeNoCheck('\\'); // depends on control dependency: [if], data = [none]
b.writeNoCheck('u'); // depends on control dependency: [if], data = [none]
b.writeNoCheck(HEXBYTES[(c >> 12) & 0xf]); // depends on control dependency: [if], data = [none]
b.writeNoCheck(HEXBYTES[(c >> 8) & 0xf]); // depends on control dependency: [if], data = [none]
b.writeNoCheck(HEXBYTES[(c >> 4) & 0xf]); // depends on control dependency: [if], data = [none]
b.writeNoCheck(HEXBYTES[c & 0xf]); // depends on control dependency: [if], data = [none]
extras += 5; // depends on control dependency: [if], data = [none]
}
if (extras > len) {
b.ensureRoom(len + extras + 5); // depends on control dependency: [if], data = [none]
extras = 0; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
void stop() {
if (!shouldRun(conf)) {
return;
}
nodeHealthScriptScheduler.cancel();
if (shexec != null) {
Process p = shexec.getProcess();
if (p != null) {
p.destroy();
}
}
} } | public class class_name {
void stop() {
if (!shouldRun(conf)) {
return; // depends on control dependency: [if], data = [none]
}
nodeHealthScriptScheduler.cancel();
if (shexec != null) {
Process p = shexec.getProcess();
if (p != null) {
p.destroy(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public DoubleVector[] getCentroids() {
if (matrix == null)
throw new IllegalArgumentException(
"The data matrix was not passed to Assignments.");
// Initialzie the centroid vectors and the cluster sizes.
DoubleVector[] centroids = new DoubleVector[numClusters];
counts = new int[numClusters];
for (int c = 0; c < numClusters; ++c)
centroids[c] = new DenseVector(matrix.columns());
// For each initial assignment, add the vector to it's centroid and
// increase the size of the cluster.
int row = 0;
for (Assignment assignment : assignments) {
if (assignment.length() != 0) {
// NOTE: why is this only using the first cluster? Is this a
// bug? -david
int clus = assignment.assignments()[0];
// Skip items whose cluster assignment indicates they were not
// assigned to any cluster.
if (clus < 0)
continue;
counts[clus]++;
DoubleVector centroid = centroids[assignment.assignments()[0]];
VectorMath.add(centroid, matrix.getRowVector(row));
}
row++;
}
// Scale any non empty clusters by their size.
for (int c = 0; c < numClusters; ++c)
if (counts[c] != 0)
centroids[c] = new ScaledDoubleVector(
centroids[c],1d/counts[c]);
return centroids;
} } | public class class_name {
public DoubleVector[] getCentroids() {
if (matrix == null)
throw new IllegalArgumentException(
"The data matrix was not passed to Assignments.");
// Initialzie the centroid vectors and the cluster sizes.
DoubleVector[] centroids = new DoubleVector[numClusters];
counts = new int[numClusters];
for (int c = 0; c < numClusters; ++c)
centroids[c] = new DenseVector(matrix.columns());
// For each initial assignment, add the vector to it's centroid and
// increase the size of the cluster.
int row = 0;
for (Assignment assignment : assignments) {
if (assignment.length() != 0) {
// NOTE: why is this only using the first cluster? Is this a
// bug? -david
int clus = assignment.assignments()[0];
// Skip items whose cluster assignment indicates they were not
// assigned to any cluster.
if (clus < 0)
continue;
counts[clus]++; // depends on control dependency: [if], data = [none]
DoubleVector centroid = centroids[assignment.assignments()[0]];
VectorMath.add(centroid, matrix.getRowVector(row)); // depends on control dependency: [if], data = [none]
}
row++; // depends on control dependency: [for], data = [none]
}
// Scale any non empty clusters by their size.
for (int c = 0; c < numClusters; ++c)
if (counts[c] != 0)
centroids[c] = new ScaledDoubleVector(
centroids[c],1d/counts[c]);
return centroids;
} } |
public class class_name {
@SafeVarargs
public static double[] removeAll(final double[] a, final double... elements) {
if (N.isNullOrEmpty(a)) {
return N.EMPTY_DOUBLE_ARRAY;
} else if (N.isNullOrEmpty(elements)) {
return a.clone();
} else if (elements.length == 1) {
return removeAllOccurrences(a, elements[0]);
}
final DoubleList list = DoubleList.of(a.clone());
list.removeAll(DoubleList.of(elements));
return list.trimToSize().array();
} } | public class class_name {
@SafeVarargs
public static double[] removeAll(final double[] a, final double... elements) {
if (N.isNullOrEmpty(a)) {
return N.EMPTY_DOUBLE_ARRAY;
// depends on control dependency: [if], data = [none]
} else if (N.isNullOrEmpty(elements)) {
return a.clone();
// depends on control dependency: [if], data = [none]
} else if (elements.length == 1) {
return removeAllOccurrences(a, elements[0]);
// depends on control dependency: [if], data = [none]
}
final DoubleList list = DoubleList.of(a.clone());
list.removeAll(DoubleList.of(elements));
return list.trimToSize().array();
} } |
public class class_name {
private void tryRippleEnter() {
if (mExitingRipplesCount >= MAX_RIPPLES) {
// This should never happen unless the user is tapping like a maniac
// or there is a bug that's preventing ripples from being removed.
return;
}
if (mRipple == null) {
final float x;
final float y;
if (mHasPending) {
mHasPending = false;
x = mPendingX;
y = mPendingY;
} else {
x = mHotspotBounds.exactCenterX();
y = mHotspotBounds.exactCenterY();
}
final boolean isBounded = isBounded();
mRipple = new RippleForeground(this, mHotspotBounds, x, y, isBounded);
}
mRipple.setup(mState.mMaxRadius, mDensity);
mRipple.enter(false);
} } | public class class_name {
private void tryRippleEnter() {
if (mExitingRipplesCount >= MAX_RIPPLES) {
// This should never happen unless the user is tapping like a maniac
// or there is a bug that's preventing ripples from being removed.
return; // depends on control dependency: [if], data = [none]
}
if (mRipple == null) {
final float x;
final float y;
if (mHasPending) {
mHasPending = false; // depends on control dependency: [if], data = [none]
x = mPendingX; // depends on control dependency: [if], data = [none]
y = mPendingY; // depends on control dependency: [if], data = [none]
} else {
x = mHotspotBounds.exactCenterX(); // depends on control dependency: [if], data = [none]
y = mHotspotBounds.exactCenterY(); // depends on control dependency: [if], data = [none]
}
final boolean isBounded = isBounded();
mRipple = new RippleForeground(this, mHotspotBounds, x, y, isBounded); // depends on control dependency: [if], data = [none]
}
mRipple.setup(mState.mMaxRadius, mDensity);
mRipple.enter(false);
} } |
public class class_name {
@Override
public void initialized(IntrospectedTable introspectedTable) {
// 1. 获取表单独配置
if (introspectedTable.getTableConfigurationProperty(PRO_TABLE_OVERRIDE) != null) {
String override = introspectedTable.getTableConfigurationProperty(PRO_TABLE_OVERRIDE);
try {
IntrospectedTableTools.setDomainObjectName(introspectedTable, getContext(), override);
} catch (Exception e) {
logger.error("itfsw:插件" + this.getClass().getTypeName() + "使用tableOverride替换时异常!", e);
}
} else if (getProperties().getProperty(PRO_SEARCH_STRING) != null) {
String searchString = getProperties().getProperty(PRO_SEARCH_STRING);
String replaceString = getProperties().getProperty(PRO_REPLACE_STRING);
String domainObjectName = introspectedTable.getFullyQualifiedTable().getDomainObjectName();
Pattern pattern = Pattern.compile(searchString);
Matcher matcher = pattern.matcher(domainObjectName);
domainObjectName = matcher.replaceAll(replaceString);
// 命名规范化 首字母大写
domainObjectName = FormatTools.upFirstChar(domainObjectName);
try {
IntrospectedTableTools.setDomainObjectName(introspectedTable, getContext(), domainObjectName);
} catch (Exception e) {
logger.error("itfsw:插件" + this.getClass().getTypeName() + "使用searchString、replaceString替换时异常!", e);
}
}
super.initialized(introspectedTable);
} } | public class class_name {
@Override
public void initialized(IntrospectedTable introspectedTable) {
// 1. 获取表单独配置
if (introspectedTable.getTableConfigurationProperty(PRO_TABLE_OVERRIDE) != null) {
String override = introspectedTable.getTableConfigurationProperty(PRO_TABLE_OVERRIDE);
try {
IntrospectedTableTools.setDomainObjectName(introspectedTable, getContext(), override); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("itfsw:插件" + this.getClass().getTypeName() + "使用tableOverride替换时异常!", e);
} // depends on control dependency: [catch], data = [none]
} else if (getProperties().getProperty(PRO_SEARCH_STRING) != null) {
String searchString = getProperties().getProperty(PRO_SEARCH_STRING);
String replaceString = getProperties().getProperty(PRO_REPLACE_STRING);
String domainObjectName = introspectedTable.getFullyQualifiedTable().getDomainObjectName();
Pattern pattern = Pattern.compile(searchString);
Matcher matcher = pattern.matcher(domainObjectName);
domainObjectName = matcher.replaceAll(replaceString); // depends on control dependency: [if], data = [none]
// 命名规范化 首字母大写
domainObjectName = FormatTools.upFirstChar(domainObjectName); // depends on control dependency: [if], data = [none]
try {
IntrospectedTableTools.setDomainObjectName(introspectedTable, getContext(), domainObjectName); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("itfsw:插件" + this.getClass().getTypeName() + "使用searchString、replaceString替换时异常!", e);
} // depends on control dependency: [catch], data = [none]
}
super.initialized(introspectedTable);
} } |
public class class_name {
public Matrix4d[] getTransformationsOrthonormal() {
Matrix4d[] transfs = new Matrix4d[this.getSpaceGroup().getNumOperators()];
transfs[0] = new Matrix4d(this.getSpaceGroup().getTransformation(0)); // no need to transform the identity
for (int i=1;i<this.getSpaceGroup().getNumOperators();i++) {
transfs[i] = this.cell.transfToOrthonormal(this.getSpaceGroup().getTransformation(i));
}
return transfs;
} } | public class class_name {
public Matrix4d[] getTransformationsOrthonormal() {
Matrix4d[] transfs = new Matrix4d[this.getSpaceGroup().getNumOperators()];
transfs[0] = new Matrix4d(this.getSpaceGroup().getTransformation(0)); // no need to transform the identity
for (int i=1;i<this.getSpaceGroup().getNumOperators();i++) {
transfs[i] = this.cell.transfToOrthonormal(this.getSpaceGroup().getTransformation(i)); // depends on control dependency: [for], data = [i]
}
return transfs;
} } |
public class class_name {
public void setResourceValueList(List<String> valueList) {
checkFrozen();
if (valueList != null) {
m_resourceValueList = new ArrayList<String>(valueList);
m_resourceValueList = Collections.unmodifiableList(m_resourceValueList);
m_resourceValue = createValueFromList(m_resourceValueList);
} else {
m_resourceValueList = null;
m_resourceValue = null;
}
} } | public class class_name {
public void setResourceValueList(List<String> valueList) {
checkFrozen();
if (valueList != null) {
m_resourceValueList = new ArrayList<String>(valueList); // depends on control dependency: [if], data = [(valueList]
m_resourceValueList = Collections.unmodifiableList(m_resourceValueList); // depends on control dependency: [if], data = [none]
m_resourceValue = createValueFromList(m_resourceValueList); // depends on control dependency: [if], data = [none]
} else {
m_resourceValueList = null; // depends on control dependency: [if], data = [none]
m_resourceValue = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static MetaClassImpl getMetaClassImpl(MetaClass mc, boolean includeEMC) {
Class mcc = mc.getClass();
boolean valid = mcc == MetaClassImpl.class ||
mcc == AdaptingMetaClass.class ||
mcc == ClosureMetaClass.class ||
(includeEMC && mcc == ExpandoMetaClass.class);
if (!valid) {
if (LOG_ENABLED) LOG.info("meta class is neither MetaClassImpl, nor AdoptingMetaClass, nor ClosureMetaClass, normal method selection path disabled.");
return null;
}
if (LOG_ENABLED) LOG.info("meta class is a recognized MetaClassImpl");
return (MetaClassImpl) mc;
} } | public class class_name {
private static MetaClassImpl getMetaClassImpl(MetaClass mc, boolean includeEMC) {
Class mcc = mc.getClass();
boolean valid = mcc == MetaClassImpl.class ||
mcc == AdaptingMetaClass.class ||
mcc == ClosureMetaClass.class ||
(includeEMC && mcc == ExpandoMetaClass.class);
if (!valid) {
if (LOG_ENABLED) LOG.info("meta class is neither MetaClassImpl, nor AdoptingMetaClass, nor ClosureMetaClass, normal method selection path disabled.");
return null; // depends on control dependency: [if], data = [none]
}
if (LOG_ENABLED) LOG.info("meta class is a recognized MetaClassImpl");
return (MetaClassImpl) mc;
} } |
public class class_name {
@Override
public String getBaseUrl() {
Environment env = getEnvironment();
String baseUrl = null;
if (env != null) {
baseUrl = env.getBaseUrl();
}
return (baseUrl == null ? "" : baseUrl);
} } | public class class_name {
@Override
public String getBaseUrl() {
Environment env = getEnvironment();
String baseUrl = null;
if (env != null) {
baseUrl = env.getBaseUrl(); // depends on control dependency: [if], data = [none]
}
return (baseUrl == null ? "" : baseUrl);
} } |
public class class_name {
public String getCodingSequence() {
String sequence = this.getSequenceAsString(getBioBegin(), getBioEnd(), getStrand());
if (getStrand() == Strand.NEGATIVE) {
//need to take complement of sequence because it is negative and we are returning a coding sequence
StringBuilder b = new StringBuilder(getLength());
CompoundSet<NucleotideCompound> compoundSet = this.getCompoundSet();
for (int i = 0; i < sequence.length(); i++) {
String nucleotide = String.valueOf(sequence.charAt(i));
NucleotideCompound nucleotideCompound = compoundSet.getCompoundForString(nucleotide);
b.append(nucleotideCompound.getComplement().getShortName());
}
sequence = b.toString();
}
// sequence = sequence.substring(phase);
return sequence;
} } | public class class_name {
public String getCodingSequence() {
String sequence = this.getSequenceAsString(getBioBegin(), getBioEnd(), getStrand());
if (getStrand() == Strand.NEGATIVE) {
//need to take complement of sequence because it is negative and we are returning a coding sequence
StringBuilder b = new StringBuilder(getLength());
CompoundSet<NucleotideCompound> compoundSet = this.getCompoundSet();
for (int i = 0; i < sequence.length(); i++) {
String nucleotide = String.valueOf(sequence.charAt(i));
NucleotideCompound nucleotideCompound = compoundSet.getCompoundForString(nucleotide);
b.append(nucleotideCompound.getComplement().getShortName()); // depends on control dependency: [for], data = [none]
}
sequence = b.toString(); // depends on control dependency: [if], data = [none]
}
// sequence = sequence.substring(phase);
return sequence;
} } |
public class class_name {
public static SortedSet<RTTypeface> getFonts(Context context) {
/*
* Fonts from the assets folder
*/
Map<String, String> assetFonts = getAssetFonts(context);
AssetManager assets = context.getResources().getAssets();
for (String fontName : assetFonts.keySet()) {
String filePath = assetFonts.get(fontName);
if (!ALL_FONTS.contains(fontName)) {
try {
Typeface typeface = Typeface.createFromAsset(assets, filePath);
ALL_FONTS.add(new RTTypeface(fontName, typeface));
}
catch (Exception e) {
// this can happen if we don't have access to the font or it's not a font or...
}
}
}
/*
* Fonts from the system
*/
Map<String, String> systemFonts = getSystemFonts();
for (String fontName : systemFonts.keySet()) {
String filePath = systemFonts.get(fontName);
if (!ALL_FONTS.contains(fontName)) {
try {
Typeface typeface = Typeface.createFromFile(filePath);
ALL_FONTS.add(new RTTypeface(fontName, typeface));
}
catch (Exception e) {
// this can happen if we don't have access to the font or it's not a font or...
}
}
}
return ALL_FONTS;
} } | public class class_name {
public static SortedSet<RTTypeface> getFonts(Context context) {
/*
* Fonts from the assets folder
*/
Map<String, String> assetFonts = getAssetFonts(context);
AssetManager assets = context.getResources().getAssets();
for (String fontName : assetFonts.keySet()) {
String filePath = assetFonts.get(fontName);
if (!ALL_FONTS.contains(fontName)) {
try {
Typeface typeface = Typeface.createFromAsset(assets, filePath);
ALL_FONTS.add(new RTTypeface(fontName, typeface)); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
// this can happen if we don't have access to the font or it's not a font or...
} // depends on control dependency: [catch], data = [none]
}
}
/*
* Fonts from the system
*/
Map<String, String> systemFonts = getSystemFonts();
for (String fontName : systemFonts.keySet()) {
String filePath = systemFonts.get(fontName);
if (!ALL_FONTS.contains(fontName)) {
try {
Typeface typeface = Typeface.createFromFile(filePath);
ALL_FONTS.add(new RTTypeface(fontName, typeface)); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
// this can happen if we don't have access to the font or it's not a font or...
} // depends on control dependency: [catch], data = [none]
}
}
return ALL_FONTS;
} } |
public class class_name {
public BatchGetLinkAttributes withAttributeNames(String... attributeNames) {
if (this.attributeNames == null) {
setAttributeNames(new java.util.ArrayList<String>(attributeNames.length));
}
for (String ele : attributeNames) {
this.attributeNames.add(ele);
}
return this;
} } | public class class_name {
public BatchGetLinkAttributes withAttributeNames(String... attributeNames) {
if (this.attributeNames == null) {
setAttributeNames(new java.util.ArrayList<String>(attributeNames.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : attributeNames) {
this.attributeNames.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static ProctorLoadResult verifyWithoutSpecification(@Nonnull final TestMatrixArtifact testMatrix,
final String matrixSource) {
final ProctorLoadResult.Builder resultBuilder = ProctorLoadResult.newBuilder();
for (final Entry<String, ConsumableTestDefinition> entry : testMatrix.getTests().entrySet()) {
final String testName = entry.getKey();
final ConsumableTestDefinition testDefinition = entry.getValue();
try {
verifyInternallyConsistentDefinition(testName, matrixSource, testDefinition);
} catch (IncompatibleTestMatrixException e) {
LOGGER.info(String.format("Unable to load test matrix for %s", testName), e);
resultBuilder.recordError(testName, e);
}
}
return resultBuilder.build();
} } | public class class_name {
public static ProctorLoadResult verifyWithoutSpecification(@Nonnull final TestMatrixArtifact testMatrix,
final String matrixSource) {
final ProctorLoadResult.Builder resultBuilder = ProctorLoadResult.newBuilder();
for (final Entry<String, ConsumableTestDefinition> entry : testMatrix.getTests().entrySet()) {
final String testName = entry.getKey();
final ConsumableTestDefinition testDefinition = entry.getValue();
try {
verifyInternallyConsistentDefinition(testName, matrixSource, testDefinition); // depends on control dependency: [try], data = [none]
} catch (IncompatibleTestMatrixException e) {
LOGGER.info(String.format("Unable to load test matrix for %s", testName), e);
resultBuilder.recordError(testName, e);
} // depends on control dependency: [catch], data = [none]
}
return resultBuilder.build();
} } |
public class class_name {
public boolean getRenderHiddenMarkersBeforeCheckboxes() {
final Set<IDialect> dialects = getDialects();
for (final IDialect dialect : dialects) {
if (dialect instanceof SpringStandardDialect) {
return ((SpringStandardDialect) dialect).getRenderHiddenMarkersBeforeCheckboxes();
}
}
return false;
} } | public class class_name {
public boolean getRenderHiddenMarkersBeforeCheckboxes() {
final Set<IDialect> dialects = getDialects();
for (final IDialect dialect : dialects) {
if (dialect instanceof SpringStandardDialect) {
return ((SpringStandardDialect) dialect).getRenderHiddenMarkersBeforeCheckboxes(); // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
@SuppressWarnings("unused")
public void setPosition(double pos) {
if (pos >= 0 && pos <= 1) {
mAngle = mStartAngle + pos * 2 * Math.PI;
}
} } | public class class_name {
@SuppressWarnings("unused")
public void setPosition(double pos) {
if (pos >= 0 && pos <= 1) {
mAngle = mStartAngle + pos * 2 * Math.PI; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <T extends Extension> List<T> getExtensions(Properties properties,
Parameter<Collection<String>> parameter, Driver d) {
Collection<String> className = parameter.getValue(properties);
List<T> finalResult = new ArrayList<>();
for (String cName : className) {
try {
T result;
if (LOG.isDebugEnabled()) {
LOG.debug("Creating extension " + className);
}
result = (T) Class.forName(cName).newInstance();
result.init(d, properties);
finalResult.add(result);
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
throw new ConfigurationException(e);
}
}
return finalResult;
} } | public class class_name {
public static <T extends Extension> List<T> getExtensions(Properties properties,
Parameter<Collection<String>> parameter, Driver d) {
Collection<String> className = parameter.getValue(properties);
List<T> finalResult = new ArrayList<>();
for (String cName : className) {
try {
T result;
if (LOG.isDebugEnabled()) {
LOG.debug("Creating extension " + className); // depends on control dependency: [if], data = [none]
}
result = (T) Class.forName(cName).newInstance(); // depends on control dependency: [try], data = [none]
result.init(d, properties); // depends on control dependency: [try], data = [none]
finalResult.add(result); // depends on control dependency: [try], data = [none]
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
throw new ConfigurationException(e);
} // depends on control dependency: [catch], data = [none]
}
return finalResult;
} } |
public class class_name {
private List resolveOperationAndCopy(DelegatingList delegatingList)
{
synchronized(delegatingList)
{
CachedQuery resolved = getResolved(delegatingList);
if (resolved != null && resolved.isModifiable())
{
return resolved.getResult();
}
resolveOperation(delegatingList);
resolved = getResolved(delegatingList).getModifiableClone();
delegatingList.zSetFastListOrCachedQuery(resolved);
return resolved.getResult();
}
} } | public class class_name {
private List resolveOperationAndCopy(DelegatingList delegatingList)
{
synchronized(delegatingList)
{
CachedQuery resolved = getResolved(delegatingList);
if (resolved != null && resolved.isModifiable())
{
return resolved.getResult();
// depends on control dependency: [if], data = [none]
}
resolveOperation(delegatingList);
resolved = getResolved(delegatingList).getModifiableClone();
delegatingList.zSetFastListOrCachedQuery(resolved);
return resolved.getResult();
}
} } |
public class class_name {
public Observable<ServiceResponse<Iteration>> updateIterationWithServiceResponseAsync(UUID projectId, UUID iterationId, Iteration updatedIteration) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (iterationId == null) {
throw new IllegalArgumentException("Parameter iterationId is required and cannot be null.");
}
if (updatedIteration == null) {
throw new IllegalArgumentException("Parameter updatedIteration is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
Validator.validate(updatedIteration);
return service.updateIteration(projectId, iterationId, updatedIteration, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Iteration>>>() {
@Override
public Observable<ServiceResponse<Iteration>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Iteration> clientResponse = updateIterationDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Iteration>> updateIterationWithServiceResponseAsync(UUID projectId, UUID iterationId, Iteration updatedIteration) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (iterationId == null) {
throw new IllegalArgumentException("Parameter iterationId is required and cannot be null.");
}
if (updatedIteration == null) {
throw new IllegalArgumentException("Parameter updatedIteration is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
Validator.validate(updatedIteration);
return service.updateIteration(projectId, iterationId, updatedIteration, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Iteration>>>() {
@Override
public Observable<ServiceResponse<Iteration>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Iteration> clientResponse = updateIterationDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
private static int moveToTiffEntryWithTag(
InputStream is,
int length,
boolean isLittleEndian,
int tagToFind)
throws IOException {
if (length < 14) {
return 0;
}
// read the number of entries and go through all of them
// each IFD entry has length of 12 bytes and is composed of
// {TAG [2], TYPE [2], COUNT [4], VALUE/OFFSET [4]}
int numEntries = StreamProcessor.readPackedInt(is, 2, isLittleEndian);
length -= 2;
while (numEntries-- > 0 && length >= 12) {
int tag = StreamProcessor.readPackedInt(is, 2, isLittleEndian);
length -= 2;
if (tag == tagToFind) {
return length;
}
is.skip(10);
length -= 10;
}
return 0;
} } | public class class_name {
private static int moveToTiffEntryWithTag(
InputStream is,
int length,
boolean isLittleEndian,
int tagToFind)
throws IOException {
if (length < 14) {
return 0;
}
// read the number of entries and go through all of them
// each IFD entry has length of 12 bytes and is composed of
// {TAG [2], TYPE [2], COUNT [4], VALUE/OFFSET [4]}
int numEntries = StreamProcessor.readPackedInt(is, 2, isLittleEndian);
length -= 2;
while (numEntries-- > 0 && length >= 12) {
int tag = StreamProcessor.readPackedInt(is, 2, isLittleEndian);
length -= 2;
if (tag == tagToFind) {
return length; // depends on control dependency: [if], data = [none]
}
is.skip(10);
length -= 10;
}
return 0;
} } |
public class class_name {
public static String toCanonicalForm(CharSequence input) {
if (input == null) {
return null;
}
return StringFunctions.CANONICAL_NORMALIZATION.apply(input.toString());
} } | public class class_name {
public static String toCanonicalForm(CharSequence input) {
if (input == null) {
return null; // depends on control dependency: [if], data = [none]
}
return StringFunctions.CANONICAL_NORMALIZATION.apply(input.toString());
} } |
public class class_name {
public static String resolveMacros(final String input, I_CmsMacroResolver resolver) {
if ((input == null) || (input.length() < 3)) {
// macro must have at last 3 chars "${}" or "%()"
return input;
}
int pn = input.indexOf(I_CmsMacroResolver.MACRO_DELIMITER);
int po = input.indexOf(I_CmsMacroResolver.MACRO_DELIMITER_OLD);
if ((po == -1) && (pn == -1)) {
// no macro delimiter found in input
return input;
}
int len = input.length();
StringBuffer result = new StringBuffer(len << 1);
int np, pp1, pp2, e;
String macro, value;
boolean keep = resolver.isKeepEmptyMacros();
boolean resolvedNone = true;
char ds, de;
int p;
if ((po == -1) || ((pn > -1) && (pn < po))) {
p = pn;
ds = I_CmsMacroResolver.MACRO_START;
de = I_CmsMacroResolver.MACRO_END;
} else {
p = po;
ds = I_CmsMacroResolver.MACRO_START_OLD;
de = I_CmsMacroResolver.MACRO_END_OLD;
}
// append chars before the first delimiter found
result.append(input.substring(0, p));
do {
pp1 = p + 1;
pp2 = pp1 + 1;
if (pp2 >= len) {
// remaining chars can't be a macro (minimum size is 3)
result.append(input.substring(p, len));
break;
}
// get the next macro delimiter
if ((pn > -1) && (pn < pp1)) {
pn = input.indexOf(I_CmsMacroResolver.MACRO_DELIMITER, pp1);
}
if ((po > -1) && (po < pp1)) {
po = input.indexOf(I_CmsMacroResolver.MACRO_DELIMITER_OLD, pp1);
}
if ((po == -1) && (pn == -1)) {
// none found, make sure remaining chars in this segment are appended
np = len;
} else {
// check if the next delimiter is old or new style
if ((po == -1) || ((pn > -1) && (pn < po))) {
np = pn;
} else {
np = po;
}
}
// check if the next char is a "macro start"
char st = input.charAt(pp1);
if (st == ds) {
// we have a starting macro sequence "${" or "%(", now check if this segment contains a "}" or ")"
e = input.indexOf(de, p);
if ((e > 0) && (e < np)) {
// this segment contains a closing macro delimiter "}" or "]", so we may have found a macro
macro = input.substring(pp2, e);
// resolve macro
value = resolver.getMacroValue(macro);
e++;
if (value != null) {
// macro was successfully resolved
result.append(value);
resolvedNone = false;
} else if (keep) {
// macro was unknown, but should be kept
result.append(input.substring(p, e));
}
} else {
// no complete macro "${...}" or "%(...)" in this segment
e = p;
}
} else {
// no macro start char after the "$" or "%"
e = p;
}
// set macro style for next delimiter found
if (np == pn) {
ds = I_CmsMacroResolver.MACRO_START;
de = I_CmsMacroResolver.MACRO_END;
} else {
ds = I_CmsMacroResolver.MACRO_START_OLD;
de = I_CmsMacroResolver.MACRO_END_OLD;
}
// append the remaining chars after the macro to the start of the next macro
result.append(input.substring(e, np));
// this is a nerdy joke ;-)
p = np;
} while (p < len);
if (resolvedNone && keep) {
// nothing was resolved and macros should be kept, return original input
return input;
}
// input was changed during resolving of macros
return result.toString();
} } | public class class_name {
public static String resolveMacros(final String input, I_CmsMacroResolver resolver) {
if ((input == null) || (input.length() < 3)) {
// macro must have at last 3 chars "${}" or "%()"
return input; // depends on control dependency: [if], data = [none]
}
int pn = input.indexOf(I_CmsMacroResolver.MACRO_DELIMITER);
int po = input.indexOf(I_CmsMacroResolver.MACRO_DELIMITER_OLD);
if ((po == -1) && (pn == -1)) {
// no macro delimiter found in input
return input; // depends on control dependency: [if], data = [none]
}
int len = input.length();
StringBuffer result = new StringBuffer(len << 1);
int np, pp1, pp2, e;
String macro, value;
boolean keep = resolver.isKeepEmptyMacros();
boolean resolvedNone = true;
char ds, de;
int p;
if ((po == -1) || ((pn > -1) && (pn < po))) {
p = pn; // depends on control dependency: [if], data = [none]
ds = I_CmsMacroResolver.MACRO_START; // depends on control dependency: [if], data = [none]
de = I_CmsMacroResolver.MACRO_END; // depends on control dependency: [if], data = [none]
} else {
p = po; // depends on control dependency: [if], data = [none]
ds = I_CmsMacroResolver.MACRO_START_OLD; // depends on control dependency: [if], data = [none]
de = I_CmsMacroResolver.MACRO_END_OLD; // depends on control dependency: [if], data = [none]
}
// append chars before the first delimiter found
result.append(input.substring(0, p));
do {
pp1 = p + 1;
pp2 = pp1 + 1;
if (pp2 >= len) {
// remaining chars can't be a macro (minimum size is 3)
result.append(input.substring(p, len)); // depends on control dependency: [if], data = [none]
break;
}
// get the next macro delimiter
if ((pn > -1) && (pn < pp1)) {
pn = input.indexOf(I_CmsMacroResolver.MACRO_DELIMITER, pp1); // depends on control dependency: [if], data = [none]
}
if ((po > -1) && (po < pp1)) {
po = input.indexOf(I_CmsMacroResolver.MACRO_DELIMITER_OLD, pp1); // depends on control dependency: [if], data = [none]
}
if ((po == -1) && (pn == -1)) {
// none found, make sure remaining chars in this segment are appended
np = len; // depends on control dependency: [if], data = [none]
} else {
// check if the next delimiter is old or new style
if ((po == -1) || ((pn > -1) && (pn < po))) {
np = pn; // depends on control dependency: [if], data = [none]
} else {
np = po; // depends on control dependency: [if], data = [none]
}
}
// check if the next char is a "macro start"
char st = input.charAt(pp1);
if (st == ds) {
// we have a starting macro sequence "${" or "%(", now check if this segment contains a "}" or ")"
e = input.indexOf(de, p); // depends on control dependency: [if], data = [none]
if ((e > 0) && (e < np)) {
// this segment contains a closing macro delimiter "}" or "]", so we may have found a macro
macro = input.substring(pp2, e); // depends on control dependency: [if], data = [none]
// resolve macro
value = resolver.getMacroValue(macro); // depends on control dependency: [if], data = [none]
e++; // depends on control dependency: [if], data = [none]
if (value != null) {
// macro was successfully resolved
result.append(value); // depends on control dependency: [if], data = [(value]
resolvedNone = false; // depends on control dependency: [if], data = [none]
} else if (keep) {
// macro was unknown, but should be kept
result.append(input.substring(p, e)); // depends on control dependency: [if], data = [none]
}
} else {
// no complete macro "${...}" or "%(...)" in this segment
e = p; // depends on control dependency: [if], data = [none]
}
} else {
// no macro start char after the "$" or "%"
e = p; // depends on control dependency: [if], data = [none]
}
// set macro style for next delimiter found
if (np == pn) {
ds = I_CmsMacroResolver.MACRO_START; // depends on control dependency: [if], data = [none]
de = I_CmsMacroResolver.MACRO_END; // depends on control dependency: [if], data = [none]
} else {
ds = I_CmsMacroResolver.MACRO_START_OLD; // depends on control dependency: [if], data = [none]
de = I_CmsMacroResolver.MACRO_END_OLD; // depends on control dependency: [if], data = [none]
}
// append the remaining chars after the macro to the start of the next macro
result.append(input.substring(e, np));
// this is a nerdy joke ;-)
p = np;
} while (p < len);
if (resolvedNone && keep) {
// nothing was resolved and macros should be kept, return original input
return input; // depends on control dependency: [if], data = [none]
}
// input was changed during resolving of macros
return result.toString();
} } |
public class class_name {
protected void buildColumnMetas(TableMeta tableMeta) throws SQLException {
String sql = dialect.forTableBuilderDoBuild(tableMeta.name);
Statement stm = conn.createStatement();
ResultSet rs = stm.executeQuery(sql);
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
Map<String, ColumnMeta> columnMetaMap = new HashMap<>();
if (generateRemarks) {
DatabaseMetaData dbMeta = conn.getMetaData();
ResultSet colMetaRs = null;
try {
colMetaRs = dbMeta.getColumns(null, null, tableMeta.name, null);
while (colMetaRs.next()) {
ColumnMeta columnMeta = new ColumnMeta();
columnMeta.name = colMetaRs.getString("COLUMN_NAME");
columnMeta.remarks = colMetaRs.getString("REMARKS");
columnMetaMap.put(columnMeta.name, columnMeta);
}
} catch (Exception e) {
System.out.println("无法生成 REMARKS");
} finally {
if (colMetaRs != null) {
colMetaRs.close();
}
}
}
for (int i=1; i<=columnCount; i++) {
ColumnMeta cm = new ColumnMeta();
cm.name = rsmd.getColumnName(i);
String typeStr = null;
if (dialect.isKeepByteAndShort()) {
int type = rsmd.getColumnType(i);
if (type == Types.TINYINT) {
typeStr = "java.lang.Byte";
} else if (type == Types.SMALLINT) {
typeStr = "java.lang.Short";
}
}
if (typeStr == null) {
String colClassName = rsmd.getColumnClassName(i);
typeStr = typeMapping.getType(colClassName);
}
if (typeStr == null) {
int type = rsmd.getColumnType(i);
if (type == Types.BINARY || type == Types.VARBINARY || type == Types.LONGVARBINARY || type == Types.BLOB) {
typeStr = "byte[]";
} else if (type == Types.CLOB || type == Types.NCLOB) {
typeStr = "java.lang.String";
}
// 支持 oracle 的 TIMESTAMP、DATE 字段类型,其中 Types.DATE 值并不会出现
// 保留对 Types.DATE 的判断,一是为了逻辑上的正确性、完备性,二是其它类型的数据库可能用得着
else if (type == Types.TIMESTAMP || type == Types.DATE) {
typeStr = "java.util.Date";
}
// 支持 PostgreSql 的 jsonb json
else if (type == Types.OTHER) {
typeStr = "java.lang.Object";
} else {
typeStr = "java.lang.String";
}
}
typeStr = handleJavaType(typeStr, rsmd, i);
cm.javaType = typeStr;
// 构造字段对应的属性名 attrName
cm.attrName = buildAttrName(cm.name);
// 备注字段赋值
if (generateRemarks && columnMetaMap.containsKey(cm.name)) {
cm.remarks = columnMetaMap.get(cm.name).remarks;
}
tableMeta.columnMetas.add(cm);
}
rs.close();
stm.close();
} } | public class class_name {
protected void buildColumnMetas(TableMeta tableMeta) throws SQLException {
String sql = dialect.forTableBuilderDoBuild(tableMeta.name);
Statement stm = conn.createStatement();
ResultSet rs = stm.executeQuery(sql);
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
Map<String, ColumnMeta> columnMetaMap = new HashMap<>();
if (generateRemarks) {
DatabaseMetaData dbMeta = conn.getMetaData();
ResultSet colMetaRs = null;
try {
colMetaRs = dbMeta.getColumns(null, null, tableMeta.name, null);
// depends on control dependency: [try], data = [none]
while (colMetaRs.next()) {
ColumnMeta columnMeta = new ColumnMeta();
columnMeta.name = colMetaRs.getString("COLUMN_NAME");
// depends on control dependency: [while], data = [none]
columnMeta.remarks = colMetaRs.getString("REMARKS");
// depends on control dependency: [while], data = [none]
columnMetaMap.put(columnMeta.name, columnMeta);
// depends on control dependency: [while], data = [none]
}
} catch (Exception e) {
System.out.println("无法生成 REMARKS");
} finally {
// depends on control dependency: [catch], data = [none]
if (colMetaRs != null) {
colMetaRs.close();
// depends on control dependency: [if], data = [none]
}
}
}
for (int i=1; i<=columnCount; i++) {
ColumnMeta cm = new ColumnMeta();
cm.name = rsmd.getColumnName(i);
String typeStr = null;
if (dialect.isKeepByteAndShort()) {
int type = rsmd.getColumnType(i);
if (type == Types.TINYINT) {
typeStr = "java.lang.Byte";
} else if (type == Types.SMALLINT) {
typeStr = "java.lang.Short";
}
}
if (typeStr == null) {
String colClassName = rsmd.getColumnClassName(i);
typeStr = typeMapping.getType(colClassName);
}
if (typeStr == null) {
int type = rsmd.getColumnType(i);
if (type == Types.BINARY || type == Types.VARBINARY || type == Types.LONGVARBINARY || type == Types.BLOB) {
typeStr = "byte[]";
} else if (type == Types.CLOB || type == Types.NCLOB) {
typeStr = "java.lang.String";
}
// 支持 oracle 的 TIMESTAMP、DATE 字段类型,其中 Types.DATE 值并不会出现
// 保留对 Types.DATE 的判断,一是为了逻辑上的正确性、完备性,二是其它类型的数据库可能用得着
else if (type == Types.TIMESTAMP || type == Types.DATE) {
typeStr = "java.util.Date";
}
// 支持 PostgreSql 的 jsonb json
else if (type == Types.OTHER) {
typeStr = "java.lang.Object";
} else {
typeStr = "java.lang.String";
}
}
typeStr = handleJavaType(typeStr, rsmd, i);
cm.javaType = typeStr;
// 构造字段对应的属性名 attrName
cm.attrName = buildAttrName(cm.name);
// 备注字段赋值
if (generateRemarks && columnMetaMap.containsKey(cm.name)) {
cm.remarks = columnMetaMap.get(cm.name).remarks;
}
tableMeta.columnMetas.add(cm);
}
rs.close();
stm.close();
} } |
public class class_name {
private void addAnnotation(final Class<? extends Annotation> clazz) {
final List<? extends Annotation> annotations = ReflectionUtils.getAnnotations(getClazz(), clazz);
for (final Annotation ann : annotations) {
addAnnotation(clazz, ann);
}
} } | public class class_name {
private void addAnnotation(final Class<? extends Annotation> clazz) {
final List<? extends Annotation> annotations = ReflectionUtils.getAnnotations(getClazz(), clazz);
for (final Annotation ann : annotations) {
addAnnotation(clazz, ann); // depends on control dependency: [for], data = [ann]
}
} } |
public class class_name {
public static boolean beforeThePrefixBytes(@Nonnull byte[] bytes, @Nonnull byte[] prefixBytes) {
final int prefixLength = prefixBytes.length;
for (int i = 0; i < prefixLength; ++i) {
int r = (char) prefixBytes[i] - (char) bytes[i];
if (r != 0) {
return r > 0;
}
}
return false;
} } | public class class_name {
public static boolean beforeThePrefixBytes(@Nonnull byte[] bytes, @Nonnull byte[] prefixBytes) {
final int prefixLength = prefixBytes.length;
for (int i = 0; i < prefixLength; ++i) {
int r = (char) prefixBytes[i] - (char) bytes[i];
if (r != 0) {
return r > 0; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public static RetentionSet removeStreamCutBefore(RetentionSet set, StreamCutReferenceRecord record) {
Preconditions.checkNotNull(record);
// remove all stream cuts with recordingTime before supplied cut
int beforeIndex = getGreatestLowerBound(set, record.getRecordingTime(), StreamCutReferenceRecord::getRecordingTime);
if (beforeIndex < 0) {
return set;
}
if (beforeIndex + 1 == set.retentionRecords.size()) {
return new RetentionSet(ImmutableList.of());
}
return new RetentionSet(set.retentionRecords.subList(beforeIndex + 1, set.retentionRecords.size()));
} } | public class class_name {
public static RetentionSet removeStreamCutBefore(RetentionSet set, StreamCutReferenceRecord record) {
Preconditions.checkNotNull(record);
// remove all stream cuts with recordingTime before supplied cut
int beforeIndex = getGreatestLowerBound(set, record.getRecordingTime(), StreamCutReferenceRecord::getRecordingTime);
if (beforeIndex < 0) {
return set; // depends on control dependency: [if], data = [none]
}
if (beforeIndex + 1 == set.retentionRecords.size()) {
return new RetentionSet(ImmutableList.of()); // depends on control dependency: [if], data = [none]
}
return new RetentionSet(set.retentionRecords.subList(beforeIndex + 1, set.retentionRecords.size()));
} } |
public class class_name {
@Override
public void run ()
{
boolean lastAcquireFailed = false;
while (!m_aHalted.get ())
{
try
{
// check if we're supposed to pause...
synchronized (m_aSigLock)
{
while (m_bPaused && !m_aHalted.get ())
{
try
{
// wait until togglePause(false) is called...
m_aSigLock.wait (1000L);
}
catch (final InterruptedException ignore)
{}
}
if (m_aHalted.get ())
{
break;
}
}
final int availThreadCount = m_aQSRsrcs.getThreadPool ().blockForAvailableThreads ();
if (availThreadCount > 0)
{ // will always be true, due to semantics of
// blockForAvailableThreads...
ICommonsList <IOperableTrigger> triggers = null;
long now = System.currentTimeMillis ();
clearSignaledSchedulingChange ();
try
{
triggers = m_aQSRsrcs.getJobStore ()
.acquireNextTriggers (now + m_nIdleWaitTime,
Math.min (availThreadCount, m_aQSRsrcs.getMaxBatchSize ()),
m_aQSRsrcs.getBatchTimeWindow ());
lastAcquireFailed = false;
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("batch acquisition of " + (triggers == null ? 0 : triggers.size ()) + " triggers");
}
catch (final JobPersistenceException jpe)
{
if (!lastAcquireFailed)
{
m_aQS.notifySchedulerListenersError ("An error occurred while scanning for the next triggers to fire.",
jpe);
}
lastAcquireFailed = true;
continue;
}
catch (final RuntimeException e)
{
if (!lastAcquireFailed)
{
LOGGER.error ("quartzSchedulerThreadLoop: RuntimeException " + e.getMessage (), e);
}
lastAcquireFailed = true;
continue;
}
if (triggers != null && !triggers.isEmpty ())
{
now = System.currentTimeMillis ();
final long triggerTime = triggers.get (0).getNextFireTime ().getTime ();
long timeUntilTrigger = triggerTime - now;
while (timeUntilTrigger > 2)
{
synchronized (m_aSigLock)
{
if (m_aHalted.get ())
{
break;
}
if (!isCandidateNewTimeEarlierWithinReason (triggerTime, false))
{
try
{
// we could have blocked a long while
// on 'synchronize', so we must recompute
now = System.currentTimeMillis ();
timeUntilTrigger = triggerTime - now;
if (timeUntilTrigger >= 1)
m_aSigLock.wait (timeUntilTrigger);
}
catch (final InterruptedException ignore)
{}
}
}
if (releaseIfScheduleChangedSignificantly (triggers, triggerTime))
{
break;
}
now = System.currentTimeMillis ();
timeUntilTrigger = triggerTime - now;
}
// this happens if releaseIfScheduleChangedSignificantly decided to
// release triggers
if (triggers.isEmpty ())
continue;
// set triggers to 'executing'
ICommonsList <TriggerFiredResult> bndles = new CommonsArrayList <> ();
boolean goAhead = true;
synchronized (m_aSigLock)
{
goAhead = !m_aHalted.get ();
}
if (goAhead)
{
try
{
final ICommonsList <TriggerFiredResult> res = m_aQSRsrcs.getJobStore ().triggersFired (triggers);
if (res != null)
bndles = res;
}
catch (final SchedulerException se)
{
m_aQS.notifySchedulerListenersError ("An error occurred while firing triggers '" + triggers + "'", se);
// QTZ-179 : a problem occurred interacting with the triggers
// from the db
// we release them and loop again
for (int i = 0; i < triggers.size (); i++)
{
m_aQSRsrcs.getJobStore ().releaseAcquiredTrigger (triggers.get (i));
}
continue;
}
}
for (int i = 0; i < bndles.size (); i++)
{
final TriggerFiredResult result = bndles.get (i);
final TriggerFiredBundle bndle = result.getTriggerFiredBundle ();
final Exception exception = result.getException ();
if (exception instanceof RuntimeException)
{
LOGGER.error ("RuntimeException while firing trigger " + triggers.get (i), exception);
m_aQSRsrcs.getJobStore ().releaseAcquiredTrigger (triggers.get (i));
continue;
}
// it's possible to get 'null' if the triggers was paused,
// blocked, or other similar occurrences that prevent it being
// fired at this time... or if the scheduler was shutdown (halted)
if (bndle == null)
{
m_aQSRsrcs.getJobStore ().releaseAcquiredTrigger (triggers.get (i));
continue;
}
JobRunShell shell = null;
try
{
shell = m_aQSRsrcs.getJobRunShellFactory ().createJobRunShell (bndle);
shell.initialize (m_aQS);
}
catch (final SchedulerException se)
{
m_aQSRsrcs.getJobStore ()
.triggeredJobComplete (triggers.get (i),
bndle.getJobDetail (),
ECompletedExecutionInstruction.SET_ALL_JOB_TRIGGERS_ERROR);
continue;
}
if (m_aQSRsrcs.getThreadPool ().runInThread (shell) == false)
{
// this case should never happen, as it is indicative of the
// scheduler being shutdown or a bug in the thread pool or
// a thread pool being used concurrently - which the docs
// say not to do...
LOGGER.error ("ThreadPool.runInThread() return false!");
m_aQSRsrcs.getJobStore ()
.triggeredJobComplete (triggers.get (i),
bndle.getJobDetail (),
ECompletedExecutionInstruction.SET_ALL_JOB_TRIGGERS_ERROR);
}
}
continue; // while (!halted)
}
}
else
{ // if(availThreadCount > 0)
// should never happen, if threadPool.blockForAvailableThreads()
// follows contract
continue; // while (!halted)
}
final long now = System.currentTimeMillis ();
final long waitTime = now + getRandomizedIdleWaitTime ();
final long timeUntilContinue = waitTime - now;
synchronized (m_aSigLock)
{
try
{
if (!m_aHalted.get ())
{
// QTZ-336 A job might have been completed in the mean time and we
// might have
// missed the scheduled changed signal by not waiting for the
// notify() yet
// Check that before waiting for too long in case this very job
// needs to be
// scheduled very soon
if (!isScheduleChanged ())
{
m_aSigLock.wait (timeUntilContinue);
}
}
}
catch (final InterruptedException ignore)
{}
}
}
catch (final RuntimeException re)
{
LOGGER.error ("Runtime error occurred in main trigger firing loop.", re);
}
} // while (!halted)
// drop references to scheduler stuff to aid garbage collection...
m_aQS = null;
m_aQSRsrcs = null;
} } | public class class_name {
@Override
public void run ()
{
boolean lastAcquireFailed = false;
while (!m_aHalted.get ())
{
try
{
// check if we're supposed to pause...
synchronized (m_aSigLock) // depends on control dependency: [try], data = [none]
{
while (m_bPaused && !m_aHalted.get ())
{
try
{
// wait until togglePause(false) is called...
m_aSigLock.wait (1000L); // depends on control dependency: [try], data = [none]
}
catch (final InterruptedException ignore)
{} // depends on control dependency: [catch], data = [none]
}
if (m_aHalted.get ())
{
break;
}
}
final int availThreadCount = m_aQSRsrcs.getThreadPool ().blockForAvailableThreads ();
if (availThreadCount > 0)
{ // will always be true, due to semantics of
// blockForAvailableThreads...
ICommonsList <IOperableTrigger> triggers = null;
long now = System.currentTimeMillis ();
clearSignaledSchedulingChange (); // depends on control dependency: [if], data = [none]
try
{
triggers = m_aQSRsrcs.getJobStore ()
.acquireNextTriggers (now + m_nIdleWaitTime,
Math.min (availThreadCount, m_aQSRsrcs.getMaxBatchSize ()),
m_aQSRsrcs.getBatchTimeWindow ()); // depends on control dependency: [try], data = [none]
lastAcquireFailed = false; // depends on control dependency: [try], data = [none]
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("batch acquisition of " + (triggers == null ? 0 : triggers.size ()) + " triggers");
}
catch (final JobPersistenceException jpe)
{
if (!lastAcquireFailed)
{
m_aQS.notifySchedulerListenersError ("An error occurred while scanning for the next triggers to fire.",
jpe); // depends on control dependency: [if], data = [none]
}
lastAcquireFailed = true;
continue;
} // depends on control dependency: [catch], data = [none]
catch (final RuntimeException e)
{
if (!lastAcquireFailed)
{
LOGGER.error ("quartzSchedulerThreadLoop: RuntimeException " + e.getMessage (), e); // depends on control dependency: [if], data = [none]
}
lastAcquireFailed = true;
continue;
} // depends on control dependency: [catch], data = [none]
if (triggers != null && !triggers.isEmpty ())
{
now = System.currentTimeMillis (); // depends on control dependency: [if], data = [none]
final long triggerTime = triggers.get (0).getNextFireTime ().getTime ();
long timeUntilTrigger = triggerTime - now;
while (timeUntilTrigger > 2)
{
synchronized (m_aSigLock) // depends on control dependency: [while], data = [none]
{
if (m_aHalted.get ())
{
break;
}
if (!isCandidateNewTimeEarlierWithinReason (triggerTime, false))
{
try
{
// we could have blocked a long while
// on 'synchronize', so we must recompute
now = System.currentTimeMillis (); // depends on control dependency: [try], data = [none]
timeUntilTrigger = triggerTime - now; // depends on control dependency: [try], data = [none]
if (timeUntilTrigger >= 1)
m_aSigLock.wait (timeUntilTrigger);
}
catch (final InterruptedException ignore)
{} // depends on control dependency: [catch], data = [none]
}
}
if (releaseIfScheduleChangedSignificantly (triggers, triggerTime))
{
break;
}
now = System.currentTimeMillis (); // depends on control dependency: [while], data = [none]
timeUntilTrigger = triggerTime - now; // depends on control dependency: [while], data = [none]
}
// this happens if releaseIfScheduleChangedSignificantly decided to
// release triggers
if (triggers.isEmpty ())
continue;
// set triggers to 'executing'
ICommonsList <TriggerFiredResult> bndles = new CommonsArrayList <> ();
boolean goAhead = true;
synchronized (m_aSigLock) // depends on control dependency: [if], data = [none]
{
goAhead = !m_aHalted.get ();
}
if (goAhead)
{
try
{
final ICommonsList <TriggerFiredResult> res = m_aQSRsrcs.getJobStore ().triggersFired (triggers);
if (res != null)
bndles = res;
}
catch (final SchedulerException se)
{
m_aQS.notifySchedulerListenersError ("An error occurred while firing triggers '" + triggers + "'", se);
// QTZ-179 : a problem occurred interacting with the triggers
// from the db
// we release them and loop again
for (int i = 0; i < triggers.size (); i++)
{
m_aQSRsrcs.getJobStore ().releaseAcquiredTrigger (triggers.get (i)); // depends on control dependency: [for], data = [i]
}
continue;
} // depends on control dependency: [catch], data = [none]
}
for (int i = 0; i < bndles.size (); i++)
{
final TriggerFiredResult result = bndles.get (i);
final TriggerFiredBundle bndle = result.getTriggerFiredBundle ();
final Exception exception = result.getException ();
if (exception instanceof RuntimeException)
{
LOGGER.error ("RuntimeException while firing trigger " + triggers.get (i), exception); // depends on control dependency: [if], data = [none]
m_aQSRsrcs.getJobStore ().releaseAcquiredTrigger (triggers.get (i)); // depends on control dependency: [if], data = [none]
continue;
}
// it's possible to get 'null' if the triggers was paused,
// blocked, or other similar occurrences that prevent it being
// fired at this time... or if the scheduler was shutdown (halted)
if (bndle == null)
{
m_aQSRsrcs.getJobStore ().releaseAcquiredTrigger (triggers.get (i)); // depends on control dependency: [if], data = [none]
continue;
}
JobRunShell shell = null;
try
{
shell = m_aQSRsrcs.getJobRunShellFactory ().createJobRunShell (bndle); // depends on control dependency: [try], data = [none]
shell.initialize (m_aQS); // depends on control dependency: [try], data = [none]
}
catch (final SchedulerException se)
{
m_aQSRsrcs.getJobStore ()
.triggeredJobComplete (triggers.get (i),
bndle.getJobDetail (),
ECompletedExecutionInstruction.SET_ALL_JOB_TRIGGERS_ERROR);
continue;
} // depends on control dependency: [catch], data = [none]
if (m_aQSRsrcs.getThreadPool ().runInThread (shell) == false)
{
// this case should never happen, as it is indicative of the
// scheduler being shutdown or a bug in the thread pool or
// a thread pool being used concurrently - which the docs
// say not to do...
LOGGER.error ("ThreadPool.runInThread() return false!"); // depends on control dependency: [if], data = [none]
m_aQSRsrcs.getJobStore ()
.triggeredJobComplete (triggers.get (i),
bndle.getJobDetail (),
ECompletedExecutionInstruction.SET_ALL_JOB_TRIGGERS_ERROR); // depends on control dependency: [if], data = [none]
}
}
continue; // while (!halted)
}
}
else
{ // if(availThreadCount > 0)
// should never happen, if threadPool.blockForAvailableThreads()
// follows contract
continue; // while (!halted)
}
final long now = System.currentTimeMillis ();
final long waitTime = now + getRandomizedIdleWaitTime ();
final long timeUntilContinue = waitTime - now;
synchronized (m_aSigLock) // depends on control dependency: [try], data = [none]
{
try
{
if (!m_aHalted.get ())
{
// QTZ-336 A job might have been completed in the mean time and we
// might have
// missed the scheduled changed signal by not waiting for the
// notify() yet
// Check that before waiting for too long in case this very job
// needs to be
// scheduled very soon
if (!isScheduleChanged ())
{
m_aSigLock.wait (timeUntilContinue); // depends on control dependency: [if], data = [none]
}
}
}
catch (final InterruptedException ignore)
{} // depends on control dependency: [catch], data = [none]
}
}
catch (final RuntimeException re)
{
LOGGER.error ("Runtime error occurred in main trigger firing loop.", re);
} // depends on control dependency: [catch], data = [none]
} // while (!halted)
// drop references to scheduler stuff to aid garbage collection...
m_aQS = null;
m_aQSRsrcs = null;
} } |
public class class_name {
public static String getBaseRequestUri(final HttpServletRequest request) {
String result = getForwardRequestUri(request);
if (result == null) {
result = request.getRequestURI();
}
return result;
} } | public class class_name {
public static String getBaseRequestUri(final HttpServletRequest request) {
String result = getForwardRequestUri(request);
if (result == null) {
result = request.getRequestURI(); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
private void setCalendarLocale(ULocale locale) {
ULocale calLocale = locale;
if (locale.getVariant().length() != 0 || locale.getKeywords() != null) {
// Construct a ULocale, without variant and keywords (except calendar).
StringBuilder buf = new StringBuilder();
buf.append(locale.getLanguage());
String script = locale.getScript();
if (script.length() > 0) {
buf.append("_").append(script);
}
String region = locale.getCountry();
if (region.length() > 0) {
buf.append("_").append(region);
}
String calType = locale.getKeywordValue("calendar");
if (calType != null) {
buf.append("@calendar=").append(calType);
}
calLocale = new ULocale(buf.toString());
}
setLocale(calLocale, calLocale);
} } | public class class_name {
private void setCalendarLocale(ULocale locale) {
ULocale calLocale = locale;
if (locale.getVariant().length() != 0 || locale.getKeywords() != null) {
// Construct a ULocale, without variant and keywords (except calendar).
StringBuilder buf = new StringBuilder();
buf.append(locale.getLanguage()); // depends on control dependency: [if], data = [none]
String script = locale.getScript();
if (script.length() > 0) {
buf.append("_").append(script); // depends on control dependency: [if], data = [none]
}
String region = locale.getCountry();
if (region.length() > 0) {
buf.append("_").append(region); // depends on control dependency: [if], data = [none]
}
String calType = locale.getKeywordValue("calendar");
if (calType != null) {
buf.append("@calendar=").append(calType); // depends on control dependency: [if], data = [(calType]
}
calLocale = new ULocale(buf.toString()); // depends on control dependency: [if], data = [none]
}
setLocale(calLocale, calLocale);
} } |
public class class_name {
@Override protected int readData(byte[] buffer, int offset)
{
FixedSizeItemsBlock data = new FixedSizeItemsBlock().read(buffer, offset);
offset = data.getOffset();
byte[][] rawData = data.getData();
m_data = new Double[rawData.length];
for (int index = 0; index < rawData.length; index++)
{
m_data[index] = FastTrackUtility.getDouble(rawData[index], 0);
}
return offset;
} } | public class class_name {
@Override protected int readData(byte[] buffer, int offset)
{
FixedSizeItemsBlock data = new FixedSizeItemsBlock().read(buffer, offset);
offset = data.getOffset();
byte[][] rawData = data.getData();
m_data = new Double[rawData.length];
for (int index = 0; index < rawData.length; index++)
{
m_data[index] = FastTrackUtility.getDouble(rawData[index], 0); // depends on control dependency: [for], data = [index]
}
return offset;
} } |
public class class_name {
public int length() {
try {
final StringBuilder s = read(MIN_LENGTH);
pushBack.append(s);
return s.length();
} catch (IOException ex) {
LOGGER.warn("Oops ", ex);
}
return 0;
} } | public class class_name {
public int length() {
try {
final StringBuilder s = read(MIN_LENGTH);
pushBack.append(s); // depends on control dependency: [try], data = [none]
return s.length(); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
LOGGER.warn("Oops ", ex);
} // depends on control dependency: [catch], data = [none]
return 0;
} } |
public class class_name {
@Override
public EEnum getIfcSIPrefix() {
if (ifcSIPrefixEEnum == null) {
ifcSIPrefixEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(1056);
}
return ifcSIPrefixEEnum;
} } | public class class_name {
@Override
public EEnum getIfcSIPrefix() {
if (ifcSIPrefixEEnum == null) {
ifcSIPrefixEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(1056);
// depends on control dependency: [if], data = [none]
}
return ifcSIPrefixEEnum;
} } |
public class class_name {
@Override
public void setIntHeader(String hdr, int value) {
if (-1 == value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setIntHeader(" + hdr + ", -1), removing header");
}
this.response.removeHeader(hdr);
} else {
this.response.setHeader(hdr, Integer.toString(value));
}
} } | public class class_name {
@Override
public void setIntHeader(String hdr, int value) {
if (-1 == value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setIntHeader(" + hdr + ", -1), removing header"); // depends on control dependency: [if], data = [none]
}
this.response.removeHeader(hdr); // depends on control dependency: [if], data = [none]
} else {
this.response.setHeader(hdr, Integer.toString(value)); // depends on control dependency: [if], data = [value)]
}
} } |
public class class_name {
private void setup(DMatrixRBlock orig) {
blockLength = orig.blockLength;
dataW.blockLength = blockLength;
dataWTA.blockLength = blockLength;
this.dataA = orig;
A.original = dataA;
int l = Math.min(blockLength,orig.numCols);
dataW.reshape(orig.numRows,l,false);
dataWTA.reshape(l,orig.numRows,false);
Y.original = orig;
Y.row1 = W.row1 = orig.numRows;
if( temp.length < blockLength )
temp = new double[blockLength];
if( gammas.length < orig.numCols )
gammas = new double[ orig.numCols ];
if( saveW ) {
dataW.reshape(orig.numRows,orig.numCols,false);
}
} } | public class class_name {
private void setup(DMatrixRBlock orig) {
blockLength = orig.blockLength;
dataW.blockLength = blockLength;
dataWTA.blockLength = blockLength;
this.dataA = orig;
A.original = dataA;
int l = Math.min(blockLength,orig.numCols);
dataW.reshape(orig.numRows,l,false);
dataWTA.reshape(l,orig.numRows,false);
Y.original = orig;
Y.row1 = W.row1 = orig.numRows;
if( temp.length < blockLength )
temp = new double[blockLength];
if( gammas.length < orig.numCols )
gammas = new double[ orig.numCols ];
if( saveW ) {
dataW.reshape(orig.numRows,orig.numCols,false); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean removeLastOccurrence(Object o) {
if (o == null) {
for (Node<E> x = last; x != null; x = x.prev) {
if (x.item == null) {
unlink(x);
return true;
}
}
} else {
for (Node<E> x = last; x != null; x = x.prev) {
if (o.equals(x.item)) {
unlink(x);
return true;
}
}
}
return false;
} } | public class class_name {
public boolean removeLastOccurrence(Object o) {
if (o == null) {
for (Node<E> x = last; x != null; x = x.prev) {
if (x.item == null) {
unlink(x); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
} else {
for (Node<E> x = last; x != null; x = x.prev) {
if (o.equals(x.item)) {
unlink(x); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.