code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { Map<String, Map<String, Integer>> getRuntimeDependencies() { final Map<String, Set<CounterRequest>> methodsCalledByCallerBeans = getMethodsCalledByCallerBeans(); final Map<String, Map<String, Integer>> result = new HashMap<String, Map<String, Integer>>(); for (final Map.Entry<String, Set<CounterRequest>> entry : methodsCalledByCallerBeans .entrySet()) { final String callerBean = entry.getKey(); final Set<CounterRequest> childRequests = entry.getValue(); final Map<String, Integer> nbMethodsCalledByCalledBean = new HashMap<String, Integer>(); for (final CounterRequest childRequest : childRequests) { final String calledBean = getClassNameFromRequest(childRequest); if (callerBean.equals(calledBean)) { // si le bean est lui même, il peut s'appeler autant qu'il veut // ce n'est pas une dépendance continue; } Integer nbOfMethodCalls = nbMethodsCalledByCalledBean.get(calledBean); if (nbOfMethodCalls == null) { nbOfMethodCalls = 1; } else { // on compte le nombre de méthodes appelées et non le nombre d'exécutions nbOfMethodCalls = nbOfMethodCalls + 1; } nbMethodsCalledByCalledBean.put(calledBean, nbOfMethodCalls); } // methodsCalled peut être vide soit parce que childRequestsByBeans est vide // (il n'y a pas d'appels de méthodes pour ce bean, que des requêtes sql par exemple), // soit parce qu'il n'y a que des appels de méthodes vers le bean lui-même if (!nbMethodsCalledByCalledBean.isEmpty()) { result.put(callerBean, nbMethodsCalledByCalledBean); } } return result; } }
public class class_name { Map<String, Map<String, Integer>> getRuntimeDependencies() { final Map<String, Set<CounterRequest>> methodsCalledByCallerBeans = getMethodsCalledByCallerBeans(); final Map<String, Map<String, Integer>> result = new HashMap<String, Map<String, Integer>>(); for (final Map.Entry<String, Set<CounterRequest>> entry : methodsCalledByCallerBeans .entrySet()) { final String callerBean = entry.getKey(); final Set<CounterRequest> childRequests = entry.getValue(); final Map<String, Integer> nbMethodsCalledByCalledBean = new HashMap<String, Integer>(); for (final CounterRequest childRequest : childRequests) { final String calledBean = getClassNameFromRequest(childRequest); if (callerBean.equals(calledBean)) { // si le bean est lui même, il peut s'appeler autant qu'il veut // ce n'est pas une dépendance continue; } Integer nbOfMethodCalls = nbMethodsCalledByCalledBean.get(calledBean); if (nbOfMethodCalls == null) { nbOfMethodCalls = 1; // depends on control dependency: [if], data = [none] } else { // on compte le nombre de méthodes appelées et non le nombre d'exécutions nbOfMethodCalls = nbOfMethodCalls + 1; // depends on control dependency: [if], data = [none] } nbMethodsCalledByCalledBean.put(calledBean, nbOfMethodCalls); // depends on control dependency: [for], data = [none] } // methodsCalled peut être vide soit parce que childRequestsByBeans est vide // (il n'y a pas d'appels de méthodes pour ce bean, que des requêtes sql par exemple), // soit parce qu'il n'y a que des appels de méthodes vers le bean lui-même if (!nbMethodsCalledByCalledBean.isEmpty()) { result.put(callerBean, nbMethodsCalledByCalledBean); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { protected void commit() { ComboException ce = new ComboException(); for (ConnInfo cInfo : list) { try { // 提交事务 cInfo.conn.commit(); // 恢复旧的事务级别 if (cInfo.conn.getTransactionIsolation() != cInfo.oldLevel) cInfo.conn.setTransactionIsolation(cInfo.oldLevel); } catch (SQLException e) { ce.add(e); } } // 如果有一个数据源提交时发生异常,抛出 if (null != ce.getCause()) { throw ce; } } }
public class class_name { protected void commit() { ComboException ce = new ComboException(); for (ConnInfo cInfo : list) { try { // 提交事务 cInfo.conn.commit(); // depends on control dependency: [try], data = [none] // 恢复旧的事务级别 if (cInfo.conn.getTransactionIsolation() != cInfo.oldLevel) cInfo.conn.setTransactionIsolation(cInfo.oldLevel); } catch (SQLException e) { ce.add(e); } // depends on control dependency: [catch], data = [none] } // 如果有一个数据源提交时发生异常,抛出 if (null != ce.getCause()) { throw ce; } } }
public class class_name { void toJSONString(final Map<ReferenceEqualityKey<JSONReference>, CharSequence> jsonReferenceToId, final boolean includeNullValuedFields, final int depth, final int indentWidth, final StringBuilder buf) { final boolean prettyPrint = indentWidth > 0; final int n = items.size(); if (n == 0) { buf.append("[]"); } else { buf.append('['); if (prettyPrint) { buf.append('\n'); } for (int i = 0; i < n; i++) { final Object item = items.get(i); if (prettyPrint) { JSONUtils.indent(depth + 1, indentWidth, buf); } JSONSerializer.jsonValToJSONString(item, jsonReferenceToId, includeNullValuedFields, depth + 1, indentWidth, buf); if (i < n - 1) { buf.append(','); } if (prettyPrint) { buf.append('\n'); } } if (prettyPrint) { JSONUtils.indent(depth, indentWidth, buf); } buf.append(']'); } } }
public class class_name { void toJSONString(final Map<ReferenceEqualityKey<JSONReference>, CharSequence> jsonReferenceToId, final boolean includeNullValuedFields, final int depth, final int indentWidth, final StringBuilder buf) { final boolean prettyPrint = indentWidth > 0; final int n = items.size(); if (n == 0) { buf.append("[]"); // depends on control dependency: [if], data = [none] } else { buf.append('['); // depends on control dependency: [if], data = [none] if (prettyPrint) { buf.append('\n'); // depends on control dependency: [if], data = [none] } for (int i = 0; i < n; i++) { final Object item = items.get(i); if (prettyPrint) { JSONUtils.indent(depth + 1, indentWidth, buf); // depends on control dependency: [if], data = [none] } JSONSerializer.jsonValToJSONString(item, jsonReferenceToId, includeNullValuedFields, depth + 1, indentWidth, buf); // depends on control dependency: [for], data = [none] if (i < n - 1) { buf.append(','); // depends on control dependency: [if], data = [none] } if (prettyPrint) { buf.append('\n'); // depends on control dependency: [if], data = [none] } } if (prettyPrint) { JSONUtils.indent(depth, indentWidth, buf); // depends on control dependency: [if], data = [none] } buf.append(']'); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void assertJsonNodePresent(Object actual, String path) { if (nodeAbsent(actual, path, configuration)) { doFail("Node \"" + path + "\" is missing."); } } }
public class class_name { public static void assertJsonNodePresent(Object actual, String path) { if (nodeAbsent(actual, path, configuration)) { doFail("Node \"" + path + "\" is missing."); // depends on control dependency: [if], data = [none] } } }
public class class_name { public T getValue () { // if the value is still around and it's expired, clear it if (_value != null && System.currentTimeMillis() >= _expires) { _value = null; } // then return the value (which may be cleared to null by now) return _value; } }
public class class_name { public T getValue () { // if the value is still around and it's expired, clear it if (_value != null && System.currentTimeMillis() >= _expires) { _value = null; // depends on control dependency: [if], data = [none] } // then return the value (which may be cleared to null by now) return _value; } }
public class class_name { public void addBoth(BindingElement element) { if (element != null) { this.rtBindingElements.add(element); this.uiBindingElements.add(element); } } }
public class class_name { public void addBoth(BindingElement element) { if (element != null) { this.rtBindingElements.add(element); // depends on control dependency: [if], data = [(element] this.uiBindingElements.add(element); // depends on control dependency: [if], data = [(element] } } }
public class class_name { private void processRemarks(GanttDesignerRemark remark) { for (GanttDesignerRemark.Task remarkTask : remark.getTask()) { Integer id = remarkTask.getRow(); Task task = m_projectFile.getTaskByID(id); String notes = task.getNotes(); if (notes.isEmpty()) { notes = remarkTask.getContent(); } else { notes = notes + '\n' + remarkTask.getContent(); } task.setNotes(notes); } } }
public class class_name { private void processRemarks(GanttDesignerRemark remark) { for (GanttDesignerRemark.Task remarkTask : remark.getTask()) { Integer id = remarkTask.getRow(); Task task = m_projectFile.getTaskByID(id); String notes = task.getNotes(); if (notes.isEmpty()) { notes = remarkTask.getContent(); // depends on control dependency: [if], data = [none] } else { notes = notes + '\n' + remarkTask.getContent(); // depends on control dependency: [if], data = [none] } task.setNotes(notes); // depends on control dependency: [for], data = [none] } } }
public class class_name { protected final void printCommandLine(@Nonnull String[] cmd, @CheckForNull FilePath workDir) { StringBuilder buf = new StringBuilder(); if (workDir != null) { buf.append('['); if(showFullPath) buf.append(workDir.getRemote()); else buf.append(workDir.getRemote().replaceFirst("^.+[/\\\\]", "")); buf.append("] "); } buf.append('$'); for (String c : cmd) { buf.append(' '); if(c.indexOf(' ')>=0) { if(c.indexOf('"')>=0) buf.append('\'').append(c).append('\''); else buf.append('"').append(c).append('"'); } else buf.append(c); } listener.getLogger().println(buf.toString()); listener.getLogger().flush(); } }
public class class_name { protected final void printCommandLine(@Nonnull String[] cmd, @CheckForNull FilePath workDir) { StringBuilder buf = new StringBuilder(); if (workDir != null) { buf.append('['); // depends on control dependency: [if], data = [none] if(showFullPath) buf.append(workDir.getRemote()); else buf.append(workDir.getRemote().replaceFirst("^.+[/\\\\]", "")); buf.append("] "); // depends on control dependency: [if], data = [none] } buf.append('$'); for (String c : cmd) { buf.append(' '); // depends on control dependency: [for], data = [none] if(c.indexOf(' ')>=0) { if(c.indexOf('"')>=0) buf.append('\'').append(c).append('\''); else buf.append('"').append(c).append('"'); } else buf.append(c); } listener.getLogger().println(buf.toString()); listener.getLogger().flush(); } }
public class class_name { @Override public URL getPersistenceUnitRootUrl() { // Make one that is OSGi based, it relies on the 'location' property String loc = location; int n = loc.lastIndexOf('/'); if (n > 0) { loc = loc.substring(0, n); } if (loc.isEmpty()) { loc = "/"; } return sourceBundle.bundle.getResource(loc); } }
public class class_name { @Override public URL getPersistenceUnitRootUrl() { // Make one that is OSGi based, it relies on the 'location' property String loc = location; int n = loc.lastIndexOf('/'); if (n > 0) { loc = loc.substring(0, n); // depends on control dependency: [if], data = [none] } if (loc.isEmpty()) { loc = "/"; // depends on control dependency: [if], data = [none] } return sourceBundle.bundle.getResource(loc); } }
public class class_name { void leaveSafeMode(boolean checkForUpgrades) throws SafeModeException { writeLock(); try { if (!isInSafeMode()) { NameNode.stateChangeLog.info("STATE* Safe mode is already OFF."); return; } if (getDistributedUpgradeState()) { throw new SafeModeException("Distributed upgrade is in progress", safeMode); } safeMode.leave(checkForUpgrades); safeMode = null; } finally { writeUnlock(); } } }
public class class_name { void leaveSafeMode(boolean checkForUpgrades) throws SafeModeException { writeLock(); try { if (!isInSafeMode()) { NameNode.stateChangeLog.info("STATE* Safe mode is already OFF."); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (getDistributedUpgradeState()) { throw new SafeModeException("Distributed upgrade is in progress", safeMode); } safeMode.leave(checkForUpgrades); safeMode = null; } finally { writeUnlock(); } } }
public class class_name { public char[] getRawURIReference() { if (_fragment == null) { return _uri; } if (_uri == null) { return _fragment; } // if _uri != null && _fragment != null String uriReference = new String(_uri) + "#" + new String(_fragment); return uriReference.toCharArray(); } }
public class class_name { public char[] getRawURIReference() { if (_fragment == null) { return _uri; // depends on control dependency: [if], data = [none] } if (_uri == null) { return _fragment; // depends on control dependency: [if], data = [none] } // if _uri != null && _fragment != null String uriReference = new String(_uri) + "#" + new String(_fragment); return uriReference.toCharArray(); } }
public class class_name { public List<SecondaryTable<Entity<T>>> getAllSecondaryTable() { List<SecondaryTable<Entity<T>>> list = new ArrayList<SecondaryTable<Entity<T>>>(); List<Node> nodeList = childNode.get("secondary-table"); for(Node node: nodeList) { SecondaryTable<Entity<T>> type = new SecondaryTableImpl<Entity<T>>(this, "secondary-table", childNode, node); list.add(type); } return list; } }
public class class_name { public List<SecondaryTable<Entity<T>>> getAllSecondaryTable() { List<SecondaryTable<Entity<T>>> list = new ArrayList<SecondaryTable<Entity<T>>>(); List<Node> nodeList = childNode.get("secondary-table"); for(Node node: nodeList) { SecondaryTable<Entity<T>> type = new SecondaryTableImpl<Entity<T>>(this, "secondary-table", childNode, node); list.add(type); // depends on control dependency: [for], data = [none] } return list; } }
public class class_name { public Links addBySelector(Element ele, String cssSelector, boolean parseSrc) { Elements as = ele.select(cssSelector); for (Element a : as) { if (a.hasAttr("href")) { String href = a.attr("abs:href"); this.add(href); } if(parseSrc){ if(a.hasAttr("src")){ String src = a.attr("abs:src"); this.add(src); } } } return this; } }
public class class_name { public Links addBySelector(Element ele, String cssSelector, boolean parseSrc) { Elements as = ele.select(cssSelector); for (Element a : as) { if (a.hasAttr("href")) { String href = a.attr("abs:href"); this.add(href); // depends on control dependency: [if], data = [none] } if(parseSrc){ if(a.hasAttr("src")){ String src = a.attr("abs:src"); this.add(src); // depends on control dependency: [if], data = [none] } } } return this; } }
public class class_name { protected List<NodeInterface> getNodesAt(final NodeInterface locationNode) { final List<NodeInterface> nodes = new LinkedList<>(); for(RelationshipInterface rel : locationNode.getIncomingRelationships(NodeHasLocation.class)) { NodeInterface startNode = rel.getSourceNode(); nodes.add(startNode); // add more nodes which are "at" this one nodes.addAll(getNodesAt(startNode)); } return nodes; } }
public class class_name { protected List<NodeInterface> getNodesAt(final NodeInterface locationNode) { final List<NodeInterface> nodes = new LinkedList<>(); for(RelationshipInterface rel : locationNode.getIncomingRelationships(NodeHasLocation.class)) { NodeInterface startNode = rel.getSourceNode(); nodes.add(startNode); // depends on control dependency: [for], data = [none] // add more nodes which are "at" this one nodes.addAll(getNodesAt(startNode)); // depends on control dependency: [for], data = [none] } return nodes; } }
public class class_name { public static boolean hasJspBody(Element element) { boolean hasJspBody = false; boolean jspBodyFound = false; NodeList children = element.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child instanceof Element) { Element childElement = (Element)child; if (childElement.getNamespaceURI() != null && childElement.getNamespaceURI().equals(Constants.JSP_NAMESPACE) && childElement.getLocalName().equals(Constants.JSP_BODY_TYPE)) { if (childElement.hasChildNodes()) { hasJspBody = true; break; } } } } return hasJspBody; } }
public class class_name { public static boolean hasJspBody(Element element) { boolean hasJspBody = false; boolean jspBodyFound = false; NodeList children = element.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child instanceof Element) { Element childElement = (Element)child; if (childElement.getNamespaceURI() != null && childElement.getNamespaceURI().equals(Constants.JSP_NAMESPACE) && childElement.getLocalName().equals(Constants.JSP_BODY_TYPE)) { if (childElement.hasChildNodes()) { hasJspBody = true; // depends on control dependency: [if], data = [none] break; } } } } return hasJspBody; } }
public class class_name { @Override public T drain() { T event = delayed.drain(); if (event != null) { return event; } return source.drain(); } }
public class class_name { @Override public T drain() { T event = delayed.drain(); if (event != null) { return event; // depends on control dependency: [if], data = [none] } return source.drain(); } }
public class class_name { @Override public void run() { System.out.println("Event monitor starting..."); while(!shouldShutDown) { try { synchronized (eventQueue) { if (eventQueue.isEmpty()) { eventQueue.wait(delay); // Support wake-up via eventQueue.notify() } } } catch (InterruptedException e) { e.printStackTrace(); System.err.println("Interrupted (use shutdown() to terminate). Continuing..."); continue; } Object event = null; while ((event = eventQueue.poll()) != null) { processEvent(event); } } System.out.println("Event monitor exiting..."); clearAllHandlers(); } }
public class class_name { @Override public void run() { System.out.println("Event monitor starting..."); while(!shouldShutDown) { try { synchronized (eventQueue) // depends on control dependency: [try], data = [none] { if (eventQueue.isEmpty()) { eventQueue.wait(delay); // Support wake-up via eventQueue.notify() // depends on control dependency: [if], data = [none] } } } catch (InterruptedException e) { e.printStackTrace(); System.err.println("Interrupted (use shutdown() to terminate). Continuing..."); continue; } // depends on control dependency: [catch], data = [none] Object event = null; while ((event = eventQueue.poll()) != null) { processEvent(event); // depends on control dependency: [while], data = [none] } } System.out.println("Event monitor exiting..."); clearAllHandlers(); } }
public class class_name { public void removeAllChildren() { boolean listenerInvoked = false; final Lock lock = sharedObject.getLock(ACCESS_OBJECT).writeLock(); try { lock.lock(); final AbstractHtml[] removedAbstractHtmls = children .toArray(new AbstractHtml[children.size()]); children.clear(); initNewSharedObjectInAllNestedTagsAndSetSuperParentNull( removedAbstractHtmls); final ChildTagRemoveListener listener = sharedObject .getChildTagRemoveListener(ACCESS_OBJECT); if (listener != null) { listener.allChildrenRemoved(new ChildTagRemoveListener.Event( this, removedAbstractHtmls)); listenerInvoked = true; } } finally { lock.unlock(); } if (listenerInvoked) { final PushQueue pushQueue = sharedObject .getPushQueue(ACCESS_OBJECT); if (pushQueue != null) { pushQueue.push(); } } } }
public class class_name { public void removeAllChildren() { boolean listenerInvoked = false; final Lock lock = sharedObject.getLock(ACCESS_OBJECT).writeLock(); try { lock.lock(); // depends on control dependency: [try], data = [none] final AbstractHtml[] removedAbstractHtmls = children .toArray(new AbstractHtml[children.size()]); children.clear(); // depends on control dependency: [try], data = [none] initNewSharedObjectInAllNestedTagsAndSetSuperParentNull( removedAbstractHtmls); // depends on control dependency: [try], data = [none] final ChildTagRemoveListener listener = sharedObject .getChildTagRemoveListener(ACCESS_OBJECT); if (listener != null) { listener.allChildrenRemoved(new ChildTagRemoveListener.Event( this, removedAbstractHtmls)); // depends on control dependency: [if], data = [none] listenerInvoked = true; // depends on control dependency: [if], data = [none] } } finally { lock.unlock(); } if (listenerInvoked) { final PushQueue pushQueue = sharedObject .getPushQueue(ACCESS_OBJECT); if (pushQueue != null) { pushQueue.push(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public void visit(NodeVisitor v) { if (v.visit(this)) { for (AstNode label : labels) { label.visit(v); } statement.visit(v); } } }
public class class_name { @Override public void visit(NodeVisitor v) { if (v.visit(this)) { for (AstNode label : labels) { label.visit(v); // depends on control dependency: [for], data = [label] } statement.visit(v); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static PrivateKey getPrivateKey(String filename, String password, String key) { if(logger.isDebugEnabled()) logger.debug("filename = " + filename + " key = " + key); PrivateKey privateKey = null; try { KeyStore keystore = KeyStore.getInstance("JKS"); keystore.load(Config.getInstance().getInputStreamFromFile(filename), password.toCharArray()); privateKey = (PrivateKey) keystore.getKey(key, password.toCharArray()); } catch (Exception e) { logger.error("Exception:", e); } if (privateKey == null) { logger.error("Failed to retrieve private key from keystore"); } return privateKey; } }
public class class_name { private static PrivateKey getPrivateKey(String filename, String password, String key) { if(logger.isDebugEnabled()) logger.debug("filename = " + filename + " key = " + key); PrivateKey privateKey = null; try { KeyStore keystore = KeyStore.getInstance("JKS"); keystore.load(Config.getInstance().getInputStreamFromFile(filename), password.toCharArray()); // depends on control dependency: [try], data = [none] privateKey = (PrivateKey) keystore.getKey(key, password.toCharArray()); // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.error("Exception:", e); } // depends on control dependency: [catch], data = [none] if (privateKey == null) { logger.error("Failed to retrieve private key from keystore"); // depends on control dependency: [if], data = [none] } return privateKey; } }
public class class_name { public void updateStateOnResponse(MobicentsSipServletResponse response, boolean receive) { final String method = response.getMethod(); if(sipSessionSecurity != null && response.getStatus() >= 200 && response.getStatus() < 300) { // Issue 2173 http://code.google.com/p/mobicents/issues/detail?id=2173 // it means some credentials were cached need to check if we need to store the nextnonce if the response have one AuthenticationInfoHeader authenticationInfoHeader = (AuthenticationInfoHeader)response.getMessage().getHeader(AuthenticationInfoHeader.NAME); if(authenticationInfoHeader != null) { String nextNonce = authenticationInfoHeader.getNextNonce(); if(logger.isDebugEnabled()) { logger.debug("Storing nextNonce " + nextNonce + " for session " + key); } sipSessionSecurity.setNextNonce(nextNonce); } } // JSR 289 Section 6.2.1 Point 2 of rules governing the state of SipSession // In general, whenever a non-dialog creating request is sent or received, // the SipSession state remains unchanged. Similarly, a response received // for a non-dialog creating request also leaves the SipSession state unchanged. // The exception to the general rule is that it does not apply to requests (e.g. BYE, CANCEL) // that are dialog terminating according to the appropriate RFC rules relating to the kind of dialog. if(!JainSipUtils.DIALOG_CREATING_METHODS.contains(method) && !JainSipUtils.DIALOG_TERMINATING_METHODS.contains(method)) { if(getSessionCreatingDialog() == null && proxy == null) { // Fix for issue http://code.google.com/p/mobicents/issues/detail?id=2116 // avoid creating derived sessions for non dialogcreating requests if(logger.isDebugEnabled()) { logger.debug("resetting the to tag since a response to a non dialog creating and terminating method has been received for non proxy session with no dialog in state " + state); } key.setToTag(null, false); // https://github.com/Mobicents/sip-servlets/issues/36 // Memory leak: SipAppSession and contained SipSessions are not cleaned-up // for non dialog creating requests after a 2xx response is received. // This code sets these SipSessions to ReadyToInvalidate. // Applications that want to create susbequent requests (re REGISTER) should call sipSession.setInvalidateWhenReady(false); if ( state != null && State.INITIAL.equals(state) && response.getStatus() >= 200 && response.getStatus() != 407 && response.getStatus() != 401) { if(logger.isDebugEnabled()) { logger.debug("Setting SipSession " + getKey() + " for response " + response.getStatus() + " to a non dialog creating or terminating request " + method + " in state " + state + " to ReadyToInvalidate=true"); } setReadyToInvalidate(true); } } return; } // Mapping to the sip session state machine (proxy is covered here too) if( (State.INITIAL.equals(state) || State.EARLY.equals(state)) && response.getStatus() >= 200 && response.getStatus() < 300 && !JainSipUtils.DIALOG_TERMINATING_METHODS.contains(method)) { this.setState(State.CONFIRMED); if(this.proxy != null && response.getProxyBranch() != null && !response.getProxyBranch().getRecordRoute()) { // Section 6.2.4.1.2 Invalidate When Ready Mechanism : // "The container determines the SipSession to be in the ready-to-invalidate state under any of the following conditions: // 2. A SipSession transitions to the CONFIRMED state when it is acting as a non-record-routing proxy." setReadyToInvalidate(true); } if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has its state updated to " + state); } } // Mapping to the sip session state machine // We will transition from INITIAL to EARLY here for 100 Trying (not clear from the spec) // Figure 6-1 The SIP Dialog State Machine // and Figure 6-2 The SipSession State Machine if( State.INITIAL.equals(state) && response.getStatus() >= 100 && response.getStatus() < 200 ) { this.setState(State.EARLY); if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has its state updated to " + state); } } if( (State.INITIAL.equals(state) || State.EARLY.equals(state)) && response.getStatus() >= 300 && response.getStatus() < 700 && JainSipUtils.DIALOG_CREATING_METHODS.contains(method) && !JainSipUtils.DIALOG_TERMINATING_METHODS.contains(method)) { // If the servlet acts as a UAC and sends a dialog creating request, // then the SipSession state tracks directly the SIP dialog state except // that non-2XX final responses received in the EARLY or INITIAL states // cause the SipSession state to return to the INITIAL state rather than going to TERMINATED. // + // If the servlet acts as a proxy for a dialog creating request then // the SipSession state tracks the SIP dialog state except that non-2XX // final responses received from downstream in the EARLY or INITIAL states // cause the SipSession state to return to INITIAL rather than going to TERMINATED. if(receive) { if(proxy == null) { // Fix for issue http://code.google.com/p/mobicents/issues/detail?id=2083 if(logger.isDebugEnabled()) { logger.debug("resetting the to tag since a non 2xx response has been received for non proxy session in state " + state); } key.setToTag(null, false); } setState(State.INITIAL); // readyToInvalidate = true; if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has its state updated to " + state); } } // If the servlet acts as a UAS and receives a dialog creating request, // then the SipSession state directly tracks the SIP dialog state. // Unlike a UAC, a non-2XX final response sent by the UAS in the EARLY or INITIAL // states causes the SipSession state to go directly to the TERMINATED state. // + // This enables proxy servlets to proxy requests to additional destinations // when called by the container in the doResponse() method for a tentative // non-2XX best response. // After all such additional proxy branches have been responded to and after // considering any servlet created responses, the container eventually arrives at // the overall best response and forwards this response upstream. // If this best response is a non-2XX final response, then when the forwarding takes place, // the state of the SipSession object becomes TERMINATED. else { setState(State.TERMINATED); if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has its state updated to " + state); } } } if(((State.CONFIRMED.equals(state) || State.TERMINATED.equals(state)) && response.getStatus() >= 200 && Request.BYE.equals(method) // https://code.google.com/p/sipservlets/issues/detail?id=194 && response.getStatus() != 407 && response.getStatus() != 401) // http://code.google.com/p/mobicents/issues/detail?id=1438 // Sip Session become TERMINATED after receiving 487 response to subsequent request => !confirmed clause added || (!State.CONFIRMED.equals(state) && response.getStatus() == 487)) { boolean hasOngoingSubscriptions = false; if(subscriptions != null) { if(subscriptions.size() > 0) { hasOngoingSubscriptions = true; } if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has " + subscriptions.size() + " subscriptions"); } if(!hasOngoingSubscriptions) { if(sessionCreatingDialog != null) { sessionCreatingDialog.delete(); } } } if(!hasOngoingSubscriptions) { if(getProxy() == null || response.getStatus() != 487) { setState(State.TERMINATED); if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has its state updated to " + state); logger.debug("the following sip session " + getKey() + " is ready to be invalidated "); } } } if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has its state updated to " + state); } okToByeSentOrReceived = true; } // we send the CANCEL only for 1xx responses if(response.getTransactionApplicationData().isCanceled() && response.getStatus() < 200 && !response.getMethod().equals(Request.CANCEL)) { SipServletRequestImpl request = (SipServletRequestImpl) response.getTransactionApplicationData().getSipServletMessage(); if(logger.isDebugEnabled()) { logger.debug("request to cancel " + request + " routingstate " + request.getRoutingState() + " requestCseq " + ((MessageExt)request.getMessage()).getCSeqHeader().getSeqNumber() + " responseCseq " + ((MessageExt)response.getMessage()).getCSeqHeader().getSeqNumber()); } if(!request.getRoutingState().equals(RoutingState.CANCELLED) && ((MessageExt)request.getMessage()).getCSeqHeader().getSeqNumber() == ((MessageExt)response.getMessage()).getCSeqHeader().getSeqNumber()) { if(response.getStatus() > 100) { request.setRoutingState(RoutingState.CANCELLED); } try { request.createCancel().send(); } catch (IOException e) { if(logger.isEnabledFor(Priority.WARN)) { logger.warn("Couldn't send CANCEL for a transaction that has been CANCELLED but " + "CANCEL was not sent because there was no response from the other side. We" + " just stopped the retransmissions." + response + "\nThe transaction" + response.getTransaction(), e); } } } } } }
public class class_name { public void updateStateOnResponse(MobicentsSipServletResponse response, boolean receive) { final String method = response.getMethod(); if(sipSessionSecurity != null && response.getStatus() >= 200 && response.getStatus() < 300) { // Issue 2173 http://code.google.com/p/mobicents/issues/detail?id=2173 // it means some credentials were cached need to check if we need to store the nextnonce if the response have one AuthenticationInfoHeader authenticationInfoHeader = (AuthenticationInfoHeader)response.getMessage().getHeader(AuthenticationInfoHeader.NAME); if(authenticationInfoHeader != null) { String nextNonce = authenticationInfoHeader.getNextNonce(); if(logger.isDebugEnabled()) { logger.debug("Storing nextNonce " + nextNonce + " for session " + key); // depends on control dependency: [if], data = [none] } sipSessionSecurity.setNextNonce(nextNonce); // depends on control dependency: [if], data = [none] } } // JSR 289 Section 6.2.1 Point 2 of rules governing the state of SipSession // In general, whenever a non-dialog creating request is sent or received, // the SipSession state remains unchanged. Similarly, a response received // for a non-dialog creating request also leaves the SipSession state unchanged. // The exception to the general rule is that it does not apply to requests (e.g. BYE, CANCEL) // that are dialog terminating according to the appropriate RFC rules relating to the kind of dialog. if(!JainSipUtils.DIALOG_CREATING_METHODS.contains(method) && !JainSipUtils.DIALOG_TERMINATING_METHODS.contains(method)) { if(getSessionCreatingDialog() == null && proxy == null) { // Fix for issue http://code.google.com/p/mobicents/issues/detail?id=2116 // avoid creating derived sessions for non dialogcreating requests if(logger.isDebugEnabled()) { logger.debug("resetting the to tag since a response to a non dialog creating and terminating method has been received for non proxy session with no dialog in state " + state); // depends on control dependency: [if], data = [none] } key.setToTag(null, false); // depends on control dependency: [if], data = [none] // https://github.com/Mobicents/sip-servlets/issues/36 // Memory leak: SipAppSession and contained SipSessions are not cleaned-up // for non dialog creating requests after a 2xx response is received. // This code sets these SipSessions to ReadyToInvalidate. // Applications that want to create susbequent requests (re REGISTER) should call sipSession.setInvalidateWhenReady(false); if ( state != null && State.INITIAL.equals(state) && response.getStatus() >= 200 && response.getStatus() != 407 && response.getStatus() != 401) { if(logger.isDebugEnabled()) { logger.debug("Setting SipSession " + getKey() + " for response " + response.getStatus() + " to a non dialog creating or terminating request " + method + " in state " + state + " to ReadyToInvalidate=true"); // depends on control dependency: [if], data = [none] } setReadyToInvalidate(true); // depends on control dependency: [if], data = [none] } } return; // depends on control dependency: [if], data = [none] } // Mapping to the sip session state machine (proxy is covered here too) if( (State.INITIAL.equals(state) || State.EARLY.equals(state)) && response.getStatus() >= 200 && response.getStatus() < 300 && !JainSipUtils.DIALOG_TERMINATING_METHODS.contains(method)) { this.setState(State.CONFIRMED); // depends on control dependency: [if], data = [none] if(this.proxy != null && response.getProxyBranch() != null && !response.getProxyBranch().getRecordRoute()) { // Section 6.2.4.1.2 Invalidate When Ready Mechanism : // "The container determines the SipSession to be in the ready-to-invalidate state under any of the following conditions: // 2. A SipSession transitions to the CONFIRMED state when it is acting as a non-record-routing proxy." setReadyToInvalidate(true); // depends on control dependency: [if], data = [none] } if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has its state updated to " + state); // depends on control dependency: [if], data = [none] } } // Mapping to the sip session state machine // We will transition from INITIAL to EARLY here for 100 Trying (not clear from the spec) // Figure 6-1 The SIP Dialog State Machine // and Figure 6-2 The SipSession State Machine if( State.INITIAL.equals(state) && response.getStatus() >= 100 && response.getStatus() < 200 ) { this.setState(State.EARLY); // depends on control dependency: [if], data = [none] if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has its state updated to " + state); // depends on control dependency: [if], data = [none] } } if( (State.INITIAL.equals(state) || State.EARLY.equals(state)) && response.getStatus() >= 300 && response.getStatus() < 700 && JainSipUtils.DIALOG_CREATING_METHODS.contains(method) && !JainSipUtils.DIALOG_TERMINATING_METHODS.contains(method)) { // If the servlet acts as a UAC and sends a dialog creating request, // then the SipSession state tracks directly the SIP dialog state except // that non-2XX final responses received in the EARLY or INITIAL states // cause the SipSession state to return to the INITIAL state rather than going to TERMINATED. // + // If the servlet acts as a proxy for a dialog creating request then // the SipSession state tracks the SIP dialog state except that non-2XX // final responses received from downstream in the EARLY or INITIAL states // cause the SipSession state to return to INITIAL rather than going to TERMINATED. if(receive) { if(proxy == null) { // Fix for issue http://code.google.com/p/mobicents/issues/detail?id=2083 if(logger.isDebugEnabled()) { logger.debug("resetting the to tag since a non 2xx response has been received for non proxy session in state " + state); // depends on control dependency: [if], data = [none] } key.setToTag(null, false); // depends on control dependency: [if], data = [none] } setState(State.INITIAL); // depends on control dependency: [if], data = [none] // readyToInvalidate = true; if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has its state updated to " + state); // depends on control dependency: [if], data = [none] } } // If the servlet acts as a UAS and receives a dialog creating request, // then the SipSession state directly tracks the SIP dialog state. // Unlike a UAC, a non-2XX final response sent by the UAS in the EARLY or INITIAL // states causes the SipSession state to go directly to the TERMINATED state. // + // This enables proxy servlets to proxy requests to additional destinations // when called by the container in the doResponse() method for a tentative // non-2XX best response. // After all such additional proxy branches have been responded to and after // considering any servlet created responses, the container eventually arrives at // the overall best response and forwards this response upstream. // If this best response is a non-2XX final response, then when the forwarding takes place, // the state of the SipSession object becomes TERMINATED. else { setState(State.TERMINATED); // depends on control dependency: [if], data = [none] if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has its state updated to " + state); // depends on control dependency: [if], data = [none] } } } if(((State.CONFIRMED.equals(state) || State.TERMINATED.equals(state)) && response.getStatus() >= 200 && Request.BYE.equals(method) // https://code.google.com/p/sipservlets/issues/detail?id=194 && response.getStatus() != 407 && response.getStatus() != 401) // http://code.google.com/p/mobicents/issues/detail?id=1438 // Sip Session become TERMINATED after receiving 487 response to subsequent request => !confirmed clause added || (!State.CONFIRMED.equals(state) && response.getStatus() == 487)) { boolean hasOngoingSubscriptions = false; if(subscriptions != null) { if(subscriptions.size() > 0) { hasOngoingSubscriptions = true; // depends on control dependency: [if], data = [none] } if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has " + subscriptions.size() + " subscriptions"); // depends on control dependency: [if], data = [none] } if(!hasOngoingSubscriptions) { if(sessionCreatingDialog != null) { sessionCreatingDialog.delete(); // depends on control dependency: [if], data = [none] } } } if(!hasOngoingSubscriptions) { if(getProxy() == null || response.getStatus() != 487) { setState(State.TERMINATED); // depends on control dependency: [if], data = [none] if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has its state updated to " + state); // depends on control dependency: [if], data = [none] logger.debug("the following sip session " + getKey() + " is ready to be invalidated "); // depends on control dependency: [if], data = [none] } } } if(logger.isDebugEnabled()) { logger.debug("the following sip session " + getKey() + " has its state updated to " + state); // depends on control dependency: [if], data = [none] } okToByeSentOrReceived = true; // depends on control dependency: [if], data = [none] } // we send the CANCEL only for 1xx responses if(response.getTransactionApplicationData().isCanceled() && response.getStatus() < 200 && !response.getMethod().equals(Request.CANCEL)) { SipServletRequestImpl request = (SipServletRequestImpl) response.getTransactionApplicationData().getSipServletMessage(); if(logger.isDebugEnabled()) { logger.debug("request to cancel " + request + " routingstate " + request.getRoutingState() + " requestCseq " + ((MessageExt)request.getMessage()).getCSeqHeader().getSeqNumber() + " responseCseq " + ((MessageExt)response.getMessage()).getCSeqHeader().getSeqNumber()); // depends on control dependency: [if], data = [none] } if(!request.getRoutingState().equals(RoutingState.CANCELLED) && ((MessageExt)request.getMessage()).getCSeqHeader().getSeqNumber() == ((MessageExt)response.getMessage()).getCSeqHeader().getSeqNumber()) { if(response.getStatus() > 100) { request.setRoutingState(RoutingState.CANCELLED); // depends on control dependency: [if], data = [none] } try { request.createCancel().send(); // depends on control dependency: [try], data = [none] } catch (IOException e) { if(logger.isEnabledFor(Priority.WARN)) { logger.warn("Couldn't send CANCEL for a transaction that has been CANCELLED but " + "CANCEL was not sent because there was no response from the other side. We" + " just stopped the retransmissions." + response + "\nThe transaction" + response.getTransaction(), e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { private int[] makeUVCoordDeltas(AttributeData map, SortableVertex[] sortVertices) { // UV coordinate scaling factor float scale = 1.0f / map.precision; int vc = sortVertices.length; int prevU = 0, prevV = 0; int[] intUVCoords = new int[vc * CTM_UV_ELEMENT_COUNT]; for (int i = 0; i < vc; ++i) { // Get old UV coordinate index (before vertex sorting) int oldIdx = sortVertices[i].originalIndex; // Convert to fixed point int u = (int) floor(scale * map.values[oldIdx * 2] + 0.5f); int v = (int) floor(scale * map.values[oldIdx * 2 + 1] + 0.5f); // Calculate delta and store it in the converted array. NOTE: Here we rely // on the fact that vertices are sorted, and usually close to each other, // which means that UV coordinates should also be close to each other... intUVCoords[i * 2] = u - prevU; intUVCoords[i * 2 + 1] = v - prevV; prevU = u; prevV = v; } return intUVCoords; } }
public class class_name { private int[] makeUVCoordDeltas(AttributeData map, SortableVertex[] sortVertices) { // UV coordinate scaling factor float scale = 1.0f / map.precision; int vc = sortVertices.length; int prevU = 0, prevV = 0; int[] intUVCoords = new int[vc * CTM_UV_ELEMENT_COUNT]; for (int i = 0; i < vc; ++i) { // Get old UV coordinate index (before vertex sorting) int oldIdx = sortVertices[i].originalIndex; // Convert to fixed point int u = (int) floor(scale * map.values[oldIdx * 2] + 0.5f); int v = (int) floor(scale * map.values[oldIdx * 2 + 1] + 0.5f); // Calculate delta and store it in the converted array. NOTE: Here we rely // on the fact that vertices are sorted, and usually close to each other, // which means that UV coordinates should also be close to each other... intUVCoords[i * 2] = u - prevU; // depends on control dependency: [for], data = [i] intUVCoords[i * 2 + 1] = v - prevV; // depends on control dependency: [for], data = [i] prevU = u; // depends on control dependency: [for], data = [none] prevV = v; // depends on control dependency: [for], data = [none] } return intUVCoords; } }
public class class_name { public void process(List<ChessboardCorner> corners ) { this.corners = corners; // reset internal data structures vertexes.reset(); edges.reset(); clusters.reset(); // Create a vertex for each corner for (int idx = 0; idx < corners.size(); idx++) { Vertex v = vertexes.grow(); v.reset(); v.index = idx; } // Initialize nearest-neighbor search. nn.setPoints(corners,true); // Connect corners to each other based on relative distance on orientation for (int i = 0; i < corners.size(); i++) { findVertexNeighbors(vertexes.get(i),corners); } // If more than one vertex's are near each other, pick one and remove the others handleAmbiguousVertexes(corners); // printDualGraph(); // Prune connections which are not mutual for (int i = 0; i < vertexes.size; i++) { Vertex v = vertexes.get(i); v.pruneNonMutal(EdgeType.PARALLEL); v.pruneNonMutal(EdgeType.PERPENDICULAR); } // printDualGraph(); // Select the final 2 to 4 connections from perpendicular set // each pair of adjacent perpendicular edge needs to have a matching parallel edge between them // Use each perpendicular edge as a seed and select the best one for (int idx = 0; idx < vertexes.size(); idx++) { selectConnections(vertexes.get(idx)); } // printConnectionGraph(); // Connects must be mutual to be accepted. Keep track of vertexes which were modified dirtyVertexes.clear(); for (int i = 0; i < vertexes.size; i++) { Vertex v = vertexes.get(i); int before = v.connections.size(); v.pruneNonMutal(EdgeType.CONNECTION); if( before != v.connections.size() ) { dirtyVertexes.add(v); v.marked = true; } } // printConnectionGraph(); // attempt to recover from poorly made decisions in the past from the greedy algorithm repairVertexes(); // Prune non-mutual edges again. Only need to consider dirty edges since it makes sure that the new // set of connections is a super set of the old for (int i = 0; i < dirtyVertexes.size(); i++) { dirtyVertexes.get(i).pruneNonMutal(EdgeType.CONNECTION); dirtyVertexes.get(i).marked = false; } // Final clean up to return just valid grids disconnectInvalidVertices(); // Name says it all convertToOutput(corners); } }
public class class_name { public void process(List<ChessboardCorner> corners ) { this.corners = corners; // reset internal data structures vertexes.reset(); edges.reset(); clusters.reset(); // Create a vertex for each corner for (int idx = 0; idx < corners.size(); idx++) { Vertex v = vertexes.grow(); v.reset(); // depends on control dependency: [for], data = [none] v.index = idx; // depends on control dependency: [for], data = [idx] } // Initialize nearest-neighbor search. nn.setPoints(corners,true); // Connect corners to each other based on relative distance on orientation for (int i = 0; i < corners.size(); i++) { findVertexNeighbors(vertexes.get(i),corners); // depends on control dependency: [for], data = [i] } // If more than one vertex's are near each other, pick one and remove the others handleAmbiguousVertexes(corners); // printDualGraph(); // Prune connections which are not mutual for (int i = 0; i < vertexes.size; i++) { Vertex v = vertexes.get(i); v.pruneNonMutal(EdgeType.PARALLEL); // depends on control dependency: [for], data = [none] v.pruneNonMutal(EdgeType.PERPENDICULAR); // depends on control dependency: [for], data = [none] } // printDualGraph(); // Select the final 2 to 4 connections from perpendicular set // each pair of adjacent perpendicular edge needs to have a matching parallel edge between them // Use each perpendicular edge as a seed and select the best one for (int idx = 0; idx < vertexes.size(); idx++) { selectConnections(vertexes.get(idx)); // depends on control dependency: [for], data = [idx] } // printConnectionGraph(); // Connects must be mutual to be accepted. Keep track of vertexes which were modified dirtyVertexes.clear(); for (int i = 0; i < vertexes.size; i++) { Vertex v = vertexes.get(i); int before = v.connections.size(); v.pruneNonMutal(EdgeType.CONNECTION); // depends on control dependency: [for], data = [none] if( before != v.connections.size() ) { dirtyVertexes.add(v); // depends on control dependency: [if], data = [none] v.marked = true; // depends on control dependency: [if], data = [none] } } // printConnectionGraph(); // attempt to recover from poorly made decisions in the past from the greedy algorithm repairVertexes(); // Prune non-mutual edges again. Only need to consider dirty edges since it makes sure that the new // set of connections is a super set of the old for (int i = 0; i < dirtyVertexes.size(); i++) { dirtyVertexes.get(i).pruneNonMutal(EdgeType.CONNECTION); // depends on control dependency: [for], data = [i] dirtyVertexes.get(i).marked = false; // depends on control dependency: [for], data = [i] } // Final clean up to return just valid grids disconnectInvalidVertices(); // Name says it all convertToOutput(corners); } }
public class class_name { public Object evaluateUntilLast(Context ctx){ if (attributes.length == 0) { //不可能发生,除非beetl写错了,先放在着 throw new RuntimeException(); } Result ret = this.getValue(ctx); Object value = ret.value; if (value == null) { BeetlException ex = new BeetlException(BeetlException.NULL); ex.pushToken(this.firstToken); throw ex; } for (int i = 0; i < attributes.length-1; i++) { VarAttribute attr = attributes[i]; if (value == null) { BeetlException be = new BeetlException(BeetlException.NULL, "空指针"); if (i == 0) { be.pushToken(this.firstToken); } else { be.pushToken(attributes[i - 1].token); } throw be; } try { value = attr.evaluate(ctx, value); } catch (BeetlException ex) { ex.pushToken(attr.token); throw ex; } catch (RuntimeException ex) { BeetlException be = new BeetlException(BeetlException.ATTRIBUTE_INVALID, "属性访问出错", ex); be.pushToken(attr.token); throw be; } } return value ; } }
public class class_name { public Object evaluateUntilLast(Context ctx){ if (attributes.length == 0) { //不可能发生,除非beetl写错了,先放在着 throw new RuntimeException(); } Result ret = this.getValue(ctx); Object value = ret.value; if (value == null) { BeetlException ex = new BeetlException(BeetlException.NULL); ex.pushToken(this.firstToken); // depends on control dependency: [if], data = [none] throw ex; } for (int i = 0; i < attributes.length-1; i++) { VarAttribute attr = attributes[i]; if (value == null) { BeetlException be = new BeetlException(BeetlException.NULL, "空指针"); if (i == 0) { be.pushToken(this.firstToken); // depends on control dependency: [if], data = [none] } else { be.pushToken(attributes[i - 1].token); // depends on control dependency: [if], data = [none] } throw be; } try { value = attr.evaluate(ctx, value); // depends on control dependency: [try], data = [none] } catch (BeetlException ex) { ex.pushToken(attr.token); throw ex; } // depends on control dependency: [catch], data = [none] catch (RuntimeException ex) { BeetlException be = new BeetlException(BeetlException.ATTRIBUTE_INVALID, "属性访问出错", ex); be.pushToken(attr.token); throw be; } // depends on control dependency: [catch], data = [none] } return value ; } }
public class class_name { public Set<String> setCapitalize(final Set<?> target) { if (target == null) { return null; } final Set<String> result = new LinkedHashSet<String>(target.size() + 2); for (final Object element : target) { result.add(capitalize(element)); } return result; } }
public class class_name { public Set<String> setCapitalize(final Set<?> target) { if (target == null) { return null; // depends on control dependency: [if], data = [none] } final Set<String> result = new LinkedHashSet<String>(target.size() + 2); for (final Object element : target) { result.add(capitalize(element)); // depends on control dependency: [for], data = [element] } return result; } }
public class class_name { static void throwExceptionWhenMultipleConstructorMatchesFound(Constructor<?>[] constructors) { if (constructors == null || constructors.length < 2) { throw new IllegalArgumentException( "Internal error: throwExceptionWhenMultipleConstructorMatchesFound needs at least two constructors."); } StringBuilder sb = new StringBuilder(); sb.append("Several matching constructors found, please specify the argument parameter types so that PowerMock can determine which method you're referring to.\n"); sb.append("Matching constructors in class ").append(constructors[0].getDeclaringClass().getName()) .append(" were:\n"); for (Constructor<?> constructor : constructors) { sb.append(constructor.getName()).append("( "); final Class<?>[] parameterTypes = constructor.getParameterTypes(); for (Class<?> paramType : parameterTypes) { sb.append(paramType.getName()).append(".class "); } sb.append(")\n"); } throw new TooManyConstructorsFoundException(sb.toString()); } }
public class class_name { static void throwExceptionWhenMultipleConstructorMatchesFound(Constructor<?>[] constructors) { if (constructors == null || constructors.length < 2) { throw new IllegalArgumentException( "Internal error: throwExceptionWhenMultipleConstructorMatchesFound needs at least two constructors."); } StringBuilder sb = new StringBuilder(); sb.append("Several matching constructors found, please specify the argument parameter types so that PowerMock can determine which method you're referring to.\n"); sb.append("Matching constructors in class ").append(constructors[0].getDeclaringClass().getName()) .append(" were:\n"); for (Constructor<?> constructor : constructors) { sb.append(constructor.getName()).append("( "); // depends on control dependency: [for], data = [constructor] final Class<?>[] parameterTypes = constructor.getParameterTypes(); for (Class<?> paramType : parameterTypes) { sb.append(paramType.getName()).append(".class "); // depends on control dependency: [for], data = [paramType] } sb.append(")\n"); // depends on control dependency: [for], data = [none] } throw new TooManyConstructorsFoundException(sb.toString()); } }
public class class_name { @SuppressWarnings("rawtypes") public List hvals(Object key) { Jedis jedis = getJedis(); try { List<byte[]> data = jedis.hvals(keyToBytes(key)); return valueListFromBytesList(data); } finally {close(jedis);} } }
public class class_name { @SuppressWarnings("rawtypes") public List hvals(Object key) { Jedis jedis = getJedis(); try { List<byte[]> data = jedis.hvals(keyToBytes(key)); return valueListFromBytesList(data); // depends on control dependency: [try], data = [none] } finally {close(jedis);} } }
public class class_name { public void monitor(Monitor target) { log.info("starting monitor: {}", target); try { target.getMonitorDriver(props, configService).run(); } catch (Exception e) { ByteArrayOutputStream out = new ByteArrayOutputStream(); PrintStream error = new PrintStream(out); error.println("Error in MonitorsDriver: " + e.getMessage()); e.printStackTrace(error); error.flush(); IOUtils.closeQuietly(out); String msg = new String(out.toByteArray()); log.error(msg); sendEmail("Management Console Monitors Error", msg); } } }
public class class_name { public void monitor(Monitor target) { log.info("starting monitor: {}", target); try { target.getMonitorDriver(props, configService).run(); // depends on control dependency: [try], data = [none] } catch (Exception e) { ByteArrayOutputStream out = new ByteArrayOutputStream(); PrintStream error = new PrintStream(out); error.println("Error in MonitorsDriver: " + e.getMessage()); e.printStackTrace(error); error.flush(); IOUtils.closeQuietly(out); String msg = new String(out.toByteArray()); log.error(msg); sendEmail("Management Console Monitors Error", msg); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void sealObject(ScriptableObject obj) { obj.sealObject(); Object[] ids = obj.getIds(); for (Object id : ids) { Object child = obj.get(id); if (child instanceof ScriptableObject) { sealObject((ScriptableObject)child); } } } }
public class class_name { private void sealObject(ScriptableObject obj) { obj.sealObject(); Object[] ids = obj.getIds(); for (Object id : ids) { Object child = obj.get(id); if (child instanceof ScriptableObject) { sealObject((ScriptableObject)child); // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected InputStream findClassContent(String className) throws IOException { String primaryArtifactEntryName = "WEB-INF/classes/" + className.replace('.', '/') + ".class"; String dependencyEntryName = className.replace('.', '/') + ".class"; ZipEntry entry = this.pluginArtifactZip.getEntry(primaryArtifactEntryName); if (entry != null) { return this.pluginArtifactZip.getInputStream(entry); } for (ZipFile zipFile : this.dependencyZips) { entry = zipFile.getEntry(dependencyEntryName); if (entry != null) { return zipFile.getInputStream(entry); } } return null; } }
public class class_name { protected InputStream findClassContent(String className) throws IOException { String primaryArtifactEntryName = "WEB-INF/classes/" + className.replace('.', '/') + ".class"; String dependencyEntryName = className.replace('.', '/') + ".class"; ZipEntry entry = this.pluginArtifactZip.getEntry(primaryArtifactEntryName); if (entry != null) { return this.pluginArtifactZip.getInputStream(entry); } for (ZipFile zipFile : this.dependencyZips) { entry = zipFile.getEntry(dependencyEntryName); if (entry != null) { return zipFile.getInputStream(entry); // depends on control dependency: [if], data = [(entry] } } return null; } }
public class class_name { private <T> T invokeURL(String toBeInvoked, Class<T> returnType) throws SameAsServiceException { URL url; try { url = new URL(toBeInvoked); } catch (MalformedURLException e) { throw new SameAsServiceException("An error occurred while building the URL '" + toBeInvoked + "'"); } URLConnection connection = null; Reader reader = null; if (this.cache != null) { lock.lock(); } try { connection = url.openConnection(); long lastModified = connection.getLastModified(); if (this.cache != null) { CacheKey cacheKey = new CacheKey(toBeInvoked, lastModified); T cached = this.cache.get(cacheKey, returnType); if (cached != null) { return cached; } } if (connection instanceof HttpURLConnection) { ((HttpURLConnection) connection).connect(); } reader = new InputStreamReader(connection.getInputStream()); Gson gson = this.gsonBuilder.create(); T response = gson.fromJson(reader, returnType); if (this.cache != null) { CacheKey cacheKey = new CacheKey(toBeInvoked, lastModified); this.cache.put(cacheKey, response); } return response; } catch (IOException e) { throw new SameAsServiceException(format("An error occurred while invoking the URL '%s': %s", toBeInvoked, e.getMessage())); } catch (JsonParseException e) { throw new SameAsServiceException("An error occurred while parsing the JSON response", e); } finally { if (this.cache != null) { lock.unlock(); } if (connection != null && connection instanceof HttpURLConnection) { ((HttpURLConnection) connection).disconnect(); } if (reader != null) { try { reader.close(); } catch (IOException e) { // close it quietly } } } } }
public class class_name { private <T> T invokeURL(String toBeInvoked, Class<T> returnType) throws SameAsServiceException { URL url; try { url = new URL(toBeInvoked); } catch (MalformedURLException e) { throw new SameAsServiceException("An error occurred while building the URL '" + toBeInvoked + "'"); } URLConnection connection = null; Reader reader = null; if (this.cache != null) { lock.lock(); } try { connection = url.openConnection(); long lastModified = connection.getLastModified(); if (this.cache != null) { CacheKey cacheKey = new CacheKey(toBeInvoked, lastModified); T cached = this.cache.get(cacheKey, returnType); if (cached != null) { return cached; // depends on control dependency: [if], data = [none] } } if (connection instanceof HttpURLConnection) { ((HttpURLConnection) connection).connect(); // depends on control dependency: [if], data = [none] } reader = new InputStreamReader(connection.getInputStream()); Gson gson = this.gsonBuilder.create(); T response = gson.fromJson(reader, returnType); if (this.cache != null) { CacheKey cacheKey = new CacheKey(toBeInvoked, lastModified); this.cache.put(cacheKey, response); // depends on control dependency: [if], data = [none] } return response; } catch (IOException e) { throw new SameAsServiceException(format("An error occurred while invoking the URL '%s': %s", toBeInvoked, e.getMessage())); } catch (JsonParseException e) { throw new SameAsServiceException("An error occurred while parsing the JSON response", e); } finally { if (this.cache != null) { lock.unlock(); // depends on control dependency: [if], data = [none] } if (connection != null && connection instanceof HttpURLConnection) { ((HttpURLConnection) connection).disconnect(); // depends on control dependency: [if], data = [none] } if (reader != null) { try { reader.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { // close it quietly } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { public ApiResponse authorizeAppUser(String email, String password) { validateNonEmptyParam(email, "email"); validateNonEmptyParam(password,"password"); assertValidApplicationId(); loggedInUser = null; accessToken = null; currentOrganization = null; Map<String, Object> formData = new HashMap<String, Object>(); formData.put("grant_type", "password"); formData.put("username", email); formData.put("password", password); ApiResponse response = apiRequest(HttpMethod.POST, formData, null, organizationId, applicationId, "token"); if (response == null) { return response; } if (!isEmpty(response.getAccessToken()) && (response.getUser() != null)) { loggedInUser = response.getUser(); accessToken = response.getAccessToken(); currentOrganization = null; log.info("Client.authorizeAppUser(): Access token: " + accessToken); } else { log.info("Client.authorizeAppUser(): Response: " + response); } return response; } }
public class class_name { public ApiResponse authorizeAppUser(String email, String password) { validateNonEmptyParam(email, "email"); validateNonEmptyParam(password,"password"); assertValidApplicationId(); loggedInUser = null; accessToken = null; currentOrganization = null; Map<String, Object> formData = new HashMap<String, Object>(); formData.put("grant_type", "password"); formData.put("username", email); formData.put("password", password); ApiResponse response = apiRequest(HttpMethod.POST, formData, null, organizationId, applicationId, "token"); if (response == null) { return response; // depends on control dependency: [if], data = [none] } if (!isEmpty(response.getAccessToken()) && (response.getUser() != null)) { loggedInUser = response.getUser(); // depends on control dependency: [if], data = [none] accessToken = response.getAccessToken(); // depends on control dependency: [if], data = [none] currentOrganization = null; // depends on control dependency: [if], data = [none] log.info("Client.authorizeAppUser(): Access token: " + accessToken); // depends on control dependency: [if], data = [none] } else { log.info("Client.authorizeAppUser(): Response: " + response); // depends on control dependency: [if], data = [none] } return response; } }
public class class_name { public void connectSource(int inputNumber, IntermediateResult source, JobEdge edge, int consumerNumber) { final DistributionPattern pattern = edge.getDistributionPattern(); final IntermediateResultPartition[] sourcePartitions = source.getPartitions(); ExecutionEdge[] edges; switch (pattern) { case POINTWISE: edges = connectPointwise(sourcePartitions, inputNumber); break; case ALL_TO_ALL: edges = connectAllToAll(sourcePartitions, inputNumber); break; default: throw new RuntimeException("Unrecognized distribution pattern."); } inputEdges[inputNumber] = edges; // add the consumers to the source // for now (until the receiver initiated handshake is in place), we need to register the // edges as the execution graph for (ExecutionEdge ee : edges) { ee.getSource().addConsumer(ee, consumerNumber); } } }
public class class_name { public void connectSource(int inputNumber, IntermediateResult source, JobEdge edge, int consumerNumber) { final DistributionPattern pattern = edge.getDistributionPattern(); final IntermediateResultPartition[] sourcePartitions = source.getPartitions(); ExecutionEdge[] edges; switch (pattern) { case POINTWISE: edges = connectPointwise(sourcePartitions, inputNumber); break; case ALL_TO_ALL: edges = connectAllToAll(sourcePartitions, inputNumber); break; default: throw new RuntimeException("Unrecognized distribution pattern."); } inputEdges[inputNumber] = edges; // add the consumers to the source // for now (until the receiver initiated handshake is in place), we need to register the // edges as the execution graph for (ExecutionEdge ee : edges) { ee.getSource().addConsumer(ee, consumerNumber); // depends on control dependency: [for], data = [ee] } } }
public class class_name { private Media create(String prefix, int prefixLength, File file) { final String currentPath = file.getPath(); final String[] systemPath = SLASH.split(currentPath.substring(currentPath.indexOf(prefix) + prefixLength) .replace(File.separator, Constant.SLASH)); final Media media; if (loader.isPresent()) { media = new MediaDefault(separator, loader.get(), UtilFolder.getPathSeparator(separator, systemPath)); } else { media = new MediaDefault(separator, resourcesDir, UtilFolder.getPathSeparator(separator, systemPath)); } return media; } }
public class class_name { private Media create(String prefix, int prefixLength, File file) { final String currentPath = file.getPath(); final String[] systemPath = SLASH.split(currentPath.substring(currentPath.indexOf(prefix) + prefixLength) .replace(File.separator, Constant.SLASH)); final Media media; if (loader.isPresent()) { media = new MediaDefault(separator, loader.get(), UtilFolder.getPathSeparator(separator, systemPath)); // depends on control dependency: [if], data = [none] } else { media = new MediaDefault(separator, resourcesDir, UtilFolder.getPathSeparator(separator, systemPath)); // depends on control dependency: [if], data = [none] } return media; } }
public class class_name { @Override public CompletableFuture<Void> createAllLeasesIfNotExists(List<String> partitionIds) { CompletableFuture<Void> future = null; // Optimization: list the blobs currently existing in the directory. If there are the // expected number of blobs, then we can skip doing the creates. int blobCount = 0; try { Iterable<ListBlobItem> leaseBlobs = this.consumerGroupDirectory.listBlobs("", true, null, this.leaseOperationOptions, null); Iterator<ListBlobItem> blobIterator = leaseBlobs.iterator(); while (blobIterator.hasNext()) { blobCount++; blobIterator.next(); } } catch (URISyntaxException | StorageException e) { TRACE_LOGGER.error(this.hostContext.withHost("Exception checking lease existence - leaseContainerName: " + this.storageContainerName + " consumerGroupName: " + this.hostContext.getConsumerGroupName() + " storageBlobPrefix: " + this.storageBlobPrefix), e); future = new CompletableFuture<Void>(); future.completeExceptionally(LoggingUtils.wrapException(e, EventProcessorHostActionStrings.CREATING_LEASES)); } if (future == null) { // No error checking the list, so keep going if (blobCount == partitionIds.size()) { // All expected blobs found, so short-circuit future = CompletableFuture.completedFuture(null); } else { // Create the blobs in parallel ArrayList<CompletableFuture<CompleteLease>> createFutures = new ArrayList<CompletableFuture<CompleteLease>>(); for (String id : partitionIds) { CompletableFuture<CompleteLease> oneCreate = CompletableFuture.supplyAsync(() -> { CompleteLease returnLease = null; try { returnLease = createLeaseIfNotExistsInternal(id, this.leaseOperationOptions); } catch (URISyntaxException | IOException | StorageException e) { TRACE_LOGGER.error(this.hostContext.withHostAndPartition(id, "Exception creating lease - leaseContainerName: " + this.storageContainerName + " consumerGroupName: " + this.hostContext.getConsumerGroupName() + " storageBlobPrefix: " + this.storageBlobPrefix), e); throw LoggingUtils.wrapException(e, EventProcessorHostActionStrings.CREATING_LEASES); } return returnLease; }, this.hostContext.getExecutor()); createFutures.add(oneCreate); } CompletableFuture<?>[] dummy = new CompletableFuture<?>[createFutures.size()]; future = CompletableFuture.allOf(createFutures.toArray(dummy)); } } return future; } }
public class class_name { @Override public CompletableFuture<Void> createAllLeasesIfNotExists(List<String> partitionIds) { CompletableFuture<Void> future = null; // Optimization: list the blobs currently existing in the directory. If there are the // expected number of blobs, then we can skip doing the creates. int blobCount = 0; try { Iterable<ListBlobItem> leaseBlobs = this.consumerGroupDirectory.listBlobs("", true, null, this.leaseOperationOptions, null); Iterator<ListBlobItem> blobIterator = leaseBlobs.iterator(); while (blobIterator.hasNext()) { blobCount++; // depends on control dependency: [while], data = [none] blobIterator.next(); // depends on control dependency: [while], data = [none] } } catch (URISyntaxException | StorageException e) { TRACE_LOGGER.error(this.hostContext.withHost("Exception checking lease existence - leaseContainerName: " + this.storageContainerName + " consumerGroupName: " + this.hostContext.getConsumerGroupName() + " storageBlobPrefix: " + this.storageBlobPrefix), e); future = new CompletableFuture<Void>(); future.completeExceptionally(LoggingUtils.wrapException(e, EventProcessorHostActionStrings.CREATING_LEASES)); } // depends on control dependency: [catch], data = [none] if (future == null) { // No error checking the list, so keep going if (blobCount == partitionIds.size()) { // All expected blobs found, so short-circuit future = CompletableFuture.completedFuture(null); // depends on control dependency: [if], data = [none] } else { // Create the blobs in parallel ArrayList<CompletableFuture<CompleteLease>> createFutures = new ArrayList<CompletableFuture<CompleteLease>>(); for (String id : partitionIds) { CompletableFuture<CompleteLease> oneCreate = CompletableFuture.supplyAsync(() -> { CompleteLease returnLease = null; try { returnLease = createLeaseIfNotExistsInternal(id, this.leaseOperationOptions); // depends on control dependency: [try], data = [none] } catch (URISyntaxException | IOException | StorageException e) { TRACE_LOGGER.error(this.hostContext.withHostAndPartition(id, "Exception creating lease - leaseContainerName: " + this.storageContainerName + " consumerGroupName: " + this.hostContext.getConsumerGroupName() + " storageBlobPrefix: " + this.storageBlobPrefix), e); throw LoggingUtils.wrapException(e, EventProcessorHostActionStrings.CREATING_LEASES); } // depends on control dependency: [catch], data = [none] return returnLease; // depends on control dependency: [for], data = [none] }, this.hostContext.getExecutor()); // depends on control dependency: [if], data = [none] createFutures.add(oneCreate); // depends on control dependency: [if], data = [none] } CompletableFuture<?>[] dummy = new CompletableFuture<?>[createFutures.size()]; future = CompletableFuture.allOf(createFutures.toArray(dummy)); // depends on control dependency: [if], data = [none] } } return future; } }
public class class_name { @Override public Long get(int partitionId) { LeaderCallBackInfo info = m_publicCache.get(partitionId); if (info == null) { return null; } return info.m_HSId; } }
public class class_name { @Override public Long get(int partitionId) { LeaderCallBackInfo info = m_publicCache.get(partitionId); if (info == null) { return null; // depends on control dependency: [if], data = [none] } return info.m_HSId; } }
public class class_name { public void marshall(SkillsStoreSkill skillsStoreSkill, ProtocolMarshaller protocolMarshaller) { if (skillsStoreSkill == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(skillsStoreSkill.getSkillId(), SKILLID_BINDING); protocolMarshaller.marshall(skillsStoreSkill.getSkillName(), SKILLNAME_BINDING); protocolMarshaller.marshall(skillsStoreSkill.getShortDescription(), SHORTDESCRIPTION_BINDING); protocolMarshaller.marshall(skillsStoreSkill.getIconUrl(), ICONURL_BINDING); protocolMarshaller.marshall(skillsStoreSkill.getSampleUtterances(), SAMPLEUTTERANCES_BINDING); protocolMarshaller.marshall(skillsStoreSkill.getSkillDetails(), SKILLDETAILS_BINDING); protocolMarshaller.marshall(skillsStoreSkill.getSupportsLinking(), SUPPORTSLINKING_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SkillsStoreSkill skillsStoreSkill, ProtocolMarshaller protocolMarshaller) { if (skillsStoreSkill == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(skillsStoreSkill.getSkillId(), SKILLID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(skillsStoreSkill.getSkillName(), SKILLNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(skillsStoreSkill.getShortDescription(), SHORTDESCRIPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(skillsStoreSkill.getIconUrl(), ICONURL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(skillsStoreSkill.getSampleUtterances(), SAMPLEUTTERANCES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(skillsStoreSkill.getSkillDetails(), SKILLDETAILS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(skillsStoreSkill.getSupportsLinking(), SUPPORTSLINKING_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Feature fromJson(@NonNull String json) { GsonBuilder gson = new GsonBuilder(); gson.registerTypeAdapterFactory(GeoJsonAdapterFactory.create()); gson.registerTypeAdapterFactory(GeometryAdapterFactory.create()); Feature feature = gson.create().fromJson(json, Feature.class); // Even thought properties are Nullable, // Feature object will be created with properties set to an empty object, // so that addProperties() would work if (feature.properties() != null) { return feature; } return new Feature(TYPE, feature.bbox(), feature.id(), feature.geometry(), new JsonObject()); } }
public class class_name { public static Feature fromJson(@NonNull String json) { GsonBuilder gson = new GsonBuilder(); gson.registerTypeAdapterFactory(GeoJsonAdapterFactory.create()); gson.registerTypeAdapterFactory(GeometryAdapterFactory.create()); Feature feature = gson.create().fromJson(json, Feature.class); // Even thought properties are Nullable, // Feature object will be created with properties set to an empty object, // so that addProperties() would work if (feature.properties() != null) { return feature; // depends on control dependency: [if], data = [none] } return new Feature(TYPE, feature.bbox(), feature.id(), feature.geometry(), new JsonObject()); } }
public class class_name { @Override ConfigConcatenation relativized(Path prefix) { List<AbstractConfigValue> newPieces = new ArrayList<AbstractConfigValue>(); for (AbstractConfigValue p : pieces) { newPieces.add(p.relativized(prefix)); } return new ConfigConcatenation(origin(), newPieces); } }
public class class_name { @Override ConfigConcatenation relativized(Path prefix) { List<AbstractConfigValue> newPieces = new ArrayList<AbstractConfigValue>(); for (AbstractConfigValue p : pieces) { newPieces.add(p.relativized(prefix)); // depends on control dependency: [for], data = [p] } return new ConfigConcatenation(origin(), newPieces); } }
public class class_name { public void setStorage(java.util.Collection<ValidStorageOptions> storage) { if (storage == null) { this.storage = null; return; } this.storage = new java.util.ArrayList<ValidStorageOptions>(storage); } }
public class class_name { public void setStorage(java.util.Collection<ValidStorageOptions> storage) { if (storage == null) { this.storage = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.storage = new java.util.ArrayList<ValidStorageOptions>(storage); } }
public class class_name { public void cleanup() { managers.clear(); for (BeanManagerImpl beanManager : beanDeploymentArchives.values()) { beanManager.cleanup(); } beanDeploymentArchives.clear(); deploymentServices.cleanup(); deploymentManager.cleanup(); instance.clear(contextId); } }
public class class_name { public void cleanup() { managers.clear(); for (BeanManagerImpl beanManager : beanDeploymentArchives.values()) { beanManager.cleanup(); // depends on control dependency: [for], data = [beanManager] } beanDeploymentArchives.clear(); deploymentServices.cleanup(); deploymentManager.cleanup(); instance.clear(contextId); } }
public class class_name { private boolean validBatchGetRequest(Map<Class<?>, List<KeyPair>> itemsToGet) { if (itemsToGet == null || itemsToGet.size() == 0) { return false; } for (Class<?> clazz : itemsToGet.keySet()) { if (itemsToGet.get(clazz) != null && itemsToGet.get(clazz).size() > 0) { return true; } } return false; } }
public class class_name { private boolean validBatchGetRequest(Map<Class<?>, List<KeyPair>> itemsToGet) { if (itemsToGet == null || itemsToGet.size() == 0) { return false; // depends on control dependency: [if], data = [none] } for (Class<?> clazz : itemsToGet.keySet()) { if (itemsToGet.get(clazz) != null && itemsToGet.get(clazz).size() > 0) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { private final void getFormFields(Node parent, Map<String, String> formfields) { String method = "getFormFields(Node parent, Map formfields)"; if (logger.isDebugEnabled()) { logger.debug(enter(method)); } NodeList children = parent.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); String tag = child.getNodeName(); if ("input".equalsIgnoreCase(tag)) { NamedNodeMap attributes = child.getAttributes(); Node typeNode = attributes.getNamedItem("type"); String type = typeNode.getNodeValue(); Node nameNode = attributes.getNamedItem("name"); String name = nameNode.getNodeValue(); Node valueNode = attributes.getNamedItem("value"); String value = ""; if (valueNode != null) { value = valueNode.getNodeValue(); } if ("hidden".equalsIgnoreCase(type) && value != null) { if (logger.isDebugEnabled()) { logger.debug(format("capturing hidden fields", name, value)); } formfields.put(name, value); } } getFormFields(child, formfields); } if (logger.isDebugEnabled()) { logger.debug(exit(method)); } } }
public class class_name { private final void getFormFields(Node parent, Map<String, String> formfields) { String method = "getFormFields(Node parent, Map formfields)"; if (logger.isDebugEnabled()) { logger.debug(enter(method)); // depends on control dependency: [if], data = [none] } NodeList children = parent.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); String tag = child.getNodeName(); if ("input".equalsIgnoreCase(tag)) { NamedNodeMap attributes = child.getAttributes(); Node typeNode = attributes.getNamedItem("type"); String type = typeNode.getNodeValue(); Node nameNode = attributes.getNamedItem("name"); String name = nameNode.getNodeValue(); Node valueNode = attributes.getNamedItem("value"); String value = ""; if (valueNode != null) { value = valueNode.getNodeValue(); // depends on control dependency: [if], data = [none] } if ("hidden".equalsIgnoreCase(type) && value != null) { if (logger.isDebugEnabled()) { logger.debug(format("capturing hidden fields", name, value)); // depends on control dependency: [if], data = [none] } formfields.put(name, value); // depends on control dependency: [if], data = [none] } } getFormFields(child, formfields); // depends on control dependency: [for], data = [none] } if (logger.isDebugEnabled()) { logger.debug(exit(method)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void streamCopy(final URL url, final FileChannel out, final ProgressBar progressBar) throws IOException { NullArgumentException.validateNotNull(url, "URL"); InputStream is = null; try { is = url.openStream(); streamCopy(is, out, progressBar); } finally { if (is != null) { is.close(); } } } }
public class class_name { public static void streamCopy(final URL url, final FileChannel out, final ProgressBar progressBar) throws IOException { NullArgumentException.validateNotNull(url, "URL"); InputStream is = null; try { is = url.openStream(); streamCopy(is, out, progressBar); } finally { if (is != null) { is.close(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void requestPermissionsToSystem(Collection<String> permissions) { if (!isShowingNativeDialog.get()) { androidPermissionService.requestPermissions(activity, permissions.toArray(new String[permissions.size()]), PERMISSIONS_REQUEST_CODE); } isShowingNativeDialog.set(true); } }
public class class_name { private void requestPermissionsToSystem(Collection<String> permissions) { if (!isShowingNativeDialog.get()) { androidPermissionService.requestPermissions(activity, permissions.toArray(new String[permissions.size()]), PERMISSIONS_REQUEST_CODE); // depends on control dependency: [if], data = [none] } isShowingNativeDialog.set(true); } }
public class class_name { public void removeDictionary(boolean isRemoveSegDict) { if(cws != null && isRemoveSegDict) cws.removeDictionary(); if(oldfeaturePipe != null){ featurePipe = oldfeaturePipe; } LinearViterbi dv = new LinearViterbi( (LinearViterbi) getClassifier().getInferencer()); getClassifier().setInferencer(dv); dictPipe = null; oldfeaturePipe = null; } }
public class class_name { public void removeDictionary(boolean isRemoveSegDict) { if(cws != null && isRemoveSegDict) cws.removeDictionary(); if(oldfeaturePipe != null){ featurePipe = oldfeaturePipe; // depends on control dependency: [if], data = [none] } LinearViterbi dv = new LinearViterbi( (LinearViterbi) getClassifier().getInferencer()); getClassifier().setInferencer(dv); dictPipe = null; oldfeaturePipe = null; } }
public class class_name { public Properties generateProperties() { Properties result = new Properties(); if (proto == null) { throw new RuntimeException("no protocol selected"); } String protocol = proto.toLowerCase(); setProperty(result, "mail.store.protocol", protocol); setProperty(result, "mail." + protocol + ".host", host); setProperty(result, "mail.username", user); setProperty(result, "mail.password", pass); if (port != 0) { setProperty(result, "mail." + protocol + ".port", Integer.toString(port)); } if (ssl) { setProperty(result, "mail." + protocol + ".ssl", "true"); } if (protocol.equals("pop3")) { setProperty(result, "mail.inbox", "INBOX"); } else { if (inbox == null) { throw new RuntimeException("no inbox selected"); } setProperty(result, "mail.inbox", inbox); } return result; } }
public class class_name { public Properties generateProperties() { Properties result = new Properties(); if (proto == null) { throw new RuntimeException("no protocol selected"); } String protocol = proto.toLowerCase(); setProperty(result, "mail.store.protocol", protocol); setProperty(result, "mail." + protocol + ".host", host); setProperty(result, "mail.username", user); setProperty(result, "mail.password", pass); if (port != 0) { setProperty(result, "mail." + protocol + ".port", Integer.toString(port)); // depends on control dependency: [if], data = [(port] } if (ssl) { setProperty(result, "mail." + protocol + ".ssl", "true"); // depends on control dependency: [if], data = [none] } if (protocol.equals("pop3")) { setProperty(result, "mail.inbox", "INBOX"); // depends on control dependency: [if], data = [none] } else { if (inbox == null) { throw new RuntimeException("no inbox selected"); } setProperty(result, "mail.inbox", inbox); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { @Override public synchronized void start(StartContext context) throws StartException { if (createQueue) { try { final ActiveMQServer server = this.activeMQServerSupplier.get(); MessagingLogger.ROOT_LOGGER.debugf("Deploying queue on server %s with address: %s , name: %s, filter: %s ands durable: %s, temporary: %s", server.getNodeID(), new SimpleString(queueConfiguration.getAddress()), new SimpleString(queueConfiguration.getName()), SimpleString.toSimpleString(queueConfiguration.getFilterString()), queueConfiguration.isDurable(), temporary); final SimpleString resourceName = new SimpleString(queueConfiguration.getName()); final SimpleString address = new SimpleString(queueConfiguration.getAddress()); final SimpleString filterString = SimpleString.toSimpleString(queueConfiguration.getFilterString()); server.createQueue(address, queueConfiguration.getRoutingType(), resourceName, filterString, queueConfiguration.isDurable(), temporary); } catch (Exception e) { throw new StartException(e); } } } }
public class class_name { @Override public synchronized void start(StartContext context) throws StartException { if (createQueue) { try { final ActiveMQServer server = this.activeMQServerSupplier.get(); MessagingLogger.ROOT_LOGGER.debugf("Deploying queue on server %s with address: %s , name: %s, filter: %s ands durable: %s, temporary: %s", server.getNodeID(), new SimpleString(queueConfiguration.getAddress()), new SimpleString(queueConfiguration.getName()), SimpleString.toSimpleString(queueConfiguration.getFilterString()), queueConfiguration.isDurable(), temporary); // depends on control dependency: [try], data = [none] final SimpleString resourceName = new SimpleString(queueConfiguration.getName()); final SimpleString address = new SimpleString(queueConfiguration.getAddress()); final SimpleString filterString = SimpleString.toSimpleString(queueConfiguration.getFilterString()); server.createQueue(address, queueConfiguration.getRoutingType(), resourceName, filterString, queueConfiguration.isDurable(), temporary); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new StartException(e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public Class<?> getBody(String message) { final Set<IdentifierLine> identifierLines = this.definitions.keySet(); final IdentifierLine messageId = new IdentifierLine(); for(IdentifierLine id : identifierLines){ final Map<Integer, String> mapIds = id.getMapIds(); final Set<Integer> keys = mapIds.keySet(); for (Integer startPosition : keys){ final String textId = mapIds.get(startPosition); int sizeText = textId.length(); int finalPosition = startPosition + sizeText; if (finalPosition > message.length()){ break; } messageId.putId(startPosition, message.substring(startPosition, finalPosition)); } if (id.equals(messageId)){ this.body = this.definitions.get(messageId); break; }else{ messageId.getMapIds().clear(); } } if (this.body == null){ throw new FFPojoException(String.format("No class matches with the line starting with: %s ", getStartWithText(message))); } return this.body; } }
public class class_name { public Class<?> getBody(String message) { final Set<IdentifierLine> identifierLines = this.definitions.keySet(); final IdentifierLine messageId = new IdentifierLine(); for(IdentifierLine id : identifierLines){ final Map<Integer, String> mapIds = id.getMapIds(); final Set<Integer> keys = mapIds.keySet(); for (Integer startPosition : keys){ final String textId = mapIds.get(startPosition); int sizeText = textId.length(); int finalPosition = startPosition + sizeText; if (finalPosition > message.length()){ break; } messageId.putId(startPosition, message.substring(startPosition, finalPosition)); // depends on control dependency: [for], data = [startPosition] } if (id.equals(messageId)){ this.body = this.definitions.get(messageId); // depends on control dependency: [if], data = [none] break; }else{ messageId.getMapIds().clear(); // depends on control dependency: [if], data = [none] } } if (this.body == null){ throw new FFPojoException(String.format("No class matches with the line starting with: %s ", getStartWithText(message))); } return this.body; } }
public class class_name { private void storeFilters() { final Map<String, TableFilter> sessFilter = new HashMap<>(); for (final Entry<String, TableFilter> entry : this.filters.entrySet()) { sessFilter.put(entry.getKey(), entry.getValue()); } try { Context.getThreadContext().setSessionAttribute(getCacheKey(UITable.UserCacheKey.FILTER), sessFilter); } catch (final EFapsException e) { UITable.LOG.error("Error storing Filtermap for Table called by Command with UUID: {}", getCommandUUID(), e); } } }
public class class_name { private void storeFilters() { final Map<String, TableFilter> sessFilter = new HashMap<>(); for (final Entry<String, TableFilter> entry : this.filters.entrySet()) { sessFilter.put(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } try { Context.getThreadContext().setSessionAttribute(getCacheKey(UITable.UserCacheKey.FILTER), sessFilter); // depends on control dependency: [try], data = [none] } catch (final EFapsException e) { UITable.LOG.error("Error storing Filtermap for Table called by Command with UUID: {}", getCommandUUID(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public JoinDomainRequest withDomainControllers(String... domainControllers) { if (this.domainControllers == null) { setDomainControllers(new com.amazonaws.internal.SdkInternalList<String>(domainControllers.length)); } for (String ele : domainControllers) { this.domainControllers.add(ele); } return this; } }
public class class_name { public JoinDomainRequest withDomainControllers(String... domainControllers) { if (this.domainControllers == null) { setDomainControllers(new com.amazonaws.internal.SdkInternalList<String>(domainControllers.length)); // depends on control dependency: [if], data = [none] } for (String ele : domainControllers) { this.domainControllers.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private View inflateButtonBar() { if (getRootView() != null) { if (buttonBarContainer == null) { LayoutInflater layoutInflater = LayoutInflater.from(getContext()); buttonBarContainer = (ViewGroup) layoutInflater .inflate(R.layout.button_bar_container, getRootView(), false); buttonBarDivider = buttonBarContainer.findViewById(R.id.button_bar_divider); } if (buttonBarContainer.getChildCount() > 1) { buttonBarContainer.removeViewAt(1); } if (customButtonBarView != null) { buttonBarContainer.addView(customButtonBarView); } else if (customButtonBarViewId != -1) { LayoutInflater layoutInflater = LayoutInflater.from(getContext()); View view = layoutInflater.inflate(customButtonBarViewId, buttonBarContainer, false); buttonBarContainer.addView(view); } else { LayoutInflater layoutInflater = LayoutInflater.from(getContext()); View view = layoutInflater.inflate( stackButtons ? R.layout.stacked_button_bar : R.layout.horizontal_button_bar, buttonBarContainer, false); buttonBarContainer.addView(view); } View positiveButtonView = buttonBarContainer.findViewById(android.R.id.button1); View negativeButtonView = buttonBarContainer.findViewById(android.R.id.button2); View neutralButtonView = buttonBarContainer.findViewById(android.R.id.button3); positiveButton = positiveButtonView instanceof Button ? (Button) positiveButtonView : null; negativeButton = negativeButtonView instanceof Button ? (Button) negativeButtonView : null; neutralButton = neutralButtonView instanceof Button ? (Button) neutralButtonView : null; return buttonBarContainer; } return null; } }
public class class_name { private View inflateButtonBar() { if (getRootView() != null) { if (buttonBarContainer == null) { LayoutInflater layoutInflater = LayoutInflater.from(getContext()); buttonBarContainer = (ViewGroup) layoutInflater .inflate(R.layout.button_bar_container, getRootView(), false); // depends on control dependency: [if], data = [none] buttonBarDivider = buttonBarContainer.findViewById(R.id.button_bar_divider); // depends on control dependency: [if], data = [none] } if (buttonBarContainer.getChildCount() > 1) { buttonBarContainer.removeViewAt(1); // depends on control dependency: [if], data = [1)] } if (customButtonBarView != null) { buttonBarContainer.addView(customButtonBarView); // depends on control dependency: [if], data = [(customButtonBarView] } else if (customButtonBarViewId != -1) { LayoutInflater layoutInflater = LayoutInflater.from(getContext()); View view = layoutInflater.inflate(customButtonBarViewId, buttonBarContainer, false); buttonBarContainer.addView(view); // depends on control dependency: [if], data = [none] } else { LayoutInflater layoutInflater = LayoutInflater.from(getContext()); View view = layoutInflater.inflate( stackButtons ? R.layout.stacked_button_bar : R.layout.horizontal_button_bar, buttonBarContainer, false); buttonBarContainer.addView(view); // depends on control dependency: [if], data = [none] } View positiveButtonView = buttonBarContainer.findViewById(android.R.id.button1); View negativeButtonView = buttonBarContainer.findViewById(android.R.id.button2); View neutralButtonView = buttonBarContainer.findViewById(android.R.id.button3); positiveButton = positiveButtonView instanceof Button ? (Button) positiveButtonView : null; // depends on control dependency: [if], data = [none] negativeButton = negativeButtonView instanceof Button ? (Button) negativeButtonView : null; // depends on control dependency: [if], data = [none] neutralButton = neutralButtonView instanceof Button ? (Button) neutralButtonView : null; // depends on control dependency: [if], data = [none] return buttonBarContainer; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public CertificateRestoreParameters withCertificateBundleBackup(byte[] certificateBundleBackup) { if (certificateBundleBackup == null) { this.certificateBundleBackup = null; } else { this.certificateBundleBackup = Base64Url.encode(certificateBundleBackup); } return this; } }
public class class_name { public CertificateRestoreParameters withCertificateBundleBackup(byte[] certificateBundleBackup) { if (certificateBundleBackup == null) { this.certificateBundleBackup = null; // depends on control dependency: [if], data = [none] } else { this.certificateBundleBackup = Base64Url.encode(certificateBundleBackup); // depends on control dependency: [if], data = [(certificateBundleBackup] } return this; } }
public class class_name { public static Type extractTypeFromLambda( Class<?> baseClass, LambdaExecutable exec, int[] lambdaTypeArgumentIndices, int paramLen, int baseParametersLen) { Type output = exec.getParameterTypes()[paramLen - baseParametersLen + lambdaTypeArgumentIndices[0]]; for (int i = 1; i < lambdaTypeArgumentIndices.length; i++) { validateLambdaType(baseClass, output); output = extractTypeArgument(output, lambdaTypeArgumentIndices[i]); } validateLambdaType(baseClass, output); return output; } }
public class class_name { public static Type extractTypeFromLambda( Class<?> baseClass, LambdaExecutable exec, int[] lambdaTypeArgumentIndices, int paramLen, int baseParametersLen) { Type output = exec.getParameterTypes()[paramLen - baseParametersLen + lambdaTypeArgumentIndices[0]]; for (int i = 1; i < lambdaTypeArgumentIndices.length; i++) { validateLambdaType(baseClass, output); // depends on control dependency: [for], data = [none] output = extractTypeArgument(output, lambdaTypeArgumentIndices[i]); // depends on control dependency: [for], data = [i] } validateLambdaType(baseClass, output); return output; } }
public class class_name { public Iterable<Result<DeleteError>> removeObjects(final String bucketName, final Iterable<String> objectNames) { return new Iterable<Result<DeleteError>>() { @Override public Iterator<Result<DeleteError>> iterator() { return new Iterator<Result<DeleteError>>() { private Result<DeleteError> error; private Iterator<DeleteError> errorIterator; private boolean completed = false; private Iterator<String> objectNameIter = objectNames.iterator(); private synchronized void populate() { List<DeleteError> errorList = null; try { List<DeleteObject> objectList = new LinkedList<DeleteObject>(); int i = 0; while (objectNameIter.hasNext() && i < 1000) { objectList.add(new DeleteObject(objectNameIter.next())); i++; } if (i > 0) { errorList = removeObject(bucketName, objectList); } } catch (InvalidBucketNameException | NoSuchAlgorithmException | InsufficientDataException | IOException | InvalidKeyException | NoResponseException | XmlPullParserException | ErrorResponseException | InternalException e) { this.error = new Result<>(null, e); } finally { if (errorList != null) { this.errorIterator = errorList.iterator(); } else { this.errorIterator = new LinkedList<DeleteError>().iterator(); } } } @Override public boolean hasNext() { if (this.completed) { return false; } if (this.error == null && this.errorIterator == null) { populate(); } if (this.error == null && this.errorIterator != null && !this.errorIterator.hasNext()) { populate(); } if (this.error != null) { return true; } if (this.errorIterator.hasNext()) { return true; } this.completed = true; return false; } @Override public Result<DeleteError> next() { if (this.completed) { throw new NoSuchElementException(); } if (this.error == null && this.errorIterator == null) { populate(); } if (this.error == null && this.errorIterator != null && !this.errorIterator.hasNext()) { populate(); } if (this.error != null) { this.completed = true; return this.error; } if (this.errorIterator.hasNext()) { return new Result<>(this.errorIterator.next(), null); } this.completed = true; throw new NoSuchElementException(); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; } }
public class class_name { public Iterable<Result<DeleteError>> removeObjects(final String bucketName, final Iterable<String> objectNames) { return new Iterable<Result<DeleteError>>() { @Override public Iterator<Result<DeleteError>> iterator() { return new Iterator<Result<DeleteError>>() { private Result<DeleteError> error; private Iterator<DeleteError> errorIterator; private boolean completed = false; private Iterator<String> objectNameIter = objectNames.iterator(); private synchronized void populate() { List<DeleteError> errorList = null; try { List<DeleteObject> objectList = new LinkedList<DeleteObject>(); int i = 0; while (objectNameIter.hasNext() && i < 1000) { objectList.add(new DeleteObject(objectNameIter.next())); // depends on control dependency: [while], data = [none] i++; // depends on control dependency: [while], data = [none] } if (i > 0) { errorList = removeObject(bucketName, objectList); // depends on control dependency: [if], data = [none] } } catch (InvalidBucketNameException | NoSuchAlgorithmException | InsufficientDataException | IOException | InvalidKeyException | NoResponseException | XmlPullParserException | ErrorResponseException | InternalException e) { this.error = new Result<>(null, e); } finally { // depends on control dependency: [catch], data = [none] if (errorList != null) { this.errorIterator = errorList.iterator(); // depends on control dependency: [if], data = [none] } else { this.errorIterator = new LinkedList<DeleteError>().iterator(); // depends on control dependency: [if], data = [none] } } } @Override public boolean hasNext() { if (this.completed) { return false; // depends on control dependency: [if], data = [none] } if (this.error == null && this.errorIterator == null) { populate(); // depends on control dependency: [if], data = [none] } if (this.error == null && this.errorIterator != null && !this.errorIterator.hasNext()) { populate(); // depends on control dependency: [if], data = [none] } if (this.error != null) { return true; // depends on control dependency: [if], data = [none] } if (this.errorIterator.hasNext()) { return true; // depends on control dependency: [if], data = [none] } this.completed = true; return false; } @Override public Result<DeleteError> next() { if (this.completed) { throw new NoSuchElementException(); } if (this.error == null && this.errorIterator == null) { populate(); // depends on control dependency: [if], data = [none] } if (this.error == null && this.errorIterator != null && !this.errorIterator.hasNext()) { populate(); // depends on control dependency: [if], data = [none] } if (this.error != null) { this.completed = true; // depends on control dependency: [if], data = [none] return this.error; // depends on control dependency: [if], data = [none] } if (this.errorIterator.hasNext()) { return new Result<>(this.errorIterator.next(), null); // depends on control dependency: [if], data = [none] } this.completed = true; throw new NoSuchElementException(); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; } }
public class class_name { public static <T extends ImageBase<T>> void plus(T input, double value, T output) { if( input instanceof ImageGray) { if (GrayU8.class == input.getClass()) { PixelMath.plus((GrayU8) input, (int) value, (GrayU8) output); } else if (GrayS8.class == input.getClass()) { PixelMath.plus((GrayS8) input, (int) value, (GrayS8) output); } else if (GrayU16.class == input.getClass()) { PixelMath.plus((GrayU16) input, (int) value, (GrayU16) output); } else if (GrayS16.class == input.getClass()) { PixelMath.plus((GrayS16) input, (int) value, (GrayS16) output); } else if (GrayS32.class == input.getClass()) { PixelMath.plus((GrayS32) input, (int) value, (GrayS32) output); } else if (GrayS64.class == input.getClass()) { PixelMath.plus((GrayS64) input, (long) value, (GrayS64) output); } else if (GrayF32.class == input.getClass()) { PixelMath.plus((GrayF32) input, (float) value, (GrayF32) output); } else if (GrayF64.class == input.getClass()) { PixelMath.plus((GrayF64) input, value, (GrayF64) output); } else { throw new IllegalArgumentException("Unknown image Type: " + input.getClass().getSimpleName()); } } else if( input instanceof ImageInterleaved ) { if (InterleavedU8.class == input.getClass()) { PixelMath.plus((InterleavedU8) input, (int) value, (InterleavedU8) output); } else if (InterleavedS8.class == input.getClass()) { PixelMath.plus((InterleavedS8) input, (int) value, (InterleavedS8) output); } else if (InterleavedU16.class == input.getClass()) { PixelMath.plus((InterleavedU16) input, (int) value, (InterleavedU16) output); } else if (InterleavedS16.class == input.getClass()) { PixelMath.plus((InterleavedS16) input, (int) value, (InterleavedS16) output); } else if (InterleavedS32.class == input.getClass()) { PixelMath.plus((InterleavedS32) input, (int) value, (InterleavedS32) output); } else if (InterleavedS64.class == input.getClass()) { PixelMath.plus((InterleavedS64) input, (long) value, (InterleavedS64) output); } else if (InterleavedF32.class == input.getClass()) { PixelMath.plus((InterleavedF32) input, (float) value, (InterleavedF32) output); } else if (InterleavedF64.class == input.getClass()) { PixelMath.plus((InterleavedF64) input, value, (InterleavedF64) output); } else { throw new IllegalArgumentException("Unknown image Type: " + input.getClass().getSimpleName()); } } else { Planar in = (Planar)input; Planar out = (Planar)output; for (int i = 0; i < in.getNumBands(); i++) { plus(in.getBand(i),value,out.getBand(i)); } } } }
public class class_name { public static <T extends ImageBase<T>> void plus(T input, double value, T output) { if( input instanceof ImageGray) { if (GrayU8.class == input.getClass()) { PixelMath.plus((GrayU8) input, (int) value, (GrayU8) output); // depends on control dependency: [if], data = [none] } else if (GrayS8.class == input.getClass()) { PixelMath.plus((GrayS8) input, (int) value, (GrayS8) output); // depends on control dependency: [if], data = [none] } else if (GrayU16.class == input.getClass()) { PixelMath.plus((GrayU16) input, (int) value, (GrayU16) output); // depends on control dependency: [if], data = [none] } else if (GrayS16.class == input.getClass()) { PixelMath.plus((GrayS16) input, (int) value, (GrayS16) output); // depends on control dependency: [if], data = [none] } else if (GrayS32.class == input.getClass()) { PixelMath.plus((GrayS32) input, (int) value, (GrayS32) output); // depends on control dependency: [if], data = [none] } else if (GrayS64.class == input.getClass()) { PixelMath.plus((GrayS64) input, (long) value, (GrayS64) output); // depends on control dependency: [if], data = [none] } else if (GrayF32.class == input.getClass()) { PixelMath.plus((GrayF32) input, (float) value, (GrayF32) output); // depends on control dependency: [if], data = [none] } else if (GrayF64.class == input.getClass()) { PixelMath.plus((GrayF64) input, value, (GrayF64) output); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Unknown image Type: " + input.getClass().getSimpleName()); } } else if( input instanceof ImageInterleaved ) { if (InterleavedU8.class == input.getClass()) { PixelMath.plus((InterleavedU8) input, (int) value, (InterleavedU8) output); // depends on control dependency: [if], data = [none] } else if (InterleavedS8.class == input.getClass()) { PixelMath.plus((InterleavedS8) input, (int) value, (InterleavedS8) output); // depends on control dependency: [if], data = [none] } else if (InterleavedU16.class == input.getClass()) { PixelMath.plus((InterleavedU16) input, (int) value, (InterleavedU16) output); // depends on control dependency: [if], data = [none] } else if (InterleavedS16.class == input.getClass()) { PixelMath.plus((InterleavedS16) input, (int) value, (InterleavedS16) output); // depends on control dependency: [if], data = [none] } else if (InterleavedS32.class == input.getClass()) { PixelMath.plus((InterleavedS32) input, (int) value, (InterleavedS32) output); // depends on control dependency: [if], data = [none] } else if (InterleavedS64.class == input.getClass()) { PixelMath.plus((InterleavedS64) input, (long) value, (InterleavedS64) output); // depends on control dependency: [if], data = [none] } else if (InterleavedF32.class == input.getClass()) { PixelMath.plus((InterleavedF32) input, (float) value, (InterleavedF32) output); // depends on control dependency: [if], data = [none] } else if (InterleavedF64.class == input.getClass()) { PixelMath.plus((InterleavedF64) input, value, (InterleavedF64) output); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Unknown image Type: " + input.getClass().getSimpleName()); } } else { Planar in = (Planar)input; Planar out = (Planar)output; for (int i = 0; i < in.getNumBands(); i++) { plus(in.getBand(i),value,out.getBand(i)); // depends on control dependency: [for], data = [i] } } } }
public class class_name { public void normalizeCifar(File fileName) { DataSet result = new DataSet(); result.load(fileName); if (!meanStdStored && train) { uMean = Math.abs(uMean / numExamples); uStd = Math.sqrt(uStd); vMean = Math.abs(vMean / numExamples); vStd = Math.sqrt(vStd); // TODO find cleaner way to store and load (e.g. json or yaml) try { FileUtils.write(meanVarPath, uMean + "," + uStd + "," + vMean + "," + vStd); } catch (IOException e) { e.printStackTrace(); } meanStdStored = true; } else if (uMean == 0 && meanStdStored) { try { String[] values = FileUtils.readFileToString(meanVarPath).split(","); uMean = Double.parseDouble(values[0]); uStd = Double.parseDouble(values[1]); vMean = Double.parseDouble(values[2]); vStd = Double.parseDouble(values[3]); } catch (IOException e) { e.printStackTrace(); } } for (int i = 0; i < result.numExamples(); i++) { INDArray newFeatures = result.get(i).getFeatures(); newFeatures.tensorAlongDimension(0, new int[] {0, 2, 3}).divi(255); newFeatures.tensorAlongDimension(1, new int[] {0, 2, 3}).subi(uMean).divi(uStd); newFeatures.tensorAlongDimension(2, new int[] {0, 2, 3}).subi(vMean).divi(vStd); result.get(i).setFeatures(newFeatures); } result.save(fileName); } }
public class class_name { public void normalizeCifar(File fileName) { DataSet result = new DataSet(); result.load(fileName); if (!meanStdStored && train) { uMean = Math.abs(uMean / numExamples); // depends on control dependency: [if], data = [none] uStd = Math.sqrt(uStd); // depends on control dependency: [if], data = [none] vMean = Math.abs(vMean / numExamples); // depends on control dependency: [if], data = [none] vStd = Math.sqrt(vStd); // depends on control dependency: [if], data = [none] // TODO find cleaner way to store and load (e.g. json or yaml) try { FileUtils.write(meanVarPath, uMean + "," + uStd + "," + vMean + "," + vStd); // depends on control dependency: [try], data = [none] } catch (IOException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] meanStdStored = true; // depends on control dependency: [if], data = [none] } else if (uMean == 0 && meanStdStored) { try { String[] values = FileUtils.readFileToString(meanVarPath).split(","); uMean = Double.parseDouble(values[0]); // depends on control dependency: [try], data = [none] uStd = Double.parseDouble(values[1]); // depends on control dependency: [try], data = [none] vMean = Double.parseDouble(values[2]); // depends on control dependency: [try], data = [none] vStd = Double.parseDouble(values[3]); // depends on control dependency: [try], data = [none] } catch (IOException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } for (int i = 0; i < result.numExamples(); i++) { INDArray newFeatures = result.get(i).getFeatures(); newFeatures.tensorAlongDimension(0, new int[] {0, 2, 3}).divi(255); // depends on control dependency: [for], data = [none] newFeatures.tensorAlongDimension(1, new int[] {0, 2, 3}).subi(uMean).divi(uStd); // depends on control dependency: [for], data = [none] newFeatures.tensorAlongDimension(2, new int[] {0, 2, 3}).subi(vMean).divi(vStd); // depends on control dependency: [for], data = [none] result.get(i).setFeatures(newFeatures); // depends on control dependency: [for], data = [i] } result.save(fileName); } }
public class class_name { public void startAdvertising() { if (mBeacon == null) { throw new NullPointerException("Beacon cannot be null. Set beacon before starting advertising"); } int manufacturerCode = mBeacon.getManufacturer(); int serviceUuid = -1; if (mBeaconParser.getServiceUuid() != null) { serviceUuid = mBeaconParser.getServiceUuid().intValue(); } if (mBeaconParser == null) { throw new NullPointerException("You must supply a BeaconParser instance to BeaconTransmitter."); } byte[] advertisingBytes = mBeaconParser.getBeaconAdvertisementData(mBeacon); String byteString = ""; for (int i= 0; i < advertisingBytes.length; i++) { byteString += String.format("%02X", advertisingBytes[i]); byteString += " "; } LogManager.d(TAG, "Starting advertising with ID1: %s ID2: %s ID3: %s and data: %s of size " + "%s", mBeacon.getId1(), mBeacon.getIdentifiers().size() > 1 ? mBeacon.getId2() : "", mBeacon.getIdentifiers().size() > 2 ? mBeacon.getId3() : "", byteString, advertisingBytes.length); try{ AdvertiseData.Builder dataBuilder = new AdvertiseData.Builder(); if (serviceUuid > 0) { byte[] serviceUuidBytes = new byte[] { (byte) (serviceUuid & 0xff), (byte) ((serviceUuid >> 8) & 0xff)}; ParcelUuid parcelUuid = parseUuidFrom(serviceUuidBytes); dataBuilder.addServiceData(parcelUuid, advertisingBytes); dataBuilder.addServiceUuid(parcelUuid); dataBuilder.setIncludeTxPowerLevel(false); dataBuilder.setIncludeDeviceName(false); } else { dataBuilder.addManufacturerData(manufacturerCode, advertisingBytes); } AdvertiseSettings.Builder settingsBuilder = new AdvertiseSettings.Builder(); settingsBuilder.setAdvertiseMode(mAdvertiseMode); settingsBuilder.setTxPowerLevel(mAdvertiseTxPowerLevel); settingsBuilder.setConnectable(mConnectable); mBluetoothLeAdvertiser.startAdvertising(settingsBuilder.build(), dataBuilder.build(), getAdvertiseCallback()); LogManager.d(TAG, "Started advertisement with callback: %s", getAdvertiseCallback()); } catch (Exception e){ LogManager.e(e, TAG, "Cannot start advertising due to exception"); } } }
public class class_name { public void startAdvertising() { if (mBeacon == null) { throw new NullPointerException("Beacon cannot be null. Set beacon before starting advertising"); } int manufacturerCode = mBeacon.getManufacturer(); int serviceUuid = -1; if (mBeaconParser.getServiceUuid() != null) { serviceUuid = mBeaconParser.getServiceUuid().intValue(); // depends on control dependency: [if], data = [none] } if (mBeaconParser == null) { throw new NullPointerException("You must supply a BeaconParser instance to BeaconTransmitter."); } byte[] advertisingBytes = mBeaconParser.getBeaconAdvertisementData(mBeacon); String byteString = ""; for (int i= 0; i < advertisingBytes.length; i++) { byteString += String.format("%02X", advertisingBytes[i]); // depends on control dependency: [for], data = [i] byteString += " "; // depends on control dependency: [for], data = [none] } LogManager.d(TAG, "Starting advertising with ID1: %s ID2: %s ID3: %s and data: %s of size " + "%s", mBeacon.getId1(), mBeacon.getIdentifiers().size() > 1 ? mBeacon.getId2() : "", mBeacon.getIdentifiers().size() > 2 ? mBeacon.getId3() : "", byteString, advertisingBytes.length); try{ AdvertiseData.Builder dataBuilder = new AdvertiseData.Builder(); if (serviceUuid > 0) { byte[] serviceUuidBytes = new byte[] { (byte) (serviceUuid & 0xff), (byte) ((serviceUuid >> 8) & 0xff)}; ParcelUuid parcelUuid = parseUuidFrom(serviceUuidBytes); dataBuilder.addServiceData(parcelUuid, advertisingBytes); // depends on control dependency: [if], data = [none] dataBuilder.addServiceUuid(parcelUuid); // depends on control dependency: [if], data = [none] dataBuilder.setIncludeTxPowerLevel(false); // depends on control dependency: [if], data = [none] dataBuilder.setIncludeDeviceName(false); // depends on control dependency: [if], data = [none] } else { dataBuilder.addManufacturerData(manufacturerCode, advertisingBytes); // depends on control dependency: [if], data = [none] } AdvertiseSettings.Builder settingsBuilder = new AdvertiseSettings.Builder(); settingsBuilder.setAdvertiseMode(mAdvertiseMode); // depends on control dependency: [try], data = [none] settingsBuilder.setTxPowerLevel(mAdvertiseTxPowerLevel); // depends on control dependency: [try], data = [none] settingsBuilder.setConnectable(mConnectable); // depends on control dependency: [try], data = [none] mBluetoothLeAdvertiser.startAdvertising(settingsBuilder.build(), dataBuilder.build(), getAdvertiseCallback()); // depends on control dependency: [try], data = [none] LogManager.d(TAG, "Started advertisement with callback: %s", getAdvertiseCallback()); // depends on control dependency: [try], data = [none] } catch (Exception e){ LogManager.e(e, TAG, "Cannot start advertising due to exception"); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public java.util.List<Change> getChanges() { if (changes == null) { changes = new com.amazonaws.internal.SdkInternalList<Change>(); } return changes; } }
public class class_name { public java.util.List<Change> getChanges() { if (changes == null) { changes = new com.amazonaws.internal.SdkInternalList<Change>(); // depends on control dependency: [if], data = [none] } return changes; } }
public class class_name { public boolean writeSilence(SIMPMessage m) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "writeSilence", new Object[] { m }); JsMessage jsMsg = m.getMessage(); // There may be Completed ticks after the Value, if so then // write these into the stream too long stamp = jsMsg.getGuaranteedValueValueTick(); long starts = jsMsg.getGuaranteedValueStartTick(); long ends = jsMsg.getGuaranteedValueEndTick(); if (ends < stamp) ends = stamp; TickRange tr = new TickRange( TickRange.Completed, starts, ends); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "writeSilence from: " + starts + " to " + ends + " on Stream " + streamID); } synchronized (this) { tr = oststream.writeCompletedRange(tr); long completedPrefix = oststream.getCompletedPrefix(); if (completedPrefix > oack) { oack = completedPrefix; } // Only want to send Silence if we know it has been missed // because we have sent something beyond it if (lastSent > ends) sendSilence(ends + 1, completedPrefix); // SIB0105 // Message silenced so reset the health state if (blockedStreamAlarm != null) blockedStreamAlarm.checkState(false); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writeSilence"); setLastSent(jsMsg.getGuaranteedValueEndTick()); return true; } }
public class class_name { public boolean writeSilence(SIMPMessage m) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "writeSilence", new Object[] { m }); JsMessage jsMsg = m.getMessage(); // There may be Completed ticks after the Value, if so then // write these into the stream too long stamp = jsMsg.getGuaranteedValueValueTick(); long starts = jsMsg.getGuaranteedValueStartTick(); long ends = jsMsg.getGuaranteedValueEndTick(); if (ends < stamp) ends = stamp; TickRange tr = new TickRange( TickRange.Completed, starts, ends); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "writeSilence from: " + starts + " to " + ends + " on Stream " + streamID); // depends on control dependency: [if], data = [none] } synchronized (this) { tr = oststream.writeCompletedRange(tr); long completedPrefix = oststream.getCompletedPrefix(); if (completedPrefix > oack) { oack = completedPrefix; // depends on control dependency: [if], data = [none] } // Only want to send Silence if we know it has been missed // because we have sent something beyond it if (lastSent > ends) sendSilence(ends + 1, completedPrefix); // SIB0105 // Message silenced so reset the health state if (blockedStreamAlarm != null) blockedStreamAlarm.checkState(false); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "writeSilence"); setLastSent(jsMsg.getGuaranteedValueEndTick()); return true; } }
public class class_name { private String readInput(PrintStream out, boolean echo) throws InterruptedException { StringBuilder sb = new StringBuilder(); Key inputKey; do { CommandOperation input = commandInvocation.getInput(); inputKey = input.getInputKey(); if (inputKey == Key.CTRL_C || inputKey == Key.CTRL_D) { throw new InterruptedException(inputKey.name()); } else if (inputKey == Key.BACKSPACE && sb.length() > 0) { sb.setLength(sb.length() - 1); if (echo) { // move cursor left out.print(Buffer.printAnsi("1D")); out.flush(); // overwrite it with space out.print(" "); // move cursor back again out.print(Buffer.printAnsi("1D")); out.flush(); } } else if (inputKey.isPrintable()) { if (echo) out.print(inputKey.getAsChar()); sb.append(inputKey.getAsChar()); } } while (inputKey != Key.ENTER && inputKey != Key.ENTER_2); return (sb.length() == 0) ? null : sb.toString(); } }
public class class_name { private String readInput(PrintStream out, boolean echo) throws InterruptedException { StringBuilder sb = new StringBuilder(); Key inputKey; do { CommandOperation input = commandInvocation.getInput(); inputKey = input.getInputKey(); if (inputKey == Key.CTRL_C || inputKey == Key.CTRL_D) { throw new InterruptedException(inputKey.name()); } else if (inputKey == Key.BACKSPACE && sb.length() > 0) { sb.setLength(sb.length() - 1); // depends on control dependency: [if], data = [none] if (echo) { // move cursor left out.print(Buffer.printAnsi("1D")); // depends on control dependency: [if], data = [none] out.flush(); // depends on control dependency: [if], data = [none] // overwrite it with space out.print(" "); // depends on control dependency: [if], data = [none] // move cursor back again out.print(Buffer.printAnsi("1D")); // depends on control dependency: [if], data = [none] out.flush(); // depends on control dependency: [if], data = [none] } } else if (inputKey.isPrintable()) { if (echo) out.print(inputKey.getAsChar()); sb.append(inputKey.getAsChar()); // depends on control dependency: [if], data = [none] } } while (inputKey != Key.ENTER && inputKey != Key.ENTER_2); return (sb.length() == 0) ? null : sb.toString(); } }
public class class_name { private static Method[] getDeclaredMethods(Class<?> clazz) { Method[] result = declaredMethodsCache.get(clazz); if (result == null) { result = clazz.getDeclaredMethods(); declaredMethodsCache.put(clazz, result); } return result; } }
public class class_name { private static Method[] getDeclaredMethods(Class<?> clazz) { Method[] result = declaredMethodsCache.get(clazz); if (result == null) { result = clazz.getDeclaredMethods(); // depends on control dependency: [if], data = [none] declaredMethodsCache.put(clazz, result); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { protected void stopping() { if (mementos != null) { for (int i = 0; i < mementos.length; i++) { mementos[i].restore(); } } } }
public class class_name { protected void stopping() { if (mementos != null) { for (int i = 0; i < mementos.length; i++) { mementos[i].restore(); // depends on control dependency: [for], data = [i] } } } }
public class class_name { @Override public Reader getResource(JoinableResourceBundle bundle, String resourceName, boolean processingBundle) { Reader rd = null; if (processingBundle) { String path = getCssPath(resourceName); rd = ((TextResourceReader) resourceReader).getResource(bundle, path, processingBundle); } return rd; } }
public class class_name { @Override public Reader getResource(JoinableResourceBundle bundle, String resourceName, boolean processingBundle) { Reader rd = null; if (processingBundle) { String path = getCssPath(resourceName); rd = ((TextResourceReader) resourceReader).getResource(bundle, path, processingBundle); // depends on control dependency: [if], data = [none] } return rd; } }
public class class_name { public static void onPushPromiseRead(Http2PushPromise http2PushPromise, Http2ClientChannel http2ClientChannel, OutboundMsgHolder outboundMsgHolder) { int streamId = http2PushPromise.getStreamId(); int promisedStreamId = http2PushPromise.getPromisedStreamId(); if (LOG.isDebugEnabled()) { LOG.debug("Received a push promise on channel: {} over stream id: {}, promisedStreamId: {}", http2ClientChannel, streamId, promisedStreamId); } if (outboundMsgHolder == null) { LOG.warn("Push promise received in channel: {} over invalid stream id : {}", http2ClientChannel, streamId); return; } http2ClientChannel.putPromisedMessage(promisedStreamId, outboundMsgHolder); http2PushPromise.setOutboundMsgHolder(outboundMsgHolder); outboundMsgHolder.addPromise(http2PushPromise); } }
public class class_name { public static void onPushPromiseRead(Http2PushPromise http2PushPromise, Http2ClientChannel http2ClientChannel, OutboundMsgHolder outboundMsgHolder) { int streamId = http2PushPromise.getStreamId(); int promisedStreamId = http2PushPromise.getPromisedStreamId(); if (LOG.isDebugEnabled()) { LOG.debug("Received a push promise on channel: {} over stream id: {}, promisedStreamId: {}", http2ClientChannel, streamId, promisedStreamId); // depends on control dependency: [if], data = [none] } if (outboundMsgHolder == null) { LOG.warn("Push promise received in channel: {} over invalid stream id : {}", http2ClientChannel, streamId); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } http2ClientChannel.putPromisedMessage(promisedStreamId, outboundMsgHolder); http2PushPromise.setOutboundMsgHolder(outboundMsgHolder); outboundMsgHolder.addPromise(http2PushPromise); } }
public class class_name { public static XMLBuilder2 create( String name, String namespaceURI, boolean enableExternalEntities, boolean isNamespaceAware) { try { return new XMLBuilder2( createDocumentImpl( name, namespaceURI, enableExternalEntities, isNamespaceAware)); } catch (ParserConfigurationException e) { throw wrapExceptionAsRuntimeException(e); } } }
public class class_name { public static XMLBuilder2 create( String name, String namespaceURI, boolean enableExternalEntities, boolean isNamespaceAware) { try { return new XMLBuilder2( createDocumentImpl( name, namespaceURI, enableExternalEntities, isNamespaceAware)); // depends on control dependency: [try], data = [none] } catch (ParserConfigurationException e) { throw wrapExceptionAsRuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static BritishCutoverDate ofYearDay(int prolepticYear, int dayOfYear) { if (prolepticYear < CUTOVER_YEAR || (prolepticYear == CUTOVER_YEAR && dayOfYear <= 246)) { JulianDate julian = JulianDate.ofYearDay(prolepticYear, dayOfYear); return new BritishCutoverDate(julian); } else if (prolepticYear == CUTOVER_YEAR) { LocalDate iso = LocalDate.ofYearDay(prolepticYear, dayOfYear + CUTOVER_DAYS); return new BritishCutoverDate(iso); } else { LocalDate iso = LocalDate.ofYearDay(prolepticYear, dayOfYear); return new BritishCutoverDate(iso); } } }
public class class_name { static BritishCutoverDate ofYearDay(int prolepticYear, int dayOfYear) { if (prolepticYear < CUTOVER_YEAR || (prolepticYear == CUTOVER_YEAR && dayOfYear <= 246)) { JulianDate julian = JulianDate.ofYearDay(prolepticYear, dayOfYear); return new BritishCutoverDate(julian); // depends on control dependency: [if], data = [none] } else if (prolepticYear == CUTOVER_YEAR) { LocalDate iso = LocalDate.ofYearDay(prolepticYear, dayOfYear + CUTOVER_DAYS); return new BritishCutoverDate(iso); // depends on control dependency: [if], data = [none] } else { LocalDate iso = LocalDate.ofYearDay(prolepticYear, dayOfYear); return new BritishCutoverDate(iso); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public final void makeOtherEntries(final Map<String, Object> pAddParam, final SalesReturn pEntity, final IRequestData pRequestData, final boolean pIsNew) throws Exception { String actionAdd = pRequestData.getParameter("actionAdd"); if ("makeAccEntries".equals(actionAdd) && pEntity.getReversedId() != null) { //reverse none-reversed lines: SalesReturnLine srl = new SalesReturnLine(); SalesReturn reversed = new SalesReturn(); reversed.setItsId(pEntity.getReversedId()); srl.setItsOwner(reversed); List<SalesReturnLine> reversedLines = getSrvOrm(). retrieveListForField(pAddParam, srl, "itsOwner"); String langDef = (String) pAddParam.get("langDef"); for (SalesReturnLine reversedLine : reversedLines) { if (reversedLine.getReversedId() == null) { if (!reversedLine.getItsQuantity() .equals(reversedLine.getTheRest())) { throw new ExceptionWithCode(PurchaseInvoice.SOURSE_IS_IN_USE, "There is withdrawals from this source!"); } SalesReturnLine reversingLine = new SalesReturnLine(); reversingLine.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); reversingLine.setReversedId(reversedLine.getItsId()); reversingLine.setWarehouseSite(reversedLine.getWarehouseSite()); reversingLine.setInvItem(reversedLine.getInvItem()); reversingLine.setUnitOfMeasure(reversedLine.getUnitOfMeasure()); reversingLine.setItsCost(reversedLine.getItsCost()); reversingLine.setItsQuantity(reversedLine.getItsQuantity() .negate()); reversingLine.setItsTotal(reversedLine.getItsTotal().negate()); reversingLine.setSubtotal(reversedLine.getSubtotal().negate()); reversingLine.setTotalTaxes(reversedLine.getTotalTaxes().negate()); reversingLine.setTaxesDescription(reversedLine .getTaxesDescription()); reversingLine.setIsNew(true); reversingLine.setItsOwner(pEntity); reversingLine.setDescription(getSrvI18n() .getMsg("reversed_n", langDef) + reversedLine.getIdDatabaseBirth() + "-" + reversedLine.getItsId()); //local getSrvOrm().insertEntity(pAddParam, reversingLine); reversingLine.setIsNew(false); getSrvWarehouseEntry().load(pAddParam, reversingLine, reversingLine.getWarehouseSite()); String descr; if (reversedLine.getDescription() == null) { descr = ""; } else { descr = reversedLine.getDescription(); } reversedLine.setDescription(descr + " " + getSrvI18n().getMsg("reversing_n", langDef) + reversingLine .getIdDatabaseBirth() + "-" + reversingLine.getItsId()); reversedLine.setReversedId(reversingLine.getItsId()); reversedLine.setTheRest(BigDecimal.ZERO); getSrvOrm().updateEntity(pAddParam, reversedLine); SalesReturnGoodsTaxLine pigtlt = new SalesReturnGoodsTaxLine(); pigtlt.setItsOwner(reversedLine); List<SalesReturnGoodsTaxLine> tls = getSrvOrm() .retrieveListForField(pAddParam, pigtlt, "itsOwner"); for (SalesReturnGoodsTaxLine pigtl : tls) { getSrvOrm().deleteEntity(pAddParam, pigtl); } } } SalesReturnTaxLine srtl = new SalesReturnTaxLine(); srtl.setItsOwner(reversed); List<SalesReturnTaxLine> reversedTaxLines = getSrvOrm(). retrieveListForField(pAddParam, srtl, "itsOwner"); for (SalesReturnTaxLine reversedLine : reversedTaxLines) { if (reversedLine.getReversedId() == null) { SalesReturnTaxLine reversingLine = new SalesReturnTaxLine(); reversingLine.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); reversingLine.setReversedId(reversedLine.getItsId()); reversingLine.setItsTotal(reversedLine.getItsTotal().negate()); reversingLine.setTax(reversedLine.getTax()); reversingLine.setIsNew(true); reversingLine.setItsOwner(pEntity); getSrvOrm().insertEntity(pAddParam, reversingLine); reversingLine.setIsNew(false); reversedLine.setReversedId(reversingLine.getItsId()); getSrvOrm().updateEntity(pAddParam, reversedLine); } } } } }
public class class_name { @Override public final void makeOtherEntries(final Map<String, Object> pAddParam, final SalesReturn pEntity, final IRequestData pRequestData, final boolean pIsNew) throws Exception { String actionAdd = pRequestData.getParameter("actionAdd"); if ("makeAccEntries".equals(actionAdd) && pEntity.getReversedId() != null) { //reverse none-reversed lines: SalesReturnLine srl = new SalesReturnLine(); SalesReturn reversed = new SalesReturn(); reversed.setItsId(pEntity.getReversedId()); srl.setItsOwner(reversed); List<SalesReturnLine> reversedLines = getSrvOrm(). retrieveListForField(pAddParam, srl, "itsOwner"); String langDef = (String) pAddParam.get("langDef"); for (SalesReturnLine reversedLine : reversedLines) { if (reversedLine.getReversedId() == null) { if (!reversedLine.getItsQuantity() .equals(reversedLine.getTheRest())) { throw new ExceptionWithCode(PurchaseInvoice.SOURSE_IS_IN_USE, "There is withdrawals from this source!"); } SalesReturnLine reversingLine = new SalesReturnLine(); reversingLine.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); // depends on control dependency: [if], data = [none] reversingLine.setReversedId(reversedLine.getItsId()); // depends on control dependency: [if], data = [none] reversingLine.setWarehouseSite(reversedLine.getWarehouseSite()); // depends on control dependency: [if], data = [none] reversingLine.setInvItem(reversedLine.getInvItem()); // depends on control dependency: [if], data = [none] reversingLine.setUnitOfMeasure(reversedLine.getUnitOfMeasure()); // depends on control dependency: [if], data = [none] reversingLine.setItsCost(reversedLine.getItsCost()); // depends on control dependency: [if], data = [none] reversingLine.setItsQuantity(reversedLine.getItsQuantity() .negate()); // depends on control dependency: [if], data = [none] reversingLine.setItsTotal(reversedLine.getItsTotal().negate()); // depends on control dependency: [if], data = [none] reversingLine.setSubtotal(reversedLine.getSubtotal().negate()); // depends on control dependency: [if], data = [none] reversingLine.setTotalTaxes(reversedLine.getTotalTaxes().negate()); // depends on control dependency: [if], data = [none] reversingLine.setTaxesDescription(reversedLine .getTaxesDescription()); // depends on control dependency: [if], data = [none] reversingLine.setIsNew(true); // depends on control dependency: [if], data = [none] reversingLine.setItsOwner(pEntity); // depends on control dependency: [if], data = [none] reversingLine.setDescription(getSrvI18n() .getMsg("reversed_n", langDef) + reversedLine.getIdDatabaseBirth() + "-" + reversedLine.getItsId()); //local // depends on control dependency: [if], data = [none] getSrvOrm().insertEntity(pAddParam, reversingLine); // depends on control dependency: [if], data = [none] reversingLine.setIsNew(false); // depends on control dependency: [if], data = [none] getSrvWarehouseEntry().load(pAddParam, reversingLine, reversingLine.getWarehouseSite()); // depends on control dependency: [if], data = [none] String descr; if (reversedLine.getDescription() == null) { descr = ""; // depends on control dependency: [if], data = [none] } else { descr = reversedLine.getDescription(); // depends on control dependency: [if], data = [none] } reversedLine.setDescription(descr + " " + getSrvI18n().getMsg("reversing_n", langDef) + reversingLine .getIdDatabaseBirth() + "-" + reversingLine.getItsId()); // depends on control dependency: [if], data = [none] reversedLine.setReversedId(reversingLine.getItsId()); // depends on control dependency: [if], data = [none] reversedLine.setTheRest(BigDecimal.ZERO); // depends on control dependency: [if], data = [none] getSrvOrm().updateEntity(pAddParam, reversedLine); // depends on control dependency: [if], data = [none] SalesReturnGoodsTaxLine pigtlt = new SalesReturnGoodsTaxLine(); pigtlt.setItsOwner(reversedLine); // depends on control dependency: [if], data = [none] List<SalesReturnGoodsTaxLine> tls = getSrvOrm() .retrieveListForField(pAddParam, pigtlt, "itsOwner"); for (SalesReturnGoodsTaxLine pigtl : tls) { getSrvOrm().deleteEntity(pAddParam, pigtl); // depends on control dependency: [for], data = [pigtl] } } } SalesReturnTaxLine srtl = new SalesReturnTaxLine(); srtl.setItsOwner(reversed); List<SalesReturnTaxLine> reversedTaxLines = getSrvOrm(). retrieveListForField(pAddParam, srtl, "itsOwner"); for (SalesReturnTaxLine reversedLine : reversedTaxLines) { if (reversedLine.getReversedId() == null) { SalesReturnTaxLine reversingLine = new SalesReturnTaxLine(); reversingLine.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); // depends on control dependency: [if], data = [none] reversingLine.setReversedId(reversedLine.getItsId()); // depends on control dependency: [if], data = [none] reversingLine.setItsTotal(reversedLine.getItsTotal().negate()); // depends on control dependency: [if], data = [none] reversingLine.setTax(reversedLine.getTax()); // depends on control dependency: [if], data = [none] reversingLine.setIsNew(true); // depends on control dependency: [if], data = [none] reversingLine.setItsOwner(pEntity); // depends on control dependency: [if], data = [none] getSrvOrm().insertEntity(pAddParam, reversingLine); // depends on control dependency: [if], data = [none] reversingLine.setIsNew(false); // depends on control dependency: [if], data = [none] reversedLine.setReversedId(reversingLine.getItsId()); // depends on control dependency: [if], data = [none] getSrvOrm().updateEntity(pAddParam, reversedLine); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public boolean init(String modelDir){ try { classifier = new Classification(modelDir); feaGen = new FeatureGenerator(); classifier.init(); return true; } catch(Exception e){ System.out.println("Error while initilizing classifier: " + e.getMessage()); return false; } } }
public class class_name { public boolean init(String modelDir){ try { classifier = new Classification(modelDir); // depends on control dependency: [try], data = [none] feaGen = new FeatureGenerator(); // depends on control dependency: [try], data = [none] classifier.init(); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch(Exception e){ System.out.println("Error while initilizing classifier: " + e.getMessage()); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private String readString() throws IOException { final int size = in.readByte(); if (size > 0) { final byte[] name = new byte[size]; if (in.read(name) != -1) { return new String(name, NetworkMessage.CHARSET); } } return null; } }
public class class_name { private String readString() throws IOException { final int size = in.readByte(); if (size > 0) { final byte[] name = new byte[size]; if (in.read(name) != -1) { return new String(name, NetworkMessage.CHARSET); // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public EClass getUniversalDateAndTimeStamp() { if (universalDateAndTimeStampEClass == null) { universalDateAndTimeStampEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(358); } return universalDateAndTimeStampEClass; } }
public class class_name { public EClass getUniversalDateAndTimeStamp() { if (universalDateAndTimeStampEClass == null) { universalDateAndTimeStampEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(358); // depends on control dependency: [if], data = [none] } return universalDateAndTimeStampEClass; } }
public class class_name { private static void appendAuthParam(StringBuilder sb, String key, String value) { if (sb.length() > 0) { sb.append(","); } sb.append(key); sb.append("=\""); sb.append(value); sb.append("\""); } }
public class class_name { private static void appendAuthParam(StringBuilder sb, String key, String value) { if (sb.length() > 0) { sb.append(","); // depends on control dependency: [if], data = [none] } sb.append(key); sb.append("=\""); sb.append(value); sb.append("\""); } }
public class class_name { public Rec setDataIndex(int iNodeIndex, Rec record) { if (record != null) { if (RESET_INDEX == iNodeIndex) { m_recTargetFieldList = record; if ((this.getNodeType() == MessageRecordDesc.NON_UNIQUE_NODE) && (!this.isSingleDetail(record))) record = this.createSubDataRecord(record); } else if (END_OF_NODES == iNodeIndex) { if (!this.isCurrentDataRecord(record)) { record = this.updateRecord(record, false); record.free(); } m_recTargetFieldList = null; } else { if (!this.isCurrentDataRecord(record)) { record = this.updateRecord(record, false); if (record != null) { try { if (record.getTable().hasNext()) { record = (Rec)record.getTable().next(); if (record != null) if (m_recTargetFieldList != null) if (record.getTableNames(false).equalsIgnoreCase(m_recTargetFieldList.getTableNames(false))) if (record.getTable().getHandle(0).equals(m_recTargetFieldList.getTable().getHandle(0))) if (m_recTargetFieldList.isModified()) { // I just read the same record as the target, make sure I have the current copy super.setDataIndex(iNodeIndex, record); // Set the node index before returning return m_recTargetFieldList; } } else record = null; // EOF } catch (DBException ex) { ex.printStackTrace(); record = null; } } } } } return super.setDataIndex(iNodeIndex, record); } }
public class class_name { public Rec setDataIndex(int iNodeIndex, Rec record) { if (record != null) { if (RESET_INDEX == iNodeIndex) { m_recTargetFieldList = record; // depends on control dependency: [if], data = [none] if ((this.getNodeType() == MessageRecordDesc.NON_UNIQUE_NODE) && (!this.isSingleDetail(record))) record = this.createSubDataRecord(record); } else if (END_OF_NODES == iNodeIndex) { if (!this.isCurrentDataRecord(record)) { record = this.updateRecord(record, false); // depends on control dependency: [if], data = [none] record.free(); // depends on control dependency: [if], data = [none] } m_recTargetFieldList = null; // depends on control dependency: [if], data = [none] } else { if (!this.isCurrentDataRecord(record)) { record = this.updateRecord(record, false); // depends on control dependency: [if], data = [none] if (record != null) { try { if (record.getTable().hasNext()) { record = (Rec)record.getTable().next(); // depends on control dependency: [if], data = [none] if (record != null) if (m_recTargetFieldList != null) if (record.getTableNames(false).equalsIgnoreCase(m_recTargetFieldList.getTableNames(false))) if (record.getTable().getHandle(0).equals(m_recTargetFieldList.getTable().getHandle(0))) if (m_recTargetFieldList.isModified()) { // I just read the same record as the target, make sure I have the current copy super.setDataIndex(iNodeIndex, record); // Set the node index before returning // depends on control dependency: [if], data = [none] return m_recTargetFieldList; // depends on control dependency: [if], data = [none] } } else record = null; // EOF } catch (DBException ex) { ex.printStackTrace(); record = null; } // depends on control dependency: [catch], data = [none] } } } } return super.setDataIndex(iNodeIndex, record); } }
public class class_name { static File preferencesFile() { final File userDir = new File(System.getProperty("user.home")); final File prefDir = (userDir.canWrite()) ? new File(userDir, ".acolyte") : null; if (prefDir != null && !prefDir.exists()) { prefDir.mkdir(); } // end of if return (prefDir != null && prefDir.canRead() && prefDir.canWrite()) ? new File(prefDir, "studio.properties") : null; } }
public class class_name { static File preferencesFile() { final File userDir = new File(System.getProperty("user.home")); final File prefDir = (userDir.canWrite()) ? new File(userDir, ".acolyte") : null; if (prefDir != null && !prefDir.exists()) { prefDir.mkdir(); // depends on control dependency: [if], data = [none] } // end of if return (prefDir != null && prefDir.canRead() && prefDir.canWrite()) ? new File(prefDir, "studio.properties") : null; } }
public class class_name { public int get(int key) { int addr = addr(hash(key)); while (true) { int tableKey = buffer.getInt(addr); if (key == tableKey) { return buffer.getInt(addr + 4); } if (tableKey == 0) { return 0; } addr += 8; } } }
public class class_name { public int get(int key) { int addr = addr(hash(key)); while (true) { int tableKey = buffer.getInt(addr); if (key == tableKey) { return buffer.getInt(addr + 4); // depends on control dependency: [if], data = [none] } if (tableKey == 0) { return 0; // depends on control dependency: [if], data = [none] } addr += 8; // depends on control dependency: [while], data = [none] } } }
public class class_name { protected String createSessionId(HttpResponse response) { StringBuilder sessionIdBuilder = new StringBuilder(); byte[] bytes = new byte[16]; secureRandom.nextBytes(bytes); for (byte b : bytes) { sessionIdBuilder.append(Integer.toHexString(b & 0xff)); } String sessionId = sessionIdBuilder.toString(); HttpCookie sessionCookie = new HttpCookie(idName(), sessionId); sessionCookie.setPath(path); sessionCookie.setHttpOnly(true); response.computeIfAbsent(HttpField.SET_COOKIE, CookieList::new) .value().add(sessionCookie); response.computeIfAbsent( HttpField.CACHE_CONTROL, CacheControlDirectives::new) .value().add(new Directive("no-cache", "SetCookie, Set-Cookie2")); return sessionId; } }
public class class_name { protected String createSessionId(HttpResponse response) { StringBuilder sessionIdBuilder = new StringBuilder(); byte[] bytes = new byte[16]; secureRandom.nextBytes(bytes); for (byte b : bytes) { sessionIdBuilder.append(Integer.toHexString(b & 0xff)); // depends on control dependency: [for], data = [b] } String sessionId = sessionIdBuilder.toString(); HttpCookie sessionCookie = new HttpCookie(idName(), sessionId); sessionCookie.setPath(path); sessionCookie.setHttpOnly(true); response.computeIfAbsent(HttpField.SET_COOKIE, CookieList::new) .value().add(sessionCookie); response.computeIfAbsent( HttpField.CACHE_CONTROL, CacheControlDirectives::new) .value().add(new Directive("no-cache", "SetCookie, Set-Cookie2")); return sessionId; } }
public class class_name { public FwAssistDirection assistAssistDirection() { if (assistDirection != null) { return assistDirection; } synchronized (this) { if (assistDirection != null) { return assistDirection; } final FwAssistDirection direction = createAssistDirection(); prepareAssistDirection(direction); assistDirection = direction; } return assistDirection; } }
public class class_name { public FwAssistDirection assistAssistDirection() { if (assistDirection != null) { return assistDirection; // depends on control dependency: [if], data = [none] } synchronized (this) { if (assistDirection != null) { return assistDirection; // depends on control dependency: [if], data = [none] } final FwAssistDirection direction = createAssistDirection(); prepareAssistDirection(direction); assistDirection = direction; } return assistDirection; } }
public class class_name { public void restart() { if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"restart", "Start re-read of data"); } // Don't update length or limit because they were set by setContentLength() and // will not be reset when the data is re-read. total = 0; count = 0; pos = 0; // With F003449 obs should never be null if restart() is called. // However check for null to make code future proof. if (obs!=null) { obs.alertOpen(); } } }
public class class_name { public void restart() { if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"restart", "Start re-read of data"); // depends on control dependency: [if], data = [none] } // Don't update length or limit because they were set by setContentLength() and // will not be reset when the data is re-read. total = 0; count = 0; pos = 0; // With F003449 obs should never be null if restart() is called. // However check for null to make code future proof. if (obs!=null) { obs.alertOpen(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public java.util.List<PrincipalIdFormat> getPrincipals() { if (principals == null) { principals = new com.amazonaws.internal.SdkInternalList<PrincipalIdFormat>(); } return principals; } }
public class class_name { public java.util.List<PrincipalIdFormat> getPrincipals() { if (principals == null) { principals = new com.amazonaws.internal.SdkInternalList<PrincipalIdFormat>(); // depends on control dependency: [if], data = [none] } return principals; } }
public class class_name { public void setUp(int fragmentId, DrawerLayout drawerLayout) { mFragmentContainerView = getActivity().findViewById(fragmentId); mDrawerLayout = drawerLayout; mActionBarToolbar = (Toolbar) getActivity().findViewById(R.id.toolbar); // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // set up the drawer's list view with items and click listener // ActionBarDrawerToggle ties together the the proper interactions // between the navigation drawer and the action bar app icon. mDrawerToggle = new JToggle( getActivity(), /* host Activity */ mDrawerLayout, /* DrawerLayout object */ mActionBarToolbar, /* nav drawer image to replace 'Up' caret */ R.string.navigation_drawer_open, /* "open drawer" description for accessibility */ R.string.navigation_drawer_close /* "close drawer" description for accessibility */ ) { @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); if (!isAdded()) { return; } getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() } @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); if (!isAdded()) { return; } if (!mUserLearnedDrawer) { // The user manually opened the drawer; store this flag to prevent auto-showing // the navigation drawer automatically in the future. mUserLearnedDrawer = true; SharedPreferences sp = PreferenceManager .getDefaultSharedPreferences(getActivity()); sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply(); } getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() } }; // If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer, // per the navigation drawer design guidelines. if (!mUserLearnedDrawer && !mFromSavedInstanceState) { mDrawerLayout.openDrawer(mFragmentContainerView); } // Defer code dependent on restoration of previous instance state. mDrawerLayout.post(new Runnable() { @Override public void run() { mDrawerToggle.syncState(); } }); mDrawerLayout.setDrawerListener(mDrawerToggle); } }
public class class_name { public void setUp(int fragmentId, DrawerLayout drawerLayout) { mFragmentContainerView = getActivity().findViewById(fragmentId); mDrawerLayout = drawerLayout; mActionBarToolbar = (Toolbar) getActivity().findViewById(R.id.toolbar); // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // set up the drawer's list view with items and click listener // ActionBarDrawerToggle ties together the the proper interactions // between the navigation drawer and the action bar app icon. mDrawerToggle = new JToggle( getActivity(), /* host Activity */ mDrawerLayout, /* DrawerLayout object */ mActionBarToolbar, /* nav drawer image to replace 'Up' caret */ R.string.navigation_drawer_open, /* "open drawer" description for accessibility */ R.string.navigation_drawer_close /* "close drawer" description for accessibility */ ) { @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); if (!isAdded()) { return; // depends on control dependency: [if], data = [none] } getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() } @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); if (!isAdded()) { return; // depends on control dependency: [if], data = [none] } if (!mUserLearnedDrawer) { // The user manually opened the drawer; store this flag to prevent auto-showing // the navigation drawer automatically in the future. mUserLearnedDrawer = true; // depends on control dependency: [if], data = [none] SharedPreferences sp = PreferenceManager .getDefaultSharedPreferences(getActivity()); sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply(); // depends on control dependency: [if], data = [none] } getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() } }; // If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer, // per the navigation drawer design guidelines. if (!mUserLearnedDrawer && !mFromSavedInstanceState) { mDrawerLayout.openDrawer(mFragmentContainerView); // depends on control dependency: [if], data = [none] } // Defer code dependent on restoration of previous instance state. mDrawerLayout.post(new Runnable() { @Override public void run() { mDrawerToggle.syncState(); } }); mDrawerLayout.setDrawerListener(mDrawerToggle); } }
public class class_name { @Override public Object getParam(String name) { String sname = "get" + name.substring(0, 1).toUpperCase() + name.substring(1); try { Method m = getClass().getMethod(sname); return m.invoke(this); } catch (NoSuchMethodException e) { return null; } catch (SecurityException e) { e.printStackTrace(); return null; } catch (IllegalAccessException e) { e.printStackTrace(); return null; } catch (IllegalArgumentException e) { e.printStackTrace(); return null; } catch (InvocationTargetException e) { e.printStackTrace(); return null; } } }
public class class_name { @Override public Object getParam(String name) { String sname = "get" + name.substring(0, 1).toUpperCase() + name.substring(1); try { Method m = getClass().getMethod(sname); return m.invoke(this); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { return null; } catch (SecurityException e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); return null; } catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); return null; } catch (IllegalArgumentException e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); return null; } catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { final public void Or() throws ParseException { And(); label_7: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OR0: case OR1: ; break; default: jj_la1[10] = jj_gen; break label_7; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OR0: jj_consume_token(OR0); break; case OR1: jj_consume_token(OR1); break; default: jj_la1[11] = jj_gen; jj_consume_token(-1); throw new ParseException(); } AstOr jjtn001 = new AstOr(JJTOR); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { And(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } } } }
public class class_name { final public void Or() throws ParseException { And(); label_7: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OR0: case OR1: ; break; default: jj_la1[10] = jj_gen; break label_7; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OR0: jj_consume_token(OR0); break; case OR1: jj_consume_token(OR1); break; default: jj_la1[11] = jj_gen; jj_consume_token(-1); throw new ParseException(); } AstOr jjtn001 = new AstOr(JJTOR); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { And(); } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); // depends on control dependency: [if], data = [none] jjtc001 = false; // depends on control dependency: [if], data = [none] } else { jjtree.popNode(); // depends on control dependency: [if], data = [none] } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public String beginConsumption(HttpServletRequest req, String identityUrl, String returnToUrl, String realm) throws OpenIDConsumerException { List<DiscoveryInformation> discoveries; try { discoveries = consumerManager.discover(identityUrl); } catch (DiscoveryException e) { throw new OpenIDConsumerException("Error during discovery", e); } DiscoveryInformation information = consumerManager.associate(discoveries); req.getSession().setAttribute(DISCOVERY_INFO_KEY, information); AuthRequest authReq; try { authReq = consumerManager.authenticate(information, returnToUrl, realm); logger.debug("Looking up attribute fetch list for identifier: " + identityUrl); List<OpenIDAttribute> attributesToFetch = attributesToFetchFactory .createAttributeList(identityUrl); if (!attributesToFetch.isEmpty()) { req.getSession().setAttribute(ATTRIBUTE_LIST_KEY, attributesToFetch); FetchRequest fetchRequest = FetchRequest.createFetchRequest(); for (OpenIDAttribute attr : attributesToFetch) { if (logger.isDebugEnabled()) { logger.debug("Adding attribute " + attr.getType() + " to fetch request"); } fetchRequest.addAttribute(attr.getName(), attr.getType(), attr.isRequired(), attr.getCount()); } authReq.addExtension(fetchRequest); } } catch (MessageException e) { throw new OpenIDConsumerException( "Error processing ConsumerManager authentication", e); } catch (ConsumerException e) { throw new OpenIDConsumerException( "Error processing ConsumerManager authentication", e); } return authReq.getDestinationUrl(true); } }
public class class_name { public String beginConsumption(HttpServletRequest req, String identityUrl, String returnToUrl, String realm) throws OpenIDConsumerException { List<DiscoveryInformation> discoveries; try { discoveries = consumerManager.discover(identityUrl); } catch (DiscoveryException e) { throw new OpenIDConsumerException("Error during discovery", e); } DiscoveryInformation information = consumerManager.associate(discoveries); req.getSession().setAttribute(DISCOVERY_INFO_KEY, information); AuthRequest authReq; try { authReq = consumerManager.authenticate(information, returnToUrl, realm); logger.debug("Looking up attribute fetch list for identifier: " + identityUrl); List<OpenIDAttribute> attributesToFetch = attributesToFetchFactory .createAttributeList(identityUrl); if (!attributesToFetch.isEmpty()) { req.getSession().setAttribute(ATTRIBUTE_LIST_KEY, attributesToFetch); // depends on control dependency: [if], data = [none] FetchRequest fetchRequest = FetchRequest.createFetchRequest(); for (OpenIDAttribute attr : attributesToFetch) { if (logger.isDebugEnabled()) { logger.debug("Adding attribute " + attr.getType() + " to fetch request"); // depends on control dependency: [if], data = [none] } fetchRequest.addAttribute(attr.getName(), attr.getType(), attr.isRequired(), attr.getCount()); // depends on control dependency: [for], data = [attr] } authReq.addExtension(fetchRequest); // depends on control dependency: [if], data = [none] } } catch (MessageException e) { throw new OpenIDConsumerException( "Error processing ConsumerManager authentication", e); } catch (ConsumerException e) { throw new OpenIDConsumerException( "Error processing ConsumerManager authentication", e); } return authReq.getDestinationUrl(true); } }
public class class_name { @Override public ListenableFuture<CheckAndMutateRowResponse> checkAndMutateRowAsync( CheckAndMutateRowRequest request) { if (shouldOverrideAppProfile(request.getAppProfileId())) { request = request.toBuilder().setAppProfileId(clientDefaultAppProfileId).build(); } return createUnaryListener(request, checkAndMutateRpc, request.getTableName()).getAsyncResult(); } }
public class class_name { @Override public ListenableFuture<CheckAndMutateRowResponse> checkAndMutateRowAsync( CheckAndMutateRowRequest request) { if (shouldOverrideAppProfile(request.getAppProfileId())) { request = request.toBuilder().setAppProfileId(clientDefaultAppProfileId).build(); // depends on control dependency: [if], data = [none] } return createUnaryListener(request, checkAndMutateRpc, request.getTableName()).getAsyncResult(); } }
public class class_name { public void itemStateChanged(ItemEvent e) { ItemSelectable item = e.getItemSelectable(); if (item == lTable) { if (iSelectionStep == SELECT_SOURCE_TABLES) { String table = lTable.getSelectedItem(); int selected = ((Integer) e.getItem()).intValue(); for (int i = 0; i < tTable.size(); i++) { TransferTable t = (TransferTable) tTable.elementAt(i); if (t == null) { continue; } if (i == selected) { saveTable(); displayTable(t); updateEnabled(true); } } } } else { // it must be a checkbox saveTable(); updateEnabled(true); } } }
public class class_name { public void itemStateChanged(ItemEvent e) { ItemSelectable item = e.getItemSelectable(); if (item == lTable) { if (iSelectionStep == SELECT_SOURCE_TABLES) { String table = lTable.getSelectedItem(); int selected = ((Integer) e.getItem()).intValue(); for (int i = 0; i < tTable.size(); i++) { TransferTable t = (TransferTable) tTable.elementAt(i); if (t == null) { continue; } if (i == selected) { saveTable(); // depends on control dependency: [if], data = [none] displayTable(t); // depends on control dependency: [if], data = [none] updateEnabled(true); // depends on control dependency: [if], data = [none] } } } } else { // it must be a checkbox saveTable(); // depends on control dependency: [if], data = [none] updateEnabled(true); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String joinStrings(Collection<String> messages) { StringBuilder b = new StringBuilder(); for (String s : messages) { if (s == null || s.isEmpty()) { continue; } // Preserve new-lines in this event by replacing them // with "\r". Otherwise, they're processed as event // delimiters, resulting in unintentional multiple events. b.append(s.replaceAll("[\r\n]", "\r")).append('\n'); } return b.toString(); } }
public class class_name { private String joinStrings(Collection<String> messages) { StringBuilder b = new StringBuilder(); for (String s : messages) { if (s == null || s.isEmpty()) { continue; } // Preserve new-lines in this event by replacing them // with "\r". Otherwise, they're processed as event // delimiters, resulting in unintentional multiple events. b.append(s.replaceAll("[\r\n]", "\r")).append('\n'); // depends on control dependency: [for], data = [s] } return b.toString(); } }
public class class_name { @Override public boolean isCallerInRole(String role) { Subject callerSubject = getCallerSubject(); AuthorizationService authService = SecurityContextHelper.getAuthorizationService(); if (authService != null) { String appName = getApplicationName(); List<String> roles = new ArrayList<String>(); roles.add(role); return authService.isAuthorized(appName, roles, callerSubject); } return false; } }
public class class_name { @Override public boolean isCallerInRole(String role) { Subject callerSubject = getCallerSubject(); AuthorizationService authService = SecurityContextHelper.getAuthorizationService(); if (authService != null) { String appName = getApplicationName(); List<String> roles = new ArrayList<String>(); roles.add(role); // depends on control dependency: [if], data = [none] return authService.isAuthorized(appName, roles, callerSubject); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void marshall(GetRoutesRequest getRoutesRequest, ProtocolMarshaller protocolMarshaller) { if (getRoutesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getRoutesRequest.getApiId(), APIID_BINDING); protocolMarshaller.marshall(getRoutesRequest.getMaxResults(), MAXRESULTS_BINDING); protocolMarshaller.marshall(getRoutesRequest.getNextToken(), NEXTTOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetRoutesRequest getRoutesRequest, ProtocolMarshaller protocolMarshaller) { if (getRoutesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getRoutesRequest.getApiId(), APIID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getRoutesRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getRoutesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static ByteBuf copiedBuffer( CharSequence string, int offset, int length, Charset charset) { if (string == null) { throw new NullPointerException("string"); } if (length == 0) { return EMPTY_BUFFER; } if (string instanceof CharBuffer) { CharBuffer buf = (CharBuffer) string; if (buf.hasArray()) { return copiedBuffer( buf.array(), buf.arrayOffset() + buf.position() + offset, length, charset); } buf = buf.slice(); buf.limit(length); buf.position(offset); return copiedBuffer(buf, charset); } return copiedBuffer(CharBuffer.wrap(string, offset, offset + length), charset); } }
public class class_name { public static ByteBuf copiedBuffer( CharSequence string, int offset, int length, Charset charset) { if (string == null) { throw new NullPointerException("string"); } if (length == 0) { return EMPTY_BUFFER; // depends on control dependency: [if], data = [none] } if (string instanceof CharBuffer) { CharBuffer buf = (CharBuffer) string; if (buf.hasArray()) { return copiedBuffer( buf.array(), buf.arrayOffset() + buf.position() + offset, length, charset); // depends on control dependency: [if], data = [none] } buf = buf.slice(); // depends on control dependency: [if], data = [none] buf.limit(length); // depends on control dependency: [if], data = [none] buf.position(offset); // depends on control dependency: [if], data = [none] return copiedBuffer(buf, charset); // depends on control dependency: [if], data = [none] } return copiedBuffer(CharBuffer.wrap(string, offset, offset + length), charset); } }
public class class_name { public void add(ManagedObject managedObject, boolean requiresCurrentCheckpoint) throws ObjectManagerException { final String methodName = "add"; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, methodName, new Object[] { managedObject, new Boolean(requiresCurrentCheckpoint) }); // At recovery make sure the Token is in memory, if the Token was newly allocated it will already be in memory. Token inMemoryToken = (Token) inMemoryTokens.putIfAbsent(new Long(managedObject.owningToken.storedObjectIdentifier) , managedObject.owningToken); if (inMemoryToken == null) { synchronized (sequenceNumberLock) { // During recovery processing we may be given a sequence number to replace an object which never completed // an add operation in the previous run so make sure we do not reuse such a number again. if (managedObject.owningToken.storedObjectIdentifier > sequenceNumber) { sequenceNumber = Math.max(managedObject.owningToken.storedObjectIdentifier, sequenceNumber); if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, new Object[] { "sequenceNumber now", new Long(sequenceNumber) }); } // if (tokenToStore.storedObjectIdentifier > sequenceNumber). } // synchronized (sequenceNumberLock). } else { // The inMemoryToken must be the same Token. if (inMemoryToken != managedObject.owningToken) { ReplacementException replacementException = new ReplacementException(this, managedObject, managedObject.owningToken, inMemoryToken); ObjectManager.ffdc.processException(this, cclass, methodName, replacementException, "1:473:1.31"); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, "add", new Object[] { replacementException, managedObject, managedObject.owningToken, inMemoryToken }); throw replacementException; } // if (inMemoryToken != managedObject.owningToken). } // if (inMemoryToken == null). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName); } }
public class class_name { public void add(ManagedObject managedObject, boolean requiresCurrentCheckpoint) throws ObjectManagerException { final String methodName = "add"; if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, methodName, new Object[] { managedObject, new Boolean(requiresCurrentCheckpoint) }); // At recovery make sure the Token is in memory, if the Token was newly allocated it will already be in memory. Token inMemoryToken = (Token) inMemoryTokens.putIfAbsent(new Long(managedObject.owningToken.storedObjectIdentifier) , managedObject.owningToken); if (inMemoryToken == null) { synchronized (sequenceNumberLock) { // During recovery processing we may be given a sequence number to replace an object which never completed // an add operation in the previous run so make sure we do not reuse such a number again. if (managedObject.owningToken.storedObjectIdentifier > sequenceNumber) { sequenceNumber = Math.max(managedObject.owningToken.storedObjectIdentifier, sequenceNumber); // depends on control dependency: [if], data = [(managedObject.owningToken.storedObjectIdentifier] if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, new Object[] { "sequenceNumber now", new Long(sequenceNumber) }); } // if (tokenToStore.storedObjectIdentifier > sequenceNumber). } // synchronized (sequenceNumberLock). } else { // The inMemoryToken must be the same Token. if (inMemoryToken != managedObject.owningToken) { ReplacementException replacementException = new ReplacementException(this, managedObject, managedObject.owningToken, inMemoryToken); ObjectManager.ffdc.processException(this, cclass, methodName, replacementException, "1:473:1.31"); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, "add", new Object[] { replacementException, managedObject, managedObject.owningToken, inMemoryToken }); throw replacementException; } // if (inMemoryToken != managedObject.owningToken). } // if (inMemoryToken == null). if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, methodName); } }
public class class_name { public static<T extends ImageGray<T>> void histogram(Planar<T> image , Histogram_F64 histogram ) { if (image.getNumBands() != histogram.getDimensions()) throw new IllegalArgumentException("Number of bands in the image and histogram must be the same"); if( image.getBandType() == GrayU8.class ) { HistogramFeatureOps.histogram_U8((Planar<GrayU8>)image, histogram); } else if( image.getBandType() == GrayF32.class ) { HistogramFeatureOps.histogram_F32((Planar<GrayF32>)image, histogram); } else { throw new IllegalArgumentException("Umage type not yet supportd"); } } }
public class class_name { public static<T extends ImageGray<T>> void histogram(Planar<T> image , Histogram_F64 histogram ) { if (image.getNumBands() != histogram.getDimensions()) throw new IllegalArgumentException("Number of bands in the image and histogram must be the same"); if( image.getBandType() == GrayU8.class ) { HistogramFeatureOps.histogram_U8((Planar<GrayU8>)image, histogram); // depends on control dependency: [if], data = [none] } else if( image.getBandType() == GrayF32.class ) { HistogramFeatureOps.histogram_F32((Planar<GrayF32>)image, histogram); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Umage type not yet supportd"); } } }
public class class_name { private static void generateDelegateMethods(EclipseNode typeNode, List<BindingTuple> methods, DelegateReceiver delegateReceiver) { CompilationUnitDeclaration top = (CompilationUnitDeclaration) typeNode.top().get(); for (BindingTuple pair : methods) { EclipseNode annNode = typeNode.getAst().get(pair.responsible); MethodDeclaration method = createDelegateMethod(pair.fieldName, typeNode, pair, top.compilationResult, annNode, delegateReceiver); if (method != null) { SetGeneratedByVisitor visitor = new SetGeneratedByVisitor(annNode.get()); method.traverse(visitor, ((TypeDeclaration)typeNode.get()).scope); injectMethod(typeNode, method); } } } }
public class class_name { private static void generateDelegateMethods(EclipseNode typeNode, List<BindingTuple> methods, DelegateReceiver delegateReceiver) { CompilationUnitDeclaration top = (CompilationUnitDeclaration) typeNode.top().get(); for (BindingTuple pair : methods) { EclipseNode annNode = typeNode.getAst().get(pair.responsible); MethodDeclaration method = createDelegateMethod(pair.fieldName, typeNode, pair, top.compilationResult, annNode, delegateReceiver); if (method != null) { SetGeneratedByVisitor visitor = new SetGeneratedByVisitor(annNode.get()); method.traverse(visitor, ((TypeDeclaration)typeNode.get()).scope); // depends on control dependency: [if], data = [none] injectMethod(typeNode, method); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @ConditionalOnClass({MacAddress.class, PcapIf.class, PcapAddr.class, SockAddr.class, DeviceNotFoundException.class, PlatformNotSupportedException.class}) //@ConditionalOnBean(PcapIf.class) @Bean(MAC_ADDRESS_BEAN_NAME) public MacAddress macAddress(@Qualifier(PCAP_IF_BEAN_NAME) PcapIf pcapIf) throws PlatformNotSupportedException, DeviceNotFoundException, SocketException { MacAddress macAddress; if (pcapIf.isLoopback()) { macAddress = MacAddress.ZERO; if (LOGGER.isDebugEnabled()) { LOGGER.debug("No MAC address for loopback interface, use default address: {}.", macAddress); } return macAddress; } if (Platforms.isWindows()) { byte[] hardwareAddress = Jxnet.FindHardwareAddress(pcapIf.getName()); if (hardwareAddress != null && hardwareAddress.length == MacAddress.MAC_ADDRESS_LENGTH) { macAddress = MacAddress.valueOf(hardwareAddress); } else { throw new DeviceNotFoundException(); } } else { macAddress = MacAddress.fromNicName(pcapIf.getName()); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Mac address: {}.", macAddress); } return macAddress; } }
public class class_name { @ConditionalOnClass({MacAddress.class, PcapIf.class, PcapAddr.class, SockAddr.class, DeviceNotFoundException.class, PlatformNotSupportedException.class}) //@ConditionalOnBean(PcapIf.class) @Bean(MAC_ADDRESS_BEAN_NAME) public MacAddress macAddress(@Qualifier(PCAP_IF_BEAN_NAME) PcapIf pcapIf) throws PlatformNotSupportedException, DeviceNotFoundException, SocketException { MacAddress macAddress; if (pcapIf.isLoopback()) { macAddress = MacAddress.ZERO; if (LOGGER.isDebugEnabled()) { LOGGER.debug("No MAC address for loopback interface, use default address: {}.", macAddress); } return macAddress; } if (Platforms.isWindows()) { byte[] hardwareAddress = Jxnet.FindHardwareAddress(pcapIf.getName()); if (hardwareAddress != null && hardwareAddress.length == MacAddress.MAC_ADDRESS_LENGTH) { macAddress = MacAddress.valueOf(hardwareAddress); // depends on control dependency: [if], data = [none] } else { throw new DeviceNotFoundException(); } } else { macAddress = MacAddress.fromNicName(pcapIf.getName()); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Mac address: {}.", macAddress); } return macAddress; } }
public class class_name { void publish() { assert publishedFullRegistry != null : "Cannot write directly to main registry"; writeLock.lock(); try { if (!modified) { return; } publishedFullRegistry.writeLock.lock(); try { publishedFullRegistry.clear(true); copy(this, publishedFullRegistry); pendingRemoveCapabilities.clear(); pendingRemoveRequirements.clear(); modified = false; } finally { publishedFullRegistry.writeLock.unlock(); } } finally { writeLock.unlock(); } } }
public class class_name { void publish() { assert publishedFullRegistry != null : "Cannot write directly to main registry"; writeLock.lock(); try { if (!modified) { return; // depends on control dependency: [if], data = [none] } publishedFullRegistry.writeLock.lock(); // depends on control dependency: [try], data = [none] try { publishedFullRegistry.clear(true); // depends on control dependency: [try], data = [none] copy(this, publishedFullRegistry); // depends on control dependency: [try], data = [none] pendingRemoveCapabilities.clear(); // depends on control dependency: [try], data = [none] pendingRemoveRequirements.clear(); // depends on control dependency: [try], data = [none] modified = false; // depends on control dependency: [try], data = [none] } finally { publishedFullRegistry.writeLock.unlock(); } } finally { writeLock.unlock(); } } }
public class class_name { public static AbstractExpression evaluateExpression(AbstractExpression expr) { if (expr == null) { return null; } // Evaluate children first expr.setLeft(evaluateExpression(expr.getLeft())); expr.setRight(evaluateExpression(expr.getRight())); // Evaluate self if (ExpressionType.CONJUNCTION_AND == expr.getExpressionType()) { if (ExpressionType.VALUE_CONSTANT == expr.getLeft().getExpressionType()) { if (ConstantValueExpression.isBooleanTrue(expr.getLeft())) { return expr.getRight(); } else { return expr.getLeft(); } } if (ExpressionType.VALUE_CONSTANT == expr.getRight().getExpressionType()) { if (ConstantValueExpression.isBooleanTrue(expr.getRight())) { return expr.getLeft(); } else { return expr.getRight(); } } } else if (ExpressionType.CONJUNCTION_OR == expr.getExpressionType()) { if (ExpressionType.VALUE_CONSTANT == expr.getLeft().getExpressionType()) { if (ConstantValueExpression.isBooleanTrue(expr.getLeft())) { return expr.getLeft(); } else { return expr.getRight(); } } if (ExpressionType.VALUE_CONSTANT == expr.getRight().getExpressionType()) { if (ConstantValueExpression.isBooleanTrue(expr.getRight())) { return expr.getRight(); } else { return expr.getLeft(); } } } else if (ExpressionType.OPERATOR_NOT == expr.getExpressionType()) { AbstractExpression leftExpr = expr.getLeft(); // function expressions can also return boolean. So the left child expression // can be expression which are not constant value expressions, so don't // evaluate every left child expr as constant value expression if ((VoltType.BOOLEAN == leftExpr.getValueType()) && (leftExpr instanceof ConstantValueExpression)) { if (ConstantValueExpression.isBooleanTrue(leftExpr)) { return ConstantValueExpression.getFalse(); } else { return ConstantValueExpression.getTrue(); } } else if (ExpressionType.OPERATOR_NOT == leftExpr.getExpressionType()) { return leftExpr.getLeft(); } else if (ExpressionType.CONJUNCTION_OR == leftExpr.getExpressionType()) { // NOT (.. OR .. OR ..) => NOT(..) AND NOT(..) AND NOT(..) AbstractExpression l = new OperatorExpression(ExpressionType.OPERATOR_NOT, leftExpr.getLeft(), null); AbstractExpression r = new OperatorExpression(ExpressionType.OPERATOR_NOT, leftExpr.getRight(), null); leftExpr = new OperatorExpression(ExpressionType.CONJUNCTION_AND, l, r); return evaluateExpression(leftExpr); } // NOT (expr1 AND expr2) => (NOT expr1) || (NOT expr2) // The above case is probably not interesting to do for short circuit purpose } return expr; } }
public class class_name { public static AbstractExpression evaluateExpression(AbstractExpression expr) { if (expr == null) { return null; // depends on control dependency: [if], data = [none] } // Evaluate children first expr.setLeft(evaluateExpression(expr.getLeft())); expr.setRight(evaluateExpression(expr.getRight())); // Evaluate self if (ExpressionType.CONJUNCTION_AND == expr.getExpressionType()) { if (ExpressionType.VALUE_CONSTANT == expr.getLeft().getExpressionType()) { if (ConstantValueExpression.isBooleanTrue(expr.getLeft())) { return expr.getRight(); // depends on control dependency: [if], data = [none] } else { return expr.getLeft(); // depends on control dependency: [if], data = [none] } } if (ExpressionType.VALUE_CONSTANT == expr.getRight().getExpressionType()) { if (ConstantValueExpression.isBooleanTrue(expr.getRight())) { return expr.getLeft(); // depends on control dependency: [if], data = [none] } else { return expr.getRight(); // depends on control dependency: [if], data = [none] } } } else if (ExpressionType.CONJUNCTION_OR == expr.getExpressionType()) { if (ExpressionType.VALUE_CONSTANT == expr.getLeft().getExpressionType()) { if (ConstantValueExpression.isBooleanTrue(expr.getLeft())) { return expr.getLeft(); // depends on control dependency: [if], data = [none] } else { return expr.getRight(); // depends on control dependency: [if], data = [none] } } if (ExpressionType.VALUE_CONSTANT == expr.getRight().getExpressionType()) { if (ConstantValueExpression.isBooleanTrue(expr.getRight())) { return expr.getRight(); // depends on control dependency: [if], data = [none] } else { return expr.getLeft(); // depends on control dependency: [if], data = [none] } } } else if (ExpressionType.OPERATOR_NOT == expr.getExpressionType()) { AbstractExpression leftExpr = expr.getLeft(); // function expressions can also return boolean. So the left child expression // can be expression which are not constant value expressions, so don't // evaluate every left child expr as constant value expression if ((VoltType.BOOLEAN == leftExpr.getValueType()) && (leftExpr instanceof ConstantValueExpression)) { if (ConstantValueExpression.isBooleanTrue(leftExpr)) { return ConstantValueExpression.getFalse(); // depends on control dependency: [if], data = [none] } else { return ConstantValueExpression.getTrue(); // depends on control dependency: [if], data = [none] } } else if (ExpressionType.OPERATOR_NOT == leftExpr.getExpressionType()) { return leftExpr.getLeft(); // depends on control dependency: [if], data = [none] } else if (ExpressionType.CONJUNCTION_OR == leftExpr.getExpressionType()) { // NOT (.. OR .. OR ..) => NOT(..) AND NOT(..) AND NOT(..) AbstractExpression l = new OperatorExpression(ExpressionType.OPERATOR_NOT, leftExpr.getLeft(), null); AbstractExpression r = new OperatorExpression(ExpressionType.OPERATOR_NOT, leftExpr.getRight(), null); leftExpr = new OperatorExpression(ExpressionType.CONJUNCTION_AND, l, r); // depends on control dependency: [if], data = [none] return evaluateExpression(leftExpr); // depends on control dependency: [if], data = [none] } // NOT (expr1 AND expr2) => (NOT expr1) || (NOT expr2) // The above case is probably not interesting to do for short circuit purpose } return expr; } }
public class class_name { private boolean updateTintColor(int[] state) { final int trackColor = mTrackStateList.getColorForState(state, mTrackColor); final int scrubberColor = mScrubberStateList.getColorForState(state, mScrubberColor); final int thumbColor = mThumbStateList.getColorForState(state, mThumbColor); if (trackColor != mTrackColor || scrubberColor != mScrubberColor || thumbColor != mThumbColor) { mTrackColor = trackColor; mScrubberColor = scrubberColor; mThumbColor = thumbColor; updateCurColor(); invalidateSelf(); return true; } return false; } }
public class class_name { private boolean updateTintColor(int[] state) { final int trackColor = mTrackStateList.getColorForState(state, mTrackColor); final int scrubberColor = mScrubberStateList.getColorForState(state, mScrubberColor); final int thumbColor = mThumbStateList.getColorForState(state, mThumbColor); if (trackColor != mTrackColor || scrubberColor != mScrubberColor || thumbColor != mThumbColor) { mTrackColor = trackColor; // depends on control dependency: [if], data = [none] mScrubberColor = scrubberColor; // depends on control dependency: [if], data = [none] mThumbColor = thumbColor; // depends on control dependency: [if], data = [none] updateCurColor(); // depends on control dependency: [if], data = [none] invalidateSelf(); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { private void processLeaf(Leaf leaf, List<String> sentence, List<Span> names) { if (leaf != null && leftContractionPart == null) { int startOfNamedEntity = -1; String leafTag = leaf.getSecondaryTag(); if (leafTag != null) { if (leafTag.contains("<sam->")) { String[] lexemes = underlinePattern.split(leaf.getLexeme()); if (lexemes.length > 1) { for (int i = 0; i < lexemes.length - 1; i++) { sentence.add(lexemes[i]); String[] conts = ContractionUtility.expand(lexemes[i]); if(conts != null) { int end = sentence.size(); int start = end - 1; Span s = new Span(start, end, "default"); names.add(s); { Span[] ss = {s}; System.out.println(Arrays.toString(Span.spansToStrings(ss, sentence.toArray(new String[sentence.size()])))); } } } } leftContractionPart = lexemes[lexemes.length - 1]; return; } // if (leaf.getLexeme().contains("_") && leaf.getLexeme().length() > 3) // { // String tag = leaf.getFunctionalTag(); // if (tags != null) { // if (tags.contains(tag)) { // namedEntityTag = leaf.getFunctionalTag(); // } // } else { // namedEntityTag = leaf.getFunctionalTag(); // } // } } // if (contraction) { // startOfNamedEntity = sentence.size(); // } // sentence.addAll(Arrays.asList(leaf.getLexeme()));// .split("_") // // if (contraction) { // names // .add(new Span(startOfNamedEntity, sentence.size())); // } } else { // will handle the contraction String tag = leaf.getSecondaryTag(); String right = leaf.getLexeme(); if (tag != null && tag.contains("<-sam>")) { String[] parts = underlinePattern.split(leaf.getLexeme()); if(parts != null) { // try to join only the first String c = PortugueseContractionUtility.toContraction( leftContractionPart, parts[0]); if (c != null) { sentence.add(c); names.add(new Span(sentence.size() - 1, sentence.size(), "default")); } for (int i = 1; i < parts.length; i++) { sentence.add(parts[i]); } } else { right = leaf.getLexeme(); String c = PortugueseContractionUtility.toContraction( leftContractionPart, right); if (c != null) { sentence.add(c); names.add(new Span(sentence.size() - 1, sentence.size(), "default")); } else { System.err.println("missing " + leftContractionPart + " + " + right); sentence.add(leftContractionPart); sentence.add(right); } } } else { System.err.println("unmatch" + leftContractionPart + " + " + right); } leftContractionPart = null; } } }
public class class_name { private void processLeaf(Leaf leaf, List<String> sentence, List<Span> names) { if (leaf != null && leftContractionPart == null) { int startOfNamedEntity = -1; String leafTag = leaf.getSecondaryTag(); if (leafTag != null) { if (leafTag.contains("<sam->")) { String[] lexemes = underlinePattern.split(leaf.getLexeme()); if (lexemes.length > 1) { for (int i = 0; i < lexemes.length - 1; i++) { sentence.add(lexemes[i]); // depends on control dependency: [for], data = [i] String[] conts = ContractionUtility.expand(lexemes[i]); if(conts != null) { int end = sentence.size(); int start = end - 1; Span s = new Span(start, end, "default"); names.add(s); // depends on control dependency: [if], data = [none] { Span[] ss = {s}; System.out.println(Arrays.toString(Span.spansToStrings(ss, sentence.toArray(new String[sentence.size()])))); } } } } leftContractionPart = lexemes[lexemes.length - 1]; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // if (leaf.getLexeme().contains("_") && leaf.getLexeme().length() > 3) // { // String tag = leaf.getFunctionalTag(); // if (tags != null) { // if (tags.contains(tag)) { // namedEntityTag = leaf.getFunctionalTag(); // } // } else { // namedEntityTag = leaf.getFunctionalTag(); // } // } } // if (contraction) { // startOfNamedEntity = sentence.size(); // } // sentence.addAll(Arrays.asList(leaf.getLexeme()));// .split("_") // depends on control dependency: [if], data = [none] // // if (contraction) { // names // .add(new Span(startOfNamedEntity, sentence.size())); // } } else { // will handle the contraction String tag = leaf.getSecondaryTag(); String right = leaf.getLexeme(); if (tag != null && tag.contains("<-sam>")) { String[] parts = underlinePattern.split(leaf.getLexeme()); if(parts != null) { // try to join only the first String c = PortugueseContractionUtility.toContraction( leftContractionPart, parts[0]); if (c != null) { sentence.add(c); // depends on control dependency: [if], data = [(c] names.add(new Span(sentence.size() - 1, sentence.size(), "default")); // depends on control dependency: [if], data = [none] } for (int i = 1; i < parts.length; i++) { sentence.add(parts[i]); // depends on control dependency: [for], data = [i] } } else { right = leaf.getLexeme(); // depends on control dependency: [if], data = [none] String c = PortugueseContractionUtility.toContraction( leftContractionPart, right); if (c != null) { sentence.add(c); // depends on control dependency: [if], data = [(c] names.add(new Span(sentence.size() - 1, sentence.size(), "default")); // depends on control dependency: [if], data = [none] } else { System.err.println("missing " + leftContractionPart + " + " + right); // depends on control dependency: [if], data = [none] sentence.add(leftContractionPart); // depends on control dependency: [if], data = [none] sentence.add(right); // depends on control dependency: [if], data = [none] } } } else { System.err.println("unmatch" + leftContractionPart + " + " + right); // depends on control dependency: [if], data = [none] } leftContractionPart = null; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void contextRootAdded(String contextRoot, VirtualHost virtualHost) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Added contextRoot {0} to virtual host {1}", contextRoot, virtualHost.getName()); } // Check that our app got installed if (contextRoot != null && contextRoot.contains(APIConstants.JMX_CONNECTOR_API_ROOT_PATH) && "default_host".equals(virtualHost.getName())) { registeredContextRoot = contextRoot; if (secureVirtualHost == virtualHost) { createJMXWorkAreaResourceIfChanged(virtualHost); } } } }
public class class_name { @Override public void contextRootAdded(String contextRoot, VirtualHost virtualHost) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Added contextRoot {0} to virtual host {1}", contextRoot, virtualHost.getName()); // depends on control dependency: [if], data = [none] } // Check that our app got installed if (contextRoot != null && contextRoot.contains(APIConstants.JMX_CONNECTOR_API_ROOT_PATH) && "default_host".equals(virtualHost.getName())) { registeredContextRoot = contextRoot; // depends on control dependency: [if], data = [none] if (secureVirtualHost == virtualHost) { createJMXWorkAreaResourceIfChanged(virtualHost); // depends on control dependency: [if], data = [virtualHost)] } } } }
public class class_name { public synchronized String getConfigProperty(Config.ConfigProperty configProperty) { SeLionLogger.getLogger().entering(configProperty); checkArgument(configProperty != null, "Config property cannot be null"); // Search locally then query SeLionConfig if not found String propValue = null; if (baseConfig.containsKey(configProperty.getName())) { propValue = baseConfig.getString(configProperty.getName()); } if (StringUtils.isBlank(propValue)) { propValue = Config.getConfigProperty(configProperty); } SeLionLogger.getLogger().exiting(propValue); return propValue; } }
public class class_name { public synchronized String getConfigProperty(Config.ConfigProperty configProperty) { SeLionLogger.getLogger().entering(configProperty); checkArgument(configProperty != null, "Config property cannot be null"); // Search locally then query SeLionConfig if not found String propValue = null; if (baseConfig.containsKey(configProperty.getName())) { propValue = baseConfig.getString(configProperty.getName()); // depends on control dependency: [if], data = [none] } if (StringUtils.isBlank(propValue)) { propValue = Config.getConfigProperty(configProperty); // depends on control dependency: [if], data = [none] } SeLionLogger.getLogger().exiting(propValue); return propValue; } }
public class class_name { public AccountListNodeAgentSkusOptions withOcpDate(DateTime ocpDate) { if (ocpDate == null) { this.ocpDate = null; } else { this.ocpDate = new DateTimeRfc1123(ocpDate); } return this; } }
public class class_name { public AccountListNodeAgentSkusOptions withOcpDate(DateTime ocpDate) { if (ocpDate == null) { this.ocpDate = null; // depends on control dependency: [if], data = [none] } else { this.ocpDate = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate] } return this; } }