query
stringlengths 7
3.3k
| positive
sequencelengths 1
1
| negative
sequencelengths 9
9
|
---|---|---|
Read an optional Date value form a JSON value.
@param val the JSON value that should represent the Date as long value in a string.
@return the Date from the JSON or null if reading the date fails. | [
"private Date readOptionalDate(JSONValue val) {\n\n JSONString str = null == val ? null : val.isString();\n if (str != null) {\n try {\n return new Date(Long.parseLong(str.stringValue()));\n } catch (@SuppressWarnings(\"unused\") NumberFormatException e) {\n // do nothing - return the default value\n }\n }\n return null;\n }"
] | [
"private PlayState1 findPlayState1() {\n PlayState1 result = PLAY_STATE_1_MAP.get(packetBytes[123]);\n if (result == null) {\n return PlayState1.UNKNOWN;\n }\n return result;\n }",
"private Calendar cleanHistCalendar(Calendar cal) {\n cal.set(Calendar.MILLISECOND, 0);\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MINUTE, 0);\n cal.set(Calendar.HOUR, 0);\n return cal;\n }",
"public static responderpolicy[] get(nitro_service service) throws Exception{\n\t\tresponderpolicy obj = new responderpolicy();\n\t\tresponderpolicy[] response = (responderpolicy[])obj.get_resources(service);\n\t\treturn response;\n\t}",
"private void writeCalendarHours(ProjectCalendar parentCalendar, ProjectCalendarHours record) throws IOException\n {\n m_buffer.setLength(0);\n\n int recordNumber;\n\n if (!parentCalendar.isDerived())\n {\n recordNumber = MPXConstants.BASE_CALENDAR_HOURS_RECORD_NUMBER;\n }\n else\n {\n recordNumber = MPXConstants.RESOURCE_CALENDAR_HOURS_RECORD_NUMBER;\n }\n\n DateRange range1 = record.getRange(0);\n if (range1 == null)\n {\n range1 = DateRange.EMPTY_RANGE;\n }\n\n DateRange range2 = record.getRange(1);\n if (range2 == null)\n {\n range2 = DateRange.EMPTY_RANGE;\n }\n\n DateRange range3 = record.getRange(2);\n if (range3 == null)\n {\n range3 = DateRange.EMPTY_RANGE;\n }\n\n m_buffer.append(recordNumber);\n m_buffer.append(m_delimiter);\n m_buffer.append(format(record.getDay()));\n m_buffer.append(m_delimiter);\n m_buffer.append(format(formatTime(range1.getStart())));\n m_buffer.append(m_delimiter);\n m_buffer.append(format(formatTime(range1.getEnd())));\n m_buffer.append(m_delimiter);\n m_buffer.append(format(formatTime(range2.getStart())));\n m_buffer.append(m_delimiter);\n m_buffer.append(format(formatTime(range2.getEnd())));\n m_buffer.append(m_delimiter);\n m_buffer.append(format(formatTime(range3.getStart())));\n m_buffer.append(m_delimiter);\n m_buffer.append(format(formatTime(range3.getEnd())));\n stripTrailingDelimiters(m_buffer);\n m_buffer.append(MPXConstants.EOL);\n\n m_writer.write(m_buffer.toString());\n }",
"public static final Date parseExtendedAttributeDate(String value)\n {\n Date result = null;\n\n if (value != null)\n {\n try\n {\n result = DATE_FORMAT.get().parse(value);\n }\n\n catch (ParseException ex)\n {\n // ignore exceptions\n }\n }\n\n return (result);\n }",
"private Envelope getMaxScreenEnvelope(InternalTile tile, Coordinate panOrigin) {\n\t\tint nrOfTilesX = Math.max(1, MAXIMUM_TILE_COORDINATE / tile.getScreenWidth());\n\t\tint nrOfTilesY = Math.max(1, MAXIMUM_TILE_COORDINATE / tile.getScreenHeight());\n\n\t\tdouble x1 = panOrigin.x - nrOfTilesX * tile.getTileWidth();\n\t\t// double x2 = x1 + (nrOfTilesX * tileWidth * 2);\n\t\tdouble x2 = panOrigin.x + nrOfTilesX * tile.getTileWidth();\n\t\tdouble y1 = panOrigin.y - nrOfTilesY * tile.getTileHeight();\n\t\t// double y2 = y1 + (nrOfTilesY * tileHeight * 2);\n\t\tdouble y2 = panOrigin.y + nrOfTilesY * tile.getTileHeight();\n\t\treturn new Envelope(x1, x2, y1, y2);\n\t}",
"@SuppressWarnings(\"unused\")\n\t@XmlID\n @XmlAttribute(name = \"id\")\n private String getXmlID(){\n return String.format(\"%s-%s\", this.getClass().getSimpleName(), Long.valueOf(id));\n }",
"public static String getHeaders(HttpMethod method) {\n String headerString = \"\";\n Header[] headers = method.getRequestHeaders();\n for (Header header : headers) {\n String name = header.getName();\n if (name.equals(Constants.ODO_PROXY_HEADER)) {\n // skip.. don't want to log this\n continue;\n }\n\n if (headerString.length() != 0) {\n headerString += \"\\n\";\n }\n\n headerString += header.getName() + \": \" + header.getValue();\n }\n\n return headerString;\n }",
"private static Predicate join(final String joinWord, final List<Predicate> preds) {\n return new Predicate() {\n public void init(AbstractSqlCreator creator) {\n for (Predicate p : preds) {\n p.init(creator);\n }\n }\n public String toSql() {\n StringBuilder sb = new StringBuilder()\n .append(\"(\");\n boolean first = true;\n for (Predicate p : preds) {\n if (!first) {\n sb.append(\" \").append(joinWord).append(\" \");\n }\n sb.append(p.toSql());\n first = false;\n }\n return sb.append(\")\").toString();\n }\n };\n }"
] |
Use this API to update filterhtmlinjectionparameter. | [
"public static base_response update(nitro_service client, filterhtmlinjectionparameter resource) throws Exception {\n\t\tfilterhtmlinjectionparameter updateresource = new filterhtmlinjectionparameter();\n\t\tupdateresource.rate = resource.rate;\n\t\tupdateresource.frequency = resource.frequency;\n\t\tupdateresource.strict = resource.strict;\n\t\tupdateresource.htmlsearchlen = resource.htmlsearchlen;\n\t\treturn updateresource.update_resource(client);\n\t}"
] | [
"public static int getLineCount(String str) {\r\n if (null == str || str.isEmpty()) {\r\n return 0;\r\n }\r\n int count = 1;\r\n for (char c : str.toCharArray()) {\r\n if ('\\n' == c) {\r\n count++;\r\n }\r\n }\r\n return count;\r\n }",
"public Class<?> getColumnType(int c) {\n\n for (int r = 0; r < m_data.size(); r++) {\n Object val = m_data.get(r).get(c);\n if (val != null) {\n return val.getClass();\n }\n }\n return Object.class;\n }",
"public static double Y(int n, double x) {\r\n double by, bym, byp, tox;\r\n\r\n if (n == 0) return Y0(x);\r\n if (n == 1) return Y(x);\r\n\r\n tox = 2.0 / x;\r\n by = Y(x);\r\n bym = Y0(x);\r\n for (int j = 1; j < n; j++) {\r\n byp = j * tox * by - bym;\r\n bym = by;\r\n by = byp;\r\n }\r\n return by;\r\n }",
"public static Double getDistanceWithinThresholdOfCoordinates(\r\n Tuple2<Double, Double> point1, Tuple2<Double, Double> point2) {\r\n throw new NotImplementedError();\r\n }",
"public static ComplexNumber Add(ComplexNumber z1, ComplexNumber z2) {\r\n return new ComplexNumber(z1.real + z2.real, z1.imaginary + z2.imaginary);\r\n }",
"public ExtendedOutputStreamWriter append(double d) throws IOException {\n super.append(String.format(Locale.ROOT, doubleFormat, d));\n return this;\n }",
"@Override\n public Response doRequest(final StitchRequest stitchReq) {\n initAppMetadata(clientAppId);\n\n return super.doRequestUrl(stitchReq, getHostname());\n }",
"@Override\n public boolean deleteObject(GcsFilename filename, long timeoutMillis) throws IOException {\n HTTPRequest req = makeRequest(filename, null, DELETE, timeoutMillis);\n HTTPResponse resp;\n try {\n resp = urlfetch.fetch(req);\n } catch (IOException e) {\n throw createIOException(new HTTPRequestInfo(req), e);\n }\n switch (resp.getResponseCode()) {\n case 204:\n return true;\n case 404:\n return false;\n default:\n throw HttpErrorHandler.error(new HTTPRequestInfo(req), resp);\n }\n }",
"public List<LogSegment> trunc(int newStart) {\n if (newStart < 0) {\n throw new IllegalArgumentException(\"Starting index must be positive.\");\n }\n while (true) {\n List<LogSegment> curr = contents.get();\n int newLength = Math.max(curr.size() - newStart, 0);\n List<LogSegment> updatedList = new ArrayList<LogSegment>(curr.subList(Math.min(newStart, curr.size() - 1),\n curr.size()));\n if (contents.compareAndSet(curr, updatedList)) {\n return curr.subList(0, curr.size() - newLength);\n }\n }\n }"
] |
Converts an absolute rectangle to a relative one wrt to the current coordinate system.
@param rect absolute rectangle
@return relative rectangle | [
"public Rectangle toRelative(Rectangle rect) {\n\t\treturn new Rectangle(rect.getLeft() - origX, rect.getBottom() - origY, rect.getRight() - origX, rect.getTop()\n\t\t\t\t- origY);\n\t}"
] | [
"public final void notifyContentItemChanged(int position) {\n if (position < 0 || position >= contentItemCount) {\n throw new IndexOutOfBoundsException(\"The given position \" + position\n + \" is not within the position bounds for content items [0 - \" + (contentItemCount - 1) + \"].\");\n }\n notifyItemChanged(position + headerItemCount);\n }",
"static VaultConfig readVaultElement_3_0(XMLExtendedStreamReader reader, Namespace expectedNs) throws XMLStreamException {\n final VaultConfig config = new VaultConfig();\n\n final int count = reader.getAttributeCount();\n for (int i = 0; i < count; i++) {\n final String value = reader.getAttributeValue(i);\n String name = reader.getAttributeLocalName(i);\n if (name.equals(CODE)){\n config.code = value;\n } else if (name.equals(MODULE)){\n config.module = value;\n } else {\n unexpectedVaultAttribute(reader.getAttributeLocalName(i), reader);\n }\n }\n if (config.code == null && config.module != null){\n throw new XMLStreamException(\"Attribute 'module' was specified without an attribute\"\n + \" 'code' for element '\" + VAULT + \"' at \" + reader.getLocation());\n }\n readVaultOptions(reader, config);\n return config;\n }",
"public void performActions() {\n\t\tif (this.clientConfiguration.getActions().isEmpty()) {\n\t\t\tthis.clientConfiguration.printHelp();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.dumpProcessingController.setOfflineMode(this.clientConfiguration\n\t\t\t\t.getOfflineMode());\n\n\t\tif (this.clientConfiguration.getDumpDirectoryLocation() != null) {\n\t\t\ttry {\n\t\t\t\tthis.dumpProcessingController\n\t\t\t\t\t\t.setDownloadDirectory(this.clientConfiguration\n\t\t\t\t\t\t\t\t.getDumpDirectoryLocation());\n\t\t\t} catch (IOException e) {\n\t\t\t\tlogger.error(\"Could not set download directory to \"\n\t\t\t\t\t\t+ this.clientConfiguration.getDumpDirectoryLocation()\n\t\t\t\t\t\t+ \": \" + e.getMessage());\n\t\t\t\tlogger.error(\"Aborting\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tdumpProcessingController.setLanguageFilter(this.clientConfiguration\n\t\t\t\t.getFilterLanguages());\n\t\tdumpProcessingController.setSiteLinkFilter(this.clientConfiguration\n\t\t\t\t.getFilterSiteKeys());\n\t\tdumpProcessingController.setPropertyFilter(this.clientConfiguration\n\t\t\t\t.getFilterProperties());\n\n\t\tMwDumpFile dumpFile = this.clientConfiguration.getLocalDumpFile();\n\n\t\tif (dumpFile == null) {\n\t\t\tdumpFile = dumpProcessingController\n\t\t\t\t\t.getMostRecentDump(DumpContentType.JSON);\n\t\t} else {\n\t\t\tif (!dumpFile.isAvailable()) {\n\t\t\t\tlogger.error(\"Dump file not found or not readable: \"\n\t\t\t\t\t\t+ dumpFile.toString());\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tthis.clientConfiguration.setProjectName(dumpFile.getProjectName());\n\t\tthis.clientConfiguration.setDateStamp(dumpFile.getDateStamp());\n\n\t\tboolean hasReadyProcessor = false;\n\t\tfor (DumpProcessingAction props : this.clientConfiguration.getActions()) {\n\n\t\t\tif (!props.isReady()) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (props.needsSites()) {\n\t\t\t\tprepareSites();\n\t\t\t\tif (this.sites == null) { // sites unavailable\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tprops.setSites(this.sites);\n\t\t\t}\n\t\t\tprops.setDumpInformation(dumpFile.getProjectName(),\n\t\t\t\t\tdumpFile.getDateStamp());\n\t\t\tthis.dumpProcessingController.registerEntityDocumentProcessor(\n\t\t\t\t\tprops, null, true);\n\t\t\thasReadyProcessor = true;\n\t\t}\n\n\t\tif (!hasReadyProcessor) {\n\t\t\treturn; // silent; non-ready action should report its problem\n\t\t\t\t\t// directly\n\t\t}\n\n\t\tif (!this.clientConfiguration.isQuiet()) {\n\t\t\tEntityTimerProcessor entityTimerProcessor = new EntityTimerProcessor(\n\t\t\t\t\t0);\n\t\t\tthis.dumpProcessingController.registerEntityDocumentProcessor(\n\t\t\t\t\tentityTimerProcessor, null, true);\n\t\t}\n\t\topenActions();\n\t\tthis.dumpProcessingController.processDump(dumpFile);\n\t\tcloseActions();\n\n\t\ttry {\n\t\t\twriteReport();\n\t\t} catch (IOException e) {\n\t\t\tlogger.error(\"Could not print report file: \" + e.getMessage());\n\t\t}\n\n\t}",
"@Subscribe\n public void onEnd(AggregatedQuitEvent e) {\n try {\n writeHints(hintsFile, hints);\n } catch (IOException exception) {\n outer.log(\"Could not write back the hints file.\", exception, Project.MSG_ERR);\n }\n }",
"public static vpnglobal_vpnnexthopserver_binding[] get(nitro_service service) throws Exception{\n\t\tvpnglobal_vpnnexthopserver_binding obj = new vpnglobal_vpnnexthopserver_binding();\n\t\tvpnglobal_vpnnexthopserver_binding response[] = (vpnglobal_vpnnexthopserver_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"public void deployApplication(String applicationName, String... classpathLocations) throws IOException {\n\n final List<URL> classpathElements = Arrays.stream(classpathLocations)\n .map(classpath -> Thread.currentThread().getContextClassLoader().getResource(classpath))\n .collect(Collectors.toList());\n\n deployApplication(applicationName, classpathElements.toArray(new URL[classpathElements.size()]));\n }",
"public static authenticationradiuspolicy_vpnglobal_binding[] get(nitro_service service, String name) throws Exception{\n\t\tauthenticationradiuspolicy_vpnglobal_binding obj = new authenticationradiuspolicy_vpnglobal_binding();\n\t\tobj.set_name(name);\n\t\tauthenticationradiuspolicy_vpnglobal_binding response[] = (authenticationradiuspolicy_vpnglobal_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"public Map<Double, SingleAssetEuropeanOptionProductDescriptor> getDescriptors(LocalDate referenceDate){\n\n\t\tint numberOfStrikes = strikes.length;\n\t\tHashMap<Double, SingleAssetEuropeanOptionProductDescriptor> descriptors = new HashMap<Double, SingleAssetEuropeanOptionProductDescriptor>();\n\n\t\tLocalDate maturityDate = FloatingpointDate.getDateFromFloatingPointDate(referenceDate, maturity);\n\t\tfor(int i = 0; i< numberOfStrikes; i++) {\n\t\t\tdescriptors.put(strikes[i], new SingleAssetEuropeanOptionProductDescriptor(underlyingName, maturityDate, strikes[i]));\n\t\t}\n\n\t\treturn descriptors;\n\t}",
"private CmsTemplateMapperConfiguration getConfiguration(final CmsObject cms) {\n\n if (!m_enabled) {\n return CmsTemplateMapperConfiguration.EMPTY_CONFIG;\n }\n\n if (m_configPath == null) {\n m_configPath = OpenCms.getSystemInfo().getConfigFilePath(cms, \"template-mapping.xml\");\n }\n\n return (CmsTemplateMapperConfiguration)(CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().loadVfsObject(\n cms,\n m_configPath,\n new Transformer() {\n\n @Override\n public Object transform(Object input) {\n\n try {\n CmsFile file = cms.readFile(m_configPath, CmsResourceFilter.IGNORE_EXPIRATION);\n SAXReader saxBuilder = new SAXReader();\n try (ByteArrayInputStream stream = new ByteArrayInputStream(file.getContents())) {\n Document document = saxBuilder.read(stream);\n CmsTemplateMapperConfiguration config = new CmsTemplateMapperConfiguration(cms, document);\n return config;\n }\n } catch (Exception e) {\n LOG.warn(e.getLocalizedMessage(), e);\n return new CmsTemplateMapperConfiguration(); // empty configuration, does not do anything\n }\n\n }\n }));\n }"
] |
Clears all checked widgets in the group | [
"public <T extends Widget & Checkable> void clearChecks() {\n List<T> children = getCheckableChildren();\n for (T c : children) {\n c.setChecked(false);\n }\n }"
] | [
"public Range<Dyno> listDynos(String appName) {\n return connection.execute(new DynoList(appName), apiKey);\n }",
"public void fireEvent(Type eventType, Object event, Annotation... qualifiers) {\n final EventMetadata metadata = new EventMetadataImpl(eventType, null, qualifiers);\n notifier.fireEvent(eventType, event, metadata, qualifiers);\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}",
"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 }",
"public <T extends OutputStream> T write(T os) throws IOException {\n close();\n\n if (!(this.os instanceof ByteArrayOutputStream))\n throw new IllegalStateException(\"Cannot write to another target if setOutputStream has been called\");\n final byte[] content = ((ByteArrayOutputStream) this.os).toByteArray();\n\n if (packer != null)\n packer.pack(new JarInputStream(new ByteArrayInputStream(content)), os);\n else\n os.write(content);\n\n os.close();\n return os;\n }",
"private static long daysBetween(Date date1, Date date2) {\n long diff;\n if (date2.after(date1)) {\n diff = date2.getTime() - date1.getTime();\n } else {\n diff = date1.getTime() - date2.getTime();\n }\n return diff / (24 * 60 * 60 * 1000);\n }",
"boolean applyDomainModel(ModelNode result) {\n if(! result.hasDefined(ModelDescriptionConstants.RESULT)) {\n return false;\n }\n final List<ModelNode> bootOperations= result.get(ModelDescriptionConstants.RESULT).asList();\n return callback.applyDomainModel(bootOperations);\n }",
"protected static void appendHandler(Class<? extends LogRecordHandler> parent, LogRecordHandler child){\r\n List<LogRecordHandler> toAdd = new LinkedList<LogRecordHandler>();\r\n //--Find Parents\r\n for(LogRecordHandler term : handlers){\r\n if(parent.isAssignableFrom(term.getClass())){\r\n toAdd.add(term);\r\n }\r\n }\r\n //--Add Handler\r\n for(LogRecordHandler p : toAdd){\r\n appendHandler(p, child);\r\n }\r\n }",
"public static Cluster getCluster(ZkClient zkClient) {\n Cluster cluster = new Cluster();\n List<String> nodes = getChildrenParentMayNotExist(zkClient, BrokerIdsPath);\n for (String node : nodes) {\n final String brokerInfoString = readData(zkClient, BrokerIdsPath + \"/\" + node);\n cluster.add(Broker.createBroker(Integer.valueOf(node), brokerInfoString));\n }\n return cluster;\n }"
] |
To use main report datasource. There should be nothing else in the detail band
@param preSorted
@return | [
"public CrosstabBuilder useMainReportDatasource(boolean preSorted) {\r\n\t\tDJDataSource datasource = new DJDataSource(\"ds\",DJConstants.DATA_SOURCE_ORIGIN_REPORT_DATASOURCE,DJConstants.DATA_SOURCE_TYPE_JRDATASOURCE);\r\n\t\tdatasource.setPreSorted(preSorted);\r\n\t\tcrosstab.setDatasource(datasource);\r\n\t\treturn this;\r\n\t}"
] | [
"private static void createDirectory(Path path) throws IOException {\n\t\ttry {\n\t\t\tFiles.createDirectory(path);\n\t\t} catch (FileAlreadyExistsException e) {\n\t\t\tif (!Files.isDirectory(path)) {\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\t}",
"public IndirectionHandler getIndirectionHandler(Object obj)\r\n {\r\n if(obj == null)\r\n {\r\n return null;\r\n }\r\n else if(isNormalOjbProxy(obj))\r\n {\r\n return getDynamicIndirectionHandler(obj);\r\n }\r\n else if(isVirtualOjbProxy(obj))\r\n {\r\n return VirtualProxy.getIndirectionHandler((VirtualProxy) obj);\r\n }\r\n else\r\n {\r\n return null;\r\n }\r\n\r\n }",
"protected void checkJobType(final String jobName, final Class<?> jobType) {\n if (jobName == null) {\n throw new IllegalArgumentException(\"jobName must not be null\");\n }\n if (jobType == null) {\n throw new IllegalArgumentException(\"jobType must not be null\");\n }\n if (!(Runnable.class.isAssignableFrom(jobType)) \n && !(Callable.class.isAssignableFrom(jobType))) {\n throw new IllegalArgumentException(\n \"jobType must implement either Runnable or Callable: \" + jobType);\n }\n }",
"public void getSpellcheckingResult(\n final HttpServletResponse res,\n final ServletRequest servletRequest,\n final CmsObject cms)\n throws CmsPermissionViolationException, IOException {\n\n // Perform a permission check\n performPermissionCheck(cms);\n\n // Set the appropriate response headers\n setResponeHeaders(res);\n\n // Figure out whether a JSON or HTTP request has been sent\n CmsSpellcheckingRequest cmsSpellcheckingRequest = null;\n try {\n String requestBody = getRequestBody(servletRequest);\n final JSONObject jsonRequest = new JSONObject(requestBody);\n cmsSpellcheckingRequest = parseJsonRequest(jsonRequest);\n } catch (Exception e) {\n LOG.debug(e.getMessage(), e);\n cmsSpellcheckingRequest = parseHttpRequest(servletRequest, cms);\n }\n\n if ((null != cmsSpellcheckingRequest) && cmsSpellcheckingRequest.isInitialized()) {\n // Perform the actual spellchecking\n final SpellCheckResponse spellCheckResponse = performSpellcheckQuery(cmsSpellcheckingRequest);\n\n /*\n * The field spellCheckResponse is null when exactly one correctly spelled word is passed to the spellchecker.\n * In this case it's safe to return an empty JSON formatted map, as the passed word is correct. Otherwise,\n * convert the spellchecker response into a new JSON formatted map.\n */\n if (null == spellCheckResponse) {\n cmsSpellcheckingRequest.m_wordSuggestions = new JSONObject();\n } else {\n cmsSpellcheckingRequest.m_wordSuggestions = getConvertedResponseAsJson(spellCheckResponse);\n }\n }\n\n // Send response back to the client\n sendResponse(res, cmsSpellcheckingRequest);\n }",
"private boolean isRecyclable(View convertView, T content) {\n boolean isRecyclable = false;\n if (convertView != null && convertView.getTag() != null) {\n Class prototypeClass = getPrototypeClass(content);\n validatePrototypeClass(prototypeClass);\n isRecyclable = prototypeClass.equals(convertView.getTag().getClass());\n }\n return isRecyclable;\n }",
"public static PersistenceBroker createPersistenceBroker(String jcdAlias,\r\n String user,\r\n String password) throws PBFactoryException\r\n {\r\n return PersistenceBrokerFactoryFactory.instance().\r\n createPersistenceBroker(jcdAlias, user, password);\r\n }",
"public static long getTxInfoCacheWeight(FluoConfiguration conf) {\n long size = conf.getLong(TX_INFO_CACHE_WEIGHT, TX_INFO_CACHE_WEIGHT_DEFAULT);\n if (size <= 0) {\n throw new IllegalArgumentException(\"Cache size must be positive for \" + TX_INFO_CACHE_WEIGHT);\n }\n return size;\n }",
"public ParallelTaskBuilder prepareHttpHead(String url) {\n reinitIfClosed();\n ParallelTaskBuilder cb = new ParallelTaskBuilder();\n cb.getHttpMeta().setHttpMethod(HttpMethod.HEAD);\n cb.getHttpMeta().setRequestUrlPostfix(url);\n return cb;\n }",
"protected static String jacksonObjectToString(Object object) {\n\t\ttry {\n\t\t\treturn mapper.writeValueAsString(object);\n\t\t} catch (JsonProcessingException e) {\n\t\t\tlogger.error(\"Failed to serialize JSON data: \" + e.toString());\n\t\t\treturn null;\n\t\t}\n\t}"
] |
Show only the following channels.
@param channels The names of the channels to show.
@return this | [
"public RedwoodConfiguration showOnlyChannels(final Object[] channels){\r\n tasks.add(new Runnable() { public void run() { Redwood.showOnlyChannels(channels); } });\r\n return this;\r\n }"
] | [
"public void set(final Argument argument) {\n if (argument != null) {\n map.put(argument.getKey(), Collections.singleton(argument));\n }\n }",
"public AsciiTable setPaddingBottom(int paddingBottom) {\r\n\t\tfor(AT_Row row : this.rows){\r\n\t\t\tif(row.getType()==TableRowType.CONTENT){\r\n\t\t\t\trow.setPaddingBottom(paddingBottom);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}",
"public static snmpuser get(nitro_service service, String name) throws Exception{\n\t\tsnmpuser obj = new snmpuser();\n\t\tobj.set_name(name);\n\t\tsnmpuser response = (snmpuser) obj.get_resource(service);\n\t\treturn response;\n\t}",
"public E get(int i) {\r\n if (i < 0 || i >= objects.size())\r\n throw new ArrayIndexOutOfBoundsException(\"Index \" + i + \r\n \" outside the bounds [0,\" + \r\n size() + \")\");\r\n return objects.get(i);\r\n }",
"@Deprecated\n\tpublic void processMostRecentDump(DumpContentType dumpContentType,\n\t\t\tMwDumpFileProcessor dumpFileProcessor) {\n\t\tMwDumpFile dumpFile = getMostRecentDump(dumpContentType);\n\t\tif (dumpFile != null) {\n\t\t\tprocessDumpFile(dumpFile, dumpFileProcessor);\n\t\t}\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 InetSocketAddress getMulticastSocketAddress() {\n if (multicastAddress == null) {\n throw MESSAGES.noMulticastBinding(name);\n }\n return new InetSocketAddress(multicastAddress, multicastPort);\n }",
"@JmxGetter(name = \"avgUpdateEntriesNetworkTimeMs\", description = \"average time spent on network, for streaming operations\")\n public double getAvgUpdateEntriesNetworkTimeMs() {\n return networkTimeCounterMap.get(Operation.UPDATE_ENTRIES).getAvgEventValue()\n / Time.NS_PER_MS;\n }",
"public static String ellipsize(String text, int maxLength, String end) {\n if (text != null && text.length() > maxLength) {\n return text.substring(0, maxLength - end.length()) + end;\n }\n return text;\n }"
] |
Retrieve a Synchro Duration from an input stream.
@param is input stream
@return Duration instance | [
"public static final Duration getDuration(InputStream is) throws IOException\n {\n double durationInSeconds = getInt(is);\n durationInSeconds /= (60 * 60);\n return Duration.getInstance(durationInSeconds, TimeUnit.HOURS);\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 boolean ignoreOperation(final Resource domainResource, final Collection<ServerConfigInfo> serverConfigs, final PathAddress pathAddress) {\n if (pathAddress.size() == 0) {\n return false;\n }\n boolean ignore = ignoreResourceInternal(domainResource, serverConfigs, pathAddress);\n return ignore;\n }",
"@Override\n public void solve(DMatrixRBlock B, DMatrixRBlock X) {\n if( B.blockLength != blockLength )\n throw new IllegalArgumentException(\"Unexpected blocklength in B.\");\n\n DSubmatrixD1 L = new DSubmatrixD1(decomposer.getT(null));\n\n if( X != null ) {\n if( X.blockLength != blockLength )\n throw new IllegalArgumentException(\"Unexpected blocklength in X.\");\n if( X.numRows != L.col1 ) throw new IllegalArgumentException(\"Not enough rows in X\");\n }\n \n if( B.numRows != L.col1 ) throw new IllegalArgumentException(\"Not enough rows in B\");\n\n // L * L^T*X = B\n\n // Solve for Y: L*Y = B\n TriangularSolver_DDRB.solve(blockLength,false,L,new DSubmatrixD1(B),false);\n\n // L^T * X = Y\n TriangularSolver_DDRB.solve(blockLength,false,L,new DSubmatrixD1(B),true);\n\n if( X != null ) {\n // copy the solution from B into X\n MatrixOps_DDRB.extractAligned(B,X);\n }\n\n }",
"private LocatorSelectionStrategy getLocatorSelectionStrategy(String locatorSelectionStrategy) {\n if (null == locatorSelectionStrategy) {\n return locatorSelectionStrategyMap.get(DEFAULT_STRATEGY).getInstance();\n }\n\n if (LOG.isLoggable(Level.FINE)) {\n LOG.log(Level.FINE, \"Strategy \" + locatorSelectionStrategy\n + \" was set for LocatorClientRegistrar.\");\n }\n\n if (locatorSelectionStrategyMap.containsKey(locatorSelectionStrategy)) {\n return locatorSelectionStrategyMap.get(locatorSelectionStrategy).getInstance();\n } else {\n if (LOG.isLoggable(Level.WARNING)) {\n LOG.log(Level.WARNING, \"LocatorSelectionStrategy \" + locatorSelectionStrategy\n + \" not registered at LocatorClientEnabler.\");\n }\n return locatorSelectionStrategyMap.get(DEFAULT_STRATEGY).getInstance();\n }\n }",
"public void removeGroup(int groupId) {\n PreparedStatement statement = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n statement = sqlConnection.prepareStatement(\n \"DELETE FROM \" + Constants.DB_TABLE_GROUPS\n + \" WHERE \" + Constants.GENERIC_ID + \" = ?\"\n );\n statement.setInt(1, groupId);\n statement.executeUpdate();\n statement.close();\n\n statement = sqlConnection.prepareStatement(\n \"DELETE FROM \" + Constants.DB_TABLE_OVERRIDE +\n \" WHERE \" + Constants.OVERRIDE_GROUP_ID + \" = ?\"\n );\n\n statement.setInt(1, groupId);\n statement.executeUpdate();\n } catch (SQLException e) {\n e.printStackTrace();\n } finally {\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n removeGroupIdFromTablePaths(groupId);\n }",
"public static PredicateExpression nin(Object... rhs) {\n PredicateExpression ex = new PredicateExpression(\"$nin\", rhs);\n if (rhs.length == 1) {\n ex.single = true;\n }\n return ex;\n }",
"public String createSessionForResource(String configPath, String fileName) throws CmsUgcException {\n\n CmsUgcSession formSession = CmsUgcSessionFactory.getInstance().createSessionForFile(\n getCmsObject(),\n getRequest(),\n configPath,\n fileName);\n return \"\" + formSession.getId();\n }",
"private static void updateJar(final File file, final byte[] searchPattern, final int[] badSkipBytes, final int newSig, final int endSig) throws IOException {\n final RandomAccessFile raf = new RandomAccessFile(file, \"rw\");\n try {\n final FileChannel channel = raf.getChannel();\n try {\n long pos = channel.size() - ENDLEN;\n final ScanContext context;\n if (newSig == CRIPPLED_ENDSIG) {\n context = new ScanContext(GOOD_ENDSIG_PATTERN, CRIPPLED_ENDSIG_PATTERN);\n } else if (newSig == GOOD_ENDSIG) {\n context = new ScanContext(CRIPPLED_ENDSIG_PATTERN, GOOD_ENDSIG_PATTERN);\n } else {\n context = null;\n }\n\n if (!validateEndRecord(file, channel, pos, endSig)) {\n pos = scanForEndSig(file, channel, context);\n }\n if (pos == -1) {\n if (context.state == State.NOT_FOUND) {\n // Don't fail patching if we cannot validate a valid zip\n PatchLogger.ROOT_LOGGER.cannotInvalidateZip(file.getAbsolutePath());\n }\n return;\n }\n // Update the central directory record\n channel.position(pos);\n final ByteBuffer buffer = ByteBuffer.allocate(4);\n buffer.order(ByteOrder.LITTLE_ENDIAN);\n buffer.putInt(newSig);\n buffer.flip();\n while (buffer.hasRemaining()) {\n channel.write(buffer);\n }\n } finally {\n safeClose(channel);\n }\n } finally {\n safeClose(raf);\n }\n }",
"public static long count(nitro_service service, Long id) throws Exception{\n\t\tbridgegroup_vlan_binding obj = new bridgegroup_vlan_binding();\n\t\tobj.set_id(id);\n\t\toptions option = new options();\n\t\toption.set_count(true);\n\t\tbridgegroup_vlan_binding response[] = (bridgegroup_vlan_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}"
] |
Handles the file deletions.
@param cms the CMS context to use
@param toDelete the resources to delete
@throws CmsException if something goes wrong | [
"protected void processDeletions(CmsObject cms, List<CmsResource> toDelete) throws CmsException {\n\n Collections.sort(toDelete, (a, b) -> b.getRootPath().compareTo(a.getRootPath()));\n for (CmsResource deleteRes : toDelete) {\n m_report.print(\n org.opencms.importexport.Messages.get().container(org.opencms.importexport.Messages.RPT_DELFOLDER_0),\n I_CmsReport.FORMAT_NOTE);\n m_report.print(\n org.opencms.report.Messages.get().container(\n org.opencms.report.Messages.RPT_ARGUMENT_1,\n deleteRes.getRootPath()));\n CmsLock lock = cms.getLock(deleteRes);\n if (lock.isUnlocked()) {\n lock(cms, deleteRes);\n }\n cms.deleteResource(deleteRes, CmsResource.DELETE_PRESERVE_SIBLINGS);\n m_report.println(\n org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),\n I_CmsReport.FORMAT_OK);\n\n }\n }"
] | [
"public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {\n final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();\n final ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES);\n if (servicesAttachment == null || servicesAttachment.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) {\n return; // Skip it if it has not been marked\n }\n final Module module = deploymentUnit.getAttachment(Attachments.MODULE);\n if (module == null) {\n return; // Skip deployments with no module\n }\n\n AttachmentList<DeploymentUnit> duList = deploymentUnit.getAttachment(Attachments.SUB_DEPLOYMENTS);\n List<String> serviceAcitvatorList = new ArrayList<String>();\n if (duList!=null && !duList.isEmpty()) {\n for (DeploymentUnit du : duList) {\n ServicesAttachment duServicesAttachment = du.getAttachment(Attachments.SERVICES);\n for (String serv : duServicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) {\n serviceAcitvatorList.add(serv);\n }\n }\n }\n\n ServiceRegistry serviceRegistry = phaseContext.getServiceRegistry();\n if (WildFlySecurityManager.isChecking()) {\n //service registry allows you to modify internal server state across all deployments\n //if a security manager is present we use a version that has permission checks\n serviceRegistry = new SecuredServiceRegistry(serviceRegistry);\n }\n final ServiceActivatorContext serviceActivatorContext = new ServiceActivatorContextImpl(phaseContext.getServiceTarget(), serviceRegistry);\n\n final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();\n\n try {\n WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader());\n for (ServiceActivator serviceActivator : module.loadService(ServiceActivator.class)) {\n try {\n for (String serv : servicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) {\n if (serv.compareTo(serviceActivator.getClass().getName()) == 0 && !serviceAcitvatorList.contains(serv)) {\n serviceActivator.activate(serviceActivatorContext);\n break;\n }\n }\n } catch (ServiceRegistryException e) {\n throw new DeploymentUnitProcessingException(e);\n }\n }\n } finally {\n WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);\n }\n }",
"private void readAvailabilityTable(Resource resource, AvailabilityPeriods periods)\n {\n if (periods != null)\n {\n AvailabilityTable table = resource.getAvailability();\n List<AvailabilityPeriod> list = periods.getAvailabilityPeriod();\n for (AvailabilityPeriod period : list)\n {\n Date start = period.getAvailableFrom();\n Date end = period.getAvailableTo();\n Number units = DatatypeConverter.parseUnits(period.getAvailableUnits());\n Availability availability = new Availability(start, end, units);\n table.add(availability);\n }\n Collections.sort(table);\n }\n }",
"public static ThreadPoolExecutor newFixedThreadPool(int threads, String groupname, int queueSize) {\n\t\treturn new ThreadPoolExecutor( threads, threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(\n\t\t\t\tqueueSize ), new SearchThreadFactory( groupname ), new BlockPolicy() );\n\t}",
"private void writeWBS(Task mpxj)\n {\n if (mpxj.getUniqueID().intValue() != 0)\n {\n WBSType xml = m_factory.createWBSType();\n m_project.getWBS().add(xml);\n String code = mpxj.getWBS();\n code = code == null || code.length() == 0 ? DEFAULT_WBS_CODE : code;\n\n Task parentTask = mpxj.getParentTask();\n Integer parentObjectID = parentTask == null ? null : parentTask.getUniqueID();\n\n xml.setCode(code);\n xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));\n xml.setName(mpxj.getName());\n\n xml.setObjectId(mpxj.getUniqueID());\n xml.setParentObjectId(parentObjectID);\n xml.setProjectObjectId(PROJECT_OBJECT_ID);\n xml.setSequenceNumber(Integer.valueOf(m_wbsSequence++));\n\n xml.setStatus(\"Active\");\n }\n\n writeChildTasks(mpxj);\n }",
"public CustomHeadersInterceptor replaceHeader(String name, String value) {\n this.headers.put(name, new ArrayList<String>());\n this.headers.get(name).add(value);\n return this;\n }",
"public static java.util.Date getDateTime(Object value) {\n try {\n return toDateTime(value);\n } catch (ParseException pe) {\n pe.printStackTrace();\n return null;\n }\n }",
"public String getString(int field)\n {\n String result;\n\n if (field < m_fields.length)\n {\n result = m_fields[field];\n\n if (result != null)\n {\n result = result.replace(MPXConstants.EOL_PLACEHOLDER, '\\n');\n }\n }\n else\n {\n result = null;\n }\n\n return (result);\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 Response remove(DesignDocument designDocument) {\r\n assertNotEmpty(designDocument, \"DesignDocument\");\r\n ensureDesignPrefixObject(designDocument);\r\n return db.remove(designDocument);\r\n }"
] |
Returns the key of the entity targeted by the represented association, retrieved from the given tuple.
@param tuple the tuple from which to retrieve the referenced entity key
@return the key of the entity targeted by the represented association | [
"protected EntityKey getEntityKey(Tuple tuple, AssociatedEntityKeyMetadata associatedEntityKeyMetadata) {\n\t\tObject[] columnValues = new Object[ associatedEntityKeyMetadata.getAssociationKeyColumns().length];\n\t\tint i = 0;\n\n\t\tfor ( String associationKeyColumn : associatedEntityKeyMetadata.getAssociationKeyColumns() ) {\n\t\t\tcolumnValues[i] = tuple.get( associationKeyColumn );\n\t\t\ti++;\n\t\t}\n\n\t\treturn new EntityKey( associatedEntityKeyMetadata.getEntityKeyMetadata(), columnValues );\n\t}"
] | [
"public static base_responses add(nitro_service client, autoscaleprofile resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tautoscaleprofile addresources[] = new autoscaleprofile[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new autoscaleprofile();\n\t\t\t\taddresources[i].name = resources[i].name;\n\t\t\t\taddresources[i].type = resources[i].type;\n\t\t\t\taddresources[i].url = resources[i].url;\n\t\t\t\taddresources[i].apikey = resources[i].apikey;\n\t\t\t\taddresources[i].sharedsecret = resources[i].sharedsecret;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}",
"public synchronized void abortTransaction() throws TransactionNotInProgressException\n {\n if(isInTransaction())\n {\n fireBrokerEvent(BEFORE_ROLLBACK_EVENT);\n setInTransaction(false);\n clearRegistrationLists();\n referencesBroker.removePrefetchingListeners();\n /*\n arminw:\n check if we in local tx, before do local rollback\n Necessary, because ConnectionManager may do a rollback by itself\n or in managed environments the used connection is already be closed\n */\n if(connectionManager.isInLocalTransaction()) this.connectionManager.localRollback();\n fireBrokerEvent(AFTER_ROLLBACK_EVENT);\n }\n }",
"private void validateSameDay(ProjectCalendar calendar, LinkedList<TimephasedWork> list)\n {\n for (TimephasedWork assignment : list)\n {\n Date assignmentStart = assignment.getStart();\n Date calendarStartTime = calendar.getStartTime(assignmentStart);\n Date assignmentStartTime = DateHelper.getCanonicalTime(assignmentStart);\n Date assignmentFinish = assignment.getFinish();\n Date calendarFinishTime = calendar.getFinishTime(assignmentFinish);\n Date assignmentFinishTime = DateHelper.getCanonicalTime(assignmentFinish);\n double totalWork = assignment.getTotalAmount().getDuration();\n\n if (assignmentStartTime != null && calendarStartTime != null)\n {\n if ((totalWork == 0 && assignmentStartTime.getTime() != calendarStartTime.getTime()) || (assignmentStartTime.getTime() < calendarStartTime.getTime()))\n {\n assignmentStart = DateHelper.setTime(assignmentStart, calendarStartTime);\n assignment.setStart(assignmentStart);\n }\n }\n\n if (assignmentFinishTime != null && calendarFinishTime != null)\n {\n if ((totalWork == 0 && assignmentFinishTime.getTime() != calendarFinishTime.getTime()) || (assignmentFinishTime.getTime() > calendarFinishTime.getTime()))\n {\n assignmentFinish = DateHelper.setTime(assignmentFinish, calendarFinishTime);\n assignment.setFinish(assignmentFinish);\n }\n }\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 }",
"public static void validateExternalizersPresent(EmbeddedCacheManager externalCacheManager) {\n\t\tMap<Integer, AdvancedExternalizer<?>> externalizerMap = externalCacheManager\n\t\t\t\t.getCacheManagerConfiguration()\n\t\t\t\t.serialization()\n\t\t\t\t.advancedExternalizers();\n\t\tfor ( AdvancedExternalizer<?> ogmExternalizer : ogmExternalizers.values() ) {\n\t\t\tfinal Integer externalizerId = ogmExternalizer.getId();\n\t\t\tAdvancedExternalizer<?> registeredExternalizer = externalizerMap.get( externalizerId );\n\t\t\tif ( registeredExternalizer == null ) {\n\t\t\t\tthrow log.externalizersNotRegistered( externalizerId, ogmExternalizer.getClass() );\n\t\t\t}\n\t\t\telse if ( !registeredExternalizer.getClass().equals( ogmExternalizer ) ) {\n\t\t\t\tif ( registeredExternalizer.getClass().toString().equals( ogmExternalizer.getClass().toString() ) ) {\n\t\t\t\t\t// same class name, yet different Class definition!\n\t\t\t\t\tthrow log.registeredExternalizerNotLoadedFromOGMClassloader( registeredExternalizer.getClass() );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow log.externalizerIdNotMatchingType( externalizerId, registeredExternalizer, ogmExternalizer );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"public int[] getVertexPointIndices() {\n int[] indices = new int[numVertices];\n for (int i = 0; i < numVertices; i++) {\n indices[i] = vertexPointIndices[i];\n }\n return indices;\n }",
"public void setFinalTransformMatrix(Matrix4f finalTransform)\n {\n float[] mat = new float[16];\n finalTransform.get(mat);\n NativeBone.setFinalTransformMatrix(getNative(), mat);\n }",
"public static ModelNode getAccessControl(ModelControllerClient client, OperationRequestAddress address, boolean operations) {\n return getAccessControl(client, null, address, operations);\n }",
"public String getTitle(Locale locale)\n {\n String result = null;\n\n if (m_title != null)\n {\n result = m_title;\n }\n else\n {\n if (m_fieldType != null)\n {\n result = m_project.getCustomFields().getCustomField(m_fieldType).getAlias();\n if (result == null)\n {\n result = m_fieldType.getName(locale);\n }\n }\n }\n\n return (result);\n }"
] |
Finds the last entry of the address list and returns it as a property.
@param address the address to get the last part of
@return the last part of the address
@throws IllegalArgumentException if the address is not of type {@link ModelType#LIST} or is empty | [
"public static Property getChildAddress(final ModelNode address) {\n if (address.getType() != ModelType.LIST) {\n throw new IllegalArgumentException(\"The address type must be a list.\");\n }\n final List<Property> addressParts = address.asPropertyList();\n if (addressParts.isEmpty()) {\n throw new IllegalArgumentException(\"The address is empty.\");\n }\n return addressParts.get(addressParts.size() - 1);\n }"
] | [
"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 link(Object targetObject, ClassDescriptor cld, ObjectReferenceDescriptor rds, Object referencedObject, boolean insert)\n {\n // MBAIRD: we have 'disassociated' this object from the referenced object,\n // the object represented by the reference descriptor is now null, so set\n // the fk in the target object to null.\n // arminw: if an insert was done and ref object was null, we should allow\n // to pass FK fields of main object (maybe only the FK fields are set)\n if (referencedObject == null)\n {\n /*\n arminw:\n if update we set FK fields to 'null', because reference was disassociated\n We do nothing on insert, maybe only the FK fields of main object (without\n materialization of the reference object) are set by the user\n */\n if(!insert)\n {\n unlinkFK(targetObject, cld, rds);\n }\n }\n else\n {\n setFKField(targetObject, cld, rds, referencedObject);\n }\n }",
"int getItemViewType(T content) {\n Class prototypeClass = getPrototypeClass(content);\n validatePrototypeClass(prototypeClass);\n return getItemViewType(prototypeClass);\n }",
"public boolean addDescriptor() {\n\n saveLocalization();\n IndexedContainer oldContainer = m_container;\n try {\n createAndLockDescriptorFile();\n unmarshalDescriptor();\n updateBundleDescriptorContent();\n m_hasMasterMode = true;\n m_container = createContainer();\n m_editorState.put(EditMode.DEFAULT, getDefaultState());\n m_editorState.put(EditMode.MASTER, getMasterState());\n } catch (CmsException | IOException e) {\n LOG.error(e.getLocalizedMessage(), e);\n if (m_descContent != null) {\n m_descContent = null;\n }\n if (m_descFile != null) {\n m_descFile = null;\n }\n if (m_desc != null) {\n try {\n m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(1));\n } catch (CmsException ex) {\n LOG.error(ex.getLocalizedMessage(), ex);\n }\n m_desc = null;\n }\n m_hasMasterMode = false;\n m_container = oldContainer;\n return false;\n }\n m_removeDescriptorOnCancel = true;\n return true;\n }",
"void releaseResources(JobInstance ji)\n {\n this.peremption.remove(ji.getId());\n this.actualNbThread.decrementAndGet();\n\n for (ResourceManagerBase rm : this.resourceManagers)\n {\n rm.releaseResource(ji);\n }\n\n if (!this.strictPollingPeriod)\n {\n // Force a new loop at once. This makes queues more fluid.\n loop.release(1);\n }\n this.engine.signalEndOfRun();\n }",
"public CustomHeadersInterceptor addHeaderMap(Map<String, String> headers) {\n for (Map.Entry<String, String> header : headers.entrySet()) {\n this.headers.put(header.getKey(), Collections.singletonList(header.getValue()));\n }\n return this;\n }",
"public static AppDescriptor of(String appName, String packageName) {\n String[] packages = packageName.split(S.COMMON_SEP);\n return of(appName, packageName, Version.ofPackage(packages[0]));\n }",
"private void writeCustomField(CustomField field) throws IOException\n {\n if (field.getAlias() != null)\n {\n m_writer.writeStartObject(null);\n m_writer.writeNameValuePair(\"field_type_class\", field.getFieldType().getFieldTypeClass().name().toLowerCase());\n m_writer.writeNameValuePair(\"field_type\", field.getFieldType().name().toLowerCase());\n m_writer.writeNameValuePair(\"field_alias\", field.getAlias());\n m_writer.writeEndObject();\n }\n }",
"private void swapROStores(List<String> swappedStoreNames, boolean useSwappedStoreNames) {\n\n try {\n for(StoreDefinition storeDef: metadataStore.getStoreDefList()) {\n\n // Only pick up the RO stores\n if(storeDef.getType().compareTo(ReadOnlyStorageConfiguration.TYPE_NAME) == 0) {\n\n if(useSwappedStoreNames && !swappedStoreNames.contains(storeDef.getName())) {\n continue;\n }\n\n ReadOnlyStorageEngine engine = (ReadOnlyStorageEngine) storeRepository.getStorageEngine(storeDef.getName());\n\n if(engine == null) {\n throw new VoldemortException(\"Could not find storage engine for \"\n + storeDef.getName() + \" to swap \");\n }\n\n logger.info(\"Swapping RO store \" + storeDef.getName());\n\n // Time to swap this store - Could have used admin client,\n // but why incur the overhead?\n engine.swapFiles(engine.getCurrentDirPath());\n\n // Add to list of stores already swapped\n if(!useSwappedStoreNames)\n swappedStoreNames.add(storeDef.getName());\n }\n }\n } catch(Exception e) {\n logger.error(\"Error while swapping RO store\");\n throw new VoldemortException(e);\n }\n }"
] |
Set an enterprise number value.
@param index number index (1-40)
@param value number value | [
"public void setEnterpriseNumber(int index, Number value)\n {\n set(selectField(AssignmentFieldLists.ENTERPRISE_NUMBER, index), value);\n }"
] | [
"public void update(Object feature) throws LayerException {\n\t\tSession session = getSessionFactory().getCurrentSession();\n\t\tsession.update(feature);\n\t}",
"@Override\n\tpublic BigInteger getCount() {\n\t\tBigInteger cached = cachedCount;\n\t\tif(cached == null) {\n\t\t\tcachedCount = cached = getCountImpl();\n\t\t}\n\t\treturn cached;\n\t}",
"public int getChunkForKey(byte[] key) throws IllegalStateException {\n if(numChunks == 0) {\n throw new IllegalStateException(\"The ChunkedFileSet is closed.\");\n }\n\n switch(storageFormat) {\n case READONLY_V0: {\n return ReadOnlyUtils.chunk(ByteUtils.md5(key), numChunks);\n }\n case READONLY_V1: {\n if(nodePartitionIds == null) {\n throw new IllegalStateException(\"nodePartitionIds is null.\");\n }\n List<Integer> routingPartitionList = routingStrategy.getPartitionList(key);\n routingPartitionList.retainAll(nodePartitionIds);\n\n if(routingPartitionList.size() != 1) {\n throw new IllegalStateException(\"The key does not belong on this node.\");\n }\n\n return chunkIdToChunkStart.get(routingPartitionList.get(0))\n + ReadOnlyUtils.chunk(ByteUtils.md5(key),\n chunkIdToNumChunks.get(routingPartitionList.get(0)));\n }\n case READONLY_V2: {\n List<Integer> routingPartitionList = routingStrategy.getPartitionList(key);\n\n Pair<Integer, Integer> bucket = null;\n for(int replicaType = 0; replicaType < routingPartitionList.size(); replicaType++) {\n if(nodePartitionIds == null) {\n throw new IllegalStateException(\"nodePartitionIds is null.\");\n }\n if(nodePartitionIds.contains(routingPartitionList.get(replicaType))) {\n if(bucket == null) {\n bucket = Pair.create(routingPartitionList.get(0), replicaType);\n } else {\n throw new IllegalStateException(\"Found more than one replica for a given partition on the current node!\");\n }\n }\n }\n\n if(bucket == null) {\n throw new IllegalStateException(\"The key does not belong on this node.\");\n }\n\n Integer chunkStart = chunkIdToChunkStart.get(bucket);\n\n if (chunkStart == null) {\n throw new IllegalStateException(\"chunkStart is null.\");\n }\n\n return chunkStart + ReadOnlyUtils.chunk(ByteUtils.md5(key), chunkIdToNumChunks.get(bucket));\n }\n default: {\n throw new IllegalStateException(\"Unsupported storageFormat: \" + storageFormat);\n }\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 }",
"public List<Collaborator> listCollaborators(String appName) {\n return connection.execute(new CollabList(appName), apiKey);\n }",
"public static BoxUser.Info createEnterpriseUser(BoxAPIConnection api, String login, String name) {\n return createEnterpriseUser(api, login, name, null);\n }",
"public <T extends Widget & Checkable> boolean addOnCheckChangedListener\n (OnCheckChangedListener listener) {\n final boolean added;\n synchronized (mListeners) {\n added = mListeners.add(listener);\n }\n if (added) {\n List<T> c = getCheckableChildren();\n for (int i = 0; i < c.size(); ++i) {\n listener.onCheckChanged(this, c.get(i), i);\n }\n }\n return added;\n }",
"public static aaagroup_vpntrafficpolicy_binding[] get(nitro_service service, String groupname) throws Exception{\n\t\taaagroup_vpntrafficpolicy_binding obj = new aaagroup_vpntrafficpolicy_binding();\n\t\tobj.set_groupname(groupname);\n\t\taaagroup_vpntrafficpolicy_binding response[] = (aaagroup_vpntrafficpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"private ResultAction getFailedResultAction(Throwable cause) {\n if (currentStage == Stage.MODEL || cancelled || isRollbackOnRuntimeFailure() || isRollbackOnly()\n || (cause != null && !(cause instanceof OperationFailedException))) {\n return ResultAction.ROLLBACK;\n }\n return ResultAction.KEEP;\n }"
] |
Only one boolean param should be true at a time for this function to return the proper results
@param hostName
@param enable
@param disable
@param remove
@param isEnabled
@param exists
@return
@throws Exception | [
"public static boolean changeHost(String hostName,\n boolean enable,\n boolean disable,\n boolean remove,\n boolean isEnabled,\n boolean exists) throws Exception {\n\n // Open the file that is the first\n // command line parameter\n File hostsFile = new File(\"/etc/hosts\");\n FileInputStream fstream = new FileInputStream(\"/etc/hosts\");\n\n File outFile = null;\n BufferedWriter bw = null;\n // only do file output for destructive operations\n if (!exists && !isEnabled) {\n outFile = File.createTempFile(\"HostsEdit\", \".tmp\");\n bw = new BufferedWriter(new FileWriter(outFile));\n System.out.println(\"File name: \" + outFile.getPath());\n }\n\n // Get the object of DataInputStream\n DataInputStream in = new DataInputStream(fstream);\n BufferedReader br = new BufferedReader(new InputStreamReader(in));\n String strLine;\n boolean foundHost = false;\n boolean hostEnabled = false;\n\n\t\t/*\n * Group 1 - possible commented out host entry\n\t\t * Group 2 - destination address\n\t\t * Group 3 - host name\n\t\t * Group 4 - everything else\n\t\t */\n Pattern pattern = Pattern.compile(\"\\\\s*(#?)\\\\s*([^\\\\s]+)\\\\s*([^\\\\s]+)(.*)\");\n while ((strLine = br.readLine()) != null) {\n\n Matcher matcher = pattern.matcher(strLine);\n\n // if there is a match to the pattern and the host name is the same as the one we want to set\n if (matcher.find() &&\n matcher.group(3).toLowerCase().compareTo(hostName.toLowerCase()) == 0) {\n foundHost = true;\n if (remove) {\n // skip this line altogether\n continue;\n } else if (enable) {\n // we will disregard group 2 and just set it to 127.0.0.1\n if (!exists && !isEnabled)\n bw.write(\"127.0.0.1 \" + matcher.group(3) + matcher.group(4));\n } else if (disable) {\n if (!exists && !isEnabled)\n bw.write(\"# \" + matcher.group(2) + \" \" + matcher.group(3) + matcher.group(4));\n } else if (isEnabled && matcher.group(1).compareTo(\"\") == 0) {\n // host exists and there is no # before it\n hostEnabled = true;\n }\n } else {\n // just write the line back out\n if (!exists && !isEnabled)\n bw.write(strLine);\n }\n\n if (!exists && !isEnabled)\n bw.write('\\n');\n }\n\n // if we didn't find the host in the file but need to enable it\n if (!foundHost && enable) {\n // write a new host entry\n if (!exists && !isEnabled)\n bw.write(\"127.0.0.1 \" + hostName + '\\n');\n }\n // Close the input stream\n in.close();\n\n if (!exists && !isEnabled) {\n bw.close();\n outFile.renameTo(hostsFile);\n }\n\n // return false if the host wasn't found\n if (exists && !foundHost)\n return false;\n\n // return false if the host wasn't enabled\n if (isEnabled && !hostEnabled)\n return false;\n\n return true;\n }"
] | [
"private void deliverMasterYieldResponse(int fromPlayer, boolean yielded) {\n for (final MasterHandoffListener listener : getMasterHandoffListeners()) {\n try {\n listener.yieldResponse(fromPlayer, yielded);\n } catch (Throwable t) {\n logger.warn(\"Problem delivering master yield response to listener\", t);\n }\n }\n }",
"public Collection<User> getFavorites(String photoId, int perPage, int page) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n\r\n parameters.put(\"method\", METHOD_GET_FAVORITES);\r\n\r\n parameters.put(\"photo_id\", photoId);\r\n\r\n if (perPage > 0) {\r\n parameters.put(\"per_page\", Integer.toString(perPage));\r\n }\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 List<User> users = new ArrayList<User>();\r\n\r\n Element userRoot = response.getPayload();\r\n NodeList userNodes = userRoot.getElementsByTagName(\"person\");\r\n for (int i = 0; i < userNodes.getLength(); i++) {\r\n Element userElement = (Element) userNodes.item(i);\r\n User user = new User();\r\n user.setId(userElement.getAttribute(\"nsid\"));\r\n user.setUsername(userElement.getAttribute(\"username\"));\r\n user.setFaveDate(userElement.getAttribute(\"favedate\"));\r\n users.add(user);\r\n }\r\n return users;\r\n }",
"public static nsrpcnode[] get(nitro_service service, String ipaddress[]) throws Exception{\n\t\tif (ipaddress !=null && ipaddress.length>0) {\n\t\t\tnsrpcnode response[] = new nsrpcnode[ipaddress.length];\n\t\t\tnsrpcnode obj[] = new nsrpcnode[ipaddress.length];\n\t\t\tfor (int i=0;i<ipaddress.length;i++) {\n\t\t\t\tobj[i] = new nsrpcnode();\n\t\t\t\tobj[i].set_ipaddress(ipaddress[i]);\n\t\t\t\tresponse[i] = (nsrpcnode) 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 void startTrack(final Object... args){\r\n if(isClosed){ return; }\r\n //--Create Record\r\n final int len = args.length == 0 ? 0 : args.length-1;\r\n final Object content = args.length == 0 ? \"\" : args[len];\r\n final Object[] tags = new Object[len];\r\n final StackTraceElement ste = getStackTrace();\r\n final long timestamp = System.currentTimeMillis();\r\n System.arraycopy(args,0,tags,0,len);\r\n //--Create Task\r\n final long threadID = Thread.currentThread().getId();\r\n final Runnable startTrack = new Runnable(){\r\n public void run(){\r\n assert !isThreaded || control.isHeldByCurrentThread();\r\n Record toPass = new Record(content,tags,depth,ste,timestamp);\r\n depth += 1;\r\n titleStack.push(args.length == 0 ? \"\" : args[len].toString());\r\n handlers.process(toPass, MessageType.START_TRACK, depth, toPass.timesstamp);\r\n assert !isThreaded || control.isHeldByCurrentThread();\r\n }\r\n };\r\n //--Run Task\r\n if(isThreaded){\r\n //(case: multithreaded)\r\n long threadId = Thread.currentThread().getId();\r\n attemptThreadControl( threadId, startTrack );\r\n } else {\r\n //(case: no threading)\r\n startTrack.run();\r\n }\r\n }",
"protected int readByte(InputStream is) throws IOException\n {\n byte[] data = new byte[1];\n if (is.read(data) != data.length)\n {\n throw new EOFException();\n }\n\n return (MPPUtility.getByte(data, 0));\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}",
"synchronized boolean doReConnect() throws IOException {\n\n // In case we are still connected, test the connection and see if we can reuse it\n if(connectionManager.isConnected()) {\n try {\n final Future<Long> result = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult();\n result.get(15, TimeUnit.SECONDS); // Hmm, perhaps 15 is already too much\n return true;\n } catch (Exception e) {\n ServerLogger.AS_ROOT_LOGGER.debugf(e, \"failed to ping the host-controller, going to reconnect\");\n }\n // Disconnect - the HC might have closed the connection without us noticing and is asking for a reconnect\n final Connection connection = connectionManager.getConnection();\n StreamUtils.safeClose(connection);\n if(connection != null) {\n try {\n // Wait for the connection to be closed\n connection.awaitClosed();\n } catch (InterruptedException e) {\n throw new InterruptedIOException();\n }\n }\n }\n\n boolean ok = false;\n final Connection connection = connectionManager.connect();\n try {\n // Reconnect to the host-controller\n final ActiveOperation<Boolean, Void> result = channelHandler.executeRequest(new ServerReconnectRequest(), null);\n try {\n boolean inSync = result.getResult().get();\n ok = true;\n reconnectRunner = null;\n return inSync;\n } catch (ExecutionException e) {\n throw new IOException(e);\n } catch (InterruptedException e) {\n throw new InterruptedIOException();\n }\n } finally {\n if(!ok) {\n StreamUtils.safeClose(connection);\n }\n }\n }",
"private int[] convertBatch(int[] batch) {\n int[] conv = new int[batch.length];\n for (int i=0; i<batch.length; i++) {\n conv[i] = sample[batch[i]];\n }\n return conv;\n }",
"private ReferenceDescriptorDef usedByReference(ModelDef modelDef, FieldDescriptorDef fieldDef)\r\n {\r\n String ownerClassName = ((ClassDescriptorDef)fieldDef.getOwner()).getQualifiedName();\r\n ClassDescriptorDef classDef;\r\n ReferenceDescriptorDef refDef;\r\n String targetClassName;\r\n\r\n // only relevant for primarykey fields\r\n if (PropertyHelper.toBoolean(fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_PRIMARYKEY), false))\r\n {\r\n for (Iterator classIt = modelDef.getClasses(); classIt.hasNext();)\r\n {\r\n classDef = (ClassDescriptorDef)classIt.next();\r\n for (Iterator refIt = classDef.getReferences(); refIt.hasNext();)\r\n {\r\n refDef = (ReferenceDescriptorDef)refIt.next();\r\n targetClassName = refDef.getProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF).replace('$', '.');\r\n if (ownerClassName.equals(targetClassName))\r\n {\r\n // the field is a primary key of the class referenced by this reference descriptor\r\n return refDef;\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n }"
] |
Puts value at given column
@param value Will be encoded using UTF-8 | [
"public FluoMutationGenerator put(Column col, CharSequence value) {\n return put(col, value.toString().getBytes(StandardCharsets.UTF_8));\n }"
] | [
"public void originalClass(String template, Properties attributes) throws XDocletException\r\n {\r\n pushCurrentClass(_curClassDef.getOriginalClass());\r\n generate(template);\r\n popCurrentClass();\r\n }",
"private static boolean isValidPropertyClass(final PropertyDescriptor _property) {\n final Class type = _property.getPropertyType();\n return Number.class.isAssignableFrom(type) || type == String.class || Date.class.isAssignableFrom(type) || type == Boolean.class;\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 float getSize(final Axis axis) {\n float size = 0;\n if (mViewPort != null && mViewPort.isClippingEnabled(axis)) {\n size = mViewPort.get(axis);\n } else if (mContainer != null) {\n size = getSizeImpl(axis);\n }\n return size;\n }",
"static InternationalFixedDate create(int prolepticYear, int month, int dayOfMonth) {\n YEAR_RANGE.checkValidValue(prolepticYear, ChronoField.YEAR_OF_ERA);\n MONTH_OF_YEAR_RANGE.checkValidValue(month, ChronoField.MONTH_OF_YEAR);\n DAY_OF_MONTH_RANGE.checkValidValue(dayOfMonth, ChronoField.DAY_OF_MONTH);\n\n if (dayOfMonth == DAYS_IN_LONG_MONTH && month != 6 && month != MONTHS_IN_YEAR) {\n throw new DateTimeException(\"Invalid date: \" + prolepticYear + '/' + month + '/' + dayOfMonth);\n }\n if (month == 6 && dayOfMonth == DAYS_IN_LONG_MONTH && !INSTANCE.isLeapYear(prolepticYear)) {\n throw new DateTimeException(\"Invalid Leap Day as '\" + prolepticYear + \"' is not a leap year\");\n }\n return new InternationalFixedDate(prolepticYear, month, dayOfMonth);\n }",
"String decodeCString(ByteBuf buffer) throws IOException {\n int length = buffer.bytesBefore(BsonConstants.STRING_TERMINATION);\n if (length < 0)\n throw new IOException(\"string termination not found\");\n\n String result = buffer.toString(buffer.readerIndex(), length, StandardCharsets.UTF_8);\n buffer.skipBytes(length + 1);\n return result;\n }",
"static ModelNode createOperation(final ModelNode operationToValidate) {\n PathAddress pa = PathAddress.pathAddress(operationToValidate.require(ModelDescriptionConstants.OP_ADDR));\n PathAddress realmPA = null;\n for (int i = pa.size() - 1; i > 0; i--) {\n PathElement pe = pa.getElement(i);\n if (SECURITY_REALM.equals(pe.getKey())) {\n realmPA = pa.subAddress(0, i + 1);\n break;\n }\n }\n assert realmPA != null : \"operationToValidate did not have an address that included a \" + SECURITY_REALM;\n return Util.getEmptyOperation(\"validate-authentication\", realmPA.toModelNode());\n }",
"private PoolingHttpClientConnectionManager createConnectionMgr() {\n PoolingHttpClientConnectionManager connectionMgr;\n\n // prepare SSLContext\n SSLContext sslContext = buildSslContext();\n ConnectionSocketFactory plainsf = PlainConnectionSocketFactory.getSocketFactory();\n // we allow to disable host name verification against CA certificate,\n // notice: in general this is insecure and should be avoided in production,\n // (this type of configuration is useful for development purposes)\n boolean noHostVerification = false;\n LayeredConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(\n sslContext,\n noHostVerification ? NoopHostnameVerifier.INSTANCE : new DefaultHostnameVerifier()\n );\n Registry<ConnectionSocketFactory> r = RegistryBuilder.<ConnectionSocketFactory>create()\n .register(\"http\", plainsf)\n .register(\"https\", sslsf)\n .build();\n connectionMgr = new PoolingHttpClientConnectionManager(r, null, null,\n null, connectionPoolTimeToLive, TimeUnit.SECONDS);\n\n connectionMgr.setMaxTotal(maxConnectionsTotal);\n connectionMgr.setDefaultMaxPerRoute(maxConnectionsPerRoute);\n HttpHost localhost = new HttpHost(\"localhost\", 80);\n connectionMgr.setMaxPerRoute(new HttpRoute(localhost), maxConnectionsPerRoute);\n return connectionMgr;\n }",
"public static void normalizeF( DMatrixRMaj A ) {\n double val = normF(A);\n\n if( val == 0 )\n return;\n\n int size = A.getNumElements();\n\n for( int i = 0; i < size; i++) {\n A.div(i , val);\n }\n }"
] |
This method retrieves a byte array containing the data at the
given offset in the block. If no data is found at the given offset
this method returns null.
@param offset offset of required data
@return byte array containing required data | [
"public byte[] getByteArray(Integer offset)\n {\n byte[] result = null;\n\n if (offset != null)\n {\n result = m_map.get(offset);\n }\n\n return (result);\n }"
] | [
"public static final void setSize(UIObject o, Rect size) {\n o.setPixelSize(size.w, size.h);\n\n }",
"private void checkObjectCache(ClassDescriptorDef classDef, String checkLevel) throws ConstraintException\r\n {\r\n if (!CHECKLEVEL_STRICT.equals(checkLevel))\r\n {\r\n return;\r\n }\r\n \r\n ObjectCacheDef objCacheDef = classDef.getObjectCache();\r\n\r\n if (objCacheDef == null)\r\n {\r\n return;\r\n }\r\n\r\n String objectCacheName = objCacheDef.getName();\r\n\r\n if ((objectCacheName == null) || (objectCacheName.length() == 0))\r\n {\r\n throw new ConstraintException(\"No class specified for the object-cache of class \"+classDef.getName());\r\n }\r\n\r\n try\r\n {\r\n InheritanceHelper helper = new InheritanceHelper();\r\n\r\n if (!helper.isSameOrSubTypeOf(objectCacheName, OBJECT_CACHE_INTERFACE))\r\n {\r\n throw new ConstraintException(\"The class \"+objectCacheName+\" specified as object-cache of class \"+classDef.getName()+\" does not implement the interface \"+OBJECT_CACHE_INTERFACE);\r\n }\r\n }\r\n catch (ClassNotFoundException ex)\r\n {\r\n throw new ConstraintException(\"Could not find the class \"+ex.getMessage()+\" on the classpath while checking the object-cache class \"+objectCacheName+\" of class \"+classDef.getName());\r\n }\r\n }",
"private List<CmsGitConfiguration> readConfigFiles() {\n\n List<CmsGitConfiguration> configurations = new LinkedList<CmsGitConfiguration>();\n\n // Default configuration file for backwards compatibility\n addConfigurationIfValid(configurations, new File(DEFAULT_CONFIG_FILE));\n\n // All files in the config folder\n File configFolder = new File(DEFAULT_CONFIG_FOLDER);\n if (configFolder.isDirectory()) {\n for (File configFile : configFolder.listFiles()) {\n addConfigurationIfValid(configurations, configFile);\n }\n }\n return configurations;\n }",
"public Task<Void> updateSyncFrequency(@NonNull final SyncFrequency syncFrequency) {\n return this.dispatcher.dispatchTask(new Callable<Void>() {\n @Override\n public Void call() throws Exception {\n SyncImpl.this.proxy.updateSyncFrequency(syncFrequency);\n return null;\n }\n });\n }",
"public void init(final MultivaluedMap<String, String> queryParameters) {\n final String scopeCompileParam = queryParameters.getFirst(ServerAPI.SCOPE_COMPILE_PARAM);\n if(scopeCompileParam != null){\n this.scopeComp = Boolean.valueOf(scopeCompileParam);\n }\n final String scopeProvidedParam = queryParameters.getFirst(ServerAPI.SCOPE_PROVIDED_PARAM);\n if(scopeProvidedParam != null){\n this.scopePro = Boolean.valueOf(scopeProvidedParam);\n }\n final String scopeRuntimeParam = queryParameters.getFirst(ServerAPI.SCOPE_RUNTIME_PARAM);\n if(scopeRuntimeParam != null){\n this.scopeRun = Boolean.valueOf(scopeRuntimeParam);\n }\n final String scopeTestParam = queryParameters.getFirst(ServerAPI.SCOPE_TEST_PARAM);\n if(scopeTestParam != null){\n this.scopeTest = Boolean.valueOf(scopeTestParam);\n }\n }",
"public void onAttach(GVRSceneObject sceneObj)\n {\n super.onAttach(sceneObj);\n GVRComponent comp = getComponent(GVRRenderData.getComponentType());\n\n if (comp == null)\n {\n throw new IllegalStateException(\"Cannot attach a morph to a scene object without a base mesh\");\n }\n\n GVRMesh mesh = ((GVRRenderData) comp).getMesh();\n if (mesh == null)\n {\n throw new IllegalStateException(\"Cannot attach a morph to a scene object without a base mesh\");\n }\n GVRShaderData mtl = getMaterial();\n\n if ((mtl == null) ||\n !mtl.getTextureDescriptor().contains(\"blendshapeTexture\"))\n {\n throw new IllegalStateException(\"Scene object shader does not support morphing\");\n }\n copyBaseShape(mesh.getVertexBuffer());\n mtl.setInt(\"u_numblendshapes\", mNumBlendShapes);\n mtl.setFloatArray(\"u_blendweights\", mWeights);\n }",
"private static List<Node> difference(List<Node> listA, List<Node> listB) {\n if(listA != null && listB != null)\n listA.removeAll(listB);\n return listA;\n }",
"public void addStoreDefinition(StoreDefinition storeDef) {\n // acquire write lock\n writeLock.lock();\n\n try {\n // Check if store already exists\n if(this.storeNames.contains(storeDef.getName())) {\n throw new VoldemortException(\"Store already exists !\");\n }\n\n // Check for backwards compatibility\n StoreDefinitionUtils.validateSchemaAsNeeded(storeDef);\n\n // Otherwise add to the STORES directory\n StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();\n String storeDefStr = mapper.writeStore(storeDef);\n Versioned<String> versionedValueStr = new Versioned<String>(storeDefStr);\n this.storeDefinitionsStorageEngine.put(storeDef.getName(), versionedValueStr, null);\n\n // Update the metadata cache\n this.metadataCache.put(storeDef.getName(), new Versioned<Object>(storeDefStr));\n\n // Re-initialize the store definitions. This is primarily required\n // to re-create the value for key: 'stores.xml'. This is necessary\n // for backwards compatibility.\n initStoreDefinitions(null);\n\n updateRoutingStrategies(getCluster(), getStoreDefList());\n } finally {\n writeLock.unlock();\n }\n }",
"void stop() {\n try {\n dm.stop(getBundleContext());\n } catch (DirectoryMonitoringException e) {\n LOG.error(\"Failed to stop \" + DirectoryMonitor.class.getName() + \" for the directory \" + monitoredDirectory, e);\n }\n declarationsFiles.clear();\n declarationRegistrationManager.unregisterAll();\n }"
] |
Use this API to delete dnsaaaarec resources of given names. | [
"public static base_responses delete(nitro_service client, String hostname[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (hostname != null && hostname.length > 0) {\n\t\t\tdnsaaaarec deleteresources[] = new dnsaaaarec[hostname.length];\n\t\t\tfor (int i=0;i<hostname.length;i++){\n\t\t\t\tdeleteresources[i] = new dnsaaaarec();\n\t\t\t\tdeleteresources[i].hostname = hostname[i];\n\t\t\t}\n\t\t\tresult = delete_bulk_request(client, deleteresources);\n\t\t}\n\t\treturn result;\n\t}"
] | [
"private void performSetupExchange() throws IOException {\n Message setupRequest = new Message(0xfffffffeL, Message.KnownType.SETUP_REQ, new NumberField(posingAsPlayer, 4));\n sendMessage(setupRequest);\n Message response = Message.read(is);\n if (response.knownType != Message.KnownType.MENU_AVAILABLE) {\n throw new IOException(\"Did not receive message type 0x4000 in response to setup message, got: \" + response);\n }\n if (response.arguments.size() != 2) {\n throw new IOException(\"Did not receive two arguments in response to setup message, got: \" + response);\n }\n final Field player = response.arguments.get(1);\n if (!(player instanceof NumberField)) {\n throw new IOException(\"Second argument in response to setup message was not a number: \" + response);\n }\n if (((NumberField)player).getValue() != targetPlayer) {\n throw new IOException(\"Expected to connect to player \" + targetPlayer +\n \", but welcome response identified itself as player \" + ((NumberField)player).getValue());\n }\n }",
"public ExecutionChain setErrorCallback(ErrorCallback callback) {\n if (state.get() == State.RUNNING) {\n throw new IllegalStateException(\n \"Invalid while ExecutionChain is running\");\n }\n errorCallback = callback;\n return this;\n }",
"protected void resize( VariableMatrix mat , int numRows , int numCols ) {\n if( mat.isTemp() ) {\n mat.matrix.reshape(numRows,numCols);\n }\n }",
"public static int cudnnGetRNNDataDescriptor(\n cudnnRNNDataDescriptor RNNDataDesc, \n int[] dataType, \n int[] layout, \n int[] maxSeqLength, \n int[] batchSize, \n int[] vectorSize, \n int arrayLengthRequested, \n int[] seqLengthArray, \n Pointer paddingFill)\n {\n return checkResult(cudnnGetRNNDataDescriptorNative(RNNDataDesc, dataType, layout, maxSeqLength, batchSize, vectorSize, arrayLengthRequested, seqLengthArray, paddingFill));\n }",
"public static String fancyStringF(double value, DecimalFormat format, int length, int significant) {\n\n String formatted = fancyString(value, format, length, significant);\n\n int n = length-formatted.length();\n if( n > 0 ) {\n StringBuilder builder = new StringBuilder(n);\n for (int i = 0; i < n; i++) {\n builder.append(' ');\n }\n return formatted + builder.toString();\n } else {\n return formatted;\n }\n }",
"public static base_response unset(nitro_service client, nsspparams resource, String[] args) throws Exception{\n\t\tnsspparams unsetresource = new nsspparams();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}",
"public static void checkFolderForFile(String fileName) throws IOException {\n\n\t\tif (fileName.lastIndexOf(File.separator) > 0) {\n\t\t\tString folder = fileName.substring(0, fileName.lastIndexOf(File.separator));\n\t\t\tdirectoryCheck(folder);\n\t\t}\n\t}",
"private boolean isTileVisible(final ReferencedEnvelope tileBounds) {\n if (FloatingPointUtil.equals(this.transformer.getRotation(), 0.0)) {\n return true;\n }\n\n final GeometryFactory gfac = new GeometryFactory();\n final Optional<Geometry> rotatedMapBounds = getRotatedMapBounds(gfac);\n\n if (rotatedMapBounds.isPresent()) {\n return rotatedMapBounds.get().intersects(gfac.toGeometry(tileBounds));\n } else {\n // in case of an error, we simply load the tile\n return true;\n }\n }",
"private void reconnectFlows() {\n // create the reverse id map:\n for (Entry<Object, List<String>> entry : _outgoingFlows.entrySet()) {\n for (String flowId : entry.getValue()) {\n if (entry.getKey() instanceof SequenceFlow) { // if it is a sequence flow, we can tell its targets\n if (_idMap.get(flowId) instanceof FlowNode) {\n ((SequenceFlow) entry.getKey()).setTargetRef((FlowNode) _idMap.get(flowId));\n }\n if (_idMap.get(flowId) instanceof Association) {\n ((Association) _idMap.get(flowId)).setTargetRef((SequenceFlow) entry.getKey());\n }\n } else if (entry.getKey() instanceof Association) {\n ((Association) entry.getKey()).setTargetRef((BaseElement) _idMap.get(flowId));\n } else { // if it is a node, we can map it to its outgoing sequence flows\n if (_idMap.get(flowId) instanceof SequenceFlow) {\n ((FlowNode) entry.getKey()).getOutgoing().add((SequenceFlow) _idMap.get(flowId));\n } else if (_idMap.get(flowId) instanceof Association) {\n ((Association) _idMap.get(flowId)).setSourceRef((BaseElement) entry.getKey());\n }\n }\n }\n }\n }"
] |
This method finds the start of the next working period.
@param cal current Calendar instance | [
"private void updateToNextWorkStart(Calendar cal)\n {\n Date originalDate = cal.getTime();\n\n //\n // Find the date ranges for the current day\n //\n ProjectCalendarDateRanges ranges = getRanges(originalDate, cal, null);\n\n if (ranges != null)\n {\n //\n // Do we have a start time today?\n //\n Date calTime = DateHelper.getCanonicalTime(cal.getTime());\n Date startTime = null;\n for (DateRange range : ranges)\n {\n Date rangeStart = DateHelper.getCanonicalTime(range.getStart());\n Date rangeEnd = DateHelper.getCanonicalTime(range.getEnd());\n Date rangeStartDay = DateHelper.getDayStartDate(range.getStart());\n Date rangeEndDay = DateHelper.getDayStartDate(range.getEnd());\n\n if (rangeStartDay.getTime() != rangeEndDay.getTime())\n {\n rangeEnd = DateHelper.addDays(rangeEnd, 1);\n }\n\n if (calTime.getTime() < rangeEnd.getTime())\n {\n if (calTime.getTime() > rangeStart.getTime())\n {\n startTime = calTime;\n }\n else\n {\n startTime = rangeStart;\n }\n break;\n }\n }\n\n //\n // If we don't have a start time today - find the next working day\n // then retrieve the start time.\n //\n if (startTime == null)\n {\n Day day;\n int nonWorkingDayCount = 0;\n do\n {\n cal.set(Calendar.DAY_OF_YEAR, cal.get(Calendar.DAY_OF_YEAR) + 1);\n day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK));\n ++nonWorkingDayCount;\n if (nonWorkingDayCount > MAX_NONWORKING_DAYS)\n {\n cal.setTime(originalDate);\n break;\n }\n }\n while (!isWorkingDate(cal.getTime(), day));\n\n startTime = getStartTime(cal.getTime());\n }\n\n DateHelper.setTime(cal, startTime);\n }\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 static double getDaycount(LocalDate startDate, LocalDate endDate, String convention) {\n\t\tDayCountConventionInterface daycountConvention = getDayCountConvention(convention);\n\t\treturn daycountConvention.getDaycount(startDate, endDate);\n\t}",
"public static double computeHouseholder(double []x , int xStart , int xEnd , double max , DScalar gamma ) {\n double tau = 0;\n for (int i = xStart; i < xEnd ; i++) {\n double val = x[i] /= max;\n tau += val*val;\n }\n tau = Math.sqrt(tau);\n if( x[xStart] < 0 ) {\n tau = -tau;\n }\n double u_0 = x[xStart] + tau;\n gamma.value = u_0/tau;\n x[xStart] = 1;\n for (int i = xStart+1; i < xEnd ; i++) {\n x[i] /= u_0;\n }\n\n return -tau*max;\n }",
"public ProjectCalendarException getException(Date date)\n {\n ProjectCalendarException exception = null;\n\n // We're working with expanded exceptions, which includes any recurring exceptions\n // expanded into individual entries.\n populateExpandedExceptions();\n if (!m_expandedExceptions.isEmpty())\n {\n sortExceptions();\n\n int low = 0;\n int high = m_expandedExceptions.size() - 1;\n long targetDate = date.getTime();\n\n while (low <= high)\n {\n int mid = (low + high) >>> 1;\n ProjectCalendarException midVal = m_expandedExceptions.get(mid);\n int cmp = 0 - DateHelper.compare(midVal.getFromDate(), midVal.getToDate(), targetDate);\n\n if (cmp < 0)\n {\n low = mid + 1;\n }\n else\n {\n if (cmp > 0)\n {\n high = mid - 1;\n }\n else\n {\n exception = midVal;\n break;\n }\n }\n }\n }\n\n if (exception == null && getParent() != null)\n {\n // Check base calendar as well for an exception.\n exception = getParent().getException(date);\n }\n return (exception);\n }",
"private void readTasks(Project project)\n {\n Project.Tasks tasks = project.getTasks();\n if (tasks != null)\n {\n int tasksWithoutIDCount = 0;\n\n for (Project.Tasks.Task task : tasks.getTask())\n {\n Task mpxjTask = readTask(task);\n if (mpxjTask.getID() == null)\n {\n ++tasksWithoutIDCount;\n }\n }\n\n for (Project.Tasks.Task task : tasks.getTask())\n {\n readPredecessors(task);\n }\n\n //\n // MS Project will happily read tasks from an MSPDI file without IDs,\n // it will just generate ID values based on the task order in the file.\n // If we find that there are no ID values present, we'll do the same.\n //\n if (tasksWithoutIDCount == tasks.getTask().size())\n {\n m_projectFile.getTasks().renumberIDs();\n }\n }\n\n m_projectFile.updateStructure();\n }",
"public void fillRectangle(Rectangle rect, Color color) {\n\t\ttemplate.saveState();\n\t\tsetFill(color);\n\t\ttemplate.rectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight());\n\t\ttemplate.fill();\n\t\ttemplate.restoreState();\n\t}",
"public static sslvserver_sslciphersuite_binding[] get(nitro_service service, String vservername) throws Exception{\n\t\tsslvserver_sslciphersuite_binding obj = new sslvserver_sslciphersuite_binding();\n\t\tobj.set_vservername(vservername);\n\t\tsslvserver_sslciphersuite_binding response[] = (sslvserver_sslciphersuite_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"private void addOp(String op, String path, String value) {\n if (this.operations == null) {\n this.operations = new JsonArray();\n }\n\n this.operations.add(new JsonObject()\n .add(\"op\", op)\n .add(\"path\", path)\n .add(\"value\", value));\n }",
"public CollectionRequest<Task> tags(String task) {\n \n String path = String.format(\"/tasks/%s/tags\", task);\n return new CollectionRequest<Task>(this, Task.class, path, \"GET\");\n }"
] |
Determine if the exception is relative based on the recurrence type integer value.
@param value integer value
@return true if the recurrence is relative | [
"private boolean getRelative(int value)\n {\n boolean result;\n if (value < 0 || value >= RELATIVE_MAP.length)\n {\n result = false;\n }\n else\n {\n result = RELATIVE_MAP[value];\n }\n\n return result;\n }"
] | [
"public void addCommandClass(ZWaveCommandClass commandClass)\n\t{\n\t\tZWaveCommandClass.CommandClass key = commandClass.getCommandClass();\n\t\t\n\t\tif (!supportedCommandClasses.containsKey(key)) {\n\t\t\tsupportedCommandClasses.put(key, commandClass);\n\t\t\t\n\t\t\tif (commandClass instanceof ZWaveEventListener)\n\t\t\t\tthis.controller.addEventListener((ZWaveEventListener)commandClass);\n\t\t\t\n\t\t\tthis.lastUpdated = Calendar.getInstance().getTime();\n\t\t}\n\t}",
"@Pure\n\tpublic static <T> Iterable<T> filterNull(Iterable<T> unfiltered) {\n\t\treturn Iterables.filter(unfiltered, Predicates.notNull());\n\t}",
"public void putInWakeUpQueue(SerialMessage serialMessage) {\r\n\t\tif (this.wakeUpQueue.contains(serialMessage)) {\r\n\t\t\tlogger.debug(\"Message already on the wake-up queue for node {}. Discarding.\", this.getNode().getNodeId());\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\t\r\n\t\tlogger.debug(\"Putting message in wakeup queue for node {}.\", this.getNode().getNodeId());\r\n\t\tthis.wakeUpQueue.add(serialMessage);\r\n\t}",
"public String text() {\n String previousText = null;\n StringBuilder buffer = null;\n for (Object child : this) {\n String text = null;\n if (child instanceof String) {\n text = (String) child;\n } else if (child instanceof Node) {\n text = ((Node) child).text();\n }\n if (text != null) {\n if (previousText == null) {\n previousText = text;\n } else {\n if (buffer == null) {\n buffer = new StringBuilder();\n buffer.append(previousText);\n }\n buffer.append(text);\n }\n }\n }\n if (buffer != null) {\n return buffer.toString();\n }\n if (previousText != null) {\n return previousText;\n }\n return \"\";\n }",
"public String getCsv() {\n\n StringWriter writer = new StringWriter();\n try (CSVWriter csv = new CSVWriter(writer)) {\n List<String> headers = new ArrayList<>();\n for (String col : m_columns) {\n headers.add(col);\n }\n csv.writeNext(headers.toArray(new String[] {}));\n for (List<Object> row : m_data) {\n List<String> colCsv = new ArrayList<>();\n for (Object col : row) {\n colCsv.add(String.valueOf(col));\n }\n csv.writeNext(colCsv.toArray(new String[] {}));\n }\n return writer.toString();\n } catch (IOException e) {\n return null;\n }\n }",
"private void writeWorkWeeks(Project.Calendars.Calendar xmlCalendar, ProjectCalendar mpxjCalendar)\n {\n List<ProjectCalendarWeek> weeks = mpxjCalendar.getWorkWeeks();\n if (!weeks.isEmpty())\n {\n WorkWeeks xmlWorkWeeks = m_factory.createProjectCalendarsCalendarWorkWeeks();\n xmlCalendar.setWorkWeeks(xmlWorkWeeks);\n List<WorkWeek> xmlWorkWeekList = xmlWorkWeeks.getWorkWeek();\n\n for (ProjectCalendarWeek week : weeks)\n {\n WorkWeek xmlWeek = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeek();\n xmlWorkWeekList.add(xmlWeek);\n\n xmlWeek.setName(week.getName());\n TimePeriod xmlTimePeriod = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekTimePeriod();\n xmlWeek.setTimePeriod(xmlTimePeriod);\n xmlTimePeriod.setFromDate(week.getDateRange().getStart());\n xmlTimePeriod.setToDate(week.getDateRange().getEnd());\n\n WeekDays xmlWeekDays = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDays();\n xmlWeek.setWeekDays(xmlWeekDays);\n\n List<Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay> dayList = xmlWeekDays.getWeekDay();\n\n for (int loop = 1; loop < 8; loop++)\n {\n DayType workingFlag = week.getWorkingDay(Day.getInstance(loop));\n\n if (workingFlag != DayType.DEFAULT)\n {\n Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay day = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDay();\n dayList.add(day);\n day.setDayType(BigInteger.valueOf(loop));\n day.setDayWorking(Boolean.valueOf(workingFlag == DayType.WORKING));\n\n if (workingFlag == DayType.WORKING)\n {\n Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes times = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDayWorkingTimes();\n day.setWorkingTimes(times);\n List<Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();\n\n ProjectCalendarHours bch = week.getCalendarHours(Day.getInstance(loop));\n if (bch != null)\n {\n for (DateRange range : bch)\n {\n if (range != null)\n {\n Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarWorkWeeksWorkWeekWeekDaysWeekDayWorkingTimesWorkingTime();\n timesList.add(time);\n\n time.setFromTime(range.getStart());\n time.setToTime(range.getEnd());\n }\n }\n }\n }\n }\n }\n }\n }\n }",
"protected int getCenterChild(CacheDataSet cache) {\n if (cache.count() == 0)\n return -1;\n\n int id = cache.getId(0);\n switch (getGravityInternal()) {\n case TOP:\n case LEFT:\n case FRONT:\n case FILL:\n break;\n case BOTTOM:\n case RIGHT:\n case BACK:\n id = cache.getId(cache.count() - 1);\n break;\n case CENTER:\n int i = cache.count() / 2;\n while (i < cache.count() && i >= 0) {\n id = cache.getId(i);\n if (cache.getStartDataOffset(id) <= 0) {\n if (cache.getEndDataOffset(id) >= 0) {\n break;\n } else {\n i++;\n }\n } else {\n i--;\n }\n }\n break;\n default:\n break;\n }\n\n Log.d(LAYOUT, TAG, \"getCenterChild = %d \", id);\n return id;\n }",
"public void forceApply(String conflictResolution) {\n\n URL url = FORCE_METADATA_CASCADE_POLICIES_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, \"POST\");\n JsonObject requestJSON = new JsonObject()\n .add(\"conflict_resolution\", conflictResolution);\n request.setBody(requestJSON.toString());\n request.send();\n }",
"public static base_responses add(nitro_service client, ntpserver resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tntpserver addresources[] = new ntpserver[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new ntpserver();\n\t\t\t\taddresources[i].serverip = resources[i].serverip;\n\t\t\t\taddresources[i].servername = resources[i].servername;\n\t\t\t\taddresources[i].minpoll = resources[i].minpoll;\n\t\t\t\taddresources[i].maxpoll = resources[i].maxpoll;\n\t\t\t\taddresources[i].autokey = resources[i].autokey;\n\t\t\t\taddresources[i].key = resources[i].key;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}"
] |
Use this API to fetch all the snmpoption resources that are configured on netscaler. | [
"public static snmpoption get(nitro_service service) throws Exception{\n\t\tsnmpoption obj = new snmpoption();\n\t\tsnmpoption[] response = (snmpoption[])obj.get_resources(service);\n\t\treturn response[0];\n\t}"
] | [
"static List<List<String>> handleNewLines( List<List<String>> tableModel ) {\n List<List<String>> result = Lists.newArrayListWithExpectedSize( tableModel.size() );\n\n for( List<String> row : tableModel ) {\n if( hasNewline( row ) ) {\n result.addAll( splitRow( row ) );\n } else {\n result.add( row );\n }\n }\n\n return result;\n }",
"public void setValue(String constantValue)\r\n {\r\n this.fieldSource = SOURCE_VALUE;\r\n this.fieldRefName = null;\r\n this.returnedByProcedure = false;\r\n this.constantValue = constantValue;\r\n }",
"@PostConstruct\n\tprotected void checkPluginDependencies() throws GeomajasException {\n\t\tif (\"true\".equals(System.getProperty(\"skipPluginDependencyCheck\"))) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (null == declaredPlugins) {\n\t\t\treturn;\n\t\t}\n\n\t\t// start by going through all plug-ins to build a map of versions for plug-in keys\n\t\t// includes verification that each key is only used once\n\t\tMap<String, String> versions = new HashMap<String, String>();\n\t\tfor (PluginInfo plugin : declaredPlugins.values()) {\n\t\t\tString name = plugin.getVersion().getName();\n\t\t\tString version = plugin.getVersion().getVersion();\n\t\t\t// check for multiple plugin with same name but different versions (duplicates allowed for jar+source dep)\n\t\t\tif (null != version) {\n\t\t\t\tString otherVersion = versions.get(name);\n\t\t\t\tif (null != otherVersion) {\n\t\t\t\t\tif (!version.startsWith(EXPR_START)) {\n\t\t\t\t\t\tif (!otherVersion.startsWith(EXPR_START) && !otherVersion.equals(version)) {\n\t\t\t\t\t\t\tthrow new GeomajasException(ExceptionCode.DEPENDENCY_CHECK_INVALID_DUPLICATE,\n\t\t\t\t\t\t\t\t\tname, version, versions.get(name));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tversions.put(name, version);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tversions.put(name, version);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Check dependencies\n\t\tStringBuilder message = new StringBuilder();\n\t\tString backendVersion = versions.get(\"Geomajas\");\n\t\tfor (PluginInfo plugin : declaredPlugins.values()) {\n\t\t\tString name = plugin.getVersion().getName();\n\t\t\tmessage.append(checkVersion(name, \"Geomajas back-end\", plugin.getBackendVersion(), backendVersion));\n\t\t\tList<PluginVersionInfo> dependencies = plugin.getDependencies();\n\t\t\tif (null != dependencies) {\n\t\t\t\tfor (PluginVersionInfo dependency : plugin.getDependencies()) {\n\t\t\t\t\tString depName = dependency.getName();\n\t\t\t\t\tmessage.append(checkVersion(name, depName, dependency.getVersion(), versions.get(depName)));\n\t\t\t\t}\n\t\t\t}\n\t\t\tdependencies = plugin.getOptionalDependencies();\n\t\t\tif (null != dependencies) {\n\t\t\t\tfor (PluginVersionInfo dependency : dependencies) {\n\t\t\t\t\tString depName = dependency.getName();\n\t\t\t\t\tString availableVersion = versions.get(depName);\n\t\t\t\t\tif (null != availableVersion) {\n\t\t\t\t\t\tmessage.append(checkVersion(name, depName, dependency.getVersion(), versions.get(depName)));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (message.length() > 0) {\n\t\t\tthrow new GeomajasException(ExceptionCode.DEPENDENCY_CHECK_FAILED, message.toString());\n\t\t}\n\n\t\trecorder.record(GROUP, VALUE);\n\t}",
"private void validateFilter(Filter filter) throws IllegalArgumentException {\n switch (filter.getFilterTypeCase()) {\n case COMPOSITE_FILTER:\n for (Filter subFilter : filter.getCompositeFilter().getFiltersList()) {\n validateFilter(subFilter);\n }\n break;\n case PROPERTY_FILTER:\n if (UNSUPPORTED_OPERATORS.contains(filter.getPropertyFilter().getOp())) {\n throw new IllegalArgumentException(\"Query cannot have any inequality filters.\");\n }\n break;\n default:\n throw new IllegalArgumentException(\n \"Unsupported filter type: \" + filter.getFilterTypeCase());\n }\n }",
"public PlacesList<Place> find(String query) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n PlacesList<Place> placesList = new PlacesList<Place>();\r\n parameters.put(\"method\", METHOD_FIND);\r\n\r\n parameters.put(\"query\", query);\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 Element placesElement = response.getPayload();\r\n NodeList placesNodes = placesElement.getElementsByTagName(\"place\");\r\n placesList.setPage(\"1\");\r\n placesList.setPages(\"1\");\r\n placesList.setPerPage(\"\" + placesNodes.getLength());\r\n placesList.setTotal(\"\" + placesNodes.getLength());\r\n for (int i = 0; i < placesNodes.getLength(); i++) {\r\n Element placeElement = (Element) placesNodes.item(i);\r\n placesList.add(parsePlace(placeElement));\r\n }\r\n return placesList;\r\n }",
"final protected void putChar(char c) {\n final int clen = _internalBuffer.length;\n if (clen == _bufferPosition) {\n final char[] next = new char[2 * clen + 1];\n\n System.arraycopy(_internalBuffer, 0, next, 0, _bufferPosition);\n _internalBuffer = next;\n }\n\n _internalBuffer[_bufferPosition++] = c;\n }",
"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}",
"private void processPredecessors(Gantt gantt)\n {\n for (Gantt.Tasks.Task ganttTask : gantt.getTasks().getTask())\n {\n String predecessors = ganttTask.getP();\n if (predecessors != null && !predecessors.isEmpty())\n {\n String wbs = ganttTask.getID();\n Task task = m_taskMap.get(wbs);\n for (String predecessor : predecessors.split(\";\"))\n {\n Task predecessorTask = m_projectFile.getTaskByID(Integer.valueOf(predecessor));\n task.addPredecessor(predecessorTask, RelationType.FINISH_START, ganttTask.getL());\n }\n }\n }\n }",
"private int countCharsStart(final char ch, final boolean allowSpaces)\n {\n int count = 0;\n for (int i = 0; i < this.value.length(); i++)\n {\n final char c = this.value.charAt(i);\n if (c == ' ' && allowSpaces)\n {\n continue;\n }\n if (c == ch)\n {\n count++;\n }\n else\n {\n break;\n }\n }\n return count;\n }"
] |
Cleans a multi-value property key.
@param name Name of the property key
@return The {@link ValidationResult} object containing the key,
and the error code(if any)
<p/>
First calls cleanObjectKey
Known property keys are reserved for multi-value properties, subsequent validation is done for those | [
"ValidationResult cleanMultiValuePropertyKey(String name) {\n ValidationResult vr = cleanObjectKey(name);\n\n name = (String) vr.getObject();\n\n // make sure its not a known property key (reserved in the case of multi-value)\n\n try {\n RestrictedMultiValueFields rf = RestrictedMultiValueFields.valueOf(name);\n //noinspection ConstantConditions\n if (rf != null) {\n vr.setErrorDesc(name + \"... is a restricted key for multi-value properties. Operation aborted.\");\n vr.setErrorCode(523);\n vr.setObject(null);\n }\n } catch (Throwable t) {\n //no-op\n }\n\n return vr;\n }"
] | [
"public static final BigInteger getBigInteger(Number value)\n {\n BigInteger result = null;\n if (value != null)\n {\n if (value instanceof BigInteger)\n {\n result = (BigInteger) value;\n }\n else\n {\n result = BigInteger.valueOf(Math.round(value.doubleValue()));\n }\n }\n return (result);\n }",
"public static TransactionalProtocolClient.PreparedOperation<TransactionalProtocolClient.Operation> executeBlocking(final ModelNode operation, TransactionalProtocolClient client) throws IOException, InterruptedException {\n final BlockingQueueOperationListener<TransactionalProtocolClient.Operation> listener = new BlockingQueueOperationListener<>();\n client.execute(listener, operation, OperationMessageHandler.DISCARD, OperationAttachments.EMPTY);\n return listener.retrievePreparedOperation();\n }",
"public void moveDown(I_CmsEditableGroupRow row) {\n\n int index = m_container.getComponentIndex(row);\n if ((index >= 0) && (index < (m_container.getComponentCount() - 1))) {\n m_container.removeComponent(row);\n m_container.addComponent(row, index + 1);\n }\n updateButtonBars();\n }",
"private static void displayAvailableFilters(ProjectFile project)\n {\n System.out.println(\"Unknown filter name supplied.\");\n System.out.println(\"Available task filters:\");\n for (Filter filter : project.getFilters().getTaskFilters())\n {\n System.out.println(\" \" + filter.getName());\n }\n\n System.out.println(\"Available resource filters:\");\n for (Filter filter : project.getFilters().getResourceFilters())\n {\n System.out.println(\" \" + filter.getName());\n }\n\n }",
"public void addSubmodule(final Module submodule) {\n if (!submodules.contains(submodule)) {\n submodule.setSubmodule(true);\n\n if (promoted) {\n submodule.setPromoted(promoted);\n }\n\n submodules.add(submodule);\n }\n }",
"public static <T> Set<T> toSet(Iterable<T> items) {\r\n Set<T> set = new HashSet<T>();\r\n addAll(set, items);\r\n return set;\r\n }",
"public void writeTo(IIMWriter writer) throws IOException {\r\n\t\tfinal boolean doLog = log != null;\r\n\t\tfor (Iterator<DataSet> i = dataSets.iterator(); i.hasNext();) {\r\n\t\t\tDataSet ds = i.next();\r\n\t\t\twriter.write(ds);\r\n\t\t\tif (doLog) {\r\n\t\t\t\tlog.debug(\"Wrote data set \" + ds);\r\n\t\t\t}\r\n\t\t}\r\n\t}",
"static void logConnectionException(URI uri, DiscoveryOption discoveryOption, boolean moreOptions, Exception e) {\n if (uri == null) {\n HostControllerLogger.ROOT_LOGGER.failedDiscoveringMaster(discoveryOption, e);\n } else {\n HostControllerLogger.ROOT_LOGGER.cannotConnect(uri, e);\n }\n if (!moreOptions) {\n // All discovery options have been exhausted\n HostControllerLogger.ROOT_LOGGER.noDiscoveryOptionsLeft();\n }\n }",
"@SuppressWarnings(\"unchecked\")\n public static Map<String, List<Path>> findJavaHomes() {\n try {\n return (Map<String, List<Path>>) accessible(Class.forName(CAPSULE_CLASS_NAME).getDeclaredMethod(\"getJavaHomes\")).invoke(null);\n } catch (ReflectiveOperationException e) {\n throw new AssertionError(e);\n }\n }"
] |
Append this message to the message set
@param messages message to append
@return the written size and first offset
@throws IOException file write exception | [
"public long[] append(MessageSet messages) throws IOException {\n checkMutable();\n long written = 0L;\n while (written < messages.getSizeInBytes())\n written += messages.writeTo(channel, 0, messages.getSizeInBytes());\n long beforeOffset = setSize.getAndAdd(written);\n return new long[]{written, beforeOffset};\n }"
] | [
"public CRFDatum<List<String>, CRFLabel> makeDatum(List<IN> info, int loc,\r\n edu.stanford.nlp.sequences.FeatureFactory<IN> featureFactory) {\r\n pad.set(AnswerAnnotation.class, flags.backgroundSymbol);\r\n PaddedList<IN> pInfo = new PaddedList<IN>(info, pad);\r\n\r\n ArrayList<List<String>> features = new ArrayList<List<String>>();\r\n\r\n // for (int i = 0; i < windowSize; i++) {\r\n // List featuresC = new ArrayList();\r\n // for (int j = 0; j < FeatureFactory.win[i].length; j++) {\r\n // featuresC.addAll(featureFactory.features(info, loc,\r\n // FeatureFactory.win[i][j]));\r\n // }\r\n // features.add(featuresC);\r\n // }\r\n\r\n Collection<Clique> done = new HashSet<Clique>();\r\n for (int i = 0; i < windowSize; i++) {\r\n List<String> featuresC = new ArrayList<String>();\r\n List<Clique> windowCliques = FeatureFactory.getCliques(i, 0);\r\n windowCliques.removeAll(done);\r\n done.addAll(windowCliques);\r\n for (Clique c : windowCliques) {\r\n featuresC.addAll(featureFactory.getCliqueFeatures(pInfo, loc, c)); //todo useless copy because of typing reasons\r\n }\r\n features.add(featuresC);\r\n }\r\n\r\n int[] labels = new int[windowSize];\r\n\r\n for (int i = 0; i < windowSize; i++) {\r\n String answer = pInfo.get(loc + i - windowSize + 1).get(AnswerAnnotation.class);\r\n labels[i] = classIndex.indexOf(answer);\r\n }\r\n\r\n printFeatureLists(pInfo.get(loc), features);\r\n\r\n CRFDatum<List<String>, CRFLabel> d = new CRFDatum<List<String>, CRFLabel>(features, new CRFLabel(labels));\r\n // System.err.println(d);\r\n return d;\r\n }",
"public static base_response flush(nitro_service client, cacheobject resource) throws Exception {\n\t\tcacheobject flushresource = new cacheobject();\n\t\tflushresource.locator = resource.locator;\n\t\tflushresource.url = resource.url;\n\t\tflushresource.host = resource.host;\n\t\tflushresource.port = resource.port;\n\t\tflushresource.groupname = resource.groupname;\n\t\tflushresource.httpmethod = resource.httpmethod;\n\t\tflushresource.force = resource.force;\n\t\treturn flushresource.perform_operation(client,\"flush\");\n\t}",
"private Renderer createRenderer(T content, ViewGroup parent) {\n int prototypeIndex = getPrototypeIndex(content);\n Renderer renderer = getPrototypeByIndex(prototypeIndex).copy();\n renderer.onCreate(content, layoutInflater, parent);\n return renderer;\n }",
"public static void executeCommand(String[] args) throws IOException {\n\n OptionParser parser = getParser();\n String url = null;\n Boolean confirm = false;\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 AdminParserUtils.checkRequired(options, AdminParserUtils.OPT_URL);\n\n url = (String) options.valueOf(AdminParserUtils.OPT_URL);\n if(options.has(AdminParserUtils.OPT_CONFIRM)) {\n confirm = true;\n }\n\n // print summary\n System.out.println(\"Synchronize metadata versions across all nodes\");\n System.out.println(\"Location:\");\n System.out.println(\" bootstrap url = \" + url);\n System.out.println(\" node = all nodes\");\n\n AdminClient adminClient = AdminToolUtils.getAdminClient(url);\n\n AdminToolUtils.assertServerNotInRebalancingState(adminClient);\n\n Versioned<Properties> versionedProps = mergeAllVersions(adminClient);\n\n printVersions(versionedProps);\n\n // execute command\n if(!AdminToolUtils.askConfirm(confirm,\n \"do you want to synchronize metadata versions to all node\"))\n return;\n\n adminClient.metadataMgmtOps.setMetadataVersion(versionedProps);\n }",
"public static BoxDeveloperEditionAPIConnection getAppUserConnection(String userId, String clientId,\n String clientSecret, JWTEncryptionPreferences encryptionPref, IAccessTokenCache accessTokenCache) {\n\n BoxDeveloperEditionAPIConnection connection = new BoxDeveloperEditionAPIConnection(userId,\n DeveloperEditionEntityType.USER, clientId, clientSecret, encryptionPref, accessTokenCache);\n\n connection.tryRestoreUsingAccessTokenCache();\n\n return connection;\n }",
"@Override\n public Set<String> paramKeys() {\n Set<String> set = new HashSet<String>();\n set.addAll(C.<String>list(request.paramNames()));\n set.addAll(extraParams.keySet());\n set.addAll(bodyParams().keySet());\n set.remove(\"_method\");\n set.remove(\"_body\");\n return set;\n }",
"public void rotateToFaceCamera(final GVRTransform transform) {\n //see http://stackoverflow.com/questions/5782658/extracting-yaw-from-a-quaternion\n final GVRTransform t = getMainCameraRig().getHeadTransform();\n final Quaternionf q = new Quaternionf(0, t.getRotationY(), 0, t.getRotationW()).normalize();\n\n transform.rotateWithPivot(q.w, q.x, q.y, q.z, 0, 0, 0);\n }",
"protected void checkJobTypes(final Map<String, ? extends Class<?>> jobTypes) {\n if (jobTypes == null) {\n throw new IllegalArgumentException(\"jobTypes must not be null\");\n }\n for (final Entry<String, ? extends Class<?>> entry : jobTypes.entrySet()) {\n try {\n checkJobType(entry.getKey(), entry.getValue());\n } catch (IllegalArgumentException iae) {\n throw new IllegalArgumentException(\"jobTypes contained invalid value\", iae);\n }\n }\n }",
"public Collection<Group> search(String text, int perPage, int page) throws FlickrException {\r\n GroupList<Group> groupList = new GroupList<Group>();\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_SEARCH);\r\n\r\n parameters.put(\"text\", text);\r\n\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 = 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 Element groupsElement = response.getPayload();\r\n NodeList groupNodes = groupsElement.getElementsByTagName(\"group\");\r\n groupList.setPage(XMLUtilities.getIntAttribute(groupsElement, \"page\"));\r\n groupList.setPages(XMLUtilities.getIntAttribute(groupsElement, \"pages\"));\r\n groupList.setPerPage(XMLUtilities.getIntAttribute(groupsElement, \"perpage\"));\r\n groupList.setTotal(XMLUtilities.getIntAttribute(groupsElement, \"total\"));\r\n for (int i = 0; i < groupNodes.getLength(); i++) {\r\n Element groupElement = (Element) groupNodes.item(i);\r\n Group group = new Group();\r\n group.setId(groupElement.getAttribute(\"nsid\"));\r\n group.setName(groupElement.getAttribute(\"name\"));\r\n groupList.add(group);\r\n }\r\n return groupList;\r\n }"
] |
Generates timephased actual costs from the assignment's cost value. Used for Cost type Resources.
@return timephased cost | [
"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 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 ArrayList<Duration> segmentBaselineWork(ProjectFile file, List<TimephasedWork> work, TimescaleUnits rangeUnits, ArrayList<DateRange> dateList)\n {\n return segmentWork(file.getBaselineCalendar(), work, rangeUnits, dateList);\n }",
"protected boolean isMultimedia(File file) {\n //noinspection SimplifiableIfStatement\n if (isDir(file)) {\n return false;\n }\n\n String path = file.getPath().toLowerCase();\n for (String ext : MULTIMEDIA_EXTENSIONS) {\n if (path.endsWith(ext)) {\n return true;\n }\n }\n\n return false;\n }",
"@SuppressWarnings(\"unchecked\")\n public void put(String key, Versioned<Object> value) {\n // acquire write lock\n writeLock.lock();\n\n try {\n if(this.storeNames.contains(key) || key.equals(STORES_KEY)) {\n\n // Check for backwards compatibility\n List<StoreDefinition> storeDefinitions = (List<StoreDefinition>) value.getValue();\n StoreDefinitionUtils.validateSchemasAsNeeded(storeDefinitions);\n\n // If the put is on the entire stores.xml key, delete the\n // additional stores which do not exist in the specified\n // stores.xml\n Set<String> storeNamesToDelete = new HashSet<String>();\n for(String storeName: this.storeNames) {\n storeNamesToDelete.add(storeName);\n }\n\n // Add / update the list of store definitions specified in the\n // value\n StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();\n\n // Update the STORES directory and the corresponding entry in\n // metadata cache\n Set<String> specifiedStoreNames = new HashSet<String>();\n for(StoreDefinition storeDef: storeDefinitions) {\n specifiedStoreNames.add(storeDef.getName());\n String storeDefStr = mapper.writeStore(storeDef);\n Versioned<String> versionedValueStr = new Versioned<String>(storeDefStr,\n value.getVersion());\n this.storeDefinitionsStorageEngine.put(storeDef.getName(),\n versionedValueStr,\n \"\");\n\n // Update the metadata cache\n this.metadataCache.put(storeDef.getName(),\n new Versioned<Object>(storeDefStr, value.getVersion()));\n }\n\n if(key.equals(STORES_KEY)) {\n storeNamesToDelete.removeAll(specifiedStoreNames);\n resetStoreDefinitions(storeNamesToDelete);\n }\n\n // Re-initialize the store definitions\n initStoreDefinitions(value.getVersion());\n\n // Update routing strategies\n updateRoutingStrategies(getCluster(), getStoreDefList());\n\n } else if(METADATA_KEYS.contains(key)) {\n // try inserting into inner store first\n putInner(key, convertObjectToString(key, value));\n\n // cache all keys if innerStore put succeeded\n metadataCache.put(key, value);\n\n // do special stuff if needed\n if(CLUSTER_KEY.equals(key)) {\n updateRoutingStrategies((Cluster) value.getValue(), getStoreDefList());\n } else if(NODE_ID_KEY.equals(key)) {\n initNodeId(getNodeIdNoLock());\n } else if(SYSTEM_STORES_KEY.equals(key))\n throw new VoldemortException(\"Cannot overwrite system store definitions\");\n\n } else {\n throw new VoldemortException(\"Unhandled Key:\" + key + \" for MetadataStore put()\");\n }\n } finally {\n writeLock.unlock();\n }\n }",
"public static Cluster swapRandomPartitionsWithinZone(final Cluster nextCandidateCluster,\n final int zoneId) {\n Cluster returnCluster = Cluster.cloneCluster(nextCandidateCluster);\n Random r = new Random();\n\n List<Integer> nodeIdsInZone = new ArrayList<Integer>(nextCandidateCluster.getNodeIdsInZone(zoneId));\n\n if(nodeIdsInZone.size() == 0) {\n return returnCluster;\n }\n\n // Select random stealer node\n int stealerNodeOffset = r.nextInt(nodeIdsInZone.size());\n Integer stealerNodeId = nodeIdsInZone.get(stealerNodeOffset);\n\n // Select random stealer partition\n List<Integer> stealerPartitions = returnCluster.getNodeById(stealerNodeId)\n .getPartitionIds();\n if(stealerPartitions.size() == 0) {\n return nextCandidateCluster;\n }\n int stealerPartitionOffset = r.nextInt(stealerPartitions.size());\n int stealerPartitionId = stealerPartitions.get(stealerPartitionOffset);\n\n // Select random donor node\n List<Integer> donorNodeIds = new ArrayList<Integer>();\n donorNodeIds.addAll(nodeIdsInZone);\n donorNodeIds.remove(stealerNodeId);\n\n if(donorNodeIds.isEmpty()) { // No donor nodes!\n return returnCluster;\n }\n int donorIdOffset = r.nextInt(donorNodeIds.size());\n Integer donorNodeId = donorNodeIds.get(donorIdOffset);\n\n // Select random donor partition\n List<Integer> donorPartitions = returnCluster.getNodeById(donorNodeId).getPartitionIds();\n int donorPartitionOffset = r.nextInt(donorPartitions.size());\n int donorPartitionId = donorPartitions.get(donorPartitionOffset);\n\n return swapPartitions(returnCluster,\n stealerNodeId,\n stealerPartitionId,\n donorNodeId,\n donorPartitionId);\n }",
"public void setConvergence( int maxIterations , double ftol , double gtol ) {\n this.maxIterations = maxIterations;\n this.ftol = ftol;\n this.gtol = gtol;\n }",
"boolean isUserPasswordReset(CmsUser user) {\n\n if (USER_PASSWORD_STATUS.containsKey(user.getId())) { //Check if user was checked before\n if (!USER_PASSWORD_STATUS.get(user.getId()).booleanValue()) { // was false before, false->true is never done without changing map\n return false;\n }\n if (m_checkedUserPasswordReset.contains(user.getId())) { //was true before, true->false happens when user resets password. Only check one time per table load.\n return true; //Set gets flushed on reloading table\n }\n }\n CmsUser currentUser = user;\n if (user.getAdditionalInfo().size() < 3) {\n\n try {\n currentUser = m_cms.readUser(user.getId());\n } catch (CmsException e) {\n LOG.error(\"Can not read user\", e);\n }\n }\n if (currentUser.getAdditionalInfo(CmsUserSettings.ADDITIONAL_INFO_PASSWORD_RESET) != null) {\n USER_PASSWORD_STATUS.put(currentUser.getId(), new Boolean(true));\n m_checkedUserPasswordReset.add(currentUser.getId());\n return true;\n }\n USER_PASSWORD_STATUS.put(currentUser.getId(), new Boolean(false));\n return false;\n }",
"private boolean contentEqualsUnchecked(byte[] bytes, int offset, int len) {\n if (length != len) {\n return false;\n }\n\n return compareToUnchecked(bytes, offset, len) == 0;\n }",
"private void setRequestProps(WbGetEntitiesActionData properties) {\n\t\tStringBuilder builder = new StringBuilder();\n\t\tbuilder.append(\"info|datatype\");\n\t\tif (!this.filter.excludeAllLanguages()) {\n\t\t\tbuilder.append(\"|labels|aliases|descriptions\");\n\t\t}\n\t\tif (!this.filter.excludeAllProperties()) {\n\t\t\tbuilder.append(\"|claims\");\n\t\t}\n\t\tif (!this.filter.excludeAllSiteLinks()) {\n\t\t\tbuilder.append(\"|sitelinks\");\n\t\t}\n\n\t\tproperties.props = builder.toString();\n\t}"
] |
Recover log up to the last complete entry. Truncate off any bytes from any incomplete
messages written
@throws IOException any exception | [
"private long recover() throws IOException {\n checkMutable();\n long len = channel.size();\n ByteBuffer buffer = ByteBuffer.allocate(4);\n long validUpTo = 0;\n long next = 0L;\n do {\n next = validateMessage(channel, validUpTo, len, buffer);\n if (next >= 0) validUpTo = next;\n } while (next >= 0);\n channel.truncate(validUpTo);\n setSize.set(validUpTo);\n setHighWaterMark.set(validUpTo);\n logger.info(\"recover high water mark:\" + highWaterMark());\n /* This should not be necessary, but fixes bug 6191269 on some OSs. */\n channel.position(validUpTo);\n needRecover.set(false);\n return len - validUpTo;\n }"
] | [
"@SuppressWarnings({\"unused\", \"WeakerAccess\"})\n public void pushEvent(String eventName) {\n if (eventName == null || eventName.trim().equals(\"\"))\n return;\n\n pushEvent(eventName, null);\n }",
"public static boolean isFloat(CharSequence self) {\n try {\n Float.valueOf(self.toString().trim());\n return true;\n } catch (NumberFormatException nfe) {\n return false;\n }\n }",
"public static List<String> toList(CharSequence self) {\n String s = self.toString();\n int size = s.length();\n List<String> answer = new ArrayList<String>(size);\n for (int i = 0; i < size; i++) {\n answer.add(s.substring(i, i + 1));\n }\n return answer;\n }",
"public void run(Configuration configuration, InjectableStepsFactory stepsFactory, Story story, MetaFilter filter,\n State beforeStories) throws Throwable {\n RunContext context = new RunContext(configuration, stepsFactory, story.getPath(), filter);\n if (beforeStories != null) {\n context.stateIs(beforeStories);\n }\n Map<String, String> storyParameters = new HashMap<>();\n run(context, story, storyParameters);\n }",
"private int[] readTypeAnnotations(final MethodVisitor mv,\n final Context context, int u, boolean visible) {\n char[] c = context.buffer;\n int[] offsets = new int[readUnsignedShort(u)];\n u += 2;\n for (int i = 0; i < offsets.length; ++i) {\n offsets[i] = u;\n int target = readInt(u);\n switch (target >>> 24) {\n case 0x00: // CLASS_TYPE_PARAMETER\n case 0x01: // METHOD_TYPE_PARAMETER\n case 0x16: // METHOD_FORMAL_PARAMETER\n u += 2;\n break;\n case 0x13: // FIELD\n case 0x14: // METHOD_RETURN\n case 0x15: // METHOD_RECEIVER\n u += 1;\n break;\n case 0x40: // LOCAL_VARIABLE\n case 0x41: // RESOURCE_VARIABLE\n for (int j = readUnsignedShort(u + 1); j > 0; --j) {\n int start = readUnsignedShort(u + 3);\n int length = readUnsignedShort(u + 5);\n createLabel(start, context.labels);\n createLabel(start + length, context.labels);\n u += 6;\n }\n u += 3;\n break;\n case 0x47: // CAST\n case 0x48: // CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT\n case 0x49: // METHOD_INVOCATION_TYPE_ARGUMENT\n case 0x4A: // CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT\n case 0x4B: // METHOD_REFERENCE_TYPE_ARGUMENT\n u += 4;\n break;\n // case 0x10: // CLASS_EXTENDS\n // case 0x11: // CLASS_TYPE_PARAMETER_BOUND\n // case 0x12: // METHOD_TYPE_PARAMETER_BOUND\n // case 0x17: // THROWS\n // case 0x42: // EXCEPTION_PARAMETER\n // case 0x43: // INSTANCEOF\n // case 0x44: // NEW\n // case 0x45: // CONSTRUCTOR_REFERENCE\n // case 0x46: // METHOD_REFERENCE\n default:\n u += 3;\n break;\n }\n int pathLength = readByte(u);\n if ((target >>> 24) == 0x42) {\n TypePath path = pathLength == 0 ? null : new TypePath(b, u);\n u += 1 + 2 * pathLength;\n u = readAnnotationValues(u + 2, c, true,\n mv.visitTryCatchAnnotation(target, path,\n readUTF8(u, c), visible));\n } else {\n u = readAnnotationValues(u + 3 + 2 * pathLength, c, true, null);\n }\n }\n return offsets;\n }",
"public void copy(ProjectCalendar cal)\n {\n setName(cal.getName());\n setParent(cal.getParent());\n System.arraycopy(cal.getDays(), 0, getDays(), 0, getDays().length);\n for (ProjectCalendarException ex : cal.m_exceptions)\n {\n addCalendarException(ex.getFromDate(), ex.getToDate());\n for (DateRange range : ex)\n {\n ex.addRange(new DateRange(range.getStart(), range.getEnd()));\n }\n }\n\n for (ProjectCalendarHours hours : getHours())\n {\n if (hours != null)\n {\n ProjectCalendarHours copyHours = cal.addCalendarHours(hours.getDay());\n for (DateRange range : hours)\n {\n copyHours.addRange(new DateRange(range.getStart(), range.getEnd()));\n }\n }\n }\n }",
"public static Artifact createArtifact(final String groupId, final String artifactId, final String version, final String classifier, final String type, final String extension, final String origin){\n\t\tfinal Artifact artifact = new Artifact();\n\n\t\tartifact.setGroupId(groupId);\n\t\tartifact.setArtifactId(artifactId);\n\t\tartifact.setVersion(version);\n\n\t\tif(classifier != null){\n\t\t\tartifact.setClassifier(classifier);\n\t\t}\n\n\t\tif(type != null){\n\t\t\tartifact.setType(type);\n\t\t}\n\n\t\tif(extension != null){\n\t\t\tartifact.setExtension(extension);\n\t\t}\n\n\t\tartifact.setOrigin(origin == null ? \"maven\" : origin);\n\n\t\treturn artifact;\n\t}",
"private boolean isRecyclable(View convertView, T content) {\n boolean isRecyclable = false;\n if (convertView != null && convertView.getTag() != null) {\n Class prototypeClass = getPrototypeClass(content);\n validatePrototypeClass(prototypeClass);\n isRecyclable = prototypeClass.equals(convertView.getTag().getClass());\n }\n return isRecyclable;\n }",
"public static List<String> getDefaultConversionProviderChain(){\n List<String> defaultChain = getMonetaryConversionsSpi()\n .getDefaultProviderChain();\n Objects.requireNonNull(defaultChain, \"No default provider chain provided by SPI: \" +\n getMonetaryConversionsSpi().getClass().getName());\n return defaultChain;\n }"
] |
Detects if the current device is a mobile device.
This method catches most of the popular modern devices.
Excludes Apple iPads and other modern tablets.
@return detection of any mobile device using the quicker method | [
"public boolean detectMobileQuick() {\r\n\r\n //Let's exclude tablets\r\n if (isTierTablet) {\r\n return false;\r\n }\r\n //Most mobile browsing is done on smartphones\r\n if (detectSmartphone()) {\r\n return true;\r\n }\r\n\r\n //Catch-all for many mobile devices\r\n if (userAgent.indexOf(mobile) != -1) {\r\n return true;\r\n }\r\n\r\n if (detectOperaMobile()) {\r\n return true;\r\n }\r\n\r\n //We also look for Kindle devices\r\n if (detectKindle() || detectAmazonSilk()) {\r\n return true;\r\n }\r\n\r\n if (detectWapWml() || detectMidpCapable() || detectBrewDevice()) {\r\n return true;\r\n }\r\n\r\n if ((userAgent.indexOf(engineNetfront) != -1) || (userAgent.indexOf(engineUpBrowser) != -1)) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }"
] | [
"public static List<Expression> getVariableExpressions(DeclarationExpression declarationExpression) {\r\n Expression leftExpression = declarationExpression.getLeftExpression();\r\n\r\n // !important: performance enhancement\r\n if (leftExpression instanceof ArrayExpression) {\r\n List<Expression> expressions = ((ArrayExpression) leftExpression).getExpressions();\r\n return expressions.isEmpty() ? Arrays.asList(leftExpression) : expressions;\r\n } else if (leftExpression instanceof ListExpression) {\r\n List<Expression> expressions = ((ListExpression) leftExpression).getExpressions();\r\n return expressions.isEmpty() ? Arrays.asList(leftExpression) : expressions;\r\n } else if (leftExpression instanceof TupleExpression) {\r\n List<Expression> expressions = ((TupleExpression) leftExpression).getExpressions();\r\n return expressions.isEmpty() ? Arrays.asList(leftExpression) : expressions;\r\n } else if (leftExpression instanceof VariableExpression) {\r\n return Arrays.asList(leftExpression);\r\n }\r\n // todo: write warning\r\n return Collections.emptyList();\r\n }",
"public Set<? extends AbstractBean<?, ?>> resolveSpecializedBeans(Bean<?> specializingBean) {\n if (specializingBean instanceof AbstractClassBean<?>) {\n AbstractClassBean<?> abstractClassBean = (AbstractClassBean<?>) specializingBean;\n if (abstractClassBean.isSpecializing()) {\n return specializedBeans.getValue(specializingBean);\n }\n }\n if (specializingBean instanceof ProducerMethod<?, ?>) {\n ProducerMethod<?, ?> producerMethod = (ProducerMethod<?, ?>) specializingBean;\n if (producerMethod.isSpecializing()) {\n return specializedBeans.getValue(specializingBean);\n }\n }\n return Collections.emptySet();\n }",
"public static Object instantiate(Class clazz) throws InstantiationException\r\n {\r\n Object result = null;\r\n try\r\n {\r\n result = ClassHelper.newInstance(clazz);\r\n }\r\n catch(IllegalAccessException e)\r\n {\r\n try\r\n {\r\n 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 }",
"public void animate(float animationTime, Matrix4f mat)\n {\n mRotInterpolator.animate(animationTime, mRotKey);\n mPosInterpolator.animate(animationTime, mPosKey);\n mSclInterpolator.animate(animationTime, mScaleKey);\n mat.translationRotateScale(mPosKey[0], mPosKey[1], mPosKey[2], mRotKey[0], mRotKey[1], mRotKey[2], mRotKey[3], mScaleKey[0], mScaleKey[1], mScaleKey[2]);\n\n }",
"public static String getArtifactoryPluginVersion() {\n String pluginsSortName = \"artifactory\";\n //Validates Jenkins existence because in some jobs the Jenkins instance is unreachable\n if (Jenkins.getInstance() != null\n && Jenkins.getInstance().getPlugin(pluginsSortName) != null\n && Jenkins.getInstance().getPlugin(pluginsSortName).getWrapper() != null) {\n return Jenkins.getInstance().getPlugin(pluginsSortName).getWrapper().getVersion();\n }\n return \"\";\n }",
"public void replaceItem(@NonNull final T oldObject, @NonNull final T newObject) {\n synchronized (mLock) {\n final int position = getPosition(oldObject);\n if (position == -1) {\n // not found, don't replace\n return;\n }\n\n mObjects.remove(position);\n mObjects.add(position, newObject);\n\n if (isItemTheSame(oldObject, newObject)) {\n if (isContentTheSame(oldObject, newObject)) {\n // visible content hasn't changed, don't notify\n return;\n }\n\n // item with same stable id has changed\n notifyItemChanged(position, newObject);\n } else {\n // item replaced with another one with a different id\n notifyItemRemoved(position);\n notifyItemInserted(position);\n }\n }\n }",
"public static List<String> getBuildNumbersNotToBeDeleted(Run build) {\n List<String> notToDelete = Lists.newArrayList();\n List<? extends Run<?, ?>> builds = build.getParent().getBuilds();\n for (Run<?, ?> run : builds) {\n if (run.isKeepLog()) {\n notToDelete.add(String.valueOf(run.getNumber()));\n }\n }\n return notToDelete;\n }",
"protected void setupPivotInfo() {\n for( int col = 0; col < numCols; col++ ) {\n pivots[col] = col;\n double c[] = dataQR[col];\n double norm = 0;\n for( int row = 0; row < numRows; row++ ) {\n double element = c[row];\n norm += element*element;\n }\n normsCol[col] = norm;\n }\n }",
"public static List<String> getStoreNames(List<StoreDefinition> storeDefList) {\n List<String> storeList = new ArrayList<String>();\n for(StoreDefinition def: storeDefList) {\n storeList.add(def.getName());\n }\n return storeList;\n }"
] |
Construct a new simple attachment key.
@param valueClass the value class
@param <T> the attachment type
@return the new instance | [
"@SuppressWarnings(\"unchecked\")\n public static <T> AttachmentKey<T> create(final Class<? super T> valueClass) {\n return new SimpleAttachmentKey(valueClass);\n }"
] | [
"private List<T> computePagedList(List<T> result, HeaderAndBody httpResponse, JSONObject where, Pipe<T> requestingPipe) {\n ReadFilter previousRead = null;\n ReadFilter nextRead = null;\n\n if (PageConfig.MetadataLocations.WEB_LINKING.equals(pageConfig.getMetadataLocation())) {\n String webLinksRaw = \"\";\n final String relHeader = \"rel\";\n final String nextIdentifier = pageConfig.getNextIdentifier();\n final String prevIdentifier = pageConfig.getPreviousIdentifier();\n try {\n webLinksRaw = getWebLinkHeader(httpResponse);\n if (webLinksRaw == null) { // no paging, return result\n return result;\n }\n List<WebLink> webLinksParsed = WebLinkParser.parse(webLinksRaw);\n for (WebLink link : webLinksParsed) {\n if (nextIdentifier.equals(link.getParameters().get(relHeader))) {\n nextRead = new ReadFilter();\n nextRead.setLinkUri(new URI(link.getUri()));\n } else if (prevIdentifier.equals(link.getParameters().get(relHeader))) {\n previousRead = new ReadFilter();\n previousRead.setLinkUri(new URI(link.getUri()));\n }\n\n }\n } catch (URISyntaxException ex) {\n Log.e(TAG, webLinksRaw + \" did not contain a valid context URI\", ex);\n throw new RuntimeException(ex);\n } catch (ParseException ex) {\n Log.e(TAG, webLinksRaw + \" could not be parsed as a web link header\", ex);\n throw new RuntimeException(ex);\n }\n } else if (pageConfig.getMetadataLocation().equals(PageConfig.MetadataLocations.HEADERS)) {\n nextRead = pageConfig.getPageParameterExtractor().getNextFilter(httpResponse, RestAdapter.this.pageConfig);\n previousRead = pageConfig.getPageParameterExtractor().getPreviousFilter(httpResponse, RestAdapter.this.pageConfig);\n } else if (pageConfig.getMetadataLocation().equals(PageConfig.MetadataLocations.BODY)) {\n nextRead = pageConfig.getPageParameterExtractor().getNextFilter(httpResponse, RestAdapter.this.pageConfig);\n previousRead = pageConfig.getPageParameterExtractor().getPreviousFilter(httpResponse, RestAdapter.this.pageConfig);\n } else {\n throw new IllegalStateException(\"Not supported\");\n }\n if (nextRead != null) {\n nextRead.setWhere(where);\n }\n\n if (previousRead != null) {\n previousRead.setWhere(where);\n }\n\n return new WrappingPagedList<T>(requestingPipe, result, nextRead, previousRead);\n }",
"public static void checkMinimumArrayLength(String parameterName,\n int actualLength, int minimumLength) {\n if (actualLength < minimumLength) {\n throw Exceptions\n .IllegalArgument(\n \"Array %s should have at least %d elements, but it only has %d\",\n parameterName, minimumLength, actualLength);\n }\n }",
"protected void updateNorms( int j ) {\n boolean foundNegative = false;\n for( int col = j; col < numCols; col++ ) {\n double e = dataQR[col][j-1];\n double v = normsCol[col] -= e*e;\n\n if( v < 0 ) {\n foundNegative = true;\n break;\n }\n }\n\n // if a negative sum has been found then clearly too much precision has been lost\n // and it should recompute the column norms from scratch\n if( foundNegative ) {\n for( int col = j; col < numCols; col++ ) {\n double u[] = dataQR[col];\n double actual = 0;\n for( int i=j; i < numRows; i++ ) {\n double v = u[i];\n actual += v*v;\n }\n normsCol[col] = actual;\n }\n }\n }",
"public static authenticationradiusaction get(nitro_service service, String name) throws Exception{\n\t\tauthenticationradiusaction obj = new authenticationradiusaction();\n\t\tobj.set_name(name);\n\t\tauthenticationradiusaction response = (authenticationradiusaction) obj.get_resource(service);\n\t\treturn response;\n\t}",
"public List<String> getMultiSelect(String path) {\n List<String> values = new ArrayList<String>();\n for (JsonValue val : this.getValue(path).asArray()) {\n values.add(val.asString());\n }\n\n return values;\n }",
"public Set<CoreDocumentSynchronizationConfig> getSynchronizedDocuments(\n final MongoNamespace namespace\n ) {\n this.waitUntilInitialized();\n try {\n ongoingOperationsGroup.enter();\n return this.syncConfig.getSynchronizedDocuments(namespace);\n } finally {\n ongoingOperationsGroup.exit();\n }\n }",
"public static <T> Set<T> toSet(Iterator<? extends T> iterator) {\n\t\treturn Sets.newLinkedHashSet(toIterable(iterator));\n\t}",
"@Override\n public JulianDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {\n return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);\n }",
"private void addHours(MpxjTreeNode parentNode, ProjectCalendarDateRanges hours)\n {\n for (DateRange range : hours)\n {\n final DateRange r = range;\n MpxjTreeNode rangeNode = new MpxjTreeNode(range)\n {\n @Override public String toString()\n {\n return m_timeFormat.format(r.getStart()) + \" - \" + m_timeFormat.format(r.getEnd());\n }\n };\n parentNode.add(rangeNode);\n }\n }"
] |
Get the class name without the package
@param c The class name with package
@return the class name without the package | [
"public static String getClassName(Class<?> c) {\n String name = c.getName();\n return name.substring(name.lastIndexOf('.') + 1, name.length());\n }"
] | [
"private File buildDirPath(final String serverConfigUserDirPropertyName, final String suppliedConfigDir,\n final String serverConfigDirPropertyName, final String serverBaseDirPropertyName, final String defaultBaseDir) {\n String propertyDir = System.getProperty(serverConfigUserDirPropertyName);\n if (propertyDir != null) {\n return new File(propertyDir);\n }\n if (suppliedConfigDir != null) {\n return new File(suppliedConfigDir);\n }\n propertyDir = System.getProperty(serverConfigDirPropertyName);\n if (propertyDir != null) {\n return new File(propertyDir);\n }\n\n propertyDir = System.getProperty(serverBaseDirPropertyName);\n if (propertyDir != null) {\n return new File(propertyDir);\n }\n\n return new File(new File(stateValues.getOptions().getJBossHome(), defaultBaseDir), \"configuration\");\n }",
"public CmsMessageContainer validateWithMessage() {\n\n if (m_parsingFailed) {\n return Messages.get().container(Messages.ERR_SERIALDATE_INVALID_VALUE_0);\n }\n if (!isStartSet()) {\n return Messages.get().container(Messages.ERR_SERIALDATE_START_MISSING_0);\n }\n if (!isEndValid()) {\n return Messages.get().container(Messages.ERR_SERIALDATE_END_BEFORE_START_0);\n }\n String key = validatePattern();\n if (null != key) {\n return Messages.get().container(key);\n }\n key = validateDuration();\n if (null != key) {\n return Messages.get().container(key);\n }\n if (hasTooManyEvents()) {\n return Messages.get().container(\n Messages.ERR_SERIALDATE_TOO_MANY_EVENTS_1,\n Integer.valueOf(CmsSerialDateUtil.getMaxEvents()));\n }\n return null;\n }",
"private void addAnnotationValues(ClassReference annotatedReference, AnnotationClassReference typeRef, Annotation node)\n {\n Map<String, AnnotationValue> annotationValueMap = new HashMap<>();\n if (node instanceof SingleMemberAnnotation)\n {\n SingleMemberAnnotation singleMemberAnnotation = (SingleMemberAnnotation) node;\n AnnotationValue value = getAnnotationValueForExpression(annotatedReference, singleMemberAnnotation.getValue());\n annotationValueMap.put(\"value\", value);\n }\n else if (node instanceof NormalAnnotation)\n {\n @SuppressWarnings(\"unchecked\")\n List<MemberValuePair> annotationValues = ((NormalAnnotation) node).values();\n for (MemberValuePair annotationValue : annotationValues)\n {\n String key = annotationValue.getName().toString();\n Expression expression = annotationValue.getValue();\n AnnotationValue value = getAnnotationValueForExpression(annotatedReference, expression);\n annotationValueMap.put(key, value);\n }\n }\n typeRef.setAnnotationValues(annotationValueMap);\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 void populateResourceAssignment(Record record, ResourceAssignment assignment) throws MPXJException\n {\n //\n // Handle malformed MPX files - ensure that we can locate the resource\n // using either the Unique ID attribute or the ID attribute.\n //\n Resource resource = m_projectFile.getResourceByUniqueID(record.getInteger(12));\n if (resource == null)\n {\n resource = m_projectFile.getResourceByID(record.getInteger(0));\n }\n\n assignment.setUnits(record.getUnits(1));\n assignment.setWork(record.getDuration(2));\n assignment.setBaselineWork(record.getDuration(3));\n assignment.setActualWork(record.getDuration(4));\n assignment.setOvertimeWork(record.getDuration(5));\n assignment.setCost(record.getCurrency(6));\n assignment.setBaselineCost(record.getCurrency(7));\n assignment.setActualCost(record.getCurrency(8));\n assignment.setStart(record.getDateTime(9));\n assignment.setFinish(record.getDateTime(10));\n assignment.setDelay(record.getDuration(11));\n\n //\n // Calculate the remaining work\n //\n Duration work = assignment.getWork();\n Duration actualWork = assignment.getActualWork();\n if (work != null && actualWork != null)\n {\n if (work.getUnits() != actualWork.getUnits())\n {\n actualWork = actualWork.convertUnits(work.getUnits(), m_projectFile.getProjectProperties());\n }\n\n assignment.setRemainingWork(Duration.getInstance(work.getDuration() - actualWork.getDuration(), work.getUnits()));\n }\n\n if (resource != null)\n {\n assignment.setResourceUniqueID(resource.getUniqueID());\n resource.addResourceAssignment(assignment);\n }\n\n m_eventManager.fireAssignmentReadEvent(assignment);\n }",
"protected void setupPivotInfo() {\n for( int col = 0; col < numCols; col++ ) {\n pivots[col] = col;\n double c[] = dataQR[col];\n double norm = 0;\n for( int row = 0; row < numRows; row++ ) {\n double element = c[row];\n norm += element*element;\n }\n normsCol[col] = norm;\n }\n }",
"public List<BindingInfo> getQueueBindings(String vhost, String queue) {\n final URI uri = uriWithPath(\"./queues/\" + encodePathSegment(vhost) +\n \"/\" + encodePathSegment(queue) + \"/bindings\");\n final BindingInfo[] result = this.rt.getForObject(uri, BindingInfo[].class);\n return asListOrNull(result);\n }",
"public static void isManagementResourceRemoveable(OperationContext context, PathAddress otherManagementEndpoint) throws OperationFailedException {\n ModelNode remotingConnector;\n try {\n remotingConnector = context.readResourceFromRoot(\n PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, \"jmx\"), PathElement.pathElement(\"remoting-connector\", \"jmx\")), false).getModel();\n } catch (Resource.NoSuchResourceException ex) {\n return;\n }\n if (!remotingConnector.hasDefined(USE_MGMT_ENDPOINT) ||\n (remotingConnector.hasDefined(USE_MGMT_ENDPOINT) && context.resolveExpressions(remotingConnector.get(USE_MGMT_ENDPOINT)).asBoolean(true))) {\n try {\n context.readResourceFromRoot(otherManagementEndpoint, false);\n } catch (NoSuchElementException ex) {\n throw RemotingLogger.ROOT_LOGGER.couldNotRemoveResource(context.getCurrentAddress());\n }\n }\n }",
"public static Thread addShutdownHook(final Process process) {\n final Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n if (process != null) {\n process.destroy();\n try {\n process.waitFor();\n } catch (InterruptedException e) {\n throw new RuntimeException(e);\n }\n }\n }\n });\n thread.setDaemon(true);\n Runtime.getRuntime().addShutdownHook(thread);\n return thread;\n }"
] |
Get Rule
Get a rule using the Rule ID
@param ruleId Rule ID. (required)
@return RuleEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"public RuleEnvelope getRule(String ruleId) throws ApiException {\n ApiResponse<RuleEnvelope> resp = getRuleWithHttpInfo(ruleId);\n return resp.getData();\n }"
] | [
"public static <IN> PaddedList<IN> valueOf(List<IN> list, IN padding) {\r\n return new PaddedList<IN>(list, padding);\r\n }",
"private static XMLStreamException unexpectedElement(final XMLStreamReader reader) {\n return SecurityManagerLogger.ROOT_LOGGER.unexpectedElement(reader.getName(), reader.getLocation());\n }",
"public void checkVersion(ZWaveCommandClass commandClass) {\r\n\t\tZWaveVersionCommandClass versionCommandClass = (ZWaveVersionCommandClass)this.getNode().getCommandClass(CommandClass.VERSION);\r\n\t\t\r\n\t\tif (versionCommandClass == null) {\r\n\t\t\tlogger.error(String.format(\"Version command class not supported on node %d,\" +\r\n\t\t\t\t\t\"reverting to version 1 for command class %s (0x%02x)\", \r\n\t\t\t\t\tthis.getNode().getNodeId(), \r\n\t\t\t\t\tcommandClass.getCommandClass().getLabel(), \r\n\t\t\t\t\tcommandClass.getCommandClass().getKey()));\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tthis.getController().sendData(versionCommandClass.getCommandClassVersionMessage(commandClass.getCommandClass()));\r\n\t}",
"public synchronized Message menuRequestTyped(Message.KnownType requestType, Message.MenuIdentifier targetMenu,\n CdjStatus.TrackSourceSlot slot, CdjStatus.TrackType trackType, Field... arguments)\n throws IOException {\n\n if (!menuLock.isHeldByCurrentThread()) {\n throw new IllegalStateException(\"renderMenuItems() cannot be called without first successfully calling tryLockingForMenuOperation()\");\n }\n\n Field[] combinedArguments = new Field[arguments.length + 1];\n combinedArguments[0] = buildRMST(targetMenu, slot, trackType);\n System.arraycopy(arguments, 0, combinedArguments, 1, arguments.length);\n final Message response = simpleRequest(requestType, Message.KnownType.MENU_AVAILABLE, combinedArguments);\n final NumberField reportedRequestType = (NumberField)response.arguments.get(0);\n if (reportedRequestType.getValue() != requestType.protocolValue) {\n throw new IOException(\"Menu request did not return result for same type as request; sent type: \" +\n requestType.protocolValue + \", received type: \" + reportedRequestType.getValue() +\n \", response: \" + response);\n }\n return response;\n }",
"public static String getOutputValueName(\n @Nullable final String outputPrefix,\n @Nonnull final Map<String, String> outputMapper,\n @Nonnull final Field field) {\n String name = outputMapper.get(field.getName());\n if (name == null) {\n name = field.getName();\n if (!StringUtils.isEmpty(outputPrefix) && !outputPrefix.trim().isEmpty()) {\n name = outputPrefix.trim() + Character.toUpperCase(name.charAt(0)) + name.substring(1);\n }\n }\n\n return name;\n }",
"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}",
"private void readResources(Project ganttProject)\n {\n Resources resources = ganttProject.getResources();\n readResourceCustomPropertyDefinitions(resources);\n readRoleDefinitions(ganttProject);\n\n for (net.sf.mpxj.ganttproject.schema.Resource gpResource : resources.getResource())\n {\n readResource(gpResource);\n }\n }",
"protected void updateStyle(BoxStyle bstyle, TextPosition text)\n {\n String font = text.getFont().getName();\n String family = null;\n String weight = null;\n String fstyle = null;\n\n bstyle.setFontSize(text.getFontSizeInPt());\n bstyle.setLineHeight(text.getHeight());\n\n if (font != null)\n {\n \t//font style and weight\n for (int i = 0; i < pdFontType.length; i++)\n {\n if (font.toLowerCase().lastIndexOf(pdFontType[i]) >= 0)\n {\n weight = cssFontWeight[i];\n fstyle = cssFontStyle[i];\n break;\n }\n }\n if (weight != null)\n \tbstyle.setFontWeight(weight);\n else\n \tbstyle.setFontWeight(cssFontWeight[0]);\n if (fstyle != null)\n \tbstyle.setFontStyle(fstyle);\n else\n \tbstyle.setFontStyle(cssFontStyle[0]);\n\n //font family\n //If it's a known common font don't embed in html output to save space\n String knownFontFamily = findKnownFontFamily(font);\n if (!knownFontFamily.equals(\"\"))\n family = knownFontFamily;\n else\n {\n family = fontTable.getUsedName(text.getFont());\n if (family == null)\n family = font;\n }\n\n if (family != null)\n \tbstyle.setFontFamily(family);\n }\n\n updateStyleForRenderingMode();\n }",
"public static cmppolicylabel_stats get(nitro_service service, String labelname) throws Exception{\n\t\tcmppolicylabel_stats obj = new cmppolicylabel_stats();\n\t\tobj.set_labelname(labelname);\n\t\tcmppolicylabel_stats response = (cmppolicylabel_stats) obj.stat_resource(service);\n\t\treturn response;\n\t}"
] |
Find the path.
@param start key of first node in the path
@param end key of last node in the path
@return string containing the nodes keys in the path separated by arrow symbol | [
"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 }"
] | [
"@Deprecated\n @SuppressWarnings(\"deprecation\")\n public void push(String eventName, HashMap<String, Object> chargeDetails,\n ArrayList<HashMap<String, Object>> items)\n throws InvalidEventNameException {\n // This method is for only charged events\n if (!eventName.equals(Constants.CHARGED_EVENT)) {\n throw new InvalidEventNameException(\"Not a charged event\");\n }\n CleverTapAPI cleverTapAPI = weakReference.get();\n if(cleverTapAPI == null){\n Logger.d(\"CleverTap Instance is null.\");\n } else {\n cleverTapAPI.pushChargedEvent(chargeDetails, items);\n }\n }",
"public static String getCacheDir(Context ctx) {\n return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || (!Environment.isExternalStorageRemovable() && ctx.getExternalCacheDir() != null) ?\n ctx.getExternalCacheDir().getPath() : ctx.getCacheDir().getPath();\n }",
"public void register(Delta delta) {\n\t\tfinal IResourceDescription newDesc = delta.getNew();\n\t\tif (newDesc == null) {\n\t\t\tremoveDescription(delta.getUri());\n\t\t} else {\n\t\t\taddDescription(delta.getUri(), newDesc);\n\t\t}\n\t}",
"public TaskProvider<GenerateHensonNavigatorTask> createHensonNavigatorGenerationTask(\n BaseVariant variant, String hensonNavigatorPackageName, File destinationFolder) {\n TaskProvider<GenerateHensonNavigatorTask> generateHensonNavigatorTask =\n project\n .getTasks()\n .register(\n \"generate\" + capitalize(variant.getName()) + \"HensonNavigator\",\n GenerateHensonNavigatorTask.class,\n (Action<GenerateHensonNavigatorTask>)\n generateHensonNavigatorTask1 -> {\n generateHensonNavigatorTask1.hensonNavigatorPackageName =\n hensonNavigatorPackageName;\n generateHensonNavigatorTask1.destinationFolder = destinationFolder;\n generateHensonNavigatorTask1.variant = variant;\n generateHensonNavigatorTask1.logger = logger;\n generateHensonNavigatorTask1.project = project;\n generateHensonNavigatorTask1.hensonNavigatorGenerator =\n hensonNavigatorGenerator;\n });\n return generateHensonNavigatorTask;\n }",
"public static final TimeUnit parseDurationTimeUnits(BigInteger value, TimeUnit defaultValue)\n {\n TimeUnit result = defaultValue;\n\n if (value != null)\n {\n switch (value.intValue())\n {\n case 3:\n case 35:\n {\n result = TimeUnit.MINUTES;\n break;\n }\n\n case 4:\n case 36:\n {\n result = TimeUnit.ELAPSED_MINUTES;\n break;\n }\n\n case 5:\n case 37:\n {\n result = TimeUnit.HOURS;\n break;\n }\n\n case 6:\n case 38:\n {\n result = TimeUnit.ELAPSED_HOURS;\n break;\n }\n\n case 7:\n case 39:\n case 53:\n {\n result = TimeUnit.DAYS;\n break;\n }\n\n case 8:\n case 40:\n {\n result = TimeUnit.ELAPSED_DAYS;\n break;\n }\n\n case 9:\n case 41:\n {\n result = TimeUnit.WEEKS;\n break;\n }\n\n case 10:\n case 42:\n {\n result = TimeUnit.ELAPSED_WEEKS;\n break;\n }\n\n case 11:\n case 43:\n {\n result = TimeUnit.MONTHS;\n break;\n }\n\n case 12:\n case 44:\n {\n result = TimeUnit.ELAPSED_MONTHS;\n break;\n }\n\n case 19:\n case 51:\n {\n result = TimeUnit.PERCENT;\n break;\n }\n\n case 20:\n case 52:\n {\n result = TimeUnit.ELAPSED_PERCENT;\n break;\n }\n\n default:\n {\n result = PARENT_FILE.get().getProjectProperties().getDefaultDurationUnits();\n break;\n }\n }\n }\n\n return (result);\n }",
"private void validateAttributes() {\n if (content == null) {\n throw new NullContentException(\"RendererBuilder needs content to create Renderer instances\");\n }\n\n if (parent == null) {\n throw new NullParentException(\"RendererBuilder needs a parent to inflate Renderer instances\");\n }\n\n if (layoutInflater == null) {\n throw new NullLayoutInflaterException(\n \"RendererBuilder needs a LayoutInflater to inflate Renderer instances\");\n }\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 }",
"private String[] getColumnNames(ResultSetMetaData rsmd) throws Exception {\n ArrayList<String> names = new ArrayList<String>();\n\n // Get result set meta data\n int numColumns = rsmd.getColumnCount();\n\n // Get the column names; column indices start from 1\n for (int i = 1; i < numColumns + 1; i++) {\n String columnName = rsmd.getColumnName(i);\n\n names.add(columnName);\n }\n\n return names.toArray(new String[0]);\n }",
"public int length() {\n int length = 1 + 2 + deviceToken.length + 2 + payload.length;\n final int marshalledLength = marshall().length;\n assert marshalledLength == length;\n return length;\n }"
] |
Print the class's constructors m | [
"private boolean operations(Options opt, ConstructorDoc m[]) {\n\tboolean printed = false;\n\tfor (ConstructorDoc cd : m) {\n\t if (hidden(cd))\n\t\tcontinue;\n\t stereotype(opt, cd, Align.LEFT);\n\t String cs = visibility(opt, cd) + cd.name() //\n\t\t + (opt.showType ? \"(\" + parameter(opt, cd.parameters()) + \")\" : \"()\");\n\t tableLine(Align.LEFT, cs);\n\t tagvalue(opt, cd);\n\t printed = true;\n\t}\n\treturn printed;\n }"
] | [
"private InputStream connect(String url) throws IOException {\n\t\tURLConnection conn = new URL(URL_BASE + url).openConnection();\n\t\tconn.setConnectTimeout(CONNECT_TIMEOUT);\n\t\tconn.setReadTimeout(READ_TIMEOUT);\n\t\tconn.setRequestProperty(\"User-Agent\", USER_AGENT);\n\t\treturn conn.getInputStream();\n\t}",
"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 static int Mode( int[] values ){\n int mode = 0, curMax = 0;\n\n for ( int i = 0, length = values.length; i < length; i++ )\n {\n if ( values[i] > curMax )\n {\n curMax = values[i];\n mode = i;\n }\n }\n return mode;\n }",
"private static <R> RowKey buildRowKey(AssociationKey associationKey, R row, AssociationRowAccessor<R> accessor) {\n\t\tString[] columnNames = associationKey.getMetadata().getRowKeyColumnNames();\n\t\tObject[] columnValues = new Object[columnNames.length];\n\n\t\tfor ( int i = 0; i < columnNames.length; i++ ) {\n\t\t\tString columnName = columnNames[i];\n\t\t\tcolumnValues[i] = associationKey.getMetadata().isKeyColumn( columnName ) ? associationKey.getColumnValue( columnName ) : accessor.get( row, columnName );\n\t\t}\n\n\t\treturn new RowKey( columnNames, columnValues );\n\t}",
"public ResultSetAndStatement executeQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException\r\n {\r\n if (logger.isDebugEnabled())\r\n {\r\n logger.debug(\"executeQuery: \" + query);\r\n }\r\n /*\r\n\t\t * MBAIRD: we should create a scrollable resultset if the start at\r\n\t\t * index or end at index is set\r\n\t\t */\r\n boolean scrollable = ((query.getStartAtIndex() > Query.NO_START_AT_INDEX) || (query.getEndAtIndex() > Query.NO_END_AT_INDEX));\r\n /*\r\n\t\t * OR if the prefetching of relationships is being used.\r\n\t\t */\r\n if (query != null && query.getPrefetchedRelationships() != null && !query.getPrefetchedRelationships().isEmpty())\r\n {\r\n scrollable = true;\r\n }\r\n final StatementManagerIF sm = broker.serviceStatementManager();\r\n final SelectStatement sql = broker.serviceSqlGenerator().getPreparedSelectStatement(query, cld);\r\n PreparedStatement stmt = null;\r\n ResultSet rs = null;\r\n try\r\n {\r\n final int queryFetchSize = query.getFetchSize();\r\n final boolean isStoredProcedure = isStoredProcedure(sql.getStatement());\r\n stmt = sm.getPreparedStatement(cld, sql.getStatement() ,\r\n scrollable, queryFetchSize, isStoredProcedure);\r\n if (isStoredProcedure)\r\n {\r\n // Query implemented as a stored procedure, which must return a result set.\r\n // Query sytax is: { ?= call PROCEDURE_NAME(?,...,?)}\r\n getPlatform().registerOutResultSet((CallableStatement) stmt, 1);\r\n sm.bindStatement(stmt, query, cld, 2);\r\n\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"executeQuery: \" + stmt);\r\n\r\n stmt.execute();\r\n rs = (ResultSet) ((CallableStatement) stmt).getObject(1);\r\n }\r\n else\r\n {\r\n sm.bindStatement(stmt, query, cld, 1);\r\n\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"executeQuery: \" + stmt);\r\n\r\n rs = stmt.executeQuery();\r\n }\r\n\r\n return new ResultSetAndStatement(sm, stmt, rs, sql);\r\n }\r\n catch (PersistenceBrokerException e)\r\n {\r\n // release resources on exception\r\n sm.closeResources(stmt, rs);\r\n logger.error(\"PersistenceBrokerException during the execution of the query: \" + e.getMessage(), e);\r\n throw e;\r\n }\r\n catch (SQLException e)\r\n {\r\n // release resources on exception\r\n sm.closeResources(stmt, rs);\r\n throw ExceptionHelper.generateException(e, sql.getStatement(), null, logger, null);\r\n }\r\n }",
"public PayloadBuilder customField(final String key, final Object value) {\n root.put(key, value);\n return this;\n }",
"public PhotoList<Photo> getNotInSet(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\", PhotosInterface.METHOD_GET_NOT_IN_SET);\r\n\r\n RequestContext requestContext = RequestContext.getRequestContext();\r\n\r\n List<String> extras = requestContext.getExtras();\r\n if (extras.size() > 0) {\r\n parameters.put(\"extras\", StringUtilities.join(extras, \",\"));\r\n }\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 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 }",
"public static String decodeUrlIso(String stringToDecode) {\n try {\n return URLDecoder.decode(stringToDecode, \"ISO-8859-1\");\n } catch (UnsupportedEncodingException e1) {\n throw new RuntimeException(e1);\n }\n }",
"@Override\n public ModelNode resolveValue(ExpressionResolver resolver, ModelNode value) throws OperationFailedException {\n\n // Pass non-LIST values through the superclass so it can reject weird values and, in the odd chance\n // that's how this object is set up, turn undefined into a default list value.\n ModelNode superResult = value.getType() == ModelType.LIST ? value : super.resolveValue(resolver, value);\n\n // If it's not a LIST (almost certainly UNDEFINED), then nothing more we can do\n if (superResult.getType() != ModelType.LIST) {\n return superResult;\n }\n // Resolve each element.\n // Don't mess with the original value\n ModelNode clone = superResult == value ? value.clone() : superResult;\n ModelNode result = new ModelNode();\n result.setEmptyList();\n for (ModelNode element : clone.asList()) {\n result.add(valueType.resolveValue(resolver, element));\n }\n // Validate the entire list\n getValidator().validateParameter(getName(), result);\n return result;\n }"
] |
This creates a new audit log file with default permissions.
@param file File to create | [
"protected void createNewFile(final File file) {\n try {\n file.createNewFile();\n setFileNotWorldReadablePermissions(file);\n } catch (IOException e){\n throw new RuntimeException(e);\n }\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 static int[] ConcatenateInt(List<int[]> arrays) {\n\n int size = 0;\n for (int i = 0; i < arrays.size(); i++) {\n size += arrays.get(i).length;\n }\n\n int[] all = new int[size];\n int idx = 0;\n\n for (int i = 0; i < arrays.size(); i++) {\n int[] v = arrays.get(i);\n for (int j = 0; j < v.length; j++) {\n all[idx++] = v[i];\n }\n }\n\n return all;\n }",
"public CompositeGeneratorNode appendTemplate(final CompositeGeneratorNode parent, final StringConcatenationClient templateString) {\n final TemplateNode proc = new TemplateNode(templateString, this);\n List<IGeneratorNode> _children = parent.getChildren();\n _children.add(proc);\n return parent;\n }",
"public ItemRequest<Project> findById(String project) {\n \n String path = String.format(\"/projects/%s\", project);\n return new ItemRequest<Project>(this, Project.class, path, \"GET\");\n }",
"public static BoxAPIConnection getTransactionConnection(String accessToken, String scope) {\n return BoxTransactionalAPIConnection.getTransactionConnection(accessToken, scope, null);\n }",
"public void dispatchKeyEvent(int code, int action) {\n int keyCode = 0;\n int keyAction = 0;\n if (code == BUTTON_1) {\n keyCode = KeyEvent.KEYCODE_BUTTON_1;\n } else if (code == BUTTON_2) {\n keyCode = KeyEvent.KEYCODE_BUTTON_2;\n }\n\n if (action == ACTION_DOWN) {\n keyAction = KeyEvent.ACTION_DOWN;\n } else if (action == ACTION_UP) {\n keyAction = KeyEvent.ACTION_UP;\n }\n\n KeyEvent keyEvent = new KeyEvent(keyAction, keyCode);\n setKeyEvent(keyEvent);\n }",
"private String formatRelationList(List<Relation> value)\n {\n String result = null;\n\n if (value != null && value.size() != 0)\n {\n StringBuilder sb = new StringBuilder();\n for (Relation relation : value)\n {\n if (sb.length() != 0)\n {\n sb.append(m_delimiter);\n }\n\n sb.append(formatRelation(relation));\n }\n\n result = sb.toString();\n }\n\n return (result);\n }",
"public static GVRCameraRig makeInstance(GVRContext gvrContext) {\n final GVRCameraRig result = gvrContext.getApplication().getDelegate().makeCameraRig(gvrContext);\n result.init(gvrContext);\n return result;\n }",
"public void terminateAllConnections(){\r\n\t\tthis.terminationLock.lock();\r\n\t\ttry{\r\n\t\t\t// close off all connections.\r\n\t\t\tfor (int i=0; i < this.pool.partitionCount; i++) {\r\n\t\t\t\tthis.pool.partitions[i].setUnableToCreateMoreTransactions(false); // we can create new ones now, this is an optimization\r\n\t\t\t\tList<ConnectionHandle> clist = new LinkedList<ConnectionHandle>(); \r\n\t\t\t\tthis.pool.partitions[i].getFreeConnections().drainTo(clist);\r\n\t\t\t\tfor (ConnectionHandle c: clist){\r\n\t\t\t\t\tthis.pool.destroyConnection(c);\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t} finally {\r\n\t\t\tthis.terminationLock.unlock();\r\n\t\t}\r\n\t}"
] |
Assemble the configuration section of the URL. | [
"StringBuilder assembleConfig(boolean meta) {\n StringBuilder builder = new StringBuilder();\n\n if (meta) {\n builder.append(PREFIX_META);\n }\n\n if (isTrim) {\n builder.append(PART_TRIM);\n if (trimPixelColor != null) {\n builder.append(\":\").append(trimPixelColor.value);\n if (trimColorTolerance > 0) {\n builder.append(\":\").append(trimColorTolerance);\n }\n }\n builder.append(\"/\");\n }\n\n if (hasCrop) {\n builder.append(cropLeft).append(\"x\").append(cropTop) //\n .append(\":\").append(cropRight).append(\"x\").append(cropBottom);\n\n builder.append(\"/\");\n }\n\n if (hasResize) {\n if (fitInStyle != null) {\n builder.append(fitInStyle.value).append(\"/\");\n }\n if (flipHorizontally) {\n builder.append(\"-\");\n }\n if (resizeWidth == ORIGINAL_SIZE) {\n builder.append(\"orig\");\n } else {\n builder.append(resizeWidth);\n }\n builder.append(\"x\");\n if (flipVertically) {\n builder.append(\"-\");\n }\n if (resizeHeight == ORIGINAL_SIZE) {\n builder.append(\"orig\");\n } else {\n builder.append(resizeHeight);\n }\n if (isSmart) {\n builder.append(\"/\").append(PART_SMART);\n } else {\n if (cropHorizontalAlign != null) {\n builder.append(\"/\").append(cropHorizontalAlign.value);\n }\n if (cropVerticalAlign != null) {\n builder.append(\"/\").append(cropVerticalAlign.value);\n }\n }\n builder.append(\"/\");\n }\n\n if (filters != null) {\n builder.append(PART_FILTERS);\n for (String filter : filters) {\n builder.append(\":\").append(filter);\n }\n builder.append(\"/\");\n }\n\n builder.append(isLegacy ? md5(image) : image);\n\n return builder;\n }"
] | [
"public RenderScript getRenderScript() {\n if (renderScript == null) {\n renderScript = RenderScript.create(context, renderScriptContextType);\n }\n return renderScript;\n }",
"public StitchEvent<T> nextEvent() throws IOException {\n final Event nextEvent = eventStream.nextEvent();\n if (nextEvent == null) {\n return null;\n }\n\n return StitchEvent.fromEvent(nextEvent, this.decoder);\n }",
"private void addIndex(IndexDescriptorDef indexDescDef, TableDef tableDef)\r\n {\r\n IndexDef indexDef = tableDef.getIndex(indexDescDef.getName());\r\n\r\n if (indexDef == null)\r\n {\r\n indexDef = new IndexDef(indexDescDef.getName(),\r\n indexDescDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_UNIQUE, false));\r\n tableDef.addIndex(indexDef);\r\n }\r\n\r\n try\r\n {\r\n String fieldNames = indexDescDef.getProperty(PropertyHelper.OJB_PROPERTY_FIELDS);\r\n ArrayList fields = ((ClassDescriptorDef)indexDescDef.getOwner()).getFields(fieldNames);\r\n FieldDescriptorDef fieldDef;\r\n\r\n for (Iterator it = fields.iterator(); it.hasNext();)\r\n {\r\n fieldDef = (FieldDescriptorDef)it.next();\r\n indexDef.addColumn(fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN));\r\n }\r\n }\r\n catch (NoSuchFieldException ex)\r\n {\r\n // won't happen if we already checked the constraints\r\n }\r\n }",
"public static BoxAPIConnection getTransactionConnection(String accessToken, String scope) {\n return BoxTransactionalAPIConnection.getTransactionConnection(accessToken, scope, null);\n }",
"protected boolean isItemAccepted(byte[] key) {\n boolean entryAccepted = false;\n if (!fetchOrphaned) {\n if (isKeyNeeded(key)) {\n entryAccepted = true;\n }\n } else {\n if (!StoreRoutingPlan.checkKeyBelongsToNode(key, nodeId, initialCluster, storeDef)) {\n entryAccepted = true;\n }\n }\n return entryAccepted;\n }",
"public static void dumpClusters(Cluster currentCluster,\n Cluster finalCluster,\n String outputDirName,\n String filePrefix) {\n dumpClusterToFile(outputDirName, filePrefix + currentClusterFileName, currentCluster);\n dumpClusterToFile(outputDirName, filePrefix + finalClusterFileName, finalCluster);\n }",
"private ColorItem buildColorItem(int colorId, String label) {\n Color color;\n String colorName;\n switch (colorId) {\n case 0:\n color = new Color(0, 0, 0, 0);\n colorName = \"No Color\";\n break;\n case 1:\n color = Color.PINK;\n colorName = \"Pink\";\n break;\n case 2:\n color = Color.RED;\n colorName = \"Red\";\n break;\n case 3:\n color = Color.ORANGE;\n colorName = \"Orange\";\n break;\n case 4:\n color = Color.YELLOW;\n colorName = \"Yellow\";\n break;\n case 5:\n color = Color.GREEN;\n colorName = \"Green\";\n break;\n case 6:\n color = Color.CYAN;\n colorName = \"Aqua\";\n break;\n case 7:\n color = Color.BLUE;\n colorName = \"Blue\";\n break;\n case 8:\n color = new Color(128, 0, 128);\n colorName = \"Purple\";\n break;\n default:\n color = new Color(0, 0, 0, 0);\n colorName = \"Unknown Color\";\n }\n return new ColorItem(colorId, label, color, colorName);\n }",
"private String joinElements(int length)\n {\n StringBuilder sb = new StringBuilder();\n for (int index = 0; index < length; index++)\n {\n sb.append(m_elements.get(index));\n }\n return sb.toString();\n }",
"public List<Task> getActiveTasks() {\n InputStream response = null;\n URI uri = new URIBase(getBaseUri()).path(\"_active_tasks\").build();\n try {\n response = couchDbClient.get(uri);\n return getResponseList(response, couchDbClient.getGson(), DeserializationTypes.TASKS);\n } finally {\n close(response);\n }\n }"
] |
Add "ORDER BY" clause to the SQL query statement. This can be called multiple times to add additional "ORDER BY"
clauses. Ones earlier are applied first. | [
"public QueryBuilder<T, ID> orderBy(String columnName, boolean ascending) {\n\t\tFieldType fieldType = verifyColumnName(columnName);\n\t\tif (fieldType.isForeignCollection()) {\n\t\t\tthrow new IllegalArgumentException(\"Can't orderBy foreign collection field: \" + columnName);\n\t\t}\n\t\taddOrderBy(new OrderBy(columnName, ascending));\n\t\treturn this;\n\t}"
] | [
"public void deployApplication(String applicationName, String... classpathLocations) throws IOException {\n\n final List<URL> classpathElements = Arrays.stream(classpathLocations)\n .map(classpath -> Thread.currentThread().getContextClassLoader().getResource(classpath))\n .collect(Collectors.toList());\n\n deployApplication(applicationName, classpathElements.toArray(new URL[classpathElements.size()]));\n }",
"public int[] getPositions() {\n int[] list;\n if (assumeSinglePosition) {\n list = new int[1];\n list[0] = super.startPosition();\n return list;\n } else {\n try {\n processEncodedPayload();\n list = mtasPosition.getPositions();\n if (list != null) {\n return mtasPosition.getPositions();\n }\n } catch (IOException e) {\n log.debug(e);\n // do nothing\n }\n int start = super.startPosition();\n int end = super.endPosition();\n list = new int[end - start];\n for (int i = start; i < end; i++)\n list[i - start] = i;\n return list;\n }\n }",
"public static String resolveProxyUrl(String relativeUrl, TileMap tileMap, String baseTmsUrl) {\n\t\tTileCode tc = parseTileCode(relativeUrl);\n\t\treturn buildUrl(tc, tileMap, baseTmsUrl);\n\t}",
"private void addAuthentication(HttpHost host, Credentials credentials,\n AuthScheme authScheme, HttpClientContext context) {\n AuthCache authCache = context.getAuthCache();\n if (authCache == null) {\n authCache = new BasicAuthCache();\n context.setAuthCache(authCache);\n }\n \n CredentialsProvider credsProvider = context.getCredentialsProvider();\n if (credsProvider == null) {\n credsProvider = new BasicCredentialsProvider();\n context.setCredentialsProvider(credsProvider);\n }\n \n credsProvider.setCredentials(new AuthScope(host), credentials);\n \n if (authScheme != null) {\n authCache.put(host, authScheme);\n }\n }",
"public int[][] argb() {\n return Arrays.stream(points()).map(p -> argb(p.x, p.y)).toArray(int[][]::new);\n }",
"public static ComplexNumber Sin(ComplexNumber z1) {\r\n ComplexNumber result = new ComplexNumber();\r\n\r\n if (z1.imaginary == 0.0) {\r\n result.real = Math.sin(z1.real);\r\n result.imaginary = 0.0;\r\n } else {\r\n result.real = Math.sin(z1.real) * Math.cosh(z1.imaginary);\r\n result.imaginary = Math.cos(z1.real) * Math.sinh(z1.imaginary);\r\n }\r\n\r\n return result;\r\n }",
"public static String join(Iterable<?> iterable, String separator) {\n if (iterable != null) {\n StringBuilder buf = new StringBuilder();\n Iterator<?> it = iterable.iterator();\n char singleChar = separator.length() == 1 ? separator.charAt(0) : 0;\n while (it.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 }",
"protected final void setDerivedEndType() {\n\n m_endType = getPatternType().equals(PatternType.NONE) || getPatternType().equals(PatternType.INDIVIDUAL)\n ? EndType.SINGLE\n : null != getSeriesEndDate() ? EndType.DATE : EndType.TIMES;\n }",
"public static double I0(double x) {\r\n double ans;\r\n double ax = Math.abs(x);\r\n\r\n if (ax < 3.75) {\r\n double y = x / 3.75;\r\n y = y * y;\r\n ans = 1.0 + y * (3.5156229 + y * (3.0899424 + y * (1.2067492\r\n + y * (0.2659732 + y * (0.360768e-1 + y * 0.45813e-2)))));\r\n } else {\r\n double y = 3.75 / ax;\r\n ans = (Math.exp(ax) / Math.sqrt(ax)) * (0.39894228 + y * (0.1328592e-1\r\n + y * (0.225319e-2 + y * (-0.157565e-2 + y * (0.916281e-2\r\n + y * (-0.2057706e-1 + y * (0.2635537e-1 + y * (-0.1647633e-1\r\n + y * 0.392377e-2))))))));\r\n }\r\n\r\n return ans;\r\n }"
] |
Get the raw bytes of the beat grid as it was read over the network. This can be used to analyze fields
that have not yet been reliably understood, and is also used for storing the beat grid in a cache file.
This is not available when the beat grid was loaded by Crate Digger.
@return the bytes that make up the beat grid | [
"@SuppressWarnings(\"WeakerAccess\")\n public ByteBuffer getRawData() {\n if (rawData != null) {\n rawData.rewind();\n return rawData.slice();\n }\n return null;\n }"
] | [
"public boolean merge(final PluginXmlAccess other) {\n boolean _xblockexpression = false;\n {\n String _path = this.getPath();\n String _path_1 = other.getPath();\n boolean _notEquals = (!Objects.equal(_path, _path_1));\n if (_notEquals) {\n String _path_2 = this.getPath();\n String _plus = (\"Merging plugin.xml files with different paths: \" + _path_2);\n String _plus_1 = (_plus + \", \");\n String _path_3 = other.getPath();\n String _plus_2 = (_plus_1 + _path_3);\n PluginXmlAccess.LOG.warn(_plus_2);\n }\n _xblockexpression = this.entries.addAll(other.entries);\n }\n return _xblockexpression;\n }",
"@Override\n public void registerChildren(ManagementResourceRegistration resourceRegistration) {\n // Register wildcard children last to prevent duplicate registration errors when override definitions exist\n for (ResourceDefinition rd : singletonChildren) {\n resourceRegistration.registerSubModel(rd);\n }\n for (ResourceDefinition rd : wildcardChildren) {\n resourceRegistration.registerSubModel(rd);\n }\n }",
"public boolean existsElement(String predicate) throws org.odmg.QueryInvalidException\r\n {\r\n DList results = (DList) this.query(predicate);\r\n if (results == null || results.size() == 0)\r\n return false;\r\n else\r\n return true;\r\n }",
"public void addAll(Vertex vtx) {\n if (head == null) {\n head = vtx;\n } else {\n tail.next = vtx;\n }\n vtx.prev = tail;\n while (vtx.next != null) {\n vtx = vtx.next;\n }\n tail = vtx;\n }",
"public static Boolean compareMultipleClientConfigAvro(String configAvro1, String configAvro2) {\n Map<String, Properties> mapStoreToProps1 = readMultipleClientConfigAvro(configAvro1);\n Map<String, Properties> mapStoreToProps2 = readMultipleClientConfigAvro(configAvro2);\n Set<String> keySet1 = mapStoreToProps1.keySet();\n Set<String> keySet2 = mapStoreToProps2.keySet();\n if(!keySet1.equals(keySet2)) {\n return false;\n }\n for(String storeName: keySet1) {\n Properties props1 = mapStoreToProps1.get(storeName);\n Properties props2 = mapStoreToProps2.get(storeName);\n if(!props1.equals(props2)) {\n return false;\n }\n }\n return true;\n }",
"public void setValue(String constantValue)\r\n {\r\n this.fieldSource = SOURCE_VALUE;\r\n this.fieldRefName = null;\r\n this.returnedByProcedure = false;\r\n this.constantValue = constantValue;\r\n }",
"@Override\n public void prettyPrint(StringBuffer sb, int indent)\n {\n sb.append(Log.getSpaces(indent));\n sb.append(GVRBone.class.getSimpleName());\n sb.append(\" [name=\" + getName() + \", boneId=\" + getBoneId()\n + \", offsetMatrix=\" + getOffsetMatrix()\n + \", finalTransformMatrix=\" + getFinalTransformMatrix() // crashes debugger\n + \"]\");\n sb.append(System.lineSeparator());\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 }",
"private void handleGlobalArguments(Section section) {\n\t\tfor (String key : section.keySet()) {\n\t\t\tswitch (key) {\n\t\t\tcase OPTION_OFFLINE_MODE:\n\t\t\t\tif (section.get(key).toLowerCase().equals(\"true\")) {\n\t\t\t\t\tthis.offlineMode = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase OPTION_QUIET:\n\t\t\t\tif (section.get(key).toLowerCase().equals(\"true\")) {\n\t\t\t\t\tthis.quiet = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase OPTION_CREATE_REPORT:\n\t\t\t\tthis.reportFilename = section.get(key);\n\t\t\t\tbreak;\n\t\t\tcase OPTION_DUMP_LOCATION:\n\t\t\t\tthis.dumpDirectoryLocation = section.get(key);\n\t\t\t\tbreak;\n\t\t\tcase OPTION_FILTER_LANGUAGES:\n\t\t\t\tsetLanguageFilters(section.get(key));\n\t\t\t\tbreak;\n\t\t\tcase OPTION_FILTER_SITES:\n\t\t\t\tsetSiteFilters(section.get(key));\n\t\t\t\tbreak;\n\t\t\tcase OPTION_FILTER_PROPERTIES:\n\t\t\t\tsetPropertyFilters(section.get(key));\n\t\t\t\tbreak;\n\t\t\tcase OPTION_LOCAL_DUMPFILE:\n\t\t\t\tthis.inputDumpLocation = section.get(key);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tlogger.warn(\"Unrecognized option: \" + key);\n\t\t\t}\n\t\t}\n\t}"
] |
Add a '<' clause so the column must be less-than the value. | [
"public Where<T, ID> lt(String columnName, Object value) throws SQLException {\n\t\taddClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,\n\t\t\t\tSimpleComparison.LESS_THAN_OPERATION));\n\t\treturn this;\n\t}"
] | [
"public static Boolean parseBoolean(String value) throws ParseException\n {\n Boolean result = null;\n Integer number = parseInteger(value);\n if (number != null)\n {\n result = number.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE;\n }\n\n return result;\n }",
"Document convertSelectorToDocument(Document selector) {\n Document document = new Document();\n for (String key : selector.keySet()) {\n if (key.startsWith(\"$\")) {\n continue;\n }\n\n Object value = selector.get(key);\n if (!Utils.containsQueryExpression(value)) {\n Utils.changeSubdocumentValue(document, key, value, (AtomicReference<Integer>) null);\n }\n }\n return document;\n }",
"public static int hash(int input)\n {\n int k1 = mixK1(input);\n int h1 = mixH1(DEFAULT_SEED, k1);\n\n return fmix(h1, SizeOf.SIZE_OF_INT);\n }",
"public ParallelTaskBuilder prepareSsh() {\n reinitIfClosed();\n ParallelTaskBuilder cb = new ParallelTaskBuilder();\n cb.setProtocol(RequestProtocol.SSH);\n return cb;\n }",
"protected void postLayoutChild(final int dataIndex) {\n if (!mContainer.isDynamic()) {\n boolean visibleInLayout = !mViewPort.isClippingEnabled() || inViewPort(dataIndex);\n ViewPortVisibility visibility = visibleInLayout ?\n ViewPortVisibility.FULLY_VISIBLE : ViewPortVisibility.INVISIBLE;\n Log.d(Log.SUBSYSTEM.LAYOUT, TAG, \"onLayout: child with dataId [%d] viewportVisibility = %s\",\n dataIndex, visibility);\n\n Widget childWidget = mContainer.get(dataIndex);\n if (childWidget != null) {\n childWidget.setViewPortVisibility(visibility);\n }\n }\n }",
"synchronized long storeUserProfile(String id, JSONObject obj) {\n\n if (id == null) return DB_UPDATE_ERROR;\n\n if (!this.belowMemThreshold()) {\n getConfigLogger().verbose(\"There is not enough space left on the device to store data, data discarded\");\n return DB_OUT_OF_MEMORY_ERROR;\n }\n\n final String tableName = Table.USER_PROFILES.getName();\n\n long ret = DB_UPDATE_ERROR;\n\n try {\n final SQLiteDatabase db = dbHelper.getWritableDatabase();\n final ContentValues cv = new ContentValues();\n cv.put(KEY_DATA, obj.toString());\n cv.put(\"_id\", id);\n ret = db.insertWithOnConflict(tableName, null, cv, SQLiteDatabase.CONFLICT_REPLACE);\n } catch (final SQLiteException e) {\n getConfigLogger().verbose(\"Error adding data to table \" + tableName + \" Recreating DB\");\n dbHelper.deleteDatabase();\n } finally {\n dbHelper.close();\n }\n return ret;\n }",
"protected void generateTitleBand() {\n\t\tlog.debug(\"Generating title band...\");\n\t\tJRDesignBand band = (JRDesignBand) getDesign().getPageHeader();\n\t\tint yOffset = 0;\n\n\t\t//If title is not present then subtitle will be ignored\n\t\tif (getReport().getTitle() == null)\n\t\t\treturn;\n\n\t\tif (band != null && !getDesign().isTitleNewPage()){\n\t\t\t//Title and subtitle comes afer the page header\n\t\t\tyOffset = band.getHeight();\n\n\t\t} else {\n\t\t\tband = (JRDesignBand) getDesign().getTitle();\n\t\t\tif (band == null){\n\t\t\t\tband = new JRDesignBand();\n\t\t\t\tgetDesign().setTitle(band);\n\t\t\t}\n\t\t}\n\n\t\tJRDesignExpression printWhenExpression = new JRDesignExpression();\n\t\tprintWhenExpression.setValueClass(Boolean.class);\n\t\tprintWhenExpression.setText(EXPRESSION_TRUE_WHEN_FIRST_PAGE);\n\n\t\tJRDesignTextField title = new JRDesignTextField();\n\t\tJRDesignExpression exp = new JRDesignExpression();\n\t\tif (getReport().isTitleIsJrExpression()){\n\t\t\texp.setText(getReport().getTitle());\n\t\t}else {\n\t\t\texp.setText(\"\\\"\" + Utils.escapeTextForExpression( getReport().getTitle()) + \"\\\"\");\n\t\t}\n\t\texp.setValueClass(String.class);\n\t\ttitle.setExpression(exp);\n\t\ttitle.setWidth(getReport().getOptions().getPrintableWidth());\n\t\ttitle.setHeight(getReport().getOptions().getTitleHeight());\n\t\ttitle.setY(yOffset);\n\t\ttitle.setPrintWhenExpression(printWhenExpression);\n\t\ttitle.setRemoveLineWhenBlank(true);\n\t\tapplyStyleToElement(getReport().getTitleStyle(), title);\n\t\ttitle.setStretchType( StretchTypeEnum.NO_STRETCH );\n\t\tband.addElement(title);\n\n\t\tJRDesignTextField subtitle = new JRDesignTextField();\n\t\tif (getReport().getSubtitle() != null) {\n\t\t\tJRDesignExpression exp2 = new JRDesignExpression();\n\t\t\texp2.setText(\"\\\"\" + getReport().getSubtitle() + \"\\\"\");\n\t\t\texp2.setValueClass(String.class);\n\t\t\tsubtitle.setExpression(exp2);\n\t\t\tsubtitle.setWidth(getReport().getOptions().getPrintableWidth());\n\t\t\tsubtitle.setHeight(getReport().getOptions().getSubtitleHeight());\n\t\t\tsubtitle.setY(title.getY() + title.getHeight());\n\t\t\tsubtitle.setPrintWhenExpression(printWhenExpression);\n\t\t\tsubtitle.setRemoveLineWhenBlank(true);\n\t\t\tapplyStyleToElement(getReport().getSubtitleStyle(), subtitle);\n\t\t\ttitle.setStretchType( StretchTypeEnum.NO_STRETCH );\n\t\t\tband.addElement(subtitle);\n\t\t}\n\n\n\t}",
"@PreDestroy\n public final void dispose() {\n getConnectionPool().ifPresent(PoolResources::dispose);\n getThreadPool().dispose();\n\n try {\n ObjectName name = getByteBufAllocatorObjectName();\n\n if (ManagementFactory.getPlatformMBeanServer().isRegistered(name)) {\n ManagementFactory.getPlatformMBeanServer().unregisterMBean(name);\n }\n } catch (JMException e) {\n this.logger.error(\"Unable to register ByteBufAllocator MBean\", e);\n }\n }",
"private boolean includeDocument(ItemDocument itemDocument) {\n\t\tfor (StatementGroup sg : itemDocument.getStatementGroups()) {\n\t\t\t// \"P19\" is \"place of birth\" on Wikidata\n\t\t\tif (!\"P19\".equals(sg.getProperty().getId())) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (Statement s : sg) {\n\t\t\t\tif (s.getMainSnak() instanceof ValueSnak) {\n\t\t\t\t\tValue v = s.getValue();\n\t\t\t\t\t// \"Q1731\" is \"Dresden\" on Wikidata\n\t\t\t\t\tif (v instanceof ItemIdValue\n\t\t\t\t\t\t\t&& \"Q1731\".equals(((ItemIdValue) v).getId())) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}"
] |
Accessor method used to retrieve a Boolean object representing the
contents of an individual field. If the field does not exist in the
record, null is returned.
@param field the index number of the field to be retrieved
@return the value of the required field | [
"public boolean getNumericBoolean(int field)\n {\n boolean result = false;\n\n if ((field < m_fields.length) && (m_fields[field].length() != 0))\n {\n result = Integer.parseInt(m_fields[field]) == 1;\n }\n\n return (result);\n }"
] | [
"@JmxGetter(name = \"avgUpdateEntriesNetworkTimeMs\", description = \"average time spent on network, for streaming operations\")\n public double getAvgUpdateEntriesNetworkTimeMs() {\n return networkTimeCounterMap.get(Operation.UPDATE_ENTRIES).getAvgEventValue()\n / Time.NS_PER_MS;\n }",
"public ObjectReferenceDescriptor getObjectReferenceDescriptorByName(String name)\r\n {\r\n ObjectReferenceDescriptor ord = (ObjectReferenceDescriptor)\r\n getObjectReferenceDescriptorsNameMap().get(name);\r\n\r\n //\r\n // BRJ: if the ReferenceDescriptor is not found\r\n // look in the ClassDescriptor referenced by 'super' for it\r\n //\r\n if (ord == null)\r\n {\r\n ClassDescriptor superCld = getSuperClassDescriptor();\r\n if (superCld != null)\r\n {\r\n ord = superCld.getObjectReferenceDescriptorByName(name);\r\n }\r\n }\r\n return ord;\r\n }",
"protected <T, A> ActiveOperation<T, A> removeActiveOperation(Integer id) {\n final ActiveOperation<T, A> removed = removeUnderLock(id);\n if(removed != null) {\n for(final Map.Entry<Integer, ActiveRequest<?, ?>> requestEntry : requests.entrySet()) {\n final ActiveRequest<?, ?> request = requestEntry.getValue();\n if(request.context == removed) {\n requests.remove(requestEntry.getKey());\n }\n }\n }\n return removed;\n }",
"public static ModelNode createBootUpdates(final String serverName, final ModelNode domainModel, final ModelNode hostModel,\n final DomainController domainController, final ExpressionResolver expressionResolver) {\n final ManagedServerOperationsFactory factory = new ManagedServerOperationsFactory(serverName, domainModel,\n hostModel, domainController, expressionResolver);\n\n\n return factory.getBootUpdates();\n }",
"public String getBaselineDurationText()\n {\n Object result = getCachedValue(TaskField.BASELINE_DURATION);\n if (result == null)\n {\n result = getCachedValue(TaskField.BASELINE_ESTIMATED_DURATION);\n }\n\n if (!(result instanceof String))\n {\n result = null;\n }\n return (String) result;\n }",
"public void setDoubleAttribute(String name, Double value) {\n\t\tensureAttributes();\n\t\tAttribute attribute = new DoubleAttribute(value);\n\t\tattribute.setEditable(isEditable(name));\n\t\tgetAllAttributes().put(name, attribute);\n\n\t}",
"public static String plus(CharSequence left, Object value) {\n return left + DefaultGroovyMethods.toString(value);\n }",
"private void sendAnnouncement(InetAddress broadcastAddress) {\n try {\n DatagramPacket announcement = new DatagramPacket(announcementBytes, announcementBytes.length,\n broadcastAddress, DeviceFinder.ANNOUNCEMENT_PORT);\n socket.get().send(announcement);\n Thread.sleep(getAnnounceInterval());\n } catch (Throwable t) {\n logger.warn(\"Unable to send announcement packet, shutting down\", t);\n stop();\n }\n }",
"public <FT, FID> BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id) throws SQLException {\n\t\t// this can happen if we have a foreign-auto-refresh scenario\n\t\tif (foreignFieldType == null) {\n\t\t\treturn null;\n\t\t}\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tDao<FT, FID> castDao = (Dao<FT, FID>) foreignDao;\n\t\tif (!fieldConfig.isForeignCollectionEager()) {\n\t\t\t// we know this won't go recursive so no need for the counters\n\t\t\treturn new LazyForeignCollection<FT, FID>(castDao, parent, id, foreignFieldType,\n\t\t\t\t\tfieldConfig.getForeignCollectionOrderColumnName(), fieldConfig.isForeignCollectionOrderAscending());\n\t\t}\n\n\t\t// try not to create level counter objects unless we have to\n\t\tLevelCounters levelCounters = threadLevelCounters.get();\n\t\tif (levelCounters == null) {\n\t\t\tif (fieldConfig.getForeignCollectionMaxEagerLevel() == 0) {\n\t\t\t\t// then return a lazy collection instead\n\t\t\t\treturn new LazyForeignCollection<FT, FID>(castDao, parent, id, foreignFieldType,\n\t\t\t\t\t\tfieldConfig.getForeignCollectionOrderColumnName(),\n\t\t\t\t\t\tfieldConfig.isForeignCollectionOrderAscending());\n\t\t\t}\n\t\t\tlevelCounters = new LevelCounters();\n\t\t\tthreadLevelCounters.set(levelCounters);\n\t\t}\n\n\t\tif (levelCounters.foreignCollectionLevel == 0) {\n\t\t\tlevelCounters.foreignCollectionLevelMax = fieldConfig.getForeignCollectionMaxEagerLevel();\n\t\t}\n\t\t// are we over our level limit?\n\t\tif (levelCounters.foreignCollectionLevel >= levelCounters.foreignCollectionLevelMax) {\n\t\t\t// then return a lazy collection instead\n\t\t\treturn new LazyForeignCollection<FT, FID>(castDao, parent, id, foreignFieldType,\n\t\t\t\t\tfieldConfig.getForeignCollectionOrderColumnName(), fieldConfig.isForeignCollectionOrderAscending());\n\t\t}\n\t\tlevelCounters.foreignCollectionLevel++;\n\t\ttry {\n\t\t\treturn new EagerForeignCollection<FT, FID>(castDao, parent, id, foreignFieldType,\n\t\t\t\t\tfieldConfig.getForeignCollectionOrderColumnName(), fieldConfig.isForeignCollectionOrderAscending());\n\t\t} finally {\n\t\t\tlevelCounters.foreignCollectionLevel--;\n\t\t}\n\t}"
] |
Destroys the context | [
"protected void destroy() {\n ContextLogger.LOG.contextCleared(this);\n final BeanStore beanStore = getBeanStore();\n if (beanStore == null) {\n throw ContextLogger.LOG.noBeanStoreAvailable(this);\n }\n for (BeanIdentifier id : beanStore) {\n destroyContextualInstance(beanStore.get(id));\n }\n beanStore.clear();\n }"
] | [
"public void pushDryRun() throws Exception {\n if (releaseAction.isCreateVcsTag()) {\n if (scmManager.isTagExists(scmManager.getRemoteConfig(releaseAction.getTargetRemoteName()), releaseAction.getTagUrl())) {\n throw new Exception(String.format(\"Tag with name '%s' already exists\", releaseAction.getTagUrl()));\n }\n }\n\n String testTagName = releaseAction.getTagUrl() + \"_test\";\n try {\n scmManager.testPush(scmManager.getRemoteConfig(releaseAction.getTargetRemoteName()), testTagName);\n } catch (Exception e) {\n throw new Exception(String.format(\"Failed while attempting push dry-run: %s\", e.getMessage()), e);\n } finally {\n if (scmManager.isTagExists(scmManager.getRemoteConfig(releaseAction.getTargetRemoteName()), testTagName)) {\n scmManager.deleteLocalTag(testTagName);\n }\n }\n }",
"public Future<HazeltaskTask<GROUP>> addPendingTaskAsync(HazeltaskTask<GROUP> task) {\n return pendingTask.putAsync(task.getId(), task);\n }",
"public static void setTranslucentNavigationFlag(Activity activity, boolean on) {\n if (Build.VERSION.SDK_INT >= 19) {\n setFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, on);\n }\n }",
"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 void deleteFilePath(FilePath workspace, String path) throws IOException {\n if (StringUtils.isNotBlank(path)) {\n try {\n FilePath propertiesFile = new FilePath(workspace, path);\n propertiesFile.delete();\n } catch (Exception e) {\n throw new IOException(\"Could not delete temp file: \" + path);\n }\n }\n }",
"public static base_response unset(nitro_service client, clusterinstance resource, String[] args) throws Exception{\n\t\tclusterinstance unsetresource = new clusterinstance();\n\t\tunsetresource.clid = resource.clid;\n\t\treturn unsetresource.unset_resource(client,args);\n\t}",
"public Map<Integer, TableDefinition> tableDefinitions()\n {\n Map<Integer, TableDefinition> result = new HashMap<Integer, TableDefinition>();\n\n result.put(Integer.valueOf(2), new TableDefinition(\"PROJECT_SUMMARY\", columnDefinitions(PROJECT_SUMMARY_COLUMNS, projectSummaryColumnsOrder())));\n result.put(Integer.valueOf(7), new TableDefinition(\"BAR\", columnDefinitions(BAR_COLUMNS, barColumnsOrder())));\n result.put(Integer.valueOf(11), new TableDefinition(\"CALENDAR\", columnDefinitions(CALENDAR_COLUMNS, calendarColumnsOrder())));\n result.put(Integer.valueOf(12), new TableDefinition(\"EXCEPTIONN\", columnDefinitions(EXCEPTIONN_COLUMNS, exceptionColumnsOrder())));\n result.put(Integer.valueOf(14), new TableDefinition(\"EXCEPTION_ASSIGNMENT\", columnDefinitions(EXCEPTION_ASSIGNMENT_COLUMNS, exceptionAssignmentColumnsOrder())));\n result.put(Integer.valueOf(15), new TableDefinition(\"TIME_ENTRY\", columnDefinitions(TIME_ENTRY_COLUMNS, timeEntryColumnsOrder())));\n result.put(Integer.valueOf(17), new TableDefinition(\"WORK_PATTERN\", columnDefinitions(WORK_PATTERN_COLUMNS, workPatternColumnsOrder()))); \n result.put(Integer.valueOf(18), new TableDefinition(\"TASK_COMPLETED_SECTION\", columnDefinitions(TASK_COMPLETED_SECTION_COLUMNS, taskCompletedSectionColumnsOrder()))); \n result.put(Integer.valueOf(21), new TableDefinition(\"TASK\", columnDefinitions(TASK_COLUMNS, taskColumnsOrder())));\n result.put(Integer.valueOf(22), new TableDefinition(\"MILESTONE\", columnDefinitions(MILESTONE_COLUMNS, milestoneColumnsOrder())));\n result.put(Integer.valueOf(23), new TableDefinition(\"EXPANDED_TASK\", columnDefinitions(EXPANDED_TASK_COLUMNS, expandedTaskColumnsOrder())));\n result.put(Integer.valueOf(25), new TableDefinition(\"LINK\", columnDefinitions(LINK_COLUMNS, linkColumnsOrder())));\n result.put(Integer.valueOf(61), new TableDefinition(\"CONSUMABLE_RESOURCE\", columnDefinitions(CONSUMABLE_RESOURCE_COLUMNS, consumableResourceColumnsOrder())));\n result.put(Integer.valueOf(62), new TableDefinition(\"PERMANENT_RESOURCE\", columnDefinitions(PERMANENT_RESOURCE_COLUMNS, permanentResourceColumnsOrder())));\n result.put(Integer.valueOf(63), new TableDefinition(\"PERM_RESOURCE_SKILL\", columnDefinitions(PERMANENT_RESOURCE_SKILL_COLUMNS, permanentResourceSkillColumnsOrder())));\n result.put(Integer.valueOf(67), new TableDefinition(\"PERMANENT_SCHEDUL_ALLOCATION\", columnDefinitions(PERMANENT_SCHEDULE_ALLOCATION_COLUMNS, permanentScheduleAllocationColumnsOrder())));\n result.put(Integer.valueOf(190), new TableDefinition(\"WBS_ENTRY\", columnDefinitions(WBS_ENTRY_COLUMNS, wbsEntryColumnsOrder())));\n\n return result;\n }",
"public static <T> T buildInstanceForMap(Class<T> clazz, Map<String, Object> values, MyReflectionDifferenceHandler differenceHandler)\n throws InstantiationException, IllegalAccessException, IntrospectionException,\n IllegalArgumentException, InvocationTargetException {\n\n log.debug(\"Building new instance of Class \" + clazz.getName());\n\n T instance = clazz.newInstance();\n\n for (String key : values.keySet()) {\n Object value = values.get(key);\n\n if (value == null) {\n log.debug(\"Value for field \" + key + \" is null, so ignoring it...\");\n continue;\n }\n \n log.debug(\n \"Invoke setter for \" + key + \" (\" + value.getClass() + \" / \" + value.toString() + \")\");\n Method setter = null;\n try {\n setter = new PropertyDescriptor(key.replace('.', '_'), clazz).getWriteMethod();\n } catch (Exception e) {\n throw new IllegalArgumentException(\"Setter for field \" + key + \" was not found\", e);\n }\n\n Class<?> argumentType = setter.getParameterTypes()[0];\n\n if (argumentType.isAssignableFrom(value.getClass())) {\n setter.invoke(instance, value);\n } else {\n\n Object newValue = differenceHandler.handleDifference(value, setter.getParameterTypes()[0]);\n setter.invoke(instance, newValue);\n\n }\n }\n\n return instance;\n }",
"public static base_response apply(nitro_service client) throws Exception {\n\t\tnspbr6 applyresource = new nspbr6();\n\t\treturn applyresource.perform_operation(client,\"apply\");\n\t}"
] |
Remove a list of stores from the session
First commit all entries for these stores and then cleanup resources
@param storeNameToRemove List of stores to be removed from the current
streaming session | [
"@SuppressWarnings({})\n public synchronized void removeStoreFromSession(List<String> storeNameToRemove) {\n\n logger.info(\"closing the Streaming session for a few stores\");\n\n commitToVoldemort(storeNameToRemove);\n cleanupSessions(storeNameToRemove);\n\n }"
] | [
"public void waitForDeployments(@Observes(precedence = -100) AfterStart event, OpenShiftAdapter client,\n CEEnvironmentProcessor.TemplateDetails details, TestClass testClass, CubeOpenShiftConfiguration configuration, OpenShiftClient openshiftClient)\n throws Exception {\n if (testClass == null) {\n // nothing to do, since we're not in ClassScoped context\n return;\n }\n if (details == null) {\n log.warning(String.format(\"No environment for %s\", testClass.getName()));\n return;\n }\n log.info(String.format(\"Waiting for environment for %s\", testClass.getName()));\n try {\n delay(client, details.getResources());\n } catch (Throwable t) {\n throw new IllegalArgumentException(\"Error waiting for template resources to deploy: \" + testClass.getName(), t);\n }\n }",
"public static DMatrixRMaj diagonal(int N , double min , double max , Random rand ) {\n return diagonal(N,N,min,max,rand);\n }",
"public static base_responses delete(nitro_service client, clusterinstance resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tclusterinstance deleteresources[] = new clusterinstance[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tdeleteresources[i] = new clusterinstance();\n\t\t\t\tdeleteresources[i].clid = resources[i].clid;\n\t\t\t}\n\t\t\tresult = delete_bulk_request(client, deleteresources);\n\t\t}\n\t\treturn result;\n\t}",
"public void _solveVectorInternal( double []vv )\n {\n // Solve L*Y = B\n int ii = 0;\n\n for( int i = 0; i < n; i++ ) {\n int ip = indx[i];\n double sum = vv[ip];\n vv[ip] = vv[i];\n if( ii != 0 ) {\n// for( int j = ii-1; j < i; j++ )\n// sum -= dataLU[i* n +j]*vv[j];\n int index = i*n + ii-1;\n for( int j = ii-1; j < i; j++ )\n sum -= dataLU[index++]*vv[j];\n } else if( sum != 0.0 ) {\n ii=i+1;\n }\n vv[i] = sum;\n }\n\n // Solve U*X = Y;\n TriangularSolver_DDRM.solveU(dataLU,vv,n);\n }",
"private void registerRows() {\n\t\tfor (int i = 0; i < rows.length; i++) {\n\t\t\tDJCrosstabRow crosstabRow = rows[i];\n\n\t\t\tJRDesignCrosstabRowGroup ctRowGroup = new JRDesignCrosstabRowGroup();\n\n\t\t\tctRowGroup.setWidth(crosstabRow.getHeaderWidth());\n\n\t\t\tctRowGroup.setName(crosstabRow.getProperty().getProperty());\n\n\t\t\tJRDesignCrosstabBucket rowBucket = new JRDesignCrosstabBucket();\n\n //New in JR 4.1+\n rowBucket.setValueClassName(crosstabRow.getProperty().getValueClassName());\n\n\t\t\tctRowGroup.setBucket(rowBucket);\n\n\t\t\tJRDesignExpression bucketExp = ExpressionUtils.createExpression(\"$F{\"+crosstabRow.getProperty().getProperty()+\"}\", crosstabRow.getProperty().getValueClassName());\n\t\t\trowBucket.setExpression(bucketExp);\n\n\n\t\t\tJRDesignCellContents rowHeaderContents = new JRDesignCellContents();\n\t\t\tJRDesignTextField rowTitle = new JRDesignTextField();\n\n\t\t\tJRDesignExpression rowTitExp = new JRDesignExpression();\n\t\t\trowTitExp.setValueClassName(crosstabRow.getProperty().getValueClassName());\n\t\t\trowTitExp.setText(\"$V{\"+crosstabRow.getProperty().getProperty()+\"}\");\n\n\t\t\trowTitle.setExpression(rowTitExp);\n\t\t\trowTitle.setWidth(crosstabRow.getHeaderWidth());\n\n\t\t\t//The width can be the sum of the with of all the rows starting from the current one, up to the inner most one.\n\t\t\tint auxHeight = getRowHeaderMaxHeight(crosstabRow);\n//\t\t\tint auxHeight = crosstabRow.getHeight(); //FIXME getRowHeaderMaxHeight() must be FIXED because it breaks when 1rs row shows total and 2nd doesn't\n\t\t\trowTitle.setHeight(auxHeight);\n\n\t\t\tStyle headerstyle = crosstabRow.getHeaderStyle() == null ? this.djcross.getRowHeaderStyle(): crosstabRow.getHeaderStyle();\n\n\t\t\tif (headerstyle != null){\n\t\t\t\tlayoutManager.applyStyleToElement(headerstyle, rowTitle);\n\t\t\t\trowHeaderContents.setBackcolor(headerstyle.getBackgroundColor());\n\t\t\t}\n\n\t\t\trowHeaderContents.addElement(rowTitle);\n\t\t\trowHeaderContents.setMode( ModeEnum.OPAQUE );\n\n\t\t\tboolean fullBorder = i <= 0; //Only outer most will have full border\n\t\t\tapplyCellBorder(rowHeaderContents, false, fullBorder);\n\n\t\t\tctRowGroup.setHeader(rowHeaderContents );\n\n\t\t\tif (crosstabRow.isShowTotals())\n\t\t\t\tcreateRowTotalHeader(ctRowGroup,crosstabRow,fullBorder);\n\n\n\t\t\ttry {\n\t\t\t\tjrcross.addRowGroup(ctRowGroup);\n\t\t\t} catch (JRException e) {\n\t\t\t\tlog.error(e.getMessage(),e);\n\t\t\t}\n\n\t\t}\n\t}",
"@Override\n public QueryBuilderFind excludingType(final Class<? extends WindupVertexFrame> type)\n {\n pipelineCriteria.add(new QueryGremlinCriterion()\n {\n @Override\n public void query(GraphRewrite event, GraphTraversal<?, Vertex> pipeline)\n {\n pipeline.filter(it -> !GraphTypeManager.hasType(type, it.get()));\n }\n });\n return this;\n }",
"public static String[] removeDuplicateStrings(String[] array) {\n if (isEmpty(array)) {\n return array;\n }\n Set<String> set = new TreeSet<String>();\n Collections.addAll(set, array);\n return toStringArray(set);\n }",
"public final void notifyFooterItemChanged(int position) {\n if (position < 0 || position >= footerItemCount) {\n throw new IndexOutOfBoundsException(\"The given position \" + position\n + \" is not within the position bounds for footer items [0 - \"\n + (footerItemCount - 1) + \"].\");\n }\n notifyItemChanged(position + headerItemCount + contentItemCount);\n }",
"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}"
] |
Obtains a local date in Ethiopic calendar system from the
proleptic-year, month-of-year and day-of-month fields.
@param prolepticYear the proleptic-year
@param month the month-of-year
@param dayOfMonth the day-of-month
@return the Ethiopic local date, not null
@throws DateTimeException if unable to create the date | [
"@Override\n public EthiopicDate date(int prolepticYear, int month, int dayOfMonth) {\n return EthiopicDate.of(prolepticYear, month, dayOfMonth);\n }"
] | [
"private Map<String, I_CmsSearchConfigurationFacetField> getDefaultFieldFacets(boolean categoryConjunction) {\n\n Map<String, I_CmsSearchConfigurationFacetField> fieldFacets = new HashMap<String, I_CmsSearchConfigurationFacetField>();\n fieldFacets.put(\n CmsListManager.FIELD_CATEGORIES,\n new CmsSearchConfigurationFacetField(\n CmsListManager.FIELD_CATEGORIES,\n null,\n Integer.valueOf(1),\n Integer.valueOf(200),\n null,\n \"Category\",\n SortOrder.index,\n null,\n Boolean.valueOf(categoryConjunction),\n null,\n Boolean.TRUE));\n fieldFacets.put(\n CmsListManager.FIELD_PARENT_FOLDERS,\n new CmsSearchConfigurationFacetField(\n CmsListManager.FIELD_PARENT_FOLDERS,\n null,\n Integer.valueOf(1),\n Integer.valueOf(200),\n null,\n \"Folders\",\n SortOrder.index,\n null,\n Boolean.FALSE,\n null,\n Boolean.TRUE));\n return Collections.unmodifiableMap(fieldFacets);\n\n }",
"public static String fancyStringF(double value, DecimalFormat format, int length, int significant) {\n\n String formatted = fancyString(value, format, length, significant);\n\n int n = length-formatted.length();\n if( n > 0 ) {\n StringBuilder builder = new StringBuilder(n);\n for (int i = 0; i < n; i++) {\n builder.append(' ');\n }\n return formatted + builder.toString();\n } else {\n return formatted;\n }\n }",
"public void setCharTranslator(CharacterTranslator charTranslator) {\r\n\t\tif(charTranslator!=null){\r\n\t\t\tthis.charTranslator = charTranslator;\r\n\t\t\tthis.htmlElementTranslator = null;\r\n\t\t\tthis.targetTranslator = null;\r\n\t\t}\r\n\t}",
"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 boolean isPublisherWrapped(AbstractProject<?, ?> project, Class<T> type) {\n return find(project, type) != null;\n }",
"public void setHeader(String header, String value) {\n StringValidator.throwIfEmptyOrNull(\"header\", header);\n StringValidator.throwIfEmptyOrNull(\"value\", value);\n\n if (headers == null) {\n headers = new HashMap<String, String>();\n }\n\n headers.put(header, value);\n }",
"private Proctor getProctorNotNull() {\n final Proctor proctor = proctorLoader.get();\n if (proctor == null) {\n throw new IllegalStateException(\"Proctor specification and/or text matrix has not been loaded\");\n }\n return proctor;\n }",
"public\tRandomVariableInterface[]\tgetFactorLoading(double time, double component, RandomVariableInterface[] realizationAtTimeIndex) {\n\t\tint componentIndex = liborPeriodDiscretization.getTimeIndex(component);\n\t\tif(componentIndex < 0) {\n\t\t\tcomponentIndex = -componentIndex - 2;\n\t\t}\n\t\treturn getFactorLoading(time, componentIndex, realizationAtTimeIndex);\n\t}",
"public static ServerSetup[] verbose(ServerSetup[] serverSetups) {\r\n ServerSetup[] copies = new ServerSetup[serverSetups.length];\r\n for (int i = 0; i < serverSetups.length; i++) {\r\n copies[i] = serverSetups[i].createCopy().setVerbose(true);\r\n }\r\n return copies;\r\n }"
] |
Returns true if this Bytes object equals another. This method doesn't check it's arguments.
@since 1.2.0 | [
"private boolean contentEqualsUnchecked(byte[] bytes, int offset, int len) {\n if (length != len) {\n return false;\n }\n\n return compareToUnchecked(bytes, offset, len) == 0;\n }"
] | [
"public AT_Row setPadding(int padding){\r\n\t\tif(this.hasCells()){\r\n\t\t\tfor(AT_Cell cell : this.getCells()){\r\n\t\t\t\tcell.getContext().setPadding(padding);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}",
"private boolean absoluteAdvanced(int row)\r\n {\r\n boolean retval = false;\r\n \r\n try\r\n {\r\n if (getRsAndStmt().m_rs != null)\r\n {\r\n if (row == 0)\r\n {\r\n getRsAndStmt().m_rs.beforeFirst();\r\n }\r\n else\r\n {\r\n retval = getRsAndStmt().m_rs.absolute(row); \r\n }\r\n m_current_row = row;\r\n setHasCalledCheck(false);\r\n }\r\n }\r\n catch (SQLException e)\r\n {\r\n advancedJDBCSupport = false;\r\n }\r\n return retval;\r\n }",
"public static Iterable<BoxRetentionPolicy.Info> getAll(final BoxAPIConnection api, String ... fields) {\r\n return getAll(null, null, null, DEFAULT_LIMIT, api, fields);\r\n }",
"public void storeIfNew(final DbArtifact fromClient) {\n final DbArtifact existing = repositoryHandler.getArtifact(fromClient.getGavc());\n\n if(existing != null){\n existing.setLicenses(fromClient.getLicenses());\n store(existing);\n }\n\n if(existing == null){\n\t store(fromClient);\n }\n }",
"private void writeBooleanField(String fieldName, Object value) throws IOException\n {\n boolean val = ((Boolean) value).booleanValue();\n if (val)\n {\n m_writer.writeNameValuePair(fieldName, val);\n }\n }",
"public static boolean checkDuplicateElements(DMatrixSparseCSC A ) {\n A = A.copy(); // create a copy so that it doesn't modify A\n A.sortIndices(null);\n return !checkSortedFlag(A);\n }",
"private static void dumpTree(PrintWriter pw, DirectoryEntry dir, String prefix, boolean showData, boolean hex, String indent) throws Exception\n {\n long byteCount;\n\n for (Iterator<Entry> iter = dir.getEntries(); iter.hasNext();)\n {\n Entry entry = iter.next();\n if (entry instanceof DirectoryEntry)\n {\n String childIndent = indent;\n if (childIndent != null)\n {\n childIndent += \" \";\n }\n\n String childPrefix = prefix + \"[\" + entry.getName() + \"].\";\n pw.println(\"start dir: \" + prefix + entry.getName());\n dumpTree(pw, (DirectoryEntry) entry, childPrefix, showData, hex, childIndent);\n pw.println(\"end dir: \" + prefix + entry.getName());\n }\n else\n if (entry instanceof DocumentEntry)\n {\n if (showData)\n {\n pw.println(\"start doc: \" + prefix + entry.getName());\n if (hex == true)\n {\n byteCount = hexdump(new DocumentInputStream((DocumentEntry) entry), pw);\n }\n else\n {\n byteCount = asciidump(new DocumentInputStream((DocumentEntry) entry), pw);\n }\n pw.println(\"end doc: \" + prefix + entry.getName() + \" (\" + byteCount + \" bytes read)\");\n }\n else\n {\n if (indent != null)\n {\n pw.print(indent);\n }\n pw.println(\"doc: \" + prefix + entry.getName());\n }\n }\n else\n {\n pw.println(\"found unknown: \" + prefix + entry.getName());\n }\n }\n }",
"private void updateMetadata(CdjStatus update, TrackMetadata data) {\n hotCache.put(DeckReference.getDeckReference(update.getDeviceNumber(), 0), data); // Main deck\n if (data.getCueList() != null) { // Update the cache with any hot cues in this track as well\n for (CueList.Entry entry : data.getCueList().entries) {\n if (entry.hotCueNumber != 0) {\n hotCache.put(DeckReference.getDeckReference(update.getDeviceNumber(), entry.hotCueNumber), data);\n }\n }\n }\n deliverTrackMetadataUpdate(update.getDeviceNumber(), data);\n }",
"public static base_response update(nitro_service client, ipv6 resource) throws Exception {\n\t\tipv6 updateresource = new ipv6();\n\t\tupdateresource.ralearning = resource.ralearning;\n\t\tupdateresource.routerredirection = resource.routerredirection;\n\t\tupdateresource.ndbasereachtime = resource.ndbasereachtime;\n\t\tupdateresource.ndretransmissiontime = resource.ndretransmissiontime;\n\t\tupdateresource.natprefix = resource.natprefix;\n\t\tupdateresource.dodad = resource.dodad;\n\t\treturn updateresource.update_resource(client);\n\t}"
] |
Specifies the maximum capacity of the counter.
@param capacity
<code>long</code>
@throws IllegalArgumentException
if windowMillis is less than 1. | [
"public void setCapacity(int capacity) {\n if (capacity <= 0) {\n throw new IllegalArgumentException(\"capacity must be greater than 0\");\n }\n\n synchronized (queue) {\n // If the capacity was reduced, we remove oldest elements until the\n // queue fits inside the specified capacity\n if (capacity < this.capacity) {\n while (queue.size() > capacity) {\n queue.removeFirst();\n }\n }\n }\n\n this.capacity = capacity;\n }"
] | [
"public static sslciphersuite[] get(nitro_service service, options option) throws Exception{\n\t\tsslciphersuite obj = new sslciphersuite();\n\t\tsslciphersuite[] response = (sslciphersuite[])obj.get_resources(service,option);\n\t\treturn response;\n\t}",
"public static int serialize(OutputStream stream, Object obj) {\n ObjectMapper mapper = createMapperWithJaxbAnnotationInspector();\n\n try (DataOutputStream data = new DataOutputStream(stream);\n OutputStreamWriter writer = new OutputStreamWriter(data, StandardCharsets.UTF_8)) {\n mapper.writerWithDefaultPrettyPrinter().writeValue(writer, obj);\n return data.size();\n } catch (IOException e) {\n throw new ReportGenerationException(e);\n }\n }",
"public boolean isActive(int profileId) {\n boolean active = false;\n PreparedStatement queryStatement = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n queryStatement = sqlConnection.prepareStatement(\n \"SELECT \" + Constants.CLIENT_IS_ACTIVE + \" FROM \" + Constants.DB_TABLE_CLIENT +\n \" WHERE \" + Constants.GENERIC_CLIENT_UUID + \"= '-1' \" +\n \" AND \" + Constants.GENERIC_PROFILE_ID + \"= ? \"\n );\n queryStatement.setInt(1, profileId);\n logger.info(queryStatement.toString());\n ResultSet results = queryStatement.executeQuery();\n if (results.next()) {\n active = results.getBoolean(Constants.CLIENT_IS_ACTIVE);\n }\n } catch (SQLException e) {\n e.printStackTrace();\n } finally {\n try {\n if (queryStatement != null) {\n queryStatement.close();\n }\n } catch (Exception e) {\n }\n }\n\n return active;\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 void notifyHeaderItemMoved(int fromPosition, int toPosition) {\n if (fromPosition < 0 || toPosition < 0 || fromPosition >= headerItemCount || toPosition >= headerItemCount) {\n throw new IndexOutOfBoundsException(\"The given fromPosition \" + fromPosition + \" or toPosition \" + toPosition + \" is not within the position bounds for header items [0 - \" + (headerItemCount - 1) + \"].\");\n }\n notifyItemMoved(fromPosition, toPosition);\n }",
"public static systemuser get(nitro_service service, String username) throws Exception{\n\t\tsystemuser obj = new systemuser();\n\t\tobj.set_username(username);\n\t\tsystemuser response = (systemuser) obj.get_resource(service);\n\t\treturn response;\n\t}",
"@Override\n public View getView(int position, View convertView,\n ViewGroup parent) {\n return (wrapped.getView(position, convertView, parent));\n }",
"private boolean operations(Options opt, MethodDoc m[]) {\n\tboolean printed = false;\n\tfor (MethodDoc md : m) {\n\t if (hidden(md))\n\t\tcontinue;\n\t // Filter-out static initializer method\n\t if (md.name().equals(\"<clinit>\") && md.isStatic() && md.isPackagePrivate())\n\t\tcontinue;\n\t stereotype(opt, md, Align.LEFT);\n\t String op = visibility(opt, md) + md.name() + //\n\t\t (opt.showType ? \"(\" + parameter(opt, md.parameters()) + \")\" + typeAnnotation(opt, md.returnType())\n\t\t\t : \"()\");\n\t tableLine(Align.LEFT, (md.isAbstract() ? Font.ABSTRACT : Font.NORMAL).wrap(opt, op));\n\t printed = true;\n\n\t tagvalue(opt, md);\n\t}\n\treturn printed;\n }",
"private void populateProjectHeader(Record record, ProjectProperties properties) throws MPXJException\n {\n properties.setProjectTitle(record.getString(0));\n properties.setCompany(record.getString(1));\n properties.setManager(record.getString(2));\n properties.setDefaultCalendarName(record.getString(3));\n properties.setStartDate(record.getDateTime(4));\n properties.setFinishDate(record.getDateTime(5));\n properties.setScheduleFrom(record.getScheduleFrom(6));\n properties.setCurrentDate(record.getDateTime(7));\n properties.setComments(record.getString(8));\n properties.setCost(record.getCurrency(9));\n properties.setBaselineCost(record.getCurrency(10));\n properties.setActualCost(record.getCurrency(11));\n properties.setWork(record.getDuration(12));\n properties.setBaselineWork(record.getDuration(13));\n properties.setActualWork(record.getDuration(14));\n properties.setWork2(record.getPercentage(15));\n properties.setDuration(record.getDuration(16));\n properties.setBaselineDuration(record.getDuration(17));\n properties.setActualDuration(record.getDuration(18));\n properties.setPercentageComplete(record.getPercentage(19));\n properties.setBaselineStart(record.getDateTime(20));\n properties.setBaselineFinish(record.getDateTime(21));\n properties.setActualStart(record.getDateTime(22));\n properties.setActualFinish(record.getDateTime(23));\n properties.setStartVariance(record.getDuration(24));\n properties.setFinishVariance(record.getDuration(25));\n properties.setSubject(record.getString(26));\n properties.setAuthor(record.getString(27));\n properties.setKeywords(record.getString(28));\n }"
] |
a small helper to get the color from the colorHolder
@param ctx
@return | [
"public int color(Context ctx) {\n if (mColorInt == 0 && mColorRes != -1) {\n mColorInt = ContextCompat.getColor(ctx, mColorRes);\n }\n return mColorInt;\n }"
] | [
"public <T extends CanvasReader> T getReader(Class<T> type, OauthToken oauthToken, Integer paginationPageSize) {\n LOG.debug(\"Factory call to instantiate class: \" + type.getName());\n RestClient restClient = new RefreshingRestClient();\n\n @SuppressWarnings(\"unchecked\")\n Class<T> concreteClass = (Class<T>)readerMap.get(type);\n\n if (concreteClass == null) {\n throw new UnsupportedOperationException(\"No implementation for requested interface found: \" + type.getName());\n }\n\n LOG.debug(\"got class: \" + concreteClass);\n try {\n Constructor<T> constructor = concreteClass.getConstructor(String.class, Integer.class,\n OauthToken.class, RestClient.class, Integer.TYPE, Integer.TYPE, Integer.class, Boolean.class);\n return constructor.newInstance(canvasBaseUrl, CANVAS_API_VERSION, oauthToken, restClient,\n connectTimeout, readTimeout, paginationPageSize, false);\n } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) {\n throw new UnsupportedOperationException(\"Unknown error instantiating the concrete API class: \" + type.getName(), e);\n }\n }",
"public GVRMesh findMesh(GVRSceneObject model)\n {\n class MeshFinder implements GVRSceneObject.ComponentVisitor\n {\n private GVRMesh meshFound = null;\n public GVRMesh getMesh() { return meshFound; }\n public boolean visit(GVRComponent comp)\n {\n GVRRenderData rdata = (GVRRenderData) comp;\n meshFound = rdata.getMesh();\n return (meshFound == null);\n }\n };\n MeshFinder findMesh = new MeshFinder();\n model.forAllComponents(findMesh, GVRRenderData.getComponentType());\n return findMesh.getMesh();\n }",
"private void setRequestSitefilter(WbGetEntitiesActionData properties) {\n\t\tif (this.filter.excludeAllSiteLinks()\n\t\t\t\t|| this.filter.getSiteLinkFilter() == null) {\n\t\t\treturn;\n\t\t}\n\t\tproperties.sitefilter = ApiConnection.implodeObjects(this.filter\n\t\t\t\t.getSiteLinkFilter());\n\t}",
"public synchronized void shutdown() {\n checkIsRunning();\n try {\n beanManager().fireEvent(new ContainerBeforeShutdown(id), BeforeDestroyed.Literal.APPLICATION);\n } finally {\n discard(id);\n // Destroy all the dependent beans correctly\n creationalContext.release();\n beanManager().fireEvent(new ContainerShutdown(id), Destroyed.Literal.APPLICATION);\n bootstrap.shutdown();\n WeldSELogger.LOG.weldContainerShutdown(id);\n }\n }",
"private void visitImplicitFirstFrame() {\n // There can be at most descriptor.length() + 1 locals\n int frameIndex = startFrame(0, descriptor.length() + 1, 0);\n if ((access & Opcodes.ACC_STATIC) == 0) {\n if ((access & ACC_CONSTRUCTOR) == 0) {\n frame[frameIndex++] = Frame.OBJECT | cw.addType(cw.thisName);\n } else {\n frame[frameIndex++] = Frame.UNINITIALIZED_THIS;\n }\n }\n int i = 1;\n loop: while (true) {\n int j = i;\n switch (descriptor.charAt(i++)) {\n case 'Z':\n case 'C':\n case 'B':\n case 'S':\n case 'I':\n frame[frameIndex++] = Frame.INTEGER;\n break;\n case 'F':\n frame[frameIndex++] = Frame.FLOAT;\n break;\n case 'J':\n frame[frameIndex++] = Frame.LONG;\n break;\n case 'D':\n frame[frameIndex++] = Frame.DOUBLE;\n break;\n case '[':\n while (descriptor.charAt(i) == '[') {\n ++i;\n }\n if (descriptor.charAt(i) == 'L') {\n ++i;\n while (descriptor.charAt(i) != ';') {\n ++i;\n }\n }\n frame[frameIndex++] = Frame.type(cw, descriptor.substring(j, ++i));\n break;\n case 'L':\n while (descriptor.charAt(i) != ';') {\n ++i;\n }\n frame[frameIndex++] = Frame.OBJECT\n | cw.addType(descriptor.substring(j + 1, i++));\n break;\n default:\n break loop;\n }\n }\n frame[1] = frameIndex - 3;\n endFrame();\n }",
"@Override\n public void perform(Rewrite event, EvaluationContext context)\n {\n perform((GraphRewrite) event, context);\n }",
"public static final BigDecimal printCurrency(Number value)\n {\n return (value == null || value.doubleValue() == 0 ? null : new BigDecimal(value.doubleValue() * 100));\n }",
"public static base_response unset(nitro_service client, filterhtmlinjectionparameter resource, String[] args) throws Exception{\n\t\tfilterhtmlinjectionparameter unsetresource = new filterhtmlinjectionparameter();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}",
"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}"
] |
get the default profile
@return representation of default profile
@throws Exception exception | [
"protected static JSONObject getDefaultProfile() throws Exception {\n String uri = DEFAULT_BASE_URL + BASE_PROFILE;\n try {\n JSONObject response = new JSONObject(doGet(uri, 60000));\n JSONArray profiles = response.getJSONArray(\"profiles\");\n\n if (profiles.length() > 0) {\n return profiles.getJSONObject(0);\n }\n } catch (Exception e) {\n // some sort of error\n throw new Exception(\"Could not create a proxy client\");\n }\n\n return null;\n }"
] | [
"public void setLinearUpperLimits(float limitX, float limitY, float limitZ) {\n Native3DGenericConstraint.setLinearUpperLimits(getNative(), limitX, limitY, limitZ);\n }",
"private void writeComma() throws IOException\n {\n if (m_firstNameValuePair.peek().booleanValue())\n {\n m_firstNameValuePair.pop();\n m_firstNameValuePair.push(Boolean.FALSE);\n }\n else\n {\n m_writer.write(',');\n }\n }",
"public boolean getHidden() throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_HIDDEN);\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 personElement = response.getPayload();\r\n return personElement.getAttribute(\"hidden\").equals(\"1\") ? true : false;\r\n }",
"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 }",
"private JSONObject getARP(final Context context) {\n try {\n final String nameSpaceKey = getNamespaceARPKey();\n if (nameSpaceKey == null) return null;\n\n final SharedPreferences prefs = StorageHelper.getPreferences(context, nameSpaceKey);\n final Map<String, ?> all = prefs.getAll();\n final Iterator<? extends Map.Entry<String, ?>> iter = all.entrySet().iterator();\n\n while (iter.hasNext()) {\n final Map.Entry<String, ?> kv = iter.next();\n final Object o = kv.getValue();\n if (o instanceof Number && ((Number) o).intValue() == -1) {\n iter.remove();\n }\n }\n final JSONObject ret = new JSONObject(all);\n getConfigLogger().verbose(getAccountId(), \"Fetched ARP for namespace key: \" + nameSpaceKey + \" values: \" + all.toString());\n return ret;\n } catch (Throwable t) {\n getConfigLogger().verbose(getAccountId(), \"Failed to construct ARP object\", t);\n return null;\n }\n }",
"public String getModuleJenkinsJobInfo(final DbArtifact dbArtifact) {\n\t\tfinal DbModule module = getModule(dbArtifact);\n\t\tif(module == null){\n\t\t\treturn \"\";\n\t\t}\n\t\t\n\t\tfinal String jenkinsJobUrl = module.getBuildInfo().get(\"jenkins-job-url\");\n\t\t\n\t\tif(jenkinsJobUrl == null){\n\t\t\treturn \"\";\t\t\t\n\t\t}\n\n\t\treturn jenkinsJobUrl;\n\t}",
"protected void recordPreparedOperation(final ServerIdentity identity, final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> prepared) {\n final ModelNode preparedResult = prepared.getPreparedResult();\n // Hmm do the server results need to get translated as well as the host one?\n // final ModelNode transformedResult = prepared.getOperation().transformResult(preparedResult);\n updatePolicy.recordServerResult(identity, preparedResult);\n executor.recordPreparedOperation(prepared);\n }",
"public static double Correlation(double[] p, double[] q) {\n\n double x = 0;\n double y = 0;\n\n for (int i = 0; i < p.length; i++) {\n x += -p[i];\n y += -q[i];\n }\n\n x /= p.length;\n y /= q.length;\n\n double num = 0;\n double den1 = 0;\n double den2 = 0;\n for (int i = 0; i < p.length; i++) {\n num += (p[i] + x) * (q[i] + y);\n\n den1 += Math.abs(Math.pow(p[i] + x, 2));\n den2 += Math.abs(Math.pow(q[i] + x, 2));\n }\n\n return 1 - (num / (Math.sqrt(den1) * Math.sqrt(den2)));\n\n }",
"private void setBandFinalHeight(JRDesignBand band, int currHeigth, boolean fitToContent) {\n if (band != null) {\n int finalHeight = LayoutUtils.findVerticalOffset(band);\n //noinspection StatementWithEmptyBody\n if (finalHeight < currHeigth && !fitToContent) {\n //nothing\n } else {\n band.setHeight(finalHeight);\n }\n }\n\n }"
] |
Get a reader implementation class to perform API calls with.
@param type Interface type you wish to get an implementation for
@param oauthToken An OAuth token to use for authentication when making API calls
@param <T> The reader type to request an instance of
@return A reader implementation class | [
"public <T extends CanvasReader> T getReader(Class<T> type, OauthToken oauthToken) {\n return getReader(type, oauthToken, null);\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 }",
"private void countCoordinateStatement(Statement statement,\n\t\t\tItemDocument itemDocument) {\n\t\tValue value = statement.getValue();\n\t\tif (!(value instanceof GlobeCoordinatesValue)) {\n\t\t\treturn;\n\t\t}\n\n\t\tGlobeCoordinatesValue coordsValue = (GlobeCoordinatesValue) value;\n\t\tif (!this.globe.equals((coordsValue.getGlobe()))) {\n\t\t\treturn;\n\t\t}\n\n\t\tint xCoord = (int) (((coordsValue.getLongitude() + 180.0) / 360.0) * this.width)\n\t\t\t\t% this.width;\n\t\tint yCoord = (int) (((coordsValue.getLatitude() + 90.0) / 180.0) * this.height)\n\t\t\t\t% this.height;\n\n\t\tif (xCoord < 0 || yCoord < 0 || xCoord >= this.width\n\t\t\t\t|| yCoord >= this.height) {\n\t\t\tSystem.out.println(\"Dropping out-of-range coordinate: \"\n\t\t\t\t\t+ coordsValue);\n\t\t\treturn;\n\t\t}\n\n\t\tcountCoordinates(xCoord, yCoord, itemDocument);\n\t\tthis.count += 1;\n\n\t\tif (this.count % 100000 == 0) {\n\t\t\treportProgress();\n\t\t\twriteImages();\n\t\t}\n\t}",
"public Day getDayOfWeek()\n {\n Day result = null;\n if (!m_days.isEmpty())\n {\n result = m_days.iterator().next();\n }\n return result;\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 }",
"public BoxStoragePolicy.Info getInfo(String... fields) {\n QueryStringBuilder builder = new QueryStringBuilder();\n if (fields.length > 0) {\n builder.appendParam(\"fields\", fields);\n }\n URL url = STORAGE_POLICY_WITH_ID_URL_TEMPLATE.buildWithQuery(this.getAPI().getBaseURL(), builder.toString(),\n this.getID());\n\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"GET\");\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n return new Info(response.getJSON());\n }",
"public void setProgressBackgroundColor(int colorRes) {\n mCircleView.setBackgroundColor(colorRes);\n mProgress.setBackgroundColor(getResources().getColor(colorRes));\n }",
"public void selectByName(String childName)\n {\n int i = 0;\n GVRSceneObject owner = getOwnerObject();\n if (owner == null)\n {\n return;\n }\n for (GVRSceneObject child : owner.children())\n {\n if (child.getName().equals(childName))\n {\n mSwitchIndex = i;\n return;\n }\n ++i;\n } \n }",
"public static base_responses Import(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 Importresources[] = new sslfipskey[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tImportresources[i] = new sslfipskey();\n\t\t\t\tImportresources[i].fipskeyname = resources[i].fipskeyname;\n\t\t\t\tImportresources[i].key = resources[i].key;\n\t\t\t\tImportresources[i].inform = resources[i].inform;\n\t\t\t\tImportresources[i].wrapkeyname = resources[i].wrapkeyname;\n\t\t\t\tImportresources[i].iv = resources[i].iv;\n\t\t\t\tImportresources[i].exponent = resources[i].exponent;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, Importresources,\"Import\");\n\t\t}\n\t\treturn result;\n\t}",
"public static Double getDistanceBetweenCoordinates(Tuple2<Double, Double> point1, Tuple2<Double, Double> point2) {\r\n // sqrt( (x2-x1)^2 + (y2-y2)^2 )\r\n Double xDiff = point1._1() - point2._1();\r\n Double yDiff = point1._2() - point2._2();\r\n return Math.sqrt(xDiff * xDiff + yDiff * yDiff);\r\n }"
] |
Merge msg bundles together, creating new MsgBundle with merges msg bundles passed in as a method argument | [
"private Optional<? extends SoyMsgBundle> mergeMsgBundles(final Locale locale, final List<SoyMsgBundle> soyMsgBundles) {\n if (soyMsgBundles.isEmpty()) {\n return Optional.absent();\n }\n\n final List<SoyMsg> msgs = Lists.newArrayList();\n for (final SoyMsgBundle smb : soyMsgBundles) {\n for (final Iterator<SoyMsg> it = smb.iterator(); it.hasNext();) {\n msgs.add(it.next());\n }\n }\n\n return Optional.of(new SoyMsgBundleImpl(locale.toString(), msgs));\n }"
] | [
"private Client getClient(){\n final ClientConfig cfg = new DefaultClientConfig();\n cfg.getClasses().add(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider.class);\n cfg.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, timeout);\n\n return Client.create(cfg);\n }",
"private void processOperandValue(int index, FieldType type, GraphicalIndicatorCriteria criteria)\n {\n boolean valueFlag = (MPPUtility.getInt(m_data, m_dataOffset) == 1);\n m_dataOffset += 4;\n\n if (valueFlag == false)\n {\n int fieldID = MPPUtility.getInt(m_data, m_dataOffset);\n criteria.setRightValue(index, FieldTypeHelper.getInstance(fieldID));\n m_dataOffset += 4;\n }\n else\n {\n //int dataTypeValue = MPPUtility.getShort(m_data, m_dataOffset);\n m_dataOffset += 2;\n\n switch (type.getDataType())\n {\n case DURATION: // 0x03\n {\n Duration value = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(m_data, m_dataOffset), MPPUtility.getDurationTimeUnits(MPPUtility.getShort(m_data, m_dataOffset + 4)));\n m_dataOffset += 6;\n criteria.setRightValue(index, value);\n break;\n }\n\n case NUMERIC: // 0x05\n {\n Double value = Double.valueOf(MPPUtility.getDouble(m_data, m_dataOffset));\n m_dataOffset += 8;\n criteria.setRightValue(index, value);\n break;\n }\n\n case CURRENCY: // 0x06\n {\n Double value = Double.valueOf(MPPUtility.getDouble(m_data, m_dataOffset) / 100);\n m_dataOffset += 8;\n criteria.setRightValue(index, value);\n break;\n }\n\n case STRING: // 0x08\n {\n String value = MPPUtility.getUnicodeString(m_data, m_dataOffset);\n m_dataOffset += ((value.length() + 1) * 2);\n criteria.setRightValue(index, value);\n break;\n }\n\n case BOOLEAN: // 0x0B\n {\n int value = MPPUtility.getShort(m_data, m_dataOffset);\n m_dataOffset += 2;\n criteria.setRightValue(index, value == 1 ? Boolean.TRUE : Boolean.FALSE);\n break;\n }\n\n case DATE: // 0x13\n {\n Date value = MPPUtility.getTimestamp(m_data, m_dataOffset);\n m_dataOffset += 4;\n criteria.setRightValue(index, value);\n break;\n }\n\n default:\n {\n break;\n }\n }\n }\n }",
"public static boolean isBadXmlCharacter(char c) {\n boolean cDataCharacter = c < '\\u0020' && c != '\\t' && c != '\\r' && c != '\\n';\n cDataCharacter |= (c >= '\\uD800' && c < '\\uE000');\n cDataCharacter |= (c == '\\uFFFE' || c == '\\uFFFF');\n return cDataCharacter;\n }",
"public void addStep(String name, String robot, Map<String, Object> options) {\n all.put(name, new Step(name, robot, options));\n }",
"private String parseLayerId(HttpServletRequest request) {\n\t\tStringTokenizer tokenizer = new StringTokenizer(request.getRequestURI(), \"/\");\n\t\tString token = \"\";\n\t\twhile (tokenizer.hasMoreTokens()) {\n\t\t\ttoken = tokenizer.nextToken();\n\t\t}\n\t\treturn token;\n\t}",
"public void generateTracedFile(final IFileSystemAccess2 fsa, final String path, final EObject rootTrace, final StringConcatenationClient code) {\n final CompositeGeneratorNode node = this.trace(rootTrace, code);\n this.generateTracedFile(fsa, path, node);\n }",
"public B importContext(AbstractContext context, boolean overwriteDuplicates){\n for (Map.Entry<String, Object> en : context.data.entrySet()) {\n if (overwriteDuplicates) {\n this.data.put(en.getKey(), en.getValue());\n }else{\n this.data.putIfAbsent(en.getKey(), en.getValue());\n }\n }\n return (B) this;\n }",
"public static appfwlearningdata[] get(nitro_service service, appfwlearningdata_args args) throws Exception{\n\t\tappfwlearningdata obj = new appfwlearningdata();\n\t\toptions option = new options();\n\t\toption.set_args(nitro_util.object_to_string_withoutquotes(args));\n\t\tappfwlearningdata[] response = (appfwlearningdata[])obj.get_resources(service, option);\n\t\treturn response;\n\t}",
"static File getTargetFile(final File root, final MiscContentItem item) {\n return PatchContentLoader.getMiscPath(root, item);\n }"
] |
End the script block, adding a return value statement
@param value the value to return
@return the new {@link LuaScriptBlock} instance | [
"public LuaScriptBlock endBlockReturn(LuaValue value) {\n add(new LuaAstReturnStatement(argument(value)));\n return new LuaScriptBlock(script);\n }"
] | [
"public static base_response update(nitro_service client, rsskeytype resource) throws Exception {\n\t\trsskeytype updateresource = new rsskeytype();\n\t\tupdateresource.rsstype = resource.rsstype;\n\t\treturn updateresource.update_resource(client);\n\t}",
"private void addCalendars(MpxjTreeNode parentNode, ProjectFile file)\n {\n for (ProjectCalendar calendar : file.getCalendars())\n {\n addCalendar(parentNode, calendar);\n }\n }",
"private SortedSet<Date> filterExceptions(SortedSet<Date> dates) {\n\n SortedSet<Date> result = new TreeSet<Date>();\n for (Date d : dates) {\n if (!m_exceptions.contains(d)) {\n result.add(d);\n }\n }\n return result;\n }",
"public static ModelNode getOperationAddress(final ModelNode op) {\n return op.hasDefined(OP_ADDR) ? op.get(OP_ADDR) : new ModelNode();\n }",
"public static boolean changeHost(String hostName,\n boolean enable,\n boolean disable,\n boolean remove,\n boolean isEnabled,\n boolean exists) throws Exception {\n\n // Open the file that is the first\n // command line parameter\n File hostsFile = new File(\"/etc/hosts\");\n FileInputStream fstream = new FileInputStream(\"/etc/hosts\");\n\n File outFile = null;\n BufferedWriter bw = null;\n // only do file output for destructive operations\n if (!exists && !isEnabled) {\n outFile = File.createTempFile(\"HostsEdit\", \".tmp\");\n bw = new BufferedWriter(new FileWriter(outFile));\n System.out.println(\"File name: \" + outFile.getPath());\n }\n\n // Get the object of DataInputStream\n DataInputStream in = new DataInputStream(fstream);\n BufferedReader br = new BufferedReader(new InputStreamReader(in));\n String strLine;\n boolean foundHost = false;\n boolean hostEnabled = false;\n\n\t\t/*\n * Group 1 - possible commented out host entry\n\t\t * Group 2 - destination address\n\t\t * Group 3 - host name\n\t\t * Group 4 - everything else\n\t\t */\n Pattern pattern = Pattern.compile(\"\\\\s*(#?)\\\\s*([^\\\\s]+)\\\\s*([^\\\\s]+)(.*)\");\n while ((strLine = br.readLine()) != null) {\n\n Matcher matcher = pattern.matcher(strLine);\n\n // if there is a match to the pattern and the host name is the same as the one we want to set\n if (matcher.find() &&\n matcher.group(3).toLowerCase().compareTo(hostName.toLowerCase()) == 0) {\n foundHost = true;\n if (remove) {\n // skip this line altogether\n continue;\n } else if (enable) {\n // we will disregard group 2 and just set it to 127.0.0.1\n if (!exists && !isEnabled)\n bw.write(\"127.0.0.1 \" + matcher.group(3) + matcher.group(4));\n } else if (disable) {\n if (!exists && !isEnabled)\n bw.write(\"# \" + matcher.group(2) + \" \" + matcher.group(3) + matcher.group(4));\n } else if (isEnabled && matcher.group(1).compareTo(\"\") == 0) {\n // host exists and there is no # before it\n hostEnabled = true;\n }\n } else {\n // just write the line back out\n if (!exists && !isEnabled)\n bw.write(strLine);\n }\n\n if (!exists && !isEnabled)\n bw.write('\\n');\n }\n\n // if we didn't find the host in the file but need to enable it\n if (!foundHost && enable) {\n // write a new host entry\n if (!exists && !isEnabled)\n bw.write(\"127.0.0.1 \" + hostName + '\\n');\n }\n // Close the input stream\n in.close();\n\n if (!exists && !isEnabled) {\n bw.close();\n outFile.renameTo(hostsFile);\n }\n\n // return false if the host wasn't found\n if (exists && !foundHost)\n return false;\n\n // return false if the host wasn't enabled\n if (isEnabled && !hostEnabled)\n return false;\n\n return true;\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 }",
"void unbind(String key)\r\n {\r\n NamedEntry entry = new NamedEntry(key, null, false);\r\n localUnbind(key);\r\n addForDeletion(entry);\r\n }",
"public static int getScreenHeight(Context context) {\n DisplayMetrics metrics = context.getResources().getDisplayMetrics();\n return metrics.heightPixels;\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 }"
] |
Mark a given element as checked to prevent duplicate work. A elements is only added when it
is not already in the set of checked elements.
@param element the element that is checked
@return true if !contains(element.uniqueString) | [
"@GuardedBy(\"elementsLock\")\n\t@Override\n\tpublic boolean markChecked(CandidateElement element) {\n\t\tString generalString = element.getGeneralString();\n\t\tString uniqueString = element.getUniqueString();\n\t\tsynchronized (elementsLock) {\n\t\t\tif (elements.contains(uniqueString)) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\telements.add(generalString);\n\t\t\t\telements.add(uniqueString);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}"
] | [
"public void pauseUpload() throws LocalOperationException {\n if (state == State.UPLOADING) {\n setState(State.PAUSED);\n executor.hardStop();\n } else {\n throw new LocalOperationException(\"Attempt to pause upload while assembly is not uploading\");\n }\n }",
"private void initializeSignProperties() {\n if (!signPackage && !signChanges) {\n return;\n }\n\n if (key != null && keyring != null && passphrase != null) {\n return;\n }\n\n Map<String, String> properties =\n readPropertiesFromActiveProfiles(signCfgPrefix, KEY, KEYRING, PASSPHRASE);\n\n key = lookupIfEmpty(key, properties, KEY);\n keyring = lookupIfEmpty(keyring, properties, KEYRING);\n passphrase = decrypt(lookupIfEmpty(passphrase, properties, PASSPHRASE));\n\n if (keyring == null) {\n try {\n keyring = Utils.guessKeyRingFile().getAbsolutePath();\n console.info(\"Located keyring at \" + keyring);\n } catch (FileNotFoundException e) {\n console.warn(e.getMessage());\n }\n }\n }",
"public MACAddressSection toEUI(boolean extended) {\n\t\tMACAddressSegment[] segs = toEUISegments(extended);\n\t\tif(segs == null) {\n\t\t\treturn null;\n\t\t}\n\t\tMACAddressCreator creator = getMACNetwork().getAddressCreator();\n\t\treturn createSectionInternal(creator, segs, Math.max(0, addressSegmentIndex - 4) << 1, extended);\n\t}",
"public boolean getBoolean(FastTrackField type)\n {\n boolean result = false;\n Object value = getObject(type);\n if (value != null)\n {\n result = BooleanHelper.getBoolean((Boolean) value);\n }\n return result;\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 }",
"private ArrayList<RunListener> instantiateRunListeners() throws Exception {\n ArrayList<RunListener> instances = new ArrayList<>();\n\n if (runListeners != null) {\n for (String className : Arrays.asList(runListeners.split(\",\"))) {\n instances.add((RunListener) this.instantiate(className).newInstance());\n }\n }\n\n return instances;\n }",
"@SuppressWarnings(\"SameParameterValue\")\n public static long bytesToNumberLittleEndian(byte[] buffer, int start, int length) {\n long result = 0;\n for (int index = start + length - 1; index >= start; index--) {\n result = (result << 8) + unsign(buffer[index]);\n }\n return result;\n }",
"protected void update(float scale) {\n GVRSceneObject owner = getOwnerObject();\n if (isEnabled() && (owner != null) && owner.isEnabled())\n {\n float w = getWidth();\n float h = getHeight();\n mPose.update(mARPlane.getCenterPose(), scale);\n Matrix4f m = new Matrix4f();\n m.set(mPose.getPoseMatrix());\n m.scaleLocal(w * 0.95f, h * 0.95f, 1.0f);\n owner.getTransform().setModelMatrix(m);\n }\n }",
"static public String bb2hex(byte[] bb) {\n\t\tString result = \"\";\n\t\tfor (int i=0; i<bb.length; i++) {\n\t\t\tresult = result + String.format(\"%02X \", bb[i]);\n\t\t}\n\t\treturn result;\n\t}"
] |
Set the timeout for idle connections. Voldemort client caches all
connections to the Voldemort server. This setting allows the a connection
to be dropped, if it is idle for more than this time.
This could be useful in the following cases 1) Voldemort client is not
directly connected to the server and is connected via a proxy or
firewall. The Proxy or firewall could drop the connection silently. If
the connection is dropped, then client will see operations fail with a
timeout. Setting this property enables the Voldemort client to tear down
the connection before a firewall could drop it. 2) Voldemort server
caches the connection and each connection has an associated memory cost.
Setting this property on all clients, enable the clients to prune the
connections and there by freeing up the server connections.
throws IllegalArgumentException if the timeout is less than 10 minutes.
Currently it can't be set below 10 minutes to avoid the racing risk of
contention between connection checkout and selector trying to close it.
This is intended for low throughput scenarios.
@param idleConnectionTimeout
zero or negative number to disable the feature ( default -1)
timeout
@param unit {@link TimeUnit}
@return ClientConfig object for chained set
throws {@link IllegalArgumentException} if the timeout is greater
than 0, but less than 10 minutes. | [
"public ClientConfig setIdleConnectionTimeout(long idleConnectionTimeout, TimeUnit unit) {\n if (idleConnectionTimeout <= 0) {\n this.idleConnectionTimeoutMs = -1;\n } else {\n if(unit.toMinutes(idleConnectionTimeout) < 10) {\n throw new IllegalArgumentException(\"idleConnectionTimeout should be minimum of 10 minutes\");\n }\n this.idleConnectionTimeoutMs = unit.toMillis(idleConnectionTimeout);\n }\n return this;\n }"
] | [
"public static String packageNameOf(Class<?> clazz) {\n String name = clazz.getName();\n int pos = name.lastIndexOf('.');\n E.unexpectedIf(pos < 0, \"Class does not have package: \" + name);\n return name.substring(0, pos);\n }",
"public static int findVerticalOffset(JRDesignBand band) {\n\t\tint finalHeight = 0;\n\t\tif (band != null) {\n\t\t\tfor (JRChild jrChild : band.getChildren()) {\n\t\t\t\tJRDesignElement element = (JRDesignElement) jrChild;\n\t\t\t\tint currentHeight = element.getY() + element.getHeight();\n\t\t\t\tif (currentHeight > finalHeight) finalHeight = currentHeight;\n\t\t\t}\n\t\t\treturn finalHeight;\n\t\t}\n\t\treturn finalHeight;\n\t}",
"public ThumborUrlBuilder resize(int width, int height) {\n if (width < 0 && width != ORIGINAL_SIZE) {\n throw new IllegalArgumentException(\"Width must be a positive number.\");\n }\n if (height < 0 && height != ORIGINAL_SIZE) {\n throw new IllegalArgumentException(\"Height must be a positive number.\");\n }\n if (width == 0 && height == 0) {\n throw new IllegalArgumentException(\"Both width and height must not be zero.\");\n }\n hasResize = true;\n resizeWidth = width;\n resizeHeight = height;\n return this;\n }",
"public void removeValue(T value, boolean reload) {\n int idx = getIndex(value);\n if (idx >= 0) {\n removeItemInternal(idx, reload);\n }\n }",
"protected BufferedImage createErrorImage(final Rectangle area) {\n final BufferedImage bufferedImage = new BufferedImage(area.width, area.height, TYPE_INT_ARGB_PRE);\n final Graphics2D graphics = bufferedImage.createGraphics();\n try {\n graphics.setBackground(ColorParser.toColor(this.configuration.getTransparentTileErrorColor()));\n graphics.clearRect(0, 0, area.width, area.height);\n return bufferedImage;\n } finally {\n graphics.dispose();\n }\n }",
"public static void launchPermissionSettings(Activity activity) {\n Intent intent = new Intent();\n intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);\n intent.setData(Uri.fromParts(\"package\", activity.getPackageName(), null));\n activity.startActivity(intent);\n }",
"public final void notifyFooterItemMoved(int fromPosition, int toPosition) {\n if (fromPosition < 0 || toPosition < 0 || fromPosition >= footerItemCount || toPosition >= footerItemCount) {\n throw new IndexOutOfBoundsException(\"The given fromPosition \" + fromPosition\n + \" or toPosition \" + toPosition + \" is not within the position bounds for footer items [0 - \"\n + (footerItemCount - 1) + \"].\");\n }\n notifyItemMoved(fromPosition + headerItemCount + contentItemCount, toPosition + headerItemCount + contentItemCount);\n }",
"private void writeTasks(Project project)\n {\n Project.Tasks tasks = m_factory.createProjectTasks();\n project.setTasks(tasks);\n List<Project.Tasks.Task> list = tasks.getTask();\n\n for (Task task : m_projectFile.getTasks())\n {\n list.add(writeTask(task));\n }\n }",
"private RekordboxAnlz.BeatGridTag findTag(RekordboxAnlz anlzFile) {\n for (RekordboxAnlz.TaggedSection section : anlzFile.sections()) {\n if (section.body() instanceof RekordboxAnlz.BeatGridTag) {\n return (RekordboxAnlz.BeatGridTag) section.body();\n }\n }\n throw new IllegalArgumentException(\"No beat grid found inside analysis file \" + anlzFile);\n }"
] |
Create and serialize a JobFailure.
@param thrwbl the Throwable that occurred
@param queue the queue the job came from
@param job the Job that failed
@return the JSON representation of a new JobFailure
@throws IOException if there was an error serializing the JobFailure | [
"protected String failMsg(final Throwable thrwbl, final String queue, final Job job) throws IOException {\n final JobFailure failure = new JobFailure();\n failure.setFailedAt(new Date());\n failure.setWorker(this.name);\n failure.setQueue(queue);\n failure.setPayload(job);\n failure.setThrowable(thrwbl);\n return ObjectMapperFactory.get().writeValueAsString(failure);\n }"
] | [
"public ItemRequest<CustomField> insertEnumOption(String customField) {\n \n String path = String.format(\"/custom_fields/%s/enum_options/insert\", customField);\n return new ItemRequest<CustomField>(this, CustomField.class, path, \"POST\");\n }",
"protected void parseIntegerLists(TokenList tokens) {\n TokenList.Token t = tokens.getFirst();\n if( t == null || t.next == null )\n return;\n\n int state = 0;\n\n TokenList.Token start = null;\n TokenList.Token prev = t;\n\n boolean last = false;\n while( true ) {\n if( state == 0 ) {\n if( isVariableInteger(t) ) {\n start = t;\n state = 1;\n }\n } else if( state == 1 ) {\n // var ?\n if( isVariableInteger(t)) { // see if its explicit number sequence\n state = 2;\n } else { // just scalar integer, skip\n state = 0;\n }\n } else if ( state == 2 ) {\n // var var ....\n if( !isVariableInteger(t) ) {\n // create explicit list sequence\n IntegerSequence sequence = new IntegerSequence.Explicit(start,prev);\n VariableIntegerSequence varSequence = functions.getManagerTemp().createIntegerSequence(sequence);\n replaceSequence(tokens, varSequence, start, prev);\n state = 0;\n }\n }\n\n if( last ) {\n break;\n } else if( t.next == null ) {\n // handle the case where it is the last token in the sequence\n last = true;\n }\n prev = t;\n t = t.next;\n }\n }",
"String getFacetParamKey(String facet) {\n\n I_CmsSearchControllerFacetField fieldFacet = m_result.getController().getFieldFacets().getFieldFacetController().get(\n facet);\n if (fieldFacet != null) {\n return fieldFacet.getConfig().getParamKey();\n }\n I_CmsSearchControllerFacetRange rangeFacet = m_result.getController().getRangeFacets().getRangeFacetController().get(\n facet);\n if (rangeFacet != null) {\n return rangeFacet.getConfig().getParamKey();\n }\n I_CmsSearchControllerFacetQuery queryFacet = m_result.getController().getQueryFacet();\n if ((queryFacet != null) && queryFacet.getConfig().getName().equals(facet)) {\n return queryFacet.getConfig().getParamKey();\n }\n\n // Facet did not exist\n LOG.warn(Messages.get().getBundle().key(Messages.LOG_FACET_NOT_CONFIGURED_1, facet), new Throwable());\n\n return null;\n }",
"public void rollback() throws GitAPIException {\n try (Git git = getGit()) {\n git.reset().setMode(ResetCommand.ResetType.HARD).setRef(HEAD).call();\n }\n }",
"public List<PossibleState> bfs(int min) throws ModelException {\r\n List<PossibleState> bootStrap = new LinkedList<>();\n\r\n TransitionTarget initial = model.getInitialTarget();\r\n PossibleState initialState = new PossibleState(initial, fillInitialVariables());\r\n bootStrap.add(initialState);\n\r\n while (bootStrap.size() < min) {\r\n PossibleState state = bootStrap.remove(0);\r\n TransitionTarget nextState = state.nextState;\n\r\n if (nextState.getId().equalsIgnoreCase(\"end\")) {\r\n throw new ModelException(\"Could not achieve required bootstrap without reaching end state\");\r\n }\n\r\n //run every action in series\r\n List<Map<String, String>> product = new LinkedList<>();\r\n product.add(new HashMap<>(state.variables));\n\r\n OnEntry entry = nextState.getOnEntry();\r\n List<Action> actions = entry.getActions();\n\r\n for (Action action : actions) {\r\n for (CustomTagExtension tagExtension : tagExtensionList) {\r\n if (tagExtension.getTagActionClass().isInstance(action)) {\r\n product = tagExtension.pipelinePossibleStates(action, product);\r\n }\r\n }\r\n }\n\r\n //go through every transition and see which of the products are valid, adding them to the list\r\n List<Transition> transitions = nextState.getTransitionsList();\n\r\n for (Transition transition : transitions) {\r\n String condition = transition.getCond();\r\n TransitionTarget target = ((List<TransitionTarget>) transition.getTargets()).get(0);\n\r\n for (Map<String, String> p : product) {\r\n Boolean pass;\n\r\n if (condition == null) {\r\n pass = true;\r\n } else {\r\n //scrub the context clean so we may use it to evaluate transition conditional\r\n Context context = this.getRootContext();\r\n context.reset();\n\r\n //set up new context\r\n for (Map.Entry<String, String> e : p.entrySet()) {\r\n context.set(e.getKey(), e.getValue());\r\n }\n\r\n //evaluate condition\r\n try {\r\n pass = (Boolean) this.getEvaluator().eval(context, condition);\r\n } catch (SCXMLExpressionException ex) {\r\n pass = false;\r\n }\r\n }\n\r\n //transition condition satisfied, add to bootstrap list\r\n if (pass) {\r\n PossibleState result = new PossibleState(target, p);\r\n bootStrap.add(result);\r\n }\r\n }\r\n }\r\n }\n\r\n return bootStrap;\r\n }",
"public boolean contains(String column) {\n\t\tfor ( String columnName : columnNames ) {\n\t\t\tif ( columnName.equals( column ) ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"private String extractAndConvertTaskType(Task task)\n {\n String activityType = (String) task.getCachedValue(m_activityTypeField);\n if (activityType == null)\n {\n activityType = \"Resource Dependent\";\n }\n else\n {\n if (ACTIVITY_TYPE_MAP.containsKey(activityType))\n {\n activityType = ACTIVITY_TYPE_MAP.get(activityType);\n }\n }\n return activityType;\n }",
"public void process(Connection connection, String directory) throws Exception\n {\n connection.setAutoCommit(true);\n\n //\n // Retrieve meta data about the connection\n //\n DatabaseMetaData dmd = connection.getMetaData();\n\n String[] types =\n {\n \"TABLE\"\n };\n\n FileWriter fw = new FileWriter(directory);\n PrintWriter pw = new PrintWriter(fw);\n\n pw.println(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\");\n pw.println();\n pw.println(\"<database>\");\n\n ResultSet tables = dmd.getTables(null, null, null, types);\n while (tables.next() == true)\n {\n processTable(pw, connection, tables.getString(\"TABLE_NAME\"));\n }\n\n pw.println(\"</database>\");\n\n pw.close();\n\n tables.close();\n }",
"@AsParameterConverter\n\tpublic Trader retrieveTrader(String name) {\n\t\tfor (Trader trader : traders) {\n\t\t\tif (trader.getName().equals(name)) {\n\t\t\t\treturn trader;\n\t\t\t}\n\t\t}\n\t\treturn mockTradePersister().retrieveTrader(name);\n\t}"
] |
Returns a matrix full of ones | [
"public static Info ones( final Variable A , final Variable B , ManagerTempVariables manager) {\n Info ret = new Info();\n final VariableMatrix output = manager.createMatrix();\n ret.output = output;\n\n if( A instanceof VariableInteger && B instanceof VariableInteger ) {\n ret.op = new Operation(\"ones-ii\") {\n @Override\n public void process() {\n int numRows = ((VariableInteger)A).value;\n int numCols = ((VariableInteger)B).value;\n output.matrix.reshape(numRows,numCols);\n CommonOps_DDRM.fill(output.matrix, 1);\n }\n };\n } else {\n throw new RuntimeException(\"Expected two integers got \"+A+\" \"+B);\n }\n\n return ret;\n }"
] | [
"private TableAlias createTableAlias(String aTable, String aPath, String aUserAlias)\r\n {\r\n\t\tif (aUserAlias == null)\r\n\t\t{\r\n\t\t\treturn createTableAlias(aTable, aPath);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn createTableAlias(aTable, aUserAlias + ALIAS_SEPARATOR + aPath);\r\n\t\t}\r\n }",
"public void copyTo(int srcOffset, byte[] destArray, int destOffset, int size) {\n int cursor = destOffset;\n for (ByteBuffer bb : toDirectByteBuffers(srcOffset, size)) {\n int bbSize = bb.remaining();\n if ((cursor + bbSize) > destArray.length)\n throw new ArrayIndexOutOfBoundsException(String.format(\"cursor + bbSize = %,d\", cursor + bbSize));\n bb.get(destArray, cursor, bbSize);\n cursor += bbSize;\n }\n }",
"public float getNormalX(int vertex) {\n if (!hasNormals()) {\n throw new IllegalStateException(\"mesh has no normals\");\n }\n \n checkVertexIndexBounds(vertex);\n \n return m_normals.getFloat(vertex * 3 * SIZEOF_FLOAT);\n }",
"public B importContext(AbstractContext context){\n Objects.requireNonNull(context);\n return importContext(context, false);\n }",
"public void processCalendar(Row calendarRow, Map<Integer, Row> workPatternMap, Map<Integer, List<Row>> workPatternAssignmentMap, Map<Integer, List<Row>> exceptionAssignmentMap, Map<Integer, List<Row>> timeEntryMap, Map<Integer, DayType> exceptionTypeMap)\n {\n //\n // Create the calendar and add the default working hours\n //\n ProjectCalendar calendar = m_project.addCalendar();\n Integer dominantWorkPatternID = calendarRow.getInteger(\"DOMINANT_WORK_PATTERN\");\n calendar.setUniqueID(calendarRow.getInteger(\"CALENDARID\"));\n processWorkPattern(calendar, dominantWorkPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);\n calendar.setName(calendarRow.getString(\"NAMK\"));\n\n //\n // Add any additional working weeks\n //\n List<Row> rows = workPatternAssignmentMap.get(calendar.getUniqueID());\n if (rows != null)\n {\n for (Row row : rows)\n {\n Integer workPatternID = row.getInteger(\"WORK_PATTERN\");\n if (!workPatternID.equals(dominantWorkPatternID))\n {\n ProjectCalendarWeek week = calendar.addWorkWeek();\n week.setDateRange(new DateRange(row.getDate(\"START_DATE\"), row.getDate(\"END_DATE\")));\n processWorkPattern(week, workPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);\n }\n }\n }\n\n //\n // Add exceptions - not sure how exceptions which turn non-working days into working days are handled by Asta - if at all?\n //\n rows = exceptionAssignmentMap.get(calendar.getUniqueID());\n if (rows != null)\n {\n for (Row row : rows)\n {\n Date startDate = row.getDate(\"STARU_DATE\");\n Date endDate = row.getDate(\"ENE_DATE\");\n calendar.addCalendarException(startDate, endDate);\n }\n }\n\n m_eventManager.fireCalendarReadEvent(calendar);\n }",
"public String addPostRunDependent(FunctionalTaskItem dependent) {\n Objects.requireNonNull(dependent);\n return this.taskGroup().addPostRunDependent(dependent);\n }",
"public T removeModule(final String moduleName, final String slot, final byte[] existingHash) {\n final ContentItem item = createModuleItem(moduleName, slot, NO_CONTENT);\n addContentModification(createContentModification(item, ModificationType.REMOVE, existingHash));\n return returnThis();\n }",
"public void forAllForeignkeys(String template, Properties attributes) throws XDocletException\r\n {\r\n for (Iterator it = _curTableDef.getForeignkeys(); it.hasNext(); )\r\n {\r\n _curForeignkeyDef = (ForeignkeyDef)it.next();\r\n generate(template);\r\n }\r\n _curForeignkeyDef = null;\r\n }",
"public double[] getZeroRates(double[] maturities)\n\t{\n\t\tdouble[] values = new double[maturities.length];\n\n\t\tfor(int i=0; i<maturities.length; i++) {\n\t\t\tvalues[i] = getZeroRate(maturities[i]);\n\t\t}\n\n\t\treturn values;\n\t}"
] |
Gets next node in the DAG which has no dependency or all of it's dependencies are resolved and
ready to be consumed.
@return next node or null if all the nodes have been explored or no node is available at this moment. | [
"public NodeT getNext() {\n String nextItemKey = queue.poll();\n if (nextItemKey == null) {\n return null;\n }\n return nodeTable.get(nextItemKey);\n }"
] | [
"public void ifPropertyValueEquals(String template, Properties attributes) throws XDocletException\r\n {\r\n String value = getPropertyValue(attributes.getProperty(ATTRIBUTE_LEVEL), attributes.getProperty(ATTRIBUTE_NAME));\r\n String expected = attributes.getProperty(ATTRIBUTE_VALUE);\r\n\r\n if (value == null)\r\n {\r\n value = attributes.getProperty(ATTRIBUTE_DEFAULT);\r\n }\r\n if (expected.equals(value))\r\n {\r\n generate(template);\r\n }\r\n }",
"public static final long getLong(InputStream is) throws IOException\n {\n byte[] data = new byte[8];\n is.read(data);\n return getLong(data, 0);\n }",
"public IntervalFrequency getRefreshFrequency() {\n switch (mRefreshInterval) {\n case REALTIME_REFRESH_INTERVAL:\n return IntervalFrequency.REALTIME;\n case HIGH_REFRESH_INTERVAL:\n return IntervalFrequency.HIGH;\n case LOW_REFRESH_INTERVAL:\n return IntervalFrequency.LOW;\n case MEDIUM_REFRESH_INTERVAL:\n return IntervalFrequency.MEDIUM;\n default:\n return IntervalFrequency.NONE;\n }\n }",
"public OperationBuilder addInputStream(final InputStream in) {\n Assert.checkNotNullParam(\"in\", in);\n if (inputStreams == null) {\n inputStreams = new ArrayList<InputStream>();\n }\n inputStreams.add(in);\n return this;\n }",
"private List<Object> doQueryAndInitializeNonLazyCollections(\n\t\t\tSharedSessionContractImplementor session,\n\t\t\tQueryParameters qp,\n\t\t\tOgmLoadingContext ogmLoadingContext,\n\t\t\tboolean returnProxies) {\n\n\n\t\t//TODO handles the read only\n\t\tfinal PersistenceContext persistenceContext = session.getPersistenceContext();\n\t\tboolean defaultReadOnlyOrig = persistenceContext.isDefaultReadOnly();\n\t\tpersistenceContext.beforeLoad();\n\t\tList<Object> result;\n\t\ttry {\n\t\t\ttry {\n\t\t\t\tresult = doQuery(\n\t\t\t\t\t\tsession,\n\t\t\t\t\t\tqp,\n\t\t\t\t\t\togmLoadingContext,\n\t\t\t\t\t\treturnProxies\n\t\t\t\t);\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tpersistenceContext.afterLoad();\n\t\t\t}\n\t\t\tpersistenceContext.initializeNonLazyCollections();\n\t\t}\n\t\tfinally {\n\t\t\t// Restore the original default\n\t\t\tpersistenceContext.setDefaultReadOnly( defaultReadOnlyOrig );\n\t\t}\n\n\t\tlog.debug( \"done entity load\" );\n\t\treturn result;\n\t}",
"public static void validateZip(File file) throws IOException {\n ZipInputStream zipInput = new ZipInputStream(new FileInputStream(file));\n ZipEntry zipEntry = zipInput.getNextEntry();\n\n while (zipEntry != null) {\n zipEntry = zipInput.getNextEntry();\n }\n\n try {\n if (zipInput != null) {\n zipInput.close();\n }\n } catch (IOException e) {\n }\n }",
"private void readTaskCustomPropertyDefinitions(Tasks gpTasks)\n {\n for (Taskproperty definition : gpTasks.getTaskproperties().getTaskproperty())\n {\n //\n // Ignore everything but custom values\n //\n if (!\"custom\".equals(definition.getType()))\n {\n continue;\n }\n\n //\n // Find the next available field of the correct type.\n //\n String type = definition.getValuetype();\n FieldType fieldType = TASK_PROPERTY_TYPES.get(type).getField();\n\n //\n // If we have run out of fields of the right type, try using a text field.\n //\n if (fieldType == null)\n {\n fieldType = TASK_PROPERTY_TYPES.get(\"text\").getField();\n }\n\n //\n // If we actually have a field available, set the alias to match\n // the name used in GanttProject.\n //\n if (fieldType != null)\n {\n CustomField field = m_projectFile.getCustomFields().getCustomField(fieldType);\n field.setAlias(definition.getName());\n String defaultValue = definition.getDefaultvalue();\n if (defaultValue != null && defaultValue.isEmpty())\n {\n defaultValue = null;\n }\n m_taskPropertyDefinitions.put(definition.getId(), new Pair<FieldType, String>(fieldType, defaultValue));\n }\n }\n }",
"public void add(T value) {\n Element<T> element = new Element<T>(bundle, value);\n element.previous = tail;\n if (tail != null) tail.next = element;\n tail = element;\n if (head == null) head = element;\n }",
"public static DMatrixRMaj convert(DMatrixRBlock src , DMatrixRMaj dst )\n {\n return ConvertDMatrixStruct.convert(src,dst);\n }"
] |
Compute "sent" date
@param msg Message to take sent date from. May be null to use default
@param defaultVal Default if sent date is not present
@return Sent date or now if no date could be found | [
"private static Date getSentDate(MimeMessage msg, Date defaultVal) {\r\n if (msg == null) {\r\n return defaultVal;\r\n }\r\n try {\r\n Date sentDate = msg.getSentDate();\r\n if (sentDate == null) {\r\n return defaultVal;\r\n } else {\r\n return sentDate;\r\n }\r\n } catch (MessagingException me) {\r\n return new Date();\r\n }\r\n }"
] | [
"public boolean mapsCell(String cell) {\n return mappedCells.stream().anyMatch(x -> x.equals(cell));\n }",
"public static void addActionsTo(\n SourceBuilder code,\n Set<MergeAction> mergeActions,\n boolean forBuilder) {\n SetMultimap<String, String> nounsByVerb = TreeMultimap.create();\n mergeActions.forEach(mergeAction -> {\n if (forBuilder || !mergeAction.builderOnly) {\n nounsByVerb.put(mergeAction.verb, mergeAction.noun);\n }\n });\n List<String> verbs = ImmutableList.copyOf(nounsByVerb.keySet());\n String lastVerb = getLast(verbs, null);\n for (String verb : nounsByVerb.keySet()) {\n code.add(\", %s%s\", (verbs.size() > 1 && verb.equals(lastVerb)) ? \"and \" : \"\", verb);\n List<String> nouns = ImmutableList.copyOf(nounsByVerb.get(verb));\n for (int i = 0; i < nouns.size(); ++i) {\n String separator = (i == 0) ? \"\" : (i == nouns.size() - 1) ? \" and\" : \",\";\n code.add(\"%s %s\", separator, nouns.get(i));\n }\n }\n }",
"private String formatRate(Rate value)\n {\n String result = null;\n if (value != null)\n {\n StringBuilder buffer = new StringBuilder(m_formats.getCurrencyFormat().format(value.getAmount()));\n buffer.append(\"/\");\n buffer.append(formatTimeUnit(value.getUnits()));\n result = buffer.toString();\n }\n return (result);\n }",
"public boolean shouldCache(String requestUri) {\n\t\tString uri = requestUri.toLowerCase();\n\t\treturn checkContains(uri, cacheIdentifiers) || checkSuffixes(uri, cacheSuffixes);\n\t}",
"protected Object[] escape(final Format format, Object... args) {\n // Transformer that escapes HTML,XML,JSON strings\n Transformer<Object, Object> escapingTransformer = new Transformer<Object, Object>() {\n @Override\n public Object transform(Object object) {\n return format.escapeValue(object);\n }\n };\n List<Object> list = Arrays.asList(ArrayUtils.clone(args));\n CollectionUtils.transform(list, escapingTransformer);\n return list.toArray();\n }",
"private void persistEnabledVersion(long version) throws PersistenceFailureException {\n File disabledMarker = getDisabledMarkerFile(version);\n if (disabledMarker.exists()) {\n if (!disabledMarker.delete()) {\n throw new PersistenceFailureException(\"Failed to create the disabled marker at path: \" +\n disabledMarker.getAbsolutePath() + \"\\nThe store/version \" +\n \"will remain enabled only until the next restart.\");\n }\n }\n }",
"public static <K, V, T> Map<K, List<Versioned<V>>> getAll(Store<K, V, T> storageEngine,\n Iterable<K> keys,\n Map<K, T> transforms) {\n Map<K, List<Versioned<V>>> result = newEmptyHashMap(keys);\n for(K key: keys) {\n List<Versioned<V>> value = storageEngine.get(key,\n transforms != null ? transforms.get(key)\n : null);\n if(!value.isEmpty())\n result.put(key, value);\n }\n return result;\n }",
"@Override\n\tpublic void writeValue(TimeValue value, Resource resource)\n\t\t\tthrows RDFHandlerException {\n\t\tthis.rdfWriter.writeTripleValueObject(resource, RdfWriter.RDF_TYPE,\n\t\t\t\tRdfWriter.WB_TIME_VALUE);\n\n\t\tthis.rdfWriter.writeTripleValueObject(resource, RdfWriter.WB_TIME,\n\t\t\t\tTimeValueConverter.getTimeLiteral(value, this.rdfWriter));\n\n\t\tthis.rdfWriter.writeTripleIntegerObject(resource,\n\t\t\t\tRdfWriter.WB_TIME_PRECISION, value.getPrecision());\n\t\tthis.rdfWriter.writeTripleIntegerObject(resource,\n\t\t\t\tRdfWriter.WB_TIME_TIMEZONE,\n\t\t\t\tvalue.getTimezoneOffset());\n\t\tthis.rdfWriter.writeTripleUriObject(resource,\n\t\t\t\tRdfWriter.WB_TIME_CALENDAR_MODEL,\n\t\t\t\tvalue.getPreferredCalendarModel());\n\t}",
"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 }"
] |
Associate the batched Children with their owner object.
Loop over owners | [
"protected void associateBatched(Collection owners, Collection children)\r\n {\r\n ObjectReferenceDescriptor ord = getObjectReferenceDescriptor();\r\n ClassDescriptor cld = getOwnerClassDescriptor();\r\n Object owner;\r\n Object relatedObject;\r\n Object fkValues[];\r\n Identity id;\r\n PersistenceBroker pb = getBroker();\r\n PersistentField field = ord.getPersistentField();\r\n Class topLevelClass = pb.getTopLevelClass(ord.getItemClass());\r\n HashMap childrenMap = new HashMap(children.size());\r\n\r\n\r\n for (Iterator it = children.iterator(); it.hasNext(); )\r\n {\r\n relatedObject = it.next();\r\n childrenMap.put(pb.serviceIdentity().buildIdentity(relatedObject), relatedObject);\r\n }\r\n\r\n for (Iterator it = owners.iterator(); it.hasNext(); )\r\n {\r\n owner = it.next();\r\n fkValues = ord.getForeignKeyValues(owner,cld);\r\n if (isNull(fkValues))\r\n {\r\n field.set(owner, null);\r\n continue;\r\n }\r\n id = pb.serviceIdentity().buildIdentity(null, topLevelClass, fkValues);\r\n relatedObject = childrenMap.get(id);\r\n field.set(owner, relatedObject);\r\n }\r\n }"
] | [
"protected void eigenvalue2by2( int x1 ) {\n double a = diag[x1];\n double b = off[x1];\n double c = diag[x1+1];\n\n // normalize to reduce overflow\n double absA = Math.abs(a);\n double absB = Math.abs(b);\n double absC = Math.abs(c);\n\n double scale = absA > absB ? absA : absB;\n if( absC > scale ) scale = absC;\n\n // see if it is a pathological case. the diagonal must already be zero\n // and the eigenvalues are all zero. so just return\n if( scale == 0 ) {\n off[x1] = 0;\n diag[x1] = 0;\n diag[x1+1] = 0;\n return;\n }\n\n a /= scale;\n b /= scale;\n c /= scale;\n\n eigenSmall.symm2x2_fast(a,b,c);\n\n off[x1] = 0;\n diag[x1] = scale*eigenSmall.value0.real;\n diag[x1+1] = scale*eigenSmall.value1.real;\n }",
"public Duration getFinishSlack()\n {\n Duration finishSlack = (Duration) getCachedValue(TaskField.FINISH_SLACK);\n if (finishSlack == null)\n {\n Duration duration = getDuration();\n if (duration != null)\n {\n finishSlack = DateHelper.getVariance(this, getEarlyFinish(), getLateFinish(), duration.getUnits());\n set(TaskField.FINISH_SLACK, finishSlack);\n }\n }\n return (finishSlack);\n }",
"public LatLong getDestinationPoint(double bearing, double distance) {\n\n double brng = Math.toRadians(bearing);\n\n double lat1 = latToRadians();\n double lon1 = longToRadians();\n\n double lat2 = Math.asin(Math.sin(lat1)\n * Math.cos(distance / EarthRadiusMeters)\n + Math.cos(lat1) * Math.sin(distance / EarthRadiusMeters)\n * Math.cos(brng));\n\n double lon2 = lon1 + Math.atan2(Math.sin(brng)\n * Math.sin(distance / EarthRadiusMeters) * Math.cos(lat1),\n Math.cos(distance / EarthRadiusMeters)\n - Math.sin(lat1) * Math.sin(lat2));\n\n return new LatLong(Math.toDegrees(lat2), Math.toDegrees(lon2));\n\n }",
"@UiThread\n private int getFlatParentPosition(int parentPosition) {\n int parentCount = 0;\n int listItemCount = mFlatItemList.size();\n for (int i = 0; i < listItemCount; i++) {\n if (mFlatItemList.get(i).isParent()) {\n parentCount++;\n\n if (parentCount > parentPosition) {\n return i;\n }\n }\n }\n\n return INVALID_FLAT_POSITION;\n }",
"public static base_response add(nitro_service client, autoscaleprofile resource) throws Exception {\n\t\tautoscaleprofile addresource = new autoscaleprofile();\n\t\taddresource.name = resource.name;\n\t\taddresource.type = resource.type;\n\t\taddresource.url = resource.url;\n\t\taddresource.apikey = resource.apikey;\n\t\taddresource.sharedsecret = resource.sharedsecret;\n\t\treturn addresource.add_resource(client);\n\t}",
"static String guessEntityTypeFromId(String id) {\n\t\tif(id.isEmpty()) {\n\t\t\tthrow new IllegalArgumentException(\"Entity ids should not be empty.\");\n\t\t}\n\t\tswitch (id.charAt(0)) {\n\t\t\tcase 'L':\n\t\t\t\tif(id.contains(\"-F\")) {\n\t\t\t\t\treturn JSON_ENTITY_TYPE_FORM;\n\t\t\t\t} else if(id.contains(\"-S\")) {\n\t\t\t\t\treturn JSON_ENTITY_TYPE_SENSE;\n\t\t\t\t} else {\n\t\t\t\t\treturn JSON_ENTITY_TYPE_LEXEME;\n\t\t\t\t}\n\t\t\tcase 'P':\n\t\t\t\treturn JSON_ENTITY_TYPE_PROPERTY;\n\t\t\tcase 'Q':\n\t\t\t\treturn JSON_ENTITY_TYPE_ITEM;\n\t\t\tdefault:\n\t\t\t\tthrow new IllegalArgumentException(\"Entity id \\\"\" + id + \"\\\" is not supported.\");\n\t\t}\n\t}",
"protected Element createTextElement(String data, float width)\n {\n Element el = createTextElement(width);\n Text text = doc.createTextNode(data);\n el.appendChild(text);\n return el;\n }",
"public void logError(String message, Object sender) {\n getEventManager().sendEvent(this, IErrorEvents.class, \"onError\", new Object[] { message, sender });\n }",
"public void run() {\r\n\t\tConnectionHandle connection = null;\r\n\t\tlong tmp;\r\n\t\tlong nextCheckInMs = this.maxAgeInMs;\r\n\r\n\t\tint partitionSize= this.partition.getAvailableConnections();\r\n\t\tlong currentTime = System.currentTimeMillis();\r\n\t\tfor (int i=0; i < partitionSize; i++){\r\n\t\t\ttry {\r\n\t\t\t\tconnection = this.partition.getFreeConnections().poll();\r\n\r\n\t\t\t\tif (connection != null){\r\n\t\t\t\t\tconnection.setOriginatingPartition(this.partition);\r\n\r\n\t\t\t\t\ttmp = this.maxAgeInMs - (currentTime - connection.getConnectionCreationTimeInMs()); \r\n\r\n\t\t\t\t\tif (tmp < nextCheckInMs){\r\n\t\t\t\t\t\tnextCheckInMs = tmp; \r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (connection.isExpired(currentTime)){\r\n\t\t\t\t\t\t// kill off this connection\r\n\t\t\t\t\t\tcloseConnection(connection);\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (this.lifoMode){\r\n\t\t\t\t\t\t// we can't put it back normally or it will end up in front again.\r\n\t\t\t\t\t\tif (!(connection.getOriginatingPartition().getFreeConnections().offer(connection))){\r\n\t\t\t\t\t\t\tconnection.internalClose();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthis.pool.putConnectionBackInPartition(connection);\r\n\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\tThread.sleep(20L); // test slowly, this is not an operation that we're in a hurry to deal with (avoid CPU spikes)...\r\n\t\t\t\t}\r\n\t\t\t} catch (Throwable e) {\r\n\t\t\t\t\tlogger.error(\"Connection max age thread exception.\", e);\r\n\t\t\t}\r\n\r\n\t\t} // throw it back on the queue\r\n\r\n\t}"
] |
Gets the gradient at the current point, computed on the given batch of examples.
@param batch A set of indices indicating the examples over which the gradient should be computed.
@param gradient The output gradient, a vector of partial derivatives. | [
"public void getGradient(int[] batch, double[] gradient) {\n for (int i=0; i<batch.length; i++) {\n addGradient(i, gradient);\n }\n }"
] | [
"@Override\n public Iterator<BoxItem.Info> iterator() {\n URL url = GET_ITEMS_URL.build(this.getAPI().getBaseURL(), BoxFolder.this.getID());\n return new BoxItemIterator(BoxFolder.this.getAPI(), url);\n }",
"public String getVertexString() {\n if (tail() != null) {\n return \"\" + tail().index + \"-\" + head().index;\n } else {\n return \"?-\" + head().index;\n }\n }",
"private void addJoin(TableAlias left, Object[] leftKeys, TableAlias right, Object[] rightKeys, boolean outer,\r\n String name)\r\n {\r\n TableAlias extAlias, rightCopy;\r\n\r\n left.addJoin(new Join(left, leftKeys, right, rightKeys, outer, name));\r\n\r\n // build join between left and extents of right\r\n if (right.hasExtents())\r\n {\r\n for (int i = 0; i < right.extents.size(); i++)\r\n {\r\n extAlias = (TableAlias) right.extents.get(i);\r\n FieldDescriptor[] extKeys = getExtentFieldDescriptors(extAlias, (FieldDescriptor[]) rightKeys);\r\n\r\n left.addJoin(new Join(left, leftKeys, extAlias, extKeys, true, name));\r\n }\r\n }\r\n\r\n // we need to copy the alias on the right for each extent on the left\r\n if (left.hasExtents())\r\n {\r\n for (int i = 0; i < left.extents.size(); i++)\r\n {\r\n extAlias = (TableAlias) left.extents.get(i);\r\n FieldDescriptor[] extKeys = getExtentFieldDescriptors(extAlias, (FieldDescriptor[]) leftKeys);\r\n rightCopy = right.copy(\"C\" + i);\r\n\r\n // copies are treated like normal extents\r\n right.extents.add(rightCopy);\r\n right.extents.addAll(rightCopy.extents);\r\n\r\n addJoin(extAlias, extKeys, rightCopy, rightKeys, true, name);\r\n }\r\n }\r\n }",
"public IExternalAccess getAgentsExternalAccess(String agent_name) {\n\n return cmsService.getExternalAccess(getAgentID(agent_name)).get(\n new ThreadSuspendable());\n }",
"protected DatabaseConnection getSavedConnection() {\n\t\tNestedConnection nested = specialConnection.get();\n\t\tif (nested == null) {\n\t\t\treturn null;\n\t\t} else {\n\t\t\treturn nested.connection;\n\t\t}\n\t}",
"public void execute(CommandHandler handler,\n int timeout,\n TimeUnit unit) throws\n CommandLineException,\n InterruptedException, ExecutionException, TimeoutException {\n ExecutableBuilder builder = new ExecutableBuilder() {\n CommandContext c = newTimeoutCommandContext(ctx);\n @Override\n public Executable build() {\n return () -> {\n handler.handle(c);\n };\n }\n\n @Override\n public CommandContext getCommandContext() {\n return c;\n }\n };\n execute(builder, timeout, unit);\n }",
"private void readProjectExtendedAttributes(Project project)\n {\n Project.ExtendedAttributes attributes = project.getExtendedAttributes();\n if (attributes != null)\n {\n for (Project.ExtendedAttributes.ExtendedAttribute ea : attributes.getExtendedAttribute())\n {\n readFieldAlias(ea);\n }\n }\n }",
"public static int checkVlen(int i) {\n int count = 0;\n if (i >= -112 && i <= 127) {\n return 1;\n } else {\n int len = -112;\n if (i < 0) {\n i ^= -1L; // take one's complement'\n len = -120;\n }\n\n long tmp = i;\n while (tmp != 0) {\n tmp = tmp >> 8;\n len--;\n }\n\n count++;\n\n len = (len < -120) ? -(len + 120) : -(len + 112);\n\n while (len != 0) {\n count++;\n len--;\n }\n\n return count;\n }\n }",
"protected synchronized Object materializeSubject() throws PersistenceBrokerException\r\n\t{\r\n\t\tTemporaryBrokerWrapper tmp = getBroker();\r\n try\r\n\t\t{\r\n\t\t\tObject realSubject = tmp.broker.getObjectByIdentity(_id);\r\n\t\t\tif (realSubject == null)\r\n\t\t\t{\r\n\t\t\t\tLoggerFactory.getLogger(IndirectionHandler.class).warn(\r\n\t\t\t\t\t\t\"Can not materialize object for Identity \" + _id + \" - using PBKey \" + getBrokerKey());\r\n\t\t\t}\r\n\t\t\treturn realSubject;\r\n\t\t} catch (Exception ex)\r\n\t\t{\r\n\t\t\tthrow new PersistenceBrokerException(ex);\r\n\t\t} finally\r\n\t\t{\r\n\t\t\ttmp.close();\r\n\t\t}\r\n\t}"
] |
Returns true if the ASTNode is a declaration of a closure, either as a declaration
or a field.
@param expression
the target expression
@return
as described | [
"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 }"
] | [
"ProtectionDomain getProtectionDomainForProxy(ProtectionDomain domain) {\n if (domain.getCodeSource() == null) {\n // no codesource to cache on\n return create(domain);\n }\n ProtectionDomain proxyProtectionDomain = proxyProtectionDomains.get(domain.getCodeSource());\n if (proxyProtectionDomain == null) {\n // as this is not atomic create() may be called multiple times for the same domain\n // we ignore that\n proxyProtectionDomain = create(domain);\n ProtectionDomain existing = proxyProtectionDomains.putIfAbsent(domain.getCodeSource(), proxyProtectionDomain);\n if (existing != null) {\n proxyProtectionDomain = existing;\n }\n }\n return proxyProtectionDomain;\n }",
"public static bridgegroup_nsip_binding[] get(nitro_service service, Long id) throws Exception{\n\t\tbridgegroup_nsip_binding obj = new bridgegroup_nsip_binding();\n\t\tobj.set_id(id);\n\t\tbridgegroup_nsip_binding response[] = (bridgegroup_nsip_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"public void setWorkDir(String dir) throws IOException\r\n {\r\n File workDir = new File(dir);\r\n\r\n if (!workDir.exists() || !workDir.canWrite() || !workDir.canRead())\r\n {\r\n throw new IOException(\"Cannot access directory \"+dir);\r\n }\r\n _workDir = workDir;\r\n }",
"private double convertTenor(int maturityInMonths, int tenorInMonths) {\r\n\t\tSchedule schedule = fixMetaSchedule.generateSchedule(referenceDate, maturityInMonths, tenorInMonths);\r\n\t\treturn schedule.getPayment(schedule.getNumberOfPeriods()-1);\r\n\t}",
"private Map<String, String> fillInitialVariables() {\r\n Map<String, TransitionTarget> targets = model.getChildren();\n\r\n Set<String> variables = new HashSet<>();\r\n for (TransitionTarget target : targets.values()) {\r\n OnEntry entry = target.getOnEntry();\r\n List<Action> actions = entry.getActions();\r\n for (Action action : actions) {\r\n if (action instanceof Assign) {\r\n String variable = ((Assign) action).getName();\r\n variables.add(variable);\r\n } else if (action instanceof SetAssignExtension.SetAssignTag) {\r\n String variable = ((SetAssignExtension.SetAssignTag) action).getName();\r\n variables.add(variable);\r\n }\r\n }\r\n }\n\r\n Map<String, String> result = new HashMap<>();\r\n for (String variable : variables) {\r\n result.put(variable, \"\");\r\n }\n\r\n return result;\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}",
"Response put(URI uri, InputStream instream, String contentType) {\n HttpConnection connection = Http.PUT(uri, contentType);\n\n connection.setRequestBody(instream);\n\n return executeToResponse(connection);\n }",
"public static Result get(XmlFileModel key)\n {\n String cacheKey = getKey(key);\n\n Result result = null;\n CacheDocument reference = map.get(cacheKey);\n\n if (reference == null)\n return new Result(false, null);\n\n if (reference.parseFailure)\n return new Result(true, null);\n\n Document document = reference.getDocument();\n if (document == null)\n LOG.info(\"Cache miss on XML document: \" + cacheKey);\n\n return new Result(false, document);\n }",
"static DocumentVersionInfo getRemoteVersionInfo(final BsonDocument remoteDocument) {\n final BsonDocument version = getDocumentVersionDoc(remoteDocument);\n return new DocumentVersionInfo(\n version,\n remoteDocument != null\n ? BsonUtils.getDocumentId(remoteDocument) : null\n );\n }"
] |
This method returns the mapped certificate for a hostname, or generates a "standard"
SSL server certificate issued by the CA to the supplied subject if no mapping has been
created. This is not a true duplication, just a shortcut method
that is adequate for web browsers.
@param hostname
@return
@throws CertificateParsingException
@throws InvalidKeyException
@throws CertificateExpiredException
@throws CertificateNotYetValidException
@throws SignatureException
@throws CertificateException
@throws NoSuchAlgorithmException
@throws NoSuchProviderException
@throws KeyStoreException
@throws UnrecoverableKeyException | [
"public X509Certificate getMappedCertificateForHostname(String hostname) throws CertificateParsingException, InvalidKeyException, CertificateExpiredException, CertificateNotYetValidException, SignatureException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, KeyStoreException, UnrecoverableKeyException\n\t{\n\t\tString subject = getSubjectForHostname(hostname);\n\n\t\tString thumbprint = _subjectMap.get(subject);\n\n\t\tif(thumbprint == null) {\n\n\t\t\tKeyPair kp = getRSAKeyPair();\n\n\t\t\tX509Certificate newCert = CertificateCreator.generateStdSSLServerCertificate(kp.getPublic(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t getSigningCert(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t getSigningPrivateKey(),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t subject);\n\n\t\t\taddCertAndPrivateKey(hostname, newCert, kp.getPrivate());\n\n\t\t\tthumbprint = ThumbprintUtil.getThumbprint(newCert);\n\n\t\t\t_subjectMap.put(subject, thumbprint);\n\n\t\t\tif(persistImmediately) {\n\t\t\t\tpersist();\n\t\t\t}\n\n\t\t\treturn newCert;\n\n\t\t}\n return getCertificateByAlias(thumbprint);\n\n\n\t}"
] | [
"public Metadata replace(String path, String value) {\n this.values.set(this.pathToProperty(path), value);\n this.addOp(\"replace\", path, value);\n return this;\n }",
"public void addHiDpiImage(String factor, CmsJspImageBean image) {\n\n if (m_hiDpiImages == null) {\n m_hiDpiImages = CmsCollectionsGenericWrapper.createLazyMap(new CmsScaleHiDpiTransformer());\n }\n m_hiDpiImages.put(factor, image);\n }",
"public void setLabel(String label) {\n\n int ix = lstSizes.indexOf(label);\n if (ix != -1) {\n setLabel(ix);\n }\n }",
"public List<String> asList() {\n final List<String> result = new ArrayList<>();\n for (Collection<Argument> args : map.values()) {\n for (Argument arg : args) {\n result.add(arg.asCommandLineArgument());\n }\n }\n return result;\n }",
"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 }",
"public static String compressedListOfPartitionsInZone(final Cluster cluster, int zoneId) {\n Map<Integer, Integer> idToRunLength = PartitionBalanceUtils.getMapOfContiguousPartitions(cluster,\n zoneId);\n\n StringBuilder sb = new StringBuilder();\n sb.append(\"[\");\n boolean first = true;\n Set<Integer> sortedInitPartitionIds = new TreeSet<Integer>(idToRunLength.keySet());\n for(int initPartitionId: sortedInitPartitionIds) {\n if(!first) {\n sb.append(\", \");\n } else {\n first = false;\n }\n\n int runLength = idToRunLength.get(initPartitionId);\n if(runLength == 1) {\n sb.append(initPartitionId);\n } else {\n int endPartitionId = (initPartitionId + runLength - 1)\n % cluster.getNumberOfPartitions();\n sb.append(initPartitionId).append(\"-\").append(endPartitionId);\n }\n }\n sb.append(\"]\");\n\n return sb.toString();\n }",
"protected static CallableStatement memorize(final CallableStatement target, final ConnectionHandle connectionHandle) {\n\t\treturn (CallableStatement) Proxy.newProxyInstance(\n\t\t\t\tCallableStatementProxy.class.getClassLoader(),\n\t\t\t\tnew Class[] {CallableStatementProxy.class},\n\t\t\t\tnew MemorizeTransactionProxy(target, connectionHandle));\n\t}",
"public String tag(ImapRequestLineReader request) throws ProtocolException {\n CharacterValidator validator = new TagCharValidator();\n return consumeWord(request, validator);\n }",
"private void initPatternControllers() {\r\n\r\n m_patternControllers.put(PatternType.NONE, new CmsPatternPanelNoneController());\r\n m_patternControllers.put(PatternType.DAILY, new CmsPatternPanelDailyController(m_model, this));\r\n m_patternControllers.put(PatternType.WEEKLY, new CmsPatternPanelWeeklyController(m_model, this));\r\n m_patternControllers.put(PatternType.MONTHLY, new CmsPatternPanelMonthlyController(m_model, this));\r\n m_patternControllers.put(PatternType.YEARLY, new CmsPatternPanelYearlyController(m_model, this));\r\n // m_patternControllers.put(PatternType.INDIVIDUAL, new CmsPatternPanelIndividualController(m_model, this));\r\n }"
] |
Gets id of a property and creates the new one if necessary.
@param txn transaction
@param propertyName name of the property.
@param allowCreate if set to true and if there is no property named as propertyName,
create the new id for the propertyName.
@return < 0 if there is no such property and create=false, else id of the property | [
"public int getPropertyId(@NotNull final PersistentStoreTransaction txn, @NotNull final String propertyName, final boolean allowCreate) {\n return allowCreate ? propertyIds.getOrAllocateId(txn, propertyName) : propertyIds.getId(txn, propertyName);\n }"
] | [
"private HashMap<String, StoreDefinition> makeStoreDefinitionMap(List<StoreDefinition> storeDefs) {\n HashMap<String, StoreDefinition> storeDefMap = new HashMap<String, StoreDefinition>();\n for(StoreDefinition storeDef: storeDefs)\n storeDefMap.put(storeDef.getName(), storeDef);\n return storeDefMap;\n }",
"public static String replaceHtmlEntities(String content, Map<String, Character> map) {\n \n for (Entry<String, Character> entry : escapeStrings.entrySet()) {\n \n if (content.indexOf(entry.getKey()) != -1) {\n content = content.replace(entry.getKey(), String.valueOf(entry.getValue()));\n }\n \n }\n \n return content;\n }",
"static PathAddress toPathAddress(String domain, ImmutableManagementResourceRegistration registry, ObjectName name) {\n if (!name.getDomain().equals(domain)) {\n return PathAddress.EMPTY_ADDRESS;\n }\n if (name.equals(ModelControllerMBeanHelper.createRootObjectName(domain))) {\n return PathAddress.EMPTY_ADDRESS;\n }\n final Hashtable<String, String> properties = name.getKeyPropertyList();\n return searchPathAddress(PathAddress.EMPTY_ADDRESS, registry, properties);\n }",
"private static String removeLastDot(final String pkgName) {\n\t\treturn pkgName.charAt(pkgName.length() - 1) == Characters.DOT ? pkgName.substring(0, pkgName.length() - 1) : pkgName;\n\t}",
"public TaskProvider<GenerateHensonNavigatorTask> createHensonNavigatorGenerationTask(\n BaseVariant variant, String hensonNavigatorPackageName, File destinationFolder) {\n TaskProvider<GenerateHensonNavigatorTask> generateHensonNavigatorTask =\n project\n .getTasks()\n .register(\n \"generate\" + capitalize(variant.getName()) + \"HensonNavigator\",\n GenerateHensonNavigatorTask.class,\n (Action<GenerateHensonNavigatorTask>)\n generateHensonNavigatorTask1 -> {\n generateHensonNavigatorTask1.hensonNavigatorPackageName =\n hensonNavigatorPackageName;\n generateHensonNavigatorTask1.destinationFolder = destinationFolder;\n generateHensonNavigatorTask1.variant = variant;\n generateHensonNavigatorTask1.logger = logger;\n generateHensonNavigatorTask1.project = project;\n generateHensonNavigatorTask1.hensonNavigatorGenerator =\n hensonNavigatorGenerator;\n });\n return generateHensonNavigatorTask;\n }",
"public static String fromClassPath() {\n Set<String> versions = new HashSet<>();\n try {\n ClassLoader classLoader = Thread.currentThread().getContextClassLoader();\n Enumeration<URL> manifests = classLoader.getResources(\"META-INF/MANIFEST.MF\");\n\n while (manifests.hasMoreElements()) {\n URL manifestURL = manifests.nextElement();\n try (InputStream is = manifestURL.openStream()) {\n Manifest manifest = new Manifest();\n manifest.read(is);\n\n Attributes buildInfo = manifest.getAttributes(\"Build-Info\");\n if (buildInfo != null) {\n if (buildInfo.getValue(\"Selenium-Version\") != null) {\n versions.add(buildInfo.getValue(\"Selenium-Version\"));\n } else {\n // might be in build-info part\n if (manifest.getEntries() != null) {\n if (manifest.getEntries().containsKey(\"Build-Info\")) {\n final Attributes attributes = manifest.getEntries().get(\"Build-Info\");\n\n if (attributes.getValue(\"Selenium-Version\") != null) {\n versions.add(attributes.getValue(\"Selenium-Version\"));\n }\n }\n }\n }\n }\n }\n }\n } catch (Exception e) {\n logger.log(Level.WARNING,\n \"Exception {0} occurred while resolving selenium version and latest image is going to be used.\",\n e.getMessage());\n return SELENIUM_VERSION;\n }\n\n if (versions.isEmpty()) {\n logger.log(Level.INFO, \"No version of Selenium found in classpath. Using latest image.\");\n return SELENIUM_VERSION;\n }\n\n String foundVersion = versions.iterator().next();\n if (versions.size() > 1) {\n logger.log(Level.WARNING, \"Multiple versions of Selenium found in classpath. Using the first one found {0}.\",\n foundVersion);\n }\n\n return foundVersion;\n }",
"public static final Date getFinishDate(byte[] data, int offset)\n {\n Date result;\n long days = getShort(data, offset);\n\n if (days == 0x8000)\n {\n result = null;\n }\n else\n {\n result = DateHelper.getDateFromLong(EPOCH + ((days - 1) * DateHelper.MS_PER_DAY));\n }\n\n return (result);\n }",
"public void each(int offset, int maxRows, Closure closure) throws SQLException {\n eachRow(getSql(), getParameters(), offset, maxRows, closure);\n }",
"static <T extends GridDialect> T getDialectFacetOrNull(GridDialect gridDialect, Class<T> facetType) {\n\t\tif ( hasFacet( gridDialect, facetType ) ) {\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tT asFacet = (T) gridDialect;\n\t\t\treturn asFacet;\n\t\t}\n\n\t\treturn null;\n\t}"
] |
Dumps an animation channel to stdout.
@param nodeAnim the channel | [
"public static void dumpNodeAnim(AiNodeAnim nodeAnim) {\n for (int i = 0; i < nodeAnim.getNumPosKeys(); i++) {\n System.out.println(i + \": \" + nodeAnim.getPosKeyTime(i) + \n \" ticks, \" + nodeAnim.getPosKeyVector(i, Jassimp.BUILTIN));\n }\n }"
] | [
"private BasicCredentialsProvider getCredentialsProvider() {\n return new BasicCredentialsProvider() {\n private Set<AuthScope> authAlreadyTried = Sets.newHashSet();\n\n @Override\n public Credentials getCredentials(AuthScope authscope) {\n if (authAlreadyTried.contains(authscope)) {\n return null;\n }\n authAlreadyTried.add(authscope);\n return super.getCredentials(authscope);\n }\n };\n }",
"@Pure\n\tpublic static <T> Iterator<T> filterNull(Iterator<T> unfiltered) {\n\t\treturn Iterators.filter(unfiltered, Predicates.notNull());\n\t}",
"protected void rehash(int newCapacity) {\r\n\tint oldCapacity = table.length;\r\n\t//if (oldCapacity == newCapacity) return;\r\n\t\r\n\tlong oldTable[] = table;\r\n\tint oldValues[] = values;\r\n\tbyte oldState[] = state;\r\n\r\n\tlong newTable[] = new long[newCapacity];\r\n\tint newValues[] = new int[newCapacity];\r\n\tbyte newState[] = new byte[newCapacity];\r\n\r\n\tthis.lowWaterMark = chooseLowWaterMark(newCapacity,this.minLoadFactor);\r\n\tthis.highWaterMark = chooseHighWaterMark(newCapacity,this.maxLoadFactor);\r\n\r\n\tthis.table = newTable;\r\n\tthis.values = newValues;\r\n\tthis.state = newState;\r\n\tthis.freeEntries = newCapacity-this.distinct; // delta\r\n\t\r\n\tfor (int i = oldCapacity ; i-- > 0 ;) {\r\n\t\tif (oldState[i]==FULL) {\r\n\t\t\tlong element = oldTable[i];\r\n\t\t\tint index = indexOfInsertion(element);\r\n\t\t\tnewTable[index]=element;\r\n\t\t\tnewValues[index]=oldValues[i];\r\n\t\t\tnewState[index]=FULL;\r\n\t\t}\r\n\t}\r\n}",
"protected DataSource getDataSource(JdbcConnectionDescriptor jcd)\r\n throws LookupException\r\n {\r\n final PBKey key = jcd.getPBKey();\r\n DataSource ds = (DataSource) dsMap.get(key);\r\n if (ds == null)\r\n {\r\n // Found no pool for PBKey\r\n try\r\n {\r\n synchronized (poolSynch)\r\n {\r\n // Setup new object pool\r\n ObjectPool pool = setupPool(jcd);\r\n poolMap.put(key, pool);\r\n // Wrap the underlying object pool as DataSource\r\n ds = wrapAsDataSource(jcd, pool);\r\n dsMap.put(key, ds);\r\n }\r\n }\r\n catch (Exception e)\r\n {\r\n log.error(\"Could not setup DBCP DataSource for \" + jcd, e);\r\n throw new LookupException(e);\r\n }\r\n }\r\n return ds;\r\n }",
"protected static void validateSignature(final DataInput input) throws IOException {\n final byte[] signatureBytes = new byte[4];\n input.readFully(signatureBytes);\n if (!Arrays.equals(ManagementProtocol.SIGNATURE, signatureBytes)) {\n throw ProtocolLogger.ROOT_LOGGER.invalidSignature(Arrays.toString(signatureBytes));\n }\n }",
"public static File getCurrentVersion(File storeDirectory) {\n File latestDir = getLatestDir(storeDirectory);\n if(latestDir != null)\n return latestDir;\n\n File[] versionDirs = getVersionDirs(storeDirectory);\n if(versionDirs == null || versionDirs.length == 0) {\n return null;\n } else {\n return findKthVersionedDir(versionDirs, versionDirs.length - 1, versionDirs.length - 1)[0];\n }\n }",
"public void sendJsonToTagged(Object data, String ... labels) {\n for (String label : labels) {\n sendJsonToTagged(data, label);\n }\n }",
"public static boolean sameLists(String list1, String list2)\r\n {\r\n return new CommaListIterator(list1).equals(new CommaListIterator(list2));\r\n }",
"@Pure\n\tpublic static <T> Iterable<T> filterNull(Iterable<T> unfiltered) {\n\t\treturn Iterables.filter(unfiltered, Predicates.notNull());\n\t}"
] |
Use this API to fetch clusternodegroup resource of given name . | [
"public static clusternodegroup get(nitro_service service, String name) throws Exception{\n\t\tclusternodegroup obj = new clusternodegroup();\n\t\tobj.set_name(name);\n\t\tclusternodegroup response = (clusternodegroup) obj.get_resource(service);\n\t\treturn response;\n\t}"
] | [
"void init( DMatrixSparseCSC A ) {\n this.A = A;\n this.m = A.numRows;\n this.n = A.numCols;\n\n this.next = 0;\n this.head = m;\n this.tail = m + n;\n this.nque = m + 2*n;\n\n if( parent.length < n || leftmost.length < m) {\n parent = new int[n];\n post = new int[n];\n pinv = new int[m+n];\n countsR = new int[n];\n leftmost = new int[m];\n }\n gwork.reshape(m+3*n);\n }",
"public Collection<Exif> getExif(String photoId, String secret) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_EXIF);\r\n\r\n parameters.put(\"photo_id\", photoId);\r\n if (secret != null) {\r\n parameters.put(\"secret\", secret);\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 List<Exif> exifs = new ArrayList<Exif>();\r\n Element photoElement = response.getPayload();\r\n NodeList exifElements = photoElement.getElementsByTagName(\"exif\");\r\n for (int i = 0; i < exifElements.getLength(); i++) {\r\n Element exifElement = (Element) exifElements.item(i);\r\n Exif exif = new Exif();\r\n exif.setTagspace(exifElement.getAttribute(\"tagspace\"));\r\n exif.setTagspaceId(exifElement.getAttribute(\"tagspaceid\"));\r\n exif.setTag(exifElement.getAttribute(\"tag\"));\r\n exif.setLabel(exifElement.getAttribute(\"label\"));\r\n exif.setRaw(XMLUtilities.getChildValue(exifElement, \"raw\"));\r\n exif.setClean(XMLUtilities.getChildValue(exifElement, \"clean\"));\r\n exifs.add(exif);\r\n }\r\n return exifs;\r\n }",
"@Api\n\tpublic void setNamedRoles(Map<String, List<NamedRoleInfo>> namedRoles) {\n\t\tthis.namedRoles = namedRoles;\n\t\tldapRoleMapping = new HashMap<String, Set<String>>();\n\t\tfor (String roleName : namedRoles.keySet()) {\n\t\t\tif (!ldapRoleMapping.containsKey(roleName)) {\n\t\t\t\tldapRoleMapping.put(roleName, new HashSet<String>());\n\t\t\t}\n\t\t\tfor (NamedRoleInfo role : namedRoles.get(roleName)) {\n\t\t\t\tldapRoleMapping.get(roleName).add(role.getName());\n\t\t\t}\n\t\t}\n\t}",
"void sign(byte[] data, int offset, int length,\n ServerMessageBlock request, ServerMessageBlock response) {\n request.signSeq = signSequence;\n if( response != null ) {\n response.signSeq = signSequence + 1;\n response.verifyFailed = false;\n }\n\n try {\n update(macSigningKey, 0, macSigningKey.length);\n int index = offset + ServerMessageBlock.SIGNATURE_OFFSET;\n for (int i = 0; i < 8; i++) data[index + i] = 0;\n ServerMessageBlock.writeInt4(signSequence, data, index);\n update(data, offset, length);\n System.arraycopy(digest(), 0, data, index, 8);\n if (bypass) {\n bypass = false;\n System.arraycopy(\"BSRSPYL \".getBytes(), 0, data, index, 8);\n }\n } catch (Exception ex) {\n if( log.level > 0 )\n ex.printStackTrace( log );\n } finally {\n signSequence += 2;\n }\n }",
"public static dnspolicylabel get(nitro_service service, String labelname) throws Exception{\n\t\tdnspolicylabel obj = new dnspolicylabel();\n\t\tobj.set_labelname(labelname);\n\t\tdnspolicylabel response = (dnspolicylabel) obj.get_resource(service);\n\t\treturn response;\n\t}",
"private String determineAndCacheOuterMostNullEmbeddable(String column, String[] path) {\n\t\tString embeddable = path[0];\n\t\t// process each embeddable from less specific to most specific\n\t\t// exclude path leaves as it's a column and not an embeddable\n\t\tfor ( int index = 0; index < path.length - 1; index++ ) {\n\t\t\tSet<String> columnsOfEmbeddable = getColumnsOfEmbeddableAndComputeEmbeddableNullness( embeddable );\n\n\t\t\tif ( nullEmbeddables.contains( embeddable ) ) {\n\t\t\t\t// the current embeddable only has null columns; cache that info for all the columns\n\t\t\t\tfor ( String columnOfEmbeddable : columnsOfEmbeddable ) {\n\t\t\t\t\tcolumnToOuterMostNullEmbeddableCache.put( columnOfEmbeddable, embeddable );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmaybeCacheOnNonNullEmbeddable( path, index, columnsOfEmbeddable );\n\t\t\t}\n\t\t\t// a more specific null embeddable might be present, carry on\n\t\t\tembeddable += \".\" + path[index + 1];\n\t\t}\n\t\treturn columnToOuterMostNullEmbeddableCache.get( column );\n\t}",
"public static <K,V> SortedMap<K,V> asImmutable(SortedMap<K, ? extends V> self) {\n return Collections.unmodifiableSortedMap(self);\n }",
"public void setRegExp(final String pattern,\n final String invalidCharactersInNameErrorMessage,\n final String invalidCharacterTypedMessage) {\n regExp = RegExp.compile(pattern);\n this.invalidCharactersInNameErrorMessage = invalidCharactersInNameErrorMessage;\n this.invalidCharacterTypedMessage = invalidCharacterTypedMessage;\n }",
"public static base_response update(nitro_service client, filterhtmlinjectionparameter resource) throws Exception {\n\t\tfilterhtmlinjectionparameter updateresource = new filterhtmlinjectionparameter();\n\t\tupdateresource.rate = resource.rate;\n\t\tupdateresource.frequency = resource.frequency;\n\t\tupdateresource.strict = resource.strict;\n\t\tupdateresource.htmlsearchlen = resource.htmlsearchlen;\n\t\treturn updateresource.update_resource(client);\n\t}"
] |
This filter adds a blur effect to the image using the specified radius and sigma.
@param radius Radius used in the gaussian function to generate a matrix, maximum value is 150.
The bigger the radius more blurred will be the image.
@param sigma Sigma used in the gaussian function. | [
"public static String blur(int radius, int sigma) {\n if (radius < 1) {\n throw new IllegalArgumentException(\"Radius must be greater than zero.\");\n }\n if (radius > 150) {\n throw new IllegalArgumentException(\"Radius must be lower or equal than 150.\");\n }\n if (sigma < 0) {\n throw new IllegalArgumentException(\"Sigma must be greater than zero.\");\n }\n return FILTER_BLUR + \"(\" + radius + \",\" + sigma + \")\";\n }"
] | [
"public float getPositionZ(int vertex) {\n if (!hasPositions()) {\n throw new IllegalStateException(\"mesh has no positions\");\n }\n \n checkVertexIndexBounds(vertex);\n \n return m_vertices.getFloat((vertex * 3 + 2) * SIZEOF_FLOAT);\n }",
"public String getNextDay(String dateString, boolean onlyBusinessDays) {\n DateTimeFormatter parser = ISODateTimeFormat.date();\n DateTime date = parser.parseDateTime(dateString).plusDays(1);\n Calendar cal = Calendar.getInstance();\n cal.setTime(date.toDate());\n\n if (onlyBusinessDays) {\n if (cal.get(Calendar.DAY_OF_WEEK) == 1 || cal.get(Calendar.DAY_OF_WEEK) == 7\n || isHoliday(date.toString().substring(0, 10))) {\n return getNextDay(date.toString().substring(0, 10), true);\n } else {\n return parser.print(date);\n }\n } else {\n return parser.print(date);\n }\n }",
"private void populateRecurringTask(Record record, RecurringTask task) throws MPXJException\n {\n //System.out.println(record);\n task.setStartDate(record.getDateTime(1));\n task.setFinishDate(record.getDateTime(2));\n task.setDuration(RecurrenceUtility.getDuration(m_projectFile.getProjectProperties(), record.getInteger(3), record.getInteger(4)));\n task.setOccurrences(record.getInteger(5));\n task.setRecurrenceType(RecurrenceUtility.getRecurrenceType(record.getInteger(6)));\n task.setUseEndDate(NumberHelper.getInt(record.getInteger(8)) == 1);\n task.setWorkingDaysOnly(NumberHelper.getInt(record.getInteger(9)) == 1);\n task.setWeeklyDaysFromBitmap(RecurrenceUtility.getDays(record.getString(10)), RecurrenceUtility.RECURRING_TASK_DAY_MASKS);\n\n RecurrenceType type = task.getRecurrenceType();\n if (type != null)\n {\n switch (task.getRecurrenceType())\n {\n case DAILY:\n {\n task.setFrequency(record.getInteger(13));\n break;\n }\n\n case WEEKLY:\n {\n task.setFrequency(record.getInteger(14));\n break;\n }\n\n case MONTHLY:\n {\n task.setRelative(NumberHelper.getInt(record.getInteger(11)) == 1);\n if (task.getRelative())\n {\n task.setFrequency(record.getInteger(17));\n task.setDayNumber(record.getInteger(15));\n task.setDayOfWeek(RecurrenceUtility.getDay(record.getInteger(16)));\n }\n else\n {\n task.setFrequency(record.getInteger(19));\n task.setDayNumber(record.getInteger(18));\n }\n break;\n }\n\n case YEARLY:\n {\n task.setRelative(NumberHelper.getInt(record.getInteger(12)) != 1);\n if (task.getRelative())\n {\n task.setDayNumber(record.getInteger(20));\n task.setDayOfWeek(RecurrenceUtility.getDay(record.getInteger(21)));\n task.setMonthNumber(record.getInteger(22));\n }\n else\n {\n task.setYearlyAbsoluteFromDate(record.getDateTime(23));\n }\n break;\n }\n }\n }\n\n //System.out.println(task);\n }",
"public static tmglobal_tmsessionpolicy_binding[] get(nitro_service service) throws Exception{\n\t\ttmglobal_tmsessionpolicy_binding obj = new tmglobal_tmsessionpolicy_binding();\n\t\ttmglobal_tmsessionpolicy_binding response[] = (tmglobal_tmsessionpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"public TransformersSubRegistration getServerRegistration(final ModelVersionRange range) {\n final PathAddress address = PathAddress.EMPTY_ADDRESS.append(HOST, SERVER);\n return new TransformersSubRegistrationImpl(range, domain, address);\n }",
"public static boolean checkAddProperty(\r\n CmsCmisTypeManager typeManager,\r\n Properties properties,\r\n String typeId,\r\n Set<String> filter,\r\n String id) {\r\n\r\n if ((properties == null) || (properties.getProperties() == null)) {\r\n throw new IllegalArgumentException(\"Properties must not be null!\");\r\n }\r\n\r\n if (id == null) {\r\n throw new IllegalArgumentException(\"Id must not be null!\");\r\n }\r\n\r\n TypeDefinition type = typeManager.getType(typeId);\r\n if (type == null) {\r\n throw new IllegalArgumentException(\"Unknown type: \" + typeId);\r\n }\r\n if (!type.getPropertyDefinitions().containsKey(id)) {\r\n throw new IllegalArgumentException(\"Unknown property: \" + id);\r\n }\r\n\r\n String queryName = type.getPropertyDefinitions().get(id).getQueryName();\r\n\r\n if ((queryName != null) && (filter != null)) {\r\n if (!filter.contains(queryName)) {\r\n return false;\r\n } else {\r\n filter.remove(queryName);\r\n }\r\n }\r\n\r\n return true;\r\n }",
"public void setKnotBlend(int n, int type) {\n\t\tknotTypes[n] = (byte)((knotTypes[n] & ~BLEND_MASK) | type);\n\t\trebuildGradient();\n\t}",
"public synchronized boolean checkWrite(TransactionImpl tx, Object obj)\r\n {\r\n if (log.isDebugEnabled()) log.debug(\"LM.checkWrite(tx-\" + tx.getGUID() + \", \" + new Identity(obj, tx.getBroker()).toString() + \")\");\r\n LockStrategy lockStrategy = LockStrategyFactory.getStrategyFor(obj);\r\n return lockStrategy.checkWrite(tx, obj);\r\n }",
"@Override\n public void close(SocketDestination destination) {\n factory.setLastClosedTimestamp(destination);\n queuedPool.reset(destination);\n }"
] |
Used to add exceptions to the calendar. The MPX standard defines
a limit of 250 exceptions per calendar.
@param fromDate exception start date
@param toDate exception end date
@return ProjectCalendarException instance | [
"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 byte[] receiveBytes(InputStream is) throws IOException {\n byte[] buffer = new byte[8192];\n int len = (is.read(buffer));\n if (len < 1) {\n throw new IOException(\"receiveBytes read \" + len + \" bytes.\");\n }\n return Arrays.copyOf(buffer, len);\n }",
"private void setLanguageFilters(String filters) {\n\t\tthis.filterLanguages = new HashSet<>();\n\t\tif (!\"-\".equals(filters)) {\n\t\t\tCollections.addAll(this.filterLanguages, filters.split(\",\"));\n\t\t}\n\t}",
"private static List<String> parseAndCompare(List<String> fileNames, int masterPartitionId) {\n List<String> sourceFileNames = new ArrayList<String>();\n for(String fileName: fileNames) {\n String[] partitionIdReplicaChunk = fileName.split(SPLIT_LITERAL);\n if(Integer.parseInt(partitionIdReplicaChunk[0]) == masterPartitionId) {\n sourceFileNames.add(fileName);\n }\n }\n return sourceFileNames;\n }",
"public static BufferedImage resizeToHeight(BufferedImage originalImage, int heightOut) {\n\n int width = originalImage.getWidth();\n\n int height = originalImage.getHeight();\n\n int heightPercent = (heightOut * 100) / height;\n\n int newWidth = (width * heightPercent) / 100;\n\n BufferedImage resizedImage =\n new BufferedImage(newWidth, heightOut, BufferedImage.TYPE_INT_ARGB);\n Graphics2D g = resizedImage.createGraphics();\n g.drawImage(originalImage, 0, 0, newWidth, heightOut, null);\n g.dispose();\n\n return resizedImage;\n }",
"private void readChunkIfNeeded() {\n if (workBufferSize > workBufferPosition) {\n return;\n }\n if (workBuffer == null) {\n workBuffer = bitmapProvider.obtainByteArray(WORK_BUFFER_SIZE);\n }\n workBufferPosition = 0;\n workBufferSize = Math.min(rawData.remaining(), WORK_BUFFER_SIZE);\n rawData.get(workBuffer, 0, workBufferSize);\n }",
"private static Class<?> getRawClass(Type type) {\n if (type instanceof Class) {\n return (Class<?>) type;\n }\n if (type instanceof ParameterizedType) {\n return getRawClass(((ParameterizedType) type).getRawType());\n }\n // For TypeVariable and WildcardType, returns the first upper bound.\n if (type instanceof TypeVariable) {\n return getRawClass(((TypeVariable) type).getBounds()[0]);\n }\n if (type instanceof WildcardType) {\n return getRawClass(((WildcardType) type).getUpperBounds()[0]);\n }\n if (type instanceof GenericArrayType) {\n Class<?> componentClass = getRawClass(((GenericArrayType) type).getGenericComponentType());\n return Array.newInstance(componentClass, 0).getClass();\n }\n // This shouldn't happen as we captured all implementations of Type above (as or Java 8)\n throw new IllegalArgumentException(\"Unsupported type \" + type + \" of type class \" + type.getClass());\n }",
"public static Span prefix(CharSequence rowPrefix) {\n Objects.requireNonNull(rowPrefix);\n return prefix(Bytes.of(rowPrefix));\n }",
"public StitchObjectMapper withCodecRegistry(final CodecRegistry codecRegistry) {\n // We can't detect if their codecRegistry has any duplicate providers. There's also a chance\n // that putting ours first may prevent decoding of some of their classes if for example they\n // have their own way of decoding an Integer.\n final CodecRegistry newReg =\n CodecRegistries.fromRegistries(BsonUtils.DEFAULT_CODEC_REGISTRY, codecRegistry);\n return new StitchObjectMapper(this, newReg);\n }",
"public void enqueue(SerialMessage serialMessage) {\n\t\tthis.sendQueue.add(serialMessage);\n\t\tlogger.debug(\"Enqueueing message. Queue length = {}\", this.sendQueue.size());\n\t}"
] |
Read a single weekday from the provided JSON value.
@param val the value to read the week day from.
@return the week day read
@throws IllegalArgumentException thrown if the provided JSON value is not the representation of a week day. | [
"private WeekDay readWeekDay(JSONValue val) throws IllegalArgumentException {\n\n String str = readOptionalString(val);\n if (null != str) {\n return WeekDay.valueOf(str);\n }\n throw new IllegalArgumentException();\n }"
] | [
"protected void maybeSignalForMoreConnections(ConnectionPartition connectionPartition) {\r\n\r\n\t\tif (!connectionPartition.isUnableToCreateMoreTransactions() \r\n\t\t\t\t&& !this.poolShuttingDown &&\r\n\t\t\t\tconnectionPartition.getAvailableConnections()*100/connectionPartition.getMaxConnections() <= this.poolAvailabilityThreshold){\r\n\t\t\tconnectionPartition.getPoolWatchThreadSignalQueue().offer(new Object()); // item being pushed is not important.\r\n\t\t}\r\n\t}",
"public Map<String, ImplT> convertToUnmodifiableMap(List<InnerT> innerList) {\n Map<String, ImplT> result = new HashMap<>();\n for (InnerT inner : innerList) {\n result.put(name(inner), impl(inner));\n }\n\n return Collections.unmodifiableMap(result);\n }",
"public static String getOjbClassName(ResultSet rs)\r\n {\r\n try\r\n {\r\n return rs.getString(OJB_CLASS_COLUMN);\r\n }\r\n catch (SQLException e)\r\n {\r\n return null;\r\n }\r\n }",
"private void putEvent(EventType eventType) throws Exception {\n List<EventType> eventTypes = Collections.singletonList(eventType);\n\n int i;\n for (i = 0; i < retryNum; ++i) {\n try {\n monitoringService.putEvents(eventTypes);\n break;\n } catch (Exception e) {\n LOG.log(Level.SEVERE, e.getMessage(), e);\n }\n Thread.sleep(retryDelay);\n }\n\n if (i == retryNum) {\n LOG.warning(\"Could not send events to monitoring service after \" + retryNum + \" retries.\");\n throw new Exception(\"Send SERVER_START/SERVER_STOP event to SAM Server failed\");\n }\n\n }",
"public static double SquaredEuclidean(double[] x, double[] y) {\n double d = 0.0, u;\n\n for (int i = 0; i < x.length; i++) {\n u = x[i] - y[i];\n d += u * u;\n }\n\n return d;\n }",
"public void enable(ConduitSelectorHolder conduitSelectorHolder, SLPropertiesMatcher matcher,\n String selectionStrategy) {\n LocatorTargetSelector selector = new LocatorTargetSelector();\n selector.setEndpoint(conduitSelectorHolder.getConduitSelector().getEndpoint());\n\n String actualStrategy = selectionStrategy != null ? selectionStrategy : defaultLocatorSelectionStrategy;\n \n LocatorSelectionStrategy locatorSelectionStrategy = getLocatorSelectionStrategy(actualStrategy);\n locatorSelectionStrategy.setServiceLocator(locatorClient);\n if (matcher != null) {\n locatorSelectionStrategy.setMatcher(matcher);\n }\n selector.setLocatorSelectionStrategy(locatorSelectionStrategy);\n\n if (LOG.isLoggable(Level.INFO)) {\n LOG.log(Level.INFO, \"Client enabled with strategy \"\n + locatorSelectionStrategy.getClass().getName() + \".\");\n }\n conduitSelectorHolder.setConduitSelector(selector);\n\n if (LOG.isLoggable(Level.FINE)) {\n LOG.log(Level.FINE, \"Successfully enabled client \" + conduitSelectorHolder\n + \" for the service locator\");\n }\n }",
"public boolean addDescriptor() {\n\n saveLocalization();\n IndexedContainer oldContainer = m_container;\n try {\n createAndLockDescriptorFile();\n unmarshalDescriptor();\n updateBundleDescriptorContent();\n m_hasMasterMode = true;\n m_container = createContainer();\n m_editorState.put(EditMode.DEFAULT, getDefaultState());\n m_editorState.put(EditMode.MASTER, getMasterState());\n } catch (CmsException | IOException e) {\n LOG.error(e.getLocalizedMessage(), e);\n if (m_descContent != null) {\n m_descContent = null;\n }\n if (m_descFile != null) {\n m_descFile = null;\n }\n if (m_desc != null) {\n try {\n m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(1));\n } catch (CmsException ex) {\n LOG.error(ex.getLocalizedMessage(), ex);\n }\n m_desc = null;\n }\n m_hasMasterMode = false;\n m_container = oldContainer;\n return false;\n }\n m_removeDescriptorOnCancel = true;\n return true;\n }",
"private void installFastProcessAnnotatedTypeResolver(ServiceRegistry services) {\n ClassFileServices classFileServices = services.get(ClassFileServices.class);\n if (classFileServices != null) {\n final GlobalObserverNotifierService observers = services.get(GlobalObserverNotifierService.class);\n try {\n final FastProcessAnnotatedTypeResolver resolver = new FastProcessAnnotatedTypeResolver(observers.getAllObserverMethods());\n services.add(FastProcessAnnotatedTypeResolver.class, resolver);\n } catch (UnsupportedObserverMethodException e) {\n BootstrapLogger.LOG.notUsingFastResolver(e.getObserver());\n return;\n }\n }\n }",
"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}"
] |
Generates the specified number of random resource names with the same prefix.
@param prefix the prefix to be used if possible
@param maxLen the maximum length for the random generated name
@param count the number of names to generate
@return random names | [
"public static String[] randomResourceNames(String prefix, int maxLen, int count) {\n String[] names = new String[count];\n ResourceNamer resourceNamer = SdkContext.getResourceNamerFactory().createResourceNamer(\"\");\n for (int i = 0; i < count; i++) {\n names[i] = resourceNamer.randomName(prefix, maxLen);\n }\n return names;\n }"
] | [
"private CollectionDescriptorDef cloneCollection(CollectionDescriptorDef collDef, String prefix)\r\n {\r\n CollectionDescriptorDef copyCollDef = new CollectionDescriptorDef(collDef, prefix);\r\n\r\n copyCollDef.setOwner(this);\r\n // we remove properties that are only relevant to the class the features are declared in\r\n copyCollDef.setProperty(PropertyHelper.OJB_PROPERTY_IGNORE, null);\r\n\r\n Properties mod = getModification(copyCollDef.getName());\r\n\r\n if (mod != null)\r\n {\r\n if (!PropertyHelper.toBoolean(mod.getProperty(PropertyHelper.OJB_PROPERTY_IGNORE), false) &&\r\n hasFeature(copyCollDef.getName()))\r\n {\r\n LogHelper.warn(true,\r\n ClassDescriptorDef.class,\r\n \"process\",\r\n \"Class \"+getName()+\" has a feature that has the same name as its included collection \"+\r\n copyCollDef.getName()+\" from class \"+collDef.getOwner().getName()); \r\n }\r\n copyCollDef.applyModifications(mod);\r\n }\r\n return copyCollDef;\r\n }",
"@Nullable public View findViewById(int id) {\n if (searchView != null) {\n return searchView.findViewById(id);\n } else if (supportView != null) {\n return supportView.findViewById(id);\n }\n throw new IllegalStateException(ERROR_NO_SEARCHVIEW);\n }",
"public static CRFClassifier getClassifier(InputStream in) throws IOException, ClassCastException,\r\n ClassNotFoundException {\r\n CRFClassifier crf = new CRFClassifier();\r\n crf.loadClassifier(in);\r\n return crf;\r\n }",
"public List<MapRow> readTable(TableReader reader) throws IOException\n {\n reader.read();\n return reader.getRows();\n }",
"private static boolean syncWithMaster(final Resource domain, final PathElement hostElement) {\n final Resource host = domain.getChild(hostElement);\n assert host != null;\n\n final Set<String> profiles = new HashSet<>();\n final Set<String> serverGroups = new HashSet<>();\n final Set<String> socketBindings = new HashSet<>();\n\n for (final Resource.ResourceEntry serverConfig : host.getChildren(SERVER_CONFIG)) {\n final ModelNode model = serverConfig.getModel();\n final String group = model.require(GROUP).asString();\n if (!serverGroups.contains(group)) {\n serverGroups.add(group);\n }\n if (model.hasDefined(SOCKET_BINDING_GROUP)) {\n processSocketBindingGroup(domain, model.require(SOCKET_BINDING_GROUP).asString(), socketBindings);\n }\n\n }\n\n // process referenced server-groups\n for (final Resource.ResourceEntry serverGroup : domain.getChildren(SERVER_GROUP)) {\n // If we have an unreferenced server-group\n if (!serverGroups.remove(serverGroup.getName())) {\n return true;\n }\n final ModelNode model = serverGroup.getModel();\n\n final String profile = model.require(PROFILE).asString();\n // Process the profile\n processProfile(domain, profile, profiles);\n // Process the socket-binding-group\n processSocketBindingGroup(domain, model.require(SOCKET_BINDING_GROUP).asString(), socketBindings);\n }\n // If we are missing a server group\n if (!serverGroups.isEmpty()) {\n return true;\n }\n // Process profiles\n for (final Resource.ResourceEntry profile : domain.getChildren(PROFILE)) {\n // We have an unreferenced profile\n if (!profiles.remove(profile.getName())) {\n return true;\n }\n }\n // We are missing a profile\n if (!profiles.isEmpty()) {\n return true;\n }\n // Process socket-binding groups\n for (final Resource.ResourceEntry socketBindingGroup : domain.getChildren(SOCKET_BINDING_GROUP)) {\n // We have an unreferenced socket-binding group\n if (!socketBindings.remove(socketBindingGroup.getName())) {\n return true;\n }\n }\n // We are missing a socket-binding group\n if (!socketBindings.isEmpty()) {\n return true;\n }\n // Looks good!\n return false;\n }",
"protected void handleExceptions(MessageEvent messageEvent, Exception exception) {\n logger.error(\"Unknown exception. Internal Server Error.\", exception);\n writeErrorResponse(messageEvent,\n HttpResponseStatus.INTERNAL_SERVER_ERROR,\n \"Internal Server Error\");\n }",
"public static final String printBookingType(BookingType value)\n {\n return (Integer.toString(value == null ? BookingType.COMMITTED.getValue() : value.getValue()));\n }",
"public int[] argb(int x, int y) {\n Pixel p = pixel(x, y);\n return new int[]{p.alpha(), p.red(), p.green(), p.blue()};\n }",
"protected void update(float scale) {\n // Updates only when the plane is in the scene\n GVRSceneObject owner = getOwnerObject();\n\n if ((owner != null) && isEnabled() && owner.isEnabled())\n {\n convertFromARtoVRSpace(scale);\n }\n }"
] |
Helper method for getting the current parameter values from a list of annotated parameters.
@param parameters The list of annotated parameter to look up
@param manager The Bean manager
@return The object array of looked up values | [
"protected Object[] getParameterValues(Object specialVal, BeanManagerImpl manager, CreationalContext<?> ctx, CreationalContext<?> transientReferenceContext) {\n if (getInjectionPoints().isEmpty()) {\n if (specialInjectionPointIndex == -1) {\n return Arrays2.EMPTY_ARRAY;\n } else {\n return new Object[] { specialVal };\n }\n }\n Object[] parameterValues = new Object[getParameterInjectionPoints().size()];\n List<ParameterInjectionPoint<?, X>> parameters = getParameterInjectionPoints();\n for (int i = 0; i < parameterValues.length; i++) {\n ParameterInjectionPoint<?, ?> param = parameters.get(i);\n if (i == specialInjectionPointIndex) {\n parameterValues[i] = specialVal;\n } else if (hasTransientReferenceParameter && param.getAnnotated().isAnnotationPresent(TransientReference.class)) {\n parameterValues[i] = param.getValueToInject(manager, transientReferenceContext);\n } else {\n parameterValues[i] = param.getValueToInject(manager, ctx);\n }\n }\n return parameterValues;\n }"
] | [
"@Beta\n public MSICredentials withIdentityId(String identityId) {\n this.identityId = identityId;\n this.clientId = null;\n this.objectId = null;\n return this;\n }",
"private static String createImageStreamRequest(String name, String version, String image, boolean insecure) {\n JSONObject imageStream = new JSONObject();\n JSONObject metadata = new JSONObject();\n JSONObject annotations = new JSONObject();\n\n metadata.put(\"name\", name);\n annotations.put(\"openshift.io/image.insecureRepository\", insecure);\n metadata.put(\"annotations\", annotations);\n\n // Definition of the image\n JSONObject from = new JSONObject();\n from.put(\"kind\", \"DockerImage\");\n from.put(\"name\", image);\n\n JSONObject importPolicy = new JSONObject();\n importPolicy.put(\"insecure\", insecure);\n\n JSONObject tag = new JSONObject();\n tag.put(\"name\", version);\n tag.put(\"from\", from);\n tag.put(\"importPolicy\", importPolicy);\n\n JSONObject tagAnnotations = new JSONObject();\n tagAnnotations.put(\"version\", version);\n tag.put(\"annotations\", tagAnnotations);\n\n JSONArray tags = new JSONArray();\n tags.add(tag);\n\n // Add image definition to image stream\n JSONObject spec = new JSONObject();\n spec.put(\"tags\", tags);\n\n imageStream.put(\"kind\", \"ImageStream\");\n imageStream.put(\"apiVersion\", \"v1\");\n imageStream.put(\"metadata\", metadata);\n imageStream.put(\"spec\", spec);\n\n return imageStream.toJSONString();\n }",
"public static vpntrafficpolicy_vpnglobal_binding[] get(nitro_service service, String name) throws Exception{\n\t\tvpntrafficpolicy_vpnglobal_binding obj = new vpntrafficpolicy_vpnglobal_binding();\n\t\tobj.set_name(name);\n\t\tvpntrafficpolicy_vpnglobal_binding response[] = (vpntrafficpolicy_vpnglobal_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"public PhotoList<Photo> getPopularPhotos(Date date, StatsSort sort, int perPage, int page) throws FlickrException {\n\n Map<String, Object> parameters = new HashMap<String, Object>();\n parameters.put(\"method\", METHOD_GET_POPULAR_PHOTOS);\n if (date != null) {\n parameters.put(\"date\", String.valueOf(date.getTime() / 1000L));\n }\n if (sort != null) {\n parameters.put(\"sort\", sort.name());\n }\n addPaginationParameters(parameters, perPage, page);\n\n Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);\n if (response.isError()) {\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\n }\n\n return parsePopularPhotos(response);\n }",
"private void readRelationships()\n {\n for (MapRow row : m_tables.get(\"REL\"))\n {\n Task predecessor = m_activityMap.get(row.getString(\"PREDECESSOR_ACTIVITY_ID\"));\n Task successor = m_activityMap.get(row.getString(\"SUCCESSOR_ACTIVITY_ID\"));\n if (predecessor != null && successor != null)\n {\n Duration lag = row.getDuration(\"LAG_VALUE\");\n RelationType type = row.getRelationType(\"LAG_TYPE\");\n\n successor.addPredecessor(predecessor, type, lag);\n }\n }\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 SqlStatement getPreparedDeleteStatement(ClassDescriptor cld)\r\n {\r\n SqlForClass sfc = getSqlForClass(cld);\r\n SqlStatement sql = sfc.getDeleteSql();\r\n if(sql == null)\r\n {\r\n ProcedureDescriptor pd = cld.getDeleteProcedure();\r\n\r\n if(pd == null)\r\n {\r\n sql = new SqlDeleteByPkStatement(cld, logger);\r\n }\r\n else\r\n {\r\n sql = new SqlProcedureStatement(pd, logger);\r\n }\r\n // set the sql string\r\n sfc.setDeleteSql(sql);\r\n\r\n if(logger.isDebugEnabled())\r\n {\r\n logger.debug(\"SQL:\" + sql.getStatement());\r\n }\r\n }\r\n return sql;\r\n }",
"private static final Duration parseDurationInFractionsOfMinutes(ProjectProperties properties, Number value, TimeUnit targetTimeUnit, int factor)\n {\n Duration result = null;\n\n if (value != null)\n {\n result = Duration.getInstance(value.intValue() / factor, TimeUnit.MINUTES);\n if (targetTimeUnit != result.getUnits())\n {\n result = result.convertUnits(targetTimeUnit, properties);\n }\n }\n\n return (result);\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 }"
] |
Validates the producer method | [
"protected void checkProducerMethod(EnhancedAnnotatedMethod<T, ? super X> method) {\n if (method.getEnhancedParameters(Observes.class).size() > 0) {\n throw BeanLogger.LOG.inconsistentAnnotationsOnMethod(PRODUCER_ANNOTATION, \"@Observes\", this.method,\n Formats.formatAsStackTraceElement(method.getJavaMember()));\n } else if (method.getEnhancedParameters(ObservesAsync.class).size() > 0) {\n throw BeanLogger.LOG.inconsistentAnnotationsOnMethod(PRODUCER_ANNOTATION, \"@ObservesAsync\", this.method,\n Formats.formatAsStackTraceElement(method.getJavaMember()));\n } else if (method.getEnhancedParameters(Disposes.class).size() > 0) {\n throw BeanLogger.LOG.inconsistentAnnotationsOnMethod(PRODUCER_ANNOTATION, \"@Disposes\", this.method,\n Formats.formatAsStackTraceElement(method.getJavaMember()));\n } else if (getDeclaringBean() instanceof SessionBean<?> && !Modifier.isStatic(method.slim().getJavaMember().getModifiers())) {\n boolean methodDeclaredOnTypes = false;\n for (Type type : getDeclaringBean().getTypes()) {\n Class<?> clazz = Reflections.getRawType(type);\n try {\n AccessController.doPrivileged(new GetMethodAction(clazz, method.getName(), method.getParameterTypesAsArray()));\n methodDeclaredOnTypes = true;\n break;\n } catch (PrivilegedActionException ignored) {\n }\n }\n if (!methodDeclaredOnTypes) {\n throw BeanLogger.LOG.methodNotBusinessMethod(\"Producer\", this, getDeclaringBean(), Formats.formatAsStackTraceElement(method.getJavaMember()));\n }\n }\n }"
] | [
"public ItemRequest<CustomField> delete(String customField) {\n \n String path = String.format(\"/custom_fields/%s\", customField);\n return new ItemRequest<CustomField>(this, CustomField.class, path, \"DELETE\");\n }",
"public void set(int i, double value) {\n switch (i) {\n case 0: {\n x = value;\n break;\n }\n case 1: {\n y = value;\n break;\n }\n case 2: {\n z = value;\n break;\n }\n default: {\n throw new ArrayIndexOutOfBoundsException(i);\n }\n }\n }",
"private void wrongUsage() {\n\n String usage = \"Usage: java -cp $PATH_TO_OPENCMS_JAR org.opencms.rmi.CmsRemoteShellClient\\n\"\n + \" -script=[path to script] (optional) \\n\"\n + \" -registryPort=[port of RMI registry] (optional, default is \"\n + CmsRemoteShellConstants.DEFAULT_PORT\n + \")\\n\"\n + \" -additional=[additional commands class name] (optional)\";\n System.out.println(usage);\n System.exit(1);\n }",
"public ImmutableList<CandidateElement> extract(StateVertex currentState)\n\t\t\tthrows CrawljaxException {\n\t\tLinkedList<CandidateElement> results = new LinkedList<>();\n\n\t\tif (!checkedElements.checkCrawlCondition(browser)) {\n\t\t\tLOG.info(\"State {} did not satisfy the CrawlConditions.\", currentState.getName());\n\t\t\treturn ImmutableList.of();\n\t\t}\n\t\tLOG.debug(\"Looking in state: {} for candidate elements\", currentState.getName());\n\n\t\ttry {\n\t\t\tDocument dom = DomUtils.asDocument(browser.getStrippedDomWithoutIframeContent());\n\t\t\textractElements(dom, results, \"\");\n\t\t} catch (IOException e) {\n\t\t\tLOG.error(e.getMessage(), e);\n\t\t\tthrow new CrawljaxException(e);\n\t\t}\n\t\tif (randomizeElementsOrder) {\n\t\t\tCollections.shuffle(results);\n\t\t}\n\t\tcurrentState.setElementsFound(results);\n\t\tLOG.debug(\"Found {} new candidate elements to analyze!\", results.size());\n\t\treturn ImmutableList.copyOf(results);\n\t}",
"public static vpnglobal_auditnslogpolicy_binding[] get(nitro_service service) throws Exception{\n\t\tvpnglobal_auditnslogpolicy_binding obj = new vpnglobal_auditnslogpolicy_binding();\n\t\tvpnglobal_auditnslogpolicy_binding response[] = (vpnglobal_auditnslogpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"public EventsRequest<Event> get(String resource, String sync) {\n return new EventsRequest<Event>(this, Event.class, \"/events\", \"GET\")\n .query(\"resource\", resource)\n .query(\"sync\", sync);\n }",
"@Override\n public synchronized void start() {\n if (!started.getAndSet(true)) {\n finished.set(false);\n thread.start();\n }\n }",
"public CliCommandBuilder setTimeout(final int timeout) {\n if (timeout > 0) {\n addCliArgument(CliArgument.TIMEOUT, Integer.toString(timeout));\n } else {\n addCliArgument(CliArgument.TIMEOUT, null);\n }\n return this;\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 }"
] |
Manually set the breaker to be reset and ready for use. This
is only useful after a manual trip otherwise the breaker will
trip automatically again if the service is still unavailable.
Just like a real breaker. WOOT!!! | [
"public void reset() {\n state = BreakerState.CLOSED;\n isHardTrip = false;\n byPass = false;\n isAttemptLive = false;\n\n notifyBreakerStateChange(getStatus());\n }"
] | [
"private ModelNode createJVMNode() throws OperationFailedException {\n ModelNode jvm = new ModelNode().setEmptyObject();\n jvm.get(NAME).set(getProperty(\"java.vm.name\"));\n jvm.get(JAVA_VERSION).set(getProperty(\"java.vm.specification.version\"));\n jvm.get(JVM_VERSION).set(getProperty(\"java.version\"));\n jvm.get(JVM_VENDOR).set(getProperty(\"java.vm.vendor\"));\n jvm.get(JVM_HOME).set(getProperty(\"java.home\"));\n return jvm;\n }",
"public static Class<?> resolveReturnTypeArgument(Method method, Class<?> genericIfc) {\n\t\tAssert.notNull(method, \"method must not be null\");\n\t\tType returnType = method.getReturnType();\n\t\tType genericReturnType = method.getGenericReturnType();\n\t\tif (returnType.equals(genericIfc)) {\n\t\t\tif (genericReturnType instanceof ParameterizedType) {\n\t\t\t\tParameterizedType targetType = (ParameterizedType) genericReturnType;\n\t\t\t\tType[] actualTypeArguments = targetType.getActualTypeArguments();\n\t\t\t\tType typeArg = actualTypeArguments[0];\n\t\t\t\tif (!(typeArg instanceof WildcardType)) {\n\t\t\t\t\treturn (Class<?>) typeArg;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\treturn resolveTypeArgument((Class<?>) returnType, genericIfc);\n\t}",
"private void makeSingularPositive() {\n numSingular = qralg.getNumberOfSingularValues();\n singularValues = qralg.getSingularValues();\n\n for( int i = 0; i < numSingular; i++ ) {\n double val = singularValues[i];\n\n if( val < 0 ) {\n singularValues[i] = -val;\n\n if( computeU ) {\n // compute the results of multiplying it by an element of -1 at this location in\n // a diagonal matrix.\n int start = i* Ut.numCols;\n int stop = start+ Ut.numCols;\n\n for( int j = start; j < stop; j++ ) {\n Ut.data[j] = -Ut.data[j];\n }\n }\n }\n }\n }",
"public void addColumn(String columnName, boolean searchable, boolean orderable,\n String searchValue) {\n this.columns.add(new Column(columnName, \"\", searchable, orderable,\n new Search(searchValue, false)));\n }",
"public Collection<Blog> getList() throws FlickrException {\r\n List<Blog> blogs = new ArrayList<Blog>();\r\n\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_LIST);\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 Element blogsElement = response.getPayload();\r\n NodeList blogNodes = blogsElement.getElementsByTagName(\"blog\");\r\n for (int i = 0; i < blogNodes.getLength(); i++) {\r\n Element blogElement = (Element) blogNodes.item(i);\r\n Blog blog = new Blog();\r\n blog.setId(blogElement.getAttribute(\"id\"));\r\n blog.setName(blogElement.getAttribute(\"name\"));\r\n blog.setNeedPassword(\"1\".equals(blogElement.getAttribute(\"needspassword\")));\r\n blog.setUrl(blogElement.getAttribute(\"url\"));\r\n blogs.add(blog);\r\n }\r\n return blogs;\r\n }",
"public static Duration add(Duration a, Duration b, ProjectProperties defaults)\n {\n if (a == null && b == null)\n {\n return null;\n }\n if (a == null)\n {\n return b;\n }\n if (b == null)\n {\n return a;\n }\n TimeUnit unit = a.getUnits();\n if (b.getUnits() != unit)\n {\n b = b.convertUnits(unit, defaults);\n }\n\n return Duration.getInstance(a.getDuration() + b.getDuration(), unit);\n }",
"public static tmtrafficpolicy_lbvserver_binding[] get(nitro_service service, String name) throws Exception{\n\t\ttmtrafficpolicy_lbvserver_binding obj = new tmtrafficpolicy_lbvserver_binding();\n\t\tobj.set_name(name);\n\t\ttmtrafficpolicy_lbvserver_binding response[] = (tmtrafficpolicy_lbvserver_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"public static ServiceController<InstallationManager> installService(ServiceTarget serviceTarget) {\n final InstallationManagerService service = new InstallationManagerService();\n return serviceTarget.addService(InstallationManagerService.NAME, service)\n .addDependency(JBOSS_PRODUCT_CONFIG_SERVICE, ProductConfig.class, service.productConfig)\n .setInitialMode(ServiceController.Mode.ACTIVE)\n .install();\n }",
"synchronized boolean markReadMessageForId(String messageId, String userId){\n if(messageId == null || userId == null) return false;\n\n final String tName = Table.INBOX_MESSAGES.getName();\n try{\n final SQLiteDatabase db = dbHelper.getWritableDatabase();\n ContentValues cv = new ContentValues();\n cv.put(IS_READ,1);\n db.update(Table.INBOX_MESSAGES.getName(), cv,_ID + \" = ? AND \" + USER_ID + \" = ?\",new String[]{messageId,userId});\n return true;\n }catch (final SQLiteException e){\n getConfigLogger().verbose(\"Error removing stale records from \" + tName, e);\n return false;\n } finally {\n dbHelper.close();\n }\n }"
] |
Moves to the next step. | [
"private void forward() {\n\n Set<String> selected = new HashSet<>();\n\n for (CheckBox checkbox : m_componentCheckboxes) {\n CmsSetupComponent component = (CmsSetupComponent)(checkbox.getData());\n if (checkbox.getValue().booleanValue()) {\n selected.add(component.getId());\n }\n }\n String error = null;\n for (String compId : selected) {\n CmsSetupComponent component = m_componentMap.get(compId);\n for (String dep : component.getDependencies()) {\n if (!selected.contains(dep)) {\n error = \"Unfulfilled dependency: The component \"\n + component.getName()\n + \" can not be installed because its dependency \"\n + m_componentMap.get(dep).getName()\n + \" is not selected\";\n break;\n }\n }\n }\n if (error == null) {\n Set<String> modules = new HashSet<>();\n\n for (CmsSetupComponent component : m_componentMap.values()) {\n\n if (selected.contains(component.getId())) {\n\n for (CmsModule module : m_context.getSetupBean().getAvailableModules().values()) {\n if (component.match(module.getName())) {\n modules.add(module.getName());\n }\n }\n }\n }\n List<String> moduleList = new ArrayList<>(modules);\n m_context.getSetupBean().setInstallModules(CmsStringUtil.listAsString(moduleList, \"|\"));\n m_context.stepForward();\n } else {\n CmsSetupErrorDialog.showErrorDialog(error, error);\n }\n }"
] | [
"public synchronized void start() throws SocketException {\n if (!isRunning()) {\n DeviceFinder.getInstance().addLifecycleListener(lifecycleListener);\n DeviceFinder.getInstance().addDeviceAnnouncementListener(announcementListener);\n DeviceFinder.getInstance().start();\n for (DeviceAnnouncement device: DeviceFinder.getInstance().getCurrentDevices()) {\n requestPlayerDBServerPort(device);\n }\n\n new Thread(null, new Runnable() {\n @Override\n public void run() {\n while (isRunning()) {\n try {\n Thread.sleep(500);\n } catch (InterruptedException e) {\n logger.warn(\"Interrupted sleeping to close idle dbserver clients\");\n }\n closeIdleClients();\n }\n logger.info(\"Idle dbserver client closer shutting down.\");\n }\n }, \"Idle dbserver client closer\").start();\n\n running.set(true);\n deliverLifecycleAnnouncement(logger, true);\n }\n }",
"public double distanceFrom(LatLong end) {\n\n double dLat = (end.getLatitude() - getLatitude()) * Math.PI / 180;\n double dLon = (end.getLongitude() - getLongitude()) * Math.PI / 180;\n\n double a = Math.sin(dLat / 2) * Math.sin(dLat / 2)\n + Math.cos(getLatitude() * Math.PI / 180)\n * Math.cos(end.getLatitude() * Math.PI / 180)\n * Math.sin(dLon / 2) * Math.sin(dLon / 2);\n\n double c = 2.0 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n double d = EarthRadiusMeters * c;\n return d;\n }",
"public base_response login(String username, String password, Long timeout) throws Exception\n\t{\n\t\tthis.set_credential(username, password);\n\t\tthis.set_timeout(timeout);\n\t\treturn this.login();\n\t}",
"private void lockLocalization(Locale l) throws CmsException {\n\n if (null == m_lockedBundleFiles.get(l)) {\n LockedFile lf = LockedFile.lockResource(m_cms, m_bundleFiles.get(l));\n m_lockedBundleFiles.put(l, lf);\n }\n\n }",
"public void addBatch(PreparedStatement stmt) throws PlatformException\r\n {\r\n // Check for Oracle batching support\r\n final boolean statementBatchingSupported = m_batchStatementsInProgress.containsKey(stmt);\r\n if (statementBatchingSupported)\r\n {\r\n try\r\n {\r\n stmt.executeUpdate();\r\n }\r\n catch (SQLException e)\r\n {\r\n throw new PlatformException(e.getLocalizedMessage(), e);\r\n }\r\n }\r\n else\r\n {\r\n super.addBatch(stmt);\r\n }\r\n }",
"public static vpnvserver_authenticationsamlpolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tvpnvserver_authenticationsamlpolicy_binding obj = new vpnvserver_authenticationsamlpolicy_binding();\n\t\tobj.set_name(name);\n\t\tvpnvserver_authenticationsamlpolicy_binding response[] = (vpnvserver_authenticationsamlpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"public int[] executeBatch(PreparedStatement stmt) throws PlatformException\r\n {\r\n // Check for Oracle batching support\r\n final Method methodSendBatch = (Method) m_batchStatementsInProgress.remove(stmt);\r\n final boolean statementBatchingSupported = methodSendBatch != null;\r\n\r\n int[] retval = null;\r\n if (statementBatchingSupported)\r\n {\r\n try\r\n {\r\n // sendBatch() returns total row count as an Integer\r\n methodSendBatch.invoke(stmt, null);\r\n }\r\n catch (Exception e)\r\n {\r\n throw new PlatformException(e.getLocalizedMessage(), e);\r\n }\r\n }\r\n else\r\n {\r\n retval = super.executeBatch(stmt);\r\n }\r\n return retval;\r\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 }",
"private void initDurationPanel() {\n\n m_durationPrefixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_PREFIX_0));\n m_durationAfterPostfixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_OCC_POSTFIX_0));\n m_seriesEndDate.setDateOnly(true);\n m_seriesEndDate.setAllowInvalidValue(true);\n m_seriesEndDate.setValue(m_model.getSeriesEndDate());\n m_seriesEndDate.getTextField().addFocusHandler(new FocusHandler() {\n\n public void onFocus(FocusEvent event) {\n\n if (handleChange()) {\n onSeriesEndDateFocus(event);\n }\n\n }\n });\n }"
] |
Log a info message with a throwable. | [
"public void info(Throwable throwable, String msg, Object[] argArray) {\n\t\tlogIfEnabled(Level.INFO, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);\n\t}"
] | [
"public static java.sql.Date newDate() {\n return new java.sql.Date((System.currentTimeMillis() / DAY_MILLIS) * DAY_MILLIS);\n }",
"@Subscribe\n public void onQuit(AggregatedQuitEvent e) {\n if (summaryFile != null) {\n try {\n Persister persister = new Persister();\n persister.write(new MavenFailsafeSummaryModel(summaryListener.getResult()), summaryFile);\n } catch (Exception x) {\n junit4.log(\"Could not serialize summary report.\", x, Project.MSG_WARN);\n }\n }\n }",
"public double stdev() {\n double m = mean();\n\n double total = 0;\n\n final int N = getNumElements();\n if( N <= 1 )\n throw new IllegalArgumentException(\"There must be more than one element to compute stdev\");\n\n\n for( int i = 0; i < N; i++ ) {\n double x = get(i);\n\n total += (x - m)*(x - m);\n }\n\n total /= (N-1);\n\n return Math.sqrt(total);\n }",
"public void addBetween(Object attribute, Object value1, Object value2)\r\n {\r\n\t\t// PAW\r\n\t\t// addSelectionCriteria(ValueCriteria.buildBeweenCriteria(attribute, value1, value2, getAlias()));\r\n\t\taddSelectionCriteria(ValueCriteria.buildBeweenCriteria(attribute, value1, value2, getUserAlias(attribute)));\r\n }",
"public void init(Configuration configuration) {\n if (devMode && reload && !listeningToDispatcher) {\n // this is the only way I found to be able to get added to to\n // ConfigurationProvider list\n // listening to events in Dispatcher\n listeningToDispatcher = true;\n Dispatcher.addDispatcherListener(this);\n }\n }",
"@SuppressWarnings(\"WeakerAccess\")\n protected void clearRmiTargetsMap(ClassLoaderLeakPreventor preventor, Map<?, ?> rmiTargetsMap) {\n try {\n final Field cclField = preventor.findFieldOfClass(\"sun.rmi.transport.Target\", \"ccl\");\n preventor.debug(\"Looping \" + rmiTargetsMap.size() + \" RMI Targets to find leaks\");\n for(Iterator<?> iter = rmiTargetsMap.values().iterator(); iter.hasNext(); ) {\n Object target = iter.next(); // sun.rmi.transport.Target\n ClassLoader ccl = (ClassLoader) cclField.get(target);\n if(preventor.isClassLoaderOrChild(ccl)) {\n preventor.warn(\"Removing RMI Target: \" + target);\n iter.remove();\n }\n }\n }\n catch (Exception ex) {\n preventor.error(ex);\n }\n }",
"public Quaternionf ConvertDirectionalVectorToQuaternion(Vector3f d) {\n d.negate();\n Quaternionf q = new Quaternionf();\n // check for exception condition\n if ((d.x == 0) && (d.z == 0)) {\n // exception condition if direction is (0,y,0):\n // straight up, straight down or all zero's.\n if (d.y > 0) { // direction straight up\n AxisAngle4f angleAxis = new AxisAngle4f(-(float) Math.PI / 2, 1, 0,\n 0);\n q.set(angleAxis);\n } else if (d.y < 0) { // direction straight down\n AxisAngle4f angleAxis = new AxisAngle4f((float) Math.PI / 2, 1, 0, 0);\n q.set(angleAxis);\n } else { // All zero's. Just set to identity quaternion\n q.identity();\n }\n } else {\n d.normalize();\n Vector3f up = new Vector3f(0, 1, 0);\n Vector3f s = new Vector3f();\n d.cross(up, s);\n s.normalize();\n Vector3f u = new Vector3f();\n d.cross(s, u);\n u.normalize();\n Matrix4f matrix = new Matrix4f(s.x, s.y, s.z, 0, u.x, u.y, u.z, 0, d.x,\n d.y, d.z, 0, 0, 0, 0, 1);\n q.setFromNormalized(matrix);\n }\n return q;\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 }",
"protected <T, A> ActiveOperation<T, A> getActiveOperation(final Integer id) {\n //noinspection unchecked\n return (ActiveOperation<T, A>) activeRequests.get(id);\n }"
] |
Gets a SerialMessage with the WAKE_UP_NO_MORE_INFORMATION command.
@return the serial message | [
"public SerialMessage getNoMoreInformationMessage() {\r\n\t\tlogger.debug(\"Creating new message for application command WAKE_UP_NO_MORE_INFORMATION for node {}\", this.getNode().getNodeId());\r\n\t\tSerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessage.SerialMessageClass.SendData, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.SendData, SerialMessage.SerialMessagePriority.Low);\r\n \tbyte[] newPayload = { \t(byte) this.getNode().getNodeId(), \r\n \t\t\t\t\t\t\t2, \r\n\t\t\t\t\t\t\t\t(byte) getCommandClass().getKey(), \r\n\t\t\t\t\t\t\t\t(byte) WAKE_UP_NO_MORE_INFORMATION };\r\n \tresult.setMessagePayload(newPayload);\r\n\r\n \treturn result;\r\n\t}"
] | [
"private static boolean validateLocalFileRecord(FileChannel channel, long startLocRecord, long compressedSize) throws IOException {\n\n ByteBuffer lfhBuffer = getByteBuffer(LOCLEN);\n read(lfhBuffer, channel, startLocRecord);\n if (lfhBuffer.limit() < LOCLEN || getUnsignedInt(lfhBuffer, 0) != LOCSIG) {\n return false;\n }\n\n if (compressedSize == -1) {\n // We can't further evaluate\n return true;\n }\n\n int fnLen = getUnsignedShort(lfhBuffer, LOC_FILENAMELEN);\n int extFieldLen = getUnsignedShort(lfhBuffer, LOC_EXTFLDLEN);\n long nextSigPos = startLocRecord + LOCLEN + compressedSize + fnLen + extFieldLen;\n\n read(lfhBuffer, channel, nextSigPos);\n long header = getUnsignedInt(lfhBuffer, 0);\n return header == LOCSIG || header == EXTSIG || header == CENSIG;\n }",
"public static base_response clear(nitro_service client) throws Exception {\n\t\tgslbldnsentries clearresource = new gslbldnsentries();\n\t\treturn clearresource.perform_operation(client,\"clear\");\n\t}",
"public static boolean isConstant(Expression expression, Object expected) {\r\n return expression instanceof ConstantExpression && expected.equals(((ConstantExpression) expression).getValue());\r\n }",
"public final void begin() {\n this.file = this.getAppender().getIoFile();\n if (this.file == null) {\n this.getAppender().getErrorHandler()\n .error(\"Scavenger not started: missing log file name\");\n return;\n }\n if (this.getProperties().getScavengeInterval() > -1) {\n final Thread thread = new Thread(this, \"Log4J File Scavenger\");\n thread.setDaemon(true);\n thread.start();\n this.threadRef = thread;\n }\n }",
"public Style createStyle(final List<Rule> styleRules) {\n final Rule[] rulesArray = styleRules.toArray(new Rule[0]);\n final FeatureTypeStyle featureTypeStyle = this.styleBuilder.createFeatureTypeStyle(null, rulesArray);\n final Style style = this.styleBuilder.createStyle();\n style.featureTypeStyles().add(featureTypeStyle);\n return style;\n }",
"private static byte calculateChecksum(byte[] buffer) {\n\t\tbyte checkSum = (byte)0xFF;\n\t\tfor (int i=1; i<buffer.length-1; i++) {\n\t\t\tcheckSum = (byte) (checkSum ^ buffer[i]);\n\t\t}\n\t\tlogger.trace(String.format(\"Calculated checksum = 0x%02X\", checkSum));\n\t\treturn checkSum;\n\t}",
"public static boolean isRowsLinearIndependent( DMatrixRMaj A )\n {\n // LU decomposition\n LUDecomposition<DMatrixRMaj> lu = DecompositionFactory_DDRM.lu(A.numRows,A.numCols);\n if( lu.inputModified() )\n A = A.copy();\n\n if( !lu.decompose(A))\n throw new RuntimeException(\"Decompositon failed?\");\n\n // if they are linearly independent it should not be singular\n return !lu.isSingular();\n }",
"public static JRDesignExpression getDataSourceExpression(DJDataSource ds) {\n JRDesignExpression exp = new JRDesignExpression();\n exp.setValueClass(JRDataSource.class);\n\n String dsType = getDataSourceTypeStr(ds.getDataSourceType());\n String expText = null;\n if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_ORIGIN_FIELD) {\n expText = dsType + \"$F{\" + ds.getDataSourceExpression() + \"})\";\n } else if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_ORIGIN_PARAMETER) {\n expText = dsType + REPORT_PARAMETERS_MAP + \".get( \\\"\" + ds.getDataSourceExpression() + \"\\\" ) )\";\n } else if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_TYPE_SQL_CONNECTION) {\n expText = dsType + REPORT_PARAMETERS_MAP + \".get( \\\"\" + ds.getDataSourceExpression() + \"\\\" ) )\";\n } else if (ds.getDataSourceOrigin() == DJConstants.DATA_SOURCE_ORIGIN_REPORT_DATASOURCE) {\n expText = \"((\" + JRDataSource.class.getName() + \") $P{REPORT_DATA_SOURCE})\";\n }\n\n exp.setText(expText);\n\n return exp;\n }",
"public static ClassNode getWrapper(ClassNode cn) {\n cn = cn.redirect();\n if (!isPrimitiveType(cn)) return cn;\n if (cn==boolean_TYPE) {\n return Boolean_TYPE;\n } else if (cn==byte_TYPE) {\n return Byte_TYPE;\n } else if (cn==char_TYPE) {\n return Character_TYPE;\n } else if (cn==short_TYPE) {\n return Short_TYPE;\n } else if (cn==int_TYPE) {\n return Integer_TYPE;\n } else if (cn==long_TYPE) {\n return Long_TYPE;\n } else if (cn==float_TYPE) {\n return Float_TYPE;\n } else if (cn==double_TYPE) {\n return Double_TYPE;\n } else if (cn==VOID_TYPE) {\n return void_WRAPPER_TYPE;\n }\n else {\n return cn;\n }\n }"
] |
Returns a single parent of the given tag. If there are multiple parents, throws a WindupException. | [
"public static TagModel getSingleParent(TagModel tag)\n {\n final Iterator<TagModel> parents = tag.getDesignatedByTags().iterator();\n if (!parents.hasNext())\n throw new WindupException(\"Tag is not designated by any tags: \" + tag);\n\n final TagModel maybeOnlyParent = parents.next();\n\n if (parents.hasNext()) {\n StringBuilder sb = new StringBuilder();\n tag.getDesignatedByTags().iterator().forEachRemaining(x -> sb.append(x).append(\", \"));\n throw new WindupException(String.format(\"Tag %s is designated by multiple tags: %s\", tag, sb.toString()));\n }\n\n return maybeOnlyParent;\n }"
] | [
"@Override\n public DMatrixRMaj getA() {\n if( A.data.length < numRows*numCols ) {\n A = new DMatrixRMaj(numRows,numCols);\n }\n A.reshape(numRows,numCols, false);\n CommonOps_DDRM.mult(Q,R,A);\n\n return A;\n }",
"public List<BoxTask.Info> getTasks(String... fields) {\n QueryStringBuilder builder = new QueryStringBuilder();\n if (fields.length > 0) {\n builder.appendParam(\"fields\", fields).toString();\n }\n URL url = GET_TASKS_URL_TEMPLATE.buildWithQuery(this.getAPI().getBaseURL(), builder.toString(), 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 List<BoxTask.Info> tasks = new ArrayList<BoxTask.Info>(totalCount);\n JsonArray entries = responseJSON.get(\"entries\").asArray();\n for (JsonValue value : entries) {\n JsonObject taskJSON = value.asObject();\n BoxTask task = new BoxTask(this.getAPI(), taskJSON.get(\"id\").asString());\n BoxTask.Info info = task.new Info(taskJSON);\n tasks.add(info);\n }\n\n return tasks;\n }",
"protected I_CmsSearchConfigurationSortOption parseSortOption(JSONObject json) {\n\n try {\n String solrValue = json.getString(JSON_KEY_SORTOPTION_SOLRVALUE);\n String paramValue = parseOptionalStringValue(json, JSON_KEY_SORTOPTION_PARAMVALUE);\n paramValue = (paramValue == null) ? solrValue : paramValue;\n String label = parseOptionalStringValue(json, JSON_KEY_SORTOPTION_LABEL);\n label = (label == null) ? paramValue : label;\n return new CmsSearchConfigurationSortOption(label, paramValue, solrValue);\n } catch (JSONException e) {\n LOG.error(\n Messages.get().getBundle().key(Messages.ERR_SORT_OPTION_NOT_PARSABLE_1, JSON_KEY_SORTOPTION_SOLRVALUE),\n e);\n return null;\n }\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 int updateRaw(DatabaseConnection connection, String statement, String[] arguments) throws SQLException {\n\t\tlogger.debug(\"running raw update statement: {}\", statement);\n\t\tif (arguments.length > 0) {\n\t\t\t// need to do the (Object) cast to force args to be a single object\n\t\t\tlogger.trace(\"update arguments: {}\", (Object) arguments);\n\t\t}\n\t\tCompiledStatement compiledStatement = connection.compileStatement(statement, StatementType.UPDATE, noFieldTypes,\n\t\t\t\tDatabaseConnection.DEFAULT_RESULT_FLAGS, false);\n\t\ttry {\n\t\t\tassignStatementArguments(compiledStatement, arguments);\n\t\t\treturn compiledStatement.runUpdate();\n\t\t} finally {\n\t\t\tIOUtils.closeThrowSqlException(compiledStatement, \"compiled statement\");\n\t\t}\n\t}",
"private void handleRequestNodeInfoResponse(SerialMessage incomingMessage) {\n\t\tlogger.trace(\"Handle RequestNodeInfo Response\");\n\t\tif(incomingMessage.getMessageBuffer()[2] != 0x00)\n\t\t\tlogger.debug(\"Request node info successfully placed on stack.\");\n\t\telse\n\t\t\tlogger.error(\"Request node info not placed on stack due to error.\");\n\t}",
"public static Method findSetMethod(Field field, DatabaseType databaseType, boolean throwExceptions)\n\t\t\tthrows IllegalArgumentException {\n\t\tMethod fieldSetMethod = findMethodFromNames(field, false, throwExceptions,\n\t\t\t\tmethodFromField(field, \"set\", databaseType, true), methodFromField(field, \"set\", databaseType, false));\n\t\tif (fieldSetMethod == null) {\n\t\t\treturn null;\n\t\t}\n\t\tif (fieldSetMethod.getReturnType() != void.class) {\n\t\t\tif (throwExceptions) {\n\t\t\t\tthrow new IllegalArgumentException(\"Return type of set method \" + fieldSetMethod.getName() + \" returns \"\n\t\t\t\t\t\t+ fieldSetMethod.getReturnType() + \" instead of void\");\n\t\t\t} else {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\treturn fieldSetMethod;\n\t}",
"private List<Row> join(List<Row> leftRows, String leftColumn, String rightTable, List<Row> rightRows, String rightColumn)\n {\n List<Row> result = new LinkedList<Row>();\n\n RowComparator leftComparator = new RowComparator(new String[]\n {\n leftColumn\n });\n RowComparator rightComparator = new RowComparator(new String[]\n {\n rightColumn\n });\n Collections.sort(leftRows, leftComparator);\n Collections.sort(rightRows, rightComparator);\n\n ListIterator<Row> rightIterator = rightRows.listIterator();\n Row rightRow = rightIterator.hasNext() ? rightIterator.next() : null;\n\n for (Row leftRow : leftRows)\n {\n Integer leftValue = leftRow.getInteger(leftColumn);\n boolean match = false;\n\n while (rightRow != null)\n {\n Integer rightValue = rightRow.getInteger(rightColumn);\n int comparison = leftValue.compareTo(rightValue);\n if (comparison == 0)\n {\n match = true;\n break;\n }\n\n if (comparison < 0)\n {\n if (rightIterator.hasPrevious())\n {\n rightRow = rightIterator.previous();\n }\n break;\n }\n\n rightRow = rightIterator.next();\n }\n\n if (match && rightRow != null)\n {\n Map<String, Object> newMap = new HashMap<String, Object>(((MapRow) leftRow).getMap());\n\n for (Entry<String, Object> entry : ((MapRow) rightRow).getMap().entrySet())\n {\n String key = entry.getKey();\n if (newMap.containsKey(key))\n {\n key = rightTable + \".\" + key;\n }\n newMap.put(key, entry.getValue());\n }\n\n result.add(new MapRow(newMap));\n }\n }\n\n return result;\n }",
"private void dbUpgrade()\n {\n DbConn cnx = this.getConn();\n Map<String, Object> rs = null;\n int db_schema_version = 0;\n try\n {\n rs = cnx.runSelectSingleRow(\"version_select_latest\");\n db_schema_version = (Integer) rs.get(\"VERSION_D1\");\n }\n catch (Exception e)\n {\n // Database is to be created, so version 0 is OK.\n }\n cnx.rollback();\n\n if (SCHEMA_VERSION > db_schema_version)\n {\n jqmlogger.warn(\"Database is being upgraded from version {} to version {}\", db_schema_version, SCHEMA_VERSION);\n\n // Upgrade scripts are named from_to.sql with 5 padding (e.g. 00000_00003.sql)\n // We try to find the fastest path (e.g. a direct 00000_00005.sql for creating a version 5 schema from nothing)\n // This is a simplistic and non-optimal algorithm as we try only a single path (no going back)\n\n int loop_from = db_schema_version;\n int to = db_schema_version;\n List<String> toApply = new ArrayList<>();\n toApply.addAll(adapter.preSchemaCreationScripts());\n\n while (to != SCHEMA_VERSION)\n {\n boolean progressed = false;\n for (int loop_to = SCHEMA_VERSION; loop_to > db_schema_version; loop_to--)\n {\n String migrationFileName = String.format(\"/sql/%05d_%05d.sql\", loop_from, loop_to);\n jqmlogger.debug(\"Trying migration script {}\", migrationFileName);\n if (Db.class.getResource(migrationFileName) != null)\n {\n toApply.add(migrationFileName);\n to = loop_to;\n loop_from = loop_to;\n progressed = true;\n break;\n }\n }\n\n if (!progressed)\n {\n break;\n }\n }\n if (to != SCHEMA_VERSION)\n {\n throw new DatabaseException(\n \"There is no migration path from version \" + db_schema_version + \" to version \" + SCHEMA_VERSION);\n }\n\n for (String s : toApply)\n {\n jqmlogger.info(\"Running migration script {}\", s);\n ScriptRunner.run(cnx, s);\n }\n cnx.commit(); // Yes, really. For advanced DB!\n\n cnx.close(); // HSQLDB does not refresh its schema without this.\n cnx = getConn();\n\n cnx.runUpdate(\"version_insert\", SCHEMA_VERSION, SCHEMA_COMPATIBLE_VERSION);\n cnx.commit();\n jqmlogger.info(\"Database is now up to date\");\n }\n else\n {\n jqmlogger.info(\"Database is already up to date\");\n }\n cnx.close();\n }"
] |
Creates an endpoint reference from a given adress.
@param address
@param props
@return | [
"private static EndpointReferenceType createEPR(String address, SLProperties props) {\n EndpointReferenceType epr = WSAEndpointReferenceUtils.getEndpointReference(address);\n if (props != null) {\n addProperties(epr, props);\n }\n return epr;\n }"
] | [
"public static <T> PollingState<T> create(Response<ResponseBody> response, LongRunningOperationOptions lroOptions, int defaultRetryTimeout, Type resourceType, SerializerAdapter<?> serializerAdapter) throws IOException {\n PollingState<T> pollingState = new PollingState<>();\n pollingState.initialHttpMethod = response.raw().request().method();\n pollingState.defaultRetryTimeout = defaultRetryTimeout;\n pollingState.withResponse(response);\n pollingState.resourceType = resourceType;\n pollingState.serializerAdapter = serializerAdapter;\n pollingState.loggingContext = response.raw().request().header(LOGGING_HEADER);\n pollingState.finalStateVia = lroOptions.finalStateVia();\n\n String responseContent = null;\n PollingResource resource = null;\n if (response.body() != null) {\n responseContent = response.body().string();\n response.body().close();\n }\n if (responseContent != null && !responseContent.isEmpty()) {\n pollingState.resource = serializerAdapter.deserialize(responseContent, resourceType);\n resource = serializerAdapter.deserialize(responseContent, PollingResource.class);\n }\n final int statusCode = pollingState.response.code();\n if (resource != null && resource.properties != null\n && resource.properties.provisioningState != null) {\n pollingState.withStatus(resource.properties.provisioningState, statusCode);\n } else {\n switch (statusCode) {\n case 202:\n pollingState.withStatus(AzureAsyncOperation.IN_PROGRESS_STATUS, statusCode);\n break;\n case 204:\n case 201:\n case 200:\n pollingState.withStatus(AzureAsyncOperation.SUCCESS_STATUS, statusCode);\n break;\n default:\n pollingState.withStatus(AzureAsyncOperation.FAILED_STATUS, statusCode);\n }\n }\n return pollingState;\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}",
"public boolean addDescriptor() {\n\n saveLocalization();\n IndexedContainer oldContainer = m_container;\n try {\n createAndLockDescriptorFile();\n unmarshalDescriptor();\n updateBundleDescriptorContent();\n m_hasMasterMode = true;\n m_container = createContainer();\n m_editorState.put(EditMode.DEFAULT, getDefaultState());\n m_editorState.put(EditMode.MASTER, getMasterState());\n } catch (CmsException | IOException e) {\n LOG.error(e.getLocalizedMessage(), e);\n if (m_descContent != null) {\n m_descContent = null;\n }\n if (m_descFile != null) {\n m_descFile = null;\n }\n if (m_desc != null) {\n try {\n m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(1));\n } catch (CmsException ex) {\n LOG.error(ex.getLocalizedMessage(), ex);\n }\n m_desc = null;\n }\n m_hasMasterMode = false;\n m_container = oldContainer;\n return false;\n }\n m_removeDescriptorOnCancel = true;\n return true;\n }",
"@Override\n public void onBindViewHolder(GalleryAdapter.ViewHolder holder, int position, List<Object> payloads) {\n if (payloads.isEmpty()) { // If doesn't have any payload then bind the fully item\n super.onBindViewHolder(holder, position, payloads);\n } else {\n for (Object payload : payloads) {\n boolean selected = isSelected(position);\n if (SELECTION_PAYLOAD.equals(payload)) {\n if (VIEW_TYPE_MEDIA == getItemViewType(position)) {\n MediaViewHolder viewHolder = (MediaViewHolder) holder;\n viewHolder.mCheckView.setChecked(selected);\n if (selected) {\n AnimationHelper.scaleView(holder.mImageView, SELECTED_SCALE);\n } else {\n AnimationHelper.scaleView(holder.mImageView, UNSELECTED_SCALE);\n }\n }\n }\n }\n }\n }",
"public CollectionRequest<CustomField> findByWorkspace(String workspace) {\n \n String path = String.format(\"/workspaces/%s/custom_fields\", workspace);\n return new CollectionRequest<CustomField>(this, CustomField.class, path, \"GET\");\n }",
"public static void checkFolderForFile(String fileName) throws IOException {\n\n\t\tif (fileName.lastIndexOf(File.separator) > 0) {\n\t\t\tString folder = fileName.substring(0, fileName.lastIndexOf(File.separator));\n\t\t\tdirectoryCheck(folder);\n\t\t}\n\t}",
"public static rnatip_stats get(nitro_service service, String Rnatip) throws Exception{\n\t\trnatip_stats obj = new rnatip_stats();\n\t\tobj.set_Rnatip(Rnatip);\n\t\trnatip_stats response = (rnatip_stats) obj.stat_resource(service);\n\t\treturn response;\n\t}",
"public static base_responses add(nitro_service client, systemuser resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tsystemuser addresources[] = new systemuser[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new systemuser();\n\t\t\t\taddresources[i].username = resources[i].username;\n\t\t\t\taddresources[i].password = resources[i].password;\n\t\t\t\taddresources[i].externalauth = resources[i].externalauth;\n\t\t\t\taddresources[i].promptstring = resources[i].promptstring;\n\t\t\t\taddresources[i].timeout = resources[i].timeout;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}",
"public void setColorInterpolated(int index, int firstIndex, int lastIndex, int color) {\n\t\tint firstColor = map[firstIndex];\n\t\tint lastColor = map[lastIndex];\n\t\tfor (int i = firstIndex; i <= index; i++)\n\t\t\tmap[i] = ImageMath.mixColors((float)(i-firstIndex)/(index-firstIndex), firstColor, color);\n\t\tfor (int i = index; i < lastIndex; i++)\n\t\t\tmap[i] = ImageMath.mixColors((float)(i-index)/(lastIndex-index), color, lastColor);\n\t}"
] |
Remove any overrides for an endpoint
@param pathValue path (endpoint) value
@param requestType path request type. "GET", "POST", etc
@return true if success, false otherwise | [
"public boolean removeCustomResponse(String pathValue, String requestType) {\n try {\n JSONObject path = getPathFromEndpoint(pathValue, requestType);\n if (path == null) {\n return false;\n }\n String pathId = path.getString(\"pathId\");\n return resetResponseOverride(pathId);\n } catch (Exception e) {\n e.printStackTrace();\n }\n return false;\n }"
] | [
"private void setTableAliasForPath(String aPath, List hintClasses, TableAlias anAlias)\r\n {\r\n m_pathToAlias.put(buildAliasKey(aPath, hintClasses), anAlias);\r\n }",
"public T withLabel(String text, String languageCode) {\n\t\twithLabel(factory.getMonolingualTextValue(text, languageCode));\n\t\treturn getThis();\n\t}",
"private void flush(final boolean propagate) throws IOException {\n final int avail = baseNCodec.available(context);\n if (avail > 0) {\n final byte[] buf = new byte[avail];\n final int c = baseNCodec.readResults(buf, 0, avail, context);\n if (c > 0) {\n out.write(buf, 0, c);\n }\n }\n if (propagate) {\n out.flush();\n }\n }",
"private boolean somethingMayHaveChanged(PhaseInterceptorChain pic) {\n Iterator<Interceptor<? extends Message>> it = pic.iterator();\n Interceptor<? extends Message> last = null;\n while (it.hasNext()) {\n Interceptor<? extends Message> cur = it.next();\n if (cur == this) {\n if (last instanceof DemoInterceptor) {\n return false;\n }\n return true;\n }\n last = cur;\n }\n return true;\n }",
"public synchronized void cleanWaitTaskQueue() {\n\n for (ParallelTask task : waitQ) {\n task.setState(ParallelTaskState.COMPLETED_WITH_ERROR);\n task.getTaskErrorMetas().add(\n new TaskErrorMeta(TaskErrorType.USER_CANCELED, \"NA\"));\n logger.info(\n \"task {} removed from wait q. This task has been marked as USER CANCELED.\",\n task.getTaskId());\n\n }\n\n waitQ.clear();\n }",
"protected void parseLinks(CmsObject cms) throws CmsException {\n\n List<CmsResource> linkParseables = new ArrayList<>();\n for (CmsResourceImportData resData : m_moduleData.getResourceData()) {\n CmsResource importRes = resData.getImportResource();\n if ((importRes != null) && m_importIds.contains(importRes.getStructureId()) && isLinkParsable(importRes)) {\n linkParseables.add(importRes);\n }\n }\n m_report.println(Messages.get().container(Messages.RPT_START_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);\n CmsImportVersion10.parseLinks(cms, linkParseables, m_report);\n m_report.println(Messages.get().container(Messages.RPT_END_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);\n }",
"@Override\n public void populateObject(ProcessedCommand<Command<CI>, CI> processedCommand, InvocationProviders invocationProviders,\n AeshContext aeshContext, CommandLineParser.Mode mode)\n throws CommandLineParserException, OptionValidatorException {\n if(processedCommand.parserExceptions().size() > 0 && mode == CommandLineParser.Mode.VALIDATE)\n throw processedCommand.parserExceptions().get(0);\n for(ProcessedOption option : processedCommand.getOptions()) {\n if(option.getValues() != null && option.getValues().size() > 0)\n option.injectValueIntoField(getObject(), invocationProviders, aeshContext,\n mode == CommandLineParser.Mode.VALIDATE );\n else if(option.getDefaultValues().size() > 0) {\n option.injectValueIntoField(getObject(), invocationProviders, aeshContext,\n mode == CommandLineParser.Mode.VALIDATE);\n }\n else if(option.getOptionType().equals(OptionType.GROUP) && option.getProperties().size() > 0)\n option.injectValueIntoField(getObject(), invocationProviders, aeshContext,\n mode == CommandLineParser.Mode.VALIDATE);\n else\n resetField(getObject(), option.getFieldName(), option.hasValue());\n }\n //arguments\n if(processedCommand.getArguments() != null &&\n (processedCommand.getArguments().getValues().size() > 0 || processedCommand.getArguments().getDefaultValues().size() > 0))\n processedCommand.getArguments().injectValueIntoField(getObject(), invocationProviders, aeshContext,\n mode == CommandLineParser.Mode.VALIDATE);\n else if(processedCommand.getArguments() != null)\n resetField(getObject(), processedCommand.getArguments().getFieldName(), true);\n //argument\n if(processedCommand.getArgument() != null &&\n (processedCommand.getArgument().getValues().size() > 0 || processedCommand.getArgument().getDefaultValues().size() > 0))\n processedCommand.getArgument().injectValueIntoField(getObject(), invocationProviders, aeshContext,\n mode == CommandLineParser.Mode.VALIDATE);\n else if(processedCommand.getArgument() != null)\n resetField(getObject(), processedCommand.getArgument().getFieldName(), true);\n }",
"public Iterator getAllBaseTypes()\r\n {\r\n ArrayList baseTypes = new ArrayList();\r\n\r\n baseTypes.addAll(_directBaseTypes.values());\r\n\r\n for (int idx = baseTypes.size() - 1; idx >= 0; idx--)\r\n {\r\n ClassDescriptorDef curClassDef = (ClassDescriptorDef)baseTypes.get(idx);\r\n\r\n for (Iterator it = curClassDef.getDirectBaseTypes(); it.hasNext();)\r\n {\r\n ClassDescriptorDef curBaseTypeDef = (ClassDescriptorDef)it.next();\r\n\r\n if (!baseTypes.contains(curBaseTypeDef))\r\n {\r\n baseTypes.add(0, curBaseTypeDef);\r\n idx++;\r\n }\r\n }\r\n }\r\n return baseTypes.iterator();\r\n }",
"public static Dimension dimensionsToFit(Dimension target, Dimension source) {\n\n // if target width/height is zero then we have no preference for that, so set it to the original value,\n // since it cannot be any larger\n int maxWidth;\n if (target.getX() == 0) {\n maxWidth = source.getX();\n } else {\n maxWidth = target.getX();\n }\n\n int maxHeight;\n if (target.getY() == 0) {\n maxHeight = source.getY();\n } else {\n maxHeight = target.getY();\n }\n\n double wscale = maxWidth / (double) source.getX();\n double hscale = maxHeight / (double) source.getY();\n\n if (wscale < hscale)\n return new Dimension((int) (source.getX() * wscale), (int) (source.getY() * wscale));\n else\n return new Dimension((int) (source.getX() * hscale), (int) (source.getY() * hscale));\n }"
] |
Visit the implicit first frame of this method. | [
"private void visitImplicitFirstFrame() {\n // There can be at most descriptor.length() + 1 locals\n int frameIndex = startFrame(0, descriptor.length() + 1, 0);\n if ((access & Opcodes.ACC_STATIC) == 0) {\n if ((access & ACC_CONSTRUCTOR) == 0) {\n frame[frameIndex++] = Frame.OBJECT | cw.addType(cw.thisName);\n } else {\n frame[frameIndex++] = Frame.UNINITIALIZED_THIS;\n }\n }\n int i = 1;\n loop: while (true) {\n int j = i;\n switch (descriptor.charAt(i++)) {\n case 'Z':\n case 'C':\n case 'B':\n case 'S':\n case 'I':\n frame[frameIndex++] = Frame.INTEGER;\n break;\n case 'F':\n frame[frameIndex++] = Frame.FLOAT;\n break;\n case 'J':\n frame[frameIndex++] = Frame.LONG;\n break;\n case 'D':\n frame[frameIndex++] = Frame.DOUBLE;\n break;\n case '[':\n while (descriptor.charAt(i) == '[') {\n ++i;\n }\n if (descriptor.charAt(i) == 'L') {\n ++i;\n while (descriptor.charAt(i) != ';') {\n ++i;\n }\n }\n frame[frameIndex++] = Frame.type(cw, descriptor.substring(j, ++i));\n break;\n case 'L':\n while (descriptor.charAt(i) != ';') {\n ++i;\n }\n frame[frameIndex++] = Frame.OBJECT\n | cw.addType(descriptor.substring(j + 1, i++));\n break;\n default:\n break loop;\n }\n }\n frame[1] = frameIndex - 3;\n endFrame();\n }"
] | [
"public static cachecontentgroup[] get(nitro_service service) throws Exception{\n\t\tcachecontentgroup obj = new cachecontentgroup();\n\t\tcachecontentgroup[] response = (cachecontentgroup[])obj.get_resources(service);\n\t\treturn response;\n\t}",
"private String parseLayerId(HttpServletRequest request) {\n\t\tStringTokenizer tokenizer = new StringTokenizer(request.getRequestURI(), \"/\");\n\t\tString token = \"\";\n\t\twhile (tokenizer.hasMoreTokens()) {\n\t\t\ttoken = tokenizer.nextToken();\n\t\t}\n\t\treturn token;\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 Map<String, String> getAttributes() {\n if (attributes == null) {\n return null;\n } else {\n return Collections.unmodifiableMap(attributes);\n }\n }",
"@UiThread\n public int getParentAdapterPosition() {\n int flatPosition = getAdapterPosition();\n if (flatPosition == RecyclerView.NO_POSITION) {\n return flatPosition;\n }\n\n return mExpandableAdapter.getNearestParentPosition(flatPosition);\n }",
"public void sendEventsFromQueue() {\n if (null == queue || stopSending) {\n return;\n }\n LOG.fine(\"Scheduler called for sending events\");\n\n int packageSize = getEventsPerMessageCall();\n\n while (!queue.isEmpty()) {\n final List<Event> list = new ArrayList<Event>();\n int i = 0;\n while (i < packageSize && !queue.isEmpty()) {\n Event event = queue.remove();\n if (event != null && !filter(event)) {\n list.add(event);\n i++;\n }\n }\n if (list.size() > 0) {\n executor.execute(new Runnable() {\n public void run() {\n try {\n sendEvents(list);\n } catch (MonitoringException e) {\n e.logException(Level.SEVERE);\n }\n }\n });\n\n }\n }\n\n }",
"int getDelay(int n) {\n int delay = -1;\n if ((n >= 0) && (n < header.frameCount)) {\n delay = header.frames.get(n).delay;\n }\n return delay;\n }",
"public static final String printDate(Date value)\n {\n return (value == null ? null : DATE_FORMAT.get().format(value));\n }",
"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}"
] |
Removes an Object from the cache. | [
"public void remove(Identity oid)\r\n {\r\n //processQueue();\r\n if(oid != null)\r\n {\r\n removeTracedIdentity(oid);\r\n objectTable.remove(buildKey(oid));\r\n if(log.isDebugEnabled()) log.debug(\"Remove object \" + oid);\r\n }\r\n }"
] | [
"static Shell createTerminalConsoleShell(String prompt, String appName,\n ShellCommandHandler mainHandler, InputStream input, OutputStream output) {\n try {\n PrintStream out = new PrintStream(output);\n\n // Build jline terminal\n jline.Terminal term = TerminalFactory.get();\n final ConsoleReader console = new ConsoleReader(input, output, term);\n console.setBellEnabled(true);\n console.setHistoryEnabled(true);\n\n // Build console\n BufferedReader in = new BufferedReader(new InputStreamReader(\n new ConsoleReaderInputStream(console)));\n\n ConsoleIO.PromptListener promptListener = new ConsoleIO.PromptListener() {\n @Override\n public boolean onPrompt(String prompt) {\n console.setPrompt(prompt);\n return true; // suppress normal prompt\n }\n };\n\n return createConsoleShell(prompt, appName, mainHandler, in, out, out, promptListener);\n } catch (Exception e) {\n // Failover: use default shell\n BufferedReader in = new BufferedReader(new InputStreamReader(input));\n PrintStream out = new PrintStream(output);\n\n return createConsoleShell(prompt, appName, mainHandler, in, out, out, null);\n }\n }",
"protected int mapGanttBarHeight(int height)\n {\n switch (height)\n {\n case 0:\n {\n height = 6;\n break;\n }\n\n case 1:\n {\n height = 8;\n break;\n }\n\n case 2:\n {\n height = 10;\n break;\n }\n\n case 3:\n {\n height = 12;\n break;\n }\n\n case 4:\n {\n height = 14;\n break;\n }\n\n case 5:\n {\n height = 18;\n break;\n }\n\n case 6:\n {\n height = 24;\n break;\n }\n }\n\n return (height);\n }",
"protected <E> E read(Supplier<E> sup) {\n try {\n this.lock.readLock().lock();\n return sup.get();\n } finally {\n this.lock.readLock().unlock();\n }\n }",
"@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoZonedDateTime<AccountingDate> zonedDateTime(TemporalAccessor temporal) {\n return (ChronoZonedDateTime<AccountingDate>) super.zonedDateTime(temporal);\n }",
"private Query getReportQueryByCriteriaCount(ReportQueryByCriteria aQuery)\r\n {\r\n ReportQueryByCriteria countQuery = (ReportQueryByCriteria) getQueryByCriteriaCount(aQuery);\r\n\r\n // BRJ: keep the original columns to build the Join\r\n countQuery.setJoinAttributes(aQuery.getAttributes());\r\n\r\n // BRJ: we have to preserve groupby information\r\n Iterator iter = aQuery.getGroupBy().iterator();\r\n while(iter.hasNext())\r\n {\r\n countQuery.addGroupBy((FieldHelper) iter.next());\r\n }\r\n\r\n return countQuery;\r\n }",
"public static int longestCommonContiguousSubstring(String s, String t) {\r\n if (s.length() == 0 || t.length() == 0) {\r\n return 0;\r\n }\r\n int M = s.length();\r\n int N = t.length();\r\n int[][] d = new int[M + 1][N + 1];\r\n for (int j = 0; j <= N; j++) {\r\n d[0][j] = 0;\r\n }\r\n for (int i = 0; i <= M; i++) {\r\n d[i][0] = 0;\r\n }\r\n\r\n int max = 0;\r\n for (int i = 1; i <= M; i++) {\r\n for (int j = 1; j <= N; j++) {\r\n if (s.charAt(i - 1) == t.charAt(j - 1)) {\r\n d[i][j] = d[i - 1][j - 1] + 1;\r\n } else {\r\n d[i][j] = 0;\r\n }\r\n\r\n if (d[i][j] > max) {\r\n max = d[i][j];\r\n }\r\n }\r\n }\r\n // System.err.println(\"LCCS(\" + s + \",\" + t + \") = \" + max);\r\n return max;\r\n }",
"private static Class<?> extractClass(Class<?> ownerClass, Type arg) {\n\t\tif (arg instanceof ParameterizedType) {\n\t\t\treturn extractClass(ownerClass, ((ParameterizedType) arg).getRawType());\n\t\t}\n\t\telse if (arg instanceof GenericArrayType) {\n\t\t\tGenericArrayType gat = (GenericArrayType) arg;\n\t\t\tType gt = gat.getGenericComponentType();\n\t\t\tClass<?> componentClass = extractClass(ownerClass, gt);\n\t\t\treturn Array.newInstance(componentClass, 0).getClass();\n\t\t}\n\t\telse if (arg instanceof TypeVariable) {\n\t\t\tTypeVariable tv = (TypeVariable) arg;\n\t\t\targ = getTypeVariableMap(ownerClass).get(tv);\n\t\t\tif (arg == null) {\n\t\t\t\targ = extractBoundForTypeVariable(tv);\n\t\t\t\tif (arg instanceof ParameterizedType) {\n\t\t\t\t\treturn extractClass(ownerClass, ((ParameterizedType) arg).getRawType());\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn extractClass(ownerClass, arg);\n\t\t\t}\n\t\t}\n\t\treturn (arg instanceof Class ? (Class) arg : Object.class);\n\t}",
"protected void appenHtmlFooter(StringBuffer buffer) {\n\n if (m_configuredFooter != null) {\n buffer.append(m_configuredFooter);\n } else {\n buffer.append(\" </body>\\r\\n\" + \"</html>\");\n }\n }",
"private static Point findMidnormalPoint(Point center, Point a, Point b, Rect area, int radius) {\n if (a.y == b.y) {\n //top\n if (a.y < center.y) {\n return new Point((a.x + b.x) / 2, center.y + radius);\n }\n //bottom\n return new Point((a.x + b.x) / 2, center.y - radius);\n }\n if (a.x == b.x) {\n //left\n if (a.x < center.x) {\n return new Point(center.x + radius, (a.y + b.y) / 2);\n }\n //right\n return new Point(center.x - radius, (a.y + b.y) / 2);\n }\n //slope of line ab\n double abSlope = (a.y - b.y) / (a.x - b.x * 1.0);\n //slope of midnormal\n double midnormalSlope = -1.0 / abSlope;\n\n double radian = Math.tan(midnormalSlope);\n int dy = (int) (radius * Math.sin(radian));\n int dx = (int) (radius * Math.cos(radian));\n Point point = new Point(center.x + dx, center.y + dy);\n if (!inArea(point, area, 0)) {\n point = new Point(center.x - dx, center.y - dy);\n }\n return point;\n }"
] |
generate a prepared DELETE-Statement for the Class
described by cld.
@param cld the ClassDescriptor | [
"public SqlStatement getPreparedDeleteStatement(ClassDescriptor cld)\r\n {\r\n SqlForClass sfc = getSqlForClass(cld);\r\n SqlStatement sql = sfc.getDeleteSql();\r\n if(sql == null)\r\n {\r\n ProcedureDescriptor pd = cld.getDeleteProcedure();\r\n\r\n if(pd == null)\r\n {\r\n sql = new SqlDeleteByPkStatement(cld, logger);\r\n }\r\n else\r\n {\r\n sql = new SqlProcedureStatement(pd, logger);\r\n }\r\n // set the sql string\r\n sfc.setDeleteSql(sql);\r\n\r\n if(logger.isDebugEnabled())\r\n {\r\n logger.debug(\"SQL:\" + sql.getStatement());\r\n }\r\n }\r\n return sql;\r\n }"
] | [
"private AirMapViewBuilder getWebMapViewBuilder() {\n if (context != null) {\n try {\n ApplicationInfo ai = context.getPackageManager()\n .getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);\n Bundle bundle = ai.metaData;\n String accessToken = bundle.getString(\"com.mapbox.ACCESS_TOKEN\");\n String mapId = bundle.getString(\"com.mapbox.MAP_ID\");\n\n if (!TextUtils.isEmpty(accessToken) && !TextUtils.isEmpty(mapId)) {\n return new MapboxWebMapViewBuilder(accessToken, mapId);\n }\n } catch (PackageManager.NameNotFoundException e) {\n Log.e(TAG, \"Failed to load Mapbox access token and map id\", e);\n }\n }\n return new WebAirMapViewBuilder();\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 }",
"private void processKeyValue(Map<ConfigurationKey, Object> properties, ConfigurationKey key, Object value) {\n if (value instanceof String) {\n value = key.convertValue((String) value);\n }\n if (key.isValidValue(value)) {\n Object previous = properties.put(key, value);\n if (previous != null && !previous.equals(value)) {\n throw ConfigurationLogger.LOG.configurationKeyHasDifferentValues(key.get(), previous, value);\n }\n } else {\n throw ConfigurationLogger.LOG.invalidConfigurationPropertyValue(value, key.get());\n }\n }",
"protected void mergeHardcodedResultsFrom(Configuration otherConfiguration) {\r\n Map<Dotted, AnalysisResult> resultsMap = hardcodedResults.build().stream()\r\n .collect(Collectors.toMap(r -> r.className, r -> r));\r\n resultsMap.putAll(otherConfiguration.hardcodedResults());\r\n hardcodedResults = ImmutableSet.<AnalysisResult>builder().addAll(resultsMap.values());\r\n }",
"private void buildMultiJoinTree(TableAlias left, ClassDescriptor cld, String name, boolean useOuterJoin)\r\n {\r\n DescriptorRepository repository = cld.getRepository();\r\n Class[] multiJoinedClasses = repository.getSubClassesMultipleJoinedTables(cld, false);\r\n\r\n for (int i = 0; i < multiJoinedClasses.length; i++)\r\n {\r\n ClassDescriptor subCld = repository.getDescriptorFor(multiJoinedClasses[i]);\r\n SuperReferenceDescriptor srd = subCld.getSuperReference();\r\n if (srd != null)\r\n {\r\n FieldDescriptor[] leftFields = subCld.getPkFields();\r\n FieldDescriptor[] rightFields = srd.getForeignKeyFieldDescriptors(subCld);\r\n TableAlias base_alias = getTableAliasForPath(name, null, null);\r\n\r\n String aliasName = String.valueOf(getAliasChar()) + m_aliasCount++;\r\n TableAlias right = new TableAlias(subCld, aliasName, false, null);\r\n\r\n Join join1to1 = new Join(left, leftFields, right, rightFields, useOuterJoin, \"subClass\");\r\n base_alias.addJoin(join1to1);\r\n\r\n buildMultiJoinTree(right, subCld, name, useOuterJoin);\r\n }\r\n }\r\n }",
"public static void openFavoriteDialog(CmsFileExplorer explorer) {\n\n try {\n CmsExplorerFavoriteContext context = new CmsExplorerFavoriteContext(A_CmsUI.getCmsObject(), explorer);\n CmsFavoriteDialog dialog = new CmsFavoriteDialog(context, new CmsFavoriteDAO(A_CmsUI.getCmsObject()));\n Window window = CmsBasicDialog.prepareWindow(DialogWidth.max);\n window.setContent(dialog);\n window.setCaption(CmsVaadinUtils.getMessageText(org.opencms.ui.Messages.GUI_FAVORITES_DIALOG_TITLE_0));\n A_CmsUI.get().addWindow(window);\n window.center();\n } catch (CmsException e) {\n CmsErrorDialog.showErrorDialog(e);\n }\n }",
"public InputStream sendRequest(String requestMethod,\n\t\t\tMap<String, String> parameters) throws IOException {\n\t\tString queryString = getQueryString(parameters);\n\t\tURL url = new URL(this.apiBaseUrl);\n\t\tHttpURLConnection connection = (HttpURLConnection) WebResourceFetcherImpl\n\t\t\t\t.getUrlConnection(url);\n\n\t\tsetupConnection(requestMethod, queryString, connection);\n\t\tOutputStreamWriter writer = new OutputStreamWriter(\n\t\t\t\tconnection.getOutputStream());\n\t\twriter.write(queryString);\n\t\twriter.flush();\n\t\twriter.close();\n\n\t\tint rc = connection.getResponseCode();\n\t\tif (rc != 200) {\n\t\t\tlogger.warn(\"Error: API request returned response code \" + rc);\n\t\t}\n\n\t\tInputStream iStream = connection.getInputStream();\n\t\tfillCookies(connection.getHeaderFields());\n\t\treturn iStream;\n\t}",
"private BasicCredentialsProvider getCredentialsProvider() {\n return new BasicCredentialsProvider() {\n private Set<AuthScope> authAlreadyTried = Sets.newHashSet();\n\n @Override\n public Credentials getCredentials(AuthScope authscope) {\n if (authAlreadyTried.contains(authscope)) {\n return null;\n }\n authAlreadyTried.add(authscope);\n return super.getCredentials(authscope);\n }\n };\n }",
"public ForeignkeyDef getForeignkey(String name, String tableName)\r\n {\r\n String realName = (name == null ? \"\" : name);\r\n ForeignkeyDef def = null;\r\n\r\n for (Iterator it = getForeignkeys(); it.hasNext();)\r\n {\r\n def = (ForeignkeyDef)it.next();\r\n if (realName.equals(def.getName()) &&\r\n def.getTableName().equals(tableName))\r\n {\r\n return def;\r\n }\r\n }\r\n return null;\r\n }"
] |
Answer the SQL-Clause for a LikeCriteria
@param c
@param buf | [
"private void appendLikeCriteria(TableAlias alias, PathInfo pathInfo, LikeCriteria c, StringBuffer buf)\r\n {\r\n appendColName(alias, pathInfo, c.isTranslateAttribute(), buf);\r\n buf.append(c.getClause());\r\n appendParameter(c.getValue(), buf);\r\n\r\n buf.append(m_platform.getEscapeClause(c));\r\n }"
] | [
"public void setDialect(String dialect) {\n String[] scripts = createScripts.get(dialect);\n createSql = scripts[0];\n createSqlInd = scripts[1];\n }",
"public static boolean distributeAndCheckResponse(DistributionBuilder distributionBuilder, ArtifactoryBuildInfoClient client, TaskListener listener,\n String buildName, String buildNumber, boolean dryRun) throws IOException {\n // do a dry run first\n listener.getLogger().println(\"Performing dry run distribution (no changes are made during dry run) ...\");\n if (!distribute(distributionBuilder, client, listener, buildName, buildNumber, true)) {\n return false;\n }\n listener.getLogger().println(\"Dry run finished successfully\");\n if (!dryRun) {\n listener.getLogger().println(\"Performing distribution ...\");\n if (!distribute(distributionBuilder, client, listener, buildName, buildNumber, false)) {\n return false;\n }\n listener.getLogger().println(\"Distribution completed successfully!\");\n }\n return true;\n }",
"public static void doExtendTraits(final ClassNode cNode, final SourceUnit unit, final CompilationUnit cu) {\n if (cNode.isInterface()) return;\n boolean isItselfTrait = Traits.isTrait(cNode);\n SuperCallTraitTransformer superCallTransformer = new SuperCallTraitTransformer(unit);\n if (isItselfTrait) {\n checkTraitAllowed(cNode, unit);\n return;\n }\n if (!cNode.getNameWithoutPackage().endsWith(Traits.TRAIT_HELPER)) {\n List<ClassNode> traits = findTraits(cNode);\n for (ClassNode trait : traits) {\n TraitHelpersTuple helpers = Traits.findHelpers(trait);\n applyTrait(trait, cNode, helpers);\n superCallTransformer.visitClass(cNode);\n if (unit!=null) {\n ASTTransformationCollectorCodeVisitor collector = new ASTTransformationCollectorCodeVisitor(unit, cu.getTransformLoader());\n collector.visitClass(cNode);\n }\n }\n }\n }",
"public String[] parseMFString(String mfString) {\n Vector<String> strings = new Vector<String>();\n\n StringReader sr = new StringReader(mfString);\n StreamTokenizer st = new StreamTokenizer(sr);\n st.quoteChar('\"');\n st.quoteChar('\\'');\n String[] mfStrings = null;\n\n int tokenType;\n try {\n while ((tokenType = st.nextToken()) != StreamTokenizer.TT_EOF) {\n\n strings.add(st.sval);\n\n }\n } catch (IOException e) {\n\n Log.d(TAG, \"String parsing Error: \" + e);\n\n e.printStackTrace();\n }\n mfStrings = new String[strings.size()];\n for (int i = 0; i < strings.size(); i++) {\n mfStrings[i] = strings.get(i);\n }\n return mfStrings;\n }",
"public static boolean containsAtLeastOneNonBlank(List<String> list){\n\t\tfor(String str : list){\n\t\t\tif(StringUtils.isNotBlank(str)){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"public void setValue(Quaternionf rot) {\n mX = rot.x;\n mY = rot.y;\n mZ = rot.z;\n mW = rot.w;\n }",
"protected PatchEntry resolveForElement(final PatchElement element) throws PatchingException {\n assert state == State.NEW;\n final PatchElementProvider provider = element.getProvider();\n final String layerName = provider.getName();\n final LayerType layerType = provider.getLayerType();\n\n final Map<String, PatchEntry> map;\n if (layerType == LayerType.Layer) {\n map = layers;\n } else {\n map = addOns;\n }\n PatchEntry entry = map.get(layerName);\n if (entry == null) {\n final InstallationManager.MutablePatchingTarget target = modification.resolve(layerName, layerType);\n if (target == null) {\n throw PatchLogger.ROOT_LOGGER.noSuchLayer(layerName);\n }\n entry = new PatchEntry(target, element);\n map.put(layerName, entry);\n }\n // Maintain the most recent element\n entry.updateElement(element);\n return entry;\n }",
"private TestClassResults getResultsForClass(Map<IClass, TestClassResults> flattenedResults,\n ITestResult testResult)\n {\n TestClassResults resultsForClass = flattenedResults.get(testResult.getTestClass());\n if (resultsForClass == null)\n {\n resultsForClass = new TestClassResults(testResult.getTestClass());\n flattenedResults.put(testResult.getTestClass(), resultsForClass);\n }\n return resultsForClass;\n }",
"public static lbvserver_appflowpolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tlbvserver_appflowpolicy_binding obj = new lbvserver_appflowpolicy_binding();\n\t\tobj.set_name(name);\n\t\tlbvserver_appflowpolicy_binding response[] = (lbvserver_appflowpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}"
] |
Returns the specified element, or null. | [
"public CSTNode get( int index ) \n {\n CSTNode element = null;\n\n if( index < size() ) \n {\n element = (CSTNode)elements.get( index );\n }\n\n return element;\n }"
] | [
"public List<Artifact> getArtifacts(final Boolean hasLicense) throws GrapesCommunicationException {\n final Client client = getClient();\n final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactsPath());\n final ClientResponse response = resource.queryParam(ServerAPI.HAS_LICENSE_PARAM, hasLicense.toString())\n .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);\n\n client.destroy();\n if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){\n final String message = \"Failed to get artifacts\";\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\n return response.getEntity(ArtifactList.class);\n }",
"static InjectionProvider<?>[] toArray(final Set<InjectionProvider<?>> injectionProviders) {\n return injectionProviders.toArray(new InjectionProvider<?>[injectionProviders.size()]);\n }",
"private synchronized HostServerGroupEffect getHostEffect(PathAddress address, String host, Resource root) {\n if (requiresMapping) {\n map(root);\n requiresMapping = false;\n }\n Set<String> mapped = hostsToGroups.get(host);\n if (mapped == null) {\n // Unassigned host. Treat like an unassigned profile or socket-binding-group;\n // i.e. available to all server group scoped roles.\n // Except -- WFLY-2085 -- the master HC is not open to all s-g-s-rs\n Resource hostResource = root.getChild(PathElement.pathElement(HOST, host));\n if (hostResource != null) {\n ModelNode dcModel = hostResource.getModel().get(DOMAIN_CONTROLLER);\n if (!dcModel.hasDefined(REMOTE)) {\n mapped = Collections.emptySet(); // prevents returning HostServerGroupEffect.forUnassignedHost(address, host)\n }\n }\n }\n return mapped == null ? HostServerGroupEffect.forUnassignedHost(address, host)\n : HostServerGroupEffect.forMappedHost(address, mapped, host);\n\n }",
"private ArrayList handleDependentReferences(Identity oid, Object userObject,\r\n Object[] origFields, Object[] newFields, Object[] newRefs)\r\n throws LockingException\r\n {\r\n ClassDescriptor mif = _pb.getClassDescriptor(userObject.getClass());\r\n FieldDescriptor[] fieldDescs = mif.getFieldDescriptions();\r\n Collection refDescs = mif.getObjectReferenceDescriptors();\r\n int count = 1 + fieldDescs.length;\r\n ArrayList newObjects = new ArrayList();\r\n int countRefs = 0;\r\n\r\n for (Iterator it = refDescs.iterator(); it.hasNext(); count++, countRefs++)\r\n {\r\n ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) it.next();\r\n Identity origOid = (origFields == null ? null : (Identity) origFields[count]);\r\n Identity newOid = (Identity) newFields[count];\r\n\r\n if (rds.getOtmDependent())\r\n {\r\n if ((origOid == null) && (newOid != null))\r\n {\r\n ContextEntry entry = (ContextEntry) _objects.get(newOid);\r\n\r\n if (entry == null)\r\n {\r\n Object relObj = newRefs[countRefs];\r\n insertInternal(newOid, relObj, LockType.WRITE_LOCK,\r\n true, oid, new Stack());\r\n newObjects.add(newOid);\r\n }\r\n }\r\n else if ((origOid != null) &&\r\n ((newOid == null) || !newOid.equals(origOid)))\r\n {\r\n markDelete(origOid, oid, false);\r\n }\r\n }\r\n }\r\n\r\n return newObjects;\r\n }",
"public synchronized Message menuRequestTyped(Message.KnownType requestType, Message.MenuIdentifier targetMenu,\n CdjStatus.TrackSourceSlot slot, CdjStatus.TrackType trackType, Field... arguments)\n throws IOException {\n\n if (!menuLock.isHeldByCurrentThread()) {\n throw new IllegalStateException(\"renderMenuItems() cannot be called without first successfully calling tryLockingForMenuOperation()\");\n }\n\n Field[] combinedArguments = new Field[arguments.length + 1];\n combinedArguments[0] = buildRMST(targetMenu, slot, trackType);\n System.arraycopy(arguments, 0, combinedArguments, 1, arguments.length);\n final Message response = simpleRequest(requestType, Message.KnownType.MENU_AVAILABLE, combinedArguments);\n final NumberField reportedRequestType = (NumberField)response.arguments.get(0);\n if (reportedRequestType.getValue() != requestType.protocolValue) {\n throw new IOException(\"Menu request did not return result for same type as request; sent type: \" +\n requestType.protocolValue + \", received type: \" + reportedRequestType.getValue() +\n \", response: \" + response);\n }\n return response;\n }",
"public String nstring(ImapRequestLineReader request) throws ProtocolException {\n char next = request.nextWordChar();\n switch (next) {\n case '\"':\n return consumeQuoted(request);\n case '{':\n return consumeLiteral(request);\n default:\n String value = atom(request);\n if (\"NIL\".equals(value)) {\n return null;\n } else {\n throw new ProtocolException(\"Invalid nstring value: valid values are '\\\"...\\\"', '{12} CRLF *CHAR8', and 'NIL'.\");\n }\n }\n }",
"public String getLinkColor(JSONObject jsonObject){\n if(jsonObject == null) return null;\n try {\n return jsonObject.has(\"color\") ? jsonObject.getString(\"color\") : \"\";\n } catch (JSONException e) {\n Logger.v(\"Unable to get Link Text Color with JSON - \"+e.getLocalizedMessage());\n return null;\n }\n }",
"protected AssemblyResponse watchStatus() throws LocalOperationException, RequestException {\n AssemblyResponse response;\n do {\n response = getClient().getAssemblyByUrl(url);\n try {\n Thread.sleep(1000);\n } catch (InterruptedException e) {\n throw new LocalOperationException(e);\n }\n } while (!response.isFinished());\n\n setState(State.FINISHED);\n return response;\n }",
"@Nullable public GeoTarget getCanonAncestor(GeoTarget.Type type) {\n for (GeoTarget target = this; target != null; target = target.canonParent()) {\n if (target.key.type == type) {\n return target;\n }\n }\n\n return null;\n }"
] |
Deserializes a variable, NOT checking whether the datatype is custom
@param s
@param variableType
@return | [
"public static Variable deserialize(String s,\n VariableType variableType) {\n return deserialize(s,\n variableType,\n null);\n }"
] | [
"public static Node addPartitionToNode(final Node node, Integer donatedPartition) {\n return UpdateClusterUtils.addPartitionsToNode(node, Sets.newHashSet(donatedPartition));\n }",
"public CustomHeadersInterceptor addHeaderMultimap(Map<String, List<String>> headers) {\n this.headers.putAll(headers);\n return this;\n }",
"public CollectionDescriptor getCollectionDescriptorByName(String name)\r\n {\r\n if (name == null)\r\n {\r\n return null;\r\n }\r\n\r\n CollectionDescriptor cod = (CollectionDescriptor) getCollectionDescriptorNameMap().get(name);\r\n\r\n //\r\n // BRJ: if the CollectionDescriptor is not found\r\n // look in the ClassDescriptor referenced by 'super' for it\r\n //\r\n if (cod == null)\r\n {\r\n ClassDescriptor superCld = getSuperClassDescriptor();\r\n if (superCld != null)\r\n {\r\n cod = superCld.getCollectionDescriptorByName(name);\r\n }\r\n }\r\n\r\n return cod;\r\n }",
"public void createProductDelivery(final String productLogicalName, final Delivery delivery, final String user, final String password) throws GrapesCommunicationException, AuthenticationException { \n \tfinal Client client = getClient(user, password);\n final WebResource resource = client.resource(serverURL).path(RequestUtils.getProductDelivery(productLogicalName));\n final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, delivery);\n\n client.destroy();\n if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){\n final String message = \"Failed to create a delivery\";\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 }",
"public void createTaskFieldMap(Props props)\n {\n byte[] fieldMapData = null;\n for (Integer key : TASK_KEYS)\n {\n fieldMapData = props.getByteArray(key);\n if (fieldMapData != null)\n {\n break;\n }\n }\n\n if (fieldMapData == null)\n {\n populateDefaultData(getDefaultTaskData());\n }\n else\n {\n createFieldMap(fieldMapData);\n }\n }",
"public <T> T convert(ConversionContext context, Object source,\r\n\t\t\tTypeReference<T> destinationType) throws ConverterException {\r\n\t\ttry {\r\n\t\t\treturn (T) multiConverter.convert(context, source, destinationType);\r\n\t\t} catch (ConverterException e) {\r\n\t\t\tthrow e;\r\n\t\t} catch (Exception e) {\r\n\t\t\t// There is a problem with one converter. This should not happen.\r\n\t\t\t// Either there is a bug in this converter or it is not properly\r\n\t\t\t// configured\r\n\t\t\tthrow new ConverterException(\r\n\t\t\t\t\tMessageFormat\r\n\t\t\t\t\t\t\t.format(\r\n\t\t\t\t\t\t\t\t\t\"Could not convert given object with class ''{0}'' to object with type signature ''{1}''\",\r\n\t\t\t\t\t\t\t\t\tsource == null ? \"null\" : source.getClass()\r\n\t\t\t\t\t\t\t\t\t\t\t.getName(), destinationType), e);\r\n\t\t}\r\n\t}",
"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 writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {\n\t\tdocument.writeElement(\"vml:shape\", asChild);\n\t\tPoint p = (Point) o;\n\t\tString adj = document.getFormatter().format(p.getX()) + \",\"\n\t\t\t\t+ document.getFormatter().format(p.getY());\n\t\tdocument.writeAttribute(\"adj\", adj);\n\t}",
"synchronized void removeServerProcess() {\n this.requiredState = InternalState.STOPPED;\n internalSetState(new ProcessRemoveTask(), InternalState.STOPPED, InternalState.PROCESS_REMOVING);\n }"
] |
Finishes the process of attaching a metadata cache file once it has been opened and validated.
@param slot the slot to which the cache should be attached
@param cache the opened, validated metadata cache file | [
"void attachMetadataCacheInternal(SlotReference slot, MetadataCache cache) {\n MetadataCache oldCache = metadataCacheFiles.put(slot, cache);\n if (oldCache != null) {\n try {\n oldCache.close();\n } catch (IOException e) {\n logger.error(\"Problem closing previous metadata cache\", e);\n }\n }\n\n deliverCacheUpdate(slot, cache);\n }"
] | [
"public static void checkMinimumArrayLength(String parameterName,\n int actualLength, int minimumLength) {\n if (actualLength < minimumLength) {\n throw Exceptions\n .IllegalArgument(\n \"Array %s should have at least %d elements, but it only has %d\",\n parameterName, minimumLength, actualLength);\n }\n }",
"private boolean isSplit(ProjectCalendar calendar, List<TimephasedWork> list)\n {\n boolean result = false;\n for (TimephasedWork assignment : list)\n {\n if (calendar != null && assignment.getTotalAmount().getDuration() == 0)\n {\n Duration calendarWork = calendar.getWork(assignment.getStart(), assignment.getFinish(), TimeUnit.MINUTES);\n if (calendarWork.getDuration() != 0)\n {\n result = true;\n break;\n }\n }\n }\n return result;\n }",
"public static URL getAuthorizationURL(String clientID, URI redirectUri, String state, List<String> scopes) {\n URLTemplate template = new URLTemplate(AUTHORIZATION_URL);\n QueryStringBuilder queryBuilder = new QueryStringBuilder().appendParam(\"client_id\", clientID)\n .appendParam(\"response_type\", \"code\")\n .appendParam(\"redirect_uri\", redirectUri.toString())\n .appendParam(\"state\", state);\n\n if (scopes != null && !scopes.isEmpty()) {\n StringBuilder builder = new StringBuilder();\n int size = scopes.size() - 1;\n int i = 0;\n while (i < size) {\n builder.append(scopes.get(i));\n builder.append(\" \");\n i++;\n }\n builder.append(scopes.get(i));\n\n queryBuilder.appendParam(\"scope\", builder.toString());\n }\n\n return template.buildWithQuery(\"\", queryBuilder.toString());\n }",
"public static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName) {\n\t\tif (unknownEnumName == null || unknownEnumName.length() == 0) {\n\t\t\treturn null;\n\t\t}\n\t\tfor (Enum<?> enumVal : (Enum<?>[]) field.getType().getEnumConstants()) {\n\t\t\tif (enumVal.name().equals(unknownEnumName)) {\n\t\t\t\treturn enumVal;\n\t\t\t}\n\t\t}\n\t\tthrow new IllegalArgumentException(\"Unknwown enum unknown name \" + unknownEnumName + \" for field \" + field);\n\t}",
"public void setCapacity(int capacity) {\n if (capacity <= 0) {\n throw new IllegalArgumentException(\"capacity must be greater than 0\");\n }\n\n synchronized (queue) {\n // If the capacity was reduced, we remove oldest elements until the\n // queue fits inside the specified capacity\n if (capacity < this.capacity) {\n while (queue.size() > capacity) {\n queue.removeFirst();\n }\n }\n }\n\n this.capacity = capacity;\n }",
"@GwtIncompatible(\"Class.getDeclaredFields\")\n\tpublic ToStringBuilder addAllFields() {\n\t\tList<Field> fields = getAllDeclaredFields(instance.getClass());\n\t\tfor(Field field : fields) {\n\t\t\taddField(field);\n\t\t}\n\t\treturn this;\n\t}",
"String fetchToken(String tokenType) throws IOException, MediaWikiApiErrorException {\n\t\tMap<String, String> params = new HashMap<>();\n\t\tparams.put(ApiConnection.PARAM_ACTION, \"query\");\n\t\tparams.put(\"meta\", \"tokens\");\n\t\tparams.put(\"type\", tokenType);\n\n\t\ttry {\n\t\t\tJsonNode root = this.sendJsonRequest(\"POST\", params);\n\t\t\treturn root.path(\"query\").path(\"tokens\").path(tokenType + \"token\").textValue();\n\t\t} catch (IOException | MediaWikiApiErrorException e) {\n\t\t\tlogger.error(\"Error when trying to fetch token: \" + e.toString());\n\t\t}\n\t\treturn null;\n\t}",
"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 }",
"public static autoscaleprofile get(nitro_service service, String name) throws Exception{\n\t\tautoscaleprofile obj = new autoscaleprofile();\n\t\tobj.set_name(name);\n\t\tautoscaleprofile response = (autoscaleprofile) obj.get_resource(service);\n\t\treturn response;\n\t}"
] |
Starts the named animation.
@see GVRAvatar#stop(String)
@see GVRAnimationEngine#start(GVRAnimation) | [
"public void start(String name)\n {\n GVRAnimator anim = findAnimation(name);\n\n if (name.equals(anim.getName()))\n {\n start(anim);\n return;\n }\n }"
] | [
"public static Priority getInstance(int priority)\n {\n Priority result;\n\n if (priority >= LOWEST && priority <= DO_NOT_LEVEL && (priority % 100 == 0))\n {\n result = VALUE[(priority / 100) - 1];\n }\n else\n {\n result = new Priority(priority);\n }\n\n return (result);\n }",
"public static File writeStreamToTempFile(InputStream inputStream, String tempFileSuffix) throws IOException\n {\n FileOutputStream outputStream = null;\n\n try\n {\n File file = File.createTempFile(\"mpxj\", tempFileSuffix);\n outputStream = new FileOutputStream(file);\n byte[] buffer = new byte[1024];\n while (true)\n {\n int bytesRead = inputStream.read(buffer);\n if (bytesRead == -1)\n {\n break;\n }\n outputStream.write(buffer, 0, bytesRead);\n }\n return file;\n }\n\n finally\n {\n if (outputStream != null)\n {\n outputStream.close();\n }\n }\n }",
"protected void processAliases(List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases) {\n for(MonolingualTextValue val : addAliases) {\n addAlias(val);\n }\n for(MonolingualTextValue val : deleteAliases) {\n deleteAlias(val);\n }\n }",
"public static double[] computeSeasonalAdjustments(double[] realizedCPIValues, int lastMonth, int numberOfYearsToAverage) {\n\n\t\t/*\n\t\t * Cacluate average log returns\n\t\t */\n\t\tdouble[] averageLogReturn = new double[12];\n\t\tArrays.fill(averageLogReturn, 0.0);\n\t\tfor(int arrayIndex = 0; arrayIndex < 12*numberOfYearsToAverage; arrayIndex++){\n\n\t\t\tint month = (((((lastMonth-1 - arrayIndex) % 12) + 12) % 12));\n\n\t\t\tdouble logReturn = Math.log(realizedCPIValues[realizedCPIValues.length - 1 - arrayIndex] / realizedCPIValues[realizedCPIValues.length - 2 - arrayIndex]);\n\t\t\taverageLogReturn[month] += logReturn/numberOfYearsToAverage;\n\t\t}\n\n\t\t/*\n\t\t * Normalize\n\t\t */\n\t\tdouble sum = 0.0;\n\t\tfor(int index = 0; index < averageLogReturn.length; index++){\n\t\t\tsum += averageLogReturn[index];\n\t\t}\n\t\tdouble averageSeasonal = sum / averageLogReturn.length;\n\n\t\tdouble[] seasonalAdjustments = new double[averageLogReturn.length];\n\t\tfor(int index = 0; index < seasonalAdjustments.length; index++){\n\t\t\tseasonalAdjustments[index] = averageLogReturn[index] - averageSeasonal;\n\t\t}\n\n\t\t// Annualize seasonal adjustments\n\t\tfor(int index = 0; index < seasonalAdjustments.length; index++){\n\t\t\tseasonalAdjustments[index] = seasonalAdjustments[index] * 12;\n\t\t}\n\n\t\treturn seasonalAdjustments;\n\t}",
"@Override\n public void setBody(String body) {\n super.setBody(body);\n this.jsonValue = JsonValue.readFrom(body);\n }",
"public int getRegisteredResourceRequestCount(K key) {\n if(requestQueueMap.containsKey(key)) {\n Queue<AsyncResourceRequest<V>> requestQueue = getRequestQueueForExistingKey(key);\n // FYI: .size() is not constant time in the next call. ;)\n if(requestQueue != null) {\n return requestQueue.size();\n }\n }\n return 0;\n }",
"@Override\n public boolean postBuild(MavenBuildProxy build, MavenProject pom, BuildListener listener)\n throws InterruptedException, IOException {\n build.executeAsync(new BuildCallable<Void, IOException>() {\n // record is transient, so needs to make a copy first\n private final Set<MavenDependency> d = dependencies;\n\n public Void call(MavenBuild build) throws IOException, InterruptedException {\n // add the action\n //TODO: [by yl] These actions are persisted into the build.xml of each build run - we need another\n //context to store these actions\n build.getActions().add(new MavenDependenciesRecord(build, d));\n return null;\n }\n });\n return true;\n }",
"public BoxFolder.Info getFolderInfo(String folderID) {\n URL url = FOLDER_INFO_URL_TEMPLATE.build(this.api.getBaseURL(), folderID);\n BoxAPIRequest request = new BoxAPIRequest(this.api, url, \"GET\");\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject jsonObject = JsonObject.readFrom(response.getJSON());\n\n BoxFolder folder = new BoxFolder(this.api, jsonObject.get(\"id\").asString());\n return folder.new Info(response.getJSON());\n }",
"private I_CmsSearchResultWrapper getSearchResults() {\n\n // The second parameter is just ignored - so it does not matter\n m_searchController.updateFromRequestParameters(pageContext.getRequest().getParameterMap(), false);\n I_CmsSearchControllerCommon common = m_searchController.getCommon();\n // Do not search for empty query, if configured\n if (common.getState().getQuery().isEmpty()\n && (!common.getConfig().getIgnoreQueryParam() && !common.getConfig().getSearchForEmptyQueryParam())) {\n return new CmsSearchResultWrapper(m_searchController, null, null, m_cms, null);\n }\n Map<String, String[]> queryParams = null;\n boolean isEditMode = CmsJspTagEditable.isEditableRequest(pageContext.getRequest());\n if (isEditMode) {\n String params = \"\";\n if (common.getConfig().getIgnoreReleaseDate()) {\n params += \"&fq=released:[* TO *]\";\n }\n if (common.getConfig().getIgnoreExpirationDate()) {\n params += \"&fq=expired:[* TO *]\";\n }\n if (!params.isEmpty()) {\n queryParams = CmsRequestUtil.createParameterMap(params.substring(1));\n }\n }\n CmsSolrQuery query = new CmsSolrQuery(null, queryParams);\n m_searchController.addQueryParts(query, m_cms);\n try {\n // use \"complicated\" constructor to allow more than 50 results -> set ignoreMaxResults to true\n // also set resource filter to allow for returning unreleased/expired resources if necessary.\n CmsSolrResultList solrResultList = m_index.search(\n m_cms,\n query.clone(), // use a clone of the query, since the search function manipulates the query (removes highlighting parts), but we want to keep the original one.\n true,\n isEditMode ? CmsResourceFilter.IGNORE_EXPIRATION : null);\n return new CmsSearchResultWrapper(m_searchController, solrResultList, query, m_cms, null);\n } catch (CmsSearchException e) {\n LOG.warn(Messages.get().getBundle().key(Messages.LOG_TAG_SEARCH_SEARCH_FAILED_0), e);\n return new CmsSearchResultWrapper(m_searchController, null, query, m_cms, e);\n }\n }"
] |
Updates the information about this collaboration with any info fields that have been modified locally.
@param info the updated info. | [
"public void updateInfo(Info info) {\n BoxAPIConnection api = this.getAPI();\n URL url = COLLABORATION_URL_TEMPLATE.build(api.getBaseURL(), this.getID());\n\n BoxJSONRequest request = new BoxJSONRequest(api, url, \"PUT\");\n request.setBody(info.getPendingChanges());\n BoxAPIResponse boxAPIResponse = request.send();\n\n if (boxAPIResponse instanceof BoxJSONResponse) {\n BoxJSONResponse response = (BoxJSONResponse) boxAPIResponse;\n JsonObject jsonObject = JsonObject.readFrom(response.getJSON());\n info.update(jsonObject);\n }\n }"
] | [
"public static int getXPathLocation(String dom, String xpath) {\n\t\tString dom_lower = dom.toLowerCase();\n\t\tString xpath_lower = xpath.toLowerCase();\n\t\tString[] elements = xpath_lower.split(\"/\");\n\t\tint pos = 0;\n\t\tint temp;\n\t\tint number;\n\t\tfor (String element : elements) {\n\t\t\tif (!element.isEmpty() && !element.startsWith(\"@\") && !element.contains(\"()\")) {\n\t\t\t\tif (element.contains(\"[\")) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tnumber =\n\t\t\t\t\t\t\t\tInteger.parseInt(element.substring(element.indexOf(\"[\") + 1,\n\t\t\t\t\t\t\t\t\t\telement.indexOf(\"]\")));\n\t\t\t\t\t} catch (NumberFormatException e) {\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tnumber = 1;\n\t\t\t\t}\n\t\t\t\tfor (int i = 0; i < number; i++) {\n\t\t\t\t\t// find new open element\n\t\t\t\t\ttemp = dom_lower.indexOf(\"<\" + stripEndSquareBrackets(element), pos);\n\n\t\t\t\t\tif (temp > -1) {\n\t\t\t\t\t\tpos = temp + 1;\n\n\t\t\t\t\t\t// if depth>1 then goto end of current element\n\t\t\t\t\t\tif (number > 1 && i < number - 1) {\n\t\t\t\t\t\t\tpos =\n\t\t\t\t\t\t\t\t\tgetCloseElementLocation(dom_lower, pos,\n\t\t\t\t\t\t\t\t\t\t\tstripEndSquareBrackets(element));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn pos - 1;\n\t}",
"public void setBaselineStartText(int baselineNumber, String value)\n {\n set(selectField(TaskFieldLists.BASELINE_STARTS, baselineNumber), value);\n }",
"public static double Sinc(double x) {\r\n return Math.sin(Math.PI * x) / (Math.PI * x);\r\n }",
"public static Timer getNamedTimer(String timerName, int todoFlags) {\n\t\treturn getNamedTimer(timerName, todoFlags, Thread.currentThread()\n\t\t\t\t.getId());\n\t}",
"public synchronized void resumeControlPoint(final String entryPoint) {\n for (ControlPoint ep : entryPoints.values()) {\n if (ep.getEntryPoint().equals(entryPoint)) {\n ep.resume();\n }\n }\n }",
"public void processPick(boolean touched, MotionEvent event)\n {\n mPickEventLock.lock();\n mTouched = touched;\n mMotionEvent = event;\n doPick();\n mPickEventLock.unlock();\n }",
"public static <T> T splitEachLine(CharSequence self, CharSequence regex, @ClosureParams(value=FromString.class,options=\"List<String>\") Closure<T> closure) throws IOException {\n return splitEachLine(self, Pattern.compile(regex.toString()), closure);\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 }",
"@Override\n\tpublic int getMinPrefixLengthForBlock() {\n\t\tint count = getDivisionCount();\n\t\tint totalPrefix = getBitCount();\n\t\tfor(int i = count - 1; i >= 0 ; i--) {\n\t\t\tAddressDivisionBase div = getDivision(i);\n\t\t\tint segBitCount = div.getBitCount();\n\t\t\tint segPrefix = div.getMinPrefixLengthForBlock();\n\t\t\tif(segPrefix == segBitCount) {\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\ttotalPrefix -= segBitCount;\n\t\t\t\tif(segPrefix != 0) {\n\t\t\t\t\ttotalPrefix += segPrefix;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn totalPrefix;\n\t}"
] |
Calls the specified Stitch function.
@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. | [
"public void callFunction(\n final String name,\n final List<?> args,\n final @Nullable Long requestTimeout) {\n this.functionService.callFunction(name, args, requestTimeout);\n }"
] | [
"private void readPattern(JSONObject patternJson) {\n\n setPatternType(readPatternType(patternJson));\n setInterval(readOptionalInt(patternJson, JsonKey.PATTERN_INTERVAL));\n setWeekDays(readWeekDays(patternJson));\n setDayOfMonth(readOptionalInt(patternJson, JsonKey.PATTERN_DAY_OF_MONTH));\n setEveryWorkingDay(readOptionalBoolean(patternJson, JsonKey.PATTERN_EVERYWORKINGDAY));\n setWeeksOfMonth(readWeeksOfMonth(patternJson));\n setIndividualDates(readDates(readOptionalArray(patternJson, JsonKey.PATTERN_DATES)));\n setMonth(readOptionalMonth(patternJson, JsonKey.PATTERN_MONTH));\n\n }",
"public static onlinkipv6prefix[] get(nitro_service service) throws Exception{\n\t\tonlinkipv6prefix obj = new onlinkipv6prefix();\n\t\tonlinkipv6prefix[] response = (onlinkipv6prefix[])obj.get_resources(service);\n\t\treturn response;\n\t}",
"public static String getPrefixFromValue(String value) {\n if (value == null) {\n return null;\n } else if (value.contains(DELIMITER)) {\n String[] list = value.split(DELIMITER);\n if (list != null && list.length > 0) {\n return list[0].replaceAll(\"\\u0000\", \"\");\n } else {\n return null;\n }\n } else {\n return value.replaceAll(\"\\u0000\", \"\");\n }\n }",
"public static void deleteRecursively(final Path path) throws IOException {\n DeploymentRepositoryLogger.ROOT_LOGGER.debugf(\"Deleting %s recursively\", path);\n if (Files.exists(path)) {\n Files.walkFileTree(path, new FileVisitor<Path>() {\n @Override\n public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {\n return FileVisitResult.CONTINUE;\n }\n\n @Override\n public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {\n Files.delete(file);\n return FileVisitResult.CONTINUE;\n }\n\n @Override\n public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {\n DeploymentRepositoryLogger.ROOT_LOGGER.cannotDeleteFile(exc, path);\n throw exc;\n }\n\n @Override\n public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {\n Files.delete(dir);\n return FileVisitResult.CONTINUE;\n }\n });\n }\n }",
"private void updateRoutingStrategies(Cluster cluster, List<StoreDefinition> storeDefs) {\n // acquire write lock\n writeLock.lock();\n try {\n VectorClock clock = new VectorClock();\n if(metadataCache.containsKey(ROUTING_STRATEGY_KEY))\n clock = (VectorClock) metadataCache.get(ROUTING_STRATEGY_KEY).getVersion();\n\n logger.info(\"Updating routing strategy for all stores\");\n HashMap<String, StoreDefinition> storeDefMap = makeStoreDefinitionMap(storeDefs);\n HashMap<String, RoutingStrategy> routingStrategyMap = createRoutingStrategyMap(cluster,\n storeDefMap);\n this.metadataCache.put(ROUTING_STRATEGY_KEY,\n new Versioned<Object>(routingStrategyMap,\n clock.incremented(getNodeId(),\n System.currentTimeMillis())));\n\n for(String storeName: storeNameTolisteners.keySet()) {\n RoutingStrategy updatedRoutingStrategy = routingStrategyMap.get(storeName);\n if(updatedRoutingStrategy != null) {\n try {\n for(MetadataStoreListener listener: storeNameTolisteners.get(storeName)) {\n listener.updateRoutingStrategy(updatedRoutingStrategy);\n listener.updateStoreDefinition(storeDefMap.get(storeName));\n }\n } catch(Exception e) {\n if(logger.isEnabledFor(Level.WARN))\n logger.warn(e, e);\n }\n }\n\n }\n } finally {\n writeLock.unlock();\n }\n }",
"public static DMatrixRMaj copyTriangle(DMatrixRMaj src , DMatrixRMaj dst , boolean upper ) {\n if( dst == null ) {\n dst = new DMatrixRMaj(src.numRows,src.numCols);\n } else if( src.numRows != dst.numRows || src.numCols != dst.numCols ) {\n throw new IllegalArgumentException(\"src and dst must have the same dimensions.\");\n }\n\n if( upper ) {\n int N = Math.min(src.numRows,src.numCols);\n for( int i = 0; i < N; i++ ) {\n int index = i*src.numCols+i;\n System.arraycopy(src.data,index,dst.data,index,src.numCols-i);\n }\n } else {\n for( int i = 0; i < src.numRows; i++ ) {\n int length = Math.min(i+1,src.numCols);\n int index = i*src.numCols;\n System.arraycopy(src.data,index,dst.data,index,length);\n }\n }\n\n return dst;\n }",
"public static void checkSvdMatrixSize(DMatrixRMaj U, boolean tranU, DMatrixRMaj W, DMatrixRMaj V, boolean tranV ) {\n int numSingular = Math.min(W.numRows,W.numCols);\n boolean compact = W.numRows == W.numCols;\n\n if( compact ) {\n if( U != null ) {\n if( tranU && U.numRows != numSingular )\n throw new IllegalArgumentException(\"Unexpected size of matrix U\");\n else if( !tranU && U.numCols != numSingular )\n throw new IllegalArgumentException(\"Unexpected size of matrix U\");\n }\n\n if( V != null ) {\n if( tranV && V.numRows != numSingular )\n throw new IllegalArgumentException(\"Unexpected size of matrix V\");\n else if( !tranV && V.numCols != numSingular )\n throw new IllegalArgumentException(\"Unexpected size of matrix V\");\n }\n } else {\n if( U != null && U.numRows != U.numCols )\n throw new IllegalArgumentException(\"Unexpected size of matrix U\");\n if( V != null && V.numRows != V.numCols )\n throw new IllegalArgumentException(\"Unexpected size of matrix V\");\n if( U != null && U.numRows != W.numRows )\n throw new IllegalArgumentException(\"Unexpected size of W\");\n if( V != null && V.numRows != W.numCols )\n throw new IllegalArgumentException(\"Unexpected size of W\");\n }\n }",
"private void addTable(TableDef table)\r\n {\r\n table.setOwner(this);\r\n _tableDefs.put(table.getName(), table);\r\n }",
"void apply() {\n final FlushLog log = new FlushLog();\n store.logOperations(txn, log);\n final BlobVault blobVault = store.getBlobVault();\n if (blobVault.requiresTxn()) {\n try {\n blobVault.flushBlobs(blobStreams, blobFiles, deferredBlobsToDelete, txn);\n } catch (Exception e) {\n // out of disk space not expected there\n throw ExodusException.toEntityStoreException(e);\n }\n }\n txn.setCommitHook(new Runnable() {\n @Override\n public void run() {\n log.flushed();\n final EntityIterableCacheAdapterMutable cache = PersistentStoreTransaction.this.mutableCache;\n if (cache != null) { // mutableCache can be null if only blobs are modified\n applyAtomicCaches(cache);\n }\n }\n });\n }"
] |
Sets the header of the collection component. | [
"public void setHeader(String header) {\n headerLabel.getElement().setInnerSafeHtml(SafeHtmlUtils.fromString(header));\n addStyleName(CssName.WITH_HEADER);\n ListItem item = new ListItem(headerLabel);\n UiHelper.addMousePressedHandlers(item);\n item.setStyleName(CssName.COLLECTION_HEADER);\n insert(item, 0);\n }"
] | [
"public static double huntKennedyCMSOptionValue(\n\t\t\tdouble forwardSwaprate,\n\t\t\tdouble volatility,\n\t\t\tdouble swapAnnuity,\n\t\t\tdouble optionMaturity,\n\t\t\tdouble swapMaturity,\n\t\t\tdouble payoffUnit,\n\t\t\tdouble optionStrike)\n\t{\n\t\tdouble a = 1.0/swapMaturity;\n\t\tdouble b = (payoffUnit / swapAnnuity - a) / forwardSwaprate;\n\t\tdouble convexityAdjustment = Math.exp(volatility*volatility*optionMaturity);\n\n\t\tdouble valueUnadjusted\t= blackModelSwaptionValue(forwardSwaprate, volatility, optionMaturity, optionStrike, swapAnnuity);\n\t\tdouble valueAdjusted\t= blackModelSwaptionValue(forwardSwaprate * convexityAdjustment, volatility, optionMaturity, optionStrike, swapAnnuity);\n\n\t\treturn a * valueUnadjusted + b * forwardSwaprate * valueAdjusted;\n\t}",
"public static base_response disable(nitro_service client, nsacl6 resource) throws Exception {\n\t\tnsacl6 disableresource = new nsacl6();\n\t\tdisableresource.acl6name = resource.acl6name;\n\t\treturn disableresource.perform_operation(client,\"disable\");\n\t}",
"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 int addCollidable(GVRSceneObject sceneObj)\n {\n synchronized (mCollidables)\n {\n int index = mCollidables.indexOf(sceneObj);\n if (index >= 0)\n {\n return index;\n }\n mCollidables.add(sceneObj);\n return mCollidables.size() - 1;\n }\n }",
"public Configuration[] getConfigurations(String name) {\n ArrayList<Configuration> valuesList = new ArrayList<Configuration>();\n\n logger.info(\"Getting data for {}\", name);\n\n PreparedStatement statement = null;\n ResultSet results = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n\n String queryString = \"SELECT * FROM \" + Constants.DB_TABLE_CONFIGURATION;\n if (name != null) {\n queryString += \" WHERE \" + Constants.DB_TABLE_CONFIGURATION_NAME + \"=?\";\n }\n\n statement = sqlConnection.prepareStatement(queryString);\n if (name != null) {\n statement.setString(1, name);\n }\n\n results = statement.executeQuery();\n while (results.next()) {\n Configuration config = new Configuration();\n config.setValue(results.getString(Constants.DB_TABLE_CONFIGURATION_VALUE));\n config.setKey(results.getString(Constants.DB_TABLE_CONFIGURATION_NAME));\n config.setId(results.getInt(Constants.GENERIC_ID));\n logger.info(\"the configValue is = {}\", config.getValue());\n valuesList.add(config);\n }\n } catch (SQLException sqe) {\n logger.info(\"Exception in sql\");\n sqe.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 if (valuesList.size() == 0) {\n return null;\n }\n\n return valuesList.toArray(new Configuration[0]);\n }",
"private Renderer getPrototypeByIndex(final int prototypeIndex) {\n Renderer prototypeSelected = null;\n int i = 0;\n for (Renderer prototype : prototypes) {\n if (i == prototypeIndex) {\n prototypeSelected = prototype;\n }\n i++;\n }\n return prototypeSelected;\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 }",
"public static String[] sortStringArray(String[] array) {\n if (isEmpty(array)) {\n return new String[0];\n }\n Arrays.sort(array);\n return array;\n }",
"@Pure\n\t@Inline(value = \"(new $3<$5, $6>($1, $2))\", imported = UnmodifiableMergingMapView.class, constantExpression = true)\n\tpublic static <K, V> Map<K, V> union(Map<? extends K, ? extends V> left, Map<? extends K, ? extends V> right) {\n\t\treturn new UnmodifiableMergingMapView<K, V>(left, right);\n\t}"
] |
Prints a report about the statistics stored in the given data object.
@param usageStatistics
the statistics object to print
@param entityLabel
the label to use to refer to this kind of entities ("items" or
"properties") | [
"private void printStatistics(UsageStatistics usageStatistics,\n\t\t\tString entityLabel) {\n\t\tSystem.out.println(\"Processed \" + usageStatistics.count + \" \"\n\t\t\t\t+ entityLabel + \":\");\n\t\tSystem.out.println(\" * Labels: \" + usageStatistics.countLabels\n\t\t\t\t+ \", descriptions: \" + usageStatistics.countDescriptions\n\t\t\t\t+ \", aliases: \" + usageStatistics.countAliases);\n\t\tSystem.out.println(\" * Statements: \" + usageStatistics.countStatements\n\t\t\t\t+ \", with references: \"\n\t\t\t\t+ usageStatistics.countReferencedStatements);\n\t}"
] | [
"protected BufferedImage fetchImage(\n @Nonnull final ClientHttpRequest request, @Nonnull final MapfishMapContext transformer)\n throws IOException {\n final String baseMetricName = getClass().getName() + \".read.\" +\n StatsUtils.quotePart(request.getURI().getHost());\n final Timer.Context timerDownload = this.registry.timer(baseMetricName).time();\n try (ClientHttpResponse httpResponse = request.execute()) {\n if (httpResponse.getStatusCode() != HttpStatus.OK) {\n final String message = String.format(\n \"Invalid status code for %s (%d!=%d). The response was: '%s'\",\n request.getURI(), httpResponse.getStatusCode().value(),\n HttpStatus.OK.value(), httpResponse.getStatusText());\n this.registry.counter(baseMetricName + \".error\").inc();\n if (getFailOnError()) {\n throw new RuntimeException(message);\n } else {\n LOGGER.info(message);\n return createErrorImage(transformer.getPaintArea());\n }\n }\n\n final List<String> contentType = httpResponse.getHeaders().get(\"Content-Type\");\n if (contentType == null || contentType.size() != 1) {\n LOGGER.debug(\"The image {} didn't return a valid content type header.\",\n request.getURI());\n } else if (!contentType.get(0).startsWith(\"image/\")) {\n final byte[] data;\n try (InputStream body = httpResponse.getBody()) {\n data = IOUtils.toByteArray(body);\n }\n LOGGER.debug(\"We get a wrong image for {}, content type: {}\\nresult:\\n{}\",\n request.getURI(), contentType.get(0),\n new String(data, StandardCharsets.UTF_8));\n this.registry.counter(baseMetricName + \".error\").inc();\n return createErrorImage(transformer.getPaintArea());\n }\n\n final BufferedImage image = ImageIO.read(httpResponse.getBody());\n if (image == null) {\n LOGGER.warn(\"Cannot read image from %a\", request.getURI());\n this.registry.counter(baseMetricName + \".error\").inc();\n if (getFailOnError()) {\n throw new RuntimeException(\"Cannot read image from \" + request.getURI());\n } else {\n return createErrorImage(transformer.getPaintArea());\n }\n }\n timerDownload.stop();\n return image;\n } catch (Throwable e) {\n this.registry.counter(baseMetricName + \".error\").inc();\n throw e;\n }\n }",
"public void write(Configuration config)\n throws IOException {\n\n pp.startDocument();\n pp.startElement(\"duke\", null);\n\n // FIXME: here we should write the objects, but that's not\n // possible with the current API. we don't need that for the\n // genetic algorithm at the moment, but it would be useful.\n\n pp.startElement(\"schema\", null);\n\n writeElement(\"threshold\", \"\" + config.getThreshold());\n if (config.getMaybeThreshold() != 0.0)\n writeElement(\"maybe-threshold\", \"\" + config.getMaybeThreshold());\n\n for (Property p : config.getProperties())\n writeProperty(p);\n\n pp.endElement(\"schema\");\n\n String dbclass = config.getDatabase(false).getClass().getName();\n AttributeListImpl atts = new AttributeListImpl();\n atts.addAttribute(\"class\", \"CDATA\", dbclass);\n pp.startElement(\"database\", atts);\n pp.endElement(\"database\");\n\n if (config.isDeduplicationMode())\n for (DataSource src : config.getDataSources())\n writeDataSource(src);\n else {\n pp.startElement(\"group\", null);\n for (DataSource src : config.getDataSources(1))\n writeDataSource(src);\n pp.endElement(\"group\");\n\n pp.startElement(\"group\", null);\n for (DataSource src : config.getDataSources(2))\n writeDataSource(src);\n pp.endElement(\"group\");\n }\n\n pp.endElement(\"duke\");\n pp.endDocument();\n }",
"public void promoteModule(final String name, final String version, 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.promoteModulePath(name, version));\n final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class);\n\n client.destroy();\n if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){\n final String message = String.format(FAILED_TO_GET_MODULE, \"promote module\", name, version);\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 }",
"public Number getMinutesPerYear()\n {\n return Integer.valueOf(NumberHelper.getInt(getMinutesPerDay()) * NumberHelper.getInt(getDaysPerMonth()) * 12);\n }",
"public static boolean isPackageOrClassName(String s) {\n if (S.blank(s)) {\n return false;\n }\n S.List parts = S.fastSplit(s, \".\");\n if (parts.size() < 2) {\n return false;\n }\n for (String part: parts) {\n if (!Character.isJavaIdentifierStart(part.charAt(0))) {\n return false;\n }\n for (int i = 1, len = part.length(); i < len; ++i) {\n if (!Character.isJavaIdentifierPart(part.charAt(i))) {\n return false;\n }\n }\n }\n return true;\n }",
"public Class getPersistentFieldClass()\r\n {\r\n if (m_persistenceClass == null)\r\n {\r\n Properties properties = new Properties();\r\n try\r\n {\r\n this.logWarning(\"Loading properties file: \" + getPropertiesFile());\r\n properties.load(new FileInputStream(getPropertiesFile()));\r\n }\r\n catch (IOException e)\r\n {\r\n this.logWarning(\"Could not load properties file '\" + getPropertiesFile()\r\n + \"'. Using PersistentFieldDefaultImpl.\");\r\n e.printStackTrace();\r\n }\r\n try\r\n {\r\n String className = properties.getProperty(\"PersistentFieldClass\");\r\n\r\n m_persistenceClass = loadClass(className);\r\n }\r\n catch (ClassNotFoundException e)\r\n {\r\n e.printStackTrace();\r\n m_persistenceClass = PersistentFieldPrivilegedImpl.class;\r\n }\r\n logWarning(\"PersistentFieldClass: \" + m_persistenceClass.toString());\r\n }\r\n return m_persistenceClass;\r\n }",
"private void writeImages() {\n\t\tfor (ValueMap gv : this.valueMaps) {\n\t\t\tgv.writeImage();\n\t\t}\n\n\t\ttry (PrintStream out = new PrintStream(\n\t\t\t\tExampleHelpers.openExampleFileOuputStream(\"map-site-count.csv\"))) {\n\t\t\tout.println(\"Site key,Number of geo items\");\n\t\t\tout.println(\"wikidata total,\" + this.count);\n\t\t\tfor (Entry<String, Integer> entry : this.siteCounts.entrySet()) {\n\t\t\t\tout.println(entry.getKey() + \",\" + entry.getValue());\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"private void clearDeck(TrackMetadataUpdate update) {\n if (hotCache.remove(DeckReference.getDeckReference(update.player, 0)) != null) {\n deliverBeatGridUpdate(update.player, null);\n }\n }",
"public static Result get(XmlFileModel key)\n {\n String cacheKey = getKey(key);\n\n Result result = null;\n CacheDocument reference = map.get(cacheKey);\n\n if (reference == null)\n return new Result(false, null);\n\n if (reference.parseFailure)\n return new Result(true, null);\n\n Document document = reference.getDocument();\n if (document == null)\n LOG.info(\"Cache miss on XML document: \" + cacheKey);\n\n return new Result(false, document);\n }"
] |
Add working days and working time to a calendar.
@param mpxjCalendar MPXJ calendar
@param gpCalendar GanttProject calendar | [
"private void setWorkingDays(ProjectCalendar mpxjCalendar, Calendars gpCalendar)\n {\n DayTypes dayTypes = gpCalendar.getDayTypes();\n DefaultWeek defaultWeek = dayTypes.getDefaultWeek();\n if (defaultWeek == null)\n {\n mpxjCalendar.setWorkingDay(Day.SUNDAY, false);\n mpxjCalendar.setWorkingDay(Day.MONDAY, true);\n mpxjCalendar.setWorkingDay(Day.TUESDAY, true);\n mpxjCalendar.setWorkingDay(Day.WEDNESDAY, true);\n mpxjCalendar.setWorkingDay(Day.THURSDAY, true);\n mpxjCalendar.setWorkingDay(Day.FRIDAY, true);\n mpxjCalendar.setWorkingDay(Day.SATURDAY, false);\n }\n else\n {\n mpxjCalendar.setWorkingDay(Day.MONDAY, isWorkingDay(defaultWeek.getMon()));\n mpxjCalendar.setWorkingDay(Day.TUESDAY, isWorkingDay(defaultWeek.getTue()));\n mpxjCalendar.setWorkingDay(Day.WEDNESDAY, isWorkingDay(defaultWeek.getWed()));\n mpxjCalendar.setWorkingDay(Day.THURSDAY, isWorkingDay(defaultWeek.getThu()));\n mpxjCalendar.setWorkingDay(Day.FRIDAY, isWorkingDay(defaultWeek.getFri()));\n mpxjCalendar.setWorkingDay(Day.SATURDAY, isWorkingDay(defaultWeek.getSat()));\n mpxjCalendar.setWorkingDay(Day.SUNDAY, isWorkingDay(defaultWeek.getSun()));\n }\n\n for (Day day : Day.values())\n {\n if (mpxjCalendar.isWorkingDay(day))\n {\n ProjectCalendarHours hours = mpxjCalendar.addCalendarHours(day);\n hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);\n hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);\n }\n }\n }"
] | [
"private String formatTimeUnit(TimeUnit timeUnit)\n {\n int units = timeUnit.getValue();\n String result;\n String[][] unitNames = LocaleData.getStringArrays(m_locale, LocaleData.TIME_UNITS_ARRAY);\n\n if (units < 0 || units >= unitNames.length)\n {\n result = \"\";\n }\n else\n {\n result = unitNames[units][0];\n }\n\n return (result);\n }",
"public CRFDatum<List<String>, CRFLabel> makeDatum(List<IN> info, int loc,\r\n edu.stanford.nlp.sequences.FeatureFactory<IN> featureFactory) {\r\n pad.set(AnswerAnnotation.class, flags.backgroundSymbol);\r\n PaddedList<IN> pInfo = new PaddedList<IN>(info, pad);\r\n\r\n ArrayList<List<String>> features = new ArrayList<List<String>>();\r\n\r\n // for (int i = 0; i < windowSize; i++) {\r\n // List featuresC = new ArrayList();\r\n // for (int j = 0; j < FeatureFactory.win[i].length; j++) {\r\n // featuresC.addAll(featureFactory.features(info, loc,\r\n // FeatureFactory.win[i][j]));\r\n // }\r\n // features.add(featuresC);\r\n // }\r\n\r\n Collection<Clique> done = new HashSet<Clique>();\r\n for (int i = 0; i < windowSize; i++) {\r\n List<String> featuresC = new ArrayList<String>();\r\n List<Clique> windowCliques = FeatureFactory.getCliques(i, 0);\r\n windowCliques.removeAll(done);\r\n done.addAll(windowCliques);\r\n for (Clique c : windowCliques) {\r\n featuresC.addAll(featureFactory.getCliqueFeatures(pInfo, loc, c)); //todo useless copy because of typing reasons\r\n }\r\n features.add(featuresC);\r\n }\r\n\r\n int[] labels = new int[windowSize];\r\n\r\n for (int i = 0; i < windowSize; i++) {\r\n String answer = pInfo.get(loc + i - windowSize + 1).get(AnswerAnnotation.class);\r\n labels[i] = classIndex.indexOf(answer);\r\n }\r\n\r\n printFeatureLists(pInfo.get(loc), features);\r\n\r\n CRFDatum<List<String>, CRFLabel> d = new CRFDatum<List<String>, CRFLabel>(features, new CRFLabel(labels));\r\n // System.err.println(d);\r\n return d;\r\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 }",
"public boolean isDeleted(Identity id)\r\n {\r\n ObjectEnvelope envelope = buffer.getByIdentity(id);\r\n\r\n return (envelope != null && envelope.needsDelete());\r\n }",
"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 }",
"private void readTable(InputStream is, SynchroTable table) throws IOException\n {\n int skip = table.getOffset() - m_offset;\n if (skip != 0)\n {\n StreamHelper.skip(is, skip);\n m_offset += skip;\n }\n\n String tableName = DatatypeConverter.getString(is);\n int tableNameLength = 2 + tableName.length();\n m_offset += tableNameLength;\n\n int dataLength;\n if (table.getLength() == -1)\n {\n dataLength = is.available();\n }\n else\n {\n dataLength = table.getLength() - tableNameLength;\n }\n\n SynchroLogger.log(\"READ\", tableName);\n\n byte[] compressedTableData = new byte[dataLength];\n is.read(compressedTableData);\n m_offset += dataLength;\n\n Inflater inflater = new Inflater();\n inflater.setInput(compressedTableData);\n ByteArrayOutputStream outputStream = new ByteArrayOutputStream(compressedTableData.length);\n byte[] buffer = new byte[1024];\n while (!inflater.finished())\n {\n int count;\n\n try\n {\n count = inflater.inflate(buffer);\n }\n catch (DataFormatException ex)\n {\n throw new IOException(ex);\n }\n outputStream.write(buffer, 0, count);\n }\n outputStream.close();\n byte[] uncompressedTableData = outputStream.toByteArray();\n\n SynchroLogger.log(uncompressedTableData);\n\n m_tableData.put(table.getName(), uncompressedTableData);\n }",
"public void addRegexRoute(String urlPattern, Class<? extends Actor> actorClass) throws RouteAlreadyMappedException {\n addRoute(new Route(urlPattern, true), actorClass);\n }",
"List<W3CEndpointReference> lookupEndpoints(QName serviceName,\n MatcherDataType matcherData) throws ServiceLocatorFault,\n InterruptedExceptionFault {\n SLPropertiesMatcher matcher = createMatcher(matcherData);\n List<String> names = null;\n List<W3CEndpointReference> result = new ArrayList<W3CEndpointReference>();\n String adress;\n try {\n initLocator();\n if (matcher == null) {\n names = locatorClient.lookup(serviceName);\n } else {\n names = locatorClient.lookup(serviceName, matcher);\n }\n } catch (ServiceLocatorException e) {\n ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail();\n serviceFaultDetail.setLocatorFaultDetail(serviceName.toString()\n + \"throws ServiceLocatorFault\");\n throw new ServiceLocatorFault(e.getMessage(), serviceFaultDetail);\n } catch (InterruptedException e) {\n InterruptionFaultDetail interruptionFaultDetail = new InterruptionFaultDetail();\n interruptionFaultDetail.setInterruptionDetail(serviceName\n .toString() + \"throws InterruptionFault\");\n throw new InterruptedExceptionFault(e.getMessage(),\n interruptionFaultDetail);\n }\n if (names != null && !names.isEmpty()) {\n for (int i = 0; i < names.size(); i++) {\n adress = names.get(i);\n result.add(buildEndpoint(serviceName, adress));\n }\n } else {\n if (LOG.isLoggable(Level.WARNING)) {\n LOG.log(Level.WARNING, \"lookup Endpoints for \" + serviceName\n + \" failed, service is not known.\");\n }\n ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail();\n serviceFaultDetail.setLocatorFaultDetail(\"lookup Endpoint for \"\n + serviceName + \" failed, service is not known.\");\n throw new ServiceLocatorFault(\"Can not find Endpoint\",\n serviceFaultDetail);\n }\n return result;\n }",
"public ProjectCalendar addDefaultDerivedCalendar()\n {\n ProjectCalendar calendar = add();\n\n calendar.setWorkingDay(Day.SUNDAY, DayType.DEFAULT);\n calendar.setWorkingDay(Day.MONDAY, DayType.DEFAULT);\n calendar.setWorkingDay(Day.TUESDAY, DayType.DEFAULT);\n calendar.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT);\n calendar.setWorkingDay(Day.THURSDAY, DayType.DEFAULT);\n calendar.setWorkingDay(Day.FRIDAY, DayType.DEFAULT);\n calendar.setWorkingDay(Day.SATURDAY, DayType.DEFAULT);\n\n return (calendar);\n }"
] |
Abort the daemon
@param error the error causing the abortion | [
"public static void abortSystem(final Throwable error) {\n DaemonStarter.currentPhase.set(LifecyclePhase.ABORTING);\n try {\n DaemonStarter.getLifecycleListener().aborting();\n } catch (Exception e) {\n DaemonStarter.rlog.error(\"Custom abort failed\", e);\n }\n if (error != null) {\n DaemonStarter.rlog.error(\"Unrecoverable error encountered --> Exiting : {}\", error.getMessage());\n DaemonStarter.getLifecycleListener().exception(LifecyclePhase.ABORTING, error);\n } else {\n DaemonStarter.rlog.error(\"Unrecoverable error encountered --> Exiting\");\n }\n // Exit system with failure return code\n System.exit(1);\n }"
] | [
"public ArrayList<IntPoint> process(ImageSource fastBitmap) {\r\n //FastBitmap l = new FastBitmap(fastBitmap);\r\n if (points == null) {\r\n apply(fastBitmap);\r\n }\r\n\r\n int width = fastBitmap.getWidth();\r\n int height = fastBitmap.getHeight();\r\n points = new ArrayList<IntPoint>();\r\n\r\n if (fastBitmap.isGrayscale()) {\r\n for (int x = 0; x < height; x++) {\r\n for (int y = 0; y < width; y++) {\r\n if (fastBitmap.getRGB(y, x) == 255) points.add(new IntPoint(y, x));\r\n }\r\n }\r\n } else {\r\n for (int x = 0; x < height; x++) {\r\n for (int y = 0; y < width; y++) {\r\n // TODO Check for green and blue?\r\n if (fastBitmap.getR(y, x) == 255) points.add(new IntPoint(y, x));\r\n }\r\n }\r\n }\r\n\r\n return points;\r\n }",
"public static double Sinc(double x) {\r\n return Math.sin(Math.PI * x) / (Math.PI * x);\r\n }",
"private static String getFileName(@Nullable final MapPrinter mapPrinter, final PJsonObject spec) {\n String fileName = spec.optString(Constants.OUTPUT_FILENAME_KEY);\n if (fileName != null) {\n return fileName;\n }\n\n if (mapPrinter != null) {\n final Configuration config = mapPrinter.getConfiguration();\n final String templateName = spec.getString(Constants.JSON_LAYOUT_KEY);\n\n final Template template = config.getTemplate(templateName);\n\n if (template.getOutputFilename() != null) {\n return template.getOutputFilename();\n }\n\n if (config.getOutputFilename() != null) {\n return config.getOutputFilename();\n }\n }\n return \"mapfish-print-report\";\n }",
"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}",
"public static BufferedImage resizeToHeight(BufferedImage originalImage, int heightOut) {\n\n int width = originalImage.getWidth();\n\n int height = originalImage.getHeight();\n\n int heightPercent = (heightOut * 100) / height;\n\n int newWidth = (width * heightPercent) / 100;\n\n BufferedImage resizedImage =\n new BufferedImage(newWidth, heightOut, BufferedImage.TYPE_INT_ARGB);\n Graphics2D g = resizedImage.createGraphics();\n g.drawImage(originalImage, 0, 0, newWidth, heightOut, null);\n g.dispose();\n\n return resizedImage;\n }",
"private void handleGetVersionResponse(SerialMessage incomingMessage) {\n\t\tthis.ZWaveLibraryType = incomingMessage.getMessagePayloadByte(12);\n\t\tthis.zWaveVersion = new String(ArrayUtils.subarray(incomingMessage.getMessagePayload(), 0, 11));\n\t\tlogger.debug(String.format(\"Got MessageGetVersion response. Version = %s, Library Type = 0x%02X\", zWaveVersion, ZWaveLibraryType));\n\t}",
"private void readRelationships(Document cdp)\n {\n for (Link link : cdp.getLinks().getLink())\n {\n readRelationship(link);\n }\n }",
"private void deliverTrackMetadataUpdate(int player, TrackMetadata metadata) {\n if (!getTrackMetadataListeners().isEmpty()) {\n final TrackMetadataUpdate update = new TrackMetadataUpdate(player, metadata);\n for (final TrackMetadataListener listener : getTrackMetadataListeners()) {\n try {\n listener.metadataChanged(update);\n\n } catch (Throwable t) {\n logger.warn(\"Problem delivering track metadata update to listener\", t);\n }\n }\n }\n }",
"public <E extends Enum<E> & FieldType> E nextField(Class<E> clazz, UserFieldDataType type)\n {\n for (String name : m_names[type.ordinal()])\n {\n int i = NumberHelper.getInt(m_counters.get(name)) + 1;\n try\n {\n E e = Enum.valueOf(clazz, name + i);\n m_counters.put(name, Integer.valueOf(i));\n return e;\n }\n catch (IllegalArgumentException ex)\n {\n // try the next name\n }\n }\n\n // no more fields available\n throw new IllegalArgumentException(\"No fields for type \" + type + \" available\");\n }"
] |
Find and read the cache format entry in a metadata cache file.
@return the content of the format entry, or {@code null} if none was found
@throws IOException if there is a problem reading the file | [
"private String getCacheFormatEntry() throws IOException {\n ZipEntry zipEntry = zipFile.getEntry(CACHE_FORMAT_ENTRY);\n InputStream is = zipFile.getInputStream(zipEntry);\n try {\n Scanner s = new Scanner(is, \"UTF-8\").useDelimiter(\"\\\\A\");\n String tag = null;\n if (s.hasNext()) tag = s.next();\n return tag;\n } finally {\n is.close();\n }\n }"
] | [
"public Release rollback(String appName, String releaseUuid) {\n return connection.execute(new Rollback(appName, releaseUuid), apiKey);\n }",
"void sign(byte[] data, int offset, int length,\n ServerMessageBlock request, ServerMessageBlock response) {\n request.signSeq = signSequence;\n if( response != null ) {\n response.signSeq = signSequence + 1;\n response.verifyFailed = false;\n }\n\n try {\n update(macSigningKey, 0, macSigningKey.length);\n int index = offset + ServerMessageBlock.SIGNATURE_OFFSET;\n for (int i = 0; i < 8; i++) data[index + i] = 0;\n ServerMessageBlock.writeInt4(signSequence, data, index);\n update(data, offset, length);\n System.arraycopy(digest(), 0, data, index, 8);\n if (bypass) {\n bypass = false;\n System.arraycopy(\"BSRSPYL \".getBytes(), 0, data, index, 8);\n }\n } catch (Exception ex) {\n if( log.level > 0 )\n ex.printStackTrace( log );\n } finally {\n signSequence += 2;\n }\n }",
"static WeldContainer startInitialization(String id, Deployment deployment, Bootstrap bootstrap) {\n if (SINGLETON.isSet(id)) {\n throw WeldSELogger.LOG.weldContainerAlreadyRunning(id);\n }\n WeldContainer weldContainer = new WeldContainer(id, deployment, bootstrap);\n SINGLETON.set(id, weldContainer);\n RUNNING_CONTAINER_IDS.add(id);\n return weldContainer;\n }",
"protected void progressInfoMessage(final String tag) {\n if(logger.isInfoEnabled()) {\n long totalTimeS = (System.currentTimeMillis() - startTimeMs) / Time.MS_PER_SECOND;\n\n logger.info(tag + \" : scanned \" + scanned + \" and fetched \" + fetched + \" for store '\"\n + storageEngine.getName() + \"' partitionIds:\" + partitionIds + \" in \"\n + totalTimeS + \" s\");\n }\n }",
"static void processServerConfig(final Resource root, final RequiredConfigurationHolder requiredConfigurationHolder, final IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo serverConfig, final ExtensionRegistry extensionRegistry) {\n\n final Set<String> serverGroups = requiredConfigurationHolder.serverGroups;\n final Set<String> socketBindings = requiredConfigurationHolder.socketBindings;\n\n String sbg = serverConfig.getSocketBindingGroup();\n if (sbg != null && !socketBindings.contains(sbg)) {\n processSocketBindingGroup(root, sbg, requiredConfigurationHolder);\n }\n\n final String groupName = serverConfig.getServerGroup();\n final PathElement groupElement = PathElement.pathElement(SERVER_GROUP, groupName);\n // Also check the root, since this also gets executed on the slave which may not have the server-group configured yet\n if (!serverGroups.contains(groupName) && root.hasChild(groupElement)) {\n\n final Resource serverGroup = root.getChild(groupElement);\n final ModelNode groupModel = serverGroup.getModel();\n serverGroups.add(groupName);\n\n // Include the socket binding groups\n if (groupModel.hasDefined(SOCKET_BINDING_GROUP)) {\n final String socketBindingGroup = groupModel.get(SOCKET_BINDING_GROUP).asString();\n processSocketBindingGroup(root, socketBindingGroup, requiredConfigurationHolder);\n }\n\n final String profileName = groupModel.get(PROFILE).asString();\n processProfile(root, profileName, requiredConfigurationHolder, extensionRegistry);\n }\n }",
"public int getHotCueCount() {\n if (rawMessage != null) {\n return (int) ((NumberField) rawMessage.arguments.get(5)).getValue();\n }\n int total = 0;\n for (Entry entry : entries) {\n if (entry.hotCueNumber > 0) {\n ++total;\n }\n }\n return total;\n }",
"private void readCalendar(Project.Calendars.Calendar calendar, HashMap<BigInteger, ProjectCalendar> map, List<Pair<ProjectCalendar, BigInteger>> baseCalendars)\n {\n ProjectCalendar bc = m_projectFile.addCalendar();\n bc.setUniqueID(NumberHelper.getInteger(calendar.getUID()));\n bc.setName(calendar.getName());\n BigInteger baseCalendarID = calendar.getBaseCalendarUID();\n if (baseCalendarID != null)\n {\n baseCalendars.add(new Pair<ProjectCalendar, BigInteger>(bc, baseCalendarID));\n }\n\n readExceptions(calendar, bc);\n boolean readExceptionsFromDays = bc.getCalendarExceptions().isEmpty();\n\n Project.Calendars.Calendar.WeekDays days = calendar.getWeekDays();\n if (days != null)\n {\n for (Project.Calendars.Calendar.WeekDays.WeekDay weekDay : days.getWeekDay())\n {\n readDay(bc, weekDay, readExceptionsFromDays);\n }\n }\n else\n {\n bc.setWorkingDay(Day.SUNDAY, DayType.DEFAULT);\n bc.setWorkingDay(Day.MONDAY, DayType.DEFAULT);\n bc.setWorkingDay(Day.TUESDAY, DayType.DEFAULT);\n bc.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT);\n bc.setWorkingDay(Day.THURSDAY, DayType.DEFAULT);\n bc.setWorkingDay(Day.FRIDAY, DayType.DEFAULT);\n bc.setWorkingDay(Day.SATURDAY, DayType.DEFAULT);\n }\n\n readWorkWeeks(calendar, bc);\n\n map.put(calendar.getUID(), bc);\n\n m_eventManager.fireCalendarReadEvent(bc);\n }",
"GVRShader makeTemplate(Class<? extends GVRShader> id, GVRContext ctx)\n {\n try\n {\n Constructor<? extends GVRShader> maker = id.getDeclaredConstructor(GVRContext.class);\n return maker.newInstance(ctx);\n }\n catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException ex)\n {\n try\n {\n Constructor<? extends GVRShader> maker = id.getDeclaredConstructor();\n return maker.newInstance();\n }\n catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException ex2)\n {\n ctx.getEventManager().sendEvent(ctx, IErrorEvents.class, \"onError\", new Object[] {ex2.getMessage(), this});\n return null;\n }\n }\n }",
"public static Type[] getActualTypeArguments(Class<?> clazz) {\n Type type = Types.getCanonicalType(clazz);\n if (type instanceof ParameterizedType) {\n return ((ParameterizedType) type).getActualTypeArguments();\n } else {\n return EMPTY_TYPES;\n }\n }"
] |
Get the raw data bytes of the device update packet.
@return the data sent by the device to update its status | [
"public byte[] getPacketBytes() {\n byte[] result = new byte[packetBytes.length];\n System.arraycopy(packetBytes, 0, result, 0, packetBytes.length);\n return result;\n }"
] | [
"public static final void decodeBuffer(byte[] data, byte encryptionCode)\n {\n for (int i = 0; i < data.length; i++)\n {\n data[i] = (byte) (data[i] ^ encryptionCode);\n }\n }",
"public void retrieveEngine() throws GeneralSecurityException, IOException {\n if (serverEngineFactory == null) {\n return;\n }\n engine = serverEngineFactory.retrieveHTTPServerEngine(nurl.getPort());\n if (engine == null) {\n engine = serverEngineFactory.getHTTPServerEngine(nurl.getHost(), nurl.getPort(), nurl.getProtocol());\n }\n\n assert engine != null;\n TLSServerParameters serverParameters = engine.getTlsServerParameters();\n if (serverParameters != null && serverParameters.getCertConstraints() != null) {\n CertificateConstraintsType constraints = serverParameters.getCertConstraints();\n if (constraints != null) {\n certConstraints = CertConstraintsJaxBUtils.createCertConstraints(constraints);\n }\n }\n\n // When configuring for \"http\", however, it is still possible that\n // Spring configuration has configured the port for https.\n if (!nurl.getProtocol().equals(engine.getProtocol())) {\n throw new IllegalStateException(\"Port \" + engine.getPort() + \" is configured with wrong protocol \\\"\" + engine.getProtocol() + \"\\\" for \\\"\" + nurl + \"\\\"\");\n }\n }",
"public ProjectCalendarWeek addWorkWeek()\n {\n ProjectCalendarWeek week = new ProjectCalendarWeek();\n week.setParent(this);\n m_workWeeks.add(week);\n m_weeksSorted = false;\n clearWorkingDateCache();\n return week;\n }",
"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 List<ProjectFile> readAll(InputStream is, boolean linkCrossProjectRelations) throws MPXJException\n {\n try\n {\n m_tables = new HashMap<String, List<Row>>();\n m_numberFormat = new DecimalFormat();\n\n processFile(is);\n\n List<Row> rows = getRows(\"project\", null, null);\n List<ProjectFile> result = new ArrayList<ProjectFile>(rows.size());\n List<ExternalPredecessorRelation> externalPredecessors = new ArrayList<ExternalPredecessorRelation>();\n for (Row row : rows)\n {\n setProjectID(row.getInt(\"proj_id\"));\n\n m_reader = new PrimaveraReader(m_taskUdfCounters, m_resourceUdfCounters, m_assignmentUdfCounters, m_resourceFields, m_wbsFields, m_taskFields, m_assignmentFields, m_aliases, m_matchPrimaveraWBS);\n ProjectFile project = m_reader.getProject();\n project.getEventManager().addProjectListeners(m_projectListeners);\n\n processProjectProperties();\n processUserDefinedFields();\n processCalendars();\n processResources();\n processResourceRates();\n processTasks();\n processPredecessors();\n processAssignments();\n\n externalPredecessors.addAll(m_reader.getExternalPredecessors());\n\n m_reader = null;\n project.updateStructure();\n\n result.add(project);\n }\n\n if (linkCrossProjectRelations)\n {\n for (ExternalPredecessorRelation externalRelation : externalPredecessors)\n {\n Task predecessorTask;\n // we could aggregate the project task id maps but that's likely more work\n // than just looping through the projects\n for (ProjectFile proj : result)\n {\n predecessorTask = proj.getTaskByUniqueID(externalRelation.getSourceUniqueID());\n if (predecessorTask != null)\n {\n Relation relation = externalRelation.getTargetTask().addPredecessor(predecessorTask, externalRelation.getType(), externalRelation.getLag());\n relation.setUniqueID(externalRelation.getUniqueID());\n break;\n }\n }\n // if predecessorTask not found the external task is outside of the file so ignore\n }\n }\n\n return result;\n }\n\n finally\n {\n m_reader = null;\n m_tables = null;\n m_currentTableName = null;\n m_currentTable = null;\n m_currentFieldNames = null;\n m_defaultCurrencyName = null;\n m_currencyMap.clear();\n m_numberFormat = null;\n m_defaultCurrencyData = null;\n }\n }",
"private void add(int field)\n {\n if (field < m_flags.length)\n {\n if (m_flags[field] == false)\n {\n m_flags[field] = true;\n m_fields[m_count] = field;\n ++m_count;\n }\n }\n }",
"public static ClassNode getWrapper(ClassNode cn) {\n cn = cn.redirect();\n if (!isPrimitiveType(cn)) return cn;\n if (cn==boolean_TYPE) {\n return Boolean_TYPE;\n } else if (cn==byte_TYPE) {\n return Byte_TYPE;\n } else if (cn==char_TYPE) {\n return Character_TYPE;\n } else if (cn==short_TYPE) {\n return Short_TYPE;\n } else if (cn==int_TYPE) {\n return Integer_TYPE;\n } else if (cn==long_TYPE) {\n return Long_TYPE;\n } else if (cn==float_TYPE) {\n return Float_TYPE;\n } else if (cn==double_TYPE) {\n return Double_TYPE;\n } else if (cn==VOID_TYPE) {\n return void_WRAPPER_TYPE;\n }\n else {\n return cn;\n }\n }",
"@Override\n\tpublic boolean isPrefixBlock() {\n\t\tInteger networkPrefixLength = getNetworkPrefixLength();\n\t\tif(networkPrefixLength == null) {\n\t\t\treturn false;\n\t\t}\n\t\tif(getNetwork().getPrefixConfiguration().allPrefixedAddressesAreSubnets()) {\n\t\t\treturn true;\n\t\t}\n\t\treturn containsPrefixBlock(networkPrefixLength);\n\t}",
"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 }"
] |
Register the Rowgroup buckets and places the header cells for the rows | [
"private void registerRows() {\n\t\tfor (int i = 0; i < rows.length; i++) {\n\t\t\tDJCrosstabRow crosstabRow = rows[i];\n\n\t\t\tJRDesignCrosstabRowGroup ctRowGroup = new JRDesignCrosstabRowGroup();\n\n\t\t\tctRowGroup.setWidth(crosstabRow.getHeaderWidth());\n\n\t\t\tctRowGroup.setName(crosstabRow.getProperty().getProperty());\n\n\t\t\tJRDesignCrosstabBucket rowBucket = new JRDesignCrosstabBucket();\n\n //New in JR 4.1+\n rowBucket.setValueClassName(crosstabRow.getProperty().getValueClassName());\n\n\t\t\tctRowGroup.setBucket(rowBucket);\n\n\t\t\tJRDesignExpression bucketExp = ExpressionUtils.createExpression(\"$F{\"+crosstabRow.getProperty().getProperty()+\"}\", crosstabRow.getProperty().getValueClassName());\n\t\t\trowBucket.setExpression(bucketExp);\n\n\n\t\t\tJRDesignCellContents rowHeaderContents = new JRDesignCellContents();\n\t\t\tJRDesignTextField rowTitle = new JRDesignTextField();\n\n\t\t\tJRDesignExpression rowTitExp = new JRDesignExpression();\n\t\t\trowTitExp.setValueClassName(crosstabRow.getProperty().getValueClassName());\n\t\t\trowTitExp.setText(\"$V{\"+crosstabRow.getProperty().getProperty()+\"}\");\n\n\t\t\trowTitle.setExpression(rowTitExp);\n\t\t\trowTitle.setWidth(crosstabRow.getHeaderWidth());\n\n\t\t\t//The width can be the sum of the with of all the rows starting from the current one, up to the inner most one.\n\t\t\tint auxHeight = getRowHeaderMaxHeight(crosstabRow);\n//\t\t\tint auxHeight = crosstabRow.getHeight(); //FIXME getRowHeaderMaxHeight() must be FIXED because it breaks when 1rs row shows total and 2nd doesn't\n\t\t\trowTitle.setHeight(auxHeight);\n\n\t\t\tStyle headerstyle = crosstabRow.getHeaderStyle() == null ? this.djcross.getRowHeaderStyle(): crosstabRow.getHeaderStyle();\n\n\t\t\tif (headerstyle != null){\n\t\t\t\tlayoutManager.applyStyleToElement(headerstyle, rowTitle);\n\t\t\t\trowHeaderContents.setBackcolor(headerstyle.getBackgroundColor());\n\t\t\t}\n\n\t\t\trowHeaderContents.addElement(rowTitle);\n\t\t\trowHeaderContents.setMode( ModeEnum.OPAQUE );\n\n\t\t\tboolean fullBorder = i <= 0; //Only outer most will have full border\n\t\t\tapplyCellBorder(rowHeaderContents, false, fullBorder);\n\n\t\t\tctRowGroup.setHeader(rowHeaderContents );\n\n\t\t\tif (crosstabRow.isShowTotals())\n\t\t\t\tcreateRowTotalHeader(ctRowGroup,crosstabRow,fullBorder);\n\n\n\t\t\ttry {\n\t\t\t\tjrcross.addRowGroup(ctRowGroup);\n\t\t\t} catch (JRException e) {\n\t\t\t\tlog.error(e.getMessage(),e);\n\t\t\t}\n\n\t\t}\n\t}"
] | [
"public static ServiceName channelServiceName(final ServiceName endpointName, final String channelName) {\n return endpointName.append(\"channel\").append(channelName);\n }",
"public static final Date parseDateTime(String value)\n {\n Date result = null;\n\n try\n {\n if (value != null && !value.isEmpty())\n {\n result = DATE_TIME_FORMAT.get().parse(value);\n }\n }\n catch (ParseException ex)\n {\n // Ignore\n }\n\n return result;\n }",
"public static double[] toDouble(int[] array) {\n double[] n = new double[array.length];\n for (int i = 0; i < array.length; i++) {\n n[i] = (double) array[i];\n }\n return n;\n }",
"public String convert(BufferedImage image, boolean favicon) {\n // Reset statistics before anything\n statsArray = new int[12];\n // Begin the timer\n dStart = System.nanoTime();\n // Scale the image\n image = scale(image, favicon);\n // The +1 is for the newline characters\n StringBuilder sb = new StringBuilder((image.getWidth() + 1) * image.getHeight());\n\n for (int y = 0; y < image.getHeight(); y++) {\n // At the end of each line, add a newline character\n if (sb.length() != 0) sb.append(\"\\n\");\n for (int x = 0; x < image.getWidth(); x++) {\n //\n Color pixelColor = new Color(image.getRGB(x, y), true);\n int alpha = pixelColor.getAlpha();\n boolean isTransient = alpha < 0.1;\n double gValue = isTransient ? 250 : ((double) pixelColor.getRed() * 0.2989 + (double) pixelColor.getBlue() * 0.5870 + (double) pixelColor.getGreen() * 0.1140) / ((double)alpha / (double)250);\n final char s = gValue < 130 ? darkGrayScaleMap(gValue) : lightGrayScaleMap(gValue);\n sb.append(s);\n }\n }\n imgArray = sb.toString().toCharArray();\n dEnd = System.nanoTime();\n return sb.toString();\n }",
"@Override\n public final String optString(final String key, final String defaultValue) {\n String result = optString(key);\n return result == null ? defaultValue : result;\n }",
"public void forAllIndices(String template, Properties attributes) throws XDocletException\r\n {\r\n boolean processUnique = TypeConversionUtil.stringToBoolean(attributes.getProperty(ATTRIBUTE_UNIQUE), false);\r\n\r\n // first the default index\r\n _curIndexDef = _curTableDef.getIndex(null);\r\n if ((_curIndexDef != null) && (processUnique == _curIndexDef.isUnique()))\r\n {\r\n generate(template);\r\n }\r\n for (Iterator it = _curTableDef.getIndices(); it.hasNext(); )\r\n {\r\n _curIndexDef = (IndexDef)it.next();\r\n if (!_curIndexDef.isDefault() && (processUnique == _curIndexDef.isUnique()))\r\n { \r\n generate(template);\r\n }\r\n }\r\n _curIndexDef = null;\r\n }",
"public void setJdbcLevel(String jdbcLevel)\r\n {\r\n if (jdbcLevel != null)\r\n {\r\n try\r\n {\r\n double intLevel = Double.parseDouble(jdbcLevel);\r\n setJdbcLevel(intLevel);\r\n }\r\n catch(NumberFormatException nfe)\r\n {\r\n setJdbcLevel(2.0);\r\n logger.info(\"Specified JDBC level was not numeric (Value=\" + jdbcLevel + \"), used default jdbc level of 2.0 \");\r\n }\r\n }\r\n else\r\n {\r\n setJdbcLevel(2.0);\r\n logger.info(\"Specified JDBC level was null, used default jdbc level of 2.0 \");\r\n }\r\n }",
"public Set<Action.ActionEffect> getActionEffects() {\n switch(getImpact()) {\n case CLASSLOADING:\n case WRITE:\n return WRITES;\n case READ_ONLY:\n return READS;\n default:\n throw new IllegalStateException();\n }\n\n }",
"public static void writeCorrelationId(Message message, String correlationId) {\n if (!(message instanceof SoapMessage)) {\n return;\n }\n SoapMessage soapMessage = (SoapMessage) message;\n Header hdCorrelationId = soapMessage.getHeader(CORRELATION_ID_QNAME);\n if (hdCorrelationId != null) {\n LOG.warning(\"CorrelationId already existing in soap header, need not to write CorrelationId header.\");\n return;\n }\n if ((soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class) != null)\n && (soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class) instanceof SAAJStreamWriter)\n && (((SAAJStreamWriter) soapMessage.getContent(javax.xml.stream.XMLStreamWriter.class))\n .getDocument()\n .getElementsByTagNameNS(\"http://www.talend.com/esb/sam/correlationId/v1\",\n \"correlationId\").getLength() > 0)) {\n LOG.warning(\"CorrelationId already existing in soap header, need not to write CorrelationId header.\");\n return;\n }\n\n try {\n soapMessage.getHeaders().add(\n new Header(CORRELATION_ID_QNAME, correlationId, new JAXBDataBinding(String.class)));\n if (LOG.isLoggable(Level.FINE)) {\n LOG.fine(\"Stored correlationId '\" + correlationId + \"' in soap header: \"\n + CORRELATION_ID_QNAME);\n }\n } catch (JAXBException e) {\n LOG.log(Level.SEVERE, \"Couldn't create correlationId header.\", e);\n }\n\n }"
] |
No need to expose. Client side work. | [
"@Override\n public void setJobQueue(int jobId, Queue queue)\n {\n JqmClientFactory.getClient().setJobQueue(jobId, queue);\n }"
] | [
"int add(DownloadRequest request) {\n\t\tint downloadId = getDownloadId();\n\t\t// Tag the request as belonging to this queue and add it to the set of current requests.\n\t\trequest.setDownloadRequestQueue(this);\n\n\t\tsynchronized (mCurrentRequests) {\n\t\t\tmCurrentRequests.add(request);\n\t\t}\n\n\t\t// Process requests in the order they are added.\n\t\trequest.setDownloadId(downloadId);\n\t\tmDownloadQueue.add(request);\n\n\t\treturn downloadId;\n\t}",
"private static I_CmsResourceBundle tryBundle(String localizedName) {\n\n I_CmsResourceBundle result = null;\n\n try {\n\n String resourceName = localizedName.replace('.', '/') + \".properties\";\n URL url = CmsResourceBundleLoader.class.getClassLoader().getResource(resourceName);\n\n I_CmsResourceBundle additionalBundle = m_permanentCache.get(localizedName);\n if (additionalBundle != null) {\n result = additionalBundle.getClone();\n } else if (url != null) {\n // the resource was found on the file system\n InputStream is = null;\n String path = CmsFileUtil.normalizePath(url);\n File file = new File(path);\n try {\n // try to load the resource bundle from a file, NOT with the resource loader first\n // this is important since using #getResourceAsStream() may return cached results,\n // for example Tomcat by default does cache all resources loaded by the class loader\n // this means a changed resource bundle file is not loaded\n is = new FileInputStream(file);\n } catch (IOException ex) {\n // this will happen if the resource is contained for example in a .jar file\n is = CmsResourceBundleLoader.class.getClassLoader().getResourceAsStream(resourceName);\n } catch (AccessControlException acex) {\n // fixed bug #1550\n // this will happen if the resource is contained for example in a .jar file\n // and security manager is turned on.\n is = CmsResourceBundleLoader.class.getClassLoader().getResourceAsStream(resourceName);\n }\n if (is != null) {\n result = new CmsPropertyResourceBundle(is);\n }\n }\n } catch (IOException ex) {\n // can't localized these message since this may lead to a chicken-egg problem\n MissingResourceException mre = new MissingResourceException(\n \"Failed to load bundle '\" + localizedName + \"'\",\n localizedName,\n \"\");\n mre.initCause(ex);\n throw mre;\n }\n\n return result;\n }",
"public static base_responses delete(nitro_service client, appfwlearningdata resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tappfwlearningdata deleteresources[] = new appfwlearningdata[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tdeleteresources[i] = new appfwlearningdata();\n\t\t\t\tdeleteresources[i].profilename = resources[i].profilename;\n\t\t\t\tdeleteresources[i].starturl = resources[i].starturl;\n\t\t\t\tdeleteresources[i].cookieconsistency = resources[i].cookieconsistency;\n\t\t\t\tdeleteresources[i].fieldconsistency = resources[i].fieldconsistency;\n\t\t\t\tdeleteresources[i].formactionurl_ffc = resources[i].formactionurl_ffc;\n\t\t\t\tdeleteresources[i].crosssitescripting = resources[i].crosssitescripting;\n\t\t\t\tdeleteresources[i].formactionurl_xss = resources[i].formactionurl_xss;\n\t\t\t\tdeleteresources[i].sqlinjection = resources[i].sqlinjection;\n\t\t\t\tdeleteresources[i].formactionurl_sql = resources[i].formactionurl_sql;\n\t\t\t\tdeleteresources[i].fieldformat = resources[i].fieldformat;\n\t\t\t\tdeleteresources[i].formactionurl_ff = resources[i].formactionurl_ff;\n\t\t\t\tdeleteresources[i].csrftag = resources[i].csrftag;\n\t\t\t\tdeleteresources[i].csrfformoriginurl = resources[i].csrfformoriginurl;\n\t\t\t\tdeleteresources[i].xmldoscheck = resources[i].xmldoscheck;\n\t\t\t\tdeleteresources[i].xmlwsicheck = resources[i].xmlwsicheck;\n\t\t\t\tdeleteresources[i].xmlattachmentcheck = resources[i].xmlattachmentcheck;\n\t\t\t\tdeleteresources[i].totalxmlrequests = resources[i].totalxmlrequests;\n\t\t\t}\n\t\t\tresult = delete_bulk_request(client, deleteresources);\n\t\t}\n\t\treturn result;\n\t}",
"public static base_response unset(nitro_service client, systemuser resource, String[] args) throws Exception{\n\t\tsystemuser unsetresource = new systemuser();\n\t\tunsetresource.username = resource.username;\n\t\treturn unsetresource.unset_resource(client,args);\n\t}",
"public boolean removeAll(Collection<?> collection) {\n boolean result = false;\n synchronized (mLock) {\n Iterator<?> it;\n if (mOriginalValues != null) {\n it = mOriginalValues.iterator();\n\n } else {\n it = mObjects.iterator();\n }\n while (it.hasNext()) {\n if (collection.contains(it.next())) {\n it.remove();\n result = true;\n }\n }\n }\n if (mNotifyOnChange) notifyDataSetChanged();\n return result;\n }",
"public void set1Value(int index, String newValue) {\n try {\n value.set( index, newValue );\n }\n catch (IndexOutOfBoundsException e) {\n Log.e(TAG, \"X3D MFString set1Value(int index, ...) out of bounds.\" + e);\n }\n catch (Exception e) {\n Log.e(TAG, \"X3D MFString set1Value(int index, ...) exception \" + e);\n }\n }",
"public ParallelTaskBuilder prepareHttpHead(String url) {\n reinitIfClosed();\n ParallelTaskBuilder cb = new ParallelTaskBuilder();\n cb.getHttpMeta().setHttpMethod(HttpMethod.HEAD);\n cb.getHttpMeta().setRequestUrlPostfix(url);\n return cb;\n }",
"public Map<Integer, String> listProjects(InputStream is) throws MPXJException\n {\n try\n {\n m_tables = new HashMap<String, List<Row>>();\n processFile(is);\n\n Map<Integer, String> result = new HashMap<Integer, String>();\n\n List<Row> rows = getRows(\"project\", null, null);\n for (Row row : rows)\n {\n Integer id = row.getInteger(\"proj_id\");\n String name = row.getString(\"proj_short_name\");\n result.put(id, name);\n }\n\n return result;\n }\n\n finally\n {\n m_tables = null;\n m_currentTable = null;\n m_currentFieldNames = null;\n }\n }",
"private void createNodeMappings(MtasTokenIdFactory mtasTokenIdFactory,\n Level level, Level parentLevel) {\n MtasToken nodeToken;\n if (level.node != null && level.positionStart != null\n && level.positionEnd != null) {\n nodeToken = new MtasTokenString(mtasTokenIdFactory.createTokenId(),\n level.node, \"\");\n nodeToken.setOffset(level.offsetStart, level.offsetEnd);\n nodeToken.setRealOffset(level.realOffsetStart, level.realOffsetEnd);\n nodeToken.addPositionRange(level.positionStart, level.positionEnd);\n tokenCollection.add(nodeToken);\n if (parentLevel != null) {\n parentLevel.tokens.add(nodeToken);\n }\n // only for first mapping(?)\n for (MtasToken token : level.tokens) {\n token.setParentId(nodeToken.getId());\n }\n }\n }"
] |
Caches the results of radix to the given power.
@param radix
@param power
@return | [
"protected static BigInteger getRadixPower(BigInteger radix, int power) {\n\t\tlong key = (((long) radix.intValue()) << 32) | power;\n\t\tBigInteger result = radixPowerMap.get(key);\n\t\tif(result == null) {\n\t\t\tif(power == 1) {\n\t\t\t\tresult = radix;\n\t\t\t} else if((power & 1) == 0) {\n\t\t\t\tBigInteger halfPower = getRadixPower(radix, power >> 1);\n\t\t\t\tresult = halfPower.multiply(halfPower);\n\t\t\t} else {\n\t\t\t\tBigInteger halfPower = getRadixPower(radix, (power - 1) >> 1);\n\t\t\t\tresult = halfPower.multiply(halfPower).multiply(radix);\n\t\t\t}\n\t\t\tradixPowerMap.put(key, result);\n\t\t}\n\t\treturn result;\n\t}"
] | [
"private void readResource(net.sf.mpxj.ganttproject.schema.Resource gpResource)\n {\n Resource mpxjResource = m_projectFile.addResource();\n mpxjResource.setUniqueID(Integer.valueOf(NumberHelper.getInt(gpResource.getId()) + 1));\n mpxjResource.setName(gpResource.getName());\n mpxjResource.setEmailAddress(gpResource.getContacts());\n mpxjResource.setText(1, gpResource.getPhone());\n mpxjResource.setGroup(m_roleDefinitions.get(gpResource.getFunction()));\n\n net.sf.mpxj.ganttproject.schema.Rate gpRate = gpResource.getRate();\n if (gpRate != null)\n {\n mpxjResource.setStandardRate(new Rate(gpRate.getValueAttribute(), TimeUnit.DAYS));\n }\n readResourceCustomFields(gpResource, mpxjResource);\n m_eventManager.fireResourceReadEvent(mpxjResource);\n }",
"public Duration getWork(FastTrackField type)\n {\n Double value = (Double) getObject(type);\n return value == null ? null : Duration.getInstance(value.doubleValue(), m_table.getWorkTimeUnit());\n }",
"public int readFrom(ByteBuffer src, long destOffset) {\n if (src.remaining() + destOffset >= size())\n throw new BufferOverflowException();\n int readLen = src.remaining();\n ByteBuffer b = toDirectByteBuffer(destOffset, readLen);\n b.position(0);\n b.put(src);\n return readLen;\n }",
"public boolean startsWith(Bytes prefix) {\n Objects.requireNonNull(prefix, \"startWith(Bytes prefix) cannot have null parameter\");\n\n if (prefix.length > this.length) {\n return false;\n } else {\n int end = this.offset + prefix.length;\n for (int i = this.offset, j = prefix.offset; i < end; i++, j++) {\n if (this.data[i] != prefix.data[j]) {\n return false;\n }\n }\n }\n return true;\n }",
"protected void reportProgress(String taskDecription) {\n if (this.progress != null) {\n if (this.progress.isCanceled()) {\n // Only AbortCompilation can stop the compiler cleanly.\n // We check cancellation again following the call to compile.\n throw new AbortCompilation(true, null);\n }\n this.progress.setTaskName(taskDecription);\n }\n }",
"public static base_response update(nitro_service client, nd6ravariables resource) throws Exception {\n\t\tnd6ravariables updateresource = new nd6ravariables();\n\t\tupdateresource.vlan = resource.vlan;\n\t\tupdateresource.ceaserouteradv = resource.ceaserouteradv;\n\t\tupdateresource.sendrouteradv = resource.sendrouteradv;\n\t\tupdateresource.srclinklayeraddroption = resource.srclinklayeraddroption;\n\t\tupdateresource.onlyunicastrtadvresponse = resource.onlyunicastrtadvresponse;\n\t\tupdateresource.managedaddrconfig = resource.managedaddrconfig;\n\t\tupdateresource.otheraddrconfig = resource.otheraddrconfig;\n\t\tupdateresource.currhoplimit = resource.currhoplimit;\n\t\tupdateresource.maxrtadvinterval = resource.maxrtadvinterval;\n\t\tupdateresource.minrtadvinterval = resource.minrtadvinterval;\n\t\tupdateresource.linkmtu = resource.linkmtu;\n\t\tupdateresource.reachabletime = resource.reachabletime;\n\t\tupdateresource.retranstime = resource.retranstime;\n\t\tupdateresource.defaultlifetime = resource.defaultlifetime;\n\t\treturn updateresource.update_resource(client);\n\t}",
"protected boolean isNetworkSection(int networkPrefixLength, boolean withPrefixLength) {\n\t\tint segmentCount = getSegmentCount();\n\t\tif(segmentCount == 0) {\n\t\t\treturn true;\n\t\t}\n\t\tint bitsPerSegment = getBitsPerSegment();\n\t\tint prefixedSegmentIndex = getNetworkSegmentIndex(networkPrefixLength, getBytesPerSegment(), bitsPerSegment);\n\t\tif(prefixedSegmentIndex + 1 < segmentCount) {\n\t\t\treturn false; //not the right number of segments\n\t\t}\n\t\t//the segment count matches, now compare the prefixed segment\n\t\tint segPrefLength = getPrefixedSegmentPrefixLength(bitsPerSegment, networkPrefixLength, prefixedSegmentIndex);\n\t\treturn !getSegment(segmentCount - 1).isNetworkChangedByPrefix(segPrefLength, withPrefixLength);\n\t}",
"public static void dumpRow(Map<String, Object> row)\n {\n for (Entry<String, Object> entry : row.entrySet())\n {\n Object value = entry.getValue();\n System.out.println(entry.getKey() + \" = \" + value + \" ( \" + (value == null ? \"\" : value.getClass().getName()) + \")\");\n }\n }",
"public void removeControl(String name) {\n Widget control = findChildByName(name);\n if (control != null) {\n removeChild(control);\n if (mBgResId != -1) {\n updateMesh();\n }\n }\n }"
] |
Determines whether the specified permission is permitted.
@param permission
@return <tt>false<tt> if the specified permission is not permitted, based on the current security policy; <tt>true<tt> otherwise | [
"public static boolean hasPermission(Permission permission) {\n SecurityManager security = System.getSecurityManager();\n if (security != null) {\n try {\n security.checkPermission(permission);\n } catch (java.security.AccessControlException e) {\n return false;\n }\n }\n return true;\n }"
] | [
"public void rename(String newName) {\n URL url = FOLDER_INFO_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, \"PUT\");\n\n JsonObject updateInfo = new JsonObject();\n updateInfo.add(\"name\", newName);\n\n request.setBody(updateInfo.toString());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n response.getJSON();\n }",
"public static base_responses reset(nitro_service client, Interface resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tInterface resetresources[] = new Interface[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tresetresources[i] = new Interface();\n\t\t\t\tresetresources[i].id = resources[i].id;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, resetresources,\"reset\");\n\t\t}\n\t\treturn result;\n\t}",
"@SafeVarargs\n private final <T> Set<T> join(Set<T>... sets)\n {\n Set<T> result = new HashSet<>();\n if (sets == null)\n return result;\n\n for (Set<T> set : sets)\n {\n if (set != null)\n result.addAll(set);\n }\n return result;\n }",
"public static sslocspresponder get(nitro_service service, String name) throws Exception{\n\t\tsslocspresponder obj = new sslocspresponder();\n\t\tobj.set_name(name);\n\t\tsslocspresponder response = (sslocspresponder) obj.get_resource(service);\n\t\treturn response;\n\t}",
"public static void checkFileOrDirectoryToBeRead(File fileOrDir, String fileDesc)\n {\n if (fileOrDir == null)\n throw new IllegalArgumentException(fileDesc + \" must not be null.\");\n if (!fileOrDir.exists())\n throw new IllegalArgumentException(fileDesc + \" does not exist: \" + fileOrDir.getAbsolutePath());\n if (!(fileOrDir.isDirectory() || fileOrDir.isFile()))\n throw new IllegalArgumentException(fileDesc + \" must be a file or a directory: \" + fileOrDir.getPath());\n if (fileOrDir.isDirectory())\n {\n if (fileOrDir.list().length == 0)\n throw new IllegalArgumentException(fileDesc + \" is an empty directory: \" + fileOrDir.getPath());\n }\n }",
"public static String digestToFileName(String digest) {\n if (StringUtils.startsWith(digest, \"sha1\")) {\n return \"manifest.json\";\n }\n return getShaVersion(digest) + \"__\" + getShaValue(digest);\n }",
"private String fixSpecials(final String inString) {\n\t\tStringBuilder tmp = new StringBuilder();\n\n\t\tfor (int i = 0; i < inString.length(); i++) {\n\t\t\tchar chr = inString.charAt(i);\n\n\t\t\tif (isSpecial(chr)) {\n\t\t\t\ttmp.append(this.escape);\n\t\t\t\ttmp.append(chr);\n\t\t\t} else {\n\t\t\t\ttmp.append(chr);\n\t\t\t}\n\t\t}\n\n\t\treturn tmp.toString();\n\t}",
"public boolean hasRequiredClientProps() {\n boolean valid = true;\n valid &= verifyStringPropSet(CONNECTION_APPLICATION_NAME_PROP, CLIENT_APPLICATION_NAME_PROP);\n valid &= verifyStringPropSet(ACCUMULO_USER_PROP, CLIENT_ACCUMULO_USER_PROP);\n valid &= verifyStringPropSet(ACCUMULO_PASSWORD_PROP, CLIENT_ACCUMULO_PASSWORD_PROP);\n valid &= verifyStringPropSet(ACCUMULO_INSTANCE_PROP, CLIENT_ACCUMULO_INSTANCE_PROP);\n return valid;\n }",
"public static byte[] synchronizeSlaveHostController(ModelNode operation, final PathAddress address, HostFileRepository fileRepository, ContentRepository contentRepository, boolean backup, byte[] oldHash) {\n ModelNode operationContentItem = operation.get(DeploymentAttributes.CONTENT_RESOURCE_ALL.getName()).get(0);\n byte[] newHash = operationContentItem.require(CONTENT_HASH.getName()).asBytes();\n if (needRemoteContent(fileRepository, contentRepository, backup, oldHash)) { // backup DC needs to pull the content\n fileRepository.getDeploymentFiles(ModelContentReference.fromModelAddress(address, newHash));\n }\n return newHash;\n }"
] |
Attempts to return the token from cache. If this is not possible because it is expired or was
never assigned, a new token is requested and parallel requests will block on retrieving a new
token. As such no guarantee of maximum latency is provided.
To avoid blocking the token is refreshed before it's expiration, while parallel requests
continue to use the old token. | [
"@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 }"
] | [
"private File getWorkDir() throws IOException\r\n {\r\n if (_workDir == null)\r\n { \r\n File dummy = File.createTempFile(\"dummy\", \".log\");\r\n String workDir = dummy.getPath().substring(0, dummy.getPath().lastIndexOf(File.separatorChar));\r\n \r\n if ((workDir == null) || (workDir.length() == 0))\r\n {\r\n workDir = \".\";\r\n }\r\n dummy.delete();\r\n _workDir = new File(workDir);\r\n }\r\n return _workDir;\r\n }",
"@RequestMapping(value = \"/api/backup\", method = RequestMethod.POST)\n public\n @ResponseBody\n Backup processBackup(@RequestParam(\"fileData\") MultipartFile fileData) throws Exception {\n // Method taken from: http://spring.io/guides/gs/uploading-files/\n if (!fileData.isEmpty()) {\n try {\n byte[] bytes = fileData.getBytes();\n BufferedOutputStream stream =\n new BufferedOutputStream(new FileOutputStream(new File(\"backup-uploaded.json\")));\n stream.write(bytes);\n stream.close();\n\n } catch (Exception e) {\n }\n }\n File f = new File(\"backup-uploaded.json\");\n BackupService.getInstance().restoreBackupData(new FileInputStream(f));\n return BackupService.getInstance().getBackupData();\n }",
"public void setBackgroundColor(int color) {\n setBackgroundColorR(Colors.byteToGl(Color.red(color)));\n setBackgroundColorG(Colors.byteToGl(Color.green(color)));\n setBackgroundColorB(Colors.byteToGl(Color.blue(color)));\n setBackgroundColorA(Colors.byteToGl(Color.alpha(color)));\n }",
"public static void applyToOr(ColorHolder colorHolder, TextView textView, ColorStateList colorDefault) {\n if (colorHolder != null && textView != null) {\n colorHolder.applyToOr(textView, colorDefault);\n } else if (textView != null) {\n textView.setTextColor(colorDefault);\n }\n }",
"public int sharedSegments(Triangle t2) {\n\t\tint counter = 0;\n\n\t\tif(a.equals(t2.a)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(a.equals(t2.b)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(a.equals(t2.c)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(b.equals(t2.a)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(b.equals(t2.b)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(b.equals(t2.c)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(c.equals(t2.a)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(c.equals(t2.b)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(c.equals(t2.c)) {\n\t\t\tcounter++;\n\t\t}\n\n\t\treturn counter;\n\t}",
"protected void processStart(Endpoint endpoint, EventTypeEnum eventType) {\n if (!sendLifecycleEvent) {\n return;\n }\n\n Event event = createEvent(endpoint, eventType);\n queue.add(event);\n }",
"private void getYearlyDates(Calendar calendar, List<Date> dates)\n {\n if (m_relative)\n {\n getYearlyRelativeDates(calendar, dates);\n }\n else\n {\n getYearlyAbsoluteDates(calendar, dates);\n }\n }",
"@SuppressWarnings(\"unused\")\n\t@XmlID\n @XmlAttribute(name = \"id\")\n private String getXmlID(){\n return String.format(\"%s-%s\", this.getClass().getSimpleName(), Long.valueOf(id));\n }",
"@PreDestroy\n public final void shutdown() {\n this.timer.shutdownNow();\n this.executor.shutdownNow();\n if (this.cleanUpTimer != null) {\n this.cleanUpTimer.shutdownNow();\n }\n }"
] |
This method performs database modification at the very and of transaction. | [
"private void doExecute(Connection conn) throws SQLException\r\n {\r\n PreparedStatement stmt;\r\n int size;\r\n\r\n size = _methods.size();\r\n if ( size == 0 )\r\n {\r\n return;\r\n }\r\n stmt = conn.prepareStatement(_sql);\r\n try\r\n {\r\n m_platform.afterStatementCreate(stmt);\r\n }\r\n catch ( PlatformException e )\r\n {\r\n if ( e.getCause() instanceof SQLException )\r\n {\r\n throw (SQLException)e.getCause();\r\n }\r\n else\r\n {\r\n throw new SQLException(e.getMessage());\r\n }\r\n }\r\n try\r\n {\r\n m_platform.beforeBatch(stmt);\r\n }\r\n catch ( PlatformException e )\r\n {\r\n if ( e.getCause() instanceof SQLException )\r\n {\r\n throw (SQLException)e.getCause();\r\n }\r\n else\r\n {\r\n throw new SQLException(e.getMessage());\r\n }\r\n }\r\n try\r\n {\r\n for ( int i = 0; i < size; i++ )\r\n {\r\n Method method = (Method) _methods.get(i);\r\n try\r\n {\r\n if ( method.equals(ADD_BATCH) )\r\n {\r\n /**\r\n * we invoke on the platform and pass the stmt as an arg.\r\n */\r\n m_platform.addBatch(stmt);\r\n }\r\n else\r\n {\r\n method.invoke(stmt, (Object[]) _params.get(i));\r\n }\r\n }\r\n catch (IllegalArgumentException ex)\r\n {\r\n\t\t\t\t\tStringBuffer buffer = generateExceptionMessage(i, stmt, ex);\r\n\t\t\t\t\tthrow new SQLException(buffer.toString());\r\n }\r\n catch ( IllegalAccessException ex )\r\n {\r\n\t\t\t\t\tStringBuffer buffer = generateExceptionMessage(i, stmt, ex);\r\n throw new SQLException(buffer.toString());\r\n }\r\n catch ( InvocationTargetException ex )\r\n {\r\n Throwable th = ex.getTargetException();\r\n\r\n if ( th == null )\r\n {\r\n th = ex;\r\n }\r\n if ( th instanceof SQLException )\r\n {\r\n throw ((SQLException) th);\r\n }\r\n else\r\n {\r\n throw new SQLException(th.toString());\r\n }\r\n }\r\n\t\t\t\tcatch (PlatformException e)\r\n\t\t\t\t{\r\n\t\t\t\t\tthrow new SQLException(e.toString());\r\n\t\t\t\t}\r\n }\r\n try\r\n {\r\n /**\r\n * this will call the platform specific call\r\n */\r\n m_platform.executeBatch(stmt);\r\n }\r\n catch ( PlatformException e )\r\n {\r\n if ( e.getCause() instanceof SQLException )\r\n {\r\n throw (SQLException)e.getCause();\r\n }\r\n else\r\n {\r\n throw new SQLException(e.getMessage());\r\n }\r\n }\r\n\r\n }\r\n finally\r\n {\r\n stmt.close();\r\n _methods.clear();\r\n _params.clear();\r\n }\r\n }"
] | [
"public static void compress(File dir, File zipFile) throws IOException {\n\n FileOutputStream fos = new FileOutputStream(zipFile);\n ZipOutputStream zos = new ZipOutputStream(fos);\n\n recursiveAddZip(dir, zos, dir);\n\n zos.finish();\n zos.close();\n\n }",
"public int getXForBeat(int beat) {\n BeatGrid grid = beatGrid.get();\n if (grid != null) {\n return millisecondsToX(grid.getTimeWithinTrack(beat));\n }\n return 0;\n }",
"public static Class<?> resolveTypeArgument(Class<?> clazz, Class<?> genericIfc) {\n\t\tClass<?>[] typeArgs = resolveTypeArguments(clazz, genericIfc);\n\t\tif (typeArgs == null) {\n\t\t\treturn null;\n\t\t}\n\t\tif (typeArgs.length != 1) {\n\t\t\tthrow new IllegalArgumentException(\"Expected 1 type argument on generic interface [\" +\n\t\t\t\t\tgenericIfc.getName() + \"] but found \" + typeArgs.length);\n\t\t}\n\t\treturn typeArgs[0];\n\t}",
"@Nonnull\n public static XMLDSigValidationResult createReferenceErrors (@Nonnull @Nonempty final List <Integer> aInvalidReferences)\n {\n return new XMLDSigValidationResult (aInvalidReferences);\n }",
"protected List<CRFDatum> extractDatumSequence(int[][][] allData, int beginPosition, int endPosition,\r\n List<IN> labeledWordInfos) {\r\n List<CRFDatum> result = new ArrayList<CRFDatum>();\r\n int beginContext = beginPosition - windowSize + 1;\r\n if (beginContext < 0) {\r\n beginContext = 0;\r\n }\r\n // for the beginning context, add some dummy datums with no features!\r\n // TODO: is there any better way to do this?\r\n for (int position = beginContext; position < beginPosition; position++) {\r\n List<Collection<String>> cliqueFeatures = new ArrayList<Collection<String>>();\r\n for (int i = 0; i < windowSize; i++) {\r\n // create a feature list\r\n cliqueFeatures.add(Collections.<String>emptyList());\r\n }\r\n CRFDatum<Collection<String>, String> datum = new CRFDatum<Collection<String>, String>(cliqueFeatures,\r\n labeledWordInfos.get(position).get(AnswerAnnotation.class));\r\n result.add(datum);\r\n }\r\n // now add the real datums\r\n for (int position = beginPosition; position <= endPosition; position++) {\r\n List<Collection<String>> cliqueFeatures = new ArrayList<Collection<String>>();\r\n for (int i = 0; i < windowSize; i++) {\r\n // create a feature list\r\n Collection<String> features = new ArrayList<String>();\r\n for (int j = 0; j < allData[position][i].length; j++) {\r\n features.add(featureIndex.get(allData[position][i][j]));\r\n }\r\n cliqueFeatures.add(features);\r\n }\r\n CRFDatum<Collection<String>,String> datum = new CRFDatum<Collection<String>,String>(cliqueFeatures,\r\n labeledWordInfos.get(position).get(AnswerAnnotation.class));\r\n result.add(datum);\r\n }\r\n return result;\r\n }",
"public static sslfipskey[] get(nitro_service service, String fipskeyname[]) throws Exception{\n\t\tif (fipskeyname !=null && fipskeyname.length>0) {\n\t\t\tsslfipskey response[] = new sslfipskey[fipskeyname.length];\n\t\t\tsslfipskey obj[] = new sslfipskey[fipskeyname.length];\n\t\t\tfor (int i=0;i<fipskeyname.length;i++) {\n\t\t\t\tobj[i] = new sslfipskey();\n\t\t\t\tobj[i].set_fipskeyname(fipskeyname[i]);\n\t\t\t\tresponse[i] = (sslfipskey) obj[i].get_resource(service);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t\treturn null;\n\t}",
"private void addErrorCorrection(StringBuilder adjustedString, int codewordSize, int dataBlocks, int eccBlocks) {\r\n\r\n int x, poly, startWeight;\r\n\r\n /* Split into codewords and calculate Reed-Solomon error correction codes */\r\n switch (codewordSize) {\r\n case 6:\r\n x = 32;\r\n poly = 0x43;\r\n startWeight = 0x20;\r\n break;\r\n case 8:\r\n x = 128;\r\n poly = 0x12d;\r\n startWeight = 0x80;\r\n break;\r\n case 10:\r\n x = 512;\r\n poly = 0x409;\r\n startWeight = 0x200;\r\n break;\r\n case 12:\r\n x = 2048;\r\n poly = 0x1069;\r\n startWeight = 0x800;\r\n break;\r\n default:\r\n throw new OkapiException(\"Unrecognized codeword size: \" + codewordSize);\r\n }\r\n\r\n ReedSolomon rs = new ReedSolomon();\r\n int[] data = new int[dataBlocks + 3];\r\n int[] ecc = new int[eccBlocks + 3];\r\n\r\n for (int i = 0; i < dataBlocks; i++) {\r\n for (int weight = 0; weight < codewordSize; weight++) {\r\n if (adjustedString.charAt((i * codewordSize) + weight) == '1') {\r\n data[i] += (x >> weight);\r\n }\r\n }\r\n }\r\n\r\n rs.init_gf(poly);\r\n rs.init_code(eccBlocks, 1);\r\n rs.encode(dataBlocks, data);\r\n\r\n for (int i = 0; i < eccBlocks; i++) {\r\n ecc[i] = rs.getResult(i);\r\n }\r\n\r\n for (int i = (eccBlocks - 1); i >= 0; i--) {\r\n for (int weight = startWeight; weight > 0; weight = weight >> 1) {\r\n if ((ecc[i] & weight) != 0) {\r\n adjustedString.append('1');\r\n } else {\r\n adjustedString.append('0');\r\n }\r\n }\r\n }\r\n }",
"private void writeBufferedValsToStorage() {\n List<Versioned<byte[]>> obsoleteVals = storageEngine.multiVersionPut(currBufferedKey,\n currBufferedVals);\n // log Obsolete versions in debug mode\n if(logger.isDebugEnabled() && obsoleteVals.size() > 0) {\n logger.debug(\"updateEntries (Streaming multi-version-put) rejected these versions as obsolete : \"\n + StoreUtils.getVersions(obsoleteVals) + \" for key \" + currBufferedKey);\n }\n currBufferedVals = new ArrayList<Versioned<byte[]>>(VALS_BUFFER_EXPECTED_SIZE);\n }",
"protected void updateLabelActiveStyle() {\n if (this.valueBoxBase.getText() != null && !this.valueBoxBase.getText().isEmpty()) {\n label.addStyleName(CssName.ACTIVE);\n } else {\n label.removeStyleName(CssName.ACTIVE);\n }\n }"
] |
Retrieves from all the Jenkins agents all the docker images, which have been registered for a specific build-info ID
Only images for which manifests have been captured are returned.
@param buildInfoId
@return
@throws IOException
@throws InterruptedException | [
"public static List<DockerImage> getDockerImagesFromAgents(final int buildInfoId, TaskListener listener) throws IOException, InterruptedException {\n List<DockerImage> dockerImages = new ArrayList<DockerImage>();\n\n // Collect images from the master:\n dockerImages.addAll(getAndDiscardImagesByBuildId(buildInfoId));\n\n // Collect images from all the agents:\n List<Node> nodes = Jenkins.getInstance().getNodes();\n for (Node node : nodes) {\n if (node == null || node.getChannel() == null) {\n continue;\n }\n try {\n List<DockerImage> partialDockerImages = node.getChannel().call(new MasterToSlaveCallable<List<DockerImage>, IOException>() {\n public List<DockerImage> call() throws IOException {\n List<DockerImage> dockerImages = new ArrayList<DockerImage>();\n dockerImages.addAll(getAndDiscardImagesByBuildId(buildInfoId));\n return dockerImages;\n }\n });\n dockerImages.addAll(partialDockerImages);\n } catch (Exception e) {\n listener.getLogger().println(\"Could not collect docker images from Jenkins node '\" + node.getDisplayName() + \"' due to: \" + e.getMessage());\n }\n }\n return dockerImages;\n }"
] | [
"private void onRead0() {\n assert inWire.startUse();\n\n ensureCapacity();\n\n try {\n\n while (!inWire.bytes().isEmpty()) {\n\n try (DocumentContext dc = inWire.readingDocument()) {\n if (!dc.isPresent())\n return;\n\n try {\n if (YamlLogging.showServerReads())\n logYaml(dc);\n onRead(dc, outWire);\n onWrite(outWire);\n } catch (Exception e) {\n Jvm.warn().on(getClass(), \"inWire=\" + inWire.getClass() + \",yaml=\" + Wires.fromSizePrefixedBlobs(dc), e);\n }\n }\n }\n\n } finally {\n assert inWire.endUse();\n }\n }",
"@AfterThrowing(pointcut = \"execution(* org.apache.cassandra.thrift.CassandraServer.doInsert(..))\", throwing = \"throwable\")\n public void logErrorFromThrownException(final JoinPoint joinPoint, final Throwable throwable) {\n final String className = joinPoint.getTarget().getClass().getName();\n final String methodName = joinPoint.getSignature().getName();\n\n logger.error(\"Could not write to cassandra! Method: \" + className + \".\"+ methodName + \"()\", throwable);\n }",
"public static base_response update(nitro_service client, aaaparameter resource) throws Exception {\n\t\taaaparameter updateresource = new aaaparameter();\n\t\tupdateresource.enablestaticpagecaching = resource.enablestaticpagecaching;\n\t\tupdateresource.enableenhancedauthfeedback = resource.enableenhancedauthfeedback;\n\t\tupdateresource.defaultauthtype = resource.defaultauthtype;\n\t\tupdateresource.maxaaausers = resource.maxaaausers;\n\t\tupdateresource.maxloginattempts = resource.maxloginattempts;\n\t\tupdateresource.failedlogintimeout = resource.failedlogintimeout;\n\t\tupdateresource.aaadnatip = resource.aaadnatip;\n\t\treturn updateresource.update_resource(client);\n\t}",
"private T getWrappedPublisher(Publisher flexiblePublisher, Class<T> type) {\n if (!(flexiblePublisher instanceof FlexiblePublisher)) {\n throw new IllegalArgumentException(String.format(\"Publisher should be of type: '%s'. Found type: '%s'\",\n FlexiblePublisher.class, flexiblePublisher.getClass()));\n }\n\n List<ConditionalPublisher> conditions = ((FlexiblePublisher) flexiblePublisher).getPublishers();\n for (ConditionalPublisher condition : conditions) {\n if (type.isInstance(condition.getPublisher())) {\n return type.cast(condition.getPublisher());\n }\n }\n\n return null;\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 }",
"BsonDocument getNextVersion() {\n if (!this.hasVersion() || this.getVersionDoc() == null) {\n return getFreshVersionDocument();\n }\n final BsonDocument nextVersion = BsonUtils.copyOfDocument(this.getVersionDoc());\n nextVersion.put(\n Fields.VERSION_COUNTER_FIELD,\n new BsonInt64(this.getVersion().getVersionCounter() + 1));\n return nextVersion;\n }",
"public String createTorqueSchema(Properties attributes) throws XDocletException\r\n {\r\n String dbName = (String)getDocletContext().getConfigParam(CONFIG_PARAM_DATABASENAME);\r\n\r\n _torqueModel = new TorqueModelDef(dbName, _model);\r\n return \"\";\r\n }",
"private void deliverLostAnnouncement(final DeviceAnnouncement announcement) {\n for (final DeviceAnnouncementListener listener : getDeviceAnnouncementListeners()) {\n SwingUtilities.invokeLater(new Runnable() {\n @Override\n public void run() {\n try {\n listener.deviceLost(announcement);\n } catch (Throwable t) {\n logger.warn(\"Problem delivering device lost announcement to listener\", t);\n }\n }\n });\n }\n }",
"public void set( int row , int col , double value ) {\n ops.set(mat, row, col, value);\n }"
] |
for bpm connector | [
"public static STSClient createSTSX509Client(Bus bus, Map<String, String> stsProps) {\r\n final STSClient stsClient = createClient(bus, stsProps);\r\n\r\n stsClient.setWsdlLocation(stsProps.get(STS_X509_WSDL_LOCATION));\r\n stsClient.setEndpointQName(new QName(stsProps.get(STS_NAMESPACE), stsProps.get(STS_X509_ENDPOINT_NAME)));\r\n\r\n return stsClient;\r\n }"
] | [
"private List<AssignmentField> getAllAssignmentExtendedAttributes()\n {\n ArrayList<AssignmentField> result = new ArrayList<AssignmentField>();\n result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_COST));\n result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_DATE));\n result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_DURATION));\n result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_COST));\n result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_DATE));\n result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_DURATION));\n result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_FLAG));\n result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_NUMBER));\n result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_RESOURCE_MULTI_VALUE));\n result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_RESOURCE_OUTLINE_CODE));\n result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_TEXT));\n result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_FINISH));\n result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_FLAG));\n result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_NUMBER));\n result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_START));\n result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_TEXT));\n return result;\n }",
"protected TextBox createTextBox(BlockBox contblock, Text n)\n {\n TextBox text = new TextBox(n, (Graphics2D) contblock.getGraphics().create(), contblock.getVisualContext().create());\n text.setOrder(next_order++);\n text.setContainingBlockBox(contblock);\n text.setClipBlock(contblock);\n text.setViewport(viewport);\n text.setBase(baseurl);\n return text;\n }",
"public static void redeployDeployments(OperationContext context, PathAddress deploymentsRootAddress, Set<String> deploymentNames) throws OperationFailedException {\n for (String deploymentName : deploymentNames) {\n PathAddress address = deploymentsRootAddress.append(DEPLOYMENT, deploymentName);\n OperationStepHandler handler = context.getRootResourceRegistration().getOperationHandler(address, REDEPLOY);\n ModelNode operation = addRedeployStep(address);\n ServerLogger.AS_ROOT_LOGGER.debugf(\"Redeploying %s at address %s with handler %s\", deploymentName, address, handler);\n assert handler != null;\n assert operation.isDefined();\n context.addStep(operation, handler, OperationContext.Stage.MODEL);\n }\n }",
"public static Duration add(Duration a, Duration b, ProjectProperties defaults)\n {\n if (a == null && b == null)\n {\n return null;\n }\n if (a == null)\n {\n return b;\n }\n if (b == null)\n {\n return a;\n }\n TimeUnit unit = a.getUnits();\n if (b.getUnits() != unit)\n {\n b = b.convertUnits(unit, defaults);\n }\n\n return Duration.getInstance(a.getDuration() + b.getDuration(), unit);\n }",
"ArgumentsBuilder param(String param, Integer value) {\n if (value != null) {\n args.add(param);\n args.add(value.toString());\n }\n return this;\n }",
"private String getParentOutlineNumber(String outlineNumber)\n {\n String result;\n int index = outlineNumber.lastIndexOf('.');\n if (index == -1)\n {\n result = \"\";\n }\n else\n {\n result = outlineNumber.substring(0, index);\n }\n return result;\n }",
"public static String checkRequiredProperties(Properties props,\r\n String ... requiredProps) {\r\n for (String required : requiredProps) {\r\n if (props.getProperty(required) == null) {\r\n return required;\r\n }\r\n }\r\n return null;\r\n }",
"private PGPSecretKey getSecretKey(InputStream input, String keyId) throws IOException, PGPException {\n PGPSecretKeyRingCollection keyrings = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(input), new JcaKeyFingerprintCalculator());\n\n Iterator rIt = keyrings.getKeyRings();\n\n while (rIt.hasNext()) {\n PGPSecretKeyRing kRing = (PGPSecretKeyRing) rIt.next();\n Iterator kIt = kRing.getSecretKeys();\n\n while (kIt.hasNext()) {\n PGPSecretKey key = (PGPSecretKey) kIt.next();\n\n if (key.isSigningKey() && String.format(\"%08x\", key.getKeyID() & 0xFFFFFFFFL).equals(keyId.toLowerCase())) {\n return key;\n }\n }\n }\n\n return null;\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 }"
] |
Helper for parsing properties
@param p The properties object
@param key The key to retrieve
@param defaultValue The default value if the key does not exist
@param used The set of keys we have seen
@return The value of the property at the key | [
"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 }"
] | [
"private boolean operations(Options opt, ConstructorDoc m[]) {\n\tboolean printed = false;\n\tfor (ConstructorDoc cd : m) {\n\t if (hidden(cd))\n\t\tcontinue;\n\t stereotype(opt, cd, Align.LEFT);\n\t String cs = visibility(opt, cd) + cd.name() //\n\t\t + (opt.showType ? \"(\" + parameter(opt, cd.parameters()) + \")\" : \"()\");\n\t tableLine(Align.LEFT, cs);\n\t tagvalue(opt, cd);\n\t printed = true;\n\t}\n\treturn printed;\n }",
"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 }",
"public boolean remove(long key) {\n int index = ((((int) (key >>> 32)) ^ ((int) (key))) & 0x7fffffff) % capacity;\n Entry previous = null;\n Entry entry = table[index];\n while (entry != null) {\n Entry next = entry.next;\n if (entry.key == key) {\n if (previous == null) {\n table[index] = next;\n } else {\n previous.next = next;\n }\n size--;\n return true;\n }\n previous = entry;\n entry = next;\n }\n return false;\n }",
"public void add(String photoId) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_ADD);\r\n parameters.put(\"photo_id\", photoId);\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 }",
"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 static sslcipher_individualcipher_binding[] get(nitro_service service, String ciphergroupname) throws Exception{\n\t\tsslcipher_individualcipher_binding obj = new sslcipher_individualcipher_binding();\n\t\tobj.set_ciphergroupname(ciphergroupname);\n\t\tsslcipher_individualcipher_binding response[] = (sslcipher_individualcipher_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"@Api\n\tpublic void setUseCache(boolean useCache) {\n\t\tif (null == cacheManagerService && useCache) {\n\t\t\tlog.warn(\"The caching plugin needs to be available to cache WMS requests. Not setting useCache.\");\n\t\t} else {\n\t\t\tthis.useCache = useCache;\n\t\t}\n\t}",
"@SuppressWarnings(\"unchecked\")\n public <V3, M4, C, N, Q> N getSceneRoot(AiWrapperProvider<V3, M4, C, N, Q> \n wrapperProvider) {\n\n return (N) m_sceneRoot;\n }",
"public String genId() {\n S.Buffer sb = S.newBuffer();\n sb.a(longEncoder.longToStr(nodeIdProvider.nodeId()))\n .a(longEncoder.longToStr(startIdProvider.startId()))\n .a(longEncoder.longToStr(sequenceProvider.seqId()));\n return sb.toString();\n }"
] |
Saves the messages for all languages that were opened in the editor.
@throws CmsException thrown if saving fails. | [
"public void save() throws CmsException {\n\n if (hasChanges()) {\n switch (m_bundleType) {\n case PROPERTY:\n saveLocalization();\n saveToPropertyVfsBundle();\n break;\n\n case XML:\n saveLocalization();\n saveToXmlVfsBundle();\n\n break;\n\n case DESCRIPTOR:\n break;\n default:\n throw new IllegalArgumentException();\n }\n if (null != m_descFile) {\n saveToBundleDescriptor();\n }\n\n resetChanges();\n }\n\n }"
] | [
"public static base_response add(nitro_service client, nsacl6 resource) throws Exception {\n\t\tnsacl6 addresource = new nsacl6();\n\t\taddresource.acl6name = resource.acl6name;\n\t\taddresource.acl6action = resource.acl6action;\n\t\taddresource.td = resource.td;\n\t\taddresource.srcipv6 = resource.srcipv6;\n\t\taddresource.srcipop = resource.srcipop;\n\t\taddresource.srcipv6val = resource.srcipv6val;\n\t\taddresource.srcport = resource.srcport;\n\t\taddresource.srcportop = resource.srcportop;\n\t\taddresource.srcportval = resource.srcportval;\n\t\taddresource.destipv6 = resource.destipv6;\n\t\taddresource.destipop = resource.destipop;\n\t\taddresource.destipv6val = resource.destipv6val;\n\t\taddresource.destport = resource.destport;\n\t\taddresource.destportop = resource.destportop;\n\t\taddresource.destportval = resource.destportval;\n\t\taddresource.ttl = resource.ttl;\n\t\taddresource.srcmac = resource.srcmac;\n\t\taddresource.protocol = resource.protocol;\n\t\taddresource.protocolnumber = resource.protocolnumber;\n\t\taddresource.vlan = resource.vlan;\n\t\taddresource.Interface = resource.Interface;\n\t\taddresource.established = resource.established;\n\t\taddresource.icmptype = resource.icmptype;\n\t\taddresource.icmpcode = resource.icmpcode;\n\t\taddresource.priority = resource.priority;\n\t\taddresource.state = resource.state;\n\t\treturn addresource.add_resource(client);\n\t}",
"public static lbvserver_rewritepolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tlbvserver_rewritepolicy_binding obj = new lbvserver_rewritepolicy_binding();\n\t\tobj.set_name(name);\n\t\tlbvserver_rewritepolicy_binding response[] = (lbvserver_rewritepolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"public static inat get(nitro_service service, String name) throws Exception{\n\t\tinat obj = new inat();\n\t\tobj.set_name(name);\n\t\tinat response = (inat) obj.get_resource(service);\n\t\treturn response;\n\t}",
"public void processAnonymousField(Properties attributes) throws XDocletException\r\n {\r\n if (!attributes.containsKey(ATTRIBUTE_NAME))\r\n {\r\n throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class,\r\n XDocletModulesOjbMessages.PARAMETER_IS_REQUIRED,\r\n new String[]{ATTRIBUTE_NAME}));\r\n }\r\n\r\n String name = attributes.getProperty(ATTRIBUTE_NAME);\r\n FieldDescriptorDef fieldDef = _curClassDef.getField(name);\r\n String attrName;\r\n\r\n if (fieldDef == null)\r\n {\r\n fieldDef = new FieldDescriptorDef(name);\r\n _curClassDef.addField(fieldDef);\r\n }\r\n fieldDef.setAnonymous();\r\n LogHelper.debug(false, OjbTagsHandler.class, \"processAnonymousField\", \" Processing anonymous field \"+fieldDef.getName());\r\n\r\n attributes.remove(ATTRIBUTE_NAME);\r\n for (Enumeration attrNames = attributes.propertyNames(); attrNames.hasMoreElements(); )\r\n {\r\n attrName = (String)attrNames.nextElement();\r\n fieldDef.setProperty(attrName, attributes.getProperty(attrName));\r\n }\r\n fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_ACCESS, \"anonymous\");\r\n }",
"private void changeClusterAndStores(String clusterKey,\n final Cluster cluster,\n String storesKey,\n final List<StoreDefinition> storeDefs) {\n metadataStore.writeLock.lock();\n try {\n VectorClock updatedVectorClock = ((VectorClock) metadataStore.get(clusterKey, null)\n .get(0)\n .getVersion()).incremented(metadataStore.getNodeId(),\n System.currentTimeMillis());\n metadataStore.put(clusterKey, Versioned.value((Object) cluster, updatedVectorClock));\n\n // now put new stores\n updatedVectorClock = ((VectorClock) metadataStore.get(storesKey, null)\n .get(0)\n .getVersion()).incremented(metadataStore.getNodeId(),\n System.currentTimeMillis());\n metadataStore.put(storesKey, Versioned.value((Object) storeDefs, updatedVectorClock));\n\n } catch(Exception e) {\n logger.info(\"Error while changing cluster to \" + cluster + \"for key \" + clusterKey);\n throw new VoldemortException(e);\n } finally {\n metadataStore.writeLock.unlock();\n }\n }",
"public void setProductModules(final String name, final List<String> moduleNames) {\n final DbProduct dbProduct = getProduct(name);\n dbProduct.setModules(moduleNames);\n repositoryHandler.store(dbProduct);\n }",
"public static RequiredConfigurationHolder populateHostResolutionContext(final HostInfo hostInfo, final Resource root, final ExtensionRegistry extensionRegistry) {\n final RequiredConfigurationHolder rc = new RequiredConfigurationHolder();\n for (IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo info : hostInfo.getServerConfigInfos()) {\n processServerConfig(root, rc, info, extensionRegistry);\n }\n return rc;\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 static IndexedTypeSet toRootEntities(ExtendedSearchIntegrator extendedIntegrator, Class<?>... selection) {\n\t\tSet<Class<?>> entities = new HashSet<Class<?>>();\n\t\t//first build the \"entities\" set containing all indexed subtypes of \"selection\".\n\t\tfor ( Class<?> entityType : selection ) {\n\t\t\tIndexedTypeSet targetedClasses = extendedIntegrator.getIndexedTypesPolymorphic( IndexedTypeSets.fromClass( entityType ) );\n\t\t\tif ( targetedClasses.isEmpty() ) {\n\t\t\t\tString msg = entityType.getName() + \" is not an indexed entity or a subclass of an indexed entity\";\n\t\t\t\tthrow new IllegalArgumentException( msg );\n\t\t\t}\n\t\t\tentities.addAll( targetedClasses.toPojosSet() );\n\t\t}\n\t\tSet<Class<?>> cleaned = new HashSet<Class<?>>();\n\t\tSet<Class<?>> toRemove = new HashSet<Class<?>>();\n\t\t//now remove all repeated types to avoid duplicate loading by polymorphic query loading\n\t\tfor ( Class<?> type : entities ) {\n\t\t\tboolean typeIsOk = true;\n\t\t\tfor ( Class<?> existing : cleaned ) {\n\t\t\t\tif ( existing.isAssignableFrom( type ) ) {\n\t\t\t\t\ttypeIsOk = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif ( type.isAssignableFrom( existing ) ) {\n\t\t\t\t\ttoRemove.add( existing );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( typeIsOk ) {\n\t\t\t\tcleaned.add( type );\n\t\t\t}\n\t\t}\n\t\tcleaned.removeAll( toRemove );\n\t\tlog.debugf( \"Targets for indexing job: %s\", cleaned );\n\t\treturn IndexedTypeSets.fromClasses( cleaned.toArray( new Class[cleaned.size()] ) );\n\t}"
] |
Returns information for a specific client
@param model
@param profileIdentifier
@param clientUUID
@return
@throws Exception | [
"@RequestMapping(value = \"/api/profile/{profileIdentifier}/clients/{clientUUID}\", method = RequestMethod.GET)\n public\n @ResponseBody\n HashMap<String, Object> getClient(Model model,\n @PathVariable(\"profileIdentifier\") String profileIdentifier,\n @PathVariable(\"clientUUID\") String clientUUID) throws Exception {\n Integer profileId = ControllerUtils.convertProfileIdentifier(profileIdentifier);\n HashMap<String, Object> valueHash = new HashMap<String, Object>();\n valueHash.put(\"client\", clientService.findClient(clientUUID, profileId));\n return valueHash;\n }"
] | [
"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}",
"List<W3CEndpointReference> lookupEndpoints(QName serviceName,\n MatcherDataType matcherData) throws ServiceLocatorFault,\n InterruptedExceptionFault {\n SLPropertiesMatcher matcher = createMatcher(matcherData);\n List<String> names = null;\n List<W3CEndpointReference> result = new ArrayList<W3CEndpointReference>();\n String adress;\n try {\n initLocator();\n if (matcher == null) {\n names = locatorClient.lookup(serviceName);\n } else {\n names = locatorClient.lookup(serviceName, matcher);\n }\n } catch (ServiceLocatorException e) {\n ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail();\n serviceFaultDetail.setLocatorFaultDetail(serviceName.toString()\n + \"throws ServiceLocatorFault\");\n throw new ServiceLocatorFault(e.getMessage(), serviceFaultDetail);\n } catch (InterruptedException e) {\n InterruptionFaultDetail interruptionFaultDetail = new InterruptionFaultDetail();\n interruptionFaultDetail.setInterruptionDetail(serviceName\n .toString() + \"throws InterruptionFault\");\n throw new InterruptedExceptionFault(e.getMessage(),\n interruptionFaultDetail);\n }\n if (names != null && !names.isEmpty()) {\n for (int i = 0; i < names.size(); i++) {\n adress = names.get(i);\n result.add(buildEndpoint(serviceName, adress));\n }\n } else {\n if (LOG.isLoggable(Level.WARNING)) {\n LOG.log(Level.WARNING, \"lookup Endpoints for \" + serviceName\n + \" failed, service is not known.\");\n }\n ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail();\n serviceFaultDetail.setLocatorFaultDetail(\"lookup Endpoint for \"\n + serviceName + \" failed, service is not known.\");\n throw new ServiceLocatorFault(\"Can not find Endpoint\",\n serviceFaultDetail);\n }\n return result;\n }",
"public static int compare(Integer n1, Integer n2)\n {\n int result;\n if (n1 == null || n2 == null)\n {\n result = (n1 == null && n2 == null ? 0 : (n1 == null ? 1 : -1));\n }\n else\n {\n result = n1.compareTo(n2);\n }\n return (result);\n }",
"@RequestMapping(value = \"/api/scripts\", method = RequestMethod.POST)\n public\n @ResponseBody\n Script addScript(Model model,\n @RequestParam(required = true) String name,\n @RequestParam(required = true) String script) throws Exception {\n\n return ScriptService.getInstance().addScript(name, script);\n }",
"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 }",
"public String putProperty(String key,\n String value) {\n return this.getProperties().put(key,\n value);\n }",
"public List<String> getArtifactVersions(final String gavc) {\n final DbArtifact artifact = getArtifact(gavc);\n return repositoryHandler.getArtifactVersions(artifact);\n }",
"public static base_response add(nitro_service client, systemuser resource) throws Exception {\n\t\tsystemuser addresource = new systemuser();\n\t\taddresource.username = resource.username;\n\t\taddresource.password = resource.password;\n\t\taddresource.externalauth = resource.externalauth;\n\t\taddresource.promptstring = resource.promptstring;\n\t\taddresource.timeout = resource.timeout;\n\t\treturn addresource.add_resource(client);\n\t}",
"public static Priority getInstance(Locale locale, String priority)\n {\n int index = DEFAULT_PRIORITY_INDEX;\n\n if (priority != null)\n {\n String[] priorityTypes = LocaleData.getStringArray(locale, LocaleData.PRIORITY_TYPES);\n for (int loop = 0; loop < priorityTypes.length; loop++)\n {\n if (priorityTypes[loop].equalsIgnoreCase(priority) == true)\n {\n index = loop;\n break;\n }\n }\n }\n\n return (Priority.getInstance((index + 1) * 100));\n }"
] |
Process the response by reporting proper log and feeding failure
detectors
@param response
@param pipeline | [
"private void processResponse(Response<ByteArray, Object> response, Pipeline pipeline) {\n if(response == null) {\n logger.warn(\"RoutingTimedout on waiting for async ops; parallelResponseToWait: \"\n + numNodesPendingResponse + \"; preferred-1: \" + (preferred - 1)\n + \"; quorumOK: \" + quorumSatisfied + \"; zoneOK: \" + zonesSatisfied);\n } else {\n numNodesPendingResponse = numNodesPendingResponse - 1;\n numResponsesGot = numResponsesGot + 1;\n if(response.getValue() instanceof Exception\n && !(response.getValue() instanceof ObsoleteVersionException)) {\n if(logger.isDebugEnabled()) {\n logger.debug(\"PUT {key:\" + key + \"} handling async put error\");\n }\n if(response.getValue() instanceof QuotaExceededException) {\n /**\n * TODO Not sure if we need to count this Exception for\n * stats or silently ignore and just log a warning. While\n * QuotaExceededException thrown from other places mean the\n * operation failed, this one does not fail the operation\n * but instead stores slops. Introduce a new Exception in\n * client side to just monitor how mamy Async writes fail on\n * exceeding Quota?\n * \n */\n if(logger.isDebugEnabled()) {\n logger.debug(\"Received quota exceeded exception after a successful \"\n + pipeline.getOperation().getSimpleName() + \" call on node \"\n + response.getNode().getId() + \", store '\"\n + pipelineData.getStoreName() + \"', master-node '\"\n + pipelineData.getMaster().getId() + \"'\");\n }\n } else if(handleResponseError(response, pipeline, failureDetector)) {\n if(logger.isDebugEnabled()) {\n logger.debug(\"PUT {key:\" + key\n + \"} severe async put error, exiting parallel put stage\");\n }\n\n return;\n }\n if(PipelineRoutedStore.isSlopableFailure(response.getValue())\n || response.getValue() instanceof QuotaExceededException) {\n /**\n * We want to slop ParallelPuts which fail due to\n * QuotaExceededException.\n * \n * TODO Though this is not the right way of doing things, in\n * order to avoid inconsistencies and data loss, we chose to\n * slop the quota failed parallel puts.\n * \n * As a long term solution - 1) either Quota management\n * should be hidden completely in a routing layer like\n * Coordinator or 2) the Server should be able to\n * distinguish between serial and parallel puts and should\n * only quota for serial puts\n * \n */\n pipelineData.getSynchronizer().tryDelegateSlop(response.getNode());\n }\n\n if(logger.isDebugEnabled()) {\n logger.debug(\"PUT {key:\" + key + \"} handled async put error\");\n }\n\n } else {\n pipelineData.incrementSuccesses();\n failureDetector.recordSuccess(response.getNode(), response.getRequestTime());\n pipelineData.getZoneResponses().add(response.getNode().getZoneId());\n }\n }\n }"
] | [
"public String getUrl(){\n\t\tfinal StringBuilder sb = new StringBuilder();\n\t\tsb.append(\"http://\");\n\t\tsb.append(getHttpConfiguration().getBindHost().get());\n\t\tsb.append(\":\");\n\t\tsb.append(getHttpConfiguration().getPort());\n\t\t\n\t\treturn sb.toString();\n\t}",
"public Info changeMessage(String newMessage) {\n Info newInfo = new Info();\n newInfo.setMessage(newMessage);\n\n URL url = COMMENT_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, \"PUT\");\n request.setBody(newInfo.getPendingChanges());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject jsonResponse = JsonObject.readFrom(response.getJSON());\n\n return new Info(jsonResponse);\n }",
"boolean callbackUnregistered(final TransactionalProtocolClient old, final boolean shuttingDown) {\n // Disconnect the remote connection.\n // WFCORE-196 Do this out of the sync block to avoid deadlocks where in-flight requests can't\n // be informed that the channel has closed\n protocolClient.disconnected(old);\n\n synchronized (this) {\n // If the connection dropped without us stopping the process ask for reconnection\n if (!shuttingDown && requiredState == InternalState.SERVER_STARTED) {\n final InternalState state = internalState;\n if (state == InternalState.PROCESS_STOPPED\n || state == InternalState.PROCESS_STOPPING\n || state == InternalState.STOPPED) {\n // In case it stopped we don't reconnect\n return true;\n }\n // In case we are reloading, it will reconnect automatically\n if (state == InternalState.RELOADING) {\n return true;\n }\n try {\n ROOT_LOGGER.logf(DEBUG_LEVEL, \"trying to reconnect to %s current-state (%s) required-state (%s)\", serverName, state, requiredState);\n internalSetState(new ReconnectTask(), state, InternalState.SEND_STDIN);\n } catch (Exception e) {\n ROOT_LOGGER.logf(DEBUG_LEVEL, e, \"failed to send reconnect task\");\n }\n return false;\n } else {\n return true;\n }\n }\n }",
"public String getCmdLineArg() {\n StringBuilder builder = new StringBuilder(\" --server-groups=\");\n boolean foundSelected = false;\n for (JCheckBox serverGroup : serverGroups) {\n if (serverGroup.isSelected()) {\n foundSelected = true;\n builder.append(serverGroup.getText());\n builder.append(\",\");\n }\n }\n builder.deleteCharAt(builder.length() - 1); // remove trailing comma\n\n if (!foundSelected) return \"\";\n return builder.toString();\n }",
"private void readFieldAlias(Project.ExtendedAttributes.ExtendedAttribute attribute)\n {\n String alias = attribute.getAlias();\n if (alias != null && alias.length() != 0)\n {\n FieldType field = FieldTypeHelper.getInstance(Integer.parseInt(attribute.getFieldID()));\n m_projectFile.getCustomFields().getCustomField(field).setAlias(attribute.getAlias());\n }\n }",
"public static Session getSession(final ServerSetup setup, Properties mailProps) {\r\n Properties props = setup.configureJavaMailSessionProperties(mailProps, false);\r\n\r\n log.debug(\"Mail session properties are {}\", props);\r\n\r\n return Session.getInstance(props, null);\r\n }",
"public static Value.Builder makeValue(Value value1, Value value2, Value... rest) {\n ArrayValue.Builder arrayValue = ArrayValue.newBuilder();\n arrayValue.addValues(value1);\n arrayValue.addValues(value2);\n arrayValue.addAllValues(Arrays.asList(rest));\n return Value.newBuilder().setArrayValue(arrayValue);\n }",
"@JsonProperty(\"labels\")\n @JsonInclude(Include.NON_EMPTY)\n public Map<String, TermImpl> getLabelUpdates() {\n \treturn getMonolingualUpdatedValues(newLabels);\n }",
"private void startInvertedColors() {\n if (managerFeatures.getInvertedColors().isInverted()) {\n managerFeatures.getInvertedColors().turnOff(mGvrContext.getMainScene());\n } else {\n managerFeatures.getInvertedColors().turnOn(mGvrContext.getMainScene());\n }\n }"
] |
Before closing the PersistenceBroker ensure that the session
cache is cleared | [
"public void beforeClose(PBStateEvent event)\r\n {\r\n /*\r\n arminw:\r\n this is a workaround for use in managed environments. When a PB instance is used\r\n within a container a PB.close call is done when leave the container method. This close\r\n the PB handle (but the real instance is still in use) and the PB listener are notified.\r\n But the JTA tx was not committed at\r\n this point in time and the session cache should not be cleared, because the updated/new\r\n objects will be pushed to the real cache on commit call (if we clear, nothing to push).\r\n So we check if the real broker is in a local tx (in this case we are in a JTA tx and the handle\r\n is closed), if true we don't reset the session cache.\r\n */\r\n if(!broker.isInTransaction())\r\n {\r\n if(log.isDebugEnabled()) log.debug(\"Clearing the session cache\");\r\n resetSessionCache();\r\n }\r\n }"
] | [
"@Override\n public void process() {\n if (client.isDone() || executorService.isTerminated()) {\n throw new IllegalStateException(\"Client is already stopped\");\n }\n Runnable runner = new Runnable() {\n @Override\n public void run() {\n try {\n while (!client.isDone()) {\n String msg = messageQueue.take();\n try {\n parseMessage(msg);\n } catch (Exception e) {\n logger.warn(\"Exception thrown during parsing msg \" + msg, e);\n onException(e);\n }\n }\n } catch (Exception e) {\n onException(e);\n }\n }\n };\n\n executorService.execute(runner);\n }",
"protected static String ConvertBinaryOperator(int oper)\r\n {\r\n // Convert the operator into the proper string\r\n String oper_string;\r\n switch (oper)\r\n {\r\n default:\r\n case EQUAL:\r\n oper_string = \"=\";\r\n break;\r\n case LIKE:\r\n oper_string = \"LIKE\";\r\n break;\r\n case NOT_EQUAL:\r\n oper_string = \"!=\";\r\n break;\r\n case LESS_THAN:\r\n oper_string = \"<\";\r\n break;\r\n case GREATER_THAN:\r\n oper_string = \">\";\r\n break;\r\n case GREATER_EQUAL:\r\n oper_string = \">=\";\r\n break;\r\n case LESS_EQUAL:\r\n oper_string = \"<=\";\r\n break;\r\n }\r\n return oper_string;\r\n }",
"private void writeAssignments()\n {\n Allocations allocations = m_factory.createAllocations();\n m_plannerProject.setAllocations(allocations);\n\n List<Allocation> allocationList = allocations.getAllocation();\n for (ResourceAssignment mpxjAssignment : m_projectFile.getResourceAssignments())\n {\n Allocation plannerAllocation = m_factory.createAllocation();\n allocationList.add(plannerAllocation);\n\n plannerAllocation.setTaskId(getIntegerString(mpxjAssignment.getTask().getUniqueID()));\n plannerAllocation.setResourceId(getIntegerString(mpxjAssignment.getResourceUniqueID()));\n plannerAllocation.setUnits(getIntegerString(mpxjAssignment.getUnits()));\n\n m_eventManager.fireAssignmentWrittenEvent(mpxjAssignment);\n }\n }",
"private Duration getDuration(String value)\n {\n Duration result = null;\n\n if (value != null && value.length() != 0)\n {\n double seconds = getLong(value);\n double hours = seconds / (60 * 60);\n double days = hours / 8;\n\n if (days < 1)\n {\n result = Duration.getInstance(hours, TimeUnit.HOURS);\n }\n else\n {\n double durationDays = hours / 8;\n result = Duration.getInstance(durationDays, TimeUnit.DAYS);\n }\n }\n\n return (result);\n }",
"private void writeAssignmentTimephasedData(ResourceAssignment mpx, Project.Assignments.Assignment xml)\n {\n if (m_writeTimphasedData && mpx.getHasTimephasedData())\n {\n List<TimephasedDataType> list = xml.getTimephasedData();\n ProjectCalendar calendar = mpx.getCalendar();\n BigInteger assignmentID = xml.getUID();\n\n List<TimephasedWork> complete = mpx.getTimephasedActualWork();\n List<TimephasedWork> planned = mpx.getTimephasedWork();\n\n if (m_splitTimephasedAsDays)\n {\n TimephasedWork lastComplete = null;\n if (complete != null && !complete.isEmpty())\n {\n lastComplete = complete.get(complete.size() - 1);\n }\n\n TimephasedWork firstPlanned = null;\n if (planned != null && !planned.isEmpty())\n {\n firstPlanned = planned.get(0);\n }\n\n if (planned != null)\n {\n planned = splitDays(calendar, mpx.getTimephasedWork(), null, lastComplete);\n }\n\n if (complete != null)\n {\n complete = splitDays(calendar, complete, firstPlanned, null);\n }\n }\n\n if (planned != null)\n {\n writeAssignmentTimephasedData(assignmentID, list, planned, 1);\n }\n\n if (complete != null)\n {\n writeAssignmentTimephasedData(assignmentID, list, complete, 2);\n }\n }\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}",
"private static Map<Integer, LinkedList<MetadataCache>> gatherCandidateAttachmentGroups() {\n Map<Integer,LinkedList<MetadataCache>> candidateGroups = new TreeMap<Integer, LinkedList<MetadataCache>>();\n final Iterator<File> iterator = MetadataFinder.getInstance().getAutoAttachCacheFiles().iterator();\n while (iterator.hasNext()) {\n final File file = iterator.next();\n try {\n final MetadataCache candidate = new MetadataCache(file);\n if (candidateGroups.get(candidate.sourcePlaylist) == null) {\n candidateGroups.put(candidate.sourcePlaylist, new LinkedList<MetadataCache>());\n }\n candidateGroups.get(candidate.sourcePlaylist).add(candidate);\n } catch (Exception e) {\n logger.error(\"Unable to open metadata cache file \" + file + \", discarding\", e);\n iterator.remove();\n }\n }\n return candidateGroups;\n }",
"private void setPropertyFilters(String filters) {\n\t\tthis.filterProperties = new HashSet<>();\n\t\tif (!\"-\".equals(filters)) {\n\t\t\tfor (String pid : filters.split(\",\")) {\n\t\t\t\tthis.filterProperties.add(Datamodel\n\t\t\t\t\t\t.makeWikidataPropertyIdValue(pid));\n\t\t\t}\n\t\t}\n\t}",
"public void useNewSOAPServiceWithOldClient() throws Exception {\n \n URL wsdlURL = getClass().getResource(\"/CustomerServiceNew.wsdl\");\n com.example.customerservice.CustomerServiceService service = \n new com.example.customerservice.CustomerServiceService(wsdlURL);\n \n com.example.customerservice.CustomerService customerService = \n service.getCustomerServicePort();\n\n // The outgoing new Customer data needs to be transformed for \n // the old service to understand it and the response from the old service\n // needs to be transformed for this new client to understand it.\n Client client = ClientProxy.getClient(customerService);\n addTransformInterceptors(client.getInInterceptors(),\n client.getOutInterceptors(),\n false);\n \n System.out.println(\"Using new SOAP CustomerService with old client\");\n \n customer.v1.Customer customer = createOldCustomer(\"Barry Old to New SOAP\");\n customerService.updateCustomer(customer);\n customer = customerService.getCustomerByName(\"Barry Old to New SOAP\");\n printOldCustomerDetails(customer);\n }"
] |
If the given result is not cudnnStatus.CUDNN_STATUS_SUCCESS
and exceptions have been enabled, this method will throw a
CudaException with an error message that corresponds to the
given result code. Otherwise, the given result is simply
returned.
@param result The result to check
@return The result that was given as the parameter
@throws CudaException If exceptions have been enabled and
the given result code is not cudnnStatus.CUDNN_STATUS_SUCCESS | [
"private static int checkResult(int result)\n {\n if (exceptionsEnabled && result !=\n cudnnStatus.CUDNN_STATUS_SUCCESS)\n {\n throw new CudaException(cudnnStatus.stringFor(result));\n }\n return result;\n }"
] | [
"@Deprecated\n\tpublic void setResolutions(List<Double> resolutions) {\n\t\tgetZoomLevels().clear();\n\t\tfor (Double resolution : resolutions) {\n\t\t\tgetZoomLevels().add(new ScaleInfo(1. / resolution));\n\t\t}\n\t}",
"private void setHeaderList(Map<String, List<String>> headers, String name, String value) {\n\n List<String> values = new ArrayList<String>();\n values.add(SET_HEADER + value);\n headers.put(name, values);\n }",
"public static locationfile get(nitro_service service) throws Exception{\n\t\tlocationfile obj = new locationfile();\n\t\tlocationfile[] response = (locationfile[])obj.get_resources(service);\n\t\treturn response[0];\n\t}",
"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}",
"private void processResourceAssignment(Task task, MapRow row)\n {\n Resource resource = m_resourceMap.get(row.getUUID(\"RESOURCE_UUID\"));\n task.addResourceAssignment(resource);\n }",
"public QueryBuilder<T, ID> groupBy(String columnName) {\n\t\tFieldType fieldType = verifyColumnName(columnName);\n\t\tif (fieldType.isForeignCollection()) {\n\t\t\tthrow new IllegalArgumentException(\"Can't groupBy foreign collection field: \" + columnName);\n\t\t}\n\t\taddGroupBy(ColumnNameOrRawSql.withColumnName(columnName));\n\t\treturn this;\n\t}",
"public void beforeBatch(PreparedStatement stmt) throws PlatformException\r\n {\r\n // Check for Oracle batching support\r\n final Method methodSetExecuteBatch;\r\n final Method methodSendBatch;\r\n methodSetExecuteBatch = ClassHelper.getMethod(stmt, \"setExecuteBatch\", PARAM_TYPE_INTEGER);\r\n methodSendBatch = ClassHelper.getMethod(stmt, \"sendBatch\", null);\r\n\r\n final boolean statementBatchingSupported = methodSetExecuteBatch != null && methodSendBatch != null;\r\n if (statementBatchingSupported)\r\n {\r\n try\r\n {\r\n // Set number of statements per batch\r\n methodSetExecuteBatch.invoke(stmt, PARAM_STATEMENT_BATCH_SIZE);\r\n m_batchStatementsInProgress.put(stmt, methodSendBatch);\r\n }\r\n catch (Exception e)\r\n {\r\n throw new PlatformException(e.getLocalizedMessage(), e);\r\n }\r\n }\r\n else\r\n {\r\n super.beforeBatch(stmt);\r\n }\r\n }",
"public boolean removeChildObjectByName(final String name) {\n if (null != name && !name.isEmpty()) {\n GVRSceneObject found = null;\n for (GVRSceneObject child : mChildren) {\n GVRSceneObject object = child.getSceneObjectByName(name);\n if (object != null) {\n found = object;\n break;\n }\n }\n if (found != null) {\n removeChildObject(found);\n return true;\n }\n }\n return false;\n }",
"public <L extends Listener> void popEvent(Event<?, L> expected) {\n synchronized (this.stack) {\n final Event<?, ?> actual = this.stack.pop();\n if (actual != expected) {\n throw new IllegalStateException(String.format(\n \"Unbalanced pop: expected '%s' but encountered '%s'\",\n expected.getListenerClass(), actual));\n }\n }\n }"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.