code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void log(Throwable error, Map<String, Object> custom, String description, Level level, boolean isUncaught) { RollbarThrowableWrapper rollbarThrowableWrapper = null; if (error != null) { rollbarThrowableWrapper = new RollbarThrowableWrapper(error); } this.log(rollbarThrowableWrapper, custom, description, level, isUncaught); } }
public class class_name { public void log(Throwable error, Map<String, Object> custom, String description, Level level, boolean isUncaught) { RollbarThrowableWrapper rollbarThrowableWrapper = null; if (error != null) { rollbarThrowableWrapper = new RollbarThrowableWrapper(error); // depends on control dependency: [if], data = [(error] } this.log(rollbarThrowableWrapper, custom, description, level, isUncaught); } }
public class class_name { public void marshall(SlotTypeMetadata slotTypeMetadata, ProtocolMarshaller protocolMarshaller) { if (slotTypeMetadata == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(slotTypeMetadata.getName(), NAME_BINDING); protocolMarshaller.marshall(slotTypeMetadata.getDescription(), DESCRIPTION_BINDING); protocolMarshaller.marshall(slotTypeMetadata.getLastUpdatedDate(), LASTUPDATEDDATE_BINDING); protocolMarshaller.marshall(slotTypeMetadata.getCreatedDate(), CREATEDDATE_BINDING); protocolMarshaller.marshall(slotTypeMetadata.getVersion(), VERSION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SlotTypeMetadata slotTypeMetadata, ProtocolMarshaller protocolMarshaller) { if (slotTypeMetadata == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(slotTypeMetadata.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(slotTypeMetadata.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(slotTypeMetadata.getLastUpdatedDate(), LASTUPDATEDDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(slotTypeMetadata.getCreatedDate(), CREATEDDATE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(slotTypeMetadata.getVersion(), VERSION_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 obtainHeaderBackground(@StyleRes final int themeResourceId) { TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(themeResourceId, new int[]{R.attr.materialDialogHeaderBackground}); int resourceId = typedArray.getResourceId(0, 0); if (resourceId != 0) { setHeaderBackground(resourceId); } else { setHeaderBackgroundColor( ThemeUtil.getColor(getContext(), themeResourceId, R.attr.colorPrimary)); } } }
public class class_name { private void obtainHeaderBackground(@StyleRes final int themeResourceId) { TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(themeResourceId, new int[]{R.attr.materialDialogHeaderBackground}); int resourceId = typedArray.getResourceId(0, 0); if (resourceId != 0) { setHeaderBackground(resourceId); // depends on control dependency: [if], data = [(resourceId] } else { setHeaderBackgroundColor( ThemeUtil.getColor(getContext(), themeResourceId, R.attr.colorPrimary)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Object toComponentTypeArray(Object val, Class<?> componentType) { if (val != null) { int len = Array.getLength(val); Object arr = Array.newInstance(componentType, len); for (int i = 0; i < len; i++) { Array.set(arr, i, Array.get(val, i)); } return arr; } else { return null; } } }
public class class_name { public static Object toComponentTypeArray(Object val, Class<?> componentType) { if (val != null) { int len = Array.getLength(val); Object arr = Array.newInstance(componentType, len); for (int i = 0; i < len; i++) { Array.set(arr, i, Array.get(val, i)); // depends on control dependency: [for], data = [i] } return arr; // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public OrderingList<S> mergeRemainderOrdering(OrderingScore<S> other) { OrderingList<S> thisRemainderOrdering = getRemainderOrdering(); if (this == other) { return thisRemainderOrdering; } OrderingList<S> otherRemainderOrdering = other.getRemainderOrdering(); // Choose the longer list. if (thisRemainderOrdering.size() == 0) { return otherRemainderOrdering; } else { if (otherRemainderOrdering.size() == 0) { return thisRemainderOrdering; } else if (thisRemainderOrdering.size() >= otherRemainderOrdering.size()) { return thisRemainderOrdering; } else { return otherRemainderOrdering; } } } }
public class class_name { public OrderingList<S> mergeRemainderOrdering(OrderingScore<S> other) { OrderingList<S> thisRemainderOrdering = getRemainderOrdering(); if (this == other) { return thisRemainderOrdering; // depends on control dependency: [if], data = [none] } OrderingList<S> otherRemainderOrdering = other.getRemainderOrdering(); // Choose the longer list. if (thisRemainderOrdering.size() == 0) { return otherRemainderOrdering; // depends on control dependency: [if], data = [none] } else { if (otherRemainderOrdering.size() == 0) { return thisRemainderOrdering; // depends on control dependency: [if], data = [none] } else if (thisRemainderOrdering.size() >= otherRemainderOrdering.size()) { return thisRemainderOrdering; // depends on control dependency: [if], data = [none] } else { return otherRemainderOrdering; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public String addDefaultFileNameToFolder(String rfsName, boolean isFolder) { StringBuffer name = new StringBuffer(rfsName); if (isFolder) { // vfs folder case name.append(EXPORT_DEFAULT_FILE); } return name.toString(); } }
public class class_name { public String addDefaultFileNameToFolder(String rfsName, boolean isFolder) { StringBuffer name = new StringBuffer(rfsName); if (isFolder) { // vfs folder case name.append(EXPORT_DEFAULT_FILE); // depends on control dependency: [if], data = [none] } return name.toString(); } }
public class class_name { protected <T extends Request, U extends Response> CompletableFuture<U> forward(T request) { CompletableFuture<U> future = new CompletableFuture<>(); context.getConnections().getConnection(context.getLeader().serverAddress()).whenComplete((connection, connectError) -> { if (connectError == null) { connection.<T, U>sendAndReceive(request).whenComplete((response, responseError) -> { if (responseError == null) { future.complete(response); } else { future.completeExceptionally(responseError); } }); } else { future.completeExceptionally(connectError); } }); return future; } }
public class class_name { protected <T extends Request, U extends Response> CompletableFuture<U> forward(T request) { CompletableFuture<U> future = new CompletableFuture<>(); context.getConnections().getConnection(context.getLeader().serverAddress()).whenComplete((connection, connectError) -> { if (connectError == null) { connection.<T, U>sendAndReceive(request).whenComplete((response, responseError) -> { if (responseError == null) { future.complete(response); // depends on control dependency: [if], data = [none] } else { future.completeExceptionally(responseError); // depends on control dependency: [if], data = [(responseError] } }); } else { future.completeExceptionally(connectError); } }); return future; } }
public class class_name { private static float getObjectTransformationCost(Class<?> srcClass, final Class<?> destClass) { if (destClass.isPrimitive()) { return getPrimitivePromotionCost(srcClass, destClass); } float cost = 0.0f; while (srcClass != null && !destClass.equals(srcClass)) { if (destClass.isInterface() && ClassUtils.isAssignable(srcClass, destClass)) { // slight penalty for interface match. // we still want an exact match to override an interface match, // but // an interface match should override anything where we have to // get a superclass. cost += 0.25f; break; } cost++; srcClass = srcClass.getSuperclass(); } /* * If the destination class is null, we've traveled all the way up to * an Object match. We'll penalize this by adding 1.5 to the cost. */ if (srcClass == null) { cost += 1.5f; } return cost; } }
public class class_name { private static float getObjectTransformationCost(Class<?> srcClass, final Class<?> destClass) { if (destClass.isPrimitive()) { return getPrimitivePromotionCost(srcClass, destClass); // depends on control dependency: [if], data = [none] } float cost = 0.0f; while (srcClass != null && !destClass.equals(srcClass)) { if (destClass.isInterface() && ClassUtils.isAssignable(srcClass, destClass)) { // slight penalty for interface match. // we still want an exact match to override an interface match, // but // an interface match should override anything where we have to // get a superclass. cost += 0.25f; // depends on control dependency: [if], data = [none] break; } cost++; // depends on control dependency: [while], data = [none] srcClass = srcClass.getSuperclass(); // depends on control dependency: [while], data = [none] } /* * If the destination class is null, we've traveled all the way up to * an Object match. We'll penalize this by adding 1.5 to the cost. */ if (srcClass == null) { cost += 1.5f; // depends on control dependency: [if], data = [none] } return cost; } }
public class class_name { public Layout previousGeneration() throws FetchException { Cursor<StoredLayout> cursor = mLayoutFactory.mLayoutStorage .query("storableTypeName = ? & generation < ?") .with(getStorableTypeName()).with(getGeneration()) .orderBy("-generation") .fetch(); try { if (cursor.hasNext()) { return new Layout(mLayoutFactory, cursor.next()); } } finally { cursor.close(); } return null; } }
public class class_name { public Layout previousGeneration() throws FetchException { Cursor<StoredLayout> cursor = mLayoutFactory.mLayoutStorage .query("storableTypeName = ? & generation < ?") .with(getStorableTypeName()).with(getGeneration()) .orderBy("-generation") .fetch(); try { if (cursor.hasNext()) { return new Layout(mLayoutFactory, cursor.next()); // depends on control dependency: [if], data = [none] } } finally { cursor.close(); } return null; } }
public class class_name { public synchronized static String formatTime(final Time object, String pattern) { if (pattern == null || pattern.equals("")) { pattern = JKFormatUtil.DEFAULT_TIME_PATTERN; } return JKFormatUtil.getDateFormatter(pattern).format(object); } }
public class class_name { public synchronized static String formatTime(final Time object, String pattern) { if (pattern == null || pattern.equals("")) { pattern = JKFormatUtil.DEFAULT_TIME_PATTERN; // depends on control dependency: [if], data = [none] } return JKFormatUtil.getDateFormatter(pattern).format(object); } }
public class class_name { public void clear() { logpane.clear(); synchronized(pbarmap) { for(Entry<Progress, JProgressBar> ent : pbarmap.entrySet()) { super.remove(ent.getValue()); pbarmap.remove(ent.getKey()); } } } }
public class class_name { public void clear() { logpane.clear(); synchronized(pbarmap) { for(Entry<Progress, JProgressBar> ent : pbarmap.entrySet()) { super.remove(ent.getValue()); // depends on control dependency: [for], data = [ent] pbarmap.remove(ent.getKey()); // depends on control dependency: [for], data = [ent] } } } }
public class class_name { public static byte[] readFully(InputStream is, int length, boolean readAll) throws IOException { byte[] output = {}; if (length == -1) length = Integer.MAX_VALUE; int pos = 0; while (pos < length) { int bytesToRead; if (pos >= output.length) { // Only expand when there's no room bytesToRead = Math.min(length - pos, output.length + 1024); if (output.length < pos + bytesToRead) { output = Arrays.copyOf(output, pos + bytesToRead); } } else { bytesToRead = output.length - pos; } int cc = is.read(output, pos, bytesToRead); if (cc < 0) { if (readAll && length != Integer.MAX_VALUE) { throw new EOFException("Detect premature EOF"); } else { if (output.length != pos) { output = Arrays.copyOf(output, pos); } break; } } pos += cc; } return output; } }
public class class_name { public static byte[] readFully(InputStream is, int length, boolean readAll) throws IOException { byte[] output = {}; if (length == -1) length = Integer.MAX_VALUE; int pos = 0; while (pos < length) { int bytesToRead; if (pos >= output.length) { // Only expand when there's no room bytesToRead = Math.min(length - pos, output.length + 1024); if (output.length < pos + bytesToRead) { output = Arrays.copyOf(output, pos + bytesToRead); // depends on control dependency: [if], data = [pos + bytesToRead)] } } else { bytesToRead = output.length - pos; } int cc = is.read(output, pos, bytesToRead); if (cc < 0) { if (readAll && length != Integer.MAX_VALUE) { throw new EOFException("Detect premature EOF"); } else { if (output.length != pos) { output = Arrays.copyOf(output, pos); } break; } } pos += cc; } return output; } }
public class class_name { public String getLogDirectoryName(long timestamp, String pid, String label) { if (pid == null || pid.isEmpty()) { throw new IllegalArgumentException("pid cannot be empty"); } StringBuilder sb = new StringBuilder(); if (timestamp > 0) { sb.append(timestamp).append(TIMESEPARATOR); } sb.append(pid); if (label != null && !label.trim().isEmpty()) { sb.append(LABELSEPARATOR).append(label); } return sb.toString(); } }
public class class_name { public String getLogDirectoryName(long timestamp, String pid, String label) { if (pid == null || pid.isEmpty()) { throw new IllegalArgumentException("pid cannot be empty"); } StringBuilder sb = new StringBuilder(); if (timestamp > 0) { sb.append(timestamp).append(TIMESEPARATOR); // depends on control dependency: [if], data = [(timestamp] } sb.append(pid); if (label != null && !label.trim().isEmpty()) { sb.append(LABELSEPARATOR).append(label); // depends on control dependency: [if], data = [(label] } return sb.toString(); } }
public class class_name { public boolean hasAccountRole(final String role,UserIdentityContext userIdentityContext) { if (userIdentityContext.getEffectiveAccount() != null) { return userIdentityContext.getEffectiveAccountRoles().contains(role); } return false; } }
public class class_name { public boolean hasAccountRole(final String role,UserIdentityContext userIdentityContext) { if (userIdentityContext.getEffectiveAccount() != null) { return userIdentityContext.getEffectiveAccountRoles().contains(role); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { protected void updateButtons() { List<Button> buttons = ((A_CmsModuleImportForm)m_tabs.getSelectedTab()).getButtons(); m_buttons.removeAllComponents(); for (Button button : buttons) { m_buttons.addComponent(button); } } }
public class class_name { protected void updateButtons() { List<Button> buttons = ((A_CmsModuleImportForm)m_tabs.getSelectedTab()).getButtons(); m_buttons.removeAllComponents(); for (Button button : buttons) { m_buttons.addComponent(button); // depends on control dependency: [for], data = [button] } } }
public class class_name { public void createLayout(Dimension dim, Rectangle visibleRect) { if (createImage) img = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_RGB); Graphics2D ig = img.createGraphics(); if (autoMediaUpdate) { decoder.getMediaSpec().setDimensions(visibleRect.width, visibleRect.height); decoder.recomputeStyles(); } log.trace("Creating boxes"); BoxFactory factory = new BoxFactory(decoder, baseurl); factory.setConfig(config); factory.reset(); VisualContext ctx = new VisualContext(null, factory); viewport = factory.createViewportTree(root, ig, ctx, dim.width, dim.height); log.trace("We have " + factory.next_order + " boxes"); viewport.setVisibleRect(visibleRect); viewport.initSubtree(); log.trace("Layout for "+dim.width+"px"); viewport.doLayout(dim.width, true, true); log.trace("Resulting size: " + viewport.getWidth() + "x" + viewport.getHeight() + " (" + viewport + ")"); if (autoSizeUpdate) { log.trace("Updating viewport size"); viewport.updateBounds(dim); log.trace("Resulting size: " + viewport.getWidth() + "x" + viewport.getHeight() + " (" + viewport + ")"); } if (createImage && (viewport.getWidth() > dim.width || viewport.getHeight() > dim.height)) { img = new BufferedImage(Math.max(viewport.getWidth(), dim.width), Math.max(viewport.getHeight(), dim.height), BufferedImage.TYPE_INT_RGB); ig = img.createGraphics(); } log.trace("Positioning for "+viewport.getWidth()+"x"+viewport.getHeight()+"px"); viewport.absolutePositions(); log.trace("Drawing"); clearCanvas(); GraphicsRenderer r = new GraphicsRenderer(ig); viewport.draw(r); r.close(); setPreferredSize(new Dimension(img.getWidth(), img.getHeight())); revalidate(); } }
public class class_name { public void createLayout(Dimension dim, Rectangle visibleRect) { if (createImage) img = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_RGB); Graphics2D ig = img.createGraphics(); if (autoMediaUpdate) { decoder.getMediaSpec().setDimensions(visibleRect.width, visibleRect.height); // depends on control dependency: [if], data = [none] decoder.recomputeStyles(); // depends on control dependency: [if], data = [none] } log.trace("Creating boxes"); BoxFactory factory = new BoxFactory(decoder, baseurl); factory.setConfig(config); factory.reset(); VisualContext ctx = new VisualContext(null, factory); viewport = factory.createViewportTree(root, ig, ctx, dim.width, dim.height); log.trace("We have " + factory.next_order + " boxes"); viewport.setVisibleRect(visibleRect); viewport.initSubtree(); log.trace("Layout for "+dim.width+"px"); viewport.doLayout(dim.width, true, true); log.trace("Resulting size: " + viewport.getWidth() + "x" + viewport.getHeight() + " (" + viewport + ")"); if (autoSizeUpdate) { log.trace("Updating viewport size"); viewport.updateBounds(dim); log.trace("Resulting size: " + viewport.getWidth() + "x" + viewport.getHeight() + " (" + viewport + ")"); } if (createImage && (viewport.getWidth() > dim.width || viewport.getHeight() > dim.height)) { img = new BufferedImage(Math.max(viewport.getWidth(), dim.width), Math.max(viewport.getHeight(), dim.height), BufferedImage.TYPE_INT_RGB); ig = img.createGraphics(); } log.trace("Positioning for "+viewport.getWidth()+"x"+viewport.getHeight()+"px"); viewport.absolutePositions(); log.trace("Drawing"); clearCanvas(); GraphicsRenderer r = new GraphicsRenderer(ig); viewport.draw(r); r.close(); setPreferredSize(new Dimension(img.getWidth(), img.getHeight())); revalidate(); } }
public class class_name { public void marshall(RespondDecisionTaskCompletedRequest respondDecisionTaskCompletedRequest, ProtocolMarshaller protocolMarshaller) { if (respondDecisionTaskCompletedRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(respondDecisionTaskCompletedRequest.getTaskToken(), TASKTOKEN_BINDING); protocolMarshaller.marshall(respondDecisionTaskCompletedRequest.getDecisions(), DECISIONS_BINDING); protocolMarshaller.marshall(respondDecisionTaskCompletedRequest.getExecutionContext(), EXECUTIONCONTEXT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RespondDecisionTaskCompletedRequest respondDecisionTaskCompletedRequest, ProtocolMarshaller protocolMarshaller) { if (respondDecisionTaskCompletedRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(respondDecisionTaskCompletedRequest.getTaskToken(), TASKTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(respondDecisionTaskCompletedRequest.getDecisions(), DECISIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(respondDecisionTaskCompletedRequest.getExecutionContext(), EXECUTIONCONTEXT_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 { @UiHandler({"m_atMonth", "m_everyMonth"}) void onIntervalValueChange(ValueChangeEvent<String> event) { if (handleChange()) { m_controller.setInterval(event.getValue()); } } }
public class class_name { @UiHandler({"m_atMonth", "m_everyMonth"}) void onIntervalValueChange(ValueChangeEvent<String> event) { if (handleChange()) { m_controller.setInterval(event.getValue()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static EvaluationResult evaluation(String resultText, String standardText) { int perfectLineCount=0; int wrongLineCount=0; int perfectCharCount=0; int wrongCharCount=0; try(BufferedReader resultReader = new BufferedReader(new InputStreamReader(new FileInputStream(resultText),"utf-8")); BufferedReader standardReader = new BufferedReader(new InputStreamReader(new FileInputStream(standardText),"utf-8"))){ String result; while( (result = resultReader.readLine()) != null ){ result = result.trim(); String standard = standardReader.readLine().trim(); if(result.equals("")){ continue; } if(result.equals(standard)){ //分词结果和标准一模一样 perfectLineCount++; perfectCharCount+=standard.replaceAll("\\s+", "").length(); }else{ //分词结果和标准不一样 wrongLineCount++; wrongCharCount+=standard.replaceAll("\\s+", "").length(); } } } catch (IOException ex) { LOGGER.error("分词效果评估失败:", ex); } int totalLineCount = perfectLineCount+wrongLineCount; int totalCharCount = perfectCharCount+wrongCharCount; EvaluationResult er = new EvaluationResult(); er.setPerfectCharCount(perfectCharCount); er.setPerfectLineCount(perfectLineCount); er.setTotalCharCount(totalCharCount); er.setTotalLineCount(totalLineCount); er.setWrongCharCount(wrongCharCount); er.setWrongLineCount(wrongLineCount); return er; } }
public class class_name { public static EvaluationResult evaluation(String resultText, String standardText) { int perfectLineCount=0; int wrongLineCount=0; int perfectCharCount=0; int wrongCharCount=0; try(BufferedReader resultReader = new BufferedReader(new InputStreamReader(new FileInputStream(resultText),"utf-8")); BufferedReader standardReader = new BufferedReader(new InputStreamReader(new FileInputStream(standardText),"utf-8"))){ String result; while( (result = resultReader.readLine()) != null ){ result = result.trim(); // depends on control dependency: [while], data = [none] String standard = standardReader.readLine().trim(); if(result.equals("")){ continue; } if(result.equals(standard)){ //分词结果和标准一模一样 perfectLineCount++; // depends on control dependency: [if], data = [none] perfectCharCount+=standard.replaceAll("\\s+", "").length(); // depends on control dependency: [if], data = [none] }else{ //分词结果和标准不一样 wrongLineCount++; // depends on control dependency: [if], data = [none] wrongCharCount+=standard.replaceAll("\\s+", "").length(); // depends on control dependency: [if], data = [none] } } } catch (IOException ex) { LOGGER.error("分词效果评估失败:", ex); } int totalLineCount = perfectLineCount+wrongLineCount; int totalCharCount = perfectCharCount+wrongCharCount; EvaluationResult er = new EvaluationResult(); er.setPerfectCharCount(perfectCharCount); er.setPerfectLineCount(perfectLineCount); er.setTotalCharCount(totalCharCount); er.setTotalLineCount(totalLineCount); er.setWrongCharCount(wrongCharCount); er.setWrongLineCount(wrongLineCount); return er; } }
public class class_name { public static Map<OperationId, Method> getOperationMap(Class<?> serviceInterface) { if (!serviceInterface.isInterface()) { Class type = serviceInterface; Map<OperationId, Method> operations = new HashMap<>(); while (type != Object.class) { for (Class<?> iface : type.getInterfaces()) { operations.putAll(findOperations(iface)); } type = type.getSuperclass(); } return operations; } return findOperations(serviceInterface); } }
public class class_name { public static Map<OperationId, Method> getOperationMap(Class<?> serviceInterface) { if (!serviceInterface.isInterface()) { Class type = serviceInterface; Map<OperationId, Method> operations = new HashMap<>(); while (type != Object.class) { for (Class<?> iface : type.getInterfaces()) { operations.putAll(findOperations(iface)); // depends on control dependency: [for], data = [iface] } type = type.getSuperclass(); // depends on control dependency: [while], data = [none] } return operations; // depends on control dependency: [if], data = [none] } return findOperations(serviceInterface); } }
public class class_name { private boolean isPrimaryServer(ServerHeartbeat server, UpdatePod update) { int index = getServerIndex(server, update); if (index < 0) { return false; } for (int i = 0; i < update.getNodeCount(); i++) { UpdateNode node = update.getNode(i); int primary = node.getServers()[0]; if (index == primary) { return true; } } return false; } }
public class class_name { private boolean isPrimaryServer(ServerHeartbeat server, UpdatePod update) { int index = getServerIndex(server, update); if (index < 0) { return false; // depends on control dependency: [if], data = [none] } for (int i = 0; i < update.getNodeCount(); i++) { UpdateNode node = update.getNode(i); int primary = node.getServers()[0]; if (index == primary) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { private org.jdom2.Element createCatGenConfigElement( CatalogGenConfig cgc) { // @todo Need to deal with the 0.6 and 1.0 namespaces. Element cgcElem = new Element("catalogGenConfig", CATALOG_GEN_CONFIG_NAMESPACE_0_5); if ( cgc != null) { if ( cgc.getType() != null) { cgcElem.setAttribute( "type", cgc.getType().toString()); } // Add 'datasetSource' element DatasetSource dsSource = cgc.getDatasetSource(); cgcElem.addContent( createDatasetSourceElement( dsSource)); } return( cgcElem); } }
public class class_name { private org.jdom2.Element createCatGenConfigElement( CatalogGenConfig cgc) { // @todo Need to deal with the 0.6 and 1.0 namespaces. Element cgcElem = new Element("catalogGenConfig", CATALOG_GEN_CONFIG_NAMESPACE_0_5); if ( cgc != null) { if ( cgc.getType() != null) { cgcElem.setAttribute( "type", cgc.getType().toString()); // depends on control dependency: [if], data = [none] } // Add 'datasetSource' element DatasetSource dsSource = cgc.getDatasetSource(); cgcElem.addContent( createDatasetSourceElement( dsSource)); // depends on control dependency: [if], data = [none] } return( cgcElem); } }
public class class_name { public void paint (Graphics2D gfx) { // if we're rendering footprints, paint that boolean footpaint = _fprintDebug.getValue(); if (footpaint) { gfx.setColor(Color.black); gfx.draw(_footprint); if (_hideObjects.getValue()) { // We're in footprints but no objects mode, so let's also fill it in so we can // see things better/tell if we have overlapping ones Composite ocomp = gfx.getComposite(); gfx.setComposite(ALPHA_WARN); gfx.fill(_footprint); gfx.setComposite(ocomp); } } if (_hideObjects.getValue()) { return; } // if we have a warning, render an alpha'd red rectangle over our bounds if (_warning) { Composite ocomp = gfx.getComposite(); gfx.setComposite(ALPHA_WARN); gfx.fill(bounds); gfx.setComposite(ocomp); } // paint our tile tile.paint(gfx, bounds.x, bounds.y); // and possibly paint the object's spot if (footpaint && _sspot != null) { // translate the origin to center on the portal gfx.translate(_sspot.x, _sspot.y); // rotate to reflect the spot orientation double rot = (Math.PI / 4.0f) * tile.getSpotOrient(); gfx.rotate(rot); // draw the spot triangle gfx.setColor(Color.green); gfx.fill(_spotTri); // outline the triangle in black gfx.setColor(Color.black); gfx.draw(_spotTri); // restore the original transform gfx.rotate(-rot); gfx.translate(-_sspot.x, -_sspot.y); } } }
public class class_name { public void paint (Graphics2D gfx) { // if we're rendering footprints, paint that boolean footpaint = _fprintDebug.getValue(); if (footpaint) { gfx.setColor(Color.black); // depends on control dependency: [if], data = [none] gfx.draw(_footprint); // depends on control dependency: [if], data = [none] if (_hideObjects.getValue()) { // We're in footprints but no objects mode, so let's also fill it in so we can // see things better/tell if we have overlapping ones Composite ocomp = gfx.getComposite(); gfx.setComposite(ALPHA_WARN); // depends on control dependency: [if], data = [none] gfx.fill(_footprint); // depends on control dependency: [if], data = [none] gfx.setComposite(ocomp); // depends on control dependency: [if], data = [none] } } if (_hideObjects.getValue()) { return; // depends on control dependency: [if], data = [none] } // if we have a warning, render an alpha'd red rectangle over our bounds if (_warning) { Composite ocomp = gfx.getComposite(); gfx.setComposite(ALPHA_WARN); // depends on control dependency: [if], data = [none] gfx.fill(bounds); // depends on control dependency: [if], data = [none] gfx.setComposite(ocomp); // depends on control dependency: [if], data = [none] } // paint our tile tile.paint(gfx, bounds.x, bounds.y); // and possibly paint the object's spot if (footpaint && _sspot != null) { // translate the origin to center on the portal gfx.translate(_sspot.x, _sspot.y); // depends on control dependency: [if], data = [none] // rotate to reflect the spot orientation double rot = (Math.PI / 4.0f) * tile.getSpotOrient(); gfx.rotate(rot); // depends on control dependency: [if], data = [none] // draw the spot triangle gfx.setColor(Color.green); // depends on control dependency: [if], data = [none] gfx.fill(_spotTri); // depends on control dependency: [if], data = [none] // outline the triangle in black gfx.setColor(Color.black); // depends on control dependency: [if], data = [none] gfx.draw(_spotTri); // depends on control dependency: [if], data = [none] // restore the original transform gfx.rotate(-rot); // depends on control dependency: [if], data = [none] gfx.translate(-_sspot.x, -_sspot.y); // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean switchAndCheckAbort() { if (Thread.holdsLock(cache.lock)) { return switchCheckAndAbortLocked(); } return cache.executeWithGlobalLock(new Job<Boolean>() { @Override public Boolean call() { return switchCheckAndAbortLocked(); } }); } }
public class class_name { private boolean switchAndCheckAbort() { if (Thread.holdsLock(cache.lock)) { return switchCheckAndAbortLocked(); // depends on control dependency: [if], data = [none] } return cache.executeWithGlobalLock(new Job<Boolean>() { @Override public Boolean call() { return switchCheckAndAbortLocked(); } }); } }
public class class_name { private Class<?> resolveClass(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return resolveClass(((ParameterizedType) type).getRawType()); } else if (type instanceof WildcardType) { Type[] bounds = ((WildcardType) type).getUpperBounds(); if (bounds.length > 0) { return (Class<?>) bounds[0]; } } return null; } }
public class class_name { private Class<?> resolveClass(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return resolveClass(((ParameterizedType) type).getRawType()); } else if (type instanceof WildcardType) { Type[] bounds = ((WildcardType) type).getUpperBounds(); if (bounds.length > 0) { return (Class<?>) bounds[0]; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { private synchronized void startCache() { for (PDatabase pDatabase : m_htDBList.values()) { for (PTable pTable : pDatabase.getTableList().values()) { this.addTableToCache(pTable); } } } }
public class class_name { private synchronized void startCache() { for (PDatabase pDatabase : m_htDBList.values()) { for (PTable pTable : pDatabase.getTableList().values()) { this.addTableToCache(pTable); // depends on control dependency: [for], data = [pTable] } } } }
public class class_name { public static Row of(Object... values) { Row row = new Row(values.length); for (int i = 0; i < values.length; i++) { row.setField(i, values[i]); } return row; } }
public class class_name { public static Row of(Object... values) { Row row = new Row(values.length); for (int i = 0; i < values.length; i++) { row.setField(i, values[i]); // depends on control dependency: [for], data = [i] } return row; } }
public class class_name { public JSONObject sameHqDeleteBySign(String contSign, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("cont_sign", contSign); if (options != null) { request.addBody(options); } request.setUri(ImageSearchConsts.SAME_HQ_DELETE); postOperation(request); return requestServer(request); } }
public class class_name { public JSONObject sameHqDeleteBySign(String contSign, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("cont_sign", contSign); if (options != null) { request.addBody(options); // depends on control dependency: [if], data = [(options] } request.setUri(ImageSearchConsts.SAME_HQ_DELETE); postOperation(request); return requestServer(request); } }
public class class_name { public void write_compressed(final OtpErlangObject o, final int level) { @SuppressWarnings("resource") final OtpOutputStream oos = new OtpOutputStream(o); /* * similar to erts_term_to_binary() in external.c: We don't want to * compress if compression actually increases the size. Since * compression uses 5 extra bytes (COMPRESSED tag + size), don't * compress if the original term is smaller. */ if (oos.size() < 5) { // fast path for small terms try { oos.writeToAndFlush(this); // if the term is written as a compressed term, the output // stream is closed, so we do this here, too close(); } catch (final IOException e) { throw new java.lang.IllegalArgumentException( "Intermediate stream failed for Erlang object " + o); } } else { final int startCount = super.count; // we need destCount bytes for an uncompressed term // -> if compression uses more, use the uncompressed term! final int destCount = startCount + oos.size(); fixedSize = destCount; final Deflater def = new Deflater(level); final java.util.zip.DeflaterOutputStream dos = new java.util.zip.DeflaterOutputStream( this, def); try { write1(OtpExternal.compressedTag); write4BE(oos.size()); oos.writeTo(dos); dos.close(); // note: closes this, too! } catch (final IllegalArgumentException e) { /* * Discard further un-compressed data (if not called, there may * be memory leaks). * * After calling java.util.zip.Deflater.end(), the deflater * should not be used anymore, not even the close() method of * dos. Calling dos.close() before def.end() is prevented since * an unfinished DeflaterOutputStream will try to deflate its * unprocessed data to the (fixed) byte array which is prevented * by ensureCapacity() and would also unnecessarily process * further data that is discarded anyway. * * Since we are re-using the byte array of this object below, we * must not call close() in e.g. a finally block either (with or * without a call to def.end()). */ def.end(); // could not make the value smaller than originally // -> reset to starting count, write uncompressed super.count = startCount; try { oos.writeTo(this); // if the term is written as a compressed term, the output // stream is closed, so we do this here, too close(); } catch (final IOException e2) { throw new java.lang.IllegalArgumentException( "Intermediate stream failed for Erlang object " + o); } } catch (final IOException e) { throw new java.lang.IllegalArgumentException( "Intermediate stream failed for Erlang object " + o); } finally { fixedSize = Integer.MAX_VALUE; } } } }
public class class_name { public void write_compressed(final OtpErlangObject o, final int level) { @SuppressWarnings("resource") final OtpOutputStream oos = new OtpOutputStream(o); /* * similar to erts_term_to_binary() in external.c: We don't want to * compress if compression actually increases the size. Since * compression uses 5 extra bytes (COMPRESSED tag + size), don't * compress if the original term is smaller. */ if (oos.size() < 5) { // fast path for small terms try { oos.writeToAndFlush(this); // depends on control dependency: [try], data = [none] // if the term is written as a compressed term, the output // stream is closed, so we do this here, too close(); // depends on control dependency: [try], data = [none] } catch (final IOException e) { throw new java.lang.IllegalArgumentException( "Intermediate stream failed for Erlang object " + o); } // depends on control dependency: [catch], data = [none] } else { final int startCount = super.count; // we need destCount bytes for an uncompressed term // -> if compression uses more, use the uncompressed term! final int destCount = startCount + oos.size(); fixedSize = destCount; // depends on control dependency: [if], data = [none] final Deflater def = new Deflater(level); final java.util.zip.DeflaterOutputStream dos = new java.util.zip.DeflaterOutputStream( this, def); try { write1(OtpExternal.compressedTag); // depends on control dependency: [try], data = [none] write4BE(oos.size()); // depends on control dependency: [try], data = [none] oos.writeTo(dos); // depends on control dependency: [try], data = [none] dos.close(); // note: closes this, too! // depends on control dependency: [try], data = [none] } catch (final IllegalArgumentException e) { /* * Discard further un-compressed data (if not called, there may * be memory leaks). * * After calling java.util.zip.Deflater.end(), the deflater * should not be used anymore, not even the close() method of * dos. Calling dos.close() before def.end() is prevented since * an unfinished DeflaterOutputStream will try to deflate its * unprocessed data to the (fixed) byte array which is prevented * by ensureCapacity() and would also unnecessarily process * further data that is discarded anyway. * * Since we are re-using the byte array of this object below, we * must not call close() in e.g. a finally block either (with or * without a call to def.end()). */ def.end(); // could not make the value smaller than originally // -> reset to starting count, write uncompressed super.count = startCount; try { oos.writeTo(this); // depends on control dependency: [try], data = [none] // if the term is written as a compressed term, the output // stream is closed, so we do this here, too close(); // depends on control dependency: [try], data = [none] } catch (final IOException e2) { throw new java.lang.IllegalArgumentException( "Intermediate stream failed for Erlang object " + o); } // depends on control dependency: [catch], data = [none] } catch (final IOException e) { // depends on control dependency: [catch], data = [none] throw new java.lang.IllegalArgumentException( "Intermediate stream failed for Erlang object " + o); } finally { // depends on control dependency: [catch], data = [none] fixedSize = Integer.MAX_VALUE; } } } }
public class class_name { public void executeListIndepActions() { if (getList().getMetadata().getItemDetailDefinition(getParamListAction()) != null) { // toggle item details getList().getMetadata().toogleDetailState(getParamListAction()); // lazy initialization initializeDetail(getParamListAction()); } listSave(); } }
public class class_name { public void executeListIndepActions() { if (getList().getMetadata().getItemDetailDefinition(getParamListAction()) != null) { // toggle item details getList().getMetadata().toogleDetailState(getParamListAction()); // depends on control dependency: [if], data = [none] // lazy initialization initializeDetail(getParamListAction()); // depends on control dependency: [if], data = [none] } listSave(); } }
public class class_name { public static List<Object> getFieldValues(Iterable<?> collection, final String fieldName, boolean ignoreNull) { return extract(collection, new Editor<Object>() { @Override public Object edit(Object bean) { if (bean instanceof Map) { return ((Map<?, ?>) bean).get(fieldName); } else { return ReflectUtil.getFieldValue(bean, fieldName); } } }, ignoreNull); } }
public class class_name { public static List<Object> getFieldValues(Iterable<?> collection, final String fieldName, boolean ignoreNull) { return extract(collection, new Editor<Object>() { @Override public Object edit(Object bean) { if (bean instanceof Map) { return ((Map<?, ?>) bean).get(fieldName); // depends on control dependency: [if], data = [none] } else { return ReflectUtil.getFieldValue(bean, fieldName); // depends on control dependency: [if], data = [none] } } }, ignoreNull); } }
public class class_name { private String wordFeature(String word) { //String feat = (String) wordFeatureCache.get(word); //if (feat != null) { // return(feat); //} String feat; if (lowercase.matcher(word).find()) { feat = "lc"; } else if (twoDigits.matcher(word).find()) { feat = "2d"; } else if (fourDigits.matcher(word).find()) { feat = "4d"; } else if (containsNumber.matcher(word).find()) { if (containsLetter.matcher(word).find()) { feat = "an"; } else if (containsHyphens.matcher(word).find()) { feat = "dd"; } else if (containsBackslash.matcher(word).find()) { feat = "ds"; } else if (containsComma.matcher(word).find()) { feat = "dc"; } else if (containsPeriod.matcher(word).find()) { feat = "dp"; } else { feat = "num"; } } else if (allCaps.matcher(word).find() && word.length() == 1) { feat = "sc"; } else if (allCaps.matcher(word).find()) { feat = "ac"; } else if (capPeriod.matcher(word).find()) { feat = "cp"; } else if (initialCap.matcher(word).find()) { feat = "ic"; } else { feat = "other"; } //wordFeatureCache.put(word,feat); //System.err.println("Finder.wordFeature: word="+word+" feat="+feat); return (feat); } }
public class class_name { private String wordFeature(String word) { //String feat = (String) wordFeatureCache.get(word); //if (feat != null) { // return(feat); //} String feat; if (lowercase.matcher(word).find()) { feat = "lc"; // depends on control dependency: [if], data = [none] } else if (twoDigits.matcher(word).find()) { feat = "2d"; // depends on control dependency: [if], data = [none] } else if (fourDigits.matcher(word).find()) { feat = "4d"; // depends on control dependency: [if], data = [none] } else if (containsNumber.matcher(word).find()) { if (containsLetter.matcher(word).find()) { feat = "an"; // depends on control dependency: [if], data = [none] } else if (containsHyphens.matcher(word).find()) { feat = "dd"; // depends on control dependency: [if], data = [none] } else if (containsBackslash.matcher(word).find()) { feat = "ds"; // depends on control dependency: [if], data = [none] } else if (containsComma.matcher(word).find()) { feat = "dc"; // depends on control dependency: [if], data = [none] } else if (containsPeriod.matcher(word).find()) { feat = "dp"; // depends on control dependency: [if], data = [none] } else { feat = "num"; // depends on control dependency: [if], data = [none] } } else if (allCaps.matcher(word).find() && word.length() == 1) { feat = "sc"; // depends on control dependency: [if], data = [none] } else if (allCaps.matcher(word).find()) { feat = "ac"; // depends on control dependency: [if], data = [none] } else if (capPeriod.matcher(word).find()) { feat = "cp"; // depends on control dependency: [if], data = [none] } else if (initialCap.matcher(word).find()) { feat = "ic"; // depends on control dependency: [if], data = [none] } else { feat = "other"; // depends on control dependency: [if], data = [none] } //wordFeatureCache.put(word,feat); //System.err.println("Finder.wordFeature: word="+word+" feat="+feat); return (feat); } }
public class class_name { protected void deliveryAsyncResult(Request request, HttpCallback<?> callback) { Util.log("onDelivery:" + request.url().toString()); final HttpCallback<?> resCallBack = callback == null ? new DefaultCallback() : callback; //Call start callStart(resCallBack, request); mOkHttpClient.newCall(request).enqueue(new Callback() { public void onFailure(Call call, IOException e) { Util.log("onFailure:" + call.request().toString()); callFailure(resCallBack, call.request(), null, e); callFinish(resCallBack); } public void onResponse(Call call, Response response) { try { Object ret = null; final String string = response.body().string(); final boolean haveValue = !TextUtils.isEmpty(string); Util.log("onResponse:Code:%d Body:%s.", response.code(), (haveValue ? string : "null")); if (haveValue) { ret = mResolver.analysis(string, resCallBack.getClass()); } callSuccess(resCallBack, ret, response.code()); } catch (Exception e) { Util.log("onResponse Failure:" + response.request().toString()); callFailure(resCallBack, response.request(), response, e); } callFinish(resCallBack); } }); } }
public class class_name { protected void deliveryAsyncResult(Request request, HttpCallback<?> callback) { Util.log("onDelivery:" + request.url().toString()); final HttpCallback<?> resCallBack = callback == null ? new DefaultCallback() : callback; //Call start callStart(resCallBack, request); mOkHttpClient.newCall(request).enqueue(new Callback() { public void onFailure(Call call, IOException e) { Util.log("onFailure:" + call.request().toString()); callFailure(resCallBack, call.request(), null, e); callFinish(resCallBack); } public void onResponse(Call call, Response response) { try { Object ret = null; final String string = response.body().string(); final boolean haveValue = !TextUtils.isEmpty(string); Util.log("onResponse:Code:%d Body:%s.", response.code(), (haveValue ? string : "null")); // depends on control dependency: [try], data = [none] if (haveValue) { ret = mResolver.analysis(string, resCallBack.getClass()); // depends on control dependency: [if], data = [none] } callSuccess(resCallBack, ret, response.code()); // depends on control dependency: [try], data = [none] } catch (Exception e) { Util.log("onResponse Failure:" + response.request().toString()); callFailure(resCallBack, response.request(), response, e); } // depends on control dependency: [catch], data = [none] callFinish(resCallBack); } }); } }
public class class_name { public static void restoreDefaultCursor () { if (systemCursorAsDefault) { Gdx.graphics.setSystemCursor(defaultSystemCursor); } else { Gdx.graphics.setCursor(defaultCursor); } } }
public class class_name { public static void restoreDefaultCursor () { if (systemCursorAsDefault) { Gdx.graphics.setSystemCursor(defaultSystemCursor); // depends on control dependency: [if], data = [none] } else { Gdx.graphics.setCursor(defaultCursor); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void doStop(final Wave wave) { for (int i = this.timeFrame; i >= 0; i--) { hideCurrent(this.eventList.get(this.timeFrame)); } } }
public class class_name { public void doStop(final Wave wave) { for (int i = this.timeFrame; i >= 0; i--) { hideCurrent(this.eventList.get(this.timeFrame)); // depends on control dependency: [for], data = [none] } } }
public class class_name { public static Marshaller createMarshaller(Class clazz, String encoding) { try { JAXBContext jaxbContext = getJaxbContext(clazz); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); if (StringUtils.isNotBlank(encoding)) { marshaller.setProperty(Marshaller.JAXB_ENCODING, encoding); } return marshaller; } catch (JAXBException e) { throw ExceptionUtil.unchecked(e); } } }
public class class_name { public static Marshaller createMarshaller(Class clazz, String encoding) { try { JAXBContext jaxbContext = getJaxbContext(clazz); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // depends on control dependency: [try], data = [none] if (StringUtils.isNotBlank(encoding)) { marshaller.setProperty(Marshaller.JAXB_ENCODING, encoding); // depends on control dependency: [if], data = [none] } return marshaller; // depends on control dependency: [try], data = [none] } catch (JAXBException e) { throw ExceptionUtil.unchecked(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(DeleteDocumentationVersionRequest deleteDocumentationVersionRequest, ProtocolMarshaller protocolMarshaller) { if (deleteDocumentationVersionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteDocumentationVersionRequest.getRestApiId(), RESTAPIID_BINDING); protocolMarshaller.marshall(deleteDocumentationVersionRequest.getDocumentationVersion(), DOCUMENTATIONVERSION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteDocumentationVersionRequest deleteDocumentationVersionRequest, ProtocolMarshaller protocolMarshaller) { if (deleteDocumentationVersionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteDocumentationVersionRequest.getRestApiId(), RESTAPIID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteDocumentationVersionRequest.getDocumentationVersion(), DOCUMENTATIONVERSION_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public DefaultProtocolDef getDefaultProtocol() { if (model.getSingle("defaultProtocol") != null) { return new DefaultProtocolDefImpl(getDescriptorName(), model, model.getSingle("defaultProtocol")); } return null; } }
public class class_name { @Override public DefaultProtocolDef getDefaultProtocol() { if (model.getSingle("defaultProtocol") != null) { return new DefaultProtocolDefImpl(getDescriptorName(), model, model.getSingle("defaultProtocol")); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static boolean isValid(final String cssValue) { // TODO modify to make a strict validation if (cssValue == null || StringUtil.isBlank(cssValue)) { return false; } final String[] cssValueParts = StringUtil.splitBySpace(cssValue); MozFlexGrow mozFlexGrow = null; MozFlexShrink mozFlexShrink = null; MozFlexBasis mozFlexBasis = null; for (final String eachPart : cssValueParts) { boolean invalid = true; if (mozFlexGrow == null && MozFlexGrow.isValid(eachPart)) { mozFlexGrow = new MozFlexGrow(eachPart); invalid = false; } else if (mozFlexShrink == null && MozFlexShrink.isValid(eachPart)) { mozFlexShrink = new MozFlexShrink(eachPart); invalid = false; } else if (mozFlexBasis == null && MozFlexBasis.isValid(eachPart)) { mozFlexBasis = new MozFlexBasis(eachPart); invalid = false; } if (invalid) { return false; } } return mozFlexGrow != null || mozFlexShrink != null || mozFlexBasis != null; } }
public class class_name { public static boolean isValid(final String cssValue) { // TODO modify to make a strict validation if (cssValue == null || StringUtil.isBlank(cssValue)) { return false; // depends on control dependency: [if], data = [none] } final String[] cssValueParts = StringUtil.splitBySpace(cssValue); MozFlexGrow mozFlexGrow = null; MozFlexShrink mozFlexShrink = null; MozFlexBasis mozFlexBasis = null; for (final String eachPart : cssValueParts) { boolean invalid = true; if (mozFlexGrow == null && MozFlexGrow.isValid(eachPart)) { mozFlexGrow = new MozFlexGrow(eachPart); // depends on control dependency: [if], data = [none] invalid = false; // depends on control dependency: [if], data = [none] } else if (mozFlexShrink == null && MozFlexShrink.isValid(eachPart)) { mozFlexShrink = new MozFlexShrink(eachPart); // depends on control dependency: [if], data = [none] invalid = false; // depends on control dependency: [if], data = [none] } else if (mozFlexBasis == null && MozFlexBasis.isValid(eachPart)) { mozFlexBasis = new MozFlexBasis(eachPart); // depends on control dependency: [if], data = [none] invalid = false; // depends on control dependency: [if], data = [none] } if (invalid) { return false; // depends on control dependency: [if], data = [none] } } return mozFlexGrow != null || mozFlexShrink != null || mozFlexBasis != null; } }
public class class_name { protected Future<T> removeFromListeners( GenericCompletionListener<? extends Future<T>> listener) { if (listener == null) { throw new IllegalArgumentException("The listener can't be null."); } if (!isDone()) { synchronized(this) { listeners.remove(listener); } } return this; } }
public class class_name { protected Future<T> removeFromListeners( GenericCompletionListener<? extends Future<T>> listener) { if (listener == null) { throw new IllegalArgumentException("The listener can't be null."); } if (!isDone()) { synchronized(this) { // depends on control dependency: [if], data = [none] listeners.remove(listener); } } return this; } }
public class class_name { @Nonnull public ESuccess compactDatabase (final boolean bDeleteTemporarySQLFile) { return getLock ().locked ( () -> { // Close DB close (); // Set temporary file name final String sScriptFileName = "h2dump$$.sql"; final File aScriptFileName = new File (sScriptFileName); try { if (dumpDatabase (aScriptFileName).isSuccess ()) { // Delete all DB files DeleteDbFiles.execute (m_sDirectory, m_sDBName, true); // And re-execute the stuff from the file RunScript.execute (getConnectionUrl (), m_sUser, m_sPassword, sScriptFileName, null, false); // And delete temporary file if (bDeleteTemporarySQLFile && FileOperations.deleteFile (aScriptFileName).isFailure ()) LOGGER.error ("Failed to delete temporary export file '" + sScriptFileName + "'"); return ESuccess.SUCCESS; } } catch (final SQLException ex) { // Oops, we lost our data -> save file to avoid overwriting with another // compact call String sUniqueFileName = "h2dump-" + Clock.systemUTC ().millis () + ".sql"; if (FileOperations.renameFile (aScriptFileName, new File (sUniqueFileName)).isFailure ()) sUniqueFileName = sScriptFileName; LOGGER.error ("Failed to delete and refill database. Data is contained in file '" + sUniqueFileName + "'!", ex); } return ESuccess.FAILURE; }); } }
public class class_name { @Nonnull public ESuccess compactDatabase (final boolean bDeleteTemporarySQLFile) { return getLock ().locked ( () -> { // Close DB close (); // Set temporary file name final String sScriptFileName = "h2dump$$.sql"; final File aScriptFileName = new File (sScriptFileName); try { if (dumpDatabase (aScriptFileName).isSuccess ()) { // Delete all DB files DeleteDbFiles.execute (m_sDirectory, m_sDBName, true); // depends on control dependency: [if], data = [none] // And re-execute the stuff from the file RunScript.execute (getConnectionUrl (), m_sUser, m_sPassword, sScriptFileName, null, false); // depends on control dependency: [if], data = [none] // And delete temporary file if (bDeleteTemporarySQLFile && FileOperations.deleteFile (aScriptFileName).isFailure ()) LOGGER.error ("Failed to delete temporary export file '" + sScriptFileName + "'"); return ESuccess.SUCCESS; // depends on control dependency: [if], data = [none] } } catch (final SQLException ex) { // Oops, we lost our data -> save file to avoid overwriting with another // compact call String sUniqueFileName = "h2dump-" + Clock.systemUTC ().millis () + ".sql"; if (FileOperations.renameFile (aScriptFileName, new File (sUniqueFileName)).isFailure ()) sUniqueFileName = sScriptFileName; LOGGER.error ("Failed to delete and refill database. Data is contained in file '" + sUniqueFileName + "'!", ex); } // depends on control dependency: [catch], data = [none] return ESuccess.FAILURE; }); } }
public class class_name { public void putAll(final Props p) { if (p == null) { return; } for (final String key : p.getKeySet()) { this.put(key, p.get(key)); } } }
public class class_name { public void putAll(final Props p) { if (p == null) { return; // depends on control dependency: [if], data = [none] } for (final String key : p.getKeySet()) { this.put(key, p.get(key)); // depends on control dependency: [for], data = [key] } } }
public class class_name { public static String canonicalID(String id) { if (id == null) return ""; int st = 0; int len = id.length(); boolean substr = false; int c; while (st < len && ((c = id.charAt(st)) == '<' || c <= ' ')) { st++; substr = true; } while (st < len && ((c = id.charAt(len - 1)) == '>' || c <= ' ')) { len--; substr = true; } return substr ? id.substring(st, len) : id; } }
public class class_name { public static String canonicalID(String id) { if (id == null) return ""; int st = 0; int len = id.length(); boolean substr = false; int c; while (st < len && ((c = id.charAt(st)) == '<' || c <= ' ')) { st++; // depends on control dependency: [while], data = [none] substr = true; // depends on control dependency: [while], data = [none] } while (st < len && ((c = id.charAt(len - 1)) == '>' || c <= ' ')) { len--; // depends on control dependency: [while], data = [none] substr = true; // depends on control dependency: [while], data = [none] } return substr ? id.substring(st, len) : id; } }
public class class_name { public final String formatStart(Format format) { if (format != null) { Long minStart = interval.getMinStart(); if (minStart != null) { return format.format(minStart); } else { return null; } } else { Long minStart = interval.getMinStart(); if (minStart != null) { return numberFormat.get().format(minStart); } else { return null; } } } }
public class class_name { public final String formatStart(Format format) { if (format != null) { Long minStart = interval.getMinStart(); if (minStart != null) { return format.format(minStart); // depends on control dependency: [if], data = [(minStart] } else { return null; // depends on control dependency: [if], data = [none] } } else { Long minStart = interval.getMinStart(); if (minStart != null) { return numberFormat.get().format(minStart); // depends on control dependency: [if], data = [(minStart] } else { return null; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static Map.Entry<Object, Object> maxMax(DataTable2D payoffMatrix) { if(payoffMatrix.isValid()==false) { throw new IllegalArgumentException("The payoff matrix does not have a rectangular format."); } Double maxMaxPayoff = Double.NEGATIVE_INFINITY; Object maxMaxPayoffOption = null; for(Map.Entry<Object, AssociativeArray> entry : payoffMatrix.entrySet()) { //Object event = entry.getKey(); AssociativeArray optionList = entry.getValue(); for(Map.Entry<Object, Object> entry2 : optionList.entrySet()) { Double payoff = TypeInference.toDouble(entry2.getValue()); //Object option = entry2.getKey(); if(payoff>maxMaxPayoff) { maxMaxPayoff=payoff; maxMaxPayoffOption = entry2.getKey(); } } } return new AbstractMap.SimpleEntry<>(maxMaxPayoffOption, maxMaxPayoff); } }
public class class_name { public static Map.Entry<Object, Object> maxMax(DataTable2D payoffMatrix) { if(payoffMatrix.isValid()==false) { throw new IllegalArgumentException("The payoff matrix does not have a rectangular format."); } Double maxMaxPayoff = Double.NEGATIVE_INFINITY; Object maxMaxPayoffOption = null; for(Map.Entry<Object, AssociativeArray> entry : payoffMatrix.entrySet()) { //Object event = entry.getKey(); AssociativeArray optionList = entry.getValue(); for(Map.Entry<Object, Object> entry2 : optionList.entrySet()) { Double payoff = TypeInference.toDouble(entry2.getValue()); //Object option = entry2.getKey(); if(payoff>maxMaxPayoff) { maxMaxPayoff=payoff; // depends on control dependency: [if], data = [none] maxMaxPayoffOption = entry2.getKey(); // depends on control dependency: [if], data = [none] } } } return new AbstractMap.SimpleEntry<>(maxMaxPayoffOption, maxMaxPayoff); } }
public class class_name { protected String moduleNameIdEncodingEndLayer(HttpServletRequest request, List<IModule> modules) { IAggregator aggr = (IAggregator)request.getAttribute(IAggregator.AGGREGATOR_REQATTRNAME); String result = ""; //$NON-NLS-1$ @SuppressWarnings("unchecked") ConcurrentListBuilder<String[]> expDepsBuilder = (ConcurrentListBuilder<String[]>)request.getAttribute(MODULE_EXPANDED_DEPS); IRequestedModuleNames requestedModules = (IRequestedModuleNames)request.getAttribute(IHttpTransport.REQUESTEDMODULENAMES_REQATTRNAME); if (expDepsBuilder == null) { expDepsBuilder = new ConcurrentListBuilder<String[]>(); } // Add boot layer deps to module id list boolean noAMD = false; if (requestedModules != null) { try { if (!requestedModules.getDeps().isEmpty()) { expDepsBuilder.add(requestedModules.getDeps().toArray(new String[requestedModules.getDeps().size()])); } if (!requestedModules.getPreloads().isEmpty()) { expDepsBuilder.add(requestedModules.getPreloads().toArray(new String[requestedModules.getPreloads().size()])); } if (RequestUtil.isServerExpandedLayers(request) && !requestedModules.getModules().isEmpty()) { // if server expanding layers, then add the required modules so that they can be module id encoded // in the exclude list on subsequent requests. expDepsBuilder.add(requestedModules.getModules().toArray(new String[requestedModules.getModules().size()])); } noAMD = requestedModules.getDeps().isEmpty() && requestedModules.getPreloads().isEmpty() && requestedModules.getModules().isEmpty(); } catch (IOException ignore) { // Won't happen because the requestedModules object is already initialized // but the language requires us to provide an exception handler. } } List<String[]> expDeps = expDepsBuilder.toList(); StringBuffer sb = new StringBuffer(); Map<String, Integer> idMap = null; if (!aggr.getOptions().isDisableModuleNameIdEncoding()) { idMap = aggr.getTransport().getModuleIdMap(); } if (RequestUtil.isExplodeRequires(request)) { if (expDeps.size() > 0) { sb.append(EXPDEPS_VARNAME).append("=") //$NON-NLS-1$ .append(generateModuleIdReg(expDeps, idMap)) .append(";"); //$NON-NLS-1$ if (idMap != null) { // Now, invoke the registration function to register the names/ids sb.append(aggr.getTransport().getModuleIdRegFunctionName()) .append("(") //$NON-NLS-1$ .append(EXPDEPS_VARNAME) .append(");"); //$NON-NLS-1$ } } } else if (expDeps.size() > 0 && idMap != null) { sb.append(aggr.getTransport().getModuleIdRegFunctionName()).append("(") //$NON-NLS-1$ .append(generateModuleIdReg(expDeps, idMap)) .append(");"); //$NON-NLS-1$ } // Finally, close the scoping function and invoke it. if (!noAMD) { // only close the scope if it was opened for AMD modules. sb.append("})();"); //$NON-NLS-1$ } result = sb.toString(); return result; } }
public class class_name { protected String moduleNameIdEncodingEndLayer(HttpServletRequest request, List<IModule> modules) { IAggregator aggr = (IAggregator)request.getAttribute(IAggregator.AGGREGATOR_REQATTRNAME); String result = ""; //$NON-NLS-1$ @SuppressWarnings("unchecked") ConcurrentListBuilder<String[]> expDepsBuilder = (ConcurrentListBuilder<String[]>)request.getAttribute(MODULE_EXPANDED_DEPS); IRequestedModuleNames requestedModules = (IRequestedModuleNames)request.getAttribute(IHttpTransport.REQUESTEDMODULENAMES_REQATTRNAME); if (expDepsBuilder == null) { expDepsBuilder = new ConcurrentListBuilder<String[]>(); // depends on control dependency: [if], data = [none] } // Add boot layer deps to module id list boolean noAMD = false; if (requestedModules != null) { try { if (!requestedModules.getDeps().isEmpty()) { expDepsBuilder.add(requestedModules.getDeps().toArray(new String[requestedModules.getDeps().size()])); // depends on control dependency: [if], data = [none] } if (!requestedModules.getPreloads().isEmpty()) { expDepsBuilder.add(requestedModules.getPreloads().toArray(new String[requestedModules.getPreloads().size()])); // depends on control dependency: [if], data = [none] } if (RequestUtil.isServerExpandedLayers(request) && !requestedModules.getModules().isEmpty()) { // if server expanding layers, then add the required modules so that they can be module id encoded // in the exclude list on subsequent requests. expDepsBuilder.add(requestedModules.getModules().toArray(new String[requestedModules.getModules().size()])); // depends on control dependency: [if], data = [none] } noAMD = requestedModules.getDeps().isEmpty() && requestedModules.getPreloads().isEmpty() && requestedModules.getModules().isEmpty(); // depends on control dependency: [try], data = [none] } catch (IOException ignore) { // Won't happen because the requestedModules object is already initialized // but the language requires us to provide an exception handler. } // depends on control dependency: [catch], data = [none] } List<String[]> expDeps = expDepsBuilder.toList(); StringBuffer sb = new StringBuffer(); Map<String, Integer> idMap = null; if (!aggr.getOptions().isDisableModuleNameIdEncoding()) { idMap = aggr.getTransport().getModuleIdMap(); // depends on control dependency: [if], data = [none] } if (RequestUtil.isExplodeRequires(request)) { if (expDeps.size() > 0) { sb.append(EXPDEPS_VARNAME).append("=") //$NON-NLS-1$ .append(generateModuleIdReg(expDeps, idMap)) .append(";"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] if (idMap != null) { // Now, invoke the registration function to register the names/ids sb.append(aggr.getTransport().getModuleIdRegFunctionName()) .append("(") //$NON-NLS-1$ .append(EXPDEPS_VARNAME) .append(");"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } } } else if (expDeps.size() > 0 && idMap != null) { sb.append(aggr.getTransport().getModuleIdRegFunctionName()).append("(") //$NON-NLS-1$ .append(generateModuleIdReg(expDeps, idMap)) .append(");"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } // Finally, close the scoping function and invoke it. if (!noAMD) { // only close the scope if it was opened for AMD modules. sb.append("})();"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none] } result = sb.toString(); return result; } }
public class class_name { @Override public void afterCompletion(int status) { // clean up transactions that aren't managed by Spring for (DataAccess<SimpleFeatureType, SimpleFeature> dataStore : transactions.keySet()) { // we must manage transaction ourselves for non-JDBC ! if (!(dataStore instanceof JDBCDataStore)) { Transaction transaction = transactions.get(dataStore); try { switch (status) { case TransactionSynchronization.STATUS_COMMITTED: transaction.commit(); break; case TransactionSynchronization.STATUS_ROLLED_BACK: transaction.rollback(); break; case TransactionSynchronization.STATUS_UNKNOWN: } } catch (IOException e) { try { transaction.rollback(); } catch (IOException e1) { log.debug("Could not rollback geotools transaction", e1); } } finally { try { transaction.close(); } catch (IOException e) { log.debug("Could not close geotools transaction", e); } } } } transactions.clear(); } }
public class class_name { @Override public void afterCompletion(int status) { // clean up transactions that aren't managed by Spring for (DataAccess<SimpleFeatureType, SimpleFeature> dataStore : transactions.keySet()) { // we must manage transaction ourselves for non-JDBC ! if (!(dataStore instanceof JDBCDataStore)) { Transaction transaction = transactions.get(dataStore); try { switch (status) { case TransactionSynchronization.STATUS_COMMITTED: transaction.commit(); break; case TransactionSynchronization.STATUS_ROLLED_BACK: transaction.rollback(); break; case TransactionSynchronization.STATUS_UNKNOWN: } } catch (IOException e) { try { transaction.rollback(); // depends on control dependency: [try], data = [none] } catch (IOException e1) { log.debug("Could not rollback geotools transaction", e1); } // depends on control dependency: [catch], data = [none] } finally { // depends on control dependency: [catch], data = [none] try { transaction.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { log.debug("Could not close geotools transaction", e); } // depends on control dependency: [catch], data = [none] } } } transactions.clear(); } }
public class class_name { public Date getDate() { for (int i = 0; i < info.length() - 9; i++) { if (Character.isWhitespace(info.charAt(i))) { String dateString = info.substring(i + 1, i + 9); try { synchronized (formatter) { return formatter.parse(dateString); } } catch (ParseException pe) { } break; } } return null; } }
public class class_name { public Date getDate() { for (int i = 0; i < info.length() - 9; i++) { if (Character.isWhitespace(info.charAt(i))) { String dateString = info.substring(i + 1, i + 9); try { synchronized (formatter) { // depends on control dependency: [try], data = [none] return formatter.parse(dateString); } } catch (ParseException pe) { } // depends on control dependency: [catch], data = [none] break; } } return null; } }
public class class_name { public static List<MutableIntTuple> deepCopy( Collection<? extends IntTuple> tuples) { List<MutableIntTuple> result = new ArrayList<MutableIntTuple>(tuples.size()); for (IntTuple t : tuples) { if (t == null) { result.add(null); } else { result.add(IntTuples.copy(t)); } } return result; } }
public class class_name { public static List<MutableIntTuple> deepCopy( Collection<? extends IntTuple> tuples) { List<MutableIntTuple> result = new ArrayList<MutableIntTuple>(tuples.size()); for (IntTuple t : tuples) { if (t == null) { result.add(null); // depends on control dependency: [if], data = [null)] } else { result.add(IntTuples.copy(t)); // depends on control dependency: [if], data = [(t] } } return result; } }
public class class_name { public void addResidue(Residue residue) { if (residues == null) residues = new ArrayList<Residue>(); //Check if exists if (residues.contains(residue)) { System.out.println("Residue: " + residue.getName() + " already present in molecule: " + getID()); return; } residues.add(residue); } }
public class class_name { public void addResidue(Residue residue) { if (residues == null) residues = new ArrayList<Residue>(); //Check if exists if (residues.contains(residue)) { System.out.println("Residue: " + residue.getName() + " already present in molecule: " + getID()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } residues.add(residue); } }
public class class_name { public final Object accessField(Field field, Object object) { try { object = field.get(object); } catch (NullPointerException npex) { throw new NullKeyFieldException("Unable to access field "+field+" on object "+object); } catch (IllegalAccessException iaex) { throw new RuntimeException("This should not happen since we call setAccesssible(true) in PojoTypeInfo." + " fields: " + field + " obj: " + object); } return object; } }
public class class_name { public final Object accessField(Field field, Object object) { try { object = field.get(object); // depends on control dependency: [try], data = [none] } catch (NullPointerException npex) { throw new NullKeyFieldException("Unable to access field "+field+" on object "+object); } catch (IllegalAccessException iaex) { // depends on control dependency: [catch], data = [none] throw new RuntimeException("This should not happen since we call setAccesssible(true) in PojoTypeInfo." + " fields: " + field + " obj: " + object); } // depends on control dependency: [catch], data = [none] return object; } }
public class class_name { public void elementwiseProductInPlace(ConcatVector other) { for (int i = 0; i < pointers.length; i++) { if (pointers[i] == null) continue; if (copyOnWrite[i]) { copyOnWrite[i] = false; pointers[i] = pointers[i].clone(); } if (i >= other.pointers.length || other.pointers[i] == null) { pointers[i] = null; } else if (sparse[i] && other.sparse[i]) { outer: for (int j = 0; j < pointers[i].length / 2; j++) { int sparseValue = (int) pointers[i][j * 2]; for (int k = 0; k < other.pointers[i].length / 2; k++) { int otherSparseValue = (int) other.pointers[i][k * 2]; if (sparseValue == otherSparseValue) { pointers[i][(j * 2) + 1] *= other.pointers[i][(k * 2) + 1]; continue outer; } } pointers[i][(j * 2) + 1] = 0; } } else if (sparse[i] && !other.sparse[i]) { for (int j = 0; j < pointers[i].length / 2; j++) { int sparseIndex = (int) pointers[i][j * 2]; if (sparseIndex >= 0 && sparseIndex < other.pointers[i].length) { pointers[i][(j * 2) + 1] *= other.pointers[i][sparseIndex]; } else { pointers[i][(j * 2) + 1] = 0.0f; } } } else if (!sparse[i] && other.sparse[i]) { // Note: there are cases where we want this element to actually become sparse, but I can't think of any // in practice, so we won't bother with the complexity boolean[] touched = new boolean[pointers[i].length]; for (int j = 0; j < other.pointers[i].length / 2; j++) { int sparseIndex = (int) other.pointers[i][j * 2]; if (sparseIndex >= 0 && sparseIndex < pointers[i].length) { pointers[i][sparseIndex] *= other.pointers[i][(j * 2) + 1]; touched[sparseIndex] = true; } } for (int j = 0; j < pointers[i].length; j++) { if (!touched[j]) pointers[i][j] = 0.0; } } else { for (int j = 0; j < Math.min(pointers[i].length, other.pointers[i].length); j++) { pointers[i][j] *= other.pointers[i][j]; } for (int j = other.pointers[i].length; j < pointers[i].length; j++) { pointers[i][j] = 0.0f; } } } } }
public class class_name { public void elementwiseProductInPlace(ConcatVector other) { for (int i = 0; i < pointers.length; i++) { if (pointers[i] == null) continue; if (copyOnWrite[i]) { copyOnWrite[i] = false; // depends on control dependency: [if], data = [none] pointers[i] = pointers[i].clone(); // depends on control dependency: [if], data = [none] } if (i >= other.pointers.length || other.pointers[i] == null) { pointers[i] = null; // depends on control dependency: [if], data = [none] } else if (sparse[i] && other.sparse[i]) { outer: for (int j = 0; j < pointers[i].length / 2; j++) { int sparseValue = (int) pointers[i][j * 2]; for (int k = 0; k < other.pointers[i].length / 2; k++) { int otherSparseValue = (int) other.pointers[i][k * 2]; if (sparseValue == otherSparseValue) { pointers[i][(j * 2) + 1] *= other.pointers[i][(k * 2) + 1]; // depends on control dependency: [if], data = [none] continue outer; } } pointers[i][(j * 2) + 1] = 0; // depends on control dependency: [for], data = [j] } } else if (sparse[i] && !other.sparse[i]) { for (int j = 0; j < pointers[i].length / 2; j++) { int sparseIndex = (int) pointers[i][j * 2]; if (sparseIndex >= 0 && sparseIndex < other.pointers[i].length) { pointers[i][(j * 2) + 1] *= other.pointers[i][sparseIndex]; // depends on control dependency: [if], data = [none] } else { pointers[i][(j * 2) + 1] = 0.0f; // depends on control dependency: [if], data = [none] } } } else if (!sparse[i] && other.sparse[i]) { // Note: there are cases where we want this element to actually become sparse, but I can't think of any // in practice, so we won't bother with the complexity boolean[] touched = new boolean[pointers[i].length]; for (int j = 0; j < other.pointers[i].length / 2; j++) { int sparseIndex = (int) other.pointers[i][j * 2]; if (sparseIndex >= 0 && sparseIndex < pointers[i].length) { pointers[i][sparseIndex] *= other.pointers[i][(j * 2) + 1]; // depends on control dependency: [if], data = [none] touched[sparseIndex] = true; // depends on control dependency: [if], data = [none] } } for (int j = 0; j < pointers[i].length; j++) { if (!touched[j]) pointers[i][j] = 0.0; } } else { for (int j = 0; j < Math.min(pointers[i].length, other.pointers[i].length); j++) { pointers[i][j] *= other.pointers[i][j]; // depends on control dependency: [for], data = [j] } for (int j = other.pointers[i].length; j < pointers[i].length; j++) { pointers[i][j] = 0.0f; // depends on control dependency: [for], data = [j] } } } } }
public class class_name { @SuppressWarnings("unused") // called through reflection by RequestServer public FramesV3 deleteAll(int version, FramesV3 frames) { final Key[] keys = KeySnapshot.globalKeysOfClass(Frame.class); ArrayList<String> missing = new ArrayList<>(); Futures fs = new Futures(); for (Key key : keys) { try { getFromDKV("(none)", key).delete(null, fs); } catch (IllegalArgumentException iae) { missing.add(key.toString()); } } fs.blockForPending(); if( missing.size() != 0 ) throw new H2OKeysNotFoundArgumentException("(none)", missing.toArray(new String[missing.size()])); return frames; } }
public class class_name { @SuppressWarnings("unused") // called through reflection by RequestServer public FramesV3 deleteAll(int version, FramesV3 frames) { final Key[] keys = KeySnapshot.globalKeysOfClass(Frame.class); ArrayList<String> missing = new ArrayList<>(); Futures fs = new Futures(); for (Key key : keys) { try { getFromDKV("(none)", key).delete(null, fs); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException iae) { missing.add(key.toString()); } // depends on control dependency: [catch], data = [none] } fs.blockForPending(); if( missing.size() != 0 ) throw new H2OKeysNotFoundArgumentException("(none)", missing.toArray(new String[missing.size()])); return frames; } }
public class class_name { @SuppressWarnings("unchecked") public static <T extends Number> T convertNumberToTargetClass(Number number, Class<T> targetClass) throws IllegalArgumentException { Assert.notNull(number, "Number must not be null"); Assert.notNull(targetClass, "Target class must not be null"); if (targetClass.isInstance(number)) { return (T) number; } else if (Byte.class == targetClass) { long value = checkedLongValue(number, targetClass); if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) { raiseOverflowException(number, targetClass); } return (T) Byte.valueOf(number.byteValue()); } else if (Short.class == targetClass) { long value = checkedLongValue(number, targetClass); if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { raiseOverflowException(number, targetClass); } return (T) Short.valueOf(number.shortValue()); } else if (Integer.class == targetClass) { long value = checkedLongValue(number, targetClass); if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) { raiseOverflowException(number, targetClass); } return (T) Integer.valueOf(number.intValue()); } else if (Long.class == targetClass) { long value = checkedLongValue(number, targetClass); return (T) Long.valueOf(value); } else if (BigInteger.class == targetClass) { if (number instanceof BigDecimal) { // do not lose precision - use BigDecimal's own conversion return (T) ((BigDecimal) number).toBigInteger(); } else { // original value is not a Big* number - use standard long conversion return (T) BigInteger.valueOf(number.longValue()); } } else if (Float.class == targetClass) { return (T) Float.valueOf(number.floatValue()); } else if (Double.class == targetClass) { return (T) Double.valueOf(number.doubleValue()); } else if (BigDecimal.class == targetClass) { // always use BigDecimal(String) here to avoid unpredictability of BigDecimal(double) // (see BigDecimal javadoc for details) return (T) new BigDecimal(number.toString()); } else { throw new IllegalArgumentException("Could not convert number [" + number + "] of type [" + number.getClass().getName() + "] to unsupported target class [" + targetClass.getName() + "]"); } } }
public class class_name { @SuppressWarnings("unchecked") public static <T extends Number> T convertNumberToTargetClass(Number number, Class<T> targetClass) throws IllegalArgumentException { Assert.notNull(number, "Number must not be null"); Assert.notNull(targetClass, "Target class must not be null"); if (targetClass.isInstance(number)) { return (T) number; } else if (Byte.class == targetClass) { long value = checkedLongValue(number, targetClass); if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) { raiseOverflowException(number, targetClass); // depends on control dependency: [if], data = [none] } return (T) Byte.valueOf(number.byteValue()); } else if (Short.class == targetClass) { long value = checkedLongValue(number, targetClass); if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { raiseOverflowException(number, targetClass); // depends on control dependency: [if], data = [none] } return (T) Short.valueOf(number.shortValue()); } else if (Integer.class == targetClass) { long value = checkedLongValue(number, targetClass); if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) { raiseOverflowException(number, targetClass); // depends on control dependency: [if], data = [none] } return (T) Integer.valueOf(number.intValue()); } else if (Long.class == targetClass) { long value = checkedLongValue(number, targetClass); return (T) Long.valueOf(value); } else if (BigInteger.class == targetClass) { if (number instanceof BigDecimal) { // do not lose precision - use BigDecimal's own conversion return (T) ((BigDecimal) number).toBigInteger(); // depends on control dependency: [if], data = [none] } else { // original value is not a Big* number - use standard long conversion return (T) BigInteger.valueOf(number.longValue()); // depends on control dependency: [if], data = [none] } } else if (Float.class == targetClass) { return (T) Float.valueOf(number.floatValue()); } else if (Double.class == targetClass) { return (T) Double.valueOf(number.doubleValue()); } else if (BigDecimal.class == targetClass) { // always use BigDecimal(String) here to avoid unpredictability of BigDecimal(double) // (see BigDecimal javadoc for details) return (T) new BigDecimal(number.toString()); } else { throw new IllegalArgumentException("Could not convert number [" + number + "] of type [" + number.getClass().getName() + "] to unsupported target class [" + targetClass.getName() + "]"); } } }
public class class_name { public DeleteMessageBatchResult withSuccessful(DeleteMessageBatchResultEntry... successful) { if (this.successful == null) { setSuccessful(new com.amazonaws.internal.SdkInternalList<DeleteMessageBatchResultEntry>(successful.length)); } for (DeleteMessageBatchResultEntry ele : successful) { this.successful.add(ele); } return this; } }
public class class_name { public DeleteMessageBatchResult withSuccessful(DeleteMessageBatchResultEntry... successful) { if (this.successful == null) { setSuccessful(new com.amazonaws.internal.SdkInternalList<DeleteMessageBatchResultEntry>(successful.length)); // depends on control dependency: [if], data = [none] } for (DeleteMessageBatchResultEntry ele : successful) { this.successful.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public Field getFieldByName(String fieldNameParam) { Field field = new Field(); field.setFieldName(fieldNameParam); if(this.serviceTicket != null) { field.setServiceTicket(this.serviceTicket); } return new Field(this.postJson( field, WS.Path.FormField.Version1.getByName())); } }
public class class_name { public Field getFieldByName(String fieldNameParam) { Field field = new Field(); field.setFieldName(fieldNameParam); if(this.serviceTicket != null) { field.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [(this.serviceTicket] } return new Field(this.postJson( field, WS.Path.FormField.Version1.getByName())); } }
public class class_name { @Override public Set<String> getJobKeys() { Set<String> outList = new HashSet<String>(); synchronized (lock) { for (JobWrapper jw : jobsByKey.values()) { if (jw != null) { outList.add(jw.jobDetail.getName()); } } } return outList == null ? java.util.Collections.<String>emptySet() : outList; } }
public class class_name { @Override public Set<String> getJobKeys() { Set<String> outList = new HashSet<String>(); synchronized (lock) { for (JobWrapper jw : jobsByKey.values()) { if (jw != null) { outList.add(jw.jobDetail.getName()); // depends on control dependency: [if], data = [(jw] } } } return outList == null ? java.util.Collections.<String>emptySet() : outList; } }
public class class_name { public void marshall(AttributeValue attributeValue, ProtocolMarshaller protocolMarshaller) { if (attributeValue == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(attributeValue.getS(), S_BINDING); protocolMarshaller.marshall(attributeValue.getN(), N_BINDING); protocolMarshaller.marshall(attributeValue.getSL(), SL_BINDING); protocolMarshaller.marshall(attributeValue.getSDM(), SDM_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AttributeValue attributeValue, ProtocolMarshaller protocolMarshaller) { if (attributeValue == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(attributeValue.getS(), S_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(attributeValue.getN(), N_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(attributeValue.getSL(), SL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(attributeValue.getSDM(), SDM_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 { @SuppressWarnings("ReferenceEquality") private void updateBalancingState() { List<Subchannel> activeList = filterNonFailingSubchannels(getSubchannels()); if (activeList.isEmpty()) { // No READY subchannels, determine aggregate state and error status boolean isConnecting = false; Status aggStatus = EMPTY_OK; for (Subchannel subchannel : getSubchannels()) { ConnectivityStateInfo stateInfo = getSubchannelStateInfoRef(subchannel).value; // This subchannel IDLE is not because of channel IDLE_TIMEOUT, // in which case LB is already shutdown. // RRLB will request connection immediately on subchannel IDLE. if (stateInfo.getState() == CONNECTING || stateInfo.getState() == IDLE) { isConnecting = true; } if (aggStatus == EMPTY_OK || !aggStatus.isOk()) { aggStatus = stateInfo.getStatus(); } } updateBalancingState(isConnecting ? CONNECTING : TRANSIENT_FAILURE, // If all subchannels are TRANSIENT_FAILURE, return the Status associated with // an arbitrary subchannel, otherwise return OK. new EmptyPicker(aggStatus)); } else { // initialize the Picker to a random start index to ensure that a high frequency of Picker // churn does not skew subchannel selection. int startIndex = random.nextInt(activeList.size()); updateBalancingState(READY, new ReadyPicker(activeList, startIndex, stickinessState)); } } }
public class class_name { @SuppressWarnings("ReferenceEquality") private void updateBalancingState() { List<Subchannel> activeList = filterNonFailingSubchannels(getSubchannels()); if (activeList.isEmpty()) { // No READY subchannels, determine aggregate state and error status boolean isConnecting = false; Status aggStatus = EMPTY_OK; for (Subchannel subchannel : getSubchannels()) { ConnectivityStateInfo stateInfo = getSubchannelStateInfoRef(subchannel).value; // This subchannel IDLE is not because of channel IDLE_TIMEOUT, // in which case LB is already shutdown. // RRLB will request connection immediately on subchannel IDLE. if (stateInfo.getState() == CONNECTING || stateInfo.getState() == IDLE) { isConnecting = true; // depends on control dependency: [if], data = [none] } if (aggStatus == EMPTY_OK || !aggStatus.isOk()) { aggStatus = stateInfo.getStatus(); // depends on control dependency: [if], data = [none] } } updateBalancingState(isConnecting ? CONNECTING : TRANSIENT_FAILURE, // If all subchannels are TRANSIENT_FAILURE, return the Status associated with // an arbitrary subchannel, otherwise return OK. new EmptyPicker(aggStatus)); // depends on control dependency: [if], data = [none] } else { // initialize the Picker to a random start index to ensure that a high frequency of Picker // churn does not skew subchannel selection. int startIndex = random.nextInt(activeList.size()); updateBalancingState(READY, new ReadyPicker(activeList, startIndex, stickinessState)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Object superGet(Object id) { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[SUPER_GET], "id = " + id); } Object sess = super.get(id); if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { if (sess == null) { LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[SUPER_GET], "returned NULL"); } else { LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[SUPER_GET], "returned a SESSION: "); } } return sess; } }
public class class_name { public Object superGet(Object id) { if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[SUPER_GET], "id = " + id); // depends on control dependency: [if], data = [none] } Object sess = super.get(id); if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) { if (sess == null) { LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[SUPER_GET], "returned NULL"); // depends on control dependency: [if], data = [none] } else { LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[SUPER_GET], "returned a SESSION: "); // depends on control dependency: [if], data = [none] } } return sess; } }
public class class_name { public static Map.Entry<String,String> parseExportedVariable( String exportedVariable ) { int index = exportedVariable.indexOf( '=' ); String varName = exportedVariable, defaultValue = null; if( index > 0 ) { varName = exportedVariable.substring( 0, index ).trim(); defaultValue = exportedVariable.substring( index + 1 ).trim(); } return new AbstractMap.SimpleEntry<>( varName, defaultValue ); } }
public class class_name { public static Map.Entry<String,String> parseExportedVariable( String exportedVariable ) { int index = exportedVariable.indexOf( '=' ); String varName = exportedVariable, defaultValue = null; if( index > 0 ) { varName = exportedVariable.substring( 0, index ).trim(); // depends on control dependency: [if], data = [none] defaultValue = exportedVariable.substring( index + 1 ).trim(); // depends on control dependency: [if], data = [( index] } return new AbstractMap.SimpleEntry<>( varName, defaultValue ); } }
public class class_name { public <T> T convertFromString(Class<T> cls, String str) { if (str == null) { return null; } StringConverter<T> conv = findConverter(cls); return conv.convertFromString(cls, str); } }
public class class_name { public <T> T convertFromString(Class<T> cls, String str) { if (str == null) { return null; // depends on control dependency: [if], data = [none] } StringConverter<T> conv = findConverter(cls); return conv.convertFromString(cls, str); } }
public class class_name { public FacesConfigRedirectRedirectParamType<FacesConfigRedirectType<T>> getOrCreateRedirectParam() { List<Node> nodeList = childNode.get("redirect-param"); if (nodeList != null && nodeList.size() > 0) { return new FacesConfigRedirectRedirectParamTypeImpl<FacesConfigRedirectType<T>>(this, "redirect-param", childNode, nodeList.get(0)); } return createRedirectParam(); } }
public class class_name { public FacesConfigRedirectRedirectParamType<FacesConfigRedirectType<T>> getOrCreateRedirectParam() { List<Node> nodeList = childNode.get("redirect-param"); if (nodeList != null && nodeList.size() > 0) { return new FacesConfigRedirectRedirectParamTypeImpl<FacesConfigRedirectType<T>>(this, "redirect-param", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createRedirectParam(); } }
public class class_name { @Override public void verify(Document d) throws SymbolWarning, IndexingFailure, ResourceDownloadError { final List<NamespaceSyntaxWarning> exceptions = new ArrayList<NamespaceSyntaxWarning>(); // open document namespaces if necessary for (Namespace ns : d.getAllNamespaces()) { String resourceLocation = ns.getResourceLocation(); synchronized (resourceLocation) { if (!isOpen(resourceLocation)) { final String indexPath = doCompile(resourceLocation); openNamespace(resourceLocation, indexPath); } } } for (final Parameter p : d.getAllParameters()) { Namespace ns = p.getNamespace(); if (ns == null) { continue; } try { doVerify(p); } catch (NamespaceSyntaxWarning e) { exceptions.add(e); } } if (!exceptions.isEmpty()) { final String name = d.getName(); 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(Document d) throws SymbolWarning, IndexingFailure, ResourceDownloadError { final List<NamespaceSyntaxWarning> exceptions = new ArrayList<NamespaceSyntaxWarning>(); // open document namespaces if necessary for (Namespace ns : d.getAllNamespaces()) { String resourceLocation = ns.getResourceLocation(); synchronized (resourceLocation) { if (!isOpen(resourceLocation)) { final String indexPath = doCompile(resourceLocation); openNamespace(resourceLocation, indexPath); // depends on control dependency: [if], data = [none] } } } for (final Parameter p : d.getAllParameters()) { Namespace ns = p.getNamespace(); if (ns == null) { continue; } try { doVerify(p); } catch (NamespaceSyntaxWarning e) { exceptions.add(e); } } if (!exceptions.isEmpty()) { final String name = d.getName(); final String fmt = INVALID_SYMBOLS; final String msg = format(fmt, exceptions.size()); throw new SymbolWarning(name, msg, exceptions); } } }
public class class_name { @SuppressWarnings("unchecked") public static <T> void bindFactory(final AbstractBinder binder, final Injector injector, final Class<?> type, final boolean hkManaged, final boolean singleton) { // resolve Factory<T> actual type to bind properly final Class<T> res = (Class<T>) GenericsResolver.resolve(type).type(Supplier.class).generic(0); if (hkManaged) { optionalSingleton(singleton ? binder.bindFactory((Class<Supplier<T>>) type, Singleton.class).to(type).to(res) : binder.bindFactory((Class<Supplier<T>>) type).to(type).to(res), singleton); } else { binder.bindFactory(new LazyGuiceFactory(injector, type)).to(res); // binding factory type to be able to autowire factory by name optionalSingleton(binder.bindFactory(new GuiceComponentFactory<>(injector, type)).to(type), singleton); } } }
public class class_name { @SuppressWarnings("unchecked") public static <T> void bindFactory(final AbstractBinder binder, final Injector injector, final Class<?> type, final boolean hkManaged, final boolean singleton) { // resolve Factory<T> actual type to bind properly final Class<T> res = (Class<T>) GenericsResolver.resolve(type).type(Supplier.class).generic(0); if (hkManaged) { optionalSingleton(singleton ? binder.bindFactory((Class<Supplier<T>>) type, Singleton.class).to(type).to(res) : binder.bindFactory((Class<Supplier<T>>) type).to(type).to(res), singleton); // depends on control dependency: [if], data = [none] } else { binder.bindFactory(new LazyGuiceFactory(injector, type)).to(res); // depends on control dependency: [if], data = [none] // binding factory type to be able to autowire factory by name optionalSingleton(binder.bindFactory(new GuiceComponentFactory<>(injector, type)).to(type), singleton); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static Feature parseLine(String s) { //FIXME update to use regex split on tabs //FIXME better errors on parse failures String[] line = p.split(s); String seqname =line[0].trim(); String source =line[1].trim(); String type =line[2].trim(); String locStart =line[3].trim(); String locEnd =line[4].trim(); Double score; try { score = Double.parseDouble(line[5].trim()); } catch (Exception e) { score = 0.0; } char strand = line[6].trim().charAt(0); //added by scooter willis to deal with glimmer predictions that //have the start after the end but is a negative strand int locationStart = Integer.parseInt(locStart); int locationEnd = Integer.parseInt(locEnd); if(locationStart > locationEnd){ int temp = locationStart; locationStart = locationEnd; locationEnd = temp; } Location location = Location.fromBio(locationStart, locationEnd, strand); assert (strand == '-') == location.isNegative(); int frame; try { frame = Integer.parseInt(line[7].trim()); } catch (Exception e) { frame = -1; } String attributes=line[8]; /* //grab everything until end of line (or # comment) start = end + 1; end = s.indexOf('#', start); String attributes = null; if (end < 0) { attributes = new String(s.substring(start)); } else { attributes = new String(s.substring(start, end)); } */ return new Feature(seqname, source, type, location, score, frame, attributes.split("#")[0]); } }
public class class_name { private static Feature parseLine(String s) { //FIXME update to use regex split on tabs //FIXME better errors on parse failures String[] line = p.split(s); String seqname =line[0].trim(); String source =line[1].trim(); String type =line[2].trim(); String locStart =line[3].trim(); String locEnd =line[4].trim(); Double score; try { score = Double.parseDouble(line[5].trim()); // depends on control dependency: [try], data = [none] } catch (Exception e) { score = 0.0; } // depends on control dependency: [catch], data = [none] char strand = line[6].trim().charAt(0); //added by scooter willis to deal with glimmer predictions that //have the start after the end but is a negative strand int locationStart = Integer.parseInt(locStart); int locationEnd = Integer.parseInt(locEnd); if(locationStart > locationEnd){ int temp = locationStart; locationStart = locationEnd; // depends on control dependency: [if], data = [none] locationEnd = temp; // depends on control dependency: [if], data = [none] } Location location = Location.fromBio(locationStart, locationEnd, strand); assert (strand == '-') == location.isNegative(); int frame; try { frame = Integer.parseInt(line[7].trim()); // depends on control dependency: [try], data = [none] } catch (Exception e) { frame = -1; } // depends on control dependency: [catch], data = [none] String attributes=line[8]; /* //grab everything until end of line (or # comment) start = end + 1; end = s.indexOf('#', start); String attributes = null; if (end < 0) { attributes = new String(s.substring(start)); } else { attributes = new String(s.substring(start, end)); } */ return new Feature(seqname, source, type, location, score, frame, attributes.split("#")[0]); } }
public class class_name { private static void addAllInterfaces(List<NetworkInterface> target, List<NetworkInterface> level) { if (!level.isEmpty()) { target.addAll(level); for (NetworkInterface intf : level) { addAllInterfaces(target, Collections.list(intf.getSubInterfaces())); } } } }
public class class_name { private static void addAllInterfaces(List<NetworkInterface> target, List<NetworkInterface> level) { if (!level.isEmpty()) { target.addAll(level); // depends on control dependency: [if], data = [none] for (NetworkInterface intf : level) { addAllInterfaces(target, Collections.list(intf.getSubInterfaces())); // depends on control dependency: [for], data = [intf] } } } }
public class class_name { protected Map<String, RequestResponsePact> getPacts(String fragment) { if (pacts == null) { pacts = new HashMap<>(); for (Method m: target.getClass().getMethods()) { if (JUnitTestSupport.conformsToSignature(m) && methodMatchesFragment(m, fragment)) { Pact pactAnnotation = m.getAnnotation(Pact.class); if (StringUtils.isEmpty(pactAnnotation.provider()) || provider.equals(pactAnnotation.provider())) { PactDslWithProvider dslBuilder = ConsumerPactBuilder.consumer(pactAnnotation.consumer()) .hasPactWith(provider); updateAnyDefaultValues(dslBuilder); try { RequestResponsePact pact = (RequestResponsePact) m.invoke(target, dslBuilder); pacts.put(provider, pact); } catch (Exception e) { throw new RuntimeException("Failed to invoke pact method", e); } } } } } return pacts; } }
public class class_name { protected Map<String, RequestResponsePact> getPacts(String fragment) { if (pacts == null) { pacts = new HashMap<>(); // depends on control dependency: [if], data = [none] for (Method m: target.getClass().getMethods()) { if (JUnitTestSupport.conformsToSignature(m) && methodMatchesFragment(m, fragment)) { Pact pactAnnotation = m.getAnnotation(Pact.class); if (StringUtils.isEmpty(pactAnnotation.provider()) || provider.equals(pactAnnotation.provider())) { PactDslWithProvider dslBuilder = ConsumerPactBuilder.consumer(pactAnnotation.consumer()) .hasPactWith(provider); updateAnyDefaultValues(dslBuilder); // depends on control dependency: [if], data = [none] try { RequestResponsePact pact = (RequestResponsePact) m.invoke(target, dslBuilder); pacts.put(provider, pact); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException("Failed to invoke pact method", e); } // depends on control dependency: [catch], data = [none] } } } } return pacts; } }
public class class_name { @Override public Object[][] getDataByKeys(String[] keys) { logger.entering(Arrays.toString(keys)); if (null == resource.getCls()) { resource.setCls(KeyValueMap.class); } Object[][] objectArray; try { JAXBContext context = JAXBContext.newInstance(resource.getCls()); Unmarshaller unmarshaller = context.createUnmarshaller(); StreamSource xmlStreamSource = new StreamSource(resource.getInputStream()); Map<String, KeyValuePair> keyValueItems = unmarshaller .unmarshal(xmlStreamSource, KeyValueMap.class).getValue().getMap(); objectArray = DataProviderHelper.getDataByKeys(keyValueItems, keys); } catch (JAXBException excp) { logger.exiting(excp.getMessage()); throw new DataProviderException("Error unmarshalling XML file.", excp); } // Passing no arguments to exiting() because implementation to print 2D array could be highly recursive. logger.exiting(); return objectArray; } }
public class class_name { @Override public Object[][] getDataByKeys(String[] keys) { logger.entering(Arrays.toString(keys)); if (null == resource.getCls()) { resource.setCls(KeyValueMap.class); // depends on control dependency: [if], data = [none] } Object[][] objectArray; try { JAXBContext context = JAXBContext.newInstance(resource.getCls()); Unmarshaller unmarshaller = context.createUnmarshaller(); StreamSource xmlStreamSource = new StreamSource(resource.getInputStream()); Map<String, KeyValuePair> keyValueItems = unmarshaller .unmarshal(xmlStreamSource, KeyValueMap.class).getValue().getMap(); objectArray = DataProviderHelper.getDataByKeys(keyValueItems, keys); // depends on control dependency: [try], data = [none] } catch (JAXBException excp) { logger.exiting(excp.getMessage()); throw new DataProviderException("Error unmarshalling XML file.", excp); } // depends on control dependency: [catch], data = [none] // Passing no arguments to exiting() because implementation to print 2D array could be highly recursive. logger.exiting(); return objectArray; } }
public class class_name { public static void plotCharts(List<Chart> charts){ int numRows =1; int numCols =1; if(charts.size()>1){ numRows = (int) Math.ceil(charts.size()/2.0); numCols = 2; } final JFrame frame = new JFrame(""); frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); frame.getContentPane().setLayout(new GridLayout(numRows, numCols)); for (Chart chart : charts) { if (chart != null) { JPanel chartPanel = new XChartPanel(chart); frame.add(chartPanel); } else { JPanel chartPanel = new JPanel(); frame.getContentPane().add(chartPanel); } } // Display the window. frame.pack(); frame.setVisible(true); } }
public class class_name { public static void plotCharts(List<Chart> charts){ int numRows =1; int numCols =1; if(charts.size()>1){ numRows = (int) Math.ceil(charts.size()/2.0); // depends on control dependency: [if], data = [(charts.size()] numCols = 2; // depends on control dependency: [if], data = [none] } final JFrame frame = new JFrame(""); frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); frame.getContentPane().setLayout(new GridLayout(numRows, numCols)); for (Chart chart : charts) { if (chart != null) { JPanel chartPanel = new XChartPanel(chart); frame.add(chartPanel); // depends on control dependency: [if], data = [(chart] } else { JPanel chartPanel = new JPanel(); frame.getContentPane().add(chartPanel); // depends on control dependency: [if], data = [(chart] } } // Display the window. frame.pack(); frame.setVisible(true); } }
public class class_name { private File findBuildFile(final String start, final String suffix) { if (args.msgOutputLevel >= Project.MSG_INFO) { System.out.println("Searching for " + suffix + " ..."); } File parent = new File(new File(start).getAbsolutePath()); File file = new File(parent, suffix); // check if the target file exists in the current directory while (!file.exists()) { // change to parent directory parent = getParentFile(parent); // if parent is null, then we are at the root of the fs, // complain that we can't find the build file. if (parent == null) { return null; } // refresh our file handle file = new File(parent, suffix); } return file; } }
public class class_name { private File findBuildFile(final String start, final String suffix) { if (args.msgOutputLevel >= Project.MSG_INFO) { System.out.println("Searching for " + suffix + " ..."); // depends on control dependency: [if], data = [none] } File parent = new File(new File(start).getAbsolutePath()); File file = new File(parent, suffix); // check if the target file exists in the current directory while (!file.exists()) { // change to parent directory parent = getParentFile(parent); // depends on control dependency: [while], data = [none] // if parent is null, then we are at the root of the fs, // complain that we can't find the build file. if (parent == null) { return null; // depends on control dependency: [if], data = [none] } // refresh our file handle file = new File(parent, suffix); // depends on control dependency: [while], data = [none] } return file; } }
public class class_name { @Override public EClass getIfcSubContractResource() { if (ifcSubContractResourceEClass == null) { ifcSubContractResourceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(668); } return ifcSubContractResourceEClass; } }
public class class_name { @Override public EClass getIfcSubContractResource() { if (ifcSubContractResourceEClass == null) { ifcSubContractResourceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(668); // depends on control dependency: [if], data = [none] } return ifcSubContractResourceEClass; } }
public class class_name { public Credentials getCredentials() { if (!Utils.isEmpty(tenant) || !Utils.isEmpty(user)) { return new Credentials(tenant, user, password); } return null; } }
public class class_name { public Credentials getCredentials() { if (!Utils.isEmpty(tenant) || !Utils.isEmpty(user)) { return new Credentials(tenant, user, password); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public String getEditorLanguage() { String testLocale = getLocale().toString(); if (getCms().existsResource(VFS_PATH_EDITOR + "js/lang-" + testLocale + ".js")) { return testLocale; } return Locale.ENGLISH.toString(); } }
public class class_name { public String getEditorLanguage() { String testLocale = getLocale().toString(); if (getCms().existsResource(VFS_PATH_EDITOR + "js/lang-" + testLocale + ".js")) { return testLocale; // depends on control dependency: [if], data = [none] } return Locale.ENGLISH.toString(); } }
public class class_name { Response serveFile(String uri, Map<String, String> header, File file, String mime) { Response res; try { // Calculate etag String etag = Integer.toHexString((file.getAbsolutePath() + file.lastModified() + "" + file.length()).hashCode()); // Support (simple) skipping: long startFrom = 0; long endAt = -1; String range = header.get("range"); if (range != null) { if (range.startsWith("bytes=")) { range = range.substring("bytes=".length()); int minus = range.indexOf('-'); try { if (minus > 0) { startFrom = Long.parseLong(range.substring(0, minus)); endAt = Long.parseLong(range.substring(minus + 1)); } } catch (NumberFormatException ignored) { } } } // get if-range header. If present, it must match etag or else we // should ignore the range request String ifRange = header.get("if-range"); boolean headerIfRangeMissingOrMatching = (ifRange == null || etag.equals(ifRange)); String ifNoneMatch = header.get("if-none-match"); boolean headerIfNoneMatchPresentAndMatching = ifNoneMatch != null && ("*".equals(ifNoneMatch) || ifNoneMatch.equals(etag)); // Change return code and add Content-Range header when skipping is // requested long fileLen = file.length(); if (headerIfRangeMissingOrMatching && range != null && startFrom >= 0 && startFrom < fileLen) { // range request that matches current etag // and the startFrom of the range is satisfiable if (headerIfNoneMatchPresentAndMatching) { // range request that matches current etag // and the startFrom of the range is satisfiable // would return range from file // respond with not-modified res = newFixedLengthResponse(Status.NOT_MODIFIED, mime, ""); res.addHeader("ETag", etag); } else { if (endAt < 0) { endAt = fileLen - 1; } long newLen = endAt - startFrom + 1; if (newLen < 0) { newLen = 0; } FileInputStream fis = new FileInputStream(file); fis.skip(startFrom); res = Response.newFixedLengthResponse(Status.PARTIAL_CONTENT, mime, fis, newLen); res.addHeader("Accept-Ranges", "bytes"); res.addHeader("Content-Length", "" + newLen); res.addHeader("Content-Range", "bytes " + startFrom + "-" + endAt + "/" + fileLen); res.addHeader("ETag", etag); } } else { if (headerIfRangeMissingOrMatching && range != null && startFrom >= fileLen) { // return the size of the file // 4xx responses are not trumped by if-none-match res = newFixedLengthResponse(Status.RANGE_NOT_SATISFIABLE, NanoHTTPD.MIME_PLAINTEXT, ""); res.addHeader("Content-Range", "bytes */" + fileLen); res.addHeader("ETag", etag); } else if (range == null && headerIfNoneMatchPresentAndMatching) { // full-file-fetch request // would return entire file // respond with not-modified res = newFixedLengthResponse(Status.NOT_MODIFIED, mime, ""); res.addHeader("ETag", etag); } else if (!headerIfRangeMissingOrMatching && headerIfNoneMatchPresentAndMatching) { // range request that doesn't match current etag // would return entire (different) file // respond with not-modified res = newFixedLengthResponse(Status.NOT_MODIFIED, mime, ""); res.addHeader("ETag", etag); } else { // supply the file res = newFixedFileResponse(file, mime); res.addHeader("Content-Length", "" + fileLen); res.addHeader("ETag", etag); } } } catch (IOException ioe) { res = getForbiddenResponse("Reading file failed."); } return res; } }
public class class_name { Response serveFile(String uri, Map<String, String> header, File file, String mime) { Response res; try { // Calculate etag String etag = Integer.toHexString((file.getAbsolutePath() + file.lastModified() + "" + file.length()).hashCode()); // Support (simple) skipping: long startFrom = 0; long endAt = -1; String range = header.get("range"); if (range != null) { if (range.startsWith("bytes=")) { range = range.substring("bytes=".length()); // depends on control dependency: [if], data = [none] int minus = range.indexOf('-'); try { if (minus > 0) { startFrom = Long.parseLong(range.substring(0, minus)); // depends on control dependency: [if], data = [none] endAt = Long.parseLong(range.substring(minus + 1)); // depends on control dependency: [if], data = [(minus] } } catch (NumberFormatException ignored) { } // depends on control dependency: [catch], data = [none] } } // get if-range header. If present, it must match etag or else we // should ignore the range request String ifRange = header.get("if-range"); boolean headerIfRangeMissingOrMatching = (ifRange == null || etag.equals(ifRange)); String ifNoneMatch = header.get("if-none-match"); boolean headerIfNoneMatchPresentAndMatching = ifNoneMatch != null && ("*".equals(ifNoneMatch) || ifNoneMatch.equals(etag)); // Change return code and add Content-Range header when skipping is // requested long fileLen = file.length(); if (headerIfRangeMissingOrMatching && range != null && startFrom >= 0 && startFrom < fileLen) { // range request that matches current etag // and the startFrom of the range is satisfiable if (headerIfNoneMatchPresentAndMatching) { // range request that matches current etag // and the startFrom of the range is satisfiable // would return range from file // respond with not-modified res = newFixedLengthResponse(Status.NOT_MODIFIED, mime, ""); // depends on control dependency: [if], data = [none] res.addHeader("ETag", etag); // depends on control dependency: [if], data = [none] } else { if (endAt < 0) { endAt = fileLen - 1; // depends on control dependency: [if], data = [none] } long newLen = endAt - startFrom + 1; if (newLen < 0) { newLen = 0; // depends on control dependency: [if], data = [none] } FileInputStream fis = new FileInputStream(file); fis.skip(startFrom); // depends on control dependency: [if], data = [none] res = Response.newFixedLengthResponse(Status.PARTIAL_CONTENT, mime, fis, newLen); // depends on control dependency: [if], data = [none] res.addHeader("Accept-Ranges", "bytes"); // depends on control dependency: [if], data = [none] res.addHeader("Content-Length", "" + newLen); // depends on control dependency: [if], data = [none] res.addHeader("Content-Range", "bytes " + startFrom + "-" + endAt + "/" + fileLen); // depends on control dependency: [if], data = [none] res.addHeader("ETag", etag); // depends on control dependency: [if], data = [none] } } else { if (headerIfRangeMissingOrMatching && range != null && startFrom >= fileLen) { // return the size of the file // 4xx responses are not trumped by if-none-match res = newFixedLengthResponse(Status.RANGE_NOT_SATISFIABLE, NanoHTTPD.MIME_PLAINTEXT, ""); // depends on control dependency: [if], data = [none] res.addHeader("Content-Range", "bytes */" + fileLen); // depends on control dependency: [if], data = [none] res.addHeader("ETag", etag); // depends on control dependency: [if], data = [none] } else if (range == null && headerIfNoneMatchPresentAndMatching) { // full-file-fetch request // would return entire file // respond with not-modified res = newFixedLengthResponse(Status.NOT_MODIFIED, mime, ""); // depends on control dependency: [if], data = [none] res.addHeader("ETag", etag); // depends on control dependency: [if], data = [none] } else if (!headerIfRangeMissingOrMatching && headerIfNoneMatchPresentAndMatching) { // range request that doesn't match current etag // would return entire (different) file // respond with not-modified res = newFixedLengthResponse(Status.NOT_MODIFIED, mime, ""); // depends on control dependency: [if], data = [none] res.addHeader("ETag", etag); // depends on control dependency: [if], data = [none] } else { // supply the file res = newFixedFileResponse(file, mime); // depends on control dependency: [if], data = [none] res.addHeader("Content-Length", "" + fileLen); // depends on control dependency: [if], data = [none] res.addHeader("ETag", etag); // depends on control dependency: [if], data = [none] } } } catch (IOException ioe) { res = getForbiddenResponse("Reading file failed."); } // depends on control dependency: [catch], data = [none] return res; } }
public class class_name { public static void relabel(GrayS32 input , int labels[] ) { if( BoofConcurrency.USE_CONCURRENT ) { ImplBinaryImageOps_MT.relabel(input, labels); } else { ImplBinaryImageOps.relabel(input, labels); } } }
public class class_name { public static void relabel(GrayS32 input , int labels[] ) { if( BoofConcurrency.USE_CONCURRENT ) { ImplBinaryImageOps_MT.relabel(input, labels); // depends on control dependency: [if], data = [none] } else { ImplBinaryImageOps.relabel(input, labels); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void onViewReleased(View releasedChild, float xVel, float yVel) { super.onViewReleased(releasedChild, xVel, yVel); if (draggableView.isDragViewAtBottom() && !draggableView.isDragViewAtRight()) { triggerOnReleaseActionsWhileHorizontalDrag(xVel); } else { triggerOnReleaseActionsWhileVerticalDrag(yVel); } } }
public class class_name { @Override public void onViewReleased(View releasedChild, float xVel, float yVel) { super.onViewReleased(releasedChild, xVel, yVel); if (draggableView.isDragViewAtBottom() && !draggableView.isDragViewAtRight()) { triggerOnReleaseActionsWhileHorizontalDrag(xVel); // depends on control dependency: [if], data = [none] } else { triggerOnReleaseActionsWhileVerticalDrag(yVel); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void removeByG_A_P(long groupId, boolean active, boolean primary) { for (CommerceWarehouse commerceWarehouse : findByG_A_P(groupId, active, primary, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceWarehouse); } } }
public class class_name { @Override public void removeByG_A_P(long groupId, boolean active, boolean primary) { for (CommerceWarehouse commerceWarehouse : findByG_A_P(groupId, active, primary, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceWarehouse); // depends on control dependency: [for], data = [commerceWarehouse] } } }
public class class_name { static public String blockContents(byte[] value) { if (null == value) { return null; } char[] data = new char[value.length]; for (int i = 0; i < data.length; i++) { data[i] = '*'; } return new String(data); } }
public class class_name { static public String blockContents(byte[] value) { if (null == value) { return null; // depends on control dependency: [if], data = [none] } char[] data = new char[value.length]; for (int i = 0; i < data.length; i++) { data[i] = '*'; // depends on control dependency: [for], data = [i] } return new String(data); } }
public class class_name { public static <I extends ScoreIter> XYCurve materializeROC(Predicate<? super I> predicate, I iter) { int poscnt = 0, negcnt = 0; XYCurve curve = new XYCurve("False Positive Rate", "True Positive Rate"); // start in bottom left curve.add(0.0, 0.0); while(iter.valid()) { // positive or negative match? do { if(predicate.test(iter)) { ++poscnt; } else { ++negcnt; } iter.advance(); } // Loop while tied: while(iter.valid() && iter.tiedToPrevious()); // Add a new point. curve.addAndSimplify(negcnt, poscnt); } // Ensure we end up in the top right corner. // Simplification will skip this if we already were. curve.addAndSimplify(negcnt, poscnt); curve.rescale(1. / negcnt, 1. / poscnt); return curve; } }
public class class_name { public static <I extends ScoreIter> XYCurve materializeROC(Predicate<? super I> predicate, I iter) { int poscnt = 0, negcnt = 0; XYCurve curve = new XYCurve("False Positive Rate", "True Positive Rate"); // start in bottom left curve.add(0.0, 0.0); while(iter.valid()) { // positive or negative match? do { if(predicate.test(iter)) { ++poscnt; // depends on control dependency: [if], data = [none] } else { ++negcnt; // depends on control dependency: [if], data = [none] } iter.advance(); } // Loop while tied: while(iter.valid() && iter.tiedToPrevious()); // Add a new point. curve.addAndSimplify(negcnt, poscnt); // depends on control dependency: [while], data = [none] } // Ensure we end up in the top right corner. // Simplification will skip this if we already were. curve.addAndSimplify(negcnt, poscnt); curve.rescale(1. / negcnt, 1. / poscnt); return curve; } }
public class class_name { public ServletMappingType<WebFragmentType<T>> getOrCreateServletMapping() { List<Node> nodeList = childNode.get("servlet-mapping"); if (nodeList != null && nodeList.size() > 0) { return new ServletMappingTypeImpl<WebFragmentType<T>>(this, "servlet-mapping", childNode, nodeList.get(0)); } return createServletMapping(); } }
public class class_name { public ServletMappingType<WebFragmentType<T>> getOrCreateServletMapping() { List<Node> nodeList = childNode.get("servlet-mapping"); if (nodeList != null && nodeList.size() > 0) { return new ServletMappingTypeImpl<WebFragmentType<T>>(this, "servlet-mapping", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createServletMapping(); } }
public class class_name { protected void invokeCall(RTMPConnection conn, IServiceCall call) { final IScope scope = conn.getScope(); if (scope != null) { if (scope.hasHandler()) { final IScopeHandler handler = scope.getHandler(); log.debug("Scope: {} handler: {}", scope, handler); if (!handler.serviceCall(conn, call)) { // XXX: What to do here? Return an error? log.warn("Scope: {} handler failed on service call", scope.getName(), new Exception("Service call failed")); return; } } final IContext context = scope.getContext(); log.debug("Context: {}", context); context.getServiceInvoker().invoke(call, scope); } else { log.warn("Scope was null for invoke: {} connection state: {}", call.getServiceMethodName(), conn.getStateCode()); } } }
public class class_name { protected void invokeCall(RTMPConnection conn, IServiceCall call) { final IScope scope = conn.getScope(); if (scope != null) { if (scope.hasHandler()) { final IScopeHandler handler = scope.getHandler(); log.debug("Scope: {} handler: {}", scope, handler); // depends on control dependency: [if], data = [none] if (!handler.serviceCall(conn, call)) { // XXX: What to do here? Return an error? log.warn("Scope: {} handler failed on service call", scope.getName(), new Exception("Service call failed")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } final IContext context = scope.getContext(); log.debug("Context: {}", context); // depends on control dependency: [if], data = [none] context.getServiceInvoker().invoke(call, scope); // depends on control dependency: [if], data = [none] } else { log.warn("Scope was null for invoke: {} connection state: {}", call.getServiceMethodName(), conn.getStateCode()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ListVolumeRecoveryPointsResult withVolumeRecoveryPointInfos(VolumeRecoveryPointInfo... volumeRecoveryPointInfos) { if (this.volumeRecoveryPointInfos == null) { setVolumeRecoveryPointInfos(new com.amazonaws.internal.SdkInternalList<VolumeRecoveryPointInfo>(volumeRecoveryPointInfos.length)); } for (VolumeRecoveryPointInfo ele : volumeRecoveryPointInfos) { this.volumeRecoveryPointInfos.add(ele); } return this; } }
public class class_name { public ListVolumeRecoveryPointsResult withVolumeRecoveryPointInfos(VolumeRecoveryPointInfo... volumeRecoveryPointInfos) { if (this.volumeRecoveryPointInfos == null) { setVolumeRecoveryPointInfos(new com.amazonaws.internal.SdkInternalList<VolumeRecoveryPointInfo>(volumeRecoveryPointInfos.length)); // depends on control dependency: [if], data = [none] } for (VolumeRecoveryPointInfo ele : volumeRecoveryPointInfos) { this.volumeRecoveryPointInfos.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { protected boolean existsProperty(final PropertyExpression pexp, final boolean readMode, final ClassCodeVisitorSupport visitor) { super.visitPropertyExpression(pexp); String propertyName = pexp.getPropertyAsString(); if (propertyName == null) return false; Expression objectExpression = pexp.getObjectExpression(); final ClassNode objectExpressionType = getType(objectExpression); boolean staticOnlyAccess = isClassClassNodeWrappingConcreteType(objectExpressionType); if ("this".equals(propertyName) && staticOnlyAccess) { // Outer.this for any level of nesting ClassNode outerNode = objectExpressionType.getGenericsTypes()[0].getType(); List<ClassNode> candidates = typeCheckingContext.getEnclosingClassNodes(); ClassNode found = null; for (ClassNode current : candidates) { if (!current.isStaticClass() && current instanceof InnerClassNode && outerNode.equals(current.getOuterClass())) { found = current; break; } } if (found != null) { storeType(pexp, outerNode); return true; } } if (objectExpressionType.isArray() && "length".equals(pexp.getPropertyAsString())) { storeType(pexp, int_TYPE); if (visitor != null) { PropertyNode node = new PropertyNode("length", Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL, int_TYPE, objectExpressionType, null, null, null); visitor.visitProperty(node); } return true; } boolean foundGetterOrSetter = false; List<Receiver<String>> receivers = new LinkedList<Receiver<String>>(); List<Receiver<String>> owners = makeOwnerList(objectExpression); addReceivers(receivers, owners, pexp.isImplicitThis()); String capName = capitalize(propertyName); boolean isAttributeExpression = pexp instanceof AttributeExpression; HashSet<ClassNode> handledNodes = new HashSet<ClassNode>(); for (Receiver<String> receiver : receivers) { ClassNode testClass = receiver.getType(); LinkedList<ClassNode> queue = new LinkedList<ClassNode>(); queue.add(testClass); if (isPrimitiveType(testClass)) { queue.add(getWrapper(testClass)); } while (!queue.isEmpty()) { ClassNode current = queue.removeFirst(); if (handledNodes.contains(current)) continue; handledNodes.add(current); Set<ClassNode> allInterfaces = current.getAllInterfaces(); for (ClassNode intf : allInterfaces) { //TODO: apply right generics here! queue.add(GenericsUtils.parameterizeType(current, intf)); } // in case of a lookup on Class we look for instance methods on Class // as well, since in case of a static property access we have the class // itself in the list of receivers already; boolean staticOnly; if (isClassClassNodeWrappingConcreteType(current)) { staticOnly = false; } else { staticOnly = staticOnlyAccess; } FieldNode field = current.getDeclaredField(propertyName); field = allowStaticAccessToMember(field, staticOnly); if (storeField(field, isAttributeExpression, pexp, current, visitor, receiver.getData(), !readMode)) return true; boolean isThisExpression = objectExpression instanceof VariableExpression && ((VariableExpression) objectExpression).isThisExpression() && objectExpressionType.equals(current); if (storeField(field, isThisExpression, pexp, receiver.getType(), visitor, receiver.getData(), !readMode)) return true; MethodNode getter = findGetter(current, "get" + capName, pexp.isImplicitThis()); getter = allowStaticAccessToMember(getter, staticOnly); if (getter == null) getter = findGetter(current, "is" + capName, pexp.isImplicitThis()); getter = allowStaticAccessToMember(getter, staticOnly); final String setterName = "set" + capName; List<MethodNode> setters = findSetters(current, setterName, false); setters = allowStaticAccessToMember(setters, staticOnly); // TODO: remove this visit // need to visit even if we only look for a setters for compatibility if (visitor != null && getter != null) visitor.visitMethod(getter); PropertyNode propertyNode = current.getProperty(propertyName); propertyNode = allowStaticAccessToMember(propertyNode, staticOnly); //prefer explicit getter or setter over property if receiver is not 'this' boolean checkGetterOrSetter = !isThisExpression || propertyNode == null; if (readMode && checkGetterOrSetter) { if (getter != null) { ClassNode cn = inferReturnTypeGenerics(current, getter, ArgumentListExpression.EMPTY_ARGUMENTS); storeInferredTypeForPropertyExpression(pexp, cn); storeTargetMethod(pexp, getter); pexp.removeNodeMetaData(StaticTypesMarker.READONLY_PROPERTY); String delegationData = receiver.getData(); if (delegationData != null) pexp.putNodeMetaData(StaticTypesMarker.IMPLICIT_RECEIVER, delegationData); return true; } } else if (!readMode && checkGetterOrSetter) { if (!setters.isEmpty()) { if (visitor != null) { if (field != null) { visitor.visitField(field); } else { for (MethodNode setter : setters) { ClassNode setterType = setter.getParameters()[0].getOriginType(); FieldNode virtual = new FieldNode(propertyName, 0, setterType, current, EmptyExpression.INSTANCE); visitor.visitField(virtual); } } } //TODO: apply generics on parameter[0]? // storeType(pexp, setter.getParameters()[0].getType()); SetterInfo info = new SetterInfo(current, setterName, setters); BinaryExpression enclosingBinaryExpression = typeCheckingContext.getEnclosingBinaryExpression(); if (enclosingBinaryExpression != null) { putSetterInfo(enclosingBinaryExpression.getLeftExpression(), info); } String delegationData = receiver.getData(); if (delegationData != null) { pexp.putNodeMetaData(StaticTypesMarker.IMPLICIT_RECEIVER, delegationData); } return true; } else if (getter != null && propertyNode == null) { pexp.putNodeMetaData(StaticTypesMarker.READONLY_PROPERTY, true); } } foundGetterOrSetter = foundGetterOrSetter || !setters.isEmpty() || getter != null; if (storeProperty(propertyNode, pexp, current, visitor, receiver.getData())) return true; if (storeField(field, true, pexp, current, visitor, receiver.getData(), !readMode)) return true; // if the property expression is an attribute expression (o.@attr), then // we stop now, otherwise we must check the parent class if (/*!isAttributeExpression && */current.getSuperClass() != null) { queue.add(current.getUnresolvedSuperClass()); } } // GROOVY-5568, the property may be defined by DGM List<ClassNode> dgmReceivers = new ArrayList<ClassNode>(2); dgmReceivers.add(testClass); if (isPrimitiveType(testClass)) dgmReceivers.add(getWrapper(testClass)); for (ClassNode dgmReceiver : dgmReceivers) { List<MethodNode> methods = findDGMMethodsByNameAndArguments(getTransformLoader(), dgmReceiver, "get" + capName, ClassNode.EMPTY_ARRAY); for (MethodNode m : findDGMMethodsByNameAndArguments(getTransformLoader(), dgmReceiver, "is" + capName, ClassNode.EMPTY_ARRAY)) { if (Boolean_TYPE.equals(getWrapper(m.getReturnType()))) methods.add(m); } if (!methods.isEmpty()) { List<MethodNode> methodNodes = chooseBestMethod(dgmReceiver, methods, ClassNode.EMPTY_ARRAY); if (methodNodes.size() == 1) { MethodNode getter = methodNodes.get(0); if (visitor != null) { visitor.visitMethod(getter); } ClassNode cn = inferReturnTypeGenerics(dgmReceiver, getter, ArgumentListExpression.EMPTY_ARGUMENTS); storeInferredTypeForPropertyExpression(pexp, cn); storeTargetMethod(pexp, getter); return true; } } } } for (Receiver<String> receiver : receivers) { ClassNode testClass = receiver.getType(); ClassNode propertyType = getTypeForMapPropertyExpression(testClass, objectExpressionType, pexp); if (propertyType == null) propertyType = getTypeForListPropertyExpression(testClass, objectExpressionType, pexp); if (propertyType == null) propertyType = getTypeForSpreadExpression(testClass, objectExpressionType, pexp); if (propertyType == null) continue; if (visitor != null) { // todo : type inference on maps and lists, if possible PropertyNode node = new PropertyNode(propertyName, Opcodes.ACC_PUBLIC, propertyType, receiver.getType(), null, null, null); node.setDeclaringClass(receiver.getType()); visitor.visitProperty(node); } storeType(pexp, propertyType); String delegationData = receiver.getData(); if (delegationData != null) pexp.putNodeMetaData(StaticTypesMarker.IMPLICIT_RECEIVER, delegationData); return true; } return foundGetterOrSetter; } }
public class class_name { protected boolean existsProperty(final PropertyExpression pexp, final boolean readMode, final ClassCodeVisitorSupport visitor) { super.visitPropertyExpression(pexp); String propertyName = pexp.getPropertyAsString(); if (propertyName == null) return false; Expression objectExpression = pexp.getObjectExpression(); final ClassNode objectExpressionType = getType(objectExpression); boolean staticOnlyAccess = isClassClassNodeWrappingConcreteType(objectExpressionType); if ("this".equals(propertyName) && staticOnlyAccess) { // Outer.this for any level of nesting ClassNode outerNode = objectExpressionType.getGenericsTypes()[0].getType(); List<ClassNode> candidates = typeCheckingContext.getEnclosingClassNodes(); ClassNode found = null; for (ClassNode current : candidates) { if (!current.isStaticClass() && current instanceof InnerClassNode && outerNode.equals(current.getOuterClass())) { found = current; // depends on control dependency: [if], data = [none] break; } } if (found != null) { storeType(pexp, outerNode); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } if (objectExpressionType.isArray() && "length".equals(pexp.getPropertyAsString())) { storeType(pexp, int_TYPE); // depends on control dependency: [if], data = [none] if (visitor != null) { PropertyNode node = new PropertyNode("length", Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL, int_TYPE, objectExpressionType, null, null, null); visitor.visitProperty(node); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } boolean foundGetterOrSetter = false; List<Receiver<String>> receivers = new LinkedList<Receiver<String>>(); List<Receiver<String>> owners = makeOwnerList(objectExpression); addReceivers(receivers, owners, pexp.isImplicitThis()); String capName = capitalize(propertyName); boolean isAttributeExpression = pexp instanceof AttributeExpression; HashSet<ClassNode> handledNodes = new HashSet<ClassNode>(); for (Receiver<String> receiver : receivers) { ClassNode testClass = receiver.getType(); LinkedList<ClassNode> queue = new LinkedList<ClassNode>(); queue.add(testClass); // depends on control dependency: [for], data = [none] if (isPrimitiveType(testClass)) { queue.add(getWrapper(testClass)); // depends on control dependency: [if], data = [none] } while (!queue.isEmpty()) { ClassNode current = queue.removeFirst(); if (handledNodes.contains(current)) continue; handledNodes.add(current); // depends on control dependency: [while], data = [none] Set<ClassNode> allInterfaces = current.getAllInterfaces(); for (ClassNode intf : allInterfaces) { //TODO: apply right generics here! queue.add(GenericsUtils.parameterizeType(current, intf)); // depends on control dependency: [for], data = [intf] } // in case of a lookup on Class we look for instance methods on Class // as well, since in case of a static property access we have the class // itself in the list of receivers already; boolean staticOnly; if (isClassClassNodeWrappingConcreteType(current)) { staticOnly = false; // depends on control dependency: [if], data = [none] } else { staticOnly = staticOnlyAccess; // depends on control dependency: [if], data = [none] } FieldNode field = current.getDeclaredField(propertyName); field = allowStaticAccessToMember(field, staticOnly); // depends on control dependency: [while], data = [none] if (storeField(field, isAttributeExpression, pexp, current, visitor, receiver.getData(), !readMode)) return true; boolean isThisExpression = objectExpression instanceof VariableExpression && ((VariableExpression) objectExpression).isThisExpression() && objectExpressionType.equals(current); if (storeField(field, isThisExpression, pexp, receiver.getType(), visitor, receiver.getData(), !readMode)) return true; MethodNode getter = findGetter(current, "get" + capName, pexp.isImplicitThis()); getter = allowStaticAccessToMember(getter, staticOnly); // depends on control dependency: [while], data = [none] if (getter == null) getter = findGetter(current, "is" + capName, pexp.isImplicitThis()); getter = allowStaticAccessToMember(getter, staticOnly); // depends on control dependency: [while], data = [none] final String setterName = "set" + capName; List<MethodNode> setters = findSetters(current, setterName, false); setters = allowStaticAccessToMember(setters, staticOnly); // depends on control dependency: [while], data = [none] // TODO: remove this visit // need to visit even if we only look for a setters for compatibility if (visitor != null && getter != null) visitor.visitMethod(getter); PropertyNode propertyNode = current.getProperty(propertyName); propertyNode = allowStaticAccessToMember(propertyNode, staticOnly); // depends on control dependency: [while], data = [none] //prefer explicit getter or setter over property if receiver is not 'this' boolean checkGetterOrSetter = !isThisExpression || propertyNode == null; if (readMode && checkGetterOrSetter) { if (getter != null) { ClassNode cn = inferReturnTypeGenerics(current, getter, ArgumentListExpression.EMPTY_ARGUMENTS); storeInferredTypeForPropertyExpression(pexp, cn); // depends on control dependency: [if], data = [none] storeTargetMethod(pexp, getter); // depends on control dependency: [if], data = [none] pexp.removeNodeMetaData(StaticTypesMarker.READONLY_PROPERTY); // depends on control dependency: [if], data = [none] String delegationData = receiver.getData(); if (delegationData != null) pexp.putNodeMetaData(StaticTypesMarker.IMPLICIT_RECEIVER, delegationData); return true; // depends on control dependency: [if], data = [none] } } else if (!readMode && checkGetterOrSetter) { if (!setters.isEmpty()) { if (visitor != null) { if (field != null) { visitor.visitField(field); // depends on control dependency: [if], data = [(field] } else { for (MethodNode setter : setters) { ClassNode setterType = setter.getParameters()[0].getOriginType(); FieldNode virtual = new FieldNode(propertyName, 0, setterType, current, EmptyExpression.INSTANCE); visitor.visitField(virtual); // depends on control dependency: [for], data = [none] } } } //TODO: apply generics on parameter[0]? // storeType(pexp, setter.getParameters()[0].getType()); SetterInfo info = new SetterInfo(current, setterName, setters); BinaryExpression enclosingBinaryExpression = typeCheckingContext.getEnclosingBinaryExpression(); if (enclosingBinaryExpression != null) { putSetterInfo(enclosingBinaryExpression.getLeftExpression(), info); // depends on control dependency: [if], data = [(enclosingBinaryExpression] } String delegationData = receiver.getData(); if (delegationData != null) { pexp.putNodeMetaData(StaticTypesMarker.IMPLICIT_RECEIVER, delegationData); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } else if (getter != null && propertyNode == null) { pexp.putNodeMetaData(StaticTypesMarker.READONLY_PROPERTY, true); // depends on control dependency: [if], data = [none] } } foundGetterOrSetter = foundGetterOrSetter || !setters.isEmpty() || getter != null; // depends on control dependency: [while], data = [none] if (storeProperty(propertyNode, pexp, current, visitor, receiver.getData())) return true; if (storeField(field, true, pexp, current, visitor, receiver.getData(), !readMode)) return true; // if the property expression is an attribute expression (o.@attr), then // we stop now, otherwise we must check the parent class if (/*!isAttributeExpression && */current.getSuperClass() != null) { queue.add(current.getUnresolvedSuperClass()); // depends on control dependency: [if], data = [none] } } // GROOVY-5568, the property may be defined by DGM List<ClassNode> dgmReceivers = new ArrayList<ClassNode>(2); dgmReceivers.add(testClass); // depends on control dependency: [for], data = [none] if (isPrimitiveType(testClass)) dgmReceivers.add(getWrapper(testClass)); for (ClassNode dgmReceiver : dgmReceivers) { List<MethodNode> methods = findDGMMethodsByNameAndArguments(getTransformLoader(), dgmReceiver, "get" + capName, ClassNode.EMPTY_ARRAY); for (MethodNode m : findDGMMethodsByNameAndArguments(getTransformLoader(), dgmReceiver, "is" + capName, ClassNode.EMPTY_ARRAY)) { if (Boolean_TYPE.equals(getWrapper(m.getReturnType()))) methods.add(m); } if (!methods.isEmpty()) { List<MethodNode> methodNodes = chooseBestMethod(dgmReceiver, methods, ClassNode.EMPTY_ARRAY); if (methodNodes.size() == 1) { MethodNode getter = methodNodes.get(0); if (visitor != null) { visitor.visitMethod(getter); // depends on control dependency: [if], data = [none] } ClassNode cn = inferReturnTypeGenerics(dgmReceiver, getter, ArgumentListExpression.EMPTY_ARGUMENTS); storeInferredTypeForPropertyExpression(pexp, cn); // depends on control dependency: [if], data = [none] storeTargetMethod(pexp, getter); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } } } } for (Receiver<String> receiver : receivers) { ClassNode testClass = receiver.getType(); ClassNode propertyType = getTypeForMapPropertyExpression(testClass, objectExpressionType, pexp); if (propertyType == null) propertyType = getTypeForListPropertyExpression(testClass, objectExpressionType, pexp); if (propertyType == null) propertyType = getTypeForSpreadExpression(testClass, objectExpressionType, pexp); if (propertyType == null) continue; if (visitor != null) { // todo : type inference on maps and lists, if possible PropertyNode node = new PropertyNode(propertyName, Opcodes.ACC_PUBLIC, propertyType, receiver.getType(), null, null, null); node.setDeclaringClass(receiver.getType()); // depends on control dependency: [if], data = [none] visitor.visitProperty(node); // depends on control dependency: [if], data = [none] } storeType(pexp, propertyType); // depends on control dependency: [for], data = [none] String delegationData = receiver.getData(); if (delegationData != null) pexp.putNodeMetaData(StaticTypesMarker.IMPLICIT_RECEIVER, delegationData); return true; // depends on control dependency: [for], data = [none] } return foundGetterOrSetter; } }
public class class_name { @Override public boolean isValid(Date value) { if (value != null) { return value.before(new Date()); } return true; } }
public class class_name { @Override public boolean isValid(Date value) { if (value != null) { return value.before(new Date()); } // depends on control dependency: [if], data = [none] return true; } }
public class class_name { public EClass getIfcProductDefinitionShape() { if (ifcProductDefinitionShapeEClass == null) { ifcProductDefinitionShapeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(387); } return ifcProductDefinitionShapeEClass; } }
public class class_name { public EClass getIfcProductDefinitionShape() { if (ifcProductDefinitionShapeEClass == null) { ifcProductDefinitionShapeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(387); // depends on control dependency: [if], data = [none] } return ifcProductDefinitionShapeEClass; } }
public class class_name { private Set<String> getBucketsForPath(String path) { Set<String> result = Sets.newHashSet(); boolean foundBucket = false; for (int i = 0; i < m_bucketNames.size(); i++) { for (String bucketPath : m_bucketPathLists.get(i)) { if (CmsStringUtil.isPrefixPath(bucketPath, path)) { String bucketName = m_bucketNames.get(i); result.add(bucketName); if (!BUCKET_OTHER.equals(bucketName)) { foundBucket = true; } } } } if (!foundBucket) { result.add(BUCKET_OTHER); } return result; } }
public class class_name { private Set<String> getBucketsForPath(String path) { Set<String> result = Sets.newHashSet(); boolean foundBucket = false; for (int i = 0; i < m_bucketNames.size(); i++) { for (String bucketPath : m_bucketPathLists.get(i)) { if (CmsStringUtil.isPrefixPath(bucketPath, path)) { String bucketName = m_bucketNames.get(i); result.add(bucketName); // depends on control dependency: [if], data = [none] if (!BUCKET_OTHER.equals(bucketName)) { foundBucket = true; // depends on control dependency: [if], data = [none] } } } } if (!foundBucket) { result.add(BUCKET_OTHER); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public Object resolveExpression(String expression) { if (StringUtils.isBlank(expression)) { return null; } interpreter.getContext().addResolvedExpression(expression.trim()); try { String elExpression = EXPRESSION_START_TOKEN + expression.trim() + EXPRESSION_END_TOKEN; ValueExpression valueExp = expressionFactory.createValueExpression(elContext, elExpression, Object.class); Object result = valueExp.getValue(elContext); validateResult(result); return result; } catch (PropertyNotFoundException e) { interpreter.addError(new TemplateError(ErrorType.WARNING, ErrorReason.UNKNOWN, ErrorItem.PROPERTY, e.getMessage(), "", interpreter.getLineNumber(), interpreter.getPosition(), e, BasicTemplateErrorCategory.UNKNOWN, ImmutableMap.of("exception", e.getMessage()))); } catch (TreeBuilderException e) { int position = interpreter.getPosition() + e.getPosition(); // replacing the position in the string like this isn't great, but JUEL's parser does not allow passing in a starting position String errorMessage = StringUtils.substringAfter(e.getMessage(), "': ").replaceFirst("position [0-9]+", "position " + position); interpreter.addError(TemplateError.fromException(new TemplateSyntaxException(expression.substring(e.getPosition() - EXPRESSION_START_TOKEN.length()), "Error parsing '" + expression + "': " + errorMessage, interpreter.getLineNumber(), position, e))); } catch (ELException e) { if (e.getCause() != null && e.getCause() instanceof DeferredValueException) { throw (DeferredValueException) e.getCause(); } if (e.getCause() != null && e.getCause() instanceof TemplateSyntaxException) { interpreter.addError(TemplateError.fromException((TemplateSyntaxException) e.getCause())); } else if (e.getCause() != null && e.getCause() instanceof InvalidInputException) { interpreter.addError(TemplateError.fromInvalidInputException((InvalidInputException) e.getCause())); } else if (e.getCause() != null && e.getCause() instanceof InvalidArgumentException) { interpreter.addError(TemplateError.fromInvalidArgumentException((InvalidArgumentException) e.getCause())); } else { interpreter.addError(TemplateError.fromException(new TemplateSyntaxException(expression, e.getMessage(), interpreter.getLineNumber(), e))); } } catch (DisabledException e) { interpreter.addError(new TemplateError(ErrorType.FATAL, ErrorReason.DISABLED, ErrorItem.FUNCTION, e.getMessage(), expression, interpreter.getLineNumber(), interpreter.getPosition(), e)); } catch (UnknownTokenException e) { // Re-throw the exception because you only get this when the config failOnUnknownTokens is enabled. throw e; } catch (DeferredValueException e) { // Re-throw so that it can be handled in JinjavaInterpreter throw e; } catch (InvalidInputException e) { interpreter.addError(TemplateError.fromInvalidInputException(e)); } catch (InvalidArgumentException e) { interpreter.addError(TemplateError.fromInvalidArgumentException(e)); } catch (Exception e) { interpreter.addError(TemplateError.fromException(new InterpretException( String.format("Error resolving expression [%s]: " + getRootCauseMessage(e), expression), e, interpreter.getLineNumber(), interpreter.getPosition()))); } return null; } }
public class class_name { public Object resolveExpression(String expression) { if (StringUtils.isBlank(expression)) { return null; // depends on control dependency: [if], data = [none] } interpreter.getContext().addResolvedExpression(expression.trim()); try { String elExpression = EXPRESSION_START_TOKEN + expression.trim() + EXPRESSION_END_TOKEN; ValueExpression valueExp = expressionFactory.createValueExpression(elContext, elExpression, Object.class); Object result = valueExp.getValue(elContext); validateResult(result); // depends on control dependency: [try], data = [none] return result; // depends on control dependency: [try], data = [none] } catch (PropertyNotFoundException e) { interpreter.addError(new TemplateError(ErrorType.WARNING, ErrorReason.UNKNOWN, ErrorItem.PROPERTY, e.getMessage(), "", interpreter.getLineNumber(), interpreter.getPosition(), e, BasicTemplateErrorCategory.UNKNOWN, ImmutableMap.of("exception", e.getMessage()))); } catch (TreeBuilderException e) { // depends on control dependency: [catch], data = [none] int position = interpreter.getPosition() + e.getPosition(); // replacing the position in the string like this isn't great, but JUEL's parser does not allow passing in a starting position String errorMessage = StringUtils.substringAfter(e.getMessage(), "': ").replaceFirst("position [0-9]+", "position " + position); interpreter.addError(TemplateError.fromException(new TemplateSyntaxException(expression.substring(e.getPosition() - EXPRESSION_START_TOKEN.length()), "Error parsing '" + expression + "': " + errorMessage, interpreter.getLineNumber(), position, e))); } // depends on control dependency: [catch], data = [none] catch (ELException e) { if (e.getCause() != null && e.getCause() instanceof DeferredValueException) { throw (DeferredValueException) e.getCause(); } if (e.getCause() != null && e.getCause() instanceof TemplateSyntaxException) { interpreter.addError(TemplateError.fromException((TemplateSyntaxException) e.getCause())); // depends on control dependency: [if], data = [none] } else if (e.getCause() != null && e.getCause() instanceof InvalidInputException) { interpreter.addError(TemplateError.fromInvalidInputException((InvalidInputException) e.getCause())); // depends on control dependency: [if], data = [none] } else if (e.getCause() != null && e.getCause() instanceof InvalidArgumentException) { interpreter.addError(TemplateError.fromInvalidArgumentException((InvalidArgumentException) e.getCause())); // depends on control dependency: [if], data = [none] } else { interpreter.addError(TemplateError.fromException(new TemplateSyntaxException(expression, e.getMessage(), interpreter.getLineNumber(), e))); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] catch (DisabledException e) { interpreter.addError(new TemplateError(ErrorType.FATAL, ErrorReason.DISABLED, ErrorItem.FUNCTION, e.getMessage(), expression, interpreter.getLineNumber(), interpreter.getPosition(), e)); } catch (UnknownTokenException e) { // depends on control dependency: [catch], data = [none] // Re-throw the exception because you only get this when the config failOnUnknownTokens is enabled. throw e; } catch (DeferredValueException e) { // depends on control dependency: [catch], data = [none] // Re-throw so that it can be handled in JinjavaInterpreter throw e; } catch (InvalidInputException e) { // depends on control dependency: [catch], data = [none] interpreter.addError(TemplateError.fromInvalidInputException(e)); } catch (InvalidArgumentException e) { // depends on control dependency: [catch], data = [none] interpreter.addError(TemplateError.fromInvalidArgumentException(e)); } catch (Exception e) { // depends on control dependency: [catch], data = [none] interpreter.addError(TemplateError.fromException(new InterpretException( String.format("Error resolving expression [%s]: " + getRootCauseMessage(e), expression), e, interpreter.getLineNumber(), interpreter.getPosition()))); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { private void saveInitialChildState(FacesContext facesContext, UIComponent component) { if (component instanceof EditableValueHolder && !component.isTransient()) { String clientId = component.getClientId(facesContext); SavedState state = new SavedState(); initialChildState.put(clientId, state); state.populate((EditableValueHolder) component); } Iterator<UIComponent> iterator = component.getFacetsAndChildren(); while (iterator.hasNext()) { saveChildState(facesContext, iterator.next()); } } }
public class class_name { private void saveInitialChildState(FacesContext facesContext, UIComponent component) { if (component instanceof EditableValueHolder && !component.isTransient()) { String clientId = component.getClientId(facesContext); SavedState state = new SavedState(); initialChildState.put(clientId, state); // depends on control dependency: [if], data = [none] state.populate((EditableValueHolder) component); // depends on control dependency: [if], data = [none] } Iterator<UIComponent> iterator = component.getFacetsAndChildren(); while (iterator.hasNext()) { saveChildState(facesContext, iterator.next()); // depends on control dependency: [while], data = [none] } } }
public class class_name { private ArrayList<Tick> parseBinary(byte [] binaryPackets) { ArrayList<Tick> ticks = new ArrayList<Tick>(); ArrayList<byte[]> packets = splitPackets(binaryPackets); for (int i = 0; i < packets.size(); i++) { byte[] bin = packets.get(i); byte[] t = Arrays.copyOfRange(bin, 0, 4); int x = ByteBuffer.wrap(t).getInt(); //int token = x >> 8; int segment = x & 0xff; int dec1 = (segment == NseCD) ? 10000000 : 100; if(bin.length == 8) { Tick tick = getLtpQuote(bin, x, dec1); ticks.add(tick); }else if(bin.length == 28 || bin.length == 32) { Tick tick = getIndeciesData(bin, x); ticks.add(tick); }else if(bin.length == 44) { Tick tick = getQuoteData(bin, x, dec1); ticks.add(tick); } else if(bin.length == 184) { Tick tick = getQuoteData(bin, x, dec1); tick.setMode(modeFull); ticks.add(getFullData(bin, dec1, tick)); } } return ticks; } }
public class class_name { private ArrayList<Tick> parseBinary(byte [] binaryPackets) { ArrayList<Tick> ticks = new ArrayList<Tick>(); ArrayList<byte[]> packets = splitPackets(binaryPackets); for (int i = 0; i < packets.size(); i++) { byte[] bin = packets.get(i); byte[] t = Arrays.copyOfRange(bin, 0, 4); int x = ByteBuffer.wrap(t).getInt(); //int token = x >> 8; int segment = x & 0xff; int dec1 = (segment == NseCD) ? 10000000 : 100; if(bin.length == 8) { Tick tick = getLtpQuote(bin, x, dec1); ticks.add(tick); // depends on control dependency: [if], data = [none] }else if(bin.length == 28 || bin.length == 32) { Tick tick = getIndeciesData(bin, x); ticks.add(tick); // depends on control dependency: [if], data = [none] }else if(bin.length == 44) { Tick tick = getQuoteData(bin, x, dec1); ticks.add(tick); // depends on control dependency: [if], data = [none] } else if(bin.length == 184) { Tick tick = getQuoteData(bin, x, dec1); tick.setMode(modeFull); // depends on control dependency: [if], data = [none] ticks.add(getFullData(bin, dec1, tick)); // depends on control dependency: [if], data = [none] } } return ticks; } }
public class class_name { static String getAttributeValue(Element element, String name) { Attr attribute = element.getAttributeNode(name); if (attribute == null) { return null; } else { return attribute.getValue(); } } }
public class class_name { static String getAttributeValue(Element element, String name) { Attr attribute = element.getAttributeNode(name); if (attribute == null) { return null; // depends on control dependency: [if], data = [none] } else { return attribute.getValue(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Handler<AsyncResult<String>> createDeploymentHandler(final Message<JsonObject> message) { return new Handler<AsyncResult<String>>() { @Override public void handle(AsyncResult<String> result) { if (result.failed()) { message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage())); } else { addNewDeployment(result.result(), message.body(), new Handler<AsyncResult<String>>() { @Override public void handle(AsyncResult<String> result) { message.reply(new JsonObject().putString("status", "ok").putString("id", result.result())); } }); } } }; } }
public class class_name { private Handler<AsyncResult<String>> createDeploymentHandler(final Message<JsonObject> message) { return new Handler<AsyncResult<String>>() { @Override public void handle(AsyncResult<String> result) { if (result.failed()) { message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage())); // depends on control dependency: [if], data = [none] } else { addNewDeployment(result.result(), message.body(), new Handler<AsyncResult<String>>() { @Override public void handle(AsyncResult<String> result) { message.reply(new JsonObject().putString("status", "ok").putString("id", result.result())); } }); // depends on control dependency: [if], data = [none] } } }; } }
public class class_name { public static float[] getUnitCellAsArray(PDBCrystallographicInfo xtalInfo) { CrystalCell xtalCell = xtalInfo.getCrystalCell(); if(xtalCell==null){ return null; }else{ float[] inputUnitCell = new float[6]; inputUnitCell[0] = (float) xtalCell.getA(); inputUnitCell[1] = (float) xtalCell.getB(); inputUnitCell[2] = (float) xtalCell.getC(); inputUnitCell[3] = (float) xtalCell.getAlpha(); inputUnitCell[4] = (float) xtalCell.getBeta(); inputUnitCell[5] = (float) xtalCell.getGamma(); return inputUnitCell; } } }
public class class_name { public static float[] getUnitCellAsArray(PDBCrystallographicInfo xtalInfo) { CrystalCell xtalCell = xtalInfo.getCrystalCell(); if(xtalCell==null){ return null; // depends on control dependency: [if], data = [none] }else{ float[] inputUnitCell = new float[6]; inputUnitCell[0] = (float) xtalCell.getA(); // depends on control dependency: [if], data = [none] inputUnitCell[1] = (float) xtalCell.getB(); // depends on control dependency: [if], data = [none] inputUnitCell[2] = (float) xtalCell.getC(); // depends on control dependency: [if], data = [none] inputUnitCell[3] = (float) xtalCell.getAlpha(); // depends on control dependency: [if], data = [none] inputUnitCell[4] = (float) xtalCell.getBeta(); // depends on control dependency: [if], data = [none] inputUnitCell[5] = (float) xtalCell.getGamma(); // depends on control dependency: [if], data = [none] return inputUnitCell; // depends on control dependency: [if], data = [none] } } }
public class class_name { private int read() { int curByte = 0; try { curByte = rawData.get() & 0xFF; } catch (Exception e) { header.status = GifDecoder.STATUS_FORMAT_ERROR; } return curByte; } }
public class class_name { private int read() { int curByte = 0; try { curByte = rawData.get() & 0xFF; // depends on control dependency: [try], data = [none] } catch (Exception e) { header.status = GifDecoder.STATUS_FORMAT_ERROR; } // depends on control dependency: [catch], data = [none] return curByte; } }
public class class_name { public Object getInstance() { try { if (prototype) { return doGetInstance(); } else { synchronized (cache) { if (!cache.containsKey(type)) { cache.put(type, doGetInstance()); } return cache.get(type); } } } catch (IrohException e) { throw e; } catch (Exception e) { throw new FailedConstructionException(e); } } }
public class class_name { public Object getInstance() { try { if (prototype) { return doGetInstance(); // depends on control dependency: [if], data = [none] } else { synchronized (cache) { // depends on control dependency: [if], data = [none] if (!cache.containsKey(type)) { cache.put(type, doGetInstance()); // depends on control dependency: [if], data = [none] } return cache.get(type); } } } catch (IrohException e) { throw e; } catch (Exception e) { // depends on control dependency: [catch], data = [none] throw new FailedConstructionException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void process(final Resource resource, final Reader reader, final Writer writer) throws IOException { StopWatch stopWatch = null; if (isDebug()) { stopWatch = new StopWatch(); before(stopWatch); } try { super.process(resource, reader, writer); } finally { if (isDebug()) { after(stopWatch); } } } }
public class class_name { @Override public void process(final Resource resource, final Reader reader, final Writer writer) throws IOException { StopWatch stopWatch = null; if (isDebug()) { stopWatch = new StopWatch(); before(stopWatch); } try { super.process(resource, reader, writer); } finally { if (isDebug()) { after(stopWatch); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void setHandler(IScopeHandler handler) { log.debug("setHandler: {} on {}", handler, name); this.handler = handler; if (handler instanceof IScopeAware) { ((IScopeAware) handler).setScope(this); } } }
public class class_name { public void setHandler(IScopeHandler handler) { log.debug("setHandler: {} on {}", handler, name); this.handler = handler; if (handler instanceof IScopeAware) { ((IScopeAware) handler).setScope(this); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void start() { this.isLive = true; // This episode is now active. try { execute(); } catch (Exception e) { System.out.println("State start - exception: " + e); e.printStackTrace(); // TODO... what? } } }
public class class_name { public void start() { this.isLive = true; // This episode is now active. try { execute(); // depends on control dependency: [try], data = [none] } catch (Exception e) { System.out.println("State start - exception: " + e); e.printStackTrace(); // TODO... what? } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String extractMulti(Pattern pattern, CharSequence content, String template) { if (null == content || null == pattern || null == template) { return null; } //提取模板中的编号 final TreeSet<Integer> varNums = new TreeSet<>(new Comparator<Integer>() { @Override public int compare(Integer o1, Integer o2) { return ObjectUtil.compare(o2, o1); } }); final Matcher matcherForTemplate = PatternPool.GROUP_VAR.matcher(template); while (matcherForTemplate.find()) { varNums.add(Integer.parseInt(matcherForTemplate.group(1))); } final Matcher matcher = pattern.matcher(content); if (matcher.find()) { for (Integer group : varNums) { template = template.replace("$" + group, matcher.group(group)); } return template; } return null; } }
public class class_name { public static String extractMulti(Pattern pattern, CharSequence content, String template) { if (null == content || null == pattern || null == template) { return null; // depends on control dependency: [if], data = [none] } //提取模板中的编号 final TreeSet<Integer> varNums = new TreeSet<>(new Comparator<Integer>() { @Override public int compare(Integer o1, Integer o2) { return ObjectUtil.compare(o2, o1); } }); final Matcher matcherForTemplate = PatternPool.GROUP_VAR.matcher(template); while (matcherForTemplate.find()) { varNums.add(Integer.parseInt(matcherForTemplate.group(1))); // depends on control dependency: [while], data = [none] } final Matcher matcher = pattern.matcher(content); if (matcher.find()) { for (Integer group : varNums) { template = template.replace("$" + group, matcher.group(group)); // depends on control dependency: [for], data = [group] } return template; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { @Override public boolean canHandleData(IoBuffer data) { boolean result = false; if (data.limit() > 0) { // read the first byte and ensure its AVC / h.264 type result = ((data.get() & 0x0f) == VideoCodec.AVC.getId()); data.rewind(); } return result; } }
public class class_name { @Override public boolean canHandleData(IoBuffer data) { boolean result = false; if (data.limit() > 0) { // read the first byte and ensure its AVC / h.264 type result = ((data.get() & 0x0f) == VideoCodec.AVC.getId()); // depends on control dependency: [if], data = [none] data.rewind(); // depends on control dependency: [if], data = [none] } return result; } }