code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public String getNamespaceForPrefix(String prefix)
{
// if (null != prefix && prefix.equals("xmlns"))
// {
// return Constants.S_XMLNAMESPACEURI;
// }
List nsDecls = m_declaredPrefixes;
if (null != nsDecls)
{
int n = nsDecls.size();
if(prefix.equals(Constants.ATTRVAL_DEFAULT_PREFIX))
{
prefix = "";
}
for (int i = 0; i < n; i++)
{
XMLNSDecl decl = (XMLNSDecl) nsDecls.get(i);
if (prefix.equals(decl.getPrefix()))
return decl.getURI();
}
}
// Not found; ask our ancestors
if (null != m_parentNode)
return m_parentNode.getNamespaceForPrefix(prefix);
// JJK: No ancestors; try implicit
// %REVIEW% Are there literals somewhere that we should use instead?
// %REVIEW% Is this really the best place to patch?
if("xml".equals(prefix))
return "http://www.w3.org/XML/1998/namespace";
// No parent, so no definition
return null;
} }
|
public class class_name {
public String getNamespaceForPrefix(String prefix)
{
// if (null != prefix && prefix.equals("xmlns"))
// {
// return Constants.S_XMLNAMESPACEURI;
// }
List nsDecls = m_declaredPrefixes;
if (null != nsDecls)
{
int n = nsDecls.size();
if(prefix.equals(Constants.ATTRVAL_DEFAULT_PREFIX))
{
prefix = ""; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < n; i++)
{
XMLNSDecl decl = (XMLNSDecl) nsDecls.get(i);
if (prefix.equals(decl.getPrefix()))
return decl.getURI();
}
}
// Not found; ask our ancestors
if (null != m_parentNode)
return m_parentNode.getNamespaceForPrefix(prefix);
// JJK: No ancestors; try implicit
// %REVIEW% Are there literals somewhere that we should use instead?
// %REVIEW% Is this really the best place to patch?
if("xml".equals(prefix))
return "http://www.w3.org/XML/1998/namespace";
// No parent, so no definition
return null;
} }
|
public class class_name {
Map<String, Map<String, List<TagsMetricsPair>>> makeMap(
Collection<MetricsContext> contexts) throws IOException {
Map<String, Map<String, List<TagsMetricsPair>>> map =
new TreeMap<String, Map<String, List<TagsMetricsPair>>>();
for (MetricsContext context : contexts) {
Map<String, List<TagsMetricsPair>> records =
new TreeMap<String, List<TagsMetricsPair>>();
map.put(context.getContextName(), records);
for (Map.Entry<String, Collection<OutputRecord>> r :
context.getAllRecords().entrySet()) {
List<TagsMetricsPair> metricsAndTags =
new ArrayList<TagsMetricsPair>();
records.put(r.getKey(), metricsAndTags);
for (OutputRecord outputRecord : r.getValue()) {
TagMap tagMap = outputRecord.getTagsCopy();
MetricMap metricMap = outputRecord.getMetricsCopy();
metricsAndTags.add(new TagsMetricsPair(tagMap, metricMap));
}
}
}
return map;
} }
|
public class class_name {
Map<String, Map<String, List<TagsMetricsPair>>> makeMap(
Collection<MetricsContext> contexts) throws IOException {
Map<String, Map<String, List<TagsMetricsPair>>> map =
new TreeMap<String, Map<String, List<TagsMetricsPair>>>();
for (MetricsContext context : contexts) {
Map<String, List<TagsMetricsPair>> records =
new TreeMap<String, List<TagsMetricsPair>>();
map.put(context.getContextName(), records);
for (Map.Entry<String, Collection<OutputRecord>> r :
context.getAllRecords().entrySet()) {
List<TagsMetricsPair> metricsAndTags =
new ArrayList<TagsMetricsPair>();
records.put(r.getKey(), metricsAndTags); // depends on control dependency: [for], data = [r]
for (OutputRecord outputRecord : r.getValue()) {
TagMap tagMap = outputRecord.getTagsCopy();
MetricMap metricMap = outputRecord.getMetricsCopy();
metricsAndTags.add(new TagsMetricsPair(tagMap, metricMap)); // depends on control dependency: [for], data = [none]
}
}
}
return map;
} }
|
public class class_name {
public static int indexOf(String str, String searchStr, int startPos) {
if (str == null || searchStr == null) {
return INDEX_NOT_FOUND;
}
// JDK1.2/JDK1.3 have a bug, when startPos > str.length for "", hence
if (searchStr.length() == 0 && startPos >= str.length()) {
return str.length();
}
return str.indexOf(searchStr, startPos);
} }
|
public class class_name {
public static int indexOf(String str, String searchStr, int startPos) {
if (str == null || searchStr == null) {
return INDEX_NOT_FOUND; // depends on control dependency: [if], data = [none]
}
// JDK1.2/JDK1.3 have a bug, when startPos > str.length for "", hence
if (searchStr.length() == 0 && startPos >= str.length()) {
return str.length(); // depends on control dependency: [if], data = [none]
}
return str.indexOf(searchStr, startPos);
} }
|
public class class_name {
private static boolean constantTimeEquals(byte[] a, byte[] b) {
if (a.length != b.length) {
return false;
}
int result = 0;
for (int i = 0; i < a.length; i++) {
result |= a[i] ^ b[i];
}
return result == 0;
} }
|
public class class_name {
private static boolean constantTimeEquals(byte[] a, byte[] b) {
if (a.length != b.length) {
return false; // depends on control dependency: [if], data = [none]
}
int result = 0;
for (int i = 0; i < a.length; i++) {
result |= a[i] ^ b[i]; // depends on control dependency: [for], data = [i]
}
return result == 0;
} }
|
public class class_name {
public void log(Level level, Object... elements) {
if(willWrite.compareTo(level)<=0) {
StringBuilder sb = buildLine(level, new StringBuilder(),elements);
if(context==null) {
System.out.println(sb.toString());
} else {
context.log(sb.toString());
}
}
} }
|
public class class_name {
public void log(Level level, Object... elements) {
if(willWrite.compareTo(level)<=0) {
StringBuilder sb = buildLine(level, new StringBuilder(),elements);
if(context==null) {
System.out.println(sb.toString()); // depends on control dependency: [if], data = [none]
} else {
context.log(sb.toString()); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static IMarker getMarkerFromEditor(ITextSelection selection, IEditorPart editor) {
IResource resource = (IResource) editor.getEditorInput().getAdapter(IFile.class);
IMarker[] allMarkers;
if (resource != null) {
allMarkers = getMarkers(resource, IResource.DEPTH_ZERO);
} else {
IClassFile classFile = (IClassFile) editor.getEditorInput().getAdapter(IClassFile.class);
if (classFile == null) {
return null;
}
Set<IMarker> markers = getMarkers(classFile.getType());
allMarkers = markers.toArray(new IMarker[markers.size()]);
}
// if editor contains only one FB marker, do some cheating and always
// return it.
if (allMarkers.length == 1) {
return allMarkers[0];
}
// +1 because it counts real lines, but editor shows lines + 1
int startLine = selection.getStartLine() + 1;
for (IMarker marker : allMarkers) {
int line = getEditorLine(marker);
if (startLine == line) {
return marker;
}
}
return null;
} }
|
public class class_name {
public static IMarker getMarkerFromEditor(ITextSelection selection, IEditorPart editor) {
IResource resource = (IResource) editor.getEditorInput().getAdapter(IFile.class);
IMarker[] allMarkers;
if (resource != null) {
allMarkers = getMarkers(resource, IResource.DEPTH_ZERO); // depends on control dependency: [if], data = [(resource]
} else {
IClassFile classFile = (IClassFile) editor.getEditorInput().getAdapter(IClassFile.class);
if (classFile == null) {
return null; // depends on control dependency: [if], data = [none]
}
Set<IMarker> markers = getMarkers(classFile.getType());
allMarkers = markers.toArray(new IMarker[markers.size()]); // depends on control dependency: [if], data = [none]
}
// if editor contains only one FB marker, do some cheating and always
// return it.
if (allMarkers.length == 1) {
return allMarkers[0]; // depends on control dependency: [if], data = [none]
}
// +1 because it counts real lines, but editor shows lines + 1
int startLine = selection.getStartLine() + 1;
for (IMarker marker : allMarkers) {
int line = getEditorLine(marker);
if (startLine == line) {
return marker; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public FormEntry getFormEntry(final String entryKey) {
FormEntry entry = entries.get(entryKey);
if (entry == null) {
entry = addFormEntry(entryKey, null);
}
return entry;
} }
|
public class class_name {
public FormEntry getFormEntry(final String entryKey) {
FormEntry entry = entries.get(entryKey);
if (entry == null) {
entry = addFormEntry(entryKey, null);
// depends on control dependency: [if], data = [(entry]
}
return entry;
} }
|
public class class_name {
@Override
public void addRole(final String role) {
try {
roles.add(UserRoleName.valueOf(role));
} catch (Exception e) {
logger.warn("Tried to add unrecognized role: " + role);
}
} }
|
public class class_name {
@Override
public void addRole(final String role) {
try {
roles.add(UserRoleName.valueOf(role)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.warn("Tried to add unrecognized role: " + role);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public CocoTask<T> progress(final Activity progress) {
if (progress != null) {
this.progress = new WeakReference<Object>(progress);
}
return this;
} }
|
public class class_name {
public CocoTask<T> progress(final Activity progress) {
if (progress != null) {
this.progress = new WeakReference<Object>(progress); // depends on control dependency: [if], data = [(progress]
}
return this;
} }
|
public class class_name {
public Schema loadSchema(String schema) {
try {
JSONObject rawSchema = new JSONObject(new JSONTokener(schema));
return SchemaLoader.load(rawSchema);
} catch (JSONException | SchemaException e) {
throw new InvalidJsonSchemaException(e);
}
} }
|
public class class_name {
public Schema loadSchema(String schema) {
try {
JSONObject rawSchema = new JSONObject(new JSONTokener(schema));
return SchemaLoader.load(rawSchema); // depends on control dependency: [try], data = [none]
} catch (JSONException | SchemaException e) {
throw new InvalidJsonSchemaException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void consumeNonExecutePrefix()
{
// fast forward through the leading whitespace
nextNonWhitespace(true);
pos--;
if (pos + NON_EXECUTE_PREFIX.length > limit) {
return;
}
for (int i = 0; i < NON_EXECUTE_PREFIX.length; i++) {
if (in.charAt(pos + i) != NON_EXECUTE_PREFIX[i]) {
return; // not a security token!
}
}
// we consumed a security token!
pos += NON_EXECUTE_PREFIX.length;
} }
|
public class class_name {
private void consumeNonExecutePrefix()
{
// fast forward through the leading whitespace
nextNonWhitespace(true);
pos--;
if (pos + NON_EXECUTE_PREFIX.length > limit) {
return; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < NON_EXECUTE_PREFIX.length; i++) {
if (in.charAt(pos + i) != NON_EXECUTE_PREFIX[i]) {
return; // not a security token! // depends on control dependency: [if], data = [none]
}
}
// we consumed a security token!
pos += NON_EXECUTE_PREFIX.length;
} }
|
public class class_name {
@SuppressWarnings("unused")
final void handleHeaderValue(ByteBuffer buffer, ParseState state, HttpServerExchange builder) throws BadRequestException {
HttpString headerName = state.nextHeader;
StringBuilder stringBuilder = state.stringBuilder;
CacheMap<HttpString, String> headerValuesCache = state.headerValuesCache;
if (headerName != null && stringBuilder.length() == 0 && headerValuesCache != null) {
String existing = headerValuesCache.get(headerName);
if (existing != null) {
if (handleCachedHeader(existing, buffer, state, builder)) {
return;
}
}
}
handleHeaderValueCacheMiss(buffer, state, builder, headerName, headerValuesCache, stringBuilder);
} }
|
public class class_name {
@SuppressWarnings("unused")
final void handleHeaderValue(ByteBuffer buffer, ParseState state, HttpServerExchange builder) throws BadRequestException {
HttpString headerName = state.nextHeader;
StringBuilder stringBuilder = state.stringBuilder;
CacheMap<HttpString, String> headerValuesCache = state.headerValuesCache;
if (headerName != null && stringBuilder.length() == 0 && headerValuesCache != null) {
String existing = headerValuesCache.get(headerName);
if (existing != null) {
if (handleCachedHeader(existing, buffer, state, builder)) {
return; // depends on control dependency: [if], data = [none]
}
}
}
handleHeaderValueCacheMiss(buffer, state, builder, headerName, headerValuesCache, stringBuilder);
} }
|
public class class_name {
private JPanel getPaneStatus() {
if (paneStatus == null) {
paneStatus = new JPanel();
paneStatus.setLayout(new BorderLayout(0,0));
paneStatus.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
paneStatus.add(getTabbedStatus());
}
return paneStatus;
} }
|
public class class_name {
private JPanel getPaneStatus() {
if (paneStatus == null) {
paneStatus = new JPanel();
// depends on control dependency: [if], data = [none]
paneStatus.setLayout(new BorderLayout(0,0));
// depends on control dependency: [if], data = [none]
paneStatus.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
// depends on control dependency: [if], data = [none]
paneStatus.add(getTabbedStatus());
// depends on control dependency: [if], data = [none]
}
return paneStatus;
} }
|
public class class_name {
public Resource getMaxContainerResources() {
double maxCpu = 0;
ByteAmount maxRam = ByteAmount.ZERO;
ByteAmount maxDisk = ByteAmount.ZERO;
for (ContainerPlan containerPlan : getContainers()) {
Resource containerResource =
containerPlan.getScheduledResource().or(containerPlan.getRequiredResource());
maxCpu = Math.max(maxCpu, containerResource.getCpu());
maxRam = maxRam.max(containerResource.getRam());
maxDisk = maxDisk.max(containerResource.getDisk());
}
return new Resource(maxCpu, maxRam, maxDisk);
} }
|
public class class_name {
public Resource getMaxContainerResources() {
double maxCpu = 0;
ByteAmount maxRam = ByteAmount.ZERO;
ByteAmount maxDisk = ByteAmount.ZERO;
for (ContainerPlan containerPlan : getContainers()) {
Resource containerResource =
containerPlan.getScheduledResource().or(containerPlan.getRequiredResource());
maxCpu = Math.max(maxCpu, containerResource.getCpu()); // depends on control dependency: [for], data = [none]
maxRam = maxRam.max(containerResource.getRam()); // depends on control dependency: [for], data = [none]
maxDisk = maxDisk.max(containerResource.getDisk()); // depends on control dependency: [for], data = [none]
}
return new Resource(maxCpu, maxRam, maxDisk);
} }
|
public class class_name {
public void getPersistentData(ObjectOutputStream dout)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getPersistentData", dout);
try
{
dout.writeLong(tick);
dout.writeLong(msgId);
dout.writeInt(storagePolicy);
dout.writeLong(plockId);
dout.writeLong(prevTick);
dout.writeLong(waitTime);
dout.writeInt(priority);
dout.writeInt(reliability);
dout.writeLong(aiRequestTick);
dout.writeUTF(sourceMEUuid.toString());
}
catch (IOException e)
{
// No FFDC code needed
SIErrorException e2 = new SIErrorException(e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getPersistentData", e2);
throw e2;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getPersistentData");
} }
|
public class class_name {
public void getPersistentData(ObjectOutputStream dout)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getPersistentData", dout);
try
{
dout.writeLong(tick); // depends on control dependency: [try], data = [none]
dout.writeLong(msgId); // depends on control dependency: [try], data = [none]
dout.writeInt(storagePolicy); // depends on control dependency: [try], data = [none]
dout.writeLong(plockId); // depends on control dependency: [try], data = [none]
dout.writeLong(prevTick); // depends on control dependency: [try], data = [none]
dout.writeLong(waitTime); // depends on control dependency: [try], data = [none]
dout.writeInt(priority); // depends on control dependency: [try], data = [none]
dout.writeInt(reliability); // depends on control dependency: [try], data = [none]
dout.writeLong(aiRequestTick); // depends on control dependency: [try], data = [none]
dout.writeUTF(sourceMEUuid.toString()); // depends on control dependency: [try], data = [none]
}
catch (IOException e)
{
// No FFDC code needed
SIErrorException e2 = new SIErrorException(e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getPersistentData", e2);
throw e2;
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getPersistentData");
} }
|
public class class_name {
public static Date valueOf(String s) {
final int YEAR_LENGTH = 4;
final int MONTH_LENGTH = 2;
final int DAY_LENGTH = 2;
final int MAX_MONTH = 12;
final int MAX_DAY = 31;
int firstDash;
int secondDash;
Date d = null;
if (s == null) {
throw new java.lang.IllegalArgumentException();
}
firstDash = s.indexOf('-');
secondDash = s.indexOf('-', firstDash + 1);
if ((firstDash > 0) && (secondDash > 0) && (secondDash < s.length() - 1)) {
String yyyy = s.substring(0, firstDash);
String mm = s.substring(firstDash + 1, secondDash);
String dd = s.substring(secondDash + 1);
if (yyyy.length() == YEAR_LENGTH &&
(mm.length() >= 1 && mm.length() <= MONTH_LENGTH) &&
(dd.length() >= 1 && dd.length() <= DAY_LENGTH)) {
int year = Integer.parseInt(yyyy);
int month = Integer.parseInt(mm);
int day = Integer.parseInt(dd);
if ((month >= 1 && month <= MAX_MONTH) && (day >= 1 && day <= MAX_DAY)) {
d = new Date(year - 1900, month - 1, day);
}
}
}
if (d == null) {
throw new java.lang.IllegalArgumentException();
}
return d;
} }
|
public class class_name {
public static Date valueOf(String s) {
final int YEAR_LENGTH = 4;
final int MONTH_LENGTH = 2;
final int DAY_LENGTH = 2;
final int MAX_MONTH = 12;
final int MAX_DAY = 31;
int firstDash;
int secondDash;
Date d = null;
if (s == null) {
throw new java.lang.IllegalArgumentException();
}
firstDash = s.indexOf('-');
secondDash = s.indexOf('-', firstDash + 1);
if ((firstDash > 0) && (secondDash > 0) && (secondDash < s.length() - 1)) {
String yyyy = s.substring(0, firstDash);
String mm = s.substring(firstDash + 1, secondDash);
String dd = s.substring(secondDash + 1);
if (yyyy.length() == YEAR_LENGTH &&
(mm.length() >= 1 && mm.length() <= MONTH_LENGTH) &&
(dd.length() >= 1 && dd.length() <= DAY_LENGTH)) {
int year = Integer.parseInt(yyyy);
int month = Integer.parseInt(mm);
int day = Integer.parseInt(dd);
if ((month >= 1 && month <= MAX_MONTH) && (day >= 1 && day <= MAX_DAY)) {
d = new Date(year - 1900, month - 1, day); // depends on control dependency: [if], data = [none]
}
}
}
if (d == null) {
throw new java.lang.IllegalArgumentException();
}
return d;
} }
|
public class class_name {
private void replacePath(String sourceModulePath, String targetModulePath, List<CmsResource> resources)
throws CmsException, UnsupportedEncodingException {
for (CmsResource resource : resources) {
if (resource.isFile()) {
CmsFile file = getCms().readFile(resource);
if (CmsResourceTypeXmlContent.isXmlContent(file)) {
CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file);
xmlContent.setAutoCorrectionEnabled(true);
file = xmlContent.correctXmlStructure(getCms());
}
String encoding = CmsLocaleManager.getResourceEncoding(getCms(), file);
String oldContent = new String(file.getContents(), encoding);
String newContent = oldContent.replaceAll(sourceModulePath, targetModulePath);
Matcher matcher = Pattern.compile(CmsUUID.UUID_REGEX).matcher(newContent);
newContent = matcher.replaceAll("");
newContent = newContent.replaceAll("<uuid></uuid>", "");
if (!oldContent.equals(newContent)) {
file.setContents(newContent.getBytes(encoding));
if (!resource.getRootPath().startsWith(CmsWorkplace.VFS_PATH_SYSTEM)) {
if (lockResource(getCms(), resource)) {
getCms().writeFile(file);
}
} else {
getCms().writeFile(file);
}
}
}
}
} }
|
public class class_name {
private void replacePath(String sourceModulePath, String targetModulePath, List<CmsResource> resources)
throws CmsException, UnsupportedEncodingException {
for (CmsResource resource : resources) {
if (resource.isFile()) {
CmsFile file = getCms().readFile(resource);
if (CmsResourceTypeXmlContent.isXmlContent(file)) {
CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file);
xmlContent.setAutoCorrectionEnabled(true);
file = xmlContent.correctXmlStructure(getCms());
}
String encoding = CmsLocaleManager.getResourceEncoding(getCms(), file);
String oldContent = new String(file.getContents(), encoding);
String newContent = oldContent.replaceAll(sourceModulePath, targetModulePath);
Matcher matcher = Pattern.compile(CmsUUID.UUID_REGEX).matcher(newContent);
newContent = matcher.replaceAll("");
newContent = newContent.replaceAll("<uuid></uuid>", "");
if (!oldContent.equals(newContent)) {
file.setContents(newContent.getBytes(encoding));
if (!resource.getRootPath().startsWith(CmsWorkplace.VFS_PATH_SYSTEM)) {
if (lockResource(getCms(), resource)) {
getCms().writeFile(file); // depends on control dependency: [if], data = [none]
}
} else {
getCms().writeFile(file); // depends on control dependency: [if], data = [none]
}
}
}
}
} }
|
public class class_name {
public static base_responses disable(nitro_service client, String name[]) throws Exception {
base_responses result = null;
if (name != null && name.length > 0) {
gslbvserver disableresources[] = new gslbvserver[name.length];
for (int i=0;i<name.length;i++){
disableresources[i] = new gslbvserver();
disableresources[i].name = name[i];
}
result = perform_operation_bulk_request(client, disableresources,"disable");
}
return result;
} }
|
public class class_name {
public static base_responses disable(nitro_service client, String name[]) throws Exception {
base_responses result = null;
if (name != null && name.length > 0) {
gslbvserver disableresources[] = new gslbvserver[name.length];
for (int i=0;i<name.length;i++){
disableresources[i] = new gslbvserver(); // depends on control dependency: [for], data = [i]
disableresources[i].name = name[i]; // depends on control dependency: [for], data = [i]
}
result = perform_operation_bulk_request(client, disableresources,"disable");
}
return result;
} }
|
public class class_name {
protected String ensureTextColorFormat(String textColor) {
String formatted = "";
boolean mainColor = true;
for (String style : textColor.split(" ")) {
if (mainColor) {
// the main color
if (!style.endsWith("-text")) {
style += "-text";
}
mainColor = false;
} else {
// the shading type
if (!style.startsWith("text-")) {
style = " text-" + style;
}
}
formatted += style;
}
return formatted;
} }
|
public class class_name {
protected String ensureTextColorFormat(String textColor) {
String formatted = "";
boolean mainColor = true;
for (String style : textColor.split(" ")) {
if (mainColor) {
// the main color
if (!style.endsWith("-text")) {
style += "-text"; // depends on control dependency: [if], data = [none]
}
mainColor = false; // depends on control dependency: [if], data = [none]
} else {
// the shading type
if (!style.startsWith("text-")) {
style = " text-" + style; // depends on control dependency: [if], data = [none]
}
}
formatted += style; // depends on control dependency: [for], data = [style]
}
return formatted;
} }
|
public class class_name {
@SafeVarargs
public static Map<String, AttributeValueUpdate> asUpdateItem(Object... a) {
if (0 != (a.length % 2)) {
throw new IllegalArgumentException(
"The parameters must be the pairs of property name and value, or Map, or an entity class with getter/setter methods.");
}
final Map<String, AttributeValueUpdate> item = new LinkedHashMap<>(N.initHashCapacity(a.length / 2));
for (int i = 0; i < a.length; i++) {
item.put((String) a[i], attrValueUpdateOf(a[++i]));
}
return item;
} }
|
public class class_name {
@SafeVarargs
public static Map<String, AttributeValueUpdate> asUpdateItem(Object... a) {
if (0 != (a.length % 2)) {
throw new IllegalArgumentException(
"The parameters must be the pairs of property name and value, or Map, or an entity class with getter/setter methods.");
}
final Map<String, AttributeValueUpdate> item = new LinkedHashMap<>(N.initHashCapacity(a.length / 2));
for (int i = 0; i < a.length; i++) {
item.put((String) a[i], attrValueUpdateOf(a[++i]));
// depends on control dependency: [for], data = [i]
}
return item;
} }
|
public class class_name {
public void removeReplicateData() {
if (replicatedDataWithFailover != null) {
replicatedDataWithFailover.remove();
replicatedDataWithFailover = null;
}
if (replicatedData != null) {
replicatedData.remove();
replicatedData = null;
}
} }
|
public class class_name {
public void removeReplicateData() {
if (replicatedDataWithFailover != null) {
replicatedDataWithFailover.remove(); // depends on control dependency: [if], data = [none]
replicatedDataWithFailover = null; // depends on control dependency: [if], data = [none]
}
if (replicatedData != null) {
replicatedData.remove(); // depends on control dependency: [if], data = [none]
replicatedData = null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void notifyLayerChanged(FeatureProvider provider,
Integer layerRefreshOld,
Integer layerRefreshNew,
Integer layerDisplayOld,
Integer layerDisplayNew)
{
if (provider.hasFeature(Refreshable.class))
{
final Refreshable refreshable = provider.getFeature(Refreshable.class);
getLayer(layerRefreshOld).remove(refreshable);
getLayer(layerRefreshNew).add(refreshable);
indexs.add(layerRefreshNew);
}
} }
|
public class class_name {
@Override
public void notifyLayerChanged(FeatureProvider provider,
Integer layerRefreshOld,
Integer layerRefreshNew,
Integer layerDisplayOld,
Integer layerDisplayNew)
{
if (provider.hasFeature(Refreshable.class))
{
final Refreshable refreshable = provider.getFeature(Refreshable.class);
getLayer(layerRefreshOld).remove(refreshable);
// depends on control dependency: [if], data = [none]
getLayer(layerRefreshNew).add(refreshable);
// depends on control dependency: [if], data = [none]
indexs.add(layerRefreshNew);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public EClass getIfcAccelerationMeasure() {
if (ifcAccelerationMeasureEClass == null) {
ifcAccelerationMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(655);
}
return ifcAccelerationMeasureEClass;
} }
|
public class class_name {
public EClass getIfcAccelerationMeasure() {
if (ifcAccelerationMeasureEClass == null) {
ifcAccelerationMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(655);
// depends on control dependency: [if], data = [none]
}
return ifcAccelerationMeasureEClass;
} }
|
public class class_name {
private static int isNumeric(String s) {
final char[] chars = s.toCharArray();
int num = 0;
// note: this method does not account for leading zeroes as could occur in build
// meta data parts. Leading zeroes are thus simply ignored when parsing the
// number.
for (int i = 0; i < chars.length; ++i) {
final char c = chars[i];
if (c >= '0' && c <= '9') {
num = num * DECIMAL + Character.digit(c, DECIMAL);
} else {
return -1;
}
}
return num;
} }
|
public class class_name {
private static int isNumeric(String s) {
final char[] chars = s.toCharArray();
int num = 0;
// note: this method does not account for leading zeroes as could occur in build
// meta data parts. Leading zeroes are thus simply ignored when parsing the
// number.
for (int i = 0; i < chars.length; ++i) {
final char c = chars[i];
if (c >= '0' && c <= '9') {
num = num * DECIMAL + Character.digit(c, DECIMAL); // depends on control dependency: [if], data = [(c]
} else {
return -1; // depends on control dependency: [if], data = [none]
}
}
return num;
} }
|
public class class_name {
public Automaton getTransitionPlanned(String name) {
for (Automaton ps : pendingTransitions) {
if (ps.name.equals(name)) {
return ps;
}
}
if (currentState != null && currentState.name.equals(name)) {
return currentState;
}
return null;
} }
|
public class class_name {
public Automaton getTransitionPlanned(String name) {
for (Automaton ps : pendingTransitions) {
if (ps.name.equals(name)) {
return ps; // depends on control dependency: [if], data = [none]
}
}
if (currentState != null && currentState.name.equals(name)) {
return currentState; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public String getXML()
{
Object root = null;
if (m_message != null)
root = m_message.getRawData();
if (root != null)
{
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
String strSOAPPackage = (String)((TrxMessageHeader)this.getMessage().getMessageHeader()).get(SOAPMessageTransport.SOAP_PACKAGE);
Marshaller m = JaxbContexts.getJAXBContexts().getMarshaller(strSOAPPackage);
if (m == null)
return null;
synchronized(m)
{ // Since the marshaller is shared (may want to tweek this for multi-cpu implementations)
m.marshal( root, out );
}
String strXML = out.toString(Constants.STRING_ENCODING);
return strXML;
} catch (IOException ex) {
ex.printStackTrace(); // Never
} catch (JAXBException ex) {
ex.printStackTrace();
} catch (java.lang.IllegalArgumentException ex) {
ex.printStackTrace();
}
}
return null;
} }
|
public class class_name {
public String getXML()
{
Object root = null;
if (m_message != null)
root = m_message.getRawData();
if (root != null)
{
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
String strSOAPPackage = (String)((TrxMessageHeader)this.getMessage().getMessageHeader()).get(SOAPMessageTransport.SOAP_PACKAGE);
Marshaller m = JaxbContexts.getJAXBContexts().getMarshaller(strSOAPPackage);
if (m == null)
return null;
synchronized(m) // depends on control dependency: [try], data = [none]
{ // Since the marshaller is shared (may want to tweek this for multi-cpu implementations)
m.marshal( root, out );
}
String strXML = out.toString(Constants.STRING_ENCODING);
return strXML; // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
ex.printStackTrace(); // Never
} catch (JAXBException ex) { // depends on control dependency: [catch], data = [none]
ex.printStackTrace();
} catch (java.lang.IllegalArgumentException ex) { // depends on control dependency: [catch], data = [none]
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return null;
} }
|
public class class_name {
public final void mRULE_SL_COMMENT() throws RecognitionException {
try {
int _type = RULE_SL_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:9911:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// InternalXtext.g:9911:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
{
match("//");
// InternalXtext.g:9911:24: (~ ( ( '\\n' | '\\r' ) ) )*
loop8:
do {
int alt8=2;
int LA8_0 = input.LA(1);
if ( ((LA8_0>='\u0000' && LA8_0<='\t')||(LA8_0>='\u000B' && LA8_0<='\f')||(LA8_0>='\u000E' && LA8_0<='\uFFFF')) ) {
alt8=1;
}
switch (alt8) {
case 1 :
// InternalXtext.g:9911:24: ~ ( ( '\\n' | '\\r' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;}
}
break;
default :
break loop8;
}
} while (true);
// InternalXtext.g:9911:40: ( ( '\\r' )? '\\n' )?
int alt10=2;
int LA10_0 = input.LA(1);
if ( (LA10_0=='\n'||LA10_0=='\r') ) {
alt10=1;
}
switch (alt10) {
case 1 :
// InternalXtext.g:9911:41: ( '\\r' )? '\\n'
{
// InternalXtext.g:9911:41: ( '\\r' )?
int alt9=2;
int LA9_0 = input.LA(1);
if ( (LA9_0=='\r') ) {
alt9=1;
}
switch (alt9) {
case 1 :
// InternalXtext.g:9911:41: '\\r'
{
match('\r');
}
break;
}
match('\n');
}
break;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
}
} }
|
public class class_name {
public final void mRULE_SL_COMMENT() throws RecognitionException {
try {
int _type = RULE_SL_COMMENT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// InternalXtext.g:9911:17: ( '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )? )
// InternalXtext.g:9911:19: '//' (~ ( ( '\\n' | '\\r' ) ) )* ( ( '\\r' )? '\\n' )?
{
match("//");
// InternalXtext.g:9911:24: (~ ( ( '\\n' | '\\r' ) ) )*
loop8:
do {
int alt8=2;
int LA8_0 = input.LA(1);
if ( ((LA8_0>='\u0000' && LA8_0<='\t')||(LA8_0>='\u000B' && LA8_0<='\f')||(LA8_0>='\u000E' && LA8_0<='\uFFFF')) ) {
alt8=1; // depends on control dependency: [if], data = [none]
}
switch (alt8) {
case 1 :
// InternalXtext.g:9911:24: ~ ( ( '\\n' | '\\r' ) )
{
if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;}
}
break;
default :
break loop8;
}
} while (true);
// InternalXtext.g:9911:40: ( ( '\\r' )? '\\n' )?
int alt10=2;
int LA10_0 = input.LA(1);
if ( (LA10_0=='\n'||LA10_0=='\r') ) {
alt10=1; // depends on control dependency: [if], data = [none]
}
switch (alt10) {
case 1 :
// InternalXtext.g:9911:41: ( '\\r' )? '\\n'
{
// InternalXtext.g:9911:41: ( '\\r' )?
int alt9=2;
int LA9_0 = input.LA(1);
if ( (LA9_0=='\r') ) {
alt9=1; // depends on control dependency: [if], data = [none]
}
switch (alt9) {
case 1 :
// InternalXtext.g:9911:41: '\\r'
{
match('\r');
}
break;
}
match('\n');
}
break;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
}
} }
|
public class class_name {
public static TimeZone getTimeZone(String id) {
if (id == null) {
throw new NullPointerException("id == null");
}
// Special cases? These can clone an existing instance.
if (id.length() == 3) {
if (id.equals("GMT")) {
return (TimeZone) GMTHolder.INSTANCE.clone();
}
if (id.equals("UTC")) {
return (TimeZone) UTCHolder.INSTANCE.clone();
}
}
// Native time zone?
TimeZone zone = NativeTimeZone.get(id);
// Custom time zone?
if (zone == null && id.length() > 3 && id.startsWith("GMT")) {
zone = getCustomTimeZone(id);
}
// We never return null; on failure we return the equivalent of "GMT".
return (zone != null) ? zone : (TimeZone) GMTHolder.INSTANCE.clone();
} }
|
public class class_name {
public static TimeZone getTimeZone(String id) {
if (id == null) {
throw new NullPointerException("id == null");
}
// Special cases? These can clone an existing instance.
if (id.length() == 3) {
if (id.equals("GMT")) {
return (TimeZone) GMTHolder.INSTANCE.clone(); // depends on control dependency: [if], data = [none]
}
if (id.equals("UTC")) {
return (TimeZone) UTCHolder.INSTANCE.clone(); // depends on control dependency: [if], data = [none]
}
}
// Native time zone?
TimeZone zone = NativeTimeZone.get(id);
// Custom time zone?
if (zone == null && id.length() > 3 && id.startsWith("GMT")) {
zone = getCustomTimeZone(id); // depends on control dependency: [if], data = [none]
}
// We never return null; on failure we return the equivalent of "GMT".
return (zone != null) ? zone : (TimeZone) GMTHolder.INSTANCE.clone();
} }
|
public class class_name {
public static Set<Class<?>> getClasses(String packageName, boolean recursive, ClassFileFilter filter) {
if (packageName == null || packageName.length() == 0) {
throw new IllegalArgumentException("packageName is empty.");
}
ClassLoader loader = Thread.currentThread().getContextClassLoader();
String packageDirName = packageName.replace('.', '/');
Collection<URL> urls;
try {
Enumeration<URL> dirs = loader.getResources(packageDirName);
urls = Collections.list(dirs);
} catch (IOException e) {
throw new RuntimeException(e);
}
Set<Class<?>> klasses = new LinkedHashSet<Class<?>>();
for (URL url : urls) {
String protocol = url.getProtocol();
if ("file".equals(protocol)) {
lookupClassesInFileSystem(packageName, new File(url.getFile()), recursive, loader, filter, klasses);
} else if ("jar".equals(protocol)) {
lookupClassesInJar(packageName, url, recursive, loader, filter, klasses);
}
}
return klasses;
} }
|
public class class_name {
public static Set<Class<?>> getClasses(String packageName, boolean recursive, ClassFileFilter filter) {
if (packageName == null || packageName.length() == 0) {
throw new IllegalArgumentException("packageName is empty.");
}
ClassLoader loader = Thread.currentThread().getContextClassLoader();
String packageDirName = packageName.replace('.', '/');
Collection<URL> urls;
try {
Enumeration<URL> dirs = loader.getResources(packageDirName);
urls = Collections.list(dirs); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
Set<Class<?>> klasses = new LinkedHashSet<Class<?>>();
for (URL url : urls) {
String protocol = url.getProtocol();
if ("file".equals(protocol)) {
lookupClassesInFileSystem(packageName, new File(url.getFile()), recursive, loader, filter, klasses); // depends on control dependency: [if], data = [none]
} else if ("jar".equals(protocol)) {
lookupClassesInJar(packageName, url, recursive, loader, filter, klasses); // depends on control dependency: [if], data = [none]
}
}
return klasses;
} }
|
public class class_name {
private static int multAndCarryBy10(int[] src, int srcLen, int[] dst) {
long carry = 0;
for (int i = 0; i < srcLen; i++) {
long product = (src[i] & LONG_MASK) * 10L + carry;
dst[i] = (int) product;
carry = product >>> 32;
}
return (int) carry;
} }
|
public class class_name {
private static int multAndCarryBy10(int[] src, int srcLen, int[] dst) {
long carry = 0;
for (int i = 0; i < srcLen; i++) {
long product = (src[i] & LONG_MASK) * 10L + carry;
dst[i] = (int) product; // depends on control dependency: [for], data = [i]
carry = product >>> 32; // depends on control dependency: [for], data = [none]
}
return (int) carry;
} }
|
public class class_name {
public String getQualifiedName(Node n) {
if (n.getBooleanProp(Node.IS_MODULE_NAME)) {
return n.getString();
} else if (n.isGetProp()) {
String left = getQualifiedName(n.getFirstChild());
if (left == null) {
return null;
}
return left + "." + n.getLastChild().getString();
}
return n.getQualifiedName();
} }
|
public class class_name {
public String getQualifiedName(Node n) {
if (n.getBooleanProp(Node.IS_MODULE_NAME)) {
return n.getString(); // depends on control dependency: [if], data = [none]
} else if (n.isGetProp()) {
String left = getQualifiedName(n.getFirstChild());
if (left == null) {
return null; // depends on control dependency: [if], data = [none]
}
return left + "." + n.getLastChild().getString(); // depends on control dependency: [if], data = [none]
}
return n.getQualifiedName();
} }
|
public class class_name {
public static <E> edu.stanford.nlp.util.PriorityQueue<E> toPriorityQueue(Counter<E> c) {
edu.stanford.nlp.util.PriorityQueue<E> queue = new BinaryHeapPriorityQueue<E>();
for (E key : c.keySet()) {
double count = c.getCount(key);
queue.add(key, count);
}
return queue;
} }
|
public class class_name {
public static <E> edu.stanford.nlp.util.PriorityQueue<E> toPriorityQueue(Counter<E> c) {
edu.stanford.nlp.util.PriorityQueue<E> queue = new BinaryHeapPriorityQueue<E>();
for (E key : c.keySet()) {
double count = c.getCount(key);
queue.add(key, count);
// depends on control dependency: [for], data = [key]
}
return queue;
} }
|
public class class_name {
protected ChannelFuture doBooterConnect(InetSocketAddress address,final ChannelHandler init)
{
ChannelFuture cf;
synchronized (booter) {
if(booter.config().group()==null)
{
booterInit();
}
final CountDownLatch latch=new CountDownLatch(1);
ChannelHandler handler=initHandlerAdapter(init);
booter.handler(handler);
cf=booter.connect(address);
cf.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
log.trace("connect operationComplete:isDone="+future.isDone()+",isSuccess="+future.isSuccess());
if(future.isDone() && future.isSuccess())
{
latch.countDown();
}
}
});
try {
latch.await(getConnectTimeOutMills(),TimeUnit.MILLISECONDS);
} catch (Exception e) {
log.error(e.getMessage(),e);
}
}
return cf;
} }
|
public class class_name {
protected ChannelFuture doBooterConnect(InetSocketAddress address,final ChannelHandler init)
{
ChannelFuture cf;
synchronized (booter) {
if(booter.config().group()==null)
{
booterInit(); // depends on control dependency: [if], data = [none]
}
final CountDownLatch latch=new CountDownLatch(1);
ChannelHandler handler=initHandlerAdapter(init);
booter.handler(handler);
cf=booter.connect(address);
cf.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
log.trace("connect operationComplete:isDone="+future.isDone()+",isSuccess="+future.isSuccess());
if(future.isDone() && future.isSuccess())
{
latch.countDown();
}
}
});
try {
latch.await(getConnectTimeOutMills(),TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error(e.getMessage(),e);
} // depends on control dependency: [catch], data = [none]
}
return cf;
} }
|
public class class_name {
public void endDocument()
{
logger.debug("**** endDoc ****");
for (Iterator iterator = conDesList.iterator(); iterator.hasNext();)
{
JdbcConnectionDescriptor jcd = (JdbcConnectionDescriptor) iterator.next();
con_repository.addDescriptor(jcd);
}
} }
|
public class class_name {
public void endDocument()
{
logger.debug("**** endDoc ****");
for (Iterator iterator = conDesList.iterator(); iterator.hasNext();)
{
JdbcConnectionDescriptor jcd = (JdbcConnectionDescriptor) iterator.next();
con_repository.addDescriptor(jcd);
// depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
@Override
public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents) {
final String methodName = "batchUpdate()";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called");
}
} }
|
public class class_name {
@Override
public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents) {
final String methodName = "batchUpdate()";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@GetMapping("/destinations")
public List<Map<String, String>> destinations() {
List<Map<String, String>> result = new ArrayList<>();
Set<String> destinations = adapterCanalConfig.DESTINATIONS;
for (String destination : destinations) {
Map<String, String> resMap = new LinkedHashMap<>();
boolean status = syncSwitch.status(destination);
String resStatus;
if (status) {
resStatus = "on";
} else {
resStatus = "off";
}
resMap.put("destination", destination);
resMap.put("status", resStatus);
result.add(resMap);
}
return result;
} }
|
public class class_name {
@GetMapping("/destinations")
public List<Map<String, String>> destinations() {
List<Map<String, String>> result = new ArrayList<>();
Set<String> destinations = adapterCanalConfig.DESTINATIONS;
for (String destination : destinations) {
Map<String, String> resMap = new LinkedHashMap<>();
boolean status = syncSwitch.status(destination);
String resStatus;
if (status) {
resStatus = "on"; // depends on control dependency: [if], data = [none]
} else {
resStatus = "off"; // depends on control dependency: [if], data = [none]
}
resMap.put("destination", destination); // depends on control dependency: [for], data = [destination]
resMap.put("status", resStatus); // depends on control dependency: [for], data = [none]
result.add(resMap); // depends on control dependency: [for], data = [none]
}
return result;
} }
|
public class class_name {
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDecoratedLabel label = (WDecoratedLabel) component;
XmlStringBuilder xml = renderContext.getWriter();
WComponent head = label.getHead();
WComponent body = label.getBody();
WComponent tail = label.getTail();
xml.appendTagOpen("ui:decoratedlabel");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", label.isHidden(), "true");
xml.appendClose();
if (head != null && head.isVisible()) {
xml.appendTagOpen("ui:labelhead");
xml.appendAttribute("id", label.getId() + "-head");
xml.appendClose();
head.paint(renderContext);
xml.appendEndTag("ui:labelhead");
}
xml.appendTagOpen("ui:labelbody");
xml.appendAttribute("id", label.getId() + "-body");
xml.appendClose();
body.paint(renderContext);
xml.appendEndTag("ui:labelbody");
if (tail != null && tail.isVisible()) {
xml.appendTagOpen("ui:labeltail");
xml.appendAttribute("id", label.getId() + "-tail");
xml.appendClose();
tail.paint(renderContext);
xml.appendEndTag("ui:labeltail");
}
xml.appendEndTag("ui:decoratedlabel");
} }
|
public class class_name {
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDecoratedLabel label = (WDecoratedLabel) component;
XmlStringBuilder xml = renderContext.getWriter();
WComponent head = label.getHead();
WComponent body = label.getBody();
WComponent tail = label.getTail();
xml.appendTagOpen("ui:decoratedlabel");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("hidden", label.isHidden(), "true");
xml.appendClose();
if (head != null && head.isVisible()) {
xml.appendTagOpen("ui:labelhead"); // depends on control dependency: [if], data = [none]
xml.appendAttribute("id", label.getId() + "-head"); // depends on control dependency: [if], data = [none]
xml.appendClose(); // depends on control dependency: [if], data = [none]
head.paint(renderContext); // depends on control dependency: [if], data = [none]
xml.appendEndTag("ui:labelhead"); // depends on control dependency: [if], data = [none]
}
xml.appendTagOpen("ui:labelbody");
xml.appendAttribute("id", label.getId() + "-body");
xml.appendClose();
body.paint(renderContext);
xml.appendEndTag("ui:labelbody");
if (tail != null && tail.isVisible()) {
xml.appendTagOpen("ui:labeltail"); // depends on control dependency: [if], data = [none]
xml.appendAttribute("id", label.getId() + "-tail"); // depends on control dependency: [if], data = [none]
xml.appendClose(); // depends on control dependency: [if], data = [none]
tail.paint(renderContext); // depends on control dependency: [if], data = [none]
xml.appendEndTag("ui:labeltail"); // depends on control dependency: [if], data = [none]
}
xml.appendEndTag("ui:decoratedlabel");
} }
|
public class class_name {
@Override
public final void setLang(final Languages pLang) {
this.lang = pLang;
if (this.itsId == null) {
this.itsId = new IdI18nSeGoods();
}
this.itsId.setLang(this.lang);
} }
|
public class class_name {
@Override
public final void setLang(final Languages pLang) {
this.lang = pLang;
if (this.itsId == null) {
this.itsId = new IdI18nSeGoods(); // depends on control dependency: [if], data = [none]
}
this.itsId.setLang(this.lang);
} }
|
public class class_name {
public String getProperty(String key) {
String v = propertiesMap.get(key);
if (v != null) {
return v;
} else {
return context.getProperty(key);
}
} }
|
public class class_name {
public String getProperty(String key) {
String v = propertiesMap.get(key);
if (v != null) {
return v; // depends on control dependency: [if], data = [none]
} else {
return context.getProperty(key); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setHandler(String handlerClassName) {
try {
m_handler = (I_CmsStaticExportHandler)Class.forName(handlerClassName).newInstance();
} catch (Exception e) {
// should never happen
LOG.error(e.getLocalizedMessage(), e);
}
} }
|
public class class_name {
public void setHandler(String handlerClassName) {
try {
m_handler = (I_CmsStaticExportHandler)Class.forName(handlerClassName).newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// should never happen
LOG.error(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public boolean configure(final FeatureContext context) {
Configuration configuration = context.getConfiguration();
init(configuration);
String path = (String) configuration.getProperty("datasource.resource.path");
if (StringUtils.isNotBlank(path)) {
dsPath = path.startsWith("/") ? path : "/" + path;
}
context.register(WebStatFilter.class);
if (StringUtils.isNotBlank(username)) {
authorizeToken = UUID.randomUUID().toString().toUpperCase();
context.register(AuthorizationRequestFilter.class);
}
context.register(new ModelProcessor() {
@Override
public ResourceModel processResourceModel(ResourceModel resourceModel, final Configuration configuration) {
ResourceModel.Builder resourceModelBuilder = new ResourceModel.Builder(resourceModel, false);
Resource.Builder resourceBuilder = Resource.builder(DsStatViewResource.class);
resourceBuilder.path(dsPath);
Resource resource = resourceBuilder.build();
resourceModelBuilder.addResource(resource);
return resourceModelBuilder.build();
}
@Override
public ResourceModel processSubResource(ResourceModel subResourceModel, Configuration configuration) {
return subResourceModel;
}
});
return true;
} }
|
public class class_name {
@Override
public boolean configure(final FeatureContext context) {
Configuration configuration = context.getConfiguration();
init(configuration);
String path = (String) configuration.getProperty("datasource.resource.path");
if (StringUtils.isNotBlank(path)) {
dsPath = path.startsWith("/") ? path : "/" + path; // depends on control dependency: [if], data = [none]
}
context.register(WebStatFilter.class);
if (StringUtils.isNotBlank(username)) {
authorizeToken = UUID.randomUUID().toString().toUpperCase(); // depends on control dependency: [if], data = [none]
context.register(AuthorizationRequestFilter.class); // depends on control dependency: [if], data = [none]
}
context.register(new ModelProcessor() {
@Override
public ResourceModel processResourceModel(ResourceModel resourceModel, final Configuration configuration) {
ResourceModel.Builder resourceModelBuilder = new ResourceModel.Builder(resourceModel, false);
Resource.Builder resourceBuilder = Resource.builder(DsStatViewResource.class);
resourceBuilder.path(dsPath);
Resource resource = resourceBuilder.build();
resourceModelBuilder.addResource(resource);
return resourceModelBuilder.build();
}
@Override
public ResourceModel processSubResource(ResourceModel subResourceModel, Configuration configuration) {
return subResourceModel;
}
});
return true;
} }
|
public class class_name {
public Observable<ServiceResponseWithHeaders<Void, RunbookDraftPublishHeaders>> beginPublishWithServiceResponseAsync(String resourceGroupName, String automationAccountName, String runbookName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (automationAccountName == null) {
throw new IllegalArgumentException("Parameter automationAccountName is required and cannot be null.");
}
if (runbookName == null) {
throw new IllegalArgumentException("Parameter runbookName is required and cannot be null.");
}
final String apiVersion = "2015-10-31";
return service.beginPublish(this.client.subscriptionId(), resourceGroupName, automationAccountName, runbookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, RunbookDraftPublishHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Void, RunbookDraftPublishHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<Void, RunbookDraftPublishHeaders> clientResponse = beginPublishDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponseWithHeaders<Void, RunbookDraftPublishHeaders>> beginPublishWithServiceResponseAsync(String resourceGroupName, String automationAccountName, String runbookName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (automationAccountName == null) {
throw new IllegalArgumentException("Parameter automationAccountName is required and cannot be null.");
}
if (runbookName == null) {
throw new IllegalArgumentException("Parameter runbookName is required and cannot be null.");
}
final String apiVersion = "2015-10-31";
return service.beginPublish(this.client.subscriptionId(), resourceGroupName, automationAccountName, runbookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, RunbookDraftPublishHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Void, RunbookDraftPublishHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<Void, RunbookDraftPublishHeaders> clientResponse = beginPublishDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
static public void configureCfRenaming(Configuration conf,
Map<String, String> renameMap) {
StringBuilder sb = new StringBuilder();
for(Map.Entry<String,String> entry: renameMap.entrySet()) {
String sourceCf = entry.getKey();
String destCf = entry.getValue();
if(sourceCf.contains(":") || sourceCf.contains(",") ||
destCf.contains(":") || destCf.contains(",")) {
throw new IllegalArgumentException("Illegal character in CF names: "
+ sourceCf + ", " + destCf);
}
if(sb.length() != 0) {
sb.append(",");
}
sb.append(sourceCf + ":" + destCf);
}
conf.set(CF_RENAME_PROP, sb.toString());
} }
|
public class class_name {
static public void configureCfRenaming(Configuration conf,
Map<String, String> renameMap) {
StringBuilder sb = new StringBuilder();
for(Map.Entry<String,String> entry: renameMap.entrySet()) {
String sourceCf = entry.getKey();
String destCf = entry.getValue();
if(sourceCf.contains(":") || sourceCf.contains(",") ||
destCf.contains(":") || destCf.contains(",")) {
throw new IllegalArgumentException("Illegal character in CF names: "
+ sourceCf + ", " + destCf);
}
if(sb.length() != 0) {
sb.append(","); // depends on control dependency: [if], data = [none]
}
sb.append(sourceCf + ":" + destCf); // depends on control dependency: [for], data = [none]
}
conf.set(CF_RENAME_PROP, sb.toString());
} }
|
public class class_name {
public int drainTo(Collection<? super Task> c)
{
if (c == this)
throw new IllegalArgumentException("cannot drain task set into itself");
if (c == null)
throw new NullPointerException("target collection must not be null");
int count = 0;
while (true)
{
try
{
Task t = this.poll(0, TimeUnit.SECONDS);
if (t == null)
break;
else
c.add(t);
}
catch (InterruptedException e)
{
break;
}
}
return count;
} }
|
public class class_name {
public int drainTo(Collection<? super Task> c)
{
if (c == this)
throw new IllegalArgumentException("cannot drain task set into itself");
if (c == null)
throw new NullPointerException("target collection must not be null");
int count = 0;
while (true)
{
try
{
Task t = this.poll(0, TimeUnit.SECONDS);
if (t == null)
break;
else
c.add(t);
}
catch (InterruptedException e)
{
break;
}
// depends on control dependency: [catch], data = [none]
}
return count;
} }
|
public class class_name {
private static void processEmoticonsToRegex() {
List<String> emoticons=new ArrayList<String>();
for(Emoji e: emojiData) {
if(e.getEmoticons()!=null) {
emoticons.addAll(e.getEmoticons());
}
}
//List of emotions should be pre-processed to handle instances of subtrings like :-) :-
//Without this pre-processing, emoticons in a string won't be processed properly
for(int i=0;i<emoticons.size();i++) {
for(int j=i+1;j<emoticons.size();j++) {
String o1=emoticons.get(i);
String o2=emoticons.get(j);
if(o2.contains(o1)) {
String temp = o2;
emoticons.remove(j);
emoticons.add(i, temp);
}
}
}
StringBuilder sb=new StringBuilder();
for(String emoticon: emoticons) {
if(sb.length() !=0) {
sb.append("|");
}
sb.append(Pattern.quote(emoticon));
}
emoticonRegexPattern = Pattern.compile(sb.toString());
} }
|
public class class_name {
private static void processEmoticonsToRegex() {
List<String> emoticons=new ArrayList<String>();
for(Emoji e: emojiData) {
if(e.getEmoticons()!=null) {
emoticons.addAll(e.getEmoticons()); // depends on control dependency: [if], data = [(e.getEmoticons()]
}
}
//List of emotions should be pre-processed to handle instances of subtrings like :-) :-
//Without this pre-processing, emoticons in a string won't be processed properly
for(int i=0;i<emoticons.size();i++) {
for(int j=i+1;j<emoticons.size();j++) {
String o1=emoticons.get(i);
String o2=emoticons.get(j);
if(o2.contains(o1)) {
String temp = o2;
emoticons.remove(j); // depends on control dependency: [if], data = [none]
emoticons.add(i, temp); // depends on control dependency: [if], data = [none]
}
}
}
StringBuilder sb=new StringBuilder();
for(String emoticon: emoticons) {
if(sb.length() !=0) {
sb.append("|"); // depends on control dependency: [if], data = [none]
}
sb.append(Pattern.quote(emoticon)); // depends on control dependency: [for], data = [emoticon]
}
emoticonRegexPattern = Pattern.compile(sb.toString());
} }
|
public class class_name {
private void updateMaxExtent() {
if (targetMap.getMapModel().isInitialized() && getGraphics().isReady()) {
// map view size may not have been set yet !
getMapModel().getMapView().setSize(getWidth(), getHeight());
Bbox targetMaxBounds = getOverviewMaxBounds();
MapView mapView = getMapModel().getMapView();
// Set the maxBounds on this map as well:
mapView.setMaxBounds(targetMaxBounds.buffer(targetMaxBounds.getWidth()));
// apply buffer
if (maxExtentIncreasePercentage > 0) {
targetMaxBounds = targetMaxBounds
.buffer(targetMaxBounds.getWidth() * maxExtentIncreasePercentage / 100);
}
// Then apply the map extent:
mapView.applyBounds(targetMaxBounds, MapView.ZoomOption.LEVEL_FIT);
// Immediately draw or remove the max extent rectangle:
setDrawTargetMaxExtent(drawTargetMaxExtent);
}
} }
|
public class class_name {
private void updateMaxExtent() {
if (targetMap.getMapModel().isInitialized() && getGraphics().isReady()) {
// map view size may not have been set yet !
getMapModel().getMapView().setSize(getWidth(), getHeight()); // depends on control dependency: [if], data = [none]
Bbox targetMaxBounds = getOverviewMaxBounds();
MapView mapView = getMapModel().getMapView();
// Set the maxBounds on this map as well:
mapView.setMaxBounds(targetMaxBounds.buffer(targetMaxBounds.getWidth())); // depends on control dependency: [if], data = [none]
// apply buffer
if (maxExtentIncreasePercentage > 0) {
targetMaxBounds = targetMaxBounds
.buffer(targetMaxBounds.getWidth() * maxExtentIncreasePercentage / 100); // depends on control dependency: [if], data = [none]
}
// Then apply the map extent:
mapView.applyBounds(targetMaxBounds, MapView.ZoomOption.LEVEL_FIT); // depends on control dependency: [if], data = [none]
// Immediately draw or remove the max extent rectangle:
setDrawTargetMaxExtent(drawTargetMaxExtent); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void compose(StylesheetRoot sroot) throws TransformerException
{
super.compose(sroot);
// Call compose on each param no matter if this is apply-templates
// or call templates.
int length = getParamElemCount();
for (int i = 0; i < length; i++)
{
ElemWithParam ewp = getParamElem(i);
ewp.compose(sroot);
}
if ((null != m_templateName) && (null == m_template)) {
m_template =
this.getStylesheetRoot().getTemplateComposed(m_templateName);
if (null == m_template) {
String themsg =
XSLMessages.createMessage(
XSLTErrorResources.ER_ELEMTEMPLATEELEM_ERR,
new Object[] { m_templateName });
throw new TransformerException(themsg, this);
//"Could not find template named: '"+templateName+"'");
}
length = getParamElemCount();
for (int i = 0; i < length; i++)
{
ElemWithParam ewp = getParamElem(i);
ewp.m_index = -1;
// Find the position of the param in the template being called,
// and set the index of the param slot.
int etePos = 0;
for (ElemTemplateElement ete = m_template.getFirstChildElem();
null != ete; ete = ete.getNextSiblingElem())
{
if(ete.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE)
{
ElemParam ep = (ElemParam)ete;
if(ep.getName().equals(ewp.getName()))
{
ewp.m_index = etePos;
}
}
else
break;
etePos++;
}
}
}
} }
|
public class class_name {
public void compose(StylesheetRoot sroot) throws TransformerException
{
super.compose(sroot);
// Call compose on each param no matter if this is apply-templates
// or call templates.
int length = getParamElemCount();
for (int i = 0; i < length; i++)
{
ElemWithParam ewp = getParamElem(i);
ewp.compose(sroot);
}
if ((null != m_templateName) && (null == m_template)) {
m_template =
this.getStylesheetRoot().getTemplateComposed(m_templateName);
if (null == m_template) {
String themsg =
XSLMessages.createMessage(
XSLTErrorResources.ER_ELEMTEMPLATEELEM_ERR,
new Object[] { m_templateName });
throw new TransformerException(themsg, this);
//"Could not find template named: '"+templateName+"'");
}
length = getParamElemCount();
for (int i = 0; i < length; i++)
{
ElemWithParam ewp = getParamElem(i);
ewp.m_index = -1; // depends on control dependency: [for], data = [none]
// Find the position of the param in the template being called,
// and set the index of the param slot.
int etePos = 0;
for (ElemTemplateElement ete = m_template.getFirstChildElem();
null != ete; ete = ete.getNextSiblingElem())
{
if(ete.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE)
{
ElemParam ep = (ElemParam)ete;
if(ep.getName().equals(ewp.getName()))
{
ewp.m_index = etePos; // depends on control dependency: [if], data = [none]
}
}
else
break;
etePos++; // depends on control dependency: [for], data = [none]
}
}
}
} }
|
public class class_name {
public static void writeMemoryCrashDump(@NonNull Model net, @NonNull Throwable e){
if(!crashDumpsEnabled){
return;
}
long now = System.currentTimeMillis();
long tid = Thread.currentThread().getId(); //Also add thread ID to avoid name clashes (parallel wrapper, etc)
String threadName = Thread.currentThread().getName();
crashDumpRootDirectory.mkdirs();
File f = new File(crashDumpRootDirectory, "dl4j-memory-crash-dump-" + now + "_" + tid + ".txt");
StringBuilder sb = new StringBuilder();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
sb.append("Deeplearning4j OOM Exception Encountered for ").append(net.getClass().getSimpleName()).append("\n")
.append(f("Timestamp: ", sdf.format(now)))
.append(f("Thread ID", tid))
.append(f("Thread Name", threadName))
.append("\n\n");
sb.append("Stack Trace:\n")
.append(ExceptionUtils.getStackTrace(e));
try{
sb.append("\n\n");
sb.append(generateMemoryStatus(net, -1, (InputType[])null));
} catch (Throwable t){
sb.append("<Error generating network memory status information section>")
.append(ExceptionUtils.getStackTrace(t));
}
String toWrite = sb.toString();
try{
FileUtils.writeStringToFile(f, toWrite);
} catch (IOException e2){
log.error("Error writing memory crash dump information to disk: {}", f.getAbsolutePath(), e2);
}
log.error(">>> Out of Memory Exception Detected. Memory crash dump written to: {}", f.getAbsolutePath());
log.warn("Memory crash dump reporting can be disabled with CrashUtil.crashDumpsEnabled(false) or using system " +
"property -D" + DL4JSystemProperties.CRASH_DUMP_ENABLED_PROPERTY + "=false");
log.warn("Memory crash dump reporting output location can be set with CrashUtil.crashDumpOutputDirectory(File) or using system " +
"property -D" + DL4JSystemProperties.CRASH_DUMP_OUTPUT_DIRECTORY_PROPERTY + "=<path>");
} }
|
public class class_name {
public static void writeMemoryCrashDump(@NonNull Model net, @NonNull Throwable e){
if(!crashDumpsEnabled){
return; // depends on control dependency: [if], data = [none]
}
long now = System.currentTimeMillis();
long tid = Thread.currentThread().getId(); //Also add thread ID to avoid name clashes (parallel wrapper, etc)
String threadName = Thread.currentThread().getName();
crashDumpRootDirectory.mkdirs();
File f = new File(crashDumpRootDirectory, "dl4j-memory-crash-dump-" + now + "_" + tid + ".txt");
StringBuilder sb = new StringBuilder();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
sb.append("Deeplearning4j OOM Exception Encountered for ").append(net.getClass().getSimpleName()).append("\n")
.append(f("Timestamp: ", sdf.format(now)))
.append(f("Thread ID", tid))
.append(f("Thread Name", threadName))
.append("\n\n");
sb.append("Stack Trace:\n")
.append(ExceptionUtils.getStackTrace(e));
try{
sb.append("\n\n");
sb.append(generateMemoryStatus(net, -1, (InputType[])null));
} catch (Throwable t){
sb.append("<Error generating network memory status information section>")
.append(ExceptionUtils.getStackTrace(t));
}
String toWrite = sb.toString();
try{
FileUtils.writeStringToFile(f, toWrite);
} catch (IOException e2){
log.error("Error writing memory crash dump information to disk: {}", f.getAbsolutePath(), e2);
}
log.error(">>> Out of Memory Exception Detected. Memory crash dump written to: {}", f.getAbsolutePath());
log.warn("Memory crash dump reporting can be disabled with CrashUtil.crashDumpsEnabled(false) or using system " +
"property -D" + DL4JSystemProperties.CRASH_DUMP_ENABLED_PROPERTY + "=false");
log.warn("Memory crash dump reporting output location can be set with CrashUtil.crashDumpOutputDirectory(File) or using system " +
"property -D" + DL4JSystemProperties.CRASH_DUMP_OUTPUT_DIRECTORY_PROPERTY + "=<path>");
} }
|
public class class_name {
public static Map<String, Criteria> constructCriteriaMap(Collection<Criteria> aCriterias)
{
if (aCriterias == null)
return null;
Map<String, Criteria> map = new HashMap<String, Criteria>(aCriterias.size());
Criteria criteria = null;
for (Iterator<Criteria> i = aCriterias.iterator(); i.hasNext();)
{
criteria = (Criteria) i.next();
map.put(criteria.getId(), criteria);
}
return map;
} }
|
public class class_name {
public static Map<String, Criteria> constructCriteriaMap(Collection<Criteria> aCriterias)
{
if (aCriterias == null)
return null;
Map<String, Criteria> map = new HashMap<String, Criteria>(aCriterias.size());
Criteria criteria = null;
for (Iterator<Criteria> i = aCriterias.iterator(); i.hasNext();)
{
criteria = (Criteria) i.next();
// depends on control dependency: [for], data = [i]
map.put(criteria.getId(), criteria);
// depends on control dependency: [for], data = [none]
}
return map;
} }
|
public class class_name {
@Override
public EClass getIfcMaterialLayerSetUsage() {
if (ifcMaterialLayerSetUsageEClass == null) {
ifcMaterialLayerSetUsageEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(364);
}
return ifcMaterialLayerSetUsageEClass;
} }
|
public class class_name {
@Override
public EClass getIfcMaterialLayerSetUsage() {
if (ifcMaterialLayerSetUsageEClass == null) {
ifcMaterialLayerSetUsageEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(364);
// depends on control dependency: [if], data = [none]
}
return ifcMaterialLayerSetUsageEClass;
} }
|
public class class_name {
public GetFolderResult withSubModules(SubModule... subModules) {
if (this.subModules == null) {
setSubModules(new java.util.ArrayList<SubModule>(subModules.length));
}
for (SubModule ele : subModules) {
this.subModules.add(ele);
}
return this;
} }
|
public class class_name {
public GetFolderResult withSubModules(SubModule... subModules) {
if (this.subModules == null) {
setSubModules(new java.util.ArrayList<SubModule>(subModules.length)); // depends on control dependency: [if], data = [none]
}
for (SubModule ele : subModules) {
this.subModules.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static String elementText(Element parentElement) {
if (parentElement == null) {
return null;
}
StringBuilder result = new StringBuilder();
NodeList childNodes = parentElement.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node node = childNodes.item(i);
if ((node == null) ||
(node.getNodeType() != Node.TEXT_NODE)) {
continue;
}
result.append(((Text) node).getData());
}
return result.toString().trim();
} }
|
public class class_name {
public static String elementText(Element parentElement) {
if (parentElement == null) {
return null; // depends on control dependency: [if], data = [none]
}
StringBuilder result = new StringBuilder();
NodeList childNodes = parentElement.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node node = childNodes.item(i);
if ((node == null) ||
(node.getNodeType() != Node.TEXT_NODE)) {
continue;
}
result.append(((Text) node).getData()); // depends on control dependency: [for], data = [none]
}
return result.toString().trim();
} }
|
public class class_name {
protected boolean taskStarted()
{
try
{
task.started(getElapsedTime());
return true;
}
catch (Throwable t)
{
log.warn("Unexpected error during 'started' for task: " + taskString, t);
return false;
}
} }
|
public class class_name {
protected boolean taskStarted()
{
try
{
task.started(getElapsedTime()); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
}
catch (Throwable t)
{
log.warn("Unexpected error during 'started' for task: " + taskString, t);
return false;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public int compareMethods(BugCollection lhsCollection, BugCollection rhsCollection, MethodAnnotation lhsMethod,
MethodAnnotation rhsMethod) {
if (lhsMethod == null || rhsMethod == null) {
return compareNullElements(lhsMethod, rhsMethod);
}
// Compare for exact match
int cmp = lhsMethod.compareTo(rhsMethod);
return cmp;
} }
|
public class class_name {
public int compareMethods(BugCollection lhsCollection, BugCollection rhsCollection, MethodAnnotation lhsMethod,
MethodAnnotation rhsMethod) {
if (lhsMethod == null || rhsMethod == null) {
return compareNullElements(lhsMethod, rhsMethod); // depends on control dependency: [if], data = [(lhsMethod]
}
// Compare for exact match
int cmp = lhsMethod.compareTo(rhsMethod);
return cmp;
} }
|
public class class_name {
@Override
public List<MutateRowsResponse> mutateRows(MutateRowsRequest request) {
if (shouldOverrideAppProfile(request.getAppProfileId())) {
request = request.toBuilder().setAppProfileId(clientDefaultAppProfileId).build();
}
return createMutateRowsOperation(request).getBlockingResult();
} }
|
public class class_name {
@Override
public List<MutateRowsResponse> mutateRows(MutateRowsRequest request) {
if (shouldOverrideAppProfile(request.getAppProfileId())) {
request = request.toBuilder().setAppProfileId(clientDefaultAppProfileId).build(); // depends on control dependency: [if], data = [none]
}
return createMutateRowsOperation(request).getBlockingResult();
} }
|
public class class_name {
protected void emitWithOnlyKey(StreamMessage message, Object messageKey)
{
if (this.recordHistory)
{
message.getHeader().addHistory(messageKey.toString());
}
this.getCollector().emit(new Values("", message));
} }
|
public class class_name {
protected void emitWithOnlyKey(StreamMessage message, Object messageKey)
{
if (this.recordHistory)
{
message.getHeader().addHistory(messageKey.toString()); // depends on control dependency: [if], data = [none]
}
this.getCollector().emit(new Values("", message));
} }
|
public class class_name {
public BlockOrder setBlockOrder(BlockOrder order) {
verifyTrue(order != null, "block order cannot be null");
if (order == layout.blockOrder) {
return order; // quick exit, already same
}
BlockMatrixLayout newLayout = new BlockMatrixLayout(layout.rows, layout.columns,
layout.blockStripe, order);
// swap order of each block
for (int r = 0; r < layout.rows; r += layout.blockStripe) {
for (int c = 0; c < layout.columns; c += layout.blockStripe) {
int blockNumber = layout.getBlockNumber(r, c);
if (data[blockNumber] == null) {
continue;
} else if (order == BlockOrder.ROWMAJOR) {
data[blockNumber] = layout.toRowMajorBlock(data[blockNumber], r, c);
} else {
data[blockNumber] = layout.toColMajorBlock(data[blockNumber], r, c);
}
}
}
BlockOrder oldLayout = this.layout.blockOrder;
this.layout = newLayout;
return oldLayout;
} }
|
public class class_name {
public BlockOrder setBlockOrder(BlockOrder order) {
verifyTrue(order != null, "block order cannot be null");
if (order == layout.blockOrder) {
return order; // quick exit, already same
// depends on control dependency: [if], data = [none]
}
BlockMatrixLayout newLayout = new BlockMatrixLayout(layout.rows, layout.columns,
layout.blockStripe, order);
// swap order of each block
for (int r = 0; r < layout.rows; r += layout.blockStripe) {
for (int c = 0; c < layout.columns; c += layout.blockStripe) {
int blockNumber = layout.getBlockNumber(r, c);
if (data[blockNumber] == null) {
continue;
} else if (order == BlockOrder.ROWMAJOR) {
data[blockNumber] = layout.toRowMajorBlock(data[blockNumber], r, c);
// depends on control dependency: [if], data = [none]
} else {
data[blockNumber] = layout.toColMajorBlock(data[blockNumber], r, c);
// depends on control dependency: [if], data = [none]
}
}
}
BlockOrder oldLayout = this.layout.blockOrder;
this.layout = newLayout;
return oldLayout;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T extends HalRepresentation> Stream<T> streamAs(final Class<T> type,
final EmbeddedTypeInfo embeddedTypeInfo,
final EmbeddedTypeInfo... moreEmbeddedTypeInfos) throws IOException {
if (moreEmbeddedTypeInfos == null || moreEmbeddedTypeInfos.length == 0) {
return streamAs(type, embeddedTypeInfo != null ? singletonList(embeddedTypeInfo) : emptyList());
} else {
final List<EmbeddedTypeInfo> typeInfos = new ArrayList<>();
typeInfos.add(requireNonNull(embeddedTypeInfo));
typeInfos.addAll(asList(moreEmbeddedTypeInfos));
return streamAs(type, typeInfos);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T extends HalRepresentation> Stream<T> streamAs(final Class<T> type,
final EmbeddedTypeInfo embeddedTypeInfo,
final EmbeddedTypeInfo... moreEmbeddedTypeInfos) throws IOException {
if (moreEmbeddedTypeInfos == null || moreEmbeddedTypeInfos.length == 0) {
return streamAs(type, embeddedTypeInfo != null ? singletonList(embeddedTypeInfo) : emptyList()); // depends on control dependency: [if], data = [none]
} else {
final List<EmbeddedTypeInfo> typeInfos = new ArrayList<>();
typeInfos.add(requireNonNull(embeddedTypeInfo)); // depends on control dependency: [if], data = [none]
typeInfos.addAll(asList(moreEmbeddedTypeInfos)); // depends on control dependency: [if], data = [(moreEmbeddedTypeInfos]
return streamAs(type, typeInfos); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public CtClass getCtClass() {
if (ctClass == null && fileName.endsWith(".class")) {
try {
ctClass = ClassPool.getDefault().makeClass(getFileStream());
} catch (IOException e) {
logger.error("make class error", e);
}
}
return ctClass;
} }
|
public class class_name {
public CtClass getCtClass() {
if (ctClass == null && fileName.endsWith(".class")) {
try {
ctClass = ClassPool.getDefault().makeClass(getFileStream()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.error("make class error", e);
} // depends on control dependency: [catch], data = [none]
}
return ctClass;
} }
|
public class class_name {
public void marshall(UpdateExpirationForHITRequest updateExpirationForHITRequest, ProtocolMarshaller protocolMarshaller) {
if (updateExpirationForHITRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateExpirationForHITRequest.getHITId(), HITID_BINDING);
protocolMarshaller.marshall(updateExpirationForHITRequest.getExpireAt(), EXPIREAT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(UpdateExpirationForHITRequest updateExpirationForHITRequest, ProtocolMarshaller protocolMarshaller) {
if (updateExpirationForHITRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateExpirationForHITRequest.getHITId(), HITID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateExpirationForHITRequest.getExpireAt(), EXPIREAT_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static double elementMax( DMatrixSparseCSC A ) {
if( A.nz_length == 0)
return 0;
// if every element is assigned a value then the first element can be a max.
// Otherwise zero needs to be considered
double max = A.isFull() ? A.nz_values[0] : 0;
for(int i = 0; i < A.nz_length; i++ ) {
double val = A.nz_values[i];
if( val > max ) {
max = val;
}
}
return max;
} }
|
public class class_name {
public static double elementMax( DMatrixSparseCSC A ) {
if( A.nz_length == 0)
return 0;
// if every element is assigned a value then the first element can be a max.
// Otherwise zero needs to be considered
double max = A.isFull() ? A.nz_values[0] : 0;
for(int i = 0; i < A.nz_length; i++ ) {
double val = A.nz_values[i];
if( val > max ) {
max = val; // depends on control dependency: [if], data = [none]
}
}
return max;
} }
|
public class class_name {
static long getTotalMaxUsage(Map<String, MemoryUsage> usages) {
long sum = 0L;
for (Map.Entry<String, MemoryUsage> e : usages.entrySet()) {
long max = e.getValue().getMax();
if (max > 0) {
sum += e.getValue().getMax();
}
}
return sum;
} }
|
public class class_name {
static long getTotalMaxUsage(Map<String, MemoryUsage> usages) {
long sum = 0L;
for (Map.Entry<String, MemoryUsage> e : usages.entrySet()) {
long max = e.getValue().getMax();
if (max > 0) {
sum += e.getValue().getMax(); // depends on control dependency: [if], data = [none]
}
}
return sum;
} }
|
public class class_name {
private static void checkNesting(final BooleanExpression expression,
final List<BooleanExpression> visitedExpressions) {
if (visitedExpressions.contains(expression)) {
// Unfortunately, we can't give much more information - even calling toString() will overflow the stack.
throw new SyntaxException("An expression can not contain itself.");
}
visitedExpressions.add(expression);
if (expression instanceof GroupExpression) {
GroupExpression group = (GroupExpression) expression;
for (BooleanExpression operand : group.getOperands()) {
checkNesting(operand, visitedExpressions);
}
}
} }
|
public class class_name {
private static void checkNesting(final BooleanExpression expression,
final List<BooleanExpression> visitedExpressions) {
if (visitedExpressions.contains(expression)) {
// Unfortunately, we can't give much more information - even calling toString() will overflow the stack.
throw new SyntaxException("An expression can not contain itself.");
}
visitedExpressions.add(expression);
if (expression instanceof GroupExpression) {
GroupExpression group = (GroupExpression) expression;
for (BooleanExpression operand : group.getOperands()) {
checkNesting(operand, visitedExpressions); // depends on control dependency: [for], data = [operand]
}
}
} }
|
public class class_name {
public static void registerApplicationNodeInCollectServer(String applicationName,
URL collectServerUrl, URL applicationNodeUrl) {
if (collectServerUrl == null || applicationNodeUrl == null) {
throw new IllegalArgumentException(
"collectServerUrl and applicationNodeUrl must not be null");
}
final String appName;
if (applicationName == null) {
appName = Parameters.getCurrentApplication();
} else {
appName = applicationName;
}
final URL registerUrl;
try {
registerUrl = new URL(collectServerUrl.toExternalForm() + "?appName="
+ URLEncoder.encode(appName, "UTF-8") + "&appUrls="
// "UTF-8" as said in javadoc
+ URLEncoder.encode(applicationNodeUrl.toExternalForm(), "UTF-8")
+ "&action=registerNode");
unregisterApplicationNodeInCollectServerUrl = new URL(
registerUrl.toExternalForm().replace("registerNode", "unregisterNode"));
} catch (final IOException e) {
// can't happen if urls are ok
throw new IllegalArgumentException(e);
}
// this is an asynchronous call because if this method is called when the webapp is starting,
// the webapp can not respond to the collect server for the first collect of data
final Thread thread = new Thread("javamelody registerApplicationNodeInCollectServer") {
@Override
public void run() {
try {
Thread.sleep(10000);
} catch (final InterruptedException e) {
throw new IllegalStateException(e);
}
try {
new LabradorRetriever(registerUrl).post(null);
LOG.info("application node added to the collect server");
} catch (final IOException e) {
LOG.warn("Unable to register application's node in the collect server ( " + e
+ ')', e);
}
}
};
thread.setDaemon(true);
thread.start();
} }
|
public class class_name {
public static void registerApplicationNodeInCollectServer(String applicationName,
URL collectServerUrl, URL applicationNodeUrl) {
if (collectServerUrl == null || applicationNodeUrl == null) {
throw new IllegalArgumentException(
"collectServerUrl and applicationNodeUrl must not be null");
}
final String appName;
if (applicationName == null) {
appName = Parameters.getCurrentApplication();
// depends on control dependency: [if], data = [none]
} else {
appName = applicationName;
// depends on control dependency: [if], data = [none]
}
final URL registerUrl;
try {
registerUrl = new URL(collectServerUrl.toExternalForm() + "?appName="
+ URLEncoder.encode(appName, "UTF-8") + "&appUrls="
// "UTF-8" as said in javadoc
+ URLEncoder.encode(applicationNodeUrl.toExternalForm(), "UTF-8")
+ "&action=registerNode");
// depends on control dependency: [try], data = [none]
unregisterApplicationNodeInCollectServerUrl = new URL(
registerUrl.toExternalForm().replace("registerNode", "unregisterNode"));
// depends on control dependency: [try], data = [none]
} catch (final IOException e) {
// can't happen if urls are ok
throw new IllegalArgumentException(e);
}
// depends on control dependency: [catch], data = [none]
// this is an asynchronous call because if this method is called when the webapp is starting,
// the webapp can not respond to the collect server for the first collect of data
final Thread thread = new Thread("javamelody registerApplicationNodeInCollectServer") {
@Override
public void run() {
try {
Thread.sleep(10000);
// depends on control dependency: [try], data = [none]
} catch (final InterruptedException e) {
throw new IllegalStateException(e);
}
// depends on control dependency: [catch], data = [none]
try {
new LabradorRetriever(registerUrl).post(null);
// depends on control dependency: [try], data = [none]
LOG.info("application node added to the collect server");
// depends on control dependency: [try], data = [none]
} catch (final IOException e) {
LOG.warn("Unable to register application's node in the collect server ( " + e
+ ')', e);
}
// depends on control dependency: [catch], data = [none]
}
};
thread.setDaemon(true);
thread.start();
} }
|
public class class_name {
@Override
public int compareTo(SurvivalInfo o) {
// return (int) (this.time - o.time - (this.status - o.status) / 1024);
if (time < o.time) {
return -1;
} else if (time > o.time) {
return 1;
} else {
if (this.status == o.status) {
return 0;
} else if (status == 1) {
return -1;
} else {
return 1;
}
}
} }
|
public class class_name {
@Override
public int compareTo(SurvivalInfo o) {
// return (int) (this.time - o.time - (this.status - o.status) / 1024);
if (time < o.time) {
return -1; // depends on control dependency: [if], data = [none]
} else if (time > o.time) {
return 1; // depends on control dependency: [if], data = [none]
} else {
if (this.status == o.status) {
return 0; // depends on control dependency: [if], data = [none]
} else if (status == 1) {
return -1; // depends on control dependency: [if], data = [none]
} else {
return 1; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public List<ISO9660File> getFiles() {
List<ISO9660File> files = new ArrayList<ISO9660File>();
if (publisher instanceof ISO9660File) {
files.add((ISO9660File) publisher);
}
if (dataPreparer instanceof ISO9660File) {
files.add((ISO9660File) dataPreparer);
}
if (app instanceof ISO9660File) {
files.add((ISO9660File) app);
}
files.add(abstractFile);
files.add(bibFile);
files.add(copyrightFile);
return files;
} }
|
public class class_name {
public List<ISO9660File> getFiles() {
List<ISO9660File> files = new ArrayList<ISO9660File>();
if (publisher instanceof ISO9660File) {
files.add((ISO9660File) publisher); // depends on control dependency: [if], data = [none]
}
if (dataPreparer instanceof ISO9660File) {
files.add((ISO9660File) dataPreparer); // depends on control dependency: [if], data = [none]
}
if (app instanceof ISO9660File) {
files.add((ISO9660File) app); // depends on control dependency: [if], data = [none]
}
files.add(abstractFile);
files.add(bibFile);
files.add(copyrightFile);
return files;
} }
|
public class class_name {
@SuppressWarnings("checkstyle:npathcomplexity")
public void removeSREs(ISREInstall... sres) {
final ISREInstall defaultSRE = getDefaultSRE();
final String defaultId = defaultSRE == null ? null : defaultSRE.getId();
int defaultIndex = -1;
if (defaultId != null) {
for (int i = 0; defaultIndex == -1 && i < this.sreTable.getItemCount(); ++i) {
if (defaultId.equals(
((ISREInstall) this.sreTable.getItem(i).getData()).getId())) {
defaultIndex = i;
}
}
}
final String normedDefaultId = Strings.nullToEmpty(defaultId);
boolean defaultIsRemoved = false;
for (final ISREInstall sre : sres) {
if (this.sreArray.remove(sre) && sre.getId().equals(normedDefaultId)) {
defaultIsRemoved = true;
}
}
refreshSREListUI();
// Update the default SRE
if (defaultIsRemoved) {
if (this.sreTable.getItemCount() == 0) {
setSelection(null);
} else {
if (defaultIndex < 0) {
defaultIndex = 0;
} else if (defaultIndex >= this.sreTable.getItemCount()) {
defaultIndex = this.sreTable.getItemCount() - 1;
}
setSelection(new StructuredSelection(
this.sreTable.getItem(defaultIndex).getData()));
}
}
this.sresList.refresh(true);
if (defaultIsRemoved) {
fireDefaultSREChanged();
}
updateUI();
} }
|
public class class_name {
@SuppressWarnings("checkstyle:npathcomplexity")
public void removeSREs(ISREInstall... sres) {
final ISREInstall defaultSRE = getDefaultSRE();
final String defaultId = defaultSRE == null ? null : defaultSRE.getId();
int defaultIndex = -1;
if (defaultId != null) {
for (int i = 0; defaultIndex == -1 && i < this.sreTable.getItemCount(); ++i) {
if (defaultId.equals(
((ISREInstall) this.sreTable.getItem(i).getData()).getId())) {
defaultIndex = i; // depends on control dependency: [if], data = [none]
}
}
}
final String normedDefaultId = Strings.nullToEmpty(defaultId);
boolean defaultIsRemoved = false;
for (final ISREInstall sre : sres) {
if (this.sreArray.remove(sre) && sre.getId().equals(normedDefaultId)) {
defaultIsRemoved = true; // depends on control dependency: [if], data = [none]
}
}
refreshSREListUI();
// Update the default SRE
if (defaultIsRemoved) {
if (this.sreTable.getItemCount() == 0) {
setSelection(null); // depends on control dependency: [if], data = [none]
} else {
if (defaultIndex < 0) {
defaultIndex = 0; // depends on control dependency: [if], data = [none]
} else if (defaultIndex >= this.sreTable.getItemCount()) {
defaultIndex = this.sreTable.getItemCount() - 1; // depends on control dependency: [if], data = [none]
}
setSelection(new StructuredSelection(
this.sreTable.getItem(defaultIndex).getData())); // depends on control dependency: [if], data = [none]
}
}
this.sresList.refresh(true);
if (defaultIsRemoved) {
fireDefaultSREChanged(); // depends on control dependency: [if], data = [none]
}
updateUI();
} }
|
public class class_name {
public static Object[] getAt(TableModel self, int index) {
int cols = self.getColumnCount();
Object[] rowData = new Object[cols];
for (int col = 0; col < cols; col++) {
rowData[col] = self.getValueAt(index, col);
}
return rowData;
} }
|
public class class_name {
public static Object[] getAt(TableModel self, int index) {
int cols = self.getColumnCount();
Object[] rowData = new Object[cols];
for (int col = 0; col < cols; col++) {
rowData[col] = self.getValueAt(index, col); // depends on control dependency: [for], data = [col]
}
return rowData;
} }
|
public class class_name {
public static boolean appearsToBeValidDDLBatch(String batch) {
BufferedReader reader = new BufferedReader(new StringReader(batch));
String line;
try {
while ((line = reader.readLine()) != null) {
if (isWholeLineComment(line)) {
continue;
}
line = line.trim();
if (line.equals(""))
continue;
// we have a non-blank line that contains more than just a comment.
return queryIsDDL(line);
}
}
catch (IOException e) {
// This should never happen for a StringReader
assert(false);
}
// trivial empty batch: no lines are non-blank or non-comments
return true;
} }
|
public class class_name {
public static boolean appearsToBeValidDDLBatch(String batch) {
BufferedReader reader = new BufferedReader(new StringReader(batch));
String line;
try {
while ((line = reader.readLine()) != null) {
if (isWholeLineComment(line)) {
continue;
}
line = line.trim(); // depends on control dependency: [while], data = [none]
if (line.equals(""))
continue;
// we have a non-blank line that contains more than just a comment.
return queryIsDDL(line); // depends on control dependency: [while], data = [none]
}
}
catch (IOException e) {
// This should never happen for a StringReader
assert(false);
} // depends on control dependency: [catch], data = [none]
// trivial empty batch: no lines are non-blank or non-comments
return true;
} }
|
public class class_name {
static MessageType mergeInto(MessageType toMerge, MessageType mergedSchema, boolean strict) {
if (mergedSchema == null) {
return toMerge;
}
return mergedSchema.union(toMerge, strict);
} }
|
public class class_name {
static MessageType mergeInto(MessageType toMerge, MessageType mergedSchema, boolean strict) {
if (mergedSchema == null) {
return toMerge; // depends on control dependency: [if], data = [none]
}
return mergedSchema.union(toMerge, strict);
} }
|
public class class_name {
@Override
public long until(Temporal endExclusive, TemporalUnit unit) {
ZonedDateTime end = ZonedDateTime.from(endExclusive);
if (unit instanceof ChronoUnit) {
end = end.withZoneSameInstant(zone);
if (unit.isDateBased()) {
return dateTime.until(end.dateTime, unit);
} else {
return toOffsetDateTime().until(end.toOffsetDateTime(), unit);
}
}
return unit.between(this, end);
} }
|
public class class_name {
@Override
public long until(Temporal endExclusive, TemporalUnit unit) {
ZonedDateTime end = ZonedDateTime.from(endExclusive);
if (unit instanceof ChronoUnit) {
end = end.withZoneSameInstant(zone); // depends on control dependency: [if], data = [none]
if (unit.isDateBased()) {
return dateTime.until(end.dateTime, unit); // depends on control dependency: [if], data = [none]
} else {
return toOffsetDateTime().until(end.toOffsetDateTime(), unit); // depends on control dependency: [if], data = [none]
}
}
return unit.between(this, end);
} }
|
public class class_name {
protected ContextSelectComboBox getContextSelectComboBox() {
if (contextSelectBox == null) {
contextSelectBox = new ContextSelectComboBox();
contextSelectBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
contextSelected((Context) contextSelectBox.getSelectedItem());
}
});
}
return contextSelectBox;
} }
|
public class class_name {
protected ContextSelectComboBox getContextSelectComboBox() {
if (contextSelectBox == null) {
contextSelectBox = new ContextSelectComboBox(); // depends on control dependency: [if], data = [none]
contextSelectBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
contextSelected((Context) contextSelectBox.getSelectedItem());
}
}); // depends on control dependency: [if], data = [none]
}
return contextSelectBox;
} }
|
public class class_name {
@Override
public List<TargetWrapperDescriptor> listPossibleTargets( AbstractApplication app ) {
// Find the matching targets based on registered hints
String key = new InstanceContext( app ).toString();
String tplKey = null;
if( app instanceof Application )
tplKey = new InstanceContext(((Application) app).getTemplate()).toString();
List<File> targetDirectories = new ArrayList<> ();
File dir = new File( this.configurationMngr.getWorkingDirectory(), ConfigurationUtils.TARGETS );
for( File f : Utils.listDirectories( dir )) {
// If there is no hint for this target, then it is global.
// We can list it.
File hintsFile = new File( f, TARGETS_HINTS_FILE );
if( ! hintsFile.exists()) {
targetDirectories.add( f );
continue;
}
// Otherwise, the key must exist in the file
Properties props = Utils.readPropertiesFileQuietly( hintsFile, this.logger );
if( props.containsKey( key ))
targetDirectories.add( f );
else if( tplKey != null && props.containsKey( tplKey ))
targetDirectories.add( f );
}
// Build the result
return buildList( targetDirectories, app );
} }
|
public class class_name {
@Override
public List<TargetWrapperDescriptor> listPossibleTargets( AbstractApplication app ) {
// Find the matching targets based on registered hints
String key = new InstanceContext( app ).toString();
String tplKey = null;
if( app instanceof Application )
tplKey = new InstanceContext(((Application) app).getTemplate()).toString();
List<File> targetDirectories = new ArrayList<> ();
File dir = new File( this.configurationMngr.getWorkingDirectory(), ConfigurationUtils.TARGETS );
for( File f : Utils.listDirectories( dir )) {
// If there is no hint for this target, then it is global.
// We can list it.
File hintsFile = new File( f, TARGETS_HINTS_FILE );
if( ! hintsFile.exists()) {
targetDirectories.add( f ); // depends on control dependency: [if], data = [none]
continue;
}
// Otherwise, the key must exist in the file
Properties props = Utils.readPropertiesFileQuietly( hintsFile, this.logger );
if( props.containsKey( key ))
targetDirectories.add( f );
else if( tplKey != null && props.containsKey( tplKey ))
targetDirectories.add( f );
}
// Build the result
return buildList( targetDirectories, app );
} }
|
public class class_name {
@SuppressWarnings({"unchecked", "rawtypes"})
public static <T> Map<Key<T>, Class<? extends T>> resolveBindingDefinitions(Class<T> injecteeClass,
Class<? extends T> firstImplClass, Class<? extends T>... restImplClasses) {
Map<Key<T>, Class<? extends T>> typeLiterals = new HashMap<>();
List<Class<? extends T>> subClasses = new ArrayList<>();
if (firstImplClass != null) {
subClasses.add(firstImplClass);
}
if (restImplClasses != null && restImplClasses.length > 0) {
subClasses.addAll(Arrays.asList(restImplClasses));
}
for (Class<? extends T> subClass : subClasses) {
if (isBindable(subClass)) {
Type resolvedType = TypeToken.of(subClass).getSupertype((Class) injecteeClass).getType();
TypeLiteral<T> parentTypeLiteral;
if (resolvedType == null) {
parentTypeLiteral = TypeLiteral.get(injecteeClass);
} else {
parentTypeLiteral = (TypeLiteral<T>) TypeLiteral.get(resolvedType);
}
Optional<Annotation> qualifier = Annotations.on(subClass)
.traversingSuperclasses()
.traversingInterfaces()
.findAll()
.filter(AnnotationPredicates.annotationAnnotatedWith(Qualifier.class, false))
.findFirst();
Key<T> key = qualifier.map(annotation -> Key.get(parentTypeLiteral, annotation)).orElseGet(
() -> Key.get(parentTypeLiteral));
if (typeLiterals.containsKey(key)) {
throw SeedException.createNew(CoreErrorCode.DUPLICATED_BINDING_KEY)
.put("duplicatedKey", key)
.put("firstClass", subClass.getName())
.put("secondClass", typeLiterals.get(key).getName());
}
typeLiterals.put(key, subClass);
}
}
return typeLiterals;
} }
|
public class class_name {
@SuppressWarnings({"unchecked", "rawtypes"})
public static <T> Map<Key<T>, Class<? extends T>> resolveBindingDefinitions(Class<T> injecteeClass,
Class<? extends T> firstImplClass, Class<? extends T>... restImplClasses) {
Map<Key<T>, Class<? extends T>> typeLiterals = new HashMap<>();
List<Class<? extends T>> subClasses = new ArrayList<>();
if (firstImplClass != null) {
subClasses.add(firstImplClass); // depends on control dependency: [if], data = [(firstImplClass]
}
if (restImplClasses != null && restImplClasses.length > 0) {
subClasses.addAll(Arrays.asList(restImplClasses)); // depends on control dependency: [if], data = [(restImplClasses]
}
for (Class<? extends T> subClass : subClasses) {
if (isBindable(subClass)) {
Type resolvedType = TypeToken.of(subClass).getSupertype((Class) injecteeClass).getType();
TypeLiteral<T> parentTypeLiteral;
if (resolvedType == null) {
parentTypeLiteral = TypeLiteral.get(injecteeClass); // depends on control dependency: [if], data = [none]
} else {
parentTypeLiteral = (TypeLiteral<T>) TypeLiteral.get(resolvedType); // depends on control dependency: [if], data = [(resolvedType]
}
Optional<Annotation> qualifier = Annotations.on(subClass)
.traversingSuperclasses()
.traversingInterfaces()
.findAll()
.filter(AnnotationPredicates.annotationAnnotatedWith(Qualifier.class, false))
.findFirst();
Key<T> key = qualifier.map(annotation -> Key.get(parentTypeLiteral, annotation)).orElseGet(
() -> Key.get(parentTypeLiteral));
if (typeLiterals.containsKey(key)) {
throw SeedException.createNew(CoreErrorCode.DUPLICATED_BINDING_KEY)
.put("duplicatedKey", key)
.put("firstClass", subClass.getName())
.put("secondClass", typeLiterals.get(key).getName());
}
typeLiterals.put(key, subClass); // depends on control dependency: [if], data = [none]
}
}
return typeLiterals;
} }
|
public class class_name {
protected void optimizeSNE(AffinityMatrix pij, double[][] sol) {
final int size = pij.size();
if(size * 3L * dim > 0x7FFF_FFFAL) {
throw new AbortException("Memory exceeds Java array size limit.");
}
// Meta information on each point; joined for memory locality.
// Gradient, Momentum, and learning rate
// For performance, we use a flat memory layout!
double[] meta = new double[size * 3 * dim];
final int dim3 = dim * 3;
for(int off = 2 * dim; off < meta.length; off += dim3) {
Arrays.fill(meta, off, off + dim, 1.); // Initial learning rate
}
// Affinity matrix in projected space
double[][] qij = new double[size][size];
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Iterative Optimization", iterations, LOG) : null;
Duration timer = LOG.isStatistics() ? LOG.newDuration(this.getClass().getName() + ".runtime.optimization").begin() : null;
// Optimize
for(int it = 0; it < iterations; it++) {
double qij_sum = computeQij(qij, sol);
computeGradient(pij, qij, 1. / qij_sum, sol, meta);
updateSolution(sol, meta, it);
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
if(timer != null) {
LOG.statistics(timer.end());
}
} }
|
public class class_name {
protected void optimizeSNE(AffinityMatrix pij, double[][] sol) {
final int size = pij.size();
if(size * 3L * dim > 0x7FFF_FFFAL) {
throw new AbortException("Memory exceeds Java array size limit.");
}
// Meta information on each point; joined for memory locality.
// Gradient, Momentum, and learning rate
// For performance, we use a flat memory layout!
double[] meta = new double[size * 3 * dim];
final int dim3 = dim * 3;
for(int off = 2 * dim; off < meta.length; off += dim3) {
Arrays.fill(meta, off, off + dim, 1.); // Initial learning rate // depends on control dependency: [for], data = [off]
}
// Affinity matrix in projected space
double[][] qij = new double[size][size];
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Iterative Optimization", iterations, LOG) : null;
Duration timer = LOG.isStatistics() ? LOG.newDuration(this.getClass().getName() + ".runtime.optimization").begin() : null;
// Optimize
for(int it = 0; it < iterations; it++) {
double qij_sum = computeQij(qij, sol);
computeGradient(pij, qij, 1. / qij_sum, sol, meta);
updateSolution(sol, meta, it);
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
if(timer != null) {
LOG.statistics(timer.end());
}
} }
|
public class class_name {
static String[] splitOnTokens(String text)
{
// used by wildcardMatch
// package level so a unit test may run on this
if (text.indexOf('?') == -1 && text.indexOf('*') == -1)
{
return new String[]
{
text
};
}
char[] array = text.toCharArray();
ArrayList<String> list = new ArrayList<String>();
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < array.length; i++)
{
if (array[i] == '?' || array[i] == '*')
{
if (buffer.length() != 0)
{
list.add(buffer.toString());
buffer.setLength(0);
}
if (array[i] == '?')
{
list.add("?");
}
else if (list.isEmpty()
|| i > 0 && list.get(list.size() - 1).equals("*") == false)
{
list.add("*");
}
}
else
{
buffer.append(array[i]);
}
}
if (buffer.length() != 0)
{
list.add(buffer.toString());
}
return list.toArray(new String[list.size()]);
} }
|
public class class_name {
static String[] splitOnTokens(String text)
{
// used by wildcardMatch
// package level so a unit test may run on this
if (text.indexOf('?') == -1 && text.indexOf('*') == -1)
{
return new String[]
{
text
}; // depends on control dependency: [if], data = [none]
}
char[] array = text.toCharArray();
ArrayList<String> list = new ArrayList<String>();
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < array.length; i++)
{
if (array[i] == '?' || array[i] == '*')
{
if (buffer.length() != 0)
{
list.add(buffer.toString()); // depends on control dependency: [if], data = [none]
buffer.setLength(0); // depends on control dependency: [if], data = [0)]
}
if (array[i] == '?')
{
list.add("?"); // depends on control dependency: [if], data = [none]
}
else if (list.isEmpty()
|| i > 0 && list.get(list.size() - 1).equals("*") == false)
{
list.add("*"); // depends on control dependency: [if], data = [none]
}
}
else
{
buffer.append(array[i]); // depends on control dependency: [if], data = [(array[i]]
}
}
if (buffer.length() != 0)
{
list.add(buffer.toString()); // depends on control dependency: [if], data = [none]
}
return list.toArray(new String[list.size()]);
} }
|
public class class_name {
private String buildFacetString(List<String> facetNames, List<String>facetValues ) {
StringBuilder builder = new StringBuilder();
if( facetNames != null && facetValues != null )
{
int pairsCount = -1;
if( facetNames.size() != facetValues.size() ) {
pairsCount = facetNames.size() > facetValues.size() ? facetValues.size() : facetNames.size();
log.warn( "facetNames and facetValues lists were of different sizes, your query may not be accurate" );
} else {
pairsCount = facetNames.size();
}
for( int i=0; i < pairsCount; i++ ) {
try {
builder.append( "&facets[").append( facetNames.get( i )).append( "][]=" )
.append( URLEncoder.encode( facetValues.get( i ), "UTF-8" ));
} catch (UnsupportedEncodingException ignore) {
}
}
} else {
log.error( "facetNames or facetValues was null, you are defaulting to a regular query using no facet matching" );
}
return builder.toString();
} }
|
public class class_name {
private String buildFacetString(List<String> facetNames, List<String>facetValues ) {
StringBuilder builder = new StringBuilder();
if( facetNames != null && facetValues != null )
{
int pairsCount = -1;
if( facetNames.size() != facetValues.size() ) {
pairsCount = facetNames.size() > facetValues.size() ? facetValues.size() : facetNames.size(); // depends on control dependency: [if], data = [none]
log.warn( "facetNames and facetValues lists were of different sizes, your query may not be accurate" ); // depends on control dependency: [if], data = [none]
} else {
pairsCount = facetNames.size(); // depends on control dependency: [if], data = [none]
}
for( int i=0; i < pairsCount; i++ ) {
try {
builder.append( "&facets[").append( facetNames.get( i )).append( "][]=" )
.append( URLEncoder.encode( facetValues.get( i ), "UTF-8" )); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException ignore) {
} // depends on control dependency: [catch], data = [none]
}
} else {
log.error( "facetNames or facetValues was null, you are defaulting to a regular query using no facet matching" ); // depends on control dependency: [if], data = [none]
}
return builder.toString();
} }
|
public class class_name {
protected void findClusters() {
for (int i = 0; i < nodes.size(); i++) {
SquareNode n = nodes.get(i);
if( n.graph < 0 ) {
n.graph = clusters.size();
List<SquareNode> graph = clusters.grow();
graph.add(n);
addToCluster(n, graph);
}
}
} }
|
public class class_name {
protected void findClusters() {
for (int i = 0; i < nodes.size(); i++) {
SquareNode n = nodes.get(i);
if( n.graph < 0 ) {
n.graph = clusters.size(); // depends on control dependency: [if], data = [none]
List<SquareNode> graph = clusters.grow();
graph.add(n); // depends on control dependency: [if], data = [none]
addToCluster(n, graph); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static WritableRaster extractSubbasins( WritableRandomIter flowIter, RandomIter netIter,
WritableRandomIter netNumberIter, int rows, int cols, IHMProgressMonitor pm ) {
for( int r = 0; r < rows; r++ ) {
for( int c = 0; c < cols; c++ ) {
if (!isNovalue(netIter.getSampleDouble(c, r, 0)))
flowIter.setSample(c, r, 0, FlowNode.OUTLET);
}
}
WritableRaster subbasinWR = CoverageUtilities.createWritableRaster(cols, rows, Integer.class, null, null);
WritableRandomIter subbasinIter = RandomIterFactory.createWritable(subbasinWR, null);
markHillSlopeWithLinkValue(flowIter, netNumberIter, subbasinIter, cols, rows, pm);
try {
for( int r = 0; r < rows; r++ ) {
for( int c = 0; c < cols; c++ ) {
int netValue = netIter.getSample(c, r, 0);
int netNumberValue = netNumberIter.getSample(c, r, 0);
if (!isNovalue(netValue)) {
subbasinIter.setSample(c, r, 0, netNumberValue);
}
if (NumericsUtilities.dEq(netNumberValue, 0)) {
netNumberIter.setSample(c, r, 0, HMConstants.intNovalue);
}
int subbValue = subbasinIter.getSample(c, r, 0);
if (NumericsUtilities.dEq(subbValue, 0))
subbasinIter.setSample(c, r, 0, HMConstants.intNovalue);
}
}
} finally {
subbasinIter.done();
}
return subbasinWR;
} }
|
public class class_name {
public static WritableRaster extractSubbasins( WritableRandomIter flowIter, RandomIter netIter,
WritableRandomIter netNumberIter, int rows, int cols, IHMProgressMonitor pm ) {
for( int r = 0; r < rows; r++ ) {
for( int c = 0; c < cols; c++ ) {
if (!isNovalue(netIter.getSampleDouble(c, r, 0)))
flowIter.setSample(c, r, 0, FlowNode.OUTLET);
}
}
WritableRaster subbasinWR = CoverageUtilities.createWritableRaster(cols, rows, Integer.class, null, null);
WritableRandomIter subbasinIter = RandomIterFactory.createWritable(subbasinWR, null);
markHillSlopeWithLinkValue(flowIter, netNumberIter, subbasinIter, cols, rows, pm);
try {
for( int r = 0; r < rows; r++ ) {
for( int c = 0; c < cols; c++ ) {
int netValue = netIter.getSample(c, r, 0);
int netNumberValue = netNumberIter.getSample(c, r, 0);
if (!isNovalue(netValue)) {
subbasinIter.setSample(c, r, 0, netNumberValue); // depends on control dependency: [if], data = [none]
}
if (NumericsUtilities.dEq(netNumberValue, 0)) {
netNumberIter.setSample(c, r, 0, HMConstants.intNovalue); // depends on control dependency: [if], data = [none]
}
int subbValue = subbasinIter.getSample(c, r, 0);
if (NumericsUtilities.dEq(subbValue, 0))
subbasinIter.setSample(c, r, 0, HMConstants.intNovalue);
}
}
} finally {
subbasinIter.done();
}
return subbasinWR;
} }
|
public class class_name {
private static byte[] padBytes(byte[] bytes, int length) {
byte[] padded = new byte[length];
for (int i = 0; i < bytes.length; i++) {
padded[i] = bytes[i];
}
return padded;
} }
|
public class class_name {
private static byte[] padBytes(byte[] bytes, int length) {
byte[] padded = new byte[length];
for (int i = 0; i < bytes.length; i++) {
padded[i] = bytes[i]; // depends on control dependency: [for], data = [i]
}
return padded;
} }
|
public class class_name {
public TableWriteItems addItemToPut(Item item) {
if (item != null) {
if (itemsToPut == null)
itemsToPut = new ArrayList<Item>();
this.itemsToPut.add(item);
}
return this;
} }
|
public class class_name {
public TableWriteItems addItemToPut(Item item) {
if (item != null) {
if (itemsToPut == null)
itemsToPut = new ArrayList<Item>();
this.itemsToPut.add(item); // depends on control dependency: [if], data = [(item]
}
return this;
} }
|
public class class_name {
public Block withRelationships(Relationship... relationships) {
if (this.relationships == null) {
setRelationships(new java.util.ArrayList<Relationship>(relationships.length));
}
for (Relationship ele : relationships) {
this.relationships.add(ele);
}
return this;
} }
|
public class class_name {
public Block withRelationships(Relationship... relationships) {
if (this.relationships == null) {
setRelationships(new java.util.ArrayList<Relationship>(relationships.length)); // depends on control dependency: [if], data = [none]
}
for (Relationship ele : relationships) {
this.relationships.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public File write(File destination) throws IOException {
assertValid();
if (destination.isDirectory() == true) {
destination = new File(destination, this.header.getFileName());
}
if (data != null) {
FileUtil.writeBytes(data, destination);
data = null;
} else {
if (tempFile != null) {
FileUtil.move(tempFile, destination, true);
}
}
return destination;
} }
|
public class class_name {
public File write(File destination) throws IOException {
assertValid();
if (destination.isDirectory() == true) {
destination = new File(destination, this.header.getFileName());
}
if (data != null) {
FileUtil.writeBytes(data, destination);
data = null;
} else {
if (tempFile != null) {
FileUtil.move(tempFile, destination, true);
// depends on control dependency: [if], data = [(tempFile]
}
}
return destination;
} }
|
public class class_name {
public int getStateId(LR1ItemSet targetSet) throws GrammarException {
for (int stateId = 0; stateId < itemSetCollection.size(); stateId++) {
LR1ItemSet lr1ItemSet = itemSetCollection.get(stateId);
if (lr1ItemSet.equals(targetSet)) {
return stateId;
}
}
throw new GrammarException("Target set '" + targetSet
+ "' was not found!");
} }
|
public class class_name {
public int getStateId(LR1ItemSet targetSet) throws GrammarException {
for (int stateId = 0; stateId < itemSetCollection.size(); stateId++) {
LR1ItemSet lr1ItemSet = itemSetCollection.get(stateId);
if (lr1ItemSet.equals(targetSet)) {
return stateId; // depends on control dependency: [if], data = [none]
}
}
throw new GrammarException("Target set '" + targetSet
+ "' was not found!");
} }
|
public class class_name {
public EClass getSCFL() {
if (scflEClass == null) {
scflEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(335);
}
return scflEClass;
} }
|
public class class_name {
public EClass getSCFL() {
if (scflEClass == null) {
scflEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(335); // depends on control dependency: [if], data = [none]
}
return scflEClass;
} }
|
public class class_name {
public String createOutputStreamAppender(String name, String pattern, String encoding, Collection<String> loggerNames,
String levelStr, boolean recursive, boolean overrideLogLevel) {
Level level = getLevel(levelStr);
String encodingToUse = StringUtils.isEmpty(encoding) ? "UTF-8" : encoding;
PatternLayout layout = PatternLayout.newBuilder()
.withPattern(StringUtils.isEmpty(pattern) ? DEFAULT_PATTERN : pattern)
.withCharset(Charset.forName(encodingToUse))
.build();
String appenderName = StringUtils.isEmpty(name) ? UUID.randomUUID().toString() : name;
AdminToolLog4j2OutputStream baos = new AdminToolLog4j2OutputStream(4096, encodingToUse);
outputStreams.put(appenderName, baos);
OutputStreamAppender appender = OutputStreamAppender.newBuilder()
.setName(appenderName)
.setTarget(baos)
.setLayout(layout)
.setFollow(false)
.build();
appender.start();
final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
final Configuration config = ctx.getConfiguration();
config.addAppender(appender);
Collection<String> parentLoggerNames = getParentLoggerNames();
Map<String, LoggerConfig> configs = getRecursiveLoggerConfigs(loggerNames, recursive, config);
configs.entrySet().forEach(configEntry ->{
configEntry.getValue().addAppender(appender, level, null);
if (overrideLogLevel) {
baos.addOriginalLevel(configEntry.getKey(), configEntry.getValue().getLevel());
changeLogger(configEntry.getKey(), level, parentLoggerNames.contains(configEntry.getKey()));
}
});
ctx.updateLoggers();
return appenderName;
} }
|
public class class_name {
public String createOutputStreamAppender(String name, String pattern, String encoding, Collection<String> loggerNames,
String levelStr, boolean recursive, boolean overrideLogLevel) {
Level level = getLevel(levelStr);
String encodingToUse = StringUtils.isEmpty(encoding) ? "UTF-8" : encoding;
PatternLayout layout = PatternLayout.newBuilder()
.withPattern(StringUtils.isEmpty(pattern) ? DEFAULT_PATTERN : pattern)
.withCharset(Charset.forName(encodingToUse))
.build();
String appenderName = StringUtils.isEmpty(name) ? UUID.randomUUID().toString() : name;
AdminToolLog4j2OutputStream baos = new AdminToolLog4j2OutputStream(4096, encodingToUse);
outputStreams.put(appenderName, baos);
OutputStreamAppender appender = OutputStreamAppender.newBuilder()
.setName(appenderName)
.setTarget(baos)
.setLayout(layout)
.setFollow(false)
.build();
appender.start();
final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
final Configuration config = ctx.getConfiguration();
config.addAppender(appender);
Collection<String> parentLoggerNames = getParentLoggerNames();
Map<String, LoggerConfig> configs = getRecursiveLoggerConfigs(loggerNames, recursive, config);
configs.entrySet().forEach(configEntry ->{
configEntry.getValue().addAppender(appender, level, null);
if (overrideLogLevel) {
baos.addOriginalLevel(configEntry.getKey(), configEntry.getValue().getLevel());
// depends on control dependency: [if], data = [none]
changeLogger(configEntry.getKey(), level, parentLoggerNames.contains(configEntry.getKey()));
// depends on control dependency: [if], data = [none]
}
});
ctx.updateLoggers();
return appenderName;
} }
|
public class class_name {
public boolean isMetBy(GlobalProperties props) {
if (this.partitioning == PartitioningProperty.ANY_DISTRIBUTION) {
return true;
} else if (this.partitioning == PartitioningProperty.FULL_REPLICATION) {
return props.isFullyReplicated();
}
else if (props.isFullyReplicated()) {
return false;
}
else if (this.partitioning == PartitioningProperty.RANDOM_PARTITIONED) {
return true;
}
else if (this.partitioning == PartitioningProperty.ANY_PARTITIONING) {
return checkCompatiblePartitioningFields(props);
}
else if (this.partitioning == PartitioningProperty.HASH_PARTITIONED) {
return props.getPartitioning() == PartitioningProperty.HASH_PARTITIONED &&
checkCompatiblePartitioningFields(props);
}
else if (this.partitioning == PartitioningProperty.RANGE_PARTITIONED) {
return props.getPartitioning() == PartitioningProperty.RANGE_PARTITIONED &&
props.matchesOrderedPartitioning(this.ordering);
}
else if (this.partitioning == PartitioningProperty.FORCED_REBALANCED) {
return props.getPartitioning() == PartitioningProperty.FORCED_REBALANCED;
}
else if (this.partitioning == PartitioningProperty.CUSTOM_PARTITIONING) {
return props.getPartitioning() == PartitioningProperty.CUSTOM_PARTITIONING &&
checkCompatiblePartitioningFields(props) &&
props.getCustomPartitioner().equals(this.customPartitioner);
}
else {
throw new CompilerException("Properties matching logic leaves open cases.");
}
} }
|
public class class_name {
public boolean isMetBy(GlobalProperties props) {
if (this.partitioning == PartitioningProperty.ANY_DISTRIBUTION) {
return true; // depends on control dependency: [if], data = [none]
} else if (this.partitioning == PartitioningProperty.FULL_REPLICATION) {
return props.isFullyReplicated(); // depends on control dependency: [if], data = [none]
}
else if (props.isFullyReplicated()) {
return false; // depends on control dependency: [if], data = [none]
}
else if (this.partitioning == PartitioningProperty.RANDOM_PARTITIONED) {
return true; // depends on control dependency: [if], data = [none]
}
else if (this.partitioning == PartitioningProperty.ANY_PARTITIONING) {
return checkCompatiblePartitioningFields(props); // depends on control dependency: [if], data = [none]
}
else if (this.partitioning == PartitioningProperty.HASH_PARTITIONED) {
return props.getPartitioning() == PartitioningProperty.HASH_PARTITIONED &&
checkCompatiblePartitioningFields(props); // depends on control dependency: [if], data = [none]
}
else if (this.partitioning == PartitioningProperty.RANGE_PARTITIONED) {
return props.getPartitioning() == PartitioningProperty.RANGE_PARTITIONED &&
props.matchesOrderedPartitioning(this.ordering); // depends on control dependency: [if], data = [none]
}
else if (this.partitioning == PartitioningProperty.FORCED_REBALANCED) {
return props.getPartitioning() == PartitioningProperty.FORCED_REBALANCED; // depends on control dependency: [if], data = [none]
}
else if (this.partitioning == PartitioningProperty.CUSTOM_PARTITIONING) {
return props.getPartitioning() == PartitioningProperty.CUSTOM_PARTITIONING &&
checkCompatiblePartitioningFields(props) &&
props.getCustomPartitioner().equals(this.customPartitioner); // depends on control dependency: [if], data = [none]
}
else {
throw new CompilerException("Properties matching logic leaves open cases.");
}
} }
|
public class class_name {
private void findChildBeans(Object obj, MetaProperty<?> mp, Class<?> beanClass, Deque<Bean> temp) {
if (obj != null) {
if (obj instanceof Bean) {
temp.addFirst((Bean) obj);
} else {
SerIterator it = SerIteratorFactory.INSTANCE.create(obj, mp, beanClass);
if (it != null) {
while (it.hasNext()) {
it.next();
findChildBeans(it.key(), mp, Object.class, temp);
findChildBeans(it.value(), mp, Object.class, temp);
findChildBeans(it.column(), mp, Object.class, temp);
}
}
}
}
} }
|
public class class_name {
private void findChildBeans(Object obj, MetaProperty<?> mp, Class<?> beanClass, Deque<Bean> temp) {
if (obj != null) {
if (obj instanceof Bean) {
temp.addFirst((Bean) obj); // depends on control dependency: [if], data = [none]
} else {
SerIterator it = SerIteratorFactory.INSTANCE.create(obj, mp, beanClass);
if (it != null) {
while (it.hasNext()) {
it.next(); // depends on control dependency: [while], data = [none]
findChildBeans(it.key(), mp, Object.class, temp); // depends on control dependency: [while], data = [none]
findChildBeans(it.value(), mp, Object.class, temp); // depends on control dependency: [while], data = [none]
findChildBeans(it.column(), mp, Object.class, temp); // depends on control dependency: [while], data = [none]
}
}
}
}
} }
|
public class class_name {
protected void tryToRemoveAlpnNegotiator(ThirdPartyAlpnNegotiator negotiator, SSLEngine engine, SSLConnectionLink link) {
// the Java 9 and IBM JSSE ALPN implementations don't use a negotiator object
if (negotiator == null && isNativeAlpnActive()) {
getNativeAlpnChoice(engine, link);
} else if (negotiator == null && isIbmAlpnActive()) {
getAndRemoveIbmAlpnChoice(engine, link);
} else if (negotiator != null && isJettyAlpnActive() && negotiator instanceof JettyServerNegotiator) {
((JettyServerNegotiator) negotiator).removeEngine();
} else if (negotiator != null && isGrizzlyAlpnActive() && negotiator instanceof GrizzlyAlpnNegotiator) {
((GrizzlyAlpnNegotiator) negotiator).removeServerNegotiatorEngine();
}
} }
|
public class class_name {
protected void tryToRemoveAlpnNegotiator(ThirdPartyAlpnNegotiator negotiator, SSLEngine engine, SSLConnectionLink link) {
// the Java 9 and IBM JSSE ALPN implementations don't use a negotiator object
if (negotiator == null && isNativeAlpnActive()) {
getNativeAlpnChoice(engine, link); // depends on control dependency: [if], data = [none]
} else if (negotiator == null && isIbmAlpnActive()) {
getAndRemoveIbmAlpnChoice(engine, link); // depends on control dependency: [if], data = [none]
} else if (negotiator != null && isJettyAlpnActive() && negotiator instanceof JettyServerNegotiator) {
((JettyServerNegotiator) negotiator).removeEngine(); // depends on control dependency: [if], data = [none]
} else if (negotiator != null && isGrizzlyAlpnActive() && negotiator instanceof GrizzlyAlpnNegotiator) {
((GrizzlyAlpnNegotiator) negotiator).removeServerNegotiatorEngine(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public TableGenerator<OrmDescriptor> getOrCreateTableGenerator()
{
List<Node> nodeList = model.get("table-generator");
if (nodeList != null && nodeList.size() > 0)
{
return new TableGeneratorImpl<OrmDescriptor>(this, "table-generator", model, nodeList.get(0));
}
return createTableGenerator();
} }
|
public class class_name {
public TableGenerator<OrmDescriptor> getOrCreateTableGenerator()
{
List<Node> nodeList = model.get("table-generator");
if (nodeList != null && nodeList.size() > 0)
{
return new TableGeneratorImpl<OrmDescriptor>(this, "table-generator", model, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createTableGenerator();
} }
|
public class class_name {
private double getParamDouble(String key, double defaultValue) {
String value = values.get(key);
if (value==null || value.isEmpty()) {
return defaultValue;
}
try {
return Double.valueOf(value);
} catch (NumberFormatException e) {
throw new RuntimeException("Invalid double value: >>>"+value+"<<<", e);
}
} }
|
public class class_name {
private double getParamDouble(String key, double defaultValue) {
String value = values.get(key);
if (value==null || value.isEmpty()) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
try {
return Double.valueOf(value);
} catch (NumberFormatException e) {
throw new RuntimeException("Invalid double value: >>>"+value+"<<<", e);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private void addTagHanderInMap() {
// 循环遍历所有class,如果其不是IConditHandler.class的实现类,则表明其是正确的class,继续下次循环.
for (Class<?> cls: classSet) {
// 如果是 Tagger 注解,则将其 Tagger 信息存放到Map中.
if (cls.isAnnotationPresent(Tagger.class) && isImplConditHandlerClass(cls)) {
Class<? extends IConditHandler> conditCls = (Class<? extends IConditHandler>) cls;
Tagger tagger = conditCls.getAnnotation(Tagger.class);
this.addTagHandlerInMapByTagger(conditCls, tagger);
}
// 如果是 Taggers 注解,则解析出其下所有的Tagger来存放到Map中.
if (cls.isAnnotationPresent(Taggers.class) && isImplConditHandlerClass(cls)) {
Taggers taggers = cls.getAnnotation(Taggers.class);
Tagger[] taggerArr = taggers.value();
for (Tagger tagger: taggerArr) {
this.addTagHandlerInMapByTagger((Class<? extends IConditHandler>) cls, tagger);
}
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private void addTagHanderInMap() {
// 循环遍历所有class,如果其不是IConditHandler.class的实现类,则表明其是正确的class,继续下次循环.
for (Class<?> cls: classSet) {
// 如果是 Tagger 注解,则将其 Tagger 信息存放到Map中.
if (cls.isAnnotationPresent(Tagger.class) && isImplConditHandlerClass(cls)) {
Class<? extends IConditHandler> conditCls = (Class<? extends IConditHandler>) cls;
Tagger tagger = conditCls.getAnnotation(Tagger.class);
this.addTagHandlerInMapByTagger(conditCls, tagger); // depends on control dependency: [if], data = [none]
}
// 如果是 Taggers 注解,则解析出其下所有的Tagger来存放到Map中.
if (cls.isAnnotationPresent(Taggers.class) && isImplConditHandlerClass(cls)) {
Taggers taggers = cls.getAnnotation(Taggers.class);
Tagger[] taggerArr = taggers.value();
for (Tagger tagger: taggerArr) {
this.addTagHandlerInMapByTagger((Class<? extends IConditHandler>) cls, tagger); // depends on control dependency: [for], data = [tagger]
}
}
}
} }
|
public class class_name {
public static Logger getLogger() {
if (logger == null) {
logger = Logger.getLogger(XmlHttpProxy.class.getName());
}
return logger;
} }
|
public class class_name {
public static Logger getLogger() {
if (logger == null) {
logger = Logger.getLogger(XmlHttpProxy.class.getName()); // depends on control dependency: [if], data = [none]
}
return logger;
} }
|
public class class_name {
protected Integer getInteger(final String key, final JSONObject jsonObject) {
Integer value = null;
if(hasKey(key, jsonObject)) {
try {
value = jsonObject.getInt(key);
}
catch(JSONException e) {
LOGGER.error("Could not get Integer from JSONObject for key: " + key, e);
}
}
return value;
} }
|
public class class_name {
protected Integer getInteger(final String key, final JSONObject jsonObject) {
Integer value = null;
if(hasKey(key, jsonObject)) {
try {
value = jsonObject.getInt(key); // depends on control dependency: [try], data = [none]
}
catch(JSONException e) {
LOGGER.error("Could not get Integer from JSONObject for key: " + key, e);
} // depends on control dependency: [catch], data = [none]
}
return value;
} }
|
public class class_name {
public void marshall(DeleteBudgetRequest deleteBudgetRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteBudgetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteBudgetRequest.getAccountId(), ACCOUNTID_BINDING);
protocolMarshaller.marshall(deleteBudgetRequest.getBudgetName(), BUDGETNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DeleteBudgetRequest deleteBudgetRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteBudgetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteBudgetRequest.getAccountId(), ACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteBudgetRequest.getBudgetName(), BUDGETNAME_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 RetrySimulation executeSimulation(int numSimulations) {
RetrySimulation simulation = new RetrySimulation();
for (int i = 0; i < numSimulations; i++) {
simulation.addSequence(executeSingleSimulation());
}
return simulation;
} }
|
public class class_name {
public RetrySimulation executeSimulation(int numSimulations) {
RetrySimulation simulation = new RetrySimulation();
for (int i = 0; i < numSimulations; i++) {
simulation.addSequence(executeSingleSimulation()); // depends on control dependency: [for], data = [none]
}
return simulation;
} }
|
public class class_name {
@Override
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
liNav.addContent(writer.getHyperLink(
SectionName.FIELD_DETAIL,
contents.navField));
} else {
liNav.addContent(contents.navField);
}
} }
|
public class class_name {
@Override
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
liNav.addContent(writer.getHyperLink(
SectionName.FIELD_DETAIL,
contents.navField)); // depends on control dependency: [if], data = [none]
} else {
liNav.addContent(contents.navField); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void displayResourceInfo(List<CmsResource> resources, String messageKey) {
m_infoResources = Lists.newArrayList(resources);
if (m_infoComponent != null) {
m_mainPanel.removeComponent(m_infoComponent);
m_infoComponent = null;
}
if ((resources != null) && !resources.isEmpty()) {
if (resources.size() == 1) {
m_infoComponent = new CmsResourceInfo(resources.get(0));
m_mainPanel.addComponent(m_infoComponent, 0);
} else {
m_infoComponent = createResourceListPanel(
messageKey == null ? null : Messages.get().getBundle(A_CmsUI.get().getLocale()).key(messageKey),
resources);
m_mainPanel.addComponent(m_infoComponent, 0);
m_mainPanel.setExpandRatio(m_infoComponent, 1);
// reset expand ratio of the content panel
m_contentPanel.setSizeUndefined();
m_contentPanel.setWidth("100%");
m_mainPanel.setExpandRatio(m_contentPanel, 0);
}
}
} }
|
public class class_name {
public void displayResourceInfo(List<CmsResource> resources, String messageKey) {
m_infoResources = Lists.newArrayList(resources);
if (m_infoComponent != null) {
m_mainPanel.removeComponent(m_infoComponent); // depends on control dependency: [if], data = [(m_infoComponent]
m_infoComponent = null; // depends on control dependency: [if], data = [none]
}
if ((resources != null) && !resources.isEmpty()) {
if (resources.size() == 1) {
m_infoComponent = new CmsResourceInfo(resources.get(0)); // depends on control dependency: [if], data = [none]
m_mainPanel.addComponent(m_infoComponent, 0); // depends on control dependency: [if], data = [none]
} else {
m_infoComponent = createResourceListPanel(
messageKey == null ? null : Messages.get().getBundle(A_CmsUI.get().getLocale()).key(messageKey),
resources); // depends on control dependency: [if], data = [none]
m_mainPanel.addComponent(m_infoComponent, 0); // depends on control dependency: [if], data = [none]
m_mainPanel.setExpandRatio(m_infoComponent, 1); // depends on control dependency: [if], data = [1)]
// reset expand ratio of the content panel
m_contentPanel.setSizeUndefined(); // depends on control dependency: [if], data = [none]
m_contentPanel.setWidth("100%"); // depends on control dependency: [if], data = [none]
m_mainPanel.setExpandRatio(m_contentPanel, 0); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override
public T paramBean(final Object bean) {
if (bean != null) {
BeanAccessor.fields(bean.getClass()).stream()
.forEach(f -> param(f.getName(), BeanAccessor.value(f, bean)));
}
return (T) this;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override
public T paramBean(final Object bean) {
if (bean != null) {
BeanAccessor.fields(bean.getClass()).stream()
.forEach(f -> param(f.getName(), BeanAccessor.value(f, bean))); // depends on control dependency: [if], data = [(bean]
}
return (T) this;
} }
|
public class class_name {
public int setBytes(final long pos, byte[] bytes,
final int offset, final int len) throws SQLException {
synchronized (this) {
if (this.underlying == null) {
if (pos > 1) {
throw new SQLException("Invalid position: " + pos);
} // end of if
if (len < 0) {
throw new IllegalArgumentException("Invalid bytes length: "
+ len);
} // end of if
// ---
final byte[] copy = new byte[len];
try {
System.arraycopy(bytes, offset, copy, 0, len);
} catch (Exception e) {
throw new IllegalArgumentException("Fails to prepare binary data", e);
} // end of catch
// ---
this.underlying = new SerialBlob(copy);
return len;
} // end of if
// ---
return this.underlying.setBytes(pos, bytes, offset, len);
} // end of sync
} }
|
public class class_name {
public int setBytes(final long pos, byte[] bytes,
final int offset, final int len) throws SQLException {
synchronized (this) {
if (this.underlying == null) {
if (pos > 1) {
throw new SQLException("Invalid position: " + pos);
} // end of if
if (len < 0) {
throw new IllegalArgumentException("Invalid bytes length: "
+ len);
} // end of if
// ---
final byte[] copy = new byte[len];
try {
System.arraycopy(bytes, offset, copy, 0, len); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IllegalArgumentException("Fails to prepare binary data", e);
} // end of catch // depends on control dependency: [catch], data = [none]
// ---
this.underlying = new SerialBlob(copy); // depends on control dependency: [if], data = [none]
return len; // depends on control dependency: [if], data = [none]
} // end of if
// ---
return this.underlying.setBytes(pos, bytes, offset, len);
} // end of sync
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.