code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public static PropertyEditorFinder getInstance(ClassLoader classLoader) { PropertyEditorFinder result = _INSTANCE; if (result == null) { synchronized (_LOCK) { result = _INSTANCE; if (result == null) { init(classLoader); result = _INSTANCE; } } } return result; } }
public class class_name { public static PropertyEditorFinder getInstance(ClassLoader classLoader) { PropertyEditorFinder result = _INSTANCE; if (result == null) { synchronized (_LOCK) { // depends on control dependency: [if], data = [none] result = _INSTANCE; if (result == null) { init(classLoader); // depends on control dependency: [if], data = [none] result = _INSTANCE; // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { protected boolean mergeSegments() { // See if merging will cause a degenerate case if( splits.size() <= 3 ) return false; boolean change = false; work.reset(); for( int i = 0; i < splits.size; i++ ) { int start = splits.data[i]; int end = splits.data[(i+2)%splits.size]; if( selectSplitOffset(start,circularDistance(start,end)) < 0 ) { // merge the two lines by not adding it change = true; } else { work.add(splits.data[(i + 1)%splits.size]); } } // swap the two lists GrowQueue_I32 tmp = work; work = splits; splits = tmp; return change; } }
public class class_name { protected boolean mergeSegments() { // See if merging will cause a degenerate case if( splits.size() <= 3 ) return false; boolean change = false; work.reset(); for( int i = 0; i < splits.size; i++ ) { int start = splits.data[i]; int end = splits.data[(i+2)%splits.size]; if( selectSplitOffset(start,circularDistance(start,end)) < 0 ) { // merge the two lines by not adding it change = true; // depends on control dependency: [if], data = [none] } else { work.add(splits.data[(i + 1)%splits.size]); // depends on control dependency: [if], data = [none] } } // swap the two lists GrowQueue_I32 tmp = work; work = splits; splits = tmp; return change; } }
public class class_name { public Map<String, String> getPrefixes(boolean onlyCommonPrefixes) { final Map<String, String> prefixes = new LinkedHashMap<String, String>(); for (final String term : termDefinitions.keySet()) { if (term.contains(":")) { continue; } final Map<String, Object> termDefinition = (Map<String, Object>) termDefinitions .get(term); if (termDefinition == null) { continue; } final String id = (String) termDefinition.get(JsonLdConsts.ID); if (id == null) { continue; } if (term.startsWith("@") || id.startsWith("@")) { continue; } if (!onlyCommonPrefixes || id.endsWith("/") || id.endsWith("#")) { prefixes.put(term, id); } } return prefixes; } }
public class class_name { public Map<String, String> getPrefixes(boolean onlyCommonPrefixes) { final Map<String, String> prefixes = new LinkedHashMap<String, String>(); for (final String term : termDefinitions.keySet()) { if (term.contains(":")) { continue; } final Map<String, Object> termDefinition = (Map<String, Object>) termDefinitions .get(term); if (termDefinition == null) { continue; } final String id = (String) termDefinition.get(JsonLdConsts.ID); if (id == null) { continue; } if (term.startsWith("@") || id.startsWith("@")) { continue; } if (!onlyCommonPrefixes || id.endsWith("/") || id.endsWith("#")) { prefixes.put(term, id); // depends on control dependency: [if], data = [none] } } return prefixes; } }
public class class_name { public JTSGeometryExpression<Geometry> convexHull() { if (convexHull == null) { convexHull = JTSGeometryExpressions.geometryOperation(SpatialOps.CONVEXHULL, mixin); } return convexHull; } }
public class class_name { public JTSGeometryExpression<Geometry> convexHull() { if (convexHull == null) { convexHull = JTSGeometryExpressions.geometryOperation(SpatialOps.CONVEXHULL, mixin); // depends on control dependency: [if], data = [none] } return convexHull; } }
public class class_name { private Field[] getAllInstanceFields(final Object obj) { Field[] fields = instanceFieldsByClass.get(obj.getClass()); if (fields == null) { List<Field> fieldList = ReflectionUtil. getAllFields(obj, excludeStatic, excludeTransient); fields = fieldList.toArray(new Field[fieldList.size()]); instanceFieldsByClass.put(obj.getClass(), fields); } return fields; } }
public class class_name { private Field[] getAllInstanceFields(final Object obj) { Field[] fields = instanceFieldsByClass.get(obj.getClass()); if (fields == null) { List<Field> fieldList = ReflectionUtil. getAllFields(obj, excludeStatic, excludeTransient); fields = fieldList.toArray(new Field[fieldList.size()]); // depends on control dependency: [if], data = [none] instanceFieldsByClass.put(obj.getClass(), fields); // depends on control dependency: [if], data = [none] } return fields; } }
public class class_name { static boolean isValidMonth(@Nullable String monthString) { if (monthString == null) { return false; } try { int monthInt = Integer.parseInt(monthString); return monthInt > 0 && monthInt <= 12; } catch (NumberFormatException numEx) { return false; } } }
public class class_name { static boolean isValidMonth(@Nullable String monthString) { if (monthString == null) { return false; // depends on control dependency: [if], data = [none] } try { int monthInt = Integer.parseInt(monthString); return monthInt > 0 && monthInt <= 12; // depends on control dependency: [try], data = [none] } catch (NumberFormatException numEx) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void setupAuthMode() { String apiKey = getStringProperty(P_APIKEY); if (Strings.isNullOrEmpty(apiKey)) { // try to use the user/pass mode instead forceUserPassAuthMode(getStringProperty(P_USERNAME), getStringProperty(P_PASSWORD)); } else { // ok the key is present, let's use it forceKeyAuthMode(apiKey); } } }
public class class_name { private void setupAuthMode() { String apiKey = getStringProperty(P_APIKEY); if (Strings.isNullOrEmpty(apiKey)) { // try to use the user/pass mode instead forceUserPassAuthMode(getStringProperty(P_USERNAME), getStringProperty(P_PASSWORD)); // depends on control dependency: [if], data = [none] } else { // ok the key is present, let's use it forceKeyAuthMode(apiKey); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void highlightConsecutiveIdentifiers(List<Integer> hashes, boolean backward) { final int startPos = highlightFirstIdentifier(hashes.get(0), backward); if (startPos >= 0) { highlightRemainingIdentifiers(hashes.subList(1, hashes.size()), startPos); } } }
public class class_name { public void highlightConsecutiveIdentifiers(List<Integer> hashes, boolean backward) { final int startPos = highlightFirstIdentifier(hashes.get(0), backward); if (startPos >= 0) { highlightRemainingIdentifiers(hashes.subList(1, hashes.size()), startPos); // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressLint("RestrictedApi") public static void hideStatusBar(Context context) { if (Jzvd.TOOL_BAR_EXIST) { JZUtils.getWindow(context).setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } } }
public class class_name { @SuppressLint("RestrictedApi") public static void hideStatusBar(Context context) { if (Jzvd.TOOL_BAR_EXIST) { JZUtils.getWindow(context).setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setNetworkProtocol(java.util.Collection<StringFilter> networkProtocol) { if (networkProtocol == null) { this.networkProtocol = null; return; } this.networkProtocol = new java.util.ArrayList<StringFilter>(networkProtocol); } }
public class class_name { public void setNetworkProtocol(java.util.Collection<StringFilter> networkProtocol) { if (networkProtocol == null) { this.networkProtocol = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.networkProtocol = new java.util.ArrayList<StringFilter>(networkProtocol); } }
public class class_name { public synchronized UserAgent getUserAgent() { if (this.userAgent == null) { if (isService) { this.userAgent = new UserAgent( this.serviceName, this.projectId, this.sslEnabled, this.nfvoIp, this.nfvoPort, this.version, this.serviceKey); } else { this.userAgent = new UserAgent( this.username, this.password, this.projectId, this.sslEnabled, this.nfvoIp, this.nfvoPort, this.version); } } return this.userAgent; } }
public class class_name { public synchronized UserAgent getUserAgent() { if (this.userAgent == null) { if (isService) { this.userAgent = new UserAgent( this.serviceName, this.projectId, this.sslEnabled, this.nfvoIp, this.nfvoPort, this.version, this.serviceKey); // depends on control dependency: [if], data = [none] } else { this.userAgent = new UserAgent( this.username, this.password, this.projectId, this.sslEnabled, this.nfvoIp, this.nfvoPort, this.version); // depends on control dependency: [if], data = [none] } } return this.userAgent; } }
public class class_name { public String getClassIdentity(XEvent event) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < keys.length; i++) { XAttribute attribute = event.getAttributes().get(keys[i]); // if (attribute == null) { // return null; // } if (attribute != null) { sb.append(attribute.toString().trim()); } if (i < (keys.length - 1)) { sb.append("+"); } } return sb.toString(); } }
public class class_name { public String getClassIdentity(XEvent event) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < keys.length; i++) { XAttribute attribute = event.getAttributes().get(keys[i]); // if (attribute == null) { // return null; // } if (attribute != null) { sb.append(attribute.toString().trim()); // depends on control dependency: [if], data = [(attribute] } if (i < (keys.length - 1)) { sb.append("+"); // depends on control dependency: [if], data = [none] } } return sb.toString(); } }
public class class_name { public static void close(ParcelFileDescriptor descriptor) { if (descriptor == null) { return; } try { descriptor.close(); } catch (IOException e) { Log.e(TAG, "something went wrong on close descriptor: ", e); } } }
public class class_name { public static void close(ParcelFileDescriptor descriptor) { if (descriptor == null) { return; // depends on control dependency: [if], data = [none] } try { descriptor.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { Log.e(TAG, "something went wrong on close descriptor: ", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void copyStream(InputStream inputStream) throws IOException { OutputStream outputStream = null; try { outputStream = getContext().getOutputStream(); byte[] buffer = new byte[65535]; int bufferLen; int totalLen = 0; while ((bufferLen = inputStream.read(buffer)) > 0) { outputStream.write(buffer, 0, bufferLen); totalLen += bufferLen; } getContext().getResponse().setContentLength(totalLen); } finally { if (outputStream != null) { outputStream.flush(); } } } }
public class class_name { private void copyStream(InputStream inputStream) throws IOException { OutputStream outputStream = null; try { outputStream = getContext().getOutputStream(); byte[] buffer = new byte[65535]; int bufferLen; int totalLen = 0; while ((bufferLen = inputStream.read(buffer)) > 0) { outputStream.write(buffer, 0, bufferLen); // depends on control dependency: [while], data = [none] totalLen += bufferLen; // depends on control dependency: [while], data = [none] } getContext().getResponse().setContentLength(totalLen); } finally { if (outputStream != null) { outputStream.flush(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Nullable static ExecutableElement findLargestPublicConstructor(TypeElement typeElement) { List<ExecutableElement> constructors = FluentIterable.from(ElementFilter.constructorsIn(typeElement.getEnclosedElements())) .filter(FILTER_NON_PUBLIC) .toList(); if (constructors.size() == 0) { return null; } return PARAMETER_COUNT_ORDER.max(constructors); } }
public class class_name { @Nullable static ExecutableElement findLargestPublicConstructor(TypeElement typeElement) { List<ExecutableElement> constructors = FluentIterable.from(ElementFilter.constructorsIn(typeElement.getEnclosedElements())) .filter(FILTER_NON_PUBLIC) .toList(); if (constructors.size() == 0) { return null; // depends on control dependency: [if], data = [none] } return PARAMETER_COUNT_ORDER.max(constructors); } }
public class class_name { @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException { boolean responseSet = false; boolean validRequest = Arrays.asList( CSS_STYLESHEET, BANNER_IMAGE ).contains( req.getServletPath()); if( ! validRequest ) this.logger.severe( "An unexpected resource was asked to Roboconf's interception servlet: " + req.getServletPath()); // If the resource exists in the Karaf ETC directory, then use it. if( ! Utils.isEmptyOrWhitespaces( this.karafEtc )) { File resource = null; if( CSS_STYLESHEET.equals( req.getServletPath())) resource = new File( this.karafEtc, OVERRIDE_CSS ); else if( BANNER_IMAGE.equals( req.getServletPath())) resource = new File( this.karafEtc, OVERRIDE_IMAGE ); if( resource != null && resource.isFile()) { this.logger.fine( "A custom resource was found for " + req.getServletPath()); Utils.copyStream( resource, resp.getOutputStream()); responseSet = true; } } // Otherwise, return the default file if( validRequest && ! responseSet ) { InputStream in = getServletContext().getResourceAsStream( req.getServletPath()); try { if( in != null ) { Utils.copyStreamUnsafelyUseWithCaution( in, resp.getOutputStream()); responseSet = true; } } finally { Utils.closeQuietly( in ); } } // Complete the result if necessary if( ! responseSet ) { if( validRequest ) resp.sendError( HttpServletResponse.SC_NOT_FOUND ); else resp.sendError( HttpServletResponse.SC_FORBIDDEN ); } } }
public class class_name { @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException { boolean responseSet = false; boolean validRequest = Arrays.asList( CSS_STYLESHEET, BANNER_IMAGE ).contains( req.getServletPath()); if( ! validRequest ) this.logger.severe( "An unexpected resource was asked to Roboconf's interception servlet: " + req.getServletPath()); // If the resource exists in the Karaf ETC directory, then use it. if( ! Utils.isEmptyOrWhitespaces( this.karafEtc )) { File resource = null; if( CSS_STYLESHEET.equals( req.getServletPath())) resource = new File( this.karafEtc, OVERRIDE_CSS ); else if( BANNER_IMAGE.equals( req.getServletPath())) resource = new File( this.karafEtc, OVERRIDE_IMAGE ); if( resource != null && resource.isFile()) { this.logger.fine( "A custom resource was found for " + req.getServletPath()); // depends on control dependency: [if], data = [none] Utils.copyStream( resource, resp.getOutputStream()); // depends on control dependency: [if], data = [( resource] responseSet = true; // depends on control dependency: [if], data = [none] } } // Otherwise, return the default file if( validRequest && ! responseSet ) { InputStream in = getServletContext().getResourceAsStream( req.getServletPath()); try { if( in != null ) { Utils.copyStreamUnsafelyUseWithCaution( in, resp.getOutputStream()); // depends on control dependency: [if], data = [( in] responseSet = true; // depends on control dependency: [if], data = [none] } } finally { Utils.closeQuietly( in ); } } // Complete the result if necessary if( ! responseSet ) { if( validRequest ) resp.sendError( HttpServletResponse.SC_NOT_FOUND ); else resp.sendError( HttpServletResponse.SC_FORBIDDEN ); } } }
public class class_name { private Bitmap getBitmap(int layer) { Bitmap bitmap = layeredBitmap[layer]; if (bitmap == null) { createBitmapAndCanvas(layer); bitmap = layeredBitmap[layer]; } return bitmap; } }
public class class_name { private Bitmap getBitmap(int layer) { Bitmap bitmap = layeredBitmap[layer]; if (bitmap == null) { createBitmapAndCanvas(layer); // depends on control dependency: [if], data = [none] bitmap = layeredBitmap[layer]; // depends on control dependency: [if], data = [none] } return bitmap; } }
public class class_name { public void setRolloffFactor (float rolloff) { if (_rolloffFactor != rolloff) { AL10.alSourcef(_id, AL10.AL_ROLLOFF_FACTOR, _rolloffFactor = rolloff); } } }
public class class_name { public void setRolloffFactor (float rolloff) { if (_rolloffFactor != rolloff) { AL10.alSourcef(_id, AL10.AL_ROLLOFF_FACTOR, _rolloffFactor = rolloff); // depends on control dependency: [if], data = [rolloff)] } } }
public class class_name { private double[][] computeLookupADC(double[] queryVector) { double[][] distances = new double[numSubVectors][numProductCentroids]; for (int i = 0; i < numSubVectors; i++) { int subvectorStart = i * subVectorLength; for (int j = 0; j < numProductCentroids; j++) { for (int k = 0; k < subVectorLength; k++) { distances[i][j] += (queryVector[subvectorStart + k] - productQuantizer[i][j][k]) * (queryVector[subvectorStart + k] - productQuantizer[i][j][k]); } } } return distances; } }
public class class_name { private double[][] computeLookupADC(double[] queryVector) { double[][] distances = new double[numSubVectors][numProductCentroids]; for (int i = 0; i < numSubVectors; i++) { int subvectorStart = i * subVectorLength; for (int j = 0; j < numProductCentroids; j++) { for (int k = 0; k < subVectorLength; k++) { distances[i][j] += (queryVector[subvectorStart + k] - productQuantizer[i][j][k]) * (queryVector[subvectorStart + k] - productQuantizer[i][j][k]); // depends on control dependency: [for], data = [k] } } } return distances; } }
public class class_name { public <T> CompletableFuture<VersionedMetadata<T>> getData(final String path, Function<byte[], T> fromBytes) { final CompletableFuture<VersionedMetadata<T>> result = new CompletableFuture<>(); try { client.getData().inBackground( callback(event -> { try { T deserialized = fromBytes.apply(event.getData()); result.complete(new VersionedMetadata<>(deserialized, new Version.IntVersion(event.getStat().getVersion()))); } catch (Exception e) { log.error("Exception thrown while deserializing the data", e); result.completeExceptionally(e); } }, result::completeExceptionally, path), executor) .forPath(path); } catch (Exception e) { result.completeExceptionally(StoreException.create(StoreException.Type.UNKNOWN, e, path)); } return result; } }
public class class_name { public <T> CompletableFuture<VersionedMetadata<T>> getData(final String path, Function<byte[], T> fromBytes) { final CompletableFuture<VersionedMetadata<T>> result = new CompletableFuture<>(); try { client.getData().inBackground( callback(event -> { try { T deserialized = fromBytes.apply(event.getData()); result.complete(new VersionedMetadata<>(deserialized, new Version.IntVersion(event.getStat().getVersion()))); } catch (Exception e) { log.error("Exception thrown while deserializing the data", e); result.completeExceptionally(e); } }, result::completeExceptionally, path), executor) .forPath(path); // depends on control dependency: [try], data = [none] } catch (Exception e) { result.completeExceptionally(StoreException.create(StoreException.Type.UNKNOWN, e, path)); } // depends on control dependency: [catch], data = [none] return result; } }
public class class_name { protected synchronized void create(boolean stream) throws IOException { this.stream = stream; if (!stream) { ResourceManager.beforeUdpCreate(); try { socketCreate(false); } catch (IOException ioe) { ResourceManager.afterUdpClose(); throw ioe; } } else { socketCreate(true); } if (socket != null) socket.setCreated(); if (serverSocket != null) serverSocket.setCreated(); // socketCreate will set |fd| if it succeeds. if (fd != null && fd.valid()) { guard.open("close"); } } }
public class class_name { protected synchronized void create(boolean stream) throws IOException { this.stream = stream; if (!stream) { ResourceManager.beforeUdpCreate(); try { socketCreate(false); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { ResourceManager.afterUdpClose(); throw ioe; } // depends on control dependency: [catch], data = [none] } else { socketCreate(true); } if (socket != null) socket.setCreated(); if (serverSocket != null) serverSocket.setCreated(); // socketCreate will set |fd| if it succeeds. if (fd != null && fd.valid()) { guard.open("close"); } } }
public class class_name { public static long initialMemory() { long memory = 0; for (MemoryPoolMXBean mp : ManagementFactory.getMemoryPoolMXBeans()) { memory += mp.getUsage().getInit(); } return memory; } }
public class class_name { public static long initialMemory() { long memory = 0; for (MemoryPoolMXBean mp : ManagementFactory.getMemoryPoolMXBeans()) { memory += mp.getUsage().getInit(); // depends on control dependency: [for], data = [mp] } return memory; } }
public class class_name { public Graph build(){ boolean isStartNode = true; for( Tree<Row> current = root.findPreOrderNext(); current != null; current = current.findPreOrderNext() ){ Node node = nodeBuilder.createNode( current ); if( node == null ){ // The current element does not produce a node. E.g. START, END, ELSE_IF, ELSE, BRANCH continue; } current.getContent().setNode( node ); if( isStartNode ){ graph.setStartNode( node ); isStartNode = false; } else{ graph.addNode( node ); } } for( Tree<Row> current = root.findPreOrderNext(); current != null; current = current.findPreOrderNext() ){ transitionBuilder.createTransitions( graph, current ); } return graph; } }
public class class_name { public Graph build(){ boolean isStartNode = true; for( Tree<Row> current = root.findPreOrderNext(); current != null; current = current.findPreOrderNext() ){ Node node = nodeBuilder.createNode( current ); if( node == null ){ // The current element does not produce a node. E.g. START, END, ELSE_IF, ELSE, BRANCH continue; } current.getContent().setNode( node ); // depends on control dependency: [for], data = [current] if( isStartNode ){ graph.setStartNode( node ); // depends on control dependency: [if], data = [none] isStartNode = false; // depends on control dependency: [if], data = [none] } else{ graph.addNode( node ); // depends on control dependency: [if], data = [none] } } for( Tree<Row> current = root.findPreOrderNext(); current != null; current = current.findPreOrderNext() ){ transitionBuilder.createTransitions( graph, current ); // depends on control dependency: [for], data = [current] } return graph; } }
public class class_name { public String constructUnsignedPayload() { // TODO reverse order when V4 becomes default if (Storage.SignUrlOption.SignatureVersion.V4.equals(signatureVersion)) { return constructV4UnsignedPayload(); } return constructV2UnsignedPayload(); } }
public class class_name { public String constructUnsignedPayload() { // TODO reverse order when V4 becomes default if (Storage.SignUrlOption.SignatureVersion.V4.equals(signatureVersion)) { return constructV4UnsignedPayload(); // depends on control dependency: [if], data = [none] } return constructV2UnsignedPayload(); } }
public class class_name { public static <E> void startConverters(Converter<E> head) { Converter<E> c = head; while (c != null) { // CompositeConverter is a subclass of DynamicConverter if (c instanceof CompositeConverter) { CompositeConverter<E> cc = (CompositeConverter<E>) c; Converter<E> childConverter = cc.childConverter; startConverters(childConverter); cc.start(); } else if (c instanceof DynamicConverter) { DynamicConverter<E> dc = (DynamicConverter<E>) c; dc.start(); } c = c.getNext(); } } }
public class class_name { public static <E> void startConverters(Converter<E> head) { Converter<E> c = head; while (c != null) { // CompositeConverter is a subclass of DynamicConverter if (c instanceof CompositeConverter) { CompositeConverter<E> cc = (CompositeConverter<E>) c; Converter<E> childConverter = cc.childConverter; startConverters(childConverter); // depends on control dependency: [if], data = [none] cc.start(); // depends on control dependency: [if], data = [none] } else if (c instanceof DynamicConverter) { DynamicConverter<E> dc = (DynamicConverter<E>) c; dc.start(); // depends on control dependency: [if], data = [none] } c = c.getNext(); // depends on control dependency: [while], data = [none] } } }
public class class_name { private static boolean criteriaListForcesUserLimitation(Set<String> userAndGroupIds, List<QueryCriteria> criteriaList) { boolean userLimitiationIntersection = false; if( criteriaList.isEmpty() ) { return false; } for( QueryCriteria criteria : criteriaList ) { if( criteria.isUnion() && criteriaList.size() > 1) { return false; } if( criteria.isGroupCriteria() ) { if( criteriaListForcesUserLimitation(userAndGroupIds, criteria.getCriteria()) ) { return true; } continue; } // intersection criteria if( taskUserRoleLimitingListIds.contains(criteria.getListId()) ) { for( Object param : criteria.getParameters() ) { if( userAndGroupIds.contains(param) ) { return true; } } } } return userLimitiationIntersection; } }
public class class_name { private static boolean criteriaListForcesUserLimitation(Set<String> userAndGroupIds, List<QueryCriteria> criteriaList) { boolean userLimitiationIntersection = false; if( criteriaList.isEmpty() ) { return false; // depends on control dependency: [if], data = [none] } for( QueryCriteria criteria : criteriaList ) { if( criteria.isUnion() && criteriaList.size() > 1) { return false; // depends on control dependency: [if], data = [none] } if( criteria.isGroupCriteria() ) { if( criteriaListForcesUserLimitation(userAndGroupIds, criteria.getCriteria()) ) { return true; // depends on control dependency: [if], data = [none] } continue; } // intersection criteria if( taskUserRoleLimitingListIds.contains(criteria.getListId()) ) { for( Object param : criteria.getParameters() ) { if( userAndGroupIds.contains(param) ) { return true; // depends on control dependency: [if], data = [none] } } } } return userLimitiationIntersection; } }
public class class_name { public double score(int termFreq, int docLen, double avgDocLen, int titleTermFreq, int titleLen, double avgTitleLen, int anchorTermFreq, int anchorLen, double avgAnchorLen, long N, long n) { if (termFreq <= 0) return 0.0; double tf = wBody * termFreq / (1.0 + bBody * (docLen / avgDocLen - 1.0)); if (titleTermFreq > 0) { tf += wTitle * titleTermFreq / (1.0 + bTitle * (titleLen / avgTitleLen - 1.0)); } if (anchorTermFreq > 0) { tf += wAnchor * anchorTermFreq / (1.0 + bAnchor * (anchorLen / avgAnchorLen - 1.0)); } tf = tf / (kf + tf); double idf = Math.log((N - n + 0.5) / (n + 0.5)); return (tf + delta) * idf; } }
public class class_name { public double score(int termFreq, int docLen, double avgDocLen, int titleTermFreq, int titleLen, double avgTitleLen, int anchorTermFreq, int anchorLen, double avgAnchorLen, long N, long n) { if (termFreq <= 0) return 0.0; double tf = wBody * termFreq / (1.0 + bBody * (docLen / avgDocLen - 1.0)); if (titleTermFreq > 0) { tf += wTitle * titleTermFreq / (1.0 + bTitle * (titleLen / avgTitleLen - 1.0)); // depends on control dependency: [if], data = [0)] } if (anchorTermFreq > 0) { tf += wAnchor * anchorTermFreq / (1.0 + bAnchor * (anchorLen / avgAnchorLen - 1.0)); // depends on control dependency: [if], data = [0)] } tf = tf / (kf + tf); double idf = Math.log((N - n + 0.5) / (n + 0.5)); return (tf + delta) * idf; } }
public class class_name { private String nextQuotedValue(char quote) throws IOException { // Like nextNonWhitespace, this uses locals 'p' and 'l' to save inner-loop field access. char[] buffer = this.buffer; StringBuilder builder = null; while (true) { int p = pos; int l = limit; /* the index of the first character not yet appended to the builder. */ int start = p; while (p < l) { int c = buffer[p++]; if (c == quote) { pos = p; int len = p - start - 1; if (builder == null) { return new String(buffer, start, len); } else { builder.append(buffer, start, len); return builder.toString(); } } else if (c == '\\') { pos = p; int len = p - start - 1; if (builder == null) { int estimatedLength = (len + 1) * 2; builder = new StringBuilder(Math.max(estimatedLength, 16)); } builder.append(buffer, start, len); builder.append(readEscapeCharacter()); p = pos; l = limit; start = p; } else if (c == '\n') { lineNumber++; lineStart = p; } } if (builder == null) { int estimatedLength = (p - start) * 2; builder = new StringBuilder(Math.max(estimatedLength, 16)); } builder.append(buffer, start, p - start); pos = p; if (!fillBuffer(1)) { throw syntaxError("Unterminated string"); } } } }
public class class_name { private String nextQuotedValue(char quote) throws IOException { // Like nextNonWhitespace, this uses locals 'p' and 'l' to save inner-loop field access. char[] buffer = this.buffer; StringBuilder builder = null; while (true) { int p = pos; int l = limit; /* the index of the first character not yet appended to the builder. */ int start = p; while (p < l) { int c = buffer[p++]; if (c == quote) { pos = p; // depends on control dependency: [if], data = [none] int len = p - start - 1; if (builder == null) { return new String(buffer, start, len); // depends on control dependency: [if], data = [none] } else { builder.append(buffer, start, len); // depends on control dependency: [if], data = [none] return builder.toString(); // depends on control dependency: [if], data = [none] } } else if (c == '\\') { pos = p; // depends on control dependency: [if], data = [none] int len = p - start - 1; if (builder == null) { int estimatedLength = (len + 1) * 2; builder = new StringBuilder(Math.max(estimatedLength, 16)); // depends on control dependency: [if], data = [none] } builder.append(buffer, start, len); // depends on control dependency: [if], data = [none] builder.append(readEscapeCharacter()); // depends on control dependency: [if], data = [none] p = pos; // depends on control dependency: [if], data = [none] l = limit; // depends on control dependency: [if], data = [none] start = p; // depends on control dependency: [if], data = [none] } else if (c == '\n') { lineNumber++; // depends on control dependency: [if], data = [none] lineStart = p; // depends on control dependency: [if], data = [none] } } if (builder == null) { int estimatedLength = (p - start) * 2; builder = new StringBuilder(Math.max(estimatedLength, 16)); // depends on control dependency: [if], data = [none] } builder.append(buffer, start, p - start); pos = p; if (!fillBuffer(1)) { throw syntaxError("Unterminated string"); } } } }
public class class_name { public List<PartialResponseAttributesType<PartialResponseChangesType<T>>> getAllAttributes() { List<PartialResponseAttributesType<PartialResponseChangesType<T>>> list = new ArrayList<PartialResponseAttributesType<PartialResponseChangesType<T>>>(); List<Node> nodeList = childNode.get("attributes"); for(Node node: nodeList) { PartialResponseAttributesType<PartialResponseChangesType<T>> type = new PartialResponseAttributesTypeImpl<PartialResponseChangesType<T>>(this, "attributes", childNode, node); list.add(type); } return list; } }
public class class_name { public List<PartialResponseAttributesType<PartialResponseChangesType<T>>> getAllAttributes() { List<PartialResponseAttributesType<PartialResponseChangesType<T>>> list = new ArrayList<PartialResponseAttributesType<PartialResponseChangesType<T>>>(); List<Node> nodeList = childNode.get("attributes"); for(Node node: nodeList) { PartialResponseAttributesType<PartialResponseChangesType<T>> type = new PartialResponseAttributesTypeImpl<PartialResponseChangesType<T>>(this, "attributes", childNode, node); list.add(type); // depends on control dependency: [for], data = [none] } return list; } }
public class class_name { String stripAppId(String origId) { if (origId == null || origId.isEmpty()) { return ""; } Matcher m = stripBracketsPattern.matcher(origId); String cleanedAppId = m.replaceAll(""); Matcher tailMatcher = stripSequencePattern.matcher(cleanedAppId); if (tailMatcher.matches()) { cleanedAppId = tailMatcher.group(1); } return cleanedAppId; } }
public class class_name { String stripAppId(String origId) { if (origId == null || origId.isEmpty()) { return ""; // depends on control dependency: [if], data = [none] } Matcher m = stripBracketsPattern.matcher(origId); String cleanedAppId = m.replaceAll(""); Matcher tailMatcher = stripSequencePattern.matcher(cleanedAppId); if (tailMatcher.matches()) { cleanedAppId = tailMatcher.group(1); // depends on control dependency: [if], data = [none] } return cleanedAppId; } }
public class class_name { @SuppressWarnings({"checkstyle:parameternumber", "checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"}) private void crossSegmentTwoShadowLines( int shadowX0, int shadowY0, int shadowZ0, int shadowX1, int shadowY1, int shadowZ1, int sx0, int sy0, int sz0, int sx1, int sy1, int sz1) { // Update the global bounds of the shadow. final int shadowXmin = Math.min(shadowX0, shadowX1); final int shadowXmax = Math.max(shadowX0, shadowX1); final int shadowYmin = Math.min(shadowY0, shadowY1); final int shadowYmax = Math.max(shadowY0, shadowY1); if (sy0 < shadowYmin && sy1 < shadowYmin) { // The segment is entirely at the bottom of the shadow. return; } if (sy0 > shadowYmax && sy1 > shadowYmax) { // The segment is entirely at the top of the shadow. return; } if (sx0 < shadowXmin && sx1 < shadowXmin) { // The segment is entirely at the left of the shadow. return; } if (sx0 > shadowXmax && sx1 > shadowXmax) { // The line is entirely at the right of the shadow if (sy1 != sy0) { final double alpha = (sx1 - sx0) / (sy1 - sy0); if (sy0 < sy1) { if (sy0 <= shadowYmin) { final int xintercept = (int) Math.round(sx0 + (shadowYmin - sy0) * alpha); setCrossingCoordinateForYMin(xintercept, shadowYmin); ++this.crossings; } if (sy1 >= shadowYmax) { final int xintercept = (int) Math.round(sx0 + (shadowYmax - sy0) * alpha); setCrossingCoordinateForYMax(xintercept, shadowYmax); ++this.crossings; } } else { if (sy1 <= shadowYmin) { final int xintercept = (int) Math.round(sx0 + (shadowYmin - sy0) * alpha); setCrossingCoordinateForYMin(xintercept, shadowYmin); --this.crossings; } if (sy0 >= shadowYmax) { final int xintercept = (int) Math.round(sx0 + (shadowYmax - sy0) * alpha); setCrossingCoordinateForYMax(xintercept, shadowYmax); --this.crossings; } } } } else if (Segment2ai.intersectsSegmentSegment( shadowX0, shadowY0, shadowX1, shadowY1, sx0, sy0, sx1, sy1)) { // The segment is intersecting the shadowed segment. this.crossings = GeomConstants.SHAPE_INTERSECTS; } else { final int side1; final int side2; final boolean isUp = shadowY0 <= shadowY1; if (isUp) { side1 = Segment2ai.findsSideLinePoint( shadowX0, shadowY0, shadowX1, shadowY1, sx0, sy0); side2 = Segment2ai.findsSideLinePoint( shadowX0, shadowY0, shadowX1, shadowY1, sx1, sy1); } else { side1 = Segment2ai.findsSideLinePoint( shadowX1, shadowY1, shadowX0, shadowY0, sx0, sy0); side2 = Segment2ai.findsSideLinePoint( shadowX1, shadowY1, shadowX0, shadowY0, sx1, sy1); } if (side1 > 0 || side2 > 0) { final int x0; final int x1; if (shadowY0 <= shadowY1) { x0 = shadowX0; x1 = shadowX1; } else { x0 = shadowX1; x1 = shadowX0; } crossSegmentShadowLine( x1, shadowYmax, sx0, sy0, sx1, sy1, isUp); crossSegmentShadowLine( x0, shadowYmin, sx0, sy0, sx1, sy1, !isUp); } } } }
public class class_name { @SuppressWarnings({"checkstyle:parameternumber", "checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"}) private void crossSegmentTwoShadowLines( int shadowX0, int shadowY0, int shadowZ0, int shadowX1, int shadowY1, int shadowZ1, int sx0, int sy0, int sz0, int sx1, int sy1, int sz1) { // Update the global bounds of the shadow. final int shadowXmin = Math.min(shadowX0, shadowX1); final int shadowXmax = Math.max(shadowX0, shadowX1); final int shadowYmin = Math.min(shadowY0, shadowY1); final int shadowYmax = Math.max(shadowY0, shadowY1); if (sy0 < shadowYmin && sy1 < shadowYmin) { // The segment is entirely at the bottom of the shadow. return; // depends on control dependency: [if], data = [none] } if (sy0 > shadowYmax && sy1 > shadowYmax) { // The segment is entirely at the top of the shadow. return; // depends on control dependency: [if], data = [none] } if (sx0 < shadowXmin && sx1 < shadowXmin) { // The segment is entirely at the left of the shadow. return; // depends on control dependency: [if], data = [none] } if (sx0 > shadowXmax && sx1 > shadowXmax) { // The line is entirely at the right of the shadow if (sy1 != sy0) { final double alpha = (sx1 - sx0) / (sy1 - sy0); if (sy0 < sy1) { if (sy0 <= shadowYmin) { final int xintercept = (int) Math.round(sx0 + (shadowYmin - sy0) * alpha); setCrossingCoordinateForYMin(xintercept, shadowYmin); // depends on control dependency: [if], data = [none] ++this.crossings; // depends on control dependency: [if], data = [none] } if (sy1 >= shadowYmax) { final int xintercept = (int) Math.round(sx0 + (shadowYmax - sy0) * alpha); setCrossingCoordinateForYMax(xintercept, shadowYmax); // depends on control dependency: [if], data = [none] ++this.crossings; // depends on control dependency: [if], data = [none] } } else { if (sy1 <= shadowYmin) { final int xintercept = (int) Math.round(sx0 + (shadowYmin - sy0) * alpha); setCrossingCoordinateForYMin(xintercept, shadowYmin); // depends on control dependency: [if], data = [none] --this.crossings; // depends on control dependency: [if], data = [none] } if (sy0 >= shadowYmax) { final int xintercept = (int) Math.round(sx0 + (shadowYmax - sy0) * alpha); setCrossingCoordinateForYMax(xintercept, shadowYmax); // depends on control dependency: [if], data = [none] --this.crossings; // depends on control dependency: [if], data = [none] } } } } else if (Segment2ai.intersectsSegmentSegment( shadowX0, shadowY0, shadowX1, shadowY1, sx0, sy0, sx1, sy1)) { // The segment is intersecting the shadowed segment. this.crossings = GeomConstants.SHAPE_INTERSECTS; // depends on control dependency: [if], data = [none] } else { final int side1; final int side2; final boolean isUp = shadowY0 <= shadowY1; if (isUp) { side1 = Segment2ai.findsSideLinePoint( shadowX0, shadowY0, shadowX1, shadowY1, sx0, sy0); // depends on control dependency: [if], data = [none] side2 = Segment2ai.findsSideLinePoint( shadowX0, shadowY0, shadowX1, shadowY1, sx1, sy1); // depends on control dependency: [if], data = [none] } else { side1 = Segment2ai.findsSideLinePoint( shadowX1, shadowY1, shadowX0, shadowY0, sx0, sy0); // depends on control dependency: [if], data = [none] side2 = Segment2ai.findsSideLinePoint( shadowX1, shadowY1, shadowX0, shadowY0, sx1, sy1); // depends on control dependency: [if], data = [none] } if (side1 > 0 || side2 > 0) { final int x0; final int x1; if (shadowY0 <= shadowY1) { x0 = shadowX0; // depends on control dependency: [if], data = [none] x1 = shadowX1; // depends on control dependency: [if], data = [none] } else { x0 = shadowX1; // depends on control dependency: [if], data = [none] x1 = shadowX0; // depends on control dependency: [if], data = [none] } crossSegmentShadowLine( x1, shadowYmax, sx0, sy0, sx1, sy1, isUp); // depends on control dependency: [if], data = [none] crossSegmentShadowLine( x0, shadowYmin, sx0, sy0, sx1, sy1, !isUp); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void truncateUncommittedEntries() { if (type() == CopycatServer.State.PASSIVE) { context.getLog().truncate(Math.min(context.getCommitIndex(), context.getLog().lastIndex())); } } }
public class class_name { private void truncateUncommittedEntries() { if (type() == CopycatServer.State.PASSIVE) { context.getLog().truncate(Math.min(context.getCommitIndex(), context.getLog().lastIndex())); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(VocabularyInfo vocabularyInfo, ProtocolMarshaller protocolMarshaller) { if (vocabularyInfo == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(vocabularyInfo.getVocabularyName(), VOCABULARYNAME_BINDING); protocolMarshaller.marshall(vocabularyInfo.getLanguageCode(), LANGUAGECODE_BINDING); protocolMarshaller.marshall(vocabularyInfo.getLastModifiedTime(), LASTMODIFIEDTIME_BINDING); protocolMarshaller.marshall(vocabularyInfo.getVocabularyState(), VOCABULARYSTATE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(VocabularyInfo vocabularyInfo, ProtocolMarshaller protocolMarshaller) { if (vocabularyInfo == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(vocabularyInfo.getVocabularyName(), VOCABULARYNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(vocabularyInfo.getLanguageCode(), LANGUAGECODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(vocabularyInfo.getLastModifiedTime(), LASTMODIFIEDTIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(vocabularyInfo.getVocabularyState(), VOCABULARYSTATE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void deleteGroup(List<Segment> group) { // Delete the old segments. for (Segment oldSegment : group) { oldSegment.close(); oldSegment.delete(); } } }
public class class_name { private void deleteGroup(List<Segment> group) { // Delete the old segments. for (Segment oldSegment : group) { oldSegment.close(); // depends on control dependency: [for], data = [oldSegment] oldSegment.delete(); // depends on control dependency: [for], data = [oldSegment] } } }
public class class_name { public static void addPropertyString( CmsCmisTypeManager typeManager, PropertiesImpl props, String typeId, Set<String> filter, String id, String value) { if (!checkAddProperty(typeManager, props, typeId, filter, id)) { return; } PropertyStringImpl result = new PropertyStringImpl(id, value); result.setQueryName(id); props.addProperty(result); } }
public class class_name { public static void addPropertyString( CmsCmisTypeManager typeManager, PropertiesImpl props, String typeId, Set<String> filter, String id, String value) { if (!checkAddProperty(typeManager, props, typeId, filter, id)) { return; // depends on control dependency: [if], data = [none] } PropertyStringImpl result = new PropertyStringImpl(id, value); result.setQueryName(id); props.addProperty(result); } }
public class class_name { public com.google.protobuf.ByteString getNewValueBytes() { java.lang.Object ref = newValue_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); newValue_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } }
public class class_name { public com.google.protobuf.ByteString getNewValueBytes() { java.lang.Object ref = newValue_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); newValue_ = b; // depends on control dependency: [if], data = [none] return b; // depends on control dependency: [if], data = [none] } else { return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String getVersion() { String version = null; // try to load from maven properties first try { Properties p = new Properties(); InputStream is = VersionHelper.class.getResourceAsStream("/META-INF/maven/io.redlink/redlink-sdk-java/pom.properties"); if (is != null) { p.load(is); version = p.getProperty("version", ""); } } catch (Exception e) { // ignore } // fallback to using Java API if (version == null) { Package aPackage = VersionHelper.class.getPackage(); if (aPackage != null) { version = aPackage.getImplementationVersion(); if (version == null) { version = aPackage.getSpecificationVersion(); } } } // fallback to read pom.xml on testing if (version == null) { final MavenXpp3Reader reader = new MavenXpp3Reader(); try { Model model = reader.read(new FileReader(new File("pom.xml"))); version = model.getVersion(); } catch (IOException | XmlPullParserException e) { // ignore } } return version; } }
public class class_name { public static String getVersion() { String version = null; // try to load from maven properties first try { Properties p = new Properties(); InputStream is = VersionHelper.class.getResourceAsStream("/META-INF/maven/io.redlink/redlink-sdk-java/pom.properties"); if (is != null) { p.load(is); // depends on control dependency: [if], data = [(is] version = p.getProperty("version", ""); // depends on control dependency: [if], data = [none] } } catch (Exception e) { // ignore } // depends on control dependency: [catch], data = [none] // fallback to using Java API if (version == null) { Package aPackage = VersionHelper.class.getPackage(); if (aPackage != null) { version = aPackage.getImplementationVersion(); // depends on control dependency: [if], data = [none] if (version == null) { version = aPackage.getSpecificationVersion(); // depends on control dependency: [if], data = [none] } } } // fallback to read pom.xml on testing if (version == null) { final MavenXpp3Reader reader = new MavenXpp3Reader(); try { Model model = reader.read(new FileReader(new File("pom.xml"))); version = model.getVersion(); // depends on control dependency: [try], data = [none] } catch (IOException | XmlPullParserException e) { // ignore } // depends on control dependency: [catch], data = [none] } return version; } }
public class class_name { @Override public Status match(int cc) { if (expression[idx] == '*') { okStatus = Status.WillMatch; if (cc == expression[idx+1]) { idx++; } else { return okStatus; } } if (expression[idx] == cc || expression[idx] == '?') { idx++; if (idx == expression.length) { idx = 0; okStatus = Status.Ok; return Status.Match; } else { return okStatus; } } else { idx = 0; okStatus = Status.Ok; return Status.Error; } } }
public class class_name { @Override public Status match(int cc) { if (expression[idx] == '*') { okStatus = Status.WillMatch; // depends on control dependency: [if], data = [none] if (cc == expression[idx+1]) { idx++; // depends on control dependency: [if], data = [none] } else { return okStatus; // depends on control dependency: [if], data = [none] } } if (expression[idx] == cc || expression[idx] == '?') { idx++; // depends on control dependency: [if], data = [none] if (idx == expression.length) { idx = 0; // depends on control dependency: [if], data = [none] okStatus = Status.Ok; // depends on control dependency: [if], data = [none] return Status.Match; // depends on control dependency: [if], data = [none] } else { return okStatus; // depends on control dependency: [if], data = [none] } } else { idx = 0; // depends on control dependency: [if], data = [none] okStatus = Status.Ok; // depends on control dependency: [if], data = [none] return Status.Error; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean contains(String[] vals, String value) { for (int i = 0; i < vals.length; i++) { if (vals[i].equals(value)) { return true; } } return false; } }
public class class_name { public static boolean contains(String[] vals, String value) { for (int i = 0; i < vals.length; i++) { if (vals[i].equals(value)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { protected void preNativeCall() { //get logger Logger logger=this.getLogger(); //get log level LogLevel logLevel=logger.getLogLevel(); boolean debugMode=false; if(logLevel.equals(LogLevel.DEBUG)) { debugMode=true; } //set debug mode WindowsJNIFaxClientSpi.setDebugModeNative(debugMode); } }
public class class_name { protected void preNativeCall() { //get logger Logger logger=this.getLogger(); //get log level LogLevel logLevel=logger.getLogLevel(); boolean debugMode=false; if(logLevel.equals(LogLevel.DEBUG)) { debugMode=true; // depends on control dependency: [if], data = [none] } //set debug mode WindowsJNIFaxClientSpi.setDebugModeNative(debugMode); } }
public class class_name { public Set keySet() { if (keySet == null) { keySet = new AbstractSet() { public Iterator iterator() { return new IntHashIterator(KEYS); } public int size() { return count; } public boolean contains(Object o) { return containsKey(o); } public boolean remove(Object o) { return IntHashMap.this.remove(o) != null; } public void clear() { IntHashMap.this.clear(); } }; } return keySet; } }
public class class_name { public Set keySet() { if (keySet == null) { keySet = new AbstractSet() { public Iterator iterator() { return new IntHashIterator(KEYS); } public int size() { return count; } public boolean contains(Object o) { return containsKey(o); } public boolean remove(Object o) { return IntHashMap.this.remove(o) != null; } public void clear() { IntHashMap.this.clear(); } }; // depends on control dependency: [if], data = [none] } return keySet; } }
public class class_name { private static Object getParam(final Object param) { final StringBuilder sb = new StringBuilder(); if(param instanceof String){ sb.append("'"); sb.append((String)param); sb.append("'"); } else if(param instanceof Boolean){ sb.append(String.valueOf((Boolean)param)); } else if(param instanceof Integer){ sb.append(String.valueOf((Integer)param)); } else if(param instanceof DBRegExp){ sb.append('/'); sb.append(((DBRegExp) param).toString()); sb.append('/'); } return sb.toString(); } }
public class class_name { private static Object getParam(final Object param) { final StringBuilder sb = new StringBuilder(); if(param instanceof String){ sb.append("'"); // depends on control dependency: [if], data = [none] sb.append((String)param); // depends on control dependency: [if], data = [none] sb.append("'"); // depends on control dependency: [if], data = [none] } else if(param instanceof Boolean){ sb.append(String.valueOf((Boolean)param)); // depends on control dependency: [if], data = [none] } else if(param instanceof Integer){ sb.append(String.valueOf((Integer)param)); // depends on control dependency: [if], data = [none] } else if(param instanceof DBRegExp){ sb.append('/'); // depends on control dependency: [if], data = [none] sb.append(((DBRegExp) param).toString()); // depends on control dependency: [if], data = [none] sb.append('/'); // depends on control dependency: [if], data = [none] } return sb.toString(); } }
public class class_name { protected void getDependencies(JSONObject jsonObject, String rootDirectory, Collection<DependencyInfo> dependencies) { try { CommandLineProcess npmLs = new CommandLineProcess(rootDirectory, getLsCommandParams()); npmLs.setTimeoutReadLineSeconds(this.npmTimeoutDependenciesCollector); List<String> linesOfNpmLs = npmLs.executeProcess(); getDependencies(jsonObject, linesOfNpmLs, 1, dependencies); } catch (IOException e) { logger.warn("Error getting dependencies after running 'npm ls --json' on {}, error : {}", rootDirectory, e.getMessage()); logger.debug("Error: {}", e.getStackTrace()); } } }
public class class_name { protected void getDependencies(JSONObject jsonObject, String rootDirectory, Collection<DependencyInfo> dependencies) { try { CommandLineProcess npmLs = new CommandLineProcess(rootDirectory, getLsCommandParams()); npmLs.setTimeoutReadLineSeconds(this.npmTimeoutDependenciesCollector); // depends on control dependency: [try], data = [none] List<String> linesOfNpmLs = npmLs.executeProcess(); getDependencies(jsonObject, linesOfNpmLs, 1, dependencies); // depends on control dependency: [try], data = [none] } catch (IOException e) { logger.warn("Error getting dependencies after running 'npm ls --json' on {}, error : {}", rootDirectory, e.getMessage()); logger.debug("Error: {}", e.getStackTrace()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setRoundingIncrement(BigDecimal newValue) { int i = newValue == null ? 0 : newValue.compareTo(BigDecimal.ZERO); if (i < 0) { throw new IllegalArgumentException("Illegal rounding increment"); } if (i == 0) { setInternalRoundingIncrement(null); } else { setInternalRoundingIncrement(newValue); } resetActualRounding(); } }
public class class_name { public void setRoundingIncrement(BigDecimal newValue) { int i = newValue == null ? 0 : newValue.compareTo(BigDecimal.ZERO); if (i < 0) { throw new IllegalArgumentException("Illegal rounding increment"); } if (i == 0) { setInternalRoundingIncrement(null); // depends on control dependency: [if], data = [none] } else { setInternalRoundingIncrement(newValue); // depends on control dependency: [if], data = [none] } resetActualRounding(); } }
public class class_name { public static List<? extends Element> getEnclosedElementsDeclarationOrder(TypeElement type) { List<? extends Element> result = null; try { Object binding = field(type, "_binding"); Class<?> sourceTypeBinding = null; { Class<?> c = binding.getClass(); do { if (c.getCanonicalName().equals( "org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding")) { sourceTypeBinding = c; break; } } while ((c = c.getSuperclass()) != null); } final List<Object> declarationOrder; if (sourceTypeBinding != null) { declarationOrder = findSourceOrder(binding); List<Element> enclosedElements = new ArrayList<Element>(type.getEnclosedElements()); Collections.sort(enclosedElements, new Comparator<Element>() { public int compare(Element o1, Element o2) { try { Object o1Binding = field(o1, "_binding"); Object o2Binding = field(o2, "_binding"); int i1 = declarationOrder.indexOf(o1Binding); int i2 = declarationOrder.indexOf(o2Binding); return i1 - i2; } catch (Exception e) { return 0; } } }); result = enclosedElements; } } catch (Exception e) { // ignore } return (result != null) ? result : type.getEnclosedElements(); } }
public class class_name { public static List<? extends Element> getEnclosedElementsDeclarationOrder(TypeElement type) { List<? extends Element> result = null; try { Object binding = field(type, "_binding"); Class<?> sourceTypeBinding = null; { Class<?> c = binding.getClass(); do { if (c.getCanonicalName().equals( "org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding")) { sourceTypeBinding = c; break; } } while ((c = c.getSuperclass()) != null); } final List<Object> declarationOrder; if (sourceTypeBinding != null) { declarationOrder = findSourceOrder(binding); // depends on control dependency: [if], data = [none] List<Element> enclosedElements = new ArrayList<Element>(type.getEnclosedElements()); Collections.sort(enclosedElements, new Comparator<Element>() { public int compare(Element o1, Element o2) { try { Object o1Binding = field(o1, "_binding"); Object o2Binding = field(o2, "_binding"); int i1 = declarationOrder.indexOf(o1Binding); int i2 = declarationOrder.indexOf(o2Binding); return i1 - i2; // depends on control dependency: [try], data = [none] } catch (Exception e) { return 0; } // depends on control dependency: [catch], data = [none] } }); // depends on control dependency: [if], data = [none] result = enclosedElements; // depends on control dependency: [if], data = [none] } } catch (Exception e) { // ignore } return (result != null) ? result : type.getEnclosedElements(); } }
public class class_name { public static boolean isNumber(final String text, final int start, final int len){ for(int i=start; i<start+len; i++){ char c = text.charAt(i); if(!isNumber(c)){ return false; } } //指定的字符串已经识别为数字串 //下面要判断数字串是否完整 if(start>0){ //判断前一个字符,如果为数字字符则识别失败 char c = text.charAt(start-1); if(isNumber(c)){ return false; } } if(start+len < text.length()){ //判断后一个字符,如果为数字字符则识别失败 char c = text.charAt(start+len); if(isNumber(c)){ return false; } } if(LOGGER.isDebugEnabled()) { LOGGER.debug("识别出数字:" + text.substring(start, start + len)); } return true; } }
public class class_name { public static boolean isNumber(final String text, final int start, final int len){ for(int i=start; i<start+len; i++){ char c = text.charAt(i); if(!isNumber(c)){ return false; // depends on control dependency: [if], data = [none] } } //指定的字符串已经识别为数字串 //下面要判断数字串是否完整 if(start>0){ //判断前一个字符,如果为数字字符则识别失败 char c = text.charAt(start-1); if(isNumber(c)){ return false; // depends on control dependency: [if], data = [none] } } if(start+len < text.length()){ //判断后一个字符,如果为数字字符则识别失败 char c = text.charAt(start+len); if(isNumber(c)){ return false; // depends on control dependency: [if], data = [none] } } if(LOGGER.isDebugEnabled()) { LOGGER.debug("识别出数字:" + text.substring(start, start + len)); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public Set<CurrencyUnit> getCurrencies(CurrencyQuery currencyQuery) { Set<CurrencyUnit> result = new HashSet<>(CURRENCY_UNITS.size()); if (currencyQuery.get(LocalDateTime.class) != null || currencyQuery.get(LocalDate.class) != null) { return Collections.emptySet(); } if (!currencyQuery.getCurrencyCodes().isEmpty()) { for (String code : currencyQuery.getCurrencyCodes()) { CurrencyUnit cu = CURRENCY_UNITS.get(code); if (cu != null) { result.add(cu); } } return result; } if (!currencyQuery.getCountries().isEmpty()) { for (Locale locale : currencyQuery.getCountries()) { CurrencyUnit cu = CURRENCY_UNITS_BY_LOCALE.get(locale); if (cu != null) { result.add(cu); } } return result; } result.addAll(CURRENCY_UNITS.values()); return result; } }
public class class_name { public Set<CurrencyUnit> getCurrencies(CurrencyQuery currencyQuery) { Set<CurrencyUnit> result = new HashSet<>(CURRENCY_UNITS.size()); if (currencyQuery.get(LocalDateTime.class) != null || currencyQuery.get(LocalDate.class) != null) { return Collections.emptySet(); // depends on control dependency: [if], data = [none] } if (!currencyQuery.getCurrencyCodes().isEmpty()) { for (String code : currencyQuery.getCurrencyCodes()) { CurrencyUnit cu = CURRENCY_UNITS.get(code); if (cu != null) { result.add(cu); // depends on control dependency: [if], data = [(cu] } } return result; // depends on control dependency: [if], data = [none] } if (!currencyQuery.getCountries().isEmpty()) { for (Locale locale : currencyQuery.getCountries()) { CurrencyUnit cu = CURRENCY_UNITS_BY_LOCALE.get(locale); if (cu != null) { result.add(cu); // depends on control dependency: [if], data = [(cu] } } return result; // depends on control dependency: [if], data = [none] } result.addAll(CURRENCY_UNITS.values()); return result; } }
public class class_name { public static long[] hash(final String in, final long seed, final long[] hashOut) { if ((in == null) || (in.length() == 0)) { return emptyOrNull(seed, hashOut); } final byte[] byteArr = in.getBytes(UTF_8); return hash(Memory.wrap(byteArr), 0L, byteArr.length, seed, hashOut); } }
public class class_name { public static long[] hash(final String in, final long seed, final long[] hashOut) { if ((in == null) || (in.length() == 0)) { return emptyOrNull(seed, hashOut); // depends on control dependency: [if], data = [none] } final byte[] byteArr = in.getBytes(UTF_8); return hash(Memory.wrap(byteArr), 0L, byteArr.length, seed, hashOut); } }
public class class_name { private void ensurePKsFromHierarchy(ClassDescriptorDef classDef) throws ConstraintException { SequencedHashMap pks = new SequencedHashMap(); for (Iterator it = classDef.getAllExtentClasses(); it.hasNext();) { ClassDescriptorDef subTypeDef = (ClassDescriptorDef)it.next(); ArrayList subPKs = subTypeDef.getPrimaryKeys(); // check against already present PKs for (Iterator pkIt = subPKs.iterator(); pkIt.hasNext();) { FieldDescriptorDef fieldDef = (FieldDescriptorDef)pkIt.next(); FieldDescriptorDef foundPKDef = (FieldDescriptorDef)pks.get(fieldDef.getName()); if (foundPKDef != null) { if (!isEqual(fieldDef, foundPKDef)) { throw new ConstraintException("Cannot pull up the declaration of the required primary key "+fieldDef.getName()+ " because its definitions in "+fieldDef.getOwner().getName()+" and "+ foundPKDef.getOwner().getName()+" differ"); } } else { pks.put(fieldDef.getName(), fieldDef); } } } ensureFields(classDef, pks.values()); } }
public class class_name { private void ensurePKsFromHierarchy(ClassDescriptorDef classDef) throws ConstraintException { SequencedHashMap pks = new SequencedHashMap(); for (Iterator it = classDef.getAllExtentClasses(); it.hasNext();) { ClassDescriptorDef subTypeDef = (ClassDescriptorDef)it.next(); ArrayList subPKs = subTypeDef.getPrimaryKeys(); // check against already present PKs for (Iterator pkIt = subPKs.iterator(); pkIt.hasNext();) { FieldDescriptorDef fieldDef = (FieldDescriptorDef)pkIt.next(); FieldDescriptorDef foundPKDef = (FieldDescriptorDef)pks.get(fieldDef.getName()); if (foundPKDef != null) { if (!isEqual(fieldDef, foundPKDef)) { throw new ConstraintException("Cannot pull up the declaration of the required primary key "+fieldDef.getName()+ " because its definitions in "+fieldDef.getOwner().getName()+" and "+ foundPKDef.getOwner().getName()+" differ"); } } else { pks.put(fieldDef.getName(), fieldDef); // depends on control dependency: [if], data = [none] } } } ensureFields(classDef, pks.values()); } }
public class class_name { public Number getValue() { if ((getText() == null) || "".equals(getText().trim())) return null; try { Number n = format.parse(getText()); if (n.getClass() == this.numberClass) return n; else if (this.numberClass == BigDecimal.class) { BigDecimal bd = new BigDecimal(n.doubleValue()); if (scale != null) { bd = bd.setScale(scale.intValue(), BigDecimal.ROUND_HALF_UP); } return bd; } else if (this.numberClass == Double.class) return new Double(n.doubleValue()); else if (this.numberClass == Float.class) return new Float(n.floatValue()); else if (this.numberClass == BigInteger.class) // we have called setBigDecimalFormat to make sure a BigDecimal // is returned so use toBigInteger on that class return ((BigDecimal) n).toBigInteger(); else if (this.numberClass == Long.class) return new Long(n.longValue()); else if (this.numberClass == Integer.class) return new Integer(n.intValue()); else if (this.numberClass == Short.class) return new Short(n.shortValue()); else if (this.numberClass == Byte.class) return new Byte(n.byteValue()); return null; } catch (Exception pe) { log.error("Error: " + getText() + " is not a number.", pe); return null; } } }
public class class_name { public Number getValue() { if ((getText() == null) || "".equals(getText().trim())) return null; try { Number n = format.parse(getText()); if (n.getClass() == this.numberClass) return n; else if (this.numberClass == BigDecimal.class) { BigDecimal bd = new BigDecimal(n.doubleValue()); if (scale != null) { bd = bd.setScale(scale.intValue(), BigDecimal.ROUND_HALF_UP); // depends on control dependency: [if], data = [(scale] } return bd; // depends on control dependency: [if], data = [none] } else if (this.numberClass == Double.class) return new Double(n.doubleValue()); else if (this.numberClass == Float.class) return new Float(n.floatValue()); else if (this.numberClass == BigInteger.class) // we have called setBigDecimalFormat to make sure a BigDecimal // is returned so use toBigInteger on that class return ((BigDecimal) n).toBigInteger(); else if (this.numberClass == Long.class) return new Long(n.longValue()); else if (this.numberClass == Integer.class) return new Integer(n.intValue()); else if (this.numberClass == Short.class) return new Short(n.shortValue()); else if (this.numberClass == Byte.class) return new Byte(n.byteValue()); return null; // depends on control dependency: [try], data = [none] } catch (Exception pe) { log.error("Error: " + getText() + " is not a number.", pe); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public GetAccountAuthorizationDetailsResult withUserDetailList(UserDetail... userDetailList) { if (this.userDetailList == null) { setUserDetailList(new com.amazonaws.internal.SdkInternalList<UserDetail>(userDetailList.length)); } for (UserDetail ele : userDetailList) { this.userDetailList.add(ele); } return this; } }
public class class_name { public GetAccountAuthorizationDetailsResult withUserDetailList(UserDetail... userDetailList) { if (this.userDetailList == null) { setUserDetailList(new com.amazonaws.internal.SdkInternalList<UserDetail>(userDetailList.length)); // depends on control dependency: [if], data = [none] } for (UserDetail ele : userDetailList) { this.userDetailList.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private boolean areElementsSame(int index1, int[] target, int index2, int length) { for (int i = 0; i < length; ++i) { if (v[index1 + i] != target[index2 + i]) { return false; } } return true; } }
public class class_name { private boolean areElementsSame(int index1, int[] target, int index2, int length) { for (int i = 0; i < length; ++i) { if (v[index1 + i] != target[index2 + i]) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private void visitObjectWithSpread(NodeTraversal t, Node obj) { checkArgument(obj.isObjectLit()); // Add an empty target object literal so changes made by Object.assign will not affect any other // variables. Node result = astFactory.createObjectDotAssignCall( t.getScope(), obj.getJSType(), astFactory.createEmptyObjectLit()); // An indicator whether the current last thing in the param list is an object literal to which // properties may be added. Initialized to null since nothing should be added to the empty // object literal in first position of the param list. Node trailingObjectLiteral = null; for (Node child : obj.children()) { if (child.isSpread()) { // Add the object directly to the param list. Node spreaded = child.removeFirstChild(); result.addChildToBack(spreaded); // Properties should not be added to the trailing object. trailingObjectLiteral = null; } else { if (trailingObjectLiteral == null) { // Add a new object to which properties may be added. trailingObjectLiteral = astFactory.createEmptyObjectLit(); result.addChildToBack(trailingObjectLiteral); } // Add the property to the object literal. trailingObjectLiteral.addChildToBack(child.detach()); } } result.useSourceInfoIfMissingFromForTree(obj); obj.replaceWith(result); compiler.reportChangeToEnclosingScope(result); } }
public class class_name { private void visitObjectWithSpread(NodeTraversal t, Node obj) { checkArgument(obj.isObjectLit()); // Add an empty target object literal so changes made by Object.assign will not affect any other // variables. Node result = astFactory.createObjectDotAssignCall( t.getScope(), obj.getJSType(), astFactory.createEmptyObjectLit()); // An indicator whether the current last thing in the param list is an object literal to which // properties may be added. Initialized to null since nothing should be added to the empty // object literal in first position of the param list. Node trailingObjectLiteral = null; for (Node child : obj.children()) { if (child.isSpread()) { // Add the object directly to the param list. Node spreaded = child.removeFirstChild(); result.addChildToBack(spreaded); // depends on control dependency: [if], data = [none] // Properties should not be added to the trailing object. trailingObjectLiteral = null; // depends on control dependency: [if], data = [none] } else { if (trailingObjectLiteral == null) { // Add a new object to which properties may be added. trailingObjectLiteral = astFactory.createEmptyObjectLit(); // depends on control dependency: [if], data = [none] result.addChildToBack(trailingObjectLiteral); // depends on control dependency: [if], data = [(trailingObjectLiteral] } // Add the property to the object literal. trailingObjectLiteral.addChildToBack(child.detach()); // depends on control dependency: [if], data = [none] } } result.useSourceInfoIfMissingFromForTree(obj); obj.replaceWith(result); compiler.reportChangeToEnclosingScope(result); } }
public class class_name { protected String trimResourceName(String resourceName) { if (resourceName.startsWith("/")) { resourceName = resourceName.substring(1); } if (resourceName.endsWith("/")) { resourceName = resourceName.substring(0, resourceName.length() - 1); } return resourceName; } }
public class class_name { protected String trimResourceName(String resourceName) { if (resourceName.startsWith("/")) { resourceName = resourceName.substring(1); // depends on control dependency: [if], data = [none] } if (resourceName.endsWith("/")) { resourceName = resourceName.substring(0, resourceName.length() - 1); // depends on control dependency: [if], data = [none] } return resourceName; } }
public class class_name { @Override public DataPoint[] getSeries(long timestampStartMs, long timestampEndMs, int steps, DataPoint.Type type) { DataPoint[] origin = getAllInRange(timestampStartMs, timestampEndMs); if (steps < 1) { steps = 1; } if (steps == 1) { return origin; } int n = origin.length / steps; if (n * steps < origin.length) { n++; } DataPoint[] result = new DataPoint[n]; int orgIndex = 0; int blockSize = steps * RESOLUTION_MS; for (DataPoint org : origin) { int resultIndex = orgIndex / steps; DataPoint block = result[resultIndex]; if (block == null) { long t = org.timestamp(); /* as of 0.5.0, the two following lines are commented out! */ // long delta = t % blockSize; // t -= delta; block = new DataPoint(DataPoint.Type.NONE, t, 0, blockSize); result[resultIndex] = block; } if (block.type() == DataPoint.Type.NONE && org.type() != DataPoint.Type.NONE) { block.type(type); } block.add(org); orgIndex++; } return result; } }
public class class_name { @Override public DataPoint[] getSeries(long timestampStartMs, long timestampEndMs, int steps, DataPoint.Type type) { DataPoint[] origin = getAllInRange(timestampStartMs, timestampEndMs); if (steps < 1) { steps = 1; // depends on control dependency: [if], data = [none] } if (steps == 1) { return origin; // depends on control dependency: [if], data = [none] } int n = origin.length / steps; if (n * steps < origin.length) { n++; // depends on control dependency: [if], data = [none] } DataPoint[] result = new DataPoint[n]; int orgIndex = 0; int blockSize = steps * RESOLUTION_MS; for (DataPoint org : origin) { int resultIndex = orgIndex / steps; DataPoint block = result[resultIndex]; if (block == null) { long t = org.timestamp(); /* as of 0.5.0, the two following lines are commented out! */ // long delta = t % blockSize; // t -= delta; block = new DataPoint(DataPoint.Type.NONE, t, 0, blockSize); // depends on control dependency: [if], data = [none] result[resultIndex] = block; // depends on control dependency: [if], data = [none] } if (block.type() == DataPoint.Type.NONE && org.type() != DataPoint.Type.NONE) { block.type(type); // depends on control dependency: [if], data = [none] } block.add(org); // depends on control dependency: [for], data = [org] orgIndex++; // depends on control dependency: [for], data = [org] } return result; } }
public class class_name { private static ILocationData createLocationData(ITraceURIConverter converter, ILocationInFileProvider locationProvider, EObject object, ILocationInFileProviderExtension.RegionDescription query, boolean skipEmpty) { ITextRegion textRegion = locationProvider instanceof ILocationInFileProviderExtension ? ((ILocationInFileProviderExtension) locationProvider).getTextRegion(object, query) : locationProvider.getFullTextRegion(object); if (!(textRegion instanceof ITextRegionWithLineInformation)) { if (log.isDebugEnabled()) log.debug("location provider returned text region without line information.", new Exception()); if (textRegion != null) textRegion = new TextRegionWithLineInformation(textRegion.getOffset(), textRegion.getLength(), 0, 0); else return null; } // usually we want to skip empty regions but if the root region is empty, we want to use it to store the path information along // with the empty offset / length pair if (skipEmpty && textRegion == ITextRegion.EMPTY_REGION) { return null; } ILocationData newData = createLocationData(converter, object, (ITextRegionWithLineInformation) textRegion); return newData; } }
public class class_name { private static ILocationData createLocationData(ITraceURIConverter converter, ILocationInFileProvider locationProvider, EObject object, ILocationInFileProviderExtension.RegionDescription query, boolean skipEmpty) { ITextRegion textRegion = locationProvider instanceof ILocationInFileProviderExtension ? ((ILocationInFileProviderExtension) locationProvider).getTextRegion(object, query) : locationProvider.getFullTextRegion(object); if (!(textRegion instanceof ITextRegionWithLineInformation)) { if (log.isDebugEnabled()) log.debug("location provider returned text region without line information.", new Exception()); if (textRegion != null) textRegion = new TextRegionWithLineInformation(textRegion.getOffset(), textRegion.getLength(), 0, 0); else return null; } // usually we want to skip empty regions but if the root region is empty, we want to use it to store the path information along // with the empty offset / length pair if (skipEmpty && textRegion == ITextRegion.EMPTY_REGION) { return null; // depends on control dependency: [if], data = [none] } ILocationData newData = createLocationData(converter, object, (ITextRegionWithLineInformation) textRegion); return newData; } }
public class class_name { private void initDecompressor(ChannelHandlerContext ctx, int streamId, Http2Headers headers, boolean endOfStream) throws Http2Exception { final Http2Stream stream = connection.stream(streamId); if (stream == null) { return; } Http2Decompressor decompressor = decompressor(stream); if (decompressor == null && !endOfStream) { // Determine the content encoding. CharSequence contentEncoding = headers.get(CONTENT_ENCODING); if (contentEncoding == null) { contentEncoding = IDENTITY; } final EmbeddedChannel channel = newContentDecompressor(ctx, contentEncoding); if (channel != null) { decompressor = new Http2Decompressor(channel); stream.setProperty(propertyKey, decompressor); // Decode the content and remove or replace the existing headers // so that the message looks like a decoded message. CharSequence targetContentEncoding = getTargetContentEncoding(contentEncoding); if (IDENTITY.contentEqualsIgnoreCase(targetContentEncoding)) { headers.remove(CONTENT_ENCODING); } else { headers.set(CONTENT_ENCODING, targetContentEncoding); } } } if (decompressor != null) { // The content length will be for the compressed data. Since we will decompress the data // this content-length will not be correct. Instead of queuing messages or delaying sending // header frames...just remove the content-length header headers.remove(CONTENT_LENGTH); // The first time that we initialize a decompressor, decorate the local flow controller to // properly convert consumed bytes. if (!flowControllerInitialized) { flowControllerInitialized = true; connection.local().flowController(new ConsumedBytesConverter(connection.local().flowController())); } } } }
public class class_name { private void initDecompressor(ChannelHandlerContext ctx, int streamId, Http2Headers headers, boolean endOfStream) throws Http2Exception { final Http2Stream stream = connection.stream(streamId); if (stream == null) { return; } Http2Decompressor decompressor = decompressor(stream); if (decompressor == null && !endOfStream) { // Determine the content encoding. CharSequence contentEncoding = headers.get(CONTENT_ENCODING); if (contentEncoding == null) { contentEncoding = IDENTITY; // depends on control dependency: [if], data = [none] } final EmbeddedChannel channel = newContentDecompressor(ctx, contentEncoding); if (channel != null) { decompressor = new Http2Decompressor(channel); // depends on control dependency: [if], data = [(channel] stream.setProperty(propertyKey, decompressor); // depends on control dependency: [if], data = [none] // Decode the content and remove or replace the existing headers // so that the message looks like a decoded message. CharSequence targetContentEncoding = getTargetContentEncoding(contentEncoding); if (IDENTITY.contentEqualsIgnoreCase(targetContentEncoding)) { headers.remove(CONTENT_ENCODING); // depends on control dependency: [if], data = [none] } else { headers.set(CONTENT_ENCODING, targetContentEncoding); // depends on control dependency: [if], data = [none] } } } if (decompressor != null) { // The content length will be for the compressed data. Since we will decompress the data // this content-length will not be correct. Instead of queuing messages or delaying sending // header frames...just remove the content-length header headers.remove(CONTENT_LENGTH); // The first time that we initialize a decompressor, decorate the local flow controller to // properly convert consumed bytes. if (!flowControllerInitialized) { flowControllerInitialized = true; connection.local().flowController(new ConsumedBytesConverter(connection.local().flowController())); } } } }
public class class_name { @Nonnull @ReturnsMutableCopy public ICommonsList <IFileItem> parseRequest (@Nonnull final IRequestContext aCtx) throws FileUploadException { final ICommonsList <IFileItem> aItems = new CommonsArrayList <> (); boolean bSuccessful = false; try { final IFileItemIterator aItemIter = getItemIterator (aCtx); final IFileItemFactory aFileItemFactory = getFileItemFactory (); if (aFileItemFactory == null) throw new IllegalStateException ("No FileItemFactory has been set."); while (aItemIter.hasNext ()) { final IFileItemStream aFileItemStream = aItemIter.next (); // Don't use getName() here to prevent an InvalidFileNameException. final IFileItem aFileItem = aFileItemFactory.createItem (aFileItemStream.getFieldName (), aFileItemStream.getContentType (), aFileItemStream.isFormField (), aFileItemStream.getNameUnchecked ()); aItems.add (aFileItem); InputStream aIS = null; OutputStream aOS = null; try { aIS = aFileItemStream.openStream (); aOS = aFileItem.getOutputStream (); final byte [] aBuffer = new byte [8192]; int nBytesRead; // potentially blocking read while ((nBytesRead = aIS.read (aBuffer, 0, aBuffer.length)) > -1) { aOS.write (aBuffer, 0, nBytesRead); } } catch (final FileUploadIOException ex) { throw (FileUploadException) ex.getCause (); } catch (final IOException ex) { throw new IOFileUploadException ("Processing of " + RequestHelper.MULTIPART_FORM_DATA + " request failed. " + ex.getMessage (), ex); } finally { StreamHelper.close (aIS); StreamHelper.close (aOS); } if (aFileItem instanceof IFileItemHeadersSupport) { final IFileItemHeaders aFileItemHeaders = aFileItemStream.getHeaders (); ((IFileItemHeadersSupport) aFileItem).setHeaders (aFileItemHeaders); } } bSuccessful = true; return aItems; } catch (final FileUploadIOException ex) { throw (FileUploadException) ex.getCause (); } catch (final IOException ex) { throw new FileUploadException (ex.getMessage (), ex); } finally { if (!bSuccessful) { // Delete all file items for (final IFileItem aFileItem : aItems) { try { aFileItem.delete (); } catch (final Exception ex) { // ignore it if (LOGGER.isErrorEnabled ()) LOGGER.error ("Failed to delete fileItem " + aFileItem, ex); } } } } } }
public class class_name { @Nonnull @ReturnsMutableCopy public ICommonsList <IFileItem> parseRequest (@Nonnull final IRequestContext aCtx) throws FileUploadException { final ICommonsList <IFileItem> aItems = new CommonsArrayList <> (); boolean bSuccessful = false; try { final IFileItemIterator aItemIter = getItemIterator (aCtx); final IFileItemFactory aFileItemFactory = getFileItemFactory (); if (aFileItemFactory == null) throw new IllegalStateException ("No FileItemFactory has been set."); while (aItemIter.hasNext ()) { final IFileItemStream aFileItemStream = aItemIter.next (); // Don't use getName() here to prevent an InvalidFileNameException. final IFileItem aFileItem = aFileItemFactory.createItem (aFileItemStream.getFieldName (), aFileItemStream.getContentType (), aFileItemStream.isFormField (), aFileItemStream.getNameUnchecked ()); aItems.add (aFileItem); // depends on control dependency: [while], data = [none] InputStream aIS = null; OutputStream aOS = null; try { aIS = aFileItemStream.openStream (); // depends on control dependency: [try], data = [none] aOS = aFileItem.getOutputStream (); // depends on control dependency: [try], data = [none] final byte [] aBuffer = new byte [8192]; int nBytesRead; // potentially blocking read while ((nBytesRead = aIS.read (aBuffer, 0, aBuffer.length)) > -1) { aOS.write (aBuffer, 0, nBytesRead); // depends on control dependency: [while], data = [none] } } catch (final FileUploadIOException ex) { throw (FileUploadException) ex.getCause (); } // depends on control dependency: [catch], data = [none] catch (final IOException ex) { throw new IOFileUploadException ("Processing of " + RequestHelper.MULTIPART_FORM_DATA + " request failed. " + ex.getMessage (), ex); } // depends on control dependency: [catch], data = [none] finally { StreamHelper.close (aIS); StreamHelper.close (aOS); } if (aFileItem instanceof IFileItemHeadersSupport) { final IFileItemHeaders aFileItemHeaders = aFileItemStream.getHeaders (); ((IFileItemHeadersSupport) aFileItem).setHeaders (aFileItemHeaders); // depends on control dependency: [if], data = [none] } } bSuccessful = true; return aItems; } catch (final FileUploadIOException ex) { throw (FileUploadException) ex.getCause (); } catch (final IOException ex) { throw new FileUploadException (ex.getMessage (), ex); } finally { if (!bSuccessful) { // Delete all file items for (final IFileItem aFileItem : aItems) { try { aFileItem.delete (); // depends on control dependency: [try], data = [none] } catch (final Exception ex) { // ignore it if (LOGGER.isErrorEnabled ()) LOGGER.error ("Failed to delete fileItem " + aFileItem, ex); } // depends on control dependency: [catch], data = [none] } } } } }
public class class_name { protected void notifyListenersPostResourceFound(HttpMessage message, int depth, String uri, String requestBody) { for (SpiderParserListener l : listeners) { l.resourcePostURIFound(message, depth, uri, requestBody); } } }
public class class_name { protected void notifyListenersPostResourceFound(HttpMessage message, int depth, String uri, String requestBody) { for (SpiderParserListener l : listeners) { l.resourcePostURIFound(message, depth, uri, requestBody); // depends on control dependency: [for], data = [l] } } }
public class class_name { public void reset() { if (null != hazelcastInstance) { synchronized (mutex) { if (null == hazelcastInstance) { hazelcastInstance.shutdown(); hazelcastInstance = null; } } } if (!stores.isEmpty()) { synchronized (mutex) { stores.clear(); } } } }
public class class_name { public void reset() { if (null != hazelcastInstance) { synchronized (mutex) { // depends on control dependency: [if], data = [none] if (null == hazelcastInstance) { hazelcastInstance.shutdown(); // depends on control dependency: [if], data = [none] hazelcastInstance = null; // depends on control dependency: [if], data = [none] } } } if (!stores.isEmpty()) { synchronized (mutex) { // depends on control dependency: [if], data = [none] stores.clear(); } } } }
public class class_name { public static List<AnnotatedHttpServiceElement> find(String pathPrefix, Object object, Iterable<?> exceptionHandlersAndConverters) { Builder<ExceptionHandlerFunction> exceptionHandlers = null; Builder<RequestConverterFunction> requestConverters = null; Builder<ResponseConverterFunction> responseConverters = null; for (final Object o : exceptionHandlersAndConverters) { boolean added = false; if (o instanceof ExceptionHandlerFunction) { if (exceptionHandlers == null) { exceptionHandlers = ImmutableList.builder(); } exceptionHandlers.add((ExceptionHandlerFunction) o); added = true; } if (o instanceof RequestConverterFunction) { if (requestConverters == null) { requestConverters = ImmutableList.builder(); } requestConverters.add((RequestConverterFunction) o); added = true; } if (o instanceof ResponseConverterFunction) { if (responseConverters == null) { responseConverters = ImmutableList.builder(); } responseConverters.add((ResponseConverterFunction) o); added = true; } if (!added) { throw new IllegalArgumentException(o.getClass().getName() + " is neither an exception handler nor a converter."); } } final List<ExceptionHandlerFunction> exceptionHandlerFunctions = exceptionHandlers != null ? exceptionHandlers.build() : ImmutableList.of(); final List<RequestConverterFunction> requestConverterFunctions = requestConverters != null ? requestConverters.build() : ImmutableList.of(); final List<ResponseConverterFunction> responseConverterFunctions = responseConverters != null ? responseConverters.build() : ImmutableList.of(); final List<Method> methods = requestMappingMethods(object); return methods.stream() .map((Method method) -> create(pathPrefix, object, method, exceptionHandlerFunctions, requestConverterFunctions, responseConverterFunctions)) .collect(toImmutableList()); } }
public class class_name { public static List<AnnotatedHttpServiceElement> find(String pathPrefix, Object object, Iterable<?> exceptionHandlersAndConverters) { Builder<ExceptionHandlerFunction> exceptionHandlers = null; Builder<RequestConverterFunction> requestConverters = null; Builder<ResponseConverterFunction> responseConverters = null; for (final Object o : exceptionHandlersAndConverters) { boolean added = false; if (o instanceof ExceptionHandlerFunction) { if (exceptionHandlers == null) { exceptionHandlers = ImmutableList.builder(); // depends on control dependency: [if], data = [none] } exceptionHandlers.add((ExceptionHandlerFunction) o); // depends on control dependency: [if], data = [none] added = true; // depends on control dependency: [if], data = [none] } if (o instanceof RequestConverterFunction) { if (requestConverters == null) { requestConverters = ImmutableList.builder(); // depends on control dependency: [if], data = [none] } requestConverters.add((RequestConverterFunction) o); // depends on control dependency: [if], data = [none] added = true; // depends on control dependency: [if], data = [none] } if (o instanceof ResponseConverterFunction) { if (responseConverters == null) { responseConverters = ImmutableList.builder(); // depends on control dependency: [if], data = [none] } responseConverters.add((ResponseConverterFunction) o); // depends on control dependency: [if], data = [none] added = true; // depends on control dependency: [if], data = [none] } if (!added) { throw new IllegalArgumentException(o.getClass().getName() + " is neither an exception handler nor a converter."); } } final List<ExceptionHandlerFunction> exceptionHandlerFunctions = exceptionHandlers != null ? exceptionHandlers.build() : ImmutableList.of(); final List<RequestConverterFunction> requestConverterFunctions = requestConverters != null ? requestConverters.build() : ImmutableList.of(); final List<ResponseConverterFunction> responseConverterFunctions = responseConverters != null ? responseConverters.build() : ImmutableList.of(); final List<Method> methods = requestMappingMethods(object); return methods.stream() .map((Method method) -> create(pathPrefix, object, method, exceptionHandlerFunctions, requestConverterFunctions, responseConverterFunctions)) .collect(toImmutableList()); } }
public class class_name { private void addMeterValuesToTransaction(final Transaction transaction, final List<MeterValue> meterValues) { for (MeterValue meterValue : meterValues) { addMeterValueToTransaction(transaction, meterValue); } } }
public class class_name { private void addMeterValuesToTransaction(final Transaction transaction, final List<MeterValue> meterValues) { for (MeterValue meterValue : meterValues) { addMeterValueToTransaction(transaction, meterValue); // depends on control dependency: [for], data = [meterValue] } } }
public class class_name { private ApplicationDefinition getApplicationDefinition(Tenant tenant, String appName) { Iterator<DColumn> colIter = DBService.instance(tenant).getAllColumns(SchemaService.APPS_STORE_NAME, appName).iterator(); if (!colIter.hasNext()) { return null; } return loadAppRow(tenant, getColumnMap(colIter)); } }
public class class_name { private ApplicationDefinition getApplicationDefinition(Tenant tenant, String appName) { Iterator<DColumn> colIter = DBService.instance(tenant).getAllColumns(SchemaService.APPS_STORE_NAME, appName).iterator(); if (!colIter.hasNext()) { return null; // depends on control dependency: [if], data = [none] } return loadAppRow(tenant, getColumnMap(colIter)); } }
public class class_name { public double getCovariance() { if(covariance == null) { Observation o = new Observation(); for(int i=0; i<observationA.getObservationCount(); i++) o.addValue(observationA.getValueAt(i)*observationB.getValueAt(i)); covariance = o.getExpectation()-observationA.getExpectation()*observationB.getExpectation(); } return covariance; } }
public class class_name { public double getCovariance() { if(covariance == null) { Observation o = new Observation(); for(int i=0; i<observationA.getObservationCount(); i++) o.addValue(observationA.getValueAt(i)*observationB.getValueAt(i)); covariance = o.getExpectation()-observationA.getExpectation()*observationB.getExpectation(); // depends on control dependency: [if], data = [none] } return covariance; } }
public class class_name { @Override public void verify(Statement s) throws SymbolWarning, IndexingFailure, ResourceDownloadError { List<Parameter> parameters = s.getAllParameters(); // first iteration to open all namespaces for (Parameter p : parameters) { if (p.getNamespace() == null || p.getNamespace().getResourceLocation() == null) { continue; } String resourceLocation = p.getNamespace().getResourceLocation(); synchronized (resourceLocation) { if (!isOpen(resourceLocation)) { final String indexPath = doCompile(resourceLocation); openNamespace(resourceLocation, indexPath); } } } final List<NamespaceSyntaxWarning> exceptions = new ArrayList<NamespaceSyntaxWarning>(); for (Parameter p : s.getAllParameters()) { Namespace ns = p.getNamespace(); if (ns == null) { continue; } try { doVerify(p); } catch (NamespaceSyntaxWarning w) { exceptions.add(w); } } if (!exceptions.isEmpty()) { // TODO review name final String name = s.toString(); final String fmt = INVALID_SYMBOLS; final String msg = format(fmt, exceptions.size()); throw new SymbolWarning(name, msg, exceptions); } } }
public class class_name { @Override public void verify(Statement s) throws SymbolWarning, IndexingFailure, ResourceDownloadError { List<Parameter> parameters = s.getAllParameters(); // first iteration to open all namespaces for (Parameter p : parameters) { if (p.getNamespace() == null || p.getNamespace().getResourceLocation() == null) { continue; } String resourceLocation = p.getNamespace().getResourceLocation(); synchronized (resourceLocation) { if (!isOpen(resourceLocation)) { final String indexPath = doCompile(resourceLocation); openNamespace(resourceLocation, indexPath); // depends on control dependency: [if], data = [none] } } } final List<NamespaceSyntaxWarning> exceptions = new ArrayList<NamespaceSyntaxWarning>(); for (Parameter p : s.getAllParameters()) { Namespace ns = p.getNamespace(); if (ns == null) { continue; } try { doVerify(p); } catch (NamespaceSyntaxWarning w) { exceptions.add(w); } } if (!exceptions.isEmpty()) { // TODO review name final String name = s.toString(); final String fmt = INVALID_SYMBOLS; final String msg = format(fmt, exceptions.size()); throw new SymbolWarning(name, msg, exceptions); } } }
public class class_name { @Override public boolean remove(Object o) { Integer id = indexOf((Record) o); if(id == null) { return false; } remove(id); return true; } }
public class class_name { @Override public boolean remove(Object o) { Integer id = indexOf((Record) o); if(id == null) { return false; // depends on control dependency: [if], data = [none] } remove(id); return true; } }
public class class_name { @Override public void drawText(Graphics2D graphics, int width, int height) { int textLength = (int) (width * textWidthPercent); // 计算水印字体大小 int fontsize = textLength / text.length(); if(fontsize < minFontSize) { return ; } graphics.setFont(new Font(defaultFont.getFontName(), Font.PLAIN, fontsize)); graphics.setColor(fontColor); graphics.drawString(text, (int)(width * xFactor), (int)(height * yFactor)); } }
public class class_name { @Override public void drawText(Graphics2D graphics, int width, int height) { int textLength = (int) (width * textWidthPercent); // 计算水印字体大小 int fontsize = textLength / text.length(); if(fontsize < minFontSize) { return ; // depends on control dependency: [if], data = [none] } graphics.setFont(new Font(defaultFont.getFontName(), Font.PLAIN, fontsize)); graphics.setColor(fontColor); graphics.drawString(text, (int)(width * xFactor), (int)(height * yFactor)); } }
public class class_name { public void update(final String datum) { if ((datum == null) || datum.isEmpty()) { return; } final byte[] data = datum.getBytes(UTF_8); final long[] arr = hash(data, seed); hashUpdate(arr[0], arr[1]); } }
public class class_name { public void update(final String datum) { if ((datum == null) || datum.isEmpty()) { return; } // depends on control dependency: [if], data = [none] final byte[] data = datum.getBytes(UTF_8); final long[] arr = hash(data, seed); hashUpdate(arr[0], arr[1]); } }
public class class_name { public void removeObservableListener(ObservableListener<String> listener) { if (adaptersByListener.containsKey(listener)) { DocumentListener adapter = adaptersByListener.remove(listener); textComponent.getDocument().removeDocumentListener(adapter); } } }
public class class_name { public void removeObservableListener(ObservableListener<String> listener) { if (adaptersByListener.containsKey(listener)) { DocumentListener adapter = adaptersByListener.remove(listener); textComponent.getDocument().removeDocumentListener(adapter); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public Collection<V> get(@Nullable K key) { Collection<V> collection = map.get(key); if (collection == null) { collection = createCollection(key); } return wrapCollection(key, collection); } }
public class class_name { @Override public Collection<V> get(@Nullable K key) { Collection<V> collection = map.get(key); if (collection == null) { collection = createCollection(key); // depends on control dependency: [if], data = [none] } return wrapCollection(key, collection); } }
public class class_name { String stringValue( CssFormatter formatter ) { String str; try { formatter.addOutput(); appendTo( formatter ); } catch( Exception ex ) { throw createException( ex ); } finally { str = formatter.releaseOutput(); } return str; } }
public class class_name { String stringValue( CssFormatter formatter ) { String str; try { formatter.addOutput(); // depends on control dependency: [try], data = [none] appendTo( formatter ); // depends on control dependency: [try], data = [none] } catch( Exception ex ) { throw createException( ex ); } finally { // depends on control dependency: [catch], data = [none] str = formatter.releaseOutput(); } return str; } }
public class class_name { public static void setDnsCache(long expireMillis, String host, String... ips) { try { InetAddressCacheUtil.setInetAddressCache(host, ips, System.currentTimeMillis() + expireMillis); } catch (Exception e) { final String message = String.format("Fail to setDnsCache for host %s ip %s expireMillis %s, cause: %s", host, Arrays.toString(ips), expireMillis, e.toString()); throw new DnsCacheManipulatorException(message, e); } } }
public class class_name { public static void setDnsCache(long expireMillis, String host, String... ips) { try { InetAddressCacheUtil.setInetAddressCache(host, ips, System.currentTimeMillis() + expireMillis); // depends on control dependency: [try], data = [none] } catch (Exception e) { final String message = String.format("Fail to setDnsCache for host %s ip %s expireMillis %s, cause: %s", host, Arrays.toString(ips), expireMillis, e.toString()); throw new DnsCacheManipulatorException(message, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static boolean namedNodeMapsAreEqual(final NamedNodeMap a, final NamedNodeMap b) { if (a == b) { return true; } if ((a == null) || (b == null)) { return false; } if (a.getLength() != b.getLength()) { return false; } List<Node> listA = new ArrayList<Node>(a.getLength()); List<Node> listB = new ArrayList<Node>(a.getLength()); for (int i = 0; i < a.getLength(); ++i) { listA.add(a.item(i)); listB.add(b.item(i)); } Collections.sort(listA, ATTRIBUTE_NODE_COMPARATOR); Collections.sort(listB, ATTRIBUTE_NODE_COMPARATOR); for (Node n1 : listA) { if (!nodesAreEqual(n1, listB.remove(0))) { return false; } } return true; } }
public class class_name { private static boolean namedNodeMapsAreEqual(final NamedNodeMap a, final NamedNodeMap b) { if (a == b) { return true; // depends on control dependency: [if], data = [none] } if ((a == null) || (b == null)) { return false; // depends on control dependency: [if], data = [none] } if (a.getLength() != b.getLength()) { return false; // depends on control dependency: [if], data = [none] } List<Node> listA = new ArrayList<Node>(a.getLength()); List<Node> listB = new ArrayList<Node>(a.getLength()); for (int i = 0; i < a.getLength(); ++i) { listA.add(a.item(i)); // depends on control dependency: [for], data = [i] listB.add(b.item(i)); // depends on control dependency: [for], data = [i] } Collections.sort(listA, ATTRIBUTE_NODE_COMPARATOR); Collections.sort(listB, ATTRIBUTE_NODE_COMPARATOR); for (Node n1 : listA) { if (!nodesAreEqual(n1, listB.remove(0))) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public void setPathSelfScore(Term from, boolean asc) { double score = this.selfScore + from.score; // 维特比进行最优路径的构建 if (this.from == null) { this.setFromAndScore(from, score); } else { if ((this.score > score) == asc) { this.setFromAndScore(from, score); } } } }
public class class_name { public void setPathSelfScore(Term from, boolean asc) { double score = this.selfScore + from.score; // 维特比进行最优路径的构建 if (this.from == null) { this.setFromAndScore(from, score); // depends on control dependency: [if], data = [none] } else { if ((this.score > score) == asc) { this.setFromAndScore(from, score); // depends on control dependency: [if], data = [none] } } } }
public class class_name { static private final Date parseISODate(String stringValue) { try { return getDateFormat().parse(stringValue); } catch (ParseException pe) { if (LOG.isLoggable(Level.INFO)) { LOG.log(Level.INFO, "CANNOT_PARSE_VALUE_INTO_DATE_WITH_YYYY_MM_DD_PATTERN "+ stringValue, pe); } return null; } } }
public class class_name { static private final Date parseISODate(String stringValue) { try { return getDateFormat().parse(stringValue); // depends on control dependency: [try], data = [none] } catch (ParseException pe) { if (LOG.isLoggable(Level.INFO)) { LOG.log(Level.INFO, "CANNOT_PARSE_VALUE_INTO_DATE_WITH_YYYY_MM_DD_PATTERN "+ stringValue, pe); // depends on control dependency: [if], data = [none] } return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public Collection<URL> getURLs() { try { // As a container URL, the URL must end with a trailing slash. URL entryUrl = rootContainer.createEntryUri( getRelativePath() + "/" ).toURL(); return Collections.singleton(entryUrl); } catch ( MalformedURLException e ) { // FFDC return Collections.emptyList(); } } }
public class class_name { @Override public Collection<URL> getURLs() { try { // As a container URL, the URL must end with a trailing slash. URL entryUrl = rootContainer.createEntryUri( getRelativePath() + "/" ).toURL(); return Collections.singleton(entryUrl); // depends on control dependency: [try], data = [none] } catch ( MalformedURLException e ) { // FFDC return Collections.emptyList(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public String readLine() throws IOException { StringBuilder str = new StringBuilder(); while (true) { int c = read(); if (c < 0) { break; } if (c == '\n') { // if possible consume another '\r' int peek = stream.read(); if (peek != '\r' && peek >= 0){ stream.unread(peek); } break; } if (c == '\r') { // if possible consume another '\n' int peek = stream.read(); if (peek != '\n' && peek >= 0){ stream.unread(peek); } break; } str.append((char) c); } return str.toString(); } }
public class class_name { public String readLine() throws IOException { StringBuilder str = new StringBuilder(); while (true) { int c = read(); if (c < 0) { break; } if (c == '\n') { // if possible consume another '\r' int peek = stream.read(); if (peek != '\r' && peek >= 0){ stream.unread(peek); // depends on control dependency: [if], data = [(peek] } break; } if (c == '\r') { // if possible consume another '\n' int peek = stream.read(); if (peek != '\n' && peek >= 0){ stream.unread(peek); // depends on control dependency: [if], data = [(peek] } break; } str.append((char) c); } return str.toString(); } }
public class class_name { public static void main(String[] args) { System.out.println(version); if (args.length < 1) { // No arguments - lazily initialize readme, print readme and usage initReadme(); if (readme != null) { System.out.println(readme); } printUsage(System.out); return; } // Last argument should be a path to the document root String name = args[args.length-1]; // Analyze the rest of parameters for (int i = 0 ; i < args.length -1; i++) { if ("-R".equalsIgnoreCase(args[i])) { recursive = true; } else if ("-C".equalsIgnoreCase(args[i])) { doPatch = false; } else { System.err.println("Unknown option passed: "+args[i]); printUsage(System.err); return; } } new JavadocFixTool().proceed(name); } }
public class class_name { public static void main(String[] args) { System.out.println(version); if (args.length < 1) { // No arguments - lazily initialize readme, print readme and usage initReadme(); // depends on control dependency: [if], data = [none] if (readme != null) { System.out.println(readme); // depends on control dependency: [if], data = [(readme] } printUsage(System.out); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // Last argument should be a path to the document root String name = args[args.length-1]; // Analyze the rest of parameters for (int i = 0 ; i < args.length -1; i++) { if ("-R".equalsIgnoreCase(args[i])) { recursive = true; } else if ("-C".equalsIgnoreCase(args[i])) { doPatch = false; } else { System.err.println("Unknown option passed: "+args[i]); printUsage(System.err); return; } } new JavadocFixTool().proceed(name); } }
public class class_name { public void storeMtoNImplementor(CollectionDescriptor cod, Object realObject, Object otherObj, Collection mnKeys) { ClassDescriptor cld = pb.getDescriptorRepository().getDescriptorFor(realObject.getClass()); ValueContainer[] pkValues = pb.serviceBrokerHelper().getKeyValues(cld, realObject); String[] pkColumns = cod.getFksToThisClass(); ClassDescriptor otherCld = pb.getDescriptorRepository().getDescriptorFor(ProxyHelper.getRealClass(otherObj)); ValueContainer[] otherPkValues = pb.serviceBrokerHelper().getKeyValues(otherCld, otherObj); String[] otherPkColumns = cod.getFksToItemClass(); String table = cod.getIndirectionTable(); MtoNBroker.Key key = new MtoNBroker.Key(otherPkValues); if(mnKeys.contains(key)) { return; } /* fix for OJB-76, composite M & N keys that have some fields common find the "shared" indirection table columns, values and remove these from m- or n- side */ for(int i = 0; i < otherPkColumns.length; i++) { int index = ArrayUtils.indexOf(pkColumns, otherPkColumns[i]); if(index != -1) { // shared indirection table column found, remove this column from one side pkColumns = (String[]) ArrayUtils.remove(pkColumns, index); // remove duplicate value too pkValues = (ValueContainer[]) ArrayUtils.remove(pkValues, index); } } String[] cols = mergeColumns(pkColumns, otherPkColumns); String insertStmt = pb.serviceSqlGenerator().getInsertMNStatement(table, pkColumns, otherPkColumns); ValueContainer[] values = mergeContainer(pkValues, otherPkValues); GenericObject gObj = new GenericObject(table, cols, values); if(! tempObjects.contains(gObj)) { pb.serviceJdbcAccess().executeUpdateSQL(insertStmt, cld, pkValues, otherPkValues); tempObjects.add(gObj); } } }
public class class_name { public void storeMtoNImplementor(CollectionDescriptor cod, Object realObject, Object otherObj, Collection mnKeys) { ClassDescriptor cld = pb.getDescriptorRepository().getDescriptorFor(realObject.getClass()); ValueContainer[] pkValues = pb.serviceBrokerHelper().getKeyValues(cld, realObject); String[] pkColumns = cod.getFksToThisClass(); ClassDescriptor otherCld = pb.getDescriptorRepository().getDescriptorFor(ProxyHelper.getRealClass(otherObj)); ValueContainer[] otherPkValues = pb.serviceBrokerHelper().getKeyValues(otherCld, otherObj); String[] otherPkColumns = cod.getFksToItemClass(); String table = cod.getIndirectionTable(); MtoNBroker.Key key = new MtoNBroker.Key(otherPkValues); if(mnKeys.contains(key)) { return; // depends on control dependency: [if], data = [none] } /* fix for OJB-76, composite M & N keys that have some fields common find the "shared" indirection table columns, values and remove these from m- or n- side */ for(int i = 0; i < otherPkColumns.length; i++) { int index = ArrayUtils.indexOf(pkColumns, otherPkColumns[i]); if(index != -1) { // shared indirection table column found, remove this column from one side pkColumns = (String[]) ArrayUtils.remove(pkColumns, index); // depends on control dependency: [if], data = [none] // remove duplicate value too pkValues = (ValueContainer[]) ArrayUtils.remove(pkValues, index); // depends on control dependency: [if], data = [none] } } String[] cols = mergeColumns(pkColumns, otherPkColumns); String insertStmt = pb.serviceSqlGenerator().getInsertMNStatement(table, pkColumns, otherPkColumns); ValueContainer[] values = mergeContainer(pkValues, otherPkValues); GenericObject gObj = new GenericObject(table, cols, values); if(! tempObjects.contains(gObj)) { pb.serviceJdbcAccess().executeUpdateSQL(insertStmt, cld, pkValues, otherPkValues); // depends on control dependency: [if], data = [none] tempObjects.add(gObj); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addFields(List<ModelFieldBean> modelFields) { Assert.notNull(modelFields, "modelFields must not be null"); for (ModelFieldBean bean : modelFields) { this.fields.put(bean.getName(), bean); } } }
public class class_name { public void addFields(List<ModelFieldBean> modelFields) { Assert.notNull(modelFields, "modelFields must not be null"); for (ModelFieldBean bean : modelFields) { this.fields.put(bean.getName(), bean); // depends on control dependency: [for], data = [bean] } } }
public class class_name { public Observable<ServiceResponse<List<TypeFieldInner>>> listFieldsByModuleAndTypeWithServiceResponseAsync(String resourceGroupName, String automationAccountName, String moduleName, String typeName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (automationAccountName == null) { throw new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."); } if (moduleName == null) { throw new IllegalArgumentException("Parameter moduleName is required and cannot be null."); } if (typeName == null) { throw new IllegalArgumentException("Parameter typeName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2015-10-31"; return service.listFieldsByModuleAndType(resourceGroupName, automationAccountName, moduleName, typeName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<TypeFieldInner>>>>() { @Override public Observable<ServiceResponse<List<TypeFieldInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl1<TypeFieldInner>> result = listFieldsByModuleAndTypeDelegate(response); List<TypeFieldInner> items = null; if (result.body() != null) { items = result.body().items(); } ServiceResponse<List<TypeFieldInner>> clientResponse = new ServiceResponse<List<TypeFieldInner>>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<List<TypeFieldInner>>> listFieldsByModuleAndTypeWithServiceResponseAsync(String resourceGroupName, String automationAccountName, String moduleName, String typeName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (automationAccountName == null) { throw new IllegalArgumentException("Parameter automationAccountName is required and cannot be null."); } if (moduleName == null) { throw new IllegalArgumentException("Parameter moduleName is required and cannot be null."); } if (typeName == null) { throw new IllegalArgumentException("Parameter typeName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2015-10-31"; return service.listFieldsByModuleAndType(resourceGroupName, automationAccountName, moduleName, typeName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<TypeFieldInner>>>>() { @Override public Observable<ServiceResponse<List<TypeFieldInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl1<TypeFieldInner>> result = listFieldsByModuleAndTypeDelegate(response); List<TypeFieldInner> items = null; if (result.body() != null) { items = result.body().items(); // depends on control dependency: [if], data = [none] } ServiceResponse<List<TypeFieldInner>> clientResponse = new ServiceResponse<List<TypeFieldInner>>(items, result.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 DescribeClientVpnRoutesResult withRoutes(ClientVpnRoute... routes) { if (this.routes == null) { setRoutes(new com.amazonaws.internal.SdkInternalList<ClientVpnRoute>(routes.length)); } for (ClientVpnRoute ele : routes) { this.routes.add(ele); } return this; } }
public class class_name { public DescribeClientVpnRoutesResult withRoutes(ClientVpnRoute... routes) { if (this.routes == null) { setRoutes(new com.amazonaws.internal.SdkInternalList<ClientVpnRoute>(routes.length)); // depends on control dependency: [if], data = [none] } for (ClientVpnRoute ele : routes) { this.routes.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void setShadowsEnabled(final boolean ENABLED) { if (null == shadowsEnabled) { _shadowsEnabled = ENABLED; fireUpdateEvent(REDRAW_EVENT); } else { shadowsEnabled.set(ENABLED); } } }
public class class_name { public void setShadowsEnabled(final boolean ENABLED) { if (null == shadowsEnabled) { _shadowsEnabled = ENABLED; // depends on control dependency: [if], data = [none] fireUpdateEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none] } else { shadowsEnabled.set(ENABLED); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static <T> void aggregateRoutes( String method, Map<PathPattern, T> routes, List<String> accMethods, List<String> accPatterns, List<String> accTargets) { for (Map.Entry<PathPattern, T> entry : routes.entrySet()) { accMethods.add(method); accPatterns.add("/" + entry.getKey().pattern()); accTargets.add(targetToString(entry.getValue())); } } }
public class class_name { private static <T> void aggregateRoutes( String method, Map<PathPattern, T> routes, List<String> accMethods, List<String> accPatterns, List<String> accTargets) { for (Map.Entry<PathPattern, T> entry : routes.entrySet()) { accMethods.add(method); // depends on control dependency: [for], data = [none] accPatterns.add("/" + entry.getKey().pattern()); // depends on control dependency: [for], data = [entry] accTargets.add(targetToString(entry.getValue())); // depends on control dependency: [for], data = [entry] } } }
public class class_name { public long compute(java.util.Vector<Long> e, java.util.Vector<java.util.List<Edge>> c, java.util.Vector<java.util.List<EdgeFlow>> x) { assert e.size() == c.size(); assert x.size() == c.size(); numNodes = e.size(); nodesToQ = new java.util.Vector<Integer>(); for (int i = 0; i < numNodes; i++) { nodesToQ.add(0); } // init flow for (int from = 0; from < numNodes; ++from) { for (Edge it : c.get(from)) { x.get(from).add(new EdgeFlow(it.getTo(), it.getCost(), 0)); x.get(it.getTo()).add(new EdgeFlow(from, -it.getCost(), 0)); } } // reduced costs for forward edges (c[i,j]-pi[i]+pi[j]) // Note that for forward edges the residual capacity is infinity java.util.Vector<java.util.List<ReducedEdge>> rCostForward = new java.util.Vector<java.util.List<ReducedEdge>>(); for (int i = 0; i < numNodes; i++) { rCostForward.add(new java.util.LinkedList<ReducedEdge>()); } for (int from = 0; from < numNodes; ++from) { for (Edge it : c.get(from)) { rCostForward.get(from).add(new ReducedEdge(it.getTo(), it.getCost())); } } // reduced costs and capacity for backward edges // (c[j,i]-pi[j]+pi[i]) // Since the flow at the beginning is 0, the residual capacity is // also zero java.util.Vector<java.util.List<ResidualReducedEdge>> rCostCapBackward = new java.util.Vector<java.util.List<ResidualReducedEdge>>(); for (int i = 0; i < numNodes; i++) { rCostCapBackward.add(new java.util.LinkedList<ResidualReducedEdge>()); } for (int from = 0; from < numNodes; ++from) { for (Edge it : c.get(from)) { rCostCapBackward.get(it.getTo()).add( new ResidualReducedEdge(from, -it.getCost(), 0)); } } // Max supply TODO:demand?, given U?, optimization-> min out of // demand,supply long u = 0; for (int i = 0; i < numNodes; i++) { if (e.get(i) > u) { u = e.get(i); } } //long delta = (long) (Math.pow(2.0, Math.ceil(Math.log((double) U) / Math.log(2.0)))); java.util.Vector<Long> d = new java.util.Vector<Long>(); java.util.Vector<Integer> prev = new java.util.Vector<Integer>(); for (int i = 0; i < numNodes; i++) { d.add(0L); prev.add(0); } long delta = 1; long tmp; while (true) { // until we break when S or T is empty long maxSupply = 0; int k = 0; for (int i = 0; i < numNodes; i++) { if (e.get(i) > 0) { if (maxSupply < e.get(i)) { maxSupply = e.get(i); k = i; } } } if (maxSupply == 0) { break; } delta = maxSupply; int[] l = new int[1]; computeShortestPath(d, prev, k, rCostForward, rCostCapBackward, e, l); // find delta (minimum on the path from k to l) // delta= e[k]; // if (-e[l]<delta) delta= e[k]; int to = l[0]; do { int from = prev.get(to); assert from != to; // residual int itccb = 0; while ((itccb < rCostCapBackward.get(from).size()) && (rCostCapBackward.get(from).get(itccb).getTo() != to)) { itccb++; } if (itccb < rCostCapBackward.get(from).size()) { if (rCostCapBackward.get(from).get(itccb).getResidualCapacity() < delta) { delta = rCostCapBackward.get(from).get(itccb).getResidualCapacity(); } } to = from; } while (to != k); // augment delta flow from k to l (backwards actually...) to = l[0]; do { int from = prev.get(to); assert from != to; // TODO - might do here O(n) can be done in O(1) int itx = 0; while (x.get(from).get(itx).getTo() != to) { itx++; } tmp = x.get(from).get(itx).getFlow(); x.get(from).get(itx).setFlow(tmp + delta); // update residual for backward edges int itccb = 0; while ((itccb < rCostCapBackward.get(to).size()) && (rCostCapBackward.get(to).get(itccb).getTo() != from)) { itccb++; } if (itccb < rCostCapBackward.get(to).size()) { tmp = rCostCapBackward.get(to).get(itccb).getResidualCapacity(); rCostCapBackward.get(to).get(itccb).setResidualCapacity(tmp + delta); } itccb = 0; while ((itccb < rCostCapBackward.get(from).size()) && (rCostCapBackward.get(from).get(itccb).getTo() != to)) { itccb++; } if (itccb < rCostCapBackward.get(from).size()) { tmp = rCostCapBackward.get(from).get(itccb).getResidualCapacity(); rCostCapBackward.get(from).get(itccb).setResidualCapacity(tmp - delta); } // update e e.set(to, e.get(to) + delta); e.set(from, e.get(from) - delta); to = from; } while (to != k); } // compute distance from x long dist = 0; for (int from = 0; from < numNodes; from++) { for (EdgeFlow it : x.get(from)) { dist += it.getCost() * it.getFlow(); } } return dist; } }
public class class_name { public long compute(java.util.Vector<Long> e, java.util.Vector<java.util.List<Edge>> c, java.util.Vector<java.util.List<EdgeFlow>> x) { assert e.size() == c.size(); assert x.size() == c.size(); numNodes = e.size(); nodesToQ = new java.util.Vector<Integer>(); for (int i = 0; i < numNodes; i++) { nodesToQ.add(0); // depends on control dependency: [for], data = [none] } // init flow for (int from = 0; from < numNodes; ++from) { for (Edge it : c.get(from)) { x.get(from).add(new EdgeFlow(it.getTo(), it.getCost(), 0)); // depends on control dependency: [for], data = [it] x.get(it.getTo()).add(new EdgeFlow(from, -it.getCost(), 0)); // depends on control dependency: [for], data = [it] } } // reduced costs for forward edges (c[i,j]-pi[i]+pi[j]) // Note that for forward edges the residual capacity is infinity java.util.Vector<java.util.List<ReducedEdge>> rCostForward = new java.util.Vector<java.util.List<ReducedEdge>>(); for (int i = 0; i < numNodes; i++) { rCostForward.add(new java.util.LinkedList<ReducedEdge>()); // depends on control dependency: [for], data = [none] } for (int from = 0; from < numNodes; ++from) { for (Edge it : c.get(from)) { rCostForward.get(from).add(new ReducedEdge(it.getTo(), it.getCost())); // depends on control dependency: [for], data = [it] } } // reduced costs and capacity for backward edges // (c[j,i]-pi[j]+pi[i]) // Since the flow at the beginning is 0, the residual capacity is // also zero java.util.Vector<java.util.List<ResidualReducedEdge>> rCostCapBackward = new java.util.Vector<java.util.List<ResidualReducedEdge>>(); for (int i = 0; i < numNodes; i++) { rCostCapBackward.add(new java.util.LinkedList<ResidualReducedEdge>()); // depends on control dependency: [for], data = [none] } for (int from = 0; from < numNodes; ++from) { for (Edge it : c.get(from)) { rCostCapBackward.get(it.getTo()).add( new ResidualReducedEdge(from, -it.getCost(), 0)); // depends on control dependency: [for], data = [it] } } // Max supply TODO:demand?, given U?, optimization-> min out of // demand,supply long u = 0; for (int i = 0; i < numNodes; i++) { if (e.get(i) > u) { u = e.get(i); // depends on control dependency: [if], data = [none] } } //long delta = (long) (Math.pow(2.0, Math.ceil(Math.log((double) U) / Math.log(2.0)))); java.util.Vector<Long> d = new java.util.Vector<Long>(); java.util.Vector<Integer> prev = new java.util.Vector<Integer>(); for (int i = 0; i < numNodes; i++) { d.add(0L); // depends on control dependency: [for], data = [none] prev.add(0); // depends on control dependency: [for], data = [none] } long delta = 1; long tmp; while (true) { // until we break when S or T is empty long maxSupply = 0; int k = 0; for (int i = 0; i < numNodes; i++) { if (e.get(i) > 0) { if (maxSupply < e.get(i)) { maxSupply = e.get(i); // depends on control dependency: [if], data = [none] k = i; // depends on control dependency: [if], data = [none] } } } if (maxSupply == 0) { break; } delta = maxSupply; // depends on control dependency: [while], data = [none] int[] l = new int[1]; computeShortestPath(d, prev, k, rCostForward, rCostCapBackward, e, l); // depends on control dependency: [while], data = [none] // find delta (minimum on the path from k to l) // delta= e[k]; // if (-e[l]<delta) delta= e[k]; int to = l[0]; do { int from = prev.get(to); assert from != to; // residual int itccb = 0; while ((itccb < rCostCapBackward.get(from).size()) && (rCostCapBackward.get(from).get(itccb).getTo() != to)) { itccb++; // depends on control dependency: [while], data = [none] } if (itccb < rCostCapBackward.get(from).size()) { if (rCostCapBackward.get(from).get(itccb).getResidualCapacity() < delta) { delta = rCostCapBackward.get(from).get(itccb).getResidualCapacity(); // depends on control dependency: [if], data = [none] } } to = from; } while (to != k); // augment delta flow from k to l (backwards actually...) to = l[0]; // depends on control dependency: [while], data = [none] do { int from = prev.get(to); assert from != to; // TODO - might do here O(n) can be done in O(1) int itx = 0; while (x.get(from).get(itx).getTo() != to) { itx++; // depends on control dependency: [while], data = [none] } tmp = x.get(from).get(itx).getFlow(); x.get(from).get(itx).setFlow(tmp + delta); // update residual for backward edges int itccb = 0; while ((itccb < rCostCapBackward.get(to).size()) && (rCostCapBackward.get(to).get(itccb).getTo() != from)) { itccb++; // depends on control dependency: [while], data = [none] } if (itccb < rCostCapBackward.get(to).size()) { tmp = rCostCapBackward.get(to).get(itccb).getResidualCapacity(); // depends on control dependency: [if], data = [(itccb] rCostCapBackward.get(to).get(itccb).setResidualCapacity(tmp + delta); // depends on control dependency: [if], data = [(itccb] } itccb = 0; while ((itccb < rCostCapBackward.get(from).size()) && (rCostCapBackward.get(from).get(itccb).getTo() != to)) { itccb++; // depends on control dependency: [while], data = [none] } if (itccb < rCostCapBackward.get(from).size()) { tmp = rCostCapBackward.get(from).get(itccb).getResidualCapacity(); // depends on control dependency: [if], data = [(itccb] rCostCapBackward.get(from).get(itccb).setResidualCapacity(tmp - delta); // depends on control dependency: [if], data = [(itccb] } // update e e.set(to, e.get(to) + delta); e.set(from, e.get(from) - delta); to = from; } while (to != k); } // compute distance from x long dist = 0; for (int from = 0; from < numNodes; from++) { for (EdgeFlow it : x.get(from)) { dist += it.getCost() * it.getFlow(); // depends on control dependency: [for], data = [it] } } return dist; } }
public class class_name { private boolean validOrthologousStatement(final Statement stmt) { // test statement is well-formed if (stmt.getRelationshipType() == RelationshipType.ORTHOLOGOUS && stmt.getObject() != null && stmt.getObject().getTerm() != null) { // test subject has only one namespace parameter final Term subject = stmt.getSubject(); List<Parameter> subparams = subject.getParameters(); if (subparams == null || subparams.size() != 1 || subparams.get(0).getNamespace() == null) { return false; } // test object has only one namespace parameter final Term object = stmt.getObject().getTerm(); List<Parameter> objparams = object.getParameters(); if (objparams == null || objparams.size() != 1 || objparams.get(0).getNamespace() == null) { return false; } return true; } return false; } }
public class class_name { private boolean validOrthologousStatement(final Statement stmt) { // test statement is well-formed if (stmt.getRelationshipType() == RelationshipType.ORTHOLOGOUS && stmt.getObject() != null && stmt.getObject().getTerm() != null) { // test subject has only one namespace parameter final Term subject = stmt.getSubject(); List<Parameter> subparams = subject.getParameters(); if (subparams == null || subparams.size() != 1 || subparams.get(0).getNamespace() == null) { return false; // depends on control dependency: [if], data = [none] } // test object has only one namespace parameter final Term object = stmt.getObject().getTerm(); List<Parameter> objparams = object.getParameters(); if (objparams == null || objparams.size() != 1 || objparams.get(0).getNamespace() == null) { return false; // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public PropertyMetadata visitProperty(String propertyType, String name, @Nullable String description, @Nullable String defaultValue) { if (!configurations.isEmpty()) { ConfigurationMetadata last = configurations.get(configurations.size() - 1); PropertyMetadata metadata = new PropertyMetadata(); metadata.declaringType = last.type; metadata.name = name; metadata.path = NameUtils.hyphenate(last.name + "." + name, true); metadata.type = propertyType; metadata.description = description; metadata.defaultValue = defaultValue; properties.add(metadata); return metadata; } return null; } }
public class class_name { public PropertyMetadata visitProperty(String propertyType, String name, @Nullable String description, @Nullable String defaultValue) { if (!configurations.isEmpty()) { ConfigurationMetadata last = configurations.get(configurations.size() - 1); PropertyMetadata metadata = new PropertyMetadata(); metadata.declaringType = last.type; // depends on control dependency: [if], data = [none] metadata.name = name; // depends on control dependency: [if], data = [none] metadata.path = NameUtils.hyphenate(last.name + "." + name, true); // depends on control dependency: [if], data = [none] metadata.type = propertyType; // depends on control dependency: [if], data = [none] metadata.description = description; // depends on control dependency: [if], data = [none] metadata.defaultValue = defaultValue; // depends on control dependency: [if], data = [none] properties.add(metadata); // depends on control dependency: [if], data = [none] return metadata; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { protected Authenticated getAuthObjFromFile(final File authFile) { if (authFile == null) { getLog().debug(AUTH_FILE_NOT_CONFIG); return null; } if (!authFile.exists()) { getLog().error(AUTH_FILE_NOT_EXIST + authFile.getAbsolutePath()); return null; } try { final Authenticated auth = azureConfigure().authenticate(authFile); if (auth != null) { getLog().info(AUTH_WITH_FILE + authFile.getAbsolutePath()); } return auth; } catch (Exception e) { getLog().error(AUTH_FILE_READ_FAIL + authFile.getAbsolutePath()); getLog().error(e); } return null; } }
public class class_name { protected Authenticated getAuthObjFromFile(final File authFile) { if (authFile == null) { getLog().debug(AUTH_FILE_NOT_CONFIG); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } if (!authFile.exists()) { getLog().error(AUTH_FILE_NOT_EXIST + authFile.getAbsolutePath()); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } try { final Authenticated auth = azureConfigure().authenticate(authFile); if (auth != null) { getLog().info(AUTH_WITH_FILE + authFile.getAbsolutePath()); // depends on control dependency: [if], data = [none] } return auth; // depends on control dependency: [try], data = [none] } catch (Exception e) { getLog().error(AUTH_FILE_READ_FAIL + authFile.getAbsolutePath()); getLog().error(e); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { public static String encode(String password, String algorithm) { byte[] unencodedPassword = password.getBytes(); MessageDigest md = null; try { // first create an instance, given the provider md = MessageDigest.getInstance(algorithm); } catch (Exception e) { logger.error("Exception:{}", e); return password; } md.reset(); // call the update method one or more times // (useful when you don't know the size of your data, eg. stream) md.update(unencodedPassword); // now calculate the hash byte[] encodedPassword = md.digest(); StringBuilder buf = new StringBuilder(); for (int i = 0; i < encodedPassword.length; i++) { if ((encodedPassword[i] & 0xff) < 0x10) buf.append("0"); buf.append(Long.toString(encodedPassword[i] & 0xff, 16)); } return buf.toString(); } }
public class class_name { public static String encode(String password, String algorithm) { byte[] unencodedPassword = password.getBytes(); MessageDigest md = null; try { // first create an instance, given the provider md = MessageDigest.getInstance(algorithm); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.error("Exception:{}", e); return password; } // depends on control dependency: [catch], data = [none] md.reset(); // call the update method one or more times // (useful when you don't know the size of your data, eg. stream) md.update(unencodedPassword); // now calculate the hash byte[] encodedPassword = md.digest(); StringBuilder buf = new StringBuilder(); for (int i = 0; i < encodedPassword.length; i++) { if ((encodedPassword[i] & 0xff) < 0x10) buf.append("0"); buf.append(Long.toString(encodedPassword[i] & 0xff, 16)); // depends on control dependency: [for], data = [i] } return buf.toString(); } }
public class class_name { @NotNull protected Map<String, Map<String, Object>> toTypeArguments(ParameterElement... parameters) { final LinkedHashMap<String, Map<String, Object>> map = new LinkedHashMap<>(parameters.length); for (ParameterElement ce : parameters) { final ClassElement type = ce.getType(); if (type == null) { continue; } final Map<String, ClassElement> subArgs = type.getTypeArguments(); if (CollectionUtils.isNotEmpty(subArgs)) { map.put(ce.getName(), toTypeArguments(subArgs)); } } return map; } }
public class class_name { @NotNull protected Map<String, Map<String, Object>> toTypeArguments(ParameterElement... parameters) { final LinkedHashMap<String, Map<String, Object>> map = new LinkedHashMap<>(parameters.length); for (ParameterElement ce : parameters) { final ClassElement type = ce.getType(); if (type == null) { continue; } final Map<String, ClassElement> subArgs = type.getTypeArguments(); if (CollectionUtils.isNotEmpty(subArgs)) { map.put(ce.getName(), toTypeArguments(subArgs)); // depends on control dependency: [if], data = [none] } } return map; } }
public class class_name { protected Component lookForComponent(String name, Component[] components) { for (int i = 0; i < components.length && !mFindWithEqual; i++) { //String componentName = ComponentNamer.getInstance().getNameForComponent(components[c]); Component c = components[i]; checkName(name, c); if (!mFindWithEqual) { if (c instanceof Container) { Component result = lookForComponent(name, ((Container) c).getComponents()); if (result != null) { return result; } } } } return null; } }
public class class_name { protected Component lookForComponent(String name, Component[] components) { for (int i = 0; i < components.length && !mFindWithEqual; i++) { //String componentName = ComponentNamer.getInstance().getNameForComponent(components[c]); Component c = components[i]; checkName(name, c); // depends on control dependency: [for], data = [none] if (!mFindWithEqual) { if (c instanceof Container) { Component result = lookForComponent(name, ((Container) c).getComponents()); if (result != null) { return result; // depends on control dependency: [if], data = [none] } } } } return null; } }
public class class_name { public boolean skipRecord() throws IOException { checkClosed(); boolean recordRead = false; if (hasMoreData) { recordRead = readRecord(); if (recordRead) { currentRecord--; } } return recordRead; } }
public class class_name { public boolean skipRecord() throws IOException { checkClosed(); boolean recordRead = false; if (hasMoreData) { recordRead = readRecord(); if (recordRead) { currentRecord--; // depends on control dependency: [if], data = [none] } } return recordRead; } }
public class class_name { private String getNamePattern() { String niceName = m_typeShortName.getValue(); if (m_typeShortName.getValue().contains("-")) { int maxLength = 0; String[] nameParts = niceName.split("-"); for (int i = 0; i < nameParts.length; i++) { if (nameParts[i].length() > maxLength) { maxLength = nameParts[i].length(); niceName = nameParts[i]; } } } return niceName + "_%(number).xml"; } }
public class class_name { private String getNamePattern() { String niceName = m_typeShortName.getValue(); if (m_typeShortName.getValue().contains("-")) { int maxLength = 0; String[] nameParts = niceName.split("-"); for (int i = 0; i < nameParts.length; i++) { if (nameParts[i].length() > maxLength) { maxLength = nameParts[i].length(); // depends on control dependency: [if], data = [none] niceName = nameParts[i]; // depends on control dependency: [if], data = [none] } } } return niceName + "_%(number).xml"; } }
public class class_name { public EClass getIfcWall() { if (ifcWallEClass == null) { ifcWallEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers() .get(640); } return ifcWallEClass; } }
public class class_name { public EClass getIfcWall() { if (ifcWallEClass == null) { ifcWallEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers() .get(640); // depends on control dependency: [if], data = [none] } return ifcWallEClass; } }
public class class_name { public void putAllRequestBaggage(Map<String, String> requestBaggage) { if (BAGGAGE_ENABLE && requestBaggage != null) { this.requestBaggage.putAll(requestBaggage); } } }
public class class_name { public void putAllRequestBaggage(Map<String, String> requestBaggage) { if (BAGGAGE_ENABLE && requestBaggage != null) { this.requestBaggage.putAll(requestBaggage); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Class getCollectionType() { Class collectionType = Collection.class; IParsedElement parent = getParsedElement().getParent(); if( parent instanceof NewExpression ) { IType newType = ((NewExpression)parent).getType(); IJavaClassInfo classInfo = IRTypeResolver.getJavaBackedClass(newType); Class javaBackedClass = classInfo != null ? classInfo.getBackingClass() : null; if( classInfo != null && javaBackedClass != null ) { collectionType = javaBackedClass; } else if( JavaTypes.getJreType(AbstractCollection.class).isAssignableFrom( newType ) ) { collectionType = AbstractCollection.class; } } return collectionType; } }
public class class_name { private Class getCollectionType() { Class collectionType = Collection.class; IParsedElement parent = getParsedElement().getParent(); if( parent instanceof NewExpression ) { IType newType = ((NewExpression)parent).getType(); IJavaClassInfo classInfo = IRTypeResolver.getJavaBackedClass(newType); Class javaBackedClass = classInfo != null ? classInfo.getBackingClass() : null; if( classInfo != null && javaBackedClass != null ) { collectionType = javaBackedClass; // depends on control dependency: [if], data = [none] } else if( JavaTypes.getJreType(AbstractCollection.class).isAssignableFrom( newType ) ) { collectionType = AbstractCollection.class; // depends on control dependency: [if], data = [none] } } return collectionType; } }
public class class_name { protected void makeRunnerIfNeeded() { // We don't need to make a SVG runner when there are no pending updates. boolean stop = true; for(WeakReference<UpdateRunner> wur : updaterunner) { UpdateRunner ur = wur.get(); if(ur == null) { updaterunner.remove(wur); } else if(!ur.isEmpty()) { stop = false; } } if(stop) { return; } // We only need a new runner when we don't have one in the queue yet! if(pending.get() != null) { return; } // We need a component JSVGComponent component = this.cref.get(); if(component == null) { return; } // Synchronize with all layers: synchronized(this) { synchronized(component) { UpdateManager um = component.getUpdateManager(); if(um != null) { synchronized(um) { if(um.isRunning()) { // Create and insert a runner. Runnable newrunner = new Runnable() { @Override public void run() { if(pending.compareAndSet(this, null)) { // Wake up all runners for(WeakReference<UpdateRunner> wur : updaterunner) { UpdateRunner ur = wur.get(); if(ur == null || ur.isEmpty()) { continue; } ur.runQueue(); } } } }; pending.set(newrunner); um.getUpdateRunnableQueue().invokeLater(newrunner); return; } } } } } } }
public class class_name { protected void makeRunnerIfNeeded() { // We don't need to make a SVG runner when there are no pending updates. boolean stop = true; for(WeakReference<UpdateRunner> wur : updaterunner) { UpdateRunner ur = wur.get(); if(ur == null) { updaterunner.remove(wur); // depends on control dependency: [if], data = [none] } else if(!ur.isEmpty()) { stop = false; // depends on control dependency: [if], data = [none] } } if(stop) { return; // depends on control dependency: [if], data = [none] } // We only need a new runner when we don't have one in the queue yet! if(pending.get() != null) { return; // depends on control dependency: [if], data = [none] } // We need a component JSVGComponent component = this.cref.get(); if(component == null) { return; // depends on control dependency: [if], data = [none] } // Synchronize with all layers: synchronized(this) { synchronized(component) { UpdateManager um = component.getUpdateManager(); if(um != null) { synchronized(um) { // depends on control dependency: [if], data = [(um] if(um.isRunning()) { // Create and insert a runner. Runnable newrunner = new Runnable() { @Override public void run() { if(pending.compareAndSet(this, null)) { // Wake up all runners for(WeakReference<UpdateRunner> wur : updaterunner) { UpdateRunner ur = wur.get(); if(ur == null || ur.isEmpty()) { continue; } ur.runQueue(); // depends on control dependency: [for], data = [none] } } } }; pending.set(newrunner); // depends on control dependency: [if], data = [none] um.getUpdateRunnableQueue().invokeLater(newrunner); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } } } } } }
public class class_name { public ZipMessage addEntry(File file) { try { addEntry(new Entry(file)); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read zip entry content from given file", e); } return this; } }
public class class_name { public ZipMessage addEntry(File file) { try { addEntry(new Entry(file)); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new CitrusRuntimeException("Failed to read zip entry content from given file", e); } // depends on control dependency: [catch], data = [none] return this; } }
public class class_name { @Override public IntSetBitStore range(int from, int to) { if (from < 0) throw new IllegalArgumentException(); if (to < from) throw new IllegalArgumentException(); to += start; if (to > finish) throw new IllegalArgumentException(); from += start; SortedSet<Integer> sub; if (to == from) { // seems we have to do this because subSet(x,x) is faulty? sub = Collections.emptySortedSet(); } else if (to == start) { sub = from == finish ? set : set.tailSet(from); } else { sub = from == finish ? set.headSet(to) : set.subSet(from, to); } return new IntSetBitStore(sub, from, to, mutable); } }
public class class_name { @Override public IntSetBitStore range(int from, int to) { if (from < 0) throw new IllegalArgumentException(); if (to < from) throw new IllegalArgumentException(); to += start; if (to > finish) throw new IllegalArgumentException(); from += start; SortedSet<Integer> sub; if (to == from) { // seems we have to do this because subSet(x,x) is faulty? sub = Collections.emptySortedSet(); // depends on control dependency: [if], data = [none] } else if (to == start) { sub = from == finish ? set : set.tailSet(from); // depends on control dependency: [if], data = [none] } else { sub = from == finish ? set.headSet(to) : set.subSet(from, to); // depends on control dependency: [if], data = [(to] } return new IntSetBitStore(sub, from, to, mutable); } }
public class class_name { public static int indexOf(double[] array, double[] sub, int startIndex, int endIndex) { int sublen = sub.length; if (sublen == 0) { return startIndex; } int total = endIndex - sublen + 1; double c = sub[0]; mainloop: for (int i = startIndex; i < total; i++) { if (Double.compare(array[i], c) != 0) { continue; } int j = 1; int k = i + 1; while (j < sublen) { if (Double.compare(sub[j], array[k]) != 0) { continue mainloop; } j++; k++; } return i; } return -1; } }
public class class_name { public static int indexOf(double[] array, double[] sub, int startIndex, int endIndex) { int sublen = sub.length; if (sublen == 0) { return startIndex; // depends on control dependency: [if], data = [none] } int total = endIndex - sublen + 1; double c = sub[0]; mainloop: for (int i = startIndex; i < total; i++) { if (Double.compare(array[i], c) != 0) { continue; } int j = 1; int k = i + 1; while (j < sublen) { if (Double.compare(sub[j], array[k]) != 0) { continue mainloop; } j++; k++; // depends on control dependency: [while], data = [none] // depends on control dependency: [while], data = [none] } return i; // depends on control dependency: [for], data = [i] } return -1; } }