query
stringlengths
7
3.3k
positive
listlengths
1
1
negative
listlengths
9
9
TestNG returns a compound thread ID that includes the thread name and its numeric ID, separated by an 'at' sign. We only want to use the thread name as the ID is mostly unimportant and it takes up too much space in the generated report. @param threadId The compound thread ID. @return The thread name.
[ "public String stripThreadName(String threadId)\n {\n if (threadId == null)\n {\n return null;\n }\n else\n {\n int index = threadId.lastIndexOf('@');\n return index >= 0 ? threadId.substring(0, index) : threadId;\n }\n }" ]
[ "public static sslservice get(nitro_service service, String servicename) throws Exception{\n\t\tsslservice obj = new sslservice();\n\t\tobj.set_servicename(servicename);\n\t\tsslservice response = (sslservice) obj.get_resource(service);\n\t\treturn response;\n\t}", "private void createFrameset(File outputDirector...
This method extracts project properties from a GanttProject file. @param ganttProject GanttProject file
[ "private void readProjectProperties(Project ganttProject)\n {\n ProjectProperties mpxjProperties = m_projectFile.getProjectProperties();\n mpxjProperties.setName(ganttProject.getName());\n mpxjProperties.setCompany(ganttProject.getCompany());\n mpxjProperties.setDefaultDurationUnits(TimeUnit.D...
[ "@Override\n\tpublic void close() {\n\t\tlogger.info(\"Finished processing.\");\n\t\tthis.timer.stop();\n\t\tthis.lastSeconds = (int) (timer.getTotalWallTime() / 1000000000);\n\t\tprintStatus();\n\t}", "public void racRent() {\n\t\tpos = pos - 1;\n\t\tString userName = CarSearch.getLastSearchParams()[0];\n\t\tStr...
Returns the index of the segment containing the first byte outside the network prefix. When networkPrefixLength is null, or it matches or exceeds the bit length, returns the segment count. @param networkPrefixLength @param byteLength @return
[ "public static int getHostSegmentIndex(int networkPrefixLength, int bytesPerSegment, int bitsPerSegment) {\n\t\tif(bytesPerSegment > 1) {\n\t\t\tif(bytesPerSegment == 2) {\n\t\t\t\treturn networkPrefixLength >> 4;\n\t\t\t}\n\t\t\treturn networkPrefixLength / bitsPerSegment;\n\t\t}\n\t\treturn networkPrefixLength >>...
[ "@SafeVarargs\n public static <K> Set<K> set(final K... keys) {\n return new LinkedHashSet<K>(Arrays.asList(keys));\n }", "public Where<T, ID> eq(String columnName, Object value) throws SQLException {\n\t\taddClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,\n\t\t\t\tSim...
Commit an upload session after all parts have been uploaded, creating the new file or the version. @param digest the base64-encoded SHA-1 hash of the file being uploaded. @param parts the list of uploaded parts to be committed. @param attributes the key value pairs of attributes from the file instance. @param ifMatch ensures that your app only alters files/folders on Box if you have the current version. @param ifNoneMatch ensure that it retrieve unnecessary data if the most current version of file is on-hand. @return the created file instance.
[ "public BoxFile.Info commit(String digest, List<BoxFileUploadSessionPart> parts,\n Map<String, String> attributes, String ifMatch, String ifNoneMatch) {\n\n URL commitURL = this.sessionInfo.getSessionEndpoints().getCommitEndpoint();\n BoxJSONRequest request = new BoxJSONRequest(th...
[ "public Version putWithCustomTimeout(CompositeVoldemortRequest<K, V> requestWrapper) {\n validateTimeout(requestWrapper.getRoutingTimeoutInMs());\n List<Versioned<V>> versionedValues;\n long startTime = System.currentTimeMillis();\n String keyHexString = \"\";\n if(logger.isDebugE...
Recursively loads the metadata for this node
[ "public boolean load()\r\n {\r\n \t_load();\r\n \tjava.util.Iterator it = this.alChildren.iterator();\r\n \twhile (it.hasNext())\r\n \t{\r\n \t\tObject o = it.next();\r\n \t\tif (o instanceof OjbMetaTreeNode) ((OjbMetaTreeNode)o).load();\r\n \t}\r\n \treturn true;\r\n }" ]
[ "public static clusternodegroup[] get(nitro_service service) throws Exception{\n\t\tclusternodegroup obj = new clusternodegroup();\n\t\tclusternodegroup[] response = (clusternodegroup[])obj.get_resources(service);\n\t\treturn response;\n\t}", "private void writeResource(Resource mpxjResource, net.sf.mpxj.planner....
Allocates a database connection. @throws SQLException
[ "private void allocateConnection() throws SQLException\n {\n if (m_connection == null)\n {\n m_connection = m_dataSource.getConnection();\n m_allocatedConnection = true;\n queryDatabaseMetaData();\n }\n }" ]
[ "public void setModificationState(ModificationState newModificationState)\r\n {\r\n if(newModificationState != modificationState)\r\n {\r\n if(log.isDebugEnabled())\r\n {\r\n log.debug(\"object state transition for object \" + this.oid + \" (\"\r\n ...
Sets the specified long attribute to the specified value. @param name name of the attribute @param value value of the attribute @since 1.9.0
[ "public void setLongAttribute(String name, Long value) {\n\t\tensureValue();\n\t\tAttribute attribute = new LongAttribute(value);\n\t\tattribute.setEditable(isEditable(name));\n\t\tgetValue().getAllAttributes().put(name, attribute);\n\t}" ]
[ "public String getLinkColor(JSONObject jsonObject){\n if(jsonObject == null) return null;\n try {\n return jsonObject.has(\"color\") ? jsonObject.getString(\"color\") : \"\";\n } catch (JSONException e) {\n Logger.v(\"Unable to get Link Text Color with JSON - \"+e.getLocal...
Gives an sequence of ByteBuffers of a specified range. Writing to these ByteBuffers modifies the contents of this LBuffer. @param offset @param size @return
[ "public ByteBuffer[] toDirectByteBuffers(long offset, long size) {\n long pos = offset;\n long blockSize = Integer.MAX_VALUE;\n long limit = offset + size;\n int numBuffers = (int) ((size + (blockSize - 1)) / blockSize);\n ByteBuffer[] result = new ByteBuffer[numBuffers];\n ...
[ "public static base_responses unset(nitro_service client, String trapname[], String args[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (trapname != null && trapname.length > 0) {\n\t\t\tsnmpalarm unsetresources[] = new snmpalarm[trapname.length];\n\t\t\tfor (int i=0;i<trapname.length;i++){\n\t\t\...
Executed read-resource-description and returns access-control info. Returns null in case there was any kind of problem. @param client @param address @return
[ "public static ModelNode getAccessControl(ModelControllerClient client, OperationRequestAddress address, boolean operations) {\n return getAccessControl(client, null, address, operations);\n }" ]
[ "private byte[] createErrorImage(int width, int height, Exception e) throws IOException {\n\t\tString error = e.getMessage();\n\t\tif (null == error) {\n\t\t\tWriter result = new StringWriter();\n\t\t\tPrintWriter printWriter = new PrintWriter(result);\n\t\t\te.printStackTrace(printWriter);\n\t\t\terror = result.to...
Indicates that all of the packages within an archive are "known" by the package mapper. Generally this indicates that the archive does not contain customer code.
[ "public static boolean isExclusivelyKnownArchive(GraphRewrite event, String filePath)\n {\n String extension = StringUtils.substringAfterLast(filePath, \".\");\n\n if (!StringUtils.equalsIgnoreCase(extension, \"jar\"))\n return false;\n\n ZipFile archive;\n try\n {\n...
[ "private static Row row(List<StatementResult> results) {\n\t\tRow row = results.get( 0 ).getData().get( 0 );\n\t\treturn row;\n\t}", "@NonNull\n @SuppressWarnings({\"WeakerAccess\", \"unused\"}) // For library users\n public Searcher reset() {\n lastResponsePage = 0;\n lastRequestPage = 0;\n ...
Helper function to return the minimum size of the workspace to be passed to the reduction given the input and output tensors
[ "public static int cudnnGetReductionWorkspaceSize(\n cudnnHandle handle, \n cudnnReduceTensorDescriptor reduceTensorDesc, \n cudnnTensorDescriptor aDesc, \n cudnnTensorDescriptor cDesc, \n long[] sizeInBytes)\n {\n return checkResult(cudnnGetReductionWorkspaceSizeNative(...
[ "public static cmppolicy_stats[] get(nitro_service service) throws Exception{\n\t\tcmppolicy_stats obj = new cmppolicy_stats();\n\t\tcmppolicy_stats[] response = (cmppolicy_stats[])obj.stat_resources(service);\n\t\treturn response;\n\t}", "public void setWeeklyDaysFromBitmap(Integer days, int[] masks)\n {\n ...
Runs the example program. @param args @throws IOException if there was a problem in writing the output file
[ "public static void main(String[] args) throws IOException {\n\t\tExampleHelpers.configureLogging();\n\t\tJsonSerializationProcessor.printDocumentation();\n\n\t\tJsonSerializationProcessor jsonSerializationProcessor = new JsonSerializationProcessor();\n\t\tExampleHelpers.processEntitiesFromWikidataDump(jsonSerializ...
[ "ValidationResult cleanObjectKey(String name) {\n ValidationResult vr = new ValidationResult();\n name = name.trim();\n for (String x : objectKeyCharsNotAllowed)\n name = name.replace(x, \"\");\n\n if (name.length() > Constants.MAX_KEY_LENGTH) {\n name = name.substr...
Sets the character translator for all cells in the row. It will also remove any other translator set. Nothing will happen if the argument is null. @param charTranslator translator @return this to allow chaining
[ "public AT_Row setCharTranslator(CharacterTranslator charTranslator) {\r\n\t\tif(this.hasCells()){\r\n\t\t\tfor(AT_Cell cell : this.getCells()){\r\n\t\t\t\tcell.getContext().setCharTranslator(charTranslator);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}" ]
[ "public synchronized void releaseRebalancingPermit(int nodeId) {\n boolean removed = rebalancePermits.remove(nodeId);\n logger.info(\"Releasing rebalancing permit for node id \" + nodeId + \", returned: \" + removed);\n if(!removed)\n throw new VoldemortException(new IllegalStateExce...
Deserialize a javascript design document file to a DesignDocument object. @param file the design document javascript file (UTF-8 encoded) @return {@link DesignDocument} @throws FileNotFoundException if the file does not exist or cannot be read
[ "public static DesignDocument fromFile(File file) throws FileNotFoundException {\r\n assertNotEmpty(file, \"Design js file\");\r\n DesignDocument designDocument;\r\n Gson gson = new Gson();\r\n InputStreamReader reader = null;\r\n try {\r\n reader = new InputStreamReade...
[ "private float[] generateParticleTimeStamps(float totalTime)\n {\n float timeStamps[] = new float[mEmitRate * 2];\n for ( int i = 0; i < mEmitRate * 2; i +=2 )\n {\n timeStamps[i] = totalTime + mRandom.nextFloat();\n timeStamps[i + 1] = 0;\n }\n return tim...
Use this API to delete clusterinstance resources.
[ "public static base_responses delete(nitro_service client, clusterinstance resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tclusterinstance deleteresources[] = new clusterinstance[resources.length];\n\t\t\tfor (int i=0;i<resources.length...
[ "@Override public View getView(int position, View convertView, ViewGroup parent) {\n T content = getItem(position);\n rendererBuilder.withContent(content);\n rendererBuilder.withConvertView(convertView);\n rendererBuilder.withParent(parent);\n rendererBuilder.withLayoutInflater(LayoutInflater.from(pa...
Creates a new GridLines instance. @param data data block @param offset offset into data block @return new GridLines instance
[ "private GridLines getGridLines(byte[] data, int offset)\n {\n Color normalLineColor = ColorType.getInstance(data[offset]).getColor();\n LineStyle normalLineStyle = LineStyle.getInstance(data[offset + 3]);\n int intervalNumber = data[offset + 4];\n LineStyle intervalLineStyle = LineStyle.getIn...
[ "public void createNewFile() throws SmbException {\n if( getUncPath0().length() == 1 ) {\n throw new SmbException( \"Invalid operation for workgroups, servers, or shares\" );\n }\n close( open0( O_RDWR | O_CREAT | O_EXCL, 0, ATTR_NORMAL, 0 ), 0L );\n }", "public static final Str...
Remove a tag from a photo. This method requires authentication with 'write' permission. @param tagId The tag ID @throws FlickrException
[ "public void removeTag(String tagId) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_REMOVE_TAG);\r\n\r\n parameters.put(\"tag_id\", tagId);\r\n\r\n Response response = transport.post(transport.getPath(), ...
[ "public static InetAddress getLocalHost() throws UnknownHostException {\n InetAddress addr;\n try {\n addr = InetAddress.getLocalHost();\n } catch (ArrayIndexOutOfBoundsException e) { //this is workaround for mac osx bug see AS7-3223 and JGRP-1404\n addr = InetAddress.get...
Support the range subscript operator for String with IntRange @param text a String @param range an IntRange @return the resulting String @since 1.0
[ "public static String getAt(String text, IntRange range) {\n return getAt(text, (Range) range);\n }" ]
[ "private int getReplicaTypeForPartition(int partitionId) {\n List<Integer> routingPartitionList = routingStrategy.getReplicatingPartitionList(partitionId);\n\n // Determine if we should host this partition, and if so, whether we are a primary,\n // secondary or n-ary replica for it\n int...
Record the connection establishment time @param dest Destination of the socket to connect to. Will actually record if null. Otherwise will call this on self and corresponding child with this param null. @param connEstTimeUs The number of us to wait before establishing a connection
[ "public void recordConnectionEstablishmentTimeUs(SocketDestination dest, long connEstTimeUs) {\n if(dest != null) {\n getOrCreateNodeStats(dest).recordConnectionEstablishmentTimeUs(null, connEstTimeUs);\n recordConnectionEstablishmentTimeUs(null, connEstTimeUs);\n } else {\n ...
[ "public void recordSyncOpTimeNs(SocketDestination dest, long opTimeNs) {\n if(dest != null) {\n getOrCreateNodeStats(dest).recordSyncOpTimeNs(null, opTimeNs);\n recordSyncOpTimeNs(null, opTimeNs);\n } else {\n this.syncOpTimeRequestCounter.addRequest(opTimeNs);\n ...
Emit status line for an aggregated event.
[ "private void emitStatusLine(AggregatedResultEvent result, TestStatus status, long timeMillis) throws IOException {\n final StringBuilder line = new StringBuilder();\n\n line.append(shortTimestamp(result.getStartTimestamp()));\n line.append(Strings.padEnd(statusNames.get(status), 8, ' '));\n line.append...
[ "public WebSocketContext sendToTagged(String message, String tag, boolean excludeSelf) {\n return sendToConnections(message, tag, manager.tagRegistry(), excludeSelf);\n }", "public static int secondsDiff(Date earlierDate, Date laterDate) {\n if (earlierDate == null || laterDate == null) {\n ...
Retrieve a UUID in the form required by Primavera PMXML. @param guid UUID instance @return formatted UUID
[ "public static String printUUID(UUID guid)\n {\n return guid == null ? null : \"{\" + guid.toString().toUpperCase() + \"}\";\n }" ]
[ "protected JRDesignGroup getParent(JRDesignGroup group) {\n int index = realGroups.indexOf(group);\n return (index > 0) ? (JRDesignGroup) realGroups.get(index - 1) : group;\n }", "public void publish() {\n\n CmsDirectPublishDialogAction action = new CmsDirectPublishDialogAction();\n ...
Parse a duration value. @param value duration value @return Duration instance
[ "public static final Duration parseDuration(String value)\n {\n return value == null ? null : Duration.getInstance(Double.parseDouble(value), TimeUnit.DAYS);\n }" ]
[ "public static float[] toFloat(int[] array) {\n float[] n = new float[array.length];\n for (int i = 0; i < array.length; i++) {\n n[i] = (float) array[i];\n }\n return n;\n }", "public static final Date getTimestamp(byte[] data, int offset)\n {\n Date result;\n\n ...
Constructs a full capability name from a static base name and a dynamic element. @param baseName the base name. Cannot be {@code null} @param dynamicNameElement the dynamic portion of the name. Cannot be {@code null} @return the full capability name. Will not return {@code null}
[ "public static String buildDynamicCapabilityName(String baseName, String ... dynamicNameElement) {\n assert baseName != null;\n assert dynamicNameElement != null;\n assert dynamicNameElement.length > 0;\n StringBuilder sb = new StringBuilder(baseName);\n for (String part:dynamicNa...
[ "public ParallelTaskBuilder prepareHttpDelete(String url) {\n reinitIfClosed();\n ParallelTaskBuilder cb = new ParallelTaskBuilder();\n\n cb.getHttpMeta().setHttpMethod(HttpMethod.DELETE);\n cb.getHttpMeta().setRequestUrlPostfix(url);\n return cb;\n }", "public byte[] toBytes...
Get a project according to its full name. @param fullName The full name of the project. @return The project which answers the full name.
[ "private static AbstractProject<?, ?> getProject(String fullName) {\n Item item = Hudson.getInstance().getItemByFullName(fullName);\n if (item != null && item instanceof AbstractProject) {\n return (AbstractProject<?, ?>) item;\n }\n return null;\n }" ]
[ "public void setUserInfo(String username, String infoName, String value) throws CmsException {\n\n CmsUser user = m_cms.readUser(username);\n user.setAdditionalInfo(infoName, value);\n m_cms.writeUser(user);\n }", "public Duration getWork(FastTrackField type)\n {\n Double value = (D...
Hide multiple channels. All other channels will be shown. @param channels The channels to hide
[ "public static void hideOnlyChannels(Object... channels){\r\n for(LogRecordHandler handler : handlers){\r\n if(handler instanceof VisibilityHandler){\r\n VisibilityHandler visHandler = (VisibilityHandler) handler;\r\n visHandler.showAll();\r\n for (Object channel : channels) {\r\n ...
[ "protected void checkConsecutiveAlpha() {\n\n Pattern symbolsPatter = Pattern.compile(REGEX_ALPHA_UC + \"+\");\n Matcher matcher = symbolsPatter.matcher(this.password);\n int met = 0;\n while (matcher.find()) {\n int start = matcher.start();\n int end = matcher.end(...
Render the scalebar. @param mapContext The context of the map for which the scalebar is created. @param scalebarParams The scalebar parameters. @param tempFolder The directory in which the graphic file is created. @param template The template that containts the scalebar processor
[ "public final URI render(\n final MapfishMapContext mapContext,\n final ScalebarAttributeValues scalebarParams,\n final File tempFolder,\n final Template template)\n throws IOException, ParserConfigurationException {\n final double dpi = mapContext.getDP...
[ "private SortedSet<Date> calculateDates() {\n\n if (null == m_allDates) {\n SortedSet<Date> result = new TreeSet<>();\n if (isAnyDatePossible()) {\n Calendar date = getFirstDate();\n int previousOccurrences = 0;\n while (showMoreEntries(date,...
Use this API to fetch all the csparameter resources that are configured on netscaler.
[ "public static csparameter get(nitro_service service) throws Exception{\n\t\tcsparameter obj = new csparameter();\n\t\tcsparameter[] response = (csparameter[])obj.get_resources(service);\n\t\treturn response[0];\n\t}" ]
[ "public String getSearchJsonModel() throws IOException {\n DbSearch search = new DbSearch();\n search.setArtifacts(new ArrayList<>());\n search.setModules(new ArrayList<>());\n return JsonUtils.serialize(search);\n }", "public Task<Void> registerWithEmail(@NonNull final String email...
Use this API to fetch all the appfwsignatures resources that are configured on netscaler.
[ "public static appfwsignatures get(nitro_service service) throws Exception{\n\t\tappfwsignatures obj = new appfwsignatures();\n\t\tappfwsignatures[] response = (appfwsignatures[])obj.get_resources(service);\n\t\treturn response[0];\n\t}" ]
[ "public final void notifyContentItemRangeRemoved(int positionStart, int itemCount) {\n if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > contentItemCount) {\n throw new IndexOutOfBoundsException(\"The given range [\" + positionStart + \" - \"\n + (positionSta...
Wrapper delayed emission, based on delayProvider. @param event the event to emit @param milliseconds the delay in milliseconds @param <T> the type of event @return delayed observable
[ "public static <T> Observable<T> delayedEmitAsync(T event, int milliseconds) {\n return delayProvider.delayedEmitAsync(event, milliseconds);\n }" ]
[ "public static String join(Iterable<?> iterable, String separator) {\n if (iterable != null) {\n StringBuilder buf = new StringBuilder();\n Iterator<?> it = iterable.iterator();\n char singleChar = separator.length() == 1 ? separator.charAt(0) : 0;\n while (it.hasN...
Write a Date attribute. @param name attribute name @param value attribute value
[ "public void writeNameValuePair(String name, Date value) throws IOException\n {\n internalWriteNameValuePair(name, m_format.format(value));\n }" ]
[ "public Set<ConstraintViolation> validate(DataSetInfo info) {\r\n\t\tSet<ConstraintViolation> errors = new LinkedHashSet<ConstraintViolation>();\r\n\t\ttry {\r\n\t\t\tif (info.isMandatory() && get(info.getDataSetNumber()) == null) {\r\n\t\t\t\terrors.add(new ConstraintViolation(info, ConstraintViolation.MANDATORY_M...
called when we are completed finished with using the TcpChannelHub
[ "@Override\n public void close() {\n if (closed)\n return;\n closed = true;\n tcpSocketConsumer.prepareToShutdown();\n\n if (shouldSendCloseMessage)\n\n eventLoop.addHandler(new EventHandler() {\n @Override\n public boolean action() ...
[ "public static void applyHyperLinkToElement(DynamicJasperDesign design, DJHyperLink djlink, JRDesignChart chart, String name) {\n\t\tJRDesignExpression hlpe = ExpressionUtils.createAndRegisterExpression(design, name, djlink.getExpression());\n\t\tchart.setHyperlinkReferenceExpression(hlpe);\n\t\tchart.setHyperlinkT...
Add a Renderer instance as prototype. @param renderer to use as prototype. @return the current RendererBuilder instance.
[ "public RendererBuilder<T> withPrototype(Renderer<? extends T> renderer) {\n if (renderer == null) {\n throw new NeedsPrototypesException(\n \"RendererBuilder can't use a null Renderer<T> instance as prototype\");\n }\n this.prototypes.add(renderer);\n return this;\n }" ]
[ "public static HttpResponse getResponse(String urls, HttpRequest request,\n HttpMethod method, int connectTimeoutMillis, int readTimeoutMillis) throws IOException {\n OutputStream out = null;\n InputStream content = null;\n HttpResponse response = null;...
Returns a source excerpt of a JavaDoc link to a method on this type.
[ "public JavadocLink javadocMethodLink(String memberName, Type... types) {\n return new JavadocLink(\"%s#%s(%s)\",\n getQualifiedName(),\n memberName,\n (Excerpt) code -> {\n String separator = \"\";\n for (Type type : types) {\n code.add(\"%s%s\", separator, type...
[ "private String getIndirectionTableColName(TableAlias mnAlias, String path)\r\n {\r\n int dotIdx = path.lastIndexOf(\".\");\r\n String column = path.substring(dotIdx);\r\n return mnAlias.alias + column;\r\n }", "public Date getStartDate()\n {\n Date result = (Date) getCachedValue...
Retrieves a long value from the extended data. @param type Type identifier @return long value
[ "public long getLong(Integer type)\n {\n long result = 0;\n\n byte[] item = m_map.get(type);\n if (item != null)\n {\n result = MPPUtility.getLong6(item, 0);\n }\n\n return (result);\n }" ]
[ "protected boolean isZero( int index ) {\n double bottom = Math.abs(diag[index])+Math.abs(diag[index+1]);\n\n return( Math.abs(off[index]) <= bottom*UtilEjml.EPS);\n }", "public SignedJWT verifyToken(String jwtString) throws ParseException {\n try {\n SignedJWT jwt = SignedJWT.p...
Gets an app client by its client app id if it has been initialized; throws if none can be found. @param clientAppId the client app id of the app client to get. @return the app client associated with the client app id.
[ "public static StitchAppClient getAppClient(\n @Nonnull final String clientAppId\n ) {\n ensureInitialized();\n\n synchronized (Stitch.class) {\n if (!appClients.containsKey(clientAppId)) {\n throw new IllegalStateException(\n String.format(\"client for app '%s' has not yet been i...
[ "public double compute( DMatrix1Row mat ) {\n if( width != mat.numCols || width != mat.numRows ) {\n throw new RuntimeException(\"Unexpected matrix dimension\");\n }\n\n // make sure everything is in the proper state before it starts\n initStructures();\n\n// System.arr...
Create a host target. @param hostName the host name @param client the connected controller client to the master host. @return the remote target
[ "public static final PatchOperationTarget createHost(final String hostName, final ModelControllerClient client) {\n final PathElement host = PathElement.pathElement(HOST, hostName);\n final PathAddress address = PathAddress.EMPTY_ADDRESS.append(host, CORE_SERVICES);\n return new RemotePatchOper...
[ "private Number calculatePercentComplete(Row row)\n {\n Number result;\n switch (PercentCompleteType.getInstance(row.getString(\"complete_pct_type\")))\n {\n case UNITS:\n {\n result = calculateUnitsPercentComplete(row);\n break;\n }\n\n case DU...
Allocate a timestamp
[ "public Stamp allocateTimestamp() {\n\n synchronized (this) {\n Preconditions.checkState(!closed, \"tracker closed \");\n\n if (node == null) {\n Preconditions.checkState(allocationsInProgress == 0,\n \"expected allocationsInProgress == 0 when node == null\");\n Preconditions.c...
[ "@SuppressWarnings(\"unused\")\n private void setTextureNumber(int type, int number) {\n m_numTextures.put(AiTextureType.fromRawValue(type), number);\n }", "private List<Entity> runQuery(Query query) throws DatastoreException {\n RunQueryRequest.Builder request = RunQueryRequest.newBuilder();\n ...
Returns the designer version from the manifest. @param context @return version
[ "public static String readDesignerVersion(ServletContext context) {\n String retStr = \"\";\n BufferedReader br = null;\n try {\n InputStream inputStream = context.getResourceAsStream(\"/META-INF/MANIFEST.MF\");\n br = new BufferedReader(new InputStreamReader(inputStream,\...
[ "public static Method getSAMMethod(Class<?> c) {\n // SAM = single public abstract method\n // if the class is not abstract there is no abstract method\n if (!Modifier.isAbstract(c.getModifiers())) return null;\n if (c.isInterface()) {\n Method[] methods = c.getMethods();\n ...
Write an integer field to the JSON file. @param fieldName field name @param value field value
[ "private void writeIntegerField(String fieldName, Object value) throws IOException\n {\n int val = ((Number) value).intValue();\n if (val != 0)\n {\n m_writer.writeNameValuePair(fieldName, val);\n }\n }" ]
[ "static void export(String path, String queueName, DbConn cnx) throws JqmXmlException\n {\n // Argument tests\n if (queueName == null)\n {\n throw new IllegalArgumentException(\"queue name cannot be null\");\n }\n if (cnx == null)\n {\n throw new Il...
Obtains a local date in Symmetry454 calendar system from the era, year-of-era and day-of-year fields. @param era the Symmetry454 era, not null @param yearOfEra the year-of-era @param dayOfYear the day-of-year @return the Symmetry454 local date, not null @throws DateTimeException if unable to create the date @throws ClassCastException if the {@code era} is not a {@code IsoEra}
[ "@Override\n public Symmetry454Date dateYearDay(Era era, int yearOfEra, int dayOfYear) {\n return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);\n }" ]
[ "protected void addEnumList(String key, List<? extends Enum> list) {\n optionsMap.put(key, list.stream().map(i -> i.toString()).collect(Collectors.toList()));\n }", "public Schedule generateSchedule(LocalDate referenceDate, LocalDate startDate, LocalDate endDate) {\r\n\t\treturn ScheduleGenerator.create...
Write an int to the byte array starting at the given offset @param bytes The byte array @param value The int to write @param offset The offset to begin writing at
[ "public static void writeInt(byte[] bytes, int value, int offset) {\n bytes[offset] = (byte) (0xFF & (value >> 24));\n bytes[offset + 1] = (byte) (0xFF & (value >> 16));\n bytes[offset + 2] = (byte) (0xFF & (value >> 8));\n bytes[offset + 3] = (byte) (0xFF & value);\n }" ]
[ "public static double blackScholesDigitalOptionVega(\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 || optionMaturity <= 0.0)\n\t\t{\n\t\t\t// The Black-Scholes model does not consider ...
If the variable is a local temporary variable it will be resized so that the operation can complete. If not temporary then it will not be reshaped @param mat Variable containing the matrix @param numRows Desired number of rows @param numCols Desired number of columns
[ "protected void resize( VariableMatrix mat , int numRows , int numCols ) {\n if( mat.isTemp() ) {\n mat.matrix.reshape(numRows,numCols);\n }\n }" ]
[ "@Override public Task addTask()\n {\n ProjectFile parent = getParentFile();\n\n Task task = new Task(parent, this);\n\n m_children.add(task);\n\n parent.getTasks().add(task);\n\n setSummary(true);\n\n return (task);\n }", "public static Region create(String name, String label) {...
Find the index of the first matching element in the list @param element the element value to find @return the index of the first matching element, or <code>-1</code> if none found
[ "public long indexOf(final String element) {\n return doWithJedis(new JedisCallable<Long>() {\n @Override\n public Long call(Jedis jedis) {\n return doIndexOf(jedis, element);\n }\n });\n }" ]
[ "public static String readDesignerVersion(ServletContext context) {\n String retStr = \"\";\n BufferedReader br = null;\n try {\n InputStream inputStream = context.getResourceAsStream(\"/META-INF/MANIFEST.MF\");\n br = new BufferedReader(new InputStreamReader(inputStream,\...
Set the start time. @param date the start time to set.
[ "public void setStartTime(final Date date) {\r\n\r\n if (!Objects.equals(m_model.getStart(), date)) {\r\n removeExceptionsOnChange(new Command() {\r\n\r\n public void execute() {\r\n\r\n m_model.setStart(date);\r\n setPatternDefaultValues(date);...
[ "private static boolean equalAsInts(Vec2d a, Vec2d b) {\n return ((int) a.x) == ((int) b.x) && ((int) a.y) == ((int) b.y);\n }", "public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException {\n\t\tList<DatabaseTableConfig<?>> list = new ArrayList<Da...
Handle the given response, return the deserialized object when the response is successful. @param <T> Type @param response Response @param returnType Return type @throws ApiException If the response has a unsuccessful status code or fail to deserialize the response body @return Type
[ "public <T> T handleResponse(Response response, Type returnType) throws ApiException {\n if (response.isSuccessful()) {\n if (returnType == null || response.code() == 204) {\n // returning null if the returnType is not defined,\n // or the status code is 204 (No Conte...
[ "private I_CmsSearchIndex getIndex() {\n\n I_CmsSearchIndex index = null;\n // get the configured index or the selected index\n if (isInitialCall()) {\n // the search form is in the initial state\n // get the configured index\n index = OpenCms.getSearchManager()...
Extract Primavera project data and export in another format. @param driverClass JDBC driver class name @param connectionString JDBC connection string @param projectID project ID @param outputFile output file @throws Exception
[ "public void process(String driverClass, String connectionString, String projectID, String outputFile) throws Exception\n {\n System.out.println(\"Reading Primavera database started.\");\n\n Class.forName(driverClass);\n Properties props = new Properties();\n\n //\n // This is not a very ...
[ "public String convertToReadableDate(Holiday holiday) {\n DateTimeFormatter parser = ISODateTimeFormat.date();\n\n if (holiday.isInDateForm()) {\n String month = Integer.toString(holiday.getMonth()).length() < 2\n ? \"0\" + holiday.getMonth() : Integer.toString(holiday.getMon...
Writes an untagged OK response, with the supplied response code, and an optional message. @param responseCode The response code, included in []. @param message The message to follow the []
[ "public void okResponse(String responseCode, String message) {\r\n untagged();\r\n message(OK);\r\n responseCode(responseCode);\r\n message(message);\r\n end();\r\n }" ]
[ "public static <T> Collection<MemberResponse<T>> executeOptimistic(IExecutorService execSvc, Set<Member> members, Callable<T> callable) {\n \treturn executeOptimistic(execSvc, members, callable, 60, TimeUnit.SECONDS);\n }", "public static DesignDocument fromFile(File file) throws FileNotFoundException {\r\n...
Create a text message that will be stored in the database. Must be called inside a transaction.
[ "static void createMessage(String textMessage, JobInstance jobInstance, DbConn cnx)\n {\n cnx.runUpdate(\"message_insert\", jobInstance.getId(), textMessage);\n }" ]
[ "public Entry<T>[] entries() {\n @SuppressWarnings(\"unchecked\")\n Entry<T>[] entries = new Entry[size];\n int idx = 0;\n for (Entry entry : table) {\n while (entry != null) {\n entries[idx++] = entry;\n entry = entry.next;\n }\n ...
Copies from buffer to our internal strBufferIndex, expanding the internal buffer if necessary @param offset offset in the buffer to start copying from @param length length to copy
[ "private void copyToStrBuffer(byte[] buffer, int offset, int length) {\n Preconditions.checkArgument(length >= 0);\n if (strBuffer.length - strBufferIndex < length) {\n // cannot fit, expanding buffer\n expandStrBuffer(length);\n }\n System.arraycopy(\n buffer, offset, strBuffer, strBuffe...
[ "public void removeHoursFromDay(ProjectCalendarHours hours)\n {\n if (hours.getParentCalendar() != this)\n {\n throw new IllegalArgumentException();\n }\n m_hours[hours.getDay().getValue() - 1] = null;\n }", "private void emit(float[] particlePositions, float[] particleVelocities,\...
Fills in the element with the InputValues for input @param element the node element @param input the input data
[ "protected void setInputElementValue(Node element, FormInput input) {\n\n\t\tLOGGER.debug(\"INPUTFIELD: {} ({})\", input.getIdentification(), input.getType());\n\t\tif (element == null || input.getInputValues().isEmpty()) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\n\t\t\tswitch (input.getType()) {\n\t\t\t\tcase TEXT:\n\t...
[ "static boolean uninstall() {\n boolean uninstalled = false;\n synchronized (lock) {\n if (locationCollectionClient != null) {\n locationCollectionClient.locationEngineController.onDestroy();\n locationCollectionClient.settingsChangeHandlerThread.quit();\n locationCollectionClient.sh...
Sends this request while monitoring its progress and returns a BoxAPIResponse containing the server's response. <p>A ProgressListener is generally only useful when the size of the request is known beforehand. If the size is unknown, then the ProgressListener will be updated for each byte sent, but the total number of bytes will be reported as 0.</p> <p> See {@link #send} for more information on sending requests.</p> @param listener a listener for monitoring the progress of the request. @throws BoxAPIException if the server returns an error code or if a network error occurs. @return a {@link BoxAPIResponse} containing the server's response.
[ "public BoxAPIResponse send(ProgressListener listener) {\n if (this.api == null) {\n this.backoffCounter.reset(BoxGlobalSettings.getMaxRequestAttempts());\n } else {\n this.backoffCounter.reset(this.api.getMaxRequestAttempts());\n }\n\n while (this.backoffCounter.ge...
[ "private static void addEcc(int[] fullstream, int[] datastream, int version, int data_cw, int blocks) {\n\n int ecc_cw = QR_TOTAL_CODEWORDS[version - 1] - data_cw;\n int short_data_block_length = data_cw / blocks;\n int qty_long_blocks = data_cw % blocks;\n int qty_short_blocks = blocks ...
Calculate start dates for a monthly absolute recurrence. @param calendar current date @param frequency frequency @param dates array of start dates
[ "private void getMonthlyAbsoluteDates(Calendar calendar, int frequency, List<Date> dates)\n {\n int currentDayNumber = calendar.get(Calendar.DAY_OF_MONTH);\n calendar.set(Calendar.DAY_OF_MONTH, 1);\n int requiredDayNumber = NumberHelper.getInt(m_dayNumber);\n if (requiredDayNumber < currentDay...
[ "public static Multimap<String, String> getParameters(final String rawQuery) {\n Multimap<String, String> result = HashMultimap.create();\n if (rawQuery == null) {\n return result;\n }\n\n StringTokenizer tokens = new StringTokenizer(rawQuery, \"&\");\n while (tokens.ha...
Places a new value at the end of the existing value array, increasing the field length accordingly. @param newValue - the 2 floats making the new SFVec2f appended to the MFVec2f array list
[ "public void append(float[] newValue) {\n if ( (newValue.length % 2) == 0) {\n for (int i = 0; i < (newValue.length/2); i++) {\n value.add( new SFVec2f(newValue[i*2], newValue[i*2+1]) );\n }\n }\n else {\n Log.e(TAG, \"X3D MFVec3f append set with ...
[ "public static base_response clear(nitro_service client, route6 resource) throws Exception {\n\t\troute6 clearresource = new route6();\n\t\tclearresource.routetype = resource.routetype;\n\t\treturn clearresource.perform_operation(client,\"clear\");\n\t}", "public static boolean start(RootDoc root) {\n\troot.print...
Gets the node meta data. @param key - the meta data key @return the node meta data value for this key
[ "public <T> T getNodeMetaData(Object key) {\n if (metaDataMap == null) {\n return (T) null;\n }\n return (T) metaDataMap.get(key);\n }" ]
[ "String fetchToken(String tokenType) throws IOException, MediaWikiApiErrorException {\n\t\tMap<String, String> params = new HashMap<>();\n\t\tparams.put(ApiConnection.PARAM_ACTION, \"query\");\n\t\tparams.put(\"meta\", \"tokens\");\n\t\tparams.put(\"type\", tokenType);\n\n\t\ttry {\n\t\t\tJsonNode root = this.sendJ...
Add a property with the given name and the given list of values to this Properties object. Name and values are trimmed before the property is added. @param name the name of the property, must not be <code>null</code>. @param values the values of the property, must no be <code>null</code>, none of the values must be <code>null</code>
[ "public void addProperty(String name, String... values) {\n List<String> valueList = new ArrayList<String>();\n for (String value : values) {\n valueList.add(value.trim());\n }\n properties.put(name.trim(), valueList);\n }" ]
[ "public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context) {\n return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, null);\n }", "@SuppressWarnings(\"unchecked\")\n protected String addPostRunDependent(Appliable<? exte...
Return the next word of the string, in other words it stops when a space is encountered.
[ "public static String nextWord(String string) {\n int index = 0;\n while (index < string.length() && !Character.isWhitespace(string.charAt(index))) {\n index++;\n }\n return string.substring(0, index);\n }" ]
[ "protected void checkJobTypes(final Map<String, ? extends Class<?>> jobTypes) {\n if (jobTypes == null) {\n throw new IllegalArgumentException(\"jobTypes must not be null\");\n }\n for (final Entry<String, ? extends Class<?>> entry : jobTypes.entrySet()) {\n try {\n ...
Run a query on the datastore. @return The entities returned by the query. @throws DatastoreException on error
[ "private List<Entity> runQuery(Query query) throws DatastoreException {\n RunQueryRequest.Builder request = RunQueryRequest.newBuilder();\n request.setQuery(query);\n RunQueryResponse response = datastore.runQuery(request.build());\n\n if (response.getBatch().getMoreResults() == QueryResultBatch.MoreRes...
[ "private void addTraceForFrame(WebSocketFrame frame, String type) {\n\t\tMap<String, Object> trace = new LinkedHashMap<>();\n\t\ttrace.put(\"type\", type);\n\t\ttrace.put(\"direction\", \"in\");\n\t\tif (frame instanceof TextWebSocketFrame) {\n\t\t\ttrace.put(\"payload\", ((TextWebSocketFrame) frame).text());\n\t\t...
Setting the type of Checkbox.
[ "public void setType(CheckBoxType type) {\n this.type = type;\n switch (type) {\n case FILLED:\n Element input = DOM.getChild(getElement(), 0);\n input.setAttribute(\"class\", CssName.FILLED_IN);\n break;\n case INTERMEDIATE:\n ...
[ "@SuppressWarnings(\"unchecked\")\n public <T extends ReportModel> T getReportByName(String name, Class<T> clazz)\n {\n WindupVertexFrame model = this.getUniqueByProperty(ReportModel.REPORT_NAME, name);\n try\n {\n return (T) model;\n }\n catch (ClassCastException...
Shutdown task scheduler.
[ "public synchronized void shutdownTaskScheduler(){\n if (scheduler != null && !scheduler.isShutdown()) {\n scheduler.shutdown();\n logger.info(\"shutdowned the task scheduler. No longer accepting new tasks\");\n scheduler = null;\n }\n }" ]
[ "public static final void decodeBuffer(byte[] data, byte encryptionCode)\n {\n for (int i = 0; i < data.length; i++)\n {\n data[i] = (byte) (data[i] ^ encryptionCode);\n }\n }", "private static Converter<List<String>, Object> createStringConstructorConverter(Class<?> resultClass) {\n ...
Flat the map of list of string to map of strings, with theoriginal values, seperated by comma
[ "protected static Map<String, String> getHeadersAsMap(ResponseEntity response) {\n\n Map<String, List<String>> headers = new HashMap<>(response.getHeaders());\n Map<String, String> map = new HashMap<>();\n\n for ( Map.Entry<String, List<String>> header :headers.entrySet() ) {\n Strin...
[ "public HomekitRoot createBridge(\n HomekitAuthInfo authInfo,\n String label,\n String manufacturer,\n String model,\n String serialNumber)\n throws IOException {\n HomekitRoot root = new HomekitRoot(label, http, localAddress, authInfo);\n root.addAccessory(new HomekitBridge(labe...
Processes the template for the comma-separated value pairs in an attribute of the current object on the specified level. @param template The template @param attributes The attributes of the tag @exception XDocletException if an error occurs @doc.tag type="block" @doc.param name="level" optional="false" description="The level for the current object" values="class,field,reference,collection" @doc.param name="name" optional="true" description="The name of the attribute containg attributes (defaults to 'attributes')" @doc.param name="default-right" optional="true" description="The default right value if none is given (defaults to empty value)"
[ "public void forAllValuePairs(String template, Properties attributes) throws XDocletException\r\n {\r\n String name = attributes.getProperty(ATTRIBUTE_NAME, \"attributes\");\r\n String defaultValue = attributes.getProperty(ATTRIBUTE_DEFAULT_RIGHT, \"\");\r\n String attributePairs...
[ "public void setSessionFactory(SessionFactory sessionFactory) throws HibernateLayerException {\n\t\ttry {\n\t\t\tthis.sessionFactory = sessionFactory;\n\t\t\tif (null != layerInfo) {\n\t\t\t\tentityMetadata = sessionFactory.getClassMetadata(layerInfo.getFeatureInfo().getDataSourceName());\n\t\t\t}\n\t\t} catch (Exc...
Describes the scenario. Must be called before any step invocation. @param description the description @return this for a fluent interface
[ "@Override\n public Scenario<GIVEN, WHEN, THEN> startScenario( String description ) {\n super.startScenario( description );\n return this;\n\n }" ]
[ "public List<SquigglyNode> parse(String filter) {\n filter = StringUtils.trim(filter);\n\n if (StringUtils.isEmpty(filter)) {\n return Collections.emptyList();\n }\n\n // get it from the cache if we can\n List<SquigglyNode> cachedNodes = CACHE.getIfPresent(filter);\n\n ...
Uses current variable assignments and info in an NWiseActionTag to expand on an n wise combinatorial set @param action an NWiseAction Action @param possibleStateList a current list of possible states produced so far from expanding a model state @return every input possible state expanded on an n wise combinatorial set defined by that input possible state
[ "public List<Map<String, String>> pipelinePossibleStates(NWiseAction action, List<Map<String, String>> possibleStateList) {\r\n String[] coVariables = action.getCoVariables().split(\",\");\r\n int n = Integer.valueOf(action.getN());\n\r\n List<Map<String, String>> newPossibleStateList = new Arr...
[ "protected void debugLog(String operationType, Long receivedTimeInMs) {\n long durationInMs = receivedTimeInMs - (this.parsedRequestOriginTimeInMs);\n int numVectorClockEntries = (this.parsedVectorClock == null ? 0\n : this.parsedVector...
Derives the OJB platform to use for a database that is connected via a url using the specified subprotocol, and where the specified jdbc driver is used. @param jdbcSubProtocol The JDBC subprotocol used to connect to the database @param jdbcDriver The JDBC driver used to connect to the database @return The platform identifier or <code>null</code> if no platform could be found
[ "public String findPlatformFor(String jdbcSubProtocol, String jdbcDriver)\r\n {\r\n String platform = (String)jdbcSubProtocolToPlatform.get(jdbcSubProtocol);\r\n\r\n if (platform == null)\r\n {\r\n platform = (String)jdbcDriverToPlatform.get(jdbcDriver);\r\n }\r\n re...
[ "public static Object parsePrimitive(\n final String fieldName, final PrimitiveAttribute<?> pAtt, final PObject requestData) {\n Class<?> valueClass = pAtt.getValueClass();\n Object value;\n try {\n value = parseValue(false, new String[0], valueClass, fieldName, requestDat...
Concats two arrays. @param first the first array @param second the second array @param <T> the type of the element in the array @return a new array created adding the element in the second array after the first one
[ "public static <T> T[] concat(T[] first, T... second) {\n\t\tint firstLength = first.length;\n\t\tint secondLength = second.length;\n\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tT[] result = (T[]) Array.newInstance( first.getClass().getComponentType(), firstLength + secondLength );\n\t\tSystem.arraycopy( first, 0, r...
[ "private String visibility(Options opt, ProgramElementDoc e) {\n\treturn opt.showVisibility ? Visibility.get(e).symbol : \" \";\n }", "public void revisitThrowEvents(Definitions def) {\n List<RootElement> rootElements = def.getRootElements();\n List<Signal> toAddSignals = new ArrayList<Signal>();...
Converts the provided object to a date, if possible. @param date the date. @return the date as {@link java.util.Date}
[ "public Date toDate(Object date) {\n\n Date d = null;\n if (null != date) {\n if (date instanceof Date) {\n d = (Date)date;\n } else if (date instanceof Long) {\n d = new Date(((Long)date).longValue());\n } else {\n try {\n ...
[ "public static <T> ConflictHandler<T> localWins() {\n return new ConflictHandler<T>() {\n @Override\n public T resolveConflict(\n final BsonValue documentId,\n final ChangeEvent<T> localEvent,\n final ChangeEvent<T> remoteEvent\n ) {\n return localEvent.getFullDoc...
Set the list of supported resolutions. Each resolution is specified in map units per pixel. @param resolutions resolutions @deprecated use {@link #setZoomLevels()}
[ "@Deprecated\n\tpublic void setResolutions(List<Double> resolutions) {\n\t\tgetZoomLevels().clear();\n\t\tfor (Double resolution : resolutions) {\n\t\t\tgetZoomLevels().add(new ScaleInfo(1. / resolution));\n\t\t}\n\t}" ]
[ "private void createStringMappings(MtasTokenIdFactory mtasTokenIdFactory,\n Level level, String stringValue, int offsetStart, int offsetEnd,\n int position) throws IOException {\n // System.out.println(\"createStringMappings string \");\n String[] stringValues = MtasPennTreebankReader.createStrings(...
Blocking function which completes the migration of one store @param storeName The name of the store @param adminClient Admin client used to initiate the copying of data @param stealInfo The steal information @param isReadOnlyStore Boolean indicating that this is a read-only store
[ "private void rebalanceStore(String storeName,\n final AdminClient adminClient,\n RebalanceTaskInfo stealInfo,\n boolean isReadOnlyStore) {\n // Move partitions\n if (stealInfo.getPartitionIds(storeName) != nu...
[ "public static void init(Context cx, Scriptable scope, boolean sealed)\n throws RhinoException {\n JSAdapter obj = new JSAdapter(cx.newObject(scope));\n obj.setParentScope(scope);\n obj.setPrototype(getFunctionPrototype(scope));\n obj.isPrototype = true;\n ScriptableObject.defi...
Use this API to fetch all the nsrollbackcmd resources that are configured on netscaler. This uses nsrollbackcmd_args which is a way to provide additional arguments while fetching the resources.
[ "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...
[ "public static base_response unset(nitro_service client, rnatparam resource, String[] args) throws Exception{\n\t\trnatparam unsetresource = new rnatparam();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "public static int getScreenHeight(Context context) {\n DisplayMetrics metrics = contex...
Prints a debug log message that details the time taken for the Http request to be parsed by the coordinator @param operationType @param receivedTimeInMs
[ "protected void debugLog(String operationType, Long receivedTimeInMs) {\n long durationInMs = receivedTimeInMs - (this.parsedRequestOriginTimeInMs);\n int numVectorClockEntries = (this.parsedVectorClock == null ? 0\n : this.parsedVector...
[ "private void digestInteger(MessageDigest digest, int value) {\n byte[] valueBytes = new byte[4];\n Util.numberToBytes(value, valueBytes, 0, 4);\n digest.update(valueBytes);\n }", "public static base_response enable(nitro_service client, nsfeature resource) throws Exception {\n\t\tnsfeatur...
Seeks to the given day within the current month @param dayOfMonth the day of the month to seek to, represented as an integer from 1 to 31. Must be guaranteed to parse as an Integer. If this day is beyond the last day of the current month, the actual last day of the month will be used.
[ "public void seekToDayOfMonth(String dayOfMonth) {\n int dayOfMonthInt = Integer.parseInt(dayOfMonth);\n assert(dayOfMonthInt >= 1 && dayOfMonthInt <= 31);\n \n markDateInvocation();\n \n dayOfMonthInt = Math.min(dayOfMonthInt, _calendar.getActualMaximum(Calendar.DAY_OF_MONTH));\n _calendar.set...
[ "@Override\n public void start(String[] arguments) {\n boolean notStarted = !started.getAndSet(true);\n if (notStarted) {\n start(new SingleInstanceWorkloadStrategy(job, name, arguments, endpointRegistry, execService));\n }\n }", "public String[] init(String[] argv, int min, ...
Indicates if a bean is proxyable @param bean The bean to test @return True if proxyable, false otherwise
[ "public static boolean isBeanProxyable(Bean<?> bean, BeanManagerImpl manager) {\n if (bean instanceof RIBean<?>) {\n return ((RIBean<?>) bean).isProxyable();\n } else {\n return Proxies.isTypesProxyable(bean.getTypes(), manager.getServices());\n }\n }" ]
[ "public int getBoneIndex(GVRSceneObject bone)\n {\n for (int i = 0; i < getNumBones(); ++i)\n if (mBones[i] == bone)\n return i;\n return -1;\n }", "private void writeTasks() throws IOException\n {\n writeAttributeTypes(\"task_types\", TaskField.values());\n\n ...
Checks to see if a WORD matches the name of a macro. if it does it applies the macro at that location
[ "void insertMacros(TokenList tokens ) {\n TokenList.Token t = tokens.getFirst();\n while( t != null ) {\n if( t.getType() == Type.WORD ) {\n Macro v = lookupMacro(t.word);\n if (v != null) {\n TokenList.Token before = t.previous;\n ...
[ "private void add(int field)\n {\n if (field < m_flags.length)\n {\n if (m_flags[field] == false)\n {\n m_flags[field] = true;\n m_fields[m_count] = field;\n ++m_count;\n }\n }\n }", "private int[] getCompressIndexAndCount(CompressOptions...
Used to determine if multiple cost rates apply to this assignment. @return true if multiple cost rates apply to this assignment
[ "private boolean hasMultipleCostRates()\n {\n boolean result = false;\n CostRateTable table = getCostRateTable();\n if (table != null)\n {\n //\n // We assume here that if there is just one entry in the cost rate\n // table, this is an open ended rate which covers any w...
[ "private void toCorrectDateWithDay(Calendar date, WeekOfMonth week) {\n\n date.set(Calendar.DAY_OF_MONTH, 1);\n int daysToFirstWeekDayMatch = ((m_weekDay.toInt() + I_CmsSerialDateValue.NUM_OF_WEEKDAYS)\n - (date.get(Calendar.DAY_OF_WEEK))) % I_CmsSerialDateValue.NUM_OF_WEEKDAYS;\n da...
Locate the no arg constructor for the class.
[ "private Constructor<T> findNoArgConstructor(Class<T> dataClass) {\n\t\tConstructor<T>[] constructors;\n\t\ttry {\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tConstructor<T>[] consts = (Constructor<T>[]) dataClass.getDeclaredConstructors();\n\t\t\t// i do this [grossness] to be able to move the Suppress inside th...
[ "private String validatePattern() {\n\n String error = null;\n switch (getPatternType()) {\n case DAILY:\n error = isEveryWorkingDay() ? null : validateInterval();\n break;\n case WEEKLY:\n error = validateInterval();\n ...
Create the label for a grid line. @param value the value of the line @param unit the unit that the value is in
[ "public static String createLabel(final double value, final String unit, final GridLabelFormat format) {\n final double zero = 0.000000001;\n if (format != null) {\n return format.format(value, unit);\n } else {\n if (Math.abs(value - Math.round(value)) < zero) {\n ...
[ "protected synchronized void quit() {\n log.debug(\"Stopping {}\", getName());\n closeServerSocket();\n\n // Close all handlers. Handler threads terminate if run loop exits\n synchronized (handlers) {\n for (ProtocolHandler handler : handlers) {\n handler.close(...
Check if the given class represents an array of primitive wrappers, i.e. Boolean, Byte, Character, Short, Integer, Long, Float, or Double. @param clazz the class to check @return whether the given class is a primitive wrapper array class
[ "public static boolean isPrimitiveWrapperArray(Class<?> clazz) {\n\t\tAssert.notNull(clazz, \"Class must not be null\");\n\t\treturn (clazz.isArray() && isPrimitiveWrapper(clazz.getComponentType()));\n\t}" ]
[ "public HashMap<K2, HashMap<K3, V>> get(final K1 firstKey) {\n\t\treturn map.get(firstKey);\n\t}", "@Override\n public void onKeyDown(KeyDownEvent event) {\n\tchar c = MiscUtils.getCharCode(event.getNativeEvent());\n\tonKeyCodeEvent(event, box.getValue()+c);\n }", "private void processPredecessors(Gantt g...
Reads the header data from a block. @param buffer block data @param offset current offset into block data @param postHeaderSkipBytes bytes to skip after reading the header @return current BlockHeader instance
[ "public BlockHeader read(byte[] buffer, int offset, int postHeaderSkipBytes)\n {\n m_offset = offset;\n\n System.arraycopy(buffer, m_offset, m_header, 0, 8);\n m_offset += 8;\n\n int nameLength = FastTrackUtility.getInt(buffer, m_offset);\n m_offset += 4;\n\n if (nameLength < 1 || na...
[ "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...
Record the resource request wait time in us @param dest Destination of the socket for which the resource was requested. Will actually record if null. Otherwise will call this on self and corresponding child with this param null. @param resourceRequestTimeUs The number of us to wait before getting a socket
[ "public void recordResourceRequestTimeUs(SocketDestination dest, long resourceRequestTimeUs) {\n if(dest != null) {\n getOrCreateNodeStats(dest).recordResourceRequestTimeUs(null, resourceRequestTimeUs);\n recordResourceRequestTimeUs(null, resourceRequestTimeUs);\n } else {\n ...
[ "public static boolean isSinglePositionPrefix(FieldInfo fieldInfo,\n String prefix) throws IOException {\n if (fieldInfo == null) {\n throw new IOException(\"no fieldInfo\");\n } else {\n String info = fieldInfo.getAttribute(\n MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_SI...
Logs an error by sending an error event to all listeners. Error events can be generated by any part of GearVRF, from any thread. They are always sent to the event receiver of the GVRContext. @param message error message @param sender object which had the error @see IErrorEvents
[ "public void logError(String message, Object sender) {\n getEventManager().sendEvent(this, IErrorEvents.class, \"onError\", new Object[] { message, sender });\n }" ]
[ "@Override\n protected void reset() {\n super.reset();\n mapClassesToNamedBoundProviders.clear();\n mapClassesToUnNamedBoundProviders.clear();\n hasTestModules = false;\n installBindingForScope();\n }", "public static VectorTile.Tile.GeomType toGeomType(Geometry geometry) {\n VectorTile.Ti...
Checks the component type of the given array against the expected component type. @param array the array to be checked. May not be <code>null</code>. @param expectedComponentType the expected component type of the array. May not be <code>null</code>. @return the unchanged array. @throws ArrayStoreException if the expected runtime {@code componentType} does not match the actual runtime component type.
[ "private static Object checkComponentType(Object array, Class<?> expectedComponentType) {\n\t\tClass<?> actualComponentType = array.getClass().getComponentType();\n\t\tif (!expectedComponentType.isAssignableFrom(actualComponentType)) {\n\t\t\tthrow new ArrayStoreException(\n\t\t\t\t\tString.format(\"The expected co...
[ "public TagSetModel getOrCreate(GraphRewrite event, Set<String> tags)\n {\n Map<Set<String>, Vertex> cache = getCache(event);\n Vertex vertex = cache.get(tags);\n if (vertex == null)\n {\n TagSetModel model = create();\n model.setTags(tags);\n cache.pu...
XER files can contain multiple projects when there are cross-project dependencies. As the UniversalProjectReader is designed just to read a single project, we need to select one project from those available in the XER file. The original project selected for export by the user will have its "export flag" set to true. We'll return the first project we find where the export flag is set to true, otherwise we'll just return the first project we find in the file. @param stream schedule data @return ProjectFile instance
[ "private ProjectFile handleXerFile(InputStream stream) throws Exception\n {\n PrimaveraXERFileReader reader = new PrimaveraXERFileReader();\n reader.setCharset(m_charset);\n List<ProjectFile> projects = reader.readAll(stream);\n ProjectFile project = null;\n for (ProjectFile file : projec...
[ "public void setValue(Vector3f scale) {\n mX = scale.x;\n mY = scale.y;\n mZ = scale.z;\n }", "private void readProjectProperties(Project ganttProject)\n {\n ProjectProperties mpxjProperties = m_projectFile.getProjectProperties();\n mpxjProperties.setName(ganttProject.getName()...
Create an image of the proper size to hold a new waveform preview image and draw it.
[ "private void updateWaveform(WaveformPreview preview) {\n this.preview.set(preview);\n if (preview == null) {\n waveformImage.set(null);\n } else {\n BufferedImage image = new BufferedImage(preview.segmentCount, preview.maxHeight, BufferedImage.TYPE_INT_RGB);\n ...
[ "public ArrayList getFields(String fieldNames) throws NoSuchFieldException\r\n {\r\n ArrayList result = new ArrayList();\r\n FieldDescriptorDef fieldDef;\r\n String name;\r\n\r\n for (CommaListIterator it = new CommaListIterator(fieldNames); it.hasNext();)\r\n ...
Adds an edge between the current and new state. @return true if the new state is not found in the state machine.
[ "public boolean switchToStateAndCheckIfClone(final Eventable event, StateVertex newState,\n\t\t\t\t\t\t\t\t\t\t\t\tCrawlerContext context) {\n\t\tStateVertex cloneState = this.addStateToCurrentState(newState, event);\n\n\t\trunOnInvariantViolationPlugins(context);\n\n\t\tif (cloneState == null) {\n\t\t\tchangeState...
[ "private void processDestructionQueue(HttpServletRequest request) {\n Object contextsAttribute = request.getAttribute(DESTRUCTION_QUEUE_ATTRIBUTE_NAME);\n if (contextsAttribute instanceof Map) {\n Map<String, List<ContextualInstance<?>>> contexts = cast(contextsAttribute);\n sync...
Turn map into string @param propMap Map to be converted @return
[ "private String getJSONFromMap(Map<String, Object> propMap) {\n try {\n return new JSONObject(propMap).toString();\n } catch (Exception e) {\n return \"{}\";\n }\n }" ]
[ "public int getTotalCreatedConnections(){\r\n\t\tint total=0;\r\n\t\tfor (int i=0; i < this.partitionCount && this.partitions[i] != null; i++){\r\n\t\t\ttotal+=this.partitions[i].getCreatedConnections();\r\n\t\t}\r\n\t\treturn total;\r\n\t}", "public String[] getNormalizedLabels() {\n\t\tif(isValid()) {\n\t\t\tre...
Access all of the elements of the collection that evaluate to true for the provided query predicate. @param predicate An OQL boolean query predicate. @return An iterator used to iterate over the elements that evaluated true for the predicate. @exception org.odmg.QueryInvalidException The query predicate is invalid.
[ "public Iterator select(String predicate) throws org.odmg.QueryInvalidException\r\n {\r\n return this.query(predicate).iterator();\r\n }" ]
[ "public void logAttributeWarning(PathAddress address, ModelNode operation, String message, String attribute) {\n messageQueue.add(new AttributeLogEntry(address, operation, message, attribute));\n }", "@SafeVarargs\n private final <T> Set<T> join(Set<T>... sets)\n {\n Set<T> result = new Has...
Signals that the processor to finish and waits until it finishes.
[ "@Override\n public void finish() {\n if (started.get() && !finished.getAndSet(true)) {\n waitUntilFinished();\n super.finish();\n // recreate thread (don't start) for processor reuse\n createProcessorThread();\n clearQueues();\n started.se...
[ "private void executeRequest(HttpMethod httpMethodProxyRequest,\n HttpServletRequest httpServletRequest,\n PluginResponse httpServletResponse,\n History history) throws Exception {\n int intProxyResponseCode = 999;\n...
A method for determining from and to information when using this IntRange to index an aggregate object of the specified size. Normally only used internally within Groovy but useful if adding range indexing support for your own aggregates. @param size the size of the aggregate being indexed @return the calculated range information (with 1 added to the to value, ready for providing to subList
[ "public RangeInfo subListBorders(int size) {\n if (inclusive == null) throw new IllegalStateException(\"Should not call subListBorders on a non-inclusive aware IntRange\");\n int tempFrom = from;\n if (tempFrom < 0) {\n tempFrom += size;\n }\n int tempTo = to;\n ...
[ "public static void parse(Reader src, StatementHandler handler)\n throws IOException {\n new NTriplesParser(src, handler).parse();\n }", "private void complete(final InstallationManager.InstallationModification modification, final FinalizeCallback callback) {\n final List<File> processed = new Array...
Returns the active logged in user.
[ "@Nullable\n public StitchUserT getUser() {\n authLock.readLock().lock();\n try {\n return activeUser;\n } finally {\n authLock.readLock().unlock();\n }\n }" ]
[ "public static String getURL(String sourceURI) {\n String retval = sourceURI;\n int qPos = sourceURI.indexOf(\"?\");\n if (qPos != -1) {\n retval = retval.substring(0, qPos);\n }\n\n return retval;\n }", "public boolean setOverrideRepeatCount(String pathName, Strin...
Check that the scope type is allowed by the stereotypes on the bean and the bean type
[ "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))) {...
[ "@Override\n public void run() {\n ExecutorService executorService = Executors.newFixedThreadPool(maxClients);\n try {\n serverSocket = new ServerSocket(port, maxClients);\n while (!shuttingDown) {\n try {\n Socket socket = serverSocket.accept...
Most complete output
[ "public void setAll() {\n\tshowAttributes = true;\n\tshowEnumerations = true;\n\tshowEnumConstants = true;\n\tshowOperations = true;\n\tshowConstructors = true;\n\tshowVisibility = true;\n\tshowType = true;\n }" ]
[ "public double totalCount() {\r\n if (depth() == 1) {\r\n return total; // I think this one is always OK. Not very principled here, though.\r\n } else {\r\n double result = 0.0;\r\n for (K o: topLevelKeySet()) {\r\n result += conditionalizeOnce(o).totalCount();\r\n }\r\n retur...
Checks the status of one or more asynchronous photo upload tickets. This method does not require authentication. @param tickets a set of ticket ids (Strings) or {@link Ticket} objects containing ids @return a list of {@link Ticket} objects. @throws FlickrException
[ "public List<Ticket> checkTickets(Set<String> tickets) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_CHECK_TICKETS);\r\n\r\n StringBuffer sb = new StringBuffer();\r\n Iterator<String> it = tickets.iterat...
[ "protected void init(DMatrixRMaj A ) {\n UBV = A;\n\n m = UBV.numRows;\n n = UBV.numCols;\n\n min = Math.min(m,n);\n int max = Math.max(m,n);\n\n if( b.length < max+1 ) {\n b = new double[ max+1 ];\n u = new double[ max+1 ];\n }\n if( gam...
Singleton of MetaClassRegistry. @param includeExtension @return the registry
[ "public static MetaClassRegistry getInstance(int includeExtension) {\n if (includeExtension != DONT_LOAD_DEFAULT) {\n if (instanceInclude == null) {\n instanceInclude = new MetaClassRegistryImpl();\n }\n return instanceInclude;\n } else {\n if...
[ "private void primeCache() {\n SwingUtilities.invokeLater(new Runnable() {\n @Override\n public void run() {\n for (Map.Entry<DeckReference, TrackMetadata> entry : MetadataFinder.getInstance().getLoadedTracks().entrySet()) {\n if (entry.getKey().hotCue ...
Consumes the version field from the given input and raises an exception if the record is in a newer version, written by a newer version of Hibernate OGM. @param input the input to read from @param supportedVersion the type version supported by this version of OGM @param externalizedType the type to be unmarshalled @throws IOException if an error occurs while reading the input
[ "public static void readAndCheckVersion(ObjectInput input, int supportedVersion, Class<?> externalizedType) throws IOException {\n\t\tint version = input.readInt();\n\n\t\tif ( version != supportedVersion ) {\n\t\t\tthrow LOG.unexpectedKeyVersion( externalizedType, version, supportedVersion );\n\t\t}\n\t}" ]
[ "public ValueContainer[] getCurrentLockingValues(Object o) throws PersistenceBrokerException\r\n {\r\n FieldDescriptor[] fields = getLockingFields();\r\n ValueContainer[] result = new ValueContainer[fields.length];\r\n for (int i = 0; i < result.length; i++)\r\n {\r\n resul...
Use this API to fetch a rewriteglobal_binding resource .
[ "public static rewriteglobal_binding get(nitro_service service) throws Exception{\n\t\trewriteglobal_binding obj = new rewriteglobal_binding();\n\t\trewriteglobal_binding response = (rewriteglobal_binding) obj.get_resource(service);\n\t\treturn response;\n\t}" ]
[ "public static <T> String listToString(List<T> list, final boolean justValue) {\r\n return listToString(list, justValue, null);\r\n }", "public static void registerParams(DynamicJasperDesign jd, Map _parameters) {\n for (Object key : _parameters.keySet()) {\n if (key instanceof String) {\n ...
Given a cluster and a node id checks if the node exists @param nodeId The node id to search for @return True if cluster contains the node id, else false
[ "public boolean hasNodeWithId(int nodeId) {\n Node node = nodesById.get(nodeId);\n if(node == null) {\n return false;\n }\n return true;\n }" ]
[ "public static base_response renumber(nitro_service client) throws Exception {\n\t\tnspbr6 renumberresource = new nspbr6();\n\t\treturn renumberresource.perform_operation(client,\"renumber\");\n\t}", "private JSONObject getConvertedResponseAsJson(SpellCheckResponse response) {\n\n if (null == response) {\n...
Sets the response context. @param responseContext the response context @return the parallel task builder
[ "public ParallelTaskBuilder setResponseContext(\n Map<String, Object> responseContext) {\n if (responseContext != null)\n this.responseContext = responseContext;\n else\n logger.error(\"context cannot be null. skip set.\");\n return this;\n }" ]
[ "static void produceInputStreamWithEntry( final DataConsumer consumer,\n final InputStream inputStream,\n final TarArchiveEntry entry ) throws IOException {\n try {\n consumer.onEachFile(inputStream, entry);\n ...
Use this API to fetch a tmglobal_binding resource .
[ "public static tmglobal_binding get(nitro_service service) throws Exception{\n\t\ttmglobal_binding obj = new tmglobal_binding();\n\t\ttmglobal_binding response = (tmglobal_binding) obj.get_resource(service);\n\t\treturn response;\n\t}" ]
[ "@Override\n public final float getFloat(final int i) {\n double val = this.array.optDouble(i, Double.MAX_VALUE);\n if (val == Double.MAX_VALUE) {\n throw new ObjectMissingException(this, \"[\" + i + \"]\");\n }\n return (float) val;\n }", "public static base_response ...
Handles Multi Instance Report message. Handles Report on the number of instances for the command class. @param serialMessage the serial message to process. @param offset the offset at which to start procesing.
[ "private void handleMultiInstanceReportResponse(SerialMessage serialMessage,\r\n\t\t\tint offset) {\r\n\t\tlogger.trace(\"Process Multi-instance Report\");\r\n\t\tint commandClassCode = serialMessage.getMessagePayloadByte(offset);\r\n\t\tint instances = serialMessage.getMessagePayloadByte(offset + 1);\r\n\r\n\t\tif...
[ "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 }", "private void persistDisabledVersion(long version) throws PersistenceFailureException {\n ...
Color waveforms are represented by a series of sixteen bit integers into which color and height information are packed. This function returns the integer corresponding to a particular half-frame in the waveform. @param waveBytes the raw data making up the waveform @param segment the index of hte half-frame of interest @return the sixteen-bit number encoding the height and RGB values of that segment
[ "private int getColorWaveformBits(final ByteBuffer waveBytes, final int segment) {\n final int base = (segment * 2);\n final int big = Util.unsign(waveBytes.get(base));\n final int small = Util.unsign(waveBytes.get(base + 1));\n return big * 256 + small;\n }" ]
[ "public void loadClassifier(String loadPath, Properties props) throws ClassCastException, IOException, ClassNotFoundException {\r\n InputStream is;\r\n // ms, 10-04-2010: check first is this path exists in our CLASSPATH. This\r\n // takes priority over the file system.\r\n if ((is = loadStreamFromClassp...