query stringlengths 7 3.3k | positive listlengths 1 1 | negative listlengths 9 9 |
|---|---|---|
Tests whether the two field descriptors are equal, i.e. have same name, same column
and same jdbc-type.
@param first The first field
@param second The second field
@return <code>true</code> if they are equal | [
"private boolean isEqual(FieldDescriptorDef first, FieldDescriptorDef second)\r\n {\r\n return first.getName().equals(second.getName()) &&\r\n first.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN).equals(second.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN)) &&\r\n first.getPr... | [
"public static Chart getMSDLineWithActiveTransportModelChart(Trajectory t, int lagMin,\n\t\t\tint lagMax, double timelag, double diffusionCoefficient, double velocity) {\n\n\t\tdouble[] xData = new double[lagMax - lagMin + 1];\n\t\tdouble[] yData = new double[lagMax - lagMin + 1];\n\t\tdouble[] modelData = new doub... |
This method reads a four byte integer from the input stream.
@param is the input stream
@return byte value
@throws IOException on file read error or EOF | [
"protected int readInt(InputStream is) throws IOException\n {\n byte[] data = new byte[4];\n if (is.read(data) != data.length)\n {\n throw new EOFException();\n }\n\n return (MPPUtility.getInt(data, 0));\n }"
] | [
"public FindByIndexOptions useIndex(String designDocument, String indexName) {\r\n assertNotNull(designDocument, \"designDocument\");\r\n assertNotNull(indexName, \"indexName\");\r\n JsonArray index = new JsonArray();\r\n index.add(new JsonPrimitive(designDocument));\r\n index.add... |
Will spawn a thread for each type in rootEntities, they will all re-join
on endAllSignal when finished.
@param backend
@throws InterruptedException
if interrupted while waiting for endAllSignal. | [
"private void doBatchWork(BatchBackend backend) throws InterruptedException {\n\t\tExecutorService executor = Executors.newFixedThreadPool( typesToIndexInParallel, \"BatchIndexingWorkspace\" );\n\t\tfor ( IndexedTypeIdentifier indexedTypeIdentifier : rootIndexedTypes ) {\n\t\t\texecutor.execute( new BatchIndexingWo... | [
"public static int Mod(int x, int m) {\r\n if (m < 0) m = -m;\r\n int r = x % m;\r\n return r < 0 ? r + m : r;\r\n }",
"private void validationRelations(Task task)\n {\n List<Relation> predecessors = task.getPredecessors();\n if (!predecessors.isEmpty())\n {\n Arra... |
Converts the given dislect to a human-readable datasource type. | [
"public static String resolveDataSourceTypeFromDialect(String dialect)\n {\n if (StringUtils.contains(dialect, \"Oracle\"))\n {\n return \"Oracle\";\n }\n else if (StringUtils.contains(dialect, \"MySQL\"))\n {\n return \"MySQL\";\n }\n else i... | [
"public void createTag(final String tagUrl, final String commitMessage)\n throws IOException, InterruptedException {\n build.getWorkspace()\n .act(new SVNCreateTagCallable(tagUrl, commitMessage, getLocation(), getSvnAuthenticationProvider(build),\n buildListen... |
Returns true if the specified class node is a trait.
@param cNode a class node to test
@return true if the classnode represents a trait | [
"public static boolean isTrait(final ClassNode cNode) {\n return cNode!=null\n && ((cNode.isInterface() && !cNode.getAnnotations(TRAIT_CLASSNODE).isEmpty())\n || isAnnotatedWithTrait(cNode));\n }"
] | [
"public static void main(String[] args) {\n\t\ttry {\n\t\t\tJarRunner runner = new JarRunner(args);\n\t\t\trunner.runIfConfigured();\n\t\t} catch (NumberFormatException e) {\n\t\t\tSystem.err.println(\"Could not parse number \" + e.getMessage());\n\t\t\tSystem.exit(1);\n\t\t} catch (RuntimeException e) {\n\t\t\tSys... |
Ask the specified player for a Folder menu for exploring its raw filesystem.
This is a request for unanalyzed items, so we do a typed menu request.
@param slotReference the player and slot for which the menu is desired
@param sortOrder the order in which responses should be sorted, 0 for default, see Section 6.11.1 of... | [
"public List<Message> requestFolderMenuFrom(final SlotReference slotReference, final int sortOrder, final int folderId)\n throws Exception {\n\n ConnectionManager.ClientTask<List<Message>> task = new ConnectionManager.ClientTask<List<Message>>() {\n @Override\n public List<Me... | [
"public static Boolean parseBoolean(String value) throws ParseException\n {\n Boolean result = null;\n Integer number = parseInteger(value);\n if (number != null)\n {\n result = number.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE;\n }\n\n return result;\n }",
"public Ph... |
Stops this progress bar. | [
"public ProgressBar stop() {\n target.kill();\n try {\n thread.join();\n target.consoleStream.print(\"\\n\");\n target.consoleStream.flush();\n }\n catch (InterruptedException ex) { }\n return this;\n }"
] | [
"public final PJsonObject toJSON() {\n try {\n JSONObject json = new JSONObject();\n for (String key: this.obj.keySet()) {\n Object opt = opt(key);\n if (opt instanceof PYamlObject) {\n opt = ((PYamlObject) opt).toJSON().getInternalObj();... |
add some validation to see if this miss anything.
@return true, if successful
@throws ParallelTaskInvalidException
the parallel task invalid exception | [
"public boolean validation() throws ParallelTaskInvalidException {\n\n ParallelTask task = new ParallelTask();\n targetHostMeta = new TargetHostMeta(targetHosts);\n\n task = new ParallelTask(requestProtocol, concurrency, httpMeta,\n targetHostMeta, sshMeta, tcpMeta, udpMeta, ping... | [
"public ItemRequest<Task> addFollowers(String task) {\n \n String path = String.format(\"/tasks/%s/addFollowers\", task);\n return new ItemRequest<Task>(this, Task.class, path, \"POST\");\n }",
"public List<MapRow> read() throws IOException\n {\n List<MapRow> result = new ArrayList<MapR... |
Extracts baseline work from the MPP file for a specific baseline.
Returns null if no baseline work is present, otherwise returns
a list of timephased work items.
@param assignment parent assignment
@param calendar baseline calendar
@param normaliser normaliser associated with this data
@param data timephased baseline ... | [
"public TimephasedWorkContainer getBaselineWork(ResourceAssignment assignment, ProjectCalendar calendar, TimephasedWorkNormaliser normaliser, byte[] data, boolean raw)\n {\n TimephasedWorkContainer result = null;\n\n if (data != null && data.length > 0)\n {\n LinkedList<TimephasedWork> list... | [
"private void processProperties() {\n state = true;\n try {\n exporterServiceFilter = getFilter(exporterServiceFilterProperty);\n } catch (InvalidFilterException invalidFilterException) {\n LOG.debug(\"The value of the Property \" + FILTER_EXPORTERSERVICE_PROPERTY + \" is ... |
Transforms a position according to the current transformation matrix and current page transformation.
@param x
@param y
@return | [
"protected float[] transformPosition(float x, float y)\n {\n Point2D.Float point = super.transformedPoint(x, y);\n AffineTransform pageTransform = createCurrentPageTransformation();\n Point2D.Float transformedPoint = (Point2D.Float) pageTransform.transform(point, null);\n\n return new... | [
"public PreparedStatementCreator count(final Dialect dialect) {\n return new PreparedStatementCreator() {\n public PreparedStatement createPreparedStatement(Connection con)\n throws SQLException {\n return getPreparedStatementCreator()\n .setSql(dialect.cre... |
Build control archive of the deb
@param packageControlFile the package control file
@param controlFiles the other control information files (maintainer scripts, etc)
@param dataSize the size of the installed package
@param checksums the md5 checksums of the files in the data archive
@param output
@return
@throws java... | [
"void buildControl(BinaryPackageControlFile packageControlFile, File[] controlFiles, List<String> conffiles, StringBuilder checksums, File output) throws IOException, ParseException {\n final File dir = output.getParentFile();\n if (dir != null && (!dir.exists() || !dir.isDirectory())) {\n ... | [
"public static final String decodePassword(byte[] data, byte encryptionCode)\n {\n String result;\n\n if (data.length < MINIMUM_PASSWORD_DATA_LENGTH)\n {\n result = null;\n }\n else\n {\n MPPUtility.decodeBuffer(data, encryptionCode);\n\n StringBuilder buffer ... |
Extract site path, base name and locale from the resource opened with the editor. | [
"private void setResourceInformation() {\n\n String sitePath = m_cms.getSitePath(m_resource);\n int pathEnd = sitePath.lastIndexOf('/') + 1;\n String baseName = sitePath.substring(pathEnd);\n m_sitepath = sitePath.substring(0, pathEnd);\n switch (CmsMessageBundleEditorTypes.Bundle... | [
"public static String buildDynamicCapabilityName(String baseName, String dynamicNameElement) {\n return buildDynamicCapabilityName(baseName, new String[]{dynamicNameElement});\n }",
"private static MBeanServer setQueryExpServer(QueryExp query, MBeanServer toSet) {\n // We assume the QueryExp is a... |
Indicates if the type is a simple Web Bean
@param clazz The type to inspect
@return True if simple Web Bean, false otherwise | [
"public static boolean isTypeManagedBeanOrDecoratorOrInterceptor(AnnotatedType<?> annotatedType) {\n Class<?> javaClass = annotatedType.getJavaClass();\n return !javaClass.isEnum() && !Extension.class.isAssignableFrom(javaClass)\n && Reflections.isTopLevelOrStaticNestedClass(javaClass) ... | [
"public static Object getFieldValue(Object object, String fieldName) {\n try {\n return getDeclaredFieldInHierarchy(object.getClass(), fieldName).get(object);\n } catch (IllegalArgumentException e) {\n throw new RuntimeException(e);\n } catch (IllegalAccessException e) {\n... |
Build a compact representation of the ModelNode.
@param node The model
@return A single line containing the multi lines ModelNode.toString() content. | [
"public static String compactToString(ModelNode node) {\n Objects.requireNonNull(node);\n final StringWriter stringWriter = new StringWriter();\n final PrintWriter writer = new PrintWriter(stringWriter, true);\n node.writeString(writer, true);\n return stringWriter.toString();\n ... | [
"public static protocolip_stats get(nitro_service service) throws Exception{\n\t\tprotocolip_stats obj = new protocolip_stats();\n\t\tprotocolip_stats[] response = (protocolip_stats[])obj.stat_resources(service);\n\t\treturn response[0];\n\t}",
"protected void putResponse(JSONObject json,\n ... |
Use this API to update cacheselector. | [
"public static base_response update(nitro_service client, cacheselector resource) throws Exception {\n\t\tcacheselector updateresource = new cacheselector();\n\t\tupdateresource.selectorname = resource.selectorname;\n\t\tupdateresource.rule = resource.rule;\n\t\treturn updateresource.update_resource(client);\n\t}"
... | [
"public boolean canBeLinked(D declaration, ServiceReference<S> declarationBinderRef) {\n // Evaluate the target filter of the ImporterService on the Declaration\n Filter filter = bindersManager.getTargetFilter(declarationBinderRef);\n return filter.matches(declaration.getMetadata());\n }",
... |
Registers the parameter for the value formatter for the given variable and puts
it's implementation in the parameters map.
@param djVariable
@param variableName | [
"protected void registerValueFormatter(DJGroupVariable djVariable, String variableName) {\n\t\tif ( djVariable.getValueFormatter() == null){\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tJRDesignParameter dparam = new JRDesignParameter();\n\t\tdparam.setName(variableName + \"_vf\"); //value formater suffix\n\t\tdparam.setValueC... | [
"public static ByteBuffer newDirectByteBuffer(long addr, int size, Object att) {\n dbbCC.setAccessible(true);\n Object b = null;\n try {\n b = dbbCC.newInstance(new Long(addr), new Integer(size), att);\n return ByteBuffer.class.cast(b);\n }\n catch(Exception ... |
This method takes the textual version of a constraint name
and returns an appropriate class instance. Note that unrecognised
values are treated as "As Soon As Possible" constraints.
@param locale target locale
@param type text version of the constraint type
@return ConstraintType instance | [
"public static ConstraintType getInstance(Locale locale, String type)\n {\n int index = 0;\n\n String[] constraintTypes = LocaleData.getStringArray(locale, LocaleData.CONSTRAINT_TYPES);\n for (int loop = 0; loop < constraintTypes.length; loop++)\n {\n if (constraintTypes[loop].equalsIg... | [
"private static List<String> parseModifiers(int modifiers) {\n List<String> result = new ArrayList<String>();\n if (Modifier.isPrivate(modifiers)) {\n result.add(\"private\");\n }\n if (Modifier.isProtected(modifiers)) {\n result.add(\"protected\");\n }\n ... |
Returns a Bic object holding the value of the specified String.
@param bic the String to be parsed.
@return a Bic object holding the value represented by the string argument.
@throws BicFormatException if the String doesn't contain parsable Bic.
UnsupportedCountryException if bic's country is not supported. | [
"public static Bic valueOf(final String bic) throws BicFormatException,\n UnsupportedCountryException {\n BicUtil.validate(bic);\n return new Bic(bic);\n }"
] | [
"private void initStoreDefinitions(Version storesXmlVersion) {\n if(this.storeDefinitionsStorageEngine == null) {\n throw new VoldemortException(\"The store definitions directory is empty\");\n }\n\n String allStoreDefinitions = \"<stores>\";\n Version finalStoresXmlVersion = ... |
Forceful cleanup the logs | [
"@JmxOperation(description = \"Forcefully invoke the log cleaning\")\n public void cleanLogs() {\n synchronized(lock) {\n try {\n for(Environment environment: environments.values()) {\n environment.cleanLog();\n }\n } catch(DatabaseExc... | [
"public static List<String> getDefaultConversionProviderChain(){\n List<String> defaultChain = getMonetaryConversionsSpi()\n .getDefaultProviderChain();\n Objects.requireNonNull(defaultChain, \"No default provider chain provided by SPI: \" +\n getMonetaryConversionsSpi().... |
Closes the connection to the dbserver. This instance can no longer be used after this action. | [
"void close() {\n try {\n performTeardownExchange();\n } catch (IOException e) {\n logger.warn(\"Problem reporting our intention to close the dbserver connection\", e);\n }\n try {\n channel.close();\n } catch (IOException e) {\n logger.... | [
"boolean applyDomainModel(ModelNode result) {\n if(! result.hasDefined(ModelDescriptionConstants.RESULT)) {\n return false;\n }\n final List<ModelNode> bootOperations= result.get(ModelDescriptionConstants.RESULT).asList();\n return callback.applyDomainModel(bootOperations);\n ... |
Get the value of the fist child element with the given name.
@param element
The parent element
@param name
The child element name
@return The child element value or null | [
"public static String getChildValue(Element element, String name) {\r\n return getValue(getChild(element, name));\r\n }"
] | [
"public int getIntegerBelief(String name){\n Object belief = introspector.getBeliefBase(this).get(name);\n int count = 0;\n if (belief!=null) {\n count = (Integer) belief;\n }\n return (Integer) count;\n }",
"public Story storyOfText(Configuration configuration, St... |
Checks if two types are the same or are equivalent under a variable
mapping given in the type map that was provided. | [
"private static boolean matches(Type from, Type to, Map<String, Type> typeMap) {\n\t\tif (to.equals(from))\n\t\t\treturn true;\n\n\t\tif (from instanceof TypeVariable) {\n\t\t\treturn to.equals(typeMap.get(((TypeVariable<?>) from).getName()));\n\t\t}\n\n\t\treturn false;\n\t}"
] | [
"public static base_responses enable(nitro_service client, String acl6name[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (acl6name != null && acl6name.length > 0) {\n\t\t\tnsacl6 enableresources[] = new nsacl6[acl6name.length];\n\t\t\tfor (int i=0;i<acl6name.length;i++){\n\t\t\t\tenableresources[... |
Populates a resource.
@param resource resource instance
@param record MPX record
@throws MPXJException | [
"private void populateResource(Resource resource, Record record) throws MPXJException\n {\n String falseText = LocaleData.getString(m_locale, LocaleData.NO);\n\n int length = record.getLength();\n int[] model = m_resourceModel.getModel();\n\n for (int i = 0; i < length; i++)\n {\n ... | [
"public static base_responses update(nitro_service client, dospolicy resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tdospolicy updateresources[] = new dospolicy[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tup... |
required for rest assured base URI configuration. | [
"public void configure(@Observes(precedence = -200) ArquillianDescriptor arquillianDescriptor) {\n restAssuredConfigurationInstanceProducer.set(\n RestAssuredConfiguration.fromMap(arquillianDescriptor\n .extension(\"restassured\")\n .getExtensionProperties()));\n }... | [
"private boolean addDeploymentTypeBasedDependencies(ProjectModel projectModel, Pom modulePom)\n {\n if (projectModel.getProjectType() == null)\n return true;\n switch (projectModel.getProjectType()){\n case \"ear\":\n break;\n case \"war\":\n ... |
Creates an object instance according to clb, and fills its fileds width data provided by row.
@param row A {@link Map} contain the Object/Row mapping for the object.
@param targetClassDescriptor If the "ojbConcreteClass" feature was used, the target
{@link org.apache.ojb.broker.metadata.ClassDescriptor} could differ fr... | [
"protected Object buildOrRefreshObject(Map row, ClassDescriptor targetClassDescriptor, Object targetObject)\r\n {\r\n Object result = targetObject;\r\n FieldDescriptor fmd;\r\n FieldDescriptor[] fields = targetClassDescriptor.getFieldDescriptor(true);\r\n\r\n if(targetObject == null)\... | [
"public Note add(String photoId, Note note) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_ADD);\r\n\r\n parameters.put(\"photo_id\", photoId);\r\n Rectangle bounds = note.getBounds();\r\n if (boun... |
Create a new queued pool with key type K, request type R, and value type
V.
@param factory The factory that creates objects
@param config The pool config
@return The created pool | [
"public static <K, V> QueuedKeyedResourcePool<K, V> create(ResourceFactory<K, V> factory,\n ResourcePoolConfig config) {\n return new QueuedKeyedResourcePool<K, V>(factory, config);\n }"
] | [
"public static nsrollbackcmd[] get(nitro_service service, nsrollbackcmd_args args) throws Exception{\n\t\tnsrollbackcmd obj = new nsrollbackcmd();\n\t\toptions option = new options();\n\t\toption.set_args(nitro_util.object_to_string_withoutquotes(args));\n\t\tnsrollbackcmd[] response = (nsrollbackcmd[])obj.get_reso... |
Creates an instance of a NewSimpleBean from an annotated class
@param clazz The annotated class
@param beanManager The Bean manager
@return a new NewSimpleBean instance | [
"public static <T> NewManagedBean<T> of(BeanAttributes<T> attributes, EnhancedAnnotatedType<T> clazz, BeanManagerImpl beanManager) {\n return new NewManagedBean<T>(attributes, clazz, new StringBeanIdentifier(BeanIdentifiers.forNewManagedBean(clazz)), beanManager);\n }"
] | [
"public RgbaColor opacify(float amount) {\n return new RgbaColor(r, g, b, alphaCheck(a + amount));\n }",
"public Integer getIdFromName(String profileName) {\n PreparedStatement query = null;\n ResultSet results = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) ... |
Returns all program element docs that have a visibility greater or
equal than the specified level | [
"private <T extends ProgramElementDoc> List<T> filterByVisibility(T[] docs, Visibility visibility) {\n\tif (visibility == Visibility.PRIVATE)\n\t return Arrays.asList(docs);\n\n\tList<T> filtered = new ArrayList<T>();\n\tfor (T doc : docs) {\n\t if (Visibility.get(doc).compareTo(visibility) > 0)\n\t\tfiltered... | [
"@Override\n public PersistentResourceXMLDescription getParserDescription() {\n return PersistentResourceXMLDescription.builder(ElytronExtension.SUBSYSTEM_PATH, getNameSpace())\n .addAttribute(ElytronDefinition.DEFAULT_AUTHENTICATION_CONTEXT)\n .addAttribute(ElytronDefinition... |
Use this API to unset the properties of systemcollectionparam resource.
Properties that need to be unset are specified in args array. | [
"public static base_response unset(nitro_service client, systemcollectionparam resource, String[] args) throws Exception{\n\t\tsystemcollectionparam unsetresource = new systemcollectionparam();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}"
] | [
"public static String digestToFileName(String digest) {\n if (StringUtils.startsWith(digest, \"sha1\")) {\n return \"manifest.json\";\n }\n return getShaVersion(digest) + \"__\" + getShaValue(digest);\n }",
"private static boolean isEqual(Method m, Method a) {\n if (m.get... |
Cause the container to be cleaned up, including all registered bean
managers, and all deployment services | [
"public void cleanup() {\n managers.clear();\n for (BeanManagerImpl beanManager : beanDeploymentArchives.values()) {\n beanManager.cleanup();\n }\n beanDeploymentArchives.clear();\n deploymentServices.cleanup();\n deploymentManager.cleanup();\n instance.cl... | [
"synchronized void removeServerProcess() {\n this.requiredState = InternalState.STOPPED;\n internalSetState(new ProcessRemoveTask(), InternalState.STOPPED, InternalState.PROCESS_REMOVING);\n }",
"public static Predicate anyBitsSet(final String expr, final long bits) {\n return new Predicat... |
Retrieves all file version retentions.
@param api the API connection to be used by the resource.
@param fields the fields to retrieve.
@return an iterable contains information about all file version retentions. | [
"public static Iterable<BoxFileVersionRetention.Info> getAll(BoxAPIConnection api, String ... fields) {\n return getRetentions(api, new QueryFilter(), fields);\n }"
] | [
"public Conditionals addIfMatch(Tag tag) {\n Preconditions.checkArgument(!modifiedSince.isPresent(), String.format(ERROR_MESSAGE, HeaderConstants.IF_MATCH, HeaderConstants.IF_MODIFIED_SINCE));\n Preconditions.checkArgument(noneMatch.isEmpty(), String.format(ERROR_MESSAGE, HeaderConstants.IF_MATCH, Hea... |
Use this API to fetch all the tunneltrafficpolicy resources that are configured on netscaler. | [
"public static tunneltrafficpolicy[] get(nitro_service service, options option) throws Exception{\n\t\ttunneltrafficpolicy obj = new tunneltrafficpolicy();\n\t\ttunneltrafficpolicy[] response = (tunneltrafficpolicy[])obj.get_resources(service,option);\n\t\treturn response;\n\t}"
] | [
"public synchronized void submitOperation(int requestId, AsyncOperation operation) {\n if(this.operations.containsKey(requestId))\n throw new VoldemortException(\"Request \" + requestId\n + \" already submitted to the system\");\n\n this.operations.pu... |
Get an image as a stream. Callers must be sure to close the stream when they are done with it.
@deprecated
@see PhotosInterface#getImageAsStream(Photo, int)
@param suffix
The suffix
@return The InputStream
@throws IOException | [
"@Deprecated\r\n private InputStream getImageAsStream(String suffix) throws IOException {\r\n StringBuffer buffer = getBaseImageUrl();\r\n buffer.append(suffix);\r\n return _getImageAsStream(buffer.toString());\r\n }"
] | [
"public static String getHotPartitionsDueToContiguity(final Cluster cluster,\n int hotContiguityCutoff) {\n StringBuilder sb = new StringBuilder();\n\n for(int zoneId: cluster.getZoneIds()) {\n Map<Integer, Integer> idToRunLength = get... |
Returns a set that contains all the unique entries of the given iterator in the order of their appearance.
The result set is a copy of the iterator with stable order.
@param iterator
the iterator. May not be <code>null</code>.
@return a set with the unique entries of the given iterator. Never <code>null</code>. | [
"public static <T> Set<T> toSet(Iterator<? extends T> iterator) {\n\t\treturn Sets.newLinkedHashSet(toIterable(iterator));\n\t}"
] | [
"public void setCurrencySymbol(String symbol)\n {\n if (symbol == null)\n {\n symbol = DEFAULT_CURRENCY_SYMBOL;\n }\n\n set(ProjectField.CURRENCY_SYMBOL, symbol);\n }",
"public static crvserver_policymap_binding[] get(nitro_service service, String name) throws Exception{\n\t\tcrvse... |
Adds an additional label to the constructed document.
@param text
the text of the label
@param languageCode
the language code of the label
@return builder object to continue construction | [
"public T withLabel(String text, String languageCode) {\n\t\twithLabel(factory.getMonolingualTextValue(text, languageCode));\n\t\treturn getThis();\n\t}"
] | [
"public DbInfo info() {\n return client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).getDatabaseUri(),\n DbInfo.class);\n }",
"public double Function2D(double x, double y) {\n return Math.exp(-(x * x + y * y) / (2 * sqrSigma)) / (2 * Math.PI * sqrSigma);\n }",
"publi... |
Helper to read a mandatory String value.
@param path The XML path of the element to read.
@return The String value stored in the XML.
@throws Exception thrown if the value could not be read. | [
"private String parseMandatoryStringValue(final String path) throws Exception {\n\n final String value = parseOptionalStringValue(path);\n if (value == null) {\n throw new Exception();\n }\n return value;\n }"
] | [
"private void checkMessageID(Message message) {\n if (!MessageUtils.isOutbound(message)) return;\n\n AddressingProperties maps =\n ContextUtils.retrieveMAPs(message, false, MessageUtils.isOutbound(message));\n if (maps == null) {\n maps = new AddressingProperties();\n ... |
Encrypt a string with AES-128 using the specified key.
@param message Input string.
@param key Encryption key.
@return Encrypted output. | [
"@SuppressWarnings(\"InsecureCryptoUsage\") // Only used in known-weak crypto \"legacy\" mode.\n static byte[] aes128Encrypt(StringBuilder message, String key) {\n try {\n key = normalizeString(key, 16);\n rightPadString(message, '{', 16);\n Cipher cipher = Cipher.getInstance(\"AES/ECB/NoPadding\... | [
"public String getBaselineDurationText()\n {\n Object result = getCachedValue(TaskField.BASELINE_DURATION);\n if (result == null)\n {\n result = getCachedValue(TaskField.BASELINE_ESTIMATED_DURATION);\n }\n\n if (!(result instanceof String))\n {\n result = null;\n ... |
Returns all values that can be selected in the widget.
@param cms the current CMS object
@param rootPath the root path to the currently edited xml file (sitemap config)
@param allRemoved flag, indicating if all inheritedly available formatters should be disabled
@return all values that can be selected in the widget. | [
"public static List<String> getSelectOptionValues(CmsObject cms, String rootPath, boolean allRemoved) {\n\n try {\n cms = OpenCms.initCmsObject(cms);\n cms.getRequestContext().setSiteRoot(\"\");\n CmsADEConfigData adeConfig = OpenCms.getADEManager().lookupConfiguration(cms, r... | [
"public Map<Integer, RandomVariable> getGradient(){\r\n\r\n\t\tint numberOfCalculationSteps = getFunctionList().size();\r\n\r\n\t\tRandomVariable[] omegaHat = new RandomVariable[numberOfCalculationSteps];\r\n\r\n\t\tomegaHat[numberOfCalculationSteps-1] = new RandomVariableFromDoubleArray(1.0);\r\n\r\n\t\tfor(int va... |
This method writes resource data to a PM XML file. | [
"private void writeResources()\n {\n for (Resource resource : m_projectFile.getResources())\n {\n if (resource.getUniqueID().intValue() != 0)\n {\n writeResource(resource);\n }\n }\n }"
] | [
"static JDOClass getJDOClass(Class c)\r\n\t{\r\n\t\tJDOClass rc = null;\r\n\t\ttry\r\n\t\t{\r\n\t\t\tJavaModelFactory javaModelFactory = RuntimeJavaModelFactory.getInstance();\r\n\t\t\tJavaModel javaModel = javaModelFactory.getJavaModel(c.getClassLoader());\r\n\t\t\tJDOModel m = JDOModelFactoryImpl.getInstance().ge... |
Calculate standart deviation.
@param values Values.
@param mean Mean.
@return Standart deviation. | [
"public static double StdDev( int[] values, double mean ){\n double stddev = 0;\n double diff;\n int hits;\n int total = 0;\n\n // for all values\n for ( int i = 0, n = values.length; i < n; i++ )\n {\n hits = values[i];\n diff = (doub... | [
"public static Map<Integer, Integer> getMapOfContiguousPartitions(final Cluster cluster,\n int zoneId) {\n List<Integer> partitionIds = new ArrayList<Integer>(cluster.getPartitionIdsInZone(zoneId));\n Map<Integer, Integer> partitionId... |
currently does not support paths with name constrains | [
"private static List<Segment> parseSegments(String origPathStr) {\n String pathStr = origPathStr;\n if (!pathStr.startsWith(\"/\")) {\n pathStr = pathStr + \"/\";\n }\n\n List<Segment> result = new ArrayList<>();\n for (String segmentStr : PATH_SPLITTER.split(pathStr)) ... | [
"private boolean initRequestHandler(SelectionKey selectionKey) {\n ByteBuffer inputBuffer = inputStream.getBuffer();\n int remaining = inputBuffer.remaining();\n\n // Don't have enough bytes to determine the protocol yet...\n if(remaining < 3)\n return true;\n\n byte[] ... |
Adjusts the day in the provided month, that it fits the specified week day.
If there's no match for that provided month, the next possible month is checked.
@param date the date to adjust, with the correct year and month already set. | [
"private void setFittingWeekDay(Calendar date) {\n\n date.set(Calendar.DAY_OF_MONTH, 1);\n int weekDayFirst = date.get(Calendar.DAY_OF_WEEK);\n int firstFittingWeekDay = (((m_weekDay.toInt() + I_CmsSerialDateValue.NUM_OF_WEEKDAYS) - weekDayFirst)\n % I_CmsSerialDateValue.NUM_OF_WEEKD... | [
"@SuppressWarnings(\"deprecation\")\n protected ModelNode executeReadOnlyOperation(final ModelNode operation, final OperationMessageHandler handler, final OperationTransactionControl control, final OperationStepHandler prepareStep, final int operationId) {\n final AbstractOperationContext delegateContext ... |
Parse one resource to a shape object and add it to the shapes array
@param shapes
@param flatJSON
@param resourceId
@throws org.json.JSONException | [
"private static void parseRessource(ArrayList<Shape> shapes,\n HashMap<String, JSONObject> flatJSON,\n String resourceId,\n Boolean keepGlossaryLink)\n throws JSONException {\n JSONObj... | [
"public static void touch(final File folder , final String fileName) throws IOException {\n if(!folder.exists()){\n folder.mkdirs();\n }\n\n final File touchedFile = new File(folder, fileName);\n\n // The JVM will only 'touch' the file if you instantiate a\n // FileOutp... |
Deletes all of the Directories in root that match the FileFilter
@param root
@param filter | [
"private static void deleteUserDirectories(final File root,\n final FileFilter filter) {\n final File[] dirs = root.listFiles(filter);\n LOGGER.info(\"Identified (\" + dirs.length + \") directories to delete\");\n for (final File dir : dirs) {\n ... | [
"public static CmsUUID readId(JSONObject obj, String key) {\n\n String strValue = obj.optString(key);\n if (!CmsUUID.isValidUUID(strValue)) {\n return null;\n }\n return new CmsUUID(strValue);\n }",
"public static void Forward(double[] data) {\n\n double[] result =... |
Remove a connection from all keys.
@param connection
the connection | [
"public void signOff(WebSocketConnection connection) {\n for (ConcurrentMap<WebSocketConnection, WebSocketConnection> connections : registry.values()) {\n connections.remove(connection);\n }\n }"
] | [
"public void addProcedure(ProcedureDef procDef)\r\n {\r\n procDef.setOwner(this);\r\n _procedures.put(procDef.getName(), procDef);\r\n }",
"public static <K, V> QueuedKeyedResourcePool<K, V> create(ResourceFactory<K, V> factory) {\n return create(factory, new ResourcePoolConfig());\n ... |
Creates a pattern choice radio button and adds it where necessary.
@param pattern the pattern that should be chosen by the button.
@param messageKey the message key for the button's label. | [
"private void createAndAddButton(PatternType pattern, String messageKey) {\n\n CmsRadioButton btn = new CmsRadioButton(pattern.toString(), Messages.get().key(messageKey));\n btn.addStyleName(I_CmsWidgetsLayoutBundle.INSTANCE.widgetCss().radioButtonlabel());\n btn.setGroup(m_groupPattern);\n ... | [
"private void logShort(CharSequence message, boolean trim) throws IOException {\n int length = message.length();\n if (trim) {\n while (length > 0 && Character.isWhitespace(message.charAt(length - 1))) {\n length--;\n }\n }\n\n char [] chars = new char [length + 1];\n for (int i = 0;... |
We have received an update that invalidates the waveform detail for a player, so clear it and alert
any listeners if this represents a change. This does not affect the hot cues; they will stick around until the
player loads a new track that overwrites one or more of them.
@param update the update which means we have n... | [
"private void clearDeckDetail(TrackMetadataUpdate update) {\n if (detailHotCache.remove(DeckReference.getDeckReference(update.player, 0)) != null) {\n deliverWaveformDetailUpdate(update.player, null);\n }\n }"
] | [
"public double[] getBasisVector( int which ) {\n if( which < 0 || which >= numComponents )\n throw new IllegalArgumentException(\"Invalid component\");\n\n DMatrixRMaj v = new DMatrixRMaj(1,A.numCols);\n CommonOps_DDRM.extract(V_t,which,which+1,0,A.numCols,v,0,0);\n\n return v... |
Processes an index descriptor tag.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException If an error occurs
@doc.tag type="content"
@doc.param name="documentation" optional="true" description="Documentation on... | [
"public String processIndexDescriptor(Properties attributes) throws XDocletException\r\n {\r\n String name = attributes.getProperty(ATTRIBUTE_NAME);\r\n IndexDescriptorDef indexDef = _curClassDef.getIndexDescriptor(name);\r\n String attrName;\r\n \r\n ... | [
"@Override\n public <K, V> StoreClient<K, V> getStoreClient(final String storeName,\n final InconsistencyResolver<Versioned<V>> resolver) {\n // wrap it in LazyStoreClient here so any direct calls to this method\n // returns a lazy client\n r... |
resolves a Field or Property node generics by using the current class and
the declaring class to extract the right meaning of the generics symbols
@param an a FieldNode or PropertyNode
@param type the origin type
@return the new ClassNode with corrected generics | [
"private ClassNode getGenericsResolvedTypeOfFieldOrProperty(AnnotatedNode an, ClassNode type) {\n if (!type.isUsingGenerics()) return type;\n Map<String, GenericsType> connections = new HashMap();\n //TODO: inner classes mean a different this-type. This is ignored here!\n extractGenerics... | [
"private long getTotalTime(ProjectCalendarDateRanges exception)\n {\n long total = 0;\n for (DateRange range : exception)\n {\n total += getTime(range.getStart(), range.getEnd());\n }\n return (total);\n }",
"public void addExportedPackages(String... exportedPackages) {\n\t\tS... |
Returns value as it appeared on the command line with escape sequences
and system properties not resolved. The variables, though, are resolved
during the initial parsing of the command line.
@param parsedLine parsed command line
@param required whether the argument is required
@return argument value as it appears o... | [
"public String getOriginalValue(ParsedCommandLine parsedLine, boolean required) throws CommandFormatException {\n String value = null;\n if(parsedLine.hasProperties()) {\n if(index >= 0) {\n List<String> others = parsedLine.getOtherProperties();\n if(others.siz... | [
"public static long count(nitro_service service, String certkey) throws Exception{\n\t\tsslcertkey_crldistribution_binding obj = new sslcertkey_crldistribution_binding();\n\t\tobj.set_certkey(certkey);\n\t\toptions option = new options();\n\t\toption.set_count(true);\n\t\tsslcertkey_crldistribution_binding response... |
Returns true if the input is a vector
@param a A matrix or vector
@return true if it's a vector. Column or row. | [
"public static boolean isVector(DMatrixSparseCSC a) {\n return (a.numCols == 1 && a.numRows > 1) || (a.numRows == 1 && a.numCols>1);\n }"
] | [
"protected SingleBusLocatorRegistrar getRegistrar(Bus bus) {\n SingleBusLocatorRegistrar registrar = busRegistrars.get(bus);\n if (registrar == null) {\n check(locatorClient, \"serviceLocator\", \"registerService\");\n registrar = new SingleBusLocatorRegistrar(bus);\n ... |
for testing purpose | [
"public boolean hasCachedValue(Key key) {\n\t\ttry {\n\t\t\treadLock.lock();\n\t\t\treturn content.containsKey(key);\n\t\t} finally {\n\t\t\treadLock.unlock();\n\t\t}\n\t}"
] | [
"public static final String printBookingType(BookingType value)\n {\n return (Integer.toString(value == null ? BookingType.COMMITTED.getValue() : value.getValue()));\n }",
"public static int skipToNextMatchingShort(byte[] buffer, int offset, int value)\n {\n int nextOffset = offset;\n while (... |
Detects if the current browser is a BlackBerry Touch
device, such as the Storm, Torch, and Bold Touch. Excludes the Playbook.
@return detection of a Blackberry touchscreen device | [
"public boolean detectBlackBerryTouch() {\r\n\r\n if (detectBlackBerry()\r\n && ((userAgent.indexOf(deviceBBStorm) != -1)\r\n || (userAgent.indexOf(deviceBBTorch) != -1)\r\n || (userAgent.indexOf(deviceBBBoldTouch) != -1)\r\n || (userAgent.indexOf(devic... | [
"public void selectTab() {\n for (Widget child : getChildren()) {\n if (child instanceof HasHref) {\n String href = ((HasHref) child).getHref();\n if (parent != null && !href.isEmpty()) {\n parent.selectTab(href.replaceAll(\"[^a-zA-Z\\\\d\\\\s:]\", ... |
Parses formatter attributes.
@param formatterLoc the node location
@return the map of formatter attributes (unmodifiable) | [
"private Map<String, String> parseAttributes(I_CmsXmlContentLocation formatterLoc) {\n\n Map<String, String> result = new LinkedHashMap<>();\n for (I_CmsXmlContentValueLocation mappingLoc : formatterLoc.getSubValues(N_ATTRIBUTE)) {\n String key = CmsConfigurationReader.getString(m_cms, mapp... | [
"protected boolean isDuplicate(String eventID) {\n if (this.receivedEvents == null) {\n this.receivedEvents = new LRUCache<String>();\n }\n\n return !this.receivedEvents.add(eventID);\n }",
"public ImmutableList<AbstractElement> getFirstSetGrammarElements() {\n\t\tif (firstSetGr... |
Set the repeat count of an override at ordinal index
@param pathName Path name
@param methodName Fully qualified method name
@param ordinal 1-based index of the override within the overrides of type methodName
@param repeatCount new repeat count to set
@return true if success, false otherwise | [
"public boolean setOverrideRepeatCount(String pathName, String methodName, Integer ordinal, Integer repeatCount) {\n try {\n String methodId = getOverrideIdForMethodName(methodName).toString();\n BasicNameValuePair[] params = {\n new BasicNameValuePair(\"profileIdentifier... | [
"protected boolean exportWithMinimalMetaData(String path) {\n\n String checkPath = path.startsWith(\"/\") ? path + \"/\" : \"/\" + path + \"/\";\n for (String p : m_parameters.getResourcesToExportWithMetaData()) {\n if (checkPath.startsWith(p)) {\n return false;\n ... |
Extract the generic type from the given Class object.
@param clazz the Class to check
@param source the expected raw source type (can be {@code null})
@param typeIndex the index of the actual type argument
@param nestingLevel the nesting level of the target type
@param currentLevel the current nested level
@return the ... | [
"private static Class<?> extractTypeFromClass(Class<?> clazz, Class<?> source, int typeIndex,\n\t\t\tMap<TypeVariable, Type> typeVariableMap, Map<Integer, Integer> typeIndexesPerLevel,\n\t\t\tint nestingLevel, int currentLevel) {\n\n\t\tif (clazz.getName().startsWith(\"java.util.\")) {\n\t\t\treturn null;\n\t\t}\n\... | [
"void lockInterruptibly(final Integer permit) throws InterruptedException {\n if (permit == null) {\n throw new IllegalArgumentException();\n }\n sync.acquireInterruptibly(permit);\n }",
"public static synchronized void unregisterDao(ConnectionSource connectionSource, Dao<?, ?> ... |
Shutdown the socket server | [
"public void close() {\n Closer.closeQuietly(acceptor);\n for (Processor processor : processors) {\n Closer.closeQuietly(processor);\n }\n }"
] | [
"private Collection parseCollection(Element collectionElement) {\n\n Collection collection = new Collection();\n collection.setId(collectionElement.getAttribute(\"id\"));\n collection.setServer(collectionElement.getAttribute(\"server\"));\n collection.setSecret(collectionElement.getAttri... |
Initialization necessary for editing a property bundle.
@throws CmsLoaderException thrown if loading a bundle file fails.
@throws CmsException thrown if loading a bundle file fails.
@throws IOException thrown if loading a bundle file fails. | [
"private void initPropertyBundle() throws CmsLoaderException, CmsException, IOException {\n\n for (Locale l : m_locales) {\n String filePath = m_sitepath + m_basename + \"_\" + l.toString();\n CmsResource resource = null;\n if (m_cms.existsResource(\n filePath,... | [
"private static Set<String> imageOrientationsOf(ImageMetadata metadata) {\n\n String exifIFD0DirName = new ExifIFD0Directory().getName();\n\n Tag[] tags = Arrays.stream(metadata.getDirectories())\n .filter(dir -> dir.getName().equals(exifIFD0DirName))\n .findFirst()\n .map(Dir... |
Gets the index of the specified value.
@param value the value of the item to be found
@return the index of the value | [
"public int getIndex(T value) {\n int count = getItemCount();\n for (int i = 0; i < count; i++) {\n if (Objects.equals(getValue(i), value)) {\n return i;\n }\n }\n return -1;\n }"
] | [
"public <T> void cleanNullReferencesAll() {\n\t\tfor (Map<Object, Reference<Object>> objectMap : classMaps.values()) {\n\t\t\tcleanMap(objectMap);\n\t\t}\n\t}",
"public static vpath get(nitro_service service, String name) throws Exception{\n\t\tvpath obj = new vpath();\n\t\tobj.set_name(name);\n\t\tvpath response... |
Switches from a dense to sparse matrix | [
"public void convertToSparse() {\n switch ( mat.getType() ) {\n case DDRM: {\n DMatrixSparseCSC m = new DMatrixSparseCSC(mat.getNumRows(), mat.getNumCols());\n ConvertDMatrixStruct.convert((DMatrixRMaj) mat, m,0);\n setMatrix(m);\n } break;\n... | [
"public ArtifactName build() {\n String groupId = this.groupId;\n String artifactId = this.artifactId;\n String classifier = this.classifier;\n String packaging = this.packaging;\n String version = this.version;\n if (artifact != null && !artifact.isEmpty()) {\n ... |
Validate that the Unique IDs for the entities in this container are valid for MS Project.
If they are not valid, i.e one or more of them are too large, renumber them. | [
"public void validateUniqueIDsForMicrosoftProject()\n {\n if (!isEmpty())\n {\n for (T entity : this)\n {\n if (NumberHelper.getInt(entity.getUniqueID()) > MS_PROJECT_MAX_UNIQUE_ID)\n {\n renumberUniqueIDs();\n break;\n }\n ... | [
"public static base_response Import(nitro_service client, appfwsignatures resource) throws Exception {\n\t\tappfwsignatures Importresource = new appfwsignatures();\n\t\tImportresource.src = resource.src;\n\t\tImportresource.name = resource.name;\n\t\tImportresource.xslt = resource.xslt;\n\t\tImportresource.comment ... |
Check whether error handling works. If it works, you should see an
ok, otherwise, you might see the actual error message and then
the program exits. | [
"public static void checkXerbla() {\n double[] x = new double[9];\n System.out.println(\"Check whether we're catching XERBLA errors. If you see something like \\\"** On entry to DGEMM parameter number 4 had an illegal value\\\", it didn't work!\");\n try {\n NativeBlas.dgemm('N', '... | [
"public Iterator<BoxItem.Info> iterator() {\n URL url = GET_ITEMS_URL.build(this.api.getBaseURL());\n return new BoxItemIterator(this.api, url);\n }",
"public static URL getAuthorizationURL(String clientID, URI redirectUri, String state, List<String> scopes) {\n URLTemplate template = new ... |
Returns the text content to any HTML.
@param html the HTML
@return the text content | [
"public static String stripHtml(String html) {\n\n if (html == null) {\n return null;\n }\n Element el = DOM.createDiv();\n el.setInnerHTML(html);\n return el.getInnerText();\n }"
] | [
"protected void processTusFiles(String assemblyUrl) throws IOException, ProtocolException {\n tusClient.setUploadCreationURL(new URL(getClient().getHostUrl() + \"/resumable/files/\"));\n tusClient.enableResuming(tusURLStore);\n\n for (Map.Entry<String, File> entry : files.entrySet()) {\n ... |
Generates a schedule based on some meta data. The schedule generation
considers short periods.
@param referenceDate The date which is used in the schedule to internally convert dates to doubles, i.e., the date where t=0.
@param startDate The start date of the first period.
@param frequency The frequency.
@param maturi... | [
"@Deprecated\n\tpublic static Schedule createScheduleFromConventions(\n\t\t\tLocalDate referenceDate,\n\t\t\tLocalDate startDate,\n\t\t\tString frequency,\n\t\t\tdouble maturity,\n\t\t\tString daycountConvention,\n\t\t\tString shortPeriodConvention,\n\t\t\tString dateRollConvention,\n\t\t\tBusinessdayCalendar busin... | [
"public static long count(nitro_service service, String id) throws Exception{\n\t\tlinkset_interface_binding obj = new linkset_interface_binding();\n\t\tobj.set_id(id);\n\t\toptions option = new options();\n\t\toption.set_count(true);\n\t\tlinkset_interface_binding response[] = (linkset_interface_binding[]) obj.get... |
Populates a relation list.
@param task parent task
@param field target task field
@param data MPX relation list data | [
"private void populateRelationList(Task task, TaskField field, String data)\n {\n DeferredRelationship dr = new DeferredRelationship();\n dr.setTask(task);\n dr.setField(field);\n dr.setData(data);\n m_deferredRelationships.add(dr);\n }"
] | [
"private void setFields(Map<String, FieldType> map, MapRow row, FieldContainer container)\n {\n if (row != null)\n {\n for (Map.Entry<String, FieldType> entry : map.entrySet())\n {\n container.set(entry.getValue(), row.getObject(entry.getKey()));\n }\n }\n }",
... |
Check the given URI to see if it matches.
@param matchInfo the matchInfo to validate.
@return True if it matches. | [
"@Override\n public final Optional<Boolean> tryOverrideValidation(final MatchInfo matchInfo) throws SocketException,\n UnknownHostException, MalformedURLException {\n for (AddressHostMatcher addressHostMatcher: this.matchersForHost) {\n if (addressHostMatcher.matches(matchInfo)) {\n ... | [
"public static Object instantiate(Class clazz) throws InstantiationException\r\n {\r\n Object result = null;\r\n try\r\n {\r\n result = ClassHelper.newInstance(clazz);\r\n }\r\n catch(IllegalAccessException e)\r\n {\r\n try\r\n {\r\n ... |
Process class properties.
@param writer output stream
@param methodSet set of methods processed
@param aClass class being processed
@throws IntrospectionException
@throws XMLStreamException | [
"private void processProperties(XMLStreamWriter writer, Set<Method> methodSet, Class<?> aClass) throws IntrospectionException, XMLStreamException\n {\n BeanInfo beanInfo = Introspector.getBeanInfo(aClass, aClass.getSuperclass());\n PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescripto... | [
"private String mountPath(CdjStatus.TrackSourceSlot slot) {\n switch (slot) {\n case SD_SLOT: return \"/B/\";\n case USB_SLOT: return \"/C/\";\n }\n throw new IllegalArgumentException(\"Don't know how to NFS mount filesystem for slot \" + slot);\n }",
"public final st... |
Reads a quoted string value from the request. | [
"protected String consumeQuoted(ImapRequestLineReader request)\n throws ProtocolException {\n // The 1st character must be '\"'\n consumeChar(request, '\"');\n\n StringBuilder quoted = new StringBuilder();\n char next = request.nextChar();\n while (next != '\"') {\n ... | [
"protected void checkScopeAllowed() {\n if (ejbDescriptor.isStateless() && !isDependent()) {\n throw BeanLogger.LOG.scopeNotAllowedOnStatelessSessionBean(getScope(), getType());\n }\n if (ejbDescriptor.isSingleton() && !(isDependent() || getScope().equals(ApplicationScoped.class))) {... |
Parses a String email address to an IMAP address string. | [
"private String parseAddress(String address) {\r\n try {\r\n StringBuilder buf = new StringBuilder();\r\n InternetAddress[] netAddrs = InternetAddress.parseHeader(address, false);\r\n for (InternetAddress netAddr : netAddrs) {\r\n if (buf.length() > 0) {\r\n ... | [
"private FieldDescriptorDef cloneField(FieldDescriptorDef fieldDef, String prefix)\r\n {\r\n FieldDescriptorDef copyFieldDef = new FieldDescriptorDef(fieldDef, prefix);\r\n\r\n copyFieldDef.setOwner(this);\r\n // we remove properties that are only relevant to the class the features are decla... |
Retrieve a duration in the form required by Phoenix.
@param duration Duration instance
@return formatted duration | [
"public static final String printDuration(Duration duration)\n {\n String result = null;\n if (duration != null)\n {\n result = duration.getDuration() + \" \" + printTimeUnits(duration.getUnits());\n }\n return result;\n }"
] | [
"protected List<CmsUUID> undelete() throws CmsException {\n\n List<CmsUUID> modifiedResources = new ArrayList<CmsUUID>();\n CmsObject cms = m_context.getCms();\n for (CmsResource resource : m_context.getResources()) {\n CmsLockActionRecord actionRecord = null;\n try {\n ... |
Drives the unit test. | [
"public HiveShellContainer evaluateStatement(List<? extends Script> scripts, Object target, TemporaryFolder temporaryFolder, Statement base) throws Throwable {\n container = null;\n FileUtil.setPermission(temporaryFolder.getRoot(), FsPermission.getDirDefault());\n try {\n LOGGER.info... | [
"public static Object getObjectFromColumn(ResultSet rs, Integer jdbcType, int columnId)\r\n throws SQLException\r\n {\r\n return getObjectFromColumn(rs, null, jdbcType, null, columnId);\r\n }",
"@Override\n public String getText() {\n String retType = AstToTextHelper.getClassText... |
Process an operand value used in the definition of the graphical
indicator criteria.
@param index position in operand list
@param type field type
@param criteria indicator criteria | [
"private void processOperandValue(int index, FieldType type, GraphicalIndicatorCriteria criteria)\n {\n boolean valueFlag = (MPPUtility.getInt(m_data, m_dataOffset) == 1);\n m_dataOffset += 4;\n\n if (valueFlag == false)\n {\n int fieldID = MPPUtility.getInt(m_data, m_dataOffset);\n ... | [
"public static DatagramPacket buildPacket(PacketType type, ByteBuffer deviceName, ByteBuffer payload) {\n ByteBuffer content = ByteBuffer.allocate(0x1f + payload.remaining());\n content.put(getMagicHeader());\n content.put(type.protocolValue);\n content.put(deviceName);\n content.... |
Wraps a linear solver of any type with a safe solver the ensures inputs are not modified | [
"public static <S extends Matrix, D extends Matrix> LinearSolver<S,D> safe(LinearSolver<S,D> solver ) {\n if( solver.modifiesA() || solver.modifiesB() ) {\n if( solver instanceof LinearSolverDense ) {\n return new LinearSolverSafe((LinearSolverDense)solver);\n } else ... | [
"public static final Number parseUnits(Number value)\n {\n return (value == null ? null : NumberHelper.getDouble(value.doubleValue() * 100));\n }",
"public static final PolylineOptions buildOpenArc(LatLong center, LatLong start, LatLong end) {\n MVCArray res = buildArcPoints(center, start, end);\n... |
Return cached object by key. The key will be concatenated with
current session id when fetching the cached object
@param key
@param <T>
the object type
@return the cached object | [
"public <T> T cached(String key) {\n H.Session sess = session();\n if (null != sess) {\n return sess.cached(key);\n } else {\n return app().cache().get(key);\n }\n }"
] | [
"public static Chart getMSDLineChart(Trajectory t, int lagMin, int lagMax) {\n\t\treturn getMSDLineChart(t, lagMin, lagMax, new MeanSquaredDisplacmentFeature(t,\n\t\t\t\tlagMin));\n\t}",
"public static base_responses add(nitro_service client, vlan resources[]) throws Exception {\n\t\tbase_responses result = null;... |
Retrieve the ordinal text for a given integer.
@param value integer value
@return ordinal text | [
"private String getOrdinal(Integer value)\n {\n String result;\n int index = value.intValue();\n if (index >= ORDINAL.length)\n {\n result = \"every \" + index + \"th\";\n }\n else\n {\n result = ORDINAL[index];\n }\n return result;\n }"
] | [
"public AT_Row setPaddingRightChar(Character paddingRightChar) {\r\n\t\tif(this.hasCells()){\r\n\t\t\tfor(AT_Cell cell : this.getCells()){\r\n\t\t\t\tcell.getContext().setPaddingRightChar(paddingRightChar);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}",
"public void setKey(int keyIndex, float time, final float[... |
Write resource assignment.
@param record resource assignment instance
@throws IOException | [
"private void writeResourceAssignment(ResourceAssignment record) throws IOException\n {\n m_buffer.setLength(0);\n\n m_buffer.append(MPXConstants.RESOURCE_ASSIGNMENT_RECORD_NUMBER);\n m_buffer.append(m_delimiter);\n m_buffer.append(formatResource(record.getResource()));\n m_buffer.append(... | [
"public static Command newInsert(Object object,\n String outIdentifier,\n boolean returnObject,\n String entryPoint ) {\n return getCommandFactoryProvider().newInsert( object,\n ... |
This method retrieves a Duration instance representing the amount of
work between two dates based on this calendar.
@param startDate start date
@param endDate end date
@param format required duration format
@return amount of work | [
"public Duration getWork(Date startDate, Date endDate, TimeUnit format)\n {\n DateRange range = new DateRange(startDate, endDate);\n Long cachedResult = m_workingDateCache.get(range);\n long totalTime = 0;\n\n if (cachedResult == null)\n {\n //\n // We want the start date ... | [
"public String text() {\n String previousText = null;\n StringBuilder buffer = null;\n for (Object child : this) {\n String text = null;\n if (child instanceof String) {\n text = (String) child;\n } else if (child instanceof Node) {\n ... |
Sets the value for the API's "languages" parameter based on the current
settings.
@param properties
current setting of parameters | [
"private void setRequestLanguages(WbGetEntitiesActionData properties) {\n\t\tif (this.filter.excludeAllLanguages()\n\t\t\t\t|| this.filter.getLanguageFilter() == null) {\n\t\t\treturn;\n\t\t}\n\t\tproperties.languages = ApiConnection.implodeObjects(this.filter\n\t\t\t\t.getLanguageFilter());\n\t}"
] | [
"public String putProperty(String key,\n String value) {\n return this.getProperties().put(key,\n value);\n }",
"public static final BigInteger printEarnedValueMethod(EarnedValueMethod value)\n {\n return (value == null ? BigInte... |
handles when a member leaves and hazelcast partition data is lost. We want
to find the Futures that are waiting on lost data and error them | [
"public void errorFuture(UUID taskId, Exception e) {\n DistributedFuture<GROUP, Serializable> future = remove(taskId);\n if(future != null) {\n future.setException(e);\n }\n }"
] | [
"@RequestMapping(value=\"/soy/compileJs\", method=GET)\n public ResponseEntity<String> compile(@RequestParam(required = false, value=\"hash\", defaultValue = \"\") final String hash,\n @RequestParam(required = true, value = \"file\") final String[] templ... |
Finishes the current box - empties the text line buffer and creates a DOM element from it. | [
"protected void finishBox()\n {\n \tif (textLine.length() > 0)\n \t{\n String s;\n if (isReversed(Character.getDirectionality(textLine.charAt(0))))\n s = textLine.reverse().toString();\n else\n s = textLine.toString();\n\n curstyle.s... | [
"private void deleteLinks(@NotNull final PersistentStoreTransaction txn, @NotNull final PersistentEntity entity) {\n final PersistentEntityId id = entity.getId();\n final int entityTypeId = id.getTypeId();\n final long entityLocalId = id.getLocalId();\n final Transaction envTxn = txn.get... |
Creates an attachment from a given array of bytes.
The bytes will be Base64 encoded.
@throws java.lang.IllegalArgumentException if mediaType is not binary | [
"public static Attachment fromBinaryBytes( byte[] bytes, MediaType mediaType ) {\n if( !mediaType.isBinary() ) {\n throw new IllegalArgumentException( \"MediaType must be binary\" );\n }\n return new Attachment(BaseEncoding.base64().encode( bytes ), mediaType, null );\n }"
] | [
"@RequestMapping(value = \"/api/profile/{profileIdentifier}/clients/delete\", method = RequestMethod.POST)\n public\n @ResponseBody\n HashMap<String, Object> deleteClient(Model model,\n @RequestParam(\"profileIdentifier\") String profileIdentifier,\n ... |
Add "GROUP BY" clause to the SQL query statement. This can be called multiple times to add additional "GROUP BY"
clauses.
<p>
NOTE: Use of this means that the resulting objects may not have a valid ID column value so cannot be deleted or
updated.
</p> | [
"public QueryBuilder<T, ID> groupBy(String columnName) {\n\t\tFieldType fieldType = verifyColumnName(columnName);\n\t\tif (fieldType.isForeignCollection()) {\n\t\t\tthrow new IllegalArgumentException(\"Can't groupBy foreign collection field: \" + columnName);\n\t\t}\n\t\taddGroupBy(ColumnNameOrRawSql.withColumnName... | [
"public double getCouponPayment(int periodIndex, AnalyticModel model) {\n\n\t\tForwardCurve forwardCurve = model.getForwardCurve(forwardCurveName);\n\t\tif(forwardCurve == null && forwardCurveName != null && forwardCurveName.length() > 0) {\n\t\t\tthrow new IllegalArgumentException(\"No forward curve with name '\" ... |
Gets the positive integer.
@param number the number
@return the positive integer | [
"private int getPositiveInteger(String number) {\n try {\n return Math.max(0, Integer.parseInt(number));\n } catch (NumberFormatException e) {\n return 0;\n }\n }"
] | [
"public ProviderContextBuilder setRateTypes(Collection<RateType> rateTypes) {\n Objects.requireNonNull(rateTypes);\n if (rateTypes.isEmpty()) {\n throw new IllegalArgumentException(\"At least one RateType is required.\");\n }\n Set<RateType> rtSet = new HashSet<>(rateTypes);\n... |
Deletes a story. A user can only delete stories they have created. Returns an empty data record.
@param story Globally unique identifier for the story.
@return Request object | [
"public ItemRequest<Story> delete(String story) {\n \n String path = String.format(\"/stories/%s\", story);\n return new ItemRequest<Story>(this, Story.class, path, \"DELETE\");\n }"
] | [
"int add(DownloadRequest request) {\n\t\tint downloadId = getDownloadId();\n\t\t// Tag the request as belonging to this queue and add it to the set of current requests.\n\t\trequest.setDownloadRequestQueue(this);\n\n\t\tsynchronized (mCurrentRequests) {\n\t\t\tmCurrentRequests.add(request);\n\t\t}\n\n\t\t// Process... |
Iterates through the range of prefixes in this range instance using the given prefix length.
@param prefixLength
@return | [
"@Override\n\tpublic Iterator<? extends IPAddressSeqRange> prefixIterator(int prefixLength) {\n\t\tif(!isMultiple()) {\n\t\t\treturn new Iterator<IPAddressSeqRange>() {\n\t\t\t\tIPAddressSeqRange orig = IPAddressSeqRange.this;\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean hasNext() {\n\t\t\t\t\treturn orig != null;\... | [
"synchronized boolean markReadMessageForId(String messageId, String userId){\n if(messageId == null || userId == null) return false;\n\n final String tName = Table.INBOX_MESSAGES.getName();\n try{\n final SQLiteDatabase db = dbHelper.getWritableDatabase();\n ContentValues ... |
Use this API to add dospolicy. | [
"public static base_response add(nitro_service client, dospolicy resource) throws Exception {\n\t\tdospolicy addresource = new dospolicy();\n\t\taddresource.name = resource.name;\n\t\taddresource.qdepth = resource.qdepth;\n\t\taddresource.cltdetectrate = resource.cltdetectrate;\n\t\treturn addresource.add_resource(... | [
"public Class<?> getType(String key) {\n Object val = this.data.get(key);\n return val == null ? null : val.getClass();\n }",
"public static <T extends Spin<?>> T S(Object input, DataFormat<T> format) {\n return SpinFactory.INSTANCE.createSpin(input, format);\n }",
"private boolean isWorkin... |
Convenience routine to move to the next iterator if needed.
@return true if the iterator is changed, false if no changes. | [
"private boolean setNextIterator()\r\n {\r\n boolean retval = false;\r\n // first, check if the activeIterator is null, and set it.\r\n if (m_activeIterator == null)\r\n {\r\n if (m_rsIterators.size() > 0)\r\n {\r\n m_activeIteratorIndex = 0;\r\n ... | [
"private void populateAnnotations(Collection<Annotation> annotations) {\n for (Annotation each : annotations) {\n this.annotations.put(each.annotationType(), each);\n }\n }",
"public void classifyAndWriteViterbiSearchGraph(String testFile, String searchGraphPrefix, DocumentReaderAndWri... |
Passes the Socket's InputStream and OutputStream to the closure. The
streams will be closed after the closure returns, even if an exception
is thrown.
@param socket a Socket
@param closure a Closure
@return the value returned by the closure
@throws IOException if an IOException occurs.
@since 1.5.2 | [
"public static <T> T withStreams(Socket socket, @ClosureParams(value=SimpleType.class, options={\"java.io.InputStream\",\"java.io.OutputStream\"}) Closure<T> closure) throws IOException {\n InputStream input = socket.getInputStream();\n OutputStream output = socket.getOutputStream();\n try {\n ... | [
"static String from(Class<?> entryClass) {\n List<String> tokens = tokenOf(entryClass);\n return fromTokens(tokens);\n }",
"public static CallSite bootstrapCurrent(Lookup caller, String name, MethodType type) {\n return realBootstrap(caller, name, CALL_TYPES.METHOD.ordinal(), type, fal... |
Return the entity of a resource
@param resource the resource
@param <T> the type of the resource's entity
@param <R> the resource type
@return the resource's entity | [
"public static <T, R extends Resource<T>> T getEntity(R resource) {\n return resource.getEntity();\n }"
] | [
"public Date getPreviousWorkFinish(Date date)\n {\n Calendar cal = Calendar.getInstance();\n cal.setTime(date);\n updateToPreviousWorkFinish(cal);\n return cal.getTime();\n }",
"public void useNewRESTServiceWithOldClient() throws Exception {\n List<Object> providers = createJAXRSPro... |
Logs all properties | [
"public void print() {\n Iterator<String> iter = getKeys();\n while (iter.hasNext()) {\n String key = iter.next();\n log.info(key + \" = \" + getRawString(key));\n }\n }"
] | [
"protected String getBasePath(String rootPath) {\r\n\r\n if (rootPath.endsWith(INHERITANCE_CONFIG_FILE_NAME)) {\r\n return rootPath.substring(0, rootPath.length() - INHERITANCE_CONFIG_FILE_NAME.length());\r\n }\r\n return rootPath;\r\n }",
"private void readProjectProperties(Pro... |
Checks if the categoryfolder setting needs to be updated.
@return true if the categoryfolder setting needs to be updated | [
"public boolean needToSetCategoryFolder() {\n\n if (m_adeModuleVersion == null) {\n return true;\n }\n CmsModuleVersion categoryFolderUpdateVersion = new CmsModuleVersion(\"9.0.0\");\n return (m_adeModuleVersion.compareTo(categoryFolderUpdateVersion) == -1);\n }"
] | [
"public static double blackScholesDigitalOptionValue(\n\t\t\tdouble initialStockValue,\n\t\t\tdouble riskFreeRate,\n\t\t\tdouble volatility,\n\t\t\tdouble optionMaturity,\n\t\t\tdouble optionStrike)\n\t{\n\t\tif(optionStrike <= 0.0)\n\t\t{\n\t\t\t// The Black-Scholes model does not consider it being an option\n\t\t... |
Return a licenses view of the targeted module
@param moduleId String
@return List<DbLicense> | [
"public List<DbLicense> getModuleLicenses(final String moduleId,\n final LicenseMatcher licenseMatcher) {\n final DbModule module = getModule(moduleId);\n\n final List<DbLicense> licenses = new ArrayList<>();\n final FiltersHolder filters = new Filter... | [
"private void RunScript(InteractiveObject interactiveObject, String functionName, Object[] parameters) {\n boolean complete = false;\n if ( V8JavaScriptEngine) {\n GVRJavascriptV8File gvrJavascriptV8File = interactiveObject.getScriptObject().getGVRJavascriptV8File();\n String par... |
Find the current active layout.
@param phoenixProject phoenix project data
@return current active layout | [
"private Layout getActiveLayout(Project phoenixProject)\n {\n //\n // Start with the first layout we find\n //\n Layout activeLayout = phoenixProject.getLayouts().getLayout().get(0);\n\n //\n // If this isn't active, find one which is... and if none are,\n // we'll just use the ... | [
"public static AnalysisResult fakeSuccess() {\n return new AnalysisResult(null, new Extensions(Collections.emptyMap(), Collections.emptyMap(),\n Collections.emptyMap(), Collections.emptyMap()));\n }",
"public void transform(DataPipe cr) {\n Map<String, String> map = cr.getDataMap()... |
Read the header from the Phoenix file.
@param stream input stream
@return raw header data | [
"private String readHeaderString(BufferedInputStream stream) throws IOException\n {\n int bufferSize = 100;\n stream.mark(bufferSize);\n byte[] buffer = new byte[bufferSize];\n stream.read(buffer);\n Charset charset = CharsetHelper.UTF8;\n String header = new String(buffer, charset);... | [
"public static boolean hasPermission(Permission permission) {\n SecurityManager security = System.getSecurityManager();\n if (security != null) {\n try {\n security.checkPermission(permission);\n } catch (java.security.AccessControlException e) {\n r... |
Use this API to fetch all the autoscaleprofile resources that are configured on netscaler. | [
"public static autoscaleprofile[] get(nitro_service service) throws Exception{\n\t\tautoscaleprofile obj = new autoscaleprofile();\n\t\tautoscaleprofile[] response = (autoscaleprofile[])obj.get_resources(service);\n\t\treturn response;\n\t}"
] | [
"public ItemRequest<CustomField> update(String customField) {\n \n String path = String.format(\"/custom_fields/%s\", customField);\n return new ItemRequest<CustomField>(this, CustomField.class, path, \"PUT\");\n }",
"static Locale getLocale(PageContext pageContext, String name) {\r\n\r\n ... |
Plots the MSD curve for trajectory t.
@param t List of trajectories
@param lagMin Minimum timelag (e.g. 1,2,3..) lagMin*timelag = elapsed time in seconds
@param lagMax Maximum timelag (e.g. 1,2,3..) lagMax*timelag = elapsed time in seconds | [
"public static Chart getMSDLineChart(Trajectory t, int lagMin, int lagMax) {\n\t\treturn getMSDLineChart(t, lagMin, lagMax, new MeanSquaredDisplacmentFeature(t,\n\t\t\t\tlagMin));\n\t}"
] | [
"public boolean matches(PathAddress address) {\n if (address == null) {\n return false;\n }\n if (equals(address)) {\n return true;\n }\n if (size() != address.size()) {\n return false;\n }\n for (int i = 0; i < size(); i++) {\n ... |
Retrieve a calendar exception which applies to this date.
@param date target date
@return calendar exception, or null if none match this date | [
"public ProjectCalendarException getException(Date date)\n {\n ProjectCalendarException exception = null;\n\n // We're working with expanded exceptions, which includes any recurring exceptions\n // expanded into individual entries.\n populateExpandedExceptions();\n if (!m_expandedExceptio... | [
"static ReadMasterDomainModelUtil readMasterDomainResourcesForInitialConnect(final Transformers transformers,\n final Transformers.TransformationInputs transformationInputs,\n ... |
Converts a tab delimited string into an object with given fields
Requires the object has public access for the specified fields
@param objClass Class of object to be created
@param str string to convert
@param delimiterPattern delimiter
@param fieldNames fieldnames
@param <T> type to return
@return Object created from... | [
"public static <T> T columnStringToObject(Class<?> objClass, String str, Pattern delimiterPattern, String[] fieldNames)\r\n throws InstantiationException, IllegalAccessException, NoSuchMethodException, NoSuchFieldException, InvocationTargetException\r\n {\r\n String[] fields = delimiterPattern.split(st... | [
"private static void reallyValidatePseudoScopedBean(Bean<?> bean, BeanManagerImpl beanManager, Set<Object> dependencyPath, Set<Bean<?>> validatedBeans) {\n // see if we have already seen this bean in the dependency path\n if (dependencyPath.contains(bean)) {\n // create a list that shows th... |
Return fallback if first string is null or empty | [
"public static String defaultString(final String str, final String fallback) {\n return isNullOrEmpty(str) ? fallback : str;\n }"
] | [
"private void calculateSCL(double[] x) {\r\n //System.out.println(\"Checking at: \"+x[0]+\" \"+x[1]+\" \"+x[2]);\r\n value = 0.0;\r\n Arrays.fill(derivative, 0.0);\r\n double[] sums = new double[numClasses];\r\n double[] probs = new double[numClasses];\r\n double[] counts = new double[numClasses];... |
Gets the date time str.
@param d
the d
@return the date time str | [
"public static String getDateTimeStr(Date d) {\n if (d == null)\n return \"\";\n\n SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss.SSSZ\");\n // 20140315 test will problem +0000\n return sdf.format(d);\n }"
] | [
"public static nslimitidentifier_stats[] get(nitro_service service) throws Exception{\n\t\tnslimitidentifier_stats obj = new nslimitidentifier_stats();\n\t\tnslimitidentifier_stats[] response = (nslimitidentifier_stats[])obj.stat_resources(service);\n\t\treturn response;\n\t}",
"Path resolveBaseDir(final String n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.