code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void start() { if( this.timer == null ) { this.logger.fine( "Agent Monitoring is being started." ); this.timer = new ScheduledThreadPoolExecutor( 1 ); this.timer.scheduleWithFixedDelay( new MonitoringRunnable( this.agentInterface, this.handlers ), 0, Constants.PROBES_POLLING_PERIOD, TimeUnit.MILLISECONDS ); } } }
public class class_name { public void start() { if( this.timer == null ) { this.logger.fine( "Agent Monitoring is being started." ); // depends on control dependency: [if], data = [none] this.timer = new ScheduledThreadPoolExecutor( 1 ); // depends on control dependency: [if], data = [none] this.timer.scheduleWithFixedDelay( new MonitoringRunnable( this.agentInterface, this.handlers ), 0, Constants.PROBES_POLLING_PERIOD, TimeUnit.MILLISECONDS ); // depends on control dependency: [if], data = [none] } } }
public class class_name { void normalizeDependencies() { if (defineDependencies != null) { LinkedHashSet<String> temp = new LinkedHashSet<String>(Arrays.asList(PathUtil.normalizePaths(getParentPath(), defineDependencies))); // normalize and remove dups defineDependencies = temp.toArray(new String[temp.size()]); } if (requireDependencies != null) { LinkedHashSet<String> temp = new LinkedHashSet<String>(Arrays.asList(PathUtil.normalizePaths(getParentPath(), requireDependencies))); // normalize and remove dups requireDependencies = temp.toArray(new String[temp.size()]); } if (children != null) { for (Entry<String, DepTreeNode> entry : children.entrySet()) { entry.getValue().normalizeDependencies(); } } } }
public class class_name { void normalizeDependencies() { if (defineDependencies != null) { LinkedHashSet<String> temp = new LinkedHashSet<String>(Arrays.asList(PathUtil.normalizePaths(getParentPath(), defineDependencies))); // normalize and remove dups defineDependencies = temp.toArray(new String[temp.size()]); // depends on control dependency: [if], data = [none] } if (requireDependencies != null) { LinkedHashSet<String> temp = new LinkedHashSet<String>(Arrays.asList(PathUtil.normalizePaths(getParentPath(), requireDependencies))); // normalize and remove dups requireDependencies = temp.toArray(new String[temp.size()]); // depends on control dependency: [if], data = [none] } if (children != null) { for (Entry<String, DepTreeNode> entry : children.entrySet()) { entry.getValue().normalizeDependencies(); // depends on control dependency: [for], data = [entry] } } } }
public class class_name { public static String filepath2URI(String path){ // return null if path is null. if (path == null) return null; char separator = java.io.File.separatorChar; path = path.replace(separator, '/'); int len = path.length(), ch; StringBuilder buffer = new StringBuilder(len*3); buffer.append("file://"); // change C:/blah to /C:/blah if (len >= 2 && path.charAt(1) == ':') { ch = Character.toUpperCase(path.charAt(0)); if (ch >= 'A' && ch <= 'Z') { buffer.append('/'); } } // for each character in the path int i = 0; for (; i < len; i++) { ch = path.charAt(i); // if it's not an ASCII character, break here, and use UTF-8 encoding if (ch >= 128) break; if (gNeedEscaping[ch]) { buffer.append('%'); buffer.append(gAfterEscaping1[ch]); buffer.append(gAfterEscaping2[ch]); // record the fact that it's escaped } else { buffer.append((char)ch); } } // we saw some non-ascii character if (i < len) { // get UTF-8 bytes for the remaining sub-string byte[] bytes = null; byte b; try { bytes = path.substring(i).getBytes("UTF-8"); } catch (java.io.UnsupportedEncodingException e) { // should never happen return path; } len = bytes.length; // for each byte for (i = 0; i < len; i++) { b = bytes[i]; // for non-ascii character: make it positive, then escape if (b < 0) { ch = b + 256; buffer.append('%'); buffer.append(gHexChs[ch >> 4]); buffer.append(gHexChs[ch & 0xf]); } else if (gNeedEscaping[b]) { buffer.append('%'); buffer.append(gAfterEscaping1[b]); buffer.append(gAfterEscaping2[b]); } else { buffer.append((char)b); } } } return buffer.toString(); } }
public class class_name { public static String filepath2URI(String path){ // return null if path is null. if (path == null) return null; char separator = java.io.File.separatorChar; path = path.replace(separator, '/'); int len = path.length(), ch; StringBuilder buffer = new StringBuilder(len*3); buffer.append("file://"); // change C:/blah to /C:/blah if (len >= 2 && path.charAt(1) == ':') { ch = Character.toUpperCase(path.charAt(0)); if (ch >= 'A' && ch <= 'Z') { buffer.append('/'); // depends on control dependency: [if], data = [none] } } // for each character in the path int i = 0; for (; i < len; i++) { ch = path.charAt(i); // if it's not an ASCII character, break here, and use UTF-8 encoding if (ch >= 128) break; if (gNeedEscaping[ch]) { buffer.append('%'); buffer.append(gAfterEscaping1[ch]); buffer.append(gAfterEscaping2[ch]); // record the fact that it's escaped } else { buffer.append((char)ch); } } // we saw some non-ascii character if (i < len) { // get UTF-8 bytes for the remaining sub-string byte[] bytes = null; byte b; try { bytes = path.substring(i).getBytes("UTF-8"); } catch (java.io.UnsupportedEncodingException e) { // should never happen return path; } len = bytes.length; // for each byte for (i = 0; i < len; i++) { b = bytes[i]; // for non-ascii character: make it positive, then escape if (b < 0) { ch = b + 256; buffer.append('%'); buffer.append(gHexChs[ch >> 4]); buffer.append(gHexChs[ch & 0xf]); } else if (gNeedEscaping[b]) { buffer.append('%'); buffer.append(gAfterEscaping1[b]); buffer.append(gAfterEscaping2[b]); } else { buffer.append((char)b); } } } return buffer.toString(); } }
public class class_name { public static int mod(int val, int mod) { val = val % mod; if (val < 0) { val += mod; } return val; } }
public class class_name { public static int mod(int val, int mod) { val = val % mod; if (val < 0) { val += mod; // depends on control dependency: [if], data = [none] } return val; } }
public class class_name { protected Node bulkConstruct(DBIDRef cur, int maxScale, double parentDist, ModifiableDoubleDBIDList elems) { assert (!elems.contains(cur)); final double max = maxDistance(elems); final int scale = Math.min(distToScale(max) - 1, maxScale); final int nextScale = scale - 1; // Leaf node, because points coincide, we are too deep, or have too few // elements remaining: if(max <= 0 || scale <= scaleBottom || elems.size() < truncate) { return new Node(cur, max, parentDist, elems); } // Find neighbors in the cover of the current object: ModifiableDoubleDBIDList candidates = DBIDUtil.newDistanceDBIDList(); excludeNotCovered(elems, scaleToDist(scale), candidates); // If no elements were not in the cover, build a compact tree: if(candidates.size() == 0) { LOG.warning("Scale not chosen appropriately? " + max + " " + scaleToDist(scale)); return bulkConstruct(cur, nextScale, parentDist, elems); } // We will have at least one other child, so build the parent: Node node = new Node(cur, max, parentDist); // Routing element now is a singleton: final boolean curSingleton = elems.size() == 0; if(!curSingleton) { // Add node for the routing object: node.children.add(bulkConstruct(cur, nextScale, 0, elems)); } final double fmax = scaleToDist(nextScale); // Build additional cover nodes: for(DoubleDBIDListIter it = candidates.iter(); it.valid();) { assert (it.getOffset() == 0); DBID t = DBIDUtil.deref(it); elems.clear(); // Recycle. collectByCover(it, candidates, fmax, elems); assert (DBIDUtil.equal(t, it)) : "First element in candidates must not change!"; if(elems.size() == 0) { // Singleton node.singletons.add(it.doubleValue(), it); } else { // Build a full child node: node.children.add(bulkConstruct(it, nextScale, it.doubleValue(), elems)); } candidates.removeSwap(0); } assert (candidates.size() == 0); // Routing object is not yet handled: if(curSingleton) { if(node.isLeaf()) { node.children = null; // First in leaf is enough. } else { node.singletons.add(parentDist, cur); // Add as regular singleton. } } // TODO: improve recycling of lists? return node; } }
public class class_name { protected Node bulkConstruct(DBIDRef cur, int maxScale, double parentDist, ModifiableDoubleDBIDList elems) { assert (!elems.contains(cur)); final double max = maxDistance(elems); final int scale = Math.min(distToScale(max) - 1, maxScale); final int nextScale = scale - 1; // Leaf node, because points coincide, we are too deep, or have too few // elements remaining: if(max <= 0 || scale <= scaleBottom || elems.size() < truncate) { return new Node(cur, max, parentDist, elems); // depends on control dependency: [if], data = [none] } // Find neighbors in the cover of the current object: ModifiableDoubleDBIDList candidates = DBIDUtil.newDistanceDBIDList(); excludeNotCovered(elems, scaleToDist(scale), candidates); // If no elements were not in the cover, build a compact tree: if(candidates.size() == 0) { LOG.warning("Scale not chosen appropriately? " + max + " " + scaleToDist(scale)); // depends on control dependency: [if], data = [none] return bulkConstruct(cur, nextScale, parentDist, elems); // depends on control dependency: [if], data = [none] } // We will have at least one other child, so build the parent: Node node = new Node(cur, max, parentDist); // Routing element now is a singleton: final boolean curSingleton = elems.size() == 0; if(!curSingleton) { // Add node for the routing object: node.children.add(bulkConstruct(cur, nextScale, 0, elems)); // depends on control dependency: [if], data = [none] } final double fmax = scaleToDist(nextScale); // Build additional cover nodes: for(DoubleDBIDListIter it = candidates.iter(); it.valid();) { assert (it.getOffset() == 0); // depends on control dependency: [for], data = [it] DBID t = DBIDUtil.deref(it); elems.clear(); // Recycle. // depends on control dependency: [for], data = [none] collectByCover(it, candidates, fmax, elems); // depends on control dependency: [for], data = [it] assert (DBIDUtil.equal(t, it)) : "First element in candidates must not change!"; if(elems.size() == 0) { // Singleton node.singletons.add(it.doubleValue(), it); // depends on control dependency: [if], data = [none] } else { // Build a full child node: node.children.add(bulkConstruct(it, nextScale, it.doubleValue(), elems)); // depends on control dependency: [if], data = [none] } candidates.removeSwap(0); // depends on control dependency: [for], data = [none] } assert (candidates.size() == 0); // Routing object is not yet handled: if(curSingleton) { if(node.isLeaf()) { node.children = null; // First in leaf is enough. // depends on control dependency: [if], data = [none] } else { node.singletons.add(parentDist, cur); // Add as regular singleton. // depends on control dependency: [if], data = [none] } } // TODO: improve recycling of lists? return node; } }
public class class_name { protected String makeVariableString(VariableElement e) { StringBuilder result = new StringBuilder(); for (Modifier modifier : e.getModifiers()) { result.append(modifier.toString()); result.append(" "); } result.append(e.asType().toString()); result.append(" "); result.append(e.toString()); Object value = e.getConstantValue(); if (value != null) { result.append(" = "); if (e.asType().toString().equals("char")) { int v = (int)value.toString().charAt(0); result.append("'\\u"+Integer.toString(v,16)+"'"); } else { result.append(value.toString()); } } return result.toString(); } }
public class class_name { protected String makeVariableString(VariableElement e) { StringBuilder result = new StringBuilder(); for (Modifier modifier : e.getModifiers()) { result.append(modifier.toString()); // depends on control dependency: [for], data = [modifier] result.append(" "); // depends on control dependency: [for], data = [none] } result.append(e.asType().toString()); result.append(" "); result.append(e.toString()); Object value = e.getConstantValue(); if (value != null) { result.append(" = "); // depends on control dependency: [if], data = [none] if (e.asType().toString().equals("char")) { int v = (int)value.toString().charAt(0); result.append("'\\u"+Integer.toString(v,16)+"'"); // depends on control dependency: [if], data = [none] } else { result.append(value.toString()); // depends on control dependency: [if], data = [none] } } return result.toString(); } }
public class class_name { public double nextDoubleValue() { if (hasNextValue(true)) { final double y0 = ((timestamps[pos] & FLAG_FLOAT) == FLAG_FLOAT ? Double.longBitsToDouble(values[pos]) : values[pos]); if (current == pos) { //LOG.debug("Exact match, no lerp needed"); return y0; } if (rate) { // No LERP for the rate. Just uses the rate of any previous timestamp. // If x0 is smaller than the current time stamp 'x', we just use // y0 as a current rate of the 'pos' span. If x0 is bigger than the // current timestamp 'x', we don't go back further and just use y0 // instead. It happens only at the beginning of iteration. // TODO: Use the next rate the time range of which includes the current // timestamp 'x'. return y0; } final long x = timestamps[current] & TIME_MASK; final long x0 = timestamps[pos] & TIME_MASK; if (x == x0) { //LOG.debug("No lerp needed x == x0 (" + x + " == "+x0+") => " + y0); return y0; } final int next = pos + iterators.length; final double y1 = ((timestamps[next] & FLAG_FLOAT) == FLAG_FLOAT ? Double.longBitsToDouble(values[next]) : values[next]); final long x1 = timestamps[next] & TIME_MASK; if (x == x1) { //LOG.debug("No lerp needed x == x1 (" + x + " == "+x1+") => " + y1); return y1; } if ((x1 & Const.MILLISECOND_MASK) != 0) { throw new AssertionError("x1=" + x1 + " in " + this); } final double r; switch (method) { case LERP: r = y0 + (x - x0) * (y1 - y0) / (x1 - x0); //LOG.debug("Lerping to time " + x + ": " + y0 + " @ " + x0 // + " -> " + y1 + " @ " + x1 + " => " + r); break; case ZIM: r = 0; break; case MAX: r = Double.MAX_VALUE; break; case MIN: r = Double.MIN_VALUE; break; case PREV: r = y0; break; default: throw new IllegalDataException("Invalid interploation somehow??"); } return r; } throw new NoSuchElementException("no more doubles in " + this); } }
public class class_name { public double nextDoubleValue() { if (hasNextValue(true)) { final double y0 = ((timestamps[pos] & FLAG_FLOAT) == FLAG_FLOAT ? Double.longBitsToDouble(values[pos]) : values[pos]); if (current == pos) { //LOG.debug("Exact match, no lerp needed"); return y0; // depends on control dependency: [if], data = [none] } if (rate) { // No LERP for the rate. Just uses the rate of any previous timestamp. // If x0 is smaller than the current time stamp 'x', we just use // y0 as a current rate of the 'pos' span. If x0 is bigger than the // current timestamp 'x', we don't go back further and just use y0 // instead. It happens only at the beginning of iteration. // TODO: Use the next rate the time range of which includes the current // timestamp 'x'. return y0; // depends on control dependency: [if], data = [none] } final long x = timestamps[current] & TIME_MASK; final long x0 = timestamps[pos] & TIME_MASK; if (x == x0) { //LOG.debug("No lerp needed x == x0 (" + x + " == "+x0+") => " + y0); return y0; // depends on control dependency: [if], data = [none] } final int next = pos + iterators.length; final double y1 = ((timestamps[next] & FLAG_FLOAT) == FLAG_FLOAT ? Double.longBitsToDouble(values[next]) : values[next]); final long x1 = timestamps[next] & TIME_MASK; if (x == x1) { //LOG.debug("No lerp needed x == x1 (" + x + " == "+x1+") => " + y1); return y1; // depends on control dependency: [if], data = [none] } if ((x1 & Const.MILLISECOND_MASK) != 0) { throw new AssertionError("x1=" + x1 + " in " + this); } final double r; switch (method) { case LERP: r = y0 + (x - x0) * (y1 - y0) / (x1 - x0); //LOG.debug("Lerping to time " + x + ": " + y0 + " @ " + x0 // + " -> " + y1 + " @ " + x1 + " => " + r); break; case ZIM: r = 0; break; case MAX: r = Double.MAX_VALUE; break; case MIN: r = Double.MIN_VALUE; break; case PREV: r = y0; break; default: throw new IllegalDataException("Invalid interploation somehow??"); } return r; // depends on control dependency: [if], data = [none] } throw new NoSuchElementException("no more doubles in " + this); } }
public class class_name { public void setSourceCode(java.util.Collection<Code> sourceCode) { if (sourceCode == null) { this.sourceCode = null; return; } this.sourceCode = new java.util.ArrayList<Code>(sourceCode); } }
public class class_name { public void setSourceCode(java.util.Collection<Code> sourceCode) { if (sourceCode == null) { this.sourceCode = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.sourceCode = new java.util.ArrayList<Code>(sourceCode); } }
public class class_name { @Override public Entry postMedia(final AtomRequest areq, final Entry entry) throws AtomException { // get incoming slug from HTTP header final String slug = areq.getHeader("Slug"); if (LOG.isDebugEnabled()) { LOG.debug("postMedia - title: " + entry.getTitle() + " slug:" + slug); } try { final File tempFile = null; final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String handle = pathInfo[0]; final String collection = pathInfo[1]; final FileBasedCollection col = service.findCollectionByHandle(handle, collection); try { col.addMediaEntry(entry, slug, areq.getInputStream()); } catch (final Exception e) { e.printStackTrace(); final String msg = "ERROR reading posted file"; LOG.error(msg, e); throw new AtomException(msg, e); } finally { if (tempFile != null) { tempFile.delete(); } } } catch (final Exception re) { throw new AtomException("ERROR: posting media"); } return entry; } }
public class class_name { @Override public Entry postMedia(final AtomRequest areq, final Entry entry) throws AtomException { // get incoming slug from HTTP header final String slug = areq.getHeader("Slug"); if (LOG.isDebugEnabled()) { LOG.debug("postMedia - title: " + entry.getTitle() + " slug:" + slug); } try { final File tempFile = null; final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String handle = pathInfo[0]; final String collection = pathInfo[1]; final FileBasedCollection col = service.findCollectionByHandle(handle, collection); try { col.addMediaEntry(entry, slug, areq.getInputStream()); } catch (final Exception e) { e.printStackTrace(); final String msg = "ERROR reading posted file"; LOG.error(msg, e); throw new AtomException(msg, e); } finally { if (tempFile != null) { tempFile.delete(); // depends on control dependency: [if], data = [none] } } } catch (final Exception re) { throw new AtomException("ERROR: posting media"); } return entry; } }
public class class_name { protected String exceptionMessage(String id, String messageTemplate, Object... parameters) { String formattedTemplate = formatMessageTemplate(id, messageTemplate); if(parameters == null || parameters.length == 0) { return formattedTemplate; } else { return MessageFormatter.arrayFormat(formattedTemplate, parameters).getMessage(); } } }
public class class_name { protected String exceptionMessage(String id, String messageTemplate, Object... parameters) { String formattedTemplate = formatMessageTemplate(id, messageTemplate); if(parameters == null || parameters.length == 0) { return formattedTemplate; // depends on control dependency: [if], data = [none] } else { return MessageFormatter.arrayFormat(formattedTemplate, parameters).getMessage(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Chunk get(char c, Font font) { char greek = SpecialSymbol.getCorrespondingSymbol(c); if (greek == ' ') { return new Chunk(String.valueOf(c), font); } Font symbol = new Font(Font.SYMBOL, font.getSize(), font.getStyle(), font.getColor()); String s = String.valueOf(greek); return new Chunk(s, symbol); } }
public class class_name { public static Chunk get(char c, Font font) { char greek = SpecialSymbol.getCorrespondingSymbol(c); if (greek == ' ') { return new Chunk(String.valueOf(c), font); // depends on control dependency: [if], data = [none] } Font symbol = new Font(Font.SYMBOL, font.getSize(), font.getStyle(), font.getColor()); String s = String.valueOf(greek); return new Chunk(s, symbol); } }
public class class_name { protected static String read(Reader file) throws IOException { final StringBuilder content = new StringBuilder(); try (BufferedReader reader = new BufferedReader(file)) { String line = reader.readLine(); boolean first = true; while (line != null) { if (first) { first = false; } else { content.append("\n"); //$NON-NLS-1$ } content.append(line); line = reader.readLine(); } } return content.toString(); } }
public class class_name { protected static String read(Reader file) throws IOException { final StringBuilder content = new StringBuilder(); try (BufferedReader reader = new BufferedReader(file)) { String line = reader.readLine(); boolean first = true; while (line != null) { if (first) { first = false; // depends on control dependency: [if], data = [none] } else { content.append("\n"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } content.append(line); // depends on control dependency: [while], data = [(line] line = reader.readLine(); // depends on control dependency: [while], data = [none] } } return content.toString(); } }
public class class_name { @Override public EClass getIfcRamp() { if (ifcRampEClass == null) { ifcRampEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(496); } return ifcRampEClass; } }
public class class_name { @Override public EClass getIfcRamp() { if (ifcRampEClass == null) { ifcRampEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers() .get(496); // depends on control dependency: [if], data = [none] } return ifcRampEClass; } }
public class class_name { private void zeroMeanWorldPoints(List<AssociatedPair> points) { center.set(0,0); pointsAdj.reset(); for (int i = 0; i < points.size(); i++) { AssociatedPair pair = points.get(i); Point2D_F64 p = pair.p1; pointsAdj.grow().p2.set(pair.p2); center.x += p.x; center.y += p.y; } center.x /= points.size(); center.y /= points.size(); for (int i = 0; i < points.size(); i++) { Point2D_F64 p = points.get(i).p1; pointsAdj.get(i).p1.set( p.x - center.x, p.y - center.y); } } }
public class class_name { private void zeroMeanWorldPoints(List<AssociatedPair> points) { center.set(0,0); pointsAdj.reset(); for (int i = 0; i < points.size(); i++) { AssociatedPair pair = points.get(i); Point2D_F64 p = pair.p1; pointsAdj.grow().p2.set(pair.p2); // depends on control dependency: [for], data = [none] center.x += p.x; // depends on control dependency: [for], data = [none] center.y += p.y; // depends on control dependency: [for], data = [none] } center.x /= points.size(); center.y /= points.size(); for (int i = 0; i < points.size(); i++) { Point2D_F64 p = points.get(i).p1; pointsAdj.get(i).p1.set( p.x - center.x, p.y - center.y); // depends on control dependency: [for], data = [i] } } }
public class class_name { public String [] processName (String qName, String parts[], boolean isAttribute) { String myParts[] = currentContext.processName(qName, isAttribute); if (myParts == null) { return null; } else { parts[0] = myParts[0]; parts[1] = myParts[1]; parts[2] = myParts[2]; return parts; } } }
public class class_name { public String [] processName (String qName, String parts[], boolean isAttribute) { String myParts[] = currentContext.processName(qName, isAttribute); if (myParts == null) { return null; // depends on control dependency: [if], data = [none] } else { parts[0] = myParts[0]; // depends on control dependency: [if], data = [none] parts[1] = myParts[1]; // depends on control dependency: [if], data = [none] parts[2] = myParts[2]; // depends on control dependency: [if], data = [none] return parts; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean containsContentEqualsIgnoreCase(Collection<CharSequence> collection, CharSequence value) { for (CharSequence v : collection) { if (contentEqualsIgnoreCase(value, v)) { return true; } } return false; } }
public class class_name { public static boolean containsContentEqualsIgnoreCase(Collection<CharSequence> collection, CharSequence value) { for (CharSequence v : collection) { if (contentEqualsIgnoreCase(value, v)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { @Override public TimeZoneTransition getPreviousTransition(long base, boolean inclusive) { complete(); if (historicTransitions == null) { return null; } TimeZoneTransition result; TimeZoneTransition tzt = historicTransitions.get(0); long tt = tzt.getTime(); if (inclusive && tt == base) { result = tzt; } else if (tt >= base) { return null; } else { int idx = historicTransitions.size() - 1; tzt = historicTransitions.get(idx); tt = tzt.getTime(); if (inclusive && tt == base) { result = tzt; } else if (tt < base) { if (finalRules != null) { // Find a transion time with finalRules Date start0 = finalRules[0].getPreviousStart(base, finalRules[1].getRawOffset(), finalRules[1].getDSTSavings(), inclusive); Date start1 = finalRules[1].getPreviousStart(base, finalRules[0].getRawOffset(), finalRules[0].getDSTSavings(), inclusive); if (start1.before(start0)) { tzt = new TimeZoneTransition(start0.getTime(), finalRules[1], finalRules[0]); } else { tzt = new TimeZoneTransition(start1.getTime(), finalRules[0], finalRules[1]); } } result = tzt; } else { // Find a transition within the historic transitions idx--; while (idx >= 0) { tzt = historicTransitions.get(idx); tt = tzt.getTime(); if (tt < base || (inclusive && tt == base)) { break; } idx--; } result = tzt; } } // For now, this implementation ignore transitions with only zone name changes. TimeZoneRule from = result.getFrom(); TimeZoneRule to = result.getTo(); if (from.getRawOffset() == to.getRawOffset() && from.getDSTSavings() == to.getDSTSavings()) { // No offset changes. Try previous one result = getPreviousTransition(result.getTime(), false /* always exclusive */); } return result; } }
public class class_name { @Override public TimeZoneTransition getPreviousTransition(long base, boolean inclusive) { complete(); if (historicTransitions == null) { return null; // depends on control dependency: [if], data = [none] } TimeZoneTransition result; TimeZoneTransition tzt = historicTransitions.get(0); long tt = tzt.getTime(); if (inclusive && tt == base) { result = tzt; // depends on control dependency: [if], data = [none] } else if (tt >= base) { return null; // depends on control dependency: [if], data = [none] } else { int idx = historicTransitions.size() - 1; tzt = historicTransitions.get(idx); // depends on control dependency: [if], data = [none] tt = tzt.getTime(); // depends on control dependency: [if], data = [none] if (inclusive && tt == base) { result = tzt; // depends on control dependency: [if], data = [none] } else if (tt < base) { if (finalRules != null) { // Find a transion time with finalRules Date start0 = finalRules[0].getPreviousStart(base, finalRules[1].getRawOffset(), finalRules[1].getDSTSavings(), inclusive); Date start1 = finalRules[1].getPreviousStart(base, finalRules[0].getRawOffset(), finalRules[0].getDSTSavings(), inclusive); if (start1.before(start0)) { tzt = new TimeZoneTransition(start0.getTime(), finalRules[1], finalRules[0]); // depends on control dependency: [if], data = [none] } else { tzt = new TimeZoneTransition(start1.getTime(), finalRules[0], finalRules[1]); // depends on control dependency: [if], data = [none] } } result = tzt; // depends on control dependency: [if], data = [none] } else { // Find a transition within the historic transitions idx--; // depends on control dependency: [if], data = [none] while (idx >= 0) { tzt = historicTransitions.get(idx); // depends on control dependency: [while], data = [(idx] tt = tzt.getTime(); // depends on control dependency: [while], data = [none] if (tt < base || (inclusive && tt == base)) { break; } idx--; // depends on control dependency: [while], data = [none] } result = tzt; // depends on control dependency: [if], data = [none] } } // For now, this implementation ignore transitions with only zone name changes. TimeZoneRule from = result.getFrom(); TimeZoneRule to = result.getTo(); if (from.getRawOffset() == to.getRawOffset() && from.getDSTSavings() == to.getDSTSavings()) { // No offset changes. Try previous one result = getPreviousTransition(result.getTime(), false /* always exclusive */); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public FleetAttributes withMetricGroups(String... metricGroups) { if (this.metricGroups == null) { setMetricGroups(new java.util.ArrayList<String>(metricGroups.length)); } for (String ele : metricGroups) { this.metricGroups.add(ele); } return this; } }
public class class_name { public FleetAttributes withMetricGroups(String... metricGroups) { if (this.metricGroups == null) { setMetricGroups(new java.util.ArrayList<String>(metricGroups.length)); // depends on control dependency: [if], data = [none] } for (String ele : metricGroups) { this.metricGroups.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static ScoreFunction illumina() { return new ScoreFunction() { @Override public double evaluate(final double relativePosition) { // TODO: this could use improvement; perhaps re-use quality profiles from ART if (relativePosition < 0.05d) { return 14400.0d * (relativePosition * relativePosition); } else if (relativePosition < 0.8d) { return 36.0d; } else { return 22600.0d * Math.pow(relativePosition - 1.0d, 4.0d); } } }; } }
public class class_name { public static ScoreFunction illumina() { return new ScoreFunction() { @Override public double evaluate(final double relativePosition) { // TODO: this could use improvement; perhaps re-use quality profiles from ART if (relativePosition < 0.05d) { return 14400.0d * (relativePosition * relativePosition); // depends on control dependency: [if], data = [(relativePosition] } else if (relativePosition < 0.8d) { return 36.0d; // depends on control dependency: [if], data = [none] } else { return 22600.0d * Math.pow(relativePosition - 1.0d, 4.0d); // depends on control dependency: [if], data = [(relativePosition] } } }; } }
public class class_name { public void initProperties() { propertiesPath = getContext().getFiles().getPropertiesLocation() + File.separator + getContext().getAddOns().getAddOn().getID() + ".properties"; this.propertiesFile = new File(propertiesPath); if (!this.propertiesFile.exists()) try { this.propertiesFile.createNewFile(); } catch (IOException e) { error("Error while trying to create the new Properties file", e); } try { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(this.propertiesFile), "UTF8")); try { properties.load(in); } catch (IOException e) { error("unable to load the InputStream for the PropertiesFile",e); } } catch (FileNotFoundException | UnsupportedEncodingException e) { error("Error while trying to read Properties-File", e); } if (defaultPropertiesPath != null && new File(defaultPropertiesPath).exists()) { @SuppressWarnings("unchecked") Enumeration<String> keys = (Enumeration<String>)properties.propertyNames(); if (!keys.hasMoreElements()) { try { createDefaultPropertyFile(defaultPropertiesPath); } catch (IOException e) { error("Error while trying to copy the Default-Properties File", e); } if (new File(defaultPropertiesPath).exists() && !writeToPropertiesFile(defaultPropertiesPath)) return; reloadProperties(); } } } }
public class class_name { public void initProperties() { propertiesPath = getContext().getFiles().getPropertiesLocation() + File.separator + getContext().getAddOns().getAddOn().getID() + ".properties"; this.propertiesFile = new File(propertiesPath); if (!this.propertiesFile.exists()) try { this.propertiesFile.createNewFile(); // depends on control dependency: [try], data = [none] } catch (IOException e) { error("Error while trying to create the new Properties file", e); } // depends on control dependency: [catch], data = [none] try { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(this.propertiesFile), "UTF8")); try { properties.load(in); // depends on control dependency: [try], data = [none] } catch (IOException e) { error("unable to load the InputStream for the PropertiesFile",e); } // depends on control dependency: [catch], data = [none] } catch (FileNotFoundException | UnsupportedEncodingException e) { error("Error while trying to read Properties-File", e); } // depends on control dependency: [catch], data = [none] if (defaultPropertiesPath != null && new File(defaultPropertiesPath).exists()) { @SuppressWarnings("unchecked") Enumeration<String> keys = (Enumeration<String>)properties.propertyNames(); if (!keys.hasMoreElements()) { try { createDefaultPropertyFile(defaultPropertiesPath); // depends on control dependency: [try], data = [none] } catch (IOException e) { error("Error while trying to copy the Default-Properties File", e); } // depends on control dependency: [catch], data = [none] if (new File(defaultPropertiesPath).exists() && !writeToPropertiesFile(defaultPropertiesPath)) return; reloadProperties(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private boolean isRealSentence(AnalyzedSentence sentence) { AnalyzedTokenReadings[] tokens = sentence.getTokensWithoutWhitespace(); if (tokens.length > 0) { AnalyzedTokenReadings lastToken = tokens[tokens.length - 1]; return lastToken.hasPosTag("PKT") && StringUtils.equalsAny(lastToken.getToken(), ".", "?", "!"); } return false; } }
public class class_name { private boolean isRealSentence(AnalyzedSentence sentence) { AnalyzedTokenReadings[] tokens = sentence.getTokensWithoutWhitespace(); if (tokens.length > 0) { AnalyzedTokenReadings lastToken = tokens[tokens.length - 1]; return lastToken.hasPosTag("PKT") && StringUtils.equalsAny(lastToken.getToken(), ".", "?", "!"); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public JSONObject toJSON(CmsObject cms, boolean includeLang) { try { CmsObject clone = OpenCms.initCmsObject(cms); clone.getRequestContext().setSiteRoot(""); JSONObject jsonAttachment = new JSONObject(); CmsResource res = clone.readResource(m_rootPath, CmsResourceFilter.IGNORE_EXPIRATION); Map<String, String> props = CmsProperty.toMap(clone.readPropertyObjects(res, false)); // id and path jsonAttachment.put(JSON_UUID, res.getStructureId()); jsonAttachment.put(JSON_PATH, res.getRootPath()); // title jsonAttachment.put(JSON_TITLE, props.get(CmsPropertyDefinition.PROPERTY_TITLE)); // date created jsonAttachment.put(JSON_DATE_CREATED, res.getDateCreated()); // date created jsonAttachment.put(JSON_LOCALE, m_locale); // date modified jsonAttachment.put(JSON_DATE_MODIFIED, res.getDateLastModified()); if (includeLang) { // get all language versions of the document List<CmsDocumentDependency> langs = getVariants(); if (langs != null) { JSONArray jsonLanguages = new JSONArray(); for (CmsDocumentDependency lang : langs) { JSONObject jsonLanguage = lang.toJSON(cms, false); jsonLanguages.put(jsonLanguage); } jsonAttachment.put(JSON_LANGUAGES, jsonLanguages); } } return jsonAttachment; } catch (Exception ex) { LOG.error(ex.getLocalizedMessage(), ex); } return null; } }
public class class_name { public JSONObject toJSON(CmsObject cms, boolean includeLang) { try { CmsObject clone = OpenCms.initCmsObject(cms); clone.getRequestContext().setSiteRoot(""); // depends on control dependency: [try], data = [none] JSONObject jsonAttachment = new JSONObject(); CmsResource res = clone.readResource(m_rootPath, CmsResourceFilter.IGNORE_EXPIRATION); Map<String, String> props = CmsProperty.toMap(clone.readPropertyObjects(res, false)); // id and path jsonAttachment.put(JSON_UUID, res.getStructureId()); // depends on control dependency: [try], data = [none] jsonAttachment.put(JSON_PATH, res.getRootPath()); // depends on control dependency: [try], data = [none] // title jsonAttachment.put(JSON_TITLE, props.get(CmsPropertyDefinition.PROPERTY_TITLE)); // depends on control dependency: [try], data = [none] // date created jsonAttachment.put(JSON_DATE_CREATED, res.getDateCreated()); // depends on control dependency: [try], data = [none] // date created jsonAttachment.put(JSON_LOCALE, m_locale); // depends on control dependency: [try], data = [none] // date modified jsonAttachment.put(JSON_DATE_MODIFIED, res.getDateLastModified()); // depends on control dependency: [try], data = [none] if (includeLang) { // get all language versions of the document List<CmsDocumentDependency> langs = getVariants(); if (langs != null) { JSONArray jsonLanguages = new JSONArray(); for (CmsDocumentDependency lang : langs) { JSONObject jsonLanguage = lang.toJSON(cms, false); jsonLanguages.put(jsonLanguage); // depends on control dependency: [for], data = [none] } jsonAttachment.put(JSON_LANGUAGES, jsonLanguages); // depends on control dependency: [if], data = [none] } } return jsonAttachment; // depends on control dependency: [try], data = [none] } catch (Exception ex) { LOG.error(ex.getLocalizedMessage(), ex); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { public static void updateModelGroupResources( HttpServletRequest request, HttpServletResponse response, String basePath, String baseContainerName) throws IOException { if (CmsFlexController.isCmsRequest(request)) { try { CmsFlexController controller = CmsFlexController.getController(request); CmsObject cms = controller.getCmsObject(); CmsResource base = cms.readResource(basePath); List<CmsResource> resources; I_CmsResourceType groupType = OpenCms.getResourceManager().getResourceType( CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME); if (base.isFolder()) { resources = cms.readResources( basePath, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(groupType)); } else if (OpenCms.getResourceManager().getResourceType(base).equals(groupType)) { resources = Collections.singletonList(base); } else { resources = Collections.emptyList(); } if (resources.isEmpty()) { response.getWriter().println("No model group resources found at " + basePath + "<br />"); } else { for (CmsResource group : resources) { boolean updated = updateModelGroupResource(cms, group, baseContainerName); response.getWriter().println( "Group '" + group.getRootPath() + "' was updated " + updated + "<br />"); } } } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); e.printStackTrace(response.getWriter()); } } } }
public class class_name { public static void updateModelGroupResources( HttpServletRequest request, HttpServletResponse response, String basePath, String baseContainerName) throws IOException { if (CmsFlexController.isCmsRequest(request)) { try { CmsFlexController controller = CmsFlexController.getController(request); CmsObject cms = controller.getCmsObject(); CmsResource base = cms.readResource(basePath); List<CmsResource> resources; I_CmsResourceType groupType = OpenCms.getResourceManager().getResourceType( CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME); if (base.isFolder()) { resources = cms.readResources( basePath, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(groupType)); // depends on control dependency: [if], data = [none] } else if (OpenCms.getResourceManager().getResourceType(base).equals(groupType)) { resources = Collections.singletonList(base); // depends on control dependency: [if], data = [none] } else { resources = Collections.emptyList(); // depends on control dependency: [if], data = [none] } if (resources.isEmpty()) { response.getWriter().println("No model group resources found at " + basePath + "<br />"); // depends on control dependency: [if], data = [none] } else { for (CmsResource group : resources) { boolean updated = updateModelGroupResource(cms, group, baseContainerName); response.getWriter().println( "Group '" + group.getRootPath() + "' was updated " + updated + "<br />"); // depends on control dependency: [for], data = [none] } } } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); e.printStackTrace(response.getWriter()); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public FieldType calcFieldType( String content ) { final SnippetBuilder.SnippetType snippetType = SnippetBuilder.getType( content ); if ( snippetType.equals( SnippetBuilder.SnippetType.FORALL ) ) { return FieldType.FORALL_FIELD; } else if ( !snippetType.equals( SnippetBuilder.SnippetType.SINGLE ) ) { return FieldType.NORMAL_FIELD; } for ( String op : operators ) { if ( content.endsWith( op ) ) { return FieldType.OPERATOR_FIELD; } } return FieldType.SINGLE_FIELD; } }
public class class_name { public FieldType calcFieldType( String content ) { final SnippetBuilder.SnippetType snippetType = SnippetBuilder.getType( content ); if ( snippetType.equals( SnippetBuilder.SnippetType.FORALL ) ) { return FieldType.FORALL_FIELD; // depends on control dependency: [if], data = [none] } else if ( !snippetType.equals( SnippetBuilder.SnippetType.SINGLE ) ) { return FieldType.NORMAL_FIELD; // depends on control dependency: [if], data = [none] } for ( String op : operators ) { if ( content.endsWith( op ) ) { return FieldType.OPERATOR_FIELD; // depends on control dependency: [if], data = [none] } } return FieldType.SINGLE_FIELD; } }
public class class_name { public static String toFullJobPath(final String jobName) { final String[] parts = jobName.split("/"); if (parts.length == 1) return parts[0]; final StringBuilder sb = new StringBuilder(DEFAULT_BUFFER_SIZE); for (int i = 0; i < parts.length; i++) { sb.append(parts[i]); if (i != parts.length -1) sb.append("/job/"); } return sb.toString(); } }
public class class_name { public static String toFullJobPath(final String jobName) { final String[] parts = jobName.split("/"); if (parts.length == 1) return parts[0]; final StringBuilder sb = new StringBuilder(DEFAULT_BUFFER_SIZE); for (int i = 0; i < parts.length; i++) { sb.append(parts[i]); // depends on control dependency: [for], data = [i] if (i != parts.length -1) sb.append("/job/"); } return sb.toString(); } }
public class class_name { protected ArgumentComponent selectMainArgumentComponent( List<ArgumentComponent> argumentComponents) { ArgumentComponent result = null; int maxLength = Integer.MIN_VALUE; for (ArgumentComponent argumentComponent : argumentComponents) { int length = argumentComponent.getEnd() - argumentComponent.getBegin(); if (length > maxLength) { maxLength = length; result = argumentComponent; } } if (result == null) { throw new IllegalStateException("Couldn't find maximum arg. component"); } return result; } }
public class class_name { protected ArgumentComponent selectMainArgumentComponent( List<ArgumentComponent> argumentComponents) { ArgumentComponent result = null; int maxLength = Integer.MIN_VALUE; for (ArgumentComponent argumentComponent : argumentComponents) { int length = argumentComponent.getEnd() - argumentComponent.getBegin(); if (length > maxLength) { maxLength = length; // depends on control dependency: [if], data = [none] result = argumentComponent; // depends on control dependency: [if], data = [none] } } if (result == null) { throw new IllegalStateException("Couldn't find maximum arg. component"); } return result; } }
public class class_name { @Override public int countByUuid(String uuid) { FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID; Object[] finderArgs = new Object[] { uuid }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(2); query.append(_SQL_COUNT_COMMERCENOTIFICATIONATTACHMENT_WHERE); boolean bindUuid = false; if (uuid == null) { query.append(_FINDER_COLUMN_UUID_UUID_1); } else if (uuid.equals("")) { query.append(_FINDER_COLUMN_UUID_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_UUID_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } }
public class class_name { @Override public int countByUuid(String uuid) { FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID; Object[] finderArgs = new Object[] { uuid }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(2); query.append(_SQL_COUNT_COMMERCENOTIFICATIONATTACHMENT_WHERE); // depends on control dependency: [if], data = [none] boolean bindUuid = false; if (uuid == null) { query.append(_FINDER_COLUMN_UUID_UUID_1); // depends on control dependency: [if], data = [none] } else if (uuid.equals("")) { query.append(_FINDER_COLUMN_UUID_UUID_3); // depends on control dependency: [if], data = [none] } else { bindUuid = true; // depends on control dependency: [if], data = [none] query.append(_FINDER_COLUMN_UUID_UUID_2); // depends on control dependency: [if], data = [none] } String sql = query.toString(); Session session = null; try { session = openSession(); // depends on control dependency: [try], data = [none] Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); // depends on control dependency: [if], data = [none] } count = (Long)q.uniqueResult(); // depends on control dependency: [try], data = [none] finderCache.putResult(finderPath, finderArgs, count); // depends on control dependency: [try], data = [none] } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } // depends on control dependency: [catch], data = [none] finally { closeSession(session); } } return count.intValue(); } }
public class class_name { public void marshall(UpdateCampaignRequest updateCampaignRequest, ProtocolMarshaller protocolMarshaller) { if (updateCampaignRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateCampaignRequest.getApplicationId(), APPLICATIONID_BINDING); protocolMarshaller.marshall(updateCampaignRequest.getCampaignId(), CAMPAIGNID_BINDING); protocolMarshaller.marshall(updateCampaignRequest.getWriteCampaignRequest(), WRITECAMPAIGNREQUEST_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateCampaignRequest updateCampaignRequest, ProtocolMarshaller protocolMarshaller) { if (updateCampaignRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateCampaignRequest.getApplicationId(), APPLICATIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateCampaignRequest.getCampaignId(), CAMPAIGNID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateCampaignRequest.getWriteCampaignRequest(), WRITECAMPAIGNREQUEST_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 { void killSocket() { try { m_closing = true; m_socket.setKeepAlive(false); m_socket.setSoLinger(false, 0); Thread.sleep(25); m_socket.close(); Thread.sleep(25); System.gc(); Thread.sleep(25); } catch (Exception e) { // don't REALLY care if this fails e.printStackTrace(); } } }
public class class_name { void killSocket() { try { m_closing = true; // depends on control dependency: [try], data = [none] m_socket.setKeepAlive(false); // depends on control dependency: [try], data = [none] m_socket.setSoLinger(false, 0); // depends on control dependency: [try], data = [none] Thread.sleep(25); // depends on control dependency: [try], data = [none] m_socket.close(); // depends on control dependency: [try], data = [none] Thread.sleep(25); // depends on control dependency: [try], data = [none] System.gc(); // depends on control dependency: [try], data = [none] Thread.sleep(25); // depends on control dependency: [try], data = [none] } catch (Exception e) { // don't REALLY care if this fails e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void runPendingCommands() { List<Runnable> commandsToRun = commands; commands = new ArrayList<Runnable>(); for (Runnable command: commandsToRun) { command.run(); } } }
public class class_name { public void runPendingCommands() { List<Runnable> commandsToRun = commands; commands = new ArrayList<Runnable>(); for (Runnable command: commandsToRun) { command.run(); // depends on control dependency: [for], data = [command] } } }
public class class_name { public void put(int index, RPCParameter param) { expand(index); if (index < params.size()) { params.set(index, param); } else { params.add(param); } } }
public class class_name { public void put(int index, RPCParameter param) { expand(index); if (index < params.size()) { params.set(index, param); // depends on control dependency: [if], data = [(index] } else { params.add(param); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public <T> T createContextualProxy(T instance, Map<String, String> executionProperties, final Class<T> intf) { Set<String> internalPropNames = executionProperties == null ? null : new HashSet<String>(); @SuppressWarnings("unchecked") ThreadContextDescriptor threadContextDescriptor = captureThreadContext(executionProperties, instance, internalPropNames); if (intf == null || !intf.isInstance(instance)) throw new IllegalArgumentException(instance + ", " + (intf == null ? null : intf.getName())); T proxy; if (Callable.class.equals(intf)) { @SuppressWarnings("unchecked") Callable<Object> callable = (Callable<Object>) instance; proxy = intf.cast(new ContextualCallable<Object>(threadContextDescriptor, callable, internalPropNames)); } else if (Runnable.class.equals(intf)) { proxy = intf.cast(new ContextualRunnable(threadContextDescriptor, (Runnable) instance, internalPropNames)); } else { final InvocationHandler handler = new ContextualInvocationHandler(threadContextDescriptor, instance, internalPropNames); proxy = AccessController.doPrivileged(new PrivilegedAction<T>() { @Override public T run() { return intf.cast(Proxy.newProxyInstance(intf.getClassLoader(), new Class<?>[] { intf }, handler)); } }); } return proxy; } }
public class class_name { @Override public <T> T createContextualProxy(T instance, Map<String, String> executionProperties, final Class<T> intf) { Set<String> internalPropNames = executionProperties == null ? null : new HashSet<String>(); @SuppressWarnings("unchecked") ThreadContextDescriptor threadContextDescriptor = captureThreadContext(executionProperties, instance, internalPropNames); if (intf == null || !intf.isInstance(instance)) throw new IllegalArgumentException(instance + ", " + (intf == null ? null : intf.getName())); T proxy; if (Callable.class.equals(intf)) { @SuppressWarnings("unchecked") Callable<Object> callable = (Callable<Object>) instance; proxy = intf.cast(new ContextualCallable<Object>(threadContextDescriptor, callable, internalPropNames)); // depends on control dependency: [if], data = [none] } else if (Runnable.class.equals(intf)) { proxy = intf.cast(new ContextualRunnable(threadContextDescriptor, (Runnable) instance, internalPropNames)); // depends on control dependency: [if], data = [none] } else { final InvocationHandler handler = new ContextualInvocationHandler(threadContextDescriptor, instance, internalPropNames); proxy = AccessController.doPrivileged(new PrivilegedAction<T>() { @Override public T run() { return intf.cast(Proxy.newProxyInstance(intf.getClassLoader(), new Class<?>[] { intf }, handler)); } }); // depends on control dependency: [if], data = [none] } return proxy; } }
public class class_name { public static byte[] decodeLines(String s) { char[] buf = new char[s.length()]; int p = 0; for (int ip = 0; ip < s.length(); ip++) { char c = s.charAt(ip); if (c != ' ' && c != '\r' && c != '\n' && c != '\t') { buf[p++] = c; } } return decode(buf, 0, p); } }
public class class_name { public static byte[] decodeLines(String s) { char[] buf = new char[s.length()]; int p = 0; for (int ip = 0; ip < s.length(); ip++) { char c = s.charAt(ip); if (c != ' ' && c != '\r' && c != '\n' && c != '\t') { buf[p++] = c; // depends on control dependency: [if], data = [none] } } return decode(buf, 0, p); } }
public class class_name { public String range(ThresholdRangeCondition condition) { String description; if (condition.getContext() != null && condition.getContext().get(CONTEXT_PROPERTY_DESCRIPTION) != null) { description = condition.getContext().get(CONTEXT_PROPERTY_DESCRIPTION); } else { description = condition.getDataId(); } if (condition.isInRange()) { description += " in "; } else { description += " out of "; } ThresholdRangeCondition.Operator operatorLow = condition.getOperatorLow(); ThresholdRangeCondition.Operator operatorHigh = condition.getOperatorHigh(); if (operatorLow.equals(ThresholdRangeCondition.Operator.INCLUSIVE)) { description += "["; } else { description += "("; } description += decimalFormat.format(condition.getThresholdLow()); description += ", "; description += decimalFormat.format(condition.getThresholdHigh()); if (operatorHigh.equals(ThresholdRangeCondition.Operator.INCLUSIVE)) { description += "]"; } else { description += ")"; } if (condition.getContext() != null && condition.getContext().get(CONTEXT_PROPERTY_UNIT) != null) { description += " " + condition.getContext().get(CONTEXT_PROPERTY_UNIT); } else { description += " (range)"; } return description; } }
public class class_name { public String range(ThresholdRangeCondition condition) { String description; if (condition.getContext() != null && condition.getContext().get(CONTEXT_PROPERTY_DESCRIPTION) != null) { description = condition.getContext().get(CONTEXT_PROPERTY_DESCRIPTION); // depends on control dependency: [if], data = [none] } else { description = condition.getDataId(); // depends on control dependency: [if], data = [none] } if (condition.isInRange()) { description += " in "; // depends on control dependency: [if], data = [none] } else { description += " out of "; // depends on control dependency: [if], data = [none] } ThresholdRangeCondition.Operator operatorLow = condition.getOperatorLow(); ThresholdRangeCondition.Operator operatorHigh = condition.getOperatorHigh(); if (operatorLow.equals(ThresholdRangeCondition.Operator.INCLUSIVE)) { description += "["; // depends on control dependency: [if], data = [none] } else { description += "("; // depends on control dependency: [if], data = [none] } description += decimalFormat.format(condition.getThresholdLow()); description += ", "; description += decimalFormat.format(condition.getThresholdHigh()); if (operatorHigh.equals(ThresholdRangeCondition.Operator.INCLUSIVE)) { description += "]"; // depends on control dependency: [if], data = [none] } else { description += ")"; // depends on control dependency: [if], data = [none] } if (condition.getContext() != null && condition.getContext().get(CONTEXT_PROPERTY_UNIT) != null) { description += " " + condition.getContext().get(CONTEXT_PROPERTY_UNIT); // depends on control dependency: [if], data = [none] } else { description += " (range)"; // depends on control dependency: [if], data = [none] } return description; } }
public class class_name { protected void createGetProfileCMPMethods( Collection<GetProfileCMPMethodDescriptor> cmpProfiles) { if (cmpProfiles == null) { if (logger.isTraceEnabled()) { logger.trace("no CMP Profile method implementation to generate."); } return; } for (GetProfileCMPMethodDescriptor cmpProfile : cmpProfiles) { String methodName = cmpProfile.getProfileCmpMethodName(); CtMethod method = (CtMethod) abstractMethods.get(methodName); if (method == null) method = (CtMethod) superClassesAbstractMethods.get(methodName); if (method != null) try { // copy method from abstract to concrete class CtMethod concreteMethod = CtNewMethod.copy(method, sbbConcreteClass, null); // create the method body String concreteMethodBody = "{ return " + SbbAbstractMethodHandler.class.getName() + ".getProfileCMPMethod(sbbEntity,\"" + methodName + "\",$1); }"; if (logger.isTraceEnabled()) { logger.trace("Generated method " + methodName + " , body = " + concreteMethodBody); } concreteMethod.setBody(concreteMethodBody); sbbConcreteClass.addMethod(concreteMethod); } catch (CannotCompileException cce) { throw new SLEEException("Cannot compile method " + method.getName(), cce); } } } }
public class class_name { protected void createGetProfileCMPMethods( Collection<GetProfileCMPMethodDescriptor> cmpProfiles) { if (cmpProfiles == null) { if (logger.isTraceEnabled()) { logger.trace("no CMP Profile method implementation to generate."); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } for (GetProfileCMPMethodDescriptor cmpProfile : cmpProfiles) { String methodName = cmpProfile.getProfileCmpMethodName(); CtMethod method = (CtMethod) abstractMethods.get(methodName); if (method == null) method = (CtMethod) superClassesAbstractMethods.get(methodName); if (method != null) try { // copy method from abstract to concrete class CtMethod concreteMethod = CtNewMethod.copy(method, sbbConcreteClass, null); // create the method body String concreteMethodBody = "{ return " + SbbAbstractMethodHandler.class.getName() + ".getProfileCMPMethod(sbbEntity,\"" + methodName + "\",$1); }"; if (logger.isTraceEnabled()) { logger.trace("Generated method " + methodName + " , body = " + concreteMethodBody); // depends on control dependency: [if], data = [none] } concreteMethod.setBody(concreteMethodBody); // depends on control dependency: [try], data = [none] sbbConcreteClass.addMethod(concreteMethod); // depends on control dependency: [try], data = [none] } catch (CannotCompileException cce) { throw new SLEEException("Cannot compile method " + method.getName(), cce); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void setSegVersion(int version) { if (version < 1) { log.warn("tried to change segment version for task " + this.jobName + " explicit, but no version given"); return; } // Wenn sich die Versionsnummer nicht geaendert hat, muessen wir die // Huehner ja nicht verrueckt machen ;) if (version == this.segVersion) return; log.info("changing segment version for task " + this.jobName + " explicit from " + this.segVersion + " to " + version); // Der alte Name String oldName = this.name; // Neuer Name und neue Versionsnummer this.segVersion = version; this.name = this.jobName + version; // Bereits gesetzte llParams fixen String[] names = this.llParams.keySet().toArray(new String[0]); for (String s : names) { if (!s.startsWith(oldName)) continue; // nicht betroffen // Alten Schluessel entfernen und neuen einfuegen String value = this.llParams.get(s); String newName = s.replaceFirst(oldName, this.name); this.llParams.remove(s); this.llParams.put(newName, value); } // Destination-Namen in den LowLevel-Parameter auf den neuen Namen umbiegen constraints.forEach((frontendName, values) -> { for (String[] value : values) { // value[0] ist das Target if (!value[0].startsWith(oldName)) continue; // Hier ersetzen wir z.Bsp. "TAN2Step5.process" gegen "TAN2Step3.process" value[0] = value[0].replaceFirst(oldName, this.name); } }); } }
public class class_name { public void setSegVersion(int version) { if (version < 1) { log.warn("tried to change segment version for task " + this.jobName + " explicit, but no version given"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // Wenn sich die Versionsnummer nicht geaendert hat, muessen wir die // Huehner ja nicht verrueckt machen ;) if (version == this.segVersion) return; log.info("changing segment version for task " + this.jobName + " explicit from " + this.segVersion + " to " + version); // Der alte Name String oldName = this.name; // Neuer Name und neue Versionsnummer this.segVersion = version; this.name = this.jobName + version; // Bereits gesetzte llParams fixen String[] names = this.llParams.keySet().toArray(new String[0]); for (String s : names) { if (!s.startsWith(oldName)) continue; // nicht betroffen // Alten Schluessel entfernen und neuen einfuegen String value = this.llParams.get(s); String newName = s.replaceFirst(oldName, this.name); this.llParams.remove(s); // depends on control dependency: [for], data = [s] this.llParams.put(newName, value); // depends on control dependency: [for], data = [s] } // Destination-Namen in den LowLevel-Parameter auf den neuen Namen umbiegen constraints.forEach((frontendName, values) -> { for (String[] value : values) { // value[0] ist das Target if (!value[0].startsWith(oldName)) continue; // Hier ersetzen wir z.Bsp. "TAN2Step5.process" gegen "TAN2Step3.process" value[0] = value[0].replaceFirst(oldName, this.name); // depends on control dependency: [for], data = [value] } }); } }
public class class_name { public static void close(final AutoCloseable closeable) { try { if (null != closeable) { closeable.close(); } } catch (final Exception e) { LangUtil.rethrowUnchecked(e); } } }
public class class_name { public static void close(final AutoCloseable closeable) { try { if (null != closeable) { closeable.close(); // depends on control dependency: [if], data = [none] } } catch (final Exception e) { LangUtil.rethrowUnchecked(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(S3Location s3Location, ProtocolMarshaller protocolMarshaller) { if (s3Location == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(s3Location.getBucket(), BUCKET_BINDING); protocolMarshaller.marshall(s3Location.getKey(), KEY_BINDING); protocolMarshaller.marshall(s3Location.getRoleArn(), ROLEARN_BINDING); protocolMarshaller.marshall(s3Location.getObjectVersion(), OBJECTVERSION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(S3Location s3Location, ProtocolMarshaller protocolMarshaller) { if (s3Location == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(s3Location.getBucket(), BUCKET_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(s3Location.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(s3Location.getRoleArn(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(s3Location.getObjectVersion(), OBJECTVERSION_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 final void toLongestString(final List<Object> objects) { if (objects == null) { return; } int maxsize = 0; int tint = 0; String tmp; int stop = objects.size(); for (int i = 0; i < stop; i++) { StringUtil.arrayToString(objects.get(i)); tmp = (String) objects.get(i); tint = tmp.length(); if (tint > maxsize) { maxsize = tint; } objects.add(i, tmp); } // maximum size known. for (int i = 0; i < stop; i++) { objects.add(i, StringUtil.setSize((String) objects.remove(i), maxsize)); } } }
public class class_name { public static final void toLongestString(final List<Object> objects) { if (objects == null) { return; // depends on control dependency: [if], data = [none] } int maxsize = 0; int tint = 0; String tmp; int stop = objects.size(); for (int i = 0; i < stop; i++) { StringUtil.arrayToString(objects.get(i)); // depends on control dependency: [for], data = [i] tmp = (String) objects.get(i); // depends on control dependency: [for], data = [i] tint = tmp.length(); // depends on control dependency: [for], data = [none] if (tint > maxsize) { maxsize = tint; // depends on control dependency: [if], data = [none] } objects.add(i, tmp); // depends on control dependency: [for], data = [i] } // maximum size known. for (int i = 0; i < stop; i++) { objects.add(i, StringUtil.setSize((String) objects.remove(i), maxsize)); // depends on control dependency: [for], data = [i] } } }
public class class_name { public void setAutomaticLayout(boolean enable) { if (enable) { this.setAutomaticLayout(AutomaticLayout.RankDirection.TopBottom, 300, 600, 200, false); } else { this.automaticLayout = null; } } }
public class class_name { public void setAutomaticLayout(boolean enable) { if (enable) { this.setAutomaticLayout(AutomaticLayout.RankDirection.TopBottom, 300, 600, 200, false); // depends on control dependency: [if], data = [none] } else { this.automaticLayout = null; // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean deserializeRequestCommand(RemotingContext ctx, RpcRequestCommand cmd, int level) { boolean result; try { cmd.deserialize(level); result = true; } catch (DeserializationException e) { logger .error( "DeserializationException occurred when process in RpcRequestProcessor, id={}, deserializeLevel={}", cmd.getId(), RpcDeserializeLevel.valueOf(level), e); sendResponseIfNecessary(ctx, cmd.getType(), this.getCommandFactory() .createExceptionResponse(cmd.getId(), ResponseStatus.SERVER_DESERIAL_EXCEPTION, e)); result = false; } catch (Throwable t) { String errMsg = "Deserialize RpcRequestCommand failed in RpcRequestProcessor, id=" + cmd.getId() + ", deserializeLevel=" + level; logger.error(errMsg, t); sendResponseIfNecessary(ctx, cmd.getType(), this.getCommandFactory() .createExceptionResponse(cmd.getId(), t, errMsg)); result = false; } return result; } }
public class class_name { private boolean deserializeRequestCommand(RemotingContext ctx, RpcRequestCommand cmd, int level) { boolean result; try { cmd.deserialize(level); // depends on control dependency: [try], data = [none] result = true; // depends on control dependency: [try], data = [none] } catch (DeserializationException e) { logger .error( "DeserializationException occurred when process in RpcRequestProcessor, id={}, deserializeLevel={}", cmd.getId(), RpcDeserializeLevel.valueOf(level), e); sendResponseIfNecessary(ctx, cmd.getType(), this.getCommandFactory() .createExceptionResponse(cmd.getId(), ResponseStatus.SERVER_DESERIAL_EXCEPTION, e)); result = false; } catch (Throwable t) { // depends on control dependency: [catch], data = [none] String errMsg = "Deserialize RpcRequestCommand failed in RpcRequestProcessor, id=" + cmd.getId() + ", deserializeLevel=" + level; logger.error(errMsg, t); sendResponseIfNecessary(ctx, cmd.getType(), this.getCommandFactory() .createExceptionResponse(cmd.getId(), t, errMsg)); result = false; } // depends on control dependency: [catch], data = [none] return result; } }
public class class_name { @Override public void stopRecording() { super.stopRecording(); mSentBroadcastLiveEvent = false; if (mStream != null) { if (VERBOSE) Log.i(TAG, "Stopping Stream"); mKickflip.stopStream(mStream, new KickflipCallback() { @Override public void onSuccess(Response response) { if (VERBOSE) Log.i(TAG, "Got stop stream response " + response); } @Override public void onError(KickflipException error) { Log.w(TAG, "Error getting stop stream response! " + error); } }); } } }
public class class_name { @Override public void stopRecording() { super.stopRecording(); mSentBroadcastLiveEvent = false; if (mStream != null) { if (VERBOSE) Log.i(TAG, "Stopping Stream"); mKickflip.stopStream(mStream, new KickflipCallback() { @Override public void onSuccess(Response response) { if (VERBOSE) Log.i(TAG, "Got stop stream response " + response); } @Override public void onError(KickflipException error) { Log.w(TAG, "Error getting stop stream response! " + error); } }); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Observable<ServiceResponseWithHeaders<OutputInner, OutputsCreateOrReplaceHeaders>> createOrReplaceWithServiceResponseAsync(String resourceGroupName, String jobName, String outputName, OutputInner output, String ifMatch, String ifNoneMatch) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (jobName == null) { throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); } if (outputName == null) { throw new IllegalArgumentException("Parameter outputName is required and cannot be null."); } if (output == null) { throw new IllegalArgumentException("Parameter output is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(output); return service.createOrReplace(this.client.subscriptionId(), resourceGroupName, jobName, outputName, output, ifMatch, ifNoneMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<OutputInner, OutputsCreateOrReplaceHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<OutputInner, OutputsCreateOrReplaceHeaders>> call(Response<ResponseBody> response) { try { ServiceResponseWithHeaders<OutputInner, OutputsCreateOrReplaceHeaders> clientResponse = createOrReplaceDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponseWithHeaders<OutputInner, OutputsCreateOrReplaceHeaders>> createOrReplaceWithServiceResponseAsync(String resourceGroupName, String jobName, String outputName, OutputInner output, String ifMatch, String ifNoneMatch) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (jobName == null) { throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); } if (outputName == null) { throw new IllegalArgumentException("Parameter outputName is required and cannot be null."); } if (output == null) { throw new IllegalArgumentException("Parameter output is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(output); return service.createOrReplace(this.client.subscriptionId(), resourceGroupName, jobName, outputName, output, ifMatch, ifNoneMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<OutputInner, OutputsCreateOrReplaceHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<OutputInner, OutputsCreateOrReplaceHeaders>> call(Response<ResponseBody> response) { try { ServiceResponseWithHeaders<OutputInner, OutputsCreateOrReplaceHeaders> clientResponse = createOrReplaceDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public Set<HierarchicalProperty> getProperties(boolean namesOnly) throws RepositoryException { Set<HierarchicalProperty> props = new HashSet<HierarchicalProperty>(); Iterator<QName> propIter = PRESET_PROP.iterator(); while (propIter.hasNext()) { QName propertyName = propIter.next(); try { props.add(namesOnly ? new HierarchicalProperty(propertyName) : getProperty(propertyName)); } catch (Exception exc) { if (LOG.isTraceEnabled()) { LOG.trace("An exception occurred: " + exc.getMessage()); } } } return props; } }
public class class_name { public Set<HierarchicalProperty> getProperties(boolean namesOnly) throws RepositoryException { Set<HierarchicalProperty> props = new HashSet<HierarchicalProperty>(); Iterator<QName> propIter = PRESET_PROP.iterator(); while (propIter.hasNext()) { QName propertyName = propIter.next(); try { props.add(namesOnly ? new HierarchicalProperty(propertyName) : getProperty(propertyName)); } catch (Exception exc) { if (LOG.isTraceEnabled()) { LOG.trace("An exception occurred: " + exc.getMessage()); // depends on control dependency: [if], data = [none] } } } return props; } }
public class class_name { public void parse(final TagVisitor visitor) { tag.init(config.caseSensitive); this.parsingTime = System.currentTimeMillis(); this.visitor = visitor; visitor.start(); parsing = true; while (parsing) { state.parse(); } emitText(); visitor.end(); this.parsingTime = System.currentTimeMillis() - parsingTime; } }
public class class_name { public void parse(final TagVisitor visitor) { tag.init(config.caseSensitive); this.parsingTime = System.currentTimeMillis(); this.visitor = visitor; visitor.start(); parsing = true; while (parsing) { state.parse(); // depends on control dependency: [while], data = [none] } emitText(); visitor.end(); this.parsingTime = System.currentTimeMillis() - parsingTime; } }
public class class_name { @Override public EClass getPluginBundleVersion() { if (pluginBundleVersionEClass == null) { pluginBundleVersionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(103); } return pluginBundleVersionEClass; } }
public class class_name { @Override public EClass getPluginBundleVersion() { if (pluginBundleVersionEClass == null) { pluginBundleVersionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(103); // depends on control dependency: [if], data = [none] } return pluginBundleVersionEClass; } }
public class class_name { public int execute() { loadTimestampFile(); String scriptPathes = System.getProperty(SYSPROP_TESTS_SCRIPT_PATH); if (StringUtils.isNotEmpty(scriptPathes)) { for (String path : scriptPathes.split(",")) { generate(new File(path), "."); } } else { for (String testScriptDir : testScriptDirs.split(",")) { File testScriptDirF = new File(testScriptDir); if (!testScriptDirF.exists()) { continue; } log.info("test.script", testScriptDirF.getAbsolutePath()); for (File scriptFile : FileUtils.listFiles(testScriptDirF, new String[] { "csv" }, true)) { generate(scriptFile, testScriptDir); } } } storeTimestampFile(); return 0; } }
public class class_name { public int execute() { loadTimestampFile(); String scriptPathes = System.getProperty(SYSPROP_TESTS_SCRIPT_PATH); if (StringUtils.isNotEmpty(scriptPathes)) { for (String path : scriptPathes.split(",")) { generate(new File(path), "."); // depends on control dependency: [for], data = [path] } } else { for (String testScriptDir : testScriptDirs.split(",")) { File testScriptDirF = new File(testScriptDir); if (!testScriptDirF.exists()) { continue; } log.info("test.script", testScriptDirF.getAbsolutePath()); // depends on control dependency: [for], data = [testScriptDir] for (File scriptFile : FileUtils.listFiles(testScriptDirF, new String[] { "csv" }, true)) { generate(scriptFile, testScriptDir); // depends on control dependency: [for], data = [scriptFile] } } } storeTimestampFile(); return 0; } }
public class class_name { private void render(List<T> data) { List<Widget> widgets = new ArrayList<>(); for (T model : data) { Widget widget = renderer.render(model); widget.getElement().setId("item-" + itemCount); add(widget); widgets.add(widget); itemCount++; } // Check if recycling is enabled if (isEnableRecycling()) { recycleManager.recycleWidgets(widgets); } // Will force the scroll panel to have a scroll if it isn't visible if (!hasScrollBar()) { int height = $(widgets.get(0).getElement()).outerHeight(); getElement().getStyle().setHeight(height, Style.Unit.PX); } } }
public class class_name { private void render(List<T> data) { List<Widget> widgets = new ArrayList<>(); for (T model : data) { Widget widget = renderer.render(model); widget.getElement().setId("item-" + itemCount); // depends on control dependency: [for], data = [none] add(widget); // depends on control dependency: [for], data = [none] widgets.add(widget); // depends on control dependency: [for], data = [none] itemCount++; // depends on control dependency: [for], data = [none] } // Check if recycling is enabled if (isEnableRecycling()) { recycleManager.recycleWidgets(widgets); // depends on control dependency: [if], data = [none] } // Will force the scroll panel to have a scroll if it isn't visible if (!hasScrollBar()) { int height = $(widgets.get(0).getElement()).outerHeight(); getElement().getStyle().setHeight(height, Style.Unit.PX); // depends on control dependency: [if], data = [none] } } }
public class class_name { public final AutoBuffer writeJSON_impl(AutoBuffer ab) { boolean isOut = direction == API.Direction.OUTPUT; ab.putJSONStr("name", name); ab.put1(','); ab.putJSONStr("type", type); ab.put1(','); ab.putJSONStrUnquoted("is_schema", is_schema ? "true" : "false"); ab.put1(','); ab.putJSONStr("schema_name", schema_name); ab.put1(','); if (value instanceof IcedWrapper) { ab.putJSONStr("value").put1(':'); ((IcedWrapper) value).writeUnwrappedJSON(ab); ab.put1(','); } else { ab.putJSONStr("value").put1(':').putJSON(value); ab.put1(','); } ab.putJSONStr("help", help); ab.put1(','); ab.putJSONStr("label", label); ab.put1(','); ab.putJSONStrUnquoted("required", isOut? "null" : required ? "true" : "false"); ab.put1(','); ab.putJSONStr("level", level.toString()); ab.put1(','); ab.putJSONStr("direction", direction.toString()); ab.put1(','); ab.putJSONStrUnquoted("is_inherited", is_inherited ? "true" : "false"); ab.put1(','); ab.putJSONStr("inherited_from", inherited_from); ab.put1(','); ab.putJSONStrUnquoted("is_gridable", isOut? "null" : is_gridable ? "true" : "false"); ab.put1(','); ab.putJSONAStr("values", values); ab.put1(','); ab.putJSONStrUnquoted("json", json ? "true" : "false"); ab.put1(','); ab.putJSONAStr("is_member_of_frames", is_member_of_frames); ab.put1(','); ab.putJSONAStr("is_mutually_exclusive_with", is_mutually_exclusive_with); return ab; } }
public class class_name { public final AutoBuffer writeJSON_impl(AutoBuffer ab) { boolean isOut = direction == API.Direction.OUTPUT; ab.putJSONStr("name", name); ab.put1(','); ab.putJSONStr("type", type); ab.put1(','); ab.putJSONStrUnquoted("is_schema", is_schema ? "true" : "false"); ab.put1(','); ab.putJSONStr("schema_name", schema_name); ab.put1(','); if (value instanceof IcedWrapper) { ab.putJSONStr("value").put1(':'); // depends on control dependency: [if], data = [none] ((IcedWrapper) value).writeUnwrappedJSON(ab); ab.put1(','); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } else { ab.putJSONStr("value").put1(':').putJSON(value); ab.put1(','); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } ab.putJSONStr("help", help); ab.put1(','); ab.putJSONStr("label", label); ab.put1(','); ab.putJSONStrUnquoted("required", isOut? "null" : required ? "true" : "false"); ab.put1(','); ab.putJSONStr("level", level.toString()); ab.put1(','); ab.putJSONStr("direction", direction.toString()); ab.put1(','); ab.putJSONStrUnquoted("is_inherited", is_inherited ? "true" : "false"); ab.put1(','); ab.putJSONStr("inherited_from", inherited_from); ab.put1(','); ab.putJSONStrUnquoted("is_gridable", isOut? "null" : is_gridable ? "true" : "false"); ab.put1(','); ab.putJSONAStr("values", values); ab.put1(','); ab.putJSONStrUnquoted("json", json ? "true" : "false"); ab.put1(','); ab.putJSONAStr("is_member_of_frames", is_member_of_frames); ab.put1(','); ab.putJSONAStr("is_mutually_exclusive_with", is_mutually_exclusive_with); return ab; } }
public class class_name { public static Object waitForJavascriptCallback(JavascriptExecutor jse, String statementPattern, Object... parameters) { Object result; String script = "var callback = arguments[arguments.length - 1];" + String.format(statementPattern, parameters); if (statementPattern.contains("arguments")) { result = jse.executeAsyncScript(script, parameters); } else { result = jse.executeAsyncScript(script); } return result; } }
public class class_name { public static Object waitForJavascriptCallback(JavascriptExecutor jse, String statementPattern, Object... parameters) { Object result; String script = "var callback = arguments[arguments.length - 1];" + String.format(statementPattern, parameters); if (statementPattern.contains("arguments")) { result = jse.executeAsyncScript(script, parameters); // depends on control dependency: [if], data = [none] } else { result = jse.executeAsyncScript(script); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public static double quickRatio(final String paramFirst, final String paramSecond) { if (paramFirst == null || paramSecond == null) { return 1; } double matches = 0; // Use a sparse array to reduce the memory usage // for unicode characters. final int x[][] = new int[256][]; for (char c : paramSecond.toCharArray()) { if (x[c >> 8] == null) { x[c >> 8] = new int[256]; } x[c >> 8][c & 0xFF]++; } for (char c : paramFirst.toCharArray()) { final int n = (x[c >> 8] == null) ? 0 : x[c >> 8][c & 0xFF]--; if (n > 0) { matches++; } } return 2.0 * matches / (paramFirst.length() + paramSecond.length()); } }
public class class_name { public static double quickRatio(final String paramFirst, final String paramSecond) { if (paramFirst == null || paramSecond == null) { return 1; // depends on control dependency: [if], data = [none] } double matches = 0; // Use a sparse array to reduce the memory usage // for unicode characters. final int x[][] = new int[256][]; for (char c : paramSecond.toCharArray()) { if (x[c >> 8] == null) { x[c >> 8] = new int[256]; // depends on control dependency: [if], data = [none] } x[c >> 8][c & 0xFF]++; // depends on control dependency: [for], data = [c] } for (char c : paramFirst.toCharArray()) { final int n = (x[c >> 8] == null) ? 0 : x[c >> 8][c & 0xFF]--; if (n > 0) { matches++; // depends on control dependency: [if], data = [none] } } return 2.0 * matches / (paramFirst.length() + paramSecond.length()); } }
public class class_name { @Override public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException, IOException { final String sourceMethod = "unregisterMBean"; checkConnection(); if (name == null) throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); else if (name.isPattern()) throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); URL mbeanURL = null; HttpsURLConnection connection = null; try { // Get URL for MBean mbeanURL = getMBeanURL(name); // Get connection to server connection = getConnection(mbeanURL, HttpMethod.DELETE); } catch (IOException io) { throw getRequestErrorException(sourceMethod, io, mbeanURL); } // Check response code from server int responseCode = 0; try { responseCode = connection.getResponseCode(); } catch (ConnectException ce) { recoverConnection(ce); // Server is down; not a client bug throw ce; } switch (responseCode) { case HttpURLConnection.HTTP_NO_CONTENT: // Clean up cached URLs purgeMBeanURLs(name); return; case HttpURLConnection.HTTP_BAD_REQUEST: case HttpURLConnection.HTTP_INTERNAL_ERROR: try { // Server response should be a serialized Throwable throw getServerThrowable(sourceMethod, connection); } catch (MBeanRegistrationException mbr) { throw mbr; } catch (InstanceNotFoundException inf) { throw inf; } catch (IOException io) { throw io; } catch (Throwable t) { throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); } case HttpURLConnection.HTTP_UNAUTHORIZED: case HttpURLConnection.HTTP_FORBIDDEN: throw getBadCredentialsException(responseCode, connection); case HttpURLConnection.HTTP_GONE: case HttpURLConnection.HTTP_NOT_FOUND: IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); recoverConnection(ioe); throw ioe; default: throw getResponseCodeErrorException(sourceMethod, responseCode, connection); } } }
public class class_name { @Override public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException, IOException { final String sourceMethod = "unregisterMBean"; checkConnection(); if (name == null) throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); else if (name.isPattern()) throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); URL mbeanURL = null; HttpsURLConnection connection = null; try { // Get URL for MBean mbeanURL = getMBeanURL(name); // Get connection to server connection = getConnection(mbeanURL, HttpMethod.DELETE); } catch (IOException io) { throw getRequestErrorException(sourceMethod, io, mbeanURL); } // Check response code from server int responseCode = 0; try { responseCode = connection.getResponseCode(); } catch (ConnectException ce) { recoverConnection(ce); // Server is down; not a client bug throw ce; } switch (responseCode) { case HttpURLConnection.HTTP_NO_CONTENT: // Clean up cached URLs purgeMBeanURLs(name); return; case HttpURLConnection.HTTP_BAD_REQUEST: case HttpURLConnection.HTTP_INTERNAL_ERROR: try { // Server response should be a serialized Throwable throw getServerThrowable(sourceMethod, connection); } catch (MBeanRegistrationException mbr) { throw mbr; } catch (InstanceNotFoundException inf) { // depends on control dependency: [catch], data = [none] throw inf; } catch (IOException io) { // depends on control dependency: [catch], data = [none] throw io; } catch (Throwable t) { // depends on control dependency: [catch], data = [none] throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); } // depends on control dependency: [catch], data = [none] case HttpURLConnection.HTTP_UNAUTHORIZED: case HttpURLConnection.HTTP_FORBIDDEN: throw getBadCredentialsException(responseCode, connection); case HttpURLConnection.HTTP_GONE: case HttpURLConnection.HTTP_NOT_FOUND: IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); recoverConnection(ioe); throw ioe; default: throw getResponseCodeErrorException(sourceMethod, responseCode, connection); } } }
public class class_name { public String getTags() { Set<String> setOfTags = getTagsAsSet(); if (setOfTags.isEmpty()) { return ""; } StringBuilder buf = new StringBuilder(); for (String tag : setOfTags) { buf.append(tag); buf.append(","); } String tagsAsString = buf.toString(); return tagsAsString.substring(0, tagsAsString.length()-1); } }
public class class_name { public String getTags() { Set<String> setOfTags = getTagsAsSet(); if (setOfTags.isEmpty()) { return ""; // depends on control dependency: [if], data = [none] } StringBuilder buf = new StringBuilder(); for (String tag : setOfTags) { buf.append(tag); // depends on control dependency: [for], data = [tag] buf.append(","); // depends on control dependency: [for], data = [none] } String tagsAsString = buf.toString(); return tagsAsString.substring(0, tagsAsString.length()-1); } }
public class class_name { public void setUnsuccessfulFleetRequests(java.util.Collection<CancelSpotFleetRequestsErrorItem> unsuccessfulFleetRequests) { if (unsuccessfulFleetRequests == null) { this.unsuccessfulFleetRequests = null; return; } this.unsuccessfulFleetRequests = new com.amazonaws.internal.SdkInternalList<CancelSpotFleetRequestsErrorItem>(unsuccessfulFleetRequests); } }
public class class_name { public void setUnsuccessfulFleetRequests(java.util.Collection<CancelSpotFleetRequestsErrorItem> unsuccessfulFleetRequests) { if (unsuccessfulFleetRequests == null) { this.unsuccessfulFleetRequests = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.unsuccessfulFleetRequests = new com.amazonaws.internal.SdkInternalList<CancelSpotFleetRequestsErrorItem>(unsuccessfulFleetRequests); } }
public class class_name { @Pure public DoubleProperty x2Property() { if (this.p2.x == null) { this.p2.x = new SimpleDoubleProperty(this, MathFXAttributeNames.X2); } return this.p2.x; } }
public class class_name { @Pure public DoubleProperty x2Property() { if (this.p2.x == null) { this.p2.x = new SimpleDoubleProperty(this, MathFXAttributeNames.X2); // depends on control dependency: [if], data = [none] } return this.p2.x; } }
public class class_name { @Override public String[] getjavaVMs() { final String methodName = "getjavaVMs"; final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(tc, methodName, this); ArrayList<String> jvmArrayList = new ArrayList<String>(); ObjectName obnToFind = null;//WebSphere:name=JVM,J2EEServer=com.ibm.ws.jca.jdbc.mbean.fat,j2eeType=JVM final String obnStr = "WebSphere:j2eeType=JVM,*"; final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { obnToFind = new ObjectName(obnStr); } catch (MalformedObjectNameException e) { //Should never happen because we are building the ObjectName without any user input if (trace && tc.isDebugEnabled()) Tr.debug(tc, "Unable to create ObjectName with the string: " + obnStr, e); } Set<ObjectInstance> matchingMbeanList = mbs.queryMBeans(obnToFind, null); if (matchingMbeanList.size() == 0) { if (trace && tc.isDebugEnabled()) Tr.debug(tc, methodName + ": matchingMbeanList.size(): " + matchingMbeanList.size() + ", We didn't find any Mbean matching: " + obnStr); if (trace && tc.isEntryEnabled()) Tr.exit(tc, methodName, this); return null; } else { for (ObjectInstance bean : matchingMbeanList) { if (trace && tc.isDebugEnabled()) Tr.debug(tc, "** Found a matching MBean: " + bean.getObjectName().toString()); jvmArrayList.add(bean.getObjectName().toString()); } } if (trace && tc.isEntryEnabled()) Tr.exit(tc, methodName, this); return jvmArrayList.toArray(new String[jvmArrayList.size()]); } }
public class class_name { @Override public String[] getjavaVMs() { final String methodName = "getjavaVMs"; final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(tc, methodName, this); ArrayList<String> jvmArrayList = new ArrayList<String>(); ObjectName obnToFind = null;//WebSphere:name=JVM,J2EEServer=com.ibm.ws.jca.jdbc.mbean.fat,j2eeType=JVM final String obnStr = "WebSphere:j2eeType=JVM,*"; final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { obnToFind = new ObjectName(obnStr); // depends on control dependency: [try], data = [none] } catch (MalformedObjectNameException e) { //Should never happen because we are building the ObjectName without any user input if (trace && tc.isDebugEnabled()) Tr.debug(tc, "Unable to create ObjectName with the string: " + obnStr, e); } // depends on control dependency: [catch], data = [none] Set<ObjectInstance> matchingMbeanList = mbs.queryMBeans(obnToFind, null); if (matchingMbeanList.size() == 0) { if (trace && tc.isDebugEnabled()) Tr.debug(tc, methodName + ": matchingMbeanList.size(): " + matchingMbeanList.size() + ", We didn't find any Mbean matching: " + obnStr); if (trace && tc.isEntryEnabled()) Tr.exit(tc, methodName, this); return null; // depends on control dependency: [if], data = [none] } else { for (ObjectInstance bean : matchingMbeanList) { if (trace && tc.isDebugEnabled()) Tr.debug(tc, "** Found a matching MBean: " + bean.getObjectName().toString()); jvmArrayList.add(bean.getObjectName().toString()); // depends on control dependency: [for], data = [bean] } } if (trace && tc.isEntryEnabled()) Tr.exit(tc, methodName, this); return jvmArrayList.toArray(new String[jvmArrayList.size()]); } }
public class class_name { public com.google.cloud.datalabeling.v1beta1.BoundingPolyOrBuilder getBoundingPolyOrBuilder() { if (boundedAreaCase_ == 2) { return (com.google.cloud.datalabeling.v1beta1.BoundingPoly) boundedArea_; } return com.google.cloud.datalabeling.v1beta1.BoundingPoly.getDefaultInstance(); } }
public class class_name { public com.google.cloud.datalabeling.v1beta1.BoundingPolyOrBuilder getBoundingPolyOrBuilder() { if (boundedAreaCase_ == 2) { return (com.google.cloud.datalabeling.v1beta1.BoundingPoly) boundedArea_; // depends on control dependency: [if], data = [none] } return com.google.cloud.datalabeling.v1beta1.BoundingPoly.getDefaultInstance(); } }
public class class_name { public static void transferValues( CmsEntity original, CmsEntity target, List<String> transferAttributes, Map<String, CmsType> entityTypes, Map<String, CmsAttributeConfiguration> attributeConfigurations, boolean considerDefaults) { CmsType entityType = entityTypes.get(target.getTypeName()); for (String attributeName : entityType.getAttributeNames()) { CmsType attributeType = entityTypes.get(entityType.getAttributeTypeName(attributeName)); if (transferAttributes.contains(attributeName)) { target.removeAttribute(attributeName); CmsEntityAttribute attribute = original != null ? original.getAttribute(attributeName) : null; if (attribute != null) { if (attributeType.isSimpleType()) { for (String value : attribute.getSimpleValues()) { target.addAttributeValue(attributeName, value); } if (considerDefaults) { for (int i = attribute.getValueCount(); i < entityType.getAttributeMinOccurrence( attributeName); i++) { target.addAttributeValue( attributeName, attributeConfigurations.get(attributeName).getDefaultValue()); } } } else { for (CmsEntity value : attribute.getComplexValues()) { target.addAttributeValue(attributeName, value); } if (considerDefaults) { for (int i = attribute.getValueCount(); i < entityType.getAttributeMinOccurrence( attributeName); i++) { target.addAttributeValue( attributeName, createDefaultValueEntity(attributeType, entityTypes, attributeConfigurations)); } } } } else if (considerDefaults) { for (int i = 0; i < entityType.getAttributeMinOccurrence(attributeName); i++) { if (attributeType.isSimpleType()) { target.addAttributeValue( attributeName, attributeConfigurations.get(attributeName).getDefaultValue()); } else { target.addAttributeValue( attributeName, createDefaultValueEntity(attributeType, entityTypes, attributeConfigurations)); } } } } else { if (!attributeType.isSimpleType()) { CmsEntityAttribute targetAttribute = target.getAttribute(attributeName); CmsEntityAttribute originalAttribute = original != null ? original.getAttribute(attributeName) : null; if (targetAttribute != null) { for (int i = 0; i < targetAttribute.getComplexValues().size(); i++) { CmsEntity subTarget = targetAttribute.getComplexValues().get(i); CmsEntity subOriginal = (originalAttribute != null) && (originalAttribute.getComplexValues().size() > i) ? originalAttribute.getComplexValues().get(i) : null; transferValues( subOriginal, subTarget, transferAttributes, entityTypes, attributeConfigurations, considerDefaults); } } } } } } }
public class class_name { public static void transferValues( CmsEntity original, CmsEntity target, List<String> transferAttributes, Map<String, CmsType> entityTypes, Map<String, CmsAttributeConfiguration> attributeConfigurations, boolean considerDefaults) { CmsType entityType = entityTypes.get(target.getTypeName()); for (String attributeName : entityType.getAttributeNames()) { CmsType attributeType = entityTypes.get(entityType.getAttributeTypeName(attributeName)); if (transferAttributes.contains(attributeName)) { target.removeAttribute(attributeName); // depends on control dependency: [if], data = [none] CmsEntityAttribute attribute = original != null ? original.getAttribute(attributeName) : null; if (attribute != null) { if (attributeType.isSimpleType()) { for (String value : attribute.getSimpleValues()) { target.addAttributeValue(attributeName, value); // depends on control dependency: [for], data = [value] } if (considerDefaults) { for (int i = attribute.getValueCount(); i < entityType.getAttributeMinOccurrence( attributeName); i++) { target.addAttributeValue( attributeName, attributeConfigurations.get(attributeName).getDefaultValue()); // depends on control dependency: [for], data = [none] } } } else { for (CmsEntity value : attribute.getComplexValues()) { target.addAttributeValue(attributeName, value); // depends on control dependency: [for], data = [value] } if (considerDefaults) { for (int i = attribute.getValueCount(); i < entityType.getAttributeMinOccurrence( attributeName); i++) { target.addAttributeValue( attributeName, createDefaultValueEntity(attributeType, entityTypes, attributeConfigurations)); // depends on control dependency: [for], data = [none] } } } } else if (considerDefaults) { for (int i = 0; i < entityType.getAttributeMinOccurrence(attributeName); i++) { if (attributeType.isSimpleType()) { target.addAttributeValue( attributeName, attributeConfigurations.get(attributeName).getDefaultValue()); // depends on control dependency: [if], data = [none] } else { target.addAttributeValue( attributeName, createDefaultValueEntity(attributeType, entityTypes, attributeConfigurations)); // depends on control dependency: [if], data = [none] } } } } else { if (!attributeType.isSimpleType()) { CmsEntityAttribute targetAttribute = target.getAttribute(attributeName); CmsEntityAttribute originalAttribute = original != null ? original.getAttribute(attributeName) : null; if (targetAttribute != null) { for (int i = 0; i < targetAttribute.getComplexValues().size(); i++) { CmsEntity subTarget = targetAttribute.getComplexValues().get(i); CmsEntity subOriginal = (originalAttribute != null) && (originalAttribute.getComplexValues().size() > i) ? originalAttribute.getComplexValues().get(i) : null; transferValues( subOriginal, subTarget, transferAttributes, entityTypes, attributeConfigurations, considerDefaults); // depends on control dependency: [for], data = [none] } } } } } } }
public class class_name { public short nextShort(int radix) { // Check cached result if ((typeCache != null) && (typeCache instanceof Short) && this.radix == radix) { short val = ((Short)typeCache).shortValue(); useTypeCache(); return val; } setRadix(radix); clearCaches(); // Search for next short try { String s = next(integerPattern()); if (matcher.group(SIMPLE_GROUP_INDEX) == null) s = processIntegerToken(s); return Short.parseShort(s, radix); } catch (NumberFormatException nfe) { position = matcher.start(); // don't skip bad token throw new InputMismatchException(nfe.getMessage()); } } }
public class class_name { public short nextShort(int radix) { // Check cached result if ((typeCache != null) && (typeCache instanceof Short) && this.radix == radix) { short val = ((Short)typeCache).shortValue(); useTypeCache(); // depends on control dependency: [if], data = [none] return val; // depends on control dependency: [if], data = [none] } setRadix(radix); clearCaches(); // Search for next short try { String s = next(integerPattern()); if (matcher.group(SIMPLE_GROUP_INDEX) == null) s = processIntegerToken(s); return Short.parseShort(s, radix); // depends on control dependency: [try], data = [none] } catch (NumberFormatException nfe) { position = matcher.start(); // don't skip bad token throw new InputMismatchException(nfe.getMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Iterator iterator() { return new Iterator() { private LeftTupleSinkNode currentNode = null; private LeftTupleSinkNode nextNode = getFirst(); public boolean hasNext() { return (this.nextNode != null); } public Object next() { this.currentNode = this.nextNode; if ( this.currentNode != null ) { this.nextNode = this.currentNode.getNextLeftTupleSinkNode(); } else { throw new NoSuchElementException( "No more elements to return" ); } return this.currentNode; } public void remove() { if ( this.currentNode != null ) { LeftTupleSinkNodeList.this.remove( this.currentNode ); this.currentNode = null; } else { throw new IllegalStateException( "No item to remove. Call next() before calling remove()." ); } } }; } }
public class class_name { public Iterator iterator() { return new Iterator() { private LeftTupleSinkNode currentNode = null; private LeftTupleSinkNode nextNode = getFirst(); public boolean hasNext() { return (this.nextNode != null); } public Object next() { this.currentNode = this.nextNode; if ( this.currentNode != null ) { this.nextNode = this.currentNode.getNextLeftTupleSinkNode(); // depends on control dependency: [if], data = [none] } else { throw new NoSuchElementException( "No more elements to return" ); } return this.currentNode; } public void remove() { if ( this.currentNode != null ) { LeftTupleSinkNodeList.this.remove( this.currentNode ); // depends on control dependency: [if], data = [( this.currentNode] this.currentNode = null; // depends on control dependency: [if], data = [none] } else { throw new IllegalStateException( "No item to remove. Call next() before calling remove()." ); } } }; } }
public class class_name { public short[] interpolate(int oldSampleRate, int newSampleRate, short[] samples) { if (oldSampleRate == newSampleRate) { return samples; } int newLength = Math.round(((float) samples.length / oldSampleRate * newSampleRate)); float lengthMultiplier = (float) newLength / samples.length; short[] interpolatedSamples = new short[newLength]; // interpolate the value by the linear equation y=mx+c for (int i = 0; i < newLength; i++) { // get the nearest positions for the interpolated point float currentPosition = i / lengthMultiplier; int nearestLeftPosition = (int) currentPosition; int nearestRightPosition = nearestLeftPosition + 1; if (nearestRightPosition >= samples.length) { nearestRightPosition = samples.length - 1; } float slope = samples[nearestRightPosition] - samples[nearestLeftPosition]; // delta x is 1 float positionFromLeft = currentPosition - nearestLeftPosition; interpolatedSamples[i] = (short) (slope * positionFromLeft + samples[nearestLeftPosition]); // y=mx+c } return interpolatedSamples; } }
public class class_name { public short[] interpolate(int oldSampleRate, int newSampleRate, short[] samples) { if (oldSampleRate == newSampleRate) { return samples; // depends on control dependency: [if], data = [none] } int newLength = Math.round(((float) samples.length / oldSampleRate * newSampleRate)); float lengthMultiplier = (float) newLength / samples.length; short[] interpolatedSamples = new short[newLength]; // interpolate the value by the linear equation y=mx+c for (int i = 0; i < newLength; i++) { // get the nearest positions for the interpolated point float currentPosition = i / lengthMultiplier; int nearestLeftPosition = (int) currentPosition; int nearestRightPosition = nearestLeftPosition + 1; if (nearestRightPosition >= samples.length) { nearestRightPosition = samples.length - 1; // depends on control dependency: [if], data = [none] } float slope = samples[nearestRightPosition] - samples[nearestLeftPosition]; // delta x is 1 float positionFromLeft = currentPosition - nearestLeftPosition; interpolatedSamples[i] = (short) (slope * positionFromLeft + samples[nearestLeftPosition]); // y=mx+c // depends on control dependency: [for], data = [i] } return interpolatedSamples; } }
public class class_name { @SuppressWarnings("unchecked") public <T> T convert(Object value, Class<T> toType) { for (ConverterDescriptor descriptor : getRegistry().keySet()) { Converter converter = descriptor.getConverter(); if (converter.canConvert(value, toType)) { if (descriptor.isExactConversion(toType)) { return toType.cast(converter.convert(value)); } else { return toType.cast(converter.convert(value, toType)); } } } throw newConversionException("Cannot convert [%1$s] into Object of type [%2$s]", value, toType.getName()); } }
public class class_name { @SuppressWarnings("unchecked") public <T> T convert(Object value, Class<T> toType) { for (ConverterDescriptor descriptor : getRegistry().keySet()) { Converter converter = descriptor.getConverter(); if (converter.canConvert(value, toType)) { if (descriptor.isExactConversion(toType)) { return toType.cast(converter.convert(value)); // depends on control dependency: [if], data = [none] } else { return toType.cast(converter.convert(value, toType)); // depends on control dependency: [if], data = [none] } } } throw newConversionException("Cannot convert [%1$s] into Object of type [%2$s]", value, toType.getName()); } }
public class class_name { public ArgumentBuilder withNamedArgument(final String name, final String value) { // Check sanity Validate.notEmpty(name, "name"); // Only add a named argument if the value is non-empty. if (value != null && !value.trim().isEmpty()) { withNamedArgument(true, name, value.trim()); } // All done. return this; } }
public class class_name { public ArgumentBuilder withNamedArgument(final String name, final String value) { // Check sanity Validate.notEmpty(name, "name"); // Only add a named argument if the value is non-empty. if (value != null && !value.trim().isEmpty()) { withNamedArgument(true, name, value.trim()); // depends on control dependency: [if], data = [none] } // All done. return this; } }
public class class_name { private void select(String[] resultList, int resultIndex, List<String[]> result) { int resultLen = resultList.length; if (resultIndex >= resultLen) { // 全部选择完时,输出排列结果 result.add(Arrays.copyOf(resultList, resultList.length)); return; } // 递归选择下一个 for (int i = 0; i < datas.length; i++) { // 判断待选项是否存在于排列结果中 boolean exists = false; for (int j = 0; j < resultIndex; j++) { if (datas[i].equals(resultList[j])) { exists = true; break; } } if (false == exists) { // 排列结果不存在该项,才可选择 resultList[resultIndex] = datas[i]; select(resultList, resultIndex + 1, result); } } } }
public class class_name { private void select(String[] resultList, int resultIndex, List<String[]> result) { int resultLen = resultList.length; if (resultIndex >= resultLen) { // 全部选择完时,输出排列结果 result.add(Arrays.copyOf(resultList, resultList.length)); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // 递归选择下一个 for (int i = 0; i < datas.length; i++) { // 判断待选项是否存在于排列结果中 boolean exists = false; for (int j = 0; j < resultIndex; j++) { if (datas[i].equals(resultList[j])) { exists = true; // depends on control dependency: [if], data = [none] break; } } if (false == exists) { // 排列结果不存在该项,才可选择 resultList[resultIndex] = datas[i]; // depends on control dependency: [if], data = [none] select(resultList, resultIndex + 1, result); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public boolean getCloseWaiting() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getCloseWaiting returning: " + this.closeWaiting); } return this.closeWaiting; } }
public class class_name { @Override public boolean getCloseWaiting() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getCloseWaiting returning: " + this.closeWaiting); // depends on control dependency: [if], data = [none] } return this.closeWaiting; } }
public class class_name { public void setText(CharSequence text, boolean animate) { if (view != null) { ((TextView) view).setText(text); } } }
public class class_name { public void setText(CharSequence text, boolean animate) { if (view != null) { ((TextView) view).setText(text); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Object getProperty(String property) { if(ExpandoMetaClass.isValidExpandoProperty(property)) { if(property.equals(ExpandoMetaClass.STATIC_QUALIFIER) || property.equals(ExpandoMetaClass.CONSTRUCTOR) || myMetaClass.hasProperty(this, property) == null) { return replaceDelegate().getProperty(property); } } return myMetaClass.getProperty(this, property); } }
public class class_name { public Object getProperty(String property) { if(ExpandoMetaClass.isValidExpandoProperty(property)) { if(property.equals(ExpandoMetaClass.STATIC_QUALIFIER) || property.equals(ExpandoMetaClass.CONSTRUCTOR) || myMetaClass.hasProperty(this, property) == null) { return replaceDelegate().getProperty(property); // depends on control dependency: [if], data = [none] } } return myMetaClass.getProperty(this, property); } }
public class class_name { public Result<GetPolyWallSegmentsResult> getPolyWallSegments(long ref, boolean storePortals, QueryFilter filter) { Result<Tupple2<MeshTile, Poly>> tileAndPoly = m_nav.getTileAndPolyByRef(ref); if (tileAndPoly.failed()) { return Result.of(tileAndPoly.status, tileAndPoly.message); } if (Objects.isNull(filter)) { return Result.invalidParam(); } MeshTile tile = tileAndPoly.result.first; Poly poly = tileAndPoly.result.second; List<Long> segmentRefs = new ArrayList<>(); List<float[]> segmentVerts = new ArrayList<>(); List<SegInterval> ints = new ArrayList<>(16); for (int i = 0, j = poly.vertCount - 1; i < poly.vertCount; j = i++) { // Skip non-solid edges. ints.clear(); if ((poly.neis[j] & NavMesh.DT_EXT_LINK) != 0) { // Tile border. for (int k = poly.firstLink; k != NavMesh.DT_NULL_LINK; k = tile.links.get(k).next) { Link link = tile.links.get(k); if (link.edge == j) { if (link.ref != 0) { Tupple2<MeshTile, Poly> tileAndPolyUnsafe = m_nav.getTileAndPolyByRefUnsafe(link.ref); MeshTile neiTile = tileAndPolyUnsafe.first; Poly neiPoly = tileAndPolyUnsafe.second; if (filter.passFilter(link.ref, neiTile, neiPoly)) { insertInterval(ints, link.bmin, link.bmax, link.ref); } } } } } else { // Internal edge long neiRef = 0; if (poly.neis[j] != 0) { int idx = (poly.neis[j] - 1); neiRef = m_nav.getPolyRefBase(tile) | idx; if (!filter.passFilter(neiRef, tile, tile.data.polys[idx])) { neiRef = 0; } } // If the edge leads to another polygon and portals are not stored, skip. if (neiRef != 0 && !storePortals) { continue; } int vj = poly.verts[j] * 3; int vi = poly.verts[i] * 3; float[] seg = new float[6]; System.arraycopy(tile.data.verts, vj, seg, 0, 3); System.arraycopy(tile.data.verts, vi, seg, 3, 3); segmentVerts.add(seg); segmentRefs.add(neiRef); continue; } // Add sentinels insertInterval(ints, -1, 0, 0); insertInterval(ints, 255, 256, 0); // Store segments. int vj = poly.verts[j] * 3; int vi = poly.verts[i] * 3; for (int k = 1; k < ints.size(); ++k) { // Portal segment. if (storePortals && ints.get(k).ref != 0) { float tmin = ints.get(k).tmin / 255.0f; float tmax = ints.get(k).tmax / 255.0f; float[] seg = new float[6]; System.arraycopy(vLerp(tile.data.verts, vj, vi, tmin), 0, seg, 0, 3); System.arraycopy(vLerp(tile.data.verts, vj, vi, tmax), 0, seg, 3, 3); segmentVerts.add(seg); segmentRefs.add(ints.get(k).ref); } // Wall segment. int imin = ints.get(k - 1).tmax; int imax = ints.get(k).tmin; if (imin != imax) { float tmin = imin / 255.0f; float tmax = imax / 255.0f; float[] seg = new float[6]; System.arraycopy(vLerp(tile.data.verts, vj, vi, tmin), 0, seg, 0, 3); System.arraycopy(vLerp(tile.data.verts, vj, vi, tmax), 0, seg, 3, 3); segmentVerts.add(seg); segmentRefs.add(0L); } } } return Result.success(new GetPolyWallSegmentsResult(segmentVerts, segmentRefs)); } }
public class class_name { public Result<GetPolyWallSegmentsResult> getPolyWallSegments(long ref, boolean storePortals, QueryFilter filter) { Result<Tupple2<MeshTile, Poly>> tileAndPoly = m_nav.getTileAndPolyByRef(ref); if (tileAndPoly.failed()) { return Result.of(tileAndPoly.status, tileAndPoly.message); // depends on control dependency: [if], data = [none] } if (Objects.isNull(filter)) { return Result.invalidParam(); // depends on control dependency: [if], data = [none] } MeshTile tile = tileAndPoly.result.first; Poly poly = tileAndPoly.result.second; List<Long> segmentRefs = new ArrayList<>(); List<float[]> segmentVerts = new ArrayList<>(); List<SegInterval> ints = new ArrayList<>(16); for (int i = 0, j = poly.vertCount - 1; i < poly.vertCount; j = i++) { // Skip non-solid edges. ints.clear(); // depends on control dependency: [for], data = [none] if ((poly.neis[j] & NavMesh.DT_EXT_LINK) != 0) { // Tile border. for (int k = poly.firstLink; k != NavMesh.DT_NULL_LINK; k = tile.links.get(k).next) { Link link = tile.links.get(k); if (link.edge == j) { if (link.ref != 0) { Tupple2<MeshTile, Poly> tileAndPolyUnsafe = m_nav.getTileAndPolyByRefUnsafe(link.ref); MeshTile neiTile = tileAndPolyUnsafe.first; Poly neiPoly = tileAndPolyUnsafe.second; if (filter.passFilter(link.ref, neiTile, neiPoly)) { insertInterval(ints, link.bmin, link.bmax, link.ref); // depends on control dependency: [if], data = [none] } } } } } else { // Internal edge long neiRef = 0; if (poly.neis[j] != 0) { int idx = (poly.neis[j] - 1); neiRef = m_nav.getPolyRefBase(tile) | idx; // depends on control dependency: [if], data = [none] if (!filter.passFilter(neiRef, tile, tile.data.polys[idx])) { neiRef = 0; // depends on control dependency: [if], data = [none] } } // If the edge leads to another polygon and portals are not stored, skip. if (neiRef != 0 && !storePortals) { continue; } int vj = poly.verts[j] * 3; int vi = poly.verts[i] * 3; float[] seg = new float[6]; System.arraycopy(tile.data.verts, vj, seg, 0, 3); // depends on control dependency: [if], data = [none] System.arraycopy(tile.data.verts, vi, seg, 3, 3); // depends on control dependency: [if], data = [none] segmentVerts.add(seg); // depends on control dependency: [if], data = [none] segmentRefs.add(neiRef); // depends on control dependency: [if], data = [none] continue; } // Add sentinels insertInterval(ints, -1, 0, 0); // depends on control dependency: [for], data = [none] insertInterval(ints, 255, 256, 0); // depends on control dependency: [for], data = [none] // Store segments. int vj = poly.verts[j] * 3; int vi = poly.verts[i] * 3; for (int k = 1; k < ints.size(); ++k) { // Portal segment. if (storePortals && ints.get(k).ref != 0) { float tmin = ints.get(k).tmin / 255.0f; float tmax = ints.get(k).tmax / 255.0f; float[] seg = new float[6]; System.arraycopy(vLerp(tile.data.verts, vj, vi, tmin), 0, seg, 0, 3); // depends on control dependency: [if], data = [none] System.arraycopy(vLerp(tile.data.verts, vj, vi, tmax), 0, seg, 3, 3); // depends on control dependency: [if], data = [none] segmentVerts.add(seg); // depends on control dependency: [if], data = [none] segmentRefs.add(ints.get(k).ref); // depends on control dependency: [if], data = [none] } // Wall segment. int imin = ints.get(k - 1).tmax; int imax = ints.get(k).tmin; if (imin != imax) { float tmin = imin / 255.0f; float tmax = imax / 255.0f; float[] seg = new float[6]; System.arraycopy(vLerp(tile.data.verts, vj, vi, tmin), 0, seg, 0, 3); // depends on control dependency: [if], data = [none] System.arraycopy(vLerp(tile.data.verts, vj, vi, tmax), 0, seg, 3, 3); // depends on control dependency: [if], data = [none] segmentVerts.add(seg); // depends on control dependency: [if], data = [none] segmentRefs.add(0L); // depends on control dependency: [if], data = [none] } } } return Result.success(new GetPolyWallSegmentsResult(segmentVerts, segmentRefs)); } }
public class class_name { @Override public List<FoxHttpAuthorization> getAuthorization(URLConnection connection, FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpClient foxHttpClient) { ArrayList<FoxHttpAuthorization> foxHttpAuthorizationList = new ArrayList<>(); for (Map.Entry<String, ArrayList<FoxHttpAuthorization>> entry : foxHttpAuthorizations.entrySet()) { if (RegexUtil.doesURLMatch(foxHttpAuthorizationScope.toString(), foxHttpClient.getFoxHttpPlaceholderStrategy().processPlaceholders(entry.getKey(), foxHttpClient))) { foxHttpAuthorizationList.addAll(entry.getValue()); } } if (foxHttpAuthorizations.containsKey(FoxHttpAuthorizationScope.ANY.toString()) && (foxHttpAuthorizationList.isEmpty())) { foxHttpAuthorizationList.addAll(foxHttpAuthorizations.get(FoxHttpAuthorizationScope.ANY.toString())); } return foxHttpAuthorizationList; } }
public class class_name { @Override public List<FoxHttpAuthorization> getAuthorization(URLConnection connection, FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpClient foxHttpClient) { ArrayList<FoxHttpAuthorization> foxHttpAuthorizationList = new ArrayList<>(); for (Map.Entry<String, ArrayList<FoxHttpAuthorization>> entry : foxHttpAuthorizations.entrySet()) { if (RegexUtil.doesURLMatch(foxHttpAuthorizationScope.toString(), foxHttpClient.getFoxHttpPlaceholderStrategy().processPlaceholders(entry.getKey(), foxHttpClient))) { foxHttpAuthorizationList.addAll(entry.getValue()); // depends on control dependency: [if], data = [none] } } if (foxHttpAuthorizations.containsKey(FoxHttpAuthorizationScope.ANY.toString()) && (foxHttpAuthorizationList.isEmpty())) { foxHttpAuthorizationList.addAll(foxHttpAuthorizations.get(FoxHttpAuthorizationScope.ANY.toString())); // depends on control dependency: [if], data = [none] } return foxHttpAuthorizationList; } }
public class class_name { private MemberId getNextMemberId(String topicName) { InternalTopic topic = topics.get(topicName); if (topic == null) { return null; } TopicIterator iterator = topic.iterator(); if (iterator.hasNext()) { return iterator.next().memberId(); } return null; } }
public class class_name { private MemberId getNextMemberId(String topicName) { InternalTopic topic = topics.get(topicName); if (topic == null) { return null; // depends on control dependency: [if], data = [none] } TopicIterator iterator = topic.iterator(); if (iterator.hasNext()) { return iterator.next().memberId(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private static void updateVolume(DataLine dataLine, int volume) { if (dataLine.isControlSupported(Type.MASTER_GAIN)) { final FloatControl gainControl = (FloatControl) dataLine.getControl(Type.MASTER_GAIN); final double gain = UtilMath.clamp(volume / 100.0, 0.0, 100.0); final double dB = Math.log(gain) / Math.log(10.0) * 20.0; gainControl.setValue((float) dB); } } }
public class class_name { private static void updateVolume(DataLine dataLine, int volume) { if (dataLine.isControlSupported(Type.MASTER_GAIN)) { final FloatControl gainControl = (FloatControl) dataLine.getControl(Type.MASTER_GAIN); final double gain = UtilMath.clamp(volume / 100.0, 0.0, 100.0); final double dB = Math.log(gain) / Math.log(10.0) * 20.0; gainControl.setValue((float) dB); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(CreateTagsRequest createTagsRequest, ProtocolMarshaller protocolMarshaller) { if (createTagsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createTagsRequest.getFileSystemId(), FILESYSTEMID_BINDING); protocolMarshaller.marshall(createTagsRequest.getTags(), TAGS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateTagsRequest createTagsRequest, ProtocolMarshaller protocolMarshaller) { if (createTagsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createTagsRequest.getFileSystemId(), FILESYSTEMID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createTagsRequest.getTags(), TAGS_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 { @FunctionName("EventHubTriggerJava") public void run( @EventHubTrigger(name = "message", eventHubName = "trigger", connection = "CIEventHubConnection", consumerGroup = "$Default") String message, @EventHubOutput(name = "result", eventHubName = "output", connection = "CIEventHubConnection" ) OutputBinding<String> result, final ExecutionContext context ) { if(message.contains("CIInput")){ result.setValue("CITest"); } } }
public class class_name { @FunctionName("EventHubTriggerJava") public void run( @EventHubTrigger(name = "message", eventHubName = "trigger", connection = "CIEventHubConnection", consumerGroup = "$Default") String message, @EventHubOutput(name = "result", eventHubName = "output", connection = "CIEventHubConnection" ) OutputBinding<String> result, final ExecutionContext context ) { if(message.contains("CIInput")){ result.setValue("CITest"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setDoesContainIBMSessionListener(boolean value) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "setDoesContainIBMSessionListener", "" + value); } doesContainIBMSessionListener = value; } }
public class class_name { public void setDoesContainIBMSessionListener(boolean value) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "setDoesContainIBMSessionListener", "" + value); // depends on control dependency: [if], data = [none] } doesContainIBMSessionListener = value; } }
public class class_name { protected DecimalWithUoM eval(final Object... _values) throws SQLException { final DecimalWithUoM ret; if (_values == null || _values.length < 2) { ret = null; } else { final BigDecimal value; if (_values[0] instanceof String && ((String) _values[0]).length() > 0) { try { value = DecimalType.parseLocalized((String) _values[0]); } catch (final EFapsException e) { throw new SQLException(e); } } else if (_values[0] instanceof BigDecimal) { value = (BigDecimal) _values[0]; } else if (_values[0] instanceof Number) { value = new BigDecimal(((Number) _values[0]).toString()); } else { value = null; } final UoM uom; if (_values[1] instanceof UoM) { uom = (UoM) _values[1]; } else if (_values[1] instanceof String && ((String) _values[1]).length() > 0) { uom = Dimension.getUoM(Long.parseLong((String) _values[1])); } else if (_values[1] instanceof Number) { uom = Dimension.getUoM(((Number) _values[1]).longValue()); } else { uom = null; } ret = new DecimalWithUoM(value, uom); } return ret; } }
public class class_name { protected DecimalWithUoM eval(final Object... _values) throws SQLException { final DecimalWithUoM ret; if (_values == null || _values.length < 2) { ret = null; // depends on control dependency: [if], data = [none] } else { final BigDecimal value; if (_values[0] instanceof String && ((String) _values[0]).length() > 0) { try { value = DecimalType.parseLocalized((String) _values[0]); // depends on control dependency: [try], data = [none] } catch (final EFapsException e) { throw new SQLException(e); } // depends on control dependency: [catch], data = [none] } else if (_values[0] instanceof BigDecimal) { value = (BigDecimal) _values[0]; // depends on control dependency: [if], data = [none] } else if (_values[0] instanceof Number) { value = new BigDecimal(((Number) _values[0]).toString()); // depends on control dependency: [if], data = [none] } else { value = null; // depends on control dependency: [if], data = [none] } final UoM uom; if (_values[1] instanceof UoM) { uom = (UoM) _values[1]; // depends on control dependency: [if], data = [none] } else if (_values[1] instanceof String && ((String) _values[1]).length() > 0) { uom = Dimension.getUoM(Long.parseLong((String) _values[1])); // depends on control dependency: [if], data = [none] } else if (_values[1] instanceof Number) { uom = Dimension.getUoM(((Number) _values[1]).longValue()); // depends on control dependency: [if], data = [none] } else { uom = null; // depends on control dependency: [if], data = [none] } ret = new DecimalWithUoM(value, uom); // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { public final BaseDescr inExpression() throws RecognitionException { BaseDescr result = null; BaseDescr left =null; ParserRuleReturnScope e1 =null; ParserRuleReturnScope e2 =null; ConstraintConnectiveDescr descr = null; BaseDescr leftDescr = null; BindingDescr binding = null; try { // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:314:3: (left= relationalExpression ( ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN |in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN )? ) // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:314:5: left= relationalExpression ( ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN |in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN )? { pushFollow(FOLLOW_relationalExpression_in_inExpression1533); left=relationalExpression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { if( buildDescr ) { result = left; } if( left instanceof BindingDescr ) { binding = (BindingDescr)left; leftDescr = new AtomicExprDescr( binding.getExpression() ); } else { leftDescr = left; } } // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:323:5: ( ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN |in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN )? int alt36=3; int LA36_0 = input.LA(1); if ( (LA36_0==ID) ) { int LA36_1 = input.LA(2); if ( (LA36_1==ID) ) { int LA36_3 = input.LA(3); if ( (LA36_3==LEFT_PAREN) && ((((helper.validateIdentifierKey(DroolsSoftKeywords.NOT)))&&synpred7_DRL5Expressions()))) { alt36=1; } } else if ( (LA36_1==LEFT_PAREN) && (((helper.validateIdentifierKey(DroolsSoftKeywords.IN))))) { alt36=2; } } switch (alt36) { case 1 : // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:323:6: ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN { pushFollow(FOLLOW_not_key_in_inExpression1553); not_key(); state._fsp--; if (state.failed) return result; pushFollow(FOLLOW_in_key_in_inExpression1557); in_key(); state._fsp--; if (state.failed) return result; match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_inExpression1559); if (state.failed) return result; if ( state.backtracking==0 ) { helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT ); } pushFollow(FOLLOW_expression_in_inExpression1581); e1=expression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { descr = ConstraintConnectiveDescr.newAnd(); RelationalExprDescr rel = new RelationalExprDescr( "!=", false, null, leftDescr, (e1!=null?((DRL5Expressions.expression_return)e1).result:null) ); descr.addOrMerge( rel ); result = descr; } // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:331:7: ( COMMA e2= expression )* loop34: while (true) { int alt34=2; int LA34_0 = input.LA(1); if ( (LA34_0==COMMA) ) { alt34=1; } switch (alt34) { case 1 : // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:331:8: COMMA e2= expression { match(input,COMMA,FOLLOW_COMMA_in_inExpression1600); if (state.failed) return result; pushFollow(FOLLOW_expression_in_inExpression1604); e2=expression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { RelationalExprDescr rel = new RelationalExprDescr( "!=", false, null, leftDescr, (e2!=null?((DRL5Expressions.expression_return)e2).result:null) ); descr.addOrMerge( rel ); } } break; default : break loop34; } } match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_inExpression1625); if (state.failed) return result; if ( state.backtracking==0 ) { helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_END ); } } break; case 2 : // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:337:7: in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN { pushFollow(FOLLOW_in_key_in_inExpression1641); in_key(); state._fsp--; if (state.failed) return result; match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_inExpression1643); if (state.failed) return result; if ( state.backtracking==0 ) { helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT ); } pushFollow(FOLLOW_expression_in_inExpression1665); e1=expression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { descr = ConstraintConnectiveDescr.newOr(); RelationalExprDescr rel = new RelationalExprDescr( "==", false, null, leftDescr, (e1!=null?((DRL5Expressions.expression_return)e1).result:null) ); descr.addOrMerge( rel ); result = descr; } // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:345:7: ( COMMA e2= expression )* loop35: while (true) { int alt35=2; int LA35_0 = input.LA(1); if ( (LA35_0==COMMA) ) { alt35=1; } switch (alt35) { case 1 : // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:345:8: COMMA e2= expression { match(input,COMMA,FOLLOW_COMMA_in_inExpression1684); if (state.failed) return result; pushFollow(FOLLOW_expression_in_inExpression1688); e2=expression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { RelationalExprDescr rel = new RelationalExprDescr( "==", false, null, leftDescr, (e2!=null?((DRL5Expressions.expression_return)e2).result:null) ); descr.addOrMerge( rel ); } } break; default : break loop35; } } match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_inExpression1709); if (state.failed) return result; if ( state.backtracking==0 ) { helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_END ); } } break; } } if ( state.backtracking==0 ) { if( binding != null && descr != null ) descr.addOrMerge( binding ); } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } return result; } }
public class class_name { public final BaseDescr inExpression() throws RecognitionException { BaseDescr result = null; BaseDescr left =null; ParserRuleReturnScope e1 =null; ParserRuleReturnScope e2 =null; ConstraintConnectiveDescr descr = null; BaseDescr leftDescr = null; BindingDescr binding = null; try { // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:314:3: (left= relationalExpression ( ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN |in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN )? ) // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:314:5: left= relationalExpression ( ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN |in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN )? { pushFollow(FOLLOW_relationalExpression_in_inExpression1533); left=relationalExpression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { if( buildDescr ) { result = left; } // depends on control dependency: [if], data = [none] if( left instanceof BindingDescr ) { binding = (BindingDescr)left; // depends on control dependency: [if], data = [none] leftDescr = new AtomicExprDescr( binding.getExpression() ); // depends on control dependency: [if], data = [none] } else { leftDescr = left; // depends on control dependency: [if], data = [none] } } // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:323:5: ( ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN |in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN )? int alt36=3; int LA36_0 = input.LA(1); if ( (LA36_0==ID) ) { int LA36_1 = input.LA(2); if ( (LA36_1==ID) ) { int LA36_3 = input.LA(3); if ( (LA36_3==LEFT_PAREN) && ((((helper.validateIdentifierKey(DroolsSoftKeywords.NOT)))&&synpred7_DRL5Expressions()))) { alt36=1; // depends on control dependency: [if], data = [none] } } else if ( (LA36_1==LEFT_PAREN) && (((helper.validateIdentifierKey(DroolsSoftKeywords.IN))))) { alt36=2; // depends on control dependency: [if], data = [none] } } switch (alt36) { case 1 : // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:323:6: ( not_key in_key )=> not_key in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN { pushFollow(FOLLOW_not_key_in_inExpression1553); not_key(); state._fsp--; if (state.failed) return result; pushFollow(FOLLOW_in_key_in_inExpression1557); in_key(); state._fsp--; if (state.failed) return result; match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_inExpression1559); if (state.failed) return result; if ( state.backtracking==0 ) { helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT ); } // depends on control dependency: [if], data = [none] pushFollow(FOLLOW_expression_in_inExpression1581); e1=expression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { descr = ConstraintConnectiveDescr.newAnd(); // depends on control dependency: [if], data = [none] RelationalExprDescr rel = new RelationalExprDescr( "!=", false, null, leftDescr, (e1!=null?((DRL5Expressions.expression_return)e1).result:null) ); descr.addOrMerge( rel ); // depends on control dependency: [if], data = [none] result = descr; // depends on control dependency: [if], data = [none] } // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:331:7: ( COMMA e2= expression )* loop34: while (true) { int alt34=2; int LA34_0 = input.LA(1); if ( (LA34_0==COMMA) ) { alt34=1; // depends on control dependency: [if], data = [none] } switch (alt34) { case 1 : // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:331:8: COMMA e2= expression { match(input,COMMA,FOLLOW_COMMA_in_inExpression1600); if (state.failed) return result; pushFollow(FOLLOW_expression_in_inExpression1604); e2=expression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { RelationalExprDescr rel = new RelationalExprDescr( "!=", false, null, leftDescr, (e2!=null?((DRL5Expressions.expression_return)e2).result:null) ); descr.addOrMerge( rel ); // depends on control dependency: [if], data = [none] } } break; default : break loop34; } } match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_inExpression1625); if (state.failed) return result; if ( state.backtracking==0 ) { helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_END ); } // depends on control dependency: [if], data = [none] } break; case 2 : // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:337:7: in= in_key LEFT_PAREN e1= expression ( COMMA e2= expression )* RIGHT_PAREN { pushFollow(FOLLOW_in_key_in_inExpression1641); in_key(); state._fsp--; if (state.failed) return result; match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_inExpression1643); if (state.failed) return result; if ( state.backtracking==0 ) { helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT ); } // depends on control dependency: [if], data = [none] pushFollow(FOLLOW_expression_in_inExpression1665); e1=expression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { descr = ConstraintConnectiveDescr.newOr(); // depends on control dependency: [if], data = [none] RelationalExprDescr rel = new RelationalExprDescr( "==", false, null, leftDescr, (e1!=null?((DRL5Expressions.expression_return)e1).result:null) ); descr.addOrMerge( rel ); // depends on control dependency: [if], data = [none] result = descr; // depends on control dependency: [if], data = [none] } // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:345:7: ( COMMA e2= expression )* loop35: while (true) { int alt35=2; int LA35_0 = input.LA(1); if ( (LA35_0==COMMA) ) { alt35=1; // depends on control dependency: [if], data = [none] } switch (alt35) { case 1 : // src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:345:8: COMMA e2= expression { match(input,COMMA,FOLLOW_COMMA_in_inExpression1684); if (state.failed) return result; pushFollow(FOLLOW_expression_in_inExpression1688); e2=expression(); state._fsp--; if (state.failed) return result; if ( state.backtracking==0 ) { RelationalExprDescr rel = new RelationalExprDescr( "==", false, null, leftDescr, (e2!=null?((DRL5Expressions.expression_return)e2).result:null) ); descr.addOrMerge( rel ); // depends on control dependency: [if], data = [none] } } break; default : break loop35; } } match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_inExpression1709); if (state.failed) return result; if ( state.backtracking==0 ) { helper.emit( Location.LOCATION_LHS_INSIDE_CONDITION_END ); } // depends on control dependency: [if], data = [none] } break; } } if ( state.backtracking==0 ) { if( binding != null && descr != null ) descr.addOrMerge( binding ); } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } return result; } }
public class class_name { protected void setGroups(List<CmsPublishGroup> groups, boolean newData) { m_model = new CmsPublishDataModel(groups, this); m_model.setSelectionChangeAction(new Runnable() { public void run() { onChangePublishSelection(); } }); m_currentGroupIndex = 0; m_currentGroupPanel = null; m_problemsPanel.clear(); if (newData) { m_showProblemsOnly = false; m_checkboxProblems.setChecked(false); m_checkboxProblems.setVisible(false); m_problemsPanel.setVisible(false); } m_groupPanels.clear(); m_groupPanelContainer.clear(); m_scrollPanel.onResizeDescendant(); enableActions(false); int numGroups = groups.size(); setResourcesVisible(numGroups > 0); if (numGroups == 0) { return; } enableActions(true); addMoreListItems(); showProblemCount(m_model.countProblems()); } }
public class class_name { protected void setGroups(List<CmsPublishGroup> groups, boolean newData) { m_model = new CmsPublishDataModel(groups, this); m_model.setSelectionChangeAction(new Runnable() { public void run() { onChangePublishSelection(); } }); m_currentGroupIndex = 0; m_currentGroupPanel = null; m_problemsPanel.clear(); if (newData) { m_showProblemsOnly = false; // depends on control dependency: [if], data = [none] m_checkboxProblems.setChecked(false); // depends on control dependency: [if], data = [none] m_checkboxProblems.setVisible(false); // depends on control dependency: [if], data = [none] m_problemsPanel.setVisible(false); // depends on control dependency: [if], data = [none] } m_groupPanels.clear(); m_groupPanelContainer.clear(); m_scrollPanel.onResizeDescendant(); enableActions(false); int numGroups = groups.size(); setResourcesVisible(numGroups > 0); if (numGroups == 0) { return; // depends on control dependency: [if], data = [none] } enableActions(true); addMoreListItems(); showProblemCount(m_model.countProblems()); } }
public class class_name { public void writeDirect( byte[] b, int off, int len, int flags ) throws IOException { if( len <= 0 ) { return; } if( tmp == null ) { throw new IOException( "Bad file descriptor" ); } ensureOpen(); if( file.log.level >= 4 ) file.log.println( "write: fid=" + file.fid + ",off=" + off + ",len=" + len ); int w; do { w = len > writeSize ? writeSize : len; if( useNTSmbs ) { reqx.setParam( file.fid, fp, len - w, b, off, w ); if ((flags & 1) != 0) { reqx.setParam( file.fid, fp, len, b, off, w ); reqx.writeMode = 0x8; } else { reqx.writeMode = 0; } file.send( reqx, rspx ); fp += rspx.count; len -= rspx.count; off += rspx.count; } else { req.setParam( file.fid, fp, len - w, b, off, w ); fp += rsp.count; len -= rsp.count; off += rsp.count; file.send( req, rsp ); } } while( len > 0 ); } }
public class class_name { public void writeDirect( byte[] b, int off, int len, int flags ) throws IOException { if( len <= 0 ) { return; } if( tmp == null ) { throw new IOException( "Bad file descriptor" ); } ensureOpen(); if( file.log.level >= 4 ) file.log.println( "write: fid=" + file.fid + ",off=" + off + ",len=" + len ); int w; do { w = len > writeSize ? writeSize : len; if( useNTSmbs ) { reqx.setParam( file.fid, fp, len - w, b, off, w ); // depends on control dependency: [if], data = [none] if ((flags & 1) != 0) { reqx.setParam( file.fid, fp, len, b, off, w ); // depends on control dependency: [if], data = [none] reqx.writeMode = 0x8; // depends on control dependency: [if], data = [none] } else { reqx.writeMode = 0; // depends on control dependency: [if], data = [none] } file.send( reqx, rspx ); // depends on control dependency: [if], data = [none] fp += rspx.count; // depends on control dependency: [if], data = [none] len -= rspx.count; // depends on control dependency: [if], data = [none] off += rspx.count; // depends on control dependency: [if], data = [none] } else { req.setParam( file.fid, fp, len - w, b, off, w ); // depends on control dependency: [if], data = [none] fp += rsp.count; // depends on control dependency: [if], data = [none] len -= rsp.count; // depends on control dependency: [if], data = [none] off += rsp.count; // depends on control dependency: [if], data = [none] file.send( req, rsp ); // depends on control dependency: [if], data = [none] } } while( len > 0 ); } }
public class class_name { @NonNull public TransitionSet addTransition(@Nullable Transition transition) { if (transition != null) { addTransitionInternal(transition); if (mDuration >= 0) { transition.setDuration(mDuration); } if (mInterpolator != null) { transition.setInterpolator(mInterpolator); } } return this; } }
public class class_name { @NonNull public TransitionSet addTransition(@Nullable Transition transition) { if (transition != null) { addTransitionInternal(transition); // depends on control dependency: [if], data = [(transition] if (mDuration >= 0) { transition.setDuration(mDuration); // depends on control dependency: [if], data = [(mDuration] } if (mInterpolator != null) { transition.setInterpolator(mInterpolator); // depends on control dependency: [if], data = [(mInterpolator] } } return this; } }
public class class_name { public EClass getIfcElementType() { if (ifcElementTypeEClass == null) { ifcElementTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(201); } return ifcElementTypeEClass; } }
public class class_name { public EClass getIfcElementType() { if (ifcElementTypeEClass == null) { ifcElementTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(201); // depends on control dependency: [if], data = [none] } return ifcElementTypeEClass; } }
public class class_name { protected void appendAppId(ApplicationId appId, Message m) { if (appId == null) { return; } // check if any application-id avp is already present. // we could use m.getApplicationIdAvps().size() > 0 but this should spare a few cpu cycles for (Avp avp : m.getAvps()) { int code = avp.getCode(); if (code == Avp.ACCT_APPLICATION_ID || code == Avp.AUTH_APPLICATION_ID || code == Avp.VENDOR_SPECIFIC_APPLICATION_ID) { return; } } if (appId.getVendorId() == 0) { if (appId.getAcctAppId() != 0) { m.getAvps().addAvp(Avp.ACCT_APPLICATION_ID, appId.getAcctAppId(), true, false, true); } if (appId.getAuthAppId() != 0) { m.getAvps().addAvp(Avp.AUTH_APPLICATION_ID, appId.getAuthAppId(), true, false, true); } } else { AvpSet avp = m.getAvps().addGroupedAvp(Avp.VENDOR_SPECIFIC_APPLICATION_ID, true, false); avp.addAvp(Avp.VENDOR_ID, appId.getVendorId(), true, false, true); if (appId.getAuthAppId() != 0) { avp.addAvp(Avp.AUTH_APPLICATION_ID, appId.getAuthAppId(), true, false, true); } if (appId.getAcctAppId() != 0) { avp.addAvp(Avp.ACCT_APPLICATION_ID, appId.getAcctAppId(), true, false, true); } } } }
public class class_name { protected void appendAppId(ApplicationId appId, Message m) { if (appId == null) { return; // depends on control dependency: [if], data = [none] } // check if any application-id avp is already present. // we could use m.getApplicationIdAvps().size() > 0 but this should spare a few cpu cycles for (Avp avp : m.getAvps()) { int code = avp.getCode(); if (code == Avp.ACCT_APPLICATION_ID || code == Avp.AUTH_APPLICATION_ID || code == Avp.VENDOR_SPECIFIC_APPLICATION_ID) { return; // depends on control dependency: [if], data = [none] } } if (appId.getVendorId() == 0) { if (appId.getAcctAppId() != 0) { m.getAvps().addAvp(Avp.ACCT_APPLICATION_ID, appId.getAcctAppId(), true, false, true); // depends on control dependency: [if], data = [none] } if (appId.getAuthAppId() != 0) { m.getAvps().addAvp(Avp.AUTH_APPLICATION_ID, appId.getAuthAppId(), true, false, true); // depends on control dependency: [if], data = [none] } } else { AvpSet avp = m.getAvps().addGroupedAvp(Avp.VENDOR_SPECIFIC_APPLICATION_ID, true, false); avp.addAvp(Avp.VENDOR_ID, appId.getVendorId(), true, false, true); // depends on control dependency: [if], data = [none] if (appId.getAuthAppId() != 0) { avp.addAvp(Avp.AUTH_APPLICATION_ID, appId.getAuthAppId(), true, false, true); // depends on control dependency: [if], data = [none] } if (appId.getAcctAppId() != 0) { avp.addAvp(Avp.ACCT_APPLICATION_ID, appId.getAcctAppId(), true, false, true); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private boolean mustStopScanToPreventAndroidNScanTimeout() { long timeOfNextScanCycleEnd = SystemClock.elapsedRealtime() + mBetweenScanPeriod + mScanPeriod; boolean timeoutAtRisk = android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && mCurrentScanStartTime > 0 && (timeOfNextScanCycleEnd - mCurrentScanStartTime > ANDROID_N_MAX_SCAN_DURATION_MILLIS); if (timeoutAtRisk) { LogManager.d(TAG, "The next scan cycle would go over the Android N max duration."); if (mLongScanForcingEnabled) { LogManager.d(TAG, "Stopping scan to prevent Android N scan timeout."); return true; } else { LogManager.w(TAG, "Allowing a long running scan to be stopped by the OS. To " + "prevent this, set longScanForcingEnabled in the AndroidBeaconLibrary."); } } return false; } }
public class class_name { private boolean mustStopScanToPreventAndroidNScanTimeout() { long timeOfNextScanCycleEnd = SystemClock.elapsedRealtime() + mBetweenScanPeriod + mScanPeriod; boolean timeoutAtRisk = android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && mCurrentScanStartTime > 0 && (timeOfNextScanCycleEnd - mCurrentScanStartTime > ANDROID_N_MAX_SCAN_DURATION_MILLIS); if (timeoutAtRisk) { LogManager.d(TAG, "The next scan cycle would go over the Android N max duration."); // depends on control dependency: [if], data = [none] if (mLongScanForcingEnabled) { LogManager.d(TAG, "Stopping scan to prevent Android N scan timeout."); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else { LogManager.w(TAG, "Allowing a long running scan to be stopped by the OS. To " + "prevent this, set longScanForcingEnabled in the AndroidBeaconLibrary."); // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public void marshall(ResourceServerType resourceServerType, ProtocolMarshaller protocolMarshaller) { if (resourceServerType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resourceServerType.getUserPoolId(), USERPOOLID_BINDING); protocolMarshaller.marshall(resourceServerType.getIdentifier(), IDENTIFIER_BINDING); protocolMarshaller.marshall(resourceServerType.getName(), NAME_BINDING); protocolMarshaller.marshall(resourceServerType.getScopes(), SCOPES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ResourceServerType resourceServerType, ProtocolMarshaller protocolMarshaller) { if (resourceServerType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resourceServerType.getUserPoolId(), USERPOOLID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resourceServerType.getIdentifier(), IDENTIFIER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resourceServerType.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resourceServerType.getScopes(), SCOPES_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private String[] resolvePermissions(ContainerRequest request) { String[] values = _permissions; if (_substitutions.isEmpty()) { return values; } String[] permissions = new String[values.length]; System.arraycopy(values, 0, permissions, 0, values.length); for (Map.Entry<String, Function<HttpRequestContext, String>> entry : _substitutions.entrySet()) { String key = Pattern.quote(entry.getKey()); String substitution = Matcher.quoteReplacement(MatchingPermission.escape(entry.getValue().apply(request))); for (int i=0; i < values.length; i++) { permissions[i] = permissions[i].replaceAll(key, substitution); } } return permissions; } }
public class class_name { private String[] resolvePermissions(ContainerRequest request) { String[] values = _permissions; if (_substitutions.isEmpty()) { return values; // depends on control dependency: [if], data = [none] } String[] permissions = new String[values.length]; System.arraycopy(values, 0, permissions, 0, values.length); for (Map.Entry<String, Function<HttpRequestContext, String>> entry : _substitutions.entrySet()) { String key = Pattern.quote(entry.getKey()); String substitution = Matcher.quoteReplacement(MatchingPermission.escape(entry.getValue().apply(request))); for (int i=0; i < values.length; i++) { permissions[i] = permissions[i].replaceAll(key, substitution); // depends on control dependency: [for], data = [i] } } return permissions; } }
public class class_name { public Map<Object, Object> getSwappableData() { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[GET_SWAPPABLE_DATA], appNameAndIdString); } Hashtable swapData = new Hashtable(); if (_attributes != null) { for (Enumeration e = _attributes.keys(); e.hasMoreElements();) { Object mykey = e.nextElement(); if (_attributes.get(mykey) instanceof Serializable) { swapData.put(mykey, _attributes.get(mykey)); } } } if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[GET_SWAPPABLE_DATA], swapData); } return swapData; } }
public class class_name { public Map<Object, Object> getSwappableData() { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[GET_SWAPPABLE_DATA], appNameAndIdString); // depends on control dependency: [if], data = [none] } Hashtable swapData = new Hashtable(); if (_attributes != null) { for (Enumeration e = _attributes.keys(); e.hasMoreElements();) { Object mykey = e.nextElement(); if (_attributes.get(mykey) instanceof Serializable) { swapData.put(mykey, _attributes.get(mykey)); // depends on control dependency: [if], data = [none] } } } if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[GET_SWAPPABLE_DATA], swapData); // depends on control dependency: [if], data = [none] } return swapData; } }
public class class_name { public static boolean load(String path, Nature defaultNature, TreeMap<String, CoreDictionary.Attribute> map, LinkedHashSet<Nature> customNatureCollector) { try { String splitter = "\\s"; if (path.endsWith(".csv")) { splitter = ","; } BufferedReader br = new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8")); String line; boolean firstLine = true; while ((line = br.readLine()) != null) { if (firstLine) { line = IOUtil.removeUTF8BOM(line); firstLine = false; } String[] param = line.split(splitter); if (param[0].length() == 0) continue; // 排除空行 if (HanLP.Config.Normalization) param[0] = CharTable.convert(param[0]); // 正规化 int natureCount = (param.length - 1) / 2; CoreDictionary.Attribute attribute; if (natureCount == 0) { attribute = new CoreDictionary.Attribute(defaultNature); } else { attribute = new CoreDictionary.Attribute(natureCount); for (int i = 0; i < natureCount; ++i) { attribute.nature[i] = LexiconUtility.convertStringToNature(param[1 + 2 * i], customNatureCollector); attribute.frequency[i] = Integer.parseInt(param[2 + 2 * i]); attribute.totalFrequency += attribute.frequency[i]; } } // if (updateAttributeIfExist(param[0], attribute, map, rewriteTable)) continue; map.put(param[0], attribute); } br.close(); } catch (Exception e) { logger.severe("自定义词典" + path + "读取错误!" + e); return false; } return true; } }
public class class_name { public static boolean load(String path, Nature defaultNature, TreeMap<String, CoreDictionary.Attribute> map, LinkedHashSet<Nature> customNatureCollector) { try { String splitter = "\\s"; if (path.endsWith(".csv")) { splitter = ","; // depends on control dependency: [if], data = [none] } BufferedReader br = new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8")); String line; boolean firstLine = true; while ((line = br.readLine()) != null) { if (firstLine) { line = IOUtil.removeUTF8BOM(line); // depends on control dependency: [if], data = [none] firstLine = false; // depends on control dependency: [if], data = [none] } String[] param = line.split(splitter); if (param[0].length() == 0) continue; // 排除空行 if (HanLP.Config.Normalization) param[0] = CharTable.convert(param[0]); // 正规化 int natureCount = (param.length - 1) / 2; CoreDictionary.Attribute attribute; if (natureCount == 0) { attribute = new CoreDictionary.Attribute(defaultNature); // depends on control dependency: [if], data = [none] } else { attribute = new CoreDictionary.Attribute(natureCount); // depends on control dependency: [if], data = [(natureCount] for (int i = 0; i < natureCount; ++i) { attribute.nature[i] = LexiconUtility.convertStringToNature(param[1 + 2 * i], customNatureCollector); // depends on control dependency: [for], data = [i] attribute.frequency[i] = Integer.parseInt(param[2 + 2 * i]); // depends on control dependency: [for], data = [i] attribute.totalFrequency += attribute.frequency[i]; // depends on control dependency: [for], data = [i] } } // if (updateAttributeIfExist(param[0], attribute, map, rewriteTable)) continue; map.put(param[0], attribute); // depends on control dependency: [while], data = [none] } br.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.severe("自定义词典" + path + "读取错误!" + e); return false; } // depends on control dependency: [catch], data = [none] return true; } }
public class class_name { private static String caseFormatWithDelimiter(String str, String delimiter, boolean isAllUpper, boolean isAllLower) { StringBuilder builder = new StringBuilder(str.length()); String[] tokens = NOT_ALPHANUMERIC_REGEX.split(str); boolean shouldAddDelimiter = StringUtils.isNotEmpty(delimiter); for (int i = 0; i < tokens.length; i++) { String currentToken = tokens[i]; builder.append(currentToken); boolean hasNextToken = i + 1 != tokens.length; if (hasNextToken && shouldAddDelimiter) { builder.append(delimiter); } } String outputString = builder.toString(); if (isAllLower) { return StringUtils.lowerCase(outputString); } else if (isAllUpper) { return StringUtils.upperCase(outputString); } return outputString; } }
public class class_name { private static String caseFormatWithDelimiter(String str, String delimiter, boolean isAllUpper, boolean isAllLower) { StringBuilder builder = new StringBuilder(str.length()); String[] tokens = NOT_ALPHANUMERIC_REGEX.split(str); boolean shouldAddDelimiter = StringUtils.isNotEmpty(delimiter); for (int i = 0; i < tokens.length; i++) { String currentToken = tokens[i]; builder.append(currentToken); // depends on control dependency: [for], data = [none] boolean hasNextToken = i + 1 != tokens.length; if (hasNextToken && shouldAddDelimiter) { builder.append(delimiter); // depends on control dependency: [if], data = [none] } } String outputString = builder.toString(); if (isAllLower) { return StringUtils.lowerCase(outputString); // depends on control dependency: [if], data = [none] } else if (isAllUpper) { return StringUtils.upperCase(outputString); // depends on control dependency: [if], data = [none] } return outputString; } }
public class class_name { public static Atom[] duplicateCA2(Atom[] ca2) { // we don't want to rotate input atoms, do we? Atom[] ca2clone = new Atom[ca2.length * 2]; int pos = 0; Chain c = null; String prevChainId = ""; for (Atom a : ca2) { Group g = (Group) a.getGroup().clone(); // works because each group // has only a single atom if (c == null) { c = new ChainImpl(); Chain orig = a.getGroup().getChain(); c.setId(orig.getId()); c.setName(orig.getName()); } else { Chain orig = a.getGroup().getChain(); if (!orig.getId().equals(prevChainId)) { c = new ChainImpl(); c.setId(orig.getId()); c.setName(orig.getName()); } } c.addGroup(g); ca2clone[pos] = g.getAtom(a.getName()); pos++; } // Duplicate ca2! c = null; prevChainId = ""; for (Atom a : ca2) { Group g = (Group) a.getGroup().clone(); if (c == null) { c = new ChainImpl(); Chain orig = a.getGroup().getChain(); c.setId(orig.getId()); c.setName(orig.getName()); } else { Chain orig = a.getGroup().getChain(); if (!orig.getId().equals(prevChainId)) { c = new ChainImpl(); c.setId(orig.getId()); c.setName(orig.getName()); } } c.addGroup(g); ca2clone[pos] = g.getAtom(a.getName()); pos++; } return ca2clone; } }
public class class_name { public static Atom[] duplicateCA2(Atom[] ca2) { // we don't want to rotate input atoms, do we? Atom[] ca2clone = new Atom[ca2.length * 2]; int pos = 0; Chain c = null; String prevChainId = ""; for (Atom a : ca2) { Group g = (Group) a.getGroup().clone(); // works because each group // has only a single atom if (c == null) { c = new ChainImpl(); // depends on control dependency: [if], data = [none] Chain orig = a.getGroup().getChain(); c.setId(orig.getId()); // depends on control dependency: [if], data = [none] c.setName(orig.getName()); // depends on control dependency: [if], data = [none] } else { Chain orig = a.getGroup().getChain(); if (!orig.getId().equals(prevChainId)) { c = new ChainImpl(); // depends on control dependency: [if], data = [none] c.setId(orig.getId()); // depends on control dependency: [if], data = [none] c.setName(orig.getName()); // depends on control dependency: [if], data = [none] } } c.addGroup(g); // depends on control dependency: [for], data = [a] ca2clone[pos] = g.getAtom(a.getName()); // depends on control dependency: [for], data = [a] pos++; // depends on control dependency: [for], data = [none] } // Duplicate ca2! c = null; prevChainId = ""; for (Atom a : ca2) { Group g = (Group) a.getGroup().clone(); if (c == null) { c = new ChainImpl(); // depends on control dependency: [if], data = [none] Chain orig = a.getGroup().getChain(); c.setId(orig.getId()); // depends on control dependency: [if], data = [none] c.setName(orig.getName()); // depends on control dependency: [if], data = [none] } else { Chain orig = a.getGroup().getChain(); if (!orig.getId().equals(prevChainId)) { c = new ChainImpl(); // depends on control dependency: [if], data = [none] c.setId(orig.getId()); // depends on control dependency: [if], data = [none] c.setName(orig.getName()); // depends on control dependency: [if], data = [none] } } c.addGroup(g); // depends on control dependency: [for], data = [a] ca2clone[pos] = g.getAtom(a.getName()); // depends on control dependency: [for], data = [a] pos++; // depends on control dependency: [for], data = [none] } return ca2clone; } }
public class class_name { public boolean isAvailable() { // The channel is available is is connected boolean available = this.rtpChannel != null && this.rtpChannel.isConnected(); // In case of WebRTC calls the DTLS handshake must be completed if(this.isWebRtc) { available = available && this.webRtcHandler.isHandshakeComplete(); } return available; } }
public class class_name { public boolean isAvailable() { // The channel is available is is connected boolean available = this.rtpChannel != null && this.rtpChannel.isConnected(); // In case of WebRTC calls the DTLS handshake must be completed if(this.isWebRtc) { available = available && this.webRtcHandler.isHandshakeComplete(); // depends on control dependency: [if], data = [none] } return available; } }
public class class_name { @Nullable private String _parseQuotedToken (final char cTerminator) { char ch; m_nIndex1 = m_nPos; m_nIndex2 = m_nPos; boolean bQuoted = false; boolean bCharEscaped = false; while (_hasChar ()) { ch = m_aChars[m_nPos]; if (!bQuoted && cTerminator == ch) break; if (!bCharEscaped && ch == '"') bQuoted = !bQuoted; bCharEscaped = (!bCharEscaped && ch == '\\'); m_nIndex2++; m_nPos++; } return _getToken (true); } }
public class class_name { @Nullable private String _parseQuotedToken (final char cTerminator) { char ch; m_nIndex1 = m_nPos; m_nIndex2 = m_nPos; boolean bQuoted = false; boolean bCharEscaped = false; while (_hasChar ()) { ch = m_aChars[m_nPos]; // depends on control dependency: [while], data = [none] if (!bQuoted && cTerminator == ch) break; if (!bCharEscaped && ch == '"') bQuoted = !bQuoted; bCharEscaped = (!bCharEscaped && ch == '\\'); // depends on control dependency: [while], data = [none] m_nIndex2++; // depends on control dependency: [while], data = [none] m_nPos++; // depends on control dependency: [while], data = [none] } return _getToken (true); } }
public class class_name { void findHandlers(ListIterator<PathElement> iterator, String value, Notification notification, Collection<NotificationHandler> handlers) { NotificationHandlerNodeRegistry registry = childRegistries.get(value); if (registry != null) { registry.findEntries(iterator, handlers, notification); } // if a child registry exists for the wildcard, we traverse it too NotificationHandlerNodeRegistry wildCardRegistry = childRegistries.get(WILDCARD_VALUE); if (wildCardRegistry != null) { wildCardRegistry.findEntries(iterator, handlers, notification); } } }
public class class_name { void findHandlers(ListIterator<PathElement> iterator, String value, Notification notification, Collection<NotificationHandler> handlers) { NotificationHandlerNodeRegistry registry = childRegistries.get(value); if (registry != null) { registry.findEntries(iterator, handlers, notification); // depends on control dependency: [if], data = [none] } // if a child registry exists for the wildcard, we traverse it too NotificationHandlerNodeRegistry wildCardRegistry = childRegistries.get(WILDCARD_VALUE); if (wildCardRegistry != null) { wildCardRegistry.findEntries(iterator, handlers, notification); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public EClass getIfcMaterialClassificationRelationship() { if (ifcMaterialClassificationRelationshipEClass == null) { ifcMaterialClassificationRelationshipEClass = (EClass) EPackage.Registry.INSTANCE .getEPackage(Ifc4Package.eNS_URI).getEClassifiers().get(357); } return ifcMaterialClassificationRelationshipEClass; } }
public class class_name { @Override public EClass getIfcMaterialClassificationRelationship() { if (ifcMaterialClassificationRelationshipEClass == null) { ifcMaterialClassificationRelationshipEClass = (EClass) EPackage.Registry.INSTANCE .getEPackage(Ifc4Package.eNS_URI).getEClassifiers().get(357); // depends on control dependency: [if], data = [none] } return ifcMaterialClassificationRelationshipEClass; } }
public class class_name { public void marshall(RealtimeEndpointInfo realtimeEndpointInfo, ProtocolMarshaller protocolMarshaller) { if (realtimeEndpointInfo == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(realtimeEndpointInfo.getPeakRequestsPerSecond(), PEAKREQUESTSPERSECOND_BINDING); protocolMarshaller.marshall(realtimeEndpointInfo.getCreatedAt(), CREATEDAT_BINDING); protocolMarshaller.marshall(realtimeEndpointInfo.getEndpointUrl(), ENDPOINTURL_BINDING); protocolMarshaller.marshall(realtimeEndpointInfo.getEndpointStatus(), ENDPOINTSTATUS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RealtimeEndpointInfo realtimeEndpointInfo, ProtocolMarshaller protocolMarshaller) { if (realtimeEndpointInfo == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(realtimeEndpointInfo.getPeakRequestsPerSecond(), PEAKREQUESTSPERSECOND_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(realtimeEndpointInfo.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(realtimeEndpointInfo.getEndpointUrl(), ENDPOINTURL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(realtimeEndpointInfo.getEndpointStatus(), ENDPOINTSTATUS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(StopAutomationExecutionRequest stopAutomationExecutionRequest, ProtocolMarshaller protocolMarshaller) { if (stopAutomationExecutionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(stopAutomationExecutionRequest.getAutomationExecutionId(), AUTOMATIONEXECUTIONID_BINDING); protocolMarshaller.marshall(stopAutomationExecutionRequest.getType(), TYPE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(StopAutomationExecutionRequest stopAutomationExecutionRequest, ProtocolMarshaller protocolMarshaller) { if (stopAutomationExecutionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(stopAutomationExecutionRequest.getAutomationExecutionId(), AUTOMATIONEXECUTIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(stopAutomationExecutionRequest.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void uploadNewBundleFromInstances(List<BundleContentGenerator> generators, BundleType bundleType) throws IOException { // Generate bundle SupportBundle bundle = generateNewBundleFromInstances(generators, bundleType); boolean enabled = configuration.get(Constants.UPLOAD_ENABLED, Constants.DEFAULT_UPLOAD_ENABLED); String accessKey = configuration.get(Constants.UPLOAD_ACCESS, Constants.DEFAULT_UPLOAD_ACCESS); String secretKey = configuration.get(Constants.UPLOAD_SECRET, Constants.DEFAULT_UPLOAD_SECRET); String bucket = configuration.get(Constants.UPLOAD_BUCKET, Constants.DEFAULT_UPLOAD_BUCKET); int bufferSize = configuration.get(Constants.UPLOAD_BUFFER_SIZE, Constants.DEFAULT_UPLOAD_BUFFER_SIZE); if(!enabled) { throw new IOException("Uploading support bundles was disabled by administrator."); } AWSCredentialsProvider credentialsProvider = new StaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey)); AmazonS3Client s3Client = new AmazonS3Client(credentialsProvider, new ClientConfiguration()); s3Client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true)); s3Client.setRegion(Region.getRegion(Regions.US_WEST_2)); // Object Metadata ObjectMetadata s3Metadata = new ObjectMetadata(); for(Map.Entry<Object, Object> entry: getMetadata(bundleType).entrySet()) { s3Metadata.addUserMetadata((String)entry.getKey(), (String)entry.getValue()); } List<PartETag> partETags; InitiateMultipartUploadResult initResponse = null; try { // Uploading part by part LOG.info("Initiating multi-part support bundle upload"); partETags = new ArrayList<>(); InitiateMultipartUploadRequest initRequest = new InitiateMultipartUploadRequest(bucket, bundle.getBundleKey()); initRequest.setObjectMetadata(s3Metadata); initResponse = s3Client.initiateMultipartUpload(initRequest); } catch (AmazonClientException e) { LOG.error("Support bundle upload failed: ", e); throw new IOException("Support bundle upload failed", e); } try { byte[] buffer = new byte[bufferSize]; int partId = 1; int size = -1; while ((size = readFully(bundle.getInputStream(), buffer)) != -1) { LOG.debug("Uploading part {} of size {}", partId, size); UploadPartRequest uploadRequest = new UploadPartRequest() .withBucketName(bucket) .withKey(bundle.getBundleKey()) .withUploadId(initResponse.getUploadId()) .withPartNumber(partId++) .withInputStream(new ByteArrayInputStream(buffer)) .withPartSize(size); partETags.add(s3Client.uploadPart(uploadRequest).getPartETag()); } CompleteMultipartUploadRequest compRequest = new CompleteMultipartUploadRequest( bucket, bundle.getBundleKey(), initResponse.getUploadId(), partETags ); s3Client.completeMultipartUpload(compRequest); LOG.info("Support bundle upload finished"); } catch (Exception e) { LOG.error("Support bundle upload failed", e); s3Client.abortMultipartUpload(new AbortMultipartUploadRequest( bucket, bundle.getBundleKey(), initResponse.getUploadId()) ); throw new IOException("Can't upload support bundle", e); } finally { // Close the client s3Client.shutdown(); } } }
public class class_name { public void uploadNewBundleFromInstances(List<BundleContentGenerator> generators, BundleType bundleType) throws IOException { // Generate bundle SupportBundle bundle = generateNewBundleFromInstances(generators, bundleType); boolean enabled = configuration.get(Constants.UPLOAD_ENABLED, Constants.DEFAULT_UPLOAD_ENABLED); String accessKey = configuration.get(Constants.UPLOAD_ACCESS, Constants.DEFAULT_UPLOAD_ACCESS); String secretKey = configuration.get(Constants.UPLOAD_SECRET, Constants.DEFAULT_UPLOAD_SECRET); String bucket = configuration.get(Constants.UPLOAD_BUCKET, Constants.DEFAULT_UPLOAD_BUCKET); int bufferSize = configuration.get(Constants.UPLOAD_BUFFER_SIZE, Constants.DEFAULT_UPLOAD_BUFFER_SIZE); if(!enabled) { throw new IOException("Uploading support bundles was disabled by administrator."); } AWSCredentialsProvider credentialsProvider = new StaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey)); AmazonS3Client s3Client = new AmazonS3Client(credentialsProvider, new ClientConfiguration()); s3Client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true)); s3Client.setRegion(Region.getRegion(Regions.US_WEST_2)); // Object Metadata ObjectMetadata s3Metadata = new ObjectMetadata(); for(Map.Entry<Object, Object> entry: getMetadata(bundleType).entrySet()) { s3Metadata.addUserMetadata((String)entry.getKey(), (String)entry.getValue()); } List<PartETag> partETags; InitiateMultipartUploadResult initResponse = null; try { // Uploading part by part LOG.info("Initiating multi-part support bundle upload"); partETags = new ArrayList<>(); InitiateMultipartUploadRequest initRequest = new InitiateMultipartUploadRequest(bucket, bundle.getBundleKey()); initRequest.setObjectMetadata(s3Metadata); initResponse = s3Client.initiateMultipartUpload(initRequest); } catch (AmazonClientException e) { LOG.error("Support bundle upload failed: ", e); throw new IOException("Support bundle upload failed", e); } try { byte[] buffer = new byte[bufferSize]; int partId = 1; int size = -1; while ((size = readFully(bundle.getInputStream(), buffer)) != -1) { LOG.debug("Uploading part {} of size {}", partId, size); // depends on control dependency: [while], data = [none] UploadPartRequest uploadRequest = new UploadPartRequest() .withBucketName(bucket) .withKey(bundle.getBundleKey()) .withUploadId(initResponse.getUploadId()) .withPartNumber(partId++) .withInputStream(new ByteArrayInputStream(buffer)) .withPartSize(size); partETags.add(s3Client.uploadPart(uploadRequest).getPartETag()); // depends on control dependency: [while], data = [none] } CompleteMultipartUploadRequest compRequest = new CompleteMultipartUploadRequest( bucket, bundle.getBundleKey(), initResponse.getUploadId(), partETags ); s3Client.completeMultipartUpload(compRequest); LOG.info("Support bundle upload finished"); } catch (Exception e) { LOG.error("Support bundle upload failed", e); s3Client.abortMultipartUpload(new AbortMultipartUploadRequest( bucket, bundle.getBundleKey(), initResponse.getUploadId()) ); throw new IOException("Can't upload support bundle", e); } finally { // Close the client s3Client.shutdown(); } } }
public class class_name { public static void rcvXACommit(CommsByteBuffer request, Conversation conversation, int requestNumber, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvXACommit", new Object[] { request, conversation, ""+requestNumber, ""+allocatedFromBufferPool, ""+partOfExchange }); ConversationState convState = (ConversationState) conversation.getAttachment(); ServerLinkLevelState linkState = (ServerLinkLevelState) conversation.getLinkLevelAttachment(); boolean onePhase = false; final boolean optimizedTx = CommsUtils.requiresOptimizedTransaction(conversation); try { int clientTransactionId = request.getInt(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "XAResource Object ID", clientTransactionId); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Getting Xid"); XidProxy xid = (XidProxy) request.getXid(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Completed:", xid); byte onePhaseByte = request.get(); if (onePhaseByte == 1) onePhase = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "One phase:", onePhase); boolean endRequired = false; int endFlags = 0; if (optimizedTx) { endRequired = request.get() == 0x01; endFlags = request.getInt(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "End Required:", ""+endRequired); SibTr.debug(tc, "End Flags:", ""+endFlags); } } boolean requiresMSResource = false; if (conversation.getHandshakeProperties().getFapLevel() >= JFapChannelConstants.FAP_VERSION_5) { requiresMSResource = request.get() == 0x01; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Requires MS Resource:", ""+requiresMSResource); } // Get the transaction out of the table IdToTransactionTable transactionTable = linkState.getTransactionTable(); if (endRequired) transactionTable.endOptimizedGlobalTransactionBranch(clientTransactionId, endFlags); SITransaction tran = null; // As commits (for the same XAResource) can be scheduled concurrently by the receive listener // dispatcher - perform all updates to the IdToTransaction table inside a synchronized block. boolean isInvalidTransaction = false; boolean isUnitOfWorkInError = false; Throwable rollbackException = null; synchronized(transactionTable) { tran = transactionTable.getResourceForGlobalTransactionBranch(clientTransactionId, xid); if (tran != null) { isInvalidTransaction = tran == IdToTransactionTable.INVALID_TRANSACTION; if (!isInvalidTransaction) { isUnitOfWorkInError = transactionTable.isGlobalTransactionBranchRollbackOnly(clientTransactionId, xid); } if (isInvalidTransaction || isUnitOfWorkInError) { rollbackException = transactionTable.getExceptionForRollbackOnlyGlobalTransactionBranch(clientTransactionId, xid); } // Leave the invalid transaction in the table. The only way to remove it is to // roll it back. if (!isInvalidTransaction) { transactionTable.removeGlobalTransactionBranch(clientTransactionId, xid); } } } SIXAResource xaResource = getResourceFromTran(tran, convState, requiresMSResource); // If the UOW was never created (because we were running with the // optimization that gets an XAResource and enlists it as part of the // first piece of transacted work and this failed) then throw // an exception notifying the caller that the UOW has been rolled back. if (isInvalidTransaction) { String errorMsg = nls.getFormattedMessage("TRANSACTION_MARKED_AS_ERROR_SICO2029", new Object[]{ rollbackException }, null); XAException xa = new XAException(errorMsg); xa.initCause(rollbackException); xa.errorCode = XAException.XA_RBOTHER; throw xa; } if (isUnitOfWorkInError) { // PK59276 Rollback the transaction, as after we throw a XA_RB* error the // transaction manager will not call us with xa_rollback. xaResource.rollback(xid); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "The transaction was marked as error due to", rollbackException); // And respond with an error XAException xa = new XAException( nls.getFormattedMessage("TRANSACTION_MARKED_AS_ERROR_SICO2029", new Object[]{ rollbackException }, null) ); xa.initCause(rollbackException); xa.errorCode = XAException.XA_RBOTHER; throw xa; } // Now call the method on the XA resource xaResource.commit(xid, onePhase); try { conversation.send(poolManager.allocate(), JFapChannelConstants.SEG_XACOMMIT_R, requestNumber, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD, null); } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvXACommit", CommsConstants.STATICCATXATRANSACTION_XACOMMIT_01); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2027", e); } } catch (XAException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvXACommit", CommsConstants.STATICCATXATRANSACTION_XACOMMIT_02); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "XAException - RC: " + e.errorCode, e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.STATICCATXATRANSACTION_XACOMMIT_02, // d186970 conversation, requestNumber); } request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvXACommit"); } }
public class class_name { public static void rcvXACommit(CommsByteBuffer request, Conversation conversation, int requestNumber, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "rcvXACommit", new Object[] { request, conversation, ""+requestNumber, ""+allocatedFromBufferPool, ""+partOfExchange }); ConversationState convState = (ConversationState) conversation.getAttachment(); ServerLinkLevelState linkState = (ServerLinkLevelState) conversation.getLinkLevelAttachment(); boolean onePhase = false; final boolean optimizedTx = CommsUtils.requiresOptimizedTransaction(conversation); try { int clientTransactionId = request.getInt(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "XAResource Object ID", clientTransactionId); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Getting Xid"); XidProxy xid = (XidProxy) request.getXid(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Completed:", xid); byte onePhaseByte = request.get(); if (onePhaseByte == 1) onePhase = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "One phase:", onePhase); boolean endRequired = false; int endFlags = 0; if (optimizedTx) { endRequired = request.get() == 0x01; // depends on control dependency: [if], data = [none] endFlags = request.getInt(); // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "End Required:", ""+endRequired); // depends on control dependency: [if], data = [none] SibTr.debug(tc, "End Flags:", ""+endFlags); // depends on control dependency: [if], data = [none] } } boolean requiresMSResource = false; if (conversation.getHandshakeProperties().getFapLevel() >= JFapChannelConstants.FAP_VERSION_5) { requiresMSResource = request.get() == 0x01; // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Requires MS Resource:", ""+requiresMSResource); } // Get the transaction out of the table IdToTransactionTable transactionTable = linkState.getTransactionTable(); if (endRequired) transactionTable.endOptimizedGlobalTransactionBranch(clientTransactionId, endFlags); SITransaction tran = null; // As commits (for the same XAResource) can be scheduled concurrently by the receive listener // dispatcher - perform all updates to the IdToTransaction table inside a synchronized block. boolean isInvalidTransaction = false; boolean isUnitOfWorkInError = false; Throwable rollbackException = null; synchronized(transactionTable) // depends on control dependency: [try], data = [none] { tran = transactionTable.getResourceForGlobalTransactionBranch(clientTransactionId, xid); if (tran != null) { isInvalidTransaction = tran == IdToTransactionTable.INVALID_TRANSACTION; // depends on control dependency: [if], data = [none] if (!isInvalidTransaction) { isUnitOfWorkInError = transactionTable.isGlobalTransactionBranchRollbackOnly(clientTransactionId, xid); // depends on control dependency: [if], data = [none] } if (isInvalidTransaction || isUnitOfWorkInError) { rollbackException = transactionTable.getExceptionForRollbackOnlyGlobalTransactionBranch(clientTransactionId, xid); // depends on control dependency: [if], data = [none] } // Leave the invalid transaction in the table. The only way to remove it is to // roll it back. if (!isInvalidTransaction) { transactionTable.removeGlobalTransactionBranch(clientTransactionId, xid); // depends on control dependency: [if], data = [none] } } } SIXAResource xaResource = getResourceFromTran(tran, convState, requiresMSResource); // If the UOW was never created (because we were running with the // optimization that gets an XAResource and enlists it as part of the // first piece of transacted work and this failed) then throw // an exception notifying the caller that the UOW has been rolled back. if (isInvalidTransaction) { String errorMsg = nls.getFormattedMessage("TRANSACTION_MARKED_AS_ERROR_SICO2029", new Object[]{ rollbackException }, null); XAException xa = new XAException(errorMsg); xa.initCause(rollbackException); // depends on control dependency: [if], data = [none] xa.errorCode = XAException.XA_RBOTHER; // depends on control dependency: [if], data = [none] throw xa; } if (isUnitOfWorkInError) { // PK59276 Rollback the transaction, as after we throw a XA_RB* error the // transaction manager will not call us with xa_rollback. xaResource.rollback(xid); // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "The transaction was marked as error due to", rollbackException); // And respond with an error XAException xa = new XAException( nls.getFormattedMessage("TRANSACTION_MARKED_AS_ERROR_SICO2029", new Object[]{ rollbackException }, null) ); xa.initCause(rollbackException); // depends on control dependency: [if], data = [none] xa.errorCode = XAException.XA_RBOTHER; // depends on control dependency: [if], data = [none] throw xa; } // Now call the method on the XA resource xaResource.commit(xid, onePhase); // depends on control dependency: [try], data = [none] try { conversation.send(poolManager.allocate(), JFapChannelConstants.SEG_XACOMMIT_R, requestNumber, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD, null); // depends on control dependency: [try], data = [none] } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvXACommit", CommsConstants.STATICCATXATRANSACTION_XACOMMIT_01); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2027", e); } // depends on control dependency: [catch], data = [none] } catch (XAException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvXACommit", CommsConstants.STATICCATXATRANSACTION_XACOMMIT_02); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "XAException - RC: " + e.errorCode, e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.STATICCATXATRANSACTION_XACOMMIT_02, // d186970 conversation, requestNumber); } // depends on control dependency: [catch], data = [none] request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "rcvXACommit"); } }
public class class_name { private static int finalizeConverter( char c, String pattern, int i, final StringBuffer currentLiteral, final ExtrasFormattingInfo formattingInfo, final Map converterRegistry, final Map rules, final List patternConverters, final List formattingInfos) { StringBuffer convBuf = new StringBuffer(); i = extractConverter(c, pattern, i, convBuf, currentLiteral); String converterId = convBuf.toString(); List options = new ArrayList(); i = extractOptions(pattern, i, options); PatternConverter pc = createConverter( converterId, currentLiteral, converterRegistry, rules, options); if (pc == null) { StringBuffer msg; if (converterId.length() == 0) { msg = new StringBuffer("Empty conversion specifier starting at position "); } else { msg = new StringBuffer("Unrecognized conversion specifier ["); msg.append(converterId); msg.append("] starting at position "); } msg.append(Integer.toString(i)); msg.append(" in conversion pattern."); LogLog.error(msg.toString()); patternConverters.add( new LiteralPatternConverter(currentLiteral.toString())); formattingInfos.add(ExtrasFormattingInfo.getDefault()); } else { patternConverters.add(pc); formattingInfos.add(formattingInfo); if (currentLiteral.length() > 0) { patternConverters.add( new LiteralPatternConverter(currentLiteral.toString())); formattingInfos.add(ExtrasFormattingInfo.getDefault()); } } currentLiteral.setLength(0); return i; } }
public class class_name { private static int finalizeConverter( char c, String pattern, int i, final StringBuffer currentLiteral, final ExtrasFormattingInfo formattingInfo, final Map converterRegistry, final Map rules, final List patternConverters, final List formattingInfos) { StringBuffer convBuf = new StringBuffer(); i = extractConverter(c, pattern, i, convBuf, currentLiteral); String converterId = convBuf.toString(); List options = new ArrayList(); i = extractOptions(pattern, i, options); PatternConverter pc = createConverter( converterId, currentLiteral, converterRegistry, rules, options); if (pc == null) { StringBuffer msg; if (converterId.length() == 0) { msg = new StringBuffer("Empty conversion specifier starting at position "); // depends on control dependency: [if], data = [none] } else { msg = new StringBuffer("Unrecognized conversion specifier ["); // depends on control dependency: [if], data = [none] msg.append(converterId); // depends on control dependency: [if], data = [none] msg.append("] starting at position "); // depends on control dependency: [if], data = [none] } msg.append(Integer.toString(i)); // depends on control dependency: [if], data = [none] msg.append(" in conversion pattern."); // depends on control dependency: [if], data = [none] LogLog.error(msg.toString()); // depends on control dependency: [if], data = [none] patternConverters.add( new LiteralPatternConverter(currentLiteral.toString())); // depends on control dependency: [if], data = [none] formattingInfos.add(ExtrasFormattingInfo.getDefault()); // depends on control dependency: [if], data = [none] } else { patternConverters.add(pc); // depends on control dependency: [if], data = [(pc] formattingInfos.add(formattingInfo); // depends on control dependency: [if], data = [none] if (currentLiteral.length() > 0) { patternConverters.add( new LiteralPatternConverter(currentLiteral.toString())); // depends on control dependency: [if], data = [none] formattingInfos.add(ExtrasFormattingInfo.getDefault()); // depends on control dependency: [if], data = [none] } } currentLiteral.setLength(0); return i; } }
public class class_name { public static boolean validateValidWhen( Object bean, ValidatorAction va, Field field, ActionMessages errors, HttpServletRequest request, ServletContext servletContext ) { String value; if ( isString( bean ) ) { value = ( String ) bean; } else { value = ValidatorUtil.getValueAsString( bean, field.getProperty() ); } if ( ! GenericValidator.isBlankOrNull( value ) ) { String condition = field.getVarValue( "netui_validwhen" ); try { if ( ! InternalExpressionUtils.evaluateCondition( condition, bean, request, servletContext ) ) { errors.add( field.getKey(), Resources.getActionError( request, va, field ) ); return false; } } catch ( Exception e ) { _log.error( "Error evaluating expression " + condition + " for ValidWhen rule on field " + field.getProperty() + " on bean of type " + ( bean != null ? bean.getClass().getName() : null ) ); errors.add( field.getKey(), Resources.getActionError( request, va, field ) ); return false; } } return true; } }
public class class_name { public static boolean validateValidWhen( Object bean, ValidatorAction va, Field field, ActionMessages errors, HttpServletRequest request, ServletContext servletContext ) { String value; if ( isString( bean ) ) { value = ( String ) bean; // depends on control dependency: [if], data = [none] } else { value = ValidatorUtil.getValueAsString( bean, field.getProperty() ); // depends on control dependency: [if], data = [none] } if ( ! GenericValidator.isBlankOrNull( value ) ) { String condition = field.getVarValue( "netui_validwhen" ); try { if ( ! InternalExpressionUtils.evaluateCondition( condition, bean, request, servletContext ) ) { errors.add( field.getKey(), Resources.getActionError( request, va, field ) ); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } catch ( Exception e ) { _log.error( "Error evaluating expression " + condition + " for ValidWhen rule on field " + field.getProperty() + " on bean of type " + ( bean != null ? bean.getClass().getName() : null ) ); errors.add( field.getKey(), Resources.getActionError( request, va, field ) ); return false; } // depends on control dependency: [catch], data = [none] } return true; } }
public class class_name { private static void parse(final Reader r) throws IOException { final BufferedReader br = new BufferedReader(r); String line; final ArrayList<String> sequence = new ArrayList<String>(); line = br.readLine(); while (true) { if (line == null) { break; } line = line.trim(); if (line.length() == 0 || line.charAt(0) == '#') { line = br.readLine(); continue; } sequence.add(line); // read the following lines until a line does not begin with '>' or // EOF while (true) { line = br.readLine(); if (line == null) { addEntry(sequence); sequence.clear(); break; } line = line.trim(); if (line.length() == 0 || line.charAt(0) == '#') { continue; } if (line.charAt(0) != '>') { addEntry(sequence); sequence.clear(); break; } sequence.add(line); } } if (!sequence.isEmpty()) { addEntry(sequence); } } }
public class class_name { private static void parse(final Reader r) throws IOException { final BufferedReader br = new BufferedReader(r); String line; final ArrayList<String> sequence = new ArrayList<String>(); line = br.readLine(); while (true) { if (line == null) { break; } line = line.trim(); if (line.length() == 0 || line.charAt(0) == '#') { line = br.readLine(); // depends on control dependency: [if], data = [none] continue; } sequence.add(line); // read the following lines until a line does not begin with '>' or // EOF while (true) { line = br.readLine(); // depends on control dependency: [while], data = [none] if (line == null) { addEntry(sequence); // depends on control dependency: [if], data = [none] sequence.clear(); // depends on control dependency: [if], data = [none] break; } line = line.trim(); // depends on control dependency: [while], data = [none] if (line.length() == 0 || line.charAt(0) == '#') { continue; } if (line.charAt(0) != '>') { addEntry(sequence); // depends on control dependency: [if], data = [none] sequence.clear(); // depends on control dependency: [if], data = [none] break; } sequence.add(line); // depends on control dependency: [while], data = [none] } } if (!sequence.isEmpty()) { addEntry(sequence); } } }
public class class_name { public static String getAsString(Type type) { String result = null; if(isSimple(type)) { result = ((Class<?>)type).getCanonicalName(); } else if(isGeneric(type)) { StringBuilder buffer = new StringBuilder(); // grab the name of the container class (e.g. List, Map...) ParameterizedType container = (ParameterizedType)type ; String containerType = ((Class<?>)container.getRawType()).getCanonicalName(); buffer.append(containerType).append("<"); // now grab the names of all generic types (those within <...>) Type[] generics = container.getActualTypeArguments(); boolean first = true; for(Type generic : generics) { String genericType = getAsString(generic); buffer.append(first ? "" : ", ").append(genericType); first = false; } buffer.append(">"); result = buffer.toString(); } return result; } }
public class class_name { public static String getAsString(Type type) { String result = null; if(isSimple(type)) { result = ((Class<?>)type).getCanonicalName(); // depends on control dependency: [if], data = [none] } else if(isGeneric(type)) { StringBuilder buffer = new StringBuilder(); // grab the name of the container class (e.g. List, Map...) ParameterizedType container = (ParameterizedType)type ; String containerType = ((Class<?>)container.getRawType()).getCanonicalName(); buffer.append(containerType).append("<"); // depends on control dependency: [if], data = [none] // now grab the names of all generic types (those within <...>) Type[] generics = container.getActualTypeArguments(); boolean first = true; for(Type generic : generics) { String genericType = getAsString(generic); buffer.append(first ? "" : ", ").append(genericType); // depends on control dependency: [for], data = [generic] first = false; // depends on control dependency: [for], data = [none] } buffer.append(">"); // depends on control dependency: [if], data = [none] result = buffer.toString(); // depends on control dependency: [if], data = [none] } return result; } }