code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
@Override
public void initialize(InitializationInput initializationInput) {
shardId = initializationInput.getShardId();
if (LOG.isDebugEnabled()) {
LOG.debug("Initializing record processor at: {}", initializationInput.getExtendedSequenceNumber().toString());
LOG.debug("Initializing record processor for shard: {}", shardId);
}
} }
|
public class class_name {
@Override
public void initialize(InitializationInput initializationInput) {
shardId = initializationInput.getShardId();
if (LOG.isDebugEnabled()) {
LOG.debug("Initializing record processor at: {}", initializationInput.getExtendedSequenceNumber().toString()); // depends on control dependency: [if], data = [none]
LOG.debug("Initializing record processor for shard: {}", shardId); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static DataRowsFacade normalize(DataRowsFacade dataFrame, double min, double max, List<String> skipColumns) {
List<String> columnsList = DataFrames.toList(dataFrame.get().columns());
columnsList.removeAll(skipColumns);
String[] columnNames = DataFrames.toArray(columnsList);
//first row is min second row is max, each column in a row is for a particular column
List<Row> minMax = minMaxColumns(dataFrame, columnNames);
for (int i = 0; i < columnNames.length; i++) {
String columnName = columnNames[i];
double dMin = ((Number) minMax.get(0).get(i)).doubleValue();
double dMax = ((Number) minMax.get(1).get(i)).doubleValue();
double maxSubMin = (dMax - dMin);
if (maxSubMin == 0)
maxSubMin = 1;
Column newCol = dataFrame.get().col(columnName).minus(dMin).divide(maxSubMin).multiply(max - min).plus(min);
dataFrame = dataRows(dataFrame.get().withColumn(columnName, newCol));
}
return dataFrame;
} }
|
public class class_name {
public static DataRowsFacade normalize(DataRowsFacade dataFrame, double min, double max, List<String> skipColumns) {
List<String> columnsList = DataFrames.toList(dataFrame.get().columns());
columnsList.removeAll(skipColumns);
String[] columnNames = DataFrames.toArray(columnsList);
//first row is min second row is max, each column in a row is for a particular column
List<Row> minMax = minMaxColumns(dataFrame, columnNames);
for (int i = 0; i < columnNames.length; i++) {
String columnName = columnNames[i];
double dMin = ((Number) minMax.get(0).get(i)).doubleValue();
double dMax = ((Number) minMax.get(1).get(i)).doubleValue();
double maxSubMin = (dMax - dMin);
if (maxSubMin == 0)
maxSubMin = 1;
Column newCol = dataFrame.get().col(columnName).minus(dMin).divide(maxSubMin).multiply(max - min).plus(min);
dataFrame = dataRows(dataFrame.get().withColumn(columnName, newCol)); // depends on control dependency: [for], data = [none]
}
return dataFrame;
} }
|
public class class_name {
public int getWidth()
{
if (getAttributes().isDefined(Attribute.WIDTH))
{
final int wide = (int) (getAttributes().getWidth() + 0.5);
if (wide > 0)
{
return wide;
}
}
if (null != m_video)
{
return m_video.getVideoWidth();
}
return 0;
} }
|
public class class_name {
public int getWidth()
{
if (getAttributes().isDefined(Attribute.WIDTH))
{
final int wide = (int) (getAttributes().getWidth() + 0.5);
if (wide > 0)
{
return wide; // depends on control dependency: [if], data = [none]
}
}
if (null != m_video)
{
return m_video.getVideoWidth(); // depends on control dependency: [if], data = [none]
}
return 0;
} }
|
public class class_name {
public static double Sinh(double x, int nTerms) {
if (nTerms < 2) return x;
if (nTerms == 2) {
return x + (x * x * x) / 6D;
} else {
double mult = x * x * x;
double fact = 6;
int factS = 5;
double result = x + mult / fact;
for (int i = 3; i <= nTerms; i++) {
mult *= x * x;
fact *= factS * (factS - 1);
factS += 2;
result += mult / fact;
}
return result;
}
} }
|
public class class_name {
public static double Sinh(double x, int nTerms) {
if (nTerms < 2) return x;
if (nTerms == 2) {
return x + (x * x * x) / 6D;
// depends on control dependency: [if], data = [none]
} else {
double mult = x * x * x;
double fact = 6;
int factS = 5;
double result = x + mult / fact;
for (int i = 3; i <= nTerms; i++) {
mult *= x * x;
// depends on control dependency: [for], data = [none]
fact *= factS * (factS - 1);
// depends on control dependency: [for], data = [none]
factS += 2;
// depends on control dependency: [for], data = [none]
result += mult / fact;
// depends on control dependency: [for], data = [none]
}
return result;
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>>
N createNode(N parent, IcosepQuadTreeZone region, GISTreeSetNodeFactory<P, N> builder) {
Rectangle2d area = parent.getAreaBounds();
if (region == IcosepQuadTreeZone.ICOSEP) {
return builder.newNode(
IcosepQuadTreeZone.ICOSEP,
area.getMinX(),
area.getMinY(),
area.getWidth(),
area.getHeight());
}
if (parent.getZone() == IcosepQuadTreeZone.ICOSEP) {
area = computeIcosepSubarea(region, area);
return builder.newNode(
region,
area.getMinX(),
area.getMinY(),
area.getWidth(),
area.getHeight());
}
final Point2d childCutPlane = computeCutPoint(region, parent);
assert childCutPlane != null;
final double w = area.getWidth() / 4.;
final double h = area.getHeight() / 4.;
return builder.newNode(region,
childCutPlane.getX() - w, childCutPlane.getY() - h, 2. * w, 2. * h);
} }
|
public class class_name {
private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>>
N createNode(N parent, IcosepQuadTreeZone region, GISTreeSetNodeFactory<P, N> builder) {
Rectangle2d area = parent.getAreaBounds();
if (region == IcosepQuadTreeZone.ICOSEP) {
return builder.newNode(
IcosepQuadTreeZone.ICOSEP,
area.getMinX(),
area.getMinY(),
area.getWidth(),
area.getHeight()); // depends on control dependency: [if], data = [none]
}
if (parent.getZone() == IcosepQuadTreeZone.ICOSEP) {
area = computeIcosepSubarea(region, area); // depends on control dependency: [if], data = [none]
return builder.newNode(
region,
area.getMinX(),
area.getMinY(),
area.getWidth(),
area.getHeight()); // depends on control dependency: [if], data = [none]
}
final Point2d childCutPlane = computeCutPoint(region, parent);
assert childCutPlane != null;
final double w = area.getWidth() / 4.;
final double h = area.getHeight() / 4.;
return builder.newNode(region,
childCutPlane.getX() - w, childCutPlane.getY() - h, 2. * w, 2. * h);
} }
|
public class class_name {
public T evaluate(Object target, Map<String, Object> variables) {
SimpleBindings bindings = variables == null
? new SimpleBindings()
: new SimpleBindings(variables);
bindings.put("target", target);
try {
return (T) (script == null
? scriptEngine.eval(getExpression(), bindings)
: script.eval(bindings));
}
catch (ScriptException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
public T evaluate(Object target, Map<String, Object> variables) {
SimpleBindings bindings = variables == null
? new SimpleBindings()
: new SimpleBindings(variables);
bindings.put("target", target);
try {
return (T) (script == null
? scriptEngine.eval(getExpression(), bindings)
: script.eval(bindings)); // depends on control dependency: [try], data = [none]
}
catch (ScriptException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static String getMd5(final String text) {
try {
final MessageDigest md = MessageDigest.getInstance("MD5");
final byte[] utf8Bytes = text.getBytes(UTF_8_NAME);
md.update(utf8Bytes, 0, utf8Bytes.length);
final byte[] md5hash = md.digest();
final int radix = 16;
final int length = 32;
final StringBuilder result = new StringBuilder(length).append(new BigInteger(1, md5hash).toString(radix));
final int zeroBeginLen = length - result.length();
if (zeroBeginLen > 0) {
final char [] zeroBegin = new char[zeroBeginLen];
Arrays.fill(zeroBegin, Character.forDigit(0, radix));
result.insert(0, zeroBegin);
}
return result.toString();
} catch (final NoSuchAlgorithmException|UnsupportedEncodingException e) {
throw new AssertionError(e);
}
} }
|
public class class_name {
public static String getMd5(final String text) {
try {
final MessageDigest md = MessageDigest.getInstance("MD5");
final byte[] utf8Bytes = text.getBytes(UTF_8_NAME);
md.update(utf8Bytes, 0, utf8Bytes.length); // depends on control dependency: [try], data = [none]
final byte[] md5hash = md.digest();
final int radix = 16;
final int length = 32;
final StringBuilder result = new StringBuilder(length).append(new BigInteger(1, md5hash).toString(radix));
final int zeroBeginLen = length - result.length();
if (zeroBeginLen > 0) {
final char [] zeroBegin = new char[zeroBeginLen];
Arrays.fill(zeroBegin, Character.forDigit(0, radix)); // depends on control dependency: [if], data = [none]
result.insert(0, zeroBegin); // depends on control dependency: [if], data = [none]
}
return result.toString(); // depends on control dependency: [try], data = [none]
} catch (final NoSuchAlgorithmException|UnsupportedEncodingException e) {
throw new AssertionError(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected void safeSet(CommandOutput<?, ?, ?> output, long integer, RedisCommand<?, ?, ?> command) {
try {
output.set(integer);
} catch (Exception e) {
command.completeExceptionally(e);
}
} }
|
public class class_name {
protected void safeSet(CommandOutput<?, ?, ?> output, long integer, RedisCommand<?, ?, ?> command) {
try {
output.set(integer); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
command.completeExceptionally(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public List<String> split(String content, String separatorCssSelector,
String separatorStrategy) {
JoinSeparator sepStrategy;
if ("before".equals(separatorStrategy)) {
sepStrategy = JoinSeparator.BEFORE;
} else if ("after".equals(separatorStrategy)) {
sepStrategy = JoinSeparator.AFTER;
} else {
sepStrategy = JoinSeparator.NO;
}
return split(content, separatorCssSelector, sepStrategy);
} }
|
public class class_name {
public List<String> split(String content, String separatorCssSelector,
String separatorStrategy) {
JoinSeparator sepStrategy;
if ("before".equals(separatorStrategy)) {
sepStrategy = JoinSeparator.BEFORE; // depends on control dependency: [if], data = [none]
} else if ("after".equals(separatorStrategy)) {
sepStrategy = JoinSeparator.AFTER; // depends on control dependency: [if], data = [none]
} else {
sepStrategy = JoinSeparator.NO; // depends on control dependency: [if], data = [none]
}
return split(content, separatorCssSelector, sepStrategy);
} }
|
public class class_name {
public void addComments(FieldDoc field, Content fieldDocTree) {
ClassDoc holder = field.containingClass();
if (field.inlineTags().length > 0) {
if (holder.equals(classdoc) ||
(! (holder.isPublic() || Util.isLinkable(holder, configuration)))) {
writer.addInlineComment(field, fieldDocTree);
} else {
Content link =
writer.getDocLink(LinkInfoImpl.Kind.FIELD_DOC_COPY,
holder, field,
holder.isIncluded() ?
holder.typeName() : holder.qualifiedTypeName(),
false);
Content codeLink = HtmlTree.CODE(link);
Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel, holder.isClass()?
writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
descfrmLabel.addContent(writer.getSpace());
descfrmLabel.addContent(codeLink);
fieldDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel));
writer.addInlineComment(field, fieldDocTree);
}
}
} }
|
public class class_name {
public void addComments(FieldDoc field, Content fieldDocTree) {
ClassDoc holder = field.containingClass();
if (field.inlineTags().length > 0) {
if (holder.equals(classdoc) ||
(! (holder.isPublic() || Util.isLinkable(holder, configuration)))) {
writer.addInlineComment(field, fieldDocTree); // depends on control dependency: [if], data = [none]
} else {
Content link =
writer.getDocLink(LinkInfoImpl.Kind.FIELD_DOC_COPY,
holder, field,
holder.isIncluded() ?
holder.typeName() : holder.qualifiedTypeName(),
false);
Content codeLink = HtmlTree.CODE(link);
Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel, holder.isClass()?
writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
descfrmLabel.addContent(writer.getSpace()); // depends on control dependency: [if], data = [none]
descfrmLabel.addContent(codeLink); // depends on control dependency: [if], data = [none]
fieldDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel)); // depends on control dependency: [if], data = [none]
writer.addInlineComment(field, fieldDocTree); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public FacesConfigFlowDefinitionSwitchType<FacesConfigFlowDefinitionType<T>> getOrCreateSwitch()
{
List<Node> nodeList = childNode.get("switch");
if (nodeList != null && nodeList.size() > 0)
{
return new FacesConfigFlowDefinitionSwitchTypeImpl<FacesConfigFlowDefinitionType<T>>(this, "switch", childNode, nodeList.get(0));
}
return createSwitch();
} }
|
public class class_name {
public FacesConfigFlowDefinitionSwitchType<FacesConfigFlowDefinitionType<T>> getOrCreateSwitch()
{
List<Node> nodeList = childNode.get("switch");
if (nodeList != null && nodeList.size() > 0)
{
return new FacesConfigFlowDefinitionSwitchTypeImpl<FacesConfigFlowDefinitionType<T>>(this, "switch", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createSwitch();
} }
|
public class class_name {
public List<I_CmsFormatterBean> getNestedFormatters(
CmsObject cms,
CmsResource res,
Locale locale,
ServletRequest req) {
List<I_CmsFormatterBean> result = null;
if (CmsResourceTypeXmlContent.isXmlContent(res)) {
CmsResourceTypeXmlContent type = (CmsResourceTypeXmlContent)OpenCms.getResourceManager().getResourceType(
res);
String schema = type.getSchema();
try {
CmsXmlContentDefinition contentDefinition = CmsXmlContentDefinition.unmarshal(cms, schema);
// get the content handler for the resource type to create
I_CmsXmlContentHandler handler = contentDefinition.getContentHandler();
if (handler.hasNestedFormatters()) {
Map<CmsUUID, I_CmsFormatterBean> formatters = getCachedFormatters(
cms.getRequestContext().getCurrentProject().isOnlineProject()).getFormatters();
result = new ArrayList<I_CmsFormatterBean>();
for (CmsUUID formatterId : handler.getNestedFormatters(cms, res, locale, req)) {
I_CmsFormatterBean formatter = formatters.get(formatterId);
if (formatter != null) {
result.add(formatter);
}
}
}
} catch (CmsXmlException e) {
LOG.error(e.getMessage(), e);
}
}
return result;
} }
|
public class class_name {
public List<I_CmsFormatterBean> getNestedFormatters(
CmsObject cms,
CmsResource res,
Locale locale,
ServletRequest req) {
List<I_CmsFormatterBean> result = null;
if (CmsResourceTypeXmlContent.isXmlContent(res)) {
CmsResourceTypeXmlContent type = (CmsResourceTypeXmlContent)OpenCms.getResourceManager().getResourceType(
res);
String schema = type.getSchema();
try {
CmsXmlContentDefinition contentDefinition = CmsXmlContentDefinition.unmarshal(cms, schema);
// get the content handler for the resource type to create
I_CmsXmlContentHandler handler = contentDefinition.getContentHandler();
if (handler.hasNestedFormatters()) {
Map<CmsUUID, I_CmsFormatterBean> formatters = getCachedFormatters(
cms.getRequestContext().getCurrentProject().isOnlineProject()).getFormatters();
result = new ArrayList<I_CmsFormatterBean>(); // depends on control dependency: [if], data = [none]
for (CmsUUID formatterId : handler.getNestedFormatters(cms, res, locale, req)) {
I_CmsFormatterBean formatter = formatters.get(formatterId);
if (formatter != null) {
result.add(formatter); // depends on control dependency: [if], data = [(formatter]
}
}
}
} catch (CmsXmlException e) {
LOG.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
return result;
} }
|
public class class_name {
public JSVariant[] getDominatedVariants() {
if (dominated == null) {
List dom = new ArrayList();
getDominatedVariants(dom);
dominated = (JSVariant[])dom.toArray(new JSVariant[0]);
}
return dominated;
} }
|
public class class_name {
public JSVariant[] getDominatedVariants() {
if (dominated == null) {
List dom = new ArrayList();
getDominatedVariants(dom); // depends on control dependency: [if], data = [none]
dominated = (JSVariant[])dom.toArray(new JSVariant[0]); // depends on control dependency: [if], data = [none]
}
return dominated;
} }
|
public class class_name {
public void marshall(DescribeServicesRequest describeServicesRequest, ProtocolMarshaller protocolMarshaller) {
if (describeServicesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeServicesRequest.getCluster(), CLUSTER_BINDING);
protocolMarshaller.marshall(describeServicesRequest.getServices(), SERVICES_BINDING);
protocolMarshaller.marshall(describeServicesRequest.getInclude(), INCLUDE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeServicesRequest describeServicesRequest, ProtocolMarshaller protocolMarshaller) {
if (describeServicesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeServicesRequest.getCluster(), CLUSTER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeServicesRequest.getServices(), SERVICES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeServicesRequest.getInclude(), INCLUDE_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 stop() {
if (this.isRunning()) {
long duration = System.nanoTime() - this.lastStarted;
this.lastStarted = 0l;
this.stats.add(new Duration(duration));
}
} }
|
public class class_name {
public void stop() {
if (this.isRunning()) {
long duration = System.nanoTime() - this.lastStarted;
this.lastStarted = 0l; // depends on control dependency: [if], data = [none]
this.stats.add(new Duration(duration)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Device withPermissions(DeviceCgroupPermission... permissions) {
com.amazonaws.internal.SdkInternalList<String> permissionsCopy = new com.amazonaws.internal.SdkInternalList<String>(permissions.length);
for (DeviceCgroupPermission value : permissions) {
permissionsCopy.add(value.toString());
}
if (getPermissions() == null) {
setPermissions(permissionsCopy);
} else {
getPermissions().addAll(permissionsCopy);
}
return this;
} }
|
public class class_name {
public Device withPermissions(DeviceCgroupPermission... permissions) {
com.amazonaws.internal.SdkInternalList<String> permissionsCopy = new com.amazonaws.internal.SdkInternalList<String>(permissions.length);
for (DeviceCgroupPermission value : permissions) {
permissionsCopy.add(value.toString()); // depends on control dependency: [for], data = [value]
}
if (getPermissions() == null) {
setPermissions(permissionsCopy); // depends on control dependency: [if], data = [none]
} else {
getPermissions().addAll(permissionsCopy); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public static short[] decodeOctetString(ByteBuffer buf) {
DerId id = DerId.decode(buf);
if (!id.matches(DerId.TagClass.UNIVERSAL, ASN1_OCTET_STRING_TAG_NUM)) {
throw new IllegalArgumentException("Expected OCTET STRING identifier, received " + id);
}
int len = DerUtils.decodeLength(buf);
if (buf.remaining() < len) {
throw new IllegalArgumentException("Insufficient content for OCTET STRING");
}
short[] dst = new short[len];
for (int i = 0; i < len; i++) {
dst[i] = (short) (0xff & buf.get());
}
return dst;
} }
|
public class class_name {
public static short[] decodeOctetString(ByteBuffer buf) {
DerId id = DerId.decode(buf);
if (!id.matches(DerId.TagClass.UNIVERSAL, ASN1_OCTET_STRING_TAG_NUM)) {
throw new IllegalArgumentException("Expected OCTET STRING identifier, received " + id);
}
int len = DerUtils.decodeLength(buf);
if (buf.remaining() < len) {
throw new IllegalArgumentException("Insufficient content for OCTET STRING");
}
short[] dst = new short[len];
for (int i = 0; i < len; i++) {
dst[i] = (short) (0xff & buf.get()); // depends on control dependency: [for], data = [i]
}
return dst;
} }
|
public class class_name {
public static void loadJavaCppResource(String libName) throws Throwable {
String libPrefix = createLibPrefix();
String libExtension = createLibExtension();
String fullName = libPrefix + libName;
String resourceName = fullName + "." + libExtension;
ClassPathResource resource = new ClassPathResource(resourceName);
InputStream inputStream = resource.getInputStream();
if (inputStream == null) {
throw new NullPointerException("No resource found with name '" + resourceName + "'");
}
File tempFile = File.createTempFile(fullName, "." + libExtension);
tempFile.deleteOnExit();
OutputStream outputStream = null;
try {
outputStream = new FileOutputStream(tempFile);
byte[] buffer = new byte[8192];
while (true) {
int read = inputStream.read(buffer);
if (read < 0) {
break;
}
outputStream.write(buffer, 0, read);
}
outputStream.flush();
outputStream.close();
outputStream = null;
System.load(tempFile.toString());
} finally {
if (outputStream != null) {
outputStream.close();
}
}
} }
|
public class class_name {
public static void loadJavaCppResource(String libName) throws Throwable {
String libPrefix = createLibPrefix();
String libExtension = createLibExtension();
String fullName = libPrefix + libName;
String resourceName = fullName + "." + libExtension;
ClassPathResource resource = new ClassPathResource(resourceName);
InputStream inputStream = resource.getInputStream();
if (inputStream == null) {
throw new NullPointerException("No resource found with name '" + resourceName + "'");
}
File tempFile = File.createTempFile(fullName, "." + libExtension);
tempFile.deleteOnExit();
OutputStream outputStream = null;
try {
outputStream = new FileOutputStream(tempFile);
byte[] buffer = new byte[8192];
while (true) {
int read = inputStream.read(buffer);
if (read < 0) {
break;
}
outputStream.write(buffer, 0, read); // depends on control dependency: [while], data = [none]
}
outputStream.flush();
outputStream.close();
outputStream = null;
System.load(tempFile.toString());
} finally {
if (outputStream != null) {
outputStream.close(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public Date getFirstDateValue(String name) {
Object objs[] = getValues(name);
for (Object obj : objs) {
if (obj instanceof Date) {
return (Date) obj;
}
}
return null;
} }
|
public class class_name {
public Date getFirstDateValue(String name) {
Object objs[] = getValues(name);
for (Object obj : objs) {
if (obj instanceof Date) {
return (Date) obj; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public List<SystemEventListener> getViewListenersForEventClass(Class<? extends SystemEvent> systemEvent) {
if (systemEvent == null) {
throw new NullPointerException();
}
if (viewListeners != null) {
return viewListeners.get(systemEvent);
}
return null;
} }
|
public class class_name {
public List<SystemEventListener> getViewListenersForEventClass(Class<? extends SystemEvent> systemEvent) {
if (systemEvent == null) {
throw new NullPointerException();
}
if (viewListeners != null) {
return viewListeners.get(systemEvent); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
private String generateTypeKey(final Object object, final KeyGenerator typeGenerator) {
String objectKey = null;
Method method = null;
try {
method = object.getClass().getMethod(typeGenerator.value());
objectKey = (String) method.invoke(object);
} catch (final NoSuchMethodException e) {
LOGGER.log(METHOD_NOT_FOUND, typeGenerator.value(), object.getClass().getSimpleName(), e);
} catch (final SecurityException e) {
LOGGER.log(NO_KEY_GENERATOR_METHOD, typeGenerator.value(), object.getClass().getSimpleName(), e);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
LOGGER.log(KEY_GENERATOR_FAILURE, typeGenerator.value(), object.getClass().getSimpleName(), e);
}
return objectKey;
} }
|
public class class_name {
private String generateTypeKey(final Object object, final KeyGenerator typeGenerator) {
String objectKey = null;
Method method = null;
try {
method = object.getClass().getMethod(typeGenerator.value());
// depends on control dependency: [try], data = [none]
objectKey = (String) method.invoke(object);
// depends on control dependency: [try], data = [none]
} catch (final NoSuchMethodException e) {
LOGGER.log(METHOD_NOT_FOUND, typeGenerator.value(), object.getClass().getSimpleName(), e);
} catch (final SecurityException e) {
// depends on control dependency: [catch], data = [none]
LOGGER.log(NO_KEY_GENERATOR_METHOD, typeGenerator.value(), object.getClass().getSimpleName(), e);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
// depends on control dependency: [catch], data = [none]
LOGGER.log(KEY_GENERATOR_FAILURE, typeGenerator.value(), object.getClass().getSimpleName(), e);
}
// depends on control dependency: [catch], data = [none]
return objectKey;
} }
|
public class class_name {
public java.util.List<CodingDt> getCoding() {
if (myCoding == null) {
myCoding = new java.util.ArrayList<CodingDt>();
}
return myCoding;
} }
|
public class class_name {
public java.util.List<CodingDt> getCoding() {
if (myCoding == null) {
myCoding = new java.util.ArrayList<CodingDt>(); // depends on control dependency: [if], data = [none]
}
return myCoding;
} }
|
public class class_name {
public static Date string2Date (String pvDateString) {
if (pvDateString == null) {
throw new IllegalArgumentException(pvDateString);
}
// 1. pass: pvDateString is a long as milliseconds after Jan 1st 1970
try {
return new Date(Long.parseLong(pvDateString));
} catch (Exception e) {
if (NonCriticalExceptionHandler.isNonCriticalExceptionHandlerEnabled()) {
NonCriticalExceptionHandler.handleException(Util.class, e, "1st pass string2Date: " + pvDateString);
}
}
// 2. pass: Timestamp format. The Timestamp format with two digits og fractional seconds are not parsed correctly by SimpleDateFormat,
// hence we have to use Timestamp.valueOf, which handles this correctly
try {
return Timestamp.valueOf(pvDateString);
} catch (Exception e) {
if (NonCriticalExceptionHandler.isNonCriticalExceptionHandlerEnabled()) {
NonCriticalExceptionHandler.handleException(Util.class, e, "2nd pass string2Date: " + pvDateString);
}
}
// 3. pass, iterate through all registered DateFormats
Collection<DateFormat> dfList = getDateFormats();
for (DateFormat df : dfList) {
try {
return df.parse(pvDateString);
} catch (ParseException e) {
if (NonCriticalExceptionHandler.isNonCriticalExceptionHandlerEnabled()) {
NonCriticalExceptionHandler.handleException(Util.class, e, "3nd pass string2Date: " + pvDateString);
}
}
}
throw new IllegalArgumentException (pvDateString);
} }
|
public class class_name {
public static Date string2Date (String pvDateString) {
if (pvDateString == null) {
throw new IllegalArgumentException(pvDateString);
}
// 1. pass: pvDateString is a long as milliseconds after Jan 1st 1970
try {
return new Date(Long.parseLong(pvDateString));
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (NonCriticalExceptionHandler.isNonCriticalExceptionHandlerEnabled()) {
NonCriticalExceptionHandler.handleException(Util.class, e, "1st pass string2Date: " + pvDateString);
// depends on control dependency: [if], data = [none]
}
}
// depends on control dependency: [catch], data = [none]
// 2. pass: Timestamp format. The Timestamp format with two digits og fractional seconds are not parsed correctly by SimpleDateFormat,
// hence we have to use Timestamp.valueOf, which handles this correctly
try {
return Timestamp.valueOf(pvDateString);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (NonCriticalExceptionHandler.isNonCriticalExceptionHandlerEnabled()) {
NonCriticalExceptionHandler.handleException(Util.class, e, "2nd pass string2Date: " + pvDateString);
// depends on control dependency: [if], data = [none]
}
}
// depends on control dependency: [catch], data = [none]
// 3. pass, iterate through all registered DateFormats
Collection<DateFormat> dfList = getDateFormats();
for (DateFormat df : dfList) {
try {
return df.parse(pvDateString);
// depends on control dependency: [try], data = [none]
} catch (ParseException e) {
if (NonCriticalExceptionHandler.isNonCriticalExceptionHandlerEnabled()) {
NonCriticalExceptionHandler.handleException(Util.class, e, "3nd pass string2Date: " + pvDateString);
// depends on control dependency: [if], data = [none]
}
}
// depends on control dependency: [catch], data = [none]
}
throw new IllegalArgumentException (pvDateString);
} }
|
public class class_name {
@Override
public void tick(long now) {
if (now - this.lastM3UAMessageTime >= this.aspFactoryImpl.m3UAManagementImpl.getHeartbeatTime()) {
this.lastM3UAMessageTime = now;
this.heartBeatAckMissed++;
this.aspFactoryImpl.write(HEART_BEAT);
}
if (this.heartBeatAckMissed > HEART_BEAT_ACK_MISSED_ALLOWED) {
logger.warn(String
.format("HEART_BEAT ACK missed %d is greater than configured %d for AspFactory %s. Underlying Association will be stopped and started again",
this.heartBeatAckMissed, HEART_BEAT_ACK_MISSED_ALLOWED, this.aspFactoryImpl.getName()));
try {
this.aspFactoryImpl.transportManagement.stopAssociation(this.aspFactoryImpl.associationName);
} catch (Exception e) {
logger.warn(String.format("Error while trying to stop underlying Association for AspFactpry=%s",
this.aspFactoryImpl.getName()), e);
}
try {
this.aspFactoryImpl.transportManagement.startAssociation(this.aspFactoryImpl.associationName);
} catch (Exception e) {
logger.error(String.format("Error while trying to start underlying Association for AspFactpry=%s",
this.aspFactoryImpl.getName()), e);
}
// finally cancel
this.cancel();
}
} }
|
public class class_name {
@Override
public void tick(long now) {
if (now - this.lastM3UAMessageTime >= this.aspFactoryImpl.m3UAManagementImpl.getHeartbeatTime()) {
this.lastM3UAMessageTime = now; // depends on control dependency: [if], data = [none]
this.heartBeatAckMissed++; // depends on control dependency: [if], data = [none]
this.aspFactoryImpl.write(HEART_BEAT); // depends on control dependency: [if], data = [none]
}
if (this.heartBeatAckMissed > HEART_BEAT_ACK_MISSED_ALLOWED) {
logger.warn(String
.format("HEART_BEAT ACK missed %d is greater than configured %d for AspFactory %s. Underlying Association will be stopped and started again",
this.heartBeatAckMissed, HEART_BEAT_ACK_MISSED_ALLOWED, this.aspFactoryImpl.getName())); // depends on control dependency: [if], data = [none]
try {
this.aspFactoryImpl.transportManagement.stopAssociation(this.aspFactoryImpl.associationName); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.warn(String.format("Error while trying to stop underlying Association for AspFactpry=%s",
this.aspFactoryImpl.getName()), e);
} // depends on control dependency: [catch], data = [none]
try {
this.aspFactoryImpl.transportManagement.startAssociation(this.aspFactoryImpl.associationName); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error(String.format("Error while trying to start underlying Association for AspFactpry=%s",
this.aspFactoryImpl.getName()), e);
} // depends on control dependency: [catch], data = [none]
// finally cancel
this.cancel(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public ConfigurationAggregator withAccountAggregationSources(AccountAggregationSource... accountAggregationSources) {
if (this.accountAggregationSources == null) {
setAccountAggregationSources(new com.amazonaws.internal.SdkInternalList<AccountAggregationSource>(accountAggregationSources.length));
}
for (AccountAggregationSource ele : accountAggregationSources) {
this.accountAggregationSources.add(ele);
}
return this;
} }
|
public class class_name {
public ConfigurationAggregator withAccountAggregationSources(AccountAggregationSource... accountAggregationSources) {
if (this.accountAggregationSources == null) {
setAccountAggregationSources(new com.amazonaws.internal.SdkInternalList<AccountAggregationSource>(accountAggregationSources.length)); // depends on control dependency: [if], data = [none]
}
for (AccountAggregationSource ele : accountAggregationSources) {
this.accountAggregationSources.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public Indexable taskResult(String taskId) {
TaskGroupEntry<TaskItem> taskGroupEntry = super.getNode(taskId);
if (taskGroupEntry != null) {
return taskGroupEntry.taskResult();
}
if (!this.proxyTaskGroupWrapper.isActive()) {
throw new IllegalArgumentException("A dependency task with id '" + taskId + "' is not found");
}
taskGroupEntry = this.proxyTaskGroupWrapper.proxyTaskGroup.getNode(taskId);
if (taskGroupEntry != null) {
return taskGroupEntry.taskResult();
}
throw new IllegalArgumentException("A dependency task or 'post-run' dependent task with with id '" + taskId + "' not found");
} }
|
public class class_name {
public Indexable taskResult(String taskId) {
TaskGroupEntry<TaskItem> taskGroupEntry = super.getNode(taskId);
if (taskGroupEntry != null) {
return taskGroupEntry.taskResult(); // depends on control dependency: [if], data = [none]
}
if (!this.proxyTaskGroupWrapper.isActive()) {
throw new IllegalArgumentException("A dependency task with id '" + taskId + "' is not found");
}
taskGroupEntry = this.proxyTaskGroupWrapper.proxyTaskGroup.getNode(taskId);
if (taskGroupEntry != null) {
return taskGroupEntry.taskResult(); // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("A dependency task or 'post-run' dependent task with with id '" + taskId + "' not found");
} }
|
public class class_name {
public FactorGraph marginalize(Collection<Integer> varNumsToEliminate) {
FactorGraph currentFactorGraph = this;
for (Integer eliminatedVariableIndex : varNumsToEliminate) {
// Each iteration marginalizes out a single variable from
// currentFactorGraph,
// aggregating intermediate results in nextFactorGraph.
FactorGraph nextFactorGraph = new FactorGraph();
// Copy the variables in currentFactorGraph to nextFactorGraph
for (String variableName : currentFactorGraph.getVariables().getVariableNamesArray()) {
int varIndex = currentFactorGraph.getVariables().getVariableByName(variableName);
if (varIndex != eliminatedVariableIndex) {
nextFactorGraph = nextFactorGraph.addVariableWithIndex(variableName,
currentFactorGraph.variables.getVariable(varIndex), varIndex);
}
}
// Identify the factors which contain the variable, which must
// be
// multiplied together. All other factors can be immediately
// copied into
// the next factor graph.
List<Factor> factorsToMultiply = Lists.newArrayList();
String mulName = null;
List<Factor> currentFactors = currentFactorGraph.getFactors();
List<String> currentFactorNames = currentFactorGraph.getFactorNames();
for (int i = 0; i < currentFactors.size(); i++) {
Factor factor = currentFactors.get(i);
if (factor.getVars().contains(eliminatedVariableIndex)) {
factorsToMultiply.add(factor);
mulName = currentFactorNames.get(i);
} else {
// No variable in factor is being eliminated, so we don't
// have to
// modify it.
nextFactorGraph = nextFactorGraph.addFactor(currentFactorNames.get(i), factor);
}
}
if (factorsToMultiply.size() > 0) {
// If the variable is present, eliminate it!
Factor productFactor = Factors.product(factorsToMultiply);
nextFactorGraph = nextFactorGraph.addFactor(mulName,
productFactor.marginalize(eliminatedVariableIndex));
}
currentFactorGraph = nextFactorGraph;
}
return currentFactorGraph;
} }
|
public class class_name {
public FactorGraph marginalize(Collection<Integer> varNumsToEliminate) {
FactorGraph currentFactorGraph = this;
for (Integer eliminatedVariableIndex : varNumsToEliminate) {
// Each iteration marginalizes out a single variable from
// currentFactorGraph,
// aggregating intermediate results in nextFactorGraph.
FactorGraph nextFactorGraph = new FactorGraph();
// Copy the variables in currentFactorGraph to nextFactorGraph
for (String variableName : currentFactorGraph.getVariables().getVariableNamesArray()) {
int varIndex = currentFactorGraph.getVariables().getVariableByName(variableName);
if (varIndex != eliminatedVariableIndex) {
nextFactorGraph = nextFactorGraph.addVariableWithIndex(variableName,
currentFactorGraph.variables.getVariable(varIndex), varIndex); // depends on control dependency: [if], data = [none]
}
}
// Identify the factors which contain the variable, which must
// be
// multiplied together. All other factors can be immediately
// copied into
// the next factor graph.
List<Factor> factorsToMultiply = Lists.newArrayList();
String mulName = null;
List<Factor> currentFactors = currentFactorGraph.getFactors();
List<String> currentFactorNames = currentFactorGraph.getFactorNames();
for (int i = 0; i < currentFactors.size(); i++) {
Factor factor = currentFactors.get(i);
if (factor.getVars().contains(eliminatedVariableIndex)) {
factorsToMultiply.add(factor); // depends on control dependency: [if], data = [none]
mulName = currentFactorNames.get(i); // depends on control dependency: [if], data = [none]
} else {
// No variable in factor is being eliminated, so we don't
// have to
// modify it.
nextFactorGraph = nextFactorGraph.addFactor(currentFactorNames.get(i), factor); // depends on control dependency: [if], data = [none]
}
}
if (factorsToMultiply.size() > 0) {
// If the variable is present, eliminate it!
Factor productFactor = Factors.product(factorsToMultiply);
nextFactorGraph = nextFactorGraph.addFactor(mulName,
productFactor.marginalize(eliminatedVariableIndex)); // depends on control dependency: [if], data = [none]
}
currentFactorGraph = nextFactorGraph; // depends on control dependency: [for], data = [none]
}
return currentFactorGraph;
} }
|
public class class_name {
private static double[] transformToLabelProjection(
final MathTransform toLabelProjection,
final Coordinate borderIntersection) {
try {
double[] labelProj = new double[2];
toLabelProjection
.transform(new double[]{borderIntersection.x, borderIntersection.y}, 0, labelProj, 0, 1);
return labelProj;
} catch (TransformException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
private static double[] transformToLabelProjection(
final MathTransform toLabelProjection,
final Coordinate borderIntersection) {
try {
double[] labelProj = new double[2];
toLabelProjection
.transform(new double[]{borderIntersection.x, borderIntersection.y}, 0, labelProj, 0, 1); // depends on control dependency: [try], data = [none]
return labelProj; // depends on control dependency: [try], data = [none]
} catch (TransformException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
Option toOption() {
DefaultOptionBuilder oBuilder = new DefaultOptionBuilder();
oBuilder.withShortName(option).withDescription(description).withRequired(required);
if (longOptionName != null) {
oBuilder.withLongName(longOptionName);
}
if (hasArgs) {
ArgumentBuilder aBuilder = new ArgumentBuilder();
if (argName != null) {
aBuilder.withName(argName);
}
if (argsAreOptional) {
aBuilder.withMinimum(0);
}
if (argsCount != null) {
aBuilder.withMaximum(argsCount);
} else {
aBuilder.withMaximum(1);
}
if (argsValueSeparator != null && argsValueSeparator.length() != 0) {
aBuilder.withInitialSeparator(argsValueSeparator.charAt(0));
aBuilder.withSubsequentSeparator(argsValueSeparator.charAt(0));
}
oBuilder.withArgument(aBuilder.create());
}
return oBuilder.create();
} }
|
public class class_name {
Option toOption() {
DefaultOptionBuilder oBuilder = new DefaultOptionBuilder();
oBuilder.withShortName(option).withDescription(description).withRequired(required);
if (longOptionName != null) {
oBuilder.withLongName(longOptionName); // depends on control dependency: [if], data = [(longOptionName]
}
if (hasArgs) {
ArgumentBuilder aBuilder = new ArgumentBuilder();
if (argName != null) {
aBuilder.withName(argName); // depends on control dependency: [if], data = [(argName]
}
if (argsAreOptional) {
aBuilder.withMinimum(0); // depends on control dependency: [if], data = [none]
}
if (argsCount != null) {
aBuilder.withMaximum(argsCount); // depends on control dependency: [if], data = [(argsCount]
} else {
aBuilder.withMaximum(1); // depends on control dependency: [if], data = [none]
}
if (argsValueSeparator != null && argsValueSeparator.length() != 0) {
aBuilder.withInitialSeparator(argsValueSeparator.charAt(0)); // depends on control dependency: [if], data = [(argsValueSeparator]
aBuilder.withSubsequentSeparator(argsValueSeparator.charAt(0)); // depends on control dependency: [if], data = [(argsValueSeparator]
}
oBuilder.withArgument(aBuilder.create()); // depends on control dependency: [if], data = [none]
}
return oBuilder.create();
} }
|
public class class_name {
public String getSystemMessageId() {
//based on com.ibm.ws.sib.mfp.impl.JsHdrsImpl
if (uuid != null) {
StringBuilder buff = new StringBuilder(uuid.toString());
buff.append(MfpConstants.MESSAGE_HANDLE_SEPARATOR);
buff.append(value);
return new String(buff);
}
else {
return null;
}
} }
|
public class class_name {
public String getSystemMessageId() {
//based on com.ibm.ws.sib.mfp.impl.JsHdrsImpl
if (uuid != null) {
StringBuilder buff = new StringBuilder(uuid.toString());
buff.append(MfpConstants.MESSAGE_HANDLE_SEPARATOR); // depends on control dependency: [if], data = [none]
buff.append(value); // depends on control dependency: [if], data = [none]
return new String(buff); // depends on control dependency: [if], data = [none]
}
else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public ResourceGroup withTags(ResourceGroupTag... tags) {
if (this.tags == null) {
setTags(new java.util.ArrayList<ResourceGroupTag>(tags.length));
}
for (ResourceGroupTag ele : tags) {
this.tags.add(ele);
}
return this;
} }
|
public class class_name {
public ResourceGroup withTags(ResourceGroupTag... tags) {
if (this.tags == null) {
setTags(new java.util.ArrayList<ResourceGroupTag>(tags.length)); // depends on control dependency: [if], data = [none]
}
for (ResourceGroupTag ele : tags) {
this.tags.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static String in(Object[] args) {
if (EmptyUtil.isEmpty(args) == true) {
return "";
}
StringBuilder sql = new StringBuilder();
Arrays.asList(args).forEach(arg -> {
if (arg == null) {
sql.append("NULL");
} else if (arg instanceof CharSequence) {
sql.append("'").append(arg).append("'");
} else {
sql.append(arg);
}
sql.append(", ");
});
sql.setLength(sql.length() - ", ".length());
return sql.toString().trim();
} }
|
public class class_name {
public static String in(Object[] args) {
if (EmptyUtil.isEmpty(args) == true) {
return ""; // depends on control dependency: [if], data = [none]
}
StringBuilder sql = new StringBuilder();
Arrays.asList(args).forEach(arg -> {
if (arg == null) {
sql.append("NULL");
} else if (arg instanceof CharSequence) {
sql.append("'").append(arg).append("'");
} else {
sql.append(arg);
}
sql.append(", ");
});
sql.setLength(sql.length() - ", ".length());
return sql.toString().trim();
} }
|
public class class_name {
protected void checkCacheVersion() {
// Be very aggressive in invalidating the cache.
boolean invalidate = true;
QueryRunner run = new QueryRunner(ds);
try {
long latestVersion = run.query("SELECT version FROM gw_dataversion", Handlers.LONG_HANDLER); //$NON-NLS-1$
if (latestVersion > -1 && dataVersion > -1 && latestVersion == dataVersion) {
invalidate = false;
} else {
dataVersion = latestVersion;
}
} catch (SQLException e) {
// TODO need to use the gateway logger to log this!
e.printStackTrace();
}
if (invalidate) {
invalidateCache();
}
} }
|
public class class_name {
protected void checkCacheVersion() {
// Be very aggressive in invalidating the cache.
boolean invalidate = true;
QueryRunner run = new QueryRunner(ds);
try {
long latestVersion = run.query("SELECT version FROM gw_dataversion", Handlers.LONG_HANDLER); //$NON-NLS-1$
if (latestVersion > -1 && dataVersion > -1 && latestVersion == dataVersion) {
invalidate = false; // depends on control dependency: [if], data = [none]
} else {
dataVersion = latestVersion; // depends on control dependency: [if], data = [none]
}
} catch (SQLException e) {
// TODO need to use the gateway logger to log this!
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
if (invalidate) {
invalidateCache(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public synchronized void sendFile(final String fileName,
final long fileSize, final String description,
final NegotiationProgress progress) {
if (progress == null) {
throw new IllegalArgumentException("Callback progress cannot be null.");
}
checkTransferThread();
if (isDone() || outputStream != null) {
throw new IllegalStateException(
"The negotiation process has already"
+ " been attempted for this file transfer");
}
setFileInfo(fileName, fileSize);
this.callback = progress;
transferThread = new Thread(new Runnable() {
@Override
public void run() {
try {
OutgoingFileTransfer.this.outputStream = negotiateStream(
fileName, fileSize, description);
progress.outputStreamEstablished(OutgoingFileTransfer.this.outputStream);
}
catch (XMPPErrorException e) {
handleXMPPException(e);
}
catch (Exception e) {
setException(e);
}
}
}, "File Transfer Negotiation " + streamID);
transferThread.start();
} }
|
public class class_name {
public synchronized void sendFile(final String fileName,
final long fileSize, final String description,
final NegotiationProgress progress) {
if (progress == null) {
throw new IllegalArgumentException("Callback progress cannot be null.");
}
checkTransferThread();
if (isDone() || outputStream != null) {
throw new IllegalStateException(
"The negotiation process has already"
+ " been attempted for this file transfer");
}
setFileInfo(fileName, fileSize);
this.callback = progress;
transferThread = new Thread(new Runnable() {
@Override
public void run() {
try {
OutgoingFileTransfer.this.outputStream = negotiateStream(
fileName, fileSize, description); // depends on control dependency: [try], data = [none]
progress.outputStreamEstablished(OutgoingFileTransfer.this.outputStream); // depends on control dependency: [try], data = [none]
}
catch (XMPPErrorException e) {
handleXMPPException(e);
} // depends on control dependency: [catch], data = [none]
catch (Exception e) {
setException(e);
} // depends on control dependency: [catch], data = [none]
}
}, "File Transfer Negotiation " + streamID);
transferThread.start();
} }
|
public class class_name {
private static boolean intersectionPrefixes(ComponentGroup group,
Set<String> intersectionPrefixes) {
if (intersectionPrefixes != null) {
for (String prefix : group.prefixes) {
if (intersectionPrefixes.contains(prefix)) {
return true;
}
}
}
return false;
} }
|
public class class_name {
private static boolean intersectionPrefixes(ComponentGroup group,
Set<String> intersectionPrefixes) {
if (intersectionPrefixes != null) {
for (String prefix : group.prefixes) {
if (intersectionPrefixes.contains(prefix)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} }
|
public class class_name {
public static void updateXmlForVfsFile(CmsLink link, Element element) {
// if element is not null
if (element != null) {
// update the type attribute
updateAttribute(element, CmsLink.ATTRIBUTE_TYPE, link.getType().getNameForXml());
// update the sub-elements
updateXml(link, element, false);
}
} }
|
public class class_name {
public static void updateXmlForVfsFile(CmsLink link, Element element) {
// if element is not null
if (element != null) {
// update the type attribute
updateAttribute(element, CmsLink.ATTRIBUTE_TYPE, link.getType().getNameForXml()); // depends on control dependency: [if], data = [(element]
// update the sub-elements
updateXml(link, element, false); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Optional<Long> readMaybeVLong(ByteBuf bf) {
if (bf.readableBytes() >= 1) {
byte b = bf.readByte();
return read(bf, b, 7, (long) b & 0x7F, 1);
} else {
bf.resetReaderIndex();
return Optional.empty();
}
} }
|
public class class_name {
public static Optional<Long> readMaybeVLong(ByteBuf bf) {
if (bf.readableBytes() >= 1) {
byte b = bf.readByte();
return read(bf, b, 7, (long) b & 0x7F, 1); // depends on control dependency: [if], data = [none]
} else {
bf.resetReaderIndex(); // depends on control dependency: [if], data = [none]
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public ArrayList<I> getInvocations()
{
LruCache<Object,I> invocationCache = _invocationCache;
ArrayList<I> invocationList = new ArrayList<>();
synchronized (invocationCache) {
Iterator<I> iter;
iter = invocationCache.values();
while (iter.hasNext()) {
invocationList.add(iter.next());
}
}
return invocationList;
} }
|
public class class_name {
public ArrayList<I> getInvocations()
{
LruCache<Object,I> invocationCache = _invocationCache;
ArrayList<I> invocationList = new ArrayList<>();
synchronized (invocationCache) {
Iterator<I> iter;
iter = invocationCache.values();
while (iter.hasNext()) {
invocationList.add(iter.next()); // depends on control dependency: [while], data = [none]
}
}
return invocationList;
} }
|
public class class_name {
public Optional<MediaType> matchHeaders(Iterable<? extends CharSequence> acceptHeaders) {
requireNonNull(acceptHeaders, "acceptHeaders");
final List<MediaType> ranges = new ArrayList<>(4);
for (CharSequence acceptHeader : acceptHeaders) {
addRanges(ranges, acceptHeader);
}
return match(ranges);
} }
|
public class class_name {
public Optional<MediaType> matchHeaders(Iterable<? extends CharSequence> acceptHeaders) {
requireNonNull(acceptHeaders, "acceptHeaders");
final List<MediaType> ranges = new ArrayList<>(4);
for (CharSequence acceptHeader : acceptHeaders) {
addRanges(ranges, acceptHeader); // depends on control dependency: [for], data = [acceptHeader]
}
return match(ranges);
} }
|
public class class_name {
public Long hset(Object key, Object field, Object value) {
Jedis jedis = getJedis();
try {
return jedis.hset(keyToBytes(key), fieldToBytes(field), valueToBytes(value));
}
finally {close(jedis);}
} }
|
public class class_name {
public Long hset(Object key, Object field, Object value) {
Jedis jedis = getJedis();
try {
return jedis.hset(keyToBytes(key), fieldToBytes(field), valueToBytes(value));
// depends on control dependency: [try], data = [none]
}
finally {close(jedis);}
} }
|
public class class_name {
private static Thread[] getThreads(ThreadGroup g) {
int mul = 1;
do {
Thread[] arr = new Thread[g.activeCount() * mul + 1];
if (g.enumerate(arr) < arr.length) {
return arr;
}
mul++;
} while (true);
} }
|
public class class_name {
private static Thread[] getThreads(ThreadGroup g) {
int mul = 1;
do {
Thread[] arr = new Thread[g.activeCount() * mul + 1];
if (g.enumerate(arr) < arr.length) {
return arr; // depends on control dependency: [if], data = [none]
}
mul++;
} while (true);
} }
|
public class class_name {
private FederalStipendRequested getFederalStipendRequested() {
FederalStipendRequested federalStipendRequested = FederalStipendRequested.Factory
.newInstance();
ProposalDevelopmentBudgetExtContract budget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal());
if (budget == null) {
return federalStipendRequested;
}
ScaleTwoDecimal sumOfLineItemCost = ScaleTwoDecimal.ZERO;
ScaleTwoDecimal numberOfMonths = ScaleTwoDecimal.ZERO;
for (BudgetPeriodContract budgetPeriod : budget.getBudgetPeriods()) {
if (budgetPeriod.getBudgetPeriod() == 1) {
for (BudgetLineItemContract budgetLineItem : budgetPeriod.getBudgetLineItems()) {
if (getCostElementsByParam(ConfigurationConstants.STIPEND_COST_ELEMENTS).contains(budgetLineItem.getCostElementBO().getCostElement())) {
sumOfLineItemCost = sumOfLineItemCost.add(budgetLineItem.getLineItemCost());
numberOfMonths = numberOfMonths.add(getNumberOfMonths(budgetLineItem.getStartDate(), budgetLineItem.getEndDate()));
}
}
}
}
federalStipendRequested.setAmount(sumOfLineItemCost.bigDecimalValue());
federalStipendRequested.setNumberOfMonths(numberOfMonths.bigDecimalValue());
return federalStipendRequested;
} }
|
public class class_name {
private FederalStipendRequested getFederalStipendRequested() {
FederalStipendRequested federalStipendRequested = FederalStipendRequested.Factory
.newInstance();
ProposalDevelopmentBudgetExtContract budget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal());
if (budget == null) {
return federalStipendRequested; // depends on control dependency: [if], data = [none]
}
ScaleTwoDecimal sumOfLineItemCost = ScaleTwoDecimal.ZERO;
ScaleTwoDecimal numberOfMonths = ScaleTwoDecimal.ZERO;
for (BudgetPeriodContract budgetPeriod : budget.getBudgetPeriods()) {
if (budgetPeriod.getBudgetPeriod() == 1) {
for (BudgetLineItemContract budgetLineItem : budgetPeriod.getBudgetLineItems()) {
if (getCostElementsByParam(ConfigurationConstants.STIPEND_COST_ELEMENTS).contains(budgetLineItem.getCostElementBO().getCostElement())) {
sumOfLineItemCost = sumOfLineItemCost.add(budgetLineItem.getLineItemCost()); // depends on control dependency: [if], data = [none]
numberOfMonths = numberOfMonths.add(getNumberOfMonths(budgetLineItem.getStartDate(), budgetLineItem.getEndDate())); // depends on control dependency: [if], data = [none]
}
}
}
}
federalStipendRequested.setAmount(sumOfLineItemCost.bigDecimalValue());
federalStipendRequested.setNumberOfMonths(numberOfMonths.bigDecimalValue());
return federalStipendRequested;
} }
|
public class class_name {
public static void mult(double alpha , DMatrix1Row a , DMatrix1Row b , DMatrix1Row c )
{
// TODO add a matrix vectory multiply here
if( b.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) {
MatrixMatrixMult_DDRM.mult_reorder(alpha, a, b, c);
} else {
MatrixMatrixMult_DDRM.mult_small(alpha,a,b,c);
}
} }
|
public class class_name {
public static void mult(double alpha , DMatrix1Row a , DMatrix1Row b , DMatrix1Row c )
{
// TODO add a matrix vectory multiply here
if( b.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) {
MatrixMatrixMult_DDRM.mult_reorder(alpha, a, b, c); // depends on control dependency: [if], data = [none]
} else {
MatrixMatrixMult_DDRM.mult_small(alpha,a,b,c); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void tagJSAction(CmsObject cms, HttpServletRequest req) throws CmsException, IOException {
CmsJspStandardContextBean standardContext = getStandardContext(cms, req);
CmsContainerPageBean containerPage = standardContext.getPage();
String includeType = TYPE_JAVASCRIPT;
Set<String> jsIncludes = new LinkedHashSet<String>();
Map<String, String> inlineJS = new LinkedHashMap<String, String>();
// add defaults
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_defaults)) {
String[] defaults = m_defaults.split("\\|");
for (int i = 0; i < defaults.length; i++) {
jsIncludes.add(defaults[i].trim());
}
}
collectHeadIncludesForContainerElement(
cms,
req,
standardContext,
containerPage,
includeType,
jsIncludes,
inlineJS);
if (standardContext.getDetailContentId() != null) {
try {
CmsResource detailContent = cms.readResource(
standardContext.getDetailContentId(),
CmsResourceFilter.ignoreExpirationOffline(cms));
CmsFormatterConfiguration config = OpenCms.getADEManager().lookupConfiguration(
cms,
cms.getRequestContext().getRootUri()).getFormatters(cms, detailContent);
boolean requiresAllIncludes = true;
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getDetailtype())
&& CmsStringUtil.isNotEmptyOrWhitespaceOnly(getDetailwidth())) {
try {
int width = Integer.parseInt(getDetailwidth());
I_CmsFormatterBean formatter = config.getDetailFormatter(getDetailtype(), width);
jsIncludes.addAll(formatter.getJavascriptHeadIncludes());
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(formatter.getInlineJavascript())) {
inlineJS.put(formatter.getId(), formatter.getInlineJavascript());
}
requiresAllIncludes = false;
} catch (NumberFormatException ne) {
// nothing to do, we will include JavaScript for all detail containers
}
}
if (requiresAllIncludes) {
for (I_CmsFormatterBean formatter : config.getDetailFormatters()) {
jsIncludes.addAll(getHeadIncludes(formatter, includeType));
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(formatter.getInlineJavascript())) {
inlineJS.put(formatter.getId(), formatter.getInlineJavascript());
}
}
}
} catch (CmsException e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_READING_REQUIRED_RESOURCE_1,
standardContext.getDetailContentId()),
e);
}
}
for (String jsUri : jsIncludes) {
pageContext.getOut().print(
"\n<script type=\"text/javascript\" src=\""
+ CmsJspTagLink.linkTagAction(jsUri.trim(), req)
+ generateReqParams()
+ "\"></script>");
}
if (!inlineJS.isEmpty()) {
StringBuffer inline = new StringBuffer();
for (Entry<String, String> jsEntry : inlineJS.entrySet()) {
inline.append("\n<script type=\"text/javascript\">\n");
inline.append(jsEntry.getValue()).append("\n\n");
inline.append("\n</script>\n");
}
pageContext.getOut().print(inline.toString());
}
} }
|
public class class_name {
public void tagJSAction(CmsObject cms, HttpServletRequest req) throws CmsException, IOException {
CmsJspStandardContextBean standardContext = getStandardContext(cms, req);
CmsContainerPageBean containerPage = standardContext.getPage();
String includeType = TYPE_JAVASCRIPT;
Set<String> jsIncludes = new LinkedHashSet<String>();
Map<String, String> inlineJS = new LinkedHashMap<String, String>();
// add defaults
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_defaults)) {
String[] defaults = m_defaults.split("\\|");
for (int i = 0; i < defaults.length; i++) {
jsIncludes.add(defaults[i].trim()); // depends on control dependency: [for], data = [i]
}
}
collectHeadIncludesForContainerElement(
cms,
req,
standardContext,
containerPage,
includeType,
jsIncludes,
inlineJS);
if (standardContext.getDetailContentId() != null) {
try {
CmsResource detailContent = cms.readResource(
standardContext.getDetailContentId(),
CmsResourceFilter.ignoreExpirationOffline(cms));
CmsFormatterConfiguration config = OpenCms.getADEManager().lookupConfiguration(
cms,
cms.getRequestContext().getRootUri()).getFormatters(cms, detailContent);
boolean requiresAllIncludes = true;
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getDetailtype())
&& CmsStringUtil.isNotEmptyOrWhitespaceOnly(getDetailwidth())) {
try {
int width = Integer.parseInt(getDetailwidth());
I_CmsFormatterBean formatter = config.getDetailFormatter(getDetailtype(), width);
jsIncludes.addAll(formatter.getJavascriptHeadIncludes()); // depends on control dependency: [try], data = [none]
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(formatter.getInlineJavascript())) {
inlineJS.put(formatter.getId(), formatter.getInlineJavascript()); // depends on control dependency: [if], data = [none]
}
requiresAllIncludes = false; // depends on control dependency: [try], data = [none]
} catch (NumberFormatException ne) {
// nothing to do, we will include JavaScript for all detail containers
} // depends on control dependency: [catch], data = [none]
}
if (requiresAllIncludes) {
for (I_CmsFormatterBean formatter : config.getDetailFormatters()) {
jsIncludes.addAll(getHeadIncludes(formatter, includeType)); // depends on control dependency: [for], data = [formatter]
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(formatter.getInlineJavascript())) {
inlineJS.put(formatter.getId(), formatter.getInlineJavascript()); // depends on control dependency: [if], data = [none]
}
}
}
} catch (CmsException e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_READING_REQUIRED_RESOURCE_1,
standardContext.getDetailContentId()),
e);
} // depends on control dependency: [catch], data = [none]
}
for (String jsUri : jsIncludes) {
pageContext.getOut().print(
"\n<script type=\"text/javascript\" src=\""
+ CmsJspTagLink.linkTagAction(jsUri.trim(), req)
+ generateReqParams()
+ "\"></script>");
}
if (!inlineJS.isEmpty()) {
StringBuffer inline = new StringBuffer();
for (Entry<String, String> jsEntry : inlineJS.entrySet()) {
inline.append("\n<script type=\"text/javascript\">\n");
inline.append(jsEntry.getValue()).append("\n\n");
inline.append("\n</script>\n");
}
pageContext.getOut().print(inline.toString());
}
} }
|
public class class_name {
public static String toLongFormatFromDate(Date date) {
if (date == null) {
return null;
}
return strategy.formatFor(FACEBOOK_LONG_DATE_FORMAT_WITHOUT_TIMEZONE).format(date);
} }
|
public class class_name {
public static String toLongFormatFromDate(Date date) {
if (date == null) {
return null;
// depends on control dependency: [if], data = [none]
}
return strategy.formatFor(FACEBOOK_LONG_DATE_FORMAT_WITHOUT_TIMEZONE).format(date);
} }
|
public class class_name {
protected String buildBridgeURL(GetSnapshotHistoryTaskParameters taskParams) {
int pageNumber = taskParams.getPageNumber();
if (pageNumber < SnapshotConstants.DEFAULT_HISTORY_PAGE_NUMBER) {
pageNumber = SnapshotConstants.DEFAULT_HISTORY_PAGE_NUMBER;
}
int pageSize = taskParams.getPageSize();
if (pageSize < SnapshotConstants.MIN_HISTORY_PAGE_SIZE ||
pageSize > SnapshotConstants.MAX_HISTORY_PAGE_SIZE) {
pageSize = SnapshotConstants.MAX_HISTORY_PAGE_SIZE;
}
String snapshotId = taskParams.getSnapshotId();
return MessageFormat.format(
"{0}/snapshot/{1}/history?page={2}&pageSize={3}",
buildBridgeBaseURL(),
snapshotId,
String.valueOf(pageNumber),
String.valueOf(pageSize));
} }
|
public class class_name {
protected String buildBridgeURL(GetSnapshotHistoryTaskParameters taskParams) {
int pageNumber = taskParams.getPageNumber();
if (pageNumber < SnapshotConstants.DEFAULT_HISTORY_PAGE_NUMBER) {
pageNumber = SnapshotConstants.DEFAULT_HISTORY_PAGE_NUMBER; // depends on control dependency: [if], data = [none]
}
int pageSize = taskParams.getPageSize();
if (pageSize < SnapshotConstants.MIN_HISTORY_PAGE_SIZE ||
pageSize > SnapshotConstants.MAX_HISTORY_PAGE_SIZE) {
pageSize = SnapshotConstants.MAX_HISTORY_PAGE_SIZE; // depends on control dependency: [if], data = [none]
}
String snapshotId = taskParams.getSnapshotId();
return MessageFormat.format(
"{0}/snapshot/{1}/history?page={2}&pageSize={3}",
buildBridgeBaseURL(),
snapshotId,
String.valueOf(pageNumber),
String.valueOf(pageSize));
} }
|
public class class_name {
public static RadioButton create(String name, String value, String idSuffix, String label, boolean isSelected,
boolean isDisabled)
{
RadioButton _result = new RadioButton();
_result.setName(name);
_result.setValue(value);
if (IS_NOT_EMPTY.test(idSuffix))
{
_result.setIdSuffix(idSuffix);
}
_result.setLabel(label);
_result.setSelected(isSelected);
_result.setDisabled(isDisabled);
return _result;
} }
|
public class class_name {
public static RadioButton create(String name, String value, String idSuffix, String label, boolean isSelected,
boolean isDisabled)
{
RadioButton _result = new RadioButton();
_result.setName(name);
_result.setValue(value);
if (IS_NOT_EMPTY.test(idSuffix))
{
_result.setIdSuffix(idSuffix);
// depends on control dependency: [if], data = [none]
}
_result.setLabel(label);
_result.setSelected(isSelected);
_result.setDisabled(isDisabled);
return _result;
} }
|
public class class_name {
private static int getIndex(String identifier, String subIdentifier) {
int position = identifier.indexOf(subIdentifier);
if (position > 0) {
String temp = identifier.substring(position + (subIdentifier.length()));
return readInteger(temp);
}
return -1;
} }
|
public class class_name {
private static int getIndex(String identifier, String subIdentifier) {
int position = identifier.indexOf(subIdentifier);
if (position > 0) {
String temp = identifier.substring(position + (subIdentifier.length()));
return readInteger(temp); // depends on control dependency: [if], data = [none]
}
return -1;
} }
|
public class class_name {
void init(KProcess process) {
process.markings = new Object[this.elements.size()];
for (KElement element : this.elements) {
element.init(process);
}
} }
|
public class class_name {
void init(KProcess process) {
process.markings = new Object[this.elements.size()];
for (KElement element : this.elements) {
element.init(process); // depends on control dependency: [for], data = [element]
}
} }
|
public class class_name {
public final boolean doInRedis(List<RedisClient> clients, boolean isRead, Object key) {
List<Integer> randomIndexs = RandomUtil.randomizeWithinLimit(clients.size());
boolean success = false;
for (Integer index : randomIndexs) {
RedisClient client = clients.get(index);
long start = System.currentTimeMillis();
try {
result = doOperation(client);
long end = System.currentTimeMillis();
logger.info("[RedisCache:" + getOptionType() + "]" + " <key:" + key + "> <client: " +
client.getCacheName() + "> <server: " + client.getLiteralRedisServer() +
"> success ! (use " + (end - start) + " ms)");
if (isRead) { // read=true,读取出非空即返回,否则双写
if (result == null) {
// retry another client
logger.info("[RedisCache:" + getOptionType() + "]" + " <key:" + key + "> <client: " +
client.getCacheName() + "> <server: " + client.getLiteralRedisServer() +
"> but null result... (use " + (end - start) + " ms)");
continue;
}
return true;
}
success = success || true;
} catch (Exception e) {
success = success || false;
this.e = new RedisOperationException(e.getMessage() + "@" + client.getLiteralRedisServer(), e);
long end = System.currentTimeMillis();
logger.error("[[RedisCache:" + getOptionType() + "]" + " <key:" + key + "> <client: " +
client.getCacheName() + "> <server: " + client.getLiteralRedisServer() + "> fail. " +
e.getMessage() + "! (use " + (end - start) + " ms)");
}
}
return success;
} }
|
public class class_name {
public final boolean doInRedis(List<RedisClient> clients, boolean isRead, Object key) {
List<Integer> randomIndexs = RandomUtil.randomizeWithinLimit(clients.size());
boolean success = false;
for (Integer index : randomIndexs) {
RedisClient client = clients.get(index);
long start = System.currentTimeMillis();
try {
result = doOperation(client); // depends on control dependency: [try], data = [none]
long end = System.currentTimeMillis();
logger.info("[RedisCache:" + getOptionType() + "]" + " <key:" + key + "> <client: " +
client.getCacheName() + "> <server: " + client.getLiteralRedisServer() +
"> success ! (use " + (end - start) + " ms)"); // depends on control dependency: [try], data = [none]
if (isRead) { // read=true,读取出非空即返回,否则双写
if (result == null) {
// retry another client
logger.info("[RedisCache:" + getOptionType() + "]" + " <key:" + key + "> <client: " +
client.getCacheName() + "> <server: " + client.getLiteralRedisServer() +
"> but null result... (use " + (end - start) + " ms)"); // depends on control dependency: [if], data = [none]
continue;
}
return true; // depends on control dependency: [if], data = [none]
}
success = success || true; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
success = success || false;
this.e = new RedisOperationException(e.getMessage() + "@" + client.getLiteralRedisServer(), e);
long end = System.currentTimeMillis();
logger.error("[[RedisCache:" + getOptionType() + "]" + " <key:" + key + "> <client: " +
client.getCacheName() + "> <server: " + client.getLiteralRedisServer() + "> fail. " +
e.getMessage() + "! (use " + (end - start) + " ms)");
} // depends on control dependency: [catch], data = [none]
}
return success;
} }
|
public class class_name {
public int countAndLogWarnings() {
final List<String> warnings = new LinkedList<>();
// find elements with a missing description
getModel().getElements().stream()
.filter(e -> !(e instanceof ContainerInstance) && !(e instanceof DeploymentNode))
.filter(e -> e.getDescription() == null || e.getDescription().trim().length() == 0)
.forEach(e -> warnings.add("The " + typeof(e) + " \"" + e.getCanonicalName().substring(1) + "\" is missing a description."));
// find containers with a missing technology
getModel().getElements().stream()
.filter(e -> e instanceof Container)
.map(e -> (Container)e)
.filter(c -> c.getTechnology() == null || c.getTechnology().trim().length() == 0)
.forEach(c -> warnings.add("The container \"" + c.getCanonicalName().substring(1) + "\" is missing a technology."));
// find components with a missing technology
getModel().getElements().stream()
.filter(e -> e instanceof Component)
.map(e -> (Component)e)
.filter(c -> c.getTechnology() == null || c.getTechnology().trim().length() == 0)
.forEach(c -> warnings.add("The component \"" + c.getCanonicalName().substring(1) + "\" is missing a technology."));
// find component relationships with a missing description
for (Relationship relationship : getModel().getRelationships()) {
if (relationship.getSource() instanceof Component && relationship.getDestination() instanceof Component &&
relationship.getSource().getParent().equals(relationship.getDestination().getParent())) {
// ignore component-component relationships inside the same container because these are
// often identified using reflection and won't have a description
// (i.e. let's not flood the user with warnings)
} else {
if (relationship.getDescription() == null || relationship.getDescription().trim().length() == 0) {
warnings.add("The relationship between " + typeof(relationship.getSource()) + " \"" + relationship.getSource().getCanonicalName().substring(1) + "\" and " + typeof(relationship.getDestination()) + " \"" + relationship.getDestination().getCanonicalName().substring(1) + "\" is missing a description.");
}
}
}
// diagram keys have not been specified - this is only applicable to
// workspaces created with the early versions of Structurizr for Java
getViews().getSystemLandscapeViews().stream()
.filter(v -> v.getKey() == null)
.forEach(v -> warnings.add("System Landscape view \"" + v.getName() + "\": Missing key"));
getViews().getSystemContextViews().stream()
.filter(v -> v.getKey() == null)
.forEach(v -> warnings.add("System Context view \"" + v.getName() + "\": Missing key"));
getViews().getContainerViews().stream()
.filter(v -> v.getKey() == null)
.forEach(v -> warnings.add("Container view \"" + v.getName() + "\": Missing key"));
getViews().getComponentViews().stream()
.filter(v -> v.getKey() == null)
.forEach(v -> warnings.add("Component view \"" + v.getName() + "\": Missing key"));
getViews().getDynamicViews().stream()
.filter(v -> v.getKey() == null)
.forEach(v -> warnings.add("Dynamic view \"" + v.getName() + "\": Missing key"));
getViews().getDeploymentViews().stream()
.filter(v -> v.getKey() == null)
.forEach(v -> warnings.add("Deployment view \"" + v.getName() + "\": Missing key"));
warnings.forEach(log::warn);
return warnings.size();
} }
|
public class class_name {
public int countAndLogWarnings() {
final List<String> warnings = new LinkedList<>();
// find elements with a missing description
getModel().getElements().stream()
.filter(e -> !(e instanceof ContainerInstance) && !(e instanceof DeploymentNode))
.filter(e -> e.getDescription() == null || e.getDescription().trim().length() == 0)
.forEach(e -> warnings.add("The " + typeof(e) + " \"" + e.getCanonicalName().substring(1) + "\" is missing a description."));
// find containers with a missing technology
getModel().getElements().stream()
.filter(e -> e instanceof Container)
.map(e -> (Container)e)
.filter(c -> c.getTechnology() == null || c.getTechnology().trim().length() == 0)
.forEach(c -> warnings.add("The container \"" + c.getCanonicalName().substring(1) + "\" is missing a technology."));
// find components with a missing technology
getModel().getElements().stream()
.filter(e -> e instanceof Component)
.map(e -> (Component)e)
.filter(c -> c.getTechnology() == null || c.getTechnology().trim().length() == 0)
.forEach(c -> warnings.add("The component \"" + c.getCanonicalName().substring(1) + "\" is missing a technology."));
// find component relationships with a missing description
for (Relationship relationship : getModel().getRelationships()) {
if (relationship.getSource() instanceof Component && relationship.getDestination() instanceof Component &&
relationship.getSource().getParent().equals(relationship.getDestination().getParent())) {
// ignore component-component relationships inside the same container because these are
// often identified using reflection and won't have a description
// (i.e. let's not flood the user with warnings)
} else {
if (relationship.getDescription() == null || relationship.getDescription().trim().length() == 0) {
warnings.add("The relationship between " + typeof(relationship.getSource()) + " \"" + relationship.getSource().getCanonicalName().substring(1) + "\" and " + typeof(relationship.getDestination()) + " \"" + relationship.getDestination().getCanonicalName().substring(1) + "\" is missing a description."); // depends on control dependency: [if], data = [none]
}
}
}
// diagram keys have not been specified - this is only applicable to
// workspaces created with the early versions of Structurizr for Java
getViews().getSystemLandscapeViews().stream()
.filter(v -> v.getKey() == null)
.forEach(v -> warnings.add("System Landscape view \"" + v.getName() + "\": Missing key"));
getViews().getSystemContextViews().stream()
.filter(v -> v.getKey() == null)
.forEach(v -> warnings.add("System Context view \"" + v.getName() + "\": Missing key"));
getViews().getContainerViews().stream()
.filter(v -> v.getKey() == null)
.forEach(v -> warnings.add("Container view \"" + v.getName() + "\": Missing key"));
getViews().getComponentViews().stream()
.filter(v -> v.getKey() == null)
.forEach(v -> warnings.add("Component view \"" + v.getName() + "\": Missing key"));
getViews().getDynamicViews().stream()
.filter(v -> v.getKey() == null)
.forEach(v -> warnings.add("Dynamic view \"" + v.getName() + "\": Missing key"));
getViews().getDeploymentViews().stream()
.filter(v -> v.getKey() == null)
.forEach(v -> warnings.add("Deployment view \"" + v.getName() + "\": Missing key"));
warnings.forEach(log::warn);
return warnings.size();
} }
|
public class class_name {
protected String getPropertyDefaultValue(AnnotatedElement element) {
if (element.isAnnotationPresent(DefaultValue.class)) {
return element.getAnnotation(DefaultValue.class).value();
}
return null;
} }
|
public class class_name {
protected String getPropertyDefaultValue(AnnotatedElement element) {
if (element.isAnnotationPresent(DefaultValue.class)) {
return element.getAnnotation(DefaultValue.class).value(); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public XEvent remove(int index) {
try {
XEvent result = events.remove(index);
return result;
} catch (IOException e) {
e.printStackTrace();
return null;
}
} }
|
public class class_name {
public XEvent remove(int index) {
try {
XEvent result = events.remove(index);
return result; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public int getLocalPort() {
final SIPTransaction sipTransaction = (SIPTransaction)getTransaction();
if(sipTransaction != null) {
return sipTransaction.getPort();
} else {
final String transport = JainSipUtils.findTransport(message);
final MobicentsExtendedListeningPoint listeningPoint = sipFactoryImpl.getSipNetworkInterfaceManager().findMatchingListeningPoint(transport, false);
return listeningPoint.getPort();
}
} }
|
public class class_name {
public int getLocalPort() {
final SIPTransaction sipTransaction = (SIPTransaction)getTransaction();
if(sipTransaction != null) {
return sipTransaction.getPort(); // depends on control dependency: [if], data = [none]
} else {
final String transport = JainSipUtils.findTransport(message);
final MobicentsExtendedListeningPoint listeningPoint = sipFactoryImpl.getSipNetworkInterfaceManager().findMatchingListeningPoint(transport, false);
return listeningPoint.getPort(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private boolean updateState(ImmutableMember member) {
// If the member matches the local member, ignore the update.
if (member.id().equals(localMember.id())) {
return false;
}
SwimMember swimMember = members.get(member.id());
// If the local member is not present, add the member in the ALIVE state.
if (swimMember == null) {
if (member.state() == State.ALIVE) {
swimMember = new SwimMember(member);
members.put(swimMember.id(), swimMember);
randomMembers.add(swimMember);
Collections.shuffle(randomMembers);
LOGGER.debug("{} - Member added {}", this.localMember.id(), swimMember);
swimMember.setState(State.ALIVE);
post(new GroupMembershipEvent(GroupMembershipEvent.Type.MEMBER_ADDED, swimMember.copy()));
recordUpdate(swimMember.copy());
return true;
}
return false;
}
// If the term has been increased, update the member and record a gossip event.
else if (member.incarnationNumber() > swimMember.getIncarnationNumber()) {
// If the member's version has changed, remove the old member and add the new member.
if (!Objects.equals(member.version(), swimMember.version())) {
members.remove(member.id());
randomMembers.remove(swimMember);
post(new GroupMembershipEvent(GroupMembershipEvent.Type.MEMBER_REMOVED, swimMember.copy()));
swimMember = new SwimMember(member);
swimMember.setState(State.ALIVE);
members.put(member.id(), swimMember);
randomMembers.add(swimMember);
Collections.shuffle(randomMembers);
LOGGER.debug("{} - Evicted member for new version {}", this.localMember.id(), swimMember);
post(new GroupMembershipEvent(GroupMembershipEvent.Type.MEMBER_ADDED, swimMember.copy()));
recordUpdate(swimMember.copy());
} else {
// Update the term for the local member.
swimMember.setIncarnationNumber(member.incarnationNumber());
// If the state has been changed to ALIVE, trigger a REACHABILITY_CHANGED event and then update metadata.
if (member.state() == State.ALIVE && swimMember.getState() != State.ALIVE) {
swimMember.setState(State.ALIVE);
LOGGER.debug("{} - Member reachable {}", this.localMember.id(), swimMember);
post(new GroupMembershipEvent(GroupMembershipEvent.Type.REACHABILITY_CHANGED, swimMember.copy()));
if (!Objects.equals(member.properties(), swimMember.properties())) {
swimMember.properties().putAll(member.properties());
LOGGER.debug("{} - Member metadata changed {}", this.localMember.id(), swimMember);
post(new GroupMembershipEvent(GroupMembershipEvent.Type.METADATA_CHANGED, swimMember.copy()));
}
}
// If the state has been changed to SUSPECT, update metadata and then trigger a REACHABILITY_CHANGED event.
else if (member.state() == State.SUSPECT && swimMember.getState() != State.SUSPECT) {
if (!Objects.equals(member.properties(), swimMember.properties())) {
swimMember.properties().putAll(member.properties());
LOGGER.debug("{} - Member metadata changed {}", this.localMember.id(), swimMember);
post(new GroupMembershipEvent(GroupMembershipEvent.Type.METADATA_CHANGED, swimMember.copy()));
}
swimMember.setState(State.SUSPECT);
LOGGER.debug("{} - Member unreachable {}", this.localMember.id(), swimMember);
post(new GroupMembershipEvent(GroupMembershipEvent.Type.REACHABILITY_CHANGED, swimMember.copy()));
if (config.isNotifySuspect()) {
gossip(swimMember, Lists.newArrayList(swimMember.copy()));
}
}
// If the state has been changed to DEAD, trigger a REACHABILITY_CHANGED event if necessary and then remove
// the member from the members list and trigger a MEMBER_REMOVED event.
else if (member.state() == State.DEAD && swimMember.getState() != State.DEAD) {
if (swimMember.getState() == State.ALIVE) {
swimMember.setState(State.SUSPECT);
LOGGER.debug("{} - Member unreachable {}", this.localMember.id(), swimMember);
post(new GroupMembershipEvent(GroupMembershipEvent.Type.REACHABILITY_CHANGED, swimMember.copy()));
}
swimMember.setState(State.DEAD);
members.remove(swimMember.id());
randomMembers.remove(swimMember);
Collections.shuffle(randomMembers);
LOGGER.debug("{} - Member removed {}", this.localMember.id(), swimMember);
post(new GroupMembershipEvent(GroupMembershipEvent.Type.MEMBER_REMOVED, swimMember.copy()));
} else if (!Objects.equals(member.properties(), swimMember.properties())) {
swimMember.properties().putAll(member.properties());
LOGGER.debug("{} - Member metadata changed {}", this.localMember.id(), swimMember);
post(new GroupMembershipEvent(GroupMembershipEvent.Type.METADATA_CHANGED, swimMember.copy()));
}
// Always enqueue an update for gossip when the term changes.
recordUpdate(swimMember.copy());
return true;
}
}
// If the term remained the same but the state has progressed, update the state and trigger events.
else if (member.incarnationNumber() == swimMember.getIncarnationNumber() && member.state().ordinal() > swimMember.getState().ordinal()) {
swimMember.setState(member.state());
// If the updated state is SUSPECT, post a REACHABILITY_CHANGED event and record an update.
if (member.state() == State.SUSPECT) {
LOGGER.debug("{} - Member unreachable {}", this.localMember.id(), swimMember);
post(new GroupMembershipEvent(GroupMembershipEvent.Type.REACHABILITY_CHANGED, swimMember.copy()));
if (config.isNotifySuspect()) {
gossip(swimMember, Lists.newArrayList(swimMember.copy()));
}
}
// If the updated state is DEAD, post a REACHABILITY_CHANGED event if necessary, then post a MEMBER_REMOVED
// event and record an update.
else if (member.state() == State.DEAD) {
members.remove(swimMember.id());
randomMembers.remove(swimMember);
Collections.shuffle(randomMembers);
LOGGER.debug("{} - Member removed {}", this.localMember.id(), swimMember);
post(new GroupMembershipEvent(GroupMembershipEvent.Type.MEMBER_REMOVED, swimMember.copy()));
}
recordUpdate(swimMember.copy());
return true;
}
return false;
} }
|
public class class_name {
private boolean updateState(ImmutableMember member) {
// If the member matches the local member, ignore the update.
if (member.id().equals(localMember.id())) {
return false; // depends on control dependency: [if], data = [none]
}
SwimMember swimMember = members.get(member.id());
// If the local member is not present, add the member in the ALIVE state.
if (swimMember == null) {
if (member.state() == State.ALIVE) {
swimMember = new SwimMember(member); // depends on control dependency: [if], data = [none]
members.put(swimMember.id(), swimMember); // depends on control dependency: [if], data = [none]
randomMembers.add(swimMember); // depends on control dependency: [if], data = [none]
Collections.shuffle(randomMembers); // depends on control dependency: [if], data = [none]
LOGGER.debug("{} - Member added {}", this.localMember.id(), swimMember); // depends on control dependency: [if], data = [none]
swimMember.setState(State.ALIVE); // depends on control dependency: [if], data = [State.ALIVE)]
post(new GroupMembershipEvent(GroupMembershipEvent.Type.MEMBER_ADDED, swimMember.copy())); // depends on control dependency: [if], data = [none]
recordUpdate(swimMember.copy()); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false; // depends on control dependency: [if], data = [none]
}
// If the term has been increased, update the member and record a gossip event.
else if (member.incarnationNumber() > swimMember.getIncarnationNumber()) {
// If the member's version has changed, remove the old member and add the new member.
if (!Objects.equals(member.version(), swimMember.version())) {
members.remove(member.id()); // depends on control dependency: [if], data = [none]
randomMembers.remove(swimMember); // depends on control dependency: [if], data = [none]
post(new GroupMembershipEvent(GroupMembershipEvent.Type.MEMBER_REMOVED, swimMember.copy())); // depends on control dependency: [if], data = [none]
swimMember = new SwimMember(member); // depends on control dependency: [if], data = [none]
swimMember.setState(State.ALIVE); // depends on control dependency: [if], data = [none]
members.put(member.id(), swimMember); // depends on control dependency: [if], data = [none]
randomMembers.add(swimMember); // depends on control dependency: [if], data = [none]
Collections.shuffle(randomMembers); // depends on control dependency: [if], data = [none]
LOGGER.debug("{} - Evicted member for new version {}", this.localMember.id(), swimMember); // depends on control dependency: [if], data = [none]
post(new GroupMembershipEvent(GroupMembershipEvent.Type.MEMBER_ADDED, swimMember.copy())); // depends on control dependency: [if], data = [none]
recordUpdate(swimMember.copy()); // depends on control dependency: [if], data = [none]
} else {
// Update the term for the local member.
swimMember.setIncarnationNumber(member.incarnationNumber()); // depends on control dependency: [if], data = [none]
// If the state has been changed to ALIVE, trigger a REACHABILITY_CHANGED event and then update metadata.
if (member.state() == State.ALIVE && swimMember.getState() != State.ALIVE) {
swimMember.setState(State.ALIVE); // depends on control dependency: [if], data = [none]
LOGGER.debug("{} - Member reachable {}", this.localMember.id(), swimMember); // depends on control dependency: [if], data = [none]
post(new GroupMembershipEvent(GroupMembershipEvent.Type.REACHABILITY_CHANGED, swimMember.copy())); // depends on control dependency: [if], data = [none]
if (!Objects.equals(member.properties(), swimMember.properties())) {
swimMember.properties().putAll(member.properties()); // depends on control dependency: [if], data = [none]
LOGGER.debug("{} - Member metadata changed {}", this.localMember.id(), swimMember); // depends on control dependency: [if], data = [none]
post(new GroupMembershipEvent(GroupMembershipEvent.Type.METADATA_CHANGED, swimMember.copy())); // depends on control dependency: [if], data = [none]
}
}
// If the state has been changed to SUSPECT, update metadata and then trigger a REACHABILITY_CHANGED event.
else if (member.state() == State.SUSPECT && swimMember.getState() != State.SUSPECT) {
if (!Objects.equals(member.properties(), swimMember.properties())) {
swimMember.properties().putAll(member.properties()); // depends on control dependency: [if], data = [none]
LOGGER.debug("{} - Member metadata changed {}", this.localMember.id(), swimMember); // depends on control dependency: [if], data = [none]
post(new GroupMembershipEvent(GroupMembershipEvent.Type.METADATA_CHANGED, swimMember.copy())); // depends on control dependency: [if], data = [none]
}
swimMember.setState(State.SUSPECT); // depends on control dependency: [if], data = [none]
LOGGER.debug("{} - Member unreachable {}", this.localMember.id(), swimMember); // depends on control dependency: [if], data = [none]
post(new GroupMembershipEvent(GroupMembershipEvent.Type.REACHABILITY_CHANGED, swimMember.copy())); // depends on control dependency: [if], data = [none]
if (config.isNotifySuspect()) {
gossip(swimMember, Lists.newArrayList(swimMember.copy())); // depends on control dependency: [if], data = [none]
}
}
// If the state has been changed to DEAD, trigger a REACHABILITY_CHANGED event if necessary and then remove
// the member from the members list and trigger a MEMBER_REMOVED event.
else if (member.state() == State.DEAD && swimMember.getState() != State.DEAD) {
if (swimMember.getState() == State.ALIVE) {
swimMember.setState(State.SUSPECT); // depends on control dependency: [if], data = [none]
LOGGER.debug("{} - Member unreachable {}", this.localMember.id(), swimMember); // depends on control dependency: [if], data = [none]
post(new GroupMembershipEvent(GroupMembershipEvent.Type.REACHABILITY_CHANGED, swimMember.copy())); // depends on control dependency: [if], data = [none]
}
swimMember.setState(State.DEAD); // depends on control dependency: [if], data = [none]
members.remove(swimMember.id()); // depends on control dependency: [if], data = [none]
randomMembers.remove(swimMember); // depends on control dependency: [if], data = [none]
Collections.shuffle(randomMembers); // depends on control dependency: [if], data = [none]
LOGGER.debug("{} - Member removed {}", this.localMember.id(), swimMember); // depends on control dependency: [if], data = [none]
post(new GroupMembershipEvent(GroupMembershipEvent.Type.MEMBER_REMOVED, swimMember.copy())); // depends on control dependency: [if], data = [none]
} else if (!Objects.equals(member.properties(), swimMember.properties())) {
swimMember.properties().putAll(member.properties()); // depends on control dependency: [if], data = [none]
LOGGER.debug("{} - Member metadata changed {}", this.localMember.id(), swimMember); // depends on control dependency: [if], data = [none]
post(new GroupMembershipEvent(GroupMembershipEvent.Type.METADATA_CHANGED, swimMember.copy())); // depends on control dependency: [if], data = [none]
}
// Always enqueue an update for gossip when the term changes.
recordUpdate(swimMember.copy()); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
// If the term remained the same but the state has progressed, update the state and trigger events.
else if (member.incarnationNumber() == swimMember.getIncarnationNumber() && member.state().ordinal() > swimMember.getState().ordinal()) {
swimMember.setState(member.state()); // depends on control dependency: [if], data = [none]
// If the updated state is SUSPECT, post a REACHABILITY_CHANGED event and record an update.
if (member.state() == State.SUSPECT) {
LOGGER.debug("{} - Member unreachable {}", this.localMember.id(), swimMember); // depends on control dependency: [if], data = [none]
post(new GroupMembershipEvent(GroupMembershipEvent.Type.REACHABILITY_CHANGED, swimMember.copy())); // depends on control dependency: [if], data = [none]
if (config.isNotifySuspect()) {
gossip(swimMember, Lists.newArrayList(swimMember.copy())); // depends on control dependency: [if], data = [none]
}
}
// If the updated state is DEAD, post a REACHABILITY_CHANGED event if necessary, then post a MEMBER_REMOVED
// event and record an update.
else if (member.state() == State.DEAD) {
members.remove(swimMember.id()); // depends on control dependency: [if], data = [none]
randomMembers.remove(swimMember); // depends on control dependency: [if], data = [none]
Collections.shuffle(randomMembers); // depends on control dependency: [if], data = [none]
LOGGER.debug("{} - Member removed {}", this.localMember.id(), swimMember); // depends on control dependency: [if], data = [none]
post(new GroupMembershipEvent(GroupMembershipEvent.Type.MEMBER_REMOVED, swimMember.copy())); // depends on control dependency: [if], data = [none]
}
recordUpdate(swimMember.copy()); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
private List<ResourceArgument> computeMethodArguments(final ExecutableElement ee) {
final List<ResourceArgument> arguments = Lists.newArrayList();
for (VariableElement ve : ee.getParameters()) {
final PathParam pathAnnotation = ve.getAnnotation(PathParam.class);
final String argName;
if (pathAnnotation != null) {
argName = pathAnnotation.value();
} else {
argName = ve.getSimpleName().toString();
}
arguments.add(new ResourceArgument(argName, makeTypeDescriptor(ve.asType())));
}
return arguments;
} }
|
public class class_name {
private List<ResourceArgument> computeMethodArguments(final ExecutableElement ee) {
final List<ResourceArgument> arguments = Lists.newArrayList();
for (VariableElement ve : ee.getParameters()) {
final PathParam pathAnnotation = ve.getAnnotation(PathParam.class);
final String argName;
if (pathAnnotation != null) {
argName = pathAnnotation.value(); // depends on control dependency: [if], data = [none]
} else {
argName = ve.getSimpleName().toString(); // depends on control dependency: [if], data = [none]
}
arguments.add(new ResourceArgument(argName, makeTypeDescriptor(ve.asType()))); // depends on control dependency: [for], data = [ve]
}
return arguments;
} }
|
public class class_name {
private void setProperties(Dictionary<String, ?> d) {
if (d == null) {
this.properties = null;
return;
}
ConfigurationDictionary newDictionary = new ConfigurationDictionary();
Enumeration<String> keys = d.keys();
while (keys.hasMoreElements()) {
String key = keys.nextElement();
if (newDictionary.get(key) == null) {
Object value = d.get(key);
if (value.getClass().isArray()) {
int arrayLength = Array.getLength(value);
Object copyOfArray = Array.newInstance(value.getClass().getComponentType(), arrayLength);
System.arraycopy(value, 0, copyOfArray, 0, arrayLength);
newDictionary.put(key, copyOfArray);
} else if (value instanceof Collection) {
newDictionary.put(key, new Vector<Object>((Collection<?>) value));
} else {
newDictionary.put(key, value);
}
} else
throw new IllegalArgumentException(key + " is already present or is a case variant."); //$NON-NLS-1$
}
// fill in necessary properties
if (this.factoryPid != null) {
newDictionary.put(ConfigurationAdmin.SERVICE_FACTORYPID, this.factoryPid);
}
newDictionary.put(Constants.SERVICE_PID, this.pid);
if (this.inOverridesFile) {
newDictionary.put("config.overrides", "true");
}
this.properties = newDictionary;
//we got new props so we should redo the mappings in case they changed
addPidMapping();
} }
|
public class class_name {
private void setProperties(Dictionary<String, ?> d) {
if (d == null) {
this.properties = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
ConfigurationDictionary newDictionary = new ConfigurationDictionary();
Enumeration<String> keys = d.keys();
while (keys.hasMoreElements()) {
String key = keys.nextElement();
if (newDictionary.get(key) == null) {
Object value = d.get(key);
if (value.getClass().isArray()) {
int arrayLength = Array.getLength(value);
Object copyOfArray = Array.newInstance(value.getClass().getComponentType(), arrayLength);
System.arraycopy(value, 0, copyOfArray, 0, arrayLength); // depends on control dependency: [if], data = [none]
newDictionary.put(key, copyOfArray); // depends on control dependency: [if], data = [none]
} else if (value instanceof Collection) {
newDictionary.put(key, new Vector<Object>((Collection<?>) value)); // depends on control dependency: [if], data = [none]
} else {
newDictionary.put(key, value); // depends on control dependency: [if], data = [none]
}
} else
throw new IllegalArgumentException(key + " is already present or is a case variant."); //$NON-NLS-1$
}
// fill in necessary properties
if (this.factoryPid != null) {
newDictionary.put(ConfigurationAdmin.SERVICE_FACTORYPID, this.factoryPid); // depends on control dependency: [if], data = [none]
}
newDictionary.put(Constants.SERVICE_PID, this.pid);
if (this.inOverridesFile) {
newDictionary.put("config.overrides", "true"); // depends on control dependency: [if], data = [none]
}
this.properties = newDictionary;
//we got new props so we should redo the mappings in case they changed
addPidMapping();
} }
|
public class class_name {
public void marshall(DescribeFileSystemsRequest describeFileSystemsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeFileSystemsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeFileSystemsRequest.getMaxItems(), MAXITEMS_BINDING);
protocolMarshaller.marshall(describeFileSystemsRequest.getMarker(), MARKER_BINDING);
protocolMarshaller.marshall(describeFileSystemsRequest.getCreationToken(), CREATIONTOKEN_BINDING);
protocolMarshaller.marshall(describeFileSystemsRequest.getFileSystemId(), FILESYSTEMID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeFileSystemsRequest describeFileSystemsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeFileSystemsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeFileSystemsRequest.getMaxItems(), MAXITEMS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeFileSystemsRequest.getMarker(), MARKER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeFileSystemsRequest.getCreationToken(), CREATIONTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeFileSystemsRequest.getFileSystemId(), FILESYSTEMID_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 List<String> getAllXPath(NamespaceContext context, String xml, String xPathExpr) {
List<String> result = null;
NodeList nodes = (NodeList) evaluateXpath(context, xml, xPathExpr, XPathConstants.NODESET);
if (nodes != null) {
result = new ArrayList<String>(nodes.getLength());
for (int i = 0; i < nodes.getLength(); i++) {
result.add(nodes.item(i).getNodeValue());
}
}
return result;
} }
|
public class class_name {
public List<String> getAllXPath(NamespaceContext context, String xml, String xPathExpr) {
List<String> result = null;
NodeList nodes = (NodeList) evaluateXpath(context, xml, xPathExpr, XPathConstants.NODESET);
if (nodes != null) {
result = new ArrayList<String>(nodes.getLength()); // depends on control dependency: [if], data = [(nodes]
for (int i = 0; i < nodes.getLength(); i++) {
result.add(nodes.item(i).getNodeValue()); // depends on control dependency: [for], data = [i]
}
}
return result;
} }
|
public class class_name {
public DescribeConfigurationOptionsResult withOptions(ConfigurationOptionDescription... options) {
if (this.options == null) {
setOptions(new com.amazonaws.internal.SdkInternalList<ConfigurationOptionDescription>(options.length));
}
for (ConfigurationOptionDescription ele : options) {
this.options.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeConfigurationOptionsResult withOptions(ConfigurationOptionDescription... options) {
if (this.options == null) {
setOptions(new com.amazonaws.internal.SdkInternalList<ConfigurationOptionDescription>(options.length)); // depends on control dependency: [if], data = [none]
}
for (ConfigurationOptionDescription ele : options) {
this.options.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void setMaintenanceOperationsInProgress(java.util.Collection<String> maintenanceOperationsInProgress) {
if (maintenanceOperationsInProgress == null) {
this.maintenanceOperationsInProgress = null;
return;
}
this.maintenanceOperationsInProgress = new java.util.ArrayList<String>(maintenanceOperationsInProgress);
} }
|
public class class_name {
public void setMaintenanceOperationsInProgress(java.util.Collection<String> maintenanceOperationsInProgress) {
if (maintenanceOperationsInProgress == null) {
this.maintenanceOperationsInProgress = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.maintenanceOperationsInProgress = new java.util.ArrayList<String>(maintenanceOperationsInProgress);
} }
|
public class class_name {
private void buttonScreenshotMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_buttonScreenshotMouseClicked
BaseFileChooser fileChooser = new BaseFileChooser();
fileChooser.setAcceptAllFileFilterUsed(true);
if(screenshotFilebase!=null)
fileChooser.setSelectedFile(new File(screenshotFilebase));
if (fileChooser.showSaveDialog(this) == BaseFileChooser.APPROVE_OPTION) {
screenshotFilebase = fileChooser.getSelectedFile().getPath();
streamPanel0.screenshot(screenshotFilebase+"_"+label_processed_points_value.getText()+"_0", true, true);
}
} }
|
public class class_name {
private void buttonScreenshotMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_buttonScreenshotMouseClicked
BaseFileChooser fileChooser = new BaseFileChooser();
fileChooser.setAcceptAllFileFilterUsed(true);
if(screenshotFilebase!=null)
fileChooser.setSelectedFile(new File(screenshotFilebase));
if (fileChooser.showSaveDialog(this) == BaseFileChooser.APPROVE_OPTION) {
screenshotFilebase = fileChooser.getSelectedFile().getPath(); // depends on control dependency: [if], data = [none]
streamPanel0.screenshot(screenshotFilebase+"_"+label_processed_points_value.getText()+"_0", true, true); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public final AntlrDatatypeRuleToken ruleQualifiedName() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token kw=null;
AntlrDatatypeRuleToken this_ValidID_0 = null;
AntlrDatatypeRuleToken this_ValidID_2 = null;
enterRule();
try {
// InternalPureXbase.g:5788:2: ( (this_ValidID_0= ruleValidID ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )* ) )
// InternalPureXbase.g:5789:2: (this_ValidID_0= ruleValidID ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )* )
{
// InternalPureXbase.g:5789:2: (this_ValidID_0= ruleValidID ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )* )
// InternalPureXbase.g:5790:3: this_ValidID_0= ruleValidID ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )*
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getQualifiedNameAccess().getValidIDParserRuleCall_0());
}
pushFollow(FOLLOW_68);
this_ValidID_0=ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(this_ValidID_0);
}
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall();
}
// InternalPureXbase.g:5800:3: ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )*
loop100:
do {
int alt100=2;
int LA100_0 = input.LA(1);
if ( (LA100_0==54) ) {
int LA100_2 = input.LA(2);
if ( (LA100_2==RULE_ID) ) {
int LA100_3 = input.LA(3);
if ( (synpred48_InternalPureXbase()) ) {
alt100=1;
}
}
}
switch (alt100) {
case 1 :
// InternalPureXbase.g:5801:4: ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID
{
// InternalPureXbase.g:5801:4: ( ( '.' )=>kw= '.' )
// InternalPureXbase.g:5802:5: ( '.' )=>kw= '.'
{
kw=(Token)match(input,54,FOLLOW_12); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getQualifiedNameAccess().getFullStopKeyword_1_0());
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getQualifiedNameAccess().getValidIDParserRuleCall_1_1());
}
pushFollow(FOLLOW_68);
this_ValidID_2=ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(this_ValidID_2);
}
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall();
}
}
break;
default :
break loop100;
}
} while (true);
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final AntlrDatatypeRuleToken ruleQualifiedName() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token kw=null;
AntlrDatatypeRuleToken this_ValidID_0 = null;
AntlrDatatypeRuleToken this_ValidID_2 = null;
enterRule();
try {
// InternalPureXbase.g:5788:2: ( (this_ValidID_0= ruleValidID ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )* ) )
// InternalPureXbase.g:5789:2: (this_ValidID_0= ruleValidID ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )* )
{
// InternalPureXbase.g:5789:2: (this_ValidID_0= ruleValidID ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )* )
// InternalPureXbase.g:5790:3: this_ValidID_0= ruleValidID ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )*
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getQualifiedNameAccess().getValidIDParserRuleCall_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_68);
this_ValidID_0=ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(this_ValidID_0); // depends on control dependency: [if], data = [none]
}
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:5800:3: ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )*
loop100:
do {
int alt100=2;
int LA100_0 = input.LA(1);
if ( (LA100_0==54) ) {
int LA100_2 = input.LA(2);
if ( (LA100_2==RULE_ID) ) {
int LA100_3 = input.LA(3);
if ( (synpred48_InternalPureXbase()) ) {
alt100=1; // depends on control dependency: [if], data = [none]
}
}
}
switch (alt100) {
case 1 :
// InternalPureXbase.g:5801:4: ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID
{
// InternalPureXbase.g:5801:4: ( ( '.' )=>kw= '.' )
// InternalPureXbase.g:5802:5: ( '.' )=>kw= '.'
{
kw=(Token)match(input,54,FOLLOW_12); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw); // depends on control dependency: [if], data = [none]
newLeafNode(kw, grammarAccess.getQualifiedNameAccess().getFullStopKeyword_1_0()); // depends on control dependency: [if], data = [none]
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getQualifiedNameAccess().getValidIDParserRuleCall_1_1()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_68);
this_ValidID_2=ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(this_ValidID_2); // depends on control dependency: [if], data = [none]
}
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
break;
default :
break loop100;
}
} while (true);
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public void setValidationStatuses(java.util.Collection<ModelPackageStatusItem> validationStatuses) {
if (validationStatuses == null) {
this.validationStatuses = null;
return;
}
this.validationStatuses = new java.util.ArrayList<ModelPackageStatusItem>(validationStatuses);
} }
|
public class class_name {
public void setValidationStatuses(java.util.Collection<ModelPackageStatusItem> validationStatuses) {
if (validationStatuses == null) {
this.validationStatuses = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.validationStatuses = new java.util.ArrayList<ModelPackageStatusItem>(validationStatuses);
} }
|
public class class_name {
private void registerWanPublisherMBeans(WanReplicationService wanReplicationService) {
final Map<String, LocalWanStats> wanStats = wanReplicationService.getStats();
if (wanStats == null) {
return;
}
for (Entry<String, LocalWanStats> replicationStatsEntry : wanStats.entrySet()) {
final String wanReplicationName = replicationStatsEntry.getKey();
final LocalWanStats localWanStats = replicationStatsEntry.getValue();
final Map<String, LocalWanPublisherStats> publisherStats = localWanStats.getLocalWanPublisherStats();
for (String targetGroupName : publisherStats.keySet()) {
register(new WanPublisherMBean(wanReplicationService, wanReplicationName, targetGroupName, service));
}
}
} }
|
public class class_name {
private void registerWanPublisherMBeans(WanReplicationService wanReplicationService) {
final Map<String, LocalWanStats> wanStats = wanReplicationService.getStats();
if (wanStats == null) {
return; // depends on control dependency: [if], data = [none]
}
for (Entry<String, LocalWanStats> replicationStatsEntry : wanStats.entrySet()) {
final String wanReplicationName = replicationStatsEntry.getKey();
final LocalWanStats localWanStats = replicationStatsEntry.getValue();
final Map<String, LocalWanPublisherStats> publisherStats = localWanStats.getLocalWanPublisherStats();
for (String targetGroupName : publisherStats.keySet()) {
register(new WanPublisherMBean(wanReplicationService, wanReplicationName, targetGroupName, service)); // depends on control dependency: [for], data = [targetGroupName]
}
}
} }
|
public class class_name {
public PoolRemoveNodesOptions withIfModifiedSince(DateTime ifModifiedSince) {
if (ifModifiedSince == null) {
this.ifModifiedSince = null;
} else {
this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince);
}
return this;
} }
|
public class class_name {
public PoolRemoveNodesOptions withIfModifiedSince(DateTime ifModifiedSince) {
if (ifModifiedSince == null) {
this.ifModifiedSince = null; // depends on control dependency: [if], data = [none]
} else {
this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); // depends on control dependency: [if], data = [(ifModifiedSince]
}
return this;
} }
|
public class class_name {
void submit() {
List<String> siteRootsToDelete = new ArrayList<String>();
for (CmsSite site : m_sitesToDelete) {
String currentSite = A_CmsUI.getCmsObject().getRequestContext().getSiteRoot();
if (currentSite.equals(site.getSiteRoot())) {
A_CmsUI.getCmsObject().getRequestContext().setSiteRoot("");
}
siteRootsToDelete.add(site.getSiteRoot());
}
m_manager.deleteElements(siteRootsToDelete);
if (m_deleteResources.getValue().booleanValue()) {
for (CmsSite site : m_sitesToDelete) {
try {
m_manager.getRootCmsObject().lockResource(site.getSiteRoot());
} catch (CmsException e) {
LOG.error("unable to lock resource");
}
try {
m_manager.getRootCmsObject().deleteResource(
site.getSiteRoot(),
CmsResource.DELETE_PRESERVE_SIBLINGS);
try {
m_manager.getRootCmsObject().unlockResource(site.getSiteRoot());
} catch (CmsLockException e) {
LOG.info("Unlock failed.", e);
}
} catch (CmsException e) {
//ok, resource was not published and can not be unlocked anymore..
}
}
}
} }
|
public class class_name {
void submit() {
List<String> siteRootsToDelete = new ArrayList<String>();
for (CmsSite site : m_sitesToDelete) {
String currentSite = A_CmsUI.getCmsObject().getRequestContext().getSiteRoot();
if (currentSite.equals(site.getSiteRoot())) {
A_CmsUI.getCmsObject().getRequestContext().setSiteRoot(""); // depends on control dependency: [if], data = [none]
}
siteRootsToDelete.add(site.getSiteRoot()); // depends on control dependency: [for], data = [site]
}
m_manager.deleteElements(siteRootsToDelete);
if (m_deleteResources.getValue().booleanValue()) {
for (CmsSite site : m_sitesToDelete) {
try {
m_manager.getRootCmsObject().lockResource(site.getSiteRoot()); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.error("unable to lock resource");
} // depends on control dependency: [catch], data = [none]
try {
m_manager.getRootCmsObject().deleteResource(
site.getSiteRoot(),
CmsResource.DELETE_PRESERVE_SIBLINGS); // depends on control dependency: [try], data = [none]
try {
m_manager.getRootCmsObject().unlockResource(site.getSiteRoot()); // depends on control dependency: [try], data = [none]
} catch (CmsLockException e) {
LOG.info("Unlock failed.", e);
} // depends on control dependency: [catch], data = [none]
} catch (CmsException e) {
//ok, resource was not published and can not be unlocked anymore..
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
public static int binarySearch(byte[] a, int key) {
int low = 0;
int high = a.length;
while (low < high) {
int mid = (low + high) >>> 1;
if (mid % 4 != 0) {
if (high == a.length) {
mid = low;
} else {
mid = high;
}
}
int midVal = getInt(a, mid);
if (midVal < key)
low = mid + 4;
else if (midVal > key)
high = mid - 4;
else
return mid; // key found
}
if (low == a.length) {
return low;
}
return key > getInt(a, low) ? low + 4 : low;
} }
|
public class class_name {
public static int binarySearch(byte[] a, int key) {
int low = 0;
int high = a.length;
while (low < high) {
int mid = (low + high) >>> 1;
if (mid % 4 != 0) {
if (high == a.length) {
mid = low; // depends on control dependency: [if], data = [none]
} else {
mid = high; // depends on control dependency: [if], data = [none]
}
}
int midVal = getInt(a, mid);
if (midVal < key)
low = mid + 4;
else if (midVal > key)
high = mid - 4;
else
return mid; // key found
}
if (low == a.length) {
return low; // depends on control dependency: [if], data = [none]
}
return key > getInt(a, low) ? low + 4 : low;
} }
|
public class class_name {
public void addDefaultTimestampMode(String timestampMode) {
if (null != timestampMode) {
try {
TimestampMode mode = TimestampMode.valueOf(timestampMode.toUpperCase());
for (String resourcetype : m_resourcetypes) {
m_defaultTimestampModes.put(resourcetype, mode);
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_IMPORTEXPORT_EXPORT_SETTIMESTAMPMODE_2,
timestampMode,
resourcetype));
}
}
} catch (IllegalArgumentException e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_IMPORTEXPORT_EXPORT_INVALID_TIMESTAMPMODE_2,
timestampMode,
m_resourcetypes.toString()),
e);
}
} else {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_IMPORTEXPORT_EXPORT_MISSING_TIMESTAMPMODE_1,
m_resourcetypes.toString()));
}
m_resourcetypes.clear();
} }
|
public class class_name {
public void addDefaultTimestampMode(String timestampMode) {
if (null != timestampMode) {
try {
TimestampMode mode = TimestampMode.valueOf(timestampMode.toUpperCase());
for (String resourcetype : m_resourcetypes) {
m_defaultTimestampModes.put(resourcetype, mode); // depends on control dependency: [for], data = [resourcetype]
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_IMPORTEXPORT_EXPORT_SETTIMESTAMPMODE_2,
timestampMode,
resourcetype)); // depends on control dependency: [if], data = [none]
}
}
} catch (IllegalArgumentException e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_IMPORTEXPORT_EXPORT_INVALID_TIMESTAMPMODE_2,
timestampMode,
m_resourcetypes.toString()),
e);
} // depends on control dependency: [catch], data = [none]
} else {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_IMPORTEXPORT_EXPORT_MISSING_TIMESTAMPMODE_1,
m_resourcetypes.toString())); // depends on control dependency: [if], data = [none]
}
m_resourcetypes.clear();
} }
|
public class class_name {
public void triggerPolling(final String objectName) throws DevFailed {
boolean isACommand = false;
CommandImpl cmd = null;
try {
cmd = CommandGetter.getCommand(objectName, commandList);
isACommand = true;
} catch (final DevFailed e) {
}
if (!isACommand) {
// polled object is not a command. May be an attribute
AttributeImpl att = null;
try {
att = AttributeGetterSetter.getAttribute(objectName, attributeList);
} catch (final DevFailed e) {
logger.error(Constants.POLLED_OBJECT + objectName + " not found");
throw DevFailedUtils.newDevFailed(ExceptionMessages.POLL_OBJ_NOT_FOUND, Constants.POLLED_OBJECT
+ objectName + " not found");
}
checkPolling(objectName, att);
try {
cacheManager.getAttributeCache(att).refresh(att.getName());
} catch (final CacheException e) {
if (e.getCause() instanceof DevFailed) {
throw (DevFailed) e.getCause();
} else {
throw DevFailedUtils.newDevFailed(e.getCause());
}
} catch (final NoCacheFoundException e) {
throw DevFailedUtils.newDevFailed(e);
}
} else {
checkPolling(objectName, cmd);
try {
cacheManager.getCommandCache(cmd).refresh(cmd.getName());
} catch (final CacheException e) {
if (e.getCause() instanceof DevFailed) {
throw (DevFailed) e.getCause();
} else {
throw DevFailedUtils.newDevFailed(e.getCause());
}
}
}
} }
|
public class class_name {
public void triggerPolling(final String objectName) throws DevFailed {
boolean isACommand = false;
CommandImpl cmd = null;
try {
cmd = CommandGetter.getCommand(objectName, commandList);
isACommand = true;
} catch (final DevFailed e) {
}
if (!isACommand) {
// polled object is not a command. May be an attribute
AttributeImpl att = null;
try {
att = AttributeGetterSetter.getAttribute(objectName, attributeList);
// depends on control dependency: [try], data = [none]
} catch (final DevFailed e) {
logger.error(Constants.POLLED_OBJECT + objectName + " not found");
throw DevFailedUtils.newDevFailed(ExceptionMessages.POLL_OBJ_NOT_FOUND, Constants.POLLED_OBJECT
+ objectName + " not found");
}
// depends on control dependency: [catch], data = [none]
checkPolling(objectName, att);
try {
cacheManager.getAttributeCache(att).refresh(att.getName());
// depends on control dependency: [try], data = [none]
} catch (final CacheException e) {
if (e.getCause() instanceof DevFailed) {
throw (DevFailed) e.getCause();
} else {
throw DevFailedUtils.newDevFailed(e.getCause());
}
} catch (final NoCacheFoundException e) {
// depends on control dependency: [catch], data = [none]
throw DevFailedUtils.newDevFailed(e);
}
// depends on control dependency: [catch], data = [none]
} else {
checkPolling(objectName, cmd);
try {
cacheManager.getCommandCache(cmd).refresh(cmd.getName());
// depends on control dependency: [try], data = [none]
} catch (final CacheException e) {
if (e.getCause() instanceof DevFailed) {
throw (DevFailed) e.getCause();
} else {
throw DevFailedUtils.newDevFailed(e.getCause());
}
}
// depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public final void warn(Object message) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_WARN)) {
log(SimpleLog.LOG_LEVEL_WARN, message, null);
}
} }
|
public class class_name {
public final void warn(Object message) {
if (isLevelEnabled(SimpleLog.LOG_LEVEL_WARN)) {
log(SimpleLog.LOG_LEVEL_WARN, message, null); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String resolveJsonName(final String realName) {
if (realNames == null) {
return realName;
}
int realIndex = ArraysUtil.indexOf(realNames, realName);
if (realIndex == -1) {
return realName;
}
return jsonNames[realIndex];
} }
|
public class class_name {
public String resolveJsonName(final String realName) {
if (realNames == null) {
return realName; // depends on control dependency: [if], data = [none]
}
int realIndex = ArraysUtil.indexOf(realNames, realName);
if (realIndex == -1) {
return realName; // depends on control dependency: [if], data = [none]
}
return jsonNames[realIndex];
} }
|
public class class_name {
@Override
public @Nonnull ApplicationContextBuilder include(@Nullable String... configurations) {
if (configurations != null) {
this.configurationIncludes.addAll(Arrays.asList(configurations));
}
return this;
} }
|
public class class_name {
@Override
public @Nonnull ApplicationContextBuilder include(@Nullable String... configurations) {
if (configurations != null) {
this.configurationIncludes.addAll(Arrays.asList(configurations)); // depends on control dependency: [if], data = [(configurations]
}
return this;
} }
|
public class class_name {
private boolean isSplit(ProjectCalendar calendar, List<TimephasedWork> list)
{
boolean result = false;
for (TimephasedWork assignment : list)
{
if (calendar != null && assignment.getTotalAmount().getDuration() == 0)
{
Duration calendarWork = calendar.getWork(assignment.getStart(), assignment.getFinish(), TimeUnit.MINUTES);
if (calendarWork.getDuration() != 0)
{
result = true;
break;
}
}
}
return result;
} }
|
public class class_name {
private boolean isSplit(ProjectCalendar calendar, List<TimephasedWork> list)
{
boolean result = false;
for (TimephasedWork assignment : list)
{
if (calendar != null && assignment.getTotalAmount().getDuration() == 0)
{
Duration calendarWork = calendar.getWork(assignment.getStart(), assignment.getFinish(), TimeUnit.MINUTES);
if (calendarWork.getDuration() != 0)
{
result = true; // depends on control dependency: [if], data = [none]
break;
}
}
}
return result;
} }
|
public class class_name {
public void setBrokerEngineTypes(java.util.Collection<BrokerEngineType> brokerEngineTypes) {
if (brokerEngineTypes == null) {
this.brokerEngineTypes = null;
return;
}
this.brokerEngineTypes = new java.util.ArrayList<BrokerEngineType>(brokerEngineTypes);
} }
|
public class class_name {
public void setBrokerEngineTypes(java.util.Collection<BrokerEngineType> brokerEngineTypes) {
if (brokerEngineTypes == null) {
this.brokerEngineTypes = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.brokerEngineTypes = new java.util.ArrayList<BrokerEngineType>(brokerEngineTypes);
} }
|
public class class_name {
protected Sid createSid(boolean isPrincipal, String sid) {
if (isPrincipal) {
return new PrincipalSid(sid);
}
else {
return new GrantedAuthoritySid(sid);
}
} }
|
public class class_name {
protected Sid createSid(boolean isPrincipal, String sid) {
if (isPrincipal) {
return new PrincipalSid(sid); // depends on control dependency: [if], data = [none]
}
else {
return new GrantedAuthoritySid(sid); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private boolean datastreamExists(FedoraClient fedora, String vitalPid,
String dsPid) {
try {
// Some options:
// * getAPIA().listDatastreams... seems best
// * getAPIM().getDatastream... causes Exceptions against new IDs
// * getAPIM().getDatastreams... is limited to a single state
DatastreamDef[] streams = fedora.getAPIA().listDatastreams(
vitalPid, null);
for (DatastreamDef stream : streams) {
if (stream.getID().equals(dsPid)) {
return true;
}
}
} catch (Exception ex) {
log.error("API Query error: ", ex);
}
return false;
} }
|
public class class_name {
private boolean datastreamExists(FedoraClient fedora, String vitalPid,
String dsPid) {
try {
// Some options:
// * getAPIA().listDatastreams... seems best
// * getAPIM().getDatastream... causes Exceptions against new IDs
// * getAPIM().getDatastreams... is limited to a single state
DatastreamDef[] streams = fedora.getAPIA().listDatastreams(
vitalPid, null);
for (DatastreamDef stream : streams) {
if (stream.getID().equals(dsPid)) {
return true; // depends on control dependency: [if], data = [none]
}
}
} catch (Exception ex) {
log.error("API Query error: ", ex);
} // depends on control dependency: [catch], data = [none]
return false;
} }
|
public class class_name {
public boolean checkMinDistIsZero(char[] a, char[] b) {
for (int i = 0; i < a.length; i++) {
if (charDistance(a[i], b[i]) > 1) {
return false;
}
}
return true;
} }
|
public class class_name {
public boolean checkMinDistIsZero(char[] a, char[] b) {
for (int i = 0; i < a.length; i++) {
if (charDistance(a[i], b[i]) > 1) {
return false;
// depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
@Beta
public static String checkHostname(String hostname,
@Nullable String errorMessageTemplate,
@Nullable Object... errorMessageArgs) {
String message = messageFromNullable(errorMessageTemplate, errorMessageArgs, "; ");
checkArgument(hostname != null, "%sExpected non-null hostname", message);
checkArgument(hostname.length() > 0 && hostname.length() < 256,
"%sExpected a hostname in range 1 to 255 characters, got %s", message, hostname.length());
Iterable<String> labels = on('.').split(hostname);
for (String label : labels) {
checkArgument(label.length() > 0 && label.length() < 64,
"%sExpected a hostname label in range 1 to 63 characters, got %s", message, label.length());
}
checkMatches(hostname, compile(REGEXP_HOSTNAME),
"%sExpected a hostname to match expression %s, got: %s", message, REGEXP_HOSTNAME, hostname);
return hostname;
} }
|
public class class_name {
@Beta
public static String checkHostname(String hostname,
@Nullable String errorMessageTemplate,
@Nullable Object... errorMessageArgs) {
String message = messageFromNullable(errorMessageTemplate, errorMessageArgs, "; ");
checkArgument(hostname != null, "%sExpected non-null hostname", message);
checkArgument(hostname.length() > 0 && hostname.length() < 256,
"%sExpected a hostname in range 1 to 255 characters, got %s", message, hostname.length());
Iterable<String> labels = on('.').split(hostname);
for (String label : labels) {
checkArgument(label.length() > 0 && label.length() < 64,
"%sExpected a hostname label in range 1 to 63 characters, got %s", message, label.length()); // depends on control dependency: [for], data = [label]
}
checkMatches(hostname, compile(REGEXP_HOSTNAME),
"%sExpected a hostname to match expression %s, got: %s", message, REGEXP_HOSTNAME, hostname);
return hostname;
} }
|
public class class_name {
public boolean isJavaExtension(String s) {
for (IJavaExtension ext : _extensions) {
if (S.isEqual(s, ext.methodName())) {
return true;
}
}
return false;
} }
|
public class class_name {
public boolean isJavaExtension(String s) {
for (IJavaExtension ext : _extensions) {
if (S.isEqual(s, ext.methodName())) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
private void _createEagerBeans(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(externalContext);
List<ManagedBean> eagerBeans = new ArrayList<ManagedBean>();
// check all registered managed-beans
for (ManagedBean bean : runtimeConfig.getManagedBeans().values())
{
String eager = bean.getEager();
if (eager != null && "true".equals(eager))
{
// eager beans are only allowed for application scope
if (ManagedBeanBuilder.APPLICATION.equals(bean.getManagedBeanScope()))
{
// add to eager beans
eagerBeans.add(bean);
}
else
{
// log warning and continue (the bean will be lazy loaded)
log.log(Level.WARNING, "The managed-bean with name "
+ bean.getManagedBeanName()
+ " must be application scoped to support eager=true.");
}
}
}
// check if there are any eager beans
if (!eagerBeans.isEmpty())
{
ManagedBeanBuilder managedBeanBuilder = new ManagedBeanBuilder();
Map<String, Object> applicationMap = externalContext.getApplicationMap();
for (ManagedBean bean : eagerBeans)
{
// check application scope for bean instance
if (applicationMap.containsKey(bean.getManagedBeanName()))
{
// do not build bean, because it already exists
// (e.g. @ManagedProperty from previous managed bean already created it)
continue;
}
// create instance
Object beanInstance = managedBeanBuilder.buildManagedBean(facesContext, bean);
// put in application scope
applicationMap.put(bean.getManagedBeanName(), beanInstance);
}
}
} }
|
public class class_name {
private void _createEagerBeans(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(externalContext);
List<ManagedBean> eagerBeans = new ArrayList<ManagedBean>();
// check all registered managed-beans
for (ManagedBean bean : runtimeConfig.getManagedBeans().values())
{
String eager = bean.getEager();
if (eager != null && "true".equals(eager))
{
// eager beans are only allowed for application scope
if (ManagedBeanBuilder.APPLICATION.equals(bean.getManagedBeanScope()))
{
// add to eager beans
eagerBeans.add(bean); // depends on control dependency: [if], data = [none]
}
else
{
// log warning and continue (the bean will be lazy loaded)
log.log(Level.WARNING, "The managed-bean with name "
+ bean.getManagedBeanName()
+ " must be application scoped to support eager=true."); // depends on control dependency: [if], data = [none]
}
}
}
// check if there are any eager beans
if (!eagerBeans.isEmpty())
{
ManagedBeanBuilder managedBeanBuilder = new ManagedBeanBuilder();
Map<String, Object> applicationMap = externalContext.getApplicationMap();
for (ManagedBean bean : eagerBeans)
{
// check application scope for bean instance
if (applicationMap.containsKey(bean.getManagedBeanName()))
{
// do not build bean, because it already exists
// (e.g. @ManagedProperty from previous managed bean already created it)
continue;
}
// create instance
Object beanInstance = managedBeanBuilder.buildManagedBean(facesContext, bean);
// put in application scope
applicationMap.put(bean.getManagedBeanName(), beanInstance); // depends on control dependency: [for], data = [bean]
}
}
} }
|
public class class_name {
protected boolean unifyVar(Variable leftVar, Term rightTerm, List<Variable> leftTrail, List<Variable> rightTrail)
{
/*log.fine("protected boolean unifyVar(Variable var = " + leftVar + ", Term term = " + rightTerm +
", List<Variable> trail = " + leftTrail + "): called");*/
// Check if the variable is bound (in the trail, but no need to explicitly check the trail as the binding is
// already held against the variable).
if (leftVar.isBound())
{
/*log.fine("Variable is bound.");*/
return unifyInternal(leftVar.getValue(), rightTerm, leftTrail, rightTrail);
}
else if (rightTerm.isVar() && ((Variable) rightTerm).isBound())
{
// The variable is free, but the term itself is a bound variable, in which case unify againt the value
// of the term.
/*log.fine("Term is a bound variable.");*/
return unifyInternal(leftVar, rightTerm.getValue(), leftTrail, rightTrail);
}
else
{
// Otherwise, unify by binding the variable to the value of the term.
/*log.fine("Variable is free, substituting in the term for it.");*/
leftVar.setSubstitution(rightTerm);
leftTrail.add(leftVar.getStorageCell(leftVar));
//leftTrail.add(leftVar);
return true;
}
// Occurs can go above if desired.
/*else if (var occurs anywhere in x)
{
return false;
}*/
} }
|
public class class_name {
protected boolean unifyVar(Variable leftVar, Term rightTerm, List<Variable> leftTrail, List<Variable> rightTrail)
{
/*log.fine("protected boolean unifyVar(Variable var = " + leftVar + ", Term term = " + rightTerm +
", List<Variable> trail = " + leftTrail + "): called");*/
// Check if the variable is bound (in the trail, but no need to explicitly check the trail as the binding is
// already held against the variable).
if (leftVar.isBound())
{
/*log.fine("Variable is bound.");*/
return unifyInternal(leftVar.getValue(), rightTerm, leftTrail, rightTrail); // depends on control dependency: [if], data = [none]
}
else if (rightTerm.isVar() && ((Variable) rightTerm).isBound())
{
// The variable is free, but the term itself is a bound variable, in which case unify againt the value
// of the term.
/*log.fine("Term is a bound variable.");*/
return unifyInternal(leftVar, rightTerm.getValue(), leftTrail, rightTrail); // depends on control dependency: [if], data = [none]
}
else
{
// Otherwise, unify by binding the variable to the value of the term.
/*log.fine("Variable is free, substituting in the term for it.");*/
leftVar.setSubstitution(rightTerm); // depends on control dependency: [if], data = [none]
leftTrail.add(leftVar.getStorageCell(leftVar)); // depends on control dependency: [if], data = [none]
//leftTrail.add(leftVar);
return true; // depends on control dependency: [if], data = [none]
}
// Occurs can go above if desired.
/*else if (var occurs anywhere in x)
{
return false;
}*/
} }
|
public class class_name {
protected static <A> double[] computeDistances(NumberArrayAdapter<?, A> adapter, A data) {
final int size = adapter.size(data);
double[] dMatrix = new double[(size * (size + 1)) >> 1];
for(int i = 0, c = 0; i < size; i++) {
for(int j = 0; j < i; j++) {
double dx = adapter.getDouble(data, i) - adapter.getDouble(data, j);
dMatrix[c++] = (dx < 0) ? -dx : dx; // Absolute difference.
}
c++; // Diagonal entry: zero
}
doubleCenterMatrix(dMatrix, size);
return dMatrix;
} }
|
public class class_name {
protected static <A> double[] computeDistances(NumberArrayAdapter<?, A> adapter, A data) {
final int size = adapter.size(data);
double[] dMatrix = new double[(size * (size + 1)) >> 1];
for(int i = 0, c = 0; i < size; i++) {
for(int j = 0; j < i; j++) {
double dx = adapter.getDouble(data, i) - adapter.getDouble(data, j);
dMatrix[c++] = (dx < 0) ? -dx : dx; // Absolute difference. // depends on control dependency: [for], data = [none]
}
c++; // Diagonal entry: zero // depends on control dependency: [for], data = [none]
}
doubleCenterMatrix(dMatrix, size);
return dMatrix;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public T overlap(final T otherInterval) {
if (otherInterval == null) {
return null;
}
if (otherInterval.isInfinite()) {
return (T)this;
}
if (this.isInfinite()) {
return otherInterval;
}
final Interval thisAsInterval = asInterval();
final Interval otherAsInterval = otherInterval.asInterval();
Interval overlap = thisAsInterval.overlap(otherAsInterval);
if (overlap == null) {
return null;
}
return newInterval(overlap);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public T overlap(final T otherInterval) {
if (otherInterval == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (otherInterval.isInfinite()) {
return (T)this; // depends on control dependency: [if], data = [none]
}
if (this.isInfinite()) {
return otherInterval; // depends on control dependency: [if], data = [none]
}
final Interval thisAsInterval = asInterval();
final Interval otherAsInterval = otherInterval.asInterval();
Interval overlap = thisAsInterval.overlap(otherAsInterval);
if (overlap == null) {
return null; // depends on control dependency: [if], data = [none]
}
return newInterval(overlap);
} }
|
public class class_name {
private void commitAddActiveMessage()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "commitAddActiveMessage");
// If this consumer is in a set then commit the add to the set
_consumerKey.commitAddActiveMessage();
// Check the _maxActiveMessage counter for this specific consumer.
// We're only interested if we're counting messages and we can only do that if
// we're bifurcatable
if (_bifurcatable && (_maxActiveMessages != 0))
{
// Lock down the active message counter (removing an active message will
// only hold this lock, not the 'this' lock)
synchronized (_maxActiveMessageLock)
{
// Add the message to the local consumer count
_currentActiveMessages++;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "_currentActiveMessages: " + _currentActiveMessages);
// If we've reached the maximum, suspend the consumer
if (_currentActiveMessages == _maxActiveMessages)
{
// Suspend the consumer for the next time round
suspendConsumer(DispatchableConsumerPoint.SUSPEND_FLAG_ACTIVE_MSGS);
// (F001731)
// If we're monitoring the maxActiveMessage limit then start an alarm that
// will ping when the allowable suspended time passes
if (_activeMsgBlockInterval > -1)
{
if (_activeMsgBlockAlarm == null)
_activeMsgBlockAlarm = new ActiveMsgBlockAlarm();
_activeMsgBlockAlarm.startAlarm();
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "commitAddActiveMessage");
} }
|
public class class_name {
private void commitAddActiveMessage()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "commitAddActiveMessage");
// If this consumer is in a set then commit the add to the set
_consumerKey.commitAddActiveMessage();
// Check the _maxActiveMessage counter for this specific consumer.
// We're only interested if we're counting messages and we can only do that if
// we're bifurcatable
if (_bifurcatable && (_maxActiveMessages != 0))
{
// Lock down the active message counter (removing an active message will
// only hold this lock, not the 'this' lock)
synchronized (_maxActiveMessageLock) // depends on control dependency: [if], data = [none]
{
// Add the message to the local consumer count
_currentActiveMessages++;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "_currentActiveMessages: " + _currentActiveMessages);
// If we've reached the maximum, suspend the consumer
if (_currentActiveMessages == _maxActiveMessages)
{
// Suspend the consumer for the next time round
suspendConsumer(DispatchableConsumerPoint.SUSPEND_FLAG_ACTIVE_MSGS); // depends on control dependency: [if], data = [none]
// (F001731)
// If we're monitoring the maxActiveMessage limit then start an alarm that
// will ping when the allowable suspended time passes
if (_activeMsgBlockInterval > -1)
{
if (_activeMsgBlockAlarm == null)
_activeMsgBlockAlarm = new ActiveMsgBlockAlarm();
_activeMsgBlockAlarm.startAlarm(); // depends on control dependency: [if], data = [none]
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "commitAddActiveMessage");
} }
|
public class class_name {
public CollisionResult computeCollision(Transformable transformable, CollisionCategory category)
{
// Distance calculation
final double sh = transformable.getOldX() + category.getOffsetX();
final double sv = transformable.getOldY() + category.getOffsetY();
final double dh = transformable.getX() + category.getOffsetX() - sh;
final double dv = transformable.getY() + category.getOffsetY() - sv;
final double nh = Math.abs(dh);
final double nv = Math.abs(dv);
final int max = (int) Math.ceil(Math.max(nh, nv));
final double sx;
final double sy;
if (Double.compare(nh, 1.0) >= 0 || Double.compare(nv, 1.0) >= 0)
{
sx = dh / max;
sy = dv / max;
}
else
{
sx = dh;
sy = dv;
}
return computeCollision(category, sh, sv, sx, sy, max);
} }
|
public class class_name {
public CollisionResult computeCollision(Transformable transformable, CollisionCategory category)
{
// Distance calculation
final double sh = transformable.getOldX() + category.getOffsetX();
final double sv = transformable.getOldY() + category.getOffsetY();
final double dh = transformable.getX() + category.getOffsetX() - sh;
final double dv = transformable.getY() + category.getOffsetY() - sv;
final double nh = Math.abs(dh);
final double nv = Math.abs(dv);
final int max = (int) Math.ceil(Math.max(nh, nv));
final double sx;
final double sy;
if (Double.compare(nh, 1.0) >= 0 || Double.compare(nv, 1.0) >= 0)
{
sx = dh / max;
// depends on control dependency: [if], data = [none]
sy = dv / max;
// depends on control dependency: [if], data = [none]
}
else
{
sx = dh;
// depends on control dependency: [if], data = [none]
sy = dv;
// depends on control dependency: [if], data = [none]
}
return computeCollision(category, sh, sv, sx, sy, max);
} }
|
public class class_name {
protected SuballocatedIntVector findNamespaceContext(int elementNodeIndex)
{
if (null!=m_namespaceDeclSetElements)
{
// %OPT% Is binary-search really saving us a lot versus linear?
// (... It may be, in large docs with many NS decls.)
int wouldBeAt=findInSortedSuballocatedIntVector(m_namespaceDeclSetElements,
elementNodeIndex);
if(wouldBeAt>=0) // Found it
return (SuballocatedIntVector) m_namespaceDeclSets.elementAt(wouldBeAt);
if(wouldBeAt == -1) // -1-wouldbeat == 0
return null; // Not after anything; definitely not found
// Not found, but we know where it should have been.
// Search back until we find an ancestor or run out.
wouldBeAt=-1-wouldBeAt;
// Decrement wouldBeAt to find last possible ancestor
int candidate=m_namespaceDeclSetElements.elementAt(-- wouldBeAt);
int ancestor=_parent(elementNodeIndex);
// Special case: if the candidate is before the given node, and
// is in the earliest possible position in the document, it
// must have the namespace declarations we're interested in.
if (wouldBeAt == 0 && candidate < ancestor) {
int rootHandle = getDocumentRoot(makeNodeHandle(elementNodeIndex));
int rootID = makeNodeIdentity(rootHandle);
int uppermostNSCandidateID;
if (getNodeType(rootHandle) == DTM.DOCUMENT_NODE) {
int ch = _firstch(rootID);
uppermostNSCandidateID = (ch != DTM.NULL) ? ch : rootID;
} else {
uppermostNSCandidateID = rootID;
}
if (candidate == uppermostNSCandidateID) {
return (SuballocatedIntVector)m_namespaceDeclSets.elementAt(wouldBeAt);
}
}
while(wouldBeAt>=0 && ancestor>0)
{
if (candidate==ancestor) {
// Found ancestor in list
return (SuballocatedIntVector)m_namespaceDeclSets.elementAt(wouldBeAt);
} else if (candidate<ancestor) {
// Too deep in tree
do {
ancestor=_parent(ancestor);
} while (candidate < ancestor);
} else if(wouldBeAt > 0){
// Too late in list
candidate=m_namespaceDeclSetElements.elementAt(--wouldBeAt);
}
else
break;
}
}
return null; // No namespaces known at this node
} }
|
public class class_name {
protected SuballocatedIntVector findNamespaceContext(int elementNodeIndex)
{
if (null!=m_namespaceDeclSetElements)
{
// %OPT% Is binary-search really saving us a lot versus linear?
// (... It may be, in large docs with many NS decls.)
int wouldBeAt=findInSortedSuballocatedIntVector(m_namespaceDeclSetElements,
elementNodeIndex);
if(wouldBeAt>=0) // Found it
return (SuballocatedIntVector) m_namespaceDeclSets.elementAt(wouldBeAt);
if(wouldBeAt == -1) // -1-wouldbeat == 0
return null; // Not after anything; definitely not found
// Not found, but we know where it should have been.
// Search back until we find an ancestor or run out.
wouldBeAt=-1-wouldBeAt; // depends on control dependency: [if], data = [none]
// Decrement wouldBeAt to find last possible ancestor
int candidate=m_namespaceDeclSetElements.elementAt(-- wouldBeAt);
int ancestor=_parent(elementNodeIndex);
// Special case: if the candidate is before the given node, and
// is in the earliest possible position in the document, it
// must have the namespace declarations we're interested in.
if (wouldBeAt == 0 && candidate < ancestor) {
int rootHandle = getDocumentRoot(makeNodeHandle(elementNodeIndex));
int rootID = makeNodeIdentity(rootHandle);
int uppermostNSCandidateID;
if (getNodeType(rootHandle) == DTM.DOCUMENT_NODE) {
int ch = _firstch(rootID);
uppermostNSCandidateID = (ch != DTM.NULL) ? ch : rootID; // depends on control dependency: [if], data = [none]
} else {
uppermostNSCandidateID = rootID; // depends on control dependency: [if], data = [none]
}
if (candidate == uppermostNSCandidateID) {
return (SuballocatedIntVector)m_namespaceDeclSets.elementAt(wouldBeAt); // depends on control dependency: [if], data = [none]
}
}
while(wouldBeAt>=0 && ancestor>0)
{
if (candidate==ancestor) {
// Found ancestor in list
return (SuballocatedIntVector)m_namespaceDeclSets.elementAt(wouldBeAt); // depends on control dependency: [if], data = [none]
} else if (candidate<ancestor) {
// Too deep in tree
do {
ancestor=_parent(ancestor);
} while (candidate < ancestor);
} else if(wouldBeAt > 0){
// Too late in list
candidate=m_namespaceDeclSetElements.elementAt(--wouldBeAt); // depends on control dependency: [if], data = [none]
}
else
break;
}
}
return null; // No namespaces known at this node
} }
|
public class class_name {
public GetTransitGatewayRouteTablePropagationsResult withTransitGatewayRouteTablePropagations(
TransitGatewayRouteTablePropagation... transitGatewayRouteTablePropagations) {
if (this.transitGatewayRouteTablePropagations == null) {
setTransitGatewayRouteTablePropagations(new com.amazonaws.internal.SdkInternalList<TransitGatewayRouteTablePropagation>(
transitGatewayRouteTablePropagations.length));
}
for (TransitGatewayRouteTablePropagation ele : transitGatewayRouteTablePropagations) {
this.transitGatewayRouteTablePropagations.add(ele);
}
return this;
} }
|
public class class_name {
public GetTransitGatewayRouteTablePropagationsResult withTransitGatewayRouteTablePropagations(
TransitGatewayRouteTablePropagation... transitGatewayRouteTablePropagations) {
if (this.transitGatewayRouteTablePropagations == null) {
setTransitGatewayRouteTablePropagations(new com.amazonaws.internal.SdkInternalList<TransitGatewayRouteTablePropagation>(
transitGatewayRouteTablePropagations.length)); // depends on control dependency: [if], data = [none]
}
for (TransitGatewayRouteTablePropagation ele : transitGatewayRouteTablePropagations) {
this.transitGatewayRouteTablePropagations.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static synchronized JmsFactoryFactory getInstance() throws JMSException
{
if (tcInt.isEntryEnabled())
Tr.entry(tcInt, "getInstance");
if (instance == null)
{
try
{
Class cls =
Class.forName(ApiJmsConstants.CONNFACTORY_FACTORY_CLASS);
instance = (JmsFactoryFactory) cls.newInstance();
} catch (Exception e)
{
// No FFDC code needed
if (tcInt.isDebugEnabled())
Tr.debug(tcInt, "Unable to instantiate JmsFactoryFactory", e);
if (tcInt.isEntryEnabled())
Tr.exit(tcInt, "getInstance");
instance = null;
JMSException jmse = new JMSException(nls.getFormattedMessage("UNABLE_TO_CREATE_FACTORY_CWSIA0001",
new Object[] {"JmsFactoryFactoryImpl", "sib.api.jmsImpl.jar"},
"!!!Unable to instantiate JmsFactoryFactoryImpl"));
jmse.setLinkedException(e);
jmse.initCause(e);
throw jmse;
}
}//if
if (tcInt.isEntryEnabled())
Tr.exit(tcInt, "getInstance");
// If we get this far, then the instance is initialized, since an exception would
// have been thrown if it was not.
return instance;
} }
|
public class class_name {
public static synchronized JmsFactoryFactory getInstance() throws JMSException
{
if (tcInt.isEntryEnabled())
Tr.entry(tcInt, "getInstance");
if (instance == null)
{
try
{
Class cls =
Class.forName(ApiJmsConstants.CONNFACTORY_FACTORY_CLASS);
instance = (JmsFactoryFactory) cls.newInstance();
} catch (Exception e)
{
// No FFDC code needed
if (tcInt.isDebugEnabled())
Tr.debug(tcInt, "Unable to instantiate JmsFactoryFactory", e);
if (tcInt.isEntryEnabled())
Tr.exit(tcInt, "getInstance");
instance = null;
JMSException jmse = new JMSException(nls.getFormattedMessage("UNABLE_TO_CREATE_FACTORY_CWSIA0001",
new Object[] {"JmsFactoryFactoryImpl", "sib.api.jmsImpl.jar"},
"!!!Unable to instantiate JmsFactoryFactoryImpl"));
jmse.setLinkedException(e);
jmse.initCause(e);
throw jmse;
} // depends on control dependency: [catch], data = [none]
}//if
if (tcInt.isEntryEnabled())
Tr.exit(tcInt, "getInstance");
// If we get this far, then the instance is initialized, since an exception would
// have been thrown if it was not.
return instance;
} }
|
public class class_name {
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1784")
@CanIgnoreReturnValue
public static SslContextBuilder configure(SslContextBuilder builder, SslProvider provider) {
switch (provider) {
case JDK:
{
Provider jdkProvider = findJdkProvider();
if (jdkProvider == null) {
throw new IllegalArgumentException(
"Could not find Jetty NPN/ALPN or Conscrypt as installed JDK providers");
}
return configure(builder, jdkProvider);
}
case OPENSSL:
{
ApplicationProtocolConfig apc;
if (OpenSsl.isAlpnSupported()) {
apc = NPN_AND_ALPN;
} else {
apc = NPN;
}
return builder
.sslProvider(SslProvider.OPENSSL)
.ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE)
.applicationProtocolConfig(apc);
}
default:
throw new IllegalArgumentException("Unsupported provider: " + provider);
}
} }
|
public class class_name {
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1784")
@CanIgnoreReturnValue
public static SslContextBuilder configure(SslContextBuilder builder, SslProvider provider) {
switch (provider) {
case JDK:
{
Provider jdkProvider = findJdkProvider();
if (jdkProvider == null) {
throw new IllegalArgumentException(
"Could not find Jetty NPN/ALPN or Conscrypt as installed JDK providers");
}
return configure(builder, jdkProvider);
}
case OPENSSL:
{
ApplicationProtocolConfig apc;
if (OpenSsl.isAlpnSupported()) {
apc = NPN_AND_ALPN; // depends on control dependency: [if], data = [none]
} else {
apc = NPN; // depends on control dependency: [if], data = [none]
}
return builder
.sslProvider(SslProvider.OPENSSL)
.ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE)
.applicationProtocolConfig(apc);
}
default:
throw new IllegalArgumentException("Unsupported provider: " + provider);
}
} }
|
public class class_name {
private FilterDefinition[] collectFilterDefinitions(Injector injector) {
List<FilterDefinition> filterDefinitions = Lists.newArrayList();
for (Binding<FilterDefinition> entry : injector.findBindingsByType(FILTER_DEFS)) {
filterDefinitions.add(entry.getProvider().get());
}
// Copy to a fixed-size array for speed of iteration.
return filterDefinitions.toArray(new FilterDefinition[filterDefinitions.size()]);
} }
|
public class class_name {
private FilterDefinition[] collectFilterDefinitions(Injector injector) {
List<FilterDefinition> filterDefinitions = Lists.newArrayList();
for (Binding<FilterDefinition> entry : injector.findBindingsByType(FILTER_DEFS)) {
filterDefinitions.add(entry.getProvider().get()); // depends on control dependency: [for], data = [entry]
}
// Copy to a fixed-size array for speed of iteration.
return filterDefinitions.toArray(new FilterDefinition[filterDefinitions.size()]);
} }
|
public class class_name {
public static String getHost(String uriString) {
try {
URI uri = new URI(uriString);
if(uri.getHost()==null) {
throw new IllegalArgumentException("Invalid URI syntax. Scheme and host must be provided (port number is optional): " + uriString);
}
if (uri.getAuthority().startsWith("@") && !uri.getHost().startsWith("@")) {
return "@" + uri.getHost();
}
return uri.getHost();
}
catch (URISyntaxException e) {
try {
return (new NetworkInterfaceURI(uriString)).getHost();
}
catch (IllegalArgumentException ne) {
throw new IllegalArgumentException(ne.getMessage(), ne);
}
}
} }
|
public class class_name {
public static String getHost(String uriString) {
try {
URI uri = new URI(uriString);
if(uri.getHost()==null) {
throw new IllegalArgumentException("Invalid URI syntax. Scheme and host must be provided (port number is optional): " + uriString);
}
if (uri.getAuthority().startsWith("@") && !uri.getHost().startsWith("@")) {
return "@" + uri.getHost(); // depends on control dependency: [if], data = [none]
}
return uri.getHost(); // depends on control dependency: [try], data = [none]
}
catch (URISyntaxException e) {
try {
return (new NetworkInterfaceURI(uriString)).getHost(); // depends on control dependency: [try], data = [none]
}
catch (IllegalArgumentException ne) {
throw new IllegalArgumentException(ne.getMessage(), ne);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static ThreadContextAccessor getThreadContextAccessor() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
// Check for the same permissions that calling
// getContextClassLoader and setContextClassLoader would require.
sm.checkPermission(new RuntimePermission("getClassLoader"));
sm.checkPermission(new RuntimePermission("setContextClassLoader"));
}
return threadContextAccessor;
} }
|
public class class_name {
public static ThreadContextAccessor getThreadContextAccessor() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
// Check for the same permissions that calling
// getContextClassLoader and setContextClassLoader would require.
sm.checkPermission(new RuntimePermission("getClassLoader")); // depends on control dependency: [if], data = [none]
sm.checkPermission(new RuntimePermission("setContextClassLoader")); // depends on control dependency: [if], data = [none]
}
return threadContextAccessor;
} }
|
public class class_name {
void logQuery(CallInfo callInfo, DataSet data) {
if (isEnabled(Option.LOG_QUERIES)) {
log.write(callInfo, data);
}
} }
|
public class class_name {
void logQuery(CallInfo callInfo, DataSet data) {
if (isEnabled(Option.LOG_QUERIES)) {
log.write(callInfo, data); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
RelDataType getTableConstructorRowType(
SqlCall values,
SqlValidatorScope scope) {
final List<SqlNode> rows = values.getOperandList();
assert rows.size() >= 1;
final List<RelDataType> rowTypes = new ArrayList<>();
for (final SqlNode row : rows) {
assert row.getKind() == SqlKind.ROW;
SqlCall rowConstructor = (SqlCall) row;
// REVIEW jvs 10-Sept-2003: Once we support single-row queries as
// rows, need to infer aliases from there.
final List<String> aliasList = new ArrayList<>();
final List<RelDataType> typeList = new ArrayList<>();
for (Ord<SqlNode> column : Ord.zip(rowConstructor.getOperandList())) {
final String alias = deriveAlias(column.e, column.i);
aliasList.add(alias);
final RelDataType type = deriveType(scope, column.e);
typeList.add(type);
}
rowTypes.add(typeFactory.createStructType(typeList, aliasList));
}
if (rows.size() == 1) {
// TODO jvs 10-Oct-2005: get rid of this workaround once
// leastRestrictive can handle all cases
return rowTypes.get(0);
}
return typeFactory.leastRestrictive(rowTypes);
} }
|
public class class_name {
RelDataType getTableConstructorRowType(
SqlCall values,
SqlValidatorScope scope) {
final List<SqlNode> rows = values.getOperandList();
assert rows.size() >= 1;
final List<RelDataType> rowTypes = new ArrayList<>();
for (final SqlNode row : rows) {
assert row.getKind() == SqlKind.ROW;
SqlCall rowConstructor = (SqlCall) row;
// REVIEW jvs 10-Sept-2003: Once we support single-row queries as
// rows, need to infer aliases from there.
final List<String> aliasList = new ArrayList<>();
final List<RelDataType> typeList = new ArrayList<>();
for (Ord<SqlNode> column : Ord.zip(rowConstructor.getOperandList())) {
final String alias = deriveAlias(column.e, column.i);
aliasList.add(alias); // depends on control dependency: [for], data = [none]
final RelDataType type = deriveType(scope, column.e);
typeList.add(type); // depends on control dependency: [for], data = [none]
}
rowTypes.add(typeFactory.createStructType(typeList, aliasList)); // depends on control dependency: [for], data = [row]
}
if (rows.size() == 1) {
// TODO jvs 10-Oct-2005: get rid of this workaround once
// leastRestrictive can handle all cases
return rowTypes.get(0); // depends on control dependency: [if], data = [none]
}
return typeFactory.leastRestrictive(rowTypes);
} }
|
public class class_name {
public String toQueryString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
StringBuilder builder = new StringBuilder();
builder.append( queryBuilder.createPositionalParameter() );
if( negate ) {
builder.append(" NOT");
}
builder.append( " MEMBER OF " );
builder.append( queryBuilder.getAbsolutePath(criteria, relativePath) );
return builder.toString();
} }
|
public class class_name {
public String toQueryString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
StringBuilder builder = new StringBuilder();
builder.append( queryBuilder.createPositionalParameter() );
if( negate ) {
builder.append(" NOT"); // depends on control dependency: [if], data = [none]
}
builder.append( " MEMBER OF " );
builder.append( queryBuilder.getAbsolutePath(criteria, relativePath) );
return builder.toString();
} }
|
public class class_name {
public static boolean addShutdownHookThread(
final Thread shutdownHook,
final String serviceName,
final Logger logger) {
checkNotNull(shutdownHook);
checkNotNull(logger);
try {
// Add JVM shutdown hook to call shutdown of service
Runtime.getRuntime().addShutdownHook(shutdownHook);
return true;
} catch (IllegalStateException e) {
// JVM is already shutting down. no need to do our work
} catch (Throwable t) {
logger.error("Cannot register shutdown hook that cleanly terminates {}.", serviceName, t);
}
return false;
} }
|
public class class_name {
public static boolean addShutdownHookThread(
final Thread shutdownHook,
final String serviceName,
final Logger logger) {
checkNotNull(shutdownHook);
checkNotNull(logger);
try {
// Add JVM shutdown hook to call shutdown of service
Runtime.getRuntime().addShutdownHook(shutdownHook); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (IllegalStateException e) {
// JVM is already shutting down. no need to do our work
} catch (Throwable t) { // depends on control dependency: [catch], data = [none]
logger.error("Cannot register shutdown hook that cleanly terminates {}.", serviceName, t);
} // depends on control dependency: [catch], data = [none]
return false;
} }
|
public class class_name {
public final void addAttributes(final Map<String,String> attributes) {
if(attributes != null) {
this.attributes.putAll(attributes);
}
} }
|
public class class_name {
public final void addAttributes(final Map<String,String> attributes) {
if(attributes != null) {
this.attributes.putAll(attributes); // depends on control dependency: [if], data = [(attributes]
}
} }
|
public class class_name {
public void read_config(InputStream in) throws Exception {
JsonFactory f = new MappingJsonFactory();
JsonParser jp = f.createJsonParser(in);
JsonToken current;
current = jp.nextToken();
if (current != JsonToken.START_OBJECT) {
logger.warn("read_config: Error: START_OBJECT not found : quiting.");
return;
}
current = jp.nextToken();
String fieldName = jp.getCurrentName();
current = jp.nextToken();
if (fieldName.equals("config")) {
if (current != JsonToken.START_OBJECT) {
logger.warn("read_config: Error: START_OBJECT not found after config : quiting.");
return;
}
current = jp.nextToken();
String fieldName2 = jp.getCurrentName();
if (fieldName2.equals("metric_groups")) {
current = jp.nextToken();
if (current != JsonToken.START_ARRAY) {
logger.warn("read_config: Error: START_ARRAY not found after metric_groups : quiting.");
return;
}
current = jp.nextToken();
while (current != JsonToken.END_ARRAY) {
if (current != JsonToken.START_OBJECT) {
logger.warn("read_config: Error: START_OBJECT not found after metric_groups START_ARRAY : quiting.");
return;
}
current = jp.nextToken();
JsonNode node1 = jp.readValueAsTree();
String node1string = write_tostring(node1);
metricgroupMap.put(node1.get("name").asText(),node1string);
current = jp.nextToken();
}
current = jp.nextToken();
String fieldName3 = jp.getCurrentName();
if (fieldName3.equals("dashboards")) {
current = jp.nextToken();
if (current != JsonToken.START_ARRAY) {
logger.warn("read_config: Error: START_ARRAY not found after dashboards : quiting.");
return;
}
current = jp.nextToken();
while (current != JsonToken.END_ARRAY) {
if (current != JsonToken.START_OBJECT) {
logger.warn("read_config: Error: START_OBJECT not found after dashboards START_ARRAY : quiting.");
return;
}
current = jp.nextToken();
JsonNode node = jp.readValueAsTree();
String nodestring = write_tostring(node);
dashMap.put(node.get("name").asText(),nodestring);
current = jp.nextToken();
}
if(jp.nextToken() != JsonToken.END_OBJECT) {
logger.warn("read_config: Error: END_OBJECT expected, not found (1): quiting.");
return;
}
if(jp.nextToken() != JsonToken.END_OBJECT) {
logger.warn("read_config: Error: END_OBJECT expected, not found (2): quiting.");
return;
}
} else {
logger.warn("read_config: Error: Expected dashboards : quiting.");
return;
}
} else {
logger.warn("read_config: Error: Expected metric_groups : quiting.");
return;
}
}
} }
|
public class class_name {
public void read_config(InputStream in) throws Exception {
JsonFactory f = new MappingJsonFactory();
JsonParser jp = f.createJsonParser(in);
JsonToken current;
current = jp.nextToken();
if (current != JsonToken.START_OBJECT) {
logger.warn("read_config: Error: START_OBJECT not found : quiting.");
return;
}
current = jp.nextToken();
String fieldName = jp.getCurrentName();
current = jp.nextToken();
if (fieldName.equals("config")) {
if (current != JsonToken.START_OBJECT) {
logger.warn("read_config: Error: START_OBJECT not found after config : quiting."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
current = jp.nextToken();
String fieldName2 = jp.getCurrentName();
if (fieldName2.equals("metric_groups")) {
current = jp.nextToken(); // depends on control dependency: [if], data = [none]
if (current != JsonToken.START_ARRAY) {
logger.warn("read_config: Error: START_ARRAY not found after metric_groups : quiting."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
current = jp.nextToken(); // depends on control dependency: [if], data = [none]
while (current != JsonToken.END_ARRAY) {
if (current != JsonToken.START_OBJECT) {
logger.warn("read_config: Error: START_OBJECT not found after metric_groups START_ARRAY : quiting."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
current = jp.nextToken(); // depends on control dependency: [while], data = [none]
JsonNode node1 = jp.readValueAsTree();
String node1string = write_tostring(node1);
metricgroupMap.put(node1.get("name").asText(),node1string); // depends on control dependency: [while], data = [none]
current = jp.nextToken(); // depends on control dependency: [while], data = [none]
}
current = jp.nextToken(); // depends on control dependency: [if], data = [none]
String fieldName3 = jp.getCurrentName();
if (fieldName3.equals("dashboards")) {
current = jp.nextToken(); // depends on control dependency: [if], data = [none]
if (current != JsonToken.START_ARRAY) {
logger.warn("read_config: Error: START_ARRAY not found after dashboards : quiting."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
current = jp.nextToken(); // depends on control dependency: [if], data = [none]
while (current != JsonToken.END_ARRAY) {
if (current != JsonToken.START_OBJECT) {
logger.warn("read_config: Error: START_OBJECT not found after dashboards START_ARRAY : quiting."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
current = jp.nextToken(); // depends on control dependency: [while], data = [none]
JsonNode node = jp.readValueAsTree();
String nodestring = write_tostring(node);
dashMap.put(node.get("name").asText(),nodestring); // depends on control dependency: [while], data = [none]
current = jp.nextToken(); // depends on control dependency: [while], data = [none]
}
if(jp.nextToken() != JsonToken.END_OBJECT) {
logger.warn("read_config: Error: END_OBJECT expected, not found (1): quiting."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if(jp.nextToken() != JsonToken.END_OBJECT) {
logger.warn("read_config: Error: END_OBJECT expected, not found (2): quiting."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
} else {
logger.warn("read_config: Error: Expected dashboards : quiting."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
} else {
logger.warn("read_config: Error: Expected metric_groups : quiting."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
protected void appendToStringFunctions(GenerationContext context, XtendTypeDeclaration source,
final JvmGenericType target) {
if (!isAppendToStringFunctionsEnable(context)) {
return;
}
// Create a list of the declared non-static fields.
final List<JvmField> declaredInstanceFields = new ArrayList<>();
for (final JvmField field : target.getDeclaredFields()) {
if (!field.isStatic()) {
declaredInstanceFields.add(field);
}
}
if (!declaredInstanceFields.isEmpty()) {
final JvmTypeReference voidType = this._typeReferenceBuilder.typeRef(Void.TYPE);
final JvmOperation op = SARLJvmModelInferrer.this.typeBuilder.toMethod(
source,
"toString", //$NON-NLS-1$
voidType, it2 -> {
it2.setVisibility(JvmVisibility.PROTECTED);
SARLJvmModelInferrer.this.typeBuilder.setDocumentation(it2,
MessageFormat.format(Messages.SARLJvmModelInferrer_2,
target.getSimpleName()));
final JvmFormalParameter param = this.typesFactory.createJvmFormalParameter();
param.setName("builder"); //$NON-NLS-1$
param.setParameterType(SARLJvmModelInferrer.this._typeReferenceBuilder.typeRef(ToStringBuilder.class));
it2.getParameters().add(param);
setBody(it2, it3 -> {
it3.append("super.toString(builder);"); //$NON-NLS-1$
for (final JvmField attr : declaredInstanceFields) {
it3.newLine();
it3.append("builder.add(\"" + attr.getSimpleName() //$NON-NLS-1$
+ "\", this." //$NON-NLS-1$
+ attr.getSimpleName() + ");"); //$NON-NLS-1$
}
});
});
if (op != null) {
appendGeneratedAnnotation(op, context);
if (context.getGeneratorConfig2().isGeneratePureAnnotation()) {
addAnnotationSafe(op, Pure.class);
}
target.getMembers().add(op);
}
}
} }
|
public class class_name {
protected void appendToStringFunctions(GenerationContext context, XtendTypeDeclaration source,
final JvmGenericType target) {
if (!isAppendToStringFunctionsEnable(context)) {
return; // depends on control dependency: [if], data = [none]
}
// Create a list of the declared non-static fields.
final List<JvmField> declaredInstanceFields = new ArrayList<>();
for (final JvmField field : target.getDeclaredFields()) {
if (!field.isStatic()) {
declaredInstanceFields.add(field); // depends on control dependency: [if], data = [none]
}
}
if (!declaredInstanceFields.isEmpty()) {
final JvmTypeReference voidType = this._typeReferenceBuilder.typeRef(Void.TYPE);
final JvmOperation op = SARLJvmModelInferrer.this.typeBuilder.toMethod(
source,
"toString", //$NON-NLS-1$
voidType, it2 -> {
it2.setVisibility(JvmVisibility.PROTECTED);
SARLJvmModelInferrer.this.typeBuilder.setDocumentation(it2,
MessageFormat.format(Messages.SARLJvmModelInferrer_2,
target.getSimpleName()));
final JvmFormalParameter param = this.typesFactory.createJvmFormalParameter();
param.setName("builder"); //$NON-NLS-1$
param.setParameterType(SARLJvmModelInferrer.this._typeReferenceBuilder.typeRef(ToStringBuilder.class));
it2.getParameters().add(param);
setBody(it2, it3 -> {
it3.append("super.toString(builder);"); //$NON-NLS-1$
for (final JvmField attr : declaredInstanceFields) {
it3.newLine();
it3.append("builder.add(\"" + attr.getSimpleName() //$NON-NLS-1$
+ "\", this." //$NON-NLS-1$
+ attr.getSimpleName() + ");"); //$NON-NLS-1$
}
});
});
if (op != null) {
appendGeneratedAnnotation(op, context);
if (context.getGeneratorConfig2().isGeneratePureAnnotation()) {
addAnnotationSafe(op, Pure.class);
}
target.getMembers().add(op);
}
}
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.