code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static BaseResult templateApi_set_industry(String access_token, String... industrys) {
Map<String, String> map = new LinkedHashMap<String, String>();
for (int i = 1; i <= industrys.length; i++) {
map.put("industry_id" + i, industrys[i - 1]);
}
String messageJson = JsonUtil.toJSONString(map);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI + "/cgi-bin/template/api_set_industry")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.setEntity(new StringEntity(messageJson, Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest, BaseResult.class);
} }
|
public class class_name {
public static BaseResult templateApi_set_industry(String access_token, String... industrys) {
Map<String, String> map = new LinkedHashMap<String, String>();
for (int i = 1; i <= industrys.length; i++) {
map.put("industry_id" + i, industrys[i - 1]); // depends on control dependency: [for], data = [i]
}
String messageJson = JsonUtil.toJSONString(map);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI + "/cgi-bin/template/api_set_industry")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.setEntity(new StringEntity(messageJson, Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest, BaseResult.class);
} }
|
public class class_name {
public CompletableFuture<Void> close() {
CompletableFuture<Void> future = new CompletableFuture<>();
threadContext.execute(() -> {
try {
clusterMembershipService.removeListener(membershipEventListener);
primaryElection.removeListener(primaryElectionListener);
role.close();
} finally {
future.complete(null);
}
});
return future.thenRunAsync(() -> threadContext.close());
} }
|
public class class_name {
public CompletableFuture<Void> close() {
CompletableFuture<Void> future = new CompletableFuture<>();
threadContext.execute(() -> {
try {
clusterMembershipService.removeListener(membershipEventListener); // depends on control dependency: [try], data = [none]
primaryElection.removeListener(primaryElectionListener); // depends on control dependency: [try], data = [none]
role.close(); // depends on control dependency: [try], data = [none]
} finally {
future.complete(null);
}
});
return future.thenRunAsync(() -> threadContext.close());
} }
|
public class class_name {
private void saveMatrix() {
for (String chainId : currentChainIDs) {
BiologicalAssemblyTransformation transformation = new BiologicalAssemblyTransformation();
transformation.setRotationMatrix(currentMatrix.getArray());
transformation.setTranslation(shift);
transformation.setId(String.valueOf(modelNumber));
transformation.setChainId(chainId);
transformations.add(transformation);
}
if (!transformationMap.containsKey(currentBioMolecule)) {
BioAssemblyInfo bioAssembly = new BioAssemblyInfo();
bioAssembly.setId(currentBioMolecule);
bioAssembly.setTransforms(transformations);
transformationMap.put(currentBioMolecule,bioAssembly);
}
} }
|
public class class_name {
private void saveMatrix() {
for (String chainId : currentChainIDs) {
BiologicalAssemblyTransformation transformation = new BiologicalAssemblyTransformation();
transformation.setRotationMatrix(currentMatrix.getArray()); // depends on control dependency: [for], data = [none]
transformation.setTranslation(shift); // depends on control dependency: [for], data = [none]
transformation.setId(String.valueOf(modelNumber)); // depends on control dependency: [for], data = [none]
transformation.setChainId(chainId); // depends on control dependency: [for], data = [chainId]
transformations.add(transformation); // depends on control dependency: [for], data = [none]
}
if (!transformationMap.containsKey(currentBioMolecule)) {
BioAssemblyInfo bioAssembly = new BioAssemblyInfo();
bioAssembly.setId(currentBioMolecule); // depends on control dependency: [if], data = [none]
bioAssembly.setTransforms(transformations); // depends on control dependency: [if], data = [none]
transformationMap.put(currentBioMolecule,bioAssembly); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public T grow() {
if( size < data.length ) {
return data[size++];
} else {
growArray((data.length+1)*2);
return data[size++];
}
} }
|
public class class_name {
public T grow() {
if( size < data.length ) {
return data[size++]; // depends on control dependency: [if], data = [none]
} else {
growArray((data.length+1)*2); // depends on control dependency: [if], data = [none]
return data[size++]; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String htmlModuleHelpDescriptions() {
StringBuffer html = new StringBuffer(1024);
Iterator<String> itModules = sortModules(getAvailableModules().values()).iterator();
for (int i = 0; itModules.hasNext(); i++) {
String moduleName = itModules.next();
CmsModule module = getAvailableModules().get(moduleName);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(module.getDescription())) {
html.append(getHtmlPart("C_HELP_START", "" + i));
html.append(module.getDescription());
html.append("\n");
html.append(getHtmlPart("C_HELP_END"));
html.append("\n");
}
}
return html.toString();
} }
|
public class class_name {
public String htmlModuleHelpDescriptions() {
StringBuffer html = new StringBuffer(1024);
Iterator<String> itModules = sortModules(getAvailableModules().values()).iterator();
for (int i = 0; itModules.hasNext(); i++) {
String moduleName = itModules.next();
CmsModule module = getAvailableModules().get(moduleName);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(module.getDescription())) {
html.append(getHtmlPart("C_HELP_START", "" + i)); // depends on control dependency: [if], data = [none]
html.append(module.getDescription()); // depends on control dependency: [if], data = [none]
html.append("\n"); // depends on control dependency: [if], data = [none]
html.append(getHtmlPart("C_HELP_END")); // depends on control dependency: [if], data = [none]
html.append("\n"); // depends on control dependency: [if], data = [none]
}
}
return html.toString();
} }
|
public class class_name {
public static boolean intersectRaySphere(float originX, float originY, float originZ, float dirX, float dirY, float dirZ,
float centerX, float centerY, float centerZ, float radiusSquared, Vector2f result) {
float Lx = centerX - originX;
float Ly = centerY - originY;
float Lz = centerZ - originZ;
float tca = Lx * dirX + Ly * dirY + Lz * dirZ;
float d2 = Lx * Lx + Ly * Ly + Lz * Lz - tca * tca;
if (d2 > radiusSquared)
return false;
float thc = (float) Math.sqrt(radiusSquared - d2);
float t0 = tca - thc;
float t1 = tca + thc;
if (t0 < t1 && t1 >= 0.0f) {
result.x = t0;
result.y = t1;
return true;
}
return false;
} }
|
public class class_name {
public static boolean intersectRaySphere(float originX, float originY, float originZ, float dirX, float dirY, float dirZ,
float centerX, float centerY, float centerZ, float radiusSquared, Vector2f result) {
float Lx = centerX - originX;
float Ly = centerY - originY;
float Lz = centerZ - originZ;
float tca = Lx * dirX + Ly * dirY + Lz * dirZ;
float d2 = Lx * Lx + Ly * Ly + Lz * Lz - tca * tca;
if (d2 > radiusSquared)
return false;
float thc = (float) Math.sqrt(radiusSquared - d2);
float t0 = tca - thc;
float t1 = tca + thc;
if (t0 < t1 && t1 >= 0.0f) {
result.x = t0; // depends on control dependency: [if], data = [none]
result.y = t1; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public void setFields(List<Field> fields) throws SqlParseException {
/*
zhongshu-comment select * from tbl_a;
select * 这种sql语句的select.getFields().size()为0
*/
if (select.getFields().size() > 0) {
ArrayList<String> includeFields = new ArrayList<String>();
ArrayList<String> excludeFields = new ArrayList<String>();
for (Field field : fields) {
if (field instanceof MethodField) { //zhongshu-comment MethodField是Field的子类,而且Field也就只有MethodField这一个子类了
MethodField method = (MethodField) field;
if (method.getName().toLowerCase().equals("script")) {
/*
zhongshu-comment scripted_field only allows script(name,script) or script(name,lang,script)
script类型的MethodField是不会加到include和exclude中的
*/
handleScriptField(method);
} else if (method.getName().equalsIgnoreCase("include")) {
String f;
for (KVValue kvValue : method.getParams()) {
//zhongshu-comment select a,b,c 中的a、b、c字段add到includeFields中
f = kvValue.value.toString();
fieldNames.add(f);
includeFields.add(f);
}
} else if (method.getName().equalsIgnoreCase("exclude")) {
for (KVValue kvValue : method.getParams()) {
excludeFields.add(kvValue.value.toString()) ;
}
}
} else if (field != null) {
fieldNames.add(field.getName());
includeFields.add(field.getName());
}
}
request.setFetchSource(
includeFields.toArray(new String[includeFields.size()]),
excludeFields.toArray(new String[excludeFields.size()])
);
}
} }
|
public class class_name {
public void setFields(List<Field> fields) throws SqlParseException {
/*
zhongshu-comment select * from tbl_a;
select * 这种sql语句的select.getFields().size()为0
*/
if (select.getFields().size() > 0) {
ArrayList<String> includeFields = new ArrayList<String>();
ArrayList<String> excludeFields = new ArrayList<String>();
for (Field field : fields) {
if (field instanceof MethodField) { //zhongshu-comment MethodField是Field的子类,而且Field也就只有MethodField这一个子类了
MethodField method = (MethodField) field;
if (method.getName().toLowerCase().equals("script")) {
/*
zhongshu-comment scripted_field only allows script(name,script) or script(name,lang,script)
script类型的MethodField是不会加到include和exclude中的
*/
handleScriptField(method); // depends on control dependency: [if], data = [none]
} else if (method.getName().equalsIgnoreCase("include")) {
String f;
for (KVValue kvValue : method.getParams()) {
//zhongshu-comment select a,b,c 中的a、b、c字段add到includeFields中
f = kvValue.value.toString(); // depends on control dependency: [for], data = [kvValue]
fieldNames.add(f); // depends on control dependency: [for], data = [none]
includeFields.add(f); // depends on control dependency: [for], data = [none]
}
} else if (method.getName().equalsIgnoreCase("exclude")) {
for (KVValue kvValue : method.getParams()) {
excludeFields.add(kvValue.value.toString()) ; // depends on control dependency: [for], data = [kvValue]
}
}
} else if (field != null) {
fieldNames.add(field.getName()); // depends on control dependency: [if], data = [(field]
includeFields.add(field.getName()); // depends on control dependency: [if], data = [(field]
}
}
request.setFetchSource(
includeFields.toArray(new String[includeFields.size()]),
excludeFields.toArray(new String[excludeFields.size()])
);
}
} }
|
public class class_name {
public HttpSession getHttpSession(String name) {
synchronized (this.sessions) {
for (HttpSession session : sessions) {
if (session.getName().equals(name)) {
return session;
}
}
}
return null;
} }
|
public class class_name {
public HttpSession getHttpSession(String name) {
synchronized (this.sessions) {
for (HttpSession session : sessions) {
if (session.getName().equals(name)) {
return session; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
public boolean hasStream(SIBUuid12 streamID, int priority, Reliability reliability ) throws SIResourceException
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "hasStream",
new Object[]{streamID, new Integer(priority), reliability});
StreamSet streamSet = (StreamSet) streamSets.get(streamID);
if(streamSet != null)
{
if ( streamSet.getStream(priority, reliability) != null )
{
if (tc.isEntryEnabled()) SibTr.exit(tc, "hasStream", Boolean.TRUE);
return true;
}
}
if (tc.isEntryEnabled()) SibTr.exit(tc, "hasStream", Boolean.FALSE);
return false;
} }
|
public class class_name {
public boolean hasStream(SIBUuid12 streamID, int priority, Reliability reliability ) throws SIResourceException
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "hasStream",
new Object[]{streamID, new Integer(priority), reliability});
StreamSet streamSet = (StreamSet) streamSets.get(streamID);
if(streamSet != null)
{
if ( streamSet.getStream(priority, reliability) != null )
{
if (tc.isEntryEnabled()) SibTr.exit(tc, "hasStream", Boolean.TRUE);
return true; // depends on control dependency: [if], data = [none]
}
}
if (tc.isEntryEnabled()) SibTr.exit(tc, "hasStream", Boolean.FALSE);
return false;
} }
|
public class class_name {
public int getLength()
{
// Tell if this is being called from within a predicate.
boolean isPredicateTest = (this == m_execContext.getSubContextList());
// And get how many total predicates are part of this step.
int predCount = getPredicateCount();
// If we have already calculated the length, and the current predicate
// is the first predicate, then return the length. We don't cache
// the anything but the length of the list to the first predicate.
if (-1 != m_length && isPredicateTest && m_predicateIndex < 1)
return m_length;
// I'm a bit worried about this one, since it doesn't have the
// checks found above. I suspect it's fine. -sb
if (m_foundLast)
return m_pos;
// Create a clone, and count from the current position to the end
// of the list, not taking into account the current predicate and
// predicates after the current one.
int pos = (m_predicateIndex >= 0) ? getProximityPosition() : m_pos;
LocPathIterator clone;
try
{
clone = (LocPathIterator) clone();
}
catch (CloneNotSupportedException cnse)
{
return -1;
}
// We want to clip off the last predicate, but only if we are a sub
// context node list, NOT if we are a context list. See pos68 test,
// also test against bug4638.
if (predCount > 0 && isPredicateTest)
{
// Don't call setPredicateCount, because it clones and is slower.
clone.m_predCount = m_predicateIndex;
// The line above used to be:
// clone.m_predCount = predCount - 1;
// ...which looks like a dumb bug to me. -sb
}
int next;
while (DTM.NULL != (next = clone.nextNode()))
{
pos++;
}
if (isPredicateTest && m_predicateIndex < 1)
m_length = pos;
return pos;
} }
|
public class class_name {
public int getLength()
{
// Tell if this is being called from within a predicate.
boolean isPredicateTest = (this == m_execContext.getSubContextList());
// And get how many total predicates are part of this step.
int predCount = getPredicateCount();
// If we have already calculated the length, and the current predicate
// is the first predicate, then return the length. We don't cache
// the anything but the length of the list to the first predicate.
if (-1 != m_length && isPredicateTest && m_predicateIndex < 1)
return m_length;
// I'm a bit worried about this one, since it doesn't have the
// checks found above. I suspect it's fine. -sb
if (m_foundLast)
return m_pos;
// Create a clone, and count from the current position to the end
// of the list, not taking into account the current predicate and
// predicates after the current one.
int pos = (m_predicateIndex >= 0) ? getProximityPosition() : m_pos;
LocPathIterator clone;
try
{
clone = (LocPathIterator) clone(); // depends on control dependency: [try], data = [none]
}
catch (CloneNotSupportedException cnse)
{
return -1;
} // depends on control dependency: [catch], data = [none]
// We want to clip off the last predicate, but only if we are a sub
// context node list, NOT if we are a context list. See pos68 test,
// also test against bug4638.
if (predCount > 0 && isPredicateTest)
{
// Don't call setPredicateCount, because it clones and is slower.
clone.m_predCount = m_predicateIndex; // depends on control dependency: [if], data = [none]
// The line above used to be:
// clone.m_predCount = predCount - 1;
// ...which looks like a dumb bug to me. -sb
}
int next;
while (DTM.NULL != (next = clone.nextNode()))
{
pos++; // depends on control dependency: [while], data = [none]
}
if (isPredicateTest && m_predicateIndex < 1)
m_length = pos;
return pos;
} }
|
public class class_name {
protected void onURLConnectionPrepared(final Context context, final URLConnection urlConnection) {
if (contentType != null) {
urlConnection.addRequestProperty("Content-Type", contentType);
}
if (contentLanguage != null) {
urlConnection.addRequestProperty("Accept-Language", contentLanguage);
}
urlConnection.addRequestProperty("Accept-Encoding", IoUtils.ENCODING_GZIP);
urlConnection.addRequestProperty("User-Agent", buildUserAgent(context));
if (headers != null) {
for (String name : headers.keySet()) {
urlConnection.addRequestProperty(name, headers.getString(name));
}
}
} }
|
public class class_name {
protected void onURLConnectionPrepared(final Context context, final URLConnection urlConnection) {
if (contentType != null) {
urlConnection.addRequestProperty("Content-Type", contentType);
// depends on control dependency: [if], data = [none]
}
if (contentLanguage != null) {
urlConnection.addRequestProperty("Accept-Language", contentLanguage);
// depends on control dependency: [if], data = [none]
}
urlConnection.addRequestProperty("Accept-Encoding", IoUtils.ENCODING_GZIP);
urlConnection.addRequestProperty("User-Agent", buildUserAgent(context));
if (headers != null) {
for (String name : headers.keySet()) {
urlConnection.addRequestProperty(name, headers.getString(name));
// depends on control dependency: [for], data = [name]
}
}
} }
|
public class class_name {
public EEnum getIfcRailingTypeEnum() {
if (ifcRailingTypeEnumEEnum == null) {
ifcRailingTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(880);
}
return ifcRailingTypeEnumEEnum;
} }
|
public class class_name {
public EEnum getIfcRailingTypeEnum() {
if (ifcRailingTypeEnumEEnum == null) {
ifcRailingTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(880);
// depends on control dependency: [if], data = [none]
}
return ifcRailingTypeEnumEEnum;
} }
|
public class class_name {
public SuppressedState suppressedState(
Suppressible suppressible, boolean suppressedInGeneratedCode) {
if (inGeneratedCode && suppressedInGeneratedCode) {
return SuppressedState.SUPPRESSED;
}
if (suppressible.supportsSuppressWarnings()
&& !Collections.disjoint(suppressible.allNames(), suppressWarningsStrings)) {
return SuppressedState.SUPPRESSED;
}
if (!Collections.disjoint(suppressible.customSuppressionAnnotations(), customSuppressions)) {
return SuppressedState.SUPPRESSED;
}
return SuppressedState.UNSUPPRESSED;
} }
|
public class class_name {
public SuppressedState suppressedState(
Suppressible suppressible, boolean suppressedInGeneratedCode) {
if (inGeneratedCode && suppressedInGeneratedCode) {
return SuppressedState.SUPPRESSED; // depends on control dependency: [if], data = [none]
}
if (suppressible.supportsSuppressWarnings()
&& !Collections.disjoint(suppressible.allNames(), suppressWarningsStrings)) {
return SuppressedState.SUPPRESSED; // depends on control dependency: [if], data = [none]
}
if (!Collections.disjoint(suppressible.customSuppressionAnnotations(), customSuppressions)) {
return SuppressedState.SUPPRESSED; // depends on control dependency: [if], data = [none]
}
return SuppressedState.UNSUPPRESSED;
} }
|
public class class_name {
public java.util.List<String> getAnalysisSchemeNames() {
if (analysisSchemeNames == null) {
analysisSchemeNames = new com.amazonaws.internal.SdkInternalList<String>();
}
return analysisSchemeNames;
} }
|
public class class_name {
public java.util.List<String> getAnalysisSchemeNames() {
if (analysisSchemeNames == null) {
analysisSchemeNames = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return analysisSchemeNames;
} }
|
public class class_name {
@Override
public List<ChannelInformation> listChannels() {
List<Channel> channels = channelDirectory.getChannels();
List<ChannelInformation> channelInformationList = new LinkedList<ChannelInformation>();
for (Channel channel : channels) {
ChannelInformation channelInfo = new ChannelInformation(channel.getChannelId(), 0, 0);
channelInformationList.add(channelInfo);
}
return channelInformationList;
} }
|
public class class_name {
@Override
public List<ChannelInformation> listChannels() {
List<Channel> channels = channelDirectory.getChannels();
List<ChannelInformation> channelInformationList = new LinkedList<ChannelInformation>();
for (Channel channel : channels) {
ChannelInformation channelInfo = new ChannelInformation(channel.getChannelId(), 0, 0);
channelInformationList.add(channelInfo); // depends on control dependency: [for], data = [channel]
}
return channelInformationList;
} }
|
public class class_name {
public static String getOtpauthURL(String name, String issuer, String secret, HmacShaAlgorithm algorithm, String digits, String period) {
Objects.requireNonNull(name, Required.ACCOUNT_NAME.toString());
Objects.requireNonNull(secret, Required.SECRET.toString());
Objects.requireNonNull(issuer, Required.ISSUER.toString());
Objects.requireNonNull(algorithm, Required.ALGORITHM.toString());
Objects.requireNonNull(digits, Required.DIGITS.toString());
Objects.requireNonNull(period, Required.PERIOD.toString());
var buffer = new StringBuilder();
buffer.append("otpauth://totp/")
.append(name)
.append("?secret=")
.append(RegExUtils.replaceAll(base32.encodeAsString(secret.getBytes(StandardCharsets.UTF_8)), "=", ""))
.append("&algorithm=")
.append(algorithm.getAlgorithm())
.append("&issuer=")
.append(issuer)
.append("&digits=")
.append(digits)
.append("&period=")
.append(period);
String url = "";
try {
url = URLEncoder.encode(buffer.toString(), StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
LOG.error("Failed to encode otpauth url", e);
}
return url;
} }
|
public class class_name {
public static String getOtpauthURL(String name, String issuer, String secret, HmacShaAlgorithm algorithm, String digits, String period) {
Objects.requireNonNull(name, Required.ACCOUNT_NAME.toString());
Objects.requireNonNull(secret, Required.SECRET.toString());
Objects.requireNonNull(issuer, Required.ISSUER.toString());
Objects.requireNonNull(algorithm, Required.ALGORITHM.toString());
Objects.requireNonNull(digits, Required.DIGITS.toString());
Objects.requireNonNull(period, Required.PERIOD.toString());
var buffer = new StringBuilder();
buffer.append("otpauth://totp/")
.append(name)
.append("?secret=")
.append(RegExUtils.replaceAll(base32.encodeAsString(secret.getBytes(StandardCharsets.UTF_8)), "=", ""))
.append("&algorithm=")
.append(algorithm.getAlgorithm())
.append("&issuer=")
.append(issuer)
.append("&digits=")
.append(digits)
.append("&period=")
.append(period);
String url = "";
try {
url = URLEncoder.encode(buffer.toString(), StandardCharsets.UTF_8.name()); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
LOG.error("Failed to encode otpauth url", e);
} // depends on control dependency: [catch], data = [none]
return url;
} }
|
public class class_name {
public String getQueryString(TableSchema tableSchema, Phase phase) throws Exception {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
if( Type.X == type ) {
pw.print("ST_X");
} else if( Type.Y == type ) {
pw.print("ST_Y");
} else {
throw new Exception("Can not handle type: "+type);
}
pw.print("(ST_Centroid(coalesce(ST_GeometryN(");
pw.print(fieldName);
pw.print(",1),");
pw.print(fieldName);
pw.print(")))");
if( Phase.SELECT == phase ) {
if( Type.X == type ) {
pw.print(" AS x");
} else if( Type.Y == type ) {
pw.print(" AS y");
} else {
throw new Exception("Can not handle type: "+type);
}
}
pw.flush();
return sw.toString();
} }
|
public class class_name {
public String getQueryString(TableSchema tableSchema, Phase phase) throws Exception {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
if( Type.X == type ) {
pw.print("ST_X");
} else if( Type.Y == type ) {
pw.print("ST_Y");
} else {
throw new Exception("Can not handle type: "+type);
}
pw.print("(ST_Centroid(coalesce(ST_GeometryN(");
pw.print(fieldName);
pw.print(",1),");
pw.print(fieldName);
pw.print(")))");
if( Phase.SELECT == phase ) {
if( Type.X == type ) {
pw.print(" AS x"); // depends on control dependency: [if], data = [none]
} else if( Type.Y == type ) {
pw.print(" AS y"); // depends on control dependency: [if], data = [none]
} else {
throw new Exception("Can not handle type: "+type);
}
}
pw.flush();
return sw.toString();
} }
|
public class class_name {
public EEnum getFNCFNORGLen() {
if (fncfnorgLenEEnum == null) {
fncfnorgLenEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(24);
}
return fncfnorgLenEEnum;
} }
|
public class class_name {
public EEnum getFNCFNORGLen() {
if (fncfnorgLenEEnum == null) {
fncfnorgLenEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(24); // depends on control dependency: [if], data = [none]
}
return fncfnorgLenEEnum;
} }
|
public class class_name {
@Override
public void connectionReleased(IManagedConnectionEvent<C> event) {
IPhynixxManagedConnection<C> proxy = event.getManagedConnection();
if (LOG.isDebugEnabled()) {
LOG.debug("Proxy " + proxy + " released");
}
} }
|
public class class_name {
@Override
public void connectionReleased(IManagedConnectionEvent<C> event) {
IPhynixxManagedConnection<C> proxy = event.getManagedConnection();
if (LOG.isDebugEnabled()) {
LOG.debug("Proxy " + proxy + " released"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public Object getAttribute(String name) {
Object value = this.attributes.get(name);
if (null == value && null != this.connection.getSSLContext()) {
// special case logic for SSL based connections
if (PEER_CERTS.equals(name)
|| SERVLET_CERTS.equals(name)) {
value = getPeerCertificates();
} else if (CIPHER_SUITE.equals(name)) {
value = getCipherSuite();
} else if (SSL_SESSION.equals(name)) {
value = this.connection.getSSLContext().getSession();
}
}
return value;
} }
|
public class class_name {
@Override
public Object getAttribute(String name) {
Object value = this.attributes.get(name);
if (null == value && null != this.connection.getSSLContext()) {
// special case logic for SSL based connections
if (PEER_CERTS.equals(name)
|| SERVLET_CERTS.equals(name)) {
value = getPeerCertificates(); // depends on control dependency: [if], data = [none]
} else if (CIPHER_SUITE.equals(name)) {
value = getCipherSuite(); // depends on control dependency: [if], data = [none]
} else if (SSL_SESSION.equals(name)) {
value = this.connection.getSSLContext().getSession(); // depends on control dependency: [if], data = [none]
}
}
return value;
} }
|
public class class_name {
public boolean processClassFile(String fileName) {
Path path = Paths.get(fileName);
try {
ClassFile cf = ClassFile.read(path);
processClass(cf);
return true;
} catch (NoSuchFileException nsfe) {
errorNoFile(fileName);
} catch (IOException | ConstantPoolException ex) {
errorException(ex);
}
return false;
} }
|
public class class_name {
public boolean processClassFile(String fileName) {
Path path = Paths.get(fileName);
try {
ClassFile cf = ClassFile.read(path);
processClass(cf); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (NoSuchFileException nsfe) {
errorNoFile(fileName);
} catch (IOException | ConstantPoolException ex) { // depends on control dependency: [catch], data = [none]
errorException(ex);
} // depends on control dependency: [catch], data = [none]
return false;
} }
|
public class class_name {
public static UserBean unmarshallUser(Map<String, Object> source) {
if (source == null) {
return null;
}
UserBean bean = new UserBean();
bean.setUsername(asString(source.get("username")));
bean.setEmail(asString(source.get("email")));
bean.setFullName(asString(source.get("fullName")));
bean.setJoinedOn(asDate(source.get("joinedOn")));
postMarshall(bean);
return bean;
} }
|
public class class_name {
public static UserBean unmarshallUser(Map<String, Object> source) {
if (source == null) {
return null; // depends on control dependency: [if], data = [none]
}
UserBean bean = new UserBean();
bean.setUsername(asString(source.get("username")));
bean.setEmail(asString(source.get("email")));
bean.setFullName(asString(source.get("fullName")));
bean.setJoinedOn(asDate(source.get("joinedOn")));
postMarshall(bean);
return bean;
} }
|
public class class_name {
public void marshall(UserPoolConfig userPoolConfig, ProtocolMarshaller protocolMarshaller) {
if (userPoolConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userPoolConfig.getUserPoolId(), USERPOOLID_BINDING);
protocolMarshaller.marshall(userPoolConfig.getAwsRegion(), AWSREGION_BINDING);
protocolMarshaller.marshall(userPoolConfig.getDefaultAction(), DEFAULTACTION_BINDING);
protocolMarshaller.marshall(userPoolConfig.getAppIdClientRegex(), APPIDCLIENTREGEX_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(UserPoolConfig userPoolConfig, ProtocolMarshaller protocolMarshaller) {
if (userPoolConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userPoolConfig.getUserPoolId(), USERPOOLID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolConfig.getAwsRegion(), AWSREGION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolConfig.getDefaultAction(), DEFAULTACTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolConfig.getAppIdClientRegex(), APPIDCLIENTREGEX_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 Drawable getDrawableFromResourceValue(String drawableId) {
if (drawableId == null || drawableId.length() == 0 || "0".equals(drawableId)) {
return null;
}
try {
// First, see if it's just an integer
int resourceId = Integer.parseInt(drawableId);
// It's an int, look for it in the cache
String drawableUri = ContentResolver.SCHEME_ANDROID_RESOURCE
+ "://" + mProviderContext.getPackageName() + "/" + resourceId;
// Must use URI as cache key, since ints are app-specific
Drawable drawable = checkIconCache(drawableUri);
if (drawable != null) {
return drawable;
}
// Not cached, find it by resource ID
drawable = mProviderContext.getResources().getDrawable(resourceId);
// Stick it in the cache, using the URI as key
storeInIconCache(drawableUri, drawable);
return drawable;
} catch (NumberFormatException nfe) {
// It's not an integer, use it as a URI
Drawable drawable = checkIconCache(drawableId);
if (drawable != null) {
return drawable;
}
Uri uri = Uri.parse(drawableId);
drawable = getDrawable(uri);
storeInIconCache(drawableId, drawable);
return drawable;
} catch (Resources.NotFoundException nfe) {
// It was an integer, but it couldn't be found, bail out
Log.w(LOG_TAG, "Icon resource not found: " + drawableId);
return null;
}
} }
|
public class class_name {
private Drawable getDrawableFromResourceValue(String drawableId) {
if (drawableId == null || drawableId.length() == 0 || "0".equals(drawableId)) {
return null; // depends on control dependency: [if], data = [none]
}
try {
// First, see if it's just an integer
int resourceId = Integer.parseInt(drawableId);
// It's an int, look for it in the cache
String drawableUri = ContentResolver.SCHEME_ANDROID_RESOURCE
+ "://" + mProviderContext.getPackageName() + "/" + resourceId;
// Must use URI as cache key, since ints are app-specific
Drawable drawable = checkIconCache(drawableUri);
if (drawable != null) {
return drawable; // depends on control dependency: [if], data = [none]
}
// Not cached, find it by resource ID
drawable = mProviderContext.getResources().getDrawable(resourceId); // depends on control dependency: [try], data = [none]
// Stick it in the cache, using the URI as key
storeInIconCache(drawableUri, drawable); // depends on control dependency: [try], data = [none]
return drawable; // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
// It's not an integer, use it as a URI
Drawable drawable = checkIconCache(drawableId);
if (drawable != null) {
return drawable; // depends on control dependency: [if], data = [none]
}
Uri uri = Uri.parse(drawableId);
drawable = getDrawable(uri);
storeInIconCache(drawableId, drawable);
return drawable;
} catch (Resources.NotFoundException nfe) { // depends on control dependency: [catch], data = [none]
// It was an integer, but it couldn't be found, bail out
Log.w(LOG_TAG, "Icon resource not found: " + drawableId);
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@SuppressWarnings( "unchecked" )
private FieldMetadata processVariableDeclaration( SingleVariableDeclaration singleVariableDeclaration,
Type type ) {
Variable variable;
if (type.isPrimitiveType()) {
FieldMetadata primitiveFieldMetadata = FieldMetadata.primitiveType(((PrimitiveType)type).getPrimitiveTypeCode().toString());
variable = new Variable();
variable.setName(JavaMetadataUtil.getName(singleVariableDeclaration.getName()));
primitiveFieldMetadata.setName(variable.getName());
primitiveFieldMetadata.getVariables().add(variable);
for (IExtendedModifier extendedModifier : (List<IExtendedModifier>)singleVariableDeclaration.modifiers()) {
if (extendedModifier.isAnnotation()) {
primitiveFieldMetadata.getAnnotations().add(createAnnotationMetadataFor((Annotation)extendedModifier));
} else {
Modifier modifier = (Modifier)extendedModifier;
primitiveFieldMetadata.getModifiers().add(new ModifierMetadata(modifier.getKeyword().toString()));
}
}
return primitiveFieldMetadata;
}
if (type.isSimpleType()) {
SimpleType simpleType = (SimpleType)type;
FieldMetadata simpleTypeFieldMetadata = FieldMetadata.simpleType(JavaMetadataUtil.getName(simpleType.getName()));
variable = new Variable();
variable.setName(JavaMetadataUtil.getName(singleVariableDeclaration.getName()));
simpleTypeFieldMetadata.setName(variable.getName());
simpleTypeFieldMetadata.getVariables().add(variable);
for (IExtendedModifier simpleTypeExtendedModifier : (List<IExtendedModifier>)singleVariableDeclaration.modifiers()) {
if (simpleTypeExtendedModifier.isAnnotation()) {
simpleTypeFieldMetadata.getAnnotations().add(createAnnotationMetadataFor((Annotation)simpleTypeExtendedModifier));
} else {
Modifier modifier = (Modifier)simpleTypeExtendedModifier;
simpleTypeFieldMetadata.getModifiers().add(new ModifierMetadata(modifier.getKeyword().toString()));
}
}
return simpleTypeFieldMetadata;
}
if (type.isParameterizedType()) {
ParameterizedType parameterizedType = (ParameterizedType)type;
FieldMetadata parameterizedTypeFieldMetadata = FieldMetadata.parametrizedType(getTypeName(parameterizedType));
variable = new Variable();
variable.setName(JavaMetadataUtil.getName(singleVariableDeclaration.getName()));
parameterizedTypeFieldMetadata.setName(variable.getName());
parameterizedTypeFieldMetadata.getVariables().add(variable);
for (IExtendedModifier parameterizedExtendedModifier : (List<IExtendedModifier>)singleVariableDeclaration.modifiers()) {
if (parameterizedExtendedModifier.isAnnotation()) {
parameterizedTypeFieldMetadata.getAnnotations().add(createAnnotationMetadataFor((Annotation)parameterizedExtendedModifier));
} else {
Modifier modifier = (Modifier)parameterizedExtendedModifier;
parameterizedTypeFieldMetadata.getModifiers().add(new ModifierMetadata(modifier.getKeyword().toString()));
}
}
return parameterizedTypeFieldMetadata;
}
if (type.isArrayType()) {
ArrayType arrayType = (ArrayType)type;
FieldMetadata arrayTypeFieldMetadata = FieldMetadata.arrayType(getTypeName(arrayType));
variable = new Variable();
variable.setName(JavaMetadataUtil.getName(singleVariableDeclaration.getName()));
arrayTypeFieldMetadata.setName(variable.getName());
arrayTypeFieldMetadata.getVariables().add(variable);
for (IExtendedModifier arrayTypeExtendedModifier : (List<IExtendedModifier>)singleVariableDeclaration.modifiers()) {
if (arrayTypeExtendedModifier.isAnnotation()) {
arrayTypeFieldMetadata.getAnnotations().add(createAnnotationMetadataFor((Annotation)arrayTypeExtendedModifier));
} else {
Modifier modifier = (Modifier)arrayTypeExtendedModifier;
arrayTypeFieldMetadata.getModifiers().add(new ModifierMetadata(modifier.getKeyword().toString()));
}
}
return arrayTypeFieldMetadata;
}
return null;
} }
|
public class class_name {
@SuppressWarnings( "unchecked" )
private FieldMetadata processVariableDeclaration( SingleVariableDeclaration singleVariableDeclaration,
Type type ) {
Variable variable;
if (type.isPrimitiveType()) {
FieldMetadata primitiveFieldMetadata = FieldMetadata.primitiveType(((PrimitiveType)type).getPrimitiveTypeCode().toString());
variable = new Variable(); // depends on control dependency: [if], data = [none]
variable.setName(JavaMetadataUtil.getName(singleVariableDeclaration.getName())); // depends on control dependency: [if], data = [none]
primitiveFieldMetadata.setName(variable.getName()); // depends on control dependency: [if], data = [none]
primitiveFieldMetadata.getVariables().add(variable); // depends on control dependency: [if], data = [none]
for (IExtendedModifier extendedModifier : (List<IExtendedModifier>)singleVariableDeclaration.modifiers()) {
if (extendedModifier.isAnnotation()) {
primitiveFieldMetadata.getAnnotations().add(createAnnotationMetadataFor((Annotation)extendedModifier)); // depends on control dependency: [if], data = [none]
} else {
Modifier modifier = (Modifier)extendedModifier;
primitiveFieldMetadata.getModifiers().add(new ModifierMetadata(modifier.getKeyword().toString())); // depends on control dependency: [if], data = [none]
}
}
return primitiveFieldMetadata; // depends on control dependency: [if], data = [none]
}
if (type.isSimpleType()) {
SimpleType simpleType = (SimpleType)type;
FieldMetadata simpleTypeFieldMetadata = FieldMetadata.simpleType(JavaMetadataUtil.getName(simpleType.getName()));
variable = new Variable(); // depends on control dependency: [if], data = [none]
variable.setName(JavaMetadataUtil.getName(singleVariableDeclaration.getName())); // depends on control dependency: [if], data = [none]
simpleTypeFieldMetadata.setName(variable.getName()); // depends on control dependency: [if], data = [none]
simpleTypeFieldMetadata.getVariables().add(variable); // depends on control dependency: [if], data = [none]
for (IExtendedModifier simpleTypeExtendedModifier : (List<IExtendedModifier>)singleVariableDeclaration.modifiers()) {
if (simpleTypeExtendedModifier.isAnnotation()) {
simpleTypeFieldMetadata.getAnnotations().add(createAnnotationMetadataFor((Annotation)simpleTypeExtendedModifier)); // depends on control dependency: [if], data = [none]
} else {
Modifier modifier = (Modifier)simpleTypeExtendedModifier;
simpleTypeFieldMetadata.getModifiers().add(new ModifierMetadata(modifier.getKeyword().toString())); // depends on control dependency: [if], data = [none]
}
}
return simpleTypeFieldMetadata; // depends on control dependency: [if], data = [none]
}
if (type.isParameterizedType()) {
ParameterizedType parameterizedType = (ParameterizedType)type;
FieldMetadata parameterizedTypeFieldMetadata = FieldMetadata.parametrizedType(getTypeName(parameterizedType));
variable = new Variable(); // depends on control dependency: [if], data = [none]
variable.setName(JavaMetadataUtil.getName(singleVariableDeclaration.getName())); // depends on control dependency: [if], data = [none]
parameterizedTypeFieldMetadata.setName(variable.getName()); // depends on control dependency: [if], data = [none]
parameterizedTypeFieldMetadata.getVariables().add(variable); // depends on control dependency: [if], data = [none]
for (IExtendedModifier parameterizedExtendedModifier : (List<IExtendedModifier>)singleVariableDeclaration.modifiers()) {
if (parameterizedExtendedModifier.isAnnotation()) {
parameterizedTypeFieldMetadata.getAnnotations().add(createAnnotationMetadataFor((Annotation)parameterizedExtendedModifier)); // depends on control dependency: [if], data = [none]
} else {
Modifier modifier = (Modifier)parameterizedExtendedModifier;
parameterizedTypeFieldMetadata.getModifiers().add(new ModifierMetadata(modifier.getKeyword().toString())); // depends on control dependency: [if], data = [none]
}
}
return parameterizedTypeFieldMetadata; // depends on control dependency: [if], data = [none]
}
if (type.isArrayType()) {
ArrayType arrayType = (ArrayType)type;
FieldMetadata arrayTypeFieldMetadata = FieldMetadata.arrayType(getTypeName(arrayType));
variable = new Variable(); // depends on control dependency: [if], data = [none]
variable.setName(JavaMetadataUtil.getName(singleVariableDeclaration.getName())); // depends on control dependency: [if], data = [none]
arrayTypeFieldMetadata.setName(variable.getName()); // depends on control dependency: [if], data = [none]
arrayTypeFieldMetadata.getVariables().add(variable); // depends on control dependency: [if], data = [none]
for (IExtendedModifier arrayTypeExtendedModifier : (List<IExtendedModifier>)singleVariableDeclaration.modifiers()) {
if (arrayTypeExtendedModifier.isAnnotation()) {
arrayTypeFieldMetadata.getAnnotations().add(createAnnotationMetadataFor((Annotation)arrayTypeExtendedModifier)); // depends on control dependency: [if], data = [none]
} else {
Modifier modifier = (Modifier)arrayTypeExtendedModifier;
arrayTypeFieldMetadata.getModifiers().add(new ModifierMetadata(modifier.getKeyword().toString())); // depends on control dependency: [if], data = [none]
}
}
return arrayTypeFieldMetadata; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public static String getMethodParamDesc(Method method) {
if (method.getParameterTypes() == null || method.getParameterTypes().length == 0) {
return null;
}
StringBuilder builder = new StringBuilder();
Class<?>[] clzs = method.getParameterTypes();
for (Class<?> clz : clzs) {
String className = getName(clz);
builder.append(className).append(PARAM_CLASS_SPLIT);
}
return builder.substring(0, builder.length() - 1);
} }
|
public class class_name {
public static String getMethodParamDesc(Method method) {
if (method.getParameterTypes() == null || method.getParameterTypes().length == 0) {
return null; // depends on control dependency: [if], data = [none]
}
StringBuilder builder = new StringBuilder();
Class<?>[] clzs = method.getParameterTypes();
for (Class<?> clz : clzs) {
String className = getName(clz);
builder.append(className).append(PARAM_CLASS_SPLIT); // depends on control dependency: [for], data = [none]
}
return builder.substring(0, builder.length() - 1);
} }
|
public class class_name {
public static double xbarVariance(TransposeDataCollection sampleDataCollection, int populationM, double Nbar) {
double xbarVariance = 0.0;
int sampleM = sampleDataCollection.size();
double mean = mean(sampleDataCollection);
for(Map.Entry<Object, FlatDataCollection> entry : sampleDataCollection.entrySet()) {
double sum = 0.0;
Iterator<Double> it = entry.getValue().iteratorDouble();
while(it.hasNext()) {
sum+=(it.next() - mean);
}
xbarVariance+= sum*sum/(sampleM-1);
}
xbarVariance *= (populationM-sampleM)/(populationM*sampleM*Nbar*Nbar);
return xbarVariance;
} }
|
public class class_name {
public static double xbarVariance(TransposeDataCollection sampleDataCollection, int populationM, double Nbar) {
double xbarVariance = 0.0;
int sampleM = sampleDataCollection.size();
double mean = mean(sampleDataCollection);
for(Map.Entry<Object, FlatDataCollection> entry : sampleDataCollection.entrySet()) {
double sum = 0.0;
Iterator<Double> it = entry.getValue().iteratorDouble();
while(it.hasNext()) {
sum+=(it.next() - mean); // depends on control dependency: [while], data = [none]
}
xbarVariance+= sum*sum/(sampleM-1); // depends on control dependency: [for], data = [none]
}
xbarVariance *= (populationM-sampleM)/(populationM*sampleM*Nbar*Nbar);
return xbarVariance;
} }
|
public class class_name {
public java.lang.String getUrlRegex() {
java.lang.Object ref = urlRegex_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
urlRegex_ = s;
return s;
}
} }
|
public class class_name {
public java.lang.String getUrlRegex() {
java.lang.Object ref = urlRegex_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref; // depends on control dependency: [if], data = [none]
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
urlRegex_ = s; // depends on control dependency: [if], data = [none]
return s; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public JShellTool rawTool() {
if (prefs == null) {
prefs = new PreferencesStorage(Preferences.userRoot().node(PREFERENCES_NODE));
}
if (vars == null) {
vars = System.getenv();
}
JShellTool sh = new JShellTool(cmdIn, cmdOut, cmdErr, console, userIn,
userOut, userErr, prefs, vars, locale);
sh.testPrompt = capturePrompt;
return sh;
} }
|
public class class_name {
public JShellTool rawTool() {
if (prefs == null) {
prefs = new PreferencesStorage(Preferences.userRoot().node(PREFERENCES_NODE)); // depends on control dependency: [if], data = [none]
}
if (vars == null) {
vars = System.getenv(); // depends on control dependency: [if], data = [none]
}
JShellTool sh = new JShellTool(cmdIn, cmdOut, cmdErr, console, userIn,
userOut, userErr, prefs, vars, locale);
sh.testPrompt = capturePrompt;
return sh;
} }
|
public class class_name {
@Override
public void render(RenderingInfo renderingInfo) {
if (renderingInfo == null) {
throw new NullPointerException("RenderingInfo cannot be null.");
}
if (!(renderingInfo.getWidget() instanceof HtmlContainer)) {
throw new IllegalArgumentException("This renderer requires a HtmlContainer to render in.");
}
layersModelContainer = (HtmlContainer) renderingInfo.getWidget();
// Delegate to the layers in layer order:
for (int i = 0; i < layersModel.getLayerCount(); i++) {
Layer layer = layersModel.getLayer(i);
// If we're in the middle of an animation and the layer does not support it, skip this layer:
if (navigating && !isAnimated(layer)) {
continue;
}
// Adjust the rendering info, to use a layer specific container widget:
RenderingInfo layerInfo = new RenderingInfo(getOrCreateLayerContainer(layer), renderingInfo.getView(),
renderingInfo.getTrajectory());
LayerRenderer layerRenderer = layerRenderers.get(layer);
layerRenderer.render(layerInfo);
}
} }
|
public class class_name {
@Override
public void render(RenderingInfo renderingInfo) {
if (renderingInfo == null) {
throw new NullPointerException("RenderingInfo cannot be null.");
}
if (!(renderingInfo.getWidget() instanceof HtmlContainer)) {
throw new IllegalArgumentException("This renderer requires a HtmlContainer to render in.");
}
layersModelContainer = (HtmlContainer) renderingInfo.getWidget();
// Delegate to the layers in layer order:
for (int i = 0; i < layersModel.getLayerCount(); i++) {
Layer layer = layersModel.getLayer(i);
// If we're in the middle of an animation and the layer does not support it, skip this layer:
if (navigating && !isAnimated(layer)) {
continue;
}
// Adjust the rendering info, to use a layer specific container widget:
RenderingInfo layerInfo = new RenderingInfo(getOrCreateLayerContainer(layer), renderingInfo.getView(),
renderingInfo.getTrajectory());
LayerRenderer layerRenderer = layerRenderers.get(layer);
layerRenderer.render(layerInfo); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public DeployableUnitID getDeployableUnit(String deploymentUrl)
throws NullPointerException, UnrecognizedDeployableUnitException,
ManagementException {
DeployableUnitID deployableUnitID = new DeployableUnitID(deploymentUrl);
boolean duExists = true;
try {
if (getSleeContainer().getDeployableUnitManagement()
.getDeployableUnit(deployableUnitID) == null) {
duExists = false;
}
} catch (Throwable e) {
throw new ManagementException(e.getMessage(), e);
}
if (duExists) {
return deployableUnitID;
} else {
throw new UnrecognizedDeployableUnitException(deploymentUrl);
}
} }
|
public class class_name {
public DeployableUnitID getDeployableUnit(String deploymentUrl)
throws NullPointerException, UnrecognizedDeployableUnitException,
ManagementException {
DeployableUnitID deployableUnitID = new DeployableUnitID(deploymentUrl);
boolean duExists = true;
try {
if (getSleeContainer().getDeployableUnitManagement()
.getDeployableUnit(deployableUnitID) == null) {
duExists = false; // depends on control dependency: [if], data = [none]
}
} catch (Throwable e) {
throw new ManagementException(e.getMessage(), e);
}
if (duExists) {
return deployableUnitID;
} else {
throw new UnrecognizedDeployableUnitException(deploymentUrl);
}
} }
|
public class class_name {
@Override
protected void startUp() {
try {
startRTS();
} catch (Exception e) {
throw new IllegalArgumentException("Cannot initiate RTS. Missing or bad arguments");
}
try {
startHFTA();
} catch (Exception e) {
throw new IllegalArgumentException("Cannot initiate HFTA processes. Missing or bad arguments");
}
try {
startGSEXIT();
} catch (Exception e) {
throw new IllegalArgumentException("Cannot initiate GSEXIT processes. Missing or bad arguments");
}
} }
|
public class class_name {
@Override
protected void startUp() {
try {
startRTS(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IllegalArgumentException("Cannot initiate RTS. Missing or bad arguments");
} // depends on control dependency: [catch], data = [none]
try {
startHFTA(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IllegalArgumentException("Cannot initiate HFTA processes. Missing or bad arguments");
} // depends on control dependency: [catch], data = [none]
try {
startGSEXIT(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IllegalArgumentException("Cannot initiate GSEXIT processes. Missing or bad arguments");
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public CachedData encode(Object o) {
byte[] b = null;
int flags = 0;
if (o instanceof String) {
b = encodeString((String) o);
if (StringUtils.isJsonObject((String) o)) {
return new CachedData(flags, b, getMaxSize());
}
} else if (o instanceof Long) {
b = tu.encodeLong((Long) o);
flags |= SPECIAL_LONG;
} else if (o instanceof Integer) {
b = tu.encodeInt((Integer) o);
flags |= SPECIAL_INT;
} else if (o instanceof Boolean) {
b = tu.encodeBoolean((Boolean) o);
flags |= SPECIAL_BOOLEAN;
} else if (o instanceof Date) {
b = tu.encodeLong(((Date) o).getTime());
flags |= SPECIAL_DATE;
} else if (o instanceof Byte) {
b = tu.encodeByte((Byte) o);
flags |= SPECIAL_BYTE;
} else if (o instanceof Float) {
b = tu.encodeInt(Float.floatToRawIntBits((Float) o));
flags |= SPECIAL_FLOAT;
} else if (o instanceof Double) {
b = tu.encodeLong(Double.doubleToRawLongBits((Double) o));
flags |= SPECIAL_DOUBLE;
} else if (o instanceof byte[]) {
b = (byte[]) o;
flags |= SPECIAL_BYTEARRAY;
} else {
b = serialize(o);
flags |= SERIALIZED;
}
assert b != null;
if (b.length > compressionThreshold) {
byte[] compressed = compress(b);
if (compressed.length < b.length) {
getLogger().debug("Compressed %s from %d to %d",
o.getClass().getName(), b.length, compressed.length);
b = compressed;
flags |= COMPRESSED;
} else {
getLogger().info("Compression increased the size of %s from %d to %d",
o.getClass().getName(), b.length, compressed.length);
}
}
return new CachedData(flags, b, getMaxSize());
} }
|
public class class_name {
public CachedData encode(Object o) {
byte[] b = null;
int flags = 0;
if (o instanceof String) {
b = encodeString((String) o); // depends on control dependency: [if], data = [none]
if (StringUtils.isJsonObject((String) o)) {
return new CachedData(flags, b, getMaxSize()); // depends on control dependency: [if], data = [none]
}
} else if (o instanceof Long) {
b = tu.encodeLong((Long) o); // depends on control dependency: [if], data = [none]
flags |= SPECIAL_LONG; // depends on control dependency: [if], data = [none]
} else if (o instanceof Integer) {
b = tu.encodeInt((Integer) o); // depends on control dependency: [if], data = [none]
flags |= SPECIAL_INT; // depends on control dependency: [if], data = [none]
} else if (o instanceof Boolean) {
b = tu.encodeBoolean((Boolean) o); // depends on control dependency: [if], data = [none]
flags |= SPECIAL_BOOLEAN; // depends on control dependency: [if], data = [none]
} else if (o instanceof Date) {
b = tu.encodeLong(((Date) o).getTime()); // depends on control dependency: [if], data = [none]
flags |= SPECIAL_DATE; // depends on control dependency: [if], data = [none]
} else if (o instanceof Byte) {
b = tu.encodeByte((Byte) o); // depends on control dependency: [if], data = [none]
flags |= SPECIAL_BYTE; // depends on control dependency: [if], data = [none]
} else if (o instanceof Float) {
b = tu.encodeInt(Float.floatToRawIntBits((Float) o)); // depends on control dependency: [if], data = [none]
flags |= SPECIAL_FLOAT; // depends on control dependency: [if], data = [none]
} else if (o instanceof Double) {
b = tu.encodeLong(Double.doubleToRawLongBits((Double) o)); // depends on control dependency: [if], data = [none]
flags |= SPECIAL_DOUBLE; // depends on control dependency: [if], data = [none]
} else if (o instanceof byte[]) {
b = (byte[]) o; // depends on control dependency: [if], data = [none]
flags |= SPECIAL_BYTEARRAY; // depends on control dependency: [if], data = [none]
} else {
b = serialize(o); // depends on control dependency: [if], data = [none]
flags |= SERIALIZED; // depends on control dependency: [if], data = [none]
}
assert b != null;
if (b.length > compressionThreshold) {
byte[] compressed = compress(b);
if (compressed.length < b.length) {
getLogger().debug("Compressed %s from %d to %d",
o.getClass().getName(), b.length, compressed.length); // depends on control dependency: [if], data = [none]
b = compressed; // depends on control dependency: [if], data = [none]
flags |= COMPRESSED; // depends on control dependency: [if], data = [none]
} else {
getLogger().info("Compression increased the size of %s from %d to %d",
o.getClass().getName(), b.length, compressed.length); // depends on control dependency: [if], data = [none]
}
}
return new CachedData(flags, b, getMaxSize());
} }
|
public class class_name {
public List<User> batchGet(String... openIds) {
if(openIds.length > 100) {
throw new WxRuntimeException(999, "批量获取用户基本信息。最多支持一次拉取100条");
}
List<Map<String, String>> list = new ArrayList<>();
for (String openId: openIds) {
Map<String, String> map = new HashMap<>();
map.put("openid", openId);
map.put("lang", "zh_CN");
list.add(map);
}
return batchGet(list);
} }
|
public class class_name {
public List<User> batchGet(String... openIds) {
if(openIds.length > 100) {
throw new WxRuntimeException(999, "批量获取用户基本信息。最多支持一次拉取100条");
}
List<Map<String, String>> list = new ArrayList<>();
for (String openId: openIds) {
Map<String, String> map = new HashMap<>();
map.put("openid", openId);
// depends on control dependency: [for], data = [openId]
map.put("lang", "zh_CN");
// depends on control dependency: [for], data = [none]
list.add(map);
// depends on control dependency: [for], data = [none]
}
return batchGet(list);
} }
|
public class class_name {
public T slash(@Nullable Object object) {
object = object instanceof Optional ? ((Optional<?>) object).orElse(null) : object;
if (object == null) {
return getThis();
}
String path = object.toString();
if (path.endsWith("#")) {
path = path.substring(0, path.length() - 1);
}
if (!StringUtils.hasText(path)) {
return getThis();
}
path = path.startsWith("/") ? path : "/".concat(path);
return slash(UriComponentsBuilder.fromUriString(path).build(), false);
} }
|
public class class_name {
public T slash(@Nullable Object object) {
object = object instanceof Optional ? ((Optional<?>) object).orElse(null) : object;
if (object == null) {
return getThis(); // depends on control dependency: [if], data = [none]
}
String path = object.toString();
if (path.endsWith("#")) {
path = path.substring(0, path.length() - 1); // depends on control dependency: [if], data = [none]
}
if (!StringUtils.hasText(path)) {
return getThis(); // depends on control dependency: [if], data = [none]
}
path = path.startsWith("/") ? path : "/".concat(path);
return slash(UriComponentsBuilder.fromUriString(path).build(), false);
} }
|
public class class_name {
public static Class checkInterfaces(Class classOrInterfaceWithInterfaces, String interfaceSearched) {
Class returnValue = null;
if (classOrInterfaceWithInterfaces.getName().compareTo(interfaceSearched) == 0) {
return classOrInterfaceWithInterfaces;
}
// we do check only on get interfaces
for (Class iface : classOrInterfaceWithInterfaces.getInterfaces()) {
if (iface.getName().compareTo(interfaceSearched) == 0) {
returnValue = iface;
} else {
returnValue = checkInterfaces(iface, interfaceSearched);
}
if (returnValue != null)
break;
}
if (!classOrInterfaceWithInterfaces.isInterface() && returnValue == null) {
Class superClass = classOrInterfaceWithInterfaces.getSuperclass();
if (superClass != null) {
returnValue = checkInterfaces(superClass, interfaceSearched);
}
}
return returnValue;
} }
|
public class class_name {
public static Class checkInterfaces(Class classOrInterfaceWithInterfaces, String interfaceSearched) {
Class returnValue = null;
if (classOrInterfaceWithInterfaces.getName().compareTo(interfaceSearched) == 0) {
return classOrInterfaceWithInterfaces;
}
// we do check only on get interfaces
for (Class iface : classOrInterfaceWithInterfaces.getInterfaces()) {
if (iface.getName().compareTo(interfaceSearched) == 0) {
returnValue = iface;
} else {
returnValue = checkInterfaces(iface, interfaceSearched);
}
if (returnValue != null)
break;
}
if (!classOrInterfaceWithInterfaces.isInterface() && returnValue == null) {
Class superClass = classOrInterfaceWithInterfaces.getSuperclass();
if (superClass != null) {
returnValue = checkInterfaces(superClass, interfaceSearched); // depends on control dependency: [if], data = [(superClass]
}
}
return returnValue;
} }
|
public class class_name {
private void initHideAnimation(TypedArray attrs) {
int index = R.styleable.ActionButton_hide_animation;
if (attrs.hasValue(index)) {
int animResId = attrs.getResourceId(index, Animations.NONE.animResId);
hideAnimation = Animations.load(getContext(), animResId);
LOGGER.trace("Initialized Action Button hide animation");
}
} }
|
public class class_name {
private void initHideAnimation(TypedArray attrs) {
int index = R.styleable.ActionButton_hide_animation;
if (attrs.hasValue(index)) {
int animResId = attrs.getResourceId(index, Animations.NONE.animResId);
hideAnimation = Animations.load(getContext(), animResId); // depends on control dependency: [if], data = [none]
LOGGER.trace("Initialized Action Button hide animation"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void dispose() {
if (onSubscribe.disposed.compareAndSet(false, true)) {
for (Object chunk : onSubscribe.chunks) {
ReferenceCountUtil.release(chunk);
}
onSubscribe.chunks.clear();
}
} }
|
public class class_name {
public void dispose() {
if (onSubscribe.disposed.compareAndSet(false, true)) {
for (Object chunk : onSubscribe.chunks) {
ReferenceCountUtil.release(chunk); // depends on control dependency: [for], data = [chunk]
}
onSubscribe.chunks.clear(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@CanIgnoreReturnValue
public V erase(@Nullable Object rowKey, @Nullable Object columnKey) {
Integer rowIndex = rowKeyToIndex.get(rowKey);
Integer columnIndex = columnKeyToIndex.get(columnKey);
if (rowIndex == null || columnIndex == null) {
return null;
}
return set(rowIndex, columnIndex, null);
} }
|
public class class_name {
@CanIgnoreReturnValue
public V erase(@Nullable Object rowKey, @Nullable Object columnKey) {
Integer rowIndex = rowKeyToIndex.get(rowKey);
Integer columnIndex = columnKeyToIndex.get(columnKey);
if (rowIndex == null || columnIndex == null) {
return null; // depends on control dependency: [if], data = [none]
}
return set(rowIndex, columnIndex, null);
} }
|
public class class_name {
public List<PUP_PersistenceUnit> pup_getPersistenceUnit() {
List<PUP_PersistenceUnit> retVal = new ArrayList<PUP_PersistenceUnit>();
List<Persistence.PersistenceUnit> puList = getPersistenceUnit();
if (puList.isEmpty()) {
return retVal;
}
for (Persistence.PersistenceUnit pu : puList) {
retVal.add(pu);
}
return retVal;
} }
|
public class class_name {
public List<PUP_PersistenceUnit> pup_getPersistenceUnit() {
List<PUP_PersistenceUnit> retVal = new ArrayList<PUP_PersistenceUnit>();
List<Persistence.PersistenceUnit> puList = getPersistenceUnit();
if (puList.isEmpty()) {
return retVal; // depends on control dependency: [if], data = [none]
}
for (Persistence.PersistenceUnit pu : puList) {
retVal.add(pu); // depends on control dependency: [for], data = [pu]
}
return retVal;
} }
|
public class class_name {
public List<AntiCsrfToken> getTokensFromResponse(HttpMessage msg, Source source) {
List<AntiCsrfToken> list = new ArrayList<>();
List<Element> formElements = source.getAllElements(HTMLElementName.FORM);
if (formElements != null && formElements.size() > 0) {
// Loop through all of the FORM tags
log.debug("Found " + formElements.size() + " forms");
int formIndex = 0;
for (Element formElement : formElements) {
List<Element> inputElements = formElement.getAllElements(HTMLElementName.INPUT);
if (inputElements != null && inputElements.size() > 0) {
// Loop through all of the INPUT elements
log.debug("Found " + inputElements.size() + " inputs");
for (Element inputElement : inputElements) {
String value = inputElement.getAttributeValue("VALUE");
if (value == null) {
continue;
}
String attId = inputElement.getAttributeValue("ID");
boolean found = false;
if (attId != null) {
for (String tokenName : this.getAntiCsrfTokenNames()) {
if (tokenName.equalsIgnoreCase(attId)) {
list.add(new AntiCsrfToken(msg, attId, value, formIndex));
found = true;
break;
}
}
}
if (!found) {
String name = inputElement.getAttributeValue("NAME");
if (name != null) {
for (String tokenName : this.getAntiCsrfTokenNames()) {
if (tokenName.equalsIgnoreCase(name)) {
list.add(new AntiCsrfToken(msg, name, value, formIndex));
break;
}
}
}
}
}
}
formIndex++;
}
}
return list;
} }
|
public class class_name {
public List<AntiCsrfToken> getTokensFromResponse(HttpMessage msg, Source source) {
List<AntiCsrfToken> list = new ArrayList<>();
List<Element> formElements = source.getAllElements(HTMLElementName.FORM);
if (formElements != null && formElements.size() > 0) {
// Loop through all of the FORM tags
log.debug("Found " + formElements.size() + " forms"); // depends on control dependency: [if], data = [none]
int formIndex = 0;
for (Element formElement : formElements) {
List<Element> inputElements = formElement.getAllElements(HTMLElementName.INPUT);
if (inputElements != null && inputElements.size() > 0) {
// Loop through all of the INPUT elements
log.debug("Found " + inputElements.size() + " inputs"); // depends on control dependency: [if], data = [none]
for (Element inputElement : inputElements) {
String value = inputElement.getAttributeValue("VALUE");
if (value == null) {
continue;
}
String attId = inputElement.getAttributeValue("ID");
boolean found = false;
if (attId != null) {
for (String tokenName : this.getAntiCsrfTokenNames()) {
if (tokenName.equalsIgnoreCase(attId)) {
list.add(new AntiCsrfToken(msg, attId, value, formIndex)); // depends on control dependency: [if], data = [none]
found = true; // depends on control dependency: [if], data = [none]
break;
}
}
}
if (!found) {
String name = inputElement.getAttributeValue("NAME");
if (name != null) {
for (String tokenName : this.getAntiCsrfTokenNames()) {
if (tokenName.equalsIgnoreCase(name)) {
list.add(new AntiCsrfToken(msg, name, value, formIndex)); // depends on control dependency: [if], data = [none]
break;
}
}
}
}
}
}
formIndex++; // depends on control dependency: [for], data = [none]
}
}
return list;
} }
|
public class class_name {
public void requestAfterExplanation(@NonNull String[] permissions) {
ArrayList<String> permissionsToRequest = new ArrayList<>();
for (String permissionName : permissions) {
if (isPermissionDeclined(permissionName)) {
permissionsToRequest.add(permissionName); // add permission to request
} else {
permissionCallback.onPermissionPreGranted(permissionName); // do not request, since it is already granted
}
}
if (permissionsToRequest.isEmpty()) return;
permissions = permissionsToRequest.toArray(new String[permissionsToRequest.size()]);
context.requestPermissions(permissions, REQUEST_PERMISSIONS);
} }
|
public class class_name {
public void requestAfterExplanation(@NonNull String[] permissions) {
ArrayList<String> permissionsToRequest = new ArrayList<>();
for (String permissionName : permissions) {
if (isPermissionDeclined(permissionName)) {
permissionsToRequest.add(permissionName); // add permission to request // depends on control dependency: [if], data = [none]
} else {
permissionCallback.onPermissionPreGranted(permissionName); // do not request, since it is already granted // depends on control dependency: [if], data = [none]
}
}
if (permissionsToRequest.isEmpty()) return;
permissions = permissionsToRequest.toArray(new String[permissionsToRequest.size()]);
context.requestPermissions(permissions, REQUEST_PERMISSIONS);
} }
|
public class class_name {
protected void prepDocument() {
/**
* In some cases a body element can't be found (if the HTML is totally
* hosed for example) so we create a new body node and append it to the
* document.
*/
if (mDocument.body() == null) {
mDocument.appendElement("body");
}
/* Remove all scripts */
Elements elementsToRemove = mDocument.getElementsByTag("script");
for (Element script : elementsToRemove) {
script.remove();
}
/* Remove all stylesheets */
elementsToRemove = getElementsByTag(mDocument.head(), "link");
for (Element styleSheet : elementsToRemove) {
if ("stylesheet".equalsIgnoreCase(styleSheet.attr("rel"))) {
styleSheet.remove();
}
}
/* Remove all style tags in head */
elementsToRemove = mDocument.getElementsByTag("style");
for (Element styleTag : elementsToRemove) {
styleTag.remove();
}
/* Turn all double br's into p's */
/*
* TODO: this is pretty costly as far as processing goes. Maybe optimize
* later.
*/
mDocument.body().html(
mDocument.body().html()
.replaceAll(Patterns.REGEX_REPLACE_BRS, "</p><p>")
.replaceAll(Patterns.REGEX_REPLACE_FONTS, "<$1span>"));
} }
|
public class class_name {
protected void prepDocument() {
/**
* In some cases a body element can't be found (if the HTML is totally
* hosed for example) so we create a new body node and append it to the
* document.
*/
if (mDocument.body() == null) {
mDocument.appendElement("body"); // depends on control dependency: [if], data = [none]
}
/* Remove all scripts */
Elements elementsToRemove = mDocument.getElementsByTag("script");
for (Element script : elementsToRemove) {
script.remove(); // depends on control dependency: [for], data = [script]
}
/* Remove all stylesheets */
elementsToRemove = getElementsByTag(mDocument.head(), "link");
for (Element styleSheet : elementsToRemove) {
if ("stylesheet".equalsIgnoreCase(styleSheet.attr("rel"))) {
styleSheet.remove(); // depends on control dependency: [if], data = [none]
}
}
/* Remove all style tags in head */
elementsToRemove = mDocument.getElementsByTag("style");
for (Element styleTag : elementsToRemove) {
styleTag.remove(); // depends on control dependency: [for], data = [styleTag]
}
/* Turn all double br's into p's */
/*
* TODO: this is pretty costly as far as processing goes. Maybe optimize
* later.
*/
mDocument.body().html(
mDocument.body().html()
.replaceAll(Patterns.REGEX_REPLACE_BRS, "</p><p>")
.replaceAll(Patterns.REGEX_REPLACE_FONTS, "<$1span>"));
} }
|
public class class_name {
HoltWintersData _performHoltWintersAnalysis(Map<Long, Double> bootstrappedDps, double alpha, double beta, double gamma, int seasonLength,
long startTimestamp) {
List<Double> intercepts = new ArrayList<Double>();
List<Double> slopes = new ArrayList<Double>();
List<Double> seasonals = new ArrayList<Double>();
List<Double> deviations = new ArrayList<Double>();
Map<Long, Double> deviationDatapoints = new TreeMap<>();
Map<Long, Double> forecastedDatapoints = new TreeMap<>();
double next_pred = 0.0, prediction = 0.0;
int i = 0;
for (Map.Entry<Long, Double> entry : bootstrappedDps.entrySet()) {
Long timestamp = entry.getKey();
Double value = entry.getValue();
double lastIntercept = 0.0;
double lastSlope = 0.0;
if (i == 0) {
lastIntercept = value;
lastSlope = 0;
// seed the first prediction as the first actual
prediction = value;
} else {
lastIntercept = intercepts.get(i - 1);
lastSlope = slopes.get(i - 1);
if (lastIntercept == 0.0) {
lastIntercept = value;
}
prediction = next_pred;
}
double last_seasonal = getLast(seasonals, i, seasonLength);
double next_last_seasonal = getLast(seasonals, i + 1, seasonLength);
double last_seasonal_dev = getLast(deviations, i, seasonLength);
double intercept = _holtWintersIntercept(alpha, value, last_seasonal, lastIntercept, lastSlope);
double slope = _holtWintersSlope(beta, intercept, lastIntercept, lastSlope);
double seasonal = _holtWintersSeasonal(gamma, value, intercept, last_seasonal);
next_pred = intercept + slope + next_last_seasonal;
double deviation = _holtWintersDeviation(gamma, value, prediction, last_seasonal_dev);
intercepts.add(intercept);
slopes.add(slope);
seasonals.add(seasonal);
deviations.add(deviation);
if (timestamp >= startTimestamp) {
forecastedDatapoints.put(timestamp, Double.parseDouble(DECIMAL_FORMAT.format(prediction)));
deviationDatapoints.put(timestamp, Double.parseDouble(DECIMAL_FORMAT.format(deviation)));
}
i++;
}
HoltWintersData data = new HoltWintersData(forecastedDatapoints, deviationDatapoints);
return data;
} }
|
public class class_name {
HoltWintersData _performHoltWintersAnalysis(Map<Long, Double> bootstrappedDps, double alpha, double beta, double gamma, int seasonLength,
long startTimestamp) {
List<Double> intercepts = new ArrayList<Double>();
List<Double> slopes = new ArrayList<Double>();
List<Double> seasonals = new ArrayList<Double>();
List<Double> deviations = new ArrayList<Double>();
Map<Long, Double> deviationDatapoints = new TreeMap<>();
Map<Long, Double> forecastedDatapoints = new TreeMap<>();
double next_pred = 0.0, prediction = 0.0;
int i = 0;
for (Map.Entry<Long, Double> entry : bootstrappedDps.entrySet()) {
Long timestamp = entry.getKey();
Double value = entry.getValue();
double lastIntercept = 0.0;
double lastSlope = 0.0;
if (i == 0) {
lastIntercept = value; // depends on control dependency: [if], data = [none]
lastSlope = 0; // depends on control dependency: [if], data = [none]
// seed the first prediction as the first actual
prediction = value; // depends on control dependency: [if], data = [none]
} else {
lastIntercept = intercepts.get(i - 1); // depends on control dependency: [if], data = [(i]
lastSlope = slopes.get(i - 1); // depends on control dependency: [if], data = [(i]
if (lastIntercept == 0.0) {
lastIntercept = value; // depends on control dependency: [if], data = [none]
}
prediction = next_pred; // depends on control dependency: [if], data = [none]
}
double last_seasonal = getLast(seasonals, i, seasonLength);
double next_last_seasonal = getLast(seasonals, i + 1, seasonLength);
double last_seasonal_dev = getLast(deviations, i, seasonLength);
double intercept = _holtWintersIntercept(alpha, value, last_seasonal, lastIntercept, lastSlope);
double slope = _holtWintersSlope(beta, intercept, lastIntercept, lastSlope);
double seasonal = _holtWintersSeasonal(gamma, value, intercept, last_seasonal);
next_pred = intercept + slope + next_last_seasonal; // depends on control dependency: [for], data = [none]
double deviation = _holtWintersDeviation(gamma, value, prediction, last_seasonal_dev);
intercepts.add(intercept); // depends on control dependency: [for], data = [none]
slopes.add(slope); // depends on control dependency: [for], data = [none]
seasonals.add(seasonal); // depends on control dependency: [for], data = [none]
deviations.add(deviation); // depends on control dependency: [for], data = [none]
if (timestamp >= startTimestamp) {
forecastedDatapoints.put(timestamp, Double.parseDouble(DECIMAL_FORMAT.format(prediction))); // depends on control dependency: [if], data = [(timestamp]
deviationDatapoints.put(timestamp, Double.parseDouble(DECIMAL_FORMAT.format(deviation))); // depends on control dependency: [if], data = [(timestamp]
}
i++; // depends on control dependency: [for], data = [none]
}
HoltWintersData data = new HoltWintersData(forecastedDatapoints, deviationDatapoints);
return data;
} }
|
public class class_name {
@SuppressWarnings("static-method")
protected String buildMessage(double progress, String comment, boolean isRoot, boolean isFinished,
NumberFormat numberFormat) {
final StringBuilder txt = new StringBuilder();
txt.append('[');
txt.append(numberFormat.format(progress));
txt.append("] "); //$NON-NLS-1$
if (comment != null) {
txt.append(comment);
}
return txt.toString();
} }
|
public class class_name {
@SuppressWarnings("static-method")
protected String buildMessage(double progress, String comment, boolean isRoot, boolean isFinished,
NumberFormat numberFormat) {
final StringBuilder txt = new StringBuilder();
txt.append('[');
txt.append(numberFormat.format(progress));
txt.append("] "); //$NON-NLS-1$
if (comment != null) {
txt.append(comment); // depends on control dependency: [if], data = [(comment]
}
return txt.toString();
} }
|
public class class_name {
@NullSafe
public static Map<String, String> fromAssociativeArray(String[] associativeArray) {
Map<String, String> map = new HashMap<>(nullSafeLength(associativeArray));
int index = 0;
for (String element : nullSafeArray(associativeArray, String.class)) {
Assert.hasText(element, "Entry [%s] at index [%d] must be specified", element, index);
String[] entry = element.split("=");
Assert.isTrue(entry.length == 2, "Entry [%s] at index [%d] must have both a key and a value", element, index);
String key = StringUtils.trim(entry[0]);
String value = StringUtils.trim(entry[1]);
map.put(key, value);
index++;
}
return map;
} }
|
public class class_name {
@NullSafe
public static Map<String, String> fromAssociativeArray(String[] associativeArray) {
Map<String, String> map = new HashMap<>(nullSafeLength(associativeArray));
int index = 0;
for (String element : nullSafeArray(associativeArray, String.class)) {
Assert.hasText(element, "Entry [%s] at index [%d] must be specified", element, index); // depends on control dependency: [for], data = [element]
String[] entry = element.split("=");
Assert.isTrue(entry.length == 2, "Entry [%s] at index [%d] must have both a key and a value", element, index); // depends on control dependency: [for], data = [element]
String key = StringUtils.trim(entry[0]);
String value = StringUtils.trim(entry[1]);
map.put(key, value); // depends on control dependency: [for], data = [none]
index++; // depends on control dependency: [for], data = [none]
}
return map;
} }
|
public class class_name {
protected byte[] convertContent(String source, String destination, byte[] content, String resType) {
// if the import is older than version 3, some additional conversions must be made
if (getVersion() < 3) {
if ("page".equals(resType)) {
// if the imported resource is a page, store its path inside the VFS for later
// integration with its body
m_pageStorage.add(destination);
} else if ("folder".equals(resType)) {
// check if the imported resource is a folder. Folders created in the /system/bodies/ folder
if (destination.startsWith(VFS_PATH_BODIES.substring(1))) {
// must be removed since we do not use body files anymore.
m_folderStorage.add(destination);
}
}
}
return content;
} }
|
public class class_name {
protected byte[] convertContent(String source, String destination, byte[] content, String resType) {
// if the import is older than version 3, some additional conversions must be made
if (getVersion() < 3) {
if ("page".equals(resType)) {
// if the imported resource is a page, store its path inside the VFS for later
// integration with its body
m_pageStorage.add(destination); // depends on control dependency: [if], data = [none]
} else if ("folder".equals(resType)) {
// check if the imported resource is a folder. Folders created in the /system/bodies/ folder
if (destination.startsWith(VFS_PATH_BODIES.substring(1))) {
// must be removed since we do not use body files anymore.
m_folderStorage.add(destination); // depends on control dependency: [if], data = [none]
}
}
}
return content;
} }
|
public class class_name {
public void fetchLogs() {
try {
callback.open();
this.request = getLogRequest(false);
final HttpResponse response = client.execute(request);
parseResponse(response);
} catch (LogCallback.DoneException e) {
// Signifies we're finished with the log stream.
} catch (IOException exp) {
callback.error(exp.getMessage());
} finally {
callback.close();
}
} }
|
public class class_name {
public void fetchLogs() {
try {
callback.open(); // depends on control dependency: [try], data = [none]
this.request = getLogRequest(false); // depends on control dependency: [try], data = [none]
final HttpResponse response = client.execute(request);
parseResponse(response); // depends on control dependency: [try], data = [none]
} catch (LogCallback.DoneException e) {
// Signifies we're finished with the log stream.
} catch (IOException exp) { // depends on control dependency: [catch], data = [none]
callback.error(exp.getMessage());
} finally { // depends on control dependency: [catch], data = [none]
callback.close();
}
} }
|
public class class_name {
public BackupChain findBackup(String backupId)
{
Iterator<BackupChain> it = currentBackups.iterator();
while (it.hasNext())
{
BackupChain chain = it.next();
if (backupId.equals(chain.getBackupId()))
{
return chain;
}
}
return null;
} }
|
public class class_name {
public BackupChain findBackup(String backupId)
{
Iterator<BackupChain> it = currentBackups.iterator();
while (it.hasNext())
{
BackupChain chain = it.next();
if (backupId.equals(chain.getBackupId()))
{
return chain; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
private static String[] getHostAndPortFromBracketedHost(String hostPortString) {
LettuceAssert.isTrue(hostPortString.charAt(0) == '[',
String.format("Bracketed host-port string must start with a bracket: %s", hostPortString));
int colonIndex = hostPortString.indexOf(':');
int closeBracketIndex = hostPortString.lastIndexOf(']');
LettuceAssert.isTrue(colonIndex > -1 && closeBracketIndex > colonIndex,
String.format("Invalid bracketed host/port: %s", hostPortString));
String host = hostPortString.substring(1, closeBracketIndex);
if (closeBracketIndex + 1 == hostPortString.length()) {
return new String[] { host, "" };
} else {
LettuceAssert.isTrue(hostPortString.charAt(closeBracketIndex + 1) == ':',
"Only a colon may follow a close bracket: " + hostPortString);
for (int i = closeBracketIndex + 2; i < hostPortString.length(); ++i) {
LettuceAssert.isTrue(Character.isDigit(hostPortString.charAt(i)),
String.format("Port must be numeric: %s", hostPortString));
}
return new String[] { host, hostPortString.substring(closeBracketIndex + 2) };
}
} }
|
public class class_name {
private static String[] getHostAndPortFromBracketedHost(String hostPortString) {
LettuceAssert.isTrue(hostPortString.charAt(0) == '[',
String.format("Bracketed host-port string must start with a bracket: %s", hostPortString));
int colonIndex = hostPortString.indexOf(':');
int closeBracketIndex = hostPortString.lastIndexOf(']');
LettuceAssert.isTrue(colonIndex > -1 && closeBracketIndex > colonIndex,
String.format("Invalid bracketed host/port: %s", hostPortString));
String host = hostPortString.substring(1, closeBracketIndex);
if (closeBracketIndex + 1 == hostPortString.length()) {
return new String[] { host, "" }; // depends on control dependency: [if], data = [none]
} else {
LettuceAssert.isTrue(hostPortString.charAt(closeBracketIndex + 1) == ':',
"Only a colon may follow a close bracket: " + hostPortString); // depends on control dependency: [if], data = [(closeBracketIndex + 1]
for (int i = closeBracketIndex + 2; i < hostPortString.length(); ++i) {
LettuceAssert.isTrue(Character.isDigit(hostPortString.charAt(i)),
String.format("Port must be numeric: %s", hostPortString)); // depends on control dependency: [for], data = [i]
}
return new String[] { host, hostPortString.substring(closeBracketIndex + 2) }; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String getPrincipalAttributeValue(final Principal p, final String attributeName) {
val attributes = p.getAttributes();
if (attributes.containsKey(attributeName)) {
return CollectionUtils.toCollection(attributes.get(attributeName)).iterator().next().toString();
}
return null;
} }
|
public class class_name {
public String getPrincipalAttributeValue(final Principal p, final String attributeName) {
val attributes = p.getAttributes();
if (attributes.containsKey(attributeName)) {
return CollectionUtils.toCollection(attributes.get(attributeName)).iterator().next().toString(); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@Override
protected Color buildResource(final ColorItem ci, final ColorParams cp) {
Color color = null;
if (cp instanceof WebColor) {
color = buildWebColor((WebColor) cp);
} else if (cp instanceof RGB01Color) {
color = buildRGB01Color((RGB01Color) cp);
} else if (cp instanceof RGB255Color) {
color = buildRGB255Color((RGB255Color) cp);
} else if (cp instanceof HSBColor) {
color = buildHSBColor((HSBColor) cp);
} else if (cp instanceof GrayColor) {
color = buildGrayColor((GrayColor) cp);
}
return color;
} }
|
public class class_name {
@Override
protected Color buildResource(final ColorItem ci, final ColorParams cp) {
Color color = null;
if (cp instanceof WebColor) {
color = buildWebColor((WebColor) cp);
// depends on control dependency: [if], data = [none]
} else if (cp instanceof RGB01Color) {
color = buildRGB01Color((RGB01Color) cp);
// depends on control dependency: [if], data = [none]
} else if (cp instanceof RGB255Color) {
color = buildRGB255Color((RGB255Color) cp);
// depends on control dependency: [if], data = [none]
} else if (cp instanceof HSBColor) {
color = buildHSBColor((HSBColor) cp);
// depends on control dependency: [if], data = [none]
} else if (cp instanceof GrayColor) {
color = buildGrayColor((GrayColor) cp);
// depends on control dependency: [if], data = [none]
}
return color;
} }
|
public class class_name {
public Cron parse(final String expression) {
Preconditions.checkNotNull(expression, "Expression must not be null");
final String replaced = expression.replaceAll("\\s+", " ").trim();
if (StringUtils.isEmpty(replaced)) {
throw new IllegalArgumentException("Empty expression!");
}
if(expression.contains("|")){
List<String> crons = new ArrayList<>();
int cronscount = Arrays.stream(expression.split("\\s+")).mapToInt(s->s.split("\\|").length).max().orElseGet(() -> 0);
for(int j=0; j<cronscount; j++){
StringBuilder builder = new StringBuilder();
for(String s : expression.split("\\s+")){
if(s.contains("|")){
builder.append(String.format("%s ", s.split("\\|")[j]));
}else{
builder.append(String.format("%s ", s));
}
}
crons.add(builder.toString().trim());
}
return new CompositeCron(crons.stream().map(c->parse(c)).collect(Collectors.toList()));
}else{
final String[] expressionParts = replaced.toUpperCase().split(" ");
final int expressionLength = expressionParts.length;
String fieldWithTrailingCommas = Arrays.stream(expressionParts).filter(x -> x.endsWith(",")).findAny().orElse(null);
if(fieldWithTrailingCommas!=null){
throw new IllegalArgumentException(String.format("Invalid field value! Trailing commas not permitted! '%s'", fieldWithTrailingCommas));
}
final List<CronParserField> fields = expressions.get(expressionLength);
if (fields == null) {
throw new IllegalArgumentException(
String.format("Cron expression contains %s parts but we expect one of %s", expressionLength, expressions.keySet()));
}
try {
final int size = fields.size();
final List<CronField> results = new ArrayList<>(size + 1);
for (int j = 0; j < size; j++) {
results.add(fields.get(j).parse(expressionParts[j]));
}
return new SingleCron(cronDefinition, results).validate();
} catch (final IllegalArgumentException e) {
throw new IllegalArgumentException(String.format("Failed to parse '%s'. %s", expression, e.getMessage()), e);
}
}
} }
|
public class class_name {
public Cron parse(final String expression) {
Preconditions.checkNotNull(expression, "Expression must not be null");
final String replaced = expression.replaceAll("\\s+", " ").trim();
if (StringUtils.isEmpty(replaced)) {
throw new IllegalArgumentException("Empty expression!");
}
if(expression.contains("|")){
List<String> crons = new ArrayList<>();
int cronscount = Arrays.stream(expression.split("\\s+")).mapToInt(s->s.split("\\|").length).max().orElseGet(() -> 0);
for(int j=0; j<cronscount; j++){
StringBuilder builder = new StringBuilder();
for(String s : expression.split("\\s+")){
if(s.contains("|")){
builder.append(String.format("%s ", s.split("\\|")[j])); // depends on control dependency: [if], data = [none]
}else{
builder.append(String.format("%s ", s)); // depends on control dependency: [if], data = [none]
}
}
crons.add(builder.toString().trim()); // depends on control dependency: [for], data = [none]
}
return new CompositeCron(crons.stream().map(c->parse(c)).collect(Collectors.toList())); // depends on control dependency: [if], data = [none]
}else{
final String[] expressionParts = replaced.toUpperCase().split(" ");
final int expressionLength = expressionParts.length;
String fieldWithTrailingCommas = Arrays.stream(expressionParts).filter(x -> x.endsWith(",")).findAny().orElse(null);
if(fieldWithTrailingCommas!=null){
throw new IllegalArgumentException(String.format("Invalid field value! Trailing commas not permitted! '%s'", fieldWithTrailingCommas));
}
final List<CronParserField> fields = expressions.get(expressionLength);
if (fields == null) {
throw new IllegalArgumentException(
String.format("Cron expression contains %s parts but we expect one of %s", expressionLength, expressions.keySet()));
}
try {
final int size = fields.size();
final List<CronField> results = new ArrayList<>(size + 1);
for (int j = 0; j < size; j++) {
results.add(fields.get(j).parse(expressionParts[j])); // depends on control dependency: [for], data = [j]
}
return new SingleCron(cronDefinition, results).validate(); // depends on control dependency: [try], data = [none]
} catch (final IllegalArgumentException e) {
throw new IllegalArgumentException(String.format("Failed to parse '%s'. %s", expression, e.getMessage()), e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
@Override
protected MailResourcesHolder createResourceImpl()
{
//create authenticator
Authenticator authenticator=null;
if(this.password!=null)
{
authenticator=new MailAuthenticator(this.userName,this.password);
}
//create session
Session session=Session.getInstance(this.mailConnectionProperties,authenticator);
//create transport
Transport transport=this.createTransport(session);
//create holder
MailResourcesHolder resource=new MailResourcesHolder(session,transport);
return resource;
} }
|
public class class_name {
@Override
protected MailResourcesHolder createResourceImpl()
{
//create authenticator
Authenticator authenticator=null;
if(this.password!=null)
{
authenticator=new MailAuthenticator(this.userName,this.password); // depends on control dependency: [if], data = [none]
}
//create session
Session session=Session.getInstance(this.mailConnectionProperties,authenticator);
//create transport
Transport transport=this.createTransport(session);
//create holder
MailResourcesHolder resource=new MailResourcesHolder(session,transport);
return resource;
} }
|
public class class_name {
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDropdown dropdown = (WDropdown) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = dropdown.isReadOnly();
String dataKey = dropdown.getListCacheKey();
// Start tag
xml.appendTagOpen("ui:dropdown");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", dropdown.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true");
} else {
xml.appendOptionalAttribute("data", dataKey != null, dataKey);
xml.appendOptionalAttribute("disabled", dropdown.isDisabled(), "true");
xml.appendOptionalAttribute("required", dropdown.isMandatory(), "true");
xml.appendOptionalAttribute("submitOnChange", dropdown.isSubmitOnChange(), "true");
xml.appendOptionalAttribute("toolTip", dropdown.getToolTip());
xml.appendOptionalAttribute("accessibleText", dropdown.getAccessibleText());
int optionWidth = dropdown.getOptionWidth();
xml.appendOptionalAttribute("optionWidth", optionWidth > 0, optionWidth);
String autocomplete = dropdown.getAutocomplete();
xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);
xml.appendOptionalAttribute("type", getTypeAsString(dropdown.getType()));
}
xml.appendClose();
// Options
List<?> options = dropdown.getOptions();
Object selectedOption = dropdown.getSelected();
// For an editable dropdown (combo box), the selected option may not be in the list.
if (dropdown.getType() == WDropdown.DropdownType.COMBO
&& selectedOption != null
&& (options == null || !options.contains(selectedOption))) {
xml.appendTagOpen("ui:option");
xml.appendAttribute("value", selectedOption.toString());
xml.appendAttribute("selected", "true");
xml.appendClose();
xml.appendEscaped(selectedOption.toString());
xml.appendEndTag("ui:option");
}
if (options != null) {
int optionIndex = 0;
boolean renderSelectionsOnly = readOnly || dataKey != null;
for (Object option : options) {
if (option instanceof OptionGroup) {
xml.appendTagOpen("ui:optgroup");
xml.appendAttribute("label", ((OptionGroup) option).getDesc());
xml.appendClose();
for (Object nestedOption : ((OptionGroup) option).getOptions()) {
renderOption(dropdown, nestedOption, optionIndex++, xml, selectedOption,
renderSelectionsOnly);
}
xml.appendEndTag("ui:optgroup");
} else {
renderOption(dropdown, option, optionIndex++, xml, selectedOption,
renderSelectionsOnly);
}
}
}
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(dropdown, renderContext);
}
// End tag
xml.appendEndTag("ui:dropdown");
} }
|
public class class_name {
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDropdown dropdown = (WDropdown) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = dropdown.isReadOnly();
String dataKey = dropdown.getListCacheKey();
// Start tag
xml.appendTagOpen("ui:dropdown");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", dropdown.isHidden(), "true");
if (readOnly) {
xml.appendAttribute("readOnly", "true"); // depends on control dependency: [if], data = [none]
} else {
xml.appendOptionalAttribute("data", dataKey != null, dataKey); // depends on control dependency: [if], data = [none]
xml.appendOptionalAttribute("disabled", dropdown.isDisabled(), "true"); // depends on control dependency: [if], data = [none]
xml.appendOptionalAttribute("required", dropdown.isMandatory(), "true"); // depends on control dependency: [if], data = [none]
xml.appendOptionalAttribute("submitOnChange", dropdown.isSubmitOnChange(), "true"); // depends on control dependency: [if], data = [none]
xml.appendOptionalAttribute("toolTip", dropdown.getToolTip()); // depends on control dependency: [if], data = [none]
xml.appendOptionalAttribute("accessibleText", dropdown.getAccessibleText()); // depends on control dependency: [if], data = [none]
int optionWidth = dropdown.getOptionWidth();
xml.appendOptionalAttribute("optionWidth", optionWidth > 0, optionWidth); // depends on control dependency: [if], data = [none]
String autocomplete = dropdown.getAutocomplete();
xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete); // depends on control dependency: [if], data = [none]
xml.appendOptionalAttribute("type", getTypeAsString(dropdown.getType())); // depends on control dependency: [if], data = [none]
}
xml.appendClose();
// Options
List<?> options = dropdown.getOptions();
Object selectedOption = dropdown.getSelected();
// For an editable dropdown (combo box), the selected option may not be in the list.
if (dropdown.getType() == WDropdown.DropdownType.COMBO
&& selectedOption != null
&& (options == null || !options.contains(selectedOption))) {
xml.appendTagOpen("ui:option"); // depends on control dependency: [if], data = [none]
xml.appendAttribute("value", selectedOption.toString()); // depends on control dependency: [if], data = [none]
xml.appendAttribute("selected", "true"); // depends on control dependency: [if], data = [none]
xml.appendClose(); // depends on control dependency: [if], data = [none]
xml.appendEscaped(selectedOption.toString()); // depends on control dependency: [if], data = [none]
xml.appendEndTag("ui:option"); // depends on control dependency: [if], data = [none]
}
if (options != null) {
int optionIndex = 0;
boolean renderSelectionsOnly = readOnly || dataKey != null;
for (Object option : options) {
if (option instanceof OptionGroup) {
xml.appendTagOpen("ui:optgroup"); // depends on control dependency: [if], data = [none]
xml.appendAttribute("label", ((OptionGroup) option).getDesc()); // depends on control dependency: [if], data = [none]
xml.appendClose(); // depends on control dependency: [if], data = [none]
for (Object nestedOption : ((OptionGroup) option).getOptions()) {
renderOption(dropdown, nestedOption, optionIndex++, xml, selectedOption,
renderSelectionsOnly); // depends on control dependency: [for], data = [none]
}
xml.appendEndTag("ui:optgroup"); // depends on control dependency: [if], data = [none]
} else {
renderOption(dropdown, option, optionIndex++, xml, selectedOption,
renderSelectionsOnly); // depends on control dependency: [if], data = [none]
}
}
}
if (!readOnly) {
DiagnosticRenderUtil.renderDiagnostics(dropdown, renderContext); // depends on control dependency: [if], data = [none]
}
// End tag
xml.appendEndTag("ui:dropdown");
} }
|
public class class_name {
public static String extractClientIpFromXForwardedFor(String xForwardedFor) {
if (xForwardedFor == null) {
return null;
}
xForwardedFor = xForwardedFor.trim();
String tokenized[] = xForwardedFor.split(",");
if (tokenized.length == 0) {
return null;
} else {
return tokenized[0].trim();
}
} }
|
public class class_name {
public static String extractClientIpFromXForwardedFor(String xForwardedFor) {
if (xForwardedFor == null) {
return null; // depends on control dependency: [if], data = [none]
}
xForwardedFor = xForwardedFor.trim();
String tokenized[] = xForwardedFor.split(",");
if (tokenized.length == 0) {
return null; // depends on control dependency: [if], data = [none]
} else {
return tokenized[0].trim(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public CommerceAccountOrganizationRel remove(Serializable primaryKey)
throws NoSuchAccountOrganizationRelException {
Session session = null;
try {
session = openSession();
CommerceAccountOrganizationRel commerceAccountOrganizationRel = (CommerceAccountOrganizationRel)session.get(CommerceAccountOrganizationRelImpl.class,
primaryKey);
if (commerceAccountOrganizationRel == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchAccountOrganizationRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commerceAccountOrganizationRel);
}
catch (NoSuchAccountOrganizationRelException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} }
|
public class class_name {
@Override
public CommerceAccountOrganizationRel remove(Serializable primaryKey)
throws NoSuchAccountOrganizationRelException {
Session session = null;
try {
session = openSession();
CommerceAccountOrganizationRel commerceAccountOrganizationRel = (CommerceAccountOrganizationRel)session.get(CommerceAccountOrganizationRelImpl.class,
primaryKey);
if (commerceAccountOrganizationRel == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none]
}
throw new NoSuchAccountOrganizationRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commerceAccountOrganizationRel);
}
catch (NoSuchAccountOrganizationRelException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} }
|
public class class_name {
public void add(String prefix, String uri) {
if (uri == null) {
namespaces.remove(prefix);
} else {
if (namespaces.containsKey(prefix)) {
String currentUri = namespaces.get(prefix);
if (!currentUri.equals(uri)) {
throw new FitFailureException(
String.format("The prefix %s is already mapped to %s",
prefix, currentUri));
}
} else {
namespaces.put(prefix, uri);
}
}
} }
|
public class class_name {
public void add(String prefix, String uri) {
if (uri == null) {
namespaces.remove(prefix); // depends on control dependency: [if], data = [none]
} else {
if (namespaces.containsKey(prefix)) {
String currentUri = namespaces.get(prefix);
if (!currentUri.equals(uri)) {
throw new FitFailureException(
String.format("The prefix %s is already mapped to %s",
prefix, currentUri));
}
} else {
namespaces.put(prefix, uri); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static boolean removeCookie(Cookie cookie, HttpServletResponse response) {
if (Checker.isNotNull(cookie)) {
cookie.setMaxAge(0);
return addCookie(cookie, response);
}
return false;
} }
|
public class class_name {
public static boolean removeCookie(Cookie cookie, HttpServletResponse response) {
if (Checker.isNotNull(cookie)) {
cookie.setMaxAge(0); // depends on control dependency: [if], data = [none]
return addCookie(cookie, response); // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
@Override
public DistributedWorkManagerStatisticsValues getDistributedStatistics(Address address)
{
if (trace)
log.tracef("GET_DISTRIBUTED_STATISTICS(%s)", address);
if (address.getTransportId() == null || getId().equals(address.getTransportId()))
return localGetDistributedStatistics(address);
try
{
T addr = nodes.get(address);
return (DistributedWorkManagerStatisticsValues)sendMessage(addr, Request.GET_DISTRIBUTED_STATISTICS, address);
}
catch (WorkException e1)
{
if (log.isDebugEnabled())
{
log.debug("Error", e1);
}
return null;
}
} }
|
public class class_name {
@Override
public DistributedWorkManagerStatisticsValues getDistributedStatistics(Address address)
{
if (trace)
log.tracef("GET_DISTRIBUTED_STATISTICS(%s)", address);
if (address.getTransportId() == null || getId().equals(address.getTransportId()))
return localGetDistributedStatistics(address);
try
{
T addr = nodes.get(address);
return (DistributedWorkManagerStatisticsValues)sendMessage(addr, Request.GET_DISTRIBUTED_STATISTICS, address); // depends on control dependency: [try], data = [none]
}
catch (WorkException e1)
{
if (log.isDebugEnabled())
{
log.debug("Error", e1); // depends on control dependency: [if], data = [none]
}
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static String toJsonAsString() {
logger.entering();
Gson gson = new GsonBuilder().setPrettyPrinting().create();
JsonObject configItem = new JsonObject();
for (Entry<String, Map<String, String>> entry : ReporterConfigMetadata.getReporterMetaData().entrySet()) {
Map<String, String> subMap = entry.getValue();
for (Entry<String, String> subEntry : subMap.entrySet()) {
JsonObject configSubItem = new JsonObject();
configSubItem.addProperty(subEntry.getKey(), subEntry.getValue());
configItem.add(entry.getKey(), configSubItem);
}
}
String json = gson.toJson(configItem);
logger.exiting(json);
return json;
} }
|
public class class_name {
public static String toJsonAsString() {
logger.entering();
Gson gson = new GsonBuilder().setPrettyPrinting().create();
JsonObject configItem = new JsonObject();
for (Entry<String, Map<String, String>> entry : ReporterConfigMetadata.getReporterMetaData().entrySet()) {
Map<String, String> subMap = entry.getValue();
for (Entry<String, String> subEntry : subMap.entrySet()) {
JsonObject configSubItem = new JsonObject();
configSubItem.addProperty(subEntry.getKey(), subEntry.getValue()); // depends on control dependency: [for], data = [subEntry]
configItem.add(entry.getKey(), configSubItem); // depends on control dependency: [for], data = [none]
}
}
String json = gson.toJson(configItem);
logger.exiting(json);
return json;
} }
|
public class class_name {
@Autowired ( required = false )
public void register(OAuthTokenLifecycleListener... lifecycleListeners) {
if (lifecycleListeners != null) {
this.lifecycleListeners.addAll(Arrays.asList(lifecycleListeners));
}
} }
|
public class class_name {
@Autowired ( required = false )
public void register(OAuthTokenLifecycleListener... lifecycleListeners) {
if (lifecycleListeners != null) {
this.lifecycleListeners.addAll(Arrays.asList(lifecycleListeners)); // depends on control dependency: [if], data = [(lifecycleListeners]
}
} }
|
public class class_name {
public void setRelationships(java.util.Collection<Relationship> relationships) {
if (relationships == null) {
this.relationships = null;
return;
}
this.relationships = new com.amazonaws.internal.SdkInternalList<Relationship>(relationships);
} }
|
public class class_name {
public void setRelationships(java.util.Collection<Relationship> relationships) {
if (relationships == null) {
this.relationships = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.relationships = new com.amazonaws.internal.SdkInternalList<Relationship>(relationships);
} }
|
public class class_name {
public void setParamTabWpReportType(String value) {
if (I_CmsReport.REPORT_TYPE_SIMPLE.equals(value) || I_CmsReport.REPORT_TYPE_EXTENDED.equals(value)) {
// set only if valid parameter value is found
m_userSettings.setWorkplaceReportType(value);
}
} }
|
public class class_name {
public void setParamTabWpReportType(String value) {
if (I_CmsReport.REPORT_TYPE_SIMPLE.equals(value) || I_CmsReport.REPORT_TYPE_EXTENDED.equals(value)) {
// set only if valid parameter value is found
m_userSettings.setWorkplaceReportType(value); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
protected void implementationSpecificPut(List<Metric> metrics,
Set<String> scopeNames,
Set<Pair<String, String>> scopesAndMetricNames,
Map<String, MetatagsRecord> metatagsToPut) {
requireNotDisposed();
SystemAssert.requireArgument(metrics != null, "Metric list cannot be null.");
for (Metric metric : metrics) {
if (metric.getTags().isEmpty()) {
_putWithoutTag(metric);
}
for (Entry<String, String> tag : metric.getTags().entrySet()) {
_putWithTag(metric, tag);
}
}
} }
|
public class class_name {
@Override
protected void implementationSpecificPut(List<Metric> metrics,
Set<String> scopeNames,
Set<Pair<String, String>> scopesAndMetricNames,
Map<String, MetatagsRecord> metatagsToPut) {
requireNotDisposed();
SystemAssert.requireArgument(metrics != null, "Metric list cannot be null.");
for (Metric metric : metrics) {
if (metric.getTags().isEmpty()) {
_putWithoutTag(metric); // depends on control dependency: [if], data = [none]
}
for (Entry<String, String> tag : metric.getTags().entrySet()) {
_putWithTag(metric, tag); // depends on control dependency: [for], data = [tag]
}
}
} }
|
public class class_name {
private final void growIfNeeded(int minimumDesired) {
if (buffer.b().remaining() < minimumDesired) {
// Compute the size of the new buffer
int newCapacity = buffer.b().capacity();
int newRemaining = newCapacity - buffer.b().position();
while (newRemaining < minimumDesired) {
newRemaining += newCapacity;
newCapacity *= 2;
}
// Allocate and copy
BBContainer next;
if (isDirect) {
next = DBBPool.allocateDirect(newCapacity);
} else {
next = DBBPool.wrapBB(ByteBuffer.allocate(newCapacity));
}
buffer.b().flip();
next.b().put(buffer.b());
assert next.b().remaining() == newRemaining;
buffer.discard();
buffer = next;
if (callback != null) callback.onBufferGrow(this);
assert(buffer.b().order() == ByteOrder.BIG_ENDIAN);
}
} }
|
public class class_name {
private final void growIfNeeded(int minimumDesired) {
if (buffer.b().remaining() < minimumDesired) {
// Compute the size of the new buffer
int newCapacity = buffer.b().capacity();
int newRemaining = newCapacity - buffer.b().position();
while (newRemaining < minimumDesired) {
newRemaining += newCapacity; // depends on control dependency: [while], data = [none]
newCapacity *= 2; // depends on control dependency: [while], data = [none]
}
// Allocate and copy
BBContainer next;
if (isDirect) {
next = DBBPool.allocateDirect(newCapacity); // depends on control dependency: [if], data = [none]
} else {
next = DBBPool.wrapBB(ByteBuffer.allocate(newCapacity)); // depends on control dependency: [if], data = [none]
}
buffer.b().flip(); // depends on control dependency: [if], data = [none]
next.b().put(buffer.b()); // depends on control dependency: [if], data = [none]
assert next.b().remaining() == newRemaining;
buffer.discard(); // depends on control dependency: [if], data = [none]
buffer = next; // depends on control dependency: [if], data = [none]
if (callback != null) callback.onBufferGrow(this);
assert(buffer.b().order() == ByteOrder.BIG_ENDIAN); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void addEnv(final Environment.Variable env){
if(null==envVars) {
envVars = new ArrayList<Environment.Variable>();
}
envVars.add(env);
} }
|
public class class_name {
public void addEnv(final Environment.Variable env){
if(null==envVars) {
envVars = new ArrayList<Environment.Variable>(); // depends on control dependency: [if], data = [none]
}
envVars.add(env);
} }
|
public class class_name {
private void validatePathname(String pathname) {
File file = new File(storageDir, pathname);
String canonicalPath;
try {
canonicalPath = file.getCanonicalPath();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
if (!canonicalPath.startsWith(storageDir)) {
throw new UncheckedIOException(new IOException("File path traversal not allowed"));
}
} }
|
public class class_name {
private void validatePathname(String pathname) {
File file = new File(storageDir, pathname);
String canonicalPath;
try {
canonicalPath = file.getCanonicalPath(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new UncheckedIOException(e);
} // depends on control dependency: [catch], data = [none]
if (!canonicalPath.startsWith(storageDir)) {
throw new UncheckedIOException(new IOException("File path traversal not allowed"));
}
} }
|
public class class_name {
public void setNotebookInstanceLifecycleConfigs(java.util.Collection<NotebookInstanceLifecycleConfigSummary> notebookInstanceLifecycleConfigs) {
if (notebookInstanceLifecycleConfigs == null) {
this.notebookInstanceLifecycleConfigs = null;
return;
}
this.notebookInstanceLifecycleConfigs = new java.util.ArrayList<NotebookInstanceLifecycleConfigSummary>(notebookInstanceLifecycleConfigs);
} }
|
public class class_name {
public void setNotebookInstanceLifecycleConfigs(java.util.Collection<NotebookInstanceLifecycleConfigSummary> notebookInstanceLifecycleConfigs) {
if (notebookInstanceLifecycleConfigs == null) {
this.notebookInstanceLifecycleConfigs = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.notebookInstanceLifecycleConfigs = new java.util.ArrayList<NotebookInstanceLifecycleConfigSummary>(notebookInstanceLifecycleConfigs);
} }
|
public class class_name {
public void perform(GraphRewrite event, EvaluationContext context, PAYLOADTYPE payload) {
Document doc = payload.asDocument();
if(doc == null) {
LOG.warning("Document is null.");
return;
}
perform(event, context, payload, doc);
} }
|
public class class_name {
public void perform(GraphRewrite event, EvaluationContext context, PAYLOADTYPE payload) {
Document doc = payload.asDocument();
if(doc == null) {
LOG.warning("Document is null."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
perform(event, context, payload, doc);
} }
|
public class class_name {
public static InstanceService getInstanceService() {
if (instanceService == null) {
try {
Class clazz = Class.forName(INSTANCE_SERVICE);
instanceService = (InstanceService) clazz.newInstance();
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
LOGGER.warn("Cannot instanciate util: {}", e.getMessage());
throw new IllegalStateException(e);
}
}
return instanceService;
} }
|
public class class_name {
public static InstanceService getInstanceService() {
if (instanceService == null) {
try {
Class clazz = Class.forName(INSTANCE_SERVICE);
instanceService = (InstanceService) clazz.newInstance();
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
LOGGER.warn("Cannot instanciate util: {}", e.getMessage());
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
}
return instanceService;
} }
|
public class class_name {
private static final void processCellRightChild(final CnfGrammar grammar, final Chart chart, final int start,
final int end, final ChartCell cell, final Scorer scorer) {
// Apply binary rules.
for (int mid = start + 1; mid <= end - 1; mid++) {
ChartCell leftCell = chart.getCell(start, mid);
ChartCell rightCell = chart.getCell(mid, end);
// Loop through each right child non-terminal.
for (final int rightChildNt : rightCell.getNts()) {
double rightScoreForNt = rightCell.getScore(rightChildNt);
// Lookup all rules with that right child.
for (final Rule r : grammar.getBinaryRulesWithRightChild(rightChildNt)) {
// Check whether the left child of that rule is in the left child cell.
double leftScoreForNt = leftCell.getScore(r.getLeftChild());
if (leftScoreForNt > Double.NEGATIVE_INFINITY) {
double score = scorer.score(r, start, mid, end)
+ leftScoreForNt
+ rightScoreForNt;
cell.updateCell(r.getParent(), score, mid, r);
}
}
}
}
} }
|
public class class_name {
private static final void processCellRightChild(final CnfGrammar grammar, final Chart chart, final int start,
final int end, final ChartCell cell, final Scorer scorer) {
// Apply binary rules.
for (int mid = start + 1; mid <= end - 1; mid++) {
ChartCell leftCell = chart.getCell(start, mid);
ChartCell rightCell = chart.getCell(mid, end);
// Loop through each right child non-terminal.
for (final int rightChildNt : rightCell.getNts()) {
double rightScoreForNt = rightCell.getScore(rightChildNt);
// Lookup all rules with that right child.
for (final Rule r : grammar.getBinaryRulesWithRightChild(rightChildNt)) {
// Check whether the left child of that rule is in the left child cell.
double leftScoreForNt = leftCell.getScore(r.getLeftChild());
if (leftScoreForNt > Double.NEGATIVE_INFINITY) {
double score = scorer.score(r, start, mid, end)
+ leftScoreForNt
+ rightScoreForNt;
cell.updateCell(r.getParent(), score, mid, r); // depends on control dependency: [if], data = [none]
}
}
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <U extends BeanPath<? extends T>> U as(Class<U> clazz) {
try {
if (!casts.containsKey(clazz)) {
PathMetadata metadata;
if (pathMixin.getMetadata().getPathType() != PathType.COLLECTION_ANY) {
metadata = PathMetadataFactory.forDelegate(pathMixin);
} else {
metadata = pathMixin.getMetadata();
}
U rv;
// the inits for the subtype will be wider, if it's a variable path
if (inits != null && pathMixin.getMetadata().getPathType() != PathType.VARIABLE) {
rv = clazz.getConstructor(PathMetadata.class, PathInits.class).newInstance(metadata, inits);
} else {
rv = clazz.getConstructor(PathMetadata.class).newInstance(metadata);
}
casts.put(clazz, rv);
return rv;
} else {
return (U) casts.get(clazz);
}
} catch (InstantiationException e) {
throw new ExpressionException(e.getMessage(), e);
} catch (IllegalAccessException e) {
throw new ExpressionException(e.getMessage(), e);
} catch (InvocationTargetException e) {
throw new ExpressionException(e.getMessage(), e);
} catch (NoSuchMethodException e) {
throw new ExpressionException(e.getMessage(), e);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <U extends BeanPath<? extends T>> U as(Class<U> clazz) {
try {
if (!casts.containsKey(clazz)) {
PathMetadata metadata;
if (pathMixin.getMetadata().getPathType() != PathType.COLLECTION_ANY) {
metadata = PathMetadataFactory.forDelegate(pathMixin); // depends on control dependency: [if], data = [none]
} else {
metadata = pathMixin.getMetadata(); // depends on control dependency: [if], data = [none]
}
U rv;
// the inits for the subtype will be wider, if it's a variable path
if (inits != null && pathMixin.getMetadata().getPathType() != PathType.VARIABLE) {
rv = clazz.getConstructor(PathMetadata.class, PathInits.class).newInstance(metadata, inits); // depends on control dependency: [if], data = [none]
} else {
rv = clazz.getConstructor(PathMetadata.class).newInstance(metadata); // depends on control dependency: [if], data = [none]
}
casts.put(clazz, rv); // depends on control dependency: [if], data = [none]
return rv; // depends on control dependency: [if], data = [none]
} else {
return (U) casts.get(clazz); // depends on control dependency: [if], data = [none]
}
} catch (InstantiationException e) {
throw new ExpressionException(e.getMessage(), e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
throw new ExpressionException(e.getMessage(), e);
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
throw new ExpressionException(e.getMessage(), e);
} catch (NoSuchMethodException e) { // depends on control dependency: [catch], data = [none]
throw new ExpressionException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected void enterTypevars(Symbol sym, Type t) {
if (t.getEnclosingType() != null) {
if (!t.getEnclosingType().hasTag(TypeTag.NONE)) {
enterTypevars(sym.owner, t.getEnclosingType());
}
} else if (sym.kind == MTH && !sym.isStatic()) {
enterTypevars(sym.owner, sym.owner.type);
}
for (List<Type> xs = t.getTypeArguments(); xs.nonEmpty(); xs = xs.tail) {
typevars.enter(xs.head.tsym);
}
} }
|
public class class_name {
protected void enterTypevars(Symbol sym, Type t) {
if (t.getEnclosingType() != null) {
if (!t.getEnclosingType().hasTag(TypeTag.NONE)) {
enterTypevars(sym.owner, t.getEnclosingType()); // depends on control dependency: [if], data = [none]
}
} else if (sym.kind == MTH && !sym.isStatic()) {
enterTypevars(sym.owner, sym.owner.type); // depends on control dependency: [if], data = [none]
}
for (List<Type> xs = t.getTypeArguments(); xs.nonEmpty(); xs = xs.tail) {
typevars.enter(xs.head.tsym); // depends on control dependency: [for], data = [xs]
}
} }
|
public class class_name {
public boolean isWorkingDay(Day day)
{
DayType value = getWorkingDay(day);
boolean result;
if (value == DayType.DEFAULT)
{
ProjectCalendar cal = getParent();
if (cal != null)
{
result = cal.isWorkingDay(day);
}
else
{
result = (day != Day.SATURDAY && day != Day.SUNDAY);
}
}
else
{
result = (value == DayType.WORKING);
}
return (result);
} }
|
public class class_name {
public boolean isWorkingDay(Day day)
{
DayType value = getWorkingDay(day);
boolean result;
if (value == DayType.DEFAULT)
{
ProjectCalendar cal = getParent();
if (cal != null)
{
result = cal.isWorkingDay(day); // depends on control dependency: [if], data = [none]
}
else
{
result = (day != Day.SATURDAY && day != Day.SUNDAY); // depends on control dependency: [if], data = [none]
}
}
else
{
result = (value == DayType.WORKING); // depends on control dependency: [if], data = [(value]
}
return (result);
} }
|
public class class_name {
static public void setLogLevel(LogLevel level) {
logLevel = level;
log.setLevel(level.value());
for (Handler handler : log.getHandlers()) {
handler.setLevel(level.value());
}
} }
|
public class class_name {
static public void setLogLevel(LogLevel level) {
logLevel = level;
log.setLevel(level.value());
for (Handler handler : log.getHandlers()) {
handler.setLevel(level.value()); // depends on control dependency: [for], data = [handler]
}
} }
|
public class class_name {
public final void generate(Resource input, IFileSystemAccess2 fsa, IGeneratorContext context) {
try {
beforeGenerate(input, fsa, context);
doGenerate(input, fsa, context);
} finally {
afterGenerate(input, fsa, context);
}
} }
|
public class class_name {
public final void generate(Resource input, IFileSystemAccess2 fsa, IGeneratorContext context) {
try {
beforeGenerate(input, fsa, context); // depends on control dependency: [try], data = [none]
doGenerate(input, fsa, context); // depends on control dependency: [try], data = [none]
} finally {
afterGenerate(input, fsa, context);
}
} }
|
public class class_name {
@Override
public ITextNode getTextNode(int index) {
if (index < 0 || index >= textNodeList.size()) {
return null;
}
return textNodeList.get(index);
} }
|
public class class_name {
@Override
public ITextNode getTextNode(int index) {
if (index < 0 || index >= textNodeList.size()) {
return null; // depends on control dependency: [if], data = [none]
}
return textNodeList.get(index);
} }
|
public class class_name {
@Override
public ScanResult call() throws InterruptedException, CancellationException, ExecutionException {
ScanResult scanResult = null;
Exception exception = null;
final long scanStart = System.currentTimeMillis();
try {
// Perform the scan
scanResult = openClasspathElementsThenScan();
// Log total time after scan completes, and flush log
if (topLevelLog != null) {
topLevelLog.log("~",
String.format("Total time: %.3f sec", (System.currentTimeMillis() - scanStart) * .001));
topLevelLog.flush();
}
// Call the ScanResultProcessor, if one was provided
if (scanResultProcessor != null) {
try {
scanResultProcessor.processScanResult(scanResult);
} finally {
scanResult.close();
}
}
} catch (final InterruptedException e) {
if (topLevelLog != null) {
topLevelLog.log("~", "Scan interrupted");
}
exception = e;
interruptionChecker.interrupt();
if (failureHandler == null) {
// Re-throw
throw e;
}
} catch (final CancellationException e) {
if (topLevelLog != null) {
topLevelLog.log("~", "Scan cancelled");
}
exception = e;
if (failureHandler == null) {
// Re-throw
throw e;
}
} catch (final ExecutionException e) {
if (topLevelLog != null) {
topLevelLog.log("~", "Uncaught exception during scan", InterruptionChecker.getCause(e));
}
exception = e;
if (failureHandler == null) {
// Re-throw
throw e;
}
} catch (final RuntimeException e) {
if (topLevelLog != null) {
topLevelLog.log("~", "Uncaught exception during scan", e);
}
exception = e;
if (failureHandler == null) {
// Wrap unchecked exceptions in a new ExecutionException
throw new ExecutionException("Exception while scanning", e);
}
} finally {
if (exception != null || scanSpec.removeTemporaryFilesAfterScan) {
// If an exception was thrown or removeTemporaryFilesAfterScan was set, remove temporary files
// and close resources, zipfiles, and modules
nestedJarHandler.close(topLevelLog);
}
}
if (exception != null) {
// If an exception was thrown, log the cause, and flush the toplevel log
if (topLevelLog != null) {
final Throwable cause = InterruptionChecker.getCause(exception);
topLevelLog.log("~", "An uncaught exception was thrown:", cause);
topLevelLog.flush();
}
// If exception is null, then failureHandler must be non-null at this point
try {
// Call the FailureHandler
failureHandler.onFailure(exception);
} catch (final Exception f) {
// The failure handler failed
if (topLevelLog != null) {
topLevelLog.log("~", "The failure handler threw an exception:", f);
}
// Group the two exceptions into one, using the suppressed exception mechanism
// to show the scan exception below the failure handler exception
final ExecutionException failureHandlerException = new ExecutionException(
"Exception while calling failure handler", f);
failureHandlerException.addSuppressed(exception);
// Throw a new ExecutionException (although this will probably be ignored,
// since any job with a FailureHandler was started with ExecutorService::execute
// rather than ExecutorService::submit)
throw failureHandlerException;
}
}
return scanResult;
} }
|
public class class_name {
@Override
public ScanResult call() throws InterruptedException, CancellationException, ExecutionException {
ScanResult scanResult = null;
Exception exception = null;
final long scanStart = System.currentTimeMillis();
try {
// Perform the scan
scanResult = openClasspathElementsThenScan();
// Log total time after scan completes, and flush log
if (topLevelLog != null) {
topLevelLog.log("~",
String.format("Total time: %.3f sec", (System.currentTimeMillis() - scanStart) * .001)); // depends on control dependency: [if], data = [none]
topLevelLog.flush(); // depends on control dependency: [if], data = [none]
}
// Call the ScanResultProcessor, if one was provided
if (scanResultProcessor != null) {
try {
scanResultProcessor.processScanResult(scanResult); // depends on control dependency: [try], data = [none]
} finally {
scanResult.close();
}
}
} catch (final InterruptedException e) {
if (topLevelLog != null) {
topLevelLog.log("~", "Scan interrupted"); // depends on control dependency: [if], data = [none]
}
exception = e;
interruptionChecker.interrupt();
if (failureHandler == null) {
// Re-throw
throw e;
}
} catch (final CancellationException e) {
if (topLevelLog != null) {
topLevelLog.log("~", "Scan cancelled"); // depends on control dependency: [if], data = [none]
}
exception = e;
if (failureHandler == null) {
// Re-throw
throw e;
}
} catch (final ExecutionException e) {
if (topLevelLog != null) {
topLevelLog.log("~", "Uncaught exception during scan", InterruptionChecker.getCause(e)); // depends on control dependency: [if], data = [none]
}
exception = e;
if (failureHandler == null) {
// Re-throw
throw e;
}
} catch (final RuntimeException e) {
if (topLevelLog != null) {
topLevelLog.log("~", "Uncaught exception during scan", e); // depends on control dependency: [if], data = [none]
}
exception = e;
if (failureHandler == null) {
// Wrap unchecked exceptions in a new ExecutionException
throw new ExecutionException("Exception while scanning", e);
}
} finally {
if (exception != null || scanSpec.removeTemporaryFilesAfterScan) {
// If an exception was thrown or removeTemporaryFilesAfterScan was set, remove temporary files
// and close resources, zipfiles, and modules
nestedJarHandler.close(topLevelLog); // depends on control dependency: [if], data = [none]
}
}
if (exception != null) {
// If an exception was thrown, log the cause, and flush the toplevel log
if (topLevelLog != null) {
final Throwable cause = InterruptionChecker.getCause(exception);
topLevelLog.log("~", "An uncaught exception was thrown:", cause);
topLevelLog.flush();
}
// If exception is null, then failureHandler must be non-null at this point
try {
// Call the FailureHandler
failureHandler.onFailure(exception);
} catch (final Exception f) {
// The failure handler failed
if (topLevelLog != null) {
topLevelLog.log("~", "The failure handler threw an exception:", f); // depends on control dependency: [if], data = [none]
}
// Group the two exceptions into one, using the suppressed exception mechanism
// to show the scan exception below the failure handler exception
final ExecutionException failureHandlerException = new ExecutionException(
"Exception while calling failure handler", f);
failureHandlerException.addSuppressed(exception);
// Throw a new ExecutionException (although this will probably be ignored,
// since any job with a FailureHandler was started with ExecutorService::execute
// rather than ExecutorService::submit)
throw failureHandlerException;
}
}
return scanResult;
} }
|
public class class_name {
private boolean isSafeAssign(Node n, boolean seenSideEffects) {
if (n.isAssign()) {
Node lhs = n.getFirstChild();
switch (lhs.getToken()) {
case NAME:
return true;
case GETPROP:
return !isExpressionTreeUnsafe(lhs.getFirstChild(), seenSideEffects);
case GETELEM:
return !isExpressionTreeUnsafe(lhs.getFirstChild(), seenSideEffects)
&& !isExpressionTreeUnsafe(lhs.getLastChild(), seenSideEffects);
default:
break;
}
}
return false;
} }
|
public class class_name {
private boolean isSafeAssign(Node n, boolean seenSideEffects) {
if (n.isAssign()) {
Node lhs = n.getFirstChild();
switch (lhs.getToken()) {
case NAME:
return true; // depends on control dependency: [if], data = [none]
case GETPROP:
return !isExpressionTreeUnsafe(lhs.getFirstChild(), seenSideEffects); // depends on control dependency: [if], data = [none]
case GETELEM:
return !isExpressionTreeUnsafe(lhs.getFirstChild(), seenSideEffects)
&& !isExpressionTreeUnsafe(lhs.getLastChild(), seenSideEffects); // depends on control dependency: [if], data = [none]
default:
break;
}
}
return false;
} }
|
public class class_name {
private CoordinateSequence restoreDim4(CoordinateSequence cs, Map<Coordinate, Double> map) {
CoordinateSequence seq = new PackedCoordinateSequenceFactory(DOUBLE, 4).create(cs.size(), 4);
for (int i = 0; i < cs.size(); i++) {
seq.setOrdinate(i, 0, cs.getOrdinate(i, 0));
seq.setOrdinate(i, 1, cs.getOrdinate(i, 1));
seq.setOrdinate(i, 2, cs.getOrdinate(i, 2));
Double d = map.get(cs.getCoordinate(i));
seq.setOrdinate(i, 3, d == null ? Double.NaN : d);
}
return seq;
} }
|
public class class_name {
private CoordinateSequence restoreDim4(CoordinateSequence cs, Map<Coordinate, Double> map) {
CoordinateSequence seq = new PackedCoordinateSequenceFactory(DOUBLE, 4).create(cs.size(), 4);
for (int i = 0; i < cs.size(); i++) {
seq.setOrdinate(i, 0, cs.getOrdinate(i, 0)); // depends on control dependency: [for], data = [i]
seq.setOrdinate(i, 1, cs.getOrdinate(i, 1)); // depends on control dependency: [for], data = [i]
seq.setOrdinate(i, 2, cs.getOrdinate(i, 2)); // depends on control dependency: [for], data = [i]
Double d = map.get(cs.getCoordinate(i));
seq.setOrdinate(i, 3, d == null ? Double.NaN : d); // depends on control dependency: [for], data = [i]
}
return seq;
} }
|
public class class_name {
public void syncFilename(String fileName) {
if (emitLineDirectives) {
if (!fileName.equals(currentFile)) {
currentLine = BEGINNING_OF_FILE;
// C11 spec. (6.10.4) requires a line number between 1 and 2147483647.
buffer.append(UnicodeUtils.format("\n#line 1 \"%s\"\n", fileName));
}
}
currentFile = fileName;
} }
|
public class class_name {
public void syncFilename(String fileName) {
if (emitLineDirectives) {
if (!fileName.equals(currentFile)) {
currentLine = BEGINNING_OF_FILE; // depends on control dependency: [if], data = [none]
// C11 spec. (6.10.4) requires a line number between 1 and 2147483647.
buffer.append(UnicodeUtils.format("\n#line 1 \"%s\"\n", fileName)); // depends on control dependency: [if], data = [none]
}
}
currentFile = fileName;
} }
|
public class class_name {
public Optional<Issue> getOptionalIssue(Object projectIdOrPath, Integer issueIid) {
try {
return (Optional.ofNullable(getIssue(projectIdOrPath, issueIid)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
} }
|
public class class_name {
public Optional<Issue> getOptionalIssue(Object projectIdOrPath, Integer issueIid) {
try {
return (Optional.ofNullable(getIssue(projectIdOrPath, issueIid))); // depends on control dependency: [try], data = [none]
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public final EObject ruleXImportDeclaration() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token lv_static_1_0=null;
Token lv_extension_2_0=null;
Token lv_wildcard_4_0=null;
Token otherlv_8=null;
AntlrDatatypeRuleToken lv_memberName_5_0 = null;
AntlrDatatypeRuleToken lv_importedNamespace_7_0 = null;
enterRule();
try {
// InternalXtype.g:884:2: ( (otherlv_0= 'import' ( ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) ) | ( ( ruleQualifiedName ) ) | ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) ) ) (otherlv_8= ';' )? ) )
// InternalXtype.g:885:2: (otherlv_0= 'import' ( ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) ) | ( ( ruleQualifiedName ) ) | ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) ) ) (otherlv_8= ';' )? )
{
// InternalXtype.g:885:2: (otherlv_0= 'import' ( ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) ) | ( ( ruleQualifiedName ) ) | ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) ) ) (otherlv_8= ';' )? )
// InternalXtype.g:886:3: otherlv_0= 'import' ( ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) ) | ( ( ruleQualifiedName ) ) | ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) ) ) (otherlv_8= ';' )?
{
otherlv_0=(Token)match(input,24,FOLLOW_19); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_0, grammarAccess.getXImportDeclarationAccess().getImportKeyword_0());
}
// InternalXtype.g:890:3: ( ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) ) | ( ( ruleQualifiedName ) ) | ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) ) )
int alt18=3;
alt18 = dfa18.predict(input);
switch (alt18) {
case 1 :
// InternalXtype.g:891:4: ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) )
{
// InternalXtype.g:891:4: ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) )
// InternalXtype.g:892:5: ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) )
{
// InternalXtype.g:892:5: ( (lv_static_1_0= 'static' ) )
// InternalXtype.g:893:6: (lv_static_1_0= 'static' )
{
// InternalXtype.g:893:6: (lv_static_1_0= 'static' )
// InternalXtype.g:894:7: lv_static_1_0= 'static'
{
lv_static_1_0=(Token)match(input,25,FOLLOW_20); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_static_1_0, grammarAccess.getXImportDeclarationAccess().getStaticStaticKeyword_1_0_0_0());
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXImportDeclarationRule());
}
setWithLastConsumed(current, "static", true, "static");
}
}
}
// InternalXtype.g:906:5: ( (lv_extension_2_0= 'extension' ) )?
int alt16=2;
int LA16_0 = input.LA(1);
if ( (LA16_0==26) ) {
alt16=1;
}
switch (alt16) {
case 1 :
// InternalXtype.g:907:6: (lv_extension_2_0= 'extension' )
{
// InternalXtype.g:907:6: (lv_extension_2_0= 'extension' )
// InternalXtype.g:908:7: lv_extension_2_0= 'extension'
{
lv_extension_2_0=(Token)match(input,26,FOLLOW_20); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_extension_2_0, grammarAccess.getXImportDeclarationAccess().getExtensionExtensionKeyword_1_0_1_0());
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXImportDeclarationRule());
}
setWithLastConsumed(current, "extension", true, "extension");
}
}
}
break;
}
// InternalXtype.g:920:5: ( ( ruleQualifiedNameInStaticImport ) )
// InternalXtype.g:921:6: ( ruleQualifiedNameInStaticImport )
{
// InternalXtype.g:921:6: ( ruleQualifiedNameInStaticImport )
// InternalXtype.g:922:7: ruleQualifiedNameInStaticImport
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXImportDeclarationRule());
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXImportDeclarationAccess().getImportedTypeJvmDeclaredTypeCrossReference_1_0_2_0());
}
pushFollow(FOLLOW_21);
ruleQualifiedNameInStaticImport();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall();
}
}
}
// InternalXtype.g:936:5: ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) )
int alt17=2;
int LA17_0 = input.LA(1);
if ( (LA17_0==23) ) {
alt17=1;
}
else if ( (LA17_0==RULE_ID) ) {
alt17=2;
}
else {
if (state.backtracking>0) {state.failed=true; return current;}
NoViableAltException nvae =
new NoViableAltException("", 17, 0, input);
throw nvae;
}
switch (alt17) {
case 1 :
// InternalXtype.g:937:6: ( (lv_wildcard_4_0= '*' ) )
{
// InternalXtype.g:937:6: ( (lv_wildcard_4_0= '*' ) )
// InternalXtype.g:938:7: (lv_wildcard_4_0= '*' )
{
// InternalXtype.g:938:7: (lv_wildcard_4_0= '*' )
// InternalXtype.g:939:8: lv_wildcard_4_0= '*'
{
lv_wildcard_4_0=(Token)match(input,23,FOLLOW_22); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_wildcard_4_0, grammarAccess.getXImportDeclarationAccess().getWildcardAsteriskKeyword_1_0_3_0_0());
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXImportDeclarationRule());
}
setWithLastConsumed(current, "wildcard", true, "*");
}
}
}
}
break;
case 2 :
// InternalXtype.g:952:6: ( (lv_memberName_5_0= ruleValidID ) )
{
// InternalXtype.g:952:6: ( (lv_memberName_5_0= ruleValidID ) )
// InternalXtype.g:953:7: (lv_memberName_5_0= ruleValidID )
{
// InternalXtype.g:953:7: (lv_memberName_5_0= ruleValidID )
// InternalXtype.g:954:8: lv_memberName_5_0= ruleValidID
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXImportDeclarationAccess().getMemberNameValidIDParserRuleCall_1_0_3_1_0());
}
pushFollow(FOLLOW_22);
lv_memberName_5_0=ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXImportDeclarationRule());
}
set(
current,
"memberName",
lv_memberName_5_0,
"org.eclipse.xtext.xbase.Xtype.ValidID");
afterParserOrEnumRuleCall();
}
}
}
}
break;
}
}
}
break;
case 2 :
// InternalXtype.g:974:4: ( ( ruleQualifiedName ) )
{
// InternalXtype.g:974:4: ( ( ruleQualifiedName ) )
// InternalXtype.g:975:5: ( ruleQualifiedName )
{
// InternalXtype.g:975:5: ( ruleQualifiedName )
// InternalXtype.g:976:6: ruleQualifiedName
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXImportDeclarationRule());
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXImportDeclarationAccess().getImportedTypeJvmDeclaredTypeCrossReference_1_1_0());
}
pushFollow(FOLLOW_22);
ruleQualifiedName();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall();
}
}
}
}
break;
case 3 :
// InternalXtype.g:991:4: ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) )
{
// InternalXtype.g:991:4: ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) )
// InternalXtype.g:992:5: (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard )
{
// InternalXtype.g:992:5: (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard )
// InternalXtype.g:993:6: lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXImportDeclarationAccess().getImportedNamespaceQualifiedNameWithWildcardParserRuleCall_1_2_0());
}
pushFollow(FOLLOW_22);
lv_importedNamespace_7_0=ruleQualifiedNameWithWildcard();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXImportDeclarationRule());
}
set(
current,
"importedNamespace",
lv_importedNamespace_7_0,
"org.eclipse.xtext.xbase.Xtype.QualifiedNameWithWildcard");
afterParserOrEnumRuleCall();
}
}
}
}
break;
}
// InternalXtype.g:1011:3: (otherlv_8= ';' )?
int alt19=2;
int LA19_0 = input.LA(1);
if ( (LA19_0==27) ) {
alt19=1;
}
switch (alt19) {
case 1 :
// InternalXtype.g:1012:4: otherlv_8= ';'
{
otherlv_8=(Token)match(input,27,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_8, grammarAccess.getXImportDeclarationAccess().getSemicolonKeyword_2());
}
}
break;
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final EObject ruleXImportDeclaration() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token lv_static_1_0=null;
Token lv_extension_2_0=null;
Token lv_wildcard_4_0=null;
Token otherlv_8=null;
AntlrDatatypeRuleToken lv_memberName_5_0 = null;
AntlrDatatypeRuleToken lv_importedNamespace_7_0 = null;
enterRule();
try {
// InternalXtype.g:884:2: ( (otherlv_0= 'import' ( ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) ) | ( ( ruleQualifiedName ) ) | ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) ) ) (otherlv_8= ';' )? ) )
// InternalXtype.g:885:2: (otherlv_0= 'import' ( ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) ) | ( ( ruleQualifiedName ) ) | ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) ) ) (otherlv_8= ';' )? )
{
// InternalXtype.g:885:2: (otherlv_0= 'import' ( ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) ) | ( ( ruleQualifiedName ) ) | ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) ) ) (otherlv_8= ';' )? )
// InternalXtype.g:886:3: otherlv_0= 'import' ( ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) ) | ( ( ruleQualifiedName ) ) | ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) ) ) (otherlv_8= ';' )?
{
otherlv_0=(Token)match(input,24,FOLLOW_19); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_0, grammarAccess.getXImportDeclarationAccess().getImportKeyword_0()); // depends on control dependency: [if], data = [none]
}
// InternalXtype.g:890:3: ( ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) ) | ( ( ruleQualifiedName ) ) | ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) ) )
int alt18=3;
alt18 = dfa18.predict(input);
switch (alt18) {
case 1 :
// InternalXtype.g:891:4: ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) )
{
// InternalXtype.g:891:4: ( ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) ) )
// InternalXtype.g:892:5: ( (lv_static_1_0= 'static' ) ) ( (lv_extension_2_0= 'extension' ) )? ( ( ruleQualifiedNameInStaticImport ) ) ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) )
{
// InternalXtype.g:892:5: ( (lv_static_1_0= 'static' ) )
// InternalXtype.g:893:6: (lv_static_1_0= 'static' )
{
// InternalXtype.g:893:6: (lv_static_1_0= 'static' )
// InternalXtype.g:894:7: lv_static_1_0= 'static'
{
lv_static_1_0=(Token)match(input,25,FOLLOW_20); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_static_1_0, grammarAccess.getXImportDeclarationAccess().getStaticStaticKeyword_1_0_0_0()); // depends on control dependency: [if], data = [none]
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXImportDeclarationRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "static", true, "static"); // depends on control dependency: [if], data = [none]
}
}
}
// InternalXtype.g:906:5: ( (lv_extension_2_0= 'extension' ) )?
int alt16=2;
int LA16_0 = input.LA(1);
if ( (LA16_0==26) ) {
alt16=1; // depends on control dependency: [if], data = [none]
}
switch (alt16) {
case 1 :
// InternalXtype.g:907:6: (lv_extension_2_0= 'extension' )
{
// InternalXtype.g:907:6: (lv_extension_2_0= 'extension' )
// InternalXtype.g:908:7: lv_extension_2_0= 'extension'
{
lv_extension_2_0=(Token)match(input,26,FOLLOW_20); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_extension_2_0, grammarAccess.getXImportDeclarationAccess().getExtensionExtensionKeyword_1_0_1_0()); // depends on control dependency: [if], data = [none]
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXImportDeclarationRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "extension", true, "extension"); // depends on control dependency: [if], data = [none]
}
}
}
break;
}
// InternalXtype.g:920:5: ( ( ruleQualifiedNameInStaticImport ) )
// InternalXtype.g:921:6: ( ruleQualifiedNameInStaticImport )
{
// InternalXtype.g:921:6: ( ruleQualifiedNameInStaticImport )
// InternalXtype.g:922:7: ruleQualifiedNameInStaticImport
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXImportDeclarationRule()); // depends on control dependency: [if], data = [none]
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXImportDeclarationAccess().getImportedTypeJvmDeclaredTypeCrossReference_1_0_2_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_21);
ruleQualifiedNameInStaticImport();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
// InternalXtype.g:936:5: ( ( (lv_wildcard_4_0= '*' ) ) | ( (lv_memberName_5_0= ruleValidID ) ) )
int alt17=2;
int LA17_0 = input.LA(1);
if ( (LA17_0==23) ) {
alt17=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA17_0==RULE_ID) ) {
alt17=2; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return current;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 17, 0, input);
throw nvae;
}
switch (alt17) {
case 1 :
// InternalXtype.g:937:6: ( (lv_wildcard_4_0= '*' ) )
{
// InternalXtype.g:937:6: ( (lv_wildcard_4_0= '*' ) )
// InternalXtype.g:938:7: (lv_wildcard_4_0= '*' )
{
// InternalXtype.g:938:7: (lv_wildcard_4_0= '*' )
// InternalXtype.g:939:8: lv_wildcard_4_0= '*'
{
lv_wildcard_4_0=(Token)match(input,23,FOLLOW_22); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_wildcard_4_0, grammarAccess.getXImportDeclarationAccess().getWildcardAsteriskKeyword_1_0_3_0_0()); // depends on control dependency: [if], data = [none]
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXImportDeclarationRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "wildcard", true, "*"); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
case 2 :
// InternalXtype.g:952:6: ( (lv_memberName_5_0= ruleValidID ) )
{
// InternalXtype.g:952:6: ( (lv_memberName_5_0= ruleValidID ) )
// InternalXtype.g:953:7: (lv_memberName_5_0= ruleValidID )
{
// InternalXtype.g:953:7: (lv_memberName_5_0= ruleValidID )
// InternalXtype.g:954:8: lv_memberName_5_0= ruleValidID
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXImportDeclarationAccess().getMemberNameValidIDParserRuleCall_1_0_3_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_22);
lv_memberName_5_0=ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXImportDeclarationRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"memberName",
lv_memberName_5_0,
"org.eclipse.xtext.xbase.Xtype.ValidID"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
}
}
}
break;
case 2 :
// InternalXtype.g:974:4: ( ( ruleQualifiedName ) )
{
// InternalXtype.g:974:4: ( ( ruleQualifiedName ) )
// InternalXtype.g:975:5: ( ruleQualifiedName )
{
// InternalXtype.g:975:5: ( ruleQualifiedName )
// InternalXtype.g:976:6: ruleQualifiedName
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXImportDeclarationRule()); // depends on control dependency: [if], data = [none]
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXImportDeclarationAccess().getImportedTypeJvmDeclaredTypeCrossReference_1_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_22);
ruleQualifiedName();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
case 3 :
// InternalXtype.g:991:4: ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) )
{
// InternalXtype.g:991:4: ( (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard ) )
// InternalXtype.g:992:5: (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard )
{
// InternalXtype.g:992:5: (lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard )
// InternalXtype.g:993:6: lv_importedNamespace_7_0= ruleQualifiedNameWithWildcard
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXImportDeclarationAccess().getImportedNamespaceQualifiedNameWithWildcardParserRuleCall_1_2_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_22);
lv_importedNamespace_7_0=ruleQualifiedNameWithWildcard();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXImportDeclarationRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"importedNamespace",
lv_importedNamespace_7_0,
"org.eclipse.xtext.xbase.Xtype.QualifiedNameWithWildcard"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
}
// InternalXtype.g:1011:3: (otherlv_8= ';' )?
int alt19=2;
int LA19_0 = input.LA(1);
if ( (LA19_0==27) ) {
alt19=1; // depends on control dependency: [if], data = [none]
}
switch (alt19) {
case 1 :
// InternalXtype.g:1012:4: otherlv_8= ';'
{
otherlv_8=(Token)match(input,27,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_8, grammarAccess.getXImportDeclarationAccess().getSemicolonKeyword_2()); // depends on control dependency: [if], data = [none]
}
}
break;
}
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
private String getNamespaceDeclarations() {
StringBuilder nsDecls = new StringBuilder();
String quoteStyle = "'";
for (Iterator keys = ctx.getPrefixes(); keys.hasNext(); ) {
String prefix = (String) keys.next();
String uri = ctx.getNamespaceURI(prefix);
if (uri == null) {
continue;
}
// this shouldn't have happened, but better safe than sorry
if (prefix == null) {
prefix = "";
}
if (uri.indexOf('\'') != -1) {
quoteStyle = "\"";
}
nsDecls.append(' ').append(XMLNS_PREFIX);
if (prefix.length() > 0) {
nsDecls.append(':');
}
nsDecls.append(prefix).append('=')
.append(quoteStyle).append(uri).append(quoteStyle)
.append(' ');
}
return nsDecls.toString();
} }
|
public class class_name {
private String getNamespaceDeclarations() {
StringBuilder nsDecls = new StringBuilder();
String quoteStyle = "'";
for (Iterator keys = ctx.getPrefixes(); keys.hasNext(); ) {
String prefix = (String) keys.next();
String uri = ctx.getNamespaceURI(prefix);
if (uri == null) {
continue;
}
// this shouldn't have happened, but better safe than sorry
if (prefix == null) {
prefix = ""; // depends on control dependency: [if], data = [none]
}
if (uri.indexOf('\'') != -1) {
quoteStyle = "\""; // depends on control dependency: [if], data = [none]
}
nsDecls.append(' ').append(XMLNS_PREFIX); // depends on control dependency: [for], data = [none]
if (prefix.length() > 0) {
nsDecls.append(':'); // depends on control dependency: [if], data = [none]
}
nsDecls.append(prefix).append('=')
.append(quoteStyle).append(uri).append(quoteStyle)
.append(' '); // depends on control dependency: [for], data = [none]
}
return nsDecls.toString();
} }
|
public class class_name {
protected boolean parseLine(String line) {
line = checkNotNull(line).trim();
if (line.isEmpty()) {
return false; // Skip empty lines
}
final String[] args = line.split("=", 2);
if (args.length != 2) {
// invalid argument, so skip
return false;
}
final String key = checkNotNull(args[0]);
final String value = checkNotNull(args[1]);
switch (key) {
case "frame":
frame = Long.parseLong(value);
return false;
case "fps":
fps = Fraction.getFraction(value);
return false;
case "bitrate":
if (value.equals("N/A")) {
bitrate = -1;
} else {
bitrate = FFmpegUtils.parseBitrate(value);
}
return false;
case "total_size":
if (value.equals("N/A")) {
total_size = -1;
} else {
total_size = Long.parseLong(value);
}
return false;
case "out_time_ms":
// This is a duplicate of the "out_time" field, but expressed as a int instead of string.
// Note this value is in microseconds, not milliseconds, and is based on AV_TIME_BASE which
// could change.
// out_time_ns = Long.parseLong(value) * 1000;
return false;
case "out_time":
out_time_ns = fromTimecode(value);
return false;
case "dup_frames":
dup_frames = Long.parseLong(value);
return false;
case "drop_frames":
drop_frames = Long.parseLong(value);
return false;
case "speed":
if (value.equals("N/A")) {
speed = -1;
} else {
speed = Float.parseFloat(value.replace("x", ""));
}
return false;
case "progress":
// TODO After "end" stream is closed
status = Status.of(value);
return true; // The status field is always last in the record
default:
if (key.startsWith("stream_")) {
// TODO handle stream_0_0_q=0.0:
// stream_%d_%d_q= file_index, index, quality
// stream_%d_%d_psnr_%c=%2.2f, file_index, index, type{Y, U, V}, quality // Enable with
// AV_CODEC_FLAG_PSNR
// stream_%d_%d_psnr_all
} else {
LOG.warn("skipping unhandled key: {} = {}", key, value);
}
return false; // Either way, not supported
}
} }
|
public class class_name {
protected boolean parseLine(String line) {
line = checkNotNull(line).trim();
if (line.isEmpty()) {
return false; // Skip empty lines // depends on control dependency: [if], data = [none]
}
final String[] args = line.split("=", 2);
if (args.length != 2) {
// invalid argument, so skip
return false; // depends on control dependency: [if], data = [none]
}
final String key = checkNotNull(args[0]);
final String value = checkNotNull(args[1]);
switch (key) {
case "frame":
frame = Long.parseLong(value);
return false;
case "fps":
fps = Fraction.getFraction(value);
return false;
case "bitrate":
if (value.equals("N/A")) {
bitrate = -1; // depends on control dependency: [if], data = [none]
} else {
bitrate = FFmpegUtils.parseBitrate(value); // depends on control dependency: [if], data = [none]
}
return false;
case "total_size":
if (value.equals("N/A")) {
total_size = -1; // depends on control dependency: [if], data = [none]
} else {
total_size = Long.parseLong(value); // depends on control dependency: [if], data = [none]
}
return false;
case "out_time_ms":
// This is a duplicate of the "out_time" field, but expressed as a int instead of string.
// Note this value is in microseconds, not milliseconds, and is based on AV_TIME_BASE which
// could change.
// out_time_ns = Long.parseLong(value) * 1000;
return false;
case "out_time":
out_time_ns = fromTimecode(value);
return false;
case "dup_frames":
dup_frames = Long.parseLong(value);
return false;
case "drop_frames":
drop_frames = Long.parseLong(value);
return false;
case "speed":
if (value.equals("N/A")) {
speed = -1; // depends on control dependency: [if], data = [none]
} else {
speed = Float.parseFloat(value.replace("x", "")); // depends on control dependency: [if], data = [none]
}
return false;
case "progress":
// TODO After "end" stream is closed
status = Status.of(value);
return true; // The status field is always last in the record
default:
if (key.startsWith("stream_")) {
// TODO handle stream_0_0_q=0.0:
// stream_%d_%d_q= file_index, index, quality
// stream_%d_%d_psnr_%c=%2.2f, file_index, index, type{Y, U, V}, quality // Enable with
// AV_CODEC_FLAG_PSNR
// stream_%d_%d_psnr_all
} else {
LOG.warn("skipping unhandled key: {} = {}", key, value); // depends on control dependency: [if], data = [none]
}
return false; // Either way, not supported
}
} }
|
public class class_name {
@Override
protected void updateEnvironment(final Environment env) {
// Check if update already applied (so not applied in render phase)
if (!environmentUpdated) {
environmentUpdated = true;
// Post path may have changed (if mapped with multiple URLs)
String postPath = getResponseUrl(backingRequest);
env.setPostPath(postPath);
}
} }
|
public class class_name {
@Override
protected void updateEnvironment(final Environment env) {
// Check if update already applied (so not applied in render phase)
if (!environmentUpdated) {
environmentUpdated = true; // depends on control dependency: [if], data = [none]
// Post path may have changed (if mapped with multiple URLs)
String postPath = getResponseUrl(backingRequest);
env.setPostPath(postPath); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void createAnimation(final float x, final float y) {
if (this.isEnabled() && !animationRunning) {
if (hasToZoom)
this.startAnimation(scaleAnimation);
radiusMax = Math.max(WIDTH, HEIGHT);
if (rippleType != 2)
radiusMax /= 2;
radiusMax -= ripplePadding;
if (isCentered || rippleType == 1) {
this.x = getMeasuredWidth() / 2;
this.y = getMeasuredHeight() / 2;
} else {
this.x = x;
this.y = y;
}
animationRunning = true;
if (rippleType == 1 && originBitmap == null)
originBitmap = getDrawingCache(true);
invalidate();
}
} }
|
public class class_name {
private void createAnimation(final float x, final float y) {
if (this.isEnabled() && !animationRunning) {
if (hasToZoom)
this.startAnimation(scaleAnimation);
radiusMax = Math.max(WIDTH, HEIGHT); // depends on control dependency: [if], data = [none]
if (rippleType != 2)
radiusMax /= 2;
radiusMax -= ripplePadding; // depends on control dependency: [if], data = [none]
if (isCentered || rippleType == 1) {
this.x = getMeasuredWidth() / 2; // depends on control dependency: [if], data = [none]
this.y = getMeasuredHeight() / 2; // depends on control dependency: [if], data = [none]
} else {
this.x = x; // depends on control dependency: [if], data = [none]
this.y = y; // depends on control dependency: [if], data = [none]
}
animationRunning = true; // depends on control dependency: [if], data = [none]
if (rippleType == 1 && originBitmap == null)
originBitmap = getDrawingCache(true);
invalidate(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private RuntimeException launderException(final Throwable throwable) {
if (throwable instanceof RuntimeException) {
return (RuntimeException) throwable;
} else if (throwable instanceof Error) {
throw (Error) throwable;
} else {
throw new IllegalStateException("Unchecked exception", throwable);
}
} }
|
public class class_name {
private RuntimeException launderException(final Throwable throwable) {
if (throwable instanceof RuntimeException) {
return (RuntimeException) throwable; // depends on control dependency: [if], data = [none]
} else if (throwable instanceof Error) {
throw (Error) throwable;
} else {
throw new IllegalStateException("Unchecked exception", throwable);
}
} }
|
public class class_name {
public void createIndexes(Connection connection, TableCreationMode mode) {
ArrayList<Type<?>> sorted = sortTypes();
for (Type<?> type : sorted) {
createIndexes(connection, mode, type);
}
} }
|
public class class_name {
public void createIndexes(Connection connection, TableCreationMode mode) {
ArrayList<Type<?>> sorted = sortTypes();
for (Type<?> type : sorted) {
createIndexes(connection, mode, type); // depends on control dependency: [for], data = [type]
}
} }
|
public class class_name {
protected void fireBackendUpdated(E e) {
for (int i = 0, n = this.listenerList.size(); i < n; i++) {
this.listenerList.get(i).backendUpdated(e);
}
} }
|
public class class_name {
protected void fireBackendUpdated(E e) {
for (int i = 0, n = this.listenerList.size(); i < n; i++) {
this.listenerList.get(i).backendUpdated(e); // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
@Override
public boolean getIsEmptyOrWhitespaceOnly() {
if (m_contentValue == null) {
// this is the case for non existing values
return true;
}
if (m_contentValue.isSimpleType()) {
// return values for simple type
return CmsStringUtil.isEmptyOrWhitespaceOnly(m_contentValue.getStringValue(m_cms));
} else {
// nested types are not empty if they have any children in the XML
return m_contentValue.getElement().elements().isEmpty();
}
} }
|
public class class_name {
@Override
public boolean getIsEmptyOrWhitespaceOnly() {
if (m_contentValue == null) {
// this is the case for non existing values
return true; // depends on control dependency: [if], data = [none]
}
if (m_contentValue.isSimpleType()) {
// return values for simple type
return CmsStringUtil.isEmptyOrWhitespaceOnly(m_contentValue.getStringValue(m_cms)); // depends on control dependency: [if], data = [none]
} else {
// nested types are not empty if they have any children in the XML
return m_contentValue.getElement().elements().isEmpty(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Observable<T> startWithArray(T... items) {
Observable<T> fromArray = fromArray(items);
if (fromArray == empty()) {
return RxJavaPlugins.onAssembly(this);
}
return concatArray(fromArray, this);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Observable<T> startWithArray(T... items) {
Observable<T> fromArray = fromArray(items);
if (fromArray == empty()) {
return RxJavaPlugins.onAssembly(this); // depends on control dependency: [if], data = [none]
}
return concatArray(fromArray, this);
} }
|
public class class_name {
public static void mainArrayBlockingQueue(String... args) throws Exception {
final int runs = 20;
final int tradeCount = 5_000_000;
final int batchSize = 125;
int currentBatchSize = batchSize;
run(runs, tradeCount, 1);
run(runs, tradeCount, batchSize);
for (int index=0; index< 10; index++) {
run(runs, tradeCount, currentBatchSize);
currentBatchSize*=2;
}
} }
|
public class class_name {
public static void mainArrayBlockingQueue(String... args) throws Exception {
final int runs = 20;
final int tradeCount = 5_000_000;
final int batchSize = 125;
int currentBatchSize = batchSize;
run(runs, tradeCount, 1);
run(runs, tradeCount, batchSize);
for (int index=0; index< 10; index++) {
run(runs, tradeCount, currentBatchSize); // depends on control dependency: [for], data = [none]
currentBatchSize*=2; // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public static List<Organisasjonsnummer> getOrganisasjonsnummerList(int length) {
List<Organisasjonsnummer> result = new ArrayList<Organisasjonsnummer>();
int numAddedToList = 0;
while (numAddedToList < length) {
StringBuilder orgnrBuffer = new StringBuilder(LENGTH);
for (int i = 0; i < LENGTH; i++) {
orgnrBuffer.append((int) (Math.random() * 10));
}
Organisasjonsnummer orgNr;
try {
orgNr = OrganisasjonsnummerValidator.getAndForceValidOrganisasjonsnummer(orgnrBuffer.toString());
} catch (IllegalArgumentException iae) {
// this number has no valid checksum
continue;
}
result.add(orgNr);
numAddedToList++;
}
return result;
} }
|
public class class_name {
public static List<Organisasjonsnummer> getOrganisasjonsnummerList(int length) {
List<Organisasjonsnummer> result = new ArrayList<Organisasjonsnummer>();
int numAddedToList = 0;
while (numAddedToList < length) {
StringBuilder orgnrBuffer = new StringBuilder(LENGTH);
for (int i = 0; i < LENGTH; i++) {
orgnrBuffer.append((int) (Math.random() * 10));
// depends on control dependency: [for], data = [none]
}
Organisasjonsnummer orgNr;
try {
orgNr = OrganisasjonsnummerValidator.getAndForceValidOrganisasjonsnummer(orgnrBuffer.toString());
// depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException iae) {
// this number has no valid checksum
continue;
}
// depends on control dependency: [catch], data = [none]
result.add(orgNr);
// depends on control dependency: [while], data = [none]
numAddedToList++;
// depends on control dependency: [while], data = [none]
}
return result;
} }
|
public class class_name {
Object retrieveAndDispose(int sequence) {
int index = toIndex(sequence);
checkSequence(index, sequence);
try {
return ringItems[index];
} finally {
ringItems[index] = null;
isTask[index] = false;
head--;
}
} }
|
public class class_name {
Object retrieveAndDispose(int sequence) {
int index = toIndex(sequence);
checkSequence(index, sequence);
try {
return ringItems[index]; // depends on control dependency: [try], data = [none]
} finally {
ringItems[index] = null;
isTask[index] = false;
head--;
}
} }
|
public class class_name {
public DescribeSnapshotAttributeResult withCreateVolumePermissions(CreateVolumePermission... createVolumePermissions) {
if (this.createVolumePermissions == null) {
setCreateVolumePermissions(new com.amazonaws.internal.SdkInternalList<CreateVolumePermission>(createVolumePermissions.length));
}
for (CreateVolumePermission ele : createVolumePermissions) {
this.createVolumePermissions.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeSnapshotAttributeResult withCreateVolumePermissions(CreateVolumePermission... createVolumePermissions) {
if (this.createVolumePermissions == null) {
setCreateVolumePermissions(new com.amazonaws.internal.SdkInternalList<CreateVolumePermission>(createVolumePermissions.length)); // depends on control dependency: [if], data = [none]
}
for (CreateVolumePermission ele : createVolumePermissions) {
this.createVolumePermissions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
final int getGregorianYearFromFixedDate(long fixedDate) {
long d0;
int d1, d2, d3, d4;
int n400, n100, n4, n1;
int year;
if (fixedDate > 0) {
d0 = fixedDate - 1;
n400 = (int)(d0 / 146097);
d1 = (int)(d0 % 146097);
n100 = d1 / 36524;
d2 = d1 % 36524;
n4 = d2 / 1461;
d3 = d2 % 1461;
n1 = d3 / 365;
d4 = (d3 % 365) + 1;
} else {
d0 = fixedDate - 1;
n400 = (int)CalendarUtils.floorDivide(d0, 146097L);
d1 = (int)CalendarUtils.mod(d0, 146097L);
n100 = CalendarUtils.floorDivide(d1, 36524);
d2 = CalendarUtils.mod(d1, 36524);
n4 = CalendarUtils.floorDivide(d2, 1461);
d3 = CalendarUtils.mod(d2, 1461);
n1 = CalendarUtils.floorDivide(d3, 365);
d4 = CalendarUtils.mod(d3, 365) + 1;
}
year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
if (!(n100 == 4 || n1 == 4)) {
++year;
}
return year;
} }
|
public class class_name {
final int getGregorianYearFromFixedDate(long fixedDate) {
long d0;
int d1, d2, d3, d4;
int n400, n100, n4, n1;
int year;
if (fixedDate > 0) {
d0 = fixedDate - 1; // depends on control dependency: [if], data = [none]
n400 = (int)(d0 / 146097); // depends on control dependency: [if], data = [none]
d1 = (int)(d0 % 146097); // depends on control dependency: [if], data = [none]
n100 = d1 / 36524; // depends on control dependency: [if], data = [none]
d2 = d1 % 36524; // depends on control dependency: [if], data = [none]
n4 = d2 / 1461; // depends on control dependency: [if], data = [none]
d3 = d2 % 1461; // depends on control dependency: [if], data = [none]
n1 = d3 / 365; // depends on control dependency: [if], data = [none]
d4 = (d3 % 365) + 1; // depends on control dependency: [if], data = [none]
} else {
d0 = fixedDate - 1; // depends on control dependency: [if], data = [none]
n400 = (int)CalendarUtils.floorDivide(d0, 146097L); // depends on control dependency: [if], data = [none]
d1 = (int)CalendarUtils.mod(d0, 146097L); // depends on control dependency: [if], data = [none]
n100 = CalendarUtils.floorDivide(d1, 36524); // depends on control dependency: [if], data = [none]
d2 = CalendarUtils.mod(d1, 36524); // depends on control dependency: [if], data = [none]
n4 = CalendarUtils.floorDivide(d2, 1461); // depends on control dependency: [if], data = [none]
d3 = CalendarUtils.mod(d2, 1461); // depends on control dependency: [if], data = [none]
n1 = CalendarUtils.floorDivide(d3, 365); // depends on control dependency: [if], data = [none]
d4 = CalendarUtils.mod(d3, 365) + 1; // depends on control dependency: [if], data = [none]
}
year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
if (!(n100 == 4 || n1 == 4)) {
++year; // depends on control dependency: [if], data = [none]
}
return year;
} }
|
public class class_name {
public long writeTo(final File file) throws IOException {
FileOutputStream out = null;
try {
out = new FileOutputStream(file);
return writeTo(out);
} finally {
if (out != null) {
out.close();
}
}
} }
|
public class class_name {
public long writeTo(final File file) throws IOException {
FileOutputStream out = null;
try {
out = new FileOutputStream(file);
return writeTo(out);
} finally {
if (out != null) {
out.close(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public boolean removeAttributes(final boolean updateClient,
final String... attributeNames) {
boolean removed = false;
boolean listenerInvoked = false;
final Lock lock = sharedObject.getLock(ACCESS_OBJECT).writeLock();
try {
lock.lock();
if (attributesMap == null) {
return false;
}
for (final String attributeName : attributeNames) {
final AbstractAttribute attribute = attributesMap
.get(attributeName);
if (attribute != null) {
attribute.unsetOwnerTag(this);
attributesMap.remove(attributeName);
removed = true;
}
}
if (removed) {
attributes = new AbstractAttribute[attributesMap.size()];
attributesMap.values().toArray(attributes);
setModified(true);
sharedObject.setChildModified(true);
// invokeListener
if (updateClient) {
final AttributeRemoveListener listener = sharedObject
.getAttributeRemoveListener(ACCESS_OBJECT);
if (listener != null) {
final AttributeRemoveListener.RemovedEvent event = new AttributeRemoveListener.RemovedEvent(
this, attributeNames);
listener.removedAttributes(event);
listenerInvoked = true;
}
}
}
} finally {
lock.unlock();
}
if (listenerInvoked) {
final PushQueue pushQueue = sharedObject
.getPushQueue(ACCESS_OBJECT);
if (pushQueue != null) {
pushQueue.push();
}
}
return removed;
} }
|
public class class_name {
public boolean removeAttributes(final boolean updateClient,
final String... attributeNames) {
boolean removed = false;
boolean listenerInvoked = false;
final Lock lock = sharedObject.getLock(ACCESS_OBJECT).writeLock();
try {
lock.lock(); // depends on control dependency: [try], data = [none]
if (attributesMap == null) {
return false; // depends on control dependency: [if], data = [none]
}
for (final String attributeName : attributeNames) {
final AbstractAttribute attribute = attributesMap
.get(attributeName);
if (attribute != null) {
attribute.unsetOwnerTag(this); // depends on control dependency: [if], data = [none]
attributesMap.remove(attributeName); // depends on control dependency: [if], data = [(attribute]
removed = true; // depends on control dependency: [if], data = [none]
}
}
if (removed) {
attributes = new AbstractAttribute[attributesMap.size()]; // depends on control dependency: [if], data = [none]
attributesMap.values().toArray(attributes); // depends on control dependency: [if], data = [none]
setModified(true); // depends on control dependency: [if], data = [none]
sharedObject.setChildModified(true); // depends on control dependency: [if], data = [none]
// invokeListener
if (updateClient) {
final AttributeRemoveListener listener = sharedObject
.getAttributeRemoveListener(ACCESS_OBJECT);
if (listener != null) {
final AttributeRemoveListener.RemovedEvent event = new AttributeRemoveListener.RemovedEvent(
this, attributeNames);
listener.removedAttributes(event); // depends on control dependency: [if], data = [none]
listenerInvoked = true; // depends on control dependency: [if], data = [none]
}
}
}
} finally {
lock.unlock();
}
if (listenerInvoked) {
final PushQueue pushQueue = sharedObject
.getPushQueue(ACCESS_OBJECT);
if (pushQueue != null) {
pushQueue.push(); // depends on control dependency: [if], data = [none]
}
}
return removed;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.