code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public java.util.List<UserProfile> getUserProfiles() {
if (userProfiles == null) {
userProfiles = new com.amazonaws.internal.SdkInternalList<UserProfile>();
}
return userProfiles;
} }
|
public class class_name {
public java.util.List<UserProfile> getUserProfiles() {
if (userProfiles == null) {
userProfiles = new com.amazonaws.internal.SdkInternalList<UserProfile>(); // depends on control dependency: [if], data = [none]
}
return userProfiles;
} }
|
public class class_name {
public static long[] hashToLongs(final byte[] data, final long seed) {
if ((data == null) || (data.length == 0)) {
return null;
}
return hash(data, seed);
} }
|
public class class_name {
public static long[] hashToLongs(final byte[] data, final long seed) {
if ((data == null) || (data.length == 0)) {
return null; // depends on control dependency: [if], data = [none]
}
return hash(data, seed);
} }
|
public class class_name {
public double getLinkSlope() {
if ((int) linkSlope == -1) {
// hillslopeFeature.getAttribute(baricenterElevationAttribute);
double startElev = (Double) linkFeature.getAttribute(NetworkChannel.STARTELEVNAME);
double endElev = (Double) linkFeature.getAttribute(NetworkChannel.ENDELEVNAME);
linkSlope = (startElev - endElev) / getLinkLength();
if (linkSlope <= 0) {
/*
* if < 0 then probably it is very flat and the dem si not precise. The slope is
* set.
*/
linkSlope = 0.001;
}
}
return linkSlope;
} }
|
public class class_name {
public double getLinkSlope() {
if ((int) linkSlope == -1) {
// hillslopeFeature.getAttribute(baricenterElevationAttribute);
double startElev = (Double) linkFeature.getAttribute(NetworkChannel.STARTELEVNAME);
double endElev = (Double) linkFeature.getAttribute(NetworkChannel.ENDELEVNAME);
linkSlope = (startElev - endElev) / getLinkLength(); // depends on control dependency: [if], data = [none]
if (linkSlope <= 0) {
/*
* if < 0 then probably it is very flat and the dem si not precise. The slope is
* set.
*/
linkSlope = 0.001; // depends on control dependency: [if], data = [none]
}
}
return linkSlope;
} }
|
public class class_name {
private void informSharedSuccessHandlers(S result) {
if (result == null) {
// no handler matches undefined result class
return;
}
for (Map.Entry<Class, SuccessHandler> handler : config.sharedSuccessHandlers.entrySet()) {
if (handler.getKey().isAssignableFrom(result.getClass())) {
handler.getValue().onCallSuccess(result);
}
}
} }
|
public class class_name {
private void informSharedSuccessHandlers(S result) {
if (result == null) {
// no handler matches undefined result class
return; // depends on control dependency: [if], data = [none]
}
for (Map.Entry<Class, SuccessHandler> handler : config.sharedSuccessHandlers.entrySet()) {
if (handler.getKey().isAssignableFrom(result.getClass())) {
handler.getValue().onCallSuccess(result); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public EClass getIfcSoundProperties() {
if (ifcSoundPropertiesEClass == null) {
ifcSoundPropertiesEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(520);
}
return ifcSoundPropertiesEClass;
} }
|
public class class_name {
public EClass getIfcSoundProperties() {
if (ifcSoundPropertiesEClass == null) {
ifcSoundPropertiesEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(520);
// depends on control dependency: [if], data = [none]
}
return ifcSoundPropertiesEClass;
} }
|
public class class_name {
void runMoreOnKeyQueueOrStop(K key) {
EntryEvent<K,V> _event;
synchronized (getLockObject(key)) {
Queue<EntryEvent<K,V>> q = keyQueue.get(key);
if (q.isEmpty()) {
keyQueue.remove(key);
return;
}
_event = q.remove();
}
List<Listener<K,V>> _listeners =
new ArrayList<Listener<K, V>>(asyncListenerByType.get(_event.getEventType()));
if (_listeners.isEmpty()) {
runMoreOnKeyQueueOrStop(key);
return;
}
runAllListenersInParallel(_event, _listeners);
} }
|
public class class_name {
void runMoreOnKeyQueueOrStop(K key) {
EntryEvent<K,V> _event;
synchronized (getLockObject(key)) {
Queue<EntryEvent<K,V>> q = keyQueue.get(key);
if (q.isEmpty()) {
keyQueue.remove(key); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
_event = q.remove();
}
List<Listener<K,V>> _listeners =
new ArrayList<Listener<K, V>>(asyncListenerByType.get(_event.getEventType()));
if (_listeners.isEmpty()) {
runMoreOnKeyQueueOrStop(key); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
runAllListenersInParallel(_event, _listeners);
} }
|
public class class_name {
private static List<Field> getAllField(Class<?> entityClass, List<Field> fieldList) {
if (fieldList == null) {
fieldList = new ArrayList<Field>();
}
if (entityClass.equals(Object.class)) {
return fieldList;
}
Field[] fields = entityClass.getDeclaredFields();
for (Field field : fields) {
// 排除静态字段
if (!Modifier.isStatic(field.getModifiers())) {
fieldList.add(field);
}
}
Class<?> superClass = entityClass.getSuperclass();
if (superClass != null && !superClass.equals(Object.class)
&& (!Map.class.isAssignableFrom(superClass) && !Collection.class.isAssignableFrom(superClass))) {
return getAllField(entityClass.getSuperclass(), fieldList);
}
return fieldList;
} }
|
public class class_name {
private static List<Field> getAllField(Class<?> entityClass, List<Field> fieldList) {
if (fieldList == null) {
fieldList = new ArrayList<Field>();
// depends on control dependency: [if], data = [none]
}
if (entityClass.equals(Object.class)) {
return fieldList;
// depends on control dependency: [if], data = [none]
}
Field[] fields = entityClass.getDeclaredFields();
for (Field field : fields) {
// 排除静态字段
if (!Modifier.isStatic(field.getModifiers())) {
fieldList.add(field);
// depends on control dependency: [if], data = [none]
}
}
Class<?> superClass = entityClass.getSuperclass();
if (superClass != null && !superClass.equals(Object.class)
&& (!Map.class.isAssignableFrom(superClass) && !Collection.class.isAssignableFrom(superClass))) {
return getAllField(entityClass.getSuperclass(), fieldList);
// depends on control dependency: [if], data = [none]
}
return fieldList;
} }
|
public class class_name {
@NotNull
public OptionalLong reduce(@NotNull LongBinaryOperator accumulator) {
boolean foundAny = false;
long result = 0;
while (iterator.hasNext()) {
final long value = iterator.nextLong();
if (!foundAny) {
foundAny = true;
result = value;
} else {
result = accumulator.applyAsLong(result, value);
}
}
return foundAny ? OptionalLong.of(result) : OptionalLong.empty();
} }
|
public class class_name {
@NotNull
public OptionalLong reduce(@NotNull LongBinaryOperator accumulator) {
boolean foundAny = false;
long result = 0;
while (iterator.hasNext()) {
final long value = iterator.nextLong();
if (!foundAny) {
foundAny = true; // depends on control dependency: [if], data = [none]
result = value; // depends on control dependency: [if], data = [none]
} else {
result = accumulator.applyAsLong(result, value); // depends on control dependency: [if], data = [none]
}
}
return foundAny ? OptionalLong.of(result) : OptionalLong.empty();
} }
|
public class class_name {
private List<String> getSourceRoots( final MavenProject project, final String scope )
{
if ( SCOPE_COMPILE.equals( scope ) || SCOPE_RUNTIME.equals( scope ) )
{
return project.getCompileSourceRoots();
}
else if ( SCOPE_TEST.equals( scope ) )
{
List<String> sourceRoots = new ArrayList<String>();
sourceRoots.addAll( project.getTestCompileSourceRoots() );
sourceRoots.addAll( project.getCompileSourceRoots() );
return sourceRoots;
}
else
{
throw new RuntimeException( "Not allowed scope " + scope );
}
} }
|
public class class_name {
private List<String> getSourceRoots( final MavenProject project, final String scope )
{
if ( SCOPE_COMPILE.equals( scope ) || SCOPE_RUNTIME.equals( scope ) )
{
return project.getCompileSourceRoots(); // depends on control dependency: [if], data = [none]
}
else if ( SCOPE_TEST.equals( scope ) )
{
List<String> sourceRoots = new ArrayList<String>();
sourceRoots.addAll( project.getTestCompileSourceRoots() ); // depends on control dependency: [if], data = [none]
sourceRoots.addAll( project.getCompileSourceRoots() ); // depends on control dependency: [if], data = [none]
return sourceRoots; // depends on control dependency: [if], data = [none]
}
else
{
throw new RuntimeException( "Not allowed scope " + scope );
}
} }
|
public class class_name {
private ProjectedEnergy projectedEnergy(Relation<V> relation, ORCLUSCluster c_i, ORCLUSCluster c_j, int i, int j, int dim) {
NumberVectorDistanceFunction<? super V> distFunc = SquaredEuclideanDistanceFunction.STATIC;
// union of cluster c_i and c_j
ORCLUSCluster c_ij = union(relation, c_i, c_j, dim);
double sum = 0.;
NumberVector c_proj = DoubleVector.wrap(project(c_ij, c_ij.centroid));
for(DBIDIter iter = c_ij.objectIDs.iter(); iter.valid(); iter.advance()) {
NumberVector o_proj = DoubleVector.wrap(project(c_ij, relation.get(iter).toArray()));
sum += distFunc.distance(o_proj, c_proj);
}
sum /= c_ij.objectIDs.size();
return new ProjectedEnergy(i, j, c_ij, sum);
} }
|
public class class_name {
private ProjectedEnergy projectedEnergy(Relation<V> relation, ORCLUSCluster c_i, ORCLUSCluster c_j, int i, int j, int dim) {
NumberVectorDistanceFunction<? super V> distFunc = SquaredEuclideanDistanceFunction.STATIC;
// union of cluster c_i and c_j
ORCLUSCluster c_ij = union(relation, c_i, c_j, dim);
double sum = 0.;
NumberVector c_proj = DoubleVector.wrap(project(c_ij, c_ij.centroid));
for(DBIDIter iter = c_ij.objectIDs.iter(); iter.valid(); iter.advance()) {
NumberVector o_proj = DoubleVector.wrap(project(c_ij, relation.get(iter).toArray()));
sum += distFunc.distance(o_proj, c_proj); // depends on control dependency: [for], data = [none]
}
sum /= c_ij.objectIDs.size();
return new ProjectedEnergy(i, j, c_ij, sum);
} }
|
public class class_name {
protected CmsFormatterConfiguration getFormattersFromSchema(CmsObject cms, CmsResource res) {
try {
return OpenCms.getResourceManager().getResourceType(res.getTypeId()).getFormattersForResource(cms, res);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
return CmsFormatterConfiguration.EMPTY_CONFIGURATION;
}
} }
|
public class class_name {
protected CmsFormatterConfiguration getFormattersFromSchema(CmsObject cms, CmsResource res) {
try {
return OpenCms.getResourceManager().getResourceType(res.getTypeId()).getFormattersForResource(cms, res); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
return CmsFormatterConfiguration.EMPTY_CONFIGURATION;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static <T> Set<T> asSet(final Iterable<T> iterable)
{
Set<T> result = new HashSet<T>();
for (T t : iterable)
{
result.add(t);
}
return result;
} }
|
public class class_name {
public static <T> Set<T> asSet(final Iterable<T> iterable)
{
Set<T> result = new HashSet<T>();
for (T t : iterable)
{
result.add(t); // depends on control dependency: [for], data = [t]
}
return result;
} }
|
public class class_name {
public void cleanup(List<IRStatus<PIR>> statuses)
{
for (IRStatus<PIR> s : statuses)
{
cleanup(s);
}
} }
|
public class class_name {
public void cleanup(List<IRStatus<PIR>> statuses)
{
for (IRStatus<PIR> s : statuses)
{
cleanup(s); // depends on control dependency: [for], data = [s]
}
} }
|
public class class_name {
public static int compareLevenshtein(String s, String t) {
int n = s.length();
int m = t.length();
if (n == 0) {
return m;
}
if (m == 0) {
return n;
}
int[][] d = new int[n + 1][m + 1];
for (int i = 0; i <= n; d[i][0] = i++) {};
for (int j = 1; j <= m; d[0][j] = j++) {};
for (int i = 1; i <= n; i++) {
char sc = s.charAt(i - 1);
for (int j = 1; j <= m; j++) {
int v = d[i - 1][j - 1];
if (t.charAt(j - 1) != sc) {
v++;
}
d[i][j] = Math.min(Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1), v);
}
}
return d[n][m];
} }
|
public class class_name {
public static int compareLevenshtein(String s, String t) {
int n = s.length();
int m = t.length();
if (n == 0) {
return m; // depends on control dependency: [if], data = [none]
}
if (m == 0) {
return n; // depends on control dependency: [if], data = [none]
}
int[][] d = new int[n + 1][m + 1];
for (int i = 0; i <= n; d[i][0] = i++) {};
for (int j = 1; j <= m; d[0][j] = j++) {};
for (int i = 1; i <= n; i++) {
char sc = s.charAt(i - 1);
for (int j = 1; j <= m; j++) {
int v = d[i - 1][j - 1];
if (t.charAt(j - 1) != sc) {
v++; // depends on control dependency: [if], data = [none]
}
d[i][j] = Math.min(Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1), v); // depends on control dependency: [for], data = [j]
}
}
return d[n][m];
} }
|
public class class_name {
public boolean matches(GHCommitPointer commit) {
final GHUser user;
try {
user = commit.getUser();
} catch (IOException ex) {
LOGGER.debug("Failed to extract user from commit " + commit, ex);
return false;
}
return userName.equals(user.getLogin())
&& repositoryName.equals(commit.getRepository().getName())
&& host.equals(commit.getRepository().getHtmlUrl().getHost());
} }
|
public class class_name {
public boolean matches(GHCommitPointer commit) {
final GHUser user;
try {
user = commit.getUser(); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
LOGGER.debug("Failed to extract user from commit " + commit, ex);
return false;
} // depends on control dependency: [catch], data = [none]
return userName.equals(user.getLogin())
&& repositoryName.equals(commit.getRepository().getName())
&& host.equals(commit.getRepository().getHtmlUrl().getHost());
} }
|
public class class_name {
Element getElement(String className) {
int templateStart = className.indexOf('<');
if (templateStart != -1) {
className = className.substring(0, templateStart).trim();
}
return elementUtils.getTypeElement(className);
} }
|
public class class_name {
Element getElement(String className) {
int templateStart = className.indexOf('<');
if (templateStart != -1) {
className = className.substring(0, templateStart).trim();
// depends on control dependency: [if], data = [none]
}
return elementUtils.getTypeElement(className);
} }
|
public class class_name {
public void didSendMessage(final String message, final Date timestamp) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != listenerReference) {
Listener listener = listenerReference.get();
if (null != listener) {
listener.onMessage(message, timestamp, RespokeEndpoint.this, true);
}
}
}
});
} }
|
public class class_name {
public void didSendMessage(final String message, final Date timestamp) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != listenerReference) {
Listener listener = listenerReference.get();
if (null != listener) {
listener.onMessage(message, timestamp, RespokeEndpoint.this, true); // depends on control dependency: [if], data = [none]
}
}
}
});
} }
|
public class class_name {
public void marshall(Threshold threshold, ProtocolMarshaller protocolMarshaller) {
if (threshold == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(threshold.getComparison(), COMPARISON_BINDING);
protocolMarshaller.marshall(threshold.getThresholdValue(), THRESHOLDVALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Threshold threshold, ProtocolMarshaller protocolMarshaller) {
if (threshold == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(threshold.getComparison(), COMPARISON_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(threshold.getThresholdValue(), THRESHOLDVALUE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void notifyAdapterItemMoved(int fromPosition, int toPosition) {
// handle our extensions
for (IAdapterExtension<Item> ext : mExtensions.values()) {
ext.notifyAdapterItemMoved(fromPosition, toPosition);
}
notifyItemMoved(fromPosition, toPosition);
} }
|
public class class_name {
public void notifyAdapterItemMoved(int fromPosition, int toPosition) {
// handle our extensions
for (IAdapterExtension<Item> ext : mExtensions.values()) {
ext.notifyAdapterItemMoved(fromPosition, toPosition); // depends on control dependency: [for], data = [ext]
}
notifyItemMoved(fromPosition, toPosition);
} }
|
public class class_name {
private Symbol hiddenInInternal(ClassSymbol currentClass, Types types) {
if (currentClass == owner) {
return this;
}
for (Symbol sym : currentClass.members().getSymbolsByName(name)) {
if (sym.kind == kind &&
(kind != MTH ||
(sym.flags() & STATIC) != 0 &&
types.isSubSignature(sym.type, type))) {
return sym;
}
}
Symbol hiddenSym = null;
for (Type st : types.interfaces(currentClass.type)
.prepend(types.supertype(currentClass.type))) {
if (st != null && (st.hasTag(CLASS))) {
Symbol sym = hiddenInInternal((ClassSymbol)st.tsym, types);
if (sym == this) {
return this;
} else if (sym != null) {
hiddenSym = sym;
}
}
}
return hiddenSym;
} }
|
public class class_name {
private Symbol hiddenInInternal(ClassSymbol currentClass, Types types) {
if (currentClass == owner) {
return this; // depends on control dependency: [if], data = [none]
}
for (Symbol sym : currentClass.members().getSymbolsByName(name)) {
if (sym.kind == kind &&
(kind != MTH ||
(sym.flags() & STATIC) != 0 &&
types.isSubSignature(sym.type, type))) {
return sym; // depends on control dependency: [if], data = [none]
}
}
Symbol hiddenSym = null;
for (Type st : types.interfaces(currentClass.type)
.prepend(types.supertype(currentClass.type))) {
if (st != null && (st.hasTag(CLASS))) {
Symbol sym = hiddenInInternal((ClassSymbol)st.tsym, types);
if (sym == this) {
return this; // depends on control dependency: [if], data = [none]
} else if (sym != null) {
hiddenSym = sym; // depends on control dependency: [if], data = [none]
}
}
}
return hiddenSym;
} }
|
public class class_name {
private void printErrLine(int pos, PrintWriter writer) {
String line = (source == null ? null : source.getLine(pos));
if (line == null)
return;
int col = source.getColumnNumber(pos, false);
printRawLines(writer, line);
for (int i = 0; i < col - 1; i++) {
writer.print((line.charAt(i) == '\t') ? "\t" : " ");
}
writer.println("^");
writer.flush();
} }
|
public class class_name {
private void printErrLine(int pos, PrintWriter writer) {
String line = (source == null ? null : source.getLine(pos));
if (line == null)
return;
int col = source.getColumnNumber(pos, false);
printRawLines(writer, line);
for (int i = 0; i < col - 1; i++) {
writer.print((line.charAt(i) == '\t') ? "\t" : " "); // depends on control dependency: [for], data = [i]
}
writer.println("^");
writer.flush();
} }
|
public class class_name {
protected void markLocalTransactionWrapperInUse() throws ResourceException {
final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.entry(this, tc, "markLocalTransactionWrapperInUse");
}
if (state == STATE_ACTIVE_INUSE) {
state = STATE_TRAN_WRAPPER_INUSE;
tranWrapperInUse = LOCALTXWRAPPER;
/*
* If we are not in the shared pool we need to move the mcWrapper from
* the unshared pool to the shared pool. Under normal conditions, this should not
* be needed. The non-normal condition is when a user starts a user thread and
* gets a connection then starts a transaction.
*/
if (!(isInSharedPool() || this.getPoolState() == MCWrapper.ConnectionState_sharedTLSPool)) {
if (cm.shareable()) {
pm.moveMCWrapperFromUnSharedToShared(this, uowCoord);
}
}
} else { // state not STATE_ACTIVE_INUSE
if (state != STATE_TRAN_WRAPPER_INUSE) {
IllegalStateException e = new IllegalStateException("markLocalTransactionWrapperInUse: illegal state exception. State = " + getStateString() + " MCW = "
+ mcWrapperObject_hexString);
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", "markLocalTransactionWrapperInUse", e);
throw e;
} else { // state is STATE_TRAN_WRAPPER_INUSE
if (tranWrapperInUse == NONE) {
tranWrapperInUse = LOCALTXWRAPPER;
} else { //tranWrapperInUse is NOT NONE
if (tranWrapperInUse != LOCALTXWRAPPER) {
// Need RAS and Trace here.
IllegalStateException e = new IllegalStateException("markLocalTransactionWrapperInUse: illegal transaction state exception. State = "
+ getTranWrapperString());
Object[] parms = new Object[] { "markLocalTransactionWrapperInUse", e };
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
throw e;
}
}
}
}
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.exit(this, tc, "markLocalTransactionWrapperInUse");
}
return;
} }
|
public class class_name {
protected void markLocalTransactionWrapperInUse() throws ResourceException {
final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.entry(this, tc, "markLocalTransactionWrapperInUse");
}
if (state == STATE_ACTIVE_INUSE) {
state = STATE_TRAN_WRAPPER_INUSE;
tranWrapperInUse = LOCALTXWRAPPER;
/*
* If we are not in the shared pool we need to move the mcWrapper from
* the unshared pool to the shared pool. Under normal conditions, this should not
* be needed. The non-normal condition is when a user starts a user thread and
* gets a connection then starts a transaction.
*/
if (!(isInSharedPool() || this.getPoolState() == MCWrapper.ConnectionState_sharedTLSPool)) {
if (cm.shareable()) {
pm.moveMCWrapperFromUnSharedToShared(this, uowCoord); // depends on control dependency: [if], data = [none]
}
}
} else { // state not STATE_ACTIVE_INUSE
if (state != STATE_TRAN_WRAPPER_INUSE) {
IllegalStateException e = new IllegalStateException("markLocalTransactionWrapperInUse: illegal state exception. State = " + getStateString() + " MCW = "
+ mcWrapperObject_hexString);
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", "markLocalTransactionWrapperInUse", e); // depends on control dependency: [if], data = [none]
throw e;
} else { // state is STATE_TRAN_WRAPPER_INUSE
if (tranWrapperInUse == NONE) {
tranWrapperInUse = LOCALTXWRAPPER; // depends on control dependency: [if], data = [none]
} else { //tranWrapperInUse is NOT NONE
if (tranWrapperInUse != LOCALTXWRAPPER) {
// Need RAS and Trace here.
IllegalStateException e = new IllegalStateException("markLocalTransactionWrapperInUse: illegal transaction state exception. State = "
+ getTranWrapperString());
Object[] parms = new Object[] { "markLocalTransactionWrapperInUse", e };
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms); // depends on control dependency: [if], data = [none]
throw e;
}
}
}
}
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.exit(this, tc, "markLocalTransactionWrapperInUse");
}
return;
} }
|
public class class_name {
public static List<AbstractInsnNode> findInvocationsWithParameter(InsnList insnList,
Type expectedParamType) {
Validate.notNull(insnList);
Validate.notNull(expectedParamType);
Validate.isTrue(expectedParamType.getSort() != Type.METHOD && expectedParamType.getSort() != Type.VOID);
List<AbstractInsnNode> ret = new ArrayList<>();
Iterator<AbstractInsnNode> it = insnList.iterator();
while (it.hasNext()) {
AbstractInsnNode instructionNode = it.next();
Type[] methodParamTypes;
if (instructionNode instanceof MethodInsnNode) {
MethodInsnNode methodInsnNode = (MethodInsnNode) instructionNode;
Type methodType = Type.getType(methodInsnNode.desc);
methodParamTypes = methodType.getArgumentTypes();
} else if (instructionNode instanceof InvokeDynamicInsnNode) {
InvokeDynamicInsnNode invokeDynamicInsnNode = (InvokeDynamicInsnNode) instructionNode;
Type methodType = Type.getType(invokeDynamicInsnNode.desc);
methodParamTypes = methodType.getArgumentTypes();
} else {
continue;
}
if (Arrays.asList(methodParamTypes).contains(expectedParamType)) {
ret.add(instructionNode);
}
}
return ret;
} }
|
public class class_name {
public static List<AbstractInsnNode> findInvocationsWithParameter(InsnList insnList,
Type expectedParamType) {
Validate.notNull(insnList);
Validate.notNull(expectedParamType);
Validate.isTrue(expectedParamType.getSort() != Type.METHOD && expectedParamType.getSort() != Type.VOID);
List<AbstractInsnNode> ret = new ArrayList<>();
Iterator<AbstractInsnNode> it = insnList.iterator();
while (it.hasNext()) {
AbstractInsnNode instructionNode = it.next();
Type[] methodParamTypes;
if (instructionNode instanceof MethodInsnNode) {
MethodInsnNode methodInsnNode = (MethodInsnNode) instructionNode;
Type methodType = Type.getType(methodInsnNode.desc);
methodParamTypes = methodType.getArgumentTypes(); // depends on control dependency: [if], data = [none]
} else if (instructionNode instanceof InvokeDynamicInsnNode) {
InvokeDynamicInsnNode invokeDynamicInsnNode = (InvokeDynamicInsnNode) instructionNode;
Type methodType = Type.getType(invokeDynamicInsnNode.desc);
methodParamTypes = methodType.getArgumentTypes(); // depends on control dependency: [if], data = [none]
} else {
continue;
}
if (Arrays.asList(methodParamTypes).contains(expectedParamType)) {
ret.add(instructionNode); // depends on control dependency: [if], data = [none]
}
}
return ret;
} }
|
public class class_name {
public MessageDrivenBeanType<EnterpriseBeansType<T>> getOrCreateMessageDriven()
{
List<Node> nodeList = childNode.get("message-driven");
if (nodeList != null && nodeList.size() > 0)
{
return new MessageDrivenBeanTypeImpl<EnterpriseBeansType<T>>(this, "message-driven", childNode, nodeList.get(0));
}
return createMessageDriven();
} }
|
public class class_name {
public MessageDrivenBeanType<EnterpriseBeansType<T>> getOrCreateMessageDriven()
{
List<Node> nodeList = childNode.get("message-driven");
if (nodeList != null && nodeList.size() > 0)
{
return new MessageDrivenBeanTypeImpl<EnterpriseBeansType<T>>(this, "message-driven", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createMessageDriven();
} }
|
public class class_name {
public final Iterable<V> getAllAccessibleVariables() {
Map<String, V> accessibleVars = new LinkedHashMap<>();
S s = thisScope();
while (s != null) {
for (V v : s.getVarIterable()) {
accessibleVars.putIfAbsent(v.getName(), v);
}
s = s.getParent();
}
return accessibleVars.values();
} }
|
public class class_name {
public final Iterable<V> getAllAccessibleVariables() {
Map<String, V> accessibleVars = new LinkedHashMap<>();
S s = thisScope();
while (s != null) {
for (V v : s.getVarIterable()) {
accessibleVars.putIfAbsent(v.getName(), v); // depends on control dependency: [for], data = [v]
}
s = s.getParent(); // depends on control dependency: [while], data = [none]
}
return accessibleVars.values();
} }
|
public class class_name {
public EClass getMeasurementUnits() {
if (measurementUnitsEClass == null) {
measurementUnitsEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(363);
}
return measurementUnitsEClass;
} }
|
public class class_name {
public EClass getMeasurementUnits() {
if (measurementUnitsEClass == null) {
measurementUnitsEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(363); // depends on control dependency: [if], data = [none]
}
return measurementUnitsEClass;
} }
|
public class class_name {
@Override
public String getOrigin() {
try {
return ((ServletRequest) ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes())
.getRequest()).getRemoteAddr();
} catch (Exception e) {
e.printStackTrace();
}
return undefienedOriginName;
} }
|
public class class_name {
@Override
public String getOrigin() {
try {
return ((ServletRequest) ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes())
.getRequest()).getRemoteAddr(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return undefienedOriginName;
} }
|
public class class_name {
@Override
public void disable(User appSensorUser) {
logger.info("Request received to disable user <{}>.", appSensorUser.getUsername());
if (userDetailsManager == null) {
logger.warn("Could not disable user [" + appSensorUser.getUsername()
+ "] since the spring security " +
"UserDetailsManager is not properly configured.");
return;
}
UserDetails springUser = userDetailsManager.loadUserByUsername(appSensorUser.getUsername());
if (springUser == null) {
logger.warn("Could not disable user [" + appSensorUser.getUsername()
+ "] because the user could not " +
"be found by lookup");
return;
}
logger.info("Disabling user <{}>.", springUser.getUsername());
userDetailsManager.updateUser(new DisabledUser(springUser));
logger.info("After disabling user <{}>, also logging out so the disable gets triggered.",
springUser.getUsername());
userResponseCache.setUserLoggedOut(appSensorUser.getUsername());
} }
|
public class class_name {
@Override
public void disable(User appSensorUser) {
logger.info("Request received to disable user <{}>.", appSensorUser.getUsername());
if (userDetailsManager == null) {
logger.warn("Could not disable user [" + appSensorUser.getUsername()
+ "] since the spring security " +
"UserDetailsManager is not properly configured."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
UserDetails springUser = userDetailsManager.loadUserByUsername(appSensorUser.getUsername());
if (springUser == null) {
logger.warn("Could not disable user [" + appSensorUser.getUsername()
+ "] because the user could not " +
"be found by lookup"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
logger.info("Disabling user <{}>.", springUser.getUsername());
userDetailsManager.updateUser(new DisabledUser(springUser));
logger.info("After disabling user <{}>, also logging out so the disable gets triggered.",
springUser.getUsername());
userResponseCache.setUserLoggedOut(appSensorUser.getUsername());
} }
|
public class class_name {
public boolean recordParameterDescription(
String parameterName, String description) {
if (currentInfo.documentParam(parameterName, description)) {
populated = true;
return true;
} else {
return false;
}
} }
|
public class class_name {
public boolean recordParameterDescription(
String parameterName, String description) {
if (currentInfo.documentParam(parameterName, description)) {
populated = true; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void updatePlaying(double extrp)
{
current += speed * extrp;
// Last frame reached
if (Double.compare(current, last + FRAME) >= 0)
{
// If not reversed, done, else, reverse
current = last + HALF_FRAME;
checkStatePlaying();
}
} }
|
public class class_name {
private void updatePlaying(double extrp)
{
current += speed * extrp;
// Last frame reached
if (Double.compare(current, last + FRAME) >= 0)
{
// If not reversed, done, else, reverse
current = last + HALF_FRAME; // depends on control dependency: [if], data = [none]
checkStatePlaying(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public java.util.List<EnhancedMetrics> getEnhancedMonitoring() {
if (enhancedMonitoring == null) {
enhancedMonitoring = new com.amazonaws.internal.SdkInternalList<EnhancedMetrics>();
}
return enhancedMonitoring;
} }
|
public class class_name {
public java.util.List<EnhancedMetrics> getEnhancedMonitoring() {
if (enhancedMonitoring == null) {
enhancedMonitoring = new com.amazonaws.internal.SdkInternalList<EnhancedMetrics>(); // depends on control dependency: [if], data = [none]
}
return enhancedMonitoring;
} }
|
public class class_name {
@Nonnull
public static String [] getExplodedArray (final char cSep,
@Nullable final String sElements,
@CheckForSigned final int nMaxItems)
{
if (nMaxItems == 1)
return new String [] { sElements };
if (hasNoText (sElements))
return ArrayHelper.EMPTY_STRING_ARRAY;
final int nMaxResultElements = 1 + getCharCount (sElements, cSep);
if (nMaxResultElements == 1)
{
// Separator not found
return new String [] { sElements };
}
final String [] ret = new String [nMaxItems < 1 ? nMaxResultElements : Math.min (nMaxResultElements, nMaxItems)];
// Do not use RegExCache.stringReplacePattern because of package
// dependencies
// Do not use String.split because it trims empty tokens from the end
int nStartIndex = 0;
int nItemsAdded = 0;
while (true)
{
final int nMatchIndex = sElements.indexOf (cSep, nStartIndex);
if (nMatchIndex < 0)
break;
ret[nItemsAdded++] = sElements.substring (nStartIndex, nMatchIndex);
// 1 == length of separator char
nStartIndex = nMatchIndex + 1;
if (nMaxItems > 0 && nItemsAdded == nMaxItems - 1)
{
// We have exactly one item the left: the rest of the string
break;
}
}
ret[nItemsAdded++] = sElements.substring (nStartIndex);
if (nItemsAdded != ret.length)
throw new IllegalStateException ("Added " + nItemsAdded + " but expected " + ret.length);
return ret;
} }
|
public class class_name {
@Nonnull
public static String [] getExplodedArray (final char cSep,
@Nullable final String sElements,
@CheckForSigned final int nMaxItems)
{
if (nMaxItems == 1)
return new String [] { sElements };
if (hasNoText (sElements))
return ArrayHelper.EMPTY_STRING_ARRAY;
final int nMaxResultElements = 1 + getCharCount (sElements, cSep);
if (nMaxResultElements == 1)
{
// Separator not found
return new String [] { sElements }; // depends on control dependency: [if], data = [none]
}
final String [] ret = new String [nMaxItems < 1 ? nMaxResultElements : Math.min (nMaxResultElements, nMaxItems)];
// Do not use RegExCache.stringReplacePattern because of package
// dependencies
// Do not use String.split because it trims empty tokens from the end
int nStartIndex = 0;
int nItemsAdded = 0;
while (true)
{
final int nMatchIndex = sElements.indexOf (cSep, nStartIndex);
if (nMatchIndex < 0)
break;
ret[nItemsAdded++] = sElements.substring (nStartIndex, nMatchIndex); // depends on control dependency: [while], data = [none]
// 1 == length of separator char
nStartIndex = nMatchIndex + 1; // depends on control dependency: [while], data = [none]
if (nMaxItems > 0 && nItemsAdded == nMaxItems - 1)
{
// We have exactly one item the left: the rest of the string
break;
}
}
ret[nItemsAdded++] = sElements.substring (nStartIndex);
if (nItemsAdded != ret.length)
throw new IllegalStateException ("Added " + nItemsAdded + " but expected " + ret.length);
return ret;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
static <P> MutableLightMetaProperty<P> of(
MetaBean metaBean,
final Field field,
final String propertyName,
int constructorIndex) {
PropertyGetter getter = new PropertyGetter() {
@Override
public Object get(Bean bean) {
try {
return field.get(bean);
} catch (IllegalArgumentException | IllegalAccessException ex) {
throw new UnsupportedOperationException("Property cannot be read: " + propertyName, ex);
}
}
};
PropertySetter setter = new PropertySetter() {
@Override
public void set(Bean bean, Object value) {
try {
field.set(bean, value);
} catch (IllegalArgumentException | IllegalAccessException ex) {
throw new UnsupportedOperationException("Property cannot be read: " + propertyName, ex);
}
}
};
return new MutableLightMetaProperty<>(
metaBean,
propertyName,
(Class<P>) field.getType(),
field.getGenericType(),
Arrays.asList(field.getAnnotations()),
getter,
setter,
constructorIndex);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
static <P> MutableLightMetaProperty<P> of(
MetaBean metaBean,
final Field field,
final String propertyName,
int constructorIndex) {
PropertyGetter getter = new PropertyGetter() {
@Override
public Object get(Bean bean) {
try {
return field.get(bean); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException | IllegalAccessException ex) {
throw new UnsupportedOperationException("Property cannot be read: " + propertyName, ex);
} // depends on control dependency: [catch], data = [none]
}
};
PropertySetter setter = new PropertySetter() {
@Override
public void set(Bean bean, Object value) {
try {
field.set(bean, value); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException | IllegalAccessException ex) {
throw new UnsupportedOperationException("Property cannot be read: " + propertyName, ex);
} // depends on control dependency: [catch], data = [none]
}
};
return new MutableLightMetaProperty<>(
metaBean,
propertyName,
(Class<P>) field.getType(),
field.getGenericType(),
Arrays.asList(field.getAnnotations()),
getter,
setter,
constructorIndex);
} }
|
public class class_name {
protected void processRelationship(final ParserData parserData, final SpecNodeWithRelationships specNode,
final Relationship relationship) {
final String relatedId = relationship.getSecondaryRelationshipId();
// The relationship points to a target so it must be a level or topic
if (relatedId.toUpperCase(Locale.ENGLISH).matches(ProcessorConstants.TARGET_REGEX)) {
if (parserData.getTargetTopics().containsKey(relatedId) && !parserData.getTargetLevels().containsKey(relatedId)) {
specNode.addRelationshipToTarget(parserData.getTargetTopics().get(relatedId), relationship.getType(),
relationship.getRelationshipTitle());
} else if (!parserData.getTargetTopics().containsKey(relatedId) && parserData.getTargetLevels().containsKey(relatedId)) {
specNode.addRelationshipToTarget(parserData.getTargetLevels().get(relatedId), relationship.getType(),
relationship.getRelationshipTitle());
} else {
final SpecTopic dummyTopic = new SpecTopic(-1, "");
dummyTopic.setTargetId(relatedId);
dummyTopic.setUniqueId("-1");
specNode.addRelationshipToTarget(dummyTopic, relationship.getType(), relationship.getRelationshipTitle());
}
}
// The relationship isn't a target so it must point to a topic directly
else {
if (!CSConstants.NEW_TOPIC_ID_PATTERN.matcher(relatedId).matches()) {
// The relationship isn't a unique new topic so it will contain the line number in front of
// the topic ID
if (!relatedId.startsWith("X")) {
int count = 0;
SpecTopic relatedTopic = null;
// Get the related topic and count if more then one is found
for (final Map.Entry<String, SpecTopic> specTopicEntry : parserData.getSpecTopics().entrySet()) {
if (specTopicEntry.getKey().matches("^[\\w\\d]+-" + relatedId + "$")) {
relatedTopic = specTopicEntry.getValue();
count++;
}
}
/*
* Add the relationship to the node even if the relationship isn't duplicated
* and the related topic isn't the current topic. This is so it shows up in the
* output.
*/
if (count > 0) {
specNode.addRelationshipToTopic(relatedTopic, relationship.getType(), relationship.getRelationshipTitle());
} else {
final SpecTopic dummyTopic = new SpecTopic(-1, "");
dummyTopic.setId(relatedId);
dummyTopic.setUniqueId("-1");
specNode.addRelationshipToTopic(dummyTopic, relationship.getType(), relationship.getRelationshipTitle());
}
} else {
final SpecTopic dummyTopic = new SpecTopic(-1, "");
dummyTopic.setId(relatedId);
dummyTopic.setUniqueId("-1");
specNode.addRelationshipToTopic(dummyTopic, relationship.getType(), relationship.getRelationshipTitle());
}
} else {
if (parserData.getSpecTopics().containsKey(relatedId)) {
final SpecTopic relatedSpecTopic = parserData.getSpecTopics().get(relatedId);
// Check that a duplicate doesn't exist, because if it does the new topic isn't unique
String duplicatedId = "X" + relatedId.substring(1);
boolean duplicateExists = false;
for (String uniqueTopicId : parserData.getSpecTopics().keySet()) {
if (uniqueTopicId.matches("^[\\w\\d]+-" + duplicatedId + "$")) {
duplicateExists = true;
break;
}
}
if (relatedSpecTopic != specNode) {
if (!duplicateExists) {
specNode.addRelationshipToTopic(relatedSpecTopic, relationship.getType(), relationship.getRelationshipTitle());
} else {
// Only create a new target if one doesn't already exist
if (relatedSpecTopic.getTargetId() == null) {
String targetId = ContentSpecUtilities.generateRandomTargetId(relatedSpecTopic.getUniqueId());
while (parserData.getTargetTopics().containsKey(targetId) || parserData.getTargetLevels().containsKey(
targetId)) {
targetId = ContentSpecUtilities.generateRandomTargetId(relatedSpecTopic.getUniqueId());
}
parserData.getSpecTopics().get(relatedId).setTargetId(targetId);
parserData.getTargetTopics().put(targetId, relatedSpecTopic);
}
specNode.addRelationshipToTopic(relatedSpecTopic, relationship.getType(), relationship.getRelationshipTitle());
}
}
} else {
final SpecTopic dummyTopic = new SpecTopic(-1, "");
dummyTopic.setId(relatedId);
dummyTopic.setUniqueId("-1");
specNode.addRelationshipToTopic(dummyTopic, relationship.getType(), relationship.getRelationshipTitle());
}
}
}
} }
|
public class class_name {
protected void processRelationship(final ParserData parserData, final SpecNodeWithRelationships specNode,
final Relationship relationship) {
final String relatedId = relationship.getSecondaryRelationshipId();
// The relationship points to a target so it must be a level or topic
if (relatedId.toUpperCase(Locale.ENGLISH).matches(ProcessorConstants.TARGET_REGEX)) {
if (parserData.getTargetTopics().containsKey(relatedId) && !parserData.getTargetLevels().containsKey(relatedId)) {
specNode.addRelationshipToTarget(parserData.getTargetTopics().get(relatedId), relationship.getType(),
relationship.getRelationshipTitle()); // depends on control dependency: [if], data = [none]
} else if (!parserData.getTargetTopics().containsKey(relatedId) && parserData.getTargetLevels().containsKey(relatedId)) {
specNode.addRelationshipToTarget(parserData.getTargetLevels().get(relatedId), relationship.getType(),
relationship.getRelationshipTitle()); // depends on control dependency: [if], data = [none]
} else {
final SpecTopic dummyTopic = new SpecTopic(-1, "");
dummyTopic.setTargetId(relatedId); // depends on control dependency: [if], data = [none]
dummyTopic.setUniqueId("-1"); // depends on control dependency: [if], data = [none]
specNode.addRelationshipToTarget(dummyTopic, relationship.getType(), relationship.getRelationshipTitle()); // depends on control dependency: [if], data = [none]
}
}
// The relationship isn't a target so it must point to a topic directly
else {
if (!CSConstants.NEW_TOPIC_ID_PATTERN.matcher(relatedId).matches()) {
// The relationship isn't a unique new topic so it will contain the line number in front of
// the topic ID
if (!relatedId.startsWith("X")) {
int count = 0;
SpecTopic relatedTopic = null;
// Get the related topic and count if more then one is found
for (final Map.Entry<String, SpecTopic> specTopicEntry : parserData.getSpecTopics().entrySet()) {
if (specTopicEntry.getKey().matches("^[\\w\\d]+-" + relatedId + "$")) {
relatedTopic = specTopicEntry.getValue(); // depends on control dependency: [if], data = [none]
count++; // depends on control dependency: [if], data = [none]
}
}
/*
* Add the relationship to the node even if the relationship isn't duplicated
* and the related topic isn't the current topic. This is so it shows up in the
* output.
*/
if (count > 0) {
specNode.addRelationshipToTopic(relatedTopic, relationship.getType(), relationship.getRelationshipTitle()); // depends on control dependency: [if], data = [none]
} else {
final SpecTopic dummyTopic = new SpecTopic(-1, "");
dummyTopic.setId(relatedId); // depends on control dependency: [if], data = [none]
dummyTopic.setUniqueId("-1"); // depends on control dependency: [if], data = [none]
specNode.addRelationshipToTopic(dummyTopic, relationship.getType(), relationship.getRelationshipTitle()); // depends on control dependency: [if], data = [none]
}
} else {
final SpecTopic dummyTopic = new SpecTopic(-1, "");
dummyTopic.setId(relatedId); // depends on control dependency: [if], data = [none]
dummyTopic.setUniqueId("-1"); // depends on control dependency: [if], data = [none]
specNode.addRelationshipToTopic(dummyTopic, relationship.getType(), relationship.getRelationshipTitle()); // depends on control dependency: [if], data = [none]
}
} else {
if (parserData.getSpecTopics().containsKey(relatedId)) {
final SpecTopic relatedSpecTopic = parserData.getSpecTopics().get(relatedId);
// Check that a duplicate doesn't exist, because if it does the new topic isn't unique
String duplicatedId = "X" + relatedId.substring(1);
boolean duplicateExists = false;
for (String uniqueTopicId : parserData.getSpecTopics().keySet()) {
if (uniqueTopicId.matches("^[\\w\\d]+-" + duplicatedId + "$")) {
duplicateExists = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (relatedSpecTopic != specNode) {
if (!duplicateExists) {
specNode.addRelationshipToTopic(relatedSpecTopic, relationship.getType(), relationship.getRelationshipTitle()); // depends on control dependency: [if], data = [none]
} else {
// Only create a new target if one doesn't already exist
if (relatedSpecTopic.getTargetId() == null) {
String targetId = ContentSpecUtilities.generateRandomTargetId(relatedSpecTopic.getUniqueId());
while (parserData.getTargetTopics().containsKey(targetId) || parserData.getTargetLevels().containsKey(
targetId)) {
targetId = ContentSpecUtilities.generateRandomTargetId(relatedSpecTopic.getUniqueId()); // depends on control dependency: [while], data = [none]
}
parserData.getSpecTopics().get(relatedId).setTargetId(targetId); // depends on control dependency: [if], data = [none]
parserData.getTargetTopics().put(targetId, relatedSpecTopic); // depends on control dependency: [if], data = [none]
}
specNode.addRelationshipToTopic(relatedSpecTopic, relationship.getType(), relationship.getRelationshipTitle()); // depends on control dependency: [if], data = [none]
}
}
} else {
final SpecTopic dummyTopic = new SpecTopic(-1, "");
dummyTopic.setId(relatedId); // depends on control dependency: [if], data = [none]
dummyTopic.setUniqueId("-1"); // depends on control dependency: [if], data = [none]
specNode.addRelationshipToTopic(dummyTopic, relationship.getType(), relationship.getRelationshipTitle()); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public static RoaringBitmap bitmapOf(final long[] words) {
// split long[] into blocks.
// each block becomes a single container, if any bit is set
final RoaringBitmap ans = new RoaringBitmap();
int containerIndex = 0;
for (int from = 0; from < words.length; from += BLOCK_LENGTH) {
final int to = Math.min(from + BLOCK_LENGTH, words.length);
final int blockCardinality = cardinality(from, to, words);
if (blockCardinality > 0) {
ans.highLowContainer.insertNewKeyValueAt(containerIndex++, Util.highbits(from * Long.SIZE),
BitSetUtil.containerOf(from, to, blockCardinality, words));
}
}
return ans;
} }
|
public class class_name {
public static RoaringBitmap bitmapOf(final long[] words) {
// split long[] into blocks.
// each block becomes a single container, if any bit is set
final RoaringBitmap ans = new RoaringBitmap();
int containerIndex = 0;
for (int from = 0; from < words.length; from += BLOCK_LENGTH) {
final int to = Math.min(from + BLOCK_LENGTH, words.length);
final int blockCardinality = cardinality(from, to, words);
if (blockCardinality > 0) {
ans.highLowContainer.insertNewKeyValueAt(containerIndex++, Util.highbits(from * Long.SIZE),
BitSetUtil.containerOf(from, to, blockCardinality, words)); // depends on control dependency: [if], data = [none]
}
}
return ans;
} }
|
public class class_name {
@VisibleForTesting
String countersToString() {
StringBuilder sb = new StringBuilder();
sb.append("\n");
double numNanoSecPerSec = TimeUnit.SECONDS.toNanos(1);
String timeSuffix = "_TIME";
for (Counter c : Counter.values()) {
String name = c.toString();
if (!name.endsWith(timeSuffix)) {
// Log invocation counter.
long count = counters.get(c).get();
sb.append(String.format("%20s = %d calls\n", name, count));
// Log duration counter.
String timeCounterName = name + timeSuffix;
double totalTime =
counters.get(Enum.valueOf(Counter.class, timeCounterName)).get()
/ numNanoSecPerSec;
sb.append(String.format("%20s = %.2f sec\n", timeCounterName, totalTime));
// Compute and log average duration per call (== total duration / num invocations).
String avgName = name + " avg.";
double avg = totalTime / count;
sb.append(String.format("%20s = %.2f sec / call\n\n", avgName, avg));
}
}
return sb.toString();
} }
|
public class class_name {
@VisibleForTesting
String countersToString() {
StringBuilder sb = new StringBuilder();
sb.append("\n");
double numNanoSecPerSec = TimeUnit.SECONDS.toNanos(1);
String timeSuffix = "_TIME";
for (Counter c : Counter.values()) {
String name = c.toString();
if (!name.endsWith(timeSuffix)) {
// Log invocation counter.
long count = counters.get(c).get();
sb.append(String.format("%20s = %d calls\n", name, count)); // depends on control dependency: [if], data = [none]
// Log duration counter.
String timeCounterName = name + timeSuffix;
double totalTime =
counters.get(Enum.valueOf(Counter.class, timeCounterName)).get()
/ numNanoSecPerSec;
sb.append(String.format("%20s = %.2f sec\n", timeCounterName, totalTime)); // depends on control dependency: [if], data = [none]
// Compute and log average duration per call (== total duration / num invocations).
String avgName = name + " avg.";
double avg = totalTime / count;
sb.append(String.format("%20s = %.2f sec / call\n\n", avgName, avg)); // depends on control dependency: [if], data = [none]
}
}
return sb.toString();
} }
|
public class class_name {
public DefaultTerminalFactory setTerminalEmulatorFrameAutoCloseTrigger(TerminalEmulatorAutoCloseTrigger autoCloseTrigger) {
this.autoCloseTriggers.clear();
if(autoCloseTrigger != null) {
this.autoCloseTriggers.add(autoCloseTrigger);
}
return this;
} }
|
public class class_name {
public DefaultTerminalFactory setTerminalEmulatorFrameAutoCloseTrigger(TerminalEmulatorAutoCloseTrigger autoCloseTrigger) {
this.autoCloseTriggers.clear();
if(autoCloseTrigger != null) {
this.autoCloseTriggers.add(autoCloseTrigger); // depends on control dependency: [if], data = [(autoCloseTrigger]
}
return this;
} }
|
public class class_name {
private FieldDescriptor getFldFromJoin(TableAlias aTableAlias, String aColName)
{
FieldDescriptor fld = null;
// Search Join Structure for attribute
if (aTableAlias.joins != null)
{
Iterator itr = aTableAlias.joins.iterator();
while (itr.hasNext())
{
Join join = (Join) itr.next();
ClassDescriptor cld = join.right.cld;
if (cld != null)
{
fld = cld.getFieldDescriptorByName(aColName);
if (fld != null)
{
break;
}
}
}
}
return fld;
} }
|
public class class_name {
private FieldDescriptor getFldFromJoin(TableAlias aTableAlias, String aColName)
{
FieldDescriptor fld = null;
// Search Join Structure for attribute
if (aTableAlias.joins != null)
{
Iterator itr = aTableAlias.joins.iterator();
while (itr.hasNext())
{
Join join = (Join) itr.next();
ClassDescriptor cld = join.right.cld;
if (cld != null)
{
fld = cld.getFieldDescriptorByName(aColName);
// depends on control dependency: [if], data = [none]
if (fld != null)
{
break;
}
}
}
}
return fld;
} }
|
public class class_name {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{dashboardId}")
@Description("Returns a dashboard by its ID.")
public DashboardDto getDashboardByID(@Context HttpServletRequest req,
@PathParam("dashboardId") BigInteger dashboardId) {
if (dashboardId == null || dashboardId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Dashboard Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
Dashboard dashboard = dService.findDashboardByPrimaryKey(dashboardId);
if (dashboard != null && !dashboard.isShared()) {
validateAndGetOwner(req, null);
validateResourceAuthorization(req, dashboard.getOwner(), getRemoteUser(req));
}
if (dashboard != null) {
return DashboardDto.transformToDto(dashboard);
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} }
|
public class class_name {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{dashboardId}")
@Description("Returns a dashboard by its ID.")
public DashboardDto getDashboardByID(@Context HttpServletRequest req,
@PathParam("dashboardId") BigInteger dashboardId) {
if (dashboardId == null || dashboardId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Dashboard Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
Dashboard dashboard = dService.findDashboardByPrimaryKey(dashboardId);
if (dashboard != null && !dashboard.isShared()) {
validateAndGetOwner(req, null); // depends on control dependency: [if], data = [none]
validateResourceAuthorization(req, dashboard.getOwner(), getRemoteUser(req)); // depends on control dependency: [if], data = [none]
}
if (dashboard != null) {
return DashboardDto.transformToDto(dashboard); // depends on control dependency: [if], data = [(dashboard]
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} }
|
public class class_name {
public Observable<ServiceResponse<EventInfoInner>> pingWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (registryName == null) {
throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
}
if (webhookName == null) {
throw new IllegalArgumentException("Parameter webhookName is required and cannot be null.");
}
final String apiVersion = "2017-10-01";
return service.ping(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<EventInfoInner>>>() {
@Override
public Observable<ServiceResponse<EventInfoInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<EventInfoInner> clientResponse = pingDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<EventInfoInner>> pingWithServiceResponseAsync(String resourceGroupName, String registryName, String webhookName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (registryName == null) {
throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
}
if (webhookName == null) {
throw new IllegalArgumentException("Parameter webhookName is required and cannot be null.");
}
final String apiVersion = "2017-10-01";
return service.ping(this.client.subscriptionId(), resourceGroupName, registryName, webhookName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<EventInfoInner>>>() {
@Override
public Observable<ServiceResponse<EventInfoInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<EventInfoInner> clientResponse = pingDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public boolean wasResourcePlayed(int resId) {
for (Playback playback : playedSounds) {
if (idIsForResource(playback.soundId, resId)) {
return true;
}
}
return false;
} }
|
public class class_name {
public boolean wasResourcePlayed(int resId) {
for (Playback playback : playedSounds) {
if (idIsForResource(playback.soundId, resId)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public static int defaultNumThreads(int numUsableCores) {
final int availableCores;
if (numUsableCores > 0) {
availableCores = numUsableCores;
} else {
availableCores = Runtime.getRuntime().availableProcessors();
}
return Math.min(availableCores, MAX_DEFAULT_NETTY_THREADS);
} }
|
public class class_name {
public static int defaultNumThreads(int numUsableCores) {
final int availableCores;
if (numUsableCores > 0) {
availableCores = numUsableCores; // depends on control dependency: [if], data = [none]
} else {
availableCores = Runtime.getRuntime().availableProcessors(); // depends on control dependency: [if], data = [none]
}
return Math.min(availableCores, MAX_DEFAULT_NETTY_THREADS);
} }
|
public class class_name {
public String htmlItem(CmsListItem item, boolean odd, boolean isPrintable) {
StringBuffer html = new StringBuffer(1024);
html.append("<tr ");
if (!isPrintable) {
html.append("class='");
html.append(odd ? "oddrowbg" : (getWp().useNewStyle() ? "evenrowbg" : "evenrowbgnew"));
html.append("'");
}
html.append(">\n");
Iterator<CmsListColumnDefinition> itCols = m_columns.elementList().iterator();
int width = 0;
while (itCols.hasNext()) {
CmsListColumnDefinition col = itCols.next();
if (!col.isVisible() && !isPrintable) {
continue;
}
if (!col.isPrintable() && isPrintable) {
continue;
}
width++;
StringBuffer style = new StringBuffer(64);
html.append("<td");
CmsListColumnAlignEnum align = col.getAlign();
if ((align != CmsListColumnAlignEnum.ALIGN_LEFT) && CmsStringUtil.isNotEmpty(align.toString())) {
style.append("text-align: ");
style.append(col.getAlign());
style.append("; ");
}
if (col.isTextWrapping()) {
style.append("white-space: normal;");
}
if (isPrintable) {
style.append("border-top: 1px solid black;");
}
if (style.length() > 0) {
html.append(" style='");
html.append(style);
html.append("'");
}
html.append(">\n");
html.append(col.htmlCell(item, isPrintable));
html.append("</td>\n");
}
if (!isPrintable && hasCheckMultiActions()) {
width++;
html.append("\t<td class='select' style='text-align: center'>\n");
html.append("\t\t<input type='checkbox' class='checkbox' name='listMultiAction' value='");
html.append(item.getId());
html.append("'>\n");
html.append("\t</td>\n");
}
html.append("</tr>\n");
Iterator<CmsListItemDetails> itDet = m_itemDetails.elementList().iterator();
while (itDet.hasNext()) {
CmsListItemDetails lid = itDet.next();
if (!lid.isVisible() && !isPrintable) {
continue;
}
if (!lid.isPrintable() && isPrintable) {
continue;
}
if ((item.get(lid.getId()) != null)
&& CmsStringUtil.isNotEmptyOrWhitespaceOnly(item.get(lid.getId()).toString())) {
int padCols = 0;
itCols = m_columns.elementList().iterator();
while (itCols.hasNext()) {
CmsListColumnDefinition col = itCols.next();
if (col.getId().equals(lid.getAtColumn())) {
break;
}
if (!col.isVisible() && !isPrintable) {
continue;
}
if (!col.isPrintable() && isPrintable) {
continue;
}
padCols++;
}
int spanCols = width - padCols;
html.append("<tr ");
if (!isPrintable) {
html.append("class='");
html.append(odd ? "oddrowbg" : (getWp().useNewStyle() ? "evenrowbg" : "evenrowbgnew"));
html.append("'");
}
html.append(">\n");
if (padCols > 0) {
html.append("<td colspan='");
html.append(padCols);
html.append("'> </td>\n");
}
html.append("<td colspan='");
html.append(spanCols);
html.append("' style='padding-left: 20px; white-space:normal;'>\n");
html.append(lid.htmlCell(item, isPrintable));
html.append("\n</td>\n");
html.append("\n");
html.append("</tr>\n");
}
}
return html.toString();
} }
|
public class class_name {
public String htmlItem(CmsListItem item, boolean odd, boolean isPrintable) {
StringBuffer html = new StringBuffer(1024);
html.append("<tr ");
if (!isPrintable) {
html.append("class='");
html.append(odd ? "oddrowbg" : (getWp().useNewStyle() ? "evenrowbg" : "evenrowbgnew"));
html.append("'"); // depends on control dependency: [if], data = [none]
}
html.append(">\n");
Iterator<CmsListColumnDefinition> itCols = m_columns.elementList().iterator();
int width = 0;
while (itCols.hasNext()) {
CmsListColumnDefinition col = itCols.next();
if (!col.isVisible() && !isPrintable) {
continue;
}
if (!col.isPrintable() && isPrintable) {
continue;
}
width++; // depends on control dependency: [while], data = [none]
StringBuffer style = new StringBuffer(64);
html.append("<td"); // depends on control dependency: [while], data = [none]
CmsListColumnAlignEnum align = col.getAlign();
if ((align != CmsListColumnAlignEnum.ALIGN_LEFT) && CmsStringUtil.isNotEmpty(align.toString())) {
style.append("text-align: "); // depends on control dependency: [if], data = [none]
style.append(col.getAlign()); // depends on control dependency: [if], data = [none]
style.append("; "); // depends on control dependency: [if], data = [none]
}
if (col.isTextWrapping()) {
style.append("white-space: normal;"); // depends on control dependency: [if], data = [none]
}
if (isPrintable) {
style.append("border-top: 1px solid black;"); // depends on control dependency: [if], data = [none]
}
if (style.length() > 0) {
html.append(" style='");
html.append(style);
html.append("'"); // depends on control dependency: [if], data = [none]
}
html.append(">\n"); // depends on control dependency: [while], data = [none]
html.append(col.htmlCell(item, isPrintable)); // depends on control dependency: [while], data = [none]
html.append("</td>\n"); // depends on control dependency: [while], data = [none]
}
if (!isPrintable && hasCheckMultiActions()) {
width++; // depends on control dependency: [if], data = [none]
html.append("\t<td class='select' style='text-align: center'>\n"); // depends on control dependency: [if], data = [none]
html.append("\t\t<input type='checkbox' class='checkbox' name='listMultiAction' value='");
html.append(item.getId());
html.append("'>\n"); // depends on control dependency: [if], data = [none]
html.append("\t</td>\n"); // depends on control dependency: [if], data = [none]
}
html.append("</tr>\n");
Iterator<CmsListItemDetails> itDet = m_itemDetails.elementList().iterator();
while (itDet.hasNext()) {
CmsListItemDetails lid = itDet.next();
if (!lid.isVisible() && !isPrintable) {
continue;
}
if (!lid.isPrintable() && isPrintable) {
continue;
}
if ((item.get(lid.getId()) != null)
&& CmsStringUtil.isNotEmptyOrWhitespaceOnly(item.get(lid.getId()).toString())) {
int padCols = 0;
itCols = m_columns.elementList().iterator(); // depends on control dependency: [if], data = [none]
while (itCols.hasNext()) {
CmsListColumnDefinition col = itCols.next();
if (col.getId().equals(lid.getAtColumn())) {
break;
}
if (!col.isVisible() && !isPrintable) {
continue;
}
if (!col.isPrintable() && isPrintable) {
continue;
}
padCols++; // depends on control dependency: [while], data = [none]
}
int spanCols = width - padCols;
html.append("<tr "); // depends on control dependency: [if], data = [none]
if (!isPrintable) {
html.append("class='");
html.append(odd ? "oddrowbg" : (getWp().useNewStyle() ? "evenrowbg" : "evenrowbgnew"));
html.append("'"); // depends on control dependency: [if], data = [none]
}
html.append(">\n"); // depends on control dependency: [if], data = [none]
if (padCols > 0) {
html.append("<td colspan='");
html.append(padCols);
html.append("'> </td>\n"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
html.append("<td colspan='");
html.append(spanCols);
html.append("' style='padding-left: 20px; white-space:normal;'>\n"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
html.append(lid.htmlCell(item, isPrintable)); // depends on control dependency: [if], data = [none]
html.append("\n</td>\n"); // depends on control dependency: [if], data = [none]
html.append("\n"); // depends on control dependency: [if], data = [none]
html.append("</tr>\n"); // depends on control dependency: [if], data = [none]
}
}
return html.toString();
} }
|
public class class_name {
public Location upstream( int length )
{
if( length < 0 )
{
throw new IllegalArgumentException( "Parameter must be >= 0; is=" + length );
}
if( Math.signum( mStart - length) == Math.signum( mStart ) || 0 == Math.signum( mStart - length ) )
{
return new Location(mStart - length, mStart );
}
else
{
throw new IndexOutOfBoundsException( "Specified length causes crossing of origin: " + length + "; " + toString() );
}
} }
|
public class class_name {
public Location upstream( int length )
{
if( length < 0 )
{
throw new IllegalArgumentException( "Parameter must be >= 0; is=" + length );
}
if( Math.signum( mStart - length) == Math.signum( mStart ) || 0 == Math.signum( mStart - length ) )
{
return new Location(mStart - length, mStart ); // depends on control dependency: [if], data = [none]
}
else
{
throw new IndexOutOfBoundsException( "Specified length causes crossing of origin: " + length + "; " + toString() );
}
} }
|
public class class_name {
public static String join(Object[] array, String separator) {
if (array == null) {
return null;
}
StringBuilder strBuilder = new StringBuilder();
for (int i = 0, z = array.length; i < z; i++) {
if (i > 0) {
strBuilder.append(separator);
}
strBuilder.append(array[i]);
}
return strBuilder.toString();
} }
|
public class class_name {
public static String join(Object[] array, String separator) {
if (array == null) {
return null; // depends on control dependency: [if], data = [none]
}
StringBuilder strBuilder = new StringBuilder();
for (int i = 0, z = array.length; i < z; i++) {
if (i > 0) {
strBuilder.append(separator); // depends on control dependency: [if], data = [none]
}
strBuilder.append(array[i]); // depends on control dependency: [for], data = [i]
}
return strBuilder.toString();
} }
|
public class class_name {
public boolean tick (Pathable pable, long timestamp)
{
double angle;
boolean modified = false;
// if we've blown past our arrival time...
if (timestamp >= _startStamp + _duration) {
// ...force the angle to the destination angle
angle = _sangle + _delta;
} else {
// otherwise, compute the angle at which we should place the pathable based on the
// elapsed time
long elapsed = timestamp - _startStamp;
angle = _sangle + _delta * elapsed / _duration;
}
// determine where we should be along the path
computePosition(_center, _xradius, _yradius, angle, _tpos);
// Skip this if we are not reorienting as we follow the path.
if (_orient != NONE) {
// compute the pathable's new orientation
double theta = angle + ((_delta > 0) ? Math.PI/2 : -Math.PI/2);
int orient;
switch (_orient) {
default:
case NORMAL:
orient = DirectionUtil.getDirection(theta);
// adjust it appropriately
orient = DirectionUtil.rotateCW(orient, 2*_orientOffset);
break;
case FINE:
orient = DirectionUtil.getFineDirection(theta);
// adjust it appropriately
orient = DirectionUtil.rotateCW(orient, _orientOffset);
break;
}
// update the pathable's orientation if it changed
if (pable.getOrientation() != orient) {
pable.setOrientation(orient);
modified = true;
}
}
// update the pathable's location if it moved
if (pable.getX() != _tpos.x || pable.getY() != _tpos.y) {
pable.setLocation(_tpos.x, _tpos.y);
modified = true;
}
// if we completed our path, let the sprite know
if (angle == _sangle + _delta) {
pable.pathCompleted(timestamp);
}
return modified;
} }
|
public class class_name {
public boolean tick (Pathable pable, long timestamp)
{
double angle;
boolean modified = false;
// if we've blown past our arrival time...
if (timestamp >= _startStamp + _duration) {
// ...force the angle to the destination angle
angle = _sangle + _delta; // depends on control dependency: [if], data = [none]
} else {
// otherwise, compute the angle at which we should place the pathable based on the
// elapsed time
long elapsed = timestamp - _startStamp;
angle = _sangle + _delta * elapsed / _duration; // depends on control dependency: [if], data = [none]
}
// determine where we should be along the path
computePosition(_center, _xradius, _yradius, angle, _tpos);
// Skip this if we are not reorienting as we follow the path.
if (_orient != NONE) {
// compute the pathable's new orientation
double theta = angle + ((_delta > 0) ? Math.PI/2 : -Math.PI/2);
int orient;
switch (_orient) {
default:
case NORMAL:
orient = DirectionUtil.getDirection(theta);
// adjust it appropriately
orient = DirectionUtil.rotateCW(orient, 2*_orientOffset);
break;
case FINE:
orient = DirectionUtil.getFineDirection(theta);
// adjust it appropriately
orient = DirectionUtil.rotateCW(orient, _orientOffset);
break;
}
// update the pathable's orientation if it changed
if (pable.getOrientation() != orient) {
pable.setOrientation(orient); // depends on control dependency: [if], data = [orient)]
modified = true; // depends on control dependency: [if], data = [none]
}
}
// update the pathable's location if it moved
if (pable.getX() != _tpos.x || pable.getY() != _tpos.y) {
pable.setLocation(_tpos.x, _tpos.y); // depends on control dependency: [if], data = [none]
modified = true; // depends on control dependency: [if], data = [none]
}
// if we completed our path, let the sprite know
if (angle == _sangle + _delta) {
pable.pathCompleted(timestamp); // depends on control dependency: [if], data = [none]
}
return modified;
} }
|
public class class_name {
public static IAtomContainer skeleton(IAtomContainer src) {
IChemObjectBuilder builder = src.getBuilder();
IAtom[] atoms = new IAtom[src.getAtomCount()];
IBond[] bonds = new IBond[src.getBondCount()];
for (int i = 0; i < atoms.length; i++) {
atoms[i] = builder.newInstance(IAtom.class, src.getAtom(i).getAtomicNumber());
}
for (int i = 0; i < bonds.length; i++) {
IBond bond = src.getBond(i);
int u = src.indexOf(bond.getBegin());
int v = src.indexOf(bond.getEnd());
bonds[i] = builder.newInstance(IBond.class, atoms[u], atoms[v]);
}
IAtomContainer dest = builder.newInstance(IAtomContainer.class, 0, 0, 0, 0);
dest.setAtoms(atoms);
dest.setBonds(bonds);
return dest;
} }
|
public class class_name {
public static IAtomContainer skeleton(IAtomContainer src) {
IChemObjectBuilder builder = src.getBuilder();
IAtom[] atoms = new IAtom[src.getAtomCount()];
IBond[] bonds = new IBond[src.getBondCount()];
for (int i = 0; i < atoms.length; i++) {
atoms[i] = builder.newInstance(IAtom.class, src.getAtom(i).getAtomicNumber()); // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < bonds.length; i++) {
IBond bond = src.getBond(i);
int u = src.indexOf(bond.getBegin());
int v = src.indexOf(bond.getEnd());
bonds[i] = builder.newInstance(IBond.class, atoms[u], atoms[v]); // depends on control dependency: [for], data = [i]
}
IAtomContainer dest = builder.newInstance(IAtomContainer.class, 0, 0, 0, 0);
dest.setAtoms(atoms);
dest.setBonds(bonds);
return dest;
} }
|
public class class_name {
@Override
public int compareTo(Object obj) {
int result = -1;
if (obj instanceof AbstractPlugin) {
AbstractPlugin test = (AbstractPlugin) obj;
if (getId() < test.getId()) {
result = -1;
} else if (getId() > test.getId()) {
result = 1;
} else {
result = 0;
}
}
return result;
} }
|
public class class_name {
@Override
public int compareTo(Object obj) {
int result = -1;
if (obj instanceof AbstractPlugin) {
AbstractPlugin test = (AbstractPlugin) obj;
if (getId() < test.getId()) {
result = -1;
// depends on control dependency: [if], data = [none]
} else if (getId() > test.getId()) {
result = 1;
// depends on control dependency: [if], data = [none]
} else {
result = 0;
// depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
public EClass getObjectAreaSize() {
if (objectAreaSizeEClass == null) {
objectAreaSizeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(365);
}
return objectAreaSizeEClass;
} }
|
public class class_name {
public EClass getObjectAreaSize() {
if (objectAreaSizeEClass == null) {
objectAreaSizeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(365); // depends on control dependency: [if], data = [none]
}
return objectAreaSizeEClass;
} }
|
public class class_name {
private static Set<Integer> setForRange(int max) {
Set<Integer> set = Sets.newLinkedHashSet();
for (int i = 0; i < max; i++) {
set.add(i);
}
return set;
} }
|
public class class_name {
private static Set<Integer> setForRange(int max) {
Set<Integer> set = Sets.newLinkedHashSet();
for (int i = 0; i < max; i++) {
set.add(i); // depends on control dependency: [for], data = [i]
}
return set;
} }
|
public class class_name {
private static boolean checkCriticalValue(double score, int h, double aLevel, int p, int q) { //p and q are used only in ARIMA Models (p,0,q).
double probability=ContinuousDistributions.chisquareCdf(score,h - p - q);
boolean rejectH0=false;
double a=aLevel;
if(probability>=(1-a)) {
rejectH0=true;
}
return rejectH0;
} }
|
public class class_name {
private static boolean checkCriticalValue(double score, int h, double aLevel, int p, int q) { //p and q are used only in ARIMA Models (p,0,q).
double probability=ContinuousDistributions.chisquareCdf(score,h - p - q);
boolean rejectH0=false;
double a=aLevel;
if(probability>=(1-a)) {
rejectH0=true; // depends on control dependency: [if], data = [none]
}
return rejectH0;
} }
|
public class class_name {
@Override
public void shutDown() {
super.shutDown();
indexSearcherClose();
if (m_analyzer != null) {
m_analyzer.close();
}
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SHUTDOWN_INDEX_1, getName()));
}
} }
|
public class class_name {
@Override
public void shutDown() {
super.shutDown();
indexSearcherClose();
if (m_analyzer != null) {
m_analyzer.close(); // depends on control dependency: [if], data = [none]
}
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SHUTDOWN_INDEX_1, getName())); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static List<BundleEntryParts> toListOfEntries(FhirContext theContext, IBaseBundle theBundle) {
List<BundleEntryParts> retVal = new ArrayList<>();
RuntimeResourceDefinition def = theContext.getResourceDefinition(theBundle);
BaseRuntimeChildDefinition entryChild = def.getChildByName("entry");
List<IBase> entries = entryChild.getAccessor().getValues(theBundle);
BaseRuntimeElementCompositeDefinition<?> entryChildElem = (BaseRuntimeElementCompositeDefinition<?>) entryChild.getChildByName("entry");
BaseRuntimeChildDefinition resourceChild = entryChildElem.getChildByName("resource");
BaseRuntimeChildDefinition requestChild = entryChildElem.getChildByName("request");
BaseRuntimeElementCompositeDefinition<?> requestElem = (BaseRuntimeElementCompositeDefinition<?>) requestChild.getChildByName("request");
BaseRuntimeChildDefinition urlChild = requestElem.getChildByName("url");
BaseRuntimeChildDefinition methodChild = requestElem.getChildByName("method");
for (IBase nextEntry : entries) {
IBaseResource resource = null;
String url = null;
RequestTypeEnum requestType = null;
for (IBase next : resourceChild.getAccessor().getValues(nextEntry)) {
resource = (IBaseResource) next;
}
for (IBase nextRequest : requestChild.getAccessor().getValues(nextEntry)) {
for (IBase nextUrl : urlChild.getAccessor().getValues(nextRequest)) {
url = ((IPrimitiveType<?>) nextUrl).getValueAsString();
}
for (IBase nextUrl : methodChild.getAccessor().getValues(nextRequest)) {
String methodString = ((IPrimitiveType<?>) nextUrl).getValueAsString();
if (isNotBlank(methodString)) {
requestType = RequestTypeEnum.valueOf(methodString);
}
}
}
/*
* All 3 might be null - That's ok because we still want to know the
* order in the original bundle.
*/
retVal.add(new BundleEntryParts(requestType, url, resource));
}
return retVal;
} }
|
public class class_name {
public static List<BundleEntryParts> toListOfEntries(FhirContext theContext, IBaseBundle theBundle) {
List<BundleEntryParts> retVal = new ArrayList<>();
RuntimeResourceDefinition def = theContext.getResourceDefinition(theBundle);
BaseRuntimeChildDefinition entryChild = def.getChildByName("entry");
List<IBase> entries = entryChild.getAccessor().getValues(theBundle);
BaseRuntimeElementCompositeDefinition<?> entryChildElem = (BaseRuntimeElementCompositeDefinition<?>) entryChild.getChildByName("entry");
BaseRuntimeChildDefinition resourceChild = entryChildElem.getChildByName("resource");
BaseRuntimeChildDefinition requestChild = entryChildElem.getChildByName("request");
BaseRuntimeElementCompositeDefinition<?> requestElem = (BaseRuntimeElementCompositeDefinition<?>) requestChild.getChildByName("request");
BaseRuntimeChildDefinition urlChild = requestElem.getChildByName("url");
BaseRuntimeChildDefinition methodChild = requestElem.getChildByName("method");
for (IBase nextEntry : entries) {
IBaseResource resource = null;
String url = null;
RequestTypeEnum requestType = null;
for (IBase next : resourceChild.getAccessor().getValues(nextEntry)) {
resource = (IBaseResource) next; // depends on control dependency: [for], data = [next]
}
for (IBase nextRequest : requestChild.getAccessor().getValues(nextEntry)) {
for (IBase nextUrl : urlChild.getAccessor().getValues(nextRequest)) {
url = ((IPrimitiveType<?>) nextUrl).getValueAsString(); // depends on control dependency: [for], data = [nextUrl]
}
for (IBase nextUrl : methodChild.getAccessor().getValues(nextRequest)) {
String methodString = ((IPrimitiveType<?>) nextUrl).getValueAsString();
if (isNotBlank(methodString)) {
requestType = RequestTypeEnum.valueOf(methodString); // depends on control dependency: [if], data = [none]
}
}
}
/*
* All 3 might be null - That's ok because we still want to know the
* order in the original bundle.
*/
retVal.add(new BundleEntryParts(requestType, url, resource)); // depends on control dependency: [for], data = [none]
}
return retVal;
} }
|
public class class_name {
public EList<JvmMember> getMembers()
{
if (members == null)
{
members = new EObjectContainmentWithInverseEList<JvmMember>(JvmMember.class, this, TypesPackage.JVM_DECLARED_TYPE__MEMBERS, TypesPackage.JVM_MEMBER__DECLARING_TYPE);
}
return members;
} }
|
public class class_name {
public EList<JvmMember> getMembers()
{
if (members == null)
{
members = new EObjectContainmentWithInverseEList<JvmMember>(JvmMember.class, this, TypesPackage.JVM_DECLARED_TYPE__MEMBERS, TypesPackage.JVM_MEMBER__DECLARING_TYPE); // depends on control dependency: [if], data = [none]
}
return members;
} }
|
public class class_name {
public void marshall(ProvisionedProductAttribute provisionedProductAttribute, ProtocolMarshaller protocolMarshaller) {
if (provisionedProductAttribute == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(provisionedProductAttribute.getName(), NAME_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getArn(), ARN_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getType(), TYPE_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getId(), ID_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getStatusMessage(), STATUSMESSAGE_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getCreatedTime(), CREATEDTIME_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getIdempotencyToken(), IDEMPOTENCYTOKEN_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getLastRecordId(), LASTRECORDID_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getTags(), TAGS_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getPhysicalId(), PHYSICALID_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getProductId(), PRODUCTID_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getProvisioningArtifactId(), PROVISIONINGARTIFACTID_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getUserArn(), USERARN_BINDING);
protocolMarshaller.marshall(provisionedProductAttribute.getUserArnSession(), USERARNSESSION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ProvisionedProductAttribute provisionedProductAttribute, ProtocolMarshaller protocolMarshaller) {
if (provisionedProductAttribute == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(provisionedProductAttribute.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getStatusMessage(), STATUSMESSAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getCreatedTime(), CREATEDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getIdempotencyToken(), IDEMPOTENCYTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getLastRecordId(), LASTRECORDID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getPhysicalId(), PHYSICALID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getProductId(), PRODUCTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getProvisioningArtifactId(), PROVISIONINGARTIFACTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getUserArn(), USERARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(provisionedProductAttribute.getUserArnSession(), USERARNSESSION_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 void writeUnsignedVarLong(long value, final BytesContainer bos) {
int pos;
while ((value & 0xFFFFFFFFFFFFFF80L) != 0L) {
// out.writeByte(((int) value & 0x7F) | 0x80);
pos = bos.alloc((short) 1);
bos.bytes[pos] = (byte) (value & 0x7F | 0x80);
value >>>= 7;
}
// out.writeByte((int) value & 0x7F);
pos = bos.alloc((short) 1);
bos.bytes[pos] = (byte) (value & 0x7F);
} }
|
public class class_name {
public static void writeUnsignedVarLong(long value, final BytesContainer bos) {
int pos;
while ((value & 0xFFFFFFFFFFFFFF80L) != 0L) {
// out.writeByte(((int) value & 0x7F) | 0x80);
pos = bos.alloc((short) 1); // depends on control dependency: [while], data = [none]
bos.bytes[pos] = (byte) (value & 0x7F | 0x80); // depends on control dependency: [while], data = [none]
value >>>= 7; // depends on control dependency: [while], data = [none]
}
// out.writeByte((int) value & 0x7F);
pos = bos.alloc((short) 1);
bos.bytes[pos] = (byte) (value & 0x7F);
} }
|
public class class_name {
private BeanDefinitionRegistry getBeanDefinitionRegistry(ApplicationContext context) {
if (context instanceof BeanDefinitionRegistry) {
return (BeanDefinitionRegistry) context;
}
if (context instanceof AbstractApplicationContext) {
return (BeanDefinitionRegistry) ((AbstractApplicationContext) context)
.getBeanFactory();
}
throw new IllegalStateException("Could not locate BeanDefinitionRegistry");
} }
|
public class class_name {
private BeanDefinitionRegistry getBeanDefinitionRegistry(ApplicationContext context) {
if (context instanceof BeanDefinitionRegistry) {
return (BeanDefinitionRegistry) context; // depends on control dependency: [if], data = [none]
}
if (context instanceof AbstractApplicationContext) {
return (BeanDefinitionRegistry) ((AbstractApplicationContext) context)
.getBeanFactory(); // depends on control dependency: [if], data = [none]
}
throw new IllegalStateException("Could not locate BeanDefinitionRegistry");
} }
|
public class class_name {
void updateModel() {
for (int i = 0; i < expressions.size(); ++i) {
String expr = expressions.get(i);
String result = "";
if (expr.length() > 0) {
result = debugGui.dim.eval(expr);
if (result == null) result = "";
} else {
result = "";
}
result = result.replace('\n', ' ');
values.set(i, result);
}
fireTableDataChanged();
} }
|
public class class_name {
void updateModel() {
for (int i = 0; i < expressions.size(); ++i) {
String expr = expressions.get(i);
String result = "";
if (expr.length() > 0) {
result = debugGui.dim.eval(expr); // depends on control dependency: [if], data = [none]
if (result == null) result = "";
} else {
result = ""; // depends on control dependency: [if], data = [none]
}
result = result.replace('\n', ' '); // depends on control dependency: [for], data = [none]
values.set(i, result); // depends on control dependency: [for], data = [i]
}
fireTableDataChanged();
} }
|
public class class_name {
public static boolean is_jhalanta(String str)
{
// System.out.print("Entered is_jhalanta, returning: ");
String s1 = VarnaUtil.getAntyaVarna(str);
if (is_jhal(s1))
{
// Log.logInfo("true");
return true;
}
// Log.logInfo("false");
return false;
} }
|
public class class_name {
public static boolean is_jhalanta(String str)
{
// System.out.print("Entered is_jhalanta, returning: ");
String s1 = VarnaUtil.getAntyaVarna(str);
if (is_jhal(s1))
{
// Log.logInfo("true");
return true; // depends on control dependency: [if], data = [none]
}
// Log.logInfo("false");
return false;
} }
|
public class class_name {
protected void parseDocument(int offset, int length) throws BadLocationException {
// initialize the segment with the complete document so the segment doesn't
// have an underlying gap in the buffer
styledDocument.getText(0, styledDocument.getLength(), segment);
buffer = CharBuffer.wrap(segment.array).asReadOnlyBuffer();
// initialize the lexer if necessary
if (!lexer.isInitialized()) {
// prime the parser and reparse whole document
lexer.initialize();
offset = 0;
length = styledDocument.getLength();
}
else {
int end = offset + length;
offset = calcBeginParse(offset);
length = calcEndParse(end) - offset;
// clean the tree by ensuring multi line styles are reset in area
// of parsing
SortedSet set = mlTextRunSet.subSet(offset,
offset + length);
if (set != null) {
set.clear();
}
}
// parse the document
lexer.parse(buffer, offset, length);
} }
|
public class class_name {
protected void parseDocument(int offset, int length) throws BadLocationException {
// initialize the segment with the complete document so the segment doesn't
// have an underlying gap in the buffer
styledDocument.getText(0, styledDocument.getLength(), segment);
buffer = CharBuffer.wrap(segment.array).asReadOnlyBuffer();
// initialize the lexer if necessary
if (!lexer.isInitialized()) {
// prime the parser and reparse whole document
lexer.initialize();
offset = 0;
length = styledDocument.getLength();
}
else {
int end = offset + length;
offset = calcBeginParse(offset);
length = calcEndParse(end) - offset;
// clean the tree by ensuring multi line styles are reset in area
// of parsing
SortedSet set = mlTextRunSet.subSet(offset,
offset + length);
if (set != null) {
set.clear(); // depends on control dependency: [if], data = [none]
}
}
// parse the document
lexer.parse(buffer, offset, length);
} }
|
public class class_name {
public static Map<String,String> order(Map<String, String> map){
HashMap<String, String> tempMap = new LinkedHashMap<String, String>();
List<Map.Entry<String, String>> infoIds = new ArrayList<Map.Entry<String, String>>( map.entrySet());
Collections.sort(infoIds, new Comparator<Map.Entry<String, String>>() {
public int compare(Map.Entry<String, String> o1,Map.Entry<String, String> o2) {
return (o1.getKey()).toString().compareTo(o2.getKey());
}
});
for (int i = 0; i < infoIds.size(); i++) {
Map.Entry<String, String> item = infoIds.get(i);
tempMap.put(item.getKey(), item.getValue());
}
return tempMap;
} }
|
public class class_name {
public static Map<String,String> order(Map<String, String> map){
HashMap<String, String> tempMap = new LinkedHashMap<String, String>();
List<Map.Entry<String, String>> infoIds = new ArrayList<Map.Entry<String, String>>( map.entrySet());
Collections.sort(infoIds, new Comparator<Map.Entry<String, String>>() {
public int compare(Map.Entry<String, String> o1,Map.Entry<String, String> o2) {
return (o1.getKey()).toString().compareTo(o2.getKey());
}
});
for (int i = 0; i < infoIds.size(); i++) {
Map.Entry<String, String> item = infoIds.get(i);
tempMap.put(item.getKey(), item.getValue());
// depends on control dependency: [for], data = [none]
}
return tempMap;
} }
|
public class class_name {
private static PriceTableRow createPriceTableRow(
String header,
String description,
String finalUrl,
String finalMobileUrl,
long priceInMicros,
String currencyCode,
PriceExtensionPriceUnit priceUnit) {
PriceTableRow priceTableRow = new PriceTableRow();
priceTableRow.setHeader(header);
priceTableRow.setDescription(description);
UrlList finalUrls = new UrlList();
finalUrls.setUrls(new String[] {finalUrl});
priceTableRow.setFinalUrls(finalUrls);
if (finalMobileUrl != null) {
UrlList finalMobileUrls = new UrlList();
finalMobileUrls.setUrls(new String[] {finalMobileUrl});
priceTableRow.setFinalMobileUrls(finalMobileUrls);
}
MoneyWithCurrency price = new MoneyWithCurrency();
Money priceMoney = new Money();
price.setCurrencyCode(currencyCode);
priceMoney.setMicroAmount(priceInMicros);
price.setMoney(priceMoney);
priceTableRow.setPrice(price);
priceTableRow.setPriceUnit(priceUnit);
return priceTableRow;
} }
|
public class class_name {
private static PriceTableRow createPriceTableRow(
String header,
String description,
String finalUrl,
String finalMobileUrl,
long priceInMicros,
String currencyCode,
PriceExtensionPriceUnit priceUnit) {
PriceTableRow priceTableRow = new PriceTableRow();
priceTableRow.setHeader(header);
priceTableRow.setDescription(description);
UrlList finalUrls = new UrlList();
finalUrls.setUrls(new String[] {finalUrl});
priceTableRow.setFinalUrls(finalUrls);
if (finalMobileUrl != null) {
UrlList finalMobileUrls = new UrlList();
finalMobileUrls.setUrls(new String[] {finalMobileUrl}); // depends on control dependency: [if], data = [none]
priceTableRow.setFinalMobileUrls(finalMobileUrls); // depends on control dependency: [if], data = [(finalMobileUrl]
}
MoneyWithCurrency price = new MoneyWithCurrency();
Money priceMoney = new Money();
price.setCurrencyCode(currencyCode);
priceMoney.setMicroAmount(priceInMicros);
price.setMoney(priceMoney);
priceTableRow.setPrice(price);
priceTableRow.setPriceUnit(priceUnit);
return priceTableRow;
} }
|
public class class_name {
private boolean shouldRemoveDataPullUpperBounds() {
if (!this.workUnitState.getPropAsBoolean(ConfigurationKeys.SOURCE_QUERYBASED_ALLOW_REMOVE_UPPER_BOUNDS, true)) {
return false;
}
// Only consider the last work unit
if (!partition.isLastPartition()) {
return false;
}
// Don't remove if user specifies one or is recorded in previous run
if (partition.getHasUserSpecifiedHighWatermark() ||
this.workUnitState.getProp(ConfigurationKeys.WORK_UNIT_STATE_ACTUAL_HIGH_WATER_MARK_KEY) != null) {
return false;
}
return true;
} }
|
public class class_name {
private boolean shouldRemoveDataPullUpperBounds() {
if (!this.workUnitState.getPropAsBoolean(ConfigurationKeys.SOURCE_QUERYBASED_ALLOW_REMOVE_UPPER_BOUNDS, true)) {
return false; // depends on control dependency: [if], data = [none]
}
// Only consider the last work unit
if (!partition.isLastPartition()) {
return false; // depends on control dependency: [if], data = [none]
}
// Don't remove if user specifies one or is recorded in previous run
if (partition.getHasUserSpecifiedHighWatermark() ||
this.workUnitState.getProp(ConfigurationKeys.WORK_UNIT_STATE_ACTUAL_HIGH_WATER_MARK_KEY) != null) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
public static Frame getFrame(Component component)
{
while (component != null)
{
if (component instanceof Frame)
return (Frame)component;
component = component.getParent();
}
return null;
} }
|
public class class_name {
public static Frame getFrame(Component component)
{
while (component != null)
{
if (component instanceof Frame)
return (Frame)component;
component = component.getParent(); // depends on control dependency: [while], data = [none]
}
return null;
} }
|
public class class_name {
public static <T> T instantiateUserCode(TaskConfig config, ClassLoader cl, Class<? super T> superClass) {
try {
T stub = config.<T>getStubWrapper(cl).getUserCodeObject(superClass, cl);
// check if the class is a subclass, if the check is required
if (superClass != null && !superClass.isAssignableFrom(stub.getClass())) {
throw new RuntimeException("The class '" + stub.getClass().getName() + "' is not a subclass of '" +
superClass.getName() + "' as is required.");
}
return stub;
}
catch (ClassCastException ccex) {
throw new RuntimeException("The UDF class is not a proper subclass of " + superClass.getName(), ccex);
}
} }
|
public class class_name {
public static <T> T instantiateUserCode(TaskConfig config, ClassLoader cl, Class<? super T> superClass) {
try {
T stub = config.<T>getStubWrapper(cl).getUserCodeObject(superClass, cl);
// check if the class is a subclass, if the check is required
if (superClass != null && !superClass.isAssignableFrom(stub.getClass())) {
throw new RuntimeException("The class '" + stub.getClass().getName() + "' is not a subclass of '" +
superClass.getName() + "' as is required.");
}
return stub; // depends on control dependency: [try], data = [none]
}
catch (ClassCastException ccex) {
throw new RuntimeException("The UDF class is not a proper subclass of " + superClass.getName(), ccex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected Map<String, List<Object>> toSeedMap(final String uid) {
final List<Object> values = Collections.singletonList((Object) uid);
final String usernameAttribute = this.usernameAttributeProvider.getUsernameAttribute();
final Map<String, List<Object>> seed = Collections.singletonMap(usernameAttribute, values);
if (this.logger.isDebugEnabled()) {
this.logger.debug("Created seed map='" + seed + "' for uid='" + uid + "'");
}
return seed;
} }
|
public class class_name {
protected Map<String, List<Object>> toSeedMap(final String uid) {
final List<Object> values = Collections.singletonList((Object) uid);
final String usernameAttribute = this.usernameAttributeProvider.getUsernameAttribute();
final Map<String, List<Object>> seed = Collections.singletonMap(usernameAttribute, values);
if (this.logger.isDebugEnabled()) {
this.logger.debug("Created seed map='" + seed + "' for uid='" + uid + "'"); // depends on control dependency: [if], data = [none]
}
return seed;
} }
|
public class class_name {
private Map<Integer, Integer> getTypeIndexesPerLevel() {
if (this.typeIndexesPerLevel == null) {
this.typeIndexesPerLevel = new HashMap<Integer, Integer>(4);
}
return this.typeIndexesPerLevel;
} }
|
public class class_name {
private Map<Integer, Integer> getTypeIndexesPerLevel() {
if (this.typeIndexesPerLevel == null) {
this.typeIndexesPerLevel = new HashMap<Integer, Integer>(4); // depends on control dependency: [if], data = [none]
}
return this.typeIndexesPerLevel;
} }
|
public class class_name {
public void appendNodes(NodeSet nodes)
{
int nNodes = nodes.size();
if (null == m_map)
{
m_mapSize = nNodes + m_blocksize;
m_map = new Node[m_mapSize];
}
else if ((m_firstFree + nNodes) >= m_mapSize)
{
m_mapSize += (nNodes + m_blocksize);
Node newMap[] = new Node[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + nNodes);
m_map = newMap;
}
System.arraycopy(nodes.m_map, 0, m_map, m_firstFree, nNodes);
m_firstFree += nNodes;
} }
|
public class class_name {
public void appendNodes(NodeSet nodes)
{
int nNodes = nodes.size();
if (null == m_map)
{
m_mapSize = nNodes + m_blocksize; // depends on control dependency: [if], data = [none]
m_map = new Node[m_mapSize]; // depends on control dependency: [if], data = [none]
}
else if ((m_firstFree + nNodes) >= m_mapSize)
{
m_mapSize += (nNodes + m_blocksize); // depends on control dependency: [if], data = [none]
Node newMap[] = new Node[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + nNodes); // depends on control dependency: [if], data = [none]
m_map = newMap; // depends on control dependency: [if], data = [none]
}
System.arraycopy(nodes.m_map, 0, m_map, m_firstFree, nNodes);
m_firstFree += nNodes;
} }
|
public class class_name {
private int getComponentState(JComponent c) {
if (frame != null) {
if (frame.isSelected()) {
return SELECTED;
}
}
return SeaGlassLookAndFeel.getComponentState(c);
} }
|
public class class_name {
private int getComponentState(JComponent c) {
if (frame != null) {
if (frame.isSelected()) {
return SELECTED; // depends on control dependency: [if], data = [none]
}
}
return SeaGlassLookAndFeel.getComponentState(c);
} }
|
public class class_name {
public void marshall(DeleteDomainEntryRequest deleteDomainEntryRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteDomainEntryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteDomainEntryRequest.getDomainName(), DOMAINNAME_BINDING);
protocolMarshaller.marshall(deleteDomainEntryRequest.getDomainEntry(), DOMAINENTRY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DeleteDomainEntryRequest deleteDomainEntryRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteDomainEntryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteDomainEntryRequest.getDomainName(), DOMAINNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteDomainEntryRequest.getDomainEntry(), DOMAINENTRY_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 String getSignedHeadersString(Map<String, String> headers) {
List<String> sortedList = new ArrayList<>(headers.keySet());
Collections.sort(sortedList, String.CASE_INSENSITIVE_ORDER);
StringBuilder signedHeaderString = new StringBuilder();
for (String header : sortedList) {
if (signedHeaderString.length() > START_INDEX) {
signedHeaderString.append(SEMICOLON);
}
signedHeaderString.append(nullToEmpty(header).toLowerCase());
}
return signedHeaderString.toString();
} }
|
public class class_name {
public String getSignedHeadersString(Map<String, String> headers) {
List<String> sortedList = new ArrayList<>(headers.keySet());
Collections.sort(sortedList, String.CASE_INSENSITIVE_ORDER);
StringBuilder signedHeaderString = new StringBuilder();
for (String header : sortedList) {
if (signedHeaderString.length() > START_INDEX) {
signedHeaderString.append(SEMICOLON); // depends on control dependency: [if], data = [none]
}
signedHeaderString.append(nullToEmpty(header).toLowerCase()); // depends on control dependency: [for], data = [header]
}
return signedHeaderString.toString();
} }
|
public class class_name {
public JBBPTextWriter Comment(final String... comment) throws IOException {
if (this.flagCommentsAllowed) {
if (comment != null) {
for (final String c : comment) {
if (c == null) {
continue;
}
if (c.indexOf('\n') >= 0) {
final String[] splitted = c.split("\\n", -1);
for (final String s : splitted) {
this.ensureCommentMode();
this.write(s);
}
} else {
this.ensureCommentMode();
this.write(c);
}
}
this.prevLineCommentsStartPosition = 0;
}
} else {
ensureNewLineMode();
}
return this;
} }
|
public class class_name {
public JBBPTextWriter Comment(final String... comment) throws IOException {
if (this.flagCommentsAllowed) {
if (comment != null) {
for (final String c : comment) {
if (c == null) {
continue;
}
if (c.indexOf('\n') >= 0) {
final String[] splitted = c.split("\\n", -1);
for (final String s : splitted) {
this.ensureCommentMode(); // depends on control dependency: [for], data = [s]
this.write(s); // depends on control dependency: [for], data = [s]
}
} else {
this.ensureCommentMode(); // depends on control dependency: [if], data = [none]
this.write(c); // depends on control dependency: [if], data = [none]
}
}
this.prevLineCommentsStartPosition = 0; // depends on control dependency: [if], data = [none]
}
} else {
ensureNewLineMode(); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public void addFile(File file, String name) {
files.put(name, file);
// remove duplicate key
if (fileStreams.containsKey(name)) {
fileStreams.remove(name);
}
} }
|
public class class_name {
public void addFile(File file, String name) {
files.put(name, file);
// remove duplicate key
if (fileStreams.containsKey(name)) {
fileStreams.remove(name); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void shutdown() {
// remove all of our temp directories
for (File path : paths) {
try {
if (path != null) {
if (path.exists()) {
FileUtils.deleteDirectory(path);
LOG.info("I/O manager removed spill file directory {}", path.getAbsolutePath());
}
}
} catch (Throwable t) {
LOG.error("IOManager failed to properly clean up temp file directory: " + path, t);
}
}
} }
|
public class class_name {
public void shutdown() {
// remove all of our temp directories
for (File path : paths) {
try {
if (path != null) {
if (path.exists()) {
FileUtils.deleteDirectory(path); // depends on control dependency: [if], data = [none]
LOG.info("I/O manager removed spill file directory {}", path.getAbsolutePath()); // depends on control dependency: [if], data = [none]
}
}
} catch (Throwable t) {
LOG.error("IOManager failed to properly clean up temp file directory: " + path, t);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public void removeDeleted(String entryId) {
CmsListItem item = getDeleted().getItem(entryId);
if (item != null) {
// remove
getDeleted().removeItem(item);
}
if (getDeleted().getWidgetCount() == 0) {
m_clipboardButton.enableClearDeleted(false);
}
} }
|
public class class_name {
public void removeDeleted(String entryId) {
CmsListItem item = getDeleted().getItem(entryId);
if (item != null) {
// remove
getDeleted().removeItem(item); // depends on control dependency: [if], data = [(item]
}
if (getDeleted().getWidgetCount() == 0) {
m_clipboardButton.enableClearDeleted(false); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public final EObject ruleJvmLowerBound() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
EObject lv_typeReference_1_0 = null;
enterRule();
try {
// InternalXbase.g:6032:2: ( (otherlv_0= 'super' ( (lv_typeReference_1_0= ruleJvmTypeReference ) ) ) )
// InternalXbase.g:6033:2: (otherlv_0= 'super' ( (lv_typeReference_1_0= ruleJvmTypeReference ) ) )
{
// InternalXbase.g:6033:2: (otherlv_0= 'super' ( (lv_typeReference_1_0= ruleJvmTypeReference ) ) )
// InternalXbase.g:6034:3: otherlv_0= 'super' ( (lv_typeReference_1_0= ruleJvmTypeReference ) )
{
otherlv_0=(Token)match(input,73,FOLLOW_13); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_0, grammarAccess.getJvmLowerBoundAccess().getSuperKeyword_0());
}
// InternalXbase.g:6038:3: ( (lv_typeReference_1_0= ruleJvmTypeReference ) )
// InternalXbase.g:6039:4: (lv_typeReference_1_0= ruleJvmTypeReference )
{
// InternalXbase.g:6039:4: (lv_typeReference_1_0= ruleJvmTypeReference )
// InternalXbase.g:6040:5: lv_typeReference_1_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmLowerBoundAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0());
}
pushFollow(FOLLOW_2);
lv_typeReference_1_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getJvmLowerBoundRule());
}
set(
current,
"typeReference",
lv_typeReference_1_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference");
afterParserOrEnumRuleCall();
}
}
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final EObject ruleJvmLowerBound() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
EObject lv_typeReference_1_0 = null;
enterRule();
try {
// InternalXbase.g:6032:2: ( (otherlv_0= 'super' ( (lv_typeReference_1_0= ruleJvmTypeReference ) ) ) )
// InternalXbase.g:6033:2: (otherlv_0= 'super' ( (lv_typeReference_1_0= ruleJvmTypeReference ) ) )
{
// InternalXbase.g:6033:2: (otherlv_0= 'super' ( (lv_typeReference_1_0= ruleJvmTypeReference ) ) )
// InternalXbase.g:6034:3: otherlv_0= 'super' ( (lv_typeReference_1_0= ruleJvmTypeReference ) )
{
otherlv_0=(Token)match(input,73,FOLLOW_13); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_0, grammarAccess.getJvmLowerBoundAccess().getSuperKeyword_0()); // depends on control dependency: [if], data = [none]
}
// InternalXbase.g:6038:3: ( (lv_typeReference_1_0= ruleJvmTypeReference ) )
// InternalXbase.g:6039:4: (lv_typeReference_1_0= ruleJvmTypeReference )
{
// InternalXbase.g:6039:4: (lv_typeReference_1_0= ruleJvmTypeReference )
// InternalXbase.g:6040:5: lv_typeReference_1_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmLowerBoundAccess().getTypeReferenceJvmTypeReferenceParserRuleCall_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_2);
lv_typeReference_1_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getJvmLowerBoundRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"typeReference",
lv_typeReference_1_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference");
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
protected final SIBusMessage readAndDeleteMessage(SIMessageHandle handle,
SITransaction transaction) throws ResourceException, SIMessageNotLockedException {
final String methodName = "deleteMessage";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] { handle,
transaction });
}
SIBusMessage message = null;
if (_session instanceof BifurcatedConsumerSession) {
try {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled ()) {
SibTr.debug(this, TRACE,
"We have a bifucated consumer session so attempting to perform readAndDelete");
}
SIBusMessage [] messageList = ((BifurcatedConsumerSession) _session).readAndDeleteSet(new SIMessageHandle[] { handle }, transaction);
if (messageList.length != 1) {
throw new ResourceAdapterInternalException(NLS.getFormattedMessage(
("MESSAGE_LIST_INCORRECT_CWSIV0607"), new Object[] { "" + messageList.length, messageList,
handle, transaction }, null));
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled ()) {
SibTr.debug(this, TRACE,
"Getting the message from the message list");
}
message = messageList [0];
} catch (SIMessageNotLockedException exception) {
// No FFDC code needed
/*
* Message lock has expired and message will be
* reassigned. Throw this back up to the called to
* catch.
*/
throw exception;
}catch (final SIException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, "1:1292:1.73", this);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
SibTr.exception(this, TRACE, exception);
}
throw new ResourceAdapterInternalException(NLS.getFormattedMessage(
("DELETE_EXCEPTION_CWSIV0608"), new Object[] { exception,
handle, transaction }, null), exception);
} catch (final SIErrorException exception) {
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, "1:1303:1.73", this);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
SibTr.exception(this, TRACE, exception);
}
throw new ResourceAdapterInternalException(NLS.getFormattedMessage(
("DELETE_EXCEPTION_CWSIV0608"), new Object[] { exception,
handle, transaction }, null), exception);
}
} else {
throw new ResourceAdapterInternalException(NLS.getFormattedMessage(
("INVALID_SESSION_CWSIV0606"),
new Object[] { _session, handle, transaction, BifurcatedConsumerSession.class.getName () },
null));
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName, message);
}
return message;
} }
|
public class class_name {
protected final SIBusMessage readAndDeleteMessage(SIMessageHandle handle,
SITransaction transaction) throws ResourceException, SIMessageNotLockedException {
final String methodName = "deleteMessage";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] { handle,
transaction });
}
SIBusMessage message = null;
if (_session instanceof BifurcatedConsumerSession) {
try {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled ()) {
SibTr.debug(this, TRACE,
"We have a bifucated consumer session so attempting to perform readAndDelete"); // depends on control dependency: [if], data = [none]
}
SIBusMessage [] messageList = ((BifurcatedConsumerSession) _session).readAndDeleteSet(new SIMessageHandle[] { handle }, transaction);
if (messageList.length != 1) {
throw new ResourceAdapterInternalException(NLS.getFormattedMessage(
("MESSAGE_LIST_INCORRECT_CWSIV0607"), new Object[] { "" + messageList.length, messageList,
handle, transaction }, null));
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled ()) {
SibTr.debug(this, TRACE,
"Getting the message from the message list"); // depends on control dependency: [if], data = [none]
}
message = messageList [0]; // depends on control dependency: [try], data = [none]
} catch (SIMessageNotLockedException exception) {
// No FFDC code needed
/*
* Message lock has expired and message will be
* reassigned. Throw this back up to the called to
* catch.
*/
throw exception;
}catch (final SIException exception) { // depends on control dependency: [catch], data = [none]
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, "1:1292:1.73", this);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
SibTr.exception(this, TRACE, exception); // depends on control dependency: [if], data = [none]
}
throw new ResourceAdapterInternalException(NLS.getFormattedMessage(
("DELETE_EXCEPTION_CWSIV0608"), new Object[] { exception,
handle, transaction }, null), exception);
} catch (final SIErrorException exception) { // depends on control dependency: [catch], data = [none]
FFDCFilter.processException(exception, CLASS_NAME + "."
+ methodName, "1:1303:1.73", this);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) {
SibTr.exception(this, TRACE, exception); // depends on control dependency: [if], data = [none]
}
throw new ResourceAdapterInternalException(NLS.getFormattedMessage(
("DELETE_EXCEPTION_CWSIV0608"), new Object[] { exception,
handle, transaction }, null), exception);
} // depends on control dependency: [catch], data = [none]
} else {
throw new ResourceAdapterInternalException(NLS.getFormattedMessage(
("INVALID_SESSION_CWSIV0606"),
new Object[] { _session, handle, transaction, BifurcatedConsumerSession.class.getName () },
null));
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName, message);
}
return message;
} }
|
public class class_name {
public ManagementGroupVertex getOutputGroupVertex(int index) {
final Iterator<ManagementGroupVertex> it = this.groupVertices.iterator();
while (it.hasNext()) {
final ManagementGroupVertex groupVertex = it.next();
if (groupVertex.isOutputVertex()) {
if (index == 0) {
return groupVertex;
} else {
--index;
}
}
}
return null;
} }
|
public class class_name {
public ManagementGroupVertex getOutputGroupVertex(int index) {
final Iterator<ManagementGroupVertex> it = this.groupVertices.iterator();
while (it.hasNext()) {
final ManagementGroupVertex groupVertex = it.next();
if (groupVertex.isOutputVertex()) {
if (index == 0) {
return groupVertex; // depends on control dependency: [if], data = [none]
} else {
--index; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
public void gatherAndDisplayMetaDataInfo(Connection conn, WSManagedConnectionFactoryImpl mcf) throws SQLException
{
java.sql.DatabaseMetaData mData = conn.getMetaData();
String databaseProductName = mData.getDatabaseProductName();
String driverName = mData.getDriverName();
String driverVersion = null;
String databaseProductVersion = null;
try {
driverVersion = mData.getDriverVersion();
databaseProductVersion = mData.getDatabaseProductVersion();
} catch (Exception e) {
// Ignore any Runtime errors as the info collected are solely for FFDC purpose.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Exception occurred while getting metaData info. Exception is: ", e);
}
}
setDatabaseProductName(databaseProductName);
setDriverName(driverName);
setDriverMajorVersion(mData.getDriverMajorVersion());
Tr.info(tc, "DB_PRODUCT_NAME", databaseProductName);
Tr.info(tc, "DB_PRODUCT_VERSION", databaseProductVersion);
Tr.info(tc, "JDBC_DRIVER_NAME", driverName);
Tr.info(tc, "JDBC_DRIVER_VERSION", driverVersion);
try {
if (mData.supportsResultSetHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT) &&
mData.supportsResultSetHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT)) {
if (tc.isDebugEnabled()) {
Tr.debug(this, tc, "Holdabiliy is supported");
}
holdabilitySupported = true;
} else {
if (tc.isDebugEnabled()) {
Tr.debug(this, tc, "Holdability not supported");
}
holdabilitySupported = false;
}
} catch (Throwable x) {
if (x instanceof SQLException) {
SQLException sqe = (SQLException) x;
if ((isConnectionError(sqe))) {
throw sqe; // if this is a stale we need to throw exception here.
}
// Some DB drivers throw SQLException when the JDBC version is 2.x.
// Holdability is not supported in 2.0
holdabilitySupported = false;
if (tc.isDebugEnabled()) {
Tr.debug(this, tc, "getHoldability is not supported in this JDBC driver. Encounter a java.sql.SQLException", sqe);
}
} else
{
//NO FFDC needed
// just log it and do nothing
if (tc.isDebugEnabled()) {
Tr.debug(this, tc, "caught an exception when testing the holdability from metadata, will call the holdability itself to know if supported", x);
}
}
}
try {
mcf.jdbcDriverSpecVersion = mData.getJDBCMajorVersion() * 10;
} catch (AbstractMethodError methError) {
// No FFDC code needed. JDBC driver version is less than 3.0.
mcf.jdbcDriverSpecVersion = 20;
}
catch (UnsupportedOperationException supportX) // raised by old Sybase driver
{
// No FFDC code needed. Driver is not JDBC 3.0 compliant because it does not
// support getJDBCMajorVersion,
mcf.jdbcDriverSpecVersion = 20;
}
catch (SQLException sqlX) {
// No FFDC code needed.
// Informix driver throws SQLException when the JDBC version is 2.x.
mcf.jdbcDriverSpecVersion = 20;
if (tc.isDebugEnabled())
Tr.debug(this, tc, "metadata.getJDBCMajorVersion", sqlX);
// Need to fail if it was a connection error.
if (isConnectionError(sqlX))
throw sqlX;
}
if (mcf.jdbcDriverSpecVersion > 30)
try {
mcf.jdbcDriverSpecVersion += mData.getJDBCMinorVersion();
} catch (SQLException x) {
} catch (UnsupportedOperationException x) {
}
if (mcf.jdbcDriverSpecVersion >= 40)
try
{
// Reset to the default client info of the data source (based on an initial connection),
// instead of using the default values for the JDBC driver--which could differ from the
// defaults specified for the data source.
Properties clientInfo = conn.getClientInfo();
if (clientInfo != null)
mcf.defaultClientInfo.putAll(clientInfo);
}
catch (SQLFeatureNotSupportedException featureX) {
// No FFDC code needed.
// The JDBC 4.0 driver ought to implement the getClientInfOProperties method,
// but doesn't. Issue a warning, but tolerate the error so that WAS can still
// interoperate with the JDBC driver.
Tr.warning(tc, "FEATURE_NOT_IMPLEMENTED", "java.sql.Connection.getClientInfo");
}
catch (AbstractMethodError methErr) {
// No FFDC code needed.
// Work around a bug in Oracle where the driver reports "10" instead
// of the JDBC specification level.
// If the JDBC 4.0 metadata operation cannot be found on the driver,
// then it must really be a JDBC 3.0 driver.
if (tc.isDebugEnabled())
Tr.debug(this, tc,
"JDBC spec level, " + mcf.jdbcDriverSpecVersion +
", reported by the driver is not valid. Using 30 (3.0) instead.");
mcf.jdbcDriverSpecVersion = 30;
}
catch (UnsupportedOperationException operationX)
{
// No FFDC code needed.
// Returned by Sybase jconn4.jar versions that are older than jConnect-7.07.
// The JDBC 4.0 driver ought to throw SQLFeatureNotSupportedException,
// but doesn't. Issue a warning, but tolerate the error so that WAS can still
// interoperate with the JDBC driver.
Tr.warning(tc, "FEATURE_NOT_IMPLEMENTED", "java.sql.Connection.getClientInfo");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "JDBC spec version implemented by driver", mcf.jdbcDriverSpecVersion);
} }
|
public class class_name {
public void gatherAndDisplayMetaDataInfo(Connection conn, WSManagedConnectionFactoryImpl mcf) throws SQLException
{
java.sql.DatabaseMetaData mData = conn.getMetaData();
String databaseProductName = mData.getDatabaseProductName();
String driverName = mData.getDriverName();
String driverVersion = null;
String databaseProductVersion = null;
try {
driverVersion = mData.getDriverVersion();
databaseProductVersion = mData.getDatabaseProductVersion();
} catch (Exception e) {
// Ignore any Runtime errors as the info collected are solely for FFDC purpose.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Exception occurred while getting metaData info. Exception is: ", e); // depends on control dependency: [if], data = [none]
}
}
setDatabaseProductName(databaseProductName);
setDriverName(driverName);
setDriverMajorVersion(mData.getDriverMajorVersion());
Tr.info(tc, "DB_PRODUCT_NAME", databaseProductName);
Tr.info(tc, "DB_PRODUCT_VERSION", databaseProductVersion);
Tr.info(tc, "JDBC_DRIVER_NAME", driverName);
Tr.info(tc, "JDBC_DRIVER_VERSION", driverVersion);
try {
if (mData.supportsResultSetHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT) &&
mData.supportsResultSetHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT)) {
if (tc.isDebugEnabled()) {
Tr.debug(this, tc, "Holdabiliy is supported"); // depends on control dependency: [if], data = [none]
}
holdabilitySupported = true; // depends on control dependency: [if], data = [none]
} else {
if (tc.isDebugEnabled()) {
Tr.debug(this, tc, "Holdability not supported"); // depends on control dependency: [if], data = [none]
}
holdabilitySupported = false; // depends on control dependency: [if], data = [none]
}
} catch (Throwable x) {
if (x instanceof SQLException) {
SQLException sqe = (SQLException) x;
if ((isConnectionError(sqe))) {
throw sqe; // if this is a stale we need to throw exception here.
}
// Some DB drivers throw SQLException when the JDBC version is 2.x.
// Holdability is not supported in 2.0
holdabilitySupported = false; // depends on control dependency: [if], data = [none]
if (tc.isDebugEnabled()) {
Tr.debug(this, tc, "getHoldability is not supported in this JDBC driver. Encounter a java.sql.SQLException", sqe); // depends on control dependency: [if], data = [none]
}
} else
{
//NO FFDC needed
// just log it and do nothing
if (tc.isDebugEnabled()) {
Tr.debug(this, tc, "caught an exception when testing the holdability from metadata, will call the holdability itself to know if supported", x); // depends on control dependency: [if], data = [none]
}
}
}
try {
mcf.jdbcDriverSpecVersion = mData.getJDBCMajorVersion() * 10;
} catch (AbstractMethodError methError) {
// No FFDC code needed. JDBC driver version is less than 3.0.
mcf.jdbcDriverSpecVersion = 20;
}
catch (UnsupportedOperationException supportX) // raised by old Sybase driver
{
// No FFDC code needed. Driver is not JDBC 3.0 compliant because it does not
// support getJDBCMajorVersion,
mcf.jdbcDriverSpecVersion = 20;
}
catch (SQLException sqlX) {
// No FFDC code needed.
// Informix driver throws SQLException when the JDBC version is 2.x.
mcf.jdbcDriverSpecVersion = 20;
if (tc.isDebugEnabled())
Tr.debug(this, tc, "metadata.getJDBCMajorVersion", sqlX);
// Need to fail if it was a connection error.
if (isConnectionError(sqlX))
throw sqlX;
}
if (mcf.jdbcDriverSpecVersion > 30)
try {
mcf.jdbcDriverSpecVersion += mData.getJDBCMinorVersion();
} catch (SQLException x) {
} catch (UnsupportedOperationException x) {
}
if (mcf.jdbcDriverSpecVersion >= 40)
try
{
// Reset to the default client info of the data source (based on an initial connection),
// instead of using the default values for the JDBC driver--which could differ from the
// defaults specified for the data source.
Properties clientInfo = conn.getClientInfo();
if (clientInfo != null)
mcf.defaultClientInfo.putAll(clientInfo);
}
catch (SQLFeatureNotSupportedException featureX) {
// No FFDC code needed.
// The JDBC 4.0 driver ought to implement the getClientInfOProperties method,
// but doesn't. Issue a warning, but tolerate the error so that WAS can still
// interoperate with the JDBC driver.
Tr.warning(tc, "FEATURE_NOT_IMPLEMENTED", "java.sql.Connection.getClientInfo");
}
catch (AbstractMethodError methErr) {
// No FFDC code needed.
// Work around a bug in Oracle where the driver reports "10" instead
// of the JDBC specification level.
// If the JDBC 4.0 metadata operation cannot be found on the driver,
// then it must really be a JDBC 3.0 driver.
if (tc.isDebugEnabled())
Tr.debug(this, tc,
"JDBC spec level, " + mcf.jdbcDriverSpecVersion +
", reported by the driver is not valid. Using 30 (3.0) instead.");
mcf.jdbcDriverSpecVersion = 30;
}
catch (UnsupportedOperationException operationX)
{
// No FFDC code needed.
// Returned by Sybase jconn4.jar versions that are older than jConnect-7.07.
// The JDBC 4.0 driver ought to throw SQLFeatureNotSupportedException,
// but doesn't. Issue a warning, but tolerate the error so that WAS can still
// interoperate with the JDBC driver.
Tr.warning(tc, "FEATURE_NOT_IMPLEMENTED", "java.sql.Connection.getClientInfo");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "JDBC spec version implemented by driver", mcf.jdbcDriverSpecVersion);
} }
|
public class class_name {
private ComparisonState compareNodeLists(Iterable<Node> controlSeq,
final XPathContext controlContext,
Iterable<Node> testSeq,
final XPathContext testContext) {
ComparisonState chain = new OngoingComparisonState();
Iterable<Map.Entry<Node, Node>> matches =
getNodeMatcher().match(controlSeq, testSeq);
List<Node> controlList = Linqy.asList(controlSeq);
List<Node> testList = Linqy.asList(testSeq);
Set<Node> seen = new HashSet<Node>();
for (Map.Entry<Node, Node> pair : matches) {
final Node control = pair.getKey();
seen.add(control);
final Node test = pair.getValue();
seen.add(test);
int controlIndex = controlList.indexOf(control);
int testIndex = testList.indexOf(test);
controlContext.navigateToChild(controlIndex);
testContext.navigateToChild(testIndex);
try {
chain =
chain.andThen(new Comparison(ComparisonType.CHILD_NODELIST_SEQUENCE,
control, getXPath(controlContext),
Integer.valueOf(controlIndex), getParentXPath(controlContext),
test, getXPath(testContext),
Integer.valueOf(testIndex), getParentXPath(testContext)))
.andThen(new DeferredComparison() {
@Override
public ComparisonState apply() {
return compareNodes(control, controlContext,
test, testContext);
}
});
} finally {
testContext.navigateToParent();
controlContext.navigateToParent();
}
}
return chain.andThen(new UnmatchedControlNodes(controlList, controlContext, seen, testContext))
.andThen(new UnmatchedTestNodes(testList, testContext, seen, controlContext));
} }
|
public class class_name {
private ComparisonState compareNodeLists(Iterable<Node> controlSeq,
final XPathContext controlContext,
Iterable<Node> testSeq,
final XPathContext testContext) {
ComparisonState chain = new OngoingComparisonState();
Iterable<Map.Entry<Node, Node>> matches =
getNodeMatcher().match(controlSeq, testSeq);
List<Node> controlList = Linqy.asList(controlSeq);
List<Node> testList = Linqy.asList(testSeq);
Set<Node> seen = new HashSet<Node>();
for (Map.Entry<Node, Node> pair : matches) {
final Node control = pair.getKey();
seen.add(control); // depends on control dependency: [for], data = [none]
final Node test = pair.getValue();
seen.add(test); // depends on control dependency: [for], data = [none]
int controlIndex = controlList.indexOf(control);
int testIndex = testList.indexOf(test);
controlContext.navigateToChild(controlIndex); // depends on control dependency: [for], data = [none]
testContext.navigateToChild(testIndex); // depends on control dependency: [for], data = [none]
try {
chain =
chain.andThen(new Comparison(ComparisonType.CHILD_NODELIST_SEQUENCE,
control, getXPath(controlContext),
Integer.valueOf(controlIndex), getParentXPath(controlContext),
test, getXPath(testContext),
Integer.valueOf(testIndex), getParentXPath(testContext)))
.andThen(new DeferredComparison() {
@Override
public ComparisonState apply() {
return compareNodes(control, controlContext,
test, testContext);
}
}); // depends on control dependency: [try], data = [none]
} finally {
testContext.navigateToParent();
controlContext.navigateToParent();
}
}
return chain.andThen(new UnmatchedControlNodes(controlList, controlContext, seen, testContext))
.andThen(new UnmatchedTestNodes(testList, testContext, seen, controlContext));
} }
|
public class class_name {
public EntityListenerDesc createEntityListenerDesc(EntityDesc entityDesc) {
EntityListenerDesc entityListenerDesc = new EntityListenerDesc();
entityListenerDesc.setEntityDesc(entityDesc);
entityListenerDesc.setPackageName(entityDesc.getPackageName());
String entityPrefix = StringUtil.defaultString(entityDesc.getEntityPrefix(), "");
String entitySuffix = StringUtil.defaultString(entityDesc.getEntitySuffix(), "");
String entityName = entityPrefix + entityDesc.getSimpleName() + entitySuffix;
entityListenerDesc.setSimpleName(entityName + Constants.ENTITY_LISTENER_SUFFIX);
entityListenerDesc.setEntityClassSimpleName(entityDesc.getSimpleName());
if (superclassName != null) {
entityListenerDesc.setSuperclassSimpleName(ClassUtil.getSimpleName(superclassName));
}
entityListenerDesc.setTemplateName(Constants.ENTITY_LISTENER_TEMPLATE);
handleImportName(entityListenerDesc, entityDesc);
return entityListenerDesc;
} }
|
public class class_name {
public EntityListenerDesc createEntityListenerDesc(EntityDesc entityDesc) {
EntityListenerDesc entityListenerDesc = new EntityListenerDesc();
entityListenerDesc.setEntityDesc(entityDesc);
entityListenerDesc.setPackageName(entityDesc.getPackageName());
String entityPrefix = StringUtil.defaultString(entityDesc.getEntityPrefix(), "");
String entitySuffix = StringUtil.defaultString(entityDesc.getEntitySuffix(), "");
String entityName = entityPrefix + entityDesc.getSimpleName() + entitySuffix;
entityListenerDesc.setSimpleName(entityName + Constants.ENTITY_LISTENER_SUFFIX);
entityListenerDesc.setEntityClassSimpleName(entityDesc.getSimpleName());
if (superclassName != null) {
entityListenerDesc.setSuperclassSimpleName(ClassUtil.getSimpleName(superclassName)); // depends on control dependency: [if], data = [(superclassName]
}
entityListenerDesc.setTemplateName(Constants.ENTITY_LISTENER_TEMPLATE);
handleImportName(entityListenerDesc, entityDesc);
return entityListenerDesc;
} }
|
public class class_name {
@Override
public final void withdrawal(final Map<String, Object> pAddParam,
final IMakingWarehouseEntry pEntity, final Date pDateAccount,
final Long pDrawingOwnerId) throws Exception {
if (!pEntity.getIdDatabaseBirth()
.equals(getSrvOrm().getIdDatabase())) {
throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
"can_not_make_di_entry_for_foreign_src");
}
String queryMain = lazyGetQuery(srvAccSettings
.lazyGetAccSettings(pAddParam).getCogsMethod().getFileName());
StringBuffer sb = new StringBuffer();
int i = 0;
for (ADrawItemSourcesLine drawItemSourceLine
: getDrawItemSources(pAddParam)) {
if (drawItemSourceLine.getIsUsed()) {
String query = lazyGetQuery(drawItemSourceLine.getFileName());
query = query.replace(":IDDATABASEBIRTH", String.valueOf(getSrvOrm()
.getIdDatabase()));
query = query.replace(":INVITEM", pEntity.getInvItem()
.getItsId().toString());
query = query.replace(":UNITOFMEASURE", pEntity.getUnitOfMeasure()
.getItsId().toString());
if (i++ > 0) {
sb.append("\nunion all\n\n");
}
sb.append(query);
}
}
String sourceAll = sb.toString();
if (sourceAll.trim().length() == 0) {
throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
"there_is_no_draw_material_rules");
}
//ADrawItemEntry just holder source id and type
List<T> sources =
new ArrayList<T>();
queryMain = queryMain.replace(":SOURCEALL",
sourceAll);
BigDecimal quantityInSources = BigDecimal.ZERO;
IRecordSet<RS> recordSet = null;
try {
recordSet = getSrvDatabase().retrieveRecords(queryMain);
if (recordSet.moveToFirst()) {
do {
Long sourceId = recordSet.getLong("SOURCEID");
Integer sourceType = recordSet.getInteger("SOURCETYPE");
Long sourceOwnerId = recordSet.getLong("SOURCEOWNERID");
Integer sourceOwnerType = recordSet.getInteger("SOURCEOWNERTYPE");
BigDecimal theRest = BigDecimal
.valueOf(recordSet.getDouble("THEREST"));
T source = createDrawItemEntry(pAddParam);
source.setSourceId(sourceId);
source.setSourceType(sourceType);
source.setSourceOwnerId(sourceOwnerId);
source.setSourceOwnerType(sourceOwnerType);
sources.add(source);
quantityInSources = quantityInSources.add(theRest);
if (quantityInSources.compareTo(pEntity.getItsQuantity()) >= 0) {
break;
}
} while (recordSet.moveToNext());
}
} finally {
if (recordSet != null) {
recordSet.close();
}
}
if (quantityInSources.compareTo(pEntity.getItsQuantity()) < 0) {
throw new ExceptionWithCode(PurchaseInvoice.THERE_IS_NO_GOODS,
"there_is_no_goods_in_stock");
}
BigDecimal quantityToDrawRest = pEntity.getItsQuantity();
for (T source : sources) {
@SuppressWarnings("unchecked")
IFactorySimple<IDrawItemSource> fctDis =
(IFactorySimple<IDrawItemSource>) this.entitiesFactoriesFatory
.lazyGet(pAddParam, srvTypeCode.getTypeCodeMap()
.get(source.getSourceType()));
IDrawItemSource drawed = fctDis.create(pAddParam);
String fldIdName = this.srvOrm.getTablesMap()
.get(drawed.getClass().getSimpleName()).getIdFieldName();
Method setterId = this.settersRapiHolder
.getFor(drawed.getClass(), fldIdName);
setterId.invoke(drawed, source.getSourceId());
drawed = srvOrm.retrieveEntity(pAddParam, drawed);
BigDecimal quantityToDraw;
if (quantityToDrawRest.compareTo(drawed.getTheRest()) < 0) {
quantityToDraw = quantityToDrawRest;
} else {
quantityToDraw = drawed.getTheRest();
}
withdrawalFrom(pAddParam, pEntity, drawed, quantityToDraw);
quantityToDrawRest = quantityToDrawRest.subtract(quantityToDraw);
if (quantityToDrawRest.doubleValue() == 0) {
break;
}
}
} }
|
public class class_name {
@Override
public final void withdrawal(final Map<String, Object> pAddParam,
final IMakingWarehouseEntry pEntity, final Date pDateAccount,
final Long pDrawingOwnerId) throws Exception {
if (!pEntity.getIdDatabaseBirth()
.equals(getSrvOrm().getIdDatabase())) {
throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
"can_not_make_di_entry_for_foreign_src");
}
String queryMain = lazyGetQuery(srvAccSettings
.lazyGetAccSettings(pAddParam).getCogsMethod().getFileName());
StringBuffer sb = new StringBuffer();
int i = 0;
for (ADrawItemSourcesLine drawItemSourceLine
: getDrawItemSources(pAddParam)) {
if (drawItemSourceLine.getIsUsed()) {
String query = lazyGetQuery(drawItemSourceLine.getFileName());
query = query.replace(":IDDATABASEBIRTH", String.valueOf(getSrvOrm()
.getIdDatabase())); // depends on control dependency: [if], data = [none]
query = query.replace(":INVITEM", pEntity.getInvItem()
.getItsId().toString()); // depends on control dependency: [if], data = [none]
query = query.replace(":UNITOFMEASURE", pEntity.getUnitOfMeasure()
.getItsId().toString()); // depends on control dependency: [if], data = [none]
if (i++ > 0) {
sb.append("\nunion all\n\n"); // depends on control dependency: [if], data = [none]
}
sb.append(query); // depends on control dependency: [if], data = [none]
}
}
String sourceAll = sb.toString();
if (sourceAll.trim().length() == 0) {
throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
"there_is_no_draw_material_rules");
}
//ADrawItemEntry just holder source id and type
List<T> sources =
new ArrayList<T>();
queryMain = queryMain.replace(":SOURCEALL",
sourceAll);
BigDecimal quantityInSources = BigDecimal.ZERO;
IRecordSet<RS> recordSet = null;
try {
recordSet = getSrvDatabase().retrieveRecords(queryMain);
if (recordSet.moveToFirst()) {
do {
Long sourceId = recordSet.getLong("SOURCEID");
Integer sourceType = recordSet.getInteger("SOURCETYPE");
Long sourceOwnerId = recordSet.getLong("SOURCEOWNERID");
Integer sourceOwnerType = recordSet.getInteger("SOURCEOWNERTYPE");
BigDecimal theRest = BigDecimal
.valueOf(recordSet.getDouble("THEREST"));
T source = createDrawItemEntry(pAddParam);
source.setSourceId(sourceId);
source.setSourceType(sourceType);
source.setSourceOwnerId(sourceOwnerId);
source.setSourceOwnerType(sourceOwnerType);
sources.add(source);
quantityInSources = quantityInSources.add(theRest);
if (quantityInSources.compareTo(pEntity.getItsQuantity()) >= 0) {
break;
}
} while (recordSet.moveToNext());
}
} finally {
if (recordSet != null) {
recordSet.close(); // depends on control dependency: [if], data = [none]
}
}
if (quantityInSources.compareTo(pEntity.getItsQuantity()) < 0) {
throw new ExceptionWithCode(PurchaseInvoice.THERE_IS_NO_GOODS,
"there_is_no_goods_in_stock");
}
BigDecimal quantityToDrawRest = pEntity.getItsQuantity();
for (T source : sources) {
@SuppressWarnings("unchecked")
IFactorySimple<IDrawItemSource> fctDis =
(IFactorySimple<IDrawItemSource>) this.entitiesFactoriesFatory
.lazyGet(pAddParam, srvTypeCode.getTypeCodeMap()
.get(source.getSourceType()));
IDrawItemSource drawed = fctDis.create(pAddParam);
String fldIdName = this.srvOrm.getTablesMap()
.get(drawed.getClass().getSimpleName()).getIdFieldName();
Method setterId = this.settersRapiHolder
.getFor(drawed.getClass(), fldIdName);
setterId.invoke(drawed, source.getSourceId());
drawed = srvOrm.retrieveEntity(pAddParam, drawed);
BigDecimal quantityToDraw;
if (quantityToDrawRest.compareTo(drawed.getTheRest()) < 0) {
quantityToDraw = quantityToDrawRest; // depends on control dependency: [if], data = [none]
} else {
quantityToDraw = drawed.getTheRest(); // depends on control dependency: [if], data = [none]
}
withdrawalFrom(pAddParam, pEntity, drawed, quantityToDraw);
quantityToDrawRest = quantityToDrawRest.subtract(quantityToDraw);
if (quantityToDrawRest.doubleValue() == 0) {
break;
}
}
} }
|
public class class_name {
@Override
public Prediction _predictRecord(Record r) {
ModelParameters modelParameters = knowledgeBase.getModelParameters();
Map<Integer, Cluster> clusterMap = modelParameters.getClusterMap();
AssociativeArray clusterDistances = new AssociativeArray();
for(Map.Entry<Integer, Cluster> e : clusterMap.entrySet()) {
Integer clusterId = e.getKey();
Cluster c= e.getValue();
double distance = calculateDistance(r, c.getCentroid());
clusterDistances.put(clusterId, distance);
}
Descriptives.normalize(clusterDistances);
return new Prediction(getSelectedClusterFromDistances(clusterDistances), clusterDistances);
} }
|
public class class_name {
@Override
public Prediction _predictRecord(Record r) {
ModelParameters modelParameters = knowledgeBase.getModelParameters();
Map<Integer, Cluster> clusterMap = modelParameters.getClusterMap();
AssociativeArray clusterDistances = new AssociativeArray();
for(Map.Entry<Integer, Cluster> e : clusterMap.entrySet()) {
Integer clusterId = e.getKey();
Cluster c= e.getValue();
double distance = calculateDistance(r, c.getCentroid());
clusterDistances.put(clusterId, distance); // depends on control dependency: [for], data = [e]
}
Descriptives.normalize(clusterDistances);
return new Prediction(getSelectedClusterFromDistances(clusterDistances), clusterDistances);
} }
|
public class class_name {
public void marshall(MigrationTask migrationTask, ProtocolMarshaller protocolMarshaller) {
if (migrationTask == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(migrationTask.getProgressUpdateStream(), PROGRESSUPDATESTREAM_BINDING);
protocolMarshaller.marshall(migrationTask.getMigrationTaskName(), MIGRATIONTASKNAME_BINDING);
protocolMarshaller.marshall(migrationTask.getTask(), TASK_BINDING);
protocolMarshaller.marshall(migrationTask.getUpdateDateTime(), UPDATEDATETIME_BINDING);
protocolMarshaller.marshall(migrationTask.getResourceAttributeList(), RESOURCEATTRIBUTELIST_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(MigrationTask migrationTask, ProtocolMarshaller protocolMarshaller) {
if (migrationTask == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(migrationTask.getProgressUpdateStream(), PROGRESSUPDATESTREAM_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(migrationTask.getMigrationTaskName(), MIGRATIONTASKNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(migrationTask.getTask(), TASK_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(migrationTask.getUpdateDateTime(), UPDATEDATETIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(migrationTask.getResourceAttributeList(), RESOURCEATTRIBUTELIST_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 Resource getResource(final String name) {
return doPrivileged(new PrivilegedAction<Resource>() {
public Resource run() {
try {
final VirtualFile file = getExistentVirtualFile(PathUtils.canonicalize(name));
if (file == null) {
return null;
}
return new VFSEntryResource(file.getPathNameRelativeTo(root), file, file.toURL());
} catch (MalformedURLException e) {
// must be invalid...? (todo: check this out)
return null;
}
}
});
} }
|
public class class_name {
public Resource getResource(final String name) {
return doPrivileged(new PrivilegedAction<Resource>() {
public Resource run() {
try {
final VirtualFile file = getExistentVirtualFile(PathUtils.canonicalize(name));
if (file == null) {
return null; // depends on control dependency: [if], data = [none]
}
return new VFSEntryResource(file.getPathNameRelativeTo(root), file, file.toURL()); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
// must be invalid...? (todo: check this out)
return null;
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public static String substring(final String s, int start) {
if (s == null) {
return null;
}
// handle negatives, which means last n characters
if (start < 0) {
start = s.length() + start; // remember start is negative
}
if (start < 0) {
start = 0;
}
if (start > s.length()) {
return "";
}
return s.substring(start);
} }
|
public class class_name {
public static String substring(final String s, int start) {
if (s == null) {
return null; // depends on control dependency: [if], data = [none]
}
// handle negatives, which means last n characters
if (start < 0) {
start = s.length() + start; // remember start is negative // depends on control dependency: [if], data = [none]
}
if (start < 0) {
start = 0; // depends on control dependency: [if], data = [none]
}
if (start > s.length()) {
return ""; // depends on control dependency: [if], data = [none]
}
return s.substring(start);
} }
|
public class class_name {
protected void addHits(@Nullable SearchResults results, boolean isReplacing) {
if (results == null) {
if (isReplacing) {
clear();
if (infiniteScrollListener != null) {
infiniteScrollListener.setCurrentlyLoading(false);
}
}
return;
}
JSONArray hits = results.hits;
if (isReplacing) {
adapter.clear(false);
}
for (int i = 0; i < hits.length(); ++i) {
JSONObject hit = hits.optJSONObject(i);
if (hit != null) {
adapter.add(hit);
}
}
if (isReplacing) {
adapter.notifyDataSetChanged();
smoothScrollToPosition(0);
if (infiniteScrollListener != null) {
infiniteScrollListener.setCurrentlyLoading(false);
}
} else {
adapter.notifyItemRangeInserted(adapter.getItemCount(), hits.length());
}
} }
|
public class class_name {
protected void addHits(@Nullable SearchResults results, boolean isReplacing) {
if (results == null) {
if (isReplacing) {
clear(); // depends on control dependency: [if], data = [none]
if (infiniteScrollListener != null) {
infiniteScrollListener.setCurrentlyLoading(false); // depends on control dependency: [if], data = [none]
}
}
return; // depends on control dependency: [if], data = [none]
}
JSONArray hits = results.hits;
if (isReplacing) {
adapter.clear(false); // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < hits.length(); ++i) {
JSONObject hit = hits.optJSONObject(i);
if (hit != null) {
adapter.add(hit); // depends on control dependency: [if], data = [(hit]
}
}
if (isReplacing) {
adapter.notifyDataSetChanged(); // depends on control dependency: [if], data = [none]
smoothScrollToPosition(0); // depends on control dependency: [if], data = [none]
if (infiniteScrollListener != null) {
infiniteScrollListener.setCurrentlyLoading(false); // depends on control dependency: [if], data = [none]
}
} else {
adapter.notifyItemRangeInserted(adapter.getItemCount(), hits.length()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected boolean installViewIfValidJoinRsp(final Promise<JoinRsp> join_promise, boolean block_for_rsp) {
boolean success=false;
JoinRsp rsp=null;
try {
if(join_promise.hasResult())
rsp=join_promise.getResult(1, true);
else if(block_for_rsp)
rsp=join_promise.getResult(gms.join_timeout, true);
return success=rsp != null && isJoinResponseValid(rsp) && installView(rsp.getView(), rsp.getDigest());
}
finally {
if(success)
gms.sendViewAck(rsp.getView().getCreator());
}
} }
|
public class class_name {
protected boolean installViewIfValidJoinRsp(final Promise<JoinRsp> join_promise, boolean block_for_rsp) {
boolean success=false;
JoinRsp rsp=null;
try {
if(join_promise.hasResult())
rsp=join_promise.getResult(1, true);
else if(block_for_rsp)
rsp=join_promise.getResult(gms.join_timeout, true);
return success=rsp != null && isJoinResponseValid(rsp) && installView(rsp.getView(), rsp.getDigest()); // depends on control dependency: [try], data = [none]
}
finally {
if(success)
gms.sendViewAck(rsp.getView().getCreator());
}
} }
|
public class class_name {
public Observable<ServiceResponse<Page<RecordSetInner>>> listByTypeWithServiceResponseAsync(final String resourceGroupName, final String privateZoneName, final RecordType recordType) {
return listByTypeSinglePageAsync(resourceGroupName, privateZoneName, recordType)
.concatMap(new Func1<ServiceResponse<Page<RecordSetInner>>, Observable<ServiceResponse<Page<RecordSetInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RecordSetInner>>> call(ServiceResponse<Page<RecordSetInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByTypeNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Page<RecordSetInner>>> listByTypeWithServiceResponseAsync(final String resourceGroupName, final String privateZoneName, final RecordType recordType) {
return listByTypeSinglePageAsync(resourceGroupName, privateZoneName, recordType)
.concatMap(new Func1<ServiceResponse<Page<RecordSetInner>>, Observable<ServiceResponse<Page<RecordSetInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RecordSetInner>>> call(ServiceResponse<Page<RecordSetInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(listByTypeNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public static MutableDoubleTuple standardDeviation(
Collection<? extends DoubleTuple> tuples,
MutableDoubleTuple result)
{
if (tuples.isEmpty())
{
return null;
}
DoubleTuple mean = arithmeticMean(tuples, null);
return standardDeviationFromMean(tuples, mean, result);
} }
|
public class class_name {
public static MutableDoubleTuple standardDeviation(
Collection<? extends DoubleTuple> tuples,
MutableDoubleTuple result)
{
if (tuples.isEmpty())
{
return null;
// depends on control dependency: [if], data = [none]
}
DoubleTuple mean = arithmeticMean(tuples, null);
return standardDeviationFromMean(tuples, mean, result);
} }
|
public class class_name {
@Override
public VType get(KType key) {
if (Intrinsics.<KType> isEmpty(key)) {
return hasEmptyKey ? Intrinsics.<VType> cast(values[mask + 1]) : Intrinsics.<VType> empty();
} else {
final KType[] keys = Intrinsics.<KType[]> cast(this.keys);
final int mask = this.mask;
int slot = hashKey(key) & mask;
KType existing;
while (!Intrinsics.<KType> isEmpty(existing = keys[slot])) {
if (Intrinsics.<KType> equals(this, key, existing)) {
return Intrinsics.<VType> cast(values[slot]);
}
slot = (slot + 1) & mask;
}
return Intrinsics.<VType> empty();
}
} }
|
public class class_name {
@Override
public VType get(KType key) {
if (Intrinsics.<KType> isEmpty(key)) {
return hasEmptyKey ? Intrinsics.<VType> cast(values[mask + 1]) : Intrinsics.<VType> empty(); // depends on control dependency: [if], data = [none]
} else {
final KType[] keys = Intrinsics.<KType[]> cast(this.keys);
final int mask = this.mask;
int slot = hashKey(key) & mask;
KType existing;
while (!Intrinsics.<KType> isEmpty(existing = keys[slot])) {
if (Intrinsics.<KType> equals(this, key, existing)) {
return Intrinsics.<VType> cast(values[slot]); // depends on control dependency: [if], data = [none]
}
slot = (slot + 1) & mask; // depends on control dependency: [while], data = [none]
}
return Intrinsics.<VType> empty(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void initialiseLinks(TraceCompletionInformation ci, long fragmentBaseTime, Node n,
StringBuilder nodeId) {
// Add Communication to represent a potential 'CausedBy' link from one or more fragments back to
// this node
TraceCompletionInformation.Communication c = new TraceCompletionInformation.Communication();
c.getIds().add(nodeId.toString());
// Define a a multi-consumer as potentially multiple CausedBy correlations may be created
// back to this node
c.setMultipleConsumers(true);
// Calculate the base duration for the communication
c.setBaseDuration(n.getTimestamp() - fragmentBaseTime);
c.setExpire(System.currentTimeMillis()+
TraceCompletionInformation.Communication.DEFAULT_EXPIRY_WINDOW_MILLIS);
if (log.isLoggable(Level.FINEST)) {
log.finest("Adding communication to completion information: ci=" + ci + " comms=" + c);
}
ci.getCommunications().add(c);
if (n.getClass() == Producer.class) {
// Get correlation ids
List<CorrelationIdentifier> cids = n.findCorrelationIds(Scope.Interaction, Scope.ControlFlow);
if (!cids.isEmpty()) {
c = new TraceCompletionInformation.Communication();
for (int i = 0; i < cids.size(); i++) {
c.getIds().add(cids.get(i).getValue());
}
c.setMultipleConsumers(((Producer) n).multipleConsumers());
// Calculate the base duration for the communication
c.setBaseDuration(n.getTimestamp() - fragmentBaseTime);
c.setExpire(System.currentTimeMillis() +
TraceCompletionInformation.Communication.DEFAULT_EXPIRY_WINDOW_MILLIS);
if (log.isLoggable(Level.FINEST)) {
log.finest("Adding communication to completion information: ci=" + ci + " comms=" + c);
}
ci.getCommunications().add(c);
}
} else if (n.containerNode()) {
ContainerNode cn = (ContainerNode) n;
for (int i = 0; i < cn.getNodes().size(); i++) {
int len = nodeId.length();
nodeId.append(':');
nodeId.append(i);
initialiseLinks(ci, fragmentBaseTime, cn.getNodes().get(i), nodeId);
// Remove this child's specific path, so that next iteration will add a different path number
nodeId.delete(len, nodeId.length());
}
}
} }
|
public class class_name {
public static void initialiseLinks(TraceCompletionInformation ci, long fragmentBaseTime, Node n,
StringBuilder nodeId) {
// Add Communication to represent a potential 'CausedBy' link from one or more fragments back to
// this node
TraceCompletionInformation.Communication c = new TraceCompletionInformation.Communication();
c.getIds().add(nodeId.toString());
// Define a a multi-consumer as potentially multiple CausedBy correlations may be created
// back to this node
c.setMultipleConsumers(true);
// Calculate the base duration for the communication
c.setBaseDuration(n.getTimestamp() - fragmentBaseTime);
c.setExpire(System.currentTimeMillis()+
TraceCompletionInformation.Communication.DEFAULT_EXPIRY_WINDOW_MILLIS);
if (log.isLoggable(Level.FINEST)) {
log.finest("Adding communication to completion information: ci=" + ci + " comms=" + c); // depends on control dependency: [if], data = [none]
}
ci.getCommunications().add(c);
if (n.getClass() == Producer.class) {
// Get correlation ids
List<CorrelationIdentifier> cids = n.findCorrelationIds(Scope.Interaction, Scope.ControlFlow);
if (!cids.isEmpty()) {
c = new TraceCompletionInformation.Communication(); // depends on control dependency: [if], data = [none]
for (int i = 0; i < cids.size(); i++) {
c.getIds().add(cids.get(i).getValue()); // depends on control dependency: [for], data = [i]
}
c.setMultipleConsumers(((Producer) n).multipleConsumers()); // depends on control dependency: [if], data = [none]
// Calculate the base duration for the communication
c.setBaseDuration(n.getTimestamp() - fragmentBaseTime); // depends on control dependency: [if], data = [none]
c.setExpire(System.currentTimeMillis() +
TraceCompletionInformation.Communication.DEFAULT_EXPIRY_WINDOW_MILLIS); // depends on control dependency: [if], data = [none]
if (log.isLoggable(Level.FINEST)) {
log.finest("Adding communication to completion information: ci=" + ci + " comms=" + c); // depends on control dependency: [if], data = [none]
}
ci.getCommunications().add(c); // depends on control dependency: [if], data = [none]
}
} else if (n.containerNode()) {
ContainerNode cn = (ContainerNode) n;
for (int i = 0; i < cn.getNodes().size(); i++) {
int len = nodeId.length();
nodeId.append(':'); // depends on control dependency: [for], data = [none]
nodeId.append(i); // depends on control dependency: [for], data = [i]
initialiseLinks(ci, fragmentBaseTime, cn.getNodes().get(i), nodeId); // depends on control dependency: [for], data = [i]
// Remove this child's specific path, so that next iteration will add a different path number
nodeId.delete(len, nodeId.length()); // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
public void marshall(GetMediaForFragmentListRequest getMediaForFragmentListRequest, ProtocolMarshaller protocolMarshaller) {
if (getMediaForFragmentListRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getMediaForFragmentListRequest.getStreamName(), STREAMNAME_BINDING);
protocolMarshaller.marshall(getMediaForFragmentListRequest.getFragments(), FRAGMENTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(GetMediaForFragmentListRequest getMediaForFragmentListRequest, ProtocolMarshaller protocolMarshaller) {
if (getMediaForFragmentListRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getMediaForFragmentListRequest.getStreamName(), STREAMNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getMediaForFragmentListRequest.getFragments(), FRAGMENTS_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 JSType getNativeWildcardType() {
if (isAllType) {
return registry.getNativeType(ALL_TYPE);
} else if (isNativeUnknownType) {
if (areAllUnknownsChecked) {
return registry.getNativeType(CHECKED_UNKNOWN_TYPE);
} else {
return registry.getNativeType(UNKNOWN_TYPE);
}
}
return null;
} }
|
public class class_name {
private JSType getNativeWildcardType() {
if (isAllType) {
return registry.getNativeType(ALL_TYPE); // depends on control dependency: [if], data = [none]
} else if (isNativeUnknownType) {
if (areAllUnknownsChecked) {
return registry.getNativeType(CHECKED_UNKNOWN_TYPE); // depends on control dependency: [if], data = [none]
} else {
return registry.getNativeType(UNKNOWN_TYPE); // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public BigMoney multipliedBy(BigDecimal valueToMultiplyBy) {
MoneyUtils.checkNotNull(valueToMultiplyBy, "Multiplier must not be null");
if (valueToMultiplyBy.compareTo(BigDecimal.ONE) == 0) {
return this;
}
BigDecimal newAmount = amount.multiply(valueToMultiplyBy);
return BigMoney.of(currency, newAmount);
} }
|
public class class_name {
public BigMoney multipliedBy(BigDecimal valueToMultiplyBy) {
MoneyUtils.checkNotNull(valueToMultiplyBy, "Multiplier must not be null");
if (valueToMultiplyBy.compareTo(BigDecimal.ONE) == 0) {
return this;
// depends on control dependency: [if], data = [none]
}
BigDecimal newAmount = amount.multiply(valueToMultiplyBy);
return BigMoney.of(currency, newAmount);
} }
|
public class class_name {
public static PeriodType hours() {
PeriodType type = cHours;
if (type == null) {
type = new PeriodType(
"Hours",
new DurationFieldType[] { DurationFieldType.hours() },
new int[] { -1, -1, -1, -1, 0, -1, -1, -1, }
);
cHours = type;
}
return type;
} }
|
public class class_name {
public static PeriodType hours() {
PeriodType type = cHours;
if (type == null) {
type = new PeriodType(
"Hours",
new DurationFieldType[] { DurationFieldType.hours() },
new int[] { -1, -1, -1, -1, 0, -1, -1, -1, }
); // depends on control dependency: [if], data = [none]
cHours = type; // depends on control dependency: [if], data = [none]
}
return type;
} }
|
public class class_name {
public Cluster withNodeIdsToRemove(String... nodeIdsToRemove) {
if (this.nodeIdsToRemove == null) {
setNodeIdsToRemove(new java.util.ArrayList<String>(nodeIdsToRemove.length));
}
for (String ele : nodeIdsToRemove) {
this.nodeIdsToRemove.add(ele);
}
return this;
} }
|
public class class_name {
public Cluster withNodeIdsToRemove(String... nodeIdsToRemove) {
if (this.nodeIdsToRemove == null) {
setNodeIdsToRemove(new java.util.ArrayList<String>(nodeIdsToRemove.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : nodeIdsToRemove) {
this.nodeIdsToRemove.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void addShutdownHookForStoppingContainers(final boolean keepContainer, final boolean removeVolumes, final boolean removeCustomNetworks) {
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
try {
stopStartedContainers(keepContainer, removeVolumes, removeCustomNetworks, null);
} catch (DockerAccessException | ExecException e) {
log.error("Error while stopping containers: %s", e.getMessage());
}
}
});
} }
|
public class class_name {
public void addShutdownHookForStoppingContainers(final boolean keepContainer, final boolean removeVolumes, final boolean removeCustomNetworks) {
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
try {
stopStartedContainers(keepContainer, removeVolumes, removeCustomNetworks, null); // depends on control dependency: [try], data = [none]
} catch (DockerAccessException | ExecException e) {
log.error("Error while stopping containers: %s", e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public int getDurationInYears(XMLGregorianCalendar startDate, XMLGregorianCalendar endDate) {
int startYear = startDate.getYear();
final int dec = 12;
if (startDate.getMonth() == dec) {
// started in December, increase year with one
startYear++;
}
int endYear = endDate.getYear();
return endYear - startYear;
} }
|
public class class_name {
public int getDurationInYears(XMLGregorianCalendar startDate, XMLGregorianCalendar endDate) {
int startYear = startDate.getYear();
final int dec = 12;
if (startDate.getMonth() == dec) {
// started in December, increase year with one
startYear++; // depends on control dependency: [if], data = [none]
}
int endYear = endDate.getYear();
return endYear - startYear;
} }
|
public class class_name {
public int[] convertToArray() {
int[] p = new int[size];
for( int j = 0; j < height; ++j ) {
for( int i = 0; i < width; ++i ) {
p[(j * width) + i] = pixels[i][j];
}
}
return p;
} }
|
public class class_name {
public int[] convertToArray() {
int[] p = new int[size];
for( int j = 0; j < height; ++j ) {
for( int i = 0; i < width; ++i ) {
p[(j * width) + i] = pixels[i][j]; // depends on control dependency: [for], data = [i]
}
}
return p;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.