query
stringlengths
7
3.3k
positive
sequencelengths
1
1
negative
sequencelengths
9
9
Adds the includes of the fileset to the handling. @param handling The handling @param fileSet The fileset
[ "private void addIncludes(DBHandling handling, FileSet fileSet) throws BuildException\r\n {\r\n DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject());\r\n String[] files = scanner.getIncludedFiles();\r\n StringBuffer includes = new StringBuffer();\r\n\r\n for (int idx = 0; idx < files.length; idx++)\r\n {\r\n if (idx > 0)\r\n {\r\n includes.append(\",\");\r\n }\r\n includes.append(files[idx]);\r\n }\r\n try\r\n {\r\n handling.addDBDefinitionFiles(fileSet.getDir(getProject()).getAbsolutePath(), includes.toString());\r\n }\r\n catch (IOException ex)\r\n {\r\n throw new BuildException(ex);\r\n }\r\n }" ]
[ "@Override\n public Object put(List<Map.Entry> batch) throws InterruptedException {\n if (initializeClusterSource()) {\n return clusterSource.put(batch);\n }\n return null;\n }", "public int executeUpdateSQL(\r\n String sqlStatement,\r\n ClassDescriptor cld,\r\n ValueContainer[] values1,\r\n ValueContainer[] values2)\r\n throws PersistenceBrokerException\r\n {\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"executeUpdateSQL: \" + sqlStatement);\r\n\r\n int result;\r\n int index;\r\n PreparedStatement stmt = null;\r\n final StatementManagerIF sm = broker.serviceStatementManager();\r\n try\r\n {\r\n stmt = sm.getPreparedStatement(cld, sqlStatement,\r\n Query.NOT_SCROLLABLE, StatementManagerIF.FETCH_SIZE_NOT_APPLICABLE, isStoredProcedure(sqlStatement));\r\n index = sm.bindValues(stmt, values1, 1);\r\n sm.bindValues(stmt, values2, index);\r\n result = stmt.executeUpdate();\r\n }\r\n catch (PersistenceBrokerException e)\r\n {\r\n logger.error(\"PersistenceBrokerException during the execution of the Update SQL query: \" + e.getMessage(), e);\r\n throw e;\r\n }\r\n catch (SQLException e)\r\n {\r\n ValueContainer[] tmp = addValues(values1, values2);\r\n throw ExceptionHelper.generateException(e, sqlStatement, cld, tmp, logger, null);\r\n }\r\n finally\r\n {\r\n sm.closeResources(stmt, null);\r\n }\r\n return result;\r\n }", "public static int cudnnConvolutionForward(\n cudnnHandle handle, \n Pointer alpha, \n cudnnTensorDescriptor xDesc, \n Pointer x, \n cudnnFilterDescriptor wDesc, \n Pointer w, \n cudnnConvolutionDescriptor convDesc, \n int algo, \n Pointer workSpace, \n long workSpaceSizeInBytes, \n Pointer beta, \n cudnnTensorDescriptor yDesc, \n Pointer y)\n {\n return checkResult(cudnnConvolutionForwardNative(handle, alpha, xDesc, x, wDesc, w, convDesc, algo, workSpace, workSpaceSizeInBytes, beta, yDesc, y));\n }", "public Schedule generateSchedule(LocalDate referenceDate, LocalDate startDate, LocalDate endDate) {\r\n\t\treturn ScheduleGenerator.createScheduleFromConventions(referenceDate, startDate, endDate, getFrequency(), getDaycountConvention(),\r\n\t\t\t\tgetShortPeriodConvention(), getDateRollConvention(), getBusinessdayCalendar(), getFixingOffsetDays(), getPaymentOffsetDays(), isUseEndOfMonth());\r\n\t}", "private long size(final Jedis jedis, final String queueName) {\n final String key = key(QUEUE, queueName);\n final long size;\n if (JedisUtils.isDelayedQueue(jedis, key)) { // If delayed queue, use ZCARD\n size = jedis.zcard(key);\n } else { // Else, use LLEN\n size = jedis.llen(key);\n }\n return size;\n }", "public void sendJsonToUser(Object data, String username) {\n sendToUser(JSON.toJSONString(data), username);\n }", "boolean hasNoAlternativeWildcardRegistration() {\n return parent == null || PathElement.WILDCARD_VALUE.equals(valueString) || !parent.getChildNames().contains(PathElement.WILDCARD_VALUE);\n }", "private String getRowLineBuf(int colCount, List<Integer> colMaxLenList, String[][] data) {\n\t\t\n\t\tS.Buffer rowBuilder = S.buffer();\n\t\tint colWidth;\n\t\t\n\t\tfor (int i = 0 ; i < colCount ; i ++) {\n\t\t\t\n\t\t\tcolWidth = colMaxLenList.get(i) + 3;\n\t\t\t\n\t\t\tfor (int j = 0; j < colWidth ; j ++) {\n\t\t\t\tif (j==0) {\n\t\t\t\t\trowBuilder.append(\"+\");\n\t\t\t\t} else if ((i+1 == colCount && j+1 == colWidth)) {//for last column close the border\n\t\t\t\t\trowBuilder.append(\"-+\");\n\t\t\t\t} else {\n\t\t\t\t\trowBuilder.append(\"-\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn rowBuilder.append(\"\\n\").toString();\n\t}", "public static String changeFileNameSuffixTo(String filename, String suffix) {\n\n int dotPos = filename.lastIndexOf('.');\n if (dotPos != -1) {\n return filename.substring(0, dotPos + 1) + suffix;\n } else {\n // the string has no suffix\n return filename;\n }\n }" ]
Delivers the correct JSON Object for the Stencilset @param stencilSet @throws org.json.JSONException
[ "private static JSONObject parseStencilSet(StencilSet stencilSet) throws JSONException {\n if (stencilSet != null) {\n JSONObject stencilSetObject = new JSONObject();\n\n stencilSetObject.put(\"url\",\n stencilSet.getUrl().toString());\n stencilSetObject.put(\"namespace\",\n stencilSet.getNamespace().toString());\n\n return stencilSetObject;\n }\n\n return new JSONObject();\n }" ]
[ "private List<ExpandableWrapper<P, C>> generateFlattenedParentChildList(List<P> parentList, Map<P, Boolean> savedLastExpansionState) {\n List<ExpandableWrapper<P, C>> flatItemList = new ArrayList<>();\n\n int parentCount = parentList.size();\n for (int i = 0; i < parentCount; i++) {\n P parent = parentList.get(i);\n Boolean lastExpandedState = savedLastExpansionState.get(parent);\n boolean shouldExpand = lastExpandedState == null ? parent.isInitiallyExpanded() : lastExpandedState;\n\n generateParentWrapper(flatItemList, parent, shouldExpand);\n }\n\n return flatItemList;\n }", "public void setMesh(GVRMesh mesh) {\n mMesh = mesh;\n NativeMeshCollider.setMesh(getNative(), mesh.getNative());\n }", "public void write(WritableByteChannel channel) throws IOException {\n logger.debug(\"..writing> {}\", this);\n Util.writeFully(getBytes(), channel);\n }", "@Override\n protected <T> CompletableFuture<T> doExecute(Command<T> command) throws Exception {\n final CompletableFuture<T> future = new CompletableFuture<>();\n executor.execute(() -> {\n try {\n future.complete(blockingExecute(command));\n } catch (Throwable t) {\n future.completeExceptionally(t);\n }\n });\n return future;\n }", "public static lbvserver[] get(nitro_service service) throws Exception{\n\t\tlbvserver obj = new lbvserver();\n\t\tlbvserver[] response = (lbvserver[])obj.get_resources(service);\n\t\treturn response;\n\t}", "private void processDefaultCurrency(Integer currencyID) throws SQLException\n {\n List<Row> rows = getRows(\"select * from \" + m_schema + \"currtype where curr_id=?\", currencyID);\n if (!rows.isEmpty())\n {\n Row row = rows.get(0);\n m_reader.processDefaultCurrency(row);\n }\n }", "private void decreaseIndent() throws IOException\n {\n if (m_pretty)\n {\n m_writer.write('\\n');\n m_indent = m_indent.substring(0, m_indent.length() - INDENT.length());\n m_writer.write(m_indent);\n }\n m_firstNameValuePair.pop();\n }", "public DbOrganization getOrganization(final String organizationId) {\n final DbOrganization dbOrganization = repositoryHandler.getOrganization(organizationId);\n\n if(dbOrganization == null){\n throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)\n .entity(\"Organization \" + organizationId + \" does not exist.\").build());\n }\n\n return dbOrganization;\n }", "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, rootPath);\n if (adeConfig.parent() != null) {\n adeConfig = adeConfig.parent();\n }\n\n List<CmsSelectWidgetOption> options = getFormatterOptionsStatic(cms, adeConfig, rootPath, allRemoved);\n List<CmsSelectWidgetOption> typeOptions = getTypeOptionsStatic(cms, adeConfig, allRemoved);\n options.addAll(typeOptions);\n List<String> result = new ArrayList<String>(options.size());\n for (CmsSelectWidgetOption o : options) {\n result.add(o.getValue());\n }\n return result;\n } catch (CmsException e) {\n // should never happen\n LOG.error(e.getLocalizedMessage(), e);\n return null;\n }\n\n }" ]
Calls the specified Stitch function, and decodes the response into an instance of the specified type. The response will be decoded using the codec registry given. @param name the name of the Stitch function to call. @param args the arguments to pass to the Stitch function. @param requestTimeout the number of milliseconds the client should wait for a response from the server before failing with an error. @param resultClass the class that the Stitch response should be decoded as. @param <T> the type into which the Stitch response will be decoded. @param codecRegistry the codec registry that will be used to encode/decode the function call. @return the decoded value.
[ "public <T> T callFunction(\n final String name,\n final List<?> args,\n final @Nullable Long requestTimeout,\n final Class<T> resultClass,\n final CodecRegistry codecRegistry\n ) {\n return this.functionService\n .withCodecRegistry(codecRegistry)\n .callFunction(name, args, requestTimeout, resultClass);\n }" ]
[ "private int getPrototypeIndex(Renderer renderer) {\n int index = 0;\n for (Renderer prototype : prototypes) {\n if (prototype.getClass().equals(renderer.getClass())) {\n break;\n }\n index++;\n }\n return index;\n }", "public synchronized HttpServer<Buffer, Buffer> start() throws Exception {\n\t\tif (server == null) {\n\t\t\tserver = createProtocolListener();\n\t\t}\n\t\treturn server;\n\t}", "@Override\r\n public ImageSource apply(ImageSource source) {\r\n if (radius != 0) {\r\n if (source.isGrayscale()) {\r\n return applyGrayscale(source, radius);\r\n } else {\r\n return applyRGB(source, radius);\r\n }\r\n } else {\r\n if (source.isGrayscale()) {\r\n return applyGrayscale(source, kernel);\r\n } else {\r\n return applyRGB(source, kernel);\r\n }\r\n }\r\n }", "public void addResourceAssignment(ResourceAssignment assignment)\n {\n if (getExistingResourceAssignment(assignment.getResource()) == null)\n {\n m_assignments.add(assignment);\n getParentFile().getResourceAssignments().add(assignment);\n\n Resource resource = assignment.getResource();\n if (resource != null)\n {\n resource.addResourceAssignment(assignment);\n }\n }\n }", "public static MediaType text( String subType, Charset charset ) {\n return nonBinary( TEXT, subType, charset );\n }", "public static base_responses update(nitro_service client, gslbservice resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tgslbservice updateresources[] = new gslbservice[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tupdateresources[i] = new gslbservice();\n\t\t\t\tupdateresources[i].servicename = resources[i].servicename;\n\t\t\t\tupdateresources[i].ipaddress = resources[i].ipaddress;\n\t\t\t\tupdateresources[i].publicip = resources[i].publicip;\n\t\t\t\tupdateresources[i].publicport = resources[i].publicport;\n\t\t\t\tupdateresources[i].cip = resources[i].cip;\n\t\t\t\tupdateresources[i].cipheader = resources[i].cipheader;\n\t\t\t\tupdateresources[i].sitepersistence = resources[i].sitepersistence;\n\t\t\t\tupdateresources[i].siteprefix = resources[i].siteprefix;\n\t\t\t\tupdateresources[i].maxclient = resources[i].maxclient;\n\t\t\t\tupdateresources[i].healthmonitor = resources[i].healthmonitor;\n\t\t\t\tupdateresources[i].maxbandwidth = resources[i].maxbandwidth;\n\t\t\t\tupdateresources[i].downstateflush = resources[i].downstateflush;\n\t\t\t\tupdateresources[i].maxaaausers = resources[i].maxaaausers;\n\t\t\t\tupdateresources[i].viewname = resources[i].viewname;\n\t\t\t\tupdateresources[i].viewip = resources[i].viewip;\n\t\t\t\tupdateresources[i].monthreshold = resources[i].monthreshold;\n\t\t\t\tupdateresources[i].weight = resources[i].weight;\n\t\t\t\tupdateresources[i].monitor_name_svc = resources[i].monitor_name_svc;\n\t\t\t\tupdateresources[i].hashid = resources[i].hashid;\n\t\t\t\tupdateresources[i].comment = resources[i].comment;\n\t\t\t\tupdateresources[i].appflowlog = resources[i].appflowlog;\n\t\t\t}\n\t\t\tresult = update_bulk_request(client, updateresources);\n\t\t}\n\t\treturn result;\n\t}", "public static boolean isPropertyAllowed(Class defClass, String propertyName)\r\n {\r\n HashMap props = (HashMap)_properties.get(defClass);\r\n\r\n return (props == null ? true : props.containsKey(propertyName));\r\n }", "public String expand(String macro) {\n if (!isMacro(macro)) {\n return macro;\n }\n String definition = macros.get(Config.canonical(macro));\n if (null == definition) {\n warn(\"possible missing definition of macro[%s]\", macro);\n }\n return null == definition ? macro : definition;\n }", "private String getDurationString(Duration value)\n {\n String result = null;\n\n if (value != null)\n {\n double seconds = 0;\n\n switch (value.getUnits())\n {\n case MINUTES:\n case ELAPSED_MINUTES:\n {\n seconds = value.getDuration() * 60;\n break;\n }\n\n case HOURS:\n case ELAPSED_HOURS:\n {\n seconds = value.getDuration() * (60 * 60);\n break;\n }\n\n case DAYS:\n {\n double minutesPerDay = m_projectFile.getProjectProperties().getMinutesPerDay().doubleValue();\n seconds = value.getDuration() * (minutesPerDay * 60);\n break;\n }\n\n case ELAPSED_DAYS:\n {\n seconds = value.getDuration() * (24 * 60 * 60);\n break;\n }\n\n case WEEKS:\n {\n double minutesPerWeek = m_projectFile.getProjectProperties().getMinutesPerWeek().doubleValue();\n seconds = value.getDuration() * (minutesPerWeek * 60);\n break;\n }\n\n case ELAPSED_WEEKS:\n {\n seconds = value.getDuration() * (7 * 24 * 60 * 60);\n break;\n }\n\n case MONTHS:\n {\n double minutesPerDay = m_projectFile.getProjectProperties().getMinutesPerDay().doubleValue();\n double daysPerMonth = m_projectFile.getProjectProperties().getDaysPerMonth().doubleValue();\n seconds = value.getDuration() * (daysPerMonth * minutesPerDay * 60);\n break;\n }\n\n case ELAPSED_MONTHS:\n {\n seconds = value.getDuration() * (30 * 24 * 60 * 60);\n break;\n }\n\n case YEARS:\n {\n double minutesPerDay = m_projectFile.getProjectProperties().getMinutesPerDay().doubleValue();\n double daysPerMonth = m_projectFile.getProjectProperties().getDaysPerMonth().doubleValue();\n seconds = value.getDuration() * (12 * daysPerMonth * minutesPerDay * 60);\n break;\n }\n\n case ELAPSED_YEARS:\n {\n seconds = value.getDuration() * (365 * 24 * 60 * 60);\n break;\n }\n\n default:\n {\n break;\n }\n }\n\n result = Long.toString((long) seconds);\n }\n\n return (result);\n }" ]
generate a message for loglevel DEBUG @param pObject the message Object
[ "public final void debug(Object pObject)\r\n\t{\r\n\t\tgetLogger().log(FQCN, Level.DEBUG, pObject, null);\r\n\t}" ]
[ "public static Cluster createUpdatedCluster(Cluster currentCluster,\n int stealerNodeId,\n List<Integer> donatedPartitions) {\n Cluster updatedCluster = Cluster.cloneCluster(currentCluster);\n // Go over every donated partition one by one\n for(int donatedPartition: donatedPartitions) {\n\n // Gets the donor Node that owns this donated partition\n Node donorNode = updatedCluster.getNodeForPartitionId(donatedPartition);\n Node stealerNode = updatedCluster.getNodeById(stealerNodeId);\n\n if(donorNode == stealerNode) {\n // Moving to the same location = No-op\n continue;\n }\n\n // Update the list of partitions for this node\n donorNode = removePartitionFromNode(donorNode, donatedPartition);\n stealerNode = addPartitionToNode(stealerNode, donatedPartition);\n\n // Sort the nodes\n updatedCluster = updateCluster(updatedCluster,\n Lists.newArrayList(donorNode, stealerNode));\n\n }\n\n return updatedCluster;\n }", "public BoxFile.Info uploadFile(InputStream fileContent, String name, long fileSize, ProgressListener listener) {\n FileUploadParams uploadInfo = new FileUploadParams()\n .setContent(fileContent)\n .setName(name)\n .setSize(fileSize)\n .setProgressListener(listener);\n return this.uploadFile(uploadInfo);\n }", "@Override\n\tpublic void addExtraState(EntityEntryExtraState extraState) {\n\t\tif ( next == null ) {\n\t\t\tnext = extraState;\n\t\t}\n\t\telse {\n\t\t\tnext.addExtraState( extraState );\n\t\t}\n\t}", "protected List<TokenList.Token> parseParameterCommaBlock( TokenList tokens, Sequence sequence ) {\n // find all the comma tokens\n List<TokenList.Token> commas = new ArrayList<TokenList.Token>();\n TokenList.Token token = tokens.first;\n\n int numBracket = 0;\n while( token != null ) {\n if( token.getType() == Type.SYMBOL ) {\n switch( token.getSymbol() ) {\n case COMMA:\n if( numBracket == 0)\n commas.add(token);\n break;\n\n case BRACKET_LEFT: numBracket++; break;\n case BRACKET_RIGHT: numBracket--; break;\n }\n }\n token = token.next;\n }\n\n List<TokenList.Token> output = new ArrayList<TokenList.Token>();\n if( commas.isEmpty() ) {\n output.add(parseBlockNoParentheses(tokens, sequence, false));\n } else {\n TokenList.Token before = tokens.first;\n for (int i = 0; i < commas.size(); i++) {\n TokenList.Token after = commas.get(i);\n if( before == after )\n throw new ParseError(\"No empty function inputs allowed!\");\n TokenList.Token tmp = after.next;\n TokenList sublist = tokens.extractSubList(before,after);\n sublist.remove(after);// remove the comma\n output.add(parseBlockNoParentheses(sublist, sequence, false));\n before = tmp;\n }\n\n // if the last character is a comma then after.next above will be null and thus before is null\n if( before == null )\n throw new ParseError(\"No empty function inputs allowed!\");\n\n TokenList.Token after = tokens.last;\n TokenList sublist = tokens.extractSubList(before, after);\n output.add(parseBlockNoParentheses(sublist, sequence, false));\n }\n\n return output;\n }", "public void recordGetAllTime(long timeNS,\n int requested,\n int returned,\n long totalValueBytes,\n long totalKeyBytes) {\n recordTime(Tracked.GET_ALL,\n timeNS,\n requested - returned,\n totalValueBytes,\n totalKeyBytes,\n requested);\n }", "private static void parseStencilSet(JSONObject modelJSON,\n Diagram current) throws JSONException {\n // get stencil type\n if (modelJSON.has(\"stencilset\")) {\n JSONObject object = modelJSON.getJSONObject(\"stencilset\");\n String url = null;\n String namespace = null;\n\n if (object.has(\"url\")) {\n url = object.getString(\"url\");\n }\n\n if (object.has(\"namespace\")) {\n namespace = object.getString(\"namespace\");\n }\n\n current.setStencilset(new StencilSet(url,\n namespace));\n }\n }", "public void getDataDTD(Writer output) throws DataTaskException\r\n {\r\n try\r\n {\r\n output.write(\"<!ELEMENT dataset (\\n\");\r\n for (Iterator it = _preparedModel.getElementNames(); it.hasNext();)\r\n {\r\n String elementName = (String)it.next();\r\n\r\n output.write(\" \");\r\n output.write(elementName);\r\n output.write(\"*\");\r\n output.write(it.hasNext() ? \" |\\n\" : \"\\n\");\r\n }\r\n output.write(\")>\\n<!ATTLIST dataset\\n name CDATA #REQUIRED\\n>\\n\");\r\n for (Iterator it = _preparedModel.getElementNames(); it.hasNext();)\r\n {\r\n String elementName = (String)it.next();\r\n List classDescs = _preparedModel.getClassDescriptorsMappingTo(elementName);\r\n\r\n if (classDescs == null)\r\n {\r\n output.write(\"\\n<!-- Indirection table\");\r\n }\r\n else\r\n {\r\n output.write(\"\\n<!-- Mapped to : \");\r\n for (Iterator classDescIt = classDescs.iterator(); classDescIt.hasNext();)\r\n {\r\n ClassDescriptor classDesc = (ClassDescriptor)classDescIt.next();\r\n \r\n output.write(classDesc.getClassNameOfObject());\r\n if (classDescIt.hasNext())\r\n {\r\n output.write(\"\\n \");\r\n }\r\n }\r\n }\r\n output.write(\" -->\\n<!ELEMENT \");\r\n output.write(elementName);\r\n output.write(\" EMPTY>\\n<!ATTLIST \");\r\n output.write(elementName);\r\n output.write(\"\\n\");\r\n\r\n for (Iterator attrIt = _preparedModel.getAttributeNames(elementName); attrIt.hasNext();)\r\n {\r\n String attrName = (String)attrIt.next();\r\n\r\n output.write(\" \");\r\n output.write(attrName);\r\n output.write(\" CDATA #\");\r\n output.write(_preparedModel.isRequired(elementName, attrName) ? \"REQUIRED\" : \"IMPLIED\");\r\n output.write(\"\\n\");\r\n }\r\n output.write(\">\\n\");\r\n }\r\n }\r\n catch (IOException ex)\r\n {\r\n throw new DataTaskException(ex);\r\n }\r\n }", "public BsonDocument toUpdateDocument() {\n final List<BsonElement> unsets = new ArrayList<>();\n for (final String removedField : this.removedFields) {\n unsets.add(new BsonElement(removedField, new BsonBoolean(true)));\n }\n final BsonDocument updateDocument = new BsonDocument();\n\n if (this.updatedFields.size() > 0) {\n updateDocument.append(\"$set\", this.updatedFields);\n }\n\n if (unsets.size() > 0) {\n updateDocument.append(\"$unset\", new BsonDocument(unsets));\n }\n\n return updateDocument;\n }", "protected boolean hasKey() {\n boolean result = false;\n String requestURI = this.request.getUri();\n parseKeys(requestURI);\n\n if(this.parsedKeys != null) {\n result = true;\n } else {\n logger.error(\"Error when validating request. No key specified.\");\n RestErrorHandler.writeErrorResponse(this.messageEvent,\n HttpResponseStatus.BAD_REQUEST,\n \"Error: No key specified !\");\n }\n return result;\n }" ]
Adds an object to the Index. If it was already in the Index, then nothing is done. If it is not in the Index, then it is added iff the Index hasn't been locked. @return true if the item was added to the index and false if the item was already in the index or if the index is locked
[ "@Override\r\n public boolean add(E o) {\r\n Integer index = indexes.get(o);\r\n if (index == null && ! locked) {\r\n index = objects.size();\r\n objects.add(o);\r\n indexes.put(o, index);\r\n return true;\r\n }\r\n return false;\r\n }" ]
[ "void parseWorkerThreadPool(final XMLExtendedStreamReader reader, final ModelNode subsystemAdd) throws XMLStreamException {\n final int count = reader.getAttributeCount();\n for (int i = 0; i < count; i++) {\n requireNoNamespaceAttribute(reader, i);\n final String value = reader.getAttributeValue(i);\n final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));\n switch (attribute) {\n case WORKER_READ_THREADS:\n if (subsystemAdd.hasDefined(CommonAttributes.WORKER_READ_THREADS)) {\n throw duplicateAttribute(reader, CommonAttributes.WORKER_READ_THREADS);\n }\n RemotingSubsystemRootResource.WORKER_READ_THREADS.parseAndSetParameter(value, subsystemAdd, reader);\n break;\n case WORKER_TASK_CORE_THREADS:\n if (subsystemAdd.hasDefined(CommonAttributes.WORKER_TASK_CORE_THREADS)) {\n throw duplicateAttribute(reader, CommonAttributes.WORKER_TASK_CORE_THREADS);\n }\n RemotingSubsystemRootResource.WORKER_TASK_CORE_THREADS.parseAndSetParameter(value, subsystemAdd, reader);\n break;\n case WORKER_TASK_KEEPALIVE:\n if (subsystemAdd.hasDefined(CommonAttributes.WORKER_TASK_KEEPALIVE)) {\n throw duplicateAttribute(reader, CommonAttributes.WORKER_TASK_KEEPALIVE);\n }\n RemotingSubsystemRootResource.WORKER_TASK_KEEPALIVE.parseAndSetParameter(value, subsystemAdd, reader);\n break;\n case WORKER_TASK_LIMIT:\n if (subsystemAdd.hasDefined(CommonAttributes.WORKER_TASK_LIMIT)) {\n throw duplicateAttribute(reader, CommonAttributes.WORKER_TASK_LIMIT);\n }\n RemotingSubsystemRootResource.WORKER_TASK_LIMIT.parseAndSetParameter(value, subsystemAdd, reader);\n break;\n case WORKER_TASK_MAX_THREADS:\n if (subsystemAdd.hasDefined(CommonAttributes.WORKER_TASK_MAX_THREADS)) {\n throw duplicateAttribute(reader, CommonAttributes.WORKER_TASK_MAX_THREADS);\n }\n RemotingSubsystemRootResource.WORKER_TASK_MAX_THREADS.parseAndSetParameter(value, subsystemAdd, reader);\n break;\n case WORKER_WRITE_THREADS:\n if (subsystemAdd.hasDefined(CommonAttributes.WORKER_WRITE_THREADS)) {\n throw duplicateAttribute(reader, CommonAttributes.WORKER_WRITE_THREADS);\n }\n RemotingSubsystemRootResource.WORKER_WRITE_THREADS.parseAndSetParameter(value, subsystemAdd, reader);\n break;\n default:\n throw unexpectedAttribute(reader, i);\n }\n }\n requireNoContent(reader);\n }", "private void updateCurrencyFormats(ProjectProperties properties, char decimalSeparator, char thousandsSeparator)\n {\n String prefix = \"\";\n String suffix = \"\";\n String currencySymbol = quoteFormatCharacters(properties.getCurrencySymbol());\n\n switch (properties.getSymbolPosition())\n {\n case AFTER:\n {\n suffix = currencySymbol;\n break;\n }\n\n case BEFORE:\n {\n prefix = currencySymbol;\n break;\n }\n\n case AFTER_WITH_SPACE:\n {\n suffix = \" \" + currencySymbol;\n break;\n }\n\n case BEFORE_WITH_SPACE:\n {\n prefix = currencySymbol + \" \";\n break;\n }\n }\n\n StringBuilder pattern = new StringBuilder(prefix);\n pattern.append(\"#0\");\n\n int digits = properties.getCurrencyDigits().intValue();\n if (digits > 0)\n {\n pattern.append('.');\n for (int i = 0; i < digits; i++)\n {\n pattern.append(\"0\");\n }\n }\n\n pattern.append(suffix);\n\n String primaryPattern = pattern.toString();\n\n String[] alternativePatterns = new String[7];\n alternativePatterns[0] = primaryPattern + \";(\" + primaryPattern + \")\";\n pattern.insert(prefix.length(), \"#,#\");\n String secondaryPattern = pattern.toString();\n alternativePatterns[1] = secondaryPattern;\n alternativePatterns[2] = secondaryPattern + \";(\" + secondaryPattern + \")\";\n\n pattern.setLength(0);\n pattern.append(\"#0\");\n\n if (digits > 0)\n {\n pattern.append('.');\n for (int i = 0; i < digits; i++)\n {\n pattern.append(\"0\");\n }\n }\n\n String noSymbolPrimaryPattern = pattern.toString();\n alternativePatterns[3] = noSymbolPrimaryPattern;\n alternativePatterns[4] = noSymbolPrimaryPattern + \";(\" + noSymbolPrimaryPattern + \")\";\n pattern.insert(0, \"#,#\");\n String noSymbolSecondaryPattern = pattern.toString();\n alternativePatterns[5] = noSymbolSecondaryPattern;\n alternativePatterns[6] = noSymbolSecondaryPattern + \";(\" + noSymbolSecondaryPattern + \")\";\n\n m_currencyFormat.applyPattern(primaryPattern, alternativePatterns, decimalSeparator, thousandsSeparator);\n }", "public GVRAnimator start(int animIndex)\n {\n if ((animIndex < 0) || (animIndex >= mAnimations.size()))\n {\n throw new IndexOutOfBoundsException(\"Animation index out of bounds\");\n }\n GVRAnimator anim = mAnimations.get(animIndex);\n start(anim);\n return anim;\n }", "private void initExceptionsPanel() {\n\n m_exceptionsPanel.setLegend(Messages.get().key(Messages.GUI_SERIALDATE_PANEL_EXCEPTIONS_0));\n m_exceptionsPanel.addCloseHandler(this);\n m_exceptionsPanel.setVisible(false);\n }", "private void stereotype(Options opt, Doc c, Align align) {\n\tfor (Tag tag : c.tags(\"stereotype\")) {\n\t String t[] = tokenize(tag.text());\n\t if (t.length != 1) {\n\t\tSystem.err.println(\"@stereotype expects one field: \" + tag.text());\n\t\tcontinue;\n\t }\n\t tableLine(align, guilWrap(opt, t[0]));\n\t}\n }", "public String format(String value) {\n StringBuilder s = new StringBuilder();\n\n if (value != null && value.trim().length() > 0) {\n boolean continuationLine = false;\n\n s.append(getName()).append(\":\");\n if (isFirstLineEmpty()) {\n s.append(\"\\n\");\n continuationLine = true;\n }\n\n try {\n BufferedReader reader = new BufferedReader(new StringReader(value));\n String line;\n while ((line = reader.readLine()) != null) {\n if (continuationLine && line.trim().length() == 0) {\n // put a dot on the empty continuation lines\n s.append(\" .\\n\");\n } else {\n s.append(\" \").append(line).append(\"\\n\");\n }\n\n continuationLine = true;\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n return s.toString();\n }", "private List<File> getConfigFiles() {\n\n String[] filenames = {\n \"opencms-modules.xml\",\n \"opencms-system.xml\",\n \"opencms-vfs.xml\",\n \"opencms-importexport.xml\",\n \"opencms-sites.xml\",\n \"opencms-variables.xml\",\n \"opencms-scheduler.xml\",\n \"opencms-workplace.xml\",\n \"opencms-search.xml\"};\n List<File> result = new ArrayList<>();\n for (String fn : filenames) {\n File file = new File(m_configDir, fn);\n if (file.exists()) {\n result.add(file);\n }\n }\n return result;\n }", "public static Optional<Variable> freshBuilder(SourceBuilder code, Datatype datatype) {\n if (!datatype.getBuilderFactory().isPresent()) {\n return Optional.empty();\n }\n return Optional.of(code.scope().computeIfAbsent(Declaration.FRESH_BUILDER, () -> {\n Variable defaults = new Variable(\"defaults\");\n code.addLine(\"%s %s = %s;\",\n datatype.getGeneratedBuilder(),\n defaults,\n datatype.getBuilderFactory().get()\n .newBuilder(datatype.getBuilder(), TypeInference.INFERRED_TYPES));\n return defaults;\n }));\n }", "private static int getTrimmedYStart(BufferedImage img) {\n int width = img.getWidth();\n int height = img.getHeight();\n int yStart = height;\n\n for (int i = 0; i < width; i++) {\n for (int j = 0; j < height; j++) {\n if (img.getRGB(i, j) != Color.WHITE.getRGB() && j < yStart) {\n yStart = j;\n break;\n }\n }\n }\n\n return yStart;\n }" ]
Checks, if the end type is valid for the set pattern type. @return a flag, indicating if the end type is valid for the pattern type.
[ "protected final boolean isValidEndTypeForPattern() {\n\n if (getEndType() == null) {\n return false;\n }\n switch (getPatternType()) {\n case DAILY:\n case WEEKLY:\n case MONTHLY:\n case YEARLY:\n return (getEndType().equals(EndType.DATE) || getEndType().equals(EndType.TIMES));\n case INDIVIDUAL:\n case NONE:\n return getEndType().equals(EndType.SINGLE);\n default:\n return false;\n }\n }" ]
[ "private static Dimension adaptTileDimensions(\n final Dimension pixels, final int maxWidth, final int maxHeight) {\n return new Dimension(adaptTileDimension(pixels.width, maxWidth),\n adaptTileDimension(pixels.height, maxHeight));\n }", "public SimplifySpanBuild appendMultiClickable(SpecialClickableUnit specialClickableUnit, Object... specialUnitOrStrings) {\n processMultiClickableSpecialUnit(false, specialClickableUnit, specialUnitOrStrings);\n return this;\n }", "public void updateActive(int profileId, String clientUUID, Boolean active) throws Exception {\n PreparedStatement statement = null;\n try (Connection sqlConnection = sqlService.getConnection()) {\n statement = sqlConnection.prepareStatement(\n \"UPDATE \" + Constants.DB_TABLE_CLIENT +\n \" SET \" + Constants.CLIENT_IS_ACTIVE + \"= ?\" +\n \" WHERE \" + Constants.GENERIC_CLIENT_UUID + \"= ? \" +\n \" AND \" + Constants.GENERIC_PROFILE_ID + \"= ?\"\n );\n statement.setBoolean(1, active);\n statement.setString(2, clientUUID);\n statement.setInt(3, profileId);\n statement.executeUpdate();\n } catch (Exception e) {\n // ok to swallow this.. just means there wasn't any\n } finally {\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n }", "public Rule CriteriaOnlyFindQuery() {\n\t\treturn Sequence( !peek().isCliQuery(), JsonParameter( JsonObject() ) , peek().setOperation( Operation.FIND ), peek().setCriteria( match() ) );\n\t}", "public static final String vertexAsString(Vertex vertex, int depth, String withEdgesOfLabel)\n {\n StringBuilder sb = new StringBuilder();\n vertexAsString(vertex, depth, withEdgesOfLabel, sb, 0, new HashSet<>());\n return sb.toString();\n }", "public synchronized void setDeviceName(String name) {\n if (name.getBytes().length > DEVICE_NAME_LENGTH) {\n throw new IllegalArgumentException(\"name cannot be more than \" + DEVICE_NAME_LENGTH + \" bytes long\");\n }\n Arrays.fill(announcementBytes, DEVICE_NAME_OFFSET, DEVICE_NAME_LENGTH, (byte)0);\n System.arraycopy(name.getBytes(), 0, announcementBytes, DEVICE_NAME_OFFSET, name.getBytes().length);\n }", "@SuppressWarnings(\"deprecation\")\n\tpublic static boolean dateEquals(java.util.Date d1, java.util.Date d2) {\n if (d1 == null || d2 == null) {\n return false;\n }\n\n return d1.getDate() == d2.getDate()\n && d1.getMonth() == d2.getMonth()\n && d1.getYear() == d2.getYear();\n }", "public static streamidentifier_stats get(nitro_service service, String name) throws Exception{\n\t\tstreamidentifier_stats obj = new streamidentifier_stats();\n\t\tobj.set_name(name);\n\t\tstreamidentifier_stats response = (streamidentifier_stats) obj.stat_resource(service);\n\t\treturn response;\n\t}", "public void start() {\n nsLock.writeLock().lock();\n try {\n if (runnerThread != null) {\n return;\n }\n runnerThread =\n new Thread(new NamespaceChangeStreamRunner(\n new WeakReference<>(this), networkMonitor, logger));\n runnerThread.start();\n } finally {\n nsLock.writeLock().unlock();\n }\n }" ]
Adds a row to the internal storage, indexed by primary key. @param uniqueID unique ID of the row @param map row data as a simpe map
[ "protected void addRow(int uniqueID, Map<String, Object> map)\n {\n m_rows.put(Integer.valueOf(uniqueID), new MapRow(map));\n }" ]
[ "public synchronized void addMapStats(\n final MapfishMapContext mapContext, final MapAttribute.MapAttributeValues mapValues) {\n this.mapStats.add(new MapStats(mapContext, mapValues));\n }", "public void add( int row , int col , double value ) {\n if( col < 0 || col >= numCols || row < 0 || row >= numRows ) {\n throw new IllegalArgumentException(\"Specified element is out of bounds\");\n }\n\n data[ row * numCols + col ] += value;\n }", "public static AiScene importFile(String filename) throws IOException {\n \n return importFile(filename, EnumSet.noneOf(AiPostProcessSteps.class));\n }", "void onDrawEye(int eye, int swapChainIndex, boolean use_multiview) {\n mCurrentEye = eye;\n if (!(mSensoredScene == null || !mMainScene.equals(mSensoredScene))) {\n GVRCameraRig mainCameraRig = mMainScene.getMainCameraRig();\n\n if (use_multiview) {\n\n if (DEBUG_STATS) {\n mTracerDrawEyes1.enter(); // this eye is drawn first\n mTracerDrawEyes2.enter();\n }\n GVRRenderTarget renderTarget = mRenderBundle.getRenderTarget(EYE.MULTIVIEW, swapChainIndex);\n GVRCamera camera = mMainScene.getMainCameraRig().getCenterCamera();\n GVRCamera left_camera = mMainScene.getMainCameraRig().getLeftCamera();\n renderTarget.cullFromCamera(mMainScene, camera,mRenderBundle.getShaderManager());\n\n captureCenterEye(renderTarget, true);\n capture3DScreenShot(renderTarget, true);\n\n renderTarget.render(mMainScene, left_camera, mRenderBundle.getShaderManager(),mRenderBundle.getPostEffectRenderTextureA(),\n mRenderBundle.getPostEffectRenderTextureB());\n\n captureRightEye(renderTarget, true);\n captureLeftEye(renderTarget, true);\n\n captureFinish();\n\n if (DEBUG_STATS) {\n mTracerDrawEyes1.leave();\n mTracerDrawEyes2.leave();\n }\n\n\n } else {\n\n if (eye == 1) {\n if (DEBUG_STATS) {\n mTracerDrawEyes1.enter();\n }\n\n GVRCamera rightCamera = mainCameraRig.getRightCamera();\n GVRRenderTarget renderTarget = mRenderBundle.getRenderTarget(EYE.RIGHT, swapChainIndex);\n renderTarget.render(mMainScene, rightCamera, mRenderBundle.getShaderManager(), mRenderBundle.getPostEffectRenderTextureA(),\n mRenderBundle.getPostEffectRenderTextureB());\n captureRightEye(renderTarget, false);\n\n captureFinish();\n if (DEBUG_STATS) {\n mTracerDrawEyes1.leave();\n mTracerDrawEyes.leave();\n }\n } else {\n if (DEBUG_STATS) {\n mTracerDrawEyes1.leave();\n mTracerDrawEyes.leave();\n }\n\n\n GVRRenderTarget renderTarget = mRenderBundle.getRenderTarget(EYE.LEFT, swapChainIndex);\n GVRCamera leftCamera = mainCameraRig.getLeftCamera();\n\n capture3DScreenShot(renderTarget, false);\n\n renderTarget.cullFromCamera(mMainScene, mainCameraRig.getCenterCamera(), mRenderBundle.getShaderManager());\n captureCenterEye(renderTarget, false);\n renderTarget.render(mMainScene, leftCamera, mRenderBundle.getShaderManager(), mRenderBundle.getPostEffectRenderTextureA(), mRenderBundle.getPostEffectRenderTextureB());\n\n captureLeftEye(renderTarget, false);\n\n if (DEBUG_STATS) {\n mTracerDrawEyes2.leave();\n }\n }\n }\n }\n }", "public String getUniformDescriptor(GVRContext ctx)\n {\n if (mShaderTemplate == null)\n {\n mShaderTemplate = makeTemplate(ID, ctx);\n ctx.getShaderManager().addShaderID(this);\n }\n return mShaderTemplate.getUniformDescriptor();\n }", "private static int getTrimmedYStart(BufferedImage img) {\n int width = img.getWidth();\n int height = img.getHeight();\n int yStart = height;\n\n for (int i = 0; i < width; i++) {\n for (int j = 0; j < height; j++) {\n if (img.getRGB(i, j) != Color.WHITE.getRGB() && j < yStart) {\n yStart = j;\n break;\n }\n }\n }\n\n return yStart;\n }", "public void setValue(FieldContainer container, byte[] data)\n {\n if (data != null)\n {\n container.set(m_type, ((MPPUtility.getInt(data, m_offset) & m_mask) == 0) ? m_zeroValue : m_nonZeroValue);\n }\n }", "public static vlan_nsip_binding[] get(nitro_service service, Long id) throws Exception{\n\t\tvlan_nsip_binding obj = new vlan_nsip_binding();\n\t\tobj.set_id(id);\n\t\tvlan_nsip_binding response[] = (vlan_nsip_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "public String processProcedure(Properties attributes) throws XDocletException\r\n {\r\n String type = attributes.getProperty(ATTRIBUTE_TYPE);\r\n ProcedureDef procDef = _curClassDef.getProcedure(type);\r\n String attrName;\r\n\r\n if (procDef == null)\r\n { \r\n procDef = new ProcedureDef(type);\r\n _curClassDef.addProcedure(procDef);\r\n }\r\n\r\n for (Enumeration attrNames = attributes.propertyNames(); attrNames.hasMoreElements(); )\r\n {\r\n attrName = (String)attrNames.nextElement();\r\n procDef.setProperty(attrName, attributes.getProperty(attrName));\r\n }\r\n return \"\";\r\n }" ]
Gets read-only metadata. @param adminClient An instance of AdminClient points to given cluster @param nodeIds Node ids to fetch read-only metadata from @param storeNames Stores names to fetch read-only metadata from @param metaKeys List of read-only metadata to fetch @throws IOException
[ "public static void doMetaGetRO(AdminClient adminClient,\n Collection<Integer> nodeIds,\n List<String> storeNames,\n List<String> metaKeys) throws IOException {\n for(String key: metaKeys) {\n System.out.println(\"Metadata: \" + key);\n if(!key.equals(KEY_MAX_VERSION) && !key.equals(KEY_CURRENT_VERSION)\n && !key.equals(KEY_STORAGE_FORMAT)) {\n System.out.println(\" Invalid read-only metadata key: \" + key);\n } else {\n for(Integer nodeId: nodeIds) {\n String hostName = adminClient.getAdminClientCluster()\n .getNodeById(nodeId)\n .getHost();\n System.out.println(\" Node: \" + hostName + \":\" + nodeId);\n if(key.equals(KEY_MAX_VERSION)) {\n Map<String, Long> mapStoreToROVersion = adminClient.readonlyOps.getROMaxVersion(nodeId,\n storeNames);\n for(String storeName: mapStoreToROVersion.keySet()) {\n System.out.println(\" \" + storeName + \":\"\n + mapStoreToROVersion.get(storeName));\n }\n } else if(key.equals(KEY_CURRENT_VERSION)) {\n Map<String, Long> mapStoreToROVersion = adminClient.readonlyOps.getROCurrentVersion(nodeId,\n storeNames);\n for(String storeName: mapStoreToROVersion.keySet()) {\n System.out.println(\" \" + storeName + \":\"\n + mapStoreToROVersion.get(storeName));\n }\n } else if(key.equals(KEY_STORAGE_FORMAT)) {\n Map<String, String> mapStoreToROFormat = adminClient.readonlyOps.getROStorageFormat(nodeId,\n storeNames);\n for(String storeName: mapStoreToROFormat.keySet()) {\n System.out.println(\" \" + storeName + \":\"\n + mapStoreToROFormat.get(storeName));\n }\n }\n }\n }\n System.out.println();\n }\n }" ]
[ "public void postConstruct() {\n parseGeometry();\n\n Assert.isTrue(this.polygon != null, \"Polygon is null. 'area' string is: '\" + this.area + \"'\");\n Assert.isTrue(this.display != null, \"'display' is null\");\n\n Assert.isTrue(this.style == null || this.display == AoiDisplay.RENDER,\n \"'style' does not make sense unless 'display' == RENDER. In this case 'display' == \" +\n this.display);\n }", "public static spilloverpolicy_stats[] get(nitro_service service) throws Exception{\n\t\tspilloverpolicy_stats obj = new spilloverpolicy_stats();\n\t\tspilloverpolicy_stats[] response = (spilloverpolicy_stats[])obj.stat_resources(service);\n\t\treturn response;\n\t}", "public ProjectCalendarException addCalendarException(Date fromDate, Date toDate)\n {\n ProjectCalendarException bce = new ProjectCalendarException(fromDate, toDate);\n m_exceptions.add(bce);\n m_expandedExceptions.clear();\n m_exceptionsSorted = false;\n clearWorkingDateCache();\n return bce;\n }", "private static int findNext(boolean reverse, int pos) {\n boolean backwards = IS_BACKWARDS_CHECKBOX.isSelected();\n backwards = backwards ? !reverse : reverse;\n\n String pattern = (String) FIND_FIELD.getSelectedItem();\n if (pattern != null && pattern.length() > 0) {\n try {\n Document doc = textComponent.getDocument();\n doc.getText(0, doc.getLength(), SEGMENT);\n }\n catch (Exception e) {\n // should NEVER reach here\n e.printStackTrace();\n }\n\n pos += textComponent.getSelectedText() == null ?\n (backwards ? -1 : 1) : 0;\n\n char first = backwards ?\n pattern.charAt(pattern.length() - 1) : pattern.charAt(0);\n char oppFirst = Character.isUpperCase(first) ?\n Character.toLowerCase(first) : Character.toUpperCase(first);\n int start = pos;\n boolean wrapped = WRAP_SEARCH_CHECKBOX.isSelected();\n int end = backwards ? 0 : SEGMENT.getEndIndex();\n pos += backwards ? -1 : 1;\n\n int length = textComponent.getDocument().getLength();\n if (pos > length) {\n pos = wrapped ? 0 : length;\n }\n\n boolean found = false;\n while (!found && (backwards ? pos > end : pos < end)) {\n found = !MATCH_CASE_CHECKBOX.isSelected() && SEGMENT.array[pos] == oppFirst;\n found = found ? found : SEGMENT.array[pos] == first;\n\n if (found) {\n pos += backwards ? -(pattern.length() - 1) : 0;\n for (int i = 0; found && i < pattern.length(); i++) {\n char c = pattern.charAt(i);\n found = SEGMENT.array[pos + i] == c;\n if (!MATCH_CASE_CHECKBOX.isSelected() && !found) {\n c = Character.isUpperCase(c) ?\n Character.toLowerCase(c) :\n Character.toUpperCase(c);\n found = SEGMENT.array[pos + i] == c;\n }\n }\n }\n\n if (!found) {\n pos += backwards ? -1 : 1;\n\n if (pos == end && wrapped) {\n pos = backwards ? SEGMENT.getEndIndex() : 0;\n end = start;\n wrapped = false;\n }\n }\n }\n pos = found ? pos : -1;\n }\n\n return pos;\n }", "public final boolean hasReturnValues()\r\n {\r\n if (this.hasReturnValue())\r\n {\r\n return true;\r\n }\r\n else\r\n {\r\n // TODO: We may be able to 'pre-calculate' the results\r\n // of this loop by just checking arguments as they are added\r\n // The only problem is that the 'isReturnedbyProcedure' property\r\n // can be modified once the argument is added to this procedure.\r\n // If that occurs, then 'pre-calculated' results will be inacccurate.\r\n Iterator iter = this.getArguments().iterator();\r\n while (iter.hasNext())\r\n {\r\n ArgumentDescriptor arg = (ArgumentDescriptor) iter.next();\r\n if (arg.getIsReturnedByProcedure())\r\n {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }", "private void readResources(Project project, HashMap<BigInteger, ProjectCalendar> calendarMap)\n {\n Project.Resources resources = project.getResources();\n if (resources != null)\n {\n for (Project.Resources.Resource resource : resources.getResource())\n {\n readResource(resource, calendarMap);\n }\n }\n }", "public static base_responses add(nitro_service client, dnsview resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tdnsview addresources[] = new dnsview[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new dnsview();\n\t\t\t\taddresources[i].viewname = resources[i].viewname;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "@Override\r\n\tpublic boolean check(EmbeddedBrowser browser) {\r\n\t\tString js =\r\n\t\t\t\t\"try{ if(\" + expression + \"){return '1';}else{\" + \"return '0';}}catch(e){\"\r\n\t\t\t\t\t\t+ \" return '0';}\";\r\n\t\ttry {\r\n\t\t\tObject object = browser.executeJavaScript(js);\r\n\t\t\tif (object == null) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn object.toString().equals(\"1\");\r\n\t\t} catch (CrawljaxException e) {\r\n\t\t\t// Exception is caught, check failed so return false;\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "static int[] toIntArray(List<Integer> integers) {\n\t\tint[] ints = new int[integers.size()];\n\t\tint i = 0;\n\t\tfor (Integer n : integers) {\n\t\t\tints[i++] = n;\n\t\t}\n\t\treturn ints;\n\t}" ]
Reads Logical Screen Descriptor.
[ "private void readLSD() {\n // Logical screen size.\n header.width = readShort();\n header.height = readShort();\n // Packed fields\n int packed = read();\n // 1 : global color table flag.\n header.gctFlag = (packed & 0x80) != 0;\n // 2-4 : color resolution.\n // 5 : gct sort flag.\n // 6-8 : gct size.\n header.gctSize = 2 << (packed & 7);\n // Background color index.\n header.bgIndex = read();\n // Pixel aspect ratio\n header.pixelAspect = read();\n }" ]
[ "protected DirectiveStatement parseDirectiveStatement(DirectiveStContext node)\r\n\t{\r\n\t\tDirectiveStContext stContext = (DirectiveStContext) node;\r\n\t\tDirectiveExpContext direExp = stContext.directiveExp();\r\n\t\tToken token = direExp.Identifier().getSymbol();\r\n\t\tString directive = token.getText().toLowerCase().intern();\r\n\t\tTerminalNode value = direExp.StringLiteral();\r\n\t\tList<TerminalNode> idNodeList = null;\r\n\t\tDirectiveExpIDListContext directExpidLisCtx = direExp.directiveExpIDList();\r\n\t\tif (directExpidLisCtx != null)\r\n\t\t{\r\n\t\t\tidNodeList = directExpidLisCtx.Identifier();\r\n\t\t}\r\n\r\n\t\tSet<String> idList = null;\r\n\t\tDirectiveStatement ds = null;\r\n\r\n\t\tif (value != null)\r\n\t\t{\r\n\t\t\tString idListValue = this.getStringValue(value.getText());\r\n\t\t\tidList = new HashSet(Arrays.asList(idListValue.split(\",\")));\r\n\t\t\tds = new DirectiveStatement(directive, idList, this.getBTToken(token));\r\n\r\n\t\t}\r\n\t\telse if (idNodeList != null)\r\n\t\t{\r\n\t\t\tidList = new HashSet<String>();\r\n\t\t\tfor (TerminalNode t : idNodeList)\r\n\t\t\t{\r\n\t\t\t\tidList.add(t.getText());\r\n\t\t\t}\r\n\t\t\tds = new DirectiveStatement(directive, idList, this.getBTToken(token));\r\n\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tds = new DirectiveStatement(directive, Collections.EMPTY_SET, this.getBTToken(token));\r\n\t\t}\r\n\r\n\t\tif (directive.equals(\"dynamic\"))\r\n\t\t{\r\n\r\n\t\t\tif (ds.getIdList().size() == 0)\r\n\t\t\t{\r\n\t\t\t\tdata.allDynamic = true;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tdata.dynamicObjectSet = ds.getIdList();\r\n\t\t\t}\r\n\t\t\tds = new DirectiveStatement(directive, Collections.EMPTY_SET, this.getBTToken(token));\r\n\t\t\t\r\n\t\t\treturn ds;\r\n\r\n\t\t}\r\n\t\telse if (directive.equalsIgnoreCase(\"safe_output_open\".intern()))\r\n\t\t{\r\n\t\t\tthis.pbCtx.isSafeOutput = true;\r\n\t\t\treturn ds;\r\n\t\t}\r\n\t\telse if (directive.equalsIgnoreCase(\"safe_output_close\".intern()))\r\n\t\t{\r\n\t\t\tthis.pbCtx.isSafeOutput = false;\r\n\t\t\treturn ds;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn ds;\r\n\t\t}\r\n\t}", "public static base_response reset(nitro_service client, Interface resource) throws Exception {\n\t\tInterface resetresource = new Interface();\n\t\tresetresource.id = resource.id;\n\t\treturn resetresource.perform_operation(client,\"reset\");\n\t}", "public void setShadow(float radius, float dx, float dy, int color) {\n\t\tshadowRadius = radius;\n\t\tshadowDx = dx;\n\t\tshadowDy = dy;\n\t\tshadowColor = color;\n\t\tupdateShadow();\n\t}", "public OJBLock atomicGetOrCreateLock(Object resourceId, Object isolationId)\r\n {\r\n synchronized(globalLocks)\r\n {\r\n MultiLevelLock lock = getLock(resourceId);\r\n if(lock == null)\r\n {\r\n lock = createLock(resourceId, isolationId);\r\n }\r\n return (OJBLock) lock;\r\n }\r\n }", "@Override\n public void run()\n {\n try {\n startBarrier.await();\n\n int idleCount = 0;\n while (!isRunning.compareAndSet(idleCount > LINGER_ITERATIONS && deadPool.isEmpty() && completionKeyToProcessMap.isEmpty(), false)) {\n idleCount = (!shutdown && process()) ? 0 : (idleCount + 1);\n }\n }\n catch (Exception e) {\n // TODO: how to handle this error?\n e.printStackTrace();\n isRunning.set(false);\n }\n }", "@SuppressWarnings(\"SameParameterValue\")\n private byte[] readResponseWithExpectedSize(InputStream is, int size, String description) throws IOException {\n byte[] result = receiveBytes(is);\n if (result.length != size) {\n logger.warn(\"Expected \" + size + \" bytes while reading \" + description + \" response, received \" + result.length);\n }\n return result;\n }", "public static void count() {\n long duration = SystemClock.uptimeMillis() - startTime;\n float avgFPS = sumFrames / (duration / 1000f);\n\n Log.v(\"FPSCounter\",\n \"total frames = %d, total elapsed time = %d ms, average fps = %f\",\n sumFrames, duration, avgFPS);\n }", "public List<ServerGroup> getServerGroups() {\n ArrayList<ServerGroup> groups = new ArrayList<ServerGroup>();\n try {\n JSONObject response = new JSONObject(doGet(BASE_SERVERGROUP, null));\n JSONArray serverArray = response.getJSONArray(\"servergroups\");\n\n for (int i = 0; i < serverArray.length(); i++) {\n JSONObject jsonServerGroup = serverArray.getJSONObject(i);\n ServerGroup group = getServerGroupFromJSON(jsonServerGroup);\n groups.add(group);\n }\n } catch (Exception e) {\n e.printStackTrace();\n return null;\n }\n return groups;\n }", "private EditorState getMasterState() {\n\n List<TableProperty> cols = new ArrayList<TableProperty>(4);\n cols.add(TableProperty.KEY);\n cols.add(TableProperty.DESCRIPTION);\n cols.add(TableProperty.DEFAULT);\n cols.add(TableProperty.TRANSLATION);\n return new EditorState(cols, true);\n }" ]
Close off the connection. @throws SQLException
[ "protected void internalClose() throws SQLException {\r\n\t\ttry {\r\n\t\t\tclearStatementCaches(true);\r\n\t\t\tif (this.connection != null){ // safety!\r\n\t\t\t\tthis.connection.close();\r\n\r\n\t\t\t\tif (!this.connectionTrackingDisabled && this.finalizableRefs != null){\r\n\t\t\t\t\tthis.finalizableRefs.remove(this.connection);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.logicallyClosed.set(true);\r\n\t\t} catch (SQLException e) {\r\n\t\t\tthrow markPossiblyBroken(e);\r\n\t\t}\r\n\t}" ]
[ "public MtasCQLParserSentenceCondition createFullSentence()\n throws ParseException {\n if (fullCondition == null) {\n if (secondSentencePart == null) {\n if (firstBasicSentence != null) {\n fullCondition = new MtasCQLParserSentenceCondition(firstBasicSentence,\n ignoreClause, maximumIgnoreLength);\n\n } else {\n fullCondition = firstSentence;\n }\n fullCondition.setOccurence(firstMinimumOccurence,\n firstMaximumOccurence);\n if (firstOptional) {\n fullCondition.setOptional(firstOptional);\n }\n return fullCondition;\n } else {\n if (!orOperator) {\n if (firstBasicSentence != null) {\n firstBasicSentence.setOccurence(firstMinimumOccurence,\n firstMaximumOccurence);\n firstBasicSentence.setOptional(firstOptional);\n fullCondition = new MtasCQLParserSentenceCondition(\n firstBasicSentence, ignoreClause, maximumIgnoreLength);\n } else {\n firstSentence.setOccurence(firstMinimumOccurence,\n firstMaximumOccurence);\n firstSentence.setOptional(firstOptional);\n fullCondition = new MtasCQLParserSentenceCondition(firstSentence,\n ignoreClause, maximumIgnoreLength);\n }\n fullCondition.addSentenceToEndLatestSequence(\n secondSentencePart.createFullSentence());\n } else {\n MtasCQLParserSentenceCondition sentence = secondSentencePart\n .createFullSentence();\n if (firstBasicSentence != null) {\n sentence.addSentenceAsFirstOption(\n new MtasCQLParserSentenceCondition(firstBasicSentence,\n ignoreClause, maximumIgnoreLength));\n } else {\n sentence.addSentenceAsFirstOption(firstSentence);\n }\n fullCondition = sentence;\n }\n return fullCondition;\n }\n } else {\n return fullCondition;\n }\n }", "public static base_responses add(nitro_service client, sslocspresponder resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tsslocspresponder addresources[] = new sslocspresponder[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new sslocspresponder();\n\t\t\t\taddresources[i].name = resources[i].name;\n\t\t\t\taddresources[i].url = resources[i].url;\n\t\t\t\taddresources[i].cache = resources[i].cache;\n\t\t\t\taddresources[i].cachetimeout = resources[i].cachetimeout;\n\t\t\t\taddresources[i].batchingdepth = resources[i].batchingdepth;\n\t\t\t\taddresources[i].batchingdelay = resources[i].batchingdelay;\n\t\t\t\taddresources[i].resptimeout = resources[i].resptimeout;\n\t\t\t\taddresources[i].respondercert = resources[i].respondercert;\n\t\t\t\taddresources[i].trustresponder = resources[i].trustresponder;\n\t\t\t\taddresources[i].producedattimeskew = resources[i].producedattimeskew;\n\t\t\t\taddresources[i].signingcert = resources[i].signingcert;\n\t\t\t\taddresources[i].usenonce = resources[i].usenonce;\n\t\t\t\taddresources[i].insertclientcert = resources[i].insertclientcert;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "static String toFormattedString(final String iban) {\n final StringBuilder ibanBuffer = new StringBuilder(iban);\n final int length = ibanBuffer.length();\n\n for (int i = 0; i < length / 4; i++) {\n ibanBuffer.insert((i + 1) * 4 + i, ' ');\n }\n\n return ibanBuffer.toString().trim();\n }", "public static nsrpcnode[] get(nitro_service service) throws Exception{\n\t\tnsrpcnode obj = new nsrpcnode();\n\t\tnsrpcnode[] response = (nsrpcnode[])obj.get_resources(service);\n\t\treturn response;\n\t}", "public static ObjectModelResolver get(String resolverId) {\n List<ObjectModelResolver> resolvers = getResolvers();\n\n for (ObjectModelResolver resolver : resolvers) {\n if (resolver.accept(resolverId)) {\n return resolver;\n }\n }\n\n return null;\n }", "public static String getShortName(String className) {\n\t\tAssert.hasLength(className, \"Class name must not be empty\");\n\t\tint lastDotIndex = className.lastIndexOf(PACKAGE_SEPARATOR);\n\t\tint nameEndIndex = className.indexOf(CGLIB_CLASS_SEPARATOR);\n\t\tif (nameEndIndex == -1) {\n\t\t\tnameEndIndex = className.length();\n\t\t}\n\t\tString shortName = className.substring(lastDotIndex + 1, nameEndIndex);\n\t\tshortName = shortName.replace(INNER_CLASS_SEPARATOR, PACKAGE_SEPARATOR);\n\t\treturn shortName;\n\t}", "public static void registerOgmExternalizers(SerializationConfigurationBuilder cfg) {\n\t\tfor ( AdvancedExternalizer<?> advancedExternalizer : ogmExternalizers.values() ) {\n\t\t\tcfg.addAdvancedExternalizer( advancedExternalizer );\n\t\t}\n\t}", "private static JSONObject parseTarget(Shape target) throws JSONException {\n JSONObject targetObject = new JSONObject();\n\n targetObject.put(\"resourceId\",\n target.getResourceId().toString());\n\n return targetObject;\n }", "public static long count(nitro_service service, String zonename) throws Exception{\n\t\tdnszone_domain_binding obj = new dnszone_domain_binding();\n\t\tobj.set_zonename(zonename);\n\t\toptions option = new options();\n\t\toption.set_count(true);\n\t\tdnszone_domain_binding response[] = (dnszone_domain_binding[]) obj.get_resources(service,option);\n\t\tif (response != null) {\n\t\t\treturn response[0].__count;\n\t\t}\n\t\treturn 0;\n\t}" ]
Recursively add indirect subclasses to a class record. @param directSuperClass the superclass to add (together with its own superclasses) @param subClassRecord the subclass to add to
[ "private void addSuperClasses(Integer directSuperClass,\n\t\t\tClassRecord subClassRecord) {\n\t\tif (subClassRecord.superClasses.contains(directSuperClass)) {\n\t\t\treturn;\n\t\t}\n\t\tsubClassRecord.superClasses.add(directSuperClass);\n\t\tClassRecord superClassRecord = getClassRecord(directSuperClass);\n\t\tif (superClassRecord == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (Integer superClass : superClassRecord.directSuperClasses) {\n\t\t\taddSuperClasses(superClass, subClassRecord);\n\t\t}\n\t}" ]
[ "protected AbstractColumn buildSimpleImageColumn() {\n\t\tImageColumn column = new ImageColumn();\n\t\tpopulateCommonAttributes(column);\n\t\tpopulateExpressionAttributes(column);\n\t\t\n\t\tcolumn.setExpression(customExpression);\n\t\tcolumn.setExpressionToGroupBy(customExpressionToGroupBy);\n\t\tcolumn.setExpressionForCalculation(customExpressionForCalculation);\n\t\t\n\t\tcolumn.setScaleMode(imageScaleMode);\n\t\treturn column;\n\t}", "public static String getBuildString() {\n\t\tString versionString = \"UNKNOWN\";\n\t\tProperties propeties = getProperites();\n\t\tif(propeties != null) {\n\t\t\tversionString = propeties.getProperty(\"finmath-lib.build\");\n\t\t}\n\t\treturn versionString;\n\t}", "protected long getUniqueLong(FieldDescriptor field) throws SequenceManagerException\r\n {\r\n long result;\r\n // lookup sequence name\r\n String sequenceName = calculateSequenceName(field);\r\n try\r\n {\r\n result = buildNextSequence(field.getClassDescriptor(), sequenceName);\r\n }\r\n catch (Throwable e)\r\n {\r\n // maybe the sequence was not created\r\n try\r\n {\r\n log.info(\"Create DB sequence key '\"+sequenceName+\"'\");\r\n createSequence(field.getClassDescriptor(), sequenceName);\r\n }\r\n catch (Exception e1)\r\n {\r\n throw new SequenceManagerException(\r\n SystemUtils.LINE_SEPARATOR +\r\n \"Could not grab next id, failed with \" + SystemUtils.LINE_SEPARATOR +\r\n e.getMessage() + SystemUtils.LINE_SEPARATOR +\r\n \"Creation of new sequence failed with \" +\r\n SystemUtils.LINE_SEPARATOR + e1.getMessage() + SystemUtils.LINE_SEPARATOR\r\n , e1);\r\n }\r\n try\r\n {\r\n result = buildNextSequence(field.getClassDescriptor(), sequenceName);\r\n }\r\n catch (Throwable e1)\r\n {\r\n throw new SequenceManagerException(\"Could not grab next id, sequence seems to exist\", e);\r\n }\r\n }\r\n return result;\r\n }", "public static void transformChar(Reader self, Writer writer, @ClosureParams(value=SimpleType.class, options=\"java.lang.String\") Closure closure) throws IOException {\n int c;\n try {\n char[] chars = new char[1];\n while ((c = self.read()) != -1) {\n chars[0] = (char) c;\n writer.write((String) closure.call(new String(chars)));\n }\n writer.flush();\n\n Writer temp2 = writer;\n writer = null;\n temp2.close();\n Reader temp1 = self;\n self = null;\n temp1.close();\n } finally {\n closeWithWarning(self);\n closeWithWarning(writer);\n }\n }", "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 return platform;\r\n }", "@Override\n public void close(SocketDestination destination) {\n factory.setLastClosedTimestamp(destination);\n queuedPool.reset(destination);\n }", "private static synchronized FileOutputWriter createFileWriter(final TypeDefinition type, final DecompilerSettings settings)\n throws IOException\n {\n final String outputDirectory = settings.getOutputDirectory();\n\n final String fileName = type.getName() + settings.getLanguage().getFileExtension();\n final String packageName = type.getPackageName();\n\n // foo.Bar -> foo/Bar.java\n final String subDir = StringUtils.defaultIfEmpty(packageName, \"\").replace('.', File.separatorChar);\n final String outputPath = PathHelper.combine(outputDirectory, subDir, fileName);\n\n final File outputFile = new File(outputPath);\n final File parentDir = outputFile.getParentFile();\n\n if (parentDir != null && !parentDir.exists() && !parentDir.mkdirs())\n {\n throw new IllegalStateException(\"Could not create directory:\" + parentDir);\n }\n\n if (!outputFile.exists() && !outputFile.createNewFile())\n {\n throw new IllegalStateException(\"Could not create output file: \" + outputPath);\n }\n\n return new FileOutputWriter(outputFile, settings);\n }", "private CostRateTableEntry getCostRateTableEntry(Date date)\n {\n CostRateTableEntry result;\n\n CostRateTable table = getCostRateTable();\n if (table == null)\n {\n Resource resource = getResource();\n result = new CostRateTableEntry(resource.getStandardRate(), TimeUnit.HOURS, resource.getOvertimeRate(), TimeUnit.HOURS, resource.getCostPerUse(), null);\n }\n else\n {\n if (table.size() == 1)\n {\n result = table.get(0);\n }\n else\n {\n result = table.getEntryByDate(date);\n }\n }\n\n return result;\n }", "public boolean setViewPortVisibility(final ViewPortVisibility viewportVisibility) {\n boolean visibilityIsChanged = viewportVisibility != mIsVisibleInViewPort;\n if (visibilityIsChanged) {\n Visibility visibility = mVisibility;\n\n switch(viewportVisibility) {\n case FULLY_VISIBLE:\n case PARTIALLY_VISIBLE:\n break;\n case INVISIBLE:\n visibility = Visibility.HIDDEN;\n break;\n }\n\n mIsVisibleInViewPort = viewportVisibility;\n\n updateVisibility(visibility);\n }\n return visibilityIsChanged;\n }" ]
Submit a operations. Throw a run time exception if the operations is already submitted @param operation The asynchronous operations to submit @param requestId Id of the request
[ "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.put(requestId, operation);\n scheduler.scheduleNow(operation);\n logger.debug(\"Handling async operation \" + requestId);\n }" ]
[ "private boolean hasToBuilderMethod(\n DeclaredType builder,\n boolean isExtensible,\n Iterable<ExecutableElement> methods) {\n for (ExecutableElement method : methods) {\n if (isToBuilderMethod(builder, method)) {\n if (!isExtensible) {\n messager.printMessage(ERROR,\n \"No accessible no-args Builder constructor available to implement toBuilder\",\n method);\n }\n return true;\n }\n }\n return false;\n }", "public String readSnippet(String name) {\n\n String path = CmsStringUtil.joinPaths(\n m_context.getSetupBean().getWebAppRfsPath(),\n CmsSetupBean.FOLDER_SETUP,\n \"html\",\n name);\n try (InputStream stream = new FileInputStream(path)) {\n byte[] data = CmsFileUtil.readFully(stream, false);\n String result = new String(data, \"UTF-8\");\n return result;\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }", "public static BoxCollaborationWhitelistExemptTarget.Info create(final BoxAPIConnection api, String userID) {\n URL url = COLLABORATION_WHITELIST_EXEMPT_TARGET_ENTRIES_URL_TEMPLATE.build(api.getBaseURL());\n BoxJSONRequest request = new BoxJSONRequest(api, url, HttpMethod.POST);\n JsonObject requestJSON = new JsonObject()\n .add(\"user\", new JsonObject()\n .add(\"type\", \"user\")\n .add(\"id\", userID));\n\n request.setBody(requestJSON.toString());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n BoxCollaborationWhitelistExemptTarget userWhitelist = new BoxCollaborationWhitelistExemptTarget(api,\n responseJSON.get(\"id\").asString());\n\n return userWhitelist.new Info(responseJSON);\n }", "public GeoPermissions getPerms(String photoId) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_PERMS);\r\n parameters.put(\"photo_id\", photoId);\r\n\r\n Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n // response:\r\n // <perms id=\"240935723\" ispublic=\"1\" iscontact=\"0\" isfriend=\"0\" isfamily=\"0\"/>\r\n GeoPermissions perms = new GeoPermissions();\r\n Element permsElement = response.getPayload();\r\n perms.setPublic(\"1\".equals(permsElement.getAttribute(\"ispublic\")));\r\n perms.setContact(\"1\".equals(permsElement.getAttribute(\"iscontact\")));\r\n perms.setFriend(\"1\".equals(permsElement.getAttribute(\"isfriend\")));\r\n perms.setFamily(\"1\".equals(permsElement.getAttribute(\"isfamily\")));\r\n perms.setId(permsElement.getAttribute(\"id\"));\r\n // I ignore the id attribute. should be the same as the given\r\n // photo id.\r\n return perms;\r\n }", "public void setup( int numSamples , int sampleSize ) {\n mean = new double[ sampleSize ];\n A.reshape(numSamples,sampleSize,false);\n sampleIndex = 0;\n numComponents = -1;\n }", "public Duration getTotalSlack()\n {\n Duration totalSlack = (Duration) getCachedValue(TaskField.TOTAL_SLACK);\n if (totalSlack == null)\n {\n Duration duration = getDuration();\n if (duration == null)\n {\n duration = Duration.getInstance(0, TimeUnit.DAYS);\n }\n\n TimeUnit units = duration.getUnits();\n\n Duration startSlack = getStartSlack();\n if (startSlack == null)\n {\n startSlack = Duration.getInstance(0, units);\n }\n else\n {\n if (startSlack.getUnits() != units)\n {\n startSlack = startSlack.convertUnits(units, getParentFile().getProjectProperties());\n }\n }\n\n Duration finishSlack = getFinishSlack();\n if (finishSlack == null)\n {\n finishSlack = Duration.getInstance(0, units);\n }\n else\n {\n if (finishSlack.getUnits() != units)\n {\n finishSlack = finishSlack.convertUnits(units, getParentFile().getProjectProperties());\n }\n }\n\n double startSlackDuration = startSlack.getDuration();\n double finishSlackDuration = finishSlack.getDuration();\n\n if (startSlackDuration == 0 || finishSlackDuration == 0)\n {\n if (startSlackDuration != 0)\n {\n totalSlack = startSlack;\n }\n else\n {\n totalSlack = finishSlack;\n }\n }\n else\n {\n if (startSlackDuration < finishSlackDuration)\n {\n totalSlack = startSlack;\n }\n else\n {\n totalSlack = finishSlack;\n }\n }\n\n set(TaskField.TOTAL_SLACK, totalSlack);\n }\n\n return (totalSlack);\n }", "public static lbvserver[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{\n\t\tlbvserver obj = new lbvserver();\n\t\toptions option = new options();\n\t\toption.set_filter(filter);\n\t\tlbvserver[] response = (lbvserver[]) obj.getfiltered(service, option);\n\t\treturn response;\n\t}", "protected void reportStorageOpTime(long startNs) {\n if(streamStats != null) {\n streamStats.reportStreamingScan(operation);\n streamStats.reportStorageTime(operation,\n Utils.elapsedTimeNs(startNs, System.nanoTime()));\n }\n }", "public ReferrerList getCollectionReferrers(Date date, String domain, String collectionId, int perPage, int page) throws FlickrException {\n return getReferrers(METHOD_GET_COLLECTION_REFERRERS, domain, \"collection_id\", collectionId, date, perPage, page);\n }" ]
Finds the file at the provided path within the archive. Eg, getChildFile(ArchiveModel, "/META-INF/MANIFEST.MF") will return a {@link FileModel} if a file named /META-INF/MANIFEST.MF exists within the archive @return Returns the located {@link FileModel} or null if no file with this path could be located
[ "public FileModel getChildFile(ArchiveModel archiveModel, String filePath)\n {\n filePath = FilenameUtils.separatorsToUnix(filePath);\n StringTokenizer stk = new StringTokenizer(filePath, \"/\");\n\n FileModel currentFileModel = archiveModel;\n while (stk.hasMoreTokens() && currentFileModel != null)\n {\n String pathElement = stk.nextToken();\n\n currentFileModel = findFileModel(currentFileModel, pathElement);\n }\n return currentFileModel;\n }" ]
[ "public Weld addPackage(boolean scanRecursively, Class<?> packageClass) {\n packages.add(new PackInfo(packageClass, scanRecursively));\n return this;\n }", "private static long scanForLocSig(FileChannel channel) throws IOException {\n\n channel.position(0);\n\n ByteBuffer bb = getByteBuffer(CHUNK_SIZE);\n long end = channel.size();\n while (channel.position() <= end) {\n\n read(bb, channel);\n\n int bufferPos = 0;\n while (bufferPos <= bb.limit() - SIG_PATTERN_LENGTH) {\n\n // Following is based on the Boyer Moore algorithm but simplified to reflect\n // a) the size of the pattern is static\n // b) the pattern is static and has no repeating bytes\n\n int patternPos;\n for (patternPos = SIG_PATTERN_LENGTH - 1;\n patternPos >= 0 && LOCSIG_PATTERN[patternPos] == bb.get(bufferPos + patternPos);\n --patternPos) {\n // empty loop while bytes match\n }\n\n // Outer switch gives same results as checking the \"good suffix array\" in the Boyer Moore algorithm\n switch (patternPos) {\n case -1: {\n // Pattern matched. Confirm is this is the start of a valid local file record\n long startLocRecord = channel.position() - bb.limit() + bufferPos;\n long currentPos = channel.position();\n if (validateLocalFileRecord(channel, startLocRecord, -1)) {\n return startLocRecord;\n }\n // Restore position in case it shifted\n channel.position(currentPos);\n\n // wasn't a valid local file record; continue scan\n bufferPos += 4;\n break;\n }\n case 3: {\n // No bytes matched; the common case.\n // With our pattern, this is the only case where the Boyer Moore algorithm's \"bad char array\" may\n // produce a shift greater than the \"good suffix array\" (which would shift 1 byte)\n int idx = bb.get(bufferPos + patternPos) - Byte.MIN_VALUE;\n bufferPos += LOC_BAD_BYTE_SKIP[idx];\n break;\n }\n default:\n // 1 or more bytes matched\n bufferPos += 4;\n }\n }\n }\n\n return -1;\n }", "public static void copy(String in, Writer out) throws IOException {\n\t\tAssert.notNull(in, \"No input String specified\");\n\t\tAssert.notNull(out, \"No Writer specified\");\n\t\ttry {\n\t\t\tout.write(in);\n\t\t}\n\t\tfinally {\n\t\t\ttry {\n\t\t\t\tout.close();\n\t\t\t}\n\t\t\tcatch (IOException ex) {\n\t\t\t}\n\t\t}\n\t}", "protected Tree determineNonTrivialHead(Tree t, Tree parent) {\r\n Tree theHead = null;\r\n String motherCat = tlp.basicCategory(t.label().value());\r\n if (DEBUG) {\r\n System.err.println(\"Looking for head of \" + t.label() +\r\n \"; value is |\" + t.label().value() + \"|, \" +\r\n \" baseCat is |\" + motherCat + '|');\r\n }\r\n // We know we have nonterminals underneath\r\n // (a bit of a Penn Treebank assumption, but).\r\n\r\n // Look at label.\r\n // a total special case....\r\n // first look for POS tag at end\r\n // this appears to be redundant in the Collins case since the rule already would do that\r\n // Tree lastDtr = t.lastChild();\r\n // if (tlp.basicCategory(lastDtr.label().value()).equals(\"POS\")) {\r\n // theHead = lastDtr;\r\n // } else {\r\n String[][] how = nonTerminalInfo.get(motherCat);\r\n if (how == null) {\r\n if (DEBUG) {\r\n System.err.println(\"Warning: No rule found for \" + motherCat +\r\n \" (first char: \" + motherCat.charAt(0) + ')');\r\n System.err.println(\"Known nonterms are: \" + nonTerminalInfo.keySet());\r\n }\r\n if (defaultRule != null) {\r\n if (DEBUG) {\r\n System.err.println(\" Using defaultRule\");\r\n }\r\n return traverseLocate(t.children(), defaultRule, true);\r\n } else {\r\n return null;\r\n }\r\n }\r\n for (int i = 0; i < how.length; i++) {\r\n boolean lastResort = (i == how.length - 1);\r\n theHead = traverseLocate(t.children(), how[i], lastResort);\r\n if (theHead != null) {\r\n break;\r\n }\r\n }\r\n if (DEBUG) {\r\n System.err.println(\" Chose \" + theHead.label());\r\n }\r\n return theHead;\r\n }", "public static int ptb2Text(Reader ptbText, Writer w) throws IOException {\r\n int numTokens = 0;\r\n PTB2TextLexer lexer = new PTB2TextLexer(ptbText);\r\n for (String token; (token = lexer.next()) != null; ) {\r\n numTokens++;\r\n w.write(token);\r\n }\r\n return numTokens;\r\n }", "private <T> T readIntoBean(final T bean, final String[] nameMapping, final CellProcessor[] processors)\n\t\tthrows IOException {\n\t\t\n\t\tif( readRow() ) {\n\t\t\tif( nameMapping.length != length() ) {\n\t\t\t\tthrow new IllegalArgumentException(String.format(\n\t\t\t\t\t\"the nameMapping array and the number of columns read \"\n\t\t\t\t\t\t+ \"should be the same size (nameMapping length = %d, columns = %d)\", nameMapping.length,\n\t\t\t\t\tlength()));\n\t\t\t}\n\t\t\t\n\t\t\tif( processors == null ) {\n\t\t\t\tprocessedColumns.clear();\n\t\t\t\tprocessedColumns.addAll(getColumns());\n\t\t\t} else {\n\t\t\t\texecuteProcessors(processedColumns, processors);\n\t\t\t}\n\t\t\t\n\t\t\treturn populateBean(bean, nameMapping);\n\t\t}\n\t\t\n\t\treturn null; // EOF\n\t}", "int acquireTransaction(@NotNull final Thread thread) {\n try (CriticalSection ignored = criticalSection.enter()) {\n final int currentThreadPermits = getThreadPermitsToAcquire(thread);\n waitForPermits(thread, currentThreadPermits > 0 ? nestedQueue : regularQueue, 1, currentThreadPermits);\n }\n return 1;\n }", "private String registerEventHandler(GFXEventHandler h) {\n //checkInitialized();\n if (!registeredOnJS) {\n JSObject doc = (JSObject) runtime.execute(\"document\");\n doc.setMember(\"jsHandlers\", jsHandlers);\n registeredOnJS = true;\n }\n return jsHandlers.registerHandler(h);\n }", "public void setEditedFilePath(final String editedFilePath) {\n\n m_filePathField.setReadOnly(false);\n m_filePathField.setValue(editedFilePath);\n m_filePathField.setReadOnly(true);\n\n }" ]
The max possible width can be calculated doing the sum of of the inner cells and its totals @param crosstabColumn @return
[ "private int calculateRowHeaderMaxWidth(DJCrosstabColumn crosstabColumn) {\n\t\tint auxWidth = 0;\n\t\tboolean firstTime = true;\n\t\tList<DJCrosstabColumn> auxList = new ArrayList<DJCrosstabColumn>(djcross.getColumns());\n\t\tCollections.reverse(auxList);\n\t\tfor (DJCrosstabColumn col : auxList) {\n\t\t\tif (col.equals(crosstabColumn)){\n\t\t\t\tif (auxWidth == 0)\n\t\t\t\t\tauxWidth = col.getWidth();\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (firstTime){\n\t\t\t\tauxWidth += col.getWidth();\n\t\t\t\tfirstTime = false;\n\t\t\t}\n\t\t\tif (col.isShowTotals()) {\n\t\t\t\tauxWidth += col.getWidth();\n\t\t\t}\n\t\t}\n\t\treturn auxWidth;\n\t}" ]
[ "@Override\n public Scenario<GIVEN, WHEN, THEN> startScenario( String description ) {\n super.startScenario( description );\n return this;\n\n }", "private void calcCurrentItem() {\n int pointerAngle;\n\n // calculate the correct pointer angle, depending on clockwise drawing or not\n if(mOpenClockwise) {\n pointerAngle = (mIndicatorAngle + 360 - mPieRotation) % 360;\n }\n else {\n pointerAngle = (mIndicatorAngle + 180 + mPieRotation) % 360;\n }\n\n for (int i = 0; i < mPieData.size(); ++i) {\n PieModel model = mPieData.get(i);\n if (model.getStartAngle() <= pointerAngle && pointerAngle <= model.getEndAngle()) {\n if (i != mCurrentItem) {\n setCurrentItem(i, false);\n }\n break;\n }\n }\n }", "private int convertMoneyness(double moneyness) {\r\n\t\tif(quotingConvention == QuotingConvention.PAYERVOLATILITYLOGNORMAL) {\r\n\t\t\treturn (int) Math.round(moneyness * 100);\r\n\t\t} else if(quotingConvention == QuotingConvention.RECEIVERPRICE) {\r\n\t\t\treturn - (int) Math.round(moneyness * 10000);\r\n\t\t} else {\r\n\t\t\treturn (int) Math.round(moneyness * 10000);\r\n\t\t}\r\n\t}", "public static lbvserver[] get(nitro_service service) throws Exception{\n\t\tlbvserver obj = new lbvserver();\n\t\tlbvserver[] response = (lbvserver[])obj.get_resources(service);\n\t\treturn response;\n\t}", "public ValueContainer[] getKeyValues(ClassDescriptor cld, Identity oid) throws PersistenceBrokerException\r\n {\r\n return getKeyValues(cld, oid, true);\r\n }", "public static void doEnqueue(final Jedis jedis, final String namespace, final String queue, final String jobJson) {\n jedis.sadd(JesqueUtils.createKey(namespace, QUEUES), queue);\n jedis.rpush(JesqueUtils.createKey(namespace, QUEUE, queue), jobJson);\n }", "private void handleContentLength(Event event) {\n if (event.getContent() == null) {\n return;\n }\n\n if (maxContentLength == -1 || event.getContent().length() <= maxContentLength) {\n return;\n }\n\n if (maxContentLength < CUT_START_TAG.length() + CUT_END_TAG.length()) {\n event.setContent(\"\");\n event.setContentCut(true);\n return;\n }\n\n int contentLength = maxContentLength - CUT_START_TAG.length() - CUT_END_TAG.length();\n event.setContent(CUT_START_TAG + event.getContent().substring(0, contentLength) + CUT_END_TAG);\n event.setContentCut(true);\n }", "private ClassReference processType(Type type, TypeReferenceLocation typeReferenceLocation, int lineNumber, int columnNumber, int length,\n String line)\n {\n if (type == null)\n return null;\n\n ITypeBinding resolveBinding = type.resolveBinding();\n if (resolveBinding == null)\n {\n ResolveClassnameResult resolvedResult = resolveClassname(type.toString());\n ResolutionStatus status = resolvedResult.found ? ResolutionStatus.RECOVERED : ResolutionStatus.UNRESOLVED;\n PackageAndClassName packageAndClassName = PackageAndClassName.parseFromQualifiedName(resolvedResult.result);\n\n return processTypeAsString(resolvedResult.result, packageAndClassName.packageName, packageAndClassName.className, status,\n typeReferenceLocation, lineNumber,\n columnNumber, length, line);\n }\n else\n {\n return processTypeBinding(type.resolveBinding(), ResolutionStatus.RESOLVED, typeReferenceLocation, lineNumber,\n columnNumber, length, line);\n }\n\n }", "public String getDbProperty(String key) {\n\n // extract the database key out of the entire key\n String databaseKey = key.substring(0, key.indexOf('.'));\n Properties databaseProperties = getDatabaseProperties().get(databaseKey);\n\n return databaseProperties.getProperty(key, \"\");\n }" ]
Use this API to enable clusterinstance resources of given names.
[ "public static base_responses enable(nitro_service client, Long clid[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (clid != null && clid.length > 0) {\n\t\t\tclusterinstance enableresources[] = new clusterinstance[clid.length];\n\t\t\tfor (int i=0;i<clid.length;i++){\n\t\t\t\tenableresources[i] = new clusterinstance();\n\t\t\t\tenableresources[i].clid = clid[i];\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, enableresources,\"enable\");\n\t\t}\n\t\treturn result;\n\t}" ]
[ "public static nspbr6 get(nitro_service service, String name) throws Exception{\n\t\tnspbr6 obj = new nspbr6();\n\t\tobj.set_name(name);\n\t\tnspbr6 response = (nspbr6) obj.get_resource(service);\n\t\treturn response;\n\t}", "public String getNotes()\n {\n String notes = (String) getCachedValue(ResourceField.NOTES);\n return (notes == null ? \"\" : notes);\n }", "private void debugLogEnd(String operationType,\n Long OriginTimeInMs,\n Long RequestStartTimeInMs,\n Long ResponseReceivedTimeInMs,\n String keyString,\n int numVectorClockEntries) {\n long durationInMs = ResponseReceivedTimeInMs - RequestStartTimeInMs;\n logger.debug(\"Received a response from voldemort server for Operation Type: \"\n + operationType\n + \" , For key(s): \"\n + keyString\n + \" , Store: \"\n + this.storeName\n + \" , Origin time of request (in ms): \"\n + OriginTimeInMs\n + \" , Response received at time (in ms): \"\n + ResponseReceivedTimeInMs\n + \" . Request sent at(in ms): \"\n + RequestStartTimeInMs\n + \" , Num vector clock entries: \"\n + numVectorClockEntries\n + \" , Duration from CoordinatorFatClient back to CoordinatorFatClient(in ms): \"\n + durationInMs);\n }", "public DJCrosstab build(){\r\n\t\tif (crosstab.getMeasures().isEmpty()){\r\n\t\t\tthrow new LayoutException(\"Crosstabs must have at least one measure\");\r\n\t\t}\r\n\t\tif (crosstab.getColumns().isEmpty()){\r\n\t\t\tthrow new LayoutException(\"Crosstabs must have at least one column\");\r\n\t\t}\r\n\t\tif (crosstab.getRows().isEmpty()){\r\n\t\t\tthrow new LayoutException(\"Crosstabs must have at least one row\");\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t//Ensure default dimension values\r\n\t\tfor (DJCrosstabColumn col : crosstab.getColumns()) {\r\n\t\t\tif (col.getWidth() == -1 && cellWidth != -1)\r\n\t\t\t\tcol.setWidth(cellWidth);\r\n\r\n\t\t\tif (col.getWidth() == -1 )\r\n\t\t\t\tcol.setWidth(DEFAULT_CELL_WIDTH);\r\n\r\n\t\t\tif (col.getHeaderHeight() == -1 && columnHeaderHeight != -1)\r\n\t\t\t\tcol.setHeaderHeight(columnHeaderHeight);\r\n\r\n\t\t\tif (col.getHeaderHeight() == -1)\r\n\t\t\t\tcol.setHeaderHeight(DEFAULT_COLUMN_HEADER_HEIGHT);\r\n\t\t}\r\n\r\n\t\tfor (DJCrosstabRow row : crosstab.getRows()) {\r\n\t\t\tif (row.getHeight() == -1 && cellHeight != -1)\r\n\t\t\t\trow.setHeight(cellHeight);\r\n\r\n\t\t\tif (row.getHeight() == -1 )\r\n\t\t\t\trow.setHeight(DEFAULT_CELL_HEIGHT);\r\n\r\n\t\t\tif (row.getHeaderWidth() == -1 && rowHeaderWidth != -1)\r\n\t\t\t\trow.setHeaderWidth(rowHeaderWidth);\r\n\r\n\t\t\tif (row.getHeaderWidth() == -1)\r\n\t\t\t\trow.setHeaderWidth(DEFAULT_ROW_HEADER_WIDTH);\r\n\r\n\t\t}\r\n\t\treturn crosstab;\r\n\t}", "public static List<Node> getSiblings(Node parent, Node element) {\n\t\tList<Node> result = new ArrayList<>();\n\t\tNodeList list = parent.getChildNodes();\n\n\t\tfor (int i = 0; i < list.getLength(); i++) {\n\t\t\tNode el = list.item(i);\n\n\t\t\tif (el.getNodeName().equals(element.getNodeName())) {\n\t\t\t\tresult.add(el);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}", "private static void setCmsOfflineProject(CmsObject cms) {\n\n if (null == cms) {\n return;\n }\n\n final CmsRequestContext cmsContext = cms.getRequestContext();\n final CmsProject cmsProject = cmsContext.getCurrentProject();\n\n if (cmsProject.isOnlineProject()) {\n CmsProject cmsOfflineProject;\n try {\n cmsOfflineProject = cms.readProject(\"Offline\");\n cmsContext.setCurrentProject(cmsOfflineProject);\n } catch (CmsException e) {\n LOG.warn(\"Could not set the current project to \\\"Offline\\\". \");\n }\n }\n }", "public void release(Contextual<T> contextual, T instance) {\n synchronized (dependentInstances) {\n for (ContextualInstance<?> dependentInstance : dependentInstances) {\n // do not destroy contextual again, since it's just being destroyed\n if (contextual == null || !(dependentInstance.getContextual().equals(contextual))) {\n destroy(dependentInstance);\n }\n }\n }\n if (resourceReferences != null) {\n for (ResourceReference<?> reference : resourceReferences) {\n reference.release();\n }\n }\n }", "@RequestMapping(value = \"/api/profile\", method = RequestMethod.POST)\n public\n @ResponseBody\n HashMap<String, Object> addProfile(Model model, String name) throws Exception {\n logger.info(\"Should be adding the profile name when I hit the enter button={}\", name);\n return Utils.getJQGridJSON(profileService.add(name), \"profile\");\n }", "public void copyTo(ColumnBuffer dest, LongPredicate timestampTest) {\n dest.clear();\n\n if (key != null) {\n dest.key = new Key(key);\n }\n\n for (int i = 0; i < timeStamps.size(); i++) {\n long time = timeStamps.get(i);\n if (timestampTest.test(time)) {\n dest.add(time, values.get(i));\n }\n }\n }" ]
Returns whether this host should ignore operations from the master domain controller that target the given address. @param address the resource address. Cannot be {@code null} @return {@code true} if the operation should be ignored; {@code false} otherwise
[ "public boolean isResourceExcluded(final PathAddress address) {\n if (!localHostControllerInfo.isMasterDomainController() && address.size() > 0) {\n IgnoredDomainResourceRoot root = this.rootResource;\n PathElement firstElement = address.getElement(0);\n IgnoreDomainResourceTypeResource typeResource = root == null ? null : root.getChildInternal(firstElement.getKey());\n if (typeResource != null) {\n if (typeResource.hasName(firstElement.getValue())) {\n return true;\n }\n }\n }\n return false;\n }" ]
[ "public Iterator<BoxItem.Info> iterator() {\n URL url = GET_ITEMS_URL.build(this.api.getBaseURL());\n return new BoxItemIterator(this.api, url);\n }", "private String formatUnits(Number value)\n {\n return (value == null ? null : m_formats.getUnitsDecimalFormat().format(value.doubleValue() / 100));\n }", "public static double JaccardDistance(double[] p, double[] q) {\n double distance = 0;\n int intersection = 0, union = 0;\n\n for (int x = 0; x < p.length; x++) {\n if ((p[x] != 0) || (q[x] != 0)) {\n if (p[x] == q[x]) {\n intersection++;\n }\n\n union++;\n }\n }\n\n if (union != 0)\n distance = 1.0 - ((double) intersection / (double) union);\n else\n distance = 0;\n\n return distance;\n }", "protected void processLabels(List<MonolingualTextValue> labels) {\n for(MonolingualTextValue label : labels) {\n \tString lang = label.getLanguageCode();\n \tNameWithUpdate currentValue = newLabels.get(lang);\n \tif (currentValue == null || !currentValue.value.equals(label)) {\n\t newLabels.put(lang,\n\t new NameWithUpdate(label, true));\n\t \n\t // Delete any alias that matches the new label\n\t AliasesWithUpdate currentAliases = newAliases.get(lang);\n\t if (currentAliases != null && currentAliases.aliases.contains(label)) {\n\t \tdeleteAlias(label);\n\t }\n \t}\n }\n \n }", "public void setColorSchemeResources(int... colorResIds) {\n final Resources res = getResources();\n int[] colorRes = new int[colorResIds.length];\n for (int i = 0; i < colorResIds.length; i++) {\n colorRes[i] = res.getColor(colorResIds[i]);\n }\n setColorSchemeColors(colorRes);\n }", "final void begin() {\n if (LogFileCompressionStrategy.existsFor(this.properties)) {\n final Thread thread = new Thread(this, \"Log4J File Compressor\");\n thread.setDaemon(true);\n thread.start();\n this.threadRef = thread;\n }\n }", "public String[] getMethods(String pluginClass) throws Exception {\n ArrayList<String> methodNames = new ArrayList<String>();\n\n Method[] methods = getClass(pluginClass).getDeclaredMethods();\n for (Method method : methods) {\n logger.info(\"Checking {}\", method.getName());\n\n com.groupon.odo.proxylib.models.Method methodInfo = this.getMethod(pluginClass, method.getName());\n if (methodInfo == null) {\n continue;\n }\n\n // check annotations\n Boolean matchesAnnotation = false;\n if (methodInfo.getMethodType().endsWith(Constants.PLUGIN_RESPONSE_OVERRIDE_CLASS) ||\n methodInfo.getMethodType().endsWith(Constants.PLUGIN_RESPONSE_OVERRIDE_V2_CLASS)) {\n matchesAnnotation = true;\n }\n\n if (!methodNames.contains(method.getName()) && matchesAnnotation) {\n methodNames.add(method.getName());\n }\n }\n\n return methodNames.toArray(new String[0]);\n }", "private void notifyIfStopped() {\n if (isAcceptingNewJobs() || !this.runningTasksFutures.isEmpty()) {\n return;\n }\n final File stoppedFile = new File(this.workingDirectories.getWorking(), \"stopped\");\n try {\n LOGGER.info(\"The print has finished processing jobs and can now stop\");\n stoppedFile.createNewFile();\n } catch (IOException e) {\n LOGGER.warn(\"Cannot create the {} file\", stoppedFile, e);\n }\n }", "private static String wordShapeChris2Long(String s, boolean omitIfInBoundary, int len, Collection<String> knownLCWords) {\r\n final char[] beginChars = new char[BOUNDARY_SIZE];\r\n final char[] endChars = new char[BOUNDARY_SIZE];\r\n int beginUpto = 0;\r\n int endUpto = 0;\r\n final Set<Character> seenSet = new TreeSet<Character>(); // TreeSet guarantees stable ordering; has no size parameter\r\n\r\n boolean nonLetters = false;\r\n\r\n for (int i = 0; i < len; i++) {\r\n int iIncr = 0;\r\n char c = s.charAt(i);\r\n char m = c;\r\n if (Character.isDigit(c)) {\r\n m = 'd';\r\n } else if (Character.isLowerCase(c)) {\r\n m = 'x';\r\n } else if (Character.isUpperCase(c) || Character.isTitleCase(c)) {\r\n m = 'X';\r\n }\r\n for (String gr : greek) {\r\n if (s.startsWith(gr, i)) {\r\n m = 'g';\r\n //System.out.println(s + \" :: \" + s.substring(i+1));\r\n iIncr = gr.length() - 1;\r\n break;\r\n }\r\n }\r\n if (m != 'x' && m != 'X') {\r\n nonLetters = true;\r\n }\r\n\r\n if (i < BOUNDARY_SIZE) {\r\n beginChars[beginUpto++] = m;\r\n } else if (i < len - BOUNDARY_SIZE) {\r\n seenSet.add(Character.valueOf(m));\r\n } else {\r\n endChars[endUpto++] = m;\r\n }\r\n i += iIncr;\r\n // System.out.println(\"Position skips to \" + i);\r\n }\r\n\r\n // Calculate size. This may be an upperbound, but is often correct\r\n int sbSize = beginUpto + endUpto + seenSet.size();\r\n if (knownLCWords != null) { sbSize++; }\r\n final StringBuilder sb = new StringBuilder(sbSize);\r\n // put in the beginning chars\r\n sb.append(beginChars, 0, beginUpto);\r\n // put in the stored ones sorted\r\n if (omitIfInBoundary) {\r\n for (Character chr : seenSet) {\r\n char ch = chr.charValue();\r\n boolean insert = true;\r\n for (int i = 0; i < beginUpto; i++) {\r\n if (beginChars[i] == ch) {\r\n insert = false;\r\n break;\r\n }\r\n }\r\n for (int i = 0; i < endUpto; i++) {\r\n if (endChars[i] == ch) {\r\n insert = false;\r\n break;\r\n }\r\n }\r\n if (insert) {\r\n sb.append(ch);\r\n }\r\n }\r\n } else {\r\n for (Character chr : seenSet) {\r\n sb.append(chr.charValue());\r\n }\r\n }\r\n // and add end ones\r\n sb.append(endChars, 0, endUpto);\r\n\r\n if (knownLCWords != null) {\r\n if (!nonLetters && knownLCWords.contains(s.toLowerCase())) {\r\n sb.append('k');\r\n }\r\n }\r\n // System.out.println(s + \" became \" + sb);\r\n return sb.toString();\r\n }" ]
We need to distinguish the case where we're newly available and the case where we're already available. So we check the node status before we update it and return it to the caller. @param isAvailable True to set to available, false to make unavailable @return Previous value of isAvailable
[ "private boolean setAvailable(NodeStatus nodeStatus, boolean isAvailable) {\n synchronized(nodeStatus) {\n boolean previous = nodeStatus.isAvailable();\n\n nodeStatus.setAvailable(isAvailable);\n nodeStatus.setLastChecked(getConfig().getTime().getMilliseconds());\n\n return previous;\n }\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 {\r\n name = it.getNext();\r\n fieldDef = getField(name);\r\n if (fieldDef == null)\r\n {\r\n throw new NoSuchFieldException(name);\r\n }\r\n result.add(fieldDef);\r\n }\r\n return result;\r\n }", "public void setAlias(String alias)\r\n\t{\r\n\t\tm_alias = alias;\r\n\t\tString attributePath = (String)getAttribute();\r\n\t\tboolean allPathsAliased = true;\r\n\t\tm_userAlias = new UserAlias(alias, attributePath, allPathsAliased);\r\n\t\t\r\n\t}", "public static ModelNode getOperationAddress(final ModelNode op) {\n return op.hasDefined(OP_ADDR) ? op.get(OP_ADDR) : new ModelNode();\n }", "private void setTaskNotes(Task task, byte[] data, ExtendedData taskExtData, FixDeferFix taskVarData)\n {\n String notes = taskExtData.getString(TASK_NOTES);\n if (notes == null && data.length == 366)\n {\n byte[] offsetData = taskVarData.getByteArray(getOffset(data, 362));\n if (offsetData != null && offsetData.length >= 12)\n {\n notes = taskVarData.getString(getOffset(offsetData, 8));\n \n // We do pick up some random stuff with this approach, and \n // we don't know enough about the file format to know when to ignore it\n // so we'll use a heuristic here to ignore anything that\n // doesn't look like RTF.\n if (notes != null && notes.indexOf('{') == -1)\n {\n notes = null;\n }\n }\n }\n \n if (notes != null)\n {\n if (m_reader.getPreserveNoteFormatting() == false)\n {\n notes = RtfHelper.strip(notes);\n }\n\n task.setNotes(notes);\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,\n \"UTF-8\"));\n String line;\n while ((line = br.readLine()) != null) {\n if (line.startsWith(BUNDLE_VERSION)) {\n retStr = line.substring(BUNDLE_VERSION.length() + 1);\n retStr = retStr.trim();\n }\n }\n inputStream.close();\n } catch (Exception e) {\n logger.error(e.getMessage(),\n e);\n } finally {\n if (br != null) {\n IOUtils.closeQuietly(br);\n }\n }\n return retStr;\n }", "public static int restrictRange(int value, int min, int max)\n {\n return Math.min((Math.max(value, min)), max);\n }", "public void setEnable(boolean flag) {\n if (flag == mIsEnabled)\n return;\n\n mIsEnabled = flag;\n\n if (getNative() != 0)\n {\n NativeComponent.setEnable(getNative(), flag);\n }\n if (flag)\n {\n onEnable();\n }\n else\n {\n onDisable();\n }\n }", "public static List<String> getChildrenParentMayNotExist(ZkClient zkClient, String path) {\n try {\n return zkClient.getChildren(path);\n } catch (ZkNoNodeException e) {\n return null;\n }\n }", "public static List<? extends Expression> getMethodArguments(ASTNode methodCall) {\r\n if (methodCall instanceof ConstructorCallExpression) {\r\n return extractExpressions(((ConstructorCallExpression) methodCall).getArguments());\r\n } else if (methodCall instanceof MethodCallExpression) {\r\n return extractExpressions(((MethodCallExpression) methodCall).getArguments());\r\n } else if (methodCall instanceof StaticMethodCallExpression) {\r\n return extractExpressions(((StaticMethodCallExpression) methodCall).getArguments());\r\n } else if (respondsTo(methodCall, \"getArguments\")) {\r\n throw new RuntimeException(); // TODO: remove, should never happen\r\n }\r\n return new ArrayList<Expression>();\r\n }" ]
Extracts project properties from a ConceptDraw PROJECT file. @param cdp ConceptDraw PROJECT file
[ "private void readProjectProperties(Document cdp)\n {\n WorkspaceProperties props = cdp.getWorkspaceProperties();\n ProjectProperties mpxjProps = m_projectFile.getProjectProperties();\n mpxjProps.setSymbolPosition(props.getCurrencyPosition());\n mpxjProps.setCurrencyDigits(props.getCurrencyDigits());\n mpxjProps.setCurrencySymbol(props.getCurrencySymbol());\n mpxjProps.setDaysPerMonth(props.getDaysPerMonth());\n mpxjProps.setMinutesPerDay(props.getHoursPerDay());\n mpxjProps.setMinutesPerWeek(props.getHoursPerWeek());\n\n m_workHoursPerDay = mpxjProps.getMinutesPerDay().doubleValue() / 60.0;\n }" ]
[ "public static base_response delete(nitro_service client, dnstxtrec resource) throws Exception {\n\t\tdnstxtrec deleteresource = new dnstxtrec();\n\t\tdeleteresource.domain = resource.domain;\n\t\tdeleteresource.String = resource.String;\n\t\tdeleteresource.recordid = resource.recordid;\n\t\treturn deleteresource.delete_resource(client);\n\t}", "void handleFacebookError(HttpStatus statusCode, FacebookError error) {\n\t\tif (error != null && error.getCode() != null) {\n\t\t\tint code = error.getCode();\n\t\t\t\n\t\t\tif (code == UNKNOWN) {\n\t\t\t\tthrow new UncategorizedApiException(FACEBOOK_PROVIDER_ID, error.getMessage(), null);\n\t\t\t} else if (code == SERVICE) {\n\t\t\t\tthrow new ServerException(FACEBOOK_PROVIDER_ID, error.getMessage());\n\t\t\t} else if (code == TOO_MANY_CALLS || code == USER_TOO_MANY_CALLS || code == EDIT_FEED_TOO_MANY_USER_CALLS || code == EDIT_FEED_TOO_MANY_USER_ACTION_CALLS) {\n\t\t\t\tthrow new RateLimitExceededException(FACEBOOK_PROVIDER_ID);\n\t\t\t} else if (code == PERMISSION_DENIED || isUserPermissionError(code)) {\n\t\t\t\tthrow new InsufficientPermissionException(FACEBOOK_PROVIDER_ID);\n\t\t\t} else if (code == PARAM_SESSION_KEY || code == PARAM_SIGNATURE) {\n\t\t\t\tthrow new InvalidAuthorizationException(FACEBOOK_PROVIDER_ID, error.getMessage());\n\t\t\t} else if (code == PARAM_ACCESS_TOKEN && error.getSubcode() == null) {\n\t\t\t\tthrow new InvalidAuthorizationException(FACEBOOK_PROVIDER_ID, error.getMessage());\n\t\t\t} else if (code == PARAM_ACCESS_TOKEN && error.getSubcode() == 463) {\n\t\t\t\tthrow new ExpiredAuthorizationException(FACEBOOK_PROVIDER_ID);\n\t\t\t} else if (code == PARAM_ACCESS_TOKEN) {\n\t\t\t\tthrow new RevokedAuthorizationException(FACEBOOK_PROVIDER_ID, error.getMessage());\n\t\t\t} else if (code == MESG_DUPLICATE) { \n\t\t\t\tthrow new DuplicateStatusException(FACEBOOK_PROVIDER_ID, error.getMessage());\n\t\t\t} else if (code == DATA_OBJECT_NOT_FOUND || code == PATH_UNKNOWN) {\n\t\t\t\tthrow new ResourceNotFoundException(FACEBOOK_PROVIDER_ID, error.getMessage());\n\t\t\t} else {\n\t\t\t\tthrow new UncategorizedApiException(FACEBOOK_PROVIDER_ID, error.getMessage(), null);\n\t\t\t}\n\t\t}\n\n\t}", "public ParallelTaskBuilder setReplaceVarMapToSingleTargetFromMap(\n Map<String, StrStrMap> replacementVarMapNodeSpecific,\n String uniformTargetHost) {\n setReplacementVarMapNodeSpecific(replacementVarMapNodeSpecific);\n\n if (Strings.isNullOrEmpty(uniformTargetHost)) {\n logger.error(\"uniform target host is empty or null. skip setting.\");\n return this;\n }\n for (Entry<String, StrStrMap> entry : replacementVarMapNodeSpecific\n .entrySet()) {\n\n if (entry.getValue() != null) {\n entry.getValue().addPair(PcConstants.UNIFORM_TARGET_HOST_VAR,\n uniformTargetHost);\n }\n }\n return this;\n }", "private void initializeLogging() {\n\t\t// Since logging is static, make sure this is done only once even if\n\t\t// multiple clients are created (e.g., during tests)\n\t\tif (consoleAppender != null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconsoleAppender = new ConsoleAppender();\n\t\tconsoleAppender.setLayout(new PatternLayout(LOG_PATTERN));\n\t\tconsoleAppender.setThreshold(Level.INFO);\n\t\tLevelRangeFilter filter = new LevelRangeFilter();\n\t\tfilter.setLevelMin(Level.TRACE);\n\t\tfilter.setLevelMax(Level.INFO);\n\t\tconsoleAppender.addFilter(filter);\n\t\tconsoleAppender.activateOptions();\n\t\torg.apache.log4j.Logger.getRootLogger().addAppender(consoleAppender);\n\n\t\terrorAppender = new ConsoleAppender();\n\t\terrorAppender.setLayout(new PatternLayout(LOG_PATTERN));\n\t\terrorAppender.setThreshold(Level.WARN);\n\t\terrorAppender.setTarget(ConsoleAppender.SYSTEM_ERR);\n\t\terrorAppender.activateOptions();\n\t\torg.apache.log4j.Logger.getRootLogger().addAppender(errorAppender);\n\t}", "public static Method findGetter(final Object object, final String fieldName) {\n\t\tif( object == null ) {\n\t\t\tthrow new NullPointerException(\"object should not be null\");\n\t\t} else if( fieldName == null ) {\n\t\t\tthrow new NullPointerException(\"fieldName should not be null\");\n\t\t}\n\t\t\n\t\tfinal Class<?> clazz = object.getClass();\n\t\t\n\t\t// find a standard getter\n\t\tfinal String standardGetterName = getMethodNameForField(GET_PREFIX, fieldName);\n\t\tMethod getter = findGetterWithCompatibleReturnType(standardGetterName, clazz, false);\n\t\t\n\t\t// if that fails, try for an isX() style boolean getter\n\t\tif( getter == null ) {\n\t\t\tfinal String booleanGetterName = getMethodNameForField(IS_PREFIX, fieldName);\n\t\t\tgetter = findGetterWithCompatibleReturnType(booleanGetterName, clazz, true);\n\t\t}\n\t\t\n\t\tif( getter == null ) {\n\t\t\tthrow new SuperCsvReflectionException(\n\t\t\t\tString\n\t\t\t\t\t.format(\n\t\t\t\t\t\t\"unable to find getter for field %s in class %s - check that the corresponding nameMapping element matches the field name in the bean\",\n\t\t\t\t\t\tfieldName, clazz.getName()));\n\t\t}\n\t\t\n\t\treturn getter;\n\t}", "public static List<Integer> toIntegerList(List<String> strList, boolean failOnException){\n\t\tList<Integer> intList = new ArrayList<Integer>();\n\t\tfor(String str : strList){\n\t\t\ttry{\n\t\t\t\tintList.add(Integer.parseInt(str));\n\t\t\t}\n\t\t\tcatch(NumberFormatException nfe){\n\t\t\t\tif(failOnException){\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tintList.add(null);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn intList;\n\t}", "protected Object getTypedValue(int type, byte[] value)\n {\n Object result;\n\n switch (type)\n {\n case 4: // Date\n {\n result = MPPUtility.getTimestamp(value, 0);\n break;\n }\n\n case 6: // Duration\n {\n TimeUnit units = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(value, 4), m_properties.getDefaultDurationUnits());\n result = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(value, 0), units);\n break;\n }\n\n case 9: // Cost\n {\n result = Double.valueOf(MPPUtility.getDouble(value, 0) / 100);\n break;\n }\n\n case 15: // Number\n {\n result = Double.valueOf(MPPUtility.getDouble(value, 0));\n break;\n }\n\n case 36058:\n case 21: // Text\n {\n result = MPPUtility.getUnicodeString(value, 0);\n break;\n }\n\n default:\n {\n result = value;\n break;\n }\n }\n\n return result;\n }", "public static DMatrixSparseCSC symmetric( int N , int nz_total ,\n double min , double max , Random rand) {\n\n // compute the number of elements in the triangle, including diagonal\n int Ntriagle = (N*N+N)/2;\n // create a list of open elements\n int open[] = new int[Ntriagle];\n for (int row = 0, index = 0; row < N; row++) {\n for (int col = row; col < N; col++, index++) {\n open[index] = row*N+col;\n }\n }\n\n // perform a random draw\n UtilEjml.shuffle(open,open.length,0,nz_total,rand);\n Arrays.sort(open,0,nz_total);\n\n // construct the matrix\n DMatrixSparseTriplet A = new DMatrixSparseTriplet(N,N,nz_total*2);\n for (int i = 0; i < nz_total; i++) {\n int index = open[i];\n int row = index/N;\n int col = index%N;\n\n double value = rand.nextDouble()*(max-min)+min;\n\n if( row == col ) {\n A.addItem(row,col,value);\n } else {\n A.addItem(row,col,value);\n A.addItem(col,row,value);\n }\n }\n\n DMatrixSparseCSC B = new DMatrixSparseCSC(N,N,A.nz_length);\n ConvertDMatrixStruct.convert(A,B);\n\n return B;\n }", "public AsciiTable setCharTranslator(CharacterTranslator charTranslator) {\r\n\t\tfor(AT_Row row : this.rows){\r\n\t\t\tif(row.getType()==TableRowType.CONTENT){\r\n\t\t\t\trow.setCharTranslator(charTranslator);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}" ]
Submit a command to the server. @param command The CLI command @return The DMR response as a ModelNode @throws CommandFormatException @throws IOException
[ "public synchronized ModelNode doCommand(String command) throws CommandFormatException, IOException {\n ModelNode request = cmdCtx.buildRequest(command);\n return execute(request, isSlowCommand(command)).getResponseNode();\n }" ]
[ "public static BoxRetentionPolicyAssignment.Info createAssignmentToEnterprise(BoxAPIConnection api,\r\n String policyID) {\r\n return createAssignment(api, policyID, new JsonObject().add(\"type\", TYPE_ENTERPRISE), null);\r\n }", "public Collection values()\r\n {\r\n if (values != null) return values;\r\n values = new AbstractCollection()\r\n {\r\n public int size()\r\n {\r\n return size;\r\n }\r\n\r\n public void clear()\r\n {\r\n ReferenceMap.this.clear();\r\n }\r\n\r\n public Iterator iterator()\r\n {\r\n return new ValueIterator();\r\n }\r\n };\r\n return values;\r\n }", "public void rollback(File rollbackToDir) {\n logger.info(\"Rolling back store '\" + getName() + \"'\");\n fileModificationLock.writeLock().lock();\n try {\n if(rollbackToDir == null)\n throw new VoldemortException(\"Version directory specified to rollback is null\");\n\n if(!rollbackToDir.exists())\n throw new VoldemortException(\"Version directory \" + rollbackToDir.getAbsolutePath()\n + \" specified to rollback does not exist\");\n\n long versionId = ReadOnlyUtils.getVersionId(rollbackToDir);\n if(versionId == -1)\n throw new VoldemortException(\"Cannot parse version id\");\n\n File[] backUpDirs = ReadOnlyUtils.getVersionDirs(storeDir, versionId, Long.MAX_VALUE);\n if(backUpDirs == null || backUpDirs.length <= 1) {\n logger.warn(\"No rollback performed since there are no back-up directories\");\n return;\n }\n backUpDirs = ReadOnlyUtils.findKthVersionedDir(backUpDirs, 0, backUpDirs.length - 1);\n\n if(isOpen)\n close();\n\n // open the rollback directory\n open(rollbackToDir);\n\n // back-up all other directories\n DateFormat df = new SimpleDateFormat(\"MM-dd-yyyy\");\n for(int index = 1; index < backUpDirs.length; index++) {\n Utils.move(backUpDirs[index], new File(storeDir, backUpDirs[index].getName() + \".\"\n + df.format(new Date()) + \".bak\"));\n }\n\n } finally {\n fileModificationLock.writeLock().unlock();\n logger.info(\"Rollback operation completed on '\" + getName() + \"', releasing lock.\");\n }\n }", "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 static boolean unzipFileOrFolder(File zipFile, String unzippedFolder){\n\t\tInputStream is;\n\t\tArchiveInputStream in = null;\n\t\tOutputStream out = null;\n\t\t\n\t\tif(!zipFile.isFile()){\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif(unzippedFolder == null){\n\t\t\tunzippedFolder = FilenameUtils.removeExtension(zipFile.getAbsolutePath());\n\t\t}\n\t\ttry {\n\t\t\tis = new FileInputStream(zipFile);\n\t\t\tnew File(unzippedFolder).mkdir();\n\t\t\t\n\t\t\tin = new ArchiveStreamFactory().createArchiveInputStream(ArchiveStreamFactory.ZIP, is);\n\t\t\t\n\t\t\tZipArchiveEntry entry = (ZipArchiveEntry)in.getNextEntry();\n\t\t\twhile(entry != null){\n\t\t\t\tif(entry.isDirectory()){\n\t\t\t\t\tnew File(unzippedFolder,entry.getName()).mkdir();\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tout = new FileOutputStream(new File(unzippedFolder, entry.getName()));\n\t\t\t\t\tIOUtils.copy(in, out);\n\t\t\t\t\tout.close();\n\t\t\t\t\tout = null;\n\t\t\t\t}\n\t\t\t\tentry = (ZipArchiveEntry)in.getNextEntry();\n\t\t\t}\t\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t\treturn false;\n\t\t} catch (ArchiveException e) {\n\t\t\te.printStackTrace();\n\t\t\treturn false;\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t\treturn false;\n\t\t}\n\t\tfinally{\n\t\t\tif(out != null){\n\t\t\t\ttry {\n\t\t\t\t\tout.close();\n\t\t\t\t} catch (IOException e) {}\n\t\t\t}\n\t\t\tif(in != null){\n\t\t\t\ttry {\n\t\t\t\t\tin.close();\n\t\t\t\t} catch (IOException e) {}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "public static Integer parseInteger(String value) throws ParseException\n {\n Integer result = null;\n\n if (value.length() > 0 && value.indexOf(' ') == -1)\n {\n if (value.indexOf('.') == -1)\n {\n result = Integer.valueOf(value);\n }\n else\n {\n Number n = DatatypeConverter.parseDouble(value);\n result = Integer.valueOf(n.intValue());\n }\n }\n\n return result;\n }", "@RequestMapping(value = \"/api/plugins\", method = RequestMethod.GET)\n public\n @ResponseBody\n HashMap<String, Object> getPluginInformation() {\n return pluginInformation();\n }", "public CollectionRequest<Attachment> findByTask(String task) {\n \n String path = String.format(\"/tasks/%s/attachments\", task);\n return new CollectionRequest<Attachment>(this, Attachment.class, path, \"GET\");\n }", "public static int getMpxField(int value)\n {\n int result = 0;\n\n if (value >= 0 && value < MPXJ_MPX_ARRAY.length)\n {\n result = MPXJ_MPX_ARRAY[value];\n }\n return (result);\n }" ]
Checks to see if an Oracle Server exists. @param curator It is the responsibility of the caller to ensure the curator is started @return boolean if the server exists in zookeeper
[ "public static boolean oracleExists(CuratorFramework curator) {\n boolean exists = false;\n try {\n exists = curator.checkExists().forPath(ZookeeperPath.ORACLE_SERVER) != null\n && !curator.getChildren().forPath(ZookeeperPath.ORACLE_SERVER).isEmpty();\n } catch (Exception nne) {\n if (nne instanceof KeeperException.NoNodeException) {\n // you'll do nothing\n } else {\n throw new RuntimeException(nne);\n }\n }\n return exists;\n }" ]
[ "public static authenticationradiusaction[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{\n\t\tauthenticationradiusaction obj = new authenticationradiusaction();\n\t\toptions option = new options();\n\t\toption.set_filter(filter);\n\t\tauthenticationradiusaction[] response = (authenticationradiusaction[]) obj.getfiltered(service, option);\n\t\treturn response;\n\t}", "public static systemsession[] get(nitro_service service) throws Exception{\n\t\tsystemsession obj = new systemsession();\n\t\tsystemsession[] response = (systemsession[])obj.get_resources(service);\n\t\treturn response;\n\t}", "@SuppressWarnings(\"deprecation\")\n private void cancelRequestAndWorkers() {\n\n for (ActorRef worker : workers.values()) {\n if (worker != null && !worker.isTerminated()) {\n worker.tell(OperationWorkerMsgType.CANCEL, getSelf());\n }\n }\n\n logger.info(\"ExecutionManager sending cancelPendingRequest at time: \"\n + PcDateUtils.getNowDateTimeStr());\n }", "private void processWorkWeeks(byte[] data, int offset, ProjectCalendar cal)\n {\n // System.out.println(\"Calendar=\" + cal.getName());\n // System.out.println(\"Work week block start offset=\" + offset);\n // System.out.println(ByteArrayHelper.hexdump(data, true, 16, \"\"));\n\n // skip 4 byte header\n offset += 4;\n\n while (data.length >= offset + ((7 * 60) + 2 + 2 + 8 + 4))\n {\n //System.out.println(\"Week start offset=\" + offset);\n ProjectCalendarWeek week = cal.addWorkWeek();\n for (Day day : Day.values())\n {\n // 60 byte block per day\n processWorkWeekDay(data, offset, week, day);\n offset += 60;\n }\n\n Date startDate = DateHelper.getDayStartDate(MPPUtility.getDate(data, offset));\n offset += 2;\n\n Date finishDate = DateHelper.getDayEndDate(MPPUtility.getDate(data, offset));\n offset += 2;\n\n // skip unknown 8 bytes\n //System.out.println(ByteArrayHelper.hexdump(data, offset, 8, false));\n offset += 8;\n\n //\n // Extract the name length - ensure that it is aligned to a 4 byte boundary\n //\n int nameLength = MPPUtility.getInt(data, offset);\n if (nameLength % 4 != 0)\n {\n nameLength = ((nameLength / 4) + 1) * 4;\n }\n offset += 4;\n\n if (nameLength != 0)\n {\n String name = MPPUtility.getUnicodeString(data, offset, nameLength);\n offset += nameLength;\n week.setName(name);\n }\n\n week.setDateRange(new DateRange(startDate, finishDate));\n // System.out.println(week);\n }\n }", "public void setDynamicValue(String attribute, String value) {\n\n if (null == m_dynamicValues) {\n m_dynamicValues = new ConcurrentHashMap<String, String>();\n }\n m_dynamicValues.put(attribute, value);\n }", "private static int getSqlInLimit()\r\n {\r\n try\r\n {\r\n PersistenceBrokerConfiguration config = (PersistenceBrokerConfiguration) PersistenceBrokerFactory\r\n .getConfigurator().getConfigurationFor(null);\r\n return config.getSqlInLimit();\r\n }\r\n catch (ConfigurationException e)\r\n {\r\n return 200;\r\n }\r\n }", "public static final Date getTime(InputStream is) throws IOException\n {\n int timeValue = getInt(is);\n timeValue -= 86400;\n timeValue /= 60;\n return DateHelper.getTimeFromMinutesPastMidnight(Integer.valueOf(timeValue));\n }", "@PreDestroy\n public void disconnectLocator() throws InterruptedException,\n ServiceLocatorException {\n if (LOG.isLoggable(Level.FINE)) {\n LOG.fine(\"Destroy Locator client\");\n }\n\n if (endpointCollector != null) {\n endpointCollector.stopScheduledCollection();\n }\n \n if (locatorClient != null) {\n locatorClient.disconnect();\n locatorClient = null;\n }\n }", "public T withAlias(String text, String languageCode) {\n\t\twithAlias(factory.getMonolingualTextValue(text, languageCode));\n\t\treturn getThis();\n\t}" ]
Modifies the specified mode and length arrays to combine adjacent modes of the same type, returning the updated index point.
[ "private int combineSubsetBlocks(Mode[] mode_type, int[] mode_length, int index_point) {\n /* bring together same type blocks */\n if (index_point > 1) {\n for (int i = 1; i < index_point; i++) {\n if (mode_type[i - 1] == mode_type[i]) {\n /* bring together */\n mode_length[i - 1] = mode_length[i - 1] + mode_length[i];\n /* decrease the list */\n for (int j = i + 1; j < index_point; j++) {\n mode_length[j - 1] = mode_length[j];\n mode_type[j - 1] = mode_type[j];\n }\n index_point--;\n i--;\n }\n }\n }\n return index_point;\n }" ]
[ "public void setChildren(List<PrintComponent<?>> children) {\n\t\tthis.children = children;\n\t\t// needed for Json unmarshall !!!!\n\t\tfor (PrintComponent<?> child : children) {\n\t\t\tchild.setParent(this);\n\t\t}\n\t}", "public Rate getRate(int field) throws MPXJException\n {\n Rate result;\n\n if ((field < m_fields.length) && (m_fields[field].length() != 0))\n {\n try\n {\n String rate = m_fields[field];\n int index = rate.indexOf('/');\n double amount;\n TimeUnit units;\n\n if (index == -1)\n {\n amount = m_formats.getCurrencyFormat().parse(rate).doubleValue();\n units = TimeUnit.HOURS;\n }\n else\n {\n amount = m_formats.getCurrencyFormat().parse(rate.substring(0, index)).doubleValue();\n units = TimeUnitUtility.getInstance(rate.substring(index + 1), m_locale);\n }\n\n result = new Rate(amount, units);\n }\n\n catch (ParseException ex)\n {\n throw new MPXJException(\"Failed to parse rate\", ex);\n }\n }\n else\n {\n result = null;\n }\n\n return (result);\n }", "public static InstalledIdentity load(final File jbossHome, final ProductConfig productConfig, final File... repoRoots) throws IOException {\n final InstalledImage installedImage = installedImage(jbossHome);\n return load(installedImage, productConfig, Arrays.<File>asList(repoRoots), Collections.<File>emptyList());\n }", "public void forAllProcedures(String template, Properties attributes) throws XDocletException\r\n {\r\n for (Iterator it = _curClassDef.getProcedures(); it.hasNext(); )\r\n {\r\n _curProcedureDef = (ProcedureDef)it.next();\r\n generate(template);\r\n }\r\n _curProcedureDef = null;\r\n }", "public static VectorClock makeClock(Set<Integer> serverIds, long clockValue, long timestamp) {\n List<ClockEntry> clockEntries = new ArrayList<ClockEntry>(serverIds.size());\n for(Integer serverId: serverIds) {\n clockEntries.add(new ClockEntry(serverId.shortValue(), clockValue));\n }\n return new VectorClock(clockEntries, timestamp);\n }", "public int createPartitions(String topic, int partitionNum, boolean enlarge) throws IOException {\n KV<Receive, ErrorMapping> response = send(new CreaterRequest(topic, partitionNum, enlarge));\n return Utils.deserializeIntArray(response.k.buffer())[0];\n }", "private <FT, FID> FT createForeignShell(ConnectionSource connectionSource, Object val, ObjectCache objectCache)\n\t\t\tthrows SQLException {\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tDao<FT, FID> castDao = (Dao<FT, FID>) foreignDao;\n\t\tFT foreignObject = castDao.createObjectInstance();\n\t\tforeignIdField.assignField(connectionSource, foreignObject, val, false, objectCache);\n\t\treturn foreignObject;\n\t}", "public Iterable<BoxGroupMembership.Info> getAllMemberships(String ... fields) {\n final QueryStringBuilder builder = new QueryStringBuilder();\n if (fields.length > 0) {\n builder.appendParam(\"fields\", fields);\n }\n return new Iterable<BoxGroupMembership.Info>() {\n public Iterator<BoxGroupMembership.Info> iterator() {\n URL url = USER_MEMBERSHIPS_URL_TEMPLATE.buildWithQuery(\n BoxUser.this.getAPI().getBaseURL(), builder.toString(), BoxUser.this.getID());\n return new BoxGroupMembershipIterator(BoxUser.this.getAPI(), url);\n }\n };\n }", "public LinearInterpolatedTimeDiscreteProcess add(LinearInterpolatedTimeDiscreteProcess process) throws CalculationException {\n\t\tMap<Double, RandomVariable> sum = new HashMap<>();\n\n\t\tfor(double time: timeDiscretization) {\n\t\t\tsum.put(time, realizations.get(time).add(process.getProcessValue(time, 0)));\n\t\t}\n\n\t\treturn new LinearInterpolatedTimeDiscreteProcess(timeDiscretization, sum);\n\t}" ]
Parses an RgbaColor from a hexadecimal value. @return returns the parsed color
[ "public static RgbaColor fromHex(String hex) {\n if (hex.length() == 0 || hex.charAt(0) != '#') return getDefaultColor();\n\n // #rgb\n if (hex.length() == 4) {\n\n return new RgbaColor(parseHex(hex, 1, 2),\n parseHex(hex, 2, 3),\n parseHex(hex, 3, 4));\n\n }\n // #rrggbb\n else if (hex.length() == 7) {\n\n return new RgbaColor(parseHex(hex, 1, 3),\n parseHex(hex, 3, 5),\n parseHex(hex, 5, 7));\n\n }\n else {\n return getDefaultColor();\n }\n }" ]
[ "public static TextEncryptor queryableText(CharSequence password, CharSequence salt) {\n\t\treturn new HexEncodingTextEncryptor(new AndroidAesBytesEncryptor(password.toString(), salt, AndroidKeyGenerators.shared(16)));\n\t}", "public static base_response unset(nitro_service client, vridparam resource, String[] args) throws Exception{\n\t\tvridparam unsetresource = new vridparam();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "private String getDynamicAttributeValue(\n CmsFile file,\n I_CmsXmlContentValue value,\n String attributeName,\n CmsEntity editedLocalEntity) {\n\n if ((null != editedLocalEntity) && (editedLocalEntity.getAttribute(attributeName) != null)) {\n getSessionCache().setDynamicValue(\n attributeName,\n editedLocalEntity.getAttribute(attributeName).getSimpleValue());\n }\n String currentValue = getSessionCache().getDynamicValue(attributeName);\n if (null != currentValue) {\n return currentValue;\n }\n if (null != file) {\n if (value.getTypeName().equals(CmsXmlDynamicCategoryValue.TYPE_NAME)) {\n List<CmsCategory> categories = new ArrayList<CmsCategory>(0);\n try {\n categories = CmsCategoryService.getInstance().readResourceCategories(getCmsObject(), file);\n } catch (CmsException e) {\n LOG.error(Messages.get().getBundle().key(Messages.ERROR_FAILED_READING_CATEGORIES_1), e);\n }\n I_CmsWidget widget = null;\n widget = CmsWidgetUtil.collectWidgetInfo(value).getWidget();\n if ((null != widget) && (widget instanceof CmsCategoryWidget)) {\n String mainCategoryPath = ((CmsCategoryWidget)widget).getStartingCategory(\n getCmsObject(),\n getCmsObject().getSitePath(file));\n StringBuffer pathes = new StringBuffer();\n for (CmsCategory category : categories) {\n if (category.getPath().startsWith(mainCategoryPath)) {\n String path = category.getBasePath() + category.getPath();\n path = getCmsObject().getRequestContext().removeSiteRoot(path);\n pathes.append(path).append(',');\n }\n }\n String dynamicConfigString = pathes.length() > 0 ? pathes.substring(0, pathes.length() - 1) : \"\";\n getSessionCache().setDynamicValue(attributeName, dynamicConfigString);\n return dynamicConfigString;\n }\n }\n }\n return \"\";\n\n }", "public static final Color getColor(byte[] data, int offset)\n {\n Color result = null;\n\n if (getByte(data, offset + 3) == 0)\n {\n int r = getByte(data, offset);\n int g = getByte(data, offset + 1);\n int b = getByte(data, offset + 2);\n result = new Color(r, g, b);\n }\n\n return result;\n }", "public ResourceTransformerEntry resolveResourceTransformer(final PathAddress address, final PlaceholderResolver placeholderResolver) {\n return resolveResourceTransformer(address.iterator(), null, placeholderResolver);\n }", "public static final long getLong(byte[] data, int offset)\n {\n long result = 0;\n int i = offset;\n for (int shiftBy = 0; shiftBy < 64; shiftBy += 8)\n {\n result |= ((long) (data[i] & 0xff)) << shiftBy;\n ++i;\n }\n return result;\n }", "public void run(Configuration configuration, List<CandidateSteps> candidateSteps, Story story, MetaFilter filter)\n throws Throwable {\n run(configuration, candidateSteps, story, filter, null);\n }", "public PartialCollection<BoxItem.Info> getChildrenRange(long offset, long limit, String... fields) {\n QueryStringBuilder builder = new QueryStringBuilder()\n .appendParam(\"limit\", limit)\n .appendParam(\"offset\", offset);\n\n if (fields.length > 0) {\n builder.appendParam(\"fields\", fields).toString();\n }\n\n URL url = GET_ITEMS_URL.buildWithQuery(getAPI().getBaseURL(), builder.toString(), getID());\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"GET\");\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n\n String totalCountString = responseJSON.get(\"total_count\").toString();\n long fullSize = Double.valueOf(totalCountString).longValue();\n PartialCollection<BoxItem.Info> children = new PartialCollection<BoxItem.Info>(offset, limit, fullSize);\n JsonArray jsonArray = responseJSON.get(\"entries\").asArray();\n for (JsonValue value : jsonArray) {\n JsonObject jsonObject = value.asObject();\n BoxItem.Info parsedItemInfo = (BoxItem.Info) BoxResource.parseInfo(this.getAPI(), jsonObject);\n if (parsedItemInfo != null) {\n children.add(parsedItemInfo);\n }\n }\n return children;\n }", "public Map<BsonValue, ChangeEvent<BsonDocument>> getEventsForNamespace(\n final MongoNamespace namespace\n ) {\n this.instanceLock.readLock().lock();\n final NamespaceChangeStreamListener streamer;\n try {\n streamer = nsStreamers.get(namespace);\n } finally {\n this.instanceLock.readLock().unlock();\n }\n if (streamer == null) {\n return new HashMap<>();\n }\n return streamer.getEvents();\n }" ]
Remove any device announcements that are so old that the device seems to have gone away.
[ "private void expireDevices() {\n long now = System.currentTimeMillis();\n // Make a copy so we don't have to worry about concurrent modification.\n Map<InetAddress, DeviceAnnouncement> copy = new HashMap<InetAddress, DeviceAnnouncement>(devices);\n for (Map.Entry<InetAddress, DeviceAnnouncement> entry : copy.entrySet()) {\n if (now - entry.getValue().getTimestamp() > MAXIMUM_AGE) {\n devices.remove(entry.getKey());\n deliverLostAnnouncement(entry.getValue());\n }\n }\n if (devices.isEmpty()) {\n firstDeviceTime.set(0); // We have lost contact with the Pro DJ Link network, so start over with next device.\n }\n }" ]
[ "private static void addFormatInfoEval(byte[] eval, int size, EccLevel ecc_level, int pattern) {\n\n int format = pattern;\n int seq;\n int i;\n\n switch(ecc_level) {\n case L: format += 0x08; break;\n case Q: format += 0x18; break;\n case H: format += 0x10; break;\n }\n\n seq = QR_ANNEX_C[format];\n\n for (i = 0; i < 6; i++) {\n eval[(i * size) + 8] = (byte) ((((seq >> i) & 0x01) != 0) ? (0x01 >> pattern) : 0x00);\n }\n\n for (i = 0; i < 8; i++) {\n eval[(8 * size) + (size - i - 1)] = (byte) ((((seq >> i) & 0x01) != 0) ? (0x01 >> pattern) : 0x00);\n }\n\n for (i = 0; i < 6; i++) {\n eval[(8 * size) + (5 - i)] = (byte) ((((seq >> (i + 9)) & 0x01) != 0) ? (0x01 >> pattern) : 0x00);\n }\n\n for (i = 0; i < 7; i++) {\n eval[(((size - 7) + i) * size) + 8] = (byte) ((((seq >> (i + 8)) & 0x01) != 0) ? (0x01 >> pattern) : 0x00);\n }\n\n eval[(7 * size) + 8] = (byte) ((((seq >> 6) & 0x01) != 0) ? (0x01 >> pattern) : 0x00);\n eval[(8 * size) + 8] = (byte) ((((seq >> 7) & 0x01) != 0) ? (0x01 >> pattern) : 0x00);\n eval[(8 * size) + 7] = (byte) ((((seq >> 8) & 0x01) != 0) ? (0x01 >> pattern) : 0x00);\n }", "private boolean initCheckTypeModifiers() {\n\n Class<?> classInfoclass = Reflections.loadClass(CLASSINFO_CLASS_NAME, new ClassLoaderResourceLoader(classFileServices.getClass().getClassLoader()));\n if (classInfoclass != null) {\n try {\n Method setFlags = AccessController.doPrivileged(GetDeclaredMethodAction.of(classInfoclass, \"setFlags\", short.class));\n return setFlags != null;\n } catch (Exception exceptionIgnored) {\n BootstrapLogger.LOG.usingOldJandexVersion();\n return false;\n }\n } else {\n return true;\n }\n }", "private TreeMap<Integer, Integer> createResourceMap(FieldMap fieldMap, FixedMeta rscFixedMeta, FixedData rscFixedData)\n {\n TreeMap<Integer, Integer> resourceMap = new TreeMap<Integer, Integer>();\n int itemCount = rscFixedMeta.getAdjustedItemCount();\n\n for (int loop = 0; loop < itemCount; loop++)\n {\n byte[] data = rscFixedData.getByteArrayValue(loop);\n if (data == null || data.length < fieldMap.getMaxFixedDataSize(0))\n {\n continue;\n }\n\n Integer uniqueID = Integer.valueOf(MPPUtility.getShort(data, 0));\n resourceMap.put(uniqueID, Integer.valueOf(loop));\n }\n\n return (resourceMap);\n }", "public void forAllIndexDescriptorColumns(String template, Properties attributes) throws XDocletException\r\n {\r\n String fields = _curIndexDescriptorDef.getProperty(PropertyHelper.OJB_PROPERTY_FIELDS);\r\n FieldDescriptorDef fieldDef;\r\n String name;\r\n\r\n for (CommaListIterator it = new CommaListIterator(fields); it.hasNext();)\r\n {\r\n name = it.getNext();\r\n fieldDef = _curClassDef.getField(name);\r\n if (fieldDef == null)\r\n {\r\n throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class,\r\n XDocletModulesOjbMessages.INDEX_FIELD_MISSING,\r\n new String[]{name, _curIndexDescriptorDef.getName(), _curClassDef.getName()}));\r\n }\r\n _curIndexColumn = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN);\r\n generate(template);\r\n }\r\n _curIndexColumn = null;\r\n }", "public static String pennPOSToWordnetPOS(String s) {\r\n if (s.matches(\"NN|NNP|NNS|NNPS\")) {\r\n return \"noun\";\r\n }\r\n if (s.matches(\"VB|VBD|VBG|VBN|VBZ|VBP|MD\")) {\r\n return \"verb\";\r\n }\r\n if (s.matches(\"JJ|JJR|JJS|CD\")) {\r\n return \"adjective\";\r\n }\r\n if (s.matches(\"RB|RBR|RBS|RP|WRB\")) {\r\n return \"adverb\";\r\n }\r\n return null;\r\n }", "public static DMatrix2 extractColumn( DMatrix2x2 a , int column , DMatrix2 out ) {\n if( out == null) out = new DMatrix2();\n switch( column ) {\n case 0:\n out.a1 = a.a11;\n out.a2 = a.a21;\n break;\n case 1:\n out.a1 = a.a12;\n out.a2 = a.a22;\n break;\n default:\n throw new IllegalArgumentException(\"Out of bounds column. column = \"+column);\n }\n return out;\n }", "private boolean isSpecial(final char chr) {\n\t\treturn ((chr == '.') || (chr == '?') || (chr == '*') || (chr == '^') || (chr == '$') || (chr == '+')\n\t\t\t\t|| (chr == '[') || (chr == ']') || (chr == '(') || (chr == ')') || (chr == '|') || (chr == '\\\\')\n\t\t\t\t|| (chr == '&'));\n\t}", "public static <T> MetaTinyType<T> metaFor(Class<?> candidate) {\n for (MetaTinyType meta : metas) {\n if (meta.isMetaOf(candidate)) {\n return meta;\n }\n }\n throw new IllegalArgumentException(String.format(\"not a tinytype: %s\", candidate == null ? \"null\" : candidate.getCanonicalName()));\n }", "static BsonDocument getVersionedFilter(\n @Nonnull final BsonValue documentId,\n @Nullable final BsonValue version\n ) {\n final BsonDocument filter = new BsonDocument(\"_id\", documentId);\n if (version == null) {\n filter.put(DOCUMENT_VERSION_FIELD, new BsonDocument(\"$exists\", BsonBoolean.FALSE));\n } else {\n filter.put(DOCUMENT_VERSION_FIELD, version);\n }\n return filter;\n }" ]
Compute the proportional padding for all items in the cache @param cache Cache data set @return the uniform padding amount
[ "protected float computeUniformPadding(final CacheDataSet cache) {\n float axisSize = getViewPortSize(getOrientationAxis());\n float totalPadding = axisSize - cache.getTotalSize();\n float uniformPadding = totalPadding > 0 && cache.count() > 1 ?\n totalPadding / (cache.count() - 1) : 0;\n return uniformPadding;\n }" ]
[ "private boolean ensureValidSetter(final Expression expression, final Expression leftExpression, final Expression rightExpression, final SetterInfo setterInfo) {\n // for expressions like foo = { ... }\n // we know that the RHS type is a closure\n // but we must check if the binary expression is an assignment\n // because we need to check if a setter uses @DelegatesTo\n VariableExpression ve = new VariableExpression(\"%\", setterInfo.receiverType);\n MethodCallExpression call = new MethodCallExpression(\n ve,\n setterInfo.name,\n rightExpression\n );\n call.setImplicitThis(false);\n visitMethodCallExpression(call);\n MethodNode directSetterCandidate = call.getNodeMetaData(StaticTypesMarker.DIRECT_METHOD_CALL_TARGET);\n if (directSetterCandidate==null) {\n // this may happen if there's a setter of type boolean/String/Class, and that we are using the property\n // notation AND that the RHS is not a boolean/String/Class\n for (MethodNode setter : setterInfo.setters) {\n ClassNode type = getWrapper(setter.getParameters()[0].getOriginType());\n if (Boolean_TYPE.equals(type) || STRING_TYPE.equals(type) || CLASS_Type.equals(type)) {\n call = new MethodCallExpression(\n ve,\n setterInfo.name,\n new CastExpression(type,rightExpression)\n );\n call.setImplicitThis(false);\n visitMethodCallExpression(call);\n directSetterCandidate = call.getNodeMetaData(StaticTypesMarker.DIRECT_METHOD_CALL_TARGET);\n if (directSetterCandidate!=null) {\n break;\n }\n }\n }\n }\n if (directSetterCandidate != null) {\n for (MethodNode setter : setterInfo.setters) {\n if (setter == directSetterCandidate) {\n leftExpression.putNodeMetaData(StaticTypesMarker.DIRECT_METHOD_CALL_TARGET, directSetterCandidate);\n storeType(leftExpression, getType(rightExpression));\n break;\n }\n }\n } else {\n ClassNode firstSetterType = setterInfo.setters.iterator().next().getParameters()[0].getOriginType();\n addAssignmentError(firstSetterType, getType(rightExpression), expression);\n return true;\n }\n return false;\n }", "public String getTextForExpression(DJGroup group, DJGroup childGroup, String type) {\n\t\treturn \"new Double( $V{\" + getReportName() + \"_\" + getGroupVariableName(childGroup) + \"}.doubleValue() / $V{\" + getReportName() + \"_\" + getGroupVariableName(type,group.getColumnToGroupBy().getColumnProperty().getProperty()) + \"}.doubleValue())\";\n\t}", "public static String formatConnectionTerminationMessage(final String connectionName, final String host, final String connectionReason, final String terminationReason) {\n\t\treturn CON_TERMINATION_FORMAT.format(new Object[] { connectionName, host, connectionReason, terminationReason });\n\t}", "@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(parent.getContext()));\n Renderer<T> renderer = rendererBuilder.build();\n if (renderer == null) {\n throw new NullRendererBuiltException(\"RendererBuilder have to return a not null Renderer\");\n }\n updateRendererExtraValues(content, renderer, position);\n renderer.render();\n return renderer.getRootView();\n }", "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 }", "public synchronized void addCertAndPrivateKey(String hostname, final X509Certificate cert, final PrivateKey privKey)\n\tthrows KeyStoreException, CertificateException, NoSuchAlgorithmException\n\t{\n//\t\tString alias = ThumbprintUtil.getThumbprint(cert);\n\n\t\t_ks.deleteEntry(hostname);\n\n _ks.setCertificateEntry(hostname, cert);\n\t\t_ks.setKeyEntry(hostname, privKey, _keypassword, new java.security.cert.Certificate[] {cert});\n\n\t\tif(persistImmediately)\n\t\t{\n\t\t\tpersist();\n\t\t}\n\n\t}", "public App on(Heroku.Stack stack) {\n App newApp = copy();\n newApp.stack = new App.Stack(stack);\n return newApp;\n }", "public TransactionImpl getCurrentTransaction()\r\n {\r\n TransactionImpl tx = tx_table.get(Thread.currentThread());\r\n if(tx == null)\r\n {\r\n throw new TransactionNotInProgressException(\"Calling method needed transaction, but no transaction found for current thread :-(\");\r\n }\r\n return tx;\r\n }", "public ItemRequest<Project> removeCustomFieldSetting(String project) {\n \n String path = String.format(\"/projects/%s/removeCustomFieldSetting\", project);\n return new ItemRequest<Project>(this, Project.class, path, \"POST\");\n }" ]
Adds a clause that checks whether ANY set bits in a bitmask are present in a numeric expression. @param expr SQL numeric expression to check. @param bits Integer containing the bits for which to check.
[ "public static Predicate anyBitsSet(final String expr, final long bits) {\n return new Predicate() {\n private String param;\n public void init(AbstractSqlCreator creator) {\n param = creator.allocateParameter();\n creator.setParameter(param, bits);\n }\n public String toSql() {\n return String.format(\"(%s & :%s) > 0\", expr, param);\n }\n };\n }" ]
[ "public static base_response expire(nitro_service client, cacheobject resource) throws Exception {\n\t\tcacheobject expireresource = new cacheobject();\n\t\texpireresource.locator = resource.locator;\n\t\texpireresource.url = resource.url;\n\t\texpireresource.host = resource.host;\n\t\texpireresource.port = resource.port;\n\t\texpireresource.groupname = resource.groupname;\n\t\texpireresource.httpmethod = resource.httpmethod;\n\t\treturn expireresource.perform_operation(client,\"expire\");\n\t}", "public static Integer getDurationValue(ProjectProperties properties, Duration duration)\n {\n Integer result;\n if (duration == null)\n {\n result = null;\n }\n else\n {\n if (duration.getUnits() != TimeUnit.MINUTES)\n {\n duration = duration.convertUnits(TimeUnit.MINUTES, properties);\n }\n result = Integer.valueOf((int) duration.getDuration());\n }\n return (result);\n }", "public void setCastShadow(boolean enableFlag)\n {\n GVRSceneObject owner = getOwnerObject();\n\n if (owner != null)\n {\n GVRShadowMap shadowMap = (GVRShadowMap) getComponent(GVRRenderTarget.getComponentType());\n if (enableFlag)\n {\n if (shadowMap != null)\n {\n shadowMap.setEnable(true);\n }\n else\n {\n float angle = (float) Math.acos(getFloat(\"outer_cone_angle\")) * 2.0f;\n GVRCamera shadowCam = GVRShadowMap.makePerspShadowCamera(getGVRContext().getMainScene().getMainCameraRig().getCenterCamera(), angle);\n shadowMap = new GVRShadowMap(getGVRContext(), shadowCam);\n owner.attachComponent(shadowMap);\n }\n mChanged.set(true);\n }\n else if (shadowMap != null)\n {\n shadowMap.setEnable(false);\n }\n }\n mCastShadow = enableFlag;\n }", "public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException {\n\t\tDao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass);\n\t\treturn doCreateTable(dao, false);\n\t}", "public static TimeZone get(String suffix) {\n if(SUFFIX_TIMEZONES.containsKey(suffix)) {\n return SUFFIX_TIMEZONES.get(suffix);\n }\n log.warn(\"Cannot find time zone for exchange suffix: '{}'. Using default: America/New_York\", suffix);\n return SUFFIX_TIMEZONES.get(\"\");\n }", "public int getShort(Integer id, Integer type)\n {\n int result = 0;\n\n Integer offset = m_meta.getOffset(id, type);\n\n if (offset != null)\n {\n byte[] value = m_map.get(offset);\n\n if (value != null && value.length >= 2)\n {\n result = MPPUtility.getShort(value, 0);\n }\n }\n\n return (result);\n }", "@SuppressWarnings(\"unchecked\")\n public void updateStoreDefinitions(Versioned<byte[]> valueBytes) {\n // acquire write lock\n writeLock.lock();\n\n try {\n Versioned<String> value = new Versioned<String>(ByteUtils.getString(valueBytes.getValue(),\n \"UTF-8\"),\n valueBytes.getVersion());\n Versioned<Object> valueObject = convertStringToObject(STORES_KEY, value);\n StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();\n List<StoreDefinition> storeDefinitions = (List<StoreDefinition>) valueObject.getValue();\n\n // Check for backwards compatibility\n StoreDefinitionUtils.validateSchemasAsNeeded(storeDefinitions);\n\n StoreDefinitionUtils.validateNewStoreDefsAreNonBreaking(getStoreDefList(), storeDefinitions);\n\n // Go through each store definition and do a corresponding put\n for(StoreDefinition storeDef: storeDefinitions) {\n if(!this.storeNames.contains(storeDef.getName())) {\n throw new VoldemortException(\"Cannot update a store which does not exist !\");\n }\n\n String storeDefStr = mapper.writeStore(storeDef);\n Versioned<String> versionedValueStr = new Versioned<String>(storeDefStr,\n value.getVersion());\n this.storeDefinitionsStorageEngine.put(storeDef.getName(), versionedValueStr, \"\");\n\n // Update the metadata cache\n this.metadataCache.put(storeDef.getName(),\n new Versioned<Object>(storeDefStr, value.getVersion()));\n }\n\n // Re-initialize the store definitions\n initStoreDefinitions(value.getVersion());\n\n // Update routing strategies\n // TODO: Make this more fine grained.. i.e only update listeners for\n // a specific store.\n updateRoutingStrategies(getCluster(), getStoreDefList());\n } finally {\n writeLock.unlock();\n }\n }", "private Object filterValue(Object value)\n {\n if (value instanceof Boolean && !((Boolean) value).booleanValue())\n {\n value = null;\n }\n if (value instanceof String && ((String) value).isEmpty())\n {\n value = null;\n }\n if (value instanceof Double && ((Double) value).doubleValue() == 0.0)\n {\n value = null;\n }\n if (value instanceof Integer && ((Integer) value).intValue() == 0)\n {\n value = null;\n }\n if (value instanceof Duration && ((Duration) value).getDuration() == 0.0)\n {\n value = null;\n }\n\n return value;\n }", "public static String subscriptionFromResourceId(String id) {\n return (id != null) ? ResourceId.fromString(id).subscriptionId() : null;\n }" ]
Read JdbcConnectionDescriptors from this InputStream. @see #mergeConnectionRepository
[ "public ConnectionRepository readConnectionRepository(InputStream inst)\r\n {\r\n try\r\n {\r\n RepositoryPersistor persistor = new RepositoryPersistor();\r\n return persistor.readConnectionRepository(inst);\r\n }\r\n catch (Exception e)\r\n {\r\n throw new MetadataException(\"Can not read repository from \" + inst, e);\r\n }\r\n }" ]
[ "public static Map<String, String> getMetadataFromSequenceFile(FileSystem fs, Path path) {\n try {\n Configuration conf = new Configuration();\n conf.setInt(\"io.file.buffer.size\", 4096);\n SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, new Configuration());\n SequenceFile.Metadata meta = reader.getMetadata();\n reader.close();\n TreeMap<Text, Text> map = meta.getMetadata();\n Map<String, String> values = new HashMap<String, String>();\n for(Map.Entry<Text, Text> entry: map.entrySet())\n values.put(entry.getKey().toString(), entry.getValue().toString());\n\n return values;\n } catch(IOException e) {\n throw new RuntimeException(e);\n }\n }", "public static int getDayAsReadableInt(long time) {\n Calendar cal = calendarThreadLocal.get();\n cal.setTimeInMillis(time);\n return getDayAsReadableInt(cal);\n }", "private void appendDefaultValue(StringBuilder sb, FieldType fieldType, Object defaultValue) {\n\t\tif (fieldType.isEscapedDefaultValue()) {\n\t\t\tappendEscapedWord(sb, defaultValue.toString());\n\t\t} else {\n\t\t\tsb.append(defaultValue);\n\t\t}\n\t}", "@Override protected Class getPrototypeClass(Video content) {\n Class prototypeClass;\n if (content.isFavorite()) {\n prototypeClass = FavoriteVideoRenderer.class;\n } else if (content.isLive()) {\n prototypeClass = LiveVideoRenderer.class;\n } else {\n prototypeClass = LikeVideoRenderer.class;\n }\n return prototypeClass;\n }", "public static void unregisterMbean(MBeanServer server, ObjectName name) {\n try {\n server.unregisterMBean(name);\n } catch(Exception e) {\n logger.error(\"Error unregistering mbean\", e);\n }\n }", "private static BufferedImage scale(BufferedImage imageToScale, int dWidth, int dHeight, double fWidth, double fHeight) {\n BufferedImage dbi = null;\n // Needed to create a new BufferedImage object\n int imageType = imageToScale.getType();\n if (imageToScale != null) {\n dbi = new BufferedImage(dWidth, dHeight, imageType);\n Graphics2D g = dbi.createGraphics();\n AffineTransform at = AffineTransform.getScaleInstance(fWidth, fHeight);\n g.drawRenderedImage(imageToScale, at);\n }\n return dbi;\n }", "public static AliasFinder newInstance(final String variableName, final ControlFlowBlock controlFlowBlockToExamine) {\n checkArgument(!variableName.isEmpty());\n return new AliasFinder(variableName, checkNotNull(controlFlowBlockToExamine));\n }", "public AirMapViewBuilder builder(AirMapViewTypes mapType) {\n switch (mapType) {\n case NATIVE:\n if (isNativeMapSupported) {\n return new NativeAirMapViewBuilder();\n }\n break;\n case WEB:\n return getWebMapViewBuilder();\n }\n throw new UnsupportedOperationException(\"Requested map type is not supported\");\n }", "@Override\n public String logFile() {\n if(logFile == null) {\n logFile = Config.getTmpDir()+Config.getPathSeparator()+\"aesh.log\";\n }\n return logFile;\n }" ]
Returns the steps instances associated to CandidateSteps @param candidateSteps the List of CandidateSteps @return The List of steps instances
[ "public List<Object> stepsInstances(List<CandidateSteps> candidateSteps) {\n List<Object> instances = new ArrayList<>();\n for (CandidateSteps steps : candidateSteps) {\n if (steps instanceof Steps) {\n instances.add(((Steps) steps).instance());\n }\n }\n return instances;\n }" ]
[ "protected ServiceName serviceName(final String name) {\n return baseServiceName != null ? baseServiceName.append(name) : null;\n }", "public static List<String> parse(final String[] args, final Object... objs) throws IOException\n {\n final List<String> ret = Colls.list();\n\n final List<Arg> allArgs = Colls.list();\n final HashMap<String, Arg> shortArgs = new HashMap<String, Arg>();\n final HashMap<String, Arg> longArgs = new HashMap<String, Arg>();\n\n parseArgs(objs, allArgs, shortArgs, longArgs);\n\n for (int i = 0; i < args.length; i++)\n {\n final String s = args[i];\n\n final Arg a;\n\n if (s.startsWith(\"--\"))\n {\n a = longArgs.get(s.substring(2));\n if (a == null)\n {\n throw new IOException(\"Unknown switch: \" + s);\n }\n }\n else if (s.startsWith(\"-\"))\n {\n a = shortArgs.get(s.substring(1));\n if (a == null)\n {\n throw new IOException(\"Unknown switch: \" + s);\n }\n }\n else\n {\n a = null;\n ret.add(s);\n }\n\n if (a != null)\n {\n if (a.isSwitch)\n {\n a.setField(\"true\");\n }\n else\n {\n if (i + 1 >= args.length)\n {\n System.out.println(\"Missing parameter for: \" + s);\n }\n if (a.isCatchAll())\n {\n final List<String> ca = Colls.list();\n for (++i; i < args.length; ++i)\n {\n ca.add(args[i]);\n }\n a.setCatchAll(ca);\n }\n else\n {\n ++i;\n a.setField(args[i]);\n }\n }\n a.setPresent();\n }\n }\n\n for (final Arg a : allArgs)\n {\n if (!a.isOk())\n {\n throw new IOException(\"Missing mandatory argument: \" + a);\n }\n }\n\n return ret;\n }", "private static String get(Properties p, String key, String defaultValue, Set<String> used){\r\n String rtn = p.getProperty(key, defaultValue);\r\n used.add(key);\r\n return rtn;\r\n }", "public void setCustomRequest(int pathId, String customRequest, String clientUUID) {\n PreparedStatement statement = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n int profileId = EditService.getProfileIdFromPathID(pathId);\n statement = sqlConnection.prepareStatement(\n \"UPDATE \" + Constants.DB_TABLE_REQUEST_RESPONSE +\n \" SET \" + Constants.REQUEST_RESPONSE_CUSTOM_REQUEST + \"= ?\" +\n \" WHERE \" + Constants.GENERIC_PROFILE_ID + \"= ?\" +\n \" AND \" + Constants.GENERIC_CLIENT_UUID + \"= ?\" +\n \" AND \" + Constants.REQUEST_RESPONSE_PATH_ID + \"= ?\"\n );\n statement.setString(1, customRequest);\n statement.setInt(2, profileId);\n statement.setString(3, clientUUID);\n statement.setInt(4, pathId);\n statement.executeUpdate();\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n }", "private void writeActivity(Task mpxj)\n {\n ActivityType xml = m_factory.createActivityType();\n m_project.getActivity().add(xml);\n\n Task parentTask = mpxj.getParentTask();\n Integer parentObjectID = parentTask == null ? null : parentTask.getUniqueID();\n\n xml.setActualStartDate(mpxj.getActualStart());\n xml.setActualFinishDate(mpxj.getActualFinish());\n xml.setAtCompletionDuration(getDuration(mpxj.getDuration()));\n xml.setCalendarObjectId(getCalendarUniqueID(mpxj.getCalendar()));\n xml.setDurationPercentComplete(getPercentage(mpxj.getPercentageComplete()));\n xml.setDurationType(DURATION_TYPE_MAP.get(mpxj.getType()));\n xml.setFinishDate(mpxj.getFinish());\n xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));\n xml.setId(getActivityID(mpxj));\n xml.setName(mpxj.getName());\n xml.setObjectId(mpxj.getUniqueID());\n xml.setPercentComplete(getPercentage(mpxj.getPercentageComplete()));\n xml.setPercentCompleteType(\"Duration\");\n xml.setPrimaryConstraintType(CONSTRAINT_TYPE_MAP.get(mpxj.getConstraintType()));\n xml.setPrimaryConstraintDate(mpxj.getConstraintDate());\n xml.setPlannedDuration(getDuration(mpxj.getDuration()));\n xml.setPlannedFinishDate(mpxj.getFinish());\n xml.setPlannedStartDate(mpxj.getStart());\n xml.setProjectObjectId(PROJECT_OBJECT_ID);\n xml.setRemainingDuration(getDuration(mpxj.getRemainingDuration()));\n xml.setRemainingEarlyFinishDate(mpxj.getEarlyFinish());\n xml.setRemainingEarlyStartDate(mpxj.getResume());\n xml.setRemainingLaborCost(NumberHelper.DOUBLE_ZERO);\n xml.setRemainingLaborUnits(NumberHelper.DOUBLE_ZERO);\n xml.setRemainingNonLaborCost(NumberHelper.DOUBLE_ZERO);\n xml.setRemainingNonLaborUnits(NumberHelper.DOUBLE_ZERO);\n xml.setStartDate(mpxj.getStart());\n xml.setStatus(getActivityStatus(mpxj));\n xml.setType(extractAndConvertTaskType(mpxj));\n xml.setWBSObjectId(parentObjectID);\n xml.getUDF().addAll(writeUDFType(FieldTypeClass.TASK, mpxj));\n\n writePredecessors(mpxj);\n }", "public static Key toKey(RowColumn rc) {\n if ((rc == null) || (rc.getRow().equals(Bytes.EMPTY))) {\n return null;\n }\n Text row = ByteUtil.toText(rc.getRow());\n if ((rc.getColumn().equals(Column.EMPTY)) || !rc.getColumn().isFamilySet()) {\n return new Key(row);\n }\n Text cf = ByteUtil.toText(rc.getColumn().getFamily());\n if (!rc.getColumn().isQualifierSet()) {\n return new Key(row, cf);\n }\n Text cq = ByteUtil.toText(rc.getColumn().getQualifier());\n if (!rc.getColumn().isVisibilitySet()) {\n return new Key(row, cf, cq);\n }\n Text cv = ByteUtil.toText(rc.getColumn().getVisibility());\n return new Key(row, cf, cq, cv);\n }", "@Override public void setUniqueID(Integer uniqueID)\n {\n ProjectFile parent = getParentFile();\n\n if (m_uniqueID != null)\n {\n parent.getCalendars().unmapUniqueID(m_uniqueID);\n }\n\n parent.getCalendars().mapUniqueID(uniqueID, this);\n\n m_uniqueID = uniqueID;\n }", "private void ensureNext() {\n // Check if the current scan result has more keys (i.e. the index did not reach the end of the result list)\n if (resultIndex < scanResult.getResult().size()) {\n return;\n }\n // Since the current scan result was fully iterated,\n // if there is another cursor scan it and ensure next key (recursively)\n if (!FIRST_CURSOR.equals(scanResult.getStringCursor())) {\n scanResult = scan(scanResult.getStringCursor(), scanParams);\n resultIndex = 0;\n ensureNext();\n }\n }", "protected void initValid(EnhancedAnnotation<T> annotatedAnnotation) {\n this.valid = false;\n for (Class<? extends Annotation> annotationType : getMetaAnnotationTypes()) {\n if (annotatedAnnotation.isAnnotationPresent(annotationType)) {\n this.valid = true;\n }\n }\n }" ]
Tries to return the single table to which all classes in the hierarchy with the given class as the root map. @param classDef The root class of the hierarchy @return The table name or <code>null</code> if the classes map to more than one table or no class in the hierarchy maps to a table
[ "private String getHierarchyTable(ClassDescriptorDef classDef)\r\n {\r\n ArrayList queue = new ArrayList();\r\n String tableName = null;\r\n\r\n queue.add(classDef);\r\n\r\n while (!queue.isEmpty())\r\n {\r\n ClassDescriptorDef curClassDef = (ClassDescriptorDef)queue.get(0);\r\n\r\n queue.remove(0);\r\n\r\n if (curClassDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_GENERATE_TABLE_INFO, true))\r\n {\r\n if (tableName != null)\r\n {\r\n if (!tableName.equals(curClassDef.getProperty(PropertyHelper.OJB_PROPERTY_TABLE)))\r\n {\r\n return null;\r\n }\r\n }\r\n else\r\n {\r\n tableName = curClassDef.getProperty(PropertyHelper.OJB_PROPERTY_TABLE);\r\n }\r\n }\r\n for (Iterator it = curClassDef.getExtentClasses(); it.hasNext();)\r\n {\r\n curClassDef = (ClassDescriptorDef)it.next();\r\n\r\n if (curClassDef.getReference(\"super\") == null)\r\n {\r\n queue.add(curClassDef);\r\n }\r\n }\r\n }\r\n return tableName;\r\n }" ]
[ "public static base_response unset(nitro_service client, protocolhttpband resource, String[] args) throws Exception{\n\t\tprotocolhttpband unsetresource = new protocolhttpband();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "public static base_responses unset(nitro_service client, String acl6name[], String args[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (acl6name != null && acl6name.length > 0) {\n\t\t\tnsacl6 unsetresources[] = new nsacl6[acl6name.length];\n\t\t\tfor (int i=0;i<acl6name.length;i++){\n\t\t\t\tunsetresources[i] = new nsacl6();\n\t\t\t\tunsetresources[i].acl6name = acl6name[i];\n\t\t\t}\n\t\t\tresult = unset_bulk_request(client, unsetresources,args);\n\t\t}\n\t\treturn result;\n\t}", "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.size() > index) {\n return others.get(index);\n }\n }\n\n value = parsedLine.getPropertyValue(fullName);\n if(value == null && shortName != null) {\n value = parsedLine.getPropertyValue(shortName);\n }\n }\n\n if(required && value == null && !isPresent(parsedLine)) {\n StringBuilder buf = new StringBuilder();\n buf.append(\"Required argument \");\n buf.append('\\'').append(fullName).append('\\'');\n buf.append(\" is missing.\");\n throw new CommandFormatException(buf.toString());\n }\n return value;\n }", "public void setValue(Vector3f scale) {\n mX = scale.x;\n mY = scale.y;\n mZ = scale.z;\n }", "public SerialMessage setValueMessage(int level) {\r\n\t\tlogger.debug(\"Creating new message for application command BASIC_SET for node {}\", this.getNode().getNodeId());\r\n\t\tSerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Set);\r\n \tbyte[] newPayload = { \t(byte) this.getNode().getNodeId(), \r\n \t\t\t\t\t\t\t3, \r\n\t\t\t\t\t\t\t\t(byte) getCommandClass().getKey(), \r\n\t\t\t\t\t\t\t\t(byte) BASIC_SET,\r\n\t\t\t\t\t\t\t\t(byte) level\r\n\t\t\t\t\t\t\t\t};\r\n \tresult.setMessagePayload(newPayload);\r\n \treturn result;\t\t\r\n\t}", "@Override\r\n public <VALUEBASE, VALUE extends VALUEBASE, KEY extends Key<CoreMap, VALUEBASE>>\r\n VALUE set(Class<KEY> key, VALUE value) {\r\n \r\n if (immutableKeys.contains(key)) {\r\n throw new HashableCoreMapException(\"Attempt to change value \" +\r\n \t\t\"of immutable field \"+key.getSimpleName());\r\n }\r\n \r\n return super.set(key, value);\r\n }", "private Class<?> beanType(String name) {\n\t\tClass<?> type = context.getType(name);\n\t\tif (ClassUtils.isCglibProxyClass(type)) {\n\t\t\treturn AopProxyUtils.ultimateTargetClass(context.getBean(name));\n\t\t}\n\t\treturn type;\n\t}", "public static boolean isSymmetric( DMatrixSparseCSC A , double tol ) {\n if( A.numRows != A.numCols )\n return false;\n\n int N = A.numCols;\n\n for (int i = 0; i < N; i++) {\n int idx0 = A.col_idx[i];\n int idx1 = A.col_idx[i+1];\n\n for (int index = idx0; index < idx1; index++) {\n int j = A.nz_rows[index];\n double value_ji = A.nz_values[index];\n double value_ij = A.get(i,j);\n\n if( Math.abs(value_ij-value_ji) > tol )\n return false;\n }\n }\n\n return true;\n }", "@Override\n public InternationalFixedDate date(int prolepticYear, int month, int dayOfMonth) {\n return InternationalFixedDate.of(prolepticYear, month, dayOfMonth);\n }" ]
Gets the argument names of a method call. If the arguments are not VariableExpressions then a null will be returned. @param methodCall the method call to search @return a list of strings, never null, but some elements may be null
[ "public static List<String> getArgumentNames(MethodCallExpression methodCall) {\r\n ArrayList<String> result = new ArrayList<String>();\r\n\r\n Expression arguments = methodCall.getArguments();\r\n List<Expression> argExpressions = null;\r\n if (arguments instanceof ArrayExpression) {\r\n argExpressions = ((ArrayExpression) arguments).getExpressions();\r\n } else if (arguments instanceof ListExpression) {\r\n argExpressions = ((ListExpression) arguments).getExpressions();\r\n } else if (arguments instanceof TupleExpression) {\r\n argExpressions = ((TupleExpression) arguments).getExpressions();\r\n } else {\r\n LOG.warn(\"getArgumentNames arguments is not an expected type\");\r\n }\r\n\r\n if (argExpressions != null) {\r\n for (Expression exp : argExpressions) {\r\n if (exp instanceof VariableExpression) {\r\n result.add(((VariableExpression) exp).getName());\r\n }\r\n }\r\n }\r\n return result;\r\n }" ]
[ "public static <T> T mode(Collection<T> values) {\r\n Set<T> modes = modes(values);\r\n return modes.iterator().next();\r\n }", "public Date getFinishTime(Date date)\n {\n Date result = null;\n\n if (date != null)\n {\n ProjectCalendarDateRanges ranges = getRanges(date, null, null);\n if (ranges == null)\n {\n result = getParentFile().getProjectProperties().getDefaultEndTime();\n result = DateHelper.getCanonicalTime(result);\n }\n else\n {\n Date rangeStart = result = ranges.getRange(0).getStart();\n Date rangeFinish = ranges.getRange(ranges.getRangeCount() - 1).getEnd();\n Date startDay = DateHelper.getDayStartDate(rangeStart);\n Date finishDay = DateHelper.getDayStartDate(rangeFinish);\n\n result = DateHelper.getCanonicalTime(rangeFinish);\n\n //\n // Handle the case where the end of the range is at midnight -\n // this will show up as the start and end days not matching\n //\n if (startDay != null && finishDay != null && startDay.getTime() != finishDay.getTime())\n {\n result = DateHelper.addDays(result, 1);\n }\n }\n }\n return result;\n }", "void initialize(DMatrixSparseCSC A) {\n m = A.numRows;\n n = A.numCols;\n int s = 4*n + (ata ? (n+m+1) : 0);\n\n gw.reshape(s);\n w = gw.data;\n\n // compute the transpose of A\n At.reshape(A.numCols,A.numRows,A.nz_length);\n CommonOps_DSCC.transpose(A,At,gw);\n\n // initialize w\n Arrays.fill(w,0,s,-1); // assign all values in workspace to -1\n\n ancestor = 0;\n maxfirst = n;\n prevleaf = 2*n;\n first = 3*n;\n }", "private boolean isSpecial(final char chr) {\n\t\treturn ((chr == '.') || (chr == '?') || (chr == '*') || (chr == '^') || (chr == '$') || (chr == '+')\n\t\t\t\t|| (chr == '[') || (chr == ']') || (chr == '(') || (chr == ')') || (chr == '|') || (chr == '\\\\')\n\t\t\t\t|| (chr == '&'));\n\t}", "public static boolean isConstantVal(DMatrixRMaj mat , double val , double tol )\n {\n // see if the result is an identity matrix\n int index = 0;\n for( int i = 0; i < mat.numRows; i++ ) {\n for( int j = 0; j < mat.numCols; j++ ) {\n if( !(Math.abs(mat.get(index++)-val) <= tol) )\n return false;\n\n }\n }\n\n return true;\n }", "public static ConstraintField getInstance(int value)\n {\n ConstraintField result = null;\n\n if (value >= 0 && value < FIELD_ARRAY.length)\n {\n result = FIELD_ARRAY[value];\n }\n\n return (result);\n }", "public static DMatrixSparseCSC convert(DMatrixSparseTriplet src , DMatrixSparseCSC dst , int hist[] ) {\n if( dst == null )\n dst = new DMatrixSparseCSC(src.numRows, src.numCols , src.nz_length);\n else\n dst.reshape(src.numRows, src.numCols, src.nz_length);\n\n if( hist == null )\n hist = new int[ src.numCols ];\n else if( hist.length >= src.numCols )\n Arrays.fill(hist,0,src.numCols, 0);\n else\n throw new IllegalArgumentException(\"Length of hist must be at least numCols\");\n\n // compute the number of elements in each columns\n for (int i = 0; i < src.nz_length; i++) {\n hist[src.nz_rowcol.data[i*2+1]]++;\n }\n\n // define col_idx\n dst.histogramToStructure(hist);\n System.arraycopy(dst.col_idx,0,hist,0,dst.numCols);\n\n // now write the row indexes and the values\n for (int i = 0; i < src.nz_length; i++) {\n int row = src.nz_rowcol.data[i*2];\n int col = src.nz_rowcol.data[i*2+1];\n double value = src.nz_value.data[i];\n\n int index = hist[col]++;\n dst.nz_rows[index] = row;\n dst.nz_values[index] = value;\n }\n dst.indicesSorted = false;\n\n return dst;\n }", "public static Map<String, StoreDefinition> getUserStoreDefMapOnNode(AdminClient adminClient,\n Integer nodeId) {\n List<StoreDefinition> storeDefinitionList = adminClient.metadataMgmtOps.getRemoteStoreDefList(nodeId)\n .getValue();\n Map<String, StoreDefinition> storeDefinitionMap = Maps.newHashMap();\n for(StoreDefinition storeDefinition: storeDefinitionList) {\n storeDefinitionMap.put(storeDefinition.getName(), storeDefinition);\n }\n return storeDefinitionMap;\n }", "public static base_responses expire(nitro_service client, cachecontentgroup resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tcachecontentgroup expireresources[] = new cachecontentgroup[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\texpireresources[i] = new cachecontentgroup();\n\t\t\t\texpireresources[i].name = resources[i].name;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, expireresources,\"expire\");\n\t\t}\n\t\treturn result;\n\t}" ]
Cancel request and worker on host. @param targetHosts the target hosts
[ "@SuppressWarnings(\"deprecation\")\n private void cancelRequestAndWorkerOnHost(List<String> targetHosts) {\n\n List<String> validTargetHosts = new ArrayList<String>(workers.keySet());\n validTargetHosts.retainAll(targetHosts);\n logger.info(\"targetHosts for cancel: Total: {}\"\n + \" Valid in current manager with worker threads: {}\",\n targetHosts.size(), validTargetHosts.size());\n\n for (String targetHost : validTargetHosts) {\n\n ActorRef worker = workers.get(targetHost);\n\n if (worker != null && !worker.isTerminated()) {\n worker.tell(OperationWorkerMsgType.CANCEL, getSelf());\n logger.info(\"Submitted CANCEL request on Host {}\", targetHost);\n } else {\n logger.info(\n \"Did NOT Submitted \"\n + \"CANCEL request on Host {} as worker on this host is null or already killed\",\n targetHost);\n }\n\n }\n\n }" ]
[ "public List<Integer> getTrackIds() {\n ArrayList<Integer> results = new ArrayList<Integer>(trackCount);\n Enumeration<? extends ZipEntry> entries = zipFile.entries();\n while (entries.hasMoreElements()) {\n ZipEntry entry = entries.nextElement();\n if (entry.getName().startsWith(CACHE_METADATA_ENTRY_PREFIX)) {\n String idPart = entry.getName().substring(CACHE_METADATA_ENTRY_PREFIX.length());\n if (idPart.length() > 0) {\n results.add(Integer.valueOf(idPart));\n }\n }\n }\n\n return Collections.unmodifiableList(results);\n }", "public boolean canUpdateServer(ServerIdentity server) {\n if (!serverGroupName.equals(server.getServerGroupName()) || !servers.contains(server)) {\n throw DomainControllerLogger.HOST_CONTROLLER_LOGGER.unknownServer(server);\n }\n\n if (!parent.canChildProceed())\n return false;\n\n synchronized (this) {\n return failureCount <= maxFailed;\n }\n }", "public void setOutlineCode(int index, String value)\n {\n set(selectField(TaskFieldLists.CUSTOM_OUTLINE_CODE, index), value);\n }", "public void forObjectCache(String template, Properties attributes) throws XDocletException\r\n {\r\n _curObjectCacheDef = _curClassDef.getObjectCache();\r\n if (_curObjectCacheDef != null)\r\n {\r\n generate(template);\r\n _curObjectCacheDef = null;\r\n }\r\n }", "List getOrderby()\r\n {\r\n List result = _getOrderby();\r\n Iterator iter = getCriteria().iterator();\r\n Object crit;\r\n\r\n while (iter.hasNext())\r\n {\r\n crit = iter.next();\r\n if (crit instanceof Criteria)\r\n {\r\n result.addAll(((Criteria) crit).getOrderby());\r\n }\r\n }\r\n\r\n return result;\r\n }", "public Date[] getDates()\n {\n int frequency = NumberHelper.getInt(m_frequency);\n if (frequency < 1)\n {\n frequency = 1;\n }\n\n Calendar calendar = DateHelper.popCalendar(m_startDate);\n List<Date> dates = new ArrayList<Date>();\n\n switch (m_recurrenceType)\n {\n case DAILY:\n {\n getDailyDates(calendar, frequency, dates);\n break;\n }\n\n case WEEKLY:\n {\n getWeeklyDates(calendar, frequency, dates);\n break;\n }\n\n case MONTHLY:\n {\n getMonthlyDates(calendar, frequency, dates);\n break;\n }\n\n case YEARLY:\n {\n getYearlyDates(calendar, dates);\n break;\n }\n }\n\n DateHelper.pushCalendar(calendar);\n \n return dates.toArray(new Date[dates.size()]);\n }", "public static URI setPath(final URI initialUri, final String path) {\n String finalPath = path;\n if (!finalPath.startsWith(\"/\")) {\n finalPath = '/' + path;\n }\n try {\n if (initialUri.getHost() == null && initialUri.getAuthority() != null) {\n return new URI(initialUri.getScheme(), initialUri.getAuthority(), finalPath,\n initialUri.getQuery(),\n initialUri.getFragment());\n } else {\n return new URI(initialUri.getScheme(), initialUri.getUserInfo(), initialUri.getHost(),\n initialUri.getPort(),\n finalPath, initialUri.getQuery(), initialUri.getFragment());\n }\n } catch (URISyntaxException e) {\n throw ExceptionUtils.getRuntimeException(e);\n }\n }", "public static int getNavigationBarHeight(Context context) {\n Resources resources = context.getResources();\n int id = resources.getIdentifier(context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT ? \"navigation_bar_height\" : \"navigation_bar_height_landscape\", \"dimen\", \"android\");\n if (id > 0) {\n return resources.getDimensionPixelSize(id);\n }\n return 0;\n }", "private void processHyperlinkData(Resource resource, byte[] data)\n {\n if (data != null)\n {\n int offset = 12;\n String hyperlink;\n String address;\n String subaddress;\n\n offset += 12;\n hyperlink = MPPUtility.getUnicodeString(data, offset);\n offset += ((hyperlink.length() + 1) * 2);\n\n offset += 12;\n address = MPPUtility.getUnicodeString(data, offset);\n offset += ((address.length() + 1) * 2);\n\n offset += 12;\n subaddress = MPPUtility.getUnicodeString(data, offset);\n\n resource.setHyperlink(hyperlink);\n resource.setHyperlinkAddress(address);\n resource.setHyperlinkSubAddress(subaddress);\n }\n }" ]
Determine the generic value type of the given Map field. @param mapField the map field to introspect @param nestingLevel the nesting level of the target type (typically 1; e.g. in case of a List of Lists, 1 would indicate the nested List, whereas 2 would indicate the element of the nested List) @return the generic type, or {@code null} if none
[ "public static Class<?> getMapValueFieldType(Field mapField, int nestingLevel) {\n\t\treturn getGenericFieldType(mapField, Map.class, 1, null, nestingLevel);\n\t}" ]
[ "public static base_responses add(nitro_service client, gslbsite resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tgslbsite addresources[] = new gslbsite[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new gslbsite();\n\t\t\t\taddresources[i].sitename = resources[i].sitename;\n\t\t\t\taddresources[i].sitetype = resources[i].sitetype;\n\t\t\t\taddresources[i].siteipaddress = resources[i].siteipaddress;\n\t\t\t\taddresources[i].publicip = resources[i].publicip;\n\t\t\t\taddresources[i].metricexchange = resources[i].metricexchange;\n\t\t\t\taddresources[i].nwmetricexchange = resources[i].nwmetricexchange;\n\t\t\t\taddresources[i].sessionexchange = resources[i].sessionexchange;\n\t\t\t\taddresources[i].triggermonitor = resources[i].triggermonitor;\n\t\t\t\taddresources[i].parentsite = resources[i].parentsite;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "public ModelNode toModelNode() {\n final ModelNode node = new ModelNode().setEmptyList();\n for (PathElement element : pathAddressList) {\n final String value;\n if (element.isMultiTarget() && !element.isWildcard()) {\n value = '[' + element.getValue() + ']';\n } else {\n value = element.getValue();\n }\n node.add(element.getKey(), value);\n }\n return node;\n }", "public static final int getInt(byte[] data, int offset)\n {\n int result = 0;\n int i = offset;\n for (int shiftBy = 0; shiftBy < 32; shiftBy += 8)\n {\n result |= ((data[i] & 0xff)) << shiftBy;\n ++i;\n }\n return result;\n }", "public EventBus emitSync(EventObject event, Object... args) {\n return _emitWithOnceBus(eventContextSync(event, args));\n }", "private void processOutlineCodeValues() throws IOException\n {\n DirectoryEntry outlineCodeDir = (DirectoryEntry) m_projectDir.getEntry(\"TBkndOutlCode\");\n FixedMeta fm = new FixedMeta(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry(\"FixedMeta\"))), 10);\n FixedData fd = new FixedData(fm, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry(\"FixedData\"))));\n\n Map<Integer, FieldType> map = new HashMap<Integer, FieldType>();\n\n int items = fm.getItemCount();\n for (int loop = 0; loop < items; loop++)\n {\n byte[] data = fd.getByteArrayValue(loop);\n if (data.length < 18)\n {\n continue;\n }\n\n int index = MPPUtility.getShort(data, 0);\n int fieldID = MPPUtility.getInt(data, 12);\n FieldType fieldType = FieldTypeHelper.getInstance(fieldID);\n if (fieldType.getFieldTypeClass() != FieldTypeClass.UNKNOWN)\n {\n map.put(Integer.valueOf(index), fieldType);\n }\n }\n\n VarMeta outlineCodeVarMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry(\"VarMeta\"))));\n Var2Data outlineCodeVarData = new Var2Data(outlineCodeVarMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry(\"Var2Data\"))));\n\n Map<FieldType, List<Pair<String, String>>> valueMap = new HashMap<FieldType, List<Pair<String, String>>>();\n\n for (Integer id : outlineCodeVarMeta.getUniqueIdentifierArray())\n {\n FieldType fieldType = map.get(id);\n String value = outlineCodeVarData.getUnicodeString(id, VALUE);\n String description = outlineCodeVarData.getUnicodeString(id, DESCRIPTION);\n\n List<Pair<String, String>> list = valueMap.get(fieldType);\n if (list == null)\n {\n list = new ArrayList<Pair<String, String>>();\n valueMap.put(fieldType, list);\n }\n list.add(new Pair<String, String>(value, description));\n }\n\n for (Entry<FieldType, List<Pair<String, String>>> entry : valueMap.entrySet())\n {\n populateContainer(entry.getKey(), entry.getValue());\n }\n }", "public String getResourceFilename() {\n switch (resourceType) {\n case ANDROID_ASSETS:\n return assetPath\n .substring(assetPath.lastIndexOf(File.separator) + 1);\n\n case ANDROID_RESOURCE:\n return resourceFilePath.substring(\n resourceFilePath.lastIndexOf(File.separator) + 1);\n\n case LINUX_FILESYSTEM:\n return filePath.substring(filePath.lastIndexOf(File.separator) + 1);\n\n case NETWORK:\n return url.getPath().substring(url.getPath().lastIndexOf(\"/\") + 1);\n\n case INPUT_STREAM:\n return inputStreamName;\n\n default:\n return null;\n }\n }", "public static callhome get(nitro_service service) throws Exception{\n\t\tcallhome obj = new callhome();\n\t\tcallhome[] response = (callhome[])obj.get_resources(service);\n\t\treturn response[0];\n\t}", "private ProjectFile readTextFile(InputStream inputStream) throws MPXJException\n {\n ProjectReader reader = new AstaTextFileReader();\n addListeners(reader);\n return reader.read(inputStream);\n }", "public Boolean getBoolean(String fieldName) {\n\t\treturn hasValue(fieldName) ? Boolean.valueOf(String.valueOf(resultMap.get(fieldName))) : null;\n\t}" ]
Returns an Array with an Objects PK VALUES if convertToSql is true, any associated java-to-sql conversions are applied. If the Object is a Proxy or a VirtualProxy NO conversion is necessary. @param objectOrProxy @param convertToSql @return Object[] @throws PersistenceBrokerException
[ "public ValueContainer[] getKeyValues(ClassDescriptor cld, Object objectOrProxy, boolean convertToSql) throws PersistenceBrokerException\r\n {\r\n IndirectionHandler handler = ProxyHelper.getIndirectionHandler(objectOrProxy);\r\n\r\n if(handler != null)\r\n {\r\n return getKeyValues(cld, handler.getIdentity(), convertToSql); //BRJ: convert Identity\r\n }\r\n else\r\n {\r\n ClassDescriptor realCld = getRealClassDescriptor(cld, objectOrProxy);\r\n return getValuesForObject(realCld.getPkFields(), objectOrProxy, convertToSql);\r\n }\r\n }" ]
[ "private void addMembers(Collection memberNames, HashMap members, XClass type, String tagName, String paramName, String paramValue) throws XDocletException\r\n {\r\n if (!type.isInterface() && (type.getFields() != null)) {\r\n XField field;\r\n\r\n for (Iterator it = type.getFields().iterator(); it.hasNext(); ) {\r\n field = (XField)it.next();\r\n if (!field.isFinal() && !field.isStatic() && !field.isTransient()) {\r\n if (checkTagAndParam(field.getDoc(), tagName, paramName, paramValue)) {\r\n // already processed ?\r\n if (!members.containsKey(field.getName())) {\r\n memberNames.add(field.getName());\r\n members.put(field.getName(), field);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (type.getMethods() != null) {\r\n XMethod method;\r\n String propertyName;\r\n\r\n for (Iterator it = type.getMethods().iterator(); it.hasNext(); ) {\r\n method = (XMethod)it.next();\r\n if (!method.isConstructor() && !method.isNative() && !method.isStatic()) {\r\n if (checkTagAndParam(method.getDoc(), tagName, paramName, paramValue)) {\r\n if (MethodTagsHandler.isGetterMethod(method) || MethodTagsHandler.isSetterMethod(method)) {\r\n propertyName = MethodTagsHandler.getPropertyNameFor(method);\r\n if (!members.containsKey(propertyName)) {\r\n memberNames.add(propertyName);\r\n members.put(propertyName, method);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }", "public void clear() {\n if (arrMask != null) {\n for (int y = 0; y < height; y++) {\n for (int x = 0; x < width; x++) {\n arrMask[x][y] = false;\n }\n }\n }\n }", "protected String findPath(String start, String end) {\n if (start.equals(end)) {\n return start;\n } else {\n return findPath(start, parent.get(end)) + \" -> \" + end;\n }\n }", "public final void setDefaultStyle(final Map<String, Style> defaultStyle) {\n this.defaultStyle = new HashMap<>(defaultStyle.size());\n for (Map.Entry<String, Style> entry: defaultStyle.entrySet()) {\n String normalizedName = GEOMETRY_NAME_ALIASES.get(entry.getKey().toLowerCase());\n\n if (normalizedName == null) {\n normalizedName = entry.getKey().toLowerCase();\n }\n\n this.defaultStyle.put(normalizedName, entry.getValue());\n }\n }", "public Pixel[] pixels() {\n Pixel[] pixels = new Pixel[count()];\n Point[] points = points();\n for (int k = 0; k < points.length; k++) {\n pixels[k] = pixel(points[k]);\n }\n return pixels;\n }", "private void query(String zipcode) {\n /* Setup YQL query statement using dynamic zipcode. The statement searches geo.places\n for the zipcode and returns XML which includes the WOEID. For more info about YQL go\n to: http://developer.yahoo.com/yql/ */\n String qry = URLEncoder.encode(\"SELECT woeid FROM geo.places WHERE text=\" + zipcode + \" LIMIT 1\");\n\n // Generate request URI using the query statement\n URL url;\n try {\n // get URL content\n url = new URL(\"http://query.yahooapis.com/v1/public/yql?q=\" + qry);\n URLConnection conn = url.openConnection();\n\n InputStream content = conn.getInputStream();\n parseResponse(content);\n\n } catch (MalformedURLException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private void setCrosstabOptions() {\n\t\tif (djcross.isUseFullWidth()){\n\t\t\tjrcross.setWidth(layoutManager.getReport().getOptions().getPrintableWidth());\n\t\t} else {\n\t\t\tjrcross.setWidth(djcross.getWidth());\n\t\t}\n\t\tjrcross.setHeight(djcross.getHeight());\n\n\t\tjrcross.setColumnBreakOffset(djcross.getColumnBreakOffset());\n\n jrcross.setIgnoreWidth(djcross.isIgnoreWidth());\n\t}", "public final static int readMdLinkId(final StringBuilder out, final String in, final int start)\n {\n int pos = start;\n int counter = 1;\n while (pos < in.length())\n {\n final char ch = in.charAt(pos);\n boolean endReached = false;\n switch (ch)\n {\n case '\\n':\n out.append(' ');\n break;\n case '[':\n counter++;\n out.append(ch);\n break;\n case ']':\n counter--;\n if (counter == 0)\n {\n endReached = true;\n }\n else\n {\n out.append(ch);\n }\n break;\n default:\n out.append(ch);\n break;\n }\n if (endReached)\n {\n break;\n }\n pos++;\n }\n\n return (pos == in.length()) ? -1 : pos;\n }", "public void addAccessory(HomekitAccessory accessory) {\n if (accessory.getId() <= 1 && !(accessory instanceof Bridge)) {\n throw new IndexOutOfBoundsException(\n \"The ID of an accessory used in a bridge must be greater than 1\");\n }\n addAccessorySkipRangeCheck(accessory);\n }" ]
Normalizes this vector in place.
[ "public void normalize() {\n double lenSqr = x * x + y * y + z * z;\n double err = lenSqr - 1;\n if (err > (2 * DOUBLE_PREC) || err < -(2 * DOUBLE_PREC)) {\n double len = Math.sqrt(lenSqr);\n x /= len;\n y /= len;\n z /= len;\n }\n }" ]
[ "public void setDuration(float start, float end)\n {\n for (GVRAnimation anim : mAnimations)\n {\n anim.setDuration(start,end);\n }\n }", "public UniqueEntityLoader buildLoader(\n\t\t\tOuterJoinLoadable persister,\n\t\t\tint batchSize,\n\t\t\tLockOptions lockOptions,\n\t\t\tSessionFactoryImplementor factory,\n\t\t\tLoadQueryInfluencers influencers,\n\t\t\tBatchableEntityLoaderBuilder innerEntityLoaderBuilder) {\n\t\tif ( batchSize <= 1 ) {\n\t\t\t// no batching\n\t\t\treturn buildNonBatchingLoader( persister, lockOptions, factory, influencers, innerEntityLoaderBuilder );\n\t\t}\n\t\treturn buildBatchingLoader( persister, batchSize, lockOptions, factory, influencers, innerEntityLoaderBuilder );\n\t}", "public static void validate(final License license) {\n // A license should have a name\n if(license.getName() == null ||\n license.getName().isEmpty()){\n throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)\n .entity(\"License name should not be empty!\")\n .build());\n }\n\n // A license should have a long name\n if(license.getLongName() == null ||\n license.getLongName().isEmpty()){\n throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)\n .entity(\"License long name should not be empty!\")\n .build());\n }\n\n // If there is a regexp, it should compile\n if(license.getRegexp() != null &&\n !license.getRegexp().isEmpty()){\n try{\n Pattern.compile(license.getRegexp());\n }\n catch (PatternSyntaxException e){\n throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)\n .entity(\"License regexp does not compile!\").build());\n }\n\n Pattern regex = Pattern.compile(\"[&%//]\");\n if(regex.matcher(license.getRegexp()).find()){\n throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)\n .entity(\"License regexp does not compile!\").build());\n }\n\n }\n }", "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 }", "public void startAnimation()\n {\n Date time = new Date();\n this.beginAnimation = time.getTime();\n this.endAnimation = beginAnimation + (long) (animationTime * 1000);\n this.animate = true;\n }", "private void parseMetadataItem(Message item) {\n switch (item.getMenuItemType()) {\n case TRACK_TITLE:\n title = ((StringField) item.arguments.get(3)).getValue();\n artworkId = (int) ((NumberField) item.arguments.get(8)).getValue();\n break;\n\n case ARTIST:\n artist = buildSearchableItem(item);\n break;\n\n case ORIGINAL_ARTIST:\n originalArtist = buildSearchableItem(item);\n break;\n\n case REMIXER:\n remixer = buildSearchableItem(item);\n\n case ALBUM_TITLE:\n album = buildSearchableItem(item);\n break;\n\n case LABEL:\n label = buildSearchableItem(item);\n break;\n\n case DURATION:\n duration = (int) ((NumberField) item.arguments.get(1)).getValue();\n break;\n\n case TEMPO:\n tempo = (int) ((NumberField) item.arguments.get(1)).getValue();\n break;\n\n case COMMENT:\n comment = ((StringField) item.arguments.get(3)).getValue();\n break;\n\n case KEY:\n key = buildSearchableItem(item);\n break;\n\n case RATING:\n rating = (int) ((NumberField)item.arguments.get(1)).getValue();\n break;\n\n case COLOR_NONE:\n case COLOR_AQUA:\n case COLOR_BLUE:\n case COLOR_GREEN:\n case COLOR_ORANGE:\n case COLOR_PINK:\n case COLOR_PURPLE:\n case COLOR_RED:\n case COLOR_YELLOW:\n color = buildColorItem(item);\n break;\n\n case GENRE:\n genre = buildSearchableItem(item);\n break;\n\n case DATE_ADDED:\n dateAdded = ((StringField) item.arguments.get(3)).getValue();\n break;\n\n case YEAR:\n year = (int) ((NumberField) item.arguments.get(1)).getValue();\n break;\n\n case BIT_RATE:\n bitRate = (int) ((NumberField) item.arguments.get(1)).getValue();\n break;\n\n default:\n logger.warn(\"Ignoring track metadata item with unknown type: {}\", item);\n }\n }", "public Gallery lookupGallery(String galleryId) throws FlickrException {\r\n\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_LOOKUP_GALLERY);\r\n parameters.put(\"url\", galleryId);\r\n\r\n Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n\r\n Element galleryElement = response.getPayload();\r\n Gallery gallery = new Gallery();\r\n gallery.setId(galleryElement.getAttribute(\"id\"));\r\n gallery.setUrl(galleryElement.getAttribute(\"url\"));\r\n\r\n User owner = new User();\r\n owner.setId(galleryElement.getAttribute(\"owner\"));\r\n gallery.setOwner(owner);\r\n gallery.setCreateDate(galleryElement.getAttribute(\"date_create\"));\r\n gallery.setUpdateDate(galleryElement.getAttribute(\"date_update\"));\r\n gallery.setPrimaryPhotoId(galleryElement.getAttribute(\"primary_photo_id\"));\r\n gallery.setPrimaryPhotoServer(galleryElement.getAttribute(\"primary_photo_server\"));\r\n gallery.setVideoCount(galleryElement.getAttribute(\"count_videos\"));\r\n gallery.setPhotoCount(galleryElement.getAttribute(\"count_photos\"));\r\n gallery.setPrimaryPhotoFarm(galleryElement.getAttribute(\"farm\"));\r\n gallery.setPrimaryPhotoSecret(galleryElement.getAttribute(\"secret\"));\r\n\r\n gallery.setTitle(XMLUtilities.getChildValue(galleryElement, \"title\"));\r\n gallery.setDesc(XMLUtilities.getChildValue(galleryElement, \"description\"));\r\n return gallery;\r\n }", "public static ModelNode getAccessControl(ModelControllerClient client, OperationRequestAddress address, boolean operations) {\n return getAccessControl(client, null, address, operations);\n }", "public void setVariable(String name, Object value) {\n if (variables == null)\n variables = new LinkedHashMap();\n variables.put(name, value);\n }" ]
Writes the content of an input stream to an output stream @throws IOException
[ "public static void copyStream(final InputStream src, OutputStream dest) throws IOException {\r\n byte[] buffer = new byte[1024];\r\n int read;\r\n while ((read = src.read(buffer)) > -1) {\r\n dest.write(buffer, 0, read);\r\n }\r\n dest.flush();\r\n }" ]
[ "public static scpolicy_stats get(nitro_service service, String name) throws Exception{\n\t\tscpolicy_stats obj = new scpolicy_stats();\n\t\tobj.set_name(name);\n\t\tscpolicy_stats response = (scpolicy_stats) obj.stat_resource(service);\n\t\treturn response;\n\t}", "public static base_responses update(nitro_service client, nsrpcnode resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tnsrpcnode updateresources[] = new nsrpcnode[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tupdateresources[i] = new nsrpcnode();\n\t\t\t\tupdateresources[i].ipaddress = resources[i].ipaddress;\n\t\t\t\tupdateresources[i].password = resources[i].password;\n\t\t\t\tupdateresources[i].srcip = resources[i].srcip;\n\t\t\t\tupdateresources[i].secure = resources[i].secure;\n\t\t\t}\n\t\t\tresult = update_bulk_request(client, updateresources);\n\t\t}\n\t\treturn result;\n\t}", "public void setHtmlElementTranslator(HtmlElementTranslator htmlElementTranslator) {\r\n\t\tif(htmlElementTranslator!=null){\r\n\t\t\tthis.htmlElementTranslator = htmlElementTranslator;\r\n\t\t\tthis.charTranslator = null;\r\n\t\t\tthis.targetTranslator = null;\r\n\t\t}\r\n\t}", "public void setIsSeries(Boolean isSeries) {\r\n\r\n if (null != isSeries) {\r\n final boolean series = isSeries.booleanValue();\r\n if ((null != m_model.getParentSeriesId()) && series) {\r\n m_removeSeriesBindingConfirmDialog.show(new Command() {\r\n\r\n public void execute() {\r\n\r\n m_model.setParentSeriesId(null);\r\n setPattern(PatternType.DAILY.toString());\r\n\r\n }\r\n });\r\n } else {\r\n setPattern(series ? PatternType.DAILY.toString() : PatternType.NONE.toString());\r\n }\r\n }\r\n }", "private void validationRelations(Task task)\n {\n List<Relation> predecessors = task.getPredecessors();\n if (!predecessors.isEmpty())\n {\n ArrayList<Relation> invalid = new ArrayList<Relation>();\n for (Relation relation : predecessors)\n {\n Task sourceTask = relation.getSourceTask();\n Task targetTask = relation.getTargetTask();\n\n String sourceOutlineNumber = sourceTask.getOutlineNumber();\n String targetOutlineNumber = targetTask.getOutlineNumber();\n\n if (sourceOutlineNumber != null && targetOutlineNumber != null && sourceOutlineNumber.startsWith(targetOutlineNumber + '.'))\n {\n invalid.add(relation);\n }\n }\n\n for (Relation relation : invalid)\n {\n relation.getSourceTask().removePredecessor(relation.getTargetTask(), relation.getType(), relation.getLag());\n }\n }\n }", "public void enableUniformSize(final boolean enable) {\n if (mUniformSize != enable) {\n mUniformSize = enable;\n if (mContainer != null) {\n mContainer.onLayoutChanged(this);\n }\n }\n }", "static ChangeEvent<BsonDocument> changeEventForLocalDelete(\n final MongoNamespace namespace,\n final BsonValue documentId,\n final boolean writePending\n ) {\n return new ChangeEvent<>(\n new BsonDocument(),\n OperationType.DELETE,\n null,\n namespace,\n new BsonDocument(\"_id\", documentId),\n null,\n writePending);\n }", "public static DMatrixRMaj symmetric(int length, double min, double max, Random rand) {\n DMatrixRMaj A = new DMatrixRMaj(length,length);\n\n symmetric(A,min,max,rand);\n\n return A;\n }", "@SuppressWarnings(\"SameParameterValue\")\n private void sendField(Field field) throws IOException {\n if (isConnected()) {\n try {\n field.write(channel);\n } catch (IOException e) {\n logger.warn(\"Problem trying to write field to dbserver, closing connection\", e);\n close();\n throw e;\n }\n return;\n }\n throw new IOException(\"sendField() called after dbserver connection was closed\");\n }" ]
Read phases and activities from the Phoenix file to create the task hierarchy. @param phoenixProject all project data @param storepoint storepoint containing current project data
[ "private void readTasks(Project phoenixProject, Storepoint storepoint)\n {\n processLayouts(phoenixProject);\n processActivityCodes(storepoint);\n processActivities(storepoint);\n updateDates();\n }" ]
[ "public static Set<String> getRoundingNames(String... providers) {\n return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow(\n () -> new MonetaryException(\"No MonetaryRoundingsSpi loaded, query functionality is not available.\"))\n .getRoundingNames(providers);\n }", "protected List<File> getRecursiveThriftFiles(MavenProject project, String outputDirectory) throws IOException {\n return getRecursiveThriftFiles(project, outputDirectory, new ArrayList<File>());\n }", "public static base_response unset(nitro_service client, coparameter resource, String[] args) throws Exception{\n\t\tcoparameter unsetresource = new coparameter();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "public <T extends StatementDocument> void nullEdit(PropertyIdValue propertyId)\n\t\t\tthrows IOException, MediaWikiApiErrorException {\n\t\tPropertyDocument currentDocument = (PropertyDocument) this.wikibaseDataFetcher\n\t\t\t\t.getEntityDocument(propertyId.getId());\n\t\t\n\t\tnullEdit(currentDocument);\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 }", "static Style get(final GridParam params) {\n final StyleBuilder builder = new StyleBuilder();\n\n final Symbolizer pointSymbolizer = crossSymbolizer(\"shape://plus\", builder, CROSS_SIZE,\n params.gridColor);\n final Style style = builder.createStyle(pointSymbolizer);\n final List<Symbolizer> symbolizers = style.featureTypeStyles().get(0).rules().get(0).symbolizers();\n\n if (params.haloRadius > 0.0) {\n Symbolizer halo = crossSymbolizer(\"cross\", builder, CROSS_SIZE + params.haloRadius * 2.0,\n params.haloColor);\n symbolizers.add(0, halo);\n }\n\n return style;\n }", "static BsonDocument getDocumentVersionDoc(final BsonDocument document) {\n if (document == null || !document.containsKey(DOCUMENT_VERSION_FIELD)) {\n return null;\n }\n return document.getDocument(DOCUMENT_VERSION_FIELD, null);\n }", "public String getHealthMemory() {\n StringBuilder sb = new StringBuilder();\n sb.append(\"Logging JVM Stats\\n\");\n MonitorProvider mp = MonitorProvider.getInstance();\n PerformUsage perf = mp.getJVMMemoryUsage();\n sb.append(perf.toString());\n\n if (perf.memoryUsagePercent >= THRESHOLD_PERCENT) {\n sb.append(\"========= WARNING: MEM USAGE > \" + THRESHOLD_PERCENT\n + \"!!\");\n sb.append(\" !! Live Threads List=============\\n\");\n sb.append(mp.getThreadUsage().toString());\n sb.append(\"========================================\\n\");\n sb.append(\"========================JVM Thread Dump====================\\n\");\n ThreadInfo[] threadDump = mp.getThreadDump();\n for (ThreadInfo threadInfo : threadDump) {\n sb.append(threadInfo.toString() + \"\\n\");\n }\n sb.append(\"===========================================================\\n\");\n }\n sb.append(\"Logged JVM Stats\\n\");\n\n return sb.toString();\n }", "public List<ProjectFile> readAll() throws MPXJException\n {\n Map<Integer, String> projects = listProjects();\n List<ProjectFile> result = new ArrayList<ProjectFile>(projects.keySet().size());\n for (Integer id : projects.keySet())\n {\n setProjectID(id.intValue());\n result.add(read());\n }\n return result;\n }" ]
Given a date represented by a Date instance, set the time component of the date based on the hours and minutes of the time supplied by the Date instance. @param date Date instance representing the date @param canonicalTime Date instance representing the time of day @return new Date instance with the required time set
[ "public static Date setTime(Date date, Date canonicalTime)\n {\n Date result;\n if (canonicalTime == null)\n {\n result = date;\n }\n else\n {\n //\n // The original naive implementation of this method generated\n // the \"start of day\" date (midnight) for the required day\n // then added the milliseconds from the canonical time\n // to move the time forward to the required point. Unfortunately\n // if the date we'e trying to do this for is the entry or\n // exit from DST, the result is wrong, hence I've switched to\n // the approach below.\n //\n Calendar cal = popCalendar(canonicalTime);\n int dayOffset = cal.get(Calendar.DAY_OF_YEAR) - 1;\n int hourOfDay = cal.get(Calendar.HOUR_OF_DAY);\n int minute = cal.get(Calendar.MINUTE);\n int second = cal.get(Calendar.SECOND);\n int millisecond = cal.get(Calendar.MILLISECOND);\n\n cal.setTime(date);\n\n if (dayOffset != 0)\n {\n // The canonical time can be +1 day.\n // It's to do with the way we've historically\n // managed time ranges and midnight.\n cal.add(Calendar.DAY_OF_YEAR, dayOffset);\n }\n\n cal.set(Calendar.MILLISECOND, millisecond);\n cal.set(Calendar.SECOND, second);\n cal.set(Calendar.MINUTE, minute);\n cal.set(Calendar.HOUR_OF_DAY, hourOfDay);\n\n result = cal.getTime();\n pushCalendar(cal);\n }\n return result;\n }" ]
[ "static Project convert(\n String name, com.linecorp.centraldogma.server.storage.project.Project project) {\n return new Project(name);\n }", "private void addToGraph(ClassDoc cd) {\n\t// avoid adding twice the same class, but don't rely on cg.getClassInfo\n\t// since there are other ways to add a classInfor than printing the class\n\tif (visited.contains(cd.toString()))\n\t return;\n\n\tvisited.add(cd.toString());\n\tcg.printClass(cd, false);\n\tcg.printRelations(cd);\n\tif (opt.inferRelationships)\n\t cg.printInferredRelations(cd);\n\tif (opt.inferDependencies)\n\t cg.printInferredDependencies(cd);\n }", "public String getToken() {\n String id = null == answer ? text : answer;\n return Act.app().crypto().generateToken(id);\n }", "private void harvestReturnValue(\r\n Object obj,\r\n CallableStatement callable,\r\n FieldDescriptor fmd,\r\n int index)\r\n throws PersistenceBrokerSQLException\r\n {\r\n\r\n try\r\n {\r\n // If we have a field descriptor, then we can harvest\r\n // the return value.\r\n if ((callable != null) && (fmd != null) && (obj != null))\r\n {\r\n // Get the value and convert it to it's appropriate\r\n // java type.\r\n Object value = fmd.getJdbcType().getObjectFromColumn(callable, index);\r\n\r\n // Set the value of the persistent field.\r\n fmd.getPersistentField().set(obj, fmd.getFieldConversion().sqlToJava(value));\r\n\r\n }\r\n }\r\n catch (SQLException e)\r\n {\r\n String msg = \"SQLException during the execution of harvestReturnValue\"\r\n + \" class=\"\r\n + obj.getClass().getName()\r\n + \",\"\r\n + \" field=\"\r\n + fmd.getAttributeName()\r\n + \" : \"\r\n + e.getMessage();\r\n logger.error(msg,e);\r\n throw new PersistenceBrokerSQLException(msg, e);\r\n }\r\n }", "public static nslimitselector get(nitro_service service, String selectorname) throws Exception{\n\t\tnslimitselector obj = new nslimitselector();\n\t\tobj.set_selectorname(selectorname);\n\t\tnslimitselector response = (nslimitselector) obj.get_resource(service);\n\t\treturn response;\n\t}", "public void await() {\n boolean intr = false;\n final Object lock = this.lock;\n try {\n synchronized (lock) {\n while (! readClosed) {\n try {\n lock.wait();\n } catch (InterruptedException e) {\n intr = true;\n }\n }\n }\n } finally {\n if (intr) {\n Thread.currentThread().interrupt();\n }\n }\n }", "@UiHandler(\"m_endTime\")\n void onEndTimeChange(CmsDateBoxEvent event) {\n\n if (handleChange() && !event.isUserTyping()) {\n m_controller.setEndTime(event.getDate());\n }\n }", "private Entry getEntry(Object key)\r\n {\r\n if (key == null) return null;\r\n int hash = hashCode(key);\r\n int index = indexFor(hash);\r\n for (Entry entry = table[index]; entry != null; entry = entry.next)\r\n {\r\n if ((entry.hash == hash) && equals(key, entry.getKey()))\r\n {\r\n return entry;\r\n }\r\n }\r\n return null;\r\n }", "private void writeResources(Project project)\n {\n Project.Resources resources = m_factory.createProjectResources();\n project.setResources(resources);\n List<Project.Resources.Resource> list = resources.getResource();\n\n for (Resource resource : m_projectFile.getResources())\n {\n list.add(writeResource(resource));\n }\n }" ]
Get a fallback handler. @param header the protocol header @return the fallback handler
[ "protected static <T, A> ManagementRequestHandler<T, A> getFallbackHandler(final ManagementRequestHeader header) {\n return new ManagementRequestHandler<T, A>() {\n @Override\n public void handleRequest(final DataInput input, ActiveOperation.ResultHandler<T> resultHandler, ManagementRequestContext<A> context) throws IOException {\n final Exception error = ProtocolLogger.ROOT_LOGGER.noSuchResponseHandler(Integer.toHexString(header.getRequestId()));\n if(resultHandler.failed(error)) {\n safeWriteErrorResponse(context.getChannel(), context.getRequestHeader(), error);\n }\n }\n };\n }" ]
[ "public List<GetLocationResult> search(String q, int maxRows, Locale locale)\n\t\t\tthrows Exception {\n\t\tList<GetLocationResult> searchResult = new ArrayList<GetLocationResult>();\n\n\t\tString url = URLEncoder.encode(q, \"UTF8\");\n\t\turl = \"q=select%20*%20from%20geo.placefinder%20where%20text%3D%22\"\n\t\t\t\t+ url + \"%22\";\n\t\tif (maxRows > 0) {\n\t\t\turl = url + \"&count=\" + maxRows;\n\t\t}\n\t\turl = url + \"&flags=GX\";\n\t\tif (null != locale) {\n\t\t\turl = url + \"&locale=\" + locale;\n\t\t}\n\t\tif (appId != null) {\n\t\t\turl = url + \"&appid=\" + appId;\n\t\t}\n\n\t\tInputStream inputStream = connect(url);\n\t\tif (null != inputStream) {\n\t\t\tSAXBuilder parser = new SAXBuilder();\n\t\t\tDocument doc = parser.build(inputStream);\n\n\t\t\tElement root = doc.getRootElement();\n\n\t\t\t// check code for exception\n\t\t\tString message = root.getChildText(\"Error\");\n\t\t\t// Integer errorCode = Integer.parseInt(message);\n\t\t\tif (message != null && Integer.parseInt(message) != 0) {\n\t\t\t\tthrow new Exception(root.getChildText(\"ErrorMessage\"));\n\t\t\t}\n\t\t\tElement results = root.getChild(\"results\");\n\t\t\tfor (Object obj : results.getChildren(\"Result\")) {\n\t\t\t\tElement toponymElement = (Element) obj;\n\t\t\t\tGetLocationResult location = getLocationFromElement(toponymElement);\n\t\t\t\tsearchResult.add(location);\n\t\t\t}\n\t\t}\n\t\treturn searchResult;\n\t}", "private void processRemarks(GanttDesignerRemark remark)\n {\n for (GanttDesignerRemark.Task remarkTask : remark.getTask())\n {\n Integer id = remarkTask.getRow();\n Task task = m_projectFile.getTaskByID(id);\n String notes = task.getNotes();\n if (notes.isEmpty())\n {\n notes = remarkTask.getContent();\n }\n else\n {\n notes = notes + '\\n' + remarkTask.getContent();\n }\n task.setNotes(notes);\n }\n }", "public boolean removePredecessor(Task targetTask, RelationType type, Duration lag)\n {\n boolean matchFound = false;\n\n //\n // Retrieve the list of predecessors\n //\n List<Relation> predecessorList = getPredecessors();\n if (!predecessorList.isEmpty())\n {\n //\n // Ensure that we have a valid lag duration\n //\n if (lag == null)\n {\n lag = Duration.getInstance(0, TimeUnit.DAYS);\n }\n\n //\n // Ensure that there is a predecessor relationship between\n // these two tasks, and remove it.\n //\n matchFound = removeRelation(predecessorList, targetTask, type, lag);\n\n //\n // If we have removed a predecessor, then we must remove the\n // corresponding successor entry from the target task list\n //\n if (matchFound)\n {\n //\n // Retrieve the list of successors\n //\n List<Relation> successorList = targetTask.getSuccessors();\n if (!successorList.isEmpty())\n {\n //\n // Ensure that there is a successor relationship between\n // these two tasks, and remove it.\n //\n removeRelation(successorList, this, type, lag);\n }\n }\n }\n\n return matchFound;\n }", "public void initialize() {\n\t\tif (dataClass == null) {\n\t\t\tthrow new IllegalStateException(\"dataClass was never set on \" + getClass().getSimpleName());\n\t\t}\n\t\tif (tableName == null) {\n\t\t\ttableName = extractTableName(databaseType, dataClass);\n\t\t}\n\t}", "public static int serialize(final File directory, String name, Object obj) {\n try (FileOutputStream stream = new FileOutputStream(new File(directory, name))) {\n return serialize(stream, obj);\n } catch (IOException e) {\n throw new ReportGenerationException(e);\n }\n }", "public ItemRequest<Team> removeUser(String team) {\n \n String path = String.format(\"/teams/%s/removeUser\", team);\n return new ItemRequest<Team>(this, Team.class, path, \"POST\");\n }", "public static void initialize(final Context context) {\n if (!initialized.compareAndSet(false, true)) {\n return;\n }\n\n applicationContext = context.getApplicationContext();\n\n final String packageName = applicationContext.getPackageName();\n localAppName = packageName;\n\n final PackageManager manager = applicationContext.getPackageManager();\n try {\n final PackageInfo pkgInfo = manager.getPackageInfo(packageName, 0);\n localAppVersion = pkgInfo.versionName;\n } catch (final NameNotFoundException e) {\n Log.d(TAG, \"Failed to get version of application, will not send in device info.\");\n }\n\n Log.d(TAG, \"Initialized android SDK\");\n }", "public String getXmlFormatted(Map<String, String> dataMap) {\r\n StringBuilder sb = new StringBuilder();\r\n for (String var : outTemplate) {\r\n sb.append(appendXmlStartTag(var));\r\n sb.append(dataMap.get(var));\r\n sb.append(appendXmlEndingTag(var));\r\n }\r\n return sb.toString();\r\n }", "@Override\n public PersistentResourceXMLDescription getParserDescription() {\n return PersistentResourceXMLDescription.builder(ElytronExtension.SUBSYSTEM_PATH, getNameSpace())\n .addAttribute(ElytronDefinition.DEFAULT_AUTHENTICATION_CONTEXT)\n .addAttribute(ElytronDefinition.INITIAL_PROVIDERS)\n .addAttribute(ElytronDefinition.FINAL_PROVIDERS)\n .addAttribute(ElytronDefinition.DISALLOWED_PROVIDERS)\n .addAttribute(ElytronDefinition.SECURITY_PROPERTIES, new AttributeParsers.PropertiesParser(null, SECURITY_PROPERTY, true), new AttributeMarshallers.PropertiesAttributeMarshaller(null, SECURITY_PROPERTY, true))\n .addChild(getAuthenticationClientParser())\n .addChild(getProviderParser())\n .addChild(getAuditLoggingParser())\n .addChild(getDomainParser())\n .addChild(getRealmParser())\n .addChild(getCredentialSecurityFactoryParser())\n .addChild(getMapperParser())\n .addChild(getHttpParser())\n .addChild(getSaslParser())\n .addChild(getTlsParser())\n .addChild(decorator(CREDENTIAL_STORES).addChild(new CredentialStoreParser().parser))\n .addChild(getDirContextParser())\n .addChild(getPolicyParser())\n .build();\n }" ]
Delete old jobs. @param checkTimeThreshold threshold for last check time @return the number of jobs deleted
[ "public final int deleteOld(final long checkTimeThreshold) {\n final CriteriaBuilder builder = getSession().getCriteriaBuilder();\n final CriteriaDelete<PrintJobStatusExtImpl> delete =\n builder.createCriteriaDelete(PrintJobStatusExtImpl.class);\n final Root<PrintJobStatusExtImpl> root = delete.from(PrintJobStatusExtImpl.class);\n delete.where(builder.and(builder.isNotNull(root.get(\"lastCheckTime\")),\n builder.lessThan(root.get(\"lastCheckTime\"), checkTimeThreshold)));\n return getSession().createQuery(delete).executeUpdate();\n }" ]
[ "@DELETE\n @Path(\"/{name}\" + ServerAPI.GET_CORPORATE_GROUPIDS)\n public Response removeCorporateGroupIdPrefix(@Auth final DbCredential credential, @PathParam(\"name\") final String organizationId, final String corporateGroupId){\n LOG.info(\"Got an remove a corporate groupId prefix request for organization \" + organizationId +\".\");\n if(!credential.getRoles().contains(DbCredential.AvailableRoles.DATA_UPDATER)){\n throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());\n }\n\n if(corporateGroupId == null || corporateGroupId.isEmpty()){\n LOG.error(\"No corporate GroupId to remove!\");\n return Response.serverError().status(HttpStatus.BAD_REQUEST_400).build();\n }\n\n getOrganizationHandler().removeCorporateGroupId(organizationId, corporateGroupId);\n\n return Response.ok(\"done\").build();\n }", "synchronized void removeServerProcess() {\n this.requiredState = InternalState.STOPPED;\n internalSetState(new ProcessRemoveTask(), InternalState.STOPPED, InternalState.PROCESS_REMOVING);\n }", "public boolean hasRequiredMiniFluoProps() {\n boolean valid = true;\n if (getMiniStartAccumulo()) {\n // ensure that client properties are not set since we are using MiniAccumulo\n valid &= verifyStringPropNotSet(ACCUMULO_USER_PROP, CLIENT_ACCUMULO_USER_PROP);\n valid &= verifyStringPropNotSet(ACCUMULO_PASSWORD_PROP, CLIENT_ACCUMULO_PASSWORD_PROP);\n valid &= verifyStringPropNotSet(ACCUMULO_INSTANCE_PROP, CLIENT_ACCUMULO_INSTANCE_PROP);\n valid &= verifyStringPropNotSet(ACCUMULO_ZOOKEEPERS_PROP, CLIENT_ACCUMULO_ZOOKEEPERS_PROP);\n valid &= verifyStringPropNotSet(CONNECTION_ZOOKEEPERS_PROP, CLIENT_ZOOKEEPER_CONNECT_PROP);\n if (valid == false) {\n log.error(\"Client properties should not be set in your configuration if MiniFluo is \"\n + \"configured to start its own accumulo (indicated by fluo.mini.start.accumulo being \"\n + \"set to true)\");\n }\n } else {\n valid &= hasRequiredClientProps();\n valid &= hasRequiredAdminProps();\n valid &= hasRequiredOracleProps();\n valid &= hasRequiredWorkerProps();\n }\n return valid;\n }", "public List<Throwable> getCauses(Throwable t)\n {\n List<Throwable> causes = new LinkedList<Throwable>();\n Throwable next = t;\n while (next.getCause() != null)\n {\n next = next.getCause();\n causes.add(next);\n }\n return causes;\n }", "protected void countStatements(UsageStatistics usageStatistics,\n\t\t\tStatementDocument statementDocument) {\n\t\t// Count Statement data:\n\t\tfor (StatementGroup sg : statementDocument.getStatementGroups()) {\n\t\t\t// Count Statements:\n\t\t\tusageStatistics.countStatements += sg.size();\n\n\t\t\t// Count uses of properties in Statements:\n\t\t\tcountPropertyMain(usageStatistics, sg.getProperty(), sg.size());\n\t\t\tfor (Statement s : sg) {\n\t\t\t\tfor (SnakGroup q : s.getQualifiers()) {\n\t\t\t\t\tcountPropertyQualifier(usageStatistics, q.getProperty(), q.size());\n\t\t\t\t}\n\t\t\t\tfor (Reference r : s.getReferences()) {\n\t\t\t\t\tusageStatistics.countReferencedStatements++;\n\t\t\t\t\tfor (SnakGroup snakGroup : r.getSnakGroups()) {\n\t\t\t\t\t\tcountPropertyReference(usageStatistics,\n\t\t\t\t\t\t\t\tsnakGroup.getProperty(), snakGroup.size());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public static String getParentIdFromAgent(Launcher launcher, final String imageID, final String host) throws IOException, InterruptedException {\n return launcher.getChannel().call(new MasterToSlaveCallable<String, IOException>() {\n public String call() throws IOException {\n return DockerUtils.getParentId(imageID, host);\n }\n });\n }", "public List<String> filterAddonResources(Addon addon, Predicate<String> filter)\n {\n List<String> discoveredFileNames = new ArrayList<>();\n List<File> addonResources = addon.getRepository().getAddonResources(addon.getId());\n for (File addonFile : addonResources)\n {\n if (addonFile.isDirectory())\n handleDirectory(filter, addonFile, discoveredFileNames);\n else\n handleArchiveByFile(filter, addonFile, discoveredFileNames);\n }\n return discoveredFileNames;\n }", "public ItemRequest<Task> removeTag(String task) {\n \n String path = String.format(\"/tasks/%s/removeTag\", task);\n return new ItemRequest<Task>(this, Task.class, path, \"POST\");\n }", "public static CmsSearchConfigurationSorting create(\n final String sortParam,\n final List<I_CmsSearchConfigurationSortOption> options,\n final I_CmsSearchConfigurationSortOption defaultOption) {\n\n return (null != sortParam) || ((null != options) && !options.isEmpty()) || (null != defaultOption)\n ? new CmsSearchConfigurationSorting(sortParam, options, defaultOption)\n : null;\n }" ]
Process a SQLite database PP file. @param inputStream file input stream @return ProjectFile instance
[ "private ProjectFile readDatabaseFile(InputStream inputStream) throws MPXJException\n {\n ProjectReader reader = new AstaDatabaseFileReader();\n addListeners(reader);\n return reader.read(inputStream);\n }" ]
[ "public LuaPreparedScript endPreparedScriptReturn(LuaValue value, LuaScriptConfig config) {\n add(new LuaAstReturnStatement(argument(value)));\n return endPreparedScript(config);\n }", "public static Chart getMSDLineWithConfinedModelChart(Trajectory t, int lagMin,\n\t\t\tint lagMax, double timelag, double a, double b, double c, double d) {\n\n\t\tdouble[] xData = new double[lagMax - lagMin + 1];\n\t\tdouble[] yData = new double[lagMax - lagMin + 1];\n\t\tdouble[] modelData = new double[lagMax - lagMin + 1];\n\t\tMeanSquaredDisplacmentFeature msdeval = new MeanSquaredDisplacmentFeature(\n\t\t\t\tt, lagMin);\n\t\tmsdeval.setTrajectory(t);\n\t\tmsdeval.setTimelag(lagMin);\n\t\tfor (int i = lagMin; i < lagMax + 1; i++) {\n\t\t\tmsdeval.setTimelag(i);\n\t\t\tdouble msdhelp = msdeval.evaluate()[0];\n\t\t\txData[i - lagMin] = i;\n\t\t\tyData[i - lagMin] = msdhelp;\n\t\t\tmodelData[i - lagMin] = a\n\t\t\t\t\t* (1 - b * Math.exp((-4 * d) * ((i * timelag) / a) * c));\n\t\t}\n\n\t\t// Create Chart\n\t\tChart chart = QuickChart.getChart(\"MSD Line\", \"LAG\", \"MSD\", \"MSD\",\n\t\t\t\txData, yData);\n\t\tif(Math.abs(1-b)<0.00001 && Math.abs(1-a)<0.00001){\n\t\t\tchart.addSeries(\"y=a*(1-exp(-4*D*t/a))\", xData, modelData);\n\t\t}else{\n\t\t\tchart.addSeries(\"y=a*(1-b*exp(-4*c*D*t/a))\", xData, modelData);\n\t\t}\n\n\t\t// Show it\n\t\t//new SwingWrapper(chart).displayChart();\n\t\treturn chart;\n\t}", "public void sendLoadTrackCommand(int targetPlayer, int rekordboxId,\n int sourcePlayer, CdjStatus.TrackSourceSlot sourceSlot, CdjStatus.TrackType sourceType)\n throws IOException {\n final DeviceUpdate update = getLatestStatusFor(targetPlayer);\n if (update == null) {\n throw new IllegalArgumentException(\"Device \" + targetPlayer + \" not found on network.\");\n }\n sendLoadTrackCommand(update, rekordboxId, sourcePlayer, sourceSlot, sourceType);\n }", "public static String getXPathExpression(Node node) {\n\t\tObject xpathCache = node.getUserData(FULL_XPATH_CACHE);\n\t\tif (xpathCache != null) {\n\t\t\treturn xpathCache.toString();\n\t\t}\n\t\tNode parent = node.getParentNode();\n\n\t\tif ((parent == null) || parent.getNodeName().contains(\"#document\")) {\n\t\t\tString xPath = \"/\" + node.getNodeName() + \"[1]\";\n\t\t\tnode.setUserData(FULL_XPATH_CACHE, xPath, null);\n\t\t\treturn xPath;\n\t\t}\n\n\t\tif (node.hasAttributes() && node.getAttributes().getNamedItem(\"id\") != null) {\n\t\t\tString xPath = \"//\" + node.getNodeName() + \"[@id = '\"\n\t\t\t\t\t+ node.getAttributes().getNamedItem(\"id\").getNodeValue() + \"']\";\n\t\t\tnode.setUserData(FULL_XPATH_CACHE, xPath, null);\n\t\t\treturn xPath;\n\t\t}\n\n\t\tStringBuffer buffer = new StringBuffer();\n\n\t\tif (parent != node) {\n\t\t\tbuffer.append(getXPathExpression(parent));\n\t\t\tbuffer.append(\"/\");\n\t\t}\n\n\t\tbuffer.append(node.getNodeName());\n\n\t\tList<Node> mySiblings = getSiblings(parent, node);\n\n\t\tfor (int i = 0; i < mySiblings.size(); i++) {\n\t\t\tNode el = mySiblings.get(i);\n\n\t\t\tif (el.equals(node)) {\n\t\t\t\tbuffer.append('[').append(Integer.toString(i + 1)).append(']');\n\t\t\t\t// Found so break;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tString xPath = buffer.toString();\n\t\tnode.setUserData(FULL_XPATH_CACHE, xPath, null);\n\t\treturn xPath;\n\t}", "public ParallelTask execute(ParallecResponseHandler handler) {\n\n ParallelTask task = new ParallelTask();\n\n try {\n targetHostMeta = new TargetHostMeta(targetHosts);\n\n final ParallelTask taskReal = new ParallelTask(requestProtocol,\n concurrency, httpMeta, targetHostMeta, sshMeta, tcpMeta, udpMeta, pingMeta,\n handler, responseContext, \n replacementVarMapNodeSpecific, replacementVarMap,\n requestReplacementType, \n config);\n\n task = taskReal;\n\n logger.info(\"***********START_PARALLEL_HTTP_TASK_\"\n + task.getTaskId() + \"***********\");\n\n // throws ParallelTaskInvalidException\n task.validateWithFillDefault();\n\n task.setSubmitTime(System.currentTimeMillis());\n\n if (task.getConfig().isEnableCapacityAwareTaskScheduler()) {\n\n //late initialize the task scheduler\n ParallelTaskManager.getInstance().initTaskSchedulerIfNot();\n // add task to the wait queue\n ParallelTaskManager.getInstance().getWaitQ().add(task);\n\n logger.info(\"Enabled CapacityAwareTaskScheduler. Submitted task to waitQ in builder.. \"\n + task.getTaskId());\n\n } else {\n\n logger.info(\n \"Disabled CapacityAwareTaskScheduler. Immediately execute task {} \",\n task.getTaskId());\n\n Runnable director = new Runnable() {\n\n public void run() {\n ParallelTaskManager.getInstance()\n .generateUpdateExecuteTask(taskReal);\n }\n };\n new Thread(director).start();\n }\n\n if (this.getMode() == TaskRunMode.SYNC) {\n logger.info(\"Executing task {} in SYNC mode... \",\n task.getTaskId());\n\n while (task != null && !task.isCompleted()) {\n try {\n Thread.sleep(500L);\n } catch (InterruptedException e) {\n logger.error(\"InterruptedException \" + e);\n }\n }\n }\n } catch (ParallelTaskInvalidException ex) {\n\n logger.info(\"Request is invalid with missing parts. Details: \"\n + ex.getMessage() + \" Cannot execute at this time. \"\n + \" Please review your request and try again.\\nCommand:\"\n + httpMeta.toString());\n\n task.setState(ParallelTaskState.COMPLETED_WITH_ERROR);\n task.getTaskErrorMetas().add(\n new TaskErrorMeta(TaskErrorType.VALIDATION_ERROR,\n \"validation eror\"));\n\n } catch (Exception t) {\n logger.error(\"fail task builder. Unknown error: \" + t, t);\n task.setState(ParallelTaskState.COMPLETED_WITH_ERROR);\n task.getTaskErrorMetas().add(\n new TaskErrorMeta(TaskErrorType.UNKNOWN, \"unknown eror\",\n t));\n }\n\n logger.info(\"***********FINISH_PARALLEL_HTTP_TASK_\" + task.getTaskId()\n + \"***********\");\n return task;\n\n }", "private void setTasks(String tasks) {\n\t\tfor (String task : tasks.split(\",\")) {\n\t\t\tif (KNOWN_TASKS.containsKey(task)) {\n\t\t\t\tthis.tasks |= KNOWN_TASKS.get(task);\n\t\t\t\tthis.taskName += (this.taskName.isEmpty() ? \"\" : \"-\") + task;\n\t\t\t} else {\n\t\t\t\tlogger.warn(\"Unsupported RDF serialization task \\\"\" + task\n\t\t\t\t\t\t+ \"\\\". Run without specifying any tasks for help.\");\n\t\t\t}\n\t\t}\n\t}", "protected final void _onConnect(WebSocketContext context) {\n if (null != connectionListener) {\n connectionListener.onConnect(context);\n }\n connectionListenerManager.notifyFreeListeners(context, false);\n Act.eventBus().emit(new WebSocketConnectEvent(context));\n }", "public String getProperty(String key, String defaultValue) {\n return mProperties.getProperty(key, defaultValue);\n }", "public static base_responses add(nitro_service client, sslcertkey resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tsslcertkey addresources[] = new sslcertkey[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new sslcertkey();\n\t\t\t\taddresources[i].certkey = resources[i].certkey;\n\t\t\t\taddresources[i].cert = resources[i].cert;\n\t\t\t\taddresources[i].key = resources[i].key;\n\t\t\t\taddresources[i].password = resources[i].password;\n\t\t\t\taddresources[i].fipskey = resources[i].fipskey;\n\t\t\t\taddresources[i].inform = resources[i].inform;\n\t\t\t\taddresources[i].passplain = resources[i].passplain;\n\t\t\t\taddresources[i].expirymonitor = resources[i].expirymonitor;\n\t\t\t\taddresources[i].notificationperiod = resources[i].notificationperiod;\n\t\t\t\taddresources[i].bundle = resources[i].bundle;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}" ]
Set day. @param d day instance
[ "public void setDay(Day d)\n {\n if (m_day != null)\n {\n m_parentCalendar.removeHoursFromDay(this);\n }\n\n m_day = d;\n\n m_parentCalendar.attachHoursToDay(this);\n }" ]
[ "public void setColorRange(int firstIndex, int lastIndex, int color) {\n\t\tfor (int i = firstIndex; i <= lastIndex; i++)\n\t\t\tmap[i] = color;\n\t}", "@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException\n {\n try\n {\n populateMemberData(reader, file, root);\n processProjectProperties();\n\n if (!reader.getReadPropertiesOnly())\n {\n processSubProjectData();\n processGraphicalIndicators();\n processCustomValueLists();\n processCalendarData();\n processResourceData();\n processTaskData();\n processConstraintData();\n processAssignmentData();\n postProcessTasks();\n\n if (reader.getReadPresentationData())\n {\n processViewPropertyData();\n processTableData();\n processViewData();\n processFilterData();\n processGroupData();\n processSavedViewState();\n }\n }\n }\n\n finally\n {\n clearMemberData();\n }\n }", "public static nspbr6_stats[] get(nitro_service service, options option) throws Exception{\n\t\tnspbr6_stats obj = new nspbr6_stats();\n\t\tnspbr6_stats[] response = (nspbr6_stats[])obj.stat_resources(service,option);\n\t\treturn response;\n\t}", "public static lbmonitor_binding get(nitro_service service, String monitorname) throws Exception{\n\t\tlbmonitor_binding obj = new lbmonitor_binding();\n\t\tobj.set_monitorname(monitorname);\n\t\tlbmonitor_binding response = (lbmonitor_binding) obj.get_resource(service);\n\t\treturn response;\n\t}", "private String fixApiDocRoot(String str) {\n\tif (str == null)\n\t return null;\n\tString fixed = str.trim();\n\tif (fixed.isEmpty())\n\t return \"\";\n\tif (File.separatorChar != '/')\n\t fixed = fixed.replace(File.separatorChar, '/');\n\tif (!fixed.endsWith(\"/\"))\n\t fixed = fixed + \"/\";\n\treturn fixed;\n }", "public static authenticationldappolicy_authenticationvserver_binding[] get(nitro_service service, String name) throws Exception{\n\t\tauthenticationldappolicy_authenticationvserver_binding obj = new authenticationldappolicy_authenticationvserver_binding();\n\t\tobj.set_name(name);\n\t\tauthenticationldappolicy_authenticationvserver_binding response[] = (authenticationldappolicy_authenticationvserver_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "private void deliverMasterChangedAnnouncement(final DeviceUpdate update) {\n for (final MasterListener listener : getMasterListeners()) {\n try {\n listener.masterChanged(update);\n } catch (Throwable t) {\n logger.warn(\"Problem delivering master changed announcement to listener\", t);\n }\n }\n }", "public static base_response clear(nitro_service client) throws Exception {\n\t\tnssimpleacl clearresource = new nssimpleacl();\n\t\treturn clearresource.perform_operation(client,\"clear\");\n\t}", "private Set<String> findResourceNamesFromFileSystem(String classPathRootOnDisk, String scanRootLocation, File folder) {\n LOGGER.debug(\"Scanning for resources in path: {} ({})\", folder.getPath(), scanRootLocation);\n\n File[] files = folder.listFiles();\n if (files == null) {\n return emptySet();\n }\n\n Set<String> resourceNames = new TreeSet<>();\n\n for (File file : files) {\n if (file.canRead()) {\n if (file.isDirectory()) {\n resourceNames.addAll(findResourceNamesFromFileSystem(classPathRootOnDisk, scanRootLocation, file));\n } else {\n resourceNames.add(toResourceNameOnClasspath(classPathRootOnDisk, file));\n }\n }\n }\n\n return resourceNames;\n }" ]
Returns an unmodifiable view of the specified multi-value map. @param map the map for which an unmodifiable view is to be returned. @return an unmodifiable view of the specified multi-value map.
[ "public static <K,V> MultiValueMap<K,V> unmodifiableMultiValueMap(MultiValueMap<? extends K, ? extends V> map) {\n\t\tAssert.notNull(map, \"'map' must not be null\");\n\t\tMap<K, List<V>> result = new LinkedHashMap<K, List<V>>(map.size());\n\t\tfor (Map.Entry<? extends K, ? extends List<? extends V>> entry : map.entrySet()) {\n\t\t\tList<V> values = Collections.unmodifiableList(entry.getValue());\n\t\t\tresult.put(entry.getKey(), values);\n\t\t}\n\t\tMap<K, List<V>> unmodifiableMap = Collections.unmodifiableMap(result);\n\t\treturn toMultiValueMap(unmodifiableMap);\n\t}" ]
[ "public static Map<String, List<String>> getConsumersPerTopic(ZkClient zkClient, String group) {\n ZkGroupDirs dirs = new ZkGroupDirs(group);\n List<String> consumers = getChildrenParentMayNotExist(zkClient, dirs.consumerRegistryDir);\n //\n Map<String, List<String>> consumersPerTopicMap = new HashMap<String, List<String>>();\n for (String consumer : consumers) {\n TopicCount topicCount = getTopicCount(zkClient, group, consumer);\n for (Map.Entry<String, Set<String>> e : topicCount.getConsumerThreadIdsPerTopic().entrySet()) {\n final String topic = e.getKey();\n for (String consumerThreadId : e.getValue()) {\n List<String> list = consumersPerTopicMap.get(topic);\n if (list == null) {\n list = new ArrayList<String>();\n consumersPerTopicMap.put(topic, list);\n }\n //\n list.add(consumerThreadId);\n }\n }\n }\n //\n for (Map.Entry<String, List<String>> e : consumersPerTopicMap.entrySet()) {\n Collections.sort(e.getValue());\n }\n return consumersPerTopicMap;\n }", "private List<Versioned<byte[]>> filterExpiredEntries(ByteArray key, List<Versioned<byte[]>> vals) {\n Iterator<Versioned<byte[]>> valsIterator = vals.iterator();\n while(valsIterator.hasNext()) {\n Versioned<byte[]> val = valsIterator.next();\n VectorClock clock = (VectorClock) val.getVersion();\n // omit if expired\n if(clock.getTimestamp() < (time.getMilliseconds() - this.retentionTimeMs)) {\n valsIterator.remove();\n // delete stale value if configured\n if(deleteExpiredEntries) {\n getInnerStore().delete(key, clock);\n }\n }\n }\n return vals;\n }", "public Headers getAllHeaders() {\n Headers requestHeaders = getHeaders();\n requestHeaders = hasPayload() ? requestHeaders.withContentType(getPayload().get().getMimeType()) : requestHeaders;\n //We don't want to add headers more than once.\n return requestHeaders;\n }", "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 }", "public View getFullScreenView() {\n if (mFullScreenView != null) {\n return mFullScreenView;\n }\n\n final DisplayMetrics metrics = new DisplayMetrics();\n mActivity.getWindowManager().getDefaultDisplay().getMetrics(metrics);\n final int screenWidthPixels = Math.max(metrics.widthPixels, metrics.heightPixels);\n final int screenHeightPixels = Math.min(metrics.widthPixels, metrics.heightPixels);\n\n final ViewGroup.LayoutParams layout = new ViewGroup.LayoutParams(screenWidthPixels, screenHeightPixels);\n mFullScreenView = new View(mActivity);\n mFullScreenView.setLayoutParams(layout);\n mRenderableViewGroup.addView(mFullScreenView);\n\n return mFullScreenView;\n }", "private static JsonParser newJsonParserForNode(JsonNode jsonNode) throws IOException {\n JsonParser parser = new JsonFactory().createParser(jsonNode.toString());\n parser.nextToken();\n return parser;\n }", "public CodePage getCodePage(int field)\n {\n CodePage result;\n\n if ((field < m_fields.length) && (m_fields[field].length() != 0))\n {\n result = CodePage.getInstance(m_fields[field]);\n }\n else\n {\n result = CodePage.getInstance(null);\n }\n\n return (result);\n }", "public Metadata setMetadata(String templateName, String scope, Metadata metadata) {\n Metadata metadataValue = null;\n\n try {\n metadataValue = this.createMetadata(templateName, scope, metadata);\n } catch (BoxAPIException e) {\n if (e.getResponseCode() == 409) {\n Metadata metadataToUpdate = new Metadata(scope, templateName);\n for (JsonValue value : metadata.getOperations()) {\n if (value.asObject().get(\"value\").isNumber()) {\n metadataToUpdate.add(value.asObject().get(\"path\").asString(),\n value.asObject().get(\"value\").asFloat());\n } else if (value.asObject().get(\"value\").isString()) {\n metadataToUpdate.add(value.asObject().get(\"path\").asString(),\n value.asObject().get(\"value\").asString());\n } else if (value.asObject().get(\"value\").isArray()) {\n ArrayList<String> list = new ArrayList<String>();\n for (JsonValue jsonValue : value.asObject().get(\"value\").asArray()) {\n list.add(jsonValue.asString());\n }\n metadataToUpdate.add(value.asObject().get(\"path\").asString(), list);\n }\n }\n metadataValue = this.updateMetadata(metadataToUpdate);\n }\n }\n\n return metadataValue;\n }", "public final void setAttributes(final Map<String, Attribute> attributes) {\n for (Map.Entry<String, Attribute> entry: attributes.entrySet()) {\n Object attribute = entry.getValue();\n if (!(attribute instanceof Attribute)) {\n final String msg =\n \"Attribute: '\" + entry.getKey() + \"' is not an attribute. It is a: \" + attribute;\n LOGGER.error(\"Error setting the Attributes: {}\", msg);\n throw new IllegalArgumentException(msg);\n } else {\n ((Attribute) attribute).setConfigName(entry.getKey());\n }\n }\n this.attributes = attributes;\n }" ]
Invokes a JavaScript function that takes no arguments. @param <T> @param function The function to invoke @param returnType The type of object to return @return The result of the function.
[ "protected <T> T invokeJavascriptReturnValue(String function, Class<T> returnType) {\n Object returnObject = invokeJavascript(function);\n if (returnObject instanceof JSObject) {\n try {\n Constructor<T> constructor = returnType.getConstructor(JSObject.class);\n return constructor.newInstance((JSObject) returnObject);\n } catch (Exception ex) {\n throw new IllegalStateException(ex);\n }\n } else {\n return (T) returnObject;\n }\n }" ]
[ "public Iterable<BoxRetentionPolicyAssignment.Info> getAllAssignments(int limit, String ... fields) {\r\n return this.getAssignments(null, limit, fields);\r\n }", "public boolean setMethodArguments(String pathName, String methodName, Integer ordinal, Object... arguments) {\n try {\n BasicNameValuePair[] params = new BasicNameValuePair[arguments.length + 2];\n int x = 0;\n for (Object argument : arguments) {\n params[x] = new BasicNameValuePair(\"arguments[]\", argument.toString());\n x++;\n }\n params[x] = new BasicNameValuePair(\"profileIdentifier\", this._profileName);\n params[x + 1] = new BasicNameValuePair(\"ordinal\", ordinal.toString());\n\n JSONObject response = new JSONObject(doPost(BASE_PATH + uriEncode(pathName) + \"/\" + methodName, params));\n\n return true;\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n return false;\n }", "private String toPath(String name, IconSize size) {\n\n return CmsStringUtil.joinPaths(CmsWorkplace.getSkinUri(), ICON_FOLDER, \"\" + name.hashCode()) + size.getSuffix();\n }", "public void addHandlerFactory(ManagementRequestHandlerFactory factory) {\n for (;;) {\n final ManagementRequestHandlerFactory[] snapshot = updater.get(this);\n final int length = snapshot.length;\n final ManagementRequestHandlerFactory[] newVal = new ManagementRequestHandlerFactory[length + 1];\n System.arraycopy(snapshot, 0, newVal, 0, length);\n newVal[length] = factory;\n if (updater.compareAndSet(this, snapshot, newVal)) {\n return;\n }\n }\n }", "protected AbstractColumn buildSimpleBarcodeColumn() {\n\t\tBarCodeColumn column = new BarCodeColumn();\n\t\tpopulateCommonAttributes(column);\n\t\tcolumn.setColumnProperty(columnProperty);\n\t\tcolumn.setExpressionToGroupBy(customExpressionToGroupBy);\n\t\tcolumn.setScaleMode(imageScaleMode);\n\t\tcolumn.setApplicationIdentifier(applicationIdentifier);\n\t\tcolumn.setBarcodeType(barcodeType);\n\t\tcolumn.setShowText(showText);\n\t\tcolumn.setCheckSum(checkSum);\n\t\treturn column;\n\t}", "@Override\n\tpublic String toNormalizedString() {\n\t\tString result;\n\t\tif(hasNoStringCache() || (result = getStringCache().normalizedString) == null) {\n\t\t\tgetStringCache().normalizedString = result = toNormalizedString(IPv6StringCache.normalizedParams);\n\t\t}\n\t\treturn result;\n\t}", "public Where<T, ID> isNull(String columnName) throws SQLException {\n\t\taddClause(new IsNull(columnName, findColumnFieldType(columnName)));\n\t\treturn this;\n\t}", "protected static PatchElement createPatchElement(final PatchEntry entry, String patchId, final List<ContentModification> modifications) {\n final PatchElement patchElement = entry.element;\n final PatchElementImpl element = new PatchElementImpl(patchId);\n element.setProvider(patchElement.getProvider());\n // Add all the rollback actions\n element.getModifications().addAll(modifications);\n element.setDescription(patchElement.getDescription());\n return element;\n }", "public static DMatrixRMaj triangularUpper(int dimen , int hessenberg , double min , double max , Random rand )\n {\n if( hessenberg < 0 )\n throw new RuntimeException(\"hessenberg must be more than or equal to 0\");\n\n double range = max-min;\n\n DMatrixRMaj A = new DMatrixRMaj(dimen,dimen);\n\n for( int i = 0; i < dimen; i++ ) {\n int start = i <= hessenberg ? 0 : i-hessenberg;\n\n for( int j = start; j < dimen; j++ ) {\n A.set(i,j, rand.nextDouble()*range+min);\n }\n\n }\n\n return A;\n }" ]
Returns true if the information in this link should take precedence over the information in the other link.
[ "public boolean overrides(Link other) {\n if (other.getStatus() == LinkStatus.ASSERTED &&\n status != LinkStatus.ASSERTED)\n return false;\n else if (status == LinkStatus.ASSERTED &&\n other.getStatus() != LinkStatus.ASSERTED)\n return true;\n\n // the two links are from equivalent sources of information, so we\n // believe the most recent\n\n return timestamp > other.getTimestamp();\n }" ]
[ "public String getHostAddress() {\n if( addr instanceof NbtAddress ) {\n return ((NbtAddress)addr).getHostAddress();\n }\n return ((InetAddress)addr).getHostAddress();\n }", "public static String getDefaultJdbcTypeFor(String javaType)\r\n {\r\n return _jdbcMappings.containsKey(javaType) ? (String)_jdbcMappings.get(javaType) : JDBC_DEFAULT_TYPE;\r\n }", "public static SQLService getInstance() throws Exception {\n if (_instance == null) {\n _instance = new SQLService();\n _instance.startServer();\n\n // default pool size is 20\n // can be overriden by env variable\n int dbPool = 20;\n if (Utils.getEnvironmentOptionValue(Constants.SYS_DATABASE_POOL_SIZE) != null) {\n dbPool = Integer.valueOf(Utils.getEnvironmentOptionValue(Constants.SYS_DATABASE_POOL_SIZE));\n }\n\n // initialize connection pool\n PoolProperties p = new PoolProperties();\n String connectString = \"jdbc:h2:tcp://\" + _instance.databaseHost + \":\" + String.valueOf(_instance.port) + \"/\" +\n _instance.databaseName + \"/proxydb;MULTI_THREADED=true;AUTO_RECONNECT=TRUE;AUTOCOMMIT=ON\";\n p.setUrl(connectString);\n p.setDriverClassName(\"org.h2.Driver\");\n p.setUsername(\"sa\");\n p.setJmxEnabled(true);\n p.setTestWhileIdle(false);\n p.setTestOnBorrow(true);\n p.setValidationQuery(\"SELECT 1\");\n p.setTestOnReturn(false);\n p.setValidationInterval(5000);\n p.setTimeBetweenEvictionRunsMillis(30000);\n p.setMaxActive(dbPool);\n p.setInitialSize(5);\n p.setMaxWait(30000);\n p.setRemoveAbandonedTimeout(60);\n p.setMinEvictableIdleTimeMillis(30000);\n p.setMinIdle(10);\n p.setLogAbandoned(true);\n p.setRemoveAbandoned(true);\n _instance.datasource = new DataSource();\n _instance.datasource.setPoolProperties(p);\n }\n return _instance;\n }", "void addSubsystem(final OperationTransformerRegistry registry, final String name, final ModelVersion version) {\n final OperationTransformerRegistry profile = registry.getChild(PathAddress.pathAddress(PROFILE));\n final OperationTransformerRegistry server = registry.getChild(PathAddress.pathAddress(HOST, SERVER));\n final PathAddress address = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, name));\n subsystem.mergeSubtree(profile, Collections.singletonMap(address, version));\n if(server != null) {\n subsystem.mergeSubtree(server, Collections.singletonMap(address, version));\n }\n }", "private int getDaysInRange(Date startDate, Date endDate)\n {\n int result;\n Calendar cal = DateHelper.popCalendar(endDate);\n int endDateYear = cal.get(Calendar.YEAR);\n int endDateDayOfYear = cal.get(Calendar.DAY_OF_YEAR);\n\n cal.setTime(startDate);\n\n if (endDateYear == cal.get(Calendar.YEAR))\n {\n result = (endDateDayOfYear - cal.get(Calendar.DAY_OF_YEAR)) + 1;\n }\n else\n {\n result = 0;\n do\n {\n result += (cal.getActualMaximum(Calendar.DAY_OF_YEAR) - cal.get(Calendar.DAY_OF_YEAR)) + 1;\n cal.roll(Calendar.YEAR, 1);\n cal.set(Calendar.DAY_OF_YEAR, 1);\n }\n while (cal.get(Calendar.YEAR) < endDateYear);\n result += endDateDayOfYear;\n }\n DateHelper.pushCalendar(cal);\n \n return result;\n }", "protected EObject forceCreateModelElementAndSet(Action action, EObject value) {\n \tEObject result = semanticModelBuilder.create(action.getType().getClassifier());\n \tsemanticModelBuilder.set(result, action.getFeature(), value, null /* ParserRule */, currentNode);\n \tinsertCompositeNode(action);\n \tassociateNodeWithAstElement(currentNode, result);\n \treturn result;\n }", "public static filterpolicy_binding get(nitro_service service, String name) throws Exception{\n\t\tfilterpolicy_binding obj = new filterpolicy_binding();\n\t\tobj.set_name(name);\n\t\tfilterpolicy_binding response = (filterpolicy_binding) obj.get_resource(service);\n\t\treturn response;\n\t}", "private static String guessDumpDate(String fileName) {\n\t\tPattern p = Pattern.compile(\"([0-9]{8})\");\n\t\tMatcher m = p.matcher(fileName);\n\n\t\tif (m.find()) {\n\t\t\treturn m.group(1);\n\t\t} else {\n\t\t\tlogger.info(\"Could not guess date of the dump file \\\"\" + fileName\n\t\t\t\t\t+ \"\\\". Defaulting to YYYYMMDD.\");\n\t\t\treturn \"YYYYMMDD\";\n\t\t}\n\t}", "CueList getCueList(int rekordboxId, CdjStatus.TrackSourceSlot slot, Client client)\n throws IOException {\n Message response = client.simpleRequest(Message.KnownType.CUE_LIST_REQ, null,\n client.buildRMST(Message.MenuIdentifier.DATA, slot), new NumberField(rekordboxId));\n if (response.knownType == Message.KnownType.CUE_LIST) {\n return new CueList(response);\n }\n logger.error(\"Unexpected response type when requesting cue list: {}\", response);\n return null;\n }" ]
create a new instance of class clazz. first use the public default constructor. If this fails also try to use protected an private constructors. @param clazz the class to instantiate @return the fresh instance of class clazz @throws InstantiationException
[ "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 result = ClassHelper.newInstance(clazz, true);\r\n }\r\n catch(Exception e1)\r\n {\r\n throw new ClassNotPersistenceCapableException(\"Can't instantiate class '\"\r\n + (clazz != null ? clazz.getName() : \"null\")\r\n + \"', message was: \" + e1.getMessage() + \")\", e1);\r\n }\r\n }\r\n return result;\r\n }" ]
[ "static String findNonProgressingOp(Resource resource, boolean forServer, long timeout) throws OperationFailedException {\n\n Resource.ResourceEntry nonProgressing = null;\n for (Resource.ResourceEntry child : resource.getChildren(ACTIVE_OPERATION)) {\n ModelNode model = child.getModel();\n if (model.get(EXCLUSIVE_RUNNING_TIME).asLong() > timeout) {\n nonProgressing = child;\n ControllerLogger.MGMT_OP_LOGGER.tracef(\"non-progressing op: %s\", nonProgressing.getModel());\n break;\n }\n }\n if (nonProgressing != null && !forServer) {\n // WFCORE-263\n // See if the op is non-progressing because it's the HC op waiting for commit\n // from the DC while other ops (i.e. ops proxied to our servers) associated\n // with the same domain-uuid are not completing\n ModelNode model = nonProgressing.getModel();\n if (model.get(DOMAIN_ROLLOUT).asBoolean()\n && OperationContext.ExecutionStatus.COMPLETING.toString().equals(model.get(EXECUTION_STATUS).asString())\n && model.hasDefined(DOMAIN_UUID)) {\n ControllerLogger.MGMT_OP_LOGGER.trace(\"Potential domain rollout issue\");\n String domainUUID = model.get(DOMAIN_UUID).asString();\n\n Set<String> relatedIds = null;\n List<Resource.ResourceEntry> relatedExecutingOps = null;\n for (Resource.ResourceEntry activeOp : resource.getChildren(ACTIVE_OPERATION)) {\n if (nonProgressing.getName().equals(activeOp.getName())) {\n continue; // ignore self\n }\n ModelNode opModel = activeOp.getModel();\n if (opModel.hasDefined(DOMAIN_UUID) && domainUUID.equals(opModel.get(DOMAIN_UUID).asString())\n && opModel.get(RUNNING_TIME).asLong() > timeout) {\n if (relatedIds == null) {\n relatedIds = new TreeSet<String>(); // order these as an aid to unit testing\n }\n relatedIds.add(activeOp.getName());\n\n // If the op is ExecutionStatus.EXECUTING that means it's still EXECUTING on the\n // server or a prepare message got lost. It would be COMPLETING if the server\n // had sent a prepare message, as that would result in ProxyStepHandler calling completeStep\n if (OperationContext.ExecutionStatus.EXECUTING.toString().equals(opModel.get(EXECUTION_STATUS).asString())) {\n if (relatedExecutingOps == null) {\n relatedExecutingOps = new ArrayList<Resource.ResourceEntry>();\n }\n relatedExecutingOps.add(activeOp);\n ControllerLogger.MGMT_OP_LOGGER.tracef(\"Related executing: %s\", opModel);\n } else ControllerLogger.MGMT_OP_LOGGER.tracef(\"Related non-executing: %s\", opModel);\n } else ControllerLogger.MGMT_OP_LOGGER.tracef(\"unrelated: %s\", opModel);\n }\n\n if (relatedIds != null) {\n // There are other ops associated with this domain-uuid that are also not completing\n // in the desired time, so we can't treat the one holding the lock as the problem.\n if (relatedExecutingOps != null && relatedExecutingOps.size() == 1) {\n // There's a single related op that's executing for too long. So we can report that one.\n // Note that it's possible that the same problem exists on other hosts as well\n // and that this cancellation will not resolve the overall problem. But, we only\n // get here on a slave HC and if the user is invoking this on a slave and not the\n // master, we'll assume they have a reason for doing that and want us to treat this\n // as a problem on this particular host.\n nonProgressing = relatedExecutingOps.get(0);\n } else {\n // Fail and provide a useful failure message.\n throw DomainManagementLogger.ROOT_LOGGER.domainRolloutNotProgressing(nonProgressing.getName(),\n timeout, domainUUID, relatedIds);\n }\n }\n }\n }\n\n return nonProgressing == null ? null : nonProgressing.getName();\n }", "public static void startAndWait(PersistentNode node, int maxWaitSec) {\n node.start();\n int waitTime = 0;\n try {\n while (node.waitForInitialCreate(1, TimeUnit.SECONDS) == false) {\n waitTime += 1;\n log.info(\"Waited \" + waitTime + \" sec for ephemeral node to be created\");\n if (waitTime > maxWaitSec) {\n throw new IllegalStateException(\"Failed to create ephemeral node\");\n }\n }\n } catch (InterruptedException e) {\n throw new IllegalStateException(e);\n }\n }", "public final PJsonArray getJSONArray(final String key) {\n final JSONArray val = this.obj.optJSONArray(key);\n if (val == null) {\n throw new ObjectMissingException(this, key);\n }\n return new PJsonArray(this, val, key);\n }", "public static long directorySize(File self) throws IOException, IllegalArgumentException\n {\n final long[] size = {0L};\n\n eachFileRecurse(self, FileType.FILES, new Closure<Void>(null) {\n public void doCall(Object[] args) {\n size[0] += ((File) args[0]).length();\n }\n });\n\n return size[0];\n }", "public static void main(String[] args) {\r\n Settings settings = new Settings();\r\n new JCommander(settings, args);\r\n\r\n if (!settings.isGuiSupressed()) {\r\n OkapiUI okapiUi = new OkapiUI();\r\n okapiUi.setVisible(true);\r\n } else {\r\n int returnValue;\r\n \r\n returnValue = commandLine(settings);\r\n \r\n if (returnValue != 0) {\r\n System.out.println(\"An error occurred\");\r\n }\r\n }\r\n }", "WaveformDetail getWaveformDetail(int rekordboxId, SlotReference slot, Client client)\n throws IOException {\n final NumberField idField = new NumberField(rekordboxId);\n\n // First try to get the NXS2-style color waveform if we are supposed to.\n if (preferColor.get()) {\n try {\n Message response = client.simpleRequest(Message.KnownType.ANLZ_TAG_REQ, Message.KnownType.ANLZ_TAG,\n client.buildRMST(Message.MenuIdentifier.MAIN_MENU, slot.slot), idField,\n new NumberField(Message.ANLZ_FILE_TAG_COLOR_WAVEFORM_DETAIL), new NumberField(Message.ALNZ_FILE_TYPE_EXT));\n return new WaveformDetail(new DataReference(slot, rekordboxId), response);\n } catch (Exception e) {\n logger.info(\"No color waveform available for slot \" + slot + \", id \" + rekordboxId + \"; requesting blue version.\", e);\n }\n }\n\n Message response = client.simpleRequest(Message.KnownType.WAVE_DETAIL_REQ, Message.KnownType.WAVE_DETAIL,\n client.buildRMST(Message.MenuIdentifier.MAIN_MENU, slot.slot), idField, NumberField.WORD_0);\n return new WaveformDetail(new DataReference(slot, rekordboxId), response);\n }", "public static int scale(Double factor, int pixel) {\n return rgb(\n (int) Math.round(factor * red(pixel)),\n (int) Math.round(factor * green(pixel)),\n (int) Math.round(factor * blue(pixel))\n );\n }", "public BoxFile.Info uploadLargeFile(InputStream inputStream, String fileName, long fileSize)\n throws InterruptedException, IOException {\n URL url = UPLOAD_SESSION_URL_TEMPLATE.build(this.getAPI().getBaseUploadURL());\n return new LargeFileUpload().\n upload(this.getAPI(), this.getID(), inputStream, url, fileName, fileSize);\n }", "protected float computeUniformPadding(final CacheDataSet cache) {\n float axisSize = getViewPortSize(getOrientationAxis());\n float totalPadding = axisSize - cache.getTotalSize();\n float uniformPadding = totalPadding > 0 && cache.count() > 1 ?\n totalPadding / (cache.count() - 1) : 0;\n return uniformPadding;\n }" ]
object -> xml @param object @param childClass
[ "public static String marshal(Object object) {\n if (object == null) {\n return null;\n }\n\n try {\n JAXBContext jaxbCtx = JAXBContext.newInstance(object.getClass());\n\n Marshaller marshaller = jaxbCtx.createMarshaller();\n marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);\n\n StringWriter sw = new StringWriter();\n marshaller.marshal(object, sw);\n\n return sw.toString();\n } catch (Exception e) {\n }\n\n return null;\n }" ]
[ "public void drawGeometry(Geometry geometry, SymbolInfo symbol, Color fillColor, Color strokeColor, float lineWidth,\n\t\t\tfloat[] dashArray, Rectangle clipRect) {\n\t\ttemplate.saveState();\n\t\t// clipping code\n\t\tif (clipRect != null) {\n\t\t\ttemplate.rectangle(clipRect.getLeft() + origX, clipRect.getBottom() + origY, clipRect.getWidth(), clipRect\n\t\t\t\t\t.getHeight());\n\t\t\ttemplate.clip();\n\t\t\ttemplate.newPath();\n\t\t}\n\t\tsetStroke(strokeColor, lineWidth, dashArray);\n\t\tsetFill(fillColor);\n\t\tdrawGeometry(geometry, symbol);\n\t\ttemplate.restoreState();\n\t}", "public static double[][] pseudoInverse(double[][] matrix){\n\t\tif(isSolverUseApacheCommonsMath) {\n\t\t\t// Use LU from common math\n\t\t\tSingularValueDecomposition svd = new SingularValueDecomposition(new Array2DRowRealMatrix(matrix));\n\t\t\tdouble[][] matrixInverse = svd.getSolver().getInverse().getData();\n\n\t\t\treturn matrixInverse;\n\t\t}\n\t\telse {\n\t\t\treturn org.jblas.Solve.pinv(new org.jblas.DoubleMatrix(matrix)).toArray2();\n\t\t}\n\t}", "public FailureDetectorConfig setCluster(Cluster cluster) {\n Utils.notNull(cluster);\n this.cluster = cluster;\n /*\n * FIXME: this is the hacky way to refresh the admin connection\n * verifier, but it'll just work. The clean way to do so is to have a\n * centralized metadata management, and all references of cluster object\n * point to that.\n */\n if(this.connectionVerifier instanceof AdminConnectionVerifier) {\n ((AdminConnectionVerifier) connectionVerifier).setCluster(cluster);\n }\n return this;\n }", "public List<Method> getMethodsFromGroupIds(int[] groupIds, String[] filters) throws Exception {\n ArrayList<Method> methods = new ArrayList<Method>();\n\n for (int groupId : groupIds) {\n methods.addAll(getMethodsFromGroupId(groupId, filters));\n }\n\n return methods;\n }", "protected void doConfigure() {\n if (config != null) {\n for (UserBean user : config.getUsersToCreate()) {\n setUser(user.getEmail(), user.getLogin(), user.getPassword());\n }\n getManagers().getUserManager().setAuthRequired(!config.isAuthenticationDisabled());\n }\n }", "public Set<String> postProcessingFields() {\n Set<String> fields = new LinkedHashSet<>();\n query.forEach(condition -> fields.addAll(condition.postProcessingFields()));\n sort.forEach(condition -> fields.addAll(condition.postProcessingFields()));\n return fields;\n }", "public FormAction setValuesInForm(Form form) {\r\n\t\tFormAction formAction = new FormAction();\r\n\t\tform.setFormAction(formAction);\r\n\t\tthis.forms.add(form);\r\n\t\treturn formAction;\r\n\t}", "public void setColorRange(int firstIndex, int lastIndex, int color) {\n\t\tfor (int i = firstIndex; i <= lastIndex; i++)\n\t\t\tmap[i] = color;\n\t}", "private void startRelayWithPortTollerance(HttpServer server, SslListener relay, int tries) throws Exception {\n if (tries >= 5) {\n throw new BindException(\"Unable to bind to several ports, most recently \" + relay.getPort() + \". Giving up\");\n }\n try {\n if (server.isStarted()) {\n relay.start();\n } else {\n throw new RuntimeException(\"Can't start SslRelay: server is not started (perhaps it was just shut down?)\");\n }\n } catch (BindException e) {\n // doh - the port is being used up, let's pick a new port\n LOG.info(\"Unable to bind to port %d, going to try port %d now\", relay.getPort(), relay.getPort() + 1);\n relay.setPort(relay.getPort() + 1);\n startRelayWithPortTollerance(server, relay, tries + 1);\n }\n }" ]
Converts Observable of page to Observable of Inner. @param <InnerT> type of inner. @param innerPage Page to be converted. @return Observable for list of inner.
[ "public static <InnerT> Observable<InnerT> convertPageToInnerAsync(Observable<Page<InnerT>> innerPage) {\n return innerPage.flatMap(new Func1<Page<InnerT>, Observable<InnerT>>() {\n @Override\n public Observable<InnerT> call(Page<InnerT> pageInner) {\n return Observable.from(pageInner.items());\n }\n });\n }" ]
[ "public int executeUpdate(String query) throws Exception {\n int returnVal = 0;\n Statement queryStatement = null;\n\n try (Connection sqlConnection = getConnection()) {\n queryStatement = sqlConnection.createStatement();\n returnVal = queryStatement.executeUpdate(query);\n } catch (Exception e) {\n } finally {\n try {\n if (queryStatement != null) {\n queryStatement.close();\n }\n } catch (Exception e) {\n }\n }\n\n return returnVal;\n }", "public WebSocketContext messageReceived(String receivedMessage) {\n this.stringMessage = S.string(receivedMessage).trim();\n isJson = stringMessage.startsWith(\"{\") || stringMessage.startsWith(\"]\");\n tryParseQueryParams();\n return this;\n }", "static GVRPickedObject makeHitMesh(long colliderPointer, float distance, float hitx, float hity, float hitz,\n int faceIndex, float barycentricx, float barycentricy, float barycentricz,\n float texu, float texv, float normalx, float normaly, float normalz)\n {\n GVRCollider collider = GVRCollider.lookup(colliderPointer);\n if (collider == null)\n {\n Log.d(TAG, \"makeHit: cannot find collider for %x\", colliderPointer);\n return null;\n }\n return new GVRPicker.GVRPickedObject(collider, new float[] { hitx, hity, hitz }, distance, faceIndex,\n new float[] {barycentricx, barycentricy, barycentricz},\n new float[]{ texu, texv },\n new float[]{normalx, normaly, normalz});\n }", "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 throw new IOException(\"Cannot write control file at '\" + output.getAbsolutePath() + \"'\");\n }\n\n final TarArchiveOutputStream outputStream = new TarArchiveOutputStream(new GZIPOutputStream(new FileOutputStream(output)));\n outputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);\n\n boolean foundConffiles = false;\n\n // create the final package control file out of the \"control\" file, copy all other files, ignore the directories\n for (File file : controlFiles) {\n if (file.isDirectory()) {\n // warn about the misplaced directory, except for directories ignored by default (.svn, cvs, etc)\n if (!isDefaultExcludes(file)) {\n console.warn(\"Found directory '\" + file + \"' in the control directory. Maybe you are pointing to wrong dir?\");\n }\n continue;\n }\n\n if (\"conffiles\".equals(file.getName())) {\n foundConffiles = true;\n }\n\n if (CONFIGURATION_FILENAMES.contains(file.getName()) || MAINTAINER_SCRIPTS.contains(file.getName())) {\n FilteredFile configurationFile = new FilteredFile(new FileInputStream(file), resolver);\n configurationFile.setOpenToken(openReplaceToken);\n configurationFile.setCloseToken(closeReplaceToken);\n addControlEntry(file.getName(), configurationFile.toString(), outputStream);\n\n } else if (!\"control\".equals(file.getName())) {\n // initialize the information stream to guess the type of the file\n InformationInputStream infoStream = new InformationInputStream(new FileInputStream(file));\n Utils.copy(infoStream, NullOutputStream.NULL_OUTPUT_STREAM);\n infoStream.close();\n\n // fix line endings for shell scripts\n InputStream in = new FileInputStream(file);\n if (infoStream.isShell() && !infoStream.hasUnixLineEndings()) {\n byte[] buf = Utils.toUnixLineEndings(in);\n in = new ByteArrayInputStream(buf);\n }\n\n addControlEntry(file.getName(), IOUtils.toString(in), outputStream);\n\n in.close();\n }\n }\n\n if (foundConffiles) {\n console.info(\"Found file 'conffiles' in the control directory. Skipping conffiles generation.\");\n } else if ((conffiles != null) && (conffiles.size() > 0)) {\n addControlEntry(\"conffiles\", createPackageConffilesFile(conffiles), outputStream);\n } else {\n console.info(\"Skipping 'conffiles' generation. No entries defined in maven/pom or ant/build.xml.\");\n }\n\n if (packageControlFile == null) {\n throw new FileNotFoundException(\"No 'control' file found in \" + controlFiles.toString());\n }\n\n addControlEntry(\"control\", packageControlFile.toString(), outputStream);\n addControlEntry(\"md5sums\", checksums.toString(), outputStream);\n\n outputStream.close();\n }", "public static tmtrafficpolicy_tmglobal_binding[] get(nitro_service service, String name) throws Exception{\n\t\ttmtrafficpolicy_tmglobal_binding obj = new tmtrafficpolicy_tmglobal_binding();\n\t\tobj.set_name(name);\n\t\ttmtrafficpolicy_tmglobal_binding response[] = (tmtrafficpolicy_tmglobal_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "public static void shutdownDomain(final ModelControllerClient client, final int timeout) throws IOException, OperationExecutionException {\n // Note the following two operations used to shutdown a domain don't seem to work well in a composite operation.\n // The operation occasionally sees a java.util.concurrent.CancellationException because the operation client\n // is likely closed before the AsyncFuture.get() is complete. Using a non-composite operation doesn't seem to\n // have this issue.\n\n // First shutdown the servers\n final ModelNode stopServersOp = Operations.createOperation(\"stop-servers\");\n stopServersOp.get(\"blocking\").set(true);\n stopServersOp.get(\"timeout\").set(timeout);\n ModelNode response = client.execute(stopServersOp);\n if (!Operations.isSuccessfulOutcome(response)) {\n throw new OperationExecutionException(\"Failed to stop servers.\", stopServersOp, response);\n }\n\n // Now shutdown the host\n final ModelNode address = determineHostAddress(client);\n final ModelNode shutdownOp = Operations.createOperation(\"shutdown\", address);\n response = client.execute(shutdownOp);\n if (Operations.isSuccessfulOutcome(response)) {\n // Wait until the process has died\n while (true) {\n if (isDomainRunning(client, true)) {\n try {\n TimeUnit.MILLISECONDS.sleep(20L);\n } catch (InterruptedException e) {\n LOGGER.trace(\"Interrupted during sleep\", e);\n }\n } else {\n break;\n }\n }\n } else {\n throw new OperationExecutionException(\"Failed to shutdown host.\", shutdownOp, response);\n }\n }", "public Date getStart()\n {\n Date result = (Date) getCachedValue(AssignmentField.START);\n if (result == null)\n {\n result = getTask().getStart();\n }\n return result;\n }", "public static void dumpAnalysisToFile(String outputDirName,\n String baseFileName,\n PartitionBalance partitionBalance) {\n if(outputDirName != null) {\n File outputDir = new File(outputDirName);\n if(!outputDir.exists()) {\n Utils.mkdirs(outputDir);\n }\n\n try {\n FileUtils.writeStringToFile(new File(outputDirName, baseFileName + \".analysis\"),\n partitionBalance.toString());\n } catch(IOException e) {\n logger.error(\"IOException during dumpAnalysisToFile: \" + e);\n }\n }\n }", "private int getCacheKey(InputDevice device, GVRControllerType controllerType) {\n if (controllerType != GVRControllerType.UNKNOWN &&\n controllerType != GVRControllerType.EXTERNAL) {\n // Sometimes a device shows up using two device ids\n // here we try to show both devices as one using the\n // product and vendor id\n\n int key = device.getVendorId();\n key = 31 * key + device.getProductId();\n key = 31 * key + controllerType.hashCode();\n\n return key;\n }\n return -1; // invalid key\n }" ]
Use this API to enable nsacl6 of given name.
[ "public static base_response enable(nitro_service client, String acl6name) throws Exception {\n\t\tnsacl6 enableresource = new nsacl6();\n\t\tenableresource.acl6name = acl6name;\n\t\treturn enableresource.perform_operation(client,\"enable\");\n\t}" ]
[ "public synchronized void removeControlPoint(ControlPoint controlPoint) {\n if (controlPoint.decreaseReferenceCount() == 0) {\n ControlPointIdentifier id = new ControlPointIdentifier(controlPoint.getDeployment(), controlPoint.getEntryPoint());\n entryPoints.remove(id);\n }\n }", "protected static void error(\n final HttpServletResponse httpServletResponse, final String message, final HttpStatus code) {\n try {\n httpServletResponse.setContentType(\"text/plain\");\n httpServletResponse.setStatus(code.value());\n setNoCache(httpServletResponse);\n try (PrintWriter out = httpServletResponse.getWriter()) {\n out.println(\"Error while processing request:\");\n out.println(message);\n }\n\n LOGGER.error(\"Error while processing request: {}\", message);\n } catch (IOException ex) {\n throw ExceptionUtils.getRuntimeException(ex);\n }\n }", "private boolean applyRemoteDomainModel(final List<ModelNode> bootOperations, final HostInfo hostInfo) {\n try {\n HostControllerLogger.ROOT_LOGGER.debug(\"Applying domain level boot operations provided by master\");\n SyncModelParameters parameters =\n new SyncModelParameters(domainController, ignoredDomainResourceRegistry,\n hostControllerEnvironment, extensionRegistry, operationExecutor, true, serverProxies, remoteFileRepository, contentRepository);\n final SyncDomainModelOperationHandler handler =\n new SyncDomainModelOperationHandler(hostInfo, parameters);\n final ModelNode operation = APPLY_DOMAIN_MODEL.clone();\n operation.get(DOMAIN_MODEL).set(bootOperations);\n\n final ModelNode result = operationExecutor.execute(OperationBuilder.create(operation).build(), OperationMessageHandler.DISCARD, ModelController.OperationTransactionControl.COMMIT, handler);\n\n final String outcome = result.get(OUTCOME).asString();\n final boolean success = SUCCESS.equals(outcome);\n\n // check if anything we synced triggered reload-required or restart-required.\n // if they did we log a warning on the synced slave.\n if (result.has(RESPONSE_HEADERS)) {\n final ModelNode headers = result.get(RESPONSE_HEADERS);\n if (headers.hasDefined(OPERATION_REQUIRES_RELOAD) && headers.get(OPERATION_REQUIRES_RELOAD).asBoolean()) {\n HostControllerLogger.ROOT_LOGGER.domainModelAppliedButReloadIsRequired();\n }\n if (headers.hasDefined(OPERATION_REQUIRES_RESTART) && headers.get(OPERATION_REQUIRES_RESTART).asBoolean()) {\n HostControllerLogger.ROOT_LOGGER.domainModelAppliedButRestartIsRequired();\n }\n }\n if (!success) {\n ModelNode failureDesc = result.hasDefined(FAILURE_DESCRIPTION) ? result.get(FAILURE_DESCRIPTION) : new ModelNode();\n HostControllerLogger.ROOT_LOGGER.failedToApplyDomainConfig(outcome, failureDesc);\n return false;\n } else {\n return true;\n }\n } catch (Exception e) {\n HostControllerLogger.ROOT_LOGGER.failedToApplyDomainConfig(e);\n return false;\n }\n }", "protected Class<?> loadClass(String clazz) throws ClassNotFoundException {\n\t\tif (this.classLoader == null){\n\t\t\treturn Class.forName(clazz);\n\t\t}\n\n\t\treturn Class.forName(clazz, true, this.classLoader);\n\n\t}", "public PhotoList<Photo> searchInterestingness(SearchParameters params, int perPage, int page) throws FlickrException {\r\n PhotoList<Photo> photos = new PhotoList<Photo>();\r\n\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_INTERESTINGNESS);\r\n\r\n parameters.putAll(params.getAsParameters());\r\n\r\n if (perPage > 0) {\r\n parameters.put(\"per_page\", Integer.toString(perPage));\r\n }\r\n if (page > 0) {\r\n parameters.put(\"page\", Integer.toString(page));\r\n }\r\n\r\n Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n Element photosElement = response.getPayload();\r\n photos.setPage(photosElement.getAttribute(\"page\"));\r\n photos.setPages(photosElement.getAttribute(\"pages\"));\r\n photos.setPerPage(photosElement.getAttribute(\"perpage\"));\r\n photos.setTotal(photosElement.getAttribute(\"total\"));\r\n\r\n NodeList photoNodes = photosElement.getElementsByTagName(\"photo\");\r\n for (int i = 0; i < photoNodes.getLength(); i++) {\r\n Element photoElement = (Element) photoNodes.item(i);\r\n Photo photo = new Photo();\r\n photo.setId(photoElement.getAttribute(\"id\"));\r\n\r\n User owner = new User();\r\n owner.setId(photoElement.getAttribute(\"owner\"));\r\n photo.setOwner(owner);\r\n\r\n photo.setSecret(photoElement.getAttribute(\"secret\"));\r\n photo.setServer(photoElement.getAttribute(\"server\"));\r\n photo.setFarm(photoElement.getAttribute(\"farm\"));\r\n photo.setTitle(photoElement.getAttribute(\"title\"));\r\n photo.setPublicFlag(\"1\".equals(photoElement.getAttribute(\"ispublic\")));\r\n photo.setFriendFlag(\"1\".equals(photoElement.getAttribute(\"isfriend\")));\r\n photo.setFamilyFlag(\"1\".equals(photoElement.getAttribute(\"isfamily\")));\r\n photos.add(photo);\r\n }\r\n return photos;\r\n }", "@Override\n public String printHelp() {\n List<CommandLineParser<CI>> parsers = getChildParsers();\n if (parsers != null && parsers.size() > 0) {\n StringBuilder sb = new StringBuilder();\n sb.append(processedCommand.printHelp(helpNames()))\n .append(Config.getLineSeparator())\n .append(processedCommand.name())\n .append(\" commands:\")\n .append(Config.getLineSeparator());\n\n int maxLength = 0;\n\n for (CommandLineParser child : parsers) {\n int length = child.getProcessedCommand().name().length();\n if (length > maxLength) {\n maxLength = length;\n }\n }\n\n for (CommandLineParser child : parsers) {\n sb.append(child.getFormattedCommand(4, maxLength + 2))\n .append(Config.getLineSeparator());\n }\n\n return sb.toString();\n }\n else\n return processedCommand.printHelp(helpNames());\n }", "private void readFormDataFromFile() {\n\t\tList<FormInput> formInputList =\n\t\t\t\tFormInputValueHelper.deserializeFormInputs(config.getSiteDir());\n\n\t\tif (formInputList != null) {\n\t\t\tInputSpecification inputSpecs = config.getCrawlRules().getInputSpecification();\n\n\t\t\tfor (FormInput input : formInputList) {\n\t\t\t\tinputSpecs.inputField(input);\n\t\t\t}\n\t\t}\n\t}", "public InsertBuilder set(String column, String value) {\n columns.add(column);\n values.add(value);\n return this;\n }", "@Override\n public void removeStorageEngine(StorageEngine<ByteArray, byte[], byte[]> engine) {\n String storeName = engine.getName();\n BdbStorageEngine bdbEngine = (BdbStorageEngine) engine;\n\n synchronized(lock) {\n\n // Only cleanup the environment if it is per store. We cannot\n // cleanup a shared 'Environment' object\n if(useOneEnvPerStore) {\n\n Environment environment = this.environments.get(storeName);\n if(environment == null) {\n // Nothing to clean up.\n return;\n }\n\n // Remove from the set of unreserved stores if needed.\n if(this.unreservedStores.remove(environment)) {\n logger.info(\"Removed environment for store name: \" + storeName\n + \" from unreserved stores\");\n } else {\n logger.info(\"No environment found in unreserved stores for store name: \"\n + storeName);\n }\n\n // Try to delete the BDB directory associated\n File bdbDir = environment.getHome();\n if(bdbDir.exists() && bdbDir.isDirectory()) {\n String bdbDirPath = bdbDir.getPath();\n try {\n FileUtils.deleteDirectory(bdbDir);\n logger.info(\"Successfully deleted BDB directory : \" + bdbDirPath\n + \" for store name: \" + storeName);\n } catch(IOException e) {\n logger.error(\"Unable to delete BDB directory: \" + bdbDirPath\n + \" for store name: \" + storeName);\n }\n }\n\n // Remove the reference to BdbEnvironmentStats, which holds a\n // reference to the Environment\n BdbEnvironmentStats bdbEnvStats = bdbEngine.getBdbEnvironmentStats();\n this.aggBdbStats.unTrackEnvironment(bdbEnvStats);\n\n // Unregister the JMX bean for Environment\n if(voldemortConfig.isJmxEnabled()) {\n ObjectName name = JmxUtils.createObjectName(JmxUtils.getPackageName(bdbEnvStats.getClass()),\n storeName);\n // Un-register the environment stats mbean\n JmxUtils.unregisterMbean(name);\n }\n\n // Cleanup the environment\n environment.close();\n this.environments.remove(storeName);\n logger.info(\"Successfully closed the environment for store name : \" + storeName);\n\n }\n }\n }" ]
performs an UPDATE operation against RDBMS. @param obj The Object to be updated in the underlying table. @param cld ClassDescriptor providing mapping information.
[ "public void executeUpdate(ClassDescriptor cld, Object obj) throws PersistenceBrokerException\r\n {\r\n if (logger.isDebugEnabled())\r\n {\r\n logger.debug(\"executeUpdate: \" + obj);\r\n }\r\n\r\n // obj with nothing but key fields is not updated\r\n if (cld.getNonPkRwFields().length == 0)\r\n {\r\n return;\r\n }\r\n\r\n final StatementManagerIF sm = broker.serviceStatementManager();\r\n PreparedStatement stmt = null;\r\n // BRJ: preserve current locking values\r\n // locking values will be restored in case of exception\r\n ValueContainer[] oldLockingValues;\r\n oldLockingValues = cld.getCurrentLockingValues(obj);\r\n try\r\n {\r\n stmt = sm.getUpdateStatement(cld);\r\n if (stmt == null)\r\n {\r\n logger.error(\"getUpdateStatement returned a null statement\");\r\n throw new PersistenceBrokerException(\"getUpdateStatement returned a null statement\");\r\n }\r\n\r\n sm.bindUpdate(stmt, cld, obj);\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"executeUpdate: \" + stmt);\r\n\r\n if ((stmt.executeUpdate() == 0) && cld.isLocking()) //BRJ\r\n {\r\n /**\r\n * Kuali Foundation modification -- 6/19/2009\r\n */\r\n \tString objToString = \"\";\r\n \ttry {\r\n \t\tobjToString = obj.toString();\r\n \t} catch (Exception ex) {}\r\n throw new OptimisticLockException(\"Object has been modified by someone else: \" + objToString, obj);\r\n /**\r\n * End of Kuali Foundation modification\r\n */\r\n }\r\n\r\n // Harvest any return values.\r\n harvestReturnValues(cld.getUpdateProcedure(), obj, stmt);\r\n }\r\n catch (OptimisticLockException e)\r\n {\r\n // Don't log as error\r\n if (logger.isDebugEnabled())\r\n logger.debug(\r\n \"OptimisticLockException during the execution of update: \" + e.getMessage(),\r\n e);\r\n throw e;\r\n }\r\n catch (PersistenceBrokerException e)\r\n {\r\n // BRJ: restore old locking values\r\n setLockingValues(cld, obj, oldLockingValues);\r\n\r\n logger.error(\r\n \"PersistenceBrokerException during the execution of the update: \" + e.getMessage(),\r\n e);\r\n throw e;\r\n }\r\n catch (SQLException e)\r\n {\r\n final String sql = broker.serviceSqlGenerator().getPreparedUpdateStatement(cld).getStatement();\r\n throw ExceptionHelper.generateException(e, sql, cld, logger, obj);\r\n }\r\n finally\r\n {\r\n sm.closeResources(stmt, null);\r\n }\r\n }" ]
[ "static void onActivityCreated(Activity activity) {\n // make sure we have at least the default instance created here.\n if (instances == null) {\n CleverTapAPI.createInstanceIfAvailable(activity, null);\n }\n\n if (instances == null) {\n Logger.v(\"Instances is null in onActivityCreated!\");\n return;\n }\n\n boolean alreadyProcessedByCleverTap = false;\n Bundle notification = null;\n Uri deepLink = null;\n String _accountId = null;\n\n // check for launch deep link\n try {\n Intent intent = activity.getIntent();\n deepLink = intent.getData();\n if (deepLink != null) {\n Bundle queryArgs = UriHelper.getAllKeyValuePairs(deepLink.toString(), true);\n _accountId = queryArgs.getString(Constants.WZRK_ACCT_ID_KEY);\n }\n } catch (Throwable t) {\n // Ignore\n }\n\n // check for launch via notification click\n try {\n notification = activity.getIntent().getExtras();\n if (notification != null && !notification.isEmpty()) {\n try {\n alreadyProcessedByCleverTap = (notification.containsKey(Constants.WZRK_FROM_KEY) && Constants.WZRK_FROM.equals(notification.get(Constants.WZRK_FROM_KEY)));\n if (alreadyProcessedByCleverTap){\n Logger.v(\"ActivityLifecycleCallback: Notification Clicked already processed for \"+ notification.toString() +\", dropping duplicate.\");\n }\n if (notification.containsKey(Constants.WZRK_ACCT_ID_KEY)) {\n _accountId = (String) notification.get(Constants.WZRK_ACCT_ID_KEY);\n }\n } catch (Throwable t) {\n // no-op\n }\n }\n } catch (Throwable t) {\n // Ignore\n }\n\n if (alreadyProcessedByCleverTap && deepLink == null) return;\n\n for (String accountId: CleverTapAPI.instances.keySet()) {\n CleverTapAPI instance = CleverTapAPI.instances.get(accountId);\n\n boolean shouldProcess = false;\n if (instance != null) {\n shouldProcess = (_accountId == null && instance.config.isDefaultInstance()) || instance.getAccountId().equals(_accountId);\n }\n\n if (shouldProcess) {\n if (notification != null && !notification.isEmpty() && notification.containsKey(Constants.NOTIFICATION_TAG)) {\n instance.pushNotificationClickedEvent(notification);\n }\n\n if (deepLink != null) {\n try {\n instance.pushDeepLink(deepLink);\n } catch (Throwable t) {\n // no-op\n }\n }\n break;\n }\n }\n }", "@NotNull\n static MetaTreeImpl.Proto saveMetaTree(@NotNull final ITreeMutable metaTree,\n @NotNull final EnvironmentImpl env,\n @NotNull final ExpiredLoggableCollection expired) {\n final long newMetaTreeAddress = metaTree.save();\n final Log log = env.getLog();\n final int lastStructureId = env.getLastStructureId();\n final long dbRootAddress = log.write(DatabaseRoot.DATABASE_ROOT_TYPE, Loggable.NO_STRUCTURE_ID,\n DatabaseRoot.asByteIterable(newMetaTreeAddress, lastStructureId));\n expired.add(dbRootAddress, (int) (log.getWrittenHighAddress() - dbRootAddress));\n return new MetaTreeImpl.Proto(newMetaTreeAddress, dbRootAddress);\n }", "public Iterable<BoxLegalHoldAssignment.Info> getAssignments(String type, String id, int limit, String ... fields) {\n QueryStringBuilder builder = new QueryStringBuilder();\n if (type != null) {\n builder.appendParam(\"assign_to_type\", type);\n }\n if (id != null) {\n builder.appendParam(\"assign_to_id\", id);\n }\n if (fields.length > 0) {\n builder.appendParam(\"fields\", fields);\n }\n return new BoxResourceIterable<BoxLegalHoldAssignment.Info>(\n this.getAPI(), LEGAL_HOLD_ASSIGNMENTS_URL_TEMPLATE.buildWithQuery(\n this.getAPI().getBaseURL(), builder.toString(), this.getID()), limit) {\n\n @Override\n protected BoxLegalHoldAssignment.Info factory(JsonObject jsonObject) {\n BoxLegalHoldAssignment assignment = new BoxLegalHoldAssignment(\n BoxLegalHoldPolicy.this.getAPI(), jsonObject.get(\"id\").asString());\n return assignment.new Info(jsonObject);\n }\n };\n }", "public static LinearSolverDense<DMatrixRMaj> symmPosDef(int matrixWidth ) {\n if(matrixWidth < EjmlParameters.SWITCH_BLOCK64_CHOLESKY ) {\n CholeskyDecompositionCommon_DDRM decomp = new CholeskyDecompositionInner_DDRM(true);\n return new LinearSolverChol_DDRM(decomp);\n } else {\n if( EjmlParameters.MEMORY == EjmlParameters.MemoryUsage.FASTER )\n return new LinearSolverChol_DDRB();\n else {\n CholeskyDecompositionCommon_DDRM decomp = new CholeskyDecompositionInner_DDRM(true);\n return new LinearSolverChol_DDRM(decomp);\n }\n }\n }", "void updateFromResponseOnPutPatch(Response<ResponseBody> response) throws CloudException, IOException {\n String responseContent = null;\n if (response.body() != null) {\n responseContent = response.body().string();\n response.body().close();\n }\n\n if (responseContent == null || responseContent.isEmpty()) {\n throw new CloudException(\"polling response does not contain a valid body\", response);\n }\n\n PollingResource resource = serializerAdapter.deserialize(responseContent, PollingResource.class);\n final int statusCode = response.code();\n if (resource != null && resource.properties != null && resource.properties.provisioningState != null) {\n this.withStatus(resource.properties.provisioningState, statusCode);\n } else {\n this.withStatus(AzureAsyncOperation.SUCCESS_STATUS, statusCode);\n }\n\n CloudError error = new CloudError();\n this.withErrorBody(error);\n error.withCode(this.status());\n error.withMessage(\"Long running operation failed\");\n this.withResponse(response);\n this.withResource(serializerAdapter.<T>deserialize(responseContent, resourceType));\n }", "public void identifyNode(int nodeId) throws SerialInterfaceException {\n\t\tSerialMessage newMessage = new SerialMessage(nodeId, SerialMessage.SerialMessageClass.IdentifyNode, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.IdentifyNode, SerialMessage.SerialMessagePriority.High);\n \tbyte[] newPayload = { (byte) nodeId };\n \tnewMessage.setMessagePayload(newPayload);\n \tthis.enqueue(newMessage);\n\t}", "public List<CmsCategory> getLeafItems() {\n\n List<CmsCategory> result = new ArrayList<CmsCategory>();\n if (m_categories.isEmpty()) {\n return result;\n }\n Iterator<CmsCategory> it = m_categories.iterator();\n CmsCategory current = it.next();\n while (it.hasNext()) {\n CmsCategory next = it.next();\n if (!next.getPath().startsWith(current.getPath())) {\n result.add(current);\n }\n current = next;\n }\n result.add(current);\n return result;\n }", "public Where<T, ID> exists(QueryBuilder<?, ?> subQueryBuilder) {\n\t\t// we do this to turn off the automatic addition of the ID column in the select column list\n\t\tsubQueryBuilder.enableInnerQuery();\n\t\taddClause(new Exists(new InternalQueryBuilderWrapper(subQueryBuilder)));\n\t\treturn this;\n\t}", "public Map<String, String> getParams() {\n\n Map<String, String> params = new HashMap<>(1);\n params.put(PARAM_COLLAPSED, Boolean.TRUE.toString());\n return params;\n }" ]
Performs a request against a Stitch app server determined by the deployment model of the underlying app. Throws a Stitch specific exception if the request fails. @param stitchReq the request to perform. @return a {@link Response} to the request.
[ "@Override\n public Response doRequest(final StitchRequest stitchReq) {\n initAppMetadata(clientAppId);\n\n return super.doRequestUrl(stitchReq, getHostname());\n }" ]
[ "public void updatePathOrder(int profileId, int[] pathOrder) {\n for (int i = 0; i < pathOrder.length; i++) {\n EditService.updatePathTable(Constants.PATH_PROFILE_PATH_ORDER, (i + 1), pathOrder[i]);\n }\n }", "public static String get(MessageKey key) {\n return data.getProperty(key.toString(), key.toString());\n }", "public static base_response update(nitro_service client, vserver resource) throws Exception {\n\t\tvserver updateresource = new vserver();\n\t\tupdateresource.name = resource.name;\n\t\tupdateresource.backupvserver = resource.backupvserver;\n\t\tupdateresource.redirecturl = resource.redirecturl;\n\t\tupdateresource.cacheable = resource.cacheable;\n\t\tupdateresource.clttimeout = resource.clttimeout;\n\t\tupdateresource.somethod = resource.somethod;\n\t\tupdateresource.sopersistence = resource.sopersistence;\n\t\tupdateresource.sopersistencetimeout = resource.sopersistencetimeout;\n\t\tupdateresource.sothreshold = resource.sothreshold;\n\t\tupdateresource.pushvserver = resource.pushvserver;\n\t\treturn updateresource.update_resource(client);\n\t}", "public static synchronized void addCachedDatabaseConfigs(Collection<DatabaseTableConfig<?>> configs) {\n\t\tMap<Class<?>, DatabaseTableConfig<?>> newMap;\n\t\tif (configMap == null) {\n\t\t\tnewMap = new HashMap<Class<?>, DatabaseTableConfig<?>>();\n\t\t} else {\n\t\t\tnewMap = new HashMap<Class<?>, DatabaseTableConfig<?>>(configMap);\n\t\t}\n\t\tfor (DatabaseTableConfig<?> config : configs) {\n\t\t\tnewMap.put(config.getDataClass(), config);\n\t\t\tlogger.info(\"Loaded configuration for {}\", config.getDataClass());\n\t\t}\n\t\tconfigMap = newMap;\n\t}", "public MapBounds getRotatedBoundsAdjustedForPreciseRotatedMapSize() {\n Rectangle2D.Double paintAreaPrecise = getRotatedMapSizePrecise();\n Rectangle paintArea = new Rectangle(MapfishMapContext.rectangleDoubleToDimension(paintAreaPrecise));\n return getRotatedBounds(paintAreaPrecise, paintArea);\n }", "public static final Date getTime(byte[] data, int offset)\n {\n int time = getShort(data, offset) / 10;\n Calendar cal = DateHelper.popCalendar(EPOCH_DATE);\n cal.set(Calendar.HOUR_OF_DAY, (time / 60));\n cal.set(Calendar.MINUTE, (time % 60));\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n DateHelper.pushCalendar(cal);\n return (cal.getTime());\n }", "private static <T, ID> void addDropTableStatements(DatabaseType databaseType, TableInfo<T, ID> tableInfo,\n\t\t\tList<String> statements, boolean logDetails) {\n\t\tList<String> statementsBefore = new ArrayList<String>();\n\t\tList<String> statementsAfter = new ArrayList<String>();\n\t\tfor (FieldType fieldType : tableInfo.getFieldTypes()) {\n\t\t\tdatabaseType.dropColumnArg(fieldType, statementsBefore, statementsAfter);\n\t\t}\n\t\tStringBuilder sb = new StringBuilder(64);\n\t\tif (logDetails) {\n\t\t\tlogger.info(\"dropping table '{}'\", tableInfo.getTableName());\n\t\t}\n\t\tsb.append(\"DROP TABLE \");\n\t\tdatabaseType.appendEscapedEntityName(sb, tableInfo.getTableName());\n\t\tsb.append(' ');\n\t\tstatements.addAll(statementsBefore);\n\t\tstatements.add(sb.toString());\n\t\tstatements.addAll(statementsAfter);\n\t}", "public static void waitForStandalone(final ModelControllerClient client, final long startupTimeout)\n throws InterruptedException, RuntimeException, TimeoutException {\n waitForStandalone(null, client, startupTimeout);\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.put(payload);\n return new DatagramPacket(content.array(), content.capacity());\n }" ]
Computes the rank of a matrix using the specified tolerance. @param A Matrix whose rank is to be calculated. Not modified. @param threshold The numerical threshold used to determine a singular value. @return The matrix's rank.
[ "public static int rank(DMatrixRMaj A , double threshold ) {\n SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(A.numRows,A.numCols,false,false,true);\n\n if( svd.inputModified() )\n A = A.copy();\n\n if( !svd.decompose(A) )\n throw new RuntimeException(\"Decomposition failed\");\n\n return SingularOps_DDRM.rank(svd, threshold);\n }" ]
[ "public static clusterinstance get(nitro_service service, Long clid) throws Exception{\n\t\tclusterinstance obj = new clusterinstance();\n\t\tobj.set_clid(clid);\n\t\tclusterinstance response = (clusterinstance) obj.get_resource(service);\n\t\treturn response;\n\t}", "private static Map<String, ServerGroupDeploymentPlanResult> buildServerGroupResults(Map<UUID, DeploymentActionResult> deploymentActionResults) {\n Map<String, ServerGroupDeploymentPlanResult> serverGroupResults = new HashMap<String, ServerGroupDeploymentPlanResult>();\n\n for (Map.Entry<UUID, DeploymentActionResult> entry : deploymentActionResults.entrySet()) {\n\n UUID actionId = entry.getKey();\n DeploymentActionResult actionResult = entry.getValue();\n\n Map<String, ServerGroupDeploymentActionResult> actionResultsByServerGroup = actionResult.getResultsByServerGroup();\n for (ServerGroupDeploymentActionResult serverGroupActionResult : actionResultsByServerGroup.values()) {\n String serverGroupName = serverGroupActionResult.getServerGroupName();\n\n ServerGroupDeploymentPlanResultImpl sgdpr = (ServerGroupDeploymentPlanResultImpl) serverGroupResults.get(serverGroupName);\n if (sgdpr == null) {\n sgdpr = new ServerGroupDeploymentPlanResultImpl(serverGroupName);\n serverGroupResults.put(serverGroupName, sgdpr);\n }\n\n for (Map.Entry<String, ServerUpdateResult> serverEntry : serverGroupActionResult.getResultByServer().entrySet()) {\n String serverName = serverEntry.getKey();\n ServerUpdateResult sud = serverEntry.getValue();\n ServerDeploymentPlanResultImpl sdpr = (ServerDeploymentPlanResultImpl) sgdpr.getServerResult(serverName);\n if (sdpr == null) {\n sdpr = new ServerDeploymentPlanResultImpl(serverName);\n sgdpr.storeServerResult(serverName, sdpr);\n }\n sdpr.storeServerUpdateResult(actionId, sud);\n }\n }\n }\n return serverGroupResults;\n }", "public static int findLastIndexOf(Object self, int startIndex, Closure closure) {\n int result = -1;\n int i = 0;\n BooleanClosureWrapper bcw = new BooleanClosureWrapper(closure);\n for (Iterator iter = InvokerHelper.asIterator(self); iter.hasNext(); i++) {\n Object value = iter.next();\n if (i < startIndex) {\n continue;\n }\n if (bcw.call(value)) {\n result = i;\n }\n }\n return result;\n }", "public static Variable deserialize(String s,\n VariableType variableType,\n List<String> dataTypes) {\n Variable var = new Variable(variableType);\n String[] varParts = s.split(\":\");\n if (varParts.length > 0) {\n String name = varParts[0];\n if (!name.isEmpty()) {\n var.setName(name);\n if (varParts.length == 2) {\n String dataType = varParts[1];\n if (!dataType.isEmpty()) {\n if (dataTypes != null && dataTypes.contains(dataType)) {\n var.setDataType(dataType);\n } else {\n var.setCustomDataType(dataType);\n }\n }\n }\n }\n }\n return var;\n }", "@PostConstruct\n\tprotected void postConstruct() throws GeomajasException {\n\t\tif (null == baseTmsUrl) {\n\t\t\tthrow new GeomajasException(ExceptionCode.PARAMETER_MISSING, \"baseTmsUrl\");\n\t\t}\n\n\t\t// Make sure we have a base URL we can work with:\n\t\tif ((baseTmsUrl.startsWith(\"http://\") || baseTmsUrl.startsWith(\"https://\")) && !baseTmsUrl.endsWith(\"/\")) {\n\t\t\tbaseTmsUrl += \"/\";\n\t\t}\n\n\t\t// Make sure there is a correct RasterLayerInfo object:\n\t\tif (layerInfo == null || layerInfo == UNUSABLE_LAYER_INFO) {\n\t\t\ttry {\n\t\t\t\ttileMap = configurationService.getCapabilities(this);\n\t\t\t\tversion = tileMap.getVersion();\n\t\t\t\textension = tileMap.getTileFormat().getExtension();\n\t\t\t\tlayerInfo = configurationService.asLayerInfo(tileMap);\n\t\t\t\tusable = true;\n\t\t\t} catch (TmsLayerException e) {\n\t\t\t\t// a layer needs an info object to keep the DtoConfigurationPostProcessor happy !\n\t\t\t\tlayerInfo = UNUSABLE_LAYER_INFO;\n\t\t\t\tusable = false;\n\t\t\t\tlog.warn(\"The layer could not be correctly initialized: \" + getId(), e);\n\t\t\t}\n\t\t} else if (extension == null) {\n\t\t\tthrow new GeomajasException(ExceptionCode.PARAMETER_MISSING, \"extension\");\n\t\t}\n\n\t\tif (layerInfo != null) {\n\t\t\t// Finally prepare some often needed values:\n\t\t\tstate = new TileServiceState(geoService, layerInfo);\n\t\t\t// when proxying the real url will be resolved later on, just use a simple one for now\n\t\t\tboolean proxying = useCache || useProxy || null != authentication;\n\t\t\tif (tileMap != null && !proxying) {\n\t\t\t\turlBuilder = new TileMapUrlBuilder(tileMap);\n\t\t\t} else {\n\t\t\t\turlBuilder = new SimpleTmsUrlBuilder(extension);\n\t\t\t}\n\t\t}\n\t}", "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 Where<T, ID> isNull(String columnName) throws SQLException {\n\t\taddClause(new IsNull(columnName, findColumnFieldType(columnName)));\n\t\treturn this;\n\t}", "public static String getButtonName(String gallery) {\n\n StringBuffer sb = new StringBuffer(GUI_BUTTON_PREF);\n sb.append(gallery.toUpperCase());\n sb.append(GUI_BUTTON_SUF);\n return sb.toString();\n }", "public static boolean isClosureDeclaration(ASTNode expression) {\r\n if (expression instanceof DeclarationExpression) {\r\n if (((DeclarationExpression) expression).getRightExpression() instanceof ClosureExpression) {\r\n return true;\r\n }\r\n }\r\n if (expression instanceof FieldNode) {\r\n ClassNode type = ((FieldNode) expression).getType();\r\n if (AstUtil.classNodeImplementsType(type, Closure.class)) {\r\n return true;\r\n } else if (((FieldNode) expression).getInitialValueExpression() instanceof ClosureExpression) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }" ]
Preloads a sound file. @param soundFile path/name of the file to be played.
[ "public void load(String soundFile)\n {\n if (mSoundFile != null)\n {\n unload();\n }\n mSoundFile = soundFile;\n if (mAudioListener != null)\n {\n mAudioListener.getAudioEngine().preloadSoundFile(soundFile);\n Log.d(\"SOUND\", \"loaded audio file %s\", getSoundFile());\n }\n }" ]
[ "public FilePath getModuleRoot(Map<String, String> globalEnv) throws IOException, InterruptedException {\n FilePath someWorkspace = project.getSomeWorkspace();\n if (someWorkspace == null) {\n throw new IllegalStateException(\"Couldn't find workspace\");\n }\n\n Map<String, String> workspaceEnv = Maps.newHashMap();\n workspaceEnv.put(\"WORKSPACE\", someWorkspace.getRemote());\n\n for (Builder builder : getBuilders()) {\n if (builder instanceof Gradle) {\n Gradle gradleBuilder = (Gradle) builder;\n String rootBuildScriptDir = gradleBuilder.getRootBuildScriptDir();\n if (rootBuildScriptDir != null && rootBuildScriptDir.trim().length() != 0) {\n String rootBuildScriptNormalized = Util.replaceMacro(rootBuildScriptDir.trim(), workspaceEnv);\n rootBuildScriptNormalized = Util.replaceMacro(rootBuildScriptNormalized, globalEnv);\n return new FilePath(someWorkspace, rootBuildScriptNormalized);\n } else {\n return someWorkspace;\n }\n }\n }\n\n throw new IllegalArgumentException(\"Couldn't find Gradle builder in the current builders list\");\n }", "private <T> void add(EjbDescriptor<T> ejbDescriptor) {\n InternalEjbDescriptor<T> internalEjbDescriptor = InternalEjbDescriptor.of(ejbDescriptor);\n ejbByName.put(ejbDescriptor.getEjbName(), internalEjbDescriptor);\n ejbByClass.put(ejbDescriptor.getBeanClass(), internalEjbDescriptor.getEjbName());\n }", "public static EventLog getEnterpriseEvents(BoxAPIConnection api, Date after, Date before, BoxEvent.Type... types) {\n return getEnterpriseEvents(api, null, after, before, ENTERPRISE_LIMIT, types);\n }", "public final PJsonArray optJSONArray(final String key, final PJsonArray defaultValue) {\n PJsonArray result = optJSONArray(key);\n return result != null ? result : defaultValue;\n }", "private void populateRelation(TaskField field, Task sourceTask, String relationship) throws MPXJException\n {\n int index = 0;\n int length = relationship.length();\n\n //\n // Extract the identifier\n //\n while ((index < length) && (Character.isDigit(relationship.charAt(index)) == true))\n {\n ++index;\n }\n\n Integer taskID;\n try\n {\n taskID = Integer.valueOf(relationship.substring(0, index));\n }\n\n catch (NumberFormatException ex)\n {\n throw new MPXJException(MPXJException.INVALID_FORMAT + \" '\" + relationship + \"'\");\n }\n\n //\n // Now find the task, so we can extract the unique ID\n //\n Task targetTask;\n if (field == TaskField.PREDECESSORS)\n {\n targetTask = m_projectFile.getTaskByID(taskID);\n }\n else\n {\n targetTask = m_projectFile.getTaskByUniqueID(taskID);\n }\n\n //\n // If we haven't reached the end, we next expect to find\n // SF, SS, FS, FF\n //\n RelationType type = null;\n Duration lag = null;\n\n if (index == length)\n {\n type = RelationType.FINISH_START;\n lag = Duration.getInstance(0, TimeUnit.DAYS);\n }\n else\n {\n if ((index + 1) == length)\n {\n throw new MPXJException(MPXJException.INVALID_FORMAT + \" '\" + relationship + \"'\");\n }\n\n type = RelationTypeUtility.getInstance(m_locale, relationship.substring(index, index + 2));\n\n index += 2;\n\n if (index == length)\n {\n lag = Duration.getInstance(0, TimeUnit.DAYS);\n }\n else\n {\n if (relationship.charAt(index) == '+')\n {\n ++index;\n }\n\n lag = DurationUtility.getInstance(relationship.substring(index), m_formats.getDurationDecimalFormat(), m_locale);\n }\n }\n\n if (type == null)\n {\n throw new MPXJException(MPXJException.INVALID_FORMAT + \" '\" + relationship + \"'\");\n }\n\n // We have seen at least one example MPX file where an invalid task ID\n // is present. We'll ignore this as the schedule is otherwise valid.\n if (targetTask != null)\n {\n Relation relation = sourceTask.addPredecessor(targetTask, type, lag);\n m_eventManager.fireRelationReadEvent(relation);\n }\n }", "public boolean removeWriter(Object key, Object resourceId)\r\n {\r\n boolean result = false;\r\n ObjectLocks objectLocks = null;\r\n synchronized(locktable)\r\n {\r\n objectLocks = (ObjectLocks) locktable.get(resourceId);\r\n if(objectLocks != null)\r\n {\r\n /**\r\n * MBAIRD, last one out, close the door and turn off the lights.\r\n * if no locks (readers or writers) exist for this object, let's remove\r\n * it from the locktable.\r\n */\r\n LockEntry entry = objectLocks.getWriter();\r\n if(entry != null && entry.isOwnedBy(key))\r\n {\r\n objectLocks.setWriter(null);\r\n result = true;\r\n\r\n // no need to check if writer is null, we just set it.\r\n if(objectLocks.getReaders().size() == 0)\r\n {\r\n locktable.remove(resourceId);\r\n }\r\n }\r\n }\r\n }\r\n return result;\r\n }", "private void readTaskExtendedAttributes(Project.Tasks.Task xml, Task mpx)\n {\n for (Project.Tasks.Task.ExtendedAttribute attrib : xml.getExtendedAttribute())\n {\n int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF;\n TaskField mpxFieldID = MPPTaskField.getInstance(xmlFieldID);\n TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null);\n DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat);\n }\n }", "public static Class<?> getRawType(Type type) {\n\t\tif (type instanceof Class) {\n\t\t\treturn (Class<?>) type;\n\t\t} else if (type instanceof ParameterizedType) {\n\t\t\tParameterizedType actualType = (ParameterizedType) type;\n\t\t\treturn getRawType(actualType.getRawType());\n\t\t} else if (type instanceof GenericArrayType) {\n\t\t\tGenericArrayType genericArrayType = (GenericArrayType) type;\n\t\t\tObject rawArrayType = Array.newInstance(getRawType(genericArrayType\n\t\t\t\t\t.getGenericComponentType()), 0);\n\t\t\treturn rawArrayType.getClass();\n\t\t} else if (type instanceof WildcardType) {\n\t\t\tWildcardType castedType = (WildcardType) type;\n\t\t\treturn getRawType(castedType.getUpperBounds()[0]);\n\t\t} else {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"Type \\'\"\n\t\t\t\t\t\t\t+ type\n\t\t\t\t\t\t\t+ \"\\' is not a Class, \"\n\t\t\t\t\t\t\t+ \"ParameterizedType, or GenericArrayType. Can't extract class.\");\n\t\t}\n\t}", "public CodePage getCodePage(int field)\n {\n CodePage result;\n\n if ((field < m_fields.length) && (m_fields[field].length() != 0))\n {\n result = CodePage.getInstance(m_fields[field]);\n }\n else\n {\n result = CodePage.getInstance(null);\n }\n\n return (result);\n }" ]
Shrinks the alert message body so that the resulting payload message fits within the passed expected payload length. This method performs best-effort approach, and its behavior is unspecified when handling alerts where the payload without body is already longer than the permitted size, or if the break occurs within word. @param payloadLength the expected max size of the payload @param postfix for the truncated body, e.g. "..." @return this
[ "public PayloadBuilder resizeAlertBody(final int payloadLength, final String postfix) {\n int currLength = length();\n if (currLength <= payloadLength) {\n return this;\n }\n\n // now we are sure that truncation is required\n String body = (String)customAlert.get(\"body\");\n\n final int acceptableSize = Utilities.toUTF8Bytes(body).length\n - (currLength - payloadLength\n + Utilities.toUTF8Bytes(postfix).length);\n body = Utilities.truncateWhenUTF8(body, acceptableSize) + postfix;\n\n // set it back\n customAlert.put(\"body\", body);\n\n // calculate the length again\n currLength = length();\n\n if(currLength > payloadLength) {\n // string is still too long, just remove the body as the body is\n // anyway not the cause OR the postfix might be too long\n customAlert.remove(\"body\");\n }\n\n return this;\n }" ]
[ "private TrackMetadata requestMetadataInternal(final DataReference track, final CdjStatus.TrackType trackType,\n final boolean failIfPassive) {\n // First check if we are using cached data for this request.\n MetadataCache cache = getMetadataCache(SlotReference.getSlotReference(track));\n if (cache != null && trackType == CdjStatus.TrackType.REKORDBOX) {\n return cache.getTrackMetadata(null, track);\n }\n\n // Then see if any registered metadata providers can offer it for us.\n final MediaDetails sourceDetails = getMediaDetailsFor(track.getSlotReference());\n if (sourceDetails != null) {\n final TrackMetadata provided = allMetadataProviders.getTrackMetadata(sourceDetails, track);\n if (provided != null) {\n return provided;\n }\n }\n\n // At this point, unless we are allowed to actively request the data, we are done. We can always actively\n // request tracks from rekordbox.\n if (passive.get() && failIfPassive && track.slot != CdjStatus.TrackSourceSlot.COLLECTION) {\n return null;\n }\n\n // Use the dbserver protocol implementation to request the metadata.\n ConnectionManager.ClientTask<TrackMetadata> task = new ConnectionManager.ClientTask<TrackMetadata>() {\n @Override\n public TrackMetadata useClient(Client client) throws Exception {\n return queryMetadata(track, trackType, client);\n }\n };\n\n try {\n return ConnectionManager.getInstance().invokeWithClientSession(track.player, task, \"requesting metadata\");\n } catch (Exception e) {\n logger.error(\"Problem requesting metadata, returning null\", e);\n }\n return null;\n }", "public String get(final String key) {\n final Collection<Argument> args = map.get(key);\n if (args != null) {\n return args.iterator().hasNext() ? args.iterator().next().getValue() : null;\n }\n return null;\n }", "public static Integer parseInteger(String value) throws ParseException\n {\n Integer result = null;\n\n if (value.length() > 0 && value.indexOf(' ') == -1)\n {\n if (value.indexOf('.') == -1)\n {\n result = Integer.valueOf(value);\n }\n else\n {\n Number n = DatatypeConverter.parseDouble(value);\n result = Integer.valueOf(n.intValue());\n }\n }\n\n return result;\n }", "public ServerSocket createServerSocket() throws IOException {\n final ServerSocket socket = getServerSocketFactory().createServerSocket(name);\n socket.bind(getSocketAddress());\n return socket;\n }", "@Override\n public String logFile() {\n if(logFile == null) {\n logFile = Config.getTmpDir()+Config.getPathSeparator()+\"aesh.log\";\n }\n return logFile;\n }", "public <V> V attach(final AttachmentKey<V> key, final V value) {\n assert key != null;\n return key.cast(contextAttachments.put(key, value));\n }", "public Rectangle getTextSize(String text, Font font) {\n\t\ttemplate.saveState();\n\t\t// get the font\n\t\tDefaultFontMapper mapper = new DefaultFontMapper();\n\t\tBaseFont bf = mapper.awtToPdf(font);\n\t\ttemplate.setFontAndSize(bf, font.getSize());\n\t\t// calculate text width and height\n\t\tfloat textWidth = template.getEffectiveStringWidth(text, false);\n\t\tfloat ascent = bf.getAscentPoint(text, font.getSize());\n\t\tfloat descent = bf.getDescentPoint(text, font.getSize());\n\t\tfloat textHeight = ascent - descent;\n\t\ttemplate.restoreState();\n\t\treturn new Rectangle(0, 0, textWidth, textHeight);\n\t}", "protected void handleRequestOut(T message) throws Fault {\n String flowId = FlowIdHelper.getFlowId(message);\n if (flowId == null\n && message.containsKey(PhaseInterceptorChain.PREVIOUS_MESSAGE)) {\n // Web Service consumer is acting as an intermediary\n @SuppressWarnings(\"unchecked\")\n WeakReference<Message> wrPreviousMessage = (WeakReference<Message>) message\n .get(PhaseInterceptorChain.PREVIOUS_MESSAGE);\n Message previousMessage = (Message) wrPreviousMessage.get();\n flowId = FlowIdHelper.getFlowId(previousMessage);\n if (flowId != null && LOG.isLoggable(Level.FINE)) {\n LOG.fine(\"flowId '\" + flowId + \"' found in previous message\");\n }\n }\n\n if (flowId == null) {\n // No flowId found. Generate one.\n flowId = ContextUtils.generateUUID();\n if (LOG.isLoggable(Level.FINE)) {\n LOG.fine(\"Generate new flowId '\" + flowId + \"'\");\n }\n }\n\n FlowIdHelper.setFlowId(message, flowId);\n }", "public boolean start(SensorManager sensorManager) {\n // Already started?\n if (accelerometer != null) {\n return true;\n }\n\n accelerometer = sensorManager.getDefaultSensor(\n Sensor.TYPE_ACCELEROMETER);\n\n // If this phone has an accelerometer, listen to it.\n if (accelerometer != null) {\n this.sensorManager = sensorManager;\n sensorManager.registerListener(this, accelerometer,\n SensorManager.SENSOR_DELAY_FASTEST);\n }\n return accelerometer != null;\n }" ]
Sets the bottom padding for all cells in the row. @param paddingBottom new padding, ignored if smaller than 0 @return this to allow chaining
[ "public AT_Row setPaddingBottom(int paddingBottom) {\r\n\t\tif(this.hasCells()){\r\n\t\t\tfor(AT_Cell cell : this.getCells()){\r\n\t\t\t\tcell.getContext().setPaddingBottom(paddingBottom);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}" ]
[ "private double convertToConvention(double value, DataKey key, QuotingConvention toConvention, double toDisplacement,\r\n\t\t\tQuotingConvention fromConvention, double fromDisplacement, AnalyticModel model) {\r\n\r\n\t\tif(toConvention == fromConvention) {\r\n\t\t\tif(toConvention != QuotingConvention.PAYERVOLATILITYLOGNORMAL) {\r\n\t\t\t\treturn value;\r\n\t\t\t} else {\r\n\t\t\t\tif(toDisplacement == fromDisplacement) {\r\n\t\t\t\t\treturn value;\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn convertToConvention(convertToConvention(value, key, QuotingConvention.PAYERPRICE, 0, fromConvention, fromDisplacement, model),\r\n\t\t\t\t\t\t\tkey, toConvention, toDisplacement, QuotingConvention.PAYERPRICE, 0, model);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tSchedule floatSchedule\t= floatMetaSchedule.generateSchedule(getReferenceDate(), key.maturity, key.tenor);\r\n\t\tSchedule fixSchedule\t= fixMetaSchedule.generateSchedule(getReferenceDate(), key.maturity, key.tenor);\r\n\r\n\t\tdouble forward = Swap.getForwardSwapRate(fixSchedule, floatSchedule, model.getForwardCurve(forwardCurveName), model);\r\n\t\tdouble optionMaturity = floatSchedule.getFixing(0);\r\n\t\tdouble offset = key.moneyness /10000.0;\r\n\t\tdouble optionStrike = forward + (quotingConvention == QuotingConvention.RECEIVERPRICE ? -offset : offset);\r\n\t\tdouble payoffUnit = SwapAnnuity.getSwapAnnuity(fixSchedule.getFixing(0), fixSchedule, model.getDiscountCurve(discountCurveName), model);\r\n\r\n\t\tif(toConvention.equals(QuotingConvention.PAYERPRICE) && fromConvention.equals(QuotingConvention.PAYERVOLATILITYLOGNORMAL)) {\r\n\t\t\treturn AnalyticFormulas.blackScholesGeneralizedOptionValue(forward + fromDisplacement, value, optionMaturity, optionStrike + fromDisplacement, payoffUnit);\r\n\t\t}\r\n\t\telse if(toConvention.equals(QuotingConvention.PAYERPRICE) && fromConvention.equals(QuotingConvention.PAYERVOLATILITYNORMAL)) {\r\n\t\t\treturn AnalyticFormulas.bachelierOptionValue(forward, value, optionMaturity, optionStrike, payoffUnit);\r\n\t\t}\r\n\t\telse if(toConvention.equals(QuotingConvention.PAYERPRICE) && fromConvention.equals(QuotingConvention.RECEIVERPRICE)) {\r\n\t\t\treturn value + (forward - optionStrike) * payoffUnit;\r\n\t\t}\r\n\t\telse if(toConvention.equals(QuotingConvention.PAYERVOLATILITYLOGNORMAL) && fromConvention.equals(QuotingConvention.PAYERPRICE)) {\r\n\t\t\treturn AnalyticFormulas.blackScholesOptionImpliedVolatility(forward + toDisplacement, optionMaturity, optionStrike + toDisplacement, payoffUnit, value);\r\n\t\t}\r\n\t\telse if(toConvention.equals(QuotingConvention.PAYERVOLATILITYNORMAL) && fromConvention.equals(QuotingConvention.PAYERPRICE)) {\r\n\t\t\treturn AnalyticFormulas.bachelierOptionImpliedVolatility(forward, optionMaturity, optionStrike, payoffUnit, value);\r\n\t\t}\r\n\t\telse if(toConvention.equals(QuotingConvention.RECEIVERPRICE) && fromConvention.equals(QuotingConvention.PAYERPRICE)) {\r\n\t\t\treturn value - (forward - optionStrike) * payoffUnit;\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn convertToConvention(convertToConvention(value, key, QuotingConvention.PAYERPRICE, 0, fromConvention, fromDisplacement, model),\r\n\t\t\t\t\tkey, toConvention, toDisplacement, QuotingConvention.PAYERPRICE, 0, model);\r\n\t\t}\r\n\t}", "public ThumborUrlBuilder trim(TrimPixelColor value, int colorTolerance) {\n if (colorTolerance < 0 || colorTolerance > 442) {\n throw new IllegalArgumentException(\"Color tolerance must be between 0 and 442.\");\n }\n if (colorTolerance > 0 && value == null) {\n throw new IllegalArgumentException(\"Trim pixel color value must not be null.\");\n }\n isTrim = true;\n trimPixelColor = value;\n trimColorTolerance = colorTolerance;\n return this;\n }", "public static base_responses export(nitro_service client, sslfipskey resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tsslfipskey exportresources[] = new sslfipskey[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\texportresources[i] = new sslfipskey();\n\t\t\t\texportresources[i].fipskeyname = resources[i].fipskeyname;\n\t\t\t\texportresources[i].key = resources[i].key;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, exportresources,\"export\");\n\t\t}\n\t\treturn result;\n\t}", "public static final String printDuration(Duration value)\n {\n return value == null ? null : Double.toString(value.getDuration());\n }", "public static streamidentifier_stats get(nitro_service service, String name) throws Exception{\n\t\tstreamidentifier_stats obj = new streamidentifier_stats();\n\t\tobj.set_name(name);\n\t\tstreamidentifier_stats response = (streamidentifier_stats) obj.stat_resource(service);\n\t\treturn response;\n\t}", "private String computeMorse(BytesRef term) {\n StringBuilder stringBuilder = new StringBuilder();\n int i = term.offset + prefixOffset;\n for (; i < term.length; i++) {\n if (ALPHABET_MORSE.containsKey(term.bytes[i])) {\n stringBuilder.append(ALPHABET_MORSE.get(term.bytes[i]) + \" \");\n } else if(term.bytes[i]!=0x00){\n return null;\n } else {\n break;\n }\n }\n return stringBuilder.toString();\n }", "private double[] formatTargetValuesForOptimizer() {\n\t\t//Put all values in an array for the optimizer.\n\t\tint numberOfMaturities = surface.getMaturities().length;\n\t\tdouble mats[] = surface.getMaturities();\n\n\t\tArrayList<Double> vals = new ArrayList<Double>();\n\n\t\tfor(int t = 0; t<numberOfMaturities; t++) {\n\t\t\tdouble mat = mats[t];\n\t\t\tdouble[] myStrikes = surface.getSurface().get(mat).getStrikes();\n\n\t\t\tOptionSmileData smileOfInterest = surface.getSurface().get(mat);\n\n\t\t\tfor(int k = 0; k < myStrikes.length; k++) {\n\t\t\t\tvals.add(smileOfInterest.getSmile().get(myStrikes[k]).getValue());\n\t\t\t}\n\n\t\t}\n\t\tDouble[] targetVals = new Double[vals.size()];\n\t\treturn ArrayUtils.toPrimitive(vals.toArray(targetVals));\n\t}", "public static Object objectify(ObjectMapper mapper, Object source) {\n return objectify(mapper, source, Object.class);\n }", "public void cache(Identity oid, Object obj)\r\n {\r\n try\r\n {\r\n jcsCache.put(oid.toString(), obj);\r\n }\r\n catch (CacheException e)\r\n {\r\n throw new RuntimeCacheException(e);\r\n }\r\n }" ]
Handles incoming Serial Messages. Serial messages can either be messages that are a response to our own requests, or the stick asking us information. @param incomingMessage the incoming message to process.
[ "private void handleIncomingMessage(SerialMessage incomingMessage) {\n\t\t\n\t\tlogger.debug(\"Incoming message to process\");\n\t\tlogger.debug(incomingMessage.toString());\n\t\t\n\t\tswitch (incomingMessage.getMessageType()) {\n\t\t\tcase Request:\n\t\t\t\thandleIncomingRequestMessage(incomingMessage);\n\t\t\t\tbreak;\n\t\t\tcase Response:\n\t\t\t\thandleIncomingResponseMessage(incomingMessage);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tlogger.warn(\"Unsupported incomingMessageType: 0x%02X\", incomingMessage.getMessageType());\n\t\t}\n\t}" ]
[ "public static String format(final String code, final Properties options, final LineEnding lineEnding) {\n\t\tCheck.notEmpty(code, \"code\");\n\t\tCheck.notEmpty(options, \"options\");\n\t\tCheck.notNull(lineEnding, \"lineEnding\");\n\n\t\tfinal CodeFormatter formatter = ToolFactory.createCodeFormatter(options);\n\t\tfinal String lineSeparator = LineEnding.find(lineEnding, code);\n\t\tTextEdit te = null;\n\t\ttry {\n\t\t\tte = formatter.format(CodeFormatter.K_COMPILATION_UNIT, code, 0, code.length(), 0, lineSeparator);\n\t\t} catch (final Exception formatFailed) {\n\t\t\tLOG.warn(\"Formatting failed\", formatFailed);\n\t\t}\n\n\t\tString formattedCode = code;\n\t\tif (te == null) {\n\t\t\tLOG.info(\"Code cannot be formatted. Possible cause is unmatched source/target/compliance version.\");\n\t\t} else {\n\n\t\t\tfinal IDocument doc = new Document(code);\n\t\t\ttry {\n\t\t\t\tte.apply(doc);\n\t\t\t} catch (final Exception e) {\n\t\t\t\tLOG.warn(e.getLocalizedMessage(), e);\n\t\t\t}\n\t\t\tformattedCode = doc.get();\n\t\t}\n\t\treturn formattedCode;\n\t}", "public void shutdown() {\n final Connection connection;\n synchronized (this) {\n if(shutdown) return;\n shutdown = true;\n connection = this.connection;\n if(connectTask != null) {\n connectTask.shutdown();\n }\n }\n if (connection != null) {\n connection.closeAsync();\n }\n }", "public long countByLex(final LexRange lexRange) {\n return doWithJedis(new JedisCallable<Long>() {\n @Override\n public Long call(Jedis jedis) {\n return jedis.zlexcount(getKey(), lexRange.from(), lexRange.to());\n }\n });\n }", "private int collectCandidates(Map<Long, Score> candidates,\n List<Bucket> buckets,\n int threshold) {\n int ix;\n for (ix = 0; ix < threshold &&\n candidates.size() < (CUTOFF_FACTOR_1 * max_search_hits); ix++) {\n Bucket b = buckets.get(ix);\n long[] ids = b.records;\n double score = b.getScore();\n \n for (int ix2 = 0; ix2 < b.nextfree; ix2++) {\n Score s = candidates.get(ids[ix2]);\n if (s == null) {\n s = new Score(ids[ix2]);\n candidates.put(ids[ix2], s);\n }\n s.score += score;\n }\n if (DEBUG)\n System.out.println(\"Bucket \" + b.nextfree + \" -> \" + candidates.size());\n }\n return ix;\n }", "public static double getRobustTreeEditDistance(String dom1, String dom2) {\n\n\t\tLblTree domTree1 = null, domTree2 = null;\n\t\ttry {\n\t\t\tdomTree1 = getDomTree(dom1);\n\t\t\tdomTree2 = getDomTree(dom2);\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tdouble DD = 0.0;\n\t\tRTED_InfoTree_Opt rted;\n\t\tdouble ted;\n\n\t\trted = new RTED_InfoTree_Opt(1, 1, 1);\n\n\t\t// compute tree edit distance\n\t\trted.init(domTree1, domTree2);\n\n\t\tint maxSize = Math.max(domTree1.getNodeCount(), domTree2.getNodeCount());\n\n\t\trted.computeOptimalStrategy();\n\t\tted = rted.nonNormalizedTreeDist();\n\t\tted /= (double) maxSize;\n\n\t\tDD = ted;\n\t\treturn DD;\n\t}", "public static base_response clear(nitro_service client, nsconfig resource) throws Exception {\n\t\tnsconfig clearresource = new nsconfig();\n\t\tclearresource.force = resource.force;\n\t\tclearresource.level = resource.level;\n\t\treturn clearresource.perform_operation(client,\"clear\");\n\t}", "public void setObjectForStatement(PreparedStatement ps, int index,\r\n Object value, int sqlType) throws SQLException\r\n {\r\n if (sqlType == Types.TINYINT)\r\n {\r\n ps.setByte(index, ((Byte) value).byteValue());\r\n }\r\n else\r\n {\r\n super.setObjectForStatement(ps, index, value, sqlType);\r\n }\r\n }", "@SuppressWarnings(\"WeakerAccess\")\n public int getPlayerDBServerPort(int player) {\n ensureRunning();\n Integer result = dbServerPorts.get(player);\n if (result == null) {\n return -1;\n }\n return result;\n }", "public static void endThreads(String check){\r\n //(error check)\r\n if(currentThread != -1L){\r\n throw new IllegalStateException(\"endThreads() called, but thread \" + currentThread + \" has not finished (exception in thread?)\");\r\n }\r\n //(end threaded environment)\r\n assert !control.isHeldByCurrentThread();\r\n isThreaded = false;\r\n //(write remaining threads)\r\n boolean cleanPass = false;\r\n while(!cleanPass){\r\n cleanPass = true;\r\n for(long thread : threadedLogQueue.keySet()){\r\n assert currentThread < 0L;\r\n if(threadedLogQueue.get(thread) != null && !threadedLogQueue.get(thread).isEmpty()){\r\n //(mark queue as unclean)\r\n cleanPass = false;\r\n //(variables)\r\n Queue<Runnable> backlog = threadedLogQueue.get(thread);\r\n currentThread = thread;\r\n //(clear buffer)\r\n while(currentThread >= 0){\r\n if(currentThread != thread){ throw new IllegalStateException(\"Redwood control shifted away from flushing thread\"); }\r\n if(backlog.isEmpty()){ throw new IllegalStateException(\"Forgot to call finishThread() on thread \" + currentThread); }\r\n assert !control.isHeldByCurrentThread();\r\n backlog.poll().run();\r\n }\r\n //(unregister thread)\r\n threadsWaiting.remove(thread);\r\n }\r\n }\r\n }\r\n while(threadsWaiting.size() > 0){\r\n assert currentThread < 0L;\r\n assert control.tryLock();\r\n assert !threadsWaiting.isEmpty();\r\n control.lock();\r\n attemptThreadControlThreadsafe(-1);\r\n control.unlock();\r\n }\r\n //(clean up)\r\n for(long threadId : threadedLogQueue.keySet()){\r\n assert threadedLogQueue.get(threadId).isEmpty();\r\n }\r\n assert threadsWaiting.isEmpty();\r\n assert currentThread == -1L;\r\n endTrack(\"Threads( \"+check+\" )\");\r\n }" ]
Makes http DELETE request @param url url to makes request to @param params data to add to params field @return {@link okhttp3.Response} @throws RequestException @throws LocalOperationException
[ "okhttp3.Response delete(String url, Map<String, Object> params)\n throws RequestException, LocalOperationException {\n okhttp3.Request request = new okhttp3.Request.Builder()\n .url(getFullUrl(url))\n .delete(getBody(toPayload(params), null))\n .addHeader(\"Transloadit-Client\", version)\n .build();\n\n try {\n return httpClient.newCall(request).execute();\n } catch (IOException e) {\n throw new RequestException(e);\n }\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 }\n if (maps.getMessageID() == null) {\n String messageID = ContextUtils.generateUUID();\n boolean isRequestor = ContextUtils.isRequestor(message);\n maps.setMessageID(ContextUtils.getAttributedURI(messageID));\n ContextUtils.storeMAPs(maps, message, ContextUtils.isOutbound(message), isRequestor);\n }\n }", "public Object lookup(String name) throws ObjectNameNotFoundException\r\n {\r\n /**\r\n * Is DB open? ODMG 3.0 says it has to be to call bind.\r\n */\r\n if (!this.isOpen())\r\n {\r\n throw new DatabaseClosedException(\"Database is not open. Must have an open DB to call lookup\");\r\n }\r\n /**\r\n * Is Tx open? ODMG 3.0 says it has to be to call bind.\r\n */\r\n TransactionImpl tx = getTransaction();\r\n if (tx == null || !tx.isOpen())\r\n {\r\n throw new TransactionNotInProgressException(\"Tx is not open. Must have an open TX to call lookup.\");\r\n }\r\n\r\n return tx.getNamedRootsMap().lookup(name);\r\n }", "private void writeProjectExtendedAttributes(Project project)\n {\n Project.ExtendedAttributes attributes = m_factory.createProjectExtendedAttributes();\n project.setExtendedAttributes(attributes);\n List<Project.ExtendedAttributes.ExtendedAttribute> list = attributes.getExtendedAttribute();\n\n Set<FieldType> customFields = new HashSet<FieldType>();\n for (CustomField customField : m_projectFile.getCustomFields())\n {\n FieldType fieldType = customField.getFieldType();\n if (fieldType != null)\n {\n customFields.add(fieldType);\n }\n }\n\n customFields.addAll(m_extendedAttributesInUse);\n \n List<FieldType> customFieldsList = new ArrayList<FieldType>();\n customFieldsList.addAll(customFields);\n \n\n // Sort to ensure consistent order in file\n final CustomFieldContainer customFieldContainer = m_projectFile.getCustomFields();\n Collections.sort(customFieldsList, new Comparator<FieldType>()\n {\n @Override public int compare(FieldType o1, FieldType o2)\n {\n CustomField customField1 = customFieldContainer.getCustomField(o1);\n CustomField customField2 = customFieldContainer.getCustomField(o2);\n String name1 = o1.getClass().getSimpleName() + \".\" + o1.getName() + \" \" + customField1.getAlias();\n String name2 = o2.getClass().getSimpleName() + \".\" + o2.getName() + \" \" + customField2.getAlias();\n return name1.compareTo(name2);\n }\n });\n\n for (FieldType fieldType : customFieldsList)\n {\n Project.ExtendedAttributes.ExtendedAttribute attribute = m_factory.createProjectExtendedAttributesExtendedAttribute();\n list.add(attribute);\n attribute.setFieldID(String.valueOf(FieldTypeHelper.getFieldID(fieldType)));\n attribute.setFieldName(fieldType.getName());\n\n CustomField customField = customFieldContainer.getCustomField(fieldType);\n attribute.setAlias(customField.getAlias());\n }\n }", "public static HashMap<String, JSONObject> flatRessources(JSONObject object) throws JSONException {\n HashMap<String, JSONObject> result = new HashMap<String, JSONObject>();\n\n // no cycle in hierarchies!!\n if (object.has(\"resourceId\") && object.has(\"childShapes\")) {\n result.put(object.getString(\"resourceId\"),\n object);\n JSONArray childShapes = object.getJSONArray(\"childShapes\");\n for (int i = 0; i < childShapes.length(); i++) {\n result.putAll(flatRessources(childShapes.getJSONObject(i)));\n }\n }\n ;\n\n return result;\n }", "private WaveformPreview requestPreviewInternal(final DataReference trackReference, final boolean failIfPassive) {\n\n // First check if we are using cached data for this slot\n MetadataCache cache = MetadataFinder.getInstance().getMetadataCache(SlotReference.getSlotReference(trackReference));\n if (cache != null) {\n return cache.getWaveformPreview(null, trackReference);\n }\n\n // Then see if any registered metadata providers can offer it for us.\n final MediaDetails sourceDetails = MetadataFinder.getInstance().getMediaDetailsFor(trackReference.getSlotReference());\n if (sourceDetails != null) {\n final WaveformPreview provided = MetadataFinder.getInstance().allMetadataProviders.getWaveformPreview(sourceDetails, trackReference);\n if (provided != null) {\n return provided;\n }\n }\n\n // At this point, unless we are allowed to actively request the data, we are done. We can always actively\n // request tracks from rekordbox.\n if (MetadataFinder.getInstance().isPassive() && failIfPassive && trackReference.slot != CdjStatus.TrackSourceSlot.COLLECTION) {\n return null;\n }\n\n // We have to actually request the preview using the dbserver protocol.\n ConnectionManager.ClientTask<WaveformPreview> task = new ConnectionManager.ClientTask<WaveformPreview>() {\n @Override\n public WaveformPreview useClient(Client client) throws Exception {\n return getWaveformPreview(trackReference.rekordboxId, SlotReference.getSlotReference(trackReference), client);\n }\n };\n\n try {\n return ConnectionManager.getInstance().invokeWithClientSession(trackReference.player, task, \"requesting waveform preview\");\n } catch (Exception e) {\n logger.error(\"Problem requesting waveform preview, returning null\", e);\n }\n return null;\n }", "public static Iterable<BoxFileVersionRetention.Info> getAll(BoxAPIConnection api, String ... fields) {\n return getRetentions(api, new QueryFilter(), fields);\n }", "public final Processor.ExecutionContext print(\n final String jobId, final PJsonObject specJson, final OutputStream out)\n throws Exception {\n final OutputFormat format = getOutputFormat(specJson);\n final File taskDirectory = this.workingDirectories.getTaskDirectory();\n\n try {\n return format.print(jobId, specJson, getConfiguration(), this.configFile.getParentFile(),\n taskDirectory, out);\n } finally {\n this.workingDirectories.removeDirectory(taskDirectory);\n }\n }", "private String getSubQuerySQL(Query subQuery)\r\n {\r\n ClassDescriptor cld = getRoot().cld.getRepository().getDescriptorFor(subQuery.getSearchClass());\r\n String sql;\r\n\r\n if (subQuery instanceof QueryBySQL)\r\n {\r\n sql = ((QueryBySQL) subQuery).getSql();\r\n }\r\n else\r\n {\r\n sql = new SqlSelectStatement(this, m_platform, cld, subQuery, m_logger).getStatement();\r\n }\r\n\r\n return sql;\r\n }", "public static base_response delete(nitro_service client, ntpserver resource) throws Exception {\n\t\tntpserver deleteresource = new ntpserver();\n\t\tdeleteresource.serverip = resource.serverip;\n\t\tdeleteresource.servername = resource.servername;\n\t\treturn deleteresource.delete_resource(client);\n\t}" ]
Validates the deployment. @param isDomain {@code true} if this is a domain server, otherwise {@code false} @throws MojoDeploymentException if the deployment is invalid
[ "protected void validate(final boolean isDomain) throws MojoDeploymentException {\n final boolean hasServerGroups = hasServerGroups();\n if (isDomain) {\n if (!hasServerGroups) {\n throw new MojoDeploymentException(\n \"Server is running in domain mode, but no server groups have been defined.\");\n }\n } else if (hasServerGroups) {\n throw new MojoDeploymentException(\"Server is running in standalone mode, but server groups have been defined.\");\n }\n }" ]
[ "public static base_responses add(nitro_service client, nsacl6 resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tnsacl6 addresources[] = new nsacl6[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new nsacl6();\n\t\t\t\taddresources[i].acl6name = resources[i].acl6name;\n\t\t\t\taddresources[i].acl6action = resources[i].acl6action;\n\t\t\t\taddresources[i].td = resources[i].td;\n\t\t\t\taddresources[i].srcipv6 = resources[i].srcipv6;\n\t\t\t\taddresources[i].srcipop = resources[i].srcipop;\n\t\t\t\taddresources[i].srcipv6val = resources[i].srcipv6val;\n\t\t\t\taddresources[i].srcport = resources[i].srcport;\n\t\t\t\taddresources[i].srcportop = resources[i].srcportop;\n\t\t\t\taddresources[i].srcportval = resources[i].srcportval;\n\t\t\t\taddresources[i].destipv6 = resources[i].destipv6;\n\t\t\t\taddresources[i].destipop = resources[i].destipop;\n\t\t\t\taddresources[i].destipv6val = resources[i].destipv6val;\n\t\t\t\taddresources[i].destport = resources[i].destport;\n\t\t\t\taddresources[i].destportop = resources[i].destportop;\n\t\t\t\taddresources[i].destportval = resources[i].destportval;\n\t\t\t\taddresources[i].ttl = resources[i].ttl;\n\t\t\t\taddresources[i].srcmac = resources[i].srcmac;\n\t\t\t\taddresources[i].protocol = resources[i].protocol;\n\t\t\t\taddresources[i].protocolnumber = resources[i].protocolnumber;\n\t\t\t\taddresources[i].vlan = resources[i].vlan;\n\t\t\t\taddresources[i].Interface = resources[i].Interface;\n\t\t\t\taddresources[i].established = resources[i].established;\n\t\t\t\taddresources[i].icmptype = resources[i].icmptype;\n\t\t\t\taddresources[i].icmpcode = resources[i].icmpcode;\n\t\t\t\taddresources[i].priority = resources[i].priority;\n\t\t\t\taddresources[i].state = resources[i].state;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "public Duration getDuration(Date startDate, Date endDate)\n {\n Calendar cal = DateHelper.popCalendar(startDate);\n int days = getDaysInRange(startDate, endDate);\n int duration = 0;\n Day day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK));\n\n while (days > 0)\n {\n if (isWorkingDate(cal.getTime(), day) == true)\n {\n ++duration;\n }\n\n --days;\n day = day.getNextDay();\n cal.set(Calendar.DAY_OF_YEAR, cal.get(Calendar.DAY_OF_YEAR) + 1);\n }\n DateHelper.pushCalendar(cal);\n \n return (Duration.getInstance(duration, TimeUnit.DAYS));\n }", "public void resize(int w, int h) {\n\n // using the new approach of Java 2D API\n BufferedImage buf = new BufferedImage(w, h, image.getType());\n Graphics2D g2d = (Graphics2D) buf.getGraphics();\n g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);\n g2d.drawImage(image, 0, 0, w, h, null);\n g2d.dispose();\n image = buf;\n width = w;\n height = h;\n updateColorArray();\n }", "public void removeNodeMetaData(Object key) {\n if (key==null) throw new GroovyBugError(\"Tried to remove meta data with null key \"+this+\".\");\n if (metaDataMap == null) {\n return;\n }\n metaDataMap.remove(key);\n }", "public static String capitalizePropertyName(String s) {\r\n\t\tif (s.length() == 0) {\r\n\t\t\treturn s;\r\n\t\t}\r\n\r\n\t\tchar[] chars = s.toCharArray();\r\n\t\tchars[0] = Character.toUpperCase(chars[0]);\r\n\t\treturn new String(chars);\r\n\t}", "protected Integer parseOptionalIntValue(final String path) {\n\n final I_CmsXmlContentValue value = m_xml.getValue(path, m_locale);\n if (value == null) {\n return null;\n } else {\n final String stringValue = value.getStringValue(null);\n try {\n final Integer intValue = Integer.valueOf(stringValue);\n return intValue;\n } catch (final NumberFormatException e) {\n LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_INTEGER_MISSING_1, path), e);\n return null;\n }\n }\n }", "private static void parseSsextensions(JSONObject modelJSON,\n Diagram current) throws JSONException {\n if (modelJSON.has(\"ssextensions\")) {\n JSONArray array = modelJSON.getJSONArray(\"ssextensions\");\n for (int i = 0; i < array.length(); i++) {\n current.addSsextension(array.getString(i));\n }\n }\n }", "public static PacketType validateHeader(DatagramPacket packet, int port) {\n byte[] data = packet.getData();\n\n if (data.length < PACKET_TYPE_OFFSET) {\n logger.warn(\"Packet is too short to be a Pro DJ Link packet; must be at least \" + PACKET_TYPE_OFFSET +\n \" bytes long, was only \" + data.length + \".\");\n return null;\n }\n\n if (!getMagicHeader().equals(ByteBuffer.wrap(data, 0, MAGIC_HEADER.length))) {\n logger.warn(\"Packet did not have correct nine-byte header for the Pro DJ Link protocol.\");\n return null;\n }\n\n final Map<Byte, PacketType> portMap = PACKET_TYPE_MAP.get(port);\n if (portMap == null) {\n logger.warn(\"Do not know any Pro DJ Link packets that are received on port \" + port + \".\");\n return null;\n }\n\n final PacketType result = portMap.get(data[PACKET_TYPE_OFFSET]);\n if (result == null) {\n logger.warn(\"Do not know any Pro DJ Link packets received on port \" + port + \" with type \" +\n String.format(\"0x%02x\", data[PACKET_TYPE_OFFSET]) + \".\");\n }\n\n return result;\n }", "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.getDPI();\n\n // get the map bounds\n final Rectangle paintArea = new Rectangle(mapContext.getMapSize());\n MapBounds bounds = mapContext.getBounds();\n\n final DistanceUnit mapUnit = getUnit(bounds);\n final Scale scale = bounds.getScale(paintArea, PDF_DPI);\n final double scaleDenominator = scale.getDenominator(scalebarParams.geodetic,\n bounds.getProjection(), dpi, bounds.getCenter());\n\n DistanceUnit scaleUnit = scalebarParams.getUnit();\n if (scaleUnit == null) {\n scaleUnit = mapUnit;\n }\n\n // adjust scalebar width and height to the DPI value\n final double maxLengthInPixel = (scalebarParams.getOrientation().isHorizontal()) ?\n scalebarParams.getSize().width : scalebarParams.getSize().height;\n\n final double maxIntervalLengthInWorldUnits = DistanceUnit.PX.convertTo(maxLengthInPixel, scaleUnit)\n * scaleDenominator / scalebarParams.intervals;\n final double niceIntervalLengthInWorldUnits =\n getNearestNiceValue(maxIntervalLengthInWorldUnits, scaleUnit, scalebarParams.lockUnits);\n\n final ScaleBarRenderSettings settings = new ScaleBarRenderSettings();\n settings.setParams(scalebarParams);\n settings.setMaxSize(scalebarParams.getSize());\n settings.setPadding(getPadding(settings));\n\n // start the rendering\n File path = null;\n if (template.getConfiguration().renderAsSvg(scalebarParams.renderAsSvg)) {\n // render scalebar as SVG\n final SVGGraphics2D graphics2D = CreateMapProcessor.createSvgGraphics(scalebarParams.getSize());\n\n try {\n tryLayout(\n graphics2D, scaleUnit, scaleDenominator,\n niceIntervalLengthInWorldUnits, settings, 0);\n\n path = File.createTempFile(\"scalebar-graphic-\", \".svg\", tempFolder);\n CreateMapProcessor.saveSvgFile(graphics2D, path);\n } finally {\n graphics2D.dispose();\n }\n } else {\n // render scalebar as raster graphic\n double dpiRatio = mapContext.getDPI() / PDF_DPI;\n final BufferedImage bufferedImage = new BufferedImage(\n (int) Math.round(scalebarParams.getSize().width * dpiRatio),\n (int) Math.round(scalebarParams.getSize().height * dpiRatio),\n TYPE_4BYTE_ABGR);\n final Graphics2D graphics2D = bufferedImage.createGraphics();\n\n try {\n AffineTransform saveAF = new AffineTransform(graphics2D.getTransform());\n graphics2D.scale(dpiRatio, dpiRatio);\n tryLayout(\n graphics2D, scaleUnit, scaleDenominator,\n niceIntervalLengthInWorldUnits, settings, 0);\n graphics2D.setTransform(saveAF);\n\n path = File.createTempFile(\"scalebar-graphic-\", \".png\", tempFolder);\n ImageUtils.writeImage(bufferedImage, \"png\", path);\n } finally {\n graphics2D.dispose();\n }\n }\n\n return path.toURI();\n }" ]
Starts data synchronization in a background thread.
[ "public void start() {\n syncLock.lock();\n try {\n if (!this.isConfigured) {\n return;\n }\n instanceChangeStreamListener.stop();\n if (listenersEnabled) {\n instanceChangeStreamListener.start();\n }\n\n if (syncThread == null) {\n syncThread = new Thread(\n new DataSynchronizerRunner(\n new WeakReference<>(this),\n networkMonitor,\n logger\n ),\n \"dataSynchronizerRunnerThread\"\n );\n }\n if (syncThreadEnabled && !isRunning) {\n syncThread.start();\n isRunning = true;\n }\n } finally {\n syncLock.unlock();\n }\n }" ]
[ "protected String adaptFilePath(String filePath) {\n // Convert windows file path to target FS\n String targetPath = filePath.replaceAll(\"\\\\\\\\\", volumeType.getSeparator());\n\n return targetPath;\n }", "public <S extends AddressSegment> void getSplitSegments(S segs[], int index, AddressSegmentCreator<S> creator) {\r\n\t\tif(!isMultiple()) {\r\n\t\t\tint bitSizeSplit = IPv6Address.BITS_PER_SEGMENT >>> 1;\r\n\t\t\tInteger myPrefix = getSegmentPrefixLength();\r\n\t\t\tInteger highPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 0);\r\n\t\t\tInteger lowPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 1);\r\n\t\t\tif(index >= 0 && index < segs.length) {\r\n\t\t\t\tsegs[index] = creator.createSegment(highByte(), highPrefixBits);\r\n\t\t\t}\r\n\t\t\tif(++index >= 0 && index < segs.length) {\r\n\t\t\t\tsegs[index] = creator.createSegment(lowByte(), lowPrefixBits);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tgetSplitSegmentsMultiple(segs, index, creator);\r\n\t\t}\r\n\t}", "@Override\n public void start(String[] arguments) {\n boolean notStarted = !started.getAndSet(true);\n if (notStarted) {\n start(new MultiInstanceWorkloadStrategy(factory, name, arguments, endpointRegistry, execService));\n }\n }", "@SuppressWarnings(\"unchecked\")\n public static <E> void serialize(E object, ParameterizedType<E> parameterizedType, OutputStream os) throws IOException {\n mapperFor(parameterizedType).serialize(object, os);\n }", "private String getStringPredicate(String fieldName, List<String> filterValues, List<Object> prms)\n {\n if (filterValues != null && !filterValues.isEmpty())\n {\n String res = \"\";\n for (String filterValue : filterValues)\n {\n if (filterValue == null)\n {\n continue;\n }\n if (!filterValue.isEmpty())\n {\n prms.add(filterValue);\n if (filterValue.contains(\"%\"))\n {\n res += String.format(\"(%s LIKE ?) OR \", fieldName);\n }\n else\n {\n res += String.format(\"(%s = ?) OR \", fieldName);\n }\n }\n else\n {\n res += String.format(\"(%s IS NULL OR %s = '') OR \", fieldName, fieldName);\n }\n }\n if (!res.isEmpty())\n {\n res = \"AND (\" + res.substring(0, res.length() - 4) + \") \";\n return res;\n }\n }\n return \"\";\n }", "public int createPartitions(String topic, int partitionNum, boolean enlarge) throws IOException {\n KV<Receive, ErrorMapping> response = send(new CreaterRequest(topic, partitionNum, enlarge));\n return Utils.deserializeIntArray(response.k.buffer())[0];\n }", "private void processResourceAssignments(Task task, List<MapRow> assignments)\n {\n for (MapRow row : assignments)\n {\n processResourceAssignment(task, row);\n }\n }", "@Override public ProjectFile read(String accessDatabaseFileName) throws MPXJException\n {\n try\n {\n Class.forName(\"sun.jdbc.odbc.JdbcOdbcDriver\");\n String url = \"jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=\" + accessDatabaseFileName;\n m_connection = DriverManager.getConnection(url);\n m_projectID = Integer.valueOf(1);\n return (read());\n }\n\n catch (ClassNotFoundException ex)\n {\n throw new MPXJException(\"Failed to load JDBC driver\", ex);\n }\n\n catch (SQLException ex)\n {\n throw new MPXJException(\"Failed to create connection\", ex);\n }\n\n finally\n {\n if (m_connection != null)\n {\n try\n {\n m_connection.close();\n }\n\n catch (SQLException ex)\n {\n // silently ignore exceptions when closing connection\n }\n }\n }\n }", "@Override\n public void postCrawling(CrawlSession session, ExitStatus exitStatus) {\n LOG.debug(\"postCrawling\");\n StateFlowGraph sfg = session.getStateFlowGraph();\n checkSFG(sfg);\n // TODO: call state abstraction function to get distance matrix and run rscript on it to\n // create clusters\n String[][] clusters = null;\n // generateClusters(session);\n\n result = outModelCache.close(session, exitStatus, clusters);\n\n outputBuilder.write(result, session.getConfig(), clusters);\n StateWriter writer =\n new StateWriter(outputBuilder, sfg, ImmutableMap.copyOf(visitedStates));\n for (State state : result.getStates().values()) {\n try {\n writer.writeHtmlForState(state);\n } catch (Exception Ex) {\n LOG.info(\"couldn't write state :\" + state.getName());\n }\n }\n LOG.info(\"Crawl overview plugin has finished\");\n }" ]
retrieve a collection of type collectionClass matching the Query query if lazy = true return a CollectionProxy @param collectionClass @param query @param lazy @return ManageableCollection @throws PersistenceBrokerException
[ "public ManageableCollection getCollectionByQuery(Class collectionClass, Query query, boolean lazy) throws PersistenceBrokerException\r\n {\r\n ManageableCollection result;\r\n\r\n try\r\n {\r\n // BRJ: return empty Collection for null query\r\n if (query == null)\r\n {\r\n result = (ManageableCollection)collectionClass.newInstance();\r\n }\r\n else\r\n {\r\n if (lazy)\r\n {\r\n result = pb.getProxyFactory().createCollectionProxy(pb.getPBKey(), query, collectionClass);\r\n }\r\n else\r\n {\r\n result = getCollectionByQuery(collectionClass, query.getSearchClass(), query);\r\n }\r\n }\r\n return result;\r\n }\r\n catch (Exception e)\r\n {\r\n if(e instanceof PersistenceBrokerException)\r\n {\r\n throw (PersistenceBrokerException) e;\r\n }\r\n else\r\n {\r\n throw new PersistenceBrokerException(e);\r\n }\r\n }\r\n }" ]
[ "public static lbsipparameters get(nitro_service service) throws Exception{\n\t\tlbsipparameters obj = new lbsipparameters();\n\t\tlbsipparameters[] response = (lbsipparameters[])obj.get_resources(service);\n\t\treturn response[0];\n\t}", "protected void appendHavingClause(StringBuffer having, Criteria crit, StringBuffer stmt)\r\n {\r\n if (having.length() == 0)\r\n {\r\n having = null;\r\n }\r\n\r\n if (having != null || crit != null)\r\n {\r\n stmt.append(\" HAVING \");\r\n appendClause(having, crit, stmt);\r\n }\r\n }", "public void add( int row , int col , double value ) {\n if( col < 0 || col >= numCols || row < 0 || row >= numRows ) {\n throw new IllegalArgumentException(\"Specified element is out of bounds\");\n }\n\n data[ row * numCols + col ] += value;\n }", "protected void appendTableWithJoins(TableAlias alias, StringBuffer where, StringBuffer buf)\r\n {\r\n int stmtFromPos = 0;\r\n byte joinSyntax = getJoinSyntaxType();\r\n\r\n if (joinSyntax == SQL92_JOIN_SYNTAX)\r\n {\r\n stmtFromPos = buf.length(); // store position of join (by: Terry Dexter)\r\n }\r\n\r\n if (alias == getRoot())\r\n {\r\n // BRJ: also add indirection table to FROM-clause for MtoNQuery \r\n if (getQuery() instanceof MtoNQuery)\r\n {\r\n MtoNQuery mnQuery = (MtoNQuery)m_query; \r\n buf.append(getTableAliasForPath(mnQuery.getIndirectionTable(), null).getTableAndAlias());\r\n buf.append(\", \");\r\n } \r\n buf.append(alias.getTableAndAlias());\r\n }\r\n else if (joinSyntax != SQL92_NOPAREN_JOIN_SYNTAX)\r\n {\r\n buf.append(alias.getTableAndAlias());\r\n }\r\n\r\n if (!alias.hasJoins())\r\n {\r\n return;\r\n }\r\n\r\n for (Iterator it = alias.iterateJoins(); it.hasNext();)\r\n {\r\n Join join = (Join) it.next();\r\n\r\n if (joinSyntax == SQL92_JOIN_SYNTAX)\r\n {\r\n appendJoinSQL92(join, where, buf);\r\n if (it.hasNext())\r\n {\r\n buf.insert(stmtFromPos, \"(\");\r\n buf.append(\")\");\r\n }\r\n }\r\n else if (joinSyntax == SQL92_NOPAREN_JOIN_SYNTAX)\r\n {\r\n appendJoinSQL92NoParen(join, where, buf);\r\n }\r\n else\r\n {\r\n appendJoin(where, buf, join);\r\n }\r\n\r\n }\r\n }", "public int deleteTopic(String topic, String password) throws IOException {\n KV<Receive, ErrorMapping> response = send(new DeleterRequest(topic, password));\n return Utils.deserializeIntArray(response.k.buffer())[0];\n }", "public static <K, V, T> List<Versioned<V>> get(Store<K, V, T> storageEngine, K key, T transform) {\n Map<K, List<Versioned<V>>> result = storageEngine.getAll(Collections.singleton(key),\n Collections.singletonMap(key,\n transform));\n if(result.size() > 0)\n return result.get(key);\n else\n return Collections.emptyList();\n }", "public static Span exact(CharSequence row) {\n Objects.requireNonNull(row);\n return exact(Bytes.of(row));\n }", "@SuppressWarnings(\"deprecation\")\n public BUILDER setAllowedValues(String ... allowedValues) {\n assert allowedValues!= null;\n this.allowedValues = new ModelNode[allowedValues.length];\n for (int i = 0; i < allowedValues.length; i++) {\n this.allowedValues[i] = new ModelNode(allowedValues[i]);\n }\n return (BUILDER) this;\n }", "private void writeCalendars() throws JAXBException\n {\n //\n // Create the new Planner calendar list\n //\n Calendars calendars = m_factory.createCalendars();\n m_plannerProject.setCalendars(calendars);\n writeDayTypes(calendars);\n List<net.sf.mpxj.planner.schema.Calendar> calendar = calendars.getCalendar();\n\n //\n // Process each calendar in turn\n //\n for (ProjectCalendar mpxjCalendar : m_projectFile.getCalendars())\n {\n net.sf.mpxj.planner.schema.Calendar plannerCalendar = m_factory.createCalendar();\n calendar.add(plannerCalendar);\n writeCalendar(mpxjCalendar, plannerCalendar);\n }\n }" ]
Sets the value of the given variable @param name the name of the variable to set @param value the new value for the given variable
[ "public void setVariable(String name, Object value) {\n if (variables == null)\n variables = new LinkedHashMap();\n variables.put(name, value);\n }" ]
[ "private void validateJUnit4() throws BuildException {\n try {\n Class<?> clazz = Class.forName(\"org.junit.runner.Description\");\n if (!Serializable.class.isAssignableFrom(clazz)) {\n throw new BuildException(\"At least JUnit version 4.10 is required on junit4's taskdef classpath.\");\n }\n } catch (ClassNotFoundException e) {\n throw new BuildException(\"JUnit JAR must be added to junit4 taskdef's classpath.\");\n }\n }", "public Object assignIdValue(ConnectionSource connectionSource, Object data, Number val, ObjectCache objectCache)\n\t\t\tthrows SQLException {\n\t\tObject idVal = dataPersister.convertIdNumber(val);\n\t\tif (idVal == null) {\n\t\t\tthrow new SQLException(\"Invalid class \" + dataPersister + \" for sequence-id \" + this);\n\t\t} else {\n\t\t\tassignField(connectionSource, data, idVal, false, objectCache);\n\t\t\treturn idVal;\n\t\t}\n\t}", "public <V> V detach(final AttachmentKey<V> key) {\n assert key != null;\n return key.cast(contextAttachments.remove(key));\n }", "public static int[] toInt(double[] array) {\n int[] n = new int[array.length];\n for (int i = 0; i < array.length; i++) {\n n[i] = (int) array[i];\n }\n return n;\n }", "public String getRandomHoliday(String earliest, String latest) {\n String dateString = \"\";\n DateTimeFormatter parser = ISODateTimeFormat.date();\n DateTime earlyDate = parser.parseDateTime(earliest);\n DateTime lateDate = parser.parseDateTime(latest);\n List<Holiday> holidays = new LinkedList<>();\n\n int min = Integer.parseInt(earlyDate.toString().substring(0, 4));\n int max = Integer.parseInt(lateDate.toString().substring(0, 4));\n int range = max - min + 1;\n int randomYear = (int) (Math.random() * range) + min;\n\n for (Holiday s : EquivalenceClassTransformer.HOLIDAYS) {\n holidays.add(s);\n }\n Collections.shuffle(holidays);\n\n for (Holiday holiday : holidays) {\n dateString = convertToReadableDate(holiday.forYear(randomYear));\n if (toDate(dateString).after(toDate(earliest)) && toDate(dateString).before(toDate(latest))) {\n break;\n }\n }\n return dateString;\n }", "public PhotoList<Photo> photosForLocation(GeoData location, Set<String> extras, int perPage, int page) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n PhotoList<Photo> photos = new PhotoList<Photo>();\r\n parameters.put(\"method\", METHOD_PHOTOS_FOR_LOCATION);\r\n\r\n if (extras.size() > 0) {\r\n parameters.put(\"extras\", StringUtilities.join(extras, \",\"));\r\n }\r\n if (perPage > 0) {\r\n parameters.put(\"per_page\", Integer.toString(perPage));\r\n }\r\n if (page > 0) {\r\n parameters.put(\"page\", Integer.toString(page));\r\n }\r\n parameters.put(\"lat\", Float.toString(location.getLatitude()));\r\n parameters.put(\"lon\", Float.toString(location.getLongitude()));\r\n parameters.put(\"accuracy\", Integer.toString(location.getAccuracy()));\r\n Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n Element photosElement = response.getPayload();\r\n photos.setPage(photosElement.getAttribute(\"page\"));\r\n photos.setPages(photosElement.getAttribute(\"pages\"));\r\n photos.setPerPage(photosElement.getAttribute(\"perpage\"));\r\n photos.setTotal(photosElement.getAttribute(\"total\"));\r\n\r\n NodeList photoElements = photosElement.getElementsByTagName(\"photo\");\r\n for (int i = 0; i < photoElements.getLength(); i++) {\r\n Element photoElement = (Element) photoElements.item(i);\r\n photos.add(PhotoUtils.createPhoto(photoElement));\r\n }\r\n return photos;\r\n }", "private void logState(final FileRollEvent fileRollEvent) {\n\n//\t\tif (ApplicationState.isApplicationStateEnabled()) {\n\t\t\t\n\t\t\tsynchronized (this) {\n\t\t\t\t\n\t\t\t\tfinal Collection<ApplicationState.ApplicationStateMessage> entries = ApplicationState.getAppStateEntries();\n\t\t\t\tfor (ApplicationState.ApplicationStateMessage entry : entries) {\n Level level = ApplicationState.getLog4jLevel(entry.getLevel());\n\t\t\t\t if(level.isGreaterOrEqual(ApplicationState.LOGGER.getEffectiveLevel())) {\n\t\t\t\t\t\tfinal org.apache.log4j.spi.LoggingEvent loggingEvent = new org.apache.log4j.spi.LoggingEvent(ApplicationState.FQCN, ApplicationState.LOGGER, level, entry.getMessage(), null);\n\n\t\t\t\t\t\t//Save the current layout before changing it to the original (relevant for marker cases when the layout was changed)\n\t\t\t\t\t\tLayout current=fileRollEvent.getSource().getLayout();\n\t\t\t\t\t\t//fileRollEvent.getSource().activeOriginalLayout();\n\t\t\t\t\t\tString flowContext = (String) MDC.get(\"flowCtxt\");\n\t\t\t\t\t\tMDC.remove(\"flowCtxt\");\n\t\t\t\t\t\t//Write applicationState:\n\t\t\t\t\t\tif(fileRollEvent.getSource().isAddApplicationState() && fileRollEvent.getSource().getFile().endsWith(\"log\")){\n\t\t\t\t\t\t\tfileRollEvent.dispatchToAppender(loggingEvent);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//Set current again.\n\t\t\t\t\t\tfileRollEvent.getSource().setLayout(current);\n\t\t\t\t\t\tif (flowContext != null) {\n\t\t\t\t\t\t\tMDC.put(\"flowCtxt\", flowContext);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n//\t\t}\n\t}", "public static <X> ServiceTypeLoader<X> load(Class<X> serviceType) {\n return load(serviceType, Thread.currentThread().getContextClassLoader());\n }", "@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 return Optional.empty();\n }\n }\n\n return Optional.of(false);\n }" ]
Get list of replies @param topicId Unique identifier of a topic for a given group {@link Topic}. @return A reply object @throws FlickrException @see <a href="http://www.flickr.com/services/api/flickr.groups.discuss.replies.getList.html">API Documentation</a>
[ "public ReplyObject getReplyList(String topicId, int perPage, int page) throws FlickrException {\r\n ReplyList<Reply> reply = new ReplyList<Reply>();\r\n TopicList<Topic> topic = new TopicList<Topic>();\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_REPLIES_GET_LIST);\r\n\r\n parameters.put(\"topic_id\", topicId);\r\n\r\n if (perPage > 0) {\r\n parameters.put(\"per_page\", \"\" + perPage);\r\n }\r\n if (page > 0) {\r\n parameters.put(\"page\", \"\" + page);\r\n }\r\n\r\n Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n\r\n Element replyElements = response.getPayload();\r\n ReplyObject ro = new ReplyObject();\r\n NodeList replyNodes = replyElements.getElementsByTagName(\"reply\");\r\n for (int i = 0; i < replyNodes.getLength(); i++) {\r\n Element replyNodeElement = (Element) replyNodes.item(i);\r\n // Element replyElement = XMLUtilities.getChild(replyNodeElement, \"reply\");\r\n reply.add(parseReply(replyNodeElement));\r\n ro.setReplyList(reply);\r\n\r\n }\r\n NodeList topicNodes = replyElements.getElementsByTagName(\"topic\");\r\n for (int i = 0; i < topicNodes.getLength(); i++) {\r\n Element replyNodeElement = (Element) replyNodes.item(i);\r\n // Element topicElement = XMLUtilities.getChild(replyNodeElement, \"topic\");\r\n topic.add(parseTopic(replyNodeElement));\r\n ro.setTopicList(topic);\r\n }\r\n\r\n return ro;\r\n }" ]
[ "public static void checkEigenvalues() {\n DoubleMatrix A = new DoubleMatrix(new double[][]{\n {3.0, 2.0, 0.0},\n {2.0, 3.0, 2.0},\n {0.0, 2.0, 3.0}\n });\n\n DoubleMatrix E = new DoubleMatrix(3, 1);\n\n NativeBlas.dsyev('N', 'U', 3, A.data, 0, 3, E.data, 0);\n check(\"checking existence of dsyev...\", true);\n }", "public double Function2D(double x, double y) {\n double frequency = initFrequency;\n double amplitude = initAmplitude;\n double sum = 0;\n\n // octaves\n for (int i = 0; i < octaves; i++) {\n sum += SmoothedNoise(x * frequency, y * frequency) * amplitude;\n\n frequency *= 2;\n amplitude *= persistence;\n }\n return sum;\n }", "public void initialize() {\n\t\tif (dataClass == null) {\n\t\t\tthrow new IllegalStateException(\"dataClass was never set on \" + getClass().getSimpleName());\n\t\t}\n\t\tif (tableName == null) {\n\t\t\ttableName = extractTableName(databaseType, dataClass);\n\t\t}\n\t}", "public static TestSuiteResult unmarshal(File testSuite) throws IOException {\n try (InputStream stream = new FileInputStream(testSuite)) {\n return unmarshal(stream);\n }\n }", "public static boolean bidiagOuterBlocks( final int blockLength ,\n final DSubmatrixD1 A ,\n final double gammasU[],\n final double gammasV[])\n {\n// System.out.println(\"---------- Orig\");\n// A.original.print();\n\n int width = Math.min(blockLength,A.col1-A.col0);\n int height = Math.min(blockLength,A.row1-A.row0);\n\n int min = Math.min(width,height);\n\n for( int i = 0; i < min; i++ ) {\n //--- Apply reflector to the column\n\n // compute the householder vector\n if (!computeHouseHolderCol(blockLength, A, gammasU, i))\n return false;\n\n // apply to rest of the columns in the column block\n rank1UpdateMultR_Col(blockLength,A,i,gammasU[A.col0+i]);\n\n // apply to the top row block\n rank1UpdateMultR_TopRow(blockLength,A,i,gammasU[A.col0+i]);\n\n System.out.println(\"After column stuff\");\n A.original.print();\n\n //-- Apply reflector to the row\n if(!computeHouseHolderRow(blockLength,A,gammasV,i))\n return false;\n \n // apply to rest of the rows in the row block\n rank1UpdateMultL_Row(blockLength,A,i,i+1,gammasV[A.row0+i]);\n\n System.out.println(\"After update row\");\n A.original.print();\n\n // apply to the left column block\n // TODO THIS WON'T WORK!!!!!!!!!!!!!\n // Needs the whole matrix to have been updated by the left reflector to compute the correct solution\n// rank1UpdateMultL_LeftCol(blockLength,A,i,i+1,gammasV[A.row0+i]);\n\n System.out.println(\"After row stuff\");\n A.original.print();\n }\n\n return true;\n }", "public synchronized int skip(int count) {\n if (count > available) {\n count = available;\n }\n idxGet = (idxGet + count) % capacity;\n available -= count;\n return count;\n }", "public static base_response add(nitro_service client, ipset resource) throws Exception {\n\t\tipset addresource = new ipset();\n\t\taddresource.name = resource.name;\n\t\taddresource.td = resource.td;\n\t\treturn addresource.add_resource(client);\n\t}", "public String p(double value ) {\n return UtilEjml.fancyString(value,format,false,length,significant);\n }", "private static int getBlockLength(String text, int offset)\n {\n int startIndex = offset;\n boolean finished = false;\n char c;\n\n while (finished == false)\n {\n c = text.charAt(offset);\n switch (c)\n {\n case '\\r':\n case '\\n':\n case '}':\n {\n finished = true;\n break;\n }\n\n default:\n {\n ++offset;\n break;\n }\n }\n }\n\n int length = offset - startIndex;\n\n return (length);\n }" ]
Expands all tabs into spaces. Assumes the CharSequence represents a single line of text. @param self A line to expand @param tabStop The number of spaces a tab represents @return The expanded toString() of this CharSequence @see #expandLine(String, int) @since 1.8.2
[ "public static String expandLine(CharSequence self, int tabStop) {\n String s = self.toString();\n int index;\n while ((index = s.indexOf('\\t')) != -1) {\n StringBuilder builder = new StringBuilder(s);\n int count = tabStop - index % tabStop;\n builder.deleteCharAt(index);\n for (int i = 0; i < count; i++) builder.insert(index, \" \");\n s = builder.toString();\n }\n return s;\n }" ]
[ "public int executeUpdateSQL(\r\n String sqlStatement,\r\n ClassDescriptor cld,\r\n ValueContainer[] values1,\r\n ValueContainer[] values2)\r\n throws PersistenceBrokerException\r\n {\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"executeUpdateSQL: \" + sqlStatement);\r\n\r\n int result;\r\n int index;\r\n PreparedStatement stmt = null;\r\n final StatementManagerIF sm = broker.serviceStatementManager();\r\n try\r\n {\r\n stmt = sm.getPreparedStatement(cld, sqlStatement,\r\n Query.NOT_SCROLLABLE, StatementManagerIF.FETCH_SIZE_NOT_APPLICABLE, isStoredProcedure(sqlStatement));\r\n index = sm.bindValues(stmt, values1, 1);\r\n sm.bindValues(stmt, values2, index);\r\n result = stmt.executeUpdate();\r\n }\r\n catch (PersistenceBrokerException e)\r\n {\r\n logger.error(\"PersistenceBrokerException during the execution of the Update SQL query: \" + e.getMessage(), e);\r\n throw e;\r\n }\r\n catch (SQLException e)\r\n {\r\n ValueContainer[] tmp = addValues(values1, values2);\r\n throw ExceptionHelper.generateException(e, sqlStatement, cld, tmp, logger, null);\r\n }\r\n finally\r\n {\r\n sm.closeResources(stmt, null);\r\n }\r\n return result;\r\n }", "public String getVertexString() {\n if (tail() != null) {\n return \"\" + tail().index + \"-\" + head().index;\n } else {\n return \"?-\" + head().index;\n }\n }", "public static final List<String> listProjectNames(File directory)\n {\n List<String> result = new ArrayList<String>();\n\n File[] files = directory.listFiles(new FilenameFilter()\n {\n @Override public boolean accept(File dir, String name)\n {\n return name.toUpperCase().endsWith(\"STR.P3\");\n }\n });\n\n if (files != null)\n {\n for (File file : files)\n {\n String fileName = file.getName();\n String prefix = fileName.substring(0, fileName.length() - 6);\n result.add(prefix);\n }\n }\n\n Collections.sort(result);\n\n return result;\n }", "public static boolean isInSubDirectory(File dir, File file)\n {\n if (file == null)\n return false;\n\n if (file.equals(dir))\n return true;\n\n return isInSubDirectory(dir, file.getParentFile());\n }", "List<Message> getFullTrackList(final CdjStatus.TrackSourceSlot slot, final Client client, final int sortOrder)\n throws IOException, InterruptedException, TimeoutException {\n // Send the metadata menu request\n if (client.tryLockingForMenuOperations(MENU_TIMEOUT, TimeUnit.SECONDS)) {\n try {\n Message response = client.menuRequest(Message.KnownType.TRACK_MENU_REQ, Message.MenuIdentifier.MAIN_MENU, slot,\n new NumberField(sortOrder));\n final long count = response.getMenuResultsCount();\n if (count == Message.NO_MENU_RESULTS_AVAILABLE || count == 0) {\n return Collections.emptyList();\n }\n\n // Gather all the metadata menu items\n return client.renderMenuItems(Message.MenuIdentifier.MAIN_MENU, slot, CdjStatus.TrackType.REKORDBOX, response);\n }\n finally {\n client.unlockForMenuOperations();\n }\n } else {\n throw new TimeoutException(\"Unable to lock the player for menu operations\");\n }\n }", "public Weld addPackage(boolean scanRecursively, Class<?> packageClass) {\n packages.add(new PackInfo(packageClass, scanRecursively));\n return this;\n }", "public DomainList getPhotosetDomains(Date date, String photosetId, int perPage, int page) throws FlickrException {\n return getDomains(METHOD_GET_PHOTOSET_DOMAINS, \"photoset_id\", photosetId, date, perPage, page);\n }", "@Override\n public void init(NamedList args) {\n\n Object regex = args.remove(PARAM_REGEX);\n if (null == regex) {\n throw new SolrException(ErrorCode.SERVER_ERROR, \"Missing required init parameter: \" + PARAM_REGEX);\n }\n try {\n m_regex = Pattern.compile(regex.toString());\n } catch (PatternSyntaxException e) {\n throw new SolrException(ErrorCode.SERVER_ERROR, \"Invalid regex: \" + regex, e);\n }\n\n Object replacement = args.remove(PARAM_REPLACEMENT);\n if (null == replacement) {\n throw new SolrException(ErrorCode.SERVER_ERROR, \"Missing required init parameter: \" + PARAM_REPLACEMENT);\n }\n m_replacement = replacement.toString();\n\n Object source = args.remove(PARAM_SOURCE);\n if (null == source) {\n throw new SolrException(ErrorCode.SERVER_ERROR, \"Missing required init parameter: \" + PARAM_SOURCE);\n }\n m_source = source.toString();\n\n Object target = args.remove(PARAM_TARGET);\n if (null == target) {\n throw new SolrException(ErrorCode.SERVER_ERROR, \"Missing required init parameter: \" + PARAM_TARGET);\n }\n m_target = target.toString();\n\n }", "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 e) {\n throw new IllegalStateException(String.format(\"Failed to create DirectByteBuffer: %s\", e.getMessage()));\n }\n }" ]
Configures a worker pool for the converter. @param corePoolSize The core pool size of the worker pool. @param maximumPoolSize The maximum pool size of the worker pool. @param keepAliveTime The keep alive time of the worker pool. @param unit The time unit of the specified keep alive time. @return This builder instance.
[ "public ConverterServerBuilder workerPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit) {\n assertNumericArgument(corePoolSize, true);\n assertNumericArgument(maximumPoolSize, true);\n assertNumericArgument(corePoolSize + maximumPoolSize, false);\n assertNumericArgument(keepAliveTime, true);\n this.corePoolSize = corePoolSize;\n this.maximumPoolSize = maximumPoolSize;\n this.keepAliveTime = unit.toMillis(keepAliveTime);\n return this;\n }" ]
[ "private Query getFKQuery(Object obj, ClassDescriptor cld, CollectionDescriptor cds)\r\n {\r\n Query fkQuery;\r\n QueryByCriteria fkQueryCrit;\r\n\r\n if (cds.isMtoNRelation())\r\n {\r\n fkQueryCrit = getFKQueryMtoN(obj, cld, cds);\r\n }\r\n else\r\n {\r\n fkQueryCrit = getFKQuery1toN(obj, cld, cds);\r\n }\r\n\r\n // check if collection must be ordered\r\n if (!cds.getOrderBy().isEmpty())\r\n {\r\n Iterator iter = cds.getOrderBy().iterator();\r\n while (iter.hasNext())\r\n {\r\n fkQueryCrit.addOrderBy((FieldHelper)iter.next());\r\n }\r\n }\r\n\r\n // BRJ: customize the query\r\n if (cds.getQueryCustomizer() != null)\r\n {\r\n fkQuery = cds.getQueryCustomizer().customizeQuery(obj, pb, cds, fkQueryCrit);\r\n }\r\n else\r\n {\r\n fkQuery = fkQueryCrit;\r\n }\r\n\r\n return fkQuery;\r\n }", "private void verifyOrAddStore(String clusterURL,\n String keySchema,\n String valueSchema) {\n String newStoreDefXml = VoldemortUtils.getStoreDefXml(\n storeName,\n props.getInt(BUILD_REPLICATION_FACTOR, 2),\n props.getInt(BUILD_REQUIRED_READS, 1),\n props.getInt(BUILD_REQUIRED_WRITES, 1),\n props.getNullableInt(BUILD_PREFERRED_READS),\n props.getNullableInt(BUILD_PREFERRED_WRITES),\n props.getString(PUSH_FORCE_SCHEMA_KEY, keySchema),\n props.getString(PUSH_FORCE_SCHEMA_VALUE, valueSchema),\n description,\n owners);\n\n log.info(\"Verifying store against cluster URL: \" + clusterURL + \"\\n\" + newStoreDefXml.toString());\n StoreDefinition newStoreDef = VoldemortUtils.getStoreDef(newStoreDefXml);\n\n try {\n adminClientPerCluster.get(clusterURL).storeMgmtOps.verifyOrAddStore(newStoreDef, \"BnP config/data\",\n enableStoreCreation, this.storeVerificationExecutorService);\n } catch (UnreachableStoreException e) {\n log.info(\"verifyOrAddStore() failed on some nodes for clusterURL: \" + clusterURL + \" (this is harmless).\", e);\n // When we can't reach some node, we just skip it and won't create the store on it.\n // Next time BnP is run while the node is up, it will get the store created.\n } // Other exceptions need to bubble up!\n\n storeDef = newStoreDef;\n }", "public static <T> boolean addAll(Collection<T> target, Iterator<? extends T> iterator) {\n Preconditions.checkArgumentNotNull(target, \"target\");\n boolean modified = false;\n while (iterator.hasNext()) {\n modified |= target.add(iterator.next());\n }\n return modified;\n }", "public static base_responses add(nitro_service client, snmpuser resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tsnmpuser addresources[] = new snmpuser[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new snmpuser();\n\t\t\t\taddresources[i].name = resources[i].name;\n\t\t\t\taddresources[i].group = resources[i].group;\n\t\t\t\taddresources[i].authtype = resources[i].authtype;\n\t\t\t\taddresources[i].authpasswd = resources[i].authpasswd;\n\t\t\t\taddresources[i].privtype = resources[i].privtype;\n\t\t\t\taddresources[i].privpasswd = resources[i].privpasswd;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "public static base_responses add(nitro_service client, dnsaaaarec resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tdnsaaaarec addresources[] = new dnsaaaarec[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new dnsaaaarec();\n\t\t\t\taddresources[i].hostname = resources[i].hostname;\n\t\t\t\taddresources[i].ipv6address = resources[i].ipv6address;\n\t\t\t\taddresources[i].ttl = resources[i].ttl;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "public static void Forward(double[][] data) {\n double[][] result = new double[data.length][data[0].length];\n\n for (int m = 0; m < data.length; m++) {\n for (int n = 0; n < data[0].length; n++) {\n double sum = 0;\n for (int i = 0; i < result.length; i++) {\n for (int k = 0; k < data.length; k++) {\n sum += data[i][k] * cas(((2.0 * Math.PI) / data.length) * (i * m + k * n));\n }\n result[m][n] = (1.0 / data.length) * sum;\n }\n }\n }\n\n for (int i = 0; i < data.length; i++) {\n for (int j = 0; j < data[0].length; j++) {\n data[i][j] = result[i][j];\n }\n }\n }", "private ClassDescriptor discoverDescriptor(Class clazz)\r\n {\r\n ClassDescriptor result = (ClassDescriptor) descriptorTable.get(clazz.getName());\r\n\r\n if (result == null)\r\n {\r\n Class superClass = clazz.getSuperclass();\r\n // only recurse if the superClass is not java.lang.Object\r\n if (superClass != null)\r\n {\r\n result = discoverDescriptor(superClass);\r\n }\r\n if (result == null)\r\n {\r\n // we're also checking the interfaces as there could be normal\r\n // mappings for them in the repository (using factory-class,\r\n // factory-method, and the property field accessor)\r\n Class[] interfaces = clazz.getInterfaces();\r\n\r\n if ((interfaces != null) && (interfaces.length > 0))\r\n {\r\n for (int idx = 0; (idx < interfaces.length) && (result == null); idx++)\r\n {\r\n result = discoverDescriptor(interfaces[idx]);\r\n }\r\n }\r\n }\r\n\r\n if (result != null)\r\n {\r\n /**\r\n * Kuali Foundation modification -- 6/19/2009\r\n */\r\n \tsynchronized (descriptorTable) {\r\n /**\r\n * End of Kuali Foundation modification\r\n */\r\n \t\tdescriptorTable.put(clazz.getName(), result);\r\n /**\r\n * Kuali Foundation modification -- 6/19/2009\r\n */\r\n \t}\r\n /**\r\n * End of Kuali Foundation modification\r\n */\r\n }\r\n }\r\n return result;\r\n }", "private void readTasks(Project gpProject)\n {\n Tasks tasks = gpProject.getTasks();\n readTaskCustomPropertyDefinitions(tasks);\n for (net.sf.mpxj.ganttproject.schema.Task task : tasks.getTask())\n {\n readTask(m_projectFile, task);\n }\n }", "synchronized public void completeTask(int taskId, int partitionStoresMigrated) {\n tasksInFlight.remove(taskId);\n\n numTasksCompleted++;\n numPartitionStoresMigrated += partitionStoresMigrated;\n\n updateProgressBar();\n }" ]
Call the onQueryExecuteTimeLimitExceeded hook if necessary @param sql sql statement that took too long @param queryStartTime time when query was started.
[ "protected void queryTimerEnd(String sql, long queryStartTime) {\r\n\t\tif ((this.queryExecuteTimeLimit != 0) \r\n\t\t\t\t&& (this.connectionHook != null)){\r\n\t\t\tlong timeElapsed = (System.nanoTime() - queryStartTime);\r\n\t\t\t\r\n\t\t\tif (timeElapsed > this.queryExecuteTimeLimit){\r\n\t\t\t\tthis.connectionHook.onQueryExecuteTimeLimitExceeded(this.connectionHandle, this, sql, this.logParams, timeElapsed);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif (this.statisticsEnabled){\r\n\t\t\tthis.statistics.incrementStatementsExecuted();\r\n\t\t\tthis.statistics.addStatementExecuteTime(System.nanoTime() - queryStartTime);\r\n\t\t\t\r\n\t\t}\r\n\r\n\t}" ]
[ "public static void endRequest() {\n final List<RequestScopedItem> result = CACHE.get();\n if (result != null) {\n CACHE.remove();\n for (final RequestScopedItem item : result) {\n item.invalidate();\n }\n }\n }", "public static Field[] getDeclaredFieldsInHierarchy(Class<?> clazz) {\n\n if (clazz.isPrimitive()) {\n throw new IllegalArgumentException(\"Primitive types not supported.\");\n }\n\n List<Field> result = new ArrayList<Field>();\n\n while (true) {\n\n if (clazz == Object.class) {\n break;\n }\n\n result.addAll(Arrays.asList(clazz.getDeclaredFields()));\n clazz = clazz.getSuperclass();\n }\n\n return result.toArray(new Field[result.size()]);\n }", "@Override\r\n public V remove(Object key) {\r\n if (fast) {\r\n synchronized (this) {\r\n Map<K, V> temp = cloneMap(map);\r\n V result = temp.remove(key);\r\n map = temp;\r\n return (result);\r\n }\r\n } else {\r\n synchronized (map) {\r\n return (map.remove(key));\r\n }\r\n }\r\n }", "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 = (double) i - mean;\n // accumulate std.dev.\n stddev += diff * diff * hits;\n // accumalate total\n total += hits;\n }\n\n return ( total == 0 ) ? 0 : Math.sqrt( stddev / (total - 1) );\n }", "public static base_response add(nitro_service client, gslbsite resource) throws Exception {\n\t\tgslbsite addresource = new gslbsite();\n\t\taddresource.sitename = resource.sitename;\n\t\taddresource.sitetype = resource.sitetype;\n\t\taddresource.siteipaddress = resource.siteipaddress;\n\t\taddresource.publicip = resource.publicip;\n\t\taddresource.metricexchange = resource.metricexchange;\n\t\taddresource.nwmetricexchange = resource.nwmetricexchange;\n\t\taddresource.sessionexchange = resource.sessionexchange;\n\t\taddresource.triggermonitor = resource.triggermonitor;\n\t\taddresource.parentsite = resource.parentsite;\n\t\treturn addresource.add_resource(client);\n\t}", "public boolean matches(HostName host) {\n\t\tif(this == host) {\n\t\t\treturn true;\n\t\t}\n\t\tif(isValid()) {\n\t\t\tif(host.isValid()) {\n\t\t\t\tif(isAddressString()) {\n\t\t\t\t\treturn host.isAddressString()\n\t\t\t\t\t\t\t&& asAddressString().equals(host.asAddressString())\n\t\t\t\t\t\t\t&& Objects.equals(getPort(), host.getPort())\n\t\t\t\t\t\t\t&& Objects.equals(getService(), host.getService());\n\t\t\t\t}\n\t\t\t\tif(host.isAddressString()) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tString thisHost = parsedHost.getHost();\n\t\t\t\tString otherHost = host.parsedHost.getHost();\n\t\t\t\tif(!thisHost.equals(otherHost)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn Objects.equals(parsedHost.getEquivalentPrefixLength(), host.parsedHost.getEquivalentPrefixLength()) &&\n\t\t\t\t\t\tObjects.equals(parsedHost.getMask(), host.parsedHost.getMask()) &&\n\t\t\t\t\t\tObjects.equals(parsedHost.getPort(), host.parsedHost.getPort()) &&\n\t\t\t\t\t\tObjects.equals(parsedHost.getService(), host.parsedHost.getService());\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\treturn !host.isValid() && toString().equals(host.toString());\n\t}", "static SortedSet<String> createStatsItems(String statsType)\n throws IOException {\n SortedSet<String> statsItems = new TreeSet<>();\n SortedSet<String> functionItems = new TreeSet<>();\n if (statsType != null) {\n Matcher m = fpStatsItems.matcher(statsType.trim());\n while (m.find()) {\n String tmpStatsItem = m.group(2).trim();\n if (STATS_TYPES.contains(tmpStatsItem)) {\n statsItems.add(tmpStatsItem);\n } else if (tmpStatsItem.equals(STATS_TYPE_ALL)) {\n for (String type : STATS_TYPES) {\n statsItems.add(type);\n }\n } else if (STATS_FUNCTIONS.contains(tmpStatsItem)) {\n if (m.group(3) == null) {\n throw new IOException(\"'\" + tmpStatsItem + \"' should be called as '\"\n + tmpStatsItem + \"()' with an optional argument\");\n } else {\n functionItems.add(m.group(1).trim());\n }\n } else {\n throw new IOException(\"unknown statsType '\" + tmpStatsItem + \"'\");\n }\n }\n }\n if (statsItems.size() == 0 && functionItems.size() == 0) {\n statsItems.add(STATS_TYPE_SUM);\n statsItems.add(STATS_TYPE_N);\n statsItems.add(STATS_TYPE_MEAN);\n }\n if (functionItems.size() > 0) {\n statsItems.addAll(functionItems);\n }\n return statsItems;\n }", "public static String addFolderSlashIfNeeded(String folderName) {\n if (!\"\".equals(folderName) && !folderName.endsWith(\"/\")) {\n return folderName + \"/\";\n } else {\n return folderName;\n }\n }", "public boolean isIPv4Mapped() {\n\t\t//::ffff:x:x/96 indicates IPv6 address mapped to IPv4\n\t\tif(getSegment(5).matches(IPv6Address.MAX_VALUE_PER_SEGMENT)) {\n\t\t\tfor(int i = 0; i < 5; i++) {\n\t\t\t\tif(!getSegment(i).isZero()) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}" ]
Creates a combined list of Entries using the provided mapping file, and sorts them by first by priority, then the number of tokens in the regex. @param mapping The path to a file of mappings @return a sorted list of Entries
[ "private Map<String, Entry> readEntries(String mapping, boolean ignoreCase) {\n\t\tMap<String, Entry> entries = new HashMap<>();\n\n\t\ttry {\n\t\t\t// ms, 2010-10-05: try to load the file from the CLASSPATH first\n\t\t\tInputStream is = getClass().getClassLoader().getResourceAsStream(mapping);\n\t\t\t// if not found in the CLASSPATH, load from the file system\n\t\t\tif (is == null) is = new FileInputStream(mapping);\n\t\t\tBufferedReader rd = new BufferedReader(new InputStreamReader(is));\n\n\t\t\tint lineCount = 0;\n\t\t\tfor (String line; (line = rd.readLine()) != null; ) {\n\t\t\t\tlineCount ++;\n\t\t\t\tString[] split = line.split(\"\\t\");\n\t\t\t\tif (split.length < 2 || split.length > 4)\n\t\t\t\t\tthrow new RuntimeException(\"Provided mapping file is in wrong format\");\n\t\t\t\tif (split[1].trim().equalsIgnoreCase(\"AS\")) System.err.println(\"ERRRR \" + mapping + \"|\" + line + \" at \" + lineCount);\n\t\t\t\tString stringLine = split[1].trim();\n\t\t\t\tif (ignoreCase) stringLine = stringLine.toLowerCase();\n\t\t\t\tString[] words = stringLine.split(\"\\\\s+\");\n\t\t\t\tString type = split[0].trim();\n\t\t\t\tSet<String> overwritableTypes = new HashSet<String>();\n\t\t\t\toverwritableTypes.add(flags.backgroundSymbol);\n\t\t\t\toverwritableTypes.add(null);\n\t\t\t\tdouble priority = 0;\n\t\t\t\tList<String> tokens = new ArrayList<String>();\n\n\t\t\t\ttry {\n\t\t\t\t\tif (split.length >= 3)\n\t\t\t\t\t\toverwritableTypes.addAll(Arrays.asList(split[2].trim().split(\",\")));\n\t\t\t\t\tif (split.length == 4)\n\t\t\t\t\t\tpriority = Double.parseDouble(split[3].trim());\n\n\t\t\t\t\tfor (String str : words) {\n\t\t\t\t\t\ttokens.add(str);\n\t\t\t\t\t}\n\t\t\t\t} catch(NumberFormatException e) {\n\t\t\t\t\tSystem.err.println(\"ERROR: Invalid line \" + lineCount + \" in regexner file \" + mapping + \": \\\"\" + line + \"\\\"!\");\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t\taddEntry(words, type, priority, overwritableTypes);\n\t\t\t}\n\t\t\trd.close();\n\t\t\tis.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn entries;\n\t}" ]
[ "public <V> V attachIfAbsent(final AttachmentKey<V> key, final V value) {\n assert key != null;\n return key.cast(contextAttachments.putIfAbsent(key, value));\n }", "public static Region create(String name, String label) {\n Region region = VALUES_BY_NAME.get(name.toLowerCase());\n if (region != null) {\n return region;\n } else {\n return new Region(name, label);\n }\n }", "public static void executeCommand(String[] args) throws IOException {\n\n OptionParser parser = getParser();\n\n // declare parameters\n String url = null;\n\n // parse command-line input\n OptionSet options = parser.parse(args);\n if(options.has(AdminParserUtils.OPT_HELP)) {\n printHelp(System.out);\n return;\n }\n\n // check required options and/or conflicting options\n AdminParserUtils.checkRequired(options, AdminParserUtils.OPT_URL);\n\n // load parameters\n url = (String) options.valueOf(AdminParserUtils.OPT_URL);\n\n // execute command\n AdminClient adminClient = AdminToolUtils.getAdminClient(url);\n\n doMetaCheckVersion(adminClient);\n }", "public static gslbdomain_stats get(nitro_service service, String name) throws Exception{\n\t\tgslbdomain_stats obj = new gslbdomain_stats();\n\t\tobj.set_name(name);\n\t\tgslbdomain_stats response = (gslbdomain_stats) obj.stat_resource(service);\n\t\treturn response;\n\t}", "public void addLicense(final String gavc, final String licenseId) {\n final DbArtifact dbArtifact = getArtifact(gavc);\n\n // Try to find an existing license that match the new one\n final LicenseHandler licenseHandler = new LicenseHandler(repositoryHandler);\n final DbLicense license = licenseHandler.resolve(licenseId);\n\n // If there is no existing license that match this one let's use the provided value but\n // only if the artifact has no license yet. Otherwise it could mean that users has already\n // identify the license manually.\n if(license == null){\n if(dbArtifact.getLicenses().isEmpty()){\n LOG.warn(\"Add reference to a non existing license called \" + licenseId + \" in artifact \" + dbArtifact.getGavc());\n repositoryHandler.addLicenseToArtifact(dbArtifact, licenseId);\n }\n }\n // Add only if the license is not already referenced\n else if(!dbArtifact.getLicenses().contains(license.getName())){\n repositoryHandler.addLicenseToArtifact(dbArtifact, license.getName());\n }\n }", "public void createNamespace() {\n Map<String, String> namespaceAnnotations = annotationProvider.create(session.getId(), Constants.RUNNING_STATUS);\n if (namespaceService.exists(session.getNamespace())) {\n //namespace exists\n } else if (configuration.isNamespaceLazyCreateEnabled()) {\n namespaceService.create(session.getNamespace(), namespaceAnnotations);\n } else {\n throw new IllegalStateException(\"Namespace [\" + session.getNamespace() + \"] doesn't exist and lazily creation of namespaces is disabled. \"\n + \"Either use an existing one, or set `namespace.lazy.enabled` to true.\");\n }\n }", "public void setDuration(float start, float end)\n {\n for (GVRAnimation anim : mAnimations)\n {\n anim.setDuration(start,end);\n }\n }", "@Override\n protected String getToken() {\n GetAccessTokenResult token = accessToken.get();\n if (token == null || isExpired(token)\n || (isAboutToExpire(token) && refreshInProgress.compareAndSet(false, true))) {\n lock.lock();\n try {\n token = accessToken.get();\n if (token == null || isAboutToExpire(token)) {\n token = accessTokenProvider.getNewAccessToken(oauthScopes);\n accessToken.set(token);\n cacheExpirationHeadroom.set(getNextCacheExpirationHeadroom());\n }\n } finally {\n refreshInProgress.set(false);\n lock.unlock();\n }\n }\n return token.getAccessToken();\n }", "static int lastArgMatchesVarg(Parameter[] params, ClassNode... args) {\n if (!isVargs(params)) return -1;\n // case length ==0 handled already\n // we have now two cases,\n // the argument is wrapped in the vargs array or\n // the argument is an array that can be used for the vargs part directly\n // we test only the wrapping part, since the non wrapping is done already\n ClassNode lastParamType = params[params.length - 1].getType();\n ClassNode ptype = lastParamType.getComponentType();\n ClassNode arg = args[args.length - 1];\n if (isNumberType(ptype) && isNumberType(arg) && !ptype.equals(arg)) return -1;\n return isAssignableTo(arg, ptype)?Math.min(getDistance(arg, lastParamType), getDistance(arg, ptype)):-1;\n }" ]
Set the view frustum to pick against from the minimum and maximum corners. The viewpoint of the frustum is the center of the scene object the picker is attached to. The view direction is the forward direction of that scene object. The frustum will pick what a camera attached to the scene object with that view frustum would see. If the frustum is not attached to a scene object, it defaults to the view frustum of the main camera of the scene. @param frustum array of 6 floats as follows: frustum[0] = left corner of frustum frustum[1] = bottom corner of frustum frustum[2] = front corner of frustum (near plane) frustum[3] = right corner of frustum frustum[4] = top corner of frustum frustum[5 = back corner of frustum (far plane)
[ "public void setFrustum(float[] frustum)\n {\n Matrix4f projMatrix = new Matrix4f();\n projMatrix.setFrustum(frustum[0], frustum[3], frustum[1], frustum[4], frustum[2], frustum[5]);\n setFrustum(projMatrix);\n }" ]
[ "public void update(short number) {\n byte[] numberInBytes = new byte[ByteUtils.SIZE_OF_SHORT];\n ByteUtils.writeShort(numberInBytes, number, 0);\n update(numberInBytes);\n }", "private void addJoinInfo(JoinType type, String localColumnName, String joinedColumnName,\n\t\t\tQueryBuilder<?, ?> joinedQueryBuilder, JoinWhereOperation operation) throws SQLException {\n\t\tJoinInfo joinInfo = new JoinInfo(type, joinedQueryBuilder, operation);\n\t\tif (localColumnName == null) {\n\t\t\tmatchJoinedFields(joinInfo, joinedQueryBuilder);\n\t\t} else {\n\t\t\tmatchJoinedFieldsByName(joinInfo, localColumnName, joinedColumnName, joinedQueryBuilder);\n\t\t}\n\t\tif (joinList == null) {\n\t\t\tjoinList = new ArrayList<JoinInfo>();\n\t\t}\n\t\tjoinList.add(joinInfo);\n\t}", "private void validate(Object object) {\n\t\tSet<ConstraintViolation<Object>> viols = validator.validate(object);\n\t\tfor (ConstraintViolation<Object> constraintViolation : viols) {\n\t\t\tif (Null.class.isAssignableFrom(constraintViolation.getConstraintDescriptor().getAnnotation().getClass())) {\n\t\t\t\tObject o = constraintViolation.getLeafBean();\n\t\t\t\tIterator<Node> iterator = constraintViolation.getPropertyPath().iterator();\n\t\t\t\tString propertyName = null;\n\t\t\t\twhile (iterator.hasNext()) {\n\t\t\t\t\tpropertyName = iterator.next().getName();\n\t\t\t\t}\n\t\t\t\tif (propertyName != null) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tPropertyDescriptor descriptor = BeanUtils.getPropertyDescriptor(o.getClass(), propertyName);\n\t\t\t\t\t\tdescriptor.getWriteMethod().invoke(o, new Object[] { null });\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public static sslcipher[] get(nitro_service service, String ciphergroupname[]) throws Exception{\n\t\tif (ciphergroupname !=null && ciphergroupname.length>0) {\n\t\t\tsslcipher response[] = new sslcipher[ciphergroupname.length];\n\t\t\tsslcipher obj[] = new sslcipher[ciphergroupname.length];\n\t\t\tfor (int i=0;i<ciphergroupname.length;i++) {\n\t\t\t\tobj[i] = new sslcipher();\n\t\t\t\tobj[i].set_ciphergroupname(ciphergroupname[i]);\n\t\t\t\tresponse[i] = (sslcipher) obj[i].get_resource(service);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t\treturn null;\n\t}", "public static String get(MessageKey key) {\n return data.getProperty(key.toString(), key.toString());\n }", "public static int lookupShaper(String name) {\r\n if (name == null) {\r\n return NOWORDSHAPE;\r\n } else if (name.equalsIgnoreCase(\"dan1\")) {\r\n return WORDSHAPEDAN1;\r\n } else if (name.equalsIgnoreCase(\"chris1\")) {\r\n return WORDSHAPECHRIS1;\r\n } else if (name.equalsIgnoreCase(\"dan2\")) {\r\n return WORDSHAPEDAN2;\r\n } else if (name.equalsIgnoreCase(\"dan2useLC\")) {\r\n return WORDSHAPEDAN2USELC;\r\n } else if (name.equalsIgnoreCase(\"dan2bio\")) {\r\n return WORDSHAPEDAN2BIO;\r\n } else if (name.equalsIgnoreCase(\"dan2bioUseLC\")) {\r\n return WORDSHAPEDAN2BIOUSELC;\r\n } else if (name.equalsIgnoreCase(\"jenny1\")) {\r\n return WORDSHAPEJENNY1;\r\n } else if (name.equalsIgnoreCase(\"jenny1useLC\")) {\r\n return WORDSHAPEJENNY1USELC;\r\n } else if (name.equalsIgnoreCase(\"chris2\")) {\r\n return WORDSHAPECHRIS2;\r\n } else if (name.equalsIgnoreCase(\"chris2useLC\")) {\r\n return WORDSHAPECHRIS2USELC;\r\n } else if (name.equalsIgnoreCase(\"chris3\")) {\r\n return WORDSHAPECHRIS3;\r\n } else if (name.equalsIgnoreCase(\"chris3useLC\")) {\r\n return WORDSHAPECHRIS3USELC;\r\n } else if (name.equalsIgnoreCase(\"chris4\")) {\r\n return WORDSHAPECHRIS4;\r\n } else if (name.equalsIgnoreCase(\"digits\")) {\r\n return WORDSHAPEDIGITS;\r\n } else {\r\n return NOWORDSHAPE;\r\n }\r\n }", "public Duration getDuration(int field) throws MPXJException\n {\n Duration result;\n\n if ((field < m_fields.length) && (m_fields[field].length() != 0))\n {\n result = DurationUtility.getInstance(m_fields[field], m_formats.getDurationDecimalFormat(), m_locale);\n }\n else\n {\n result = null;\n }\n\n return (result);\n }", "public static Class<?> determineCommonAncestor(Class<?> clazz1, Class<?> clazz2) {\n\t\tif (clazz1 == null) {\n\t\t\treturn clazz2;\n\t\t}\n\t\tif (clazz2 == null) {\n\t\t\treturn clazz1;\n\t\t}\n\t\tif (clazz1.isAssignableFrom(clazz2)) {\n\t\t\treturn clazz1;\n\t\t}\n\t\tif (clazz2.isAssignableFrom(clazz1)) {\n\t\t\treturn clazz2;\n\t\t}\n\t\tClass<?> ancestor = clazz1;\n\t\tdo {\n\t\t\tancestor = ancestor.getSuperclass();\n\t\t\tif (ancestor == null || Object.class.equals(ancestor)) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\twhile (!ancestor.isAssignableFrom(clazz2));\n\t\treturn ancestor;\n\t}", "boolean awaitState(final InternalState expected) {\n synchronized (this) {\n final InternalState initialRequired = this.requiredState;\n for(;;) {\n final InternalState required = this.requiredState;\n // Stop in case the server failed to reach the state\n if(required == InternalState.FAILED) {\n return false;\n // Stop in case the required state changed\n } else if (initialRequired != required) {\n return false;\n }\n final InternalState current = this.internalState;\n if(expected == current) {\n return true;\n }\n try {\n wait();\n } catch(InterruptedException e) {\n Thread.currentThread().interrupt();\n return false;\n }\n }\n }\n }" ]
Use this API to fetch sslciphersuite resource of given name .
[ "public static sslciphersuite get(nitro_service service, String ciphername) throws Exception{\n\t\tsslciphersuite obj = new sslciphersuite();\n\t\tobj.set_ciphername(ciphername);\n\t\tsslciphersuite response = (sslciphersuite) obj.get_resource(service);\n\t\treturn response;\n\t}" ]
[ "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\tSystem.err.println(e.getMessage());\n\t\t\tSystem.exit(1);\n\t\t}\n\t}", "@PrefMetadata(type = CmsElementViewPreference.class)\n public String getElementView() {\n\n return m_settings.getAdditionalPreference(CmsElementViewPreference.PREFERENCE_NAME, false);\n }", "protected static void captureSystemStreams(boolean captureOut, boolean captureErr){\r\n if(captureOut){\r\n System.setOut(new RedwoodPrintStream(STDOUT, realSysOut));\r\n }\r\n if(captureErr){\r\n System.setErr(new RedwoodPrintStream(STDERR, realSysErr));\r\n }\r\n }", "public TopicList<Topic> getTopicsList(String groupId, int perPage, int page) throws FlickrException {\r\n TopicList<Topic> topicList = new TopicList<Topic>();\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_TOPICS_GET_LIST);\r\n\r\n parameters.put(\"group_id\", groupId);\r\n\r\n if (perPage > 0) {\r\n parameters.put(\"per_page\", \"\" + perPage);\r\n }\r\n if (page > 0) {\r\n parameters.put(\"page\", \"\" + page);\r\n }\r\n\r\n Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n\r\n Element topicElements = response.getPayload();\r\n topicList.setPage(topicElements.getAttribute(\"page\"));\r\n topicList.setPages(topicElements.getAttribute(\"pages\"));\r\n topicList.setPerPage(topicElements.getAttribute(\"perpage\"));\r\n topicList.setTotal(topicElements.getAttribute(\"total\"));\r\n topicList.setGroupId(topicElements.getAttribute(\"group_id\"));\r\n topicList.setIconServer(Integer.parseInt(topicElements.getAttribute(\"iconserver\")));\r\n topicList.setIconFarm(Integer.parseInt(topicElements.getAttribute(\"iconfarm\")));\r\n topicList.setName(topicElements.getAttribute(\"name\"));\r\n topicList.setMembers(Integer.parseInt(topicElements.getAttribute(\"members\")));\r\n topicList.setPrivacy(Integer.parseInt(topicElements.getAttribute(\"privacy\")));\r\n topicList.setLanguage(topicElements.getAttribute(\"lang\"));\r\n topicList.setIsPoolModerated(\"1\".equals(topicElements.getAttribute(\"ispoolmoderated\")));\r\n\r\n NodeList topicNodes = topicElements.getElementsByTagName(\"topic\");\r\n for (int i = 0; i < topicNodes.getLength(); i++) {\r\n Element element = (Element) topicNodes.item(i);\r\n topicList.add(parseTopic(element));\r\n }\r\n return topicList;\r\n }", "public void setModel(Database databaseModel, DescriptorRepository objModel)\r\n {\r\n _dbModel = databaseModel;\r\n _preparedModel = new PreparedModel(objModel, databaseModel);\r\n }", "private void updateDates(Task parentTask)\n {\n if (parentTask.hasChildTasks())\n {\n Date plannedStartDate = null;\n Date plannedFinishDate = null;\n\n for (Task task : parentTask.getChildTasks())\n {\n updateDates(task);\n plannedStartDate = DateHelper.min(plannedStartDate, task.getStart());\n plannedFinishDate = DateHelper.max(plannedFinishDate, task.getFinish());\n }\n\n parentTask.setStart(plannedStartDate);\n parentTask.setFinish(plannedFinishDate);\n }\n }", "public void checkAllRequirementsSatisfied(final String currentPath) {\n StringBuilder errors = new StringBuilder();\n\n for (Field field: this.dependantsInJson) {\n final Collection<String> requirements = this.dependantToRequirementsMap.get(field);\n if (!requirements.isEmpty()) {\n errors.append(\"\\n\");\n String type = field.getType().getName();\n if (field.getType().isArray()) {\n type = field.getType().getComponentType().getName() + \"[]\";\n }\n errors.append(\"\\t* \").append(type).append(' ').append(field.getName()).append(\" depends on \")\n .append(requirements);\n }\n }\n Assert.equals(0, errors.length(),\n \"\\nErrors were detected when analysing the @Requires dependencies of '\" +\n currentPath + \"': \" + errors);\n }", "@SuppressWarnings({\"WeakerAccess\", \"unused\"}) // For library users\n public void registerFilters(List<AlgoliaFilter> filters) {\n for (final AlgoliaFilter filter : filters) {\n searcher.addFacet(filter.getAttribute());\n }\n }", "private Path getPath(PropertyWriter writer, JsonStreamContext sc) {\n LinkedList<PathElement> elements = new LinkedList<>();\n\n if (sc != null) {\n elements.add(new PathElement(writer.getName(), sc.getCurrentValue()));\n sc = sc.getParent();\n }\n\n while (sc != null) {\n if (sc.getCurrentName() != null && sc.getCurrentValue() != null) {\n elements.addFirst(new PathElement(sc.getCurrentName(), sc.getCurrentValue()));\n }\n sc = sc.getParent();\n }\n\n return new Path(elements);\n }" ]
Compose src onto dst using the alpha of sel to interpolate between the two. I can't think of a way to do this using AlphaComposite. @param src the source raster @param dst the destination raster @param sel the mask raster
[ "public static void composeThroughMask(Raster src, WritableRaster dst, Raster sel) {\n\t\tint x = src.getMinX();\n\t\tint y = src.getMinY();\n\t\tint w = src.getWidth();\n\t\tint h = src.getHeight();\n\n\t\tint srcRGB[] = null;\n\t\tint selRGB[] = null;\n\t\tint dstRGB[] = null;\n\n\t\tfor ( int i = 0; i < h; i++ ) {\n\t\t\tsrcRGB = src.getPixels(x, y, w, 1, srcRGB);\n\t\t\tselRGB = sel.getPixels(x, y, w, 1, selRGB);\n\t\t\tdstRGB = dst.getPixels(x, y, w, 1, dstRGB);\n\n\t\t\tint k = x;\n\t\t\tfor ( int j = 0; j < w; j++ ) {\n\t\t\t\tint sr = srcRGB[k];\n\t\t\t\tint dir = dstRGB[k];\n\t\t\t\tint sg = srcRGB[k+1];\n\t\t\t\tint dig = dstRGB[k+1];\n\t\t\t\tint sb = srcRGB[k+2];\n\t\t\t\tint dib = dstRGB[k+2];\n\t\t\t\tint sa = srcRGB[k+3];\n\t\t\t\tint dia = dstRGB[k+3];\n\n\t\t\t\tfloat a = selRGB[k+3]/255f;\n\t\t\t\tfloat ac = 1-a;\n\n\t\t\t\tdstRGB[k] = (int)(a*sr + ac*dir); \n\t\t\t\tdstRGB[k+1] = (int)(a*sg + ac*dig); \n\t\t\t\tdstRGB[k+2] = (int)(a*sb + ac*dib); \n\t\t\t\tdstRGB[k+3] = (int)(a*sa + ac*dia);\n\t\t\t\tk += 4;\n\t\t\t}\n\n\t\t\tdst.setPixels(x, y, w, 1, dstRGB);\n\t\t\ty++;\n\t\t}\n\t}" ]
[ "public LayerType toDto(Class<? extends com.vividsolutions.jts.geom.Geometry> geometryClass) {\n\t\tif (geometryClass == LineString.class) {\n\t\t\treturn LayerType.LINESTRING;\n\t\t} else if (geometryClass == MultiLineString.class) {\n\t\t\treturn LayerType.MULTILINESTRING;\n\t\t} else if (geometryClass == Point.class) {\n\t\t\treturn LayerType.POINT;\n\t\t} else if (geometryClass == MultiPoint.class) {\n\t\t\treturn LayerType.MULTIPOINT;\n\t\t} else if (geometryClass == Polygon.class) {\n\t\t\treturn LayerType.POLYGON;\n\t\t} else if (geometryClass == MultiPolygon.class) {\n\t\t\treturn LayerType.MULTIPOLYGON;\n\t\t} else {\n\t\t\treturn LayerType.GEOMETRY;\n\t\t}\n\t}", "public AsciiTable setPaddingRightChar(Character paddingRightChar) {\r\n\t\tfor(AT_Row row : this.rows){\r\n\t\t\tif(row.getType()==TableRowType.CONTENT){\r\n\t\t\t\trow.setPaddingRightChar(paddingRightChar);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}", "public int readFrom(byte[] src, int srcOffset, long destOffset, int length) {\n int readLen = (int) Math.min(src.length - srcOffset, Math.min(size() - destOffset, length));\n ByteBuffer b = toDirectByteBuffer(destOffset, readLen);\n b.position(0);\n b.put(src, srcOffset, readLen);\n return readLen;\n }", "public static final double round(double value, double precision)\n {\n precision = Math.pow(10, precision);\n return Math.round(value * precision) / precision;\n }", "protected void\t\tcalcWorld(Bone bone, int parentId)\n {\n getWorldMatrix(parentId, mTempMtxB); // WorldMatrix (parent) TempMtxB\n mTempMtxB.mul(bone.LocalMatrix); // WorldMatrix = WorldMatrix(parent) * LocalMatrix\n bone.WorldMatrix.set(mTempMtxB);\n }", "public List<Integer> getTrackIds() {\n ArrayList<Integer> results = new ArrayList<Integer>(trackCount);\n Enumeration<? extends ZipEntry> entries = zipFile.entries();\n while (entries.hasMoreElements()) {\n ZipEntry entry = entries.nextElement();\n if (entry.getName().startsWith(CACHE_METADATA_ENTRY_PREFIX)) {\n String idPart = entry.getName().substring(CACHE_METADATA_ENTRY_PREFIX.length());\n if (idPart.length() > 0) {\n results.add(Integer.valueOf(idPart));\n }\n }\n }\n\n return Collections.unmodifiableList(results);\n }", "public boolean isHoliday(String dateString) {\n boolean isHoliday = false;\n for (Holiday date : EquivalenceClassTransformer.HOLIDAYS) {\n if (convertToReadableDate(date.forYear(Integer.parseInt(dateString.substring(0, 4)))).equals(dateString)) {\n isHoliday = true;\n }\n }\n return isHoliday;\n }", "String getQuery(String key)\n {\n String res = this.adapter.getSqlText(key);\n if (res == null)\n {\n throw new DatabaseException(\"Query \" + key + \" does not exist\");\n }\n return res;\n }", "public static route6[] get(nitro_service service, route6_args args) throws Exception{\n\t\troute6 obj = new route6();\n\t\toptions option = new options();\n\t\toption.set_args(nitro_util.object_to_string_withoutquotes(args));\n\t\troute6[] response = (route6[])obj.get_resources(service, option);\n\t\treturn response;\n\t}" ]
Consumer is required to do any privilege checks before getting here @param request a {@link HttpServletRequest} which may contain forced groups parameters from URL, Header or Cookie. @return a map of test names to bucket values specified by the request. Returns an empty {@link Map} if nothing was specified
[ "@Nonnull\n public static Map<String, Integer> parseForcedGroups(@Nonnull final HttpServletRequest request) {\n final String forceGroupsList = getForceGroupsStringFromRequest(request);\n return parseForceGroupsList(forceGroupsList);\n }" ]
[ "public static base_responses update(nitro_service client, gslbsite resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tgslbsite updateresources[] = new gslbsite[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tupdateresources[i] = new gslbsite();\n\t\t\t\tupdateresources[i].sitename = resources[i].sitename;\n\t\t\t\tupdateresources[i].metricexchange = resources[i].metricexchange;\n\t\t\t\tupdateresources[i].nwmetricexchange = resources[i].nwmetricexchange;\n\t\t\t\tupdateresources[i].sessionexchange = resources[i].sessionexchange;\n\t\t\t\tupdateresources[i].triggermonitor = resources[i].triggermonitor;\n\t\t\t}\n\t\t\tresult = update_bulk_request(client, updateresources);\n\t\t}\n\t\treturn result;\n\t}", "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 ItemRequest<Section> findById(String section) {\n \n String path = String.format(\"/sections/%s\", section);\n return new ItemRequest<Section>(this, Section.class, path, \"GET\");\n }", "static JobContext copy() {\n JobContext current = current_.get();\n //JobContext ctxt = new JobContext(keepParent ? current : null);\n JobContext ctxt = new JobContext(null);\n if (null != current) {\n ctxt.bag_.putAll(current.bag_);\n }\n return ctxt;\n }", "public static byte[] explodeContentAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws OperationFailedException, ExplodedContentException {\n final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS);\n ModelNode contentItem = getContentItem(deploymentResource);\n ModelNode explodedPath = DEPLOYMENT_CONTENT_PATH.resolveModelAttribute(context, operation);\n byte[] oldHash = CONTENT_HASH.resolveModelAttribute(context, contentItem).asBytes();\n final byte[] hash;\n if (explodedPath.isDefined()) {\n hash = contentRepository.explodeSubContent(oldHash, explodedPath.asString());\n } else {\n hash = contentRepository.explodeContent(oldHash);\n }\n\n // Clear the contents and update with the hash\n final ModelNode slave = operation.clone();\n ModelNode addedContent = new ModelNode().setEmptyObject();\n addedContent.get(HASH).set(hash);\n addedContent.get(TARGET_PATH.getName()).set(\"./\");\n slave.get(CONTENT).setEmptyList().add(addedContent);\n // Add the domain op transformer\n List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);\n if (transformers == null) {\n context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());\n }\n transformers.add(new CompositeOperationAwareTransmuter(slave));\n return hash;\n }", "@Override\n public boolean awaitCompletion(long timeout, TimeUnit unit) throws InterruptedException {\n long deadline = unit.toMillis(timeout) + System.currentTimeMillis();\n lock.lock(); try {\n assert shutdown;\n while(activeCount != 0) {\n long remaining = deadline - System.currentTimeMillis();\n if (remaining <= 0) {\n break;\n }\n condition.await(remaining, TimeUnit.MILLISECONDS);\n }\n boolean allComplete = activeCount == 0;\n if (!allComplete) {\n ProtocolLogger.ROOT_LOGGER.debugf(\"ActiveOperation(s) %s have not completed within %d %s\", activeRequests.keySet(), timeout, unit);\n }\n return allComplete;\n } finally {\n lock.unlock();\n }\n }", "public void updateIteratorPosition(int length) {\n if(length > 0) {\n //make sure we dont go OB\n if((length + character) > parsedLine.line().length())\n length = parsedLine.line().length() - character;\n\n //move word counter to the correct word\n while(hasNextWord() &&\n (length + character) >= parsedLine.words().get(word).lineIndex() +\n parsedLine.words().get(word).word().length())\n word++;\n\n character = length + character;\n }\n else\n throw new IllegalArgumentException(\"The length given must be > 0 and not exceed the boundary of the line (including the current position)\");\n }", "public void addImportedPackages(Set<String> importedPackages) {\n\t\taddImportedPackages(importedPackages.toArray(new String[importedPackages.size()]));\n\t}", "public static void permutationInverse( int []original , int []inverse , int length ) {\n for (int i = 0; i < length; i++) {\n inverse[original[i]] = i;\n }\n }" ]
This is the profiles page. this is the 'regular' page when the url is typed in
[ "@RequestMapping(value = \"/profiles\", method = RequestMethod.GET)\n public String list(Model model) {\n Profile profiles = new Profile();\n model.addAttribute(\"addNewProfile\", profiles);\n model.addAttribute(\"version\", Constants.VERSION);\n logger.info(\"Loading initial page\");\n\n return \"profiles\";\n }" ]
[ "public static base_response delete(nitro_service client, String labelname) throws Exception {\n\t\tdnspolicylabel deleteresource = new dnspolicylabel();\n\t\tdeleteresource.labelname = labelname;\n\t\treturn deleteresource.delete_resource(client);\n\t}", "public ReferrerList getPhotostreamReferrers(Date date, String domain, int perPage, int page) throws FlickrException {\n return getReferrers(METHOD_GET_PHOTOSTREAM_REFERRERS, domain, null, null, date, perPage, page);\n }", "public List<CmsFavoriteEntry> loadFavorites() throws CmsException {\n\n List<CmsFavoriteEntry> result = new ArrayList<>();\n try {\n CmsUser user = readUser();\n String data = (String)user.getAdditionalInfo(ADDINFO_KEY);\n if (CmsStringUtil.isEmptyOrWhitespaceOnly(data)) {\n return new ArrayList<>();\n }\n JSONObject json = new JSONObject(data);\n JSONArray array = json.getJSONArray(BASE_KEY);\n for (int i = 0; i < array.length(); i++) {\n JSONObject fav = array.getJSONObject(i);\n try {\n CmsFavoriteEntry entry = new CmsFavoriteEntry(fav);\n if (validate(entry)) {\n result.add(entry);\n }\n } catch (Exception e) {\n LOG.warn(e.getLocalizedMessage(), e);\n }\n\n }\n } catch (JSONException e) {\n LOG.error(e.getLocalizedMessage(), e);\n }\n return result;\n }", "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 // FileOutputStream instance for the file in question.\n // You don't actually write any data to the file through\n // the FileOutputStream. Just instantiate it and close it.\n\n try (\n FileOutputStream doneFOS = new FileOutputStream(touchedFile);\n ) {\n // Touching the file\n }\n catch (FileNotFoundException e) {\n throw new FileNotFoundException(\"Failed to the find file.\" + e);\n }\n }", "public void visitExport(String packaze, int access, String... modules) {\n if (mv != null) {\n mv.visitExport(packaze, access, modules);\n }\n }", "public static String getJsonDatatypeFromDatatypeIri(String datatypeIri) {\n\t\tswitch (datatypeIri) {\n\t\t\tcase DatatypeIdValue.DT_ITEM:\n\t\t\t\treturn DatatypeIdImpl.JSON_DT_ITEM;\n\t\t\tcase DatatypeIdValue.DT_GLOBE_COORDINATES:\n\t\t\t\treturn DatatypeIdImpl.JSON_DT_GLOBE_COORDINATES;\n\t\t\tcase DatatypeIdValue.DT_URL:\n\t\t\t\treturn DatatypeIdImpl.JSON_DT_URL;\n\t\t\tcase DatatypeIdValue.DT_COMMONS_MEDIA:\n\t\t\t\treturn DatatypeIdImpl.JSON_DT_COMMONS_MEDIA;\n\t\t\tcase DatatypeIdValue.DT_TIME:\n\t\t\t\treturn DatatypeIdImpl.JSON_DT_TIME;\n\t\t\tcase DatatypeIdValue.DT_QUANTITY:\n\t\t\t\treturn DatatypeIdImpl.JSON_DT_QUANTITY;\n\t\t\tcase DatatypeIdValue.DT_STRING:\n\t\t\t\treturn DatatypeIdImpl.JSON_DT_STRING;\n\t\t\tcase DatatypeIdValue.DT_MONOLINGUAL_TEXT:\n\t\t\t\treturn DatatypeIdImpl.JSON_DT_MONOLINGUAL_TEXT;\n\t\t\tcase DatatypeIdValue.DT_PROPERTY:\n\t\t\t\treturn DatatypeIdImpl.JSON_DT_PROPERTY;\n\t\t\tdefault:\n\t\t\t\t//We apply the reverse algorithm of JacksonDatatypeId::getDatatypeIriFromJsonDatatype\n\t\t\t\tMatcher matcher = DATATYPE_ID_PATTERN.matcher(datatypeIri);\n\t\t\t\tif(!matcher.matches()) {\n\t\t\t\t\tthrow new IllegalArgumentException(\"Unknown datatype: \" + datatypeIri);\n\t\t\t\t}\n\t\t\n\t\t\t\tStringBuilder jsonDatatypeBuilder = new StringBuilder();\n\t\t\t\tfor(char ch : StringUtils.uncapitalize(matcher.group(1)).toCharArray()) {\n\t\t\t\t\tif(Character.isUpperCase(ch)) {\n\t\t\t\t\t\tjsonDatatypeBuilder\n\t\t\t\t\t\t\t\t.append('-')\n\t\t\t\t\t\t\t\t.append(Character.toLowerCase(ch));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjsonDatatypeBuilder.append(ch);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn jsonDatatypeBuilder.toString();\n\t\t}\n\t}", "public static double ratioSmallestOverLargest( double []sv ) {\n if( sv.length == 0 )\n return Double.NaN;\n\n double min = sv[0];\n double max = min;\n\n for (int i = 1; i < sv.length; i++) {\n double v = sv[i];\n if( v > max )\n max = v;\n else if( v < min )\n min = v;\n }\n\n return min/max;\n }", "public Collection<BoxFileVersion> getVersions() {\n URL url = VERSIONS_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"GET\");\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n\n JsonObject jsonObject = JsonObject.readFrom(response.getJSON());\n JsonArray entries = jsonObject.get(\"entries\").asArray();\n Collection<BoxFileVersion> versions = new ArrayList<BoxFileVersion>();\n for (JsonValue entry : entries) {\n versions.add(new BoxFileVersion(this.getAPI(), entry.asObject(), this.getID()));\n }\n\n return versions;\n }", "public Task add()\n {\n Task task = new Task(m_projectFile, (Task) null);\n add(task);\n m_projectFile.getChildTasks().add(task);\n return task;\n }" ]
Check if number is valid @return boolean
[ "@SuppressWarnings(\"unused\")\n public boolean isValid() {\n Phonenumber.PhoneNumber phoneNumber = getPhoneNumber();\n return phoneNumber != null && mPhoneUtil.isValidNumber(phoneNumber);\n }" ]
[ "public void setWeeklyDaysFromBitmap(Integer days, int[] masks)\n {\n if (days != null)\n {\n int value = days.intValue();\n for (Day day : Day.values())\n {\n setWeeklyDay(day, ((value & masks[day.getValue()]) != 0));\n }\n }\n }", "public Set<String> rangeByLex(final LexRange lexRange) {\n return doWithJedis(new JedisCallable<Set<String>>() {\n @Override\n public Set<String> call(Jedis jedis) {\n if (lexRange.hasLimit()) {\n return jedis.zrangeByLex(getKey(), lexRange.from(), lexRange.to(), lexRange.offset(), lexRange.count());\n } else {\n return jedis.zrangeByLex(getKey(), lexRange.from(), lexRange.to());\n }\n }\n });\n }", "private static BsonDocument withNewVersion(\n final BsonDocument document,\n final BsonDocument newVersion\n ) {\n final BsonDocument newDocument = BsonUtils.copyOfDocument(document);\n newDocument.put(DOCUMENT_VERSION_FIELD, newVersion);\n return newDocument;\n }", "public Set<String> rangeByRank(final long start, final long end) {\n return doWithJedis(new JedisCallable<Set<String>>() {\n @Override\n public Set<String> call(Jedis jedis) {\n return jedis.zrange(getKey(), start, end);\n }\n });\n }", "private void updateSortedServices() {\n List<T> copiedList = new ArrayList<T>(serviceMap.values());\n sortedServices = Collections.unmodifiableList(copiedList);\n if (changeListener != null) {\n changeListener.changed();\n }\n }", "void nextExecuted(String sql) throws SQLException\r\n {\r\n count++;\r\n\r\n if (_order.contains(sql))\r\n {\r\n return;\r\n }\r\n\r\n String sqlCmd = sql.substring(0, 7);\r\n String rest = sql.substring(sqlCmd.equals(\"UPDATE \") ? 7 // \"UPDATE \"\r\n : 12); // \"INSERT INTO \" or \"DELETE FROM \"\r\n String tableName = rest.substring(0, rest.indexOf(' '));\r\n HashSet fkTables = (HashSet) _fkInfo.get(tableName);\r\n\r\n // we should not change order of INSERT/DELETE/UPDATE\r\n // statements for the same table\r\n if (_touched.contains(tableName))\r\n {\r\n executeBatch();\r\n }\r\n if (sqlCmd.equals(\"INSERT \"))\r\n {\r\n if (_dontInsert != null && _dontInsert.contains(tableName))\r\n {\r\n // one of the previous INSERTs contained a table\r\n // that references this table.\r\n // Let's execute that previous INSERT right now so that\r\n // in the future INSERTs into this table will go first\r\n // in the _order array.\r\n executeBatch();\r\n }\r\n }\r\n else\r\n //if (sqlCmd.equals(\"DELETE \") || sqlCmd.equals(\"UPDATE \"))\r\n {\r\n // We process UPDATEs in the same way as DELETEs\r\n // because setting FK to NULL in UPDATE is equivalent\r\n // to DELETE from the referential integrity point of view.\r\n\r\n if (_deleted != null && fkTables != null)\r\n {\r\n HashSet intersection = (HashSet) _deleted.clone();\r\n\r\n intersection.retainAll(fkTables);\r\n if (!intersection.isEmpty())\r\n {\r\n // one of the previous DELETEs contained a table\r\n // that is referenced from this table.\r\n // Let's execute that previous DELETE right now so that\r\n // in the future DELETEs into this table will go first\r\n // in the _order array.\r\n executeBatch();\r\n }\r\n }\r\n }\r\n\r\n _order.add(sql);\r\n\r\n _touched.add(tableName);\r\n if (sqlCmd.equals(\"INSERT \"))\r\n {\r\n if (fkTables != null)\r\n {\r\n if (_dontInsert == null)\r\n {\r\n _dontInsert = new HashSet();\r\n }\r\n _dontInsert.addAll(fkTables);\r\n }\r\n }\r\n else if (sqlCmd.equals(\"DELETE \"))\r\n {\r\n if (_deleted == null)\r\n {\r\n _deleted = new HashSet();\r\n }\r\n _deleted.add(tableName);\r\n }\r\n }", "public static base_response unset(nitro_service client, sslservice resource, String[] args) throws Exception{\n\t\tsslservice unsetresource = new sslservice();\n\t\tunsetresource.servicename = resource.servicename;\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "@Override\n public void run() {\n for (Map.Entry<String, TestSuiteResult> entry : testSuites) {\n for (TestCaseResult testCase : entry.getValue().getTestCases()) {\n markTestcaseAsInterruptedIfNotFinishedYet(testCase);\n }\n entry.getValue().getTestCases().add(createFakeTestcaseWithWarning(entry.getValue()));\n\n Allure.LIFECYCLE.fire(new TestSuiteFinishedEvent(entry.getKey()));\n }\n }", "public static base_responses renumber(nitro_service client, nspbr6 resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tnspbr6 renumberresources[] = new nspbr6[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\trenumberresources[i] = new nspbr6();\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, renumberresources,\"renumber\");\n\t\t}\n\t\treturn result;\n\t}" ]
Update the object in the database.
[ "public int update(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException {\n\t\ttry {\n\t\t\t// there is always and id field as an argument so just return 0 lines updated\n\t\t\tif (argFieldTypes.length <= 1) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tObject[] args = getFieldObjects(data);\n\t\t\tObject newVersion = null;\n\t\t\tif (versionFieldType != null) {\n\t\t\t\tnewVersion = versionFieldType.extractJavaFieldValue(data);\n\t\t\t\tnewVersion = versionFieldType.moveToNextValue(newVersion);\n\t\t\t\targs[versionFieldTypeIndex] = versionFieldType.convertJavaFieldToSqlArgValue(newVersion);\n\t\t\t}\n\t\t\tint rowC = databaseConnection.update(statement, args, argFieldTypes);\n\t\t\tif (rowC > 0) {\n\t\t\t\tif (newVersion != null) {\n\t\t\t\t\t// if we have updated a row then update the version field in our object to the new value\n\t\t\t\t\tversionFieldType.assignField(connectionSource, data, newVersion, false, null);\n\t\t\t\t}\n\t\t\t\tif (objectCache != null) {\n\t\t\t\t\t// if we've changed something then see if we need to update our cache\n\t\t\t\t\tObject id = idField.extractJavaFieldValue(data);\n\t\t\t\t\tT cachedData = objectCache.get(clazz, id);\n\t\t\t\t\tif (cachedData != null && cachedData != data) {\n\t\t\t\t\t\t// copy each field from the updated data into the cached object\n\t\t\t\t\t\tfor (FieldType fieldType : tableInfo.getFieldTypes()) {\n\t\t\t\t\t\t\tif (fieldType != idField) {\n\t\t\t\t\t\t\t\tfieldType.assignField(connectionSource, cachedData,\n\t\t\t\t\t\t\t\t\t\tfieldType.extractJavaFieldValue(data), false, objectCache);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlogger.debug(\"update data with statement '{}' and {} args, changed {} rows\", statement, args.length, rowC);\n\t\t\tif (args.length > 0) {\n\t\t\t\t// need to do the (Object) cast to force args to be a single object\n\t\t\t\tlogger.trace(\"update arguments: {}\", (Object) args);\n\t\t\t}\n\t\t\treturn rowC;\n\t\t} catch (SQLException e) {\n\t\t\tthrow SqlExceptionUtil.create(\"Unable to run update stmt on object \" + data + \": \" + statement, e);\n\t\t}\n\t}" ]
[ "public static void setTime(Calendar calendar, int hourOfDay, int minute, int second, int millisecond) {\n calendar.set(Calendar.HOUR_OF_DAY, hourOfDay);\n calendar.set(Calendar.MINUTE, minute);\n calendar.set(Calendar.SECOND, second);\n calendar.set(Calendar.MILLISECOND, millisecond);\n }", "public static ComplexNumber Divide(ComplexNumber z1, ComplexNumber z2) {\r\n\r\n ComplexNumber conj = ComplexNumber.Conjugate(z2);\r\n\r\n double a = z1.real * conj.real + ((z1.imaginary * conj.imaginary) * -1);\r\n double b = z1.real * conj.imaginary + (z1.imaginary * conj.real);\r\n\r\n double c = z2.real * conj.real + ((z2.imaginary * conj.imaginary) * -1);\r\n\r\n return new ComplexNumber(a / c, b / c);\r\n }", "public static base_responses add(nitro_service client, snmpmanager resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tsnmpmanager addresources[] = new snmpmanager[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new snmpmanager();\n\t\t\t\taddresources[i].ipaddress = resources[i].ipaddress;\n\t\t\t\taddresources[i].netmask = resources[i].netmask;\n\t\t\t\taddresources[i].domainresolveretry = resources[i].domainresolveretry;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "public void putEvents(List<Event> events) {\n Exception lastException;\n List<EventType> eventTypes = new ArrayList<EventType>();\n for (Event event : events) {\n EventType eventType = EventMapper.map(event);\n eventTypes.add(eventType);\n }\n\n int i = 0;\n lastException = null;\n while (i < numberOfRetries) {\n try {\n monitoringService.putEvents(eventTypes);\n break;\n } catch (Exception e) {\n lastException = e;\n i++;\n }\n if(i < numberOfRetries) {\n try {\n Thread.sleep(delayBetweenRetry);\n } catch (InterruptedException e) {\n break;\n }\n }\n }\n\n if (i == numberOfRetries) {\n throw new MonitoringException(\"1104\", \"Could not send events to monitoring service after \"\n + numberOfRetries + \" retries.\", lastException, events);\n }\n }", "public List<Message> requestTrackMenuFrom(final SlotReference slotReference, final int sortOrder)\n throws Exception {\n\n ConnectionManager.ClientTask<List<Message>> task = new ConnectionManager.ClientTask<List<Message>>() {\n @Override\n public List<Message> useClient(Client client) throws Exception {\n return MetadataFinder.getInstance().getFullTrackList(slotReference.slot, client, sortOrder);\n }\n };\n\n return ConnectionManager.getInstance().invokeWithClientSession(slotReference.player, task, \"requesting track menu\");\n }", "private static String wordShapeDan1(String s) {\r\n boolean digit = true;\r\n boolean upper = true;\r\n boolean lower = true;\r\n boolean mixed = true;\r\n for (int i = 0; i < s.length(); i++) {\r\n char c = s.charAt(i);\r\n if (!Character.isDigit(c)) {\r\n digit = false;\r\n }\r\n if (!Character.isLowerCase(c)) {\r\n lower = false;\r\n }\r\n if (!Character.isUpperCase(c)) {\r\n upper = false;\r\n }\r\n if ((i == 0 && !Character.isUpperCase(c)) || (i >= 1 && !Character.isLowerCase(c))) {\r\n mixed = false;\r\n }\r\n }\r\n if (digit) {\r\n return \"ALL-DIGITS\";\r\n }\r\n if (upper) {\r\n return \"ALL-UPPER\";\r\n }\r\n if (lower) {\r\n return \"ALL-LOWER\";\r\n }\r\n if (mixed) {\r\n return \"MIXED-CASE\";\r\n }\r\n return \"OTHER\";\r\n }", "private void addFilters(MpxjTreeNode parentNode, List<Filter> filters)\n {\n for (Filter field : filters)\n {\n final Filter f = field;\n MpxjTreeNode childNode = new MpxjTreeNode(field)\n {\n @Override public String toString()\n {\n return f.getName();\n }\n };\n parentNode.add(childNode);\n }\n }", "public void getElevationForLocations(LocationElevationRequest req, ElevationServiceCallback callback) {\n \n this.callback = callback;\n \n JSObject doc = (JSObject) getJSObject().eval(\"document\");\n doc.setMember(getVariableName(), this);\n \n StringBuilder r = new StringBuilder(getVariableName())\n .append(\".\")\n .append(\"getElevationForLocations(\")\n .append(req.getVariableName())\n .append(\", \")\n .append(\"function(results, status) {alert('rec:'+status);\\ndocument.\")\n .append(getVariableName())\n .append(\".processResponse(results, status);});\");\n \n LOG.trace(\"ElevationService direct call: \" + r.toString());\n \n getJSObject().eval(r.toString());\n \n }", "public void setActiveView(View v, int position) {\n final View oldView = mActiveView;\n mActiveView = v;\n mActivePosition = position;\n\n if (mAllowIndicatorAnimation && oldView != null) {\n startAnimatingIndicator();\n }\n\n invalidate();\n }" ]
Verifies that the TestMatrix is correct and sane without using a specification. The Proctor API doesn't use a test specification so that it can serve all tests in the matrix without restriction. Does a limited set of sanity checks that are applicable when there is no specification, and thus no required tests or provided context. @param testMatrix the {@link TestMatrixArtifact} to be verified. @param matrixSource a {@link String} of the source of proctor artifact. For example a path of proctor artifact file. @return a {@link ProctorLoadResult} to describe the result of verification. It contains errors of verification and a list of missing test.
[ "public static ProctorLoadResult verifyWithoutSpecification(@Nonnull final TestMatrixArtifact testMatrix,\n final String matrixSource) {\n final ProctorLoadResult.Builder resultBuilder = ProctorLoadResult.newBuilder();\n\n for (final Entry<String, ConsumableTestDefinition> entry : testMatrix.getTests().entrySet()) {\n final String testName = entry.getKey();\n final ConsumableTestDefinition testDefinition = entry.getValue();\n\n try {\n verifyInternallyConsistentDefinition(testName, matrixSource, testDefinition);\n } catch (IncompatibleTestMatrixException e) {\n LOGGER.info(String.format(\"Unable to load test matrix for %s\", testName), e);\n resultBuilder.recordError(testName, e);\n }\n }\n return resultBuilder.build();\n }" ]
[ "public void deploy(InputStream inputStream) throws IOException {\n final List<? extends HasMetadata> entities = deploy(\"application\", inputStream);\n\n if (this.applicationName == null) {\n\n Optional<String> deployment = entities.stream()\n .filter(hm -> hm instanceof Deployment)\n .map(hm -> (Deployment) hm)\n .map(rc -> rc.getMetadata().getName()).findFirst();\n\n deployment.ifPresent(name -> this.applicationName = name);\n }\n }", "public static base_responses add(nitro_service client, inat resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tinat addresources[] = new inat[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new inat();\n\t\t\t\taddresources[i].name = resources[i].name;\n\t\t\t\taddresources[i].publicip = resources[i].publicip;\n\t\t\t\taddresources[i].privateip = resources[i].privateip;\n\t\t\t\taddresources[i].tcpproxy = resources[i].tcpproxy;\n\t\t\t\taddresources[i].ftp = resources[i].ftp;\n\t\t\t\taddresources[i].tftp = resources[i].tftp;\n\t\t\t\taddresources[i].usip = resources[i].usip;\n\t\t\t\taddresources[i].usnip = resources[i].usnip;\n\t\t\t\taddresources[i].proxyip = resources[i].proxyip;\n\t\t\t\taddresources[i].mode = resources[i].mode;\n\t\t\t\taddresources[i].td = resources[i].td;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "public static BMatrixRMaj elementLessThan(DMatrixRMaj A , double value , BMatrixRMaj output )\n {\n if( output == null ) {\n output = new BMatrixRMaj(A.numRows,A.numCols);\n }\n\n output.reshape(A.numRows, A.numCols);\n\n int N = A.getNumElements();\n\n for (int i = 0; i < N; i++) {\n output.data[i] = A.data[i] < value;\n }\n\n return output;\n }", "public static String md5(byte[] source) {\n try {\n MessageDigest md = MessageDigest.getInstance(\"MD5\");\n md.update(source);\n byte tmp[] = md.digest();\n char str[] = new char[32];\n int k = 0;\n for (byte b : tmp) {\n str[k++] = hexDigits[b >>> 4 & 0xf];\n str[k++] = hexDigits[b & 0xf];\n }\n return new String(str);\n\n } catch (Exception e) {\n throw new IllegalArgumentException(e);\n }\n }", "<P extends PatchingArtifact.ArtifactState, S extends PatchingArtifact.ArtifactState> PatchingArtifactStateHandler<S> getHandlerForArtifact(PatchingArtifact<P, S> artifact) {\n return handlers.get(artifact);\n }", "public CollectionRequest<Task> findByProject(String projectId) {\n \n String path = String.format(\"/projects/%s/tasks\", projectId);\n return new CollectionRequest<Task>(this, Task.class, path, \"GET\");\n }", "public boolean doSyncPass() {\n if (!this.isConfigured || !syncLock.tryLock()) {\n return false;\n }\n try {\n if (logicalT == Long.MAX_VALUE) {\n if (logger.isInfoEnabled()) {\n logger.info(\"reached max logical time; resetting back to 0\");\n }\n logicalT = 0;\n }\n logicalT++;\n\n if (logger.isInfoEnabled()) {\n logger.info(String.format(\n Locale.US,\n \"t='%d': doSyncPass START\",\n logicalT));\n }\n if (networkMonitor == null || !networkMonitor.isConnected()) {\n if (logger.isInfoEnabled()) {\n logger.info(String.format(\n Locale.US,\n \"t='%d': doSyncPass END - Network disconnected\",\n logicalT));\n }\n return false;\n }\n if (authMonitor == null || !authMonitor.tryIsLoggedIn()) {\n if (logger.isInfoEnabled()) {\n logger.info(String.format(\n Locale.US,\n \"t='%d': doSyncPass END - Logged out\",\n logicalT));\n }\n return false;\n }\n\n syncRemoteToLocal();\n syncLocalToRemote();\n\n if (logger.isInfoEnabled()) {\n logger.info(String.format(\n Locale.US,\n \"t='%d': doSyncPass END\",\n logicalT));\n }\n } catch (InterruptedException e) {\n if (logger.isInfoEnabled()) {\n logger.info(String.format(\n Locale.US,\n \"t='%d': doSyncPass INTERRUPTED\",\n logicalT));\n }\n return false;\n } finally {\n syncLock.unlock();\n }\n return true;\n }", "public List<Tag> getRootTags()\n {\n return this.definedTags.values().stream()\n .filter(Tag::isRoot)\n .collect(Collectors.toList());\n }", "protected void validateResultsDirectories() {\n for (String result : results) {\n if (Files.notExists(Paths.get(result))) {\n throw new AllureCommandException(String.format(\"Report directory <%s> not found.\", result));\n }\n }\n }" ]
Use this API to update autoscaleaction resources.
[ "public static base_responses update(nitro_service client, autoscaleaction resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tautoscaleaction updateresources[] = new autoscaleaction[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tupdateresources[i] = new autoscaleaction();\n\t\t\t\tupdateresources[i].name = resources[i].name;\n\t\t\t\tupdateresources[i].profilename = resources[i].profilename;\n\t\t\t\tupdateresources[i].parameters = resources[i].parameters;\n\t\t\t\tupdateresources[i].vmdestroygraceperiod = resources[i].vmdestroygraceperiod;\n\t\t\t\tupdateresources[i].quiettime = resources[i].quiettime;\n\t\t\t\tupdateresources[i].vserver = resources[i].vserver;\n\t\t\t}\n\t\t\tresult = update_bulk_request(client, updateresources);\n\t\t}\n\t\treturn result;\n\t}" ]
[ "@Override\n public boolean parseAndValidateRequest() {\n if(!super.parseAndValidateRequest()) {\n return false;\n }\n isGetVersionRequest = hasGetVersionRequestHeader();\n if(isGetVersionRequest && this.parsedKeys.size() > 1) {\n RestErrorHandler.writeErrorResponse(messageEvent,\n HttpResponseStatus.BAD_REQUEST,\n \"Get version request cannot have multiple keys\");\n return false;\n }\n return true;\n }", "public ApnsServiceBuilder withAuthProxy(Proxy proxy, String proxyUsername, String proxyPassword) {\n this.proxy = proxy;\n this.proxyUsername = proxyUsername;\n this.proxyPassword = proxyPassword;\n return this;\n }", "public static void initialize(final Context context) {\n if (!initialized.compareAndSet(false, true)) {\n return;\n }\n\n applicationContext = context.getApplicationContext();\n\n final String packageName = applicationContext.getPackageName();\n localAppName = packageName;\n\n final PackageManager manager = applicationContext.getPackageManager();\n try {\n final PackageInfo pkgInfo = manager.getPackageInfo(packageName, 0);\n localAppVersion = pkgInfo.versionName;\n } catch (final NameNotFoundException e) {\n Log.d(TAG, \"Failed to get version of application, will not send in device info.\");\n }\n\n Log.d(TAG, \"Initialized android SDK\");\n }", "public void waitAndRetry() {\n ContinueToSendToBatchSenderAsstManager continueToSendToBatchSenderAsstManager = new ContinueToSendToBatchSenderAsstManager(\n processedWorkerCount);\n\n logger.debug(\"NOW WAIT Another \" + asstManagerRetryIntervalMillis\n + \" MS. at \" + PcDateUtils.getNowDateTimeStrStandard());\n getContext()\n .system()\n .scheduler()\n .scheduleOnce(\n Duration.create(asstManagerRetryIntervalMillis,\n TimeUnit.MILLISECONDS), getSelf(),\n continueToSendToBatchSenderAsstManager,\n getContext().system().dispatcher(), getSelf());\n return;\n }", "private String filterAttributes(String html) {\n\t\tString filteredHtml = html;\n\t\tfor (String attribute : this.filterAttributes) {\n\t\t\tString regex = \"\\\\s\" + attribute + \"=\\\"[^\\\"]*\\\"\";\n\t\t\tPattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);\n\t\t\tMatcher m = p.matcher(html);\n\t\t\tfilteredHtml = m.replaceAll(\"\");\n\t\t}\n\t\treturn filteredHtml;\n\t}", "public static rnat_stats get(nitro_service service) throws Exception{\n\t\trnat_stats obj = new rnat_stats();\n\t\trnat_stats[] response = (rnat_stats[])obj.stat_resources(service);\n\t\treturn response[0];\n\t}", "public Object copy(final Object obj, PersistenceBroker broker)\r\n\t\t\tthrows ObjectCopyException\r\n\t{\r\n\t\tObjectOutputStream oos = null;\r\n\t\tObjectInputStream ois = null;\r\n\t\ttry\r\n\t\t{\r\n\t\t\tfinal ByteArrayOutputStream bos = new ByteArrayOutputStream();\r\n\t\t\toos = new ObjectOutputStream(bos);\r\n\t\t\t// serialize and pass the object\r\n\t\t\toos.writeObject(obj);\r\n\t\t\toos.flush();\r\n\t\t\tfinal ByteArrayInputStream bin =\r\n\t\t\t\t\tnew ByteArrayInputStream(bos.toByteArray());\r\n\t\t\tois = new ObjectInputStream(bin);\r\n\t\t\t// return the new object\r\n\t\t\treturn ois.readObject();\r\n\t\t}\r\n\t\tcatch (Exception e)\r\n\t\t{\r\n\t\t\tthrow new ObjectCopyException(e);\r\n\t\t}\r\n\t\tfinally\r\n\t\t{\r\n\t\t\ttry\r\n\t\t\t{\r\n\t\t\t\tif (oos != null)\r\n\t\t\t\t{\r\n\t\t\t\t\toos.close();\r\n\t\t\t\t}\r\n\t\t\t\tif (ois != null)\r\n\t\t\t\t{\r\n\t\t\t\t\tois.close();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcatch (IOException ioe)\r\n\t\t\t{\r\n\t\t\t\t// ignore\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static double Sinc(double x) {\r\n return Math.sin(Math.PI * x) / (Math.PI * x);\r\n }", "private static InterestRateSwapLegProductDescriptor getSwapLegProductDescriptor(Element leg, String forwardCurveName, String discountCurveName,\r\n\t\t\tDayCountConvention daycountConvention) {\r\n\r\n\t\tboolean isFixed = leg.getElementsByTagName(\"interestType\").item(0).getTextContent().equalsIgnoreCase(\"FIX\");\r\n\r\n\t\tArrayList<Period> periods \t\t= new ArrayList<>();\r\n\t\tArrayList<Double> notionalsList\t= new ArrayList<>();\r\n\t\tArrayList<Double> rates\t\t\t= new ArrayList<>();\r\n\r\n\t\t//extracting data for each period\r\n\t\tNodeList periodsXML = leg.getElementsByTagName(\"incomePayment\");\r\n\t\tfor(int periodIndex = 0; periodIndex < periodsXML.getLength(); periodIndex++) {\r\n\r\n\t\t\tElement periodXML = (Element) periodsXML.item(periodIndex);\r\n\r\n\t\t\tLocalDate startDate\t= LocalDate.parse(periodXML.getElementsByTagName(\"startDate\").item(0).getTextContent());\r\n\t\t\tLocalDate endDate\t= LocalDate.parse(periodXML.getElementsByTagName(\"endDate\").item(0).getTextContent());\r\n\r\n\t\t\tLocalDate fixingDate\t= startDate;\r\n\t\t\tLocalDate paymentDate\t= LocalDate.parse(periodXML.getElementsByTagName(\"payDate\").item(0).getTextContent());\r\n\r\n\t\t\tif(! isFixed) {\r\n\t\t\t\tfixingDate = LocalDate.parse(periodXML.getElementsByTagName(\"fixingDate\").item(0).getTextContent());\r\n\t\t\t}\r\n\r\n\t\t\tperiods.add(new Period(fixingDate, paymentDate, startDate, endDate));\r\n\r\n\t\t\tdouble notional\t\t= Double.parseDouble(periodXML.getElementsByTagName(\"nominal\").item(0).getTextContent());\r\n\t\t\tnotionalsList.add(new Double(notional));\r\n\r\n\t\t\tif(isFixed) {\r\n\t\t\t\tdouble fixedRate\t= Double.parseDouble(periodXML.getElementsByTagName(\"fixedRate\").item(0).getTextContent());\r\n\t\t\t\trates.add(new Double(fixedRate));\r\n\t\t\t} else {\r\n\t\t\t\trates.add(new Double(0));\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tScheduleDescriptor schedule = new ScheduleDescriptor(periods, daycountConvention);\r\n\t\tdouble[] notionals\t= notionalsList.stream().mapToDouble(Double::doubleValue).toArray();\r\n\t\tdouble[] spreads\t= rates.stream().mapToDouble(Double::doubleValue).toArray();\r\n\r\n\t\treturn new InterestRateSwapLegProductDescriptor(forwardCurveName, discountCurveName, schedule, notionals, spreads, false);\r\n\t}" ]
Checks to see if the specified off diagonal element is zero using a relative metric.
[ "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 }" ]
[ "private Serializable doWorkInIsolationTransaction(final SharedSessionContractImplementor session)\n\t\t\tthrows HibernateException {\n\t\tclass Work extends AbstractReturningWork<IntegralDataTypeHolder> {\n\t\t\tprivate final SharedSessionContractImplementor localSession = session;\n\n\t\t\t@Override\n\t\t\tpublic IntegralDataTypeHolder execute(Connection connection) throws SQLException {\n\t\t\t\ttry {\n\t\t\t\t\treturn doWorkInCurrentTransactionIfAny( localSession );\n\t\t\t\t}\n\t\t\t\tcatch ( RuntimeException sqle ) {\n\t\t\t\t\tthrow new HibernateException( \"Could not get or update next value\", sqle );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//we want to work out of transaction\n\t\tboolean workInTransaction = false;\n\t\tWork work = new Work();\n\t\tSerializable generatedValue = session.getTransactionCoordinator().createIsolationDelegate().delegateWork( work, workInTransaction );\n\t\treturn generatedValue;\n\t}", "public static void main(String args[]) throws Exception {\n final StringBuffer buffer = new StringBuffer(\"The lazy fox\");\n Thread t1 = new Thread() {\n public void run() {\n synchronized(buffer) {\n buffer.delete(0,4);\n buffer.append(\" in the middle\");\n System.err.println(\"Middle\");\n try { Thread.sleep(4000); } catch(Exception e) {}\n buffer.append(\" of fall\");\n System.err.println(\"Fall\");\n }\n }\n };\n Thread t2 = new Thread() {\n public void run() {\n try { Thread.sleep(1000); } catch(Exception e) {}\n buffer.append(\" jump over the fence\");\n System.err.println(\"Fence\");\n }\n };\n t1.start();\n t2.start();\n\n t1.join();\n t2.join();\n System.err.println(buffer);\n }", "private String dumpZoneNAryDetails(StoreRoutingPlan storeRoutingPlan) {\n StringBuilder sb = new StringBuilder();\n\n sb.append(\"\\tDetailed Dump (Zone N-Aries):\").append(Utils.NEWLINE);\n for(Node node: storeRoutingPlan.getCluster().getNodes()) {\n int zoneId = node.getZoneId();\n int nodeId = node.getId();\n sb.append(\"\\tNode ID: \" + nodeId + \" in zone \" + zoneId).append(Utils.NEWLINE);\n List<Integer> naries = storeRoutingPlan.getZoneNAryPartitionIds(nodeId);\n Map<Integer, List<Integer>> zoneNaryTypeToPartitionIds = new HashMap<Integer, List<Integer>>();\n for(int nary: naries) {\n int zoneReplicaType = storeRoutingPlan.getZoneNaryForNodesPartition(zoneId,\n nodeId,\n nary);\n if(!zoneNaryTypeToPartitionIds.containsKey(zoneReplicaType)) {\n zoneNaryTypeToPartitionIds.put(zoneReplicaType, new ArrayList<Integer>());\n }\n zoneNaryTypeToPartitionIds.get(zoneReplicaType).add(nary);\n }\n\n for(int replicaType: new TreeSet<Integer>(zoneNaryTypeToPartitionIds.keySet())) {\n sb.append(\"\\t\\t\" + replicaType + \" : \");\n sb.append(zoneNaryTypeToPartitionIds.get(replicaType).toString());\n sb.append(Utils.NEWLINE);\n }\n }\n\n return sb.toString();\n }", "@NonNull\n public static File[] listAllFiles(File directory) {\n if (directory == null) {\n return new File[0];\n }\n File[] files = directory.listFiles();\n return files != null ? files : new File[0];\n }", "protected void mergeSameCost(LinkedList<TimephasedCost> list)\n {\n LinkedList<TimephasedCost> result = new LinkedList<TimephasedCost>();\n\n TimephasedCost previousAssignment = null;\n for (TimephasedCost assignment : list)\n {\n if (previousAssignment == null)\n {\n assignment.setAmountPerDay(assignment.getTotalAmount());\n result.add(assignment);\n }\n else\n {\n Number previousAssignmentCost = previousAssignment.getAmountPerDay();\n Number assignmentCost = assignment.getTotalAmount();\n\n if (NumberHelper.equals(previousAssignmentCost.doubleValue(), assignmentCost.doubleValue(), 0.01))\n {\n Date assignmentStart = previousAssignment.getStart();\n Date assignmentFinish = assignment.getFinish();\n double total = previousAssignment.getTotalAmount().doubleValue();\n total += assignmentCost.doubleValue();\n\n TimephasedCost merged = new TimephasedCost();\n merged.setStart(assignmentStart);\n merged.setFinish(assignmentFinish);\n merged.setAmountPerDay(assignmentCost);\n merged.setTotalAmount(Double.valueOf(total));\n\n result.removeLast();\n assignment = merged;\n }\n else\n {\n assignment.setAmountPerDay(assignment.getTotalAmount());\n }\n result.add(assignment);\n }\n\n previousAssignment = assignment;\n }\n\n list.clear();\n list.addAll(result);\n }", "void setPatternDefaultValues(Date startDate) {\r\n\r\n if ((m_patternDefaultValues == null) || !Objects.equals(m_patternDefaultValues.getDate(), startDate)) {\r\n m_patternDefaultValues = new PatternDefaultValues(startDate);\r\n }\r\n }", "public static Calendar popCalendar()\n {\n Calendar result;\n Deque<Calendar> calendars = CALENDARS.get();\n if (calendars.isEmpty())\n {\n result = Calendar.getInstance();\n }\n else\n {\n result = calendars.pop();\n }\n return result;\n }", "public synchronized void stopDebugServer() {\n if (mDebugServer == null) {\n Log.e(TAG, \"Debug server is not running.\");\n return;\n }\n\n mDebugServer.shutdown();\n mDebugServer = null;\n }", "public CollectionRequest<Story> findByTask(String task) {\n \n String path = String.format(\"/tasks/%s/stories\", task);\n return new CollectionRequest<Story>(this, Story.class, path, \"GET\");\n }" ]
Generate debug dump of the tree from the scene object. It should include a newline character at the end. @param sb the {@code StringBuffer} to dump the object. @param indent indentation level as number of spaces.
[ "public void prettyPrint(StringBuffer sb, int indent) {\n sb.append(Log.getSpaces(indent));\n sb.append(getClass().getSimpleName());\n sb.append(\" [name=\");\n sb.append(this.getName());\n sb.append(\"]\");\n sb.append(System.lineSeparator());\n GVRRenderData rdata = getRenderData();\n GVRTransform trans = getTransform();\n\n if (rdata == null) {\n sb.append(Log.getSpaces(indent + 2));\n sb.append(\"RenderData: null\");\n sb.append(System.lineSeparator());\n } else {\n rdata.prettyPrint(sb, indent + 2);\n }\n sb.append(Log.getSpaces(indent + 2));\n sb.append(\"Transform: \"); sb.append(trans);\n sb.append(System.lineSeparator());\n\n // dump its children\n for (GVRSceneObject child : getChildren()) {\n child.prettyPrint(sb, indent + 2);\n }\n }" ]
[ "public void update(StoreDefinition storeDef) {\n if(!useOneEnvPerStore)\n throw new VoldemortException(\"Memory foot print can be set only when using different environments per store\");\n\n String storeName = storeDef.getName();\n Environment environment = environments.get(storeName);\n // change reservation amount of reserved store\n if(!unreservedStores.contains(environment) && storeDef.hasMemoryFootprint()) {\n EnvironmentMutableConfig mConfig = environment.getMutableConfig();\n long currentCacheSize = mConfig.getCacheSize();\n long newCacheSize = storeDef.getMemoryFootprintMB() * ByteUtils.BYTES_PER_MB;\n if(currentCacheSize != newCacheSize) {\n long newReservedCacheSize = this.reservedCacheSize - currentCacheSize\n + newCacheSize;\n\n // check that we leave a 'minimum' shared cache\n if((voldemortConfig.getBdbCacheSize() - newReservedCacheSize) < voldemortConfig.getBdbMinimumSharedCache()) {\n throw new StorageInitializationException(\"Reservation of \"\n + storeDef.getMemoryFootprintMB()\n + \" MB for store \"\n + storeName\n + \" violates minimum shared cache size of \"\n + voldemortConfig.getBdbMinimumSharedCache());\n }\n\n this.reservedCacheSize = newReservedCacheSize;\n adjustCacheSizes();\n mConfig.setCacheSize(newCacheSize);\n environment.setMutableConfig(mConfig);\n logger.info(\"Setting private cache for store \" + storeDef.getName() + \" to \"\n + newCacheSize);\n }\n } else {\n // we cannot support changing a reserved store to unreserved or vice\n // versa since the sharedCache param is not mutable\n throw new VoldemortException(\"Cannot switch between shared and private cache dynamically\");\n }\n }", "public boolean isInBounds(int row, int col) {\n return row >= 0 && col >= 0 && row < mat.getNumRows() && col < mat.getNumCols();\n }", "public AsciiTable setHtmlElementTranslator(HtmlElementTranslator htmlElementTranslator) {\r\n\t\tfor(AT_Row row : this.rows){\r\n\t\t\tif(row.getType()==TableRowType.CONTENT){\r\n\t\t\t\trow.setHtmlElementTranslator(htmlElementTranslator);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}", "public void process() {\n // are we ready to process yet, or have we had an error, and are\n // waiting a bit longer in the hope that it will resolve itself?\n if (error_skips > 0) {\n error_skips--;\n return;\n }\n \n try {\n if (logger != null)\n logger.debug(\"Starting processing\");\n status = \"Processing\";\n lastCheck = System.currentTimeMillis();\n\n // FIXME: how to break off processing if we don't want to keep going?\n processor.deduplicate(batch_size);\n\n status = \"Sleeping\";\n if (logger != null)\n logger.debug(\"Finished processing\");\n } catch (Throwable e) {\n status = \"Thread blocked on error: \" + e;\n if (logger != null)\n logger.error(\"Error in processing; waiting\", e);\n error_skips = error_factor;\n }\n }", "BeatGrid getBeatGrid(int rekordboxId, SlotReference slot, Client client)\n throws IOException {\n Message response = client.simpleRequest(Message.KnownType.BEAT_GRID_REQ, null,\n client.buildRMST(Message.MenuIdentifier.DATA, slot.slot), new NumberField(rekordboxId));\n if (response.knownType == Message.KnownType.BEAT_GRID) {\n return new BeatGrid(new DataReference(slot, rekordboxId), response);\n }\n logger.error(\"Unexpected response type when requesting beat grid: {}\", response);\n return null;\n }", "synchronized public void completeTask(int taskId, int partitionStoresMigrated) {\n tasksInFlight.remove(taskId);\n\n numTasksCompleted++;\n numPartitionStoresMigrated += partitionStoresMigrated;\n\n updateProgressBar();\n }", "public ItemRequest<Task> removeTag(String task) {\n \n String path = String.format(\"/tasks/%s/removeTag\", task);\n return new ItemRequest<Task>(this, Task.class, path, \"POST\");\n }", "private void setMaxMin(IntervalRBTreeNode<T> n) {\n n.min = n.left;\n n.max = n.right;\n if (n.leftChild != null) {\n n.min = Math.min(n.min, n.leftChild.min);\n n.max = Math.max(n.max, n.leftChild.max);\n }\n if (n.rightChild != null) {\n n.min = Math.min(n.min, n.rightChild.min);\n n.max = Math.max(n.max, n.rightChild.max);\n }\n }", "protected org.apache.log4j.helpers.PatternParser createPatternParser(final String pattern) {\n\t\treturn new FoundationLoggingPatternParser(pattern);\n\t}" ]
to check availability, then class name is truncated to bundle id
[ "private static String getBundle(String friendlyName, String className, int truncate)\r\n\t{\r\n\t\ttry {\r\n\t\t\tcl.loadClass(className);\r\n\t\t\tint start = className.length();\r\n\t\t\tfor (int i = 0; i < truncate; ++i)\r\n\t\t\t\tstart = className.lastIndexOf('.', start - 1);\r\n\t\t\tfinal String bundle = className.substring(0, start);\r\n\t\t\treturn \"+ \" + friendlyName + align(friendlyName) + \"- \" + bundle;\r\n\t\t}\r\n\t\tcatch (final ClassNotFoundException e) {}\r\n\t\tcatch (final NoClassDefFoundError e) {}\r\n\t\treturn \"- \" + friendlyName + align(friendlyName) + \"- not available\";\r\n\t}" ]
[ "private long getWeightedMatchScore(Iterable<String> requestUriParts, Iterable<String> destUriParts) {\n // The score calculated below is a base 5 number\n // The score will have one digit for one part of the URI\n // This will allow for 27 parts in the path since log (Long.MAX_VALUE) to base 5 = 27.13\n // We limit the number of parts in the path to 25 using MAX_PATH_PARTS constant above to avoid overflow during\n // score calculation\n long score = 0;\n for (Iterator<String> rit = requestUriParts.iterator(), dit = destUriParts.iterator();\n rit.hasNext() && dit.hasNext(); ) {\n String requestPart = rit.next();\n String destPart = dit.next();\n if (requestPart.equals(destPart)) {\n score = (score * 5) + 4;\n } else if (PatternPathRouterWithGroups.GROUP_PATTERN.matcher(destPart).matches()) {\n score = (score * 5) + 3;\n } else {\n score = (score * 5) + 2;\n }\n }\n return score;\n }", "private void checkLocking(FieldDescriptorDef fieldDef, String checkLevel) throws ConstraintException\r\n {\r\n if (CHECKLEVEL_NONE.equals(checkLevel))\r\n {\r\n return;\r\n }\r\n\r\n String jdbcType = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE);\r\n\r\n if (!\"TIMESTAMP\".equals(jdbcType) && !\"INTEGER\".equals(jdbcType))\r\n {\r\n if (fieldDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_LOCKING, false))\r\n {\r\n throw new ConstraintException(\"The field \"+fieldDef.getName()+\" in class \"+fieldDef.getOwner().getName()+\" has locking set to true though it is not of TIMESTAMP or INTEGER type\");\r\n }\r\n if (fieldDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_UPDATE_LOCK, false))\r\n {\r\n throw new ConstraintException(\"The field \"+fieldDef.getName()+\" in class \"+fieldDef.getOwner().getName()+\" has update-lock set to true though it is not of TIMESTAMP or INTEGER type\");\r\n }\r\n }\r\n }", "public FormAction setValuesInForm(Form form) {\r\n\t\tFormAction formAction = new FormAction();\r\n\t\tform.setFormAction(formAction);\r\n\t\tthis.forms.add(form);\r\n\t\treturn formAction;\r\n\t}", "protected List<File> getRecursiveThriftFiles(MavenProject project, String outputDirectory) throws IOException {\n return getRecursiveThriftFiles(project, outputDirectory, new ArrayList<File>());\n }", "@SuppressWarnings({\"unused\", \"WeakerAccess\"})\n public int getInboxMessageUnreadCount(){\n synchronized (inboxControllerLock) {\n if (this.ctInboxController != null) {\n return ctInboxController.unreadCount();\n } else {\n getConfigLogger().debug(getAccountId(), \"Notification Inbox not initialized\");\n return -1;\n }\n }\n }", "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<Message> useClient(Client client) throws Exception {\n if (client.tryLockingForMenuOperations(MetadataFinder.MENU_TIMEOUT, TimeUnit.SECONDS)) {\n try {\n logger.debug(\"Requesting Key menu.\");\n Message response = client.menuRequestTyped(Message.KnownType.FOLDER_MENU_REQ, Message.MenuIdentifier.MAIN_MENU, slotReference.slot,\n CdjStatus.TrackType.UNANALYZED, new NumberField(sortOrder), new NumberField(folderId), new NumberField(0xffffff));\n return client.renderMenuItems(Message.MenuIdentifier.MAIN_MENU, slotReference.slot, CdjStatus.TrackType.UNANALYZED, response);\n } finally {\n client.unlockForMenuOperations();\n }\n } else {\n throw new TimeoutException(\"Unable to lock player for menu operations.\");\n }\n }\n };\n\n return ConnectionManager.getInstance().invokeWithClientSession(slotReference.player, task, \"requesting folder menu\");\n }", "public static String getTitleGalleryKey(String gallery) {\n\n StringBuffer sb = new StringBuffer(GUI_TITLE_PREFIX);\n sb.append(gallery.toUpperCase());\n sb.append(GUI_TITLE_POSTFIX);\n return sb.toString();\n }", "public void setShortVec(CharBuffer data)\n {\n if (data == null)\n {\n throw new IllegalArgumentException(\"Input data for indices cannot be null\");\n }\n if (getIndexSize() != 2)\n {\n throw new UnsupportedOperationException(\"Cannot update integer indices with char array\");\n }\n if (data.isDirect())\n {\n if (!NativeIndexBuffer.setShortVec(getNative(), data))\n {\n throw new UnsupportedOperationException(\"Input buffer is wrong size\");\n }\n }\n else if (data.hasArray())\n {\n if (!NativeIndexBuffer.setShortArray(getNative(), data.array()))\n {\n throw new UnsupportedOperationException(\"Input buffer is wrong size\");\n }\n }\n else\n {\n throw new UnsupportedOperationException(\n \"CharBuffer type not supported. Must be direct or have backing array\");\n }\n }", "public static boolean isInSubDirectory(File dir, File file)\n {\n if (file == null)\n return false;\n\n if (file.equals(dir))\n return true;\n\n return isInSubDirectory(dir, file.getParentFile());\n }" ]
This is an assertion method that can be used by a thread to confirm that the thread isn't already holding lock for an object, before acquiring a lock @param object object to test for lock @param name tag associated with the lock
[ "public static void assertUnlocked(Object object, String name) {\n if (RUNTIME_ASSERTIONS) {\n if (Thread.holdsLock(object)) {\n throw new RuntimeAssertion(\"Recursive lock of %s\", name);\n }\n }\n }" ]
[ "public static URL classFileUrl(Class<?> clazz) throws IOException {\n ClassLoader cl = clazz.getClassLoader();\n if (cl == null) {\n cl = ClassLoader.getSystemClassLoader();\n }\n URL res = cl.getResource(clazz.getName().replace('.', '/') + \".class\");\n if (res == null) {\n throw new IllegalArgumentException(\"Unable to locate class file for \" + clazz);\n }\n return res;\n }", "@PostConstruct\n\tprotected void postConstruct() {\n\t\tif (pixelPerUnitBased) {\n\t\t\t//\tCalculate numerator and denominator\n\t\t\tif (pixelPerUnit > PIXEL_PER_METER) {\n\t\t\t\tthis.numerator = pixelPerUnit / conversionFactor;\n\t\t\t\tthis.denominator = 1;\n\t\t\t} else {\n\t\t\t\tthis.numerator = 1;\n\t\t\t\tthis.denominator = PIXEL_PER_METER / pixelPerUnit;\n\t\t\t}\n\t\t\tsetPixelPerUnitBased(false);\n\t\t} else {\n\t\t\t// Calculate PPU\n\t\t\tthis.pixelPerUnit = numerator / denominator * conversionFactor;\n\t\t\tsetPixelPerUnitBased(true);\n\t\t}\n\t}", "protected View postDeclineView() {\n\t\treturn new TopLevelWindowRedirect() {\n\t\t\t@Override\n\t\t\tprotected String getRedirectUrl(Map<String, ?> model) {\n\t\t\t\treturn postDeclineUrl;\n\t\t\t}\n\t\t};\n\t}", "public void updateInfo(BoxTermsOfServiceUserStatus.Info info) {\n URL url = TERMS_OF_SERVICE_USER_STATUSES_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, \"PUT\");\n request.setBody(info.getPendingChanges());\n\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n info.update(responseJSON);\n }", "public boolean setMethodArguments(String pathName, String methodName, Integer ordinal, Object... arguments) {\n try {\n BasicNameValuePair[] params = new BasicNameValuePair[arguments.length + 2];\n int x = 0;\n for (Object argument : arguments) {\n params[x] = new BasicNameValuePair(\"arguments[]\", argument.toString());\n x++;\n }\n params[x] = new BasicNameValuePair(\"profileIdentifier\", this._profileName);\n params[x + 1] = new BasicNameValuePair(\"ordinal\", ordinal.toString());\n\n JSONObject response = new JSONObject(doPost(BASE_PATH + uriEncode(pathName) + \"/\" + methodName, params));\n\n return true;\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n return false;\n }", "public ItemRequest<Webhook> getById(String webhook) {\n \n String path = String.format(\"/webhooks/%s\", webhook);\n return new ItemRequest<Webhook>(this, Webhook.class, path, \"GET\");\n }", "@Override\n public JulianDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {\n return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);\n }", "public static boolean pullImage(Launcher launcher, final String imageTag, final String username, final String password, final String host)\n throws IOException, InterruptedException {\n\n return launcher.getChannel().call(new MasterToSlaveCallable<Boolean, IOException>() {\n public Boolean call() throws IOException {\n DockerUtils.pullImage(imageTag, username, password, host);\n return true;\n }\n });\n }", "public static void checkVectorAddition() {\n DoubleMatrix x = new DoubleMatrix(3, 1, 1.0, 2.0, 3.0);\n DoubleMatrix y = new DoubleMatrix(3, 1, 4.0, 5.0, 6.0);\n DoubleMatrix z = new DoubleMatrix(3, 1, 5.0, 7.0, 9.0);\n\n check(\"checking vector addition\", x.add(y).equals(z));\n }" ]
Add the list with given bundles to the "Require-Bundle" main attribute. @param requiredBundles The list of all bundles to add.
[ "public void addRequiredBundles(String... requiredBundles) {\n\t\tString oldBundles = mainAttributes.get(REQUIRE_BUNDLE);\n\t\tif (oldBundles == null)\n\t\t\toldBundles = \"\";\n\t\tBundleList oldResultList = BundleList.fromInput(oldBundles, newline);\n\t\tBundleList resultList = BundleList.fromInput(oldBundles, newline);\n\t\tfor (String bundle : requiredBundles) {\n\t\t\tBundle newBundle = Bundle.fromInput(bundle);\n\t\t\tif (name != null && name.equals(newBundle.getName()))\n\t\t\t\tcontinue;\n\t\t\tresultList.mergeInto(newBundle);\n\t\t}\n\t\tString result = resultList.toString();\n\t\tboolean changed = !oldResultList.toString().equals(result);\n\t\tmodified |= changed;\n\t\tif (changed)\n\t\t\tmainAttributes.put(REQUIRE_BUNDLE, result);\n\t}" ]
[ "private ChildTaskContainer getParentTask(Activity activity)\n {\n //\n // Make a map of activity codes and their values for this activity\n //\n Map<UUID, UUID> map = getActivityCodes(activity);\n\n //\n // Work through the activity codes in sequence\n //\n ChildTaskContainer parent = m_projectFile;\n StringBuilder uniqueIdentifier = new StringBuilder();\n for (UUID activityCode : m_codeSequence)\n {\n UUID activityCodeValue = map.get(activityCode);\n String activityCodeText = m_activityCodeValues.get(activityCodeValue);\n if (activityCodeText != null)\n {\n if (uniqueIdentifier.length() != 0)\n {\n uniqueIdentifier.append('>');\n }\n uniqueIdentifier.append(activityCodeValue.toString());\n UUID uuid = UUID.nameUUIDFromBytes(uniqueIdentifier.toString().getBytes());\n Task newParent = findChildTaskByUUID(parent, uuid);\n if (newParent == null)\n {\n newParent = parent.addTask();\n newParent.setGUID(uuid);\n newParent.setName(activityCodeText);\n }\n parent = newParent;\n }\n }\n return parent;\n }", "@Override\r\n public String replace(File file, String flickrId, boolean async) throws FlickrException {\r\n Payload payload = new Payload(file, flickrId);\r\n return sendReplaceRequest(async, payload);\r\n }", "public Iterator getAllExtentClasses()\r\n {\r\n ArrayList subTypes = new ArrayList();\r\n\r\n subTypes.addAll(_extents);\r\n\r\n for (int idx = 0; idx < subTypes.size(); idx++)\r\n {\r\n ClassDescriptorDef curClassDef = (ClassDescriptorDef)subTypes.get(idx);\r\n\r\n for (Iterator it = curClassDef.getExtentClasses(); it.hasNext();)\r\n {\r\n ClassDescriptorDef curSubTypeDef = (ClassDescriptorDef)it.next();\r\n\r\n if (!subTypes.contains(curSubTypeDef))\r\n {\r\n subTypes.add(curSubTypeDef);\r\n }\r\n }\r\n }\r\n return subTypes.iterator();\r\n }", "public static String paramMapToString(final Map<String, String[]> parameters) {\n\n final StringBuffer result = new StringBuffer();\n for (final String key : parameters.keySet()) {\n String[] values = parameters.get(key);\n if (null == values) {\n result.append(key).append('&');\n } else {\n for (final String value : parameters.get(key)) {\n result.append(key).append('=').append(CmsEncoder.encode(value)).append('&');\n }\n }\n }\n // remove last '&'\n if (result.length() > 0) {\n result.setLength(result.length() - 1);\n }\n return result.toString();\n }", "public static <T extends InterconnectObject> T fromJson(String data, Class<T> clazz) throws IOException {\n return InterconnectMapper.mapper.readValue(data, clazz);\n }", "private void writeTask(Task task)\n {\n if (!task.getNull())\n {\n if (extractAndConvertTaskType(task) == null || task.getSummary())\n {\n writeWBS(task);\n }\n else\n {\n writeActivity(task);\n }\n }\n }", "synchronized public void completeTask(int taskId, int partitionStoresMigrated) {\n tasksInFlight.remove(taskId);\n\n numTasksCompleted++;\n numPartitionStoresMigrated += partitionStoresMigrated;\n\n updateProgressBar();\n }", "@Override\n public synchronized void start() {\n if (!started.getAndSet(true)) {\n finished.set(false);\n thread.start();\n }\n }", "public String getURN() throws InvalidRegistrationContentException {\n if (parsedConfig==null || parsedConfig.urn==null || parsedConfig.urn.trim().isEmpty()) {\n throw new InvalidRegistrationContentException(\"Invalid registration config - failed to read mediator URN\");\n }\n return parsedConfig.urn;\n }" ]
Add this service to the given service target. @param serviceTarget the service target @param configuration the bootstrap configuration
[ "public static void addService(final ServiceTarget serviceTarget, final Bootstrap.Configuration configuration,\n final ControlledProcessState processState, final BootstrapListener bootstrapListener,\n final RunningModeControl runningModeControl, final AbstractVaultReader vaultReader, final ManagedAuditLogger auditLogger,\n final DelegatingConfigurableAuthorizer authorizer, final ManagementSecurityIdentitySupplier securityIdentitySupplier,\n final SuspendController suspendController) {\n\n // Install Executor services\n final ThreadGroup threadGroup = new ThreadGroup(\"ServerService ThreadGroup\");\n final String namePattern = \"ServerService Thread Pool -- %t\";\n final ThreadFactory threadFactory = doPrivileged(new PrivilegedAction<ThreadFactory>() {\n public ThreadFactory run() {\n return new JBossThreadFactory(threadGroup, Boolean.FALSE, null, namePattern, null, null);\n }\n });\n\n // TODO determine why QueuelessThreadPoolService makes boot take > 35 secs\n// final QueuelessThreadPoolService serverExecutorService = new QueuelessThreadPoolService(Integer.MAX_VALUE, false, new TimeSpec(TimeUnit.SECONDS, 5));\n// serverExecutorService.getThreadFactoryInjector().inject(threadFactory);\n final boolean forDomain = ProcessType.DOMAIN_SERVER == getProcessType(configuration.getServerEnvironment());\n final ServerExecutorService serverExecutorService = new ServerExecutorService(threadFactory, forDomain);\n serviceTarget.addService(MANAGEMENT_EXECUTOR, serverExecutorService)\n .addAliases(Services.JBOSS_SERVER_EXECUTOR, ManagementRemotingServices.SHUTDOWN_EXECUTOR_NAME) // Use this executor for mgmt shutdown for now\n .install();\n final ServerScheduledExecutorService serverScheduledExecutorService = new ServerScheduledExecutorService(threadFactory);\n serviceTarget.addService(JBOSS_SERVER_SCHEDULED_EXECUTOR, serverScheduledExecutorService)\n .addAliases(JBOSS_SERVER_SCHEDULED_EXECUTOR)\n .addDependency(MANAGEMENT_EXECUTOR, ExecutorService.class, serverScheduledExecutorService.executorInjector)\n .install();\n\n final CapabilityRegistry capabilityRegistry = configuration.getCapabilityRegistry();\n ServerService service = new ServerService(configuration, processState, null, bootstrapListener, new ServerDelegatingResourceDefinition(),\n runningModeControl, vaultReader, auditLogger, authorizer, securityIdentitySupplier, capabilityRegistry, suspendController);\n\n ExternalManagementRequestExecutor.install(serviceTarget, threadGroup, EXECUTOR_CAPABILITY.getCapabilityServiceName(), service.getStabilityMonitor());\n\n ServiceBuilder<?> serviceBuilder = serviceTarget.addService(Services.JBOSS_SERVER_CONTROLLER, service);\n serviceBuilder.addDependency(DeploymentMountProvider.SERVICE_NAME,DeploymentMountProvider.class, service.injectedDeploymentRepository);\n serviceBuilder.addDependency(ContentRepository.SERVICE_NAME, ContentRepository.class, service.injectedContentRepository);\n serviceBuilder.addDependency(Services.JBOSS_SERVICE_MODULE_LOADER, ServiceModuleLoader.class, service.injectedModuleLoader);\n serviceBuilder.addDependency(Services.JBOSS_EXTERNAL_MODULE_SERVICE, ExternalModuleService.class,\n service.injectedExternalModuleService);\n serviceBuilder.addDependency(PATH_MANAGER_CAPABILITY.getCapabilityServiceName(), PathManager.class, service.injectedPathManagerService);\n if (configuration.getServerEnvironment().isAllowModelControllerExecutor()) {\n serviceBuilder.addDependency(MANAGEMENT_EXECUTOR, ExecutorService.class, service.getExecutorServiceInjector());\n }\n if (configuration.getServerEnvironment().getLaunchType() == ServerEnvironment.LaunchType.DOMAIN) {\n serviceBuilder.addDependency(HostControllerConnectionService.SERVICE_NAME, ControllerInstabilityListener.class,\n service.getContainerInstabilityInjector());\n }\n\n serviceBuilder.install();\n }" ]
[ "public void growInternal(int amount ) {\n int tmp[] = new int[ data.length + amount ];\n\n System.arraycopy(data,0,tmp,0,data.length);\n this.data = tmp;\n }", "private JSONArray toJsonStringArray(Collection<? extends Object> collection) {\n\n if (null != collection) {\n JSONArray array = new JSONArray();\n for (Object o : collection) {\n array.put(\"\" + o);\n }\n return array;\n } else {\n return null;\n }\n }", "public int[] indices(Collection<E> elems) {\r\n int[] indices = new int[elems.size()];\r\n int i = 0;\r\n for (E elem : elems) {\r\n indices[i++] = indexOf(elem);\r\n }\r\n return indices;\r\n }", "protected static boolean numericEquals(Field vector1, Field vector2) {\n\t\tif (vector1.size() != vector2.size())\n\t\t\treturn false;\n\t\tif (vector1.isEmpty())\n\t\t\treturn true;\n\n\t\tIterator<Object> it1 = vector1.iterator();\n\t\tIterator<Object> it2 = vector2.iterator();\n\n\t\twhile (it1.hasNext()) {\n\t\t\tObject obj1 = it1.next();\n\t\t\tObject obj2 = it2.next();\n\n\t\t\tif (!(obj1 instanceof Number && obj2 instanceof Number))\n\t\t\t\treturn false;\n\n\t\t\tif (((Number) obj1).doubleValue() != ((Number) obj2).doubleValue())\n\t\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}", "public static void Forward(double[] data) {\n double[] result = new double[data.length];\n\n for (int k = 0; k < result.length; k++) {\n double sum = 0;\n for (int n = 0; n < data.length; n++) {\n double theta = ((2.0 * Math.PI) / data.length) * k * n;\n sum += data[n] * cas(theta);\n }\n result[k] = (1.0 / Math.sqrt(data.length)) * sum;\n }\n\n for (int i = 0; i < result.length; i++) {\n data[i] = result[i];\n }\n\n }", "public FormAction setValuesInForm(Form form) {\r\n\t\tFormAction formAction = new FormAction();\r\n\t\tform.setFormAction(formAction);\r\n\t\tthis.forms.add(form);\r\n\t\treturn formAction;\r\n\t}", "public static long randomLongBetween(long min, long max) {\n Random rand = new Random();\n return min + (long) (rand.nextDouble() * (max - min));\n }", "public static aaa_stats get(nitro_service service) throws Exception{\n\t\taaa_stats obj = new aaa_stats();\n\t\taaa_stats[] response = (aaa_stats[])obj.stat_resources(service);\n\t\treturn response[0];\n\t}", "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.hasNext()) {\n buf.append(it.next());\n if (it.hasNext()) {\n if (singleChar != 0) {\n // More efficient\n buf.append(singleChar);\n } else {\n buf.append(separator);\n }\n }\n }\n return buf.toString();\n } else {\n return \"\";\n }\n }" ]
Returns a prefix length for which the range of this segment grouping matches the the block of addresses for that prefix. If no such prefix exists, returns null If this segment grouping represents a single value, returns the bit length @return the prefix length or null
[ "@Override\n\tpublic Integer getPrefixLengthForSingleBlock() {\n\t\tint count = getDivisionCount();\n\t\tint totalPrefix = 0;\n\t\tfor(int i = 0; i < count; i++) {\n\t\t\tAddressDivisionBase div = getDivision(i);\n\t\t\tInteger divPrefix = div.getPrefixLengthForSingleBlock();\n\t\t\tif(divPrefix == null) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\ttotalPrefix += divPrefix;\n\t\t\tif(divPrefix < div.getBitCount()) {\n\t\t\t\t//remaining segments must be full range or we return null\n\t\t\t\tfor(i++; i < count; i++) {\n\t\t\t\t\tAddressDivisionBase laterDiv = getDivision(i);\n\t\t\t\t\tif(!laterDiv.isFullRange()) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cacheBits(totalPrefix);\n\t}" ]
[ "public Collection<EmailAlias> getEmailAliases() {\n URL url = EMAIL_ALIASES_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"GET\");\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n\n int totalCount = responseJSON.get(\"total_count\").asInt();\n Collection<EmailAlias> emailAliases = new ArrayList<EmailAlias>(totalCount);\n JsonArray entries = responseJSON.get(\"entries\").asArray();\n for (JsonValue value : entries) {\n JsonObject emailAliasJSON = value.asObject();\n emailAliases.add(new EmailAlias(emailAliasJSON));\n }\n\n return emailAliases;\n }", "public void removeMarker(Marker marker) {\n if (markers != null && markers.contains(marker)) {\n markers.remove(marker);\n }\n marker.setMap(null);\n }", "protected void removeEmptyDirectories(File outputDirectory)\n {\n if (outputDirectory.exists())\n {\n for (File file : outputDirectory.listFiles(new EmptyDirectoryFilter()))\n {\n file.delete();\n }\n }\n }", "public void setDates(SortedSet<Date> dates, boolean checked) {\n\n m_checkBoxes.clear();\n for (Date date : dates) {\n CmsCheckBox cb = generateCheckBox(date, checked);\n m_checkBoxes.add(cb);\n }\n reInitLayoutElements();\n setDatesInternal(dates);\n }", "public static CmsGalleryTabConfiguration resolve(String configStr) {\r\n\r\n CmsGalleryTabConfiguration tabConfig;\r\n if (CmsStringUtil.isEmptyOrWhitespaceOnly(configStr)) {\r\n configStr = \"*sitemap,types,galleries,categories,vfstree,search,results\";\r\n }\r\n if (DEFAULT_CONFIGURATIONS != null) {\r\n tabConfig = DEFAULT_CONFIGURATIONS.get(configStr);\r\n if (tabConfig != null) {\r\n return tabConfig;\r\n }\r\n\r\n }\r\n return parse(configStr);\r\n }", "public final void setAttributes(final Map<String, Attribute> attributes) {\n for (Map.Entry<String, Attribute> entry: attributes.entrySet()) {\n Object attribute = entry.getValue();\n if (!(attribute instanceof Attribute)) {\n final String msg =\n \"Attribute: '\" + entry.getKey() + \"' is not an attribute. It is a: \" + attribute;\n LOGGER.error(\"Error setting the Attributes: {}\", msg);\n throw new IllegalArgumentException(msg);\n } else {\n ((Attribute) attribute).setConfigName(entry.getKey());\n }\n }\n this.attributes = attributes;\n }", "public static String getTokenText(INode node) {\n\t\tif (node instanceof ILeafNode)\n\t\t\treturn ((ILeafNode) node).getText();\n\t\telse {\n\t\t\tStringBuilder builder = new StringBuilder(Math.max(node.getTotalLength(), 1));\n\t\t\tboolean hiddenSeen = false;\n\t\t\tfor (ILeafNode leaf : node.getLeafNodes()) {\n\t\t\t\tif (!leaf.isHidden()) {\n\t\t\t\t\tif (hiddenSeen && builder.length() > 0)\n\t\t\t\t\t\tbuilder.append(' ');\n\t\t\t\t\tbuilder.append(leaf.getText());\n\t\t\t\t\thiddenSeen = false;\n\t\t\t\t} else {\n\t\t\t\t\thiddenSeen = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn builder.toString();\n\t\t}\n\t}", "public void symm2x2_fast( double a11 , double a12, double a22 )\n {\n// double p = (a11 - a22)*0.5;\n// double r = Math.sqrt(p*p + a12*a12);\n//\n// value0.real = a22 + a12*a12/(r-p);\n// value1.real = a22 - a12*a12/(r+p);\n// }\n//\n// public void symm2x2_std( double a11 , double a12, double a22 )\n// {\n double left = (a11+a22)*0.5;\n double b = (a11-a22)*0.5;\n double right = Math.sqrt(b*b+a12*a12);\n value0.real = left + right;\n value1.real = left - right;\n }", "@Override\n\tpublic void processItemDocument(ItemDocument itemDocument) {\n\t\tthis.countItems++;\n\n\t\t// Do some printing for demonstration/debugging.\n\t\t// Only print at most 50 items (or it would get too slow).\n\t\tif (this.countItems < 10) {\n\t\t\tSystem.out.println(itemDocument);\n\t\t} else if (this.countItems == 10) {\n\t\t\tSystem.out.println(\"*** I won't print any further items.\\n\"\n\t\t\t\t\t+ \"*** We will never finish if we print all the items.\\n\"\n\t\t\t\t\t+ \"*** Maybe remove this debug output altogether.\");\n\t\t}\n\t}" ]
Returns an attribute's map value from this JAR's manifest's main section. The attributes string value will be split on whitespace into map entries, and each entry will be split on '=' to get the key-value pair. The returned map may be safely modified. @param name the attribute's name
[ "public Map<String, String> getMapAttribute(String name, String defaultValue) {\n return mapSplit(getAttribute(name), defaultValue);\n }" ]
[ "public ManagementModelNode findNode(String address) {\n ManagementModelNode root = (ManagementModelNode)tree.getModel().getRoot();\n Enumeration<javax.swing.tree.TreeNode> allNodes = root.depthFirstEnumeration();\n while (allNodes.hasMoreElements()) {\n ManagementModelNode node = (ManagementModelNode)allNodes.nextElement();\n if (node.addressPath().equals(address)) return node;\n }\n\n return null;\n }", "protected List<String> parseOptionalStringValues(final String path) {\n\n final List<I_CmsXmlContentValue> values = m_xml.getValues(path, m_locale);\n if (values == null) {\n return null;\n } else {\n List<String> stringValues = new ArrayList<String>(values.size());\n for (I_CmsXmlContentValue value : values) {\n stringValues.add(value.getStringValue(null));\n }\n return stringValues;\n }\n }", "public T reverse() {\n String id = getId();\n String REVERSE = \"_REVERSE\";\n if (id.endsWith(REVERSE)) {\n setId(id.substring(0, id.length() - REVERSE.length()));\n }\n\n float start = mStart;\n float end = mEnd;\n mStart = end;\n mEnd = start;\n mReverse = !mReverse;\n return self();\n }", "public void unbind(String name) throws ObjectNameNotFoundException\r\n {\r\n /**\r\n * Is DB open? ODMG 3.0 says it has to be to call unbind.\r\n */\r\n if (!this.isOpen())\r\n {\r\n throw new DatabaseClosedException(\"Database is not open. Must have an open DB to call unbind\");\r\n }\r\n TransactionImpl tx = getTransaction();\r\n if (tx == null || !tx.isOpen())\r\n {\r\n throw new TransactionNotInProgressException(\"Tx is not open. Must have an open TX to call lookup.\");\r\n }\r\n\r\n tx.getNamedRootsMap().unbind(name);\r\n }", "public void setColorRange(int firstIndex, int lastIndex, int color1, int color2) {\n\t\tfor (int i = firstIndex; i <= lastIndex; i++)\n\t\t\tmap[i] = ImageMath.mixColors((float)(i-firstIndex)/(lastIndex-firstIndex), color1, color2);\n\t}", "public DbModule getModule(final String moduleId) {\n final DbModule dbModule = repositoryHandler.getModule(moduleId);\n\n if (dbModule == null) {\n throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)\n .entity(\"Module \" + moduleId + \" does not exist.\").build());\n }\n\n return dbModule;\n }", "private void writeCustomInfo(Event event) {\n // insert customInfo (key/value) into DB\n for (Map.Entry<String, String> customInfo : event.getCustomInfo().entrySet()) {\n long cust_id = dbDialect.getIncrementer().nextLongValue();\n getJdbcTemplate()\n .update(\"insert into EVENTS_CUSTOMINFO (ID, EVENT_ID, CUST_KEY, CUST_VALUE)\"\n + \" values (?,?,?,?)\",\n cust_id, event.getPersistedId(), customInfo.getKey(), customInfo.getValue());\n }\n }", "@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 static <T> Set<T> asSet(T[] o) {\r\n return new HashSet<T>(Arrays.asList(o));\r\n }" ]
Use this API to add nsacl6 resources.
[ "public static base_responses add(nitro_service client, nsacl6 resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tnsacl6 addresources[] = new nsacl6[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new nsacl6();\n\t\t\t\taddresources[i].acl6name = resources[i].acl6name;\n\t\t\t\taddresources[i].acl6action = resources[i].acl6action;\n\t\t\t\taddresources[i].td = resources[i].td;\n\t\t\t\taddresources[i].srcipv6 = resources[i].srcipv6;\n\t\t\t\taddresources[i].srcipop = resources[i].srcipop;\n\t\t\t\taddresources[i].srcipv6val = resources[i].srcipv6val;\n\t\t\t\taddresources[i].srcport = resources[i].srcport;\n\t\t\t\taddresources[i].srcportop = resources[i].srcportop;\n\t\t\t\taddresources[i].srcportval = resources[i].srcportval;\n\t\t\t\taddresources[i].destipv6 = resources[i].destipv6;\n\t\t\t\taddresources[i].destipop = resources[i].destipop;\n\t\t\t\taddresources[i].destipv6val = resources[i].destipv6val;\n\t\t\t\taddresources[i].destport = resources[i].destport;\n\t\t\t\taddresources[i].destportop = resources[i].destportop;\n\t\t\t\taddresources[i].destportval = resources[i].destportval;\n\t\t\t\taddresources[i].ttl = resources[i].ttl;\n\t\t\t\taddresources[i].srcmac = resources[i].srcmac;\n\t\t\t\taddresources[i].protocol = resources[i].protocol;\n\t\t\t\taddresources[i].protocolnumber = resources[i].protocolnumber;\n\t\t\t\taddresources[i].vlan = resources[i].vlan;\n\t\t\t\taddresources[i].Interface = resources[i].Interface;\n\t\t\t\taddresources[i].established = resources[i].established;\n\t\t\t\taddresources[i].icmptype = resources[i].icmptype;\n\t\t\t\taddresources[i].icmpcode = resources[i].icmpcode;\n\t\t\t\taddresources[i].priority = resources[i].priority;\n\t\t\t\taddresources[i].state = resources[i].state;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}" ]
[ "public List<Widget> getAllViews() {\n List<Widget> views = new ArrayList<>();\n for (Widget child: mContent.getChildren()) {\n Widget item = ((ListItemHostWidget) child).getGuest();\n if (item != null) {\n views.add(item);\n }\n }\n return views;\n }", "private FieldDescriptor getFldFromReference(TableAlias aTableAlias, ObjectReferenceDescriptor anOrd)\r\n {\r\n FieldDescriptor fld = null;\r\n\r\n if (aTableAlias == getRoot())\r\n {\r\n // no path expression\r\n FieldDescriptor[] fk = anOrd.getForeignKeyFieldDescriptors(aTableAlias.cld);\r\n if (fk.length > 0)\r\n {\r\n fld = fk[0];\r\n }\r\n }\r\n else\r\n {\r\n // attribute with path expression\r\n /**\r\n * MBAIRD\r\n * potentially people are referring to objects, not to the object's primary key, \r\n * and then we need to take the primary key attribute of the referenced object \r\n * to help them out.\r\n */\r\n ClassDescriptor cld = aTableAlias.cld.getRepository().getDescriptorFor(anOrd.getItemClass());\r\n if (cld != null)\r\n {\r\n fld = aTableAlias.cld.getFieldDescriptorByName(cld.getPkFields()[0].getPersistentField().getName());\r\n }\r\n }\r\n\r\n return fld;\r\n }", "public Object[] getForeignKeyValues(Object obj, ClassDescriptor mif)\r\n throws PersistenceBrokerException\r\n {\r\n FieldDescriptor[] fks = getForeignKeyFieldDescriptors(mif);\r\n // materialize object only if FK fields are declared\r\n if(fks.length > 0) obj = ProxyHelper.getRealObject(obj);\r\n Object[] result = new Object[fks.length];\r\n for (int i = 0; i < result.length; i++)\r\n {\r\n FieldDescriptor fmd = fks[i];\r\n PersistentField f = fmd.getPersistentField();\r\n\r\n // BRJ: do NOT convert.\r\n // conversion is done when binding the sql-statement\r\n //\r\n // FieldConversion fc = fmd.getFieldConversion();\r\n // Object val = fc.javaToSql(f.get(obj));\r\n\r\n result[i] = f.get(obj);\r\n }\r\n return result;\r\n }", "@SuppressWarnings(\"unchecked\")\n public <T> Map<String, T> find(final Class<T> valueTypeToFind) {\n return (Map<String, T>) this.values.entrySet().stream()\n .filter(input -> valueTypeToFind.isInstance(input.getValue()))\n .collect(\n Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));\n }", "@SuppressWarnings(\"WeakerAccess\")\n public static SlotReference getSlotReference(DataReference dataReference) {\n return getSlotReference(dataReference.player, dataReference.slot);\n }", "private void writeResourceExtendedAttributes(Project.Resources.Resource xml, Resource mpx)\n {\n Project.Resources.Resource.ExtendedAttribute attrib;\n List<Project.Resources.Resource.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();\n\n for (ResourceField mpxFieldID : getAllResourceExtendedAttributes())\n {\n Object value = mpx.getCachedValue(mpxFieldID);\n\n if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))\n {\n m_extendedAttributesInUse.add(mpxFieldID);\n\n Integer xmlFieldID = Integer.valueOf(MPPResourceField.getID(mpxFieldID) | MPPResourceField.RESOURCE_FIELD_BASE);\n\n attrib = m_factory.createProjectResourcesResourceExtendedAttribute();\n extendedAttributes.add(attrib);\n attrib.setFieldID(xmlFieldID.toString());\n attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));\n attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));\n }\n }\n }", "public static base_response delete(nitro_service client, nssimpleacl resource) throws Exception {\n\t\tnssimpleacl deleteresource = new nssimpleacl();\n\t\tdeleteresource.aclname = resource.aclname;\n\t\treturn deleteresource.delete_resource(client);\n\t}", "private void writeResourceBaselines(Project.Resources.Resource xmlResource, Resource mpxjResource)\n {\n Project.Resources.Resource.Baseline baseline = m_factory.createProjectResourcesResourceBaseline();\n boolean populated = false;\n\n Number cost = mpxjResource.getBaselineCost();\n if (cost != null && cost.intValue() != 0)\n {\n populated = true;\n baseline.setCost(DatatypeConverter.printCurrency(cost));\n }\n\n Duration work = mpxjResource.getBaselineWork();\n if (work != null && work.getDuration() != 0)\n {\n populated = true;\n baseline.setWork(DatatypeConverter.printDuration(this, work));\n }\n\n if (populated)\n {\n xmlResource.getBaseline().add(baseline);\n baseline.setNumber(BigInteger.ZERO);\n }\n\n for (int loop = 1; loop <= 10; loop++)\n {\n baseline = m_factory.createProjectResourcesResourceBaseline();\n populated = false;\n\n cost = mpxjResource.getBaselineCost(loop);\n if (cost != null && cost.intValue() != 0)\n {\n populated = true;\n baseline.setCost(DatatypeConverter.printCurrency(cost));\n }\n\n work = mpxjResource.getBaselineWork(loop);\n if (work != null && work.getDuration() != 0)\n {\n populated = true;\n baseline.setWork(DatatypeConverter.printDuration(this, work));\n }\n\n if (populated)\n {\n xmlResource.getBaseline().add(baseline);\n baseline.setNumber(BigInteger.valueOf(loop));\n }\n }\n }", "public static boolean bidiagOuterBlocks( final int blockLength ,\n final DSubmatrixD1 A ,\n final double gammasU[],\n final double gammasV[])\n {\n// System.out.println(\"---------- Orig\");\n// A.original.print();\n\n int width = Math.min(blockLength,A.col1-A.col0);\n int height = Math.min(blockLength,A.row1-A.row0);\n\n int min = Math.min(width,height);\n\n for( int i = 0; i < min; i++ ) {\n //--- Apply reflector to the column\n\n // compute the householder vector\n if (!computeHouseHolderCol(blockLength, A, gammasU, i))\n return false;\n\n // apply to rest of the columns in the column block\n rank1UpdateMultR_Col(blockLength,A,i,gammasU[A.col0+i]);\n\n // apply to the top row block\n rank1UpdateMultR_TopRow(blockLength,A,i,gammasU[A.col0+i]);\n\n System.out.println(\"After column stuff\");\n A.original.print();\n\n //-- Apply reflector to the row\n if(!computeHouseHolderRow(blockLength,A,gammasV,i))\n return false;\n \n // apply to rest of the rows in the row block\n rank1UpdateMultL_Row(blockLength,A,i,i+1,gammasV[A.row0+i]);\n\n System.out.println(\"After update row\");\n A.original.print();\n\n // apply to the left column block\n // TODO THIS WON'T WORK!!!!!!!!!!!!!\n // Needs the whole matrix to have been updated by the left reflector to compute the correct solution\n// rank1UpdateMultL_LeftCol(blockLength,A,i,i+1,gammasV[A.row0+i]);\n\n System.out.println(\"After row stuff\");\n A.original.print();\n }\n\n return true;\n }" ]
Checks if a new version of the file can be uploaded with the specified name and size. @param name the new name for the file. @param fileSize the size of the new version content in bytes. @return whether or not the file version can be uploaded.
[ "public boolean canUploadVersion(String name, long fileSize) {\n\n URL url = CONTENT_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, \"OPTIONS\");\n\n JsonObject preflightInfo = new JsonObject();\n if (name != null) {\n preflightInfo.add(\"name\", name);\n }\n\n preflightInfo.add(\"size\", fileSize);\n\n request.setBody(preflightInfo.toString());\n try {\n BoxAPIResponse response = request.send();\n\n return response.getResponseCode() == 200;\n } catch (BoxAPIException ex) {\n\n if (ex.getResponseCode() >= 400 && ex.getResponseCode() < 500) {\n // This looks like an error response, menaing the upload would fail\n return false;\n } else {\n // This looks like a network error or server error, rethrow exception\n throw ex;\n }\n }\n }" ]
[ "private float MIN(float first, float second, float third) {\r\n\r\n float min = Integer.MAX_VALUE;\r\n if (first < min) {\r\n min = first;\r\n }\r\n if (second < min) {\r\n min = second;\r\n }\r\n if (third < min) {\r\n min = third;\r\n }\r\n return min;\r\n }", "public TwoDHashMap<K2, K3, V> getAs2d(final K1 firstKey) {\n\t\tfinal HashMap<K2, HashMap<K3, V>> innerMap1 = map.get(firstKey);\n\t\tif( innerMap1 != null ) {\n\t\t\treturn new TwoDHashMap<K2, K3, V>(innerMap1);\n\t\t} else {\n\t\t\treturn new TwoDHashMap<K2, K3, V>();\n\t\t}\n\t\t\n\t}", "private void writeResource(Resource mpxj)\n {\n ResourceType xml = m_factory.createResourceType();\n m_apibo.getResource().add(xml);\n\n xml.setAutoComputeActuals(Boolean.TRUE);\n xml.setCalculateCostFromUnits(Boolean.TRUE);\n xml.setCalendarObjectId(getCalendarUniqueID(mpxj.getResourceCalendar()));\n xml.setCurrencyObjectId(DEFAULT_CURRENCY_ID);\n xml.setDefaultUnitsPerTime(Double.valueOf(1.0));\n xml.setEmailAddress(mpxj.getEmailAddress());\n xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));\n xml.setId(RESOURCE_ID_PREFIX + mpxj.getUniqueID());\n xml.setIsActive(Boolean.TRUE);\n xml.setMaxUnitsPerTime(getPercentage(mpxj.getMaxUnits()));\n xml.setName(mpxj.getName());\n xml.setObjectId(mpxj.getUniqueID());\n xml.setParentObjectId(mpxj.getParentID());\n xml.setResourceNotes(mpxj.getNotes());\n xml.setResourceType(getResourceType(mpxj));\n xml.getUDF().addAll(writeUDFType(FieldTypeClass.RESOURCE, mpxj));\n }", "private ResourceField selectField(ResourceField[] fields, int index)\n {\n if (index < 1 || index > fields.length)\n {\n throw new IllegalArgumentException(index + \" is not a valid field index\");\n }\n return (fields[index - 1]);\n }", "public static List<int[]> createList( int N )\n {\n int data[] = new int[ N ];\n for( int i = 0; i < data.length; i++ ) {\n data[i] = -1;\n }\n\n List<int[]> ret = new ArrayList<int[]>();\n\n createList(data,0,-1,ret);\n\n return ret;\n }", "public void setScale(final float scale) {\n if (equal(mScale, scale) != true) {\n Log.d(TAG, \"setScale(): old: %.2f, new: %.2f\", mScale, scale);\n mScale = scale;\n setScale(mSceneRootObject, scale);\n setScale(mMainCameraRootObject, scale);\n setScale(mLeftCameraRootObject, scale);\n setScale(mRightCameraRootObject, scale);\n for (OnScaledListener listener : mOnScaledListeners) {\n try {\n listener.onScaled(scale);\n } catch (Exception e) {\n e.printStackTrace();\n Log.e(TAG, e, \"setScale()\");\n }\n }\n }\n }", "public static base_responses update(nitro_service client, bridgetable resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tbridgetable updateresources[] = new bridgetable[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tupdateresources[i] = new bridgetable();\n\t\t\t\tupdateresources[i].bridgeage = resources[i].bridgeage;\n\t\t\t}\n\t\t\tresult = update_bulk_request(client, updateresources);\n\t\t}\n\t\treturn result;\n\t}", "private void handleChange(Object propertyId) {\n\n if (!m_saveBtn.isEnabled()) {\n m_saveBtn.setEnabled(true);\n m_saveExitBtn.setEnabled(true);\n }\n m_model.handleChange(propertyId);\n\n }", "private Month readOptionalMonth(JSONValue val) {\n\n String str = readOptionalString(val);\n if (null != str) {\n try {\n return Month.valueOf(str);\n } catch (@SuppressWarnings(\"unused\") IllegalArgumentException e) {\n // Do nothing -return the default value\n }\n }\n return null;\n }" ]
Attaches meta info about the current state of the device to an event. Typically, this meta is added only to the ping event.
[ "private void attachMeta(final JSONObject o, final Context context) {\n // Memory consumption\n try {\n o.put(\"mc\", Utils.getMemoryConsumption());\n } catch (Throwable t) {\n // Ignore\n }\n\n // Attach the network type\n try {\n o.put(\"nt\", Utils.getCurrentNetworkType(context));\n } catch (Throwable t) {\n // Ignore\n }\n }" ]
[ "public String computeTrackSignature(final String title, final SearchableItem artist, final int duration,\n final WaveformDetail waveformDetail, final BeatGrid beatGrid) {\n final String safeTitle = (title == null)? \"\" : title;\n final String artistName = (artist == null)? \"[no artist]\" : artist.label;\n try {\n // Compute the SHA-1 hash of our fields\n MessageDigest digest = MessageDigest.getInstance(\"SHA1\");\n digest.update(safeTitle.getBytes(\"UTF-8\"));\n digest.update((byte) 0);\n digest.update(artistName.getBytes(\"UTF-8\"));\n digest.update((byte) 0);\n digestInteger(digest, duration);\n digest.update(waveformDetail.getData());\n for (int i = 1; i <= beatGrid.beatCount; i++) {\n digestInteger(digest, beatGrid.getBeatWithinBar(i));\n digestInteger(digest, (int)beatGrid.getTimeWithinTrack(i));\n }\n byte[] result = digest.digest();\n\n // Create a hex string representation of the hash\n StringBuilder hex = new StringBuilder(result.length * 2);\n for (byte aResult : result) {\n hex.append(Integer.toString((aResult & 0xff) + 0x100, 16).substring(1));\n }\n\n return hex.toString();\n\n } catch (NullPointerException e) {\n logger.info(\"Returning null track signature because an input element was null.\", e);\n } catch (NoSuchAlgorithmException e) {\n logger.error(\"Unable to obtain SHA-1 MessageDigest instance for computing track signatures.\", e);\n } catch (UnsupportedEncodingException e) {\n logger.error(\"Unable to work with UTF-8 string encoding for computing track signatures.\", e);\n }\n return null; // We were unable to compute a signature\n }", "public base_response enable_features(String[] features) throws Exception\n\t{\n\t\tbase_response result = null;\n\t\tnsfeature resource = new nsfeature();\n\t\tresource.set_feature(features);\n\t\toptions option = new options();\n\t\toption.set_action(\"enable\");\n\t\tresult = resource.perform_operation(this, option);\n\t\treturn result;\n\t}", "private InputStream runSparqlQuery(String query) throws IOException {\n\t\ttry {\n\t\t\tString queryString = \"query=\" + URLEncoder.encode(query, \"UTF-8\")\n\t\t\t\t\t+ \"&format=json\";\n\t\t\tURL url = new URL(\"https://query.wikidata.org/sparql?\"\n\t\t\t\t\t+ queryString);\n\t\t\tHttpURLConnection connection = (HttpURLConnection) url\n\t\t\t\t\t.openConnection();\n\t\t\tconnection.setRequestMethod(\"GET\");\n\n\t\t\treturn connection.getInputStream();\n\t\t} catch (UnsupportedEncodingException | MalformedURLException e) {\n\t\t\tthrow new RuntimeException(e.getMessage(), e);\n\t\t}\n\t}", "@SuppressWarnings(\"unused\")\n private void setTextureNumber(int type, int number) {\n m_numTextures.put(AiTextureType.fromRawValue(type), number);\n }", "public static BufferedImage resizeToWidth(BufferedImage originalImage, int widthOut) {\n \n int width = originalImage.getWidth();\n \n int height = originalImage.getHeight();\n \n int widthPercent = (widthOut * 100) / width;\n \n int newHeight = (height * widthPercent) / 100;\n \n BufferedImage resizedImage =\n new BufferedImage(widthOut, newHeight, BufferedImage.TYPE_INT_ARGB);\n Graphics2D g = resizedImage.createGraphics();\n g.drawImage(originalImage, 0, 0, widthOut, newHeight, null);\n g.dispose();\n \n return resizedImage;\n }", "public static <T> T columnStringToObject(Class objClass, String str, String delimiterRegex, String[] fieldNames)\r\n throws InstantiationException, IllegalAccessException, NoSuchFieldException, NoSuchMethodException, InvocationTargetException\r\n {\r\n Pattern delimiterPattern = Pattern.compile(delimiterRegex);\r\n return StringUtils.<T>columnStringToObject(objClass, str, delimiterPattern, fieldNames);\r\n }", "private void readPredecessors(net.sf.mpxj.planner.schema.Task plannerTask)\n {\n Task mpxjTask = m_projectFile.getTaskByUniqueID(getInteger(plannerTask.getId()));\n\n Predecessors predecessors = plannerTask.getPredecessors();\n if (predecessors != null)\n {\n List<Predecessor> predecessorList = predecessors.getPredecessor();\n for (Predecessor predecessor : predecessorList)\n {\n Integer predecessorID = getInteger(predecessor.getPredecessorId());\n Task predecessorTask = m_projectFile.getTaskByUniqueID(predecessorID);\n if (predecessorTask != null)\n {\n Duration lag = getDuration(predecessor.getLag());\n if (lag == null)\n {\n lag = Duration.getInstance(0, TimeUnit.HOURS);\n }\n Relation relation = mpxjTask.addPredecessor(predecessorTask, RELATIONSHIP_TYPES.get(predecessor.getType()), lag);\n m_eventManager.fireRelationReadEvent(relation);\n }\n }\n }\n\n //\n // Process child tasks\n //\n List<net.sf.mpxj.planner.schema.Task> childTasks = plannerTask.getTask();\n for (net.sf.mpxj.planner.schema.Task childTask : childTasks)\n {\n readPredecessors(childTask);\n }\n }", "protected Object[] idsOf(final List<?> idsOrValues) {\n // convert list to array that we can mutate\n final Object[] ids = idsOrValues.toArray();\n\n // mutate array to contain only non-empty ids\n int length = 0;\n for (int i = 0; i < ids.length;) {\n final Object p = ids[i++];\n if (p instanceof HasId) {\n // only use values with ids that are non-empty\n final String id = ((HasId) p).getId();\n if (!StringUtils.isEmpty(id)) {\n ids[length++] = id;\n }\n } else if (p instanceof String) {\n // only use ids that are non-empty\n final String id = p.toString();\n if (!StringUtils.isEmpty(id)) {\n ids[length++] = id;\n }\n } else if (p != null) {\n throw new StoreException(\"Invalid id or value of type \" + p);\n }\n }\n\n // no ids in array\n if (length == 0) {\n return null;\n }\n\n // some ids in array\n if (length != ids.length) {\n final Object[] tmp = new Object[length];\n System.arraycopy(ids, 0, tmp, 0, length);\n return tmp;\n }\n\n // array was full\n return ids;\n }", "public static vpnvserver_vpnsessionpolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tvpnvserver_vpnsessionpolicy_binding obj = new vpnvserver_vpnsessionpolicy_binding();\n\t\tobj.set_name(name);\n\t\tvpnvserver_vpnsessionpolicy_binding response[] = (vpnvserver_vpnsessionpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}" ]
Want to make arbitrary probability queries? Then this is the method for you. Given the filename, it reads it in and breaks it into documents, and then makes a CRFCliqueTree for each document. you can then ask the clique tree for marginals and conditional probabilities of almost anything you want.
[ "public List<CRFCliqueTree> getCliqueTrees(String filename, DocumentReaderAndWriter<IN> readerAndWriter) {\r\n // only for the OCR data does this matter\r\n flags.ocrTrain = false;\r\n\r\n List<CRFCliqueTree> cts = new ArrayList<CRFCliqueTree>();\r\n ObjectBank<List<IN>> docs = makeObjectBankFromFile(filename, readerAndWriter);\r\n for (List<IN> doc : docs) {\r\n cts.add(getCliqueTree(doc));\r\n }\r\n\r\n return cts;\r\n }" ]
[ "public static String readUntilTag(Reader r) throws IOException {\r\n if (!r.ready()) {\r\n return \"\";\r\n }\r\n StringBuilder b = new StringBuilder();\r\n int c = r.read();\r\n while (c >= 0 && c != '<') {\r\n b.append((char) c);\r\n c = r.read();\r\n }\r\n return b.toString();\r\n }", "public static ScheduledJob create(String cronExpression)\n {\n ScheduledJob res = new ScheduledJob();\n res.cronExpression = cronExpression;\n return res;\n }", "private String addPathProperty(final List<String> command, final String typeName, final String propertyName, final Map<String, String> properties, final DirectoryGrouping directoryGrouping,\n final File typeDir, File serverDir) {\n final String result;\n final String value = properties.get(propertyName);\n if (value == null) {\n switch (directoryGrouping) {\n case BY_TYPE:\n result = getAbsolutePath(typeDir, \"servers\", serverName);\n break;\n case BY_SERVER:\n default:\n result = getAbsolutePath(serverDir, typeName);\n break;\n }\n properties.put(propertyName, result);\n } else {\n final File dir = new File(value);\n switch (directoryGrouping) {\n case BY_TYPE:\n result = getAbsolutePath(dir, \"servers\", serverName);\n break;\n case BY_SERVER:\n default:\n result = getAbsolutePath(dir, serverName);\n break;\n }\n }\n command.add(String.format(\"-D%s=%s\", propertyName, result));\n return result;\n }", "private static EventEnumType convertEventType(org.talend.esb.sam.common.event.EventTypeEnum eventType) {\n if (eventType == null) {\n return null;\n }\n return EventEnumType.valueOf(eventType.name());\n }", "protected synchronized void doWriteObjects(boolean isFlush) throws TransactionAbortedException, LockNotGrantedException\r\n {\r\n /*\r\n arminw:\r\n if broker isn't in PB-tx, start tx\r\n */\r\n if (!getBroker().isInTransaction())\r\n {\r\n if (log.isDebugEnabled()) log.debug(\"call beginTransaction() on PB instance\");\r\n broker.beginTransaction();\r\n }\r\n\r\n // Notify objects of impending commits.\r\n performTransactionAwareBeforeCommit();\r\n\r\n // Now perfom the real work\r\n objectEnvelopeTable.writeObjects(isFlush);\r\n // now we have to perform the named objects\r\n namedRootsMap.performDeletion();\r\n namedRootsMap.performInsert();\r\n namedRootsMap.afterWriteCleanup();\r\n }", "public static base_response unset(nitro_service client, nsacl6 resource, String[] args) throws Exception{\n\t\tnsacl6 unsetresource = new nsacl6();\n\t\tunsetresource.acl6name = resource.acl6name;\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "public static JSONObject loadJSONAsset(Context context, final String asset) {\n if (asset == null) {\n return new JSONObject();\n }\n return getJsonObject(org.gearvrf.widgetlib.main.Utility.readTextFile(context, asset));\n }", "private String findLoggingProfile(final ResourceRoot resourceRoot) {\n final Manifest manifest = resourceRoot.getAttachment(Attachments.MANIFEST);\n if (manifest != null) {\n final String loggingProfile = manifest.getMainAttributes().getValue(LOGGING_PROFILE);\n if (loggingProfile != null) {\n LoggingLogger.ROOT_LOGGER.debugf(\"Logging profile '%s' found in '%s'.\", loggingProfile, resourceRoot);\n return loggingProfile;\n }\n }\n return null;\n }", "public static authorizationpolicylabel_binding get(nitro_service service, String labelname) throws Exception{\n\t\tauthorizationpolicylabel_binding obj = new authorizationpolicylabel_binding();\n\t\tobj.set_labelname(labelname);\n\t\tauthorizationpolicylabel_binding response = (authorizationpolicylabel_binding) obj.get_resource(service);\n\t\treturn response;\n\t}" ]
Get the Operation metadata for an MBean by name. @return the {@link Map} of {@link String} operation names to {@link MBeanOperationInfo} values.
[ "public Map<String, MBeanOperationInfo> getOperationMetadata() {\n\n MBeanOperationInfo[] operations = mBeanInfo.getOperations();\n\n Map<String, MBeanOperationInfo> operationMap = new TreeMap<String, MBeanOperationInfo>();\n for (MBeanOperationInfo operation: operations) {\n operationMap.put(operation.getName(), operation);\n }\n return operationMap;\n }" ]
[ "public void deleteLicense(final String licName) {\n final DbLicense dbLicense = getLicense(licName);\n\n repoHandler.deleteLicense(dbLicense.getName());\n\n final FiltersHolder filters = new FiltersHolder();\n final LicenseIdFilter licenseIdFilter = new LicenseIdFilter(licName);\n filters.addFilter(licenseIdFilter);\n\n for (final DbArtifact artifact : repoHandler.getArtifacts(filters)) {\n repoHandler.removeLicenseFromArtifact(artifact, licName, this);\n }\n }", "public static SimpleMatrix diag( Class type, double ...vals ) {\n SimpleMatrix M = new SimpleMatrix(vals.length,vals.length,type);\n for (int i = 0; i < vals.length; i++) {\n M.set(i,i,vals[i]);\n }\n return M;\n }", "public static systemcore get(nitro_service service) throws Exception{\n\t\tsystemcore obj = new systemcore();\n\t\tsystemcore[] response = (systemcore[])obj.get_resources(service);\n\t\treturn response[0];\n\t}", "protected <T, A> ActiveOperation<T, A> getActiveOperation(final ManagementRequestHeader header) {\n return getActiveOperation(header.getBatchId());\n }", "private void logBinaryStringInfo(StringBuilder binaryString) {\n\n encodeInfo += \"Binary Length: \" + binaryString.length() + \"\\n\";\n encodeInfo += \"Binary String: \";\n\n int nibble = 0;\n for (int i = 0; i < binaryString.length(); i++) {\n switch (i % 4) {\n case 0:\n if (binaryString.charAt(i) == '1') {\n nibble += 8;\n }\n break;\n case 1:\n if (binaryString.charAt(i) == '1') {\n nibble += 4;\n }\n break;\n case 2:\n if (binaryString.charAt(i) == '1') {\n nibble += 2;\n }\n break;\n case 3:\n if (binaryString.charAt(i) == '1') {\n nibble += 1;\n }\n encodeInfo += Integer.toHexString(nibble);\n nibble = 0;\n break;\n }\n }\n\n if ((binaryString.length() % 4) != 0) {\n encodeInfo += Integer.toHexString(nibble);\n }\n\n encodeInfo += \"\\n\";\n }", "public PhotoContext getContext(String photoId, String userId) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_CONTEXT);\r\n\r\n parameters.put(\"photo_id\", photoId);\r\n parameters.put(\"user_id\", userId);\r\n\r\n Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n\r\n Collection<Element> payload = response.getPayloadCollection();\r\n PhotoContext photoContext = new PhotoContext();\r\n for (Element element : payload) {\r\n String elementName = element.getTagName();\r\n if (elementName.equals(\"prevphoto\")) {\r\n Photo photo = new Photo();\r\n photo.setId(element.getAttribute(\"id\"));\r\n photoContext.setPreviousPhoto(photo);\r\n } else if (elementName.equals(\"nextphoto\")) {\r\n Photo photo = new Photo();\r\n photo.setId(element.getAttribute(\"id\"));\r\n photoContext.setNextPhoto(photo);\r\n } else {\r\n if (logger.isInfoEnabled()) {\r\n logger.info(\"unsupported element name: \" + elementName);\r\n }\r\n }\r\n }\r\n return photoContext;\r\n }", "public static final BigDecimal printRate(Rate rate)\n {\n BigDecimal result = null;\n if (rate != null && rate.getAmount() != 0)\n {\n result = new BigDecimal(rate.getAmount());\n }\n return result;\n }", "public AsciiTable setPaddingTop(int paddingTop) {\r\n\t\tfor(AT_Row row : this.rows){\r\n\t\t\tif(row.getType()==TableRowType.CONTENT){\r\n\t\t\t\trow.setPaddingTop(paddingTop);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}", "public void strokeEllipse(Rectangle rect, Color color, float linewidth) {\n\t\ttemplate.saveState();\n\t\tsetStroke(color, linewidth, null);\n\t\ttemplate.ellipse(origX + rect.getLeft(), origY + rect.getBottom(), origX + rect.getRight(),\n\t\t\t\torigY + rect.getTop());\n\t\ttemplate.stroke();\n\t\ttemplate.restoreState();\n\t}" ]
Get the names of the paths that would apply to the request @param requestUrl URL of the request @param requestType Type of the request: GET, POST, PUT, or DELETE as integer @return JSONArray of path names @throws Exception
[ "private JSONArray getApplicablePathNames (String requestUrl, Integer requestType) throws Exception {\n RequestInformation requestInfo = requestInformation.get();\n List<EndpointOverride> applicablePaths;\n JSONArray pathNames = new JSONArray();\n // Get all paths that match the request\n applicablePaths = PathOverrideService.getInstance().getSelectedPaths(Constants.OVERRIDE_TYPE_REQUEST, requestInfo.client,\n requestInfo.profile,\n requestUrl + \"?\" + requestInfo.originalRequestInfo.getQueryString(),\n requestType, true);\n // Extract just the path name from each path\n for (EndpointOverride path : applicablePaths) {\n JSONObject pathName = new JSONObject();\n pathName.put(\"name\", path.getPathName());\n pathNames.put(pathName);\n }\n\n return pathNames;\n }" ]
[ "@SuppressWarnings(\"unchecked\")\n protected String addPostRunDependent(Creatable<? extends Indexable> creatable) {\n TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) creatable;\n return this.addPostRunDependent(dependency);\n }", "public void setStatusBarMessage(final String message)\r\n {\r\n // Guaranteed to return a non-null array\r\n Object[] listeners = listenerList.getListenerList();\r\n // Process the listeners last to first, notifying\r\n // those that are interested in this event\r\n for (int i = listeners.length-2; i>=0; i-=2) {\r\n if (listeners[i]==StatusMessageListener.class) \r\n {\r\n ((StatusMessageListener)listeners[i+1]).statusMessageReceived(message);\r\n } \r\n } \r\n }", "private void processGeneratedProperties(\n\t\t\tSerializable id,\n\t\t\tObject entity,\n\t\t\tObject[] state,\n\t\t\tSharedSessionContractImplementor session,\n\t\t\tGenerationTiming matchTiming) {\n\n\t\tTuple tuple = getFreshTuple( EntityKeyBuilder.fromPersister( this, id, session ), session );\n\t\tsaveSharedTuple( entity, tuple, session );\n\n\t\tif ( tuple == null || tuple.getSnapshot().isEmpty() ) {\n\t\t\tthrow log.couldNotRetrieveEntityForRetrievalOfGeneratedProperties( getEntityName(), id );\n\t\t}\n\n\t\tint propertyIndex = -1;\n\t\tfor ( NonIdentifierAttribute attribute : getEntityMetamodel().getProperties() ) {\n\t\t\tpropertyIndex++;\n\t\t\tfinal ValueGeneration valueGeneration = attribute.getValueGenerationStrategy();\n\t\t\tif ( isReadRequired( valueGeneration, matchTiming ) ) {\n\t\t\t\tObject hydratedState = gridPropertyTypes[propertyIndex].hydrate( tuple, getPropertyAliases( \"\", propertyIndex ), session, entity );\n\t\t\t\tstate[propertyIndex] = gridPropertyTypes[propertyIndex].resolve( hydratedState, session, entity );\n\t\t\t\tsetPropertyValue( entity, propertyIndex, state[propertyIndex] );\n\t\t\t}\n\t\t}\n\t}", "public static final Bytes of(CharSequence cs) {\n if (cs instanceof String) {\n return of((String) cs);\n }\n\n Objects.requireNonNull(cs);\n if (cs.length() == 0) {\n return EMPTY;\n }\n\n ByteBuffer bb = StandardCharsets.UTF_8.encode(CharBuffer.wrap(cs));\n\n if (bb.hasArray()) {\n // this byte buffer has never escaped so can use its byte array directly\n return new Bytes(bb.array(), bb.position() + bb.arrayOffset(), bb.limit());\n } else {\n byte[] data = new byte[bb.remaining()];\n bb.get(data);\n return new Bytes(data);\n }\n }", "public static byte[] encode(byte[] ba, int offset, long v) {\n ba[offset + 0] = (byte) (v >>> 56);\n ba[offset + 1] = (byte) (v >>> 48);\n ba[offset + 2] = (byte) (v >>> 40);\n ba[offset + 3] = (byte) (v >>> 32);\n ba[offset + 4] = (byte) (v >>> 24);\n ba[offset + 5] = (byte) (v >>> 16);\n ba[offset + 6] = (byte) (v >>> 8);\n ba[offset + 7] = (byte) (v >>> 0);\n return ba;\n }", "private void writeExceptions(List<ProjectCalendar> records) throws IOException\n {\n for (ProjectCalendar record : records)\n {\n if (!record.getCalendarExceptions().isEmpty())\n {\n // Need to move HOLI up here and get 15 exceptions per line as per USACE spec.\n // for now, we'll write one line for each calendar exception, hope there aren't too many\n //\n // changing this would be a serious upgrade, too much coding to do today....\n for (ProjectCalendarException ex : record.getCalendarExceptions())\n {\n writeCalendarException(record, ex);\n }\n }\n m_eventManager.fireCalendarWrittenEvent(record); // left here from MPX template, maybe not needed???\n }\n }", "public static DMatrixRMaj nullspaceQRP( DMatrixRMaj A , int totalSingular ) {\n SolveNullSpaceQRP_DDRM solver = new SolveNullSpaceQRP_DDRM();\n\n DMatrixRMaj nullspace = new DMatrixRMaj(1,1);\n\n if( !solver.process(A,totalSingular,nullspace))\n throw new RuntimeException(\"Solver failed. try SVD based method instead?\");\n\n return nullspace;\n }", "public static vpnsessionaction[] get(nitro_service service) throws Exception{\n\t\tvpnsessionaction obj = new vpnsessionaction();\n\t\tvpnsessionaction[] response = (vpnsessionaction[])obj.get_resources(service);\n\t\treturn response;\n\t}", "public static double elementSum( DMatrixSparseCSC A ) {\n if( A.nz_length == 0)\n return 0;\n\n double sum = 0;\n for(int i = 0; i < A.nz_length; i++ ) {\n sum += A.nz_values[i];\n }\n\n return sum;\n }" ]
This method calls the index state. It should be called once per crawl in order to setup the crawl. @return The initial state.
[ "public StateVertex crawlIndex() {\n\t\tLOG.debug(\"Setting up vertex of the index page\");\n\n\t\tif (basicAuthUrl != null) {\n\t\t\tbrowser.goToUrl(basicAuthUrl);\n\t\t}\n\n\t\tbrowser.goToUrl(url);\n\n\t\t// Run url first load plugin to clear the application state\n\t\tplugins.runOnUrlFirstLoadPlugins(context);\n\n\t\tplugins.runOnUrlLoadPlugins(context);\n\t\tStateVertex index = vertexFactory.createIndex(url.toString(), browser.getStrippedDom(),\n\t\t\t\tstateComparator.getStrippedDom(browser), browser);\n\t\tPreconditions.checkArgument(index.getId() == StateVertex.INDEX_ID,\n\t\t\t\t\"It seems some the index state is crawled more than once.\");\n\n\t\tLOG.debug(\"Parsing the index for candidate elements\");\n\t\tImmutableList<CandidateElement> extract = candidateExtractor.extract(index);\n\n\t\tplugins.runPreStateCrawlingPlugins(context, extract, index);\n\n\t\tcandidateActionCache.addActions(extract, index);\n\n\t\treturn index;\n\n\t}" ]
[ "public static void configure(Job conf, SimpleConfiguration props) {\n try {\n\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n props.save(baos);\n\n conf.getConfiguration().set(PROPS_CONF_KEY,\n new String(baos.toByteArray(), StandardCharsets.UTF_8));\n\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }", "public synchronized void insert(long data) {\n resetIfNeeded();\n long index = 0;\n if(data >= this.upperBound) {\n index = nBuckets - 1;\n } else if(data < 0) {\n logger.error(data + \" can't be bucketed because it is negative!\");\n return;\n } else {\n index = data / step;\n }\n if(index < 0 || index >= nBuckets) {\n // This should be dead code. Defending against code changes in\n // future.\n logger.error(data + \" can't be bucketed because index is not in range [0,nBuckets).\");\n return;\n }\n buckets[(int) index]++;\n sum += data;\n size++;\n }", "public static boolean isAscii(Slice utf8)\n {\n int length = utf8.length();\n int offset = 0;\n\n // Length rounded to 8 bytes\n int length8 = length & 0x7FFF_FFF8;\n for (; offset < length8; offset += 8) {\n if ((utf8.getLongUnchecked(offset) & TOP_MASK64) != 0) {\n return false;\n }\n }\n // Enough bytes left for 32 bits?\n if (offset + 4 < length) {\n if ((utf8.getIntUnchecked(offset) & TOP_MASK32) != 0) {\n return false;\n }\n\n offset += 4;\n }\n // Do the rest one by one\n for (; offset < length; offset++) {\n if ((utf8.getByteUnchecked(offset) & 0x80) != 0) {\n return false;\n }\n }\n\n return true;\n }", "public static <V> V doWorkInPoolNicely(final Pool<Jedis> pool, final PoolWork<Jedis, V> work) {\n final V result;\n try {\n result = doWorkInPool(pool, work);\n } catch (RuntimeException re) {\n throw re;\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n return result;\n }", "public static int[][] toInt(double[][] array) {\n int[][] n = new int[array.length][array[0].length];\n for (int i = 0; i < array.length; i++) {\n for (int j = 0; j < array[0].length; j++) {\n n[i][j] = (int) array[i][j];\n }\n }\n return n;\n }", "public boolean detectSonyMylo() {\r\n\r\n if ((userAgent.indexOf(manuSony) != -1)\r\n && ((userAgent.indexOf(qtembedded) != -1) || (userAgent.indexOf(mylocom2) != -1))) {\r\n return true;\r\n }\r\n return false;\r\n }", "public synchronized void stop () {\n if (isRunning()) {\n MetadataFinder.getInstance().removeTrackMetadataListener(metadataListener);\n WaveformFinder.getInstance().removeWaveformListener(waveformListener);\n BeatGridFinder.getInstance().removeBeatGridListener(beatGridListener);\n running.set(false);\n pendingUpdates.clear();\n queueHandler.interrupt();\n queueHandler = null;\n\n // Report the loss of our signatures, on the proper thread, outside our lock\n final Set<Integer> dyingSignatures = new HashSet<Integer>(signatures.keySet());\n signatures.clear();\n SwingUtilities.invokeLater(new Runnable() {\n @Override\n public void run() {\n for (Integer player : dyingSignatures) {\n deliverSignatureUpdate(player, null);\n }\n }\n });\n }\n deliverLifecycleAnnouncement(logger, false);\n }", "public static onlinkipv6prefix[] get(nitro_service service, String ipv6prefix[]) throws Exception{\n\t\tif (ipv6prefix !=null && ipv6prefix.length>0) {\n\t\t\tonlinkipv6prefix response[] = new onlinkipv6prefix[ipv6prefix.length];\n\t\t\tonlinkipv6prefix obj[] = new onlinkipv6prefix[ipv6prefix.length];\n\t\t\tfor (int i=0;i<ipv6prefix.length;i++) {\n\t\t\t\tobj[i] = new onlinkipv6prefix();\n\t\t\t\tobj[i].set_ipv6prefix(ipv6prefix[i]);\n\t\t\t\tresponse[i] = (onlinkipv6prefix) obj[i].get_resource(service);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t\treturn null;\n\t}", "public void addRequiredBundles(Set<String> bundles) {\n\t\t// TODO manage transitive dependencies\n\t\t// don't require self\n\t\tSet<String> bundlesToMerge;\n\t\tString bundleName = (String) getMainAttributes().get(BUNDLE_SYMBOLIC_NAME);\n\t\tif (bundleName != null) {\n\t\t\tint idx = bundleName.indexOf(';');\n\t\t\tif (idx >= 0) {\n\t\t\t\tbundleName = bundleName.substring(0, idx);\n\t\t\t}\n\t\t}\n\t\tif (bundleName != null && bundles.contains(bundleName)\n\t\t\t\t|| projectName != null && bundles.contains(projectName)) {\n\t\t\tbundlesToMerge = new LinkedHashSet<String>(bundles);\n\t\t\tbundlesToMerge.remove(bundleName);\n\t\t\tbundlesToMerge.remove(projectName);\n\t\t} else {\n\t\t\tbundlesToMerge = bundles;\n\t\t}\n\t\tString s = (String) getMainAttributes().get(REQUIRE_BUNDLE);\n\t\tWrapper<Boolean> modified = Wrapper.wrap(this.modified);\n\t\tString result = mergeIntoCommaSeparatedList(s, bundlesToMerge, modified, lineDelimiter);\n\t\tthis.modified = modified.get();\n\t\tgetMainAttributes().put(REQUIRE_BUNDLE, result);\n\t}" ]
Creates a map of identifiers or page titles to documents retrieved via the API URL @param properties parameter setting for wbgetentities @return map of document identifiers or titles to documents retrieved via the API URL @throws MediaWikiApiErrorException if the API returns an error @throws IOException if we encounter network issues or HTTP 500 errors from Wikibase
[ "public Map<String, EntityDocument> wbGetEntities(\n\t\t\tWbGetEntitiesActionData properties)\n\t\t\tthrows MediaWikiApiErrorException, IOException {\n\t\treturn wbGetEntities(properties.ids, properties.sites,\n\t\t\t\tproperties.titles, properties.props, properties.languages,\n\t\t\t\tproperties.sitefilter);\n\t}" ]
[ "private Object getLiteralValue(Expression expression) {\n\t\tif (!(expression instanceof Literal)) {\n\t\t\tthrow new IllegalArgumentException(\"Expression \" + expression + \" is not a Literal.\");\n\t\t}\n\t\treturn ((Literal) expression).getValue();\n\t}", "protected ValueContainer[] getAllValues(ClassDescriptor cld, Object obj) throws PersistenceBrokerException\r\n {\r\n return m_broker.serviceBrokerHelper().getAllRwValues(cld, obj);\r\n }", "public void useNewRESTService(String address) throws Exception {\n List<Object> providers = createJAXRSProviders();\n\n org.customer.service.CustomerService customerService = JAXRSClientFactory\n .createFromModel(address, \n org.customer.service.CustomerService.class,\n \"classpath:/model/CustomerService-jaxrs.xml\", \n providers, \n null);\n\n System.out.println(\"Using new RESTful CustomerService with new client\");\n\n customer.v2.Customer customer = createNewCustomer(\"Smith New REST\");\n customerService.updateCustomer(customer);\n\n customer = customerService.getCustomerByName(\"Smith New REST\");\n printNewCustomerDetails(customer);\n }", "private void writeCompressedText(File file, byte[] compressedContent) throws IOException\r\n {\r\n ByteArrayInputStream bais = new ByteArrayInputStream(compressedContent);\r\n GZIPInputStream gis = new GZIPInputStream(bais);\r\n BufferedReader input = new BufferedReader(new InputStreamReader(gis));\r\n BufferedWriter output = new BufferedWriter(new FileWriter(file));\r\n String line;\r\n\r\n while ((line = input.readLine()) != null)\r\n {\r\n output.write(line);\r\n output.write('\\n');\r\n }\r\n input.close();\r\n gis.close();\r\n bais.close();\r\n output.close();\r\n }", "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);\n int prefixIndex = header.indexOf(\"PPX!!!!|\");\n int suffixIndex = header.indexOf(\"|!!!!XPP\");\n\n if (prefixIndex != 0 || suffixIndex == -1)\n {\n throw new IOException(\"File format not recognised\");\n }\n\n int skip = suffixIndex + 9;\n stream.reset();\n stream.skip(skip);\n\n return header.substring(prefixIndex + 8, suffixIndex);\n }", "private void addModuleToTree(final DbModule module, final TreeNode tree) {\n final TreeNode subTree = new TreeNode();\n subTree.setName(module.getName());\n tree.addChild(subTree);\n\n // Add SubsubModules\n for (final DbModule subsubmodule : module.getSubmodules()) {\n addModuleToTree(subsubmodule, subTree);\n }\n }", "public List<Gallery> getList(String userId, int perPage, int page) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_LIST);\r\n parameters.put(\"user_id\", userId);\r\n if (perPage > 0) {\r\n parameters.put(\"per_page\", String.valueOf(perPage));\r\n }\r\n if (page > 0) {\r\n parameters.put(\"page\", String.valueOf(page));\r\n }\r\n\r\n Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n\r\n Element element = response.getPayload();\r\n GalleryList<Gallery> galleries = new GalleryList<Gallery>();\r\n galleries.setPage(element.getAttribute(\"page\"));\r\n galleries.setPages(element.getAttribute(\"pages\"));\r\n galleries.setPerPage(element.getAttribute(\"per_page\"));\r\n galleries.setTotal(element.getAttribute(\"total\"));\r\n\r\n NodeList galleryNodes = element.getElementsByTagName(\"gallery\");\r\n for (int i = 0; i < galleryNodes.getLength(); i++) {\r\n Element galleryElement = (Element) galleryNodes.item(i);\r\n Gallery gallery = new Gallery();\r\n gallery.setId(galleryElement.getAttribute(\"id\"));\r\n gallery.setUrl(galleryElement.getAttribute(\"url\"));\r\n\r\n User owner = new User();\r\n owner.setId(galleryElement.getAttribute(\"owner\"));\r\n gallery.setOwner(owner);\r\n gallery.setCreateDate(galleryElement.getAttribute(\"date_create\"));\r\n gallery.setUpdateDate(galleryElement.getAttribute(\"date_update\"));\r\n gallery.setPrimaryPhotoId(galleryElement.getAttribute(\"primary_photo_id\"));\r\n gallery.setPrimaryPhotoServer(galleryElement.getAttribute(\"primary_photo_server\"));\r\n gallery.setPrimaryPhotoFarm(galleryElement.getAttribute(\"primary_photo_farm\"));\r\n gallery.setPrimaryPhotoSecret(galleryElement.getAttribute(\"primary_photo_secret\"));\r\n gallery.setPhotoCount(galleryElement.getAttribute(\"count_photos\"));\r\n gallery.setVideoCount(galleryElement.getAttribute(\"count_videos\"));\r\n\r\n galleries.add(gallery);\r\n }\r\n return galleries;\r\n }", "private void uncheckAll(CmsList<? extends I_CmsListItem> list) {\r\n\r\n for (Widget it : list) {\r\n CmsTreeItem treeItem = (CmsTreeItem)it;\r\n treeItem.getCheckBox().setChecked(false);\r\n uncheckAll(treeItem.getChildren());\r\n }\r\n }", "public static String getVcsRevision(Map<String, String> env) {\n String revision = env.get(\"SVN_REVISION\");\n if (StringUtils.isBlank(revision)) {\n revision = env.get(GIT_COMMIT);\n }\n if (StringUtils.isBlank(revision)) {\n revision = env.get(\"P4_CHANGELIST\");\n }\n return revision;\n }" ]
Signal that all threads have run to completion, and the multithreaded environment is over. @param check The name of the thread group passed to startThreads()
[ "public static void endThreads(String check){\r\n //(error check)\r\n if(currentThread != -1L){\r\n throw new IllegalStateException(\"endThreads() called, but thread \" + currentThread + \" has not finished (exception in thread?)\");\r\n }\r\n //(end threaded environment)\r\n assert !control.isHeldByCurrentThread();\r\n isThreaded = false;\r\n //(write remaining threads)\r\n boolean cleanPass = false;\r\n while(!cleanPass){\r\n cleanPass = true;\r\n for(long thread : threadedLogQueue.keySet()){\r\n assert currentThread < 0L;\r\n if(threadedLogQueue.get(thread) != null && !threadedLogQueue.get(thread).isEmpty()){\r\n //(mark queue as unclean)\r\n cleanPass = false;\r\n //(variables)\r\n Queue<Runnable> backlog = threadedLogQueue.get(thread);\r\n currentThread = thread;\r\n //(clear buffer)\r\n while(currentThread >= 0){\r\n if(currentThread != thread){ throw new IllegalStateException(\"Redwood control shifted away from flushing thread\"); }\r\n if(backlog.isEmpty()){ throw new IllegalStateException(\"Forgot to call finishThread() on thread \" + currentThread); }\r\n assert !control.isHeldByCurrentThread();\r\n backlog.poll().run();\r\n }\r\n //(unregister thread)\r\n threadsWaiting.remove(thread);\r\n }\r\n }\r\n }\r\n while(threadsWaiting.size() > 0){\r\n assert currentThread < 0L;\r\n assert control.tryLock();\r\n assert !threadsWaiting.isEmpty();\r\n control.lock();\r\n attemptThreadControlThreadsafe(-1);\r\n control.unlock();\r\n }\r\n //(clean up)\r\n for(long threadId : threadedLogQueue.keySet()){\r\n assert threadedLogQueue.get(threadId).isEmpty();\r\n }\r\n assert threadsWaiting.isEmpty();\r\n assert currentThread == -1L;\r\n endTrack(\"Threads( \"+check+\" )\");\r\n }" ]
[ "public Response save() throws RequestException, LocalOperationException {\n Map<String, Object> templateData = new HashMap<String, Object>();\n templateData.put(\"name\", name);\n\n options.put(\"steps\", steps.toMap());\n\n templateData.put(\"template\", options);\n Request request = new Request(transloadit);\n return new Response(request.post(\"/templates\", templateData));\n }", "public void rotate(String photoId, int degrees) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_ROTATE);\r\n\r\n parameters.put(\"photo_id\", photoId);\r\n parameters.put(\"degrees\", String.valueOf(degrees));\r\n\r\n Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n }", "protected <T1> void dispatchCommand(final BiConsumer<P, T1> action, final T1 routable1) {\n routingFor(routable1)\n .routees()\n .forEach(routee -> routee.receiveCommand(action, routable1));\n }", "private List<TimephasedCost> getTimephasedActualCostFixedAmount()\n {\n List<TimephasedCost> result = new LinkedList<TimephasedCost>();\n\n double actualCost = getActualCost().doubleValue();\n\n if (actualCost > 0)\n {\n AccrueType accrueAt = getResource().getAccrueAt();\n\n if (accrueAt == AccrueType.START)\n {\n result.add(splitCostStart(getCalendar(), actualCost, getActualStart()));\n }\n else\n if (accrueAt == AccrueType.END)\n {\n result.add(splitCostEnd(getCalendar(), actualCost, getActualFinish()));\n }\n else\n {\n //for prorated, we have to deal with it differently; have to 'fill up' each\n //day with the standard amount before going to the next one\n double numWorkingDays = getCalendar().getWork(getStart(), getFinish(), TimeUnit.DAYS).getDuration();\n double standardAmountPerDay = getCost().doubleValue() / numWorkingDays;\n\n result.addAll(splitCostProrated(getCalendar(), actualCost, standardAmountPerDay, getActualStart()));\n }\n }\n\n return result;\n }", "public Object[] getForeignKeyValues(Object obj, ClassDescriptor mif)\r\n throws PersistenceBrokerException\r\n {\r\n FieldDescriptor[] fks = getForeignKeyFieldDescriptors(mif);\r\n // materialize object only if FK fields are declared\r\n if(fks.length > 0) obj = ProxyHelper.getRealObject(obj);\r\n Object[] result = new Object[fks.length];\r\n for (int i = 0; i < result.length; i++)\r\n {\r\n FieldDescriptor fmd = fks[i];\r\n PersistentField f = fmd.getPersistentField();\r\n\r\n // BRJ: do NOT convert.\r\n // conversion is done when binding the sql-statement\r\n //\r\n // FieldConversion fc = fmd.getFieldConversion();\r\n // Object val = fc.javaToSql(f.get(obj));\r\n\r\n result[i] = f.get(obj);\r\n }\r\n return result;\r\n }", "public static MarvinImage rgbToBinary(MarvinImage img, int threshold) {\n MarvinImage resultImage = new MarvinImage(img.getWidth(), img.getHeight(), MarvinImage.COLOR_MODEL_BINARY);\n\n for (int y = 0; y < img.getHeight(); y++) {\n for (int x = 0; x < img.getWidth(); x++) {\n int gray = (int) ((img.getIntComponent0(x, y) * 0.3) + (img.getIntComponent1(x, y) * 0.59) + (img.getIntComponent2(x, y) * 0.11));\n\n if (gray <= threshold) {\n resultImage.setBinaryColor(x, y, true);\n } else {\n resultImage.setBinaryColor(x, y, false);\n }\n }\n }\n return resultImage;\n }", "public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {\n switch (requestCode) {\n case REQUEST_PERMISSIONS_CODE:\n if (listener != null) {\n boolean granted = grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED;\n listener.onPermissionResult(granted);\n }\n break;\n default:\n // Ignored\n }\n }", "@Subscribe\n @SuppressForbidden(\"legitimate printStackTrace().\")\n public void onSuiteResult(AggregatedSuiteResultEvent e) {\n try {\n if (jsonWriter == null)\n return;\n\n slaves.put(e.getSlave().id, e.getSlave());\n e.serialize(jsonWriter, outputStreams);\n } catch (Exception ex) {\n ex.printStackTrace();\n junit4.log(\"Error serializing to JSON file: \"\n + Throwables.getStackTraceAsString(ex), Project.MSG_WARN);\n if (jsonWriter != null) {\n try {\n jsonWriter.close();\n } catch (Throwable ignored) {\n // Ignore.\n } finally {\n jsonWriter = null;\n }\n }\n }\n }", "public void postBuildInfo(final String moduleName, final String moduleVersion, final Map<String, String> buildInfo, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {\n final Client client = getClient(user, password);\n final WebResource resource = client.resource(serverURL).path(RequestUtils.getBuildInfoPath(moduleName, moduleVersion));\n final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, buildInfo);\n\n client.destroy();\n if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){\n final String message = \"Failed to POST buildInfo\";\n if(LOG.isErrorEnabled()) {\n LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));\n }\n throw new GrapesCommunicationException(message, response.getStatus());\n }\n }" ]
Writes the data collected about properties to a file.
[ "private void writePropertyData() {\n\t\ttry (PrintStream out = new PrintStream(\n\t\t\t\tExampleHelpers.openExampleFileOuputStream(\"properties.csv\"))) {\n\n\t\t\tout.println(\"Id\" + \",Label\" + \",Description\" + \",URL\" + \",Datatype\"\n\t\t\t\t\t+ \",Uses in statements\" + \",Items with such statements\"\n\t\t\t\t\t+ \",Uses in statements with qualifiers\"\n\t\t\t\t\t+ \",Uses in qualifiers\" + \",Uses in references\"\n\t\t\t\t\t+ \",Uses total\" + \",Related properties\");\n\n\t\t\tList<Entry<PropertyIdValue, PropertyRecord>> list = new ArrayList<Entry<PropertyIdValue, PropertyRecord>>(\n\t\t\t\t\tthis.propertyRecords.entrySet());\n\t\t\tCollections.sort(list, new UsageRecordComparator());\n\t\t\tfor (Entry<PropertyIdValue, PropertyRecord> entry : list) {\n\t\t\t\tprintPropertyRecord(out, entry.getValue(), entry.getKey());\n\t\t\t}\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}" ]
[ "protected void concatenateReports() {\n\n if (!concatenatedReports.isEmpty()) { // dummy group for page break if needed\n DJGroup globalGroup = createDummyGroup();\n report.getColumnsGroups().add(0, globalGroup);\n }\n\n for (Subreport subreport : concatenatedReports) {\n DJGroup globalGroup = createDummyGroup();\n globalGroup.getFooterSubreports().add(subreport);\n report.getColumnsGroups().add(0, globalGroup);\n }\n }", "private static Iterable<BoxUser.Info> getUsersInfoForType(final BoxAPIConnection api,\n final String filterTerm, final String userType, final String externalAppUserId, final String... fields) {\n return new Iterable<BoxUser.Info>() {\n public Iterator<BoxUser.Info> iterator() {\n QueryStringBuilder builder = new QueryStringBuilder();\n if (filterTerm != null) {\n builder.appendParam(\"filter_term\", filterTerm);\n }\n if (userType != null) {\n builder.appendParam(\"user_type\", userType);\n }\n if (externalAppUserId != null) {\n builder.appendParam(\"external_app_user_id\", externalAppUserId);\n }\n if (fields.length > 0) {\n builder.appendParam(\"fields\", fields);\n }\n URL url = USERS_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString());\n return new BoxUserIterator(api, url);\n }\n };\n }", "public ItemDocument updateStatements(ItemIdValue itemIdValue,\n\t\t\tList<Statement> addStatements, List<Statement> deleteStatements,\n\t\t\tString summary) throws MediaWikiApiErrorException, IOException {\n\n\t\tItemDocument currentDocument = (ItemDocument) this.wikibaseDataFetcher\n\t\t\t\t.getEntityDocument(itemIdValue.getId());\n\n\t\treturn updateStatements(currentDocument, addStatements,\n\t\t\t\tdeleteStatements, summary);\n\t}", "public static String regexFindFirst(String pattern, String str) {\n return regexFindFirst(Pattern.compile(pattern), str, 1);\n }", "public void flushAllLogs(final boolean force) {\n Iterator<Log> iter = getLogIterator();\n while (iter.hasNext()) {\n Log log = iter.next();\n try {\n boolean needFlush = force;\n if (!needFlush) {\n long timeSinceLastFlush = System.currentTimeMillis() - log.getLastFlushedTime();\n Integer logFlushInterval = logFlushIntervalMap.get(log.getTopicName());\n if (logFlushInterval == null) {\n logFlushInterval = config.getDefaultFlushIntervalMs();\n }\n final String flushLogFormat = \"[%s] flush interval %d, last flushed %d, need flush? %s\";\n needFlush = timeSinceLastFlush >= logFlushInterval.intValue();\n logger.trace(String.format(flushLogFormat, log.getTopicName(), logFlushInterval,\n log.getLastFlushedTime(), needFlush));\n }\n if (needFlush) {\n log.flush();\n }\n } catch (IOException ioe) {\n logger.error(\"Error flushing topic \" + log.getTopicName(), ioe);\n logger.error(\"Halting due to unrecoverable I/O error while flushing logs: \" + ioe.getMessage(), ioe);\n Runtime.getRuntime().halt(1);\n } catch (Exception e) {\n logger.error(\"Error flushing topic \" + log.getTopicName(), e);\n }\n }\n }", "public double dot(Vector3d v1) {\n return x * v1.x + y * v1.y + z * v1.z;\n }", "public static boolean isMethodNode(ASTNode node, String methodNamePattern, Integer numArguments, Class returnType) {\r\n if (!(node instanceof MethodNode)) {\r\n return false;\r\n }\r\n if (!(((MethodNode) node).getName().matches(methodNamePattern))) {\r\n return false;\r\n }\r\n if (numArguments != null && ((MethodNode)node).getParameters() != null && ((MethodNode)node).getParameters().length != numArguments) {\r\n return false;\r\n }\r\n if (returnType != null && !AstUtil.classNodeImplementsType(((MethodNode) node).getReturnType(), returnType)) {\r\n return false;\r\n }\r\n return true;\r\n }", "private static FieldType getPlaceholder(final Class<?> type, final int fieldID)\n {\n return new FieldType()\n {\n @Override public FieldTypeClass getFieldTypeClass()\n {\n return FieldTypeClass.UNKNOWN;\n }\n\n @Override public String name()\n {\n return \"UNKNOWN\";\n }\n\n @Override public int getValue()\n {\n return fieldID;\n }\n\n @Override public String getName()\n {\n return \"Unknown \" + (type == null ? \"\" : type.getSimpleName() + \"(\" + fieldID + \")\");\n }\n\n @Override public String getName(Locale locale)\n {\n return getName();\n }\n\n @Override public DataType getDataType()\n {\n return null;\n }\n\n @Override public FieldType getUnitsType()\n {\n return null;\n }\n\n @Override public String toString()\n {\n return getName();\n }\n };\n }", "public final File getBuildFileFor(\n final Configuration configuration, final File jasperFileXml,\n final String extension, final Logger logger) {\n final String configurationAbsolutePath = configuration.getDirectory().getPath();\n final int prefixToConfiguration = configurationAbsolutePath.length() + 1;\n final String parentDir = jasperFileXml.getAbsoluteFile().getParent();\n final String relativePathToFile;\n if (configurationAbsolutePath.equals(parentDir)) {\n relativePathToFile = FilenameUtils.getBaseName(jasperFileXml.getName());\n } else {\n final String relativePathToContainingDirectory = parentDir.substring(prefixToConfiguration);\n relativePathToFile = relativePathToContainingDirectory + File.separator +\n FilenameUtils.getBaseName(jasperFileXml.getName());\n }\n\n final File buildFile = new File(getJasperCompilation(configuration), relativePathToFile + extension);\n\n if (!buildFile.getParentFile().exists() && !buildFile.getParentFile().mkdirs()) {\n logger.error(\"Unable to create directory for containing compiled jasper report templates: {}\",\n buildFile.getParentFile());\n }\n return buildFile;\n }" ]
Initializes the mode switcher. @param current the current edit mode
[ "private void initModeSwitch(final EditMode current) {\n\n FormLayout modes = new FormLayout();\n modes.setHeight(\"100%\");\n modes.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);\n\n m_modeSelect = new ComboBox();\n m_modeSelect.setCaption(m_messages.key(Messages.GUI_VIEW_SWITCHER_LABEL_0));\n\n // add Modes\n m_modeSelect.addItem(CmsMessageBundleEditorTypes.EditMode.DEFAULT);\n m_modeSelect.setItemCaption(\n CmsMessageBundleEditorTypes.EditMode.DEFAULT,\n m_messages.key(Messages.GUI_VIEW_SWITCHER_EDITMODE_DEFAULT_0));\n m_modeSelect.addItem(CmsMessageBundleEditorTypes.EditMode.MASTER);\n m_modeSelect.setItemCaption(\n CmsMessageBundleEditorTypes.EditMode.MASTER,\n m_messages.key(Messages.GUI_VIEW_SWITCHER_EDITMODE_MASTER_0));\n\n // set current mode as selected\n m_modeSelect.setValue(current);\n\n m_modeSelect.setNewItemsAllowed(false);\n m_modeSelect.setTextInputAllowed(false);\n m_modeSelect.setNullSelectionAllowed(false);\n\n m_modeSelect.addValueChangeListener(new ValueChangeListener() {\n\n private static final long serialVersionUID = 1L;\n\n public void valueChange(ValueChangeEvent event) {\n\n m_listener.handleModeChange((EditMode)event.getProperty().getValue());\n\n }\n });\n\n modes.addComponent(m_modeSelect);\n m_modeSwitch = modes;\n }" ]
[ "private void onShow() {\n\n if (m_detailsFieldset != null) {\n m_detailsFieldset.getContentPanel().getElement().getStyle().setPropertyPx(\n \"maxHeight\",\n getAvailableHeight(m_messageWidget.getOffsetHeight()));\n }\n }", "private void writeAssignmentExtendedAttributes(Project.Assignments.Assignment xml, ResourceAssignment mpx)\n {\n Project.Assignments.Assignment.ExtendedAttribute attrib;\n List<Project.Assignments.Assignment.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();\n\n for (AssignmentField mpxFieldID : getAllAssignmentExtendedAttributes())\n {\n Object value = mpx.getCachedValue(mpxFieldID);\n\n if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))\n {\n m_extendedAttributesInUse.add(mpxFieldID);\n\n Integer xmlFieldID = Integer.valueOf(MPPAssignmentField.getID(mpxFieldID) | MPPAssignmentField.ASSIGNMENT_FIELD_BASE);\n\n attrib = m_factory.createProjectAssignmentsAssignmentExtendedAttribute();\n extendedAttributes.add(attrib);\n attrib.setFieldID(xmlFieldID.toString());\n attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));\n attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));\n }\n }\n }", "public static appflowpolicy_appflowpolicylabel_binding[] get(nitro_service service, String name) throws Exception{\n\t\tappflowpolicy_appflowpolicylabel_binding obj = new appflowpolicy_appflowpolicylabel_binding();\n\t\tobj.set_name(name);\n\t\tappflowpolicy_appflowpolicylabel_binding response[] = (appflowpolicy_appflowpolicylabel_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "public static Diagram parseJson(JSONObject json,\n Boolean keepGlossaryLink) throws JSONException {\n ArrayList<Shape> shapes = new ArrayList<Shape>();\n HashMap<String, JSONObject> flatJSON = flatRessources(json);\n for (String resourceId : flatJSON.keySet()) {\n parseRessource(shapes,\n flatJSON,\n resourceId,\n keepGlossaryLink);\n }\n String id = \"canvas\";\n\n if (json.has(\"resourceId\")) {\n id = json.getString(\"resourceId\");\n shapes.remove(new Shape(id));\n }\n ;\n Diagram diagram = new Diagram(id);\n\n // remove Diagram\n // (Diagram)getShapeWithId(json.getString(\"resourceId\"), shapes);\n parseStencilSet(json,\n diagram);\n parseSsextensions(json,\n diagram);\n parseStencil(json,\n diagram);\n parseProperties(json,\n diagram,\n keepGlossaryLink);\n parseChildShapes(shapes,\n json,\n diagram);\n parseBounds(json,\n diagram);\n diagram.setShapes(shapes);\n return diagram;\n }", "protected void unregisterDriver(){\r\n\t\tString jdbcURL = this.config.getJdbcUrl();\r\n\t\tif ((jdbcURL != null) && this.config.isDeregisterDriverOnClose()){\r\n\t\t\tlogger.info(\"Unregistering JDBC driver for : \"+jdbcURL);\r\n\t\t\ttry {\r\n\t\t\t\tDriverManager.deregisterDriver(DriverManager.getDriver(jdbcURL));\r\n\t\t\t} catch (SQLException e) {\r\n\t\t\t\tlogger.info(\"Unregistering driver failed.\", e);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static void setQuota(final GreenMailUser user, final Quota quota) {\r\n Session session = GreenMailUtil.getSession(ServerSetupTest.IMAP);\r\n try {\r\n Store store = session.getStore(\"imap\");\r\n store.connect(user.getEmail(), user.getPassword());\r\n try {\r\n ((QuotaAwareStore) store).setQuota(quota);\r\n } finally {\r\n store.close();\r\n }\r\n } catch (Exception ex) {\r\n throw new IllegalStateException(\"Can not set quota \" + quota\r\n + \" for user \" + user, ex);\r\n }\r\n }", "@Override\n public final float getFloat(final String key) {\n Float result = optFloat(key);\n if (result == null) {\n throw new ObjectMissingException(this, key);\n }\n return result;\n }", "public Automaton getAutomatonById(String id) throws IOException {\n if (idToVersion.containsKey(id)) {\n List<BytesRef> bytesArray = new ArrayList<>();\n Set<String> data = get(id);\n if (data != null) {\n Term term;\n for (String item : data) {\n term = new Term(\"dummy\", item);\n bytesArray.add(term.bytes());\n }\n Collections.sort(bytesArray);\n return Automata.makeStringUnion(bytesArray);\n }\n }\n return null;\n }", "public static base_responses save(nitro_service client, cacheobject resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tcacheobject saveresources[] = new cacheobject[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tsaveresources[i] = new cacheobject();\n\t\t\t\tsaveresources[i].locator = resources[i].locator;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, saveresources,\"save\");\n\t\t}\n\t\treturn result;\n\t}" ]
Simple, high-level API to enable or disable eye picking for this scene object. The {@linkplain #attachCollider low-level API} gives you a lot of control over eye picking, but it does involve an awful lot of details. This method (and {@link #getPickingEnabled()}) provides a simple boolean property. It attaches a GVRSphereCollider to the scene object. If you want more accurate picking, you can use {@link #attachComponent(GVRComponent)} to attach a mesh collider instead. The mesh collider is more accurate but also costs more to compute. @param enabled Should eye picking 'see' this scene object? @since 2.0.2 @see GVRSphereCollider @see GVRMeshCollider
[ "public void setPickingEnabled(boolean enabled) {\n if (enabled != getPickingEnabled()) {\n if (enabled) {\n attachComponent(new GVRSphereCollider(getGVRContext()));\n } else {\n detachComponent(GVRCollider.getComponentType());\n }\n }\n }" ]
[ "public List<Client> findAllClients(int profileId) throws Exception {\n ArrayList<Client> clients = new ArrayList<Client>();\n\n PreparedStatement query = null;\n ResultSet results = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n query = sqlConnection.prepareStatement(\n \"SELECT * FROM \" + Constants.DB_TABLE_CLIENT +\n \" WHERE \" + Constants.GENERIC_PROFILE_ID + \" = ?\"\n );\n query.setInt(1, profileId);\n results = query.executeQuery();\n while (results.next()) {\n clients.add(this.getClientFromResultSet(results));\n }\n } catch (Exception e) {\n throw e;\n } finally {\n try {\n if (results != null) {\n results.close();\n }\n } catch (Exception e) {\n }\n try {\n if (query != null) {\n query.close();\n }\n } catch (Exception e) {\n }\n }\n return clients;\n }", "public void setHeaders(final Set<String> names) {\n // transform to lower-case because header names should be case-insensitive\n Set<String> lowerCaseNames = new HashSet<>();\n for (String name: names) {\n lowerCaseNames.add(name.toLowerCase());\n }\n this.headerNames = lowerCaseNames;\n }", "public static void checkRequired(OptionSet options, List<String> opts)\n throws VoldemortException {\n List<String> optCopy = Lists.newArrayList();\n for(String opt: opts) {\n if(options.has(opt)) {\n optCopy.add(opt);\n }\n }\n if(optCopy.size() < 1) {\n System.err.println(\"Please specify one of the following options:\");\n for(String opt: opts) {\n System.err.println(\"--\" + opt);\n }\n Utils.croak(\"Missing required option.\");\n }\n if(optCopy.size() > 1) {\n System.err.println(\"Conflicting options:\");\n for(String opt: optCopy) {\n System.err.println(\"--\" + opt);\n }\n Utils.croak(\"Conflicting options detected.\");\n }\n }", "public Map<String, List<Locale>> getAvailableLocales() {\n\n if (m_availableLocales == null) {\n // create lazy map only on demand\n m_availableLocales = CmsCollectionsGenericWrapper.createLazyMap(new CmsAvailableLocaleLoaderTransformer());\n }\n return m_availableLocales;\n }", "public void addExportedPackages(String... exportedPackages) {\n\t\tString oldBundles = mainAttributes.get(EXPORT_PACKAGE);\n\t\tif (oldBundles == null)\n\t\t\toldBundles = \"\";\n\t\tBundleList oldResultList = BundleList.fromInput(oldBundles, newline);\n\t\tBundleList resultList = BundleList.fromInput(oldBundles, newline);\n\t\tfor (String bundle : exportedPackages)\n\t\t\tresultList.mergeInto(Bundle.fromInput(bundle));\n\t\tString result = resultList.toString();\n\t\tboolean changed = !oldResultList.toString().equals(result);\n\t\tmodified |= changed;\n\t\tif (changed)\n\t\t\tmainAttributes.put(EXPORT_PACKAGE, result);\n\t}", "public RemoteMongoCollection<Document> getCollection(final String collectionName) {\n return new RemoteMongoCollectionImpl<>(proxy.getCollection(collectionName), dispatcher);\n }", "public static base_responses add(nitro_service client, cacheselector resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tcacheselector addresources[] = new cacheselector[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new cacheselector();\n\t\t\t\taddresources[i].selectorname = resources[i].selectorname;\n\t\t\t\taddresources[i].rule = resources[i].rule;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "public int rebalanceNode(final RebalanceTaskInfo stealInfo) {\n\n final RebalanceTaskInfo info = metadataStore.getRebalancerState()\n .find(stealInfo.getDonorId());\n\n // Do we have the plan in the state?\n if(info == null) {\n throw new VoldemortException(\"Could not find plan \" + stealInfo\n + \" in the server state on \" + metadataStore.getNodeId());\n } else if(!info.equals(stealInfo)) {\n // If we do have the plan, is it the same\n throw new VoldemortException(\"The plan in server state \" + info\n + \" is not the same as the process passed \" + stealInfo);\n } else if(!acquireRebalancingPermit(stealInfo.getDonorId())) {\n // Both are same, now try to acquire a lock for the donor node\n throw new AlreadyRebalancingException(\"Node \" + metadataStore.getNodeId()\n + \" is already rebalancing from donor \"\n + info.getDonorId() + \" with info \" + info);\n }\n\n // Acquired lock successfully, start rebalancing...\n int requestId = asyncService.getUniqueRequestId();\n\n // Why do we pass 'info' instead of 'stealInfo'? So that we can change\n // the state as the stores finish rebalance\n asyncService.submitOperation(requestId,\n new StealerBasedRebalanceAsyncOperation(this,\n voldemortConfig,\n metadataStore,\n requestId,\n info));\n\n return requestId;\n }", "@Override\n @SuppressWarnings(\"unchecked\")\n public Stream<ChangeEvent<DocumentT>> watch(final BsonValue... ids)\n throws InterruptedException, IOException {\n return operations.watch(\n new HashSet<>(Arrays.asList(ids)),\n false,\n documentClass\n ).execute(service);\n }" ]
Add resources to the tree. @param parentNode parent tree node @param file resource container
[ "private void addResources(MpxjTreeNode parentNode, ProjectFile file)\n {\n for (Resource resource : file.getResources())\n {\n final Resource r = resource;\n MpxjTreeNode childNode = new MpxjTreeNode(resource)\n {\n @Override public String toString()\n {\n return r.getName();\n }\n };\n parentNode.add(childNode);\n }\n }" ]
[ "public void setBit(int index, boolean set)\n {\n assertValidIndex(index);\n int word = index / WORD_LENGTH;\n int offset = index % WORD_LENGTH;\n if (set)\n {\n data[word] |= (1 << offset);\n }\n else // Unset the bit.\n {\n data[word] &= ~(1 << offset);\n }\n }", "public long queryForCountStar(DatabaseConnection databaseConnection) throws SQLException {\n\t\tif (countStarQuery == null) {\n\t\t\tStringBuilder sb = new StringBuilder(64);\n\t\t\tsb.append(\"SELECT COUNT(*) FROM \");\n\t\t\tdatabaseType.appendEscapedEntityName(sb, tableInfo.getTableName());\n\t\t\tcountStarQuery = sb.toString();\n\t\t}\n\t\tlong count = databaseConnection.queryForLong(countStarQuery);\n\t\tlogger.debug(\"query of '{}' returned {}\", countStarQuery, count);\n\t\treturn count;\n\t}", "public static BoxAPIConnection restore(String clientID, String clientSecret, String state) {\n BoxAPIConnection api = new BoxAPIConnection(clientID, clientSecret);\n api.restore(state);\n return api;\n }", "public static boolean isSpreadSafe(Expression expression) {\r\n if (expression instanceof MethodCallExpression) {\r\n return ((MethodCallExpression) expression).isSpreadSafe();\r\n }\r\n if (expression instanceof PropertyExpression) {\r\n return ((PropertyExpression) expression).isSpreadSafe();\r\n }\r\n return false;\r\n }", "@SuppressWarnings(\"unchecked\") public Relation addPredecessor(Task targetTask, RelationType type, Duration lag)\n {\n //\n // Ensure that we have a valid lag duration\n //\n if (lag == null)\n {\n lag = Duration.getInstance(0, TimeUnit.DAYS);\n }\n\n //\n // Retrieve the list of predecessors\n //\n List<Relation> predecessorList = (List<Relation>) getCachedValue(TaskField.PREDECESSORS);\n\n //\n // Ensure that there is only one predecessor relationship between\n // these two tasks.\n //\n Relation predecessorRelation = null;\n Iterator<Relation> iter = predecessorList.iterator();\n while (iter.hasNext() == true)\n {\n predecessorRelation = iter.next();\n if (predecessorRelation.getTargetTask() == targetTask)\n {\n if (predecessorRelation.getType() != type || predecessorRelation.getLag().compareTo(lag) != 0)\n {\n predecessorRelation = null;\n }\n break;\n }\n predecessorRelation = null;\n }\n\n //\n // If necessary, create a new predecessor relationship\n //\n if (predecessorRelation == null)\n {\n predecessorRelation = new Relation(this, targetTask, type, lag);\n predecessorList.add(predecessorRelation);\n }\n\n //\n // Retrieve the list of successors\n //\n List<Relation> successorList = (List<Relation>) targetTask.getCachedValue(TaskField.SUCCESSORS);\n\n //\n // Ensure that there is only one successor relationship between\n // these two tasks.\n //\n Relation successorRelation = null;\n iter = successorList.iterator();\n while (iter.hasNext() == true)\n {\n successorRelation = iter.next();\n if (successorRelation.getTargetTask() == this)\n {\n if (successorRelation.getType() != type || successorRelation.getLag().compareTo(lag) != 0)\n {\n successorRelation = null;\n }\n break;\n }\n successorRelation = null;\n }\n\n //\n // If necessary, create a new successor relationship\n //\n if (successorRelation == null)\n {\n successorRelation = new Relation(targetTask, this, type, lag);\n successorList.add(successorRelation);\n }\n\n return (predecessorRelation);\n }", "public Metadata remove(String path) {\n this.values.remove(this.pathToProperty(path));\n this.addOp(\"remove\", path, (String) null);\n return this;\n }", "@Override public int getItemViewType(int position) {\n T content = getItem(position);\n return rendererBuilder.getItemViewType(content);\n }", "protected void onLegendDataChanged() {\n\n int legendCount = mLegendList.size();\n float margin = (mGraphWidth / legendCount);\n float currentOffset = 0;\n\n for (LegendModel model : mLegendList) {\n model.setLegendBounds(new RectF(currentOffset, 0, currentOffset + margin, mLegendHeight));\n currentOffset += margin;\n }\n\n Utils.calculateLegendInformation(mLegendList, 0, mGraphWidth, mLegendPaint);\n\n invalidateGlobal();\n }", "public void handleChange(Object propertyId) {\n\n try {\n lockOnChange(propertyId);\n } catch (CmsException e) {\n LOG.debug(e);\n }\n if (isDescriptorProperty(propertyId)) {\n m_descriptorHasChanges = true;\n }\n if (isBundleProperty(propertyId)) {\n m_changedTranslations.add(getLocale());\n }\n\n }" ]
Use this API to update clusterinstance resources.
[ "public static base_responses update(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 updateresources[] = new clusterinstance[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tupdateresources[i] = new clusterinstance();\n\t\t\t\tupdateresources[i].clid = resources[i].clid;\n\t\t\t\tupdateresources[i].deadinterval = resources[i].deadinterval;\n\t\t\t\tupdateresources[i].hellointerval = resources[i].hellointerval;\n\t\t\t\tupdateresources[i].preemption = resources[i].preemption;\n\t\t\t}\n\t\t\tresult = update_bulk_request(client, updateresources);\n\t\t}\n\t\treturn result;\n\t}" ]
[ "public static dnstxtrec get(nitro_service service, String domain) throws Exception{\n\t\tdnstxtrec obj = new dnstxtrec();\n\t\tobj.set_domain(domain);\n\t\tdnstxtrec response = (dnstxtrec) obj.get_resource(service);\n\t\treturn response;\n\t}", "public void abortExternalTx(TransactionImpl odmgTrans)\r\n {\r\n if (log.isDebugEnabled()) log.debug(\"abortExternTransaction was called\");\r\n if (odmgTrans == null) return;\r\n TxBuffer buf = (TxBuffer) txRepository.get();\r\n Transaction extTx = buf != null ? buf.getExternTx() : null;\r\n try\r\n {\r\n if (extTx != null && extTx.getStatus() == Status.STATUS_ACTIVE)\r\n {\r\n if(log.isDebugEnabled())\r\n {\r\n log.debug(\"Set extern transaction to rollback\");\r\n }\r\n extTx.setRollbackOnly();\r\n }\r\n }\r\n catch (Exception ignore)\r\n {\r\n }\r\n txRepository.set(null);\r\n }", "public void createRelationFieldMap(Props props)\n {\n byte[] fieldMapData = null;\n for (Integer key : RELATION_KEYS)\n {\n fieldMapData = props.getByteArray(key);\n if (fieldMapData != null)\n {\n break;\n }\n }\n\n if (fieldMapData == null)\n {\n populateDefaultData(getDefaultRelationData());\n }\n else\n {\n createFieldMap(fieldMapData);\n }\n }", "public static final Duration getDuration(double value, TimeUnit type)\n {\n double duration;\n // Value is given in 1/10 of minute\n switch (type)\n {\n case MINUTES:\n case ELAPSED_MINUTES:\n {\n duration = value / 10;\n break;\n }\n\n case HOURS:\n case ELAPSED_HOURS:\n {\n duration = value / 600; // 60 * 10\n break;\n }\n\n case DAYS:\n {\n duration = value / 4800; // 8 * 60 * 10\n break;\n }\n\n case ELAPSED_DAYS:\n {\n duration = value / 14400; // 24 * 60 * 10\n break;\n }\n\n case WEEKS:\n {\n duration = value / 24000; // 5 * 8 * 60 * 10\n break;\n }\n\n case ELAPSED_WEEKS:\n {\n duration = value / 100800; // 7 * 24 * 60 * 10\n break;\n }\n\n case MONTHS:\n {\n duration = value / 96000; // 4 * 5 * 8 * 60 * 10\n break;\n }\n\n case ELAPSED_MONTHS:\n {\n duration = value / 432000; // 30 * 24 * 60 * 10\n break;\n }\n\n default:\n {\n duration = value;\n break;\n }\n }\n return (Duration.getInstance(duration, type));\n }", "private void validateSegments(List<LogSegment> segments) {\n synchronized (lock) {\n for (int i = 0; i < segments.size() - 1; i++) {\n LogSegment curr = segments.get(i);\n LogSegment next = segments.get(i + 1);\n if (curr.start() + curr.size() != next.start()) {\n throw new IllegalStateException(\"The following segments don't validate: \" + curr.getFile()\n .getAbsolutePath() + \", \" + next.getFile().getAbsolutePath());\n }\n }\n }\n }", "public static final Rate parseRate(BigDecimal value)\n {\n Rate result = null;\n\n if (value != null)\n {\n result = new Rate(value, TimeUnit.HOURS);\n }\n\n return (result);\n }", "public static nsacl6_stats[] get(nitro_service service) throws Exception{\n\t\tnsacl6_stats obj = new nsacl6_stats();\n\t\tnsacl6_stats[] response = (nsacl6_stats[])obj.stat_resources(service);\n\t\treturn response;\n\t}", "HtmlTag attr(String name, String value) {\n if (attrs == null) {\n attrs = new HashMap<>();\n }\n attrs.put(name, value);\n return this;\n }", "public static Context getContext()\r\n {\r\n if (ctx == null)\r\n {\r\n try\r\n {\r\n setContext(null);\r\n }\r\n catch (Exception e)\r\n {\r\n log.error(\"Cannot instantiate the InitialContext\", e);\r\n throw new OJBRuntimeException(e);\r\n }\r\n }\r\n return ctx;\r\n }" ]
This method is called to format a task type. @param value task type value @return formatted task type
[ "private String formatTaskType(TaskType value)\n {\n return (LocaleData.getString(m_locale, (value == TaskType.FIXED_DURATION ? LocaleData.YES : LocaleData.NO)));\n }" ]
[ "public static base_response unset(nitro_service client, lbsipparameters resource, String[] args) throws Exception{\n\t\tlbsipparameters unsetresource = new lbsipparameters();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "public static Date getTime(int hour, int minutes)\n {\n Calendar cal = popCalendar();\n cal.set(Calendar.HOUR_OF_DAY, hour);\n cal.set(Calendar.MINUTE, minutes);\n cal.set(Calendar.SECOND, 0);\n Date result = cal.getTime();\n pushCalendar(cal);\n return result;\n }", "@Nullable\n @VisibleForTesting\n protected PolygonSymbolizer createPolygonSymbolizer(final PJsonObject styleJson) {\n if (this.allowNullSymbolizer && !styleJson.has(JSON_FILL_COLOR)) {\n return null;\n }\n\n final PolygonSymbolizer symbolizer = this.styleBuilder.createPolygonSymbolizer();\n symbolizer.setFill(createFill(styleJson));\n\n symbolizer.setStroke(createStroke(styleJson, false));\n\n return symbolizer;\n }", "protected TableFontStyle getColumnFontStyle(byte[] data, int offset, Map<Integer, FontBase> fontBases)\n {\n int uniqueID = MPPUtility.getInt(data, offset);\n FieldType fieldType = MPPTaskField.getInstance(MPPUtility.getShort(data, offset + 4));\n Integer index = Integer.valueOf(MPPUtility.getByte(data, offset + 8));\n int style = MPPUtility.getByte(data, offset + 9);\n ColorType color = ColorType.getInstance(MPPUtility.getByte(data, offset + 10));\n int change = MPPUtility.getByte(data, offset + 12);\n\n FontBase fontBase = fontBases.get(index);\n\n boolean bold = ((style & 0x01) != 0);\n boolean italic = ((style & 0x02) != 0);\n boolean underline = ((style & 0x04) != 0);\n\n boolean boldChanged = ((change & 0x01) != 0);\n boolean underlineChanged = ((change & 0x02) != 0);\n boolean italicChanged = ((change & 0x04) != 0);\n boolean colorChanged = ((change & 0x08) != 0);\n boolean fontChanged = ((change & 0x10) != 0);\n boolean backgroundColorChanged = (uniqueID == -1);\n boolean backgroundPatternChanged = (uniqueID == -1);\n\n return (new TableFontStyle(uniqueID, fieldType, fontBase, italic, bold, underline, false, color.getColor(), Color.BLACK, BackgroundPattern.TRANSPARENT, italicChanged, boldChanged, underlineChanged, false, colorChanged, fontChanged, backgroundColorChanged, backgroundPatternChanged));\n }", "private void rotatorPushRight2( int m , int offset)\n {\n double b11 = bulge;\n double b12 = diag[m+offset];\n\n computeRotator(b12,-b11);\n\n diag[m+offset] = b12*c-b11*s;\n\n if( m+offset<N-1) {\n double b22 = off[m+offset];\n off[m+offset] = b22*c;\n bulge = b22*s;\n }\n\n// SimpleMatrix Q = createQ(m,m+offset, c, s, true);\n// B=Q.mult(B);\n//\n// B.print();\n// printMatrix();\n// System.out.println(\" bulge = \"+bulge);\n// System.out.println();\n\n if( Ut != null ) {\n updateRotator(Ut,m,m+offset,c,s);\n\n// SimpleMatrix.wrap(Ut).mult(B).mult(SimpleMatrix.wrap(Vt).transpose()).print();\n// printMatrix();\n// System.out.println(\"bulge = \"+bulge);\n// System.out.println();\n }\n }", "public static Chart getMSDLineWithPowerModelChart(Trajectory t, int lagMin,\n\t\t\tint lagMax, double timelag, double a, double D) {\n\n\t\tdouble[] xData = new double[lagMax - lagMin + 1];\n\t\tdouble[] yData = new double[lagMax - lagMin + 1];\n\t\tdouble[] modelData = new double[lagMax - lagMin + 1];\n\t\tMeanSquaredDisplacmentFeature msdeval = new MeanSquaredDisplacmentFeature(\n\t\t\t\tt, lagMin);\n\t\tmsdeval.setTrajectory(t);\n\t\tmsdeval.setTimelag(lagMin);\n\t\tfor (int i = lagMin; i < lagMax + 1; i++) {\n\t\t\tmsdeval.setTimelag(i);\n\t\t\tdouble msdhelp = msdeval.evaluate()[0];\n\t\t\txData[i - lagMin] = i;\n\t\t\tyData[i - lagMin] = msdhelp;\n\t\t\tmodelData[i - lagMin] = 4 * D * Math.pow(i * timelag, a);\n\t\t}\n\n\t\t// Create Chart\n\t\tChart chart = QuickChart.getChart(\"MSD Line\", \"LAG\", \"MSD\", \"MSD\",\n\t\t\t\txData, yData);\n\t\tchart.addSeries(\"y=4*D*t^alpha\", xData, modelData);\n\n\t\t// Show it\n\t\t//new SwingWrapper(chart).displayChart();\n\t\treturn chart;\n\t}", "private String getTypeString(Class<?> c)\n {\n String result = TYPE_MAP.get(c);\n if (result == null)\n {\n result = c.getName();\n if (!result.endsWith(\";\") && !result.startsWith(\"[\"))\n {\n result = \"L\" + result + \";\";\n }\n }\n return result;\n }", "private static Future<?> spawn(final int priority, final Runnable threadProc) {\n return threadPool.submit(new Runnable() {\n\n @Override\n public void run() {\n Thread current = Thread.currentThread();\n int defaultPriority = current.getPriority();\n\n try {\n current.setPriority(priority);\n\n /*\n * We yield to give the foreground process a chance to run.\n * This also means that the new priority takes effect RIGHT\n * AWAY, not after the next blocking call or quantum\n * timeout.\n */\n Thread.yield();\n\n try {\n threadProc.run();\n } catch (Exception e) {\n logException(TAG, e);\n }\n } finally {\n current.setPriority(defaultPriority);\n }\n\n }\n\n });\n }", "private void addReverse(final File[] files) {\n for (int i = files.length - 1; i >= 0; --i) {\n stack.add(files[i]);\n }\n }" ]
Use this API to enable clusterinstance of given name.
[ "public static base_response enable(nitro_service client, Long clid) throws Exception {\n\t\tclusterinstance enableresource = new clusterinstance();\n\t\tenableresource.clid = clid;\n\t\treturn enableresource.perform_operation(client,\"enable\");\n\t}" ]
[ "@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 }", "private void initialize(Handler callbackHandler) {\n\t\tint processors = Runtime.getRuntime().availableProcessors();\n\t\tmDownloadDispatchers = new DownloadDispatcher[processors];\n\t\tmDelivery = new CallBackDelivery(callbackHandler);\n\t}", "@Override\n public boolean supportsNativeRotation() {\n return this.params.useNativeAngle &&\n (this.params.serverType == WmsLayerParam.ServerType.MAPSERVER ||\n this.params.serverType == WmsLayerParam.ServerType.GEOSERVER);\n }", "public double[] getScaleDenominators() {\n double[] dest = new double[this.scaleDenominators.length];\n System.arraycopy(this.scaleDenominators, 0, dest, 0, this.scaleDenominators.length);\n return dest;\n }", "static ProcessedLayers process(final InstalledConfiguration conf, final List<File> moduleRoots, final List<File> bundleRoots) throws IOException {\n final ProcessedLayers layers = new ProcessedLayers(conf);\n // Process module roots\n final LayerPathSetter moduleSetter = new LayerPathSetter() {\n @Override\n public boolean setPath(final LayerPathConfig pending, final File root) {\n if (pending.modulePath == null) {\n pending.modulePath = root;\n return true;\n }\n return false;\n }\n };\n for (final File moduleRoot : moduleRoots) {\n processRoot(moduleRoot, layers, moduleSetter);\n }\n // Process bundle root\n final LayerPathSetter bundleSetter = new LayerPathSetter() {\n @Override\n public boolean setPath(LayerPathConfig pending, File root) {\n if (pending.bundlePath == null) {\n pending.bundlePath = root;\n return true;\n }\n return false;\n }\n };\n for (final File bundleRoot : bundleRoots) {\n processRoot(bundleRoot, layers, bundleSetter);\n }\n// if (conf.getInstalledLayers().size() != layers.getLayers().size()) {\n// throw processingError(\"processed layers don't match expected %s, but was %s\", conf.getInstalledLayers(), layers.getLayers().keySet());\n// }\n// if (conf.getInstalledAddOns().size() != layers.getAddOns().size()) {\n// throw processingError(\"processed add-ons don't match expected %s, but was %s\", conf.getInstalledAddOns(), layers.getAddOns().keySet());\n// }\n return layers;\n }", "void lockInterruptibly(final Integer permit) throws InterruptedException {\n if (permit == null) {\n throw new IllegalArgumentException();\n }\n sync.acquireInterruptibly(permit);\n }", "public double getSpread(double bondPrice, Curve referenceCurve, AnalyticModel model) {\n\t\tGoldenSectionSearch search = new GoldenSectionSearch(-2.0, 2.0);\n\t\twhile(search.getAccuracy() > 1E-11 && !search.isDone()) {\n\t\t\tdouble x = search.getNextPoint();\n\t\t\tdouble fx=getValueWithGivenSpreadOverCurve(0.0,referenceCurve,x,model);\n\t\t\tdouble y = (bondPrice-fx)*(bondPrice-fx);\n\n\t\t\tsearch.setValue(y);\n\t\t}\n\t\treturn search.getBestPoint();\n\t}", "protected void appendHavingClause(StringBuffer having, Criteria crit, StringBuffer stmt)\r\n {\r\n if (having.length() == 0)\r\n {\r\n having = null;\r\n }\r\n\r\n if (having != null || crit != null)\r\n {\r\n stmt.append(\" HAVING \");\r\n appendClause(having, crit, stmt);\r\n }\r\n }", "public void removeCollaborator(String appName, String collaborator) {\n connection.execute(new SharingRemove(appName, collaborator), apiKey);\n }" ]
Locate a feature in the file by match a byte pattern. @param patterns patterns to match @param bufferIndex start index @return true if the bytes at the position match a pattern
[ "private final boolean matchPattern(byte[][] patterns, int bufferIndex)\n {\n boolean match = false;\n for (byte[] pattern : patterns)\n {\n int index = 0;\n match = true;\n for (byte b : pattern)\n {\n if (b != m_buffer[bufferIndex + index])\n {\n match = false;\n break;\n }\n ++index;\n }\n if (match)\n {\n break;\n }\n }\n return match;\n }" ]
[ "public Collection getAllObjects(Class target)\r\n {\r\n PersistenceBroker broker = getBroker();\r\n Collection result;\r\n try\r\n {\r\n Query q = new QueryByCriteria(target);\r\n result = broker.getCollectionByQuery(q);\r\n }\r\n finally\r\n {\r\n if (broker != null) broker.close();\r\n }\r\n return result;\r\n }", "public Method getMethod(Method method) {\n return getMethod(method.getReturnType(), method.getName(), method.getParameterTypes());\n }", "public void validate() throws PackagingException {\n if (control == null || !control.isDirectory()) {\n throw new PackagingException(\"The 'control' attribute doesn't point to a directory. \" + control);\n }\n\n if (changesIn != null) {\n\n if (changesIn.exists() && (!changesIn.isFile() || !changesIn.canRead())) {\n throw new PackagingException(\"The 'changesIn' setting needs to point to a readable file. \" + changesIn + \" was not found/readable.\");\n }\n\n if (changesOut != null && !isWritableFile(changesOut)) {\n throw new PackagingException(\"Cannot write the output for 'changesOut' to \" + changesOut);\n }\n\n if (changesSave != null && !isWritableFile(changesSave)) {\n throw new PackagingException(\"Cannot write the output for 'changesSave' to \" + changesSave);\n }\n\n } else {\n if (changesOut != null || changesSave != null) {\n throw new PackagingException(\"The 'changesOut' or 'changesSave' settings may only be used when there is a 'changesIn' specified.\");\n }\n }\n\n if (Compression.toEnum(compression) == null) {\n throw new PackagingException(\"The compression method '\" + compression + \"' is not supported (expected 'none', 'gzip', 'bzip2' or 'xz')\");\n }\n\n if (deb == null) {\n throw new PackagingException(\"You need to specify where the deb file is supposed to be created.\");\n }\n\n getDigestCode(digest);\n }", "private EndpointOverride getEndpointOverrideFromResultSet(ResultSet results) throws Exception {\n EndpointOverride endpoint = new EndpointOverride();\n endpoint.setPathId(results.getInt(Constants.GENERIC_ID));\n endpoint.setPath(results.getString(Constants.PATH_PROFILE_ACTUAL_PATH));\n endpoint.setBodyFilter(results.getString(Constants.PATH_PROFILE_BODY_FILTER));\n endpoint.setPathName(results.getString(Constants.PATH_PROFILE_PATHNAME));\n endpoint.setContentType(results.getString(Constants.PATH_PROFILE_CONTENT_TYPE));\n endpoint.setRequestType(results.getInt(Constants.PATH_PROFILE_REQUEST_TYPE));\n endpoint.setRepeatNumber(results.getInt(Constants.REQUEST_RESPONSE_REPEAT_NUMBER));\n endpoint.setGroupIds(results.getString(Constants.PATH_PROFILE_GROUP_IDS));\n endpoint.setRequestEnabled(results.getBoolean(Constants.REQUEST_RESPONSE_REQUEST_ENABLED));\n endpoint.setResponseEnabled(results.getBoolean(Constants.REQUEST_RESPONSE_RESPONSE_ENABLED));\n endpoint.setClientUUID(results.getString(Constants.GENERIC_CLIENT_UUID));\n endpoint.setProfileId(results.getInt(Constants.GENERIC_PROFILE_ID));\n endpoint.setGlobal(results.getBoolean(Constants.PATH_PROFILE_GLOBAL));\n return endpoint;\n }", "public boolean addSsextension(String ssExt) {\n if (this.ssextensions == null) {\n this.ssextensions = new ArrayList<String>();\n }\n return this.ssextensions.add(ssExt);\n }", "@Override\r\n public boolean containsKey(Object key) {\r\n // key could be not in original or in deltaMap\r\n // key could be not in original but in deltaMap\r\n // key could be in original but removed from deltaMap\r\n // key could be in original but mapped to something else in deltaMap\r\n Object value = deltaMap.get(key);\r\n if (value == null) {\r\n return originalMap.containsKey(key);\r\n }\r\n if (value == removedValue) {\r\n return false;\r\n }\r\n return true;\r\n }", "public void createOverride(int groupId, String methodName, String className) throws Exception {\n // first make sure this doesn't already exist\n for (Method method : EditService.getInstance().getMethodsFromGroupId(groupId, null)) {\n if (method.getMethodName().equals(methodName) && method.getClassName().equals(className)) {\n // don't add if it already exists in the group\n return;\n }\n }\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n PreparedStatement statement = sqlConnection.prepareStatement(\n \"INSERT INTO \" + Constants.DB_TABLE_OVERRIDE\n + \"(\" + Constants.OVERRIDE_METHOD_NAME\n + \",\" + Constants.OVERRIDE_CLASS_NAME\n + \",\" + Constants.OVERRIDE_GROUP_ID\n + \")\"\n + \" VALUES (?, ?, ?)\"\n );\n statement.setString(1, methodName);\n statement.setString(2, className);\n statement.setInt(3, groupId);\n statement.executeUpdate();\n } catch (SQLException e) {\n e.printStackTrace();\n }\n }", "protected int _countPeriods(String str)\n {\n int commas = 0;\n for (int i = 0, end = str.length(); i < end; ++i) {\n int ch = str.charAt(i);\n if (ch < '0' || ch > '9') {\n if (ch == '.') {\n ++commas;\n } else {\n return -1;\n }\n }\n }\n return commas;\n }", "@Nonnull\n\tprivate static Properties findDefaultProperties() {\n\t\tfinal InputStream in = SourceCodeFormatter.class.getClassLoader().getResourceAsStream(DEFAULT_PROPERTIES_PATH);\n\t\tfinal Properties p = new Properties();\n\t\ttry {\n\t\t\tp.load(in);\n\t\t} catch (final IOException e) {\n\t\t\tthrow new RuntimeException(String.format(\"Can not load resource %s\", DEFAULT_PROPERTIES_PATH));\n\t\t}\n\t\treturn p;\n\t}" ]
Copy the contents of the given byte array to the given OutputStream. Leaves the stream open when done. @param in the byte array to copy from @param out the OutputStream to copy to @throws IOException in case of I/O errors
[ "public static void copy(byte[] in, OutputStream out) throws IOException {\n\t\tAssert.notNull(in, \"No input byte array specified\");\n\t\tAssert.notNull(out, \"No OutputStream specified\");\n\t\tout.write(in);\n\t}" ]
[ "public static String readFlowId(Message message) {\n if (!(message instanceof SoapMessage)) {\n return null;\n }\n String flowId = null;\n Header hdFlowId = ((SoapMessage)message).getHeader(FLOW_ID_QNAME);\n if (hdFlowId != null) {\n if (hdFlowId.getObject() instanceof String) {\n flowId = (String)hdFlowId.getObject();\n } else if (hdFlowId.getObject() instanceof Node) {\n Node headerNode = (Node)hdFlowId.getObject();\n flowId = headerNode.getTextContent();\n } else {\n LOG.warning(\"Found FlowId soap header but value is not a String or a Node! Value: \"\n + hdFlowId.getObject().toString());\n }\n }\n return flowId;\n }", "public String validationErrors() {\n\n List<String> errors = new ArrayList<>();\n for (File config : getConfigFiles()) {\n String filename = config.getName();\n try (FileInputStream stream = new FileInputStream(config)) {\n CmsXmlUtils.unmarshalHelper(CmsFileUtil.readFully(stream, false), new CmsXmlEntityResolver(null), true);\n } catch (CmsXmlException e) {\n errors.add(filename + \":\" + e.getCause().getMessage());\n } catch (Exception e) {\n errors.add(filename + \":\" + e.getMessage());\n }\n }\n if (errors.size() == 0) {\n return null;\n }\n String errString = CmsStringUtil.listAsString(errors, \"\\n\");\n JSONObject obj = new JSONObject();\n try {\n obj.put(\"err\", errString);\n } catch (JSONException e) {\n\n }\n return obj.toString();\n }", "public Boolean checkType(String type) {\n if (mtasPositionType == null) {\n return false;\n } else {\n return mtasPositionType.equals(type);\n }\n }", "private void writeExceptions12(Project.Calendars.Calendar calendar, List<ProjectCalendarException> exceptions)\n {\n Exceptions ce = m_factory.createProjectCalendarsCalendarExceptions();\n calendar.setExceptions(ce);\n List<Exceptions.Exception> el = ce.getException();\n\n for (ProjectCalendarException exception : exceptions)\n {\n Exceptions.Exception ex = m_factory.createProjectCalendarsCalendarExceptionsException();\n el.add(ex);\n\n ex.setName(exception.getName());\n boolean working = exception.getWorking();\n ex.setDayWorking(Boolean.valueOf(working));\n\n if (exception.getRecurring() == null)\n {\n ex.setEnteredByOccurrences(Boolean.FALSE);\n ex.setOccurrences(BigInteger.ONE);\n ex.setType(BigInteger.ONE);\n }\n else\n {\n populateRecurringException(exception, ex);\n }\n\n Project.Calendars.Calendar.Exceptions.Exception.TimePeriod period = m_factory.createProjectCalendarsCalendarExceptionsExceptionTimePeriod();\n ex.setTimePeriod(period);\n period.setFromDate(exception.getFromDate());\n period.setToDate(exception.getToDate());\n\n if (working)\n {\n Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes times = m_factory.createProjectCalendarsCalendarExceptionsExceptionWorkingTimes();\n ex.setWorkingTimes(times);\n List<Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();\n\n for (DateRange range : exception)\n {\n Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarExceptionsExceptionWorkingTimesWorkingTime();\n timesList.add(time);\n\n time.setFromTime(range.getStart());\n time.setToTime(range.getEnd());\n }\n }\n }\n }", "public void increasePriority(int overrideId, int ordinal, int pathId, String clientUUID) {\n logger.info(\"Increase priority\");\n\n int origPriority = -1;\n int newPriority = -1;\n int origId = 0;\n int newId = 0;\n\n PreparedStatement statement = null;\n ResultSet results = null;\n try (Connection sqlConnection = sqlService.getConnection()) {\n results = null;\n statement = sqlConnection.prepareStatement(\n \"SELECT * FROM \" + Constants.DB_TABLE_ENABLED_OVERRIDE +\n \" WHERE \" + Constants.ENABLED_OVERRIDES_PATH_ID + \" = ?\" +\n \" AND \" + Constants.GENERIC_CLIENT_UUID + \" = ?\" +\n \" ORDER BY \" + Constants.ENABLED_OVERRIDES_PRIORITY\n );\n statement.setInt(1, pathId);\n statement.setString(2, clientUUID);\n results = statement.executeQuery();\n\n int ordinalCount = 0;\n while (results.next()) {\n if (results.getInt(Constants.ENABLED_OVERRIDES_OVERRIDE_ID) == overrideId) {\n ordinalCount++;\n if (ordinalCount == ordinal) {\n origPriority = results.getInt(Constants.ENABLED_OVERRIDES_PRIORITY);\n origId = results.getInt(Constants.GENERIC_ID);\n break;\n }\n }\n newPriority = results.getInt(Constants.ENABLED_OVERRIDES_PRIORITY);\n newId = results.getInt(Constants.GENERIC_ID);\n }\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n try {\n if (results != null) {\n results.close();\n }\n } catch (Exception e) {\n }\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n // update priorities\n if (origPriority != -1 && newPriority != -1) {\n statement = sqlConnection.prepareStatement(\n \"UPDATE \" + Constants.DB_TABLE_ENABLED_OVERRIDE +\n \" SET \" + Constants.ENABLED_OVERRIDES_PRIORITY + \"=?\" +\n \" WHERE \" + Constants.GENERIC_ID + \"=?\"\n );\n statement.setInt(1, origPriority);\n statement.setInt(2, newId);\n statement.executeUpdate();\n statement.close();\n\n statement = sqlConnection.prepareStatement(\n \"UPDATE \" + Constants.DB_TABLE_ENABLED_OVERRIDE +\n \" SET \" + Constants.ENABLED_OVERRIDES_PRIORITY + \"=?\" +\n \" WHERE \" + Constants.GENERIC_ID + \"=?\"\n );\n statement.setInt(1, newPriority);\n statement.setInt(2, origId);\n statement.executeUpdate();\n }\n } catch (Exception e) {\n } finally {\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n }", "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, result, 0, firstLength );\n\t\tSystem.arraycopy( second, 0, result, firstLength, secondLength );\n\n\t\treturn result;\n\t}", "public static boolean compareAnnotatedTypes(AnnotatedType<?> t1, AnnotatedType<?> t2) {\n if (!t1.getJavaClass().equals(t2.getJavaClass())) {\n return false;\n }\n if (!compareAnnotated(t1, t2)) {\n return false;\n }\n\n if (t1.getFields().size() != t2.getFields().size()) {\n return false;\n }\n Map<Field, AnnotatedField<?>> fields = new HashMap<Field, AnnotatedField<?>>();\n for (AnnotatedField<?> f : t2.getFields()) {\n fields.put(f.getJavaMember(), f);\n }\n for (AnnotatedField<?> f : t1.getFields()) {\n if (fields.containsKey(f.getJavaMember())) {\n if (!compareAnnotatedField(f, fields.get(f.getJavaMember()))) {\n return false;\n }\n } else {\n return false;\n }\n }\n\n if (t1.getMethods().size() != t2.getMethods().size()) {\n return false;\n }\n Map<Method, AnnotatedMethod<?>> methods = new HashMap<Method, AnnotatedMethod<?>>();\n for (AnnotatedMethod<?> f : t2.getMethods()) {\n methods.put(f.getJavaMember(), f);\n }\n for (AnnotatedMethod<?> f : t1.getMethods()) {\n if (methods.containsKey(f.getJavaMember())) {\n if (!compareAnnotatedCallable(f, methods.get(f.getJavaMember()))) {\n return false;\n }\n } else {\n return false;\n }\n }\n if (t1.getConstructors().size() != t2.getConstructors().size()) {\n return false;\n }\n Map<Constructor<?>, AnnotatedConstructor<?>> constructors = new HashMap<Constructor<?>, AnnotatedConstructor<?>>();\n for (AnnotatedConstructor<?> f : t2.getConstructors()) {\n constructors.put(f.getJavaMember(), f);\n }\n for (AnnotatedConstructor<?> f : t1.getConstructors()) {\n if (constructors.containsKey(f.getJavaMember())) {\n if (!compareAnnotatedCallable(f, constructors.get(f.getJavaMember()))) {\n return false;\n }\n } else {\n return false;\n }\n }\n return true;\n\n }", "private void cascadeMarkedForDeletion()\r\n {\r\n List alreadyPrepared = new ArrayList();\r\n for(int i = 0; i < markedForDeletionList.size(); i++)\r\n {\r\n ObjectEnvelope mod = (ObjectEnvelope) markedForDeletionList.get(i);\r\n // if the object wasn't associated with another object, start cascade delete\r\n if(!isNewAssociatedObject(mod.getIdentity()))\r\n {\r\n cascadeDeleteFor(mod, alreadyPrepared);\r\n alreadyPrepared.clear();\r\n }\r\n }\r\n markedForDeletionList.clear();\r\n }", "public byte[] toBytes(T object) {\n try {\n ByteArrayOutputStream stream = new ByteArrayOutputStream();\n ObjectOutputStream out = new ObjectOutputStream(stream);\n out.writeObject(object);\n return stream.toByteArray();\n } catch(IOException e) {\n throw new SerializationException(e);\n }\n }" ]
Get the server redirects for a given clientId from the database @param clientId client ID @return collection of ServerRedirects
[ "public List<ServerRedirect> tableServers(int clientId) {\n List<ServerRedirect> servers = new ArrayList<>();\n\n try {\n Client client = ClientService.getInstance().getClient(clientId);\n servers = tableServers(client.getProfile().getId(), client.getActiveServerGroup());\n } catch (SQLException e) {\n e.printStackTrace();\n } catch (Exception e) {\n e.printStackTrace();\n }\n return servers;\n }" ]
[ "public static BoxRetentionPolicyAssignment.Info createAssignmentToFolder(BoxAPIConnection api, String policyID,\r\n String folderID) {\r\n return createAssignment(api, policyID, new JsonObject().add(\"type\", TYPE_FOLDER).add(\"id\", folderID), null);\r\n }", "public static base_response unset(nitro_service client, onlinkipv6prefix resource, String[] args) throws Exception{\n\t\tonlinkipv6prefix unsetresource = new onlinkipv6prefix();\n\t\tunsetresource.ipv6prefix = resource.ipv6prefix;\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "public void cache(Identity oid, Object obj)\r\n {\r\n if (oid != null && obj != null)\r\n {\r\n ObjectCache cache = getCache(oid, obj, METHOD_CACHE);\r\n if (cache != null)\r\n {\r\n cache.cache(oid, obj);\r\n }\r\n }\r\n }", "public void fireTaskWrittenEvent(Task task)\n {\n if (m_projectListeners != null)\n {\n for (ProjectListener listener : m_projectListeners)\n {\n listener.taskWritten(task);\n }\n }\n }", "private JarFile loadJar(File archive) throws DecompilationException\n {\n try\n {\n return new JarFile(archive);\n }\n catch (IOException ex)\n {\n throw new DecompilationException(\"Can't load .jar: \" + archive.getPath(), ex);\n }\n }", "public static base_responses clear(nitro_service client, bridgetable resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tbridgetable clearresources[] = new bridgetable[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tclearresources[i] = new bridgetable();\n\t\t\t\tclearresources[i].vlan = resources[i].vlan;\n\t\t\t\tclearresources[i].ifnum = resources[i].ifnum;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, clearresources,\"clear\");\n\t\t}\n\t\treturn result;\n\t}", "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 static BoxAPIConnection restore(String clientID, String clientSecret, String state) {\n BoxAPIConnection api = new BoxAPIConnection(clientID, clientSecret);\n api.restore(state);\n return api;\n }", "public Iterable<? extends WindupVertexFrame> findVariable(String name, int maxDepth)\n {\n int currentDepth = 0;\n Iterable<? extends WindupVertexFrame> result = null;\n for (Map<String, Iterable<? extends WindupVertexFrame>> frame : deque)\n {\n result = frame.get(name);\n if (result != null)\n {\n break;\n }\n currentDepth++;\n if (currentDepth >= maxDepth)\n break;\n }\n return result;\n }" ]