query
stringlengths 7
3.3k
| positive
sequencelengths 1
1
| negative
sequencelengths 9
9
|
---|---|---|
Set the ambient light intensity.
This designates the color of the ambient reflection.
It is multiplied by the material ambient color to derive
the hue of the ambient reflection for that material.
The built-in phong shader {@link GVRPhongShader} uses a {@code vec4} uniform named
{@code ambient_intensity} to control the intensity of ambient light reflected.
@param r red component (0 to 1)
@param g green component (0 to 1)
@param b blue component (0 to 1)
@param a alpha component (0 to 1) | [
"public void setAmbientIntensity(float r, float g, float b, float a) {\n setVec4(\"ambient_intensity\", r, g, b, a);\n }"
] | [
"public V get(final K1 firstKey, final K2 secondKey) {\n\t\t// existence check on inner map\n\t\tfinal HashMap<K2, V> innerMap = map.get(firstKey);\n\t\tif( innerMap == null ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn innerMap.get(secondKey);\n\t}",
"@Override\n public void setBody(String body) {\n super.setBody(body);\n this.jsonValue = JsonValue.readFrom(body);\n }",
"public static final Rect getViewportBounds() {\n return new Rect(Window.getScrollLeft(), Window.getScrollTop(), Window.getClientWidth(), Window.getClientHeight());\n }",
"private void readVersion(InputStream is) throws IOException\n {\n BytesReadInputStream bytesReadStream = new BytesReadInputStream(is);\n String version = DatatypeConverter.getString(bytesReadStream);\n m_offset += bytesReadStream.getBytesRead();\n SynchroLogger.log(\"VERSION\", version);\n \n String[] versionArray = version.split(\"\\\\.\");\n m_majorVersion = Integer.parseInt(versionArray[0]);\n }",
"public void extractFieldTypes(DatabaseType databaseType) throws SQLException {\n\t\tif (fieldTypes == null) {\n\t\t\tif (fieldConfigs == null) {\n\t\t\t\tfieldTypes = extractFieldTypes(databaseType, dataClass, tableName);\n\t\t\t} else {\n\t\t\t\tfieldTypes = convertFieldConfigs(databaseType, tableName, fieldConfigs);\n\t\t\t}\n\t\t}\n\t}",
"private synchronized void freeClient(Client client) {\n int current = useCounts.get(client);\n if (current > 0) {\n timestamps.put(client, System.currentTimeMillis()); // Mark that it was used until now.\n useCounts.put(client, current - 1);\n if ((current == 1) && (idleLimit.get() == 0)) {\n closeClient(client); // This was the last use, and we are supposed to immediately close idle clients.\n }\n } else {\n logger.error(\"Ignoring attempt to free a client that is not allocated: {}\", client);\n }\n }",
"public <T extends CanvasReader> T getReader(Class<T> type, OauthToken oauthToken) {\n return getReader(type, oauthToken, null);\n }",
"private void registerPerformanceMonitor(String beanName,\n BeanDefinitionRegistry registry) {\n\n String perfMonitorName = beanName + \"PerformanceMonitor\";\n if (!registry.containsBeanDefinition(perfMonitorName)) {\n BeanDefinitionBuilder initializer =\n BeanDefinitionBuilder.rootBeanDefinition(PerformanceMonitorBean.class);\n registry.registerBeanDefinition(perfMonitorName, initializer.getBeanDefinition());\n }\n }",
"public DownloadRequest addCustomHeader(String key, String value) {\n mCustomHeader.put(key, value);\n return this;\n }"
] |
Use this API to add ntpserver resources. | [
"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}"
] | [
"@JsonProperty\n public String timestamp() {\n if (timestampAsText == null) {\n timestampAsText = DateTimeFormatter.ISO_INSTANT.format(timestamp);\n }\n return timestampAsText;\n }",
"private CostRateTableEntry getCostRateTableEntry(Date date)\n {\n CostRateTableEntry result;\n\n CostRateTable table = getCostRateTable();\n if (table == null)\n {\n Resource resource = getResource();\n result = new CostRateTableEntry(resource.getStandardRate(), TimeUnit.HOURS, resource.getOvertimeRate(), TimeUnit.HOURS, resource.getCostPerUse(), null);\n }\n else\n {\n if (table.size() == 1)\n {\n result = table.get(0);\n }\n else\n {\n result = table.getEntryByDate(date);\n }\n }\n\n return result;\n }",
"public static boolean isArray(Type type) {\n return (type instanceof GenericArrayType) || (type instanceof Class<?> && ((Class<?>) type).isArray());\n }",
"public String format(final LoggingEvent event) {\n\t\tfinal StringBuffer buf = new StringBuffer();\n\t\tfor (PatternConverter c = head; c != null; c = c.next) {\n\t\t\tc.format(buf, event);\n\t\t}\n\t\treturn buf.toString();\n\t}",
"private boolean isOrdered(FieldDescriptor[] flds, String[] pkFieldNames)\r\n {\r\n if((flds.length > 1 && pkFieldNames == null) || flds.length != pkFieldNames.length)\r\n {\r\n throw new PersistenceBrokerException(\"pkFieldName length does not match number of defined PK fields.\" +\r\n \" Expected number of PK fields is \" + flds.length + \", given number was \" +\r\n (pkFieldNames != null ? pkFieldNames.length : 0));\r\n }\r\n boolean result = true;\r\n for(int i = 0; i < flds.length; i++)\r\n {\r\n FieldDescriptor fld = flds[i];\r\n result = result && fld.getPersistentField().getName().equals(pkFieldNames[i]);\r\n }\r\n return result;\r\n }",
"public static final String printFinishDateTime(Date value)\n {\n if (value != null)\n {\n value = DateHelper.addDays(value, 1);\n }\n return (value == null ? null : DATE_FORMAT.get().format(value));\n }",
"public static base_responses unset(nitro_service client, gslbservice resources[], String[] args) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tgslbservice unsetresources[] = new gslbservice[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tunsetresources[i] = new gslbservice();\n\t\t\t\tunsetresources[i].servicename = resources[i].servicename;\n\t\t\t}\n\t\t\tresult = unset_bulk_request(client, unsetresources,args);\n\t\t}\n\t\treturn result;\n\t}",
"public static base_responses delete(nitro_service client, String fipskeyname[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (fipskeyname != null && fipskeyname.length > 0) {\n\t\t\tsslfipskey deleteresources[] = new sslfipskey[fipskeyname.length];\n\t\t\tfor (int i=0;i<fipskeyname.length;i++){\n\t\t\t\tdeleteresources[i] = new sslfipskey();\n\t\t\t\tdeleteresources[i].fipskeyname = fipskeyname[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 writeResources() throws IOException\n {\n writeAttributeTypes(\"resource_types\", ResourceField.values());\n\n m_writer.writeStartList(\"resources\");\n for (Resource resource : m_projectFile.getResources())\n {\n writeFields(null, resource, ResourceField.values());\n }\n m_writer.writeEndList();\n }"
] |
Add the declarationBinderRef to the ImportersManager, create the corresponding.
BinderDescriptor.
@param declarationBinderRef the ServiceReference<DeclarationBinder> of the DeclarationBinder
@throws InvalidFilterException | [
"public void add(ServiceReference<S> declarationBinderRef) throws InvalidFilterException {\n BinderDescriptor binderDescriptor = new BinderDescriptor(declarationBinderRef);\n declarationBinders.put(declarationBinderRef, binderDescriptor);\n }"
] | [
"private Optional<String> getXsrfFromHtmlBody(HttpResponse loginResponse) throws IOException {\n Optional<Cookie> gerritAccountCookie = findGerritAccountCookie();\n if (gerritAccountCookie.isPresent()) {\n Matcher matcher = GERRIT_AUTH_PATTERN.matcher(EntityUtils.toString(loginResponse.getEntity(), Consts.UTF_8));\n if (matcher.find()) {\n return Optional.of(matcher.group(1));\n }\n }\n return Optional.absent();\n }",
"public void deleteServerGroup(int id) {\n try {\n sqlService.executeUpdate(\"DELETE FROM \" + Constants.DB_TABLE_SERVER_GROUPS +\n \" WHERE \" + Constants.GENERIC_ID + \" = \" + id + \";\");\n\n sqlService.executeUpdate(\"DELETE FROM \" + Constants.DB_TABLE_SERVERS +\n \" WHERE \" + Constants.SERVER_REDIRECT_GROUP_ID + \" = \" + id);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }",
"static String tokenize(PageMetadata<?, ?> pageMetadata) {\n try {\n Gson g = getGsonWithKeyAdapter(pageMetadata.pageRequestParameters);\n return new String(Base64.encodeBase64URLSafe(g.toJson(new PaginationToken\n (pageMetadata)).getBytes(\"UTF-8\")),\n Charset.forName(\"UTF-8\"));\n } catch (UnsupportedEncodingException e) {\n //all JVMs should support UTF-8\n throw new RuntimeException(e);\n }\n }",
"public String getNotes()\n {\n String notes = (String) getCachedValue(ResourceField.NOTES);\n return (notes == null ? \"\" : notes);\n }",
"private static boolean matches(Type from, Type to, Map<String, Type> typeMap) {\n\t\tif (to.equals(from))\n\t\t\treturn true;\n\n\t\tif (from instanceof TypeVariable) {\n\t\t\treturn to.equals(typeMap.get(((TypeVariable<?>) from).getName()));\n\t\t}\n\n\t\treturn false;\n\t}",
"public synchronized boolean hasNext()\r\n {\r\n try\r\n {\r\n if (!isHasCalledCheck())\r\n {\r\n setHasCalledCheck(true);\r\n setHasNext(getRsAndStmt().m_rs.next());\r\n if (!getHasNext())\r\n {\r\n autoReleaseDbResources();\r\n }\r\n }\r\n }\r\n catch (Exception ex)\r\n {\r\n setHasNext(false);\r\n autoReleaseDbResources();\r\n if(ex instanceof ResourceClosedException)\r\n {\r\n throw (ResourceClosedException)ex;\r\n }\r\n if(ex instanceof SQLException)\r\n {\r\n throw new PersistenceBrokerSQLException(\"Calling ResultSet.next() failed\", (SQLException) ex);\r\n }\r\n else\r\n {\r\n throw new PersistenceBrokerException(\"Can't get next row from ResultSet\", ex);\r\n }\r\n }\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"hasNext() -> \" + getHasNext());\r\n\r\n return getHasNext();\r\n }",
"public static String resolveDataSourceTypeFromDialect(String dialect)\n {\n if (StringUtils.contains(dialect, \"Oracle\"))\n {\n return \"Oracle\";\n }\n else if (StringUtils.contains(dialect, \"MySQL\"))\n {\n return \"MySQL\";\n }\n else if (StringUtils.contains(dialect, \"DB2390Dialect\"))\n {\n return \"DB2/390\";\n }\n else if (StringUtils.contains(dialect, \"DB2400Dialect\"))\n {\n return \"DB2/400\";\n }\n else if (StringUtils.contains(dialect, \"DB2\"))\n {\n return \"DB2\";\n }\n else if (StringUtils.contains(dialect, \"Ingres\"))\n {\n return \"Ingres\";\n }\n else if (StringUtils.contains(dialect, \"Derby\"))\n {\n return \"Derby\";\n }\n else if (StringUtils.contains(dialect, \"Pointbase\"))\n {\n return \"Pointbase\";\n }\n else if (StringUtils.contains(dialect, \"Postgres\"))\n {\n return \"Postgres\";\n }\n else if (StringUtils.contains(dialect, \"SQLServer\"))\n {\n return \"SQLServer\";\n }\n else if (StringUtils.contains(dialect, \"Sybase\"))\n {\n return \"Sybase\";\n }\n else if (StringUtils.contains(dialect, \"HSQLDialect\"))\n {\n return \"HyperSQL\";\n }\n else if (StringUtils.contains(dialect, \"H2Dialect\"))\n {\n return \"H2\";\n }\n \n return dialect;\n\n }",
"public void finalizeConfig() {\n assert !configFinalized;\n\n try {\n retrieveEngine();\n } catch (Exception e) {\n throw new RuntimeException(e.getMessage(), e);\n }\n configFinalized = true;\n }",
"@PrefMetadata(type = CmsTimeWarpPreference.class)\n public String getTimeWarp() {\n\n long warp = m_settings.getTimeWarp();\n return warp < 0 ? \"\" : \"\" + warp; // if timewarp < 0 (i.e. time warp is not set), use the empty string because we don't want the date selector widget to interpret the negative value\n }"
] |
Build the query to perform a batched read get orderBy settings from CollectionDescriptor
@param ids Collection containing all identities of objects of the ONE side | [
"protected Query buildPrefetchQuery(Collection ids)\r\n {\r\n CollectionDescriptor cds = getCollectionDescriptor();\r\n QueryByCriteria query = buildPrefetchQuery(ids, cds.getForeignKeyFieldDescriptors(getItemClassDescriptor()));\r\n\r\n // check if collection must be ordered\r\n if (!cds.getOrderBy().isEmpty())\r\n {\r\n Iterator iter = cds.getOrderBy().iterator();\r\n while (iter.hasNext())\r\n {\r\n query.addOrderBy((FieldHelper) iter.next());\r\n }\r\n }\r\n\r\n return query;\r\n }"
] | [
"private ResourceAssignment getExistingResourceAssignment(Resource resource)\n {\n ResourceAssignment assignment = null;\n Integer resourceUniqueID = null;\n\n if (resource != null)\n {\n Iterator<ResourceAssignment> iter = m_assignments.iterator();\n resourceUniqueID = resource.getUniqueID();\n\n while (iter.hasNext() == true)\n {\n assignment = iter.next();\n Integer uniqueID = assignment.getResourceUniqueID();\n if (uniqueID != null && uniqueID.equals(resourceUniqueID) == true)\n {\n break;\n }\n assignment = null;\n }\n }\n\n return assignment;\n }",
"private Auth constructAuth(String authToken, String tokenSecret, String username) throws IOException {\n\n Auth auth = new Auth();\n auth.setToken(authToken);\n auth.setTokenSecret(tokenSecret);\n\n // Prompt to ask what permission is needed: read, update or delete.\n auth.setPermission(Permission.fromString(\"delete\"));\n\n User user = new User();\n // Later change the following 3. Either ask user to pass on command line or read\n // from saved file.\n user.setId(nsid);\n user.setUsername((username));\n user.setRealName(\"\");\n auth.setUser(user);\n this.authStore.store(auth);\n return auth;\n }",
"protected void updateTables()\n {\n byte[] data = m_model.getData();\n int columns = m_model.getColumns();\n int rows = (data.length / columns) + 1;\n int offset = m_model.getOffset();\n\n String[][] hexData = new String[rows][columns];\n String[][] asciiData = new String[rows][columns];\n\n int row = 0;\n int column = 0;\n StringBuilder hexValue = new StringBuilder();\n for (int index = offset; index < data.length; index++)\n {\n int value = data[index];\n hexValue.setLength(0);\n hexValue.append(HEX_DIGITS[(value & 0xF0) >> 4]);\n hexValue.append(HEX_DIGITS[value & 0x0F]);\n\n char c = (char) value;\n if ((c > 200) || (c < 27))\n {\n c = ' ';\n }\n\n hexData[row][column] = hexValue.toString();\n asciiData[row][column] = Character.toString(c);\n\n ++column;\n if (column == columns)\n {\n column = 0;\n ++row;\n }\n }\n\n String[] columnHeadings = new String[columns];\n TableModel hexTableModel = new DefaultTableModel(hexData, columnHeadings)\n {\n @Override public boolean isCellEditable(int r, int c)\n {\n return false;\n }\n };\n\n TableModel asciiTableModel = new DefaultTableModel(asciiData, columnHeadings)\n {\n @Override public boolean isCellEditable(int r, int c)\n {\n return false;\n }\n };\n\n m_model.setSizeValueLabel(Integer.toString(data.length));\n m_model.setHexTableModel(hexTableModel);\n m_model.setAsciiTableModel(asciiTableModel);\n m_model.setCurrentSelectionIndex(0);\n m_model.setPreviousSelectionIndex(0);\n }",
"public static final void getByteArray(byte[] data, int offset, int size, byte[] buffer, int bufferOffset)\n {\n System.arraycopy(data, offset, buffer, bufferOffset, size);\n }",
"public static <T> ConflictHandler<T> localWins() {\n return new ConflictHandler<T>() {\n @Override\n public T resolveConflict(\n final BsonValue documentId,\n final ChangeEvent<T> localEvent,\n final ChangeEvent<T> remoteEvent\n ) {\n return localEvent.getFullDocument();\n }\n };\n }",
"protected void updateForNewConfiguration(CmsGitConfiguration gitConfig) {\n\n if (!m_checkinBean.setCurrentConfiguration(gitConfig)) {\n Notification.show(\n CmsVaadinUtils.getMessageText(Messages.GUI_GIT_CONFIGURATION_SWITCH_FAILED_0),\n CmsVaadinUtils.getMessageText(Messages.GUI_GIT_CONFIGURATION_SWITCH_FAILED_DESC_0),\n Type.ERROR_MESSAGE);\n m_configurationSelector.select(m_checkinBean.getCurrentConfiguration());\n return;\n }\n\n resetSelectableModules();\n for (final String moduleName : gitConfig.getConfiguredModules()) {\n addSelectableModule(moduleName);\n }\n updateNewModuleSelector();\n m_pullFirst.setValue(Boolean.valueOf(gitConfig.getDefaultAutoPullBefore()));\n m_pullAfterCommit.setValue(Boolean.valueOf(gitConfig.getDefaultAutoPullAfter()));\n m_addAndCommit.setValue(Boolean.valueOf(gitConfig.getDefaultAutoCommit()));\n m_pushAutomatically.setValue(Boolean.valueOf(gitConfig.getDefaultAutoPush()));\n m_commitMessage.setValue(Strings.nullToEmpty(gitConfig.getDefaultCommitMessage()));\n m_copyAndUnzip.setValue(Boolean.valueOf(gitConfig.getDefaultCopyAndUnzip()));\n m_excludeLib.setValue(Boolean.valueOf(gitConfig.getDefaultExcludeLibs()));\n m_ignoreUnclean.setValue(Boolean.valueOf(gitConfig.getDefaultIngoreUnclean()));\n m_userField.setValue(Strings.nullToEmpty(gitConfig.getDefaultGitUserName()));\n m_emailField.setValue(Strings.nullToEmpty(gitConfig.getDefaultGitUserEmail()));\n\n }",
"public static <T> int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig)\n\t\t\tthrows SQLException {\n\t\tDao<T, ?> dao = DaoManager.createDao(connectionSource, tableConfig);\n\t\treturn doCreateTable(dao, false);\n\t}",
"public static servicegroup_stats[] get(nitro_service service, options option) throws Exception{\n\t\tservicegroup_stats obj = new servicegroup_stats();\n\t\tservicegroup_stats[] response = (servicegroup_stats[])obj.stat_resources(service,option);\n\t\treturn response;\n\t}",
"public static IBlur getIBlurAlgorithm(EBlurAlgorithm algorithm, ContextWrapper contextWrapper) {\n RenderScript rs = contextWrapper.getRenderScript();\n Context ctx = contextWrapper.getContext();\n\n switch (algorithm) {\n case RS_GAUSS_FAST:\n return new RenderScriptGaussianBlur(rs);\n case RS_BOX_5x5:\n return new RenderScriptBox5x5Blur(rs);\n case RS_GAUSS_5x5:\n return new RenderScriptGaussian5x5Blur(rs);\n case RS_STACKBLUR:\n return new RenderScriptStackBlur(rs, ctx);\n case STACKBLUR:\n return new StackBlur();\n case GAUSS_FAST:\n return new GaussianFastBlur();\n case BOX_BLUR:\n return new BoxBlur();\n default:\n return new IgnoreBlur();\n }\n }"
] |
Mbeans for SLOP_UPDATE | [
"@JmxGetter(name = \"avgSlopUpdateNetworkTimeMs\", description = \"average time spent on network, for streaming operations\")\n public double getAvgSlopUpdateNetworkTimeMs() {\n return networkTimeCounterMap.get(Operation.SLOP_UPDATE).getAvgEventValue() / Time.NS_PER_MS;\n }"
] | [
"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}",
"@Override\n public <T> Producer<T> createProducer(final Bean<X> declaringBean, final Bean<T> bean, DisposalMethod<X, T> disposalMethod) {\n EnhancedAnnotatedField<T, X> enhancedField = getManager().getServices().get(MemberTransformer.class).loadEnhancedMember(field, getManager().getId());\n return new ProducerFieldProducer<X, T>(enhancedField, disposalMethod) {\n\n @Override\n public AnnotatedField<X> getAnnotated() {\n return field;\n }\n\n @Override\n public BeanManagerImpl getBeanManager() {\n return getManager();\n }\n\n @Override\n public Bean<X> getDeclaringBean() {\n return declaringBean;\n }\n\n @Override\n public Bean<T> getBean() {\n return bean;\n }\n };\n }",
"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 }",
"public String[] getNormalizedLabels() {\n\t\tif(isValid()) {\n\t\t\treturn parsedHost.getNormalizedLabels();\n\t\t}\n\t\tif(host.length() == 0) {\n\t\t\treturn new String[0];\n\t\t}\n\t\treturn new String[] {host};\n\t}",
"public void deleteStoreDefinition(String storeName) {\n // acquire write lock\n writeLock.lock();\n\n try {\n // Check if store exists\n if(!this.storeNames.contains(storeName)) {\n throw new VoldemortException(\"Requested store to be deleted does not exist !\");\n }\n\n // Otherwise remove from the STORES directory. Note: The version\n // argument is not required here since the\n // ConfigurationStorageEngine simply ignores this.\n this.storeDefinitionsStorageEngine.delete(storeName, null);\n\n // Update the metadata cache\n this.metadataCache.remove(storeName);\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 } finally {\n writeLock.unlock();\n }\n }",
"public boolean detectNintendo() {\r\n\r\n if ((userAgent.indexOf(deviceNintendo) != -1)\r\n || (userAgent.indexOf(deviceWii) != -1)\r\n || (userAgent.indexOf(deviceNintendoDs) != -1)) {\r\n return true;\r\n }\r\n return false;\r\n }",
"protected String getBasePath(String rootPath) {\r\n\r\n if (rootPath.endsWith(INHERITANCE_CONFIG_FILE_NAME)) {\r\n return rootPath.substring(0, rootPath.length() - INHERITANCE_CONFIG_FILE_NAME.length());\r\n }\r\n return rootPath;\r\n }",
"public static int brightnessNTSC(int rgb) {\n\t\tint r = (rgb >> 16) & 0xff;\n\t\tint g = (rgb >> 8) & 0xff;\n\t\tint b = rgb & 0xff;\n\t\treturn (int)(r*0.299f + g*0.587f + b*0.114f);\n\t}",
"private void registerPerformanceMonitor(String beanName,\n BeanDefinitionRegistry registry) {\n\n String perfMonitorName = beanName + \"PerformanceMonitor\";\n if (!registry.containsBeanDefinition(perfMonitorName)) {\n BeanDefinitionBuilder initializer =\n BeanDefinitionBuilder.rootBeanDefinition(PerformanceMonitorBean.class);\n registry.registerBeanDefinition(perfMonitorName, initializer.getBeanDefinition());\n }\n }"
] |
Adds a path to the request response table with the specified values
@param profileId ID of profile
@param clientUUID UUID of client
@param pathId ID of path
@throws Exception exception | [
"public void addPathToRequestResponseTable(int profileId, String clientUUID, int pathId) throws Exception {\n PreparedStatement statement = null;\n try (Connection sqlConnection = sqlService.getConnection()) {\n statement = sqlConnection\n .prepareStatement(\"INSERT INTO \" + Constants.DB_TABLE_REQUEST_RESPONSE +\n \"(\" + Constants.REQUEST_RESPONSE_PATH_ID + \",\"\n + Constants.GENERIC_PROFILE_ID + \",\"\n + Constants.GENERIC_CLIENT_UUID + \",\"\n + Constants.REQUEST_RESPONSE_REPEAT_NUMBER + \",\"\n + Constants.REQUEST_RESPONSE_RESPONSE_ENABLED + \",\"\n + Constants.REQUEST_RESPONSE_REQUEST_ENABLED + \",\"\n + Constants.REQUEST_RESPONSE_CUSTOM_RESPONSE + \",\"\n + Constants.REQUEST_RESPONSE_CUSTOM_REQUEST + \")\"\n + \" VALUES (?, ?, ?, ?, ?, ?, ?, ?);\");\n statement.setInt(1, pathId);\n statement.setInt(2, profileId);\n statement.setString(3, clientUUID);\n statement.setInt(4, -1);\n statement.setInt(5, 0);\n statement.setInt(6, 0);\n statement.setString(7, \"\");\n statement.setString(8, \"\");\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 }"
] | [
"public static base_response clear(nitro_service client, route6 resource) throws Exception {\n\t\troute6 clearresource = new route6();\n\t\tclearresource.routetype = resource.routetype;\n\t\treturn clearresource.perform_operation(client,\"clear\");\n\t}",
"public ProviderContextBuilder setRateTypes(Collection<RateType> rateTypes) {\n Objects.requireNonNull(rateTypes);\n if (rateTypes.isEmpty()) {\n throw new IllegalArgumentException(\"At least one RateType is required.\");\n }\n Set<RateType> rtSet = new HashSet<>(rateTypes);\n set(ProviderContext.KEY_RATE_TYPES, rtSet);\n return this;\n }",
"public boolean load()\r\n {\r\n \t_load();\r\n \tjava.util.Iterator it = this.alChildren.iterator();\r\n \twhile (it.hasNext())\r\n \t{\r\n \t\tObject o = it.next();\r\n \t\tif (o instanceof OjbMetaTreeNode) ((OjbMetaTreeNode)o).load();\r\n \t}\r\n \treturn true;\r\n }",
"public static hanode_routemonitor6_binding[] get(nitro_service service, Long id) throws Exception{\n\t\thanode_routemonitor6_binding obj = new hanode_routemonitor6_binding();\n\t\tobj.set_id(id);\n\t\thanode_routemonitor6_binding response[] = (hanode_routemonitor6_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"private ModelNode resolveSubsystems(final List<ModelNode> extensions) {\n\n HostControllerLogger.ROOT_LOGGER.debug(\"Applying extensions provided by master\");\n final ModelNode result = operationExecutor.installSlaveExtensions(extensions);\n if (!SUCCESS.equals(result.get(OUTCOME).asString())) {\n throw HostControllerLogger.ROOT_LOGGER.failedToAddExtensions(result.get(FAILURE_DESCRIPTION));\n }\n final ModelNode subsystems = new ModelNode();\n for (final ModelNode extension : extensions) {\n extensionRegistry.recordSubsystemVersions(extension.asString(), subsystems);\n }\n return subsystems;\n }",
"public static Object lookup(String jndiName)\r\n {\r\n if(log.isDebugEnabled()) log.debug(\"lookup(\"+jndiName+\") was called\");\r\n try\r\n {\r\n return getContext().lookup(jndiName);\r\n }\r\n catch (NamingException e)\r\n {\r\n throw new OJBRuntimeException(\"Lookup failed for: \" + jndiName, e);\r\n }\r\n catch(OJBRuntimeException e)\r\n {\r\n throw e;\r\n }\r\n }",
"private static OriginatorType mapOriginator(Originator originator) {\n if (originator == null) {\n return null;\n }\n OriginatorType origType = new OriginatorType();\n origType.setProcessId(originator.getProcessId());\n origType.setIp(originator.getIp());\n origType.setHostname(originator.getHostname());\n origType.setCustomId(originator.getCustomId());\n origType.setPrincipal(originator.getPrincipal());\n return origType;\n }",
"public Class<E> getEventClass() {\n if (cachedClazz != null) {\n return cachedClazz;\n }\n Class<?> clazz = this.getClass();\n while (clazz != Object.class) {\n try {\n Type mySuperclass = clazz.getGenericSuperclass();\n Type tType = ((ParameterizedType) mySuperclass).getActualTypeArguments()[0];\n cachedClazz = (Class<E>) Class.forName(tType.getTypeName());\n return cachedClazz;\n } catch (Exception e) {\n }\n clazz = clazz.getSuperclass();\n }\n throw new IllegalStateException(\"Failed to load event class - \" + this.getClass().getCanonicalName());\n }",
"private void processVirtualHostName(HttpMethod httpMethodProxyRequest, HttpServletRequest httpServletRequest) {\n String virtualHostName;\n if (httpMethodProxyRequest.getRequestHeader(STRING_HOST_HEADER_NAME) != null) {\n virtualHostName = HttpUtilities.removePortFromHostHeaderString(httpMethodProxyRequest.getRequestHeader(STRING_HOST_HEADER_NAME).getValue());\n } else {\n virtualHostName = HttpUtilities.getHostNameFromURL(httpServletRequest.getRequestURL().toString());\n }\n httpMethodProxyRequest.getParams().setVirtualHost(virtualHostName);\n }"
] |
Checks to see if the two matrices are inverses of each other.
@param a A matrix. Not modified.
@param b A matrix. Not modified. | [
"public static boolean isInverse(DMatrixRMaj a , DMatrixRMaj b , double tol ) {\n if( a.numRows != b.numRows || a.numCols != b.numCols ) {\n return false;\n }\n\n int numRows = a.numRows;\n int numCols = a.numCols;\n\n for( int i = 0; i < numRows; i++ ) {\n for( int j = 0; j < numCols; j++ ) {\n double total = 0;\n for( int k = 0; k < numCols; k++ ) {\n total += a.get(i,k)*b.get(k,j);\n }\n\n if( i == j ) {\n if( !(Math.abs(total-1) <= tol) )\n return false;\n } else if( !(Math.abs(total) <= tol) )\n return false;\n }\n }\n\n return true;\n }"
] | [
"private void merge(Map<String, NodeT> source, Map<String, NodeT> target) {\n for (Map.Entry<String, NodeT> entry : source.entrySet()) {\n String key = entry.getKey();\n if (!target.containsKey(key)) {\n target.put(key, entry.getValue());\n }\n }\n }",
"private void initWsClient(BundleContext context) throws Exception {\n ServiceReference serviceRef = context.getServiceReference(ConfigurationAdmin.class.getName());\n ConfigurationAdmin cfgAdmin = (ConfigurationAdmin)context.getService(serviceRef); \n Configuration config = cfgAdmin.getConfiguration(\"org.talend.esb.sam.agent\");\n\n String serviceURL = (String)config.getProperties().get(\"service.url\");\n retryNum = Integer.parseInt((String)config.getProperties().get(\"service.retry.number\"));\n retryDelay = Long.parseLong((String)config.getProperties().get(\"service.retry.delay\"));\n\n JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();\n factory.setServiceClass(org.talend.esb.sam.monitoringservice.v1.MonitoringService.class);\n factory.setAddress(serviceURL);\n monitoringService = (MonitoringService)factory.create();\n }",
"public static CmsJspResourceWrapper convertResource(CmsObject cms, Object input) throws CmsException {\n\n CmsJspResourceWrapper result;\n if (input instanceof CmsResource) {\n result = CmsJspResourceWrapper.wrap(cms, (CmsResource)input);\n } else {\n result = CmsJspResourceWrapper.wrap(cms, convertRawResource(cms, input));\n }\n return result;\n }",
"public static synchronized void unregister(final String serviceName,\n final Callable<Class< ? >> factory) {\n if ( serviceName == null ) {\n throw new IllegalArgumentException( \"serviceName cannot be null\" );\n }\n if ( factories != null ) {\n List<Callable<Class< ? >>> l = factories.get( serviceName );\n if ( l != null ) {\n l.remove( factory );\n }\n }\n }",
"protected String getUserDefinedFieldName(String field) {\n int index = field.indexOf('-');\n char letter = getUserDefinedFieldLetter();\n\n for (int i = 0; i < index; ++i) {\n if (field.charAt(i) == letter) {\n return field.substring(index + 1);\n }\n }\n\n return null;\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 }",
"protected Element createRectangleElement(float x, float y, float width, float height, boolean stroke, boolean fill)\n {\n float lineWidth = transformWidth(getGraphicsState().getLineWidth());\n \tfloat wcor = stroke ? lineWidth : 0.0f;\n float strokeOffset = wcor == 0 ? 0 : wcor / 2;\n width = width - wcor < 0 ? 1 : width - wcor;\n height = height - wcor < 0 ? 1 : height - wcor;\n\n StringBuilder pstyle = new StringBuilder(50);\n \tpstyle.append(\"left:\").append(style.formatLength(x - strokeOffset)).append(';');\n pstyle.append(\"top:\").append(style.formatLength(y - strokeOffset)).append(';');\n pstyle.append(\"width:\").append(style.formatLength(width)).append(';');\n pstyle.append(\"height:\").append(style.formatLength(height)).append(';');\n \t \n \tif (stroke)\n \t{\n String color = colorString(getGraphicsState().getStrokingColor());\n \tpstyle.append(\"border:\").append(style.formatLength(lineWidth)).append(\" solid \").append(color).append(';');\n \t}\n \t\n \tif (fill)\n \t{\n String fcolor = colorString(getGraphicsState().getNonStrokingColor());\n \t pstyle.append(\"background-color:\").append(fcolor).append(';');\n \t}\n \t\n Element el = doc.createElement(\"div\");\n el.setAttribute(\"class\", \"r\");\n el.setAttribute(\"style\", pstyle.toString());\n el.appendChild(doc.createEntityReference(\"nbsp\"));\n return el;\n }",
"public final void notifyContentItemRemoved(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 - \"\n + (contentItemCount - 1) + \"].\");\n }\n notifyItemRemoved(position + headerItemCount);\n }",
"public ValueContainer[] getKeyValues(ClassDescriptor cld, Object objectOrProxy, boolean convertToSql) throws PersistenceBrokerException\r\n {\r\n IndirectionHandler handler = ProxyHelper.getIndirectionHandler(objectOrProxy);\r\n\r\n if(handler != null)\r\n {\r\n return getKeyValues(cld, handler.getIdentity(), convertToSql); //BRJ: convert Identity\r\n }\r\n else\r\n {\r\n ClassDescriptor realCld = getRealClassDescriptor(cld, objectOrProxy);\r\n return getValuesForObject(realCld.getPkFields(), objectOrProxy, convertToSql);\r\n }\r\n }"
] |
Write file creation record.
@throws IOException | [
"private void writeFileCreationRecord() throws IOException\n {\n ProjectProperties properties = m_projectFile.getProjectProperties();\n\n m_buffer.setLength(0);\n m_buffer.append(\"MPX\");\n m_buffer.append(m_delimiter);\n m_buffer.append(properties.getMpxProgramName());\n m_buffer.append(m_delimiter);\n m_buffer.append(properties.getMpxFileVersion());\n m_buffer.append(m_delimiter);\n m_buffer.append(properties.getMpxCodePage());\n m_buffer.append(MPXConstants.EOL);\n m_writer.write(m_buffer.toString());\n }"
] | [
"public void reinitIfClosed() {\n if (isClosed.get()) {\n logger.info(\"External Resource was released. Now Re-initializing resources ...\");\n\n ActorConfig.createAndGetActorSystem();\n httpClientStore.reinit();\n tcpSshPingResourceStore.reinit();\n try {\n Thread.sleep(1000l);\n } catch (InterruptedException e) {\n logger.error(\"error reinit httpClientStore\", e);\n }\n isClosed.set(false);\n logger.info(\"Parallel Client Resources has been reinitialized.\");\n } else {\n logger.debug(\"NO OP. Resource was not released.\");\n }\n }",
"private boolean isAllNumeric(TokenStream stream) {\n List<Token> tokens = ((NattyTokenSource) stream.getTokenSource()).getTokens();\n for(Token token:tokens) {\n try {\n Integer.parseInt(token.getText());\n } catch(NumberFormatException e) {\n return false;\n }\n }\n return true;\n }",
"public List<List<IN>> classifyFile(String filename) {\r\n ObjectBank<List<IN>> documents =\r\n makeObjectBankFromFile(filename, plainTextReaderAndWriter);\r\n List<List<IN>> result = new ArrayList<List<IN>>();\r\n\r\n for (List<IN> document : documents) {\r\n // System.err.println(document);\r\n classify(document);\r\n\r\n List<IN> sentence = new ArrayList<IN>();\r\n for (IN wi : document) {\r\n sentence.add(wi);\r\n // System.err.println(wi);\r\n }\r\n result.add(sentence);\r\n }\r\n return result;\r\n }",
"public void setColorSchemeResources(int... colorResIds) {\n final Resources res = getResources();\n int[] colorRes = new int[colorResIds.length];\n for (int i = 0; i < colorResIds.length; i++) {\n colorRes[i] = res.getColor(colorResIds[i]);\n }\n setColorSchemeColors(colorRes);\n }",
"protected synchronized int loadSize() throws PersistenceBrokerException\r\n {\r\n PersistenceBroker broker = getBroker();\r\n try\r\n {\r\n return broker.getCount(getQuery());\r\n }\r\n catch (Exception ex)\r\n {\r\n throw new PersistenceBrokerException(ex);\r\n }\r\n finally\r\n {\r\n releaseBroker(broker);\r\n }\r\n }",
"public SwaptionDataLattice append(SwaptionDataLattice other, AnalyticModel model) {\r\n\r\n\t\tSwaptionDataLattice combined = new SwaptionDataLattice(referenceDate, quotingConvention, displacement,\r\n\t\t\t\tforwardCurveName, discountCurveName, floatMetaSchedule, fixMetaSchedule);\r\n\t\tcombined.entryMap.putAll(entryMap);\r\n\r\n\t\tif(quotingConvention == other.quotingConvention && displacement == other.displacement) {\r\n\t\t\tcombined.entryMap.putAll(other.entryMap);\r\n\t\t} else {\r\n\t\t\tSwaptionDataLattice converted = other.convertLattice(quotingConvention, displacement, model);\r\n\t\t\tcombined.entryMap.putAll(converted.entryMap);\r\n\t\t}\r\n\r\n\t\treturn combined;\r\n\t}",
"private void storeToDb(Object obj, ClassDescriptor cld, Identity oid, boolean insert, boolean ignoreReferences)\n {\n // 1. link and store 1:1 references\n storeReferences(obj, cld, insert, ignoreReferences);\n\n Object[] pkValues = oid.getPrimaryKeyValues();\n if (!serviceBrokerHelper().assertValidPksForStore(cld.getPkFields(), pkValues))\n {\n // BRJ: fk values may be part of pk, but the are not known during\n // creation of Identity. so we have to get them here\n pkValues = serviceBrokerHelper().getKeyValues(cld, obj);\n if (!serviceBrokerHelper().assertValidPksForStore(cld.getPkFields(), pkValues))\n {\n String append = insert ? \" on insert\" : \" on update\" ;\n throw new PersistenceBrokerException(\"assertValidPkFields failed for Object of type: \" + cld.getClassNameOfObject() + append);\n }\n }\n\n // get super class cld then store it with the object\n /*\n now for multiple table inheritance\n 1. store super classes, topmost parent first\n 2. go down through heirarchy until current class\n 3. todo: store to full extent?\n\n// arminw: TODO: The extend-attribute feature dosn't work, should we remove this stuff?\n This if-clause will go up the inheritance heirarchy to store all the super classes.\n The id for the top most super class will be the id for all the subclasses too\n */\n if(cld.getSuperClass() != null)\n {\n\n ClassDescriptor superCld = getDescriptorRepository().getDescriptorFor(cld.getSuperClass());\n storeToDb(obj, superCld, oid, insert);\n // arminw: why this?? I comment out this section\n // storeCollections(obj, cld.getCollectionDescriptors(), insert);\n }\n\n // 2. store primitive typed attributes (Or is THIS step 3 ?)\n // if obj not present in db use INSERT\n if (insert)\n {\n dbAccess.executeInsert(cld, obj);\n if(oid.isTransient())\n {\n // Create a new Identity based on the current set of primary key values.\n oid = serviceIdentity().buildIdentity(cld, obj);\n }\n }\n // else use UPDATE\n else\n {\n try\n {\n dbAccess.executeUpdate(cld, obj);\n }\n catch(OptimisticLockException e)\n {\n // ensure that the outdated object be removed from cache\n objectCache.remove(oid);\n throw e;\n }\n }\n // cache object for symmetry with getObjectByXXX()\n // Add the object to the cache.\n objectCache.doInternalCache(oid, obj, ObjectCacheInternal.TYPE_WRITE);\n // 3. store 1:n and m:n associations\n if(!ignoreReferences) storeCollections(obj, cld, insert);\n }",
"public void build(Set<Bean<?>> beans) {\n\n if (isBuilt()) {\n throw new IllegalStateException(\"BeanIdentifier index is already built!\");\n }\n\n if (beans.isEmpty()) {\n index = new BeanIdentifier[0];\n reverseIndex = Collections.emptyMap();\n indexHash = 0;\n indexBuilt.set(true);\n return;\n }\n\n List<BeanIdentifier> tempIndex = new ArrayList<BeanIdentifier>(beans.size());\n\n for (Bean<?> bean : beans) {\n if (bean instanceof CommonBean<?>) {\n tempIndex.add(((CommonBean<?>) bean).getIdentifier());\n } else if (bean instanceof PassivationCapable) {\n tempIndex.add(new StringBeanIdentifier(((PassivationCapable) bean).getId()));\n }\n }\n\n Collections.sort(tempIndex, new Comparator<BeanIdentifier>() {\n @Override\n public int compare(BeanIdentifier o1, BeanIdentifier o2) {\n return o1.asString().compareTo(o2.asString());\n }\n });\n\n index = tempIndex.toArray(new BeanIdentifier[tempIndex.size()]);\n\n ImmutableMap.Builder<BeanIdentifier, Integer> builder = ImmutableMap.builder();\n for (int i = 0; i < index.length; i++) {\n builder.put(index[i], i);\n }\n reverseIndex = builder.build();\n\n indexHash = Arrays.hashCode(index);\n\n if(BootstrapLogger.LOG.isDebugEnabled()) {\n BootstrapLogger.LOG.beanIdentifierIndexBuilt(getDebugInfo());\n }\n indexBuilt.set(true);\n }",
"protected Object transformEntity(Entity entity) {\n\t\tPropertyColumn propertyColumn = (PropertyColumn) entity;\n\t\tJRDesignField field = new JRDesignField();\n\t\tColumnProperty columnProperty = propertyColumn.getColumnProperty();\n\t\tfield.setName(columnProperty.getProperty());\n\t\tfield.setValueClassName(columnProperty.getValueClassName());\n\t\t\n\t\tlog.debug(\"Transforming column: \" + propertyColumn.getName() + \", property: \" + columnProperty.getProperty() + \" (\" + columnProperty.getValueClassName() +\") \" );\n\n\t\tfield.setDescription(propertyColumn.getFieldDescription()); //hack for XML data source\n\t\tfor (String key : columnProperty.getFieldProperties().keySet()) {\n\t\t\tfield.getPropertiesMap().setProperty(key, columnProperty.getFieldProperties().get(key));\n\t\t}\n\t\treturn field;\n\t}"
] |
Determine whether the calling thread is the GL thread.
@return {@code True} if called from the GL thread, {@code false} if
called from another thread. | [
"protected final boolean isGLThread() {\n final Thread glThread = sGLThread.get();\n return glThread != null && glThread.equals(Thread.currentThread());\n }"
] | [
"public void cleanup() {\n managers.clear();\n for (BeanManagerImpl beanManager : beanDeploymentArchives.values()) {\n beanManager.cleanup();\n }\n beanDeploymentArchives.clear();\n deploymentServices.cleanup();\n deploymentManager.cleanup();\n instance.clear(contextId);\n }",
"public static void generateJRXML(DynamicReport dr, LayoutManager layoutManager, Map _parameters, String xmlEncoding, OutputStream outputStream) throws JRException {\n JasperReport jr = generateJasperReport(dr, layoutManager, _parameters);\n if (xmlEncoding == null)\n xmlEncoding = DEFAULT_XML_ENCODING;\n JRXmlWriter.writeReport(jr, outputStream, xmlEncoding);\n }",
"public static String getStateKey(CmsResourceState state) {\n\n StringBuffer sb = new StringBuffer(STATE_PREFIX);\n sb.append(state);\n sb.append(STATE_POSTFIX);\n return sb.toString();\n\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}",
"private static String firstFoundTableName(PersistenceBroker brokerForClass, ClassDescriptor cld)\r\n {\r\n String name = null;\r\n if (!cld.isInterface() && cld.getFullTableName() != null)\r\n {\r\n return cld.getFullTableName();\r\n }\r\n if (cld.isExtent())\r\n {\r\n Collection extentClasses = cld.getExtentClasses();\r\n for (Iterator iterator = extentClasses.iterator(); iterator.hasNext();)\r\n {\r\n name = firstFoundTableName(brokerForClass, brokerForClass.getClassDescriptor((Class) iterator.next()));\r\n // System.out.println(\"## \" + cld.getClassNameOfObject()+\" - name: \"+name);\r\n if (name != null) break;\r\n }\r\n }\r\n return name;\r\n }",
"public Where<T, ID> not() {\n\t\t/*\n\t\t * Special circumstance here when we have a needs future with a not. Something like and().not().like(...). In\n\t\t * this case we satisfy the and()'s future as the not() but the not() becomes the new needs-future.\n\t\t */\n\t\tNot not = new Not();\n\t\taddClause(not);\n\t\taddNeedsFuture(not);\n\t\treturn this;\n\t}",
"public static CmsResource getDescriptor(CmsObject cms, String basename) {\n\n CmsSolrQuery query = new CmsSolrQuery();\n query.setResourceTypes(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR.toString());\n query.setFilterQueries(\"filename:\\\"\" + basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX + \"\\\"\");\n query.add(\"fl\", \"path\");\n CmsSolrResultList results;\n try {\n boolean isOnlineProject = cms.getRequestContext().getCurrentProject().isOnlineProject();\n String indexName = isOnlineProject\n ? CmsSolrIndex.DEFAULT_INDEX_NAME_ONLINE\n : CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE;\n results = OpenCms.getSearchManager().getIndexSolr(indexName).search(cms, query, true, null, true, null);\n } catch (CmsSearchException e) {\n LOG.error(Messages.get().getBundle().key(Messages.ERR_BUNDLE_DESCRIPTOR_SEARCH_ERROR_0), e);\n return null;\n }\n\n switch (results.size()) {\n case 0:\n return null;\n case 1:\n return results.get(0);\n default:\n String files = \"\";\n for (CmsResource res : results) {\n files += \" \" + res.getRootPath();\n }\n LOG.warn(Messages.get().getBundle().key(Messages.ERR_BUNDLE_DESCRIPTOR_NOT_UNIQUE_1, files));\n return results.get(0);\n }\n }",
"private String formatTaskType(TaskType value)\n {\n return (LocaleData.getString(m_locale, (value == TaskType.FIXED_DURATION ? LocaleData.YES : LocaleData.NO)));\n }",
"public static int findFirstNonAnnotationLine(ASTNode node, SourceCode sourceCode) {\r\n if (node instanceof AnnotatedNode && !((AnnotatedNode) node).getAnnotations().isEmpty()) {\r\n\r\n // HACK: Groovy line numbers are broken when annotations have a parameter :(\r\n // so we must look at the lineNumber, not the lastLineNumber\r\n AnnotationNode lastAnnotation = null;\r\n for (AnnotationNode annotation : ((AnnotatedNode) node).getAnnotations()) {\r\n if (lastAnnotation == null) lastAnnotation = annotation;\r\n else if (lastAnnotation.getLineNumber() < annotation.getLineNumber()) lastAnnotation = annotation;\r\n }\r\n\r\n String rawLine = getRawLine(sourceCode, lastAnnotation.getLastLineNumber()-1);\r\n\r\n if(rawLine == null) {\r\n return node.getLineNumber();\r\n }\r\n\r\n // is the annotation the last thing on the line?\r\n if (rawLine.length() > lastAnnotation.getLastColumnNumber()) {\r\n // no it is not\r\n return lastAnnotation.getLastLineNumber();\r\n }\r\n // yes it is the last thing, return the next thing\r\n return lastAnnotation.getLastLineNumber() + 1;\r\n }\r\n return node.getLineNumber();\r\n }"
] |
Removes the task from wait q.
@param taskTobeRemoved
the task tobe removed
@return true, if successful | [
"public synchronized boolean removeTaskFromWaitQ(ParallelTask taskTobeRemoved) {\n boolean removed = false;\n for (ParallelTask task : waitQ) {\n if (task.getTaskId() == taskTobeRemoved.getTaskId()) {\n\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 removed = true;\n }\n }\n\n return removed;\n }"
] | [
"public static double elementMax( DMatrixSparseCSC A ) {\n if( A.nz_length == 0)\n return 0;\n\n // if every element is assigned a value then the first element can be a max.\n // Otherwise zero needs to be considered\n double max = A.isFull() ? A.nz_values[0] : 0;\n for(int i = 0; i < A.nz_length; i++ ) {\n double val = A.nz_values[i];\n if( val > max ) {\n max = val;\n }\n }\n\n return max;\n }",
"private void processOutlineCodeFields(Row parentRow) throws SQLException\n {\n Integer entityID = parentRow.getInteger(\"CODE_REF_UID\");\n Integer outlineCodeEntityID = parentRow.getInteger(\"CODE_UID\");\n\n for (ResultSetRow row : getRows(\"SELECT * FROM MSP_OUTLINE_CODES WHERE CODE_UID=?\", outlineCodeEntityID))\n {\n processOutlineCodeField(entityID, row);\n }\n }",
"@Override\n public ActivityInterface getActivityInterface() {\n if (activityInterface == null) {\n activityInterface = new ActivityInterface(apiKey, sharedSecret, transport);\n }\n return activityInterface;\n }",
"public static RebalanceTaskInfo decodeRebalanceTaskInfoMap(VAdminProto.RebalanceTaskInfoMap rebalanceTaskInfoMap) {\n RebalanceTaskInfo rebalanceTaskInfo = new RebalanceTaskInfo(\n rebalanceTaskInfoMap.getStealerId(),\n rebalanceTaskInfoMap.getDonorId(),\n decodeStoreToPartitionIds(rebalanceTaskInfoMap.getPerStorePartitionIdsList()),\n new ClusterMapper().readCluster(new StringReader(rebalanceTaskInfoMap.getInitialCluster())));\n return rebalanceTaskInfo;\n }",
"private void solveInternalL() {\n // This takes advantage of the diagonal elements always being real numbers\n\n // solve L*y=b storing y in x\n TriangularSolver_ZDRM.solveL_diagReal(t, vv, n);\n\n // solve L^T*x=y\n TriangularSolver_ZDRM.solveConjTranL_diagReal(t, vv, n);\n }",
"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 void main(String args[]) throws Exception {\n final StringBuffer buffer = new StringBuffer(\"The lazy fox\");\n Thread t1 = new Thread() {\n public void run() {\n synchronized(buffer) {\n buffer.delete(0,4);\n buffer.append(\" in the middle\");\n System.err.println(\"Middle\");\n try { Thread.sleep(4000); } catch(Exception e) {}\n buffer.append(\" of fall\");\n System.err.println(\"Fall\");\n }\n }\n };\n Thread t2 = new Thread() {\n public void run() {\n try { Thread.sleep(1000); } catch(Exception e) {}\n buffer.append(\" jump over the fence\");\n System.err.println(\"Fence\");\n }\n };\n t1.start();\n t2.start();\n\n t1.join();\n t2.join();\n System.err.println(buffer);\n }",
"private String 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 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}"
] |
Turn this profile on or off
@param enabled true or false
@return true on success, false otherwise | [
"public boolean toggleProfile(Boolean enabled) {\n // TODO: make this return values properly\n BasicNameValuePair[] params = {\n new BasicNameValuePair(\"active\", enabled.toString())\n };\n try {\n String uri = BASE_PROFILE + uriEncode(this._profileName) + \"/\" + BASE_CLIENTS + \"/\";\n if (_clientId == null) {\n uri += \"-1\";\n } else {\n uri += _clientId;\n }\n JSONObject response = new JSONObject(doPost(uri, params));\n } catch (Exception e) {\n // some sort of error\n System.out.println(e.getMessage());\n return false;\n }\n return true;\n }"
] | [
"protected void mergeSameWork(LinkedList<TimephasedWork> list)\n {\n LinkedList<TimephasedWork> result = new LinkedList<TimephasedWork>();\n\n TimephasedWork previousAssignment = null;\n for (TimephasedWork assignment : list)\n {\n if (previousAssignment == null)\n {\n assignment.setAmountPerDay(assignment.getTotalAmount());\n result.add(assignment);\n }\n else\n {\n Duration previousAssignmentWork = previousAssignment.getAmountPerDay();\n Duration assignmentWork = assignment.getTotalAmount();\n\n if (NumberHelper.equals(previousAssignmentWork.getDuration(), assignmentWork.getDuration(), 0.01))\n {\n Date assignmentStart = previousAssignment.getStart();\n Date assignmentFinish = assignment.getFinish();\n double total = previousAssignment.getTotalAmount().getDuration();\n total += assignmentWork.getDuration();\n Duration totalWork = Duration.getInstance(total, TimeUnit.MINUTES);\n\n TimephasedWork merged = new TimephasedWork();\n merged.setStart(assignmentStart);\n merged.setFinish(assignmentFinish);\n merged.setAmountPerDay(assignmentWork);\n merged.setTotalAmount(totalWork);\n\n result.removeLast();\n assignment = merged;\n }\n else\n {\n assignment.setAmountPerDay(assignment.getTotalAmount());\n }\n result.add(assignment);\n }\n\n previousAssignment = assignment;\n }\n\n list.clear();\n list.addAll(result);\n }",
"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 }",
"public static Iterable<Metadata> getAllMetadata(BoxItem item, String ... fields) {\n QueryStringBuilder builder = new QueryStringBuilder();\n if (fields.length > 0) {\n builder.appendParam(\"fields\", fields);\n }\n return new BoxResourceIterable<Metadata>(\n item.getAPI(),\n GET_ALL_METADATA_URL_TEMPLATE.buildWithQuery(item.getItemURL().toString(), builder.toString()),\n DEFAULT_LIMIT) {\n\n @Override\n protected Metadata factory(JsonObject jsonObject) {\n return new Metadata(jsonObject);\n }\n\n };\n }",
"public void forAllTables(String template, Properties attributes) throws XDocletException\r\n {\r\n for (Iterator it = _torqueModel.getTables(); it.hasNext(); )\r\n {\r\n _curTableDef = (TableDef)it.next();\r\n generate(template);\r\n }\r\n _curTableDef = null;\r\n }",
"public Number getCostVariance()\n {\n Number variance = (Number) getCachedValue(TaskField.COST_VARIANCE);\n if (variance == null)\n {\n Number cost = getCost();\n Number baselineCost = getBaselineCost();\n if (cost != null && baselineCost != null)\n {\n variance = NumberHelper.getDouble(cost.doubleValue() - baselineCost.doubleValue());\n set(TaskField.COST_VARIANCE, variance);\n }\n }\n return (variance);\n }",
"@Override\n public void onKeyDown(KeyDownEvent event) {\n\tchar c = MiscUtils.getCharCode(event.getNativeEvent());\n\tonKeyCodeEvent(event, box.getValue()+c);\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 static String getURLParentDirectory(String urlString) throws IllegalArgumentException {\n URL url = null;\n try {\n url = new URL(urlString);\n } catch (MalformedURLException e) {\n throw Exceptions.IllegalArgument(\"Malformed URL: %s\", url);\n }\n\n String path = url.getPath();\n int lastSlashIndex = path.lastIndexOf(\"/\");\n String directory = lastSlashIndex == -1 ? \"\" : path.substring(0, lastSlashIndex);\n return String.format(\"%s://%s%s%s%s\", url.getProtocol(),\n url.getUserInfo() == null ? \"\" : url.getUserInfo() + \"@\",\n url.getHost(),\n url.getPort() == -1 ? \"\" : \":\" + Integer.toString(url.getPort()),\n directory);\n }",
"public static base_response add(nitro_service client, spilloverpolicy resource) throws Exception {\n\t\tspilloverpolicy addresource = new spilloverpolicy();\n\t\taddresource.name = resource.name;\n\t\taddresource.rule = resource.rule;\n\t\taddresource.action = resource.action;\n\t\taddresource.comment = resource.comment;\n\t\treturn addresource.add_resource(client);\n\t}"
] |
decodes the uriFragment
@param res the resource that contains the feature holder
@param uriFragment the fragment that should be decoded
@return the decoded information
@see LazyURIEncoder#encode(EObject, EReference, INode) | [
"public Triple<EObject, EReference, INode> decode(Resource res, String uriFragment) {\n\t\tif (isUseIndexFragment(res)) {\n\t\t\treturn getLazyProxyInformation(res, uriFragment);\n\t\t}\n\t\tList<String> split = Strings.split(uriFragment, SEP);\n\t\tEObject source = resolveShortFragment(res, split.get(1));\n\t\tEReference ref = fromShortExternalForm(source.eClass(), split.get(2));\n\t\tINode compositeNode = NodeModelUtils.getNode(source);\n\t\tif (compositeNode==null)\n\t\t\tthrow new IllegalStateException(\"Couldn't resolve lazy link, because no node model is attached.\");\n\t\tINode textNode = getNode(compositeNode, split.get(3));\n\t\treturn Tuples.create(source, ref, textNode);\n\t}"
] | [
"private JsonArray formatBoxMetadataFilterRequest() {\n JsonArray boxMetadataFilterRequestArray = new JsonArray();\n\n JsonObject boxMetadataFilter = new JsonObject()\n .add(\"templateKey\", this.metadataFilter.getTemplateKey())\n .add(\"scope\", this.metadataFilter.getScope())\n .add(\"filters\", this.metadataFilter.getFiltersList());\n boxMetadataFilterRequestArray.add(boxMetadataFilter);\n\n return boxMetadataFilterRequestArray;\n }",
"private void clearMetadata(DeviceAnnouncement announcement) {\n final int player = announcement.getNumber();\n // Iterate over a copy to avoid concurrent modification issues\n for (DeckReference deck : new HashSet<DeckReference>(hotCache.keySet())) {\n if (deck.player == player) {\n hotCache.remove(deck);\n if (deck.hotCue == 0) {\n deliverTrackMetadataUpdate(player, null); // Inform listeners the metadata is gone.\n }\n }\n }\n }",
"public Resource addReference(Reference reference) {\n\t\tResource resource = this.rdfWriter.getUri(Vocabulary.getReferenceUri(reference));\n\n\t\tthis.referenceQueue.add(reference);\n\t\tthis.referenceSubjectQueue.add(resource);\n\n\t\treturn resource;\n\t}",
"public static WebDriverBackedEmbeddedBrowser withRemoteDriver(String hubUrl,\n\t\t\tImmutableSortedSet<String> filterAttributes, long crawlWaitEvent,\n\t\t\tlong crawlWaitReload) {\n\t\treturn WebDriverBackedEmbeddedBrowser.withDriver(buildRemoteWebDriver(hubUrl),\n\t\t\t\tfilterAttributes, crawlWaitEvent,\n\t\t\t\tcrawlWaitReload);\n\t}",
"public static base_responses kill(nitro_service client, systemsession resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tsystemsession killresources[] = new systemsession[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tkillresources[i] = new systemsession();\n\t\t\t\tkillresources[i].sid = resources[i].sid;\n\t\t\t\tkillresources[i].all = resources[i].all;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, killresources,\"kill\");\n\t\t}\n\t\treturn result;\n\t}",
"public DockerContainerObjectBuilder<T> withEnrichers(Collection<TestEnricher> enrichers) {\n if (enrichers == null) {\n throw new IllegalArgumentException(\"enrichers cannot be null\");\n }\n this.enrichers = enrichers;\n return this;\n }",
"public void sendMessageUntilStopCount(int stopCount) {\n\n // always send with valid data.\n for (int i = processedWorkerCount; i < workers.size(); ++i) {\n ActorRef worker = workers.get(i);\n try {\n\n /**\n * !!! This is a must; without this sleep; stuck occured at 5K.\n * AKKA seems cannot handle too much too fast message send out.\n */\n Thread.sleep(1L);\n\n } catch (InterruptedException e) {\n logger.error(\"sleep exception \" + e + \" details: \", e);\n }\n\n // send as if the sender is the origin manager; so reply back to\n // origin manager\n worker.tell(OperationWorkerMsgType.PROCESS_REQUEST, originalManager);\n\n processedWorkerCount++;\n\n if (processedWorkerCount > stopCount) {\n return;\n }\n\n logger.debug(\"REQ_SENT: {} / {} taskId {}\", \n processedWorkerCount, requestTotalCount, taskIdTrim);\n\n }// end for loop\n }",
"private void processFieldNameAliases(Map<Integer, FieldType> map, byte[] data)\n {\n if (data != null)\n {\n int offset = 0;\n int index = 0;\n CustomFieldContainer fields = m_file.getCustomFields();\n while (offset < data.length)\n {\n String alias = MPPUtility.getUnicodeString(data, offset);\n if (!alias.isEmpty())\n {\n FieldType field = map.get(Integer.valueOf(index));\n if (field != null)\n {\n fields.getCustomField(field).setAlias(alias);\n }\n }\n offset += (alias.length() + 1) * 2;\n index++;\n }\n }\n }",
"public void linkOneToOne(Object obj, ClassDescriptor cld, ObjectReferenceDescriptor rds, boolean insert)\n {\n storeAndLinkOneToOne(true, obj, cld, rds, true);\n }"
] |
Resolve the single type argument of the given generic interface against
the given target class which is assumed to implement the generic interface
and possibly declare a concrete type for its type variable.
@param clazz the target class to check against
@param genericIfc the generic interface or superclass to resolve the type argument from
@return the resolved type of the argument, or {@code null} if not resolvable | [
"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}"
] | [
"@Override protected Class getPrototypeClass(Video content) {\n Class prototypeClass;\n if (content.isFavorite()) {\n prototypeClass = FavoriteVideoRenderer.class;\n } else if (content.isLive()) {\n prototypeClass = LiveVideoRenderer.class;\n } else {\n prototypeClass = LikeVideoRenderer.class;\n }\n return prototypeClass;\n }",
"public void incrementVersion(int node, long time) {\n if(node < 0 || node > Short.MAX_VALUE)\n throw new IllegalArgumentException(node\n + \" is outside the acceptable range of node ids.\");\n\n this.timestamp = time;\n\n Long version = versionMap.get((short) node);\n if(version == null) {\n version = 1L;\n } else {\n version = version + 1L;\n }\n\n versionMap.put((short) node, version);\n if(versionMap.size() >= MAX_NUMBER_OF_VERSIONS) {\n throw new IllegalStateException(\"Vector clock is full!\");\n }\n\n }",
"public static void permutationVector( DMatrixSparseCSC P , int[] vector) {\n if( P.numCols != P.numRows ) {\n throw new MatrixDimensionException(\"Expected a square matrix\");\n } else if( P.nz_length != P.numCols ) {\n throw new IllegalArgumentException(\"Expected N non-zero elements in permutation matrix\");\n } else if( vector.length < P.numCols ) {\n throw new IllegalArgumentException(\"vector is too short\");\n }\n\n int M = P.numCols;\n\n for (int i = 0; i < M; i++) {\n if( P.col_idx[i+1] != i+1 )\n throw new IllegalArgumentException(\"Unexpected number of elements in a column\");\n\n vector[P.nz_rows[i]] = i;\n }\n }",
"public Date getBaselineFinish()\n {\n Object result = getCachedValue(TaskField.BASELINE_FINISH);\n if (result == null)\n {\n result = getCachedValue(TaskField.BASELINE_ESTIMATED_FINISH);\n }\n\n if (!(result instanceof Date))\n {\n result = null;\n }\n return (Date) result;\n }",
"public static base_response delete(nitro_service client, ntpserver resource) throws Exception {\n\t\tntpserver deleteresource = new ntpserver();\n\t\tdeleteresource.serverip = resource.serverip;\n\t\tdeleteresource.servername = resource.servername;\n\t\treturn deleteresource.delete_resource(client);\n\t}",
"private void computeUnnamedParams() {\n unnamedParams.addAll(rawArgs.stream().filter(arg -> !isNamedParam(arg)).collect(Collectors.toList()));\n }",
"public Jar addClass(Class<?> clazz) throws IOException {\n final String resource = clazz.getName().replace('.', '/') + \".class\";\n return addEntry(resource, clazz.getClassLoader().getResourceAsStream(resource));\n }",
"private static void checkPreconditions(final String dateFormat, final Locale locale) {\n\t\tif( dateFormat == null ) {\n\t\t\tthrow new NullPointerException(\"dateFormat should not be null\");\n\t\t} else if( locale == null ) {\n\t\t\tthrow new NullPointerException(\"locale should not be null\");\n\t\t}\n\t}",
"public Duration getWorkVariance()\n {\n Duration variance = (Duration) getCachedValue(ResourceField.WORK_VARIANCE);\n if (variance == null)\n {\n Duration work = getWork();\n Duration baselineWork = getBaselineWork();\n if (work != null && baselineWork != null)\n {\n variance = Duration.getInstance(work.getDuration() - baselineWork.convertUnits(work.getUnits(), getParentFile().getProjectProperties()).getDuration(), work.getUnits());\n set(ResourceField.WORK_VARIANCE, variance);\n }\n }\n return (variance);\n }"
] |
Adds the remaining tokens to the processed tokens list.
@param iter An iterator over the remaining tokens | [
"private void gobble(Iterator iter)\n {\n if (eatTheRest)\n {\n while (iter.hasNext())\n {\n tokens.add(iter.next());\n }\n }\n }"
] | [
"protected List<Reference> mergeReferences(\n\t\t\tList<? extends Reference> references1,\n\t\t\tList<? extends Reference> references2) {\n\t\tList<Reference> result = new ArrayList<>();\n\t\tfor (Reference reference : references1) {\n\t\t\taddBestReferenceToList(reference, result);\n\t\t}\n\t\tfor (Reference reference : references2) {\n\t\t\taddBestReferenceToList(reference, result);\n\t\t}\n\t\treturn result;\n\t}",
"public static void stopService() {\n DaemonStarter.currentPhase.set(LifecyclePhase.STOPPING);\n final CountDownLatch cdl = new CountDownLatch(1);\n Executors.newSingleThreadExecutor().execute(() -> {\n DaemonStarter.getLifecycleListener().stopping();\n DaemonStarter.daemon.stop();\n cdl.countDown();\n });\n\n try {\n int timeout = DaemonStarter.lifecycleListener.get().getShutdownTimeoutSeconds();\n if (!cdl.await(timeout, TimeUnit.SECONDS)) {\n DaemonStarter.rlog.error(\"Failed to stop gracefully\");\n DaemonStarter.abortSystem();\n }\n } catch (InterruptedException e) {\n DaemonStarter.rlog.error(\"Failure awaiting stop\", e);\n Thread.currentThread().interrupt();\n }\n\n }",
"public void bindDelete(PreparedStatement stmt, ClassDescriptor cld, Object obj) throws SQLException\r\n {\r\n if (cld.getDeleteProcedure() != null)\r\n {\r\n this.bindProcedure(stmt, cld, obj, cld.getDeleteProcedure());\r\n }\r\n else\r\n {\r\n int index = 1;\r\n ValueContainer[] values, currentLockingValues;\r\n\r\n currentLockingValues = cld.getCurrentLockingValues(obj);\r\n // parameters for WHERE-clause pk\r\n values = getKeyValues(m_broker, cld, obj);\r\n for (int i = 0; i < values.length; i++)\r\n {\r\n setObjectForStatement(stmt, index, values[i].getValue(), values[i].getJdbcType().getType());\r\n index++;\r\n }\r\n\r\n // parameters for WHERE-clause locking\r\n values = currentLockingValues;\r\n for (int i = 0; i < values.length; i++)\r\n {\r\n setObjectForStatement(stmt, index, values[i].getValue(), values[i].getJdbcType().getType());\r\n index++;\r\n }\r\n }\r\n }",
"private String getClassLabel(EntityIdValue entityIdValue) {\n\t\tClassRecord classRecord = this.classRecords.get(entityIdValue);\n\t\tString label;\n\t\tif (classRecord == null || classRecord.itemDocument == null) {\n\t\t\tlabel = entityIdValue.getId();\n\t\t} else {\n\t\t\tlabel = getLabel(entityIdValue, classRecord.itemDocument);\n\t\t}\n\n\t\tEntityIdValue labelOwner = this.labels.get(label);\n\t\tif (labelOwner == null) {\n\t\t\tthis.labels.put(label, entityIdValue);\n\t\t\treturn label;\n\t\t} else if (labelOwner.equals(entityIdValue)) {\n\t\t\treturn label;\n\t\t} else {\n\t\t\treturn label + \" (\" + entityIdValue.getId() + \")\";\n\t\t}\n\t}",
"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 List<? super OpenShiftResource> processTemplateResources() {\n List<? extends OpenShiftResource> resources;\n final List<? super OpenShiftResource> processedResources = new ArrayList<>();\n templates = OpenShiftResourceFactory.getTemplates(getType());\n boolean sync_instantiation = OpenShiftResourceFactory.syncInstantiation(getType());\n\n /* Instantiate templates */\n for (Template template : templates) {\n resources = processTemplate(template);\n if (resources != null) {\n if (sync_instantiation) {\n /* synchronous template instantiation */\n processedResources.addAll(resources);\n } else {\n /* asynchronous template instantiation */\n try {\n delay(openShiftAdapter, resources);\n } catch (Throwable t) {\n throw new IllegalArgumentException(asynchronousDelayErrorMessage(), t);\n }\n }\n }\n }\n\n return processedResources;\n }",
"public TransformersSubRegistration getServerRegistration(final ModelVersionRange range) {\n final PathAddress address = PathAddress.EMPTY_ADDRESS.append(HOST, SERVER);\n return new TransformersSubRegistrationImpl(range, domain, address);\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 ImageSource apply(ImageSource input) {\n ImageSource originalImage = input;\n\n int width = originalImage.getWidth();\n int height = originalImage.getHeight();\n\n boolean[][] matrix = new boolean[width][height]; // black n white boolean matrix; true = blck, false = white\n\n // Copy\n ImageSource filteredImage = new MatrixSource(input);\n\n int[] histogram = OtsuBinarize.imageHistogram(originalImage);\n\n int totalNumberOfpixels = height * width;\n\n int threshold = OtsuBinarize.threshold(histogram, totalNumberOfpixels);\n\n int black = 0;\n int white = 255;\n\n int gray;\n int alpha;\n int newColor;\n\n for (int i = 0; i < width; i++) {\n for (int j = 0; j < height; j++) {\n gray = originalImage.getGray(i, j);\n\n if (gray > threshold) {\n matrix[i][j] = false;\n } else {\n matrix[i][j] = true;\n }\n\n }\n }\n\n int blackTreshold = letterThreshold(originalImage, matrix);\n\n for (int i = 0; i < width; i++) {\n for (int j = 0; j < height; j++) {\n gray = originalImage.getGray(i, j);\n alpha = originalImage.getA(i, j);\n\n if (gray > blackTreshold) {\n newColor = white;\n } else {\n newColor = black;\n }\n\n newColor = ColorHelper.getARGB(newColor, newColor, newColor, alpha);\n filteredImage.setRGB(i, j, newColor);\n }\n }\n\n return filteredImage;\n }"
] |
Common method for creating styles.
@param template the template that the map is part of
@param styleRef the style ref identifying the style
@param <T> the source type | [
"protected final <T> StyleSupplier<T> createStyleSupplier(\n final Template template,\n final String styleRef) {\n return new StyleSupplier<T>() {\n @Override\n public Style load(\n final MfClientHttpRequestFactory requestFactory,\n final T featureSource) {\n final StyleParser parser = AbstractGridCoverageLayerPlugin.this.styleParser;\n return OptionalUtils.or(\n () -> template.getStyle(styleRef),\n () -> parser.loadStyle(template.getConfiguration(), requestFactory, styleRef))\n .orElse(template.getConfiguration().getDefaultStyle(NAME));\n }\n };\n }"
] | [
"public static DMatrixRMaj extractRow(DMatrixRMaj a , int row , DMatrixRMaj out ) {\n if( out == null)\n out = new DMatrixRMaj(1,a.numCols);\n else if( !MatrixFeatures_DDRM.isVector(out) || out.getNumElements() != a.numCols )\n throw new MatrixDimensionException(\"Output must be a vector of length \"+a.numCols);\n\n System.arraycopy(a.data,a.getIndex(row,0),out.data,0,a.numCols);\n\n return out;\n }",
"private Priority getPriority(Integer gpPriority)\n {\n int result;\n if (gpPriority == null)\n {\n result = Priority.MEDIUM;\n }\n else\n {\n int index = gpPriority.intValue();\n if (index < 0 || index >= PRIORITY.length)\n {\n result = Priority.MEDIUM;\n }\n else\n {\n result = PRIORITY[index];\n }\n }\n return Priority.getInstance(result);\n }",
"@Override\n public void clear() {\n values.clear();\n listBox.clear();\n\n clearStatusText();\n if (emptyPlaceHolder != null) {\n insertEmptyPlaceHolder(emptyPlaceHolder);\n }\n reload();\n if (isAllowBlank()) {\n addBlankItemIfNeeded();\n }\n }",
"public static String[] tokenizeUnquoted(String s) {\r\n List tokens = new LinkedList();\r\n int first = 0;\r\n while (first < s.length()) {\r\n first = skipWhitespace(s, first);\r\n int last = scanToken(s, first);\r\n if (first < last) {\r\n tokens.add(s.substring(first, last));\r\n }\r\n first = last;\r\n }\r\n return (String[])tokens.toArray(new String[tokens.size()]);\r\n }",
"@Nonnull\n\tprivate static Properties findDefaultProperties() {\n\t\tfinal InputStream in = SourceCodeFormatter.class.getClassLoader().getResourceAsStream(DEFAULT_PROPERTIES_PATH);\n\t\tfinal Properties p = new Properties();\n\t\ttry {\n\t\t\tp.load(in);\n\t\t} catch (final IOException e) {\n\t\t\tthrow new RuntimeException(String.format(\"Can not load resource %s\", DEFAULT_PROPERTIES_PATH));\n\t\t}\n\t\treturn p;\n\t}",
"public <T extends Widget & Checkable> List<T> getCheckedWidgets() {\n List<T> checked = new ArrayList<>();\n\n for (Widget c : getChildren()) {\n if (c instanceof Checkable && ((Checkable) c).isChecked()) {\n checked.add((T) c);\n }\n }\n\n return checked;\n }",
"protected void setBandsFinalHeight() {\n log.debug(\"Setting bands final height...\");\n\n List<JRBand> bands = new ArrayList<JRBand>();\n\n Utils.addNotNull(bands, design.getPageHeader());\n Utils.addNotNull(bands, design.getPageFooter());\n Utils.addNotNull(bands, design.getColumnHeader());\n Utils.addNotNull(bands, design.getColumnFooter());\n Utils.addNotNull(bands, design.getSummary());\n Utils.addNotNull(bands, design.getBackground());\n bands.addAll(((JRDesignSection) design.getDetailSection()).getBandsList());\n Utils.addNotNull(bands, design.getLastPageFooter());\n Utils.addNotNull(bands, design.getTitle());\n Utils.addNotNull(bands, design.getPageFooter());\n Utils.addNotNull(bands, design.getNoData());\n\n for (JRGroup jrgroup : design.getGroupsList()) {\n DJGroup djGroup = (DJGroup) getReferencesMap().get(jrgroup.getName());\n JRDesignSection headerSection = (JRDesignSection) jrgroup.getGroupHeaderSection();\n JRDesignSection footerSection = (JRDesignSection) jrgroup.getGroupFooterSection();\n if (djGroup != null) {\n for (JRBand headerBand : headerSection.getBandsList()) {\n setBandFinalHeight((JRDesignBand) headerBand, djGroup.getHeaderHeight(), djGroup.isFitHeaderHeightToContent());\n\n }\n for (JRBand footerBand : footerSection.getBandsList()) {\n setBandFinalHeight((JRDesignBand) footerBand, djGroup.getFooterHeight(), djGroup.isFitFooterHeightToContent());\n\n }\n } else {\n bands.addAll(headerSection.getBandsList());\n bands.addAll(footerSection.getBandsList());\n }\n }\n\n for (JRBand jrDesignBand : bands) {\n setBandFinalHeight((JRDesignBand) jrDesignBand);\n }\n }",
"private void logOriginalRequestHistory(String requestType,\n HttpServletRequest request, History history) {\n logger.info(\"Storing original request history\");\n history.setRequestType(requestType);\n history.setOriginalRequestHeaders(HttpUtilities.getHeaders(request));\n history.setOriginalRequestURL(request.getRequestURL().toString());\n history.setOriginalRequestParams(request.getQueryString() == null ? \"\" : request.getQueryString());\n logger.info(\"Done storing\");\n }",
"public int bindShader(GVRContext context, GVRShaderData material, String vertexDesc)\n {\n String signature = getClass().getSimpleName();\n GVRShaderManager shaderManager = context.getShaderManager();\n\n synchronized (shaderManager)\n {\n int nativeShader = shaderManager.getShader(signature);\n if (nativeShader == 0)\n {\n nativeShader = addShader(shaderManager, signature, material);\n }\n return nativeShader;\n }\n }"
] |
Registers all custom Externalizer implementations that Hibernate OGM needs into an Infinispan CacheManager
configuration.
@see ExternalizerIds
@param cfg the Serialization section of a GlobalConfiguration builder | [
"public static void registerOgmExternalizers(SerializationConfigurationBuilder cfg) {\n\t\tfor ( AdvancedExternalizer<?> advancedExternalizer : ogmExternalizers.values() ) {\n\t\t\tcfg.addAdvancedExternalizer( advancedExternalizer );\n\t\t}\n\t}"
] | [
"public Number getPercentageWorkComplete()\n {\n Number pct = (Number) getCachedValue(AssignmentField.PERCENT_WORK_COMPLETE);\n if (pct == null)\n {\n Duration actualWork = getActualWork();\n Duration work = getWork();\n if (actualWork != null && work != null && work.getDuration() != 0)\n {\n pct = Double.valueOf((actualWork.getDuration() * 100) / work.convertUnits(actualWork.getUnits(), getParentFile().getProjectProperties()).getDuration());\n set(AssignmentField.PERCENT_WORK_COMPLETE, pct);\n }\n }\n return pct;\n }",
"public static boolean isLong(CharSequence self) {\n try {\n Long.valueOf(self.toString().trim());\n return true;\n } catch (NumberFormatException nfe) {\n return false;\n }\n }",
"public static Drawable decideIcon(ImageHolder imageHolder, Context ctx, int iconColor, boolean tint) {\n if (imageHolder == null) {\n return null;\n } else {\n return imageHolder.decideIcon(ctx, iconColor, tint);\n }\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 }",
"public static int getCount(Matcher matcher) {\n int counter = 0;\n matcher.reset();\n while (matcher.find()) {\n counter++;\n }\n return counter;\n }",
"public static sslcertkey[] get(nitro_service service, String certkey[]) throws Exception{\n\t\tif (certkey !=null && certkey.length>0) {\n\t\t\tsslcertkey response[] = new sslcertkey[certkey.length];\n\t\t\tsslcertkey obj[] = new sslcertkey[certkey.length];\n\t\t\tfor (int i=0;i<certkey.length;i++) {\n\t\t\t\tobj[i] = new sslcertkey();\n\t\t\t\tobj[i].set_certkey(certkey[i]);\n\t\t\t\tresponse[i] = (sslcertkey) obj[i].get_resource(service);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t\treturn null;\n\t}",
"public static String compactToString(ModelNode node) {\n Objects.requireNonNull(node);\n final StringWriter stringWriter = new StringWriter();\n final PrintWriter writer = new PrintWriter(stringWriter, true);\n node.writeString(writer, true);\n return stringWriter.toString();\n }",
"public static final Boolean parseExtendedAttributeBoolean(String value)\n {\n return ((value.equals(\"1\") ? Boolean.TRUE : Boolean.FALSE));\n }",
"public static CompressionType getDumpFileCompressionType(String fileName) {\n\t\tif (fileName.endsWith(\".gz\")) {\n\t\t\treturn CompressionType.GZIP;\n\t\t} else if (fileName.endsWith(\".bz2\")) {\n\t\t\treturn CompressionType.BZ2;\n\t\t} else {\n\t\t\treturn CompressionType.NONE;\n\t\t}\n\t}"
] |
This will create a line in the SDEF file for each calendar
if there are more than 9 calendars, you'll have a big error,
as USACE numbers them 0-9.
@param records list of ProjectCalendar instances | [
"private void writeCalendars(List<ProjectCalendar> records)\n {\n\n //\n // Write project calendars\n //\n for (ProjectCalendar record : records)\n {\n m_buffer.setLength(0);\n m_buffer.append(\"CLDR \");\n m_buffer.append(SDEFmethods.lset(record.getUniqueID().toString(), 2)); // 2 character used, USACE allows 1\n String workDays = SDEFmethods.workDays(record); // custom line, like NYYYYYN for a week\n m_buffer.append(SDEFmethods.lset(workDays, 8));\n m_buffer.append(SDEFmethods.lset(record.getName(), 30));\n m_writer.println(m_buffer);\n }\n }"
] | [
"public static int scale(Double factor, int pixel) {\n return rgb(\n (int) Math.round(factor * red(pixel)),\n (int) Math.round(factor * green(pixel)),\n (int) Math.round(factor * blue(pixel))\n );\n }",
"private synchronized Response doAuthenticatedRequest(\n final StitchAuthRequest stitchReq,\n final AuthInfo authInfo\n ) {\n try {\n return requestClient.doRequest(prepareAuthRequest(stitchReq, authInfo));\n } catch (final StitchServiceException ex) {\n return handleAuthFailure(ex, stitchReq);\n }\n }",
"private void readAssignments(Resource mpxjResource, net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource res)\n {\n for (Assignment assignment : res.getAssignment())\n {\n readAssignment(mpxjResource, assignment);\n }\n }",
"public static MetadataTemplate createMetadataTemplate(BoxAPIConnection api, String scope, String templateKey,\n String displayName, boolean hidden, List<Field> fields) {\n\n JsonObject jsonObject = new JsonObject();\n jsonObject.add(\"scope\", scope);\n jsonObject.add(\"displayName\", displayName);\n jsonObject.add(\"hidden\", hidden);\n\n if (templateKey != null) {\n jsonObject.add(\"templateKey\", templateKey);\n }\n\n JsonArray fieldsArray = new JsonArray();\n if (fields != null && !fields.isEmpty()) {\n for (Field field : fields) {\n JsonObject fieldObj = getFieldJsonObject(field);\n\n fieldsArray.add(fieldObj);\n }\n\n jsonObject.add(\"fields\", fieldsArray);\n }\n\n URL url = METADATA_TEMPLATE_SCHEMA_URL_TEMPLATE.build(api.getBaseURL());\n BoxJSONRequest request = new BoxJSONRequest(api, url, \"POST\");\n request.setBody(jsonObject.toString());\n\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n\n return new MetadataTemplate(responseJSON);\n }",
"public void store(Object obj) throws PersistenceBrokerException\n {\n obj = extractObjectToStore(obj);\n // only do something if obj != null\n if(obj == null) return;\n\n ClassDescriptor cld = getClassDescriptor(obj.getClass());\n /*\n if one of the PK fields was null, we assume the objects\n was new and needs insert\n */\n boolean insert = serviceBrokerHelper().hasNullPKField(cld, obj);\n Identity oid = serviceIdentity().buildIdentity(cld, obj);\n /*\n if PK values are set, lookup cache or db to see whether object\n needs insert or update\n */\n if (!insert)\n {\n insert = objectCache.lookup(oid) == null\n && !serviceBrokerHelper().doesExist(cld, oid, obj);\n }\n store(obj, oid, cld, insert);\n }",
"public static final PatchOperationTarget createLocal(final File jbossHome, List<File> moduleRoots, List<File> bundlesRoots) throws IOException {\n final PatchTool tool = PatchTool.Factory.createLocalTool(jbossHome, moduleRoots, bundlesRoots);\n return new LocalPatchOperationTarget(tool);\n }",
"public static auditmessages[] get(nitro_service service) throws Exception{\n\t\tauditmessages obj = new auditmessages();\n\t\tauditmessages[] response = (auditmessages[])obj.get_resources(service);\n\t\treturn response;\n\t}",
"protected long save() {\n // save leaf nodes\n ReclaimFlag flag = saveChildren();\n // save self. complementary to {@link load()}\n final byte type = getType();\n final BTreeBase tree = getTree();\n final int structureId = tree.structureId;\n final Log log = tree.log;\n if (flag == ReclaimFlag.PRESERVE) {\n // there is a chance to update the flag to RECLAIM\n if (log.getWrittenHighAddress() % log.getFileLengthBound() == 0) {\n // page will be exactly on file border\n flag = ReclaimFlag.RECLAIM;\n } else {\n final ByteIterable[] iterables = getByteIterables(flag);\n long result = log.tryWrite(type, structureId, new CompoundByteIterable(iterables));\n if (result < 0) {\n iterables[0] = CompressedUnsignedLongByteIterable.getIterable(\n (size << 1) + ReclaimFlag.RECLAIM.value\n );\n result = log.writeContinuously(type, structureId, new CompoundByteIterable(iterables));\n\n if (result < 0) {\n throw new TooBigLoggableException();\n }\n }\n return result;\n }\n }\n return log.write(type, structureId, new CompoundByteIterable(getByteIterables(flag)));\n }",
"public static final double getDouble(String value)\n {\n return (value == null || value.length() == 0 ? 0 : Double.parseDouble(value));\n }"
] |
Returns the spread value such that the sum of cash flows of the bond discounted with a given reference curve
with the additional spread coincides with a given price.
@param bondPrice The target price as double.
@param referenceCurve The reference curve used for discounting the coupon payments.
@param model The model under which the product is valued.
@return The optimal spread value. | [
"public double getSpread(double bondPrice, Curve referenceCurve, AnalyticModel model) {\n\t\tGoldenSectionSearch search = new GoldenSectionSearch(-2.0, 2.0);\n\t\twhile(search.getAccuracy() > 1E-11 && !search.isDone()) {\n\t\t\tdouble x = search.getNextPoint();\n\t\t\tdouble fx=getValueWithGivenSpreadOverCurve(0.0,referenceCurve,x,model);\n\t\t\tdouble y = (bondPrice-fx)*(bondPrice-fx);\n\n\t\t\tsearch.setValue(y);\n\t\t}\n\t\treturn search.getBestPoint();\n\t}"
] | [
"public static DMatrixRMaj convert(DMatrixRBlock src , DMatrixRMaj dst )\n {\n return ConvertDMatrixStruct.convert(src,dst);\n }",
"public static void removeFromList(List<String> list, String value) {\n int foundIndex = -1;\n int i = 0;\n for (String id : list) {\n if (id.equalsIgnoreCase(value)) {\n foundIndex = i;\n break;\n }\n i++;\n }\n if (foundIndex != -1) {\n list.remove(foundIndex);\n }\n }",
"private void ensurePKsFromHierarchy(ClassDescriptorDef classDef) throws ConstraintException\r\n {\r\n SequencedHashMap pks = new SequencedHashMap();\r\n\r\n for (Iterator it = classDef.getAllExtentClasses(); it.hasNext();)\r\n {\r\n ClassDescriptorDef subTypeDef = (ClassDescriptorDef)it.next();\r\n\r\n ArrayList subPKs = subTypeDef.getPrimaryKeys();\r\n\r\n // check against already present PKs\r\n for (Iterator pkIt = subPKs.iterator(); pkIt.hasNext();)\r\n {\r\n FieldDescriptorDef fieldDef = (FieldDescriptorDef)pkIt.next();\r\n FieldDescriptorDef foundPKDef = (FieldDescriptorDef)pks.get(fieldDef.getName());\r\n\r\n if (foundPKDef != null)\r\n {\r\n if (!isEqual(fieldDef, foundPKDef))\r\n {\r\n throw new ConstraintException(\"Cannot pull up the declaration of the required primary key \"+fieldDef.getName()+\r\n \" because its definitions in \"+fieldDef.getOwner().getName()+\" and \"+\r\n foundPKDef.getOwner().getName()+\" differ\");\r\n }\r\n }\r\n else\r\n {\r\n pks.put(fieldDef.getName(), fieldDef);\r\n }\r\n }\r\n }\r\n\r\n ensureFields(classDef, pks.values());\r\n }",
"public static base_response add(nitro_service client, gslbsite resource) throws Exception {\n\t\tgslbsite addresource = new gslbsite();\n\t\taddresource.sitename = resource.sitename;\n\t\taddresource.sitetype = resource.sitetype;\n\t\taddresource.siteipaddress = resource.siteipaddress;\n\t\taddresource.publicip = resource.publicip;\n\t\taddresource.metricexchange = resource.metricexchange;\n\t\taddresource.nwmetricexchange = resource.nwmetricexchange;\n\t\taddresource.sessionexchange = resource.sessionexchange;\n\t\taddresource.triggermonitor = resource.triggermonitor;\n\t\taddresource.parentsite = resource.parentsite;\n\t\treturn addresource.add_resource(client);\n\t}",
"private long getTime(Date start, Date end)\n {\n long total = 0;\n if (start != null && end != null)\n {\n Date startTime = DateHelper.getCanonicalTime(start);\n Date endTime = DateHelper.getCanonicalTime(end);\n\n Date startDay = DateHelper.getDayStartDate(start);\n Date finishDay = DateHelper.getDayStartDate(end);\n\n //\n // Handle the case where the end of the range is at midnight -\n // this will show up as the start and end days not matching\n //\n if (startDay.getTime() != finishDay.getTime())\n { \n endTime = DateHelper.addDays(endTime, 1);\n }\n\n total = (endTime.getTime() - startTime.getTime());\n }\n return (total);\n }",
"private void parse(String header)\n {\n ArrayList<String> list = new ArrayList<String>(4);\n StringBuilder sb = new StringBuilder();\n int index = 1;\n while (index < header.length())\n {\n char c = header.charAt(index++);\n if (Character.isDigit(c))\n {\n sb.append(c);\n }\n else\n {\n if (sb.length() != 0)\n {\n list.add(sb.toString());\n sb.setLength(0);\n }\n }\n }\n\n if (sb.length() != 0)\n {\n list.add(sb.toString());\n }\n\n m_id = list.get(0);\n m_sequence = Integer.parseInt(list.get(1));\n m_type = Integer.valueOf(list.get(2));\n if (list.size() > 3)\n {\n m_subtype = Integer.parseInt(list.get(3));\n }\n }",
"protected void setColumnsFinalWidth() {\n log.debug(\"Setting columns final width.\");\n float factor;\n int printableArea = report.getOptions().getColumnWidth();\n\n //Create a list with only the visible columns.\n List visibleColums = getVisibleColumns();\n\n\n if (report.getOptions().isUseFullPageWidth()) {\n int columnsWidth = 0;\n int notRezisableWidth = 0;\n\n //Store in a variable the total with of all visible columns\n for (Object visibleColum : visibleColums) {\n AbstractColumn col = (AbstractColumn) visibleColum;\n columnsWidth += col.getWidth();\n if (col.isFixedWidth())\n notRezisableWidth += col.getWidth();\n }\n\n\n factor = (float) (printableArea - notRezisableWidth) / (float) (columnsWidth - notRezisableWidth);\n\n log.debug(\"printableArea = \" + printableArea\n + \", columnsWidth = \" + columnsWidth\n + \", columnsWidth = \" + columnsWidth\n + \", notRezisableWidth = \" + notRezisableWidth\n + \", factor = \" + factor);\n\n int acumulated = 0;\n int colFinalWidth;\n\n //Select the non-resizable columns\n Collection resizableColumns = CollectionUtils.select(visibleColums, new Predicate() {\n public boolean evaluate(Object arg0) {\n return !((AbstractColumn) arg0).isFixedWidth();\n }\n\n });\n\n //Finally, set the new width to the resizable columns\n for (Iterator iter = resizableColumns.iterator(); iter.hasNext(); ) {\n AbstractColumn col = (AbstractColumn) iter.next();\n\n if (!iter.hasNext()) {\n col.setWidth(printableArea - notRezisableWidth - acumulated);\n } else {\n colFinalWidth = (new Float(col.getWidth() * factor)).intValue();\n acumulated += colFinalWidth;\n col.setWidth(colFinalWidth);\n }\n }\n }\n\n // If the columns width changed, the X position must be setted again.\n int posx = 0;\n for (Object visibleColum : visibleColums) {\n AbstractColumn col = (AbstractColumn) visibleColum;\n col.setPosX(posx);\n posx += col.getWidth();\n }\n }",
"public static HashMap<String, JSONObject> flatRessources(JSONObject object) throws JSONException {\n HashMap<String, JSONObject> result = new HashMap<String, JSONObject>();\n\n // no cycle in hierarchies!!\n if (object.has(\"resourceId\") && object.has(\"childShapes\")) {\n result.put(object.getString(\"resourceId\"),\n object);\n JSONArray childShapes = object.getJSONArray(\"childShapes\");\n for (int i = 0; i < childShapes.length(); i++) {\n result.putAll(flatRessources(childShapes.getJSONObject(i)));\n }\n }\n ;\n\n return result;\n }",
"public void stop(int waitMillis) throws InterruptedException {\n try {\n if (!isDone()) {\n setExitStatus(new Event(EventType.STOPPED_BY_USER, String.format(\"Stopped by user: waiting for %d ms\", waitMillis)));\n }\n if (!waitForFinish(waitMillis)) {\n logger.warn(\"{} Client thread failed to finish in {} millis\", name, waitMillis);\n }\n } finally {\n rateTracker.shutdown();\n }\n }"
] |
Remove a server mapping from current profile by ID
@param serverMappingId server mapping ID
@return Collection of updated ServerRedirects | [
"public List<ServerRedirect> deleteServerMapping(int serverMappingId) {\n ArrayList<ServerRedirect> servers = new ArrayList<ServerRedirect>();\n try {\n JSONArray serverArray = new JSONArray(doDelete(BASE_SERVER + \"/\" + serverMappingId, null));\n for (int i = 0; i < serverArray.length(); i++) {\n JSONObject jsonServer = serverArray.getJSONObject(i);\n ServerRedirect server = getServerRedirectFromJSON(jsonServer);\n if (server != null) {\n servers.add(server);\n }\n }\n } catch (Exception e) {\n e.printStackTrace();\n return null;\n }\n\n return servers;\n }"
] | [
"protected boolean isStoreValid() {\n boolean result = false;\n String requestURI = this.request.getUri();\n this.storeName = parseStoreName(requestURI);\n if(storeName != null) {\n result = true;\n } else {\n logger.error(\"Error when validating request. Missing store name.\");\n RestErrorHandler.writeErrorResponse(this.messageEvent,\n HttpResponseStatus.BAD_REQUEST,\n \"Missing store name. Critical error.\");\n }\n return result;\n }",
"public static snmpalarm[] get(nitro_service service) throws Exception{\n\t\tsnmpalarm obj = new snmpalarm();\n\t\tsnmpalarm[] response = (snmpalarm[])obj.get_resources(service);\n\t\treturn response;\n\t}",
"public final void setExceptions(SortedSet<Date> dates) {\n\n m_exceptions.clear();\n if (null != dates) {\n m_exceptions.addAll(dates);\n }\n\n }",
"private void ensureLength(FieldDescriptorDef fieldDef, String checkLevel)\r\n {\r\n if (!fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_LENGTH))\r\n {\r\n String defaultLength = JdbcTypeHelper.getDefaultLengthFor(fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE));\r\n\r\n if (defaultLength != null)\r\n {\r\n LogHelper.warn(true,\r\n FieldDescriptorConstraints.class,\r\n \"ensureLength\",\r\n \"The field \"+fieldDef.getName()+\" in class \"+fieldDef.getOwner().getName()+\" has no length setting though its jdbc type requires it (in most databases); using default length of \"+defaultLength);\r\n fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_LENGTH, defaultLength);\r\n }\r\n }\r\n }",
"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 }",
"private void initPatternButtonGroup() {\n\n m_groupPattern = new CmsRadioButtonGroup();\n m_patternButtons = new HashMap<>();\n\n createAndAddButton(PatternType.DAILY, Messages.GUI_SERIALDATE_TYPE_DAILY_0);\n m_patternButtons.put(PatternType.NONE, m_patternButtons.get(PatternType.DAILY));\n createAndAddButton(PatternType.WEEKLY, Messages.GUI_SERIALDATE_TYPE_WEEKLY_0);\n createAndAddButton(PatternType.MONTHLY, Messages.GUI_SERIALDATE_TYPE_MONTHLY_0);\n createAndAddButton(PatternType.YEARLY, Messages.GUI_SERIALDATE_TYPE_YEARLY_0);\n // createAndAddButton(PatternType.INDIVIDUAL, Messages.GUI_SERIALDATE_TYPE_INDIVIDUAL_0);\n\n m_groupPattern.addValueChangeHandler(new ValueChangeHandler<String>() {\n\n public void onValueChange(ValueChangeEvent<String> event) {\n\n if (handleChange()) {\n String value = event.getValue();\n if (value != null) {\n m_controller.setPattern(value);\n }\n }\n }\n });\n\n }",
"public DownloadRequest addCustomHeader(String key, String value) {\n mCustomHeader.put(key, value);\n return this;\n }",
"public static String getFailureDescriptionAsString(final ModelNode result) {\n if (isSuccessfulOutcome(result)) {\n return \"\";\n }\n final String msg;\n if (result.hasDefined(ClientConstants.FAILURE_DESCRIPTION)) {\n if (result.hasDefined(ClientConstants.OP)) {\n msg = String.format(\"Operation '%s' at address '%s' failed: %s\", result.get(ClientConstants.OP), result.get(ClientConstants.OP_ADDR), result\n .get(ClientConstants.FAILURE_DESCRIPTION));\n } else {\n msg = String.format(\"Operation failed: %s\", result.get(ClientConstants.FAILURE_DESCRIPTION));\n }\n } else {\n msg = String.format(\"An unexpected response was found checking the deployment. Result: %s\", result);\n }\n return msg;\n }",
"public static appfwlearningsettings[] get(nitro_service service) throws Exception{\n\t\tappfwlearningsettings obj = new appfwlearningsettings();\n\t\tappfwlearningsettings[] response = (appfwlearningsettings[])obj.get_resources(service);\n\t\treturn response;\n\t}"
] |
Throw IllegalArgumentException if the value is null.
@param name the parameter name.
@param value the value that should not be null.
@param <T> the value type.
@throws IllegalArgumentException if value is null. | [
"public static <T> void notNull(final String name, final T value) {\n if (value == null) {\n throw new IllegalArgumentException(name + \" can not be null\");\n }\n }"
] | [
"public <T> T find(Class<T> classType, String id, String rev) {\n assertNotEmpty(classType, \"Class\");\n assertNotEmpty(id, \"id\");\n assertNotEmpty(id, \"rev\");\n final URI uri = new DatabaseURIHelper(dbUri).documentUri(id, \"rev\", rev);\n return couchDbClient.get(uri, classType);\n }",
"public void performImplicitSingleStep(double scale , double lambda , boolean byAngle) {\n createBulge(x1,lambda,scale,byAngle);\n\n for( int i = x1; i < x2-1 && bulge != 0.0; i++ ) {\n removeBulgeLeft(i,true);\n if( bulge == 0 )\n break;\n removeBulgeRight(i);\n }\n\n if( bulge != 0 )\n removeBulgeLeft(x2-1,false);\n\n incrementSteps();\n }",
"public static <T> T callConstructor(Class<T> klass) {\n return callConstructor(klass, new Class<?>[0], new Object[0]);\n }",
"public static long getGcTimestamp(String zookeepers) {\n ZooKeeper zk = null;\n try {\n zk = new ZooKeeper(zookeepers, 30000, null);\n\n // wait until zookeeper is connected\n long start = System.currentTimeMillis();\n while (!zk.getState().isConnected() && System.currentTimeMillis() - start < 30000) {\n Uninterruptibles.sleepUninterruptibly(10, TimeUnit.MILLISECONDS);\n }\n\n byte[] d = zk.getData(ZookeeperPath.ORACLE_GC_TIMESTAMP, false, null);\n return LongUtil.fromByteArray(d);\n } catch (KeeperException | InterruptedException | IOException e) {\n log.warn(\"Failed to get oldest timestamp of Oracle from Zookeeper\", e);\n return OLDEST_POSSIBLE;\n } finally {\n if (zk != null) {\n try {\n zk.close();\n } catch (InterruptedException e) {\n log.error(\"Failed to close zookeeper client\", e);\n }\n }\n }\n }",
"private final boolean matchPattern(byte[][] patterns, int bufferIndex)\n {\n boolean match = false;\n for (byte[] pattern : patterns)\n {\n int index = 0;\n match = true;\n for (byte b : pattern)\n {\n if (b != m_buffer[bufferIndex + index])\n {\n match = false;\n break;\n }\n ++index;\n }\n if (match)\n {\n break;\n }\n }\n return match;\n }",
"public static boolean isTodoItem(final Document todoItemDoc) {\n return todoItemDoc.containsKey(ID_KEY)\n && todoItemDoc.containsKey(TASK_KEY)\n && todoItemDoc.containsKey(CHECKED_KEY);\n }",
"@Override\n\tpublic void validate() throws HostNameException {\n\t\tif(parsedHost != null) {\n\t\t\treturn;\n\t\t}\n\t\tif(validationException != null) {\n\t\t\tthrow validationException;\n\t\t}\n\t\tsynchronized(this) {\n\t\t\tif(parsedHost != null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(validationException != null) {\n\t\t\t\tthrow validationException;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tparsedHost = getValidator().validateHost(this);\n\t\t\t} catch(HostNameException e) {\n\t\t\t\tvalidationException = e;\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\t}",
"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 setDuration(float start, float end)\n {\n for (GVRAnimation anim : mAnimations)\n {\n anim.setDuration(start,end);\n }\n }"
] |
Retrieve a table by name.
@param name table name
@return Table instance | [
"private Table getTable(String name)\n {\n Table table = m_tables.get(name);\n if (table == null)\n {\n table = EMPTY_TABLE;\n }\n return table;\n }"
] | [
"public String tag(ImapRequestLineReader request) throws ProtocolException {\n CharacterValidator validator = new TagCharValidator();\n return consumeWord(request, validator);\n }",
"public static int getScreenHeight(Context context) {\n DisplayMetrics metrics = context.getResources().getDisplayMetrics();\n return metrics.heightPixels;\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 static double blackScholesOptionRho(\n\t\t\tdouble initialStockValue,\n\t\t\tdouble riskFreeRate,\n\t\t\tdouble volatility,\n\t\t\tdouble optionMaturity,\n\t\t\tdouble optionStrike)\n\t{\n\t\tif(optionStrike <= 0.0 || optionMaturity <= 0.0)\n\t\t{\n\t\t\t// The Black-Scholes model does not consider it being an option\n\t\t\treturn 0.0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Calculate rho\n\t\t\tdouble dMinus = (Math.log(initialStockValue / optionStrike) + (riskFreeRate - 0.5 * volatility * volatility) * optionMaturity) / (volatility * Math.sqrt(optionMaturity));\n\n\t\t\tdouble rho = optionStrike * optionMaturity * Math.exp(-riskFreeRate * optionMaturity) * NormalDistribution.cumulativeDistribution(dMinus);\n\n\t\t\treturn rho;\n\t\t}\n\t}",
"public static String getHeaders(HttpServletResponse response) {\n String headerString = \"\";\n Collection<String> headerNames = response.getHeaderNames();\n for (String headerName : headerNames) {\n // there may be multiple headers per header name\n for (String headerValue : response.getHeaders(headerName)) {\n if (headerString.length() != 0) {\n headerString += \"\\n\";\n }\n\n headerString += headerName + \": \" + headerValue;\n }\n }\n\n return headerString;\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 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}",
"@SuppressWarnings(\"unchecked\")\n public static Map<String, Properties> readMultipleClientConfigAvro(String configAvro) {\n Map<String, Properties> mapStoreToProps = Maps.newHashMap();\n try {\n JsonDecoder decoder = new JsonDecoder(CLIENT_CONFIGS_AVRO_SCHEMA, configAvro);\n GenericDatumReader<Object> datumReader = new GenericDatumReader<Object>(CLIENT_CONFIGS_AVRO_SCHEMA);\n\n Map<Utf8, Map<Utf8, Utf8>> storeConfigs = (Map<Utf8, Map<Utf8, Utf8>>) datumReader.read(null,\n decoder);\n // Store config props to return back\n for(Utf8 storeName: storeConfigs.keySet()) {\n Properties props = new Properties();\n Map<Utf8, Utf8> singleConfig = storeConfigs.get(storeName);\n\n for(Utf8 key: singleConfig.keySet()) {\n props.put(key.toString(), singleConfig.get(key).toString());\n }\n\n if(storeName == null || storeName.length() == 0) {\n throw new Exception(\"Invalid store name found!\");\n }\n\n mapStoreToProps.put(storeName.toString(), props);\n }\n } catch(Exception e) {\n e.printStackTrace();\n }\n return mapStoreToProps;\n }",
"public void safeRevertWorkingCopy() {\n try {\n revertWorkingCopy();\n } catch (Exception e) {\n debuggingLogger.log(Level.FINE, \"Failed to revert working copy\", e);\n log(\"Failed to revert working copy: \" + e.getLocalizedMessage());\n Throwable cause = e.getCause();\n if (!(cause instanceof SVNException)) {\n return;\n }\n SVNException svnException = (SVNException) cause;\n if (svnException.getErrorMessage().getErrorCode() == SVNErrorCode.WC_LOCKED) {\n // work space locked attempt cleanup and try to revert again\n try {\n cleanupWorkingCopy();\n } catch (Exception unlockException) {\n debuggingLogger.log(Level.FINE, \"Failed to cleanup working copy\", e);\n log(\"Failed to cleanup working copy: \" + e.getLocalizedMessage());\n return;\n }\n\n try {\n revertWorkingCopy();\n } catch (Exception revertException) {\n log(\"Failed to revert working copy on the 2nd attempt: \" + e.getLocalizedMessage());\n }\n }\n }\n }"
] |
Returns the full record for a single team.
@param team Globally unique identifier for the team.
@return Request object | [
"public ItemRequest<Team> findById(String team) {\n \n String path = String.format(\"/teams/%s\", team);\n return new ItemRequest<Team>(this, Team.class, path, \"GET\");\n }"
] | [
"public static Method getGetterPropertyMethod(Class<?> type,\r\n\t\t\tString propertyName) {\r\n\t\tString sourceMethodName = \"get\"\r\n\t\t\t\t+ BeanUtils.capitalizePropertyName(propertyName);\r\n\r\n\t\tMethod sourceMethod = BeanUtils.getMethod(type, sourceMethodName);\r\n\r\n\t\tif (sourceMethod == null) {\r\n\t\t\tsourceMethodName = \"is\"\r\n\t\t\t\t\t+ BeanUtils.capitalizePropertyName(propertyName);\r\n\t\t\tsourceMethod = BeanUtils.getMethod(type, sourceMethodName);\r\n\t\t\tif (sourceMethod != null\r\n\t\t\t\t\t&& sourceMethod.getReturnType() != Boolean.TYPE) {\r\n\t\t\t\tsourceMethod = null;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn sourceMethod;\r\n\t}",
"public static Timer getNamedTimer(String timerName, int todoFlags) {\n\t\treturn getNamedTimer(timerName, todoFlags, Thread.currentThread()\n\t\t\t\t.getId());\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 }",
"private static String getUnexpectedTypeMessage(final Class<?> expectedType, final Object actualValue) {\n\t\tif( expectedType == null ) {\n\t\t\tthrow new NullPointerException(\"expectedType should not be null\");\n\t\t}\n\t\tString expectedClassName = expectedType.getName();\n\t\tString actualClassName = (actualValue != null) ? actualValue.getClass().getName() : \"null\";\n\t\treturn String.format(\"the input value should be of type %s but is %s\", expectedClassName, actualClassName);\n\t}",
"private String searchForPersistentSubType(XClass type)\r\n {\r\n ArrayList queue = new ArrayList();\r\n XClass subType;\r\n\r\n queue.add(type);\r\n while (!queue.isEmpty())\r\n {\r\n subType = (XClass)queue.get(0);\r\n queue.remove(0);\r\n if (_model.hasClass(subType.getQualifiedName()))\r\n {\r\n return subType.getQualifiedName();\r\n }\r\n addDirectSubTypes(subType, queue);\r\n }\r\n return null;\r\n }",
"private void addObjectReferenceEdges(Vertex vertex, ObjectReferenceDescriptor rds)\r\n {\r\n Object refObject = rds.getPersistentField().get(vertex.getEnvelope().getRealObject());\r\n Class refClass = rds.getItemClass();\r\n for (int i = 0; i < vertices.length; i++)\r\n {\r\n Edge edge = null;\r\n // ObjectEnvelope envelope = vertex.getEnvelope();\r\n Vertex refVertex = vertices[i];\r\n ObjectEnvelope refEnvelope = refVertex.getEnvelope();\r\n if (refObject == refEnvelope.getRealObject())\r\n {\r\n edge = buildConcrete11Edge(vertex, refVertex, rds.hasConstraint());\r\n }\r\n else if (refClass.isInstance(refVertex.getEnvelope().getRealObject()))\r\n {\r\n edge = buildPotential11Edge(vertex, refVertex, rds.hasConstraint());\r\n }\r\n if (edge != null)\r\n {\r\n if (!edgeList.contains(edge))\r\n {\r\n edgeList.add(edge);\r\n }\r\n else\r\n {\r\n edge.increaseWeightTo(edge.getWeight());\r\n }\r\n }\r\n }\r\n }",
"private Integer getKeyPartitionId(byte[] key) {\n Integer keyPartitionId = storeInstance.getNodesPartitionIdForKey(nodeId, key);\n\n Utils.notNull(keyPartitionId);\n return keyPartitionId;\n }",
"public static String readTextFile(File file) {\n try {\n return readTextFile(new FileReader(file));\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n return null;\n }\n }",
"public static void setField(Object object, String field, Object value) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {\n\t\tClass<?> clazz = object.getClass();\n\t\tMethod m = clazz.getMethod( PROPERTY_ACCESSOR_PREFIX_SET + capitalize( field ), value.getClass() );\n\t\tm.invoke( object, value );\n\t}"
] |
Write a project file in SDEF format to an output stream.
@param projectFile ProjectFile instance
@param out output stream | [
"@Override public void write(ProjectFile projectFile, OutputStream out) throws IOException\n {\n m_projectFile = projectFile;\n m_eventManager = projectFile.getEventManager();\n\n m_writer = new PrintStream(out); // the print stream class is the easiest way to create a text file\n m_buffer = new StringBuilder();\n\n try\n {\n write(); // method call a method, this is how MPXJ is structured, so I followed the lead?\n }\n\n // catch (Exception e)\n // { // used during console debugging\n // System.out.println(\"Caught Exception in SDEFWriter.java\");\n // System.out.println(\" \" + e.toString());\n // }\n\n finally\n { // keeps things cool after we're done\n m_writer = null;\n m_projectFile = null;\n m_buffer = null;\n }\n }"
] | [
"public void build(Point3d[] points, int nump) throws IllegalArgumentException {\n if (nump < 4) {\n throw new IllegalArgumentException(\"Less than four input points specified\");\n }\n if (points.length < nump) {\n throw new IllegalArgumentException(\"Point array too small for specified number of points\");\n }\n initBuffers(nump);\n setPoints(points, nump);\n buildHull();\n }",
"public int compare(Vector3 o1, Vector3 o2) {\n\t\tint ans = 0;\n\n\t\tif (o1 != null && o2 != null) {\n\t\t\tVector3 d1 = o1;\n\t\t\tVector3 d2 = o2;\n\n\t\t\tif (d1.x > d2.x)\n\t\t\t\treturn 1;\n\t\t\tif (d1.x < d2.x)\n\t\t\t\treturn -1;\n\t\t\t// x1 == x2\n\t\t\tif (d1.y > d2.y)\n\t\t\t\treturn 1;\n\t\t\tif (d1.y < d2.y)\n\t\t\t\treturn -1;\n\t\t} else {\n\t\t\tif (o1 == null && o2 == null)\n\t\t\t\treturn 0;\n\t\t\tif (o1 == null && o2 != null)\n\t\t\t\treturn 1;\n\t\t\tif (o1 != null && o2 == null)\n\t\t\t\treturn -1;\n\t\t}\n\t\t\n\t\treturn ans;\n\t}",
"public static VectorClock makeClock(Set<Integer> serverIds, long clockValue, long timestamp) {\n List<ClockEntry> clockEntries = new ArrayList<ClockEntry>(serverIds.size());\n for(Integer serverId: serverIds) {\n clockEntries.add(new ClockEntry(serverId.shortValue(), clockValue));\n }\n return new VectorClock(clockEntries, timestamp);\n }",
"public static double normP(DMatrixRMaj A , double p ) {\n if( p == 1 ) {\n return normP1(A);\n } else if( p == 2 ) {\n return normP2(A);\n } else if( Double.isInfinite(p)) {\n return normPInf(A);\n }\n if( MatrixFeatures_DDRM.isVector(A) ) {\n return elementP(A,p);\n } else {\n throw new IllegalArgumentException(\"Doesn't support induced norms yet.\");\n }\n }",
"public static boolean hasValidContentAdditionParameterDefined(ModelNode operation) {\n for (String s : DeploymentAttributes.MANAGED_CONTENT_ATTRIBUTES.keySet()) {\n if (operation.hasDefined(s)) {\n return true;\n }\n }\n return false;\n }",
"public static Bic valueOf(final String bic) throws BicFormatException,\n UnsupportedCountryException {\n BicUtil.validate(bic);\n return new Bic(bic);\n }",
"private void copyResources(File outputDirectory) throws IOException\n {\n copyClasspathResource(outputDirectory, \"reportng.css\", \"reportng.css\");\n copyClasspathResource(outputDirectory, \"reportng.js\", \"reportng.js\");\n // If there is a custom stylesheet, copy that.\n File customStylesheet = META.getStylesheetPath();\n\n if (customStylesheet != null)\n {\n if (customStylesheet.exists())\n {\n copyFile(outputDirectory, customStylesheet, CUSTOM_STYLE_FILE);\n }\n else\n {\n // If not found, try to read the file as a resource on the classpath\n // useful when reportng is called by a jarred up library\n InputStream stream = ClassLoader.getSystemClassLoader().getResourceAsStream(customStylesheet.getPath());\n if (stream != null)\n {\n copyStream(outputDirectory, stream, CUSTOM_STYLE_FILE);\n }\n }\n }\n }",
"public int execute(DatabaseConnection databaseConnection, T data, ID newId, ObjectCache objectCache)\n\t\t\tthrows SQLException {\n\t\ttry {\n\t\t\t// the arguments are the new-id and old-id\n\t\t\tObject[] args = new Object[] { convertIdToFieldObject(newId), extractIdToFieldObject(data) };\n\t\t\tint rowC = databaseConnection.update(statement, args, argFieldTypes);\n\t\t\tif (rowC > 0) {\n\t\t\t\tif (objectCache != null) {\n\t\t\t\t\tObject oldId = idField.extractJavaFieldValue(data);\n\t\t\t\t\tT obj = objectCache.updateId(clazz, oldId, newId);\n\t\t\t\t\tif (obj != null && obj != data) {\n\t\t\t\t\t\t// if our cached value is not the data that will be updated then we need to update it specially\n\t\t\t\t\t\tidField.assignField(connectionSource, obj, newId, false, objectCache);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// adjust the object to assign the new id\n\t\t\t\tidField.assignField(connectionSource, data, newId, false, objectCache);\n\t\t\t}\n\t\t\tlogger.debug(\"updating-id 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 cast otherwise we only print the first object in args\n\t\t\t\tlogger.trace(\"updating-id 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-id stmt on object \" + data + \": \" + statement, e);\n\t\t}\n\t}",
"@Override\n public int read(char[] cbuf, int off, int len) throws IOException {\n int numChars = super.read(cbuf, off, len);\n replaceBadXmlCharactersBySpace(cbuf, off, len);\n return numChars;\n }"
] |
Obtains a British Cutover local date-time from another date-time object.
@param temporal the date-time object to convert, not null
@return the British Cutover local date-time, not null
@throws DateTimeException if unable to create the date-time | [
"@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoLocalDateTime<BritishCutoverDate> localDateTime(TemporalAccessor temporal) {\n return (ChronoLocalDateTime<BritishCutoverDate>) super.localDateTime(temporal);\n }"
] | [
"public byte[] toArray() {\n if (size() > Integer.MAX_VALUE)\n throw new IllegalStateException(\"Cannot create byte array of more than 2GB\");\n\n int len = (int) size();\n ByteBuffer bb = toDirectByteBuffer(0L, len);\n byte[] b = new byte[len];\n // Copy data to the array\n bb.get(b, 0, len);\n return b;\n }",
"public static Info inviteUserToEnterprise(BoxAPIConnection api, String userLogin, String enterpriseID) {\n\n URL url = INVITE_CREATION_URL_TEMPLATE.build(api.getBaseURL());\n BoxJSONRequest request = new BoxJSONRequest(api, url, \"POST\");\n\n JsonObject body = new JsonObject();\n\n JsonObject enterprise = new JsonObject();\n enterprise.add(\"id\", enterpriseID);\n body.add(\"enterprise\", enterprise);\n\n JsonObject actionableBy = new JsonObject();\n actionableBy.add(\"login\", userLogin);\n body.add(\"actionable_by\", actionableBy);\n\n request.setBody(body);\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n\n BoxInvite invite = new BoxInvite(api, responseJSON.get(\"id\").asString());\n return invite.new Info(responseJSON);\n }",
"public AiTextureInfo getTextureInfo(AiTextureType type, int index) {\n return new AiTextureInfo(type, index, getTextureFile(type, index), \n getTextureUVIndex(type, index), getBlendFactor(type, index), \n getTextureOp(type, index), getTextureMapModeW(type, index), \n getTextureMapModeW(type, index), \n getTextureMapModeW(type, index));\n }",
"private JsonArray formatBoxMetadataFilterRequest() {\n JsonArray boxMetadataFilterRequestArray = new JsonArray();\n\n JsonObject boxMetadataFilter = new JsonObject()\n .add(\"templateKey\", this.metadataFilter.getTemplateKey())\n .add(\"scope\", this.metadataFilter.getScope())\n .add(\"filters\", this.metadataFilter.getFiltersList());\n boxMetadataFilterRequestArray.add(boxMetadataFilter);\n\n return boxMetadataFilterRequestArray;\n }",
"public SelectBuilder orderBy(String name, boolean ascending) {\n if (ascending) {\n orderBys.add(name + \" asc\");\n } else {\n orderBys.add(name + \" desc\");\n }\n return this;\n }",
"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}",
"protected String getExtraSolrParams() {\n\n try {\n return m_configObject.getString(JSON_KEY_EXTRASOLRPARAMS);\n } catch (JSONException e) {\n if (null == m_baseConfig) {\n if (LOG.isInfoEnabled()) {\n LOG.info(Messages.get().getBundle().key(Messages.LOG_NO_EXTRA_PARAMETERS_0), e);\n }\n return \"\";\n } else {\n return m_baseConfig.getGeneralConfig().getExtraSolrParams();\n }\n }\n }",
"static BsonDocument getFreshVersionDocument() {\n final BsonDocument versionDoc = new BsonDocument();\n\n versionDoc.append(Fields.SYNC_PROTOCOL_VERSION_FIELD, new BsonInt32(1));\n versionDoc.append(Fields.INSTANCE_ID_FIELD, new BsonString(UUID.randomUUID().toString()));\n versionDoc.append(Fields.VERSION_COUNTER_FIELD, new BsonInt64(0L));\n\n return versionDoc;\n }",
"public void setRotation(String rotation) {\r\n if (rotation != null) {\r\n try {\r\n setRotation(Integer.parseInt(rotation));\r\n } catch (NumberFormatException e) {\r\n setRotation(-1);\r\n }\r\n }\r\n }"
] |
Set the value for a floating point 4x4 matrix.
@param key name of uniform to set.
@see #getFloatVec(String) | [
"public void setMat4(String key, float x1, float y1, float z1, float w1,\n float x2, float y2, float z2, float w2, float x3, float y3,\n float z3, float w3, float x4, float y4, float z4, float w4)\n {\n checkKeyIsUniform(key);\n NativeLight.setMat4(getNative(), key, x1, y1, z1, w1, x2, y2,\n z2, w2, x3, y3, z3, w3, x4, y4, z4, w4);\n }"
] | [
"public void openReport(String newState, A_CmsReportThread thread, String label) {\n\n setReport(newState, thread);\n m_labels.put(thread, label);\n openSubView(newState, true);\n }",
"public static String nextWord(String string) {\n int index = 0;\n while (index < string.length() && !Character.isWhitespace(string.charAt(index))) {\n index++;\n }\n return string.substring(0, index);\n }",
"protected void prepForWrite(SelectionKey selectionKey) {\n if(logger.isTraceEnabled())\n traceInputBufferState(\"About to clear read buffer\");\n\n if(requestHandlerFactory.shareReadWriteBuffer() == false) {\n inputStream.clear();\n }\n\n if(logger.isTraceEnabled())\n traceInputBufferState(\"Cleared read buffer\");\n\n outputStream.getBuffer().flip();\n selectionKey.interestOps(SelectionKey.OP_WRITE);\n }",
"public static <T> boolean addAll(Collection<T> target, Iterator<? extends T> iterator) {\n Preconditions.checkArgumentNotNull(target, \"target\");\n boolean modified = false;\n while (iterator.hasNext()) {\n modified |= target.add(iterator.next());\n }\n return modified;\n }",
"private void loadCadidateString() {\n volumeUp = mGvrContext.getActivity().getResources().getString(R.string.volume_up);\n volumeDown = mGvrContext.getActivity().getResources().getString(R.string.volume_down);\n zoomIn = mGvrContext.getActivity().getResources().getString(R.string.zoom_in);\n zoomOut = mGvrContext.getActivity().getResources().getString(R.string.zoom_out);\n invertedColors = mGvrContext.getActivity().getResources().getString(R.string.inverted_colors);\n talkBack = mGvrContext.getActivity().getResources().getString(R.string.talk_back);\n disableTalkBack = mGvrContext.getActivity().getResources().getString(R.string.disable_talk_back);\n }",
"private void readBitFields(MppBitFlag[] flags, FieldContainer container, byte[] data)\n {\n for (MppBitFlag flag : flags)\n {\n flag.setValue(container, data);\n }\n }",
"public static appfwprofile_excluderescontenttype_binding[] get(nitro_service service, String name) throws Exception{\n\t\tappfwprofile_excluderescontenttype_binding obj = new appfwprofile_excluderescontenttype_binding();\n\t\tobj.set_name(name);\n\t\tappfwprofile_excluderescontenttype_binding response[] = (appfwprofile_excluderescontenttype_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"public boolean filter(Event event) {\n LOG.info(\"StringContentFilter called\");\n \n if (wordsToFilter != null) {\n for (String filterWord : wordsToFilter) {\n if (event.getContent() != null\n && -1 != event.getContent().indexOf(filterWord)) {\n return true;\n }\n }\n }\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 }"
] |
Returns the specified range of elements in the sorted set.
The elements are considered to be ordered from the highest to the lowest score.
Descending lexicographical order is used for elements with equal score.
Both start and stop are zero-based inclusive indexes. They can also be negative numbers indicating offsets from
the end of the sorted set, with -1 being the last element of the sorted set.
@param start
@param end
@return the range of elements | [
"public Set<String> rangeByRankReverse(final long start, final long end) {\n return doWithJedis(new JedisCallable<Set<String>>() {\n @Override\n public Set<String> call(Jedis jedis) {\n return jedis.zrevrange(getKey(), start, end);\n }\n });\n }"
] | [
"private static void dumpRelationList(List<Relation> relations)\n {\n if (relations != null && relations.isEmpty() == false)\n {\n if (relations.size() > 1)\n {\n System.out.print('\"');\n }\n boolean first = true;\n for (Relation relation : relations)\n {\n if (!first)\n {\n System.out.print(',');\n }\n first = false;\n System.out.print(relation.getTargetTask().getID());\n Duration lag = relation.getLag();\n if (relation.getType() != RelationType.FINISH_START || lag.getDuration() != 0)\n {\n System.out.print(relation.getType());\n }\n\n if (lag.getDuration() != 0)\n {\n if (lag.getDuration() > 0)\n {\n System.out.print(\"+\");\n }\n System.out.print(lag);\n }\n }\n if (relations.size() > 1)\n {\n System.out.print('\"');\n }\n }\n }",
"public void addNotIn(String attribute, Query subQuery)\r\n {\r\n\t\t// PAW\r\n\t\t// addSelectionCriteria(ValueCriteria.buildNotInCriteria(attribute, subQuery, getAlias()));\r\n\t\taddSelectionCriteria(ValueCriteria.buildNotInCriteria(attribute, subQuery, getUserAlias(attribute)));\r\n }",
"public void setWeekDay(String weekDayStr) {\n\n final WeekDay weekDay = WeekDay.valueOf(weekDayStr);\n if ((m_model.getWeekDay() != null) || !m_model.getWeekDay().equals(weekDay)) {\n removeExceptionsOnChange(new Command() {\n\n public void execute() {\n\n m_model.setWeekDay(weekDay);\n onValueChange();\n }\n });\n\n }\n\n }",
"public void getRepresentationContent(String representationHint, String assetPath, OutputStream output) {\n\n List<Representation> reps = this.getInfoWithRepresentations(representationHint).getRepresentations();\n if (reps.size() < 1) {\n throw new BoxAPIException(\"No matching representations found\");\n }\n Representation representation = reps.get(0);\n String repState = representation.getStatus().getState();\n\n if (repState.equals(\"viewable\") || repState.equals(\"success\")) {\n\n this.makeRepresentationContentRequest(representation.getContent().getUrlTemplate(),\n assetPath, output);\n return;\n } else if (repState.equals(\"pending\") || repState.equals(\"none\")) {\n\n String repContentURLString = null;\n while (repContentURLString == null) {\n repContentURLString = this.pollRepInfo(representation.getInfo().getUrl());\n }\n\n this.makeRepresentationContentRequest(repContentURLString, assetPath, output);\n return;\n\n } else if (repState.equals(\"error\")) {\n\n throw new BoxAPIException(\"Representation had error status\");\n } else {\n\n throw new BoxAPIException(\"Representation had unknown status\");\n }\n\n }",
"public void animate(float timeInSec)\n {\n GVRSkeleton skel = getSkeleton();\n GVRPose pose = skel.getPose();\n computePose(timeInSec,pose);\n skel.poseToBones();\n skel.updateBonePose();\n skel.updateSkinPose();\n }",
"private Month readOptionalMonth(JSONValue val) {\n\n String str = readOptionalString(val);\n if (null != str) {\n try {\n return Month.valueOf(str);\n } catch (@SuppressWarnings(\"unused\") IllegalArgumentException e) {\n // Do nothing -return the default value\n }\n }\n return null;\n }",
"@Override\n public DiscordianDate date(int prolepticYear, int month, int dayOfMonth) {\n return DiscordianDate.of(prolepticYear, month, dayOfMonth);\n }",
"private void setResourceInformation() {\n\n String sitePath = m_cms.getSitePath(m_resource);\n int pathEnd = sitePath.lastIndexOf('/') + 1;\n String baseName = sitePath.substring(pathEnd);\n m_sitepath = sitePath.substring(0, pathEnd);\n switch (CmsMessageBundleEditorTypes.BundleType.toBundleType(\n OpenCms.getResourceManager().getResourceType(m_resource).getTypeName())) {\n case PROPERTY:\n String localeSuffix = CmsStringUtil.getLocaleSuffixForName(baseName);\n if ((null != localeSuffix) && !localeSuffix.isEmpty()) {\n baseName = baseName.substring(\n 0,\n baseName.lastIndexOf(localeSuffix) - (1 /* cut off trailing underscore, too*/));\n m_locale = CmsLocaleManager.getLocale(localeSuffix);\n }\n if ((null == m_locale) || !m_locales.contains(m_locale)) {\n m_switchedLocaleOnOpening = true;\n m_locale = m_locales.iterator().next();\n }\n break;\n case XML:\n m_locale = OpenCms.getLocaleManager().getBestAvailableLocaleForXmlContent(\n m_cms,\n m_resource,\n m_xmlBundle);\n break;\n case DESCRIPTOR:\n m_basename = baseName.substring(\n 0,\n baseName.length() - CmsMessageBundleEditorTypes.Descriptor.POSTFIX.length());\n m_locale = new Locale(\"en\");\n break;\n default:\n throw new IllegalArgumentException(\n Messages.get().container(\n Messages.ERR_UNSUPPORTED_BUNDLE_TYPE_1,\n CmsMessageBundleEditorTypes.BundleType.toBundleType(\n OpenCms.getResourceManager().getResourceType(m_resource).getTypeName())).toString());\n }\n m_basename = baseName;\n\n }",
"@JmxOperation\n public String stopAsyncOperation(int requestId) {\n try {\n stopOperation(requestId);\n } catch(VoldemortException e) {\n return e.getMessage();\n }\n\n return \"Stopping operation \" + requestId;\n }"
] |
Use this API to unset the properties of sslocspresponder resource.
Properties that need to be unset are specified in args array. | [
"public static base_response unset(nitro_service client, sslocspresponder resource, String[] args) throws Exception{\n\t\tsslocspresponder unsetresource = new sslocspresponder();\n\t\tunsetresource.name = resource.name;\n\t\tunsetresource.insertclientcert = resource.insertclientcert;\n\t\treturn unsetresource.unset_resource(client,args);\n\t}"
] | [
"public static <E> Set<E> diff(Set<E> s1, Set<E> s2) {\r\n Set<E> s = new HashSet<E>();\r\n for (E o : s1) {\r\n if (!s2.contains(o)) {\r\n s.add(o);\r\n }\r\n }\r\n return s;\r\n }",
"public void updatePathOrder(int profileId, int[] pathOrder) {\n for (int i = 0; i < pathOrder.length; i++) {\n EditService.updatePathTable(Constants.PATH_PROFILE_PATH_ORDER, (i + 1), pathOrder[i]);\n }\n }",
"@JavaScriptMethod\n @SuppressWarnings({\"UnusedDeclaration\"})\n public LoadBuildsResponse loadBuild(String buildId) {\n LoadBuildsResponse response = new LoadBuildsResponse();\n // When we load a new build we need also to reset the promotion plugin.\n // The null plugin is related to 'None' plugin.\n setPromotionPlugin(null);\n try {\n this.currentPromotionCandidate = promotionCandidates.get(buildId);\n if (this.currentPromotionCandidate == null) {\n throw new IllegalArgumentException(\"Can't find build by ID: \" + buildId);\n }\n List<String> repositoryKeys = getRepositoryKeys();\n List<UserPluginInfo> plugins = getPromotionsUserPluginInfo();\n PromotionConfig promotionConfig = getPromotionConfig();\n String defaultTargetRepository = getDefaultPromotionTargetRepository();\n if (StringUtils.isNotBlank(defaultTargetRepository) && repositoryKeys.contains(defaultTargetRepository)) {\n promotionConfig.setTargetRepo(defaultTargetRepository);\n }\n response.addRepositories(repositoryKeys);\n response.setPlugins(plugins);\n response.setPromotionConfig(promotionConfig);\n response.setSuccess(true);\n } catch (Exception e) {\n response.setResponseMessage(e.getMessage());\n }\n return response;\n }",
"public List<TableProperty> getEditableColumns(CmsMessageBundleEditorTypes.EditMode mode) {\n\n return m_editorState.get(mode).getEditableColumns();\n }",
"private static void checkPreconditions(final String dateFormat, final Locale locale) {\n\t\tif( dateFormat == null ) {\n\t\t\tthrow new NullPointerException(\"dateFormat should not be null\");\n\t\t} else if( locale == null ) {\n\t\t\tthrow new NullPointerException(\"locale should not be null\");\n\t\t}\n\t}",
"private String getActivityID(Task task)\n {\n String result = null;\n if (m_activityIDField != null)\n {\n Object value = task.getCachedValue(m_activityIDField);\n if (value != null)\n {\n result = value.toString();\n }\n }\n return result;\n }",
"public static URL getKubernetesConfigurationUrl(Map<String, String> map) throws MalformedURLException {\n if (Strings.isNotNullOrEmpty(Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_URL, \"\"))) {\n return new URL(Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_URL, \"\"));\n } else if (Strings.isNotNullOrEmpty(Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_RESOURCE_NAME, \"\"))) {\n String resourceName = Utils.getSystemPropertyOrEnvVar(ENVIRONMENT_CONFIG_RESOURCE_NAME, \"\");\n return findConfigResource(resourceName);\n } else if (map.containsKey(ENVIRONMENT_CONFIG_URL)) {\n return new URL(map.get(ENVIRONMENT_CONFIG_URL));\n } else if (map.containsKey(ENVIRONMENT_CONFIG_RESOURCE_NAME)) {\n String resourceName = map.get(ENVIRONMENT_CONFIG_RESOURCE_NAME);\n return findConfigResource(resourceName);\n } else {\n // Let the resource locator find the resource\n return null;\n }\n }",
"private void increaseBeliefCount(String bName) {\n Object belief = this.getBelief(bName);\n int count = 0;\n if (belief!=null) {\n count = (Integer) belief;\n }\n this.setBelief(bName, count + 1);\n }",
"private void initWsClient(BundleContext context) throws Exception {\n ServiceReference serviceRef = context.getServiceReference(ConfigurationAdmin.class.getName());\n ConfigurationAdmin cfgAdmin = (ConfigurationAdmin)context.getService(serviceRef); \n Configuration config = cfgAdmin.getConfiguration(\"org.talend.esb.sam.agent\");\n\n String serviceURL = (String)config.getProperties().get(\"service.url\");\n retryNum = Integer.parseInt((String)config.getProperties().get(\"service.retry.number\"));\n retryDelay = Long.parseLong((String)config.getProperties().get(\"service.retry.delay\"));\n\n JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();\n factory.setServiceClass(org.talend.esb.sam.monitoringservice.v1.MonitoringService.class);\n factory.setAddress(serviceURL);\n monitoringService = (MonitoringService)factory.create();\n }"
] |
Use this API to fetch the statistics of all rnatip_stats resources that are configured on netscaler. | [
"public static rnatip_stats[] get(nitro_service service, options option) throws Exception{\n\t\trnatip_stats obj = new rnatip_stats();\n\t\trnatip_stats[] response = (rnatip_stats[])obj.stat_resources(service,option);\n\t\treturn response;\n\t}"
] | [
"public void downloadRange(OutputStream output, long rangeStart, long rangeEnd, ProgressListener listener) {\n URL url = CONTENT_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"GET\");\n if (rangeEnd > 0) {\n request.addHeader(\"Range\", String.format(\"bytes=%s-%s\", Long.toString(rangeStart),\n Long.toString(rangeEnd)));\n } else {\n request.addHeader(\"Range\", String.format(\"bytes=%s-\", Long.toString(rangeStart)));\n }\n\n BoxAPIResponse response = request.send();\n InputStream input = response.getBody(listener);\n\n byte[] buffer = new byte[BUFFER_SIZE];\n try {\n int n = input.read(buffer);\n while (n != -1) {\n output.write(buffer, 0, n);\n n = input.read(buffer);\n }\n } catch (IOException e) {\n throw new BoxAPIException(\"Couldn't connect to the Box API due to a network error.\", e);\n } finally {\n response.disconnect();\n }\n }",
"public static <T> Class<T> loadClass(String className, ResourceLoader resourceLoader) {\n try {\n return cast(resourceLoader.classForName(className));\n } catch (ResourceLoadingException e) {\n return null;\n } catch (SecurityException e) {\n return null;\n }\n }",
"private MavenProjectModel getMavenStubProject(MavenProjectService mavenProjectService, String groupId, String artifactId, String version)\n {\n Iterable<MavenProjectModel> mavenProjectModels = mavenProjectService.findByGroupArtifactVersion(groupId, artifactId, version);\n if (!mavenProjectModels.iterator().hasNext())\n {\n return null;\n }\n for (MavenProjectModel mavenProjectModel : mavenProjectModels)\n {\n if (mavenProjectModel.getRootFileModel() == null)\n {\n // this is a stub... we can fill it in with details\n return mavenProjectModel;\n }\n }\n return null;\n }",
"public static base_response delete(nitro_service client, snmpmanager resource) throws Exception {\n\t\tsnmpmanager deleteresource = new snmpmanager();\n\t\tdeleteresource.ipaddress = resource.ipaddress;\n\t\tdeleteresource.netmask = resource.netmask;\n\t\treturn deleteresource.delete_resource(client);\n\t}",
"private void doSend(byte[] msg, boolean wait, KNXAddress dst)\r\n\t\tthrows KNXAckTimeoutException, KNXLinkClosedException\r\n\t{\r\n\t\tif (closed)\r\n\t\t\tthrow new KNXLinkClosedException(\"link closed\");\r\n\t\ttry {\r\n\t\t\tlogger.info(\"send message to \" + dst + (wait ? \", wait for ack\" : \"\"));\r\n\t\t\tlogger.trace(\"EMI \" + DataUnitBuilder.toHex(msg, \" \"));\r\n\t\t\tconn.send(msg, wait);\r\n\t\t\tlogger.trace(\"send to \" + dst + \" succeeded\");\r\n\t\t}\r\n\t\tcatch (final KNXPortClosedException e) {\r\n\t\t\tlogger.error(\"send error, closing link\", e);\r\n\t\t\tclose();\r\n\t\t\tthrow new KNXLinkClosedException(\"link closed, \" + e.getMessage());\r\n\t\t}\r\n\t}",
"public static void doMetaGetRO(AdminClient adminClient,\n Collection<Integer> nodeIds,\n List<String> storeNames,\n List<String> metaKeys) throws IOException {\n for(String key: metaKeys) {\n System.out.println(\"Metadata: \" + key);\n if(!key.equals(KEY_MAX_VERSION) && !key.equals(KEY_CURRENT_VERSION)\n && !key.equals(KEY_STORAGE_FORMAT)) {\n System.out.println(\" Invalid read-only metadata key: \" + key);\n } else {\n for(Integer nodeId: nodeIds) {\n String hostName = adminClient.getAdminClientCluster()\n .getNodeById(nodeId)\n .getHost();\n System.out.println(\" Node: \" + hostName + \":\" + nodeId);\n if(key.equals(KEY_MAX_VERSION)) {\n Map<String, Long> mapStoreToROVersion = adminClient.readonlyOps.getROMaxVersion(nodeId,\n storeNames);\n for(String storeName: mapStoreToROVersion.keySet()) {\n System.out.println(\" \" + storeName + \":\"\n + mapStoreToROVersion.get(storeName));\n }\n } else if(key.equals(KEY_CURRENT_VERSION)) {\n Map<String, Long> mapStoreToROVersion = adminClient.readonlyOps.getROCurrentVersion(nodeId,\n storeNames);\n for(String storeName: mapStoreToROVersion.keySet()) {\n System.out.println(\" \" + storeName + \":\"\n + mapStoreToROVersion.get(storeName));\n }\n } else if(key.equals(KEY_STORAGE_FORMAT)) {\n Map<String, String> mapStoreToROFormat = adminClient.readonlyOps.getROStorageFormat(nodeId,\n storeNames);\n for(String storeName: mapStoreToROFormat.keySet()) {\n System.out.println(\" \" + storeName + \":\"\n + mapStoreToROFormat.get(storeName));\n }\n }\n }\n }\n System.out.println();\n }\n }",
"public static Node removePartitionFromNode(final Node node, Integer donatedPartition) {\n return UpdateClusterUtils.removePartitionsFromNode(node, Sets.newHashSet(donatedPartition));\n }",
"protected boolean isStoreValid() {\n boolean result = false;\n String requestURI = this.request.getUri();\n this.storeName = parseStoreName(requestURI);\n if(storeName != null) {\n result = true;\n } else {\n logger.error(\"Error when validating request. Missing store name.\");\n RestErrorHandler.writeErrorResponse(this.messageEvent,\n HttpResponseStatus.BAD_REQUEST,\n \"Missing store name. Critical error.\");\n }\n return result;\n }",
"@Pure\n\tpublic static <P1, P2, P3, RESULT> Function2<P2, P3, RESULT> curry(final Function3<? super P1, ? super P2, ? super P3, ? extends RESULT> function,\n\t\t\tfinal P1 argument) {\n\t\tif (function == null)\n\t\t\tthrow new NullPointerException(\"function\");\n\t\treturn new Function2<P2, P3, RESULT>() {\n\t\t\t@Override\n\t\t\tpublic RESULT apply(P2 p2, P3 p3) {\n\t\t\t\treturn function.apply(argument, p2, p3);\n\t\t\t}\n\t\t};\n\t}"
] |
Build a query to read the mn-implementors
@param ids | [
"protected Query buildMtoNImplementorQuery(Collection ids)\r\n {\r\n String[] indFkCols = getFksToThisClass();\r\n String[] indItemFkCols = getFksToItemClass();\r\n FieldDescriptor[] pkFields = getOwnerClassDescriptor().getPkFields();\r\n FieldDescriptor[] itemPkFields = getItemClassDescriptor().getPkFields();\r\n String[] cols = new String[indFkCols.length + indItemFkCols.length];\r\n int[] jdbcTypes = new int[indFkCols.length + indItemFkCols.length];\r\n\r\n // concatenate the columns[]\r\n System.arraycopy(indFkCols, 0, cols, 0, indFkCols.length);\r\n System.arraycopy(indItemFkCols, 0, cols, indFkCols.length, indItemFkCols.length);\r\n\r\n Criteria crit = buildPrefetchCriteria(ids, indFkCols, indItemFkCols, itemPkFields);\r\n\r\n // determine the jdbcTypes of the pks\r\n for (int i = 0; i < pkFields.length; i++)\r\n {\r\n jdbcTypes[i] = pkFields[i].getJdbcType().getType();\r\n }\r\n for (int i = 0; i < itemPkFields.length; i++)\r\n {\r\n jdbcTypes[pkFields.length + i] = itemPkFields[i].getJdbcType().getType();\r\n }\r\n\r\n ReportQueryByMtoNCriteria q = new ReportQueryByMtoNCriteria(getItemClassDescriptor().getClassOfObject(), cols,\r\n crit, false);\r\n q.setIndirectionTable(getCollectionDescriptor().getIndirectionTable());\r\n q.setJdbcTypes(jdbcTypes);\r\n\r\n CollectionDescriptor cds = getCollectionDescriptor();\r\n //check if collection must be ordered\r\n if (!cds.getOrderBy().isEmpty())\r\n {\r\n Iterator iter = cds.getOrderBy().iterator();\r\n while (iter.hasNext())\r\n {\r\n q.addOrderBy((FieldHelper) iter.next());\r\n }\r\n }\r\n \r\n return q;\r\n }"
] | [
"public static final MVCArray buildArcPoints(LatLong center, double startBearing, double endBearing, double radius) {\n int points = DEFAULT_ARC_POINTS;\n\n MVCArray res = new MVCArray();\n\n if (startBearing > endBearing) {\n endBearing += 360.0;\n }\n double deltaBearing = endBearing - startBearing;\n deltaBearing = deltaBearing / points;\n for (int i = 0; (i < points + 1); i++) {\n res.push(center.getDestinationPoint(startBearing + i * deltaBearing, radius));\n }\n\n return res;\n\n }",
"private List<File> getConfigFiles() {\n\n String[] filenames = {\n \"opencms-modules.xml\",\n \"opencms-system.xml\",\n \"opencms-vfs.xml\",\n \"opencms-importexport.xml\",\n \"opencms-sites.xml\",\n \"opencms-variables.xml\",\n \"opencms-scheduler.xml\",\n \"opencms-workplace.xml\",\n \"opencms-search.xml\"};\n List<File> result = new ArrayList<>();\n for (String fn : filenames) {\n File file = new File(m_configDir, fn);\n if (file.exists()) {\n result.add(file);\n }\n }\n return result;\n }",
"public void close() throws IOException {\n final ManagedBinding binding = this.socketBindingManager.getNamedRegistry().getManagedBinding(this.name);\n if (binding == null) {\n return;\n }\n binding.close();\n }",
"public void postConstruct() throws URISyntaxException {\n WmsVersion.lookup(this.version);\n Assert.isTrue(validateBaseUrl(), \"invalid baseURL\");\n\n Assert.isTrue(this.layers.length > 0, \"There must be at least one layer defined for a WMS request\" +\n \" to make sense\");\n\n // OpenLayers 2 compatibility. It will post a single empty style no matter how many layers there are\n\n if (this.styles != null && this.styles.length != this.layers.length && this.styles.length == 1 &&\n this.styles[0].trim().isEmpty()) {\n this.styles = null;\n } else {\n Assert.isTrue(this.styles == null || this.layers.length == this.styles.length,\n String.format(\n \"If styles are defined then there must be one for each layer. Number of\" +\n \" layers: %s\\nStyles: %s\", this.layers.length,\n Arrays.toString(this.styles)));\n }\n\n if (this.imageFormat.indexOf('/') < 0) {\n LOGGER.warn(\"The format {} should be a mime type\", this.imageFormat);\n this.imageFormat = \"image/\" + this.imageFormat;\n }\n\n Assert.isTrue(this.method == HttpMethod.GET || this.method == HttpMethod.POST,\n String.format(\"Unsupported method %s for WMS layer\", this.method.toString()));\n }",
"public void registerComponent(java.awt.Component c)\r\n {\r\n unregisterComponent(c);\r\n if (recognizerAbstractClass == null)\r\n {\r\n hmDragGestureRecognizers.put(c, \r\n dragSource.createDefaultDragGestureRecognizer(c, \r\n dragWorker.getAcceptableActions(c), dgListener)\r\n );\r\n }\r\n else\r\n {\r\n hmDragGestureRecognizers.put(c, \r\n dragSource.createDragGestureRecognizer (recognizerAbstractClass,\r\n c, dragWorker.getAcceptableActions(c), dgListener)\r\n );\r\n }\r\n }",
"public static final String printCurrencySymbolPosition(CurrencySymbolPosition value)\n {\n String result;\n\n switch (value)\n {\n default:\n case BEFORE:\n {\n result = \"0\";\n break;\n }\n\n case AFTER:\n {\n result = \"1\";\n break;\n }\n\n case BEFORE_WITH_SPACE:\n {\n result = \"2\";\n break;\n }\n\n case AFTER_WITH_SPACE:\n {\n result = \"3\";\n break;\n }\n }\n\n return (result);\n }",
"private String quoteFormatCharacters(String literal)\n {\n StringBuilder sb = new StringBuilder();\n int length = literal.length();\n char c;\n\n for (int loop = 0; loop < length; loop++)\n {\n c = literal.charAt(loop);\n switch (c)\n {\n case '0':\n case '#':\n case '.':\n case '-':\n case ',':\n case 'E':\n case ';':\n case '%':\n {\n sb.append(\"'\");\n sb.append(c);\n sb.append(\"'\");\n break;\n }\n\n default:\n {\n sb.append(c);\n break;\n }\n }\n }\n\n return (sb.toString());\n }",
"public FluoMutationGenerator put(Column col, CharSequence value) {\n return put(col, value.toString().getBytes(StandardCharsets.UTF_8));\n }",
"public List<DbLicense> getModuleLicenses(final String moduleId,\n final LicenseMatcher licenseMatcher) {\n final DbModule module = getModule(moduleId);\n\n final List<DbLicense> licenses = new ArrayList<>();\n final FiltersHolder filters = new FiltersHolder();\n final ArtifactHandler artifactHandler = new ArtifactHandler(repositoryHandler, licenseMatcher);\n\n for (final String gavc : DataUtils.getAllArtifacts(module)) {\n licenses.addAll(artifactHandler.getArtifactLicenses(gavc, filters));\n }\n\n return licenses;\n }"
] |
set custom response or request for a profile's default client, ensures profile and path are enabled
@param profileName profileName to modift, default client is used
@param pathName friendly name of path
@param isResponse true if response, false for request
@param customData custom response/request data
@return true if success, false otherwise | [
"protected static boolean setCustomForDefaultClient(String profileName, String pathName, Boolean isResponse, String customData) {\n try {\n Client client = new Client(profileName, false);\n client.toggleProfile(true);\n client.setCustom(isResponse, pathName, customData);\n if (isResponse) {\n client.toggleResponseOverride(pathName, true);\n } else {\n client.toggleRequestOverride(pathName, true);\n }\n return true;\n } catch (Exception e) {\n e.printStackTrace();\n }\n return false;\n }"
] | [
"public Version putWithCustomTimeout(CompositeVoldemortRequest<K, V> requestWrapper) {\n validateTimeout(requestWrapper.getRoutingTimeoutInMs());\n List<Versioned<V>> versionedValues;\n long startTime = System.currentTimeMillis();\n String keyHexString = \"\";\n if(logger.isDebugEnabled()) {\n ByteArray key = (ByteArray) requestWrapper.getKey();\n keyHexString = RestUtils.getKeyHexString(key);\n logger.debug(\"PUT requested for key: \" + keyHexString + \" , for store: \"\n + this.storeName + \" at time(in ms): \" + startTime\n + \" . Nested GET and PUT VERSION requests to follow ---\");\n }\n\n // We use the full timeout for doing the Get. In this, we're being\n // optimistic that the subsequent put might be faster such that all the\n // steps might finish within the allotted time\n requestWrapper.setResolveConflicts(true);\n versionedValues = getWithCustomTimeout(requestWrapper);\n Versioned<V> versioned = getItemOrThrow(requestWrapper.getKey(), null, versionedValues);\n\n long endTime = System.currentTimeMillis();\n if(versioned == null)\n versioned = Versioned.value(requestWrapper.getRawValue(), new VectorClock());\n else\n versioned.setObject(requestWrapper.getRawValue());\n\n // This should not happen unless there's a bug in the\n // getWithCustomTimeout\n long timeLeft = requestWrapper.getRoutingTimeoutInMs() - (endTime - startTime);\n if(timeLeft <= 0) {\n throw new StoreTimeoutException(\"PUT request timed out\");\n }\n CompositeVersionedPutVoldemortRequest<K, V> putVersionedRequestObject = new CompositeVersionedPutVoldemortRequest<K, V>(requestWrapper.getKey(),\n versioned,\n timeLeft);\n putVersionedRequestObject.setRequestOriginTimeInMs(requestWrapper.getRequestOriginTimeInMs());\n Version result = putVersionedWithCustomTimeout(putVersionedRequestObject);\n long endTimeInMs = System.currentTimeMillis();\n if(logger.isDebugEnabled()) {\n logger.debug(\"PUT response received for key: \" + keyHexString + \" , for store: \"\n + this.storeName + \" at time(in ms): \" + endTimeInMs);\n }\n return result;\n }",
"public void addGroupBy(String[] fieldNames)\r\n {\r\n for (int i = 0; i < fieldNames.length; i++)\r\n {\r\n addGroupBy(fieldNames[i]);\r\n }\r\n }",
"public static boolean isConstantVal(DMatrixRMaj mat , double val , double tol )\n {\n // see if the result is an identity matrix\n int index = 0;\n for( int i = 0; i < mat.numRows; i++ ) {\n for( int j = 0; j < mat.numCols; j++ ) {\n if( !(Math.abs(mat.get(index++)-val) <= tol) )\n return false;\n\n }\n }\n\n return true;\n }",
"private <T> void deferNotification(T event, final EventMetadata metadata, final ObserverMethod<? super T> observer,\n final List<DeferredEventNotification<?>> notifications) {\n TransactionPhase transactionPhase = observer.getTransactionPhase();\n boolean before = transactionPhase.equals(TransactionPhase.BEFORE_COMPLETION);\n Status status = Status.valueOf(transactionPhase);\n notifications.add(new DeferredEventNotification<T>(contextId, event, metadata, observer, currentEventMetadata, status, before));\n }",
"public static void doEnqueue(final Jedis jedis, final String namespace, final String queue, final String jobJson) {\n jedis.sadd(JesqueUtils.createKey(namespace, QUEUES), queue);\n jedis.rpush(JesqueUtils.createKey(namespace, QUEUE, queue), jobJson);\n }",
"public List<com.groupon.odo.proxylib.models.Method> getMethodsNotInGroup(int groupId) throws Exception {\n List<com.groupon.odo.proxylib.models.Method> allMethods = getAllMethods();\n List<com.groupon.odo.proxylib.models.Method> methodsNotInGroup = new ArrayList<com.groupon.odo.proxylib.models.Method>();\n List<com.groupon.odo.proxylib.models.Method> methodsInGroup = editService.getMethodsFromGroupId(groupId, null);\n\n for (int i = 0; i < allMethods.size(); i++) {\n boolean add = true;\n String methodName = allMethods.get(i).getMethodName();\n String className = allMethods.get(i).getClassName();\n\n for (int j = 0; j < methodsInGroup.size(); j++) {\n if ((methodName.equals(methodsInGroup.get(j).getMethodName())) &&\n (className.equals(methodsInGroup.get(j).getClassName()))) {\n add = false;\n }\n }\n if (add) {\n methodsNotInGroup.add(allMethods.get(i));\n }\n }\n return methodsNotInGroup;\n }",
"public boolean deleteExisting(final File file) {\n if (!file.exists()) {\n return true;\n }\n boolean deleted = false;\n if (file.canWrite()) {\n deleted = file.delete();\n } else {\n LogLog.debug(file + \" is not writeable for delete (retrying)\");\n }\n if (!deleted) {\n if (!file.exists()) {\n deleted = true;\n } else {\n file.delete();\n deleted = (!file.exists());\n }\n }\n return deleted;\n }",
"public void transform(String name, String transform) throws Exception {\n\n File configFile = new File(m_configDir, name);\n File transformFile = new File(m_xsltDir, transform);\n try (InputStream stream = new FileInputStream(transformFile)) {\n StreamSource source = new StreamSource(stream);\n transform(configFile, source);\n }\n }",
"public static String copyToString(InputStream in, Charset charset) throws IOException {\n\t\tAssert.notNull(in, \"No InputStream specified\");\n\t\tStringBuilder out = new StringBuilder();\n\t\tInputStreamReader reader = new InputStreamReader(in, charset);\n\t\tchar[] buffer = new char[BUFFER_SIZE];\n\t\tint bytesRead = -1;\n\t\twhile ((bytesRead = reader.read(buffer)) != -1) {\n\t\t\tout.append(buffer, 0, bytesRead);\n\t\t}\n\t\treturn out.toString();\n\t}"
] |
Returns a time interval as Solr compatible query string.
@param searchField the field to search for.
@param startTime the lower limit of the interval.
@param endTime the upper limit of the interval.
@return Solr compatible query string. | [
"public static String getDateCreatedTimeRangeFilterQuery(String searchField, long startTime, long endTime) {\n\n String sStartTime = null;\n String sEndTime = null;\n\n // Convert startTime to ISO 8601 format\n if ((startTime > Long.MIN_VALUE) && (startTime < Long.MAX_VALUE)) {\n sStartTime = CmsSearchUtil.getDateAsIso8601(new Date(startTime));\n }\n\n // Convert endTime to ISO 8601 format\n if ((endTime > Long.MIN_VALUE) && (endTime < Long.MAX_VALUE)) {\n sEndTime = CmsSearchUtil.getDateAsIso8601(new Date(endTime));\n }\n\n // Build Solr range string\n final String rangeString = CmsSearchUtil.getSolrRangeString(sStartTime, sEndTime);\n\n // Build Solr filter string\n return String.format(\"%s:%s\", searchField, rangeString);\n }"
] | [
"@SuppressWarnings(\"unchecked\")\n public <T extends ReportModel> T getReportByName(String name, Class<T> clazz)\n {\n WindupVertexFrame model = this.getUniqueByProperty(ReportModel.REPORT_NAME, name);\n try\n {\n return (T) model;\n }\n catch (ClassCastException ex)\n {\n throw new WindupException(\"The vertex is not of expected frame type \" + clazz.getName() + \": \" + model.toPrettyString());\n }\n }",
"public JSONObject toJSON() {\n try {\n return new JSONObject(properties).putOpt(\"name\", getName());\n } catch (JSONException e) {\n e.printStackTrace();\n Log.e(TAG, e, \"toJSON()\");\n throw new RuntimeAssertion(\"NodeEntry.toJSON() failed for '%s'\", this);\n }\n }",
"public static boolean isRegularQueue(final Jedis jedis, final String key) {\n return LIST.equalsIgnoreCase(jedis.type(key));\n }",
"public void afterLoading(CollectionProxyDefaultImpl colProxy)\r\n {\r\n if (log.isDebugEnabled()) log.debug(\"loading a proxied collection a collection: \" + colProxy);\r\n Collection data = colProxy.getData();\r\n for (Iterator iterator = data.iterator(); iterator.hasNext();)\r\n {\r\n Object o = iterator.next();\r\n if(!isOpen())\r\n {\r\n log.error(\"Collection proxy materialization outside of a running tx, obj=\" + o);\r\n try{throw new Exception(\"Collection proxy materialization outside of a running tx, obj=\" + o);}\r\n catch(Exception e)\r\n {e.printStackTrace();}\r\n }\r\n else\r\n {\r\n Identity oid = getBroker().serviceIdentity().buildIdentity(o);\r\n ClassDescriptor cld = getBroker().getClassDescriptor(ProxyHelper.getRealClass(o));\r\n RuntimeObject rt = new RuntimeObject(o, oid, cld, false, ProxyHelper.isProxy(o));\r\n lockAndRegister(rt, Transaction.READ, isImplicitLocking(), getRegistrationList());\r\n }\r\n }\r\n unregisterFromCollectionProxy(colProxy);\r\n }",
"private List<Event> filterEvents(List<Event> events) {\n List<Event> filteredEvents = new ArrayList<Event>();\n for (Event event : events) {\n if (!filter(event)) {\n filteredEvents.add(event);\n }\n }\n return filteredEvents;\n }",
"private int findAvailablePortNumber( Integer portNumberStartingPoint, List<Integer> reservedPorts )\n {\n assert portNumberStartingPoint != null;\n int candidate = portNumberStartingPoint;\n while ( reservedPorts.contains( candidate ) )\n {\n candidate++;\n }\n return candidate;\n }",
"private File getDisabledMarkerFile(long version) throws PersistenceFailureException {\n File[] versionDirArray = ReadOnlyUtils.getVersionDirs(rootDir, version, version);\n if (versionDirArray.length == 0) {\n throw new PersistenceFailureException(\"getDisabledMarkerFile did not find the requested version directory\" +\n \" on disk. Version: \" + version + \", rootDir: \" + rootDir);\n }\n File disabledMarkerFile = new File(versionDirArray[0], DISABLED_MARKER_NAME);\n return disabledMarkerFile;\n }",
"private long size(final Jedis jedis, final String queueName) {\n final String key = key(QUEUE, queueName);\n final long size;\n if (JedisUtils.isDelayedQueue(jedis, key)) { // If delayed queue, use ZCARD\n size = jedis.zcard(key);\n } else { // Else, use LLEN\n size = jedis.llen(key);\n }\n return size;\n }",
"public 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 }"
] |
Returns a single item from the Iterator.
If there's none, returns null.
If there are more, throws an IllegalStateException.
@throws IllegalStateException | [
"public static final <T> T getSingle( Iterable<T> it ) {\n if( ! it.iterator().hasNext() )\n return null;\n\n final Iterator<T> iterator = it.iterator();\n T o = iterator.next();\n if(iterator.hasNext())\n throw new IllegalStateException(\"Found multiple items in iterator over \" + o.getClass().getName() );\n\n return o;\n }"
] | [
"private void process(String input, String output) throws MPXJException, IOException\n {\n //\n // Extract the project data\n //\n MPPReader reader = new MPPReader();\n m_project = reader.read(input);\n\n String varDataFileName;\n String projectDirName;\n int mppFileType = NumberHelper.getInt(m_project.getProjectProperties().getMppFileType());\n switch (mppFileType)\n {\n case 8:\n {\n projectDirName = \" 1\";\n varDataFileName = \"FixDeferFix 0\";\n break;\n }\n\n case 9:\n {\n projectDirName = \" 19\";\n varDataFileName = \"Var2Data\";\n break;\n }\n\n case 12:\n {\n projectDirName = \" 112\";\n varDataFileName = \"Var2Data\";\n break;\n }\n\n case 14:\n {\n projectDirName = \" 114\";\n varDataFileName = \"Var2Data\";\n break;\n }\n\n default:\n {\n throw new IllegalArgumentException(\"Unsupported file type \" + mppFileType);\n }\n }\n\n //\n // Load the raw file\n //\n FileInputStream is = new FileInputStream(input);\n POIFSFileSystem fs = new POIFSFileSystem(is);\n is.close();\n\n //\n // Locate the root of the project file system\n //\n DirectoryEntry root = fs.getRoot();\n m_projectDir = (DirectoryEntry) root.getEntry(projectDirName);\n\n //\n // Process Tasks\n //\n Map<String, String> replacements = new HashMap<String, String>();\n for (Task task : m_project.getTasks())\n {\n mapText(task.getName(), replacements);\n }\n processReplacements(((DirectoryEntry) m_projectDir.getEntry(\"TBkndTask\")), varDataFileName, replacements, true);\n\n //\n // Process Resources\n //\n replacements.clear();\n for (Resource resource : m_project.getResources())\n {\n mapText(resource.getName(), replacements);\n mapText(resource.getInitials(), replacements);\n }\n processReplacements((DirectoryEntry) m_projectDir.getEntry(\"TBkndRsc\"), varDataFileName, replacements, true);\n\n //\n // Process project properties\n //\n replacements.clear();\n ProjectProperties properties = m_project.getProjectProperties();\n mapText(properties.getProjectTitle(), replacements);\n processReplacements(m_projectDir, \"Props\", replacements, true);\n\n replacements.clear();\n mapText(properties.getProjectTitle(), replacements);\n mapText(properties.getSubject(), replacements);\n mapText(properties.getAuthor(), replacements);\n mapText(properties.getKeywords(), replacements);\n mapText(properties.getComments(), replacements);\n processReplacements(root, \"\\005SummaryInformation\", replacements, false);\n\n replacements.clear();\n mapText(properties.getManager(), replacements);\n mapText(properties.getCompany(), replacements);\n mapText(properties.getCategory(), replacements);\n processReplacements(root, \"\\005DocumentSummaryInformation\", replacements, false);\n\n //\n // Write the replacement raw file\n //\n FileOutputStream os = new FileOutputStream(output);\n fs.writeFilesystem(os);\n os.flush();\n os.close();\n fs.close();\n }",
"private void writeStringField(String fieldName, Object value) throws IOException\n {\n String val = value.toString();\n if (!val.isEmpty())\n {\n m_writer.writeNameValuePair(fieldName, val);\n }\n }",
"private static boolean typeEquals(ParameterizedType from,\n\t\t\tParameterizedType to, Map<String, Type> typeVarMap) {\n\t\tif (from.getRawType().equals(to.getRawType())) {\n\t\t\tType[] fromArgs = from.getActualTypeArguments();\n\t\t\tType[] toArgs = to.getActualTypeArguments();\n\t\t\tfor (int i = 0; i < fromArgs.length; i++) {\n\t\t\t\tif (!matches(fromArgs[i], toArgs[i], typeVarMap)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"public GVRAnimator animate(int animIndex, float timeInSec)\n {\n if ((animIndex < 0) || (animIndex >= mAnimations.size()))\n {\n throw new IndexOutOfBoundsException(\"Animation index out of bounds\");\n }\n GVRAnimator anim = mAnimations.get(animIndex);\n anim.animate(timeInSec);\n return anim;\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 boolean endsWith(Bytes suffix) {\n Objects.requireNonNull(suffix, \"endsWith(Bytes suffix) cannot have null parameter\");\n int startOffset = this.length - suffix.length;\n\n if (startOffset < 0) {\n return false;\n } else {\n int end = startOffset + this.offset + suffix.length;\n for (int i = startOffset + this.offset, j = suffix.offset; i < end; i++, j++) {\n if (this.data[i] != suffix.data[j]) {\n return false;\n }\n }\n }\n return true;\n }",
"public static void showChannels(Object... channels){\r\n // TODO this could share more code with the other show/hide(Only)Channels methods\r\n for(LogRecordHandler handler : handlers){\r\n if(handler instanceof VisibilityHandler){\r\n VisibilityHandler visHandler = (VisibilityHandler) handler;\r\n for (Object channel : channels) {\r\n visHandler.alsoShow(channel);\r\n }\r\n }\r\n }\r\n }",
"@Override\n public void close() {\n // unregister MBeans\n if(stats != null) {\n try {\n if(this.jmxEnabled)\n JmxUtils.unregisterMbean(getAggregateMetricName());\n } catch(Exception e) {}\n stats.close();\n }\n factory.close();\n queuedPool.close();\n }",
"public final void printClientConfig(final JSONWriter json) throws JSONException {\n json.key(\"layouts\");\n json.array();\n final Map<String, Template> accessibleTemplates = getTemplates();\n accessibleTemplates.entrySet().stream().sorted(Comparator.comparing(Map.Entry::getKey))\n .forEach(entry -> {\n json.object();\n json.key(\"name\").value(entry.getKey());\n entry.getValue().printClientConfig(json);\n json.endObject();\n });\n json.endArray();\n json.key(\"smtp\").object();\n json.key(\"enabled\").value(smtp != null);\n if (smtp != null) {\n json.key(\"storage\").object();\n json.key(\"enabled\").value(smtp.getStorage() != null);\n json.endObject();\n }\n json.endObject();\n }"
] |
Formats a date or a time range according to the local conventions.
You should ensure that start/end are in the same timezone; formatDateRange()
doesn't handle start/end in different timezones well.
See {@link android.text.format.DateUtils#formatDateRange} for full docs.
@param context the context is required only if the time is shown
@param start the start time
@param end the end time
@param flags a bit mask of options
@return a string containing the formatted date/time range | [
"public static String formatDateRange(Context context, ReadablePartial start, ReadablePartial end, int flags) {\n return formatDateRange(context, toMillis(start), toMillis(end), flags);\n }"
] | [
"public ValueContainer[] getCurrentLockingValues(Object o) throws PersistenceBrokerException\r\n {\r\n FieldDescriptor[] fields = getLockingFields();\r\n ValueContainer[] result = new ValueContainer[fields.length];\r\n for (int i = 0; i < result.length; i++)\r\n {\r\n result[i] = new ValueContainer(fields[i].getPersistentField().get(o), fields[i].getJdbcType());\r\n }\r\n return result;\r\n }",
"private static int getBinaryLength(int version, QrMode[] inputModeUnoptimized, int[] inputData, boolean gs1, int eciMode) {\n\n int i, j;\n QrMode currentMode;\n int inputLength = inputModeUnoptimized.length;\n int count = 0;\n int alphaLength;\n int percent = 0;\n\n // ZINT NOTE: in Zint, this call modifies the input mode array directly; here, we leave\n // the original array alone so that subsequent binary length checks don't irrevocably\n // optimize the mode array for the wrong QR Code version\n QrMode[] inputMode = applyOptimisation(version, inputModeUnoptimized);\n\n currentMode = QrMode.NULL;\n\n if (gs1) {\n count += 4;\n }\n\n if (eciMode != 3) {\n count += 12;\n }\n\n for (i = 0; i < inputLength; i++) {\n if (inputMode[i] != currentMode) {\n count += 4;\n switch (inputMode[i]) {\n case KANJI:\n count += tribus(version, 8, 10, 12);\n count += (blockLength(i, inputMode) * 13);\n break;\n case BINARY:\n count += tribus(version, 8, 16, 16);\n for (j = i; j < (i + blockLength(i, inputMode)); j++) {\n if (inputData[j] > 0xff) {\n count += 16;\n } else {\n count += 8;\n }\n }\n break;\n case ALPHANUM:\n count += tribus(version, 9, 11, 13);\n alphaLength = blockLength(i, inputMode);\n // In alphanumeric mode % becomes %%\n if (gs1) {\n for (j = i; j < (i + alphaLength); j++) { // TODO: need to do this only if in GS1 mode? or is the other code wrong? https://sourceforge.net/p/zint/tickets/104/#227b\n if (inputData[j] == '%') {\n percent++;\n }\n }\n }\n alphaLength += percent;\n switch (alphaLength % 2) {\n case 0:\n count += (alphaLength / 2) * 11;\n break;\n case 1:\n count += ((alphaLength - 1) / 2) * 11;\n count += 6;\n break;\n }\n break;\n case NUMERIC:\n count += tribus(version, 10, 12, 14);\n switch (blockLength(i, inputMode) % 3) {\n case 0:\n count += (blockLength(i, inputMode) / 3) * 10;\n break;\n case 1:\n count += ((blockLength(i, inputMode) - 1) / 3) * 10;\n count += 4;\n break;\n case 2:\n count += ((blockLength(i, inputMode) - 2) / 3) * 10;\n count += 7;\n break;\n }\n break;\n }\n currentMode = inputMode[i];\n }\n }\n\n return count;\n }",
"public PathAddress append(List<PathElement> additionalElements) {\n final ArrayList<PathElement> newList = new ArrayList<PathElement>(pathAddressList.size() + additionalElements.size());\n newList.addAll(pathAddressList);\n newList.addAll(additionalElements);\n return pathAddress(newList);\n }",
"private static long scanForLocSig(FileChannel channel) throws IOException {\n\n channel.position(0);\n\n ByteBuffer bb = getByteBuffer(CHUNK_SIZE);\n long end = channel.size();\n while (channel.position() <= end) {\n\n read(bb, channel);\n\n int bufferPos = 0;\n while (bufferPos <= bb.limit() - SIG_PATTERN_LENGTH) {\n\n // Following is based on the Boyer Moore algorithm but simplified to reflect\n // a) the size of the pattern is static\n // b) the pattern is static and has no repeating bytes\n\n int patternPos;\n for (patternPos = SIG_PATTERN_LENGTH - 1;\n patternPos >= 0 && LOCSIG_PATTERN[patternPos] == bb.get(bufferPos + patternPos);\n --patternPos) {\n // empty loop while bytes match\n }\n\n // Outer switch gives same results as checking the \"good suffix array\" in the Boyer Moore algorithm\n switch (patternPos) {\n case -1: {\n // Pattern matched. Confirm is this is the start of a valid local file record\n long startLocRecord = channel.position() - bb.limit() + bufferPos;\n long currentPos = channel.position();\n if (validateLocalFileRecord(channel, startLocRecord, -1)) {\n return startLocRecord;\n }\n // Restore position in case it shifted\n channel.position(currentPos);\n\n // wasn't a valid local file record; continue scan\n bufferPos += 4;\n break;\n }\n case 3: {\n // No bytes matched; the common case.\n // With our pattern, this is the only case where the Boyer Moore algorithm's \"bad char array\" may\n // produce a shift greater than the \"good suffix array\" (which would shift 1 byte)\n int idx = bb.get(bufferPos + patternPos) - Byte.MIN_VALUE;\n bufferPos += LOC_BAD_BYTE_SKIP[idx];\n break;\n }\n default:\n // 1 or more bytes matched\n bufferPos += 4;\n }\n }\n }\n\n return -1;\n }",
"public void setTabs(ArrayList<String>tabs) {\n if (tabs == null || tabs.size() <= 0) return;\n\n if (platformSupportsTabs) {\n ArrayList<String> toAdd;\n if (tabs.size() > MAX_TABS) {\n toAdd = new ArrayList<>(tabs.subList(0, MAX_TABS));\n } else {\n toAdd = tabs;\n }\n this.tabs = toAdd.toArray(new String[0]);\n } else {\n Logger.d(\"Please upgrade com.android.support:design library to v28.0.0 to enable Tabs for App Inbox, dropping Tabs\");\n }\n }",
"protected void checkForPrimaryKeys(final Object realObject) throws ClassNotPersistenceCapableException\r\n {\r\n // if no PKs are specified OJB can't handle this class !\r\n if (m_pkValues == null || m_pkValues.length == 0)\r\n {\r\n throw createException(\"OJB needs at least one primary key attribute for class: \", realObject, null);\r\n }\r\n// arminw: should never happen\r\n// if(m_pkValues[0] instanceof ValueContainer)\r\n// throw new OJBRuntimeException(\"Can't handle pk values of type \"+ValueContainer.class.getName());\r\n }",
"public static base_response update(nitro_service client, Interface resource) throws Exception {\n\t\tInterface updateresource = new Interface();\n\t\tupdateresource.id = resource.id;\n\t\tupdateresource.speed = resource.speed;\n\t\tupdateresource.duplex = resource.duplex;\n\t\tupdateresource.flowctl = resource.flowctl;\n\t\tupdateresource.autoneg = resource.autoneg;\n\t\tupdateresource.hamonitor = resource.hamonitor;\n\t\tupdateresource.tagall = resource.tagall;\n\t\tupdateresource.trunk = resource.trunk;\n\t\tupdateresource.lacpmode = resource.lacpmode;\n\t\tupdateresource.lacpkey = resource.lacpkey;\n\t\tupdateresource.lagtype = resource.lagtype;\n\t\tupdateresource.lacppriority = resource.lacppriority;\n\t\tupdateresource.lacptimeout = resource.lacptimeout;\n\t\tupdateresource.ifalias = resource.ifalias;\n\t\tupdateresource.throughput = resource.throughput;\n\t\tupdateresource.bandwidthhigh = resource.bandwidthhigh;\n\t\tupdateresource.bandwidthnormal = resource.bandwidthnormal;\n\t\treturn updateresource.update_resource(client);\n\t}",
"private ProjectCalendarDateRanges getRanges(Date date, Calendar cal, Day day)\n {\n ProjectCalendarDateRanges ranges = getException(date);\n if (ranges == null)\n {\n ProjectCalendarWeek week = getWorkWeek(date);\n if (week == null)\n {\n week = this;\n }\n\n if (day == null)\n {\n if (cal == null)\n {\n cal = Calendar.getInstance();\n cal.setTime(date);\n }\n day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK));\n }\n\n ranges = week.getHours(day);\n }\n return ranges;\n }",
"protected void recordContentLoader(final String patchID, final PatchContentLoader contentLoader) {\n if (contentLoaders.containsKey(patchID)) {\n throw new IllegalStateException(\"Content loader already registered for patch \" + patchID); // internal wrong usage, no i18n\n }\n contentLoaders.put(patchID, contentLoader);\n }"
] |
Shifts are performed based upon singular values computed previously. If it does not converge
using one of those singular values it uses a Wilkinson shift instead. | [
"private void performScriptedStep() {\n double scale = computeBulgeScale();\n if( steps > giveUpOnKnown ) {\n // give up on the script\n followScript = false;\n } else {\n // use previous singular value to step\n double s = values[x2]/scale;\n performImplicitSingleStep(scale,s*s,false);\n }\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_responses unset(nitro_service client, Long clid[], String args[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (clid != null && clid.length > 0) {\n\t\t\tclusterinstance unsetresources[] = new clusterinstance[clid.length];\n\t\t\tfor (int i=0;i<clid.length;i++){\n\t\t\t\tunsetresources[i] = new clusterinstance();\n\t\t\t\tunsetresources[i].clid = clid[i];\n\t\t\t}\n\t\t\tresult = unset_bulk_request(client, unsetresources,args);\n\t\t}\n\t\treturn result;\n\t}",
"public SimplifySpanBuild append(String text) {\n if (TextUtils.isEmpty(text)) return this;\n\n mNormalSizeText.append(text);\n mStringBuilder.append(text);\n return this;\n }",
"public void fireCalendarWrittenEvent(ProjectCalendar calendar)\n {\n if (m_projectListeners != null)\n {\n for (ProjectListener listener : m_projectListeners)\n {\n listener.calendarWritten(calendar);\n }\n }\n }",
"public boolean hasRequiredMiniFluoProps() {\n boolean valid = true;\n if (getMiniStartAccumulo()) {\n // ensure that client properties are not set since we are using MiniAccumulo\n valid &= verifyStringPropNotSet(ACCUMULO_USER_PROP, CLIENT_ACCUMULO_USER_PROP);\n valid &= verifyStringPropNotSet(ACCUMULO_PASSWORD_PROP, CLIENT_ACCUMULO_PASSWORD_PROP);\n valid &= verifyStringPropNotSet(ACCUMULO_INSTANCE_PROP, CLIENT_ACCUMULO_INSTANCE_PROP);\n valid &= verifyStringPropNotSet(ACCUMULO_ZOOKEEPERS_PROP, CLIENT_ACCUMULO_ZOOKEEPERS_PROP);\n valid &= verifyStringPropNotSet(CONNECTION_ZOOKEEPERS_PROP, CLIENT_ZOOKEEPER_CONNECT_PROP);\n if (valid == false) {\n log.error(\"Client properties should not be set in your configuration if MiniFluo is \"\n + \"configured to start its own accumulo (indicated by fluo.mini.start.accumulo being \"\n + \"set to true)\");\n }\n } else {\n valid &= hasRequiredClientProps();\n valid &= hasRequiredAdminProps();\n valid &= hasRequiredOracleProps();\n valid &= hasRequiredWorkerProps();\n }\n return valid;\n }",
"public 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 void forAllExtents(String template, Properties attributes) throws XDocletException\r\n {\r\n for (Iterator it = _curClassDef.getExtentClasses(); it.hasNext(); )\r\n {\r\n _curExtent = (ClassDescriptorDef)it.next();\r\n generate(template);\r\n }\r\n _curExtent = null;\r\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 }",
"@Override\n public JulianDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {\n return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);\n }"
] |
remove the user profile with id from the db. | [
"synchronized void removeUserProfile(String id) {\n\n if (id == null) return;\n final String tableName = Table.USER_PROFILES.getName();\n try {\n final SQLiteDatabase db = dbHelper.getWritableDatabase();\n db.delete(tableName, \"_id = ?\", new String[]{id});\n } catch (final SQLiteException e) {\n getConfigLogger().verbose(\"Error removing user profile from \" + tableName + \" Recreating DB\");\n dbHelper.deleteDatabase();\n } finally {\n dbHelper.close();\n }\n }"
] | [
"public static String padOrTrim(String str, int num) {\r\n if (str == null) {\r\n str = \"null\";\r\n }\r\n int leng = str.length();\r\n if (leng < num) {\r\n StringBuilder sb = new StringBuilder(str);\r\n for (int i = 0; i < num - leng; i++) {\r\n sb.append(' ');\r\n }\r\n return sb.toString();\r\n } else if (leng > num) {\r\n return str.substring(0, num);\r\n } else {\r\n return str;\r\n }\r\n }",
"public static double volatilityConversionLognormalATMtoNormalATM(double forward, double displacement, double maturity, double lognormalVolatiltiy) {\n\t\tdouble x = lognormalVolatiltiy * Math.sqrt(maturity / 8);\n\t\tdouble y = org.apache.commons.math3.special.Erf.erf(x);\n\t\tdouble normalVol = Math.sqrt(2*Math.PI / maturity) * (forward+displacement) * y;\n\n\t\treturn normalVol;\n\t}",
"private void addResources(MpxjTreeNode parentNode, ProjectFile file)\n {\n for (Resource resource : file.getResources())\n {\n final Resource r = resource;\n MpxjTreeNode childNode = new MpxjTreeNode(resource)\n {\n @Override public String toString()\n {\n return r.getName();\n }\n };\n parentNode.add(childNode);\n }\n }",
"public static String getGalleryNotFoundKey(String gallery) {\n\n StringBuffer sb = new StringBuffer(ERROR_REASON_NO_PREFIX);\n sb.append(gallery.toUpperCase());\n sb.append(GUI_TITLE_POSTFIX);\n return sb.toString();\n }",
"public void setFirstOccurence(int min, int max) throws ParseException {\n if (fullCondition == null) {\n if ((min < 0) || (min > max) || (max < 1)) {\n throw new ParseException(\"Illegal number {\" + min + \",\" + max + \"}\");\n }\n if (min == 0) {\n firstOptional = true;\n }\n firstMinimumOccurence = Math.max(1, min);\n firstMaximumOccurence = max;\n } else {\n throw new ParseException(\"fullCondition already generated\");\n }\n }",
"private boolean checkZoneRequirement(HashMap<Integer, Integer> requiredRepFactor, int zoneId) {\n if(requiredRepFactor.containsKey(zoneId)) {\n if(requiredRepFactor.get(zoneId) == 0) {\n return false;\n } else {\n requiredRepFactor.put(zoneId, requiredRepFactor.get(zoneId) - 1);\n return true;\n }\n }\n return false;\n\n }",
"private void postProcessTasks()\n {\n List<Task> allTasks = m_file.getTasks();\n if (allTasks.size() > 1)\n {\n Collections.sort(allTasks);\n\n int taskID = -1;\n int lastTaskID = -1;\n\n for (int i = 0; i < allTasks.size(); i++)\n {\n Task task = allTasks.get(i);\n taskID = NumberHelper.getInt(task.getID());\n // In Project the tasks IDs are always contiguous so we can spot invalid tasks by making sure all\n // IDs are represented.\n if (!task.getNull() && lastTaskID != -1 && taskID > lastTaskID + 1)\n {\n // This task looks to be invalid.\n task.setNull(true);\n }\n else\n {\n lastTaskID = taskID;\n }\n }\n }\n }",
"private void logTimeTakenByRuleProvider(GraphContext graphContext, Context context, int ruleIndex, int timeTaken)\n {\n AbstractRuleProvider ruleProvider = (AbstractRuleProvider) context.get(RuleMetadataType.RULE_PROVIDER);\n if (ruleProvider == null)\n return;\n\n if (!timeTakenByProvider.containsKey(ruleProvider))\n {\n RuleProviderExecutionStatisticsModel model = new RuleProviderExecutionStatisticsService(graphContext)\n .create();\n model.setRuleIndex(ruleIndex);\n model.setRuleProviderID(ruleProvider.getMetadata().getID());\n model.setTimeTaken(timeTaken);\n\n timeTakenByProvider.put(ruleProvider, model.getElement().id());\n }\n else\n {\n RuleProviderExecutionStatisticsService service = new RuleProviderExecutionStatisticsService(graphContext);\n RuleProviderExecutionStatisticsModel model = service.getById(timeTakenByProvider.get(ruleProvider));\n int prevTimeTaken = model.getTimeTaken();\n model.setTimeTaken(prevTimeTaken + timeTaken);\n }\n logTimeTakenByPhase(graphContext, ruleProvider.getMetadata().getPhase(), timeTaken);\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 }"
] |
Returns iterable with all assignments of given type of this retention policy.
@param type the type of the retention policy assignment to retrieve. Can either be "folder" or "enterprise".
@param limit the limit of entries per response. The default value is 100.
@param fields the fields to retrieve.
@return an iterable containing all assignments of given type. | [
"private Iterable<BoxRetentionPolicyAssignment.Info> getAssignments(String type, int limit, String ... fields) {\r\n QueryStringBuilder queryString = new QueryStringBuilder();\r\n if (type != null) {\r\n queryString.appendParam(\"type\", type);\r\n }\r\n if (fields.length > 0) {\r\n queryString.appendParam(\"fields\", fields);\r\n }\r\n URL url = ASSIGNMENTS_URL_TEMPLATE.buildWithQuery(getAPI().getBaseURL(), queryString.toString(), getID());\r\n return new BoxResourceIterable<BoxRetentionPolicyAssignment.Info>(getAPI(), url, limit) {\r\n\r\n @Override\r\n protected BoxRetentionPolicyAssignment.Info factory(JsonObject jsonObject) {\r\n BoxRetentionPolicyAssignment assignment\r\n = new BoxRetentionPolicyAssignment(getAPI(), jsonObject.get(\"id\").asString());\r\n return assignment.new Info(jsonObject);\r\n }\r\n\r\n };\r\n }"
] | [
"public static byte[] removeContentFromExplodedAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws OperationFailedException, ExplodedContentException {\n final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS);\n ModelNode contentItemNode = getContentItem(deploymentResource);\n final byte[] oldHash = CONTENT_HASH.resolveModelAttribute(context, contentItemNode).asBytes();\n final List<String> paths = REMOVED_PATHS.unwrap(context, operation);\n final byte[] hash = contentRepository.removeContentFromExploded(oldHash, paths);\n\n // Clear the contents and update with the hash\n final ModelNode slave = operation.clone();\n slave.get(CONTENT).setEmptyList().add().get(HASH).set(hash);\n slave.get(CONTENT).add().get(ARCHIVE).set(false);\n // Add the domain op transformer\n List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);\n if (transformers == null) {\n context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());\n }\n transformers.add(new CompositeOperationAwareTransmuter(slave));\n return hash;\n }",
"public static File createFolder(String path, String dest_dir)\n throws BeastException {\n File f = new File(dest_dir);\n if (!f.isDirectory()) {\n try {\n f.mkdirs();\n } catch (Exception e) {\n logger.severe(\"Problem creating directory: \" + path\n + File.separator + dest_dir);\n }\n }\n\n String folderPath = createFolderPath(path);\n\n f = new File(f, folderPath);\n if (!f.isDirectory()) {\n try {\n f.mkdirs();\n } catch (Exception e) {\n String message = \"Problem creating directory: \" + path\n + File.separator + dest_dir;\n logger.severe(message);\n throw new BeastException(message, e);\n }\n }\n\n return f;\n }",
"public static final String printExtendedAttribute(MSPDIWriter writer, Object value, DataType type)\n {\n String result;\n\n if (type == DataType.DATE)\n {\n result = printExtendedAttributeDate((Date) value);\n }\n else\n {\n if (value instanceof Boolean)\n {\n result = printExtendedAttributeBoolean((Boolean) value);\n }\n else\n {\n if (value instanceof Duration)\n {\n result = printDuration(writer, (Duration) value);\n }\n else\n {\n if (type == DataType.CURRENCY)\n {\n result = printExtendedAttributeCurrency((Number) value);\n }\n else\n {\n if (value instanceof Number)\n {\n result = printExtendedAttributeNumber((Number) value);\n }\n else\n {\n result = value.toString();\n }\n }\n }\n }\n }\n\n return (result);\n }",
"public List<String> deviceTypes() {\n Integer count = json().size(DEVICE_FAMILIES);\n List<String> deviceTypes = new ArrayList<String>(count);\n for(int i = 0 ; i < count ; i++) {\n String familyNumber = json().stringValue(DEVICE_FAMILIES, i);\n if(familyNumber.equals(\"1\")) deviceTypes.add(\"iPhone\");\n if(familyNumber.equals(\"2\")) deviceTypes.add(\"iPad\");\n }\n return deviceTypes;\n }",
"static Path resolvePath(final Path base, final String... paths) {\n return Paths.get(base.toString(), paths);\n }",
"public CollectionRequest<Project> tasks(String project) {\n \n String path = String.format(\"/projects/%s/tasks\", project);\n return new CollectionRequest<Project>(this, Project.class, path, \"GET\");\n }",
"@Override\n\tpublic double getDiscountFactor(AnalyticModelInterface model, double maturity)\n\t{\n\t\t// Change time scale\n\t\tmaturity *= timeScaling;\n\n\t\tdouble beta1\t= parameter[0];\n\t\tdouble beta2\t= parameter[1];\n\t\tdouble beta3\t= parameter[2];\n\t\tdouble beta4\t= parameter[3];\n\t\tdouble tau1\t\t= parameter[4];\n\t\tdouble tau2\t\t= parameter[5];\n\n\t\tdouble x1 = tau1 > 0 ? FastMath.exp(-maturity/tau1) : 0.0;\n\t\tdouble x2 = tau2 > 0 ? FastMath.exp(-maturity/tau2) : 0.0;\n\n\t\tdouble y1 = tau1 > 0 ? (maturity > 0.0 ? (1.0-x1)/maturity*tau1 : 1.0) : 0.0;\n\t\tdouble y2 = tau2 > 0 ? (maturity > 0.0 ? (1.0-x2)/maturity*tau2 : 1.0) : 0.0;\n\n\t\tdouble zeroRate = beta1 + beta2 * y1 + beta3 * (y1-x1) + beta4 * (y2-x2);\n\n\t\treturn Math.exp(- zeroRate * maturity);\n\t}",
"public void add(Map<String, Object> map) throws SQLException {\n if (withinDataSetBatch) {\n if (batchData.size() == 0) {\n batchKeys = map.keySet();\n } else {\n if (!map.keySet().equals(batchKeys)) {\n throw new IllegalArgumentException(\"Inconsistent keys found for batch add!\");\n }\n }\n batchData.add(map);\n return;\n }\n int answer = executeUpdate(buildListQuery(map), new ArrayList<Object>(map.values()));\n if (answer != 1) {\n LOG.warning(\"Should have updated 1 row not \" + answer + \" when trying to add: \" + map);\n }\n }",
"List<LogSegment> markDeletedWhile(LogSegmentFilter filter) throws IOException {\n synchronized (lock) {\n List<LogSegment> view = segments.getView();\n List<LogSegment> deletable = new ArrayList<LogSegment>();\n for (LogSegment seg : view) {\n if (filter.filter(seg)) {\n deletable.add(seg);\n }\n }\n for (LogSegment seg : deletable) {\n seg.setDeleted(true);\n }\n int numToDelete = deletable.size();\n //\n // if we are deleting everything, create a new empty segment\n if (numToDelete == view.size()) {\n if (view.get(numToDelete - 1).size() > 0) {\n roll();\n } else {\n // If the last segment to be deleted is empty and we roll the log, the new segment will have the same\n // file name. So simply reuse the last segment and reset the modified time.\n view.get(numToDelete - 1).getFile().setLastModified(System.currentTimeMillis());\n numToDelete -= 1;\n }\n }\n return segments.trunc(numToDelete);\n }\n }"
] |
Shows the given step.
@param step the step | [
"protected void showStep(A_CmsSetupStep step) {\n\n Window window = newWindow();\n window.setContent(step);\n window.setCaption(step.getTitle());\n A_CmsUI.get().addWindow(window);\n window.center();\n }"
] | [
"public static HttpConnection createPost(URI uri, String body, String contentType) {\n HttpConnection connection = Http.POST(uri, \"application/json\");\n if(body != null) {\n setEntity(connection, body, contentType);\n }\n return connection;\n }",
"public static String cutEnd(String data, int maxLength) {\n if (data.length() > maxLength) {\n return data.substring(0, maxLength) + \"...\";\n } else {\n return data;\n }\n }",
"public void addPropertyChangeListener (String propertyName, java.beans.PropertyChangeListener listener)\r\n {\r\n this.propertyChangeDelegate.addPropertyChangeListener(propertyName, listener);\r\n }",
"public static void main(String[] args) {\n try {\n new StartMain(args).go();\n } catch(Throwable t) {\n WeldSELogger.LOG.error(\"Application exited with an exception\", t);\n System.exit(1);\n }\n }",
"public void scale(double v){\n\t\tfor(int i = 0; i < this.size(); i++){\n\t\t\tthis.get(i).scale(v);;\n\t\t}\n\t}",
"private float colorToAngle(int color) {\n\t\tfloat[] colors = new float[3];\n\t\tColor.colorToHSV(color, colors);\n\t\t\n\t\treturn (float) Math.toRadians(-colors[0]);\n\t}",
"public static base_response delete(nitro_service client, ntpserver resource) throws Exception {\n\t\tntpserver deleteresource = new ntpserver();\n\t\tdeleteresource.serverip = resource.serverip;\n\t\tdeleteresource.servername = resource.servername;\n\t\treturn deleteresource.delete_resource(client);\n\t}",
"public static systemuser[] get(nitro_service service) throws Exception{\n\t\tsystemuser obj = new systemuser();\n\t\tsystemuser[] response = (systemuser[])obj.get_resources(service);\n\t\treturn response;\n\t}",
"public static authenticationvserver_authenticationradiuspolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tauthenticationvserver_authenticationradiuspolicy_binding obj = new authenticationvserver_authenticationradiuspolicy_binding();\n\t\tobj.set_name(name);\n\t\tauthenticationvserver_authenticationradiuspolicy_binding response[] = (authenticationvserver_authenticationradiuspolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}"
] |
Starts the transition | [
"public void start() {\n if (TransitionConfig.isDebug()) {\n getTransitionStateHolder().start();\n }\n\n mLastProgress = Float.MIN_VALUE;\n\n TransitionController transitionController;\n for (int i = 0, size = mTransitionControls.size(); i < size; i++) {\n transitionController = mTransitionControls.get(i);\n if (mInterpolator != null) {\n transitionController.setInterpolator(mInterpolator);\n }\n //required for ViewPager transitions to work\n if (mTarget != null) {\n transitionController.setTarget(mTarget);\n }\n transitionController.setUpdateStateAfterUpdateProgress(mUpdateStateAfterUpdateProgress);\n transitionController.start();\n }\n }"
] | [
"public void setValue(String propName, Object value) {\n for (RequestProp prop : props) {\n if (prop.getName().equals(propName)) {\n JComponent valComp = prop.getValueComponent();\n if (valComp instanceof JTextComponent) {\n ((JTextComponent)valComp).setText(value.toString());\n }\n if (valComp instanceof AbstractButton) {\n ((AbstractButton)valComp).setSelected((Boolean)value);\n }\n if (valComp instanceof JComboBox) {\n ((JComboBox)valComp).setSelectedItem(value);\n }\n return;\n }\n }\n }",
"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 }",
"public static base_response update(nitro_service client, protocolhttpband resource) throws Exception {\n\t\tprotocolhttpband updateresource = new protocolhttpband();\n\t\tupdateresource.reqbandsize = resource.reqbandsize;\n\t\tupdateresource.respbandsize = resource.respbandsize;\n\t\treturn updateresource.update_resource(client);\n\t}",
"public void map(Story story, MetaFilter metaFilter) {\n if (metaFilter.allow(story.getMeta())) {\n boolean allowed = false;\n for (Scenario scenario : story.getScenarios()) {\n // scenario also inherits meta from story\n Meta inherited = scenario.getMeta().inheritFrom(story.getMeta());\n if (metaFilter.allow(inherited)) {\n allowed = true;\n break;\n }\n }\n if (allowed) {\n add(metaFilter.asString(), story);\n }\n }\n }",
"void setDayOfMonth(String day) {\n\n final int i = CmsSerialDateUtil.toIntWithDefault(day, -1);\n if (m_model.getDayOfMonth() != i) {\n removeExceptionsOnChange(new Command() {\n\n public void execute() {\n\n m_model.setDayOfMonth(i);\n onValueChange();\n }\n });\n }\n }",
"public List<PPVItemsType.PPVItem> getPPVItem()\n {\n if (ppvItem == null)\n {\n ppvItem = new ArrayList<PPVItemsType.PPVItem>();\n }\n return this.ppvItem;\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 List<List<IN>> classify(String str) {\r\n ObjectBank<List<IN>> documents =\r\n makeObjectBankFromString(str, plainTextReaderAndWriter);\r\n List<List<IN>> result = new ArrayList<List<IN>>();\r\n\r\n for (List<IN> document : documents) {\r\n classify(document);\r\n\r\n List<IN> sentence = new ArrayList<IN>();\r\n for (IN wi : document) {\r\n // TaggedWord word = new TaggedWord(wi.word(), wi.answer());\r\n // sentence.add(word);\r\n sentence.add(wi);\r\n }\r\n result.add(sentence);\r\n }\r\n return result;\r\n }",
"public FieldDescriptor getAutoIncrementField()\r\n {\r\n if (m_autoIncrementField == null)\r\n {\r\n FieldDescriptor[] fds = getPkFields();\r\n\r\n for (int i = 0; i < fds.length; i++)\r\n {\r\n FieldDescriptor fd = fds[i];\r\n if (fd.isAutoIncrement())\r\n {\r\n m_autoIncrementField = fd;\r\n break;\r\n }\r\n }\r\n }\r\n if (m_autoIncrementField == null)\r\n {\r\n LoggerFactory.getDefaultLogger().warn(\r\n this.getClass().getName()\r\n + \": \"\r\n + \"Could not find autoincrement attribute for class: \"\r\n + this.getClassNameOfObject());\r\n }\r\n return m_autoIncrementField;\r\n }"
] |
Adds a Statement to a given collection of statement groups.
If the statement id is not null and matches that of an existing statement,
this statement will be replaced.
@param statement
@param claims
@return | [
"protected static Map<String, List<Statement>> addStatementToGroups(Statement statement, Map<String, List<Statement>> claims) {\n\t\tMap<String, List<Statement>> newGroups = new HashMap<>(claims);\n\t\tString pid = statement.getMainSnak().getPropertyId().getId();\n\t\tif(newGroups.containsKey(pid)) {\n\t\t\tList<Statement> newGroup = new ArrayList<>(newGroups.get(pid).size());\n\t\t\tboolean statementReplaced = false;\n\t\t\tfor(Statement existingStatement : newGroups.get(pid)) {\n\t\t\t\tif(existingStatement.getStatementId().equals(statement.getStatementId()) &&\n\t\t\t\t\t\t!existingStatement.getStatementId().isEmpty()) {\n\t\t\t\t\tstatementReplaced = true;\n\t\t\t\t\tnewGroup.add(statement);\n\t\t\t\t} else {\n\t\t\t\t\tnewGroup.add(existingStatement);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!statementReplaced) {\n\t\t\t\tnewGroup.add(statement);\n\t\t\t}\n\t\t\tnewGroups.put(pid, newGroup);\n\t\t} else {\n\t\t\tnewGroups.put(pid, Collections.singletonList(statement));\n\t\t}\n\t\treturn newGroups;\n\t}"
] | [
"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 }",
"public GVRShaderId getShaderType(Class<? extends GVRShader> shaderClass)\n {\n GVRShaderId shaderId = mShaderTemplates.get(shaderClass);\n\n if (shaderId == null)\n {\n GVRContext ctx = getGVRContext();\n shaderId = new GVRShaderId(shaderClass);\n mShaderTemplates.put(shaderClass, shaderId);\n shaderId.getTemplate(ctx);\n }\n return shaderId;\n }",
"public static void waitForStandalone(final ModelControllerClient client, final long startupTimeout)\n throws InterruptedException, RuntimeException, TimeoutException {\n waitForStandalone(null, client, startupTimeout);\n }",
"private Duration getAssignmentWork(ProjectCalendar calendar, TimephasedWork assignment)\n {\n Date assignmentStart = assignment.getStart();\n\n Date splitStart = assignmentStart;\n Date splitFinishTime = calendar.getFinishTime(splitStart);\n Date splitFinish = DateHelper.setTime(splitStart, splitFinishTime);\n\n Duration calendarSplitWork = calendar.getWork(splitStart, splitFinish, TimeUnit.MINUTES);\n Duration assignmentWorkPerDay = assignment.getAmountPerDay();\n Duration splitWork;\n\n double splitMinutes = assignmentWorkPerDay.getDuration();\n splitMinutes *= calendarSplitWork.getDuration();\n splitMinutes /= (8 * 60); // this appears to be a fixed value\n splitWork = Duration.getInstance(splitMinutes, TimeUnit.MINUTES);\n return splitWork;\n }",
"public void setIndirectionHandlerClass(Class indirectionHandlerClass)\r\n {\r\n if(indirectionHandlerClass == null)\r\n {\r\n //throw new MetadataException(\"No IndirectionHandlerClass specified.\");\r\n /**\r\n * andrew.clute\r\n * Allow the default IndirectionHandler for the given ProxyFactory implementation\r\n * when the parameter is not given\r\n */\r\n indirectionHandlerClass = getDefaultIndirectionHandlerClass();\r\n }\r\n if(indirectionHandlerClass.isInterface()\r\n || Modifier.isAbstract(indirectionHandlerClass.getModifiers())\r\n || !getIndirectionHandlerBaseClass().isAssignableFrom(indirectionHandlerClass))\r\n {\r\n throw new MetadataException(\"Illegal class \"\r\n + indirectionHandlerClass.getName()\r\n + \" specified for IndirectionHandlerClass. Must be a concrete subclass of \"\r\n + getIndirectionHandlerBaseClass().getName());\r\n }\r\n _indirectionHandlerClass = indirectionHandlerClass;\r\n }",
"private static void close(Closeable closeable) {\n\t\tif (closeable != null) {\n\t\t\ttry {\n\t\t\t\tcloseable.close();\n\t\t\t} catch (IOException ignored) {\n\t\t\t\tlogger.error(\"Failed to close output stream: \"\n\t\t\t\t\t\t+ ignored.getMessage());\n\t\t\t}\n\t\t}\n\t}",
"public static systemcollectionparam get(nitro_service service) throws Exception{\n\t\tsystemcollectionparam obj = new systemcollectionparam();\n\t\tsystemcollectionparam[] response = (systemcollectionparam[])obj.get_resources(service);\n\t\treturn response[0];\n\t}",
"private void writeDoubleField(String fieldName, Object value) throws IOException\n {\n double val = ((Number) value).doubleValue();\n if (val != 0)\n {\n m_writer.writeNameValuePair(fieldName, val);\n }\n }",
"public static base_response add(nitro_service client, snmpmanager resource) throws Exception {\n\t\tsnmpmanager addresource = new snmpmanager();\n\t\taddresource.ipaddress = resource.ipaddress;\n\t\taddresource.netmask = resource.netmask;\n\t\taddresource.domainresolveretry = resource.domainresolveretry;\n\t\treturn addresource.add_resource(client);\n\t}"
] |
Counts the coordinates stored in a single statement for the relevant
property, if they are actually given and valid.
@param statement
@param itemDocument | [
"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 static Calendar parseDividendDate(String date) {\n if (!Utils.isParseable(date)) {\n return null;\n }\n date = date.trim();\n SimpleDateFormat format = new SimpleDateFormat(Utils.getDividendDateFormat(date), Locale.US);\n format.setTimeZone(TimeZone.getTimeZone(YahooFinance.TIMEZONE));\n try {\n Calendar today = Calendar.getInstance(TimeZone.getTimeZone(YahooFinance.TIMEZONE));\n Calendar parsedDate = Calendar.getInstance(TimeZone.getTimeZone(YahooFinance.TIMEZONE));\n parsedDate.setTime(format.parse(date));\n\n if (parsedDate.get(Calendar.YEAR) == 1970) {\n // Not really clear which year the dividend date is... making a reasonable guess.\n int monthDiff = parsedDate.get(Calendar.MONTH) - today.get(Calendar.MONTH);\n int year = today.get(Calendar.YEAR);\n if (monthDiff > 6) {\n year -= 1;\n } else if (monthDiff < -6) {\n year += 1;\n }\n parsedDate.set(Calendar.YEAR, year);\n }\n\n return parsedDate;\n } catch (ParseException ex) {\n log.warn(\"Failed to parse dividend date: \" + date);\n log.debug(\"Failed to parse dividend date: \" + date, ex);\n return null;\n }\n }",
"public boolean classifyDocumentStdin(DocumentReaderAndWriter<IN> readerWriter)\r\n throws IOException\r\n {\r\n BufferedReader is = new BufferedReader(new InputStreamReader(System.in, flags.inputEncoding));\r\n String line;\r\n String text = \"\";\r\n String eol = \"\\n\";\r\n String sentence = \"<s>\";\r\n int blankLines = 0;\r\n while ((line = is.readLine()) != null) {\r\n if (line.trim().equals(\"\")) {\r\n \t ++blankLines;\r\n \t if (blankLines > 3) {\r\n \t\t return false;\r\n \t } else if (blankLines > 2) {\r\n\t\t\t ObjectBank<List<IN>> documents = makeObjectBankFromString(text, readerWriter);\r\n\t \t classifyAndWriteAnswers(documents, readerWriter);\r\n \t\t text = \"\";\r\n \t } else {\r\n \t\t text += sentence + eol;\r\n \t }\r\n } else {\r\n \t text += line + eol;\r\n \t blankLines = 0;\r\n }\r\n }\r\n // Classify last document before input stream end\r\n if (text.trim() != \"\") {\r\n ObjectBank<List<IN>> documents = makeObjectBankFromString(text, readerWriter);\r\n \t classifyAndWriteAnswers(documents, readerWriter);\r\n }\r\n return (line == null); // reached eol\r\n }",
"public static String getAt(String text, int index) {\n index = normaliseIndex(index, text.length());\n return text.substring(index, index + 1);\n }",
"public Optional<URL> getServiceUrl(String name) {\n Service service = client.services().inNamespace(namespace).withName(name).get();\n return service != null ? createUrlForService(service) : Optional.empty();\n }",
"protected static final float[] getSpreadInRange(float member, int count, int max, int offset) {\n // to find the spread, we first find the min that is a\n // multiple of max/count away from the member\n\n int interval = max / count;\n float min = (member + offset) % interval;\n\n if (min == 0 && member == max) {\n min += interval;\n }\n\n float[] range = new float[count];\n for (int i = 0; i < count; i++) {\n range[i] = min + interval * i + offset;\n }\n\n return range;\n }",
"void countNonZeroUsingLinkedList( int parent[] , int ll[] ) {\n\n Arrays.fill(pinv,0,m,-1);\n nz_in_V = 0;\n m2 = m;\n\n for (int k = 0; k < n; k++) {\n int i = ll[head+k]; // remove row i from queue k\n nz_in_V++; // count V(k,k) as nonzero\n if( i < 0) // add a fictitious row since there are no nz elements\n i = m2++;\n pinv[i] = k; // associate row i with V(:,k)\n if( --ll[nque+k] <= 0 )\n continue;\n nz_in_V += ll[nque+k];\n int pa;\n if( (pa = parent[k]) != -1 ) { // move all rows to parent of k\n if( ll[nque+pa] == 0)\n ll[tail+pa] = ll[tail+k];\n ll[next+ll[tail+k]] = ll[head+pa];\n ll[head+pa] = ll[next+i];\n ll[nque+pa] += ll[nque+k];\n }\n }\n for (int i = 0, k = n; i < m; i++) {\n if( pinv[i] < 0 )\n pinv[i] = k++;\n }\n\n if( nz_in_V < 0)\n throw new RuntimeException(\"Too many elements. Numerical overflow in V counts\");\n }",
"public com.squareup.okhttp.Call getCharactersCharacterIdShipCall(Integer characterId, String datasource,\n String ifNoneMatch, String token, final ApiCallback callback) throws ApiException {\n Object localVarPostBody = new Object();\n\n // create path and map variables\n String localVarPath = \"/v1/characters/{character_id}/ship/\".replaceAll(\"\\\\{\" + \"character_id\" + \"\\\\}\",\n apiClient.escapeString(characterId.toString()));\n\n List<Pair> localVarQueryParams = new ArrayList<Pair>();\n List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();\n if (datasource != null) {\n localVarQueryParams.addAll(apiClient.parameterToPair(\"datasource\", datasource));\n }\n\n if (token != null) {\n localVarQueryParams.addAll(apiClient.parameterToPair(\"token\", token));\n }\n\n Map<String, String> localVarHeaderParams = new HashMap<String, String>();\n if (ifNoneMatch != null) {\n localVarHeaderParams.put(\"If-None-Match\", apiClient.parameterToString(ifNoneMatch));\n }\n\n Map<String, Object> localVarFormParams = new HashMap<String, Object>();\n final String[] localVarAccepts = { \"application/json\" };\n final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);\n if (localVarAccept != null) {\n localVarHeaderParams.put(\"Accept\", localVarAccept);\n }\n\n final String[] localVarContentTypes = {\n\n };\n final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);\n localVarHeaderParams.put(\"Content-Type\", localVarContentType);\n\n String[] localVarAuthNames = new String[] { \"evesso\" };\n return apiClient.buildCall(localVarPath, \"GET\", localVarQueryParams, localVarCollectionQueryParams,\n localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, callback);\n }",
"private void decreaseIndent() throws IOException\n {\n if (m_pretty)\n {\n m_writer.write('\\n');\n m_indent = m_indent.substring(0, m_indent.length() - INDENT.length());\n m_writer.write(m_indent);\n }\n m_firstNameValuePair.pop();\n }",
"public Rule CriteriaOnlyFindQuery() {\n\t\treturn Sequence( !peek().isCliQuery(), JsonParameter( JsonObject() ) , peek().setOperation( Operation.FIND ), peek().setCriteria( match() ) );\n\t}"
] |
Sets axis dimension
@param val dimension
@param axis Axis. It might be either {@link Layout.Axis#X X} or
{@link Layout.Axis#Y Y} or {@link Layout.Axis#Z Z} | [
"public void set(float val, Layout.Axis axis) {\n switch (axis) {\n case X:\n x = val;\n break;\n case Y:\n y = val;\n break;\n case Z:\n z = val;\n break;\n default:\n throw new RuntimeAssertion(\"Bad axis specified: %s\", axis);\n }\n }"
] | [
"private Map<String, String> toPayload(Map<String, Object> data) throws LocalOperationException {\n Map<String, Object> dataClone = new HashMap<String, Object>(data);\n dataClone.put(\"auth\", getAuthData());\n\n Map<String, String> payload = new HashMap<String, String>();\n payload.put(\"params\", jsonifyData(dataClone));\n\n if (transloadit.shouldSignRequest) {\n payload.put(\"signature\", getSignature(jsonifyData(dataClone)));\n }\n return payload;\n }",
"public static String toXml(DeploymentDescriptor descriptor) {\n try {\n\n Marshaller marshaller = getContext().createMarshaller();\n marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);\n marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, \"http://www.jboss.org/jbpm deployment-descriptor.xsd\");\n marshaller.setSchema(schema);\n StringWriter stringWriter = new StringWriter();\n\n // clone the object and cleanup transients\n DeploymentDescriptor clone = ((DeploymentDescriptorImpl) descriptor).clearClone();\n\n marshaller.marshal(clone, stringWriter);\n String output = stringWriter.toString();\n\n return output;\n } catch (Exception e) {\n throw new RuntimeException(\"Unable to generate xml from deployment descriptor\", e);\n }\n }",
"public static authenticationvserver_authenticationradiuspolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tauthenticationvserver_authenticationradiuspolicy_binding obj = new authenticationvserver_authenticationradiuspolicy_binding();\n\t\tobj.set_name(name);\n\t\tauthenticationvserver_authenticationradiuspolicy_binding response[] = (authenticationvserver_authenticationradiuspolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"@Override\n public void detachScriptFile(IScriptable target) {\n IScriptFile scriptFile = mScriptMap.remove(target);\n if (scriptFile != null) {\n scriptFile.invokeFunction(\"onDetach\", new Object[] { target });\n }\n }",
"@Override\n\tpublic void addExtraState(EntityEntryExtraState extraState) {\n\t\tif ( next == null ) {\n\t\t\tnext = extraState;\n\t\t}\n\t\telse {\n\t\t\tnext.addExtraState( extraState );\n\t\t}\n\t}",
"private static void listTimephasedWork(ResourceAssignment assignment)\n {\n Task task = assignment.getTask();\n int days = (int) ((task.getFinish().getTime() - task.getStart().getTime()) / (1000 * 60 * 60 * 24)) + 1;\n if (days > 1)\n {\n SimpleDateFormat df = new SimpleDateFormat(\"dd/MM/yy\");\n\n TimescaleUtility timescale = new TimescaleUtility();\n ArrayList<DateRange> dates = timescale.createTimescale(task.getStart(), TimescaleUnits.DAYS, days);\n TimephasedUtility timephased = new TimephasedUtility();\n\n ArrayList<Duration> durations = timephased.segmentWork(assignment.getCalendar(), assignment.getTimephasedWork(), TimescaleUnits.DAYS, dates);\n for (DateRange range : dates)\n {\n System.out.print(df.format(range.getStart()) + \"\\t\");\n }\n System.out.println();\n for (Duration duration : durations)\n {\n System.out.print(duration.toString() + \" \".substring(0, 7) + \"\\t\");\n }\n System.out.println();\n }\n }",
"public Bytes subSequence(int start, int end) {\n if (start > end || start < 0 || end > length) {\n throw new IndexOutOfBoundsException(\"Bad start and/end start = \" + start + \" end=\" + end\n + \" offset=\" + offset + \" length=\" + length);\n }\n return new Bytes(data, offset + start, end - start);\n }",
"public void processClass(String template, Properties attributes) throws XDocletException\r\n {\r\n if (!_model.hasClass(getCurrentClass().getQualifiedName()))\r\n {\r\n // we only want to output the log message once\r\n LogHelper.debug(true, OjbTagsHandler.class, \"processClass\", \"Type \"+getCurrentClass().getQualifiedName());\r\n }\r\n\r\n ClassDescriptorDef classDef = ensureClassDef(getCurrentClass());\r\n String attrName;\r\n\r\n for (Enumeration attrNames = attributes.propertyNames(); attrNames.hasMoreElements(); )\r\n {\r\n attrName = (String)attrNames.nextElement();\r\n classDef.setProperty(attrName, attributes.getProperty(attrName));\r\n }\r\n _curClassDef = classDef;\r\n generate(template);\r\n _curClassDef = null;\r\n }",
"public void validateOperations(final List<ModelNode> operations) {\n if (operations == null) {\n return;\n }\n\n for (ModelNode operation : operations) {\n try {\n validateOperation(operation);\n } catch (RuntimeException e) {\n if (exitOnError) {\n throw e;\n } else {\n System.out.println(\"---- Operation validation error:\");\n System.out.println(e.getMessage());\n }\n\n }\n }\n }"
] |
Throws an IllegalStateException when the given value is not true. | [
"public static Boolean assertTrue(Boolean value, String message) {\n if (!Boolean.valueOf(value))\n throw new IllegalStateException(message);\n\n return value;\n }"
] | [
"public final OutputFormat getOutputFormat(final PJsonObject specJson) {\n final String format = specJson.getString(MapPrinterServlet.JSON_OUTPUT_FORMAT);\n final boolean mapExport =\n this.configuration.getTemplate(specJson.getString(Constants.JSON_LAYOUT_KEY)).isMapExport();\n final String beanName =\n format + (mapExport ? MAP_OUTPUT_FORMAT_BEAN_NAME_ENDING : OUTPUT_FORMAT_BEAN_NAME_ENDING);\n\n if (!this.outputFormat.containsKey(beanName)) {\n throw new RuntimeException(\"Format '\" + format + \"' with mapExport '\" + mapExport\n + \"' is not supported.\");\n }\n\n return this.outputFormat.get(beanName);\n }",
"public static base_response update(nitro_service client, spilloverpolicy resource) throws Exception {\n\t\tspilloverpolicy updateresource = new spilloverpolicy();\n\t\tupdateresource.name = resource.name;\n\t\tupdateresource.rule = resource.rule;\n\t\tupdateresource.action = resource.action;\n\t\tupdateresource.comment = resource.comment;\n\t\treturn updateresource.update_resource(client);\n\t}",
"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}",
"private static CharSequence convertReverseDNSIPv4(String str, int suffixStartIndex) throws AddressStringException {\n\t\tStringBuilder builder = new StringBuilder(suffixStartIndex);\n\t\tint segCount = 0;\n\t\tint j = suffixStartIndex;\n\t\tfor(int i = suffixStartIndex - 1; i > 0; i--) {\n\t\t\tchar c1 = str.charAt(i);\n\t\t\tif(c1 == IPv4Address.SEGMENT_SEPARATOR) {\n\t\t\t\tif(j - i <= 1) {\n\t\t\t\t\tthrow new AddressStringException(str, i);\n\t\t\t\t}\n\t\t\t\tfor(int k = i + 1; k < j; k++) {\n\t\t\t\t\tbuilder.append(str.charAt(k));\n\t\t\t\t}\n\t\t\t\tbuilder.append(c1);\n\t\t\t\tj = i;\n\t\t\t\tsegCount++;\n\t\t\t}\n\t\t}\n\t\tfor(int k = 0; k < j; k++) {\n\t\t\tbuilder.append(str.charAt(k));\n\t\t}\n\t\tif(segCount + 1 != IPv4Address.SEGMENT_COUNT) {\n\t\t\tthrow new AddressStringException(str, 0);\n\t\t}\n\t\treturn builder;\n\t}",
"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 }",
"public List<Index<Field>> allIndexes() {\n List<Index<Field>> indexesOfAnyType = new ArrayList<Index<Field>>();\n indexesOfAnyType.addAll(listIndexType(null, ListableIndex.class));\n return indexesOfAnyType;\n }",
"public static Chart getMSDLineChart(Trajectory t, int lagMin, int lagMax,\n\t\t\tAbstractMeanSquaredDisplacmentEvaluator msdeval) {\n\n\t\tdouble[] xData = new double[lagMax - lagMin + 1];\n\t\tdouble[] yData = new double[lagMax - lagMin + 1];\n\t\tmsdeval.setTrajectory(t);\n\t\tmsdeval.setTimelag(lagMin);\n\t\tfor (int i = lagMin; i < lagMax + 1; i++) {\n\t\t\tmsdeval.setTimelag(i);\n\t\t\tdouble msdhelp = msdeval.evaluate()[0];\n\t\t\txData[i - lagMin] = i;\n\t\t\tyData[i - lagMin] = msdhelp;\n\t\t}\n\n\t\t// Create Chart\n\t\tChart chart = QuickChart.getChart(\"MSD Line\", \"LAG\", \"MSD\", \"MSD\",\n\t\t\t\txData, yData);\n\n\t\t// Show it\n\t\t//new SwingWrapper(chart).displayChart();\n\t\treturn chart;\n\t}",
"public boolean setUpCameraForVrMode(final int fpsMode) {\n\n cameraSetUpStatus = false;\n this.fpsMode = fpsMode;\n\n if (!isCameraOpen) {\n Log.e(TAG, \"Camera is not open\");\n return false;\n }\n if (fpsMode < 0 || fpsMode > 2) {\n Log.e(TAG,\n \"Invalid fpsMode: %d. It can only take values 0, 1, or 2.\", fpsMode);\n } else {\n Parameters params = camera.getParameters();\n\n // check if the device supports vr mode preview\n if (\"true\".equalsIgnoreCase(params.get(\"vrmode-supported\"))) {\n\n Log.v(TAG, \"VR Mode supported!\");\n\n // set vr mode\n params.set(\"vrmode\", 1);\n\n // true if the apps intend to record videos using\n // MediaRecorder\n params.setRecordingHint(true);\n\n // set preview size\n // params.setPreviewSize(640, 480);\n\n // set fast-fps-mode: 0 for 30fps, 1 for 60 fps,\n // 2 for 120 fps\n params.set(\"fast-fps-mode\", fpsMode);\n\n switch (fpsMode) {\n case 0: // 30 fps\n params.setPreviewFpsRange(30000, 30000);\n break;\n case 1: // 60 fps\n params.setPreviewFpsRange(60000, 60000);\n break;\n case 2: // 120 fps\n params.setPreviewFpsRange(120000, 120000);\n break;\n default:\n }\n\n // for auto focus\n params.set(\"focus-mode\", \"continuous-video\");\n\n params.setVideoStabilization(false);\n if (\"true\".equalsIgnoreCase(params.get(\"ois-supported\"))) {\n params.set(\"ois\", \"center\");\n }\n\n camera.setParameters(params);\n cameraSetUpStatus = true;\n }\n }\n\n return cameraSetUpStatus;\n }",
"public static sslaction[] get(nitro_service service) throws Exception{\n\t\tsslaction obj = new sslaction();\n\t\tsslaction[] response = (sslaction[])obj.get_resources(service);\n\t\treturn response;\n\t}"
] |
Adds a function to the end of the token list
@param function Function which is to be added
@return The new Token created around function | [
"public Token add( Function function ) {\n Token t = new Token(function);\n push( t );\n return t;\n }"
] | [
"public byte[] serialize() throws PersistenceBrokerException\r\n {\r\n // Identity is serialized and written to an ObjectOutputStream\r\n // This ObjectOutputstream is compressed by a GZIPOutputStream\r\n // and finally written to a ByteArrayOutputStream.\r\n // the resulting byte[] is returned\r\n try\r\n {\r\n final ByteArrayOutputStream bao = new ByteArrayOutputStream();\r\n final GZIPOutputStream gos = new GZIPOutputStream(bao);\r\n final ObjectOutputStream oos = new ObjectOutputStream(gos);\r\n oos.writeObject(this);\r\n oos.close();\r\n gos.close();\r\n bao.close();\r\n return bao.toByteArray();\r\n }\r\n catch (Exception ignored)\r\n {\r\n throw new PersistenceBrokerException(ignored);\r\n }\r\n }",
"public static int scanright(Color color, int height, int width, int col, PixelsExtractor f, int tolerance) {\n if (col == width || !PixelTools.colorMatches(color, tolerance, f.apply(new Area(col, 0, 1, height))))\n return col;\n else\n return scanright(color, height, width, col + 1, f, tolerance);\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 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}",
"void releaseTransaction(@NotNull final Thread thread, final int permits) {\n try (CriticalSection ignored = criticalSection.enter()) {\n int currentThreadPermits = getThreadPermits(thread);\n if (permits > currentThreadPermits) {\n throw new ExodusException(\"Can't release more permits than it was acquired\");\n }\n acquiredPermits -= permits;\n currentThreadPermits -= permits;\n if (currentThreadPermits == 0) {\n threadPermits.remove(thread);\n } else {\n threadPermits.put(thread, currentThreadPermits);\n }\n notifyNextWaiters();\n }\n }",
"public String getRepoKey() {\n String repoKey;\n if (isDynamicMode()) {\n repoKey = keyFromText;\n } else {\n repoKey = keyFromSelect;\n }\n return repoKey;\n }",
"public void addUIEventHandler(JavascriptObject obj, UIEventType type, UIEventHandler h) {\n String key = registerEventHandler(h);\n String mcall = \"google.maps.event.addListener(\" + obj.getVariableName() + \", '\" + type.name() + \"', \"\n + \"function(event) {document.jsHandlers.handleUIEvent('\" + key + \"', event);});\";//.latLng\n //System.out.println(\"addUIEventHandler mcall: \" + mcall);\n runtime.execute(mcall);\n }",
"public static base_response delete(nitro_service client, dnstxtrec resource) throws Exception {\n\t\tdnstxtrec deleteresource = new dnstxtrec();\n\t\tdeleteresource.domain = resource.domain;\n\t\tdeleteresource.String = resource.String;\n\t\tdeleteresource.recordid = resource.recordid;\n\t\treturn deleteresource.delete_resource(client);\n\t}",
"public void createPdfLayout(Dimension dim)\n {\n if (pdfdocument != null) //processing a PDF document\n {\n try {\n if (createImage)\n img = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_RGB);\n Graphics2D ig = img.createGraphics();\n \n log.info(\"Creating PDF boxes\");\n VisualContext ctx = new VisualContext(null, null);\n \n boxtree = new CSSBoxTree(ig, ctx, dim, baseurl);\n boxtree.setConfig(config);\n boxtree.processDocument(pdfdocument, startPage, endPage);\n viewport = boxtree.getViewport();\n root = boxtree.getDocument().getDocumentElement();\n log.info(\"We have \" + boxtree.getLastId() + \" boxes\");\n viewport.initSubtree();\n \n log.info(\"Layout for \"+dim.width+\"px\");\n viewport.doLayout(dim.width, true, true);\n log.info(\"Resulting size: \" + viewport.getWidth() + \"x\" + viewport.getHeight() + \" (\" + viewport + \")\");\n \n log.info(\"Updating viewport size\");\n viewport.updateBounds(dim);\n log.info(\"Resulting size: \" + viewport.getWidth() + \"x\" + viewport.getHeight() + \" (\" + viewport + \")\");\n \n if (createImage && (viewport.getWidth() > dim.width || viewport.getHeight() > dim.height))\n {\n img = new BufferedImage(Math.max(viewport.getWidth(), dim.width),\n Math.max(viewport.getHeight(), dim.height),\n BufferedImage.TYPE_INT_RGB);\n ig = img.createGraphics();\n }\n \n log.info(\"Positioning for \"+img.getWidth()+\"x\"+img.getHeight()+\"px\");\n viewport.absolutePositions();\n \n clearCanvas();\n viewport.draw(new GraphicsRenderer(ig));\n setPreferredSize(new Dimension(img.getWidth(), img.getHeight()));\n revalidate();\n } catch (ParserConfigurationException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n else if (root != null) //processing a DOM tree\n {\n super.createLayout(dim);\n }\n }"
] |
Check if the right-hand side type may be assigned to the left-hand side
type following the Java generics rules.
@param lhsType the target type
@param rhsType the value type that should be assigned to the target type
@return true if rhs is assignable to lhs | [
"public static boolean isAssignable(Type lhsType, Type rhsType) {\n\t\tAssert.notNull(lhsType, \"Left-hand side type must not be null\");\n\t\tAssert.notNull(rhsType, \"Right-hand side type must not be null\");\n\n\t\t// all types are assignable to themselves and to class Object\n\t\tif (lhsType.equals(rhsType) || lhsType.equals(Object.class)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (lhsType instanceof Class<?>) {\n\t\t\tClass<?> lhsClass = (Class<?>) lhsType;\n\n\t\t\t// just comparing two classes\n\t\t\tif (rhsType instanceof Class<?>) {\n\t\t\t\treturn ClassUtils.isAssignable(lhsClass, (Class<?>) rhsType);\n\t\t\t}\n\n\t\t\tif (rhsType instanceof ParameterizedType) {\n\t\t\t\tType rhsRaw = ((ParameterizedType) rhsType).getRawType();\n\n\t\t\t\t// a parameterized type is always assignable to its raw class type\n\t\t\t\tif (rhsRaw instanceof Class<?>) {\n\t\t\t\t\treturn ClassUtils.isAssignable(lhsClass, (Class<?>) rhsRaw);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (lhsClass.isArray() && rhsType instanceof GenericArrayType) {\n\t\t\t\tType rhsComponent = ((GenericArrayType) rhsType).getGenericComponentType();\n\n\t\t\t\treturn isAssignable(lhsClass.getComponentType(), rhsComponent);\n\t\t\t}\n\t\t}\n\n\t\t// parameterized types are only assignable to other parameterized types and class types\n\t\tif (lhsType instanceof ParameterizedType) {\n\t\t\tif (rhsType instanceof Class<?>) {\n\t\t\t\tType lhsRaw = ((ParameterizedType) lhsType).getRawType();\n\n\t\t\t\tif (lhsRaw instanceof Class<?>) {\n\t\t\t\t\treturn ClassUtils.isAssignable((Class<?>) lhsRaw, (Class<?>) rhsType);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (rhsType instanceof ParameterizedType) {\n\t\t\t\treturn isAssignable((ParameterizedType) lhsType, (ParameterizedType) rhsType);\n\t\t\t}\n\t\t}\n\n\t\tif (lhsType instanceof GenericArrayType) {\n\t\t\tType lhsComponent = ((GenericArrayType) lhsType).getGenericComponentType();\n\n\t\t\tif (rhsType instanceof Class<?>) {\n\t\t\t\tClass<?> rhsClass = (Class<?>) rhsType;\n\n\t\t\t\tif (rhsClass.isArray()) {\n\t\t\t\t\treturn isAssignable(lhsComponent, rhsClass.getComponentType());\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (rhsType instanceof GenericArrayType) {\n\t\t\t\tType rhsComponent = ((GenericArrayType) rhsType).getGenericComponentType();\n\n\t\t\t\treturn isAssignable(lhsComponent, rhsComponent);\n\t\t\t}\n\t\t}\n\n\t\tif (lhsType instanceof WildcardType) {\n\t\t\treturn isAssignable((WildcardType) lhsType, rhsType);\n\t\t}\n\n\t\treturn false;\n\t}"
] | [
"public void checkSpecialization() {\n if (isSpecializing()) {\n boolean isNameDefined = getAnnotated().isAnnotationPresent(Named.class);\n String previousSpecializedBeanName = null;\n for (AbstractBean<?, ?> specializedBean : getSpecializedBeans()) {\n String name = specializedBean.getName();\n if (previousSpecializedBeanName != null && name != null && !previousSpecializedBeanName.equals(specializedBean.getName())) {\n // there may be multiple beans specialized by this bean - make sure they all share the same name\n throw BeanLogger.LOG.beansWithDifferentBeanNamesCannotBeSpecialized(previousSpecializedBeanName, specializedBean.getName(), this);\n }\n previousSpecializedBeanName = name;\n if (isNameDefined && name != null) {\n throw BeanLogger.LOG.nameNotAllowedOnSpecialization(getAnnotated(), specializedBean.getAnnotated());\n }\n\n // When a specializing bean extends the raw type of a generic superclass, types of the generic superclass are\n // added into types of the specializing bean because of assignability rules. However, ParameterizedTypes among\n // these types are NOT types of the specializing bean (that's the way java works)\n boolean rawInsteadOfGeneric = (this instanceof AbstractClassBean<?>\n && specializedBean.getBeanClass().getTypeParameters().length > 0\n && !(((AbstractClassBean<?>) this).getBeanClass().getGenericSuperclass() instanceof ParameterizedType));\n for (Type specializedType : specializedBean.getTypes()) {\n if (rawInsteadOfGeneric && specializedType instanceof ParameterizedType) {\n throw BeanLogger.LOG.specializingBeanMissingSpecializedType(this, specializedType, specializedBean);\n }\n boolean contains = getTypes().contains(specializedType);\n if (!contains) {\n for (Type specializingType : getTypes()) {\n // In case 'type' is a ParameterizedType, two bean types equivalent in the CDI sense may not be\n // equal in the java sense. Therefore we have to use our own equality util.\n if (TypeEqualitySpecializationUtils.areTheSame(specializingType, specializedType)) {\n contains = true;\n break;\n }\n }\n }\n if (!contains) {\n throw BeanLogger.LOG.specializingBeanMissingSpecializedType(this, specializedType, specializedBean);\n }\n }\n }\n }\n }",
"public <Result, Param extends Resource> Result execWithoutCacheClear(Param resource, IUnitOfWork<Result, Param> transaction) throws WrappedException {\n\t\tCacheAdapter cacheAdapter = getOrCreate(resource);\n\t\ttry {\n\t\t\tcacheAdapter.ignoreNotifications();\n\t\t\treturn transaction.exec(resource);\n\t\t} catch (RuntimeException e) {\n\t\t\tthrow e;\n\t\t} catch (Exception e) {\n\t\t\tthrow new WrappedException(e);\n\t\t} finally {\n\t\t\tcacheAdapter.listenToNotifications();\n\t\t}\n\t}",
"public static boolean promoteAndCheckResponse(Promotion promotion, ArtifactoryBuildInfoClient client, TaskListener listener,\n String buildName, String buildNumber) throws IOException {\n // If failFast is true, perform dry run first\n if (promotion.isFailFast()) {\n promotion.setDryRun(true);\n listener.getLogger().println(\"Performing dry run promotion (no changes are made during dry run) ...\");\n HttpResponse dryResponse = client.stageBuild(buildName, buildNumber, promotion);\n try {\n validatePromotionSuccessful(dryResponse, true, promotion.isFailFast(), listener);\n } catch (IOException e) {\n listener.error(e.getMessage());\n return false;\n }\n listener.getLogger().println(\"Dry run finished successfully.\\nPerforming promotion ...\");\n }\n\n // Perform promotion\n promotion.setDryRun(false);\n HttpResponse response = client.stageBuild(buildName, buildNumber, promotion);\n try {\n validatePromotionSuccessful(response, false, promotion.isFailFast(), listener);\n } catch (IOException e) {\n listener.error(e.getMessage());\n return false;\n }\n listener.getLogger().println(\"Promotion completed successfully!\");\n\n return true;\n }",
"private void processDependencies() throws SQLException\n {\n List<Row> rows = getRows(\"select * from zdependency where zproject=?\", m_projectID);\n for (Row row : rows)\n {\n Task nextTask = m_project.getTaskByUniqueID(row.getInteger(\"ZNEXTACTIVITY_\"));\n Task prevTask = m_project.getTaskByUniqueID(row.getInteger(\"ZPREVIOUSACTIVITY_\"));\n Duration lag = row.getDuration(\"ZLAG_\");\n RelationType type = row.getRelationType(\"ZTYPE\");\n Relation relation = nextTask.addPredecessor(prevTask, type, lag);\n relation.setUniqueID(row.getInteger(\"Z_PK\"));\n }\n }",
"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 ParallelTaskBuilder prepareHttpPut(String url) {\n reinitIfClosed();\n ParallelTaskBuilder cb = new ParallelTaskBuilder();\n cb.getHttpMeta().setHttpMethod(HttpMethod.PUT);\n cb.getHttpMeta().setRequestUrlPostfix(url);\n return cb;\n\n }",
"@Override\n public void map(GenericData.Record record,\n AvroCollector<Pair<ByteBuffer, ByteBuffer>> collector,\n Reporter reporter) throws IOException {\n\n byte[] keyBytes = null;\n byte[] valBytes = null;\n Object keyRecord = null;\n Object valRecord = null;\n try {\n keyRecord = record.get(keyField);\n valRecord = record.get(valField);\n keyBytes = keySerializer.toBytes(keyRecord);\n valBytes = valueSerializer.toBytes(valRecord);\n\n this.collectorWrapper.setCollector(collector);\n this.mapper.map(keyBytes, valBytes, this.collectorWrapper);\n\n recordCounter++;\n } catch (OutOfMemoryError oom) {\n logger.error(oomErrorMessage(reporter));\n if (keyBytes == null) {\n logger.error(\"keyRecord caused OOM!\");\n } else {\n logger.error(\"keyRecord: \" + keyRecord);\n logger.error(\"valRecord: \" + (valBytes == null ? \"caused OOM\" : valRecord));\n }\n throw new VoldemortException(oomErrorMessage(reporter), oom);\n }\n }",
"public static Node removePartitionFromNode(final Node node, Integer donatedPartition) {\n return UpdateClusterUtils.removePartitionsFromNode(node, Sets.newHashSet(donatedPartition));\n }",
"public long countByLex(final LexRange lexRange) {\n return doWithJedis(new JedisCallable<Long>() {\n @Override\n public Long call(Jedis jedis) {\n return jedis.zlexcount(getKey(), lexRange.from(), lexRange.to());\n }\n });\n }"
] |
Removes an audio source from the audio manager.
@param audioSource audio source to remove | [
"public void removeSource(GVRAudioSource audioSource)\n {\n synchronized (mAudioSources)\n {\n audioSource.setListener(null);\n mAudioSources.remove(audioSource);\n }\n }"
] | [
"@Override\n public void sendResponse(StoreStats performanceStats,\n boolean isFromLocalZone,\n long startTimeInMs) throws Exception {\n\n ChannelBuffer responseContent = ChannelBuffers.dynamicBuffer(this.responseValue.length);\n responseContent.writeBytes(responseValue);\n\n // 1. Create the Response object\n HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);\n\n // 2. Set the right headers\n response.setHeader(CONTENT_TYPE, \"binary\");\n response.setHeader(CONTENT_TRANSFER_ENCODING, \"binary\");\n\n // 3. Copy the data into the payload\n response.setContent(responseContent);\n response.setHeader(CONTENT_LENGTH, response.getContent().readableBytes());\n\n if(logger.isDebugEnabled()) {\n logger.debug(\"Response = \" + response);\n }\n\n // Write the response to the Netty Channel\n this.messageEvent.getChannel().write(response);\n\n if(performanceStats != null && isFromLocalZone) {\n recordStats(performanceStats, startTimeInMs, Tracked.GET);\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 <T> Observable<T> map(Observable<?> fromObservable, final T toValue) {\n if (fromObservable != null) {\n return fromObservable.subscribeOn(Schedulers.io())\n .map(new RXMapper<T>(toValue));\n } else {\n return Observable.empty();\n }\n }",
"public final File getBuildFileFor(\n final Configuration configuration, final File jasperFileXml,\n final String extension, final Logger logger) {\n final String configurationAbsolutePath = configuration.getDirectory().getPath();\n final int prefixToConfiguration = configurationAbsolutePath.length() + 1;\n final String parentDir = jasperFileXml.getAbsoluteFile().getParent();\n final String relativePathToFile;\n if (configurationAbsolutePath.equals(parentDir)) {\n relativePathToFile = FilenameUtils.getBaseName(jasperFileXml.getName());\n } else {\n final String relativePathToContainingDirectory = parentDir.substring(prefixToConfiguration);\n relativePathToFile = relativePathToContainingDirectory + File.separator +\n FilenameUtils.getBaseName(jasperFileXml.getName());\n }\n\n final File buildFile = new File(getJasperCompilation(configuration), relativePathToFile + extension);\n\n if (!buildFile.getParentFile().exists() && !buildFile.getParentFile().mkdirs()) {\n logger.error(\"Unable to create directory for containing compiled jasper report templates: {}\",\n buildFile.getParentFile());\n }\n return buildFile;\n }",
"private static int nextIndex( String description, int defaultIndex ) {\n\n Pattern startsWithNumber = Pattern.compile( \"(\\\\d+).*\" );\n Matcher matcher = startsWithNumber.matcher( description );\n if( matcher.matches() ) {\n return Integer.parseInt( matcher.group( 1 ) ) - 1;\n }\n\n return defaultIndex;\n }",
"public void setFileFormat(String fileFormat) {\n\n if (fileFormat.toUpperCase().equals(FileFormat.JSON.toString())) {\n m_fileFormat = FileFormat.JSON;\n }\n }",
"public static BoxAPIConnection getTransactionConnection(String accessToken, String scope) {\n return BoxTransactionalAPIConnection.getTransactionConnection(accessToken, scope, null);\n }",
"public static int queryForInt(Statement stmt, String sql, int nullvalue) {\n try {\n ResultSet rs = stmt.executeQuery(sql);\n try {\n if (!rs.next())\n return nullvalue;\n \n return rs.getInt(1);\n } finally {\n rs.close();\n }\n } catch (SQLException e) {\n throw new DukeException(e);\n }\n }",
"public static String cutEnd(String data, int maxLength) {\n if (data.length() > maxLength) {\n return data.substring(0, maxLength) + \"...\";\n } else {\n return data;\n }\n }"
] |
Use this API to fetch statistics of streamidentifier_stats resource of given name . | [
"public static streamidentifier_stats get(nitro_service service, String name) throws Exception{\n\t\tstreamidentifier_stats obj = new streamidentifier_stats();\n\t\tobj.set_name(name);\n\t\tstreamidentifier_stats response = (streamidentifier_stats) obj.stat_resource(service);\n\t\treturn response;\n\t}"
] | [
"public UniqueEntityLoader buildLoader(\n\t\t\tOuterJoinLoadable persister,\n\t\t\tint batchSize,\n\t\t\tLockMode lockMode,\n\t\t\tSessionFactoryImplementor factory,\n\t\t\tLoadQueryInfluencers influencers,\n\t\t\tBatchableEntityLoaderBuilder innerEntityLoaderBuilder) {\n\t\tif ( batchSize <= 1 ) {\n\t\t\t// no batching\n\t\t\treturn buildNonBatchingLoader( persister, lockMode, factory, influencers, innerEntityLoaderBuilder );\n\t\t}\n\t\treturn buildBatchingLoader( persister, batchSize, lockMode, factory, influencers, innerEntityLoaderBuilder );\n\t}",
"private Map<String, String> getLocaleProperties() {\n\n if (m_localeProperties == null) {\n m_localeProperties = CmsCollectionsGenericWrapper.createLazyMap(\n new CmsProperty.CmsPropertyLocaleTransformer(m_properties, m_locale));\n }\n return m_localeProperties;\n }",
"public static base_responses disable(nitro_service client, String trapname[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (trapname != null && trapname.length > 0) {\n\t\t\tsnmpalarm disableresources[] = new snmpalarm[trapname.length];\n\t\t\tfor (int i=0;i<trapname.length;i++){\n\t\t\t\tdisableresources[i] = new snmpalarm();\n\t\t\t\tdisableresources[i].trapname = trapname[i];\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, disableresources,\"disable\");\n\t\t}\n\t\treturn result;\n\t}",
"public static ScheduledExecutorService newScheduledDaemonThreadPool(int corePoolSize) {\n return Executors.newScheduledThreadPool(corePoolSize, r -> {\n Thread t = Executors.defaultThreadFactory().newThread(r);\n t.setDaemon(true);\n return t;\n });\n }",
"public static GlobalParameter create(DbConn cnx, String key, String value)\n {\n QueryResult r = cnx.runUpdate(\"globalprm_insert\", key, value);\n GlobalParameter res = new GlobalParameter();\n res.id = r.getGeneratedId();\n res.key = key;\n res.value = value;\n return res;\n }",
"@SuppressWarnings(\"unchecked\")\n private static synchronized Map<String, Boolean> getCache(GraphRewrite event)\n {\n Map<String, Boolean> result = (Map<String, Boolean>)event.getRewriteContext().get(ClassificationServiceCache.class);\n if (result == null)\n {\n result = Collections.synchronizedMap(new LRUMap(30000));\n event.getRewriteContext().put(ClassificationServiceCache.class, result);\n }\n return result;\n }",
"@Override\n public void deploy(InputStream inputStream) throws IOException {\n final List<? extends HasMetadata> entities = deploy(\"application\", inputStream);\n\n if (this.applicationName == null) {\n\n Optional<String> deploymentConfig = entities.stream()\n .filter(hm -> hm instanceof DeploymentConfig)\n .map(hm -> (DeploymentConfig) hm)\n .map(dc -> dc.getMetadata().getName()).findFirst();\n\n deploymentConfig.ifPresent(name -> this.applicationName = name);\n }\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 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 }"
] |
Get the primitive attributes for the associated object.
@return attributes for associated objects
@deprecated replaced by {@link #getAllAttributes()} after introduction of nested associations | [
"@Deprecated\n\t@SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n\tpublic Map<String, PrimitiveAttribute<?>> getAttributes() {\n\t\tif (!isPrimitiveOnly()) {\n\t\t\tthrow new UnsupportedOperationException(\"Primitive API not supported for nested association values\");\n\t\t}\n\t\treturn (Map) attributes;\n\t}"
] | [
"protected final void error(final HttpServletResponse httpServletResponse, final Throwable e) {\n httpServletResponse.setContentType(\"text/plain\");\n httpServletResponse.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());\n try (PrintWriter out = httpServletResponse.getWriter()) {\n out.println(\"Error while processing request:\");\n LOGGER.error(\"Error while processing request\", e);\n } catch (IOException ex) {\n throw ExceptionUtils.getRuntimeException(ex);\n }\n }",
"public static boolean isOperationDefined(final ModelNode operation) {\n for (final AttributeDefinition def : ROOT_ATTRIBUTES) {\n if (operation.hasDefined(def.getName())) {\n return true;\n }\n }\n return false;\n }",
"public List<RoutableDestination<T>> getDestinations(String path) {\n\n String cleanPath = (path.endsWith(\"/\") && path.length() > 1)\n ? path.substring(0, path.length() - 1) : path;\n\n List<RoutableDestination<T>> result = new ArrayList<>();\n\n for (ImmutablePair<Pattern, RouteDestinationWithGroups> patternRoute : patternRouteList) {\n Map<String, String> groupNameValuesBuilder = new HashMap<>();\n Matcher matcher = patternRoute.getFirst().matcher(cleanPath);\n if (matcher.matches()) {\n int matchIndex = 1;\n for (String name : patternRoute.getSecond().getGroupNames()) {\n String value = matcher.group(matchIndex);\n groupNameValuesBuilder.put(name, value);\n matchIndex++;\n }\n result.add(new RoutableDestination<>(patternRoute.getSecond().getDestination(), groupNameValuesBuilder));\n }\n }\n return result;\n }",
"public void deleteModule(final String moduleId) {\n final DbModule module = getModule(moduleId);\n repositoryHandler.deleteModule(module.getId());\n\n for (final String gavc : DataUtils.getAllArtifacts(module)) {\n repositoryHandler.deleteArtifact(gavc);\n }\n }",
"public void setEnd(Date endDate) {\n\n if ((null == endDate) || getStart().after(endDate)) {\n m_explicitEnd = null;\n } else {\n m_explicitEnd = endDate;\n }\n }",
"public static auditnslogpolicy_vpnvserver_binding[] get(nitro_service service, String name) throws Exception{\n\t\tauditnslogpolicy_vpnvserver_binding obj = new auditnslogpolicy_vpnvserver_binding();\n\t\tobj.set_name(name);\n\t\tauditnslogpolicy_vpnvserver_binding response[] = (auditnslogpolicy_vpnvserver_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"public ApnsServiceBuilder withAuthProxy(Proxy proxy, String proxyUsername, String proxyPassword) {\n this.proxy = proxy;\n this.proxyUsername = proxyUsername;\n this.proxyPassword = proxyPassword;\n return this;\n }",
"public PartialCollection<BoxItem.Info> searchRange(long offset, long limit, final BoxSearchParameters bsp) {\n QueryStringBuilder builder = bsp.getQueryParameters()\n .appendParam(\"limit\", limit)\n .appendParam(\"offset\", offset);\n URL url = SEARCH_URL_TEMPLATE.buildWithQuery(this.getAPI().getBaseURL(), builder.toString());\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"GET\");\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n String totalCountString = responseJSON.get(\"total_count\").toString();\n long fullSize = Double.valueOf(totalCountString).longValue();\n PartialCollection<BoxItem.Info> results = new PartialCollection<BoxItem.Info>(offset, limit, fullSize);\n JsonArray jsonArray = responseJSON.get(\"entries\").asArray();\n for (JsonValue value : jsonArray) {\n JsonObject jsonObject = value.asObject();\n BoxItem.Info parsedItemInfo = (BoxItem.Info) BoxResource.parseInfo(this.getAPI(), jsonObject);\n if (parsedItemInfo != null) {\n results.add(parsedItemInfo);\n }\n }\n return results;\n }",
"private CmsFavoriteEntry getEntry(Component row) {\n\n if (row instanceof CmsFavInfo) {\n\n return ((CmsFavInfo)row).getEntry();\n\n }\n return null;\n\n }"
] |
Returns a factory that vends DelimitRegExIterators that reads the contents of the
given Reader, splits on the specified delimiter, applies op, then returns the result. | [
"public static <T> IteratorFromReaderFactory<T> getFactory(String delim, Function<String,T> op) {\r\n return new DelimitRegExIteratorFactory<T>(delim, op);\r\n }"
] | [
"public float getBoundsDepth() {\n if (mSceneObject != null) {\n GVRSceneObject.BoundingVolume v = mSceneObject.getBoundingVolume();\n return v.maxCorner.z - v.minCorner.z;\n }\n return 0f;\n }",
"private void showSettingsMenu(final Cursor cursor) {\n Log.d(TAG, \"showSettingsMenu\");\n enableSettingsCursor(cursor);\n context.runOnGlThread(new Runnable() {\n @Override\n public void run() {\n new SettingsView(context, scene, CursorManager.this,\n settingsCursor.getIoDevice().getCursorControllerId(), cursor, new\n SettingsChangeListener() {\n @Override\n public void onBack(boolean cascading) {\n disableSettingsCursor();\n }\n\n @Override\n public int onDeviceChanged(IoDevice device) {\n // we are changing the io device on the settings cursor\n removeCursorFromScene(settingsCursor);\n IoDevice clickedDevice = getAvailableIoDevice(device);\n settingsCursor.setIoDevice(clickedDevice);\n addCursorToScene(settingsCursor);\n return device.getCursorControllerId();\n }\n });\n }\n });\n }",
"private int getFlagResource(Country country) {\n return getContext().getResources().getIdentifier(\"country_\" + country.getIso().toLowerCase(), \"drawable\", getContext().getPackageName());\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}",
"@Override\n public void put(ByteArray keyBytes, Versioned<byte[]> valueBytes, byte[] transforms)\n throws VoldemortException {\n // acquire write lock\n writeLock.lock();\n try {\n String key = ByteUtils.getString(keyBytes.get(), \"UTF-8\");\n Versioned<String> value = new Versioned<String>(ByteUtils.getString(valueBytes.getValue(),\n \"UTF-8\"),\n valueBytes.getVersion());\n\n Versioned<Object> valueObject = convertStringToObject(key, value);\n\n this.put(key, valueObject);\n } finally {\n writeLock.unlock();\n }\n }",
"public static base_response unset(nitro_service client, onlinkipv6prefix resource, String[] args) throws Exception{\n\t\tonlinkipv6prefix unsetresource = new onlinkipv6prefix();\n\t\tunsetresource.ipv6prefix = resource.ipv6prefix;\n\t\treturn unsetresource.unset_resource(client,args);\n\t}",
"@Nonnull\n public static Map<String, Integer> parseForcedGroups(@Nonnull final HttpServletRequest request) {\n final String forceGroupsList = getForceGroupsStringFromRequest(request);\n return parseForceGroupsList(forceGroupsList);\n }",
"public static RgbaColor fromHsl(float H, float S, float L) {\n\n // convert to [0-1]\n H /= 360f;\n S /= 100f;\n L /= 100f;\n\n float R, G, B;\n\n if (S == 0) {\n // grey\n R = G = B = L;\n }\n else {\n float m2 = L <= 0.5 ? L * (S + 1f) : L + S - L * S;\n float m1 = 2f * L - m2;\n R = hue2rgb(m1, m2, H + 1 / 3f);\n G = hue2rgb(m1, m2, H);\n B = hue2rgb(m1, m2, H - 1 / 3f);\n }\n\n // convert [0-1] to [0-255]\n int r = Math.round(R * 255f);\n int g = Math.round(G * 255f);\n int b = Math.round(B * 255f);\n\n return new RgbaColor(r, g, b, 1);\n }",
"public Optional<URL> getServiceUrl() {\n Optional<Service> optionalService = client.services().inNamespace(namespace)\n .list().getItems()\n .stream()\n .findFirst();\n\n return optionalService\n .map(this::createUrlForService)\n .orElse(Optional.empty());\n }"
] |
Extract day type definitions.
@param types Synchro day type rows
@return Map of day types by UUID | [
"private Map<UUID, List<DateRange>> processDayTypes(List<MapRow> types)\n {\n Map<UUID, List<DateRange>> map = new HashMap<UUID, List<DateRange>>();\n for (MapRow row : types)\n {\n List<DateRange> ranges = new ArrayList<DateRange>();\n for (MapRow range : row.getRows(\"TIME_RANGES\"))\n {\n ranges.add(new DateRange(range.getDate(\"START\"), range.getDate(\"END\")));\n }\n map.put(row.getUUID(\"UUID\"), ranges);\n }\n\n return map;\n }"
] | [
"public DynamicReportBuilder addStyle(Style style) throws DJBuilderException {\n if (style.getName() == null) {\n throw new DJBuilderException(\"Invalid style. The style must have a name\");\n }\n\n report.addStyle(style);\n\n return this;\n }",
"protected Query buildMtoNImplementorQuery(Collection ids)\r\n {\r\n String[] indFkCols = getFksToThisClass();\r\n String[] indItemFkCols = getFksToItemClass();\r\n FieldDescriptor[] pkFields = getOwnerClassDescriptor().getPkFields();\r\n FieldDescriptor[] itemPkFields = getItemClassDescriptor().getPkFields();\r\n String[] cols = new String[indFkCols.length + indItemFkCols.length];\r\n int[] jdbcTypes = new int[indFkCols.length + indItemFkCols.length];\r\n\r\n // concatenate the columns[]\r\n System.arraycopy(indFkCols, 0, cols, 0, indFkCols.length);\r\n System.arraycopy(indItemFkCols, 0, cols, indFkCols.length, indItemFkCols.length);\r\n\r\n Criteria crit = buildPrefetchCriteria(ids, indFkCols, indItemFkCols, itemPkFields);\r\n\r\n // determine the jdbcTypes of the pks\r\n for (int i = 0; i < pkFields.length; i++)\r\n {\r\n jdbcTypes[i] = pkFields[i].getJdbcType().getType();\r\n }\r\n for (int i = 0; i < itemPkFields.length; i++)\r\n {\r\n jdbcTypes[pkFields.length + i] = itemPkFields[i].getJdbcType().getType();\r\n }\r\n\r\n ReportQueryByMtoNCriteria q = new ReportQueryByMtoNCriteria(getItemClassDescriptor().getClassOfObject(), cols,\r\n crit, false);\r\n q.setIndirectionTable(getCollectionDescriptor().getIndirectionTable());\r\n q.setJdbcTypes(jdbcTypes);\r\n\r\n CollectionDescriptor cds = getCollectionDescriptor();\r\n //check if collection must be ordered\r\n if (!cds.getOrderBy().isEmpty())\r\n {\r\n Iterator iter = cds.getOrderBy().iterator();\r\n while (iter.hasNext())\r\n {\r\n q.addOrderBy((FieldHelper) iter.next());\r\n }\r\n }\r\n \r\n return q;\r\n }",
"public final SimpleFeatureCollection autoTreat(final Template template, final String features)\n throws IOException {\n SimpleFeatureCollection featuresCollection = treatStringAsURL(template, features);\n if (featuresCollection == null) {\n featuresCollection = treatStringAsGeoJson(features);\n }\n return featuresCollection;\n }",
"public FullTypeSignature getTypeErasureSignature() {\r\n\t\tif (typeErasureSignature == null) {\r\n\t\t\ttypeErasureSignature = new ClassTypeSignature(binaryName,\r\n\t\t\t\t\tnew TypeArgSignature[0], ownerTypeSignature == null ? null\r\n\t\t\t\t\t\t\t: (ClassTypeSignature) ownerTypeSignature\r\n\t\t\t\t\t\t\t\t\t.getTypeErasureSignature());\r\n\t\t}\r\n\t\treturn typeErasureSignature;\r\n\t}",
"@UiHandler(\"m_atNumber\")\r\n void onWeekOfMonthChange(ValueChangeEvent<String> event) {\r\n\r\n if (handleChange()) {\r\n m_controller.setWeekOfMonth(event.getValue());\r\n }\r\n }",
"public static appfwpolicylabel_binding get(nitro_service service, String labelname) throws Exception{\n\t\tappfwpolicylabel_binding obj = new appfwpolicylabel_binding();\n\t\tobj.set_labelname(labelname);\n\t\tappfwpolicylabel_binding response = (appfwpolicylabel_binding) obj.get_resource(service);\n\t\treturn response;\n\t}",
"public Script updateName(int id, String name) throws Exception {\n PreparedStatement statement = null;\n\n try (Connection sqlConnection = SQLService.getInstance().getConnection()) {\n statement = sqlConnection.prepareStatement(\n \"UPDATE \" + Constants.DB_TABLE_SCRIPT +\n \" SET \" + Constants.SCRIPT_NAME + \" = ? \" +\n \" WHERE \" + Constants.GENERIC_ID + \" = ?\"\n );\n statement.setString(1, name);\n statement.setInt(2, id);\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\n return this.getScript(id);\n }",
"private <A extends Annotation> AnnotationConverter<A> getConverter(Annotation annotation) {\n\t\tMappingOption mappingOption = annotation.annotationType().getAnnotation( MappingOption.class );\n\t\tif ( mappingOption == null ) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// wrong type would be a programming error of the annotation developer\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tClass<? extends AnnotationConverter<A>> converterClass = (Class<? extends AnnotationConverter<A>>) mappingOption.value();\n\n\t\ttry {\n\t\t\treturn converterClass.newInstance();\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow log.cannotConvertAnnotation( converterClass, e );\n\t\t}\n\t}",
"public void addItem(T value, Direction dir, String text) {\n addItem(value, dir, text, true);\n }"
] |
Initializes the set of report implementation. | [
"public static void init() {\n reports.clear();\n Reflections reflections = new Reflections(REPORTS_PACKAGE);\n final Set<Class<? extends Report>> reportClasses = reflections.getSubTypesOf(Report.class);\n\n for(Class<? extends Report> c : reportClasses) {\n LOG.info(\"Report class: \" + c.getName());\n try {\n reports.add(c.newInstance());\n } catch (IllegalAccessException | InstantiationException e) {\n LOG.error(\"Error while loading report implementation classes\", e);\n }\n }\n\n if(LOG.isInfoEnabled()) {\n LOG.info(String.format(\"Detected %s reports\", reports.size()));\n }\n }"
] | [
"public int getCrossZonePartitionStoreMoves() {\n int xzonePartitionStoreMoves = 0;\n for (RebalanceTaskInfo info : batchPlan) {\n Node donorNode = finalCluster.getNodeById(info.getDonorId());\n Node stealerNode = finalCluster.getNodeById(info.getStealerId());\n\n if(donorNode.getZoneId() != stealerNode.getZoneId()) {\n xzonePartitionStoreMoves += info.getPartitionStoreMoves();\n }\n }\n\n return xzonePartitionStoreMoves;\n }",
"static Type getRawType(Type genericType, Map<TypeVariable, Type> typeVariableMap) {\n\t\tType resolvedType = genericType;\n\t\tif (genericType instanceof TypeVariable) {\n\t\t\tTypeVariable tv = (TypeVariable) genericType;\n\t\t\tresolvedType = typeVariableMap.get(tv);\n\t\t\tif (resolvedType == null) {\n\t\t\t\tresolvedType = extractBoundForTypeVariable(tv);\n\t\t\t}\n\t\t}\n\t\tif (resolvedType instanceof ParameterizedType) {\n\t\t\treturn ((ParameterizedType) resolvedType).getRawType();\n\t\t}\n\t\telse {\n\t\t\treturn resolvedType;\n\t\t}\n\t}",
"public static Filter.Builder makeAndFilter(Iterable<Filter> subfilters) {\n return Filter.newBuilder()\n .setCompositeFilter(CompositeFilter.newBuilder()\n .addAllFilters(subfilters)\n .setOp(CompositeFilter.Operator.AND));\n }",
"public static long raiseToPower(int value, int power)\n {\n if (power < 0)\n {\n throw new IllegalArgumentException(\"This method does not support negative powers.\");\n }\n long result = 1;\n for (int i = 0; i < power; i++)\n {\n result *= value;\n }\n return result;\n }",
"public List<String> parseMethodList(String methods) {\n\n String[] methodArray = StringUtils.delimitedListToStringArray(methods, \",\");\n\n List<String> methodList = new ArrayList<String>();\n\n for (String methodName : methodArray) {\n methodList.add(methodName.trim());\n }\n return methodList;\n }",
"private void deliverFaderStartCommand(Set<Integer> playersToStart, Set<Integer> playersToStop) {\n for (final FaderStartListener listener : getFaderStartListeners()) {\n try {\n listener.fadersChanged(playersToStart, playersToStop);\n } catch (Throwable t) {\n logger.warn(\"Problem delivering fader start command to listener\", t);\n }\n }\n }",
"private void processSubProjects()\n {\n int subprojectIndex = 1;\n for (Task task : m_project.getTasks())\n {\n String subProjectFileName = task.getSubprojectName();\n if (subProjectFileName != null)\n {\n String fileName = subProjectFileName;\n int offset = 0x01000000 + (subprojectIndex * 0x00400000);\n int index = subProjectFileName.lastIndexOf('\\\\');\n if (index != -1)\n {\n fileName = subProjectFileName.substring(index + 1);\n }\n\n SubProject sp = new SubProject();\n sp.setFileName(fileName);\n sp.setFullPath(subProjectFileName);\n sp.setUniqueIDOffset(Integer.valueOf(offset));\n sp.setTaskUniqueID(task.getUniqueID());\n task.setSubProject(sp);\n\n ++subprojectIndex;\n }\n }\n }",
"public static Bitmap flip(Bitmap src) {\n Matrix m = new Matrix();\n m.preScale(-1, 1);\n return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), m, false);\n }",
"private long getTime(Date start1, Date end1, Date start2, Date end2)\n {\n long total = 0;\n\n if (start1 != null && end1 != null && start2 != null && end2 != null)\n {\n long start;\n long end;\n\n if (start1.getTime() < start2.getTime())\n {\n start = start2.getTime();\n }\n else\n {\n start = start1.getTime();\n }\n\n if (end1.getTime() < end2.getTime())\n {\n end = end1.getTime();\n }\n else\n {\n end = end2.getTime();\n }\n\n if (start < end)\n {\n total = end - start;\n }\n }\n\n return (total);\n }"
] |
Parse a list of objects from a JsonParser.
@param jsonParser The JsonParser, preconfigured to be at the START_ARRAY token. | [
"public List<T> parseList(JsonParser jsonParser) throws IOException {\n List<T> list = new ArrayList<>();\n if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {\n while (jsonParser.nextToken() != JsonToken.END_ARRAY) {\n list.add(parse(jsonParser));\n }\n }\n return list;\n }"
] | [
"public Object selectElement(String predicate) throws org.odmg.QueryInvalidException\r\n {\r\n return ((DList) this.query(predicate)).get(0);\r\n }",
"public static responderparam get(nitro_service service) throws Exception{\n\t\tresponderparam obj = new responderparam();\n\t\tresponderparam[] response = (responderparam[])obj.get_resources(service);\n\t\treturn response[0];\n\t}",
"public T modifyModule(final String moduleName, final String slot, final byte[] existingHash, final byte[] newHash) {\n final ContentItem item = createModuleItem(moduleName, slot, newHash);\n addContentModification(createContentModification(item, ModificationType.MODIFY, existingHash));\n return returnThis();\n }",
"public InsertIntoTable addRowsFrom(File file, FileParser fileParser) {\n builder.addRowsFrom(file, fileParser);\n return this;\n }",
"public PhotoList<Photo> getUntagged(int perPage, int page) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_UNTAGGED);\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 PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement);\r\n return photos;\r\n }",
"public static base_responses add(nitro_service client, gslbservice resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tgslbservice addresources[] = new gslbservice[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new gslbservice();\n\t\t\t\taddresources[i].servicename = resources[i].servicename;\n\t\t\t\taddresources[i].cnameentry = resources[i].cnameentry;\n\t\t\t\taddresources[i].ip = resources[i].ip;\n\t\t\t\taddresources[i].servername = resources[i].servername;\n\t\t\t\taddresources[i].servicetype = resources[i].servicetype;\n\t\t\t\taddresources[i].port = resources[i].port;\n\t\t\t\taddresources[i].publicip = resources[i].publicip;\n\t\t\t\taddresources[i].publicport = resources[i].publicport;\n\t\t\t\taddresources[i].maxclient = resources[i].maxclient;\n\t\t\t\taddresources[i].healthmonitor = resources[i].healthmonitor;\n\t\t\t\taddresources[i].sitename = resources[i].sitename;\n\t\t\t\taddresources[i].state = resources[i].state;\n\t\t\t\taddresources[i].cip = resources[i].cip;\n\t\t\t\taddresources[i].cipheader = resources[i].cipheader;\n\t\t\t\taddresources[i].sitepersistence = resources[i].sitepersistence;\n\t\t\t\taddresources[i].cookietimeout = resources[i].cookietimeout;\n\t\t\t\taddresources[i].siteprefix = resources[i].siteprefix;\n\t\t\t\taddresources[i].clttimeout = resources[i].clttimeout;\n\t\t\t\taddresources[i].svrtimeout = resources[i].svrtimeout;\n\t\t\t\taddresources[i].maxbandwidth = resources[i].maxbandwidth;\n\t\t\t\taddresources[i].downstateflush = resources[i].downstateflush;\n\t\t\t\taddresources[i].maxaaausers = resources[i].maxaaausers;\n\t\t\t\taddresources[i].monthreshold = resources[i].monthreshold;\n\t\t\t\taddresources[i].hashid = resources[i].hashid;\n\t\t\t\taddresources[i].comment = resources[i].comment;\n\t\t\t\taddresources[i].appflowlog = resources[i].appflowlog;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}",
"public static void touch(final File folder , final String fileName) throws IOException {\n if(!folder.exists()){\n folder.mkdirs();\n }\n\n final File touchedFile = new File(folder, fileName);\n\n // The JVM will only 'touch' the file if you instantiate a\n // FileOutputStream instance for the file in question.\n // You don't actually write any data to the file through\n // the FileOutputStream. Just instantiate it and close it.\n\n try (\n FileOutputStream doneFOS = new FileOutputStream(touchedFile);\n ) {\n // Touching the file\n }\n catch (FileNotFoundException e) {\n throw new FileNotFoundException(\"Failed to the find file.\" + e);\n }\n }",
"private void checkModifications(ClassDescriptorDef classDef, String checkLevel) throws ConstraintException\r\n {\r\n if (CHECKLEVEL_NONE.equals(checkLevel))\r\n {\r\n return;\r\n }\r\n\r\n HashMap features = new HashMap();\r\n FeatureDescriptorDef def;\r\n\r\n for (Iterator it = classDef.getFields(); it.hasNext();)\r\n {\r\n def = (FeatureDescriptorDef)it.next();\r\n features.put(def.getName(), def);\r\n }\r\n for (Iterator it = classDef.getReferences(); it.hasNext();)\r\n {\r\n def = (FeatureDescriptorDef)it.next();\r\n features.put(def.getName(), def);\r\n }\r\n for (Iterator it = classDef.getCollections(); it.hasNext();)\r\n {\r\n def = (FeatureDescriptorDef)it.next();\r\n features.put(def.getName(), def);\r\n }\r\n\r\n // now checking the modifications\r\n Properties mods;\r\n String modName;\r\n String propName;\r\n\r\n for (Iterator it = classDef.getModificationNames(); it.hasNext();)\r\n {\r\n modName = (String)it.next();\r\n if (!features.containsKey(modName))\r\n {\r\n throw new ConstraintException(\"Class \"+classDef.getName()+\" contains a modification for an unknown feature \"+modName);\r\n }\r\n def = (FeatureDescriptorDef)features.get(modName);\r\n if (def.getOriginal() == null)\r\n {\r\n throw new ConstraintException(\"Class \"+classDef.getName()+\" contains a modification for a feature \"+modName+\" that is not inherited but defined in the same class\");\r\n }\r\n // checking modification\r\n mods = classDef.getModification(modName);\r\n for (Iterator propIt = mods.keySet().iterator(); propIt.hasNext();)\r\n {\r\n propName = (String)propIt.next();\r\n if (!PropertyHelper.isPropertyAllowed(def.getClass(), propName))\r\n {\r\n throw new ConstraintException(\"The modification of attribute \"+propName+\" in class \"+classDef.getName()+\" is not applicable to the feature \"+modName);\r\n }\r\n }\r\n }\r\n }",
"private List<TimephasedCost> getTimephasedCostFixedAmount()\n {\n List<TimephasedCost> result = new LinkedList<TimephasedCost>();\n\n ProjectCalendar cal = getCalendar();\n\n double remainingCost = getRemainingCost().doubleValue();\n\n if (remainingCost > 0)\n {\n AccrueType accrueAt = getResource().getAccrueAt();\n\n if (accrueAt == AccrueType.START)\n {\n result.add(splitCostStart(cal, remainingCost, getStart()));\n }\n else\n if (accrueAt == AccrueType.END)\n {\n result.add(splitCostEnd(cal, remainingCost, getFinish()));\n }\n else\n {\n //for prorated, we have to deal with it differently depending on whether or not\n //any actual has been entered, since we want to mimic the other timephased data\n //where planned and actual values do not overlap\n double numWorkingDays = cal.getWork(getStart(), getFinish(), TimeUnit.DAYS).getDuration();\n double standardAmountPerDay = getCost().doubleValue() / numWorkingDays;\n\n if (getActualCost().intValue() > 0)\n {\n //need to get three possible blocks of data: one for the possible partial amount\n //overlap with timephased actual cost; one with all the standard amount days\n //that happen after the actual cost stops; and one with any remaining\n //partial day cost amount\n\n int numActualDaysUsed = (int) Math.ceil(getActualCost().doubleValue() / standardAmountPerDay);\n Date actualWorkFinish = cal.getDate(getStart(), Duration.getInstance(numActualDaysUsed, TimeUnit.DAYS), false);\n\n double partialDayActualAmount = getActualCost().doubleValue() % standardAmountPerDay;\n\n if (partialDayActualAmount > 0)\n {\n double dayAmount = standardAmountPerDay < remainingCost ? standardAmountPerDay - partialDayActualAmount : remainingCost;\n\n result.add(splitCostEnd(cal, dayAmount, actualWorkFinish));\n\n remainingCost -= dayAmount;\n }\n\n //see if there's anything left to work with\n if (remainingCost > 0)\n {\n //have to split up the amount into standard prorated amount days and whatever is left\n result.addAll(splitCostProrated(cal, remainingCost, standardAmountPerDay, cal.getNextWorkStart(actualWorkFinish)));\n }\n\n }\n else\n {\n //no actual cost to worry about, so just a standard split from the beginning of the assignment\n result.addAll(splitCostProrated(cal, remainingCost, standardAmountPerDay, getStart()));\n }\n }\n }\n\n return result;\n }"
] |
Remove all of the audio sources from the audio manager.
This will stop all sound from playing. | [
"public void clearSources()\n {\n synchronized (mAudioSources)\n {\n for (GVRAudioSource source : mAudioSources)\n {\n source.setListener(null);\n }\n mAudioSources.clear();\n }\n }"
] | [
"public static void Forward(double[][] data) {\n int rows = data.length;\n int cols = data[0].length;\n\n double[] row = new double[cols];\n double[] col = new double[rows];\n\n for (int i = 0; i < rows; i++) {\n for (int j = 0; j < row.length; j++)\n row[j] = data[i][j];\n\n Forward(row);\n\n for (int j = 0; j < row.length; j++)\n data[i][j] = row[j];\n }\n\n for (int j = 0; j < cols; j++) {\n for (int i = 0; i < col.length; i++)\n col[i] = data[i][j];\n\n Forward(col);\n\n for (int i = 0; i < col.length; i++)\n data[i][j] = col[i];\n }\n }",
"private static <T> void writeConfig(BufferedWriter writer, DatabaseTableConfig<T> config) throws IOException,\n\t\t\tSQLException {\n\t\twriter.append(CONFIG_FILE_START_MARKER);\n\t\twriter.newLine();\n\t\tif (config.getDataClass() != null) {\n\t\t\twriter.append(FIELD_NAME_DATA_CLASS).append('=').append(config.getDataClass().getName());\n\t\t\twriter.newLine();\n\t\t}\n\t\tif (config.getTableName() != null) {\n\t\t\twriter.append(FIELD_NAME_TABLE_NAME).append('=').append(config.getTableName());\n\t\t\twriter.newLine();\n\t\t}\n\t\twriter.append(CONFIG_FILE_FIELDS_START);\n\t\twriter.newLine();\n\t\tif (config.getFieldConfigs() != null) {\n\t\t\tfor (DatabaseFieldConfig field : config.getFieldConfigs()) {\n\t\t\t\tDatabaseFieldConfigLoader.write(writer, field, config.getTableName());\n\t\t\t}\n\t\t}\n\t\twriter.append(CONFIG_FILE_FIELDS_END);\n\t\twriter.newLine();\n\t\twriter.append(CONFIG_FILE_END_MARKER);\n\t\twriter.newLine();\n\t}",
"public void run(Configuration configuration, List<CandidateSteps> candidateSteps, Story story) throws Throwable {\n run(configuration, candidateSteps, story, MetaFilter.EMPTY);\n }",
"public static java.util.Date toDateTime(Object value) throws ParseException {\n if (value == null) {\n return null;\n }\n if (value instanceof java.util.Date) {\n return (java.util.Date) value;\n }\n if (value instanceof String) {\n if (\"\".equals((String) value)) {\n return null;\n }\n return IN_DATETIME_FORMAT.parse((String) value);\n }\n\n return IN_DATETIME_FORMAT.parse(value.toString());\n }",
"protected List<Integer> getPageSizes() {\n\n try {\n return Collections.singletonList(Integer.valueOf(m_configObject.getInt(JSON_KEY_PAGESIZE)));\n } catch (JSONException e) {\n List<Integer> result = null;\n String pageSizesString = null;\n try {\n pageSizesString = m_configObject.getString(JSON_KEY_PAGESIZE);\n String[] pageSizesArray = pageSizesString.split(\"-\");\n if (pageSizesArray.length > 0) {\n result = new ArrayList<>(pageSizesArray.length);\n for (int i = 0; i < pageSizesArray.length; i++) {\n result.add(Integer.valueOf(pageSizesArray[i]));\n }\n }\n return result;\n } catch (NumberFormatException | JSONException e1) {\n LOG.warn(Messages.get().getBundle().key(Messages.LOG_PARSING_PAGE_SIZES_FAILED_1, pageSizesString), e);\n }\n if (null == m_baseConfig) {\n if (LOG.isInfoEnabled()) {\n LOG.info(Messages.get().getBundle().key(Messages.LOG_NO_PAGESIZE_SPECIFIED_0), e);\n }\n return null;\n } else {\n return m_baseConfig.getPaginationConfig().getPageSizes();\n }\n }\n }",
"public void addColumnIsNull(String column)\r\n {\r\n\t\t// PAW\r\n\t\t//SelectionCriteria c = ValueCriteria.buildNullCriteria(column, getAlias());\r\n\t\tSelectionCriteria c = ValueCriteria.buildNullCriteria(column, getUserAlias(column));\r\n c.setTranslateAttribute(false);\r\n addSelectionCriteria(c);\r\n }",
"private static Interval parseEndDateTime(Instant start, ZoneOffset offset, CharSequence endStr) {\n try {\n TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest(endStr, OffsetDateTime::from, LocalDateTime::from);\n if (temporal instanceof OffsetDateTime) {\n OffsetDateTime odt = (OffsetDateTime) temporal;\n return Interval.of(start, odt.toInstant());\n } else {\n // infer offset from start if not specified by end\n LocalDateTime ldt = (LocalDateTime) temporal;\n return Interval.of(start, ldt.toInstant(offset));\n }\n } catch (DateTimeParseException ex) {\n Instant end = Instant.parse(endStr);\n return Interval.of(start, end);\n }\n }",
"private String readOptionalString(JSONValue val) {\n\n JSONString str = null == val ? null : val.isString();\n if (str != null) {\n return str.stringValue();\n }\n return null;\n }",
"public Date getFinish()\n {\n Date result = (Date) getCachedValue(AssignmentField.FINISH);\n if (result == null)\n {\n result = getTask().getFinish();\n }\n return result;\n }"
] |
You should call this method from your activity onRequestPermissionsResult.
@param requestCode The request code passed in requestPermissions(android.app.Activity, String[], int)
@param permissions The requested permissions. Never null.
@param grantResults The grant results for the corresponding permissions which is either
PERMISSION_GRANTED or PERMISSION_DENIED. Never null. | [
"public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {\n switch (requestCode) {\n case REQUEST_PERMISSIONS_CODE:\n if (listener != null) {\n boolean granted = grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED;\n listener.onPermissionResult(granted);\n }\n break;\n default:\n // Ignored\n }\n }"
] | [
"@SuppressWarnings({\"unused\", \"WeakerAccess\"})\n public void setOffline(boolean value){\n offline = value;\n if (offline) {\n getConfigLogger().debug(getAccountId(), \"CleverTap Instance has been set to offline, won't send events queue\");\n } else {\n getConfigLogger().debug(getAccountId(), \"CleverTap Instance has been set to online, sending events queue\");\n flush();\n }\n }",
"protected void setJsonValue(JsonObjectBuilder builder, T value) {\n // I don't like this - there should really be a way to construct a disconnected JSONValue...\n if (value instanceof Boolean) {\n builder.add(\"value\", (Boolean) value);\n } else if (value instanceof Double) {\n builder.add(\"value\", (Double) value);\n } else if (value instanceof Integer) {\n builder.add(\"value\", (Integer) value);\n } else if (value instanceof Long) {\n builder.add(\"value\", (Long) value);\n } else if (value instanceof BigInteger) {\n builder.add(\"value\", (BigInteger) value);\n } else if (value instanceof BigDecimal) {\n builder.add(\"value\", (BigDecimal) value);\n } else if (value == null) {\n builder.addNull(\"value\");\n } else {\n builder.add(\"value\", value.toString());\n }\n }",
"private <T extends Index> List<T> listIndexType(String type, Class<T> modelType) {\n List<T> indexesOfType = new ArrayList<T>();\n Gson g = new Gson();\n for (JsonElement index : indexes) {\n if (index.isJsonObject()) {\n JsonObject indexDefinition = index.getAsJsonObject();\n JsonElement indexType = indexDefinition.get(\"type\");\n if (indexType != null && indexType.isJsonPrimitive()) {\n JsonPrimitive indexTypePrimitive = indexType.getAsJsonPrimitive();\n if (type == null || (indexTypePrimitive.isString() && indexTypePrimitive\n .getAsString().equals(type))) {\n indexesOfType.add(g.fromJson(indexDefinition, modelType));\n }\n }\n }\n }\n return indexesOfType;\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 }",
"public static String getRelativePathName(Path root, Path path) {\n Path relative = root.relativize(path);\n return Files.isDirectory(path) && !relative.toString().endsWith(\"/\") ? String.format(\"%s/\", relative.toString()) : relative.toString();\n }",
"public GVRAnimation setOffset(float startOffset)\n {\n if(startOffset<0 || startOffset>mDuration){\n throw new IllegalArgumentException(\"offset should not be either negative or greater than duration\");\n }\n animationOffset = startOffset;\n mDuration = mDuration-animationOffset;\n return this;\n }",
"public static Span exact(Bytes row) {\n Objects.requireNonNull(row);\n return new Span(row, true, row, true);\n }",
"public static PJsonObject parseSpec(final String spec) {\n final JSONObject jsonSpec;\n try {\n jsonSpec = new JSONObject(spec);\n } catch (JSONException e) {\n throw new RuntimeException(\"Cannot parse the spec file: \" + spec, e);\n }\n return new PJsonObject(jsonSpec, \"spec\");\n }",
"public void setProxy(String proxyHost, int proxyPort, String username, String password) {\n setProxy(proxyHost, proxyPort);\n proxyAuth = true;\n proxyUser = username;\n proxyPassword = password;\n }"
] |
This is a convenience method to add a default derived
calendar to the project.
@return new ProjectCalendar instance | [
"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 }"
] | [
"public synchronized void start() throws SocketException {\n\n if (!isRunning()) {\n socket.set(new DatagramSocket(ANNOUNCEMENT_PORT));\n startTime.set(System.currentTimeMillis());\n deliverLifecycleAnnouncement(logger, true);\n\n final byte[] buffer = new byte[512];\n final DatagramPacket packet = new DatagramPacket(buffer, buffer.length);\n Thread receiver = new Thread(null, new Runnable() {\n @Override\n public void run() {\n boolean received;\n while (isRunning()) {\n try {\n if (getCurrentDevices().isEmpty()) {\n socket.get().setSoTimeout(60000); // We have no devices to check for timeout; block for a whole minute to check for shutdown\n } else {\n socket.get().setSoTimeout(1000); // Check every second to see if a device has vanished\n }\n socket.get().receive(packet);\n received = !ignoredAddresses.contains(packet.getAddress());\n } catch (SocketTimeoutException ste) {\n received = false;\n } catch (IOException e) {\n // Don't log a warning if the exception was due to the socket closing at shutdown.\n if (isRunning()) {\n // We did not expect to have a problem; log a warning and shut down.\n logger.warn(\"Problem reading from DeviceAnnouncement socket, stopping\", e);\n stop();\n }\n received = false;\n }\n try {\n if (received && (packet.getLength() == 54)) {\n final Util.PacketType kind = Util.validateHeader(packet, ANNOUNCEMENT_PORT);\n if (kind == Util.PacketType.DEVICE_KEEP_ALIVE) {\n // Looks like the kind of packet we need\n if (packet.getLength() < 54) {\n logger.warn(\"Ignoring too-short \" + kind.name + \" packet; expected 54 bytes, but only got \" +\n packet.getLength() + \".\");\n } else {\n if (packet.getLength() > 54) {\n logger.warn(\"Processing too-long \" + kind.name + \" packet; expected 54 bytes, but got \" +\n packet.getLength() + \".\");\n }\n DeviceAnnouncement announcement = new DeviceAnnouncement(packet);\n final boolean foundNewDevice = isDeviceNew(announcement);\n updateDevices(announcement);\n if (foundNewDevice) {\n deliverFoundAnnouncement(announcement);\n }\n }\n }\n }\n expireDevices();\n } catch (Throwable t) {\n logger.warn(\"Problem processing DeviceAnnouncement packet\", t);\n }\n }\n }\n }, \"beat-link DeviceFinder receiver\");\n receiver.setDaemon(true);\n receiver.start();\n }\n }",
"private Serializable doWorkInIsolationTransaction(final SharedSessionContractImplementor session)\n\t\t\tthrows HibernateException {\n\t\tclass Work extends AbstractReturningWork<IntegralDataTypeHolder> {\n\t\t\tprivate final SharedSessionContractImplementor localSession = session;\n\n\t\t\t@Override\n\t\t\tpublic IntegralDataTypeHolder execute(Connection connection) throws SQLException {\n\t\t\t\ttry {\n\t\t\t\t\treturn doWorkInCurrentTransactionIfAny( localSession );\n\t\t\t\t}\n\t\t\t\tcatch ( RuntimeException sqle ) {\n\t\t\t\t\tthrow new HibernateException( \"Could not get or update next value\", sqle );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//we want to work out of transaction\n\t\tboolean workInTransaction = false;\n\t\tWork work = new Work();\n\t\tSerializable generatedValue = session.getTransactionCoordinator().createIsolationDelegate().delegateWork( work, workInTransaction );\n\t\treturn generatedValue;\n\t}",
"public Map<String, Object> getModuleFieldsFilters() {\n final Map<String, Object> params = new HashMap<String, Object>();\n\n for(final Filter filter: filters){\n params.putAll(filter.moduleFilterFields());\n }\n\n return params;\n }",
"public List<EnabledEndpoint> getEnabledEndpoints(int pathId, String clientUUID, String[] filters) throws Exception {\n ArrayList<EnabledEndpoint> enabledOverrides = new ArrayList<EnabledEndpoint>();\n PreparedStatement query = null;\n ResultSet results = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n query = sqlConnection.prepareStatement(\n \"SELECT * FROM \" + Constants.DB_TABLE_ENABLED_OVERRIDE +\n \" WHERE \" + Constants.ENABLED_OVERRIDES_PATH_ID + \"=?\" +\n \" AND \" + Constants.GENERIC_CLIENT_UUID + \"=?\" +\n \" ORDER BY \" + Constants.ENABLED_OVERRIDES_PRIORITY\n );\n query.setInt(1, pathId);\n query.setString(2, clientUUID);\n results = query.executeQuery();\n\n while (results.next()) {\n EnabledEndpoint endpoint = this.getPartialEnabledEndpointFromResultset(results);\n com.groupon.odo.proxylib.models.Method m = PathOverrideService.getInstance().getMethodForOverrideId(endpoint.getOverrideId());\n\n // this is an errant entry.. perhaps a method got deleted from a plugin\n // we'll also remove it from the endpoint\n if (m == null) {\n PathOverrideService.getInstance().removeOverride(endpoint.getOverrideId());\n continue;\n }\n\n // check filters and see if any match\n boolean addOverride = false;\n if (filters != null) {\n for (String filter : filters) {\n if (m.getMethodType().endsWith(filter)) {\n addOverride = true;\n break;\n }\n }\n } else {\n // if there are no filters then we assume that the requester wants all enabled overrides\n addOverride = true;\n }\n\n if (addOverride) {\n enabledOverrides.add(endpoint);\n }\n }\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n try {\n if (results != null) {\n results.close();\n }\n } catch (Exception e) {\n }\n try {\n if (query != null) {\n query.close();\n }\n } catch (Exception e) {\n }\n }\n\n // now go through the ArrayList and get the method for all of the endpoints\n // have to do this so we don't have overlapping SQL queries\n ArrayList<EnabledEndpoint> enabledOverridesWithMethods = new ArrayList<EnabledEndpoint>();\n for (EnabledEndpoint endpoint : enabledOverrides) {\n if (endpoint.getOverrideId() >= 0) {\n com.groupon.odo.proxylib.models.Method m = PathOverrideService.getInstance().getMethodForOverrideId(endpoint.getOverrideId());\n endpoint.setMethodInformation(m);\n }\n enabledOverridesWithMethods.add(endpoint);\n }\n\n return enabledOverridesWithMethods;\n }",
"public MessageSet read(long offset, int length) throws IOException {\n List<LogSegment> views = segments.getView();\n LogSegment found = findRange(views, offset, views.size());\n if (found == null) {\n if (logger.isTraceEnabled()) {\n logger.trace(format(\"NOT FOUND MessageSet from Log[%s], offset=%d, length=%d\", name, offset, length));\n }\n return MessageSet.Empty;\n }\n return found.getMessageSet().read(offset - found.start(), length);\n }",
"private void writeTimeUnitsField(String fieldName, Object value) throws IOException\n {\n TimeUnit val = (TimeUnit) value;\n if (val != m_projectFile.getProjectProperties().getDefaultDurationUnits())\n {\n m_writer.writeNameValuePair(fieldName, val.toString());\n }\n }",
"private void logShort(CharSequence message, boolean trim) throws IOException {\n int length = message.length();\n if (trim) {\n while (length > 0 && Character.isWhitespace(message.charAt(length - 1))) {\n length--;\n }\n }\n\n char [] chars = new char [length + 1];\n for (int i = 0; i < length; i++) {\n chars[i] = message.charAt(i);\n }\n chars[length] = '\\n';\n\n output.write(chars);\n }",
"public int executeTask(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, final ServerUpdateTask task) {\n try {\n return execute(listener, task.getServerIdentity(), task.getOperation());\n } catch (OperationFailedException e) {\n // Handle failures operation transformation failures\n final ServerIdentity identity = task.getServerIdentity();\n final ServerOperation serverOperation = new ServerOperation(identity, task.getOperation(), null, null, OperationResultTransformer.ORIGINAL_RESULT);\n final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e);\n listener.operationPrepared(result);\n recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), OperationResultTransformer.ORIGINAL_RESULT));\n return 1; // 1 ms timeout since there is no reason to wait for the locally stored result\n }\n\n }",
"public void delete(boolean notifyUser, boolean force) {\n String queryString = new QueryStringBuilder()\n .appendParam(\"notify\", String.valueOf(notifyUser))\n .appendParam(\"force\", String.valueOf(force))\n .toString();\n\n URL url = USER_URL_TEMPLATE.buildWithQuery(this.getAPI().getBaseURL(), queryString, this.getID());\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"DELETE\");\n BoxAPIResponse response = request.send();\n response.disconnect();\n }"
] |
returns the zero argument constructor for the class represented by this class descriptor
or null if a zero argument constructor does not exist. If the zero argument constructor
for this class is not public it is made accessible before being returned. | [
"public Constructor getZeroArgumentConstructor()\r\n {\r\n if (zeroArgumentConstructor == null && !alreadyLookedupZeroArguments)\r\n {\r\n try\r\n {\r\n zeroArgumentConstructor = getClassOfObject().getConstructor(NO_PARAMS);\r\n }\r\n catch (NoSuchMethodException e)\r\n {\r\n //no public zero argument constructor available let's try for a private/protected one\r\n try\r\n {\r\n zeroArgumentConstructor = getClassOfObject().getDeclaredConstructor(NO_PARAMS);\r\n\r\n //we found one, now let's make it accessible\r\n zeroArgumentConstructor.setAccessible(true);\r\n }\r\n catch (NoSuchMethodException e2)\r\n {\r\n //out of options, log the fact and let the method return null\r\n LoggerFactory.getDefaultLogger().warn(\r\n this.getClass().getName()\r\n + \": \"\r\n + \"No zero argument constructor defined for \"\r\n + this.getClassOfObject());\r\n }\r\n }\r\n\r\n alreadyLookedupZeroArguments = true;\r\n }\r\n\r\n return zeroArgumentConstructor;\r\n }"
] | [
"public void setIndexBuffer(GVRIndexBuffer ibuf)\n {\n mIndices = ibuf;\n NativeMesh.setIndexBuffer(getNative(), (ibuf != null) ? ibuf.getNative() : 0L);\n }",
"static String md5(String input) {\n if (input == null || input.length() == 0) {\n throw new IllegalArgumentException(\"Input string must not be blank.\");\n }\n try {\n MessageDigest algorithm = MessageDigest.getInstance(\"MD5\");\n algorithm.reset();\n algorithm.update(input.getBytes());\n byte[] messageDigest = algorithm.digest();\n\n StringBuilder hexString = new StringBuilder();\n for (byte messageByte : messageDigest) {\n hexString.append(Integer.toHexString((messageByte & 0xFF) | 0x100).substring(1, 3));\n }\n return hexString.toString();\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }",
"public static Type getDeclaredBeanType(Class<?> clazz) {\n Type[] actualTypeArguments = Reflections.getActualTypeArguments(clazz);\n if (actualTypeArguments.length == 1) {\n return actualTypeArguments[0];\n } else {\n return null;\n }\n }",
"public static <T> Iterator<T> concat(Iterator<? extends Iterator<? extends T>> iterators) {\n Preconditions.checkArgumentNotNull(iterators, \"iterators\");\n return new CombinedIterator<T>(iterators);\n }",
"private void removeObservation( int index ) {\n final int N = y.numRows-1;\n final double d[] = y.data;\n\n // shift\n for( int i = index; i < N; i++ ) {\n d[i] = d[i+1];\n }\n y.numRows--;\n }",
"public void retrieveProxyCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException\r\n {\r\n doRetrieveCollections(newObj, cld, forced, true);\r\n }",
"protected String createGlobalStyle()\n {\n StringBuilder ret = new StringBuilder();\n ret.append(createFontFaces());\n ret.append(\"\\n\");\n ret.append(defaultStyle);\n return ret.toString();\n }",
"void killAll()\n {\n for (RjiRegistration reg : this.instancesById.values().toArray(new RjiRegistration[] {}))\n {\n reg.rji.handleInstruction(Instruction.KILL);\n }\n }",
"public HashMap<String, IndexInput> getIndexInputList() {\n HashMap<String, IndexInput> clonedIndexInputList = new HashMap<String, IndexInput>();\n for (Entry<String, IndexInput> entry : indexInputList.entrySet()) {\n clonedIndexInputList.put(entry.getKey(), entry.getValue().clone());\n }\n return clonedIndexInputList;\n }"
] |
Launches the client with the specified parameters.
@param args
command line parameters
@throws ParseException
@throws IOException | [
"public static void main(String[] args) throws ParseException, IOException {\n\t\tClient client = new Client(\n\t\t\t\tnew DumpProcessingController(\"wikidatawiki\"), args);\n\t\tclient.performActions();\n\t}"
] | [
"public static <T> boolean addAll(Collection<T> self, Iterable<T> items) {\n boolean changed = false;\n for (T next : items) {\n if (self.add(next)) changed = true;\n }\n return changed;\n }",
"public static <K, V> Map<K, V> immutableMapView(Map<K, V> map) {\n if (map instanceof ImmutableMap<?, ?>) {\n return map;\n }\n return Collections.unmodifiableMap(map);\n }",
"public void finalizeConfig() {\n assert !configFinalized;\n\n try {\n retrieveEngine();\n } catch (Exception e) {\n throw new RuntimeException(e.getMessage(), e);\n }\n configFinalized = true;\n }",
"private static String mapContent(DataHandler dh) {\n if (dh == null) {\n return \"\";\n }\n try {\n InputStream is = dh.getInputStream();\n String content = IOUtils.toString(is);\n is.close();\n return content;\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"public void copyTo(int start, int end, byte[] dest, int destPos) {\n // this.subSequence(start, end).copyTo(dest, destPos) would allocate another Bytes object\n arraycopy(start, dest, destPos, end - start);\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}",
"public void deleteEmailAlias(String emailAliasID) {\n URL url = EMAIL_ALIAS_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID(), emailAliasID);\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"DELETE\");\n BoxAPIResponse response = request.send();\n response.disconnect();\n }",
"static void addHeaders(HttpUriRequest httpRequest, HttpHeaders headers) {\n\t\tfor (Map.Entry<String, List<String>> entry : headers.entrySet()) {\n\t\t\tString headerName = entry.getKey();\n\t\t\tif (HttpHeaders.COOKIE.equalsIgnoreCase(headerName)) { // RFC 6265\n\t\t\t\tString headerValue = StringUtils.collectionToDelimitedString(entry.getValue(), \"; \");\n\t\t\t\thttpRequest.addHeader(headerName, headerValue);\n\t\t\t}\n\t\t\telse if (!HTTP.CONTENT_LEN.equalsIgnoreCase(headerName) &&\n\t\t\t\t\t!HTTP.TRANSFER_ENCODING.equalsIgnoreCase(headerName)) {\n\t\t\t\tfor (String headerValue : entry.getValue()) {\n\t\t\t\t\thttpRequest.addHeader(headerName, headerValue);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"private static boolean isDpiSet(final Multimap<String, String> extraParams) {\n String searchKey = \"FORMAT_OPTIONS\";\n for (String key: extraParams.keys()) {\n if (key.equalsIgnoreCase(searchKey)) {\n for (String value: extraParams.get(key)) {\n if (value.toLowerCase().contains(\"dpi:\")) {\n return true;\n }\n }\n }\n }\n return false;\n }"
] |
Check for exceptions.
@return the list | [
"public final List<MtasSolrStatus> checkForExceptions() {\n List<MtasSolrStatus> statusWithException = null;\n for (MtasSolrStatus item : data) {\n if (item.checkResponseForException()) {\n if (statusWithException == null) {\n statusWithException = new ArrayList<>();\n }\n statusWithException.add(item);\n }\n }\n return statusWithException;\n }"
] | [
"public boolean uploadConfigurationAndProfile(String fileName, String odoImport) {\n File file = new File(fileName);\n MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();\n FileBody fileBody = new FileBody(file, ContentType.MULTIPART_FORM_DATA);\n multipartEntityBuilder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);\n multipartEntityBuilder.addPart(\"fileData\", fileBody);\n multipartEntityBuilder.addTextBody(\"odoImport\", odoImport);\n try {\n JSONObject response = new JSONObject(doMultipartPost(BASE_BACKUP_PROFILE + \"/\" + uriEncode(this._profileName) + \"/\" + this._clientId, multipartEntityBuilder));\n if (response.length() == 0) {\n return true;\n } else {\n return false;\n }\n } catch (Exception e) {\n return false;\n }\n }",
"public int indexOfKey(Object key) {\n return key == null ? indexOfNull() : indexOf(key, key.hashCode());\n }",
"public static void skip(InputStream stream, long skip) throws IOException\n {\n long count = skip;\n while (count > 0)\n {\n count -= stream.skip(count);\n }\n }",
"public static Processor<DataSourceTask> source(DataSource source, int parallelism, String description, UserConfig taskConf, ActorSystem system) {\n io.gearpump.streaming.Processor<DataSourceTask<Object, Object>> p =\n DataSourceProcessor.apply(source, parallelism, description, taskConf, system);\n return new Processor(p);\n }",
"public static sslvserver_sslcipher_binding[] get(nitro_service service, String vservername) throws Exception{\n\t\tsslvserver_sslcipher_binding obj = new sslvserver_sslcipher_binding();\n\t\tobj.set_vservername(vservername);\n\t\tsslvserver_sslcipher_binding response[] = (sslvserver_sslcipher_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"@SuppressWarnings(\"unchecked\")\n @Nonnull\n public final java.util.Optional<Style> getStyle(final String styleName) {\n final String styleRef = this.styles.get(styleName);\n Optional<Style> style;\n if (styleRef != null) {\n style = (Optional<Style>) this.styleParser\n .loadStyle(getConfiguration(), this.httpRequestFactory, styleRef);\n } else {\n style = Optional.empty();\n }\n return or(style, this.configuration.getStyle(styleName));\n }",
"public NRShape makeShape(Date from, Date to) {\n UnitNRShape fromShape = tree.toUnitShape(from);\n UnitNRShape toShape = tree.toUnitShape(to);\n return tree.toRangeShape(fromShape, toShape);\n }",
"private static Path resolveDockerDefinition(Path fullpath) {\n final Path ymlPath = fullpath.resolveSibling(fullpath.getFileName() + \".yml\");\n if (Files.exists(ymlPath)) {\n return ymlPath;\n } else {\n final Path yamlPath = fullpath.resolveSibling(fullpath.getFileName() + \".yaml\");\n if (Files.exists(yamlPath)) {\n return yamlPath;\n }\n }\n\n return null;\n }",
"public Equation process( String equation , boolean debug ) {\n compile(equation,true,debug).perform();\n return this;\n }"
] |
Specify the class represented by this `ClassNode` implements
an interface specified by the given name
@param name the name of the interface class
@return this `ClassNode` instance | [
"public ClassNode addInterface(String name) {\n ClassNode intf = infoBase.node(name);\n addInterface(intf);\n return this;\n }"
] | [
"public Iterator getReportQueryIteratorByQuery(Query query) throws PersistenceBrokerException\n {\n ClassDescriptor cld = getClassDescriptor(query.getSearchClass());\n return getReportQueryIteratorFromQuery(query, cld);\n }",
"protected Path createTempDirectory(String prefix) {\n try {\n return Files.createTempDirectory(tempDirectory, prefix);\n } catch (IOException e) {\n throw new AllureCommandException(e);\n }\n }",
"public List<Integer> getAsyncOperationList(boolean showCompleted) {\n /**\n * Create a copy using an immutable set to avoid a\n * {@link java.util.ConcurrentModificationException}\n */\n Set<Integer> keySet = ImmutableSet.copyOf(operations.keySet());\n\n if(showCompleted)\n return new ArrayList<Integer>(keySet);\n\n List<Integer> keyList = new ArrayList<Integer>();\n for(int key: keySet) {\n AsyncOperation operation = operations.get(key);\n if(operation != null && !operation.getStatus().isComplete())\n keyList.add(key);\n }\n return keyList;\n }",
"void killAll()\n {\n for (RjiRegistration reg : this.instancesById.values().toArray(new RjiRegistration[] {}))\n {\n reg.rji.handleInstruction(Instruction.KILL);\n }\n }",
"@SuppressWarnings(\"unchecked\")\n\tprivate void addParameters(Model model, HttpServletRequest request) {\n\t\tfor (Object objectEntry : request.getParameterMap().entrySet()) {\n\t\t\tMap.Entry<String, String[]> entry = (Map.Entry<String, String[]>) objectEntry;\n\t\t\tString key = entry.getKey();\n\t\t\tString[] values = entry.getValue();\n\t\t\tif (null != values && values.length > 0) {\n\t\t\t\tString value = values[0];\n\t\t\t\ttry {\n\t\t\t\t\tmodel.addAttribute(key, getParameter(key, value));\n\t\t\t\t} catch (ParseException pe) {\n\t\t\t\t\tlog.error(\"Could not parse parameter value {} for {}, ignoring parameter.\", key, value);\n\t\t\t\t} catch (NumberFormatException nfe) {\n\t\t\t\t\tlog.error(\"Could not parse parameter value {} for {}, ignoring parameter.\", key, value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"public void onDrawFrame(float frameTime)\n {\n if (!isEnabled() || (owner == null) || (getFloat(\"enabled\") <= 0.0f))\n {\n return;\n }\n float[] odir = getVec3(\"world_direction\");\n float[] opos = getVec3(\"world_position\");\n GVRSceneObject parent = owner;\n Matrix4f worldmtx = parent.getTransform().getModelMatrix4f();\n\n mOldDir.x = odir[0];\n mOldDir.y = odir[1];\n mOldDir.z = odir[2];\n mOldPos.x = opos[0];\n mOldPos.y = opos[1];\n mOldPos.z = opos[2];\n mNewDir.x = 0.0f;\n mNewDir.y = 0.0f;\n mNewDir.z = -1.0f;\n worldmtx.getTranslation(mNewPos);\n worldmtx.mul(mLightRot);\n worldmtx.transformDirection(mNewDir);\n if ((mOldDir.x != mNewDir.x) || (mOldDir.y != mNewDir.y) || (mOldDir.z != mNewDir.z))\n {\n setVec4(\"world_direction\", mNewDir.x, mNewDir.y, mNewDir.z, 0);\n }\n if ((mOldPos.x != mNewPos.x) || (mOldPos.y != mNewPos.y) || (mOldPos.z != mNewPos.z))\n {\n setPosition(mNewPos.x, mNewPos.y, mNewPos.z);\n }\n }",
"void update(Object feature) throws LayerException {\n\t\tSimpleFeatureSource source = getFeatureSource();\n\t\tif (source instanceof SimpleFeatureStore) {\n\t\t\tSimpleFeatureStore store = (SimpleFeatureStore) source;\n\t\t\tString featureId = getFeatureModel().getId(feature);\n\t\t\tFilter filter = filterService.createFidFilter(new String[] { featureId });\n\t\t\ttransactionSynchronization.synchTransaction(store);\n\t\t\tList<Name> names = new ArrayList<Name>();\n\t\t\tMap<String, Attribute> attrMap = getFeatureModel().getAttributes(feature);\n\t\t\tList<Object> values = new ArrayList<Object>();\n\t\t\tfor (Map.Entry<String, Attribute> entry : attrMap.entrySet()) {\n\t\t\t\tString name = entry.getKey();\n\t\t\t\tnames.add(store.getSchema().getDescriptor(name).getName());\n\t\t\t\tvalues.add(entry.getValue().getValue());\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tstore.modifyFeatures(names.toArray(new Name[names.size()]), values.toArray(), filter);\n\t\t\t\tstore.modifyFeatures(store.getSchema().getGeometryDescriptor().getName(), getFeatureModel()\n\t\t\t\t\t\t.getGeometry(feature), filter);\n\t\t\t\tlog.debug(\"Updated feature {} in {}\", featureId, getFeatureSourceName());\n\t\t\t} catch (IOException ioe) {\n\t\t\t\tfeatureModelUsable = false;\n\t\t\t\tthrow new LayerException(ioe, ExceptionCode.LAYER_MODEL_IO_EXCEPTION);\n\t\t\t}\n\t\t} else {\n\t\t\tlog.error(\"Don't know how to create or update \" + getFeatureSourceName() + \", class \"\n\t\t\t\t\t+ source.getClass().getName() + \" does not implement SimpleFeatureStore\");\n\t\t\tthrow new LayerException(ExceptionCode.CREATE_OR_UPDATE_NOT_IMPLEMENTED, getFeatureSourceName(), source\n\t\t\t\t\t.getClass().getName());\n\t\t}\n\t}",
"public static String find(CharSequence self, CharSequence regex, @ClosureParams(value=SimpleType.class, options=\"java.lang.String[]\") Closure closure) {\n return find(self.toString(), Pattern.compile(regex.toString()), closure);\n }",
"protected static void safeWriteErrorResponse(final Channel channel, final ManagementProtocolHeader header, final Throwable error) {\n if(header.getType() == ManagementProtocol.TYPE_REQUEST) {\n try {\n writeErrorResponse(channel, (ManagementRequestHeader) header, error);\n } catch(IOException ioe) {\n ProtocolLogger.ROOT_LOGGER.tracef(ioe, \"failed to write error response for %s on channel: %s\", header, channel);\n }\n }\n }"
] |
Constructs a valid request and passes it on to the next handler. It also
creates the 'StoreClient' object corresponding to the store name
specified in the REST request.
@param requestValidator The Validator object used to construct the
request object
@param ctx Context of the Netty channel
@param messageEvent Message Event used to write the response / exception | [
"@Override\n protected void registerRequest(RestRequestValidator requestValidator,\n ChannelHandlerContext ctx,\n MessageEvent messageEvent) {\n\n // At this point we know the request is valid and we have a\n // error handler. So we construct the composite Voldemort\n // request object.\n CompositeVoldemortRequest<ByteArray, byte[]> requestObject = requestValidator.constructCompositeVoldemortRequestObject();\n\n if(requestObject != null) {\n\n DynamicTimeoutStoreClient<ByteArray, byte[]> storeClient = null;\n\n if(!requestValidator.getStoreName().equalsIgnoreCase(RestMessageHeaders.SCHEMATA_STORE)) {\n\n storeClient = this.fatClientMap.get(requestValidator.getStoreName());\n if(storeClient == null) {\n logger.error(\"Error when getting store. Non Existing store client.\");\n RestErrorHandler.writeErrorResponse(messageEvent,\n HttpResponseStatus.BAD_REQUEST,\n \"Non Existing store client. Critical error.\");\n return;\n }\n } else {\n requestObject.setOperationType(VoldemortOpCode.GET_METADATA_OP_CODE);\n }\n\n CoordinatorStoreClientRequest coordinatorRequest = new CoordinatorStoreClientRequest(requestObject,\n storeClient);\n Channels.fireMessageReceived(ctx, coordinatorRequest);\n\n }\n }"
] | [
"public static LinearSolverDense<DMatrixRMaj> general(int numRows , int numCols ) {\n if( numRows == numCols )\n return linear(numRows);\n else\n return leastSquares(numRows,numCols);\n }",
"public static base_responses update(nitro_service client, bridgetable resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tbridgetable updateresources[] = new bridgetable[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tupdateresources[i] = new bridgetable();\n\t\t\t\tupdateresources[i].bridgeage = resources[i].bridgeage;\n\t\t\t}\n\t\t\tresult = update_bulk_request(client, updateresources);\n\t\t}\n\t\treturn result;\n\t}",
"public static Object xmlToObject(String fileName) throws FileNotFoundException {\r\n\t\tFileInputStream fi = new FileInputStream(fileName);\r\n\t\tXMLDecoder decoder = new XMLDecoder(fi);\r\n\t\tObject object = decoder.readObject();\r\n\t\tdecoder.close();\r\n\t\treturn object;\r\n\t}",
"public static String roundCorner(int radiusInner, int radiusOuter, int color) {\n if (radiusInner < 1) {\n throw new IllegalArgumentException(\"Radius must be greater than zero.\");\n }\n if (radiusOuter < 0) {\n throw new IllegalArgumentException(\"Outer radius must be greater than or equal to zero.\");\n }\n StringBuilder builder = new StringBuilder(FILTER_ROUND_CORNER).append(\"(\").append(radiusInner);\n if (radiusOuter > 0) {\n builder.append(\"|\").append(radiusOuter);\n }\n final int r = (color & 0xFF0000) >>> 16;\n final int g = (color & 0xFF00) >>> 8;\n final int b = color & 0xFF;\n return builder.append(\",\") //\n .append(r).append(\",\") //\n .append(g).append(\",\") //\n .append(b).append(\")\") //\n .toString();\n }",
"public void addModuleDir(final String moduleDir) {\n if (moduleDir == null) {\n throw LauncherMessages.MESSAGES.nullParam(\"moduleDir\");\n }\n // Validate the path\n final Path path = Paths.get(moduleDir).normalize();\n modulesDirs.add(path.toString());\n }",
"public static float calcDet(Vector3 a ,Vector3 b, Vector3 c) {\n\t\treturn (a.x*(b.y-c.y)) - (a.y*(b.x-c.x)) + (b.x*c.y-b.y*c.x);\n\t}",
"public static String get(String language) {\n language = language.toLowerCase();\n if(\"ecmascript\".equals(language)) {\n language = \"javascript\";\n }\n\n String extension = extensions.get(language);\n if(extension == null) {\n return null;\n\n } else {\n return loadScriptEnv(language, extension);\n\n }\n }",
"public CancelIndicator newCancelIndicator(final ResourceSet rs) {\n CancelIndicator _xifexpression = null;\n if ((rs instanceof XtextResourceSet)) {\n final boolean cancelationAllowed = (this.cancelationAllowed.get()).booleanValue();\n final int current = ((XtextResourceSet)rs).getModificationStamp();\n final CancelIndicator _function = () -> {\n return (cancelationAllowed && (((XtextResourceSet)rs).isOutdated() || (current != ((XtextResourceSet)rs).getModificationStamp())));\n };\n return _function;\n } else {\n _xifexpression = CancelIndicator.NullImpl;\n }\n return _xifexpression;\n }",
"public T addFile(final String name, final List<String> path, final byte[] newHash, final boolean isDirectory) {\n return addFile(name, path, newHash, isDirectory, null);\n }"
] |
Saves the loaded XML bundle as property bundle.
@throws UnsupportedEncodingException thrown if localizations from the XML bundle could not be loaded correctly.
@throws CmsException thrown if any of the interactions with the VFS fails.
@throws IOException thrown if localizations from the XML bundle could not be loaded correctly. | [
"public void saveAsPropertyBundle() throws UnsupportedEncodingException, CmsException, IOException {\n\n switch (m_bundleType) {\n case XML:\n saveLocalization();\n loadAllRemainingLocalizations();\n createPropertyVfsBundleFiles();\n saveToPropertyVfsBundle();\n m_bundleType = BundleType.PROPERTY;\n removeXmlBundleFile();\n\n break;\n default:\n throw new IllegalArgumentException(\n \"The method should only be called when editing an XMLResourceBundle.\");\n }\n\n }"
] | [
"private Collection parseCollection(Element collectionElement) {\n\n Collection collection = new Collection();\n collection.setId(collectionElement.getAttribute(\"id\"));\n collection.setServer(collectionElement.getAttribute(\"server\"));\n collection.setSecret(collectionElement.getAttribute(\"secret\"));\n collection.setChildCount(collectionElement.getAttribute(\"child_count\"));\n collection.setIconLarge(collectionElement.getAttribute(\"iconlarge\"));\n collection.setIconSmall(collectionElement.getAttribute(\"iconsmall\"));\n collection.setDateCreated(collectionElement.getAttribute(\"datecreate\"));\n collection.setTitle(XMLUtilities.getChildValue(collectionElement, \"title\"));\n collection.setDescription(XMLUtilities.getChildValue(collectionElement, \"description\"));\n\n Element iconPhotos = XMLUtilities.getChild(collectionElement, \"iconphotos\");\n if (iconPhotos != null) {\n NodeList photoElements = iconPhotos.getElementsByTagName(\"photo\");\n for (int i = 0; i < photoElements.getLength(); i++) {\n Element photoElement = (Element) photoElements.item(i);\n collection.addPhoto(PhotoUtils.createPhoto(photoElement));\n }\n }\n\n return collection;\n }",
"private void addModuleToTree(final DbModule module, final TreeNode tree) {\n final TreeNode subTree = new TreeNode();\n subTree.setName(module.getName());\n tree.addChild(subTree);\n\n // Add SubsubModules\n for (final DbModule subsubmodule : module.getSubmodules()) {\n addModuleToTree(subsubmodule, subTree);\n }\n }",
"@SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n\tprivate IntegrationFlowBuilder getFlowBuilder() {\n\n\t\tIntegrationFlowBuilder flowBuilder;\n\t\tURLName urlName = this.properties.getUrl();\n\n\t\tif (this.properties.isIdleImap()) {\n\t\t\tflowBuilder = getIdleImapFlow(urlName);\n\t\t}\n\t\telse {\n\n\t\t\tMailInboundChannelAdapterSpec adapterSpec;\n\t\t\tswitch (urlName.getProtocol().toUpperCase()) {\n\t\t\t\tcase \"IMAP\":\n\t\t\t\tcase \"IMAPS\":\n\t\t\t\t\tadapterSpec = getImapFlowBuilder(urlName);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"POP3\":\n\t\t\t\tcase \"POP3S\":\n\t\t\t\t\tadapterSpec = getPop3FlowBuilder(urlName);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\t\"Unsupported mail protocol: \" + urlName.getProtocol());\n\t\t\t}\n\t\t\tflowBuilder = IntegrationFlows.from(\n\t\t\t\t\tadapterSpec.javaMailProperties(getJavaMailProperties(urlName))\n\t\t\t\t\t\t\t.selectorExpression(this.properties.getExpression())\n\t\t\t\t\t\t\t.shouldDeleteMessages(this.properties.isDelete()),\n\t\t\t\t\tnew Consumer<SourcePollingChannelAdapterSpec>() {\n\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic void accept(\n\t\t\t\t\t\t\t\tSourcePollingChannelAdapterSpec sourcePollingChannelAdapterSpec) {\n\t\t\t\t\t\t\tsourcePollingChannelAdapterSpec.poller(MailSourceConfiguration.this.defaultPoller);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t});\n\n\t\t}\n\t\treturn flowBuilder;\n\t}",
"public void close() throws IOException {\n final ManagedBinding binding = this.socketBindingManager.getNamedRegistry().getManagedBinding(this.name);\n if (binding == null) {\n return;\n }\n binding.close();\n }",
"public static Operation createDeployOperation(final DeploymentDescription deployment) {\n Assert.checkNotNullParam(\"deployment\", deployment);\n final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true);\n addDeployOperationStep(builder, deployment);\n return builder.build();\n }",
"public static Trajectory getTrajectoryByID(List<? extends Trajectory> t, int id){\n\t\tTrajectory track = null;\n\t\tfor(int i = 0; i < t.size() ; i++){\n\t\t\tif(t.get(i).getID()==id){\n\t\t\t\ttrack = t.get(i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn track;\n\t}",
"@Inline(value = \"$1.put($2.getKey(), $2.getValue())\", statementExpression = true)\n\tpublic static <K, V> V operator_add(Map<K, V> map, Pair<? extends K, ? extends V> entry) {\n\t\treturn map.put(entry.getKey(), entry.getValue());\n\t}",
"public synchronized void stop() {\n if (isRunning()) {\n socket.get().close();\n socket.set(null);\n deliverLifecycleAnnouncement(logger, false);\n }\n }",
"public FailureDetectorConfig setCluster(Cluster cluster) {\n Utils.notNull(cluster);\n this.cluster = cluster;\n /*\n * FIXME: this is the hacky way to refresh the admin connection\n * verifier, but it'll just work. The clean way to do so is to have a\n * centralized metadata management, and all references of cluster object\n * point to that.\n */\n if(this.connectionVerifier instanceof AdminConnectionVerifier) {\n ((AdminConnectionVerifier) connectionVerifier).setCluster(cluster);\n }\n return this;\n }"
] |
Sets in-place the right child with the same first byte.
@param b next byte of child suffix.
@param child child node. | [
"void setRightChild(final byte b, @NotNull final MutableNode child) {\n final ChildReference right = children.getRight();\n if (right == null || (right.firstByte & 0xff) != (b & 0xff)) {\n throw new IllegalArgumentException();\n }\n children.setAt(children.size() - 1, new ChildReferenceMutable(b, child));\n }"
] | [
"public List<Module> getModules(final Map<String, String> filters) throws GrapesCommunicationException {\n final Client client = getClient();\n WebResource resource = client.resource(serverURL).path(RequestUtils.getAllModulesPath());\n for(final Map.Entry<String,String> queryParam: filters.entrySet()){\n resource = resource.queryParam(queryParam.getKey(), queryParam.getValue());\n }\n\n final ClientResponse response = resource.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 filtered modules.\";\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(new GenericType<List<Module>>(){});\n }",
"private int getDaysToNextMatch(WeekDay weekDay) {\n\n for (WeekDay wd : m_weekDays) {\n if (wd.compareTo(weekDay) > 0) {\n return wd.toInt() - weekDay.toInt();\n }\n }\n return (m_weekDays.iterator().next().toInt() + (m_interval * I_CmsSerialDateValue.NUM_OF_WEEKDAYS))\n - weekDay.toInt();\n }",
"private void readZookeeperConfig() {\n\n try (CuratorFramework curator = CuratorUtil.newAppCurator(config)) {\n curator.start();\n\n accumuloInstance =\n new String(curator.getData().forPath(ZookeeperPath.CONFIG_ACCUMULO_INSTANCE_NAME),\n StandardCharsets.UTF_8);\n accumuloInstanceID =\n new String(curator.getData().forPath(ZookeeperPath.CONFIG_ACCUMULO_INSTANCE_ID),\n StandardCharsets.UTF_8);\n fluoApplicationID =\n new String(curator.getData().forPath(ZookeeperPath.CONFIG_FLUO_APPLICATION_ID),\n StandardCharsets.UTF_8);\n\n table = new String(curator.getData().forPath(ZookeeperPath.CONFIG_ACCUMULO_TABLE),\n StandardCharsets.UTF_8);\n\n observers = ObserverUtil.load(curator);\n\n config = FluoAdminImpl.mergeZookeeperConfig(config);\n\n // make sure not to include config passed to env, only want config from zookeeper\n appConfig = config.getAppConfiguration();\n } catch (Exception e) {\n throw new IllegalStateException(e);\n }\n }",
"private void cleanStaleFiles(File backupDir, AsyncOperationStatus status) {\n String[] filesInEnv = env.getHome().list();\n String[] filesInBackupDir = backupDir.list();\n if(filesInEnv != null && filesInBackupDir != null) {\n HashSet<String> envFileSet = new HashSet<String>();\n for(String file: filesInEnv)\n envFileSet.add(file);\n // delete all files in backup which are currently not in environment\n for(String file: filesInBackupDir) {\n if(file.endsWith(BDB_EXT) && !envFileSet.contains(file)) {\n status.setStatus(\"Deleting stale jdb file :\" + file);\n File staleJdbFile = new File(backupDir, file);\n staleJdbFile.delete();\n }\n }\n }\n }",
"public static String encodeUrlIso(String stringToEncode) {\n try {\n return URLEncoder.encode(stringToEncode, \"ISO-8859-1\");\n } catch (UnsupportedEncodingException e1) {\n throw new RuntimeException(e1);\n }\n }",
"private String getResourceType(Resource resource)\n {\n String result;\n net.sf.mpxj.ResourceType type = resource.getType();\n if (type == null)\n {\n type = net.sf.mpxj.ResourceType.WORK;\n }\n\n switch (type)\n {\n case MATERIAL:\n {\n result = \"Material\";\n break;\n }\n\n case COST:\n {\n result = \"Nonlabor\";\n break;\n }\n\n default:\n {\n result = \"Labor\";\n break;\n }\n }\n\n return result;\n }",
"public void clearRequestSettings(int pathId, String clientUUID) throws Exception {\n this.setRequestEnabled(pathId, false, clientUUID);\n OverrideService.getInstance().disableAllOverrides(pathId, clientUUID, Constants.OVERRIDE_TYPE_REQUEST);\n EditService.getInstance().updateRepeatNumber(Constants.OVERRIDE_TYPE_REQUEST, pathId, clientUUID);\n }",
"public static <T> int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig)\n\t\t\tthrows SQLException {\n\t\tDao<T, ?> dao = DaoManager.createDao(connectionSource, tableConfig);\n\t\treturn doCreateTable(dao, false);\n\t}",
"public static String formatDateTime(Context context, ReadablePartial time, int flags) {\n return android.text.format.DateUtils.formatDateTime(context, toMillis(time), flags | FORMAT_UTC);\n }"
] |
Adds title and subtitle to the TitleBand when it applies.
If title is not present then subtitle will be ignored | [
"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}"
] | [
"public void startScenario( Class<?> testClass, Method method, List<NamedArgument> arguments ) {\n listener.scenarioStarted( testClass, method, arguments );\n\n if( method.isAnnotationPresent( Pending.class ) ) {\n Pending annotation = method.getAnnotation( Pending.class );\n\n if( annotation.failIfPass() ) {\n failIfPass();\n } else if( !annotation.executeSteps() ) {\n methodInterceptor.disableMethodExecution();\n executeLifeCycleMethods = false;\n }\n suppressExceptions = true;\n } else if( method.isAnnotationPresent( NotImplementedYet.class ) ) {\n NotImplementedYet annotation = method.getAnnotation( NotImplementedYet.class );\n\n if( annotation.failIfPass() ) {\n failIfPass();\n } else if( !annotation.executeSteps() ) {\n methodInterceptor.disableMethodExecution();\n executeLifeCycleMethods = false;\n }\n suppressExceptions = true;\n }\n\n }",
"private boolean isRelated(Task task, List<Relation> list)\n {\n boolean result = false;\n for (Relation relation : list)\n {\n if (relation.getTargetTask().getUniqueID().intValue() == task.getUniqueID().intValue())\n {\n result = true;\n break;\n }\n }\n return result;\n }",
"public static void changeSign(DMatrixSparseCSC A , DMatrixSparseCSC B ) {\n if( A != B ) {\n B.copyStructure(A);\n }\n\n for (int i = 0; i < A.nz_length; i++) {\n B.nz_values[i] = -A.nz_values[i];\n }\n }",
"@Override\r\n public void processOutput(Map<String, String> resultsMap) {\r\n queue.add(resultsMap);\n\r\n if (queue.size() > 10000) {\r\n log.info(\"Queue size \" + queue.size() + \", waiting\");\r\n try {\r\n Thread.sleep(500);\r\n } catch (InterruptedException ex) {\r\n log.info(\"Interrupted \", ex);\r\n }\r\n }\r\n }",
"private void removeObsoleteElements(List<String> names,\n Map<String, View> sharedElements,\n List<String> elementsToRemove) {\n if (elementsToRemove.size() > 0) {\n names.removeAll(elementsToRemove);\n for (String elementToRemove : elementsToRemove) {\n sharedElements.remove(elementToRemove);\n }\n }\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 }",
"private void addCheckBox(final String internalValue, String labelMessageKey) {\r\n\r\n CmsCheckBox box = new CmsCheckBox(Messages.get().key(labelMessageKey));\r\n box.setInternalValue(internalValue);\r\n box.addValueChangeHandler(new ValueChangeHandler<Boolean>() {\r\n\r\n public void onValueChange(ValueChangeEvent<Boolean> event) {\r\n\r\n if (handleChange()) {\r\n m_controller.weeksChange(internalValue, event.getValue());\r\n }\r\n }\r\n });\r\n m_weekPanel.add(box);\r\n m_checkboxes.add(box);\r\n\r\n }",
"public FastReportBuilder addBarcodeColumn(String title, String property,String className, int barcodeType,boolean showText, int width, boolean fixedWidth,ImageScaleMode imageScaleMode, Style style) throws ColumnBuilderException, ClassNotFoundException {\n\t\tAbstractColumn column = ColumnBuilder.getNew()\n\t\t.setColumnProperty(property, className)\n\t\t.setWidth(width)\n\t\t.setTitle(title)\n\t\t.setFixedWidth(fixedWidth)\n\t\t.setColumnType(ColumnBuilder.COLUMN_TYPE_BARCODE)\n\t\t.setStyle(style)\n\t\t.setBarcodeType(barcodeType)\n\t\t.setShowText(showText)\n\t\t.build();\n\n\t\tif (style == null)\n\t\t\tguessStyle(className, column);\n\n\t\taddColumn(column);\n\n\t\treturn this;\n\t}",
"protected String colorString(PDColor pdcolor)\n {\n String color = null;\n try\n {\n float[] rgb = pdcolor.getColorSpace().toRGB(pdcolor.getComponents());\n color = colorString(rgb[0], rgb[1], rgb[2]);\n } catch (IOException e) {\n log.error(\"colorString: IOException: {}\", e.getMessage());\n } catch (UnsupportedOperationException e) {\n log.error(\"colorString: UnsupportedOperationException: {}\", e.getMessage());\n }\n return color;\n }"
] |
Returns the plugins classpath elements. | [
"protected List<String> getPluginsPath() throws IOException {\n List<String> result = new ArrayList<>();\n Path pluginsDirectory = PROPERTIES.getAllureHome().resolve(\"plugins\").toAbsolutePath();\n if (Files.notExists(pluginsDirectory)) {\n return Collections.emptyList();\n }\n\n try (DirectoryStream<Path> plugins = Files.newDirectoryStream(pluginsDirectory, JAR_FILES)) {\n for (Path plugin : plugins) {\n result.add(plugin.toUri().toURL().toString());\n }\n }\n return result;\n }"
] | [
"public BlurBuilder downScale(int scaleInSample) {\n data.options.inSampleSize = Math.min(Math.max(1, scaleInSample), 16384);\n return this;\n }",
"public static rnatip_stats[] get(nitro_service service, options option) throws Exception{\n\t\trnatip_stats obj = new rnatip_stats();\n\t\trnatip_stats[] response = (rnatip_stats[])obj.stat_resources(service,option);\n\t\treturn response;\n\t}",
"public void updateAnimation()\n {\n Date time = new Date();\n long currentTime = time.getTime() - this.beginAnimation;\n if (currentTime > animationTime)\n {\n this.currentQuaternion.set(endQuaternion);\n for (int i = 0; i < 3; i++)\n {\n\n this.currentPos[i] = this.endPos[i];\n }\n this.animate = false;\n }\n\n else\n {\n float t = (float) currentTime / animationTime;\n this.currentQuaternion = this.beginQuaternion.slerp(this.endQuaternion,\n t);\n for (int i = 0; i < 3; i++)\n {\n this.currentPos[i] = this.beginPos[i] + totalTranslation[i] * t;\n }\n\n }\n }",
"public static appfwjsoncontenttype[] get(nitro_service service, String jsoncontenttypevalue[]) throws Exception{\n\t\tif (jsoncontenttypevalue !=null && jsoncontenttypevalue.length>0) {\n\t\t\tappfwjsoncontenttype response[] = new appfwjsoncontenttype[jsoncontenttypevalue.length];\n\t\t\tappfwjsoncontenttype obj[] = new appfwjsoncontenttype[jsoncontenttypevalue.length];\n\t\t\tfor (int i=0;i<jsoncontenttypevalue.length;i++) {\n\t\t\t\tobj[i] = new appfwjsoncontenttype();\n\t\t\t\tobj[i].set_jsoncontenttypevalue(jsoncontenttypevalue[i]);\n\t\t\t\tresponse[i] = (appfwjsoncontenttype) obj[i].get_resource(service);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t\treturn null;\n\t}",
"private String listToCSV(List<String> list) {\n String csvStr = \"\";\n for (String item : list) {\n csvStr += \",\" + item;\n }\n\n return csvStr.length() > 1 ? csvStr.substring(1) : csvStr;\n }",
"public final int toCodePoints(char[] src, int srcOff, int srcLen, int[] dest, int destOff) {\n if (srcLen < 0) {\n throw new IllegalArgumentException(\"srcLen must be >= 0\");\n }\n int codePointCount = 0;\n for (int i = 0; i < srcLen; ) {\n final int cp = codePointAt(src, srcOff + i, srcOff + srcLen);\n final int charCount = Character.charCount(cp);\n dest[destOff + codePointCount++] = cp;\n i += charCount;\n }\n return codePointCount;\n }",
"public static Deployment of(final URL url) {\n final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam(\"url\", url));\n return new Deployment(deploymentContent, null);\n }",
"public void reportCompletion(NodeT completed) {\n completed.setPreparer(true);\n String dependency = completed.key();\n for (String dependentKey : nodeTable.get(dependency).dependentKeys()) {\n DAGNode<DataT, NodeT> dependent = nodeTable.get(dependentKey);\n dependent.lock().lock();\n try {\n dependent.onSuccessfulResolution(dependency);\n if (dependent.hasAllResolved()) {\n queue.add(dependent.key());\n }\n } finally {\n dependent.lock().unlock();\n }\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 }"
] |
Create a classname from a given path
@param path
@return | [
"private String getClassNameFromPath(String path) {\n String className = path.replace(\".class\", \"\");\n\n // for *nix\n if (className.startsWith(\"/\")) {\n className = className.substring(1, className.length());\n }\n className = className.replace(\"/\", \".\");\n\n // for windows\n if (className.startsWith(\"\\\\\")) {\n className = className.substring(1, className.length());\n }\n className = className.replace(\"\\\\\", \".\");\n\n return className;\n }"
] | [
"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 void deleteStoreDefinition(String storeName) {\n // acquire write lock\n writeLock.lock();\n\n try {\n // Check if store exists\n if(!this.storeNames.contains(storeName)) {\n throw new VoldemortException(\"Requested store to be deleted does not exist !\");\n }\n\n // Otherwise remove from the STORES directory. Note: The version\n // argument is not required here since the\n // ConfigurationStorageEngine simply ignores this.\n this.storeDefinitionsStorageEngine.delete(storeName, null);\n\n // Update the metadata cache\n this.metadataCache.remove(storeName);\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 } finally {\n writeLock.unlock();\n }\n }",
"public static String getParentId(String digest, String host) throws IOException {\n DockerClient dockerClient = null;\n try {\n dockerClient = getDockerClient(host);\n return dockerClient.inspectImageCmd(digest).exec().getParent();\n } finally {\n closeQuietly(dockerClient);\n }\n }",
"public Set<PlaybackState> getPlaybackState() {\n Set<PlaybackState> result = new HashSet<PlaybackState>(playbackStateMap.values());\n return Collections.unmodifiableSet(result);\n }",
"public static Timespan create(Timespan... timespans) {\n if (timespans == null) {\n return null;\n }\n\n if (timespans.length == 0) {\n return ZERO_MILLISECONDS;\n }\n\n Timespan res = timespans[0];\n\n for (int i = 1; i < timespans.length; i++) {\n Timespan timespan = timespans[i];\n res = res.add(timespan);\n }\n\n return res;\n }",
"public void addExportedPackages(String... exportedPackages) {\n\t\tString oldBundles = mainAttributes.get(EXPORT_PACKAGE);\n\t\tif (oldBundles == null)\n\t\t\toldBundles = \"\";\n\t\tBundleList oldResultList = BundleList.fromInput(oldBundles, newline);\n\t\tBundleList resultList = BundleList.fromInput(oldBundles, newline);\n\t\tfor (String bundle : exportedPackages)\n\t\t\tresultList.mergeInto(Bundle.fromInput(bundle));\n\t\tString result = resultList.toString();\n\t\tboolean changed = !oldResultList.toString().equals(result);\n\t\tmodified |= changed;\n\t\tif (changed)\n\t\t\tmainAttributes.put(EXPORT_PACKAGE, result);\n\t}",
"public static CrashReport fromJson(String json) throws IllegalArgumentException {\n try {\n return new CrashReport(json);\n } catch (JSONException je) {\n throw new IllegalArgumentException(je.toString());\n }\n }",
"public static int queryForInt(Statement stmt, String sql, int nullvalue) {\n try {\n ResultSet rs = stmt.executeQuery(sql);\n try {\n if (!rs.next())\n return nullvalue;\n \n return rs.getInt(1);\n } finally {\n rs.close();\n }\n } catch (SQLException e) {\n throw new DukeException(e);\n }\n }",
"private int findIndexForName(String[] fieldNames, String searchName)\r\n {\r\n for(int i = 0; i < fieldNames.length; i++)\r\n {\r\n if(searchName.equals(fieldNames[i]))\r\n {\r\n return i;\r\n }\r\n }\r\n throw new PersistenceBrokerException(\"Can't find field name '\" + searchName +\r\n \"' in given array of field names\");\r\n }"
] |
Scales the weights of this crfclassifier by the specified weight
@param scale | [
"public void scaleWeights(double scale) {\r\n for (int i = 0; i < weights.length; i++) {\r\n for (int j = 0; j < weights[i].length; j++) {\r\n weights[i][j] *= scale;\r\n }\r\n }\r\n }"
] | [
"protected boolean hasVectorClock(boolean isVectorClockOptional) {\n boolean result = false;\n\n String vectorClockHeader = this.request.getHeader(RestMessageHeaders.X_VOLD_VECTOR_CLOCK);\n if(vectorClockHeader != null) {\n ObjectMapper mapper = new ObjectMapper();\n try {\n VectorClockWrapper vcWrapper = mapper.readValue(vectorClockHeader,\n VectorClockWrapper.class);\n this.parsedVectorClock = new VectorClock(vcWrapper.getVersions(),\n vcWrapper.getTimestamp());\n result = true;\n } catch(Exception e) {\n logger.error(\"Exception while parsing and constructing vector clock\", e);\n RestErrorHandler.writeErrorResponse(this.messageEvent,\n HttpResponseStatus.BAD_REQUEST,\n \"Invalid Vector Clock\");\n }\n } else if(!isVectorClockOptional) {\n logger.error(\"Error when validating request. Missing Vector Clock\");\n RestErrorHandler.writeErrorResponse(this.messageEvent,\n HttpResponseStatus.BAD_REQUEST,\n \"Missing Vector Clock\");\n } else {\n result = true;\n }\n\n return result;\n }",
"public DiscreteInterval minus(DiscreteInterval other) {\n return new DiscreteInterval(this.min - other.max, this.max - other.min);\n }",
"public Replication queryParams(Map<String, Object> queryParams) {\r\n this.replication = replication.queryParams(queryParams);\r\n return this;\r\n }",
"public static final Date getTime(byte[] data, int offset)\n {\n int time = getShort(data, offset) / 10;\n Calendar cal = DateHelper.popCalendar(EPOCH_DATE);\n cal.set(Calendar.HOUR_OF_DAY, (time / 60));\n cal.set(Calendar.MINUTE, (time % 60));\n cal.set(Calendar.SECOND, 0);\n cal.set(Calendar.MILLISECOND, 0);\n DateHelper.pushCalendar(cal);\n return (cal.getTime());\n }",
"String encodePath(String in) {\n try {\n String encodedString = HierarchicalUriComponents.encodeUriComponent(in, \"UTF-8\",\n HierarchicalUriComponents.Type.PATH_SEGMENT);\n if (encodedString.startsWith(_design_prefix_encoded) ||\n encodedString.startsWith(_local_prefix_encoded)) {\n // we replaced the first slash in the design or local doc URL, which we shouldn't\n // so let's put it back\n return encodedString.replaceFirst(\"%2F\", \"/\");\n } else {\n return encodedString;\n }\n } catch (UnsupportedEncodingException uee) {\n // This should never happen as every implementation of the java platform is required\n // to support UTF-8.\n throw new RuntimeException(\n \"Couldn't encode ID \" + in,\n uee);\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 }",
"private static void flushCurrentWord( StringBuilder currentWords, List<Word> formattedWords, boolean cutWhitespace ) {\n if( currentWords.length() > 0 ) {\n if( cutWhitespace && currentWords.charAt( currentWords.length() - 1 ) == ' ' ) {\n currentWords.setLength( currentWords.length() - 1 );\n }\n formattedWords.add( new Word( currentWords.toString() ) );\n currentWords.setLength( 0 );\n }\n }",
"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 }",
"private ChildTaskContainer getParentTask(Activity activity)\n {\n //\n // Make a map of activity codes and their values for this activity\n //\n Map<UUID, UUID> map = getActivityCodes(activity);\n\n //\n // Work through the activity codes in sequence\n //\n ChildTaskContainer parent = m_projectFile;\n StringBuilder uniqueIdentifier = new StringBuilder();\n for (UUID activityCode : m_codeSequence)\n {\n UUID activityCodeValue = map.get(activityCode);\n String activityCodeText = m_activityCodeValues.get(activityCodeValue);\n if (activityCodeText != null)\n {\n if (uniqueIdentifier.length() != 0)\n {\n uniqueIdentifier.append('>');\n }\n uniqueIdentifier.append(activityCodeValue.toString());\n UUID uuid = UUID.nameUUIDFromBytes(uniqueIdentifier.toString().getBytes());\n Task newParent = findChildTaskByUUID(parent, uuid);\n if (newParent == null)\n {\n newParent = parent.addTask();\n newParent.setGUID(uuid);\n newParent.setName(activityCodeText);\n }\n parent = newParent;\n }\n }\n return parent;\n }"
] |
Extract predecessor data. | [
"private void processPredecessors()\n {\n for (Map.Entry<Task, List<MapRow>> entry : m_predecessorMap.entrySet())\n {\n Task task = entry.getKey();\n List<MapRow> predecessors = entry.getValue();\n for (MapRow predecessor : predecessors)\n {\n processPredecessor(task, predecessor);\n }\n }\n }"
] | [
"public final void setWeeksOfMonth(SortedSet<WeekOfMonth> weeksOfMonth) {\n\n m_weeksOfMonth.clear();\n if (null != weeksOfMonth) {\n m_weeksOfMonth.addAll(weeksOfMonth);\n }\n\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 setBREE(String bree) {\n\t\tString old = mainAttributes.get(BUNDLE_REQUIREDEXECUTIONENVIRONMENT);\n\t\tif (!bree.equals(old)) {\n\t\t\tthis.mainAttributes.put(BUNDLE_REQUIREDEXECUTIONENVIRONMENT, bree);\n\t\t\tthis.modified = true;\n\t\t\tthis.bree = bree;\n\t\t}\n\t}",
"public static Deployment of(final Path content) {\n final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam(\"content\", content));\n return new Deployment(deploymentContent, null);\n }",
"public static String stringifyJavascriptObject(Object object) {\n StringBuilder bld = new StringBuilder();\n stringify(object, bld);\n return bld.toString();\n }",
"private void populateSortedCustomFieldsList ()\n {\n m_sortedCustomFieldsList = new ArrayList<CustomField>();\n for (CustomField field : m_projectFile.getCustomFields())\n {\n FieldType fieldType = field.getFieldType();\n if (fieldType != null)\n {\n m_sortedCustomFieldsList.add(field);\n }\n }\n\n // Sort to ensure consistent order in file\n Collections.sort(m_sortedCustomFieldsList, new Comparator<CustomField>()\n {\n @Override public int compare(CustomField customField1, CustomField customField2)\n {\n FieldType o1 = customField1.getFieldType();\n FieldType o2 = customField2.getFieldType();\n String name1 = o1.getClass().getSimpleName() + \".\" + o1.getName() + \" \" + customField1.getAlias();\n String name2 = o2.getClass().getSimpleName() + \".\" + o2.getName() + \" \" + customField2.getAlias();\n return name1.compareTo(name2);\n }\n });\n }",
"public CollectionRequest<Team> findByUser(String user) {\n \n String path = String.format(\"/users/%s/teams\", user);\n return new CollectionRequest<Team>(this, Team.class, path, \"GET\");\n }",
"public TokenList extractSubList( Token begin , Token end ) {\n if( begin == end ) {\n remove(begin);\n return new TokenList(begin,begin);\n } else {\n if( first == begin ) {\n first = end.next;\n }\n if( last == end ) {\n last = begin.previous;\n }\n if( begin.previous != null ) {\n begin.previous.next = end.next;\n }\n if( end.next != null ) {\n end.next.previous = begin.previous;\n }\n begin.previous = null;\n end.next = null;\n\n TokenList ret = new TokenList(begin,end);\n size -= ret.size();\n return ret;\n }\n }",
"public static void objectToXML(Object object, String fileName) throws FileNotFoundException {\r\n\t\tFileOutputStream fo = new FileOutputStream(fileName);\r\n\t\tXMLEncoder encoder = new XMLEncoder(fo);\r\n\t\tencoder.writeObject(object);\r\n\t\tencoder.close();\r\n\t}"
] |
An extremely simple method for identifying multimedia. This
could be improved, but it's good enough for this example.
@param file which could be an image or a video
@return true if the file can be previewed, false otherwise | [
"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 }"
] | [
"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 void addCell(TableLayoutCell cell) {\n GridBagConstraints constraints = cell.getConstraints();\n constraints.insets = new Insets(cellpadding, cellpadding, cellpadding, cellpadding);\n add(cell.getComponent(), constraints);\n }",
"private boolean isSecuredByPolicy(Server server) {\n boolean isSecured = false;\n\n EndpointInfo ei = server.getEndpoint().getEndpointInfo();\n\n PolicyEngine pe = bus.getExtension(PolicyEngine.class);\n if (null == pe) {\n LOG.finest(\"No Policy engine found\");\n return isSecured;\n }\n\n Destination destination = server.getDestination();\n EndpointPolicy ep = pe.getServerEndpointPolicy(ei, destination, null);\n Collection<Assertion> assertions = ep.getChosenAlternative();\n for (Assertion a : assertions) {\n if (a instanceof TransportBinding) {\n TransportBinding tb = (TransportBinding) a;\n TransportToken tt = tb.getTransportToken();\n AbstractToken t = tt.getToken();\n if (t instanceof HttpsToken) {\n isSecured = true;\n break;\n }\n }\n }\n\n Policy policy = ep.getPolicy();\n List<PolicyComponent> pcList = policy.getPolicyComponents();\n for (PolicyComponent a : pcList) {\n if (a instanceof TransportBinding) {\n TransportBinding tb = (TransportBinding) a;\n TransportToken tt = tb.getTransportToken();\n AbstractToken t = tt.getToken();\n if (t instanceof HttpsToken) {\n isSecured = true;\n break;\n }\n }\n }\n\n return isSecured;\n }",
"protected void associateBatched(Collection owners, Collection children)\r\n {\r\n CollectionDescriptor cds = getCollectionDescriptor();\r\n PersistentField field = cds.getPersistentField();\r\n PersistenceBroker pb = getBroker();\r\n Class ownerTopLevelClass = pb.getTopLevelClass(getOwnerClassDescriptor().getClassOfObject());\r\n Class collectionClass = cds.getCollectionClass(); // this collection type will be used:\r\n HashMap ownerIdsToLists = new HashMap(owners.size());\r\n\r\n IdentityFactory identityFactory = pb.serviceIdentity();\r\n // initialize the owner list map\r\n for (Iterator it = owners.iterator(); it.hasNext();)\r\n {\r\n Object owner = it.next();\r\n ownerIdsToLists.put(identityFactory.buildIdentity(getOwnerClassDescriptor(), owner), new ArrayList());\r\n }\r\n\r\n // build the children lists for the owners\r\n for (Iterator it = children.iterator(); it.hasNext();)\r\n {\r\n Object child = it.next();\r\n // BRJ: use cld for real class, relatedObject could be Proxy\r\n ClassDescriptor cld = getDescriptorRepository().getDescriptorFor(ProxyHelper.getRealClass(child));\r\n\r\n Object[] fkValues = cds.getForeignKeyValues(child, cld);\r\n Identity ownerId = identityFactory.buildIdentity(null, ownerTopLevelClass, fkValues);\r\n List list = (List) ownerIdsToLists.get(ownerId);\r\n if (list != null)\r\n {\r\n list.add(child);\r\n }\r\n }\r\n\r\n // connect children list to owners\r\n for (Iterator it = owners.iterator(); it.hasNext();)\r\n {\r\n Object result;\r\n Object owner = it.next();\r\n Identity ownerId = identityFactory.buildIdentity(owner);\r\n List list = (List) ownerIdsToLists.get(ownerId);\r\n\r\n if ((collectionClass == null) && field.getType().isArray())\r\n {\r\n int length = list.size();\r\n Class itemtype = field.getType().getComponentType();\r\n result = Array.newInstance(itemtype, length);\r\n for (int j = 0; j < length; j++)\r\n {\r\n Array.set(result, j, list.get(j));\r\n }\r\n }\r\n else\r\n {\r\n ManageableCollection col = createCollection(cds, collectionClass);\r\n for (Iterator it2 = list.iterator(); it2.hasNext();)\r\n {\r\n col.ojbAdd(it2.next());\r\n }\r\n result = col;\r\n }\r\n\r\n Object value = field.get(owner);\r\n if ((value instanceof CollectionProxyDefaultImpl) && (result instanceof Collection))\r\n {\r\n ((CollectionProxyDefaultImpl) value).setData((Collection) result);\r\n }\r\n else\r\n {\r\n field.set(owner, result);\r\n }\r\n }\r\n }",
"public void updateAnimation()\n {\n Date time = new Date();\n long currentTime = time.getTime() - this.beginAnimation;\n if (currentTime > animationTime)\n {\n this.currentQuaternion.set(endQuaternion);\n for (int i = 0; i < 3; i++)\n {\n\n this.currentPos[i] = this.endPos[i];\n }\n this.animate = false;\n }\n\n else\n {\n float t = (float) currentTime / animationTime;\n this.currentQuaternion = this.beginQuaternion.slerp(this.endQuaternion,\n t);\n for (int i = 0; i < 3; i++)\n {\n this.currentPos[i] = this.beginPos[i] + totalTranslation[i] * t;\n }\n\n }\n }",
"public void addRelation(RelationType relationType, RelationDirection direction) {\n\tint idx = relationType.ordinal();\n\tdirections[idx] = directions[idx].sum(direction);\n }",
"public NamespacesList<Namespace> getNamespaces(String predicate, int perPage, int page) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n NamespacesList<Namespace> nsList = new NamespacesList<Namespace>();\r\n parameters.put(\"method\", METHOD_GET_NAMESPACES);\r\n\r\n if (predicate != null) {\r\n parameters.put(\"predicate\", predicate);\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 Element nsElement = response.getPayload();\r\n NodeList nsNodes = nsElement.getElementsByTagName(\"namespace\");\r\n nsList.setPage(\"1\");\r\n nsList.setPages(\"1\");\r\n nsList.setPerPage(\"\" + nsNodes.getLength());\r\n nsList.setTotal(\"\" + nsNodes.getLength());\r\n for (int i = 0; i < nsNodes.getLength(); i++) {\r\n Element element = (Element) nsNodes.item(i);\r\n nsList.add(parseNamespace(element));\r\n }\r\n return nsList;\r\n }",
"private int convertMoneyness(double moneyness) {\r\n\t\tif(quotingConvention == QuotingConvention.PAYERVOLATILITYLOGNORMAL) {\r\n\t\t\treturn (int) Math.round(moneyness * 100);\r\n\t\t} else if(quotingConvention == QuotingConvention.RECEIVERPRICE) {\r\n\t\t\treturn - (int) Math.round(moneyness * 10000);\r\n\t\t} else {\r\n\t\t\treturn (int) Math.round(moneyness * 10000);\r\n\t\t}\r\n\t}",
"public static double getDaycount(LocalDate startDate, LocalDate endDate, String convention) {\n\t\tDayCountConventionInterface daycountConvention = getDayCountConvention(convention);\n\t\treturn daycountConvention.getDaycount(startDate, endDate);\n\t}"
] |
Apply issues tracker info to a build info builder (used by generic tasks and maven2 which doesn't use the extractor | [
"public void setIssueTrackerInfo(BuildInfoBuilder builder) {\n Issues issues = new Issues();\n issues.setAggregateBuildIssues(aggregateBuildIssues);\n issues.setAggregationBuildStatus(aggregationBuildStatus);\n issues.setTracker(new IssueTracker(\"JIRA\", issueTrackerVersion));\n Set<Issue> affectedIssuesSet = IssuesTrackerUtils.getAffectedIssuesSet(affectedIssues);\n if (!affectedIssuesSet.isEmpty()) {\n issues.setAffectedIssues(affectedIssuesSet);\n }\n builder.issues(issues);\n }"
] | [
"public void setCategoryDisplayOptions(\n String displayCategoriesByRepository,\n String displayCategorySelectionCollapsed) {\n\n m_displayCategoriesByRepository = Boolean.parseBoolean(displayCategoriesByRepository);\n m_displayCategorySelectionCollapsed = Boolean.parseBoolean(displayCategorySelectionCollapsed);\n }",
"@Override\n public DiscordianDate date(int prolepticYear, int month, int dayOfMonth) {\n return DiscordianDate.of(prolepticYear, month, dayOfMonth);\n }",
"public static base_responses add(nitro_service client, appfwjsoncontenttype resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tappfwjsoncontenttype addresources[] = new appfwjsoncontenttype[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new appfwjsoncontenttype();\n\t\t\t\taddresources[i].jsoncontenttypevalue = resources[i].jsoncontenttypevalue;\n\t\t\t\taddresources[i].isregex = resources[i].isregex;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}",
"public static XMLStreamException missingRequiredElement(final XMLExtendedStreamReader reader, final Set<?> required) {\n final StringBuilder b = new StringBuilder();\n Iterator<?> iterator = required.iterator();\n while (iterator.hasNext()) {\n final Object o = iterator.next();\n b.append(o.toString());\n if (iterator.hasNext()) {\n b.append(\", \");\n }\n }\n final XMLStreamException ex = ControllerLogger.ROOT_LOGGER.missingRequiredElements(b, reader.getLocation());\n\n Set<String> set = new HashSet<>();\n for (Object o : required) {\n String toString = o.toString();\n set.add(toString);\n }\n return new XMLStreamValidationException(ex.getMessage(),\n ValidationError.from(ex, ErrorType.REQUIRED_ELEMENTS_MISSING)\n .element(reader.getName())\n .alternatives(set),\n ex);\n }",
"private void readTasks(Project plannerProject) throws MPXJException\n {\n Tasks tasks = plannerProject.getTasks();\n if (tasks != null)\n {\n for (net.sf.mpxj.planner.schema.Task task : tasks.getTask())\n {\n readTask(null, task);\n }\n\n for (net.sf.mpxj.planner.schema.Task task : tasks.getTask())\n {\n readPredecessors(task);\n }\n }\n\n m_projectFile.updateStructure();\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 Long getLong(String fieldName) {\n\t\ttry {\n\t\t\treturn hasValue(fieldName) ? Long.valueOf(String.valueOf(resultMap.get(fieldName))) : null;\n\t\t} catch (NumberFormatException e) {\n\t\t\tthrow new FqlException(\"Field '\" + fieldName +\"' is not a number.\", e);\n\t\t}\n\t}",
"protected void addFacetPart(CmsSolrQuery query) {\n\n StringBuffer value = new StringBuffer();\n value.append(\"{!key=\").append(m_config.getName());\n addFacetOptions(value);\n if (m_config.getIgnoreAllFacetFilters()\n || (!m_state.getCheckedEntries().isEmpty() && !m_config.getIsAndFacet())) {\n value.append(\" ex=\").append(m_config.getIgnoreTags());\n }\n value.append(\"}\");\n value.append(m_config.getRange());\n query.add(\"facet.range\", value.toString());\n }",
"@Override\n protected boolean changeDirection(int currentIndex, int centerIndex, boolean inBounds) {\n boolean changed = false;\n if (getGravityInternal() == Gravity.CENTER &&\n currentIndex <= centerIndex &&\n currentIndex == 0 || !inBounds) {\n\n changed = true;\n }\n return changed;\n }"
] |
Check if a column is part of the row key columns.
@param column the name of the column to check
@return true if the column is one of the row key columns, false otherwise | [
"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 void readZookeeperConfig() {\n\n try (CuratorFramework curator = CuratorUtil.newAppCurator(config)) {\n curator.start();\n\n accumuloInstance =\n new String(curator.getData().forPath(ZookeeperPath.CONFIG_ACCUMULO_INSTANCE_NAME),\n StandardCharsets.UTF_8);\n accumuloInstanceID =\n new String(curator.getData().forPath(ZookeeperPath.CONFIG_ACCUMULO_INSTANCE_ID),\n StandardCharsets.UTF_8);\n fluoApplicationID =\n new String(curator.getData().forPath(ZookeeperPath.CONFIG_FLUO_APPLICATION_ID),\n StandardCharsets.UTF_8);\n\n table = new String(curator.getData().forPath(ZookeeperPath.CONFIG_ACCUMULO_TABLE),\n StandardCharsets.UTF_8);\n\n observers = ObserverUtil.load(curator);\n\n config = FluoAdminImpl.mergeZookeeperConfig(config);\n\n // make sure not to include config passed to env, only want config from zookeeper\n appConfig = config.getAppConfiguration();\n } catch (Exception e) {\n throw new IllegalStateException(e);\n }\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 }",
"private BigInteger printExtendedAttributeDurationFormat(Object value)\n {\n BigInteger result = null;\n if (value instanceof Duration)\n {\n result = DatatypeConverter.printDurationTimeUnits(((Duration) value).getUnits(), false);\n }\n return (result);\n }",
"public List<Tag> getPrimeTags()\n {\n return this.definedTags.values().stream()\n .filter(Tag::isPrime)\n .collect(Collectors.toList());\n }",
"public PreparedStatement getDeleteStatement(ClassDescriptor cld) throws PersistenceBrokerSQLException, PersistenceBrokerException\r\n {\r\n try\r\n {\r\n return cld.getStatementsForClass(m_conMan).getDeleteStmt(m_conMan.getConnection());\r\n }\r\n catch (SQLException e)\r\n {\r\n throw new PersistenceBrokerSQLException(\"Could not build statement ask for\", e);\r\n }\r\n catch (LookupException e)\r\n {\r\n throw new PersistenceBrokerException(\"Used ConnectionManager instance could not obtain a connection\", e);\r\n }\r\n }",
"public CollectionRequest<Team> findByOrganization(String organization) {\n \n String path = String.format(\"/organizations/%s/teams\", organization);\n return new CollectionRequest<Team>(this, Team.class, path, \"GET\");\n }",
"public long nextUniqueTransaction(long timeMs) {\n long id = timeMs;\n for (; ; ) {\n long old = transactionID.get();\n if (old >= id)\n id = old + 1;\n if (transactionID.compareAndSet(old, id))\n break;\n }\n return id;\n }",
"public void addExtentClass(String newExtentClassName)\r\n {\r\n extentClassNames.add(newExtentClassName);\r\n if(m_repository != null) m_repository.addExtent(newExtentClassName, this);\r\n }",
"@Override\n public Map<String, String> values() {\n Map<String, String> values = new LinkedHashMap<>();\n for (Row each : delegates) {\n for (Entry<String, String> entry : each.values().entrySet()) {\n String name = entry.getKey();\n if (!values.containsKey(name)) {\n values.put(name, entry.getValue());\n }\n }\n }\n return values;\n }"
] |
returns a proxy or a fully materialized Object from the current row of the
underlying resultset. | [
"protected Object getObjectFromResultSet() throws PersistenceBrokerException\r\n {\r\n\r\n try\r\n {\r\n // if all primitive attributes of the object are contained in the ResultSet\r\n // the fast direct mapping can be used\r\n return super.getObjectFromResultSet();\r\n }\r\n // if the full loading failed we assume that at least PK attributes are contained\r\n // in the ResultSet and perform a slower Identity based loading...\r\n // This may of course also fail and can throw another PersistenceBrokerException\r\n catch (PersistenceBrokerException e)\r\n {\r\n Identity oid = getIdentityFromResultSet();\r\n return getBroker().getObjectByIdentity(oid);\r\n }\r\n\r\n }"
] | [
"public void copyTo(Gradient g) {\n\t\tg.numKnots = numKnots;\n\t\tg.map = (int[])map.clone();\n\t\tg.xKnots = (int[])xKnots.clone();\n\t\tg.yKnots = (int[])yKnots.clone();\n\t\tg.knotTypes = (byte[])knotTypes.clone();\n\t}",
"private Event createEvent(Endpoint endpoint, EventTypeEnum type) {\n\n Event event = new Event();\n MessageInfo messageInfo = new MessageInfo();\n Originator originator = new Originator();\n event.setMessageInfo(messageInfo);\n event.setOriginator(originator);\n\n Date date = new Date();\n event.setTimestamp(date);\n event.setEventType(type);\n\n messageInfo.setPortType(\n endpoint.getBinding().getBindingInfo().getService().getInterface().getName().toString());\n\n String transportType = null;\n if (endpoint.getBinding() instanceof SoapBinding) {\n SoapBinding soapBinding = (SoapBinding)endpoint.getBinding();\n if (soapBinding.getBindingInfo() instanceof SoapBindingInfo) {\n SoapBindingInfo soapBindingInfo = (SoapBindingInfo)soapBinding.getBindingInfo();\n transportType = soapBindingInfo.getTransportURI();\n }\n }\n messageInfo.setTransportType((transportType != null) ? transportType : \"Unknown transport type\");\n\n originator.setProcessId(Converter.getPID());\n try {\n InetAddress inetAddress = InetAddress.getLocalHost();\n originator.setIp(inetAddress.getHostAddress());\n originator.setHostname(inetAddress.getHostName());\n } catch (UnknownHostException e) {\n originator.setHostname(\"Unknown hostname\");\n originator.setIp(\"Unknown ip address\");\n }\n\n String address = endpoint.getEndpointInfo().getAddress();\n event.getCustomInfo().put(\"address\", address);\n\n return event;\n }",
"public Iterable<BoxLegalHoldAssignment.Info> getAssignments(String type, String id, int limit, String ... fields) {\n QueryStringBuilder builder = new QueryStringBuilder();\n if (type != null) {\n builder.appendParam(\"assign_to_type\", type);\n }\n if (id != null) {\n builder.appendParam(\"assign_to_id\", id);\n }\n if (fields.length > 0) {\n builder.appendParam(\"fields\", fields);\n }\n return new BoxResourceIterable<BoxLegalHoldAssignment.Info>(\n this.getAPI(), LEGAL_HOLD_ASSIGNMENTS_URL_TEMPLATE.buildWithQuery(\n this.getAPI().getBaseURL(), builder.toString(), this.getID()), limit) {\n\n @Override\n protected BoxLegalHoldAssignment.Info factory(JsonObject jsonObject) {\n BoxLegalHoldAssignment assignment = new BoxLegalHoldAssignment(\n BoxLegalHoldPolicy.this.getAPI(), jsonObject.get(\"id\").asString());\n return assignment.new Info(jsonObject);\n }\n };\n }",
"public static base_response Reboot(nitro_service client, reboot resource) throws Exception {\n\t\treboot Rebootresource = new reboot();\n\t\tRebootresource.warm = resource.warm;\n\t\treturn Rebootresource.perform_operation(client);\n\t}",
"public static String getFileFormat(POIFSFileSystem fs) throws IOException\n {\n String fileFormat = \"\";\n DirectoryEntry root = fs.getRoot();\n if (root.getEntryNames().contains(\"\\1CompObj\"))\n {\n CompObj compObj = new CompObj(new DocumentInputStream((DocumentEntry) root.getEntry(\"\\1CompObj\")));\n fileFormat = compObj.getFileFormat();\n }\n return fileFormat;\n }",
"private void cascadeDeleteFor(ObjectEnvelope mod, List alreadyPrepared)\r\n {\r\n // avoid endless recursion\r\n if(alreadyPrepared.contains(mod.getIdentity())) return;\r\n\r\n alreadyPrepared.add(mod.getIdentity());\r\n\r\n ClassDescriptor cld = getTransaction().getBroker().getClassDescriptor(mod.getObject().getClass());\r\n\r\n List refs = cld.getObjectReferenceDescriptors(true);\r\n cascadeDeleteSingleReferences(mod, refs, alreadyPrepared);\r\n\r\n List colls = cld.getCollectionDescriptors(true);\r\n cascadeDeleteCollectionReferences(mod, colls, alreadyPrepared);\r\n }",
"private static DirectoryGrouping resolveDirectoryGrouping(final ModelNode model, final ExpressionResolver expressionResolver) {\n try {\n return DirectoryGrouping.forName(HostResourceDefinition.DIRECTORY_GROUPING.resolveModelAttribute(expressionResolver, model).asString());\n } catch (OperationFailedException e) {\n throw new IllegalStateException(e);\n }\n }",
"public static base_response delete(nitro_service client, dnsaaaarec resource) throws Exception {\n\t\tdnsaaaarec deleteresource = new dnsaaaarec();\n\t\tdeleteresource.hostname = resource.hostname;\n\t\tdeleteresource.ipv6address = resource.ipv6address;\n\t\treturn deleteresource.delete_resource(client);\n\t}",
"public void update(int width, int height, float[] data)\n throws IllegalArgumentException\n {\n if ((width <= 0) || (height <= 0) ||\n (data == null) || (data.length < height * width * mFloatsPerPixel))\n {\n throw new IllegalArgumentException();\n }\n NativeFloatImage.update(getNative(), width, height, 0, data);\n }"
] |
Use this API to delete nsacl6 resources of given names. | [
"public static base_responses delete(nitro_service client, String acl6name[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (acl6name != null && acl6name.length > 0) {\n\t\t\tnsacl6 deleteresources[] = new nsacl6[acl6name.length];\n\t\t\tfor (int i=0;i<acl6name.length;i++){\n\t\t\t\tdeleteresources[i] = new nsacl6();\n\t\t\t\tdeleteresources[i].acl6name = acl6name[i];\n\t\t\t}\n\t\t\tresult = delete_bulk_request(client, deleteresources);\n\t\t}\n\t\treturn result;\n\t}"
] | [
"public static final Duration getDuration(double value, TimeUnit type)\n {\n double duration;\n // Value is given in 1/10 of minute\n switch (type)\n {\n case MINUTES:\n case ELAPSED_MINUTES:\n {\n duration = value / 10;\n break;\n }\n\n case HOURS:\n case ELAPSED_HOURS:\n {\n duration = value / 600; // 60 * 10\n break;\n }\n\n case DAYS:\n {\n duration = value / 4800; // 8 * 60 * 10\n break;\n }\n\n case ELAPSED_DAYS:\n {\n duration = value / 14400; // 24 * 60 * 10\n break;\n }\n\n case WEEKS:\n {\n duration = value / 24000; // 5 * 8 * 60 * 10\n break;\n }\n\n case ELAPSED_WEEKS:\n {\n duration = value / 100800; // 7 * 24 * 60 * 10\n break;\n }\n\n case MONTHS:\n {\n duration = value / 96000; // 4 * 5 * 8 * 60 * 10\n break;\n }\n\n case ELAPSED_MONTHS:\n {\n duration = value / 432000; // 30 * 24 * 60 * 10\n break;\n }\n\n default:\n {\n duration = value;\n break;\n }\n }\n return (Duration.getInstance(duration, type));\n }",
"public static List<String> asListLines(String content) {\n List<String> retorno = new ArrayList<String>();\n content = content.replace(CARRIAGE_RETURN, RETURN);\n content = content.replace(RETURN, CARRIAGE_RETURN);\n for (String str : content.split(CARRIAGE_RETURN)) {\n retorno.add(str);\n }\n return retorno;\n }",
"@SuppressWarnings(\"unchecked\")\n private static Object resolveConflictWithResolver(\n final ConflictHandler conflictResolver,\n final BsonValue documentId,\n final ChangeEvent localEvent,\n final ChangeEvent remoteEvent\n ) {\n return conflictResolver.resolveConflict(\n documentId,\n localEvent,\n remoteEvent);\n }",
"@SuppressWarnings(\"deprecation\")\n private void cancelRequestAndWorkerOnHost(List<String> targetHosts) {\n\n List<String> validTargetHosts = new ArrayList<String>(workers.keySet());\n validTargetHosts.retainAll(targetHosts);\n logger.info(\"targetHosts for cancel: Total: {}\"\n + \" Valid in current manager with worker threads: {}\",\n targetHosts.size(), validTargetHosts.size());\n\n for (String targetHost : validTargetHosts) {\n\n ActorRef worker = workers.get(targetHost);\n\n if (worker != null && !worker.isTerminated()) {\n worker.tell(OperationWorkerMsgType.CANCEL, getSelf());\n logger.info(\"Submitted CANCEL request on Host {}\", targetHost);\n } else {\n logger.info(\n \"Did NOT Submitted \"\n + \"CANCEL request on Host {} as worker on this host is null or already killed\",\n targetHost);\n }\n\n }\n\n }",
"public static void printResults(Counter<String> entityTP, Counter<String> entityFP,\r\n Counter<String> entityFN) {\r\n Set<String> entities = new TreeSet<String>();\r\n entities.addAll(entityTP.keySet());\r\n entities.addAll(entityFP.keySet());\r\n entities.addAll(entityFN.keySet());\r\n boolean printedHeader = false;\r\n for (String entity : entities) {\r\n double tp = entityTP.getCount(entity);\r\n double fp = entityFP.getCount(entity);\r\n double fn = entityFN.getCount(entity);\r\n printedHeader = printPRLine(entity, tp, fp, fn, printedHeader);\r\n }\r\n double tp = entityTP.totalCount();\r\n double fp = entityFP.totalCount();\r\n double fn = entityFN.totalCount();\r\n printedHeader = printPRLine(\"Totals\", tp, fp, fn, printedHeader);\r\n }",
"protected <T> T getProperty(String key, Class<T> type) {\n Object returnValue = getProperty(key);\n if (returnValue != null) {\n return (T) returnValue;\n } else {\n return null;\n }\n }",
"public synchronized static void registerImagOnAgents(Launcher launcher, final String imageTag,\n final String host, final String targetRepo, final ArrayListMultimap<String, String> artifactsProps,\n final int buildInfoId) throws IOException, InterruptedException {\n // Master\n final String imageId = getImageIdFromAgent(launcher, imageTag, host);\n registerImage(imageId, imageTag, targetRepo, artifactsProps, buildInfoId);\n\n // 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 node.getChannel().call(new MasterToSlaveCallable<Boolean, IOException>() {\n public Boolean call() throws IOException {\n registerImage(imageId, imageTag, targetRepo, artifactsProps, buildInfoId);\n return true;\n }\n });\n } catch (Exception e) {\n launcher.getListener().getLogger().println(\"Could not register docker image \" + imageTag +\n \" on Jenkins node '\" + node.getDisplayName() + \"' due to: \" + e.getMessage() +\n \" This could be because this node is now offline.\"\n );\n }\n }\n }",
"public MwDumpFile findMostRecentDump(DumpContentType dumpContentType) {\n\t\tList<MwDumpFile> dumps = findAllDumps(dumpContentType);\n\n\t\tfor (MwDumpFile dump : dumps) {\n\t\t\tif (dump.isAvailable()) {\n\t\t\t\treturn dump;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}",
"public static base_responses enable(nitro_service client, String acl6name[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (acl6name != null && acl6name.length > 0) {\n\t\t\tnsacl6 enableresources[] = new nsacl6[acl6name.length];\n\t\t\tfor (int i=0;i<acl6name.length;i++){\n\t\t\t\tenableresources[i] = new nsacl6();\n\t\t\t\tenableresources[i].acl6name = acl6name[i];\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, enableresources,\"enable\");\n\t\t}\n\t\treturn result;\n\t}"
] |
Returns whether this is a valid address string format.
The accepted IP address formats are:
an IPv4 address, an IPv6 address, a network prefix alone, the address representing all addresses of all types, or an empty string.
If this method returns false, and you want more details, call validate() and examine the thrown exception.
@return whether this is a valid address string format | [
"public boolean isValid() {\n\t\tif(addressProvider.isUninitialized()) {\n\t\t\ttry {\n\t\t\t\tvalidate();\n\t\t\t\treturn true;\n\t\t\t} catch(AddressStringException e) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn !addressProvider.isInvalid();\n\t}"
] | [
"public static String getVcsUrl(Map<String, String> env) {\n String url = env.get(\"SVN_URL\");\n if (StringUtils.isBlank(url)) {\n url = publicGitUrl(env.get(\"GIT_URL\"));\n }\n if (StringUtils.isBlank(url)) {\n url = env.get(\"P4PORT\");\n }\n return url;\n }",
"private List<File> getConfigFiles() {\n\n String[] filenames = {\n \"opencms-modules.xml\",\n \"opencms-system.xml\",\n \"opencms-vfs.xml\",\n \"opencms-importexport.xml\",\n \"opencms-sites.xml\",\n \"opencms-variables.xml\",\n \"opencms-scheduler.xml\",\n \"opencms-workplace.xml\",\n \"opencms-search.xml\"};\n List<File> result = new ArrayList<>();\n for (String fn : filenames) {\n File file = new File(m_configDir, fn);\n if (file.exists()) {\n result.add(file);\n }\n }\n return result;\n }",
"public static File createFolder(String path, String dest_dir)\n throws BeastException {\n File f = new File(dest_dir);\n if (!f.isDirectory()) {\n try {\n f.mkdirs();\n } catch (Exception e) {\n logger.severe(\"Problem creating directory: \" + path\n + File.separator + dest_dir);\n }\n }\n\n String folderPath = createFolderPath(path);\n\n f = new File(f, folderPath);\n if (!f.isDirectory()) {\n try {\n f.mkdirs();\n } catch (Exception e) {\n String message = \"Problem creating directory: \" + path\n + File.separator + dest_dir;\n logger.severe(message);\n throw new BeastException(message, e);\n }\n }\n\n return f;\n }",
"public void linkOneToMany(Object obj, CollectionDescriptor cod, boolean insert)\n {\n Object referencedObjects = cod.getPersistentField().get(obj);\n storeAndLinkOneToMany(true, obj, cod,referencedObjects, insert);\n }",
"public static void redeployLinksAndTransformOperation(OperationContext context, ModelNode removeOperation, PathAddress deploymentsRootAddress, Set<String> runtimeNames) throws OperationFailedException {\n Set<String> deploymentNames = listDeployments(context.readResourceFromRoot(deploymentsRootAddress), runtimeNames);\n Operations.CompositeOperationBuilder opBuilder = Operations.CompositeOperationBuilder.create();\n if (deploymentNames.isEmpty()) {\n for (String s : runtimeNames) {\n ServerLogger.ROOT_LOGGER.debugf(\"We haven't found any deployment for %s in server-group %s\", s, deploymentsRootAddress.getLastElement().getValue());\n }\n }\n if(removeOperation != null) {\n opBuilder.addStep(removeOperation);\n }\n for (String deploymentName : deploymentNames) {\n opBuilder.addStep(addRedeployStep(deploymentsRootAddress.append(DEPLOYMENT, deploymentName)));\n }\n List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);\n if (transformers == null) {\n context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());\n }\n final ModelNode slave = opBuilder.build().getOperation();\n transformers.add(new OverlayOperationTransmuter(slave, context.getCurrentAddress()));\n }",
"public List<IssueCategory> getIssueCategories()\n {\n return this.issueCategories.values().stream()\n .sorted((category1, category2) -> category1.getPriority() - category2.getPriority())\n .collect(Collectors.toList());\n }",
"public void setSeriesEndDate(Date date) {\r\n\r\n if (!Objects.equals(m_model.getSeriesEndDate(), date)) {\r\n m_model.setSeriesEndDate(date);\r\n valueChanged();\r\n }\r\n\r\n }",
"private String[] getDatePatterns(ProjectProperties properties)\n {\n String pattern = \"\";\n\n char datesep = properties.getDateSeparator();\n DateOrder dateOrder = properties.getDateOrder();\n\n switch (dateOrder)\n {\n case DMY:\n {\n pattern = \"dd\" + datesep + \"MM\" + datesep + \"yy\";\n break;\n }\n\n case MDY:\n {\n pattern = \"MM\" + datesep + \"dd\" + datesep + \"yy\";\n break;\n }\n\n case YMD:\n {\n pattern = \"yy\" + datesep + \"MM\" + datesep + \"dd\";\n break;\n }\n }\n\n return new String[]\n {\n pattern\n };\n }",
"public static lbroute[] get(nitro_service service) throws Exception{\n\t\tlbroute obj = new lbroute();\n\t\tlbroute[] response = (lbroute[])obj.get_resources(service);\n\t\treturn response;\n\t}"
] |
Obtain an OTMConnection for the given persistence broker key | [
"public OTMConnection acquireConnection(PBKey pbKey)\r\n {\r\n TransactionFactory txFactory = getTransactionFactory();\r\n return txFactory.acquireConnection(pbKey);\r\n }"
] | [
"public PhotoList<Photo> search(SearchParameters params, int perPage, int page) throws FlickrException {\r\n PhotoList<Photo> photos = new PhotoList<Photo>();\r\n\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_SEARCH);\r\n\r\n parameters.putAll(params.getAsParameters());\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 = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n Element photosElement = response.getPayload();\r\n photos.setPage(photosElement.getAttribute(\"page\"));\r\n photos.setPages(photosElement.getAttribute(\"pages\"));\r\n photos.setPerPage(photosElement.getAttribute(\"perpage\"));\r\n photos.setTotal(photosElement.getAttribute(\"total\"));\r\n\r\n NodeList photoNodes = photosElement.getElementsByTagName(\"photo\");\r\n for (int i = 0; i < photoNodes.getLength(); i++) {\r\n Element photoElement = (Element) photoNodes.item(i);\r\n photos.add(PhotoUtils.createPhoto(photoElement));\r\n }\r\n return photos;\r\n }",
"public static base_response delete(nitro_service client, application resource) throws Exception {\n\t\tapplication deleteresource = new application();\n\t\tdeleteresource.appname = resource.appname;\n\t\treturn deleteresource.delete_resource(client);\n\t}",
"public void search(String query) {\n final Query newQuery = searcher.getQuery().setQuery(query);\n searcher.setQuery(newQuery).search();\n }",
"private void readDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay day, boolean readExceptionsFromDays)\n {\n BigInteger dayType = day.getDayType();\n if (dayType != null)\n {\n if (dayType.intValue() == 0)\n {\n if (readExceptionsFromDays)\n {\n readExceptionDay(calendar, day);\n }\n }\n else\n {\n readNormalDay(calendar, day);\n }\n }\n }",
"public void registerCollectionSizeGauge(\n\t\t\tCollectionSizeGauge collectionSizeGauge) {\n\t\tString name = createMetricName(LocalTaskExecutorService.class,\n\t\t\t\t\"queue-size\");\n\t\tmetrics.register(name, collectionSizeGauge);\n\t}",
"@SuppressWarnings(\"deprecation\")\n protected ModelNode executeReadOnlyOperation(final ModelNode operation, final OperationMessageHandler handler, final OperationTransactionControl control, final OperationStepHandler prepareStep, final int operationId) {\n final AbstractOperationContext delegateContext = getDelegateContext(operationId);\n CurrentOperationIdHolder.setCurrentOperationID(operationId);\n try {\n return executeReadOnlyOperation(operation, delegateContext.getManagementModel(), control, prepareStep, delegateContext);\n } finally {\n CurrentOperationIdHolder.setCurrentOperationID(null);\n }\n }",
"public List<String> uuids(long count) {\n final URI uri = new URIBase(clientUri).path(\"_uuids\").query(\"count\", count).build();\n final JsonObject json = get(uri, JsonObject.class);\n return getGson().fromJson(json.get(\"uuids\").toString(), DeserializationTypes.STRINGS);\n }",
"public static DMatrixRMaj extractRow(DMatrixRMaj a , int row , DMatrixRMaj out ) {\n if( out == null)\n out = new DMatrixRMaj(1,a.numCols);\n else if( !MatrixFeatures_DDRM.isVector(out) || out.getNumElements() != a.numCols )\n throw new MatrixDimensionException(\"Output must be a vector of length \"+a.numCols);\n\n System.arraycopy(a.data,a.getIndex(row,0),out.data,0,a.numCols);\n\n return out;\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 }"
] |
Performs a HTTP GET request.
@return Class type of object T (i.e. {@link Response} | [
"public <T> T get(URI uri, Class<T> classType) {\n HttpConnection connection = Http.GET(uri);\n InputStream response = executeToInputStream(connection);\n try {\n return getResponse(response, classType, getGson());\n } finally {\n close(response);\n }\n }"
] | [
"public static nspbr6_stats get(nitro_service service, String name) throws Exception{\n\t\tnspbr6_stats obj = new nspbr6_stats();\n\t\tobj.set_name(name);\n\t\tnspbr6_stats response = (nspbr6_stats) obj.stat_resource(service);\n\t\treturn response;\n\t}",
"public static base_responses update(nitro_service client, clusterinstance resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tclusterinstance updateresources[] = new clusterinstance[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tupdateresources[i] = new clusterinstance();\n\t\t\t\tupdateresources[i].clid = resources[i].clid;\n\t\t\t\tupdateresources[i].deadinterval = resources[i].deadinterval;\n\t\t\t\tupdateresources[i].hellointerval = resources[i].hellointerval;\n\t\t\t\tupdateresources[i].preemption = resources[i].preemption;\n\t\t\t}\n\t\t\tresult = update_bulk_request(client, updateresources);\n\t\t}\n\t\treturn result;\n\t}",
"public static 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 ParallelTaskBuilder preparePing() {\n reinitIfClosed();\n ParallelTaskBuilder cb = new ParallelTaskBuilder();\n cb.setProtocol(RequestProtocol.PING);\n return cb;\n }",
"public void removeDropPasteWorker(DropPasteWorkerInterface worker)\r\n {\r\n this.dropPasteWorkerSet.remove(worker);\r\n java.util.Iterator it = this.dropPasteWorkerSet.iterator();\r\n int newDefaultActions = 0;\r\n while (it.hasNext())\r\n newDefaultActions |= ((DropPasteWorkerInterface)it.next()).getAcceptableActions(defaultDropTarget.getComponent());\r\n defaultDropTarget.setDefaultActions(newDefaultActions);\r\n }",
"@Pure\n\tpublic static <P1> Procedure0 curry(final Procedure1<? super P1> procedure, final P1 argument) {\n\t\tif (procedure == null)\n\t\t\tthrow new NullPointerException(\"procedure\");\n\t\treturn new Procedure0() {\n\t\t\t@Override\n\t\t\tpublic void apply() {\n\t\t\t\tprocedure.apply(argument);\n\t\t\t}\n\t\t};\n\t}",
"public void setLargePayloadSupportEnabled(AmazonS3 s3, String s3BucketName) {\n\t\tif (s3 == null || s3BucketName == null) {\n\t\t\tString errorMessage = \"S3 client and/or S3 bucket name cannot be null.\";\n\t\t\tLOG.error(errorMessage);\n\t\t\tthrow new AmazonClientException(errorMessage);\n\t\t}\n\t\tif (isLargePayloadSupportEnabled()) {\n\t\t\tLOG.warn(\"Large-payload support is already enabled. Overwriting AmazonS3Client and S3BucketName.\");\n\t\t}\n\t\tthis.s3 = s3;\n\t\tthis.s3BucketName = s3BucketName;\n\t\tlargePayloadSupport = true;\n\t\tLOG.info(\"Large-payload support enabled.\");\n\t}",
"private boolean isAbandoned(final SubmittedPrintJob printJob) {\n final long duration = ThreadPoolJobManager.this.jobQueue.timeSinceLastStatusCheck(\n printJob.getEntry().getReferenceId());\n final boolean abandoned =\n duration > TimeUnit.SECONDS.toMillis(ThreadPoolJobManager.this.abandonedTimeout);\n if (abandoned) {\n LOGGER.info(\"Job {} is abandoned (no status check within the last {} seconds)\",\n printJob.getEntry().getReferenceId(), ThreadPoolJobManager.this.abandonedTimeout);\n }\n return abandoned;\n }",
"public void showTrajectoryAndSpline(){\n\t\t\n\t\tif(t.getDimension()==2){\n\t\t \tdouble[] xData = new double[rotatedTrajectory.size()];\n\t\t double[] yData = new double[rotatedTrajectory.size()];\n\t\t for(int i = 0; i < rotatedTrajectory.size(); i++){\n\t\t \txData[i] = rotatedTrajectory.get(i).x;\n\t\t \tyData[i] = rotatedTrajectory.get(i).y;\t\t \t\n\t\t }\n\t\t // Create Chart\n\t\t Chart chart = QuickChart.getChart(\"Spline+Track\", \"X\", \"Y\", \"y(x)\", xData, yData);\n\t\t \n\t\t //Add spline support points\n\t\t double[] subxData = new double[splineSupportPoints.size()];\n\t\t double[] subyData = new double[splineSupportPoints.size()];\n\t\t \n\t\t for(int i = 0; i < splineSupportPoints.size(); i++){\n\t\t \tsubxData[i] = splineSupportPoints.get(i).x;\n\t\t \tsubyData[i] = splineSupportPoints.get(i).y;\n\t\t }\n\t\t Series s = chart.addSeries(\"Spline Support Points\", subxData, subyData);\n\t\t s.setLineStyle(SeriesLineStyle.NONE);\n\t\t s.setSeriesType(SeriesType.Line);\n\t\t \n\t\t //ADd spline points\n\t\t int numberInterpolatedPointsPerSegment = 20;\n\t\t int numberOfSplines = spline.getN();\n\t\t double[] sxData = new double[numberInterpolatedPointsPerSegment*numberOfSplines];\n\t\t \n\t\t double[] syData = new double[numberInterpolatedPointsPerSegment*numberOfSplines];\n\t\t double[] knots = spline.getKnots();\n\t\t for(int i = 0; i < numberOfSplines; i++){\n\t\t \tdouble x = knots[i];\n\t\t \n\t\t \tdouble stopx = knots[i+1];\n\t\t \tdouble dx = (stopx-x)/numberInterpolatedPointsPerSegment;\n\t\t \t\n\t\t \tfor(int j = 0; j < numberInterpolatedPointsPerSegment; j++){\n\n\t\t \t\tsxData[i*numberInterpolatedPointsPerSegment+j] = x;\n\t\t \t\tsyData[i*numberInterpolatedPointsPerSegment+j] = spline.value(x);\n\t\t \t\tx += dx;\n\t\t \t}\n\t\t \t\n\t\t }\n\t\t s = chart.addSeries(\"Spline\", sxData, syData);\n\t\t s.setLineStyle(SeriesLineStyle.DASH_DASH);\n\t\t s.setMarker(SeriesMarker.NONE);\n\t\t s.setSeriesType(SeriesType.Line);\n\t\t \n\t\t \n\t\t //Show it\n\t\t new SwingWrapper(chart).displayChart();\n\t\t} \n\t}"
] |
OR operation which takes the previous clause and the next clause and OR's them together. | [
"public Where<T, ID> or() {\n\t\tManyClause clause = new ManyClause(pop(\"OR\"), ManyClause.OR_OPERATION);\n\t\tpush(clause);\n\t\taddNeedsFuture(clause);\n\t\treturn this;\n\t}"
] | [
"public static <V> Map<V, V> convertListToMap(List<V> list) {\n Map<V, V> map = new HashMap<V, V>();\n if(list.size() % 2 != 0)\n throw new VoldemortException(\"Failed to convert list to map.\");\n for(int i = 0; i < list.size(); i += 2) {\n map.put(list.get(i), list.get(i + 1));\n }\n return map;\n }",
"public static base_response unset(nitro_service client, Interface resource, String[] args) throws Exception{\n\t\tInterface unsetresource = new Interface();\n\t\tunsetresource.id = resource.id;\n\t\treturn unsetresource.unset_resource(client,args);\n\t}",
"public void setKnotType(int n, int type) {\n\t\tknotTypes[n] = (byte)((knotTypes[n] & ~COLOR_MASK) | type);\n\t\trebuildGradient();\n\t}",
"public void set( int row , int col , double real , double imaginary ) {\n if( imaginary == 0 ) {\n set(row,col,real);\n } else {\n ops.set(mat,row,col, real, imaginary);\n }\n }",
"public static void closeThrowSqlException(Closeable closeable, String label) throws SQLException {\n\t\tif (closeable != null) {\n\t\t\ttry {\n\t\t\t\tcloseable.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow SqlExceptionUtil.create(\"could not close \" + label, e);\n\t\t\t}\n\t\t}\n\t}",
"public static long getGcTimestamp(String zookeepers) {\n ZooKeeper zk = null;\n try {\n zk = new ZooKeeper(zookeepers, 30000, null);\n\n // wait until zookeeper is connected\n long start = System.currentTimeMillis();\n while (!zk.getState().isConnected() && System.currentTimeMillis() - start < 30000) {\n Uninterruptibles.sleepUninterruptibly(10, TimeUnit.MILLISECONDS);\n }\n\n byte[] d = zk.getData(ZookeeperPath.ORACLE_GC_TIMESTAMP, false, null);\n return LongUtil.fromByteArray(d);\n } catch (KeeperException | InterruptedException | IOException e) {\n log.warn(\"Failed to get oldest timestamp of Oracle from Zookeeper\", e);\n return OLDEST_POSSIBLE;\n } finally {\n if (zk != null) {\n try {\n zk.close();\n } catch (InterruptedException e) {\n log.error(\"Failed to close zookeeper client\", e);\n }\n }\n }\n }",
"protected String getContextPath(){\n\n if(context != null) return context;\n\n if(get(\"context_path\") == null){\n throw new ViewException(\"context_path missing - red alarm!\");\n }\n return get(\"context_path\").toString();\n }",
"public DbModule getModule(final String moduleId) {\n final DbModule dbModule = repositoryHandler.getModule(moduleId);\n\n if (dbModule == null) {\n throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)\n .entity(\"Module \" + moduleId + \" does not exist.\").build());\n }\n\n return dbModule;\n }",
"private List<File> getConfigFiles() {\n\n String[] filenames = {\n \"opencms-modules.xml\",\n \"opencms-system.xml\",\n \"opencms-vfs.xml\",\n \"opencms-importexport.xml\",\n \"opencms-sites.xml\",\n \"opencms-variables.xml\",\n \"opencms-scheduler.xml\",\n \"opencms-workplace.xml\",\n \"opencms-search.xml\"};\n List<File> result = new ArrayList<>();\n for (String fn : filenames) {\n File file = new File(m_configDir, fn);\n if (file.exists()) {\n result.add(file);\n }\n }\n return result;\n }"
] |
Add raw SQL "ORDER BY" clause to the SQL query statement.
@param rawSql
The raw SQL order by clause. This should not include the "ORDER BY". | [
"public QueryBuilder<T, ID> orderByRaw(String rawSql) {\n\t\taddOrderBy(new OrderBy(rawSql, (ArgumentHolder[]) null));\n\t\treturn this;\n\t}"
] | [
"public static Iterable<BoxCollection.Info> getAllCollections(final BoxAPIConnection api) {\n return new Iterable<BoxCollection.Info>() {\n public Iterator<BoxCollection.Info> iterator() {\n URL url = GET_COLLECTIONS_URL_TEMPLATE.build(api.getBaseURL());\n return new BoxCollectionIterator(api, url);\n }\n };\n }",
"public void readData(BufferedReader in) throws IOException {\r\n String line, value;\r\n // skip old variables if still present\r\n lexOptions.readData(in);\r\n line = in.readLine();\r\n value = line.substring(line.indexOf(' ') + 1);\r\n try {\r\n tlpParams = (TreebankLangParserParams) Class.forName(value).newInstance();\r\n } catch (Exception e) {\r\n IOException ioe = new IOException(\"Problem instantiating parserParams: \" + line);\r\n ioe.initCause(e);\r\n throw ioe;\r\n }\r\n line = in.readLine();\r\n // ensure backwards compatibility\r\n if (line.matches(\"^forceCNF.*\")) {\r\n value = line.substring(line.indexOf(' ') + 1);\r\n forceCNF = Boolean.parseBoolean(value);\r\n line = in.readLine();\r\n }\r\n value = line.substring(line.indexOf(' ') + 1);\r\n doPCFG = Boolean.parseBoolean(value);\r\n line = in.readLine();\r\n value = line.substring(line.indexOf(' ') + 1);\r\n doDep = Boolean.parseBoolean(value);\r\n line = in.readLine();\r\n value = line.substring(line.indexOf(' ') + 1);\r\n freeDependencies = Boolean.parseBoolean(value);\r\n line = in.readLine();\r\n value = line.substring(line.indexOf(' ') + 1);\r\n directional = Boolean.parseBoolean(value);\r\n line = in.readLine();\r\n value = line.substring(line.indexOf(' ') + 1);\r\n genStop = Boolean.parseBoolean(value);\r\n line = in.readLine();\r\n value = line.substring(line.indexOf(' ') + 1);\r\n distance = Boolean.parseBoolean(value);\r\n line = in.readLine();\r\n value = line.substring(line.indexOf(' ') + 1);\r\n coarseDistance = Boolean.parseBoolean(value);\r\n line = in.readLine();\r\n value = line.substring(line.indexOf(' ') + 1);\r\n dcTags = Boolean.parseBoolean(value);\r\n line = in.readLine();\r\n if ( ! line.matches(\"^nPrune.*\")) {\r\n throw new RuntimeException(\"Expected nPrune, found: \" + line);\r\n }\r\n value = line.substring(line.indexOf(' ') + 1);\r\n nodePrune = Boolean.parseBoolean(value);\r\n line = in.readLine(); // get rid of last line\r\n if (line.length() != 0) {\r\n throw new RuntimeException(\"Expected blank line, found: \" + line);\r\n }\r\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 String makeReport(String name, String report) {\n long increment = Long.valueOf(report);\n long currentLineCount = globalLineCounter.addAndGet(increment);\n\n if (currentLineCount >= maxScenarios) {\n return \"exit\";\n } else {\n return \"ok\";\n }\n }",
"protected long getRevisionIdFromResponse(JsonNode response) throws JsonMappingException {\n\t\tif(response == null) {\n\t\t\tthrow new JsonMappingException(\"API response is null\");\n\t\t}\n\t\tJsonNode entity = null;\n\t\tif(response.has(\"entity\")) {\n\t\t\tentity = response.path(\"entity\");\n\t\t} else if(response.has(\"pageinfo\")) {\n\t\t\tentity = response.path(\"pageinfo\");\n\t\t} \n\t\tif(entity != null && entity.has(\"lastrevid\")) {\n\t\t\treturn entity.path(\"lastrevid\").asLong();\n\t\t}\n\t\tthrow new JsonMappingException(\"The last revision id could not be found in API response\");\n\t}",
"private static final int getUnicodeStringLengthInBytes(byte[] data, int offset)\n {\n int result;\n if (data == null || offset >= data.length)\n {\n result = 0;\n }\n else\n {\n result = data.length - offset;\n\n for (int loop = offset; loop < (data.length - 1); loop += 2)\n {\n if (data[loop] == 0 && data[loop + 1] == 0)\n {\n result = loop - offset;\n break;\n }\n }\n }\n return result;\n }",
"private void handleSendDataRequest(SerialMessage incomingMessage) {\n\t\tlogger.trace(\"Handle Message Send Data Request\");\n\t\t\n\t\tint callbackId = incomingMessage.getMessagePayloadByte(0);\n\t\tTransmissionState status = TransmissionState.getTransmissionState(incomingMessage.getMessagePayloadByte(1));\n\t\tSerialMessage originalMessage = this.lastSentMessage;\n\t\t\n\t\tif (status == null) {\n\t\t\tlogger.warn(\"Transmission state not found, ignoring.\");\n\t\t\treturn;\n\t\t}\n\n\t\tlogger.debug(\"CallBack ID = {}\", callbackId);\n\t\tlogger.debug(String.format(\"Status = %s (0x%02x)\", status.getLabel(), status.getKey()));\n\t\t\n\t\tif (originalMessage == null || originalMessage.getCallbackId() != callbackId) {\n\t\t\tlogger.warn(\"Already processed another send data request for this callback Id, ignoring.\");\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tswitch (status) {\n\t\t\tcase COMPLETE_OK:\n\t\t\t\tZWaveNode node = this.getNode(originalMessage.getMessageNode());\n\t\t\t\tnode.resetResendCount();\n\t\t\t\t\n\t\t\t\t// in case we received a ping response and the node is alive, we proceed with the next node stage for this node.\n\t\t\t\tif (node != null && node.getNodeStage() == NodeStage.NODEBUILDINFO_PING) {\n\t\t\t\t\tnode.advanceNodeStage();\n\t\t\t\t}\n\t\t\t\tif (incomingMessage.getMessageClass() == originalMessage.getExpectedReply() && !incomingMessage.isTransActionCanceled()) {\n\t\t\t\t\tnotifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));\n\t\t\t\t\ttransactionCompleted.release();\n\t\t\t\t\tlogger.trace(\"Released. Transaction completed permit count -> {}\", transactionCompleted.availablePermits());\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\tcase COMPLETE_NO_ACK:\n\t\t\tcase COMPLETE_FAIL:\n\t\t\tcase COMPLETE_NOT_IDLE:\n\t\t\tcase COMPLETE_NOROUTE:\n\t\t\t\ttry {\n\t\t\t\t\thandleFailedSendDataRequest(originalMessage);\n\t\t\t\t} finally {\n\t\t\t\t\ttransactionCompleted.release();\n\t\t\t\t\tlogger.trace(\"Released. Transaction completed permit count -> {}\", transactionCompleted.availablePermits());\n\t\t\t\t}\n\t\t\tdefault:\n\t\t}\n\t}",
"private Set<String> checkModel(final ModelNode model, TransformationContext context) throws OperationFailedException {\n final Set<String> attributes = new HashSet<String>();\n AttributeTransformationRequirementChecker checker;\n for (final String attribute : attributeNames) {\n if (model.hasDefined(attribute)) {\n if (attributeCheckers != null && (checker = attributeCheckers.get(attribute)) != null) {\n if (checker.isAttributeTransformationRequired(attribute, model.get(attribute), context)) {\n attributes.add(attribute);\n }\n } else if (SIMPLE_EXPRESSIONS.isAttributeTransformationRequired(attribute, model.get(attribute), context)) {\n attributes.add(attribute);\n }\n }\n }\n return attributes;\n }",
"public void sendSyncModeCommand(int deviceNumber, boolean synced) throws IOException {\n final DeviceUpdate update = getLatestStatusFor(deviceNumber);\n if (update == null) {\n throw new IllegalArgumentException(\"Device \" + deviceNumber + \" not found on network.\");\n }\n sendSyncModeCommand(update, synced);\n }"
] |
Start check of execution time
@param extra | [
"public static void startCheck(String extra) {\n startCheckTime = System.currentTimeMillis();\n nextCheckTime = startCheckTime;\n Log.d(Log.SUBSYSTEM.TRACING, \"FPSCounter\" , \"[%d] startCheck %s\", startCheckTime, extra);\n }"
] | [
"private void deselectChildren(CmsTreeItem item) {\r\n\r\n for (String childId : m_childrens.get(item.getId())) {\r\n CmsTreeItem child = m_categories.get(childId);\r\n deselectChildren(child);\r\n child.getCheckBox().setChecked(false);\r\n if (m_selectedCategories.contains(childId)) {\r\n m_selectedCategories.remove(childId);\r\n }\r\n }\r\n }",
"@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoLocalDateTime<Symmetry010Date> localDateTime(TemporalAccessor temporal) {\n return (ChronoLocalDateTime<Symmetry010Date>) super.localDateTime(temporal);\n }",
"private static CharSequence convertReverseDNSIPv4(String str, int suffixStartIndex) throws AddressStringException {\n\t\tStringBuilder builder = new StringBuilder(suffixStartIndex);\n\t\tint segCount = 0;\n\t\tint j = suffixStartIndex;\n\t\tfor(int i = suffixStartIndex - 1; i > 0; i--) {\n\t\t\tchar c1 = str.charAt(i);\n\t\t\tif(c1 == IPv4Address.SEGMENT_SEPARATOR) {\n\t\t\t\tif(j - i <= 1) {\n\t\t\t\t\tthrow new AddressStringException(str, i);\n\t\t\t\t}\n\t\t\t\tfor(int k = i + 1; k < j; k++) {\n\t\t\t\t\tbuilder.append(str.charAt(k));\n\t\t\t\t}\n\t\t\t\tbuilder.append(c1);\n\t\t\t\tj = i;\n\t\t\t\tsegCount++;\n\t\t\t}\n\t\t}\n\t\tfor(int k = 0; k < j; k++) {\n\t\t\tbuilder.append(str.charAt(k));\n\t\t}\n\t\tif(segCount + 1 != IPv4Address.SEGMENT_COUNT) {\n\t\t\tthrow new AddressStringException(str, 0);\n\t\t}\n\t\treturn builder;\n\t}",
"private void deliverWaveformPreviewUpdate(final int player, final WaveformPreview preview) {\n final Set<WaveformListener> listeners = getWaveformListeners();\n if (!listeners.isEmpty()) {\n SwingUtilities.invokeLater(new Runnable() {\n @Override\n public void run() {\n final WaveformPreviewUpdate update = new WaveformPreviewUpdate(player, preview);\n for (final WaveformListener listener : listeners) {\n try {\n listener.previewChanged(update);\n\n } catch (Throwable t) {\n logger.warn(\"Problem delivering waveform preview update to listener\", t);\n }\n }\n }\n });\n }\n }",
"protected static boolean isOperatorLR( Symbol s ) {\n if( s == null )\n return false;\n\n switch( s ) {\n case ELEMENT_DIVIDE:\n case ELEMENT_TIMES:\n case ELEMENT_POWER:\n case RDIVIDE:\n case LDIVIDE:\n case TIMES:\n case POWER:\n case PLUS:\n case MINUS:\n case ASSIGN:\n return true;\n }\n return false;\n }",
"public void rotateWithPivot(float quatW, float quatX, float quatY,\n float quatZ, float pivotX, float pivotY, float pivotZ) {\n NativeTransform.rotateWithPivot(getNative(), quatW, quatX, quatY,\n quatZ, pivotX, pivotY, pivotZ);\n }",
"@Override\n public void detachScriptFile(IScriptable target) {\n IScriptFile scriptFile = mScriptMap.remove(target);\n if (scriptFile != null) {\n scriptFile.invokeFunction(\"onDetach\", new Object[] { target });\n }\n }",
"public static boolean isArray(Type type) {\n return (type instanceof GenericArrayType) || (type instanceof Class<?> && ((Class<?>) type).isArray());\n }",
"public ServerGroup getServerGroup(int id, int profileId) throws Exception {\n PreparedStatement queryStatement = null;\n ResultSet results = null;\n\n if (id == 0) {\n return new ServerGroup(0, \"Default\", profileId);\n }\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n queryStatement = sqlConnection.prepareStatement(\n \"SELECT * FROM \" + Constants.DB_TABLE_SERVER_GROUPS +\n \" WHERE \" + Constants.GENERIC_ID + \" = ?\"\n );\n queryStatement.setInt(1, id);\n results = queryStatement.executeQuery();\n if (results.next()) {\n ServerGroup curGroup = new ServerGroup(results.getInt(Constants.GENERIC_ID),\n results.getString(Constants.GENERIC_NAME),\n results.getInt(Constants.GENERIC_PROFILE_ID));\n return curGroup;\n }\n logger.info(\"Did not find the ID: {}\", id);\n } catch (SQLException e) {\n throw e;\n } finally {\n try {\n if (results != null) {\n results.close();\n }\n } catch (Exception e) {\n }\n try {\n if (queryStatement != null) {\n queryStatement.close();\n }\n } catch (Exception e) {\n }\n }\n return null;\n }"
] |
If status is in failed state then throw CloudException. | [
"void throwCloudExceptionIfInFailedState() {\n if (this.isStatusFailed()) {\n if (this.errorBody() != null) {\n throw new CloudException(\"Async operation failed with provisioning state: \" + this.status(), this.response(), this.errorBody());\n } else {\n throw new CloudException(\"Async operation failed with provisioning state: \" + this.status(), this.response());\n }\n }\n }"
] | [
"public void setInvalidValues(final Set<String> invalidValues,\n final boolean isCaseSensitive,\n final String invalidValueErrorMessage) {\n if (isCaseSensitive) {\n this.invalidValues = invalidValues;\n } else {\n this.invalidValues = new HashSet<String>();\n for (String value : invalidValues) {\n this.invalidValues.add(value.toLowerCase());\n }\n }\n this.isCaseSensitive = isCaseSensitive;\n this.invalidValueErrorMessage = invalidValueErrorMessage;\n }",
"public int getIntegerBelief(String name){\n Object belief = introspector.getBeliefBase(this).get(name);\n int count = 0;\n if (belief!=null) {\n count = (Integer) belief;\n }\n return (Integer) count;\n }",
"public double Function1D(double x) {\n double frequency = initFrequency;\n double amplitude = initAmplitude;\n double sum = 0;\n\n // octaves\n for (int i = 0; i < octaves; i++) {\n sum += SmoothedNoise(x * frequency) * amplitude;\n\n frequency *= 2;\n amplitude *= persistence;\n }\n return sum;\n }",
"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 }",
"static <T, ID> Dao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException {\n\t\treturn new BaseDaoImpl<T, ID>(connectionSource, clazz) {\n\t\t};\n\t}",
"protected List<I_CmsFacetQueryItem> parseFacetQueryItems(final String path) throws Exception {\n\n final List<I_CmsXmlContentValue> values = m_xml.getValues(path, m_locale);\n if (values == null) {\n return null;\n } else {\n List<I_CmsFacetQueryItem> parsedItems = new ArrayList<I_CmsFacetQueryItem>(values.size());\n for (I_CmsXmlContentValue value : values) {\n I_CmsFacetQueryItem item = parseFacetQueryItem(value.getPath() + \"/\");\n if (null != item) {\n parsedItems.add(item);\n } else {\n // TODO: log\n }\n }\n return parsedItems;\n }\n }",
"private Resolvable createMetadataProvider(Class<?> rawType) {\n Set<Type> types = Collections.<Type>singleton(rawType);\n return new ResolvableImpl(rawType, types, declaringBean, qualifierInstances, delegate);\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 }",
"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 }"
] |
Provides a collection of all the nodes in the tree
using a depth first traversal.
@return the list of (depth-first) ordered nodes | [
"public List depthFirst() {\n List answer = new NodeList();\n answer.add(this);\n answer.addAll(depthFirstRest());\n return answer;\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 }",
"public ResultSetAndStatement executeSQL(\r\n final String sql,\r\n ClassDescriptor cld,\r\n ValueContainer[] values,\r\n boolean scrollable)\r\n throws PersistenceBrokerException\r\n {\r\n if (logger.isDebugEnabled()) logger.debug(\"executeSQL: \" + sql);\r\n final boolean isStoredprocedure = isStoredProcedure(sql);\r\n final StatementManagerIF sm = broker.serviceStatementManager();\r\n PreparedStatement stmt = null;\r\n ResultSet rs = null;\r\n try\r\n {\r\n stmt = sm.getPreparedStatement(cld, sql,\r\n scrollable, StatementManagerIF.FETCH_SIZE_NOT_EXPLICITLY_SET, 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.bindValues(stmt, values, 2);\r\n stmt.execute();\r\n rs = (ResultSet) ((CallableStatement) stmt).getObject(1);\r\n }\r\n else\r\n {\r\n sm.bindValues(stmt, values, 1);\r\n rs = stmt.executeQuery();\r\n }\r\n\r\n // as we return the resultset for further operations, we cannot release the statement yet.\r\n // that has to be done by the JdbcAccess-clients (i.e. RsIterator, ProxyRsIterator and PkEnumeration.)\r\n return new ResultSetAndStatement(sm, stmt, rs, new SelectStatement()\r\n {\r\n public Query getQueryInstance()\r\n {\r\n return null;\r\n }\r\n\r\n public int getColumnIndex(FieldDescriptor fld)\r\n {\r\n return JdbcType.MIN_INT;\r\n }\r\n\r\n public String getStatement()\r\n {\r\n return sql;\r\n }\r\n });\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 SQL 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, cld, values, logger, null);\r\n }\r\n }",
"public static final String printTaskType(TaskType value)\n {\n return (Integer.toString(value == null ? TaskType.FIXED_UNITS.getValue() : value.getValue()));\n }",
"public void addControl(String name, JSONObject properties, Widget.OnTouchListener listener) {\n final JSONObject allowedProperties = new JSONObject();\n put(allowedProperties, Widget.Properties.name, optString(properties, Widget.Properties.name));\n put(allowedProperties, Widget.Properties.size, new PointF(mControlDimensions.x, mControlDimensions.y));\n put(allowedProperties, Widget.Properties.states, optJSONObject(properties, Widget.Properties.states));\n\n Widget control = new Widget(getGVRContext(), allowedProperties);\n setupControl(name, control, listener, -1);\n }",
"public static boolean setCustomResponseForDefaultClient(String profileName, String pathName, String customData) {\n try {\n return setCustomForDefaultClient(profileName, pathName, true, customData);\n } catch (Exception e) {\n e.printStackTrace();\n }\n return false;\n }",
"private void purgeDeadJobInstances(DbConn cnx, Node node)\n {\n for (JobInstance ji : JobInstance.select(cnx, \"ji_select_by_node\", node.getId()))\n {\n try\n {\n cnx.runSelectSingle(\"history_select_state_by_id\", String.class, ji.getId());\n }\n catch (NoResultException e)\n {\n History.create(cnx, ji, State.CRASHED, Calendar.getInstance());\n Message.create(cnx,\n \"Job was supposed to be running at server startup - usually means it was killed along a server by an admin or a crash\",\n ji.getId());\n }\n\n cnx.runUpdate(\"ji_delete_by_id\", ji.getId());\n }\n cnx.commit();\n }",
"public void updateRequestByAddingReplaceVarPair(\n ParallelTask task, String replaceVarKey, String replaceVarValue) {\n\n Map<String, NodeReqResponse> taskResult = task.getParallelTaskResult();\n\n for (Entry<String, NodeReqResponse> entry : taskResult.entrySet()) {\n NodeReqResponse nodeReqResponse = entry.getValue();\n\n nodeReqResponse.getRequestParameters()\n .put(PcConstants.NODE_REQUEST_PREFIX_REPLACE_VAR\n + replaceVarKey, replaceVarValue);\n nodeReqResponse.getRequestParameters().put(\n PcConstants.NODE_REQUEST_WILL_EXECUTE,\n Boolean.toString(true));\n\n }// end for loop\n\n }",
"public int execute(DatabaseConnection databaseConnection, T data, ID newId, ObjectCache objectCache)\n\t\t\tthrows SQLException {\n\t\ttry {\n\t\t\t// the arguments are the new-id and old-id\n\t\t\tObject[] args = new Object[] { convertIdToFieldObject(newId), extractIdToFieldObject(data) };\n\t\t\tint rowC = databaseConnection.update(statement, args, argFieldTypes);\n\t\t\tif (rowC > 0) {\n\t\t\t\tif (objectCache != null) {\n\t\t\t\t\tObject oldId = idField.extractJavaFieldValue(data);\n\t\t\t\t\tT obj = objectCache.updateId(clazz, oldId, newId);\n\t\t\t\t\tif (obj != null && obj != data) {\n\t\t\t\t\t\t// if our cached value is not the data that will be updated then we need to update it specially\n\t\t\t\t\t\tidField.assignField(connectionSource, obj, newId, false, objectCache);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// adjust the object to assign the new id\n\t\t\t\tidField.assignField(connectionSource, data, newId, false, objectCache);\n\t\t\t}\n\t\t\tlogger.debug(\"updating-id 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 cast otherwise we only print the first object in args\n\t\t\t\tlogger.trace(\"updating-id 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-id stmt on object \" + data + \": \" + statement, e);\n\t\t}\n\t}",
"public static Status from(Set<ServiceReference> serviceReferencesBound, Set<ServiceReference> serviceReferencesHandled) {\n if (serviceReferencesBound == null && serviceReferencesHandled == null) {\n throw new IllegalArgumentException(\"Cannot create a status with serviceReferencesBound == null\" +\n \"and serviceReferencesHandled == null\");\n } else if (serviceReferencesBound == null) {\n throw new IllegalArgumentException(\"Cannot create a status with serviceReferencesBound == null\");\n } else if (serviceReferencesHandled == null) {\n throw new IllegalArgumentException(\"Cannot create a status with serviceReferencesHandled == null\");\n }\n return new Status(serviceReferencesBound, serviceReferencesHandled);\n }"
] |
Set up server for report directory. | [
"private Server setUpServer() {\n Server server = new Server(port);\n ResourceHandler handler = new ResourceHandler();\n handler.setDirectoriesListed(true);\n handler.setWelcomeFiles(new String[]{\"index.html\"});\n handler.setResourceBase(getReportDirectoryPath().toAbsolutePath().toString());\n HandlerList handlers = new HandlerList();\n handlers.setHandlers(new Handler[]{handler, new DefaultHandler()});\n server.setStopAtShutdown(true);\n server.setHandler(handlers);\n return server;\n }"
] | [
"void createDirectory(Path path) throws IOException {\n\t\tif (Files.exists(path) && Files.isDirectory(path)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.readOnly) {\n\t\t\tthrow new FileNotFoundException(\n\t\t\t\t\t\"The requested directory \\\"\"\n\t\t\t\t\t\t\t+ path.toString()\n\t\t\t\t\t\t\t+ \"\\\" does not exist and we are in read-only mode, so it cannot be created.\");\n\t\t}\n\n\t\tFiles.createDirectory(path);\n\t}",
"public Object newInstance(String resource) {\n try {\n String name = resource.startsWith(\"/\") ? resource : \"/\" + resource;\n File file = new File(this.getClass().getResource(name).toURI());\n return newInstance(classLoader.parseClass(new GroovyCodeSource(file), true));\n } catch (Exception e) {\n throw new GroovyClassInstantiationFailed(classLoader, resource, e);\n }\n }",
"public static boolean nullSafeEquals(final Object obj1, final Object obj2) {\n return ((obj1 == null && obj2 == null)\n || (obj1 != null && obj2 != null && obj1.equals(obj2)));\n }",
"private void handleTextWebSocketFrameInternal(TextWebSocketFrame frame, ChannelHandlerContext ctx) {\n\t\tif (logger.isTraceEnabled()) {\n\t\t\tlogger.trace(String.format(\"%s received %s\", ctx.channel(), frame.text()));\n\t\t}\n\n\t\taddTraceForFrame(frame, \"text\");\n\t\tctx.channel().write(new TextWebSocketFrame(\"Echo: \" + frame.text()));\n\t}",
"private String getRelativePomPath(MavenModule mavenModule, MavenModuleSetBuild mavenBuild) {\n String relativePath = mavenModule.getRelativePath();\n if (StringUtils.isBlank(relativePath)) {\n return POM_NAME;\n }\n\n // If this is the root module, return the root pom path.\n if (mavenModule.getModuleName().toString().\n equals(mavenBuild.getProject().getRootModule().getModuleName().toString())) {\n return mavenBuild.getProject().getRootPOM(null);\n }\n\n // to remove the project folder name if exists\n // keeps only the name of the module\n String modulePath = relativePath.substring(relativePath.indexOf(\"/\") + 1);\n for (String moduleName : mavenModules) {\n if (moduleName.contains(modulePath)) {\n return createPomPath(relativePath, moduleName);\n }\n }\n\n // In case this module is not in the parent pom\n return relativePath + \"/\" + POM_NAME;\n }",
"public static List<String> enableJMX(List<String> jvmArgs) {\n final String arg = \"-D\" + OPT_JMX_REMOTE;\n if (jvmArgs.contains(arg))\n return jvmArgs;\n final List<String> cmdLine2 = new ArrayList<>(jvmArgs);\n cmdLine2.add(arg);\n return cmdLine2;\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 boolean queryHasResult(Statement stmt, String sql) {\n try {\n ResultSet rs = stmt.executeQuery(sql);\n try {\n return rs.next();\n } finally {\n rs.close();\n }\n } catch (SQLException e) {\n throw new DukeException(e);\n }\n }",
"private void sendEmptyRequest(String path, String method) throws DatastoreEmulatorException {\n HttpURLConnection connection = null;\n try {\n URL url = new URL(this.host + path);\n connection = (HttpURLConnection) url.openConnection();\n connection.setDoOutput(true);\n connection.setRequestMethod(method);\n connection.getOutputStream().close();\n if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {\n throw new DatastoreEmulatorException(\n String.format(\n \"%s request to %s returned HTTP status %s\",\n method, path, connection.getResponseCode()));\n }\n } catch (IOException e) {\n throw new DatastoreEmulatorException(\n String.format(\"Exception connecting to emulator on %s request to %s\", method, path), e);\n } finally {\n if (connection != null) {\n connection.disconnect();\n }\n }\n }"
] |
Alternative entry point allowing an MPP file to be read from
a user-supplied POI file stream.
@param fs POI file stream
@return ProjectFile instance
@throws MPXJException | [
"public ProjectFile read(POIFSFileSystem fs) throws MPXJException\n {\n try\n {\n ProjectFile projectFile = new ProjectFile();\n ProjectConfig config = projectFile.getProjectConfig();\n\n config.setAutoTaskID(false);\n config.setAutoTaskUniqueID(false);\n config.setAutoResourceID(false);\n config.setAutoResourceUniqueID(false);\n config.setAutoOutlineLevel(false);\n config.setAutoOutlineNumber(false);\n config.setAutoWBS(false);\n config.setAutoCalendarUniqueID(false);\n config.setAutoAssignmentUniqueID(false);\n\n projectFile.getEventManager().addProjectListeners(m_projectListeners);\n\n //\n // Open the file system and retrieve the root directory\n //\n DirectoryEntry root = fs.getRoot();\n\n //\n // Retrieve the CompObj data, validate the file format and process\n //\n CompObj compObj = new CompObj(new DocumentInputStream((DocumentEntry) root.getEntry(\"\\1CompObj\")));\n ProjectProperties projectProperties = projectFile.getProjectProperties();\n projectProperties.setFullApplicationName(compObj.getApplicationName());\n projectProperties.setApplicationVersion(compObj.getApplicationVersion());\n String format = compObj.getFileFormat();\n Class<? extends MPPVariantReader> readerClass = FILE_CLASS_MAP.get(format);\n if (readerClass == null)\n {\n throw new MPXJException(MPXJException.INVALID_FILE + \": \" + format);\n }\n MPPVariantReader reader = readerClass.newInstance();\n reader.process(this, projectFile, root);\n\n //\n // Update the internal structure. We'll take this opportunity to\n // generate outline numbers for the tasks as they don't appear to\n // be present in the MPP file.\n //\n config.setAutoOutlineNumber(true);\n projectFile.updateStructure();\n config.setAutoOutlineNumber(false);\n\n //\n // Perform post-processing to set the summary flag and clean\n // up any instances where a task has an empty splits list.\n //\n for (Task task : projectFile.getTasks())\n {\n task.setSummary(task.hasChildTasks());\n List<DateRange> splits = task.getSplits();\n if (splits != null && splits.isEmpty())\n {\n task.setSplits(null);\n }\n validationRelations(task);\n }\n\n //\n // Ensure that the unique ID counters are correct\n //\n config.updateUniqueCounters();\n\n //\n // Add some analytics\n //\n String projectFilePath = projectFile.getProjectProperties().getProjectFilePath();\n if (projectFilePath != null && projectFilePath.startsWith(\"<>\\\\\"))\n {\n projectProperties.setFileApplication(\"Microsoft Project Server\");\n }\n else\n {\n projectProperties.setFileApplication(\"Microsoft\");\n }\n projectProperties.setFileType(\"MPP\");\n\n return (projectFile);\n }\n\n catch (IOException ex)\n {\n throw new MPXJException(MPXJException.READ_ERROR, ex);\n }\n\n catch (IllegalAccessException ex)\n {\n throw new MPXJException(MPXJException.READ_ERROR, ex);\n }\n\n catch (InstantiationException ex)\n {\n throw new MPXJException(MPXJException.READ_ERROR, ex);\n }\n }"
] | [
"public static base_response save(nitro_service client, cachecontentgroup resource) throws Exception {\n\t\tcachecontentgroup saveresource = new cachecontentgroup();\n\t\tsaveresource.name = resource.name;\n\t\treturn saveresource.perform_operation(client,\"save\");\n\t}",
"public Collection<String> getMethods() throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_METHODS);\r\n\r\n Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n\r\n Element methodsElement = response.getPayload();\r\n\r\n List<String> methods = new ArrayList<String>();\r\n NodeList methodElements = methodsElement.getElementsByTagName(\"method\");\r\n for (int i = 0; i < methodElements.getLength(); i++) {\r\n Element methodElement = (Element) methodElements.item(i);\r\n methods.add(XMLUtilities.getValue(methodElement));\r\n }\r\n return methods;\r\n }",
"public RelatedTagsList getRelated(String tag) throws FlickrException {\n\n Map<String, Object> parameters = new HashMap<String, Object>();\n parameters.put(\"method\", METHOD_GET_RELATED);\n\n parameters.put(\"tag\", tag);\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 Element tagsElement = response.getPayload();\n\n RelatedTagsList tags = new RelatedTagsList();\n tags.setSource(tagsElement.getAttribute(\"source\"));\n NodeList tagElements = tagsElement.getElementsByTagName(\"tag\");\n for (int i = 0; i < tagElements.getLength(); i++) {\n Element tagElement = (Element) tagElements.item(i);\n Tag t = new Tag();\n t.setValue(XMLUtilities.getValue(tagElement));\n tags.add(t);\n }\n return tags;\n }",
"public static byte[] getDocumentToByteArray(Document dom) {\n try {\n TransformerFactory tFactory = TransformerFactory.newInstance();\n\n Transformer transformer = tFactory.newTransformer();\n transformer.setOutputProperty(OutputKeys.INDENT, \"yes\");\n transformer\n .setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, \"no\");\n transformer.setOutputProperty(OutputKeys.METHOD, \"html\");\n // TODO should be fixed to read doctype declaration\n transformer\n .setOutputProperty(\n OutputKeys.DOCTYPE_PUBLIC,\n \"-//W3C//DTD XHTML 1.0 Strict//EN\\\" \"\n + \"\\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\");\n\n DOMSource source = new DOMSource(dom);\n\n ByteArrayOutputStream out = new ByteArrayOutputStream();\n Result result = new StreamResult(out);\n transformer.transform(source, result);\n\n return out.toByteArray();\n } catch (TransformerException e) {\n LOGGER.error(\"Error while converting the document to a byte array\",\n e);\n }\n return null;\n\n }",
"public static base_response add(nitro_service client, appfwjsoncontenttype resource) throws Exception {\n\t\tappfwjsoncontenttype addresource = new appfwjsoncontenttype();\n\t\taddresource.jsoncontenttypevalue = resource.jsoncontenttypevalue;\n\t\taddresource.isregex = resource.isregex;\n\t\treturn addresource.add_resource(client);\n\t}",
"public Object get(int dataSet) throws SerializationException {\r\n\t\tObject result = null;\r\n\t\tfor (Iterator<DataSet> i = dataSets.iterator(); i.hasNext();) {\r\n\t\t\tDataSet ds = i.next();\r\n\t\t\tDataSetInfo info = ds.getInfo();\r\n\t\t\tif (info.getDataSetNumber() == dataSet) {\r\n\t\t\t\tresult = getData(ds);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}",
"@Override\n public final Double optDouble(final String key, final Double defaultValue) {\n Double result = optDouble(key);\n return result == null ? defaultValue : result;\n }",
"static boolean uninstall() {\n boolean uninstalled = false;\n synchronized (lock) {\n if (locationCollectionClient != null) {\n locationCollectionClient.locationEngineController.onDestroy();\n locationCollectionClient.settingsChangeHandlerThread.quit();\n locationCollectionClient.sharedPreferences.unregisterOnSharedPreferenceChangeListener(locationCollectionClient);\n locationCollectionClient = null;\n uninstalled = true;\n }\n }\n return uninstalled;\n }",
"private void parseResponse(InputStream inputStream) {\n\n try {\n DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();\n DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();\n Document doc = dBuilder.parse(inputStream);\n doc.getDocumentElement().normalize();\n\n NodeList nodes = doc.getElementsByTagName(\"place\");\n\n for (int i = 0; i < nodes.getLength(); i++) {\n Node node = nodes.item(i);\n\n if (node.getNodeType() == Node.ELEMENT_NODE) {\n Element element = (Element) node;\n _woeid = getValue(\"woeid\", element);\n }\n }\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n }"
] |
Polls from the provided URL and updates the polling state with the
polling response.
@param pollingState the polling state for the current operation.
@param url the url to poll from
@param <T> the return type of the caller. | [
"private <T> Observable<PollingState<T>> updateStateFromGetResourceOperationAsync(final PollingState<T> pollingState, String url) {\n return pollAsync(url, pollingState.loggingContext())\n .flatMap(new Func1<Response<ResponseBody>, Observable<PollingState<T>>>() {\n @Override\n public Observable<PollingState<T>> call(Response<ResponseBody> response) {\n try {\n pollingState.updateFromResponseOnPutPatch(response);\n return Observable.just(pollingState);\n } catch (CloudException | IOException e) {\n return Observable.error(e);\n }\n }\n });\n }"
] | [
"private org.apache.log4j.Logger getLogger()\r\n\t{\r\n /*\r\n Logger interface extends Serializable, thus Log field is\r\n declared 'transient' and we have to null-check\r\n\t\t*/\r\n\t\tif (logger == null)\r\n\t\t{\r\n\t\t\tlogger = org.apache.log4j.Logger.getLogger(name);\r\n\t\t}\r\n\t\treturn logger;\r\n\t}",
"public static Thread newThread(String name, Runnable runnable, boolean daemon) {\n Thread thread = new Thread(runnable, name);\n thread.setDaemon(daemon);\n return thread;\n }",
"public void contextInitialized(ServletContextEvent event) {\n this.context = event.getServletContext();\n\n // Output a simple message to the server's console\n System.out.println(\"The Simple Web App. Is Ready\");\n\n ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(\n \"/client.xml\");\n LocatorService client = (LocatorService) context\n .getBean(\"locatorService\");\n\n String serviceHost = this.context.getInitParameter(\"serviceHost\");\n\n try {\n client.registerEndpoint(new QName(\n \"http://talend.org/esb/examples/\", \"GreeterService\"),\n serviceHost, BindingType.SOAP_11, TransportType.HTTP, null);\n } catch (InterruptedExceptionFault e) {\n e.printStackTrace();\n } catch (ServiceLocatorFault e) {\n e.printStackTrace();\n }\n }",
"public void strokeRectangle(Rectangle rect, Color color, float linewidth) {\n\t\tstrokeRectangle(rect, color, linewidth, null);\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 static Filter.Builder makeAndFilter(Iterable<Filter> subfilters) {\n return Filter.newBuilder()\n .setCompositeFilter(CompositeFilter.newBuilder()\n .addAllFilters(subfilters)\n .setOp(CompositeFilter.Operator.AND));\n }",
"protected DirectiveStatement parseDirectiveStatement(DirectiveStContext node)\r\n\t{\r\n\t\tDirectiveStContext stContext = (DirectiveStContext) node;\r\n\t\tDirectiveExpContext direExp = stContext.directiveExp();\r\n\t\tToken token = direExp.Identifier().getSymbol();\r\n\t\tString directive = token.getText().toLowerCase().intern();\r\n\t\tTerminalNode value = direExp.StringLiteral();\r\n\t\tList<TerminalNode> idNodeList = null;\r\n\t\tDirectiveExpIDListContext directExpidLisCtx = direExp.directiveExpIDList();\r\n\t\tif (directExpidLisCtx != null)\r\n\t\t{\r\n\t\t\tidNodeList = directExpidLisCtx.Identifier();\r\n\t\t}\r\n\r\n\t\tSet<String> idList = null;\r\n\t\tDirectiveStatement ds = null;\r\n\r\n\t\tif (value != null)\r\n\t\t{\r\n\t\t\tString idListValue = this.getStringValue(value.getText());\r\n\t\t\tidList = new HashSet(Arrays.asList(idListValue.split(\",\")));\r\n\t\t\tds = new DirectiveStatement(directive, idList, this.getBTToken(token));\r\n\r\n\t\t}\r\n\t\telse if (idNodeList != null)\r\n\t\t{\r\n\t\t\tidList = new HashSet<String>();\r\n\t\t\tfor (TerminalNode t : idNodeList)\r\n\t\t\t{\r\n\t\t\t\tidList.add(t.getText());\r\n\t\t\t}\r\n\t\t\tds = new DirectiveStatement(directive, idList, this.getBTToken(token));\r\n\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tds = new DirectiveStatement(directive, Collections.EMPTY_SET, this.getBTToken(token));\r\n\t\t}\r\n\r\n\t\tif (directive.equals(\"dynamic\"))\r\n\t\t{\r\n\r\n\t\t\tif (ds.getIdList().size() == 0)\r\n\t\t\t{\r\n\t\t\t\tdata.allDynamic = true;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tdata.dynamicObjectSet = ds.getIdList();\r\n\t\t\t}\r\n\t\t\tds = new DirectiveStatement(directive, Collections.EMPTY_SET, this.getBTToken(token));\r\n\t\t\t\r\n\t\t\treturn ds;\r\n\r\n\t\t}\r\n\t\telse if (directive.equalsIgnoreCase(\"safe_output_open\".intern()))\r\n\t\t{\r\n\t\t\tthis.pbCtx.isSafeOutput = true;\r\n\t\t\treturn ds;\r\n\t\t}\r\n\t\telse if (directive.equalsIgnoreCase(\"safe_output_close\".intern()))\r\n\t\t{\r\n\t\t\tthis.pbCtx.isSafeOutput = false;\r\n\t\t\treturn ds;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn ds;\r\n\t\t}\r\n\t}",
"public static ProxyMetaClass getInstance(Class theClass) throws IntrospectionException {\n MetaClassRegistry metaRegistry = GroovySystem.getMetaClassRegistry();\n MetaClass meta = metaRegistry.getMetaClass(theClass);\n return new ProxyMetaClass(metaRegistry, theClass, meta);\n }",
"void update(Object feature) throws LayerException {\n\t\tSimpleFeatureSource source = getFeatureSource();\n\t\tif (source instanceof SimpleFeatureStore) {\n\t\t\tSimpleFeatureStore store = (SimpleFeatureStore) source;\n\t\t\tString featureId = getFeatureModel().getId(feature);\n\t\t\tFilter filter = filterService.createFidFilter(new String[] { featureId });\n\t\t\ttransactionSynchronization.synchTransaction(store);\n\t\t\tList<Name> names = new ArrayList<Name>();\n\t\t\tMap<String, Attribute> attrMap = getFeatureModel().getAttributes(feature);\n\t\t\tList<Object> values = new ArrayList<Object>();\n\t\t\tfor (Map.Entry<String, Attribute> entry : attrMap.entrySet()) {\n\t\t\t\tString name = entry.getKey();\n\t\t\t\tnames.add(store.getSchema().getDescriptor(name).getName());\n\t\t\t\tvalues.add(entry.getValue().getValue());\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tstore.modifyFeatures(names.toArray(new Name[names.size()]), values.toArray(), filter);\n\t\t\t\tstore.modifyFeatures(store.getSchema().getGeometryDescriptor().getName(), getFeatureModel()\n\t\t\t\t\t\t.getGeometry(feature), filter);\n\t\t\t\tlog.debug(\"Updated feature {} in {}\", featureId, getFeatureSourceName());\n\t\t\t} catch (IOException ioe) {\n\t\t\t\tfeatureModelUsable = false;\n\t\t\t\tthrow new LayerException(ioe, ExceptionCode.LAYER_MODEL_IO_EXCEPTION);\n\t\t\t}\n\t\t} else {\n\t\t\tlog.error(\"Don't know how to create or update \" + getFeatureSourceName() + \", class \"\n\t\t\t\t\t+ source.getClass().getName() + \" does not implement SimpleFeatureStore\");\n\t\t\tthrow new LayerException(ExceptionCode.CREATE_OR_UPDATE_NOT_IMPLEMENTED, getFeatureSourceName(), source\n\t\t\t\t\t.getClass().getName());\n\t\t}\n\t}"
] |
Override this method to supply a custom splash screen image.
@param gvrContext
The new {@link GVRContext}
@return Texture to display
@since 1.6.4 | [
"public GVRTexture getSplashTexture(GVRContext gvrContext) {\n Bitmap bitmap = BitmapFactory.decodeResource( //\n gvrContext.getContext().getResources(), //\n R.drawable.__default_splash_screen__);\n GVRTexture tex = new GVRTexture(gvrContext);\n tex.setImage(new GVRBitmapImage(gvrContext, bitmap));\n return tex;\n }"
] | [
"public IPlan[] getAgentPlans(final String agent_name, Connector connector) {\n ((IExternalAccess) connector.getAgentsExternalAccess(agent_name))\n .scheduleStep(new IComponentStep<Plan>() {\n\n public IFuture<Plan> execute(IInternalAccess ia) {\n\n IBDIInternalAccess bia = (IBDIInternalAccess) ia;\n plans = bia.getPlanbase().getPlans();\n return null;\n }\n }).get(new ThreadSuspendable());\n\n return plans;\n }",
"public B set(String key, int value) {\n this.data.put(key, value);\n return (B) this;\n }",
"private static void checkPreconditions(final int maxSize, final String suffix) {\n\t\tif( maxSize <= 0 ) {\n\t\t\tthrow new IllegalArgumentException(String.format(\"maxSize should be > 0 but was %d\", maxSize));\n\t\t}\n\t\tif( suffix == null ) {\n\t\t\tthrow new NullPointerException(\"suffix should not be null\");\n\t\t}\n\t}",
"public static String getDumpFilePostfix(DumpContentType dumpContentType) {\n\t\tif (WmfDumpFile.POSTFIXES.containsKey(dumpContentType)) {\n\t\t\treturn WmfDumpFile.POSTFIXES.get(dumpContentType);\n\t\t} else {\n\t\t\tthrow new IllegalArgumentException(\"Unsupported dump type \"\n\t\t\t\t\t+ dumpContentType);\n\t\t}\n\t}",
"public static String readFileContents(FileSystem fs, Path path, int bufferSize)\n throws IOException {\n if(bufferSize <= 0)\n return new String();\n\n FSDataInputStream input = fs.open(path);\n byte[] buffer = new byte[bufferSize];\n\n ByteArrayOutputStream stream = new ByteArrayOutputStream();\n\n while(true) {\n int read = input.read(buffer);\n if(read < 0) {\n break;\n } else {\n buffer = ByteUtils.copy(buffer, 0, read);\n }\n stream.write(buffer);\n }\n\n return new String(stream.toByteArray());\n }",
"public void writeTo(Writer destination) {\n Element eltRuleset = new Element(\"ruleset\");\n addAttribute(eltRuleset, \"name\", name);\n addChild(eltRuleset, \"description\", description);\n for (PmdRule pmdRule : rules) {\n Element eltRule = new Element(\"rule\");\n addAttribute(eltRule, \"ref\", pmdRule.getRef());\n addAttribute(eltRule, \"class\", pmdRule.getClazz());\n addAttribute(eltRule, \"message\", pmdRule.getMessage());\n addAttribute(eltRule, \"name\", pmdRule.getName());\n addAttribute(eltRule, \"language\", pmdRule.getLanguage());\n addChild(eltRule, \"priority\", String.valueOf(pmdRule.getPriority()));\n if (pmdRule.hasProperties()) {\n Element ruleProperties = processRuleProperties(pmdRule);\n if (ruleProperties.getContentSize() > 0) {\n eltRule.addContent(ruleProperties);\n }\n }\n eltRuleset.addContent(eltRule);\n }\n XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat());\n try {\n serializer.output(new Document(eltRuleset), destination);\n } catch (IOException e) {\n throw new IllegalStateException(\"An exception occurred while serializing PmdRuleSet.\", e);\n }\n }",
"private boolean isSpecial(final char chr) {\n\t\treturn ((chr == '.') || (chr == '?') || (chr == '*') || (chr == '^') || (chr == '$') || (chr == '+')\n\t\t\t\t|| (chr == '[') || (chr == ']') || (chr == '(') || (chr == ')') || (chr == '|') || (chr == '\\\\')\n\t\t\t\t|| (chr == '&'));\n\t}",
"public void localBegin()\r\n {\r\n if (this.isInLocalTransaction)\r\n {\r\n throw new TransactionInProgressException(\"Connection is already in transaction\");\r\n }\r\n Connection connection = null;\r\n try\r\n {\r\n connection = this.getConnection();\r\n }\r\n catch (LookupException e)\r\n {\r\n /**\r\n * must throw to notify user that we couldn't start a connection\r\n */\r\n throw new PersistenceBrokerException(\"Can't lookup a connection\", e);\r\n }\r\n if (log.isDebugEnabled()) log.debug(\"localBegin was called for con \" + connection);\r\n // change autoCommit state only if we are not in a managed environment\r\n // and it is enabled by user\r\n if(!broker.isManaged())\r\n {\r\n if (jcd.getUseAutoCommit() == JdbcConnectionDescriptor.AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE)\r\n {\r\n if (log.isDebugEnabled()) log.debug(\"Try to change autoCommit state to 'false'\");\r\n platform.changeAutoCommitState(jcd, connection, false);\r\n }\r\n }\r\n else\r\n {\r\n if(log.isDebugEnabled()) log.debug(\r\n \"Found managed environment setting in PB, will skip Platform.changeAutoCommitState(...) call\");\r\n }\r\n this.isInLocalTransaction = true;\r\n }",
"public static BoxCollaborationWhitelist.Info create(final BoxAPIConnection api, String domain,\n WhitelistDirection direction) {\n\n URL url = COLLABORATION_WHITELIST_ENTRIES_URL_TEMPLATE.build(api.getBaseURL());\n BoxJSONRequest request = new BoxJSONRequest(api, url, HttpMethod.POST);\n JsonObject requestJSON = new JsonObject()\n .add(\"domain\", domain)\n .add(\"direction\", direction.toString());\n\n request.setBody(requestJSON.toString());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n BoxCollaborationWhitelist domainWhitelist =\n new BoxCollaborationWhitelist(api, responseJSON.get(\"id\").asString());\n\n return domainWhitelist.new Info(responseJSON);\n }"
] |
Old REST client uses new REST service | [
"public void useNewRESTServiceWithOldClient() throws Exception {\n List<Object> providers = createJAXRSProviders();\n\n com.example.customerservice.CustomerService customerService = JAXRSClientFactory\n .createFromModel(\"http://localhost:\" + port + \"/examples/direct/new-rest\", \n com.example.customerservice.CustomerService.class,\n \"classpath:/model/CustomerService-jaxrs.xml\", \n providers, \n null);\n \n // The outgoing old Customer data needs to be transformed for \n // the new service to understand it and the response from the new service\n // needs to be transformed for this old client to understand it.\n ClientConfiguration config = WebClient.getConfig(customerService);\n addTransformInterceptors(config.getInInterceptors(),\n config.getOutInterceptors(),\n false);\n \n \n System.out.println(\"Using new RESTful CustomerService with old Client\");\n\n customer.v1.Customer customer = createOldCustomer(\"Smith Old to New REST\");\n customerService.updateCustomer(customer);\n\n customer = customerService.getCustomerByName(\"Smith Old to New REST\");\n printOldCustomerDetails(customer);\n }"
] | [
"public static appfwsignatures get(nitro_service service, String name) throws Exception{\n\t\tappfwsignatures obj = new appfwsignatures();\n\t\tobj.set_name(name);\n\t\tappfwsignatures response = (appfwsignatures) obj.get_resource(service);\n\t\treturn response;\n\t}",
"public static final String printPercent(Double value)\n {\n return value == null ? null : Double.toString(value.doubleValue() / 100.0);\n }",
"private void setCorrectDay(Calendar date) {\n\n if (monthHasNotDay(date)) {\n date.set(Calendar.DAY_OF_MONTH, date.getActualMaximum(Calendar.DAY_OF_MONTH));\n } else {\n date.set(Calendar.DAY_OF_MONTH, m_dayOfMonth);\n }\n }",
"@SuppressWarnings(\"unchecked\")\n public static <E> TypeConverter<E> typeConverterFor(Class<E> cls) throws NoSuchTypeConverterException {\n TypeConverter<E> typeConverter = TYPE_CONVERTERS.get(cls);\n if (typeConverter == null) {\n throw new NoSuchTypeConverterException(cls);\n }\n return typeConverter;\n }",
"@SuppressWarnings({\"unused\", \"WeakerAccess\"})\n public void recordScreen(String screenName){\n if(screenName == null || (!currentScreenName.isEmpty() && currentScreenName.equals(screenName))) return;\n getConfigLogger().debug(getAccountId(), \"Screen changed to \" + screenName);\n currentScreenName = screenName;\n recordPageEventWithExtras(null);\n }",
"@JsonProperty(\"labels\")\n @JsonInclude(Include.NON_EMPTY)\n public Map<String, TermImpl> getLabelUpdates() {\n \treturn getMonolingualUpdatedValues(newLabels);\n }",
"public List<Method> getMethodsFromGroupIds(int[] groupIds, String[] filters) throws Exception {\n ArrayList<Method> methods = new ArrayList<Method>();\n\n for (int groupId : groupIds) {\n methods.addAll(getMethodsFromGroupId(groupId, filters));\n }\n\n return methods;\n }",
"boolean awaitState(final InternalState expected) {\n synchronized (this) {\n final InternalState initialRequired = this.requiredState;\n for(;;) {\n final InternalState required = this.requiredState;\n // Stop in case the server failed to reach the state\n if(required == InternalState.FAILED) {\n return false;\n // Stop in case the required state changed\n } else if (initialRequired != required) {\n return false;\n }\n final InternalState current = this.internalState;\n if(expected == current) {\n return true;\n }\n try {\n wait();\n } catch(InterruptedException e) {\n Thread.currentThread().interrupt();\n return false;\n }\n }\n }\n }",
"@Override\n public final Boolean optBool(final String key, final Boolean defaultValue) {\n Boolean result = optBool(key);\n return result == null ? defaultValue : result;\n }"
] |
Returns a map of all variables in scope.
@return map of all variables in scope. | [
"protected Map getAllVariables(){\n try{\n Iterator names = FreeMarkerTL.getEnvironment().getKnownVariableNames().iterator();\n Map vars = new HashMap();\n while (names.hasNext()) {\n Object name =names.next();\n vars.put(name, get(name.toString()));\n }\n return vars;\n }catch(Exception e){\n throw new ViewException(e);\n }\n }"
] | [
"public ParallelTaskBuilder setHttpPollerProcessor(\n HttpPollerProcessor httpPollerProcessor) {\n this.httpMeta.setHttpPollerProcessor(httpPollerProcessor);\n this.httpMeta.setPollable(true);\n return this;\n }",
"@Override\r\n public String upload(InputStream in, UploadMetaData metaData) throws FlickrException {\r\n Payload payload = new Payload(in);\r\n return sendUploadRequest(metaData, payload);\r\n }",
"private void addCalendarException(MpxjTreeNode parentNode, final ProjectCalendarException exception)\n {\n MpxjTreeNode exceptionNode = new MpxjTreeNode(exception, CALENDAR_EXCEPTION_EXCLUDED_METHODS)\n {\n @Override public String toString()\n {\n return m_dateFormat.format(exception.getFromDate());\n }\n };\n parentNode.add(exceptionNode);\n addHours(exceptionNode, exception);\n }",
"public static String createUnquotedConstant(String str) {\n if (str == null || str.isEmpty()) {\n return str;\n }\n if (str.startsWith(\"\\\"\")) {\n str = str.substring(1);\n }\n if (str.endsWith(\"\\\"\")) {\n str = str.substring(0,\n str.length() - 1);\n }\n return str;\n }",
"public String[] getMethods(String pluginClass) throws Exception {\n ArrayList<String> methodNames = new ArrayList<String>();\n\n Method[] methods = getClass(pluginClass).getDeclaredMethods();\n for (Method method : methods) {\n logger.info(\"Checking {}\", method.getName());\n\n com.groupon.odo.proxylib.models.Method methodInfo = this.getMethod(pluginClass, method.getName());\n if (methodInfo == null) {\n continue;\n }\n\n // check annotations\n Boolean matchesAnnotation = false;\n if (methodInfo.getMethodType().endsWith(Constants.PLUGIN_RESPONSE_OVERRIDE_CLASS) ||\n methodInfo.getMethodType().endsWith(Constants.PLUGIN_RESPONSE_OVERRIDE_V2_CLASS)) {\n matchesAnnotation = true;\n }\n\n if (!methodNames.contains(method.getName()) && matchesAnnotation) {\n methodNames.add(method.getName());\n }\n }\n\n return methodNames.toArray(new String[0]);\n }",
"@Override\n public PersistentResourceXMLDescription getParserDescription() {\n return PersistentResourceXMLDescription.builder(ElytronExtension.SUBSYSTEM_PATH, getNameSpace())\n .addAttribute(ElytronDefinition.DEFAULT_AUTHENTICATION_CONTEXT)\n .addAttribute(ElytronDefinition.INITIAL_PROVIDERS)\n .addAttribute(ElytronDefinition.FINAL_PROVIDERS)\n .addAttribute(ElytronDefinition.DISALLOWED_PROVIDERS)\n .addAttribute(ElytronDefinition.SECURITY_PROPERTIES, new AttributeParsers.PropertiesParser(null, SECURITY_PROPERTY, true), new AttributeMarshallers.PropertiesAttributeMarshaller(null, SECURITY_PROPERTY, true))\n .addChild(getAuthenticationClientParser())\n .addChild(getProviderParser())\n .addChild(getAuditLoggingParser())\n .addChild(getDomainParser())\n .addChild(getRealmParser())\n .addChild(getCredentialSecurityFactoryParser())\n .addChild(getMapperParser())\n .addChild(getHttpParser())\n .addChild(getSaslParser())\n .addChild(getTlsParser())\n .addChild(decorator(CREDENTIAL_STORES).addChild(new CredentialStoreParser().parser))\n .addChild(getDirContextParser())\n .addChild(getPolicyParser())\n .build();\n }",
"public DependencyReport getDependencyReport(final String moduleId, final FiltersHolder filters) {\n final DbModule module = moduleHandler.getModule(moduleId);\n final DbOrganization organization = moduleHandler.getOrganization(module);\n filters.setCorporateFilter(new CorporateFilter(organization));\n\n final DependencyReport report = new DependencyReport(moduleId);\n final List<String> done = new ArrayList<String>();\n for(final DbModule submodule: DataUtils.getAllSubmodules(module)){\n done.add(submodule.getId());\n }\n\n addModuleToReport(report, module, filters, done, 1);\n\n return report;\n }",
"public void setBody(String body) {\n byte[] bytes = body.getBytes(StandardCharsets.UTF_8);\n this.bodyLength = bytes.length;\n this.body = new ByteArrayInputStream(bytes);\n }",
"public static snmpalarm[] get(nitro_service service) throws Exception{\n\t\tsnmpalarm obj = new snmpalarm();\n\t\tsnmpalarm[] response = (snmpalarm[])obj.get_resources(service);\n\t\treturn response;\n\t}"
] |
Prepare a parallel UDP Task.
@param command
the command
@return the parallel task builder | [
"public ParallelTaskBuilder prepareUdp(String command) {\n reinitIfClosed();\n ParallelTaskBuilder cb = new ParallelTaskBuilder();\n cb.setProtocol(RequestProtocol.UDP);\n cb.getUdpMeta().setCommand(command);\n return cb;\n }"
] | [
"private String parsePropertyName(String orgPropertyName, Object userData) {\n\t\t// try to assure the correct separator is used\n\t\tString propertyName = orgPropertyName.replace(HibernateLayerUtil.XPATH_SEPARATOR, HibernateLayerUtil.SEPARATOR);\n\n\t\t// split the path (separator is defined in the HibernateLayerUtil)\n\t\tString[] props = propertyName.split(HibernateLayerUtil.SEPARATOR_REGEXP);\n\t\tString finalName;\n\t\tif (props.length > 1 && userData instanceof Criteria) {\n\t\t\t// the criteria API requires an alias for each join table !!!\n\t\t\tString prevAlias = null;\n\t\t\tfor (int i = 0; i < props.length - 1; i++) {\n\t\t\t\tString alias = props[i] + \"_alias\";\n\t\t\t\tif (!aliases.contains(alias)) {\n\t\t\t\t\tCriteria criteria = (Criteria) userData;\n\t\t\t\t\tif (i == 0) {\n\t\t\t\t\t\tcriteria.createAlias(props[0], alias);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcriteria.createAlias(prevAlias + \".\" + props[i], alias);\n\t\t\t\t\t}\n\t\t\t\t\taliases.add(alias);\n\t\t\t\t}\n\t\t\t\tprevAlias = alias;\n\t\t\t}\n\t\t\tfinalName = prevAlias + \".\" + props[props.length - 1];\n\t\t} else {\n\t\t\tfinalName = propertyName;\n\t\t}\n\t\treturn finalName;\n\t}",
"public void useOldRESTService() throws Exception {\n List<Object> providers = createJAXRSProviders();\n\n com.example.customerservice.CustomerService customerService = JAXRSClientFactory\n .createFromModel(\"http://localhost:\" + port + \"/examples/direct/rest\", \n com.example.customerservice.CustomerService.class,\n \"classpath:/model/CustomerService-jaxrs.xml\", \n providers, \n null);\n\n System.out.println(\"Using old RESTful CustomerService with old client\");\n\n customer.v1.Customer customer = createOldCustomer(\"Smith Old REST\");\n customerService.updateCustomer(customer);\n\n customer = customerService.getCustomerByName(\"Smith Old REST\");\n printOldCustomerDetails(customer);\n }",
"public EndpointOverride getPath(int pathId, String clientUUID, String[] filters) throws Exception {\n EndpointOverride endpoint = null;\n PreparedStatement statement = null;\n ResultSet results = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n String queryString = this.getPathSelectString();\n queryString += \" AND \" + Constants.DB_TABLE_PATH + \".\" + Constants.GENERIC_ID + \"=\" + pathId + \";\";\n statement = sqlConnection.prepareStatement(queryString);\n statement.setString(1, clientUUID);\n\n results = statement.executeQuery();\n\n if (results.next()) {\n endpoint = this.getEndpointOverrideFromResultSet(results);\n endpoint.setFilters(filters);\n }\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n try {\n if (results != null) {\n results.close();\n }\n } catch (Exception e) {\n }\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n\n return endpoint;\n }",
"public void setBaseCalendar(String val)\n {\n set(ResourceField.BASE_CALENDAR, val == null || val.length() == 0 ? \"Standard\" : val);\n }",
"public static boolean isFinalVariable(DeclarationExpression declarationExpression, SourceCode sourceCode) {\r\n if (isFromGeneratedSourceCode(declarationExpression)) {\r\n return false;\r\n }\r\n List<Expression> variableExpressions = getVariableExpressions(declarationExpression);\r\n if (!variableExpressions.isEmpty()) {\r\n Expression variableExpression = variableExpressions.get(0);\r\n int startOfDeclaration = declarationExpression.getColumnNumber();\r\n int startOfVariableName = variableExpression.getColumnNumber();\r\n int sourceLineNumber = findFirstNonAnnotationLine(declarationExpression, sourceCode);\r\n String sourceLine = sourceCode.getLines().get(sourceLineNumber-1);\r\n\r\n String modifiers = (startOfDeclaration >= 0 && startOfVariableName >= 0 && sourceLine.length() >= startOfVariableName) ?\r\n sourceLine.substring(startOfDeclaration - 1, startOfVariableName - 1) : \"\";\r\n return modifiers.contains(\"final\");\r\n }\r\n return false;\r\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 }",
"private Boolean readOptionalBoolean(JSONObject json, String key) {\n\n try {\n return Boolean.valueOf(json.getBoolean(key));\n } catch (JSONException e) {\n LOG.debug(\"Reading optional JSON boolean failed. Default to provided default value.\", e);\n }\n return null;\n }",
"public Map<AssociationKey, Map<RowKey, Map<String, Object>>> getAssociationsMap() {\n\t\treturn Collections.unmodifiableMap( associationsKeyValueStorage );\n\t}",
"private static BsonDocument withNewVersion(\n final BsonDocument document,\n final BsonDocument newVersion\n ) {\n final BsonDocument newDocument = BsonUtils.copyOfDocument(document);\n newDocument.put(DOCUMENT_VERSION_FIELD, newVersion);\n return newDocument;\n }"
] |
Gets a legend graphic with the specified metadata parameters. All parameters are passed as request parameters.
@param layerId
the layer id
@param styleName
the style name
@param ruleIndex
the rule index
@param format
the image format ('png','jpg','gif')
@param width
the graphic's width
@param height
the graphic's height
@param scale
the scale denominator (not supported yet)
@param allRules
if true the image will contain all rules stacked vertically
@param request
the servlet request object
@return the model and view
@throws GeomajasException
when a style or rule does not exist or is not renderable | [
"@RequestMapping(value = \"/legendgraphic\", method = RequestMethod.GET)\n\tpublic ModelAndView getGraphic(@RequestParam(\"layerId\") String layerId,\n\t\t\t@RequestParam(value = \"styleName\", required = false) String styleName,\n\t\t\t@RequestParam(value = \"ruleIndex\", required = false) Integer ruleIndex,\n\t\t\t@RequestParam(value = \"format\", required = false) String format,\n\t\t\t@RequestParam(value = \"width\", required = false) Integer width,\n\t\t\t@RequestParam(value = \"height\", required = false) Integer height,\n\t\t\t@RequestParam(value = \"scale\", required = false) Double scale,\n\t\t\t@RequestParam(value = \"allRules\", required = false) Boolean allRules, HttpServletRequest request)\n\t\t\tthrows GeomajasException {\n\t\tif (!allRules) {\n\t\t\treturn getGraphic(layerId, styleName, ruleIndex, format, width, height, scale);\n\t\t} else {\n\t\t\treturn getGraphics(layerId, styleName, format, width, height, scale);\n\t\t}\n\t}"
] | [
"protected Connection newConnectionFromDriverManager(JdbcConnectionDescriptor jcd)\r\n throws LookupException\r\n {\r\n Connection retval = null;\r\n // use JDBC DriverManager\r\n final String driver = jcd.getDriver();\r\n final String url = getDbURL(jcd);\r\n try\r\n {\r\n // loads the driver - NB call to newInstance() added to force initialisation\r\n ClassHelper.getClass(driver, true);\r\n final String user = jcd.getUserName();\r\n final String password = jcd.getPassWord();\r\n final Properties properties = getJdbcProperties(jcd, user, password);\r\n if (properties.isEmpty())\r\n {\r\n if (user == null)\r\n {\r\n retval = DriverManager.getConnection(url);\r\n }\r\n else\r\n {\r\n retval = DriverManager.getConnection(url, user, password);\r\n }\r\n }\r\n else\r\n {\r\n retval = DriverManager.getConnection(url, properties);\r\n }\r\n }\r\n catch (SQLException sqlEx)\r\n {\r\n log.error(\"Error getting Connection from DriverManager with url (\" + url + \") and driver (\" + driver + \")\", sqlEx);\r\n throw new LookupException(\"Error getting Connection from DriverManager with url (\" + url + \") and driver (\" + driver + \")\", sqlEx);\r\n }\r\n catch (ClassNotFoundException cnfEx)\r\n {\r\n log.error(cnfEx);\r\n throw new LookupException(\"A class was not found\", cnfEx);\r\n }\r\n catch (Exception e)\r\n {\r\n log.error(\"Instantiation of jdbc driver failed\", e);\r\n throw new LookupException(\"Instantiation of jdbc driver failed\", e);\r\n }\r\n // initialize connection\r\n initializeJdbcConnection(retval, jcd);\r\n if(log.isDebugEnabled()) log.debug(\"Create new connection using DriverManager: \"+retval);\r\n return retval;\r\n }",
"protected void init(EnhancedAnnotation<T> annotatedAnnotation) {\n initType(annotatedAnnotation);\n initValid(annotatedAnnotation);\n check(annotatedAnnotation);\n }",
"public static void addLazyDefinitions(SourceBuilder code) {\n Set<Declaration> defined = new HashSet<>();\n\n // Definitions may lazily declare new names; ensure we add them all\n List<Declaration> declarations =\n code.scope().keysOfType(Declaration.class).stream().sorted().collect(toList());\n while (!defined.containsAll(declarations)) {\n for (Declaration declaration : declarations) {\n if (defined.add(declaration)) {\n code.add(code.scope().get(declaration).definition);\n }\n }\n declarations = code.scope().keysOfType(Declaration.class).stream().sorted().collect(toList());\n }\n }",
"private void readSubProjects(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex)\n {\n while (uniqueIDOffset < filePathOffset)\n {\n readSubProject(data, uniqueIDOffset, filePathOffset, fileNameOffset, subprojectIndex++);\n uniqueIDOffset += 4;\n }\n }",
"private void processKnownType(FieldType type)\n {\n //System.out.println(\"Header: \" + type);\n //System.out.println(ByteArrayHelper.hexdump(m_data, m_dataOffset, 36, false, 16, \"\"));\n\n GraphicalIndicator indicator = m_container.getCustomField(type).getGraphicalIndicator();\n indicator.setFieldType(type);\n int flags = m_data[m_dataOffset];\n indicator.setProjectSummaryInheritsFromSummaryRows((flags & 0x08) != 0);\n indicator.setSummaryRowsInheritFromNonSummaryRows((flags & 0x04) != 0);\n indicator.setDisplayGraphicalIndicators((flags & 0x02) != 0);\n indicator.setShowDataValuesInToolTips((flags & 0x01) != 0);\n m_dataOffset += 20;\n\n int nonSummaryRowOffset = MPPUtility.getInt(m_data, m_dataOffset) - 36;\n m_dataOffset += 4;\n\n int summaryRowOffset = MPPUtility.getInt(m_data, m_dataOffset) - 36;\n m_dataOffset += 4;\n\n int projectSummaryOffset = MPPUtility.getInt(m_data, m_dataOffset) - 36;\n m_dataOffset += 4;\n\n int dataSize = MPPUtility.getInt(m_data, m_dataOffset) - 36;\n m_dataOffset += 4;\n\n //System.out.println(\"Data\");\n //System.out.println(ByteArrayHelper.hexdump(m_data, m_dataOffset, dataSize, false, 16, \"\"));\n\n int maxNonSummaryRowOffset = m_dataOffset + summaryRowOffset;\n int maxSummaryRowOffset = m_dataOffset + projectSummaryOffset;\n int maxProjectSummaryOffset = m_dataOffset + dataSize;\n\n m_dataOffset += nonSummaryRowOffset;\n\n while (m_dataOffset + 2 < maxNonSummaryRowOffset)\n {\n indicator.addNonSummaryRowCriteria(processCriteria(type));\n }\n\n while (m_dataOffset + 2 < maxSummaryRowOffset)\n {\n indicator.addSummaryRowCriteria(processCriteria(type));\n }\n\n while (m_dataOffset + 2 < maxProjectSummaryOffset)\n {\n indicator.addProjectSummaryCriteria(processCriteria(type));\n }\n }",
"public static base_responses delete(nitro_service client, dnstxtrec resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tdnstxtrec deleteresources[] = new dnstxtrec[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tdeleteresources[i] = new dnstxtrec();\n\t\t\t\tdeleteresources[i].domain = resources[i].domain;\n\t\t\t\tdeleteresources[i].String = resources[i].String;\n\t\t\t\tdeleteresources[i].recordid = resources[i].recordid;\n\t\t\t}\n\t\t\tresult = delete_bulk_request(client, deleteresources);\n\t\t}\n\t\treturn result;\n\t}",
"public Build createBuild(String appName, Build build) {\n return connection.execute(new BuildCreate(appName, build), apiKey);\n }",
"public static TimeZone get(String suffix) {\n if(SUFFIX_TIMEZONES.containsKey(suffix)) {\n return SUFFIX_TIMEZONES.get(suffix);\n }\n log.warn(\"Cannot find time zone for exchange suffix: '{}'. Using default: America/New_York\", suffix);\n return SUFFIX_TIMEZONES.get(\"\");\n }",
"private void readAssignmentBaselines(Project.Assignments.Assignment assignment, ResourceAssignment mpx)\n {\n for (Project.Assignments.Assignment.Baseline baseline : assignment.getBaseline())\n {\n int number = NumberHelper.getInt(baseline.getNumber());\n\n //baseline.getBCWP()\n //baseline.getBCWS()\n Number cost = DatatypeConverter.parseExtendedAttributeCurrency(baseline.getCost());\n Date finish = DatatypeConverter.parseExtendedAttributeDate(baseline.getFinish());\n //baseline.getNumber()\n Date start = DatatypeConverter.parseExtendedAttributeDate(baseline.getStart());\n Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.HOURS, baseline.getWork());\n\n if (number == 0)\n {\n mpx.setBaselineCost(cost);\n mpx.setBaselineFinish(finish);\n mpx.setBaselineStart(start);\n mpx.setBaselineWork(work);\n }\n else\n {\n mpx.setBaselineCost(number, cost);\n mpx.setBaselineWork(number, work);\n mpx.setBaselineStart(number, start);\n mpx.setBaselineFinish(number, finish);\n }\n }\n }"
] |
This method prints goal information of an agent through its external
access. It can be used to check the correct behaviour of the agent.
@param agent_name
The name of the agent
@param connector
The connector to get the external access
@return goals the IGoal[] with all the information, so the tester can
look for information | [
"public IGoal[] getAgentGoals(final String agent_name, Connector connector) {\n ((IExternalAccess) connector.getAgentsExternalAccess(agent_name))\n .scheduleStep(new IComponentStep<Plan>() {\n\n public IFuture<Plan> execute(IInternalAccess ia) {\n IBDIInternalAccess bia = (IBDIInternalAccess) ia;\n\n goals = bia.getGoalbase().getGoals();\n return null;\n }\n }).get(new ThreadSuspendable());\n\n return goals;\n }"
] | [
"boolean attachmentsAreStructurallyDifferent( List<AttachmentModel> firstAttachments, List<AttachmentModel> otherAttachments ) {\n if( firstAttachments.size() != otherAttachments.size() ) {\n return true;\n }\n\n for( int i = 0; i < firstAttachments.size(); i++ ) {\n if( attachmentIsStructurallyDifferent( firstAttachments.get( i ), otherAttachments.get( i ) ) ) {\n return true;\n }\n }\n return false;\n }",
"public static <T extends Publisher> T getPublisher(AbstractProject<?, ?> project, Class<T> type) {\n // Search for a publisher of the given type in the project and return it if found:\n T publisher = new PublisherFindImpl<T>().find(project, type);\n if (publisher != null) {\n return publisher;\n }\n // If not found, the publisher might be wrapped by a \"Flexible Publish\" publisher. The below searches for it inside the\n // Flexible Publisher:\n publisher = new PublisherFlexible<T>().find(project, type);\n return publisher;\n }",
"public static final CurrencySymbolPosition parseCurrencySymbolPosition(String value)\n {\n CurrencySymbolPosition result = MAP_TO_CURRENCY_SYMBOL_POSITION.get(value);\n result = result == null ? CurrencySymbolPosition.BEFORE_WITH_SPACE : result;\n return result;\n }",
"public final boolean roll(final LoggingEvent loggingEvent) {\n for (int i = 0; i < this.fileRollables.length; i++) {\n if (this.fileRollables[i].roll(loggingEvent)) {\n return true;\n }\n }\n return false;\n }",
"@Override\n public Response doRequest(final StitchRequest stitchReq) {\n initAppMetadata(clientAppId);\n\n return super.doRequestUrl(stitchReq, getHostname());\n }",
"public static boolean updateImageParentOnAgents(final JenkinsBuildInfoLog log, final String imageTag, final String host, final int buildInfoId) throws IOException, InterruptedException {\n boolean parentUpdated = updateImageParent(log, imageTag, host, buildInfoId);\n List<Node> nodes = Jenkins.getInstance().getNodes();\n for (Node node : nodes) {\n if (node == null || node.getChannel() == null) {\n continue;\n }\n boolean parentNodeUpdated = node.getChannel().call(new MasterToSlaveCallable<Boolean, IOException>() {\n public Boolean call() throws IOException {\n return updateImageParent(log, imageTag, host, buildInfoId);\n }\n });\n parentUpdated = parentUpdated ? parentUpdated : parentNodeUpdated;\n }\n return parentUpdated;\n }",
"public Map<String, CmsCategory> getReadCategory() {\n\n if (null == m_categories) {\n m_categories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() {\n\n public Object transform(Object categoryPath) {\n\n try {\n CmsCategoryService catService = CmsCategoryService.getInstance();\n return catService.localizeCategory(\n m_cms,\n catService.readCategory(m_cms, (String)categoryPath, getRequestContext().getUri()),\n m_cms.getRequestContext().getLocale());\n } catch (CmsException e) {\n LOG.warn(e.getLocalizedMessage(), e);\n return null;\n }\n }\n\n });\n }\n return m_categories;\n }",
"private void refreshMetadataCache(final Queue<WindupMetadataSystem> metadataSystemCache, final DecompilerSettings settings)\n {\n metadataSystemCache.clear();\n for (int i = 0; i < this.getNumberOfThreads(); i++)\n {\n metadataSystemCache.add(new NoRetryMetadataSystem(settings.getTypeLoader()));\n }\n }",
"public final void setColorPreferred(boolean preferColor) {\n if (this.preferColor.compareAndSet(!preferColor, preferColor) && isRunning()) {\n stop();\n try {\n start();\n } catch (Exception e) {\n logger.error(\"Unexplained exception restarting; we had been running already!\", e);\n }\n }\n }"
] |
Hides the Loader component | [
"public void hide() {\n div.removeFromParent();\n if (scrollDisabled) {\n RootPanel.get().getElement().getStyle().setOverflow(Style.Overflow.AUTO);\n }\n if (type == LoaderType.CIRCULAR) {\n preLoader.removeFromParent();\n } else if (type == LoaderType.PROGRESS) {\n progress.removeFromParent();\n }\n }"
] | [
"public static base_response update(nitro_service client, sslparameter resource) throws Exception {\n\t\tsslparameter updateresource = new sslparameter();\n\t\tupdateresource.quantumsize = resource.quantumsize;\n\t\tupdateresource.crlmemorysizemb = resource.crlmemorysizemb;\n\t\tupdateresource.strictcachecks = resource.strictcachecks;\n\t\tupdateresource.ssltriggertimeout = resource.ssltriggertimeout;\n\t\tupdateresource.sendclosenotify = resource.sendclosenotify;\n\t\tupdateresource.encrypttriggerpktcount = resource.encrypttriggerpktcount;\n\t\tupdateresource.denysslreneg = resource.denysslreneg;\n\t\tupdateresource.insertionencoding = resource.insertionencoding;\n\t\tupdateresource.ocspcachesize = resource.ocspcachesize;\n\t\tupdateresource.pushflag = resource.pushflag;\n\t\tupdateresource.dropreqwithnohostheader = resource.dropreqwithnohostheader;\n\t\tupdateresource.pushenctriggertimeout = resource.pushenctriggertimeout;\n\t\tupdateresource.undefactioncontrol = resource.undefactioncontrol;\n\t\tupdateresource.undefactiondata = resource.undefactiondata;\n\t\treturn updateresource.update_resource(client);\n\t}",
"private ProjectCalendar getResourceCalendar(Integer calendarID)\n {\n ProjectCalendar result = null;\n if (calendarID != null)\n {\n ProjectCalendar calendar = m_calMap.get(calendarID);\n if (calendar != null)\n {\n //\n // If the resource is linked to a base calendar, derive\n // a default calendar from the base calendar.\n //\n if (!calendar.isDerived())\n {\n ProjectCalendar resourceCalendar = m_project.addCalendar();\n resourceCalendar.setParent(calendar);\n resourceCalendar.setWorkingDay(Day.MONDAY, DayType.DEFAULT);\n resourceCalendar.setWorkingDay(Day.TUESDAY, DayType.DEFAULT);\n resourceCalendar.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT);\n resourceCalendar.setWorkingDay(Day.THURSDAY, DayType.DEFAULT);\n resourceCalendar.setWorkingDay(Day.FRIDAY, DayType.DEFAULT);\n resourceCalendar.setWorkingDay(Day.SATURDAY, DayType.DEFAULT);\n resourceCalendar.setWorkingDay(Day.SUNDAY, DayType.DEFAULT);\n result = resourceCalendar;\n }\n else\n {\n //\n // Primavera seems to allow a calendar to be shared between resources\n // whereas in the MS Project model there is a one-to-one\n // relationship. If we find a shared calendar, take a copy of it\n //\n if (calendar.getResource() == null)\n {\n result = calendar;\n }\n else\n {\n ProjectCalendar copy = m_project.addCalendar();\n copy.copy(calendar);\n result = copy;\n }\n }\n }\n }\n\n return result;\n }",
"public static void readAndCheckVersion(ObjectInput input, int supportedVersion, Class<?> externalizedType) throws IOException {\n\t\tint version = input.readInt();\n\n\t\tif ( version != supportedVersion ) {\n\t\t\tthrow LOG.unexpectedKeyVersion( externalizedType, version, supportedVersion );\n\t\t}\n\t}",
"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 double[] getRegressionCoefficients(RandomVariable value) {\n\t\tif(basisFunctions.length == 0) {\n\t\t\treturn new double[] { };\n\t\t}\n\t\telse if(basisFunctions.length == 1) {\n\t\t\t/*\n\t\t\t * Regression with one basis function is just a projection on that vector. <b,x>/<b,b>\n\t\t\t */\n\t\t\treturn new double[] { value.mult(basisFunctions[0]).getAverage() / basisFunctions[0].squared().getAverage() };\n\t\t}\n\t\telse if(basisFunctions.length == 2) {\n\t\t\t/*\n\t\t\t * Regression with two basis functions can be solved explicitly if determinant != 0 (otherwise we will fallback to SVD)\n\t\t\t */\n\t\t\tdouble a = basisFunctions[0].squared().getAverage();\n\t\t\tdouble b = basisFunctions[0].mult(basisFunctions[1]).average().squared().doubleValue();\n\t\t\tdouble c = b;\n\t\t\tdouble d = basisFunctions[1].squared().getAverage();\n\n\t\t\tdouble determinant = (a * d - b * c);\n\t\t\tif(determinant != 0) {\n\t\t\t\tdouble x = value.mult(basisFunctions[0]).getAverage();\n\t\t\t\tdouble y = value.mult(basisFunctions[1]).getAverage();\n\n\t\t\t\tdouble alpha0 = (d * x - b * y) / determinant;\n\t\t\t\tdouble alpha1 = (a * y - c * x) / determinant;\n\n\t\t\t\treturn new double[] { alpha0, alpha1 };\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t * General case\n\t\t */\n\n\t\t// Build regression matrix\n\t\tdouble[][] BTB = new double[basisFunctions.length][basisFunctions.length];\n\t\tfor(int i=0; i<basisFunctions.length; i++) {\n\t\t\tfor(int j=0; j<=i; j++) {\n\t\t\t\tdouble covariance = basisFunctions[i].mult(basisFunctions[j]).getAverage();\n\t\t\t\tBTB[i][j] = covariance;\n\t\t\t\tBTB[j][i] = covariance;\n\t\t\t}\n\t\t}\n\n\t\tdouble[] BTX = new double[basisFunctions.length];\n\t\tfor(int i=0; i<basisFunctions.length; i++) {\n\t\t\tdouble covariance = basisFunctions[i].mult(value).getAverage();\n\t\t\tBTX[i] = covariance;\n\t\t}\n\n\t\treturn LinearAlgebra.solveLinearEquationLeastSquare(BTB, BTX);\n\t}",
"@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 static base_responses add(nitro_service client, nsip6 resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tnsip6 addresources[] = new nsip6[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new nsip6();\n\t\t\t\taddresources[i].ipv6address = resources[i].ipv6address;\n\t\t\t\taddresources[i].scope = resources[i].scope;\n\t\t\t\taddresources[i].type = resources[i].type;\n\t\t\t\taddresources[i].vlan = resources[i].vlan;\n\t\t\t\taddresources[i].nd = resources[i].nd;\n\t\t\t\taddresources[i].icmp = resources[i].icmp;\n\t\t\t\taddresources[i].vserver = resources[i].vserver;\n\t\t\t\taddresources[i].telnet = resources[i].telnet;\n\t\t\t\taddresources[i].ftp = resources[i].ftp;\n\t\t\t\taddresources[i].gui = resources[i].gui;\n\t\t\t\taddresources[i].ssh = resources[i].ssh;\n\t\t\t\taddresources[i].snmp = resources[i].snmp;\n\t\t\t\taddresources[i].mgmtaccess = resources[i].mgmtaccess;\n\t\t\t\taddresources[i].restrictaccess = resources[i].restrictaccess;\n\t\t\t\taddresources[i].dynamicrouting = resources[i].dynamicrouting;\n\t\t\t\taddresources[i].hostroute = resources[i].hostroute;\n\t\t\t\taddresources[i].ip6hostrtgw = resources[i].ip6hostrtgw;\n\t\t\t\taddresources[i].metric = resources[i].metric;\n\t\t\t\taddresources[i].vserverrhilevel = resources[i].vserverrhilevel;\n\t\t\t\taddresources[i].ospf6lsatype = resources[i].ospf6lsatype;\n\t\t\t\taddresources[i].ospfarea = resources[i].ospfarea;\n\t\t\t\taddresources[i].state = resources[i].state;\n\t\t\t\taddresources[i].map = resources[i].map;\n\t\t\t\taddresources[i].ownernode = resources[i].ownernode;\n\t\t\t\taddresources[i].td = resources[i].td;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}",
"private static int nextIndex( String description, int defaultIndex ) {\n\n Pattern startsWithNumber = Pattern.compile( \"(\\\\d+).*\" );\n Matcher matcher = startsWithNumber.matcher( description );\n if( matcher.matches() ) {\n return Integer.parseInt( matcher.group( 1 ) ) - 1;\n }\n\n return defaultIndex;\n }",
"public ItemRequest<Team> addUser(String team) {\n \n String path = String.format(\"/teams/%s/addUser\", team);\n return new ItemRequest<Team>(this, Team.class, path, \"POST\");\n }"
] |
Use this API to update snmpoption. | [
"public static base_response update(nitro_service client, snmpoption resource) throws Exception {\n\t\tsnmpoption updateresource = new snmpoption();\n\t\tupdateresource.snmpset = resource.snmpset;\n\t\tupdateresource.snmptraplogging = resource.snmptraplogging;\n\t\treturn updateresource.update_resource(client);\n\t}"
] | [
"public void setIntegerAttribute(String name, Integer value) {\n\t\tensureValue();\n\t\tAttribute attribute = new IntegerAttribute(value);\n\t\tattribute.setEditable(isEditable(name));\n\t\tgetValue().getAllAttributes().put(name, attribute);\n\t}",
"public static List<ContentRepositoryElement> listFiles(final Path rootPath, Path tempDir, final ContentFilter filter) throws IOException {\n List<ContentRepositoryElement> result = new ArrayList<>();\n if (Files.exists(rootPath)) {\n if(isArchive(rootPath)) {\n return listZipContent(rootPath, filter);\n }\n Files.walkFileTree(rootPath, 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 if (filter.acceptFile(rootPath, file)) {\n result.add(ContentRepositoryElement.createFile(formatPath(rootPath.relativize(file)), Files.size(file)));\n }\n return FileVisitResult.CONTINUE;\n }\n\n @Override\n public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {\n return FileVisitResult.CONTINUE;\n }\n\n @Override\n public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {\n if (filter.acceptDirectory(rootPath, dir)) {\n String directoryPath = formatDirectoryPath(rootPath.relativize(dir));\n if(! \"/\".equals(directoryPath)) {\n result.add(ContentRepositoryElement.createFolder(directoryPath));\n }\n }\n return FileVisitResult.CONTINUE;\n }\n\n private String formatDirectoryPath(Path path) {\n return formatPath(path) + '/';\n }\n\n private String formatPath(Path path) {\n return path.toString().replace(File.separatorChar, '/');\n }\n });\n } else {\n Path file = getFile(rootPath);\n if(isArchive(file)) {\n Path relativePath = file.relativize(rootPath);\n Path target = createTempDirectory(tempDir, \"unarchive\");\n unzip(file, target);\n return listFiles(target.resolve(relativePath), tempDir, filter);\n } else {\n throw new FileNotFoundException(rootPath.toString());\n }\n }\n return result;\n }",
"@Nullable\n @SuppressWarnings(\"unchecked\")\n protected <T extends JavaElement> ActiveElements<T> popIfActive() {\n return (ActiveElements<T>) (!activations.isEmpty() && activations.peek().depth == depth ? activations.pop() :\n null);\n }",
"public void setTexture(GVRRenderTexture texture)\n {\n mTexture = texture;\n NativeRenderTarget.setTexture(getNative(), texture.getNative());\n }",
"public static base_responses clear(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 clearresources[] = new Interface[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tclearresources[i] = new Interface();\n\t\t\t\tclearresources[i].id = resources[i].id;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, clearresources,\"clear\");\n\t\t}\n\t\treturn result;\n\t}",
"public static <S extends Matrix, D extends Matrix> LinearSolver<S,D> safe(LinearSolver<S,D> solver ) {\n if( solver.modifiesA() || solver.modifiesB() ) {\n if( solver instanceof LinearSolverDense ) {\n return new LinearSolverSafe((LinearSolverDense)solver);\n } else if( solver instanceof LinearSolverSparse ) {\n return new LinearSolverSparseSafe((LinearSolverSparse)solver);\n } else {\n throw new IllegalArgumentException(\"Unknown solver type\");\n }\n } else {\n return solver;\n }\n }",
"public static base_response unset(nitro_service client, callhome resource, String[] args) throws Exception{\n\t\tcallhome unsetresource = new callhome();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}",
"public int getIgnoredCount() {\n int count = 0;\n for (AggregatedTestResultEvent t : getTests()) {\n if (t.getStatus() == TestStatus.IGNORED ||\n t.getStatus() == TestStatus.IGNORED_ASSUMPTION) {\n count++;\n }\n }\n return count;\n }",
"public ServerRedirect addServerMapping(String sourceHost, String destinationHost, String hostHeader) {\n JSONObject response = null;\n\n ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();\n params.add(new BasicNameValuePair(\"srcUrl\", sourceHost));\n params.add(new BasicNameValuePair(\"destUrl\", destinationHost));\n params.add(new BasicNameValuePair(\"profileIdentifier\", this._profileName));\n if (hostHeader != null) {\n params.add(new BasicNameValuePair(\"hostHeader\", hostHeader));\n }\n\n try {\n BasicNameValuePair paramArray[] = new BasicNameValuePair[params.size()];\n params.toArray(paramArray);\n response = new JSONObject(doPost(BASE_SERVER, paramArray));\n } catch (Exception e) {\n e.printStackTrace();\n return null;\n }\n return getServerRedirectFromJSON(response);\n }"
] |
Use this API to restore appfwprofile resources. | [
"public static base_responses restore(nitro_service client, appfwprofile resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tappfwprofile restoreresources[] = new appfwprofile[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\trestoreresources[i] = new appfwprofile();\n\t\t\t\trestoreresources[i].archivename = resources[i].archivename;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, restoreresources,\"restore\");\n\t\t}\n\t\treturn result;\n\t}"
] | [
"public static Trajectory addPositionNoise(Trajectory t, double sd){\n\t\tCentralRandomNumberGenerator r = CentralRandomNumberGenerator.getInstance();\n\t\tTrajectory newt = new Trajectory(t.getDimension());\n\t\t\n\t\tfor(int i = 0; i < t.size(); i++){\n\t\t\tnewt.add(t.get(i));\n\t\t\tfor(int j = 1; j <= t.getDimension(); j++){\n\t\t\t\tswitch (j) {\n\t\t\t\tcase 1:\n\t\t\t\t\tnewt.get(i).setX(newt.get(i).x + r.nextGaussian()*sd);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tnewt.get(i).setY(newt.get(i).y + r.nextGaussian()*sd);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tnewt.get(i).setZ(newt.get(i).z + r.nextGaussian()*sd);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn newt;\n\t\t\n\t}",
"public Version putVersionedWithCustomTimeout(CompositeVoldemortRequest<K, V> requestWrapper)\n throws ObsoleteVersionException {\n validateTimeout(requestWrapper.getRoutingTimeoutInMs());\n for(int attempts = 0; attempts < this.metadataRefreshAttempts; attempts++) {\n try {\n String keyHexString = \"\";\n long startTimeInMs = System.currentTimeMillis();\n if(logger.isDebugEnabled()) {\n ByteArray key = (ByteArray) requestWrapper.getKey();\n keyHexString = RestUtils.getKeyHexString(key);\n debugLogStart(\"PUT_VERSION\",\n requestWrapper.getRequestOriginTimeInMs(),\n startTimeInMs,\n keyHexString);\n }\n store.put(requestWrapper);\n if(logger.isDebugEnabled()) {\n debugLogEnd(\"PUT_VERSION\",\n requestWrapper.getRequestOriginTimeInMs(),\n startTimeInMs,\n System.currentTimeMillis(),\n keyHexString,\n 0);\n }\n return requestWrapper.getValue().getVersion();\n } catch(InvalidMetadataException e) {\n logger.info(\"Received invalid metadata exception during put [ \" + e.getMessage()\n + \" ] on store '\" + storeName + \"'. Rebootstrapping\");\n bootStrap();\n }\n }\n throw new VoldemortException(this.metadataRefreshAttempts\n + \" metadata refresh attempts failed.\");\n }",
"public static Variable deserialize(String s,\n VariableType variableType) {\n return deserialize(s,\n variableType,\n null);\n }",
"public static String getSerializedVectorClocks(List<VectorClock> vectorClocks) {\n List<VectorClockWrapper> vectorClockWrappers = new ArrayList<VectorClockWrapper>();\n for(VectorClock vc: vectorClocks) {\n vectorClockWrappers.add(new VectorClockWrapper(vc));\n }\n String serializedVC = \"\";\n try {\n serializedVC = mapper.writeValueAsString(vectorClockWrappers);\n } catch(Exception e) {\n e.printStackTrace();\n }\n return serializedVC;\n }",
"@Override\n\tpublic boolean exists() {\n\t\ttry {\n\t\t\tInputStream inputStream = this.assetManager.open(this.fileName);\n\t\t\tif (inputStream != null) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\treturn false;\n\t\t}\n\t}",
"public String getMessage(Locale locale) {\n\t\tif (getCause() != null) {\n\t\t\tString message = getShortMessage(locale) + \", \" + translate(\"ROOT_CAUSE\", locale) + \" \";\n\t\t\tif (getCause() instanceof GeomajasException) {\n\t\t\t\treturn message + ((GeomajasException) getCause()).getMessage(locale);\n\t\t\t}\n\t\t\treturn message + getCause().getMessage();\n\t\t} else {\n\t\t\treturn getShortMessage(locale);\n\t\t}\n\t}",
"public String load() {\n this.paginator = new Paginator();\n this.codes = null;\n\n // Perform a search\n\n this.codes = codeFragmentManager.searchCodeFragments(this.codeFragmentPrototype, this.page, this.paginator);\n return \"history\";\n }",
"public static String resolveOrOriginal(String input) {\n try {\n return resolve(input, true);\n } catch (UnresolvedExpressionException e) {\n return input;\n }\n }",
"public static DMatrixRMaj nullspaceSVD( DMatrixRMaj A , int totalSingular ) {\n SolveNullSpace<DMatrixRMaj> solver = new SolveNullSpaceSvd_DDRM();\n\n DMatrixRMaj nullspace = new DMatrixRMaj(1,1);\n\n if( !solver.process(A,totalSingular,nullspace))\n throw new RuntimeException(\"Solver failed. try SVD based method instead?\");\n\n return nullspace;\n }"
] |
Check if values in the column "property" are written to the bundle files.
@param property the property id of the table column.
@return a flag, indicating if values of the table column are stored to the bundle files. | [
"private boolean isBundleProperty(Object property) {\n\n return (property.equals(TableProperty.KEY) || property.equals(TableProperty.TRANSLATION));\n }"
] | [
"private void mapText(String oldText, Map<String, String> replacements)\n {\n char c2 = 0;\n if (oldText != null && oldText.length() != 0 && !replacements.containsKey(oldText))\n {\n StringBuilder newText = new StringBuilder(oldText.length());\n for (int loop = 0; loop < oldText.length(); loop++)\n {\n char c = oldText.charAt(loop);\n if (Character.isUpperCase(c))\n {\n newText.append('X');\n }\n else\n {\n if (Character.isLowerCase(c))\n {\n newText.append('x');\n }\n else\n {\n if (Character.isDigit(c))\n {\n newText.append('0');\n }\n else\n {\n if (Character.isLetter(c))\n {\n // Handle other codepages etc. If possible find a way to\n // maintain the same code page as original.\n // E.g. replace with a character from the same alphabet.\n // This 'should' work for most cases\n if (c2 == 0)\n {\n c2 = c;\n }\n newText.append(c2);\n }\n else\n {\n newText.append(c);\n }\n }\n }\n }\n }\n\n replacements.put(oldText, newText.toString());\n }\n }",
"private Duration getDuration(Double duration)\n {\n Duration result = null;\n\n if (duration != null)\n {\n result = Duration.getInstance(NumberHelper.getDouble(duration), TimeUnit.HOURS);\n }\n\n return result;\n }",
"public void setJobTypes(final Map<String, ? extends Class<?>> jobTypes) {\n checkJobTypes(jobTypes);\n this.jobTypes.clear();\n this.jobTypes.putAll(jobTypes);\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 }",
"protected boolean isSecureLink(CmsObject cms, String vfsName, CmsSite targetSite, boolean secureRequest) {\n\n return OpenCms.getStaticExportManager().isSecureLink(cms, vfsName, targetSite.getSiteRoot(), secureRequest);\n }",
"public static void copyProperties(Object dest, Object orig){\n\t\ttry {\n\t\t\tif (orig != null && dest != null){\n\t\t\t\tBeanUtils.copyProperties(dest, orig);\n\n\t\t\t\tPropertyUtils putils = new PropertyUtils();\n\t PropertyDescriptor origDescriptors[] = putils.getPropertyDescriptors(orig);\n\n\t\t\t\tfor (PropertyDescriptor origDescriptor : origDescriptors) {\n\t\t\t\t\tString name = origDescriptor.getName();\n\t\t\t\t\tif (\"class\".equals(name)) {\n\t\t\t\t\t\tcontinue; // No point in trying to set an object's class\n\t\t\t\t\t}\n\n\t\t\t\t\tClass propertyType = origDescriptor.getPropertyType();\n\t\t\t\t\tif (!Boolean.class.equals(propertyType) && !(Boolean.class.equals(propertyType)))\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif (!putils.isReadable(orig, name)) { //because of bad convention\n\t\t\t\t\t\tMethod m = orig.getClass().getMethod(\"is\" + name.substring(0, 1).toUpperCase() + name.substring(1), (Class<?>[]) null);\n\t\t\t\t\t\tObject value = m.invoke(orig, (Object[]) null);\n\n\t\t\t\t\t\tif (putils.isWriteable(dest, name)) {\n\t\t\t\t\t\t\tBeanUtilsBean.getInstance().copyProperty(dest, name, value);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tthrow new DJException(\"Could not copy properties for shared object: \" + orig +\", message: \" + e.getMessage(),e);\n\t\t}\n\t}",
"public void addResourceAssignment(ResourceAssignment assignment)\n {\n if (getExistingResourceAssignment(assignment.getResource()) == null)\n {\n m_assignments.add(assignment);\n getParentFile().getResourceAssignments().add(assignment);\n\n Resource resource = assignment.getResource();\n if (resource != null)\n {\n resource.addResourceAssignment(assignment);\n }\n }\n }",
"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 }",
"public static BufferedImage createImage(ImageProducer producer) {\n\t\tPixelGrabber pg = new PixelGrabber(producer, 0, 0, -1, -1, null, 0, 0);\n\t\ttry {\n\t\t\tpg.grabPixels();\n\t\t} catch (InterruptedException e) {\n\t\t\tthrow new RuntimeException(\"Image fetch interrupted\");\n\t\t}\n\t\tif ((pg.status() & ImageObserver.ABORT) != 0)\n\t\t\tthrow new RuntimeException(\"Image fetch aborted\");\n\t\tif ((pg.status() & ImageObserver.ERROR) != 0)\n\t\t\tthrow new RuntimeException(\"Image fetch error\");\n\t\tBufferedImage p = new BufferedImage(pg.getWidth(), pg.getHeight(), BufferedImage.TYPE_INT_ARGB);\n\t\tp.setRGB(0, 0, pg.getWidth(), pg.getHeight(), (int[])pg.getPixels(), 0, pg.getWidth());\n\t\treturn p;\n\t}"
] |
Destroys the internal connection handle and creates a new one.
@throws SQLException | [
"public void refreshConnection() throws SQLException{\r\n\t\tthis.connection.close(); // if it's still in use, close it.\r\n\t\ttry{\r\n\t\t\tthis.connection = this.pool.obtainRawInternalConnection();\r\n\t\t} catch(SQLException e){\r\n\t\t\tthrow markPossiblyBroken(e);\r\n\t\t}\r\n\t}"
] | [
"public static void processEntitiesFromWikidataDump(\n\t\t\tEntityDocumentProcessor entityDocumentProcessor) {\n\n\t\t// Controller object for processing dumps:\n\t\tDumpProcessingController dumpProcessingController = new DumpProcessingController(\n\t\t\t\t\"wikidatawiki\");\n\t\tdumpProcessingController.setOfflineMode(OFFLINE_MODE);\n\n\t\t// // Optional: Use another download directory:\n\t\t// dumpProcessingController.setDownloadDirectory(System.getProperty(\"user.dir\"));\n\n\t\t// Should we process historic revisions or only current ones?\n\t\tboolean onlyCurrentRevisions;\n\t\tswitch (DUMP_FILE_MODE) {\n\t\tcase ALL_REVS:\n\t\tcase ALL_REVS_WITH_DAILIES:\n\t\t\tonlyCurrentRevisions = false;\n\t\t\tbreak;\n\t\tcase CURRENT_REVS:\n\t\tcase CURRENT_REVS_WITH_DAILIES:\n\t\tcase JSON:\n\t\tcase JUST_ONE_DAILY_FOR_TEST:\n\t\tdefault:\n\t\t\tonlyCurrentRevisions = true;\n\t\t}\n\n\t\t// Subscribe to the most recent entity documents of type wikibase item:\n\t\tdumpProcessingController.registerEntityDocumentProcessor(\n\t\t\t\tentityDocumentProcessor, null, onlyCurrentRevisions);\n\n\t\t// Also add a timer that reports some basic progress information:\n\t\tEntityTimerProcessor entityTimerProcessor = new EntityTimerProcessor(\n\t\t\t\tTIMEOUT_SEC);\n\t\tdumpProcessingController.registerEntityDocumentProcessor(\n\t\t\t\tentityTimerProcessor, null, onlyCurrentRevisions);\n\n\t\tMwDumpFile dumpFile = null;\n\t\ttry {\n\t\t\t// Start processing (may trigger downloads where needed):\n\t\t\tswitch (DUMP_FILE_MODE) {\n\t\t\tcase ALL_REVS:\n\t\t\tcase CURRENT_REVS:\n\t\t\t\tdumpFile = dumpProcessingController\n\t\t\t\t\t\t.getMostRecentDump(DumpContentType.FULL);\n\t\t\t\tbreak;\n\t\t\tcase ALL_REVS_WITH_DAILIES:\n\t\t\tcase CURRENT_REVS_WITH_DAILIES:\n\t\t\t\tMwDumpFile fullDumpFile = dumpProcessingController\n\t\t\t\t\t\t.getMostRecentDump(DumpContentType.FULL);\n\t\t\t\tMwDumpFile incrDumpFile = dumpProcessingController\n\t\t\t\t\t\t.getMostRecentDump(DumpContentType.DAILY);\n\t\t\t\tlastDumpFileName = fullDumpFile.getProjectName() + \"-\"\n\t\t\t\t\t\t+ incrDumpFile.getDateStamp() + \".\"\n\t\t\t\t\t\t+ fullDumpFile.getDateStamp();\n\t\t\t\tdumpProcessingController.processAllRecentRevisionDumps();\n\t\t\t\tbreak;\n\t\t\tcase JSON:\n\t\t\t\tdumpFile = dumpProcessingController\n\t\t\t\t\t\t.getMostRecentDump(DumpContentType.JSON);\n\t\t\t\tbreak;\n\t\t\tcase JUST_ONE_DAILY_FOR_TEST:\n\t\t\t\tdumpFile = dumpProcessingController\n\t\t\t\t\t\t.getMostRecentDump(DumpContentType.DAILY);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new RuntimeException(\"Unsupported dump processing type \"\n\t\t\t\t\t\t+ DUMP_FILE_MODE);\n\t\t\t}\n\n\t\t\tif (dumpFile != null) {\n\t\t\t\tlastDumpFileName = dumpFile.getProjectName() + \"-\"\n\t\t\t\t\t\t+ dumpFile.getDateStamp();\n\t\t\t\tdumpProcessingController.processDump(dumpFile);\n\t\t\t}\n\t\t} catch (TimeoutException e) {\n\t\t\t// The timer caused a time out. Continue and finish normally.\n\t\t}\n\n\t\t// Print final timer results:\n\t\tentityTimerProcessor.close();\n\t}",
"public static Dimension rectangleDoubleToDimension(final Rectangle2D.Double rectangle) {\n return new Dimension(\n (int) Math.round(rectangle.width),\n (int) Math.round(rectangle.height));\n }",
"private <T> T populateBean(final T resultBean, final String[] nameMapping) {\n\t\t\n\t\t// map each column to its associated field on the bean\n\t\tfor( int i = 0; i < nameMapping.length; i++ ) {\n\t\t\t\n\t\t\tfinal Object fieldValue = processedColumns.get(i);\n\t\t\t\n\t\t\t// don't call a set-method in the bean if there is no name mapping for the column or no result to store\n\t\t\tif( nameMapping[i] == null || fieldValue == null ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\t// invoke the setter on the bean\n\t\t\tMethod setMethod = cache.getSetMethod(resultBean, nameMapping[i], fieldValue.getClass());\n\t\t\tinvokeSetter(resultBean, setMethod, fieldValue);\n\t\t\t\n\t\t}\n\t\t\n\t\treturn resultBean;\n\t}",
"private long getTotalUploadSize() throws IOException {\n long size = 0;\n for (Map.Entry<String, File> entry : files.entrySet()) {\n size += entry.getValue().length();\n }\n\n for (Map.Entry<String, InputStream> entry : fileStreams.entrySet()) {\n size += entry.getValue().available();\n }\n return size;\n }",
"private void cascadeMarkedForInsert()\r\n {\r\n // This list was used to avoid endless recursion on circular references\r\n List alreadyPrepared = new ArrayList();\r\n for(int i = 0; i < markedForInsertList.size(); i++)\r\n {\r\n ObjectEnvelope mod = (ObjectEnvelope) markedForInsertList.get(i);\r\n // only if a new object was found we cascade to register the dependent objects\r\n if(mod.needsInsert())\r\n {\r\n cascadeInsertFor(mod, alreadyPrepared);\r\n alreadyPrepared.clear();\r\n }\r\n }\r\n markedForInsertList.clear();\r\n }",
"public Map<String, CmsJspCategoryAccessBean> getReadAllSubCategories() {\n\n if (null == m_allSubCategories) {\n m_allSubCategories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() {\n\n @Override\n public Object transform(Object categoryPath) {\n\n try {\n List<CmsCategory> categories = CmsCategoryService.getInstance().readCategories(\n m_cms,\n (String)categoryPath,\n true,\n m_cms.getRequestContext().getUri());\n CmsJspCategoryAccessBean result = new CmsJspCategoryAccessBean(\n m_cms,\n categories,\n (String)categoryPath);\n return result;\n } catch (CmsException e) {\n LOG.warn(e.getLocalizedMessage(), e);\n return null;\n }\n }\n\n });\n }\n return m_allSubCategories;\n }",
"public String getSafetyLevel() throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_SAFETY_LEVEL);\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(\"safety_level\");\r\n }",
"private D createAndRegisterDeclaration(Map<String, Object> metadata) {\n D declaration;\n if (klass.equals(ImportDeclaration.class)) {\n declaration = (D) ImportDeclarationBuilder.fromMetadata(metadata).build();\n } else if (klass.equals(ExportDeclaration.class)) {\n declaration = (D) ExportDeclarationBuilder.fromMetadata(metadata).build();\n } else {\n throw new IllegalStateException(\"\");\n }\n declarationRegistrationManager.registerDeclaration(declaration);\n return declaration;\n }",
"public Shard getShard(String docId) {\n assertNotEmpty(docId, \"docId\");\n return client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).path(\"_shards\")\n .path(docId).build(),\n Shard.class);\n }"
] |
Get a property as a int or null.
@param key the property name | [
"@Override\n public final Integer optInt(final String key) {\n final int result = this.obj.optInt(key, Integer.MIN_VALUE);\n return result == Integer.MIN_VALUE ? null : result;\n }"
] | [
"private RawGcsCreationToken put(final GcsRestCreationToken token, ByteBuffer chunk,\n final boolean isFinalChunk, long timeoutMillis) throws IOException {\n final int length = chunk.remaining();\n HTTPRequest req = createPutRequest(token, chunk, isFinalChunk, timeoutMillis, length);\n HTTPRequestInfo info = new HTTPRequestInfo(req);\n HTTPResponse response;\n try {\n response = urlfetch.fetch(req);\n } catch (IOException e) {\n throw createIOException(info, e);\n }\n return handlePutResponse(token, isFinalChunk, length, info, response);\n }",
"public Tree determineHead(Tree t, Tree parent) {\r\n if (nonTerminalInfo == null) {\r\n throw new RuntimeException(\"Classes derived from AbstractCollinsHeadFinder must\" + \" create and fill HashMap nonTerminalInfo.\");\r\n }\r\n if (t == null || t.isLeaf()) {\r\n return null;\r\n }\r\n if (DEBUG) {\r\n System.err.println(\"determineHead for \" + t.value());\r\n }\r\n \r\n Tree[] kids = t.children();\r\n\r\n Tree theHead;\r\n // first check if subclass found explicitly marked head\r\n if ((theHead = findMarkedHead(t)) != null) {\r\n if (DEBUG) {\r\n System.err.println(\"Find marked head method returned \" +\r\n theHead.label() + \" as head of \" + t.label());\r\n }\r\n return theHead;\r\n }\r\n\r\n // if the node is a unary, then that kid must be the head\r\n // it used to special case preterminal and ROOT/TOP case\r\n // but that seemed bad (especially hardcoding string \"ROOT\")\r\n if (kids.length == 1) {\r\n if (DEBUG) {\r\n System.err.println(\"Only one child determines \" +\r\n kids[0].label() + \" as head of \" + t.label());\r\n }\r\n return kids[0];\r\n }\r\n\r\n return determineNonTrivialHead(t, parent);\r\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 void seekToHolidayYear(String holidayString, String yearString) {\n Holiday holiday = Holiday.valueOf(holidayString);\n assert(holiday != null);\n \n seekToIcsEventYear(HOLIDAY_ICS_FILE, yearString, holiday.getSummary());\n }",
"private Map<UUID, List<DateRange>> processDayTypes(List<MapRow> types)\n {\n Map<UUID, List<DateRange>> map = new HashMap<UUID, List<DateRange>>();\n for (MapRow row : types)\n {\n List<DateRange> ranges = new ArrayList<DateRange>();\n for (MapRow range : row.getRows(\"TIME_RANGES\"))\n {\n ranges.add(new DateRange(range.getDate(\"START\"), range.getDate(\"END\")));\n }\n map.put(row.getUUID(\"UUID\"), ranges);\n }\n\n return map;\n }",
"public static <T> void callInitializers(T instance, CreationalContext<T> creationalContext, BeanManagerImpl manager,\n Iterable<? extends MethodInjectionPoint<?, ?>> initializerMethods) {\n for (MethodInjectionPoint<?, ?> initializer : initializerMethods) {\n initializer.invoke(instance, null, manager, creationalContext, CreationException.class);\n }\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 }",
"public ItemRequest<Workspace> update(String workspace) {\n \n String path = String.format(\"/workspaces/%s\", workspace);\n return new ItemRequest<Workspace>(this, Workspace.class, path, \"PUT\");\n }",
"public static base_responses reset(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 resetresources[] = new appfwlearningdata[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tresetresources[i] = new appfwlearningdata();\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, resetresources,\"reset\");\n\t\t}\n\t\treturn result;\n\t}"
] |
Adds a String timestamp representing uninstall flag to the DB. | [
"synchronized void storeUninstallTimestamp() {\n\n if (!this.belowMemThreshold()) {\n getConfigLogger().verbose(\"There is not enough space left on the device to store data, data discarded\");\n return ;\n }\n final String tableName = Table.UNINSTALL_TS.getName();\n\n try {\n final SQLiteDatabase db = dbHelper.getWritableDatabase();\n final ContentValues cv = new ContentValues();\n cv.put(KEY_CREATED_AT, System.currentTimeMillis());\n db.insert(tableName, null, cv);\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\n }"
] | [
"public static boolean start(RootDoc root) {\n\troot.printNotice(\"UmlGraphDoc version \" + Version.VERSION + \", running the standard doclet\");\n\tStandard.start(root);\n\troot.printNotice(\"UmlGraphDoc version \" + Version.VERSION + \", altering javadocs\");\n\ttry {\n\t String outputFolder = findOutputPath(root.options());\n\n Options opt = UmlGraph.buildOptions(root);\n\t opt.setOptions(root.options());\n\t // in javadoc enumerations are always printed\n\t opt.showEnumerations = true;\n\t opt.relativeLinksForSourcePackages = true;\n\t // enable strict matching for hide expressions\n\t opt.strictMatching = true;\n//\t root.printNotice(opt.toString());\n\n\t generatePackageDiagrams(root, opt, outputFolder);\n\t generateContextDiagrams(root, opt, outputFolder);\n\t} catch(Throwable t) {\n\t root.printWarning(\"Error: \" + t.toString());\n\t t.printStackTrace();\n\t return false;\n\t}\n\treturn true;\n }",
"private ProjectCalendar getResourceCalendar(Integer calendarID)\n {\n ProjectCalendar result = null;\n if (calendarID != null)\n {\n ProjectCalendar calendar = m_calMap.get(calendarID);\n if (calendar != null)\n {\n //\n // If the resource is linked to a base calendar, derive\n // a default calendar from the base calendar.\n //\n if (!calendar.isDerived())\n {\n ProjectCalendar resourceCalendar = m_project.addCalendar();\n resourceCalendar.setParent(calendar);\n resourceCalendar.setWorkingDay(Day.MONDAY, DayType.DEFAULT);\n resourceCalendar.setWorkingDay(Day.TUESDAY, DayType.DEFAULT);\n resourceCalendar.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT);\n resourceCalendar.setWorkingDay(Day.THURSDAY, DayType.DEFAULT);\n resourceCalendar.setWorkingDay(Day.FRIDAY, DayType.DEFAULT);\n resourceCalendar.setWorkingDay(Day.SATURDAY, DayType.DEFAULT);\n resourceCalendar.setWorkingDay(Day.SUNDAY, DayType.DEFAULT);\n result = resourceCalendar;\n }\n else\n {\n //\n // Primavera seems to allow a calendar to be shared between resources\n // whereas in the MS Project model there is a one-to-one\n // relationship. If we find a shared calendar, take a copy of it\n //\n if (calendar.getResource() == null)\n {\n result = calendar;\n }\n else\n {\n ProjectCalendar copy = m_project.addCalendar();\n copy.copy(calendar);\n result = copy;\n }\n }\n }\n }\n\n return result;\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 }",
"private void processChildTasks(Task task, MapRow row) throws IOException\n {\n List<MapRow> tasks = row.getRows(\"TASKS\");\n if (tasks != null)\n {\n for (MapRow childTask : tasks)\n {\n processTask(task, childTask);\n }\n }\n }",
"private XopBean createXopBean() throws Exception {\n XopBean xop = new XopBean();\n xop.setName(\"xopName\");\n \n InputStream is = getClass().getResourceAsStream(\"/java.jpg\");\n byte[] data = IOUtils.readBytesFromStream(is);\n \n // Pass java.jpg as an array of bytes\n xop.setBytes(data);\n \n // Wrap java.jpg as a DataHandler\n xop.setDatahandler(new DataHandler(\n new ByteArrayDataSource(data, \"application/octet-stream\")));\n \n if (Boolean.getBoolean(\"java.awt.headless\")) {\n System.out.println(\"Running headless. Ignoring an Image property.\");\n } else {\n xop.setImage(getImage(\"/java.jpg\"));\n }\n \n return xop;\n }",
"public static void validateInterimFinalCluster(final Cluster interimCluster,\n final Cluster finalCluster) {\n validateClusterPartitionCounts(interimCluster, finalCluster);\n validateClusterZonesSame(interimCluster, finalCluster);\n validateClusterNodeCounts(interimCluster, finalCluster);\n validateClusterNodeState(interimCluster, finalCluster);\n return;\n }",
"protected String format(String key, String defaultPattern, Object... args) {\n String escape = escape(defaultPattern);\n String s = lookupPattern(key, escape);\n Object[] objects = escapeAll(args);\n return MessageFormat.format(s, objects);\n }",
"public static int getId(Context context, String id) {\n final String defType;\n if (id.startsWith(\"R.\")) {\n int dot = id.indexOf('.', 2);\n defType = id.substring(2, dot);\n } else {\n defType = \"drawable\";\n }\n\n Log.d(TAG, \"getId(): id: %s, extracted type: %s\", id, defType);\n return getId(context, id, defType);\n }",
"private String getDatatypeLabel(DatatypeIdValue datatype) {\n\t\tif (datatype.getIri() == null) { // TODO should be redundant once the\n\t\t\t\t\t\t\t\t\t\t\t// JSON parsing works\n\t\t\treturn \"Unknown\";\n\t\t}\n\n\t\tswitch (datatype.getIri()) {\n\t\tcase DatatypeIdValue.DT_COMMONS_MEDIA:\n\t\t\treturn \"Commons media\";\n\t\tcase DatatypeIdValue.DT_GLOBE_COORDINATES:\n\t\t\treturn \"Globe coordinates\";\n\t\tcase DatatypeIdValue.DT_ITEM:\n\t\t\treturn \"Item\";\n\t\tcase DatatypeIdValue.DT_QUANTITY:\n\t\t\treturn \"Quantity\";\n\t\tcase DatatypeIdValue.DT_STRING:\n\t\t\treturn \"String\";\n\t\tcase DatatypeIdValue.DT_TIME:\n\t\t\treturn \"Time\";\n\t\tcase DatatypeIdValue.DT_URL:\n\t\t\treturn \"URL\";\n\t\tcase DatatypeIdValue.DT_PROPERTY:\n\t\t\treturn \"Property\";\n\t\tcase DatatypeIdValue.DT_EXTERNAL_ID:\n\t\t\treturn \"External identifier\";\n\t\tcase DatatypeIdValue.DT_MATH:\n\t\t\treturn \"Math\";\n\t\tcase DatatypeIdValue.DT_MONOLINGUAL_TEXT:\n\t\t\treturn \"Monolingual Text\";\n\t\tdefault:\n\t\t\tthrow new RuntimeException(\"Unknown datatype \" + datatype.getIri());\n\t\t}\n\t}"
] |
Insert a value into the right bucket of the histogram. If the value is
larger than any bound, insert into the last bucket. If the value is less
than zero, then ignore it.
@param data The value to insert into the histogram | [
"public synchronized void insert(long data) {\n resetIfNeeded();\n long index = 0;\n if(data >= this.upperBound) {\n index = nBuckets - 1;\n } else if(data < 0) {\n logger.error(data + \" can't be bucketed because it is negative!\");\n return;\n } else {\n index = data / step;\n }\n if(index < 0 || index >= nBuckets) {\n // This should be dead code. Defending against code changes in\n // future.\n logger.error(data + \" can't be bucketed because index is not in range [0,nBuckets).\");\n return;\n }\n buckets[(int) index]++;\n sum += data;\n size++;\n }"
] | [
"protected void setupRegistration() {\n if (isServiceWorkerSupported()) {\n Navigator.serviceWorker.register(getResource()).then(object -> {\n logger.info(\"Service worker has been successfully registered\");\n registration = (ServiceWorkerRegistration) object;\n\n onRegistered(new ServiceEvent(), registration);\n\n // Observe service worker lifecycle\n observeLifecycle(registration);\n\n // Setup Service Worker events events\n setupOnControllerChangeEvent();\n setupOnMessageEvent();\n setupOnErrorEvent();\n return null;\n }, error -> {\n logger.info(\"ServiceWorker registration failed: \" + error);\n return null;\n });\n } else {\n logger.info(\"Service worker is not supported by this browser.\");\n }\n }",
"public static boolean setDefaultCustomResponse(String pathValue, String requestType, String customData) {\n try {\n JSONObject profile = getDefaultProfile();\n String profileName = profile.getString(\"name\");\n PathValueClient client = new PathValueClient(profileName, false);\n return client.setCustomResponse(pathValue, requestType, customData);\n } catch (Exception e) {\n e.printStackTrace();\n }\n return false;\n }",
"public void send(ProducerPoolData<V> ppd) {\n if (logger.isDebugEnabled()) {\n logger.debug(\"send message: \" + ppd);\n }\n if (sync) {\n Message[] messages = new Message[ppd.data.size()];\n int index = 0;\n for (V v : ppd.data) {\n messages[index] = serializer.toMessage(v);\n index++;\n }\n ByteBufferMessageSet bbms = new ByteBufferMessageSet(config.getCompressionCodec(), messages);\n ProducerRequest request = new ProducerRequest(ppd.topic, ppd.partition.partId, bbms);\n SyncProducer producer = syncProducers.get(ppd.partition.brokerId);\n if (producer == null) {\n throw new UnavailableProducerException(\"Producer pool has not been initialized correctly. \" + \"Sync Producer for broker \"\n + ppd.partition.brokerId + \" does not exist in the pool\");\n }\n producer.send(request.topic, request.partition, request.messages);\n } else {\n AsyncProducer<V> asyncProducer = asyncProducers.get(ppd.partition.brokerId);\n for (V v : ppd.data) {\n asyncProducer.send(ppd.topic, v, ppd.partition.partId);\n }\n }\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 boolean isEmbeddedProperty(String targetTypeName, List<String> namesWithoutAlias) {\n\t\tOgmEntityPersister persister = getPersister( targetTypeName );\n\t\tType propertyType = persister.getPropertyType( namesWithoutAlias.get( 0 ) );\n\t\tif ( propertyType.isComponentType() ) {\n\t\t\t// Embedded\n\t\t\treturn true;\n\t\t}\n\t\telse if ( propertyType.isAssociationType() ) {\n\t\t\tJoinable associatedJoinable = ( (AssociationType) propertyType ).getAssociatedJoinable( persister.getFactory() );\n\t\t\tif ( associatedJoinable.isCollection() ) {\n\t\t\t\tOgmCollectionPersister collectionPersister = (OgmCollectionPersister) associatedJoinable;\n\t\t\t\treturn collectionPersister.getType().isComponentType();\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"protected synchronized Class loadClass(final String name, boolean resolve) throws ClassNotFoundException {\n Class c = this.findLoadedClass(name);\n if (c != null) return c;\n c = (Class) customClasses.get(name);\n if (c != null) return c;\n\n try {\n c = oldFindClass(name);\n } catch (ClassNotFoundException cnfe) {\n // IGNORE\n }\n if (c == null) c = super.loadClass(name, resolve);\n\n if (resolve) resolveClass(c);\n\n return c;\n }",
"public void setEnd(Date endDate) {\n\n if ((null == endDate) || getStart().after(endDate)) {\n m_explicitEnd = null;\n } else {\n m_explicitEnd = endDate;\n }\n }",
"private boolean compareBytes(byte[] lhs, byte[] rhs, int rhsOffset)\n {\n boolean result = true;\n for (int loop = 0; loop < lhs.length; loop++)\n {\n if (lhs[loop] != rhs[rhsOffset + loop])\n {\n result = false;\n break;\n }\n }\n return (result);\n }",
"public ReferrerList getPhotoReferrers(Date date, String domain, String photoId, int perPage, int page) throws FlickrException {\n return getReferrers(METHOD_GET_PHOTO_REFERRERS, domain, \"photo_id\", photoId, date, perPage, page);\n }"
] |
Generates the build-info module for this docker image.
Additionally. this method tags the deployed docker layers with properties,
such as build.name, build.number and custom properties defined in the Jenkins build.
@param build
@param listener
@param config
@param buildName
@param buildNumber
@param timestamp
@return
@throws IOException | [
"public Module generateBuildInfoModule(Run build, TaskListener listener, ArtifactoryConfigurator config, String buildName, String buildNumber, String timestamp) throws IOException {\n if (artifactsProps == null) {\n artifactsProps = ArrayListMultimap.create();\n }\n artifactsProps.put(\"build.name\", buildName);\n artifactsProps.put(\"build.number\", buildNumber);\n artifactsProps.put(\"build.timestamp\", timestamp);\n String artifactsPropsStr = ExtractorUtils.buildPropertiesString(artifactsProps);\n\n Properties buildInfoItemsProps = new Properties();\n buildInfoItemsProps.setProperty(\"build.name\", buildName);\n buildInfoItemsProps.setProperty(\"build.number\", buildNumber);\n buildInfoItemsProps.setProperty(\"build.timestamp\", timestamp);\n\n ArtifactoryServer server = config.getArtifactoryServer();\n CredentialsConfig preferredResolver = server.getDeployerCredentialsConfig();\n ArtifactoryDependenciesClient dependenciesClient = null;\n ArtifactoryBuildInfoClient propertyChangeClient = null;\n\n try {\n dependenciesClient = server.createArtifactoryDependenciesClient(\n preferredResolver.provideUsername(build.getParent()), preferredResolver.providePassword(build.getParent()),\n server.createProxyConfiguration(Jenkins.getInstance().proxy), listener);\n\n CredentialsConfig preferredDeployer = CredentialManager.getPreferredDeployer(config, server);\n propertyChangeClient = server.createArtifactoryClient(\n preferredDeployer.provideUsername(build.getParent()), preferredDeployer.providePassword(build.getParent()),\n server.createProxyConfiguration(Jenkins.getInstance().proxy));\n\n Module buildInfoModule = new Module();\n buildInfoModule.setId(imageTag.substring(imageTag.indexOf(\"/\") + 1));\n\n // If manifest and imagePath not found, return.\n if ((StringUtils.isEmpty(manifest) || StringUtils.isEmpty(imagePath)) && !findAndSetManifestFromArtifactory(server, dependenciesClient, listener)) {\n return buildInfoModule;\n }\n\n listener.getLogger().println(\"Fetching details of published docker layers from Artifactory...\");\n boolean includeVirtualReposSupported = propertyChangeClient.getArtifactoryVersion().isAtLeast(VIRTUAL_REPOS_SUPPORTED_VERSION);\n DockerLayers layers = createLayers(dependenciesClient, includeVirtualReposSupported);\n\n listener.getLogger().println(\"Tagging published docker layers with build properties in Artifactory...\");\n setDependenciesAndArtifacts(buildInfoModule, layers, artifactsPropsStr, buildInfoItemsProps,\n dependenciesClient, propertyChangeClient, server);\n setBuildInfoModuleProps(buildInfoModule);\n return buildInfoModule;\n } finally {\n if (dependenciesClient != null) {\n dependenciesClient.close();\n }\n if (propertyChangeClient != null) {\n propertyChangeClient.close();\n }\n }\n }"
] | [
"@Override\n\tpublic Iterator<? extends IPAddressSeqRange> prefixIterator(int prefixLength) {\n\t\tif(!isMultiple()) {\n\t\t\treturn new Iterator<IPAddressSeqRange>() {\n\t\t\t\tIPAddressSeqRange orig = IPAddressSeqRange.this;\n\n\t\t\t\t@Override\n\t\t\t\tpublic boolean hasNext() {\n\t\t\t\t\treturn orig != null;\n\t\t\t\t}\n\n\t\t\t @Override\n\t\t\t\tpublic IPAddressSeqRange next() {\n\t\t\t \tif(orig == null) {\n\t\t\t \t\tthrow new NoSuchElementException();\n\t\t\t \t}\n\t\t\t \tIPAddressSeqRange result = orig;\n\t\t\t \torig = null;\n\t\t\t \treturn result;\n\t\t\t }\n\t\t\t\n\t\t\t @Override\n\t\t\t\tpublic void remove() {\n\t\t\t \tthrow new UnsupportedOperationException();\n\t\t\t }\n\t\t\t};\n\t\t}\n\t\treturn new Iterator<IPAddressSeqRange>() {\n\t\t\tIterator<? extends IPAddress> prefixBlockIterator = prefixBlockIterator(prefixLength);\n\t\t\tprivate boolean first = true;\n\n\t\t\t@Override\n\t\t\tpublic boolean hasNext() {\n\t\t\t\treturn prefixBlockIterator.hasNext();\n\t\t\t}\n\n\t\t @Override\n\t\t\tpublic IPAddressSeqRange next() {\n\t\t \tIPAddress next = prefixBlockIterator.next();\n\t\t \tif(first) {\n\t\t \t\tfirst = false;\n\t\t \t\t// next is a prefix block\n\t\t \t\tIPAddress lower = getLower();\n\t\t \t\tif(hasNext()) {\n\t\t\t \t\tif(!lower.includesZeroHost(prefixLength)) {\n\t\t\t \t\t\treturn create(lower, next.getUpper());\n\t\t\t \t\t}\n\t\t \t\t} else {\n\t\t \t\t\tIPAddress upper = getUpper();\n\t\t \t\t\tif(!lower.includesZeroHost(prefixLength) || !upper.includesMaxHost(prefixLength)) {\n\t\t \t\t\t\treturn create(lower, upper);\n\t\t \t\t\t}\n\t\t \t\t}\n\t\t \t} else if(!hasNext()) {\n\t\t \t\tIPAddress upper = getUpper();\n\t\t \t\tif(!upper.includesMaxHost(prefixLength)) {\n\t\t \t\t\treturn create(next.getLower(), upper);\n\t\t \t\t}\n\t\t \t}\n\t\t \treturn next.toSequentialRange();\n\t\t }\n\t\t\n\t\t @Override\n\t\t\tpublic void remove() {\n\t\t \tthrow new UnsupportedOperationException();\n\t\t }\n\t\t};\n\t}",
"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 }",
"public static lbvserver_servicegroupmember_binding[] get(nitro_service service, String name) throws Exception{\n\t\tlbvserver_servicegroupmember_binding obj = new lbvserver_servicegroupmember_binding();\n\t\tobj.set_name(name);\n\t\tlbvserver_servicegroupmember_binding response[] = (lbvserver_servicegroupmember_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"public List<TimephasedWork> getTimephasedOvertimeWork()\n {\n if (m_timephasedOvertimeWork == null && m_timephasedWork != null && getOvertimeWork() != null)\n {\n double perDayFactor = getRemainingOvertimeWork().getDuration() / (getRemainingWork().getDuration() - getRemainingOvertimeWork().getDuration());\n double totalFactor = getRemainingOvertimeWork().getDuration() / getRemainingWork().getDuration();\n\n perDayFactor = Double.isNaN(perDayFactor) ? 0 : perDayFactor;\n totalFactor = Double.isNaN(totalFactor) ? 0 : totalFactor;\n\n m_timephasedOvertimeWork = new DefaultTimephasedWorkContainer(m_timephasedWork, perDayFactor, totalFactor);\n }\n return m_timephasedOvertimeWork == null ? null : m_timephasedOvertimeWork.getData();\n }",
"public String addPostRunDependent(FunctionalTaskItem dependentTaskItem) {\n IndexableTaskItem taskItem = IndexableTaskItem.create(dependentTaskItem);\n this.addPostRunDependent(taskItem);\n return taskItem.key();\n }",
"public static MimeMultipart createMultipartWithAttachment(String msg, final byte[] attachment, final String contentType,\r\n final String filename, String description) {\r\n try {\r\n MimeMultipart multiPart = new MimeMultipart();\r\n\r\n MimeBodyPart textPart = new MimeBodyPart();\r\n multiPart.addBodyPart(textPart);\r\n textPart.setText(msg);\r\n\r\n MimeBodyPart binaryPart = new MimeBodyPart();\r\n multiPart.addBodyPart(binaryPart);\r\n\r\n DataSource ds = new DataSource() {\r\n @Override\r\n public InputStream getInputStream() throws IOException {\r\n return new ByteArrayInputStream(attachment);\r\n }\r\n\r\n @Override\r\n public OutputStream getOutputStream() throws IOException {\r\n ByteArrayOutputStream byteStream = new ByteArrayOutputStream();\r\n byteStream.write(attachment);\r\n return byteStream;\r\n }\r\n\r\n @Override\r\n public String getContentType() {\r\n return contentType;\r\n }\r\n\r\n @Override\r\n public String getName() {\r\n return filename;\r\n }\r\n };\r\n binaryPart.setDataHandler(new DataHandler(ds));\r\n binaryPart.setFileName(filename);\r\n binaryPart.setDescription(description);\r\n return multiPart;\r\n } catch (MessagingException e) {\r\n throw new IllegalArgumentException(\"Can not create multipart message with attachment\", e);\r\n }\r\n }",
"private void ensurePKsFromHierarchy(ClassDescriptorDef classDef) throws ConstraintException\r\n {\r\n SequencedHashMap pks = new SequencedHashMap();\r\n\r\n for (Iterator it = classDef.getAllExtentClasses(); it.hasNext();)\r\n {\r\n ClassDescriptorDef subTypeDef = (ClassDescriptorDef)it.next();\r\n\r\n ArrayList subPKs = subTypeDef.getPrimaryKeys();\r\n\r\n // check against already present PKs\r\n for (Iterator pkIt = subPKs.iterator(); pkIt.hasNext();)\r\n {\r\n FieldDescriptorDef fieldDef = (FieldDescriptorDef)pkIt.next();\r\n FieldDescriptorDef foundPKDef = (FieldDescriptorDef)pks.get(fieldDef.getName());\r\n\r\n if (foundPKDef != null)\r\n {\r\n if (!isEqual(fieldDef, foundPKDef))\r\n {\r\n throw new ConstraintException(\"Cannot pull up the declaration of the required primary key \"+fieldDef.getName()+\r\n \" because its definitions in \"+fieldDef.getOwner().getName()+\" and \"+\r\n foundPKDef.getOwner().getName()+\" differ\");\r\n }\r\n }\r\n else\r\n {\r\n pks.put(fieldDef.getName(), fieldDef);\r\n }\r\n }\r\n }\r\n\r\n ensureFields(classDef, pks.values());\r\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}",
"public synchronized Response<ByteArray, Object> responseQueuePoll(long timeout,\n TimeUnit timeUnit)\n throws InterruptedException {\n long timeoutMs = timeUnit.toMillis(timeout);\n long timeoutWallClockMs = System.currentTimeMillis() + timeoutMs;\n while(responseQueue.isEmpty() && System.currentTimeMillis() < timeoutWallClockMs) {\n long remainingMs = Math.max(0, timeoutWallClockMs - System.currentTimeMillis());\n if(logger.isDebugEnabled()) {\n logger.debug(\"Start waiting for response queue with timeoutMs: \" + timeoutMs);\n }\n this.wait(remainingMs);\n if(logger.isDebugEnabled()) {\n logger.debug(\"End waiting for response queue with timeoutMs: \" + timeoutMs);\n }\n }\n return responseQueue.poll();\n }"
] |
Parser for forecast
@param feed
@return | [
"private List<String> parseRssFeedForeCast(String feed) {\n String[] result = feed.split(\"<br />\");\n List<String> returnList = new ArrayList<String>();\n String[] result2 = result[2].split(\"<BR />\");\n\n returnList.add(result2[3] + \"\\n\");\n returnList.add(result[3] + \"\\n\");\n returnList.add(result[4] + \"\\n\");\n returnList.add(result[5] + \"\\n\");\n returnList.add(result[6] + \"\\n\");\n\n return returnList;\n }"
] | [
"public static MBeanServerConnection getMBeanServerConnection(Process p, boolean startAgent) {\n try {\n final JMXServiceURL serviceURL = getLocalConnectorAddress(p, startAgent);\n final JMXConnector connector = JMXConnectorFactory.connect(serviceURL);\n final MBeanServerConnection mbsc = connector.getMBeanServerConnection();\n return mbsc;\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }",
"public static void addIndex(DBCollection collection, String field, boolean asc, boolean background) {\n int dir = (asc) ? 1 : -1;\n collection.createIndex(new BasicDBObject(field, dir), new BasicDBObject(\"background\", background));\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}",
"public void remove(Identity oid)\r\n {\r\n if (oid == null) return;\r\n\r\n ObjectCache cache = getCache(oid, null, METHOD_REMOVE);\r\n if (cache != null)\r\n {\r\n cache.remove(oid);\r\n }\r\n }",
"@UiHandler(\"m_addButton\")\r\n void addButtonClick(ClickEvent e) {\r\n\r\n if (null != m_newDate.getValue()) {\r\n m_dateList.addDate(m_newDate.getValue());\r\n m_newDate.setValue(null);\r\n if (handleChange()) {\r\n m_controller.setDates(m_dateList.getDates());\r\n }\r\n }\r\n }",
"@SuppressWarnings({\"WeakerAccess\", \"unused\"}) // For library users\n public void registerWidget(View widget) {\n prepareWidget(widget);\n\n if (widget instanceof AlgoliaResultsListener) {\n AlgoliaResultsListener listener = (AlgoliaResultsListener) widget;\n if (!this.resultListeners.contains(listener)) {\n this.resultListeners.add(listener);\n }\n searcher.registerResultListener(listener);\n }\n if (widget instanceof AlgoliaErrorListener) {\n AlgoliaErrorListener listener = (AlgoliaErrorListener) widget;\n if (!this.errorListeners.contains(listener)) {\n this.errorListeners.add(listener);\n }\n searcher.registerErrorListener(listener);\n }\n if (widget instanceof AlgoliaSearcherListener) {\n AlgoliaSearcherListener listener = (AlgoliaSearcherListener) widget;\n listener.initWithSearcher(searcher);\n }\n }",
"public static void ensureNotSingular( DMatrixSparseCSC A , Random rand ) {\n// if( A.numRows < A.numCols ) {\n// throw new IllegalArgumentException(\"Fewer equations than variables\");\n// }\n\n int []s = UtilEjml.shuffled(A.numRows,rand);\n Arrays.sort(s);\n\n int N = Math.min(A.numCols,A.numRows);\n for (int col = 0; col < N; col++) {\n A.set(s[col],col,rand.nextDouble()+0.5);\n }\n }",
"private void purgeDeadJobInstances(DbConn cnx, Node node)\n {\n for (JobInstance ji : JobInstance.select(cnx, \"ji_select_by_node\", node.getId()))\n {\n try\n {\n cnx.runSelectSingle(\"history_select_state_by_id\", String.class, ji.getId());\n }\n catch (NoResultException e)\n {\n History.create(cnx, ji, State.CRASHED, Calendar.getInstance());\n Message.create(cnx,\n \"Job was supposed to be running at server startup - usually means it was killed along a server by an admin or a crash\",\n ji.getId());\n }\n\n cnx.runUpdate(\"ji_delete_by_id\", ji.getId());\n }\n cnx.commit();\n }",
"private void enableTalkBack() {\n GVRSceneObject[] sceneObjects = mGvrContext.getMainScene().getWholeSceneObjects();\n for (GVRSceneObject sceneObject : sceneObjects) {\n if (sceneObject instanceof GVRAccessiblityObject)\n if (((GVRAccessiblityObject) sceneObject).getTalkBack() != null)\n ((GVRAccessiblityObject) sceneObject).getTalkBack().setActive(true);\n }\n }"
] |
Iterates through the given CharSequence line by line, splitting each line using
the given regex delimiter. The list of tokens for each line is then passed to
the given closure.
@param self a CharSequence
@param regex the delimiting regular expression
@param closure a closure
@return the last value returned by the closure
@throws java.io.IOException if an error occurs
@throws java.util.regex.PatternSyntaxException if the regular expression's syntax is invalid
@see #splitEachLine(CharSequence, java.util.regex.Pattern, groovy.lang.Closure)
@since 1.8.2 | [
"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 }"
] | [
"public static NamingConvention determineNamingConvention(\n TypeElement type,\n Iterable<ExecutableElement> methods,\n Messager messager,\n Types types) {\n ExecutableElement beanMethod = null;\n ExecutableElement prefixlessMethod = null;\n for (ExecutableElement method : methods) {\n switch (methodNameConvention(method)) {\n case BEAN:\n beanMethod = firstNonNull(beanMethod, method);\n break;\n case PREFIXLESS:\n prefixlessMethod = firstNonNull(prefixlessMethod, method);\n break;\n default:\n break;\n }\n }\n if (prefixlessMethod != null) {\n if (beanMethod != null) {\n messager.printMessage(\n ERROR,\n \"Type contains an illegal mix of get-prefixed and unprefixed getter methods, e.g. '\"\n + beanMethod.getSimpleName() + \"' and '\" + prefixlessMethod.getSimpleName() + \"'\",\n type);\n }\n return new PrefixlessConvention(messager, types);\n } else {\n return new BeanConvention(messager, types);\n }\n }",
"public static TestSuiteResult unmarshal(File testSuite) throws IOException {\n try (InputStream stream = new FileInputStream(testSuite)) {\n return unmarshal(stream);\n }\n }",
"private void merge(ExecutionStatistics otherStatistics) {\n for (String s : otherStatistics.executionInfo.keySet())\n {\n TimingData thisStats = this.executionInfo.get(s);\n TimingData otherStats = otherStatistics.executionInfo.get(s);\n if(thisStats == null) {\n this.executionInfo.put(s,otherStats);\n } else {\n thisStats.merge(otherStats);\n }\n\n }\n }",
"public void sendData(SerialMessage serialMessage)\n\t{\n \tif (serialMessage.getMessageClass() != SerialMessage.SerialMessageClass.SendData) {\n \t\tlogger.error(String.format(\"Invalid message class %s (0x%02X) for sendData\", serialMessage.getMessageClass().getLabel(), serialMessage.getMessageClass().getKey()));\n \t\treturn;\n \t}\n \tif (serialMessage.getMessageType() != SerialMessage.SerialMessageType.Request) {\n \t\tlogger.error(\"Only request messages can be sent\");\n \t\treturn;\n \t}\n \t\n \tZWaveNode node = this.getNode(serialMessage.getMessageNode());\n \t\t\t\n \tif (node.getNodeStage() == NodeStage.NODEBUILDINFO_DEAD) {\n \t\tlogger.debug(\"Node {} is dead, not sending message.\", node.getNodeId());\n\t\t\treturn;\n \t}\n\t\t\n \tif (!node.isListening() && serialMessage.getPriority() != SerialMessage.SerialMessagePriority.Low) {\n\t\t\tZWaveWakeUpCommandClass wakeUpCommandClass = (ZWaveWakeUpCommandClass)node.getCommandClass(ZWaveCommandClass.CommandClass.WAKE_UP);\n\t\t\t\n\t\t\tif (wakeUpCommandClass != null && !wakeUpCommandClass.isAwake()) {\n\t\t\t\twakeUpCommandClass.putInWakeUpQueue(serialMessage); //it's a battery operated device, place in wake-up queue.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n \t\n \tserialMessage.setTransmitOptions(TRANSMIT_OPTION_ACK | TRANSMIT_OPTION_AUTO_ROUTE | TRANSMIT_OPTION_EXPLORE);\n \tif (++sentDataPointer > 0xFF)\n \t\tsentDataPointer = 1;\n \tserialMessage.setCallbackId(sentDataPointer);\n \tlogger.debug(\"Callback ID = {}\", sentDataPointer);\n \tthis.enqueue(serialMessage);\n\t}",
"public static base_response export(nitro_service client, sslfipskey resource) throws Exception {\n\t\tsslfipskey exportresource = new sslfipskey();\n\t\texportresource.fipskeyname = resource.fipskeyname;\n\t\texportresource.key = resource.key;\n\t\treturn exportresource.perform_operation(client,\"export\");\n\t}",
"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 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 }",
"protected void reportWorked(int workIncrement, int currentUnitIndex) {\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.worked(workIncrement, (this.totalUnits* this.remainingIterations) - currentUnitIndex - 1);\n }\n }",
"@Override\n @Deprecated\n public List<CardWithActions> getBoardMemberActivity(String boardId, String memberId,\n String actionFilter, Argument... args) {\n if (actionFilter == null)\n actionFilter = \"all\";\n Argument[] argsAndFilter = Arrays.copyOf(args, args.length + 1);\n argsAndFilter[args.length] = new Argument(\"actions\", actionFilter);\n\n return asList(() -> get(createUrl(GET_BOARD_MEMBER_CARDS).params(argsAndFilter).asString(),\n CardWithActions[].class, boardId, memberId));\n }"
] |
Obtains a Pax zoned date-time from another date-time object.
@param temporal the date-time object to convert, not null
@return the Pax zoned date-time, not null
@throws DateTimeException if unable to create the date-time | [
"@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoZonedDateTime<PaxDate> zonedDateTime(TemporalAccessor temporal) {\n return (ChronoZonedDateTime<PaxDate>) super.zonedDateTime(temporal);\n }"
] | [
"public AbstractGraph getModuleGraph(final String moduleId) {\n final ModuleHandler moduleHandler = new ModuleHandler(repoHandler);\n final DbModule module = moduleHandler.getModule(moduleId);\n final DbOrganization organization = moduleHandler.getOrganization(module);\n\n filters.setCorporateFilter(new CorporateFilter(organization));\n\n final AbstractGraph graph = new ModuleGraph();\n addModuleToGraph(module, graph, 0);\n\n return graph;\n }",
"public CancelIndicator newCancelIndicator(final ResourceSet rs) {\n CancelIndicator _xifexpression = null;\n if ((rs instanceof XtextResourceSet)) {\n final boolean cancelationAllowed = (this.cancelationAllowed.get()).booleanValue();\n final int current = ((XtextResourceSet)rs).getModificationStamp();\n final CancelIndicator _function = () -> {\n return (cancelationAllowed && (((XtextResourceSet)rs).isOutdated() || (current != ((XtextResourceSet)rs).getModificationStamp())));\n };\n return _function;\n } else {\n _xifexpression = CancelIndicator.NullImpl;\n }\n return _xifexpression;\n }",
"public ParallelTaskBuilder prepareHttpOptions(String url) {\n reinitIfClosed();\n ParallelTaskBuilder cb = new ParallelTaskBuilder();\n cb.getHttpMeta().setHttpMethod(HttpMethod.OPTIONS);\n cb.getHttpMeta().setRequestUrlPostfix(url);\n return cb;\n\n }",
"private byte[] readStreamCompressed(InputStream stream) throws IOException\r\n {\r\n ByteArrayOutputStream bao = new ByteArrayOutputStream();\r\n GZIPOutputStream gos = new GZIPOutputStream(bao);\r\n OutputStreamWriter output = new OutputStreamWriter(gos);\r\n BufferedReader input = new BufferedReader(new InputStreamReader(stream));\r\n String line;\r\n\r\n while ((line = input.readLine()) != null)\r\n {\r\n output.write(line);\r\n output.write('\\n');\r\n }\r\n input.close();\r\n stream.close();\r\n output.close();\r\n gos.close();\r\n bao.close();\r\n return bao.toByteArray();\r\n }",
"public boolean invokeFunction(String funcName, Object[] args)\n {\n mLastError = null;\n if (mScriptFile != null)\n {\n if (mScriptFile.invokeFunction(funcName, args))\n {\n return true;\n }\n }\n mLastError = mScriptFile.getLastError();\n if ((mLastError != null) && !mLastError.contains(\"is not defined\"))\n {\n getGVRContext().logError(mLastError, this);\n }\n return false;\n }",
"public static Class<?> getRawType(Type type) {\n\t\tif (type instanceof Class) {\n\t\t\treturn (Class<?>) type;\n\t\t} else if (type instanceof ParameterizedType) {\n\t\t\tParameterizedType actualType = (ParameterizedType) type;\n\t\t\treturn getRawType(actualType.getRawType());\n\t\t} else if (type instanceof GenericArrayType) {\n\t\t\tGenericArrayType genericArrayType = (GenericArrayType) type;\n\t\t\tObject rawArrayType = Array.newInstance(getRawType(genericArrayType\n\t\t\t\t\t.getGenericComponentType()), 0);\n\t\t\treturn rawArrayType.getClass();\n\t\t} else if (type instanceof WildcardType) {\n\t\t\tWildcardType castedType = (WildcardType) type;\n\t\t\treturn getRawType(castedType.getUpperBounds()[0]);\n\t\t} else {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"Type \\'\"\n\t\t\t\t\t\t\t+ type\n\t\t\t\t\t\t\t+ \"\\' is not a Class, \"\n\t\t\t\t\t\t\t+ \"ParameterizedType, or GenericArrayType. Can't extract class.\");\n\t\t}\n\t}",
"public int size() {\n\t\tint size = cleared ? 0 : snapshot.size();\n\t\tfor ( Map.Entry<RowKey,AssociationOperation> op : currentState.entrySet() ) {\n\t\t\tswitch ( op.getValue().getType() ) {\n\t\t\t\tcase PUT:\n\t\t\t\t\tif ( cleared || !snapshot.containsKey( op.getKey() ) ) {\n\t\t\t\t\t\tsize++;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase REMOVE:\n\t\t\t\t\tif ( !cleared && snapshot.containsKey( op.getKey() ) ) {\n\t\t\t\t\t\tsize--;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn size;\n\t}",
"public static responderpolicylabel_responderpolicy_binding[] get(nitro_service service, String labelname) throws Exception{\n\t\tresponderpolicylabel_responderpolicy_binding obj = new responderpolicylabel_responderpolicy_binding();\n\t\tobj.set_labelname(labelname);\n\t\tresponderpolicylabel_responderpolicy_binding response[] = (responderpolicylabel_responderpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"@Override\n public PmdRuleSet create() {\n final SAXBuilder parser = new SAXBuilder();\n final Document dom;\n try {\n dom = parser.build(source);\n } catch (JDOMException | IOException e) {\n if (messages != null) {\n messages.addErrorText(INVALID_INPUT + \" : \" + e.getMessage());\n }\n LOG.error(INVALID_INPUT, e);\n return new PmdRuleSet();\n }\n\n final Element eltResultset = dom.getRootElement();\n final Namespace namespace = eltResultset.getNamespace();\n final PmdRuleSet result = new PmdRuleSet();\n\n final String name = eltResultset.getAttributeValue(\"name\");\n final Element descriptionElement = getChild(eltResultset, namespace);\n\n result.setName(name);\n\n if (descriptionElement != null) {\n result.setDescription(descriptionElement.getValue());\n }\n\n for (Element eltRule : getChildren(eltResultset, \"rule\", namespace)) {\n PmdRule pmdRule = new PmdRule(eltRule.getAttributeValue(\"ref\"));\n pmdRule.setClazz(eltRule.getAttributeValue(\"class\"));\n pmdRule.setName(eltRule.getAttributeValue(\"name\"));\n pmdRule.setMessage(eltRule.getAttributeValue(\"message\"));\n parsePmdPriority(eltRule, pmdRule, namespace);\n parsePmdProperties(eltRule, pmdRule, namespace);\n result.addRule(pmdRule);\n }\n return result;\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.