code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
protected void unregister(IEventListener listener) {
log.debug("unregister - listener: {}", listener);
if (listeners.remove(listener)) {
listenerStats.decrement();
}
} } | public class class_name {
protected void unregister(IEventListener listener) {
log.debug("unregister - listener: {}", listener);
if (listeners.remove(listener)) {
listenerStats.decrement();
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void rmLittlePathByScore() {
int maxTo = -1;
Term temp = null;
for (int i = 0; i < terms.length; i++) {
if (terms[i] == null) {
continue;
}
Term maxTerm = null;
double maxScore = 0;
Term term = terms[i];
// 找到自身分数对大最长的
do {
if (maxTerm == null || maxScore > term.score()) {
maxTerm = term;
} else if (maxScore == term.score() && maxTerm.getName().length() < term.getName().length()) {
maxTerm = term;
}
} while ((term = term.next()) != null);
term = maxTerm;
do {
maxTo = term.toValue();
maxScore = term.score();
if (maxTo - i == 1 || i + 1 == terms.length)
continue;
boolean flag = true;// 可以删除
out: for (int j = i; j < maxTo; j++) {
temp = terms[j];
if (temp == null) {
continue;
}
do {
if (temp.toValue() > maxTo || temp.score() < maxScore) {
flag = false;
break out;
}
} while ((temp = temp.next()) != null);
}
// 验证通过可以删除了
if (flag) {
for (int j = i + 1; j < maxTo; j++) {
terms[j] = null;
}
}
} while ((term = term.next()) != null);
}
} } | public class class_name {
public void rmLittlePathByScore() {
int maxTo = -1;
Term temp = null;
for (int i = 0; i < terms.length; i++) {
if (terms[i] == null) {
continue;
}
Term maxTerm = null;
double maxScore = 0;
Term term = terms[i];
// 找到自身分数对大最长的
do {
if (maxTerm == null || maxScore > term.score()) {
maxTerm = term; // depends on control dependency: [if], data = [none]
} else if (maxScore == term.score() && maxTerm.getName().length() < term.getName().length()) {
maxTerm = term; // depends on control dependency: [if], data = [none]
}
} while ((term = term.next()) != null);
term = maxTerm; // depends on control dependency: [for], data = [none]
do {
maxTo = term.toValue();
maxScore = term.score();
if (maxTo - i == 1 || i + 1 == terms.length)
continue;
boolean flag = true;// 可以删除
out: for (int j = i; j < maxTo; j++) {
temp = terms[j]; // depends on control dependency: [for], data = [j]
if (temp == null) {
continue;
}
do {
if (temp.toValue() > maxTo || temp.score() < maxScore) {
flag = false; // depends on control dependency: [if], data = [none]
break out;
}
} while ((temp = temp.next()) != null);
}
// 验证通过可以删除了
if (flag) {
for (int j = i + 1; j < maxTo; j++) {
terms[j] = null; // depends on control dependency: [for], data = [j]
}
}
} while ((term = term.next()) != null);
}
} } |
public class class_name {
public static boolean removeBids(
BidResponse.Builder response, @Nullable String seatFilter, Predicate<Bid.Builder> bidFilter) {
checkNotNull(bidFilter);
boolean updated = false;
for (SeatBid.Builder seatbid : response.getSeatbidBuilderList()) {
if (filterSeat(seatbid, seatFilter)) {
updated |= removeBids(seatbid, bidFilter);
}
}
return updated;
} } | public class class_name {
public static boolean removeBids(
BidResponse.Builder response, @Nullable String seatFilter, Predicate<Bid.Builder> bidFilter) {
checkNotNull(bidFilter);
boolean updated = false;
for (SeatBid.Builder seatbid : response.getSeatbidBuilderList()) {
if (filterSeat(seatbid, seatFilter)) {
updated |= removeBids(seatbid, bidFilter); // depends on control dependency: [if], data = [none]
}
}
return updated;
} } |
public class class_name {
public void setSpotFleetRequestConfigs(java.util.Collection<SpotFleetRequestConfig> spotFleetRequestConfigs) {
if (spotFleetRequestConfigs == null) {
this.spotFleetRequestConfigs = null;
return;
}
this.spotFleetRequestConfigs = new com.amazonaws.internal.SdkInternalList<SpotFleetRequestConfig>(spotFleetRequestConfigs);
} } | public class class_name {
public void setSpotFleetRequestConfigs(java.util.Collection<SpotFleetRequestConfig> spotFleetRequestConfigs) {
if (spotFleetRequestConfigs == null) {
this.spotFleetRequestConfigs = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.spotFleetRequestConfigs = new com.amazonaws.internal.SdkInternalList<SpotFleetRequestConfig>(spotFleetRequestConfigs);
} } |
public class class_name {
public static void deleteEmptyParentDirectories(FileSystem fs, Path limitPath, Path startPath)
throws IOException {
if (PathUtils.isAncestor(limitPath, startPath) && !PathUtils.getPathWithoutSchemeAndAuthority(limitPath)
.equals(PathUtils.getPathWithoutSchemeAndAuthority(startPath)) && fs.listStatus(startPath).length == 0) {
if (!fs.delete(startPath, false)) {
log.warn("Failed to delete empty directory " + startPath);
} else {
log.info("Deleted empty directory " + startPath);
}
deleteEmptyParentDirectories(fs, limitPath, startPath.getParent());
}
} } | public class class_name {
public static void deleteEmptyParentDirectories(FileSystem fs, Path limitPath, Path startPath)
throws IOException {
if (PathUtils.isAncestor(limitPath, startPath) && !PathUtils.getPathWithoutSchemeAndAuthority(limitPath)
.equals(PathUtils.getPathWithoutSchemeAndAuthority(startPath)) && fs.listStatus(startPath).length == 0) {
if (!fs.delete(startPath, false)) {
log.warn("Failed to delete empty directory " + startPath); // depends on control dependency: [if], data = [none]
} else {
log.info("Deleted empty directory " + startPath); // depends on control dependency: [if], data = [none]
}
deleteEmptyParentDirectories(fs, limitPath, startPath.getParent());
}
} } |
public class class_name {
public R setTags(List<String> tags) {
JsonArray jsonArray = new JsonArray();
for (String s : tags) {
jsonArray.add(s);
}
mBodyMap.put(BoxItem.FIELD_TAGS, jsonArray);
return (R) this;
} } | public class class_name {
public R setTags(List<String> tags) {
JsonArray jsonArray = new JsonArray();
for (String s : tags) {
jsonArray.add(s); // depends on control dependency: [for], data = [s]
}
mBodyMap.put(BoxItem.FIELD_TAGS, jsonArray);
return (R) this;
} } |
public class class_name {
static void applyUriConnectionSettings(RedisURI from, RedisURI to) {
if (from.getPassword() != null && from.getPassword().length != 0) {
to.setPassword(new String(from.getPassword()));
}
to.setTimeout(from.getTimeout());
to.setSsl(from.isSsl());
to.setStartTls(from.isStartTls());
to.setVerifyPeer(from.isVerifyPeer());
} } | public class class_name {
static void applyUriConnectionSettings(RedisURI from, RedisURI to) {
if (from.getPassword() != null && from.getPassword().length != 0) {
to.setPassword(new String(from.getPassword())); // depends on control dependency: [if], data = [(from.getPassword()]
}
to.setTimeout(from.getTimeout());
to.setSsl(from.isSsl());
to.setStartTls(from.isStartTls());
to.setVerifyPeer(from.isVerifyPeer());
} } |
public class class_name {
public static boolean isNumeric(String str, int beginIndex, int endIndex)
{
for ( int i = beginIndex; i < endIndex; i++ ) {
char chr = str.charAt(i);
if ( ! StringUtil.isEnNumeric(chr) ) {
return false;
}
}
return true;
} } | public class class_name {
public static boolean isNumeric(String str, int beginIndex, int endIndex)
{
for ( int i = beginIndex; i < endIndex; i++ ) {
char chr = str.charAt(i);
if ( ! StringUtil.isEnNumeric(chr) ) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public Interval getInstance(Long position, Granularity gran) {
List<Object> key = Arrays.asList(new Object[]{position, gran});
Interval result;
synchronized (cache) {
result = cache.get(key);
if (result == null) {
if (position == null) {
result = new DefaultInterval(position, gran, position, gran);
} else {
result = new SimpleInterval(position, gran);
}
cache.put(key, result);
}
}
return result;
} } | public class class_name {
public Interval getInstance(Long position, Granularity gran) {
List<Object> key = Arrays.asList(new Object[]{position, gran});
Interval result;
synchronized (cache) {
result = cache.get(key);
if (result == null) {
if (position == null) {
result = new DefaultInterval(position, gran, position, gran); // depends on control dependency: [if], data = [(position]
} else {
result = new SimpleInterval(position, gran); // depends on control dependency: [if], data = [(position]
}
cache.put(key, result); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public void synchronize(List<? extends E> list) {
assert SwingUtilities.isEventDispatchThread() : ApplicationResources.accessor.getMessage("assert.notRunningInSwingEventThread");
// Make sure the first element exists and matches
int modelOffset;
if(constantFirstRow!=null) {
modelOffset = 1;
if(isEmpty()) addElement(constantFirstRow);
else if(!getElementAt(0).equals(constantFirstRow)) {
insertElementAt(constantFirstRow, 0);
}
} else modelOffset = 0;
// Synchronize the dynamic part of the list
int size = list.size();
for(int index=0; index<size; index++) {
E obj = list.get(index);
if(index>=(size()-modelOffset)) addElement(obj);
else if(!obj.equals(getElementAt(index+modelOffset))) {
// Objects don't match
// If this object is found further down the list, then delete up to that object
int foundIndex = -1;
for(int searchIndex = index+1; searchIndex<(size()-modelOffset); searchIndex++) {
if(obj.equals(getElementAt(searchIndex+modelOffset))) {
foundIndex = searchIndex;
break;
}
}
if(foundIndex!=-1) removeRange(index+modelOffset, foundIndex-1+modelOffset);
// Otherwise, insert in the current index
else insertElementAt(obj, index+modelOffset);
}
}
// Remove any extra
if((size()-modelOffset) > size) removeRange(size+modelOffset, size()-1);
} } | public class class_name {
public void synchronize(List<? extends E> list) {
assert SwingUtilities.isEventDispatchThread() : ApplicationResources.accessor.getMessage("assert.notRunningInSwingEventThread");
// Make sure the first element exists and matches
int modelOffset;
if(constantFirstRow!=null) {
modelOffset = 1; // depends on control dependency: [if], data = [none]
if(isEmpty()) addElement(constantFirstRow);
else if(!getElementAt(0).equals(constantFirstRow)) {
insertElementAt(constantFirstRow, 0); // depends on control dependency: [if], data = [none]
}
} else modelOffset = 0;
// Synchronize the dynamic part of the list
int size = list.size();
for(int index=0; index<size; index++) {
E obj = list.get(index);
if(index>=(size()-modelOffset)) addElement(obj);
else if(!obj.equals(getElementAt(index+modelOffset))) {
// Objects don't match
// If this object is found further down the list, then delete up to that object
int foundIndex = -1;
for(int searchIndex = index+1; searchIndex<(size()-modelOffset); searchIndex++) {
if(obj.equals(getElementAt(searchIndex+modelOffset))) {
foundIndex = searchIndex; // depends on control dependency: [if], data = [none]
break;
}
}
if(foundIndex!=-1) removeRange(index+modelOffset, foundIndex-1+modelOffset);
// Otherwise, insert in the current index
else insertElementAt(obj, index+modelOffset);
}
}
// Remove any extra
if((size()-modelOffset) > size) removeRange(size+modelOffset, size()-1);
} } |
public class class_name {
int writeJavaAnnotations(List<Attribute.Compound> attrs) {
if (attrs.isEmpty()) return 0;
ListBuffer<Attribute.Compound> visibles = new ListBuffer<Attribute.Compound>();
ListBuffer<Attribute.Compound> invisibles = new ListBuffer<Attribute.Compound>();
for (Attribute.Compound a : attrs) {
switch (types.getRetention(a)) {
case SOURCE: break;
case CLASS: invisibles.append(a); break;
case RUNTIME: visibles.append(a); break;
default: ;// /* fail soft */ throw new AssertionError(vis);
}
}
int attrCount = 0;
if (visibles.length() != 0) {
int attrIndex = writeAttr(names.RuntimeVisibleAnnotations);
databuf.appendChar(visibles.length());
for (Attribute.Compound a : visibles)
writeCompoundAttribute(a);
endAttr(attrIndex);
attrCount++;
}
if (invisibles.length() != 0) {
int attrIndex = writeAttr(names.RuntimeInvisibleAnnotations);
databuf.appendChar(invisibles.length());
for (Attribute.Compound a : invisibles)
writeCompoundAttribute(a);
endAttr(attrIndex);
attrCount++;
}
return attrCount;
} } | public class class_name {
int writeJavaAnnotations(List<Attribute.Compound> attrs) {
if (attrs.isEmpty()) return 0;
ListBuffer<Attribute.Compound> visibles = new ListBuffer<Attribute.Compound>();
ListBuffer<Attribute.Compound> invisibles = new ListBuffer<Attribute.Compound>();
for (Attribute.Compound a : attrs) {
switch (types.getRetention(a)) {
case SOURCE: break;
case CLASS: invisibles.append(a); break;
case RUNTIME: visibles.append(a); break;
default: ;// /* fail soft */ throw new AssertionError(vis);
}
}
int attrCount = 0;
if (visibles.length() != 0) {
int attrIndex = writeAttr(names.RuntimeVisibleAnnotations);
databuf.appendChar(visibles.length()); // depends on control dependency: [if], data = [(visibles.length()]
for (Attribute.Compound a : visibles)
writeCompoundAttribute(a);
endAttr(attrIndex); // depends on control dependency: [if], data = [none]
attrCount++; // depends on control dependency: [if], data = [none]
}
if (invisibles.length() != 0) {
int attrIndex = writeAttr(names.RuntimeInvisibleAnnotations);
databuf.appendChar(invisibles.length()); // depends on control dependency: [if], data = [(invisibles.length()]
for (Attribute.Compound a : invisibles)
writeCompoundAttribute(a);
endAttr(attrIndex); // depends on control dependency: [if], data = [none]
attrCount++; // depends on control dependency: [if], data = [none]
}
return attrCount;
} } |
public class class_name {
public void removePropertyChangeListener(PropertyChangeListener listener) {
if (listener == null) {
return;
}
if (listener instanceof PropertyChangeListenerProxy) {
PropertyChangeListenerProxy proxy =
(PropertyChangeListenerProxy)listener;
// Call two argument remove method.
removePropertyChangeListener(proxy.getPropertyName(),
proxy.getListener());
} else {
this.map.remove(null, listener);
}
} } | public class class_name {
public void removePropertyChangeListener(PropertyChangeListener listener) {
if (listener == null) {
return; // depends on control dependency: [if], data = [none]
}
if (listener instanceof PropertyChangeListenerProxy) {
PropertyChangeListenerProxy proxy =
(PropertyChangeListenerProxy)listener;
// Call two argument remove method.
removePropertyChangeListener(proxy.getPropertyName(),
proxy.getListener()); // depends on control dependency: [if], data = [none]
} else {
this.map.remove(null, listener); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected String removeServletMappingFromPath(String path, String mapping) {
if (mapping != null && mapping.length() > 0) {
int idx = path.indexOf(mapping);
if (idx > -1) {
path = path.substring(idx + mapping.length());
}
path = PathNormalizer.asPath(path);
}
return path;
} } | public class class_name {
protected String removeServletMappingFromPath(String path, String mapping) {
if (mapping != null && mapping.length() > 0) {
int idx = path.indexOf(mapping);
if (idx > -1) {
path = path.substring(idx + mapping.length()); // depends on control dependency: [if], data = [(idx]
}
path = PathNormalizer.asPath(path); // depends on control dependency: [if], data = [none]
}
return path;
} } |
public class class_name {
private CompletableFuture<Void> trySealStreamSegment(SegmentMetadata metadata, Duration timeout) {
if (metadata.isSealed()) {
return CompletableFuture.completedFuture(null);
} else {
// It is OK to ignore StreamSegmentSealedException as the segment may have already been sealed by a concurrent
// call to this or via some other operation.
return Futures.exceptionallyExpecting(
this.durableLog.add(new StreamSegmentSealOperation(metadata.getId()), timeout),
ex -> ex instanceof StreamSegmentSealedException,
null);
}
} } | public class class_name {
private CompletableFuture<Void> trySealStreamSegment(SegmentMetadata metadata, Duration timeout) {
if (metadata.isSealed()) {
return CompletableFuture.completedFuture(null); // depends on control dependency: [if], data = [none]
} else {
// It is OK to ignore StreamSegmentSealedException as the segment may have already been sealed by a concurrent
// call to this or via some other operation.
return Futures.exceptionallyExpecting(
this.durableLog.add(new StreamSegmentSealOperation(metadata.getId()), timeout),
ex -> ex instanceof StreamSegmentSealedException,
null); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ElapsedTime process() {
try {
long start = System.currentTimeMillis();
ioProcess();
long ioDone = System.currentTimeMillis();
loopProcess();
long end = System.currentTimeMillis();
return new ElapsedTime(start, ioDone, end);
} catch (Exception e) {
Logger.error("-ERR error occurs in hbMain", e);
}
return null;
} } | public class class_name {
public ElapsedTime process() {
try {
long start = System.currentTimeMillis();
ioProcess(); // depends on control dependency: [try], data = [none]
long ioDone = System.currentTimeMillis();
loopProcess(); // depends on control dependency: [try], data = [none]
long end = System.currentTimeMillis();
return new ElapsedTime(start, ioDone, end); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
Logger.error("-ERR error occurs in hbMain", e);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public static <T> Iterator<T> iterator(final Source<T> source) {
return new Iterator<T>() {
@Override
public boolean hasNext() {
try {
return source.hasNext();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public T next() {
try {
return source.next();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
} } | public class class_name {
public static <T> Iterator<T> iterator(final Source<T> source) {
return new Iterator<T>() {
@Override
public boolean hasNext() {
try {
return source.hasNext(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
@Override
public T next() {
try {
return source.next(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
} } |
public class class_name {
public static void init(final ClassLoader classLoader, final ClassLoader[] propertyLoaders) {
getInstance().classLoader = classLoader;
if(propertyLoaders != null && propertyLoaders.length != 0) {
Map<Integer, ClassLoader> loaderMap = new HashMap<>();
for(ClassLoader propertyLoader : propertyLoaders) {
loaderMap.put(propertyLoader.hashCode(), propertyLoader);
}
getInstance().ognlContext = new OgnlContext(loaderMap);
getInstance().ognlContext.setMemberAccess(new DefaultMemberAccess(true));
getInstance().ognlContext.setClassResolver(new MultipleLoaderClassResolver());
}
} } | public class class_name {
public static void init(final ClassLoader classLoader, final ClassLoader[] propertyLoaders) {
getInstance().classLoader = classLoader;
if(propertyLoaders != null && propertyLoaders.length != 0) {
Map<Integer, ClassLoader> loaderMap = new HashMap<>();
for(ClassLoader propertyLoader : propertyLoaders) {
loaderMap.put(propertyLoader.hashCode(), propertyLoader);
// depends on control dependency: [for], data = [propertyLoader]
}
getInstance().ognlContext = new OgnlContext(loaderMap);
// depends on control dependency: [if], data = [none]
getInstance().ognlContext.setMemberAccess(new DefaultMemberAccess(true));
// depends on control dependency: [if], data = [none]
getInstance().ognlContext.setClassResolver(new MultipleLoaderClassResolver());
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void warning(int no, String msg, ILexLocation location)
{
VDMWarning vdmwarning = new VDMWarning(no, msg, location);
warnings.add(vdmwarning);
if (warnings.size() >= MAX - 1)
{
errors.add(new VDMError(9, "Too many warnings", location));
throw new InternalException(9, "Too many warnings");
}
} } | public class class_name {
protected void warning(int no, String msg, ILexLocation location)
{
VDMWarning vdmwarning = new VDMWarning(no, msg, location);
warnings.add(vdmwarning);
if (warnings.size() >= MAX - 1)
{
errors.add(new VDMError(9, "Too many warnings", location)); // depends on control dependency: [if], data = [none]
throw new InternalException(9, "Too many warnings");
}
} } |
public class class_name {
public static Object evaluateExpression(Node node, String xPathExpression, NamespaceContext nsContext, QName returnType) {
try {
return buildExpression(xPathExpression, nsContext).evaluate(node, returnType);
} catch (XPathExpressionException e) {
throw new CitrusRuntimeException("Can not evaluate xpath expression '" + xPathExpression + "'", e);
}
} } | public class class_name {
public static Object evaluateExpression(Node node, String xPathExpression, NamespaceContext nsContext, QName returnType) {
try {
return buildExpression(xPathExpression, nsContext).evaluate(node, returnType); // depends on control dependency: [try], data = [none]
} catch (XPathExpressionException e) {
throw new CitrusRuntimeException("Can not evaluate xpath expression '" + xPathExpression + "'", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected static void iniRole(CmsObject cms, String ou, ComboBox roleComboBox, Log log) {
try {
List<CmsRole> roles = OpenCms.getRoleManager().getRoles(cms, ou, false);
CmsRole.applySystemRoleOrder(roles);
IndexedContainer container = new IndexedContainer();
container.addContainerProperty("caption", String.class, "");
for (CmsRole role : roles) {
Item item = container.addItem(role);
item.getItemProperty("caption").setValue(role.getDisplayName(cms, A_CmsUI.get().getLocale()));
}
roleComboBox.setContainerDataSource(container);
roleComboBox.setItemCaptionPropertyId("caption");
roleComboBox.setNullSelectionAllowed(false);
roleComboBox.setNewItemsAllowed(false);
} catch (CmsException e) {
if (log != null) {
log.error("Unable to read roles.", e);
}
}
} } | public class class_name {
protected static void iniRole(CmsObject cms, String ou, ComboBox roleComboBox, Log log) {
try {
List<CmsRole> roles = OpenCms.getRoleManager().getRoles(cms, ou, false);
CmsRole.applySystemRoleOrder(roles); // depends on control dependency: [try], data = [none]
IndexedContainer container = new IndexedContainer();
container.addContainerProperty("caption", String.class, ""); // depends on control dependency: [try], data = [none]
for (CmsRole role : roles) {
Item item = container.addItem(role);
item.getItemProperty("caption").setValue(role.getDisplayName(cms, A_CmsUI.get().getLocale())); // depends on control dependency: [for], data = [role]
}
roleComboBox.setContainerDataSource(container); // depends on control dependency: [try], data = [none]
roleComboBox.setItemCaptionPropertyId("caption"); // depends on control dependency: [try], data = [none]
roleComboBox.setNullSelectionAllowed(false); // depends on control dependency: [try], data = [none]
roleComboBox.setNewItemsAllowed(false); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
if (log != null) {
log.error("Unable to read roles.", e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void insertLeafEntry(E entry) {
lastInsertedEntry = entry;
// choose subtree for insertion
IndexTreePath<E> subtree = choosePath(getRootPath(), entry, height, 1);
if(getLogger().isDebugging()) {
getLogger().debugFine("insertion-subtree " + subtree);
}
N parent = getNode(subtree.getEntry());
parent.addLeafEntry(entry);
writeNode(parent);
// adjust the tree from subtree to root
adjustTree(subtree);
} } | public class class_name {
protected void insertLeafEntry(E entry) {
lastInsertedEntry = entry;
// choose subtree for insertion
IndexTreePath<E> subtree = choosePath(getRootPath(), entry, height, 1);
if(getLogger().isDebugging()) {
getLogger().debugFine("insertion-subtree " + subtree); // depends on control dependency: [if], data = [none]
}
N parent = getNode(subtree.getEntry());
parent.addLeafEntry(entry);
writeNode(parent);
// adjust the tree from subtree to root
adjustTree(subtree);
} } |
public class class_name {
private static long deriveTokenInterval(ImmutableSortedSet<Integer> tokens)
{
long interval = 0;
int count = 4;
int prevToken = Integer.MIN_VALUE;
UnmodifiableIterator<Integer> tokenIter = tokens.iterator();
while (tokenIter.hasNext() && count-- > 0) {
int nextToken = tokenIter.next();
interval = Math.max(interval, nextToken - prevToken);
prevToken = nextToken;
}
return interval;
} } | public class class_name {
private static long deriveTokenInterval(ImmutableSortedSet<Integer> tokens)
{
long interval = 0;
int count = 4;
int prevToken = Integer.MIN_VALUE;
UnmodifiableIterator<Integer> tokenIter = tokens.iterator();
while (tokenIter.hasNext() && count-- > 0) {
int nextToken = tokenIter.next();
interval = Math.max(interval, nextToken - prevToken); // depends on control dependency: [while], data = [none]
prevToken = nextToken; // depends on control dependency: [while], data = [none]
}
return interval;
} } |
public class class_name {
public static SyntacticItem substitute(SyntacticItem item, SyntacticItem from, SyntacticItem to) {
SyntacticItem nItem = substitute(item, from, to, new IdentityHashMap<>());
if(nItem != item) {
item.getHeap().allocate(nItem);
}
return nItem;
} } | public class class_name {
public static SyntacticItem substitute(SyntacticItem item, SyntacticItem from, SyntacticItem to) {
SyntacticItem nItem = substitute(item, from, to, new IdentityHashMap<>());
if(nItem != item) {
item.getHeap().allocate(nItem); // depends on control dependency: [if], data = [(nItem]
}
return nItem;
} } |
public class class_name {
@Override
public long getHiddenExpiryTime()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getHiddenExpiryTime");
SibTr.exit(tc, "getHiddenExpiryTime", Long.valueOf(hiddenExpiryTime));
}
return hiddenExpiryTime;
} } | public class class_name {
@Override
public long getHiddenExpiryTime()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getHiddenExpiryTime"); // depends on control dependency: [if], data = [none]
SibTr.exit(tc, "getHiddenExpiryTime", Long.valueOf(hiddenExpiryTime)); // depends on control dependency: [if], data = [none]
}
return hiddenExpiryTime;
} } |
public class class_name {
protected static Path getPath(int startindex, String[] uriParts) {
Path ret = Paths.get("/");
List<FileSystem> toClose = new ArrayList<FileSystem>();
try {
for (int i = startindex; i < uriParts.length; i++) {
String name = uriParts[i];
if (name.endsWith("!")) {
name = name.substring(0, name.length() - 1);
}
ret = ret.resolve(name);
if (name.endsWith(".jar") || name.endsWith(".war")) {
try (FileSystem jarfs = FileSystems.newFileSystem(ret,
Thread.currentThread().getContextClassLoader())) {
ret = jarfs.getRootDirectories().iterator().next();
} catch (IOException e) {
log.log(Level.SEVERE, "Failed to access archive '" + name + "'", e);
}
}
}
} finally {
for (FileSystem fs : toClose) {
try {
fs.close();
} catch (IOException e) {
log.log(Level.SEVERE, "Failed to close file system '" + fs + "'", e);
}
}
}
return ret;
} } | public class class_name {
protected static Path getPath(int startindex, String[] uriParts) {
Path ret = Paths.get("/");
List<FileSystem> toClose = new ArrayList<FileSystem>();
try {
for (int i = startindex; i < uriParts.length; i++) {
String name = uriParts[i];
if (name.endsWith("!")) {
name = name.substring(0, name.length() - 1); // depends on control dependency: [if], data = [none]
}
ret = ret.resolve(name); // depends on control dependency: [for], data = [none]
if (name.endsWith(".jar") || name.endsWith(".war")) {
try (FileSystem jarfs = FileSystems.newFileSystem(ret,
Thread.currentThread().getContextClassLoader())) {
ret = jarfs.getRootDirectories().iterator().next();
} catch (IOException e) { // depends on control dependency: [try], data = [none]
log.log(Level.SEVERE, "Failed to access archive '" + name + "'", e);
}
}
}
} finally {
for (FileSystem fs : toClose) {
try {
fs.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
log.log(Level.SEVERE, "Failed to close file system '" + fs + "'", e);
} // depends on control dependency: [catch], data = [none]
}
}
return ret;
} } |
public class class_name {
public EClass getSBI() {
if (sbiEClass == null) {
sbiEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(334);
}
return sbiEClass;
} } | public class class_name {
public EClass getSBI() {
if (sbiEClass == null) {
sbiEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(334); // depends on control dependency: [if], data = [none]
}
return sbiEClass;
} } |
public class class_name {
protected ArrayList<Snak> getQualifierList(PropertyIdValue propertyIdValue) {
ArrayList<Snak> result = this.qualifiers.get(propertyIdValue);
if (result == null) {
result = new ArrayList<Snak>();
this.qualifiers.put(propertyIdValue, result);
}
return result;
} } | public class class_name {
protected ArrayList<Snak> getQualifierList(PropertyIdValue propertyIdValue) {
ArrayList<Snak> result = this.qualifiers.get(propertyIdValue);
if (result == null) {
result = new ArrayList<Snak>(); // depends on control dependency: [if], data = [none]
this.qualifiers.put(propertyIdValue, result); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
@Override
public void handleRequest(final Request request) {
super.handleRequest(request);
// Check if window in request
boolean targeted = isPresent(request);
setTargeted(targeted);
if (getState() == ACTIVE_STATE && isTargeted()) {
getComponentModel().wrappedContent.serviceRequest(request);
}
} } | public class class_name {
@Override
public void handleRequest(final Request request) {
super.handleRequest(request);
// Check if window in request
boolean targeted = isPresent(request);
setTargeted(targeted);
if (getState() == ACTIVE_STATE && isTargeted()) {
getComponentModel().wrappedContent.serviceRequest(request); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public Iterator<String> getExcludedValidatorIds()
{
if (_excludedValidatorIdsStack != null && !_excludedValidatorIdsStack.isEmpty())
{
return _excludedValidatorIdsStack.iterator();
}
return null;
} } | public class class_name {
@Override
public Iterator<String> getExcludedValidatorIds()
{
if (_excludedValidatorIdsStack != null && !_excludedValidatorIdsStack.isEmpty())
{
return _excludedValidatorIdsStack.iterator(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
void graphToRDF(String graphName, Map<String, Object> graph) {
// 4.2)
final List<Quad> triples = new ArrayList<Quad>();
// 4.3)
final List<String> subjects = new ArrayList<String>(graph.keySet());
// Collections.sort(subjects);
for (final String id : subjects) {
if (JsonLdUtils.isRelativeIri(id)) {
continue;
}
final Map<String, Object> node = (Map<String, Object>) graph.get(id);
final List<String> properties = new ArrayList<String>(node.keySet());
Collections.sort(properties);
for (String property : properties) {
final List<Object> values;
// 4.3.2.1)
if ("@type".equals(property)) {
values = (List<Object>) node.get("@type");
property = RDF_TYPE;
}
// 4.3.2.2)
else if (isKeyword(property)) {
continue;
}
// 4.3.2.3)
else if (property.startsWith("_:") && !api.opts.getProduceGeneralizedRdf()) {
continue;
}
// 4.3.2.4)
else if (JsonLdUtils.isRelativeIri(property)) {
continue;
} else {
values = (List<Object>) node.get(property);
}
Node subject;
if (id.indexOf("_:") == 0) {
// NOTE: don't rename, just set it as a blank node
subject = new BlankNode(id);
} else {
subject = new IRI(id);
}
// RDF predicates
Node predicate;
if (property.startsWith("_:")) {
predicate = new BlankNode(property);
} else {
predicate = new IRI(property);
}
for (final Object item : values) {
// convert @list to triples
if (isList(item)) {
final List<Object> list = (List<Object>) ((Map<String, Object>) item)
.get("@list");
Node last = null;
Node firstBNode = nil;
if (!list.isEmpty()) {
last = objectToRDF(list.get(list.size() - 1));
firstBNode = new BlankNode(api.generateBlankNodeIdentifier());
}
triples.add(new Quad(subject, predicate, firstBNode, graphName));
for (int i = 0; i < list.size() - 1; i++) {
final Node object = objectToRDF(list.get(i));
triples.add(new Quad(firstBNode, first, object, graphName));
final Node restBNode = new BlankNode(api.generateBlankNodeIdentifier());
triples.add(new Quad(firstBNode, rest, restBNode, graphName));
firstBNode = restBNode;
}
if (last != null) {
triples.add(new Quad(firstBNode, first, last, graphName));
triples.add(new Quad(firstBNode, rest, nil, graphName));
}
}
// convert value or node object to triple
else {
final Node object = objectToRDF(item);
if (object != null) {
triples.add(new Quad(subject, predicate, object, graphName));
}
}
}
}
}
put(graphName, triples);
} } | public class class_name {
void graphToRDF(String graphName, Map<String, Object> graph) {
// 4.2)
final List<Quad> triples = new ArrayList<Quad>();
// 4.3)
final List<String> subjects = new ArrayList<String>(graph.keySet());
// Collections.sort(subjects);
for (final String id : subjects) {
if (JsonLdUtils.isRelativeIri(id)) {
continue;
}
final Map<String, Object> node = (Map<String, Object>) graph.get(id);
final List<String> properties = new ArrayList<String>(node.keySet());
Collections.sort(properties); // depends on control dependency: [for], data = [none]
for (String property : properties) {
final List<Object> values;
// 4.3.2.1)
if ("@type".equals(property)) {
values = (List<Object>) node.get("@type"); // depends on control dependency: [if], data = [none]
property = RDF_TYPE; // depends on control dependency: [if], data = [none]
}
// 4.3.2.2)
else if (isKeyword(property)) {
continue;
}
// 4.3.2.3)
else if (property.startsWith("_:") && !api.opts.getProduceGeneralizedRdf()) {
continue;
}
// 4.3.2.4)
else if (JsonLdUtils.isRelativeIri(property)) {
continue;
} else {
values = (List<Object>) node.get(property); // depends on control dependency: [if], data = [none]
}
Node subject;
if (id.indexOf("_:") == 0) {
// NOTE: don't rename, just set it as a blank node
subject = new BlankNode(id); // depends on control dependency: [if], data = [none]
} else {
subject = new IRI(id); // depends on control dependency: [if], data = [none]
}
// RDF predicates
Node predicate;
if (property.startsWith("_:")) {
predicate = new BlankNode(property); // depends on control dependency: [if], data = [none]
} else {
predicate = new IRI(property); // depends on control dependency: [if], data = [none]
}
for (final Object item : values) {
// convert @list to triples
if (isList(item)) {
final List<Object> list = (List<Object>) ((Map<String, Object>) item)
.get("@list");
Node last = null;
Node firstBNode = nil;
if (!list.isEmpty()) {
last = objectToRDF(list.get(list.size() - 1)); // depends on control dependency: [if], data = [none]
firstBNode = new BlankNode(api.generateBlankNodeIdentifier()); // depends on control dependency: [if], data = [none]
}
triples.add(new Quad(subject, predicate, firstBNode, graphName)); // depends on control dependency: [if], data = [none]
for (int i = 0; i < list.size() - 1; i++) {
final Node object = objectToRDF(list.get(i));
triples.add(new Quad(firstBNode, first, object, graphName)); // depends on control dependency: [for], data = [none]
final Node restBNode = new BlankNode(api.generateBlankNodeIdentifier());
triples.add(new Quad(firstBNode, rest, restBNode, graphName)); // depends on control dependency: [for], data = [none]
firstBNode = restBNode; // depends on control dependency: [for], data = [none]
}
if (last != null) {
triples.add(new Quad(firstBNode, first, last, graphName)); // depends on control dependency: [if], data = [none]
triples.add(new Quad(firstBNode, rest, nil, graphName)); // depends on control dependency: [if], data = [none]
}
}
// convert value or node object to triple
else {
final Node object = objectToRDF(item);
if (object != null) {
triples.add(new Quad(subject, predicate, object, graphName)); // depends on control dependency: [if], data = [none]
}
}
}
}
}
put(graphName, triples);
} } |
public class class_name {
public EClass getIfcPerformanceHistory() {
if (ifcPerformanceHistoryEClass == null) {
ifcPerformanceHistoryEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(346);
}
return ifcPerformanceHistoryEClass;
} } | public class class_name {
public EClass getIfcPerformanceHistory() {
if (ifcPerformanceHistoryEClass == null) {
ifcPerformanceHistoryEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(346);
// depends on control dependency: [if], data = [none]
}
return ifcPerformanceHistoryEClass;
} } |
public class class_name {
@Override
public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(final Map<String, List<Object>> seed,
final IPersonAttributeDaoFilter filter) {
Validate.notNull(seed, "Argument 'seed' cannot be null.");
for (final AttributeRule rule : this.rules) {
if (rule.appliesTo(seed)) {
if (logger.isDebugEnabled()) {
logger.debug("Evaluating rule='" + rule + "' from the rules List");
}
return rule.evaluate(seed);
}
}
return null;
} } | public class class_name {
@Override
public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(final Map<String, List<Object>> seed,
final IPersonAttributeDaoFilter filter) {
Validate.notNull(seed, "Argument 'seed' cannot be null.");
for (final AttributeRule rule : this.rules) {
if (rule.appliesTo(seed)) {
if (logger.isDebugEnabled()) {
logger.debug("Evaluating rule='" + rule + "' from the rules List"); // depends on control dependency: [if], data = [none]
}
return rule.evaluate(seed); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static Method findMethod(Class<?> clazz, String methodName) {
Method[] candidates = clazz.getDeclaredMethods();
for (int i = 0; i < candidates.length; i++) {
Method candidate = candidates[i];
if (candidate.getName().equals(methodName)) {
return candidate;
}
}
if (clazz.getSuperclass() != null) {
return findMethod(clazz.getSuperclass(), methodName);
}
return null;
} } | public class class_name {
public static Method findMethod(Class<?> clazz, String methodName) {
Method[] candidates = clazz.getDeclaredMethods();
for (int i = 0; i < candidates.length; i++) {
Method candidate = candidates[i];
if (candidate.getName().equals(methodName)) {
return candidate; // depends on control dependency: [if], data = [none]
}
}
if (clazz.getSuperclass() != null) {
return findMethod(clazz.getSuperclass(), methodName); // depends on control dependency: [if], data = [(clazz.getSuperclass()]
}
return null;
} } |
public class class_name {
private DefaultLdapAuthoritiesPopulator create() {
DefaultLdapAuthoritiesPopulator populator = new DefaultLdapAuthoritiesPopulator(
initialDirContextFactory, groupSearchBase);
populator.setConvertToUpperCase(convertToUpperCase);
if (defaultRole != null) {
populator.setDefaultRole(defaultRole);
}
populator.setGroupRoleAttribute(groupRoleAttribute);
populator.setGroupSearchFilter(groupSearchFilter);
populator.setRolePrefix(rolePrefix);
populator.setSearchSubtree(searchSubtree);
return populator;
} } | public class class_name {
private DefaultLdapAuthoritiesPopulator create() {
DefaultLdapAuthoritiesPopulator populator = new DefaultLdapAuthoritiesPopulator(
initialDirContextFactory, groupSearchBase);
populator.setConvertToUpperCase(convertToUpperCase);
if (defaultRole != null) {
populator.setDefaultRole(defaultRole); // depends on control dependency: [if], data = [(defaultRole]
}
populator.setGroupRoleAttribute(groupRoleAttribute);
populator.setGroupSearchFilter(groupSearchFilter);
populator.setRolePrefix(rolePrefix);
populator.setSearchSubtree(searchSubtree);
return populator;
} } |
public class class_name {
public Clustering<Model> run(Relation<V> rel) {
fulldatabase = preprocess(rel);
processedIDs = DBIDUtil.newHashSet(fulldatabase.size());
noiseDim = dimensionality(fulldatabase);
FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress("CASH Clustering", fulldatabase.size(), LOG) : null;
Clustering<Model> result = doRun(fulldatabase, progress);
LOG.ensureCompleted(progress);
if(LOG.isVerbose()) {
StringBuilder msg = new StringBuilder(1000);
for(Cluster<Model> c : result.getAllClusters()) {
if(c.getModel() instanceof LinearEquationModel) {
LinearEquationModel s = (LinearEquationModel) c.getModel();
msg.append("\n Cluster: Dim: " + s.getLes().subspacedim() + " size: " + c.size());
}
else {
msg.append("\n Cluster: " + c.getModel().getClass().getName() + " size: " + c.size());
}
}
LOG.verbose(msg.toString());
}
return result;
} } | public class class_name {
public Clustering<Model> run(Relation<V> rel) {
fulldatabase = preprocess(rel);
processedIDs = DBIDUtil.newHashSet(fulldatabase.size());
noiseDim = dimensionality(fulldatabase);
FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress("CASH Clustering", fulldatabase.size(), LOG) : null;
Clustering<Model> result = doRun(fulldatabase, progress);
LOG.ensureCompleted(progress);
if(LOG.isVerbose()) {
StringBuilder msg = new StringBuilder(1000);
for(Cluster<Model> c : result.getAllClusters()) {
if(c.getModel() instanceof LinearEquationModel) {
LinearEquationModel s = (LinearEquationModel) c.getModel();
msg.append("\n Cluster: Dim: " + s.getLes().subspacedim() + " size: " + c.size()); // depends on control dependency: [if], data = [none]
}
else {
msg.append("\n Cluster: " + c.getModel().getClass().getName() + " size: " + c.size()); // depends on control dependency: [if], data = [none]
}
}
LOG.verbose(msg.toString()); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public void marshall(DeleteResourceRequest deleteResourceRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteResourceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteResourceRequest.getOrganizationId(), ORGANIZATIONID_BINDING);
protocolMarshaller.marshall(deleteResourceRequest.getResourceId(), RESOURCEID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteResourceRequest deleteResourceRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteResourceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteResourceRequest.getOrganizationId(), ORGANIZATIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteResourceRequest.getResourceId(), RESOURCEID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Double getCollisionX(CollisionRange range, CollisionFunction function, double x, double y, int offsetX)
{
final double yOnTile = getInputValue(Axis.Y, x, y);
if (UtilMath.isBetween(yOnTile, range.getMinY(), range.getMaxY()))
{
final double xOnTile = getInputValue(Axis.X, x, y);
final double result = Math.floor(function.compute(yOnTile));
if (UtilMath.isBetween(xOnTile, result + range.getMinX() - 1, result + range.getMaxX()))
{
final double coll = Math.floor(tile.getX() + result - offsetX);
return Double.valueOf(coll);
}
}
return null;
} } | public class class_name {
private Double getCollisionX(CollisionRange range, CollisionFunction function, double x, double y, int offsetX)
{
final double yOnTile = getInputValue(Axis.Y, x, y);
if (UtilMath.isBetween(yOnTile, range.getMinY(), range.getMaxY()))
{
final double xOnTile = getInputValue(Axis.X, x, y);
final double result = Math.floor(function.compute(yOnTile));
if (UtilMath.isBetween(xOnTile, result + range.getMinX() - 1, result + range.getMaxX()))
{
final double coll = Math.floor(tile.getX() + result - offsetX);
return Double.valueOf(coll); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@Override
public Builder audience(List<String> newaudiences) throws InvalidClaimException {
// this.AUDIENCE
if (newaudiences != null && !newaudiences.isEmpty()) {
ArrayList<String> audiences = new ArrayList<String>();
for (String aud : newaudiences) {
if (aud != null && !aud.trim().isEmpty() && !audiences.contains(aud)) {
audiences.add(aud);
}
}
if (audiences.isEmpty()) {
String err = Tr.formatMessage(tc, "JWT_INVALID_CLAIM_VALUE_ERR", new Object[] { Claims.AUDIENCE, newaudiences });
throw new InvalidClaimException(err);
}
// this.audiences = new ArrayList<String>(audiences);
claims.put(Claims.AUDIENCE, audiences);
} else {
String err = Tr.formatMessage(tc, "JWT_INVALID_CLAIM_VALUE_ERR", new Object[] { Claims.AUDIENCE, newaudiences });
throw new InvalidClaimException(err);
}
return this;
} } | public class class_name {
@Override
public Builder audience(List<String> newaudiences) throws InvalidClaimException {
// this.AUDIENCE
if (newaudiences != null && !newaudiences.isEmpty()) {
ArrayList<String> audiences = new ArrayList<String>();
for (String aud : newaudiences) {
if (aud != null && !aud.trim().isEmpty() && !audiences.contains(aud)) {
audiences.add(aud); // depends on control dependency: [if], data = [(aud]
}
}
if (audiences.isEmpty()) {
String err = Tr.formatMessage(tc, "JWT_INVALID_CLAIM_VALUE_ERR", new Object[] { Claims.AUDIENCE, newaudiences });
throw new InvalidClaimException(err);
}
// this.audiences = new ArrayList<String>(audiences);
claims.put(Claims.AUDIENCE, audiences);
} else {
String err = Tr.formatMessage(tc, "JWT_INVALID_CLAIM_VALUE_ERR", new Object[] { Claims.AUDIENCE, newaudiences });
throw new InvalidClaimException(err);
}
return this;
} } |
public class class_name {
@Override
public void cacheResult(List<CommerceWishListItem> commerceWishListItems) {
for (CommerceWishListItem commerceWishListItem : commerceWishListItems) {
if (entityCache.getResult(
CommerceWishListItemModelImpl.ENTITY_CACHE_ENABLED,
CommerceWishListItemImpl.class,
commerceWishListItem.getPrimaryKey()) == null) {
cacheResult(commerceWishListItem);
}
else {
commerceWishListItem.resetOriginalValues();
}
}
} } | public class class_name {
@Override
public void cacheResult(List<CommerceWishListItem> commerceWishListItems) {
for (CommerceWishListItem commerceWishListItem : commerceWishListItems) {
if (entityCache.getResult(
CommerceWishListItemModelImpl.ENTITY_CACHE_ENABLED,
CommerceWishListItemImpl.class,
commerceWishListItem.getPrimaryKey()) == null) {
cacheResult(commerceWishListItem); // depends on control dependency: [if], data = [none]
}
else {
commerceWishListItem.resetOriginalValues(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private SkeletonAndItsBestMatch genIntervalPattern(
int field, String skeleton, String bestSkeleton,
int differenceInfo, Map<String, PatternInfo> intervalPatterns) {
SkeletonAndItsBestMatch retValue = null;
PatternInfo pattern = fInfo.getIntervalPattern(
bestSkeleton, field);
if ( pattern == null ) {
// single date
if ( SimpleDateFormat.isFieldUnitIgnored(bestSkeleton, field) ) {
PatternInfo ptnInfo =
new PatternInfo(fDateFormat.toPattern(),
null,
fInfo.getDefaultOrder());
intervalPatterns.put(DateIntervalInfo.
CALENDAR_FIELD_TO_PATTERN_LETTER[field], ptnInfo);
return null;
}
// for 24 hour system, interval patterns in resource file
// might not include pattern when am_pm differ,
// which should be the same as hour differ.
// add it here for simplicity
if ( field == Calendar.AM_PM ) {
pattern = fInfo.getIntervalPattern(bestSkeleton,
Calendar.HOUR);
if ( pattern != null ) {
// share
intervalPatterns.put(DateIntervalInfo.
CALENDAR_FIELD_TO_PATTERN_LETTER[field],
pattern);
}
return null;
}
// else, looking for pattern when 'y' differ for 'dMMMM' skeleton,
// first, get best match pattern "MMMd",
// since there is no pattern for 'y' differs for skeleton 'MMMd',
// need to look for it from skeleton 'yMMMd',
// if found, adjust field width in interval pattern from
// "MMM" to "MMMM".
String fieldLetter =
DateIntervalInfo.CALENDAR_FIELD_TO_PATTERN_LETTER[field];
bestSkeleton = fieldLetter + bestSkeleton;
skeleton = fieldLetter + skeleton;
// for example, looking for patterns when 'y' differ for
// skeleton "MMMM".
pattern = fInfo.getIntervalPattern(bestSkeleton, field);
if ( pattern == null && differenceInfo == 0 ) {
// if there is no skeleton "yMMMM" defined,
// look for the best match skeleton, for example: "yMMM"
BestMatchInfo tmpRetValue = fInfo.getBestSkeleton(skeleton);
String tmpBestSkeleton = tmpRetValue.bestMatchSkeleton;
differenceInfo = tmpRetValue.bestMatchDistanceInfo;
if ( tmpBestSkeleton.length() != 0 && differenceInfo != -1 ) {
pattern = fInfo.getIntervalPattern(tmpBestSkeleton, field);
bestSkeleton = tmpBestSkeleton;
}
}
if ( pattern != null ) {
retValue = new SkeletonAndItsBestMatch(skeleton, bestSkeleton);
}
}
if ( pattern != null ) {
if ( differenceInfo != 0 ) {
String part1 = adjustFieldWidth(skeleton, bestSkeleton,
pattern.getFirstPart(), differenceInfo);
String part2 = adjustFieldWidth(skeleton, bestSkeleton,
pattern.getSecondPart(), differenceInfo);
pattern = new PatternInfo(part1, part2,
pattern.firstDateInPtnIsLaterDate());
} else {
// pattern is immutable, no need to clone;
// pattern = (PatternInfo)pattern.clone();
}
intervalPatterns.put(
DateIntervalInfo.CALENDAR_FIELD_TO_PATTERN_LETTER[field], pattern);
}
return retValue;
} } | public class class_name {
private SkeletonAndItsBestMatch genIntervalPattern(
int field, String skeleton, String bestSkeleton,
int differenceInfo, Map<String, PatternInfo> intervalPatterns) {
SkeletonAndItsBestMatch retValue = null;
PatternInfo pattern = fInfo.getIntervalPattern(
bestSkeleton, field);
if ( pattern == null ) {
// single date
if ( SimpleDateFormat.isFieldUnitIgnored(bestSkeleton, field) ) {
PatternInfo ptnInfo =
new PatternInfo(fDateFormat.toPattern(),
null,
fInfo.getDefaultOrder());
intervalPatterns.put(DateIntervalInfo.
CALENDAR_FIELD_TO_PATTERN_LETTER[field], ptnInfo); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
// for 24 hour system, interval patterns in resource file
// might not include pattern when am_pm differ,
// which should be the same as hour differ.
// add it here for simplicity
if ( field == Calendar.AM_PM ) {
pattern = fInfo.getIntervalPattern(bestSkeleton,
Calendar.HOUR); // depends on control dependency: [if], data = [none]
if ( pattern != null ) {
// share
intervalPatterns.put(DateIntervalInfo.
CALENDAR_FIELD_TO_PATTERN_LETTER[field],
pattern); // depends on control dependency: [if], data = [none]
}
return null; // depends on control dependency: [if], data = [none]
}
// else, looking for pattern when 'y' differ for 'dMMMM' skeleton,
// first, get best match pattern "MMMd",
// since there is no pattern for 'y' differs for skeleton 'MMMd',
// need to look for it from skeleton 'yMMMd',
// if found, adjust field width in interval pattern from
// "MMM" to "MMMM".
String fieldLetter =
DateIntervalInfo.CALENDAR_FIELD_TO_PATTERN_LETTER[field];
bestSkeleton = fieldLetter + bestSkeleton; // depends on control dependency: [if], data = [none]
skeleton = fieldLetter + skeleton; // depends on control dependency: [if], data = [none]
// for example, looking for patterns when 'y' differ for
// skeleton "MMMM".
pattern = fInfo.getIntervalPattern(bestSkeleton, field); // depends on control dependency: [if], data = [none]
if ( pattern == null && differenceInfo == 0 ) {
// if there is no skeleton "yMMMM" defined,
// look for the best match skeleton, for example: "yMMM"
BestMatchInfo tmpRetValue = fInfo.getBestSkeleton(skeleton);
String tmpBestSkeleton = tmpRetValue.bestMatchSkeleton;
differenceInfo = tmpRetValue.bestMatchDistanceInfo; // depends on control dependency: [if], data = [none]
if ( tmpBestSkeleton.length() != 0 && differenceInfo != -1 ) {
pattern = fInfo.getIntervalPattern(tmpBestSkeleton, field); // depends on control dependency: [if], data = [none]
bestSkeleton = tmpBestSkeleton; // depends on control dependency: [if], data = [none]
}
}
if ( pattern != null ) {
retValue = new SkeletonAndItsBestMatch(skeleton, bestSkeleton); // depends on control dependency: [if], data = [none]
}
}
if ( pattern != null ) {
if ( differenceInfo != 0 ) {
String part1 = adjustFieldWidth(skeleton, bestSkeleton,
pattern.getFirstPart(), differenceInfo);
String part2 = adjustFieldWidth(skeleton, bestSkeleton,
pattern.getSecondPart(), differenceInfo);
pattern = new PatternInfo(part1, part2,
pattern.firstDateInPtnIsLaterDate()); // depends on control dependency: [if], data = [none]
} else {
// pattern is immutable, no need to clone;
// pattern = (PatternInfo)pattern.clone();
}
intervalPatterns.put(
DateIntervalInfo.CALENDAR_FIELD_TO_PATTERN_LETTER[field], pattern); // depends on control dependency: [if], data = [none]
}
return retValue;
} } |
public class class_name {
public final void setText(@Nullable final String text) {
boolean hasDisabledDependents = shouldDisableDependents();
this.text = text;
persistString(text);
boolean isDisablingDependents = shouldDisableDependents();
if (isDisablingDependents != hasDisabledDependents) {
notifyDependencyChange(isDisablingDependents);
}
notifyChanged();
} } | public class class_name {
public final void setText(@Nullable final String text) {
boolean hasDisabledDependents = shouldDisableDependents();
this.text = text;
persistString(text);
boolean isDisablingDependents = shouldDisableDependents();
if (isDisablingDependents != hasDisabledDependents) {
notifyDependencyChange(isDisablingDependents); // depends on control dependency: [if], data = [(isDisablingDependents]
}
notifyChanged();
} } |
public class class_name {
public static ExpectedCondition<WebElement> visibilityOfOneOfElementsLocatedBy(final By locator) {
return new ExpectedCondition<WebElement>() {
@Override
public WebElement apply(WebDriver driver) {
for (WebElement element : driver.findElements(locator)) {
if (element.isDisplayed()) {
return element;
}
}
return null;
}
@Override
public String toString() {
return "visibility of one of the elements located by " + locator;
}
};
} } | public class class_name {
public static ExpectedCondition<WebElement> visibilityOfOneOfElementsLocatedBy(final By locator) {
return new ExpectedCondition<WebElement>() {
@Override
public WebElement apply(WebDriver driver) {
for (WebElement element : driver.findElements(locator)) {
if (element.isDisplayed()) {
return element; // depends on control dependency: [if], data = [none]
}
}
return null;
}
@Override
public String toString() {
return "visibility of one of the elements located by " + locator;
}
};
} } |
public class class_name {
public boolean startUpdates(boolean getPreviousUpdates) {
if(updateManager == null) updateManager = new RequestUpdatesManager(this, getPreviousUpdates);
if(!updateManager.isRunning()) {
updateManager.startUpdates();
return true;
}
return false;
} } | public class class_name {
public boolean startUpdates(boolean getPreviousUpdates) {
if(updateManager == null) updateManager = new RequestUpdatesManager(this, getPreviousUpdates);
if(!updateManager.isRunning()) {
updateManager.startUpdates(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
@Override
public void stopped() {
// Close the cache manager
if (cacheManager != null) {
try {
cacheManager.close();
} catch (Exception ignored) {
}
cacheManager = null;
}
// Clear partitions
final long stamp = lock.writeLock();
try {
partitions.clear();
} finally {
lock.unlockWrite(stamp);
}
} } | public class class_name {
@Override
public void stopped() {
// Close the cache manager
if (cacheManager != null) {
try {
cacheManager.close();
// depends on control dependency: [try], data = [none]
} catch (Exception ignored) {
}
// depends on control dependency: [catch], data = [none]
cacheManager = null;
// depends on control dependency: [if], data = [none]
}
// Clear partitions
final long stamp = lock.writeLock();
try {
partitions.clear();
// depends on control dependency: [try], data = [none]
} finally {
lock.unlockWrite(stamp);
}
} } |
public class class_name {
public void advertiseSelf(TrustGraphAdvertisement message) {
/*
* Choose the route length and number of neighbors to
* advertise to based on the number of neighbors this
* node has. The product of these two values determines
* the intended reach. The route length is bounded by
* the minimum and maximum route length paramters and the
* number of neighbors is bounded by the degree.
*
* If there are more neighbors available than are needed,
* the random ordering kept by the routing table is used
* to select the subset to advertise to.
*
* If there are too many neighbors to use (ie more than
* reach/min route len) The largest subset of neighbors
* is chosen and each is sent a route approximately
* reach/min in length.
*
* TR2008-918 does not explicitly outline how to allocate
* inexact divisions of route length or what to do in the
* case that neither boundary condition is violated.
*
* This implementation assumes that all neighbors should
* be advertised to and that the strategy for allocating
* route lengths to sum to the intended reach should
* be repeatable in keeping with the intent of the
* limited advertisement.
*
*/
final int idealReach = getIdealReach();
final int minRouteLength = getMinRouteLength();
final int maxRouteLength = getMaxRouteLength();
final List<TrustGraphNodeId> neighbors =
getRoutingTable().getOrderedNeighbors();
final int neighborCount = neighbors.size();
/* if there are not enough neighbors to reach the
* ideal number with maximum route length per neighbor,
* just use them all.
*/
if ( neighborCount * maxRouteLength < idealReach ) {
for (TrustGraphNodeId n : neighbors) {
sendAdvertisement(message, n, maxRouteLength);
}
}
/* Otherwise, use as many neigbors as possible.
* The number of usable neighbors is bounded above
* by idealReach/minRouteLength.
*/
else {
// use as many neighbors as possible
final int routes;
// too many neighbors, if all were used at min route length
if (neighborCount * minRouteLength > idealReach ) {
routes = idealReach / minRouteLength;
}
// can use all
else {
routes = neighborCount;
}
/* distribute route lengths between min and max that sum to
* idealReach.
*
* floor(idealReach/routes is the base length of each route, and
* any remainder is spread out as one extra hop on each of the
* first 'remainder' routes.
*/
final int stdLen = idealReach / routes;
final int remainder = idealReach % routes;
/* send the actual adverstisements. Use the first 'routes' neighbors
* in the random ordering assigned by the routing table.
*/
Iterator<TrustGraphNodeId> it = neighbors.iterator();
for (int i = 0; i < routes; i++) {
int routeLength = stdLen;
if (i < remainder) {
routeLength += 1;
}
sendAdvertisement(message, it.next(), routeLength);
}
}
} } | public class class_name {
public void advertiseSelf(TrustGraphAdvertisement message) {
/*
* Choose the route length and number of neighbors to
* advertise to based on the number of neighbors this
* node has. The product of these two values determines
* the intended reach. The route length is bounded by
* the minimum and maximum route length paramters and the
* number of neighbors is bounded by the degree.
*
* If there are more neighbors available than are needed,
* the random ordering kept by the routing table is used
* to select the subset to advertise to.
*
* If there are too many neighbors to use (ie more than
* reach/min route len) The largest subset of neighbors
* is chosen and each is sent a route approximately
* reach/min in length.
*
* TR2008-918 does not explicitly outline how to allocate
* inexact divisions of route length or what to do in the
* case that neither boundary condition is violated.
*
* This implementation assumes that all neighbors should
* be advertised to and that the strategy for allocating
* route lengths to sum to the intended reach should
* be repeatable in keeping with the intent of the
* limited advertisement.
*
*/
final int idealReach = getIdealReach();
final int minRouteLength = getMinRouteLength();
final int maxRouteLength = getMaxRouteLength();
final List<TrustGraphNodeId> neighbors =
getRoutingTable().getOrderedNeighbors();
final int neighborCount = neighbors.size();
/* if there are not enough neighbors to reach the
* ideal number with maximum route length per neighbor,
* just use them all.
*/
if ( neighborCount * maxRouteLength < idealReach ) {
for (TrustGraphNodeId n : neighbors) {
sendAdvertisement(message, n, maxRouteLength); // depends on control dependency: [for], data = [n]
}
}
/* Otherwise, use as many neigbors as possible.
* The number of usable neighbors is bounded above
* by idealReach/minRouteLength.
*/
else {
// use as many neighbors as possible
final int routes;
// too many neighbors, if all were used at min route length
if (neighborCount * minRouteLength > idealReach ) {
routes = idealReach / minRouteLength; // depends on control dependency: [if], data = [none]
}
// can use all
else {
routes = neighborCount; // depends on control dependency: [if], data = [none]
}
/* distribute route lengths between min and max that sum to
* idealReach.
*
* floor(idealReach/routes is the base length of each route, and
* any remainder is spread out as one extra hop on each of the
* first 'remainder' routes.
*/
final int stdLen = idealReach / routes;
final int remainder = idealReach % routes;
/* send the actual adverstisements. Use the first 'routes' neighbors
* in the random ordering assigned by the routing table.
*/
Iterator<TrustGraphNodeId> it = neighbors.iterator();
for (int i = 0; i < routes; i++) {
int routeLength = stdLen;
if (i < remainder) {
routeLength += 1; // depends on control dependency: [if], data = [none]
}
sendAdvertisement(message, it.next(), routeLength); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public static DServerClass instance()
{
if (_instance == null)
{
System.err.println("DServerClass is not initialised !!!");
System.err.println("Exiting");
System.exit(-1);
}
return _instance;
} } | public class class_name {
public static DServerClass instance()
{
if (_instance == null)
{
System.err.println("DServerClass is not initialised !!!"); // depends on control dependency: [if], data = [none]
System.err.println("Exiting"); // depends on control dependency: [if], data = [none]
System.exit(-1); // depends on control dependency: [if], data = [none]
}
return _instance;
} } |
public class class_name {
public void sendMessage(String message, final Respoke.TaskCompletionListener completionListener) {
if (isActive()) {
JSONObject jsonMessage = new JSONObject();
try {
jsonMessage.put("message", message);
byte[] rawMessage = jsonMessage.toString().getBytes(Charset.forName("UTF-8"));
ByteBuffer directData = ByteBuffer.allocateDirect(rawMessage.length);
directData.put(rawMessage);
directData.flip();
DataChannel.Buffer data = new DataChannel.Buffer(directData, false);
if (dataChannel.send(data)) {
Respoke.postTaskSuccess(completionListener);
} else {
Respoke.postTaskError(completionListener, "Error sending message");
}
} catch (JSONException e) {
Respoke.postTaskError(completionListener, "Unable to encode message to JSON");
}
} else {
Respoke.postTaskError(completionListener, "DataChannel not in an open state");
}
} } | public class class_name {
public void sendMessage(String message, final Respoke.TaskCompletionListener completionListener) {
if (isActive()) {
JSONObject jsonMessage = new JSONObject();
try {
jsonMessage.put("message", message); // depends on control dependency: [try], data = [none]
byte[] rawMessage = jsonMessage.toString().getBytes(Charset.forName("UTF-8"));
ByteBuffer directData = ByteBuffer.allocateDirect(rawMessage.length);
directData.put(rawMessage); // depends on control dependency: [try], data = [none]
directData.flip(); // depends on control dependency: [try], data = [none]
DataChannel.Buffer data = new DataChannel.Buffer(directData, false);
if (dataChannel.send(data)) {
Respoke.postTaskSuccess(completionListener); // depends on control dependency: [if], data = [none]
} else {
Respoke.postTaskError(completionListener, "Error sending message"); // depends on control dependency: [if], data = [none]
}
} catch (JSONException e) {
Respoke.postTaskError(completionListener, "Unable to encode message to JSON");
} // depends on control dependency: [catch], data = [none]
} else {
Respoke.postTaskError(completionListener, "DataChannel not in an open state"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(BatchDisassociateUserStackRequest batchDisassociateUserStackRequest, ProtocolMarshaller protocolMarshaller) {
if (batchDisassociateUserStackRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchDisassociateUserStackRequest.getUserStackAssociations(), USERSTACKASSOCIATIONS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(BatchDisassociateUserStackRequest batchDisassociateUserStackRequest, ProtocolMarshaller protocolMarshaller) {
if (batchDisassociateUserStackRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchDisassociateUserStackRequest.getUserStackAssociations(), USERSTACKASSOCIATIONS_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 int getGeometryType(Connection connection,TableLocation location, String fieldName)
throws SQLException {
if(fieldName==null || fieldName.isEmpty()) {
List<String> geometryFields = getGeometryFields(connection, location);
if(geometryFields.isEmpty()) {
throw new SQLException("The table "+location+" does not contain a Geometry field, " +
"then geometry type cannot be computed");
}
fieldName = geometryFields.get(0);
}
ResultSet geomResultSet = getGeometryColumnsView(connection,location.getCatalog(),location.getSchema(),
location.getTable());
boolean isH2 = JDBCUtilities.isH2DataBase(connection.getMetaData());
while(geomResultSet.next()) {
if(fieldName.isEmpty() || geomResultSet.getString("F_GEOMETRY_COLUMN").equalsIgnoreCase(fieldName)) {
if(isH2) {
return geomResultSet.getInt("GEOMETRY_TYPE");
} else {
return GEOM_TYPE_TO_SFS_CODE.get(geomResultSet.getString("type").toLowerCase());
}
}
}
throw new SQLException("Field not found "+fieldName);
} } | public class class_name {
public static int getGeometryType(Connection connection,TableLocation location, String fieldName)
throws SQLException {
if(fieldName==null || fieldName.isEmpty()) {
List<String> geometryFields = getGeometryFields(connection, location);
if(geometryFields.isEmpty()) {
throw new SQLException("The table "+location+" does not contain a Geometry field, " +
"then geometry type cannot be computed");
}
fieldName = geometryFields.get(0);
}
ResultSet geomResultSet = getGeometryColumnsView(connection,location.getCatalog(),location.getSchema(),
location.getTable());
boolean isH2 = JDBCUtilities.isH2DataBase(connection.getMetaData());
while(geomResultSet.next()) {
if(fieldName.isEmpty() || geomResultSet.getString("F_GEOMETRY_COLUMN").equalsIgnoreCase(fieldName)) {
if(isH2) {
return geomResultSet.getInt("GEOMETRY_TYPE"); // depends on control dependency: [if], data = [none]
} else {
return GEOM_TYPE_TO_SFS_CODE.get(geomResultSet.getString("type").toLowerCase()); // depends on control dependency: [if], data = [none]
}
}
}
throw new SQLException("Field not found "+fieldName);
} } |
public class class_name {
private Vector getDistinctSortedY(Vector distinctY, Vector piecesEachY, ArrayList<TextPiece> wordsOfAPage,
TableCandidate tc) {
int pieceNumThisPage = wordsOfAPage.size();
float x_columnToGetYs = m_docInfo.getMinX();
float endX_columnToGetYs = m_docInfo.getMiddleX();
if ( (tc.isWideTable()==false) && (tc.getCaptionX()>=m_docInfo.getMiddleX())){
x_columnToGetYs = m_docInfo.getMiddleX();
endX_columnToGetYs = m_docInfo.getMaxX();
}
float[] sortY = new float[pieceNumThisPage];
for (int bb=0; bb<pieceNumThisPage; bb++) {
if ( (wordsOfAPage.get(bb).getX()>=x_columnToGetYs) && (wordsOfAPage.get(bb).getEndX()<=endX_columnToGetYs) ) {
sortY[bb]=wordsOfAPage.get(bb).getY();
}
}
Arrays.sort(sortY);
int bb=0; float lastY = 0.0f;
while (bb<pieceNumThisPage) {
if (distinctY.size()>0) lastY =((Float)distinctY.lastElement()).floatValue();
if ( (sortY[bb]-lastY)>=m_docInfo.getAverageLineGap()/2.0)
distinctY.addElement(new Float(sortY[bb]));
bb++;
}
return distinctY;
} } | public class class_name {
private Vector getDistinctSortedY(Vector distinctY, Vector piecesEachY, ArrayList<TextPiece> wordsOfAPage,
TableCandidate tc) {
int pieceNumThisPage = wordsOfAPage.size();
float x_columnToGetYs = m_docInfo.getMinX();
float endX_columnToGetYs = m_docInfo.getMiddleX();
if ( (tc.isWideTable()==false) && (tc.getCaptionX()>=m_docInfo.getMiddleX())){
x_columnToGetYs = m_docInfo.getMiddleX();
// depends on control dependency: [if], data = [none]
endX_columnToGetYs = m_docInfo.getMaxX();
// depends on control dependency: [if], data = [none]
}
float[] sortY = new float[pieceNumThisPage];
for (int bb=0; bb<pieceNumThisPage; bb++) {
if ( (wordsOfAPage.get(bb).getX()>=x_columnToGetYs) && (wordsOfAPage.get(bb).getEndX()<=endX_columnToGetYs) ) {
sortY[bb]=wordsOfAPage.get(bb).getY();
// depends on control dependency: [if], data = [none]
}
}
Arrays.sort(sortY);
int bb=0; float lastY = 0.0f;
while (bb<pieceNumThisPage) {
if (distinctY.size()>0) lastY =((Float)distinctY.lastElement()).floatValue();
if ( (sortY[bb]-lastY)>=m_docInfo.getAverageLineGap()/2.0)
distinctY.addElement(new Float(sortY[bb]));
bb++;
// depends on control dependency: [while], data = [none]
}
return distinctY;
} } |
public class class_name {
public synchronized static void init(boolean forceCreate) {
if (!isInitialized) {
if(processEngines == null) {
// Create new map to store process-engines if current map is null
processEngines = new HashMap<String, ProcessEngine>();
}
ClassLoader classLoader = ReflectUtil.getClassLoader();
Enumeration<URL> resources = null;
try {
resources = classLoader.getResources("camunda.cfg.xml");
} catch (IOException e) {
try {
resources = classLoader.getResources("activiti.cfg.xml");
} catch(IOException ex) {
if(forceCreate) {
throw new ProcessEngineException("problem retrieving camunda.cfg.xml and activiti.cfg.xml resources on the classpath: "+System.getProperty("java.class.path"), ex);
} else {
return;
}
}
}
// Remove duplicated configuration URL's using set. Some classloaders may return identical URL's twice, causing duplicate startups
Set<URL> configUrls = new HashSet<URL>();
while (resources.hasMoreElements()) {
configUrls.add( resources.nextElement() );
}
for (Iterator<URL> iterator = configUrls.iterator(); iterator.hasNext();) {
URL resource = iterator.next();
initProcessEngineFromResource(resource);
}
try {
resources = classLoader.getResources("activiti-context.xml");
} catch (IOException e) {
if(forceCreate) {
throw new ProcessEngineException("problem retrieving activiti-context.xml resources on the classpath: "+System.getProperty("java.class.path"), e);
} else {
return;
}
}
while (resources.hasMoreElements()) {
URL resource = resources.nextElement();
initProcessEngineFromSpringResource(resource);
}
isInitialized = true;
} else {
LOG.processEngineAlreadyInitialized();
}
} } | public class class_name {
public synchronized static void init(boolean forceCreate) {
if (!isInitialized) {
if(processEngines == null) {
// Create new map to store process-engines if current map is null
processEngines = new HashMap<String, ProcessEngine>(); // depends on control dependency: [if], data = [none]
}
ClassLoader classLoader = ReflectUtil.getClassLoader();
Enumeration<URL> resources = null;
try {
resources = classLoader.getResources("camunda.cfg.xml"); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
try {
resources = classLoader.getResources("activiti.cfg.xml"); // depends on control dependency: [try], data = [none]
} catch(IOException ex) {
if(forceCreate) {
throw new ProcessEngineException("problem retrieving camunda.cfg.xml and activiti.cfg.xml resources on the classpath: "+System.getProperty("java.class.path"), ex);
} else {
return; // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
// Remove duplicated configuration URL's using set. Some classloaders may return identical URL's twice, causing duplicate startups
Set<URL> configUrls = new HashSet<URL>();
while (resources.hasMoreElements()) {
configUrls.add( resources.nextElement() ); // depends on control dependency: [while], data = [none]
}
for (Iterator<URL> iterator = configUrls.iterator(); iterator.hasNext();) {
URL resource = iterator.next();
initProcessEngineFromResource(resource); // depends on control dependency: [for], data = [none]
}
try {
resources = classLoader.getResources("activiti-context.xml"); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
if(forceCreate) {
throw new ProcessEngineException("problem retrieving activiti-context.xml resources on the classpath: "+System.getProperty("java.class.path"), e);
} else {
return; // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
while (resources.hasMoreElements()) {
URL resource = resources.nextElement();
initProcessEngineFromSpringResource(resource); // depends on control dependency: [while], data = [none]
}
isInitialized = true; // depends on control dependency: [if], data = [none]
} else {
LOG.processEngineAlreadyInitialized(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void send(TCUniRequest event) throws TCAPSendException {
if (this.previewMode)
return;
if (this.isStructured()) {
throw new TCAPSendException("Structured dialogs do not use Uni");
}
try {
this.dialogLock.lock();
TCUniMessageImpl msg = (TCUniMessageImpl) TcapFactory.createTCUniMessage();
if (event.getApplicationContextName() != null) {
DialogPortion dp = TcapFactory.createDialogPortion();
DialogUniAPDU apdu = TcapFactory.createDialogAPDUUni();
apdu.setDoNotSendProtocolVersion(doNotSendProtocolVersion());
apdu.setApplicationContextName(event.getApplicationContextName());
if (event.getUserInformation() != null) {
apdu.setUserInformation(event.getUserInformation());
}
dp.setUnidirectional(true);
dp.setDialogAPDU(apdu);
msg.setDialogPortion(dp);
}
if (this.scheduledComponentList.size() > 0) {
Component[] componentsToSend = new Component[this.scheduledComponentList.size()];
this.prepareComponents(componentsToSend);
msg.setComponent(componentsToSend);
}
AsnOutputStream aos = new AsnOutputStream();
try {
msg.encode(aos);
if (this.provider.getStack().getStatisticsEnabled()) {
this.provider.getStack().getCounterProviderImpl().updateTcUniSentCount(this);
}
this.provider.send(aos.toByteArray(), event.getReturnMessageOnError(), this.remoteAddress, this.localAddress,
this.seqControl, this.networkId, this.localSsn, this.remotePc);
this.scheduledComponentList.clear();
} catch (Exception e) {
if (logger.isEnabledFor(Level.ERROR)) {
logger.error("Failed to send message: ", e);
}
throw new TCAPSendException("Failed to send TC-Uni message: " + e.getMessage(), e);
} finally {
release();
}
} finally {
this.dialogLock.unlock();
}
} } | public class class_name {
public void send(TCUniRequest event) throws TCAPSendException {
if (this.previewMode)
return;
if (this.isStructured()) {
throw new TCAPSendException("Structured dialogs do not use Uni");
}
try {
this.dialogLock.lock();
TCUniMessageImpl msg = (TCUniMessageImpl) TcapFactory.createTCUniMessage();
if (event.getApplicationContextName() != null) {
DialogPortion dp = TcapFactory.createDialogPortion();
DialogUniAPDU apdu = TcapFactory.createDialogAPDUUni();
apdu.setDoNotSendProtocolVersion(doNotSendProtocolVersion()); // depends on control dependency: [if], data = [none]
apdu.setApplicationContextName(event.getApplicationContextName()); // depends on control dependency: [if], data = [(event.getApplicationContextName()]
if (event.getUserInformation() != null) {
apdu.setUserInformation(event.getUserInformation()); // depends on control dependency: [if], data = [(event.getUserInformation()]
}
dp.setUnidirectional(true); // depends on control dependency: [if], data = [none]
dp.setDialogAPDU(apdu); // depends on control dependency: [if], data = [none]
msg.setDialogPortion(dp); // depends on control dependency: [if], data = [none]
}
if (this.scheduledComponentList.size() > 0) {
Component[] componentsToSend = new Component[this.scheduledComponentList.size()];
this.prepareComponents(componentsToSend); // depends on control dependency: [if], data = [none]
msg.setComponent(componentsToSend); // depends on control dependency: [if], data = [none]
}
AsnOutputStream aos = new AsnOutputStream();
try {
msg.encode(aos); // depends on control dependency: [try], data = [none]
if (this.provider.getStack().getStatisticsEnabled()) {
this.provider.getStack().getCounterProviderImpl().updateTcUniSentCount(this); // depends on control dependency: [if], data = [none]
}
this.provider.send(aos.toByteArray(), event.getReturnMessageOnError(), this.remoteAddress, this.localAddress,
this.seqControl, this.networkId, this.localSsn, this.remotePc); // depends on control dependency: [try], data = [none]
this.scheduledComponentList.clear(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (logger.isEnabledFor(Level.ERROR)) {
logger.error("Failed to send message: ", e); // depends on control dependency: [if], data = [none]
}
throw new TCAPSendException("Failed to send TC-Uni message: " + e.getMessage(), e);
} finally { // depends on control dependency: [catch], data = [none]
release();
}
} finally {
this.dialogLock.unlock();
}
} } |
public class class_name {
protected static GeoJSONObject readParcel(Parcel parcel) {
String json = parcel.readString();
try {
return GeoJSON.parse(json);
}
catch (JSONException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
protected static GeoJSONObject readParcel(Parcel parcel) {
String json = parcel.readString();
try {
return GeoJSON.parse(json); // depends on control dependency: [try], data = [none]
}
catch (JSONException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private int findMin(Comparator comparator, int index, int len)
{
if (index >= heapSize) {
return -1;
}
int limit = Math.min(index, heapSize - len) + len;
int minIndex = index;
for (int i = index + 1; i < limit; i++) {
if (comparator.compare(buf.getInt(i * Integer.BYTES), buf.getInt(minIndex * Integer.BYTES)) < 0) {
minIndex = i;
}
}
return minIndex;
} } | public class class_name {
private int findMin(Comparator comparator, int index, int len)
{
if (index >= heapSize) {
return -1; // depends on control dependency: [if], data = [none]
}
int limit = Math.min(index, heapSize - len) + len;
int minIndex = index;
for (int i = index + 1; i < limit; i++) {
if (comparator.compare(buf.getInt(i * Integer.BYTES), buf.getInt(minIndex * Integer.BYTES)) < 0) {
minIndex = i; // depends on control dependency: [if], data = [none]
}
}
return minIndex;
} } |
public class class_name {
public boolean follows(@NotNull final DayOfTheWeek other) {
Contract.requireArgNotNull("other", other);
if (this == PH || other == PH) {
return false;
}
return this.id == (other.id + 1);
} } | public class class_name {
public boolean follows(@NotNull final DayOfTheWeek other) {
Contract.requireArgNotNull("other", other);
if (this == PH || other == PH) {
return false; // depends on control dependency: [if], data = [none]
}
return this.id == (other.id + 1);
} } |
public class class_name {
private void getGeneralID(final String _complStmt)
throws EFapsException
{
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
final Statement stmt = con.createStatement();
final ResultSet rs = stmt.executeQuery(_complStmt.toString());
while (rs.next()) {
this.generalID = rs.getLong(1);
this.fileName = rs.getString(2);
if (this.fileName != null && !this.fileName.isEmpty()) {
this.fileName = this.fileName.trim();
}
this.fileLength = rs.getLong(3);
for (int i = 0; i < this.exist.length; i++) {
this.exist[i] = rs.getLong(4 + i) > 0;
}
getAdditionalInfo(rs);
}
rs.close();
stmt.close();
} catch (final SQLException e) {
throw new EFapsException(InstanceQuery.class, "executeOneCompleteStmt", e);
}
} } | public class class_name {
private void getGeneralID(final String _complStmt)
throws EFapsException
{
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
final Statement stmt = con.createStatement();
final ResultSet rs = stmt.executeQuery(_complStmt.toString());
while (rs.next()) {
this.generalID = rs.getLong(1); // depends on control dependency: [while], data = [none]
this.fileName = rs.getString(2); // depends on control dependency: [while], data = [none]
if (this.fileName != null && !this.fileName.isEmpty()) {
this.fileName = this.fileName.trim(); // depends on control dependency: [if], data = [none]
}
this.fileLength = rs.getLong(3); // depends on control dependency: [while], data = [none]
for (int i = 0; i < this.exist.length; i++) {
this.exist[i] = rs.getLong(4 + i) > 0; // depends on control dependency: [for], data = [i]
}
getAdditionalInfo(rs); // depends on control dependency: [while], data = [none]
}
rs.close();
stmt.close();
} catch (final SQLException e) {
throw new EFapsException(InstanceQuery.class, "executeOneCompleteStmt", e);
}
} } |
public class class_name {
public void marshall(IncreaseReplicationFactorRequest increaseReplicationFactorRequest, ProtocolMarshaller protocolMarshaller) {
if (increaseReplicationFactorRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(increaseReplicationFactorRequest.getClusterName(), CLUSTERNAME_BINDING);
protocolMarshaller.marshall(increaseReplicationFactorRequest.getNewReplicationFactor(), NEWREPLICATIONFACTOR_BINDING);
protocolMarshaller.marshall(increaseReplicationFactorRequest.getAvailabilityZones(), AVAILABILITYZONES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(IncreaseReplicationFactorRequest increaseReplicationFactorRequest, ProtocolMarshaller protocolMarshaller) {
if (increaseReplicationFactorRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(increaseReplicationFactorRequest.getClusterName(), CLUSTERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(increaseReplicationFactorRequest.getNewReplicationFactor(), NEWREPLICATIONFACTOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(increaseReplicationFactorRequest.getAvailabilityZones(), AVAILABILITYZONES_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 {
@GET
@Path("user")
@Produces(MediaType.APPLICATION_JSON)
@HttpCache
public List<RUserDto> getUsers()
{
DbConn cnx = null;
try
{
cnx = Helpers.getDbSession();
return MetaService.getUsers(cnx);
}
finally
{
Helpers.closeQuietly(cnx);
}
} } | public class class_name {
@GET
@Path("user")
@Produces(MediaType.APPLICATION_JSON)
@HttpCache
public List<RUserDto> getUsers()
{
DbConn cnx = null;
try
{
cnx = Helpers.getDbSession(); // depends on control dependency: [try], data = [none]
return MetaService.getUsers(cnx); // depends on control dependency: [try], data = [none]
}
finally
{
Helpers.closeQuietly(cnx);
}
} } |
public class class_name {
public static RedisClusterManager getInstance(RedisBaseConfig redisBaseConfig) {
if (!CACHE.containsKey(redisBaseConfig)) {
synchronized (lock) {
if (!CACHE.containsKey(redisBaseConfig)) {
CACHE.put(redisBaseConfig, newInstance(redisBaseConfig));
}
}
}
return CACHE.get(redisBaseConfig);
} } | public class class_name {
public static RedisClusterManager getInstance(RedisBaseConfig redisBaseConfig) {
if (!CACHE.containsKey(redisBaseConfig)) {
synchronized (lock) { // depends on control dependency: [if], data = [none]
if (!CACHE.containsKey(redisBaseConfig)) {
CACHE.put(redisBaseConfig, newInstance(redisBaseConfig)); // depends on control dependency: [if], data = [none]
}
}
}
return CACHE.get(redisBaseConfig);
} } |
public class class_name {
@Override
protected void paintComponent(Graphics g) {
final Graphics2D G2 = (Graphics2D) g.create();
G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
G2.translate(getInnerBounds().x, getInnerBounds().y);
// Draw background
if (sectionsVisible && !sections.isEmpty()) {
for (int i = 0; i < sections.size(); i++) {
if (Double.compare(lcdValue, sections.get(i).getStart()) >= 0 && Double.compare(lcdValue, sections.get(i).getStop()) <= 0) {
bgImage = sectionsBackground.get(i);
fgColor = sectionsForeground.get(i);
break;
} else {
bgImage = lcdImage;
fgColor = lcdColor.TEXT_COLOR;
}
}
if (bgImage == null) {
bgImage = lcdImage;
fgColor = null;
}
} else {
bgImage = lcdImage;
fgColor = null;
}
if (lcdBackgroundVisible) {
G2.drawImage(bgImage, 0, 0, null);
}
// Draw bargraph
if (bargraphVisible) {
int activeSegments = (int) (lcdValue * bargraphSegmentFactor);
for (int i = 0 ; i < 20 ; i++) {
if (i < activeSegments) {
if (!sections.isEmpty()) {
for (int j = 0; j < sections.size(); j++) {
if (Double.compare(lcdValue, sections.get(j).getStart()) >= 0 && Double.compare(lcdValue, sections.get(j).getStop()) <= 0) {
Paint fill;
if (plainBargraphSegments) {
fill = sections.get(j).getColor();
} else {
fill = new RadialGradientPaint((float)bargraph.get(i).getBounds2D().getCenterX(), (float)bargraph.get(i).getBounds2D().getCenterY(), (float)bargraph.get(i).getBounds2D().getWidth() / 2, new float[]{0.0f, 1.0f}, new Color[]{sections.get(j).getColor().brighter(), sections.get(j).getColor().darker()});
}
G2.setPaint(fill);
break;
} else {
G2.setPaint(lcdColor.TEXT_COLOR);
}
}
} else {
G2.setPaint(lcdColor.TEXT_COLOR);
}
G2.fill(bargraph.get(i));
}
}
}
// Draw quality overlay
if (qualityOverlayVisible && lcdValue > lcdMinValue) {
G2.setPaint(qualityOverlayGradient);
G2.fill(qualityOverlay);
}
// Draw lcd text
if (fgColor == null) {
if (lcdColor == LcdColor.CUSTOM) {
G2.setColor(customLcdForeground);
} else {
G2.setColor(lcdColor.TEXT_COLOR);
}
} else {
G2.setColor(fgColor);
}
if (lcdNnumericValues) {
G2.setFont(lcdUnitFont);
final double UNIT_STRING_WIDTH;
final double digitalFontOffset = digitalFont ? lcdImage.getWidth() * 0.0625 : 0;
// Draw unit string
if (lcdUnitStringVisible && !lcdUnitString.isEmpty()) {
unitLayout = new TextLayout(lcdUnitString, G2.getFont(), RENDER_CONTEXT);
UNIT_BOUNDARY.setFrame(unitLayout.getBounds());
if (lcdTextVisible) {
G2.drawString(lcdUnitString, (int) ((lcdImage.getWidth() - UNIT_BOUNDARY.getWidth()) - lcdImage.getHeight() * 0.15f), (int) (lcdImage.getHeight() * 0.76f));
}
UNIT_STRING_WIDTH = UNIT_BOUNDARY.getWidth();
} else {
UNIT_STRING_WIDTH = 0;
}
// Draw value
G2.setFont(lcdValueFont);
switch (numberSystem) {
case HEX:
valueLayout = new TextLayout(Integer.toHexString((int) lcdValue).toUpperCase(), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
if (lcdTextVisible) {
G2.drawString(Integer.toHexString((int) lcdValue).toUpperCase(), (float) ((lcdImage.getMinX() + (lcdImage.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth() - digitalFontOffset) - lcdImage.getHeight() * 0.3)), (lcdImage.getHeight() * 0.76f));
}
break;
case OCT:
valueLayout = new TextLayout(Integer.toOctalString((int) lcdValue), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
if (lcdTextVisible) {
G2.drawString(Integer.toOctalString((int) lcdValue), (float) ((lcdImage.getMinX() + (lcdImage.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth() - digitalFontOffset) - lcdImage.getHeight() * 0.3)), (lcdImage.getHeight() * 0.76f));
}
break;
case DEC:
default:
valueLayout = new TextLayout(formatLcdValue(lcdValue), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
if (lcdTextVisible) {
G2.drawString(formatLcdValue(lcdValue), (float)((lcdImage.getMinX() + (lcdImage.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth() - digitalFontOffset) - lcdImage.getHeight() * 0.3)), (lcdImage.getHeight() * 0.76f));
}
break;
}
// Draw lcd info string
if (!lcdInfoString.isEmpty()) {
G2.setFont(lcdInfoFont);
infoLayout = new TextLayout(lcdInfoString, G2.getFont(), RENDER_CONTEXT);
INFO_BOUNDARY.setFrame(infoLayout.getBounds());
G2.drawString(lcdInfoString, 5f, (float) INFO_BOUNDARY.getHeight() + 2f);
}
} else {
// Draw text instead of numbers
G2.setFont(lcdValueFont);
if (!lcdText.isEmpty()) {
valueLayout = new TextLayout(lcdText, G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
if (!TEXT_SCROLLER.isRunning()) {
lcdTextX = (float) VALUE_BOUNDARY.getWidth();
}
G2.drawString(lcdText, lcdImage.getWidth() - lcdTextX - lcdImage.getHeight() * 0.15f, (lcdImage.getHeight() * 0.76f));
}
}
// Draw lcd threshold indicator
if (numberSystem == NumberSystem.DEC && lcdThresholdVisible) {
if (!lcdThresholdBehaviourInverted) {
if (lcdValue >= lcdThreshold) {
G2.drawImage(lcdThresholdImage, 5, getHeight() - lcdThresholdImage.getHeight() - 5, null);
}
} else {
if (lcdValue <= lcdThreshold) {
G2.drawImage(lcdThresholdImage, 5, getHeight() - lcdThresholdImage.getHeight() - 5, null);
}
}
}
if (glowVisible && glowing) {
G2.drawImage(glowImageOn, 0, 0, null);
}
if (!isEnabled()) {
G2.setColor(DISABLED_COLOR);
G2.fill(disabledShape);
}
G2.dispose();
} } | public class class_name {
@Override
protected void paintComponent(Graphics g) {
final Graphics2D G2 = (Graphics2D) g.create();
G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
G2.translate(getInnerBounds().x, getInnerBounds().y);
// Draw background
if (sectionsVisible && !sections.isEmpty()) {
for (int i = 0; i < sections.size(); i++) {
if (Double.compare(lcdValue, sections.get(i).getStart()) >= 0 && Double.compare(lcdValue, sections.get(i).getStop()) <= 0) {
bgImage = sectionsBackground.get(i); // depends on control dependency: [if], data = [none]
fgColor = sectionsForeground.get(i); // depends on control dependency: [if], data = [none]
break;
} else {
bgImage = lcdImage; // depends on control dependency: [if], data = [none]
fgColor = lcdColor.TEXT_COLOR; // depends on control dependency: [if], data = [none]
}
}
if (bgImage == null) {
bgImage = lcdImage; // depends on control dependency: [if], data = [none]
fgColor = null; // depends on control dependency: [if], data = [none]
}
} else {
bgImage = lcdImage; // depends on control dependency: [if], data = [none]
fgColor = null; // depends on control dependency: [if], data = [none]
}
if (lcdBackgroundVisible) {
G2.drawImage(bgImage, 0, 0, null); // depends on control dependency: [if], data = [none]
}
// Draw bargraph
if (bargraphVisible) {
int activeSegments = (int) (lcdValue * bargraphSegmentFactor);
for (int i = 0 ; i < 20 ; i++) {
if (i < activeSegments) {
if (!sections.isEmpty()) {
for (int j = 0; j < sections.size(); j++) {
if (Double.compare(lcdValue, sections.get(j).getStart()) >= 0 && Double.compare(lcdValue, sections.get(j).getStop()) <= 0) {
Paint fill;
if (plainBargraphSegments) {
fill = sections.get(j).getColor(); // depends on control dependency: [if], data = [none]
} else {
fill = new RadialGradientPaint((float)bargraph.get(i).getBounds2D().getCenterX(), (float)bargraph.get(i).getBounds2D().getCenterY(), (float)bargraph.get(i).getBounds2D().getWidth() / 2, new float[]{0.0f, 1.0f}, new Color[]{sections.get(j).getColor().brighter(), sections.get(j).getColor().darker()}); // depends on control dependency: [if], data = [none]
}
G2.setPaint(fill); // depends on control dependency: [if], data = [none]
break;
} else {
G2.setPaint(lcdColor.TEXT_COLOR); // depends on control dependency: [if], data = [none]
}
}
} else {
G2.setPaint(lcdColor.TEXT_COLOR); // depends on control dependency: [if], data = [none]
}
G2.fill(bargraph.get(i)); // depends on control dependency: [if], data = [(i]
}
}
}
// Draw quality overlay
if (qualityOverlayVisible && lcdValue > lcdMinValue) {
G2.setPaint(qualityOverlayGradient); // depends on control dependency: [if], data = [none]
G2.fill(qualityOverlay); // depends on control dependency: [if], data = [none]
}
// Draw lcd text
if (fgColor == null) {
if (lcdColor == LcdColor.CUSTOM) {
G2.setColor(customLcdForeground); // depends on control dependency: [if], data = [none]
} else {
G2.setColor(lcdColor.TEXT_COLOR); // depends on control dependency: [if], data = [(lcdColor]
}
} else {
G2.setColor(fgColor); // depends on control dependency: [if], data = [(fgColor]
}
if (lcdNnumericValues) {
G2.setFont(lcdUnitFont); // depends on control dependency: [if], data = [none]
final double UNIT_STRING_WIDTH;
final double digitalFontOffset = digitalFont ? lcdImage.getWidth() * 0.0625 : 0;
// Draw unit string
if (lcdUnitStringVisible && !lcdUnitString.isEmpty()) {
unitLayout = new TextLayout(lcdUnitString, G2.getFont(), RENDER_CONTEXT); // depends on control dependency: [if], data = [none]
UNIT_BOUNDARY.setFrame(unitLayout.getBounds()); // depends on control dependency: [if], data = [none]
if (lcdTextVisible) {
G2.drawString(lcdUnitString, (int) ((lcdImage.getWidth() - UNIT_BOUNDARY.getWidth()) - lcdImage.getHeight() * 0.15f), (int) (lcdImage.getHeight() * 0.76f)); // depends on control dependency: [if], data = [none]
}
UNIT_STRING_WIDTH = UNIT_BOUNDARY.getWidth(); // depends on control dependency: [if], data = [none]
} else {
UNIT_STRING_WIDTH = 0; // depends on control dependency: [if], data = [none]
}
// Draw value
G2.setFont(lcdValueFont); // depends on control dependency: [if], data = [none]
switch (numberSystem) {
case HEX:
valueLayout = new TextLayout(Integer.toHexString((int) lcdValue).toUpperCase(), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
if (lcdTextVisible) {
G2.drawString(Integer.toHexString((int) lcdValue).toUpperCase(), (float) ((lcdImage.getMinX() + (lcdImage.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth() - digitalFontOffset) - lcdImage.getHeight() * 0.3)), (lcdImage.getHeight() * 0.76f)); // depends on control dependency: [if], data = [none]
}
break;
case OCT:
valueLayout = new TextLayout(Integer.toOctalString((int) lcdValue), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
if (lcdTextVisible) {
G2.drawString(Integer.toOctalString((int) lcdValue), (float) ((lcdImage.getMinX() + (lcdImage.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth() - digitalFontOffset) - lcdImage.getHeight() * 0.3)), (lcdImage.getHeight() * 0.76f)); // depends on control dependency: [if], data = [none]
}
break;
case DEC:
default:
valueLayout = new TextLayout(formatLcdValue(lcdValue), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
if (lcdTextVisible) {
G2.drawString(formatLcdValue(lcdValue), (float)((lcdImage.getMinX() + (lcdImage.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth() - digitalFontOffset) - lcdImage.getHeight() * 0.3)), (lcdImage.getHeight() * 0.76f)); // depends on control dependency: [if], data = [none]
}
break;
}
// Draw lcd info string
if (!lcdInfoString.isEmpty()) {
G2.setFont(lcdInfoFont); // depends on control dependency: [if], data = [none]
infoLayout = new TextLayout(lcdInfoString, G2.getFont(), RENDER_CONTEXT); // depends on control dependency: [if], data = [none]
INFO_BOUNDARY.setFrame(infoLayout.getBounds()); // depends on control dependency: [if], data = [none]
G2.drawString(lcdInfoString, 5f, (float) INFO_BOUNDARY.getHeight() + 2f); // depends on control dependency: [if], data = [none]
}
} else {
// Draw text instead of numbers
G2.setFont(lcdValueFont); // depends on control dependency: [if], data = [none]
if (!lcdText.isEmpty()) {
valueLayout = new TextLayout(lcdText, G2.getFont(), RENDER_CONTEXT); // depends on control dependency: [if], data = [none]
VALUE_BOUNDARY.setFrame(valueLayout.getBounds()); // depends on control dependency: [if], data = [none]
if (!TEXT_SCROLLER.isRunning()) {
lcdTextX = (float) VALUE_BOUNDARY.getWidth(); // depends on control dependency: [if], data = [none]
}
G2.drawString(lcdText, lcdImage.getWidth() - lcdTextX - lcdImage.getHeight() * 0.15f, (lcdImage.getHeight() * 0.76f)); // depends on control dependency: [if], data = [none]
}
}
// Draw lcd threshold indicator
if (numberSystem == NumberSystem.DEC && lcdThresholdVisible) {
if (!lcdThresholdBehaviourInverted) {
if (lcdValue >= lcdThreshold) {
G2.drawImage(lcdThresholdImage, 5, getHeight() - lcdThresholdImage.getHeight() - 5, null); // depends on control dependency: [if], data = [none]
}
} else {
if (lcdValue <= lcdThreshold) {
G2.drawImage(lcdThresholdImage, 5, getHeight() - lcdThresholdImage.getHeight() - 5, null); // depends on control dependency: [if], data = [none]
}
}
}
if (glowVisible && glowing) {
G2.drawImage(glowImageOn, 0, 0, null); // depends on control dependency: [if], data = [none]
}
if (!isEnabled()) {
G2.setColor(DISABLED_COLOR); // depends on control dependency: [if], data = [none]
G2.fill(disabledShape); // depends on control dependency: [if], data = [none]
}
G2.dispose();
} } |
public class class_name {
public static Class getRawType(final Type t)
{
if (t instanceof ParameterizedType)
{
ParameterizedType pType = (ParameterizedType) t;
if (pType.getRawType() instanceof Class)
{
return (Class) pType.getRawType();
}
}
return null;
} } | public class class_name {
public static Class getRawType(final Type t)
{
if (t instanceof ParameterizedType)
{
ParameterizedType pType = (ParameterizedType) t;
if (pType.getRawType() instanceof Class)
{
return (Class) pType.getRawType(); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public boolean validateSignature(@NonNull Context context, @NonNull String packageName) {
if (isDebug(context)) {
return true;
}
PackageInfo packageInfo;
try {
packageInfo = context.getPackageManager().getPackageInfo(packageName,
PackageManager.GET_SIGNATURES);
} catch (PackageManager.NameNotFoundException e) {
return false;
}
for (Signature signature : packageInfo.signatures) {
String hashedSignature = Utility.sha1hash(signature.toByteArray());
if (!validAppSignatureHashes.contains(hashedSignature)) {
return false;
}
}
return true;
} } | public class class_name {
public boolean validateSignature(@NonNull Context context, @NonNull String packageName) {
if (isDebug(context)) {
return true; // depends on control dependency: [if], data = [none]
}
PackageInfo packageInfo;
try {
packageInfo = context.getPackageManager().getPackageInfo(packageName,
PackageManager.GET_SIGNATURES); // depends on control dependency: [try], data = [none]
} catch (PackageManager.NameNotFoundException e) {
return false;
} // depends on control dependency: [catch], data = [none]
for (Signature signature : packageInfo.signatures) {
String hashedSignature = Utility.sha1hash(signature.toByteArray());
if (!validAppSignatureHashes.contains(hashedSignature)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
private void removeFromReplicaLayer(final Node followedReplica) {
final Node prev = NeoUtils.getPrevSingleNode(followedReplica,
SocialGraphRelationshipType.GRAPHITY);
final Node next = NeoUtils.getNextSingleNode(followedReplica,
SocialGraphRelationshipType.GRAPHITY);
// bridge the user replica in the replica layer
prev.getSingleRelationship(SocialGraphRelationshipType.GRAPHITY,
Direction.OUTGOING).delete();
if (next != null) {
next.getSingleRelationship(SocialGraphRelationshipType.GRAPHITY,
Direction.INCOMING).delete();
prev.createRelationshipTo(next,
SocialGraphRelationshipType.GRAPHITY);
}
// remove the followship
followedReplica.getSingleRelationship(
SocialGraphRelationshipType.FOLLOW, Direction.INCOMING)
.delete();
// remove the replica node itself
followedReplica.getSingleRelationship(
SocialGraphRelationshipType.REPLICA, Direction.OUTGOING)
.delete();
followedReplica.delete();
} } | public class class_name {
private void removeFromReplicaLayer(final Node followedReplica) {
final Node prev = NeoUtils.getPrevSingleNode(followedReplica,
SocialGraphRelationshipType.GRAPHITY);
final Node next = NeoUtils.getNextSingleNode(followedReplica,
SocialGraphRelationshipType.GRAPHITY);
// bridge the user replica in the replica layer
prev.getSingleRelationship(SocialGraphRelationshipType.GRAPHITY,
Direction.OUTGOING).delete();
if (next != null) {
next.getSingleRelationship(SocialGraphRelationshipType.GRAPHITY,
Direction.INCOMING).delete(); // depends on control dependency: [if], data = [none]
prev.createRelationshipTo(next,
SocialGraphRelationshipType.GRAPHITY); // depends on control dependency: [if], data = [(next]
}
// remove the followship
followedReplica.getSingleRelationship(
SocialGraphRelationshipType.FOLLOW, Direction.INCOMING)
.delete();
// remove the replica node itself
followedReplica.getSingleRelationship(
SocialGraphRelationshipType.REPLICA, Direction.OUTGOING)
.delete();
followedReplica.delete();
} } |
public class class_name {
public List<Type> newInstances(List<Type> tvars) {
List<Type> tvars1 = tvars.map(newInstanceFun);
for (List<Type> l = tvars1; l.nonEmpty(); l = l.tail) {
TypeVar tv = (TypeVar) l.head;
tv.bound = subst(tv.bound, tvars, tvars1);
}
return tvars1;
} } | public class class_name {
public List<Type> newInstances(List<Type> tvars) {
List<Type> tvars1 = tvars.map(newInstanceFun);
for (List<Type> l = tvars1; l.nonEmpty(); l = l.tail) {
TypeVar tv = (TypeVar) l.head;
tv.bound = subst(tv.bound, tvars, tvars1); // depends on control dependency: [for], data = [none]
}
return tvars1;
} } |
public class class_name {
private static void clean(Config config, Attachment[] attachmentz) {
if (attachmentz != null) for (int i = 0; i < attachmentz.length; i++) {
if (attachmentz[i].isRemoveAfterSend()) {
Resource res = config.getResource(attachmentz[i].getAbsolutePath());
ResourceUtil.removeEL(res, true);
}
}
} } | public class class_name {
private static void clean(Config config, Attachment[] attachmentz) {
if (attachmentz != null) for (int i = 0; i < attachmentz.length; i++) {
if (attachmentz[i].isRemoveAfterSend()) {
Resource res = config.getResource(attachmentz[i].getAbsolutePath());
ResourceUtil.removeEL(res, true); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void unregister(EventDefinition eventDefinition, IEventListener eventListener) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
unregister(listenersPost, eventDefinition, eventListener);
} else {
unregister(listeners, eventDefinition, eventListener);
}
} } | public class class_name {
public void unregister(EventDefinition eventDefinition, IEventListener eventListener) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
unregister(listenersPost, eventDefinition, eventListener); // depends on control dependency: [if], data = [none]
} else {
unregister(listeners, eventDefinition, eventListener); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <P extends BaseParser<V>, V> byte[] getByteCode(
final Class<P> parserClass)
{
try {
return ParserTransformer.getByteCode(parserClass);
} catch (Exception e) {
throw new RuntimeException("failed to generate byte code", e);
}
} } | public class class_name {
public static <P extends BaseParser<V>, V> byte[] getByteCode(
final Class<P> parserClass)
{
try {
return ParserTransformer.getByteCode(parserClass); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("failed to generate byte code", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static filterhtmlinjectionvariable[] get(nitro_service service, String variable[]) throws Exception{
if (variable !=null && variable.length>0) {
filterhtmlinjectionvariable response[] = new filterhtmlinjectionvariable[variable.length];
filterhtmlinjectionvariable obj[] = new filterhtmlinjectionvariable[variable.length];
for (int i=0;i<variable.length;i++) {
obj[i] = new filterhtmlinjectionvariable();
obj[i].set_variable(variable[i]);
response[i] = (filterhtmlinjectionvariable) obj[i].get_resource(service);
}
return response;
}
return null;
} } | public class class_name {
public static filterhtmlinjectionvariable[] get(nitro_service service, String variable[]) throws Exception{
if (variable !=null && variable.length>0) {
filterhtmlinjectionvariable response[] = new filterhtmlinjectionvariable[variable.length];
filterhtmlinjectionvariable obj[] = new filterhtmlinjectionvariable[variable.length];
for (int i=0;i<variable.length;i++) {
obj[i] = new filterhtmlinjectionvariable(); // depends on control dependency: [for], data = [i]
obj[i].set_variable(variable[i]); // depends on control dependency: [for], data = [i]
response[i] = (filterhtmlinjectionvariable) obj[i].get_resource(service); // depends on control dependency: [for], data = [i]
}
return response;
}
return null;
} } |
public class class_name {
public void skipValue() throws IOException {
skipping = true;
try {
int count = 0;
do {
JsonToken token = advance();
if (token == JsonToken.BEGIN_ARRAY || token == JsonToken.BEGIN_OBJECT) {
count++;
} else if (token == JsonToken.END_ARRAY || token == JsonToken.END_OBJECT) {
count--;
}
} while (count != 0);
} finally {
skipping = false;
}
} } | public class class_name {
public void skipValue() throws IOException {
skipping = true;
try {
int count = 0;
do {
JsonToken token = advance();
if (token == JsonToken.BEGIN_ARRAY || token == JsonToken.BEGIN_OBJECT) {
count++; // depends on control dependency: [if], data = [none]
} else if (token == JsonToken.END_ARRAY || token == JsonToken.END_OBJECT) {
count--; // depends on control dependency: [if], data = [none]
}
} while (count != 0);
} finally {
skipping = false;
}
} } |
public class class_name {
public <T> T get(String key, Class<T> type) {
Object value = this.data.get(key);
if (value != null && type.isAssignableFrom(value.getClass())) {
return (T) value;
}
return null;
} } | public class class_name {
public <T> T get(String key, Class<T> type) {
Object value = this.data.get(key);
if (value != null && type.isAssignableFrom(value.getClass())) {
return (T) value; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public CreateTableRequest withLocalSecondaryIndexes(LocalSecondaryIndex... localSecondaryIndexes) {
if (this.localSecondaryIndexes == null) {
setLocalSecondaryIndexes(new java.util.ArrayList<LocalSecondaryIndex>(localSecondaryIndexes.length));
}
for (LocalSecondaryIndex ele : localSecondaryIndexes) {
this.localSecondaryIndexes.add(ele);
}
return this;
} } | public class class_name {
public CreateTableRequest withLocalSecondaryIndexes(LocalSecondaryIndex... localSecondaryIndexes) {
if (this.localSecondaryIndexes == null) {
setLocalSecondaryIndexes(new java.util.ArrayList<LocalSecondaryIndex>(localSecondaryIndexes.length)); // depends on control dependency: [if], data = [none]
}
for (LocalSecondaryIndex ele : localSecondaryIndexes) {
this.localSecondaryIndexes.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void marshall(NotificationWithSubscribers notificationWithSubscribers, ProtocolMarshaller protocolMarshaller) {
if (notificationWithSubscribers == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(notificationWithSubscribers.getNotification(), NOTIFICATION_BINDING);
protocolMarshaller.marshall(notificationWithSubscribers.getSubscribers(), SUBSCRIBERS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(NotificationWithSubscribers notificationWithSubscribers, ProtocolMarshaller protocolMarshaller) {
if (notificationWithSubscribers == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(notificationWithSubscribers.getNotification(), NOTIFICATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(notificationWithSubscribers.getSubscribers(), SUBSCRIBERS_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 synchronized void postDelayed(Runnable runnable, long delay, TimeUnit unit) {
long delayMillis = unit.toMillis(delay);
if ((idleState != CONSTANT_IDLE && (isPaused() || delayMillis > 0)) || Thread.currentThread() != associatedThread) {
runnables.add(new ScheduledRunnable(runnable, currentTime + delayMillis));
} else {
runOrQueueRunnable(runnable, currentTime + delayMillis);
}
} } | public class class_name {
public synchronized void postDelayed(Runnable runnable, long delay, TimeUnit unit) {
long delayMillis = unit.toMillis(delay);
if ((idleState != CONSTANT_IDLE && (isPaused() || delayMillis > 0)) || Thread.currentThread() != associatedThread) {
runnables.add(new ScheduledRunnable(runnable, currentTime + delayMillis)); // depends on control dependency: [if], data = [none]
} else {
runOrQueueRunnable(runnable, currentTime + delayMillis); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean runOnMainThreadAtTime(Runnable r, long uptimeMillis) {
assert handler != null;
if (!sanityCheck("runOnMainThreadAtTime " + r)) {
return false;
}
return handler.postAtTime(r, uptimeMillis);
} } | public class class_name {
public boolean runOnMainThreadAtTime(Runnable r, long uptimeMillis) {
assert handler != null;
if (!sanityCheck("runOnMainThreadAtTime " + r)) {
return false; // depends on control dependency: [if], data = [none]
}
return handler.postAtTime(r, uptimeMillis);
} } |
public class class_name {
protected void openDialog(String dialogTitle) {
m_editorDialog.setCaption(dialogTitle);
int contentHeight = m_dialogContent.getOffsetHeight();
m_editorDialog.setMainContent(m_dialogContent);
// position dialog and show it
if (m_groupContainerPosition != null) {
int lefthandSpace = m_groupContainerPosition.getLeft() - Window.getScrollLeft();
int righthandSpace = (Window.getClientWidth() + Window.getScrollLeft())
- (m_groupContainerPosition.getLeft() + m_groupContainerPosition.getWidth());
int requiredWidth = CmsPopup.DEFAULT_WIDTH + 30;
int left = m_groupContainerPosition.getLeft();
if (requiredWidth > (righthandSpace + m_groupContainerPosition.getWidth())) {
left = (Window.getClientWidth() + Window.getScrollLeft()) - requiredWidth;
}
if (left < Window.getScrollLeft()) {
left = 0;
}
if (lefthandSpace > requiredWidth) {
// place left of the group container if there is enough space
m_editorDialog.setPopupPosition(
m_groupContainerPosition.getLeft() - requiredWidth,
m_groupContainerPosition.getTop() - 1);
} else if ((m_groupContainerPosition.getTop() - Window.getScrollTop()) > (contentHeight
+ DIALOG_BASE_HEIGHT
+ 50)) {
// else place above if there is enough space
m_editorDialog.setPopupPosition(
left,
m_groupContainerPosition.getTop() - (contentHeight + DIALOG_BASE_HEIGHT));
} else if (righthandSpace > requiredWidth) {
// else on the right if there is enough space
m_editorDialog.setPopupPosition(
m_groupContainerPosition.getLeft() + m_groupContainerPosition.getWidth() + 20,
m_groupContainerPosition.getTop() - 1);
} else {
// last resort, place below
m_editorDialog.setPopupPosition(
left,
m_groupContainerPosition.getTop() + m_groupContainerPosition.getHeight() + 20);
}
m_editorDialog.show();
} else {
// should never happen
m_editorDialog.center();
}
if (!m_controller.getData().isUseClassicEditor()) {
for (Widget element : m_groupContainer) {
if (element instanceof CmsContainerPageElementPanel) {
((CmsContainerPageElementPanel)element).initInlineEditor(m_controller);
}
}
}
} } | public class class_name {
protected void openDialog(String dialogTitle) {
m_editorDialog.setCaption(dialogTitle);
int contentHeight = m_dialogContent.getOffsetHeight();
m_editorDialog.setMainContent(m_dialogContent);
// position dialog and show it
if (m_groupContainerPosition != null) {
int lefthandSpace = m_groupContainerPosition.getLeft() - Window.getScrollLeft();
int righthandSpace = (Window.getClientWidth() + Window.getScrollLeft())
- (m_groupContainerPosition.getLeft() + m_groupContainerPosition.getWidth());
int requiredWidth = CmsPopup.DEFAULT_WIDTH + 30;
int left = m_groupContainerPosition.getLeft();
if (requiredWidth > (righthandSpace + m_groupContainerPosition.getWidth())) {
left = (Window.getClientWidth() + Window.getScrollLeft()) - requiredWidth; // depends on control dependency: [if], data = [none]
}
if (left < Window.getScrollLeft()) {
left = 0; // depends on control dependency: [if], data = [none]
}
if (lefthandSpace > requiredWidth) {
// place left of the group container if there is enough space
m_editorDialog.setPopupPosition(
m_groupContainerPosition.getLeft() - requiredWidth,
m_groupContainerPosition.getTop() - 1); // depends on control dependency: [if], data = [none]
} else if ((m_groupContainerPosition.getTop() - Window.getScrollTop()) > (contentHeight
+ DIALOG_BASE_HEIGHT
+ 50)) {
// else place above if there is enough space
m_editorDialog.setPopupPosition(
left,
m_groupContainerPosition.getTop() - (contentHeight + DIALOG_BASE_HEIGHT)); // depends on control dependency: [if], data = []
} else if (righthandSpace > requiredWidth) {
// else on the right if there is enough space
m_editorDialog.setPopupPosition(
m_groupContainerPosition.getLeft() + m_groupContainerPosition.getWidth() + 20,
m_groupContainerPosition.getTop() - 1); // depends on control dependency: [if], data = [none]
} else {
// last resort, place below
m_editorDialog.setPopupPosition(
left,
m_groupContainerPosition.getTop() + m_groupContainerPosition.getHeight() + 20); // depends on control dependency: [if], data = [none]
}
m_editorDialog.show(); // depends on control dependency: [if], data = [none]
} else {
// should never happen
m_editorDialog.center(); // depends on control dependency: [if], data = [none]
}
if (!m_controller.getData().isUseClassicEditor()) {
for (Widget element : m_groupContainer) {
if (element instanceof CmsContainerPageElementPanel) {
((CmsContainerPageElementPanel)element).initInlineEditor(m_controller); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
protected void activate(ComponentContext compcontext) {
if (TC.isDebugEnabled()) {
Tr.debug(TC, "Activating " + this.getClass().getName());
}
this.userTransaction.activate(compcontext);
this.transactionManager.activate(compcontext);
} } | public class class_name {
protected void activate(ComponentContext compcontext) {
if (TC.isDebugEnabled()) {
Tr.debug(TC, "Activating " + this.getClass().getName()); // depends on control dependency: [if], data = [none]
}
this.userTransaction.activate(compcontext);
this.transactionManager.activate(compcontext);
} } |
public class class_name {
@Override
public int predict(T x) {
List<Neighbor<T,T>> neighbors = new ArrayList<>();
nns.range(x, radius, neighbors);
if (neighbors.size() < minPts) {
return OUTLIER;
}
int[] label = new int[k + 1];
for (Neighbor<T,T> neighbor : neighbors) {
int yi = y[neighbor.index];
if (yi == OUTLIER) yi = k;
label[yi]++;
}
int c = Math.whichMax(label);
if (c == k) c = OUTLIER;
return c;
} } | public class class_name {
@Override
public int predict(T x) {
List<Neighbor<T,T>> neighbors = new ArrayList<>();
nns.range(x, radius, neighbors);
if (neighbors.size() < minPts) {
return OUTLIER; // depends on control dependency: [if], data = [none]
}
int[] label = new int[k + 1];
for (Neighbor<T,T> neighbor : neighbors) {
int yi = y[neighbor.index];
if (yi == OUTLIER) yi = k;
label[yi]++; // depends on control dependency: [for], data = [none]
}
int c = Math.whichMax(label);
if (c == k) c = OUTLIER;
return c;
} } |
public class class_name {
public static String[] getNames(JSONObject jo) {
int length = jo.length();
if (length == 0) {
return null;
}
String[] names = jo.m_map.keySet().toArray(new String[length]);
return names;
} } | public class class_name {
public static String[] getNames(JSONObject jo) {
int length = jo.length();
if (length == 0) {
return null; // depends on control dependency: [if], data = [none]
}
String[] names = jo.m_map.keySet().toArray(new String[length]);
return names;
} } |
public class class_name {
public synchronized boolean removeChangeListener(ChangeListener listener) {
if (bEnableListener && listener != null) {
eventSource.removeListener(listener);
return true;
}
return false;
} } | public class class_name {
public synchronized boolean removeChangeListener(ChangeListener listener) {
if (bEnableListener && listener != null) {
eventSource.removeListener(listener); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
@Override
public CommerceNotificationAttachment fetchByCommerceNotificationQueueEntryId_First(
long commerceNotificationQueueEntryId,
OrderByComparator<CommerceNotificationAttachment> orderByComparator) {
List<CommerceNotificationAttachment> list = findByCommerceNotificationQueueEntryId(commerceNotificationQueueEntryId,
0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CommerceNotificationAttachment fetchByCommerceNotificationQueueEntryId_First(
long commerceNotificationQueueEntryId,
OrderByComparator<CommerceNotificationAttachment> orderByComparator) {
List<CommerceNotificationAttachment> list = findByCommerceNotificationQueueEntryId(commerceNotificationQueueEntryId,
0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
protected Term decodeHeap(int start, Map<Integer, Variable> variableContext)
{
/*log.fine("private Term decodeHeap(int start = " + start + ", Map<Integer, Variable> variableContext = " +
variableContext + "): called");*/
// Used to hold the decoded argument in.
Term result = null;
// Dereference the initial heap pointer.
int addr = deref(start);
byte tag = getDerefTag();
int val = getDerefVal();
/*log.fine("addr = " + addr);*/
/*log.fine("tag = " + tag);*/
/*log.fine("val = " + val);*/
switch (tag)
{
case REF:
{
// Check if a variable for the address has already been created in this context, and use it if so.
Variable var = variableContext.get(val);
if (var == null)
{
var = new Variable(varNameId.decrementAndGet(), null, false);
variableContext.put(val, var);
}
result = var;
break;
}
case STR:
{
// Decode f/n from the STR data.
int fn = getHeap(val);
int f = fn & 0x00ffffff;
/*log.fine("fn = " + fn);*/
/*log.fine("f = " + f);*/
// Look up and initialize this functor name from the symbol table.
FunctorName functorName = getDeinternedFunctorName(f);
// Fill in this functors name and arity and allocate storage space for its arguments.
int arity = functorName.getArity();
Term[] arguments = new Term[arity];
// Loop over all of the functors arguments, recursively decoding them.
for (int i = 0; i < arity; i++)
{
arguments[i] = decodeHeap(val + 1 + i, variableContext);
}
// Create a new functor to hold the decoded data.
result = new Functor(f, arguments);
break;
}
case WAMInstruction.CON:
{
//Decode f/n from the CON data.
int f = val & 0x3fffffff;
/*log.fine("f = " + f);*/
// Create a new functor to hold the decoded data.
result = new Functor(f, null);
break;
}
case WAMInstruction.LIS:
{
FunctorName functorName = new FunctorName("cons", 2);
int f = internFunctorName(functorName);
// Fill in this functors name and arity and allocate storage space for its arguments.
int arity = functorName.getArity();
Term[] arguments = new Term[arity];
// Loop over all of the functors arguments, recursively decoding them.
for (int i = 0; i < arity; i++)
{
arguments[i] = decodeHeap(val + i, variableContext);
}
// Create a new functor to hold the decoded data.
result = new Functor(f, arguments);
break;
}
default:
throw new IllegalStateException("Encountered unknown tag type on the heap.");
}
return result;
} } | public class class_name {
protected Term decodeHeap(int start, Map<Integer, Variable> variableContext)
{
/*log.fine("private Term decodeHeap(int start = " + start + ", Map<Integer, Variable> variableContext = " +
variableContext + "): called");*/
// Used to hold the decoded argument in.
Term result = null;
// Dereference the initial heap pointer.
int addr = deref(start);
byte tag = getDerefTag();
int val = getDerefVal();
/*log.fine("addr = " + addr);*/
/*log.fine("tag = " + tag);*/
/*log.fine("val = " + val);*/
switch (tag)
{
case REF:
{
// Check if a variable for the address has already been created in this context, and use it if so.
Variable var = variableContext.get(val);
if (var == null)
{
var = new Variable(varNameId.decrementAndGet(), null, false); // depends on control dependency: [if], data = [(var]
variableContext.put(val, var); // depends on control dependency: [if], data = [none]
}
result = var;
break;
}
case STR:
{
// Decode f/n from the STR data.
int fn = getHeap(val);
int f = fn & 0x00ffffff;
/*log.fine("fn = " + fn);*/
/*log.fine("f = " + f);*/
// Look up and initialize this functor name from the symbol table.
FunctorName functorName = getDeinternedFunctorName(f);
// Fill in this functors name and arity and allocate storage space for its arguments.
int arity = functorName.getArity();
Term[] arguments = new Term[arity];
// Loop over all of the functors arguments, recursively decoding them.
for (int i = 0; i < arity; i++)
{
arguments[i] = decodeHeap(val + 1 + i, variableContext); // depends on control dependency: [for], data = [i]
}
// Create a new functor to hold the decoded data.
result = new Functor(f, arguments);
break;
}
case WAMInstruction.CON:
{
//Decode f/n from the CON data.
int f = val & 0x3fffffff;
/*log.fine("f = " + f);*/
// Create a new functor to hold the decoded data.
result = new Functor(f, null);
break;
}
case WAMInstruction.LIS:
{
FunctorName functorName = new FunctorName("cons", 2);
int f = internFunctorName(functorName);
// Fill in this functors name and arity and allocate storage space for its arguments.
int arity = functorName.getArity();
Term[] arguments = new Term[arity];
// Loop over all of the functors arguments, recursively decoding them.
for (int i = 0; i < arity; i++)
{
arguments[i] = decodeHeap(val + i, variableContext);
}
// Create a new functor to hold the decoded data.
result = new Functor(f, arguments);
break;
}
default:
throw new IllegalStateException("Encountered unknown tag type on the heap.");
}
return result;
} } |
public class class_name {
public void setProviderARNs(java.util.Collection<String> providerARNs) {
if (providerARNs == null) {
this.providerARNs = null;
return;
}
this.providerARNs = new java.util.ArrayList<String>(providerARNs);
} } | public class class_name {
public void setProviderARNs(java.util.Collection<String> providerARNs) {
if (providerARNs == null) {
this.providerARNs = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.providerARNs = new java.util.ArrayList<String>(providerARNs);
} } |
public class class_name {
protected void removeTypeConversions(String... types) {
for (final String type : types) {
final Iterator<ConversionMapping> iterator = this.conversions.iterator();
while (iterator.hasNext()) {
final ConversionMapping pair = iterator.next();
if (Strings.equal(pair.getSource(), type)) {
iterator.remove();
break;
}
}
}
refreshListUI();
this.list.refresh(true);
enableButtons();
preferenceValueChanged();
} } | public class class_name {
protected void removeTypeConversions(String... types) {
for (final String type : types) {
final Iterator<ConversionMapping> iterator = this.conversions.iterator();
while (iterator.hasNext()) {
final ConversionMapping pair = iterator.next();
if (Strings.equal(pair.getSource(), type)) {
iterator.remove(); // depends on control dependency: [if], data = [none]
break;
}
}
}
refreshListUI();
this.list.refresh(true);
enableButtons();
preferenceValueChanged();
} } |
public class class_name {
private void analyze(Analyzer analyzer,
boolean allowFlow,
IntArray pendingTargets,
IntArray completedTargets)
throws Exception
{
pending:
while (pendingTargets.size() > 0) {
int pc = pendingTargets.pop();
if (allowFlow) {
if (completedTargets.contains(pc))
continue pending;
completedTargets.add(pc);
}
setOffset(pc);
flow:
do {
pc = getOffset();
if (pc < 0)
throw new IllegalStateException();
if (! allowFlow) {
if (completedTargets.contains(pc))
break flow;
completedTargets.add(pc);
}
if (isBranch()) {
int targetPC = getBranchTarget();
if (! pendingTargets.contains(targetPC))
pendingTargets.add(targetPC);
}
else if (isSwitch()) {
int []switchTargets = getSwitchTargets();
for (int i = 0; i < switchTargets.length; i++) {
if (! pendingTargets.contains(switchTargets[i]))
pendingTargets.add(switchTargets[i]);
}
}
analyzer.analyze(this);
} while (next());
}
} } | public class class_name {
private void analyze(Analyzer analyzer,
boolean allowFlow,
IntArray pendingTargets,
IntArray completedTargets)
throws Exception
{
pending:
while (pendingTargets.size() > 0) {
int pc = pendingTargets.pop();
if (allowFlow) {
if (completedTargets.contains(pc))
continue pending;
completedTargets.add(pc); // depends on control dependency: [if], data = [none]
}
setOffset(pc);
flow:
do {
pc = getOffset();
if (pc < 0)
throw new IllegalStateException();
if (! allowFlow) {
if (completedTargets.contains(pc))
break flow;
completedTargets.add(pc); // depends on control dependency: [if], data = [none]
}
if (isBranch()) {
int targetPC = getBranchTarget();
if (! pendingTargets.contains(targetPC))
pendingTargets.add(targetPC);
}
else if (isSwitch()) {
int []switchTargets = getSwitchTargets();
for (int i = 0; i < switchTargets.length; i++) {
if (! pendingTargets.contains(switchTargets[i]))
pendingTargets.add(switchTargets[i]);
}
}
analyzer.analyze(this);
} while (next());
}
} } |
public class class_name {
@Override
public EClass getIfcBlock() {
if (ifcBlockEClass == null) {
ifcBlockEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(42);
}
return ifcBlockEClass;
} } | public class class_name {
@Override
public EClass getIfcBlock() {
if (ifcBlockEClass == null) {
ifcBlockEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(42);
// depends on control dependency: [if], data = [none]
}
return ifcBlockEClass;
} } |
public class class_name {
@Nullable
public static Integer findContentInteger(final Node rootNode, final XPath xPath,
final String expression) {
final Node node = findNode(rootNode, xPath, expression);
if (node == null) {
return null;
}
final String str = node.getTextContent();
return Integer.valueOf(str);
} } | public class class_name {
@Nullable
public static Integer findContentInteger(final Node rootNode, final XPath xPath,
final String expression) {
final Node node = findNode(rootNode, xPath, expression);
if (node == null) {
return null; // depends on control dependency: [if], data = [none]
}
final String str = node.getTextContent();
return Integer.valueOf(str);
} } |
public class class_name {
@Override
protected void doLock(Connection con, final String lockContext) throws SQLException {
logger.debug("Trying to acquire db lock for '{}'", lockContext);
PreparedStatement stmt = con.prepareStatement("select get_lock(?,?)");
stmt.setString(1, lockContext);
stmt.setInt(2, ACQUIRE_BLOCKING_WAIT_SEC);
try {
final ResultSet rs = stmt.executeQuery();
while (rs.next()) {
final int lockResult = rs.getInt(1);
if (lockResult == 1) {
// success
return;
}
final String errorMsgPrefix = "error acquire lock(" + lockContext + "," + ACQUIRE_BLOCKING_WAIT_SEC + "): ";
if (rs.wasNull()) {
throw new SQLException(errorMsgPrefix + "unknown");
} else if (lockResult == 0) {
// timeout
throw new SQLException(errorMsgPrefix + "timeout");
}
}
// something else must be horribly wrong
throw new SQLException("Please check your version of MySQL, to make sure it supports get_lock() & release_lock()");
} finally {
JdbcUtils.closeStatement(stmt);
}
} } | public class class_name {
@Override
protected void doLock(Connection con, final String lockContext) throws SQLException {
logger.debug("Trying to acquire db lock for '{}'", lockContext);
PreparedStatement stmt = con.prepareStatement("select get_lock(?,?)");
stmt.setString(1, lockContext);
stmt.setInt(2, ACQUIRE_BLOCKING_WAIT_SEC);
try {
final ResultSet rs = stmt.executeQuery();
while (rs.next()) {
final int lockResult = rs.getInt(1);
if (lockResult == 1) {
// success
return;
// depends on control dependency: [if], data = [none]
}
final String errorMsgPrefix = "error acquire lock(" + lockContext + "," + ACQUIRE_BLOCKING_WAIT_SEC + "): ";
// depends on control dependency: [while], data = [none]
if (rs.wasNull()) {
throw new SQLException(errorMsgPrefix + "unknown");
} else if (lockResult == 0) {
// timeout
throw new SQLException(errorMsgPrefix + "timeout");
}
}
// something else must be horribly wrong
throw new SQLException("Please check your version of MySQL, to make sure it supports get_lock() & release_lock()");
} finally {
JdbcUtils.closeStatement(stmt);
}
} } |
public class class_name {
private Resource mightCache(String key, Resource fileResource) {
if ( ! isDevMode() ) {
lookupCache.put(key,fileResource);
}
return fileResource;
} } | public class class_name {
private Resource mightCache(String key, Resource fileResource) {
if ( ! isDevMode() ) {
lookupCache.put(key,fileResource); // depends on control dependency: [if], data = [none]
}
return fileResource;
} } |
public class class_name {
public Object deserialise(final XMLStreamReader reader)
{
if (reader == null)
throw new IllegalArgumentException("Null argument passed to deserialise!");
final Unmarshaller unmarshaller = getUnmarshaller();
try
{
final Object obj = unmarshaller.unmarshal(reader);
if (obj == null)
throw new RuntimeException("Malformed XML! JAXB returned null");
else
return obj;
}
catch (JAXBException e)
{
throw new JAXBRuntimeException("deserialisation", e);
}
} } | public class class_name {
public Object deserialise(final XMLStreamReader reader)
{
if (reader == null)
throw new IllegalArgumentException("Null argument passed to deserialise!");
final Unmarshaller unmarshaller = getUnmarshaller();
try
{
final Object obj = unmarshaller.unmarshal(reader);
if (obj == null)
throw new RuntimeException("Malformed XML! JAXB returned null");
else
return obj;
}
catch (JAXBException e)
{
throw new JAXBRuntimeException("deserialisation", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String key(String key, Object... args) {
if ((args == null) || (args.length == 0)) {
// no parameters available, use simple key method
return key(key);
}
String result = key(key, true);
if (result == null) {
// key was not found
result = formatUnknownKey(key);
} else {
result = formatMessage(result, args);
}
// return the result
return result;
} } | public class class_name {
public String key(String key, Object... args) {
if ((args == null) || (args.length == 0)) {
// no parameters available, use simple key method
return key(key); // depends on control dependency: [if], data = [none]
}
String result = key(key, true);
if (result == null) {
// key was not found
result = formatUnknownKey(key); // depends on control dependency: [if], data = [none]
} else {
result = formatMessage(result, args); // depends on control dependency: [if], data = [(result]
}
// return the result
return result;
} } |
public class class_name {
public EngineResult waitForEngineReady(int tries, int interval) {
EngineResult engineResult = null;
if (tries <= 0) {
tries = 1;
}
if (interval <= 99) {
interval = 1000;
}
boolean bLoop = true;
while (bLoop && tries > 0) {
engineResult = rescanJobDirectory();
// debug
//System.out.println(engineResult.status + " - " + ResultStatus.OK);
if (engineResult.status == ResultStatus.OK) {
bLoop = false;
}
--tries;
if (bLoop && tries > 0) {
try {
Thread.sleep(interval);
} catch (InterruptedException e) {
}
}
}
return engineResult;
} } | public class class_name {
public EngineResult waitForEngineReady(int tries, int interval) {
EngineResult engineResult = null;
if (tries <= 0) {
tries = 1; // depends on control dependency: [if], data = [none]
}
if (interval <= 99) {
interval = 1000; // depends on control dependency: [if], data = [none]
}
boolean bLoop = true;
while (bLoop && tries > 0) {
engineResult = rescanJobDirectory(); // depends on control dependency: [while], data = [none]
// debug
//System.out.println(engineResult.status + " - " + ResultStatus.OK);
if (engineResult.status == ResultStatus.OK) {
bLoop = false; // depends on control dependency: [if], data = [none]
}
--tries; // depends on control dependency: [while], data = [none]
if (bLoop && tries > 0) {
try {
Thread.sleep(interval); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
} // depends on control dependency: [catch], data = [none]
}
}
return engineResult;
} } |
public class class_name {
private String adjustForContext(String result) {
if (result != null && result.length() > 0 && UCharacter.isLowerCase(result.codePointAt(0))) {
DisplayContext capitalization = getContext(DisplayContext.Type.CAPITALIZATION);
if ( capitalization==DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
(capitalization == DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForListOrMenu) ||
(capitalization == DisplayContext.CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone) ) {
if (capitalizationBrkIter == null) {
// should only happen when deserializing, etc.
capitalizationBrkIter = BreakIterator.getSentenceInstance(locale);
}
return UCharacter.toTitleCase(locale, result, capitalizationBrkIter,
UCharacter.TITLECASE_NO_LOWERCASE | UCharacter.TITLECASE_NO_BREAK_ADJUSTMENT);
}
}
return result;
} } | public class class_name {
private String adjustForContext(String result) {
if (result != null && result.length() > 0 && UCharacter.isLowerCase(result.codePointAt(0))) {
DisplayContext capitalization = getContext(DisplayContext.Type.CAPITALIZATION);
if ( capitalization==DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
(capitalization == DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForListOrMenu) ||
(capitalization == DisplayContext.CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone) ) {
if (capitalizationBrkIter == null) {
// should only happen when deserializing, etc.
capitalizationBrkIter = BreakIterator.getSentenceInstance(locale); // depends on control dependency: [if], data = [none]
}
return UCharacter.toTitleCase(locale, result, capitalizationBrkIter,
UCharacter.TITLECASE_NO_LOWERCASE | UCharacter.TITLECASE_NO_BREAK_ADJUSTMENT); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
protected void appendDefaultOperator(SolrQuery solrQuery, @Nullable Operator defaultOperator) {
if (defaultOperator != null && !Query.Operator.NONE.equals(defaultOperator)) {
solrQuery.set("q.op", defaultOperator.asQueryStringRepresentation());
}
} } | public class class_name {
protected void appendDefaultOperator(SolrQuery solrQuery, @Nullable Operator defaultOperator) {
if (defaultOperator != null && !Query.Operator.NONE.equals(defaultOperator)) {
solrQuery.set("q.op", defaultOperator.asQueryStringRepresentation()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int doErrorReturn(int iChangeType, int iErrorCode) // init this field override for other value
{
if (iChangeType == DBConstants.AFTER_ADD_TYPE)
if (iErrorCode == DBConstants.DUPLICATE_KEY)
{
// First, find the first unique key that is not a counter
Record record = this.getOwner();
for (int iKeySeq = 0; iKeySeq < record.getKeyAreaCount(); iKeySeq++)
{
KeyArea keyArea = record.getKeyArea(iKeySeq);
if (keyArea.getUniqueKeyCode() != DBConstants.UNIQUE)
continue; // Could not have been this key
BaseField field = m_fieldToBump;
if (field == null)
field = keyArea.getField(keyArea.getKeyFields() - 1);
if (field instanceof CounterField)
continue; // This could not have had a dup key
if (field instanceof NumberField)
{ // This is the one
if (field instanceof DateTimeField)
m_iBumpAmount = KMS_IN_A_MINUTE;
long lCurrentValue = (long)field.getValue();
for (long lValue = lCurrentValue + 1; lValue < lCurrentValue + REPEAT_COUNT * m_iBumpAmount; lValue = lValue + m_iBumpAmount)
{
field.setValue(lValue);
try {
record.add();
} catch (DBException ex) {
if (ex.getErrorCode() != DBConstants.DUPLICATE_KEY)
break; // Other error
continue; // Ignore duplicate key error
}
return DBConstants.NORMAL_RETURN; // Everything is okay now
}
}
}
}
return super.doErrorReturn(iChangeType, iErrorCode);
} } | public class class_name {
public int doErrorReturn(int iChangeType, int iErrorCode) // init this field override for other value
{
if (iChangeType == DBConstants.AFTER_ADD_TYPE)
if (iErrorCode == DBConstants.DUPLICATE_KEY)
{
// First, find the first unique key that is not a counter
Record record = this.getOwner();
for (int iKeySeq = 0; iKeySeq < record.getKeyAreaCount(); iKeySeq++)
{
KeyArea keyArea = record.getKeyArea(iKeySeq);
if (keyArea.getUniqueKeyCode() != DBConstants.UNIQUE)
continue; // Could not have been this key
BaseField field = m_fieldToBump;
if (field == null)
field = keyArea.getField(keyArea.getKeyFields() - 1);
if (field instanceof CounterField)
continue; // This could not have had a dup key
if (field instanceof NumberField)
{ // This is the one
if (field instanceof DateTimeField)
m_iBumpAmount = KMS_IN_A_MINUTE;
long lCurrentValue = (long)field.getValue();
for (long lValue = lCurrentValue + 1; lValue < lCurrentValue + REPEAT_COUNT * m_iBumpAmount; lValue = lValue + m_iBumpAmount)
{
field.setValue(lValue); // depends on control dependency: [for], data = [lValue]
try {
record.add(); // depends on control dependency: [try], data = [none]
} catch (DBException ex) {
if (ex.getErrorCode() != DBConstants.DUPLICATE_KEY)
break; // Other error
continue; // Ignore duplicate key error
} // depends on control dependency: [catch], data = [none]
return DBConstants.NORMAL_RETURN; // Everything is okay now // depends on control dependency: [for], data = [none]
}
}
}
}
return super.doErrorReturn(iChangeType, iErrorCode);
} } |
public class class_name {
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
ItemStack itemStack = player.getHeldItem(hand);
if (itemStack.isEmpty())
return EnumActionResult.FAIL;
if (!player.canPlayerEdit(pos.offset(side), side, itemStack))
return EnumActionResult.FAIL;
//first check if the block clicked can be merged with the one in hand
IBlockState placedState = checkMerge(itemStack, player, world, pos, side, hitX, hitY, hitZ);
BlockPos p = pos;
//can't merge, offset the placed position to where the block should be placed in the world
if (placedState == null)
{
p = pos.offset(side);
float x = hitX - side.getFrontOffsetX();
float y = hitY - side.getFrontOffsetY();
float z = hitZ - side.getFrontOffsetZ();
//check for merge at the new position too
placedState = checkMerge(itemStack, player, world, p, side, x, y, z);
}
if (placedState == null)
return super.onItemUse(player, world, pos, hand, side, hitX, hitY, hitZ);
//block can be merged
Block block = placedState.getBlock();
if (world.checkNoEntityCollision(placedState.getCollisionBoundingBox(world, p)) && world.setBlockState(p, placedState, 3))
{
SoundType soundType = block.getSoundType(placedState, world, pos, player);
world.playSound(player,
pos,
soundType.getPlaceSound(),
SoundCategory.BLOCKS,
(soundType.getVolume() + 1.0F) / 2.0F,
soundType.getPitch() * 0.8F);
itemStack.shrink(1);
}
return EnumActionResult.SUCCESS;
} } | public class class_name {
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
ItemStack itemStack = player.getHeldItem(hand);
if (itemStack.isEmpty())
return EnumActionResult.FAIL;
if (!player.canPlayerEdit(pos.offset(side), side, itemStack))
return EnumActionResult.FAIL;
//first check if the block clicked can be merged with the one in hand
IBlockState placedState = checkMerge(itemStack, player, world, pos, side, hitX, hitY, hitZ);
BlockPos p = pos;
//can't merge, offset the placed position to where the block should be placed in the world
if (placedState == null)
{
p = pos.offset(side); // depends on control dependency: [if], data = [none]
float x = hitX - side.getFrontOffsetX();
float y = hitY - side.getFrontOffsetY();
float z = hitZ - side.getFrontOffsetZ();
//check for merge at the new position too
placedState = checkMerge(itemStack, player, world, p, side, x, y, z); // depends on control dependency: [if], data = [none]
}
if (placedState == null)
return super.onItemUse(player, world, pos, hand, side, hitX, hitY, hitZ);
//block can be merged
Block block = placedState.getBlock();
if (world.checkNoEntityCollision(placedState.getCollisionBoundingBox(world, p)) && world.setBlockState(p, placedState, 3))
{
SoundType soundType = block.getSoundType(placedState, world, pos, player);
world.playSound(player,
pos,
soundType.getPlaceSound(),
SoundCategory.BLOCKS,
(soundType.getVolume() + 1.0F) / 2.0F,
soundType.getPitch() * 0.8F); // depends on control dependency: [if], data = [none]
itemStack.shrink(1); // depends on control dependency: [if], data = [none]
}
return EnumActionResult.SUCCESS;
} } |
public class class_name {
public String getPath() {
// ensure the export file name ends with ".zip" in case of ZIP file export
if ((m_path != null) && !isExportAsFiles() && !m_path.toLowerCase().endsWith(".zip")) {
m_path += ".zip";
}
return m_path;
} } | public class class_name {
public String getPath() {
// ensure the export file name ends with ".zip" in case of ZIP file export
if ((m_path != null) && !isExportAsFiles() && !m_path.toLowerCase().endsWith(".zip")) {
m_path += ".zip"; // depends on control dependency: [if], data = [none]
}
return m_path;
} } |
public class class_name {
public GetServiceStatusResult withMessages(Message... values) {
List<Message> list = getMessages();
for (Message value : values) {
list.add(value);
}
return this;
} } | public class class_name {
public GetServiceStatusResult withMessages(Message... values) {
List<Message> list = getMessages();
for (Message value : values) {
list.add(value);
// depends on control dependency: [for], data = [value]
}
return this;
} } |
public class class_name {
private ISource resloveSource(Source source, PropertyResolver resolver, Map<Object, Object> bootstrapMap, Map<Object, Object> defaultMap) {
Class<? extends Locator> locatorClass = source.locator();
if(locatorClass == null) {
locatorClass = NullLocator.class;
}
Locator locator = this.beanResolver.resolveBeanWithDefaultClass(locatorClass, NullLocator.class);
this.logger.trace("Using locator: '{}'", locator.getClass().getName());
// resolve path if enabled
String path = source.value();
if(resolver != null && source.resolve()) {
path = resolver.resolveProperties(path, bootstrapMap, defaultMap);
}
// log path
this.logger.trace("Looking for source at path: '{}'", path);
// locate
ISource foundSource = locator.locate(path);
// log results
this.logger.trace("Source: '{}' (using locator '{}')", foundSource, locator.getClass().getName());
return foundSource;
} } | public class class_name {
private ISource resloveSource(Source source, PropertyResolver resolver, Map<Object, Object> bootstrapMap, Map<Object, Object> defaultMap) {
Class<? extends Locator> locatorClass = source.locator();
if(locatorClass == null) {
locatorClass = NullLocator.class; // depends on control dependency: [if], data = [none]
}
Locator locator = this.beanResolver.resolveBeanWithDefaultClass(locatorClass, NullLocator.class);
this.logger.trace("Using locator: '{}'", locator.getClass().getName());
// resolve path if enabled
String path = source.value();
if(resolver != null && source.resolve()) {
path = resolver.resolveProperties(path, bootstrapMap, defaultMap); // depends on control dependency: [if], data = [none]
}
// log path
this.logger.trace("Looking for source at path: '{}'", path);
// locate
ISource foundSource = locator.locate(path);
// log results
this.logger.trace("Source: '{}' (using locator '{}')", foundSource, locator.getClass().getName());
return foundSource;
} } |
public class class_name {
private synchronized void log(final String text)
{
try {
this.writer.write(text);
}
catch (IOException ioe) {
ioe.printStackTrace();
}
} } | public class class_name {
private synchronized void log(final String text)
{
try {
this.writer.write(text); // depends on control dependency: [try], data = [none]
}
catch (IOException ioe) {
ioe.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String getAllowedCharactersForRegEx(final String pregEx) {
if (StringUtils.isEmpty(pregEx)) {
return null;
}
final StringBuilder regExCheck = new StringBuilder();
final StringBuilder regExCheckOut = new StringBuilder();
boolean inSequence = false;
boolean isNegativeSequence = false;
boolean inSize = false;
boolean isMasked = false;
regExCheck.append("([");
for (final char character : pregEx.toCharArray()) {
switch (character) {
case '\\':
if (isMasked || inSequence) {
regExCheck.append(character);
}
if (!inSequence) {
isMasked = !isMasked;
}
break;
case '^':
if (inSequence) {
if (isMasked) {
regExCheck.append(character);
} else {
isNegativeSequence = true;
}
}
isMasked = false;
break;
case '$':
case '*':
case '+':
case '?':
case '|':
if (isMasked || inSequence) {
regExCheck.append(character);
}
isMasked = false;
break;
case '[':
if (isMasked || inSequence) {
regExCheck.append(character);
} else {
inSequence = true;
isNegativeSequence = false;
}
isMasked = false;
break;
case ']':
if (isMasked) {
regExCheck.append(character);
} else {
inSequence = false;
isNegativeSequence = false;
}
isMasked = false;
break;
case '{':
if (isMasked || inSequence) {
regExCheck.append(character);
} else {
inSize = true;
}
isMasked = false;
break;
case '}':
if (isMasked || inSequence) {
regExCheck.append(character);
} else {
inSize = false;
}
isMasked = false;
break;
case '(':
if (isMasked || inSequence) {
regExCheck.append(character);
}
isMasked = false;
break;
case ')':
if (isMasked || inSequence) {
regExCheck.append(character);
}
isMasked = false;
break;
default:
if (inSize) {
if (character != ',' && (character < '0' || character > '9')) {
regExCheck.append(character);
}
} else if (!isNegativeSequence) {
if (isMasked) {
if (regExCheckOut.length() > 1) {
regExCheckOut.append('|');
}
regExCheckOut.append('\\');
regExCheckOut.append(character);
} else {
regExCheck.append(character);
}
}
isMasked = false;
break;
}
}
if (regExCheck.length() < 3) {
regExCheck.delete(1, regExCheck.length());
} else {
regExCheck.append(']');
if (regExCheckOut.length() > 0) {
regExCheck.append('|');
}
}
regExCheck.append(regExCheckOut);
regExCheck.append(')');
final RegExp regEx = RegExp.compile(regExCheck.toString());
final StringBuilder result = new StringBuilder();
for (int count = Character.MIN_VALUE; count < Character.MAX_VALUE; count++) {
if (regEx.exec(String.valueOf((char) count)) != null) {
result.append((char) count);
}
}
return result.toString();
} } | public class class_name {
public static String getAllowedCharactersForRegEx(final String pregEx) {
if (StringUtils.isEmpty(pregEx)) {
return null; // depends on control dependency: [if], data = [none]
}
final StringBuilder regExCheck = new StringBuilder();
final StringBuilder regExCheckOut = new StringBuilder();
boolean inSequence = false;
boolean isNegativeSequence = false;
boolean inSize = false;
boolean isMasked = false;
regExCheck.append("([");
for (final char character : pregEx.toCharArray()) {
switch (character) {
case '\\':
if (isMasked || inSequence) {
regExCheck.append(character); // depends on control dependency: [if], data = [none]
}
if (!inSequence) {
isMasked = !isMasked; // depends on control dependency: [if], data = [none]
}
break;
case '^':
if (inSequence) {
if (isMasked) {
regExCheck.append(character); // depends on control dependency: [if], data = [none]
} else {
isNegativeSequence = true; // depends on control dependency: [if], data = [none]
}
}
isMasked = false;
break;
case '$':
case '*':
case '+':
case '?':
case '|':
if (isMasked || inSequence) {
regExCheck.append(character); // depends on control dependency: [if], data = [none]
}
isMasked = false;
break;
case '[':
if (isMasked || inSequence) {
regExCheck.append(character); // depends on control dependency: [if], data = [none]
} else {
inSequence = true; // depends on control dependency: [if], data = [none]
isNegativeSequence = false; // depends on control dependency: [if], data = [none]
}
isMasked = false;
break;
case ']':
if (isMasked) {
regExCheck.append(character); // depends on control dependency: [if], data = [none]
} else {
inSequence = false; // depends on control dependency: [if], data = [none]
isNegativeSequence = false; // depends on control dependency: [if], data = [none]
}
isMasked = false;
break;
case '{':
if (isMasked || inSequence) {
regExCheck.append(character); // depends on control dependency: [if], data = [none]
} else {
inSize = true; // depends on control dependency: [if], data = [none]
}
isMasked = false;
break;
case '}':
if (isMasked || inSequence) {
regExCheck.append(character); // depends on control dependency: [if], data = [none]
} else {
inSize = false; // depends on control dependency: [if], data = [none]
}
isMasked = false;
break;
case '(':
if (isMasked || inSequence) {
regExCheck.append(character); // depends on control dependency: [if], data = [none]
}
isMasked = false;
break;
case ')':
if (isMasked || inSequence) {
regExCheck.append(character); // depends on control dependency: [if], data = [none]
}
isMasked = false;
break;
default:
if (inSize) {
if (character != ',' && (character < '0' || character > '9')) {
regExCheck.append(character); // depends on control dependency: [if], data = [(character]
}
} else if (!isNegativeSequence) {
if (isMasked) {
if (regExCheckOut.length() > 1) {
regExCheckOut.append('|'); // depends on control dependency: [if], data = [none]
}
regExCheckOut.append('\\'); // depends on control dependency: [if], data = [none]
regExCheckOut.append(character); // depends on control dependency: [if], data = [none]
} else {
regExCheck.append(character); // depends on control dependency: [if], data = [none]
}
}
isMasked = false;
break;
}
}
if (regExCheck.length() < 3) {
regExCheck.delete(1, regExCheck.length()); // depends on control dependency: [if], data = [none]
} else {
regExCheck.append(']'); // depends on control dependency: [if], data = [none]
if (regExCheckOut.length() > 0) {
regExCheck.append('|'); // depends on control dependency: [if], data = [none]
}
}
regExCheck.append(regExCheckOut);
regExCheck.append(')');
final RegExp regEx = RegExp.compile(regExCheck.toString());
final StringBuilder result = new StringBuilder();
for (int count = Character.MIN_VALUE; count < Character.MAX_VALUE; count++) {
if (regEx.exec(String.valueOf((char) count)) != null) {
result.append((char) count); // depends on control dependency: [if], data = [none]
}
}
return result.toString();
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.