code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private void generateConcreteMethods(Map interfaceMethods) { if (interfaceMethods == null) return; Iterator it = interfaceMethods.values().iterator(); while (it.hasNext()) { CtMethod interfaceMethod = (CtMethod) it.next(); if (interfaceMethod != null //&& isBaseInterfaceMethod(interfaceMethod.getName())) && (interfaceMethod.getDeclaringClass().getName().equals( javax.slee.ActivityContextInterface.class.getName()) || interfaceMethod.getDeclaringClass().getName().equals( ActivityContextInterfaceExt.class.getName()))) continue; // @todo: need to check args also try { // copy method from abstract to concrete class CtMethod concreteMethod = CtNewMethod.copy(interfaceMethod, concreteActivityContextInterface, null); // create the method body String fieldName = interfaceMethod.getName().substring(3); fieldName = fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1); String concreteMethodBody = null; if (interfaceMethod.getName().startsWith("get")) { concreteMethodBody = "{ return ($r)getFieldValue(\"" + fieldName + "\","+concreteMethod.getReturnType().getName()+".class); }"; } else if (interfaceMethod.getName().startsWith("set")) { concreteMethodBody = "{ setFieldValue(\"" + fieldName + "\",$1); }"; } else { throw new SLEEException("unexpected method name <" + interfaceMethod.getName() + "> to implement in sbb aci interface"); } if (logger.isTraceEnabled()) { logger.trace("Generated method " + interfaceMethod.getName() + " , body = " + concreteMethodBody); } concreteMethod.setBody(concreteMethodBody); concreteActivityContextInterface.addMethod(concreteMethod); } catch (Exception cce) { throw new SLEEException("Cannot compile method " + interfaceMethod.getName(), cce); } } } }
public class class_name { private void generateConcreteMethods(Map interfaceMethods) { if (interfaceMethods == null) return; Iterator it = interfaceMethods.values().iterator(); while (it.hasNext()) { CtMethod interfaceMethod = (CtMethod) it.next(); if (interfaceMethod != null //&& isBaseInterfaceMethod(interfaceMethod.getName())) && (interfaceMethod.getDeclaringClass().getName().equals( javax.slee.ActivityContextInterface.class.getName()) || interfaceMethod.getDeclaringClass().getName().equals( ActivityContextInterfaceExt.class.getName()))) continue; // @todo: need to check args also try { // copy method from abstract to concrete class CtMethod concreteMethod = CtNewMethod.copy(interfaceMethod, concreteActivityContextInterface, null); // create the method body String fieldName = interfaceMethod.getName().substring(3); fieldName = fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1); String concreteMethodBody = null; if (interfaceMethod.getName().startsWith("get")) { concreteMethodBody = "{ return ($r)getFieldValue(\"" + fieldName + "\","+concreteMethod.getReturnType().getName()+".class); }"; // depends on control dependency: [if], data = [none] } else if (interfaceMethod.getName().startsWith("set")) { concreteMethodBody = "{ setFieldValue(\"" + fieldName + "\",$1); }"; } else { throw new SLEEException("unexpected method name <" + interfaceMethod.getName() + "> to implement in sbb aci interface"); } if (logger.isTraceEnabled()) { logger.trace("Generated method " + interfaceMethod.getName() + " , body = " + concreteMethodBody); // depends on control dependency: [if], data = [none] } concreteMethod.setBody(concreteMethodBody); concreteActivityContextInterface.addMethod(concreteMethod); } catch (Exception cce) { throw new SLEEException("Cannot compile method " + interfaceMethod.getName(), cce); } } } }
public class class_name { public I_CmsHistoryDriver getHistoryDriver(CmsDbContext dbc) { if ((dbc == null) || (dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) { return m_historyDriver; } I_CmsHistoryDriver driver = dbc.getHistoryDriver(dbc.getProjectId()); return driver != null ? driver : m_historyDriver; } }
public class class_name { public I_CmsHistoryDriver getHistoryDriver(CmsDbContext dbc) { if ((dbc == null) || (dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) { return m_historyDriver; // depends on control dependency: [if], data = [none] } I_CmsHistoryDriver driver = dbc.getHistoryDriver(dbc.getProjectId()); return driver != null ? driver : m_historyDriver; } }
public class class_name { @Override protected void _fit(Dataframe trainingData) { ModelParameters modelParameters = knowledgeBase.getModelParameters(); TrainingParameters trainingParameters = knowledgeBase.getTrainingParameters(); Map<List<Object>, Double> thitas = modelParameters.getThitas(); Set<Object> classesSet = modelParameters.getClasses(); //first we need to find all the classes for(Record r : trainingData) { Object theClass=r.getY(); classesSet.add(theClass); } //we initialize the thitas to zero for all features and all classes compinations for(Object theClass : classesSet) { thitas.put(Arrays.asList(Dataframe.COLUMN_NAME_CONSTANT, theClass), 0.0); } streamExecutor.forEach(StreamMethods.stream(trainingData.getXDataTypes().keySet().stream(), isParallelized()), feature -> { for(Object theClass : classesSet) { thitas.putIfAbsent(Arrays.asList(feature, theClass), 0.0); } }); double minError = Double.POSITIVE_INFINITY; double learningRate = trainingParameters.getLearningRate(); int totalIterations = trainingParameters.getTotalIterations(); StorageEngine storageEngine = knowledgeBase.getStorageEngine(); for(int iteration=0;iteration<totalIterations;++iteration) { logger.debug("Iteration {}", iteration); Map<List<Object>, Double> tmp_newThitas = storageEngine.getBigMap("tmp_newThitas", (Class<List<Object>>)(Class<?>)List.class, Double.class, MapType.HASHMAP, StorageHint.IN_MEMORY, true, true); tmp_newThitas.putAll(thitas); batchGradientDescent(trainingData, tmp_newThitas, learningRate); double newError = calculateError(trainingData,tmp_newThitas); //bold driver if(newError>minError) { learningRate/=2.0; } else { learningRate*=1.05; minError=newError; //keep the new thitas thitas.clear(); thitas.putAll(tmp_newThitas); } //Drop the temporary Collection storageEngine.dropBigMap("tmp_newThitas", tmp_newThitas); } } }
public class class_name { @Override protected void _fit(Dataframe trainingData) { ModelParameters modelParameters = knowledgeBase.getModelParameters(); TrainingParameters trainingParameters = knowledgeBase.getTrainingParameters(); Map<List<Object>, Double> thitas = modelParameters.getThitas(); Set<Object> classesSet = modelParameters.getClasses(); //first we need to find all the classes for(Record r : trainingData) { Object theClass=r.getY(); classesSet.add(theClass); // depends on control dependency: [for], data = [none] } //we initialize the thitas to zero for all features and all classes compinations for(Object theClass : classesSet) { thitas.put(Arrays.asList(Dataframe.COLUMN_NAME_CONSTANT, theClass), 0.0); // depends on control dependency: [for], data = [theClass] } streamExecutor.forEach(StreamMethods.stream(trainingData.getXDataTypes().keySet().stream(), isParallelized()), feature -> { for(Object theClass : classesSet) { thitas.putIfAbsent(Arrays.asList(feature, theClass), 0.0); } }); double minError = Double.POSITIVE_INFINITY; double learningRate = trainingParameters.getLearningRate(); int totalIterations = trainingParameters.getTotalIterations(); StorageEngine storageEngine = knowledgeBase.getStorageEngine(); for(int iteration=0;iteration<totalIterations;++iteration) { logger.debug("Iteration {}", iteration); Map<List<Object>, Double> tmp_newThitas = storageEngine.getBigMap("tmp_newThitas", (Class<List<Object>>)(Class<?>)List.class, Double.class, MapType.HASHMAP, StorageHint.IN_MEMORY, true, true); tmp_newThitas.putAll(thitas); batchGradientDescent(trainingData, tmp_newThitas, learningRate); double newError = calculateError(trainingData,tmp_newThitas); //bold driver if(newError>minError) { learningRate/=2.0; } else { learningRate*=1.05; minError=newError; //keep the new thitas thitas.clear(); thitas.putAll(tmp_newThitas); } //Drop the temporary Collection storageEngine.dropBigMap("tmp_newThitas", tmp_newThitas); } } }
public class class_name { public static Bitmap getTileBitmap(final int pTileSizePx) { final Bitmap bitmap = BitmapPool.getInstance().obtainSizedBitmapFromPool(pTileSizePx, pTileSizePx); if (bitmap != null) { return bitmap; } return Bitmap.createBitmap(pTileSizePx, pTileSizePx, Bitmap.Config.ARGB_8888); } }
public class class_name { public static Bitmap getTileBitmap(final int pTileSizePx) { final Bitmap bitmap = BitmapPool.getInstance().obtainSizedBitmapFromPool(pTileSizePx, pTileSizePx); if (bitmap != null) { return bitmap; // depends on control dependency: [if], data = [none] } return Bitmap.createBitmap(pTileSizePx, pTileSizePx, Bitmap.Config.ARGB_8888); } }
public class class_name { public static Properties toProperties(String propString) { Properties prop = new Properties(); try { prop.load(new StringReader(propString)); return prop; } catch (IOException e) { JK.throww(e); return null; } } }
public class class_name { public static Properties toProperties(String propString) { Properties prop = new Properties(); try { prop.load(new StringReader(propString)); // depends on control dependency: [try], data = [none] return prop; // depends on control dependency: [try], data = [none] } catch (IOException e) { JK.throww(e); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @SuppressWarnings("all") public void validateFalse(boolean value, String name, String message) { if (value) { addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.FALSE_KEY.name(), name))); } } }
public class class_name { @SuppressWarnings("all") public void validateFalse(boolean value, String name, String message) { if (value) { addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.FALSE_KEY.name(), name))); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static String extractTemplateName(String filter) { Matcher matcher = TEMPLATE_FILTER_PATTERN.matcher(filter); if (matcher.matches()) { return matcher.group(1); } else { return "Unknown template"; } } }
public class class_name { private static String extractTemplateName(String filter) { Matcher matcher = TEMPLATE_FILTER_PATTERN.matcher(filter); if (matcher.matches()) { return matcher.group(1); // depends on control dependency: [if], data = [none] } else { return "Unknown template"; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static synchronized Set<String> getCanonicalSystemLocationZIDs() { Set<String> canonicalSystemLocationZones = null; if (REF_CANONICAL_SYSTEM_LOCATION_ZONES != null) { canonicalSystemLocationZones = REF_CANONICAL_SYSTEM_LOCATION_ZONES.get(); } if (canonicalSystemLocationZones == null) { Set<String> canonicalSystemLocationIDs = new TreeSet<String>(); String[] allIDs = getZoneIDs(); for (String id : allIDs) { // exclude Etc/Unknown if (id.equals(TimeZone.UNKNOWN_ZONE_ID)) { continue; } String canonicalID = getCanonicalCLDRID(id); if (id.equals(canonicalID)) { String region = getRegion(id); if (region != null && !region.equals(kWorld)) { canonicalSystemLocationIDs.add(id); } } } canonicalSystemLocationZones = Collections.unmodifiableSet(canonicalSystemLocationIDs); REF_CANONICAL_SYSTEM_LOCATION_ZONES = new SoftReference<Set<String>>(canonicalSystemLocationZones); } return canonicalSystemLocationZones; } }
public class class_name { private static synchronized Set<String> getCanonicalSystemLocationZIDs() { Set<String> canonicalSystemLocationZones = null; if (REF_CANONICAL_SYSTEM_LOCATION_ZONES != null) { canonicalSystemLocationZones = REF_CANONICAL_SYSTEM_LOCATION_ZONES.get(); // depends on control dependency: [if], data = [none] } if (canonicalSystemLocationZones == null) { Set<String> canonicalSystemLocationIDs = new TreeSet<String>(); String[] allIDs = getZoneIDs(); for (String id : allIDs) { // exclude Etc/Unknown if (id.equals(TimeZone.UNKNOWN_ZONE_ID)) { continue; } String canonicalID = getCanonicalCLDRID(id); if (id.equals(canonicalID)) { String region = getRegion(id); if (region != null && !region.equals(kWorld)) { canonicalSystemLocationIDs.add(id); // depends on control dependency: [if], data = [none] } } } canonicalSystemLocationZones = Collections.unmodifiableSet(canonicalSystemLocationIDs); // depends on control dependency: [if], data = [none] REF_CANONICAL_SYSTEM_LOCATION_ZONES = new SoftReference<Set<String>>(canonicalSystemLocationZones); // depends on control dependency: [if], data = [(canonicalSystemLocationZones] } return canonicalSystemLocationZones; } }
public class class_name { @Override public void introspect(PrintWriter out) throws Exception { for (Region region : digraph) { out.println(region.getName()); out.println(" Associated Bundles:"); for (Long id : region.getBundleIds()) { Bundle b = systemContext.getBundle(id); out.append(" "); out.println(b); } out.println(" Edges:"); for (FilteredRegion edge : region.getEdges()) { out.append(" ").append(edge.getRegion().getName()).append(" -> "); out.println(edge.getFilter()); } out.println(); } } }
public class class_name { @Override public void introspect(PrintWriter out) throws Exception { for (Region region : digraph) { out.println(region.getName()); out.println(" Associated Bundles:"); for (Long id : region.getBundleIds()) { Bundle b = systemContext.getBundle(id); out.append(" "); // depends on control dependency: [for], data = [none] out.println(b); // depends on control dependency: [for], data = [none] } out.println(" Edges:"); for (FilteredRegion edge : region.getEdges()) { out.append(" ").append(edge.getRegion().getName()).append(" -> "); // depends on control dependency: [for], data = [edge] out.println(edge.getFilter()); // depends on control dependency: [for], data = [edge] } out.println(); } } }
public class class_name { protected String getSql(int version){ Dialect dialect = ((SqlManagerImpl) sqlManager).getDialect(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream in = classLoader.getResourceAsStream( String.format("%s/%s_%d.sql", packageName, dialect.getName().toLowerCase(), version)); if(in == null){ in = classLoader.getResourceAsStream( String.format("%s/%d.sql", packageName, version)); if(in == null){ return null; } } byte[] buf = IOUtil.readStream(in); return new String(buf, StandardCharsets.UTF_8); } }
public class class_name { protected String getSql(int version){ Dialect dialect = ((SqlManagerImpl) sqlManager).getDialect(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream in = classLoader.getResourceAsStream( String.format("%s/%s_%d.sql", packageName, dialect.getName().toLowerCase(), version)); if(in == null){ in = classLoader.getResourceAsStream( String.format("%s/%d.sql", packageName, version)); // depends on control dependency: [if], data = [none] if(in == null){ return null; // depends on control dependency: [if], data = [none] } } byte[] buf = IOUtil.readStream(in); return new String(buf, StandardCharsets.UTF_8); } }
public class class_name { private void checkAndSetJvms() { Collection<String> jvmProcs = processTree.getProcessNameContainsCount("java "); metricsRecord.setMetric("all_node_jvms", jvmProcs.size()); int maxExpected = tt.getMaxActualMapTasks() + tt.getMaxActualReduceTasks() + extraJvms; if (maxExpected < jvmProcs.size()) { LOG.warn("checkAndSetJvms: Expected up to " + maxExpected + " jvms, " + "but got " + jvmProcs.size()); for (String jvmProc : jvmProcs) { LOG.warn(jvmProc); } } } }
public class class_name { private void checkAndSetJvms() { Collection<String> jvmProcs = processTree.getProcessNameContainsCount("java "); metricsRecord.setMetric("all_node_jvms", jvmProcs.size()); int maxExpected = tt.getMaxActualMapTasks() + tt.getMaxActualReduceTasks() + extraJvms; if (maxExpected < jvmProcs.size()) { LOG.warn("checkAndSetJvms: Expected up to " + maxExpected + " jvms, " + "but got " + jvmProcs.size()); // depends on control dependency: [if], data = [none] for (String jvmProc : jvmProcs) { LOG.warn(jvmProc); // depends on control dependency: [for], data = [jvmProc] } } } }
public class class_name { final boolean isAnyChildMatched() { if (isAnyChildMatched == null) { isAnyChildMatched = false; for (RecursableDiffEntity entity : childEntities()) { if ((entity.isMatched() && !entity.isContentEmpty()) || entity.isAnyChildMatched()) { isAnyChildMatched = true; break; } } } return isAnyChildMatched; } }
public class class_name { final boolean isAnyChildMatched() { if (isAnyChildMatched == null) { isAnyChildMatched = false; // depends on control dependency: [if], data = [none] for (RecursableDiffEntity entity : childEntities()) { if ((entity.isMatched() && !entity.isContentEmpty()) || entity.isAnyChildMatched()) { isAnyChildMatched = true; // depends on control dependency: [if], data = [none] break; } } } return isAnyChildMatched; } }
public class class_name { @Override public void run() { if (this.state != null && this.state.cancel) { // we were already cancelled, don't run, but still post completion this.state.documentCounter = 0; this.state.batchCounter = 0; runComplete(null); return; } // reset internal state this.state = new State(); Throwable errorInfo = null; try { this.useBulkGet = sourceDb.isBulkSupported(); replicate(); } catch (ExecutionException ex) { logger.log(Level.SEVERE, String.format("Batch %s ended with error:", this.state .batchCounter), ex); errorInfo = ex.getCause(); } catch (Throwable e) { logger.log(Level.SEVERE, String.format("Batch %s ended with error:", this.state .batchCounter), e); errorInfo = e; } runComplete(errorInfo); } }
public class class_name { @Override public void run() { if (this.state != null && this.state.cancel) { // we were already cancelled, don't run, but still post completion this.state.documentCounter = 0; // depends on control dependency: [if], data = [none] this.state.batchCounter = 0; // depends on control dependency: [if], data = [none] runComplete(null); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // reset internal state this.state = new State(); Throwable errorInfo = null; try { this.useBulkGet = sourceDb.isBulkSupported(); // depends on control dependency: [try], data = [none] replicate(); // depends on control dependency: [try], data = [none] } catch (ExecutionException ex) { logger.log(Level.SEVERE, String.format("Batch %s ended with error:", this.state .batchCounter), ex); errorInfo = ex.getCause(); } catch (Throwable e) { // depends on control dependency: [catch], data = [none] logger.log(Level.SEVERE, String.format("Batch %s ended with error:", this.state .batchCounter), e); errorInfo = e; } // depends on control dependency: [catch], data = [none] runComplete(errorInfo); } }
public class class_name { @Nonnull public static String unescapeURL (@Nonnull final String sEscapedURL) { int nIndex = sEscapedURL.indexOf (URL_ESCAPE_CHAR); if (nIndex < 0) { // No escape sequence found return sEscapedURL; } final StringBuilder aSB = new StringBuilder (sEscapedURL.length ()); int nPrevIndex = 0; do { // Append everything before the first quote char aSB.append (sEscapedURL, nPrevIndex, nIndex); // Append the quoted char itself aSB.append (sEscapedURL, nIndex + 1, nIndex + 2); // The new position to start searching nPrevIndex = nIndex + 2; // Search the next escaped char nIndex = sEscapedURL.indexOf (URL_ESCAPE_CHAR, nPrevIndex); } while (nIndex >= 0); // Append the rest aSB.append (sEscapedURL.substring (nPrevIndex)); return aSB.toString (); } }
public class class_name { @Nonnull public static String unescapeURL (@Nonnull final String sEscapedURL) { int nIndex = sEscapedURL.indexOf (URL_ESCAPE_CHAR); if (nIndex < 0) { // No escape sequence found return sEscapedURL; // depends on control dependency: [if], data = [none] } final StringBuilder aSB = new StringBuilder (sEscapedURL.length ()); int nPrevIndex = 0; do { // Append everything before the first quote char aSB.append (sEscapedURL, nPrevIndex, nIndex); // Append the quoted char itself aSB.append (sEscapedURL, nIndex + 1, nIndex + 2); // The new position to start searching nPrevIndex = nIndex + 2; // Search the next escaped char nIndex = sEscapedURL.indexOf (URL_ESCAPE_CHAR, nPrevIndex); } while (nIndex >= 0); // Append the rest aSB.append (sEscapedURL.substring (nPrevIndex)); return aSB.toString (); } }
public class class_name { public void setStackFromEnd(boolean stackFromEnd) { if (mPendingSavedState != null && mPendingSavedState.mStackFromEnd != stackFromEnd) { // override pending state mPendingSavedState.mStackFromEnd = stackFromEnd; } if (mStackFromEnd == stackFromEnd) { return; } mStackFromEnd = stackFromEnd; requestLayout(); } }
public class class_name { public void setStackFromEnd(boolean stackFromEnd) { if (mPendingSavedState != null && mPendingSavedState.mStackFromEnd != stackFromEnd) { // override pending state mPendingSavedState.mStackFromEnd = stackFromEnd; // depends on control dependency: [if], data = [none] } if (mStackFromEnd == stackFromEnd) { return; // depends on control dependency: [if], data = [none] } mStackFromEnd = stackFromEnd; requestLayout(); } }
public class class_name { @Override public void setCurrency(Currency currency) { if (currency != symbols.getCurrency() // J2ObjC: Added to be consistent with Android behavior. || !currency.getSymbol().equals(symbols.getCurrencySymbol())) { symbols.setCurrency(currency); if (isCurrencyFormat) { expandAffixes(); } } fastPathCheckNeeded = true; } }
public class class_name { @Override public void setCurrency(Currency currency) { if (currency != symbols.getCurrency() // J2ObjC: Added to be consistent with Android behavior. || !currency.getSymbol().equals(symbols.getCurrencySymbol())) { symbols.setCurrency(currency); // depends on control dependency: [if], data = [(currency] if (isCurrencyFormat) { expandAffixes(); // depends on control dependency: [if], data = [none] } } fastPathCheckNeeded = true; } }
public class class_name { @Override public void doPostPhaseActions(FacesContext facesContext) { if (!_flashScopeDisabled) { // do the actions only if this is the last time // doPostPhaseActions() is called on this request if (_isLastPhaseInRequest(facesContext)) { if (_isRedirectTrueOnThisRequest(facesContext)) { // copy entries from executeMap to renderMap, if they do not exist Map<String, Object> renderMap = _getRenderFlashMap(facesContext); for (Map.Entry<String, Object> entry : _getExecuteFlashMap(facesContext).entrySet()) { if (!renderMap.containsKey(entry.getKey())) { renderMap.put(entry.getKey(), entry.getValue()); } } } // remove execute Map entries from session (--> "destroy" executeMap) _clearExecuteFlashMap(facesContext); // save the current FacesMessages in the renderMap, if wanted // Note that this also works on a redirect even though the redirect // was already performed and the response has already been committed, // because the renderMap is stored in the session. _saveMessages(facesContext); _clearRenderFlashTokenIfMapEmpty(facesContext); } } } }
public class class_name { @Override public void doPostPhaseActions(FacesContext facesContext) { if (!_flashScopeDisabled) { // do the actions only if this is the last time // doPostPhaseActions() is called on this request if (_isLastPhaseInRequest(facesContext)) { if (_isRedirectTrueOnThisRequest(facesContext)) { // copy entries from executeMap to renderMap, if they do not exist Map<String, Object> renderMap = _getRenderFlashMap(facesContext); for (Map.Entry<String, Object> entry : _getExecuteFlashMap(facesContext).entrySet()) { if (!renderMap.containsKey(entry.getKey())) { renderMap.put(entry.getKey(), entry.getValue()); // depends on control dependency: [if], data = [none] } } } // remove execute Map entries from session (--> "destroy" executeMap) _clearExecuteFlashMap(facesContext); // depends on control dependency: [if], data = [none] // save the current FacesMessages in the renderMap, if wanted // Note that this also works on a redirect even though the redirect // was already performed and the response has already been committed, // because the renderMap is stored in the session. _saveMessages(facesContext); // depends on control dependency: [if], data = [none] _clearRenderFlashTokenIfMapEmpty(facesContext); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void add(String name, String value) { if (containsKey(name)) { get(name).add(value); } else { put(name, value); } } }
public class class_name { public void add(String name, String value) { if (containsKey(name)) { get(name).add(value); // depends on control dependency: [if], data = [none] } else { put(name, value); // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<FormFieldListing> getFormFieldsSynchronized( Form ... formsToGetFieldListingForForParam ) { if(formsToGetFieldListingForForParam == null) { return null; } if(formsToGetFieldListingForForParam.length == 0) { return null; } //Start a new request... String uniqueReqId = this.initNewRequest(); //Send all the messages... int numberOfSentForms = 0; for(Form formToSend : formsToGetFieldListingForForParam) { this.setEchoIfNotSet(formToSend); //Send the actual message... this.sendMessage(formToSend, uniqueReqId); numberOfSentForms++; } try { List<FormFieldListing> returnValue = this.getHandler(uniqueReqId).getCF().get( this.getTimeoutInMillis(), TimeUnit.MILLISECONDS); //Connection was closed.. this is a problem.... if(this.getHandler(uniqueReqId).isConnectionClosed()) { throw new FluidClientException( "SQLUtil-WebSocket-GetFormFields: " + "The connection was closed by the server prior to the response received.", FluidClientException.ErrorCode.IO_ERROR); } return returnValue; } catch (InterruptedException exceptParam) { //Interrupted... throw new FluidClientException( "SQLUtil-WebSocket-Interrupted-GetFormFields: " + exceptParam.getMessage(), exceptParam, FluidClientException.ErrorCode.STATEMENT_EXECUTION_ERROR); } catch (ExecutionException executeProblem) { //Error on the web-socket... Throwable cause = executeProblem.getCause(); //Fluid client exception... if(cause instanceof FluidClientException) { throw (FluidClientException)cause; } else { throw new FluidClientException( "SQLUtil-WebSocket-GetFormFields: " + cause.getMessage(), cause, FluidClientException.ErrorCode.STATEMENT_EXECUTION_ERROR); } } catch (TimeoutException eParam) { //Timeout... String errMessage = this.getExceptionMessageVerbose( "SQLUtil-WebSocket-GetFormFields", uniqueReqId, numberOfSentForms); throw new FluidClientException( errMessage, FluidClientException.ErrorCode.IO_ERROR); } finally { this.removeHandler(uniqueReqId); } } }
public class class_name { public List<FormFieldListing> getFormFieldsSynchronized( Form ... formsToGetFieldListingForForParam ) { if(formsToGetFieldListingForForParam == null) { return null; // depends on control dependency: [if], data = [none] } if(formsToGetFieldListingForForParam.length == 0) { return null; // depends on control dependency: [if], data = [none] } //Start a new request... String uniqueReqId = this.initNewRequest(); //Send all the messages... int numberOfSentForms = 0; for(Form formToSend : formsToGetFieldListingForForParam) { this.setEchoIfNotSet(formToSend); // depends on control dependency: [for], data = [formToSend] //Send the actual message... this.sendMessage(formToSend, uniqueReqId); // depends on control dependency: [for], data = [formToSend] numberOfSentForms++; // depends on control dependency: [for], data = [none] } try { List<FormFieldListing> returnValue = this.getHandler(uniqueReqId).getCF().get( this.getTimeoutInMillis(), TimeUnit.MILLISECONDS); //Connection was closed.. this is a problem.... if(this.getHandler(uniqueReqId).isConnectionClosed()) { throw new FluidClientException( "SQLUtil-WebSocket-GetFormFields: " + "The connection was closed by the server prior to the response received.", FluidClientException.ErrorCode.IO_ERROR); } return returnValue; // depends on control dependency: [try], data = [none] } catch (InterruptedException exceptParam) { //Interrupted... throw new FluidClientException( "SQLUtil-WebSocket-Interrupted-GetFormFields: " + exceptParam.getMessage(), exceptParam, FluidClientException.ErrorCode.STATEMENT_EXECUTION_ERROR); } catch (ExecutionException executeProblem) { // depends on control dependency: [catch], data = [none] //Error on the web-socket... Throwable cause = executeProblem.getCause(); //Fluid client exception... if(cause instanceof FluidClientException) { throw (FluidClientException)cause; } else { throw new FluidClientException( "SQLUtil-WebSocket-GetFormFields: " + cause.getMessage(), cause, FluidClientException.ErrorCode.STATEMENT_EXECUTION_ERROR); } } catch (TimeoutException eParam) { // depends on control dependency: [catch], data = [none] //Timeout... String errMessage = this.getExceptionMessageVerbose( "SQLUtil-WebSocket-GetFormFields", uniqueReqId, numberOfSentForms); throw new FluidClientException( errMessage, FluidClientException.ErrorCode.IO_ERROR); } finally { // depends on control dependency: [catch], data = [none] this.removeHandler(uniqueReqId); } } }
public class class_name { public static final boolean hasScript(int c, int sc) { int scriptX=UCharacterProperty.INSTANCE.getAdditional(c, 0)&UCharacterProperty.SCRIPT_X_MASK; if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) { return sc==scriptX; } char[] scriptExtensions=UCharacterProperty.INSTANCE.m_scriptExtensions_; int scx=scriptX&UCharacterProperty.SCRIPT_MASK_; // index into scriptExtensions if(scriptX>=UCharacterProperty.SCRIPT_X_WITH_OTHER) { scx=scriptExtensions[scx+1]; } if(sc>0x7fff) { // Guard against bogus input that would // make us go past the Script_Extensions terminator. return false; } while(sc>scriptExtensions[scx]) { ++scx; } return sc==(scriptExtensions[scx]&0x7fff); } }
public class class_name { public static final boolean hasScript(int c, int sc) { int scriptX=UCharacterProperty.INSTANCE.getAdditional(c, 0)&UCharacterProperty.SCRIPT_X_MASK; if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) { return sc==scriptX; // depends on control dependency: [if], data = [none] } char[] scriptExtensions=UCharacterProperty.INSTANCE.m_scriptExtensions_; int scx=scriptX&UCharacterProperty.SCRIPT_MASK_; // index into scriptExtensions if(scriptX>=UCharacterProperty.SCRIPT_X_WITH_OTHER) { scx=scriptExtensions[scx+1]; // depends on control dependency: [if], data = [none] } if(sc>0x7fff) { // Guard against bogus input that would // make us go past the Script_Extensions terminator. return false; // depends on control dependency: [if], data = [none] } while(sc>scriptExtensions[scx]) { ++scx; // depends on control dependency: [while], data = [none] } return sc==(scriptExtensions[scx]&0x7fff); } }
public class class_name { public static <T> List<T> toList( T... objects ) { List<T> list = new ArrayList<T>( objects.length ); for (T t : objects) { list.add( t ); } return list; } }
public class class_name { public static <T> List<T> toList( T... objects ) { List<T> list = new ArrayList<T>( objects.length ); for (T t : objects) { list.add( t ); // depends on control dependency: [for], data = [t] } return list; } }
public class class_name { public java.util.List<String> getAWSAccountIds() { if (aWSAccountIds == null) { aWSAccountIds = new com.amazonaws.internal.SdkInternalList<String>(); } return aWSAccountIds; } }
public class class_name { public java.util.List<String> getAWSAccountIds() { if (aWSAccountIds == null) { aWSAccountIds = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return aWSAccountIds; } }
public class class_name { public TransactGetItemsRequest withTransactItems(TransactGetItem... transactItems) { if (this.transactItems == null) { setTransactItems(new java.util.ArrayList<TransactGetItem>(transactItems.length)); } for (TransactGetItem ele : transactItems) { this.transactItems.add(ele); } return this; } }
public class class_name { public TransactGetItemsRequest withTransactItems(TransactGetItem... transactItems) { if (this.transactItems == null) { setTransactItems(new java.util.ArrayList<TransactGetItem>(transactItems.length)); // depends on control dependency: [if], data = [none] } for (TransactGetItem ele : transactItems) { this.transactItems.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public CMASpace create(CMASpace space, String organizationId) { assertNotNull(space, "space"); assertNotNull(space.getName(), "spaceName"); assertNotNull(organizationId, "organizationId"); final CMASystem system = space.getSystem(); space.setSystem(null); try { return service.create(organizationId, space).blockingFirst(); } finally { space.setSystem(system); } } }
public class class_name { public CMASpace create(CMASpace space, String organizationId) { assertNotNull(space, "space"); assertNotNull(space.getName(), "spaceName"); assertNotNull(organizationId, "organizationId"); final CMASystem system = space.getSystem(); space.setSystem(null); try { return service.create(organizationId, space).blockingFirst(); // depends on control dependency: [try], data = [none] } finally { space.setSystem(system); } } }
public class class_name { @Pure public double distance(BusItineraryHalt halt) { assert halt != null; final GeoLocationPoint p = getGeoPosition(); final GeoLocationPoint p2 = halt.getGeoPosition(); if (p != null && p2 != null) { return Point2D.getDistancePointPoint(p.getX(), p.getY(), p2.getX(), p2.getY()); } return Double.NaN; } }
public class class_name { @Pure public double distance(BusItineraryHalt halt) { assert halt != null; final GeoLocationPoint p = getGeoPosition(); final GeoLocationPoint p2 = halt.getGeoPosition(); if (p != null && p2 != null) { return Point2D.getDistancePointPoint(p.getX(), p.getY(), p2.getX(), p2.getY()); // depends on control dependency: [if], data = [(p] } return Double.NaN; } }
public class class_name { public static String printInputParams(JoinPoint joinPoint, String... includeParamNames) { try { if (joinPoint == null) { return "joinPoint is null"; } Signature signature = joinPoint.getSignature(); if (!(signature instanceof MethodSignature)) { return PRINT_EMPTY_LIST; } Optional<LoggingAspectConfig> config = AopAnnotationUtils.getConfigAnnotation(joinPoint); String[] includeParams = includeParamNames; String[] excludeParams = EMPTY_ARRAY; boolean inputCollectionAware = LoggingAspectConfig.DEFAULT_INPUT_COLLECTION_AWARE; if (config.isPresent()) { if (!config.get().inputDetails()) { return PRINT_HIDDEN; } inputCollectionAware = config.get().inputCollectionAware(); if (ArrayUtils.isNotEmpty(config.get().inputIncludeParams())) { includeParams = config.get().inputIncludeParams(); } if (ArrayUtils.isEmpty(includeParams) && ArrayUtils.isNotEmpty(config.get().inputExcludeParams())) { excludeParams = config.get().inputExcludeParams(); } } MethodSignature ms = (MethodSignature) signature; String[] params = ms.getParameterNames(); return ArrayUtils.isNotEmpty(params) ? renderParams(joinPoint, params, includeParams, excludeParams, inputCollectionAware) : PRINT_EMPTY_LIST; } catch (IndexOutOfBoundsException | IllegalArgumentException e) { log.warn("Error while print params: {}, params = {}", e, joinPoint.getArgs()); return "printerror: " + e; } } }
public class class_name { public static String printInputParams(JoinPoint joinPoint, String... includeParamNames) { try { if (joinPoint == null) { return "joinPoint is null"; // depends on control dependency: [if], data = [none] } Signature signature = joinPoint.getSignature(); if (!(signature instanceof MethodSignature)) { return PRINT_EMPTY_LIST; // depends on control dependency: [if], data = [none] } Optional<LoggingAspectConfig> config = AopAnnotationUtils.getConfigAnnotation(joinPoint); String[] includeParams = includeParamNames; String[] excludeParams = EMPTY_ARRAY; boolean inputCollectionAware = LoggingAspectConfig.DEFAULT_INPUT_COLLECTION_AWARE; if (config.isPresent()) { if (!config.get().inputDetails()) { return PRINT_HIDDEN; // depends on control dependency: [if], data = [none] } inputCollectionAware = config.get().inputCollectionAware(); // depends on control dependency: [if], data = [none] if (ArrayUtils.isNotEmpty(config.get().inputIncludeParams())) { includeParams = config.get().inputIncludeParams(); // depends on control dependency: [if], data = [none] } if (ArrayUtils.isEmpty(includeParams) && ArrayUtils.isNotEmpty(config.get().inputExcludeParams())) { excludeParams = config.get().inputExcludeParams(); // depends on control dependency: [if], data = [none] } } MethodSignature ms = (MethodSignature) signature; String[] params = ms.getParameterNames(); return ArrayUtils.isNotEmpty(params) ? renderParams(joinPoint, params, includeParams, excludeParams, inputCollectionAware) : PRINT_EMPTY_LIST; // depends on control dependency: [try], data = [none] } catch (IndexOutOfBoundsException | IllegalArgumentException e) { log.warn("Error while print params: {}, params = {}", e, joinPoint.getArgs()); return "printerror: " + e; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void findNeighbor(int p) { // if no neighbors available, set flag for UpdatePoint to find if (npoints == 1) { neighbor[p] = p; distance[p] = Float.MAX_VALUE; return; } // find first point unequal to p itself int first = 0; if (p == points[first]) { first = 1; } neighbor[p] = points[first]; distance[p] = linkage.d(p, neighbor[p]); // now test whether each other point is closer for (int i = first + 1; i < npoints; i++) { int q = points[i]; if (q != p) { float d = linkage.d(p, q); if (d < distance[p]) { distance[p] = d; neighbor[p] = q; } } } } }
public class class_name { private void findNeighbor(int p) { // if no neighbors available, set flag for UpdatePoint to find if (npoints == 1) { neighbor[p] = p; // depends on control dependency: [if], data = [none] distance[p] = Float.MAX_VALUE; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // find first point unequal to p itself int first = 0; if (p == points[first]) { first = 1; // depends on control dependency: [if], data = [none] } neighbor[p] = points[first]; distance[p] = linkage.d(p, neighbor[p]); // now test whether each other point is closer for (int i = first + 1; i < npoints; i++) { int q = points[i]; if (q != p) { float d = linkage.d(p, q); if (d < distance[p]) { distance[p] = d; // depends on control dependency: [if], data = [none] neighbor[p] = q; // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static boolean isEmpty(final String str) { if(str == null || str.isEmpty()) { return true; } if(str.length() == 1) { return str.charAt(0) == '\u0000'; } return false; } }
public class class_name { public static boolean isEmpty(final String str) { if(str == null || str.isEmpty()) { return true; // depends on control dependency: [if], data = [none] } if(str.length() == 1) { return str.charAt(0) == '\u0000'; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static void extractText(JCas jcas, BDocument bDocument, String docId, boolean expandAbbrevs) { StringBuffer sb = new StringBuffer(""); int currBegin = 0, currPageId = 0; DocumentPage currPage = new DocumentPage(jcas); currPage.setBegin(0); Set<Abbrev> abbrevs = null; if (expandAbbrevs) { // pass over the text to find abbrevs StringBuffer abbrevSb = new StringBuffer(""); for (BBlock block : bDocument.getBlocks()) { abbrevSb.append(cleanupText(block, docId)); } abbrevs = AbbreviationExpander.getAbbrevs(abbrevSb.toString()); } for (BBlock block : bDocument.getBlocks()) { String text = cleanupText(block, docId); if (expandAbbrevs) { text = AbbreviationExpander.expand(text, abbrevs); } // add lines int currLineBegin = currBegin; for (BLine bLine : block.getLines()) { String lineText = bLine.getText(); int lineLength = lineText.replaceAll(" +", " ").length(); // LATER watch out: begin,end is ~approximate~ // TODO especially because of abbrev expansion! DocumentLine annLine = new DocumentLine(jcas, currLineBegin, currLineBegin + lineLength); currLineBegin += lineLength; annLine.setX(bLine.getRegion().x); annLine.setY(bLine.getRegion().y); annLine.setHeight(bLine.getRegion().height); annLine.setWidth(bLine.getRegion().width); annLine.setPageId(block.getPageId()); annLine.setBlock(block.getId()); annLine.setLineText(lineText); // LATER a workaround annLine.setBeginnings(new FloatArray(jcas, bLine .getBeginnings().size())); for (int i = 0; i < bLine.getBeginnings().size(); i++) { annLine.setBeginnings(i, bLine.getBeginnings().get(i)); } annLine.setEndings(new FloatArray(jcas, bLine.getEndings() .size())); for (int i = 0; i < bLine.getEndings().size(); i++) { annLine.setEndings(i, bLine.getEndings().get(i)); } annLine.addToIndexes(); } // add block DocumentBlock annBlock = new DocumentBlock(jcas, currBegin, currBegin + text.length()); currBegin += text.length(); sb.append(text); annBlock.setElementId(block.getId()); annBlock.setX(block.getRegion().x); annBlock.setY(block.getRegion().y); annBlock.setHeight(block.getRegion().height); annBlock.setWidth(block.getRegion().width); annBlock.setHasBold(block.isHasBold()); annBlock.setHasManyFontsizes(block.isHasManyFontsizes()); annBlock.setMedianFontsize(block.getMedianFontsize()); annBlock.setPageId(block.getPageId()); annBlock.addToIndexes(); // update page if (block.getPageId() > currPageId) { currPage.setEnd(currBegin); currPage.setPageId(currPageId); currPage.addToIndexes(); currPage = new DocumentPage(jcas); currPage.setBegin(currBegin); currPageId = block.getPageId(); } } jcas.setDocumentText(sb.toString()); } }
public class class_name { public static void extractText(JCas jcas, BDocument bDocument, String docId, boolean expandAbbrevs) { StringBuffer sb = new StringBuffer(""); int currBegin = 0, currPageId = 0; DocumentPage currPage = new DocumentPage(jcas); currPage.setBegin(0); Set<Abbrev> abbrevs = null; if (expandAbbrevs) { // pass over the text to find abbrevs StringBuffer abbrevSb = new StringBuffer(""); for (BBlock block : bDocument.getBlocks()) { abbrevSb.append(cleanupText(block, docId)); // depends on control dependency: [for], data = [block] } abbrevs = AbbreviationExpander.getAbbrevs(abbrevSb.toString()); // depends on control dependency: [if], data = [none] } for (BBlock block : bDocument.getBlocks()) { String text = cleanupText(block, docId); if (expandAbbrevs) { text = AbbreviationExpander.expand(text, abbrevs); // depends on control dependency: [if], data = [none] } // add lines int currLineBegin = currBegin; for (BLine bLine : block.getLines()) { String lineText = bLine.getText(); int lineLength = lineText.replaceAll(" +", " ").length(); // LATER watch out: begin,end is ~approximate~ // TODO especially because of abbrev expansion! DocumentLine annLine = new DocumentLine(jcas, currLineBegin, currLineBegin + lineLength); currLineBegin += lineLength; // depends on control dependency: [for], data = [none] annLine.setX(bLine.getRegion().x); // depends on control dependency: [for], data = [bLine] annLine.setY(bLine.getRegion().y); // depends on control dependency: [for], data = [bLine] annLine.setHeight(bLine.getRegion().height); // depends on control dependency: [for], data = [bLine] annLine.setWidth(bLine.getRegion().width); // depends on control dependency: [for], data = [bLine] annLine.setPageId(block.getPageId()); // depends on control dependency: [for], data = [none] annLine.setBlock(block.getId()); // depends on control dependency: [for], data = [none] annLine.setLineText(lineText); // LATER a workaround // depends on control dependency: [for], data = [none] annLine.setBeginnings(new FloatArray(jcas, bLine .getBeginnings().size())); // depends on control dependency: [for], data = [none] for (int i = 0; i < bLine.getBeginnings().size(); i++) { annLine.setBeginnings(i, bLine.getBeginnings().get(i)); // depends on control dependency: [for], data = [i] } annLine.setEndings(new FloatArray(jcas, bLine.getEndings() .size())); // depends on control dependency: [for], data = [none] for (int i = 0; i < bLine.getEndings().size(); i++) { annLine.setEndings(i, bLine.getEndings().get(i)); // depends on control dependency: [for], data = [i] } annLine.addToIndexes(); // depends on control dependency: [for], data = [none] } // add block DocumentBlock annBlock = new DocumentBlock(jcas, currBegin, currBegin + text.length()); currBegin += text.length(); // depends on control dependency: [for], data = [none] sb.append(text); // depends on control dependency: [for], data = [none] annBlock.setElementId(block.getId()); // depends on control dependency: [for], data = [block] annBlock.setX(block.getRegion().x); // depends on control dependency: [for], data = [block] annBlock.setY(block.getRegion().y); // depends on control dependency: [for], data = [block] annBlock.setHeight(block.getRegion().height); // depends on control dependency: [for], data = [block] annBlock.setWidth(block.getRegion().width); // depends on control dependency: [for], data = [block] annBlock.setHasBold(block.isHasBold()); // depends on control dependency: [for], data = [block] annBlock.setHasManyFontsizes(block.isHasManyFontsizes()); // depends on control dependency: [for], data = [block] annBlock.setMedianFontsize(block.getMedianFontsize()); // depends on control dependency: [for], data = [block] annBlock.setPageId(block.getPageId()); // depends on control dependency: [for], data = [block] annBlock.addToIndexes(); // depends on control dependency: [for], data = [none] // update page if (block.getPageId() > currPageId) { currPage.setEnd(currBegin); // depends on control dependency: [if], data = [none] currPage.setPageId(currPageId); // depends on control dependency: [if], data = [currPageId)] currPage.addToIndexes(); // depends on control dependency: [if], data = [none] currPage = new DocumentPage(jcas); // depends on control dependency: [if], data = [none] currPage.setBegin(currBegin); // depends on control dependency: [if], data = [none] currPageId = block.getPageId(); // depends on control dependency: [if], data = [none] } } jcas.setDocumentText(sb.toString()); } }
public class class_name { protected void generateJsOptionsForTemplateContent(final Map<String, Object> variables, final StringBuilder sb) { sb.append("{\n"); int count = 1; Object localComponentId = null; if (withComponentId) { localComponentId = variables.get(COMPONENT_ID); variables.remove(COMPONENT_ID); } for (final Map.Entry<String, Object> entry : variables.entrySet()) { final String key = entry.getKey(); sb.append(key).append(": ${").append(key).append("}"); if (count < variables.size()) { sb.append(",\n"); } else { sb.append("\n"); } count++; } if (withComponentId) { variables.put(COMPONENT_ID, localComponentId); } sb.append("}"); } }
public class class_name { protected void generateJsOptionsForTemplateContent(final Map<String, Object> variables, final StringBuilder sb) { sb.append("{\n"); int count = 1; Object localComponentId = null; if (withComponentId) { localComponentId = variables.get(COMPONENT_ID); // depends on control dependency: [if], data = [none] variables.remove(COMPONENT_ID); // depends on control dependency: [if], data = [none] } for (final Map.Entry<String, Object> entry : variables.entrySet()) { final String key = entry.getKey(); sb.append(key).append(": ${").append(key).append("}"); // depends on control dependency: [for], data = [none] if (count < variables.size()) { sb.append(",\n"); // depends on control dependency: [if], data = [none] } else { sb.append("\n"); // depends on control dependency: [if], data = [none] } count++; // depends on control dependency: [for], data = [none] } if (withComponentId) { variables.put(COMPONENT_ID, localComponentId); // depends on control dependency: [if], data = [none] } sb.append("}"); } }
public class class_name { public void sort(List<?> list, String property, boolean reverse) { Class<?> type = getObjectClass(list); if (type != null) { sort(list, type, property, reverse); } } }
public class class_name { public void sort(List<?> list, String property, boolean reverse) { Class<?> type = getObjectClass(list); if (type != null) { sort(list, type, property, reverse); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public UserTrades getTradeHistory(TradeHistoryParams params) throws ExchangeException, IOException { Long offset = null; Long count = null; Long startId = null; Long endId = null; WexAuthenticated.SortOrder sort = WexAuthenticated.SortOrder.DESC; Long startTime = null; Long endTime = null; String btcrPair = null; if (params instanceof TradeHistoryParamPaging) { TradeHistoryParamPaging pagingParams = (TradeHistoryParamPaging) params; Integer pageLength = pagingParams.getPageLength(); Integer pageNumber = pagingParams.getPageNumber(); if (pageNumber == null) { pageNumber = 0; } if (pageLength != null) { count = pageLength.longValue(); offset = (long) (pageLength * pageNumber); } else { offset = pageNumber.longValue(); } } if (params instanceof TradeHistoryParamsIdSpan) { TradeHistoryParamsIdSpan idParams = (TradeHistoryParamsIdSpan) params; startId = nullSafeToLong(idParams.getStartId()); endId = nullSafeToLong(idParams.getEndId()); } if (params instanceof TradeHistoryParamsTimeSpan) { TradeHistoryParamsTimeSpan timeParams = (TradeHistoryParamsTimeSpan) params; startTime = nullSafeUnixTime(timeParams.getStartTime()); endTime = nullSafeUnixTime(timeParams.getEndTime()); } if (params instanceof TradeHistoryParamCurrencyPair) { CurrencyPair pair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair(); if (pair != null) { btcrPair = WexAdapters.getPair(pair); } } if (params instanceof WexTransHistoryParams) { sort = ((WexTransHistoryParams) params).getSortOrder(); } Map<Long, WexTradeHistoryResult> resultMap = getBTCETradeHistory(offset, count, startId, endId, sort, startTime, endTime, btcrPair); return WexAdapters.adaptTradeHistory(resultMap); } }
public class class_name { @Override public UserTrades getTradeHistory(TradeHistoryParams params) throws ExchangeException, IOException { Long offset = null; Long count = null; Long startId = null; Long endId = null; WexAuthenticated.SortOrder sort = WexAuthenticated.SortOrder.DESC; Long startTime = null; Long endTime = null; String btcrPair = null; if (params instanceof TradeHistoryParamPaging) { TradeHistoryParamPaging pagingParams = (TradeHistoryParamPaging) params; Integer pageLength = pagingParams.getPageLength(); Integer pageNumber = pagingParams.getPageNumber(); if (pageNumber == null) { pageNumber = 0; // depends on control dependency: [if], data = [none] } if (pageLength != null) { count = pageLength.longValue(); // depends on control dependency: [if], data = [none] offset = (long) (pageLength * pageNumber); // depends on control dependency: [if], data = [(pageLength] } else { offset = pageNumber.longValue(); // depends on control dependency: [if], data = [none] } } if (params instanceof TradeHistoryParamsIdSpan) { TradeHistoryParamsIdSpan idParams = (TradeHistoryParamsIdSpan) params; startId = nullSafeToLong(idParams.getStartId()); endId = nullSafeToLong(idParams.getEndId()); } if (params instanceof TradeHistoryParamsTimeSpan) { TradeHistoryParamsTimeSpan timeParams = (TradeHistoryParamsTimeSpan) params; startTime = nullSafeUnixTime(timeParams.getStartTime()); endTime = nullSafeUnixTime(timeParams.getEndTime()); } if (params instanceof TradeHistoryParamCurrencyPair) { CurrencyPair pair = ((TradeHistoryParamCurrencyPair) params).getCurrencyPair(); if (pair != null) { btcrPair = WexAdapters.getPair(pair); // depends on control dependency: [if], data = [(pair] } } if (params instanceof WexTransHistoryParams) { sort = ((WexTransHistoryParams) params).getSortOrder(); } Map<Long, WexTradeHistoryResult> resultMap = getBTCETradeHistory(offset, count, startId, endId, sort, startTime, endTime, btcrPair); return WexAdapters.adaptTradeHistory(resultMap); } }
public class class_name { public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> listFromTaskWithServiceResponseAsync(final String jobId, final String taskId, final Boolean recursive, final FileListFromTaskOptions fileListFromTaskOptions) { return listFromTaskSinglePageAsync(jobId, taskId, recursive, fileListFromTaskOptions) .concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } FileListFromTaskNextOptions fileListFromTaskNextOptions = null; if (fileListFromTaskOptions != null) { fileListFromTaskNextOptions = new FileListFromTaskNextOptions(); fileListFromTaskNextOptions.withClientRequestId(fileListFromTaskOptions.clientRequestId()); fileListFromTaskNextOptions.withReturnClientRequestId(fileListFromTaskOptions.returnClientRequestId()); fileListFromTaskNextOptions.withOcpDate(fileListFromTaskOptions.ocpDate()); } return Observable.just(page).concatWith(listFromTaskNextWithServiceResponseAsync(nextPageLink, fileListFromTaskNextOptions)); } }); } }
public class class_name { public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> listFromTaskWithServiceResponseAsync(final String jobId, final String taskId, final Boolean recursive, final FileListFromTaskOptions fileListFromTaskOptions) { return listFromTaskSinglePageAsync(jobId, taskId, recursive, fileListFromTaskOptions) .concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } FileListFromTaskNextOptions fileListFromTaskNextOptions = null; if (fileListFromTaskOptions != null) { fileListFromTaskNextOptions = new FileListFromTaskNextOptions(); // depends on control dependency: [if], data = [none] fileListFromTaskNextOptions.withClientRequestId(fileListFromTaskOptions.clientRequestId()); // depends on control dependency: [if], data = [(fileListFromTaskOptions] fileListFromTaskNextOptions.withReturnClientRequestId(fileListFromTaskOptions.returnClientRequestId()); // depends on control dependency: [if], data = [(fileListFromTaskOptions] fileListFromTaskNextOptions.withOcpDate(fileListFromTaskOptions.ocpDate()); // depends on control dependency: [if], data = [(fileListFromTaskOptions] } return Observable.just(page).concatWith(listFromTaskNextWithServiceResponseAsync(nextPageLink, fileListFromTaskNextOptions)); } }); } }
public class class_name { private ProposalResponse sendProposalSerially(TransactionRequest proposalRequest, Collection<Peer> peers) throws ProposalException { ProposalException lastException = new ProposalException("ProposalRequest failed."); for (Peer peer : peers) { proposalRequest.submitted = false; try { Collection<ProposalResponse> proposalResponses = sendProposal(proposalRequest, Collections.singletonList(peer)); if (proposalResponses.isEmpty()) { logger.warn(format("Proposal request to peer %s failed", peer)); } ProposalResponse proposalResponse = proposalResponses.iterator().next(); ChaincodeResponse.Status status = proposalResponse.getStatus(); if (status.getStatus() < 400) { return proposalResponse; } else if (status.getStatus() > 499) { // server error may work on other peer. lastException = new ProposalException(format("Channel %s got exception on peer %s %d. %s ", name, peer, status.getStatus(), proposalResponse.getMessage())); } else { // 400 to 499 throw new ProposalException(format("Channel %s got exception on peer %s %d. %s ", name, peer, status.getStatus(), proposalResponse.getMessage())); } } catch (Exception e) { lastException = new ProposalException(format("Channel %s failed proposal on peer %s %s", name, peer.getName(), e.getMessage()), e); logger.warn(lastException.getMessage()); } } throw lastException; } }
public class class_name { private ProposalResponse sendProposalSerially(TransactionRequest proposalRequest, Collection<Peer> peers) throws ProposalException { ProposalException lastException = new ProposalException("ProposalRequest failed."); for (Peer peer : peers) { proposalRequest.submitted = false; try { Collection<ProposalResponse> proposalResponses = sendProposal(proposalRequest, Collections.singletonList(peer)); if (proposalResponses.isEmpty()) { logger.warn(format("Proposal request to peer %s failed", peer)); // depends on control dependency: [if], data = [none] } ProposalResponse proposalResponse = proposalResponses.iterator().next(); ChaincodeResponse.Status status = proposalResponse.getStatus(); if (status.getStatus() < 400) { return proposalResponse; // depends on control dependency: [if], data = [none] } else if (status.getStatus() > 499) { // server error may work on other peer. lastException = new ProposalException(format("Channel %s got exception on peer %s %d. %s ", name, peer, status.getStatus(), proposalResponse.getMessage())); // depends on control dependency: [if], data = [none] } else { // 400 to 499 throw new ProposalException(format("Channel %s got exception on peer %s %d. %s ", name, peer, status.getStatus(), proposalResponse.getMessage())); } } catch (Exception e) { lastException = new ProposalException(format("Channel %s failed proposal on peer %s %s", name, peer.getName(), e.getMessage()), e); logger.warn(lastException.getMessage()); } // depends on control dependency: [catch], data = [none] } throw lastException; } }
public class class_name { private StringBuffer format(double number, StringBuffer result, FieldPosition fieldPosition, boolean parseAttr) { fieldPosition.setBeginIndex(0); fieldPosition.setEndIndex(0); if (Double.isNaN(number)) { if (fieldPosition.getField() == NumberFormat.INTEGER_FIELD) { fieldPosition.setBeginIndex(result.length()); } else if (fieldPosition.getFieldAttribute() == NumberFormat.Field.INTEGER) { fieldPosition.setBeginIndex(result.length()); } result.append(symbols.getNaN()); // TODO: Combine setting a single FieldPosition or adding to an AttributedCharacterIterator // into a function like recordAttribute(FieldAttribute, begin, end). // [Spark/CDL] Add attribute for NaN here. // result.append(symbols.getNaN()); if (parseAttr) { addAttribute(Field.INTEGER, result.length() - symbols.getNaN().length(), result.length()); } if (fieldPosition.getField() == NumberFormat.INTEGER_FIELD) { fieldPosition.setEndIndex(result.length()); } else if (fieldPosition.getFieldAttribute() == NumberFormat.Field.INTEGER) { fieldPosition.setEndIndex(result.length()); } addPadding(result, fieldPosition, 0, 0); return result; } // Do this BEFORE checking to see if value is negative or infinite and // before rounding. number = multiply(number); boolean isNegative = isNegative(number); number = round(number); if (Double.isInfinite(number)) { int prefixLen = appendAffix(result, isNegative, true, fieldPosition, parseAttr); if (fieldPosition.getField() == NumberFormat.INTEGER_FIELD) { fieldPosition.setBeginIndex(result.length()); } else if (fieldPosition.getFieldAttribute() == NumberFormat.Field.INTEGER) { fieldPosition.setBeginIndex(result.length()); } // [Spark/CDL] Add attribute for infinity here. result.append(symbols.getInfinity()); if (parseAttr) { addAttribute(Field.INTEGER, result.length() - symbols.getInfinity().length(), result.length()); } if (fieldPosition.getField() == NumberFormat.INTEGER_FIELD) { fieldPosition.setEndIndex(result.length()); } else if (fieldPosition.getFieldAttribute() == NumberFormat.Field.INTEGER) { fieldPosition.setEndIndex(result.length()); } int suffixLen = appendAffix(result, isNegative, false, fieldPosition, parseAttr); addPadding(result, fieldPosition, prefixLen, suffixLen); return result; } int precision = precision(false); // This is to fix rounding for scientific notation. See ticket:10542. // This code should go away when a permanent fix is done for ticket:9931. // // This block of code only executes for scientific notation so it will not interfere with the // previous fix in {@link #resetActualRounding} for fixed decimal numbers. // Moreover this code only runs when there is rounding to be done (precision > 0) and when the // rounding mode is something other than ROUND_HALF_EVEN. // This block of code does the correct rounding of number in advance so that it will fit into // the number of digits indicated by precision. In this way, we avoid using the default // ROUND_HALF_EVEN behavior of DigitList. For example, if number = 0.003016 and roundingMode = // ROUND_DOWN and precision = 3 then after this code executes, number = 0.00301 (3 significant digits) if (useExponentialNotation && precision > 0 && number != 0.0 && roundingMode != BigDecimal.ROUND_HALF_EVEN) { int log10RoundingIncr = 1 - precision + (int) Math.floor(Math.log10(Math.abs(number))); double roundingIncReciprocal = 0.0; double roundingInc = 0.0; if (log10RoundingIncr < 0) { roundingIncReciprocal = BigDecimal.ONE.movePointRight(-log10RoundingIncr).doubleValue(); } else { roundingInc = BigDecimal.ONE.movePointRight(log10RoundingIncr).doubleValue(); } number = DecimalFormat.round(number, roundingInc, roundingIncReciprocal, roundingMode, isNegative); } // End fix for ticket:10542 // At this point we are guaranteed a nonnegative finite // number. synchronized (digitList) { digitList.set(number, precision, !useExponentialNotation && !areSignificantDigitsUsed()); return subformat(number, result, fieldPosition, isNegative, false, parseAttr); } } }
public class class_name { private StringBuffer format(double number, StringBuffer result, FieldPosition fieldPosition, boolean parseAttr) { fieldPosition.setBeginIndex(0); fieldPosition.setEndIndex(0); if (Double.isNaN(number)) { if (fieldPosition.getField() == NumberFormat.INTEGER_FIELD) { fieldPosition.setBeginIndex(result.length()); // depends on control dependency: [if], data = [none] } else if (fieldPosition.getFieldAttribute() == NumberFormat.Field.INTEGER) { fieldPosition.setBeginIndex(result.length()); // depends on control dependency: [if], data = [none] } result.append(symbols.getNaN()); // depends on control dependency: [if], data = [none] // TODO: Combine setting a single FieldPosition or adding to an AttributedCharacterIterator // into a function like recordAttribute(FieldAttribute, begin, end). // [Spark/CDL] Add attribute for NaN here. // result.append(symbols.getNaN()); if (parseAttr) { addAttribute(Field.INTEGER, result.length() - symbols.getNaN().length(), result.length()); // depends on control dependency: [if], data = [none] } if (fieldPosition.getField() == NumberFormat.INTEGER_FIELD) { fieldPosition.setEndIndex(result.length()); // depends on control dependency: [if], data = [none] } else if (fieldPosition.getFieldAttribute() == NumberFormat.Field.INTEGER) { fieldPosition.setEndIndex(result.length()); // depends on control dependency: [if], data = [none] } addPadding(result, fieldPosition, 0, 0); // depends on control dependency: [if], data = [none] return result; // depends on control dependency: [if], data = [none] } // Do this BEFORE checking to see if value is negative or infinite and // before rounding. number = multiply(number); boolean isNegative = isNegative(number); number = round(number); if (Double.isInfinite(number)) { int prefixLen = appendAffix(result, isNegative, true, fieldPosition, parseAttr); if (fieldPosition.getField() == NumberFormat.INTEGER_FIELD) { fieldPosition.setBeginIndex(result.length()); // depends on control dependency: [if], data = [none] } else if (fieldPosition.getFieldAttribute() == NumberFormat.Field.INTEGER) { fieldPosition.setBeginIndex(result.length()); // depends on control dependency: [if], data = [none] } // [Spark/CDL] Add attribute for infinity here. result.append(symbols.getInfinity()); // depends on control dependency: [if], data = [none] if (parseAttr) { addAttribute(Field.INTEGER, result.length() - symbols.getInfinity().length(), result.length()); // depends on control dependency: [if], data = [none] } if (fieldPosition.getField() == NumberFormat.INTEGER_FIELD) { fieldPosition.setEndIndex(result.length()); // depends on control dependency: [if], data = [none] } else if (fieldPosition.getFieldAttribute() == NumberFormat.Field.INTEGER) { fieldPosition.setEndIndex(result.length()); // depends on control dependency: [if], data = [none] } int suffixLen = appendAffix(result, isNegative, false, fieldPosition, parseAttr); addPadding(result, fieldPosition, prefixLen, suffixLen); // depends on control dependency: [if], data = [none] return result; // depends on control dependency: [if], data = [none] } int precision = precision(false); // This is to fix rounding for scientific notation. See ticket:10542. // This code should go away when a permanent fix is done for ticket:9931. // // This block of code only executes for scientific notation so it will not interfere with the // previous fix in {@link #resetActualRounding} for fixed decimal numbers. // Moreover this code only runs when there is rounding to be done (precision > 0) and when the // rounding mode is something other than ROUND_HALF_EVEN. // This block of code does the correct rounding of number in advance so that it will fit into // the number of digits indicated by precision. In this way, we avoid using the default // ROUND_HALF_EVEN behavior of DigitList. For example, if number = 0.003016 and roundingMode = // ROUND_DOWN and precision = 3 then after this code executes, number = 0.00301 (3 significant digits) if (useExponentialNotation && precision > 0 && number != 0.0 && roundingMode != BigDecimal.ROUND_HALF_EVEN) { int log10RoundingIncr = 1 - precision + (int) Math.floor(Math.log10(Math.abs(number))); double roundingIncReciprocal = 0.0; double roundingInc = 0.0; if (log10RoundingIncr < 0) { roundingIncReciprocal = BigDecimal.ONE.movePointRight(-log10RoundingIncr).doubleValue(); // depends on control dependency: [if], data = [none] } else { roundingInc = BigDecimal.ONE.movePointRight(log10RoundingIncr).doubleValue(); // depends on control dependency: [if], data = [none] } number = DecimalFormat.round(number, roundingInc, roundingIncReciprocal, roundingMode, isNegative); // depends on control dependency: [if], data = [none] } // End fix for ticket:10542 // At this point we are guaranteed a nonnegative finite // number. synchronized (digitList) { digitList.set(number, precision, !useExponentialNotation && !areSignificantDigitsUsed()); return subformat(number, result, fieldPosition, isNegative, false, parseAttr); } } }
public class class_name { public boolean isNullOrEmpty(String attributeName) { String attr = attributes.get(attributeName); if (attr == null || attr.isEmpty()) { return true; } return false; } }
public class class_name { public boolean isNullOrEmpty(String attributeName) { String attr = attributes.get(attributeName); if (attr == null || attr.isEmpty()) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public static int cint(String str) { if (str != null) try { int i = new Integer(str).intValue(); return i; } catch (NumberFormatException e) { } return -1; } }
public class class_name { public static int cint(String str) { if (str != null) try { int i = new Integer(str).intValue(); return i; // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { } // depends on control dependency: [catch], data = [none] return -1; } }
public class class_name { static String normalize(String path, Iterable<String> moduleRootPaths) { String normalizedPath = path; if (isAmbiguousIdentifier(normalizedPath)) { normalizedPath = MODULE_SLASH + normalizedPath; } // Find a moduleRoot that this URI is under. If none, use as is. for (String moduleRoot : moduleRootPaths) { if (normalizedPath.startsWith(moduleRoot)) { // Make sure that e.g. path "foobar/test.js" is not matched by module "foo", by checking for // a leading slash. String trailing = normalizedPath.substring(moduleRoot.length()); if (trailing.startsWith(MODULE_SLASH)) { return trailing.substring(MODULE_SLASH.length()); } } } // Not underneath any of the roots. return path; } }
public class class_name { static String normalize(String path, Iterable<String> moduleRootPaths) { String normalizedPath = path; if (isAmbiguousIdentifier(normalizedPath)) { normalizedPath = MODULE_SLASH + normalizedPath; // depends on control dependency: [if], data = [none] } // Find a moduleRoot that this URI is under. If none, use as is. for (String moduleRoot : moduleRootPaths) { if (normalizedPath.startsWith(moduleRoot)) { // Make sure that e.g. path "foobar/test.js" is not matched by module "foo", by checking for // a leading slash. String trailing = normalizedPath.substring(moduleRoot.length()); if (trailing.startsWith(MODULE_SLASH)) { return trailing.substring(MODULE_SLASH.length()); // depends on control dependency: [if], data = [none] } } } // Not underneath any of the roots. return path; } }
public class class_name { private boolean shouldInterpretEmptyStringSubmittedValuesAsNull(FacesContext context) { ExternalContext ec = context.getExternalContext(); Boolean interpretEmptyStringAsNull = (Boolean)ec.getApplicationMap().get(MYFACES_EMPTY_VALUES_AS_NULL_PARAM_NAME); // not yet cached... if (interpretEmptyStringAsNull == null) { // parses the web.xml to get the "javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL" value String param = ec.getInitParameter(EMPTY_VALUES_AS_NULL_PARAM_NAME); // evaluate the param interpretEmptyStringAsNull = "true".equalsIgnoreCase(param); // cache the parsed value ec.getApplicationMap().put(MYFACES_EMPTY_VALUES_AS_NULL_PARAM_NAME, interpretEmptyStringAsNull); } return interpretEmptyStringAsNull; } }
public class class_name { private boolean shouldInterpretEmptyStringSubmittedValuesAsNull(FacesContext context) { ExternalContext ec = context.getExternalContext(); Boolean interpretEmptyStringAsNull = (Boolean)ec.getApplicationMap().get(MYFACES_EMPTY_VALUES_AS_NULL_PARAM_NAME); // not yet cached... if (interpretEmptyStringAsNull == null) { // parses the web.xml to get the "javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL" value String param = ec.getInitParameter(EMPTY_VALUES_AS_NULL_PARAM_NAME); // evaluate the param interpretEmptyStringAsNull = "true".equalsIgnoreCase(param); // depends on control dependency: [if], data = [none] // cache the parsed value ec.getApplicationMap().put(MYFACES_EMPTY_VALUES_AS_NULL_PARAM_NAME, interpretEmptyStringAsNull); // depends on control dependency: [if], data = [none] } return interpretEmptyStringAsNull; } }
public class class_name { public int login(Task task, String strUserName, String strPassword, String strDomain) { boolean bCreateServer = false; if ((this.getProperty(DBParams.REMOTE_HOST) != null) && (this.getProperty(DBParams.REMOTE_HOST).length() > 0)) bCreateServer = true; org.jbundle.thin.base.remote.RemoteTask remoteTask = (org.jbundle.thin.base.remote.RemoteTask)this.getRemoteTask(null, strUserName, bCreateServer); if (remoteTask != null) return super.login(task, strUserName, strPassword, strDomain); // Remote client - have server log me in else { // If I'm not remote, I need to read the user info. Map<String,Object> mapDomainProperties = this.setDomainProperties(task, strDomain); this.setProperty(Params.USER_ID, null); this.setProperty(Params.USER_NAME, null); if (Utility.isNumeric(strUserName)) this.setProperty(Params.USER_ID, strUserName); else this.setProperty(Params.USER_NAME, strUserName); if ((this.getProperty(Params.USER_ID) == null) || (this.getProperty(Params.USER_ID).length() == 0)) if ((this.getProperty(Params.USER_NAME) == null) || (this.getProperty(Params.USER_NAME).length() == 0)) { // If user is not specified (either for no user, or logout), use the anonymous user Record recUserControl = null; if (m_systemRecordOwner != null) { // Always recUserControl = (Record)m_systemRecordOwner.getRecord(UserControlModel.USER_CONTROL_FILE); if (recUserControl == null) recUserControl = Record.makeRecordFromClassName(UserControlModel.THICK_CLASS, m_systemRecordOwner); String strUserID = recUserControl.getField(UserControlModel.ANON_USER_INFO_ID).getString(); if ((strUserID == null) || (strUserID.length() == 0)) strUserID = DBConstants.ANON_USER_ID; this.setProperty(Params.USER_ID, strUserID); } } if (this.readUserInfo(false, true) == true) { UserInfoModel recUserInfo = this.getUserInfo(); if ((strPassword != null) && (strPassword.length() > 0)) { while (strPassword.endsWith("%3D")) { strPassword = strPassword.substring(0, strPassword.length() - 3) + "="; // Often converted when passing URLs } if (!strPassword.equals(recUserInfo.getField(UserInfoModel.PASSWORD).toString())) { return task.setLastError(this.getString("User name and password do not match")); } // Create and save the remote authorization token. String strToken = Long.toString((long)(Math.random() * Long.MAX_VALUE)); strToken = Base64.encode(strToken); this.setProperty(DBParams.AUTH_TOKEN, strToken); // todo(don) HACK - For now, authentication is the SHA password! See ServletTask/777 this.setProperty(DBParams.AUTH_TOKEN, strPassword); // NO NO NO } Record recUserGroup = ((ReferenceField)recUserInfo.getField(UserInfoModel.USER_GROUP_ID)).getReference(); String strSecurityMap = null; Map<String,Object> mapUserProperties = ((PropertiesField)recUserInfo.getField(UserInfoModel.PROPERTIES)).getProperties(); Map<String,Object> mapGroupProperties = null; if (recUserGroup != null) { strSecurityMap = recUserGroup.getField(UserGroupModel.ACCESS_MAP).toString(); mapGroupProperties = ((PropertiesField)recUserGroup.getField(UserGroupModel.PROPERTIES)).getProperties(); } if (strSecurityMap == null) strSecurityMap = DBConstants.BLANK; // The signals the the user is signed on this.setProperty(Params.SECURITY_MAP, strSecurityMap); this.setProperty(Params.SECURITY_LEVEL, ((strPassword == null) || (strPassword.length() == 0)) ? Integer.toString(Constants.LOGIN_USER) : Integer.toString(Constants.LOGIN_AUTHENTICATED)); if ((DBConstants.ANON_USER_ID.equals(recUserInfo.getField(UserInfoModel.ID).toString())) || (recUserInfo == null)) this.setProperty(Params.SECURITY_LEVEL, Integer.toString(Constants.LOGIN_USER)); // Special case - If user is anonymous, level is always anonymous Map<String,Object> properties = new Hashtable<String,Object>(); if (mapDomainProperties != null) properties.putAll(mapDomainProperties); // Merge the properties if (mapGroupProperties != null) properties.putAll(mapGroupProperties); // Merge the properties if (mapUserProperties != null) properties.putAll(mapUserProperties); // Merge the properties if (recUserInfo != null) { this.setProperty(DBParams.USER_ID, recUserInfo.getField(UserInfoModel.ID).toString()); if (!recUserInfo.getField(UserInfoModel.USER_NAME).isNull()) this.setProperty(DBParams.USER_NAME, recUserInfo.getField(UserInfoModel.USER_NAME).toString()); if (properties != null) { properties.put(DBParams.USER_ID, recUserInfo.getField(UserInfo.ID).toString()); if (!recUserInfo.getField(UserInfoModel.USER_NAME).isNull()) properties.put(DBParams.USER_NAME, recUserInfo.getField(UserInfoModel.USER_NAME).toString()); if (this.getProperty(DBParams.AUTH_TOKEN) != null) properties.put(DBParams.AUTH_TOKEN, this.getProperty(DBParams.AUTH_TOKEN)); } } m_systemRecordOwner.setProperties(properties); // These are the user properties UserLogModel recUserLog = null; if (m_systemRecordOwner != null) { // Always recUserLog = (UserLogModel)m_systemRecordOwner.getRecord(UserLogModel.USER_LOG_FILE); if (recUserLog == null) recUserLog = (UserLogModel)Record.makeRecordFromClassName(UserLogModel.THICK_CLASS, m_systemRecordOwner); } if (recUserLog != null) if (this.getProperty(DBParams.USER_ID) != null) if (this.getProperty(DBParams.USER_ID).length() > 0) if (!DBConstants.ANON_USER_ID.equals(this.getProperty(DBParams.USER_ID))) { try { int iUserID = Integer.parseInt(this.getProperty(DBParams.USER_ID)); int iUserLogTypeID = UserLogTypeModel.LOGIN; String strMessage = "Login"; recUserLog.log(iUserID, iUserLogTypeID, strMessage); } catch (NumberFormatException e) { // Ignore } } return Constants.NORMAL_RETURN; } else if (task != null) return task.setLastError(this.getString("User name and password do not match")); else return DBConstants.ERROR_RETURN; } } }
public class class_name { public int login(Task task, String strUserName, String strPassword, String strDomain) { boolean bCreateServer = false; if ((this.getProperty(DBParams.REMOTE_HOST) != null) && (this.getProperty(DBParams.REMOTE_HOST).length() > 0)) bCreateServer = true; org.jbundle.thin.base.remote.RemoteTask remoteTask = (org.jbundle.thin.base.remote.RemoteTask)this.getRemoteTask(null, strUserName, bCreateServer); if (remoteTask != null) return super.login(task, strUserName, strPassword, strDomain); // Remote client - have server log me in else { // If I'm not remote, I need to read the user info. Map<String,Object> mapDomainProperties = this.setDomainProperties(task, strDomain); this.setProperty(Params.USER_ID, null); // depends on control dependency: [if], data = [null)] this.setProperty(Params.USER_NAME, null); // depends on control dependency: [if], data = [null)] if (Utility.isNumeric(strUserName)) this.setProperty(Params.USER_ID, strUserName); else this.setProperty(Params.USER_NAME, strUserName); if ((this.getProperty(Params.USER_ID) == null) || (this.getProperty(Params.USER_ID).length() == 0)) if ((this.getProperty(Params.USER_NAME) == null) || (this.getProperty(Params.USER_NAME).length() == 0)) { // If user is not specified (either for no user, or logout), use the anonymous user Record recUserControl = null; if (m_systemRecordOwner != null) { // Always recUserControl = (Record)m_systemRecordOwner.getRecord(UserControlModel.USER_CONTROL_FILE); // depends on control dependency: [if], data = [none] if (recUserControl == null) recUserControl = Record.makeRecordFromClassName(UserControlModel.THICK_CLASS, m_systemRecordOwner); String strUserID = recUserControl.getField(UserControlModel.ANON_USER_INFO_ID).getString(); if ((strUserID == null) || (strUserID.length() == 0)) strUserID = DBConstants.ANON_USER_ID; this.setProperty(Params.USER_ID, strUserID); // depends on control dependency: [if], data = [none] } } if (this.readUserInfo(false, true) == true) { UserInfoModel recUserInfo = this.getUserInfo(); if ((strPassword != null) && (strPassword.length() > 0)) { while (strPassword.endsWith("%3D")) { strPassword = strPassword.substring(0, strPassword.length() - 3) + "="; // Often converted when passing URLs // depends on control dependency: [while], data = [none] } if (!strPassword.equals(recUserInfo.getField(UserInfoModel.PASSWORD).toString())) { return task.setLastError(this.getString("User name and password do not match")); // depends on control dependency: [if], data = [none] } // Create and save the remote authorization token. String strToken = Long.toString((long)(Math.random() * Long.MAX_VALUE)); strToken = Base64.encode(strToken); // depends on control dependency: [if], data = [none] this.setProperty(DBParams.AUTH_TOKEN, strToken); // depends on control dependency: [if], data = [none] // todo(don) HACK - For now, authentication is the SHA password! See ServletTask/777 this.setProperty(DBParams.AUTH_TOKEN, strPassword); // NO NO NO // depends on control dependency: [if], data = [none] } Record recUserGroup = ((ReferenceField)recUserInfo.getField(UserInfoModel.USER_GROUP_ID)).getReference(); String strSecurityMap = null; Map<String,Object> mapUserProperties = ((PropertiesField)recUserInfo.getField(UserInfoModel.PROPERTIES)).getProperties(); Map<String,Object> mapGroupProperties = null; if (recUserGroup != null) { strSecurityMap = recUserGroup.getField(UserGroupModel.ACCESS_MAP).toString(); // depends on control dependency: [if], data = [none] mapGroupProperties = ((PropertiesField)recUserGroup.getField(UserGroupModel.PROPERTIES)).getProperties(); // depends on control dependency: [if], data = [none] } if (strSecurityMap == null) strSecurityMap = DBConstants.BLANK; // The signals the the user is signed on this.setProperty(Params.SECURITY_MAP, strSecurityMap); // depends on control dependency: [if], data = [none] this.setProperty(Params.SECURITY_LEVEL, ((strPassword == null) || (strPassword.length() == 0)) ? Integer.toString(Constants.LOGIN_USER) : Integer.toString(Constants.LOGIN_AUTHENTICATED)); // depends on control dependency: [if], data = [none] if ((DBConstants.ANON_USER_ID.equals(recUserInfo.getField(UserInfoModel.ID).toString())) || (recUserInfo == null)) this.setProperty(Params.SECURITY_LEVEL, Integer.toString(Constants.LOGIN_USER)); // Special case - If user is anonymous, level is always anonymous Map<String,Object> properties = new Hashtable<String,Object>(); if (mapDomainProperties != null) properties.putAll(mapDomainProperties); // Merge the properties if (mapGroupProperties != null) properties.putAll(mapGroupProperties); // Merge the properties if (mapUserProperties != null) properties.putAll(mapUserProperties); // Merge the properties if (recUserInfo != null) { this.setProperty(DBParams.USER_ID, recUserInfo.getField(UserInfoModel.ID).toString()); // depends on control dependency: [if], data = [none] if (!recUserInfo.getField(UserInfoModel.USER_NAME).isNull()) this.setProperty(DBParams.USER_NAME, recUserInfo.getField(UserInfoModel.USER_NAME).toString()); if (properties != null) { properties.put(DBParams.USER_ID, recUserInfo.getField(UserInfo.ID).toString()); // depends on control dependency: [if], data = [none] if (!recUserInfo.getField(UserInfoModel.USER_NAME).isNull()) properties.put(DBParams.USER_NAME, recUserInfo.getField(UserInfoModel.USER_NAME).toString()); if (this.getProperty(DBParams.AUTH_TOKEN) != null) properties.put(DBParams.AUTH_TOKEN, this.getProperty(DBParams.AUTH_TOKEN)); } } m_systemRecordOwner.setProperties(properties); // These are the user properties // depends on control dependency: [if], data = [none] UserLogModel recUserLog = null; if (m_systemRecordOwner != null) { // Always recUserLog = (UserLogModel)m_systemRecordOwner.getRecord(UserLogModel.USER_LOG_FILE); // depends on control dependency: [if], data = [none] if (recUserLog == null) recUserLog = (UserLogModel)Record.makeRecordFromClassName(UserLogModel.THICK_CLASS, m_systemRecordOwner); } if (recUserLog != null) if (this.getProperty(DBParams.USER_ID) != null) if (this.getProperty(DBParams.USER_ID).length() > 0) if (!DBConstants.ANON_USER_ID.equals(this.getProperty(DBParams.USER_ID))) { try { int iUserID = Integer.parseInt(this.getProperty(DBParams.USER_ID)); int iUserLogTypeID = UserLogTypeModel.LOGIN; String strMessage = "Login"; recUserLog.log(iUserID, iUserLogTypeID, strMessage); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { // Ignore } // depends on control dependency: [catch], data = [none] } return Constants.NORMAL_RETURN; // depends on control dependency: [if], data = [none] } else if (task != null) return task.setLastError(this.getString("User name and password do not match")); else return DBConstants.ERROR_RETURN; } } }
public class class_name { public final static List<PolymerNotation> getBLOBPolymers(List<PolymerNotation> polymers) { List<PolymerNotation> blobPolymers = new ArrayList<PolymerNotation>(); for (PolymerNotation polymer : polymers) { if (polymer.getPolymerID() instanceof BlobEntity) { blobPolymers.add(polymer); } } return blobPolymers; } }
public class class_name { public final static List<PolymerNotation> getBLOBPolymers(List<PolymerNotation> polymers) { List<PolymerNotation> blobPolymers = new ArrayList<PolymerNotation>(); for (PolymerNotation polymer : polymers) { if (polymer.getPolymerID() instanceof BlobEntity) { blobPolymers.add(polymer); // depends on control dependency: [if], data = [none] } } return blobPolymers; } }
public class class_name { public static String quote(final String string) { int last = 0; final StringBuilder sb = new StringBuilder(); for (int i = 0; i < string.length(); i++) { if (needsQuoting(string.charAt(i))) { sb.append(string, last, i); last = i = quote(sb, string, i); } } sb.append(string, last, string.length()); return sb.toString(); } }
public class class_name { public static String quote(final String string) { int last = 0; final StringBuilder sb = new StringBuilder(); for (int i = 0; i < string.length(); i++) { if (needsQuoting(string.charAt(i))) { sb.append(string, last, i); // depends on control dependency: [if], data = [none] last = i = quote(sb, string, i); // depends on control dependency: [if], data = [none] } } sb.append(string, last, string.length()); return sb.toString(); } }
public class class_name { protected <C extends BaseUIComponent> C createCell(BaseComponent parent, Object value, String prefix, String style, String width, Class<C> clazz) { C container = null; try { container = clazz.newInstance(); container.setParent(parent); container.setStyles(cellStyle); if (width != null) { container.setWidth(width); } if (value instanceof BaseComponent) { ((BaseComponent) value).setParent(container); } else if (value != null) { createLabel(container, value, prefix, style); } } catch (Exception e) {} ; return container; } }
public class class_name { protected <C extends BaseUIComponent> C createCell(BaseComponent parent, Object value, String prefix, String style, String width, Class<C> clazz) { C container = null; try { container = clazz.newInstance(); // depends on control dependency: [try], data = [none] container.setParent(parent); // depends on control dependency: [try], data = [none] container.setStyles(cellStyle); // depends on control dependency: [try], data = [none] if (width != null) { container.setWidth(width); // depends on control dependency: [if], data = [(width] } if (value instanceof BaseComponent) { ((BaseComponent) value).setParent(container); // depends on control dependency: [if], data = [none] } else if (value != null) { createLabel(container, value, prefix, style); // depends on control dependency: [if], data = [none] } } catch (Exception e) {} // depends on control dependency: [catch], data = [none] ; return container; } }
public class class_name { public static void runExample( AdManagerServices adManagerServices, AdManagerSession session, long customTargetingValueId) throws RemoteException { // Get the CustomTargetingService. CustomTargetingServiceInterface customTargetingService = adManagerServices.get(session, CustomTargetingServiceInterface.class); // Create a statement to select custom targeting value. StatementBuilder statementBuilder = new StatementBuilder() .where("WHERE id = :id") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("id", customTargetingValueId); // Default for total result set size. int totalResultSetSize = 0; do { // Get custom targeting values by statement. CustomTargetingValuePage page = customTargetingService.getCustomTargetingValuesByStatement( statementBuilder.toStatement()); if (page.getResults() != null) { totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (CustomTargetingValue customTargetingValue : page.getResults()) { System.out.printf( "%d) Custom targeting value with ID %d" + " will be deleted.%n", i++, customTargetingValue.getId()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of custom targeting values to be deleted: %d%n", totalResultSetSize); if (totalResultSetSize > 0) { // Remove limit and offset from statement. statementBuilder.removeLimitAndOffset(); // Create action. com.google.api.ads.admanager.axis.v201902.DeleteCustomTargetingValues action = new com.google.api.ads.admanager.axis.v201902.DeleteCustomTargetingValues(); // Perform action. UpdateResult result = customTargetingService.performCustomTargetingValueAction( action, statementBuilder.toStatement()); if (result != null && result.getNumChanges() > 0) { System.out.printf( "Number of custom targeting values deleted: %d%n", result.getNumChanges()); } else { System.out.println("No custom targeting values deleted."); } } } }
public class class_name { public static void runExample( AdManagerServices adManagerServices, AdManagerSession session, long customTargetingValueId) throws RemoteException { // Get the CustomTargetingService. CustomTargetingServiceInterface customTargetingService = adManagerServices.get(session, CustomTargetingServiceInterface.class); // Create a statement to select custom targeting value. StatementBuilder statementBuilder = new StatementBuilder() .where("WHERE id = :id") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("id", customTargetingValueId); // Default for total result set size. int totalResultSetSize = 0; do { // Get custom targeting values by statement. CustomTargetingValuePage page = customTargetingService.getCustomTargetingValuesByStatement( statementBuilder.toStatement()); if (page.getResults() != null) { totalResultSetSize = page.getTotalResultSetSize(); // depends on control dependency: [if], data = [none] int i = page.getStartIndex(); for (CustomTargetingValue customTargetingValue : page.getResults()) { System.out.printf( "%d) Custom targeting value with ID %d" + " will be deleted.%n", // depends on control dependency: [for], data = [none] i++, customTargetingValue.getId()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of custom targeting values to be deleted: %d%n", totalResultSetSize); if (totalResultSetSize > 0) { // Remove limit and offset from statement. statementBuilder.removeLimitAndOffset(); // Create action. com.google.api.ads.admanager.axis.v201902.DeleteCustomTargetingValues action = new com.google.api.ads.admanager.axis.v201902.DeleteCustomTargetingValues(); // Perform action. UpdateResult result = customTargetingService.performCustomTargetingValueAction( action, statementBuilder.toStatement()); if (result != null && result.getNumChanges() > 0) { System.out.printf( "Number of custom targeting values deleted: %d%n", result.getNumChanges()); } else { System.out.println("No custom targeting values deleted."); } } } }
public class class_name { public static Word2Vec readWord2VecModel(@NonNull File file, boolean extendedModel) { if (!file.exists() || !file.isFile()) throw new ND4JIllegalStateException("File [" + file.getAbsolutePath() + "] doesn't exist"); Word2Vec vec = null; int originalFreq = Nd4j.getMemoryManager().getOccasionalGcFrequency(); boolean originalPeriodic = Nd4j.getMemoryManager().isPeriodicGcActive(); if (originalPeriodic) Nd4j.getMemoryManager().togglePeriodicGc(false); Nd4j.getMemoryManager().setOccasionalGcFrequency(50000); // try to load zip format try { vec = readWord2Vec(file, extendedModel); return vec; } catch (Exception e) { // let's try to load this file as csv file try { if (extendedModel) { vec = readAsExtendedModel(file); return vec; } else { vec = readAsSimplifiedModel(file); return vec; } } catch (Exception ex) { try { vec = readAsCsv(file); return vec; } catch (Exception exc) { try { vec = readAsBinary(file); return vec; } catch (Exception exce) { try { vec = readAsBinaryNoLineBreaks(file); return vec; } catch (Exception excep) { throw new RuntimeException("Unable to guess input file format. Please use corresponding loader directly"); } } } } } } }
public class class_name { public static Word2Vec readWord2VecModel(@NonNull File file, boolean extendedModel) { if (!file.exists() || !file.isFile()) throw new ND4JIllegalStateException("File [" + file.getAbsolutePath() + "] doesn't exist"); Word2Vec vec = null; int originalFreq = Nd4j.getMemoryManager().getOccasionalGcFrequency(); boolean originalPeriodic = Nd4j.getMemoryManager().isPeriodicGcActive(); if (originalPeriodic) Nd4j.getMemoryManager().togglePeriodicGc(false); Nd4j.getMemoryManager().setOccasionalGcFrequency(50000); // try to load zip format try { vec = readWord2Vec(file, extendedModel); return vec; } catch (Exception e) { // let's try to load this file as csv file try { if (extendedModel) { vec = readAsExtendedModel(file); // depends on control dependency: [if], data = [none] return vec; // depends on control dependency: [if], data = [none] } else { vec = readAsSimplifiedModel(file); // depends on control dependency: [if], data = [none] return vec; // depends on control dependency: [if], data = [none] } } catch (Exception ex) { try { vec = readAsCsv(file); // depends on control dependency: [try], data = [none] return vec; // depends on control dependency: [try], data = [none] } catch (Exception exc) { try { vec = readAsBinary(file); // depends on control dependency: [try], data = [none] return vec; // depends on control dependency: [try], data = [none] } catch (Exception exce) { try { vec = readAsBinaryNoLineBreaks(file); // depends on control dependency: [try], data = [none] return vec; // depends on control dependency: [try], data = [none] } catch (Exception excep) { throw new RuntimeException("Unable to guess input file format. Please use corresponding loader directly"); } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public com.google.appengine.v1.ScriptHandlerOrBuilder getScriptOrBuilder() { if (handlerTypeCase_ == 3) { return (com.google.appengine.v1.ScriptHandler) handlerType_; } return com.google.appengine.v1.ScriptHandler.getDefaultInstance(); } }
public class class_name { public com.google.appengine.v1.ScriptHandlerOrBuilder getScriptOrBuilder() { if (handlerTypeCase_ == 3) { return (com.google.appengine.v1.ScriptHandler) handlerType_; // depends on control dependency: [if], data = [none] } return com.google.appengine.v1.ScriptHandler.getDefaultInstance(); } }
public class class_name { @Pure protected final @Nullable Attribute get_stack_map_table_attribute(MethodGen mgen) { for (Attribute a : mgen.getCodeAttributes()) { if (is_stack_map_table(a)) { return a; } } return null; } }
public class class_name { @Pure protected final @Nullable Attribute get_stack_map_table_attribute(MethodGen mgen) { for (Attribute a : mgen.getCodeAttributes()) { if (is_stack_map_table(a)) { return a; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public int getSumDegree() { if(sumDegree < 0) { int sum = 0; for(Word word : words) { if(word != null && word.getDegree() > -1) { sum += word.getDegree(); } } sumDegree = sum; } return sumDegree; } }
public class class_name { public int getSumDegree() { if(sumDegree < 0) { int sum = 0; for(Word word : words) { if(word != null && word.getDegree() > -1) { sum += word.getDegree(); // depends on control dependency: [if], data = [none] } } sumDegree = sum; // depends on control dependency: [if], data = [none] } return sumDegree; } }
public class class_name { public Pattern<T, F> or(IterativeCondition<F> condition) { Preconditions.checkNotNull(condition, "The condition cannot be null."); ClosureCleaner.clean(condition, true); if (this.condition == null) { this.condition = condition; } else { this.condition = new RichOrCondition<>(this.condition, condition); } return this; } }
public class class_name { public Pattern<T, F> or(IterativeCondition<F> condition) { Preconditions.checkNotNull(condition, "The condition cannot be null."); ClosureCleaner.clean(condition, true); if (this.condition == null) { this.condition = condition; // depends on control dependency: [if], data = [none] } else { this.condition = new RichOrCondition<>(this.condition, condition); // depends on control dependency: [if], data = [(this.condition] } return this; } }
public class class_name { public Matrix getU () { Matrix X = MatrixFactory.createMatrix(n,n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i <= j) { X.set(i, j, LU[i][j]); } } } return X; } }
public class class_name { public Matrix getU () { Matrix X = MatrixFactory.createMatrix(n,n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i <= j) { X.set(i, j, LU[i][j]); // depends on control dependency: [if], data = [(i] } } } return X; } }
public class class_name { public void applyAppendConditionToRequest(final HttpURLConnection request) { if (this.ifMaxSizeLessThanOrEqual != null) { request.setRequestProperty(Constants.HeaderConstants.IF_MAX_SIZE_LESS_THAN_OR_EQUAL, this.ifMaxSizeLessThanOrEqual.toString()); } if (this.ifAppendPositionEqual != null) { request.setRequestProperty(Constants.HeaderConstants.IF_APPEND_POSITION_EQUAL_HEADER, this.ifAppendPositionEqual.toString()); } } }
public class class_name { public void applyAppendConditionToRequest(final HttpURLConnection request) { if (this.ifMaxSizeLessThanOrEqual != null) { request.setRequestProperty(Constants.HeaderConstants.IF_MAX_SIZE_LESS_THAN_OR_EQUAL, this.ifMaxSizeLessThanOrEqual.toString()); // depends on control dependency: [if], data = [none] } if (this.ifAppendPositionEqual != null) { request.setRequestProperty(Constants.HeaderConstants.IF_APPEND_POSITION_EQUAL_HEADER, this.ifAppendPositionEqual.toString()); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public T put(String key, T value) { if (StringUtils.isBlank(key)) { throw new MultiEnvSupportException(String.format("Expected non-empty value for environment, was: %s", key)); } boolean isDefaultEnvironment = false; if (value instanceof MultiEnvDefaultedConfiguration) { isDefaultEnvironment = ((MultiEnvDefaultedConfiguration) value).isDefault(); if (isDefaultEnvironment && this.hasDefaultEnvironment()) { throw new MultiEnvSupportException(String.format( "Only one default environment is allowed per instance. Found %s and %s", key, defaultEnvironment)); } else if (isDefaultEnvironment) { this.defaultEnvironment = key; } } if (value instanceof MultiEnvTemplateConfiguration) { boolean isTemplateEnvironment = ((MultiEnvTemplateConfiguration) value).isTemplate(); if (isTemplateEnvironment && this.hasTemplateEnvironment()) { throw new MultiEnvSupportException(String.format( "Only one template environment is allowed per instance. Found %s and %s", key, templateEnvironment)); } else if (isTemplateEnvironment && isDefaultEnvironment) { throw new MultiEnvSupportException(String.format( "You cannot have a configuration be a default and a template at the same time. Found %s", key)); } else if (isTemplateEnvironment) { this.templateEnvironment = key; } } return map.put(key, value); } }
public class class_name { @Override public T put(String key, T value) { if (StringUtils.isBlank(key)) { throw new MultiEnvSupportException(String.format("Expected non-empty value for environment, was: %s", key)); } boolean isDefaultEnvironment = false; if (value instanceof MultiEnvDefaultedConfiguration) { isDefaultEnvironment = ((MultiEnvDefaultedConfiguration) value).isDefault(); // depends on control dependency: [if], data = [none] if (isDefaultEnvironment && this.hasDefaultEnvironment()) { throw new MultiEnvSupportException(String.format( "Only one default environment is allowed per instance. Found %s and %s", key, defaultEnvironment)); } else if (isDefaultEnvironment) { this.defaultEnvironment = key; // depends on control dependency: [if], data = [none] } } if (value instanceof MultiEnvTemplateConfiguration) { boolean isTemplateEnvironment = ((MultiEnvTemplateConfiguration) value).isTemplate(); if (isTemplateEnvironment && this.hasTemplateEnvironment()) { throw new MultiEnvSupportException(String.format( "Only one template environment is allowed per instance. Found %s and %s", key, templateEnvironment)); } else if (isTemplateEnvironment && isDefaultEnvironment) { throw new MultiEnvSupportException(String.format( "You cannot have a configuration be a default and a template at the same time. Found %s", key)); } else if (isTemplateEnvironment) { this.templateEnvironment = key; // depends on control dependency: [if], data = [none] } } return map.put(key, value); } }
public class class_name { public static ExpressionFactory newInstance(Properties properties) { ClassLoader classLoader; try { classLoader = Thread.currentThread().getContextClassLoader(); } catch (SecurityException e) { classLoader = ExpressionFactory.class.getClassLoader(); } String className = null; String serviceId = "META-INF/services/" + ExpressionFactory.class.getName(); InputStream input = classLoader.getResourceAsStream(serviceId); try { if (input != null) { BufferedReader reader = new BufferedReader(new InputStreamReader(input, "UTF-8")); className = reader.readLine(); reader.close(); } } catch (IOException e) { // do nothing } finally { if (input != null) { try { input.close(); } catch (Exception io) { // do nothing } finally { input = null; } } } if (className == null || className.trim().length() == 0) { try { String home = System.getProperty("java.home"); if (home != null) { String path = home + File.separator + "lib" + File.separator + "el.properties"; File file = new File(path); if (file.exists()) { input = new FileInputStream(file); Properties props = new Properties(); props.load(input); className = props.getProperty(ExpressionFactory.class.getName()); } } } catch (IOException e) { // do nothing } catch (SecurityException e) { // do nothing } finally { if (input != null) { try { input.close(); } catch (IOException io) { // do nothing } finally { input = null; } } } } if (className == null || className.trim().length() == 0) { try { className = System.getProperty(ExpressionFactory.class.getName()); } catch (Exception se) { // do nothing } } if (className == null || className.trim().length() == 0) { className = "org.camunda.bpm.engine.impl.juel.ExpressionFactoryImpl"; } return newInstance(properties, className, classLoader); } }
public class class_name { public static ExpressionFactory newInstance(Properties properties) { ClassLoader classLoader; try { classLoader = Thread.currentThread().getContextClassLoader(); // depends on control dependency: [try], data = [none] } catch (SecurityException e) { classLoader = ExpressionFactory.class.getClassLoader(); } // depends on control dependency: [catch], data = [none] String className = null; String serviceId = "META-INF/services/" + ExpressionFactory.class.getName(); InputStream input = classLoader.getResourceAsStream(serviceId); try { if (input != null) { BufferedReader reader = new BufferedReader(new InputStreamReader(input, "UTF-8")); className = reader.readLine(); // depends on control dependency: [if], data = [none] reader.close(); // depends on control dependency: [if], data = [none] } } catch (IOException e) { // do nothing } finally { // depends on control dependency: [catch], data = [none] if (input != null) { try { input.close(); // depends on control dependency: [try], data = [none] } catch (Exception io) { // do nothing } finally { // depends on control dependency: [catch], data = [none] input = null; } } } if (className == null || className.trim().length() == 0) { try { String home = System.getProperty("java.home"); if (home != null) { String path = home + File.separator + "lib" + File.separator + "el.properties"; File file = new File(path); if (file.exists()) { input = new FileInputStream(file); // depends on control dependency: [if], data = [none] Properties props = new Properties(); props.load(input); // depends on control dependency: [if], data = [none] className = props.getProperty(ExpressionFactory.class.getName()); // depends on control dependency: [if], data = [none] } } } catch (IOException e) { // do nothing } catch (SecurityException e) { // depends on control dependency: [catch], data = [none] // do nothing } finally { // depends on control dependency: [catch], data = [none] if (input != null) { try { input.close(); // depends on control dependency: [try], data = [none] } catch (IOException io) { // do nothing } finally { // depends on control dependency: [catch], data = [none] input = null; } } } } if (className == null || className.trim().length() == 0) { try { className = System.getProperty(ExpressionFactory.class.getName()); // depends on control dependency: [try], data = [none] } catch (Exception se) { // do nothing } // depends on control dependency: [catch], data = [none] } if (className == null || className.trim().length() == 0) { className = "org.camunda.bpm.engine.impl.juel.ExpressionFactoryImpl"; // depends on control dependency: [if], data = [none] } return newInstance(properties, className, classLoader); } }
public class class_name { VirtualMachineLease getClonedMaxResourcesLease(Collection<AssignableVirtualMachine> avms) { double cpus = 0.0; double mem = 0.0; double disk = 0.0; double network = 0.0; double ports = 0.0; final Map<String, Double> scalars = new HashMap<>(); final Map<String, Protos.Attribute> attributeMap = new HashMap<>(); if (avms != null) { for (AssignableVirtualMachine avm : avms) { Map<VMResource, Double> maxResources = avm.getMaxResources(); Double value = maxResources.get(VMResource.CPU); if (value != null) { cpus = Math.max(cpus, value); } value = maxResources.get(VMResource.Memory); if (value != null) { mem = Math.max(mem, value); } value = maxResources.get(VMResource.Disk); if (value != null) { disk = Math.max(disk, value); } value = maxResources.get(VMResource.Network); if (value != null) { network = Math.max(network, value); } value = maxResources.get(VMResource.Ports); if (value != null) { ports = Math.max(ports, value); } final Map<String, Double> maxScalars = avm.getMaxScalars(); if (maxScalars != null && !maxScalars.isEmpty()) { for (String k : maxScalars.keySet()) scalars.compute(k, (s, oldVal) -> { if (oldVal == null) { oldVal = 0.0; } Double aDouble = maxScalars.get(k); if (aDouble == null) { aDouble = 0.0; } return oldVal + aDouble; }); } final Map<String, Protos.Attribute> attrs = avm.getCurrTotalLease().getAttributeMap(); if (attrs != null && !attrs.isEmpty()) { for (Map.Entry<String, Protos.Attribute> e : attrs.entrySet()) attributeMap.putIfAbsent(e.getKey(), e.getValue()); } } } final double fcpus = cpus; final double fmem = mem; final double fdisk = disk; final double fnetwork = network; final List<VirtualMachineLease.Range> fports = Collections.singletonList( new VirtualMachineLease.Range(100, 100 + (int) ports)); return new VirtualMachineLease() { @Override public String getId() { return "NoID"; } @Override public long getOfferedTime() { return 0; } @Override public String hostname() { return "NoHostname"; } @Override public String getVMID() { return "NoID"; } @Override public double cpuCores() { return fcpus; } @Override public double memoryMB() { return fmem; } @Override public double networkMbps() { return fnetwork; } @Override public double diskMB() { return fdisk; } @Override public List<Range> portRanges() { return fports; } @Override public Protos.Offer getOffer() { return null; } @Override public Map<String, Protos.Attribute> getAttributeMap() { return attributeMap; } @Override public Double getScalarValue(String name) { return scalars.get(name); } @Override public Map<String, Double> getScalarValues() { return scalars; } }; } }
public class class_name { VirtualMachineLease getClonedMaxResourcesLease(Collection<AssignableVirtualMachine> avms) { double cpus = 0.0; double mem = 0.0; double disk = 0.0; double network = 0.0; double ports = 0.0; final Map<String, Double> scalars = new HashMap<>(); final Map<String, Protos.Attribute> attributeMap = new HashMap<>(); if (avms != null) { for (AssignableVirtualMachine avm : avms) { Map<VMResource, Double> maxResources = avm.getMaxResources(); Double value = maxResources.get(VMResource.CPU); if (value != null) { cpus = Math.max(cpus, value); // depends on control dependency: [if], data = [none] } value = maxResources.get(VMResource.Memory); // depends on control dependency: [for], data = [none] if (value != null) { mem = Math.max(mem, value); // depends on control dependency: [if], data = [none] } value = maxResources.get(VMResource.Disk); // depends on control dependency: [for], data = [none] if (value != null) { disk = Math.max(disk, value); // depends on control dependency: [if], data = [none] } value = maxResources.get(VMResource.Network); // depends on control dependency: [for], data = [none] if (value != null) { network = Math.max(network, value); // depends on control dependency: [if], data = [none] } value = maxResources.get(VMResource.Ports); // depends on control dependency: [for], data = [none] if (value != null) { ports = Math.max(ports, value); // depends on control dependency: [if], data = [none] } final Map<String, Double> maxScalars = avm.getMaxScalars(); if (maxScalars != null && !maxScalars.isEmpty()) { for (String k : maxScalars.keySet()) scalars.compute(k, (s, oldVal) -> { if (oldVal == null) { oldVal = 0.0; // depends on control dependency: [if], data = [none] } Double aDouble = maxScalars.get(k); if (aDouble == null) { aDouble = 0.0; // depends on control dependency: [if], data = [none] } return oldVal + aDouble; // depends on control dependency: [for], data = [none] }); } final Map<String, Protos.Attribute> attrs = avm.getCurrTotalLease().getAttributeMap(); if (attrs != null && !attrs.isEmpty()) { for (Map.Entry<String, Protos.Attribute> e : attrs.entrySet()) attributeMap.putIfAbsent(e.getKey(), e.getValue()); } } } final double fcpus = cpus; final double fmem = mem; final double fdisk = disk; final double fnetwork = network; final List<VirtualMachineLease.Range> fports = Collections.singletonList( new VirtualMachineLease.Range(100, 100 + (int) ports)); return new VirtualMachineLease() { @Override public String getId() { return "NoID"; } @Override public long getOfferedTime() { return 0; } @Override public String hostname() { return "NoHostname"; } @Override public String getVMID() { return "NoID"; } @Override public double cpuCores() { return fcpus; } @Override public double memoryMB() { return fmem; } @Override public double networkMbps() { return fnetwork; } @Override public double diskMB() { return fdisk; } @Override public List<Range> portRanges() { return fports; } @Override public Protos.Offer getOffer() { return null; } @Override public Map<String, Protos.Attribute> getAttributeMap() { return attributeMap; } @Override public Double getScalarValue(String name) { return scalars.get(name); } @Override public Map<String, Double> getScalarValues() { return scalars; } }; } }
public class class_name { private boolean doObjectTypesMatch(byte[] aceObjectType, final String assertionObjectType, final AceObjectFlags assertionObjFlags) { boolean res = true; if (assertionObjFlags == null) { return res; } if ((assertionObjFlags.asUInt() & Flag.ACE_OBJECT_TYPE_PRESENT.getValue()) == Flag.ACE_OBJECT_TYPE_PRESENT.getValue()) { if (aceObjectType == null || !GUID.getGuidAsString(aceObjectType).equals(assertionObjectType)) { res = false; } } LOG.debug("doObjectTypesMatch, result: {}", res); return res; } }
public class class_name { private boolean doObjectTypesMatch(byte[] aceObjectType, final String assertionObjectType, final AceObjectFlags assertionObjFlags) { boolean res = true; if (assertionObjFlags == null) { return res; // depends on control dependency: [if], data = [none] } if ((assertionObjFlags.asUInt() & Flag.ACE_OBJECT_TYPE_PRESENT.getValue()) == Flag.ACE_OBJECT_TYPE_PRESENT.getValue()) { if (aceObjectType == null || !GUID.getGuidAsString(aceObjectType).equals(assertionObjectType)) { res = false; // depends on control dependency: [if], data = [none] } } LOG.debug("doObjectTypesMatch, result: {}", res); return res; } }
public class class_name { @Override public void reshape(int numRows, int numCols ) { if( numRows <= data.length ) { this.numRows = numRows; } else { throw new IllegalArgumentException("Requested number of rows is too great."); } if( numCols <= data[0].length ) { this.numCols = numCols; } else { throw new IllegalArgumentException("Requested number of columns is too great."); } } }
public class class_name { @Override public void reshape(int numRows, int numCols ) { if( numRows <= data.length ) { this.numRows = numRows; // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Requested number of rows is too great."); } if( numCols <= data[0].length ) { this.numCols = numCols; // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Requested number of columns is too great."); } } }
public class class_name { public TimerType<T> end(java.util.Date end) { if (end != null) { childNode.getOrCreate("end").text(XMLDate.toXMLFormat(end)); return this; } return null; } }
public class class_name { public TimerType<T> end(java.util.Date end) { if (end != null) { childNode.getOrCreate("end").text(XMLDate.toXMLFormat(end)); // depends on control dependency: [if], data = [(end] return this; // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public void setParent(AstNode parent) { if (parent == this.parent) { return; } // Convert position back to absolute. if (this.parent != null) { setRelative(-this.parent.getAbsolutePosition()); } this.parent = parent; if (parent != null) { setRelative(parent.getAbsolutePosition()); } } }
public class class_name { public void setParent(AstNode parent) { if (parent == this.parent) { return; // depends on control dependency: [if], data = [none] } // Convert position back to absolute. if (this.parent != null) { setRelative(-this.parent.getAbsolutePosition()); // depends on control dependency: [if], data = [none] } this.parent = parent; if (parent != null) { setRelative(parent.getAbsolutePosition()); // depends on control dependency: [if], data = [(parent] } } }
public class class_name { private void assignNames(SortedSet<Assignment> varsToRename) { NameGenerator globalNameGenerator = null; NameGenerator localNameGenerator = null; globalNameGenerator = nameGenerator; nameGenerator.reset(reservedNames, prefix, reservedCharacters); // Local variables never need a prefix. // Also, we need to avoid conflicts between global and local variable // names; we do this by having using the same generator (not two // instances). The case where global variables have a prefix (and // therefore we use two different generators) but a local variable name // might nevertheless conflict with a global one is not handled. localNameGenerator = prefix.isEmpty() ? globalNameGenerator : nameGenerator.clone(reservedNames, "", reservedCharacters); // Generated names and the assignments for non-local vars. List<Assignment> pendingAssignments = new ArrayList<>(); List<String> generatedNamesForAssignments = new ArrayList<>(); for (Assignment a : varsToRename) { if (a.newName != null) { continue; } if (externNames.contains(a.oldName)) { continue; } String newName; if (a.isLocal) { // For local variable, we make the assignment right away. newName = localNameGenerator.generateNextName(); finalizeNameAssignment(a, newName); } else { // For non-local variable, delay finalizing the name assignment // until we know how many new names we'll have of length 2, 3, etc. newName = globalNameGenerator.generateNextName(); pendingAssignments.add(a); generatedNamesForAssignments.add(newName); } reservedNames.add(newName); } // Now that we have a list of generated names, and a list of variable // Assignment objects, we assign the generated names to the vars as // follows: // 1) The most frequent vars get the shorter names. // 2) If N number of vars are going to be assigned names of the same // length, we assign the N names based on the order at which the vars // first appear in the source. This makes the output somewhat less // random, because symbols declared close together are assigned names // that are quite similar. With this heuristic, the output is more // compressible. // For instance, the output may look like: // var da = "..", ea = ".."; // function fa() { .. } function ga() { .. } int numPendingAssignments = generatedNamesForAssignments.size(); for (int i = 0; i < numPendingAssignments;) { SortedSet<Assignment> varsByOrderOfOccurrence = new TreeSet<>(ORDER_OF_OCCURRENCE_COMPARATOR); // Add k number of Assignment to the set, where k is the number of // generated names of the same length. int len = generatedNamesForAssignments.get(i).length(); for (int j = i; j < numPendingAssignments && generatedNamesForAssignments.get(j).length() == len; j++) { varsByOrderOfOccurrence.add(pendingAssignments.get(j)); } // Now, make the assignments for (Assignment a : varsByOrderOfOccurrence) { finalizeNameAssignment(a, generatedNamesForAssignments.get(i)); ++i; } } } }
public class class_name { private void assignNames(SortedSet<Assignment> varsToRename) { NameGenerator globalNameGenerator = null; NameGenerator localNameGenerator = null; globalNameGenerator = nameGenerator; nameGenerator.reset(reservedNames, prefix, reservedCharacters); // Local variables never need a prefix. // Also, we need to avoid conflicts between global and local variable // names; we do this by having using the same generator (not two // instances). The case where global variables have a prefix (and // therefore we use two different generators) but a local variable name // might nevertheless conflict with a global one is not handled. localNameGenerator = prefix.isEmpty() ? globalNameGenerator : nameGenerator.clone(reservedNames, "", reservedCharacters); // Generated names and the assignments for non-local vars. List<Assignment> pendingAssignments = new ArrayList<>(); List<String> generatedNamesForAssignments = new ArrayList<>(); for (Assignment a : varsToRename) { if (a.newName != null) { continue; } if (externNames.contains(a.oldName)) { continue; } String newName; if (a.isLocal) { // For local variable, we make the assignment right away. newName = localNameGenerator.generateNextName(); // depends on control dependency: [if], data = [none] finalizeNameAssignment(a, newName); // depends on control dependency: [if], data = [none] } else { // For non-local variable, delay finalizing the name assignment // until we know how many new names we'll have of length 2, 3, etc. newName = globalNameGenerator.generateNextName(); // depends on control dependency: [if], data = [none] pendingAssignments.add(a); // depends on control dependency: [if], data = [none] generatedNamesForAssignments.add(newName); // depends on control dependency: [if], data = [none] } reservedNames.add(newName); // depends on control dependency: [for], data = [a] } // Now that we have a list of generated names, and a list of variable // Assignment objects, we assign the generated names to the vars as // follows: // 1) The most frequent vars get the shorter names. // 2) If N number of vars are going to be assigned names of the same // length, we assign the N names based on the order at which the vars // first appear in the source. This makes the output somewhat less // random, because symbols declared close together are assigned names // that are quite similar. With this heuristic, the output is more // compressible. // For instance, the output may look like: // var da = "..", ea = ".."; // function fa() { .. } function ga() { .. } int numPendingAssignments = generatedNamesForAssignments.size(); for (int i = 0; i < numPendingAssignments;) { SortedSet<Assignment> varsByOrderOfOccurrence = new TreeSet<>(ORDER_OF_OCCURRENCE_COMPARATOR); // Add k number of Assignment to the set, where k is the number of // generated names of the same length. int len = generatedNamesForAssignments.get(i).length(); for (int j = i; j < numPendingAssignments && generatedNamesForAssignments.get(j).length() == len; j++) { varsByOrderOfOccurrence.add(pendingAssignments.get(j)); // depends on control dependency: [for], data = [j] } // Now, make the assignments for (Assignment a : varsByOrderOfOccurrence) { finalizeNameAssignment(a, generatedNamesForAssignments.get(i)); // depends on control dependency: [for], data = [a] ++i; // depends on control dependency: [for], data = [none] } } } }
public class class_name { @Override protected void onEvent(GHEvent event, String payload) { GHEventPayload.Ping ping; try { ping = GitHub.offline().parseEventPayload(new StringReader(payload), GHEventPayload.Ping.class); } catch (IOException e) { LOGGER.warn("Received malformed PingEvent: " + payload, e); return; } GHRepository repository = ping.getRepository(); if (repository != null) { LOGGER.info("{} webhook received from repo <{}>!", event, repository.getHtmlUrl()); monitor.resolveProblem(GitHubRepositoryName.create(repository.getHtmlUrl().toExternalForm())); } else { GHOrganization organization = ping.getOrganization(); if (organization != null) { LOGGER.info("{} webhook received from org <{}>!", event, organization.getUrl()); } else { LOGGER.warn("{} webhook received with unexpected payload", event); } } } }
public class class_name { @Override protected void onEvent(GHEvent event, String payload) { GHEventPayload.Ping ping; try { ping = GitHub.offline().parseEventPayload(new StringReader(payload), GHEventPayload.Ping.class); // depends on control dependency: [try], data = [none] } catch (IOException e) { LOGGER.warn("Received malformed PingEvent: " + payload, e); return; } // depends on control dependency: [catch], data = [none] GHRepository repository = ping.getRepository(); if (repository != null) { LOGGER.info("{} webhook received from repo <{}>!", event, repository.getHtmlUrl()); // depends on control dependency: [if], data = [none] monitor.resolveProblem(GitHubRepositoryName.create(repository.getHtmlUrl().toExternalForm())); // depends on control dependency: [if], data = [(repository] } else { GHOrganization organization = ping.getOrganization(); if (organization != null) { LOGGER.info("{} webhook received from org <{}>!", event, organization.getUrl()); // depends on control dependency: [if], data = [none] } else { LOGGER.warn("{} webhook received with unexpected payload", event); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public SqlBuilder delete(String tableName) { if (StrUtil.isBlank(tableName)) { throw new DbRuntimeException("Table name is blank !"); } if (null != wrapper) { // 包装表名 tableName = wrapper.wrap(tableName); } sql.append("DELETE FROM ").append(tableName); return this; } }
public class class_name { public SqlBuilder delete(String tableName) { if (StrUtil.isBlank(tableName)) { throw new DbRuntimeException("Table name is blank !"); } if (null != wrapper) { // 包装表名 tableName = wrapper.wrap(tableName); // depends on control dependency: [if], data = [none] } sql.append("DELETE FROM ").append(tableName); return this; } }
public class class_name { @Override public Processor newProcessor(Processor sourceProcessor) { LocalLearnerProcessor newProcessor = new LocalLearnerProcessor(); LocalLearnerProcessor originProcessor = (LocalLearnerProcessor) sourceProcessor; if (originProcessor.getLearner() != null){ newProcessor.setLearner(originProcessor.getLearner().create()); } if (originProcessor.getChangeDetector() != null){ newProcessor.setChangeDetector(originProcessor.getChangeDetector()); } newProcessor.setOutputStream(originProcessor.getOutputStream()); return newProcessor; } }
public class class_name { @Override public Processor newProcessor(Processor sourceProcessor) { LocalLearnerProcessor newProcessor = new LocalLearnerProcessor(); LocalLearnerProcessor originProcessor = (LocalLearnerProcessor) sourceProcessor; if (originProcessor.getLearner() != null){ newProcessor.setLearner(originProcessor.getLearner().create()); // depends on control dependency: [if], data = [(originProcessor.getLearner()] } if (originProcessor.getChangeDetector() != null){ newProcessor.setChangeDetector(originProcessor.getChangeDetector()); // depends on control dependency: [if], data = [(originProcessor.getChangeDetector()] } newProcessor.setOutputStream(originProcessor.getOutputStream()); return newProcessor; } }
public class class_name { protected QueryResult getQueryResult(QueryResponse queryResponse) { QueryResult queryResult = null; if (queryResponse != null) { queryResult = new QueryResult(); queryResult.setEntities(getEntities(queryResponse)); queryResult.setFault(queryResponse.getFault()); queryResult.setMaxResults(queryResponse.getMaxResults()); queryResult.setStartPosition(queryResponse.getStartPosition()); queryResult.setTotalCount(queryResponse.getTotalCount()); } return queryResult; } }
public class class_name { protected QueryResult getQueryResult(QueryResponse queryResponse) { QueryResult queryResult = null; if (queryResponse != null) { queryResult = new QueryResult(); // depends on control dependency: [if], data = [none] queryResult.setEntities(getEntities(queryResponse)); // depends on control dependency: [if], data = [(queryResponse] queryResult.setFault(queryResponse.getFault()); // depends on control dependency: [if], data = [(queryResponse] queryResult.setMaxResults(queryResponse.getMaxResults()); // depends on control dependency: [if], data = [(queryResponse] queryResult.setStartPosition(queryResponse.getStartPosition()); // depends on control dependency: [if], data = [(queryResponse] queryResult.setTotalCount(queryResponse.getTotalCount()); // depends on control dependency: [if], data = [(queryResponse] } return queryResult; } }
public class class_name { public int scanCStringLength() throws IOException { int pos = index; while (true) { while (pos < endIndex) { if (buffer[pos++] == '\0') { return pos - index; } } if (!readMore(STRING_SCAN_SPAN)) { throw new EOFException(); } pos = index; } } }
public class class_name { public int scanCStringLength() throws IOException { int pos = index; while (true) { while (pos < endIndex) { if (buffer[pos++] == '\0') { return pos - index; // depends on control dependency: [if], data = [none] } } if (!readMore(STRING_SCAN_SPAN)) { throw new EOFException(); } pos = index; } } }
public class class_name { public JToolBar createToolBar() { // Create the tool bar toolBar = new JToolBar(); toolBar.putClientProperty("jgoodies.headerStyle", "Both"); toolBar.setRollover(true); toolBar.setFloatable(false); for (int i = 0; i < beans.length; i++) { Icon icon; JButton button; try { final JComponent bean = beans[i]; URL iconURL = bean.getClass().getResource( "images/" + bean.getName() + "Color16.gif"); icon = new ImageIcon(iconURL); button = new JButton(icon); ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { installBean(bean); } }; button.addActionListener(actionListener); } catch (Exception e) { System.out.println("JCalendarDemo.createToolBar(): " + e); button = new JButton(beans[i].getName()); } button.setFocusPainted(false); toolBar.add(button); } return toolBar; } }
public class class_name { public JToolBar createToolBar() { // Create the tool bar toolBar = new JToolBar(); toolBar.putClientProperty("jgoodies.headerStyle", "Both"); toolBar.setRollover(true); toolBar.setFloatable(false); for (int i = 0; i < beans.length; i++) { Icon icon; JButton button; try { final JComponent bean = beans[i]; URL iconURL = bean.getClass().getResource( "images/" + bean.getName() + "Color16.gif"); icon = new ImageIcon(iconURL); // depends on control dependency: [try], data = [none] button = new JButton(icon); // depends on control dependency: [try], data = [none] ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { installBean(bean); } }; button.addActionListener(actionListener); // depends on control dependency: [try], data = [none] } catch (Exception e) { System.out.println("JCalendarDemo.createToolBar(): " + e); button = new JButton(beans[i].getName()); } // depends on control dependency: [catch], data = [none] button.setFocusPainted(false); // depends on control dependency: [for], data = [none] toolBar.add(button); // depends on control dependency: [for], data = [none] } return toolBar; } }
public class class_name { protected int decodeProgressiveScan(int marker) throws IOException { try { while (marker != MarkerConstants.SOS) { readTables(marker); marker = nextMarker(); if (marker == -1) { return marker; } } } catch (JPEGMarkerException e) { // just ignore unknown marker return -1; } int[] componentIndexes = readScanHeader(); validateProgressiveParam(); Component[] components = frameHeader.getComponents(); // Calculate MCU size calculateMCUs(componentIndexes, components); // AC scans can only contain one component, DC scans may contain more // than one component try { int restartsLeft = restartInterval; in.resetBuffer(); resetDecoder(); HuffmanTable curDCTable; HuffmanTable curACTable; /* * Note:If the compressed image data is non-interleaved, the MCU is defined to be one data unit */ // interleaved if (scanHeader.getSs() == 0) { for (int m = 0; m < MCUsPerColumn * MCUsPerRow; m++) { // If support restart interval if (restartInterval > 0 && restartsLeft == 0) { marker = nextMarker(); if (marker > MarkerConstants.RST7 || marker < MarkerConstants.RST0) { return marker; } in.resetBuffer(); resetDecoder(); restartsLeft = restartInterval; } // Begin decode MCU for (int c = 0, index = 0, blkIndex = 0; c < blocksNumInMCU; c++) { index = blocksInMCU[c]; if (c == 0) { blkIndex = 0; } else { if (index == blocksInMCU[c - 1]) { blkIndex++; } else { blkIndex = 0; } } curDCTable = components[index].dcHuffTable; if (scanHeader.getAh() == 0) { // first scan // only DC decodeDCFirst(index, curDCTable, scanHeader.getAl(), allMCUDatas[index][m], blkIndex); } else { // subsequent scans // only DC decodeDCRefine(scanHeader.getAl(), allMCUDatas[index][m], blkIndex); } } // End decode MCU restartsLeft--; } } else { // non-interleaved int componentH = components[componentIndexes[0]].getH(); int componentV = components[componentIndexes[0]].getV(); int blksInVertica = (componentV == 1 ? MCUsPerColumn : ((frameHeader.getY() + 7) / DCTSIZE)); int blksInHorizon = (componentH == 1 ? MCUsPerRow : ((frameHeader.getX() + 7) / DCTSIZE)); int MCUIndex = 0, blkIndex = 0, secondBlkIndex = (componentH == 1 ? 1 : 2); curACTable = components[componentIndexes[0]].acHuffTable; for (int v = 0; v < blksInVertica; v++) { MCUIndex = (v / componentV) * MCUsPerRow - 1; for (int h = 0; h < blksInHorizon; h++) { if (h % componentH == 0) { MCUIndex++; blkIndex = 0; if (v % componentV != 0) { blkIndex = secondBlkIndex; } } // If support restart interval if (restartInterval > 0 && restartsLeft == 0) { marker = nextMarker(); if (marker > MarkerConstants.RST7 || marker < MarkerConstants.RST0) { return marker; } in.resetBuffer(); resetDecoder(); restartsLeft = restartInterval; } if (scanHeader.getAh() == 0) { decodeACFirst(curACTable, scanHeader.getSs(), scanHeader.getSe(), scanHeader.getAl(), allMCUDatas[componentIndexes[0]][MCUIndex], blkIndex); } else { decodeACRefine(curACTable, scanHeader.getSs(), scanHeader.getSe(), scanHeader.getAl(), allMCUDatas[componentIndexes[0]][MCUIndex], blkIndex); } blkIndex++; /* There is always only one block per MCU */ restartsLeft--; } } } marker = nextMarker(); } catch (JPEGMarkerException e) { marker = e.getMarker(); } catch (EOFException e) { marker = -1; } catch (ArrayIndexOutOfBoundsException e) { // Note : just ignore huffman decode error marker = -1; broken = true; } return marker; } }
public class class_name { protected int decodeProgressiveScan(int marker) throws IOException { try { while (marker != MarkerConstants.SOS) { readTables(marker); marker = nextMarker(); if (marker == -1) { return marker; } } } catch (JPEGMarkerException e) { // just ignore unknown marker return -1; } int[] componentIndexes = readScanHeader(); validateProgressiveParam(); Component[] components = frameHeader.getComponents(); // Calculate MCU size calculateMCUs(componentIndexes, components); // AC scans can only contain one component, DC scans may contain more // than one component try { int restartsLeft = restartInterval; in.resetBuffer(); resetDecoder(); HuffmanTable curDCTable; HuffmanTable curACTable; /* * Note:If the compressed image data is non-interleaved, the MCU is defined to be one data unit */ // interleaved if (scanHeader.getSs() == 0) { for (int m = 0; m < MCUsPerColumn * MCUsPerRow; m++) { // If support restart interval if (restartInterval > 0 && restartsLeft == 0) { marker = nextMarker(); // depends on control dependency: [if], data = [none] if (marker > MarkerConstants.RST7 || marker < MarkerConstants.RST0) { return marker; // depends on control dependency: [if], data = [none] } in.resetBuffer(); // depends on control dependency: [if], data = [none] resetDecoder(); // depends on control dependency: [if], data = [none] restartsLeft = restartInterval; // depends on control dependency: [if], data = [none] } // Begin decode MCU for (int c = 0, index = 0, blkIndex = 0; c < blocksNumInMCU; c++) { index = blocksInMCU[c]; // depends on control dependency: [for], data = [c] if (c == 0) { blkIndex = 0; // depends on control dependency: [if], data = [none] } else { if (index == blocksInMCU[c - 1]) { blkIndex++; // depends on control dependency: [if], data = [none] } else { blkIndex = 0; // depends on control dependency: [if], data = [none] } } curDCTable = components[index].dcHuffTable; // depends on control dependency: [for], data = [none] if (scanHeader.getAh() == 0) { // first scan // only DC decodeDCFirst(index, curDCTable, scanHeader.getAl(), allMCUDatas[index][m], blkIndex); // depends on control dependency: [if], data = [none] } else { // subsequent scans // only DC decodeDCRefine(scanHeader.getAl(), allMCUDatas[index][m], blkIndex); // depends on control dependency: [if], data = [none] } } // End decode MCU restartsLeft--; // depends on control dependency: [for], data = [none] } } else { // non-interleaved int componentH = components[componentIndexes[0]].getH(); int componentV = components[componentIndexes[0]].getV(); int blksInVertica = (componentV == 1 ? MCUsPerColumn : ((frameHeader.getY() + 7) / DCTSIZE)); int blksInHorizon = (componentH == 1 ? MCUsPerRow : ((frameHeader.getX() + 7) / DCTSIZE)); int MCUIndex = 0, blkIndex = 0, secondBlkIndex = (componentH == 1 ? 1 : 2); curACTable = components[componentIndexes[0]].acHuffTable; // depends on control dependency: [if], data = [none] for (int v = 0; v < blksInVertica; v++) { MCUIndex = (v / componentV) * MCUsPerRow - 1; // depends on control dependency: [for], data = [v] for (int h = 0; h < blksInHorizon; h++) { if (h % componentH == 0) { MCUIndex++; // depends on control dependency: [if], data = [none] blkIndex = 0; // depends on control dependency: [if], data = [none] if (v % componentV != 0) { blkIndex = secondBlkIndex; // depends on control dependency: [if], data = [none] } } // If support restart interval if (restartInterval > 0 && restartsLeft == 0) { marker = nextMarker(); // depends on control dependency: [if], data = [none] if (marker > MarkerConstants.RST7 || marker < MarkerConstants.RST0) { return marker; // depends on control dependency: [if], data = [none] } in.resetBuffer(); // depends on control dependency: [if], data = [none] resetDecoder(); // depends on control dependency: [if], data = [none] restartsLeft = restartInterval; // depends on control dependency: [if], data = [none] } if (scanHeader.getAh() == 0) { decodeACFirst(curACTable, scanHeader.getSs(), scanHeader.getSe(), scanHeader.getAl(), allMCUDatas[componentIndexes[0]][MCUIndex], blkIndex); // depends on control dependency: [if], data = [none] } else { decodeACRefine(curACTable, scanHeader.getSs(), scanHeader.getSe(), scanHeader.getAl(), allMCUDatas[componentIndexes[0]][MCUIndex], blkIndex); // depends on control dependency: [if], data = [none] } blkIndex++; // depends on control dependency: [for], data = [none] /* There is always only one block per MCU */ restartsLeft--; // depends on control dependency: [for], data = [none] } } } marker = nextMarker(); } catch (JPEGMarkerException e) { marker = e.getMarker(); } catch (EOFException e) { marker = -1; } catch (ArrayIndexOutOfBoundsException e) { // Note : just ignore huffman decode error marker = -1; broken = true; } return marker; } }
public class class_name { public String displayConfiguration() { StringBuffer result = new StringBuffer(); for (ConfigurationManager confManager : ConfigurationService .getConfigurationService().getConfigurationManager().values()) { Object configuration = confManager.getConfiguration(); StringWriter writer = new StringWriter(); JAXB.marshal(configuration, writer); result.append(writer.getBuffer()); result.append("\n"); } ; return result.toString(); } }
public class class_name { public String displayConfiguration() { StringBuffer result = new StringBuffer(); for (ConfigurationManager confManager : ConfigurationService .getConfigurationService().getConfigurationManager().values()) { Object configuration = confManager.getConfiguration(); StringWriter writer = new StringWriter(); JAXB.marshal(configuration, writer); // depends on control dependency: [for], data = [none] result.append(writer.getBuffer()); // depends on control dependency: [for], data = [none] result.append("\n"); // depends on control dependency: [for], data = [none] } ; return result.toString(); } }
public class class_name { public java.util.List<SchemaExtensionInfo> getSchemaExtensionsInfo() { if (schemaExtensionsInfo == null) { schemaExtensionsInfo = new com.amazonaws.internal.SdkInternalList<SchemaExtensionInfo>(); } return schemaExtensionsInfo; } }
public class class_name { public java.util.List<SchemaExtensionInfo> getSchemaExtensionsInfo() { if (schemaExtensionsInfo == null) { schemaExtensionsInfo = new com.amazonaws.internal.SdkInternalList<SchemaExtensionInfo>(); // depends on control dependency: [if], data = [none] } return schemaExtensionsInfo; } }
public class class_name { public void validate(String path, Schema schema, Object value, List<ValidationResult> results) { if (_rules == null || _rules.length == 0) return; List<ValidationResult> localResults = new ArrayList<ValidationResult>(); for (IValidationRule rule : _rules) { int resultsCount = localResults.size(); rule.validate(path, schema, value, localResults); if (resultsCount == localResults.size()) return; } results.addAll(localResults); } }
public class class_name { public void validate(String path, Schema schema, Object value, List<ValidationResult> results) { if (_rules == null || _rules.length == 0) return; List<ValidationResult> localResults = new ArrayList<ValidationResult>(); for (IValidationRule rule : _rules) { int resultsCount = localResults.size(); rule.validate(path, schema, value, localResults); // depends on control dependency: [for], data = [rule] if (resultsCount == localResults.size()) return; } results.addAll(localResults); } }
public class class_name { @Override public void initDownstream() { for (Controller controller : ctrl.getController()) { if (controller instanceof Pathway) continue; PhysicalEntity pe = (PhysicalEntity) controller; bindDownstream(pe); } for (Control control : ctrl.getControlledOf()) { bindDownstream(control); } for (Process prc : ctrl.getControlled()) { if (prc instanceof Interaction) { bindDownstream(prc); } } } }
public class class_name { @Override public void initDownstream() { for (Controller controller : ctrl.getController()) { if (controller instanceof Pathway) continue; PhysicalEntity pe = (PhysicalEntity) controller; bindDownstream(pe); // depends on control dependency: [for], data = [none] } for (Control control : ctrl.getControlledOf()) { bindDownstream(control); // depends on control dependency: [for], data = [control] } for (Process prc : ctrl.getControlled()) { if (prc instanceof Interaction) { bindDownstream(prc); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private boolean isImplConditHandlerClass(Class<?> implCls) { Class<?>[] classes = implCls.getInterfaces(); if (classes == null) { return false; } // 循环判断其接口是否含有'IConditHandler'接口. for (Class<?> cls: classes) { if (IConditHandler.class.isAssignableFrom(cls)) { return true; } } return false; } }
public class class_name { private boolean isImplConditHandlerClass(Class<?> implCls) { Class<?>[] classes = implCls.getInterfaces(); if (classes == null) { return false; // depends on control dependency: [if], data = [none] } // 循环判断其接口是否含有'IConditHandler'接口. for (Class<?> cls: classes) { if (IConditHandler.class.isAssignableFrom(cls)) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public static boolean launchAppForPackage(final Context context, final String packageName) { try { final PackageManager packageManager = context.getPackageManager(); final Intent intent = packageManager.getLaunchIntentForPackage(packageName); intent.addCategory(Intent.CATEGORY_LAUNCHER); context.startActivity(intent); return true; } catch (Exception ex) { Log.e("Caffeine", "Failed to launch application for package name [" + packageName + "]", ex); return false; } } }
public class class_name { public static boolean launchAppForPackage(final Context context, final String packageName) { try { final PackageManager packageManager = context.getPackageManager(); final Intent intent = packageManager.getLaunchIntentForPackage(packageName); intent.addCategory(Intent.CATEGORY_LAUNCHER); // depends on control dependency: [try], data = [none] context.startActivity(intent); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (Exception ex) { Log.e("Caffeine", "Failed to launch application for package name [" + packageName + "]", ex); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private List<Rule> match(final RuleSet ruleSet, final OgnlContext ognlContext) throws OgnlException { log.debug("Assessing input for ruleset : " + ruleSet.id); //run the input commands ruleSet.runInput(ognlContext); final List<Rule> ret = new ArrayList<>(); //assess each rule against the input, return any that match for (Rule rule : ruleSet.rules) { Boolean bresult = rule.assessMatch(ognlContext); if (bresult) { log.debug(rule.condition.getOriginalExpression() + " matches"); ret.add(rule); } } return ret; } }
public class class_name { private List<Rule> match(final RuleSet ruleSet, final OgnlContext ognlContext) throws OgnlException { log.debug("Assessing input for ruleset : " + ruleSet.id); //run the input commands ruleSet.runInput(ognlContext); final List<Rule> ret = new ArrayList<>(); //assess each rule against the input, return any that match for (Rule rule : ruleSet.rules) { Boolean bresult = rule.assessMatch(ognlContext); if (bresult) { log.debug(rule.condition.getOriginalExpression() + " matches"); // depends on control dependency: [if], data = [none] ret.add(rule); // depends on control dependency: [if], data = [none] } } return ret; } }
public class class_name { public Observable<ServiceResponse<Void>> provisionWithServiceResponseAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String recoveryPointId, ILRRequestResource parameters) { if (vaultName == null) { throw new IllegalArgumentException("Parameter vaultName is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (fabricName == null) { throw new IllegalArgumentException("Parameter fabricName is required and cannot be null."); } if (containerName == null) { throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); } if (protectedItemName == null) { throw new IllegalArgumentException("Parameter protectedItemName is required and cannot be null."); } if (recoveryPointId == null) { throw new IllegalArgumentException("Parameter recoveryPointId is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); return service.provision(vaultName, resourceGroupName, this.client.subscriptionId(), fabricName, containerName, protectedItemName, recoveryPointId, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = provisionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponse<Void>> provisionWithServiceResponseAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String recoveryPointId, ILRRequestResource parameters) { if (vaultName == null) { throw new IllegalArgumentException("Parameter vaultName is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (fabricName == null) { throw new IllegalArgumentException("Parameter fabricName is required and cannot be null."); } if (containerName == null) { throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); } if (protectedItemName == null) { throw new IllegalArgumentException("Parameter protectedItemName is required and cannot be null."); } if (recoveryPointId == null) { throw new IllegalArgumentException("Parameter recoveryPointId is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); return service.provision(vaultName, resourceGroupName, this.client.subscriptionId(), fabricName, containerName, protectedItemName, recoveryPointId, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = provisionDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public static void startPayment(final BraintreeFragment fragment, final LocalPaymentRequest request, final BraintreeResponseListener<LocalPaymentRequest> listener) { if (request == null) { fragment.postCallback(new BraintreeException("A LocalPaymentRequest is required.")); return; } else if (request.getApprovalUrl() != null || request.getPaymentId() != null) { fragment.postCallback(new BraintreeException("LocalPaymentRequest is invalid, " + "appovalUrl and paymentId should not be set.")); return; } else if (request.getPaymentType() == null || request.getAmount() == null) { fragment.postCallback(new BraintreeException("LocalPaymentRequest is invalid, " + "paymentType and amount are required.")); return; } else if (listener == null) { fragment.postCallback(new BraintreeException("BraintreeResponseListener<LocalPaymentRequest> " + "is required.")); return; } fragment.waitForConfiguration(new ConfigurationListener() { @Override public void onConfigurationFetched(Configuration configuration) { if (!configuration.getPayPal().isEnabled()) { fragment.postCallback(new ConfigurationException("Local payments are not enabled for this merchant.")); return; } sMerchantAccountId = request.getMerchantAccountId(); sPaymentType = request.getPaymentType(); String returnUrl = fragment.getReturnUrlScheme() + "://" + LOCAL_PAYMENT_SUCCESSS; String cancel = fragment.getReturnUrlScheme() + "://" + LOCAL_PAYMENT_CANCEL; fragment.sendAnalyticsEvent(paymentTypeForAnalytics() + ".local-payment.start-payment.selected"); fragment.getHttpClient().post("/v1/paypal_hermes/create_payment_resource", request.build(returnUrl, cancel), new HttpResponseCallback() { @Override public void success(String responseBody) { try { JSONObject responseJson = new JSONObject(responseBody); request.approvalUrl(responseJson.getJSONObject("paymentResource").getString("redirectUrl")); request.paymentId(responseJson.getJSONObject("paymentResource").getString("paymentToken")); fragment.sendAnalyticsEvent(paymentTypeForAnalytics() + ".local-payment.create.succeeded"); listener.onResponse(request); } catch (JSONException jsonException) { failure(jsonException); } } @Override public void failure(Exception exception) { fragment.sendAnalyticsEvent(paymentTypeForAnalytics() + ".local-payment.webswitch.initiate.failed"); fragment.postCallback(exception); } }); } }); } }
public class class_name { public static void startPayment(final BraintreeFragment fragment, final LocalPaymentRequest request, final BraintreeResponseListener<LocalPaymentRequest> listener) { if (request == null) { fragment.postCallback(new BraintreeException("A LocalPaymentRequest is required.")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else if (request.getApprovalUrl() != null || request.getPaymentId() != null) { fragment.postCallback(new BraintreeException("LocalPaymentRequest is invalid, " + "appovalUrl and paymentId should not be set.")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else if (request.getPaymentType() == null || request.getAmount() == null) { fragment.postCallback(new BraintreeException("LocalPaymentRequest is invalid, " + "paymentType and amount are required.")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } else if (listener == null) { fragment.postCallback(new BraintreeException("BraintreeResponseListener<LocalPaymentRequest> " + "is required.")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } fragment.waitForConfiguration(new ConfigurationListener() { @Override public void onConfigurationFetched(Configuration configuration) { if (!configuration.getPayPal().isEnabled()) { fragment.postCallback(new ConfigurationException("Local payments are not enabled for this merchant.")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } sMerchantAccountId = request.getMerchantAccountId(); sPaymentType = request.getPaymentType(); String returnUrl = fragment.getReturnUrlScheme() + "://" + LOCAL_PAYMENT_SUCCESSS; String cancel = fragment.getReturnUrlScheme() + "://" + LOCAL_PAYMENT_CANCEL; fragment.sendAnalyticsEvent(paymentTypeForAnalytics() + ".local-payment.start-payment.selected"); fragment.getHttpClient().post("/v1/paypal_hermes/create_payment_resource", request.build(returnUrl, cancel), new HttpResponseCallback() { @Override public void success(String responseBody) { try { JSONObject responseJson = new JSONObject(responseBody); request.approvalUrl(responseJson.getJSONObject("paymentResource").getString("redirectUrl")); request.paymentId(responseJson.getJSONObject("paymentResource").getString("paymentToken")); fragment.sendAnalyticsEvent(paymentTypeForAnalytics() + ".local-payment.create.succeeded"); listener.onResponse(request); } catch (JSONException jsonException) { failure(jsonException); } } @Override public void failure(Exception exception) { fragment.sendAnalyticsEvent(paymentTypeForAnalytics() + ".local-payment.webswitch.initiate.failed"); fragment.postCallback(exception); } }); } }); } }
public class class_name { @JsonProperty("relative_url") public String getRelativeURL() { StringBuilder bld = new StringBuilder(); bld.append(this.object); Param[] params = this.getParams(); if (params != null && params.length > 0) { bld.append('?'); boolean afterFirst = false; for (Param param: params) { if (afterFirst) bld.append('&'); else afterFirst = true; if (param instanceof BinaryParam) { //call.addParam(param.name, (InputStream)param.value, ((BinaryParam)param).contentType, "irrelevant"); throw new UnsupportedOperationException("Not quite sure what to do with BinaryParam yet"); } else { String paramValue = StringUtils.stringifyValue(param, this.mapper); bld.append(StringUtils.urlEncode(param.name)); bld.append('='); bld.append(StringUtils.urlEncode(paramValue)); } } } return bld.toString(); } }
public class class_name { @JsonProperty("relative_url") public String getRelativeURL() { StringBuilder bld = new StringBuilder(); bld.append(this.object); Param[] params = this.getParams(); if (params != null && params.length > 0) { bld.append('?'); // depends on control dependency: [if], data = [none] boolean afterFirst = false; for (Param param: params) { if (afterFirst) bld.append('&'); else afterFirst = true; if (param instanceof BinaryParam) { //call.addParam(param.name, (InputStream)param.value, ((BinaryParam)param).contentType, "irrelevant"); throw new UnsupportedOperationException("Not quite sure what to do with BinaryParam yet"); } else { String paramValue = StringUtils.stringifyValue(param, this.mapper); bld.append(StringUtils.urlEncode(param.name)); // depends on control dependency: [if], data = [none] bld.append('='); // depends on control dependency: [if], data = [none] bld.append(StringUtils.urlEncode(paramValue)); // depends on control dependency: [if], data = [none] } } } return bld.toString(); } }
public class class_name { public GitlabHTTPRequestor withAttachment(String key, File file) { if (file != null && key != null) { attachments.put(key, file); } return this; } }
public class class_name { public GitlabHTTPRequestor withAttachment(String key, File file) { if (file != null && key != null) { attachments.put(key, file); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public String hashCodeList(List<RecordTemplateSpec.Field> fields) { StringBuilder sb = new StringBuilder(); Iterator<RecordTemplateSpec.Field> iter = fields.iterator(); while(iter.hasNext()) { RecordTemplateSpec.Field field = iter.next(); Type schemaType = field.getSchemaField().getType().getType(); sb.append(escapeKeyword(field.getSchemaField().getName())); if (iter.hasNext()) sb.append(", "); } return sb.toString(); } }
public class class_name { public String hashCodeList(List<RecordTemplateSpec.Field> fields) { StringBuilder sb = new StringBuilder(); Iterator<RecordTemplateSpec.Field> iter = fields.iterator(); while(iter.hasNext()) { RecordTemplateSpec.Field field = iter.next(); Type schemaType = field.getSchemaField().getType().getType(); sb.append(escapeKeyword(field.getSchemaField().getName())); // depends on control dependency: [while], data = [none] if (iter.hasNext()) sb.append(", "); } return sb.toString(); } }
public class class_name { static public String getFormattedDate(long dt) { String ret = ""; SimpleDateFormat df = null; try { if(dt > 0) { df = formatPool.getFormat(DATE_FORMAT); df.setTimeZone(DateUtilities.getCurrentTimeZone()); ret = df.format(new Date(dt)); } } catch(Exception e) { } if(df != null) formatPool.release(df); return ret; } }
public class class_name { static public String getFormattedDate(long dt) { String ret = ""; SimpleDateFormat df = null; try { if(dt > 0) { df = formatPool.getFormat(DATE_FORMAT); // depends on control dependency: [if], data = [none] df.setTimeZone(DateUtilities.getCurrentTimeZone()); // depends on control dependency: [if], data = [none] ret = df.format(new Date(dt)); // depends on control dependency: [if], data = [(dt] } } catch(Exception e) { } // depends on control dependency: [catch], data = [none] if(df != null) formatPool.release(df); return ret; } }
public class class_name { private void normalizeFilePaths(Reportable report) { for (TestSuiteReport testSuiteReport : ((Report) report).getTestSuiteReports()) { for (PropertyEntry entry : testSuiteReport.getPropertyEntries()) { if (entry instanceof VideoEntry) { VideoEntry e = (VideoEntry) entry; e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1)); } } for (TestClassReport testClassReport : testSuiteReport.getTestClassReports()) { for (PropertyEntry entry : testClassReport.getPropertyEntries()) { if (entry instanceof VideoEntry) { VideoEntry e = (VideoEntry) entry; e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1)); } } for (TestMethodReport testMethodReport : testClassReport.getTestMethodReports()) { for (PropertyEntry entry : testMethodReport.getPropertyEntries()) { if (entry instanceof VideoEntry) { VideoEntry e = (VideoEntry) entry; e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1)); } else if (entry instanceof ScreenshotEntry) { ScreenshotEntry e = (ScreenshotEntry) entry; e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1)); } } } } } } }
public class class_name { private void normalizeFilePaths(Reportable report) { for (TestSuiteReport testSuiteReport : ((Report) report).getTestSuiteReports()) { for (PropertyEntry entry : testSuiteReport.getPropertyEntries()) { if (entry instanceof VideoEntry) { VideoEntry e = (VideoEntry) entry; e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1)); // depends on control dependency: [if], data = [none] } } for (TestClassReport testClassReport : testSuiteReport.getTestClassReports()) { for (PropertyEntry entry : testClassReport.getPropertyEntries()) { if (entry instanceof VideoEntry) { VideoEntry e = (VideoEntry) entry; e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1)); // depends on control dependency: [if], data = [none] } } for (TestMethodReport testMethodReport : testClassReport.getTestMethodReports()) { for (PropertyEntry entry : testMethodReport.getPropertyEntries()) { if (entry instanceof VideoEntry) { VideoEntry e = (VideoEntry) entry; e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1)); // depends on control dependency: [if], data = [none] } else if (entry instanceof ScreenshotEntry) { ScreenshotEntry e = (ScreenshotEntry) entry; e.setLink(e.getPath().substring(configuration.getRootDir().getAbsolutePath().length() + 1)); // depends on control dependency: [if], data = [none] } } } } } } }
public class class_name { private static int getAnonCompilePriority50(IJavaElement javaElement, IJavaElement firstAncestor, IJavaElement topAncestor) { // search for initializer block IJavaElement initBlock = getLastAncestor(javaElement, IJavaElement.INITIALIZER); // test is for anon. classes from initializer blocks if (initBlock != null) { return 10; // from inner from class init } // test for anon. classes from "regular" code return 5; } }
public class class_name { private static int getAnonCompilePriority50(IJavaElement javaElement, IJavaElement firstAncestor, IJavaElement topAncestor) { // search for initializer block IJavaElement initBlock = getLastAncestor(javaElement, IJavaElement.INITIALIZER); // test is for anon. classes from initializer blocks if (initBlock != null) { return 10; // from inner from class init // depends on control dependency: [if], data = [none] } // test for anon. classes from "regular" code return 5; } }
public class class_name { public InputStream makeInStream() { if (m_InputStream != null) return m_InputStream; try { return new FileInputStream(m_inputFile); } catch (FileNotFoundException ex) { System.out.println("Warning: scanned file does not exist: " + m_inputFile.getPath()); // Skip this file } return null; } }
public class class_name { public InputStream makeInStream() { if (m_InputStream != null) return m_InputStream; try { return new FileInputStream(m_inputFile); // depends on control dependency: [try], data = [none] } catch (FileNotFoundException ex) { System.out.println("Warning: scanned file does not exist: " + m_inputFile.getPath()); // Skip this file } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { private boolean checkFreeSlotAt(final long sequence) { final long wrapPoint = sequence - bufferSize; final long minPoint = getMinimumGetOrAck(); if (wrapPoint > minPoint) { // 刚好追上一轮 return false; } else { // 在bufferSize模式上,再增加memSize控制 if (batchMode.isMemSize()) { final long memsize = putMemSize.get() - ackMemSize.get(); if (memsize < bufferSize * bufferMemUnit) { return true; } else { return false; } } else { return true; } } } }
public class class_name { private boolean checkFreeSlotAt(final long sequence) { final long wrapPoint = sequence - bufferSize; final long minPoint = getMinimumGetOrAck(); if (wrapPoint > minPoint) { // 刚好追上一轮 return false; // depends on control dependency: [if], data = [none] } else { // 在bufferSize模式上,再增加memSize控制 if (batchMode.isMemSize()) { final long memsize = putMemSize.get() - ackMemSize.get(); if (memsize < bufferSize * bufferMemUnit) { return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } else { return true; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void clearCache() { File cacheDir = getCacheDir(); if (cacheDir.exists()) { File[] files = cacheDir.listFiles(); if (files != null) { for (File child : files) { deleteFilesRecursively(child); } } } } }
public class class_name { public void clearCache() { File cacheDir = getCacheDir(); if (cacheDir.exists()) { File[] files = cacheDir.listFiles(); if (files != null) { for (File child : files) { deleteFilesRecursively(child); // depends on control dependency: [for], data = [child] } } } } }
public class class_name { public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Write/Update a record int iErrorCode = DBConstants.NORMAL_RETURN; switch (iChangeType) { case DBConstants.REFRESH_TYPE: case DBConstants.UPDATE_TYPE: if (m_bFirstTimeOnly) break; case DBConstants.ADD_TYPE: iErrorCode = this.setUserID(iChangeType, bDisplayOption); if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; break; case DBConstants.FIELD_CHANGED_TYPE: if ((this.getOwner().getEditMode() == DBConstants.EDIT_ADD) && (this.getOwner().getField(userIdFieldName).getValue() == -1)) { // Special case - Init Record did not have record owner, but I probably do now. iErrorCode = this.setUserID(iChangeType, bDisplayOption); if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; } } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record } }
public class class_name { public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Write/Update a record int iErrorCode = DBConstants.NORMAL_RETURN; switch (iChangeType) { case DBConstants.REFRESH_TYPE: case DBConstants.UPDATE_TYPE: if (m_bFirstTimeOnly) break; case DBConstants.ADD_TYPE: iErrorCode = this.setUserID(iChangeType, bDisplayOption); if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; break; case DBConstants.FIELD_CHANGED_TYPE: if ((this.getOwner().getEditMode() == DBConstants.EDIT_ADD) && (this.getOwner().getField(userIdFieldName).getValue() == -1)) { // Special case - Init Record did not have record owner, but I probably do now. iErrorCode = this.setUserID(iChangeType, bDisplayOption); // depends on control dependency: [if], data = [none] if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; } } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record } }
public class class_name { public boolean isBruch() { String s = toString(); if (s.contains("/")) { try { Bruch.of(s); return true; } catch (IllegalArgumentException ex) { LOG.fine(s + " is not a fraction: " + ex); return false; } } else { return false; } } }
public class class_name { public boolean isBruch() { String s = toString(); if (s.contains("/")) { try { Bruch.of(s); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException ex) { LOG.fine(s + " is not a fraction: " + ex); return false; } // depends on control dependency: [catch], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String wrapCharArray(char[] c) { if (c == null) return null; String s = null; if (stringConstructor != null) { try { s = stringConstructor.newInstance(0, c.length, c); } catch (Exception e) { // Swallowing as we'll just use a copying constructor } } return s == null ? new String(c) : s; } }
public class class_name { public static String wrapCharArray(char[] c) { if (c == null) return null; String s = null; if (stringConstructor != null) { try { s = stringConstructor.newInstance(0, c.length, c); // depends on control dependency: [try], data = [none] } catch (Exception e) { // Swallowing as we'll just use a copying constructor } // depends on control dependency: [catch], data = [none] } return s == null ? new String(c) : s; } }
public class class_name { public void marshall(SetTimeBasedAutoScalingRequest setTimeBasedAutoScalingRequest, ProtocolMarshaller protocolMarshaller) { if (setTimeBasedAutoScalingRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(setTimeBasedAutoScalingRequest.getInstanceId(), INSTANCEID_BINDING); protocolMarshaller.marshall(setTimeBasedAutoScalingRequest.getAutoScalingSchedule(), AUTOSCALINGSCHEDULE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SetTimeBasedAutoScalingRequest setTimeBasedAutoScalingRequest, ProtocolMarshaller protocolMarshaller) { if (setTimeBasedAutoScalingRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(setTimeBasedAutoScalingRequest.getInstanceId(), INSTANCEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(setTimeBasedAutoScalingRequest.getAutoScalingSchedule(), AUTOSCALINGSCHEDULE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Object preprocessResult(Object result) { if (tc.isEntryEnabled()) Tr.entry(tc, "preprocessResult", new Object[] {result, this}); Object processedResult = null; if (result instanceof DataItem) { processedResult = ((DataItem)result).getData(); } else { processedResult = result; } if (tc.isEntryEnabled()) Tr.exit(tc, "preprocessResult", processedResult); return processedResult; } }
public class class_name { private Object preprocessResult(Object result) { if (tc.isEntryEnabled()) Tr.entry(tc, "preprocessResult", new Object[] {result, this}); Object processedResult = null; if (result instanceof DataItem) { processedResult = ((DataItem)result).getData(); // depends on control dependency: [if], data = [none] } else { processedResult = result; // depends on control dependency: [if], data = [none] } if (tc.isEntryEnabled()) Tr.exit(tc, "preprocessResult", processedResult); return processedResult; } }
public class class_name { @Override public EClass getIfcRelConnectsWithEccentricity() { if (ifcRelConnectsWithEccentricityEClass == null) { ifcRelConnectsWithEccentricityEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(540); } return ifcRelConnectsWithEccentricityEClass; } }
public class class_name { @Override public EClass getIfcRelConnectsWithEccentricity() { if (ifcRelConnectsWithEccentricityEClass == null) { ifcRelConnectsWithEccentricityEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(540); // depends on control dependency: [if], data = [none] } return ifcRelConnectsWithEccentricityEClass; } }
public class class_name { @PostConstruct public void init() { for (int i = 0; i < 100; i++) { contentList.getItems().add("Item " + i); } contentList.setMaxHeight(3400); JFXScrollPane.smoothScrolling((ScrollPane) scroll.getChildren().get(0)); SVGGlyph arrow = new SVGGlyph(0, "FULLSCREEN", "M402.746 877.254l-320-320c-24.994-24.992-24.994-65.516 0-90.51l320-320c24.994-24.992 65.516-24.992 90.51 0 24.994 24.994 " + "24.994 65.516 0 90.51l-210.746 210.746h613.49c35.346 0 64 28.654 64 64s-28.654 64-64 64h-613.49l210.746 210.746c12.496 " + "12.496 18.744 28.876 18.744 45.254s-6.248 32.758-18.744 45.254c-24.994 24.994-65.516 24.994-90.51 0z", Color.WHITE); arrow.setSize(20, 16); backButton.setGraphic(arrow); backButton.setRipplerFill(Color.WHITE); } }
public class class_name { @PostConstruct public void init() { for (int i = 0; i < 100; i++) { contentList.getItems().add("Item " + i); // depends on control dependency: [for], data = [i] } contentList.setMaxHeight(3400); JFXScrollPane.smoothScrolling((ScrollPane) scroll.getChildren().get(0)); SVGGlyph arrow = new SVGGlyph(0, "FULLSCREEN", "M402.746 877.254l-320-320c-24.994-24.992-24.994-65.516 0-90.51l320-320c24.994-24.992 65.516-24.992 90.51 0 24.994 24.994 " + "24.994 65.516 0 90.51l-210.746 210.746h613.49c35.346 0 64 28.654 64 64s-28.654 64-64 64h-613.49l210.746 210.746c12.496 " + "12.496 18.744 28.876 18.744 45.254s-6.248 32.758-18.744 45.254c-24.994 24.994-65.516 24.994-90.51 0z", Color.WHITE); arrow.setSize(20, 16); backButton.setGraphic(arrow); backButton.setRipplerFill(Color.WHITE); } }
public class class_name { protected NetworkConnection getNetworkConnectionInstance(VirtualConnection vc) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getNetworkConnectionInstance", vc); NetworkConnection retConn = null; if (vc != null) { // Default to the connection that we were created from retConn = conn; if (vc != ((CFWNetworkConnection) conn).getVirtualConnection()) { // The connection is different - nothing else to do but create a new instance retConn = new CFWNetworkConnection(vc); } } if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getNetworkConnectionInstance", retConn); return retConn; } }
public class class_name { protected NetworkConnection getNetworkConnectionInstance(VirtualConnection vc) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getNetworkConnectionInstance", vc); NetworkConnection retConn = null; if (vc != null) { // Default to the connection that we were created from retConn = conn; // depends on control dependency: [if], data = [none] if (vc != ((CFWNetworkConnection) conn).getVirtualConnection()) { // The connection is different - nothing else to do but create a new instance retConn = new CFWNetworkConnection(vc); // depends on control dependency: [if], data = [(vc] } } if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getNetworkConnectionInstance", retConn); return retConn; } }
public class class_name { @Override public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException { byte[] transformedBytes = providerClassTransformer.transform(loader, className, classBeingRedefined, protectionDomain, classfileBuffer); try { // Capture bytecode to disk if capturing is enabled and if a transformation has occurred. // The transform() method contract states a return value of null indicates no transformation. // We check the returned byte array just in case the JPA Implementation violates that contract. if (captureEnabled && transformedBytes != null) { File saveFile = new File(captureRootDir, className.replace('.', '/') + ".class"); File targetDir = saveFile.getParentFile(); if (mkdirs(targetDir)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Capturing enhanced Entity Class bytecode to " + saveFile.getAbsolutePath()); } writeCapturedEnhancedBytecode(saveFile, transformedBytes); } else { // Couldn't create the target directory if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Failed to create capture directory " + targetDir.getAbsolutePath()); } } } } catch (Throwable t) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught unexpected Exception while capturing " + className + ".", t); } } return transformedBytes; } }
public class class_name { @Override public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException { byte[] transformedBytes = providerClassTransformer.transform(loader, className, classBeingRedefined, protectionDomain, classfileBuffer); try { // Capture bytecode to disk if capturing is enabled and if a transformation has occurred. // The transform() method contract states a return value of null indicates no transformation. // We check the returned byte array just in case the JPA Implementation violates that contract. if (captureEnabled && transformedBytes != null) { File saveFile = new File(captureRootDir, className.replace('.', '/') + ".class"); File targetDir = saveFile.getParentFile(); if (mkdirs(targetDir)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Capturing enhanced Entity Class bytecode to " + saveFile.getAbsolutePath()); // depends on control dependency: [if], data = [none] } writeCapturedEnhancedBytecode(saveFile, transformedBytes); // depends on control dependency: [if], data = [none] } else { // Couldn't create the target directory if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Failed to create capture directory " + targetDir.getAbsolutePath()); // depends on control dependency: [if], data = [none] } } } } catch (Throwable t) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught unexpected Exception while capturing " + className + ".", t); // depends on control dependency: [if], data = [none] } } return transformedBytes; } }
public class class_name { public static Map<String, String[]> createParameterMap(Map<String, ?> params) { if (params == null) { return null; } Map<String, String[]> result = new HashMap<String, String[]>(); Iterator<?> i = params.entrySet().iterator(); while (i.hasNext()) { @SuppressWarnings("unchecked") Map.Entry<String, ?> entry = (Entry<String, ?>)i.next(); String key = entry.getKey(); Object values = entry.getValue(); if (values instanceof String[]) { result.put(key, (String[])values); } else { if (values != null) { result.put(key, new String[] {values.toString()}); } } } return result; } }
public class class_name { public static Map<String, String[]> createParameterMap(Map<String, ?> params) { if (params == null) { return null; // depends on control dependency: [if], data = [none] } Map<String, String[]> result = new HashMap<String, String[]>(); Iterator<?> i = params.entrySet().iterator(); while (i.hasNext()) { @SuppressWarnings("unchecked") Map.Entry<String, ?> entry = (Entry<String, ?>)i.next(); String key = entry.getKey(); Object values = entry.getValue(); if (values instanceof String[]) { result.put(key, (String[])values); // depends on control dependency: [if], data = [none] } else { if (values != null) { result.put(key, new String[] {values.toString()}); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { public Observable<ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) { return listByResourceGroupSinglePageAsync(resourceGroupName, filter, top, skip, select, orderby, count) .concatMap(new Func1<ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>>, Observable<ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>>>>() { @Override public Observable<ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>>> call(ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) { return listByResourceGroupSinglePageAsync(resourceGroupName, filter, top, skip, select, orderby, count) .concatMap(new Func1<ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>>, Observable<ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>>>>() { @Override public Observable<ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>>> call(ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { protected void setEntityNavigationProperties(Object entity, StructuredType entityType) throws ODataException { for (Map.Entry<String, Object> entry : links.entrySet()) { String propertyName = entry.getKey(); Object entryLinks = entry.getValue(); LOG.debug("Found link for navigation property: {}", propertyName); StructuralProperty property = entityType.getStructuralProperty(propertyName); if (!(property instanceof NavigationProperty)) { throw new ODataUnmarshallingException("The request contains a navigation link '" + propertyName + "' but the entity type '" + entityType + "' does not contain a navigation property " + "with this name."); } // Note: The links are processed a bit differently depending on whether we are parsing in the context // of a 'write operation' or 'read operation'. Only in the case of a 'write operation' it is necessary // to resolve the referenced entity. if (isWriteOperation()) { // Get the referenced entity(es), but only with the key fields filled in if (entryLinks instanceof List) { List<String> linksList = (List<String>) entryLinks; for (String link : linksList) { Object referencedEntity = getReferencedEntity(link, propertyName); LOG.debug("Referenced entity: {}", referencedEntity); saveReferencedEntity(entity, propertyName, property, referencedEntity); } } else { Object referencedEntity = getReferencedEntity((String) entryLinks, propertyName); LOG.debug("Referenced entity: {}", referencedEntity); saveReferencedEntity(entity, propertyName, property, referencedEntity); } } } } }
public class class_name { protected void setEntityNavigationProperties(Object entity, StructuredType entityType) throws ODataException { for (Map.Entry<String, Object> entry : links.entrySet()) { String propertyName = entry.getKey(); Object entryLinks = entry.getValue(); LOG.debug("Found link for navigation property: {}", propertyName); StructuralProperty property = entityType.getStructuralProperty(propertyName); if (!(property instanceof NavigationProperty)) { throw new ODataUnmarshallingException("The request contains a navigation link '" + propertyName + "' but the entity type '" + entityType + "' does not contain a navigation property " + "with this name."); } // Note: The links are processed a bit differently depending on whether we are parsing in the context // of a 'write operation' or 'read operation'. Only in the case of a 'write operation' it is necessary // to resolve the referenced entity. if (isWriteOperation()) { // Get the referenced entity(es), but only with the key fields filled in if (entryLinks instanceof List) { List<String> linksList = (List<String>) entryLinks; for (String link : linksList) { Object referencedEntity = getReferencedEntity(link, propertyName); LOG.debug("Referenced entity: {}", referencedEntity); // depends on control dependency: [for], data = [none] saveReferencedEntity(entity, propertyName, property, referencedEntity); // depends on control dependency: [for], data = [none] } } else { Object referencedEntity = getReferencedEntity((String) entryLinks, propertyName); LOG.debug("Referenced entity: {}", referencedEntity); saveReferencedEntity(entity, propertyName, property, referencedEntity); } } } } }
public class class_name { public Query select(final Expression... selectColumns) { if (selectColumns == null) { return this; } return select(Arrays.asList(selectColumns)); } }
public class class_name { public Query select(final Expression... selectColumns) { if (selectColumns == null) { return this; // depends on control dependency: [if], data = [none] } return select(Arrays.asList(selectColumns)); } }
public class class_name { public ServiceFuture<List<CloudTask>> listAsync(final String jobId, final TaskListOptions taskListOptions, final ListOperationCallback<CloudTask> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listSinglePageAsync(jobId, taskListOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> call(String nextPageLink) { TaskListNextOptions taskListNextOptions = null; if (taskListOptions != null) { taskListNextOptions = new TaskListNextOptions(); taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId()); taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId()); taskListNextOptions.withOcpDate(taskListOptions.ocpDate()); } return listNextSinglePageAsync(nextPageLink, taskListNextOptions); } }, serviceCallback); } }
public class class_name { public ServiceFuture<List<CloudTask>> listAsync(final String jobId, final TaskListOptions taskListOptions, final ListOperationCallback<CloudTask> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listSinglePageAsync(jobId, taskListOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> call(String nextPageLink) { TaskListNextOptions taskListNextOptions = null; if (taskListOptions != null) { taskListNextOptions = new TaskListNextOptions(); // depends on control dependency: [if], data = [none] taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId()); // depends on control dependency: [if], data = [(taskListOptions] taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId()); // depends on control dependency: [if], data = [(taskListOptions] taskListNextOptions.withOcpDate(taskListOptions.ocpDate()); // depends on control dependency: [if], data = [(taskListOptions] } return listNextSinglePageAsync(nextPageLink, taskListNextOptions); } }, serviceCallback); } }
public class class_name { @Override public void removeByC_A(long commerceCountryId, boolean active) { for (CommerceRegion commerceRegion : findByC_A(commerceCountryId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceRegion); } } }
public class class_name { @Override public void removeByC_A(long commerceCountryId, boolean active) { for (CommerceRegion commerceRegion : findByC_A(commerceCountryId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceRegion); // depends on control dependency: [for], data = [commerceRegion] } } }
public class class_name { protected Properties getConfigurationProperties(OperationContext context, ModelNode model) throws OperationFailedException { Properties props = new Properties(); getResourceProperties(props, IIOPRootDefinition.INSTANCE, context, model); // check if the node contains a list of generic properties. ModelNode configNode = model.get(Constants.CONFIGURATION); if (configNode.hasDefined(Constants.PROPERTIES)) { for (Property property : configNode.get(Constants.PROPERTIES).get(Constants.PROPERTY) .asPropertyList()) { String name = property.getName(); String value = property.getValue().get(Constants.PROPERTY_VALUE).asString(); props.setProperty(name, value); } } return props; } }
public class class_name { protected Properties getConfigurationProperties(OperationContext context, ModelNode model) throws OperationFailedException { Properties props = new Properties(); getResourceProperties(props, IIOPRootDefinition.INSTANCE, context, model); // check if the node contains a list of generic properties. ModelNode configNode = model.get(Constants.CONFIGURATION); if (configNode.hasDefined(Constants.PROPERTIES)) { for (Property property : configNode.get(Constants.PROPERTIES).get(Constants.PROPERTY) .asPropertyList()) { String name = property.getName(); String value = property.getValue().get(Constants.PROPERTY_VALUE).asString(); props.setProperty(name, value); // depends on control dependency: [for], data = [none] } } return props; } }