code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public static LoggerWrapper getLogger(String name, ProgressManager pm) {
LoggerWrapper ret = getLogger(name);
if (ret.getProgressManager() == null
|| ret.getProgressManager() == LoggerWrapper.defaultProgressManager) {
ret.setProgressManager(pm);
}
return ret;
} } | public class class_name {
public static LoggerWrapper getLogger(String name, ProgressManager pm) {
LoggerWrapper ret = getLogger(name);
if (ret.getProgressManager() == null
|| ret.getProgressManager() == LoggerWrapper.defaultProgressManager) {
ret.setProgressManager(pm); // depends on control dependency: [if], data = [none]
}
return ret;
} } |
public class class_name {
private String genTypeRef(StructureDefinition sd, ElementDefinition ed, String id, ElementDefinition.TypeRefComponent typ) {
if(typ.hasProfile()) {
if(typ.getCode().equals("Reference"))
return genReference("", typ);
else if(ProfileUtilities.getChildList(sd, ed).size() > 0) {
// inline anonymous type - give it a name and factor it out
innerTypes.add(new ImmutablePair<StructureDefinition, ElementDefinition>(sd, ed));
return simpleElement(sd, ed, id);
}
else {
String ref = getTypeName(typ);
datatypes.add(ref);
return simpleElement(sd, ed, ref);
}
} else if (typ.getCodeElement().getExtensionsByUrl(ToolingExtensions.EXT_RDF_TYPE).size() > 0) {
String xt = null;
try {
xt = typ.getCodeElement().getExtensionString(ToolingExtensions.EXT_RDF_TYPE);
} catch (FHIRException e) {
e.printStackTrace();
}
// TODO: Remove the next line when the type of token gets switched to string
// TODO: Add a rdf-type entry for valueInteger to xsd:integer (instead of int)
ST td_entry = tmplt(PRIMITIVE_ELEMENT_DEFN_TEMPLATE).add("typ",
xt.replace("xsd:token", "xsd:string").replace("xsd:int", "xsd:integer"));
StringBuilder facets = new StringBuilder();
if(ed.hasMinValue()) {
Type mv = ed.getMinValue();
facets.append(tmplt(MINVALUE_TEMPLATE).add("val", mv.primitiveValue()).render());
}
if(ed.hasMaxValue()) {
Type mv = ed.getMaxValue();
facets.append(tmplt(MAXVALUE_TEMPLATE).add("val", mv.primitiveValue()).render());
}
if(ed.hasMaxLength()) {
int ml = ed.getMaxLength();
facets.append(tmplt(MAXLENGTH_TEMPLATE).add("val", ml).render());
}
if(ed.hasPattern()) {
Type pat = ed.getPattern();
facets.append(tmplt(PATTERN_TEMPLATE).add("val",pat.primitiveValue()).render());
}
td_entry.add("facets", facets.toString());
return td_entry.render();
} else if (typ.getCode() == null) {
ST primitive_entry = tmplt(PRIMITIVE_ELEMENT_DEFN_TEMPLATE);
primitive_entry.add("typ", "xsd:string");
return primitive_entry.render();
} else if(typ.getCode().equals("xhtml")) {
return tmplt(XHTML_TYPE_TEMPLATE).render();
} else {
datatypes.add(typ.getCode());
return simpleElement(sd, ed, typ.getCode());
}
} } | public class class_name {
private String genTypeRef(StructureDefinition sd, ElementDefinition ed, String id, ElementDefinition.TypeRefComponent typ) {
if(typ.hasProfile()) {
if(typ.getCode().equals("Reference"))
return genReference("", typ);
else if(ProfileUtilities.getChildList(sd, ed).size() > 0) {
// inline anonymous type - give it a name and factor it out
innerTypes.add(new ImmutablePair<StructureDefinition, ElementDefinition>(sd, ed));
// depends on control dependency: [if], data = [none]
return simpleElement(sd, ed, id);
// depends on control dependency: [if], data = [none]
}
else {
String ref = getTypeName(typ);
datatypes.add(ref);
// depends on control dependency: [if], data = [none]
return simpleElement(sd, ed, ref);
// depends on control dependency: [if], data = [none]
}
} else if (typ.getCodeElement().getExtensionsByUrl(ToolingExtensions.EXT_RDF_TYPE).size() > 0) {
String xt = null;
try {
xt = typ.getCodeElement().getExtensionString(ToolingExtensions.EXT_RDF_TYPE);
// depends on control dependency: [try], data = [none]
} catch (FHIRException e) {
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
// TODO: Remove the next line when the type of token gets switched to string
// TODO: Add a rdf-type entry for valueInteger to xsd:integer (instead of int)
ST td_entry = tmplt(PRIMITIVE_ELEMENT_DEFN_TEMPLATE).add("typ",
xt.replace("xsd:token", "xsd:string").replace("xsd:int", "xsd:integer"));
StringBuilder facets = new StringBuilder();
if(ed.hasMinValue()) {
Type mv = ed.getMinValue();
facets.append(tmplt(MINVALUE_TEMPLATE).add("val", mv.primitiveValue()).render());
// depends on control dependency: [if], data = [none]
}
if(ed.hasMaxValue()) {
Type mv = ed.getMaxValue();
facets.append(tmplt(MAXVALUE_TEMPLATE).add("val", mv.primitiveValue()).render());
// depends on control dependency: [if], data = [none]
}
if(ed.hasMaxLength()) {
int ml = ed.getMaxLength();
facets.append(tmplt(MAXLENGTH_TEMPLATE).add("val", ml).render());
// depends on control dependency: [if], data = [none]
}
if(ed.hasPattern()) {
Type pat = ed.getPattern();
facets.append(tmplt(PATTERN_TEMPLATE).add("val",pat.primitiveValue()).render());
// depends on control dependency: [if], data = [none]
}
td_entry.add("facets", facets.toString());
// depends on control dependency: [if], data = [none]
return td_entry.render();
// depends on control dependency: [if], data = [none]
} else if (typ.getCode() == null) {
ST primitive_entry = tmplt(PRIMITIVE_ELEMENT_DEFN_TEMPLATE);
primitive_entry.add("typ", "xsd:string");
// depends on control dependency: [if], data = [none]
return primitive_entry.render();
// depends on control dependency: [if], data = [none]
} else if(typ.getCode().equals("xhtml")) {
return tmplt(XHTML_TYPE_TEMPLATE).render();
// depends on control dependency: [if], data = [none]
} else {
datatypes.add(typ.getCode());
// depends on control dependency: [if], data = [none]
return simpleElement(sd, ed, typ.getCode());
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void prepare() throws HibiscusException {
HttpEntityEnclosingRequestBase request = (HttpEntityEnclosingRequestBase) this.httpRequest;
try {
request.setURI(getURI());
for (BasicNameValuePair header : httpClient.getRequestHeaders()) {
request.addHeader(header.getName(), header.getValue());
}
} catch (URISyntaxException e1) {
throw new HibiscusException(e1);
}
final String requestBody = httpClient.getRequestBody();
final int contentLength = (null != requestBody) ? requestBody.length() : 0;
if (contentLength > 0) {
try {
request.setEntity(new StringEntity(requestBody, httpClient.getEncoding()));
} catch (UnsupportedEncodingException e2) {
throw new HibiscusException("The encoding " + httpClient.getEncoding() + " is not supported", e2);
}
}
} } | public class class_name {
@Override
public void prepare() throws HibiscusException {
HttpEntityEnclosingRequestBase request = (HttpEntityEnclosingRequestBase) this.httpRequest;
try {
request.setURI(getURI());
for (BasicNameValuePair header : httpClient.getRequestHeaders()) {
request.addHeader(header.getName(), header.getValue()); // depends on control dependency: [for], data = [header]
}
} catch (URISyntaxException e1) {
throw new HibiscusException(e1);
}
final String requestBody = httpClient.getRequestBody();
final int contentLength = (null != requestBody) ? requestBody.length() : 0;
if (contentLength > 0) {
try {
request.setEntity(new StringEntity(requestBody, httpClient.getEncoding())); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e2) {
throw new HibiscusException("The encoding " + httpClient.getEncoding() + " is not supported", e2);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static String join(Collection<String> s, String delimiter, boolean doQuote) {
StringBuffer buffer = new StringBuffer();
Iterator<String> iter = s.iterator();
while (iter.hasNext()) {
if (doQuote) {
buffer.append("\"" + iter.next() + "\"");
} else {
buffer.append(iter.next());
}
if (iter.hasNext()) {
buffer.append(delimiter);
}
}
return buffer.toString();
} } | public class class_name {
public static String join(Collection<String> s, String delimiter, boolean doQuote) {
StringBuffer buffer = new StringBuffer();
Iterator<String> iter = s.iterator();
while (iter.hasNext()) {
if (doQuote) {
buffer.append("\"" + iter.next() + "\"");
// depends on control dependency: [if], data = [none]
} else {
buffer.append(iter.next());
// depends on control dependency: [if], data = [none]
}
if (iter.hasNext()) {
buffer.append(delimiter);
// depends on control dependency: [if], data = [none]
}
}
return buffer.toString();
} } |
public class class_name {
public final void info(Object message) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_INFO)) {
log(SimpleLog.LOG_LEVEL_INFO, message, null);
}
} } | public class class_name {
public final void info(Object message) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_INFO)) {
log(SimpleLog.LOG_LEVEL_INFO, message, null); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ActivitiStateHandlerRegistration findRegistrationForProcessAndState(String processName, String stateName) {
ActivitiStateHandlerRegistration r = null;
String key = registrationKey(processName, stateName);
Collection<ActivitiStateHandlerRegistration> rs = this.findRegistrationsForProcessAndState(
processName, stateName);
for (ActivitiStateHandlerRegistration sr : rs) {
String kName = registrationKey(sr.getProcessName(), sr.getStateName());
if (key.equalsIgnoreCase(kName)) {
r = sr;
break;
}
}
for (ActivitiStateHandlerRegistration sr : rs) {
String kName = registrationKey(null, sr.getStateName());
if (key.equalsIgnoreCase(kName)) {
r = sr;
break;
}
}
if ((r == null) && (rs.size() > 0)) {
r = rs.iterator().next();
}
return r;
} } | public class class_name {
public ActivitiStateHandlerRegistration findRegistrationForProcessAndState(String processName, String stateName) {
ActivitiStateHandlerRegistration r = null;
String key = registrationKey(processName, stateName);
Collection<ActivitiStateHandlerRegistration> rs = this.findRegistrationsForProcessAndState(
processName, stateName);
for (ActivitiStateHandlerRegistration sr : rs) {
String kName = registrationKey(sr.getProcessName(), sr.getStateName());
if (key.equalsIgnoreCase(kName)) {
r = sr; // depends on control dependency: [if], data = [none]
break;
}
}
for (ActivitiStateHandlerRegistration sr : rs) {
String kName = registrationKey(null, sr.getStateName());
if (key.equalsIgnoreCase(kName)) {
r = sr; // depends on control dependency: [if], data = [none]
break;
}
}
if ((r == null) && (rs.size() > 0)) {
r = rs.iterator().next(); // depends on control dependency: [if], data = [none]
}
return r;
} } |
public class class_name {
static ReversePurgeLongHashMap deserializeFromStringArray(final String[] tokens) {
final int ignore = STR_PREAMBLE_TOKENS;
final int numActive = Integer.parseInt(tokens[ignore]);
final int length = Integer.parseInt(tokens[ignore + 1]);
final ReversePurgeLongHashMap hashMap = new ReversePurgeLongHashMap(length);
int j = 2 + ignore;
for (int i = 0; i < numActive; i++) {
final long key = Long.parseLong(tokens[j++]);
final long value = Long.parseLong(tokens[j++]);
hashMap.adjustOrPutValue(key, value);
}
return hashMap;
} } | public class class_name {
static ReversePurgeLongHashMap deserializeFromStringArray(final String[] tokens) {
final int ignore = STR_PREAMBLE_TOKENS;
final int numActive = Integer.parseInt(tokens[ignore]);
final int length = Integer.parseInt(tokens[ignore + 1]);
final ReversePurgeLongHashMap hashMap = new ReversePurgeLongHashMap(length);
int j = 2 + ignore;
for (int i = 0; i < numActive; i++) {
final long key = Long.parseLong(tokens[j++]);
final long value = Long.parseLong(tokens[j++]);
hashMap.adjustOrPutValue(key, value); // depends on control dependency: [for], data = [none]
}
return hashMap;
} } |
public class class_name {
public static String toJSONString(Collection collection){
final StringWriter writer = new StringWriter();
try {
writeJSONString(collection, writer);
return writer.toString();
} catch(IOException e){
// This should never happen for a StringWriter
throw new RuntimeException(e);
}
} } | public class class_name {
public static String toJSONString(Collection collection){
final StringWriter writer = new StringWriter();
try {
writeJSONString(collection, writer); // depends on control dependency: [try], data = [none]
return writer.toString(); // depends on control dependency: [try], data = [none]
} catch(IOException e){
// This should never happen for a StringWriter
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void addReadPacketToTable(final SimpleDateFormat dateFormatter, final TopLevelStreamElement packet) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
String messageType;
Jid from;
String stanzaId;
if (packet instanceof Stanza) {
Stanza stanza = (Stanza) packet;
from = stanza.getFrom();
stanzaId = stanza.getStanzaId();
} else {
from = null;
stanzaId = "(Nonza)";
}
String type = "";
Icon packetTypeIcon;
receivedPackets++;
if (packet instanceof IQ) {
packetTypeIcon = iqPacketIcon;
messageType = "IQ Received (class=" + packet.getClass().getName() + ")";
type = ((IQ) packet).getType().toString();
receivedIQPackets++;
}
else if (packet instanceof Message) {
packetTypeIcon = messagePacketIcon;
messageType = "Message Received";
type = ((Message) packet).getType().toString();
receivedMessagePackets++;
}
else if (packet instanceof Presence) {
packetTypeIcon = presencePacketIcon;
messageType = "Presence Received";
type = ((Presence) packet).getType().toString();
receivedPresencePackets++;
}
else {
packetTypeIcon = unknownPacketTypeIcon;
messageType = packet.getClass().getName() + " Received";
receivedOtherPackets++;
}
// Check if we need to remove old rows from the table to keep memory consumption low
if (EnhancedDebuggerWindow.MAX_TABLE_ROWS > 0 &&
messagesTable.getRowCount() >= EnhancedDebuggerWindow.MAX_TABLE_ROWS) {
messagesTable.removeRow(0);
}
messagesTable.addRow(
new Object[] {
XmlUtil.prettyFormatXml(packet.toXML().toString()),
dateFormatter.format(new Date()),
packetReceivedIcon,
packetTypeIcon,
messageType,
stanzaId,
type,
"",
from});
// Update the statistics table
updateStatistics();
}
});
} } | public class class_name {
private void addReadPacketToTable(final SimpleDateFormat dateFormatter, final TopLevelStreamElement packet) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
String messageType;
Jid from;
String stanzaId;
if (packet instanceof Stanza) {
Stanza stanza = (Stanza) packet;
from = stanza.getFrom(); // depends on control dependency: [if], data = [none]
stanzaId = stanza.getStanzaId(); // depends on control dependency: [if], data = [none]
} else {
from = null; // depends on control dependency: [if], data = [none]
stanzaId = "(Nonza)";
}
String type = ""; // depends on control dependency: [if], data = [none]
Icon packetTypeIcon;
receivedPackets++; // depends on control dependency: [if], data = [none]
if (packet instanceof IQ) {
packetTypeIcon = iqPacketIcon; // depends on control dependency: [if], data = [none]
messageType = "IQ Received (class=" + packet.getClass().getName() + ")";
type = ((IQ) packet).getType().toString(); // depends on control dependency: [if], data = [none]
receivedIQPackets++; // depends on control dependency: [if], data = [none]
}
else if (packet instanceof Message) {
packetTypeIcon = messagePacketIcon; // depends on control dependency: [if], data = [none]
messageType = "Message Received"; // depends on control dependency: [if], data = [none]
type = ((Message) packet).getType().toString(); // depends on control dependency: [if], data = [none]
receivedMessagePackets++; // depends on control dependency: [if], data = [none]
}
else if (packet instanceof Presence) {
packetTypeIcon = presencePacketIcon; // depends on control dependency: [if], data = [none]
messageType = "Presence Received"; // depends on control dependency: [if], data = [none]
type = ((Presence) packet).getType().toString(); // depends on control dependency: [if], data = [none]
receivedPresencePackets++; // depends on control dependency: [if], data = [none]
}
else {
packetTypeIcon = unknownPacketTypeIcon; // depends on control dependency: [if], data = [none]
messageType = packet.getClass().getName() + " Received"; // depends on control dependency: [if], data = [none]
receivedOtherPackets++; // depends on control dependency: [if], data = [none]
}
// Check if we need to remove old rows from the table to keep memory consumption low
if (EnhancedDebuggerWindow.MAX_TABLE_ROWS > 0 &&
messagesTable.getRowCount() >= EnhancedDebuggerWindow.MAX_TABLE_ROWS) {
messagesTable.removeRow(0); // depends on control dependency: [if], data = [none]
}
messagesTable.addRow(
new Object[] {
XmlUtil.prettyFormatXml(packet.toXML().toString()),
dateFormatter.format(new Date()),
packetReceivedIcon,
packetTypeIcon,
messageType,
stanzaId,
type,
"",
from}); // depends on control dependency: [if], data = [none]
// Update the statistics table
updateStatistics(); // depends on control dependency: [if], data = [none]
}
});
} } |
public class class_name {
protected Object convertValueToRequiredType(Object value, Class requiredType) {
if (String.class.equals(this.requiredType)) {
return value.toString();
} else if (Number.class.isAssignableFrom(this.requiredType)) {
if (value instanceof Number) {
// Convert original Number to target Number class.
return NumberUtils.convertNumberToTargetClass(((Number) value), this.requiredType);
} else {
// Convert stringified value to target Number class.
return NumberUtils.parseNumber(value.toString(), this.requiredType);
}
} else {
throw new IllegalArgumentException(
"Value [" + value + "] is of type [" + value.getClass().getName() +
"] and cannot be converted to required type [" + this.requiredType.getName() + "]");
}
} } | public class class_name {
protected Object convertValueToRequiredType(Object value, Class requiredType) {
if (String.class.equals(this.requiredType)) {
return value.toString(); // depends on control dependency: [if], data = [none]
} else if (Number.class.isAssignableFrom(this.requiredType)) {
if (value instanceof Number) {
// Convert original Number to target Number class.
return NumberUtils.convertNumberToTargetClass(((Number) value), this.requiredType); // depends on control dependency: [if], data = [none]
} else {
// Convert stringified value to target Number class.
return NumberUtils.parseNumber(value.toString(), this.requiredType); // depends on control dependency: [if], data = [none]
}
} else {
throw new IllegalArgumentException(
"Value [" + value + "] is of type [" + value.getClass().getName() +
"] and cannot be converted to required type [" + this.requiredType.getName() + "]");
}
} } |
public class class_name {
public boolean ensureBytes(int n) throws IOException {
int required = n - endIndex + index;
while (required > 0) {
if (!readMore(required)) {
return false;
}
required = n - endIndex + index;
}
return true;
} } | public class class_name {
public boolean ensureBytes(int n) throws IOException {
int required = n - endIndex + index;
while (required > 0) {
if (!readMore(required)) {
return false; // depends on control dependency: [if], data = [none]
}
required = n - endIndex + index;
}
return true;
} } |
public class class_name {
public void notReady()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "notReady");
//get the ready consumer list lock
synchronized (consumerDispatcher.getDestination().getReadyConsumerPointLock())
{
if(ready)
{
ready = false;
consumerDispatcher.removeReadyConsumer(this, specificReady);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "notReady");
} } | public class class_name {
public void notReady()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "notReady");
//get the ready consumer list lock
synchronized (consumerDispatcher.getDestination().getReadyConsumerPointLock())
{
if(ready)
{
ready = false; // depends on control dependency: [if], data = [none]
consumerDispatcher.removeReadyConsumer(this, specificReady); // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "notReady");
} } |
public class class_name {
protected static String orRegex(Iterable<String> elements) {
final StringBuilder regex = new StringBuilder();
for (final String element : elements) {
if (regex.length() > 0) {
regex.append("|"); //$NON-NLS-1$
}
regex.append("(?:"); //$NON-NLS-1$
regex.append(quoteRegex(element));
regex.append(")"); //$NON-NLS-1$
}
return regex.toString();
} } | public class class_name {
protected static String orRegex(Iterable<String> elements) {
final StringBuilder regex = new StringBuilder();
for (final String element : elements) {
if (regex.length() > 0) {
regex.append("|"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
regex.append("(?:"); //$NON-NLS-1$ // depends on control dependency: [for], data = [none]
regex.append(quoteRegex(element)); // depends on control dependency: [for], data = [element]
regex.append(")"); //$NON-NLS-1$ // depends on control dependency: [for], data = [none]
}
return regex.toString();
} } |
public class class_name {
public void marshall(ErrorDetail errorDetail, ProtocolMarshaller protocolMarshaller) {
if (errorDetail == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(errorDetail.getErrorCode(), ERRORCODE_BINDING);
protocolMarshaller.marshall(errorDetail.getErrorMessage(), ERRORMESSAGE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ErrorDetail errorDetail, ProtocolMarshaller protocolMarshaller) {
if (errorDetail == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(errorDetail.getErrorCode(), ERRORCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(errorDetail.getErrorMessage(), ERRORMESSAGE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public StaticFactor addStaticNormalizedFactor(int[] neighborIndices, int[] neighborDimensions, Function<int[], Double> assignmentFeaturizer) {
NDArrayDoubles doubleArray = new NDArrayDoubles(neighborDimensions);
double localPartitionFunction = 0.0;
for (int[] assignment : doubleArray) {
localPartitionFunction += Math.exp(assignmentFeaturizer.apply(assignment));
}
for (int[] assignment : doubleArray) {
doubleArray.setAssignmentValue(assignment, assignmentFeaturizer.apply(assignment) - Math.log(localPartitionFunction));
}
return addStaticFactor(doubleArray, neighborIndices);
} } | public class class_name {
public StaticFactor addStaticNormalizedFactor(int[] neighborIndices, int[] neighborDimensions, Function<int[], Double> assignmentFeaturizer) {
NDArrayDoubles doubleArray = new NDArrayDoubles(neighborDimensions);
double localPartitionFunction = 0.0;
for (int[] assignment : doubleArray) {
localPartitionFunction += Math.exp(assignmentFeaturizer.apply(assignment)); // depends on control dependency: [for], data = [assignment]
}
for (int[] assignment : doubleArray) {
doubleArray.setAssignmentValue(assignment, assignmentFeaturizer.apply(assignment) - Math.log(localPartitionFunction)); // depends on control dependency: [for], data = [assignment]
}
return addStaticFactor(doubleArray, neighborIndices);
} } |
public class class_name {
protected void onGetImageError(String cacheKey, JusError error) {
// Notify the requesters that something failed via a null result.
// Remove this request from the list of in-flight requests.
BatchedImageRequest request = inFlightRequests.remove(cacheKey);
if (request != null) {
// Set the error for this request
request.setError(error);
// Send the batched response
batchResponse(cacheKey, request);
}
} } | public class class_name {
protected void onGetImageError(String cacheKey, JusError error) {
// Notify the requesters that something failed via a null result.
// Remove this request from the list of in-flight requests.
BatchedImageRequest request = inFlightRequests.remove(cacheKey);
if (request != null) {
// Set the error for this request
request.setError(error); // depends on control dependency: [if], data = [none]
// Send the batched response
batchResponse(cacheKey, request); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void addProjectPath(final Path path) {
addToClassPool(path);
if (path.toFile().isFile() && path.toString().endsWith(".jar")) {
addJarClasses(path);
} else if (path.toFile().isDirectory()) {
addDirectoryClasses(path, Paths.get(""));
} else {
throw new IllegalArgumentException("The project path '" + path + "' must be a jar file or a directory");
}
} } | public class class_name {
private void addProjectPath(final Path path) {
addToClassPool(path);
if (path.toFile().isFile() && path.toString().endsWith(".jar")) {
addJarClasses(path); // depends on control dependency: [if], data = [none]
} else if (path.toFile().isDirectory()) {
addDirectoryClasses(path, Paths.get("")); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("The project path '" + path + "' must be a jar file or a directory");
}
} } |
public class class_name {
public boolean remove(String key) {
if (pageSources.remove(key.toLowerCase()) != null) return true;
Set<String> set = pageSources.keySet();
String[] keys = set.toArray(new String[set.size()]); // done this way to avoid ConcurrentModificationException
PageSource ps;
for (String k: keys) {
ps = pageSources.get(k);
if (key.equalsIgnoreCase(ps.getClassName())) {
pageSources.remove(k);
return true;
}
}
return false;
} } | public class class_name {
public boolean remove(String key) {
if (pageSources.remove(key.toLowerCase()) != null) return true;
Set<String> set = pageSources.keySet();
String[] keys = set.toArray(new String[set.size()]); // done this way to avoid ConcurrentModificationException
PageSource ps;
for (String k: keys) {
ps = pageSources.get(k); // depends on control dependency: [for], data = [k]
if (key.equalsIgnoreCase(ps.getClassName())) {
pageSources.remove(k); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public void loadTableLocal(byte []tableKey, Result<TableKraken> result)
{
if (tableKey == null) {
result.ok(null);
return;
}
TableKraken table = _tableManager.getTable(tableKey);
if (table != null) {
result.ok(table);
return;
}
RowCursor cursor = _metaTable.cursor();
cursor.setBytes(1, tableKey, 0);
// XXX: direct
if (_metaTable.getDirect(cursor)) {
String name = cursor.getString(2);
String sql = cursor.getString(3);
if (sql == null || sql.equals("")) {
throw new IllegalStateException(L.l("Broken table: '{0}'\n sql: {1} {2}",
name, sql,
AmpSystem.currentManager()));
}
QueryKraken query = QueryParserKraken.parse(_tableManager, sql).build();
// ServiceFuture<Object> future = new ServiceFuture<>();
query.exec((Result) result);
//future.get(1, TimeUnit.SECONDS);
}
else {
KrakenException exn = new KrakenException(L.l("Failed to load table {0}",
Hex.toShortHex(tableKey)));
exn.fillInStackTrace();
result.fail(exn);
}
} } | public class class_name {
public void loadTableLocal(byte []tableKey, Result<TableKraken> result)
{
if (tableKey == null) {
result.ok(null); // depends on control dependency: [if], data = [null)]
return; // depends on control dependency: [if], data = [none]
}
TableKraken table = _tableManager.getTable(tableKey);
if (table != null) {
result.ok(table); // depends on control dependency: [if], data = [(table]
return; // depends on control dependency: [if], data = [none]
}
RowCursor cursor = _metaTable.cursor();
cursor.setBytes(1, tableKey, 0);
// XXX: direct
if (_metaTable.getDirect(cursor)) {
String name = cursor.getString(2);
String sql = cursor.getString(3);
if (sql == null || sql.equals("")) {
throw new IllegalStateException(L.l("Broken table: '{0}'\n sql: {1} {2}",
name, sql,
AmpSystem.currentManager()));
}
QueryKraken query = QueryParserKraken.parse(_tableManager, sql).build();
// ServiceFuture<Object> future = new ServiceFuture<>();
query.exec((Result) result); // depends on control dependency: [if], data = [none]
//future.get(1, TimeUnit.SECONDS);
}
else {
KrakenException exn = new KrakenException(L.l("Failed to load table {0}",
Hex.toShortHex(tableKey)));
exn.fillInStackTrace(); // depends on control dependency: [if], data = [none]
result.fail(exn); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static List<SettingsResult> getSettingsResults(Result r) {
if(r instanceof SettingsResult) {
List<SettingsResult> ors = new ArrayList<>(1);
ors.add((SettingsResult) r);
return ors;
}
if(r instanceof HierarchicalResult) {
return ResultUtil.filterResults(((HierarchicalResult) r).getHierarchy(), r, SettingsResult.class);
}
return Collections.emptyList();
} } | public class class_name {
public static List<SettingsResult> getSettingsResults(Result r) {
if(r instanceof SettingsResult) {
List<SettingsResult> ors = new ArrayList<>(1);
ors.add((SettingsResult) r); // depends on control dependency: [if], data = [none]
return ors; // depends on control dependency: [if], data = [none]
}
if(r instanceof HierarchicalResult) {
return ResultUtil.filterResults(((HierarchicalResult) r).getHierarchy(), r, SettingsResult.class); // depends on control dependency: [if], data = [none]
}
return Collections.emptyList();
} } |
public class class_name {
public boolean set(State state) {
while (true) {
InternalState internalState = currentInternalState.get();
checkState(!internalState.isRead, "State was already read, cannot set state.");
if (state == internalState.state) {
return false;
} else {
if (!currentInternalState.compareAndSet(
internalState,
state == State.ENABLED
? InternalState.ENABLED_NOT_READ
: InternalState.DISABLED_NOT_READ)) {
// The state was changed between the moment the internalState was read and this point.
// Some conditions may be not correct, reset at the beginning and recheck all conditions.
continue;
}
return true;
}
}
} } | public class class_name {
public boolean set(State state) {
while (true) {
InternalState internalState = currentInternalState.get();
checkState(!internalState.isRead, "State was already read, cannot set state."); // depends on control dependency: [while], data = [none]
if (state == internalState.state) {
return false; // depends on control dependency: [if], data = [none]
} else {
if (!currentInternalState.compareAndSet(
internalState,
state == State.ENABLED
? InternalState.ENABLED_NOT_READ
: InternalState.DISABLED_NOT_READ)) {
// The state was changed between the moment the internalState was read and this point.
// Some conditions may be not correct, reset at the beginning and recheck all conditions.
continue;
}
return true; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void writeNewClassDesc(ObjectStreamClass classDesc)
throws IOException {
output.writeUTF(classDesc.getName());
output.writeLong(classDesc.getSerialVersionUID());
byte flags = classDesc.getFlags();
boolean externalizable = classDesc.isExternalizable();
if (externalizable) {
if (protocolVersion == PROTOCOL_VERSION_1) {
flags &= NOT_SC_BLOCK_DATA;
} else {
// Change for 1.2. Objects can be saved in old format
// (PROTOCOL_VERSION_1) or in the 1.2 format (PROTOCOL_VERSION_2).
flags |= SC_BLOCK_DATA;
}
}
output.writeByte(flags);
if ((SC_ENUM | SC_SERIALIZABLE) != classDesc.getFlags()) {
writeFieldDescriptors(classDesc, externalizable);
} else {
// enum write no fields
output.writeShort(0);
}
} } | public class class_name {
private void writeNewClassDesc(ObjectStreamClass classDesc)
throws IOException {
output.writeUTF(classDesc.getName());
output.writeLong(classDesc.getSerialVersionUID());
byte flags = classDesc.getFlags();
boolean externalizable = classDesc.isExternalizable();
if (externalizable) {
if (protocolVersion == PROTOCOL_VERSION_1) {
flags &= NOT_SC_BLOCK_DATA; // depends on control dependency: [if], data = [none]
} else {
// Change for 1.2. Objects can be saved in old format
// (PROTOCOL_VERSION_1) or in the 1.2 format (PROTOCOL_VERSION_2).
flags |= SC_BLOCK_DATA; // depends on control dependency: [if], data = [none]
}
}
output.writeByte(flags);
if ((SC_ENUM | SC_SERIALIZABLE) != classDesc.getFlags()) {
writeFieldDescriptors(classDesc, externalizable);
} else {
// enum write no fields
output.writeShort(0);
}
} } |
public class class_name {
public Request param(String name, Object value) {
if (params == null) {
params = new LinkedHashMap<String, Object>();
}
if (multipleValues) {
Object currentValue = params.get(name);
if (currentValue != null) {
if (currentValue instanceof Collection) {
Collection<Object> values = (Collection) currentValue;
values.add(value);
} else {
// upgrade single value to set of values
Collection<Object> values = new ArrayList<Object>();
values.add(currentValue);
values.add(value);
params.put(name, values);
}
return this;
}
}
params.put(name, value);
return this;
} } | public class class_name {
public Request param(String name, Object value) {
if (params == null) {
params = new LinkedHashMap<String, Object>(); // depends on control dependency: [if], data = [none]
}
if (multipleValues) {
Object currentValue = params.get(name);
if (currentValue != null) {
if (currentValue instanceof Collection) {
Collection<Object> values = (Collection) currentValue;
values.add(value); // depends on control dependency: [if], data = [none]
} else {
// upgrade single value to set of values
Collection<Object> values = new ArrayList<Object>();
values.add(currentValue); // depends on control dependency: [if], data = [none]
values.add(value); // depends on control dependency: [if], data = [none]
params.put(name, values); // depends on control dependency: [if], data = [none]
}
return this; // depends on control dependency: [if], data = [none]
}
}
params.put(name, value);
return this;
} } |
public class class_name {
private String getParameterJSDocName(Node paramNode, int paramIndex) {
Node nameNode = null;
if (paramNode != null) {
checkArgument(paramNode.getParent().isParamList(), paramNode);
if (paramNode.isRest()) {
// use `restParam` of `...restParam`
// restParam might still be a destructuring pattern
paramNode = paramNode.getOnlyChild();
} else if (paramNode.isDefaultValue()) {
// use `defaultParam` of `defaultParam = something`
// defaultParam might still be a destructuring pattern
paramNode = paramNode.getFirstChild();
}
if (paramNode.isName()) {
nameNode = paramNode;
} else {
checkState(paramNode.isObjectPattern() || paramNode.isArrayPattern(), paramNode);
nameNode = null; // must generate a fake name
}
}
if (nameNode == null) {
return "p" + paramIndex;
} else {
checkState(nameNode.isName(), nameNode);
return nameNode.getString();
}
} } | public class class_name {
private String getParameterJSDocName(Node paramNode, int paramIndex) {
Node nameNode = null;
if (paramNode != null) {
checkArgument(paramNode.getParent().isParamList(), paramNode); // depends on control dependency: [if], data = [(paramNode]
if (paramNode.isRest()) {
// use `restParam` of `...restParam`
// restParam might still be a destructuring pattern
paramNode = paramNode.getOnlyChild(); // depends on control dependency: [if], data = [none]
} else if (paramNode.isDefaultValue()) {
// use `defaultParam` of `defaultParam = something`
// defaultParam might still be a destructuring pattern
paramNode = paramNode.getFirstChild(); // depends on control dependency: [if], data = [none]
}
if (paramNode.isName()) {
nameNode = paramNode; // depends on control dependency: [if], data = [none]
} else {
checkState(paramNode.isObjectPattern() || paramNode.isArrayPattern(), paramNode); // depends on control dependency: [if], data = [none]
nameNode = null; // must generate a fake name // depends on control dependency: [if], data = [none]
}
}
if (nameNode == null) {
return "p" + paramIndex; // depends on control dependency: [if], data = [none]
} else {
checkState(nameNode.isName(), nameNode); // depends on control dependency: [if], data = [(nameNode]
return nameNode.getString(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Integer getSelectedLastColumn() {
final Object result = getStateHelper().eval(PropertyKeys.selectedLastColumn);
if (result == null) {
return null;
}
return Integer.valueOf(result.toString());
} } | public class class_name {
public Integer getSelectedLastColumn() {
final Object result = getStateHelper().eval(PropertyKeys.selectedLastColumn);
if (result == null) {
return null; // depends on control dependency: [if], data = [none]
}
return Integer.valueOf(result.toString());
} } |
public class class_name {
@Override
public int size() {
int count = 0;
for (Map<N, Map<K, S>> namespaceMap : state) {
if (null != namespaceMap) {
for (Map<K, S> keyMap : namespaceMap.values()) {
if (null != keyMap) {
count += keyMap.size();
}
}
}
}
return count;
} } | public class class_name {
@Override
public int size() {
int count = 0;
for (Map<N, Map<K, S>> namespaceMap : state) {
if (null != namespaceMap) {
for (Map<K, S> keyMap : namespaceMap.values()) {
if (null != keyMap) {
count += keyMap.size(); // depends on control dependency: [if], data = [none]
}
}
}
}
return count;
} } |
public class class_name {
void cell(Cell cell) {
int left = cell.getLeft();
int right = cell.getRight();
// first see if we've got a cell past the last col
if (right > realColumnCount) {
// are we past last col entirely?
if (left == realColumnCount) {
// single col?
if (left + 1 != right) {
appendColumnRange(new ColumnRange(cell.elementName(), cell, left + 1, right));
}
realColumnCount = right;
return;
} else {
// not past entirely
appendColumnRange(new ColumnRange(cell.elementName(), cell, realColumnCount, right));
realColumnCount = right;
}
}
while (currentColRange != null) {
int hit = currentColRange.hits(left);
if (hit == 0) {
ColumnRange newRange = currentColRange.removeColumn(left);
if (newRange == null) {
// zap a list item
if (previousColRange != null) {
previousColRange.setNext(currentColRange.getNext());
}
if (first == currentColRange) {
first = currentColRange.getNext();
}
if (last == currentColRange) {
last = previousColRange;
}
currentColRange = currentColRange.getNext();
} else {
if (last == currentColRange) {
last = newRange;
}
currentColRange = newRange;
}
return;
} else if (hit == -1) {
return;
} else if (hit == 1) {
previousColRange = currentColRange;
currentColRange = currentColRange.getNext();
}
}
} } | public class class_name {
void cell(Cell cell) {
int left = cell.getLeft();
int right = cell.getRight();
// first see if we've got a cell past the last col
if (right > realColumnCount) {
// are we past last col entirely?
if (left == realColumnCount) {
// single col?
if (left + 1 != right) {
appendColumnRange(new ColumnRange(cell.elementName(), cell, left + 1, right)); // depends on control dependency: [if], data = [right)]
}
realColumnCount = right; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else {
// not past entirely
appendColumnRange(new ColumnRange(cell.elementName(), cell, realColumnCount, right)); // depends on control dependency: [if], data = [none]
realColumnCount = right; // depends on control dependency: [if], data = [none]
}
}
while (currentColRange != null) {
int hit = currentColRange.hits(left);
if (hit == 0) {
ColumnRange newRange = currentColRange.removeColumn(left);
if (newRange == null) {
// zap a list item
if (previousColRange != null) {
previousColRange.setNext(currentColRange.getNext()); // depends on control dependency: [if], data = [none]
}
if (first == currentColRange) {
first = currentColRange.getNext(); // depends on control dependency: [if], data = [none]
}
if (last == currentColRange) {
last = previousColRange; // depends on control dependency: [if], data = [none]
}
currentColRange = currentColRange.getNext(); // depends on control dependency: [if], data = [none]
} else {
if (last == currentColRange) {
last = newRange; // depends on control dependency: [if], data = [none]
}
currentColRange = newRange; // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
} else if (hit == -1) {
return; // depends on control dependency: [if], data = [none]
} else if (hit == 1) {
previousColRange = currentColRange; // depends on control dependency: [if], data = [none]
currentColRange = currentColRange.getNext(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public synchronized TransactionItem[] clear( List<String> deliveredMessageIDs ) throws FFMQException
{
int len = deliveredMessageIDs.size();
TransactionItem[] itemsSnapshot = new TransactionItem[len];
for(int n=0;n<len;n++)
{
String deliveredMessageID = deliveredMessageIDs.get(len-n-1);
boolean found = false;
Iterator<TransactionItem> entries = items.iterator();
while (entries.hasNext())
{
TransactionItem item = entries.next();
if (item.getMessageId().equals(deliveredMessageID))
{
found = true;
itemsSnapshot[n] = item; // Store in snapshot
entries.remove();
break;
}
}
if (!found)
throw new FFMQException("Message does not belong to transaction : "+deliveredMessageID,"INTERNAL_ERROR");
}
return itemsSnapshot;
} } | public class class_name {
public synchronized TransactionItem[] clear( List<String> deliveredMessageIDs ) throws FFMQException
{
int len = deliveredMessageIDs.size();
TransactionItem[] itemsSnapshot = new TransactionItem[len];
for(int n=0;n<len;n++)
{
String deliveredMessageID = deliveredMessageIDs.get(len-n-1);
boolean found = false;
Iterator<TransactionItem> entries = items.iterator();
while (entries.hasNext())
{
TransactionItem item = entries.next();
if (item.getMessageId().equals(deliveredMessageID))
{
found = true; // depends on control dependency: [if], data = [none]
itemsSnapshot[n] = item; // Store in snapshot // depends on control dependency: [if], data = [none]
entries.remove(); // depends on control dependency: [if], data = [none]
break;
}
}
if (!found)
throw new FFMQException("Message does not belong to transaction : "+deliveredMessageID,"INTERNAL_ERROR");
}
return itemsSnapshot;
} } |
public class class_name {
@Nullable
@SuppressWarnings("unchecked")
static JSONObject mapToJsonObject(@Nullable Map<String, ? extends Object> mapObject) {
if (mapObject == null) {
return null;
}
JSONObject jsonObject = new JSONObject();
for (String key : mapObject.keySet()) {
Object value = mapObject.get(key);
if (value == null) {
continue;
}
try {
if (value instanceof Map<?, ?>) {
try {
Map<String, Object> mapValue = (Map<String, Object>) value;
jsonObject.put(key, mapToJsonObject(mapValue));
} catch (ClassCastException classCastException) {
// We don't include the item in the JSONObject if the keys are not Strings.
}
} else if (value instanceof List<?>) {
jsonObject.put(key, listToJsonArray((List<Object>) value));
} else if (value instanceof Number || value instanceof Boolean) {
jsonObject.put(key, value);
} else {
jsonObject.put(key, value.toString());
}
} catch (JSONException jsonException) {
// Simply skip this value
}
}
return jsonObject;
} } | public class class_name {
@Nullable
@SuppressWarnings("unchecked")
static JSONObject mapToJsonObject(@Nullable Map<String, ? extends Object> mapObject) {
if (mapObject == null) {
return null; // depends on control dependency: [if], data = [none]
}
JSONObject jsonObject = new JSONObject();
for (String key : mapObject.keySet()) {
Object value = mapObject.get(key);
if (value == null) {
continue;
}
try {
if (value instanceof Map<?, ?>) {
try {
Map<String, Object> mapValue = (Map<String, Object>) value;
jsonObject.put(key, mapToJsonObject(mapValue)); // depends on control dependency: [try], data = [none]
} catch (ClassCastException classCastException) {
// We don't include the item in the JSONObject if the keys are not Strings.
} // depends on control dependency: [catch], data = [none]
} else if (value instanceof List<?>) {
jsonObject.put(key, listToJsonArray((List<Object>) value)); // depends on control dependency: [if], data = [)]
} else if (value instanceof Number || value instanceof Boolean) {
jsonObject.put(key, value); // depends on control dependency: [if], data = [none]
} else {
jsonObject.put(key, value.toString()); // depends on control dependency: [if], data = [none]
}
} catch (JSONException jsonException) {
// Simply skip this value
} // depends on control dependency: [catch], data = [none]
}
return jsonObject;
} } |
public class class_name {
@Override
public boolean onMenuItemClick(MenuItem item) {
boolean handled = false;
ShareTarget target = mShareTargets.get(item.getItemId());
// 首先响应target自带的listener
if (target.listener != null) {
handled = target.listener.onMenuItemClick(item);
}
if (handled) {
return true;
}
// 其次响应外部设置的listener
if (mOnMenuItemClickListener != null) {
handled = mOnMenuItemClickListener.onMenuItemClick(item);
}
if (handled) {
return true;
}
if (target.packageName == null || target.className == null) {
return true;
}
// 最后响应默认的intent
ComponentName chosenName = new ComponentName(
target.packageName,
target.className);
Intent intent = new Intent(mIntent);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(chosenName);
if (DEBUG) {
Log.v(TAG, "onMenuItemClick() target=" + chosenName);
}
try {
mContext.startActivity(intent);
} catch (Exception e) {
Log.e(TAG, "onMenuItemClick() error: " + e);
Toast.makeText(mContext, R.string.share_action_provider_target_not_found, Toast.LENGTH_SHORT).show();
}
return true;
} } | public class class_name {
@Override
public boolean onMenuItemClick(MenuItem item) {
boolean handled = false;
ShareTarget target = mShareTargets.get(item.getItemId());
// 首先响应target自带的listener
if (target.listener != null) {
handled = target.listener.onMenuItemClick(item); // depends on control dependency: [if], data = [none]
}
if (handled) {
return true; // depends on control dependency: [if], data = [none]
}
// 其次响应外部设置的listener
if (mOnMenuItemClickListener != null) {
handled = mOnMenuItemClickListener.onMenuItemClick(item); // depends on control dependency: [if], data = [none]
}
if (handled) {
return true; // depends on control dependency: [if], data = [none]
}
if (target.packageName == null || target.className == null) {
return true; // depends on control dependency: [if], data = [none]
}
// 最后响应默认的intent
ComponentName chosenName = new ComponentName(
target.packageName,
target.className);
Intent intent = new Intent(mIntent);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(chosenName);
if (DEBUG) {
Log.v(TAG, "onMenuItemClick() target=" + chosenName); // depends on control dependency: [if], data = [none]
}
try {
mContext.startActivity(intent); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
Log.e(TAG, "onMenuItemClick() error: " + e);
Toast.makeText(mContext, R.string.share_action_provider_target_not_found, Toast.LENGTH_SHORT).show();
} // depends on control dependency: [catch], data = [none]
return true;
} } |
public class class_name {
public static BenchmarkExecutor getExecutor(final BenchmarkElement meth) {
if (BENCHRES == null) {
throw new IllegalStateException("Call initialize method first!");
}
// check if new instance needs to be created
if (!EXECUTOR.containsKey(meth.getMeth())) {
EXECUTOR.put(meth.getMeth(), new BenchmarkExecutor(meth.getMeth()));
int runsOnAnno = BenchmarkMethod.getNumberOfAnnotatedRuns(meth.getMeth().getMethodToBench());
if (runsOnAnno < 0) {
runsOnAnno = CONFIG.getRuns();
}
RUNS.put(meth.getMeth(), runsOnAnno);
}
// returning the executor
return EXECUTOR.get(meth.getMeth());
} } | public class class_name {
public static BenchmarkExecutor getExecutor(final BenchmarkElement meth) {
if (BENCHRES == null) {
throw new IllegalStateException("Call initialize method first!");
}
// check if new instance needs to be created
if (!EXECUTOR.containsKey(meth.getMeth())) {
EXECUTOR.put(meth.getMeth(), new BenchmarkExecutor(meth.getMeth())); // depends on control dependency: [if], data = [none]
int runsOnAnno = BenchmarkMethod.getNumberOfAnnotatedRuns(meth.getMeth().getMethodToBench());
if (runsOnAnno < 0) {
runsOnAnno = CONFIG.getRuns(); // depends on control dependency: [if], data = [none]
}
RUNS.put(meth.getMeth(), runsOnAnno); // depends on control dependency: [if], data = [none]
}
// returning the executor
return EXECUTOR.get(meth.getMeth());
} } |
public class class_name {
private Object convertStringToNearestObjectType(String value) {
switch (value) {
case "true":
return true;
case "false":
return false;
default: {
if (NumberUtils.isParsable(value)) {
return Integer.parseInt(value);
}
return value;
}
}
} } | public class class_name {
private Object convertStringToNearestObjectType(String value) {
switch (value) {
case "true":
return true;
case "false":
return false;
default: {
if (NumberUtils.isParsable(value)) {
return Integer.parseInt(value); // depends on control dependency: [if], data = [none]
}
return value;
}
}
} } |
public class class_name {
private boolean shouldEmitDeprecationWarning(NodeTraversal t, PropertyReference propRef) {
// In the global scope, there are only two kinds of accesses that should
// be flagged for warnings:
// 1) Calls of deprecated functions and methods.
// 2) Instantiations of deprecated classes.
// For now, we just let everything else by.
if (t.inGlobalScope()) {
if (!NodeUtil.isInvocationTarget(propRef.getSourceNode())) {
return false;
}
}
// We can always assign to a deprecated property, to keep it up to date.
if (propRef.isMutation()) {
return false;
}
// Don't warn if the node is just declaring the property, not reading it.
JSDocInfo jsdoc = propRef.getJSDocInfo();
if (propRef.isDeclaration() && (jsdoc != null) && jsdoc.isDeprecated()) {
return false;
}
return !canAccessDeprecatedTypes(t);
} } | public class class_name {
private boolean shouldEmitDeprecationWarning(NodeTraversal t, PropertyReference propRef) {
// In the global scope, there are only two kinds of accesses that should
// be flagged for warnings:
// 1) Calls of deprecated functions and methods.
// 2) Instantiations of deprecated classes.
// For now, we just let everything else by.
if (t.inGlobalScope()) {
if (!NodeUtil.isInvocationTarget(propRef.getSourceNode())) {
return false; // depends on control dependency: [if], data = [none]
}
}
// We can always assign to a deprecated property, to keep it up to date.
if (propRef.isMutation()) {
return false; // depends on control dependency: [if], data = [none]
}
// Don't warn if the node is just declaring the property, not reading it.
JSDocInfo jsdoc = propRef.getJSDocInfo();
if (propRef.isDeclaration() && (jsdoc != null) && jsdoc.isDeprecated()) {
return false; // depends on control dependency: [if], data = [none]
}
return !canAccessDeprecatedTypes(t);
} } |
public class class_name {
public static List<String> getOrderList(Properties repoProperties) throws InstallException {
List<String> orderList = new ArrayList<String>();
List<String> repoList = new ArrayList<String>();
// Retrieves the Repository Properties file
File repoPropertiesFile = new File(getRepoPropertiesFileLocation());
if (repoPropertiesFile.exists() && repoPropertiesFile.isFile()) {
//Load repository properties
FileInputStream repoPropertiesInput = null;
BufferedReader repoPropertiesReader = null;
try {
repoPropertiesInput = new FileInputStream(repoPropertiesFile);
repoPropertiesReader = new BufferedReader(new InputStreamReader(repoPropertiesInput));
String line;
String repoName;
while ((line = repoPropertiesReader.readLine()) != null) {
String keyValue[] = line.split(EQUALS);
if (!line.startsWith(COMMENT_PREFIX) && keyValue.length > 1 && keyValue[0].endsWith(URL_SUFFIX)) {
repoName = keyValue[0].substring(0, keyValue[0].length() - URL_SUFFIX.length());
//Ignore empty repository names
if (repoName.isEmpty()) {
continue;
}
//Remove duplicate entries
if (orderList.contains(repoName)) {
repoList.remove(orderList.indexOf(repoName));
orderList.remove(repoName);
}
orderList.add(repoName);
repoList.add(line);
// if Windows, replace \ to \\
if (InstallUtils.isWindows && keyValue.length > 1 && keyValue[1].contains("\\")) {
String url = repoProperties.getProperty(keyValue[0]);
if (url != null && !InstallUtils.isURL(url)) {
repoProperties.put(keyValue[0], keyValue[1].trim());
logger.log(Level.FINEST, "The value of " + keyValue[0] + " was replaced to " + repoProperties.getProperty(keyValue[0]));
}
}
}
}
} catch (IOException e) {
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_REPOSITORY_PROPS_NOT_LOADED",
getRepoPropertiesFileLocation()), InstallException.IO_FAILURE);
} finally {
InstallUtils.close(repoPropertiesInput);
InstallUtils.close(repoPropertiesReader);
}
}
if (isWlpRepoEnabled(repoProperties)) {
orderList.add(WLP_REPO);
}
return orderList;
} } | public class class_name {
public static List<String> getOrderList(Properties repoProperties) throws InstallException {
List<String> orderList = new ArrayList<String>();
List<String> repoList = new ArrayList<String>();
// Retrieves the Repository Properties file
File repoPropertiesFile = new File(getRepoPropertiesFileLocation());
if (repoPropertiesFile.exists() && repoPropertiesFile.isFile()) {
//Load repository properties
FileInputStream repoPropertiesInput = null;
BufferedReader repoPropertiesReader = null;
try {
repoPropertiesInput = new FileInputStream(repoPropertiesFile); // depends on control dependency: [try], data = [none]
repoPropertiesReader = new BufferedReader(new InputStreamReader(repoPropertiesInput)); // depends on control dependency: [try], data = [none]
String line;
String repoName;
while ((line = repoPropertiesReader.readLine()) != null) {
String keyValue[] = line.split(EQUALS);
if (!line.startsWith(COMMENT_PREFIX) && keyValue.length > 1 && keyValue[0].endsWith(URL_SUFFIX)) {
repoName = keyValue[0].substring(0, keyValue[0].length() - URL_SUFFIX.length()); // depends on control dependency: [if], data = [none]
//Ignore empty repository names
if (repoName.isEmpty()) {
continue;
}
//Remove duplicate entries
if (orderList.contains(repoName)) {
repoList.remove(orderList.indexOf(repoName)); // depends on control dependency: [if], data = [none]
orderList.remove(repoName); // depends on control dependency: [if], data = [none]
}
orderList.add(repoName); // depends on control dependency: [if], data = [none]
repoList.add(line); // depends on control dependency: [if], data = [none]
// if Windows, replace \ to \\
if (InstallUtils.isWindows && keyValue.length > 1 && keyValue[1].contains("\\")) {
String url = repoProperties.getProperty(keyValue[0]);
if (url != null && !InstallUtils.isURL(url)) {
repoProperties.put(keyValue[0], keyValue[1].trim()); // depends on control dependency: [if], data = [none]
logger.log(Level.FINEST, "The value of " + keyValue[0] + " was replaced to " + repoProperties.getProperty(keyValue[0])); // depends on control dependency: [if], data = [none]
}
}
}
}
} catch (IOException e) {
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_REPOSITORY_PROPS_NOT_LOADED",
getRepoPropertiesFileLocation()), InstallException.IO_FAILURE);
} finally { // depends on control dependency: [catch], data = [none]
InstallUtils.close(repoPropertiesInput);
InstallUtils.close(repoPropertiesReader);
}
}
if (isWlpRepoEnabled(repoProperties)) {
orderList.add(WLP_REPO);
}
return orderList;
} } |
public class class_name {
private void addAnnotationValues(ClassReference annotatedReference, AnnotationClassReference typeRef, Annotation node)
{
Map<String, AnnotationValue> annotationValueMap = new HashMap<>();
if (node instanceof SingleMemberAnnotation)
{
SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation) node;
AnnotationValue value = getAnnotationValueForExpression(annotatedReference, singleMemberAnnotation.getValue());
annotationValueMap.put("value", value);
}
else if (node instanceof NormalAnnotation)
{
@SuppressWarnings("unchecked")
List<MemberValuePair> annotationValues = ((NormalAnnotation) node).values();
for (MemberValuePair annotationValue : annotationValues)
{
String key = annotationValue.getName().toString();
Expression expression = annotationValue.getValue();
AnnotationValue value = getAnnotationValueForExpression(annotatedReference, expression);
annotationValueMap.put(key, value);
}
}
typeRef.setAnnotationValues(annotationValueMap);
} } | public class class_name {
private void addAnnotationValues(ClassReference annotatedReference, AnnotationClassReference typeRef, Annotation node)
{
Map<String, AnnotationValue> annotationValueMap = new HashMap<>();
if (node instanceof SingleMemberAnnotation)
{
SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation) node;
AnnotationValue value = getAnnotationValueForExpression(annotatedReference, singleMemberAnnotation.getValue());
annotationValueMap.put("value", value); // depends on control dependency: [if], data = [none]
}
else if (node instanceof NormalAnnotation)
{
@SuppressWarnings("unchecked")
List<MemberValuePair> annotationValues = ((NormalAnnotation) node).values();
for (MemberValuePair annotationValue : annotationValues)
{
String key = annotationValue.getName().toString();
Expression expression = annotationValue.getValue();
AnnotationValue value = getAnnotationValueForExpression(annotatedReference, expression);
annotationValueMap.put(key, value); // depends on control dependency: [for], data = [annotationValue]
}
}
typeRef.setAnnotationValues(annotationValueMap);
} } |
public class class_name {
public IScan add(IScan scan) {
int num = scan.getNum();
IScan oldScan = getNum2scan().put(num, scan);
log.trace("Adding scan #{} to ScanIndex. num2scan map already contained a scan for scanNum: {}",
num, num);
final Double rt = scan.getRt();
final TreeMap<Double, List<IScan>> rt2scan = getRt2scan();
if (scan.getRt() != null) {
List<IScan> scans = rt2scan.get(rt);
if (scans == null) {
// no entries for this RT yet
scans = new ArrayList<>(1);
scans.add(scan);
getRt2scan().put(rt, scans);
} else {
// check if this scan was in the list
boolean replaced = false;
for (int i = 0; i < scans.size(); i++) {
IScan s = scans.get(i);
if (s.getNum() == scan.getNum()) {
scans.set(i, scan);
replaced = true;
break;
}
}
if (!replaced) {
scans.add(scan);
}
}
} else {
log.debug("Adding scan # to ScanIndex. No RT.", num);
}
return oldScan;
} } | public class class_name {
public IScan add(IScan scan) {
int num = scan.getNum();
IScan oldScan = getNum2scan().put(num, scan);
log.trace("Adding scan #{} to ScanIndex. num2scan map already contained a scan for scanNum: {}",
num, num);
final Double rt = scan.getRt();
final TreeMap<Double, List<IScan>> rt2scan = getRt2scan();
if (scan.getRt() != null) {
List<IScan> scans = rt2scan.get(rt);
if (scans == null) {
// no entries for this RT yet
scans = new ArrayList<>(1); // depends on control dependency: [if], data = [none]
scans.add(scan); // depends on control dependency: [if], data = [none]
getRt2scan().put(rt, scans); // depends on control dependency: [if], data = [none]
} else {
// check if this scan was in the list
boolean replaced = false;
for (int i = 0; i < scans.size(); i++) {
IScan s = scans.get(i);
if (s.getNum() == scan.getNum()) {
scans.set(i, scan); // depends on control dependency: [if], data = [none]
replaced = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!replaced) {
scans.add(scan); // depends on control dependency: [if], data = [none]
}
}
} else {
log.debug("Adding scan # to ScanIndex. No RT.", num); // depends on control dependency: [if], data = [none]
}
return oldScan;
} } |
public class class_name {
public void marshall(GetGroupsRequest getGroupsRequest, ProtocolMarshaller protocolMarshaller) {
if (getGroupsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getGroupsRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetGroupsRequest getGroupsRequest, ProtocolMarshaller protocolMarshaller) {
if (getGroupsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getGroupsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static final int toIndex(List<?> base, Object property) {
int index = 0;
if (property instanceof Number) {
index = ((Number) property).intValue();
} else if (property instanceof String) {
try {
index = Integer.valueOf((String) property);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Cannot parse list index: " + property);
}
} else if (property instanceof Character) {
index = ((Character) property).charValue();
} else if (property instanceof Boolean) {
index = ((Boolean) property).booleanValue() ? 1 : 0;
} else {
throw new IllegalArgumentException("Cannot coerce property to list index: " + property);
}
if (base != null && (index < 0 || index >= base.size())) {
throw new PropertyNotFoundException("List index out of bounds: " + index);
}
return index;
} } | public class class_name {
private static final int toIndex(List<?> base, Object property) {
int index = 0;
if (property instanceof Number) {
index = ((Number) property).intValue(); // depends on control dependency: [if], data = [none]
} else if (property instanceof String) {
try {
index = Integer.valueOf((String) property); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Cannot parse list index: " + property);
} // depends on control dependency: [catch], data = [none]
} else if (property instanceof Character) {
index = ((Character) property).charValue(); // depends on control dependency: [if], data = [none]
} else if (property instanceof Boolean) {
index = ((Boolean) property).booleanValue() ? 1 : 0; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Cannot coerce property to list index: " + property);
}
if (base != null && (index < 0 || index >= base.size())) {
throw new PropertyNotFoundException("List index out of bounds: " + index);
}
return index;
} } |
public class class_name {
public List<JAXBElement<Object>> get_GenericApplicationPropertyOfAbstractBuilding() {
if (_GenericApplicationPropertyOfAbstractBuilding == null) {
_GenericApplicationPropertyOfAbstractBuilding = new ArrayList<JAXBElement<Object>>();
}
return this._GenericApplicationPropertyOfAbstractBuilding;
} } | public class class_name {
public List<JAXBElement<Object>> get_GenericApplicationPropertyOfAbstractBuilding() {
if (_GenericApplicationPropertyOfAbstractBuilding == null) {
_GenericApplicationPropertyOfAbstractBuilding = new ArrayList<JAXBElement<Object>>(); // depends on control dependency: [if], data = [none]
}
return this._GenericApplicationPropertyOfAbstractBuilding;
} } |
public class class_name {
public void breakCycles()
{
for (GraphObject go : new ArrayList<GraphObject>(result))
{
if (go instanceof Node)
{
Node node = (Node) go;
for (Edge edge : node.getDownstream())
{
if (result.contains(edge) && !isSafe(node, edge))
{
result.remove(edge);
}
}
}
}
} } | public class class_name {
public void breakCycles()
{
for (GraphObject go : new ArrayList<GraphObject>(result))
{
if (go instanceof Node)
{
Node node = (Node) go;
for (Edge edge : node.getDownstream())
{
if (result.contains(edge) && !isSafe(node, edge))
{
result.remove(edge); // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public void start() {
IoFutureListener<ConnectFuture> tmpConnectListener;
if (interval > 0) {
tmpConnectListener = new IoFutureListener<ConnectFuture>() {
@Override
public void operationComplete(ConnectFuture future) {
heartbeatFilter.setServiceConnected(future.isConnected());
updateConnectTimes(future.isConnected());
}
};
} else {
tmpConnectListener = new IoFutureListener<ConnectFuture>() {
@Override
public void operationComplete(ConnectFuture future) {
updateConnectTimes(future.isConnected());
}
};
}
final IoFutureListener<ConnectFuture> connectListener = tmpConnectListener;
// set a connection pool with GT 0 prepared connections in every worker thread as an optimization
Worker[] workers = tcpAcceptor.getWorkers();
assert preparedConnectionCount == 0 || preparedConnectionCount >= workers.length : "Prepared connection count must be 0, or >= number of IO threads";
int minCountPerThread = preparedConnectionCount / workers.length;
int remainder = preparedConnectionCount % workers.length;
for (Worker worker : workers) {
final int count = remainder-- > 0 ? minCountPerThread + 1 : minCountPerThread;
Runnable startConnectionPoolTask = () -> {
ConnectionPool currentPool = connectionPool.get();
if (currentPool == null) {
// the first time the pool is started is needs to be created, subsequent times it should just be started
// without re-creating.
currentPool = new ConnectionPool(serviceCtx, connectHandler, connectURI, heartbeatFilter,
connectListener, count, true);
connectionPool.set(currentPool);
}
currentPool.start();
};
worker.executeInIoThread(startConnectionPoolTask);
}
} } | public class class_name {
public void start() {
IoFutureListener<ConnectFuture> tmpConnectListener;
if (interval > 0) {
tmpConnectListener = new IoFutureListener<ConnectFuture>() {
@Override
public void operationComplete(ConnectFuture future) {
heartbeatFilter.setServiceConnected(future.isConnected());
updateConnectTimes(future.isConnected());
}
}; // depends on control dependency: [if], data = [none]
} else {
tmpConnectListener = new IoFutureListener<ConnectFuture>() {
@Override
public void operationComplete(ConnectFuture future) {
updateConnectTimes(future.isConnected());
}
}; // depends on control dependency: [if], data = [none]
}
final IoFutureListener<ConnectFuture> connectListener = tmpConnectListener;
// set a connection pool with GT 0 prepared connections in every worker thread as an optimization
Worker[] workers = tcpAcceptor.getWorkers();
assert preparedConnectionCount == 0 || preparedConnectionCount >= workers.length : "Prepared connection count must be 0, or >= number of IO threads";
int minCountPerThread = preparedConnectionCount / workers.length;
int remainder = preparedConnectionCount % workers.length;
for (Worker worker : workers) {
final int count = remainder-- > 0 ? minCountPerThread + 1 : minCountPerThread;
Runnable startConnectionPoolTask = () -> {
ConnectionPool currentPool = connectionPool.get();
if (currentPool == null) {
// the first time the pool is started is needs to be created, subsequent times it should just be started
// without re-creating.
currentPool = new ConnectionPool(serviceCtx, connectHandler, connectURI, heartbeatFilter,
connectListener, count, true); // depends on control dependency: [if], data = [none]
connectionPool.set(currentPool); // depends on control dependency: [if], data = [(currentPool]
}
currentPool.start(); // depends on control dependency: [for], data = [none]
};
worker.executeInIoThread(startConnectionPoolTask);
}
} } |
public class class_name {
public static KvStateService fromConfiguration(TaskManagerServicesConfiguration taskManagerServicesConfiguration) {
KvStateRegistry kvStateRegistry = new KvStateRegistry();
QueryableStateConfiguration qsConfig = taskManagerServicesConfiguration.getQueryableStateConfig();
KvStateClientProxy kvClientProxy = null;
KvStateServer kvStateServer = null;
if (qsConfig != null) {
int numProxyServerNetworkThreads = qsConfig.numProxyServerThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyServerThreads();
int numProxyServerQueryThreads = qsConfig.numProxyQueryThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyQueryThreads();
kvClientProxy = QueryableStateUtils.createKvStateClientProxy(
taskManagerServicesConfiguration.getTaskManagerAddress(),
qsConfig.getProxyPortRange(),
numProxyServerNetworkThreads,
numProxyServerQueryThreads,
new DisabledKvStateRequestStats());
int numStateServerNetworkThreads = qsConfig.numStateServerThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateServerThreads();
int numStateServerQueryThreads = qsConfig.numStateQueryThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateQueryThreads();
kvStateServer = QueryableStateUtils.createKvStateServer(
taskManagerServicesConfiguration.getTaskManagerAddress(),
qsConfig.getStateServerPortRange(),
numStateServerNetworkThreads,
numStateServerQueryThreads,
kvStateRegistry,
new DisabledKvStateRequestStats());
}
return new KvStateService(kvStateRegistry, kvStateServer, kvClientProxy);
} } | public class class_name {
public static KvStateService fromConfiguration(TaskManagerServicesConfiguration taskManagerServicesConfiguration) {
KvStateRegistry kvStateRegistry = new KvStateRegistry();
QueryableStateConfiguration qsConfig = taskManagerServicesConfiguration.getQueryableStateConfig();
KvStateClientProxy kvClientProxy = null;
KvStateServer kvStateServer = null;
if (qsConfig != null) {
int numProxyServerNetworkThreads = qsConfig.numProxyServerThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyServerThreads();
int numProxyServerQueryThreads = qsConfig.numProxyQueryThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyQueryThreads();
kvClientProxy = QueryableStateUtils.createKvStateClientProxy(
taskManagerServicesConfiguration.getTaskManagerAddress(),
qsConfig.getProxyPortRange(),
numProxyServerNetworkThreads,
numProxyServerQueryThreads,
new DisabledKvStateRequestStats()); // depends on control dependency: [if], data = [none]
int numStateServerNetworkThreads = qsConfig.numStateServerThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateServerThreads();
int numStateServerQueryThreads = qsConfig.numStateQueryThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateQueryThreads();
kvStateServer = QueryableStateUtils.createKvStateServer(
taskManagerServicesConfiguration.getTaskManagerAddress(),
qsConfig.getStateServerPortRange(),
numStateServerNetworkThreads,
numStateServerQueryThreads,
kvStateRegistry,
new DisabledKvStateRequestStats()); // depends on control dependency: [if], data = [none]
}
return new KvStateService(kvStateRegistry, kvStateServer, kvClientProxy);
} } |
public class class_name {
private CompletableFuture<Void> replicateAndInvalidate(CacheTopology cacheTopology) {
Address nextMember = getNextMember(cacheTopology);
if (nextMember != null) {
HashSet<Address> otherMembers = new HashSet<>(cacheTopology.getActualMembers());
Address localAddress = rpcManager.getAddress();
otherMembers.remove(localAddress);
otherMembers.remove(nextMember);
IntSet oldSegments;
if (cacheTopology.getCurrentCH().getMembers().contains(localAddress)) {
oldSegments = IntSets.from(cacheTopology.getCurrentCH().getSegmentsForOwner(localAddress));
oldSegments.retainAll(cacheTopology.getPendingCH().getSegmentsForOwner(localAddress));
} else {
log.trace("Local address is not a member of currentCH, returning");
return CompletableFutures.completedNull();
}
log.trace("Segments to replicate and invalidate: " + oldSegments);
if (oldSegments.isEmpty()) {
return CompletableFutures.completedNull();
}
// we'll start at 1, so the counter will never drop to 0 until we send all chunks
AtomicInteger outboundInvalidations = new AtomicInteger(1);
CompletableFuture<Void> outboundTaskFuture = new CompletableFuture<>();
OutboundTransferTask outboundTransferTask = new OutboundTransferTask(nextMember, oldSegments,
cacheTopology.getCurrentCH().getNumSegments(), chunkSize, cacheTopology.getTopologyId(), keyPartitioner,
task -> {
if (outboundInvalidations.decrementAndGet() == 0) {
outboundTaskFuture.complete(null);
}
}, chunks -> invalidateChunks(chunks, otherMembers, outboundInvalidations, outboundTaskFuture, cacheTopology),
OutboundTransferTask::defaultMapEntryFromDataContainer, OutboundTransferTask::defaultMapEntryFromStore,
dataContainer, persistenceManager, rpcManager, commandsFactory, entryFactory, timeout, cacheName, true, true);
outboundTransferTask.execute(executorService);
return outboundTaskFuture;
} else {
return CompletableFutures.completedNull();
}
} } | public class class_name {
private CompletableFuture<Void> replicateAndInvalidate(CacheTopology cacheTopology) {
Address nextMember = getNextMember(cacheTopology);
if (nextMember != null) {
HashSet<Address> otherMembers = new HashSet<>(cacheTopology.getActualMembers());
Address localAddress = rpcManager.getAddress();
otherMembers.remove(localAddress); // depends on control dependency: [if], data = [none]
otherMembers.remove(nextMember); // depends on control dependency: [if], data = [(nextMember]
IntSet oldSegments;
if (cacheTopology.getCurrentCH().getMembers().contains(localAddress)) {
oldSegments = IntSets.from(cacheTopology.getCurrentCH().getSegmentsForOwner(localAddress)); // depends on control dependency: [if], data = [none]
oldSegments.retainAll(cacheTopology.getPendingCH().getSegmentsForOwner(localAddress)); // depends on control dependency: [if], data = [none]
} else {
log.trace("Local address is not a member of currentCH, returning"); // depends on control dependency: [if], data = [none]
return CompletableFutures.completedNull(); // depends on control dependency: [if], data = [none]
}
log.trace("Segments to replicate and invalidate: " + oldSegments); // depends on control dependency: [if], data = [none]
if (oldSegments.isEmpty()) {
return CompletableFutures.completedNull(); // depends on control dependency: [if], data = [none]
}
// we'll start at 1, so the counter will never drop to 0 until we send all chunks
AtomicInteger outboundInvalidations = new AtomicInteger(1);
CompletableFuture<Void> outboundTaskFuture = new CompletableFuture<>();
OutboundTransferTask outboundTransferTask = new OutboundTransferTask(nextMember, oldSegments,
cacheTopology.getCurrentCH().getNumSegments(), chunkSize, cacheTopology.getTopologyId(), keyPartitioner,
task -> {
if (outboundInvalidations.decrementAndGet() == 0) {
outboundTaskFuture.complete(null);
}
}, chunks -> invalidateChunks(chunks, otherMembers, outboundInvalidations, outboundTaskFuture, cacheTopology),
OutboundTransferTask::defaultMapEntryFromDataContainer, OutboundTransferTask::defaultMapEntryFromStore,
dataContainer, persistenceManager, rpcManager, commandsFactory, entryFactory, timeout, cacheName, true, true);
outboundTransferTask.execute(executorService); // depends on control dependency: [if], data = [none]
return outboundTaskFuture; // depends on control dependency: [if], data = [none]
} else {
return CompletableFutures.completedNull(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static Cycles _invoke(CycleFinder finder, IAtomContainer container, int length) {
try {
return finder.find(container, length);
} catch (Intractable e) {
throw new RuntimeException("Cycle computation should not be intractable: ", e);
}
} } | public class class_name {
private static Cycles _invoke(CycleFinder finder, IAtomContainer container, int length) {
try {
return finder.find(container, length); // depends on control dependency: [try], data = [none]
} catch (Intractable e) {
throw new RuntimeException("Cycle computation should not be intractable: ", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String getValue(final String... profiles) {
if (hasMacro) {
return propsData.resolveMacros(value, profiles);
}
return value;
} } | public class class_name {
public String getValue(final String... profiles) {
if (hasMacro) {
return propsData.resolveMacros(value, profiles); // depends on control dependency: [if], data = [none]
}
return value;
} } |
public class class_name {
private void useGoBack(int numberOfTimes){
for(int i = 0; i < numberOfTimes; i++){
try {
inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
sleeper.sleep(MINISLEEP);
inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
} catch (Throwable ignored) {
// Guard against lack of INJECT_EVENT permission
}
}
} } | public class class_name {
private void useGoBack(int numberOfTimes){
for(int i = 0; i < numberOfTimes; i++){
try {
inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK); // depends on control dependency: [try], data = [none]
sleeper.sleep(MINISLEEP); // depends on control dependency: [try], data = [none]
inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK); // depends on control dependency: [try], data = [none]
} catch (Throwable ignored) {
// Guard against lack of INJECT_EVENT permission
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected Connection<CommPortAdapter> getCommPortConnection()
{
Connection<CommPortAdapter> connection=null;
synchronized(this)
{
boolean connectionValid=true;
//if no connection available
if(this.commConnection==null)
{
connectionValid=false;
}
else
{
//get adapter
CommPortAdapter adapter=this.commConnection.getResource();
//if current adapter is not valid/open
if(!adapter.isOpen())
{
connectionValid=false;
}
}
if(!connectionValid)
{
//release old connection
this.releaseCommPortConnection();
//create new connection
this.commConnection=this.createCommPortConnection();
}
}
//get connection
connection=this.commConnection;
return connection;
} } | public class class_name {
protected Connection<CommPortAdapter> getCommPortConnection()
{
Connection<CommPortAdapter> connection=null;
synchronized(this)
{
boolean connectionValid=true;
//if no connection available
if(this.commConnection==null)
{
connectionValid=false; // depends on control dependency: [if], data = [none]
}
else
{
//get adapter
CommPortAdapter adapter=this.commConnection.getResource();
//if current adapter is not valid/open
if(!adapter.isOpen())
{
connectionValid=false; // depends on control dependency: [if], data = [none]
}
}
if(!connectionValid)
{
//release old connection
this.releaseCommPortConnection(); // depends on control dependency: [if], data = [none]
//create new connection
this.commConnection=this.createCommPortConnection(); // depends on control dependency: [if], data = [none]
}
}
//get connection
connection=this.commConnection;
return connection;
} } |
public class class_name {
protected final ContentCryptoMaterial createContentCryptoMaterial(
AmazonWebServiceRequest req) {
if (req instanceof EncryptionMaterialsFactory) {
// per request level encryption materials
EncryptionMaterialsFactory f = (EncryptionMaterialsFactory)req;
final EncryptionMaterials materials = f.getEncryptionMaterials();
if (materials != null) {
return buildContentCryptoMaterial(materials, req);
}
}
if (req instanceof MaterialsDescriptionProvider) {
// per request level material description
MaterialsDescriptionProvider mdp = (MaterialsDescriptionProvider) req;
Map<String,String> matdesc_req = mdp.getMaterialsDescription();
ContentCryptoMaterial ccm = newContentCryptoMaterial(
kekMaterialsProvider,
matdesc_req,
cryptoConfig.getCryptoProvider(), req);
if (ccm != null)
return ccm;
if (matdesc_req != null) {
// check to see if KMS is in use and if so we should fall thru
// to the s3 client level encryption material
EncryptionMaterials material =
kekMaterialsProvider.getEncryptionMaterials();
if (!material.isKMSEnabled()) {
throw new SdkClientException(
"No material available from the encryption material provider for description "
+ matdesc_req);
}
}
// if there is no material description, fall thru to use
// the per s3 client level encryption materials
}
// per s3 client level encryption materials
return newContentCryptoMaterial(this.kekMaterialsProvider,
cryptoConfig.getCryptoProvider(), req);
} } | public class class_name {
protected final ContentCryptoMaterial createContentCryptoMaterial(
AmazonWebServiceRequest req) {
if (req instanceof EncryptionMaterialsFactory) {
// per request level encryption materials
EncryptionMaterialsFactory f = (EncryptionMaterialsFactory)req;
final EncryptionMaterials materials = f.getEncryptionMaterials();
if (materials != null) {
return buildContentCryptoMaterial(materials, req); // depends on control dependency: [if], data = [(materials]
}
}
if (req instanceof MaterialsDescriptionProvider) {
// per request level material description
MaterialsDescriptionProvider mdp = (MaterialsDescriptionProvider) req;
Map<String,String> matdesc_req = mdp.getMaterialsDescription();
ContentCryptoMaterial ccm = newContentCryptoMaterial(
kekMaterialsProvider,
matdesc_req,
cryptoConfig.getCryptoProvider(), req);
if (ccm != null)
return ccm;
if (matdesc_req != null) {
// check to see if KMS is in use and if so we should fall thru
// to the s3 client level encryption material
EncryptionMaterials material =
kekMaterialsProvider.getEncryptionMaterials();
if (!material.isKMSEnabled()) {
throw new SdkClientException(
"No material available from the encryption material provider for description "
+ matdesc_req);
}
}
// if there is no material description, fall thru to use
// the per s3 client level encryption materials
}
// per s3 client level encryption materials
return newContentCryptoMaterial(this.kekMaterialsProvider,
cryptoConfig.getCryptoProvider(), req);
} } |
public class class_name {
private boolean createGeometryIndexTable() {
boolean created = false;
// Create the geometry index table if needed as well
try {
if (!geometryIndexDao.isTableExists()) {
created = geoPackage.createGeometryIndexTable();
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to create Geometry Index table for GeoPackage: "
+ geoPackage.getName() + ", Table Name: "
+ tableName + ", Column Name: " + columnName, e);
}
return created;
} } | public class class_name {
private boolean createGeometryIndexTable() {
boolean created = false;
// Create the geometry index table if needed as well
try {
if (!geometryIndexDao.isTableExists()) {
created = geoPackage.createGeometryIndexTable(); // depends on control dependency: [if], data = [none]
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to create Geometry Index table for GeoPackage: "
+ geoPackage.getName() + ", Table Name: "
+ tableName + ", Column Name: " + columnName, e);
} // depends on control dependency: [catch], data = [none]
return created;
} } |
public class class_name {
@NonNull
@Override
public MutableDictionary setValue(@NonNull String key, Object value) {
if (key == null) { throw new IllegalArgumentException("key cannot be null."); }
synchronized (lock) {
final MValue oldValue = internalDict.get(key);
value = Fleece.toCBLObject(value);
if (Fleece.valueWouldChange(value, oldValue, internalDict)) { internalDict.set(key, new MValue(value)); }
return this;
}
} } | public class class_name {
@NonNull
@Override
public MutableDictionary setValue(@NonNull String key, Object value) {
if (key == null) { throw new IllegalArgumentException("key cannot be null."); }
synchronized (lock) {
final MValue oldValue = internalDict.get(key);
value = Fleece.toCBLObject(value);
if (Fleece.valueWouldChange(value, oldValue, internalDict)) { internalDict.set(key, new MValue(value)); } // depends on control dependency: [if], data = [none]
return this;
}
} } |
public class class_name {
private SepaVersion determinePainVersion(HBCIPassportInternal passport, String gvName) {
// Schritt 1: Wir holen uns die globale maximale PAIN-Version
SepaVersion globalVersion = this.determinePainVersionInternal(passport, GVSEPAInfo.getLowlevelName());
// Schritt 2: Die des Geschaeftsvorfalls - fuer den Fall, dass die Bank
// dort weitere Einschraenkungen hinterlegt hat
SepaVersion jobVersion = this.determinePainVersionInternal(passport, gvName);
// Wir haben gar keine PAIN-Version gefunden
if (globalVersion == null && jobVersion == null) {
SepaVersion def = this.getDefaultPainVersion();
log.warn("unable to determine matching pain version, using default: " + def);
return def;
}
// Wenn wir keine GV-spezifische haben, dann nehmen wir die globale
if (jobVersion == null) {
log.debug("have no job-specific pain version, using global pain version: " + globalVersion);
return globalVersion;
}
// Ansonsten hat die vom Job Vorrang:
log.debug("using job-specific pain version: " + jobVersion);
return jobVersion;
} } | public class class_name {
private SepaVersion determinePainVersion(HBCIPassportInternal passport, String gvName) {
// Schritt 1: Wir holen uns die globale maximale PAIN-Version
SepaVersion globalVersion = this.determinePainVersionInternal(passport, GVSEPAInfo.getLowlevelName());
// Schritt 2: Die des Geschaeftsvorfalls - fuer den Fall, dass die Bank
// dort weitere Einschraenkungen hinterlegt hat
SepaVersion jobVersion = this.determinePainVersionInternal(passport, gvName);
// Wir haben gar keine PAIN-Version gefunden
if (globalVersion == null && jobVersion == null) {
SepaVersion def = this.getDefaultPainVersion();
log.warn("unable to determine matching pain version, using default: " + def); // depends on control dependency: [if], data = [none]
return def; // depends on control dependency: [if], data = [none]
}
// Wenn wir keine GV-spezifische haben, dann nehmen wir die globale
if (jobVersion == null) {
log.debug("have no job-specific pain version, using global pain version: " + globalVersion); // depends on control dependency: [if], data = [none]
return globalVersion; // depends on control dependency: [if], data = [none]
}
// Ansonsten hat die vom Job Vorrang:
log.debug("using job-specific pain version: " + jobVersion);
return jobVersion;
} } |
public class class_name {
public EClass getIfcHeatFluxDensityMeasure() {
if (ifcHeatFluxDensityMeasureEClass == null) {
ifcHeatFluxDensityMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(682);
}
return ifcHeatFluxDensityMeasureEClass;
} } | public class class_name {
public EClass getIfcHeatFluxDensityMeasure() {
if (ifcHeatFluxDensityMeasureEClass == null) {
ifcHeatFluxDensityMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(682);
// depends on control dependency: [if], data = [none]
}
return ifcHeatFluxDensityMeasureEClass;
} } |
public class class_name {
@SafeVarargs
public static <T> void split(T[] src, T[]... parts) {
int srcPos = 0;
for (T[] dest : parts) {
System.arraycopy(src, srcPos, dest, 0, dest.length);
srcPos += dest.length;
}
} } | public class class_name {
@SafeVarargs
public static <T> void split(T[] src, T[]... parts) {
int srcPos = 0;
for (T[] dest : parts) {
System.arraycopy(src, srcPos, dest, 0, dest.length); // depends on control dependency: [for], data = [dest]
srcPos += dest.length; // depends on control dependency: [for], data = [dest]
}
} } |
public class class_name {
public float optFloat(int index, float defaultValue) {
final Number val = this.optNumber(index, null);
if (val == null) {
return defaultValue;
}
final float floatValue = val.floatValue();
// if (Float.isNaN(floatValue) || Float.isInfinite(floatValue)) {
// return floatValue;
// }
return floatValue;
} } | public class class_name {
public float optFloat(int index, float defaultValue) {
final Number val = this.optNumber(index, null);
if (val == null) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
final float floatValue = val.floatValue();
// if (Float.isNaN(floatValue) || Float.isInfinite(floatValue)) {
// return floatValue;
// }
return floatValue;
} } |
public class class_name {
public static base_responses update(nitro_service client, dnsaction resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsaction updateresources[] = new dnsaction[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new dnsaction();
updateresources[i].actionname = resources[i].actionname;
updateresources[i].ipaddress = resources[i].ipaddress;
updateresources[i].ttl = resources[i].ttl;
updateresources[i].viewname = resources[i].viewname;
updateresources[i].preferredloclist = resources[i].preferredloclist;
}
result = update_bulk_request(client, updateresources);
}
return result;
} } | public class class_name {
public static base_responses update(nitro_service client, dnsaction resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsaction updateresources[] = new dnsaction[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new dnsaction(); // depends on control dependency: [for], data = [i]
updateresources[i].actionname = resources[i].actionname; // depends on control dependency: [for], data = [i]
updateresources[i].ipaddress = resources[i].ipaddress; // depends on control dependency: [for], data = [i]
updateresources[i].ttl = resources[i].ttl; // depends on control dependency: [for], data = [i]
updateresources[i].viewname = resources[i].viewname; // depends on control dependency: [for], data = [i]
updateresources[i].preferredloclist = resources[i].preferredloclist; // depends on control dependency: [for], data = [i]
}
result = update_bulk_request(client, updateresources);
}
return result;
} } |
public class class_name {
@Pure
@SuppressWarnings("checkstyle:npathcomplexity")
public static Map<Character, String> getJavaToHTMLTranslationTable() {
Map<Character, String> map = null;
try {
LOCK.lock();
if (javaToHtmlTransTbl != null) {
map = javaToHtmlTransTbl.get();
}
} finally {
LOCK.unlock();
}
if (map != null) {
return map;
}
// Get the resource file
ResourceBundle resource = null;
try {
resource = ResourceBundle.getBundle(
TextUtil.class.getCanonicalName(),
java.util.Locale.getDefault());
} catch (MissingResourceException exep) {
return null;
}
// get the resource string
final String result;
try {
result = resource.getString("HTML_TRANS_TBL"); //$NON-NLS-1$
} catch (Exception e) {
return null;
}
map = new TreeMap<>();
final String[] pairs = result.split("(\\}\\{)|\\{|\\}"); //$NON-NLS-1$
Integer isoCode;
String entity;
String code;
for (int i = 1; (i + 1) < pairs.length; i += 2) {
try {
entity = pairs[i];
code = pairs[i + 1];
isoCode = Integer.valueOf(code);
if (isoCode != null) {
map.put((char) isoCode.intValue(), entity);
}
} catch (Throwable exception) {
//
}
}
try {
LOCK.lock();
javaToHtmlTransTbl = new SoftReference<>(map);
} finally {
LOCK.unlock();
}
return map;
} } | public class class_name {
@Pure
@SuppressWarnings("checkstyle:npathcomplexity")
public static Map<Character, String> getJavaToHTMLTranslationTable() {
Map<Character, String> map = null;
try {
LOCK.lock(); // depends on control dependency: [try], data = [none]
if (javaToHtmlTransTbl != null) {
map = javaToHtmlTransTbl.get(); // depends on control dependency: [if], data = [none]
}
} finally {
LOCK.unlock();
}
if (map != null) {
return map; // depends on control dependency: [if], data = [none]
}
// Get the resource file
ResourceBundle resource = null;
try {
resource = ResourceBundle.getBundle(
TextUtil.class.getCanonicalName(),
java.util.Locale.getDefault()); // depends on control dependency: [try], data = [none]
} catch (MissingResourceException exep) {
return null;
} // depends on control dependency: [catch], data = [none]
// get the resource string
final String result;
try {
result = resource.getString("HTML_TRANS_TBL"); //$NON-NLS-1$ // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return null;
} // depends on control dependency: [catch], data = [none]
map = new TreeMap<>();
final String[] pairs = result.split("(\\}\\{)|\\{|\\}"); //$NON-NLS-1$
Integer isoCode;
String entity;
String code;
for (int i = 1; (i + 1) < pairs.length; i += 2) {
try {
entity = pairs[i]; // depends on control dependency: [try], data = [none]
code = pairs[i + 1]; // depends on control dependency: [try], data = [none]
isoCode = Integer.valueOf(code); // depends on control dependency: [try], data = [none]
if (isoCode != null) {
map.put((char) isoCode.intValue(), entity); // depends on control dependency: [if], data = [none]
}
} catch (Throwable exception) {
//
} // depends on control dependency: [catch], data = [none]
}
try {
LOCK.lock(); // depends on control dependency: [try], data = [none]
javaToHtmlTransTbl = new SoftReference<>(map); // depends on control dependency: [try], data = [none]
} finally {
LOCK.unlock();
}
return map;
} } |
public class class_name {
public <T extends RegisteredService> T getDynamicService(Package pkg, Class<T> serviceInterface, String className) {
if (dynamicServices.containsKey(serviceInterface.getName())
&& dynamicServices.get(serviceInterface.getName()).contains(className)) {
try {
ClassLoader parentClassLoader = pkg == null ? getClass().getClassLoader() : pkg.getClassLoader();
Class<?> clazz = CompiledJavaCache.getClassFromAssetName(parentClassLoader, className);
if (clazz == null)
return null;
RegisteredService rs = (RegisteredService) (clazz).newInstance();
T drs = serviceInterface.cast(rs);
return drs;
}
catch (Exception ex) {
logger.severeException("Failed to get the dynamic registered service : " + className +" \n " + ex.getMessage(), ex);
}
}
return null;
} } | public class class_name {
public <T extends RegisteredService> T getDynamicService(Package pkg, Class<T> serviceInterface, String className) {
if (dynamicServices.containsKey(serviceInterface.getName())
&& dynamicServices.get(serviceInterface.getName()).contains(className)) {
try {
ClassLoader parentClassLoader = pkg == null ? getClass().getClassLoader() : pkg.getClassLoader();
Class<?> clazz = CompiledJavaCache.getClassFromAssetName(parentClassLoader, className);
if (clazz == null)
return null;
RegisteredService rs = (RegisteredService) (clazz).newInstance();
T drs = serviceInterface.cast(rs);
return drs; // depends on control dependency: [try], data = [none]
}
catch (Exception ex) {
logger.severeException("Failed to get the dynamic registered service : " + className +" \n " + ex.getMessage(), ex);
} // depends on control dependency: [catch], data = [none]
}
return null;
} } |
public class class_name {
private Message buildMapEntryMessage(Message.Builder mapBuilder, Field field,
Object mapKey, Object mapValue) {
FieldDescriptor keyFieldDescriptor =
mapBuilder.getDescriptorForType().findFieldByName(MAP_KEY_FIELD_NAME);
FieldDescriptor valueFieldDescriptor =
mapBuilder.getDescriptorForType().findFieldByName(MAP_VALUE_FIELD_NAME);
boolean isKeyStruct = field.getMapKeyField().isStruct();
boolean isValueStruct = field.getMapValueField().isStruct();
Object convertedKey;
if (isKeyStruct) {
convertedKey = doConvert((TBase<?, ?>) mapKey);
} else {
convertedKey = sanitizeRawValue(mapKey, field.getMapKeyField());
}
Object convertedValue;
if (isValueStruct) {
convertedValue = doConvert((TBase<?, ?>) mapValue);
} else {
convertedValue = sanitizeRawValue(mapValue, field.getMapValueField());
}
mapBuilder.setField(keyFieldDescriptor, convertedKey);
mapBuilder.setField(valueFieldDescriptor, convertedValue);
return mapBuilder.build();
} } | public class class_name {
private Message buildMapEntryMessage(Message.Builder mapBuilder, Field field,
Object mapKey, Object mapValue) {
FieldDescriptor keyFieldDescriptor =
mapBuilder.getDescriptorForType().findFieldByName(MAP_KEY_FIELD_NAME);
FieldDescriptor valueFieldDescriptor =
mapBuilder.getDescriptorForType().findFieldByName(MAP_VALUE_FIELD_NAME);
boolean isKeyStruct = field.getMapKeyField().isStruct();
boolean isValueStruct = field.getMapValueField().isStruct();
Object convertedKey;
if (isKeyStruct) {
convertedKey = doConvert((TBase<?, ?>) mapKey); // depends on control dependency: [if], data = [none]
} else {
convertedKey = sanitizeRawValue(mapKey, field.getMapKeyField()); // depends on control dependency: [if], data = [none]
}
Object convertedValue;
if (isValueStruct) {
convertedValue = doConvert((TBase<?, ?>) mapValue); // depends on control dependency: [if], data = [none]
} else {
convertedValue = sanitizeRawValue(mapValue, field.getMapValueField()); // depends on control dependency: [if], data = [none]
}
mapBuilder.setField(keyFieldDescriptor, convertedKey);
mapBuilder.setField(valueFieldDescriptor, convertedValue);
return mapBuilder.build();
} } |
public class class_name {
public static String trimTrailingCharacter(String str, char trailingCharacter) {
if (!hasLength(str)) {
return str;
}
StringBuilder buf = new StringBuilder(str);
while (buf.length() > 0 && buf.charAt(buf.length() - 1) == trailingCharacter) {
buf.deleteCharAt(buf.length() - 1);
}
return buf.toString();
} } | public class class_name {
public static String trimTrailingCharacter(String str, char trailingCharacter) {
if (!hasLength(str)) {
return str; // depends on control dependency: [if], data = [none]
}
StringBuilder buf = new StringBuilder(str);
while (buf.length() > 0 && buf.charAt(buf.length() - 1) == trailingCharacter) {
buf.deleteCharAt(buf.length() - 1); // depends on control dependency: [while], data = [none]
}
return buf.toString();
} } |
public class class_name {
public long videoPreview(String wxName, String openId, String mediaId, String title, String desc) {
Map<String, String> uploadRequest = new HashMap<>();
uploadRequest.put("media_id", mediaId);
uploadRequest.put("title", title);
uploadRequest.put("description", desc);
String uploadUrl = WxEndpoint.get("url.mass.message.video.upload");
String json = JsonMapper.nonEmptyMapper().toJson(uploadUrl);
String response = wxClient.post(uploadUrl, json);
Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response);
if (result.containsKey("media_id")) {
return preview(wxName, openId, "mpvideo", (String) result.get("media_id"));
} else {
throw new WxRuntimeException(999, "send mp video preview failed.");
}
} } | public class class_name {
public long videoPreview(String wxName, String openId, String mediaId, String title, String desc) {
Map<String, String> uploadRequest = new HashMap<>();
uploadRequest.put("media_id", mediaId);
uploadRequest.put("title", title);
uploadRequest.put("description", desc);
String uploadUrl = WxEndpoint.get("url.mass.message.video.upload");
String json = JsonMapper.nonEmptyMapper().toJson(uploadUrl);
String response = wxClient.post(uploadUrl, json);
Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response);
if (result.containsKey("media_id")) {
return preview(wxName, openId, "mpvideo", (String) result.get("media_id"));
// depends on control dependency: [if], data = [none]
} else {
throw new WxRuntimeException(999, "send mp video preview failed.");
}
} } |
public class class_name {
public static String udunitsToUcum(String udunits) {
if (udunits == null) {
return null;
}
//is it a point in time? e.g., seconds since 1970-01-01T00:00:00T
int sincePo = udunits.indexOf(" since ");
if (sincePo > 0) {
try {
//test if really appropriate
double baf[] = ErddapCalendar2.getTimeBaseAndFactor(udunits); //throws exception if trouble
//use 'factor', since it is more forgiving than udunitsToUcum converter
String u;
if (Misc.nearlyEquals(baf[1], 0.001, 1e-6)) { // Can't simply do "baf[1] == 0.001".
u = "ms";
} else if (baf[1] == 1) {
u = "s";
} else if (baf[1] == ErddapCalendar2.SECONDS_PER_MINUTE) {
u = "min";
} else if (baf[1] == ErddapCalendar2.SECONDS_PER_HOUR) {
u = "h";
} else if (baf[1] == ErddapCalendar2.SECONDS_PER_DAY) {
u = "d";
} else if (baf[1] == 30 * ErddapCalendar2.SECONDS_PER_DAY) { // mo_j ?
u = "mo";
} else if (baf[1] == 360 * ErddapCalendar2.SECONDS_PER_DAY) { // a_j ?
u = "a";
} else {
u = udunitsToUcum(udunits.substring(0, sincePo)); //shouldn't happen, but weeks? microsec?
}
//make "s{since 1970-01-01T00:00:00T}
return u + "{" + udunits.substring(sincePo + 1) + "}";
} catch (Exception e) {
}
}
//parse udunits and build ucum, till done
StringBuilder ucum = new StringBuilder();
int udLength = udunits.length();
int po = 0; //po is next position to be read
while (po < udLength) {
char ch = udunits.charAt(po);
//letter
if (isUdunitsLetter(ch)) { //includes 'µ' and '°'
//find contiguous letters|_|digit (no '-')
int po2 = po + 1;
while (po2 < udLength &&
(isUdunitsLetter(udunits.charAt(po2)) || udunits.charAt(po2) == '_' ||
ErddapString2.isDigit(udunits.charAt(po2)))) {
po2++;
}
String tUdunits = udunits.substring(po, po2);
po = po2;
//some udunits have internal digits, but none end in digits
//if it ends in digits, treat as exponent
//find contiguous digits at end
int firstDigit = tUdunits.length();
while (firstDigit >= 1 && ErddapString2.isDigit(tUdunits.charAt(firstDigit - 1))) {
firstDigit--;
}
String exponent = tUdunits.substring(firstDigit);
tUdunits = tUdunits.substring(0, firstDigit);
String tUcum = oneUdunitsToUcum(tUdunits);
//deal with PER -> /
if (tUcum.equals("/")) {
char lastUcum = ucum.length() == 0 ? '\u0000' : ucum.charAt(ucum.length() - 1);
if (lastUcum == '/') {
ucum.setCharAt(ucum.length() - 1, '.'); //2 '/' cancel out
} else if (lastUcum == '.') {
ucum.setCharAt(ucum.length() - 1, '/'); // '/' replaces '.'
} else {
ucum.append('/');
}
} else {
ucum.append(tUcum);
}
//add the exponent
ucum.append(exponent);
//catch -exponent as a number below
continue;
}
//number
if (ch == '-' || ErddapString2.isDigit(ch)) {
//find contiguous digits
int po2 = po + 1;
while (po2 < udLength && ErddapString2.isDigit(udunits.charAt(po2))) {
po2++;
}
//decimal place + digit (not just .=multiplication)
boolean hasDot = false;
if (po2 < udLength - 1 && udunits.charAt(po2) == '.' && ErddapString2.isDigit(udunits.charAt(po2 + 1))) {
hasDot = true;
po2 += 2;
while (po2 < udLength && ErddapString2.isDigit(udunits.charAt(po2))) {
po2++;
}
}
//exponent? e- or e{digit}
boolean hasE = false;
if (po2 < udLength - 1 && Character.toLowerCase(udunits.charAt(po2)) == 'e' &&
(udunits.charAt(po2 + 1) == '-' || ErddapString2.isDigit(udunits.charAt(po2 + 1)))) {
hasE = true;
po2 += 2;
while (po2 < udLength && ErddapString2.isDigit(udunits.charAt(po2))) {
po2++;
}
}
String num = udunits.substring(po, po2);
po = po2;
//convert floating point to rational number
if (hasDot || hasE) {
int rational[] = ErddapString2.toRational(ErddapString2.parseDouble(num));
if (rational[1] == Integer.MAX_VALUE) {
ucum.append(num); //ignore the trouble !!! ???
} else if (rational[1] == 0) //includes {0, 0}
{
ucum.append(rational[0]);
} else {
ucum.append(rational[0]).append(".10^").append(rational[1]);
}
} else {
//just copy num
ucum.append(num);
}
continue;
}
//space or . or · (183) (multiplication)
if (ch == ' ' || ch == '.' || ch == 183) {
char lastUcum = ucum.length() == 0 ? '\u0000' : ucum.charAt(ucum.length() - 1);
if (lastUcum == '/' || lastUcum == '.') {
//if last token was / or ., do nothing
} else {
ucum.append('.');
}
po++;
continue;
}
// * (multiplication * or exponent **)
if (ch == '*') {
po++;
if (po < udLength && udunits.charAt(po) == '*') {
ucum.append('^'); // exponent: ** -> ^
po++;
} else {
char lastUcum = ucum.length() == 0 ? '\u0000' : ucum.charAt(ucum.length() - 1);
if (lastUcum == '/' || lastUcum == '.') {
//if last token was / or ., do nothing
} else {
ucum.append('.');
}
}
continue;
}
// /
if (ch == '/') {
po++;
char lastUcum = ucum.length() == 0 ? '\u0000' : ucum.charAt(ucum.length() - 1);
if (lastUcum == '/') {
ucum.setCharAt(ucum.length() - 1, '.'); // 2 '/' cancel out
} else if (lastUcum == '.') {
ucum.setCharAt(ucum.length() - 1, '/'); // '/' replaces '.'
} else {
ucum.append('/');
}
continue;
}
// "
if (ch == '\"') {
po++;
ucum.append("''");
continue;
}
//otherwise, punctuation. copy it
ucum.append(ch);
po++;
}
return ucum.toString();
} } | public class class_name {
public static String udunitsToUcum(String udunits) {
if (udunits == null) {
return null; // depends on control dependency: [if], data = [none]
}
//is it a point in time? e.g., seconds since 1970-01-01T00:00:00T
int sincePo = udunits.indexOf(" since ");
if (sincePo > 0) {
try {
//test if really appropriate
double baf[] = ErddapCalendar2.getTimeBaseAndFactor(udunits); //throws exception if trouble
//use 'factor', since it is more forgiving than udunitsToUcum converter
String u;
if (Misc.nearlyEquals(baf[1], 0.001, 1e-6)) { // Can't simply do "baf[1] == 0.001".
u = "ms"; // depends on control dependency: [if], data = [none]
} else if (baf[1] == 1) {
u = "s"; // depends on control dependency: [if], data = [none]
} else if (baf[1] == ErddapCalendar2.SECONDS_PER_MINUTE) {
u = "min"; // depends on control dependency: [if], data = [none]
} else if (baf[1] == ErddapCalendar2.SECONDS_PER_HOUR) {
u = "h"; // depends on control dependency: [if], data = [none]
} else if (baf[1] == ErddapCalendar2.SECONDS_PER_DAY) {
u = "d"; // depends on control dependency: [if], data = [none]
} else if (baf[1] == 30 * ErddapCalendar2.SECONDS_PER_DAY) { // mo_j ?
u = "mo"; // depends on control dependency: [if], data = [none]
} else if (baf[1] == 360 * ErddapCalendar2.SECONDS_PER_DAY) { // a_j ?
u = "a"; // depends on control dependency: [if], data = [none]
} else {
u = udunitsToUcum(udunits.substring(0, sincePo)); //shouldn't happen, but weeks? microsec? // depends on control dependency: [if], data = [none]
}
//make "s{since 1970-01-01T00:00:00T}
return u + "{" + udunits.substring(sincePo + 1) + "}"; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
}
//parse udunits and build ucum, till done
StringBuilder ucum = new StringBuilder();
int udLength = udunits.length();
int po = 0; //po is next position to be read
while (po < udLength) {
char ch = udunits.charAt(po);
//letter
if (isUdunitsLetter(ch)) { //includes 'µ' and '°'
//find contiguous letters|_|digit (no '-')
int po2 = po + 1;
while (po2 < udLength &&
(isUdunitsLetter(udunits.charAt(po2)) || udunits.charAt(po2) == '_' ||
ErddapString2.isDigit(udunits.charAt(po2)))) {
po2++; // depends on control dependency: [while], data = [none]
}
String tUdunits = udunits.substring(po, po2);
po = po2; // depends on control dependency: [if], data = [none]
//some udunits have internal digits, but none end in digits
//if it ends in digits, treat as exponent
//find contiguous digits at end
int firstDigit = tUdunits.length();
while (firstDigit >= 1 && ErddapString2.isDigit(tUdunits.charAt(firstDigit - 1))) {
firstDigit--; // depends on control dependency: [while], data = [none]
}
String exponent = tUdunits.substring(firstDigit);
tUdunits = tUdunits.substring(0, firstDigit); // depends on control dependency: [if], data = [none]
String tUcum = oneUdunitsToUcum(tUdunits);
//deal with PER -> /
if (tUcum.equals("/")) {
char lastUcum = ucum.length() == 0 ? '\u0000' : ucum.charAt(ucum.length() - 1);
if (lastUcum == '/') {
ucum.setCharAt(ucum.length() - 1, '.'); //2 '/' cancel out // depends on control dependency: [if], data = [none]
} else if (lastUcum == '.') {
ucum.setCharAt(ucum.length() - 1, '/'); // '/' replaces '.' // depends on control dependency: [if], data = [none]
} else {
ucum.append('/'); // depends on control dependency: [if], data = [none]
}
} else {
ucum.append(tUcum); // depends on control dependency: [if], data = [none]
}
//add the exponent
ucum.append(exponent); // depends on control dependency: [if], data = [none]
//catch -exponent as a number below
continue;
}
//number
if (ch == '-' || ErddapString2.isDigit(ch)) {
//find contiguous digits
int po2 = po + 1;
while (po2 < udLength && ErddapString2.isDigit(udunits.charAt(po2))) {
po2++; // depends on control dependency: [while], data = [none]
}
//decimal place + digit (not just .=multiplication)
boolean hasDot = false;
if (po2 < udLength - 1 && udunits.charAt(po2) == '.' && ErddapString2.isDigit(udunits.charAt(po2 + 1))) {
hasDot = true; // depends on control dependency: [if], data = [none]
po2 += 2; // depends on control dependency: [if], data = [none]
while (po2 < udLength && ErddapString2.isDigit(udunits.charAt(po2))) {
po2++; // depends on control dependency: [while], data = [none]
}
}
//exponent? e- or e{digit}
boolean hasE = false;
if (po2 < udLength - 1 && Character.toLowerCase(udunits.charAt(po2)) == 'e' &&
(udunits.charAt(po2 + 1) == '-' || ErddapString2.isDigit(udunits.charAt(po2 + 1)))) {
hasE = true; // depends on control dependency: [if], data = [none]
po2 += 2; // depends on control dependency: [if], data = [none]
while (po2 < udLength && ErddapString2.isDigit(udunits.charAt(po2))) {
po2++; // depends on control dependency: [while], data = [none]
}
}
String num = udunits.substring(po, po2);
po = po2; // depends on control dependency: [if], data = [none]
//convert floating point to rational number
if (hasDot || hasE) {
int rational[] = ErddapString2.toRational(ErddapString2.parseDouble(num));
if (rational[1] == Integer.MAX_VALUE) {
ucum.append(num); //ignore the trouble !!! ??? // depends on control dependency: [if], data = [none]
} else if (rational[1] == 0) //includes {0, 0}
{
ucum.append(rational[0]); // depends on control dependency: [if], data = [none]
} else {
ucum.append(rational[0]).append(".10^").append(rational[1]); // depends on control dependency: [if], data = [(rational[1]]
}
} else {
//just copy num
ucum.append(num); // depends on control dependency: [if], data = [none]
}
continue;
}
//space or . or · (183) (multiplication)
if (ch == ' ' || ch == '.' || ch == 183) {
char lastUcum = ucum.length() == 0 ? '\u0000' : ucum.charAt(ucum.length() - 1);
if (lastUcum == '/' || lastUcum == '.') {
//if last token was / or ., do nothing
} else {
ucum.append('.'); // depends on control dependency: [if], data = [none]
}
po++; // depends on control dependency: [if], data = [none]
continue;
}
// * (multiplication * or exponent **)
if (ch == '*') {
po++; // depends on control dependency: [if], data = [none]
if (po < udLength && udunits.charAt(po) == '*') {
ucum.append('^'); // exponent: ** -> ^ // depends on control dependency: [if], data = [none]
po++; // depends on control dependency: [if], data = [none]
} else {
char lastUcum = ucum.length() == 0 ? '\u0000' : ucum.charAt(ucum.length() - 1);
if (lastUcum == '/' || lastUcum == '.') {
//if last token was / or ., do nothing
} else {
ucum.append('.'); // depends on control dependency: [if], data = [none]
}
}
continue;
}
// /
if (ch == '/') {
po++; // depends on control dependency: [if], data = [none]
char lastUcum = ucum.length() == 0 ? '\u0000' : ucum.charAt(ucum.length() - 1);
if (lastUcum == '/') {
ucum.setCharAt(ucum.length() - 1, '.'); // 2 '/' cancel out // depends on control dependency: [if], data = [none]
} else if (lastUcum == '.') {
ucum.setCharAt(ucum.length() - 1, '/'); // '/' replaces '.' // depends on control dependency: [if], data = [none]
} else {
ucum.append('/'); // depends on control dependency: [if], data = [none]
}
continue;
}
// "
if (ch == '\"') {
po++; // depends on control dependency: [if], data = [none]
ucum.append("''"); // depends on control dependency: [if], data = [none]
continue;
}
//otherwise, punctuation. copy it
ucum.append(ch); // depends on control dependency: [while], data = [none]
po++; // depends on control dependency: [while], data = [none]
}
return ucum.toString();
} } |
public class class_name {
public boolean removeTerms(Set<BooleanTerm> toRemove) {
boolean modified = false;
if (toRemove == null || toRemove.iterator() == null) {
modified = booleanTerms == null || size() != 0;
booleanTerms = new HashSet<BooleanTerm>();
} else if (booleanTerms != null) {
modified = removeAll(toRemove);
}
return modified;
} } | public class class_name {
public boolean removeTerms(Set<BooleanTerm> toRemove) {
boolean modified = false;
if (toRemove == null || toRemove.iterator() == null) {
modified = booleanTerms == null || size() != 0;
// depends on control dependency: [if], data = [none]
booleanTerms = new HashSet<BooleanTerm>();
// depends on control dependency: [if], data = [none]
} else if (booleanTerms != null) {
modified = removeAll(toRemove);
// depends on control dependency: [if], data = [none]
}
return modified;
} } |
public class class_name {
static String uri(final String... paths) {
StringBuilder sb = new StringBuilder();
boolean firstPath = true;
for (String s : paths) {
if (s == null || s.isEmpty()) {
continue;
}
if (!s.startsWith("/") && !firstPath) {
sb.append("/");
}
sb.append(stripLeadingSlash(s));
firstPath = false;
}
return sb.toString();
} } | public class class_name {
static String uri(final String... paths) {
StringBuilder sb = new StringBuilder();
boolean firstPath = true;
for (String s : paths) {
if (s == null || s.isEmpty()) {
continue;
}
if (!s.startsWith("/") && !firstPath) {
sb.append("/"); // depends on control dependency: [if], data = [none]
}
sb.append(stripLeadingSlash(s)); // depends on control dependency: [for], data = [s]
firstPath = false; // depends on control dependency: [for], data = [s]
}
return sb.toString();
} } |
public class class_name {
public void marshall(OutputSettings outputSettings, ProtocolMarshaller protocolMarshaller) {
if (outputSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(outputSettings.getHlsSettings(), HLSSETTINGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(OutputSettings outputSettings, ProtocolMarshaller protocolMarshaller) {
if (outputSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(outputSettings.getHlsSettings(), HLSSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void init() {
_minValue = 0;
_maxValue = 100;
value = new DoublePropertyBase(_minValue) {
@Override protected void invalidated() {
final double VALUE = get();
withinSpeedLimit = !(Instant.now().minusMillis(getAnimationDuration()).isBefore(lastCall));
lastCall = Instant.now();
if (isAnimated() && withinSpeedLimit) {
long animationDuration = isReturnToZero() ? (long) (0.2 * getAnimationDuration()) : getAnimationDuration();
timeline.stop();
final KeyValue KEY_VALUE;
if (NeedleBehavior.STANDARD == getNeedleBehavior()) {
KEY_VALUE = new KeyValue(currentValue, VALUE, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
} else { // Optimized only useful in a gauge where the angle range is 360 deg and the shorter way has to be calculated.
double ov = getOldValue();
double min = getMinValue();
double max = getMaxValue();
double halfRange = getRange() * 0.5;
double cv = getCurrentValue();
double delta = VALUE - getCurrentValue();
if (delta < -halfRange) {
double kv1 = max - cv;
double kv2 = VALUE;
} else if (delta > halfRange) {
}
double tmpValue;
if (Math.abs(VALUE - ov) > getRange() * 0.5) {
if (ov < VALUE) {
tmpValue = min - max + VALUE;
} else {
tmpValue = ov + max - ov + min + VALUE - getRange();
}
KEY_VALUE = new KeyValue(currentValue, tmpValue, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
} else {
if (cv < min) currentValue.set(max + cv);
KEY_VALUE = new KeyValue(currentValue, VALUE, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
}
}
final KeyFrame KEY_FRAME = new KeyFrame(Duration.millis(animationDuration), KEY_VALUE);
timeline.getKeyFrames().setAll(KEY_FRAME);
timeline.play();
} else {
currentValue.set(VALUE);
fireUpdateEvent(FINISHED_EVENT);
}
if (isAveragingEnabled()) { movingAverage.addData(new Data(VALUE)); }
}
@Override public void set(final double VALUE) {
super.set(VALUE);
fireUpdateEvent(VALUE_EVENT);
}
@Override public Object getBean() { return Gauge.this; }
@Override public String getName() { return "value"; }
};
oldValue = new SimpleDoubleProperty(Gauge.this, "oldValue", value.get());
currentValue = new DoublePropertyBase(value.get()) {
@Override protected void invalidated() {
final double VALUE = get();
if (isCheckThreshold()) {
double thrshld = getThreshold();
if (formerValue.get() < thrshld && VALUE > thrshld) {
fireEvent(EXCEEDED_EVENT);
} else if (formerValue.get() > thrshld && VALUE < thrshld) {
fireEvent(UNDERRUN_EVENT);
}
}
if (VALUE < getMinMeasuredValue()) {
setMinMeasuredValue(VALUE);
} else if (VALUE > getMaxMeasuredValue()) {
setMaxMeasuredValue(VALUE);
}
formerValue.set(VALUE);
}
@Override public void set(final double VALUE) { super.set(VALUE); }
@Override public Object getBean() { return Gauge.this; }
@Override public String getName() { return "currentValue";}
};
formerValue = new SimpleDoubleProperty(Gauge.this, "formerValue", value.get());
_range = _maxValue - _minValue;
_threshold = _maxValue;
_title = "";
_subTitle = "";
_unit = "";
_averagingEnabled = false;
_averagingPeriod = 10;
movingAverage = new MovingAverage(_averagingPeriod);
sections = FXCollections.observableArrayList();
areas = FXCollections.observableArrayList();
tickMarkSections = FXCollections.observableArrayList();
tickLabelSections = FXCollections.observableArrayList();
markers = FXCollections.observableArrayList();
_startFromZero = false;
_returnToZero = false;
_zeroColor = DARK_COLOR;
_minMeasuredValue = _maxValue;
_maxMeasuredValue = _minValue;
_minMeasuredValueVisible = false;
_maxMeasuredValueVisible = false;
_oldValueVisible = false;
_valueVisible = true;
_backgroundPaint = Color.TRANSPARENT;
_borderPaint = Color.TRANSPARENT;
_borderWidth = 1;
_foregroundPaint = Color.TRANSPARENT;
_knobColor = Color.rgb(204, 204, 204);
_knobType = KnobType.STANDARD;
_knobPosition = Pos.CENTER;
_knobVisible = true;
_animated = false;
animationDuration = 800;
_startAngle = 320;
_angleRange = 280;
_angleStep = _angleRange / _range;
_autoScale = true;
_shadowsEnabled = false;
_barEffectEnabled = false;
_scaleDirection = ScaleDirection.CLOCKWISE;
_tickLabelLocation = TickLabelLocation.INSIDE;
_tickLabelOrientation = TickLabelOrientation.HORIZONTAL;
_tickLabelColor = DARK_COLOR;
_tickMarkColor = DARK_COLOR;
_majorTickMarkColor = DARK_COLOR;
_majorTickMarkLengthFactor = 0.42;
_majorTickMarkWidthFactor = 0.275;
_mediumTickMarkColor = DARK_COLOR;
_mediumTickMarkLengthFactor = 0.41;
_mediumTickMarkWidthFactor = 0.175;
_minorTickMarkColor = DARK_COLOR;
_minorTickMarkLengthFactor = 0.40;
_minorTickMarkWidthFactor = 0.1125;
_majorTickMarkType = TickMarkType.LINE;
_mediumTickMarkType = TickMarkType.LINE;
_minorTickMarkType = TickMarkType.LINE;
_locale = Locale.US;
_decimals = 1;
_tickLabelDecimals = 0;
_needleType = NeedleType.STANDARD;
_needleShape = NeedleShape.ANGLED;
_needleSize = NeedleSize.STANDARD;
_needleBehavior = NeedleBehavior.STANDARD;
_needleColor = Color.rgb(200, 0, 0);
_needleBorderColor = Color.TRANSPARENT;
_barColor = BRIGHT_COLOR;
_barBorderColor = Color.TRANSPARENT;
_barBackgroundColor = DARK_COLOR;
_lcdDesign = LcdDesign.STANDARD;
_lcdFont = LcdFont.DIGITAL_BOLD;
_ledColor = Color.RED;
_ledType = LedType.STANDARD;
_titleColor = DARK_COLOR;
_subTitleColor = DARK_COLOR;
_unitColor = DARK_COLOR;
_valueColor = DARK_COLOR;
_thresholdColor = Color.CRIMSON;
_averageColor = Color.MAGENTA;
_checkSectionsForValue = false;
_checkAreasForValue = false;
_checkThreshold = false;
_innerShadowEnabled = false;
_thresholdVisible = false;
_averageVisible = false;
_sectionsVisible = false;
_sectionsAlwaysVisible = false;
_sectionTextVisible = false;
_sectionIconsVisible = false;
_highlightSections = false;
_areasVisible = false;
_areaTextVisible = false;
_areaIconsVisible = false;
_highlightAreas = false;
_tickMarkSectionsVisible = false;
_tickLabelSectionsVisible = false;
_markersVisible = false;
_tickLabelsVisible = true;
_onlyFirstAndLastTickLabelVisible = false;
_majorTickMarksVisible = true;
_mediumTickMarksVisible = true;
_minorTickMarksVisible = true;
_tickMarkRingVisible = false;
_majorTickSpace = 10;
_minorTickSpace = 1;
_lcdVisible = false;
_lcdCrystalEnabled = false;
_ledVisible = false;
_ledOn = false;
_ledBlinking = false;
_orientation = Orientation.HORIZONTAL;
_gradientBarEnabled = false;
_customTickLabelsEnabled = false;
customTickLabels = FXCollections.observableArrayList();
_customTickLabelFontSize = 18;
_interactive = false;
_buttonTooltipText = "";
_keepAspect = true;
_customFontEnabled = false;
_customFont = Fonts.robotoRegular(12);
_alert = false;
_alertMessage = "";
_smoothing = false;
formatString = "%.2f";
originalMinValue = -Double.MAX_VALUE;
originalMaxValue = Double.MAX_VALUE;
originalThreshold = Double.MAX_VALUE;
lastCall = Instant.now();
timeline = new Timeline();
timeline.setOnFinished(e -> {
if (isReturnToZero() && Double.compare(currentValue.get(), 0.0) != 0.0) {
final KeyValue KEY_VALUE2 = new KeyValue(value, 0, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
final KeyFrame KEY_FRAME2 = new KeyFrame(Duration.millis((long) (0.8 * getAnimationDuration())), KEY_VALUE2);
timeline.getKeyFrames().setAll(KEY_FRAME2);
timeline.play();
}
fireUpdateEvent(FINISHED_EVENT);
});
} } | public class class_name {
private void init() {
_minValue = 0;
_maxValue = 100;
value = new DoublePropertyBase(_minValue) {
@Override protected void invalidated() {
final double VALUE = get();
withinSpeedLimit = !(Instant.now().minusMillis(getAnimationDuration()).isBefore(lastCall));
lastCall = Instant.now();
if (isAnimated() && withinSpeedLimit) {
long animationDuration = isReturnToZero() ? (long) (0.2 * getAnimationDuration()) : getAnimationDuration();
timeline.stop(); // depends on control dependency: [if], data = [none]
final KeyValue KEY_VALUE;
if (NeedleBehavior.STANDARD == getNeedleBehavior()) {
KEY_VALUE = new KeyValue(currentValue, VALUE, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0)); // depends on control dependency: [if], data = [none]
} else { // Optimized only useful in a gauge where the angle range is 360 deg and the shorter way has to be calculated.
double ov = getOldValue();
double min = getMinValue();
double max = getMaxValue();
double halfRange = getRange() * 0.5;
double cv = getCurrentValue();
double delta = VALUE - getCurrentValue();
if (delta < -halfRange) {
double kv1 = max - cv;
double kv2 = VALUE;
} else if (delta > halfRange) {
}
double tmpValue;
if (Math.abs(VALUE - ov) > getRange() * 0.5) {
if (ov < VALUE) {
tmpValue = min - max + VALUE; // depends on control dependency: [if], data = [none]
} else {
tmpValue = ov + max - ov + min + VALUE - getRange(); // depends on control dependency: [if], data = [none]
}
KEY_VALUE = new KeyValue(currentValue, tmpValue, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0)); // depends on control dependency: [if], data = [none]
} else {
if (cv < min) currentValue.set(max + cv);
KEY_VALUE = new KeyValue(currentValue, VALUE, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0)); // depends on control dependency: [if], data = [none]
}
}
final KeyFrame KEY_FRAME = new KeyFrame(Duration.millis(animationDuration), KEY_VALUE);
timeline.getKeyFrames().setAll(KEY_FRAME); // depends on control dependency: [if], data = [none]
timeline.play(); // depends on control dependency: [if], data = [none]
} else {
currentValue.set(VALUE); // depends on control dependency: [if], data = [none]
fireUpdateEvent(FINISHED_EVENT); // depends on control dependency: [if], data = [none]
}
if (isAveragingEnabled()) { movingAverage.addData(new Data(VALUE)); } // depends on control dependency: [if], data = [none]
}
@Override public void set(final double VALUE) {
super.set(VALUE);
fireUpdateEvent(VALUE_EVENT);
}
@Override public Object getBean() { return Gauge.this; }
@Override public String getName() { return "value"; }
};
oldValue = new SimpleDoubleProperty(Gauge.this, "oldValue", value.get());
currentValue = new DoublePropertyBase(value.get()) {
@Override protected void invalidated() {
final double VALUE = get();
if (isCheckThreshold()) {
double thrshld = getThreshold();
if (formerValue.get() < thrshld && VALUE > thrshld) {
fireEvent(EXCEEDED_EVENT); // depends on control dependency: [if], data = [none]
} else if (formerValue.get() > thrshld && VALUE < thrshld) {
fireEvent(UNDERRUN_EVENT); // depends on control dependency: [if], data = [none]
}
}
if (VALUE < getMinMeasuredValue()) {
setMinMeasuredValue(VALUE); // depends on control dependency: [if], data = [(VALUE]
} else if (VALUE > getMaxMeasuredValue()) {
setMaxMeasuredValue(VALUE); // depends on control dependency: [if], data = [(VALUE]
}
formerValue.set(VALUE);
}
@Override public void set(final double VALUE) { super.set(VALUE); }
@Override public Object getBean() { return Gauge.this; }
@Override public String getName() { return "currentValue";}
};
formerValue = new SimpleDoubleProperty(Gauge.this, "formerValue", value.get());
_range = _maxValue - _minValue;
_threshold = _maxValue;
_title = "";
_subTitle = "";
_unit = "";
_averagingEnabled = false;
_averagingPeriod = 10;
movingAverage = new MovingAverage(_averagingPeriod);
sections = FXCollections.observableArrayList();
areas = FXCollections.observableArrayList();
tickMarkSections = FXCollections.observableArrayList();
tickLabelSections = FXCollections.observableArrayList();
markers = FXCollections.observableArrayList();
_startFromZero = false;
_returnToZero = false;
_zeroColor = DARK_COLOR;
_minMeasuredValue = _maxValue;
_maxMeasuredValue = _minValue;
_minMeasuredValueVisible = false;
_maxMeasuredValueVisible = false;
_oldValueVisible = false;
_valueVisible = true;
_backgroundPaint = Color.TRANSPARENT;
_borderPaint = Color.TRANSPARENT;
_borderWidth = 1;
_foregroundPaint = Color.TRANSPARENT;
_knobColor = Color.rgb(204, 204, 204);
_knobType = KnobType.STANDARD;
_knobPosition = Pos.CENTER;
_knobVisible = true;
_animated = false;
animationDuration = 800;
_startAngle = 320;
_angleRange = 280;
_angleStep = _angleRange / _range;
_autoScale = true;
_shadowsEnabled = false;
_barEffectEnabled = false;
_scaleDirection = ScaleDirection.CLOCKWISE;
_tickLabelLocation = TickLabelLocation.INSIDE;
_tickLabelOrientation = TickLabelOrientation.HORIZONTAL;
_tickLabelColor = DARK_COLOR;
_tickMarkColor = DARK_COLOR;
_majorTickMarkColor = DARK_COLOR;
_majorTickMarkLengthFactor = 0.42;
_majorTickMarkWidthFactor = 0.275;
_mediumTickMarkColor = DARK_COLOR;
_mediumTickMarkLengthFactor = 0.41;
_mediumTickMarkWidthFactor = 0.175;
_minorTickMarkColor = DARK_COLOR;
_minorTickMarkLengthFactor = 0.40;
_minorTickMarkWidthFactor = 0.1125;
_majorTickMarkType = TickMarkType.LINE;
_mediumTickMarkType = TickMarkType.LINE;
_minorTickMarkType = TickMarkType.LINE;
_locale = Locale.US;
_decimals = 1;
_tickLabelDecimals = 0;
_needleType = NeedleType.STANDARD;
_needleShape = NeedleShape.ANGLED;
_needleSize = NeedleSize.STANDARD;
_needleBehavior = NeedleBehavior.STANDARD;
_needleColor = Color.rgb(200, 0, 0);
_needleBorderColor = Color.TRANSPARENT;
_barColor = BRIGHT_COLOR;
_barBorderColor = Color.TRANSPARENT;
_barBackgroundColor = DARK_COLOR;
_lcdDesign = LcdDesign.STANDARD;
_lcdFont = LcdFont.DIGITAL_BOLD;
_ledColor = Color.RED;
_ledType = LedType.STANDARD;
_titleColor = DARK_COLOR;
_subTitleColor = DARK_COLOR;
_unitColor = DARK_COLOR;
_valueColor = DARK_COLOR;
_thresholdColor = Color.CRIMSON;
_averageColor = Color.MAGENTA;
_checkSectionsForValue = false;
_checkAreasForValue = false;
_checkThreshold = false;
_innerShadowEnabled = false;
_thresholdVisible = false;
_averageVisible = false;
_sectionsVisible = false;
_sectionsAlwaysVisible = false;
_sectionTextVisible = false;
_sectionIconsVisible = false;
_highlightSections = false;
_areasVisible = false;
_areaTextVisible = false;
_areaIconsVisible = false;
_highlightAreas = false;
_tickMarkSectionsVisible = false;
_tickLabelSectionsVisible = false;
_markersVisible = false;
_tickLabelsVisible = true;
_onlyFirstAndLastTickLabelVisible = false;
_majorTickMarksVisible = true;
_mediumTickMarksVisible = true;
_minorTickMarksVisible = true;
_tickMarkRingVisible = false;
_majorTickSpace = 10;
_minorTickSpace = 1;
_lcdVisible = false;
_lcdCrystalEnabled = false;
_ledVisible = false;
_ledOn = false;
_ledBlinking = false;
_orientation = Orientation.HORIZONTAL;
_gradientBarEnabled = false;
_customTickLabelsEnabled = false;
customTickLabels = FXCollections.observableArrayList();
_customTickLabelFontSize = 18;
_interactive = false;
_buttonTooltipText = "";
_keepAspect = true;
_customFontEnabled = false;
_customFont = Fonts.robotoRegular(12);
_alert = false;
_alertMessage = "";
_smoothing = false;
formatString = "%.2f";
originalMinValue = -Double.MAX_VALUE;
originalMaxValue = Double.MAX_VALUE;
originalThreshold = Double.MAX_VALUE;
lastCall = Instant.now();
timeline = new Timeline();
timeline.setOnFinished(e -> {
if (isReturnToZero() && Double.compare(currentValue.get(), 0.0) != 0.0) {
final KeyValue KEY_VALUE2 = new KeyValue(value, 0, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
final KeyFrame KEY_FRAME2 = new KeyFrame(Duration.millis((long) (0.8 * getAnimationDuration())), KEY_VALUE2);
timeline.getKeyFrames().setAll(KEY_FRAME2);
timeline.play();
}
fireUpdateEvent(FINISHED_EVENT);
});
} } |
public class class_name {
public final EObject ruleXCasePart() throws RecognitionException {
EObject current = null;
Token otherlv_2=null;
Token otherlv_4=null;
Token lv_fallThrough_6_0=null;
EObject lv_typeGuard_1_0 = null;
EObject lv_case_3_0 = null;
EObject lv_then_5_0 = null;
enterRule();
try {
// InternalPureXbase.g:3853:2: ( ( () ( (lv_typeGuard_1_0= ruleJvmTypeReference ) )? (otherlv_2= 'case' ( (lv_case_3_0= ruleXExpression ) ) )? ( (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) ) | ( (lv_fallThrough_6_0= ',' ) ) ) ) )
// InternalPureXbase.g:3854:2: ( () ( (lv_typeGuard_1_0= ruleJvmTypeReference ) )? (otherlv_2= 'case' ( (lv_case_3_0= ruleXExpression ) ) )? ( (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) ) | ( (lv_fallThrough_6_0= ',' ) ) ) )
{
// InternalPureXbase.g:3854:2: ( () ( (lv_typeGuard_1_0= ruleJvmTypeReference ) )? (otherlv_2= 'case' ( (lv_case_3_0= ruleXExpression ) ) )? ( (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) ) | ( (lv_fallThrough_6_0= ',' ) ) ) )
// InternalPureXbase.g:3855:3: () ( (lv_typeGuard_1_0= ruleJvmTypeReference ) )? (otherlv_2= 'case' ( (lv_case_3_0= ruleXExpression ) ) )? ( (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) ) | ( (lv_fallThrough_6_0= ',' ) ) )
{
// InternalPureXbase.g:3855:3: ()
// InternalPureXbase.g:3856:4:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXCasePartAccess().getXCasePartAction_0(),
current);
}
}
// InternalPureXbase.g:3862:3: ( (lv_typeGuard_1_0= ruleJvmTypeReference ) )?
int alt69=2;
int LA69_0 = input.LA(1);
if ( (LA69_0==RULE_ID||LA69_0==15||LA69_0==41) ) {
alt69=1;
}
switch (alt69) {
case 1 :
// InternalPureXbase.g:3863:4: (lv_typeGuard_1_0= ruleJvmTypeReference )
{
// InternalPureXbase.g:3863:4: (lv_typeGuard_1_0= ruleJvmTypeReference )
// InternalPureXbase.g:3864:5: lv_typeGuard_1_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXCasePartAccess().getTypeGuardJvmTypeReferenceParserRuleCall_1_0());
}
pushFollow(FOLLOW_55);
lv_typeGuard_1_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXCasePartRule());
}
set(
current,
"typeGuard",
lv_typeGuard_1_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference");
afterParserOrEnumRuleCall();
}
}
}
break;
}
// InternalPureXbase.g:3881:3: (otherlv_2= 'case' ( (lv_case_3_0= ruleXExpression ) ) )?
int alt70=2;
int LA70_0 = input.LA(1);
if ( (LA70_0==68) ) {
alt70=1;
}
switch (alt70) {
case 1 :
// InternalPureXbase.g:3882:4: otherlv_2= 'case' ( (lv_case_3_0= ruleXExpression ) )
{
otherlv_2=(Token)match(input,68,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXCasePartAccess().getCaseKeyword_2_0());
}
// InternalPureXbase.g:3886:4: ( (lv_case_3_0= ruleXExpression ) )
// InternalPureXbase.g:3887:5: (lv_case_3_0= ruleXExpression )
{
// InternalPureXbase.g:3887:5: (lv_case_3_0= ruleXExpression )
// InternalPureXbase.g:3888:6: lv_case_3_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXCasePartAccess().getCaseXExpressionParserRuleCall_2_1_0());
}
pushFollow(FOLLOW_56);
lv_case_3_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXCasePartRule());
}
set(
current,
"case",
lv_case_3_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
}
break;
}
// InternalPureXbase.g:3906:3: ( (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) ) | ( (lv_fallThrough_6_0= ',' ) ) )
int alt71=2;
int LA71_0 = input.LA(1);
if ( (LA71_0==22) ) {
alt71=1;
}
else if ( (LA71_0==57) ) {
alt71=2;
}
else {
if (state.backtracking>0) {state.failed=true; return current;}
NoViableAltException nvae =
new NoViableAltException("", 71, 0, input);
throw nvae;
}
switch (alt71) {
case 1 :
// InternalPureXbase.g:3907:4: (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) )
{
// InternalPureXbase.g:3907:4: (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) )
// InternalPureXbase.g:3908:5: otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) )
{
otherlv_4=(Token)match(input,22,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getXCasePartAccess().getColonKeyword_3_0_0());
}
// InternalPureXbase.g:3912:5: ( (lv_then_5_0= ruleXExpression ) )
// InternalPureXbase.g:3913:6: (lv_then_5_0= ruleXExpression )
{
// InternalPureXbase.g:3913:6: (lv_then_5_0= ruleXExpression )
// InternalPureXbase.g:3914:7: lv_then_5_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXCasePartAccess().getThenXExpressionParserRuleCall_3_0_1_0());
}
pushFollow(FOLLOW_2);
lv_then_5_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXCasePartRule());
}
set(
current,
"then",
lv_then_5_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
}
}
break;
case 2 :
// InternalPureXbase.g:3933:4: ( (lv_fallThrough_6_0= ',' ) )
{
// InternalPureXbase.g:3933:4: ( (lv_fallThrough_6_0= ',' ) )
// InternalPureXbase.g:3934:5: (lv_fallThrough_6_0= ',' )
{
// InternalPureXbase.g:3934:5: (lv_fallThrough_6_0= ',' )
// InternalPureXbase.g:3935:6: lv_fallThrough_6_0= ','
{
lv_fallThrough_6_0=(Token)match(input,57,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_fallThrough_6_0, grammarAccess.getXCasePartAccess().getFallThroughCommaKeyword_3_1_0());
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXCasePartRule());
}
setWithLastConsumed(current, "fallThrough", true, ",");
}
}
}
}
break;
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleXCasePart() throws RecognitionException {
EObject current = null;
Token otherlv_2=null;
Token otherlv_4=null;
Token lv_fallThrough_6_0=null;
EObject lv_typeGuard_1_0 = null;
EObject lv_case_3_0 = null;
EObject lv_then_5_0 = null;
enterRule();
try {
// InternalPureXbase.g:3853:2: ( ( () ( (lv_typeGuard_1_0= ruleJvmTypeReference ) )? (otherlv_2= 'case' ( (lv_case_3_0= ruleXExpression ) ) )? ( (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) ) | ( (lv_fallThrough_6_0= ',' ) ) ) ) )
// InternalPureXbase.g:3854:2: ( () ( (lv_typeGuard_1_0= ruleJvmTypeReference ) )? (otherlv_2= 'case' ( (lv_case_3_0= ruleXExpression ) ) )? ( (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) ) | ( (lv_fallThrough_6_0= ',' ) ) ) )
{
// InternalPureXbase.g:3854:2: ( () ( (lv_typeGuard_1_0= ruleJvmTypeReference ) )? (otherlv_2= 'case' ( (lv_case_3_0= ruleXExpression ) ) )? ( (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) ) | ( (lv_fallThrough_6_0= ',' ) ) ) )
// InternalPureXbase.g:3855:3: () ( (lv_typeGuard_1_0= ruleJvmTypeReference ) )? (otherlv_2= 'case' ( (lv_case_3_0= ruleXExpression ) ) )? ( (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) ) | ( (lv_fallThrough_6_0= ',' ) ) )
{
// InternalPureXbase.g:3855:3: ()
// InternalPureXbase.g:3856:4:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXCasePartAccess().getXCasePartAction_0(),
current); // depends on control dependency: [if], data = [none]
}
}
// InternalPureXbase.g:3862:3: ( (lv_typeGuard_1_0= ruleJvmTypeReference ) )?
int alt69=2;
int LA69_0 = input.LA(1);
if ( (LA69_0==RULE_ID||LA69_0==15||LA69_0==41) ) {
alt69=1; // depends on control dependency: [if], data = [none]
}
switch (alt69) {
case 1 :
// InternalPureXbase.g:3863:4: (lv_typeGuard_1_0= ruleJvmTypeReference )
{
// InternalPureXbase.g:3863:4: (lv_typeGuard_1_0= ruleJvmTypeReference )
// InternalPureXbase.g:3864:5: lv_typeGuard_1_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXCasePartAccess().getTypeGuardJvmTypeReferenceParserRuleCall_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_55);
lv_typeGuard_1_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXCasePartRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"typeGuard",
lv_typeGuard_1_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
break;
}
// InternalPureXbase.g:3881:3: (otherlv_2= 'case' ( (lv_case_3_0= ruleXExpression ) ) )?
int alt70=2;
int LA70_0 = input.LA(1);
if ( (LA70_0==68) ) {
alt70=1; // depends on control dependency: [if], data = [none]
}
switch (alt70) {
case 1 :
// InternalPureXbase.g:3882:4: otherlv_2= 'case' ( (lv_case_3_0= ruleXExpression ) )
{
otherlv_2=(Token)match(input,68,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXCasePartAccess().getCaseKeyword_2_0()); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:3886:4: ( (lv_case_3_0= ruleXExpression ) )
// InternalPureXbase.g:3887:5: (lv_case_3_0= ruleXExpression )
{
// InternalPureXbase.g:3887:5: (lv_case_3_0= ruleXExpression )
// InternalPureXbase.g:3888:6: lv_case_3_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXCasePartAccess().getCaseXExpressionParserRuleCall_2_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_56);
lv_case_3_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXCasePartRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"case",
lv_case_3_0,
"org.eclipse.xtext.xbase.Xbase.XExpression"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
}
// InternalPureXbase.g:3906:3: ( (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) ) | ( (lv_fallThrough_6_0= ',' ) ) )
int alt71=2;
int LA71_0 = input.LA(1);
if ( (LA71_0==22) ) {
alt71=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA71_0==57) ) {
alt71=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("", 71, 0, input);
throw nvae;
}
switch (alt71) {
case 1 :
// InternalPureXbase.g:3907:4: (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) )
{
// InternalPureXbase.g:3907:4: (otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) ) )
// InternalPureXbase.g:3908:5: otherlv_4= ':' ( (lv_then_5_0= ruleXExpression ) )
{
otherlv_4=(Token)match(input,22,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getXCasePartAccess().getColonKeyword_3_0_0()); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:3912:5: ( (lv_then_5_0= ruleXExpression ) )
// InternalPureXbase.g:3913:6: (lv_then_5_0= ruleXExpression )
{
// InternalPureXbase.g:3913:6: (lv_then_5_0= ruleXExpression )
// InternalPureXbase.g:3914:7: lv_then_5_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXCasePartAccess().getThenXExpressionParserRuleCall_3_0_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_2);
lv_then_5_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXCasePartRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"then",
lv_then_5_0,
"org.eclipse.xtext.xbase.Xbase.XExpression"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
break;
case 2 :
// InternalPureXbase.g:3933:4: ( (lv_fallThrough_6_0= ',' ) )
{
// InternalPureXbase.g:3933:4: ( (lv_fallThrough_6_0= ',' ) )
// InternalPureXbase.g:3934:5: (lv_fallThrough_6_0= ',' )
{
// InternalPureXbase.g:3934:5: (lv_fallThrough_6_0= ',' )
// InternalPureXbase.g:3935:6: lv_fallThrough_6_0= ','
{
lv_fallThrough_6_0=(Token)match(input,57,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(lv_fallThrough_6_0, grammarAccess.getXCasePartAccess().getFallThroughCommaKeyword_3_1_0()); // depends on control dependency: [if], data = [none]
}
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXCasePartRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "fallThrough", true, ","); // 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 {
public static ImmutableList<JClassType> filterSubtypesForDeserialization( TreeLogger logger, RebindConfiguration configuration,
JClassType type ) {
boolean filterOnlySupportedType = isObjectOrSerializable( type );
ImmutableList.Builder<JClassType> builder = ImmutableList.builder();
if ( type.getSubtypes().length > 0 ) {
for ( JClassType subtype : type.getSubtypes() ) {
if ( (null == subtype.isInterface() && !subtype.isAbstract() && (!subtype.isMemberType() || subtype.isStatic()))
&& null == subtype.isAnnotation()
&& subtype.isPublic()
&& (!filterOnlySupportedType ||
(configuration.isTypeSupportedForDeserialization( logger, subtype )
// EnumSet and EnumMap are not supported in subtype deserialization because we can't know the enum to use.
&& !EnumSet.class.getCanonicalName().equals( subtype.getQualifiedSourceName() )
&& !EnumMap.class.getCanonicalName().equals( subtype.getQualifiedSourceName() )))
&& !findFirstEncounteredAnnotationsOnAllHierarchy( configuration, subtype.isClassOrInterface(), JsonIgnoreType.class, Optional.of( type ) ).isPresent() ) {
builder.add( subtype );
}
}
}
return builder.build();
} } | public class class_name {
public static ImmutableList<JClassType> filterSubtypesForDeserialization( TreeLogger logger, RebindConfiguration configuration,
JClassType type ) {
boolean filterOnlySupportedType = isObjectOrSerializable( type );
ImmutableList.Builder<JClassType> builder = ImmutableList.builder();
if ( type.getSubtypes().length > 0 ) {
for ( JClassType subtype : type.getSubtypes() ) {
if ( (null == subtype.isInterface() && !subtype.isAbstract() && (!subtype.isMemberType() || subtype.isStatic()))
&& null == subtype.isAnnotation()
&& subtype.isPublic()
&& (!filterOnlySupportedType ||
(configuration.isTypeSupportedForDeserialization( logger, subtype )
// EnumSet and EnumMap are not supported in subtype deserialization because we can't know the enum to use.
&& !EnumSet.class.getCanonicalName().equals( subtype.getQualifiedSourceName() )
&& !EnumMap.class.getCanonicalName().equals( subtype.getQualifiedSourceName() )))
&& !findFirstEncounteredAnnotationsOnAllHierarchy( configuration, subtype.isClassOrInterface(), JsonIgnoreType.class, Optional.of( type ) ).isPresent() ) {
builder.add( subtype ); // depends on control dependency: [if], data = [none]
}
}
}
return builder.build();
} } |
public class class_name {
public void setText(final String TEXT) {
if (null == text) {
_text = TEXT;
fireUpdateEvent(REDRAW_EVENT);
} else {
text.set(TEXT);
}
} } | public class class_name {
public void setText(final String TEXT) {
if (null == text) {
_text = TEXT; // depends on control dependency: [if], data = [none]
fireUpdateEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none]
} else {
text.set(TEXT); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String removeAllWhitespaces(final String string) {
if (string == null || string.length() == 0) {
return string;
}
final int originalSize = string.length();
final char[] charArray = new char[originalSize];
int charCount = 0;
for (int i = 0; i < originalSize; i++) {
final char currentChar = string.charAt(i);
if (!Character.isWhitespace(currentChar)) {
charArray[charCount++] = currentChar;
}
}
if (charCount == originalSize) {
return string;
}
return new String(charArray, 0, charCount);
} } | public class class_name {
public static String removeAllWhitespaces(final String string) {
if (string == null || string.length() == 0) {
return string; // depends on control dependency: [if], data = [none]
}
final int originalSize = string.length();
final char[] charArray = new char[originalSize];
int charCount = 0;
for (int i = 0; i < originalSize; i++) {
final char currentChar = string.charAt(i);
if (!Character.isWhitespace(currentChar)) {
charArray[charCount++] = currentChar; // depends on control dependency: [if], data = [none]
}
}
if (charCount == originalSize) {
return string; // depends on control dependency: [if], data = [none]
}
return new String(charArray, 0, charCount);
} } |
public class class_name {
static void publishEntryEvent(QueryCacheContext context, String mapName,
String cacheId, Data dataKey, Data dataNewValue,
QueryCacheRecord oldRecord, EntryEventType eventType,
Extractors extractors) {
if (!hasListener(context, mapName, cacheId)) {
return;
}
QueryCacheEventService eventService = getQueryCacheEventService(context);
Object oldValue = getOldValue(oldRecord);
LocalEntryEventData eventData = createLocalEntryEventData(cacheId, dataKey, dataNewValue, oldValue,
eventType.getType(), -1, context);
eventService.publish(mapName, cacheId, eventData, dataKey.hashCode(), extractors);
} } | public class class_name {
static void publishEntryEvent(QueryCacheContext context, String mapName,
String cacheId, Data dataKey, Data dataNewValue,
QueryCacheRecord oldRecord, EntryEventType eventType,
Extractors extractors) {
if (!hasListener(context, mapName, cacheId)) {
return; // depends on control dependency: [if], data = [none]
}
QueryCacheEventService eventService = getQueryCacheEventService(context);
Object oldValue = getOldValue(oldRecord);
LocalEntryEventData eventData = createLocalEntryEventData(cacheId, dataKey, dataNewValue, oldValue,
eventType.getType(), -1, context);
eventService.publish(mapName, cacheId, eventData, dataKey.hashCode(), extractors);
} } |
public class class_name {
public static <T> T onUiSync(Func<T> func) {
if (Looper.myLooper() == Looper.getMainLooper()) {
return func.call();
}
FuncSyncTask<T> poster = new FuncSyncTask<T>(func);
getUiPoster().sync(poster);
return poster.waitRun();
} } | public class class_name {
public static <T> T onUiSync(Func<T> func) {
if (Looper.myLooper() == Looper.getMainLooper()) {
return func.call(); // depends on control dependency: [if], data = [none]
}
FuncSyncTask<T> poster = new FuncSyncTask<T>(func);
getUiPoster().sync(poster);
return poster.waitRun();
} } |
public class class_name {
private Publisher<List<String>> convertServiceIds(ListServicesResult listServicesResult) {
List<ServiceSummary> services = listServicesResult.getServices();
List<String> serviceIds = new ArrayList<>();
for (ServiceSummary service : services) {
serviceIds.add(service.getId());
}
return Publishers.just(
serviceIds
);
} } | public class class_name {
private Publisher<List<String>> convertServiceIds(ListServicesResult listServicesResult) {
List<ServiceSummary> services = listServicesResult.getServices();
List<String> serviceIds = new ArrayList<>();
for (ServiceSummary service : services) {
serviceIds.add(service.getId()); // depends on control dependency: [for], data = [service]
}
return Publishers.just(
serviceIds
);
} } |
public class class_name {
public static boolean hasActiveQuorum(
final ClusterMember[] clusterMembers, final long nowMs, final long timeoutMs)
{
int threshold = quorumThreshold(clusterMembers.length);
for (final ClusterMember member : clusterMembers)
{
if (member.isLeader() || nowMs <= (member.timeOfLastAppendPositionMs() + timeoutMs))
{
if (--threshold <= 0)
{
return true;
}
}
}
return false;
} } | public class class_name {
public static boolean hasActiveQuorum(
final ClusterMember[] clusterMembers, final long nowMs, final long timeoutMs)
{
int threshold = quorumThreshold(clusterMembers.length);
for (final ClusterMember member : clusterMembers)
{
if (member.isLeader() || nowMs <= (member.timeOfLastAppendPositionMs() + timeoutMs))
{
if (--threshold <= 0)
{
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
static ManagedChannelServiceConfig fromServiceConfig(
Map<String, ?> serviceConfig,
boolean retryEnabled,
int maxRetryAttemptsLimit,
int maxHedgedAttemptsLimit,
@Nullable Object loadBalancingConfig) {
Throttle retryThrottling = null;
if (retryEnabled) {
retryThrottling = ServiceConfigUtil.getThrottlePolicy(serviceConfig);
}
Map<String, MethodInfo> serviceMethodMap = new HashMap<>();
Map<String, MethodInfo> serviceMap = new HashMap<>();
// Try and do as much validation here before we swap out the existing configuration. In case
// the input is invalid, we don't want to lose the existing configuration.
List<Map<String, ?>> methodConfigs =
ServiceConfigUtil.getMethodConfigFromServiceConfig(serviceConfig);
if (methodConfigs == null) {
// this is surprising, but possible.
return new ManagedChannelServiceConfig(
serviceMethodMap, serviceMap, retryThrottling, loadBalancingConfig);
}
for (Map<String, ?> methodConfig : methodConfigs) {
MethodInfo info = new MethodInfo(
methodConfig, retryEnabled, maxRetryAttemptsLimit, maxHedgedAttemptsLimit);
List<Map<String, ?>> nameList =
ServiceConfigUtil.getNameListFromMethodConfig(methodConfig);
checkArgument(
nameList != null && !nameList.isEmpty(), "no names in method config %s", methodConfig);
for (Map<String, ?> name : nameList) {
String serviceName = ServiceConfigUtil.getServiceFromName(name);
checkArgument(!Strings.isNullOrEmpty(serviceName), "missing service name");
String methodName = ServiceConfigUtil.getMethodFromName(name);
if (Strings.isNullOrEmpty(methodName)) {
// Service scoped config
checkArgument(
!serviceMap.containsKey(serviceName), "Duplicate service %s", serviceName);
serviceMap.put(serviceName, info);
} else {
// Method scoped config
String fullMethodName = MethodDescriptor.generateFullMethodName(serviceName, methodName);
checkArgument(
!serviceMethodMap.containsKey(fullMethodName),
"Duplicate method name %s",
fullMethodName);
serviceMethodMap.put(fullMethodName, info);
}
}
}
return new ManagedChannelServiceConfig(
serviceMethodMap, serviceMap, retryThrottling, loadBalancingConfig);
} } | public class class_name {
static ManagedChannelServiceConfig fromServiceConfig(
Map<String, ?> serviceConfig,
boolean retryEnabled,
int maxRetryAttemptsLimit,
int maxHedgedAttemptsLimit,
@Nullable Object loadBalancingConfig) {
Throttle retryThrottling = null;
if (retryEnabled) {
retryThrottling = ServiceConfigUtil.getThrottlePolicy(serviceConfig); // depends on control dependency: [if], data = [none]
}
Map<String, MethodInfo> serviceMethodMap = new HashMap<>();
Map<String, MethodInfo> serviceMap = new HashMap<>();
// Try and do as much validation here before we swap out the existing configuration. In case
// the input is invalid, we don't want to lose the existing configuration.
List<Map<String, ?>> methodConfigs =
ServiceConfigUtil.getMethodConfigFromServiceConfig(serviceConfig);
if (methodConfigs == null) {
// this is surprising, but possible.
return new ManagedChannelServiceConfig(
serviceMethodMap, serviceMap, retryThrottling, loadBalancingConfig); // depends on control dependency: [if], data = [none]
}
for (Map<String, ?> methodConfig : methodConfigs) {
MethodInfo info = new MethodInfo(
methodConfig, retryEnabled, maxRetryAttemptsLimit, maxHedgedAttemptsLimit);
List<Map<String, ?>> nameList =
ServiceConfigUtil.getNameListFromMethodConfig(methodConfig); // depends on control dependency: [for], data = [none]
checkArgument(
nameList != null && !nameList.isEmpty(), "no names in method config %s", methodConfig); // depends on control dependency: [for], data = [none]
for (Map<String, ?> name : nameList) {
String serviceName = ServiceConfigUtil.getServiceFromName(name);
checkArgument(!Strings.isNullOrEmpty(serviceName), "missing service name"); // depends on control dependency: [for], data = [name]
String methodName = ServiceConfigUtil.getMethodFromName(name);
if (Strings.isNullOrEmpty(methodName)) {
// Service scoped config
checkArgument(
!serviceMap.containsKey(serviceName), "Duplicate service %s", serviceName); // depends on control dependency: [if], data = [none]
serviceMap.put(serviceName, info); // depends on control dependency: [if], data = [none]
} else {
// Method scoped config
String fullMethodName = MethodDescriptor.generateFullMethodName(serviceName, methodName);
checkArgument(
!serviceMethodMap.containsKey(fullMethodName),
"Duplicate method name %s",
fullMethodName); // depends on control dependency: [if], data = [none]
serviceMethodMap.put(fullMethodName, info); // depends on control dependency: [if], data = [none]
}
}
}
return new ManagedChannelServiceConfig(
serviceMethodMap, serviceMap, retryThrottling, loadBalancingConfig);
} } |
public class class_name {
@Override
public String queryValue(String name, Object value) {
if (value == null) {
return null;
} else if (value instanceof Boolean) {
return (Boolean) value ? TRUE : FALSE;
} else {
return value.toString();
}
} } | public class class_name {
@Override
public String queryValue(String name, Object value) {
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
} else if (value instanceof Boolean) {
return (Boolean) value ? TRUE : FALSE; // depends on control dependency: [if], data = [none]
} else {
return value.toString(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void computeDensityEstimator(List<S> solutionList) {
int size = solutionList.size();
if (size <= solutionList.get(0).getNumberOfObjectives()) {
for (int x = 0; x < size; x++) {
solutionList.get(x).setAttribute(getAttributeID(), Double.POSITIVE_INFINITY);
}
return;
}
// Use a new SolutionSet to avoid altering the original solutionSet
List<S> front = new ArrayList<>(size);
for (S solution : solutionList) {
front.add(solution);
}
for (int i = 0; i < size; i++) {
front.get(i).setAttribute(getAttributeID(), 0.0);
}
int numberOfObjectives = solutionList.get(0).getNumberOfObjectives();
double objetiveMaxn[] = new double[numberOfObjectives];
double objetiveMinn[] = new double[numberOfObjectives];
double distan;
for (int i = 0; i < numberOfObjectives; i++) {
// Sort the population by Obj n
Collections.sort(front, new ObjectiveComparator<S>(i));
objetiveMinn[i] = front.get(0).getObjective(i);
objetiveMaxn[i] = front.get(front.size() - 1).getObjective(i);
// Set de crowding distance Los extremos si infinitos
front.get(0).setAttribute(getAttributeID(), Double.POSITIVE_INFINITY);
front.get(size - 1).setAttribute(getAttributeID(), Double.POSITIVE_INFINITY);
}
double[][] distance =
SolutionListUtils.distanceMatrix_normalize(front, objetiveMaxn, objetiveMinn);
double dminn, dmaxx;
dminn = Double.MAX_VALUE;
dmaxx = 0.0;
for (int i = 0; i < distance.length; i++)
for (int j = 0; j < distance.length; j++) {
if (i != j) {
if (distance[i][j] < dminn) {
dminn = distance[i][j];
}
if (distance[i][j] > dmaxx) {
dmaxx = distance[i][j];
}
}
}
for (int i = 0; i < front.size(); i++) {
double temp = 0.0;
for (int j = 0; j < distance.length; j++) {
if (i != j) {
temp += Math.pow(distance[i][j] - (dmaxx - dminn), 2);
}
}
temp /= distance.length - 1;
temp = Math.sqrt(temp);
temp *= -1;
temp += (double) front.get(i).getAttribute(getAttributeID());
// if((double) front.get(i).getAttribute(getAttributeID())!=Double.POSITIVE_INFINITY)
front.get(i).setAttribute(getAttributeID(), temp);
}
// int k = numberOfObjectives la solucion 0 es ella misma
for (int i = 0; i < distance.length; i++) {
Arrays.sort(distance[i]);
double kDistance = 0.0;
for (int k = numberOfObjectives; k > 0; k--) {
// kDistance += (dmaxx-dminn) / (distance[i][k]);//me gusta mas este
// kDistance += (dmaxx-dminn) / (distance[i][k]+dminn);//original
kDistance += (dmaxx - dminn) / distance[i][k];
}
double temp = (double) front.get(i).getAttribute(getAttributeID());
// if(temp!=Double.POSITIVE_INFINITY)
// kDistance=kDistance/numberOfObjectives-1;
temp -= kDistance;
front.get(i).setAttribute(getAttributeID(), temp);
}
} } | public class class_name {
@Override
public void computeDensityEstimator(List<S> solutionList) {
int size = solutionList.size();
if (size <= solutionList.get(0).getNumberOfObjectives()) {
for (int x = 0; x < size; x++) {
solutionList.get(x).setAttribute(getAttributeID(), Double.POSITIVE_INFINITY); // depends on control dependency: [for], data = [x]
}
return; // depends on control dependency: [if], data = [none]
}
// Use a new SolutionSet to avoid altering the original solutionSet
List<S> front = new ArrayList<>(size);
for (S solution : solutionList) {
front.add(solution); // depends on control dependency: [for], data = [solution]
}
for (int i = 0; i < size; i++) {
front.get(i).setAttribute(getAttributeID(), 0.0); // depends on control dependency: [for], data = [i]
}
int numberOfObjectives = solutionList.get(0).getNumberOfObjectives();
double objetiveMaxn[] = new double[numberOfObjectives];
double objetiveMinn[] = new double[numberOfObjectives];
double distan;
for (int i = 0; i < numberOfObjectives; i++) {
// Sort the population by Obj n
Collections.sort(front, new ObjectiveComparator<S>(i)); // depends on control dependency: [for], data = [i]
objetiveMinn[i] = front.get(0).getObjective(i); // depends on control dependency: [for], data = [i]
objetiveMaxn[i] = front.get(front.size() - 1).getObjective(i); // depends on control dependency: [for], data = [i]
// Set de crowding distance Los extremos si infinitos
front.get(0).setAttribute(getAttributeID(), Double.POSITIVE_INFINITY); // depends on control dependency: [for], data = [none]
front.get(size - 1).setAttribute(getAttributeID(), Double.POSITIVE_INFINITY); // depends on control dependency: [for], data = [none]
}
double[][] distance =
SolutionListUtils.distanceMatrix_normalize(front, objetiveMaxn, objetiveMinn);
double dminn, dmaxx;
dminn = Double.MAX_VALUE;
dmaxx = 0.0;
for (int i = 0; i < distance.length; i++)
for (int j = 0; j < distance.length; j++) {
if (i != j) {
if (distance[i][j] < dminn) {
dminn = distance[i][j]; // depends on control dependency: [if], data = [none]
}
if (distance[i][j] > dmaxx) {
dmaxx = distance[i][j]; // depends on control dependency: [if], data = [none]
}
}
}
for (int i = 0; i < front.size(); i++) {
double temp = 0.0;
for (int j = 0; j < distance.length; j++) {
if (i != j) {
temp += Math.pow(distance[i][j] - (dmaxx - dminn), 2); // depends on control dependency: [if], data = [none]
}
}
temp /= distance.length - 1; // depends on control dependency: [for], data = [none]
temp = Math.sqrt(temp); // depends on control dependency: [for], data = [none]
temp *= -1; // depends on control dependency: [for], data = [none]
temp += (double) front.get(i).getAttribute(getAttributeID()); // depends on control dependency: [for], data = [i]
// if((double) front.get(i).getAttribute(getAttributeID())!=Double.POSITIVE_INFINITY)
front.get(i).setAttribute(getAttributeID(), temp); // depends on control dependency: [for], data = [i]
}
// int k = numberOfObjectives la solucion 0 es ella misma
for (int i = 0; i < distance.length; i++) {
Arrays.sort(distance[i]); // depends on control dependency: [for], data = [i]
double kDistance = 0.0;
for (int k = numberOfObjectives; k > 0; k--) {
// kDistance += (dmaxx-dminn) / (distance[i][k]);//me gusta mas este
// kDistance += (dmaxx-dminn) / (distance[i][k]+dminn);//original
kDistance += (dmaxx - dminn) / distance[i][k]; // depends on control dependency: [for], data = [k]
}
double temp = (double) front.get(i).getAttribute(getAttributeID());
// if(temp!=Double.POSITIVE_INFINITY)
// kDistance=kDistance/numberOfObjectives-1;
temp -= kDistance; // depends on control dependency: [for], data = [none]
front.get(i).setAttribute(getAttributeID(), temp); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public static Period fieldDifference(ReadablePartial start, ReadablePartial end) {
if (start == null || end == null) {
throw new IllegalArgumentException("ReadablePartial objects must not be null");
}
if (start.size() != end.size()) {
throw new IllegalArgumentException("ReadablePartial objects must have the same set of fields");
}
DurationFieldType[] types = new DurationFieldType[start.size()];
int[] values = new int[start.size()];
for (int i = 0, isize = start.size(); i < isize; i++) {
if (start.getFieldType(i) != end.getFieldType(i)) {
throw new IllegalArgumentException("ReadablePartial objects must have the same set of fields");
}
types[i] = start.getFieldType(i).getDurationType();
if (i > 0 && types[i - 1] == types[i]) {
throw new IllegalArgumentException("ReadablePartial objects must not have overlapping fields");
}
values[i] = end.getValue(i) - start.getValue(i);
}
return new Period(values, PeriodType.forFields(types));
} } | public class class_name {
public static Period fieldDifference(ReadablePartial start, ReadablePartial end) {
if (start == null || end == null) {
throw new IllegalArgumentException("ReadablePartial objects must not be null");
}
if (start.size() != end.size()) {
throw new IllegalArgumentException("ReadablePartial objects must have the same set of fields");
}
DurationFieldType[] types = new DurationFieldType[start.size()];
int[] values = new int[start.size()];
for (int i = 0, isize = start.size(); i < isize; i++) {
if (start.getFieldType(i) != end.getFieldType(i)) {
throw new IllegalArgumentException("ReadablePartial objects must have the same set of fields");
}
types[i] = start.getFieldType(i).getDurationType(); // depends on control dependency: [for], data = [i]
if (i > 0 && types[i - 1] == types[i]) {
throw new IllegalArgumentException("ReadablePartial objects must not have overlapping fields");
}
values[i] = end.getValue(i) - start.getValue(i); // depends on control dependency: [for], data = [i]
}
return new Period(values, PeriodType.forFields(types));
} } |
public class class_name {
private Object readItem() {
Object itemRead = null;
try {
currentChunkStatus.incrementItemsTouchedInCurrentChunk();
// call read listeners before and after the actual read
for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
readListenerProxy.beforeRead();
}
itemRead = readerProxy.readItem();
for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
readListenerProxy.afterRead(itemRead);
}
// itemRead == null means we reached the end of
// the readerProxy "resultset"
if (itemRead == null) {
currentChunkStatus.markReadNull();
currentChunkStatus.decrementItemsTouchedInCurrentChunk();
}
} catch (Exception e) {
runtimeStepExecution.setException(e);
for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
readListenerProxy.onReadError(e);
}
if (!currentChunkStatus.isRetryingAfterRollback()) {
if (retryReadException(e)) {
if (!retryHandler.isRollbackException(e)) {
// retry without rollback
itemRead = readItem();
} else {
// retry with rollback
currentChunkStatus.markForRollbackWithRetry(e);
}
} else if (skipReadException(e)) {
currentItemStatus.setSkipped(true);
runtimeStepExecution.getMetric(MetricImpl.MetricType.READ_SKIP_COUNT).incValue();
} else {
throw new BatchContainerRuntimeException(e);
}
} else {
// coming from a rollback retry
if (skipReadException(e)) {
currentItemStatus.setSkipped(true);
runtimeStepExecution.getMetric(MetricImpl.MetricType.READ_SKIP_COUNT).incValue();
} else if (retryReadException(e)) {
if (!retryHandler.isRollbackException(e)) {
// retry without rollback
itemRead = readItem();
} else {
// retry with rollback
currentChunkStatus.markForRollbackWithRetry(e);
}
} else {
throw new BatchContainerRuntimeException(e);
}
}
} catch (Throwable e) {
throw new BatchContainerRuntimeException(e);
}
logger.exiting(sourceClass, "readItem", itemRead == null ? "<null>" : itemRead);
return itemRead;
} } | public class class_name {
private Object readItem() {
Object itemRead = null;
try {
currentChunkStatus.incrementItemsTouchedInCurrentChunk(); // depends on control dependency: [try], data = [none]
// call read listeners before and after the actual read
for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
readListenerProxy.beforeRead(); // depends on control dependency: [for], data = [readListenerProxy]
}
itemRead = readerProxy.readItem(); // depends on control dependency: [try], data = [none]
for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
readListenerProxy.afterRead(itemRead); // depends on control dependency: [for], data = [readListenerProxy]
}
// itemRead == null means we reached the end of
// the readerProxy "resultset"
if (itemRead == null) {
currentChunkStatus.markReadNull(); // depends on control dependency: [if], data = [none]
currentChunkStatus.decrementItemsTouchedInCurrentChunk(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
runtimeStepExecution.setException(e);
for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
readListenerProxy.onReadError(e); // depends on control dependency: [for], data = [readListenerProxy]
}
if (!currentChunkStatus.isRetryingAfterRollback()) {
if (retryReadException(e)) {
if (!retryHandler.isRollbackException(e)) {
// retry without rollback
itemRead = readItem(); // depends on control dependency: [if], data = [none]
} else {
// retry with rollback
currentChunkStatus.markForRollbackWithRetry(e); // depends on control dependency: [if], data = [none]
}
} else if (skipReadException(e)) {
currentItemStatus.setSkipped(true); // depends on control dependency: [if], data = [none]
runtimeStepExecution.getMetric(MetricImpl.MetricType.READ_SKIP_COUNT).incValue(); // depends on control dependency: [if], data = [none]
} else {
throw new BatchContainerRuntimeException(e);
}
} else {
// coming from a rollback retry
if (skipReadException(e)) {
currentItemStatus.setSkipped(true); // depends on control dependency: [if], data = [none]
runtimeStepExecution.getMetric(MetricImpl.MetricType.READ_SKIP_COUNT).incValue(); // depends on control dependency: [if], data = [none]
} else if (retryReadException(e)) {
if (!retryHandler.isRollbackException(e)) {
// retry without rollback
itemRead = readItem(); // depends on control dependency: [if], data = [none]
} else {
// retry with rollback
currentChunkStatus.markForRollbackWithRetry(e); // depends on control dependency: [if], data = [none]
}
} else {
throw new BatchContainerRuntimeException(e);
}
}
} catch (Throwable e) { // depends on control dependency: [catch], data = [none]
throw new BatchContainerRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
logger.exiting(sourceClass, "readItem", itemRead == null ? "<null>" : itemRead);
return itemRead;
} } |
public class class_name {
private static Properties initializeConfigurationProperties() {
Properties properties = new Properties();
InputStream in = GeoPackageProperties.class.getResourceAsStream("/"
+ PropertyConstants.PROPERTIES_FILE);
if (in != null) {
try {
properties.load(in);
} catch (Exception e) {
log.log(Level.SEVERE, "Failed to load properties file: "
+ PropertyConstants.PROPERTIES_FILE, e);
} finally {
try {
in.close();
} catch (IOException e) {
log.log(Level.WARNING, "Failed to close properties file: "
+ PropertyConstants.PROPERTIES_FILE, e);
}
}
} else {
log.log(Level.SEVERE, "Failed to load properties, file not found: "
+ PropertyConstants.PROPERTIES_FILE);
}
return properties;
} } | public class class_name {
private static Properties initializeConfigurationProperties() {
Properties properties = new Properties();
InputStream in = GeoPackageProperties.class.getResourceAsStream("/"
+ PropertyConstants.PROPERTIES_FILE);
if (in != null) {
try {
properties.load(in); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.log(Level.SEVERE, "Failed to load properties file: "
+ PropertyConstants.PROPERTIES_FILE, e);
} finally { // depends on control dependency: [catch], data = [none]
try {
in.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
log.log(Level.WARNING, "Failed to close properties file: "
+ PropertyConstants.PROPERTIES_FILE, e);
} // depends on control dependency: [catch], data = [none]
}
} else {
log.log(Level.SEVERE, "Failed to load properties, file not found: "
+ PropertyConstants.PROPERTIES_FILE); // depends on control dependency: [if], data = [none]
}
return properties;
} } |
public class class_name {
private static File newTempDirectory() {
String tempDirName = System.getProperty(JBOSS_SERVER_TMPDIR);
if (tempDirName == null) {
tempDirName = System.getProperty(JAVA_IO_TMPDIR);
}
if (tempDirName == null) {
throw new SystemFailureException(JcrI18n.tempDirectorySystemPropertyMustBeSet.text(JAVA_IO_TMPDIR));
}
File tempDir = new File(tempDirName);
// Create a temporary directory in the "java.io.tmpdir" directory ...
return new File(tempDir, "modeshape-binary-store");
} } | public class class_name {
private static File newTempDirectory() {
String tempDirName = System.getProperty(JBOSS_SERVER_TMPDIR);
if (tempDirName == null) {
tempDirName = System.getProperty(JAVA_IO_TMPDIR); // depends on control dependency: [if], data = [none]
}
if (tempDirName == null) {
throw new SystemFailureException(JcrI18n.tempDirectorySystemPropertyMustBeSet.text(JAVA_IO_TMPDIR));
}
File tempDir = new File(tempDirName);
// Create a temporary directory in the "java.io.tmpdir" directory ...
return new File(tempDir, "modeshape-binary-store");
} } |
public class class_name {
public void marshall(CreateConnectionRequest createConnectionRequest, ProtocolMarshaller protocolMarshaller) {
if (createConnectionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createConnectionRequest.getLocation(), LOCATION_BINDING);
protocolMarshaller.marshall(createConnectionRequest.getBandwidth(), BANDWIDTH_BINDING);
protocolMarshaller.marshall(createConnectionRequest.getConnectionName(), CONNECTIONNAME_BINDING);
protocolMarshaller.marshall(createConnectionRequest.getLagId(), LAGID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateConnectionRequest createConnectionRequest, ProtocolMarshaller protocolMarshaller) {
if (createConnectionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createConnectionRequest.getLocation(), LOCATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createConnectionRequest.getBandwidth(), BANDWIDTH_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createConnectionRequest.getConnectionName(), CONNECTIONNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createConnectionRequest.getLagId(), LAGID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void drawDistances(Graphics g1){
Graphics2D g = (Graphics2D)g1;
int c = matrix.getRowDimension();
int d = matrix.getColumnDimension();
float scale = getScale();
int width = Math.round(scale);
for (int i = 0; i < c; i++) {
int ipaint = Math.round(i*scale);
for (int j = 0; j < d; j++) {
double val = matrix.get(i,j);
int jpaint = Math.round(j*scale);
Color color = cellColor.getColor(val);
g.setColor(color);
g.fillRect(ipaint,jpaint,width,width);
}
}
} } | public class class_name {
public void drawDistances(Graphics g1){
Graphics2D g = (Graphics2D)g1;
int c = matrix.getRowDimension();
int d = matrix.getColumnDimension();
float scale = getScale();
int width = Math.round(scale);
for (int i = 0; i < c; i++) {
int ipaint = Math.round(i*scale);
for (int j = 0; j < d; j++) {
double val = matrix.get(i,j);
int jpaint = Math.round(j*scale);
Color color = cellColor.getColor(val);
g.setColor(color); // depends on control dependency: [for], data = [none]
g.fillRect(ipaint,jpaint,width,width); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
void countNonZeroUsingLinkedList( int parent[] , int ll[] ) {
Arrays.fill(pinv,0,m,-1);
nz_in_V = 0;
m2 = m;
for (int k = 0; k < n; k++) {
int i = ll[head+k]; // remove row i from queue k
nz_in_V++; // count V(k,k) as nonzero
if( i < 0) // add a fictitious row since there are no nz elements
i = m2++;
pinv[i] = k; // associate row i with V(:,k)
if( --ll[nque+k] <= 0 )
continue;
nz_in_V += ll[nque+k];
int pa;
if( (pa = parent[k]) != -1 ) { // move all rows to parent of k
if( ll[nque+pa] == 0)
ll[tail+pa] = ll[tail+k];
ll[next+ll[tail+k]] = ll[head+pa];
ll[head+pa] = ll[next+i];
ll[nque+pa] += ll[nque+k];
}
}
for (int i = 0, k = n; i < m; i++) {
if( pinv[i] < 0 )
pinv[i] = k++;
}
if( nz_in_V < 0)
throw new RuntimeException("Too many elements. Numerical overflow in V counts");
} } | public class class_name {
void countNonZeroUsingLinkedList( int parent[] , int ll[] ) {
Arrays.fill(pinv,0,m,-1);
nz_in_V = 0;
m2 = m;
for (int k = 0; k < n; k++) {
int i = ll[head+k]; // remove row i from queue k
nz_in_V++; // count V(k,k) as nonzero // depends on control dependency: [for], data = [none]
if( i < 0) // add a fictitious row since there are no nz elements
i = m2++;
pinv[i] = k; // associate row i with V(:,k) // depends on control dependency: [for], data = [k]
if( --ll[nque+k] <= 0 )
continue;
nz_in_V += ll[nque+k]; // depends on control dependency: [for], data = [k]
int pa;
if( (pa = parent[k]) != -1 ) { // move all rows to parent of k
if( ll[nque+pa] == 0)
ll[tail+pa] = ll[tail+k];
ll[next+ll[tail+k]] = ll[head+pa]; // depends on control dependency: [if], data = [none]
ll[head+pa] = ll[next+i]; // depends on control dependency: [if], data = [none]
ll[nque+pa] += ll[nque+k]; // depends on control dependency: [if], data = [none]
}
}
for (int i = 0, k = n; i < m; i++) {
if( pinv[i] < 0 )
pinv[i] = k++;
}
if( nz_in_V < 0)
throw new RuntimeException("Too many elements. Numerical overflow in V counts");
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static VmSetting getSetting(String s) {
PARAMETERS.clear();
PARAMETERS.put("setting", s);
result = namedQuery("VmSetting.findBySetting",
PARAMETERS);
if (result.isEmpty()) {
return null;
} else {
return (VmSetting) result.get(0);
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public static VmSetting getSetting(String s) {
PARAMETERS.clear();
PARAMETERS.put("setting", s);
result = namedQuery("VmSetting.findBySetting",
PARAMETERS);
if (result.isEmpty()) {
return null;
// depends on control dependency: [if], data = [none]
} else {
return (VmSetting) result.get(0);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final void mPRED() throws RecognitionException {
try {
int _type = PRED;
int _channel = DEFAULT_TOKEN_CHANNEL;
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:124:5: ( ( 'P' | 'p' ) ( 'R' | 'r' ) ( 'E' | 'e' ) ( 'D' | 'd' ) )
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:124:7: ( 'P' | 'p' ) ( 'R' | 'r' ) ( 'E' | 'e' ) ( 'D' | 'd' )
{
if ( input.LA(1)=='P'||input.LA(1)=='p' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
if ( input.LA(1)=='R'||input.LA(1)=='r' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
if ( input.LA(1)=='D'||input.LA(1)=='d' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
} } | public class class_name {
public final void mPRED() throws RecognitionException {
try {
int _type = PRED;
int _channel = DEFAULT_TOKEN_CHANNEL;
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:124:5: ( ( 'P' | 'p' ) ( 'R' | 'r' ) ( 'E' | 'e' ) ( 'D' | 'd' ) )
// C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:124:7: ( 'P' | 'p' ) ( 'R' | 'r' ) ( 'E' | 'e' ) ( 'D' | 'd' )
{
if ( input.LA(1)=='P'||input.LA(1)=='p' ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
if ( input.LA(1)=='R'||input.LA(1)=='r' ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
if ( input.LA(1)=='D'||input.LA(1)=='d' ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
} } |
public class class_name {
@Pure
public static String getExecutableFilename(String name) {
if (OperatingSystem.WIN.isCurrentOS()) {
return name + ".exe"; //$NON-NLS-1$
}
return name;
} } | public class class_name {
@Pure
public static String getExecutableFilename(String name) {
if (OperatingSystem.WIN.isCurrentOS()) {
return name + ".exe"; //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
return name;
} } |
public class class_name {
private void initializePortraitListListener() {
instructionLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View instructionView) {
boolean instructionsVisible = instructionListLayout.getVisibility() == VISIBLE;
if (!instructionsVisible) {
showInstructionList();
} else {
hideInstructionList();
}
}
});
} } | public class class_name {
private void initializePortraitListListener() {
instructionLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View instructionView) {
boolean instructionsVisible = instructionListLayout.getVisibility() == VISIBLE;
if (!instructionsVisible) {
showInstructionList(); // depends on control dependency: [if], data = [none]
} else {
hideInstructionList(); // depends on control dependency: [if], data = [none]
}
}
});
} } |
public class class_name {
public List<InputColumn<?>> getAvailableInputColumns(final ComponentBuilder componentBuilder,
final Class<?> dataType) {
List<InputColumn<?>> result = getAvailableInputColumns(dataType);
final SourceColumnFinder finder = new SourceColumnFinder();
finder.addSources(this);
result = CollectionUtils.filter(result, new Predicate<InputColumn<?>>() {
@Override
public Boolean eval(InputColumn<?> inputColumn) {
if (inputColumn.isPhysicalColumn()) {
return true;
}
final InputColumnSourceJob origin = finder.findInputColumnSource(inputColumn);
if (origin == null) {
return true;
}
if (origin == componentBuilder) {
// exclude columns from the component itself
return false;
}
final Set<Object> sourceComponents = finder.findAllSourceJobs(origin);
if (sourceComponents.contains(componentBuilder)) {
// exclude columns that depend
return false;
}
return true;
}
});
return result;
} } | public class class_name {
public List<InputColumn<?>> getAvailableInputColumns(final ComponentBuilder componentBuilder,
final Class<?> dataType) {
List<InputColumn<?>> result = getAvailableInputColumns(dataType);
final SourceColumnFinder finder = new SourceColumnFinder();
finder.addSources(this);
result = CollectionUtils.filter(result, new Predicate<InputColumn<?>>() {
@Override
public Boolean eval(InputColumn<?> inputColumn) {
if (inputColumn.isPhysicalColumn()) {
return true; // depends on control dependency: [if], data = [none]
}
final InputColumnSourceJob origin = finder.findInputColumnSource(inputColumn);
if (origin == null) {
return true; // depends on control dependency: [if], data = [none]
}
if (origin == componentBuilder) {
// exclude columns from the component itself
return false; // depends on control dependency: [if], data = [none]
}
final Set<Object> sourceComponents = finder.findAllSourceJobs(origin);
if (sourceComponents.contains(componentBuilder)) {
// exclude columns that depend
return false; // depends on control dependency: [if], data = [none]
}
return true;
}
});
return result;
} } |
public class class_name {
public static void stopChains(List<String> chains, long timeout, final Runnable runOnStop) {
if (null == chains || chains.isEmpty()) {
return;
}
final boolean bTrace = TraceComponent.isAnyTracingEnabled();
final ChannelFramework cf = ChannelFrameworkFactory.getChannelFramework();
final long quiesceTimeout = (-1L == timeout) ? cf.getDefaultChainQuiesceTimeout() : timeout;
final UtilsChainListener listener = new UtilsChainListener();
for (String chain : chains) {
ChainData cd = cf.getChain(chain);
if (null == cd) {
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Skipping unknown chain; " + chain);
}
continue;
}
if (FlowType.OUTBOUND.equals(cd.getType()) || !cf.isChainRunning(cd)) {
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Skipping chain; " + chain);
}
continue;
}
try {
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Stopping chain: " + chain);
}
if (quiesceTimeout > 0 ) {
listener.watchChain(cd);
}
cf.stopChain(cd, quiesceTimeout);
} catch (Throwable t) {
// framework already FFDCs on stopChain failure
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Error stopping chain: " + t);
}
}
}
if (runOnStop != null) {
ExecutorService executorService = CHFWBundle.getExecutorService();
if (null != executorService) {
// Use a different thread to wait for chain stop and then finish..
Runnable runner = new Runnable() {
@Override
public void run() {
// wait for the quiesce time to expire
listener.waitOnChains(quiesceTimeout);
// call the runnable to finish cleanup activity.
runOnStop.run();
}
};
executorService.execute(runner);
// We've forked waiting for chain stop to a different thread
return;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Waiting for chains to stop");
}
// wait for the quiesce time to expire
listener.waitOnChains(quiesceTimeout);
} } | public class class_name {
public static void stopChains(List<String> chains, long timeout, final Runnable runOnStop) {
if (null == chains || chains.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
final boolean bTrace = TraceComponent.isAnyTracingEnabled();
final ChannelFramework cf = ChannelFrameworkFactory.getChannelFramework();
final long quiesceTimeout = (-1L == timeout) ? cf.getDefaultChainQuiesceTimeout() : timeout;
final UtilsChainListener listener = new UtilsChainListener();
for (String chain : chains) {
ChainData cd = cf.getChain(chain);
if (null == cd) {
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Skipping unknown chain; " + chain); // depends on control dependency: [if], data = [none]
}
continue;
}
if (FlowType.OUTBOUND.equals(cd.getType()) || !cf.isChainRunning(cd)) {
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Skipping chain; " + chain); // depends on control dependency: [if], data = [none]
}
continue;
}
try {
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Stopping chain: " + chain); // depends on control dependency: [if], data = [none]
}
if (quiesceTimeout > 0 ) {
listener.watchChain(cd); // depends on control dependency: [if], data = [none]
}
cf.stopChain(cd, quiesceTimeout); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
// framework already FFDCs on stopChain failure
if (bTrace && tc.isDebugEnabled()) {
Tr.debug(tc, "Error stopping chain: " + t); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
if (runOnStop != null) {
ExecutorService executorService = CHFWBundle.getExecutorService();
if (null != executorService) {
// Use a different thread to wait for chain stop and then finish..
Runnable runner = new Runnable() {
@Override
public void run() {
// wait for the quiesce time to expire
listener.waitOnChains(quiesceTimeout);
// call the runnable to finish cleanup activity.
runOnStop.run();
}
};
executorService.execute(runner); // depends on control dependency: [if], data = [none]
// We've forked waiting for chain stop to a different thread
return; // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Waiting for chains to stop"); // depends on control dependency: [if], data = [none]
}
// wait for the quiesce time to expire
listener.waitOnChains(quiesceTimeout);
} } |
public class class_name {
@Override
@UiThread
public int getItemViewType(int flatPosition) {
ExpandableWrapper<P, C> listItem = mFlatItemList.get(flatPosition);
if (listItem.isParent()) {
return getParentViewType(getNearestParentPosition(flatPosition));
} else {
return getChildViewType(getNearestParentPosition(flatPosition), getChildPosition(flatPosition));
}
} } | public class class_name {
@Override
@UiThread
public int getItemViewType(int flatPosition) {
ExpandableWrapper<P, C> listItem = mFlatItemList.get(flatPosition);
if (listItem.isParent()) {
return getParentViewType(getNearestParentPosition(flatPosition)); // depends on control dependency: [if], data = [none]
} else {
return getChildViewType(getNearestParentPosition(flatPosition), getChildPosition(flatPosition)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(HIT hIT, ProtocolMarshaller protocolMarshaller) {
if (hIT == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(hIT.getHITId(), HITID_BINDING);
protocolMarshaller.marshall(hIT.getHITTypeId(), HITTYPEID_BINDING);
protocolMarshaller.marshall(hIT.getHITGroupId(), HITGROUPID_BINDING);
protocolMarshaller.marshall(hIT.getHITLayoutId(), HITLAYOUTID_BINDING);
protocolMarshaller.marshall(hIT.getCreationTime(), CREATIONTIME_BINDING);
protocolMarshaller.marshall(hIT.getTitle(), TITLE_BINDING);
protocolMarshaller.marshall(hIT.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(hIT.getQuestion(), QUESTION_BINDING);
protocolMarshaller.marshall(hIT.getKeywords(), KEYWORDS_BINDING);
protocolMarshaller.marshall(hIT.getHITStatus(), HITSTATUS_BINDING);
protocolMarshaller.marshall(hIT.getMaxAssignments(), MAXASSIGNMENTS_BINDING);
protocolMarshaller.marshall(hIT.getReward(), REWARD_BINDING);
protocolMarshaller.marshall(hIT.getAutoApprovalDelayInSeconds(), AUTOAPPROVALDELAYINSECONDS_BINDING);
protocolMarshaller.marshall(hIT.getExpiration(), EXPIRATION_BINDING);
protocolMarshaller.marshall(hIT.getAssignmentDurationInSeconds(), ASSIGNMENTDURATIONINSECONDS_BINDING);
protocolMarshaller.marshall(hIT.getRequesterAnnotation(), REQUESTERANNOTATION_BINDING);
protocolMarshaller.marshall(hIT.getQualificationRequirements(), QUALIFICATIONREQUIREMENTS_BINDING);
protocolMarshaller.marshall(hIT.getHITReviewStatus(), HITREVIEWSTATUS_BINDING);
protocolMarshaller.marshall(hIT.getNumberOfAssignmentsPending(), NUMBEROFASSIGNMENTSPENDING_BINDING);
protocolMarshaller.marshall(hIT.getNumberOfAssignmentsAvailable(), NUMBEROFASSIGNMENTSAVAILABLE_BINDING);
protocolMarshaller.marshall(hIT.getNumberOfAssignmentsCompleted(), NUMBEROFASSIGNMENTSCOMPLETED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(HIT hIT, ProtocolMarshaller protocolMarshaller) {
if (hIT == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(hIT.getHITId(), HITID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getHITTypeId(), HITTYPEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getHITGroupId(), HITGROUPID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getHITLayoutId(), HITLAYOUTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getCreationTime(), CREATIONTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getTitle(), TITLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getQuestion(), QUESTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getKeywords(), KEYWORDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getHITStatus(), HITSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getMaxAssignments(), MAXASSIGNMENTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getReward(), REWARD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getAutoApprovalDelayInSeconds(), AUTOAPPROVALDELAYINSECONDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getExpiration(), EXPIRATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getAssignmentDurationInSeconds(), ASSIGNMENTDURATIONINSECONDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getRequesterAnnotation(), REQUESTERANNOTATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getQualificationRequirements(), QUALIFICATIONREQUIREMENTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getHITReviewStatus(), HITREVIEWSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getNumberOfAssignmentsPending(), NUMBEROFASSIGNMENTSPENDING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getNumberOfAssignmentsAvailable(), NUMBEROFASSIGNMENTSAVAILABLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(hIT.getNumberOfAssignmentsCompleted(), NUMBEROFASSIGNMENTSCOMPLETED_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 Set<URI> listEntitiesByDataModel(com.hp.hpl.jena.rdf.model.Resource entityType, Property dataPropertyType, URI modelReference) {
if (modelReference == null) {
return ImmutableSet.of();
}
StringBuilder queryBuilder = new StringBuilder()
.append("SELECT DISTINCT ?entity WHERE { \n");
// Deal with engines that store the inference in the default graph (e.g., OWLIM)
queryBuilder.append("{").append("\n")
.append(" ?entity <").append(RDF.type.getURI()).append("> <").append(entityType.getURI()).append("> .").append("\n");
// Deal with the difference between Services and Operations
if (entityType.equals(MSM.Service)) {
queryBuilder.append(" ?entity <").append(MSM.hasOperation.getURI()).append("> / ").append("\n")
.append(" <").append(dataPropertyType.getURI()).append("> / ").append("\n");
} else {
queryBuilder.append(" ?entity <").append(dataPropertyType.getURI()).append("> / ").append("\n");
}
queryBuilder.append(" <").append(SAWSDL.modelReference.getURI()).append("> <").append(modelReference.toASCIIString()).append("> .").append("\n");
// UNION
queryBuilder.append("\n } UNION { \n");
queryBuilder.append(" ?entity <").append(RDF.type.getURI()).append("> <").append(entityType.getURI()).append("> .").append("\n");
// Deal with the difference between Services and Operations
if (entityType.equals(MSM.Service)) {
queryBuilder.append(" ?entity <").append(MSM.hasOperation.getURI()).append("> / ").append("\n")
.append(" <").append(dataPropertyType.getURI()).append("> ?message .").append("\n");
} else {
queryBuilder.append(" ?entity <").append(dataPropertyType.getURI()).append("> ?message .").append("\n");
}
queryBuilder.append("?message (<").append(MSM.hasOptionalPart.getURI()).
append("> | <").append(MSM.hasMandatoryPart.getURI()).append(">)+ ?part . \n").
append(" ?part <").append(SAWSDL.modelReference.getURI()).append("> <").append(modelReference.toASCIIString()).append("> .").
append("}}");
return this.graphStoreManager.listResourcesByQuery(queryBuilder.toString(), "entity");
} } | public class class_name {
private Set<URI> listEntitiesByDataModel(com.hp.hpl.jena.rdf.model.Resource entityType, Property dataPropertyType, URI modelReference) {
if (modelReference == null) {
return ImmutableSet.of(); // depends on control dependency: [if], data = [none]
}
StringBuilder queryBuilder = new StringBuilder()
.append("SELECT DISTINCT ?entity WHERE { \n");
// Deal with engines that store the inference in the default graph (e.g., OWLIM)
queryBuilder.append("{").append("\n")
.append(" ?entity <").append(RDF.type.getURI()).append("> <").append(entityType.getURI()).append("> .").append("\n");
// Deal with the difference between Services and Operations
if (entityType.equals(MSM.Service)) {
queryBuilder.append(" ?entity <").append(MSM.hasOperation.getURI()).append("> / ").append("\n")
.append(" <").append(dataPropertyType.getURI()).append("> / ").append("\n");
} else {
queryBuilder.append(" ?entity <").append(dataPropertyType.getURI()).append("> / ").append("\n");
}
queryBuilder.append(" <").append(SAWSDL.modelReference.getURI()).append("> <").append(modelReference.toASCIIString()).append("> .").append("\n");
// UNION
queryBuilder.append("\n } UNION { \n");
queryBuilder.append(" ?entity <").append(RDF.type.getURI()).append("> <").append(entityType.getURI()).append("> .").append("\n");
// Deal with the difference between Services and Operations
if (entityType.equals(MSM.Service)) {
queryBuilder.append(" ?entity <").append(MSM.hasOperation.getURI()).append("> / ").append("\n")
.append(" <").append(dataPropertyType.getURI()).append("> ?message .").append("\n");
} else {
queryBuilder.append(" ?entity <").append(dataPropertyType.getURI()).append("> ?message .").append("\n");
}
queryBuilder.append("?message (<").append(MSM.hasOptionalPart.getURI()).
append("> | <").append(MSM.hasMandatoryPart.getURI()).append(">)+ ?part . \n").
append(" ?part <").append(SAWSDL.modelReference.getURI()).append("> <").append(modelReference.toASCIIString()).append("> .").
append("}}");
return this.graphStoreManager.listResourcesByQuery(queryBuilder.toString(), "entity");
} } |
public class class_name {
@Override
public int delete(List<?> values, boolean shouldNotify) throws StormException {
final CachedTable table = super.getCachedTable(values);
FieldHolder primaryKey;
try {
primaryKey = getPrimaryKey(table);
} catch (NoPrimaryKeyFoundException e) {
throw new StormException(e);
}
final List<Selection> selections = new ArrayList<>();
final int size = values.size();
int x = size / MAX;
final int steps = x == 0
? 1
: size % MAX != 0
? x + 1
: x;
if (steps > 1) {
for (int i = 0, end = MAX, start = 0; i < steps; i++, start = end, end += Math.min(size - (MAX * i), MAX)) {
selections.add(getSelection(primaryKey, values.subList(start, end)));
}
} else {
selections.add(getSelection(primaryKey, values));
}
int result = 0;
beginTransaction();
try {
for (Selection selection: selections) {
result += deleteInner(table.getTableName(), selection);
}
setTransactionSuccessful();
} finally {
endTransaction();
}
if (shouldNotify
&& result > 0) {
manager.notifyChange(table.getNotificationUri());
}
return result;
} } | public class class_name {
@Override
public int delete(List<?> values, boolean shouldNotify) throws StormException {
final CachedTable table = super.getCachedTable(values);
FieldHolder primaryKey;
try {
primaryKey = getPrimaryKey(table);
} catch (NoPrimaryKeyFoundException e) {
throw new StormException(e);
}
final List<Selection> selections = new ArrayList<>();
final int size = values.size();
int x = size / MAX;
final int steps = x == 0
? 1
: size % MAX != 0
? x + 1
: x;
if (steps > 1) {
for (int i = 0, end = MAX, start = 0; i < steps; i++, start = end, end += Math.min(size - (MAX * i), MAX)) {
selections.add(getSelection(primaryKey, values.subList(start, end))); // depends on control dependency: [for], data = [none]
}
} else {
selections.add(getSelection(primaryKey, values));
}
int result = 0;
beginTransaction();
try {
for (Selection selection: selections) {
result += deleteInner(table.getTableName(), selection); // depends on control dependency: [for], data = [selection]
}
setTransactionSuccessful();
} finally {
endTransaction();
}
if (shouldNotify
&& result > 0) {
manager.notifyChange(table.getNotificationUri());
}
return result;
} } |
public class class_name {
private List<String> loadArgumentsFile(final String argumentsFile) {
List<String> args = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(argumentsFile))){
String line;
while ((line = reader.readLine()) != null) {
if (!line.startsWith(ARGUMENT_FILE_COMMENT) && !line.trim().isEmpty()) {
args.addAll(Arrays.asList(StringUtils.split(line)));
}
}
} catch (final IOException e) {
throw new CommandLineException("I/O error loading arguments file:" + argumentsFile, e);
}
return args;
} } | public class class_name {
private List<String> loadArgumentsFile(final String argumentsFile) {
List<String> args = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(argumentsFile))){
String line;
while ((line = reader.readLine()) != null) {
if (!line.startsWith(ARGUMENT_FILE_COMMENT) && !line.trim().isEmpty()) {
args.addAll(Arrays.asList(StringUtils.split(line))); // depends on control dependency: [if], data = [none]
}
}
} catch (final IOException e) {
throw new CommandLineException("I/O error loading arguments file:" + argumentsFile, e);
}
return args;
} } |
public class class_name {
@Beta
public static <K, V> Map<K, V> zip(List<K> keys, List<V> values) {
checkArgument(keys != null, "Expected non-null keys");
checkArgument(values != null, "Expected non-null values");
checkArgument(keys.size() == values.size(), "Expected equal size of lists, got %s and %s", keys.size(), values.size());
ImmutableMap.Builder<K, V> builder = ImmutableMap.builder();
for (int i = 0; i < keys.size(); i++) {
builder.put(keys.get(i), values.get(i));
}
return builder.build();
} } | public class class_name {
@Beta
public static <K, V> Map<K, V> zip(List<K> keys, List<V> values) {
checkArgument(keys != null, "Expected non-null keys");
checkArgument(values != null, "Expected non-null values");
checkArgument(keys.size() == values.size(), "Expected equal size of lists, got %s and %s", keys.size(), values.size());
ImmutableMap.Builder<K, V> builder = ImmutableMap.builder();
for (int i = 0; i < keys.size(); i++) {
builder.put(keys.get(i), values.get(i)); // depends on control dependency: [for], data = [i]
}
return builder.build();
} } |
public class class_name {
public void marshall(CurrentMetricData currentMetricData, ProtocolMarshaller protocolMarshaller) {
if (currentMetricData == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(currentMetricData.getMetric(), METRIC_BINDING);
protocolMarshaller.marshall(currentMetricData.getValue(), VALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CurrentMetricData currentMetricData, ProtocolMarshaller protocolMarshaller) {
if (currentMetricData == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(currentMetricData.getMetric(), METRIC_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(currentMetricData.getValue(), VALUE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public SDVariable[] getInputVariablesForFunction(DifferentialFunction function) {
val inputs = getInputsForFunction(function);
if (inputs == null) {
throw new ND4JIllegalStateException("No inputs found for function " + function);
}
val vars = new SDVariable[inputs.length];
for (int i = 0; i < inputs.length; i++) {
vars[i] = getVariable(inputs[i]);
if (vars[i] == null) {
throw new ND4JIllegalStateException("Found null variable at index " + i);
}
}
return vars;
} } | public class class_name {
public SDVariable[] getInputVariablesForFunction(DifferentialFunction function) {
val inputs = getInputsForFunction(function);
if (inputs == null) {
throw new ND4JIllegalStateException("No inputs found for function " + function);
}
val vars = new SDVariable[inputs.length];
for (int i = 0; i < inputs.length; i++) {
vars[i] = getVariable(inputs[i]); // depends on control dependency: [for], data = [i]
if (vars[i] == null) {
throw new ND4JIllegalStateException("Found null variable at index " + i);
}
}
return vars;
} } |
public class class_name {
public boolean removeWatcher(Listener watcher) {
if (watcher == null) {
throw new IllegalArgumentException("Null watcher removed");
}
synchronized (mutex) {
AtomicBoolean removed = new AtomicBoolean(removeFromListeners(watchers, watcher));
watchedFiles.forEach((path, suppliers) -> {
if (removeFromListeners(suppliers, watcher)) {
removed.set(true);
}
});
return removed.get();
}
} } | public class class_name {
public boolean removeWatcher(Listener watcher) {
if (watcher == null) {
throw new IllegalArgumentException("Null watcher removed");
}
synchronized (mutex) {
AtomicBoolean removed = new AtomicBoolean(removeFromListeners(watchers, watcher));
watchedFiles.forEach((path, suppliers) -> {
if (removeFromListeners(suppliers, watcher)) {
removed.set(true); // depends on control dependency: [if], data = [none]
}
});
return removed.get();
}
} } |
public class class_name {
private void cleanProperties(Map<String, String> props) {
if (props != null) {
props.remove(StorageProvider.PROPERTIES_CONTENT_MD5);
props.remove(StorageProvider.PROPERTIES_CONTENT_CHECKSUM);
props.remove(StorageProvider.PROPERTIES_CONTENT_MODIFIED);
props.remove(StorageProvider.PROPERTIES_CONTENT_SIZE);
props.remove(HttpHeaders.CONTENT_LENGTH);
props.remove(HttpHeaders.CONTENT_TYPE);
props.remove(HttpHeaders.LAST_MODIFIED);
props.remove(HttpHeaders.DATE);
props.remove(HttpHeaders.ETAG);
props.remove(HttpHeaders.CONTENT_LENGTH.toLowerCase());
props.remove(HttpHeaders.CONTENT_TYPE.toLowerCase());
props.remove(HttpHeaders.LAST_MODIFIED.toLowerCase());
props.remove(HttpHeaders.DATE.toLowerCase());
props.remove(HttpHeaders.ETAG.toLowerCase());
}
} } | public class class_name {
private void cleanProperties(Map<String, String> props) {
if (props != null) {
props.remove(StorageProvider.PROPERTIES_CONTENT_MD5); // depends on control dependency: [if], data = [none]
props.remove(StorageProvider.PROPERTIES_CONTENT_CHECKSUM); // depends on control dependency: [if], data = [none]
props.remove(StorageProvider.PROPERTIES_CONTENT_MODIFIED); // depends on control dependency: [if], data = [none]
props.remove(StorageProvider.PROPERTIES_CONTENT_SIZE); // depends on control dependency: [if], data = [none]
props.remove(HttpHeaders.CONTENT_LENGTH); // depends on control dependency: [if], data = [none]
props.remove(HttpHeaders.CONTENT_TYPE); // depends on control dependency: [if], data = [none]
props.remove(HttpHeaders.LAST_MODIFIED); // depends on control dependency: [if], data = [none]
props.remove(HttpHeaders.DATE); // depends on control dependency: [if], data = [none]
props.remove(HttpHeaders.ETAG); // depends on control dependency: [if], data = [none]
props.remove(HttpHeaders.CONTENT_LENGTH.toLowerCase()); // depends on control dependency: [if], data = [none]
props.remove(HttpHeaders.CONTENT_TYPE.toLowerCase()); // depends on control dependency: [if], data = [none]
props.remove(HttpHeaders.LAST_MODIFIED.toLowerCase()); // depends on control dependency: [if], data = [none]
props.remove(HttpHeaders.DATE.toLowerCase()); // depends on control dependency: [if], data = [none]
props.remove(HttpHeaders.ETAG.toLowerCase()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public double setCount(F first, S second, double value) {
Counter<S> counter = maps.get(first);
if (counter == null) {
counter = new Counter<S>();
maps.put(first, counter);
}
return counter.setCount(second, value);
} } | public class class_name {
public double setCount(F first, S second, double value) {
Counter<S> counter = maps.get(first);
if (counter == null) {
counter = new Counter<S>(); // depends on control dependency: [if], data = [none]
maps.put(first, counter); // depends on control dependency: [if], data = [none]
}
return counter.setCount(second, value);
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.