code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static double d(int[] x1, int[] x2) { int n1 = x1.length; int n2 = x2.length; double[][] table = new double[2][n2 + 1]; table[0][0] = 0; for (int i = 1; i <= n2; i++) { table[0][i] = Double.POSITIVE_INFINITY; } for (int i = 1; i <= n1; i++) { table[1][0] = Double.POSITIVE_INFINITY; for (int j = 1; j <= n2; j++) { double cost = Math.abs(x1[i-1] - x2[j-1]); double min = table[0][j - 1]; if (min > table[0][j]) { min = table[0][j]; } if (min > table[1][j - 1]) { min = table[1][j - 1]; } table[1][j] = cost + min; } double[] swap = table[0]; table[0] = table[1]; table[1] = swap; } return table[0][n2]; } }
public class class_name { public static double d(int[] x1, int[] x2) { int n1 = x1.length; int n2 = x2.length; double[][] table = new double[2][n2 + 1]; table[0][0] = 0; for (int i = 1; i <= n2; i++) { table[0][i] = Double.POSITIVE_INFINITY; // depends on control dependency: [for], data = [i] } for (int i = 1; i <= n1; i++) { table[1][0] = Double.POSITIVE_INFINITY; // depends on control dependency: [for], data = [none] for (int j = 1; j <= n2; j++) { double cost = Math.abs(x1[i-1] - x2[j-1]); double min = table[0][j - 1]; if (min > table[0][j]) { min = table[0][j]; // depends on control dependency: [if], data = [none] } if (min > table[1][j - 1]) { min = table[1][j - 1]; // depends on control dependency: [if], data = [none] } table[1][j] = cost + min; // depends on control dependency: [for], data = [j] } double[] swap = table[0]; table[0] = table[1]; // depends on control dependency: [for], data = [none] table[1] = swap; // depends on control dependency: [for], data = [none] } return table[0][n2]; } }
public class class_name { void checkThrown() throws SSLException { synchronized (thrownLock) { if (thrown != null) { String msg = thrown.getMessage(); if (msg == null) { msg = "Delegated task threw Exception/Error"; } /* * See what the underlying type of exception is. We should * throw the same thing. Chain thrown to the new exception. */ Exception e = thrown; thrown = null; if (e instanceof RuntimeException) { throw (RuntimeException) new RuntimeException(msg).initCause(e); } else if (e instanceof SSLHandshakeException) { throw (SSLHandshakeException) new SSLHandshakeException(msg).initCause(e); } else if (e instanceof SSLKeyException) { throw (SSLKeyException) new SSLKeyException(msg).initCause(e); } else if (e instanceof SSLPeerUnverifiedException) { throw (SSLPeerUnverifiedException) new SSLPeerUnverifiedException(msg).initCause(e); } else if (e instanceof SSLProtocolException) { throw (SSLProtocolException) new SSLProtocolException(msg).initCause(e); } else { /* * If it's SSLException or any other Exception, * we'll wrap it in an SSLException. */ throw (SSLException) new SSLException(msg).initCause(e); } } } } }
public class class_name { void checkThrown() throws SSLException { synchronized (thrownLock) { if (thrown != null) { String msg = thrown.getMessage(); if (msg == null) { msg = "Delegated task threw Exception/Error"; // depends on control dependency: [if], data = [none] } /* * See what the underlying type of exception is. We should * throw the same thing. Chain thrown to the new exception. */ Exception e = thrown; thrown = null; // depends on control dependency: [if], data = [none] if (e instanceof RuntimeException) { throw (RuntimeException) new RuntimeException(msg).initCause(e); } else if (e instanceof SSLHandshakeException) { throw (SSLHandshakeException) new SSLHandshakeException(msg).initCause(e); } else if (e instanceof SSLKeyException) { throw (SSLKeyException) new SSLKeyException(msg).initCause(e); } else if (e instanceof SSLPeerUnverifiedException) { throw (SSLPeerUnverifiedException) new SSLPeerUnverifiedException(msg).initCause(e); } else if (e instanceof SSLProtocolException) { throw (SSLProtocolException) new SSLProtocolException(msg).initCause(e); } else { /* * If it's SSLException or any other Exception, * we'll wrap it in an SSLException. */ throw (SSLException) new SSLException(msg).initCause(e); } } } } }
public class class_name { public void resetNodesLastHeartbeatTime() { long now = ClusterManager.clock.getTime(); for (ClusterNode node : nameToNode.values()) { node.lastHeartbeatTime = now; } } }
public class class_name { public void resetNodesLastHeartbeatTime() { long now = ClusterManager.clock.getTime(); for (ClusterNode node : nameToNode.values()) { node.lastHeartbeatTime = now; // depends on control dependency: [for], data = [node] } } }
public class class_name { public void marshall(CreateNamedQueryRequest createNamedQueryRequest, ProtocolMarshaller protocolMarshaller) { if (createNamedQueryRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createNamedQueryRequest.getName(), NAME_BINDING); protocolMarshaller.marshall(createNamedQueryRequest.getDescription(), DESCRIPTION_BINDING); protocolMarshaller.marshall(createNamedQueryRequest.getDatabase(), DATABASE_BINDING); protocolMarshaller.marshall(createNamedQueryRequest.getQueryString(), QUERYSTRING_BINDING); protocolMarshaller.marshall(createNamedQueryRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING); protocolMarshaller.marshall(createNamedQueryRequest.getWorkGroup(), WORKGROUP_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateNamedQueryRequest createNamedQueryRequest, ProtocolMarshaller protocolMarshaller) { if (createNamedQueryRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createNamedQueryRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createNamedQueryRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createNamedQueryRequest.getDatabase(), DATABASE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createNamedQueryRequest.getQueryString(), QUERYSTRING_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createNamedQueryRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createNamedQueryRequest.getWorkGroup(), WORKGROUP_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void updateButtonBars() { List<I_CmsEditableGroupRow> rows = getRows(); int i = 0; for (I_CmsEditableGroupRow row : rows) { boolean first = i == 0; boolean last = i == (rows.size() - 1); row.getButtonBar().setFirstLast(first, last, m_hideAdd); i += 1; } } }
public class class_name { private void updateButtonBars() { List<I_CmsEditableGroupRow> rows = getRows(); int i = 0; for (I_CmsEditableGroupRow row : rows) { boolean first = i == 0; boolean last = i == (rows.size() - 1); row.getButtonBar().setFirstLast(first, last, m_hideAdd); // depends on control dependency: [for], data = [row] i += 1; // depends on control dependency: [for], data = [none] } } }
public class class_name { @FFDCIgnore(ELException.class) @Trivial protected String processString(String name, String expression, boolean immediateOnly, boolean mask) { final String methodName = "processString"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, methodName, new Object[] { name, (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, immediateOnly, mask }); } String result; boolean immediate = false; try { Object obj = evaluateElExpression(expression, mask); if (obj == null) { throw new IllegalArgumentException("EL expression '" + (mask ? OBFUSCATED_STRING : expression) + "' for '" + name + "'evaluated to null."); } else if (obj instanceof String) { result = (String) obj; immediate = isImmediateExpression(expression, mask); } else { throw new IllegalArgumentException("Expected '" + name + "' to evaluate to a String value."); } } catch (ELException e) { result = expression; immediate = true; } String finalResult = (immediateOnly && !immediate) ? null : result; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, methodName, (finalResult == null) ? null : mask ? OBFUSCATED_STRING : finalResult); } return finalResult; } }
public class class_name { @FFDCIgnore(ELException.class) @Trivial protected String processString(String name, String expression, boolean immediateOnly, boolean mask) { final String methodName = "processString"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, methodName, new Object[] { name, (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, immediateOnly, mask }); // depends on control dependency: [if], data = [none] } String result; boolean immediate = false; try { Object obj = evaluateElExpression(expression, mask); if (obj == null) { throw new IllegalArgumentException("EL expression '" + (mask ? OBFUSCATED_STRING : expression) + "' for '" + name + "'evaluated to null."); } else if (obj instanceof String) { result = (String) obj; // depends on control dependency: [if], data = [none] immediate = isImmediateExpression(expression, mask); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Expected '" + name + "' to evaluate to a String value."); } } catch (ELException e) { result = expression; immediate = true; } // depends on control dependency: [catch], data = [none] String finalResult = (immediateOnly && !immediate) ? null : result; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, methodName, (finalResult == null) ? null : mask ? OBFUSCATED_STRING : finalResult); // depends on control dependency: [if], data = [none] } return finalResult; } }
public class class_name { protected org.cp.elements.util.sort.annotation.Sortable configureComparator(final org.cp.elements.util.sort.annotation.Sortable sortableMetaData) { try { if (isCustomComparatorAllowed()) { Class<? extends Comparator> comparatorClass = sortableMetaData.orderBy(); if (!Comparator.class.equals(comparatorClass)) { ComparatorHolder.set(comparatorClass.newInstance()); } } return sortableMetaData; } catch (Exception e) { throw new SortException(String.format( "Error occurred creating an instance of Comparator class (%1$s) to be used by this Sorter (%2$s)!" + " The Comparator class (%1$s) must have a public no-arg constructor!", sortableMetaData.orderBy().getName(), this.getClass().getName()), e); } } }
public class class_name { protected org.cp.elements.util.sort.annotation.Sortable configureComparator(final org.cp.elements.util.sort.annotation.Sortable sortableMetaData) { try { if (isCustomComparatorAllowed()) { Class<? extends Comparator> comparatorClass = sortableMetaData.orderBy(); if (!Comparator.class.equals(comparatorClass)) { ComparatorHolder.set(comparatorClass.newInstance()); // depends on control dependency: [if], data = [none] } } return sortableMetaData; // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SortException(String.format( "Error occurred creating an instance of Comparator class (%1$s) to be used by this Sorter (%2$s)!" + " The Comparator class (%1$s) must have a public no-arg constructor!", sortableMetaData.orderBy().getName(), this.getClass().getName()), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public EClass getIfcCableCarrierSegment() { if (ifcCableCarrierSegmentEClass == null) { ifcCableCarrierSegmentEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(71); } return ifcCableCarrierSegmentEClass; } }
public class class_name { @Override public EClass getIfcCableCarrierSegment() { if (ifcCableCarrierSegmentEClass == null) { ifcCableCarrierSegmentEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(71); // depends on control dependency: [if], data = [none] } return ifcCableCarrierSegmentEClass; } }
public class class_name { public NotificationResponse cloneIfNotCloned() { try { return isCloned() ? this : (NotificationResponse) this.clone(); } catch (CloneNotSupportedException e) { log.error("Failed to clone() the sourceResponse", e); } return this; } }
public class class_name { public NotificationResponse cloneIfNotCloned() { try { return isCloned() ? this : (NotificationResponse) this.clone(); // depends on control dependency: [try], data = [none] } catch (CloneNotSupportedException e) { log.error("Failed to clone() the sourceResponse", e); } // depends on control dependency: [catch], data = [none] return this; } }
public class class_name { @Override public void clear() { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Clearing this response: " + this); } super.clear(); this.myStatusCode = StatusCodes.OK; this.myReason = null; this.myReasonBytes = null; } }
public class class_name { @Override public void clear() { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Clearing this response: " + this); // depends on control dependency: [if], data = [none] } super.clear(); this.myStatusCode = StatusCodes.OK; this.myReason = null; this.myReasonBytes = null; } }
public class class_name { private boolean lexicalClimb(PageCompilingContext pc, Node node) { if (node.attr(ANNOTATION).length()>1) { // Setup a new lexical scope (symbol table changes on each scope encountered). if (REPEAT_WIDGET.equalsIgnoreCase(node.attr(ANNOTATION_KEY)) || CHOOSE_WIDGET.equalsIgnoreCase(node.attr(ANNOTATION_KEY))) { String[] keyAndContent = {node.attr(ANNOTATION_KEY), node.attr(ANNOTATION_CONTENT)}; pc.lexicalScopes.push(new MvelEvaluatorCompiler(parseRepeatScope(pc, keyAndContent, node))); return true; } // Setup a new lexical scope for compiling against embedded pages (closures). final PageBook.Page embed = pageBook.forName(node.attr(ANNOTATION_KEY)); if (null != embed) { final Class<?> embedClass = embed.pageClass(); MvelEvaluatorCompiler compiler = new MvelEvaluatorCompiler(embedClass); checkEmbedAgainst(pc, compiler, Parsing.toBindMap(node.attr(ANNOTATION_CONTENT)), embedClass, node); pc.lexicalScopes.push(compiler); return true; } } return false; } }
public class class_name { private boolean lexicalClimb(PageCompilingContext pc, Node node) { if (node.attr(ANNOTATION).length()>1) { // Setup a new lexical scope (symbol table changes on each scope encountered). if (REPEAT_WIDGET.equalsIgnoreCase(node.attr(ANNOTATION_KEY)) || CHOOSE_WIDGET.equalsIgnoreCase(node.attr(ANNOTATION_KEY))) { String[] keyAndContent = {node.attr(ANNOTATION_KEY), node.attr(ANNOTATION_CONTENT)}; pc.lexicalScopes.push(new MvelEvaluatorCompiler(parseRepeatScope(pc, keyAndContent, node))); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } // Setup a new lexical scope for compiling against embedded pages (closures). final PageBook.Page embed = pageBook.forName(node.attr(ANNOTATION_KEY)); if (null != embed) { final Class<?> embedClass = embed.pageClass(); MvelEvaluatorCompiler compiler = new MvelEvaluatorCompiler(embedClass); checkEmbedAgainst(pc, compiler, Parsing.toBindMap(node.attr(ANNOTATION_CONTENT)), embedClass, node); pc.lexicalScopes.push(compiler); return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public E poll() { E result = buffer.poll(); if (producer != null) { producer.wakeUp(); } return result; } }
public class class_name { public E poll() { E result = buffer.poll(); if (producer != null) { producer.wakeUp(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { private static boolean isIdentityToString(Object pObject) { try { Method toString = pObject.getClass().getMethod("toString"); if (toString.getDeclaringClass() == Object.class) { return true; } } catch (Exception ignore) { // Ignore } return false; } }
public class class_name { private static boolean isIdentityToString(Object pObject) { try { Method toString = pObject.getClass().getMethod("toString"); if (toString.getDeclaringClass() == Object.class) { return true; // depends on control dependency: [if], data = [none] } } catch (Exception ignore) { // Ignore } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { private ArrayDouble.D3 addStagger(ArrayDouble.D3 array, int dimIndex) { //ADD: assert 0<=dimIndex<=2 int[] shape = array.getShape(); int[] newShape = new int[3]; System.arraycopy(shape, 0, newShape, 0, 3); newShape[dimIndex]++; int ni = newShape[0]; int nj = newShape[1]; int nk = newShape[2]; ArrayDouble.D3 newArray = new ArrayDouble.D3(ni, nj, nk); //Index newIndex = newArray.getIndex(); //extract 1d array to be extended int n = shape[dimIndex]; //length of extracted array double[] d = new double[n]; //tmp array to hold extracted values int[] eshape = new int[3]; //shape of extracted array int[] neweshape = new int[3]; //shape of new array slice to write into for (int i = 0; i < 3; i++) { eshape[i] = (i == dimIndex) ? n : 1; neweshape[i] = (i == dimIndex) ? n + 1 : 1; } int[] origin = new int[3]; try { //loop through the other 2 dimensions and "extrapinterpolate" the other for (int i = 0; i < ((dimIndex == 0) ? 1 : ni); i++) { for (int j = 0; j < ((dimIndex == 1) ? 1 : nj); j++) { for (int k = 0; k < ((dimIndex == 2) ? 1 : nk); k++) { origin[0] = i; origin[1] = j; origin[2] = k; IndexIterator it = array.section(origin, eshape).getIndexIterator(); for (int l = 0; l < n; l++) { d[l] = it.getDoubleNext(); //get the original values } double[] d2 = extrapinterpolate(d); //compute new values //define slice of new array to write into IndexIterator newit = newArray.section(origin, neweshape).getIndexIterator(); for (int l = 0; l < n + 1; l++) { newit.setDoubleNext(d2[l]); } } } } } catch (InvalidRangeException e) { //ADD: report error? return null; } return newArray; } }
public class class_name { private ArrayDouble.D3 addStagger(ArrayDouble.D3 array, int dimIndex) { //ADD: assert 0<=dimIndex<=2 int[] shape = array.getShape(); int[] newShape = new int[3]; System.arraycopy(shape, 0, newShape, 0, 3); newShape[dimIndex]++; int ni = newShape[0]; int nj = newShape[1]; int nk = newShape[2]; ArrayDouble.D3 newArray = new ArrayDouble.D3(ni, nj, nk); //Index newIndex = newArray.getIndex(); //extract 1d array to be extended int n = shape[dimIndex]; //length of extracted array double[] d = new double[n]; //tmp array to hold extracted values int[] eshape = new int[3]; //shape of extracted array int[] neweshape = new int[3]; //shape of new array slice to write into for (int i = 0; i < 3; i++) { eshape[i] = (i == dimIndex) ? n : 1; // depends on control dependency: [for], data = [i] neweshape[i] = (i == dimIndex) ? n + 1 : 1; // depends on control dependency: [for], data = [none] } int[] origin = new int[3]; try { //loop through the other 2 dimensions and "extrapinterpolate" the other for (int i = 0; i < ((dimIndex == 0) ? 1 : ni); i++) { for (int j = 0; j < ((dimIndex == 1) ? 1 : nj); j++) { for (int k = 0; k < ((dimIndex == 2) ? 1 : nk); k++) { origin[0] = i; // depends on control dependency: [for], data = [none] origin[1] = j; // depends on control dependency: [for], data = [none] origin[2] = k; // depends on control dependency: [for], data = [k] IndexIterator it = array.section(origin, eshape).getIndexIterator(); for (int l = 0; l < n; l++) { d[l] = it.getDoubleNext(); //get the original values // depends on control dependency: [for], data = [l] } double[] d2 = extrapinterpolate(d); //compute new values //define slice of new array to write into IndexIterator newit = newArray.section(origin, neweshape).getIndexIterator(); for (int l = 0; l < n + 1; l++) { newit.setDoubleNext(d2[l]); // depends on control dependency: [for], data = [l] } } } } } catch (InvalidRangeException e) { //ADD: report error? return null; } // depends on control dependency: [catch], data = [none] return newArray; } }
public class class_name { public double calcError(final Frame ftest, final Vec vactual, final Frame fpreds, final Frame hitratio_fpreds, final String label, final boolean printMe, final int max_conf_mat_size, final water.api.ConfusionMatrix cm, final AUC auc, final HitRatio hr) { StringBuilder sb = new StringBuilder(); double error = Double.POSITIVE_INFINITY; // populate AUC if (auc != null) { assert(isClassifier()); assert(nclasses() == 2); auc.actual = ftest; auc.vactual = vactual; auc.predict = fpreds; auc.vpredict = fpreds.vecs()[2]; //binary classifier (label, prob0, prob1 (THIS ONE), adaptedlabel) auc.invoke(); auc.toASCII(sb); error = auc.data().err(); //using optimal threshold for F1 } // populate CM if (cm != null) { cm.actual = ftest; cm.vactual = vactual; cm.predict = fpreds; cm.vpredict = fpreds.vecs()[0]; // prediction (either label or regression target) cm.invoke(); if (isClassifier()) { if (auc != null) { AUCData aucd = auc.data(); //override the CM with the one computed by AUC (using optimal threshold) //Note: must still call invoke above to set the domains etc. cm.cm = new long[3][3]; // 1 extra layer for NaNs (not populated here, since AUC skips them) cm.cm[0][0] = aucd.cm()[0][0]; cm.cm[1][0] = aucd.cm()[1][0]; cm.cm[0][1] = aucd.cm()[0][1]; cm.cm[1][1] = aucd.cm()[1][1]; double cm_err = new hex.ConfusionMatrix(cm.cm).err(); double auc_err = aucd.err(); if (! (Double.isNaN(cm_err) && Double.isNaN(auc_err))) // NOTE: NaN != NaN assert(cm_err == auc_err); //check consistency with AUC-computed error } else { error = new hex.ConfusionMatrix(cm.cm).err(); //only set error if AUC didn't already set the error } if (cm.cm.length <= max_conf_mat_size+1) cm.toASCII(sb); } else { assert(auc == null); error = cm.mse; cm.toASCII(sb); } } // populate HitRatio if (hr != null) { assert(isClassifier()); hr.actual = ftest; hr.vactual = vactual; hr.predict = hitratio_fpreds; hr.invoke(); hr.toASCII(sb); } if (printMe && sb.length() > 0) { Log.info("Scoring on " + label + " data:"); for (String s : sb.toString().split("\n")) Log.info(s); } return error; } }
public class class_name { public double calcError(final Frame ftest, final Vec vactual, final Frame fpreds, final Frame hitratio_fpreds, final String label, final boolean printMe, final int max_conf_mat_size, final water.api.ConfusionMatrix cm, final AUC auc, final HitRatio hr) { StringBuilder sb = new StringBuilder(); double error = Double.POSITIVE_INFINITY; // populate AUC if (auc != null) { assert(isClassifier()); // depends on control dependency: [if], data = [none] assert(nclasses() == 2); // depends on control dependency: [if], data = [none] auc.actual = ftest; // depends on control dependency: [if], data = [none] auc.vactual = vactual; // depends on control dependency: [if], data = [none] auc.predict = fpreds; // depends on control dependency: [if], data = [none] auc.vpredict = fpreds.vecs()[2]; //binary classifier (label, prob0, prob1 (THIS ONE), adaptedlabel) // depends on control dependency: [if], data = [none] auc.invoke(); // depends on control dependency: [if], data = [none] auc.toASCII(sb); // depends on control dependency: [if], data = [none] error = auc.data().err(); //using optimal threshold for F1 // depends on control dependency: [if], data = [none] } // populate CM if (cm != null) { cm.actual = ftest; // depends on control dependency: [if], data = [none] cm.vactual = vactual; // depends on control dependency: [if], data = [none] cm.predict = fpreds; // depends on control dependency: [if], data = [none] cm.vpredict = fpreds.vecs()[0]; // prediction (either label or regression target) // depends on control dependency: [if], data = [none] cm.invoke(); // depends on control dependency: [if], data = [none] if (isClassifier()) { if (auc != null) { AUCData aucd = auc.data(); //override the CM with the one computed by AUC (using optimal threshold) //Note: must still call invoke above to set the domains etc. cm.cm = new long[3][3]; // 1 extra layer for NaNs (not populated here, since AUC skips them) // depends on control dependency: [if], data = [none] cm.cm[0][0] = aucd.cm()[0][0]; // depends on control dependency: [if], data = [none] cm.cm[1][0] = aucd.cm()[1][0]; // depends on control dependency: [if], data = [none] cm.cm[0][1] = aucd.cm()[0][1]; // depends on control dependency: [if], data = [none] cm.cm[1][1] = aucd.cm()[1][1]; // depends on control dependency: [if], data = [none] double cm_err = new hex.ConfusionMatrix(cm.cm).err(); double auc_err = aucd.err(); if (! (Double.isNaN(cm_err) && Double.isNaN(auc_err))) // NOTE: NaN != NaN assert(cm_err == auc_err); //check consistency with AUC-computed error } else { error = new hex.ConfusionMatrix(cm.cm).err(); //only set error if AUC didn't already set the error // depends on control dependency: [if], data = [none] } if (cm.cm.length <= max_conf_mat_size+1) cm.toASCII(sb); } else { assert(auc == null); // depends on control dependency: [if], data = [none] error = cm.mse; // depends on control dependency: [if], data = [none] cm.toASCII(sb); // depends on control dependency: [if], data = [none] } } // populate HitRatio if (hr != null) { assert(isClassifier()); // depends on control dependency: [if], data = [none] hr.actual = ftest; // depends on control dependency: [if], data = [none] hr.vactual = vactual; // depends on control dependency: [if], data = [none] hr.predict = hitratio_fpreds; // depends on control dependency: [if], data = [none] hr.invoke(); // depends on control dependency: [if], data = [none] hr.toASCII(sb); // depends on control dependency: [if], data = [none] } if (printMe && sb.length() > 0) { Log.info("Scoring on " + label + " data:"); // depends on control dependency: [if], data = [none] for (String s : sb.toString().split("\n")) Log.info(s); } return error; } }
public class class_name { @Deprecated public static ResultSet query(String sql, Object... args) { ResultSet result = null; Connection con = getconnnection(); PreparedStatement ps = null; try { ps = con.prepareStatement(sql); if (args != null) { for (int i = 0; i < args.length; i++) { ps.setObject((i + 1), args[i]); } } result = ps.executeQuery(); } catch (SQLException e) { e.printStackTrace(); } return result; } }
public class class_name { @Deprecated public static ResultSet query(String sql, Object... args) { ResultSet result = null; Connection con = getconnnection(); PreparedStatement ps = null; try { ps = con.prepareStatement(sql); // depends on control dependency: [try], data = [none] if (args != null) { for (int i = 0; i < args.length; i++) { ps.setObject((i + 1), args[i]); // depends on control dependency: [for], data = [i] } } result = ps.executeQuery(); // depends on control dependency: [try], data = [none] } catch (SQLException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] return result; } }
public class class_name { public InputStream[] getInputStreams(String name) { List parts = (List)_partMap.getValues(name); if (parts==null) return null; InputStream[] streams = new InputStream[parts.size()]; for (int i=0; i<streams.length; i++) { streams[i] = new ByteArrayInputStream(((Part)parts.get(i))._data); } return streams; } }
public class class_name { public InputStream[] getInputStreams(String name) { List parts = (List)_partMap.getValues(name); if (parts==null) return null; InputStream[] streams = new InputStream[parts.size()]; for (int i=0; i<streams.length; i++) { streams[i] = new ByteArrayInputStream(((Part)parts.get(i))._data); // depends on control dependency: [for], data = [i] } return streams; } }
public class class_name { @SuppressWarnings({ "rawtypes" }) protected ISFSArray parseArrayObjectCollection(GetterMethodCover method, Collection collection) { ISFSArray result = new SFSArray(); for(Object obj : collection) { result.addSFSArray(parseObjectArray( method, (Object[])obj)); } return result; } }
public class class_name { @SuppressWarnings({ "rawtypes" }) protected ISFSArray parseArrayObjectCollection(GetterMethodCover method, Collection collection) { ISFSArray result = new SFSArray(); for(Object obj : collection) { result.addSFSArray(parseObjectArray( method, (Object[])obj)); // depends on control dependency: [for], data = [none] } return result; } }
public class class_name { public TaskResponse run(Task k, TaskRequest req, TaskResponse res) { // Assertions. if (k == null) { String msg = "Argument 'k [Task]' cannot be null."; throw new IllegalArgumentException(msg); } if (req == null) { String msg = "Argument 'req' cannot be null."; throw new IllegalArgumentException(msg); } // Set up Attributes.ORIGIN if possible... RuntimeRequestResponse tr = new RuntimeRequestResponse(); tr.enclose(req); if (k instanceof TaskDecorator) { String origin = ((TaskDecorator) k).getOrigin(); tr.setAttribute(Attributes.ORIGIN, origin); } // Provide a warning if there's no Attributes.ORIGIN at this point... if (!tr.hasAttribute(Attributes.ORIGIN)) { log.warn("Request attribute 'Attributes.ORIGIN' is not present. " + "Cernunnos may not be able to access resources relative " + "to the script."); } // Set up Attributes.CACHE if not already provided... if (!tr.hasAttribute(Attributes.CACHE)) { tr.setAttribute(Attributes.CACHE, new ConcurrentHashMap<Object, Object>()); } // Write the initial contents of the TaskRequest to the logs... if (log.isInfoEnabled()) { StringBuffer msg = new StringBuffer(); msg.append("\n"); msg.append("**************************************************\n"); msg.append("** Invoking ScriptRunner.run(Task, TaskRequest)\n"); msg.append("** TaskRequest contains ").append(tr.getAttributeNames().size()).append(" elements\n"); for (String name : tr.getSortedAttributeNames()) { msg.append("** - ").append(name).append("=").append(String.valueOf(tr.getAttribute(name))).append("\n"); } msg.append("**************************************************\n"); log.info(msg.toString()); } // Invoke the task... k.perform(tr, res); return res; } }
public class class_name { public TaskResponse run(Task k, TaskRequest req, TaskResponse res) { // Assertions. if (k == null) { String msg = "Argument 'k [Task]' cannot be null."; throw new IllegalArgumentException(msg); } if (req == null) { String msg = "Argument 'req' cannot be null."; throw new IllegalArgumentException(msg); } // Set up Attributes.ORIGIN if possible... RuntimeRequestResponse tr = new RuntimeRequestResponse(); tr.enclose(req); if (k instanceof TaskDecorator) { String origin = ((TaskDecorator) k).getOrigin(); tr.setAttribute(Attributes.ORIGIN, origin); // depends on control dependency: [if], data = [none] } // Provide a warning if there's no Attributes.ORIGIN at this point... if (!tr.hasAttribute(Attributes.ORIGIN)) { log.warn("Request attribute 'Attributes.ORIGIN' is not present. " + "Cernunnos may not be able to access resources relative " + "to the script."); // depends on control dependency: [if], data = [none] } // Set up Attributes.CACHE if not already provided... if (!tr.hasAttribute(Attributes.CACHE)) { tr.setAttribute(Attributes.CACHE, new ConcurrentHashMap<Object, Object>()); // depends on control dependency: [if], data = [none] } // Write the initial contents of the TaskRequest to the logs... if (log.isInfoEnabled()) { StringBuffer msg = new StringBuffer(); msg.append("\n"); // depends on control dependency: [if], data = [none] msg.append("**************************************************\n"); // depends on control dependency: [if], data = [none] msg.append("** Invoking ScriptRunner.run(Task, TaskRequest)\n"); // depends on control dependency: [if], data = [none] msg.append("** TaskRequest contains ").append(tr.getAttributeNames().size()).append(" elements\n"); // depends on control dependency: [if], data = [none] for (String name : tr.getSortedAttributeNames()) { msg.append("** - ").append(name).append("=").append(String.valueOf(tr.getAttribute(name))).append("\n"); // depends on control dependency: [for], data = [name] } msg.append("**************************************************\n"); // depends on control dependency: [if], data = [none] log.info(msg.toString()); // depends on control dependency: [if], data = [none] } // Invoke the task... k.perform(tr, res); return res; } }
public class class_name { public int compareTo(ReadablePartial partial) { // override to perform faster if (this == partial) { return 0; } if (partial instanceof LocalDateTime) { LocalDateTime other = (LocalDateTime) partial; if (iChronology.equals(other.iChronology)) { return (iLocalMillis < other.iLocalMillis ? -1 : (iLocalMillis == other.iLocalMillis ? 0 : 1)); } } return super.compareTo(partial); } }
public class class_name { public int compareTo(ReadablePartial partial) { // override to perform faster if (this == partial) { return 0; // depends on control dependency: [if], data = [none] } if (partial instanceof LocalDateTime) { LocalDateTime other = (LocalDateTime) partial; if (iChronology.equals(other.iChronology)) { return (iLocalMillis < other.iLocalMillis ? -1 : (iLocalMillis == other.iLocalMillis ? 0 : 1)); // depends on control dependency: [if], data = [none] } } return super.compareTo(partial); } }
public class class_name { public static void deleteQueue(String queueURL) { if (!StringUtils.isBlank(queueURL)) { try { getClient().deleteQueue(new DeleteQueueRequest(queueURL)); } catch (AmazonServiceException ase) { logException(ase); } catch (AmazonClientException ace) { logger.error("Could not reach SQS. {0}", ace.toString()); } } } }
public class class_name { public static void deleteQueue(String queueURL) { if (!StringUtils.isBlank(queueURL)) { try { getClient().deleteQueue(new DeleteQueueRequest(queueURL)); // depends on control dependency: [try], data = [none] } catch (AmazonServiceException ase) { logException(ase); } catch (AmazonClientException ace) { // depends on control dependency: [catch], data = [none] logger.error("Could not reach SQS. {0}", ace.toString()); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static final void registerNodeDataInstance( Class<? extends NodeData> clazz) { try { @SuppressWarnings("unused") NodeData test = clazz.newInstance(); ndImpl = clazz; } catch (InstantiationException e) { throw new RuntimeException("NodeData implemenation (" + clazz.getName() + ") doesn't provide sole constructor", e); } catch (IllegalAccessException e) { throw new RuntimeException("NodeData implementation (" + clazz.getName() + ") is not accesible", e); } } }
public class class_name { public static final void registerNodeDataInstance( Class<? extends NodeData> clazz) { try { @SuppressWarnings("unused") NodeData test = clazz.newInstance(); ndImpl = clazz; // depends on control dependency: [try], data = [none] } catch (InstantiationException e) { throw new RuntimeException("NodeData implemenation (" + clazz.getName() + ") doesn't provide sole constructor", e); } catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none] throw new RuntimeException("NodeData implementation (" + clazz.getName() + ") is not accesible", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public EClass getIfcSurfaceReinforcementArea() { if (ifcSurfaceReinforcementAreaEClass == null) { ifcSurfaceReinforcementAreaEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(677); } return ifcSurfaceReinforcementAreaEClass; } }
public class class_name { @Override public EClass getIfcSurfaceReinforcementArea() { if (ifcSurfaceReinforcementAreaEClass == null) { ifcSurfaceReinforcementAreaEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(677); // depends on control dependency: [if], data = [none] } return ifcSurfaceReinforcementAreaEClass; } }
public class class_name { public List<?> convert(CamelContext camelContext, List<?> values, Class[] targetTypes) { LOG.debug("About to convert those arguments: {}", values); List<Object> convertedArguments = new ArrayList<>(values.size()); for (int i = 0; i < values.size(); i++) { try { convertedArguments.add(camelContext.getTypeConverter().mandatoryConvertTo(targetTypes[i], values.get(i))); } catch (NoTypeConversionAvailableException e) { LOG.debug("Failed to convert {} to type {}. Falling back to Jackson conversion.", values.get(i), targetTypes[i]); convertedArguments.add(objectMapper.convertValue(values.get(i), targetTypes[i])); } } LOG.debug("Converted arguments: {}", convertedArguments); return convertedArguments; } }
public class class_name { public List<?> convert(CamelContext camelContext, List<?> values, Class[] targetTypes) { LOG.debug("About to convert those arguments: {}", values); List<Object> convertedArguments = new ArrayList<>(values.size()); for (int i = 0; i < values.size(); i++) { try { convertedArguments.add(camelContext.getTypeConverter().mandatoryConvertTo(targetTypes[i], values.get(i))); // depends on control dependency: [try], data = [none] } catch (NoTypeConversionAvailableException e) { LOG.debug("Failed to convert {} to type {}. Falling back to Jackson conversion.", values.get(i), targetTypes[i]); convertedArguments.add(objectMapper.convertValue(values.get(i), targetTypes[i])); } // depends on control dependency: [catch], data = [none] } LOG.debug("Converted arguments: {}", convertedArguments); return convertedArguments; } }
public class class_name { @Deprecated public char next() { if (nextChar == Normalizer.DONE) { findNextChar(); } curChar = nextChar; nextChar = Normalizer.DONE; return (char) curChar; } }
public class class_name { @Deprecated public char next() { if (nextChar == Normalizer.DONE) { findNextChar(); // depends on control dependency: [if], data = [none] } curChar = nextChar; nextChar = Normalizer.DONE; return (char) curChar; } }
public class class_name { public static Boolean exists( EvaluationContext ctx, Object tests, Object target) { if (!(tests instanceof List)) { if (tests == null) { ctx.notifyEvt(() -> new ASTEventBase(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.IS_NULL, "value"), null)); return null; } return applyUnaryTest(ctx, tests, target); } for (Object test : (List) tests) { Boolean r = applyUnaryTest(ctx, test, target); if (Boolean.TRUE.equals(r)) { return true; } } return false; } }
public class class_name { public static Boolean exists( EvaluationContext ctx, Object tests, Object target) { if (!(tests instanceof List)) { if (tests == null) { ctx.notifyEvt(() -> new ASTEventBase(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.IS_NULL, "value"), null)); // depends on control dependency: [if], data = [null)] return null; // depends on control dependency: [if], data = [none] } return applyUnaryTest(ctx, tests, target); // depends on control dependency: [if], data = [none] } for (Object test : (List) tests) { Boolean r = applyUnaryTest(ctx, test, target); if (Boolean.TRUE.equals(r)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { @Override protected UserPrincipal loadUserInfo(String userName) { UserIdentity id = _userStore.getUserIdentity(userName); if (id != null) { return (UserPrincipal)id.getUserPrincipal(); } return null; } }
public class class_name { @Override protected UserPrincipal loadUserInfo(String userName) { UserIdentity id = _userStore.getUserIdentity(userName); if (id != null) { return (UserPrincipal)id.getUserPrincipal(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public boolean expireAttribute(final String identifier, final String attribute, final long expirationTime) { if (identifier == null) { log.error("Unable to expire an attribute with a null Identifier value."); return false; } if (attribute == null) { log.error("Unable to expire a null attribute."); return false; } if (this.originString == null) { log.error("Origin has not been set. Cannot expire attributes without a valid origin."); return false; } ExpireAttributeMessage message = new ExpireAttributeMessage(); message.setId(identifier); message.setAttributeName(attribute); message.setExpirationTime(expirationTime); message.setOrigin(this.originString); this.session.write(message); log.debug("Sent {}", message); return true; } }
public class class_name { public boolean expireAttribute(final String identifier, final String attribute, final long expirationTime) { if (identifier == null) { log.error("Unable to expire an attribute with a null Identifier value."); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } if (attribute == null) { log.error("Unable to expire a null attribute."); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } if (this.originString == null) { log.error("Origin has not been set. Cannot expire attributes without a valid origin."); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } ExpireAttributeMessage message = new ExpireAttributeMessage(); message.setId(identifier); message.setAttributeName(attribute); message.setExpirationTime(expirationTime); message.setOrigin(this.originString); this.session.write(message); log.debug("Sent {}", message); return true; } }
public class class_name { public int getAllCookies(List<HttpCookie> list) { int added = 0; if (0 < this.parsedList.size()) { for (HttpCookie cookie : this.parsedList) { list.add(cookie.clone()); added++; } } return added; } }
public class class_name { public int getAllCookies(List<HttpCookie> list) { int added = 0; if (0 < this.parsedList.size()) { for (HttpCookie cookie : this.parsedList) { list.add(cookie.clone()); // depends on control dependency: [for], data = [cookie] added++; // depends on control dependency: [for], data = [none] } } return added; } }
public class class_name { @Override public void initialize() throws XMPPException { LOGGER.fine("Initialized"); if (!isResolving() && !isResolved()) { // Get the best STUN server available if (currentServer.isNull()) { loadSTUNServers(); } // We should have a valid STUN server by now... if (!currentServer.isNull()) { clearCandidates(); resolverThread = new Thread(new Runnable() { @Override public void run() { // Iterate through the list of interfaces, and ask // to the STUN server for our address. try { Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); String candAddress; int candPort; while (ifaces.hasMoreElements()) { NetworkInterface iface = ifaces.nextElement(); Enumeration<InetAddress> iaddresses = iface.getInetAddresses(); while (iaddresses.hasMoreElements()) { InetAddress iaddress = iaddresses.nextElement(); if (!iaddress.isLoopbackAddress() && !iaddress.isLinkLocalAddress()) { // Reset the candidate candAddress = null; candPort = -1; DiscoveryTest test = new DiscoveryTest(iaddress, currentServer.getHostname(), currentServer.getPort()); try { // Run the tests and get the // discovery // information, where all the // info is stored... DiscoveryInfo di = test.test(); candAddress = di.getPublicIP() != null ? di.getPublicIP().getHostAddress() : null; // Get a valid port if (defaultPort == 0) { candPort = getFreePort(); } else { candPort = defaultPort; } // If we have a valid candidate, // add it to the list. if (candAddress != null && candPort >= 0) { TransportCandidate candidate = new TransportCandidate.Fixed( candAddress, candPort); candidate.setLocalIp(iaddress.getHostAddress() != null ? iaddress.getHostAddress() : iaddress.getHostName()); addCandidate(candidate); resolvedPublicIP = candidate.getIp(); resolvedLocalIP = candidate.getLocalIp(); return; } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Exception", e); } } } } } catch (SocketException e) { LOGGER.log(Level.SEVERE, "Exception", e); } finally { setInitialized(); } } }, "Waiting for all the transport candidates checks..."); resolverThread.setName("STUN resolver"); resolverThread.start(); } else { throw new IllegalStateException("No valid STUN server found."); } } } }
public class class_name { @Override public void initialize() throws XMPPException { LOGGER.fine("Initialized"); if (!isResolving() && !isResolved()) { // Get the best STUN server available if (currentServer.isNull()) { loadSTUNServers(); // depends on control dependency: [if], data = [none] } // We should have a valid STUN server by now... if (!currentServer.isNull()) { clearCandidates(); // depends on control dependency: [if], data = [none] resolverThread = new Thread(new Runnable() { @Override public void run() { // Iterate through the list of interfaces, and ask // to the STUN server for our address. try { Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); String candAddress; int candPort; while (ifaces.hasMoreElements()) { NetworkInterface iface = ifaces.nextElement(); Enumeration<InetAddress> iaddresses = iface.getInetAddresses(); while (iaddresses.hasMoreElements()) { InetAddress iaddress = iaddresses.nextElement(); if (!iaddress.isLoopbackAddress() && !iaddress.isLinkLocalAddress()) { // Reset the candidate candAddress = null; // depends on control dependency: [if], data = [none] candPort = -1; // depends on control dependency: [if], data = [none] DiscoveryTest test = new DiscoveryTest(iaddress, currentServer.getHostname(), currentServer.getPort()); try { // Run the tests and get the // discovery // information, where all the // info is stored... DiscoveryInfo di = test.test(); candAddress = di.getPublicIP() != null ? di.getPublicIP().getHostAddress() : null; // depends on control dependency: [try], data = [none] // Get a valid port if (defaultPort == 0) { candPort = getFreePort(); // depends on control dependency: [if], data = [none] } else { candPort = defaultPort; // depends on control dependency: [if], data = [none] } // If we have a valid candidate, // add it to the list. if (candAddress != null && candPort >= 0) { TransportCandidate candidate = new TransportCandidate.Fixed( candAddress, candPort); candidate.setLocalIp(iaddress.getHostAddress() != null ? iaddress.getHostAddress() : iaddress.getHostName()); // depends on control dependency: [if], data = [none] addCandidate(candidate); // depends on control dependency: [if], data = [none] resolvedPublicIP = candidate.getIp(); // depends on control dependency: [if], data = [none] resolvedLocalIP = candidate.getLocalIp(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Exception", e); } // depends on control dependency: [catch], data = [none] } } } } catch (SocketException e) { LOGGER.log(Level.SEVERE, "Exception", e); } // depends on control dependency: [catch], data = [none] finally { setInitialized(); } } }, "Waiting for all the transport candidates checks..."); // depends on control dependency: [if], data = [none] resolverThread.setName("STUN resolver"); // depends on control dependency: [if], data = [none] resolverThread.start(); // depends on control dependency: [if], data = [none] } else { throw new IllegalStateException("No valid STUN server found."); } } } }
public class class_name { public static boolean isPredecessor(KeyValue kv) { if (Bytes.equals(kv.getFamily(), PRED_COLUMN_FAMILY)) { return true; } return false; } }
public class class_name { public static boolean isPredecessor(KeyValue kv) { if (Bytes.equals(kv.getFamily(), PRED_COLUMN_FAMILY)) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void build(Set<Bean<?>> beans) { if (isBuilt()) { throw new IllegalStateException("BeanIdentifier index is already built!"); } if (beans.isEmpty()) { index = new BeanIdentifier[0]; reverseIndex = Collections.emptyMap(); indexHash = 0; indexBuilt.set(true); return; } List<BeanIdentifier> tempIndex = new ArrayList<BeanIdentifier>(beans.size()); for (Bean<?> bean : beans) { if (bean instanceof CommonBean<?>) { tempIndex.add(((CommonBean<?>) bean).getIdentifier()); } else if (bean instanceof PassivationCapable) { tempIndex.add(new StringBeanIdentifier(((PassivationCapable) bean).getId())); } } Collections.sort(tempIndex, new Comparator<BeanIdentifier>() { @Override public int compare(BeanIdentifier o1, BeanIdentifier o2) { return o1.asString().compareTo(o2.asString()); } }); index = tempIndex.toArray(new BeanIdentifier[tempIndex.size()]); ImmutableMap.Builder<BeanIdentifier, Integer> builder = ImmutableMap.builder(); for (int i = 0; i < index.length; i++) { builder.put(index[i], i); } reverseIndex = builder.build(); indexHash = Arrays.hashCode(index); if(BootstrapLogger.LOG.isDebugEnabled()) { BootstrapLogger.LOG.beanIdentifierIndexBuilt(getDebugInfo()); } indexBuilt.set(true); } }
public class class_name { public void build(Set<Bean<?>> beans) { if (isBuilt()) { throw new IllegalStateException("BeanIdentifier index is already built!"); } if (beans.isEmpty()) { index = new BeanIdentifier[0]; reverseIndex = Collections.emptyMap(); indexHash = 0; indexBuilt.set(true); return; } List<BeanIdentifier> tempIndex = new ArrayList<BeanIdentifier>(beans.size()); for (Bean<?> bean : beans) { if (bean instanceof CommonBean<?>) { tempIndex.add(((CommonBean<?>) bean).getIdentifier()); // depends on control dependency: [if], data = [)] } else if (bean instanceof PassivationCapable) { tempIndex.add(new StringBeanIdentifier(((PassivationCapable) bean).getId())); // depends on control dependency: [if], data = [none] } } Collections.sort(tempIndex, new Comparator<BeanIdentifier>() { @Override public int compare(BeanIdentifier o1, BeanIdentifier o2) { return o1.asString().compareTo(o2.asString()); } }); index = tempIndex.toArray(new BeanIdentifier[tempIndex.size()]); ImmutableMap.Builder<BeanIdentifier, Integer> builder = ImmutableMap.builder(); for (int i = 0; i < index.length; i++) { builder.put(index[i], i); } reverseIndex = builder.build(); indexHash = Arrays.hashCode(index); if(BootstrapLogger.LOG.isDebugEnabled()) { BootstrapLogger.LOG.beanIdentifierIndexBuilt(getDebugInfo()); } indexBuilt.set(true); } }
public class class_name { public T peek() { if (peekedItem == null) { try { peekedItem = SerializableValue.of(getMarshaller(), super.next()); } catch (NoSuchElementException e) { // ignore. } catch (IOException e) { throw new RuntimeException("Failed to read next input", e); } } return peekedItem == null ? null : peekedItem.getValue(); } }
public class class_name { public T peek() { if (peekedItem == null) { try { peekedItem = SerializableValue.of(getMarshaller(), super.next()); // depends on control dependency: [try], data = [none] } catch (NoSuchElementException e) { // ignore. } catch (IOException e) { // depends on control dependency: [catch], data = [none] throw new RuntimeException("Failed to read next input", e); } // depends on control dependency: [catch], data = [none] } return peekedItem == null ? null : peekedItem.getValue(); } }
public class class_name { @Override public int predict(double[] x) { double minDist = Double.MAX_VALUE; int bestCluster = 0; int i = 0; for (Node neuron : nodes) { double dist = Math.squaredDistance(x, neuron.w); if (dist < minDist) { minDist = dist; bestCluster = i; } i++; } if (y == null || y.length != nodes.size()) { return bestCluster; } else { return y[bestCluster]; } } }
public class class_name { @Override public int predict(double[] x) { double minDist = Double.MAX_VALUE; int bestCluster = 0; int i = 0; for (Node neuron : nodes) { double dist = Math.squaredDistance(x, neuron.w); if (dist < minDist) { minDist = dist; // depends on control dependency: [if], data = [none] bestCluster = i; // depends on control dependency: [if], data = [none] } i++; // depends on control dependency: [for], data = [none] } if (y == null || y.length != nodes.size()) { return bestCluster; // depends on control dependency: [if], data = [none] } else { return y[bestCluster]; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (AbstractDataSource.this.options.databaseLifecycleHandler != null) { AbstractDataSource.this.options.databaseLifecycleHandler.onUpdate(db, oldVersion, newVersion, false); versionChanged = true; } } }
public class class_name { public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (AbstractDataSource.this.options.databaseLifecycleHandler != null) { AbstractDataSource.this.options.databaseLifecycleHandler.onUpdate(db, oldVersion, newVersion, false); // depends on control dependency: [if], data = [none] versionChanged = true; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void createdModule( String name, String niceName, String group, String actionClass, String importScript, String importSite, String site, String exportModeName, String description, String version, String authorName, String authorEmail, String dateCreated, String userInstalled, String dateInstalled) { String moduleName; if (!CmsStringUtil.isValidJavaClassName(name)) { // ensure backward compatibility with old (5.0) module names LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_MOD_NAME_IMPORTED_1, name)); moduleName = makeValidJavaClassName(name); LOG.error(Messages.get().getBundle().key(Messages.LOG_CORRECTED_MOD_NAME_1, moduleName)); } else { moduleName = name; } // parse the module version CmsModuleVersion moduleVersion = new CmsModuleVersion(version); // parse date created long moduleDateCreated = CmsModule.DEFAULT_DATE; if (dateCreated != null) { try { moduleDateCreated = CmsDateUtil.parseHeaderDate(dateCreated); } catch (ParseException e) { // noop } } // parse date installed long moduleDateInstalled = CmsModule.DEFAULT_DATE; if (dateInstalled != null) { try { moduleDateInstalled = CmsDateUtil.parseHeaderDate(dateInstalled); } catch (ParseException e1) { // noop } } if (m_oldModule) { // make sure module path is added to resources for "old" (5.0.x) modules String modulePath = CmsWorkplace.VFS_PATH_MODULES + name + "/"; m_resources.add(modulePath); } ExportMode exportMode = ExportMode.DEFAULT; try { if (!CmsStringUtil.isEmptyOrWhitespaceOnly(exportModeName)) { exportMode = ExportMode.valueOf(exportModeName.toUpperCase()); } } catch (IllegalArgumentException e) { LOG.warn(e.getLocalizedMessage(), e); //stay with default export mode } String siteForConstructor; boolean isImportSite; if (importSite != null) { siteForConstructor = importSite; isImportSite = true; } else { siteForConstructor = site; isImportSite = false; } // now create the module m_module = new CmsModule( moduleName, niceName, group, actionClass, importScript, siteForConstructor, isImportSite, exportMode, description, moduleVersion, authorName, authorEmail, moduleDateCreated, userInstalled, moduleDateInstalled, m_dependencies, m_exportPoints, m_resources, m_excluderesources, m_parameters); // store module name in the additional resource types List<I_CmsResourceType> moduleResourceTypes = new ArrayList<I_CmsResourceType>(m_resourceTypes.size()); for (Iterator<I_CmsResourceType> i = m_resourceTypes.iterator(); i.hasNext();) { I_CmsResourceType resType = i.next(); resType.setModuleName(moduleName); moduleResourceTypes.add(resType); } // set the additional resource types; m_module.setResourceTypes(moduleResourceTypes); // set the additional explorer types m_module.setExplorerTypes(m_explorerTypeSettings); m_module.setAutoIncrement(m_autoIncrement); m_module.setCheckpointTime(m_checkpointTime); } }
public class class_name { public void createdModule( String name, String niceName, String group, String actionClass, String importScript, String importSite, String site, String exportModeName, String description, String version, String authorName, String authorEmail, String dateCreated, String userInstalled, String dateInstalled) { String moduleName; if (!CmsStringUtil.isValidJavaClassName(name)) { // ensure backward compatibility with old (5.0) module names LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_MOD_NAME_IMPORTED_1, name)); // depends on control dependency: [if], data = [none] moduleName = makeValidJavaClassName(name); // depends on control dependency: [if], data = [none] LOG.error(Messages.get().getBundle().key(Messages.LOG_CORRECTED_MOD_NAME_1, moduleName)); // depends on control dependency: [if], data = [none] } else { moduleName = name; // depends on control dependency: [if], data = [none] } // parse the module version CmsModuleVersion moduleVersion = new CmsModuleVersion(version); // parse date created long moduleDateCreated = CmsModule.DEFAULT_DATE; if (dateCreated != null) { try { moduleDateCreated = CmsDateUtil.parseHeaderDate(dateCreated); // depends on control dependency: [try], data = [none] } catch (ParseException e) { // noop } // depends on control dependency: [catch], data = [none] } // parse date installed long moduleDateInstalled = CmsModule.DEFAULT_DATE; if (dateInstalled != null) { try { moduleDateInstalled = CmsDateUtil.parseHeaderDate(dateInstalled); // depends on control dependency: [try], data = [none] } catch (ParseException e1) { // noop } // depends on control dependency: [catch], data = [none] } if (m_oldModule) { // make sure module path is added to resources for "old" (5.0.x) modules String modulePath = CmsWorkplace.VFS_PATH_MODULES + name + "/"; m_resources.add(modulePath); // depends on control dependency: [if], data = [none] } ExportMode exportMode = ExportMode.DEFAULT; try { if (!CmsStringUtil.isEmptyOrWhitespaceOnly(exportModeName)) { exportMode = ExportMode.valueOf(exportModeName.toUpperCase()); // depends on control dependency: [if], data = [none] } } catch (IllegalArgumentException e) { LOG.warn(e.getLocalizedMessage(), e); //stay with default export mode } // depends on control dependency: [catch], data = [none] String siteForConstructor; boolean isImportSite; if (importSite != null) { siteForConstructor = importSite; // depends on control dependency: [if], data = [none] isImportSite = true; // depends on control dependency: [if], data = [none] } else { siteForConstructor = site; // depends on control dependency: [if], data = [none] isImportSite = false; // depends on control dependency: [if], data = [none] } // now create the module m_module = new CmsModule( moduleName, niceName, group, actionClass, importScript, siteForConstructor, isImportSite, exportMode, description, moduleVersion, authorName, authorEmail, moduleDateCreated, userInstalled, moduleDateInstalled, m_dependencies, m_exportPoints, m_resources, m_excluderesources, m_parameters); // store module name in the additional resource types List<I_CmsResourceType> moduleResourceTypes = new ArrayList<I_CmsResourceType>(m_resourceTypes.size()); for (Iterator<I_CmsResourceType> i = m_resourceTypes.iterator(); i.hasNext();) { I_CmsResourceType resType = i.next(); resType.setModuleName(moduleName); // depends on control dependency: [for], data = [none] moduleResourceTypes.add(resType); // depends on control dependency: [for], data = [none] } // set the additional resource types; m_module.setResourceTypes(moduleResourceTypes); // set the additional explorer types m_module.setExplorerTypes(m_explorerTypeSettings); m_module.setAutoIncrement(m_autoIncrement); m_module.setCheckpointTime(m_checkpointTime); } }
public class class_name { private void transferLogFilesToS3() { if (_fileTransfersEnabled) { // Find all closed log files in the staging directory and move them to S3 for (final File logFile : _stagingDir.listFiles((dir, name) -> name.startsWith(_logFilePrefix) && name.endsWith(COMPRESSED_FILE_SUFFIX))) { // Extract the date portion of the file name and is it to partition the file in S3 String auditDate = logFile.getName().substring(_logFilePrefix.length() + 1, _logFilePrefix.length() + 9); String dest = String.format("%s/date=%s/%s", _s3AuditRoot, auditDate, logFile.getName()); _fileTransferService.submit(() -> { // Since file transfers are done in a single thread, there shouldn't be any concurrency issues, // but verify the same file wasn't submitted previously and is already transferred. if (logFile.exists()) { try { PutObjectResult result = _s3.putObject(_s3Bucket, dest, logFile); _log.debug("Audit log copied: {}, ETag={}", logFile, result.getETag()); if (!logFile.delete()) { _log.warn("Failed to delete file after copying to s3: {}", logFile); } } catch (Exception e) { // Log the error, try again on the next iteration _rateLimitedLog.error(e, "Failed to copy log file {}", logFile); } } }); } } } }
public class class_name { private void transferLogFilesToS3() { if (_fileTransfersEnabled) { // Find all closed log files in the staging directory and move them to S3 for (final File logFile : _stagingDir.listFiles((dir, name) -> name.startsWith(_logFilePrefix) && name.endsWith(COMPRESSED_FILE_SUFFIX))) { // Extract the date portion of the file name and is it to partition the file in S3 String auditDate = logFile.getName().substring(_logFilePrefix.length() + 1, _logFilePrefix.length() + 9); String dest = String.format("%s/date=%s/%s", _s3AuditRoot, auditDate, logFile.getName()); _fileTransferService.submit(() -> { // Since file transfers are done in a single thread, there shouldn't be any concurrency issues, // but verify the same file wasn't submitted previously and is already transferred. if (logFile.exists()) { try { PutObjectResult result = _s3.putObject(_s3Bucket, dest, logFile); _log.debug("Audit log copied: {}, ETag={}", logFile, result.getETag()); // depends on control dependency: [try], data = [none] if (!logFile.delete()) { _log.warn("Failed to delete file after copying to s3: {}", logFile); // depends on control dependency: [if], data = [none] } } catch (Exception e) { // Log the error, try again on the next iteration _rateLimitedLog.error(e, "Failed to copy log file {}", logFile); } // depends on control dependency: [catch], data = [none] } }); } } } }
public class class_name { @Override public byte[] generateTrailerValue(String hdr, HttpTrailers message) { HeaderKeys key = HttpHeaderKeys.find(hdr); if (key != null && hdr.equals(_key)) { if (tc.isDebugEnabled()) { Tr.debug(tc, "generateTrailerValue(String,HttpTrailers): hdr = " + hdr + ", value = " + _value); } return _value.getBytes(); } else if (tc.isDebugEnabled()) { if (tc.isDebugEnabled()) { Tr.debug(tc, "generateTrailerValue(HeaderKeys,HttpTrailers): header names don't match. requested = " + hdr + ", this object = " + _key); } } return null; } }
public class class_name { @Override public byte[] generateTrailerValue(String hdr, HttpTrailers message) { HeaderKeys key = HttpHeaderKeys.find(hdr); if (key != null && hdr.equals(_key)) { if (tc.isDebugEnabled()) { Tr.debug(tc, "generateTrailerValue(String,HttpTrailers): hdr = " + hdr + ", value = " + _value); // depends on control dependency: [if], data = [none] } return _value.getBytes(); // depends on control dependency: [if], data = [none] } else if (tc.isDebugEnabled()) { if (tc.isDebugEnabled()) { Tr.debug(tc, "generateTrailerValue(HeaderKeys,HttpTrailers): header names don't match. requested = " + hdr + ", this object = " + _key); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { protected void initializeBuildPath(IJavaProject javaProject, IProgressMonitor monitor) throws CoreException { IProgressMonitor theMonitor = monitor; if (theMonitor == null) { theMonitor = new NullProgressMonitor(); } theMonitor.beginTask(NewWizardMessages.NewJavaProjectWizardPageTwo_monitor_init_build_path, 2); try { final OutParameter<IClasspathEntry[]> entries = new OutParameter<>(); final OutParameter<IPath> outputLocation = new OutParameter<>(); final IProject project = javaProject.getProject(); if (this.keepContent) { keepExistingBuildPath(project, entries, outputLocation, theMonitor); } else { buildNewBuildPath(project, entries, outputLocation, theMonitor); } if (theMonitor.isCanceled()) { throw new OperationCanceledException(); } init(javaProject, outputLocation.get(), entries.get(), false); } catch (CoreException e) { throw e; } catch (Throwable e) { if (e.getCause() instanceof CoreException) { throw (CoreException) e.getCause(); } final Throwable ee; if (e.getCause() != null && e.getCause() != e) { ee = e.getCause(); } else { ee = e; } throw new CoreException(SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, ee)); } finally { theMonitor.done(); } } }
public class class_name { protected void initializeBuildPath(IJavaProject javaProject, IProgressMonitor monitor) throws CoreException { IProgressMonitor theMonitor = monitor; if (theMonitor == null) { theMonitor = new NullProgressMonitor(); } theMonitor.beginTask(NewWizardMessages.NewJavaProjectWizardPageTwo_monitor_init_build_path, 2); try { final OutParameter<IClasspathEntry[]> entries = new OutParameter<>(); final OutParameter<IPath> outputLocation = new OutParameter<>(); final IProject project = javaProject.getProject(); if (this.keepContent) { keepExistingBuildPath(project, entries, outputLocation, theMonitor); // depends on control dependency: [if], data = [none] } else { buildNewBuildPath(project, entries, outputLocation, theMonitor); // depends on control dependency: [if], data = [none] } if (theMonitor.isCanceled()) { throw new OperationCanceledException(); } init(javaProject, outputLocation.get(), entries.get(), false); } catch (CoreException e) { throw e; } catch (Throwable e) { if (e.getCause() instanceof CoreException) { throw (CoreException) e.getCause(); } final Throwable ee; if (e.getCause() != null && e.getCause() != e) { ee = e.getCause(); // depends on control dependency: [if], data = [none] } else { ee = e; // depends on control dependency: [if], data = [none] } throw new CoreException(SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, ee)); } finally { theMonitor.done(); } } }
public class class_name { private boolean isBucketProcessed(int bucketId) { synchronized (actualProcessingBuckets) { for (Bucket<Data> oneBucket : this.actualProcessingBuckets) { if (oneBucket.getBucketId() == bucketId) { return true; } } } return false; } }
public class class_name { private boolean isBucketProcessed(int bucketId) { synchronized (actualProcessingBuckets) { for (Bucket<Data> oneBucket : this.actualProcessingBuckets) { if (oneBucket.getBucketId() == bucketId) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { public void setMapping(java.util.Collection<MappingEntry> mapping) { if (mapping == null) { this.mapping = null; return; } this.mapping = new java.util.ArrayList<MappingEntry>(mapping); } }
public class class_name { public void setMapping(java.util.Collection<MappingEntry> mapping) { if (mapping == null) { this.mapping = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.mapping = new java.util.ArrayList<MappingEntry>(mapping); } }
public class class_name { public String getName() { String name = super.getName(); if (name != null) { if (name.equals(getParameterDescriptor().getDisplayName()) || name.length() == 0) { name = null; } } return name; } }
public class class_name { public String getName() { String name = super.getName(); if (name != null) { if (name.equals(getParameterDescriptor().getDisplayName()) || name.length() == 0) { name = null; // depends on control dependency: [if], data = [none] } } return name; } }
public class class_name { public static void creatFontDialog(DatabaseManagerSwing owner) { if (isRunning) { frame.setVisible(true); } else { CommonSwing.setSwingLAF(frame, CommonSwing.Native); fOwner = owner; frame.setIconImage(CommonSwing.getIcon("Frame")); isRunning = true; frame.setSize(600, 100); CommonSwing.setFramePositon(frame); ckbitalic = new JCheckBox( new ImageIcon(CommonSwing.getIcon("ItalicFont"))); ckbitalic.putClientProperty("is3DEnabled", Boolean.TRUE); ckbitalic.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setStyle(); } }); ckbbold = new JCheckBox(new ImageIcon(CommonSwing.getIcon("BoldFont"))); ckbbold.putClientProperty("is3DEnabled", Boolean.TRUE); ckbbold.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setStyle(); } }); fgColorButton = new JButton( "Foreground", new ImageIcon(CommonSwing.getIcon("ColorSelection"))); fgColorButton.putClientProperty("is3DEnabled", Boolean.TRUE); fgColorButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setColor(FOREGROUND); } }); bgColorButton = new JButton( "Background", new ImageIcon(CommonSwing.getIcon("ColorSelection"))); bgColorButton.putClientProperty("is3DEnabled", Boolean.TRUE); bgColorButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setColor(BACKGROUND); } }); closeButton = new JButton("Close", new ImageIcon(CommonSwing.getIcon("Close"))); closeButton.putClientProperty("is3DEnabled", Boolean.TRUE); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { frame.setVisible(false); } }); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); String[] fontNames = ge.getAvailableFontFamilyNames(); Dimension fontsComboBoxDimension = new Dimension(160, 25); fontsComboBox = new JComboBox(fontNames); fontsComboBox.putClientProperty("is3DEnabled", Boolean.TRUE); fontsComboBox.setMaximumSize(fontsComboBoxDimension); fontsComboBox.setPreferredSize(fontsComboBoxDimension); fontsComboBox.setMaximumSize(fontsComboBoxDimension); fontsComboBox.setEditable(false); fontsComboBox.setSelectedItem(defaultFont); fontsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setFont(); } }); // weconsultants@users 20050215 - Added for Compatbilty fix for JDK 1.3 fontSizesComboBox = new JComboBox(fontSizes); Dimension spinnerDimension = new Dimension(45, 25); fontSizesComboBox.putClientProperty("is3DEnabled", Boolean.TRUE); fontSizesComboBox.setMinimumSize(spinnerDimension); fontSizesComboBox.setPreferredSize(spinnerDimension); fontSizesComboBox.setMaximumSize(spinnerDimension); fontSizesComboBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent evt) { if (evt.getStateChange() == ItemEvent.SELECTED) { setFontSize((String) evt.getItem()); } } }); // weconsultants@users 20050215 - Commented out for Compatbilty fix for JDK 1.3 // Dimension spinnerDimension = new Dimension(50, 25); // spinnerFontSizes = new JSpinner(); // spinnerFontSizes.putClientProperty("is3DEnabled", Boolean.TRUE); // spinnerFontSizes.setMinimumSize(spinnerDimension); // spinnerFontSizes.setPreferredSize(spinnerDimension); // spinnerFontSizes.setMaximumSize(spinnerDimension); // spinnerModelSizes = new SpinnerNumberModel(12, 8, 72, 1); // spinnerFontSizes.setModel(spinnerModelSizes); // spinnerFontSizes.addChangeListener(new ChangeListener() { // public void stateChanged(ChangeEvent e) { // setFontSize(); // } // }); Container contentPane = frame.getContentPane(); contentPane.setLayout(new FlowLayout()); contentPane.add(fontsComboBox); // weconsultants@users 20050215 - Commented out for Compatbilty fix for 1.3 // contentPane.add(spinnerFontSizes); // weconsultants@users 20050215 - Added for Compatbilty fix for 1.3 contentPane.add(fontSizesComboBox); contentPane.add(ckbbold); contentPane.add(ckbitalic); contentPane.add(fgColorButton); contentPane.add(bgColorButton); contentPane.add(closeButton); frame.pack(); frame.setVisible(false); } } }
public class class_name { public static void creatFontDialog(DatabaseManagerSwing owner) { if (isRunning) { frame.setVisible(true); // depends on control dependency: [if], data = [none] } else { CommonSwing.setSwingLAF(frame, CommonSwing.Native); // depends on control dependency: [if], data = [none] fOwner = owner; // depends on control dependency: [if], data = [none] frame.setIconImage(CommonSwing.getIcon("Frame")); // depends on control dependency: [if], data = [none] isRunning = true; // depends on control dependency: [if], data = [none] frame.setSize(600, 100); // depends on control dependency: [if], data = [none] CommonSwing.setFramePositon(frame); // depends on control dependency: [if], data = [none] ckbitalic = new JCheckBox( new ImageIcon(CommonSwing.getIcon("ItalicFont"))); // depends on control dependency: [if], data = [none] ckbitalic.putClientProperty("is3DEnabled", Boolean.TRUE); // depends on control dependency: [if], data = [none] ckbitalic.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setStyle(); } }); // depends on control dependency: [if], data = [none] ckbbold = new JCheckBox(new ImageIcon(CommonSwing.getIcon("BoldFont"))); // depends on control dependency: [if], data = [none] ckbbold.putClientProperty("is3DEnabled", Boolean.TRUE); // depends on control dependency: [if], data = [none] ckbbold.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setStyle(); } }); // depends on control dependency: [if], data = [none] fgColorButton = new JButton( "Foreground", new ImageIcon(CommonSwing.getIcon("ColorSelection"))); // depends on control dependency: [if], data = [none] fgColorButton.putClientProperty("is3DEnabled", Boolean.TRUE); // depends on control dependency: [if], data = [none] fgColorButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setColor(FOREGROUND); } }); // depends on control dependency: [if], data = [none] bgColorButton = new JButton( "Background", new ImageIcon(CommonSwing.getIcon("ColorSelection"))); // depends on control dependency: [if], data = [none] bgColorButton.putClientProperty("is3DEnabled", Boolean.TRUE); // depends on control dependency: [if], data = [none] bgColorButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setColor(BACKGROUND); } }); // depends on control dependency: [if], data = [none] closeButton = new JButton("Close", new ImageIcon(CommonSwing.getIcon("Close"))); // depends on control dependency: [if], data = [none] closeButton.putClientProperty("is3DEnabled", Boolean.TRUE); // depends on control dependency: [if], data = [none] closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { frame.setVisible(false); } }); // depends on control dependency: [if], data = [none] GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); String[] fontNames = ge.getAvailableFontFamilyNames(); Dimension fontsComboBoxDimension = new Dimension(160, 25); fontsComboBox = new JComboBox(fontNames); // depends on control dependency: [if], data = [none] fontsComboBox.putClientProperty("is3DEnabled", Boolean.TRUE); // depends on control dependency: [if], data = [none] fontsComboBox.setMaximumSize(fontsComboBoxDimension); // depends on control dependency: [if], data = [none] fontsComboBox.setPreferredSize(fontsComboBoxDimension); // depends on control dependency: [if], data = [none] fontsComboBox.setMaximumSize(fontsComboBoxDimension); // depends on control dependency: [if], data = [none] fontsComboBox.setEditable(false); // depends on control dependency: [if], data = [none] fontsComboBox.setSelectedItem(defaultFont); // depends on control dependency: [if], data = [none] fontsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setFont(); } }); // depends on control dependency: [if], data = [none] // weconsultants@users 20050215 - Added for Compatbilty fix for JDK 1.3 fontSizesComboBox = new JComboBox(fontSizes); // depends on control dependency: [if], data = [none] Dimension spinnerDimension = new Dimension(45, 25); fontSizesComboBox.putClientProperty("is3DEnabled", Boolean.TRUE); // depends on control dependency: [if], data = [none] fontSizesComboBox.setMinimumSize(spinnerDimension); // depends on control dependency: [if], data = [none] fontSizesComboBox.setPreferredSize(spinnerDimension); // depends on control dependency: [if], data = [none] fontSizesComboBox.setMaximumSize(spinnerDimension); // depends on control dependency: [if], data = [none] fontSizesComboBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent evt) { if (evt.getStateChange() == ItemEvent.SELECTED) { setFontSize((String) evt.getItem()); // depends on control dependency: [if], data = [none] } } }); // depends on control dependency: [if], data = [none] // weconsultants@users 20050215 - Commented out for Compatbilty fix for JDK 1.3 // Dimension spinnerDimension = new Dimension(50, 25); // spinnerFontSizes = new JSpinner(); // spinnerFontSizes.putClientProperty("is3DEnabled", Boolean.TRUE); // spinnerFontSizes.setMinimumSize(spinnerDimension); // spinnerFontSizes.setPreferredSize(spinnerDimension); // spinnerFontSizes.setMaximumSize(spinnerDimension); // spinnerModelSizes = new SpinnerNumberModel(12, 8, 72, 1); // spinnerFontSizes.setModel(spinnerModelSizes); // spinnerFontSizes.addChangeListener(new ChangeListener() { // public void stateChanged(ChangeEvent e) { // setFontSize(); // } // }); Container contentPane = frame.getContentPane(); contentPane.setLayout(new FlowLayout()); // depends on control dependency: [if], data = [none] contentPane.add(fontsComboBox); // depends on control dependency: [if], data = [none] // weconsultants@users 20050215 - Commented out for Compatbilty fix for 1.3 // contentPane.add(spinnerFontSizes); // weconsultants@users 20050215 - Added for Compatbilty fix for 1.3 contentPane.add(fontSizesComboBox); // depends on control dependency: [if], data = [none] contentPane.add(ckbbold); // depends on control dependency: [if], data = [none] contentPane.add(ckbitalic); // depends on control dependency: [if], data = [none] contentPane.add(fgColorButton); // depends on control dependency: [if], data = [none] contentPane.add(bgColorButton); // depends on control dependency: [if], data = [none] contentPane.add(closeButton); // depends on control dependency: [if], data = [none] frame.pack(); // depends on control dependency: [if], data = [none] frame.setVisible(false); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void addGlobalServices(CatalogBuilder cat) { // look for datasets that want to use global services Set<String> allServiceNames = new HashSet<>(); findServices(cat.getDatasets(), allServiceNames); // all services used if (!allServiceNames.isEmpty()) { List<Service> servicesMissing = new ArrayList<>(); // all services missing for (String name : allServiceNames) { if (cat.hasServiceInDataset(name)) continue; Service s = globalServices.findGlobalService(name); if (s != null) servicesMissing.add(s); } servicesMissing.forEach(cat::addService); } // look for datasets that want to use standard services for (DatasetBuilder node : cat.getDatasets()) { String sname = (String) node.getFldOrInherited(Dataset.ServiceName); String urlPath = (String) node.get(Dataset.UrlPath); String ftypeS = (String) node.getFldOrInherited(Dataset.FeatureType); if (sname == null && urlPath != null && ftypeS != null) { Service s = globalServices.getStandardServices(ftypeS); if (s != null) { node.put(Dataset.ServiceName, s.getName()); cat.addService(s); } } } } }
public class class_name { private void addGlobalServices(CatalogBuilder cat) { // look for datasets that want to use global services Set<String> allServiceNames = new HashSet<>(); findServices(cat.getDatasets(), allServiceNames); // all services used if (!allServiceNames.isEmpty()) { List<Service> servicesMissing = new ArrayList<>(); // all services missing for (String name : allServiceNames) { if (cat.hasServiceInDataset(name)) continue; Service s = globalServices.findGlobalService(name); if (s != null) servicesMissing.add(s); } servicesMissing.forEach(cat::addService); // depends on control dependency: [if], data = [none] } // look for datasets that want to use standard services for (DatasetBuilder node : cat.getDatasets()) { String sname = (String) node.getFldOrInherited(Dataset.ServiceName); String urlPath = (String) node.get(Dataset.UrlPath); String ftypeS = (String) node.getFldOrInherited(Dataset.FeatureType); if (sname == null && urlPath != null && ftypeS != null) { Service s = globalServices.getStandardServices(ftypeS); if (s != null) { node.put(Dataset.ServiceName, s.getName()); // depends on control dependency: [if], data = [none] cat.addService(s); // depends on control dependency: [if], data = [(s] } } } } }
public class class_name { public @Nullable ChangeEvent<BsonDocument> getUnprocessedEventForDocumentId( final BsonValue documentId ) { final ChangeEvent<BsonDocument> event; nsLock.readLock().lock(); try { event = this.events.get(documentId); } finally { nsLock.readLock().unlock(); } nsLock.writeLock().lock(); try { this.events.remove(documentId); return event; } finally { nsLock.writeLock().unlock(); } } }
public class class_name { public @Nullable ChangeEvent<BsonDocument> getUnprocessedEventForDocumentId( final BsonValue documentId ) { final ChangeEvent<BsonDocument> event; nsLock.readLock().lock(); try { event = this.events.get(documentId); // depends on control dependency: [try], data = [none] } finally { nsLock.readLock().unlock(); } nsLock.writeLock().lock(); try { this.events.remove(documentId); // depends on control dependency: [try], data = [none] return event; // depends on control dependency: [try], data = [none] } finally { nsLock.writeLock().unlock(); } } }
public class class_name { @Override public BatchStatus getBatchStatus(long jobExecutionId) { BatchStatus retVal = null; BatchWorkUnit bwu = executingJobs.get(jobExecutionId); if (bwu != null) { retVal = bwu.getRuntimeWorkUnitExecution().getBatchStatus(); logger.finer("Returning local BatchStatus of: " + retVal); } else { logger.finer("Local BatchStatus not found, returning <null>"); } return retVal; } }
public class class_name { @Override public BatchStatus getBatchStatus(long jobExecutionId) { BatchStatus retVal = null; BatchWorkUnit bwu = executingJobs.get(jobExecutionId); if (bwu != null) { retVal = bwu.getRuntimeWorkUnitExecution().getBatchStatus(); // depends on control dependency: [if], data = [none] logger.finer("Returning local BatchStatus of: " + retVal); // depends on control dependency: [if], data = [none] } else { logger.finer("Local BatchStatus not found, returning <null>"); // depends on control dependency: [if], data = [none] } return retVal; } }
public class class_name { public final hqlParser.selectedPropertiesList_return selectedPropertiesList() throws RecognitionException { hqlParser.selectedPropertiesList_return retval = new hqlParser.selectedPropertiesList_return(); retval.start = input.LT(1); CommonTree root_0 = null; Token COMMA148=null; ParserRuleReturnScope aliasedExpression147 =null; ParserRuleReturnScope aliasedExpression149 =null; CommonTree COMMA148_tree=null; try { // hql.g:372:2: ( aliasedExpression ( COMMA ! aliasedExpression )* ) // hql.g:372:4: aliasedExpression ( COMMA ! aliasedExpression )* { root_0 = (CommonTree)adaptor.nil(); pushFollow(FOLLOW_aliasedExpression_in_selectedPropertiesList1798); aliasedExpression147=aliasedExpression(); state._fsp--; adaptor.addChild(root_0, aliasedExpression147.getTree()); // hql.g:372:22: ( COMMA ! aliasedExpression )* loop49: while (true) { int alt49=2; int LA49_0 = input.LA(1); if ( (LA49_0==COMMA) ) { alt49=1; } switch (alt49) { case 1 : // hql.g:372:24: COMMA ! aliasedExpression { COMMA148=(Token)match(input,COMMA,FOLLOW_COMMA_in_selectedPropertiesList1802); pushFollow(FOLLOW_aliasedExpression_in_selectedPropertiesList1805); aliasedExpression149=aliasedExpression(); state._fsp--; adaptor.addChild(root_0, aliasedExpression149.getTree()); } break; default : break loop49; } } } retval.stop = input.LT(-1); retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { // do for sure before leaving } return retval; } }
public class class_name { public final hqlParser.selectedPropertiesList_return selectedPropertiesList() throws RecognitionException { hqlParser.selectedPropertiesList_return retval = new hqlParser.selectedPropertiesList_return(); retval.start = input.LT(1); CommonTree root_0 = null; Token COMMA148=null; ParserRuleReturnScope aliasedExpression147 =null; ParserRuleReturnScope aliasedExpression149 =null; CommonTree COMMA148_tree=null; try { // hql.g:372:2: ( aliasedExpression ( COMMA ! aliasedExpression )* ) // hql.g:372:4: aliasedExpression ( COMMA ! aliasedExpression )* { root_0 = (CommonTree)adaptor.nil(); pushFollow(FOLLOW_aliasedExpression_in_selectedPropertiesList1798); aliasedExpression147=aliasedExpression(); state._fsp--; adaptor.addChild(root_0, aliasedExpression147.getTree()); // hql.g:372:22: ( COMMA ! aliasedExpression )* loop49: while (true) { int alt49=2; int LA49_0 = input.LA(1); if ( (LA49_0==COMMA) ) { alt49=1; // depends on control dependency: [if], data = [none] } switch (alt49) { case 1 : // hql.g:372:24: COMMA ! aliasedExpression { COMMA148=(Token)match(input,COMMA,FOLLOW_COMMA_in_selectedPropertiesList1802); pushFollow(FOLLOW_aliasedExpression_in_selectedPropertiesList1805); aliasedExpression149=aliasedExpression(); state._fsp--; adaptor.addChild(root_0, aliasedExpression149.getTree()); } break; default : break loop49; } } } retval.stop = input.LT(-1); retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { // do for sure before leaving } return retval; } }
public class class_name { public void register(final Field field) { Requires requires = field.getAnnotation(Requires.class); if (requires != null) { final String[] requirements = requires.value(); for (String requirement: requirements) { this.dependantToRequirementsMap.put(field, requirement); this.requirementToDependantMap.put(requirement, field); } } } }
public class class_name { public void register(final Field field) { Requires requires = field.getAnnotation(Requires.class); if (requires != null) { final String[] requirements = requires.value(); for (String requirement: requirements) { this.dependantToRequirementsMap.put(field, requirement); // depends on control dependency: [for], data = [requirement] this.requirementToDependantMap.put(requirement, field); // depends on control dependency: [for], data = [requirement] } } } }
public class class_name { public static ARCHType calculateArch() { String osArch = System.getProperty("os.arch"); osArch = osArch.toLowerCase(Locale.ENGLISH); if (osArch.equals("i386") || osArch.equals("x86") || osArch.equals("i686")) { return ARCHType.X86; } if (osArch.startsWith("amd64") || osArch.startsWith("x86_64")) { return ARCHType.X86_64; } if (osArch.equals("ppc") || osArch.equals("powerpc")) { return ARCHType.PPC; } if (osArch.startsWith("ppc")) { return ARCHType.PPC_64; } if (osArch.startsWith("sparc")) { return ARCHType.SPARC; } if (osArch.startsWith("arm")) { return ARCHType.ARM; } if (osArch.startsWith("mips")) { return ARCHType.MIPS; } if (osArch.contains("risc")) { return ARCHType.RISC; } return ARCHType.UNKNOWN; } }
public class class_name { public static ARCHType calculateArch() { String osArch = System.getProperty("os.arch"); osArch = osArch.toLowerCase(Locale.ENGLISH); if (osArch.equals("i386") || osArch.equals("x86") || osArch.equals("i686")) { return ARCHType.X86; // depends on control dependency: [if], data = [none] } if (osArch.startsWith("amd64") || osArch.startsWith("x86_64")) { return ARCHType.X86_64; // depends on control dependency: [if], data = [none] } if (osArch.equals("ppc") || osArch.equals("powerpc")) { return ARCHType.PPC; // depends on control dependency: [if], data = [none] } if (osArch.startsWith("ppc")) { return ARCHType.PPC_64; // depends on control dependency: [if], data = [none] } if (osArch.startsWith("sparc")) { return ARCHType.SPARC; // depends on control dependency: [if], data = [none] } if (osArch.startsWith("arm")) { return ARCHType.ARM; // depends on control dependency: [if], data = [none] } if (osArch.startsWith("mips")) { return ARCHType.MIPS; // depends on control dependency: [if], data = [none] } if (osArch.contains("risc")) { return ARCHType.RISC; // depends on control dependency: [if], data = [none] } return ARCHType.UNKNOWN; } }
public class class_name { public void waitForReplayCompletion() { if (tc.isEntryEnabled()) Tr.entry(tc, "waitForReplayCompletion"); if (!_replayCompleted) { try { if (tc.isEventEnabled()) Tr.event(tc, "starting to wait for replay completion"); _replayInProgress.waitEvent(); if (tc.isEventEnabled()) Tr.event(tc, "completed wait for replay completion"); } catch (InterruptedException exc) { FFDCFilter.processException(exc, "com.ibm.tx.jta.impl.RecoveryManager.waitForReplayCompletion", "1242", this); if (tc.isEventEnabled()) Tr.event(tc, "Wait for resync complete interrupted."); } } if (tc.isEntryEnabled()) Tr.exit(tc, "waitForReplayCompletion"); } }
public class class_name { public void waitForReplayCompletion() { if (tc.isEntryEnabled()) Tr.entry(tc, "waitForReplayCompletion"); if (!_replayCompleted) { try { if (tc.isEventEnabled()) Tr.event(tc, "starting to wait for replay completion"); _replayInProgress.waitEvent(); // depends on control dependency: [try], data = [none] if (tc.isEventEnabled()) Tr.event(tc, "completed wait for replay completion"); } catch (InterruptedException exc) { FFDCFilter.processException(exc, "com.ibm.tx.jta.impl.RecoveryManager.waitForReplayCompletion", "1242", this); if (tc.isEventEnabled()) Tr.event(tc, "Wait for resync complete interrupted."); } // depends on control dependency: [catch], data = [none] } if (tc.isEntryEnabled()) Tr.exit(tc, "waitForReplayCompletion"); } }
public class class_name { private void trainStep(DataSet dataSet, boolean parallel) { boolean autoLearners = isAutoFeatureSample();//We will need to set it back after, so remember if we need to if(autoLearners) baseLearner.setRandomFeatureCount(Math.max((int)Math.sqrt(dataSet.getNumFeatures()), 1)); else baseLearner.setRandomFeatureCount(featureSamples); int roundsToDistribut = maxForestSize; int roundShare = roundsToDistribut / SystemInfo.LogicalCores;//The number of rounds each thread gets int extraRounds = roundsToDistribut % SystemInfo.LogicalCores;//The number of extra rounds that need to get distributed if(!parallel)//No point in duplicatin recources roundShare = roundsToDistribut;//All the rounds get shoved onto one thread ExecutorService threadPool = parallel ? ParallelUtils.CACHED_THREAD_POOL : new FakeExecutor(); //Random used for creating more random objects, faster to duplicate such a small recourse then share and lock Random rand = RandomUtil.getRandom(); List<Future<LearningWorker>> futures = new ArrayList<>(SystemInfo.LogicalCores); int[][] counts = null; AtomicDoubleArray pred = null; if(dataSet instanceof RegressionDataSet) { pred = new AtomicDoubleArray(dataSet.size()); counts = new int[pred.length()][1];//how many predictions are in this? } else { counts = new int[dataSet.size()][((ClassificationDataSet)dataSet).getClassSize()]; } while (roundsToDistribut > 0) { int extra = (extraRounds-- > 0) ? 1 : 0; Future<LearningWorker> future = threadPool.submit(new LearningWorker(dataSet, roundShare + extra, new Random(rand.nextInt()), counts, pred)); roundsToDistribut -= (roundShare + extra); futures.add(future); } outOfBagError = 0; try { List<LearningWorker> workers = ListUtils.collectFutures(futures); for (LearningWorker worker : workers) forest.addAll(worker.learned); if (useOutOfBagError) { if (dataSet instanceof ClassificationDataSet) { ClassificationDataSet cds = (ClassificationDataSet) dataSet; for (int i = 0; i < counts.length; i++) { int max = 0; for (int j = 1; j < counts[i].length; j++) if(counts[i][j] > counts[i][max]) max = j; if(max != cds.getDataPointCategory(i)) outOfBagError++; } } else { RegressionDataSet rds = (RegressionDataSet) dataSet; for (int i = 0; i < counts.length; i++) outOfBagError += Math.pow(pred.get(i)/counts[i][0]-rds.getTargetValue(i), 2); } outOfBagError /= dataSet.size(); } if(useOutOfBagImportance)//collect feature importance stats from each worker { feature_importance = new OnLineStatistics[dataSet.getNumFeatures()]; for(int j = 0; j < dataSet.getNumFeatures(); j++) feature_importance[j] = new OnLineStatistics(); for(LearningWorker worker : workers) for(int j = 0; j < dataSet.getNumFeatures(); j++) feature_importance[j].add(worker.fi[j]); } } catch (Exception ex) { Logger.getLogger(RandomForest.class.getName()).log(Level.SEVERE, null, ex); } } }
public class class_name { private void trainStep(DataSet dataSet, boolean parallel) { boolean autoLearners = isAutoFeatureSample();//We will need to set it back after, so remember if we need to if(autoLearners) baseLearner.setRandomFeatureCount(Math.max((int)Math.sqrt(dataSet.getNumFeatures()), 1)); else baseLearner.setRandomFeatureCount(featureSamples); int roundsToDistribut = maxForestSize; int roundShare = roundsToDistribut / SystemInfo.LogicalCores;//The number of rounds each thread gets int extraRounds = roundsToDistribut % SystemInfo.LogicalCores;//The number of extra rounds that need to get distributed if(!parallel)//No point in duplicatin recources roundShare = roundsToDistribut;//All the rounds get shoved onto one thread ExecutorService threadPool = parallel ? ParallelUtils.CACHED_THREAD_POOL : new FakeExecutor(); //Random used for creating more random objects, faster to duplicate such a small recourse then share and lock Random rand = RandomUtil.getRandom(); List<Future<LearningWorker>> futures = new ArrayList<>(SystemInfo.LogicalCores); int[][] counts = null; AtomicDoubleArray pred = null; if(dataSet instanceof RegressionDataSet) { pred = new AtomicDoubleArray(dataSet.size()); // depends on control dependency: [if], data = [none] counts = new int[pred.length()][1];//how many predictions are in this? // depends on control dependency: [if], data = [none] } else { counts = new int[dataSet.size()][((ClassificationDataSet)dataSet).getClassSize()]; // depends on control dependency: [if], data = [none] } while (roundsToDistribut > 0) { int extra = (extraRounds-- > 0) ? 1 : 0; Future<LearningWorker> future = threadPool.submit(new LearningWorker(dataSet, roundShare + extra, new Random(rand.nextInt()), counts, pred)); roundsToDistribut -= (roundShare + extra); // depends on control dependency: [while], data = [none] futures.add(future); // depends on control dependency: [while], data = [none] } outOfBagError = 0; try { List<LearningWorker> workers = ListUtils.collectFutures(futures); for (LearningWorker worker : workers) forest.addAll(worker.learned); if (useOutOfBagError) { if (dataSet instanceof ClassificationDataSet) { ClassificationDataSet cds = (ClassificationDataSet) dataSet; for (int i = 0; i < counts.length; i++) { int max = 0; for (int j = 1; j < counts[i].length; j++) if(counts[i][j] > counts[i][max]) max = j; if(max != cds.getDataPointCategory(i)) outOfBagError++; } } else { RegressionDataSet rds = (RegressionDataSet) dataSet; for (int i = 0; i < counts.length; i++) outOfBagError += Math.pow(pred.get(i)/counts[i][0]-rds.getTargetValue(i), 2); } outOfBagError /= dataSet.size(); // depends on control dependency: [if], data = [none] } if(useOutOfBagImportance)//collect feature importance stats from each worker { feature_importance = new OnLineStatistics[dataSet.getNumFeatures()]; // depends on control dependency: [if], data = [none] for(int j = 0; j < dataSet.getNumFeatures(); j++) feature_importance[j] = new OnLineStatistics(); for(LearningWorker worker : workers) for(int j = 0; j < dataSet.getNumFeatures(); j++) feature_importance[j].add(worker.fi[j]); } } catch (Exception ex) { Logger.getLogger(RandomForest.class.getName()).log(Level.SEVERE, null, ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Nullable public JobID getOwningJob(AllocationID allocationId) { final TaskSlot taskSlot = getTaskSlot(allocationId); if (taskSlot != null) { return taskSlot.getJobId(); } else { return null; } } }
public class class_name { @Nullable public JobID getOwningJob(AllocationID allocationId) { final TaskSlot taskSlot = getTaskSlot(allocationId); if (taskSlot != null) { return taskSlot.getJobId(); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public String getMessage(MyfacesLogKey key) { try { String name = key.name(); return _log.getResourceBundle().getString(name); } catch (MissingResourceException mre) { return key.name(); } } }
public class class_name { public String getMessage(MyfacesLogKey key) { try { String name = key.name(); return _log.getResourceBundle().getString(name); // depends on control dependency: [try], data = [none] } catch (MissingResourceException mre) { return key.name(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setAverageVisible(final boolean VISIBLE) { if (null == averageVisible) { _averageVisible = VISIBLE; fireUpdateEvent(VISIBILITY_EVENT); } else { averageVisible.set(VISIBLE); } } }
public class class_name { public void setAverageVisible(final boolean VISIBLE) { if (null == averageVisible) { _averageVisible = VISIBLE; // depends on control dependency: [if], data = [none] fireUpdateEvent(VISIBILITY_EVENT); // depends on control dependency: [if], data = [none] } else { averageVisible.set(VISIBLE); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void accept(SARLQuickfixProvider provider, Issue issue, IssueResolutionAcceptor acceptor, RemovalType type) { final String[] data = issue.getData(); RemovalType removalType = type; String redundantName = null; if (data != null && data.length >= 1) { redundantName = data[0]; if (removalType == null && data.length >= 2) { final String mode = data[1]; if (!Strings.isNullOrEmpty(mode)) { try { removalType = RemovalType.valueOf(mode.toUpperCase()); } catch (Throwable exception) { // } } } } if (removalType == null) { removalType = RemovalType.OTHER; } final String msg; if (Strings.isNullOrEmpty(redundantName)) { msg = Messages.SARLQuickfixProvider_0; } else { msg = MessageFormat.format(Messages.SARLQuickfixProvider_6, redundantName); } final ExtendedTypeRemoveModification modification = new ExtendedTypeRemoveModification(removalType); modification.setIssue(issue); modification.setTools(provider); acceptor.accept(issue, msg, Messages.SARLQuickfixProvider_7, JavaPluginImages.IMG_CORRECTION_REMOVE, modification, IProposalRelevance.REMOVE_REDUNDANT_SUPER_INTERFACE); } }
public class class_name { public static void accept(SARLQuickfixProvider provider, Issue issue, IssueResolutionAcceptor acceptor, RemovalType type) { final String[] data = issue.getData(); RemovalType removalType = type; String redundantName = null; if (data != null && data.length >= 1) { redundantName = data[0]; // depends on control dependency: [if], data = [none] if (removalType == null && data.length >= 2) { final String mode = data[1]; if (!Strings.isNullOrEmpty(mode)) { try { removalType = RemovalType.valueOf(mode.toUpperCase()); // depends on control dependency: [try], data = [none] } catch (Throwable exception) { // } // depends on control dependency: [catch], data = [none] } } } if (removalType == null) { removalType = RemovalType.OTHER; // depends on control dependency: [if], data = [none] } final String msg; if (Strings.isNullOrEmpty(redundantName)) { msg = Messages.SARLQuickfixProvider_0; // depends on control dependency: [if], data = [none] } else { msg = MessageFormat.format(Messages.SARLQuickfixProvider_6, redundantName); // depends on control dependency: [if], data = [none] } final ExtendedTypeRemoveModification modification = new ExtendedTypeRemoveModification(removalType); modification.setIssue(issue); modification.setTools(provider); acceptor.accept(issue, msg, Messages.SARLQuickfixProvider_7, JavaPluginImages.IMG_CORRECTION_REMOVE, modification, IProposalRelevance.REMOVE_REDUNDANT_SUPER_INTERFACE); } }
public class class_name { private void prepareBuffers(List<DBBPool.BBContainer> buffers) { Preconditions.checkArgument(buffers.size() == m_tableTasks.size()); UnmodifiableIterator<SnapshotTableTask> iterator = m_tableTasks.iterator(); for (DBBPool.BBContainer container : buffers) { int headerSize = iterator.next().m_target.getHeaderSize(); final ByteBuffer buf = container.b(); buf.clear(); buf.position(headerSize); } } }
public class class_name { private void prepareBuffers(List<DBBPool.BBContainer> buffers) { Preconditions.checkArgument(buffers.size() == m_tableTasks.size()); UnmodifiableIterator<SnapshotTableTask> iterator = m_tableTasks.iterator(); for (DBBPool.BBContainer container : buffers) { int headerSize = iterator.next().m_target.getHeaderSize(); final ByteBuffer buf = container.b(); buf.clear(); // depends on control dependency: [for], data = [none] buf.position(headerSize); // depends on control dependency: [for], data = [none] } } }
public class class_name { private static String joinAndGetValueForSelect(List<Field> fields, String sep, String fieldPrefix) { fieldPrefix = fieldPrefix == null ? "" : fieldPrefix.trim(); StringBuilder sb = new StringBuilder(); for(Field field : fields) { Column column = field.getAnnotation(Column.class); String computed = column.computed().trim(); if(!computed.isEmpty()) { sb.append("(").append(computed).append(") AS "); } else { sb.append(fieldPrefix); // 计算列不支持默认前缀,当join时,请自行区分计算字段的命名 } sb.append(getColumnName(column)).append(sep); } int len = sb.length(); return len == 0 ? "" : sb.toString().substring(0, len - 1); } }
public class class_name { private static String joinAndGetValueForSelect(List<Field> fields, String sep, String fieldPrefix) { fieldPrefix = fieldPrefix == null ? "" : fieldPrefix.trim(); StringBuilder sb = new StringBuilder(); for(Field field : fields) { Column column = field.getAnnotation(Column.class); String computed = column.computed().trim(); if(!computed.isEmpty()) { sb.append("(").append(computed).append(") AS "); // depends on control dependency: [if], data = [none] } else { sb.append(fieldPrefix); // 计算列不支持默认前缀,当join时,请自行区分计算字段的命名 // depends on control dependency: [if], data = [none] } sb.append(getColumnName(column)).append(sep); // depends on control dependency: [for], data = [none] } int len = sb.length(); return len == 0 ? "" : sb.toString().substring(0, len - 1); } }
public class class_name { public void marshall(ResponseCard responseCard, ProtocolMarshaller protocolMarshaller) { if (responseCard == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(responseCard.getVersion(), VERSION_BINDING); protocolMarshaller.marshall(responseCard.getContentType(), CONTENTTYPE_BINDING); protocolMarshaller.marshall(responseCard.getGenericAttachments(), GENERICATTACHMENTS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ResponseCard responseCard, ProtocolMarshaller protocolMarshaller) { if (responseCard == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(responseCard.getVersion(), VERSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(responseCard.getContentType(), CONTENTTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(responseCard.getGenericAttachments(), GENERICATTACHMENTS_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 Optional<Playlist> getPlaylist(EventModel eventModel) { if (eventModel.getListResourceContainer().containsResourcesFromSource(ID)) { return eventModel .getListResourceContainer() .provideResource(ID) .stream() .findAny() .flatMap(Playlist::importResource); } else { return Optional.empty(); } } }
public class class_name { public static Optional<Playlist> getPlaylist(EventModel eventModel) { if (eventModel.getListResourceContainer().containsResourcesFromSource(ID)) { return eventModel .getListResourceContainer() .provideResource(ID) .stream() .findAny() .flatMap(Playlist::importResource); // depends on control dependency: [if], data = [none] } else { return Optional.empty(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setChapCredentials(java.util.Collection<ChapInfo> chapCredentials) { if (chapCredentials == null) { this.chapCredentials = null; return; } this.chapCredentials = new com.amazonaws.internal.SdkInternalList<ChapInfo>(chapCredentials); } }
public class class_name { public void setChapCredentials(java.util.Collection<ChapInfo> chapCredentials) { if (chapCredentials == null) { this.chapCredentials = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.chapCredentials = new com.amazonaws.internal.SdkInternalList<ChapInfo>(chapCredentials); } }
public class class_name { protected void initZipOutputStream(ZipOutputStream zOut) throws IOException, BuildException { if (manifestFiles.size() != 0) { // // Create a default (empty) manifest // Manifest mergeManifest = Manifest.getDefaultManifest(); // // Iterate through each found manifest file, merging its contents into the // merge manifest // for (File manifestFile : manifestFiles) { FileInputStream fis = null; try { fis = new FileInputStream(manifestFile); Manifest resourceManifest = new Manifest(new InputStreamReader(fis)); mergeManifest.merge(resourceManifest); } catch (IOException ioe) { throw new BuildException("Unable to read manifest file:" + manifestFile, ioe); } catch (ManifestException me) { throw new BuildException("Unable to process manifest file: "+ manifestFile, me); } finally { if (fis != null) fis.close(); } } // // Set the merge manifest as the 'configured' manifest. This will treat its // contents as if they had been included inline with the <jar> task, with // similar precedence rules. // try { addConfiguredManifest(mergeManifest); } catch (ManifestException me) { throw new BuildException("Unable to add new manifest entries:" + me); } } super.initZipOutputStream(zOut); } }
public class class_name { protected void initZipOutputStream(ZipOutputStream zOut) throws IOException, BuildException { if (manifestFiles.size() != 0) { // // Create a default (empty) manifest // Manifest mergeManifest = Manifest.getDefaultManifest(); // // Iterate through each found manifest file, merging its contents into the // merge manifest // for (File manifestFile : manifestFiles) { FileInputStream fis = null; try { fis = new FileInputStream(manifestFile); // depends on control dependency: [try], data = [none] Manifest resourceManifest = new Manifest(new InputStreamReader(fis)); mergeManifest.merge(resourceManifest); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { throw new BuildException("Unable to read manifest file:" + manifestFile, ioe); } // depends on control dependency: [catch], data = [none] catch (ManifestException me) { throw new BuildException("Unable to process manifest file: "+ manifestFile, me); } // depends on control dependency: [catch], data = [none] finally { if (fis != null) fis.close(); } } // // Set the merge manifest as the 'configured' manifest. This will treat its // contents as if they had been included inline with the <jar> task, with // similar precedence rules. // try { addConfiguredManifest(mergeManifest); } catch (ManifestException me) { throw new BuildException("Unable to add new manifest entries:" + me); } } super.initZipOutputStream(zOut); } }
public class class_name { private static String getHostPort(SocketAddress address) { if (address instanceof ResourceAddress) { ResourceAddress lowest = getLowestTransportLayer((ResourceAddress)address); return format(HOST_PORT_FORMAT, lowest.getResource().getHost(), lowest.getResource().getPort()); } if (address instanceof InetSocketAddress) { InetSocketAddress inet = (InetSocketAddress)address; // we don't use inet.toString() because it would include a leading /, for example "/127.0.0.1:21345" // use getHostString() to avoid a reverse DNS lookup return format(HOST_PORT_FORMAT, inet.getHostString(), inet.getPort()); } return null; } }
public class class_name { private static String getHostPort(SocketAddress address) { if (address instanceof ResourceAddress) { ResourceAddress lowest = getLowestTransportLayer((ResourceAddress)address); return format(HOST_PORT_FORMAT, lowest.getResource().getHost(), lowest.getResource().getPort()); // depends on control dependency: [if], data = [none] } if (address instanceof InetSocketAddress) { InetSocketAddress inet = (InetSocketAddress)address; // we don't use inet.toString() because it would include a leading /, for example "/127.0.0.1:21345" // use getHostString() to avoid a reverse DNS lookup return format(HOST_PORT_FORMAT, inet.getHostString(), inet.getPort()); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public java.util.List<String> getApplicationArns() { if (applicationArns == null) { applicationArns = new com.amazonaws.internal.SdkInternalList<String>(); } return applicationArns; } }
public class class_name { public java.util.List<String> getApplicationArns() { if (applicationArns == null) { applicationArns = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return applicationArns; } }
public class class_name { public static VectorTile.Tile.GeomType toGeomType(Geometry geometry) { VectorTile.Tile.GeomType result = VectorTile.Tile.GeomType.UNKNOWN; if(geometry instanceof Point || geometry instanceof MultiPoint) { result = VectorTile.Tile.GeomType.POINT; } else if(geometry instanceof LineString || geometry instanceof MultiLineString) { result = VectorTile.Tile.GeomType.LINESTRING; } else if(geometry instanceof Polygon || geometry instanceof MultiPolygon) { result = VectorTile.Tile.GeomType.POLYGON; } return result; } }
public class class_name { public static VectorTile.Tile.GeomType toGeomType(Geometry geometry) { VectorTile.Tile.GeomType result = VectorTile.Tile.GeomType.UNKNOWN; if(geometry instanceof Point || geometry instanceof MultiPoint) { result = VectorTile.Tile.GeomType.POINT; // depends on control dependency: [if], data = [none] } else if(geometry instanceof LineString || geometry instanceof MultiLineString) { result = VectorTile.Tile.GeomType.LINESTRING; // depends on control dependency: [if], data = [none] } else if(geometry instanceof Polygon || geometry instanceof MultiPolygon) { result = VectorTile.Tile.GeomType.POLYGON; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { private void init() { if (x == null) { x = new double[z[0].length]; for (int i = 0; i < x.length; i++) { x[i] = i + 0.5; } } if (y == null) { y = new double[z.length]; for (int i = 0; i < y.length; i++) { y[i] = y.length - i - 0.5; } } // In case of outliers, we use 1% and 99% quantiles as lower and // upper limits instead of min and max. int n = z.length * z[0].length; double[] values = new double[n]; int i = 0; for (double[] zi : z) { for (double zij : zi) { if (!Double.isNaN(zij)) { values[i++] = zij; } } } if (i > 0) { Arrays.sort(values, 0, i); min = values[(int)Math.round(0.01 * i)]; max = values[(int)Math.round(0.99 * (i-1))]; width = (max - min) / palette.length; } } }
public class class_name { private void init() { if (x == null) { x = new double[z[0].length]; // depends on control dependency: [if], data = [none] for (int i = 0; i < x.length; i++) { x[i] = i + 0.5; // depends on control dependency: [for], data = [i] } } if (y == null) { y = new double[z.length]; // depends on control dependency: [if], data = [none] for (int i = 0; i < y.length; i++) { y[i] = y.length - i - 0.5; // depends on control dependency: [for], data = [i] } } // In case of outliers, we use 1% and 99% quantiles as lower and // upper limits instead of min and max. int n = z.length * z[0].length; double[] values = new double[n]; int i = 0; for (double[] zi : z) { for (double zij : zi) { if (!Double.isNaN(zij)) { values[i++] = zij; // depends on control dependency: [if], data = [none] } } } if (i > 0) { Arrays.sort(values, 0, i); // depends on control dependency: [if], data = [none] min = values[(int)Math.round(0.01 * i)]; // depends on control dependency: [if], data = [(i] max = values[(int)Math.round(0.99 * (i-1))]; // depends on control dependency: [if], data = [(i] width = (max - min) / palette.length; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public Set<String> getSwappableAttributes(ExternalContext externalContext) { final PortletRequest portletRequest = (PortletRequest) externalContext.getNativeRequest(); final PortletPreferences preferences = portletRequest.getPreferences(); final Set<String> swappableAttributes; // Use prefs configured list if available final String[] configuredAttributes = preferences.getValues(ATTRIBUTE_SWAPPER_ATTRIBUTES_FORM_SWAPPABLE_ATTRIBUTES, null); final String[] excludedAttributes = preferences.getValues( ATTRIBUTE_SWAPPER_ATTRIBUTES_FORM_SWAPPABLE_ATTRIBUTES_EXCLUDES, null); if (configuredAttributes != null) { swappableAttributes = new LinkedHashSet<String>(Arrays.asList(configuredAttributes)); } else { // If no prefs try the 'possibleUserAttributeNames' from the IPersonAttributeDao final Set<String> possibleAttributes = this.portalRootPersonAttributeDao.getPossibleUserAttributeNames(); if (possibleAttributes != null) { swappableAttributes = new TreeSet<String>(possibleAttributes); } // If no possible names try getting the current user's attributes and use the key set else { final Principal currentUser = externalContext.getCurrentUser(); final IPersonAttributes baseUserAttributes = this.getOriginalUserAttributes(currentUser.getName()); if (baseUserAttributes != null) { final Map<String, List<Object>> attributes = baseUserAttributes.getAttributes(); swappableAttributes = new LinkedHashSet<String>(attributes.keySet()); } else { swappableAttributes = Collections.emptySet(); } } } if (excludedAttributes != null) { for (final String excludedAttribute : excludedAttributes) { swappableAttributes.remove(excludedAttribute); } } return swappableAttributes; } }
public class class_name { @Override public Set<String> getSwappableAttributes(ExternalContext externalContext) { final PortletRequest portletRequest = (PortletRequest) externalContext.getNativeRequest(); final PortletPreferences preferences = portletRequest.getPreferences(); final Set<String> swappableAttributes; // Use prefs configured list if available final String[] configuredAttributes = preferences.getValues(ATTRIBUTE_SWAPPER_ATTRIBUTES_FORM_SWAPPABLE_ATTRIBUTES, null); final String[] excludedAttributes = preferences.getValues( ATTRIBUTE_SWAPPER_ATTRIBUTES_FORM_SWAPPABLE_ATTRIBUTES_EXCLUDES, null); if (configuredAttributes != null) { swappableAttributes = new LinkedHashSet<String>(Arrays.asList(configuredAttributes)); // depends on control dependency: [if], data = [(configuredAttributes] } else { // If no prefs try the 'possibleUserAttributeNames' from the IPersonAttributeDao final Set<String> possibleAttributes = this.portalRootPersonAttributeDao.getPossibleUserAttributeNames(); if (possibleAttributes != null) { swappableAttributes = new TreeSet<String>(possibleAttributes); // depends on control dependency: [if], data = [(possibleAttributes] } // If no possible names try getting the current user's attributes and use the key set else { final Principal currentUser = externalContext.getCurrentUser(); final IPersonAttributes baseUserAttributes = this.getOriginalUserAttributes(currentUser.getName()); if (baseUserAttributes != null) { final Map<String, List<Object>> attributes = baseUserAttributes.getAttributes(); swappableAttributes = new LinkedHashSet<String>(attributes.keySet()); // depends on control dependency: [if], data = [none] } else { swappableAttributes = Collections.emptySet(); // depends on control dependency: [if], data = [none] } } } if (excludedAttributes != null) { for (final String excludedAttribute : excludedAttributes) { swappableAttributes.remove(excludedAttribute); // depends on control dependency: [for], data = [excludedAttribute] } } return swappableAttributes; } }
public class class_name { public void setCollections(java.util.Collection<HistoricalMetricData> collections) { if (collections == null) { this.collections = null; return; } this.collections = new java.util.ArrayList<HistoricalMetricData>(collections); } }
public class class_name { public void setCollections(java.util.Collection<HistoricalMetricData> collections) { if (collections == null) { this.collections = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.collections = new java.util.ArrayList<HistoricalMetricData>(collections); } }
public class class_name { public static MutableRoaringBitmap horizontal_or(ImmutableRoaringBitmap... bitmaps) { MutableRoaringBitmap answer = new MutableRoaringBitmap(); if (bitmaps.length == 0) { return answer; } PriorityQueue<MappeableContainerPointer> pq = new PriorityQueue<>(bitmaps.length); for (int k = 0; k < bitmaps.length; ++k) { MappeableContainerPointer x = bitmaps[k].highLowContainer.getContainerPointer(); if (x.getContainer() != null) { pq.add(x); } } while (!pq.isEmpty()) { MappeableContainerPointer x1 = pq.poll(); if (pq.isEmpty() || (pq.peek().key() != x1.key())) { answer.getMappeableRoaringArray().append(x1.key(), x1.getContainer().clone()); x1.advance(); if (x1.getContainer() != null) { pq.add(x1); } continue; } MappeableContainerPointer x2 = pq.poll(); MappeableContainer newc = x1.getContainer().lazyOR(x2.getContainer()); while (!pq.isEmpty() && (pq.peek().key() == x1.key())) { MappeableContainerPointer x = pq.poll(); newc = newc.lazyIOR(x.getContainer()); x.advance(); if (x.getContainer() != null) { pq.add(x); } else if (pq.isEmpty()) { break; } } newc = newc.repairAfterLazy(); answer.getMappeableRoaringArray().append(x1.key(), newc); x1.advance(); if (x1.getContainer() != null) { pq.add(x1); } x2.advance(); if (x2.getContainer() != null) { pq.add(x2); } } return answer; } }
public class class_name { public static MutableRoaringBitmap horizontal_or(ImmutableRoaringBitmap... bitmaps) { MutableRoaringBitmap answer = new MutableRoaringBitmap(); if (bitmaps.length == 0) { return answer; // depends on control dependency: [if], data = [none] } PriorityQueue<MappeableContainerPointer> pq = new PriorityQueue<>(bitmaps.length); for (int k = 0; k < bitmaps.length; ++k) { MappeableContainerPointer x = bitmaps[k].highLowContainer.getContainerPointer(); if (x.getContainer() != null) { pq.add(x); // depends on control dependency: [if], data = [none] } } while (!pq.isEmpty()) { MappeableContainerPointer x1 = pq.poll(); if (pq.isEmpty() || (pq.peek().key() != x1.key())) { answer.getMappeableRoaringArray().append(x1.key(), x1.getContainer().clone()); // depends on control dependency: [if], data = [none] x1.advance(); // depends on control dependency: [if], data = [none] if (x1.getContainer() != null) { pq.add(x1); // depends on control dependency: [if], data = [none] } continue; } MappeableContainerPointer x2 = pq.poll(); MappeableContainer newc = x1.getContainer().lazyOR(x2.getContainer()); while (!pq.isEmpty() && (pq.peek().key() == x1.key())) { MappeableContainerPointer x = pq.poll(); newc = newc.lazyIOR(x.getContainer()); // depends on control dependency: [while], data = [none] x.advance(); // depends on control dependency: [while], data = [none] if (x.getContainer() != null) { pq.add(x); // depends on control dependency: [if], data = [none] } else if (pq.isEmpty()) { break; } } newc = newc.repairAfterLazy(); // depends on control dependency: [while], data = [none] answer.getMappeableRoaringArray().append(x1.key(), newc); // depends on control dependency: [while], data = [none] x1.advance(); // depends on control dependency: [while], data = [none] if (x1.getContainer() != null) { pq.add(x1); // depends on control dependency: [if], data = [none] } x2.advance(); // depends on control dependency: [while], data = [none] if (x2.getContainer() != null) { pq.add(x2); // depends on control dependency: [if], data = [none] } } return answer; } }
public class class_name { public T get(final int key) { final int hash = hashOf(key); int index = hash & mask; if (containsKey(key, index)) { return (T)values[index]; } if (states[index] == FREE) { return missingEntries; } int j = index; for (int perturb = perturb(hash); states[index] != FREE; perturb >>= PERTURB_SHIFT) { j = probe(perturb, j); index = j & mask; if (containsKey(key, index)) { return (T)values[index]; } } return missingEntries; } }
public class class_name { public T get(final int key) { final int hash = hashOf(key); int index = hash & mask; if (containsKey(key, index)) { return (T)values[index]; // depends on control dependency: [if], data = [none] } if (states[index] == FREE) { return missingEntries; // depends on control dependency: [if], data = [none] } int j = index; for (int perturb = perturb(hash); states[index] != FREE; perturb >>= PERTURB_SHIFT) { j = probe(perturb, j); // depends on control dependency: [for], data = [perturb] index = j & mask; // depends on control dependency: [for], data = [none] if (containsKey(key, index)) { return (T)values[index]; // depends on control dependency: [if], data = [none] } } return missingEntries; } }
public class class_name { public static Instance getInstance(String type, Class<?> clazz, String algorithm) throws NoSuchAlgorithmException { // in the almost all cases, the first service will work // avoid taking long path if so ProviderList list = Providers.getProviderList(); Service firstService = list.getService(type, algorithm); if (firstService == null) { throw new NoSuchAlgorithmException (algorithm + " " + type + " not available"); } NoSuchAlgorithmException failure; try { return getInstance(firstService, clazz); } catch (NoSuchAlgorithmException e) { failure = e; } // if we cannot get the service from the preferred provider, // fail over to the next for (Service s : list.getServices(type, algorithm)) { if (s == firstService) { // do not retry initial failed service continue; } try { return getInstance(s, clazz); } catch (NoSuchAlgorithmException e) { failure = e; } } throw failure; } }
public class class_name { public static Instance getInstance(String type, Class<?> clazz, String algorithm) throws NoSuchAlgorithmException { // in the almost all cases, the first service will work // avoid taking long path if so ProviderList list = Providers.getProviderList(); Service firstService = list.getService(type, algorithm); if (firstService == null) { throw new NoSuchAlgorithmException (algorithm + " " + type + " not available"); } NoSuchAlgorithmException failure; try { return getInstance(firstService, clazz); } catch (NoSuchAlgorithmException e) { failure = e; } // if we cannot get the service from the preferred provider, // fail over to the next for (Service s : list.getServices(type, algorithm)) { if (s == firstService) { // do not retry initial failed service continue; } try { return getInstance(s, clazz); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException e) { failure = e; } // depends on control dependency: [catch], data = [none] } throw failure; } }
public class class_name { public static Method findMethod(Class<?> type, String name, Class<?>... parameterTypes) { while (type != null) { try { return type.getDeclaredMethod(name, parameterTypes); } catch (Exception e) { } type = type.getSuperclass(); } return null; } }
public class class_name { public static Method findMethod(Class<?> type, String name, Class<?>... parameterTypes) { while (type != null) { try { return type.getDeclaredMethod(name, parameterTypes); // depends on control dependency: [try], data = [none] } catch (Exception e) { } // depends on control dependency: [catch], data = [none] type = type.getSuperclass(); // depends on control dependency: [while], data = [none] } return null; } }
public class class_name { public static Enumeration getRequestLocales(HttpServletRequest request) { Enumeration values = request.getHeaders("accept-language"); if (values == null) { // No header for "accept-language". Simply return // a new empty enumeration. // System.out.println("Null accept-language"); return new Vector().elements(); } else if (values.hasMoreElements()) { // At least one "accept-language". Simply return // the enumeration returned by request.getLocales(). // System.out.println("At least one accept-language"); return request.getLocales(); } else { // No header for "accept-language". Simply return // the empty enumeration. // System.out.println("No accept-language"); return values; } } }
public class class_name { public static Enumeration getRequestLocales(HttpServletRequest request) { Enumeration values = request.getHeaders("accept-language"); if (values == null) { // No header for "accept-language". Simply return // a new empty enumeration. // System.out.println("Null accept-language"); return new Vector().elements(); // depends on control dependency: [if], data = [none] } else if (values.hasMoreElements()) { // At least one "accept-language". Simply return // the enumeration returned by request.getLocales(). // System.out.println("At least one accept-language"); return request.getLocales(); // depends on control dependency: [if], data = [none] } else { // No header for "accept-language". Simply return // the empty enumeration. // System.out.println("No accept-language"); return values; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public String encodeURL(String url) { SessionInfo info = this.request.getSessionInfo(); if (null == info || !info.getSessionConfig().isURLRewriting()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "encodeURL: no session update needed"); } return url; } if (null == info.getSession()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "encodeURL: no session found"); } return url; } return SessionInfo.encodeURL(url, info); } }
public class class_name { @Override public String encodeURL(String url) { SessionInfo info = this.request.getSessionInfo(); if (null == info || !info.getSessionConfig().isURLRewriting()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "encodeURL: no session update needed"); // depends on control dependency: [if], data = [none] } return url; // depends on control dependency: [if], data = [none] } if (null == info.getSession()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "encodeURL: no session found"); // depends on control dependency: [if], data = [none] } return url; // depends on control dependency: [if], data = [none] } return SessionInfo.encodeURL(url, info); } }
public class class_name { public static Locale getLocale(final String anEncoding) { Locale aLocale = null; String country = null; String language = null; String variant; //Tokenize the string using "-" as the token string as per IETF RFC4646 (superceeds RFC3066). final StringTokenizer tokenizer = new StringTokenizer(anEncoding, "-"); //We need to know how many tokens we have so we can create a Locale object with the proper constructor. final int numberOfTokens = tokenizer.countTokens(); if (numberOfTokens == 1) { final String tempString = tokenizer.nextToken().toLowerCase(); //Note: Newer XML parsers should throw an error if the xml:lang value contains //underscore. But this is not guaranteed. //Check to see if some one used "en_US" instead of "en-US". //If so, the first token will contain "en_US" or "xxx_YYYYYYYY". In this case, //we will only grab the value for xxx. final int underscoreIndex = tempString.indexOf("_"); if (underscoreIndex == -1) { language = tempString; } else if (underscoreIndex == 2 || underscoreIndex == 3) { //check is first subtag is two or three characters in length. language = tempString.substring(0, underscoreIndex); } aLocale = new Locale(language); } else if (numberOfTokens == 2) { language = tokenizer.nextToken().toLowerCase(); final String subtag2 = tokenizer.nextToken(); //All country tags should be three characters or less. //If the subtag is longer than three characters, it assumes that //is a dialect or variant. if (subtag2.length() <= 3) { country = subtag2.toUpperCase(); aLocale = new Locale(language, country); } else if (subtag2.length() > 3 && subtag2.length() <= 8) { variant = subtag2; aLocale = new Locale(language, "", variant); } else if (subtag2.length() > 8) { //return an error! } } else if (numberOfTokens >= 3) { language = tokenizer.nextToken().toLowerCase(); final String subtag2 = tokenizer.nextToken(); if (subtag2.length() <= 3) { country = subtag2.toUpperCase(); } else if (subtag2.length() > 3 && subtag2.length() <= 8) { } else if (subtag2.length() > 8) { //return an error! } variant = tokenizer.nextToken(); aLocale = new Locale(language, country, variant); } else { //return an warning or do nothing. //The xml:lang attribute is empty. aLocale = new Locale(LANGUAGE_EN, COUNTRY_US); } return aLocale; } }
public class class_name { public static Locale getLocale(final String anEncoding) { Locale aLocale = null; String country = null; String language = null; String variant; //Tokenize the string using "-" as the token string as per IETF RFC4646 (superceeds RFC3066). final StringTokenizer tokenizer = new StringTokenizer(anEncoding, "-"); //We need to know how many tokens we have so we can create a Locale object with the proper constructor. final int numberOfTokens = tokenizer.countTokens(); if (numberOfTokens == 1) { final String tempString = tokenizer.nextToken().toLowerCase(); //Note: Newer XML parsers should throw an error if the xml:lang value contains //underscore. But this is not guaranteed. //Check to see if some one used "en_US" instead of "en-US". //If so, the first token will contain "en_US" or "xxx_YYYYYYYY". In this case, //we will only grab the value for xxx. final int underscoreIndex = tempString.indexOf("_"); if (underscoreIndex == -1) { language = tempString; // depends on control dependency: [if], data = [none] } else if (underscoreIndex == 2 || underscoreIndex == 3) { //check is first subtag is two or three characters in length. language = tempString.substring(0, underscoreIndex); // depends on control dependency: [if], data = [none] } aLocale = new Locale(language); // depends on control dependency: [if], data = [none] } else if (numberOfTokens == 2) { language = tokenizer.nextToken().toLowerCase(); // depends on control dependency: [if], data = [none] final String subtag2 = tokenizer.nextToken(); //All country tags should be three characters or less. //If the subtag is longer than three characters, it assumes that //is a dialect or variant. if (subtag2.length() <= 3) { country = subtag2.toUpperCase(); // depends on control dependency: [if], data = [none] aLocale = new Locale(language, country); // depends on control dependency: [if], data = [none] } else if (subtag2.length() > 3 && subtag2.length() <= 8) { variant = subtag2; // depends on control dependency: [if], data = [none] aLocale = new Locale(language, "", variant); // depends on control dependency: [if], data = [none] } else if (subtag2.length() > 8) { //return an error! } } else if (numberOfTokens >= 3) { language = tokenizer.nextToken().toLowerCase(); // depends on control dependency: [if], data = [none] final String subtag2 = tokenizer.nextToken(); if (subtag2.length() <= 3) { country = subtag2.toUpperCase(); // depends on control dependency: [if], data = [none] } else if (subtag2.length() > 3 && subtag2.length() <= 8) { } else if (subtag2.length() > 8) { //return an error! } variant = tokenizer.nextToken(); // depends on control dependency: [if], data = [none] aLocale = new Locale(language, country, variant); // depends on control dependency: [if], data = [none] } else { //return an warning or do nothing. //The xml:lang attribute is empty. aLocale = new Locale(LANGUAGE_EN, COUNTRY_US); // depends on control dependency: [if], data = [none] } return aLocale; } }
public class class_name { public static List<BoxTermsOfServiceUserStatus.Info> getInfo(final BoxAPIConnection api, String termsOfServiceID, String userID) { QueryStringBuilder builder = new QueryStringBuilder(); builder.appendParam("tos_id", termsOfServiceID); if (userID != null) { builder.appendParam("user_id", userID); } URL url = ALL_TERMS_OF_SERVICE_USER_STATUSES_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()); BoxAPIRequest request = new BoxAPIRequest(api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); int totalCount = responseJSON.get("total_count").asInt(); List<BoxTermsOfServiceUserStatus.Info> termsOfServiceUserStatuses = new ArrayList<BoxTermsOfServiceUserStatus.Info>(totalCount); JsonArray entries = responseJSON.get("entries").asArray(); for (JsonValue value : entries) { JsonObject termsOfServiceUserStatusJSON = value.asObject(); BoxTermsOfServiceUserStatus termsOfServiceUserStatus = new BoxTermsOfServiceUserStatus(api, termsOfServiceUserStatusJSON.get("id").asString()); BoxTermsOfServiceUserStatus.Info info = termsOfServiceUserStatus.new Info(termsOfServiceUserStatusJSON); termsOfServiceUserStatuses.add(info); } return termsOfServiceUserStatuses; } }
public class class_name { public static List<BoxTermsOfServiceUserStatus.Info> getInfo(final BoxAPIConnection api, String termsOfServiceID, String userID) { QueryStringBuilder builder = new QueryStringBuilder(); builder.appendParam("tos_id", termsOfServiceID); if (userID != null) { builder.appendParam("user_id", userID); // depends on control dependency: [if], data = [none] } URL url = ALL_TERMS_OF_SERVICE_USER_STATUSES_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()); BoxAPIRequest request = new BoxAPIRequest(api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); int totalCount = responseJSON.get("total_count").asInt(); List<BoxTermsOfServiceUserStatus.Info> termsOfServiceUserStatuses = new ArrayList<BoxTermsOfServiceUserStatus.Info>(totalCount); JsonArray entries = responseJSON.get("entries").asArray(); for (JsonValue value : entries) { JsonObject termsOfServiceUserStatusJSON = value.asObject(); BoxTermsOfServiceUserStatus termsOfServiceUserStatus = new BoxTermsOfServiceUserStatus(api, termsOfServiceUserStatusJSON.get("id").asString()); BoxTermsOfServiceUserStatus.Info info = termsOfServiceUserStatus.new Info(termsOfServiceUserStatusJSON); termsOfServiceUserStatuses.add(info); // depends on control dependency: [for], data = [none] } return termsOfServiceUserStatuses; } }
public class class_name { public static FileBatch readFromZip(InputStream is) throws IOException { String originalUris = null; Map<Integer, byte[]> bytesMap = new HashMap<>(); try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(is))) { ZipEntry ze; while ((ze = zis.getNextEntry()) != null) { String name = ze.getName(); byte[] bytes = IOUtils.toByteArray(zis); if (name.equals(ORIGINAL_PATHS_FILENAME)) { originalUris = new String(bytes, 0, bytes.length, StandardCharsets.UTF_8); } else { int idxSplit = name.indexOf("_"); int idxSplit2 = name.indexOf("."); int fileIdx = Integer.parseInt(name.substring(idxSplit + 1, idxSplit2)); bytesMap.put(fileIdx, bytes); } } } List<byte[]> list = new ArrayList<>(bytesMap.size()); for (int i = 0; i < bytesMap.size(); i++) { list.add(bytesMap.get(i)); } List<String> origPaths = Arrays.asList(originalUris.split("\n")); return new FileBatch(list, origPaths); } }
public class class_name { public static FileBatch readFromZip(InputStream is) throws IOException { String originalUris = null; Map<Integer, byte[]> bytesMap = new HashMap<>(); try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(is))) { ZipEntry ze; while ((ze = zis.getNextEntry()) != null) { String name = ze.getName(); byte[] bytes = IOUtils.toByteArray(zis); if (name.equals(ORIGINAL_PATHS_FILENAME)) { originalUris = new String(bytes, 0, bytes.length, StandardCharsets.UTF_8); // depends on control dependency: [if], data = [none] } else { int idxSplit = name.indexOf("_"); int idxSplit2 = name.indexOf("."); int fileIdx = Integer.parseInt(name.substring(idxSplit + 1, idxSplit2)); bytesMap.put(fileIdx, bytes); // depends on control dependency: [if], data = [none] } } } List<byte[]> list = new ArrayList<>(bytesMap.size()); for (int i = 0; i < bytesMap.size(); i++) { list.add(bytesMap.get(i)); } List<String> origPaths = Arrays.asList(originalUris.split("\n")); return new FileBatch(list, origPaths); } }
public class class_name { protected Map<String, List<String>> decodeParameters(String queryString) { Map<String, List<String>> parms = new HashMap<String, List<String>>(); if (queryString != null) { StringTokenizer st = new StringTokenizer(queryString, "&"); while (st.hasMoreTokens()) { String e = st.nextToken(); int sep = e.indexOf('='); String propertyName = (sep >= 0) ? decodePercent(e.substring(0, sep)).trim() : decodePercent(e).trim(); if (!parms.containsKey(propertyName)) { parms.put(propertyName, new ArrayList<String>()); } String propertyValue = (sep >= 0) ? decodePercent(e.substring(sep + 1)) : null; if (propertyValue != null) { parms.get(propertyName).add(propertyValue); } } } return parms; } }
public class class_name { protected Map<String, List<String>> decodeParameters(String queryString) { Map<String, List<String>> parms = new HashMap<String, List<String>>(); if (queryString != null) { StringTokenizer st = new StringTokenizer(queryString, "&"); while (st.hasMoreTokens()) { String e = st.nextToken(); int sep = e.indexOf('='); String propertyName = (sep >= 0) ? decodePercent(e.substring(0, sep)).trim() : decodePercent(e).trim(); if (!parms.containsKey(propertyName)) { parms.put(propertyName, new ArrayList<String>()); // depends on control dependency: [if], data = [none] } String propertyValue = (sep >= 0) ? decodePercent(e.substring(sep + 1)) : null; if (propertyValue != null) { parms.get(propertyName).add(propertyValue); // depends on control dependency: [if], data = [(propertyValue] } } } return parms; } }
public class class_name { public static Locale convertLanguageToLocale(final String planguage) { final Locale locale; if (planguage == null) { locale = null; } else { final String localeStringUp = planguage.toUpperCase().replace('-', '_'); if (LocaleUtil.DEFAULT_MAP.containsKey(localeStringUp)) { locale = LocaleUtil.DEFAULT_MAP.get(localeStringUp); } else if (localeStringUp.contains("_")) { final String[] lcoaleSplitted = localeStringUp.split("_"); if (lcoaleSplitted.length > 2) { locale = new Locale(lcoaleSplitted[0].toLowerCase(), lcoaleSplitted[1], lcoaleSplitted[2]); } else { locale = new Locale(lcoaleSplitted[0].toLowerCase(), lcoaleSplitted[1]); } } else { locale = new Locale(planguage); } } return locale; } }
public class class_name { public static Locale convertLanguageToLocale(final String planguage) { final Locale locale; if (planguage == null) { locale = null; // depends on control dependency: [if], data = [none] } else { final String localeStringUp = planguage.toUpperCase().replace('-', '_'); if (LocaleUtil.DEFAULT_MAP.containsKey(localeStringUp)) { locale = LocaleUtil.DEFAULT_MAP.get(localeStringUp); // depends on control dependency: [if], data = [none] } else if (localeStringUp.contains("_")) { final String[] lcoaleSplitted = localeStringUp.split("_"); if (lcoaleSplitted.length > 2) { locale = new Locale(lcoaleSplitted[0].toLowerCase(), lcoaleSplitted[1], lcoaleSplitted[2]); // depends on control dependency: [if], data = [none] } else { locale = new Locale(lcoaleSplitted[0].toLowerCase(), lcoaleSplitted[1]); // depends on control dependency: [if], data = [none] } } else { locale = new Locale(planguage); // depends on control dependency: [if], data = [none] } } return locale; } }
public class class_name { public void marshall(CreateDirectConnectGatewayAssociationRequest createDirectConnectGatewayAssociationRequest, ProtocolMarshaller protocolMarshaller) { if (createDirectConnectGatewayAssociationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createDirectConnectGatewayAssociationRequest.getDirectConnectGatewayId(), DIRECTCONNECTGATEWAYID_BINDING); protocolMarshaller.marshall(createDirectConnectGatewayAssociationRequest.getGatewayId(), GATEWAYID_BINDING); protocolMarshaller.marshall(createDirectConnectGatewayAssociationRequest.getAddAllowedPrefixesToDirectConnectGateway(), ADDALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_BINDING); protocolMarshaller.marshall(createDirectConnectGatewayAssociationRequest.getVirtualGatewayId(), VIRTUALGATEWAYID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateDirectConnectGatewayAssociationRequest createDirectConnectGatewayAssociationRequest, ProtocolMarshaller protocolMarshaller) { if (createDirectConnectGatewayAssociationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createDirectConnectGatewayAssociationRequest.getDirectConnectGatewayId(), DIRECTCONNECTGATEWAYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createDirectConnectGatewayAssociationRequest.getGatewayId(), GATEWAYID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createDirectConnectGatewayAssociationRequest.getAddAllowedPrefixesToDirectConnectGateway(), ADDALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createDirectConnectGatewayAssociationRequest.getVirtualGatewayId(), VIRTUALGATEWAYID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static int[] make_crc_table() { int[] crc_table = new int[256]; for (int n = 0; n < 256; n++) { int c = n; for (int k = 8; --k >= 0; ) { if ((c & 1) != 0) c = 0xedb88320 ^ (c >>> 1); else c = c >>> 1; } crc_table[n] = c; } return crc_table; } }
public class class_name { private static int[] make_crc_table() { int[] crc_table = new int[256]; for (int n = 0; n < 256; n++) { int c = n; for (int k = 8; --k >= 0; ) { if ((c & 1) != 0) c = 0xedb88320 ^ (c >>> 1); else c = c >>> 1; } crc_table[n] = c; // depends on control dependency: [for], data = [n] } return crc_table; } }
public class class_name { @Override public NodeInfo getParent() { try { NodeInfo parent = null; final INodeReadTrx rtx = createRtxAndMove(); if (rtx.getNode().hasParent()) { // Parent transaction. parent = new NodeWrapper(mDocWrapper, rtx.getNode().getParentKey()); } rtx.close(); return parent; } catch (final TTException exc) { LOGGER.error(exc.toString()); return null; } } }
public class class_name { @Override public NodeInfo getParent() { try { NodeInfo parent = null; final INodeReadTrx rtx = createRtxAndMove(); if (rtx.getNode().hasParent()) { // Parent transaction. parent = new NodeWrapper(mDocWrapper, rtx.getNode().getParentKey()); // depends on control dependency: [if], data = [none] } rtx.close(); // depends on control dependency: [try], data = [none] return parent; // depends on control dependency: [try], data = [none] } catch (final TTException exc) { LOGGER.error(exc.toString()); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Node<ColumnName> advance(int goalRow) { ColumnHeader<ColumnName> col = findBestColumn(); if (col.size > 0) { coverColumn(col); Node<ColumnName> row = col.down; int id = 0; while (row != col) { if (id == goalRow) { Node<ColumnName> node = row.right; while (node != row) { coverColumn(node.head); node = node.right; } return row; } id += 1; row = row.down; } } return null; } }
public class class_name { private Node<ColumnName> advance(int goalRow) { ColumnHeader<ColumnName> col = findBestColumn(); if (col.size > 0) { coverColumn(col); // depends on control dependency: [if], data = [none] Node<ColumnName> row = col.down; int id = 0; while (row != col) { if (id == goalRow) { Node<ColumnName> node = row.right; while (node != row) { coverColumn(node.head); // depends on control dependency: [while], data = [(node] node = node.right; // depends on control dependency: [while], data = [none] } return row; // depends on control dependency: [if], data = [none] } id += 1; // depends on control dependency: [while], data = [none] row = row.down; // depends on control dependency: [while], data = [none] } } return null; } }
public class class_name { private static void printEnvVariables() { System.out.println("Environment Variables: "); Map<String,String> map = System.getenv(); Set<Entry<String, String>> entrySet = map.entrySet(); for(Entry<String, String> entry : entrySet) { System.out.println(entry.getKey() + " = " + entry.getValue()); } } }
public class class_name { private static void printEnvVariables() { System.out.println("Environment Variables: "); Map<String,String> map = System.getenv(); Set<Entry<String, String>> entrySet = map.entrySet(); for(Entry<String, String> entry : entrySet) { System.out.println(entry.getKey() + " = " + entry.getValue()); // depends on control dependency: [for], data = [entry] } } }
public class class_name { @Override public List<IScan> getScansByRtUpper(double rt) { Map.Entry<Double, List<IScan>> ceilingEntry = getMapRt2scan().ceilingEntry(rt); if (ceilingEntry == null) { return null; } List<IScan> scans = ceilingEntry.getValue(); if (scans != null) { return scans; } return null; } }
public class class_name { @Override public List<IScan> getScansByRtUpper(double rt) { Map.Entry<Double, List<IScan>> ceilingEntry = getMapRt2scan().ceilingEntry(rt); if (ceilingEntry == null) { return null; // depends on control dependency: [if], data = [none] } List<IScan> scans = ceilingEntry.getValue(); if (scans != null) { return scans; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public DescribeTagsRequest withFilters(TagFilter... filters) { if (this.filters == null) { setFilters(new java.util.ArrayList<TagFilter>(filters.length)); } for (TagFilter ele : filters) { this.filters.add(ele); } return this; } }
public class class_name { public DescribeTagsRequest withFilters(TagFilter... filters) { if (this.filters == null) { setFilters(new java.util.ArrayList<TagFilter>(filters.length)); // depends on control dependency: [if], data = [none] } for (TagFilter ele : filters) { this.filters.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private void synchronizedRecordResult(CircuitBreakerResult result) { synchronized (this) { switch (state.get()) { case CLOSED: rollingWindow.record(result); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Recording result {0} in closed state: {1}", result, rollingWindow); } if (rollingWindow.isOverThreshold()) { stateOpen(); } break; case HALF_OPEN: if (result == CircuitBreakerResult.FAILURE) { stateOpen(); } else { halfOpenRunningExecutions--; halfOpenSuccessfulExecutions++; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Recording result {0} in half-open state. Running executions: {1}, Current results: ({2}/{3})", result, halfOpenRunningExecutions, halfOpenSuccessfulExecutions, policy.getSuccessThreshold()); } if (halfOpenSuccessfulExecutions >= policy.getSuccessThreshold()) { stateClosed(); } } break; case OPEN: if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Recording result {0} in open state", result); } // Nothing else to do break; } } } }
public class class_name { private void synchronizedRecordResult(CircuitBreakerResult result) { synchronized (this) { switch (state.get()) { case CLOSED: rollingWindow.record(result); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Recording result {0} in closed state: {1}", result, rollingWindow); // depends on control dependency: [if], data = [none] } if (rollingWindow.isOverThreshold()) { stateOpen(); // depends on control dependency: [if], data = [none] } break; case HALF_OPEN: if (result == CircuitBreakerResult.FAILURE) { stateOpen(); // depends on control dependency: [if], data = [none] } else { halfOpenRunningExecutions--; // depends on control dependency: [if], data = [none] halfOpenSuccessfulExecutions++; // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Recording result {0} in half-open state. Running executions: {1}, Current results: ({2}/{3})", result, halfOpenRunningExecutions, halfOpenSuccessfulExecutions, policy.getSuccessThreshold()); // depends on control dependency: [if], data = [none] } if (halfOpenSuccessfulExecutions >= policy.getSuccessThreshold()) { stateClosed(); // depends on control dependency: [if], data = [none] } } break; case OPEN: if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Recording result {0} in open state", result); // depends on control dependency: [if], data = [none] } // Nothing else to do break; } } } }
public class class_name { @Override public IPromise<T> thenAnd(Supplier<IPromise<T>> callable) { Promise res = new Promise<>(); then( new Callback<T>() { @Override public void complete(T result, Object error) { if ( Actor.isError(error) ) { res.complete(null, error); } else { IPromise<T> call = null; call = callable.get().then(res); } } }); return res; } }
public class class_name { @Override public IPromise<T> thenAnd(Supplier<IPromise<T>> callable) { Promise res = new Promise<>(); then( new Callback<T>() { @Override public void complete(T result, Object error) { if ( Actor.isError(error) ) { res.complete(null, error); // depends on control dependency: [if], data = [none] } else { IPromise<T> call = null; call = callable.get().then(res); // depends on control dependency: [if], data = [none] } } }); return res; } }
public class class_name { protected LaJobScheduler findAppScheduler() { final List<LaJobScheduler> schedulerList = new ArrayList<LaJobScheduler>(); // to check not found final List<String> derivedNameList = new ArrayList<String>(); // for exception message final NamingConvention convention = getNamingConvention(); for (String root : convention.getRootPackageNames()) { final String schedulerName = buildSchedulerName(root); derivedNameList.add(schedulerName); final Class<?> schedulerType; try { schedulerType = forSchedulerName(schedulerName); } catch (ClassNotFoundException ignored) { continue; } final LaJobScheduler scheduler = createScheduler(schedulerType); schedulerList.add(scheduler); } if (schedulerList.isEmpty()) { throwJobSchedulerNotFoundException(derivedNameList); } else if (schedulerList.size() >= 2) { throw new IllegalStateException("Duplicate scheduler object: " + schedulerList); } return schedulerList.get(0); } }
public class class_name { protected LaJobScheduler findAppScheduler() { final List<LaJobScheduler> schedulerList = new ArrayList<LaJobScheduler>(); // to check not found final List<String> derivedNameList = new ArrayList<String>(); // for exception message final NamingConvention convention = getNamingConvention(); for (String root : convention.getRootPackageNames()) { final String schedulerName = buildSchedulerName(root); derivedNameList.add(schedulerName); // depends on control dependency: [for], data = [none] final Class<?> schedulerType; try { schedulerType = forSchedulerName(schedulerName); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException ignored) { continue; } // depends on control dependency: [catch], data = [none] final LaJobScheduler scheduler = createScheduler(schedulerType); schedulerList.add(scheduler); // depends on control dependency: [for], data = [none] } if (schedulerList.isEmpty()) { throwJobSchedulerNotFoundException(derivedNameList); // depends on control dependency: [if], data = [none] } else if (schedulerList.size() >= 2) { throw new IllegalStateException("Duplicate scheduler object: " + schedulerList); } return schedulerList.get(0); } }
public class class_name { private static void lazyInit() { if (components==null) { components = new HashSet<Component>(); nonTerminalComps = new HashMap<Set<String>, Component>(); nTerminalAminoAcids = new HashMap<Set<String>, Component>(); cTerminalAminoAcids = new HashMap<Set<String>, Component>(); } } }
public class class_name { private static void lazyInit() { if (components==null) { components = new HashSet<Component>(); // depends on control dependency: [if], data = [none] nonTerminalComps = new HashMap<Set<String>, Component>(); // depends on control dependency: [if], data = [none] nTerminalAminoAcids = new HashMap<Set<String>, Component>(); // depends on control dependency: [if], data = [none] cTerminalAminoAcids = new HashMap<Set<String>, Component>(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean hasErrors() { if ((m_validatedNewEntry != null) && m_validatedNewEntry.hasErrors()) { return true; } for (CmsAliasTableRow row : m_changedRows) { if (row.hasErrors()) { return true; } } return false; } }
public class class_name { public boolean hasErrors() { if ((m_validatedNewEntry != null) && m_validatedNewEntry.hasErrors()) { return true; // depends on control dependency: [if], data = [none] } for (CmsAliasTableRow row : m_changedRows) { if (row.hasErrors()) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { private Entity processInteraction(Interaction interaction, Set<String> avail, Provenance pro, boolean isComplex) { Entity bpInteraction = null; //interaction or complex boolean isGeneticInteraction = false; // get interaction name/short name String name = null; String shortName = null; if (interaction.hasNames()) { Names names = interaction.getNames(); name = (names.hasFullName()) ? names.getFullName() : ""; shortName = (names.hasShortLabel()) ? names.getShortLabel() : ""; } final Set<InteractionVocabulary> interactionVocabularies = new HashSet<InteractionVocabulary>(); if (interaction.hasInteractionTypes()) { for(CvType interactionType : interaction.getInteractionTypes()) { //generate InteractionVocabulary and set interactionType InteractionVocabulary cv = findOrCreateControlledVocabulary(interactionType, InteractionVocabulary.class); if(cv != null) interactionVocabularies.add(cv); } } // using experiment descriptions, create Evidence objects // (yet, no experimental forms/roles/entities are created here) Set<Evidence> bpEvidences = new HashSet<Evidence>(); if (interaction.hasExperiments()) { bpEvidences = createBiopaxEvidences(interaction); } //A hack for e.g. IntAct or BIND "gene-protein" interactions (ChIp and EMSA experiments) // where the interactor type should probably not be 'gene' (but 'dna' or 'rna') Set<String> participantTypes = new HashSet<String>(); for(Participant p : interaction.getParticipants()) { if(p.hasInteractor()) { String type = getName(p.getInteractor().getInteractorType().getNames()); if(type==null) type = "protein"; //default type (if unspecified) participantTypes.add(type.toLowerCase()); } else if (p.hasInteraction()) { participantTypes.add("complex"); //hierarchical complex build up } // else? (impossible!) } // If there are both genes and physical entities present, let's // replace 'gene' with 'dna' (esp. true for "ch-ip", "emsa" experiments); // (this won't affect experimental form entities if experimentalInteractor element exists) if(participantTypes.size() > 1 && participantTypes.contains("gene")) { //TODO a better criteria to reliably detect whether 'gene' interactor type actually means Dna/DnaRegion or Rna/RnaRegion, or indeed Gene) LOG.warn("Interaction: " + interaction.getId() + ", name(s): " + shortName + " " + name + "; has both 'gene' and physical entity type participants: " + participantTypes + "; so we'll replace 'gene' with 'dna' (a quick fix)"); for(Participant p : interaction.getParticipants()) { if(p.hasInteractor() && p.getInteractor().getInteractorType().hasNames()) { String type = getName(p.getInteractor().getInteractorType().getNames()); if("gene".equalsIgnoreCase(type)) { p.getInteractor().getInteractorType().getNames().setShortLabel("dna"); } } } } // interate through the psi-mi participants, create corresp. biopax entities final Set<Entity> bpParticipants = new HashSet<Entity>(); for (Participant participant : interaction.getParticipants()) { // get paxtools physical entity participant and add to participant list // (this also adds experimental evidence and forms) Entity bpParticipant = createBiopaxEntity(participant, avail, pro); if (bpParticipant != null) { if(!bpParticipants.contains(bpParticipant)) bpParticipants.add(bpParticipant); } } // Process interaction attributes. final Set<String> comments = new HashSet<String>(); // Set GeneticInteraction flag. // As of BioGRID v3.1.72 (at least), genetic interaction code can reside // as an attribute of the Interaction via "BioGRID Evidence Code" key if (interaction.hasAttributes()) { for (Attribute attribute : interaction.getAttributes()) { String key = attribute.getName(); //may be reset below String value = (attribute.hasValue()) ? attribute.getValue() : ""; if(key.equalsIgnoreCase(BIOGRID_EVIDENCE_CODE) && GENETIC_INTERACTIONS.contains(value)) { isGeneticInteraction = true; // important! } comments.add(key + ":" + value); } } // or, if all participants are 'gene' type, make a biopax GeneticInteraction if(participantTypes.size() == 1 && participantTypes.contains("gene")) { isGeneticInteraction = true; } //or, check another genetic interaction flag (criteria) if(!isGeneticInteraction) { isGeneticInteraction = isGeneticInteraction(bpEvidences); } if ((isComplex || forceInteractionToComplex) && !isGeneticInteraction) { bpInteraction = createComplex(bpParticipants, interaction.getImexId(), interaction.getId()); } else if(isGeneticInteraction) { bpInteraction = createGeneticInteraction(bpParticipants, interactionVocabularies, interaction.getImexId(), interaction.getId() ); } else { bpInteraction = createMolecularInteraction(bpParticipants, interactionVocabularies, interaction.getImexId(), interaction.getId()); } for(String c : comments) { bpInteraction.addComment(c); } //add evidences to the interaction/complex bpEntity for (Evidence evidence : bpEvidences) { bpInteraction.addEvidence(evidence); //TODO: shall we add IntAct "figure legend" comment to the evidences as well? } addAvailabilityAndProvenance(bpInteraction, avail, pro); if (name != null) bpInteraction.addName(name); if (shortName != null) { if(shortName.length()<51) bpInteraction.setDisplayName(shortName); else bpInteraction.addName(shortName); } // add xrefs Set<Xref> bpXrefs = new HashSet<Xref>(); if (interaction.hasXref()) { bpXrefs.addAll(getXrefs(interaction.getXref())); } for (Xref bpXref : bpXrefs) { bpInteraction.addXref(bpXref); } return bpInteraction; } }
public class class_name { private Entity processInteraction(Interaction interaction, Set<String> avail, Provenance pro, boolean isComplex) { Entity bpInteraction = null; //interaction or complex boolean isGeneticInteraction = false; // get interaction name/short name String name = null; String shortName = null; if (interaction.hasNames()) { Names names = interaction.getNames(); name = (names.hasFullName()) ? names.getFullName() : ""; shortName = (names.hasShortLabel()) ? names.getShortLabel() : ""; // depends on control dependency: [if], data = [none] } final Set<InteractionVocabulary> interactionVocabularies = new HashSet<InteractionVocabulary>(); if (interaction.hasInteractionTypes()) { for(CvType interactionType : interaction.getInteractionTypes()) { //generate InteractionVocabulary and set interactionType InteractionVocabulary cv = findOrCreateControlledVocabulary(interactionType, InteractionVocabulary.class); if(cv != null) interactionVocabularies.add(cv); } } // using experiment descriptions, create Evidence objects // (yet, no experimental forms/roles/entities are created here) Set<Evidence> bpEvidences = new HashSet<Evidence>(); if (interaction.hasExperiments()) { bpEvidences = createBiopaxEvidences(interaction); // depends on control dependency: [if], data = [none] } //A hack for e.g. IntAct or BIND "gene-protein" interactions (ChIp and EMSA experiments) // where the interactor type should probably not be 'gene' (but 'dna' or 'rna') Set<String> participantTypes = new HashSet<String>(); for(Participant p : interaction.getParticipants()) { if(p.hasInteractor()) { String type = getName(p.getInteractor().getInteractorType().getNames()); if(type==null) type = "protein"; //default type (if unspecified) participantTypes.add(type.toLowerCase()); // depends on control dependency: [if], data = [none] } else if (p.hasInteraction()) { participantTypes.add("complex"); //hierarchical complex build up // depends on control dependency: [if], data = [none] } // else? (impossible!) } // If there are both genes and physical entities present, let's // replace 'gene' with 'dna' (esp. true for "ch-ip", "emsa" experiments); // (this won't affect experimental form entities if experimentalInteractor element exists) if(participantTypes.size() > 1 && participantTypes.contains("gene")) { //TODO a better criteria to reliably detect whether 'gene' interactor type actually means Dna/DnaRegion or Rna/RnaRegion, or indeed Gene) LOG.warn("Interaction: " + interaction.getId() + ", name(s): " + shortName + " " + name + "; has both 'gene' and physical entity type participants: " + participantTypes + "; so we'll replace 'gene' with 'dna' (a quick fix)"); // depends on control dependency: [if], data = [none] for(Participant p : interaction.getParticipants()) { if(p.hasInteractor() && p.getInteractor().getInteractorType().hasNames()) { String type = getName(p.getInteractor().getInteractorType().getNames()); if("gene".equalsIgnoreCase(type)) { p.getInteractor().getInteractorType().getNames().setShortLabel("dna"); // depends on control dependency: [if], data = [none] } } } } // interate through the psi-mi participants, create corresp. biopax entities final Set<Entity> bpParticipants = new HashSet<Entity>(); for (Participant participant : interaction.getParticipants()) { // get paxtools physical entity participant and add to participant list // (this also adds experimental evidence and forms) Entity bpParticipant = createBiopaxEntity(participant, avail, pro); if (bpParticipant != null) { if(!bpParticipants.contains(bpParticipant)) bpParticipants.add(bpParticipant); } } // Process interaction attributes. final Set<String> comments = new HashSet<String>(); // Set GeneticInteraction flag. // As of BioGRID v3.1.72 (at least), genetic interaction code can reside // as an attribute of the Interaction via "BioGRID Evidence Code" key if (interaction.hasAttributes()) { for (Attribute attribute : interaction.getAttributes()) { String key = attribute.getName(); //may be reset below String value = (attribute.hasValue()) ? attribute.getValue() : ""; if(key.equalsIgnoreCase(BIOGRID_EVIDENCE_CODE) && GENETIC_INTERACTIONS.contains(value)) { isGeneticInteraction = true; // important! } comments.add(key + ":" + value); // depends on control dependency: [for], data = [none] } } // or, if all participants are 'gene' type, make a biopax GeneticInteraction if(participantTypes.size() == 1 && participantTypes.contains("gene")) { isGeneticInteraction = true; // depends on control dependency: [if], data = [none] } //or, check another genetic interaction flag (criteria) if(!isGeneticInteraction) { isGeneticInteraction = isGeneticInteraction(bpEvidences); // depends on control dependency: [if], data = [none] } if ((isComplex || forceInteractionToComplex) && !isGeneticInteraction) { bpInteraction = createComplex(bpParticipants, interaction.getImexId(), interaction.getId()); // depends on control dependency: [if], data = [none] } else if(isGeneticInteraction) { bpInteraction = createGeneticInteraction(bpParticipants, interactionVocabularies, interaction.getImexId(), interaction.getId() ); // depends on control dependency: [if], data = [none] } else { bpInteraction = createMolecularInteraction(bpParticipants, interactionVocabularies, interaction.getImexId(), interaction.getId()); // depends on control dependency: [if], data = [none] } for(String c : comments) { bpInteraction.addComment(c); // depends on control dependency: [for], data = [c] } //add evidences to the interaction/complex bpEntity for (Evidence evidence : bpEvidences) { bpInteraction.addEvidence(evidence); // depends on control dependency: [for], data = [evidence] //TODO: shall we add IntAct "figure legend" comment to the evidences as well? } addAvailabilityAndProvenance(bpInteraction, avail, pro); if (name != null) bpInteraction.addName(name); if (shortName != null) { if(shortName.length()<51) bpInteraction.setDisplayName(shortName); else bpInteraction.addName(shortName); } // add xrefs Set<Xref> bpXrefs = new HashSet<Xref>(); if (interaction.hasXref()) { bpXrefs.addAll(getXrefs(interaction.getXref())); // depends on control dependency: [if], data = [none] } for (Xref bpXref : bpXrefs) { bpInteraction.addXref(bpXref); // depends on control dependency: [for], data = [bpXref] } return bpInteraction; } }
public class class_name { public SipTransaction sendStatefulNotify(Request req, boolean viaProxy) { setErrorMessage(""); SipTransaction transaction; synchronized (dialogLock) { transaction = phone.sendRequestWithTransaction(req, viaProxy, dialog); if (transaction == null) { setErrorMessage(phone.getErrorMessage()); return null; } // enable auth challenge handling phone.enableAuthorization(((CallIdHeader) req.getHeader(CallIdHeader.NAME)).getCallId()); dialog = transaction.getClientTransaction().getDialog(); setLastSentNotify(req); } LOG.trace("Sent NOTIFY {}", req.getHeader(ToHeader.NAME)); return transaction; } }
public class class_name { public SipTransaction sendStatefulNotify(Request req, boolean viaProxy) { setErrorMessage(""); SipTransaction transaction; synchronized (dialogLock) { transaction = phone.sendRequestWithTransaction(req, viaProxy, dialog); if (transaction == null) { setErrorMessage(phone.getErrorMessage()); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } // enable auth challenge handling phone.enableAuthorization(((CallIdHeader) req.getHeader(CallIdHeader.NAME)).getCallId()); dialog = transaction.getClientTransaction().getDialog(); setLastSentNotify(req); } LOG.trace("Sent NOTIFY {}", req.getHeader(ToHeader.NAME)); return transaction; } }
public class class_name { @Override public Object getIdentifierValue(Identifier id, boolean ignoreType, Object contextValue, boolean returnList) throws BadMessageFormatMatchingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getIdentifierValue", new Object[] { id, ignoreType, contextValue, returnList }); Object value = null; boolean dontTraceNonNullValue = false; /* Determine the messaging domain: JMS or SI Core message */ SelectorDomain domain = SelectorDomain.getSelectorDomain(id.getSelectorDomain()); // If the domain is XPATH1 .... if (domain == SelectorDomain.XPATH1) { try { // Check any contextValue is actually a Node, we will catch, FFDC & wrap it below if (contextValue != null && !(contextValue instanceof Node)) { throw new IllegalArgumentException("contextValue must be a Node"); } XPathExpression xrep = (XPathExpression) id.getCompiledExpression(); // If a list of nodes is required......... if (returnList) { if (xrep != null) { // If the contextValue is null, use payload document as the root if (contextValue == null) { contextValue = getPayloadDocument(); } if (contextValue != null) { NodeList nodeList = (NodeList) xrep.evaluate(contextValue, XPathConstants.NODESET); // Now we have to turn the NodeList (if we have one) into a real List to return if ((nodeList != null) && (nodeList.getLength() > 0)) { value = new ArrayList(nodeList.getLength()); for (int i = 0; i < nodeList.getLength(); i++) { ((ArrayList) value).add(nodeList.item(i)); } } // if the nodeList is null or empty, we just drop through to return value=null } // if contextValue is still null, we just drop through to return value=null } // if xrep == null, we just drop through to return value=null } // ... if not, we just need to return a Boolean, which is easier else { if (xrep != null) { // If the contextValue is null, use payload document as the root if (contextValue == null) { contextValue = getPayloadDocument(); } if (contextValue != null) { value = xrep.evaluate(contextValue, XPathConstants.BOOLEAN); } // Return FALSE if the the contextValue is still null else { value = Boolean.FALSE; } } else { // Return FALSE if the XPath expression is null value = Boolean.FALSE; } } } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsApiMessageImpl.getIdentifierValue", "795"); throw new BadMessageFormatMatchingException(e); } } // If the SelectorDomain is not XPATH1, we must be selecting on a named property else { /* Get the name of the identifier. */ String fieldName = id.getName(); /* Decide if the fieldName means we shouldn't trace non-null results */ dontTraceNonNullValue = PasswordUtils.containsPassword(fieldName); /* Get the value of the property: */ /* If we're processing on behalf of the Core SPI, the property can be a */ /* JMS property (starting "JMS") or an SI Core property (starting "SI_") */ /* or a user property. */ /* If we're processing a JMS message however we can have JMS properties */ /* but _not_ SI Core properties; anything else must be a user property, */ /* but only user properties of types supported by JMS are 'found'. */ /* If fieldName starts with JMS check for the JMS headers & properties */ if (fieldName.startsWith(JMS_PREFIX)) { /* If it isn't one of the properties we don't match on, get the value */ if (!(fieldName.equals(SIProperties.JMSDestination)) && !(fieldName.equals(SIProperties.JMSReplyTo)) && !(fieldName.equals(SIProperties.JMS_IBM_ExceptionMessage)) && !(fieldName.startsWith(JMS_IBM_MQMD_PREFIX))) { value = getJMSSystemProperty(fieldName, true); } } /* If we're processing on behalf of JMS, look for a JMS-type user property */ else if (domain == SelectorDomain.JMS) { /* Usually it would be in the JMS Property Map */ if (mayHaveJmsUserProperties()) { value = getJmsUserPropertyMap().get(fieldName); } /* If we haven't found the property, check for the Maelstrom wierdo */ if ((value == null) && (fieldName.equals(MfpConstants.PRP_TRANSVER))) { value = getTransportVersion(); } } /* If we're processing on behalf of the Core SPI.... */ else if (domain == SelectorDomain.SIMESSAGE) { /* If fieldName starts with SI_ it must be a header field */ if (fieldName.startsWith(SI_PREFIX)) { /* If it isn't one of the properties we don't match on, get the value */ if (!fieldName.equals(SIProperties.SI_ExceptionInserts)) { value = getSIProperty(fieldName, true); } } /* Otherwise it should start with "user." */ else if (fieldName.startsWith(USER_PREFIX)) { String remainder = fieldName.substring(USER_PREFIX_LENGTH); try { value = getUserProperty(remainder, true); } catch (Exception e) { /* No Exception can be thrown as getUserProperty was called with */ /* forMatching set to true. */ // No FFDC code needed. } } /* Otherwise, value remains null as no other fieldName is supported. */ } /* If the value existed, check it is the right type (if we care) */ if ((value != null) && (!ignoreType)) { value = typeCheck(value, id.getType()); } } // End of not-XPATH /* Value may be null after running typeCheck, even if it wasn't before! */ if (value == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getIdentifierValue", null); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getIdentifierValue", new Object[] { PasswordUtils.replacePossiblePassword(dontTraceNonNullValue, value), value.getClass() }); } return value; } }
public class class_name { @Override public Object getIdentifierValue(Identifier id, boolean ignoreType, Object contextValue, boolean returnList) throws BadMessageFormatMatchingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getIdentifierValue", new Object[] { id, ignoreType, contextValue, returnList }); Object value = null; boolean dontTraceNonNullValue = false; /* Determine the messaging domain: JMS or SI Core message */ SelectorDomain domain = SelectorDomain.getSelectorDomain(id.getSelectorDomain()); // If the domain is XPATH1 .... if (domain == SelectorDomain.XPATH1) { try { // Check any contextValue is actually a Node, we will catch, FFDC & wrap it below if (contextValue != null && !(contextValue instanceof Node)) { throw new IllegalArgumentException("contextValue must be a Node"); } XPathExpression xrep = (XPathExpression) id.getCompiledExpression(); // If a list of nodes is required......... if (returnList) { if (xrep != null) { // If the contextValue is null, use payload document as the root if (contextValue == null) { contextValue = getPayloadDocument(); // depends on control dependency: [if], data = [none] } if (contextValue != null) { NodeList nodeList = (NodeList) xrep.evaluate(contextValue, XPathConstants.NODESET); // Now we have to turn the NodeList (if we have one) into a real List to return if ((nodeList != null) && (nodeList.getLength() > 0)) { value = new ArrayList(nodeList.getLength()); // depends on control dependency: [if], data = [none] for (int i = 0; i < nodeList.getLength(); i++) { ((ArrayList) value).add(nodeList.item(i)); // depends on control dependency: [for], data = [i] } } // if the nodeList is null or empty, we just drop through to return value=null } // if contextValue is still null, we just drop through to return value=null } // if xrep == null, we just drop through to return value=null } // ... if not, we just need to return a Boolean, which is easier else { if (xrep != null) { // If the contextValue is null, use payload document as the root if (contextValue == null) { contextValue = getPayloadDocument(); // depends on control dependency: [if], data = [none] } if (contextValue != null) { value = xrep.evaluate(contextValue, XPathConstants.BOOLEAN); // depends on control dependency: [if], data = [(contextValue] } // Return FALSE if the the contextValue is still null else { value = Boolean.FALSE; // depends on control dependency: [if], data = [none] } } else { // Return FALSE if the XPath expression is null value = Boolean.FALSE; // depends on control dependency: [if], data = [none] } } } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsApiMessageImpl.getIdentifierValue", "795"); throw new BadMessageFormatMatchingException(e); } // depends on control dependency: [catch], data = [none] } // If the SelectorDomain is not XPATH1, we must be selecting on a named property else { /* Get the name of the identifier. */ String fieldName = id.getName(); /* Decide if the fieldName means we shouldn't trace non-null results */ dontTraceNonNullValue = PasswordUtils.containsPassword(fieldName); /* Get the value of the property: */ /* If we're processing on behalf of the Core SPI, the property can be a */ /* JMS property (starting "JMS") or an SI Core property (starting "SI_") */ /* or a user property. */ /* If we're processing a JMS message however we can have JMS properties */ /* but _not_ SI Core properties; anything else must be a user property, */ /* but only user properties of types supported by JMS are 'found'. */ /* If fieldName starts with JMS check for the JMS headers & properties */ if (fieldName.startsWith(JMS_PREFIX)) { /* If it isn't one of the properties we don't match on, get the value */ if (!(fieldName.equals(SIProperties.JMSDestination)) && !(fieldName.equals(SIProperties.JMSReplyTo)) && !(fieldName.equals(SIProperties.JMS_IBM_ExceptionMessage)) && !(fieldName.startsWith(JMS_IBM_MQMD_PREFIX))) { value = getJMSSystemProperty(fieldName, true); // depends on control dependency: [if], data = [none] } } /* If we're processing on behalf of JMS, look for a JMS-type user property */ else if (domain == SelectorDomain.JMS) { /* Usually it would be in the JMS Property Map */ if (mayHaveJmsUserProperties()) { value = getJmsUserPropertyMap().get(fieldName); // depends on control dependency: [if], data = [none] } /* If we haven't found the property, check for the Maelstrom wierdo */ if ((value == null) && (fieldName.equals(MfpConstants.PRP_TRANSVER))) { value = getTransportVersion(); // depends on control dependency: [if], data = [none] } } /* If we're processing on behalf of the Core SPI.... */ else if (domain == SelectorDomain.SIMESSAGE) { /* If fieldName starts with SI_ it must be a header field */ if (fieldName.startsWith(SI_PREFIX)) { /* If it isn't one of the properties we don't match on, get the value */ if (!fieldName.equals(SIProperties.SI_ExceptionInserts)) { value = getSIProperty(fieldName, true); // depends on control dependency: [if], data = [none] } } /* Otherwise it should start with "user." */ else if (fieldName.startsWith(USER_PREFIX)) { String remainder = fieldName.substring(USER_PREFIX_LENGTH); try { value = getUserProperty(remainder, true); // depends on control dependency: [try], data = [none] } catch (Exception e) { /* No Exception can be thrown as getUserProperty was called with */ /* forMatching set to true. */ // No FFDC code needed. } // depends on control dependency: [catch], data = [none] } /* Otherwise, value remains null as no other fieldName is supported. */ } /* If the value existed, check it is the right type (if we care) */ if ((value != null) && (!ignoreType)) { value = typeCheck(value, id.getType()); // depends on control dependency: [if], data = [none] } } // End of not-XPATH /* Value may be null after running typeCheck, even if it wasn't before! */ if (value == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getIdentifierValue", null); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getIdentifierValue", new Object[] { PasswordUtils.replacePossiblePassword(dontTraceNonNullValue, value), value.getClass() }); } return value; } }
public class class_name { private void matchItemIds(@NonNull ArrayMap<View, TransitionValues> unmatchedStart, @NonNull ArrayMap<View, TransitionValues> unmatchedEnd, @NonNull LongSparseArray<View> startItemIds, @NonNull LongSparseArray<View> endItemIds) { int numStartIds = startItemIds.size(); for (int i = 0; i < numStartIds; i++) { View startView = startItemIds.valueAt(i); if (startView != null && isValidTarget(startView)) { View endView = endItemIds.get(startItemIds.keyAt(i)); if (endView != null && isValidTarget(endView)) { TransitionValues startValues = unmatchedStart.get(startView); TransitionValues endValues = unmatchedEnd.get(endView); if (startValues != null && endValues != null) { mStartValuesList.add(startValues); mEndValuesList.add(endValues); unmatchedStart.remove(startView); unmatchedEnd.remove(endView); } } } } } }
public class class_name { private void matchItemIds(@NonNull ArrayMap<View, TransitionValues> unmatchedStart, @NonNull ArrayMap<View, TransitionValues> unmatchedEnd, @NonNull LongSparseArray<View> startItemIds, @NonNull LongSparseArray<View> endItemIds) { int numStartIds = startItemIds.size(); for (int i = 0; i < numStartIds; i++) { View startView = startItemIds.valueAt(i); if (startView != null && isValidTarget(startView)) { View endView = endItemIds.get(startItemIds.keyAt(i)); if (endView != null && isValidTarget(endView)) { TransitionValues startValues = unmatchedStart.get(startView); TransitionValues endValues = unmatchedEnd.get(endView); if (startValues != null && endValues != null) { mStartValuesList.add(startValues); // depends on control dependency: [if], data = [(startValues] mEndValuesList.add(endValues); // depends on control dependency: [if], data = [none] unmatchedStart.remove(startView); // depends on control dependency: [if], data = [none] unmatchedEnd.remove(endView); // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { @SuppressWarnings("rawtypes") private Map<EntitySpec, SQLGenResultProcessorFactory> allEntitySpecToResultProcessor() { /* * The order of the entity specs matters for multiple with the same * name. Thus, we use a LinkedHashMap. */ Map<EntitySpec, SQLGenResultProcessorFactory> result = new LinkedHashMap<>(); PrimitiveParameterResultProcessorFactory ppFactory = new PrimitiveParameterResultProcessorFactory(this.backend); for (EntitySpec es : this.primitiveParameterEntitySpecs) { result.put(es, ppFactory); } EventResultProcessorFactory eFactory = new EventResultProcessorFactory(this.backend); for (EntitySpec es : this.eventEntitySpecs) { result.put(es, eFactory); } ConstantResultProcessorFactory cFactory = new ConstantResultProcessorFactory(this.backend); for (EntitySpec es : this.constantEntitySpecs) { result.put(es, cFactory); } return result; } }
public class class_name { @SuppressWarnings("rawtypes") private Map<EntitySpec, SQLGenResultProcessorFactory> allEntitySpecToResultProcessor() { /* * The order of the entity specs matters for multiple with the same * name. Thus, we use a LinkedHashMap. */ Map<EntitySpec, SQLGenResultProcessorFactory> result = new LinkedHashMap<>(); PrimitiveParameterResultProcessorFactory ppFactory = new PrimitiveParameterResultProcessorFactory(this.backend); for (EntitySpec es : this.primitiveParameterEntitySpecs) { result.put(es, ppFactory); // depends on control dependency: [for], data = [es] } EventResultProcessorFactory eFactory = new EventResultProcessorFactory(this.backend); for (EntitySpec es : this.eventEntitySpecs) { result.put(es, eFactory); // depends on control dependency: [for], data = [es] } ConstantResultProcessorFactory cFactory = new ConstantResultProcessorFactory(this.backend); for (EntitySpec es : this.constantEntitySpecs) { result.put(es, cFactory); // depends on control dependency: [for], data = [es] } return result; } }
public class class_name { protected void parseElse() { Node parent = peek(); if (!(parent instanceof IfNode)) { return; } IfNode ifNode = (IfNode) pop(); ElseNode elseNode = new ElseNode(); ifNode.setElseNode(elseNode); push(elseNode); tokenizer.skipWhitespace(); } }
public class class_name { protected void parseElse() { Node parent = peek(); if (!(parent instanceof IfNode)) { return; // depends on control dependency: [if], data = [none] } IfNode ifNode = (IfNode) pop(); ElseNode elseNode = new ElseNode(); ifNode.setElseNode(elseNode); push(elseNode); tokenizer.skipWhitespace(); } }
public class class_name { public void selectFields(String[] fieldNames) { checkNotNull(fieldNames, "fieldNames"); this.fieldNames = fieldNames; RowTypeInfo rowTypeInfo = (RowTypeInfo) ParquetSchemaConverter.fromParquetType(expectedFileSchema); TypeInformation[] selectFieldTypes = new TypeInformation[fieldNames.length]; for (int i = 0; i < fieldNames.length; i++) { try { selectFieldTypes[i] = rowTypeInfo.getTypeAt(fieldNames[i]); } catch (IndexOutOfBoundsException e) { throw new IllegalArgumentException(String.format("Fail to access Field %s , " + "which is not contained in the file schema", fieldNames[i]), e); } } this.fieldTypes = selectFieldTypes; } }
public class class_name { public void selectFields(String[] fieldNames) { checkNotNull(fieldNames, "fieldNames"); this.fieldNames = fieldNames; RowTypeInfo rowTypeInfo = (RowTypeInfo) ParquetSchemaConverter.fromParquetType(expectedFileSchema); TypeInformation[] selectFieldTypes = new TypeInformation[fieldNames.length]; for (int i = 0; i < fieldNames.length; i++) { try { selectFieldTypes[i] = rowTypeInfo.getTypeAt(fieldNames[i]); // depends on control dependency: [try], data = [none] } catch (IndexOutOfBoundsException e) { throw new IllegalArgumentException(String.format("Fail to access Field %s , " + "which is not contained in the file schema", fieldNames[i]), e); } // depends on control dependency: [catch], data = [none] } this.fieldTypes = selectFieldTypes; } }
public class class_name { public FilterableSet<K> keySetByValue() { if (setOfKeysByValue == null) { setOfKeysByValue = new AbstractFilterableSet<K>() { @Override public Iterator<K> iterator() { return new TransactionalBidiTreeMapIterator<K>(VALUE) { @Override protected K doGetNext() { return (K)lastReturnedNode.getData(KEY); } }; } @Override public int size() { return TransactionalBidiTreeMap.this.size(); } @Override public boolean contains(Object o) { return containsKey(o); } @Override public boolean remove(Object o) { int oldnodeCount = nodeCount; TransactionalBidiTreeMap.this.remove(o); return nodeCount != oldnodeCount; } @Override public void clear() { TransactionalBidiTreeMap.this.clear(); } }; } return setOfKeysByValue; } }
public class class_name { public FilterableSet<K> keySetByValue() { if (setOfKeysByValue == null) { setOfKeysByValue = new AbstractFilterableSet<K>() { @Override public Iterator<K> iterator() { return new TransactionalBidiTreeMapIterator<K>(VALUE) { @Override protected K doGetNext() { return (K)lastReturnedNode.getData(KEY); } }; } @Override public int size() { return TransactionalBidiTreeMap.this.size(); } @Override public boolean contains(Object o) { return containsKey(o); } @Override public boolean remove(Object o) { int oldnodeCount = nodeCount; TransactionalBidiTreeMap.this.remove(o); return nodeCount != oldnodeCount; } @Override public void clear() { TransactionalBidiTreeMap.this.clear(); } }; // depends on control dependency: [if], data = [none] } return setOfKeysByValue; } }
public class class_name { public SetLoadBalancerPoliciesOfListenerRequest withPolicyNames(String... policyNames) { if (this.policyNames == null) { setPolicyNames(new com.amazonaws.internal.SdkInternalList<String>(policyNames.length)); } for (String ele : policyNames) { this.policyNames.add(ele); } return this; } }
public class class_name { public SetLoadBalancerPoliciesOfListenerRequest withPolicyNames(String... policyNames) { if (this.policyNames == null) { setPolicyNames(new com.amazonaws.internal.SdkInternalList<String>(policyNames.length)); // depends on control dependency: [if], data = [none] } for (String ele : policyNames) { this.policyNames.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { protected Pair<Integer, InputStream> executeCommand(String command) { int resultVal = 1; InputStream inputStream = null; try { logger.debug("Executing command: {}", command); Process process = Runtime.getRuntime().exec(command); resultVal = process.waitFor(); inputStream = process.getInputStream(); } catch (InterruptedException e) { logger.info("Execution of {} failed: code - {} ; message - {}", command, resultVal, e.getMessage()); Thread.currentThread().interrupt(); } catch (IOException e) { logger.info("Execution of {} failed: code - {} ; message - {}", command, resultVal, e.getMessage()); } if (inputStream == null) { // Create an empty InputStream instead of returning a null inputStream = new InputStream() { @Override public int read() throws IOException { return -1; } } ; } return new Pair<>(resultVal, inputStream); } }
public class class_name { protected Pair<Integer, InputStream> executeCommand(String command) { int resultVal = 1; InputStream inputStream = null; try { logger.debug("Executing command: {}", command); // depends on control dependency: [try], data = [none] Process process = Runtime.getRuntime().exec(command); resultVal = process.waitFor(); // depends on control dependency: [try], data = [none] inputStream = process.getInputStream(); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { logger.info("Execution of {} failed: code - {} ; message - {}", command, resultVal, e.getMessage()); Thread.currentThread().interrupt(); } catch (IOException e) { // depends on control dependency: [catch], data = [none] logger.info("Execution of {} failed: code - {} ; message - {}", command, resultVal, e.getMessage()); } // depends on control dependency: [catch], data = [none] if (inputStream == null) { // Create an empty InputStream instead of returning a null inputStream = new InputStream() { @Override public int read() throws IOException { return -1; } } ; // depends on control dependency: [if], data = [none] } return new Pair<>(resultVal, inputStream); } }