code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { protected void handleMessage(@NonNull VoidMessage message) { if (message == null) { // log.info("sI_{} got null message", getShardIndex()); return; } if (message.getTargetId() >= 0 && message.getTargetId() != shardIndex) { log.warn("sI_{}: Skipping message: [{}]; TargetIdx: [{}]", shardIndex, message.getClass().getSimpleName(), message.getTargetId()); return; } // log.info("sI_{}: Processing message: [{}]", shardIndex, message.getClass().getSimpleName()); message.attachContext(voidConfiguration, trainer, clipboard, transport, storage, nodeRole, shardIndex); message.processMessage(); } }
public class class_name { protected void handleMessage(@NonNull VoidMessage message) { if (message == null) { // log.info("sI_{} got null message", getShardIndex()); return; // depends on control dependency: [if], data = [none] } if (message.getTargetId() >= 0 && message.getTargetId() != shardIndex) { log.warn("sI_{}: Skipping message: [{}]; TargetIdx: [{}]", shardIndex, message.getClass().getSimpleName(), message.getTargetId()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // log.info("sI_{}: Processing message: [{}]", shardIndex, message.getClass().getSimpleName()); message.attachContext(voidConfiguration, trainer, clipboard, transport, storage, nodeRole, shardIndex); message.processMessage(); } }
public class class_name { private void removeKeys(List<Integer> keysToRemove, SparseArrayCompat<ViewHolder> headers) { for (Integer key : keysToRemove) { headers.remove(key); } } }
public class class_name { private void removeKeys(List<Integer> keysToRemove, SparseArrayCompat<ViewHolder> headers) { for (Integer key : keysToRemove) { headers.remove(key); // depends on control dependency: [for], data = [key] } } }
public class class_name { public AnnotationVisitor visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String desc, boolean visible) { if (api < Opcodes.ASM5) { throw new RuntimeException(); } if (mv != null) { return mv.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, desc, visible); } return null; } }
public class class_name { public AnnotationVisitor visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String desc, boolean visible) { if (api < Opcodes.ASM5) { throw new RuntimeException(); } if (mv != null) { return mv.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, desc, visible); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public void setChunkedEncoding() throws IOException { validate(); // peek ahead and make sure we have a line with hex numbers: int max = 50; is.mark(max + 2); int cur = 0; int hexFound = 0; boolean isChunked = false; while (cur < max) { int nextC = is.read(); // allow CRLF and plain ole LF: if ((nextC == 13) || (nextC == 10)) { // must have read at least 1 hex char: if (hexFound > 0) { if (nextC == 10) { isChunked = true; break; } nextC = is.read(); if (nextC == 10) { isChunked = true; break; } } // keep looking to allow some blank lines. } else { // better be a hex character: if (isHex(nextC)) { hexFound++; } else if (nextC != ' ') { // allow whitespace before or after chunk... // not a hex digit: not a chunked stream. break; } } cur++; } is.reset(); if (isChunked) { setInputStream(new ChunkedInputStream(is)); } } }
public class class_name { public void setChunkedEncoding() throws IOException { validate(); // peek ahead and make sure we have a line with hex numbers: int max = 50; is.mark(max + 2); int cur = 0; int hexFound = 0; boolean isChunked = false; while (cur < max) { int nextC = is.read(); // allow CRLF and plain ole LF: if ((nextC == 13) || (nextC == 10)) { // must have read at least 1 hex char: if (hexFound > 0) { if (nextC == 10) { isChunked = true; // depends on control dependency: [if], data = [none] break; } nextC = is.read(); if (nextC == 10) { isChunked = true; // depends on control dependency: [if], data = [none] break; } } // keep looking to allow some blank lines. } else { // better be a hex character: if (isHex(nextC)) { hexFound++; } else if (nextC != ' ') { // allow whitespace before or after chunk... // not a hex digit: not a chunked stream. break; } } cur++; } is.reset(); if (isChunked) { setInputStream(new ChunkedInputStream(is)); } } }
public class class_name { public boolean isInBitmapMemoryCache(final Uri uri) { if (uri == null) { return false; } Predicate<CacheKey> bitmapCachePredicate = predicateForUri(uri); return mBitmapMemoryCache.contains(bitmapCachePredicate); } }
public class class_name { public boolean isInBitmapMemoryCache(final Uri uri) { if (uri == null) { return false; // depends on control dependency: [if], data = [none] } Predicate<CacheKey> bitmapCachePredicate = predicateForUri(uri); return mBitmapMemoryCache.contains(bitmapCachePredicate); } }
public class class_name { public void inputKeyevent(int value) { executeCommandQuietly(adbCommand("shell", "input", "keyevent", "" + value)); // need to wait a beat for the UI to respond try { Thread.sleep(500); } catch (InterruptedException e) { log.warn("", e); } } }
public class class_name { public void inputKeyevent(int value) { executeCommandQuietly(adbCommand("shell", "input", "keyevent", "" + value)); // need to wait a beat for the UI to respond try { Thread.sleep(500); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { log.warn("", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Field resolveField(Field inputField) { if (inputField.isList()) { return inputField.getListElemField(); } else if (inputField.isSet()) { return inputField.getSetElemField(); } else { return inputField; } } }
public class class_name { private Field resolveField(Field inputField) { if (inputField.isList()) { return inputField.getListElemField(); // depends on control dependency: [if], data = [none] } else if (inputField.isSet()) { return inputField.getSetElemField(); // depends on control dependency: [if], data = [none] } else { return inputField; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void dumpDAG(Node[][] dag){ if(LOGGER.isDebugEnabled()) { LOGGER.debug("有向无环图:"); for (int i=0; i<dag.length-1; i++) { Node[] nodes = dag[i]; StringBuilder line = new StringBuilder(); for (Node node : nodes) { int following = node.getFollowing(); StringBuilder followingNodeTexts = new StringBuilder(); for (int k = 0; k < dag[following].length; k++) { String followingNodeText = dag[following][k].getText(); followingNodeTexts.append("(").append(followingNodeText).append(")"); } line.append("【") .append(node.getText()) .append("->").append(followingNodeTexts.toString()) .append("】\t"); } LOGGER.debug(line.toString()); } } } }
public class class_name { private void dumpDAG(Node[][] dag){ if(LOGGER.isDebugEnabled()) { LOGGER.debug("有向无环图:"); // depends on control dependency: [if], data = [none] for (int i=0; i<dag.length-1; i++) { Node[] nodes = dag[i]; StringBuilder line = new StringBuilder(); for (Node node : nodes) { int following = node.getFollowing(); StringBuilder followingNodeTexts = new StringBuilder(); for (int k = 0; k < dag[following].length; k++) { String followingNodeText = dag[following][k].getText(); followingNodeTexts.append("(").append(followingNodeText).append(")"); // depends on control dependency: [for], data = [none] } line.append("【") .append(node.getText()) .append("->").append(followingNodeTexts.toString()) .append("】\t"); // depends on control dependency: [for], data = [none] } LOGGER.debug(line.toString()); // depends on control dependency: [for], data = [none] } } } }
public class class_name { public static URL fromJavaURI(java.net.URI uri) { //TODO: Let's do this more efficient. try { return new URLParser(uri.toString()).parse(); } catch (GalimatiasParseException e) { // This should not happen. throw new RuntimeException("BUG", e); } } }
public class class_name { public static URL fromJavaURI(java.net.URI uri) { //TODO: Let's do this more efficient. try { return new URLParser(uri.toString()).parse(); // depends on control dependency: [try], data = [none] } catch (GalimatiasParseException e) { // This should not happen. throw new RuntimeException("BUG", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public MethodDoc[] methods(boolean filter) { Names names = tsym.name.table.names; List<MethodDocImpl> methods = List.nil(); for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) { if (e.sym != null && e.sym.kind == Kinds.MTH && e.sym.name != names.init && e.sym.name != names.clinit) { MethodSymbol s = (MethodSymbol)e.sym; if (!filter || env.shouldDocument(s)) { methods = methods.prepend(env.getMethodDoc(s)); } } } //### Cache methods here? return methods.toArray(new MethodDocImpl[methods.length()]); } }
public class class_name { public MethodDoc[] methods(boolean filter) { Names names = tsym.name.table.names; List<MethodDocImpl> methods = List.nil(); for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) { if (e.sym != null && e.sym.kind == Kinds.MTH && e.sym.name != names.init && e.sym.name != names.clinit) { MethodSymbol s = (MethodSymbol)e.sym; if (!filter || env.shouldDocument(s)) { methods = methods.prepend(env.getMethodDoc(s)); // depends on control dependency: [if], data = [none] } } } //### Cache methods here? return methods.toArray(new MethodDocImpl[methods.length()]); } }
public class class_name { public List<Intervalable> removeOverlaps(List<Intervalable> intervals) { // 排序,按照先大小后左端点的顺序 Collections.sort(intervals, new IntervalableComparatorBySize()); Set<Intervalable> removeIntervals = new TreeSet<Intervalable>(); for (Intervalable interval : intervals) { // 如果区间已经被移除了,就忽略它 if (removeIntervals.contains(interval)) { continue; } // 否则就移除它 removeIntervals.addAll(findOverlaps(interval)); } // 移除所有的重叠区间 for (Intervalable removeInterval : removeIntervals) { intervals.remove(removeInterval); } // 排序,按照左端顺序 Collections.sort(intervals, new IntervalableComparatorByPosition()); return intervals; } }
public class class_name { public List<Intervalable> removeOverlaps(List<Intervalable> intervals) { // 排序,按照先大小后左端点的顺序 Collections.sort(intervals, new IntervalableComparatorBySize()); Set<Intervalable> removeIntervals = new TreeSet<Intervalable>(); for (Intervalable interval : intervals) { // 如果区间已经被移除了,就忽略它 if (removeIntervals.contains(interval)) { continue; } // 否则就移除它 removeIntervals.addAll(findOverlaps(interval)); // depends on control dependency: [for], data = [interval] } // 移除所有的重叠区间 for (Intervalable removeInterval : removeIntervals) { intervals.remove(removeInterval); // depends on control dependency: [for], data = [removeInterval] } // 排序,按照左端顺序 Collections.sort(intervals, new IntervalableComparatorByPosition()); return intervals; } }
public class class_name { public DistributedWorkManager resolveDistributedWorkManager(Address address) { if (trace) { log.tracef("resolveDistributedWorkManager(%s)", address); log.tracef(" ActiveWorkManagers: %s", activeWorkmanagers); } WorkManager wm = activeWorkmanagers.get(address.getWorkManagerId()); if (wm != null) { if (wm instanceof DistributedWorkManager) { if (trace) log.tracef(" WorkManager: %s", wm); return (DistributedWorkManager)wm; } else { if (trace) log.tracef(" WorkManager not distributable: %s", wm); return null; } } try { // Create a new instance WorkManager template = workmanagers.get(address.getWorkManagerName()); if (template != null) { wm = template.clone(); wm.setId(address.getWorkManagerId()); if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; dwm.initialize(); activeWorkmanagers.put(address.getWorkManagerId(), dwm); refCountWorkmanagers.put(address.getWorkManagerId(), Integer.valueOf(0)); if (trace) log.tracef("Created WorkManager: %s", dwm); return dwm; } } } catch (Throwable t) { //throw new IllegalStateException("The WorkManager couldn't be created: " + name); } return null; } }
public class class_name { public DistributedWorkManager resolveDistributedWorkManager(Address address) { if (trace) { log.tracef("resolveDistributedWorkManager(%s)", address); // depends on control dependency: [if], data = [none] log.tracef(" ActiveWorkManagers: %s", activeWorkmanagers); // depends on control dependency: [if], data = [none] } WorkManager wm = activeWorkmanagers.get(address.getWorkManagerId()); if (wm != null) { if (wm instanceof DistributedWorkManager) { if (trace) log.tracef(" WorkManager: %s", wm); return (DistributedWorkManager)wm; // depends on control dependency: [if], data = [none] } else { if (trace) log.tracef(" WorkManager not distributable: %s", wm); return null; // depends on control dependency: [if], data = [none] } } try { // Create a new instance WorkManager template = workmanagers.get(address.getWorkManagerName()); if (template != null) { wm = template.clone(); // depends on control dependency: [if], data = [none] wm.setId(address.getWorkManagerId()); // depends on control dependency: [if], data = [none] if (wm instanceof DistributedWorkManager) { DistributedWorkManager dwm = (DistributedWorkManager)wm; dwm.initialize(); // depends on control dependency: [if], data = [none] activeWorkmanagers.put(address.getWorkManagerId(), dwm); // depends on control dependency: [if], data = [none] refCountWorkmanagers.put(address.getWorkManagerId(), Integer.valueOf(0)); // depends on control dependency: [if], data = [none] if (trace) log.tracef("Created WorkManager: %s", dwm); return dwm; // depends on control dependency: [if], data = [none] } } } catch (Throwable t) { //throw new IllegalStateException("The WorkManager couldn't be created: " + name); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { @Nullable public static ISessionWebScope getSessionWebScopeOfID (@Nullable final String sScopeID) { final ISessionScope aSessionScope = ScopeSessionManager.getInstance ().getSessionScopeOfID (sScopeID); if (aSessionScope == null) return null; if (!(aSessionScope instanceof ISessionWebScope)) { if (LOGGER.isWarnEnabled ()) LOGGER.warn ("The passed scope ID '" + sScopeID + "' is not a session web scope: " + aSessionScope.toString ()); return null; } return (ISessionWebScope) aSessionScope; } }
public class class_name { @Nullable public static ISessionWebScope getSessionWebScopeOfID (@Nullable final String sScopeID) { final ISessionScope aSessionScope = ScopeSessionManager.getInstance ().getSessionScopeOfID (sScopeID); if (aSessionScope == null) return null; if (!(aSessionScope instanceof ISessionWebScope)) { if (LOGGER.isWarnEnabled ()) LOGGER.warn ("The passed scope ID '" + sScopeID + "' is not a session web scope: " + aSessionScope.toString ()); return null; // depends on control dependency: [if], data = [none] } return (ISessionWebScope) aSessionScope; } }
public class class_name { @Deprecated public static double[][] times(final double[] v1, final double[][] m2) { assert m2.length == 1 : ERR_MATRIX_INNERDIM; final int columndimension = m2[0].length; final double[][] re = new double[v1.length][columndimension]; for(int j = 0; j < columndimension; j++) { for(int i = 0; i < v1.length; i++) { re[i][j] = v1[i] * m2[0][j]; } } return re; } }
public class class_name { @Deprecated public static double[][] times(final double[] v1, final double[][] m2) { assert m2.length == 1 : ERR_MATRIX_INNERDIM; final int columndimension = m2[0].length; final double[][] re = new double[v1.length][columndimension]; for(int j = 0; j < columndimension; j++) { for(int i = 0; i < v1.length; i++) { re[i][j] = v1[i] * m2[0][j]; // depends on control dependency: [for], data = [i] } } return re; } }
public class class_name { public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if ((strCommand.equalsIgnoreCase(MenuConstants.FORM)) || (strCommand.equalsIgnoreCase(MenuConstants.FORMLINK))) { String strHandle = null; if (strCommand.equalsIgnoreCase(MenuConstants.FORMLINK)) { try { strHandle = this.getMainRecord().getHandle(DBConstants.OBJECT_ID_HANDLE).toString(); } catch (DBException ex) { strHandle = null; // Ignore error - just go to form } } strCommand = Utility.addURLParam(null, DBParams.SCREEN, Constants.ROOT_PACKAGE + AccessScreen.class.getName()); // Screen class strCommand = Utility.addURLParam(strCommand, DBParams.RECORD, this.getProperty(DBParams.RECORD)); strCommand = Utility.addURLParam(strCommand, "package", this.getProperty("package")); if (strHandle != null) strCommand = Utility.addURLParam(strCommand, DBConstants.STRING_OBJECT_ID_HANDLE, strHandle); } else if ("Delete all".equalsIgnoreCase(strCommand)) { Record record = this.getMainRecord(); record.close(); try { while (record.hasNext()) { Record rec = record.next(); rec.edit(); rec.remove(); } } catch (DBException ex) { ex.printStackTrace(); } } return super.doCommand(strCommand, sourceSField, iCommandOptions); // This will send the command to my parent } }
public class class_name { public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if ((strCommand.equalsIgnoreCase(MenuConstants.FORM)) || (strCommand.equalsIgnoreCase(MenuConstants.FORMLINK))) { String strHandle = null; if (strCommand.equalsIgnoreCase(MenuConstants.FORMLINK)) { try { strHandle = this.getMainRecord().getHandle(DBConstants.OBJECT_ID_HANDLE).toString(); // depends on control dependency: [try], data = [none] } catch (DBException ex) { strHandle = null; // Ignore error - just go to form } // depends on control dependency: [catch], data = [none] } strCommand = Utility.addURLParam(null, DBParams.SCREEN, Constants.ROOT_PACKAGE + AccessScreen.class.getName()); // Screen class // depends on control dependency: [if], data = [none] strCommand = Utility.addURLParam(strCommand, DBParams.RECORD, this.getProperty(DBParams.RECORD)); // depends on control dependency: [if], data = [none] strCommand = Utility.addURLParam(strCommand, "package", this.getProperty("package")); // depends on control dependency: [if], data = [none] if (strHandle != null) strCommand = Utility.addURLParam(strCommand, DBConstants.STRING_OBJECT_ID_HANDLE, strHandle); } else if ("Delete all".equalsIgnoreCase(strCommand)) { Record record = this.getMainRecord(); record.close(); // depends on control dependency: [if], data = [none] try { while (record.hasNext()) { Record rec = record.next(); rec.edit(); // depends on control dependency: [while], data = [none] rec.remove(); // depends on control dependency: [while], data = [none] } } catch (DBException ex) { ex.printStackTrace(); } // depends on control dependency: [catch], data = [none] } return super.doCommand(strCommand, sourceSField, iCommandOptions); // This will send the command to my parent } }
public class class_name { @Override public Layer getOverLayer() { final Viewport viewport = getViewport(); if (null != viewport) { return viewport.getOverLayer(); } return null; } }
public class class_name { @Override public Layer getOverLayer() { final Viewport viewport = getViewport(); if (null != viewport) { return viewport.getOverLayer(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { protected static int safeToInt (String intstr) { if (!StringUtil.isBlank(intstr)) { try { return Integer.parseInt(intstr); } catch (NumberFormatException nfe) { } } return -1; } }
public class class_name { protected static int safeToInt (String intstr) { if (!StringUtil.isBlank(intstr)) { try { return Integer.parseInt(intstr); // depends on control dependency: [try], data = [none] } catch (NumberFormatException nfe) { } // depends on control dependency: [catch], data = [none] } return -1; } }
public class class_name { public PutEvaluationsResult withFailedEvaluations(Evaluation... failedEvaluations) { if (this.failedEvaluations == null) { setFailedEvaluations(new com.amazonaws.internal.SdkInternalList<Evaluation>(failedEvaluations.length)); } for (Evaluation ele : failedEvaluations) { this.failedEvaluations.add(ele); } return this; } }
public class class_name { public PutEvaluationsResult withFailedEvaluations(Evaluation... failedEvaluations) { if (this.failedEvaluations == null) { setFailedEvaluations(new com.amazonaws.internal.SdkInternalList<Evaluation>(failedEvaluations.length)); // depends on control dependency: [if], data = [none] } for (Evaluation ele : failedEvaluations) { this.failedEvaluations.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private void organizeCells(ArrayList<TextPiece> linesOfAPage, TableCandidate tc) { float captionY = linesOfAPage.get(tc.getCaptionStartLine()).getY(); float captionEndY = linesOfAPage.get(tc.getCaptionEndLine()).getEndY(); ArrayList<TextPiece> rawCells = new ArrayList<TextPiece>(); /* * Copy & sort */ for (int i = tc.getBodyStartLine(); i <= tc.getBodyEndLine(); i++) { rawCells.add(linesOfAPage.get(i)); } Collections.sort(rawCells); assert rawCells.size() >= 4; // due to previous check TableRow currentRow = null; // creates first row for (TextPiece cell : rawCells) { /* * Skips lines beyond caption //TODO: remove the far Y */ if (tc.isTopCaption() && (cell.getY() < captionY)) continue; if (!tc.isTopCaption() && (cell.getEndY() > captionEndY)) continue; /* * Lines too close to each other are treated as a single line */ if (currentRow != null && cell.getY() - currentRow.getY() < m_docInfo .getAverageLineGap() / 2.0) currentRow.addCell(cell); else { /* * Creates a new row */ currentRow = new TableRow(); currentRow.setY(cell.getY()); if (cell.isSuperScriptBeginning()) currentRow.setSuperScriptRow(true); currentRow.addCell(cell); tc.addRow(currentRow); } } if (tc.getRows().size() < 2) tc.setValid(false); } }
public class class_name { private void organizeCells(ArrayList<TextPiece> linesOfAPage, TableCandidate tc) { float captionY = linesOfAPage.get(tc.getCaptionStartLine()).getY(); float captionEndY = linesOfAPage.get(tc.getCaptionEndLine()).getEndY(); ArrayList<TextPiece> rawCells = new ArrayList<TextPiece>(); /* * Copy & sort */ for (int i = tc.getBodyStartLine(); i <= tc.getBodyEndLine(); i++) { rawCells.add(linesOfAPage.get(i)); // depends on control dependency: [for], data = [i] } Collections.sort(rawCells); assert rawCells.size() >= 4; // due to previous check TableRow currentRow = null; // creates first row for (TextPiece cell : rawCells) { /* * Skips lines beyond caption //TODO: remove the far Y */ if (tc.isTopCaption() && (cell.getY() < captionY)) continue; if (!tc.isTopCaption() && (cell.getEndY() > captionEndY)) continue; /* * Lines too close to each other are treated as a single line */ if (currentRow != null && cell.getY() - currentRow.getY() < m_docInfo .getAverageLineGap() / 2.0) currentRow.addCell(cell); else { /* * Creates a new row */ currentRow = new TableRow(); // depends on control dependency: [if], data = [none] currentRow.setY(cell.getY()); // depends on control dependency: [if], data = [none] if (cell.isSuperScriptBeginning()) currentRow.setSuperScriptRow(true); currentRow.addCell(cell); // depends on control dependency: [if], data = [none] tc.addRow(currentRow); // depends on control dependency: [if], data = [(currentRow] } } if (tc.getRows().size() < 2) tc.setValid(false); } }
public class class_name { private TimeWindow mergeWindow(TimeWindow curWindow, TimeWindow other, Collection<TimeWindow> mergedWindow) { if (curWindow.intersects(other)) { mergedWindow.add(other); return curWindow.cover(other); } else { return curWindow; } } }
public class class_name { private TimeWindow mergeWindow(TimeWindow curWindow, TimeWindow other, Collection<TimeWindow> mergedWindow) { if (curWindow.intersects(other)) { mergedWindow.add(other); // depends on control dependency: [if], data = [none] return curWindow.cover(other); // depends on control dependency: [if], data = [none] } else { return curWindow; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static double variance(FlatDataCollection flatDataCollection, boolean isSample) { /* Uses the formal Variance = E(X^2) - mean^2 */ int n = 0; double mean = 0.0; double squaredMean = 0.0; Iterator<Double> it = flatDataCollection.iteratorDouble(); while(it.hasNext()) { Double v = it.next(); if(v != null) { ++n; mean+=v; squaredMean+=v*v; } } if(n<=1) { throw new IllegalArgumentException("The provided collection must have more than 1 elements."); } mean/=n; squaredMean/=n; double variance = squaredMean - mean*mean; /* Unbiased for sample */ if(isSample) { variance*=n/(n-1.0); } return variance; } }
public class class_name { public static double variance(FlatDataCollection flatDataCollection, boolean isSample) { /* Uses the formal Variance = E(X^2) - mean^2 */ int n = 0; double mean = 0.0; double squaredMean = 0.0; Iterator<Double> it = flatDataCollection.iteratorDouble(); while(it.hasNext()) { Double v = it.next(); if(v != null) { ++n; // depends on control dependency: [if], data = [none] mean+=v; // depends on control dependency: [if], data = [none] squaredMean+=v*v; // depends on control dependency: [if], data = [none] } } if(n<=1) { throw new IllegalArgumentException("The provided collection must have more than 1 elements."); } mean/=n; squaredMean/=n; double variance = squaredMean - mean*mean; /* Unbiased for sample */ if(isSample) { variance*=n/(n-1.0); // depends on control dependency: [if], data = [none] } return variance; } }
public class class_name { private INode genDirStructure(String rootName, int maxDepth) { INode root = new INode(rootName); if (maxDepth>0) { maxDepth--; int minDepth = maxDepth*2/3; // Figure out the number of subdirectories to generate int numOfSubDirs = minWidth + r.nextInt(maxWidth-minWidth+1); // Expand the tree for (int i=0; i<numOfSubDirs; i++) { int childDepth = (maxDepth == 0)?0: (r.nextInt(maxDepth-minDepth+1)+minDepth); INode child = genDirStructure("dir"+i, childDepth); root.addChild(child); } } return root; } }
public class class_name { private INode genDirStructure(String rootName, int maxDepth) { INode root = new INode(rootName); if (maxDepth>0) { maxDepth--; // depends on control dependency: [if], data = [none] int minDepth = maxDepth*2/3; // Figure out the number of subdirectories to generate int numOfSubDirs = minWidth + r.nextInt(maxWidth-minWidth+1); // Expand the tree for (int i=0; i<numOfSubDirs; i++) { int childDepth = (maxDepth == 0)?0: (r.nextInt(maxDepth-minDepth+1)+minDepth); INode child = genDirStructure("dir"+i, childDepth); root.addChild(child); // depends on control dependency: [for], data = [none] } } return root; } }
public class class_name { private void extractFlags(Msg msg) { // Test whether IDENTITY flag is valid for this socket type. if (msg.isIdentity()) { assert (options.recvIdentity); } // Remove MORE flag. rcvmore = msg.hasMore(); } }
public class class_name { private void extractFlags(Msg msg) { // Test whether IDENTITY flag is valid for this socket type. if (msg.isIdentity()) { assert (options.recvIdentity); // depends on control dependency: [if], data = [none] } // Remove MORE flag. rcvmore = msg.hasMore(); } }
public class class_name { @Override public void complete(VirtualConnection vc, TCPReadRequestContext rsc) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "complete() called: " + vc); } HttpInboundLink myLink = (HttpInboundLink) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPICL); myLink.processRequest(); } }
public class class_name { @Override public void complete(VirtualConnection vc, TCPReadRequestContext rsc) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "complete() called: " + vc); // depends on control dependency: [if], data = [none] } HttpInboundLink myLink = (HttpInboundLink) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPICL); myLink.processRequest(); } }
public class class_name { public void marshall(AssetAttributes assetAttributes, ProtocolMarshaller protocolMarshaller) { if (assetAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(assetAttributes.getSchemaVersion(), SCHEMAVERSION_BINDING); protocolMarshaller.marshall(assetAttributes.getAgentId(), AGENTID_BINDING); protocolMarshaller.marshall(assetAttributes.getAutoScalingGroup(), AUTOSCALINGGROUP_BINDING); protocolMarshaller.marshall(assetAttributes.getAmiId(), AMIID_BINDING); protocolMarshaller.marshall(assetAttributes.getHostname(), HOSTNAME_BINDING); protocolMarshaller.marshall(assetAttributes.getIpv4Addresses(), IPV4ADDRESSES_BINDING); protocolMarshaller.marshall(assetAttributes.getTags(), TAGS_BINDING); protocolMarshaller.marshall(assetAttributes.getNetworkInterfaces(), NETWORKINTERFACES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AssetAttributes assetAttributes, ProtocolMarshaller protocolMarshaller) { if (assetAttributes == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(assetAttributes.getSchemaVersion(), SCHEMAVERSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(assetAttributes.getAgentId(), AGENTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(assetAttributes.getAutoScalingGroup(), AUTOSCALINGGROUP_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(assetAttributes.getAmiId(), AMIID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(assetAttributes.getHostname(), HOSTNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(assetAttributes.getIpv4Addresses(), IPV4ADDRESSES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(assetAttributes.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(assetAttributes.getNetworkInterfaces(), NETWORKINTERFACES_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 String reverse(final String binaryStr) { final StringBuilder occupyBuffer = new StringBuilder(binaryStr.length()); for (int i = 0; i < binaryStr.length(); i++) { if ('0' == binaryStr.charAt(i)) { occupyBuffer.append('1'); } else { occupyBuffer.append('0'); } } return occupyBuffer.toString(); } }
public class class_name { public static String reverse(final String binaryStr) { final StringBuilder occupyBuffer = new StringBuilder(binaryStr.length()); for (int i = 0; i < binaryStr.length(); i++) { if ('0' == binaryStr.charAt(i)) { occupyBuffer.append('1'); // depends on control dependency: [if], data = [none] } else { occupyBuffer.append('0'); // depends on control dependency: [if], data = [('0'] } } return occupyBuffer.toString(); } }
public class class_name { private int loadFSEdits() throws IOException { FSDirectory fsDir = fsNamesys.dir; int numEdits = 0; long startTime = FSNamesystem.now(); LOG.info("Ingest: Consuming transactions: " + this.toString()); try { logVersion = inputEditStream.getVersion(); if (!LayoutVersion.supports(Feature.TXID_BASED_LAYOUT, logVersion)) throw new RuntimeException("Log version is too old"); currentPosition = inputEditStream.getPosition(); numEdits = ingestFSEdits(); // continue to ingest } finally { LOG.info("Ingest: Closing ingest for segment: " + this.toString()); // At this time we are done reading the transaction log // We need to sync to have on disk status the same as in memory // if we saw end segment, we already synced if(endTxId == -1 && fsDir.fsImage.getEditLog().isOpen()) { fsDir.fsImage.getEditLog().logSync(); } inputEditStream.close(); standby.clearIngestState(); } LOG.info("Ingest: Edits segment: " + this.toString() + " edits # " + numEdits + " loaded in " + (FSNamesystem.now()-startTime)/1000 + " seconds."); if (logVersion != FSConstants.LAYOUT_VERSION) // other version numEdits++; // save this image asap return numEdits; } }
public class class_name { private int loadFSEdits() throws IOException { FSDirectory fsDir = fsNamesys.dir; int numEdits = 0; long startTime = FSNamesystem.now(); LOG.info("Ingest: Consuming transactions: " + this.toString()); try { logVersion = inputEditStream.getVersion(); if (!LayoutVersion.supports(Feature.TXID_BASED_LAYOUT, logVersion)) throw new RuntimeException("Log version is too old"); currentPosition = inputEditStream.getPosition(); numEdits = ingestFSEdits(); // continue to ingest } finally { LOG.info("Ingest: Closing ingest for segment: " + this.toString()); // At this time we are done reading the transaction log // We need to sync to have on disk status the same as in memory // if we saw end segment, we already synced if(endTxId == -1 && fsDir.fsImage.getEditLog().isOpen()) { fsDir.fsImage.getEditLog().logSync(); // depends on control dependency: [if], data = [none] } inputEditStream.close(); standby.clearIngestState(); } LOG.info("Ingest: Edits segment: " + this.toString() + " edits # " + numEdits + " loaded in " + (FSNamesystem.now()-startTime)/1000 + " seconds."); if (logVersion != FSConstants.LAYOUT_VERSION) // other version numEdits++; // save this image asap return numEdits; } }
public class class_name { private static String getErrorSnippet(final String record, final int pos) { final StringBuilder snippet = new StringBuilder(); final int start = pos - SNIPPET_SIZE / 2; if (start < 0) { snippet.append(record.substring(0, pos)); } else { snippet.append(SNIPPET_ELLIPSIS); snippet.append(record.substring(start, pos)); } snippet.append(POS_MARKER_LEFT); snippet.append(record.charAt(pos)); snippet.append(POS_MARKER_RIGHT); if (pos + 1 < record.length()) { final int end = pos + SNIPPET_SIZE / 2; if (end > record.length()) { snippet.append(record.substring(pos + 1)); } else { snippet.append(record.substring(pos + 1, end)); snippet.append(SNIPPET_ELLIPSIS); } } return snippet.toString(); } }
public class class_name { private static String getErrorSnippet(final String record, final int pos) { final StringBuilder snippet = new StringBuilder(); final int start = pos - SNIPPET_SIZE / 2; if (start < 0) { snippet.append(record.substring(0, pos)); // depends on control dependency: [if], data = [none] } else { snippet.append(SNIPPET_ELLIPSIS); // depends on control dependency: [if], data = [none] snippet.append(record.substring(start, pos)); // depends on control dependency: [if], data = [(start] } snippet.append(POS_MARKER_LEFT); snippet.append(record.charAt(pos)); snippet.append(POS_MARKER_RIGHT); if (pos + 1 < record.length()) { final int end = pos + SNIPPET_SIZE / 2; if (end > record.length()) { snippet.append(record.substring(pos + 1)); // depends on control dependency: [if], data = [none] } else { snippet.append(record.substring(pos + 1, end)); // depends on control dependency: [if], data = [none] snippet.append(SNIPPET_ELLIPSIS); // depends on control dependency: [if], data = [none] } } return snippet.toString(); } }
public class class_name { boolean fitRotate2D(Dimension dimension) { if (dimension.getHeight() < height) { return false; } return fitRotate2D(dimension.getWidth(), dimension.getDepth()); } }
public class class_name { boolean fitRotate2D(Dimension dimension) { if (dimension.getHeight() < height) { return false; // depends on control dependency: [if], data = [none] } return fitRotate2D(dimension.getWidth(), dimension.getDepth()); } }
public class class_name { synchronized void refresh() { if(reinitOnRefresh) { LOG.debug("Reinitialize in thread " + Thread.currentThread().getName()); reinitialize(); reinitOnRefresh = false; return; } synchronized(plot) { boolean refreshcss = false; if(plotmap == null) { throw new IllegalStateException("Plotmap is null"); } final int thumbsize = (int) Math.max(screenwidth / plotmap.getWidth(), screenheight / plotmap.getHeight()); for(PlotItem pi : plotmap.keySet()) { for(Iterator<PlotItem> iter = pi.itemIterator(); iter.hasNext();) { PlotItem it = iter.next(); for(Iterator<VisualizationTask> tit = it.tasks.iterator(); tit.hasNext();) { VisualizationTask task = tit.next(); Pair<Element, Visualization> pair = vistoelem.get(it, task); // New task? if(pair == null) { if(visibleInOverview(task)) { Element elem = plot.svgElement(SVGConstants.SVG_G_TAG); pair = new Pair<>(elem, embedOrThumbnail(thumbsize, it, task, elem)); vistoelem.get(it, null).first.appendChild(elem); vistoelem.put(it, task, pair); refreshcss = true; } } else if(pair.first != null) { if(visibleInOverview(task)) { // unhide if hidden. if(pair.first.hasAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY)) { pair.first.removeAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY); } } else { // hide if there is anything to hide. if(pair.first.hasChildNodes()) { pair.first.setAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY, SVGConstants.CSS_HIDDEN_VALUE); } } // TODO: unqueue pending thumbnails } } } } if(refreshcss) { plot.updateStyleElement(); } } } }
public class class_name { synchronized void refresh() { if(reinitOnRefresh) { LOG.debug("Reinitialize in thread " + Thread.currentThread().getName()); // depends on control dependency: [if], data = [none] reinitialize(); // depends on control dependency: [if], data = [none] reinitOnRefresh = false; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } synchronized(plot) { boolean refreshcss = false; if(plotmap == null) { throw new IllegalStateException("Plotmap is null"); } final int thumbsize = (int) Math.max(screenwidth / plotmap.getWidth(), screenheight / plotmap.getHeight()); for(PlotItem pi : plotmap.keySet()) { for(Iterator<PlotItem> iter = pi.itemIterator(); iter.hasNext();) { PlotItem it = iter.next(); for(Iterator<VisualizationTask> tit = it.tasks.iterator(); tit.hasNext();) { VisualizationTask task = tit.next(); Pair<Element, Visualization> pair = vistoelem.get(it, task); // New task? if(pair == null) { if(visibleInOverview(task)) { Element elem = plot.svgElement(SVGConstants.SVG_G_TAG); pair = new Pair<>(elem, embedOrThumbnail(thumbsize, it, task, elem)); // depends on control dependency: [if], data = [none] vistoelem.get(it, null).first.appendChild(elem); // depends on control dependency: [if], data = [none] vistoelem.put(it, task, pair); // depends on control dependency: [if], data = [none] refreshcss = true; // depends on control dependency: [if], data = [none] } } else if(pair.first != null) { if(visibleInOverview(task)) { // unhide if hidden. if(pair.first.hasAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY)) { pair.first.removeAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY); // depends on control dependency: [if], data = [none] } } else { // hide if there is anything to hide. if(pair.first.hasChildNodes()) { pair.first.setAttribute(SVGConstants.CSS_VISIBILITY_PROPERTY, SVGConstants.CSS_HIDDEN_VALUE); // depends on control dependency: [if], data = [none] } } // TODO: unqueue pending thumbnails } } } } if(refreshcss) { plot.updateStyleElement(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void add(E element) throws IllegalStateException { requireNonNull(element); lock.lock(); try { if (open) { elements.addLast(element); if (elements.size() == 1) { nonEmpty.signalAll(); } } else { throw new IllegalStateException("queue is closed"); } } finally { lock.unlock(); } } }
public class class_name { public void add(E element) throws IllegalStateException { requireNonNull(element); lock.lock(); try { if (open) { elements.addLast(element); // depends on control dependency: [if], data = [none] if (elements.size() == 1) { nonEmpty.signalAll(); // depends on control dependency: [if], data = [none] } } else { throw new IllegalStateException("queue is closed"); } } finally { lock.unlock(); } } }
public class class_name { public Set<OGraphEdge> getInEdges(final String iEdgeLabel) { Set<OGraphEdge> temp = in != null ? in.get() : null; if (temp == null) { if (iEdgeLabel == null) temp = new HashSet<OGraphEdge>(); in = new SoftReference<Set<OGraphEdge>>(temp); final Set<Object> docs = document.field(OGraphDatabase.VERTEX_FIELD_IN); if (docs != null) { // TRANSFORM ALL THE ARCS for (Object o : docs) { final ODocument doc = (ODocument) ((OIdentifiable) o).getRecord(); if (iEdgeLabel != null && !iEdgeLabel.equals(doc.field(OGraphDatabase.LABEL))) continue; temp.add((OGraphEdge) database.getUserObjectByRecord(doc, null)); } } } else if (iEdgeLabel != null) { // FILTER THE EXISTENT COLLECTION HashSet<OGraphEdge> filtered = new HashSet<OGraphEdge>(); for (OGraphEdge e : temp) { if (iEdgeLabel.equals(e.getLabel())) filtered.add(e); } temp = filtered; } return temp; } }
public class class_name { public Set<OGraphEdge> getInEdges(final String iEdgeLabel) { Set<OGraphEdge> temp = in != null ? in.get() : null; if (temp == null) { if (iEdgeLabel == null) temp = new HashSet<OGraphEdge>(); in = new SoftReference<Set<OGraphEdge>>(temp); // depends on control dependency: [if], data = [(temp] final Set<Object> docs = document.field(OGraphDatabase.VERTEX_FIELD_IN); if (docs != null) { // TRANSFORM ALL THE ARCS for (Object o : docs) { final ODocument doc = (ODocument) ((OIdentifiable) o).getRecord(); if (iEdgeLabel != null && !iEdgeLabel.equals(doc.field(OGraphDatabase.LABEL))) continue; temp.add((OGraphEdge) database.getUserObjectByRecord(doc, null)); // depends on control dependency: [for], data = [o] } } } else if (iEdgeLabel != null) { // FILTER THE EXISTENT COLLECTION HashSet<OGraphEdge> filtered = new HashSet<OGraphEdge>(); for (OGraphEdge e : temp) { if (iEdgeLabel.equals(e.getLabel())) filtered.add(e); } temp = filtered; // depends on control dependency: [if], data = [none] } return temp; } }
public class class_name { public void computeOptimalStrategy() { long heavyMin, revHeavyMin, leftMin, revLeftMin, rightMin, revRightMin; long min = -1; int strategy = -1; int parent1 = -1; int parent2 = -1; boolean[] nodeTypeLeft1 = it1.nodeType[LEFT]; boolean[] nodeTypeLeft2 = it2.nodeType[LEFT]; boolean[] nodeTypeRigt1 = it1.nodeType[RIGHT]; boolean[] nodeTypeRight2 = it2.nodeType[RIGHT]; boolean[] nodeTypeHeavy1 = it1.nodeType[HEAVY]; boolean[] nodeTypeHeavy2 = it2.nodeType[HEAVY]; int[] post2size1 = it1.info[POST2_SIZE]; int[] post2size2 = it2.info[POST2_SIZE]; int[] post2descSum1 = it1.info[POST2_DESC_SUM]; int[] post2descSum2 = it2.info[POST2_DESC_SUM]; int[] post2krSum1 = it1.info[POST2_KR_SUM]; int[] post2krSum2 = it2.info[POST2_KR_SUM]; int[] post2revkrSum1 = it1.info[POST2_REV_KR_SUM]; int[] post2revkrSum2 = it2.info[POST2_REV_KR_SUM]; int[] post2parent1 = it1.info[POST2_PARENT]; int[] post2parent2 = it2.info[POST2_PARENT]; str = new int[size1][size2]; // v represents nodes of left input tree in postorder // w represents nodes of right input tree in postorder for (int v = 0; v < size1; v++) { Arrays.fill(costW[0], 0); Arrays.fill(costW[1], 0); Arrays.fill(costW[2], 0); for (int w = 0; w < size2; w++) { if (post2size2[w] == 1) { // putTree zeros into arrays costW[LEFT][w] = 0; costW[RIGHT][w] = 0; costW[HEAVY][w] = 0; } if (post2size1[v] == 1) { // putTree zeros into arrays costV[LEFT][v][w] = 0; costV[RIGHT][v][w] = 0; costV[HEAVY][v][w] = 0; } // TODO: some things below may be putTree to outer loop // count the minimum + get the strategy heavyMin = (long) post2size1[v] * (long) post2descSum2[w] + costV[HEAVY][v][w]; revHeavyMin = (long) post2size2[w] * (long) post2descSum1[v] + costW[HEAVY][w]; leftMin = (long) post2size1[v] * (long) post2krSum2[w] + costV[LEFT][v][w]; revLeftMin = (long) post2size2[w] * (long) post2krSum1[v] + costW[LEFT][w]; rightMin = (long) post2size1[v] * (long) post2revkrSum2[w] + costV[RIGHT][v][w]; revRightMin = (long) post2size2[w] * (long) post2revkrSum1[v] + costW[RIGHT][w]; long[] mins = { leftMin, rightMin, heavyMin, Long.MAX_VALUE, revLeftMin, revRightMin, revHeavyMin }; min = leftMin; strategy = 0; for (int i = 1; i <= 6; i++) { if (mins[i] < min) { min = mins[i]; strategy = i; } } // store the strategy for the minimal cost str[v][w] = strategy; // fill the cost arrays parent1 = post2parent1[v]; if (parent1 != -1) { costV[HEAVY][parent1][w] += nodeTypeHeavy1[v] ? costV[HEAVY][v][w] : min; costV[RIGHT][parent1][w] += nodeTypeRigt1[v] ? costV[RIGHT][v][w] : min; costV[LEFT][parent1][w] += nodeTypeLeft1[v] ? costV[LEFT][v][w] : min; } parent2 = post2parent2[w]; if (parent2 != -1) { costW[HEAVY][parent2] += nodeTypeHeavy2[w] ? costW[HEAVY][w] : min; costW[LEFT][parent2] += nodeTypeLeft2[w] ? costW[LEFT][w] : min; costW[RIGHT][parent2] += nodeTypeRight2[w] ? costW[RIGHT][w] : min; } } } } }
public class class_name { public void computeOptimalStrategy() { long heavyMin, revHeavyMin, leftMin, revLeftMin, rightMin, revRightMin; long min = -1; int strategy = -1; int parent1 = -1; int parent2 = -1; boolean[] nodeTypeLeft1 = it1.nodeType[LEFT]; boolean[] nodeTypeLeft2 = it2.nodeType[LEFT]; boolean[] nodeTypeRigt1 = it1.nodeType[RIGHT]; boolean[] nodeTypeRight2 = it2.nodeType[RIGHT]; boolean[] nodeTypeHeavy1 = it1.nodeType[HEAVY]; boolean[] nodeTypeHeavy2 = it2.nodeType[HEAVY]; int[] post2size1 = it1.info[POST2_SIZE]; int[] post2size2 = it2.info[POST2_SIZE]; int[] post2descSum1 = it1.info[POST2_DESC_SUM]; int[] post2descSum2 = it2.info[POST2_DESC_SUM]; int[] post2krSum1 = it1.info[POST2_KR_SUM]; int[] post2krSum2 = it2.info[POST2_KR_SUM]; int[] post2revkrSum1 = it1.info[POST2_REV_KR_SUM]; int[] post2revkrSum2 = it2.info[POST2_REV_KR_SUM]; int[] post2parent1 = it1.info[POST2_PARENT]; int[] post2parent2 = it2.info[POST2_PARENT]; str = new int[size1][size2]; // v represents nodes of left input tree in postorder // w represents nodes of right input tree in postorder for (int v = 0; v < size1; v++) { Arrays.fill(costW[0], 0); // depends on control dependency: [for], data = [none] Arrays.fill(costW[1], 0); // depends on control dependency: [for], data = [none] Arrays.fill(costW[2], 0); // depends on control dependency: [for], data = [none] for (int w = 0; w < size2; w++) { if (post2size2[w] == 1) { // putTree zeros into arrays costW[LEFT][w] = 0; // depends on control dependency: [if], data = [none] costW[RIGHT][w] = 0; // depends on control dependency: [if], data = [none] costW[HEAVY][w] = 0; // depends on control dependency: [if], data = [none] } if (post2size1[v] == 1) { // putTree zeros into arrays costV[LEFT][v][w] = 0; // depends on control dependency: [if], data = [none] costV[RIGHT][v][w] = 0; // depends on control dependency: [if], data = [none] costV[HEAVY][v][w] = 0; // depends on control dependency: [if], data = [none] } // TODO: some things below may be putTree to outer loop // count the minimum + get the strategy heavyMin = (long) post2size1[v] * (long) post2descSum2[w] + costV[HEAVY][v][w]; // depends on control dependency: [for], data = [none] revHeavyMin = (long) post2size2[w] * (long) post2descSum1[v] + costW[HEAVY][w]; // depends on control dependency: [for], data = [none] leftMin = (long) post2size1[v] * (long) post2krSum2[w] + costV[LEFT][v][w]; // depends on control dependency: [for], data = [none] revLeftMin = (long) post2size2[w] * (long) post2krSum1[v] + costW[LEFT][w]; // depends on control dependency: [for], data = [none] rightMin = (long) post2size1[v] * (long) post2revkrSum2[w] + costV[RIGHT][v][w]; // depends on control dependency: [for], data = [none] revRightMin = (long) post2size2[w] * (long) post2revkrSum1[v] + costW[RIGHT][w]; // depends on control dependency: [for], data = [none] long[] mins = { leftMin, rightMin, heavyMin, Long.MAX_VALUE, revLeftMin, revRightMin, revHeavyMin }; min = leftMin; // depends on control dependency: [for], data = [none] strategy = 0; // depends on control dependency: [for], data = [none] for (int i = 1; i <= 6; i++) { if (mins[i] < min) { min = mins[i]; // depends on control dependency: [if], data = [none] strategy = i; // depends on control dependency: [if], data = [none] } } // store the strategy for the minimal cost str[v][w] = strategy; // depends on control dependency: [for], data = [w] // fill the cost arrays parent1 = post2parent1[v]; // depends on control dependency: [for], data = [none] if (parent1 != -1) { costV[HEAVY][parent1][w] += nodeTypeHeavy1[v] ? costV[HEAVY][v][w] : min; // depends on control dependency: [if], data = [none] costV[RIGHT][parent1][w] += nodeTypeRigt1[v] ? costV[RIGHT][v][w] : min; // depends on control dependency: [if], data = [none] costV[LEFT][parent1][w] += nodeTypeLeft1[v] ? costV[LEFT][v][w] : min; // depends on control dependency: [if], data = [none] } parent2 = post2parent2[w]; // depends on control dependency: [for], data = [w] if (parent2 != -1) { costW[HEAVY][parent2] += nodeTypeHeavy2[w] ? costW[HEAVY][w] : min; // depends on control dependency: [if], data = [none] costW[LEFT][parent2] += nodeTypeLeft2[w] ? costW[LEFT][w] : min; // depends on control dependency: [if], data = [none] costW[RIGHT][parent2] += nodeTypeRight2[w] ? costW[RIGHT][w] : min; // depends on control dependency: [if], data = [none] } } } } }
public class class_name { protected void closeResources(Connection connection) { if (cacheConnection) return; if (connection != null && dataSource != null) { try { connection.close(); } catch (SQLException e) { LOG.finest("Caught exception closing connection: " + e.getMessage() + " - continuing"); } } } }
public class class_name { protected void closeResources(Connection connection) { if (cacheConnection) return; if (connection != null && dataSource != null) { try { connection.close(); // depends on control dependency: [try], data = [none] } catch (SQLException e) { LOG.finest("Caught exception closing connection: " + e.getMessage() + " - continuing"); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void updateDefinition(BaseDestinationDefinition destinationDefinition) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "updateDefinition", new Object[] {destinationDefinition}); DestinationDefinition oldDefinition = definition; DestinationDefinition newDefinition = (DestinationDefinition) destinationDefinition; // Reset values to force a reload on first reference _maxFailedDeliveries = -1; _blockedRetryInterval = -1; if (!isPubSub() && ((oldDefinition == null) || (oldDefinition.isReceiveExclusive() != newDefinition.isReceiveExclusive()))) { // notify the AnycastOutputHandler, *before* throwing off all consumers. // If this is not done, AnycastOutputHandler could // create a new consumer before knowing the change in the receiveExclusive value which is not good! notifyAOHReceiveExclusiveChange(newDefinition.isReceiveExclusive()); //throw off all consumers attached through this destination ConsumerDispatcher cm = (ConsumerDispatcher)getLocalPtoPConsumerManager(); if (cm != null) { cm.closeAllConsumersForReceiveExclusive(); } // notify the RME RemoteConsumerDispatchers that the receiveExlusive value has changed notifyRCDReceiveExclusiveChange(newDefinition.isReceiveExclusive()); } // definition must be updated before notifying consumer dispatcher(s) of update definition = (DestinationDefinition) destinationDefinition; if ((oldDefinition == null) || (oldDefinition.isReceiveAllowed() != newDefinition.isReceiveAllowed())) { _isReceiveAllowed = newDefinition.isReceiveAllowed(); notifyReceiveAllowed(this); //Tell any aliases that inherit the receive allowed value from this //destination that the value has changed. notifyTargettingAliasesReceiveAllowed(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "updateDefinition"); } }
public class class_name { public void updateDefinition(BaseDestinationDefinition destinationDefinition) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "updateDefinition", new Object[] {destinationDefinition}); DestinationDefinition oldDefinition = definition; DestinationDefinition newDefinition = (DestinationDefinition) destinationDefinition; // Reset values to force a reload on first reference _maxFailedDeliveries = -1; _blockedRetryInterval = -1; if (!isPubSub() && ((oldDefinition == null) || (oldDefinition.isReceiveExclusive() != newDefinition.isReceiveExclusive()))) { // notify the AnycastOutputHandler, *before* throwing off all consumers. // If this is not done, AnycastOutputHandler could // create a new consumer before knowing the change in the receiveExclusive value which is not good! notifyAOHReceiveExclusiveChange(newDefinition.isReceiveExclusive()); // depends on control dependency: [if], data = [none] //throw off all consumers attached through this destination ConsumerDispatcher cm = (ConsumerDispatcher)getLocalPtoPConsumerManager(); if (cm != null) { cm.closeAllConsumersForReceiveExclusive(); // depends on control dependency: [if], data = [none] } // notify the RME RemoteConsumerDispatchers that the receiveExlusive value has changed notifyRCDReceiveExclusiveChange(newDefinition.isReceiveExclusive()); // depends on control dependency: [if], data = [none] } // definition must be updated before notifying consumer dispatcher(s) of update definition = (DestinationDefinition) destinationDefinition; if ((oldDefinition == null) || (oldDefinition.isReceiveAllowed() != newDefinition.isReceiveAllowed())) { _isReceiveAllowed = newDefinition.isReceiveAllowed(); // depends on control dependency: [if], data = [none] notifyReceiveAllowed(this); // depends on control dependency: [if], data = [none] //Tell any aliases that inherit the receive allowed value from this //destination that the value has changed. notifyTargettingAliasesReceiveAllowed(); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "updateDefinition"); } }
public class class_name { public static boolean isFilePathAcceptable(File file, final FileFilter fileFilter) { do { if (fileFilter != null && !fileFilter.accept(file)) { return false; } file = file.getParentFile(); } while (file != null); return true; } }
public class class_name { public static boolean isFilePathAcceptable(File file, final FileFilter fileFilter) { do { if (fileFilter != null && !fileFilter.accept(file)) { return false; // depends on control dependency: [if], data = [none] } file = file.getParentFile(); } while (file != null); return true; } }
public class class_name { protected static boolean dispatchKeyEvent (KeyEvent e) { // ignore non-keypress events if (e.getID() != KeyEvent.KEY_PRESSED) { return false; } // bail here if we have no hooks registered for this key code ArrayList<Tuple<Integer,Hook>> list = _bindings.get(e.getKeyCode()); if (list == null) { return false; } // scan the list of registered hooks checking for any that match // the depressed set of modifier keys boolean handled = false; int hcount = list.size(); for (int ii = 0; ii < hcount; ii++) { Tuple<Integer,Hook> tup = list.get(ii); int mask = tup.left.intValue(); if ((e.getModifiersEx() & mask) == mask) { try { tup.right.invoke(); handled = true; } catch (Throwable t) { log.warning("Hook failed", "event", e, "hook", tup.right, t); } } } return handled; } }
public class class_name { protected static boolean dispatchKeyEvent (KeyEvent e) { // ignore non-keypress events if (e.getID() != KeyEvent.KEY_PRESSED) { return false; // depends on control dependency: [if], data = [none] } // bail here if we have no hooks registered for this key code ArrayList<Tuple<Integer,Hook>> list = _bindings.get(e.getKeyCode()); if (list == null) { return false; // depends on control dependency: [if], data = [none] } // scan the list of registered hooks checking for any that match // the depressed set of modifier keys boolean handled = false; int hcount = list.size(); for (int ii = 0; ii < hcount; ii++) { Tuple<Integer,Hook> tup = list.get(ii); int mask = tup.left.intValue(); if ((e.getModifiersEx() & mask) == mask) { try { tup.right.invoke(); // depends on control dependency: [try], data = [none] handled = true; // depends on control dependency: [try], data = [none] } catch (Throwable t) { log.warning("Hook failed", "event", e, "hook", tup.right, t); } // depends on control dependency: [catch], data = [none] } } return handled; } }
public class class_name { public static void animate(View imageView, int durationMillis) { if (imageView != null) { AlphaAnimation fadeImage = new AlphaAnimation(0, 1); fadeImage.setDuration(durationMillis); fadeImage.setInterpolator(new DecelerateInterpolator()); imageView.startAnimation(fadeImage); } } }
public class class_name { public static void animate(View imageView, int durationMillis) { if (imageView != null) { AlphaAnimation fadeImage = new AlphaAnimation(0, 1); fadeImage.setDuration(durationMillis); // depends on control dependency: [if], data = [none] fadeImage.setInterpolator(new DecelerateInterpolator()); // depends on control dependency: [if], data = [none] imageView.startAnimation(fadeImage); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public DataBuffer relocateConstantSpace(DataBuffer dataBuffer) { // we always assume that data is sync, and valid on host side Integer deviceId = AtomicAllocator.getInstance().getDeviceId(); ensureMaps(deviceId); if (dataBuffer instanceof CudaIntDataBuffer) { int[] data = dataBuffer.asInt(); return getConstantBuffer(data); } else if (dataBuffer instanceof CudaFloatDataBuffer) { float[] data = dataBuffer.asFloat(); return getConstantBuffer(data); } else if (dataBuffer instanceof CudaDoubleDataBuffer) { double[] data = dataBuffer.asDouble(); return getConstantBuffer(data); } else if (dataBuffer instanceof CudaHalfDataBuffer) { float[] data = dataBuffer.asFloat(); return getConstantBuffer(data); } else if (dataBuffer instanceof CudaLongDataBuffer) { long[] data = dataBuffer.asLong(); return getConstantBuffer(data); } throw new IllegalStateException("Unknown CudaDataBuffer opType"); } }
public class class_name { @Override public DataBuffer relocateConstantSpace(DataBuffer dataBuffer) { // we always assume that data is sync, and valid on host side Integer deviceId = AtomicAllocator.getInstance().getDeviceId(); ensureMaps(deviceId); if (dataBuffer instanceof CudaIntDataBuffer) { int[] data = dataBuffer.asInt(); return getConstantBuffer(data); // depends on control dependency: [if], data = [none] } else if (dataBuffer instanceof CudaFloatDataBuffer) { float[] data = dataBuffer.asFloat(); return getConstantBuffer(data); // depends on control dependency: [if], data = [none] } else if (dataBuffer instanceof CudaDoubleDataBuffer) { double[] data = dataBuffer.asDouble(); return getConstantBuffer(data); // depends on control dependency: [if], data = [none] } else if (dataBuffer instanceof CudaHalfDataBuffer) { float[] data = dataBuffer.asFloat(); return getConstantBuffer(data); // depends on control dependency: [if], data = [none] } else if (dataBuffer instanceof CudaLongDataBuffer) { long[] data = dataBuffer.asLong(); return getConstantBuffer(data); // depends on control dependency: [if], data = [none] } throw new IllegalStateException("Unknown CudaDataBuffer opType"); } }
public class class_name { private void parseFirstConsonant() { // find first of (vnfirstconsonant) // if not found, first consonant = ZERO // else the found consonant Iterator iter = alFirstConsonants.iterator(); while (iter.hasNext()) { String strFirstCon = (String) iter.next(); if (strSyllable.startsWith(strFirstCon, iCurPos)) { strFirstConsonant = strFirstCon; iCurPos += strFirstCon.length(); return; } } strFirstConsonant = ZERO; } }
public class class_name { private void parseFirstConsonant() { // find first of (vnfirstconsonant) // if not found, first consonant = ZERO // else the found consonant Iterator iter = alFirstConsonants.iterator(); while (iter.hasNext()) { String strFirstCon = (String) iter.next(); if (strSyllable.startsWith(strFirstCon, iCurPos)) { strFirstConsonant = strFirstCon; // depends on control dependency: [if], data = [none] iCurPos += strFirstCon.length(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } strFirstConsonant = ZERO; } }
public class class_name { public Optional<CoreNLPSentence> firstSentenceContaining(final OffsetRange<CharOffset> offsets) { for(final CoreNLPSentence sentence: sentences) { if(sentence.offsets().contains(offsets)) { return Optional.of(sentence); } } return Optional.absent(); } }
public class class_name { public Optional<CoreNLPSentence> firstSentenceContaining(final OffsetRange<CharOffset> offsets) { for(final CoreNLPSentence sentence: sentences) { if(sentence.offsets().contains(offsets)) { return Optional.of(sentence); // depends on control dependency: [if], data = [none] } } return Optional.absent(); } }
public class class_name { public Token getAccessToken() { Token accessToken = authPersistence.getToken(); if (isTokenValid(accessToken)) { return accessToken; } // authorize accessToken = authorize(); // save authPersistence.saveToken(accessToken); return accessToken; } }
public class class_name { public Token getAccessToken() { Token accessToken = authPersistence.getToken(); if (isTokenValid(accessToken)) { return accessToken; // depends on control dependency: [if], data = [none] } // authorize accessToken = authorize(); // save authPersistence.saveToken(accessToken); return accessToken; } }
public class class_name { private boolean setPositionByMin() { // min always points to a start of a record long min = getPosition(); if (min < 0) { return false; } try { long max = reader.length(); int recSize = reader.readLength(); if (recSize < 0 || min + recSize + 8 > max) { // Even first record is incomplete return false; } DataInputStream input = readRecord(recSize); if (LogRecordSerializer.RECORD != formatter.getType(input)) { // First record is not a record return false; } RepositoryLogRecordImpl record = formatter.deserializeLogTime(input); // First record already satisfies condition if (verifyMin(record)) { return true; } reader.seek(max); long nextPosition = seekToPrevRecord(formatter); max = nextPosition; do { recSize = reader.readLength(); if (recSize < 0 || nextPosition + recSize + 8 > max) { // corrupt record, good records are closer to the start. max = nextPosition; } else { input = readRecord(recSize); if (LogRecordSerializer.RECORD != formatter.getType(input)) { // Got all the way to the header record. max = nextPosition; } else { record = formatter.deserializeLogTime(input); if (verifyMin(record)) { max = nextPosition; } else { min = nextPosition + recSize + 8; } } } reader.seek((min + max)/2); nextPosition = seekToNextRecord(formatter); // loop until seek to next record returns us back to max. } while (nextPosition < max); return true; } catch (IOException ex) { logger.logp(Level.SEVERE, className, "setPositionBySeq", "Error to set position in {0} by min condition: ", new Object[]{file, ex.getMessage()}); logger.logp(Level.SEVERE, className, "setPositionBySeq", ex.getLocalizedMessage(), ex); // Fall through to return false. } finally { try { reader.seek(min); } catch (IOException ex) { // too late to fix, allow reading logic to work around it. // don't use return here it would mask all uncaught exceptions } } return false; } }
public class class_name { private boolean setPositionByMin() { // min always points to a start of a record long min = getPosition(); if (min < 0) { return false; // depends on control dependency: [if], data = [none] } try { long max = reader.length(); int recSize = reader.readLength(); if (recSize < 0 || min + recSize + 8 > max) { // Even first record is incomplete return false; // depends on control dependency: [if], data = [none] } DataInputStream input = readRecord(recSize); if (LogRecordSerializer.RECORD != formatter.getType(input)) { // First record is not a record return false; // depends on control dependency: [if], data = [none] } RepositoryLogRecordImpl record = formatter.deserializeLogTime(input); // First record already satisfies condition if (verifyMin(record)) { return true; // depends on control dependency: [if], data = [none] } reader.seek(max); // depends on control dependency: [try], data = [none] long nextPosition = seekToPrevRecord(formatter); max = nextPosition; // depends on control dependency: [try], data = [none] do { recSize = reader.readLength(); if (recSize < 0 || nextPosition + recSize + 8 > max) { // corrupt record, good records are closer to the start. max = nextPosition; // depends on control dependency: [if], data = [none] } else { input = readRecord(recSize); // depends on control dependency: [if], data = [none] if (LogRecordSerializer.RECORD != formatter.getType(input)) { // Got all the way to the header record. max = nextPosition; // depends on control dependency: [if], data = [none] } else { record = formatter.deserializeLogTime(input); // depends on control dependency: [if], data = [none] if (verifyMin(record)) { max = nextPosition; // depends on control dependency: [if], data = [none] } else { min = nextPosition + recSize + 8; // depends on control dependency: [if], data = [none] } } } reader.seek((min + max)/2); nextPosition = seekToNextRecord(formatter); // loop until seek to next record returns us back to max. } while (nextPosition < max); return true; // depends on control dependency: [try], data = [none] } catch (IOException ex) { logger.logp(Level.SEVERE, className, "setPositionBySeq", "Error to set position in {0} by min condition: ", new Object[]{file, ex.getMessage()}); logger.logp(Level.SEVERE, className, "setPositionBySeq", ex.getLocalizedMessage(), ex); // Fall through to return false. } finally { // depends on control dependency: [catch], data = [none] try { reader.seek(min); // depends on control dependency: [try], data = [none] } catch (IOException ex) { // too late to fix, allow reading logic to work around it. // don't use return here it would mask all uncaught exceptions } // depends on control dependency: [catch], data = [none] } return false; } }
public class class_name { public void alignSheetWithFab(View fab) { // NOTE: View.getLocationOnScreen() returns the view's coordinates on the screen // whereas other view methods like getRight() and getY() return coordinates relative // to the view's parent. Using those methods can lead to incorrect calculations when // the two views do not have the same parent. // Get FAB's coordinates int[] fabCoords = new int[2]; fab.getLocationOnScreen(fabCoords); // Get sheet's coordinates int[] sheetCoords = new int[2]; sheet.getLocationOnScreen(sheetCoords); // NOTE: Use the diffs between the positions of the FAB and sheet to align the sheet. // We have to use the diffs because the coordinates returned by getLocationOnScreen() // include the status bar and any other system UI elements, meaning the coordinates // aren't representative of the usable screen space. int leftDiff = sheetCoords[0] - fabCoords[0]; int rightDiff = (sheetCoords[0] + sheet.getWidth()) - (fabCoords[0] + fab.getWidth()); int topDiff = sheetCoords[1] - fabCoords[1]; int bottomDiff = (sheetCoords[1] + sheet.getHeight()) - (fabCoords[1] + fab.getHeight()); // NOTE: Preserve the sheet's margins to allow users to shift the sheet's position // to compensate for the fact that the design support library's FAB has extra // padding within the view ViewGroup.MarginLayoutParams sheetLayoutParams = (ViewGroup.MarginLayoutParams) sheet .getLayoutParams(); // Set sheet's new coordinates (only if there is a change in coordinates because // setting the same coordinates can cause the view to "drift" - moving 0.5 to 1 pixels // around the screen) if (rightDiff != 0) { float sheetX = sheet.getX(); // Align the right side of the sheet with the right side of the FAB if // doing so would not move the sheet off the screen if (rightDiff <= sheetX) { sheet.setX(sheetX - rightDiff - sheetLayoutParams.rightMargin); revealXDirection = RevealXDirection.LEFT; } // Otherwise, align the left side of the sheet with the left side of the FAB else if (leftDiff != 0 && leftDiff <= sheetX) { sheet.setX(sheetX - leftDiff + sheetLayoutParams.leftMargin); revealXDirection = RevealXDirection.RIGHT; } } if (bottomDiff != 0) { float sheetY = sheet.getY(); // Align the bottom of the sheet with the bottom of the FAB if (bottomDiff <= sheetY) { sheet.setY(sheetY - bottomDiff - sheetLayoutParams.bottomMargin); revealYDirection = RevealYDirection.UP; } // Otherwise, align the top of the sheet with the top of the FAB else if (topDiff != 0 && topDiff <= sheetY) { sheet.setY(sheetY - topDiff + sheetLayoutParams.topMargin); revealYDirection = RevealYDirection.DOWN; } } } }
public class class_name { public void alignSheetWithFab(View fab) { // NOTE: View.getLocationOnScreen() returns the view's coordinates on the screen // whereas other view methods like getRight() and getY() return coordinates relative // to the view's parent. Using those methods can lead to incorrect calculations when // the two views do not have the same parent. // Get FAB's coordinates int[] fabCoords = new int[2]; fab.getLocationOnScreen(fabCoords); // Get sheet's coordinates int[] sheetCoords = new int[2]; sheet.getLocationOnScreen(sheetCoords); // NOTE: Use the diffs between the positions of the FAB and sheet to align the sheet. // We have to use the diffs because the coordinates returned by getLocationOnScreen() // include the status bar and any other system UI elements, meaning the coordinates // aren't representative of the usable screen space. int leftDiff = sheetCoords[0] - fabCoords[0]; int rightDiff = (sheetCoords[0] + sheet.getWidth()) - (fabCoords[0] + fab.getWidth()); int topDiff = sheetCoords[1] - fabCoords[1]; int bottomDiff = (sheetCoords[1] + sheet.getHeight()) - (fabCoords[1] + fab.getHeight()); // NOTE: Preserve the sheet's margins to allow users to shift the sheet's position // to compensate for the fact that the design support library's FAB has extra // padding within the view ViewGroup.MarginLayoutParams sheetLayoutParams = (ViewGroup.MarginLayoutParams) sheet .getLayoutParams(); // Set sheet's new coordinates (only if there is a change in coordinates because // setting the same coordinates can cause the view to "drift" - moving 0.5 to 1 pixels // around the screen) if (rightDiff != 0) { float sheetX = sheet.getX(); // Align the right side of the sheet with the right side of the FAB if // doing so would not move the sheet off the screen if (rightDiff <= sheetX) { sheet.setX(sheetX - rightDiff - sheetLayoutParams.rightMargin); // depends on control dependency: [if], data = [none] revealXDirection = RevealXDirection.LEFT; // depends on control dependency: [if], data = [none] } // Otherwise, align the left side of the sheet with the left side of the FAB else if (leftDiff != 0 && leftDiff <= sheetX) { sheet.setX(sheetX - leftDiff + sheetLayoutParams.leftMargin); // depends on control dependency: [if], data = [none] revealXDirection = RevealXDirection.RIGHT; // depends on control dependency: [if], data = [none] } } if (bottomDiff != 0) { float sheetY = sheet.getY(); // Align the bottom of the sheet with the bottom of the FAB if (bottomDiff <= sheetY) { sheet.setY(sheetY - bottomDiff - sheetLayoutParams.bottomMargin); // depends on control dependency: [if], data = [none] revealYDirection = RevealYDirection.UP; // depends on control dependency: [if], data = [none] } // Otherwise, align the top of the sheet with the top of the FAB else if (topDiff != 0 && topDiff <= sheetY) { sheet.setY(sheetY - topDiff + sheetLayoutParams.topMargin); // depends on control dependency: [if], data = [none] revealYDirection = RevealYDirection.DOWN; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Destination withBccAddresses(String... bccAddresses) { if (this.bccAddresses == null) { setBccAddresses(new java.util.ArrayList<String>(bccAddresses.length)); } for (String ele : bccAddresses) { this.bccAddresses.add(ele); } return this; } }
public class class_name { public Destination withBccAddresses(String... bccAddresses) { if (this.bccAddresses == null) { setBccAddresses(new java.util.ArrayList<String>(bccAddresses.length)); // depends on control dependency: [if], data = [none] } for (String ele : bccAddresses) { this.bccAddresses.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static boolean isCausedBy(final Throwable t, final Class<? extends Throwable>... causeTypes) { for (Class<? extends Throwable> type : causeTypes) { if (ExceptionUtils.indexOfType(t, type) >= 0) { return true; } } return false; } }
public class class_name { public static boolean isCausedBy(final Throwable t, final Class<? extends Throwable>... causeTypes) { for (Class<? extends Throwable> type : causeTypes) { if (ExceptionUtils.indexOfType(t, type) >= 0) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public void setDescription(java.util.Collection<StringFilter> description) { if (description == null) { this.description = null; return; } this.description = new java.util.ArrayList<StringFilter>(description); } }
public class class_name { public void setDescription(java.util.Collection<StringFilter> description) { if (description == null) { this.description = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.description = new java.util.ArrayList<StringFilter>(description); } }
public class class_name { public static ModelNode getDetypedMemoryUsage(final MemoryUsage memoryUsage) { final ModelNode result = new ModelNode(); if (memoryUsage != null) { result.get(PlatformMBeanConstants.INIT).set(memoryUsage.getInit()); result.get(PlatformMBeanConstants.USED).set(memoryUsage.getUsed()); result.get(PlatformMBeanConstants.COMMITTED).set(memoryUsage.getCommitted()); result.get(PlatformMBeanConstants.MAX).set(memoryUsage.getMax()); } return result; } }
public class class_name { public static ModelNode getDetypedMemoryUsage(final MemoryUsage memoryUsage) { final ModelNode result = new ModelNode(); if (memoryUsage != null) { result.get(PlatformMBeanConstants.INIT).set(memoryUsage.getInit()); // depends on control dependency: [if], data = [(memoryUsage] result.get(PlatformMBeanConstants.USED).set(memoryUsage.getUsed()); // depends on control dependency: [if], data = [(memoryUsage] result.get(PlatformMBeanConstants.COMMITTED).set(memoryUsage.getCommitted()); // depends on control dependency: [if], data = [(memoryUsage] result.get(PlatformMBeanConstants.MAX).set(memoryUsage.getMax()); // depends on control dependency: [if], data = [(memoryUsage] } return result; } }
public class class_name { @Override protected void init(CmsObject cms, CmsMessages widgetDialog, I_CmsWidgetParameter param, String configuration) { if (configuration == null) { // no configuration String found, return return; } configuration = CmsMacroResolver.resolveMacros(configuration, cms, widgetDialog); JSONObject jsonObj = new JSONObject(); try { jsonObj = new JSONObject(configuration); } catch (JSONException e) { // initialization failed return; } // determine the class name that fills in values dynamically setClassName(jsonObj.optString(CONFIG_KEY_CLASS, null)); I_CmsImageWidgetDynamicConfiguration dynConf = null; if (getClassName() != null) { try { dynConf = (I_CmsImageWidgetDynamicConfiguration)Class.forName(getClassName()).newInstance(); } catch (Exception e) { // class not found } } // determine if the description field should be shown setShowDescription(jsonObj.optBoolean(CONFIG_KEY_USEDESCRIPTION)); // determine if the format select box should be shown setShowFormat(jsonObj.optBoolean(CONFIG_KEY_USEFORMAT)); if (isShowFormat()) { // only parse options if the format select box should be shown String optionsStr = (String)jsonObj.opt(CONFIG_KEY_FORMATNAMES); setSelectFormatString(optionsStr); setSelectFormat(CmsSelectWidgetOption.parseOptions(optionsStr)); // get the corresponding format values as well JSONArray formatValues = jsonObj.optJSONArray(CONFIG_KEY_FORMATVALUES); if (formatValues != null) { List<String> formatValueList = new ArrayList<String>(formatValues.length()); for (int i = 0; i < formatValues.length(); i++) { formatValueList.add(formatValues.optString(i)); } setFormatValues(formatValueList); } if (dynConf != null) { setFormatValues( dynConf.getFormatValues(cms, widgetDialog, param, getSelectFormat(), getFormatValues())); } } // determine the initial image list settings setType(jsonObj.optString(CONFIG_KEY_TYPE)); if ((CONFIG_VALUE_DYNAMIC.equals(getType()) || CmsStringUtil.isEmpty(getType())) && (dynConf != null)) { setType(dynConf.getType(cms, widgetDialog, param)); } setStartup(jsonObj.optString(CONFIG_KEY_STARTUP)); if ((CONFIG_VALUE_DYNAMIC.equals(getStartup()) || CmsStringUtil.isEmpty(getStartup())) && (dynConf != null)) { setStartup(dynConf.getStartup(cms, widgetDialog, param)); } // determine the scale parameters setScaleParams(jsonObj.optString(CONFIG_KEY_SCALEPARAMS)); } }
public class class_name { @Override protected void init(CmsObject cms, CmsMessages widgetDialog, I_CmsWidgetParameter param, String configuration) { if (configuration == null) { // no configuration String found, return return; // depends on control dependency: [if], data = [none] } configuration = CmsMacroResolver.resolveMacros(configuration, cms, widgetDialog); JSONObject jsonObj = new JSONObject(); try { jsonObj = new JSONObject(configuration); // depends on control dependency: [try], data = [none] } catch (JSONException e) { // initialization failed return; } // depends on control dependency: [catch], data = [none] // determine the class name that fills in values dynamically setClassName(jsonObj.optString(CONFIG_KEY_CLASS, null)); I_CmsImageWidgetDynamicConfiguration dynConf = null; if (getClassName() != null) { try { dynConf = (I_CmsImageWidgetDynamicConfiguration)Class.forName(getClassName()).newInstance(); // depends on control dependency: [try], data = [none] } catch (Exception e) { // class not found } // depends on control dependency: [catch], data = [none] } // determine if the description field should be shown setShowDescription(jsonObj.optBoolean(CONFIG_KEY_USEDESCRIPTION)); // determine if the format select box should be shown setShowFormat(jsonObj.optBoolean(CONFIG_KEY_USEFORMAT)); if (isShowFormat()) { // only parse options if the format select box should be shown String optionsStr = (String)jsonObj.opt(CONFIG_KEY_FORMATNAMES); setSelectFormatString(optionsStr); // depends on control dependency: [if], data = [none] setSelectFormat(CmsSelectWidgetOption.parseOptions(optionsStr)); // depends on control dependency: [if], data = [none] // get the corresponding format values as well JSONArray formatValues = jsonObj.optJSONArray(CONFIG_KEY_FORMATVALUES); if (formatValues != null) { List<String> formatValueList = new ArrayList<String>(formatValues.length()); for (int i = 0; i < formatValues.length(); i++) { formatValueList.add(formatValues.optString(i)); // depends on control dependency: [for], data = [i] } setFormatValues(formatValueList); // depends on control dependency: [if], data = [none] } if (dynConf != null) { setFormatValues( dynConf.getFormatValues(cms, widgetDialog, param, getSelectFormat(), getFormatValues())); // depends on control dependency: [if], data = [none] } } // determine the initial image list settings setType(jsonObj.optString(CONFIG_KEY_TYPE)); if ((CONFIG_VALUE_DYNAMIC.equals(getType()) || CmsStringUtil.isEmpty(getType())) && (dynConf != null)) { setType(dynConf.getType(cms, widgetDialog, param)); // depends on control dependency: [if], data = [none] } setStartup(jsonObj.optString(CONFIG_KEY_STARTUP)); if ((CONFIG_VALUE_DYNAMIC.equals(getStartup()) || CmsStringUtil.isEmpty(getStartup())) && (dynConf != null)) { setStartup(dynConf.getStartup(cms, widgetDialog, param)); // depends on control dependency: [if], data = [none] } // determine the scale parameters setScaleParams(jsonObj.optString(CONFIG_KEY_SCALEPARAMS)); } }
public class class_name { public DescribeDBClustersResult withDBClusters(DBCluster... dBClusters) { if (this.dBClusters == null) { setDBClusters(new com.amazonaws.internal.SdkInternalList<DBCluster>(dBClusters.length)); } for (DBCluster ele : dBClusters) { this.dBClusters.add(ele); } return this; } }
public class class_name { public DescribeDBClustersResult withDBClusters(DBCluster... dBClusters) { if (this.dBClusters == null) { setDBClusters(new com.amazonaws.internal.SdkInternalList<DBCluster>(dBClusters.length)); // depends on control dependency: [if], data = [none] } for (DBCluster ele : dBClusters) { this.dBClusters.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { protected void load() { properties = new Properties(); String filename = getFilename(); try { URL url = ClassHelper.getResource(filename); if (url == null) { url = (new File(filename)).toURL(); } logger.info("Loading OJB's properties: " + url); URLConnection conn = url.openConnection(); conn.setUseCaches(false); conn.connect(); InputStream strIn = conn.getInputStream(); properties.load(strIn); strIn.close(); } catch (FileNotFoundException ex) { // [tomdz] If the filename is explicitly reset (null or empty string) then we'll // output an info message because the user did this on purpose // Otherwise, we'll output a warning if ((filename == null) || (filename.length() == 0)) { logger.info("Starting OJB without a properties file. OJB is using default settings instead."); } else { logger.warn("Could not load properties file '"+filename+"'. Using default settings!", ex); } // [tomdz] There seems to be no use of this setting ? //properties.put("valid", "false"); } catch (Exception ex) { throw new MetadataException("An error happend while loading the properties file '"+filename+"'", ex); } } }
public class class_name { protected void load() { properties = new Properties(); String filename = getFilename(); try { URL url = ClassHelper.getResource(filename); if (url == null) { url = (new File(filename)).toURL(); // depends on control dependency: [if], data = [none] } logger.info("Loading OJB's properties: " + url); // depends on control dependency: [try], data = [none] URLConnection conn = url.openConnection(); conn.setUseCaches(false); // depends on control dependency: [try], data = [none] conn.connect(); // depends on control dependency: [try], data = [none] InputStream strIn = conn.getInputStream(); properties.load(strIn); // depends on control dependency: [try], data = [none] strIn.close(); // depends on control dependency: [try], data = [none] } catch (FileNotFoundException ex) { // [tomdz] If the filename is explicitly reset (null or empty string) then we'll // output an info message because the user did this on purpose // Otherwise, we'll output a warning if ((filename == null) || (filename.length() == 0)) { logger.info("Starting OJB without a properties file. OJB is using default settings instead."); // depends on control dependency: [if], data = [none] } else { logger.warn("Could not load properties file '"+filename+"'. Using default settings!", ex); // depends on control dependency: [if], data = [none] } // [tomdz] There seems to be no use of this setting ? //properties.put("valid", "false"); } // depends on control dependency: [catch], data = [none] catch (Exception ex) { throw new MetadataException("An error happend while loading the properties file '"+filename+"'", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void addInheritedMemberSummary(AbstractMemberWriter mw, ClassDoc cd, ProgramElementDoc member, boolean isFirst, Content linksTree) { if (! isFirst) { linksTree.addContent(", "); } mw.addInheritedSummaryLink(cd, member, linksTree); } }
public class class_name { public void addInheritedMemberSummary(AbstractMemberWriter mw, ClassDoc cd, ProgramElementDoc member, boolean isFirst, Content linksTree) { if (! isFirst) { linksTree.addContent(", "); // depends on control dependency: [if], data = [none] } mw.addInheritedSummaryLink(cd, member, linksTree); } }
public class class_name { public static Element searchForNode(final Element root, final String searchKey, final String attrName, final DitaClass classValue) { if (root == null) { return null; } final Queue<Element> queue = new LinkedList<>(); queue.offer(root); while (!queue.isEmpty()) { final Element pe = queue.poll(); final NodeList pchildrenList = pe.getChildNodes(); for (int i = 0; i < pchildrenList.getLength(); i++) { final Node node = pchildrenList.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { queue.offer((Element) node); } } if (pe.getAttribute(ATTRIBUTE_NAME_CLASS) == null || !classValue.matches(pe)) { continue; } final Attr value = pe.getAttributeNode(attrName); if (value == null) { continue; } if (searchKey.equals(value.getValue())) { return pe; } } return null; } }
public class class_name { public static Element searchForNode(final Element root, final String searchKey, final String attrName, final DitaClass classValue) { if (root == null) { return null; // depends on control dependency: [if], data = [none] } final Queue<Element> queue = new LinkedList<>(); queue.offer(root); while (!queue.isEmpty()) { final Element pe = queue.poll(); final NodeList pchildrenList = pe.getChildNodes(); for (int i = 0; i < pchildrenList.getLength(); i++) { final Node node = pchildrenList.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { queue.offer((Element) node); // depends on control dependency: [if], data = [none] } } if (pe.getAttribute(ATTRIBUTE_NAME_CLASS) == null || !classValue.matches(pe)) { continue; } final Attr value = pe.getAttributeNode(attrName); if (value == null) { continue; } if (searchKey.equals(value.getValue())) { return pe; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { private int computeReadLength(long currentFetchOffset) { Preconditions.checkState(endOffset >= currentFetchOffset, "Current offset up to to which events are fetched should be less than the configured end offset"); int currentReadLength = Math.max(minReadLength, buffer.capacityAvailable()); if (UNBOUNDED_END_OFFSET == endOffset) { //endOffset is UNBOUNDED_END_OFFSET if the endOffset is not set. return currentReadLength; } long numberOfBytesRemaining = endOffset - currentFetchOffset; return Math.toIntExact(Math.min(currentReadLength, numberOfBytesRemaining)); } }
public class class_name { private int computeReadLength(long currentFetchOffset) { Preconditions.checkState(endOffset >= currentFetchOffset, "Current offset up to to which events are fetched should be less than the configured end offset"); int currentReadLength = Math.max(minReadLength, buffer.capacityAvailable()); if (UNBOUNDED_END_OFFSET == endOffset) { //endOffset is UNBOUNDED_END_OFFSET if the endOffset is not set. return currentReadLength; // depends on control dependency: [if], data = [none] } long numberOfBytesRemaining = endOffset - currentFetchOffset; return Math.toIntExact(Math.min(currentReadLength, numberOfBytesRemaining)); } }
public class class_name { public final String formatDin5008International(final PhoneNumberInterface pphoneNumberData) { final StringBuilder resultNumber = new StringBuilder(); if (isPhoneNumberNotEmpty(pphoneNumberData)) { resultNumber.append('+').append(pphoneNumberData.getCountryCode()).append(' '); if (StringUtils.isNotBlank(pphoneNumberData.getAreaCode())) { resultNumber.append(pphoneNumberData.getAreaCode()).append(' '); } resultNumber.append(pphoneNumberData.getLineNumber()); if (StringUtils.isNotBlank(pphoneNumberData.getExtension())) { resultNumber.append('-'); resultNumber.append(pphoneNumberData.getExtension()); } } return StringUtils.trimToNull(resultNumber.toString()); } }
public class class_name { public final String formatDin5008International(final PhoneNumberInterface pphoneNumberData) { final StringBuilder resultNumber = new StringBuilder(); if (isPhoneNumberNotEmpty(pphoneNumberData)) { resultNumber.append('+').append(pphoneNumberData.getCountryCode()).append(' '); // depends on control dependency: [if], data = [none] if (StringUtils.isNotBlank(pphoneNumberData.getAreaCode())) { resultNumber.append(pphoneNumberData.getAreaCode()).append(' '); // depends on control dependency: [if], data = [none] } resultNumber.append(pphoneNumberData.getLineNumber()); // depends on control dependency: [if], data = [none] if (StringUtils.isNotBlank(pphoneNumberData.getExtension())) { resultNumber.append('-'); // depends on control dependency: [if], data = [none] resultNumber.append(pphoneNumberData.getExtension()); // depends on control dependency: [if], data = [none] } } return StringUtils.trimToNull(resultNumber.toString()); } }
public class class_name { private VirtualTransformedRenditionMetadata getCropRendition(NavigableSet<RenditionMetadata> candidates) { RenditionMetadata original = getOriginalRendition(); if (original == null) { return null; } Double scaleFactor = getCropScaleFactor(); CropDimension scaledCropDimension = new CropDimension( Math.round(cropDimension.getLeft() * scaleFactor), Math.round(cropDimension.getTop() * scaleFactor), Math.round(cropDimension.getWidth() * scaleFactor), Math.round(cropDimension.getHeight() * scaleFactor)); return new VirtualTransformedRenditionMetadata(original.getRendition(), rotateMapWidth(scaledCropDimension.getWidth(), scaledCropDimension.getHeight()), rotateMapHeight(scaledCropDimension.getWidth(), scaledCropDimension.getHeight()), scaledCropDimension, rotation); } }
public class class_name { private VirtualTransformedRenditionMetadata getCropRendition(NavigableSet<RenditionMetadata> candidates) { RenditionMetadata original = getOriginalRendition(); if (original == null) { return null; // depends on control dependency: [if], data = [none] } Double scaleFactor = getCropScaleFactor(); CropDimension scaledCropDimension = new CropDimension( Math.round(cropDimension.getLeft() * scaleFactor), Math.round(cropDimension.getTop() * scaleFactor), Math.round(cropDimension.getWidth() * scaleFactor), Math.round(cropDimension.getHeight() * scaleFactor)); return new VirtualTransformedRenditionMetadata(original.getRendition(), rotateMapWidth(scaledCropDimension.getWidth(), scaledCropDimension.getHeight()), rotateMapHeight(scaledCropDimension.getWidth(), scaledCropDimension.getHeight()), scaledCropDimension, rotation); } }
public class class_name { public final CharSequence[] getSelectedEntries() { List<Integer> indices = indicesOf(values); Collections.sort(indices); if (!indices.isEmpty()) { CharSequence[] selectedEntries = new CharSequence[indices.size()]; int currentIndex = 0; for (int index : indices) { selectedEntries[currentIndex] = getEntries()[index]; currentIndex++; } return selectedEntries; } return null; } }
public class class_name { public final CharSequence[] getSelectedEntries() { List<Integer> indices = indicesOf(values); Collections.sort(indices); if (!indices.isEmpty()) { CharSequence[] selectedEntries = new CharSequence[indices.size()]; int currentIndex = 0; for (int index : indices) { selectedEntries[currentIndex] = getEntries()[index]; // depends on control dependency: [for], data = [index] currentIndex++; // depends on control dependency: [for], data = [none] } return selectedEntries; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public void marshall(FlinkApplicationConfiguration flinkApplicationConfiguration, ProtocolMarshaller protocolMarshaller) { if (flinkApplicationConfiguration == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(flinkApplicationConfiguration.getCheckpointConfiguration(), CHECKPOINTCONFIGURATION_BINDING); protocolMarshaller.marshall(flinkApplicationConfiguration.getMonitoringConfiguration(), MONITORINGCONFIGURATION_BINDING); protocolMarshaller.marshall(flinkApplicationConfiguration.getParallelismConfiguration(), PARALLELISMCONFIGURATION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(FlinkApplicationConfiguration flinkApplicationConfiguration, ProtocolMarshaller protocolMarshaller) { if (flinkApplicationConfiguration == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(flinkApplicationConfiguration.getCheckpointConfiguration(), CHECKPOINTCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(flinkApplicationConfiguration.getMonitoringConfiguration(), MONITORINGCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(flinkApplicationConfiguration.getParallelismConfiguration(), PARALLELISMCONFIGURATION_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 Set<String> getPropertyBundleNameSet() { Set<String> bundleNameSet = new HashSet<>(); for (Object key : props.keySet()) { Matcher matcher = bundleNamePattern.matcher((String) key); if (matcher.matches()) { String id = matcher.group(2); bundleNameSet.add(id); } } return bundleNameSet; } }
public class class_name { public Set<String> getPropertyBundleNameSet() { Set<String> bundleNameSet = new HashSet<>(); for (Object key : props.keySet()) { Matcher matcher = bundleNamePattern.matcher((String) key); if (matcher.matches()) { String id = matcher.group(2); bundleNameSet.add(id); // depends on control dependency: [if], data = [none] } } return bundleNameSet; } }
public class class_name { public RenderResult renderForResult(String template, Map<String, ?> bindings, JinjavaConfig renderConfig) { Context context = new Context(globalContext, bindings, renderConfig.getDisabled()); JinjavaInterpreter parentInterpreter = JinjavaInterpreter.getCurrent(); if (parentInterpreter != null) { renderConfig = parentInterpreter.getConfig(); } JinjavaInterpreter interpreter = new JinjavaInterpreter(this, context, renderConfig); JinjavaInterpreter.pushCurrent(interpreter); try { String result = interpreter.render(template); return new RenderResult(result, interpreter.getContext(), interpreter.getErrorsCopy()); } catch (InterpretException e) { if (e instanceof TemplateSyntaxException) { return new RenderResult(TemplateError.fromException((TemplateSyntaxException) e), interpreter.getContext(), interpreter.getErrorsCopy()); } return new RenderResult(TemplateError.fromSyntaxError(e), interpreter.getContext(), interpreter.getErrorsCopy()); } catch (InvalidArgumentException e) { return new RenderResult(TemplateError.fromInvalidArgumentException(e), interpreter.getContext(), interpreter.getErrorsCopy()); } catch (InvalidInputException e) { return new RenderResult(TemplateError.fromInvalidInputException(e), interpreter.getContext(), interpreter.getErrorsCopy()); } catch (Exception e) { return new RenderResult(TemplateError.fromException(e), interpreter.getContext(), interpreter.getErrorsCopy()); } finally { globalContext.reset(); JinjavaInterpreter.popCurrent(); } } }
public class class_name { public RenderResult renderForResult(String template, Map<String, ?> bindings, JinjavaConfig renderConfig) { Context context = new Context(globalContext, bindings, renderConfig.getDisabled()); JinjavaInterpreter parentInterpreter = JinjavaInterpreter.getCurrent(); if (parentInterpreter != null) { renderConfig = parentInterpreter.getConfig(); // depends on control dependency: [if], data = [none] } JinjavaInterpreter interpreter = new JinjavaInterpreter(this, context, renderConfig); JinjavaInterpreter.pushCurrent(interpreter); try { String result = interpreter.render(template); return new RenderResult(result, interpreter.getContext(), interpreter.getErrorsCopy()); // depends on control dependency: [try], data = [none] } catch (InterpretException e) { if (e instanceof TemplateSyntaxException) { return new RenderResult(TemplateError.fromException((TemplateSyntaxException) e), interpreter.getContext(), interpreter.getErrorsCopy()); // depends on control dependency: [if], data = [none] } return new RenderResult(TemplateError.fromSyntaxError(e), interpreter.getContext(), interpreter.getErrorsCopy()); } catch (InvalidArgumentException e) { // depends on control dependency: [catch], data = [none] return new RenderResult(TemplateError.fromInvalidArgumentException(e), interpreter.getContext(), interpreter.getErrorsCopy()); } catch (InvalidInputException e) { // depends on control dependency: [catch], data = [none] return new RenderResult(TemplateError.fromInvalidInputException(e), interpreter.getContext(), interpreter.getErrorsCopy()); } // depends on control dependency: [catch], data = [none] catch (Exception e) { return new RenderResult(TemplateError.fromException(e), interpreter.getContext(), interpreter.getErrorsCopy()); } finally { // depends on control dependency: [catch], data = [none] globalContext.reset(); JinjavaInterpreter.popCurrent(); } } }
public class class_name { void wrappedSmoothScrollBy(int dx, int dy) { if (!mScrollable) { return; } smoothScrollBy(dx, dy); if (mLockableScrollChangedListener != null) { mLockableScrollChangedListener.onSmoothScrollBy(dx, dy); } } }
public class class_name { void wrappedSmoothScrollBy(int dx, int dy) { if (!mScrollable) { return; // depends on control dependency: [if], data = [none] } smoothScrollBy(dx, dy); if (mLockableScrollChangedListener != null) { mLockableScrollChangedListener.onSmoothScrollBy(dx, dy); // depends on control dependency: [if], data = [none] } } }
public class class_name { public IndicatorData getIndicatorData() { if (INDICATOR_FORMAT.equals(format)) { IndicatorExporter ie = (IndicatorExporter) exporter; return ie.getData(); } else { return new IndicatorData(); } } }
public class class_name { public IndicatorData getIndicatorData() { if (INDICATOR_FORMAT.equals(format)) { IndicatorExporter ie = (IndicatorExporter) exporter; return ie.getData(); // depends on control dependency: [if], data = [none] } else { return new IndicatorData(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private MethodParmDef[] filterParms(MethodDef method) { ArrayList<MethodParmDef> filteredParms = new ArrayList<MethodParmDef>(); for (MethodParmDef element : method.methodParms) { if (element.parmType.equalsIgnoreCase(MethodParmDef.USER_INPUT)) { filteredParms.add(element); } } return filteredParms.toArray(new MethodParmDef[0]); } }
public class class_name { private MethodParmDef[] filterParms(MethodDef method) { ArrayList<MethodParmDef> filteredParms = new ArrayList<MethodParmDef>(); for (MethodParmDef element : method.methodParms) { if (element.parmType.equalsIgnoreCase(MethodParmDef.USER_INPUT)) { filteredParms.add(element); // depends on control dependency: [if], data = [none] } } return filteredParms.toArray(new MethodParmDef[0]); } }
public class class_name { private FileDetails getOldestInactive() { for (FileDetails curFd : fileList) { if (curFd.pid == null) return curFd ; synchronized(activeFilesMap) { FileDetails cur4Pid = activeFilesMap.get(curFd.pid) ; if ( cur4Pid == null || cur4Pid != curFd) { return curFd ; } } } return null ; } }
public class class_name { private FileDetails getOldestInactive() { for (FileDetails curFd : fileList) { if (curFd.pid == null) return curFd ; synchronized(activeFilesMap) { // depends on control dependency: [for], data = [none] FileDetails cur4Pid = activeFilesMap.get(curFd.pid) ; if ( cur4Pid == null || cur4Pid != curFd) { return curFd ; // depends on control dependency: [if], data = [none] } } } return null ; } }
public class class_name { public java.util.List<DiskImage> getDiskImages() { if (diskImages == null) { diskImages = new com.amazonaws.internal.SdkInternalList<DiskImage>(); } return diskImages; } }
public class class_name { public java.util.List<DiskImage> getDiskImages() { if (diskImages == null) { diskImages = new com.amazonaws.internal.SdkInternalList<DiskImage>(); // depends on control dependency: [if], data = [none] } return diskImages; } }
public class class_name { public boolean hasContentType(String... contentTypes) { if (contentTypes == null || contentTypes.length == 0) { return true; } String normalisedContentType = getNormalisedContentTypeValue(); if (normalisedContentType == null) { return false; } for (String contentType : contentTypes) { if (normalisedContentType.contains(contentType)) { return true; } } return false; } }
public class class_name { public boolean hasContentType(String... contentTypes) { if (contentTypes == null || contentTypes.length == 0) { return true; // depends on control dependency: [if], data = [none] } String normalisedContentType = getNormalisedContentTypeValue(); if (normalisedContentType == null) { return false; // depends on control dependency: [if], data = [none] } for (String contentType : contentTypes) { if (normalisedContentType.contains(contentType)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { static public String encode(byte[] bytes, String indentation) { StringBuilder result = new StringBuilder(); int length = bytes.length; if (length == 0) return ""; // empty byte array if (indentation != null) result.append(indentation); encodeByte(bytes, 0, result); for (int i = 1; i < length; i++) { if (i % 40 == 0) { // format to indented 80 character blocks result.append("\n"); if (indentation != null) result.append(indentation); } encodeByte(bytes, i, result); } return result.toString(); } }
public class class_name { static public String encode(byte[] bytes, String indentation) { StringBuilder result = new StringBuilder(); int length = bytes.length; if (length == 0) return ""; // empty byte array if (indentation != null) result.append(indentation); encodeByte(bytes, 0, result); for (int i = 1; i < length; i++) { if (i % 40 == 0) { // format to indented 80 character blocks result.append("\n"); // depends on control dependency: [if], data = [none] if (indentation != null) result.append(indentation); } encodeByte(bytes, i, result); // depends on control dependency: [for], data = [i] } return result.toString(); } }
public class class_name { public static double elementMinReal( ZMatrixD1 a ) { final int size = a.getDataLength(); double min = a.data[0]; for( int i = 2; i < size; i += 2 ) { double val = a.data[i]; if( val < min ) { min = val; } } return min; } }
public class class_name { public static double elementMinReal( ZMatrixD1 a ) { final int size = a.getDataLength(); double min = a.data[0]; for( int i = 2; i < size; i += 2 ) { double val = a.data[i]; if( val < min ) { min = val; // depends on control dependency: [if], data = [none] } } return min; } }
public class class_name { private void writeJsonUpdatesForJob(PrintWriter wrt, JobID jobId) { try { List<AbstractEvent> events = jobmanager.getEvents(jobId); //Serialize job to json wrt.write("{"); wrt.write("\"jobid\": \"" + jobId + "\","); wrt.write("\"timestamp\": \"" + System.currentTimeMillis() + "\","); wrt.write("\"recentjobs\": ["); boolean first = true; for(RecentJobEvent rje: jobmanager.getRecentJobs()) { if(first) { first = false; } else { wrt.write(","); } wrt.write("\""+rje.getJobID().toString()+"\""); } wrt.write("],"); wrt.write("\"vertexevents\": ["); first = true; for(AbstractEvent event: events) { if(event instanceof ExecutionStateChangeEvent) { if(first) { first = false; } else { wrt.write(","); } ExecutionStateChangeEvent vertexevent = (ExecutionStateChangeEvent) event; wrt.write("{"); wrt.write("\"vertexid\": \"" + vertexevent.getVertexID() + "\","); wrt.write("\"newstate\": \"" + vertexevent.getNewExecutionState() + "\","); wrt.write("\"timestamp\": \"" + vertexevent.getTimestamp() + "\""); wrt.write("}"); } } wrt.write("],"); wrt.write("\"jobevents\": ["); first = true; for(AbstractEvent event: events) { if( event instanceof JobEvent) { if(first) { first = false; } else { wrt.write(","); } JobEvent jobevent = (JobEvent) event; wrt.write("{"); wrt.write("\"newstate\": \"" + jobevent.getCurrentJobStatus() + "\","); wrt.write("\"timestamp\": \"" + jobevent.getTimestamp() + "\""); wrt.write("}"); } } wrt.write("]"); wrt.write("}"); } catch (EofException eof) { // Connection closed by client LOG.info("Info server for jobmanager: Connection closed by client, EofException"); } catch (IOException ioe) { // Connection closed by client LOG.info("Info server for jobmanager: Connection closed by client, IOException"); } } }
public class class_name { private void writeJsonUpdatesForJob(PrintWriter wrt, JobID jobId) { try { List<AbstractEvent> events = jobmanager.getEvents(jobId); //Serialize job to json wrt.write("{"); // depends on control dependency: [try], data = [none] wrt.write("\"jobid\": \"" + jobId + "\","); // depends on control dependency: [try], data = [none] wrt.write("\"timestamp\": \"" + System.currentTimeMillis() + "\","); // depends on control dependency: [try], data = [none] wrt.write("\"recentjobs\": ["); // depends on control dependency: [try], data = [none] boolean first = true; for(RecentJobEvent rje: jobmanager.getRecentJobs()) { if(first) { first = false; // depends on control dependency: [if], data = [none] } else { wrt.write(","); } // depends on control dependency: [if], data = [none] wrt.write("\""+rje.getJobID().toString()+"\""); // depends on control dependency: [for], data = [rje] } wrt.write("],"); // depends on control dependency: [try], data = [none] wrt.write("\"vertexevents\": ["); // depends on control dependency: [try], data = [none] first = true; // depends on control dependency: [try], data = [none] for(AbstractEvent event: events) { if(event instanceof ExecutionStateChangeEvent) { if(first) { first = false; // depends on control dependency: [if], data = [none] } else { wrt.write(","); } // depends on control dependency: [if], data = [none] ExecutionStateChangeEvent vertexevent = (ExecutionStateChangeEvent) event; wrt.write("{"); // depends on control dependency: [if], data = [none] wrt.write("\"vertexid\": \"" + vertexevent.getVertexID() + "\","); // depends on control dependency: [if], data = [none] wrt.write("\"newstate\": \"" + vertexevent.getNewExecutionState() + "\","); // depends on control dependency: [if], data = [none] wrt.write("\"timestamp\": \"" + vertexevent.getTimestamp() + "\""); // depends on control dependency: [if], data = [none] wrt.write("}"); // depends on control dependency: [if], data = [none] } } wrt.write("],"); // depends on control dependency: [try], data = [none] wrt.write("\"jobevents\": ["); // depends on control dependency: [try], data = [none] first = true; // depends on control dependency: [try], data = [none] for(AbstractEvent event: events) { if( event instanceof JobEvent) { if(first) { first = false; // depends on control dependency: [if], data = [none] } else { wrt.write(","); } // depends on control dependency: [if], data = [none] JobEvent jobevent = (JobEvent) event; wrt.write("{"); // depends on control dependency: [if], data = [none] wrt.write("\"newstate\": \"" + jobevent.getCurrentJobStatus() + "\","); // depends on control dependency: [if], data = [none] wrt.write("\"timestamp\": \"" + jobevent.getTimestamp() + "\""); // depends on control dependency: [if], data = [none] wrt.write("}"); // depends on control dependency: [if], data = [none] } } wrt.write("]"); // depends on control dependency: [try], data = [none] wrt.write("}"); // depends on control dependency: [try], data = [none] } catch (EofException eof) { // Connection closed by client LOG.info("Info server for jobmanager: Connection closed by client, EofException"); } catch (IOException ioe) { // Connection closed by client // depends on control dependency: [catch], data = [none] LOG.info("Info server for jobmanager: Connection closed by client, IOException"); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public AnalysisResultFuture run() { try { // the injection manager is job scoped final InjectionManager injectionManager = _configuration.getEnvironment().getInjectionManagerFactory() .getInjectionManager(_configuration, _job); final LifeCycleHelper rowProcessingLifeCycleHelper = new LifeCycleHelper(injectionManager, _includeNonDistributedTasks); final RowProcessingPublishers publishers = new RowProcessingPublishers(_job, _analysisListener, _errorAware, _taskRunner, rowProcessingLifeCycleHelper); final AnalysisJobMetrics analysisJobMetrics = publishers.getAnalysisJobMetrics(); // A task listener that will register either succesfull executions // or unexpected errors (which will be delegated to the // errorListener) final JobCompletionTaskListener jobCompletionTaskListener = new JobCompletionTaskListener(analysisJobMetrics, _analysisListener, 1); _analysisListener.jobBegin(_job, analysisJobMetrics); validateSingleTableInput(_job); // at this point we are done validating the job, it will run. scheduleRowProcessing(publishers, rowProcessingLifeCycleHelper, jobCompletionTaskListener, analysisJobMetrics); return new AnalysisResultFutureImpl(_resultQueue, jobCompletionTaskListener, _errorAware); } catch (final RuntimeException e) { _analysisListener.errorUnknown(_job, e); throw e; } } }
public class class_name { public AnalysisResultFuture run() { try { // the injection manager is job scoped final InjectionManager injectionManager = _configuration.getEnvironment().getInjectionManagerFactory() .getInjectionManager(_configuration, _job); final LifeCycleHelper rowProcessingLifeCycleHelper = new LifeCycleHelper(injectionManager, _includeNonDistributedTasks); final RowProcessingPublishers publishers = new RowProcessingPublishers(_job, _analysisListener, _errorAware, _taskRunner, rowProcessingLifeCycleHelper); final AnalysisJobMetrics analysisJobMetrics = publishers.getAnalysisJobMetrics(); // A task listener that will register either succesfull executions // or unexpected errors (which will be delegated to the // errorListener) final JobCompletionTaskListener jobCompletionTaskListener = new JobCompletionTaskListener(analysisJobMetrics, _analysisListener, 1); _analysisListener.jobBegin(_job, analysisJobMetrics); // depends on control dependency: [try], data = [none] validateSingleTableInput(_job); // depends on control dependency: [try], data = [none] // at this point we are done validating the job, it will run. scheduleRowProcessing(publishers, rowProcessingLifeCycleHelper, jobCompletionTaskListener, analysisJobMetrics); // depends on control dependency: [try], data = [none] return new AnalysisResultFutureImpl(_resultQueue, jobCompletionTaskListener, _errorAware); // depends on control dependency: [try], data = [none] } catch (final RuntimeException e) { _analysisListener.errorUnknown(_job, e); throw e; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Nullable private static String getLocalVarTranslation(String ident, SoyToJsVariableMappings mappings) { Expression translation = mappings.maybeGet(ident); if (translation == null) { return null; } JsExpr asExpr = translation.assertExpr(); return asExpr.getPrecedence() != Integer.MAX_VALUE ? "(" + asExpr.getText() + ")" : asExpr.getText(); } }
public class class_name { @Nullable private static String getLocalVarTranslation(String ident, SoyToJsVariableMappings mappings) { Expression translation = mappings.maybeGet(ident); if (translation == null) { return null; // depends on control dependency: [if], data = [none] } JsExpr asExpr = translation.assertExpr(); return asExpr.getPrecedence() != Integer.MAX_VALUE ? "(" + asExpr.getText() + ")" : asExpr.getText(); } }
public class class_name { public Collection<V> values() { if (values == null) { values = new ReferenceValues<K, V>(this); } return values; } }
public class class_name { public Collection<V> values() { if (values == null) { values = new ReferenceValues<K, V>(this); // depends on control dependency: [if], data = [none] } return values; } }
public class class_name { public static String waitForCompletion(AmazonCloudFormation stackbuilder, String stackName) throws Exception { DescribeStacksRequest wait = new DescribeStacksRequest(); wait.setStackName(stackName); Boolean completed = false; String stackStatus = "Unknown"; String stackReason = ""; System.out.print("Waiting"); while (!completed) { List<Stack> stacks = stackbuilder.describeStacks(wait).getStacks(); if (stacks.isEmpty()) { completed = true; stackStatus = "NO_SUCH_STACK"; stackReason = "Stack has been deleted"; } else { for (Stack stack : stacks) { if (stack.getStackStatus().equals(StackStatus.CREATE_COMPLETE.toString()) || stack.getStackStatus().equals(StackStatus.CREATE_FAILED.toString()) || stack.getStackStatus().equals(StackStatus.ROLLBACK_FAILED.toString()) || stack.getStackStatus().equals(StackStatus.DELETE_FAILED.toString())) { completed = true; stackStatus = stack.getStackStatus(); stackReason = stack.getStackStatusReason(); } } } // Show we are waiting System.out.print("."); // Not done yet so sleep for 10 seconds. if (!completed) Thread.sleep(10000); } // Show we are done System.out.print("done\n"); return stackStatus + " (" + stackReason + ")"; } }
public class class_name { public static String waitForCompletion(AmazonCloudFormation stackbuilder, String stackName) throws Exception { DescribeStacksRequest wait = new DescribeStacksRequest(); wait.setStackName(stackName); Boolean completed = false; String stackStatus = "Unknown"; String stackReason = ""; System.out.print("Waiting"); while (!completed) { List<Stack> stacks = stackbuilder.describeStacks(wait).getStacks(); if (stacks.isEmpty()) { completed = true; // depends on control dependency: [if], data = [none] stackStatus = "NO_SUCH_STACK"; // depends on control dependency: [if], data = [none] stackReason = "Stack has been deleted"; // depends on control dependency: [if], data = [none] } else { for (Stack stack : stacks) { if (stack.getStackStatus().equals(StackStatus.CREATE_COMPLETE.toString()) || stack.getStackStatus().equals(StackStatus.CREATE_FAILED.toString()) || stack.getStackStatus().equals(StackStatus.ROLLBACK_FAILED.toString()) || stack.getStackStatus().equals(StackStatus.DELETE_FAILED.toString())) { completed = true; // depends on control dependency: [if], data = [none] stackStatus = stack.getStackStatus(); // depends on control dependency: [if], data = [none] stackReason = stack.getStackStatusReason(); // depends on control dependency: [if], data = [none] } } } // Show we are waiting System.out.print("."); // Not done yet so sleep for 10 seconds. if (!completed) Thread.sleep(10000); } // Show we are done System.out.print("done\n"); return stackStatus + " (" + stackReason + ")"; } }
public class class_name { private List<Flow> createFromResults(Scan scan, boolean populateTasks, int maxCount) throws IOException { List<Flow> flows = new ArrayList<Flow>(); ResultScanner scanner = null; try { Stopwatch timer = new Stopwatch().start(); Stopwatch timerJob = new Stopwatch(); int rowCount = 0; long colCount = 0; long resultSize = 0; int jobCount = 0; Table historyTable = hbaseConnection.getTable(TableName.valueOf(Constants.HISTORY_TABLE)); scanner = historyTable.getScanner(scan); Flow currentFlow = null; for (Result result : scanner) { if (result != null && !result.isEmpty()) { rowCount++; colCount += result.size(); // TODO dogpiledays resultSize += result.getWritableSize(); JobKey currentKey = jobKeyConv.fromBytes(result.getRow()); // empty runId is special cased -- we need to treat each job as it's // own flow if (currentFlow == null || !currentFlow.contains(currentKey) || currentKey.getRunId() == 0) { // return if we've already hit the limit if (flows.size() >= maxCount) { break; } currentFlow = new Flow(new FlowKey(currentKey)); flows.add(currentFlow); } timerJob.start(); JobDetails job = new JobDetails(currentKey); job.populate(result); currentFlow.addJob(job); jobCount++; timerJob.stop(); } } historyTable.close(); timer.stop(); LOG.info("Fetched from hbase " + rowCount + " rows, " + colCount + " columns, " + flows.size() + " flows and " + jobCount + " jobs taking up " + resultSize + " bytes ( " + resultSize / (1024.0 * 1024.0) + " atomic double: " + new AtomicDouble(resultSize / (1024.0 * 1024.0)) + ") MB, in total time of " + timer + " with " + timerJob + " spent inJobDetails & Flow population"); // export the size of data fetched from hbase as a metric HravenResponseMetrics.FLOW_HBASE_RESULT_SIZE_VALUE .set(resultSize / (1024.0 * 1024.0)); } finally { if (scanner != null) { scanner.close(); } } if (populateTasks) { populateTasks(flows); } return flows; } }
public class class_name { private List<Flow> createFromResults(Scan scan, boolean populateTasks, int maxCount) throws IOException { List<Flow> flows = new ArrayList<Flow>(); ResultScanner scanner = null; try { Stopwatch timer = new Stopwatch().start(); Stopwatch timerJob = new Stopwatch(); int rowCount = 0; long colCount = 0; long resultSize = 0; int jobCount = 0; Table historyTable = hbaseConnection.getTable(TableName.valueOf(Constants.HISTORY_TABLE)); scanner = historyTable.getScanner(scan); Flow currentFlow = null; for (Result result : scanner) { if (result != null && !result.isEmpty()) { rowCount++; // depends on control dependency: [if], data = [none] colCount += result.size(); // depends on control dependency: [if], data = [none] // TODO dogpiledays resultSize += result.getWritableSize(); JobKey currentKey = jobKeyConv.fromBytes(result.getRow()); // empty runId is special cased -- we need to treat each job as it's // own flow if (currentFlow == null || !currentFlow.contains(currentKey) || currentKey.getRunId() == 0) { // return if we've already hit the limit if (flows.size() >= maxCount) { break; } currentFlow = new Flow(new FlowKey(currentKey)); // depends on control dependency: [if], data = [none] flows.add(currentFlow); // depends on control dependency: [if], data = [(currentFlow] } timerJob.start(); // depends on control dependency: [if], data = [none] JobDetails job = new JobDetails(currentKey); job.populate(result); // depends on control dependency: [if], data = [(result] currentFlow.addJob(job); // depends on control dependency: [if], data = [none] jobCount++; // depends on control dependency: [if], data = [none] timerJob.stop(); // depends on control dependency: [if], data = [none] } } historyTable.close(); timer.stop(); LOG.info("Fetched from hbase " + rowCount + " rows, " + colCount + " columns, " + flows.size() + " flows and " + jobCount + " jobs taking up " + resultSize + " bytes ( " + resultSize / (1024.0 * 1024.0) + " atomic double: " + new AtomicDouble(resultSize / (1024.0 * 1024.0)) + ") MB, in total time of " + timer + " with " + timerJob + " spent inJobDetails & Flow population"); // export the size of data fetched from hbase as a metric HravenResponseMetrics.FLOW_HBASE_RESULT_SIZE_VALUE .set(resultSize / (1024.0 * 1024.0)); } finally { if (scanner != null) { scanner.close(); // depends on control dependency: [if], data = [none] } } if (populateTasks) { populateTasks(flows); } return flows; } }
public class class_name { public static Locale getLocale(final String str) { if(isEmpty(str)) { return Locale.getDefault(); } if(!str.contains("_")) { return new Locale(str); } final String[] split = str.split("_"); if(split.length == 2) { return new Locale(split[0], split[1]); } else { return new Locale(split[0], split[1], split[2]); } } }
public class class_name { public static Locale getLocale(final String str) { if(isEmpty(str)) { return Locale.getDefault(); // depends on control dependency: [if], data = [none] } if(!str.contains("_")) { return new Locale(str); // depends on control dependency: [if], data = [none] } final String[] split = str.split("_"); if(split.length == 2) { return new Locale(split[0], split[1]); // depends on control dependency: [if], data = [none] } else { return new Locale(split[0], split[1], split[2]); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public <T> T decode(Message message, java.lang.Class<T> yourDomainMessageObject) throws RecoderException { Object rc = null; ClassInfo c = storage.getClassInfo(yourDomainMessageObject); CommandDscr cd = c.getAnnotation(CommandDscr.class); if (cd != null) { try { if (message.getCommandCode() != cd.code()) { throw new IllegalArgumentException("Invalid message code " + message.getCommandCode()); } if (message.getApplicationId() != 0 && message.getApplicationId() != cd.appId()) { throw new IllegalArgumentException("Invalid Application-Id " + message.getApplicationId()); } for (CommandFlag f : cd.flags()) { switch (f) { case E: if (!message.isError()) { throw new IllegalArgumentException("Flag e is not set"); } break; case P: if (!message.isProxiable()) { throw new IllegalArgumentException("Flag p is not set"); } break; case R: if (!message.isRequest()) { throw new IllegalArgumentException("Flag m is not set"); } break; case T: if (!message.isReTransmitted()) { throw new IllegalArgumentException("Flag t is not set"); } break; } } // Find max constructor + lost avp set by setters int cacount = 0; Constructor<?> cm = null; Map<String, Class<?>> cmargs = new HashMap<String, Class<?>>(); for (ConstructorInfo ci : c.getConstructorsInfo()) { if (ci.getAnnotation(Setter.class) != null) { // check params - all params must have avp annotation Class<?>[] params = ci.getConstructor().getParameterTypes(); boolean correct = true; for (Class<?> j : params) { if (j.isArray()) { j = j.getComponentType(); } if (storage.getClassInfo(j).getAnnotation(AvpDscr.class) == null) { correct = false; break; } } if (!correct) { continue; } // find max args constructor if (cacount < params.length) { cacount = params.length; cm = ci.getConstructor(); } } } // fill cm args List<Object> initargs = new ArrayList<Object>(); if (cm != null) { for (Class<?> ac : cm.getParameterTypes()) { Class<?> lac = ac.isArray() ? ac.getComponentType() : ac; cmargs.put(lac.getName(), ac); // Create params initargs.add(createChildByAvp(findChildDscr(cd.childs(), ac), ac, message.getAvps())); } // Create instance class rc = cm.newInstance(initargs.toArray()); } else { rc = yourDomainMessageObject.newInstance(); } // for (MethodInfo mi : c.getMethodsInfo()) { if (mi.getAnnotation(Setter.class) != null) { Class<?>[] pt = mi.getMethod().getParameterTypes(); if (pt.length == 1 && storage.getClassInfo(pt[0]).getAnnotation(AvpDscr.class) != null) { Class<?> ptc = pt[0].isArray() ? pt[0].getComponentType() : pt[0]; if (!cmargs.containsKey(ptc.getName())) { cmargs.put(ptc.getName(), ptc); mi.getMethod().invoke(rc, createChildByAvp(findChildDscr(cd.childs(), pt[0]), pt[0], message.getAvps())); } } } } // Fill undefined avp setUndefinedAvp(message.getAvps(), rc, c, cmargs); } catch (InstantiationException e) { throw new RecoderException(e); } catch (InvocationTargetException e) { throw new RecoderException(e); } catch (IllegalAccessException e) { throw new RecoderException(e); } } return (T) rc; } }
public class class_name { @Override public <T> T decode(Message message, java.lang.Class<T> yourDomainMessageObject) throws RecoderException { Object rc = null; ClassInfo c = storage.getClassInfo(yourDomainMessageObject); CommandDscr cd = c.getAnnotation(CommandDscr.class); if (cd != null) { try { if (message.getCommandCode() != cd.code()) { throw new IllegalArgumentException("Invalid message code " + message.getCommandCode()); } if (message.getApplicationId() != 0 && message.getApplicationId() != cd.appId()) { throw new IllegalArgumentException("Invalid Application-Id " + message.getApplicationId()); } for (CommandFlag f : cd.flags()) { switch (f) { case E: if (!message.isError()) { throw new IllegalArgumentException("Flag e is not set"); } break; case P: if (!message.isProxiable()) { throw new IllegalArgumentException("Flag p is not set"); } break; case R: if (!message.isRequest()) { throw new IllegalArgumentException("Flag m is not set"); } break; case T: if (!message.isReTransmitted()) { throw new IllegalArgumentException("Flag t is not set"); } break; } } // Find max constructor + lost avp set by setters int cacount = 0; Constructor<?> cm = null; Map<String, Class<?>> cmargs = new HashMap<String, Class<?>>(); for (ConstructorInfo ci : c.getConstructorsInfo()) { if (ci.getAnnotation(Setter.class) != null) { // check params - all params must have avp annotation Class<?>[] params = ci.getConstructor().getParameterTypes(); boolean correct = true; for (Class<?> j : params) { if (j.isArray()) { j = j.getComponentType(); } if (storage.getClassInfo(j).getAnnotation(AvpDscr.class) == null) { correct = false; break; } } if (!correct) { continue; } // find max args constructor if (cacount < params.length) { cacount = params.length; cm = ci.getConstructor(); } } } // fill cm args List<Object> initargs = new ArrayList<Object>(); if (cm != null) { for (Class<?> ac : cm.getParameterTypes()) { Class<?> lac = ac.isArray() ? ac.getComponentType() : ac; cmargs.put(lac.getName(), ac); // Create params initargs.add(createChildByAvp(findChildDscr(cd.childs(), ac), ac, message.getAvps())); } // Create instance class rc = cm.newInstance(initargs.toArray()); } else { rc = yourDomainMessageObject.newInstance(); } // for (MethodInfo mi : c.getMethodsInfo()) { if (mi.getAnnotation(Setter.class) != null) { Class<?>[] pt = mi.getMethod().getParameterTypes(); if (pt.length == 1 && storage.getClassInfo(pt[0]).getAnnotation(AvpDscr.class) != null) { Class<?> ptc = pt[0].isArray() ? pt[0].getComponentType() : pt[0]; if (!cmargs.containsKey(ptc.getName())) { cmargs.put(ptc.getName(), ptc); // depends on control dependency: [if], data = [none] mi.getMethod().invoke(rc, createChildByAvp(findChildDscr(cd.childs(), pt[0]), pt[0], message.getAvps())); // depends on control dependency: [if], data = [none] } } } } // Fill undefined avp setUndefinedAvp(message.getAvps(), rc, c, cmargs); } catch (InstantiationException e) { throw new RecoderException(e); } catch (InvocationTargetException e) { throw new RecoderException(e); } catch (IllegalAccessException e) { throw new RecoderException(e); } } return (T) rc; } }
public class class_name { @Override public void startWorkflow( long woinRefNum ){ log.debug( "Starting" ); TransactionStatus status = null; try{ workflowInstanceService.markStarting( woinRefNum ); status = begin(); WorkflowInstance woin = workflowInstanceService.find( woinRefNum ); Environment env = Marshaller.deserializeEnv( woin.getAttributes() ); GraphInstance graphInstance = engineFactory.getSingletonInstance().start( woin.getWorkflowName(), woin.getWorkflowVersion(), env, woinRefNum ); graphInstanceRepository.save( graphInstance, WorkflowInstanceStatus.EXECUTED ); commit( status, "Started" ); } catch( UnexpectedStatusException e ){ // See above for a reasoning on why these exceptions are caught separately. log.warn( e.getMessage() ); if( status != null ){ rollback( status ); } workflowInstanceService.unlock( woinRefNum ); log.warn( "Unlocked", e ); } catch( Exception e ){ log.warn( "Handling error", e ); rollback( status ); try{ workflowInstanceService.handleStartingError( woinRefNum, e ); } catch( Exception e2 ){ log.error( "Handling error failed.", e2 ); } exceptionNotificationService.handleException( e ); } } }
public class class_name { @Override public void startWorkflow( long woinRefNum ){ log.debug( "Starting" ); TransactionStatus status = null; try{ workflowInstanceService.markStarting( woinRefNum ); // depends on control dependency: [try], data = [none] status = begin(); // depends on control dependency: [try], data = [none] WorkflowInstance woin = workflowInstanceService.find( woinRefNum ); Environment env = Marshaller.deserializeEnv( woin.getAttributes() ); GraphInstance graphInstance = engineFactory.getSingletonInstance().start( woin.getWorkflowName(), woin.getWorkflowVersion(), env, woinRefNum ); graphInstanceRepository.save( graphInstance, WorkflowInstanceStatus.EXECUTED ); // depends on control dependency: [try], data = [none] commit( status, "Started" ); // depends on control dependency: [try], data = [none] } catch( UnexpectedStatusException e ){ // See above for a reasoning on why these exceptions are caught separately. log.warn( e.getMessage() ); if( status != null ){ rollback( status ); // depends on control dependency: [if], data = [( status] } workflowInstanceService.unlock( woinRefNum ); log.warn( "Unlocked", e ); } // depends on control dependency: [catch], data = [none] catch( Exception e ){ log.warn( "Handling error", e ); rollback( status ); try{ workflowInstanceService.handleStartingError( woinRefNum, e ); // depends on control dependency: [try], data = [none] } catch( Exception e2 ){ log.error( "Handling error failed.", e2 ); } // depends on control dependency: [catch], data = [none] exceptionNotificationService.handleException( e ); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static Map<String, Object> processAttributesForIncremental(Map<String, Object> attributes) { Map<String, Object> attributeMap = new HashMap<>(); if (attributes.containsKey(Conversation.NAME)) { attributeMap.put(Conversation.NAME, attributes.get(Conversation.NAME)); } for (Map.Entry<String, Object> entry : attributes.entrySet()) { String k = entry.getKey(); if (!Arrays.asList(Conversation.CONVERSATION_COLUMNS).contains(k)) { attributeMap.put(ATTR_PERFIX + k, entry.getValue()); } } if (attributeMap.isEmpty()) { return null; } return attributeMap; } }
public class class_name { static Map<String, Object> processAttributesForIncremental(Map<String, Object> attributes) { Map<String, Object> attributeMap = new HashMap<>(); if (attributes.containsKey(Conversation.NAME)) { attributeMap.put(Conversation.NAME, attributes.get(Conversation.NAME)); // depends on control dependency: [if], data = [none] } for (Map.Entry<String, Object> entry : attributes.entrySet()) { String k = entry.getKey(); if (!Arrays.asList(Conversation.CONVERSATION_COLUMNS).contains(k)) { attributeMap.put(ATTR_PERFIX + k, entry.getValue()); // depends on control dependency: [if], data = [none] } } if (attributeMap.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } return attributeMap; } }
public class class_name { private static long estimateLineCount(final File file, final int byReadingLineNum) throws UncheckedIOException { final Holder<ZipFile> outputZipFile = new Holder<>(); InputStream is = null; BufferedReader br = null; try { is = openFile(outputZipFile, file); br = Objectory.createBufferedReader(is); int cnt = 0; String line = null; long bytes = 0; while (cnt < byReadingLineNum && (line = br.readLine()) != null) { bytes += line.getBytes().length; cnt++; } return cnt == 0 ? 0 : (file.length() / (bytes / cnt == 0 ? 1 : bytes / cnt)); } catch (IOException e) { throw new UncheckedIOException(e); } finally { closeQuietly(is); closeQuietly(outputZipFile.value()); Objectory.recycle(br); } } }
public class class_name { private static long estimateLineCount(final File file, final int byReadingLineNum) throws UncheckedIOException { final Holder<ZipFile> outputZipFile = new Holder<>(); InputStream is = null; BufferedReader br = null; try { is = openFile(outputZipFile, file); br = Objectory.createBufferedReader(is); int cnt = 0; String line = null; long bytes = 0; while (cnt < byReadingLineNum && (line = br.readLine()) != null) { bytes += line.getBytes().length; // depends on control dependency: [while], data = [none] cnt++; // depends on control dependency: [while], data = [none] } return cnt == 0 ? 0 : (file.length() / (bytes / cnt == 0 ? 1 : bytes / cnt)); } catch (IOException e) { throw new UncheckedIOException(e); } finally { closeQuietly(is); closeQuietly(outputZipFile.value()); Objectory.recycle(br); } } }
public class class_name { boolean validate(StringBuilder out) { this.isValid = true; // If log from construction has content, append to validation output msg. if (this.msgLog.length() > 0) { out.append(this.msgLog); } // Check that name is not null (it can be an empty string). if (this.getName() == null) { this.isValid = false; out.append(" ** DatasetNamer (1): null value for name is not valid."); } // Check that addLevel is not null. // boolean can't be null //if ( this.getAddLevel() == null) //{ // this.isValid = false; // out.append(" ** DatasetNamer (2): null value for addLevel is not valid."); //} // Check that type is not null. if (this.getType() == null) { this.isValid = false; out.append(" ** DatasetNamer (3): null value for type is not valid (set with bad string?)."); } if ( this.getType() == DatasetNamerType.REGULAR_EXPRESSION && ( this.getMatchPattern() == null || this.getSubstitutePattern() == null )) { this.isValid = false; out.append(" ** DatasetNamer (4): invalid datasetNamer <" + this.getName() + ">;" + " type is " + this.getType().toString() + ": matchPattern(" + this.getMatchPattern() + ") and substitutionPattern(" + this.getSubstitutePattern() + ") " + "must not be null."); } if ( this.getType() == DatasetNamerType.DODS_ATTRIBUTE && ( this.getAttribContainer() == null || this.getAttribName() == null ) ) { this.isValid = false; out.append(" ** DatasetNamer (5): invalid datasetNamer <" + this.getName() + ">;" + " type is " + this.getType().toString() + ": attriuteContainer(" + this.getAttribContainer() + ") and attributeName(" + this.getAttribName() + ") must not be null."); } return (this.isValid); } }
public class class_name { boolean validate(StringBuilder out) { this.isValid = true; // If log from construction has content, append to validation output msg. if (this.msgLog.length() > 0) { out.append(this.msgLog); // depends on control dependency: [if], data = [none] } // Check that name is not null (it can be an empty string). if (this.getName() == null) { this.isValid = false; // depends on control dependency: [if], data = [none] out.append(" ** DatasetNamer (1): null value for name is not valid."); } // Check that addLevel is not null. // boolean can't be null //if ( this.getAddLevel() == null) //{ // this.isValid = false; // out.append(" ** DatasetNamer (2): null value for addLevel is not valid."); //} // Check that type is not null. if (this.getType() == null) { this.isValid = false; // depends on control dependency: [if], data = [none] out.append(" ** DatasetNamer (3): null value for type is not valid (set with bad string?)."); // depends on control dependency: [if], data = [none] } if ( this.getType() == DatasetNamerType.REGULAR_EXPRESSION && ( this.getMatchPattern() == null || this.getSubstitutePattern() == null )) { this.isValid = false; out.append(" ** DatasetNamer (4): invalid datasetNamer <" + this.getName() + ">;" + " type is " + this.getType().toString() + ": matchPattern(" + this.getMatchPattern() + ") and substitutionPattern(" + this.getSubstitutePattern() + ") " + "must not be null."); } if ( this.getType() == DatasetNamerType.DODS_ATTRIBUTE && ( this.getAttribContainer() == null || this.getAttribName() == null ) ) { this.isValid = false; out.append(" ** DatasetNamer (5): invalid datasetNamer <" + this.getName() + ">;" + " type is " + this.getType().toString() + ": attriuteContainer(" + this.getAttribContainer() + ") and attributeName(" + this.getAttribName() + ") must not be null."); } return (this.isValid); } }
public class class_name { @Override public int size() { if (size < 0) { size = 0; for (int i = 0; i <= lastWordIndex; i++) { int w = words[i]; if (isLiteral(w)) { size += getLiteralBitCount(w); } else { if (isZeroSequence(w)) { if (!isSequenceWithNoBits(w)) { size++; } } else { size += maxLiteralLengthMultiplication(getSequenceCount(w) + 1); if (!isSequenceWithNoBits(w)) { size--; } } } } } return size; } }
public class class_name { @Override public int size() { if (size < 0) { size = 0; // depends on control dependency: [if], data = [none] for (int i = 0; i <= lastWordIndex; i++) { int w = words[i]; if (isLiteral(w)) { size += getLiteralBitCount(w); // depends on control dependency: [if], data = [none] } else { if (isZeroSequence(w)) { if (!isSequenceWithNoBits(w)) { size++; // depends on control dependency: [if], data = [none] } } else { size += maxLiteralLengthMultiplication(getSequenceCount(w) + 1); // depends on control dependency: [if], data = [none] if (!isSequenceWithNoBits(w)) { size--; // depends on control dependency: [if], data = [none] } } } } } return size; } }
public class class_name { private static <K,V> Tree<K,V> append (Tree<K,V> tl, Tree<K,V> tr) { if (tl == null) return tr; if (tr == null) return tl; if (isRedTree (tl) && isRedTree (tr)) { final Tree<K,V> bc = append (tl.right, tr.left); return isRedTree (bc) ? new RedTree<> (bc.key, bc.value, new RedTree<> (tl.key, tl.value, tl.left, bc.left), new RedTree<> (tr.key, tr.value, bc.right, tr.right)) : new RedTree<> (tl.key, tl.value, tl.left, new RedTree<> (tr.key, tr.value, bc, tr.right)); } if (isBlackTree (tl) && isBlackTree (tr)) { final Tree<K,V> bc = append (tl.right, tr.left); return isRedTree (bc) ? new RedTree<> (bc.key, bc.value, new BlackTree<> (tl.key, tl.value, tl.left, bc.left), new BlackTree<> (tr.key, tr.value, bc.right, tr.right)) : balanceLeft (tl.key, tl.value, tl.left, new BlackTree<> (tr.key, tr.value, bc, tr.right)); } if (isRedTree (tr)) { return new RedTree<> (tr.key, tr.value, append (tl, tr.left), tr.right); } if (isRedTree (tl)) { return new RedTree<> (tl.key, tl.value, tl.left, append (tl.right, tr)); } throw new IllegalStateException ("invariant violation: unmatched tree on append: " + tl + ", " + tr); } }
public class class_name { private static <K,V> Tree<K,V> append (Tree<K,V> tl, Tree<K,V> tr) { if (tl == null) return tr; if (tr == null) return tl; if (isRedTree (tl) && isRedTree (tr)) { final Tree<K,V> bc = append (tl.right, tr.left); return isRedTree (bc) ? new RedTree<> (bc.key, bc.value, new RedTree<> (tl.key, tl.value, tl.left, bc.left), new RedTree<> (tr.key, tr.value, bc.right, tr.right)) : new RedTree<> (tl.key, tl.value, tl.left, new RedTree<> (tr.key, tr.value, bc, tr.right)); // depends on control dependency: [if], data = [none] } if (isBlackTree (tl) && isBlackTree (tr)) { final Tree<K,V> bc = append (tl.right, tr.left); return isRedTree (bc) ? new RedTree<> (bc.key, bc.value, new BlackTree<> (tl.key, tl.value, tl.left, bc.left), new BlackTree<> (tr.key, tr.value, bc.right, tr.right)) : balanceLeft (tl.key, tl.value, tl.left, new BlackTree<> (tr.key, tr.value, bc, tr.right)); // depends on control dependency: [if], data = [none] } if (isRedTree (tr)) { return new RedTree<> (tr.key, tr.value, append (tl, tr.left), tr.right); // depends on control dependency: [if], data = [none] } if (isRedTree (tl)) { return new RedTree<> (tl.key, tl.value, tl.left, append (tl.right, tr)); // depends on control dependency: [if], data = [none] } throw new IllegalStateException ("invariant violation: unmatched tree on append: " + tl + ", " + tr); } }
public class class_name { public static boolean hasForUpdate(Object parameter) { if (parameter != null && parameter instanceof Example) { Example example = (Example) parameter; return example.isForUpdate(); } return false; } }
public class class_name { public static boolean hasForUpdate(Object parameter) { if (parameter != null && parameter instanceof Example) { Example example = (Example) parameter; return example.isForUpdate(); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public MutableRoaringBitmap toMutableRoaringBitmap() { MutableRoaringBitmap c = new MutableRoaringBitmap(); MappeableContainerPointer mcp = highLowContainer.getContainerPointer(); while (mcp.hasContainer()) { c.getMappeableRoaringArray().appendCopy(mcp.key(), mcp.getContainer()); mcp.advance(); } return c; } }
public class class_name { public MutableRoaringBitmap toMutableRoaringBitmap() { MutableRoaringBitmap c = new MutableRoaringBitmap(); MappeableContainerPointer mcp = highLowContainer.getContainerPointer(); while (mcp.hasContainer()) { c.getMappeableRoaringArray().appendCopy(mcp.key(), mcp.getContainer()); // depends on control dependency: [while], data = [none] mcp.advance(); // depends on control dependency: [while], data = [none] } return c; } }
public class class_name { public void marshall(DeleteUtterancesRequest deleteUtterancesRequest, ProtocolMarshaller protocolMarshaller) { if (deleteUtterancesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteUtterancesRequest.getBotName(), BOTNAME_BINDING); protocolMarshaller.marshall(deleteUtterancesRequest.getUserId(), USERID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteUtterancesRequest deleteUtterancesRequest, ProtocolMarshaller protocolMarshaller) { if (deleteUtterancesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteUtterancesRequest.getBotName(), BOTNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteUtterancesRequest.getUserId(), USERID_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 { @Override public JvmOperation getFeature() { if (feature != null && feature.eIsProxy()) { InternalEObject oldFeature = (InternalEObject)feature; feature = (JvmOperation)eResolveProxy(oldFeature); if (feature != oldFeature) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, SarlPackage.SARL_CASTED_EXPRESSION__FEATURE, oldFeature, feature)); } } return feature; } }
public class class_name { @Override public JvmOperation getFeature() { if (feature != null && feature.eIsProxy()) { InternalEObject oldFeature = (InternalEObject)feature; feature = (JvmOperation)eResolveProxy(oldFeature); // depends on control dependency: [if], data = [none] if (feature != oldFeature) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, SarlPackage.SARL_CASTED_EXPRESSION__FEATURE, oldFeature, feature)); } } return feature; } }
public class class_name { public EClass getEDG() { if (edgEClass == null) { edgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(238); } return edgEClass; } }
public class class_name { public EClass getEDG() { if (edgEClass == null) { edgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(238); // depends on control dependency: [if], data = [none] } return edgEClass; } }
public class class_name { public static String getJsonOutput(FormChecker fc) { StringBuilder json = new StringBuilder(); String status = fc.isValidAndNotFirstRun() ? "success" : "fail"; json.append("{\"status\": \"" + status + "\","); json.append("\"data\":"); // Problems: if (fc.isValidAndNotFirstRun()) { json.append("\"null\","); } else { // append errors: json.append("{"); String commaAppend = ""; for (FormCheckerElement elem : fc.getForm().getElements()) { if (!elem.isValid()) { json.append(commaAppend); json.append("\"" + elem.getName() + "\":" + "\"" + elem.getValidationResult().getMessage() + "\""); commaAppend = ","; } } json.append("},"); } // no problems json.append("\"okdata\":"); // append errors: json.append("{"); String commaAppend = ""; for (FormCheckerElement elem : fc.getForm().getElements()) { if (elem.isValid()) { json.append(commaAppend); json.append("\"" + elem.getName() + "\":" + "\"" + "OK" + "\""); commaAppend = ","; } } json.append("}"); json.append("}"); return json.toString(); } }
public class class_name { public static String getJsonOutput(FormChecker fc) { StringBuilder json = new StringBuilder(); String status = fc.isValidAndNotFirstRun() ? "success" : "fail"; json.append("{\"status\": \"" + status + "\","); json.append("\"data\":"); // Problems: if (fc.isValidAndNotFirstRun()) { json.append("\"null\","); // depends on control dependency: [if], data = [none] } else { // append errors: json.append("{"); // depends on control dependency: [if], data = [none] String commaAppend = ""; for (FormCheckerElement elem : fc.getForm().getElements()) { if (!elem.isValid()) { json.append(commaAppend); // depends on control dependency: [if], data = [none] json.append("\"" + elem.getName() + "\":" + "\"" + elem.getValidationResult().getMessage() + "\""); // depends on control dependency: [if], data = [none] commaAppend = ","; // depends on control dependency: [if], data = [none] } } json.append("},"); // depends on control dependency: [if], data = [none] } // no problems json.append("\"okdata\":"); // append errors: json.append("{"); String commaAppend = ""; for (FormCheckerElement elem : fc.getForm().getElements()) { if (elem.isValid()) { json.append(commaAppend); // depends on control dependency: [if], data = [none] json.append("\"" + elem.getName() + "\":" + "\"" + "OK" + "\""); // depends on control dependency: [if], data = [none] commaAppend = ","; // depends on control dependency: [if], data = [none] } } json.append("}"); json.append("}"); return json.toString(); } }
public class class_name { public void setRotation(float r) { double d = 2.0 * Math.PI; rotationRadians = (float) ((r + initialRotation) % d); if (rotationRadians < 0) { rotationRadians += d; } float[] matrix = matrix(); scaledWidth = matrix[DX] - matrix[CX]; scaledHeight = matrix[DY] - matrix[CY]; } }
public class class_name { public void setRotation(float r) { double d = 2.0 * Math.PI; rotationRadians = (float) ((r + initialRotation) % d); if (rotationRadians < 0) { rotationRadians += d; // depends on control dependency: [if], data = [none] } float[] matrix = matrix(); scaledWidth = matrix[DX] - matrix[CX]; scaledHeight = matrix[DY] - matrix[CY]; } }
public class class_name { public void polyScale(GrowQueue_I8 input , int scale , GrowQueue_I8 output) { output.resize(input.size); for (int i = 0; i < input.size; i++) { output.data[i] = (byte)multiply(input.data[i]&0xFF, scale); } } }
public class class_name { public void polyScale(GrowQueue_I8 input , int scale , GrowQueue_I8 output) { output.resize(input.size); for (int i = 0; i < input.size; i++) { output.data[i] = (byte)multiply(input.data[i]&0xFF, scale); // depends on control dependency: [for], data = [i] } } }
public class class_name { private void generateNextCombinationIndices() { if (remainingCombinations == 0) { throw new IllegalStateException("There are no combinations remaining. " + "Generator must be reset to continue using."); } else if (remainingCombinations < totalCombinations) { int i = combinationIndices.length - 1; while (combinationIndices[i] == elements.length - combinationIndices.length + i) { i--; } ++combinationIndices[i]; for (int j = i + 1; j < combinationIndices.length; j++) { combinationIndices[j] = combinationIndices[i] + j - i; } } --remainingCombinations; } }
public class class_name { private void generateNextCombinationIndices() { if (remainingCombinations == 0) { throw new IllegalStateException("There are no combinations remaining. " + "Generator must be reset to continue using."); } else if (remainingCombinations < totalCombinations) { int i = combinationIndices.length - 1; while (combinationIndices[i] == elements.length - combinationIndices.length + i) { i--; // depends on control dependency: [while], data = [none] } ++combinationIndices[i]; // depends on control dependency: [if], data = [none] for (int j = i + 1; j < combinationIndices.length; j++) { combinationIndices[j] = combinationIndices[i] + j - i; // depends on control dependency: [for], data = [j] } } --remainingCombinations; } }
public class class_name { public void marshall(ListDatastoresRequest listDatastoresRequest, ProtocolMarshaller protocolMarshaller) { if (listDatastoresRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listDatastoresRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(listDatastoresRequest.getMaxResults(), MAXRESULTS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListDatastoresRequest listDatastoresRequest, ProtocolMarshaller protocolMarshaller) { if (listDatastoresRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listDatastoresRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listDatastoresRequest.getMaxResults(), MAXRESULTS_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 base_responses delete(nitro_service client, String hostname[]) throws Exception { base_responses result = null; if (hostname != null && hostname.length > 0) { dnsaaaarec deleteresources[] = new dnsaaaarec[hostname.length]; for (int i=0;i<hostname.length;i++){ deleteresources[i] = new dnsaaaarec(); deleteresources[i].hostname = hostname[i]; } result = delete_bulk_request(client, deleteresources); } return result; } }
public class class_name { public static base_responses delete(nitro_service client, String hostname[]) throws Exception { base_responses result = null; if (hostname != null && hostname.length > 0) { dnsaaaarec deleteresources[] = new dnsaaaarec[hostname.length]; for (int i=0;i<hostname.length;i++){ deleteresources[i] = new dnsaaaarec(); // depends on control dependency: [for], data = [i] deleteresources[i].hostname = hostname[i]; // depends on control dependency: [for], data = [i] } result = delete_bulk_request(client, deleteresources); } return result; } }
public class class_name { public ArgumentBuilder withNamedArgument(final boolean addNamedArgument, final String name, final String value) { // Bail out? if (!addNamedArgument) { return this; } // Check sanity Validate.notEmpty(name, "name"); Validate.notEmpty(value, "value"); // Trim the arguments, and validate again. final String trimmedName = name.trim(); final String trimmedValue = value.trim(); Validate.notEmpty(trimmedName, "name"); Validate.notEmpty(trimmedValue, "value"); // Add or update the name and value. if (!updateValueForNamedArgument(name, value)) { synchronized (lock) { withFlag(true, trimmedName); arguments.add(value); } } // All done. return this; } }
public class class_name { public ArgumentBuilder withNamedArgument(final boolean addNamedArgument, final String name, final String value) { // Bail out? if (!addNamedArgument) { return this; // depends on control dependency: [if], data = [none] } // Check sanity Validate.notEmpty(name, "name"); Validate.notEmpty(value, "value"); // Trim the arguments, and validate again. final String trimmedName = name.trim(); final String trimmedValue = value.trim(); Validate.notEmpty(trimmedName, "name"); Validate.notEmpty(trimmedValue, "value"); // Add or update the name and value. if (!updateValueForNamedArgument(name, value)) { synchronized (lock) { // depends on control dependency: [if], data = [none] withFlag(true, trimmedName); arguments.add(value); } } // All done. return this; } }
public class class_name { private IRingSet getRingSetCore(IRingSet rs) { Multimap<IBond, IRing> ringlookup = HashMultimap.create(); Set<IRing> ringsystem = new LinkedHashSet<>(); for (IAtomContainer ring : rs.atomContainers()) { ringsystem.add((IRing) ring); for (IBond bond : ring.bonds()) ringlookup.put(bond, (IRing) ring); } // iteratively reduce ring system by removing ring that only share one bond Set<IRing> toremove = new HashSet<>(); do { toremove.clear(); for (IRing ring : ringsystem) { int numAttach = 0; for (IBond bond : ring.bonds()) { for (IRing attached : ringlookup.get(bond)) { if (attached != ring && ringsystem.contains(attached)) { numAttach++; break; } } } if (numAttach <= 1) toremove.add(ring); } ringsystem.removeAll(toremove); } while (!toremove.isEmpty()); final IRingSet core = rs.getBuilder().newInstance(IRingSet.class); for (IRing ring : ringsystem) core.addAtomContainer(ring); return core; } }
public class class_name { private IRingSet getRingSetCore(IRingSet rs) { Multimap<IBond, IRing> ringlookup = HashMultimap.create(); Set<IRing> ringsystem = new LinkedHashSet<>(); for (IAtomContainer ring : rs.atomContainers()) { ringsystem.add((IRing) ring); // depends on control dependency: [for], data = [ring] for (IBond bond : ring.bonds()) ringlookup.put(bond, (IRing) ring); } // iteratively reduce ring system by removing ring that only share one bond Set<IRing> toremove = new HashSet<>(); do { toremove.clear(); for (IRing ring : ringsystem) { int numAttach = 0; for (IBond bond : ring.bonds()) { for (IRing attached : ringlookup.get(bond)) { if (attached != ring && ringsystem.contains(attached)) { numAttach++; // depends on control dependency: [if], data = [none] break; } } } if (numAttach <= 1) toremove.add(ring); } ringsystem.removeAll(toremove); } while (!toremove.isEmpty()); final IRingSet core = rs.getBuilder().newInstance(IRingSet.class); for (IRing ring : ringsystem) core.addAtomContainer(ring); return core; } }
public class class_name { public void setProcesses(java.util.Collection<ProcessType> processes) { if (processes == null) { this.processes = null; return; } this.processes = new com.amazonaws.internal.SdkInternalList<ProcessType>(processes); } }
public class class_name { public void setProcesses(java.util.Collection<ProcessType> processes) { if (processes == null) { this.processes = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.processes = new com.amazonaws.internal.SdkInternalList<ProcessType>(processes); } }
public class class_name { public static void waitFor(double seconds) { long nanos = (long) (seconds * 1000000000); if (seconds > 0) { try { TimeUnit.NANOSECONDS.sleep(nanos); } catch (InterruptedException ex) { // Swallow exception ex.printStackTrace(); } } } }
public class class_name { public static void waitFor(double seconds) { long nanos = (long) (seconds * 1000000000); if (seconds > 0) { try { TimeUnit.NANOSECONDS.sleep(nanos); // depends on control dependency: [try], data = [none] } catch (InterruptedException ex) { // Swallow exception ex.printStackTrace(); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void request(final String method, final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { String id = null; try{ requests.set(request); id = Session.start(getSessionId(request,response)); long t = System.currentTimeMillis(); try { String requestId = UUID.randomUUID().toString(); // set MDC MDC.put("requestId", requestId); logRequest(method, request); I params = parseInput(request); logInParams(params); //check access checkAccess(method, params, request); O out = process(method, params, request, response); if (out != null) { logOut(out); formatOutput(out, false, request, response); } } catch (Throwable e) { logError(e); try { O out = transformError(e, request, response); formatOutput(out, true, request, response); } catch (Exception ex) { LOG.error("Error preparing exception output", ex); } } logResult(System.currentTimeMillis() - t); }finally { requests.remove(); Session.end(id); } } }
public class class_name { public void request(final String method, final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { String id = null; try{ requests.set(request); id = Session.start(getSessionId(request,response)); long t = System.currentTimeMillis(); try { String requestId = UUID.randomUUID().toString(); // set MDC MDC.put("requestId", requestId); // depends on control dependency: [try], data = [none] logRequest(method, request); // depends on control dependency: [try], data = [none] I params = parseInput(request); logInParams(params); // depends on control dependency: [try], data = [none] //check access checkAccess(method, params, request); // depends on control dependency: [try], data = [none] O out = process(method, params, request, response); if (out != null) { logOut(out); // depends on control dependency: [if], data = [(out] formatOutput(out, false, request, response); // depends on control dependency: [if], data = [(out] } } catch (Throwable e) { logError(e); try { O out = transformError(e, request, response); formatOutput(out, true, request, response); // depends on control dependency: [try], data = [none] } catch (Exception ex) { LOG.error("Error preparing exception output", ex); } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] logResult(System.currentTimeMillis() - t); }finally { requests.remove(); Session.end(id); } } }
public class class_name { protected void setSourceDirectoryForAllMojo(File newSourceDirectory) { final List<String> sourceRoots = this.mavenProject.getCompileSourceRoots(); getLog().debug("Old source roots: " + sourceRoots.toString()); //$NON-NLS-1$ final Iterator<String> iterator = sourceRoots.iterator(); final String removableSourcePath = this.javaSourceRoot.getAbsolutePath(); getLog().debug("Removable source root: " + removableSourcePath); //$NON-NLS-1$ String path; while (iterator.hasNext()) { path = iterator.next(); if (path != null && path.equals(removableSourcePath)) { getLog().debug("Removing source root: " + path); //$NON-NLS-1$ iterator.remove(); } } getLog().debug("Adding source root: " + newSourceDirectory.getAbsolutePath()); //$NON-NLS-1$ this.mavenProject.addCompileSourceRoot(newSourceDirectory.toString()); this.sourceDirectory = newSourceDirectory; } }
public class class_name { protected void setSourceDirectoryForAllMojo(File newSourceDirectory) { final List<String> sourceRoots = this.mavenProject.getCompileSourceRoots(); getLog().debug("Old source roots: " + sourceRoots.toString()); //$NON-NLS-1$ final Iterator<String> iterator = sourceRoots.iterator(); final String removableSourcePath = this.javaSourceRoot.getAbsolutePath(); getLog().debug("Removable source root: " + removableSourcePath); //$NON-NLS-1$ String path; while (iterator.hasNext()) { path = iterator.next(); // depends on control dependency: [while], data = [none] if (path != null && path.equals(removableSourcePath)) { getLog().debug("Removing source root: " + path); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] iterator.remove(); // depends on control dependency: [if], data = [none] } } getLog().debug("Adding source root: " + newSourceDirectory.getAbsolutePath()); //$NON-NLS-1$ this.mavenProject.addCompileSourceRoot(newSourceDirectory.toString()); this.sourceDirectory = newSourceDirectory; } }
public class class_name { public SearchAddressBooksResult withAddressBooks(AddressBookData... addressBooks) { if (this.addressBooks == null) { setAddressBooks(new java.util.ArrayList<AddressBookData>(addressBooks.length)); } for (AddressBookData ele : addressBooks) { this.addressBooks.add(ele); } return this; } }
public class class_name { public SearchAddressBooksResult withAddressBooks(AddressBookData... addressBooks) { if (this.addressBooks == null) { setAddressBooks(new java.util.ArrayList<AddressBookData>(addressBooks.length)); // depends on control dependency: [if], data = [none] } for (AddressBookData ele : addressBooks) { this.addressBooks.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }