code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { @Override public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException, IOException { final String sourceMethod = "getAttributes"; checkConnection(); if (name == null) throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); else if (name.isPattern()) throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); else if (attributes == null) throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.ATTRIBUTE_NAMES_NULL))); URL attributesURL; try { // Get URL for attributes attributesURL = getAttributesURL(name, attributes); } catch (IntrospectionException intro) { throw getRequestErrorException(sourceMethod, intro); } catch (IOException io) { throw getRequestErrorException(sourceMethod, io); } HttpsURLConnection connection; try { // Get connection to server connection = getConnection(attributesURL, HttpMethod.GET); } catch (IOException io) { throw getRequestErrorException(sourceMethod, io, attributesURL); } // Check response code from server int responseCode = 0; try { responseCode = connection.getResponseCode(); } catch (ConnectException ce) { recoverConnection(ce); // Server is down; not a client bug throw ce; } switch (responseCode) { case HttpURLConnection.HTTP_OK: JSONConverter converter = JSONConverter.getConverter(); try { // Process and return server response, which should be an AttributeList return converter.readAttributeList(connection.getInputStream()); } catch (ClassNotFoundException cnf) { // Not a REST connector bug per se; not need to log this case throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); } catch (Exception e) { throw getResponseErrorException(sourceMethod, e, attributesURL); } finally { JSONConverter.returnConverter(converter); } case HttpURLConnection.HTTP_BAD_REQUEST: case HttpURLConnection.HTTP_INTERNAL_ERROR: try { // Server response should be a serialized Throwable throw getServerThrowable(sourceMethod, connection); } catch (InstanceNotFoundException inf) { throw inf; } catch (ReflectionException re) { throw re; } catch (IOException io) { throw io; } catch (Throwable t) { throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); } case HttpURLConnection.HTTP_UNAUTHORIZED: case HttpURLConnection.HTTP_FORBIDDEN: throw getBadCredentialsException(responseCode, connection); case HttpURLConnection.HTTP_GONE: case HttpURLConnection.HTTP_NOT_FOUND: IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); recoverConnection(ioe); throw ioe; default: throw getResponseCodeErrorException(sourceMethod, responseCode, connection); } } }
public class class_name { @Override public AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException, IOException { final String sourceMethod = "getAttributes"; checkConnection(); if (name == null) throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_NULL))); else if (name.isPattern()) throw new InstanceNotFoundException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.OBJECT_NAME_PATTERN, name)); else if (attributes == null) throw new RuntimeOperationsException(new IllegalArgumentException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.ATTRIBUTE_NAMES_NULL))); URL attributesURL; try { // Get URL for attributes attributesURL = getAttributesURL(name, attributes); } catch (IntrospectionException intro) { throw getRequestErrorException(sourceMethod, intro); } catch (IOException io) { throw getRequestErrorException(sourceMethod, io); } HttpsURLConnection connection; try { // Get connection to server connection = getConnection(attributesURL, HttpMethod.GET); } catch (IOException io) { throw getRequestErrorException(sourceMethod, io, attributesURL); } // Check response code from server int responseCode = 0; try { responseCode = connection.getResponseCode(); } catch (ConnectException ce) { recoverConnection(ce); // Server is down; not a client bug throw ce; } switch (responseCode) { case HttpURLConnection.HTTP_OK: JSONConverter converter = JSONConverter.getConverter(); try { // Process and return server response, which should be an AttributeList return converter.readAttributeList(connection.getInputStream()); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException cnf) { // Not a REST connector bug per se; not need to log this case throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.SERVER_RESULT_EXCEPTION), cnf); } catch (Exception e) { // depends on control dependency: [catch], data = [none] throw getResponseErrorException(sourceMethod, e, attributesURL); } finally { // depends on control dependency: [catch], data = [none] JSONConverter.returnConverter(converter); } case HttpURLConnection.HTTP_BAD_REQUEST: case HttpURLConnection.HTTP_INTERNAL_ERROR: try { // Server response should be a serialized Throwable throw getServerThrowable(sourceMethod, connection); } catch (InstanceNotFoundException inf) { throw inf; } catch (ReflectionException re) { // depends on control dependency: [catch], data = [none] throw re; } catch (IOException io) { // depends on control dependency: [catch], data = [none] throw io; } catch (Throwable t) { // depends on control dependency: [catch], data = [none] throw new IOException(RESTClientMessagesUtil.getMessage(RESTClientMessagesUtil.UNEXPECTED_SERVER_THROWABLE), t); } // depends on control dependency: [catch], data = [none] case HttpURLConnection.HTTP_UNAUTHORIZED: case HttpURLConnection.HTTP_FORBIDDEN: throw getBadCredentialsException(responseCode, connection); case HttpURLConnection.HTTP_GONE: case HttpURLConnection.HTTP_NOT_FOUND: IOException ioe = getResponseCodeErrorException(sourceMethod, responseCode, connection); recoverConnection(ioe); throw ioe; default: throw getResponseCodeErrorException(sourceMethod, responseCode, connection); } } }
public class class_name { public static String getSKSAT(String[] soilParas) { if (soilParas != null && soilParas.length >= 3) { if (soilParas.length >= 4) { return divide(calcSatBulk(soilParas[0], soilParas[1], soilParas[2], divide(soilParas[3], "100")), "10", 3); } else { return divide(calcSatMatric(soilParas[0], soilParas[1], soilParas[2]), "10", 3); } } else { return null; } } }
public class class_name { public static String getSKSAT(String[] soilParas) { if (soilParas != null && soilParas.length >= 3) { if (soilParas.length >= 4) { return divide(calcSatBulk(soilParas[0], soilParas[1], soilParas[2], divide(soilParas[3], "100")), "10", 3); // depends on control dependency: [if], data = [none] } else { return divide(calcSatMatric(soilParas[0], soilParas[1], soilParas[2]), "10", 3); // depends on control dependency: [if], data = [none] } } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") private void handleResponseSuccess(long requestId, Object response) { ContextualFuture future = responseFutures.remove(requestId); if (future != null) { future.context.executor().execute(() -> future.complete(response)); } } }
public class class_name { @SuppressWarnings("unchecked") private void handleResponseSuccess(long requestId, Object response) { ContextualFuture future = responseFutures.remove(requestId); if (future != null) { future.context.executor().execute(() -> future.complete(response)); // depends on control dependency: [if], data = [none] } } }
public class class_name { private boolean hasData(CmsSetupDb dbCon) throws SQLException { System.out.println(new Exception().getStackTrace()[0].toString()); boolean result = false; String query = readQuery(QUERY_SELECT_COUNT_HISTORY_PRINCIPALS); CmsSetupDBWrapper db = null; try { db = dbCon.executeSqlStatement(query, null); if (db.getResultSet().next()) { if (db.getResultSet().getInt("COUNT") > 0) { result = true; } } } finally { if (db != null) { db.close(); } } return result; } }
public class class_name { private boolean hasData(CmsSetupDb dbCon) throws SQLException { System.out.println(new Exception().getStackTrace()[0].toString()); boolean result = false; String query = readQuery(QUERY_SELECT_COUNT_HISTORY_PRINCIPALS); CmsSetupDBWrapper db = null; try { db = dbCon.executeSqlStatement(query, null); if (db.getResultSet().next()) { if (db.getResultSet().getInt("COUNT") > 0) { result = true; // depends on control dependency: [if], data = [none] } } } finally { if (db != null) { db.close(); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public String formatForLiteral(String s) { if (s == null) { return ""; } StringBuffer sb = new StringBuffer(s.length()); char[] chars = s.toCharArray(); for (char c : chars) { switch (c) { case '\"': sb.append("\\\""); break; case '\'': sb.append("\\\'"); break; case '\t': sb.append("\\t"); break; case '\r': sb.append("\\r"); break; case '\n': sb.append("\\n"); break; case '\f': sb.append("\\f"); break; case '\b': sb.append("\\b"); break; case '\\': sb.append("\\\\"); break; default: sb.append(c); break; } } return sb.toString(); } }
public class class_name { public String formatForLiteral(String s) { if (s == null) { return ""; // depends on control dependency: [if], data = [none] } StringBuffer sb = new StringBuffer(s.length()); char[] chars = s.toCharArray(); for (char c : chars) { switch (c) { case '\"': sb.append("\\\""); break; case '\'': sb.append("\\\'"); break; case '\t': sb.append("\\t"); break; case '\r': sb.append("\\r"); break; case '\n': sb.append("\\n"); break; case '\f': sb.append("\\f"); break; case '\b': sb.append("\\b"); break; case '\\': sb.append("\\\\"); break; default: sb.append(c); break; } } return sb.toString(); } }
public class class_name { private MultiValuedMap<String,VarBindingDef> createPropertyProviders( FunctionInputDef inputDef) { propertyProviders_ = MultiMapUtils.newListValuedHashMap(); for( VarDefIterator varDefs = new VarDefIterator( inputDef.getVarDefs()); varDefs.hasNext(); ) { VarDef varDef = varDefs.next(); for( Iterator<VarValueDef> values = varDef.getValidValues(); values.hasNext(); ) { VarValueDef value = values.next(); if( value.hasProperties()) { VarBindingDef binding = new VarBindingDef( varDef, value); for( Iterator<String> properties = value.getProperties().iterator(); properties.hasNext(); ) { propertyProviders_.put( properties.next(), binding); } } } } return propertyProviders_; } }
public class class_name { private MultiValuedMap<String,VarBindingDef> createPropertyProviders( FunctionInputDef inputDef) { propertyProviders_ = MultiMapUtils.newListValuedHashMap(); for( VarDefIterator varDefs = new VarDefIterator( inputDef.getVarDefs()); varDefs.hasNext(); ) { VarDef varDef = varDefs.next(); for( Iterator<VarValueDef> values = varDef.getValidValues(); values.hasNext(); ) { VarValueDef value = values.next(); if( value.hasProperties()) { VarBindingDef binding = new VarBindingDef( varDef, value); for( Iterator<String> properties = value.getProperties().iterator(); properties.hasNext(); ) { propertyProviders_.put( properties.next(), binding); // depends on control dependency: [for], data = [properties] } } } } return propertyProviders_; } }
public class class_name { @Override public EEnum getIfcLaborResourceTypeEnum() { if (ifcLaborResourceTypeEnumEEnum == null) { ifcLaborResourceTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1008); } return ifcLaborResourceTypeEnumEEnum; } }
public class class_name { @Override public EEnum getIfcLaborResourceTypeEnum() { if (ifcLaborResourceTypeEnumEEnum == null) { ifcLaborResourceTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(1008); // depends on control dependency: [if], data = [none] } return ifcLaborResourceTypeEnumEEnum; } }
public class class_name { private List<Filter<S>> findCoveringMatches() { List<Filter<S>> coveringFilters = null; boolean check = !mRemainderFilters.isEmpty() && (mIdentityFilters.size() > 0 || mRangeStartFilters.size() > 0 || mRangeEndFilters.size() > 0); if (check) { // Any remainder property which is provided by the index is a covering match. for (Filter<S> subFilter : mRemainderFilters) { if (isProvidedByIndex(subFilter)) { if (coveringFilters == null) { coveringFilters = new ArrayList<Filter<S>>(); } coveringFilters.add(subFilter); } } } return prepareList(coveringFilters); } }
public class class_name { private List<Filter<S>> findCoveringMatches() { List<Filter<S>> coveringFilters = null; boolean check = !mRemainderFilters.isEmpty() && (mIdentityFilters.size() > 0 || mRangeStartFilters.size() > 0 || mRangeEndFilters.size() > 0); if (check) { // Any remainder property which is provided by the index is a covering match. for (Filter<S> subFilter : mRemainderFilters) { if (isProvidedByIndex(subFilter)) { if (coveringFilters == null) { coveringFilters = new ArrayList<Filter<S>>(); // depends on control dependency: [if], data = [none] } coveringFilters.add(subFilter); // depends on control dependency: [if], data = [none] } } } return prepareList(coveringFilters); } }
public class class_name { @Override public void put(Mean other) { if(!(other instanceof StatisticalMoments)) { throw new IllegalArgumentException("I cannot combine Mean or MeanVariance into to a StatisticalMoments class."); } if(other.n == 0.) { return; } StatisticalMoments othe = (StatisticalMoments) other; if(this.n == 0.) { this.n = othe.n; this.sum = othe.sum; this.m2 = othe.m2; this.m3 = othe.m3; this.m4 = othe.m4; return; } final double nn = othe.n + this.n; final double delta = othe.sum / othe.n - this.sum / this.n; // Some factors used below: final double delta_nn = delta / nn; final double delta_nn2 = delta_nn * delta_nn; final double delta_nn3 = delta_nn2 * delta_nn; final double na2 = this.n * this.n; final double nb2 = othe.n * othe.n; final double ntn = this.n * othe.n; this.m4 += othe.m4 + delta * delta_nn3 * ntn * (na2 - ntn + nb2) + 6. * (na2 * othe.m2 + nb2 * this.m2) * delta_nn2 + 4. * (this.n * othe.m3 - othe.n * this.m3) * delta_nn; this.m3 += othe.m3 + delta * delta_nn2 * ntn * (this.n - othe.n) + 3. * (this.n * othe.m2 - othe.n * this.m2) * delta_nn; this.m2 += othe.m2 + delta * delta_nn * this.n * othe.n; this.sum += othe.sum; this.n = nn; min = Math.min(min, othe.min); max = Math.max(max, othe.max); } }
public class class_name { @Override public void put(Mean other) { if(!(other instanceof StatisticalMoments)) { throw new IllegalArgumentException("I cannot combine Mean or MeanVariance into to a StatisticalMoments class."); } if(other.n == 0.) { return; // depends on control dependency: [if], data = [none] } StatisticalMoments othe = (StatisticalMoments) other; if(this.n == 0.) { this.n = othe.n; // depends on control dependency: [if], data = [none] this.sum = othe.sum; // depends on control dependency: [if], data = [none] this.m2 = othe.m2; // depends on control dependency: [if], data = [none] this.m3 = othe.m3; // depends on control dependency: [if], data = [none] this.m4 = othe.m4; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } final double nn = othe.n + this.n; final double delta = othe.sum / othe.n - this.sum / this.n; // Some factors used below: final double delta_nn = delta / nn; final double delta_nn2 = delta_nn * delta_nn; final double delta_nn3 = delta_nn2 * delta_nn; final double na2 = this.n * this.n; final double nb2 = othe.n * othe.n; final double ntn = this.n * othe.n; this.m4 += othe.m4 + delta * delta_nn3 * ntn * (na2 - ntn + nb2) + 6. * (na2 * othe.m2 + nb2 * this.m2) * delta_nn2 + 4. * (this.n * othe.m3 - othe.n * this.m3) * delta_nn; this.m3 += othe.m3 + delta * delta_nn2 * ntn * (this.n - othe.n) + 3. * (this.n * othe.m2 - othe.n * this.m2) * delta_nn; this.m2 += othe.m2 + delta * delta_nn * this.n * othe.n; this.sum += othe.sum; this.n = nn; min = Math.min(min, othe.min); max = Math.max(max, othe.max); } }
public class class_name { private static boolean multiPathExactlyEqualsMultiPath_( MultiPath multipathA, MultiPath multipathB, double tolerance, ProgressTracker progress_tracker) { if (multipathA.getPathCount() != multipathB.getPathCount() || multipathA.getPointCount() != multipathB.getPointCount()) return false; Point2D ptA = new Point2D(), ptB = new Point2D(); boolean bAllPointsEqual = true; double tolerance_sq = tolerance * tolerance; for (int ipath = 0; ipath < multipathA.getPathCount(); ipath++) { if (multipathA.getPathEnd(ipath) != multipathB.getPathEnd(ipath)) { bAllPointsEqual = false; break; } for (int i = multipathA.getPathStart(ipath); i < multipathB .getPathEnd(ipath); i++) { multipathA.getXY(i, ptA); multipathB.getXY(i, ptB); if (Point2D.sqrDistance(ptA, ptB) > tolerance_sq) { bAllPointsEqual = false; break; } } if (!bAllPointsEqual) break; } if (!bAllPointsEqual) return false; return true; } }
public class class_name { private static boolean multiPathExactlyEqualsMultiPath_( MultiPath multipathA, MultiPath multipathB, double tolerance, ProgressTracker progress_tracker) { if (multipathA.getPathCount() != multipathB.getPathCount() || multipathA.getPointCount() != multipathB.getPointCount()) return false; Point2D ptA = new Point2D(), ptB = new Point2D(); boolean bAllPointsEqual = true; double tolerance_sq = tolerance * tolerance; for (int ipath = 0; ipath < multipathA.getPathCount(); ipath++) { if (multipathA.getPathEnd(ipath) != multipathB.getPathEnd(ipath)) { bAllPointsEqual = false; // depends on control dependency: [if], data = [none] break; } for (int i = multipathA.getPathStart(ipath); i < multipathB .getPathEnd(ipath); i++) { multipathA.getXY(i, ptA); // depends on control dependency: [for], data = [i] multipathB.getXY(i, ptB); // depends on control dependency: [for], data = [i] if (Point2D.sqrDistance(ptA, ptB) > tolerance_sq) { bAllPointsEqual = false; // depends on control dependency: [if], data = [none] break; } } if (!bAllPointsEqual) break; } if (!bAllPointsEqual) return false; return true; } }
public class class_name { public static URL getDeepResource(ClassLoader startLoader, String resourceName) { ClassLoader currentLoader = checkNotNull(startLoader); URL url = currentLoader.getResource(checkNotEmpty(resourceName)); int attempts = 0; while (url == null && attempts < 10) { // search the class loader tree currentLoader = currentLoader.getParent(); attempts += 1; //no inspection ConstantConditions if (currentLoader == null) { break; // we are at the bootstrap class loader } url = currentLoader.getResource(resourceName); } checkArgument(url != null, "resource %s not found for the context class loader %s", resourceName, startLoader); return url; } }
public class class_name { public static URL getDeepResource(ClassLoader startLoader, String resourceName) { ClassLoader currentLoader = checkNotNull(startLoader); URL url = currentLoader.getResource(checkNotEmpty(resourceName)); int attempts = 0; while (url == null && attempts < 10) { // search the class loader tree currentLoader = currentLoader.getParent(); // depends on control dependency: [while], data = [none] attempts += 1; // depends on control dependency: [while], data = [none] //no inspection ConstantConditions if (currentLoader == null) { break; // we are at the bootstrap class loader } url = currentLoader.getResource(resourceName); // depends on control dependency: [while], data = [none] } checkArgument(url != null, "resource %s not found for the context class loader %s", resourceName, startLoader); return url; } }
public class class_name { public com.google.protobuf.ByteString getResourceBytes() { java.lang.Object ref = resource_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); resource_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } }
public class class_name { public com.google.protobuf.ByteString getResourceBytes() { java.lang.Object ref = resource_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); resource_ = b; // depends on control dependency: [if], data = [none] return b; // depends on control dependency: [if], data = [none] } else { return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void processUpdates(FacesContext context) { initState(); notifyBefore(context, PhaseId.UPDATE_MODEL_VALUES); try { if (!skipPhase) { if (context.getPartialViewContext().isPartialRequest() && !context.getPartialViewContext().isExecuteAll()) { context.getPartialViewContext().processPartial(PhaseId.UPDATE_MODEL_VALUES); } else { super.processUpdates(context); } broadcastEvents(context, PhaseId.UPDATE_MODEL_VALUES); } } finally { clearFacesEvents(context); notifyAfter(context, PhaseId.UPDATE_MODEL_VALUES); } } }
public class class_name { @Override public void processUpdates(FacesContext context) { initState(); notifyBefore(context, PhaseId.UPDATE_MODEL_VALUES); try { if (!skipPhase) { if (context.getPartialViewContext().isPartialRequest() && !context.getPartialViewContext().isExecuteAll()) { context.getPartialViewContext().processPartial(PhaseId.UPDATE_MODEL_VALUES); // depends on control dependency: [if], data = [none] } else { super.processUpdates(context); // depends on control dependency: [if], data = [none] } broadcastEvents(context, PhaseId.UPDATE_MODEL_VALUES); // depends on control dependency: [if], data = [none] } } finally { clearFacesEvents(context); notifyAfter(context, PhaseId.UPDATE_MODEL_VALUES); } } }
public class class_name { public TRow getRowOrLock(long id) { TRow row = null; lock.lock(); try { RowCondition rowCondition = rows.get(id); if (rowCondition != null) { row = rowCondition.row; if (row == null) { // Another thread is currently retrieving the row, wait rowCondition.condition.await(); // Row has now been retrieved row = rowCondition.row; } } else { // Set the row condition and the calling thread is now // responsible for retrieving the row rowCondition = new RowCondition(); rowCondition.condition = lock.newCondition(); rows.put(id, rowCondition); } } catch (InterruptedException e) { throw new GeoPackageException( "Interruption obtaining cached row or row lock. id: " + id, e); } finally { lock.unlock(); } return row; } }
public class class_name { public TRow getRowOrLock(long id) { TRow row = null; lock.lock(); try { RowCondition rowCondition = rows.get(id); if (rowCondition != null) { row = rowCondition.row; // depends on control dependency: [if], data = [none] if (row == null) { // Another thread is currently retrieving the row, wait rowCondition.condition.await(); // depends on control dependency: [if], data = [none] // Row has now been retrieved row = rowCondition.row; // depends on control dependency: [if], data = [none] } } else { // Set the row condition and the calling thread is now // responsible for retrieving the row rowCondition = new RowCondition(); // depends on control dependency: [if], data = [none] rowCondition.condition = lock.newCondition(); // depends on control dependency: [if], data = [none] rows.put(id, rowCondition); // depends on control dependency: [if], data = [none] } } catch (InterruptedException e) { throw new GeoPackageException( "Interruption obtaining cached row or row lock. id: " + id, e); } finally { // depends on control dependency: [catch], data = [none] lock.unlock(); } return row; } }
public class class_name { public static void preDestroyQuietly(Object obj, Logger log) { try { preDestroy(obj, log); } catch( Throwable t ) { log.warn("Could not @PreDestroy object", t); } } }
public class class_name { public static void preDestroyQuietly(Object obj, Logger log) { try { preDestroy(obj, log); // depends on control dependency: [try], data = [none] } catch( Throwable t ) { log.warn("Could not @PreDestroy object", t); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void addCurrentSubsite(String referencePath) { CmsADEConfigData configData = OpenCms.getADEManager().lookupConfiguration(m_cms, referencePath); String basePath = configData.getBasePath(); if (basePath != null) { addOption( Type.currentSubsite, basePath, Messages.get().getBundle(OpenCms.getWorkplaceManager().getWorkplaceLocale(m_cms)).key( Messages.GUI_SITESELECTOR_CURRENT_SUBSITE_0)); } } }
public class class_name { public void addCurrentSubsite(String referencePath) { CmsADEConfigData configData = OpenCms.getADEManager().lookupConfiguration(m_cms, referencePath); String basePath = configData.getBasePath(); if (basePath != null) { addOption( Type.currentSubsite, basePath, Messages.get().getBundle(OpenCms.getWorkplaceManager().getWorkplaceLocale(m_cms)).key( Messages.GUI_SITESELECTOR_CURRENT_SUBSITE_0)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Name getPrefix(int index) { LinkedList newNames = new LinkedList(); for (int i = 0; i < index; i++) { newNames.add(names.get(i)); } return new DistinguishedName(newNames); } }
public class class_name { public Name getPrefix(int index) { LinkedList newNames = new LinkedList(); for (int i = 0; i < index; i++) { newNames.add(names.get(i)); // depends on control dependency: [for], data = [i] } return new DistinguishedName(newNames); } }
public class class_name { public static Criterion allEq(Map<String,Object> values) { Conjunction conjunction = new Conjunction(); for( Entry<String, Object> entry : values.entrySet() ) { conjunction.add( eq(entry.getKey(), entry.getValue()) ); } return conjunction; } }
public class class_name { public static Criterion allEq(Map<String,Object> values) { Conjunction conjunction = new Conjunction(); for( Entry<String, Object> entry : values.entrySet() ) { conjunction.add( eq(entry.getKey(), entry.getValue()) ); // depends on control dependency: [for], data = [entry] } return conjunction; } }
public class class_name { double sparseProbabilisticAlgorithmCardinality() { final int m = this.m/*for performance*/; // compute the "indicator function" -- sum(2^(-M[j])) where M[j] is the // 'j'th register value double sum = 0; int numberOfZeroes = 0/*"V" in the paper*/; for(int j=0; j<m; j++) { final long register = sparseProbabilisticStorage.get(j); sum += 1.0 / (1L << register); if(register == 0L) numberOfZeroes++; } // apply the estimate and correction to the indicator function final double estimator = alphaMSquared / sum; if((numberOfZeroes != 0) && (estimator < smallEstimatorCutoff)) { return HLLUtil.smallEstimator(m, numberOfZeroes); } else if(estimator <= largeEstimatorCutoff) { return estimator; } else { return HLLUtil.largeEstimator(log2m, regwidth, estimator); } } }
public class class_name { double sparseProbabilisticAlgorithmCardinality() { final int m = this.m/*for performance*/; // compute the "indicator function" -- sum(2^(-M[j])) where M[j] is the // 'j'th register value double sum = 0; int numberOfZeroes = 0/*"V" in the paper*/; for(int j=0; j<m; j++) { final long register = sparseProbabilisticStorage.get(j); sum += 1.0 / (1L << register); // depends on control dependency: [for], data = [none] if(register == 0L) numberOfZeroes++; } // apply the estimate and correction to the indicator function final double estimator = alphaMSquared / sum; if((numberOfZeroes != 0) && (estimator < smallEstimatorCutoff)) { return HLLUtil.smallEstimator(m, numberOfZeroes); // depends on control dependency: [if], data = [none] } else if(estimator <= largeEstimatorCutoff) { return estimator; // depends on control dependency: [if], data = [none] } else { return HLLUtil.largeEstimator(log2m, regwidth, estimator); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean setLinesDeleted(String linesDeletedStr) { try { this.linesDeleted = Integer.parseInt(linesDeletedStr); return true; } catch (NumberFormatException e) { return false; } } }
public class class_name { public boolean setLinesDeleted(String linesDeletedStr) { try { this.linesDeleted = Integer.parseInt(linesDeletedStr); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static CharSequence js_substr(CharSequence target, Object[] args) { if (args.length < 1) return target; double begin = ScriptRuntime.toInteger(args[0]); double end; int length = target.length(); if (begin < 0) { begin += length; if (begin < 0) begin = 0; } else if (begin > length) { begin = length; } if (args.length == 1) { end = length; } else { end = ScriptRuntime.toInteger(args[1]); if (end < 0) end = 0; end += begin; if (end > length) end = length; } return target.subSequence((int)begin, (int)end); } }
public class class_name { private static CharSequence js_substr(CharSequence target, Object[] args) { if (args.length < 1) return target; double begin = ScriptRuntime.toInteger(args[0]); double end; int length = target.length(); if (begin < 0) { begin += length; // depends on control dependency: [if], data = [none] if (begin < 0) begin = 0; } else if (begin > length) { begin = length; // depends on control dependency: [if], data = [none] } if (args.length == 1) { end = length; // depends on control dependency: [if], data = [none] } else { end = ScriptRuntime.toInteger(args[1]); // depends on control dependency: [if], data = [none] if (end < 0) end = 0; end += begin; // depends on control dependency: [if], data = [none] if (end > length) end = length; } return target.subSequence((int)begin, (int)end); } }
public class class_name { public BinaryString[] splitByWholeSeparatorPreserveAllTokens(BinaryString separator) { ensureMaterialized(); final int len = sizeInBytes; if (len == 0) { return EMPTY_STRING_ARRAY; } if (separator == null || EMPTY_UTF8.equals(separator)) { // Split on whitespace. return splitByWholeSeparatorPreserveAllTokens(fromString(" ")); } separator.ensureMaterialized(); final int separatorLength = separator.sizeInBytes; final ArrayList<BinaryString> substrings = new ArrayList<>(); int beg = 0; int end = 0; while (end < len) { end = SegmentsUtil.find( segments, offset + beg, sizeInBytes - beg, separator.segments, separator.offset, separator.sizeInBytes) - offset; if (end > -1) { if (end > beg) { // The following is OK, because String.substring( beg, end ) excludes // the character at the position 'end'. substrings.add(BinaryString.fromAddress(segments, offset + beg, end - beg)); // Set the starting point for the next search. // The following is equivalent to beg = end + (separatorLength - 1) + 1, // which is the right calculation: beg = end + separatorLength; } else { // We found a consecutive occurrence of the separator. substrings.add(EMPTY_UTF8); beg = end + separatorLength; } } else { // String.substring( beg ) goes from 'beg' to the end of the String. substrings.add(BinaryString.fromAddress(segments, offset + beg, sizeInBytes - beg)); end = len; } } return substrings.toArray(new BinaryString[0]); } }
public class class_name { public BinaryString[] splitByWholeSeparatorPreserveAllTokens(BinaryString separator) { ensureMaterialized(); final int len = sizeInBytes; if (len == 0) { return EMPTY_STRING_ARRAY; // depends on control dependency: [if], data = [none] } if (separator == null || EMPTY_UTF8.equals(separator)) { // Split on whitespace. return splitByWholeSeparatorPreserveAllTokens(fromString(" ")); // depends on control dependency: [if], data = [none] } separator.ensureMaterialized(); final int separatorLength = separator.sizeInBytes; final ArrayList<BinaryString> substrings = new ArrayList<>(); int beg = 0; int end = 0; while (end < len) { end = SegmentsUtil.find( segments, offset + beg, sizeInBytes - beg, separator.segments, separator.offset, separator.sizeInBytes) - offset; // depends on control dependency: [while], data = [none] if (end > -1) { if (end > beg) { // The following is OK, because String.substring( beg, end ) excludes // the character at the position 'end'. substrings.add(BinaryString.fromAddress(segments, offset + beg, end - beg)); // depends on control dependency: [if], data = [beg)] // Set the starting point for the next search. // The following is equivalent to beg = end + (separatorLength - 1) + 1, // which is the right calculation: beg = end + separatorLength; // depends on control dependency: [if], data = [none] } else { // We found a consecutive occurrence of the separator. substrings.add(EMPTY_UTF8); // depends on control dependency: [if], data = [none] beg = end + separatorLength; // depends on control dependency: [if], data = [none] } } else { // String.substring( beg ) goes from 'beg' to the end of the String. substrings.add(BinaryString.fromAddress(segments, offset + beg, sizeInBytes - beg)); // depends on control dependency: [if], data = [none] end = len; // depends on control dependency: [if], data = [none] } } return substrings.toArray(new BinaryString[0]); } }
public class class_name { public void parse(Element element) { model = newModel(); model.setName(element.getAttribute(ATTR_NAME)); model.setDisplayName(element.getAttribute(ATTR_DISPLAYNAME)); model.setLayout(element.getAttribute(ATTR_LAYOUT)); model.setPreInterceptors(element.getAttribute(ATTR_PREINTERCEPTORS)); model.setPostInterceptors(element.getAttribute(ATTR_POSTINTERCEPTORS)); List<Element> transitions = XmlHelper.elements(element, NODE_TRANSITION); for(Element te : transitions) { TransitionModel transition = new TransitionModel(); transition.setName(te.getAttribute(ATTR_NAME)); transition.setDisplayName(te.getAttribute(ATTR_DISPLAYNAME)); transition.setTo(te.getAttribute(ATTR_TO)); transition.setExpr(te.getAttribute(ATTR_EXPR)); transition.setG(te.getAttribute(ATTR_G)); transition.setOffset(te.getAttribute(ATTR_OFFSET)); transition.setSource(model); model.getOutputs().add(transition); } parseNode(model, element); } }
public class class_name { public void parse(Element element) { model = newModel(); model.setName(element.getAttribute(ATTR_NAME)); model.setDisplayName(element.getAttribute(ATTR_DISPLAYNAME)); model.setLayout(element.getAttribute(ATTR_LAYOUT)); model.setPreInterceptors(element.getAttribute(ATTR_PREINTERCEPTORS)); model.setPostInterceptors(element.getAttribute(ATTR_POSTINTERCEPTORS)); List<Element> transitions = XmlHelper.elements(element, NODE_TRANSITION); for(Element te : transitions) { TransitionModel transition = new TransitionModel(); transition.setName(te.getAttribute(ATTR_NAME)); // depends on control dependency: [for], data = [te] transition.setDisplayName(te.getAttribute(ATTR_DISPLAYNAME)); // depends on control dependency: [for], data = [te] transition.setTo(te.getAttribute(ATTR_TO)); // depends on control dependency: [for], data = [te] transition.setExpr(te.getAttribute(ATTR_EXPR)); // depends on control dependency: [for], data = [te] transition.setG(te.getAttribute(ATTR_G)); // depends on control dependency: [for], data = [te] transition.setOffset(te.getAttribute(ATTR_OFFSET)); // depends on control dependency: [for], data = [te] transition.setSource(model); // depends on control dependency: [for], data = [none] model.getOutputs().add(transition); // depends on control dependency: [for], data = [none] } parseNode(model, element); } }
public class class_name { @Override public String substituteProps(String str, SubstitutionTransformer transformer) { if (str == null) { return null; } StringBuffer buf = new StringBuffer(); Matcher matcher = pattern.matcher(str); while ( matcher.find() ) { String propName = matcher.group(1); String propValue = getPropValue(propName); if (propValue != null) { if (transformer != null) { propValue = transformer.transform(propName, propValue); } matcher.appendReplacement( buf, propValue .replace("\\", "\\\\") //$NON-NLS-1$ //$NON-NLS-2$ .replace("$", "\\$") //$NON-NLS-1$ //$NON-NLS-2$ ); } else { matcher.appendReplacement(buf, "\\${"+propName+"}"); //$NON-NLS-1$ //$NON-NLS-2$ } } matcher.appendTail(buf); return buf.toString(); } }
public class class_name { @Override public String substituteProps(String str, SubstitutionTransformer transformer) { if (str == null) { return null; // depends on control dependency: [if], data = [none] } StringBuffer buf = new StringBuffer(); Matcher matcher = pattern.matcher(str); while ( matcher.find() ) { String propName = matcher.group(1); String propValue = getPropValue(propName); if (propValue != null) { if (transformer != null) { propValue = transformer.transform(propName, propValue); // depends on control dependency: [if], data = [none] } matcher.appendReplacement( buf, propValue .replace("\\", "\\\\") //$NON-NLS-1$ //$NON-NLS-2$ .replace("$", "\\$") //$NON-NLS-1$ //$NON-NLS-2$ ); // depends on control dependency: [if], data = [none] } else { matcher.appendReplacement(buf, "\\${"+propName+"}"); //$NON-NLS-1$ //$NON-NLS-2$ // depends on control dependency: [if], data = [none] } } matcher.appendTail(buf); return buf.toString(); } }
public class class_name { protected void throttleUpdated () { int messagesPerSec; synchronized(_pendingThrottles) { if (_pendingThrottles.size() == 0) { log.warning("Received throttleUpdated but have no pending throttles", "client", this); return; } messagesPerSec = _pendingThrottles.remove(0); } // log.info("Applying updated throttle", "client", this, "msgsPerSec", messagesPerSec); // We set our hard throttle over a 10 second period instead of a 1 second period to // account for periods of network congestion that might cause otherwise properly // throttled messages to bunch up while they're "on the wire"; we also add a one // message buffer so that if the client is right up against the limit, we don't end // up quibbling over a couple of milliseconds _throttle.reinit(10*messagesPerSec+1, 10*1000L); } }
public class class_name { protected void throttleUpdated () { int messagesPerSec; synchronized(_pendingThrottles) { if (_pendingThrottles.size() == 0) { log.warning("Received throttleUpdated but have no pending throttles", "client", this); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } messagesPerSec = _pendingThrottles.remove(0); } // log.info("Applying updated throttle", "client", this, "msgsPerSec", messagesPerSec); // We set our hard throttle over a 10 second period instead of a 1 second period to // account for periods of network congestion that might cause otherwise properly // throttled messages to bunch up while they're "on the wire"; we also add a one // message buffer so that if the client is right up against the limit, we don't end // up quibbling over a couple of milliseconds _throttle.reinit(10*messagesPerSec+1, 10*1000L); } }
public class class_name { private long throttleQueries() { if (timeLastQuerySent != 0) { // check that we allowed some time between queries long difference = System.currentTimeMillis() - timeLastQuerySent; if (difference < minDelayBetweenQueries) { return minDelayBetweenQueries - difference; } } return -1; } }
public class class_name { private long throttleQueries() { if (timeLastQuerySent != 0) { // check that we allowed some time between queries long difference = System.currentTimeMillis() - timeLastQuerySent; if (difference < minDelayBetweenQueries) { return minDelayBetweenQueries - difference; // depends on control dependency: [if], data = [none] } } return -1; } }
public class class_name { public java.util.List<TargetGroupInfo> getTargetGroupInfoList() { if (targetGroupInfoList == null) { targetGroupInfoList = new com.amazonaws.internal.SdkInternalList<TargetGroupInfo>(); } return targetGroupInfoList; } }
public class class_name { public java.util.List<TargetGroupInfo> getTargetGroupInfoList() { if (targetGroupInfoList == null) { targetGroupInfoList = new com.amazonaws.internal.SdkInternalList<TargetGroupInfo>(); // depends on control dependency: [if], data = [none] } return targetGroupInfoList; } }
public class class_name { private JScrollPane getPaneScroll() { if (paneScroll == null) { paneScroll = new JScrollPane(); paneScroll.setName("paneScroll"); paneScroll.setViewportView(getTreeAlert()); } return paneScroll; } }
public class class_name { private JScrollPane getPaneScroll() { if (paneScroll == null) { paneScroll = new JScrollPane(); // depends on control dependency: [if], data = [none] paneScroll.setName("paneScroll"); // depends on control dependency: [if], data = [none] paneScroll.setViewportView(getTreeAlert()); // depends on control dependency: [if], data = [none] } return paneScroll; } }
public class class_name { public void generateProfileMBeanInterface() throws Exception { if (SleeProfileClassCodeGenerator.checkCombination(component) == -1) { throw new DeploymentException("Profile Specification doesn't match any combination " + "from the JSLEE spec 1.0 section 10.5.2"); } String profileMBeanConcreteInterfaceName = cmpProfileInterfaceName + "MBean"; profileMBeanConcreteInterface = pool.makeInterface(profileMBeanConcreteInterfaceName); try { cmpProfileInterface = pool.get(cmpProfileInterfaceName); profileManagementInterface = profileManagementInterfaceName != null ? pool.get(profileManagementInterfaceName) : null; } catch (NotFoundException nfe) { throw new DeploymentException("Failed to locate CMP/Management Interface for " + component, nfe); } // set interface try { profileMBeanConcreteInterface.addInterface(pool.get(AbstractProfileMBean.class.getName())); } catch (Throwable e) { throw new SLEEException(e.getMessage(),e); } // gather exceptions that the mbean methods may throw CtClass[] managementMethodExceptions = new CtClass[3]; try { managementMethodExceptions[0] = pool.get(ManagementException.class.getName()); managementMethodExceptions[1] = pool.get(InvalidStateException.class.getName()); managementMethodExceptions[2] = pool.get(ProfileImplementationException.class.getName()); } catch (NotFoundException e) { throw new SLEEException(e.getMessage(),e); } CtClass[] cmpGetAcessorMethodExceptions = new CtClass[] {managementMethodExceptions[0]}; CtClass[] cmpSetAcessorMethodExceptions = new CtClass[] {managementMethodExceptions[0],managementMethodExceptions[1]}; // gather all Object class methods, we don't want those in the mbean Set<CtMethod> objectMethods = new HashSet<CtMethod>(); try { CtClass objectClass = pool.get(Object.class.getName()); for (CtMethod ctMethod : objectClass.getMethods()) { objectMethods.add(ctMethod); } } catch (NotFoundException e) { throw new SLEEException(e.getMessage(),e); } // gather methods to copy Set<CtMethod> cmpAcessorMethods = new HashSet<CtMethod>(); Set<CtMethod> managementMethods = new HashSet<CtMethod>(); if (profileManagementInterface != null) { // If the Profile Specification defines a Profile Management Interface, the profileMBean interface has the same methods // 1. gather all methods from management interface for (CtMethod ctMethod : profileManagementInterface.getMethods()) { if (!objectMethods.contains(ctMethod)) { managementMethods.add(ctMethod); } } // 2. gather all methods present also in cmp interface, removing those from the ones gather from management interface for (CtMethod ctMethod : cmpProfileInterface.getMethods()) { if (!objectMethods.contains(ctMethod)) { if (managementMethods.remove(ctMethod)) { cmpAcessorMethods.add(ctMethod); } } } } else { for (CtMethod ctMethod : cmpProfileInterface.getMethods()) { if (!objectMethods.contains(ctMethod)) { cmpAcessorMethods.add(ctMethod); } } } // copy cmp acessor & mngt methods for (CtMethod ctMethod : cmpAcessorMethods) { // copy method CtMethod methodCopy = new CtMethod(ctMethod, profileMBeanConcreteInterface, null); // set exceptions CtClass[] exceptions = null; if(ctMethod.getName().startsWith("set")) { exceptions = cmpSetAcessorMethodExceptions; } else if(ctMethod.getName().startsWith("get")) { exceptions = cmpGetAcessorMethodExceptions; } else { throw new DeploymentException("unexpected method in profile cmp interface "+ctMethod); } methodCopy.setExceptionTypes(exceptions); // add to class profileMBeanConcreteInterface.addMethod(methodCopy); // store in set to be used in mbean impl mBeanCmpAcessorMethods.add(methodCopy); } for (CtMethod ctMethod : managementMethods) { // copy method CtMethod methodCopy = new CtMethod(ctMethod, profileMBeanConcreteInterface, null); // set exceptions methodCopy.setExceptionTypes(managementMethodExceptions); // add to class profileMBeanConcreteInterface.addMethod(methodCopy); // store in set to be used in mbean impl mBeanManagementMethods.add(methodCopy); } // write class file try { profileMBeanConcreteInterface.writeFile(this.component.getDeploymentDir().getAbsolutePath()); } catch (Throwable e) { throw new SLEEException(e.getMessage(), e); } finally { profileMBeanConcreteInterface.defrost(); } // and load it to the component try { this.component.setProfileMBeanConcreteInterfaceClass(Thread.currentThread().getContextClassLoader().loadClass(profileMBeanConcreteInterfaceName)); } catch (Throwable e) { throw new SLEEException(e.getMessage(), e); } } }
public class class_name { public void generateProfileMBeanInterface() throws Exception { if (SleeProfileClassCodeGenerator.checkCombination(component) == -1) { throw new DeploymentException("Profile Specification doesn't match any combination " + "from the JSLEE spec 1.0 section 10.5.2"); } String profileMBeanConcreteInterfaceName = cmpProfileInterfaceName + "MBean"; profileMBeanConcreteInterface = pool.makeInterface(profileMBeanConcreteInterfaceName); try { cmpProfileInterface = pool.get(cmpProfileInterfaceName); profileManagementInterface = profileManagementInterfaceName != null ? pool.get(profileManagementInterfaceName) : null; } catch (NotFoundException nfe) { throw new DeploymentException("Failed to locate CMP/Management Interface for " + component, nfe); } // set interface try { profileMBeanConcreteInterface.addInterface(pool.get(AbstractProfileMBean.class.getName())); } catch (Throwable e) { throw new SLEEException(e.getMessage(),e); } // gather exceptions that the mbean methods may throw CtClass[] managementMethodExceptions = new CtClass[3]; try { managementMethodExceptions[0] = pool.get(ManagementException.class.getName()); managementMethodExceptions[1] = pool.get(InvalidStateException.class.getName()); managementMethodExceptions[2] = pool.get(ProfileImplementationException.class.getName()); } catch (NotFoundException e) { throw new SLEEException(e.getMessage(),e); } CtClass[] cmpGetAcessorMethodExceptions = new CtClass[] {managementMethodExceptions[0]}; CtClass[] cmpSetAcessorMethodExceptions = new CtClass[] {managementMethodExceptions[0],managementMethodExceptions[1]}; // gather all Object class methods, we don't want those in the mbean Set<CtMethod> objectMethods = new HashSet<CtMethod>(); try { CtClass objectClass = pool.get(Object.class.getName()); for (CtMethod ctMethod : objectClass.getMethods()) { objectMethods.add(ctMethod); // depends on control dependency: [for], data = [ctMethod] } } catch (NotFoundException e) { throw new SLEEException(e.getMessage(),e); } // gather methods to copy Set<CtMethod> cmpAcessorMethods = new HashSet<CtMethod>(); Set<CtMethod> managementMethods = new HashSet<CtMethod>(); if (profileManagementInterface != null) { // If the Profile Specification defines a Profile Management Interface, the profileMBean interface has the same methods // 1. gather all methods from management interface for (CtMethod ctMethod : profileManagementInterface.getMethods()) { if (!objectMethods.contains(ctMethod)) { managementMethods.add(ctMethod); // depends on control dependency: [if], data = [none] } } // 2. gather all methods present also in cmp interface, removing those from the ones gather from management interface for (CtMethod ctMethod : cmpProfileInterface.getMethods()) { if (!objectMethods.contains(ctMethod)) { if (managementMethods.remove(ctMethod)) { cmpAcessorMethods.add(ctMethod); // depends on control dependency: [if], data = [none] } } } } else { for (CtMethod ctMethod : cmpProfileInterface.getMethods()) { if (!objectMethods.contains(ctMethod)) { cmpAcessorMethods.add(ctMethod); } } } // copy cmp acessor & mngt methods for (CtMethod ctMethod : cmpAcessorMethods) { // copy method CtMethod methodCopy = new CtMethod(ctMethod, profileMBeanConcreteInterface, null); // set exceptions CtClass[] exceptions = null; if(ctMethod.getName().startsWith("set")) { exceptions = cmpSetAcessorMethodExceptions; } else if(ctMethod.getName().startsWith("get")) { exceptions = cmpGetAcessorMethodExceptions; } else { throw new DeploymentException("unexpected method in profile cmp interface "+ctMethod); } methodCopy.setExceptionTypes(exceptions); // add to class profileMBeanConcreteInterface.addMethod(methodCopy); // store in set to be used in mbean impl mBeanCmpAcessorMethods.add(methodCopy); } for (CtMethod ctMethod : managementMethods) { // copy method CtMethod methodCopy = new CtMethod(ctMethod, profileMBeanConcreteInterface, null); // set exceptions methodCopy.setExceptionTypes(managementMethodExceptions); // add to class profileMBeanConcreteInterface.addMethod(methodCopy); // store in set to be used in mbean impl mBeanManagementMethods.add(methodCopy); } // write class file try { profileMBeanConcreteInterface.writeFile(this.component.getDeploymentDir().getAbsolutePath()); } catch (Throwable e) { throw new SLEEException(e.getMessage(), e); } finally { profileMBeanConcreteInterface.defrost(); } // and load it to the component try { this.component.setProfileMBeanConcreteInterfaceClass(Thread.currentThread().getContextClassLoader().loadClass(profileMBeanConcreteInterfaceName)); } catch (Throwable e) { throw new SLEEException(e.getMessage(), e); } } }
public class class_name { final DAO loadExternalDAO(String classSimpleName) { ServiceLoader<DAO> daoLoader = ServiceLoader.load(DAO.class, Para.getParaClassLoader()); for (DAO dao : daoLoader) { if (dao != null && classSimpleName.equalsIgnoreCase(dao.getClass().getSimpleName())) { return dao; } } return null; } }
public class class_name { final DAO loadExternalDAO(String classSimpleName) { ServiceLoader<DAO> daoLoader = ServiceLoader.load(DAO.class, Para.getParaClassLoader()); for (DAO dao : daoLoader) { if (dao != null && classSimpleName.equalsIgnoreCase(dao.getClass().getSimpleName())) { return dao; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { @Override public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException { Object o = context.getEntity(); if (o != null && isWritable(o.getClass())) { MultivaluedMap<String, String> queryParams = uriInfoProvider.get().getQueryParameters(); SpiQuery query = null; if (o instanceof Finder) { query = (SpiQuery) ((Finder) o).query(); } else if (o instanceof Query) { query = (SpiQuery) o; } else if (o instanceof ExpressionList) { query = (SpiQuery) ((ExpressionList) o).query(); } else if (o instanceof FutureList) { query = (SpiQuery) ((FutureList) o).getQuery(); } else if (o instanceof FutureIds) { query = (SpiQuery) ((FutureIds) o).getQuery(); } if (query != null) { FutureRowCount rowCount = applyUriQuery(queryParams, query, manager); Object result; if (o instanceof FutureList) { result = ((FutureList) o).getUnchecked(); } else if (o instanceof FutureIds) { try { result = ((FutureIds) o).get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PersistenceException(e); } catch (ExecutionException e) { throw new PersistenceException(e); } } else { result = query.findList(); } applyRowCountHeader(context.getHeaders(), query, rowCount); context.setEntity(result); if (result != null) context.setType(result.getClass()); context.setGenericType(query.getBeanType()); } } else if (o instanceof BeanCollection && !BeanCollection.class.isAssignableFrom(context.getType())) { context.setEntity(o.getClass()); } context.proceed(); } }
public class class_name { @Override public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException { Object o = context.getEntity(); if (o != null && isWritable(o.getClass())) { MultivaluedMap<String, String> queryParams = uriInfoProvider.get().getQueryParameters(); SpiQuery query = null; if (o instanceof Finder) { query = (SpiQuery) ((Finder) o).query(); // depends on control dependency: [if], data = [none] } else if (o instanceof Query) { query = (SpiQuery) o; // depends on control dependency: [if], data = [none] } else if (o instanceof ExpressionList) { query = (SpiQuery) ((ExpressionList) o).query(); // depends on control dependency: [if], data = [none] } else if (o instanceof FutureList) { query = (SpiQuery) ((FutureList) o).getQuery(); // depends on control dependency: [if], data = [none] } else if (o instanceof FutureIds) { query = (SpiQuery) ((FutureIds) o).getQuery(); // depends on control dependency: [if], data = [none] } if (query != null) { FutureRowCount rowCount = applyUriQuery(queryParams, query, manager); Object result; if (o instanceof FutureList) { result = ((FutureList) o).getUnchecked(); // depends on control dependency: [if], data = [none] } else if (o instanceof FutureIds) { try { result = ((FutureIds) o).get(); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new PersistenceException(e); } catch (ExecutionException e) { // depends on control dependency: [catch], data = [none] throw new PersistenceException(e); } // depends on control dependency: [catch], data = [none] } else { result = query.findList(); // depends on control dependency: [if], data = [none] } applyRowCountHeader(context.getHeaders(), query, rowCount); // depends on control dependency: [if], data = [none] context.setEntity(result); // depends on control dependency: [if], data = [none] if (result != null) context.setType(result.getClass()); context.setGenericType(query.getBeanType()); // depends on control dependency: [if], data = [(query] } } else if (o instanceof BeanCollection && !BeanCollection.class.isAssignableFrom(context.getType())) { context.setEntity(o.getClass()); } context.proceed(); } }
public class class_name { private void calculateInsideBeam(int spanStart, int spanEnd, BeamSearchCfgParseChart chart, long[] treeEncodingOffsets) { // For efficiency, precompute values which are used repeatedly in the loop // below. double[] values = binaryDistributionWeights.getValues(); long[] dimensionOffsets = binaryDistributionWeights.getDimensionOffsets(); for (int i = 0; i < spanEnd - spanStart; i++) { for (int j = i + 1; j < (canSkipTerminals ? 1 + spanEnd - spanStart : i + 2); j++) { // These variables store the (integer encoded) parse trees from the two // subspans. long[] leftParseTreeKeys = chart.getParseTreeKeysForSpan(spanStart, spanStart + i); double[] leftParseTreeProbs = chart.getParseTreeProbsForSpan(spanStart, spanStart + i); int numLeftParseTrees = chart.getNumParseTreeKeysForSpan(spanStart, spanStart + i); long[] rightParseTreeKeys = chart.getParseTreeKeysForSpan(spanStart + j, spanEnd); double[] rightParseTreeProbs = chart.getParseTreeProbsForSpan(spanStart + j, spanEnd); int numRightParseTrees = chart.getNumParseTreeKeysForSpan(spanStart + j, spanEnd); long spanKey = ((spanStart + i) * treeEncodingOffsets[2]) + ((spanStart + j) * treeEncodingOffsets[3]); for (int leftIndex = 0; leftIndex < numLeftParseTrees; leftIndex++) { // Parse out the parent node's index from the left tree. int leftRoot = (int) ((leftParseTreeKeys[leftIndex] % treeEncodingOffsets[3]) / treeEncodingOffsets[4]); long leftIndexPartialKey = (leftIndex * treeEncodingOffsets[0]) + spanKey; for (int rightIndex = 0; rightIndex < numRightParseTrees; rightIndex++) { int rightRoot = (int) ((rightParseTreeKeys[rightIndex] % treeEncodingOffsets[3]) / treeEncodingOffsets[4]); long rightIndexPartialKey = (rightIndex * treeEncodingOffsets[1]) + leftIndexPartialKey; // Compute the tensor index containing any production rules // where leftRoot is the left nonterminal and rightRoot is the right // nonterminal. long partialKeyNum = leftRoot * dimensionOffsets[0] + rightRoot * dimensionOffsets[1]; int startIndex = binaryDistributionWeights.getNearestIndex(partialKeyNum); long endKeyNum = partialKeyNum + dimensionOffsets[1]; long startKeyNum; while (startIndex < values.length) { startKeyNum = binaryDistributionWeights.indexToKeyNum(startIndex); if (startKeyNum >= endKeyNum) { break; } double treeProb = leftParseTreeProbs[leftIndex] * rightParseTreeProbs[rightIndex] * values[startIndex]; long treeKeyNum = rightIndexPartialKey + startKeyNum - partialKeyNum; chart.addParseTreeKeyForSpan(spanStart, spanEnd, treeKeyNum, treeProb); startIndex++; } } } } } } }
public class class_name { private void calculateInsideBeam(int spanStart, int spanEnd, BeamSearchCfgParseChart chart, long[] treeEncodingOffsets) { // For efficiency, precompute values which are used repeatedly in the loop // below. double[] values = binaryDistributionWeights.getValues(); long[] dimensionOffsets = binaryDistributionWeights.getDimensionOffsets(); for (int i = 0; i < spanEnd - spanStart; i++) { for (int j = i + 1; j < (canSkipTerminals ? 1 + spanEnd - spanStart : i + 2); j++) { // These variables store the (integer encoded) parse trees from the two // subspans. long[] leftParseTreeKeys = chart.getParseTreeKeysForSpan(spanStart, spanStart + i); double[] leftParseTreeProbs = chart.getParseTreeProbsForSpan(spanStart, spanStart + i); int numLeftParseTrees = chart.getNumParseTreeKeysForSpan(spanStart, spanStart + i); long[] rightParseTreeKeys = chart.getParseTreeKeysForSpan(spanStart + j, spanEnd); double[] rightParseTreeProbs = chart.getParseTreeProbsForSpan(spanStart + j, spanEnd); int numRightParseTrees = chart.getNumParseTreeKeysForSpan(spanStart + j, spanEnd); long spanKey = ((spanStart + i) * treeEncodingOffsets[2]) + ((spanStart + j) * treeEncodingOffsets[3]); for (int leftIndex = 0; leftIndex < numLeftParseTrees; leftIndex++) { // Parse out the parent node's index from the left tree. int leftRoot = (int) ((leftParseTreeKeys[leftIndex] % treeEncodingOffsets[3]) / treeEncodingOffsets[4]); long leftIndexPartialKey = (leftIndex * treeEncodingOffsets[0]) + spanKey; for (int rightIndex = 0; rightIndex < numRightParseTrees; rightIndex++) { int rightRoot = (int) ((rightParseTreeKeys[rightIndex] % treeEncodingOffsets[3]) / treeEncodingOffsets[4]); long rightIndexPartialKey = (rightIndex * treeEncodingOffsets[1]) + leftIndexPartialKey; // Compute the tensor index containing any production rules // where leftRoot is the left nonterminal and rightRoot is the right // nonterminal. long partialKeyNum = leftRoot * dimensionOffsets[0] + rightRoot * dimensionOffsets[1]; int startIndex = binaryDistributionWeights.getNearestIndex(partialKeyNum); long endKeyNum = partialKeyNum + dimensionOffsets[1]; long startKeyNum; while (startIndex < values.length) { startKeyNum = binaryDistributionWeights.indexToKeyNum(startIndex); // depends on control dependency: [while], data = [(startIndex] if (startKeyNum >= endKeyNum) { break; } double treeProb = leftParseTreeProbs[leftIndex] * rightParseTreeProbs[rightIndex] * values[startIndex]; long treeKeyNum = rightIndexPartialKey + startKeyNum - partialKeyNum; chart.addParseTreeKeyForSpan(spanStart, spanEnd, treeKeyNum, treeProb); // depends on control dependency: [while], data = [none] startIndex++; // depends on control dependency: [while], data = [none] } } } } } } }
public class class_name { protected Content getClassLink(LinkInfo linkInfo) { LinkInfoImpl classLinkInfo = (LinkInfoImpl) linkInfo; boolean noLabel = linkInfo.label == null || linkInfo.label.isEmpty(); ClassDoc classDoc = classLinkInfo.classDoc; //Create a tool tip if we are linking to a class or interface. Don't //create one if we are linking to a member. String title = (classLinkInfo.where == null || classLinkInfo.where.length() == 0) ? getClassToolTip(classDoc, classLinkInfo.type != null && !classDoc.qualifiedTypeName().equals(classLinkInfo.type.qualifiedTypeName())) : ""; Content label = classLinkInfo.getClassLinkLabel(m_writer.configuration); Configuration configuration = m_writer.configuration; Content link = new ContentBuilder(); if (classDoc.isIncluded()) { if (configuration.isGeneratedDoc(classDoc)) { DocPath filename = getPath(classLinkInfo); if (linkInfo.linkToSelf || !(DocPath.forName(classDoc)).equals(m_writer.filename)) { link.addContent(m_writer.getHyperLink( filename.fragment(classLinkInfo.where), label, classLinkInfo.isStrong, classLinkInfo.styleName, title, classLinkInfo.target)); if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { link.addContent(getTypeParameterLinks(linkInfo)); } return link; } } } else { Content crossLink = m_writer.getCrossClassLink( classDoc.qualifiedName(), classLinkInfo.where, label, classLinkInfo.isStrong, classLinkInfo.styleName, true); if (crossLink != null) { link.addContent(crossLink); if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { link.addContent(getTypeParameterLinks(linkInfo)); } return link; } } // Can't link so just write label. link.addContent(label); if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { link.addContent(getTypeParameterLinks(linkInfo)); } return link; } }
public class class_name { protected Content getClassLink(LinkInfo linkInfo) { LinkInfoImpl classLinkInfo = (LinkInfoImpl) linkInfo; boolean noLabel = linkInfo.label == null || linkInfo.label.isEmpty(); ClassDoc classDoc = classLinkInfo.classDoc; //Create a tool tip if we are linking to a class or interface. Don't //create one if we are linking to a member. String title = (classLinkInfo.where == null || classLinkInfo.where.length() == 0) ? getClassToolTip(classDoc, classLinkInfo.type != null && !classDoc.qualifiedTypeName().equals(classLinkInfo.type.qualifiedTypeName())) : ""; Content label = classLinkInfo.getClassLinkLabel(m_writer.configuration); Configuration configuration = m_writer.configuration; Content link = new ContentBuilder(); if (classDoc.isIncluded()) { if (configuration.isGeneratedDoc(classDoc)) { DocPath filename = getPath(classLinkInfo); if (linkInfo.linkToSelf || !(DocPath.forName(classDoc)).equals(m_writer.filename)) { link.addContent(m_writer.getHyperLink( filename.fragment(classLinkInfo.where), label, classLinkInfo.isStrong, classLinkInfo.styleName, title, classLinkInfo.target)); // depends on control dependency: [if], data = [none] if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { link.addContent(getTypeParameterLinks(linkInfo)); // depends on control dependency: [if], data = [none] } return link; // depends on control dependency: [if], data = [none] } } } else { Content crossLink = m_writer.getCrossClassLink( classDoc.qualifiedName(), classLinkInfo.where, label, classLinkInfo.isStrong, classLinkInfo.styleName, true); if (crossLink != null) { link.addContent(crossLink); // depends on control dependency: [if], data = [(crossLink] if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { link.addContent(getTypeParameterLinks(linkInfo)); // depends on control dependency: [if], data = [none] } return link; // depends on control dependency: [if], data = [none] } } // Can't link so just write label. link.addContent(label); if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { link.addContent(getTypeParameterLinks(linkInfo)); // depends on control dependency: [if], data = [none] } return link; } }
public class class_name { public void trip() { if (state != BreakerState.OPEN) { openCount.getAndIncrement(); } state = BreakerState.OPEN; lastFailure.set(clock.currentTimeMillis()); isAttemptLive = false; notifyBreakerStateChange(getStatus()); } }
public class class_name { public void trip() { if (state != BreakerState.OPEN) { openCount.getAndIncrement(); // depends on control dependency: [if], data = [none] } state = BreakerState.OPEN; lastFailure.set(clock.currentTimeMillis()); isAttemptLive = false; notifyBreakerStateChange(getStatus()); } }
public class class_name { private GenericRecord convertRowToAvroRecord(Schema schema, Row row) { final List<Schema.Field> fields = schema.getFields(); final int length = fields.size(); final GenericRecord record = new GenericData.Record(schema); for (int i = 0; i < length; i++) { final Schema.Field field = fields.get(i); record.put(i, convertFlinkType(field.schema(), row.getField(i))); } return record; } }
public class class_name { private GenericRecord convertRowToAvroRecord(Schema schema, Row row) { final List<Schema.Field> fields = schema.getFields(); final int length = fields.size(); final GenericRecord record = new GenericData.Record(schema); for (int i = 0; i < length; i++) { final Schema.Field field = fields.get(i); record.put(i, convertFlinkType(field.schema(), row.getField(i))); // depends on control dependency: [for], data = [i] } return record; } }
public class class_name { public static boolean isNumber(String value) { try { Double.parseDouble(value); } catch (NumberFormatException nfe) { return false; } return true; } }
public class class_name { public static boolean isNumber(String value) { try { Double.parseDouble(value); // depends on control dependency: [try], data = [none] } catch (NumberFormatException nfe) { return false; } // depends on control dependency: [catch], data = [none] return true; } }
public class class_name { protected void addInnerHtmls(final boolean updateClient, final AbstractHtml... innerHtmls) { boolean listenerInvoked = false; final Lock lock = sharedObject.getLock(ACCESS_OBJECT).writeLock(); try { lock.lock(); final AbstractHtml[] removedAbstractHtmls = children .toArray(new AbstractHtml[children.size()]); children.clear(); initNewSharedObjectInAllNestedTagsAndSetSuperParentNull( removedAbstractHtmls); final InnerHtmlAddListener listener = sharedObject .getInnerHtmlAddListener(ACCESS_OBJECT); if (listener != null && updateClient) { final InnerHtmlAddListener.Event[] events = new InnerHtmlAddListener.Event[innerHtmls.length]; int index = 0; for (final AbstractHtml innerHtml : innerHtmls) { AbstractHtml previousParentTag = null; if (innerHtml.parent != null && innerHtml.parent.sharedObject == sharedObject) { previousParentTag = innerHtml.parent; } addChild(innerHtml, false); events[index] = new InnerHtmlAddListener.Event(this, innerHtml, previousParentTag); index++; } listener.innerHtmlsAdded(this, events); listenerInvoked = true; } else { for (final AbstractHtml innerHtml : innerHtmls) { addChild(innerHtml, false); } } } finally { lock.unlock(); } if (listenerInvoked) { final PushQueue pushQueue = sharedObject .getPushQueue(ACCESS_OBJECT); if (pushQueue != null) { pushQueue.push(); } } } }
public class class_name { protected void addInnerHtmls(final boolean updateClient, final AbstractHtml... innerHtmls) { boolean listenerInvoked = false; final Lock lock = sharedObject.getLock(ACCESS_OBJECT).writeLock(); try { lock.lock(); // depends on control dependency: [try], data = [none] final AbstractHtml[] removedAbstractHtmls = children .toArray(new AbstractHtml[children.size()]); children.clear(); // depends on control dependency: [try], data = [none] initNewSharedObjectInAllNestedTagsAndSetSuperParentNull( removedAbstractHtmls); // depends on control dependency: [try], data = [none] final InnerHtmlAddListener listener = sharedObject .getInnerHtmlAddListener(ACCESS_OBJECT); if (listener != null && updateClient) { final InnerHtmlAddListener.Event[] events = new InnerHtmlAddListener.Event[innerHtmls.length]; int index = 0; for (final AbstractHtml innerHtml : innerHtmls) { AbstractHtml previousParentTag = null; if (innerHtml.parent != null && innerHtml.parent.sharedObject == sharedObject) { previousParentTag = innerHtml.parent; // depends on control dependency: [if], data = [none] } addChild(innerHtml, false); // depends on control dependency: [for], data = [innerHtml] events[index] = new InnerHtmlAddListener.Event(this, innerHtml, previousParentTag); // depends on control dependency: [for], data = [none] index++; // depends on control dependency: [for], data = [none] } listener.innerHtmlsAdded(this, events); // depends on control dependency: [if], data = [none] listenerInvoked = true; // depends on control dependency: [if], data = [none] } else { for (final AbstractHtml innerHtml : innerHtmls) { addChild(innerHtml, false); // depends on control dependency: [for], data = [innerHtml] } } } finally { lock.unlock(); } if (listenerInvoked) { final PushQueue pushQueue = sharedObject .getPushQueue(ACCESS_OBJECT); if (pushQueue != null) { pushQueue.push(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static String formatWaypointNames(String[] waypointNames) { for (int i = 0; i < waypointNames.length; i++) { if (waypointNames[i] == null) { waypointNames[i] = ""; } } return TextUtils.join(";", waypointNames); } }
public class class_name { public static String formatWaypointNames(String[] waypointNames) { for (int i = 0; i < waypointNames.length; i++) { if (waypointNames[i] == null) { waypointNames[i] = ""; // depends on control dependency: [if], data = [none] } } return TextUtils.join(";", waypointNames); } }
public class class_name { private Duration assignmentDuration(Task task, Duration work) { Duration result = work; if (result != null) { if (result.getUnits() == TimeUnit.PERCENT) { Duration taskWork = task.getWork(); if (taskWork != null) { result = Duration.getInstance(taskWork.getDuration() * result.getDuration(), taskWork.getUnits()); } } } return result; } }
public class class_name { private Duration assignmentDuration(Task task, Duration work) { Duration result = work; if (result != null) { if (result.getUnits() == TimeUnit.PERCENT) { Duration taskWork = task.getWork(); if (taskWork != null) { result = Duration.getInstance(taskWork.getDuration() * result.getDuration(), taskWork.getUnits()); // depends on control dependency: [if], data = [(taskWork] } } } return result; } }
public class class_name { public synchronized static String convertToAgmipDateString(Date date) { if (date != null) { return dateFormatter.format(date); } else { return null; } } }
public class class_name { public synchronized static String convertToAgmipDateString(Date date) { if (date != null) { return dateFormatter.format(date); // depends on control dependency: [if], data = [(date] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void registerParameters(IGenerator<? extends IChemObject> generator) { for (IGeneratorParameter<?> param : generator.getParameters()) { try { renderingParameters.put(param.getClass().getName(), param.getClass().newInstance()); } catch (InstantiationException | IllegalAccessException e) { throw new IllegalStateException("Could not create a copy of rendering parameter."); } } } }
public class class_name { public void registerParameters(IGenerator<? extends IChemObject> generator) { for (IGeneratorParameter<?> param : generator.getParameters()) { try { renderingParameters.put(param.getClass().getName(), param.getClass().newInstance()); // depends on control dependency: [try], data = [none] } catch (InstantiationException | IllegalAccessException e) { throw new IllegalStateException("Could not create a copy of rendering parameter."); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { @Override public void removeAttribute(String name) { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "removeAttribute: " + name); } if (isInvalid()) { throw new IllegalStateException("Session is invalid"); } Object attr = this.attributes.remove(name); if (null == attr) { if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Attribute not found"); } return; } HttpSessionBindingEvent event = null; if (attr instanceof HttpSessionBindingListener) { // this value wants to know when it's removed if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Notifying value; " + attr); } event = new HttpSessionBindingEvent(this, name, attr); ((HttpSessionBindingListener) attr).valueUnbound(event); } // List<HttpSessionAttributeListener> listeners = this.myConfig.getSessionAttributeListeners(); // if (null != listeners) { // // notify any session-attribute listeners that were registered // // in the module configuration // if (null == event) { // event = new HttpSessionBindingEvent(this, name, attr); // } // for (HttpSessionAttributeListener listener : listeners) { // if (bTrace && tc.isDebugEnabled()) { // Tr.debug(tc, "Notifying listener: " + listener); // } // listener.attributeRemoved(event); // } // } } }
public class class_name { @Override public void removeAttribute(String name) { final boolean bTrace = TraceComponent.isAnyTracingEnabled(); if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "removeAttribute: " + name); // depends on control dependency: [if], data = [none] } if (isInvalid()) { throw new IllegalStateException("Session is invalid"); } Object attr = this.attributes.remove(name); if (null == attr) { if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Attribute not found"); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } HttpSessionBindingEvent event = null; if (attr instanceof HttpSessionBindingListener) { // this value wants to know when it's removed if (bTrace && tc.isDebugEnabled()) { Tr.debug(tc, "Notifying value; " + attr); // depends on control dependency: [if], data = [none] } event = new HttpSessionBindingEvent(this, name, attr); // depends on control dependency: [if], data = [none] ((HttpSessionBindingListener) attr).valueUnbound(event); // depends on control dependency: [if], data = [none] } // List<HttpSessionAttributeListener> listeners = this.myConfig.getSessionAttributeListeners(); // if (null != listeners) { // // notify any session-attribute listeners that were registered // // in the module configuration // if (null == event) { // event = new HttpSessionBindingEvent(this, name, attr); // } // for (HttpSessionAttributeListener listener : listeners) { // if (bTrace && tc.isDebugEnabled()) { // Tr.debug(tc, "Notifying listener: " + listener); // } // listener.attributeRemoved(event); // } // } } }
public class class_name { public void computeMolecularWeight(ElementTable eTable){ this.aaSymbol2MolecularWeight = new HashMap<Character, Double>(); for(AminoAcidComposition a:aminoacid){ //Check to ensure that the symbol is of single character if(a.getSymbol().length() != 1){ throw new Error(a.getSymbol() + " is not allowed. Symbols must be single character.\r\nPlease check AminoAcidComposition XML file"); } //Check to ensure that the symbols are not repeated char c = a.getSymbol().charAt(0); if(this.aaSymbol2MolecularWeight.keySet().contains(c)){ throw new Error("Symbol " + c + " is repeated.\r\n" + "Please check AminoAcidComposition XML file to ensure there are no repeated symbols. Note that this is case-insensitive.\r\n" + "This means that having 'A' and 'a' would be repeating."); } double total = 0.0; if(a.getElementList() != null){ for(Name2Count element:a.getElementList()){ element.getName(); if(eTable.getElement(element.getName()) == null){ throw new Error("Element " + element.getName() + " could not be found. " + "\r\nPlease ensure that its name is correct in AminoAcidComposition.xml and is defined in ElementMass.xml."); } eTable.getElement(element.getName()).getMass(); total += eTable.getElement(element.getName()).getMass() * element.getCount(); } } if(a.getIsotopeList() != null){ for(Name2Count isotope:a.getIsotopeList()){ isotope.getName(); if(eTable.getIsotope(isotope.getName()) == null){ throw new Error("Isotope " + isotope.getName() + " could not be found. " + "\r\nPlease ensure that its name is correct in AminoAcidComposition.xml and is defined in ElementMass.xml."); } eTable.getIsotope(isotope.getName()).getMass(); total += eTable.getIsotope(isotope.getName()).getMass() * isotope.getCount(); } } c = a.getSymbol().charAt(0); this.aaSymbol2MolecularWeight.put(c, total); } generatesAminoAcidCompoundSet(); } }
public class class_name { public void computeMolecularWeight(ElementTable eTable){ this.aaSymbol2MolecularWeight = new HashMap<Character, Double>(); for(AminoAcidComposition a:aminoacid){ //Check to ensure that the symbol is of single character if(a.getSymbol().length() != 1){ throw new Error(a.getSymbol() + " is not allowed. Symbols must be single character.\r\nPlease check AminoAcidComposition XML file"); } //Check to ensure that the symbols are not repeated char c = a.getSymbol().charAt(0); if(this.aaSymbol2MolecularWeight.keySet().contains(c)){ throw new Error("Symbol " + c + " is repeated.\r\n" + "Please check AminoAcidComposition XML file to ensure there are no repeated symbols. Note that this is case-insensitive.\r\n" + "This means that having 'A' and 'a' would be repeating."); } double total = 0.0; if(a.getElementList() != null){ for(Name2Count element:a.getElementList()){ element.getName(); // depends on control dependency: [for], data = [element] if(eTable.getElement(element.getName()) == null){ throw new Error("Element " + element.getName() + " could not be found. " + "\r\nPlease ensure that its name is correct in AminoAcidComposition.xml and is defined in ElementMass.xml."); } eTable.getElement(element.getName()).getMass(); total += eTable.getElement(element.getName()).getMass() * element.getCount(); } } if(a.getIsotopeList() != null){ for(Name2Count isotope:a.getIsotopeList()){ isotope.getName(); // depends on control dependency: [for], data = [isotope] if(eTable.getIsotope(isotope.getName()) == null){ throw new Error("Isotope " + isotope.getName() + " could not be found. " + "\r\nPlease ensure that its name is correct in AminoAcidComposition.xml and is defined in ElementMass.xml."); } eTable.getIsotope(isotope.getName()).getMass(); total += eTable.getIsotope(isotope.getName()).getMass() * isotope.getCount(); } } c = a.getSymbol().charAt(0); // depends on control dependency: [if], data = [none] this.aaSymbol2MolecularWeight.put(c, total); // depends on control dependency: [if], data = [none] } generatesAminoAcidCompoundSet(); // depends on control dependency: [if], data = [none] } }
public class class_name { public String getAlertTime(int index){ if(index < 0 || index >= alert.length ) return null; else { String out = ""; DateFormat dfm = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); dfm.setTimeZone(TimeZone.getTimeZone(timezone)); out = dfm.format( Long.parseLong(String.valueOf( alert[index].getTime() * 1000 ))); return out; } } }
public class class_name { public String getAlertTime(int index){ if(index < 0 || index >= alert.length ) return null; else { String out = ""; DateFormat dfm = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); dfm.setTimeZone(TimeZone.getTimeZone(timezone)); // depends on control dependency: [if], data = [none] out = dfm.format( Long.parseLong(String.valueOf( alert[index].getTime() * 1000 ))); // depends on control dependency: [if], data = [none] return out; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int getBuildVersion() { try { Properties props = new Properties(); props.load(ResourceLoader.getResourceAsStream("version")); int build = Integer.parseInt(props.getProperty("build")); Log.info("Slick Build #"+build); return build; } catch (Exception e) { Log.error("Unable to determine Slick build number"); return -1; } } }
public class class_name { public static int getBuildVersion() { try { Properties props = new Properties(); props.load(ResourceLoader.getResourceAsStream("version")); // depends on control dependency: [try], data = [none] int build = Integer.parseInt(props.getProperty("build")); Log.info("Slick Build #"+build); // depends on control dependency: [try], data = [none] return build; // depends on control dependency: [try], data = [none] } catch (Exception e) { Log.error("Unable to determine Slick build number"); return -1; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void preferenceChanged(View child, boolean width, boolean height) { if (parent != null) { parent.preferenceChanged(child, width, height); } } }
public class class_name { @Override public void preferenceChanged(View child, boolean width, boolean height) { if (parent != null) { parent.preferenceChanged(child, width, height); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void postTask( Runnable task ) { synchronized( _queue ) { _queue.add( task ); if( !isAlive() ) { start(); } _queue.notifyAll(); } } }
public class class_name { public void postTask( Runnable task ) { synchronized( _queue ) { _queue.add( task ); if( !isAlive() ) { start(); // depends on control dependency: [if], data = [none] } _queue.notifyAll(); } } }
public class class_name { private List<MonolingualTextValue> copyMonoLingualTextValues(Collection<MonolingualTextValue> monoLingualTextValues) { if (filter.excludeAllLanguages()) { return Collections.emptyList(); } List<MonolingualTextValue> result = new ArrayList<>(monoLingualTextValues.size()); for (MonolingualTextValue mtv : monoLingualTextValues) { if (filter.includeLanguage(mtv.getLanguageCode())) { result.add(copy(mtv)); } } return result; } }
public class class_name { private List<MonolingualTextValue> copyMonoLingualTextValues(Collection<MonolingualTextValue> monoLingualTextValues) { if (filter.excludeAllLanguages()) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } List<MonolingualTextValue> result = new ArrayList<>(monoLingualTextValues.size()); for (MonolingualTextValue mtv : monoLingualTextValues) { if (filter.includeLanguage(mtv.getLanguageCode())) { result.add(copy(mtv)); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public static Map<String, Map<String, Metadata>> parseAndPopulateMetadataMap(JsonObject jsonObject) { Map<String, Map<String, Metadata>> metadataMap = new HashMap<String, Map<String, Metadata>>(); //Parse all templates for (JsonObject.Member templateMember : jsonObject) { if (templateMember.getValue().isNull()) { continue; } else { String templateName = templateMember.getName(); Map<String, Metadata> scopeMap = metadataMap.get(templateName); //If templateName doesn't yet exist then create an entry with empty scope map if (scopeMap == null) { scopeMap = new HashMap<String, Metadata>(); metadataMap.put(templateName, scopeMap); } //Parse all scopes in a template for (JsonObject.Member scopeMember : templateMember.getValue().asObject()) { String scope = scopeMember.getName(); Metadata metadataObject = new Metadata(scopeMember.getValue().asObject()); scopeMap.put(scope, metadataObject); } } } return metadataMap; } }
public class class_name { public static Map<String, Map<String, Metadata>> parseAndPopulateMetadataMap(JsonObject jsonObject) { Map<String, Map<String, Metadata>> metadataMap = new HashMap<String, Map<String, Metadata>>(); //Parse all templates for (JsonObject.Member templateMember : jsonObject) { if (templateMember.getValue().isNull()) { continue; } else { String templateName = templateMember.getName(); Map<String, Metadata> scopeMap = metadataMap.get(templateName); //If templateName doesn't yet exist then create an entry with empty scope map if (scopeMap == null) { scopeMap = new HashMap<String, Metadata>(); // depends on control dependency: [if], data = [none] metadataMap.put(templateName, scopeMap); // depends on control dependency: [if], data = [none] } //Parse all scopes in a template for (JsonObject.Member scopeMember : templateMember.getValue().asObject()) { String scope = scopeMember.getName(); Metadata metadataObject = new Metadata(scopeMember.getValue().asObject()); scopeMap.put(scope, metadataObject); // depends on control dependency: [for], data = [none] } } } return metadataMap; } }
public class class_name { public static String[] getNames(Object object) { if (object == null) { return null; } Class<? extends Object> klass = object.getClass(); Field[] fields = klass.getFields(); int length = fields.length; if (length == 0) { return null; } String[] names = new String[length]; for (int i = 0; i < length; i += 1) { names[i] = fields[i].getName(); } return names; } }
public class class_name { public static String[] getNames(Object object) { if (object == null) { return null; // depends on control dependency: [if], data = [none] } Class<? extends Object> klass = object.getClass(); Field[] fields = klass.getFields(); int length = fields.length; if (length == 0) { return null; // depends on control dependency: [if], data = [none] } String[] names = new String[length]; for (int i = 0; i < length; i += 1) { names[i] = fields[i].getName(); // depends on control dependency: [for], data = [i] } return names; } }
public class class_name { @Override public void cleanup() { if (this.array == null) { // #cleanup may be called twice in case of exceptions // avoid calling #free twice return; } // https://docs.oracle.com/javase/tutorial/jdbc/basics/array.html#releasing_array try { this.array.free(); this.array = null; } catch (SQLException e) { throw new CleanupFailureDataAccessException("could not free array", e); } } }
public class class_name { @Override public void cleanup() { if (this.array == null) { // #cleanup may be called twice in case of exceptions // avoid calling #free twice return; // depends on control dependency: [if], data = [none] } // https://docs.oracle.com/javase/tutorial/jdbc/basics/array.html#releasing_array try { this.array.free(); // depends on control dependency: [try], data = [none] this.array = null; // depends on control dependency: [try], data = [none] } catch (SQLException e) { throw new CleanupFailureDataAccessException("could not free array", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<Future<?>> submitBackground(final ColumnFamilyStore cfs) { if (cfs.isAutoCompactionDisabled()) { logger.debug("Autocompaction is disabled"); return Collections.emptyList(); } int count = compactingCF.count(cfs); if (count > 0 && executor.getActiveCount() >= executor.getMaximumPoolSize()) { logger.debug("Background compaction is still running for {}.{} ({} remaining). Skipping", cfs.keyspace.getName(), cfs.name, count); return Collections.emptyList(); } logger.debug("Scheduling a background task check for {}.{} with {}", cfs.keyspace.getName(), cfs.name, cfs.getCompactionStrategy().getName()); List<Future<?>> futures = new ArrayList<Future<?>>(); // we must schedule it at least once, otherwise compaction will stop for a CF until next flush do { if (executor.isShutdown()) { logger.info("Executor has shut down, not submitting background task"); return Collections.emptyList(); } compactingCF.add(cfs); futures.add(executor.submit(new BackgroundCompactionTask(cfs))); // if we have room for more compactions, then fill up executor } while (executor.getActiveCount() + futures.size() < executor.getMaximumPoolSize()); return futures; } }
public class class_name { public List<Future<?>> submitBackground(final ColumnFamilyStore cfs) { if (cfs.isAutoCompactionDisabled()) { logger.debug("Autocompaction is disabled"); // depends on control dependency: [if], data = [none] return Collections.emptyList(); // depends on control dependency: [if], data = [none] } int count = compactingCF.count(cfs); if (count > 0 && executor.getActiveCount() >= executor.getMaximumPoolSize()) { logger.debug("Background compaction is still running for {}.{} ({} remaining). Skipping", cfs.keyspace.getName(), cfs.name, count); // depends on control dependency: [if], data = [none] return Collections.emptyList(); // depends on control dependency: [if], data = [none] } logger.debug("Scheduling a background task check for {}.{} with {}", cfs.keyspace.getName(), cfs.name, cfs.getCompactionStrategy().getName()); List<Future<?>> futures = new ArrayList<Future<?>>(); // we must schedule it at least once, otherwise compaction will stop for a CF until next flush do { if (executor.isShutdown()) { logger.info("Executor has shut down, not submitting background task"); // depends on control dependency: [if], data = [none] return Collections.emptyList(); // depends on control dependency: [if], data = [none] } compactingCF.add(cfs); futures.add(executor.submit(new BackgroundCompactionTask(cfs))); // if we have room for more compactions, then fill up executor } while (executor.getActiveCount() + futures.size() < executor.getMaximumPoolSize()); return futures; } }
public class class_name { public static Recipient[] toRecipient(String[] to) { Recipient[] addresses = new Recipient[to.length]; int i = 0; for (String t : to) { addresses[i++] = new Recipient(t); } return addresses; } }
public class class_name { public static Recipient[] toRecipient(String[] to) { Recipient[] addresses = new Recipient[to.length]; int i = 0; for (String t : to) { addresses[i++] = new Recipient(t); // depends on control dependency: [for], data = [t] } return addresses; } }
public class class_name { public static <K> double estimatePenalty(double l1, Map<K, Double> weights) { double penalty = 0.0; if(l1 > 0.0) { double sumAbsWeights = 0.0; for(double w : weights.values()) { sumAbsWeights += Math.abs(w); } penalty = l1*sumAbsWeights; } return penalty; } }
public class class_name { public static <K> double estimatePenalty(double l1, Map<K, Double> weights) { double penalty = 0.0; if(l1 > 0.0) { double sumAbsWeights = 0.0; for(double w : weights.values()) { sumAbsWeights += Math.abs(w); // depends on control dependency: [for], data = [w] } penalty = l1*sumAbsWeights; // depends on control dependency: [if], data = [none] } return penalty; } }
public class class_name { protected void remove(CmsUUID structureId, String rootPath, int type) { if (CmsResource.isTemporaryFileName(rootPath)) { return; } m_pathCache.remove(structureId); if (isSitemapConfiguration(rootPath, type)) { m_workQueue.add(structureId); } else if (isModuleConfiguration(rootPath, type)) { m_workQueue.add(ID_UPDATE_MODULES); } else if (isElementView(type)) { m_workQueue.add(ID_UPDATE_ELEMENT_VIEWS); } else if (m_state.getFolderTypes().containsKey(rootPath)) { m_workQueue.add(ID_UPDATE_FOLDERTYPES); } } }
public class class_name { protected void remove(CmsUUID structureId, String rootPath, int type) { if (CmsResource.isTemporaryFileName(rootPath)) { return; // depends on control dependency: [if], data = [none] } m_pathCache.remove(structureId); if (isSitemapConfiguration(rootPath, type)) { m_workQueue.add(structureId); // depends on control dependency: [if], data = [none] } else if (isModuleConfiguration(rootPath, type)) { m_workQueue.add(ID_UPDATE_MODULES); // depends on control dependency: [if], data = [none] } else if (isElementView(type)) { m_workQueue.add(ID_UPDATE_ELEMENT_VIEWS); // depends on control dependency: [if], data = [none] } else if (m_state.getFolderTypes().containsKey(rootPath)) { m_workQueue.add(ID_UPDATE_FOLDERTYPES); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void evaluateNormalCells(final Cell cell, final String strValue, final Map<String, Object> context, final ExpressionEngine engine) { if (strValue.contains(TieConstants.METHOD_PREFIX)) { Object evaluationResult = evaluate(strValue, context, engine); if (evaluationResult == null) { evaluationResult = ""; } CellUtility.setCellValue(cell, evaluationResult.toString()); createTieCell(cell, context, engine); } } }
public class class_name { public static void evaluateNormalCells(final Cell cell, final String strValue, final Map<String, Object> context, final ExpressionEngine engine) { if (strValue.contains(TieConstants.METHOD_PREFIX)) { Object evaluationResult = evaluate(strValue, context, engine); if (evaluationResult == null) { evaluationResult = ""; // depends on control dependency: [if], data = [none] } CellUtility.setCellValue(cell, evaluationResult.toString()); // depends on control dependency: [if], data = [none] createTieCell(cell, context, engine); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void initializeForTouchDevice() { logger.log(Level.FINE, "ZoomControl -> initializeForTouchDevice()"); // Add touch handlers to the zoom in button: zoomInElement.addDomHandler(new TouchStartHandler() { @Override public void onTouchStart(TouchStartEvent event) { event.stopPropagation(); event.preventDefault(); logger.log(Level.FINE, "ZoomControl -> zoomInElement onTouchStart()"); ViewPort viewPort = mapPresenter.getViewPort(); int index = viewPort.getResolutionIndex(viewPort.getResolution()); if (index < viewPort.getResolutionCount() - 1) { viewPort.applyResolution(viewPort.getResolution(index + 1)); viewPort.getPosition(); } } }, TouchStartEvent.getType()); // Add touch handlers to the zoom out button: zoomOutElement.addDomHandler(new TouchStartHandler() { @Override public void onTouchStart(TouchStartEvent event) { logger.log(Level.FINE, "zoomOutElement -> zoomInElement onTouchStart()"); event.stopPropagation(); event.preventDefault(); ViewPort viewPort = mapPresenter.getViewPort(); int index = viewPort.getResolutionIndex(viewPort.getResolution()); if (index > 0) { viewPort.applyResolution(viewPort.getResolution(index - 1)); } } }, TouchStartEvent.getType()); } }
public class class_name { private void initializeForTouchDevice() { logger.log(Level.FINE, "ZoomControl -> initializeForTouchDevice()"); // Add touch handlers to the zoom in button: zoomInElement.addDomHandler(new TouchStartHandler() { @Override public void onTouchStart(TouchStartEvent event) { event.stopPropagation(); event.preventDefault(); logger.log(Level.FINE, "ZoomControl -> zoomInElement onTouchStart()"); ViewPort viewPort = mapPresenter.getViewPort(); int index = viewPort.getResolutionIndex(viewPort.getResolution()); if (index < viewPort.getResolutionCount() - 1) { viewPort.applyResolution(viewPort.getResolution(index + 1)); // depends on control dependency: [if], data = [(index] viewPort.getPosition(); // depends on control dependency: [if], data = [none] } } }, TouchStartEvent.getType()); // Add touch handlers to the zoom out button: zoomOutElement.addDomHandler(new TouchStartHandler() { @Override public void onTouchStart(TouchStartEvent event) { logger.log(Level.FINE, "zoomOutElement -> zoomInElement onTouchStart()"); event.stopPropagation(); event.preventDefault(); ViewPort viewPort = mapPresenter.getViewPort(); int index = viewPort.getResolutionIndex(viewPort.getResolution()); if (index > 0) { viewPort.applyResolution(viewPort.getResolution(index - 1)); // depends on control dependency: [if], data = [(index] } } }, TouchStartEvent.getType()); } }
public class class_name { @Override protected boolean updateDerivates() { functionGradientHessian(x,sameStateAsCost,gradient,hessian); if( config.hessianScaling ) { computeHessianScaling(); applyHessianScaling(); } // Convergence should be tested on scaled variables to remove their arbitrary natural scale // from influencing convergence if( checkConvergenceGTest(gradient)) { if( verbose != null ) { verbose.println("Converged g-test"); } return true; } gradientNorm = NormOps_DDRM.normF(gradient); if(UtilEjml.isUncountable(gradientNorm)) throw new OptimizationException("Uncountable. gradientNorm="+gradientNorm); parameterUpdate.initializeUpdate(); return false; } }
public class class_name { @Override protected boolean updateDerivates() { functionGradientHessian(x,sameStateAsCost,gradient,hessian); if( config.hessianScaling ) { computeHessianScaling(); // depends on control dependency: [if], data = [none] applyHessianScaling(); // depends on control dependency: [if], data = [none] } // Convergence should be tested on scaled variables to remove their arbitrary natural scale // from influencing convergence if( checkConvergenceGTest(gradient)) { if( verbose != null ) { verbose.println("Converged g-test"); // depends on control dependency: [if], data = [none] } return true; // depends on control dependency: [if], data = [none] } gradientNorm = NormOps_DDRM.normF(gradient); if(UtilEjml.isUncountable(gradientNorm)) throw new OptimizationException("Uncountable. gradientNorm="+gradientNorm); parameterUpdate.initializeUpdate(); return false; } }
public class class_name { protected int addOriginalDocument(String text) { if(noMoreAdding) throw new RuntimeException("Initial data set has been finalized"); StringBuilder localWorkSpace = workSpace.get(); List<String> localStorageSpace = storageSpace.get(); Map<String, Integer> localWordCounts = wordCounts.get(); if(localWorkSpace == null) { localWorkSpace = new StringBuilder(); localStorageSpace = new ArrayList<String>(); localWordCounts = new LinkedHashMap<String, Integer>(); workSpace.set(localWorkSpace); storageSpace.set(localStorageSpace); wordCounts.set(localWordCounts); } localWorkSpace.setLength(0); localStorageSpace.clear(); localWordCounts.clear(); tokenizer.tokenize(text, localWorkSpace, localStorageSpace); for(String word : localStorageSpace) { Integer count = localWordCounts.get(word); if(count == null) localWordCounts.put(word, 1); else localWordCounts.put(word, count+1); } SparseVector vec = new SparseVector(currentLength.get()+1, localWordCounts.size());//+1 to avoid issues when its length is zero, will be corrected in finalization step anyway for(Iterator<Map.Entry<String, Integer>> iter = localWordCounts.entrySet().iterator(); iter.hasNext();) { Map.Entry<String, Integer> entry = iter.next(); String word = entry.getKey(); int ms_to_sleep = 1; while(!addWord(word, vec, entry.getValue()))//try in a loop, expoential back off { try { Thread.sleep(ms_to_sleep); ms_to_sleep = Math.min(100, ms_to_sleep*2); } catch (InterruptedException ex) { Logger.getLogger(TextDataLoader.class.getName()).log(Level.SEVERE, null, ex); } } } localWordCounts.clear(); synchronized(vectors) { vectors.add(vec); return documents++; } } }
public class class_name { protected int addOriginalDocument(String text) { if(noMoreAdding) throw new RuntimeException("Initial data set has been finalized"); StringBuilder localWorkSpace = workSpace.get(); List<String> localStorageSpace = storageSpace.get(); Map<String, Integer> localWordCounts = wordCounts.get(); if(localWorkSpace == null) { localWorkSpace = new StringBuilder(); // depends on control dependency: [if], data = [none] localStorageSpace = new ArrayList<String>(); // depends on control dependency: [if], data = [none] localWordCounts = new LinkedHashMap<String, Integer>(); // depends on control dependency: [if], data = [none] workSpace.set(localWorkSpace); // depends on control dependency: [if], data = [(localWorkSpace] storageSpace.set(localStorageSpace); // depends on control dependency: [if], data = [none] wordCounts.set(localWordCounts); // depends on control dependency: [if], data = [none] } localWorkSpace.setLength(0); localStorageSpace.clear(); localWordCounts.clear(); tokenizer.tokenize(text, localWorkSpace, localStorageSpace); for(String word : localStorageSpace) { Integer count = localWordCounts.get(word); if(count == null) localWordCounts.put(word, 1); else localWordCounts.put(word, count+1); } SparseVector vec = new SparseVector(currentLength.get()+1, localWordCounts.size());//+1 to avoid issues when its length is zero, will be corrected in finalization step anyway for(Iterator<Map.Entry<String, Integer>> iter = localWordCounts.entrySet().iterator(); iter.hasNext();) { Map.Entry<String, Integer> entry = iter.next(); String word = entry.getKey(); int ms_to_sleep = 1; while(!addWord(word, vec, entry.getValue()))//try in a loop, expoential back off { try { Thread.sleep(ms_to_sleep); // depends on control dependency: [try], data = [none] ms_to_sleep = Math.min(100, ms_to_sleep*2); // depends on control dependency: [try], data = [none] } catch (InterruptedException ex) { Logger.getLogger(TextDataLoader.class.getName()).log(Level.SEVERE, null, ex); } // depends on control dependency: [catch], data = [none] } } localWordCounts.clear(); synchronized(vectors) { vectors.add(vec); return documents++; } } }
public class class_name { static int countLineBreaks(String s) { int pos = -1; int count = 0; while (true) { int nextPos = s.indexOf('\n', pos + 1); if (nextPos == -1) { break; } pos = nextPos; count++; } return count; } }
public class class_name { static int countLineBreaks(String s) { int pos = -1; int count = 0; while (true) { int nextPos = s.indexOf('\n', pos + 1); if (nextPos == -1) { break; } pos = nextPos; // depends on control dependency: [while], data = [none] count++; // depends on control dependency: [while], data = [none] } return count; } }
public class class_name { public KeyArea setupKey(int iKeyArea) { KeyArea keyArea = null; if (iKeyArea == 0) { keyArea = this.makeIndex(DBConstants.UNIQUE, ID_KEY); keyArea.addKeyField(ID, DBConstants.ASCENDING); } if (iKeyArea == 1) { keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, CLASS_INFO_CLASS_NAME_KEY); keyArea.addKeyField(CLASS_INFO_CLASS_NAME, DBConstants.ASCENDING); keyArea.addKeyField(CLASS_FIELD_SEQUENCE, DBConstants.ASCENDING); keyArea.addKeyField(CLASS_FIELD_NAME, DBConstants.ASCENDING); } if (keyArea == null) keyArea = super.setupKey(iKeyArea); return keyArea; } }
public class class_name { public KeyArea setupKey(int iKeyArea) { KeyArea keyArea = null; if (iKeyArea == 0) { keyArea = this.makeIndex(DBConstants.UNIQUE, ID_KEY); // depends on control dependency: [if], data = [none] keyArea.addKeyField(ID, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none] } if (iKeyArea == 1) { keyArea = this.makeIndex(DBConstants.NOT_UNIQUE, CLASS_INFO_CLASS_NAME_KEY); // depends on control dependency: [if], data = [none] keyArea.addKeyField(CLASS_INFO_CLASS_NAME, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none] keyArea.addKeyField(CLASS_FIELD_SEQUENCE, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none] keyArea.addKeyField(CLASS_FIELD_NAME, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none] } if (keyArea == null) keyArea = super.setupKey(iKeyArea); return keyArea; } }
public class class_name { private float calculateCenterOffsetForPage(int pageNb) { if (swipeVertical) { float imageY = -(pageNb * optimalPageHeight); imageY += getHeight() / 2 - optimalPageHeight / 2; return imageY; } else { float imageX = -(pageNb * optimalPageWidth); imageX += getWidth() / 2 - optimalPageWidth / 2; return imageX; } } }
public class class_name { private float calculateCenterOffsetForPage(int pageNb) { if (swipeVertical) { float imageY = -(pageNb * optimalPageHeight); imageY += getHeight() / 2 - optimalPageHeight / 2; // depends on control dependency: [if], data = [none] return imageY; // depends on control dependency: [if], data = [none] } else { float imageX = -(pageNb * optimalPageWidth); imageX += getWidth() / 2 - optimalPageWidth / 2; // depends on control dependency: [if], data = [none] return imageX; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override @SuppressWarnings("UnusedParameters") public boolean putFromLoad(Object session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) throws CacheException { if ( !region.checkValid() ) { if (trace) { log.tracef( "Region %s not valid", region.getName() ); } return false; } // In theory, since putForExternalRead is already as minimal as it can // get, we shouldn't be need this check. However, without the check and // without https://issues.jboss.org/browse/ISPN-1986, it's impossible to // know whether the put actually occurred. Knowing this is crucial so // that Hibernate can expose accurate statistics. if ( minimalPutOverride && cache.containsKey( key ) ) { return false; } PutFromLoadValidator.Lock lock = putValidator.acquirePutFromLoadLock(session, key, txTimestamp); if ( lock == null) { if (trace) { log.tracef( "Put from load lock not acquired for key %s", key ); } return false; } try { writeCache.putForExternalRead( key, value ); } finally { putValidator.releasePutFromLoadLock( key, lock); } return true; } }
public class class_name { @Override @SuppressWarnings("UnusedParameters") public boolean putFromLoad(Object session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) throws CacheException { if ( !region.checkValid() ) { if (trace) { log.tracef( "Region %s not valid", region.getName() ); // depends on control dependency: [if], data = [none] } return false; } // In theory, since putForExternalRead is already as minimal as it can // get, we shouldn't be need this check. However, without the check and // without https://issues.jboss.org/browse/ISPN-1986, it's impossible to // know whether the put actually occurred. Knowing this is crucial so // that Hibernate can expose accurate statistics. if ( minimalPutOverride && cache.containsKey( key ) ) { return false; } PutFromLoadValidator.Lock lock = putValidator.acquirePutFromLoadLock(session, key, txTimestamp); if ( lock == null) { if (trace) { log.tracef( "Put from load lock not acquired for key %s", key ); } return false; } try { writeCache.putForExternalRead( key, value ); } finally { putValidator.releasePutFromLoadLock( key, lock); } return true; } }
public class class_name { @Override public void waveFailed(final Wave wave) { if (wave.relatedWave() != null) { // Return wave has failed, so the triggered wave must be marked as failed too LOGGER.log(RELATED_WAVE_HAS_FAILED, wave.componentClass().getSimpleName(), wave.relatedWave().toString()); wave.relatedWave().status(Status.Failed); } } }
public class class_name { @Override public void waveFailed(final Wave wave) { if (wave.relatedWave() != null) { // Return wave has failed, so the triggered wave must be marked as failed too LOGGER.log(RELATED_WAVE_HAS_FAILED, wave.componentClass().getSimpleName(), wave.relatedWave().toString()); // depends on control dependency: [if], data = [none] wave.relatedWave().status(Status.Failed); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void bodyConsumerFinish() { BodyConsumer consumer = bodyConsumer; bodyConsumer = null; try { consumer.finished(responder); } catch (Throwable t) { exceptionHandler.handle(t, request, responder); } } }
public class class_name { private void bodyConsumerFinish() { BodyConsumer consumer = bodyConsumer; bodyConsumer = null; try { consumer.finished(responder); // depends on control dependency: [try], data = [none] } catch (Throwable t) { exceptionHandler.handle(t, request, responder); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static final byte getByteWithBitSet (final byte b, final int bitNumber, final boolean value) { int number = b; if (value) { // make sure bit is set to true int mask = 1; mask <<= bitNumber; number |= mask; } else { int mask = 1; mask <<= bitNumber; mask ^= 255;// flip bits number &= mask; } return (byte) number; } }
public class class_name { public static final byte getByteWithBitSet (final byte b, final int bitNumber, final boolean value) { int number = b; if (value) { // make sure bit is set to true int mask = 1; mask <<= bitNumber; // depends on control dependency: [if], data = [none] number |= mask; // depends on control dependency: [if], data = [none] } else { int mask = 1; mask <<= bitNumber; // depends on control dependency: [if], data = [none] mask ^= 255;// flip bits // depends on control dependency: [if], data = [none] number &= mask; // depends on control dependency: [if], data = [none] } return (byte) number; } }
public class class_name { public static String getParametersAsString(final Object... parameters) { if (parameters == null || parameters.length == 0) { return ""; } final StringBuilder builder = new StringBuilder(); builder.append('['); for (int i = 0; i < parameters.length; i++) { builder.append(arrayToString(parameters[i])); if (i < parameters.length - 1) { builder.append(", "); } } return builder.append(']').toString(); } }
public class class_name { public static String getParametersAsString(final Object... parameters) { if (parameters == null || parameters.length == 0) { return ""; // depends on control dependency: [if], data = [none] } final StringBuilder builder = new StringBuilder(); builder.append('['); for (int i = 0; i < parameters.length; i++) { builder.append(arrayToString(parameters[i])); // depends on control dependency: [for], data = [i] if (i < parameters.length - 1) { builder.append(", "); // depends on control dependency: [if], data = [none] } } return builder.append(']').toString(); } }
public class class_name { public static JCas getInitialView(JCas jCas) { try { return jCas.getView(INITIAL_VIEW); } catch (CASException e) { throw new IllegalStateException(e); } } }
public class class_name { public static JCas getInitialView(JCas jCas) { try { return jCas.getView(INITIAL_VIEW); // depends on control dependency: [try], data = [none] } catch (CASException e) { throw new IllegalStateException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String[] toArray( final String source, final String delim, final boolean returnDelims ) { List<String> tmp = toList( source, delim, returnDelims ); String[] result = new String[tmp.size()]; int index = 0; for ( String str : tmp ) { result[index++] = str; } return result; } }
public class class_name { public static String[] toArray( final String source, final String delim, final boolean returnDelims ) { List<String> tmp = toList( source, delim, returnDelims ); String[] result = new String[tmp.size()]; int index = 0; for ( String str : tmp ) { result[index++] = str; // depends on control dependency: [for], data = [str] } return result; } }
public class class_name { @Nullable public static Integer parseIntObj (@Nullable final String sStr, @Nonnegative final int nRadix, @Nullable final Integer aDefault) { if (sStr != null && sStr.length () > 0) try { return Integer.valueOf (sStr, nRadix); } catch (final NumberFormatException ex) { // Fall through } return aDefault; } }
public class class_name { @Nullable public static Integer parseIntObj (@Nullable final String sStr, @Nonnegative final int nRadix, @Nullable final Integer aDefault) { if (sStr != null && sStr.length () > 0) try { return Integer.valueOf (sStr, nRadix); // depends on control dependency: [try], data = [none] } catch (final NumberFormatException ex) { // Fall through } // depends on control dependency: [catch], data = [none] return aDefault; } }
public class class_name { public static double dotDense(NumberVector v1, NumberVector v2) { final int dim1 = v1.getDimensionality(), dim2 = v2.getDimensionality(); final int mindim = (dim1 <= dim2) ? dim1 : dim2; double dot = 0; for(int k = 0; k < mindim; k++) { dot += v1.doubleValue(k) * v2.doubleValue(k); } return dot; } }
public class class_name { public static double dotDense(NumberVector v1, NumberVector v2) { final int dim1 = v1.getDimensionality(), dim2 = v2.getDimensionality(); final int mindim = (dim1 <= dim2) ? dim1 : dim2; double dot = 0; for(int k = 0; k < mindim; k++) { dot += v1.doubleValue(k) * v2.doubleValue(k); // depends on control dependency: [for], data = [k] } return dot; } }
public class class_name { public static RegexpMatcher getMatcher( String pattern, boolean multiline ) { if( isJDK13() ){ return new Perl5RegexpMatcher( pattern, true ); }else{ return new JdkRegexpMatcher( pattern, true ); } } }
public class class_name { public static RegexpMatcher getMatcher( String pattern, boolean multiline ) { if( isJDK13() ){ return new Perl5RegexpMatcher( pattern, true ); // depends on control dependency: [if], data = [none] }else{ return new JdkRegexpMatcher( pattern, true ); // depends on control dependency: [if], data = [none] } } }
public class class_name { public final void postComplete(final PersistentTransaction transaction, final boolean committed) throws SevereMessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "postComplete", "Transaction=" + transaction + ", Committed=" + committed); if (committed) { if (STATE_END_COMMIT == _state) { // normal course } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "postComplete"); throw new TaskListException(_state); } _state = STATE_BEGIN_POSTCOMMIT; } else { if (STATE_BEGIN_ABORT == _state) { // blew up in our rollback } else if (STATE_END_ABORT == _state) { // blew up in someone elses rollback - after ours } else if (STATE_END_PRECOMMIT == _state) { // blew up in the persistence layers commit } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "postComplete"); throw new TaskListException(_state); } _state = STATE_BEGIN_POSTABORT; } if (committed) { Task task = _firstTask; while (null != task) { task.postCommit(transaction); task = task._nextTask; } } else { Task task = _firstTask; while (null != task) { task.postAbort(transaction); task = task._nextTask; } } if (committed) { _state = STATE_END_POSTCOMMIT; } else { _state = STATE_END_POSTABORT; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "postComplete"); } }
public class class_name { public final void postComplete(final PersistentTransaction transaction, final boolean committed) throws SevereMessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "postComplete", "Transaction=" + transaction + ", Committed=" + committed); if (committed) { if (STATE_END_COMMIT == _state) { // normal course } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "postComplete"); throw new TaskListException(_state); } _state = STATE_BEGIN_POSTCOMMIT; } else { if (STATE_BEGIN_ABORT == _state) { // blew up in our rollback } else if (STATE_END_ABORT == _state) { // blew up in someone elses rollback - after ours } else if (STATE_END_PRECOMMIT == _state) { // blew up in the persistence layers commit } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "postComplete"); throw new TaskListException(_state); } _state = STATE_BEGIN_POSTABORT; } if (committed) { Task task = _firstTask; while (null != task) { task.postCommit(transaction); // depends on control dependency: [while], data = [none] task = task._nextTask; // depends on control dependency: [while], data = [none] } } else { Task task = _firstTask; while (null != task) { task.postAbort(transaction); // depends on control dependency: [while], data = [none] task = task._nextTask; // depends on control dependency: [while], data = [none] } } if (committed) { _state = STATE_END_POSTCOMMIT; } else { _state = STATE_END_POSTABORT; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "postComplete"); } }
public class class_name { private void fixForce() { final double minH; final double minV; final double maxH; final double maxV; if (directionMin == null) { minH = fh; minV = fv; } else { minH = directionMin.getDirectionHorizontal(); minV = directionMin.getDirectionVertical(); } if (directionMax == null) { maxH = fh; maxV = fv; } else { maxH = directionMax.getDirectionHorizontal(); maxV = directionMax.getDirectionVertical(); } fh = UtilMath.clamp(fh, minH, maxH); fv = UtilMath.clamp(fv, minV, maxV); } }
public class class_name { private void fixForce() { final double minH; final double minV; final double maxH; final double maxV; if (directionMin == null) { minH = fh; // depends on control dependency: [if], data = [none] minV = fv; // depends on control dependency: [if], data = [none] } else { minH = directionMin.getDirectionHorizontal(); // depends on control dependency: [if], data = [none] minV = directionMin.getDirectionVertical(); // depends on control dependency: [if], data = [none] } if (directionMax == null) { maxH = fh; // depends on control dependency: [if], data = [none] maxV = fv; // depends on control dependency: [if], data = [none] } else { maxH = directionMax.getDirectionHorizontal(); // depends on control dependency: [if], data = [none] maxV = directionMax.getDirectionVertical(); // depends on control dependency: [if], data = [none] } fh = UtilMath.clamp(fh, minH, maxH); fv = UtilMath.clamp(fv, minV, maxV); } }
public class class_name { protected final Split stopStopwatch() { HandlerLocation location = threadLocation.get(); Split split = null; if (location != null) { split = location.getSplit(); split.stop(); location.setSplit(null); } return split; } }
public class class_name { protected final Split stopStopwatch() { HandlerLocation location = threadLocation.get(); Split split = null; if (location != null) { split = location.getSplit(); // depends on control dependency: [if], data = [none] split.stop(); // depends on control dependency: [if], data = [none] location.setSplit(null); // depends on control dependency: [if], data = [null)] } return split; } }
public class class_name { private Object executeImmutableTransaction(ManagedMethodSPI managedMethod, Object[] args) throws Throwable { Transaction transaction = transactionalResource.createReadOnlyTransaction(); // see mutable transaction comment transactionalResource.storeSession(transaction.getSession()); try { Object result = managedMethod.invoke(managedInstance, args); if (transaction.unused()) { log.debug("Method |%s| superfluously declared transactional.", managedMethod); } return result; } catch (Throwable throwable) { throw throwable(throwable, "Immutable transactional method |%s| invocation fail.", managedMethod); } finally { if (transaction.close()) { // see mutable transaction comment transactionalResource.releaseSession(); } } } }
public class class_name { private Object executeImmutableTransaction(ManagedMethodSPI managedMethod, Object[] args) throws Throwable { Transaction transaction = transactionalResource.createReadOnlyTransaction(); // see mutable transaction comment transactionalResource.storeSession(transaction.getSession()); try { Object result = managedMethod.invoke(managedInstance, args); if (transaction.unused()) { log.debug("Method |%s| superfluously declared transactional.", managedMethod); // depends on control dependency: [if], data = [none] } return result; } catch (Throwable throwable) { throw throwable(throwable, "Immutable transactional method |%s| invocation fail.", managedMethod); } finally { if (transaction.close()) { // see mutable transaction comment transactionalResource.releaseSession(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public CloudSdkVersion getVersion() throws CloudSdkVersionFileException { Path versionFile = getPath().resolve(VERSION_FILE_NAME); if (!Files.isRegularFile(versionFile)) { throw new CloudSdkVersionFileNotFoundException( "Cloud SDK version file not found at " + versionFile.toString()); } String contents = ""; try { List<String> lines = Files.readAllLines(versionFile, StandardCharsets.UTF_8); if (lines.size() > 0) { // expect only a single line contents = lines.get(0); } return new CloudSdkVersion(contents); } catch (IOException ex) { throw new CloudSdkVersionFileException(ex); } catch (IllegalArgumentException ex) { throw new CloudSdkVersionFileParseException( "Pattern found in the Cloud SDK version file could not be parsed: " + contents, ex); } } }
public class class_name { public CloudSdkVersion getVersion() throws CloudSdkVersionFileException { Path versionFile = getPath().resolve(VERSION_FILE_NAME); if (!Files.isRegularFile(versionFile)) { throw new CloudSdkVersionFileNotFoundException( "Cloud SDK version file not found at " + versionFile.toString()); } String contents = ""; try { List<String> lines = Files.readAllLines(versionFile, StandardCharsets.UTF_8); if (lines.size() > 0) { // expect only a single line contents = lines.get(0); // depends on control dependency: [if], data = [0)] } return new CloudSdkVersion(contents); } catch (IOException ex) { throw new CloudSdkVersionFileException(ex); } catch (IllegalArgumentException ex) { throw new CloudSdkVersionFileParseException( "Pattern found in the Cloud SDK version file could not be parsed: " + contents, ex); } } }
public class class_name { public void addPackageContent(Content contentTree, Content packageContentTree) { if (configuration.allowTag(HtmlTag.MAIN)) { packageContentTree.addContent(sectionTree); mainTree.addContent(packageContentTree); contentTree.addContent(mainTree); } else { contentTree.addContent(packageContentTree); } } }
public class class_name { public void addPackageContent(Content contentTree, Content packageContentTree) { if (configuration.allowTag(HtmlTag.MAIN)) { packageContentTree.addContent(sectionTree); // depends on control dependency: [if], data = [none] mainTree.addContent(packageContentTree); // depends on control dependency: [if], data = [none] contentTree.addContent(mainTree); // depends on control dependency: [if], data = [none] } else { contentTree.addContent(packageContentTree); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public byte[] load(Value v) { long skip = 0; Key k = v._key; // Convert a chunk into a long-offset from the base file. if( k._kb[0] == Key.DVEC ) skip = water.fvec.NFSFileVec.chunkOffset(k); // The offset try { FileInputStream s = null; try { s = new FileInputStream(getFileForKey(k)); FileChannel fc = s.getChannel(); fc.position(skip); AutoBuffer ab = new AutoBuffer(fc, true, Value.NFS); byte[] b = ab.getA1(v._max); ab.close(); assert v.isPersisted(); return b; } finally { if( s != null ) s.close(); } } catch( IOException e ) { // Broken disk / short-file??? H2O.ignore(e); return null; } } }
public class class_name { @Override public byte[] load(Value v) { long skip = 0; Key k = v._key; // Convert a chunk into a long-offset from the base file. if( k._kb[0] == Key.DVEC ) skip = water.fvec.NFSFileVec.chunkOffset(k); // The offset try { FileInputStream s = null; try { s = new FileInputStream(getFileForKey(k)); // depends on control dependency: [try], data = [none] FileChannel fc = s.getChannel(); fc.position(skip); // depends on control dependency: [try], data = [none] AutoBuffer ab = new AutoBuffer(fc, true, Value.NFS); byte[] b = ab.getA1(v._max); ab.close(); // depends on control dependency: [try], data = [none] assert v.isPersisted(); return b; // depends on control dependency: [try], data = [none] } finally { if( s != null ) s.close(); } } catch( IOException e ) { // Broken disk / short-file??? H2O.ignore(e); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void reloadProperties() { Properties temp = new Properties(); BufferedReader bufferedReader = null; try { File properties = new File(propertiesPath); bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(properties), "UTF8")); temp.load(bufferedReader); this.properties = temp; listeners.removeIf(weakReference -> weakReference.get() == null); listeners.forEach(weakReference -> { Consumer<PropertiesAssistant> consumer = weakReference.get(); if (consumer != null) consumer.accept(this); }); } catch (IOException e) { error("Error while trying to load the Properties-File: " + propertiesPath, e); } finally { if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { error("Unable to close input stream", e); } } } } }
public class class_name { private void reloadProperties() { Properties temp = new Properties(); BufferedReader bufferedReader = null; try { File properties = new File(propertiesPath); bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(properties), "UTF8")); // depends on control dependency: [try], data = [none] temp.load(bufferedReader); // depends on control dependency: [try], data = [none] this.properties = temp; // depends on control dependency: [try], data = [none] listeners.removeIf(weakReference -> weakReference.get() == null); // depends on control dependency: [try], data = [none] listeners.forEach(weakReference -> { Consumer<PropertiesAssistant> consumer = weakReference.get(); // depends on control dependency: [try], data = [none] if (consumer != null) consumer.accept(this); }); } catch (IOException e) { error("Error while trying to load the Properties-File: " + propertiesPath, e); } finally { // depends on control dependency: [catch], data = [none] if (bufferedReader != null) { try { bufferedReader.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { error("Unable to close input stream", e); } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { public void growArray( int amountBits , boolean saveValue ) { size = size+amountBits; int N = size/8 + (size%8==0?0:1); if( N > data.length ) { // add in some buffer to avoid lots of calls to new int extra = Math.min(1024,N+10); byte[] tmp = new byte[N+extra]; if( saveValue ) System.arraycopy(data,0,tmp,0,data.length); this.data = tmp; } } }
public class class_name { public void growArray( int amountBits , boolean saveValue ) { size = size+amountBits; int N = size/8 + (size%8==0?0:1); if( N > data.length ) { // add in some buffer to avoid lots of calls to new int extra = Math.min(1024,N+10); byte[] tmp = new byte[N+extra]; if( saveValue ) System.arraycopy(data,0,tmp,0,data.length); this.data = tmp; // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<JAXBElement<Object>> get_GenericApplicationPropertyOfOpening() { if (_GenericApplicationPropertyOfOpening == null) { _GenericApplicationPropertyOfOpening = new ArrayList<JAXBElement<Object>>(); } return this._GenericApplicationPropertyOfOpening; } }
public class class_name { public List<JAXBElement<Object>> get_GenericApplicationPropertyOfOpening() { if (_GenericApplicationPropertyOfOpening == null) { _GenericApplicationPropertyOfOpening = new ArrayList<JAXBElement<Object>>(); // depends on control dependency: [if], data = [none] } return this._GenericApplicationPropertyOfOpening; } }
public class class_name { private void assignUniqueLabel(Package pack, Package targetPackage) { Set<String> existingLabels; if (targetPackage != null) { existingLabels = stream(targetPackage.getChildren()).map(Package::getLabel).collect(toSet()); } else { existingLabels = dataService .query(PACKAGE, Package.class) .eq(PackageMetadata.PARENT, null) .findAll() .map(Package::getLabel) .collect(toSet()); } pack.setLabel(generateUniqueLabel(pack.getLabel(), existingLabels)); } }
public class class_name { private void assignUniqueLabel(Package pack, Package targetPackage) { Set<String> existingLabels; if (targetPackage != null) { existingLabels = stream(targetPackage.getChildren()).map(Package::getLabel).collect(toSet()); // depends on control dependency: [if], data = [(targetPackage] } else { existingLabels = dataService .query(PACKAGE, Package.class) .eq(PackageMetadata.PARENT, null) .findAll() .map(Package::getLabel) .collect(toSet()); // depends on control dependency: [if], data = [none] } pack.setLabel(generateUniqueLabel(pack.getLabel(), existingLabels)); } }
public class class_name { public Future<Void> waitUntilReadyFuture() { try { return getRegistryRemote().waitUntilReadyFuture(); } catch (NotAvailableException ex) { return FutureProcessor.canceledFuture(null, ex); } } }
public class class_name { public Future<Void> waitUntilReadyFuture() { try { return getRegistryRemote().waitUntilReadyFuture(); // depends on control dependency: [try], data = [none] } catch (NotAvailableException ex) { return FutureProcessor.canceledFuture(null, ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public int checkAccess(String path) { timeLastAccessed = System.currentTimeMillis(); int result = UNDEFINED; String myUA = config.getUserAgentName(); boolean ignoreUADisc = config.getIgnoreUADiscrimination(); // When checking rules, the list of rules is already ordered based on the // match of the user-agent of the clause with the user-agent of the crawler. // The most specific match should come first. // // Only the most specific match is obeyed, unless ignoreUADiscrimination is // enabled. In that case, any matching non-wildcard clause that explicitly // disallows the path is obeyed. If no such rule exists and any UA in the list // is allowed access, that rule is obeyed. for (UserAgentDirectives ua : rules) { int score = ua.match(myUA); // If ignoreUADisc is disabled and the current UA doesn't match, // the rest will not match so we are done here. if (score == 0 && !ignoreUADisc) { break; } // Match the rule to the path result = ua.checkAccess(path, userAgent); // If the result is ALLOWED or UNDEFINED, or if // this is a wildcard rule and ignoreUADisc is disabled, // this is the final verdict. if (result != DISALLOWED || (!ua.isWildcard() || !ignoreUADisc)) { break; } // This is a wildcard rule that disallows access. The verdict is stored, // but the other rules will also be checked to see if any specific UA is allowed // access to this path. If so, that positive UA discrimination is ignored // and we crawl the page anyway. } return result; } }
public class class_name { public int checkAccess(String path) { timeLastAccessed = System.currentTimeMillis(); int result = UNDEFINED; String myUA = config.getUserAgentName(); boolean ignoreUADisc = config.getIgnoreUADiscrimination(); // When checking rules, the list of rules is already ordered based on the // match of the user-agent of the clause with the user-agent of the crawler. // The most specific match should come first. // // Only the most specific match is obeyed, unless ignoreUADiscrimination is // enabled. In that case, any matching non-wildcard clause that explicitly // disallows the path is obeyed. If no such rule exists and any UA in the list // is allowed access, that rule is obeyed. for (UserAgentDirectives ua : rules) { int score = ua.match(myUA); // If ignoreUADisc is disabled and the current UA doesn't match, // the rest will not match so we are done here. if (score == 0 && !ignoreUADisc) { break; } // Match the rule to the path result = ua.checkAccess(path, userAgent); // depends on control dependency: [for], data = [ua] // If the result is ALLOWED or UNDEFINED, or if // this is a wildcard rule and ignoreUADisc is disabled, // this is the final verdict. if (result != DISALLOWED || (!ua.isWildcard() || !ignoreUADisc)) { break; } // This is a wildcard rule that disallows access. The verdict is stored, // but the other rules will also be checked to see if any specific UA is allowed // access to this path. If so, that positive UA discrimination is ignored // and we crawl the page anyway. } return result; } }
public class class_name { @Override public void remove(Object cacheKey) { if (cacheKey != null) { CacheObject cacheObject = getCachedObject(cacheKey); if (cacheObject != null) { removeCachedObject(cacheObject); } } } }
public class class_name { @Override public void remove(Object cacheKey) { if (cacheKey != null) { CacheObject cacheObject = getCachedObject(cacheKey); if (cacheObject != null) { removeCachedObject(cacheObject); // depends on control dependency: [if], data = [(cacheObject] } } } }
public class class_name { public int fasthdlc_rx_run(HdlcState h) { int next; int retval = RETURN_EMPTY_FLAG; while ((h.bits >= minbits[h.state]) && (retval == RETURN_EMPTY_FLAG)) { /* * Run until we can no longer be assured that we will have enough bits to continue */ switch (h.state) { case FRAME_SEARCH: /* * Look for an HDLC frame, keying from the top byte. */ next = hdlc_search[(h.data >> 24) & 0xff]; h.bits -= next & 0x0f; h.data <<= next & 0x0f; h.state = (next >> 4) & 0xff; h.ones = 0; break; case PROCESS_FRAME: /* Process as much as the next ten bits */ next = hdlc_frame[h.ones][(h.data >>> 22) & 0x3ff]; // Must be 10 bits here, not 8, that's all // next = hdlc_frame_precalc(h.ones, (h.data >> 22)& 0x3ff); h.bits -= (((next & 0x0f00) >> 8) & 0xff); h.data <<= (((next & 0x0f00) >> 8) & 0xff); h.state = ((next & STATE_MASK) >> 15) & 0xff; h.ones = (((next & ONES_MASK) >> 12) & 0xff); switch (next & STATUS_MASK) { case STATUS_CONTROL: if ((next & CONTROL_COMPLETE) != 0) { /* A complete, valid frame received */ retval = (RETURN_COMPLETE_FLAG); /* Stay in this state */ h.state = 1; } else { /* An abort (either out of sync of explicit) */ retval = (RETURN_DISCARD_FLAG); } break; case STATUS_VALID: retval = (next & DATA_MASK); } } } return retval; } }
public class class_name { public int fasthdlc_rx_run(HdlcState h) { int next; int retval = RETURN_EMPTY_FLAG; while ((h.bits >= minbits[h.state]) && (retval == RETURN_EMPTY_FLAG)) { /* * Run until we can no longer be assured that we will have enough bits to continue */ switch (h.state) { case FRAME_SEARCH: /* * Look for an HDLC frame, keying from the top byte. */ next = hdlc_search[(h.data >> 24) & 0xff]; h.bits -= next & 0x0f; h.data <<= next & 0x0f; h.state = (next >> 4) & 0xff; h.ones = 0; break; case PROCESS_FRAME: /* Process as much as the next ten bits */ next = hdlc_frame[h.ones][(h.data >>> 22) & 0x3ff]; // Must be 10 bits here, not 8, that's all // next = hdlc_frame_precalc(h.ones, (h.data >> 22)& 0x3ff); h.bits -= (((next & 0x0f00) >> 8) & 0xff); h.data <<= (((next & 0x0f00) >> 8) & 0xff); h.state = ((next & STATE_MASK) >> 15) & 0xff; h.ones = (((next & ONES_MASK) >> 12) & 0xff); switch (next & STATUS_MASK) { case STATUS_CONTROL: if ((next & CONTROL_COMPLETE) != 0) { /* A complete, valid frame received */ retval = (RETURN_COMPLETE_FLAG); // depends on control dependency: [if], data = [none] /* Stay in this state */ h.state = 1; // depends on control dependency: [if], data = [none] } else { /* An abort (either out of sync of explicit) */ retval = (RETURN_DISCARD_FLAG); // depends on control dependency: [if], data = [none] } break; case STATUS_VALID: retval = (next & DATA_MASK); } } } return retval; } }
public class class_name { public static String escape(char c) { switch (c) { case '\b': return "\\b"; case '\t': return "\\t"; case '\n': return "\\n"; case '\f': return "\\f"; case '\r': return "\\r"; case '"': return "\\\""; case '\'': return "\\'"; case '\\': return "\\\\"; default: if (c < 32 || c == 127) { return String.format("\\%03o", (int) c); } else if (!isConsolePrintable(c) || isHighSurrogate(c) || isLowSurrogate(c)) { return String.format("\\u%04x", (int) c); } return String.valueOf(c); } } }
public class class_name { public static String escape(char c) { switch (c) { case '\b': return "\\b"; case '\t': return "\\t"; case '\n': return "\\n"; case '\f': return "\\f"; case '\r': return "\\r"; case '"': return "\\\""; case '\'': return "\\'"; case '\\': return "\\\\"; default: if (c < 32 || c == 127) { return String.format("\\%03o", (int) c); // depends on control dependency: [if], data = [none] } else if (!isConsolePrintable(c) || isHighSurrogate(c) || isLowSurrogate(c)) { return String.format("\\u%04x", (int) c); // depends on control dependency: [if], data = [none] } return String.valueOf(c); } } }
public class class_name { static SuggestedFix.Builder makeConcreteClassAbstract(ClassTree classTree, VisitorState state) { Set<Modifier> flags = EnumSet.noneOf(Modifier.class); flags.addAll(classTree.getModifiers().getFlags()); boolean wasFinal = flags.remove(FINAL); boolean wasAbstract = !flags.add(ABSTRACT); if (classTree.getKind().equals(INTERFACE) || (!wasFinal && wasAbstract)) { return SuggestedFix.builder(); // no-op } ImmutableList.Builder<Object> modifiers = ImmutableList.builder(); for (AnnotationTree annotation : classTree.getModifiers().getAnnotations()) { modifiers.add(state.getSourceForNode(annotation)); } modifiers.addAll(flags); SuggestedFix.Builder makeAbstract = SuggestedFix.builder(); if (((JCModifiers) classTree.getModifiers()).pos == -1) { makeAbstract.prefixWith(classTree, Joiner.on(' ').join(modifiers.build())); } else { makeAbstract.replace(classTree.getModifiers(), Joiner.on(' ').join(modifiers.build())); } if (wasFinal && HAS_GENERATED_CONSTRUCTOR.matches(classTree, state)) { makeAbstract.merge(addPrivateConstructor(classTree)); } return makeAbstract; } }
public class class_name { static SuggestedFix.Builder makeConcreteClassAbstract(ClassTree classTree, VisitorState state) { Set<Modifier> flags = EnumSet.noneOf(Modifier.class); flags.addAll(classTree.getModifiers().getFlags()); boolean wasFinal = flags.remove(FINAL); boolean wasAbstract = !flags.add(ABSTRACT); if (classTree.getKind().equals(INTERFACE) || (!wasFinal && wasAbstract)) { return SuggestedFix.builder(); // no-op // depends on control dependency: [if], data = [none] } ImmutableList.Builder<Object> modifiers = ImmutableList.builder(); for (AnnotationTree annotation : classTree.getModifiers().getAnnotations()) { modifiers.add(state.getSourceForNode(annotation)); // depends on control dependency: [for], data = [annotation] } modifiers.addAll(flags); SuggestedFix.Builder makeAbstract = SuggestedFix.builder(); if (((JCModifiers) classTree.getModifiers()).pos == -1) { makeAbstract.prefixWith(classTree, Joiner.on(' ').join(modifiers.build())); // depends on control dependency: [if], data = [none] } else { makeAbstract.replace(classTree.getModifiers(), Joiner.on(' ').join(modifiers.build())); // depends on control dependency: [if], data = [none] } if (wasFinal && HAS_GENERATED_CONSTRUCTOR.matches(classTree, state)) { makeAbstract.merge(addPrivateConstructor(classTree)); // depends on control dependency: [if], data = [none] } return makeAbstract; } }
public class class_name { public String[] getAttributeNames() { NamedNodeMap map = dom.getAttributes(); String[] names = new String[map.getLength()]; for (int i=0;i<names.length;i++) { names[i] = map.item(i).getNodeName(); } return names; } }
public class class_name { public String[] getAttributeNames() { NamedNodeMap map = dom.getAttributes(); String[] names = new String[map.getLength()]; for (int i=0;i<names.length;i++) { names[i] = map.item(i).getNodeName(); // depends on control dependency: [for], data = [i] } return names; } }
public class class_name { public static String formatPropertyName(final String value) { String formattedValue = toUpperFirstChar(value); if (ValidationUtil.isGolangKeyword(formattedValue)) { final String keywordAppendToken = System.getProperty(SbeTool.KEYWORD_APPEND_TOKEN); if (null == keywordAppendToken) { throw new IllegalStateException( "Invalid property name='" + formattedValue + "' please correct the schema or consider setting system property: " + SbeTool.KEYWORD_APPEND_TOKEN); } formattedValue += keywordAppendToken; } return formattedValue; } }
public class class_name { public static String formatPropertyName(final String value) { String formattedValue = toUpperFirstChar(value); if (ValidationUtil.isGolangKeyword(formattedValue)) { final String keywordAppendToken = System.getProperty(SbeTool.KEYWORD_APPEND_TOKEN); if (null == keywordAppendToken) { throw new IllegalStateException( "Invalid property name='" + formattedValue + "' please correct the schema or consider setting system property: " + SbeTool.KEYWORD_APPEND_TOKEN); } formattedValue += keywordAppendToken; // depends on control dependency: [if], data = [none] } return formattedValue; } }
public class class_name { public SearchableDocumentation process() { // Start processing. final SortedMap<SortableLocation, JavaDocData> dataHolder = new TreeMap<SortableLocation, JavaDocData>(); final Collection<JavaSource> sources = builder.getSources(); if (log.isInfoEnabled()) { log.info("Processing [" + sources.size() + "] java sources."); } for (JavaSource current : sources) { // Add the package-level JavaDoc final JavaPackage currentPackage = current.getPackage(); final String packageName = currentPackage.getName(); addEntry(dataHolder, new PackageLocation(packageName), currentPackage); if (log.isDebugEnabled()) { log.debug("Added package-level JavaDoc for [" + packageName + "]"); } for (JavaClass currentClass : current.getClasses()) { // Add the class-level JavaDoc final String simpleClassName = currentClass.getName(); final String classXmlName = getAnnotationAttributeValueFrom(XmlType.class, "name", currentClass.getAnnotations()); final ClassLocation classLocation = new ClassLocation(packageName, simpleClassName, classXmlName); addEntry(dataHolder, classLocation, currentClass); if (log.isDebugEnabled()) { log.debug("Added class-level JavaDoc for [" + classLocation + "]"); } for (JavaField currentField : currentClass.getFields()) { final List<JavaAnnotation> currentFieldAnnotations = currentField.getAnnotations(); String annotatedXmlName = null; // // Is this field a collection, annotated with @XmlElementWrapper? // If so, the documentation should pertain to the corresponding XML Sequence, // rather than the individual XML elements. // if (hasAnnotation(XmlElementWrapper.class, currentFieldAnnotations)) { // There are 2 cases here: // // 1: The XmlElementWrapper is named. // ================================== // @XmlElementWrapper(name = "foobar") // @XmlElement(name = "aString") // private List<String> strings; // // ==> annotatedXmlName == "foobar" // // 2: The XmlElementWrapper is not named. // ====================================== // @XmlElementWrapper // @XmlElement(name = "anInteger") // private SortedSet<Integer> integerSet; // // ==> annotatedXmlName == "integerSet" // annotatedXmlName = getAnnotationAttributeValueFrom( XmlElementWrapper.class, "name", currentFieldAnnotations); if (annotatedXmlName == null || annotatedXmlName.equals(DEFAULT_VALUE)) { annotatedXmlName = currentField.getName(); } } // Find the XML name if provided within an annotation. if (annotatedXmlName == null) { annotatedXmlName = getAnnotationAttributeValueFrom( XmlElement.class, "name", currentFieldAnnotations); } if (annotatedXmlName == null) { annotatedXmlName = getAnnotationAttributeValueFrom( XmlAttribute.class, "name", currentFieldAnnotations); } if (annotatedXmlName == null) { annotatedXmlName = getAnnotationAttributeValueFrom( XmlEnumValue.class, "value", currentFieldAnnotations); } // Add the field-level JavaDoc final FieldLocation fieldLocation = new FieldLocation( packageName, simpleClassName, classXmlName, currentField.getName(), annotatedXmlName); addEntry(dataHolder, fieldLocation, currentField); if (log.isDebugEnabled()) { log.debug("Added field-level JavaDoc for [" + fieldLocation + "]"); } } for (JavaMethod currentMethod : currentClass.getMethods()) { final List<JavaAnnotation> currentMethodAnnotations = currentMethod.getAnnotations(); String annotatedXmlName = null; // // Is this field a collection, annotated with @XmlElementWrapper? // If so, the documentation should pertain to the corresponding XML Sequence, // rather than the individual XML elements. // if (hasAnnotation(XmlElementWrapper.class, currentMethodAnnotations)) { // There are 2 cases here: // // 1: The XmlElementWrapper is named. // ================================== // @XmlElementWrapper(name = "foobar") // @XmlElement(name = "aString") // public List<String> getStrings() { ... }; // // ==> annotatedXmlName == "foobar" // // 2: The XmlElementWrapper is not named. // ====================================== // @XmlElementWrapper // @XmlElement(name = "anInteger") // public SortedSet<Integer> getIntegerSet() { ... }; // // ==> annotatedXmlName == "getIntegerSet" // annotatedXmlName = getAnnotationAttributeValueFrom( XmlElementWrapper.class, "name", currentMethodAnnotations); if (annotatedXmlName == null || annotatedXmlName.equals(DEFAULT_VALUE)) { annotatedXmlName = currentMethod.getName(); } } // Find the XML name if provided within an annotation. if (annotatedXmlName == null) { annotatedXmlName = getAnnotationAttributeValueFrom( XmlElement.class, "name", currentMethod.getAnnotations()); } if (annotatedXmlName == null) { annotatedXmlName = getAnnotationAttributeValueFrom( XmlAttribute.class, "name", currentMethod.getAnnotations()); } // Add the method-level JavaDoc final MethodLocation location = new MethodLocation(packageName, simpleClassName, classXmlName, currentMethod.getName(), annotatedXmlName, currentMethod.getParameters()); addEntry(dataHolder, location, currentMethod); if (log.isDebugEnabled()) { log.debug("Added method-level JavaDoc for [" + location + "]"); } } } } // All done. return new ReadOnlySearchableDocumentation(dataHolder); } }
public class class_name { public SearchableDocumentation process() { // Start processing. final SortedMap<SortableLocation, JavaDocData> dataHolder = new TreeMap<SortableLocation, JavaDocData>(); final Collection<JavaSource> sources = builder.getSources(); if (log.isInfoEnabled()) { log.info("Processing [" + sources.size() + "] java sources."); // depends on control dependency: [if], data = [none] } for (JavaSource current : sources) { // Add the package-level JavaDoc final JavaPackage currentPackage = current.getPackage(); final String packageName = currentPackage.getName(); addEntry(dataHolder, new PackageLocation(packageName), currentPackage); // depends on control dependency: [for], data = [current] if (log.isDebugEnabled()) { log.debug("Added package-level JavaDoc for [" + packageName + "]"); // depends on control dependency: [if], data = [none] } for (JavaClass currentClass : current.getClasses()) { // Add the class-level JavaDoc final String simpleClassName = currentClass.getName(); final String classXmlName = getAnnotationAttributeValueFrom(XmlType.class, "name", currentClass.getAnnotations()); final ClassLocation classLocation = new ClassLocation(packageName, simpleClassName, classXmlName); addEntry(dataHolder, classLocation, currentClass); // depends on control dependency: [for], data = [currentClass] if (log.isDebugEnabled()) { log.debug("Added class-level JavaDoc for [" + classLocation + "]"); // depends on control dependency: [if], data = [none] } for (JavaField currentField : currentClass.getFields()) { final List<JavaAnnotation> currentFieldAnnotations = currentField.getAnnotations(); String annotatedXmlName = null; // // Is this field a collection, annotated with @XmlElementWrapper? // If so, the documentation should pertain to the corresponding XML Sequence, // rather than the individual XML elements. // if (hasAnnotation(XmlElementWrapper.class, currentFieldAnnotations)) { // There are 2 cases here: // // 1: The XmlElementWrapper is named. // ================================== // @XmlElementWrapper(name = "foobar") // @XmlElement(name = "aString") // private List<String> strings; // // ==> annotatedXmlName == "foobar" // // 2: The XmlElementWrapper is not named. // ====================================== // @XmlElementWrapper // @XmlElement(name = "anInteger") // private SortedSet<Integer> integerSet; // // ==> annotatedXmlName == "integerSet" // annotatedXmlName = getAnnotationAttributeValueFrom( XmlElementWrapper.class, "name", currentFieldAnnotations); // depends on control dependency: [if], data = [none] if (annotatedXmlName == null || annotatedXmlName.equals(DEFAULT_VALUE)) { annotatedXmlName = currentField.getName(); // depends on control dependency: [if], data = [none] } } // Find the XML name if provided within an annotation. if (annotatedXmlName == null) { annotatedXmlName = getAnnotationAttributeValueFrom( XmlElement.class, "name", currentFieldAnnotations); // depends on control dependency: [if], data = [none] } if (annotatedXmlName == null) { annotatedXmlName = getAnnotationAttributeValueFrom( XmlAttribute.class, "name", currentFieldAnnotations); // depends on control dependency: [if], data = [none] } if (annotatedXmlName == null) { annotatedXmlName = getAnnotationAttributeValueFrom( XmlEnumValue.class, "value", currentFieldAnnotations); // depends on control dependency: [if], data = [none] } // Add the field-level JavaDoc final FieldLocation fieldLocation = new FieldLocation( packageName, simpleClassName, classXmlName, currentField.getName(), annotatedXmlName); addEntry(dataHolder, fieldLocation, currentField); // depends on control dependency: [for], data = [currentField] if (log.isDebugEnabled()) { log.debug("Added field-level JavaDoc for [" + fieldLocation + "]"); // depends on control dependency: [if], data = [none] } } for (JavaMethod currentMethod : currentClass.getMethods()) { final List<JavaAnnotation> currentMethodAnnotations = currentMethod.getAnnotations(); String annotatedXmlName = null; // // Is this field a collection, annotated with @XmlElementWrapper? // If so, the documentation should pertain to the corresponding XML Sequence, // rather than the individual XML elements. // if (hasAnnotation(XmlElementWrapper.class, currentMethodAnnotations)) { // There are 2 cases here: // // 1: The XmlElementWrapper is named. // ================================== // @XmlElementWrapper(name = "foobar") // @XmlElement(name = "aString") // public List<String> getStrings() { ... }; // // ==> annotatedXmlName == "foobar" // // 2: The XmlElementWrapper is not named. // ====================================== // @XmlElementWrapper // @XmlElement(name = "anInteger") // public SortedSet<Integer> getIntegerSet() { ... }; // // ==> annotatedXmlName == "getIntegerSet" // annotatedXmlName = getAnnotationAttributeValueFrom( XmlElementWrapper.class, "name", currentMethodAnnotations); // depends on control dependency: [if], data = [none] if (annotatedXmlName == null || annotatedXmlName.equals(DEFAULT_VALUE)) { annotatedXmlName = currentMethod.getName(); // depends on control dependency: [if], data = [none] } } // Find the XML name if provided within an annotation. if (annotatedXmlName == null) { annotatedXmlName = getAnnotationAttributeValueFrom( XmlElement.class, "name", currentMethod.getAnnotations()); // depends on control dependency: [if], data = [none] } if (annotatedXmlName == null) { annotatedXmlName = getAnnotationAttributeValueFrom( XmlAttribute.class, "name", currentMethod.getAnnotations()); // depends on control dependency: [if], data = [none] } // Add the method-level JavaDoc final MethodLocation location = new MethodLocation(packageName, simpleClassName, classXmlName, currentMethod.getName(), annotatedXmlName, currentMethod.getParameters()); addEntry(dataHolder, location, currentMethod); // depends on control dependency: [for], data = [currentMethod] if (log.isDebugEnabled()) { log.debug("Added method-level JavaDoc for [" + location + "]"); // depends on control dependency: [if], data = [none] } } } } // All done. return new ReadOnlySearchableDocumentation(dataHolder); } }
public class class_name { public static <T extends Comparable<T>> T minOr(Collection<T> values, T defaultVal) { if (values.isEmpty()) { return defaultVal; } else { return Collections.min(values); } } }
public class class_name { public static <T extends Comparable<T>> T minOr(Collection<T> values, T defaultVal) { if (values.isEmpty()) { return defaultVal; // depends on control dependency: [if], data = [none] } else { return Collections.min(values); // depends on control dependency: [if], data = [none] } } }
public class class_name { private ConciseSet performOperation(ConciseSet other, Operator operator) { // non-empty arguments if (this.isEmpty() || other.isEmpty()) { return operator.combineEmptySets(this, other); } // if the two operands are disjoint, the operation is faster ConciseSet res = operator.combineDisjointSets(this, other); if (res != null) { return res; } // Allocate a sufficient number of words to contain all possible results. // NOTE: since lastWordIndex is the index of the last used word in "words", // we require "+2" to have the actual maximum required space. // In any case, we do not allocate more than the maximum space required // for the uncompressed representation. // Another "+1" is required to allows for the addition of the last word // before compacting. res = empty(); res.words = new int[1 + Math.min( this.lastWordIndex + other.lastWordIndex + 2, maxLiteralLengthDivision(Math.max(this.last, other.last)) << (simulateWAH ? 1 : 0) )]; // scan "this" and "other" WordIterator thisItr = new WordIterator(); WordIterator otherItr = other.new WordIterator(); while (true) { if (!thisItr.isLiteral) { if (!otherItr.isLiteral) { int minCount = Math.min(thisItr.count, otherItr.count); res.appendFill(minCount, operator.combineLiterals(thisItr.word, otherItr.word)); //noinspection NonShortCircuitBooleanExpression if (!thisItr.prepareNext(minCount) | /* NOT || */ !otherItr.prepareNext(minCount)) { break; } } else { res.appendLiteral(operator.combineLiterals(thisItr.toLiteral(), otherItr.word)); thisItr.word--; //noinspection NonShortCircuitBooleanExpression if (!thisItr.prepareNext(1) | /* do NOT use "||" */ !otherItr.prepareNext()) { break; } } } else if (!otherItr.isLiteral) { res.appendLiteral(operator.combineLiterals(thisItr.word, otherItr.toLiteral())); otherItr.word--; //noinspection NonShortCircuitBooleanExpression if (!thisItr.prepareNext() | /* do NOT use "||" */ !otherItr.prepareNext(1)) { break; } } else { res.appendLiteral(operator.combineLiterals(thisItr.word, otherItr.word)); //noinspection NonShortCircuitBooleanExpression if (!thisItr.prepareNext() | /* do NOT use "||" */ !otherItr.prepareNext()) { break; } } } // invalidate the size res.size = -1; boolean invalidLast = true; // if one bit string is greater than the other one, we add the remaining // bits depending on the given operation. switch (operator) { case AND: break; case OR: res.last = Math.max(this.last, other.last); invalidLast = thisItr.flush(res); invalidLast |= otherItr.flush(res); break; case XOR: if (this.last != other.last) { res.last = Math.max(this.last, other.last); invalidLast = false; } invalidLast |= thisItr.flush(res); invalidLast |= otherItr.flush(res); break; case ANDNOT: if (this.last > other.last) { res.last = this.last; invalidLast = false; } invalidLast |= thisItr.flush(res); break; } // remove trailing zeros res.trimZeros(); if (res.isEmpty()) { return res; } // compute the greatest element if (invalidLast) { res.updateLast(); } // compact the memory res.compact(); return res; } }
public class class_name { private ConciseSet performOperation(ConciseSet other, Operator operator) { // non-empty arguments if (this.isEmpty() || other.isEmpty()) { return operator.combineEmptySets(this, other); // depends on control dependency: [if], data = [none] } // if the two operands are disjoint, the operation is faster ConciseSet res = operator.combineDisjointSets(this, other); if (res != null) { return res; // depends on control dependency: [if], data = [none] } // Allocate a sufficient number of words to contain all possible results. // NOTE: since lastWordIndex is the index of the last used word in "words", // we require "+2" to have the actual maximum required space. // In any case, we do not allocate more than the maximum space required // for the uncompressed representation. // Another "+1" is required to allows for the addition of the last word // before compacting. res = empty(); res.words = new int[1 + Math.min( this.lastWordIndex + other.lastWordIndex + 2, maxLiteralLengthDivision(Math.max(this.last, other.last)) << (simulateWAH ? 1 : 0) )]; // scan "this" and "other" WordIterator thisItr = new WordIterator(); WordIterator otherItr = other.new WordIterator(); while (true) { if (!thisItr.isLiteral) { if (!otherItr.isLiteral) { int minCount = Math.min(thisItr.count, otherItr.count); res.appendFill(minCount, operator.combineLiterals(thisItr.word, otherItr.word)); // depends on control dependency: [if], data = [none] //noinspection NonShortCircuitBooleanExpression if (!thisItr.prepareNext(minCount) | /* NOT || */ !otherItr.prepareNext(minCount)) { break; } } else { res.appendLiteral(operator.combineLiterals(thisItr.toLiteral(), otherItr.word)); // depends on control dependency: [if], data = [none] thisItr.word--; // depends on control dependency: [if], data = [none] //noinspection NonShortCircuitBooleanExpression if (!thisItr.prepareNext(1) | /* do NOT use "||" */ !otherItr.prepareNext()) { break; } } } else if (!otherItr.isLiteral) { res.appendLiteral(operator.combineLiterals(thisItr.word, otherItr.toLiteral())); // depends on control dependency: [if], data = [none] otherItr.word--; // depends on control dependency: [if], data = [none] //noinspection NonShortCircuitBooleanExpression if (!thisItr.prepareNext() | /* do NOT use "||" */ !otherItr.prepareNext(1)) { break; } } else { res.appendLiteral(operator.combineLiterals(thisItr.word, otherItr.word)); // depends on control dependency: [if], data = [none] //noinspection NonShortCircuitBooleanExpression if (!thisItr.prepareNext() | /* do NOT use "||" */ !otherItr.prepareNext()) { break; } } } // invalidate the size res.size = -1; boolean invalidLast = true; // if one bit string is greater than the other one, we add the remaining // bits depending on the given operation. switch (operator) { case AND: break; case OR: res.last = Math.max(this.last, other.last); invalidLast = thisItr.flush(res); invalidLast |= otherItr.flush(res); break; case XOR: if (this.last != other.last) { res.last = Math.max(this.last, other.last); // depends on control dependency: [if], data = [(this.last] invalidLast = false; // depends on control dependency: [if], data = [none] } invalidLast |= thisItr.flush(res); invalidLast |= otherItr.flush(res); break; case ANDNOT: if (this.last > other.last) { res.last = this.last; // depends on control dependency: [if], data = [none] invalidLast = false; // depends on control dependency: [if], data = [none] } invalidLast |= thisItr.flush(res); break; } // remove trailing zeros res.trimZeros(); if (res.isEmpty()) { return res; // depends on control dependency: [if], data = [none] } // compute the greatest element if (invalidLast) { res.updateLast(); // depends on control dependency: [if], data = [none] } // compact the memory res.compact(); return res; } }
public class class_name { public void put(String key, Short value) { if (this.compiledStatement != null) { if (value==null) { this.compiledStatement.bindNull(compiledStatementBindIndex++); } else { compiledStatement.bindLong(compiledStatementBindIndex++, (short) value); } } else if (values != null) { values.put(key, value); return; } names.add(key); // values.put(key, value); args.add(value); valueType.add(ParamType.SHORT); } }
public class class_name { public void put(String key, Short value) { if (this.compiledStatement != null) { if (value==null) { this.compiledStatement.bindNull(compiledStatementBindIndex++); // depends on control dependency: [if], data = [none] } else { compiledStatement.bindLong(compiledStatementBindIndex++, (short) value); // depends on control dependency: [if], data = [none] } } else if (values != null) { values.put(key, value); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } names.add(key); // values.put(key, value); args.add(value); valueType.add(ParamType.SHORT); } }
public class class_name { @Override @LogarithmicTime public void insert(Integer key, V value) { if (Constants.NOT_BENCHMARK) { if (key == null) { throw new NullPointerException("Null keys not permitted"); } // make space if needed if (size == array.length - 2) { if (array.length == 2) { ensureCapacity(1); } else { ensureCapacity(2 * (array.length - 2)); } } } ++size; int hole = size; int pred = hole >> 1; Elem<V> predElem = array[pred]; while (predElem.key > key) { array[hole].key = predElem.key; array[hole].value = predElem.value; hole = pred; pred >>= 1; predElem = array[pred]; } array[hole].key = key; array[hole].value = value; } }
public class class_name { @Override @LogarithmicTime public void insert(Integer key, V value) { if (Constants.NOT_BENCHMARK) { if (key == null) { throw new NullPointerException("Null keys not permitted"); } // make space if needed if (size == array.length - 2) { if (array.length == 2) { ensureCapacity(1); // depends on control dependency: [if], data = [none] } else { ensureCapacity(2 * (array.length - 2)); // depends on control dependency: [if], data = [(array.length] } } } ++size; int hole = size; int pred = hole >> 1; Elem<V> predElem = array[pred]; while (predElem.key > key) { array[hole].key = predElem.key; // depends on control dependency: [while], data = [none] array[hole].value = predElem.value; // depends on control dependency: [while], data = [none] hole = pred; // depends on control dependency: [while], data = [none] pred >>= 1; // depends on control dependency: [while], data = [none] predElem = array[pred]; // depends on control dependency: [while], data = [none] } array[hole].key = key; array[hole].value = value; } }
public class class_name { public Serializable createContext() { MVELAccumulatorFunctionContext context = new MVELAccumulatorFunctionContext(); context.context = this.function.createContext(); if ( this.function.supportsReverse() ) { context.reverseSupport = new HashMap<Integer, Object>(); } return context; } }
public class class_name { public Serializable createContext() { MVELAccumulatorFunctionContext context = new MVELAccumulatorFunctionContext(); context.context = this.function.createContext(); if ( this.function.supportsReverse() ) { context.reverseSupport = new HashMap<Integer, Object>(); // depends on control dependency: [if], data = [none] } return context; } }
public class class_name { public ServiceCall<Collection> getCollection(GetCollectionOptions getCollectionOptions) { Validator.notNull(getCollectionOptions, "getCollectionOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections" }; String[] pathParameters = { getCollectionOptions.environmentId(), getCollectionOptions.collectionId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getCollection"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Collection.class)); } }
public class class_name { public ServiceCall<Collection> getCollection(GetCollectionOptions getCollectionOptions) { Validator.notNull(getCollectionOptions, "getCollectionOptions cannot be null"); String[] pathSegments = { "v1/environments", "collections" }; String[] pathParameters = { getCollectionOptions.environmentId(), getCollectionOptions.collectionId() }; RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getCollection"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header] } builder.header("Accept", "application/json"); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Collection.class)); } }
public class class_name { public static base_responses update(nitro_service client, filterhtmlinjectionvariable resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { filterhtmlinjectionvariable updateresources[] = new filterhtmlinjectionvariable[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new filterhtmlinjectionvariable(); updateresources[i].variable = resources[i].variable; updateresources[i].value = resources[i].value; } result = update_bulk_request(client, updateresources); } return result; } }
public class class_name { public static base_responses update(nitro_service client, filterhtmlinjectionvariable resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { filterhtmlinjectionvariable updateresources[] = new filterhtmlinjectionvariable[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new filterhtmlinjectionvariable(); // depends on control dependency: [for], data = [i] updateresources[i].variable = resources[i].variable; // depends on control dependency: [for], data = [i] updateresources[i].value = resources[i].value; // depends on control dependency: [for], data = [i] } result = update_bulk_request(client, updateresources); } return result; } }
public class class_name { protected boolean check(String id, List<String> includes) { if (null != includes) { for (String check : includes) { if (check(id, check)) { return true; } } } return false; } }
public class class_name { protected boolean check(String id, List<String> includes) { if (null != includes) { for (String check : includes) { if (check(id, check)) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }