query
stringlengths 7
3.3k
| positive
sequencelengths 1
1
| negative
sequencelengths 9
9
|
---|---|---|
Read the relationships for an individual GanttProject task.
@param gpTask GanttProject task | [
"private void readRelationships(net.sf.mpxj.ganttproject.schema.Task gpTask)\n {\n for (Depend depend : gpTask.getDepend())\n {\n Task task1 = m_projectFile.getTaskByUniqueID(Integer.valueOf(NumberHelper.getInt(gpTask.getId()) + 1));\n Task task2 = m_projectFile.getTaskByUniqueID(Integer.valueOf(NumberHelper.getInt(depend.getId()) + 1));\n if (task1 != null && task2 != null)\n {\n Duration lag = Duration.getInstance(NumberHelper.getInt(depend.getDifference()), TimeUnit.DAYS);\n Relation relation = task2.addPredecessor(task1, getRelationType(depend.getType()), lag);\n m_eventManager.fireRelationReadEvent(relation);\n }\n }\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 }",
"public void credentialsMigration(T overrider, Class overriderClass) {\n try {\n deployerMigration(overrider, overriderClass);\n resolverMigration(overrider, overriderClass);\n } catch (NoSuchFieldException | IllegalAccessException | IOException e) {\n converterErrors.add(getConversionErrorMessage(overrider, e));\n }\n }",
"private void stopDone() {\n synchronized (stopLock) {\n final StopContext stopContext = this.stopContext;\n this.stopContext = null;\n if (stopContext != null) {\n stopContext.complete();\n }\n stopLock.notifyAll();\n }\n }",
"@Nonnull\n public BiMap<String, String> getOutputMapper() {\n final BiMap<String, String> outputMapper = this.processor.getOutputMapperBiMap();\n if (outputMapper == null) {\n return HashBiMap.create();\n }\n return outputMapper;\n }",
"public static double HighAccuracyComplemented(double x) {\n double[] R =\n {\n 1.25331413731550025, 0.421369229288054473, 0.236652382913560671,\n 0.162377660896867462, 0.123131963257932296, 0.0990285964717319214,\n 0.0827662865013691773, 0.0710695805388521071, 0.0622586659950261958\n };\n\n int j = (int) (0.5 * (Math.abs(x) + 1));\n\n double a = R[j];\n double z = 2 * j;\n double b = a * z - 1;\n\n double h = Math.abs(x) - z;\n double q = h * h;\n double pwr = 1;\n\n double sum = a + h * b;\n double term = a;\n\n\n for (int i = 2; sum != term; i += 2) {\n term = sum;\n\n a = (a + z * b) / (i);\n b = (b + z * a) / (i + 1);\n pwr *= q;\n\n sum = term + pwr * (a + h * b);\n }\n\n sum *= Math.exp(-0.5 * (x * x) - 0.5 * Constants.Log2PI);\n\n return (x >= 0) ? sum : (1.0 - sum);\n }",
"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 int getIndexMax() {\n int indexMax = 0;\n double max = getEigenvalue(0).getMagnitude2();\n\n final int N = getNumberOfEigenvalues();\n for( int i = 1; i < N; i++ ) {\n double m = getEigenvalue(i).getMagnitude2();\n if( m > max ) {\n max = m;\n indexMax = i;\n }\n }\n\n return indexMax;\n }",
"public static boolean equal(Vector3f v1, Vector3f v2) {\n return equal(v1.x, v2.x) && equal(v1.y, v2.y) && equal(v1.z, v2.z);\n }",
"private void cascadeMarkedForDeletion()\r\n {\r\n List alreadyPrepared = new ArrayList();\r\n for(int i = 0; i < markedForDeletionList.size(); i++)\r\n {\r\n ObjectEnvelope mod = (ObjectEnvelope) markedForDeletionList.get(i);\r\n // if the object wasn't associated with another object, start cascade delete\r\n if(!isNewAssociatedObject(mod.getIdentity()))\r\n {\r\n cascadeDeleteFor(mod, alreadyPrepared);\r\n alreadyPrepared.clear();\r\n }\r\n }\r\n markedForDeletionList.clear();\r\n }"
] |
Create a BoxStoragePolicyAssignment for a BoxStoragePolicy.
@param api the API connection to be used by the resource.
@param policyID the policy ID of the BoxStoragePolicy.
@param userID the user ID of the to assign the BoxStoragePolicy to.
@return the information about the BoxStoragePolicyAssignment created. | [
"public static BoxStoragePolicyAssignment.Info create(BoxAPIConnection api, String policyID, String userID) {\n URL url = STORAGE_POLICY_ASSIGNMENT_URL_TEMPLATE.build(api.getBaseURL());\n BoxJSONRequest request = new BoxJSONRequest(api, url, HttpMethod.POST);\n JsonObject requestJSON = new JsonObject()\n .add(\"storage_policy\", new JsonObject()\n .add(\"type\", \"storage_policy\")\n .add(\"id\", policyID))\n .add(\"assigned_to\", new JsonObject()\n .add(\"type\", \"user\")\n .add(\"id\", userID));\n\n request.setBody(requestJSON.toString());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n\n BoxStoragePolicyAssignment storagePolicyAssignment = new BoxStoragePolicyAssignment(api,\n responseJSON.get(\"id\").asString());\n\n return storagePolicyAssignment.new Info(responseJSON);\n }"
] | [
"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 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 }",
"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 }",
"public static <T, ID> int dropTable(Dao<T, ID> dao, boolean ignoreErrors) throws SQLException {\n\t\tConnectionSource connectionSource = dao.getConnectionSource();\n\t\tClass<T> dataClass = dao.getDataClass();\n\t\tDatabaseType databaseType = connectionSource.getDatabaseType();\n\t\tif (dao instanceof BaseDaoImpl<?, ?>) {\n\t\t\treturn doDropTable(databaseType, connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), ignoreErrors);\n\t\t} else {\n\t\t\tTableInfo<T, ID> tableInfo = new TableInfo<T, ID>(databaseType, dataClass);\n\t\t\treturn doDropTable(databaseType, connectionSource, tableInfo, ignoreErrors);\n\t\t}\n\t}",
"public static BoxDeveloperEditionAPIConnection getAppEnterpriseConnection(String enterpriseId, String clientId,\n String clientSecret, JWTEncryptionPreferences encryptionPref, IAccessTokenCache accessTokenCache) {\n\n BoxDeveloperEditionAPIConnection connection = new BoxDeveloperEditionAPIConnection(enterpriseId,\n DeveloperEditionEntityType.ENTERPRISE, clientId, clientSecret, encryptionPref, accessTokenCache);\n\n connection.tryRestoreUsingAccessTokenCache();\n\n return connection;\n }",
"public static int getSystemPort(String portIdentifier) {\n int defaultPort = 0;\n\n if (portIdentifier.compareTo(Constants.SYS_API_PORT) == 0) {\n defaultPort = Constants.DEFAULT_API_PORT;\n } else if (portIdentifier.compareTo(Constants.SYS_DB_PORT) == 0) {\n defaultPort = Constants.DEFAULT_DB_PORT;\n } else if (portIdentifier.compareTo(Constants.SYS_FWD_PORT) == 0) {\n defaultPort = Constants.DEFAULT_FWD_PORT;\n } else if (portIdentifier.compareTo(Constants.SYS_HTTP_PORT) == 0) {\n defaultPort = Constants.DEFAULT_HTTP_PORT;\n } else if (portIdentifier.compareTo(Constants.SYS_HTTPS_PORT) == 0) {\n defaultPort = Constants.DEFAULT_HTTPS_PORT;\n } else {\n return defaultPort;\n }\n\n String portStr = System.getenv(portIdentifier);\n return (portStr == null || portStr.isEmpty()) ? defaultPort : Integer.valueOf(portStr);\n }",
"public void register() {\n synchronized (loaders) {\n loaders.add(this);\n\n maximumHeaderLength = 0;\n for (GVRCompressedTextureLoader loader : loaders) {\n int headerLength = loader.headerLength();\n if (headerLength > maximumHeaderLength) {\n maximumHeaderLength = headerLength;\n }\n }\n }\n }",
"private void setFittingWeekDay(Calendar date) {\n\n date.set(Calendar.DAY_OF_MONTH, 1);\n int weekDayFirst = date.get(Calendar.DAY_OF_WEEK);\n int firstFittingWeekDay = (((m_weekDay.toInt() + I_CmsSerialDateValue.NUM_OF_WEEKDAYS) - weekDayFirst)\n % I_CmsSerialDateValue.NUM_OF_WEEKDAYS) + 1;\n int fittingWeekDay = firstFittingWeekDay + (I_CmsSerialDateValue.NUM_OF_WEEKDAYS * m_weekOfMonth.ordinal());\n if (fittingWeekDay > date.getActualMaximum(Calendar.DAY_OF_MONTH)) {\n fittingWeekDay -= I_CmsSerialDateValue.NUM_OF_WEEKDAYS;\n }\n date.set(Calendar.DAY_OF_MONTH, fittingWeekDay);\n }",
"boolean deleteEntity(@NotNull final PersistentStoreTransaction txn, @NotNull final PersistentEntity entity) {\n clearProperties(txn, entity);\n clearBlobs(txn, entity);\n deleteLinks(txn, entity);\n final PersistentEntityId id = entity.getId();\n final int entityTypeId = id.getTypeId();\n final long entityLocalId = id.getLocalId();\n final ByteIterable key = LongBinding.longToCompressedEntry(entityLocalId);\n if (config.isDebugSearchForIncomingLinksOnDelete()) {\n // search for incoming links\n final List<String> allLinkNames = getAllLinkNames(txn);\n for (final String entityType : txn.getEntityTypes()) {\n for (final String linkName : allLinkNames) {\n //noinspection LoopStatementThatDoesntLoop\n for (final Entity referrer : txn.findLinks(entityType, entity, linkName)) {\n throw new EntityStoreException(entity +\n \" is about to be deleted, but it is referenced by \" + referrer + \", link name: \" + linkName);\n }\n }\n }\n }\n if (getEntitiesTable(txn, entityTypeId).delete(txn.getEnvironmentTransaction(), key)) {\n txn.entityDeleted(id);\n return true;\n }\n return false;\n }"
] |
Returns s if it's at most maxWidth chars, otherwise chops right side to fit. | [
"public static String trim(String s, int maxWidth) {\r\n if (s.length() <= maxWidth) {\r\n return (s);\r\n }\r\n return (s.substring(0, maxWidth));\r\n }"
] | [
"public static void addJarToClasspath(ClassLoader loader, URL url) throws IOException,\n IllegalAccessException, IllegalArgumentException, InvocationTargetException,\n NoSuchMethodException, SecurityException {\n URLClassLoader sysloader = (URLClassLoader) loader;\n Class<?> sysclass = URLClassLoader.class;\n\n Method method =\n sysclass.getDeclaredMethod(MyClasspathUtils.ADD_URL_METHOD, new Class[] {URL.class});\n method.setAccessible(true);\n method.invoke(sysloader, new Object[] {url});\n\n }",
"public void setType(CheckBoxType type) {\n this.type = type;\n switch (type) {\n case FILLED:\n Element input = DOM.getChild(getElement(), 0);\n input.setAttribute(\"class\", CssName.FILLED_IN);\n break;\n case INTERMEDIATE:\n addStyleName(type.getCssName() + \"-checkbox\");\n break;\n default:\n addStyleName(type.getCssName());\n break;\n }\n }",
"public static clusterinstance[] get(nitro_service service, Long clid[]) throws Exception{\n\t\tif (clid !=null && clid.length>0) {\n\t\t\tclusterinstance response[] = new clusterinstance[clid.length];\n\t\t\tclusterinstance obj[] = new clusterinstance[clid.length];\n\t\t\tfor (int i=0;i<clid.length;i++) {\n\t\t\t\tobj[i] = new clusterinstance();\n\t\t\t\tobj[i].set_clid(clid[i]);\n\t\t\t\tresponse[i] = (clusterinstance) obj[i].get_resource(service);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t\treturn null;\n\t}",
"Map<UUID, UUID> getActivityCodes(Activity activity)\n {\n Map<UUID, UUID> map = m_activityCodeCache.get(activity);\n if (map == null)\n {\n map = new HashMap<UUID, UUID>();\n m_activityCodeCache.put(activity, map);\n for (CodeAssignment ca : activity.getCodeAssignment())\n {\n UUID code = getUUID(ca.getCodeUuid(), ca.getCode());\n UUID value = getUUID(ca.getValueUuid(), ca.getValue());\n map.put(code, value);\n }\n }\n return map;\n }",
"private String getProjectName() {\n String pName = Strings.emptyToNull(projectName);\n if (pName == null) { \n pName = Strings.emptyToNull(junit4.getProject().getName());\n }\n if (pName == null) {\n pName = \"(unnamed project)\"; \n }\n return pName;\n }",
"public void initSize(Rectangle rectangle) {\n\t\ttemplate = writer.getDirectContent().createTemplate(rectangle.getWidth(), rectangle.getHeight());\n\t}",
"private void initComponents(List<CmsSetupComponent> components) {\n\n for (CmsSetupComponent component : components) {\n CheckBox checkbox = new CheckBox();\n checkbox.setValue(component.isChecked());\n checkbox.setCaption(component.getName() + \" - \" + component.getDescription());\n checkbox.setDescription(component.getDescription());\n checkbox.setData(component);\n checkbox.setWidth(\"100%\");\n m_components.addComponent(checkbox);\n m_componentCheckboxes.add(checkbox);\n m_componentMap.put(component.getId(), component);\n\n }\n }",
"private int[] convertBatch(int[] batch) {\n int[] conv = new int[batch.length];\n for (int i=0; i<batch.length; i++) {\n conv[i] = sample[batch[i]];\n }\n return conv;\n }",
"protected boolean isChangedByMask(int maskValue, Integer segmentPrefixLength) throws IncompatibleAddressException {\r\n\t\tboolean hasBits = (segmentPrefixLength != null);\r\n\t\tif(hasBits && (segmentPrefixLength < 0 || segmentPrefixLength > getBitCount())) {\r\n\t\t\tthrow new PrefixLenException(this, segmentPrefixLength);\r\n\t\t}\r\n\t\t\r\n\t\t//note that the mask can represent a range (for example a CIDR mask), \r\n\t\t//but we use the lowest value (maskSegment.value) in the range when masking (ie we discard the range)\r\n\t\tint value = getSegmentValue();\r\n\t\tint upperValue = getUpperSegmentValue();\r\n\t\treturn value != (value & maskValue) ||\r\n\t\t\t\tupperValue != (upperValue & maskValue) ||\r\n\t\t\t\t\t\t(isPrefixed() ? !getSegmentPrefixLength().equals(segmentPrefixLength) : hasBits);\r\n\t}"
] |
Return a list of photos for a user at a specific latitude, longitude and accuracy.
@param location
@param extras
@param perPage
@param page
@return The collection of Photo objects
@throws FlickrException
@see com.flickr4java.flickr.photos.Extras | [
"public PhotoList<Photo> photosForLocation(GeoData location, Set<String> extras, int perPage, int page) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n PhotoList<Photo> photos = new PhotoList<Photo>();\r\n parameters.put(\"method\", METHOD_PHOTOS_FOR_LOCATION);\r\n\r\n if (extras.size() > 0) {\r\n parameters.put(\"extras\", StringUtilities.join(extras, \",\"));\r\n }\r\n if (perPage > 0) {\r\n parameters.put(\"per_page\", Integer.toString(perPage));\r\n }\r\n if (page > 0) {\r\n parameters.put(\"page\", Integer.toString(page));\r\n }\r\n parameters.put(\"lat\", Float.toString(location.getLatitude()));\r\n parameters.put(\"lon\", Float.toString(location.getLongitude()));\r\n parameters.put(\"accuracy\", Integer.toString(location.getAccuracy()));\r\n Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n Element photosElement = response.getPayload();\r\n photos.setPage(photosElement.getAttribute(\"page\"));\r\n photos.setPages(photosElement.getAttribute(\"pages\"));\r\n photos.setPerPage(photosElement.getAttribute(\"perpage\"));\r\n photos.setTotal(photosElement.getAttribute(\"total\"));\r\n\r\n NodeList photoElements = photosElement.getElementsByTagName(\"photo\");\r\n for (int i = 0; i < photoElements.getLength(); i++) {\r\n Element photoElement = (Element) photoElements.item(i);\r\n photos.add(PhotoUtils.createPhoto(photoElement));\r\n }\r\n return photos;\r\n }"
] | [
"private OperationResponse executeForResult(final OperationExecutionContext executionContext) throws IOException {\n try {\n return execute(executionContext).get();\n } catch(Exception e) {\n throw new IOException(e);\n }\n }",
"private void readPattern(JSONObject patternJson) {\n\n setPatternType(readPatternType(patternJson));\n setInterval(readOptionalInt(patternJson, JsonKey.PATTERN_INTERVAL));\n setWeekDays(readWeekDays(patternJson));\n setDayOfMonth(readOptionalInt(patternJson, JsonKey.PATTERN_DAY_OF_MONTH));\n setEveryWorkingDay(readOptionalBoolean(patternJson, JsonKey.PATTERN_EVERYWORKINGDAY));\n setWeeksOfMonth(readWeeksOfMonth(patternJson));\n setIndividualDates(readDates(readOptionalArray(patternJson, JsonKey.PATTERN_DATES)));\n setMonth(readOptionalMonth(patternJson, JsonKey.PATTERN_MONTH));\n\n }",
"public synchronized void removeControlPoint(ControlPoint controlPoint) {\n if (controlPoint.decreaseReferenceCount() == 0) {\n ControlPointIdentifier id = new ControlPointIdentifier(controlPoint.getDeployment(), controlPoint.getEntryPoint());\n entryPoints.remove(id);\n }\n }",
"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 }",
"public static final PatchOperationTarget createHost(final String hostName, final ModelControllerClient client) {\n final PathElement host = PathElement.pathElement(HOST, hostName);\n final PathAddress address = PathAddress.EMPTY_ADDRESS.append(host, CORE_SERVICES);\n return new RemotePatchOperationTarget(address, client);\n }",
"public void setHtmlElementTranslator(HtmlElementTranslator htmlElementTranslator) {\r\n\t\tif(htmlElementTranslator!=null){\r\n\t\t\tthis.htmlElementTranslator = htmlElementTranslator;\r\n\t\t\tthis.charTranslator = null;\r\n\t\t\tthis.targetTranslator = null;\r\n\t\t}\r\n\t}",
"private String getCachedETag(HttpHost host, String file) {\n Map<String, Object> cachedETags = readCachedETags();\n\n @SuppressWarnings(\"unchecked\")\n Map<String, Object> hostMap =\n (Map<String, Object>)cachedETags.get(host.toURI());\n if (hostMap == null) {\n return null;\n }\n\n @SuppressWarnings(\"unchecked\")\n Map<String, String> etagMap = (Map<String, String>)hostMap.get(file);\n if (etagMap == null) {\n return null;\n }\n\n return etagMap.get(\"ETag\");\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 }",
"@Override\n public InternationalFixedDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {\n return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);\n }"
] |
Registers a handler and returns the callback key to be passed to
Javascript.
@param handler Handler to be registered.
@return A String random UUID that can be used as the callback key. | [
"public String registerHandler(GFXEventHandler handler) {\n String uuid = UUID.randomUUID().toString();\n handlers.put(uuid, handler);\n return uuid;\n }"
] | [
"public static base_response unset(nitro_service client, nstimeout resource, String[] args) throws Exception{\n\t\tnstimeout unsetresource = new nstimeout();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}",
"public void addSerie(AbstractColumn column, StringExpression labelExpression) {\r\n\t\tseries.add(column);\r\n\t\tseriesLabels.put(column, labelExpression);\r\n\t}",
"public String getTexCoordShaderVar(String texName)\n {\n GVRTexture tex = textures.get(texName);\n if (tex != null)\n {\n return tex.getTexCoordShaderVar();\n }\n return null;\n }",
"protected Violation createViolation(Integer lineNumber, String sourceLine, String message) {\n Violation violation = new Violation();\n violation.setRule(this);\n violation.setSourceLine(sourceLine);\n violation.setLineNumber(lineNumber);\n violation.setMessage(message);\n return violation;\n }",
"@SuppressWarnings(\"WeakerAccess\")\n public static synchronized SlotReference getSlotReference(int player, CdjStatus.TrackSourceSlot slot) {\n Map<CdjStatus.TrackSourceSlot, SlotReference> playerMap = instances.get(player);\n if (playerMap == null) {\n playerMap = new HashMap<CdjStatus.TrackSourceSlot, SlotReference>();\n instances.put(player, playerMap);\n }\n SlotReference result = playerMap.get(slot);\n if (result == null) {\n result = new SlotReference(player, slot);\n playerMap.put(slot, result);\n }\n return result;\n }",
"public final String getPath(final String key) {\n StringBuilder result = new StringBuilder();\n addPathTo(result);\n result.append(\".\");\n result.append(getPathElement(key));\n return result.toString();\n }",
"public static base_response rename(nitro_service client, nsacl6 resource, String new_acl6name) throws Exception {\n\t\tnsacl6 renameresource = new nsacl6();\n\t\trenameresource.acl6name = resource.acl6name;\n\t\treturn renameresource.rename_resource(client,new_acl6name);\n\t}",
"protected ClassDescriptor getClassDescriptor()\r\n {\r\n ClassDescriptor cld = (ClassDescriptor) m_classDescriptor.get();\r\n if(cld == null)\r\n {\r\n throw new OJBRuntimeException(\"Requested ClassDescriptor instance was already GC by JVM\");\r\n }\r\n return cld;\r\n }",
"private void setExceptions(ProjectCalendar mpxjCalendar, Calendars gpCalendar)\n {\n List<net.sf.mpxj.ganttproject.schema.Date> dates = gpCalendar.getDate();\n for (net.sf.mpxj.ganttproject.schema.Date date : dates)\n {\n addException(mpxjCalendar, date);\n }\n }"
] |
Converts a gwt Date in the timezone of the current browser to a time in
UTC.
@return A Long corresponding to the number of milliseconds since January
1, 1970, 00:00:00 GMT or null if the specified Date is null. | [
"public static final Long date2utc(Date date) {\n\n // use null for a null date\n if (date == null) return null;\n \n long time = date.getTime();\n \n // remove the timezone offset \n time -= timezoneOffsetMillis(date);\n \n return time;\n }"
] | [
"public static URL getAuthorizationURL(String clientID, URI redirectUri, String state, List<String> scopes) {\n URLTemplate template = new URLTemplate(AUTHORIZATION_URL);\n QueryStringBuilder queryBuilder = new QueryStringBuilder().appendParam(\"client_id\", clientID)\n .appendParam(\"response_type\", \"code\")\n .appendParam(\"redirect_uri\", redirectUri.toString())\n .appendParam(\"state\", state);\n\n if (scopes != null && !scopes.isEmpty()) {\n StringBuilder builder = new StringBuilder();\n int size = scopes.size() - 1;\n int i = 0;\n while (i < size) {\n builder.append(scopes.get(i));\n builder.append(\" \");\n i++;\n }\n builder.append(scopes.get(i));\n\n queryBuilder.appendParam(\"scope\", builder.toString());\n }\n\n return template.buildWithQuery(\"\", queryBuilder.toString());\n }",
"private String escapeAndJoin(String[] commandline) {\n // TODO: we should try to escape special characters here, depending on the OS.\n StringBuilder b = new StringBuilder();\n Pattern specials = Pattern.compile(\"[\\\\ ]\");\n for (String arg : commandline) {\n if (b.length() > 0) {\n b.append(\" \");\n }\n\n if (specials.matcher(arg).find()) {\n b.append('\"').append(arg).append('\"');\n } else {\n b.append(arg);\n }\n }\n return b.toString();\n }",
"private static void handlePing(final Channel channel, final ManagementProtocolHeader header) throws IOException {\n final ManagementProtocolHeader response = new ManagementPongHeader(header.getVersion());\n final MessageOutputStream output = channel.writeMessage();\n try {\n writeHeader(response, output);\n output.close();\n } finally {\n StreamUtils.safeClose(output);\n }\n }",
"private String getStringPredicate(String fieldName, List<String> filterValues, List<Object> prms)\n {\n if (filterValues != null && !filterValues.isEmpty())\n {\n String res = \"\";\n for (String filterValue : filterValues)\n {\n if (filterValue == null)\n {\n continue;\n }\n if (!filterValue.isEmpty())\n {\n prms.add(filterValue);\n if (filterValue.contains(\"%\"))\n {\n res += String.format(\"(%s LIKE ?) OR \", fieldName);\n }\n else\n {\n res += String.format(\"(%s = ?) OR \", fieldName);\n }\n }\n else\n {\n res += String.format(\"(%s IS NULL OR %s = '') OR \", fieldName, fieldName);\n }\n }\n if (!res.isEmpty())\n {\n res = \"AND (\" + res.substring(0, res.length() - 4) + \") \";\n return res;\n }\n }\n return \"\";\n }",
"public void setFinalTransformMatrix(Matrix4f finalTransform)\n {\n float[] mat = new float[16];\n finalTransform.get(mat);\n NativeBone.setFinalTransformMatrix(getNative(), mat);\n }",
"public static base_response update(nitro_service client, sslcertkey resource) throws Exception {\n\t\tsslcertkey updateresource = new sslcertkey();\n\t\tupdateresource.certkey = resource.certkey;\n\t\tupdateresource.expirymonitor = resource.expirymonitor;\n\t\tupdateresource.notificationperiod = resource.notificationperiod;\n\t\treturn updateresource.update_resource(client);\n\t}",
"public static base_response unset(nitro_service client, protocolhttpband resource, String[] args) throws Exception{\n\t\tprotocolhttpband unsetresource = new protocolhttpband();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}",
"public void shutdown() {\n debugConnection = null;\n shuttingDown = true;\n try {\n if (serverSocket != null) {\n serverSocket.close();\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }",
"public <Ex extends Throwable> Try<R,Ex> execute(T input,Class<Ex> classes){\n\t\t\n\t\treturn Try.withCatch( ()->transactionTemplate.execute(status-> transaction.apply(input)),classes);\n\t\t \n\t}"
] |
Private used static method for creation of a RemoteWebDriver. Taking care of the default
Capabilities and using the HttpCommandExecutor.
@param hubUrl the url of the hub to use.
@return the RemoteWebDriver instance. | [
"private static RemoteWebDriver buildRemoteWebDriver(String hubUrl) {\n\t\tDesiredCapabilities capabilities = new DesiredCapabilities();\n\t\tcapabilities.setPlatform(Platform.ANY);\n\t\tURL url;\n\t\ttry {\n\t\t\turl = new URL(hubUrl);\n\t\t} catch (MalformedURLException e) {\n\t\t\tLOGGER.error(\"The given hub url of the remote server is malformed can not continue!\",\n\t\t\t\t\te);\n\t\t\treturn null;\n\t\t}\n\t\tHttpCommandExecutor executor = null;\n\t\ttry {\n\t\t\texecutor = new HttpCommandExecutor(url);\n\t\t} catch (Exception e) {\n\t\t\t// TODO Stefan; refactor this catch, this will definitely result in\n\t\t\t// NullPointers, why\n\t\t\t// not throw RuntimeException direct?\n\t\t\tLOGGER.error(\n\t\t\t\t\t\"Received unknown exception while creating the \"\n\t\t\t\t\t\t\t+ \"HttpCommandExecutor, can not continue!\",\n\t\t\t\t\te);\n\t\t\treturn null;\n\t\t}\n\t\treturn new RemoteWebDriver(executor, capabilities);\n\t}"
] | [
"public int sharedSegments(Triangle t2) {\n\t\tint counter = 0;\n\n\t\tif(a.equals(t2.a)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(a.equals(t2.b)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(a.equals(t2.c)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(b.equals(t2.a)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(b.equals(t2.b)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(b.equals(t2.c)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(c.equals(t2.a)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(c.equals(t2.b)) {\n\t\t\tcounter++;\n\t\t}\n\t\tif(c.equals(t2.c)) {\n\t\t\tcounter++;\n\t\t}\n\n\t\treturn counter;\n\t}",
"@Override\n\tpublic void processItemDocument(ItemDocument itemDocument) {\n\t\tthis.countItems++;\n\n\t\t// Do some printing for demonstration/debugging.\n\t\t// Only print at most 50 items (or it would get too slow).\n\t\tif (this.countItems < 10) {\n\t\t\tSystem.out.println(itemDocument);\n\t\t} else if (this.countItems == 10) {\n\t\t\tSystem.out.println(\"*** I won't print any further items.\\n\"\n\t\t\t\t\t+ \"*** We will never finish if we print all the items.\\n\"\n\t\t\t\t\t+ \"*** Maybe remove this debug output altogether.\");\n\t\t}\n\t}",
"public static int countTrue(BMatrixRMaj A) {\n int total = 0;\n\n int N = A.getNumElements();\n\n for (int i = 0; i < N; i++) {\n if( A.data[i] )\n total++;\n }\n\n return total;\n }",
"public HttpConnection setRequestBody(final InputStream input, final long inputLength) {\n try {\n return setRequestBody(new InputStreamWrappingGenerator(input, inputLength),\n inputLength);\n } catch (IOException e) {\n logger.log(Level.SEVERE, \"Error copying input stream for request body\", e);\n throw new RuntimeException(e);\n }\n }",
"public boolean unlink(D declaration, ServiceReference<S> declarationBinderRef) {\n S declarationBinder = bindersManager.getDeclarationBinder(declarationBinderRef);\n try {\n declarationBinder.removeDeclaration(declaration);\n } catch (BinderException e) {\n LOG.debug(declarationBinder + \" throw an exception when removing of it the Declaration \"\n + declaration, e);\n declaration.unhandle(declarationBinderRef);\n return false;\n } finally {\n declaration.unbind(declarationBinderRef);\n }\n return true;\n }",
"public static transformpolicylabel get(nitro_service service, String labelname) throws Exception{\n\t\ttransformpolicylabel obj = new transformpolicylabel();\n\t\tobj.set_labelname(labelname);\n\t\ttransformpolicylabel response = (transformpolicylabel) obj.get_resource(service);\n\t\treturn response;\n\t}",
"public static DoubleMatrix absi(DoubleMatrix x) { \n\t\t/*# mapfct('Math.abs') #*/\n//RJPP-BEGIN------------------------------------------------------------\n\t for (int i = 0; i < x.length; i++)\n\t x.put(i, (double) Math.abs(x.get(i)));\n\t return x;\n//RJPP-END--------------------------------------------------------------\n\t}",
"public void fireEvent(final WorkerEvent event, final Worker worker, final String queue, final Job job, \n final Object runner, final Object result, final Throwable t) {\n final ConcurrentSet<WorkerListener> listeners = this.eventListenerMap.get(event);\n if (listeners != null) {\n for (final WorkerListener listener : listeners) {\n if (listener != null) {\n try {\n listener.onEvent(event, worker, queue, job, runner, result, t);\n } catch (Exception e) {\n log.error(\"Failure executing listener \" + listener + \" for event \" + event \n + \" from queue \" + queue + \" on worker \" + worker, e);\n }\n }\n }\n }\n }",
"public static aaauser_vpntrafficpolicy_binding[] get(nitro_service service, String username) throws Exception{\n\t\taaauser_vpntrafficpolicy_binding obj = new aaauser_vpntrafficpolicy_binding();\n\t\tobj.set_username(username);\n\t\taaauser_vpntrafficpolicy_binding response[] = (aaauser_vpntrafficpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}"
] |
Use this API to fetch the statistics of all service_stats resources that are configured on netscaler. | [
"public static service_stats[] get(nitro_service service) throws Exception{\n\t\tservice_stats obj = new service_stats();\n\t\tservice_stats[] response = (service_stats[])obj.stat_resources(service);\n\t\treturn response;\n\t}"
] | [
"private Component createAddKeyButton() {\n\n // the \"+\" button\n Button addKeyButton = new Button();\n addKeyButton.addStyleName(\"icon-only\");\n addKeyButton.addStyleName(\"borderless-colored\");\n addKeyButton.setDescription(m_messages.key(Messages.GUI_ADD_KEY_0));\n addKeyButton.setIcon(FontOpenCms.CIRCLE_PLUS, m_messages.key(Messages.GUI_ADD_KEY_0));\n addKeyButton.addClickListener(new ClickListener() {\n\n private static final long serialVersionUID = 1L;\n\n public void buttonClick(ClickEvent event) {\n\n handleAddKey();\n\n }\n });\n return addKeyButton;\n }",
"public static String readStringFromUrlGeneric(String url)\n throws IOException {\n InputStream is = null;\n URL urlObj = null;\n String responseString = PcConstants.NA;\n try {\n urlObj = new URL(url);\n URLConnection con = urlObj.openConnection();\n\n con.setConnectTimeout(ParallecGlobalConfig.urlConnectionConnectTimeoutMillis);\n con.setReadTimeout(ParallecGlobalConfig.urlConnectionReadTimeoutMillis);\n is = con.getInputStream();\n\n BufferedReader rd = new BufferedReader(new InputStreamReader(is,\n Charset.forName(\"UTF-8\")));\n responseString = PcFileNetworkIoUtils.readAll(rd);\n\n } finally {\n\n if (is != null) {\n is.close();\n }\n\n }\n\n return responseString;\n }",
"public boolean switchToStateAndCheckIfClone(final Eventable event, StateVertex newState,\n\t\t\t\t\t\t\t\t\t\t\t\tCrawlerContext context) {\n\t\tStateVertex cloneState = this.addStateToCurrentState(newState, event);\n\n\t\trunOnInvariantViolationPlugins(context);\n\n\t\tif (cloneState == null) {\n\t\t\tchangeState(newState);\n\t\t\tplugins.runOnNewStatePlugins(context, newState);\n\t\t\treturn true;\n\t\t} else {\n\t\t\tchangeState(cloneState);\n\t\t\treturn false;\n\t\t}\n\t}",
"public static final Date parseExtendedAttributeDate(String value)\n {\n Date result = null;\n\n if (value != null)\n {\n try\n {\n result = DATE_FORMAT.get().parse(value);\n }\n\n catch (ParseException ex)\n {\n // ignore exceptions\n }\n }\n\n return (result);\n }",
"public ConnectionlessBootstrap bootStrapUdpClient()\n throws HttpRequestCreateException {\n\n ConnectionlessBootstrap udpClient = null;\n try {\n\n // Configure the client.\n udpClient = new ConnectionlessBootstrap(udpMeta.getChannelFactory());\n\n udpClient.setPipeline(new UdpPipelineFactory(\n TcpUdpSshPingResourceStore.getInstance().getTimer(), this)\n .getPipeline());\n\n } catch (Exception t) {\n throw new TcpUdpRequestCreateException(\n \"Error in creating request in udp worker. \"\n + \" If udpClient is null. Then fail to create.\", t);\n }\n\n return udpClient;\n\n }",
"public String getModulePaths() {\n final StringBuilder result = new StringBuilder();\n if (addDefaultModuleDir) {\n result.append(wildflyHome.resolve(\"modules\").toString());\n }\n if (!modulesDirs.isEmpty()) {\n if (addDefaultModuleDir) result.append(File.pathSeparator);\n for (Iterator<String> iterator = modulesDirs.iterator(); iterator.hasNext(); ) {\n result.append(iterator.next());\n if (iterator.hasNext()) {\n result.append(File.pathSeparator);\n }\n }\n }\n return result.toString();\n }",
"private void fillToolBar(final I_CmsAppUIContext context) {\n\n context.setAppTitle(m_messages.key(Messages.GUI_APP_TITLE_0));\n\n // create components\n Component publishBtn = createPublishButton();\n m_saveBtn = createSaveButton();\n m_saveExitBtn = createSaveExitButton();\n Component closeBtn = createCloseButton();\n\n context.enableDefaultToolbarButtons(false);\n context.addToolbarButtonRight(closeBtn);\n context.addToolbarButton(publishBtn);\n context.addToolbarButton(m_saveExitBtn);\n context.addToolbarButton(m_saveBtn);\n\n Component addDescriptorBtn = createAddDescriptorButton();\n if (m_model.hasDescriptor() || m_model.getBundleType().equals(BundleType.DESCRIPTOR)) {\n addDescriptorBtn.setEnabled(false);\n }\n context.addToolbarButton(addDescriptorBtn);\n if (m_model.getBundleType().equals(BundleType.XML)) {\n Component convertToPropertyBundleBtn = createConvertToPropertyBundleButton();\n context.addToolbarButton(convertToPropertyBundleBtn);\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 Token add( Function function ) {\n Token t = new Token(function);\n push( t );\n return t;\n }"
] |
Adds a property to report design, this properties are mostly used by
exporters to know if any specific configuration is needed
@param name
@param value
@return A Dynamic Report Builder | [
"public DynamicReportBuilder setProperty(String name, String value) {\n this.report.setProperty(name, value);\n return this;\n }"
] | [
"public static FullTypeSignature getTypeSignature(Class<?> clazz, Class<?>[] typeArgs) {\n\t\tClassTypeSignature rawClassTypeSignature = (ClassTypeSignature) javaTypeToTypeSignature\n\t\t\t\t.getTypeSignature(clazz);\n\t\tTypeArgSignature[] typeArgSignatures = new TypeArgSignature[typeArgs.length];\n\t\tfor (int i = 0; i < typeArgs.length; i++) {\n\t\t\ttypeArgSignatures[i] = new TypeArgSignature(\n\t\t\t\t\tTypeArgSignature.NO_WILDCARD,\n\t\t\t\t\t(FieldTypeSignature) javaTypeToTypeSignature\n\t\t\t\t\t\t\t.getTypeSignature(typeArgs[i]));\n\t\t}\n\t\tClassTypeSignature classTypeSignature = new ClassTypeSignature(\n\t\t\t\trawClassTypeSignature.getBinaryName(), typeArgSignatures,\n\t\t\t\trawClassTypeSignature.getOwnerTypeSignature());\n\n\t\treturn classTypeSignature;\n\t}",
"public Weld addPackages(boolean scanRecursively, Class<?>... packageClasses) {\n for (Class<?> packageClass : packageClasses) {\n addPackage(scanRecursively, packageClass);\n }\n return this;\n }",
"public static <T> void finish(T query, long correlationId, EventBus bus, String... labels) {\n for (String type : labels) {\n RemoveLabelledQuery<T> next = finish(query, correlationId, type);\n bus.post(next);\n }\n }",
"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, ntpserver resource, String[] args) throws Exception{\n\t\tntpserver unsetresource = new ntpserver();\n\t\tunsetresource.serverip = resource.serverip;\n\t\tunsetresource.servername = resource.servername;\n\t\treturn unsetresource.unset_resource(client,args);\n\t}",
"public void initialize() {\n\t\tif (dataClass == null) {\n\t\t\tthrow new IllegalStateException(\"dataClass was never set on \" + getClass().getSimpleName());\n\t\t}\n\t\tif (tableName == null) {\n\t\t\ttableName = extractTableName(databaseType, dataClass);\n\t\t}\n\t}",
"public <T> DiffNode compare(final T working, final T base)\n\t{\n\t\tdispatcher.resetInstanceMemory();\n\t\ttry\n\t\t{\n\t\t\treturn dispatcher.dispatch(DiffNode.ROOT, Instances.of(working, base), RootAccessor.getInstance());\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\tdispatcher.clearInstanceMemory();\n\t\t}\n\t}",
"private int cleanupSegmentsToMaintainSize(final Log log) throws IOException {\n if (logRetentionSize < 0 || log.size() < logRetentionSize) return 0;\n\n List<LogSegment> toBeDeleted = log.markDeletedWhile(new LogSegmentFilter() {\n\n long diff = log.size() - logRetentionSize;\n\n public boolean filter(LogSegment segment) {\n diff -= segment.size();\n return diff >= 0;\n }\n });\n return deleteSegments(log, toBeDeleted);\n }",
"private boolean hasMultipleCostRates()\n {\n boolean result = false;\n CostRateTable table = getCostRateTable();\n if (table != null)\n {\n //\n // We assume here that if there is just one entry in the cost rate\n // table, this is an open ended rate which covers any work, it won't\n // have specific dates attached to it.\n //\n if (table.size() > 1)\n {\n //\n // If we have multiple rates in the table, see if the same rate\n // is in force at the start and the end of the aaaignment.\n //\n CostRateTableEntry startEntry = table.getEntryByDate(getStart());\n CostRateTableEntry finishEntry = table.getEntryByDate(getFinish());\n result = (startEntry != finishEntry);\n }\n }\n return result;\n }"
] |
Adapt a file path to the current file system.
@param filePath The input file path string.
@return File path compatible with the file system of this {@link GVRResourceVolume}. | [
"protected String adaptFilePath(String filePath) {\n // Convert windows file path to target FS\n String targetPath = filePath.replaceAll(\"\\\\\\\\\", volumeType.getSeparator());\n\n return targetPath;\n }"
] | [
"protected void processAssignmentBaseline(Row row)\n {\n Integer id = row.getInteger(\"ASSN_UID\");\n ResourceAssignment assignment = m_assignmentMap.get(id);\n if (assignment != null)\n {\n int index = row.getInt(\"AB_BASE_NUM\");\n\n assignment.setBaselineStart(index, row.getDate(\"AB_BASE_START\"));\n assignment.setBaselineFinish(index, row.getDate(\"AB_BASE_FINISH\"));\n assignment.setBaselineWork(index, row.getDuration(\"AB_BASE_WORK\"));\n assignment.setBaselineCost(index, row.getCurrency(\"AB_BASE_COST\"));\n }\n }",
"public final static void codeEncode(final StringBuilder out, final String value, final int offset)\n {\n for (int i = offset; i < value.length(); i++)\n {\n final char c = value.charAt(i);\n switch (c)\n {\n case '&':\n out.append(\"&\");\n break;\n case '<':\n out.append(\"<\");\n break;\n case '>':\n out.append(\">\");\n break;\n default:\n out.append(c);\n }\n }\n }",
"public boolean isInBounds(int row, int col) {\n return row >= 0 && col >= 0 && row < mat.getNumRows() && col < mat.getNumCols();\n }",
"public static base_response unset(nitro_service client, gslbsite resource, String[] args) throws Exception{\n\t\tgslbsite unsetresource = new gslbsite();\n\t\tunsetresource.sitename = resource.sitename;\n\t\treturn unsetresource.unset_resource(client,args);\n\t}",
"public EventBus emitAsync(Enum<?> event, Object... args) {\n return _emitWithOnceBus(eventContextAsync(event, args));\n }",
"public static Shell createSubshell(String pathElement, Shell parent, String appName, Object mainHandler,\n MultiMap<String, Object> auxHandlers) {\n\n List<String> newPath = new ArrayList<String>(parent.getPath());\n newPath.add(pathElement);\n\n Shell subshell = new Shell(parent.getSettings().createWithAddedAuxHandlers(auxHandlers),\n new CommandTable(parent.getCommandTable().getNamer()), newPath);\n\n subshell.setAppName(appName);\n subshell.addMainHandler(subshell, \"!\");\n subshell.addMainHandler(new HelpCommandHandler(), \"?\");\n\n subshell.addMainHandler(mainHandler, \"\");\n return subshell;\n }",
"public void checkAllRequirementsSatisfied(final String currentPath) {\n StringBuilder errors = new StringBuilder();\n\n for (Field field: this.dependantsInJson) {\n final Collection<String> requirements = this.dependantToRequirementsMap.get(field);\n if (!requirements.isEmpty()) {\n errors.append(\"\\n\");\n String type = field.getType().getName();\n if (field.getType().isArray()) {\n type = field.getType().getComponentType().getName() + \"[]\";\n }\n errors.append(\"\\t* \").append(type).append(' ').append(field.getName()).append(\" depends on \")\n .append(requirements);\n }\n }\n Assert.equals(0, errors.length(),\n \"\\nErrors were detected when analysing the @Requires dependencies of '\" +\n currentPath + \"': \" + errors);\n }",
"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 }",
"protected AbstractColumn buildSimpleColumn() {\n\t\tSimpleColumn column = new SimpleColumn();\n\t\tpopulateCommonAttributes(column);\n\t\tcolumnProperty.getFieldProperties().putAll(fieldProperties);\n\t\tcolumn.setColumnProperty(columnProperty);\n\t\tcolumn.setExpressionToGroupBy(customExpressionToGroupBy);\n\t\tcolumn.setFieldDescription(fieldDescription);\n\t\treturn column;\n\t}"
] |
Makes this pose the inverse of the input pose.
@param src pose to invert. | [
"public void inverse(GVRPose src)\n {\n if (getSkeleton() != src.getSkeleton())\n throw new IllegalArgumentException(\"GVRPose.copy: input pose is incompatible with this pose\");\n src.sync();\n int numbones = getNumBones();\n Bone srcBone = src.mBones[0];\n Bone dstBone = mBones[0];\n\n mNeedSync = true;\n srcBone.WorldMatrix.invertAffine(dstBone.WorldMatrix);\n srcBone.LocalMatrix.set(dstBone.WorldMatrix);\n if (sDebug)\n {\n Log.d(\"BONE\", \"invert: %s %s\", mSkeleton.getBoneName(0), dstBone.toString());\n\n }\n for (int i = 1; i < numbones; ++i)\n {\n srcBone = src.mBones[i];\n dstBone = mBones[i];\n srcBone.WorldMatrix.invertAffine(dstBone.WorldMatrix);\n dstBone.Changed = WORLD_ROT | WORLD_POS;\n if (sDebug)\n {\n Log.d(\"BONE\", \"invert: %s %s\", mSkeleton.getBoneName(i), dstBone.toString());\n }\n }\n sync();\n }"
] | [
"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 WaveformPreview requestWaveformPreviewFrom(final DataReference dataReference) {\n ensureRunning();\n for (WaveformPreview cached : previewHotCache.values()) {\n if (cached.dataReference.equals(dataReference)) { // Found a hot cue hit, use it.\n return cached;\n }\n }\n return requestPreviewInternal(dataReference, false);\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 void checkpoint(ObjectEnvelope mod)\r\n throws org.apache.ojb.broker.PersistenceBrokerException\r\n {\r\n mod.doUpdate();\r\n }",
"public static JSONObject loadJSONAsset(Context context, final String asset) {\n if (asset == null) {\n return new JSONObject();\n }\n return getJsonObject(org.gearvrf.widgetlib.main.Utility.readTextFile(context, asset));\n }",
"private 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 int nullity() {\n if( is64 ) {\n return SingularOps_DDRM.nullity((SingularValueDecomposition_F64)svd, 10.0 * UtilEjml.EPS);\n } else {\n return SingularOps_FDRM.nullity((SingularValueDecomposition_F32)svd, 5.0f * UtilEjml.F_EPS);\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 static nsacl6[] get(nitro_service service, String acl6name[]) throws Exception{\n\t\tif (acl6name !=null && acl6name.length>0) {\n\t\t\tnsacl6 response[] = new nsacl6[acl6name.length];\n\t\t\tnsacl6 obj[] = new nsacl6[acl6name.length];\n\t\t\tfor (int i=0;i<acl6name.length;i++) {\n\t\t\t\tobj[i] = new nsacl6();\n\t\t\t\tobj[i].set_acl6name(acl6name[i]);\n\t\t\t\tresponse[i] = (nsacl6) obj[i].get_resource(service);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t\treturn null;\n\t}"
] |
Compute the CRC32 of the segment of the byte array given by the
specificed size and offset
@param bytes The bytes to checksum
@param offset the offset at which to begin checksumming
@param size the number of bytes to checksum
@return The CRC32 | [
"public static long crc32(byte[] bytes, int offset, int size) {\n CRC32 crc = new CRC32();\n crc.update(bytes, offset, size);\n return crc.getValue();\n }"
] | [
"public void restartDyno(String appName, String dynoId) {\n connection.execute(new DynoRestart(appName, dynoId), apiKey);\n }",
"@PostConstruct\n public final void addMetricsAppenderToLogback() {\n final LoggerContext factory = (LoggerContext) LoggerFactory.getILoggerFactory();\n final Logger root = factory.getLogger(Logger.ROOT_LOGGER_NAME);\n\n final InstrumentedAppender metrics = new InstrumentedAppender(this.metricRegistry);\n metrics.setContext(root.getLoggerContext());\n metrics.start();\n root.addAppender(metrics);\n }",
"public ItemDocumentBuilder withSiteLink(String title, String siteKey,\n\t\t\tItemIdValue... badges) {\n\t\twithSiteLink(factory.getSiteLink(title, siteKey, Arrays.asList(badges)));\n\t\treturn this;\n\t}",
"okhttp3.Response delete(String url, Map<String, Object> params)\n throws RequestException, LocalOperationException {\n okhttp3.Request request = new okhttp3.Request.Builder()\n .url(getFullUrl(url))\n .delete(getBody(toPayload(params), null))\n .addHeader(\"Transloadit-Client\", version)\n .build();\n\n try {\n return httpClient.newCall(request).execute();\n } catch (IOException e) {\n throw new RequestException(e);\n }\n }",
"public static base_response clear(nitro_service client) throws Exception {\n\t\tnssimpleacl clearresource = new nssimpleacl();\n\t\treturn clearresource.perform_operation(client,\"clear\");\n\t}",
"public void setControllerModel(GVRSceneObject controllerModel)\n {\n if (mControllerModel != null)\n {\n mControllerGroup.removeChildObject(mControllerModel);\n }\n mControllerModel = controllerModel;\n mControllerGroup.addChildObject(mControllerModel);\n mControllerModel.setEnable(mShowControllerModel);\n }",
"public double[] getBasisVector( int which ) {\n if( which < 0 || which >= numComponents )\n throw new IllegalArgumentException(\"Invalid component\");\n\n DMatrixRMaj v = new DMatrixRMaj(1,A.numCols);\n CommonOps_DDRM.extract(V_t,which,which+1,0,A.numCols,v,0,0);\n\n return v.data;\n }",
"public HalfEdge getEdge(int i) {\n HalfEdge he = he0;\n while (i > 0) {\n he = he.next;\n i--;\n }\n while (i < 0) {\n he = he.prev;\n i++;\n }\n return he;\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}"
] |
Deserialize an `AppDescriptor` from byte array
@param bytes
the byte array
@return
an `AppDescriptor` instance | [
"public static AppDescriptor deserializeFrom(byte[] bytes) {\n try {\n ByteArrayInputStream bais = new ByteArrayInputStream(bytes);\n ObjectInputStream ois = new ObjectInputStream(bais);\n return (AppDescriptor) ois.readObject();\n } catch (IOException e) {\n throw E.ioException(e);\n } catch (ClassNotFoundException e) {\n throw E.unexpected(e);\n }\n }"
] | [
"public Duration getFinishSlack()\n {\n Duration finishSlack = (Duration) getCachedValue(TaskField.FINISH_SLACK);\n if (finishSlack == null)\n {\n Duration duration = getDuration();\n if (duration != null)\n {\n finishSlack = DateHelper.getVariance(this, getEarlyFinish(), getLateFinish(), duration.getUnits());\n set(TaskField.FINISH_SLACK, finishSlack);\n }\n }\n return (finishSlack);\n }",
"public void setUserInfo(String username, String infoName, String value) throws CmsException {\n\n CmsUser user = m_cms.readUser(username);\n user.setAdditionalInfo(infoName, value);\n m_cms.writeUser(user);\n }",
"private String parseEnvelope() {\r\n List<String> response = new ArrayList<>();\r\n //1. Date ---------------\r\n response.add(LB + Q + sentDateEnvelopeString + Q + SP);\r\n //2. Subject ---------------\r\n if (subject != null && (subject.length() != 0)) {\r\n response.add(Q + escapeHeader(subject) + Q + SP);\r\n } else {\r\n response.add(NIL + SP);\r\n }\r\n //3. From ---------------\r\n addAddressToEnvelopeIfAvailable(from, response);\r\n response.add(SP);\r\n //4. Sender ---------------\r\n addAddressToEnvelopeIfAvailableWithNetscapeFeature(sender, response);\r\n response.add(SP);\r\n addAddressToEnvelopeIfAvailableWithNetscapeFeature(replyTo, response);\r\n response.add(SP);\r\n addAddressToEnvelopeIfAvailable(to, response);\r\n response.add(SP);\r\n addAddressToEnvelopeIfAvailable(cc, response);\r\n response.add(SP);\r\n addAddressToEnvelopeIfAvailable(bcc, response);\r\n response.add(SP);\r\n if (inReplyTo != null && inReplyTo.length > 0) {\r\n response.add(inReplyTo[0]);\r\n } else {\r\n response.add(NIL);\r\n }\r\n response.add(SP);\r\n if (messageID != null && messageID.length > 0) {\r\n messageID[0] = escapeHeader(messageID[0]);\r\n response.add(Q + messageID[0] + Q);\r\n } else {\r\n response.add(NIL);\r\n }\r\n response.add(RB);\r\n\r\n StringBuilder buf = new StringBuilder(16 * response.size());\r\n for (String aResponse : response) {\r\n buf.append(aResponse);\r\n }\r\n\r\n return buf.toString();\r\n }",
"public float get(Layout.Axis axis) {\n switch (axis) {\n case X:\n return x;\n case Y:\n return y;\n case Z:\n return z;\n default:\n throw new RuntimeAssertion(\"Bad axis specified: %s\", axis);\n }\n }",
"public static Chart getMSDLineChart(Trajectory t, int lagMin, int lagMax) {\n\t\treturn getMSDLineChart(t, lagMin, lagMax, new MeanSquaredDisplacmentFeature(t,\n\t\t\t\tlagMin));\n\t}",
"public static vpnglobal_auditnslogpolicy_binding[] get(nitro_service service) throws Exception{\n\t\tvpnglobal_auditnslogpolicy_binding obj = new vpnglobal_auditnslogpolicy_binding();\n\t\tvpnglobal_auditnslogpolicy_binding response[] = (vpnglobal_auditnslogpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"@Override\n public boolean decompose( ZMatrixRMaj A )\n {\n if( A.numRows != A.numCols )\n throw new IllegalArgumentException(\"A must be square.\");\n if( A.numRows <= 0 )\n return false;\n\n QH = A;\n\n N = A.numCols;\n\n if( b.length < N*2 ) {\n b = new double[ N*2 ];\n gammas = new double[ N ];\n u = new double[ N*2 ];\n }\n return _decompose();\n }",
"public static Iterable<String> toHexStrings(Iterable<ByteArray> arrays) {\n ArrayList<String> ret = new ArrayList<String>();\n for(ByteArray array: arrays)\n ret.add(ByteUtils.toHexString(array.get()));\n return ret;\n }",
"public static Interface[] get(nitro_service service) throws Exception{\n\t\tInterface obj = new Interface();\n\t\tInterface[] response = (Interface[])obj.get_resources(service);\n\t\treturn response;\n\t}"
] |
Convert a key-version-nodeSet information to string
@param key The key
@param versionMap mapping versions to set of PrefixNodes
@param storeName store's name
@param partitionId partition scanned
@return a string that describe the information passed in | [
"public static String keyVersionToString(ByteArray key,\n Map<Value, Set<ClusterNode>> versionMap,\n String storeName,\n Integer partitionId) {\n StringBuilder record = new StringBuilder();\n for (Map.Entry<Value, Set<ClusterNode>> versionSet : versionMap.entrySet()) {\n Value value = versionSet.getKey();\n Set<ClusterNode> nodeSet = versionSet.getValue();\n\n record.append(\"BAD_KEY,\");\n record.append(storeName + \",\");\n record.append(partitionId + \",\");\n record.append(ByteUtils.toHexString(key.get()) + \",\");\n record.append(nodeSet.toString().replace(\", \", \";\") + \",\");\n record.append(value.toString());\n }\n return record.toString();\n }"
] | [
"public CmsMessageContainer validateWithMessage() {\n\n if (m_parsingFailed) {\n return Messages.get().container(Messages.ERR_SERIALDATE_INVALID_VALUE_0);\n }\n if (!isStartSet()) {\n return Messages.get().container(Messages.ERR_SERIALDATE_START_MISSING_0);\n }\n if (!isEndValid()) {\n return Messages.get().container(Messages.ERR_SERIALDATE_END_BEFORE_START_0);\n }\n String key = validatePattern();\n if (null != key) {\n return Messages.get().container(key);\n }\n key = validateDuration();\n if (null != key) {\n return Messages.get().container(key);\n }\n if (hasTooManyEvents()) {\n return Messages.get().container(\n Messages.ERR_SERIALDATE_TOO_MANY_EVENTS_1,\n Integer.valueOf(CmsSerialDateUtil.getMaxEvents()));\n }\n return null;\n }",
"public BoxFile.Info upload(BoxAPIConnection boxApi, String folderId, InputStream stream, URL url,\n String fileName, long fileSize) throws InterruptedException, IOException {\n //Create a upload session\n BoxFileUploadSession.Info session = this.createUploadSession(boxApi, folderId, url, fileName, fileSize);\n return this.uploadHelper(session, stream, fileSize);\n }",
"public String findAlias(String entityAlias, List<String> propertyPathWithoutAlias) {\n\t\tRelationshipAliasTree aliasTree = relationshipAliases.get( entityAlias );\n\t\tif ( aliasTree == null ) {\n\t\t\treturn null;\n\t\t}\n\t\tRelationshipAliasTree associationAlias = aliasTree;\n\t\tfor ( int i = 0; i < propertyPathWithoutAlias.size(); i++ ) {\n\t\t\tassociationAlias = associationAlias.findChild( propertyPathWithoutAlias.get( i ) );\n\t\t\tif ( associationAlias == null ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\treturn associationAlias.getAlias();\n\t}",
"public static java.sql.Date getDate(Object value) {\n try {\n return toDate(value);\n } catch (ParseException pe) {\n pe.printStackTrace();\n return null;\n }\n }",
"private void primeCache() {\n SwingUtilities.invokeLater(new Runnable() {\n @Override\n public void run() {\n for (Map.Entry<DeckReference, TrackMetadata> entry : MetadataFinder.getInstance().getLoadedTracks().entrySet()) {\n if (entry.getKey().hotCue == 0) { // The track is currently loaded in a main player deck\n handleUpdate(new TrackMetadataUpdate(entry.getKey().player, entry.getValue()));\n }\n }\n }\n });\n }",
"public static Collection<String> getKnownPGPSecureRingLocations() {\n final LinkedHashSet<String> locations = new LinkedHashSet<String>();\n\n final String os = System.getProperty(\"os.name\");\n final boolean runOnWindows = os == null || os.toLowerCase().contains(\"win\");\n\n if (runOnWindows) {\n // The user's roaming profile on Windows, via environment\n final String windowsRoaming = System.getenv(\"APPDATA\");\n if (windowsRoaming != null) {\n locations.add(joinLocalPath(windowsRoaming, \"gnupg\", \"secring.gpg\"));\n }\n\n // The user's local profile on Windows, via environment\n final String windowsLocal = System.getenv(\"LOCALAPPDATA\");\n if (windowsLocal != null) {\n locations.add(joinLocalPath(windowsLocal, \"gnupg\", \"secring.gpg\"));\n }\n\n // The Windows installation directory\n final String windir = System.getProperty(\"WINDIR\");\n if (windir != null) {\n // Local Profile on Windows 98 and ME\n locations.add(joinLocalPath(windir, \"Application Data\", \"gnupg\", \"secring.gpg\"));\n }\n }\n\n final String home = System.getProperty(\"user.home\");\n\n if (home != null && runOnWindows) {\n // These are for various flavours of Windows\n // if the environment variables above have failed\n\n // Roaming profile on Vista and later\n locations.add(joinLocalPath(home, \"AppData\", \"Roaming\", \"gnupg\", \"secring.gpg\"));\n // Local profile on Vista and later\n locations.add(joinLocalPath(home, \"AppData\", \"Local\", \"gnupg\", \"secring.gpg\"));\n // Roaming profile on 2000 and XP\n locations.add(joinLocalPath(home, \"Application Data\", \"gnupg\", \"secring.gpg\"));\n // Local profile on 2000 and XP\n locations.add(joinLocalPath(home, \"Local Settings\", \"Application Data\", \"gnupg\", \"secring.gpg\"));\n }\n\n // *nix, including OS X\n if (home != null) {\n locations.add(joinLocalPath(home, \".gnupg\", \"secring.gpg\"));\n }\n\n return locations;\n }",
"void close() {\n try {\n performTeardownExchange();\n } catch (IOException e) {\n logger.warn(\"Problem reporting our intention to close the dbserver connection\", e);\n }\n try {\n channel.close();\n } catch (IOException e) {\n logger.warn(\"Problem closing dbserver client output channel\", e);\n }\n try {\n os.close();\n } catch (IOException e) {\n logger.warn(\"Problem closing dbserver client output stream\", e);\n }\n try {\n is.close();\n } catch (IOException e) {\n logger.warn(\"Problem closing dbserver client input stream\", e);\n }\n try {\n socket.close();\n } catch (IOException e) {\n logger.warn(\"Problem closing dbserver client socket\", e);\n }\n }",
"@PostConstruct\n public void initDatabase() {\n MongoDBInit.LOGGER.info(\"initializing MongoDB\");\n String dbName = System.getProperty(\"mongodb.name\");\n if (dbName == null) {\n throw new RuntimeException(\"Missing database name; Set system property 'mongodb.name'\");\n }\n MongoDatabase db = this.mongo.getDatabase(dbName);\n\n try {\n PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();\n Resource[] resources = resolver.getResources(\"classpath*:mongodb/*.ndjson\");\n MongoDBInit.LOGGER.info(\"Scanning for collection data\");\n for (Resource res : resources) {\n String filename = res.getFilename();\n String collection = filename.substring(0, filename.length() - 7);\n MongoDBInit.LOGGER.info(\"Found collection file: {}\", collection);\n MongoCollection<DBObject> dbCollection = db.getCollection(collection, DBObject.class);\n try (Scanner scan = new Scanner(res.getInputStream(), \"UTF-8\")) {\n int lines = 0;\n while (scan.hasNextLine()) {\n String json = scan.nextLine();\n Object parse = JSON.parse(json);\n if (parse instanceof DBObject) {\n DBObject dbObject = (DBObject) parse;\n dbCollection.insertOne(dbObject);\n } else {\n MongoDBInit.LOGGER.error(\"Invalid object found: {}\", parse);\n throw new RuntimeException(\"Invalid object\");\n }\n lines++;\n }\n MongoDBInit.LOGGER.info(\"Imported {} objects into collection {}\", lines, collection);\n }\n }\n } catch (IOException e) {\n throw new RuntimeException(\"Error importing objects\", e);\n }\n }",
"public static String readTag(Reader r) throws IOException {\r\n if ( ! r.ready()) {\r\n return null;\r\n }\r\n StringBuilder b = new StringBuilder(\"<\");\r\n int c = r.read();\r\n while (c >= 0) {\r\n b.append((char) c);\r\n if (c == '>') {\r\n break;\r\n }\r\n c = r.read();\r\n }\r\n if (b.length() == 1) {\r\n return null;\r\n }\r\n return b.toString();\r\n }"
] |
Remove an active operation.
@param id the operation id
@return the removed active operation, {@code null} if there was no registered operation | [
"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 base_responses update(nitro_service client, systemuser resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tsystemuser updateresources[] = new systemuser[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tupdateresources[i] = new systemuser();\n\t\t\t\tupdateresources[i].username = resources[i].username;\n\t\t\t\tupdateresources[i].password = resources[i].password;\n\t\t\t\tupdateresources[i].externalauth = resources[i].externalauth;\n\t\t\t\tupdateresources[i].promptstring = resources[i].promptstring;\n\t\t\t\tupdateresources[i].timeout = resources[i].timeout;\n\t\t\t}\n\t\t\tresult = update_bulk_request(client, updateresources);\n\t\t}\n\t\treturn result;\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 }",
"private void handleHidden(FormInput input) {\n\t\tString text = input.getInputValues().iterator().next().getValue();\n\t\tif (null == text || text.length() == 0) {\n\t\t\treturn;\n\t\t}\n\t\tWebElement inputElement = browser.getWebElement(input.getIdentification());\n\t\tJavascriptExecutor js = (JavascriptExecutor) browser.getWebDriver();\n\t\tjs.executeScript(\"arguments[0].setAttribute(arguments[1], arguments[2]);\", inputElement,\n\t\t\t\t\"value\", text);\n\t}",
"public static Field getDeclaredFieldWithPath(Class<?> clazz, String path) {\n\n int lastDot = path.lastIndexOf('.');\n\n if (lastDot > -1) {\n String parentPath = path.substring(0, lastDot);\n String fieldName = path.substring(lastDot + 1);\n Field parentField = getDeclaredFieldWithPath(clazz, parentPath);\n return getDeclaredFieldInHierarchy(parentField.getType(), fieldName);\n } else {\n return getDeclaredFieldInHierarchy(clazz, path);\n }\n }",
"protected int readByte(InputStream is) throws IOException\n {\n byte[] data = new byte[1];\n if (is.read(data) != data.length)\n {\n throw new EOFException();\n }\n\n return (MPPUtility.getByte(data, 0));\n }",
"protected void appendWhereClause(StringBuffer stmt, Object[] columns)\r\n {\r\n stmt.append(\" WHERE \");\r\n\r\n for (int i = 0; i < columns.length; i++)\r\n {\r\n if (i > 0)\r\n {\r\n stmt.append(\" AND \");\r\n }\r\n stmt.append(columns[i]);\r\n stmt.append(\"=?\");\r\n }\r\n }",
"public FilePath getModuleRoot(Map<String, String> globalEnv) throws IOException, InterruptedException {\n FilePath someWorkspace = project.getSomeWorkspace();\n if (someWorkspace == null) {\n throw new IllegalStateException(\"Couldn't find workspace\");\n }\n\n Map<String, String> workspaceEnv = Maps.newHashMap();\n workspaceEnv.put(\"WORKSPACE\", someWorkspace.getRemote());\n\n for (Builder builder : getBuilders()) {\n if (builder instanceof Gradle) {\n Gradle gradleBuilder = (Gradle) builder;\n String rootBuildScriptDir = gradleBuilder.getRootBuildScriptDir();\n if (rootBuildScriptDir != null && rootBuildScriptDir.trim().length() != 0) {\n String rootBuildScriptNormalized = Util.replaceMacro(rootBuildScriptDir.trim(), workspaceEnv);\n rootBuildScriptNormalized = Util.replaceMacro(rootBuildScriptNormalized, globalEnv);\n return new FilePath(someWorkspace, rootBuildScriptNormalized);\n } else {\n return someWorkspace;\n }\n }\n }\n\n throw new IllegalArgumentException(\"Couldn't find Gradle builder in the current builders list\");\n }",
"private static Converter<List<String>, Object> createStringConstructorConverter(Class<?> resultClass) {\n try {\n final Constructor<?> constructor = resultClass.getConstructor(String.class);\n return new BasicConverter(defaultValue(resultClass)) {\n @Override\n protected Object convert(String value) throws Exception {\n return constructor.newInstance(value);\n }\n };\n } catch (Exception e) {\n return null;\n }\n }",
"public static String getPunctClass(String punc) {\r\n if(punc.equals(\"%\") || punc.equals(\"-PLUS-\"))//-PLUS- is an escape for \"+\" in the ATB\r\n return \"perc\";\r\n else if(punc.startsWith(\"*\"))\r\n return \"bullet\";\r\n else if(sfClass.contains(punc))\r\n return \"sf\";\r\n else if(colonClass.contains(punc) || pEllipsis.matcher(punc).matches())\r\n return \"colon\";\r\n else if(commaClass.contains(punc))\r\n return \"comma\";\r\n else if(currencyClass.contains(punc))\r\n return \"curr\";\r\n else if(slashClass.contains(punc))\r\n return \"slash\";\r\n else if(lBracketClass.contains(punc))\r\n return \"lrb\";\r\n else if(rBracketClass.contains(punc))\r\n return \"rrb\";\r\n else if(quoteClass.contains(punc))\r\n return \"quote\";\r\n \r\n return \"\";\r\n }"
] |
Old REST client uses old REST service | [
"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 byte[] getMessageBuffer() {\n\t\tByteArrayOutputStream resultByteBuffer = new ByteArrayOutputStream();\n\t\tbyte[] result;\n\t\tresultByteBuffer.write((byte)0x01);\n\t\tint messageLength = messagePayload.length + \n\t\t\t\t(this.messageClass == SerialMessageClass.SendData && \n\t\t\t\tthis.messageType == SerialMessageType.Request ? 5 : 3); // calculate and set length\n\t\t\n\t\tresultByteBuffer.write((byte) messageLength);\n\t\tresultByteBuffer.write((byte) messageType.ordinal());\n\t\tresultByteBuffer.write((byte) messageClass.getKey());\n\t\t\n\t\ttry {\n\t\t\tresultByteBuffer.write(messagePayload);\n\t\t} catch (IOException e) {\n\t\t\t\n\t\t}\n\n\t\t// callback ID and transmit options for a Send Data message.\n\t\tif (this.messageClass == SerialMessageClass.SendData && this.messageType == SerialMessageType.Request) {\n\t\t\tresultByteBuffer.write(transmitOptions);\n\t\t\tresultByteBuffer.write(callbackId);\n\t\t}\n\t\t\n\t\tresultByteBuffer.write((byte) 0x00);\n\t\tresult = resultByteBuffer.toByteArray();\n\t\tresult[result.length - 1] = 0x01;\n\t\tresult[result.length - 1] = calculateChecksum(result);\n\t\tlogger.debug(\"Assembled message buffer = \" + SerialMessage.bb2hex(result));\n\t\treturn result;\n\t}",
"public static boolean canParseColor(final String colorString) {\n try {\n return ColorParser.toColor(colorString) != null;\n } catch (Exception exc) {\n return false;\n }\n }",
"public PreparedStatementCreator count(final Dialect dialect) {\n return new PreparedStatementCreator() {\n public PreparedStatement createPreparedStatement(Connection con)\n throws SQLException {\n return getPreparedStatementCreator()\n .setSql(dialect.createCountSelect(builder.toString()))\n .createPreparedStatement(con);\n }\n };\n }",
"public void authenticate() {\n URL url;\n try {\n url = new URL(this.getTokenURL());\n } catch (MalformedURLException e) {\n assert false : \"An invalid token URL indicates a bug in the SDK.\";\n throw new RuntimeException(\"An invalid token URL indicates a bug in the SDK.\", e);\n }\n\n String jwtAssertion = this.constructJWTAssertion();\n\n String urlParameters = String.format(JWT_GRANT_TYPE, this.getClientID(), this.getClientSecret(), jwtAssertion);\n\n BoxAPIRequest request = new BoxAPIRequest(this, url, \"POST\");\n request.shouldAuthenticate(false);\n request.setBody(urlParameters);\n\n String json;\n try {\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n json = response.getJSON();\n } catch (BoxAPIException ex) {\n // Use the Date advertised by the Box server as the current time to synchronize clocks\n List<String> responseDates = ex.getHeaders().get(\"Date\");\n NumericDate currentTime;\n if (responseDates != null) {\n String responseDate = responseDates.get(0);\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"EEE, d MMM yyyy HH:mm:ss zzz\");\n try {\n Date date = dateFormat.parse(responseDate);\n currentTime = NumericDate.fromMilliseconds(date.getTime());\n } catch (ParseException e) {\n currentTime = NumericDate.now();\n }\n } else {\n currentTime = NumericDate.now();\n }\n\n // Reconstruct the JWT assertion, which regenerates the jti claim, with the new \"current\" time\n jwtAssertion = this.constructJWTAssertion(currentTime);\n urlParameters = String.format(JWT_GRANT_TYPE, this.getClientID(), this.getClientSecret(), jwtAssertion);\n\n // Re-send the updated request\n request = new BoxAPIRequest(this, url, \"POST\");\n request.shouldAuthenticate(false);\n request.setBody(urlParameters);\n\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n json = response.getJSON();\n }\n\n JsonObject jsonObject = JsonObject.readFrom(json);\n this.setAccessToken(jsonObject.get(\"access_token\").asString());\n this.setLastRefresh(System.currentTimeMillis());\n this.setExpires(jsonObject.get(\"expires_in\").asLong() * 1000);\n\n //if token cache is specified, save to cache\n if (this.accessTokenCache != null) {\n String key = this.getAccessTokenCacheKey();\n JsonObject accessTokenCacheInfo = new JsonObject()\n .add(\"accessToken\", this.getAccessToken())\n .add(\"lastRefresh\", this.getLastRefresh())\n .add(\"expires\", this.getExpires());\n\n this.accessTokenCache.put(key, accessTokenCacheInfo.toString());\n }\n }",
"public String format(String value) {\n StringBuilder s = new StringBuilder();\n\n if (value != null && value.trim().length() > 0) {\n boolean continuationLine = false;\n\n s.append(getName()).append(\":\");\n if (isFirstLineEmpty()) {\n s.append(\"\\n\");\n continuationLine = true;\n }\n\n try {\n BufferedReader reader = new BufferedReader(new StringReader(value));\n String line;\n while ((line = reader.readLine()) != null) {\n if (continuationLine && line.trim().length() == 0) {\n // put a dot on the empty continuation lines\n s.append(\" .\\n\");\n } else {\n s.append(\" \").append(line).append(\"\\n\");\n }\n\n continuationLine = true;\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n return s.toString();\n }",
"private List<Row> createExceptionAssignmentRowList(String exceptionData)\n {\n List<Row> list = new ArrayList<Row>();\n String[] exceptions = exceptionData.split(\",|:\");\n int index = 1;\n while (index < exceptions.length)\n {\n Date startDate = DatatypeConverter.parseEpochTimestamp(exceptions[index + 0]);\n Date endDate = DatatypeConverter.parseEpochTimestamp(exceptions[index + 1]);\n //Integer exceptionTypeID = Integer.valueOf(exceptions[index + 2]);\n\n Map<String, Object> map = new HashMap<String, Object>();\n map.put(\"STARU_DATE\", startDate);\n map.put(\"ENE_DATE\", endDate);\n\n list.add(new MapRow(map));\n\n index += 3;\n }\n\n return list;\n }",
"public static appfwwsdl get(nitro_service service) throws Exception{\n\t\tappfwwsdl obj = new appfwwsdl();\n\t\tappfwwsdl[] response = (appfwwsdl[])obj.get_resources(service);\n\t\treturn response[0];\n\t}",
"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 }",
"static ChangeEvent<BsonDocument> changeEventForLocalUpdate(\n final MongoNamespace namespace,\n final BsonValue documentId,\n final UpdateDescription update,\n final BsonDocument fullDocumentAfterUpdate,\n final boolean writePending\n ) {\n return new ChangeEvent<>(\n new BsonDocument(),\n OperationType.UPDATE,\n fullDocumentAfterUpdate,\n namespace,\n new BsonDocument(\"_id\", documentId),\n update,\n writePending);\n }"
] |
Finds an Object of the specified type.
@param <T> Object type.
@param classType The class of type T.
@param id The document _id field.
@param rev The document _rev field.
@return An object of type T.
@throws NoDocumentException If the document is not found in the database. | [
"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 CredentialsConfig getResolvingCredentialsConfig() {\n if (resolverCredentialsConfig != null && resolverCredentialsConfig.isCredentialsProvided()) {\n return getResolverCredentialsConfig();\n }\n if (deployerCredentialsConfig != null) {\n return getDeployerCredentialsConfig();\n }\n\n return CredentialsConfig.EMPTY_CREDENTIALS_CONFIG;\n }",
"private void readProjectProperties(Project ganttProject)\n {\n ProjectProperties mpxjProperties = m_projectFile.getProjectProperties();\n mpxjProperties.setName(ganttProject.getName());\n mpxjProperties.setCompany(ganttProject.getCompany());\n mpxjProperties.setDefaultDurationUnits(TimeUnit.DAYS);\n\n String locale = ganttProject.getLocale();\n if (locale == null)\n {\n locale = \"en_US\";\n }\n m_localeDateFormat = DateFormat.getDateInstance(DateFormat.SHORT, new Locale(locale));\n }",
"@PreDestroy\n public void disconnectLocator() throws InterruptedException,\n ServiceLocatorException {\n if (LOG.isLoggable(Level.FINE)) {\n LOG.fine(\"Destroy Locator client\");\n }\n\n if (endpointCollector != null) {\n endpointCollector.stopScheduledCollection();\n }\n \n if (locatorClient != null) {\n locatorClient.disconnect();\n locatorClient = null;\n }\n }",
"public static JMXServiceURL getLocalConnectorAddress(Process p, boolean startAgent) {\n return getLocalConnectorAddress(Integer.toString(getPid(p)), startAgent);\n }",
"public static void archiveFile(@NotNull final ArchiveOutputStream out,\n @NotNull final VirtualFileDescriptor source,\n final long fileSize) throws IOException {\n if (!source.hasContent()) {\n throw new IllegalArgumentException(\"Provided source is not a file: \" + source.getPath());\n }\n //noinspection ChainOfInstanceofChecks\n if (out instanceof TarArchiveOutputStream) {\n final TarArchiveEntry entry = new TarArchiveEntry(source.getPath() + source.getName());\n entry.setSize(fileSize);\n entry.setModTime(source.getTimeStamp());\n out.putArchiveEntry(entry);\n } else if (out instanceof ZipArchiveOutputStream) {\n final ZipArchiveEntry entry = new ZipArchiveEntry(source.getPath() + source.getName());\n entry.setSize(fileSize);\n entry.setTime(source.getTimeStamp());\n out.putArchiveEntry(entry);\n } else {\n throw new IOException(\"Unknown archive output stream\");\n }\n final InputStream input = source.getInputStream();\n try {\n IOUtil.copyStreams(input, fileSize, out, IOUtil.BUFFER_ALLOCATOR);\n } finally {\n if (source.shouldCloseStream()) {\n input.close();\n }\n }\n out.closeArchiveEntry();\n }",
"protected String buildErrorSetMsg(Object obj, Object value, Field aField)\r\n {\r\n String eol = SystemUtils.LINE_SEPARATOR;\r\n StringBuffer buf = new StringBuffer();\r\n buf\r\n .append(eol + \"[try to set 'object value' in 'target object'\")\r\n .append(eol + \"target obj class: \" + (obj != null ? obj.getClass().getName() : null))\r\n .append(eol + \"target field name: \" + (aField != null ? aField.getName() : null))\r\n .append(eol + \"target field type: \" + (aField != null ? aField.getType() : null))\r\n .append(eol + \"target field declared in: \" + (aField != null ? aField.getDeclaringClass().getName() : null))\r\n .append(eol + \"object value class: \" + (value != null ? value.getClass().getName() : null))\r\n .append(eol + \"object value: \" + (value != null ? value : null))\r\n .append(eol + \"]\");\r\n return buf.toString();\r\n }",
"public void endRecord_() {\n // this is where we actually update the link database. basically,\n // all we need to do is to retract those links which weren't seen\n // this time around, and that can be done via assertLink, since it\n // can override existing links.\n\n // get all the existing links\n Collection<Link> oldlinks = linkdb.getAllLinksFor(getIdentity(current));\n\n // build a hashmap so we can look up corresponding old links from\n // new links\n if (oldlinks != null) {\n Map<String, Link> oldmap = new HashMap(oldlinks.size());\n for (Link l : oldlinks)\n oldmap.put(makeKey(l), l);\n\n // removing all the links we found this time around from the set of\n // old links. any links remaining after this will be stale, and need\n // to be retracted\n for (Link newl : new ArrayList<Link>(curlinks)) {\n String key = makeKey(newl);\n Link oldl = oldmap.get(key);\n if (oldl == null)\n continue;\n\n if (oldl.overrides(newl))\n // previous information overrides this link, so ignore\n curlinks.remove(newl);\n else if (sameAs(oldl, newl)) {\n // there's no new information here, so just ignore this\n curlinks.remove(newl);\n oldmap.remove(key); // we don't want to retract the old one\n } else\n // the link is out of date, but will be overwritten, so remove\n oldmap.remove(key);\n }\n\n // all the inferred links left in oldmap are now old links we\n // didn't find on this pass. there is no longer any evidence\n // supporting them, and so we can retract them.\n for (Link oldl : oldmap.values())\n if (oldl.getStatus() == LinkStatus.INFERRED) {\n oldl.retract(); // changes to retracted, updates timestamp\n curlinks.add(oldl);\n }\n }\n\n // okay, now we write it all to the database\n for (Link l : curlinks)\n linkdb.assertLink(l);\n }",
"private static String convertISO88591toUTF8(String value) {\n try {\n return new String(value.getBytes(CharEncoding.ISO_8859_1), CharEncoding.UTF_8);\n }\n catch (UnsupportedEncodingException ex) {\n // ignore and fallback to original encoding\n return value;\n }\n }",
"private List<UDFAssignmentType> writeUDFType(FieldTypeClass type, FieldContainer mpxj)\n {\n List<UDFAssignmentType> out = new ArrayList<UDFAssignmentType>();\n for (CustomField cf : m_sortedCustomFieldsList)\n {\n FieldType fieldType = cf.getFieldType();\n if (fieldType != null && type == fieldType.getFieldTypeClass())\n {\n Object value = mpxj.getCachedValue(fieldType);\n if (FieldTypeHelper.valueIsNotDefault(fieldType, value))\n {\n UDFAssignmentType udf = m_factory.createUDFAssignmentType();\n udf.setTypeObjectId(FieldTypeHelper.getFieldID(fieldType));\n setUserFieldValue(udf, fieldType.getDataType(), value);\n out.add(udf);\n }\n }\n }\n return out;\n }"
] |
find all accessibility object and set active false for enable talk back. | [
"private void disableTalkBack() {\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(false);\n\n }\n }"
] | [
"public void fireRelationWrittenEvent(Relation relation)\n {\n if (m_projectListeners != null)\n {\n for (ProjectListener listener : m_projectListeners)\n {\n listener.relationWritten(relation);\n }\n }\n }",
"public static <T> Object callMethod(Object obj,\n Class<T> c,\n String name,\n Class<?>[] classes,\n Object[] args) {\n try {\n Method m = getMethod(c, name, classes);\n return m.invoke(obj, args);\n } catch(InvocationTargetException e) {\n throw getCause(e);\n } catch(IllegalAccessException e) {\n throw new IllegalStateException(e);\n }\n }",
"public Integer getGroupIdFromName(String groupName) {\n return (Integer) sqlService.getFromTable(Constants.GENERIC_ID, Constants.GROUPS_GROUP_NAME, groupName,\n Constants.DB_TABLE_GROUPS);\n }",
"protected void addProcessedData(List<List<CRFDatum<Collection<String>, String>>> processedData, int[][][][] data,\r\n int[][] labels, int offset) {\r\n for (int i = 0, pdSize = processedData.size(); i < pdSize; i++) {\r\n int dataIndex = i + offset;\r\n List<CRFDatum<Collection<String>, String>> document = processedData.get(i);\r\n int dsize = document.size();\r\n labels[dataIndex] = new int[dsize];\r\n data[dataIndex] = new int[dsize][][];\r\n for (int j = 0; j < dsize; j++) {\r\n CRFDatum<Collection<String>, String> crfDatum = document.get(j);\r\n // add label, they are offset by extra context\r\n labels[dataIndex][j] = classIndex.indexOf(crfDatum.label());\r\n // add features\r\n List<Collection<String>> cliques = crfDatum.asFeatures();\r\n int csize = cliques.size();\r\n data[dataIndex][j] = new int[csize][];\r\n for (int k = 0; k < csize; k++) {\r\n Collection<String> features = cliques.get(k);\r\n\r\n // Debug only: Remove\r\n // if (j < windowSize) {\r\n // System.err.println(\"addProcessedData: Features Size: \" +\r\n // features.size());\r\n // }\r\n\r\n data[dataIndex][j][k] = new int[features.size()];\r\n\r\n int m = 0;\r\n try {\r\n for (String feature : features) {\r\n // System.err.println(\"feature \" + feature);\r\n // if (featureIndex.indexOf(feature)) ;\r\n if (featureIndex == null) {\r\n System.out.println(\"Feature is NULL!\");\r\n }\r\n data[dataIndex][j][k][m] = featureIndex.indexOf(feature);\r\n m++;\r\n }\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n System.err.printf(\"[index=%d, j=%d, k=%d, m=%d]\\n\", dataIndex, j, k, m);\r\n System.err.println(\"data.length \" + data.length);\r\n System.err.println(\"data[dataIndex].length \" + data[dataIndex].length);\r\n System.err.println(\"data[dataIndex][j].length \" + data[dataIndex][j].length);\r\n System.err.println(\"data[dataIndex][j][k].length \" + data[dataIndex][j].length);\r\n System.err.println(\"data[dataIndex][j][k][m] \" + data[dataIndex][j][k][m]);\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n }",
"public Association getAssociation(String collectionRole) {\n\t\tif ( associations == null ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn associations.get( collectionRole );\n\t}",
"public void visitRequire(String module, int access, String version) {\n if (mv != null) {\n mv.visitRequire(module, access, version);\n }\n }",
"public static void populateSubject(final LinkedHashMap<String, CommonProfile> profiles) {\n if (profiles != null && profiles.size() > 0) {\n final List<CommonProfile> listProfiles = ProfileHelper.flatIntoAProfileList(profiles);\n try {\n if (IS_FULLY_AUTHENTICATED_AUTHORIZER.isAuthorized(null, listProfiles)) {\n SecurityUtils.getSubject().login(new Pac4jToken(listProfiles, false));\n } else if (IS_REMEMBERED_AUTHORIZER.isAuthorized(null, listProfiles)) {\n SecurityUtils.getSubject().login(new Pac4jToken(listProfiles, true));\n }\n } catch (final HttpAction e) {\n throw new TechnicalException(e);\n }\n }\n }",
"@Override\n\tpublic void set(String headerName, String headerValue) {\n\t\tList<String> headerValues = new LinkedList<String>();\n\t\theaderValues.add(headerValue);\n\t\theaders.put(headerName, headerValues);\n\t}",
"protected void parseNegOp(TokenList tokens, Sequence sequence) {\n if( tokens.size == 0 )\n return;\n\n TokenList.Token token = tokens.first;\n\n while( token != null ) {\n TokenList.Token next = token.next;\n escape:\n if( token.getSymbol() == Symbol.MINUS ) {\n if( token.previous != null && token.previous.getType() != Type.SYMBOL)\n break escape;\n if( token.previous != null && token.previous.getType() == Type.SYMBOL &&\n (token.previous.symbol == Symbol.TRANSPOSE))\n break escape;\n if( token.next == null || token.next.getType() == Type.SYMBOL)\n break escape;\n\n if( token.next.getType() != Type.VARIABLE )\n throw new RuntimeException(\"Crap bug rethink this function\");\n\n // create the operation\n Operation.Info info = Operation.neg(token.next.getVariable(),functions.getManagerTemp());\n // add the operation to the sequence\n sequence.addOperation(info.op);\n // update the token list\n TokenList.Token t = new TokenList.Token(info.output);\n tokens.insert(token.next,t);\n tokens.remove(token.next);\n tokens.remove(token);\n next = t;\n }\n token = next;\n }\n }"
] |
Used to retrieve the watermark for the item.
If the item does not have a watermark applied to it, a 404 Not Found will be returned by API.
@param itemUrl url template for the item.
@param fields the fields to retrieve.
@return the watermark associated with the item. | [
"protected BoxWatermark getWatermark(URLTemplate itemUrl, String... fields) {\n URL watermarkUrl = itemUrl.build(this.getAPI().getBaseURL(), this.getID());\n QueryStringBuilder builder = new QueryStringBuilder();\n if (fields.length > 0) {\n builder.appendParam(\"fields\", fields);\n }\n URL url = WATERMARK_URL_TEMPLATE.buildWithQuery(watermarkUrl.toString(), builder.toString());\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"GET\");\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n return new BoxWatermark(response.getJSON());\n }"
] | [
"public static double ratioSmallestOverLargest( double []sv ) {\n if( sv.length == 0 )\n return Double.NaN;\n\n double min = sv[0];\n double max = min;\n\n for (int i = 1; i < sv.length; i++) {\n double v = sv[i];\n if( v > max )\n max = v;\n else if( v < min )\n min = v;\n }\n\n return min/max;\n }",
"public static SimpleFeatureType createGridFeatureType(\n @Nonnull final MapfishMapContext mapContext,\n @Nonnull final Class<? extends Geometry> geomClass) {\n final SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();\n CoordinateReferenceSystem projection = mapContext.getBounds().getProjection();\n typeBuilder.add(Constants.Style.Grid.ATT_GEOM, geomClass, projection);\n typeBuilder.setName(Constants.Style.Grid.NAME_LINES);\n\n return typeBuilder.buildFeatureType();\n }",
"public boolean matches(Property property) {\n return property.getName().equals(key) && (value == WILDCARD_VALUE || property.getValue().asString().equals(value));\n }",
"private Map<String, Table> getIndex(Table table)\n {\n Map<String, Table> result;\n\n if (!table.getResourceFlag())\n {\n result = m_taskTablesByName;\n }\n else\n {\n result = m_resourceTablesByName;\n }\n return result;\n }",
"public boolean perform(Run<?, ?> build, Launcher launcher, TaskListener listener, EnvVars env, FilePath workDir, FilePath tempDir)\n throws InterruptedException, IOException {\n listener.getLogger().println(\"Jenkins Artifactory Plugin version: \" + ActionableHelper.getArtifactoryPluginVersion());\n FilePath mavenHome = getMavenHome(listener, env, launcher);\n\n if (!mavenHome.exists()) {\n listener.getLogger().println(\"Couldn't find Maven home at \" + mavenHome.getRemote() + \" on agent \" + Utils.getAgentName(workDir) +\n \". This could be because this build is running inside a Docker container.\");\n }\n ArgumentListBuilder cmdLine = buildMavenCmdLine(build, listener, env, launcher, mavenHome, workDir, tempDir);\n String[] cmds = cmdLine.toCommandArray();\n return RunMaven(build, launcher, listener, env, workDir, cmds);\n }",
"public static String decodeUrl(String stringToDecode) {\n try {\n return URLDecoder.decode(stringToDecode, \"UTF-8\");\n } catch (UnsupportedEncodingException e1) {\n throw new RuntimeException(e1);\n }\n }",
"private ProjectFile handleZipFile(InputStream stream) throws Exception\n {\n File dir = null;\n\n try\n {\n dir = InputStreamHelper.writeZipStreamToTempDir(stream);\n ProjectFile result = handleDirectory(dir);\n if (result != null)\n {\n return result;\n }\n }\n\n finally\n {\n FileHelper.deleteQuietly(dir);\n }\n\n return null;\n }",
"private static void computeBadByteSkipArray(byte[] pattern, int[] badByteArray) {\n for (int a = 0; a < ALPHABET_SIZE; a++) {\n badByteArray[a] = pattern.length;\n }\n\n for (int j = 0; j < pattern.length - 1; j++) {\n badByteArray[pattern[j] - Byte.MIN_VALUE] = pattern.length - j - 1;\n }\n }",
"static <T> boolean syncInstantiation(T objectType) {\n List<Template> templates = new ArrayList<>();\n Templates tr = TEMP_FINDER.findAnnotations(templates, objectType);\n if (tr == null) {\n /* Default to synchronous instantiation */\n return true;\n } else {\n return tr.syncInstantiation();\n }\n }"
] |
Use this API to fetch all the inat resources that are configured on netscaler. | [
"public static inat[] get(nitro_service service) throws Exception{\n\t\tinat obj = new inat();\n\t\tinat[] response = (inat[])obj.get_resources(service);\n\t\treturn response;\n\t}"
] | [
"public static nslimitidentifier_stats get(nitro_service service, String name) throws Exception{\n\t\tnslimitidentifier_stats obj = new nslimitidentifier_stats();\n\t\tobj.set_name(name);\n\t\tnslimitidentifier_stats response = (nslimitidentifier_stats) obj.stat_resource(service);\n\t\treturn response;\n\t}",
"public void link(Object targetObject, ClassDescriptor cld, ObjectReferenceDescriptor rds, Object referencedObject, boolean insert)\n {\n // MBAIRD: we have 'disassociated' this object from the referenced object,\n // the object represented by the reference descriptor is now null, so set\n // the fk in the target object to null.\n // arminw: if an insert was done and ref object was null, we should allow\n // to pass FK fields of main object (maybe only the FK fields are set)\n if (referencedObject == null)\n {\n /*\n arminw:\n if update we set FK fields to 'null', because reference was disassociated\n We do nothing on insert, maybe only the FK fields of main object (without\n materialization of the reference object) are set by the user\n */\n if(!insert)\n {\n unlinkFK(targetObject, cld, rds);\n }\n }\n else\n {\n setFKField(targetObject, cld, rds, referencedObject);\n }\n }",
"public PhotoContext getContext(String photoId) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_CONTEXT);\r\n\r\n parameters.put(\"photo_id\", photoId);\r\n\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 PhotoContext photoContext = new PhotoContext();\r\n Collection<Element> payload = response.getPayloadCollection();\r\n for (Element payloadElement : payload) {\r\n String tagName = payloadElement.getTagName();\r\n if (tagName.equals(\"prevphoto\")) {\r\n Photo photo = new Photo();\r\n photo.setId(payloadElement.getAttribute(\"id\"));\r\n photo.setSecret(payloadElement.getAttribute(\"secret\"));\r\n photo.setTitle(payloadElement.getAttribute(\"title\"));\r\n photo.setFarm(payloadElement.getAttribute(\"farm\"));\r\n photo.setUrl(payloadElement.getAttribute(\"url\"));\r\n photoContext.setPreviousPhoto(photo);\r\n } else if (tagName.equals(\"nextphoto\")) {\r\n Photo photo = new Photo();\r\n photo.setId(payloadElement.getAttribute(\"id\"));\r\n photo.setSecret(payloadElement.getAttribute(\"secret\"));\r\n photo.setTitle(payloadElement.getAttribute(\"title\"));\r\n photo.setFarm(payloadElement.getAttribute(\"farm\"));\r\n photo.setUrl(payloadElement.getAttribute(\"url\"));\r\n photoContext.setNextPhoto(photo);\r\n }\r\n }\r\n return photoContext;\r\n }",
"public void addDependency(final Dependency dependency) {\n if(dependency != null && !dependencies.contains(dependency)){\n this.dependencies.add(dependency);\n }\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 }",
"public static <X, T> ProducerField<X, T> of(BeanAttributes<T> attributes, EnhancedAnnotatedField<T, ? super X> field, AbstractClassBean<X> declaringBean, DisposalMethod<X, ?> disposalMethod, BeanManagerImpl beanManager, ServiceRegistry services) {\n return new ProducerField<X, T>(attributes, field, declaringBean, disposalMethod, beanManager, services);\n }",
"private static String handleRichError(final Response response, final String body) {\n if (!response.getHeaders().containsKey(Headers.CONTENT_TYPE)\n || !response.getHeaders().get(Headers.CONTENT_TYPE).equals(ContentTypes.APPLICATION_JSON)) {\n return body;\n }\n\n final Document doc;\n try {\n doc = BsonUtils.parseValue(body, Document.class);\n } catch (Exception e) {\n return body;\n }\n\n if (!doc.containsKey(Fields.ERROR)) {\n return body;\n }\n final String errorMsg = doc.getString(Fields.ERROR);\n if (!doc.containsKey(Fields.ERROR_CODE)) {\n return errorMsg;\n }\n\n final String errorCode = doc.getString(Fields.ERROR_CODE);\n throw new StitchServiceException(errorMsg, StitchServiceErrorCode.fromCodeName(errorCode));\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 byte[] join(Map<Integer, byte[]> parts) {\n checkArgument(parts.size() > 0, \"No parts provided\");\n final int[] lengths = parts.values().stream().mapToInt(v -> v.length).distinct().toArray();\n checkArgument(lengths.length == 1, \"Varying lengths of part values\");\n final byte[] secret = new byte[lengths[0]];\n for (int i = 0; i < secret.length; i++) {\n final byte[][] points = new byte[parts.size()][2];\n int j = 0;\n for (Map.Entry<Integer, byte[]> part : parts.entrySet()) {\n points[j][0] = part.getKey().byteValue();\n points[j][1] = part.getValue()[i];\n j++;\n }\n secret[i] = GF256.interpolate(points);\n }\n return secret;\n }"
] |
Return the text content of the document. It does not containing trailing spaces and asterisks
at the start of the line. | [
"public String toText() {\n StringBuilder sb = new StringBuilder();\n if (!description.isEmpty()) {\n sb.append(description.toText());\n sb.append(EOL);\n }\n if (!blockTags.isEmpty()) {\n sb.append(EOL);\n }\n for (JavadocBlockTag tag : blockTags) {\n sb.append(tag.toText()).append(EOL);\n }\n return sb.toString();\n }"
] | [
"public static base_response add(nitro_service client, responderpolicy resource) throws Exception {\n\t\tresponderpolicy addresource = new responderpolicy();\n\t\taddresource.name = resource.name;\n\t\taddresource.rule = resource.rule;\n\t\taddresource.action = resource.action;\n\t\taddresource.undefaction = resource.undefaction;\n\t\taddresource.comment = resource.comment;\n\t\taddresource.logaction = resource.logaction;\n\t\taddresource.appflowaction = resource.appflowaction;\n\t\treturn addresource.add_resource(client);\n\t}",
"public Where<T, ID> isNotNull(String columnName) throws SQLException {\n\t\taddClause(new IsNotNull(columnName, findColumnFieldType(columnName)));\n\t\treturn this;\n\t}",
"static void checkUpgradeConditions(final UpgradeCondition condition, final InstallationManager.MutablePatchingTarget target) throws PatchingException {\n // See if the prerequisites are met\n for (final String required : condition.getRequires()) {\n if (!target.isApplied(required)) {\n throw PatchLogger.ROOT_LOGGER.requiresPatch(required);\n }\n }\n // Check for incompatibilities\n for (final String incompatible : condition.getIncompatibleWith()) {\n if (target.isApplied(incompatible)) {\n throw PatchLogger.ROOT_LOGGER.incompatiblePatch(incompatible);\n }\n }\n }",
"public void fatal(Throwable throwable, String msg, Object[] argArray) {\n\t\tlogIfEnabled(Level.FATAL, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);\n\t}",
"public void updateIteratorPosition(int length) {\n if(length > 0) {\n //make sure we dont go OB\n if((length + character) > parsedLine.line().length())\n length = parsedLine.line().length() - character;\n\n //move word counter to the correct word\n while(hasNextWord() &&\n (length + character) >= parsedLine.words().get(word).lineIndex() +\n parsedLine.words().get(word).word().length())\n word++;\n\n character = length + character;\n }\n else\n throw new IllegalArgumentException(\"The length given must be > 0 and not exceed the boundary of the line (including the current position)\");\n }",
"protected void doSave() {\n\n List<CmsFavoriteEntry> entries = getEntries();\n try {\n m_favDao.saveFavorites(entries);\n } catch (Exception e) {\n CmsErrorDialog.showErrorDialog(e);\n }\n }",
"protected void postConnection(ConnectionHandle handle, long statsObtainTime){\r\n\r\n\t\thandle.renewConnection(); // mark it as being logically \"open\"\r\n\r\n\t\t// Give an application a chance to do something with it.\r\n\t\tif (handle.getConnectionHook() != null){\r\n\t\t\thandle.getConnectionHook().onCheckOut(handle);\r\n\t\t}\r\n\r\n\t\tif (this.pool.closeConnectionWatch){ // a debugging tool\r\n\t\t\tthis.pool.watchConnection(handle);\r\n\t\t}\r\n\r\n\t\tif (this.pool.statisticsEnabled){\r\n\t\t\tthis.pool.statistics.addCumulativeConnectionWaitTime(System.nanoTime()-statsObtainTime);\r\n\t\t}\r\n\t}",
"public DateRange getRange(int index)\n {\n DateRange result;\n\n if (index >= 0 && index < m_ranges.size())\n {\n result = m_ranges.get(index);\n }\n else\n {\n result = DateRange.EMPTY_RANGE;\n }\n\n return (result);\n }",
"public RedwoodConfiguration rootHandler(final LogRecordHandler handler){\r\n tasks.add(new Runnable(){ public void run(){ Redwood.appendHandler(handler); } });\r\n Redwood.appendHandler(handler);\r\n return this;\r\n }"
] |
Get a collection of Photo objects for the specified Photoset.
This method does not require authentication.
@see com.flickr4java.flickr.photos.Extras
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_NO_FILTER
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_PUBLIC
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS_FAMILY
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FAMILY
@see com.flickr4java.flickr.Flickr#PRIVACY_LEVEL_FRIENDS
@param photosetId
The photoset ID
@param extras
Set of extra-fields
@param privacy_filter
filter value for authenticated calls
@param perPage
The number of photos per page
@param page
The page offset
@return PhotoList The Collection of Photo objects
@throws FlickrException | [
"public PhotoList<Photo> getPhotos(String photosetId, Set<String> extras, int privacy_filter, int perPage, int page) throws FlickrException {\r\n PhotoList<Photo> photos = new PhotoList<Photo>();\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_PHOTOS);\r\n\r\n parameters.put(\"photoset_id\", photosetId);\r\n\r\n if (perPage > 0) {\r\n parameters.put(\"per_page\", String.valueOf(perPage));\r\n }\r\n\r\n if (page > 0) {\r\n parameters.put(\"page\", String.valueOf(page));\r\n }\r\n\r\n if (privacy_filter > 0) {\r\n parameters.put(\"privacy_filter\", \"\" + privacy_filter);\r\n }\r\n\r\n if (extras != null && !extras.isEmpty()) {\r\n parameters.put(Extras.KEY_EXTRAS, StringUtilities.join(extras, \",\"));\r\n }\r\n\r\n Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n\r\n Element photoset = response.getPayload();\r\n NodeList photoElements = photoset.getElementsByTagName(\"photo\");\r\n photos.setPage(photoset.getAttribute(\"page\"));\r\n photos.setPages(photoset.getAttribute(\"pages\"));\r\n photos.setPerPage(photoset.getAttribute(\"per_page\"));\r\n photos.setTotal(photoset.getAttribute(\"total\"));\r\n\r\n for (int i = 0; i < photoElements.getLength(); i++) {\r\n Element photoElement = (Element) photoElements.item(i);\r\n photos.add(PhotoUtils.createPhoto(photoElement, photoset));\r\n }\r\n\r\n return photos;\r\n }"
] | [
"private void updateImageInfo() {\n\n String crop = getCrop();\n String point = getPoint();\n m_imageInfoDisplay.fillContent(m_info, crop, point);\n }",
"public ReferenceDescriptorDef getReference(String name)\r\n {\r\n ReferenceDescriptorDef refDef;\r\n\r\n for (Iterator it = _references.iterator(); it.hasNext(); )\r\n {\r\n refDef = (ReferenceDescriptorDef)it.next();\r\n if (refDef.getName().equals(name))\r\n {\r\n return refDef;\r\n }\r\n }\r\n return null;\r\n }",
"@Override protected View inflate(LayoutInflater inflater, ViewGroup parent) {\n View inflatedView = inflater.inflate(R.layout.video_renderer, parent, false);\n /*\n * You don't have to use ButterKnife library to implement the mapping between your layout\n * and your widgets you can implement setUpView and hookListener methods declared in\n * Renderer<T> class.\n */\n ButterKnife.bind(this, inflatedView);\n return inflatedView;\n }",
"protected <T> T invokeJavascriptReturnValue(String function, Class<T> returnType) {\n Object returnObject = invokeJavascript(function);\n if (returnObject instanceof JSObject) {\n try {\n Constructor<T> constructor = returnType.getConstructor(JSObject.class);\n return constructor.newInstance((JSObject) returnObject);\n } catch (Exception ex) {\n throw new IllegalStateException(ex);\n }\n } else {\n return (T) returnObject;\n }\n }",
"protected I_CmsSearchDocument appendFieldMappingsFromElementsOnThePage(\n I_CmsSearchDocument document,\n CmsObject cms,\n CmsResource resource,\n List<String> systemFields) {\n\n try {\n CmsFile file = cms.readFile(resource);\n CmsXmlContainerPage containerPage = CmsXmlContainerPageFactory.unmarshal(cms, file);\n CmsContainerPageBean containerBean = containerPage.getContainerPage(cms);\n if (containerBean != null) {\n for (CmsContainerElementBean element : containerBean.getElements()) {\n element.initResource(cms);\n CmsResource elemResource = element.getResource();\n Set<CmsSearchField> mappedFields = getXSDMappingsForPage(cms, elemResource);\n if (mappedFields != null) {\n\n for (CmsSearchField field : mappedFields) {\n if (!systemFields.contains(field.getName())) {\n document = appendFieldMapping(\n document,\n field,\n cms,\n elemResource,\n CmsSolrDocumentXmlContent.extractXmlContent(cms, elemResource, getIndex()),\n cms.readPropertyObjects(resource, false),\n cms.readPropertyObjects(resource, true));\n } else {\n LOG.error(\n Messages.get().getBundle().key(\n Messages.LOG_SOLR_ERR_MAPPING_TO_INTERNALLY_USED_FIELD_3,\n elemResource.getRootPath(),\n field.getName(),\n resource.getRootPath()));\n }\n }\n }\n }\n }\n } catch (CmsException e) {\n // Should be thrown if element on the page does not exist anymore - this is possible, but not necessarily an error.\n // Hence, just notice it in the debug log.\n if (LOG.isDebugEnabled()) {\n LOG.debug(e.getLocalizedMessage(), e);\n }\n }\n return document;\n }",
"private void addHours(ProjectCalendarDateRanges ranges, Record hoursRecord)\n {\n if (hoursRecord.getValue() != null)\n {\n String[] wh = hoursRecord.getValue().split(\"\\\\|\");\n try\n {\n String startText;\n String endText;\n\n if (wh[0].equals(\"s\"))\n {\n startText = wh[1];\n endText = wh[3];\n }\n else\n {\n startText = wh[3];\n endText = wh[1];\n }\n\n // for end time treat midnight as midnight next day\n if (endText.equals(\"00:00\"))\n {\n endText = \"24:00\";\n }\n Date start = m_calendarTimeFormat.parse(startText);\n Date end = m_calendarTimeFormat.parse(endText);\n\n ranges.addRange(new DateRange(start, end));\n }\n catch (ParseException e)\n {\n // silently ignore date parse exceptions\n }\n }\n }",
"public boolean evaluate(Object feature) {\n\t\t// Checks to ensure that the attribute has been set\n\t\tif (attribute == null) {\n\t\t\treturn false;\n\t\t}\n\t\t// Note that this converts the attribute to a string\n\t\t// for comparison. Unlike the math or geometry filters, which\n\t\t// require specific types to function correctly, this filter\n\t\t// using the mandatory string representation in Java\n\t\t// Of course, this does not guarantee a meaningful result, but it\n\t\t// does guarantee a valid result.\n\t\t// LOGGER.finest(\"pattern: \" + pattern);\n\t\t// LOGGER.finest(\"string: \" + attribute.getValue(feature));\n\t\t// return attribute.getValue(feature).toString().matches(pattern);\n\t\tObject value = attribute.evaluate(feature);\n\n\t\tif (null == value) {\n\t\t\treturn false;\n\t\t}\n\n\t\tMatcher matcher = getMatcher();\n\t\tmatcher.reset(value.toString());\n\n\t\treturn matcher.matches();\n\t}",
"public void removePropertyChangeListener (String propertyName, java.beans.PropertyChangeListener listener)\r\n {\r\n this.propertyChangeDelegate.removePropertyChangeListener(propertyName, listener);\r\n }",
"@UiThread\n public void collapseParentRange(int startParentPosition, int parentCount) {\n int endParentPosition = startParentPosition + parentCount;\n for (int i = startParentPosition; i < endParentPosition; i++) {\n collapseParent(i);\n }\n }"
] |
Creates a CSS rgb specification from a PDF color
@param pdcolor
@return the rgb() string | [
"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 }"
] | [
"public void addFile(File file) {\n String name = \"file\";\n files.put(normalizeDuplicateName(name), file);\n }",
"public static final String printDuration(Duration value)\n {\n return value == null ? null : Double.toString(value.getDuration());\n }",
"protected float computeUniformPadding(final CacheDataSet cache) {\n float axisSize = getViewPortSize(getOrientationAxis());\n float totalPadding = axisSize - cache.getTotalSize();\n float uniformPadding = totalPadding > 0 && cache.count() > 1 ?\n totalPadding / (cache.count() - 1) : 0;\n return uniformPadding;\n }",
"private void ensureReferencedPKs(ModelDef modelDef, CollectionDescriptorDef collDef) throws ConstraintException\r\n {\r\n String elementClassName = collDef.getProperty(PropertyHelper.OJB_PROPERTY_ELEMENT_CLASS_REF);\r\n ClassDescriptorDef elementClassDef = modelDef.getClass(elementClassName);\r\n String indirTable = collDef.getProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE);\r\n String localKey = collDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY);\r\n String remoteKey = collDef.getProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY);\r\n boolean hasRemoteKey = remoteKey != null;\r\n ArrayList fittingCollections = new ArrayList();\r\n\r\n // we're checking for the fitting remote collection(s) and also\r\n // use their foreignkey as remote-foreignkey in the original collection definition\r\n for (Iterator it = elementClassDef.getAllExtentClasses(); it.hasNext();)\r\n {\r\n ClassDescriptorDef subTypeDef = (ClassDescriptorDef)it.next();\r\n\r\n // find the collection in the element class that has the same indirection table\r\n for (Iterator collIt = subTypeDef.getCollections(); collIt.hasNext();)\r\n {\r\n CollectionDescriptorDef curCollDef = (CollectionDescriptorDef)collIt.next();\r\n\r\n if (indirTable.equals(curCollDef.getProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE)) &&\r\n (collDef != curCollDef) &&\r\n (!hasRemoteKey || CommaListIterator.sameLists(remoteKey, curCollDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY))) &&\r\n (!curCollDef.hasProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY) ||\r\n CommaListIterator.sameLists(localKey, curCollDef.getProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY))))\r\n {\r\n fittingCollections.add(curCollDef);\r\n }\r\n }\r\n }\r\n if (!fittingCollections.isEmpty())\r\n {\r\n // if there is more than one, check that they match, i.e. that they all have the same foreignkeys\r\n if (!hasRemoteKey && (fittingCollections.size() > 1))\r\n {\r\n CollectionDescriptorDef firstCollDef = (CollectionDescriptorDef)fittingCollections.get(0);\r\n String foreignKey = firstCollDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY);\r\n\r\n for (int idx = 1; idx < fittingCollections.size(); idx++)\r\n {\r\n CollectionDescriptorDef curCollDef = (CollectionDescriptorDef)fittingCollections.get(idx);\r\n\r\n if (!CommaListIterator.sameLists(foreignKey, curCollDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY)))\r\n {\r\n throw new ConstraintException(\"Cannot determine the element-side collection that corresponds to the collection \"+\r\n collDef.getName()+\" in type \"+collDef.getOwner().getName()+\r\n \" because there are at least two different collections that would fit.\"+\r\n \" Specifying remote-foreignkey in the original collection \"+collDef.getName()+\r\n \" will perhaps help\");\r\n }\r\n }\r\n // store the found keys at the collections\r\n collDef.setProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY, foreignKey);\r\n for (int idx = 0; idx < fittingCollections.size(); idx++)\r\n {\r\n CollectionDescriptorDef curCollDef = (CollectionDescriptorDef)fittingCollections.get(idx);\r\n\r\n curCollDef.setProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY, localKey);\r\n }\r\n }\r\n }\r\n\r\n // copy subclass pk fields into target class (if not already present)\r\n ensurePKsFromHierarchy(elementClassDef);\r\n }",
"public static String getAt(String text, Range range) {\n RangeInfo info = subListBorders(text.length(), range);\n String answer = text.substring(info.from, info.to);\n if (info.reverse) {\n answer = reverse(answer);\n }\n return answer;\n }",
"@PostConstruct\n public final void init() throws URISyntaxException {\n final String address = getConfig(ADDRESS, null);\n if (address != null) {\n final URI uri = new URI(\"udp://\" + address);\n final String prefix = getConfig(PREFIX, \"mapfish-print\").replace(\"%h\", getHostname());\n final int period = Integer.parseInt(getConfig(PERIOD, \"10\"));\n LOGGER.info(\"Starting a StatsD reporter targeting {} with prefix {} and period {}s\",\n uri, prefix, period);\n this.reporter = StatsDReporter.forRegistry(this.metricRegistry)\n .prefixedWith(prefix)\n .build(uri.getHost(), uri.getPort());\n this.reporter.start(period, TimeUnit.SECONDS);\n }\n }",
"private Object getParameter(String name, String value) throws ParseException, NumberFormatException {\n\t\tObject result = null;\n\t\tif (name.length() > 0) {\n\n\t\t\tswitch (name.charAt(0)) {\n\t\t\t\tcase 'i':\n\t\t\t\t\tif (null == value || value.length() == 0) {\n\t\t\t\t\t\tvalue = \"0\";\n\t\t\t\t\t}\n\t\t\t\t\tresult = new Integer(value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'f':\n\t\t\t\t\tif (name.startsWith(\"form\")) {\n\t\t\t\t\t\tresult = value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (null == value || value.length() == 0) {\n\t\t\t\t\t\t\tvalue = \"0.0\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresult = new Double(value);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'd':\n\t\t\t\t\tif (null == value || value.length() == 0) {\n\t\t\t\t\t\tresult = null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tSimpleDateFormat dateParser = new SimpleDateFormat(\"yyyy-MM-dd\");\n\t\t\t\t\t\tresult = dateParser.parse(value);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 't':\n\t\t\t\t\tif (null == value || value.length() == 0) {\n\t\t\t\t\t\tresult = null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tSimpleDateFormat timeParser = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n\t\t\t\t\t\tresult = timeParser.parse(value);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'b':\n\t\t\t\t\tresult = \"true\".equalsIgnoreCase(value) ? Boolean.TRUE : Boolean.FALSE;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tresult = value;\n\t\t\t}\n\t\t\tif (log.isDebugEnabled()) {\n\t\t\t\tif (result != null) {\n\t\t\t\t\tlog.debug(\n\t\t\t\t\t\t\t\"parameter \" + name + \" value \" + result + \" class \" + result.getClass().getName());\n\t\t\t\t} else {\n\t\t\t\t\tlog.debug(\"parameter\" + name + \"is null\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}",
"public static String marshal(Object object) {\n if (object == null) {\n return null;\n }\n\n try {\n JAXBContext jaxbCtx = JAXBContext.newInstance(object.getClass());\n\n Marshaller marshaller = jaxbCtx.createMarshaller();\n marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);\n\n StringWriter sw = new StringWriter();\n marshaller.marshal(object, sw);\n\n return sw.toString();\n } catch (Exception e) {\n }\n\n return null;\n }",
"public static Expression type(String lhs, Type rhs) {\n return new Expression(lhs, \"$type\", rhs.toString());\n }"
] |
Apply modifications to a content task definition.
@param patchId the patch id
@param modifications the modifications
@param definitions the task definitions
@param filter the content item filter | [
"static void apply(final String patchId, final Collection<ContentModification> modifications, final PatchEntry patchEntry, final ContentItemFilter filter) {\n for (final ContentModification modification : modifications) {\n\n final ContentItem item = modification.getItem();\n // Check if we accept the item\n if (!filter.accepts(item)) {\n continue;\n }\n\n final Location location = new Location(item);\n final ContentEntry contentEntry = new ContentEntry(patchId, modification);\n ContentTaskDefinition definition = patchEntry.get(location);\n if (definition == null) {\n definition = new ContentTaskDefinition(location, contentEntry, false);\n patchEntry.put(location, definition);\n } else {\n definition.setTarget(contentEntry);\n }\n }\n }"
] | [
"public static cacheselector[] get(nitro_service service, String selectorname[]) throws Exception{\n\t\tif (selectorname !=null && selectorname.length>0) {\n\t\t\tcacheselector response[] = new cacheselector[selectorname.length];\n\t\t\tcacheselector obj[] = new cacheselector[selectorname.length];\n\t\t\tfor (int i=0;i<selectorname.length;i++) {\n\t\t\t\tobj[i] = new cacheselector();\n\t\t\t\tobj[i].set_selectorname(selectorname[i]);\n\t\t\t\tresponse[i] = (cacheselector) obj[i].get_resource(service);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t\treturn null;\n\t}",
"private void validate(Object object) {\n\t\tSet<ConstraintViolation<Object>> viols = validator.validate(object);\n\t\tfor (ConstraintViolation<Object> constraintViolation : viols) {\n\t\t\tif (Null.class.isAssignableFrom(constraintViolation.getConstraintDescriptor().getAnnotation().getClass())) {\n\t\t\t\tObject o = constraintViolation.getLeafBean();\n\t\t\t\tIterator<Node> iterator = constraintViolation.getPropertyPath().iterator();\n\t\t\t\tString propertyName = null;\n\t\t\t\twhile (iterator.hasNext()) {\n\t\t\t\t\tpropertyName = iterator.next().getName();\n\t\t\t\t}\n\t\t\t\tif (propertyName != null) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tPropertyDescriptor descriptor = BeanUtils.getPropertyDescriptor(o.getClass(), propertyName);\n\t\t\t\t\t\tdescriptor.getWriteMethod().invoke(o, new Object[] { null });\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"private Map<String, Criteria> getCriterias(Map<String, String[]> params) {\n Map<String, Criteria> result = new HashMap<String, Criteria>();\n for (Map.Entry<String, String[]> param : params.entrySet()) {\n for (Criteria criteria : FILTER_CRITERIAS) {\n if (criteria.getName().equals(param.getKey())) {\n try {\n Criteria[] parsedCriterias = criteria.parseValue(param.getValue()[0]);\n for (Criteria parsedCriteria : parsedCriterias) {\n result.put(parsedCriteria.getName(), parsedCriteria);\n }\n } catch (Exception e) {\n // Exception happened during paring\n LOG.log(Level.SEVERE, \"Error parsing parameter \" + param.getKey(), e);\n }\n break;\n }\n }\n }\n return result;\n }",
"public static base_responses delete(nitro_service client, String ciphergroupname[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (ciphergroupname != null && ciphergroupname.length > 0) {\n\t\t\tsslcipher deleteresources[] = new sslcipher[ciphergroupname.length];\n\t\t\tfor (int i=0;i<ciphergroupname.length;i++){\n\t\t\t\tdeleteresources[i] = new sslcipher();\n\t\t\t\tdeleteresources[i].ciphergroupname = ciphergroupname[i];\n\t\t\t}\n\t\t\tresult = delete_bulk_request(client, deleteresources);\n\t\t}\n\t\treturn result;\n\t}",
"public PhotoContext getContext(String photoId) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_CONTEXT);\r\n\r\n parameters.put(\"photo_id\", photoId);\r\n\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 PhotoContext photoContext = new PhotoContext();\r\n Collection<Element> payload = response.getPayloadCollection();\r\n for (Element payloadElement : payload) {\r\n String tagName = payloadElement.getTagName();\r\n if (tagName.equals(\"prevphoto\")) {\r\n Photo photo = new Photo();\r\n photo.setId(payloadElement.getAttribute(\"id\"));\r\n photo.setSecret(payloadElement.getAttribute(\"secret\"));\r\n photo.setTitle(payloadElement.getAttribute(\"title\"));\r\n photo.setFarm(payloadElement.getAttribute(\"farm\"));\r\n photo.setUrl(payloadElement.getAttribute(\"url\"));\r\n photoContext.setPreviousPhoto(photo);\r\n } else if (tagName.equals(\"nextphoto\")) {\r\n Photo photo = new Photo();\r\n photo.setId(payloadElement.getAttribute(\"id\"));\r\n photo.setSecret(payloadElement.getAttribute(\"secret\"));\r\n photo.setTitle(payloadElement.getAttribute(\"title\"));\r\n photo.setFarm(payloadElement.getAttribute(\"farm\"));\r\n photo.setUrl(payloadElement.getAttribute(\"url\"));\r\n photoContext.setNextPhoto(photo);\r\n }\r\n }\r\n return photoContext;\r\n }",
"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 float getBoundsHeight(){\n if (mSceneObject != null) {\n GVRSceneObject.BoundingVolume v = mSceneObject.getBoundingVolume();\n return v.maxCorner.y - v.minCorner.y;\n }\n return 0f;\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 }",
"public double mean() {\n double total = 0;\n\n final int N = getNumElements();\n for( int i = 0; i < N; i++ ) {\n total += get(i);\n }\n\n return total/N;\n }"
] |
sorts are a bit more awkward and need a helper... | [
"private static String quoteSort(Sort[] sort) {\n LinkedList<String> sorts = new LinkedList<String>();\n for (Sort pair : sort) {\n sorts.add(String.format(\"{%s: %s}\", Helpers.quote(pair.getName()), Helpers.quote(pair.getOrder().toString())));\n }\n return sorts.toString();\n }"
] | [
"public void initLocator() throws InterruptedException,\n ServiceLocatorException {\n if (locatorClient == null) {\n if (LOG.isLoggable(Level.FINE)) {\n LOG.fine(\"Instantiate locatorClient client for Locator Server \"\n + locatorEndpoints + \"...\");\n }\n ServiceLocatorImpl client = new ServiceLocatorImpl();\n client.setLocatorEndpoints(locatorEndpoints);\n client.setConnectionTimeout(connectionTimeout);\n client.setSessionTimeout(sessionTimeout);\n if (null != authenticationName)\n client.setName(authenticationName);\n if (null != authenticationPassword)\n client.setPassword(authenticationPassword);\n locatorClient = client;\n locatorClient.connect();\n }\n }",
"public double d(double x){\n\t\tint intervalNumber =getIntervalNumber(x);\n\t\tif (intervalNumber==0 || intervalNumber==points.length) {\n\t\t\treturn x;\n\t\t}\n\t\treturn getIntervalReferencePoint(intervalNumber-1);\n\t}",
"public static void applyDecidedIconOrSetGone(ImageHolder imageHolder, ImageView imageView, int iconColor, boolean tint) {\n if (imageHolder != null && imageView != null) {\n Drawable drawable = ImageHolder.decideIcon(imageHolder, imageView.getContext(), iconColor, tint);\n if (drawable != null) {\n imageView.setImageDrawable(drawable);\n imageView.setVisibility(View.VISIBLE);\n } else if (imageHolder.getBitmap() != null) {\n imageView.setImageBitmap(imageHolder.getBitmap());\n imageView.setVisibility(View.VISIBLE);\n } else {\n imageView.setVisibility(View.GONE);\n }\n } else if (imageView != null) {\n imageView.setVisibility(View.GONE);\n }\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 static int Maximum(ImageSource fastBitmap, int startX, int startY, int width, int height) {\r\n int max = 0;\r\n\r\n if (fastBitmap.isGrayscale()) {\r\n for (int i = startX; i < height; i++) {\r\n for (int j = startY; j < width; j++) {\r\n int gray = fastBitmap.getRGB(j, i);\r\n if (gray > max) {\r\n max = gray;\r\n }\r\n }\r\n }\r\n } else {\r\n for (int i = startX; i < height; i++) {\r\n for (int j = startY; j < width; j++) {\r\n int gray = fastBitmap.getG(j, i);\r\n if (gray > max) {\r\n max = gray;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return max;\r\n }",
"static VaultConfig readVaultElement_3_0(XMLExtendedStreamReader reader, Namespace expectedNs) throws XMLStreamException {\n final VaultConfig config = new VaultConfig();\n\n final int count = reader.getAttributeCount();\n for (int i = 0; i < count; i++) {\n final String value = reader.getAttributeValue(i);\n String name = reader.getAttributeLocalName(i);\n if (name.equals(CODE)){\n config.code = value;\n } else if (name.equals(MODULE)){\n config.module = value;\n } else {\n unexpectedVaultAttribute(reader.getAttributeLocalName(i), reader);\n }\n }\n if (config.code == null && config.module != null){\n throw new XMLStreamException(\"Attribute 'module' was specified without an attribute\"\n + \" 'code' for element '\" + VAULT + \"' at \" + reader.getLocation());\n }\n readVaultOptions(reader, config);\n return config;\n }",
"void registerAlias(FieldType type, String alias)\n {\n m_aliasMap.put(new Pair<FieldTypeClass, String>(type.getFieldTypeClass(), alias), type);\n }",
"public static rnat_stats get(nitro_service service) throws Exception{\n\t\trnat_stats obj = new rnat_stats();\n\t\trnat_stats[] response = (rnat_stats[])obj.stat_resources(service);\n\t\treturn response[0];\n\t}",
"public void setStringValue(String value) {\n\n if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) {\n try {\n m_editValue = CmsLocationValue.parse(value);\n m_currentValue = m_editValue.cloneValue();\n displayValue();\n if ((m_popup != null) && m_popup.isVisible()) {\n m_popupContent.displayValues(m_editValue);\n updateMarkerPosition();\n }\n } catch (Exception e) {\n CmsLog.log(e.getLocalizedMessage() + \"\\n\" + CmsClientStringUtil.getStackTrace(e, \"\\n\"));\n }\n } else {\n m_currentValue = null;\n displayValue();\n }\n }"
] |
Process the host info and determine which configuration elements are required on the slave host.
@param hostInfo the host info
@param root the model root
@param extensionRegistry the extension registry
@return | [
"public static RequiredConfigurationHolder populateHostResolutionContext(final HostInfo hostInfo, final Resource root, final ExtensionRegistry extensionRegistry) {\n final RequiredConfigurationHolder rc = new RequiredConfigurationHolder();\n for (IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo info : hostInfo.getServerConfigInfos()) {\n processServerConfig(root, rc, info, extensionRegistry);\n }\n return rc;\n }"
] | [
"private void readRelationship(Link link)\n {\n Task sourceTask = m_taskIdMap.get(link.getSourceTaskID());\n Task destinationTask = m_taskIdMap.get(link.getDestinationTaskID());\n if (sourceTask != null && destinationTask != null)\n {\n Duration lag = getDuration(link.getLagUnit(), link.getLag());\n RelationType type = link.getType();\n Relation relation = destinationTask.addPredecessor(sourceTask, type, lag);\n relation.setUniqueID(link.getID());\n }\n }",
"public static dospolicy get(nitro_service service, String name) throws Exception{\n\t\tdospolicy obj = new dospolicy();\n\t\tobj.set_name(name);\n\t\tdospolicy response = (dospolicy) obj.get_resource(service);\n\t\treturn response;\n\t}",
"public List<Throwable> getCauses(Throwable t)\n {\n List<Throwable> causes = new LinkedList<Throwable>();\n Throwable next = t;\n while (next.getCause() != null)\n {\n next = next.getCause();\n causes.add(next);\n }\n return causes;\n }",
"public static boolean checkConfiguredInModules() {\n\n Boolean result = m_moduleCheckCache.get();\n if (result == null) {\n result = Boolean.valueOf(getConfiguredTemplateMapping() != null);\n m_moduleCheckCache.set(result);\n }\n return result.booleanValue();\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 }",
"@Override\n public void removeStorageEngine(StorageEngine<ByteArray, byte[], byte[]> engine) {\n String storeName = engine.getName();\n BdbStorageEngine bdbEngine = (BdbStorageEngine) engine;\n\n synchronized(lock) {\n\n // Only cleanup the environment if it is per store. We cannot\n // cleanup a shared 'Environment' object\n if(useOneEnvPerStore) {\n\n Environment environment = this.environments.get(storeName);\n if(environment == null) {\n // Nothing to clean up.\n return;\n }\n\n // Remove from the set of unreserved stores if needed.\n if(this.unreservedStores.remove(environment)) {\n logger.info(\"Removed environment for store name: \" + storeName\n + \" from unreserved stores\");\n } else {\n logger.info(\"No environment found in unreserved stores for store name: \"\n + storeName);\n }\n\n // Try to delete the BDB directory associated\n File bdbDir = environment.getHome();\n if(bdbDir.exists() && bdbDir.isDirectory()) {\n String bdbDirPath = bdbDir.getPath();\n try {\n FileUtils.deleteDirectory(bdbDir);\n logger.info(\"Successfully deleted BDB directory : \" + bdbDirPath\n + \" for store name: \" + storeName);\n } catch(IOException e) {\n logger.error(\"Unable to delete BDB directory: \" + bdbDirPath\n + \" for store name: \" + storeName);\n }\n }\n\n // Remove the reference to BdbEnvironmentStats, which holds a\n // reference to the Environment\n BdbEnvironmentStats bdbEnvStats = bdbEngine.getBdbEnvironmentStats();\n this.aggBdbStats.unTrackEnvironment(bdbEnvStats);\n\n // Unregister the JMX bean for Environment\n if(voldemortConfig.isJmxEnabled()) {\n ObjectName name = JmxUtils.createObjectName(JmxUtils.getPackageName(bdbEnvStats.getClass()),\n storeName);\n // Un-register the environment stats mbean\n JmxUtils.unregisterMbean(name);\n }\n\n // Cleanup the environment\n environment.close();\n this.environments.remove(storeName);\n logger.info(\"Successfully closed the environment for store name : \" + storeName);\n\n }\n }\n }",
"public Date getStart()\n {\n Date result = null;\n for (ResourceAssignment assignment : m_assignments)\n {\n if (result == null || DateHelper.compare(result, assignment.getStart()) > 0)\n {\n result = assignment.getStart();\n }\n }\n return (result);\n }",
"private boolean isInInnerCircle(float x, float y) {\n return GearWearableUtility.isInCircle(x, y, CENTER_X, CENTER_Y, INNER_RADIUS);\n }",
"public static Bytes toBytes(Text t) {\n return Bytes.of(t.getBytes(), 0, t.getLength());\n }"
] |
Sets the elements of this vector to uniformly distributed random values
in a specified range, using a supplied random number generator.
@param lower
lower random value (inclusive)
@param upper
upper random value (exclusive)
@param generator
random number generator | [
"protected void setRandom(double lower, double upper, Random generator) {\n double range = upper - lower;\n\n x = generator.nextDouble() * range + lower;\n y = generator.nextDouble() * range + lower;\n z = generator.nextDouble() * range + lower;\n }"
] | [
"public static Variable deserialize(String s,\n VariableType variableType) {\n return deserialize(s,\n variableType,\n null);\n }",
"public static final BigInteger getBigInteger(Number value)\n {\n BigInteger result = null;\n if (value != null)\n {\n if (value instanceof BigInteger)\n {\n result = (BigInteger) value;\n }\n else\n {\n result = BigInteger.valueOf(Math.round(value.doubleValue()));\n }\n }\n return (result);\n }",
"public static vpnclientlessaccesspolicy get(nitro_service service, String name) throws Exception{\n\t\tvpnclientlessaccesspolicy obj = new vpnclientlessaccesspolicy();\n\t\tobj.set_name(name);\n\t\tvpnclientlessaccesspolicy response = (vpnclientlessaccesspolicy) obj.get_resource(service);\n\t\treturn response;\n\t}",
"public static final Double parseCurrency(Number value)\n {\n return (value == null ? null : NumberHelper.getDouble(value.doubleValue() / 100));\n }",
"public static IPAddressSeqRange[] join(IPAddressSeqRange... ranges) {\n\t\tint joinedCount = 0;\n\t\tArrays.sort(ranges, Address.ADDRESS_LOW_VALUE_COMPARATOR);\n\t\tfor(int i = 0; i < ranges.length; i++) {\n\t\t\tIPAddressSeqRange range = ranges[i];\n\t\t\tif(range == null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor(int j = i + 1; j < ranges.length; j++) {\n\t\t\t\tIPAddressSeqRange range2 = ranges[j];\n\t\t\t\tif(range2 == null) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tIPAddress upper = range.getUpper();\n\t\t\t\tIPAddress lower = range2.getLower();\n\t\t\t\tif(compareLowValues(upper, lower) >= 0\n\t\t\t\t\t\t|| upper.increment(1).equals(lower)) {\n\t\t\t\t\t//join them\n\t\t\t\t\tranges[i] = range = range.create(range.getLower(), range2.getUpper());\n\t\t\t\t\tranges[j] = null;\n\t\t\t\t\tjoinedCount++;\n\t\t\t\t} else break;\n\t\t\t}\n\t\t}\n\t\tif(joinedCount == 0) {\n\t\t\treturn ranges;\n\t\t}\n\t\tIPAddressSeqRange joined[] = new IPAddressSeqRange[ranges.length - joinedCount];\n\t\tfor(int i = 0, j = 0; i < ranges.length; i++) {\n\t\t\tIPAddressSeqRange range = ranges[i];\n\t\t\tif(range == null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tjoined[j++] = range;\n\t\t\tif(j >= joined.length) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn joined;\n\t}",
"private static Pod getRandomPod(KubernetesClient client, String name, String namespace) {\n Endpoints endpoints = client.endpoints().inNamespace(namespace).withName(name).get();\n List<String> pods = new ArrayList<>();\n if (endpoints != null) {\n for (EndpointSubset subset : endpoints.getSubsets()) {\n for (EndpointAddress address : subset.getAddresses()) {\n if (address.getTargetRef() != null && POD.equals(address.getTargetRef().getKind())) {\n String pod = address.getTargetRef().getName();\n if (pod != null && !pod.isEmpty()) {\n pods.add(pod);\n }\n }\n }\n }\n }\n if (pods.isEmpty()) {\n return null;\n } else {\n String chosen = pods.get(RANDOM.nextInt(pods.size()));\n return client.pods().inNamespace(namespace).withName(chosen).get();\n }\n }",
"public static final Double getPercentage(byte[] data, int offset)\n {\n int value = MPPUtility.getShort(data, offset);\n Double result = null;\n if (value >= 0 && value <= 100)\n {\n result = NumberHelper.getDouble(value);\n }\n return result;\n }",
"public Info getInfo() {\n BoxAPIConnection api = this.getAPI();\n URL url = COLLABORATION_URL_TEMPLATE.build(api.getBaseURL(), this.getID());\n\n BoxAPIRequest request = new BoxAPIRequest(api, url, \"GET\");\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject jsonObject = JsonObject.readFrom(response.getJSON());\n return new Info(jsonObject);\n }",
"private Set<File> findThriftFiles() throws IOException, MojoExecutionException {\n final File thriftSourceRoot = getThriftSourceRoot();\n Set<File> thriftFiles = new HashSet<File>();\n if (thriftSourceRoot != null && thriftSourceRoot.exists()) {\n thriftFiles.addAll(findThriftFilesInDirectory(thriftSourceRoot));\n }\n getLog().info(\"finding thrift files in dependencies\");\n extractFilesFromDependencies(findThriftDependencies(), getResourcesOutputDirectory());\n if (buildExtractedThrift && getResourcesOutputDirectory().exists()) {\n thriftFiles.addAll(findThriftFilesInDirectory(getResourcesOutputDirectory()));\n }\n getLog().info(\"finding thrift files in referenced (reactor) projects\");\n thriftFiles.addAll(getReferencedThriftFiles());\n return thriftFiles;\n }"
] |
Add statistics about sent emails.
@param recipients The list of recipients.
@param storageUsed If a remote storage was used. | [
"public void addEmailStats(final InternetAddress[] recipients, final boolean storageUsed) {\n this.storageUsed = storageUsed;\n for (InternetAddress recipient: recipients) {\n emailDests.add(recipient.getAddress());\n }\n }"
] | [
"protected void addPropertiesStart(String type) {\n putProperty(PropertyKey.Host.name(), IpUtils.getHostName());\n putProperty(PropertyKey.Type.name(), type);\n putProperty(PropertyKey.Status.name(), Status.Start.name());\n }",
"public static Chart getMSDLineWithPowerModelChart(Trajectory t, int lagMin,\n\t\t\tint lagMax, double timelag, double a, double D) {\n\n\t\tdouble[] xData = new double[lagMax - lagMin + 1];\n\t\tdouble[] yData = new double[lagMax - lagMin + 1];\n\t\tdouble[] modelData = new double[lagMax - lagMin + 1];\n\t\tMeanSquaredDisplacmentFeature msdeval = new MeanSquaredDisplacmentFeature(\n\t\t\t\tt, lagMin);\n\t\tmsdeval.setTrajectory(t);\n\t\tmsdeval.setTimelag(lagMin);\n\t\tfor (int i = lagMin; i < lagMax + 1; i++) {\n\t\t\tmsdeval.setTimelag(i);\n\t\t\tdouble msdhelp = msdeval.evaluate()[0];\n\t\t\txData[i - lagMin] = i;\n\t\t\tyData[i - lagMin] = msdhelp;\n\t\t\tmodelData[i - lagMin] = 4 * D * Math.pow(i * timelag, a);\n\t\t}\n\n\t\t// Create Chart\n\t\tChart chart = QuickChart.getChart(\"MSD Line\", \"LAG\", \"MSD\", \"MSD\",\n\t\t\t\txData, yData);\n\t\tchart.addSeries(\"y=4*D*t^alpha\", xData, modelData);\n\n\t\t// Show it\n\t\t//new SwingWrapper(chart).displayChart();\n\t\treturn chart;\n\t}",
"static List<List<String>> handleNewLines( List<List<String>> tableModel ) {\n List<List<String>> result = Lists.newArrayListWithExpectedSize( tableModel.size() );\n\n for( List<String> row : tableModel ) {\n if( hasNewline( row ) ) {\n result.addAll( splitRow( row ) );\n } else {\n result.add( row );\n }\n }\n\n return result;\n }",
"public static BufferedImage resizeToHeight(BufferedImage originalImage, int heightOut) {\n\n int width = originalImage.getWidth();\n\n int height = originalImage.getHeight();\n\n int heightPercent = (heightOut * 100) / height;\n\n int newWidth = (width * heightPercent) / 100;\n\n BufferedImage resizedImage =\n new BufferedImage(newWidth, heightOut, BufferedImage.TYPE_INT_ARGB);\n Graphics2D g = resizedImage.createGraphics();\n g.drawImage(originalImage, 0, 0, newWidth, heightOut, null);\n g.dispose();\n\n return resizedImage;\n }",
"public String findAlias(String entityAlias, List<String> propertyPathWithoutAlias) {\n\t\tRelationshipAliasTree aliasTree = relationshipAliases.get( entityAlias );\n\t\tif ( aliasTree == null ) {\n\t\t\treturn null;\n\t\t}\n\t\tRelationshipAliasTree associationAlias = aliasTree;\n\t\tfor ( int i = 0; i < propertyPathWithoutAlias.size(); i++ ) {\n\t\t\tassociationAlias = associationAlias.findChild( propertyPathWithoutAlias.get( i ) );\n\t\t\tif ( associationAlias == null ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\treturn associationAlias.getAlias();\n\t}",
"public static void writeCorrelationId(Message message, String correlationId) {\n Map<String, List<String>> headers = getOrCreateProtocolHeader(message);\n headers.put(CORRELATIONID_HTTP_HEADER_NAME, Collections.singletonList(correlationId));\n if (LOG.isLoggable(Level.FINE)) {\n LOG.fine(\"HTTP header '\" + CORRELATIONID_HTTP_HEADER_NAME + \"' set to: \" + correlationId);\n }\n }",
"@Override\n protected void runUnsafe() throws Exception {\n Path reportDirectory = getReportDirectoryPath();\n Files.walkFileTree(reportDirectory, new DeleteVisitor());\n LOGGER.info(\"Report directory <{}> was successfully cleaned.\", reportDirectory);\n }",
"private String getTypeString(Class<?> c)\n {\n String result = TYPE_MAP.get(c);\n if (result == null)\n {\n result = c.getName();\n if (!result.endsWith(\";\") && !result.startsWith(\"[\"))\n {\n result = \"L\" + result + \";\";\n }\n }\n return result;\n }",
"@Override\n public Scenario<GIVEN, WHEN, THEN> startScenario( String description ) {\n super.startScenario( description );\n return this;\n\n }"
] |
Port forward missing module changes for each layer.
@param patch the current patch
@param context the patch context
@throws PatchingException
@throws IOException
@throws XMLStreamException | [
"void portForward(final Patch patch, IdentityPatchContext context) throws PatchingException, IOException, XMLStreamException {\n assert patch.getIdentity().getPatchType() == Patch.PatchType.CUMULATIVE;\n\n final PatchingHistory history = context.getHistory();\n for (final PatchElement element : patch.getElements()) {\n\n final PatchElementProvider provider = element.getProvider();\n final String name = provider.getName();\n final boolean addOn = provider.isAddOn();\n\n final IdentityPatchContext.PatchEntry target = context.resolveForElement(element);\n final String cumulativePatchID = target.getCumulativePatchID();\n if (Constants.BASE.equals(cumulativePatchID)) {\n reenableRolledBackInBase(target);\n continue;\n }\n\n boolean found = false;\n final PatchingHistory.Iterator iterator = history.iterator();\n while (iterator.hasNextCP()) {\n final PatchingHistory.Entry entry = iterator.nextCP();\n final String patchId = addOn ? entry.getAddOnPatches().get(name) : entry.getLayerPatches().get(name);\n\n if (patchId != null && patchId.equals(cumulativePatchID)) {\n final Patch original = loadPatchInformation(entry.getPatchId(), installedImage);\n for (final PatchElement originalElement : original.getElements()) {\n if (name.equals(originalElement.getProvider().getName())\n && addOn == originalElement.getProvider().isAddOn()) {\n PatchingTasks.addMissingModifications(target, originalElement.getModifications(), ContentItemFilter.ALL_BUT_MISC);\n }\n }\n // Record a loader to have access to the current modules\n final DirectoryStructure structure = target.getDirectoryStructure();\n final File modulesRoot = structure.getModulePatchDirectory(patchId);\n final File bundlesRoot = structure.getBundlesPatchDirectory(patchId);\n final PatchContentLoader loader = PatchContentLoader.create(null, bundlesRoot, modulesRoot);\n context.recordContentLoader(patchId, loader);\n found = true;\n break;\n }\n }\n if (!found) {\n throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(cumulativePatchID);\n }\n\n reenableRolledBackInBase(target);\n }\n }"
] | [
"@Beta(SinceVersion.V1_1_0)\n public void close() {\n httpClient.dispatcher().executorService().shutdown();\n httpClient.connectionPool().evictAll();\n synchronized (httpClient.connectionPool()) {\n httpClient.connectionPool().notifyAll();\n }\n synchronized (AsyncTimeout.class) {\n AsyncTimeout.class.notifyAll();\n }\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 }",
"public void sendJsonToTagged(Object data, String label) {\n sendToTagged(JSON.toJSONString(data), label);\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 }",
"public BoxTaskAssignment.Info addAssignment(BoxUser assignTo) {\n JsonObject taskJSON = new JsonObject();\n taskJSON.add(\"type\", \"task\");\n taskJSON.add(\"id\", this.getID());\n\n JsonObject assignToJSON = new JsonObject();\n assignToJSON.add(\"id\", assignTo.getID());\n\n JsonObject requestJSON = new JsonObject();\n requestJSON.add(\"task\", taskJSON);\n requestJSON.add(\"assign_to\", assignToJSON);\n\n URL url = ADD_TASK_ASSIGNMENT_URL_TEMPLATE.build(this.getAPI().getBaseURL());\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, \"POST\");\n request.setBody(requestJSON.toString());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n\n BoxTaskAssignment addedAssignment = new BoxTaskAssignment(this.getAPI(), responseJSON.get(\"id\").asString());\n return addedAssignment.new Info(responseJSON);\n }",
"private boolean skipBar(Row row)\n {\n List<Row> childRows = row.getChildRows();\n return childRows.size() == 1 && childRows.get(0).getChildRows().isEmpty();\n }",
"@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoZonedDateTime<AccountingDate> zonedDateTime(TemporalAccessor temporal) {\n return (ChronoZonedDateTime<AccountingDate>) super.zonedDateTime(temporal);\n }",
"private ClassDescriptor getRealClassDescriptor(ClassDescriptor aCld, Object anObj)\r\n {\r\n ClassDescriptor result;\r\n\r\n if(aCld.getClassOfObject() == ProxyHelper.getRealClass(anObj))\r\n {\r\n result = aCld;\r\n }\r\n else\r\n {\r\n result = aCld.getRepository().getDescriptorFor(anObj.getClass());\r\n }\r\n\r\n return result;\r\n }",
"private void createResults(List<ISuite> suites,\n File outputDirectory,\n boolean onlyShowFailures) throws Exception\n {\n int index = 1;\n for (ISuite suite : suites)\n {\n int index2 = 1;\n for (ISuiteResult result : suite.getResults().values())\n {\n boolean failuresExist = result.getTestContext().getFailedTests().size() > 0\n || result.getTestContext().getFailedConfigurations().size() > 0;\n if (!onlyShowFailures || failuresExist)\n {\n VelocityContext context = createContext();\n context.put(RESULT_KEY, result);\n context.put(FAILED_CONFIG_KEY, sortByTestClass(result.getTestContext().getFailedConfigurations()));\n context.put(SKIPPED_CONFIG_KEY, sortByTestClass(result.getTestContext().getSkippedConfigurations()));\n context.put(FAILED_TESTS_KEY, sortByTestClass(result.getTestContext().getFailedTests()));\n context.put(SKIPPED_TESTS_KEY, sortByTestClass(result.getTestContext().getSkippedTests()));\n context.put(PASSED_TESTS_KEY, sortByTestClass(result.getTestContext().getPassedTests()));\n String fileName = String.format(\"suite%d_test%d_%s\", index, index2, RESULTS_FILE);\n generateFile(new File(outputDirectory, fileName),\n RESULTS_FILE + TEMPLATE_EXTENSION,\n context);\n }\n ++index2;\n }\n ++index;\n }\n }"
] |
Use this API to fetch all the policydataset resources that are configured on netscaler. | [
"public static policydataset[] get(nitro_service service) throws Exception{\n\t\tpolicydataset obj = new policydataset();\n\t\tpolicydataset[] response = (policydataset[])obj.get_resources(service);\n\t\treturn response;\n\t}"
] | [
"public String convertToReadableDate(Holiday holiday) {\n DateTimeFormatter parser = ISODateTimeFormat.date();\n\n if (holiday.isInDateForm()) {\n String month = Integer.toString(holiday.getMonth()).length() < 2\n ? \"0\" + holiday.getMonth() : Integer.toString(holiday.getMonth());\n String day = Integer.toString(holiday.getDayOfMonth()).length() < 2\n ? \"0\" + holiday.getDayOfMonth() : Integer.toString(holiday.getDayOfMonth());\n return holiday.getYear() + \"-\" + month + \"-\" + day;\n } else {\n /*\n * 5 denotes the final occurrence of the day in the month. Need to find actual\n * number of occurrences\n */\n if (holiday.getOccurrence() == 5) {\n holiday.setOccurrence(numOccurrences(holiday.getYear(), holiday.getMonth(),\n holiday.getDayOfWeek()));\n }\n\n DateTime date = parser.parseDateTime(holiday.getYear() + \"-\"\n + holiday.getMonth() + \"-\" + \"01\");\n Calendar calendar = Calendar.getInstance();\n calendar.setTime(date.toDate());\n int count = 0;\n\n while (count < holiday.getOccurrence()) {\n if (calendar.get(Calendar.DAY_OF_WEEK) == holiday.getDayOfWeek()) {\n count++;\n if (count == holiday.getOccurrence()) {\n break;\n }\n }\n date = date.plusDays(1);\n calendar.setTime(date.toDate());\n }\n return date.toString().substring(0, 10);\n }\n }",
"@Override\n public synchronized void start() {\n if (!started.getAndSet(true)) {\n finished.set(false);\n thread.start();\n }\n }",
"public static String getImageIdFromAgent(Launcher launcher, final String imageTag, final String host) throws IOException, InterruptedException {\n return launcher.getChannel().call(new MasterToSlaveCallable<String, IOException>() {\n public String call() throws IOException {\n return DockerUtils.getImageIdFromTag(imageTag, host);\n }\n });\n }",
"public void fireEvent(final WorkerEvent event, final Worker worker, final String queue, final Job job, \n final Object runner, final Object result, final Throwable t) {\n final ConcurrentSet<WorkerListener> listeners = this.eventListenerMap.get(event);\n if (listeners != null) {\n for (final WorkerListener listener : listeners) {\n if (listener != null) {\n try {\n listener.onEvent(event, worker, queue, job, runner, result, t);\n } catch (Exception e) {\n log.error(\"Failure executing listener \" + listener + \" for event \" + event \n + \" from queue \" + queue + \" on worker \" + worker, e);\n }\n }\n }\n }\n }",
"public GroovyFieldDoc[] enumConstants() {\n Collections.sort(enumConstants);\n return enumConstants.toArray(new GroovyFieldDoc[enumConstants.size()]);\n }",
"@Override\n public Map<String, Set<String>> cleanObsoleteContent() {\n if(!readWrite) {\n return Collections.emptyMap();\n }\n Map<String, Set<String>> cleanedContents = new HashMap<>(2);\n cleanedContents.put(MARKED_CONTENT, new HashSet<>());\n cleanedContents.put(DELETED_CONTENT, new HashSet<>());\n synchronized (contentHashReferences) {\n for (ContentReference fsContent : listLocalContents()) {\n if (!readWrite) {\n return Collections.emptyMap();\n }\n if (!contentHashReferences.containsKey(fsContent.getHexHash())) { //We have no reference to this content\n if (markAsObsolete(fsContent)) {\n cleanedContents.get(DELETED_CONTENT).add(fsContent.getContentIdentifier());\n } else {\n cleanedContents.get(MARKED_CONTENT).add(fsContent.getContentIdentifier());\n }\n } else {\n obsoleteContents.remove(fsContent.getHexHash()); //Remove existing references from obsoleteContents\n }\n }\n }\n return cleanedContents;\n }",
"public static Info ones( final Variable A , final Variable B , ManagerTempVariables manager) {\n Info ret = new Info();\n final VariableMatrix output = manager.createMatrix();\n ret.output = output;\n\n if( A instanceof VariableInteger && B instanceof VariableInteger ) {\n ret.op = new Operation(\"ones-ii\") {\n @Override\n public void process() {\n int numRows = ((VariableInteger)A).value;\n int numCols = ((VariableInteger)B).value;\n output.matrix.reshape(numRows,numCols);\n CommonOps_DDRM.fill(output.matrix, 1);\n }\n };\n } else {\n throw new RuntimeException(\"Expected two integers got \"+A+\" \"+B);\n }\n\n return ret;\n }",
"private static String qualifiedName(Options opt, String r) {\n\tif (opt.hideGenerics)\n\t r = removeTemplate(r);\n\t// Fast path - nothing to do:\n\tif (opt.showQualified && (opt.showQualifiedGenerics || r.indexOf('<') < 0))\n\t return r;\n\tStringBuilder buf = new StringBuilder(r.length());\n\tqualifiedNameInner(opt, r, buf, 0, !opt.showQualified);\n\treturn buf.toString();\n }",
"private ValidationResult _mergeListInternalForKey(String key, JSONArray left,\n JSONArray right, boolean remove, ValidationResult vr) {\n\n if (left == null) {\n vr.setObject(null);\n return vr;\n }\n\n if (right == null) {\n vr.setObject(left);\n return vr;\n }\n\n int maxValNum = Constants.MAX_MULTI_VALUE_ARRAY_LENGTH;\n\n JSONArray mergedList = new JSONArray();\n\n HashSet<String> set = new HashSet<>();\n\n int lsize = left.length(), rsize = right.length();\n\n BitSet dupSetForAdd = null;\n\n if (!remove)\n dupSetForAdd = new BitSet(lsize + rsize);\n\n int lidx = 0;\n\n int ridx = scan(right, set, dupSetForAdd, lsize);\n\n if (!remove && set.size() < maxValNum) {\n lidx = scan(left, set, dupSetForAdd, 0);\n }\n\n for (int i = lidx; i < lsize; i++) {\n try {\n if (remove) {\n String _j = (String) left.get(i);\n\n if (!set.contains(_j)) {\n mergedList.put(_j);\n }\n } else if (!dupSetForAdd.get(i)) {\n mergedList.put(left.get(i));\n }\n\n } catch (Throwable t) {\n //no-op\n }\n }\n\n if (!remove && mergedList.length() < maxValNum) {\n\n for (int i = ridx; i < rsize; i++) {\n\n try {\n if (!dupSetForAdd.get(i + lsize)) {\n mergedList.put(right.get(i));\n }\n } catch (Throwable t) {\n //no-op\n }\n }\n }\n\n // check to see if the list got trimmed in the merge\n if (ridx > 0 || lidx > 0) {\n vr.setErrorDesc(\"Multi value property for key \" + key + \" exceeds the limit of \" + maxValNum + \" items. Trimmed\");\n vr.setErrorCode(521);\n }\n\n vr.setObject(mergedList);\n\n return vr;\n }"
] |
Stop a managed server. | [
"synchronized void stop(Integer timeout) {\n final InternalState required = this.requiredState;\n if(required != InternalState.STOPPED) {\n this.requiredState = InternalState.STOPPED;\n ROOT_LOGGER.stoppingServer(serverName);\n // Only send the stop operation if the server is started\n if (internalState == InternalState.SERVER_STARTED) {\n internalSetState(new ServerStopTask(timeout), internalState, InternalState.PROCESS_STOPPING);\n } else {\n transition(false);\n }\n }\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 }",
"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 static void openLogFile(String logPath) {\n\t\tif (logPath == null) {\n\t\t\tprintStream = System.out;\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tprintStream = new PrintStream(new File(logPath));\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\tthrow new IllegalArgumentException(\"Log file \" + logPath + \" was not found\", e);\n\t\t\t}\n\t\t}\n\t}",
"private final boolean parseBoolean(String value)\n {\n return value != null && (value.equalsIgnoreCase(\"true\") || value.equalsIgnoreCase(\"y\") || value.equalsIgnoreCase(\"yes\"));\n }",
"public void applyTo(Context ctx, GradientDrawable drawable) {\n if (mColorInt != 0) {\n drawable.setColor(mColorInt);\n } else if (mColorRes != -1) {\n drawable.setColor(ContextCompat.getColor(ctx, mColorRes));\n }\n }",
"public int expect(String pattern) throws MalformedPatternException, Exception {\n logger.trace(\"Searching for '\" + pattern + \"' in the reader stream\");\n return expect(pattern, null);\n }",
"public StateVertex crawlIndex() {\n\t\tLOG.debug(\"Setting up vertex of the index page\");\n\n\t\tif (basicAuthUrl != null) {\n\t\t\tbrowser.goToUrl(basicAuthUrl);\n\t\t}\n\n\t\tbrowser.goToUrl(url);\n\n\t\t// Run url first load plugin to clear the application state\n\t\tplugins.runOnUrlFirstLoadPlugins(context);\n\n\t\tplugins.runOnUrlLoadPlugins(context);\n\t\tStateVertex index = vertexFactory.createIndex(url.toString(), browser.getStrippedDom(),\n\t\t\t\tstateComparator.getStrippedDom(browser), browser);\n\t\tPreconditions.checkArgument(index.getId() == StateVertex.INDEX_ID,\n\t\t\t\t\"It seems some the index state is crawled more than once.\");\n\n\t\tLOG.debug(\"Parsing the index for candidate elements\");\n\t\tImmutableList<CandidateElement> extract = candidateExtractor.extract(index);\n\n\t\tplugins.runPreStateCrawlingPlugins(context, extract, index);\n\n\t\tcandidateActionCache.addActions(extract, index);\n\n\t\treturn index;\n\n\t}",
"public Integer getOverrideIdForMethod(String className, String methodName) {\n Integer overrideId = null;\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_OVERRIDE +\n \" WHERE \" + Constants.OVERRIDE_CLASS_NAME + \" = ?\" +\n \" AND \" + Constants.OVERRIDE_METHOD_NAME + \" = ?\"\n );\n query.setString(1, className);\n query.setString(2, methodName);\n results = query.executeQuery();\n\n if (results.next()) {\n overrideId = results.getInt(Constants.GENERIC_ID);\n }\n } catch (SQLException e) {\n e.printStackTrace();\n return null;\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 return overrideId;\n }",
"public static base_response save(nitro_service client, cacheobject resource) throws Exception {\n\t\tcacheobject saveresource = new cacheobject();\n\t\tsaveresource.locator = resource.locator;\n\t\treturn saveresource.perform_operation(client,\"save\");\n\t}"
] |
Utility function that pauses and asks for confirmation on dangerous
operations.
@param confirm User has already confirmed in command-line input
@param opDesc Description of the dangerous operation
@throws IOException
@return True if user confirms the operation in either command-line input
or here. | [
"public static Boolean askConfirm(Boolean confirm, String opDesc) throws IOException {\n if(confirm) {\n System.out.println(\"Confirmed \" + opDesc + \" in command-line.\");\n return true;\n } else {\n System.out.println(\"Are you sure you want to \" + opDesc + \"? (yes/no)\");\n BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));\n String text = buffer.readLine().toLowerCase(Locale.ENGLISH);\n boolean go = text.equals(\"yes\") || text.equals(\"y\");\n if (!go) {\n System.out.println(\"Did not confirm; \" + opDesc + \" aborted.\");\n }\n return go;\n }\n }"
] | [
"private void setRequestLanguages(WbGetEntitiesActionData properties) {\n\t\tif (this.filter.excludeAllLanguages()\n\t\t\t\t|| this.filter.getLanguageFilter() == null) {\n\t\t\treturn;\n\t\t}\n\t\tproperties.languages = ApiConnection.implodeObjects(this.filter\n\t\t\t\t.getLanguageFilter());\n\t}",
"private String escapeAndJoin(String[] commandline) {\n // TODO: we should try to escape special characters here, depending on the OS.\n StringBuilder b = new StringBuilder();\n Pattern specials = Pattern.compile(\"[\\\\ ]\");\n for (String arg : commandline) {\n if (b.length() > 0) {\n b.append(\" \");\n }\n\n if (specials.matcher(arg).find()) {\n b.append('\"').append(arg).append('\"');\n } else {\n b.append(arg);\n }\n }\n return b.toString();\n }",
"private List<Row> createTimeEntryRowList(String shiftData) throws ParseException\n {\n List<Row> list = new ArrayList<Row>();\n String[] shifts = shiftData.split(\",|:\");\n int index = 1;\n while (index < shifts.length)\n {\n index += 2;\n int entryCount = Integer.parseInt(shifts[index]);\n index++;\n\n for (int entryIndex = 0; entryIndex < entryCount; entryIndex++)\n {\n Integer exceptionTypeID = Integer.valueOf(shifts[index + 0]);\n Date startTime = DatatypeConverter.parseBasicTime(shifts[index + 1]);\n Date endTime = DatatypeConverter.parseBasicTime(shifts[index + 2]);\n\n Map<String, Object> map = new HashMap<String, Object>();\n map.put(\"START_TIME\", startTime);\n map.put(\"END_TIME\", endTime);\n map.put(\"EXCEPTIOP\", exceptionTypeID);\n\n list.add(new MapRow(map));\n\n index += 3;\n }\n }\n\n return list;\n }",
"@NonNull\n @SuppressWarnings({\"WeakerAccess\", \"unused\"}) // For library users\n public Searcher reset() {\n lastResponsePage = 0;\n lastRequestPage = 0;\n lastResponseId = 0;\n endReached = false;\n clearFacetRefinements();\n cancelPendingRequests();\n numericRefinements.clear();\n return this;\n }",
"public Object lookup(String name) throws ObjectNameNotFoundException\r\n {\r\n /**\r\n * Is DB open? ODMG 3.0 says it has to be to call bind.\r\n */\r\n if (!this.isOpen())\r\n {\r\n throw new DatabaseClosedException(\"Database is not open. Must have an open DB to call lookup\");\r\n }\r\n /**\r\n * Is Tx open? ODMG 3.0 says it has to be to call bind.\r\n */\r\n TransactionImpl tx = getTransaction();\r\n if (tx == null || !tx.isOpen())\r\n {\r\n throw new TransactionNotInProgressException(\"Tx is not open. Must have an open TX to call lookup.\");\r\n }\r\n\r\n return tx.getNamedRootsMap().lookup(name);\r\n }",
"public static final BigInteger printEarnedValueMethod(EarnedValueMethod value)\n {\n return (value == null ? BigInteger.valueOf(EarnedValueMethod.PERCENT_COMPLETE.getValue()) : BigInteger.valueOf(value.getValue()));\n }",
"public static dnsview[] get(nitro_service service, String viewname[]) throws Exception{\n\t\tif (viewname !=null && viewname.length>0) {\n\t\t\tdnsview response[] = new dnsview[viewname.length];\n\t\t\tdnsview obj[] = new dnsview[viewname.length];\n\t\t\tfor (int i=0;i<viewname.length;i++) {\n\t\t\t\tobj[i] = new dnsview();\n\t\t\t\tobj[i].set_viewname(viewname[i]);\n\t\t\t\tresponse[i] = (dnsview) obj[i].get_resource(service);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t\treturn null;\n\t}",
"private void ensureReferencedPKs(ModelDef modelDef, CollectionDescriptorDef collDef) throws ConstraintException\r\n {\r\n String elementClassName = collDef.getProperty(PropertyHelper.OJB_PROPERTY_ELEMENT_CLASS_REF);\r\n ClassDescriptorDef elementClassDef = modelDef.getClass(elementClassName);\r\n String indirTable = collDef.getProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE);\r\n String localKey = collDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY);\r\n String remoteKey = collDef.getProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY);\r\n boolean hasRemoteKey = remoteKey != null;\r\n ArrayList fittingCollections = new ArrayList();\r\n\r\n // we're checking for the fitting remote collection(s) and also\r\n // use their foreignkey as remote-foreignkey in the original collection definition\r\n for (Iterator it = elementClassDef.getAllExtentClasses(); it.hasNext();)\r\n {\r\n ClassDescriptorDef subTypeDef = (ClassDescriptorDef)it.next();\r\n\r\n // find the collection in the element class that has the same indirection table\r\n for (Iterator collIt = subTypeDef.getCollections(); collIt.hasNext();)\r\n {\r\n CollectionDescriptorDef curCollDef = (CollectionDescriptorDef)collIt.next();\r\n\r\n if (indirTable.equals(curCollDef.getProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE)) &&\r\n (collDef != curCollDef) &&\r\n (!hasRemoteKey || CommaListIterator.sameLists(remoteKey, curCollDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY))) &&\r\n (!curCollDef.hasProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY) ||\r\n CommaListIterator.sameLists(localKey, curCollDef.getProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY))))\r\n {\r\n fittingCollections.add(curCollDef);\r\n }\r\n }\r\n }\r\n if (!fittingCollections.isEmpty())\r\n {\r\n // if there is more than one, check that they match, i.e. that they all have the same foreignkeys\r\n if (!hasRemoteKey && (fittingCollections.size() > 1))\r\n {\r\n CollectionDescriptorDef firstCollDef = (CollectionDescriptorDef)fittingCollections.get(0);\r\n String foreignKey = firstCollDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY);\r\n\r\n for (int idx = 1; idx < fittingCollections.size(); idx++)\r\n {\r\n CollectionDescriptorDef curCollDef = (CollectionDescriptorDef)fittingCollections.get(idx);\r\n\r\n if (!CommaListIterator.sameLists(foreignKey, curCollDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY)))\r\n {\r\n throw new ConstraintException(\"Cannot determine the element-side collection that corresponds to the collection \"+\r\n collDef.getName()+\" in type \"+collDef.getOwner().getName()+\r\n \" because there are at least two different collections that would fit.\"+\r\n \" Specifying remote-foreignkey in the original collection \"+collDef.getName()+\r\n \" will perhaps help\");\r\n }\r\n }\r\n // store the found keys at the collections\r\n collDef.setProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY, foreignKey);\r\n for (int idx = 0; idx < fittingCollections.size(); idx++)\r\n {\r\n CollectionDescriptorDef curCollDef = (CollectionDescriptorDef)fittingCollections.get(idx);\r\n\r\n curCollDef.setProperty(PropertyHelper.OJB_PROPERTY_REMOTE_FOREIGNKEY, localKey);\r\n }\r\n }\r\n }\r\n\r\n // copy subclass pk fields into target class (if not already present)\r\n ensurePKsFromHierarchy(elementClassDef);\r\n }",
"public SubReportBuilder setParameterMapPath(String path) {\r\n\t\tsubreport.setParametersExpression(path);\r\n\t\tsubreport.setParametersMapOrigin(DJConstants.SUBREPORT_PARAMETER_MAP_ORIGIN_PARAMETER);\r\n\t\treturn this;\r\n\t}"
] |
Retrieve the frequency of an exception.
@param exception XML calendar exception
@return frequency | [
"private Integer getFrequency(Project.Calendars.Calendar.Exceptions.Exception exception)\n {\n Integer period = NumberHelper.getInteger(exception.getPeriod());\n if (period == null)\n {\n period = Integer.valueOf(1);\n }\n return period;\n }"
] | [
"public void release(Contextual<T> contextual, T instance) {\n synchronized (dependentInstances) {\n for (ContextualInstance<?> dependentInstance : dependentInstances) {\n // do not destroy contextual again, since it's just being destroyed\n if (contextual == null || !(dependentInstance.getContextual().equals(contextual))) {\n destroy(dependentInstance);\n }\n }\n }\n if (resourceReferences != null) {\n for (ResourceReference<?> reference : resourceReferences) {\n reference.release();\n }\n }\n }",
"public static boolean isListLiteralWithOnlyConstantValues(Expression expression) {\r\n if (expression instanceof ListExpression) {\r\n List<Expression> expressions = ((ListExpression) expression).getExpressions();\r\n for (Expression e : expressions) {\r\n if (!isConstantOrConstantLiteral(e)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n return false;\r\n }",
"private void deriveProjectCalendar()\n {\n //\n // Count the number of times each calendar is used\n //\n Map<ProjectCalendar, Integer> map = new HashMap<ProjectCalendar, Integer>();\n for (Task task : m_project.getTasks())\n {\n ProjectCalendar calendar = task.getCalendar();\n Integer count = map.get(calendar);\n if (count == null)\n {\n count = Integer.valueOf(1);\n }\n else\n {\n count = Integer.valueOf(count.intValue() + 1);\n }\n map.put(calendar, count);\n }\n\n //\n // Find the most frequently used calendar\n //\n int maxCount = 0;\n ProjectCalendar defaultCalendar = null;\n\n for (Entry<ProjectCalendar, Integer> entry : map.entrySet())\n {\n if (entry.getValue().intValue() > maxCount)\n {\n maxCount = entry.getValue().intValue();\n defaultCalendar = entry.getKey();\n }\n }\n\n //\n // Set the default calendar for the project\n // and remove it's use as a task-specific calendar.\n //\n if (defaultCalendar != null)\n {\n m_project.setDefaultCalendar(defaultCalendar);\n for (Task task : m_project.getTasks())\n {\n if (task.getCalendar() == defaultCalendar)\n {\n task.setCalendar(null);\n }\n }\n }\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}",
"final public void addPositionRange(int start, int end) {\n if (tokenPosition == null) {\n tokenPosition = new MtasPosition(start, end);\n } else {\n int[] positions = new int[end - start + 1];\n for (int i = start; i <= end; i++) {\n positions[i - start] = i;\n }\n tokenPosition.add(positions);\n }\n }",
"public boolean hasNullPKField(ClassDescriptor cld, Object obj)\r\n {\r\n FieldDescriptor[] fields = cld.getPkFields();\r\n boolean hasNull = false;\r\n // an unmaterialized proxy object can never have nullified PK's\r\n IndirectionHandler handler = ProxyHelper.getIndirectionHandler(obj);\r\n if(handler == null || handler.alreadyMaterialized())\r\n {\r\n if(handler != null) obj = handler.getRealSubject();\r\n FieldDescriptor fld;\r\n for(int i = 0; i < fields.length; i++)\r\n {\r\n fld = fields[i];\r\n hasNull = representsNull(fld, fld.getPersistentField().get(obj));\r\n if(hasNull) break;\r\n }\r\n }\r\n return hasNull;\r\n }",
"private List<String> getMavenModules(MavenModuleSetBuild mavenBuild) throws IOException, InterruptedException {\n FilePath pathToModuleRoot = mavenBuild.getModuleRoot();\n FilePath pathToPom = new FilePath(pathToModuleRoot, mavenBuild.getProject().getRootPOM(null));\n return pathToPom.act(new MavenModulesExtractor());\n }",
"@SuppressWarnings(\"unchecked\")\n public T toObject(byte[] bytes) {\n try {\n return (T) new ObjectInputStream(new ByteArrayInputStream(bytes)).readObject();\n } catch(IOException e) {\n throw new SerializationException(e);\n } catch(ClassNotFoundException c) {\n throw new SerializationException(c);\n }\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}"
] |
Sets the size of a UIObject | [
"public static final void setSize(UIObject o, Rect size) {\n o.setPixelSize(size.w, size.h);\n\n }"
] | [
"public static Color cueColor(CueList.Entry entry) {\n if (entry.hotCueNumber > 0) {\n return Color.GREEN;\n }\n if (entry.isLoop) {\n return Color.ORANGE;\n }\n return Color.RED;\n }",
"private int bestSurroundingSet(int index, int length, int... valid) {\r\n int option1 = set[index - 1];\r\n if (index + 1 < length) {\r\n // we have two options to check\r\n int option2 = set[index + 1];\r\n if (contains(valid, option1) && contains(valid, option2)) {\r\n return Math.min(option1, option2);\r\n } else if (contains(valid, option1)) {\r\n return option1;\r\n } else if (contains(valid, option2)) {\r\n return option2;\r\n } else {\r\n return valid[0];\r\n }\r\n } else {\r\n // we only have one option to check\r\n if (contains(valid, option1)) {\r\n return option1;\r\n } else {\r\n return valid[0];\r\n }\r\n }\r\n }",
"private void configureConfigurationSelector() {\n\n if (m_checkinBean.getConfigurations().size() < 2) {\n // Do not show the configuration selection at all.\n removeComponent(m_configurationSelectionPanel);\n } else {\n for (CmsGitConfiguration configuration : m_checkinBean.getConfigurations()) {\n m_configurationSelector.addItem(configuration);\n m_configurationSelector.setItemCaption(configuration, configuration.getName());\n }\n m_configurationSelector.setNullSelectionAllowed(false);\n m_configurationSelector.setNewItemsAllowed(false);\n m_configurationSelector.setWidth(\"350px\");\n m_configurationSelector.select(m_checkinBean.getCurrentConfiguration());\n\n // There is really a choice between configurations\n m_configurationSelector.addValueChangeListener(new ValueChangeListener() {\n\n private static final long serialVersionUID = 1L;\n\n @SuppressWarnings(\"synthetic-access\")\n public void valueChange(ValueChangeEvent event) {\n\n updateForNewConfiguration((CmsGitConfiguration)event.getProperty().getValue());\n restoreFieldsFromUserInfo();\n\n }\n });\n }\n }",
"private String stripLineBreaks(String text, String replacement)\n {\n if (text.indexOf('\\r') != -1 || text.indexOf('\\n') != -1)\n {\n StringBuilder sb = new StringBuilder(text);\n\n int index;\n\n while ((index = sb.indexOf(\"\\r\\n\")) != -1)\n {\n sb.replace(index, index + 2, replacement);\n }\n\n while ((index = sb.indexOf(\"\\n\\r\")) != -1)\n {\n sb.replace(index, index + 2, replacement);\n }\n\n while ((index = sb.indexOf(\"\\r\")) != -1)\n {\n sb.replace(index, index + 1, replacement);\n }\n\n while ((index = sb.indexOf(\"\\n\")) != -1)\n {\n sb.replace(index, index + 1, replacement);\n }\n\n text = sb.toString();\n }\n\n return (text);\n }",
"private void setCalendarToOrdinalRelativeDay(Calendar calendar, int dayNumber)\n {\n int currentDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);\n int requiredDayOfWeek = getDayOfWeek().getValue();\n int dayOfWeekOffset = 0;\n if (requiredDayOfWeek > currentDayOfWeek)\n {\n dayOfWeekOffset = requiredDayOfWeek - currentDayOfWeek;\n }\n else\n {\n if (requiredDayOfWeek < currentDayOfWeek)\n {\n dayOfWeekOffset = 7 - (currentDayOfWeek - requiredDayOfWeek);\n }\n }\n\n if (dayOfWeekOffset != 0)\n {\n calendar.add(Calendar.DAY_OF_YEAR, dayOfWeekOffset);\n }\n\n if (dayNumber > 1)\n {\n calendar.add(Calendar.DAY_OF_YEAR, (7 * (dayNumber - 1)));\n }\n }",
"public static <T extends Annotation> List<T> searchForAnnotation(Method method, Class<T> annotation) {\n if (method == null) {\n return Lists.newArrayList();\n }\n return searchClasses(method, annotation, method.getDeclaringClass());\n }",
"@RequestMapping(value = \"/api/scripts\", method = RequestMethod.GET)\n public\n @ResponseBody\n HashMap<String, Object> getScripts(Model model,\n @RequestParam(required = false) Integer type) throws Exception {\n Script[] scripts = ScriptService.getInstance().getScripts(type);\n return Utils.getJQGridJSON(scripts, \"scripts\");\n }",
"public ParallelTaskBuilder prepareSsh() {\n reinitIfClosed();\n ParallelTaskBuilder cb = new ParallelTaskBuilder();\n cb.setProtocol(RequestProtocol.SSH);\n return cb;\n }",
"public void sortIndices(SortCoupledArray_F64 sorter ) {\n if( sorter == null )\n sorter = new SortCoupledArray_F64();\n\n sorter.quick(col_idx,numCols+1,nz_rows,nz_values);\n indicesSorted = true;\n }"
] |
Serialize an object with Json
@param obj Object
@return String
@throws IOException | [
"public static String serialize(final Object obj) throws IOException {\n\t\tfinal ObjectMapper mapper = new ObjectMapper();\n mapper.disable(MapperFeature.USE_GETTERS_AS_SETTERS);\n\t\treturn mapper.writeValueAsString(obj);\n\t\t\n\t}"
] | [
"public static base_response update(nitro_service client, snmpmanager resource) throws Exception {\n\t\tsnmpmanager updateresource = new snmpmanager();\n\t\tupdateresource.ipaddress = resource.ipaddress;\n\t\tupdateresource.netmask = resource.netmask;\n\t\tupdateresource.domainresolveretry = resource.domainresolveretry;\n\t\treturn updateresource.update_resource(client);\n\t}",
"public String getMethodSignature() {\n if (method != null) {\n String methodSignature = method.toString();\n return methodSignature.replaceFirst(\"public void \", \"\");\n }\n return null;\n }",
"public static filterhtmlinjectionparameter get(nitro_service service, options option) throws Exception{\n\t\tfilterhtmlinjectionparameter obj = new filterhtmlinjectionparameter();\n\t\tfilterhtmlinjectionparameter[] response = (filterhtmlinjectionparameter[])obj.get_resources(service,option);\n\t\treturn response[0];\n\t}",
"public Map<Integer, Row> createWorkPatternMap(List<Row> rows)\n {\n Map<Integer, Row> map = new HashMap<Integer, Row>();\n for (Row row : rows)\n {\n map.put(row.getInteger(\"WORK_PATTERNID\"), row);\n }\n return map;\n }",
"public void increasePriority(int overrideId, int ordinal, int pathId, String clientUUID) {\n logger.info(\"Increase priority\");\n\n int origPriority = -1;\n int newPriority = -1;\n int origId = 0;\n int newId = 0;\n\n PreparedStatement statement = null;\n ResultSet results = null;\n try (Connection sqlConnection = sqlService.getConnection()) {\n results = null;\n statement = sqlConnection.prepareStatement(\n \"SELECT * FROM \" + Constants.DB_TABLE_ENABLED_OVERRIDE +\n \" WHERE \" + Constants.ENABLED_OVERRIDES_PATH_ID + \" = ?\" +\n \" AND \" + Constants.GENERIC_CLIENT_UUID + \" = ?\" +\n \" ORDER BY \" + Constants.ENABLED_OVERRIDES_PRIORITY\n );\n statement.setInt(1, pathId);\n statement.setString(2, clientUUID);\n results = statement.executeQuery();\n\n int ordinalCount = 0;\n while (results.next()) {\n if (results.getInt(Constants.ENABLED_OVERRIDES_OVERRIDE_ID) == overrideId) {\n ordinalCount++;\n if (ordinalCount == ordinal) {\n origPriority = results.getInt(Constants.ENABLED_OVERRIDES_PRIORITY);\n origId = results.getInt(Constants.GENERIC_ID);\n break;\n }\n }\n newPriority = results.getInt(Constants.ENABLED_OVERRIDES_PRIORITY);\n newId = results.getInt(Constants.GENERIC_ID);\n }\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n try {\n if (results != null) {\n results.close();\n }\n } catch (Exception e) {\n }\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n // update priorities\n if (origPriority != -1 && newPriority != -1) {\n statement = sqlConnection.prepareStatement(\n \"UPDATE \" + Constants.DB_TABLE_ENABLED_OVERRIDE +\n \" SET \" + Constants.ENABLED_OVERRIDES_PRIORITY + \"=?\" +\n \" WHERE \" + Constants.GENERIC_ID + \"=?\"\n );\n statement.setInt(1, origPriority);\n statement.setInt(2, newId);\n statement.executeUpdate();\n statement.close();\n\n statement = sqlConnection.prepareStatement(\n \"UPDATE \" + Constants.DB_TABLE_ENABLED_OVERRIDE +\n \" SET \" + Constants.ENABLED_OVERRIDES_PRIORITY + \"=?\" +\n \" WHERE \" + Constants.GENERIC_ID + \"=?\"\n );\n statement.setInt(1, newPriority);\n statement.setInt(2, origId);\n statement.executeUpdate();\n }\n } catch (Exception e) {\n } finally {\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n }",
"public List depthFirst() {\n List answer = new NodeList();\n answer.add(this);\n answer.addAll(depthFirstRest());\n return answer;\n }",
"@Override\r\n public void close() {\r\n // Use monitor to avoid race between external close and handler thread run()\r\n synchronized (closeMonitor) {\r\n // Close and clear streams, sockets etc.\r\n if (socket != null) {\r\n try {\r\n // Terminates thread blocking on socket read\r\n // and automatically closed depending streams\r\n socket.close();\r\n } catch (IOException e) {\r\n log.warn(\"Can not close socket\", e);\r\n } finally {\r\n socket = null;\r\n }\r\n }\r\n\r\n // Clear user data\r\n session = null;\r\n response = null;\r\n }\r\n }",
"private String getParentWBS(String wbs)\n {\n String result;\n int index = wbs.lastIndexOf('.');\n if (index == -1)\n {\n result = null;\n }\n else\n {\n result = wbs.substring(0, index);\n }\n return result;\n }",
"public String getTexCoordShaderVar(String texName)\n {\n GVRTexture tex = textures.get(texName);\n if (tex != null)\n {\n return tex.getTexCoordShaderVar();\n }\n return null;\n }"
] |
Get the context for a photo in the group pool.
This method does not require authentication.
@param photoId
The photo ID
@param groupId
The group ID
@return The PhotoContext
@throws FlickrException | [
"public PhotoContext getContext(String photoId, String groupId) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_CONTEXT);\r\n\r\n parameters.put(\"photo_id\", photoId);\r\n parameters.put(\"group_id\", groupId);\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 Collection<Element> payload = response.getPayloadCollection();\r\n PhotoContext photoContext = new PhotoContext();\r\n for (Element element : payload) {\r\n String elementName = element.getTagName();\r\n if (elementName.equals(\"prevphoto\")) {\r\n Photo photo = new Photo();\r\n photo.setId(element.getAttribute(\"id\"));\r\n photoContext.setPreviousPhoto(photo);\r\n } else if (elementName.equals(\"nextphoto\")) {\r\n Photo photo = new Photo();\r\n photo.setId(element.getAttribute(\"id\"));\r\n photoContext.setNextPhoto(photo);\r\n } else if (!elementName.equals(\"count\")) {\r\n _log.warn(\"unsupported element name: \" + elementName);\r\n }\r\n }\r\n return photoContext;\r\n }"
] | [
"public boolean needMerge(@NotNull final BasePage left, @NotNull final BasePage right) {\n final int leftSize = left.getSize();\n final int rightSize = right.getSize();\n return leftSize == 0 || rightSize == 0 ||\n leftSize + rightSize <= (((isDupTree(left) ? getDupPageMaxSize() : getPageMaxSize()) * 7) >> 3);\n }",
"public void loadPhysics(String filename, GVRScene scene) throws IOException\n {\n GVRPhysicsLoader.loadPhysicsFile(getGVRContext(), filename, true, scene);\n }",
"public ListActiveCoursesInAccountOptions searchTerm(String searchTerm) {\n if(searchTerm == null || searchTerm.length() < 3) {\n throw new IllegalArgumentException(\"Search term must be at least 3 characters\");\n }\n addSingleItem(\"search_term\", searchTerm);\n return this;\n }",
"private static int findNext(boolean reverse, int pos) {\n boolean backwards = IS_BACKWARDS_CHECKBOX.isSelected();\n backwards = backwards ? !reverse : reverse;\n\n String pattern = (String) FIND_FIELD.getSelectedItem();\n if (pattern != null && pattern.length() > 0) {\n try {\n Document doc = textComponent.getDocument();\n doc.getText(0, doc.getLength(), SEGMENT);\n }\n catch (Exception e) {\n // should NEVER reach here\n e.printStackTrace();\n }\n\n pos += textComponent.getSelectedText() == null ?\n (backwards ? -1 : 1) : 0;\n\n char first = backwards ?\n pattern.charAt(pattern.length() - 1) : pattern.charAt(0);\n char oppFirst = Character.isUpperCase(first) ?\n Character.toLowerCase(first) : Character.toUpperCase(first);\n int start = pos;\n boolean wrapped = WRAP_SEARCH_CHECKBOX.isSelected();\n int end = backwards ? 0 : SEGMENT.getEndIndex();\n pos += backwards ? -1 : 1;\n\n int length = textComponent.getDocument().getLength();\n if (pos > length) {\n pos = wrapped ? 0 : length;\n }\n\n boolean found = false;\n while (!found && (backwards ? pos > end : pos < end)) {\n found = !MATCH_CASE_CHECKBOX.isSelected() && SEGMENT.array[pos] == oppFirst;\n found = found ? found : SEGMENT.array[pos] == first;\n\n if (found) {\n pos += backwards ? -(pattern.length() - 1) : 0;\n for (int i = 0; found && i < pattern.length(); i++) {\n char c = pattern.charAt(i);\n found = SEGMENT.array[pos + i] == c;\n if (!MATCH_CASE_CHECKBOX.isSelected() && !found) {\n c = Character.isUpperCase(c) ?\n Character.toLowerCase(c) :\n Character.toUpperCase(c);\n found = SEGMENT.array[pos + i] == c;\n }\n }\n }\n\n if (!found) {\n pos += backwards ? -1 : 1;\n\n if (pos == end && wrapped) {\n pos = backwards ? SEGMENT.getEndIndex() : 0;\n end = start;\n wrapped = false;\n }\n }\n }\n pos = found ? pos : -1;\n }\n\n return pos;\n }",
"public String getURN() throws InvalidRegistrationContentException {\n if (parsedConfig==null || parsedConfig.urn==null || parsedConfig.urn.trim().isEmpty()) {\n throw new InvalidRegistrationContentException(\"Invalid registration config - failed to read mediator URN\");\n }\n return parsedConfig.urn;\n }",
"public void setHostName(String hostName) {\n if (hostName == null || hostName.contains(\":\")) {\n return;\n }\n ODO_HOST = hostName;\n BASE_URL = \"http://\" + ODO_HOST + \":\" + API_PORT + \"/\" + API_BASE + \"/\";\n }",
"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 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}",
"public List<SquigglyNode> parse(String filter) {\n filter = StringUtils.trim(filter);\n\n if (StringUtils.isEmpty(filter)) {\n return Collections.emptyList();\n }\n\n // get it from the cache if we can\n List<SquigglyNode> cachedNodes = CACHE.getIfPresent(filter);\n\n if (cachedNodes != null) {\n return cachedNodes;\n }\n\n\n SquigglyExpressionLexer lexer = ThrowingErrorListener.overwrite(new SquigglyExpressionLexer(new ANTLRInputStream(filter)));\n SquigglyExpressionParser parser = ThrowingErrorListener.overwrite(new SquigglyExpressionParser(new CommonTokenStream(lexer)));\n\n Visitor visitor = new Visitor();\n List<SquigglyNode> nodes = Collections.unmodifiableList(visitor.visit(parser.parse()));\n\n CACHE.put(filter, nodes);\n return nodes;\n }"
] |
Return as a string the tagged values associated with c
@param opt the Options used to guess font names
@param c the Doc entry to look for @tagvalue
@param prevterm the termination string for the previous element
@param term the termination character for each tagged value | [
"private void tagvalue(Options opt, Doc c) {\n\tTag tags[] = c.tags(\"tagvalue\");\n\tif (tags.length == 0)\n\t return;\n\t\n\tfor (Tag tag : tags) {\n\t String t[] = tokenize(tag.text());\n\t if (t.length != 2) {\n\t\tSystem.err.println(\"@tagvalue expects two fields: \" + tag.text());\n\t\tcontinue;\n\t }\n\t tableLine(Align.RIGHT, Font.TAG.wrap(opt, \"{\" + t[0] + \" = \" + t[1] + \"}\"));\n\t}\n }"
] | [
"public static String getAt(GString text, Range range) {\n return getAt(text.toString(), range);\n }",
"public static authenticationldappolicy_authenticationvserver_binding[] get(nitro_service service, String name) throws Exception{\n\t\tauthenticationldappolicy_authenticationvserver_binding obj = new authenticationldappolicy_authenticationvserver_binding();\n\t\tobj.set_name(name);\n\t\tauthenticationldappolicy_authenticationvserver_binding response[] = (authenticationldappolicy_authenticationvserver_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}",
"public static Date getDateFromConciseStr(String str) {\n\n Date d = null;\n if (str == null || str.isEmpty())\n return null;\n\n try {\n SimpleDateFormat sdf = new SimpleDateFormat(\"yyyyMMddHHmmssSSSZ\");\n\n d = sdf.parse(str);\n } catch (Exception ex) {\n logger.error(ex + \"Exception while converting string to date : \"\n + str);\n }\n\n return d;\n }",
"public static<Z> Function0<Z> lift(Func0<Z> f) {\n\treturn bridge.lift(f);\n }",
"public static List<String> parse(final String[] args, final Object... objs) throws IOException\n {\n final List<String> ret = Colls.list();\n\n final List<Arg> allArgs = Colls.list();\n final HashMap<String, Arg> shortArgs = new HashMap<String, Arg>();\n final HashMap<String, Arg> longArgs = new HashMap<String, Arg>();\n\n parseArgs(objs, allArgs, shortArgs, longArgs);\n\n for (int i = 0; i < args.length; i++)\n {\n final String s = args[i];\n\n final Arg a;\n\n if (s.startsWith(\"--\"))\n {\n a = longArgs.get(s.substring(2));\n if (a == null)\n {\n throw new IOException(\"Unknown switch: \" + s);\n }\n }\n else if (s.startsWith(\"-\"))\n {\n a = shortArgs.get(s.substring(1));\n if (a == null)\n {\n throw new IOException(\"Unknown switch: \" + s);\n }\n }\n else\n {\n a = null;\n ret.add(s);\n }\n\n if (a != null)\n {\n if (a.isSwitch)\n {\n a.setField(\"true\");\n }\n else\n {\n if (i + 1 >= args.length)\n {\n System.out.println(\"Missing parameter for: \" + s);\n }\n if (a.isCatchAll())\n {\n final List<String> ca = Colls.list();\n for (++i; i < args.length; ++i)\n {\n ca.add(args[i]);\n }\n a.setCatchAll(ca);\n }\n else\n {\n ++i;\n a.setField(args[i]);\n }\n }\n a.setPresent();\n }\n }\n\n for (final Arg a : allArgs)\n {\n if (!a.isOk())\n {\n throw new IOException(\"Missing mandatory argument: \" + a);\n }\n }\n\n return ret;\n }",
"final public void addOffset(Integer start, Integer end) {\n if (tokenOffset == null) {\n setOffset(start, end);\n } else if ((start == null) || (end == null)) {\n // do nothing\n } else if (start > end) {\n throw new IllegalArgumentException(\"Start offset after end offset\");\n } else {\n tokenOffset.add(start, end);\n }\n }",
"private static Iterable<String> splitAndOmitEmpty(final String str, final char splitChar) {\n return new Iterable<String>() {\n @Override\n public Iterator<String> iterator() {\n return new Iterator<String>() {\n\n int startIdx = 0;\n String next = null;\n\n @Override\n public boolean hasNext() {\n while (next == null && startIdx < str.length()) {\n int idx = str.indexOf(splitChar, startIdx);\n if (idx == startIdx) {\n // Omit empty string\n startIdx++;\n continue;\n }\n if (idx >= 0) {\n // Found the next part\n next = str.substring(startIdx, idx);\n startIdx = idx;\n } else {\n // The last part\n if (startIdx < str.length()) {\n next = str.substring(startIdx);\n startIdx = str.length();\n }\n break;\n }\n }\n return next != null;\n }\n\n @Override\n public String next() {\n if (hasNext()) {\n String next = this.next;\n this.next = null;\n return next;\n }\n throw new NoSuchElementException(\"No more element\");\n }\n\n @Override\n public void remove() {\n throw new UnsupportedOperationException(\"Remove not supported\");\n }\n };\n }\n };\n }",
"public static base_response delete(nitro_service client, String labelname) throws Exception {\n\t\tdnspolicylabel deleteresource = new dnspolicylabel();\n\t\tdeleteresource.labelname = labelname;\n\t\treturn deleteresource.delete_resource(client);\n\t}",
"public void writeTo(WritableByteChannel channel) throws IOException {\n for (ByteBuffer buffer : toDirectByteBuffers()) {\n channel.write(buffer);\n }\n }"
] |
Select this tab item. | [
"public void selectTab() {\n for (Widget child : getChildren()) {\n if (child instanceof HasHref) {\n String href = ((HasHref) child).getHref();\n if (parent != null && !href.isEmpty()) {\n parent.selectTab(href.replaceAll(\"[^a-zA-Z\\\\d\\\\s:]\", \"\"));\n parent.reload();\n break;\n }\n }\n }\n }"
] | [
"public void updateProvider(final String gavc, final String provider) {\n final DbArtifact artifact = getArtifact(gavc);\n repositoryHandler.updateProvider(artifact, provider);\n }",
"public static int positionOf(char value, char[] array) {\n for (int i = 0; i < array.length; i++) {\n if (value == array[i]) {\n return i;\n }\n }\n throw new OkapiException(\"Unable to find character '\" + value + \"' in character array.\");\n }",
"private String swapStore(String storeName, String directory) throws VoldemortException {\n\n ReadOnlyStorageEngine store = getReadOnlyStorageEngine(metadataStore,\n storeRepository,\n storeName);\n\n if(!Utils.isReadableDir(directory))\n throw new VoldemortException(\"Store directory '\" + directory\n + \"' is not a readable directory.\");\n\n String currentDirPath = store.getCurrentDirPath();\n\n logger.info(\"Swapping RO store '\" + storeName + \"' to version directory '\" + directory\n + \"'\");\n store.swapFiles(directory);\n logger.info(\"Swapping swapped RO store '\" + storeName + \"' to version directory '\"\n + directory + \"'\");\n\n return currentDirPath;\n }",
"public static int lengthOfCodePoint(int codePoint)\n {\n if (codePoint < 0) {\n throw new InvalidCodePointException(codePoint);\n }\n if (codePoint < 0x80) {\n // normal ASCII\n // 0xxx_xxxx\n return 1;\n }\n if (codePoint < 0x800) {\n return 2;\n }\n if (codePoint < 0x1_0000) {\n return 3;\n }\n if (codePoint < 0x11_0000) {\n return 4;\n }\n // Per RFC3629, UTF-8 is limited to 4 bytes, so more bytes are illegal\n throw new InvalidCodePointException(codePoint);\n }",
"public static ModelControllerClient createReceiving(final Channel channel, final ExecutorService executorService) {\n final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel);\n final ManagementChannelHandler handler = new ManagementChannelHandler(strategy, executorService);\n final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler);\n handler.addHandlerFactory(client);\n channel.addCloseHandler(new CloseHandler<Channel>() {\n @Override\n public void handleClose(Channel closed, IOException exception) {\n handler.shutdown();\n try {\n handler.awaitCompletion(1, TimeUnit.SECONDS);\n } catch (InterruptedException e) {\n Thread.currentThread().interrupt();\n } finally {\n handler.shutdownNow();\n }\n }\n });\n channel.receiveMessage(handler.getReceiver());\n return client;\n }",
"private void setPlaybackPosition(long milliseconds) {\n PlaybackState oldState = currentSimpleState();\n if (oldState != null && oldState.position != milliseconds) {\n setPlaybackState(oldState.player, milliseconds, oldState.playing);\n }\n }",
"public static nslimitselector get(nitro_service service, String selectorname) throws Exception{\n\t\tnslimitselector obj = new nslimitselector();\n\t\tobj.set_selectorname(selectorname);\n\t\tnslimitselector response = (nslimitselector) obj.get_resource(service);\n\t\treturn response;\n\t}",
"public void getDataDTD(Writer output) throws DataTaskException\r\n {\r\n try\r\n {\r\n output.write(\"<!ELEMENT dataset (\\n\");\r\n for (Iterator it = _preparedModel.getElementNames(); it.hasNext();)\r\n {\r\n String elementName = (String)it.next();\r\n\r\n output.write(\" \");\r\n output.write(elementName);\r\n output.write(\"*\");\r\n output.write(it.hasNext() ? \" |\\n\" : \"\\n\");\r\n }\r\n output.write(\")>\\n<!ATTLIST dataset\\n name CDATA #REQUIRED\\n>\\n\");\r\n for (Iterator it = _preparedModel.getElementNames(); it.hasNext();)\r\n {\r\n String elementName = (String)it.next();\r\n List classDescs = _preparedModel.getClassDescriptorsMappingTo(elementName);\r\n\r\n if (classDescs == null)\r\n {\r\n output.write(\"\\n<!-- Indirection table\");\r\n }\r\n else\r\n {\r\n output.write(\"\\n<!-- Mapped to : \");\r\n for (Iterator classDescIt = classDescs.iterator(); classDescIt.hasNext();)\r\n {\r\n ClassDescriptor classDesc = (ClassDescriptor)classDescIt.next();\r\n \r\n output.write(classDesc.getClassNameOfObject());\r\n if (classDescIt.hasNext())\r\n {\r\n output.write(\"\\n \");\r\n }\r\n }\r\n }\r\n output.write(\" -->\\n<!ELEMENT \");\r\n output.write(elementName);\r\n output.write(\" EMPTY>\\n<!ATTLIST \");\r\n output.write(elementName);\r\n output.write(\"\\n\");\r\n\r\n for (Iterator attrIt = _preparedModel.getAttributeNames(elementName); attrIt.hasNext();)\r\n {\r\n String attrName = (String)attrIt.next();\r\n\r\n output.write(\" \");\r\n output.write(attrName);\r\n output.write(\" CDATA #\");\r\n output.write(_preparedModel.isRequired(elementName, attrName) ? \"REQUIRED\" : \"IMPLIED\");\r\n output.write(\"\\n\");\r\n }\r\n output.write(\">\\n\");\r\n }\r\n }\r\n catch (IOException ex)\r\n {\r\n throw new DataTaskException(ex);\r\n }\r\n }",
"public static BoxLegalHoldAssignment.Info create(BoxAPIConnection api,\n String policyID, String resourceType, String resourceID) {\n URL url = ASSIGNMENTS_URL_TEMPLATE.build(api.getBaseURL());\n BoxJSONRequest request = new BoxJSONRequest(api, url, \"POST\");\n\n JsonObject requestJSON = new JsonObject()\n .add(\"policy_id\", policyID)\n .add(\"assign_to\", new JsonObject()\n .add(\"type\", resourceType)\n .add(\"id\", resourceID));\n request.setBody(requestJSON.toString());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n BoxLegalHoldAssignment createdAssignment = new BoxLegalHoldAssignment(api, responseJSON.get(\"id\").asString());\n return createdAssignment.new Info(responseJSON);\n }"
] |
Checks to see if every value in the matrix is the specified value.
@param mat The matrix being tested. Not modified.
@param val Checks to see if every element in the matrix has this value.
@param tol True if all the elements are within this tolerance.
@return true if the test passes. | [
"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 }"
] | [
"@Deprecated\r\n public Category browse(String catId) throws FlickrException {\r\n List<Subcategory> subcategories = new ArrayList<Subcategory>();\r\n List<Group> groups = new ArrayList<Group>();\r\n\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_BROWSE);\r\n\r\n if (catId != null) {\r\n parameters.put(\"cat_id\", catId);\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 categoryElement = response.getPayload();\r\n\r\n Category category = new Category();\r\n category.setName(categoryElement.getAttribute(\"name\"));\r\n category.setPath(categoryElement.getAttribute(\"path\"));\r\n category.setPathIds(categoryElement.getAttribute(\"pathids\"));\r\n\r\n NodeList subcatNodes = categoryElement.getElementsByTagName(\"subcat\");\r\n for (int i = 0; i < subcatNodes.getLength(); i++) {\r\n Element node = (Element) subcatNodes.item(i);\r\n Subcategory subcategory = new Subcategory();\r\n subcategory.setId(Integer.parseInt(node.getAttribute(\"id\")));\r\n subcategory.setName(node.getAttribute(\"name\"));\r\n subcategory.setCount(Integer.parseInt(node.getAttribute(\"count\")));\r\n\r\n subcategories.add(subcategory);\r\n }\r\n\r\n NodeList groupNodes = categoryElement.getElementsByTagName(\"group\");\r\n for (int i = 0; i < groupNodes.getLength(); i++) {\r\n Element node = (Element) groupNodes.item(i);\r\n Group group = new Group();\r\n group.setId(node.getAttribute(\"nsid\"));\r\n group.setName(node.getAttribute(\"name\"));\r\n group.setMembers(node.getAttribute(\"members\"));\r\n\r\n groups.add(group);\r\n }\r\n\r\n category.setGroups(groups);\r\n category.setSubcategories(subcategories);\r\n\r\n return category;\r\n }",
"public History[] refreshHistory(int limit, int offset) throws Exception {\n BasicNameValuePair[] params = {\n new BasicNameValuePair(\"limit\", String.valueOf(limit)),\n new BasicNameValuePair(\"offset\", String.valueOf(offset))\n };\n return constructHistory(params);\n }",
"private URL[] getClasspath(JobInstance ji, JobRunnerCallback cb) throws JqmPayloadException\n {\n switch (ji.getJD().getPathType())\n {\n case MAVEN:\n return mavenResolver.resolve(ji);\n case MEMORY:\n return new URL[0];\n case FS:\n default:\n return fsResolver.getLibraries(ji.getNode(), ji.getJD());\n }\n }",
"public PhotoList<Photo> getClusterPhotos(String tag, String clusterId) throws FlickrException {\n\n PhotoList<Photo> photos = new PhotoList<Photo>();\n Map<String, Object> parameters = new HashMap<String, Object>();\n parameters.put(\"method\", METHOD_GET_CLUSTER_PHOTOS);\n\n parameters.put(\"tag\", tag);\n parameters.put(\"cluster_id\", clusterId);\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 photosElement = response.getPayload();\n NodeList photoNodes = photosElement.getElementsByTagName(\"photo\");\n photos.setPage(\"1\");\n photos.setPages(\"1\");\n photos.setPerPage(\"\" + photoNodes.getLength());\n photos.setTotal(\"\" + photoNodes.getLength());\n for (int i = 0; i < photoNodes.getLength(); i++) {\n Element photoElement = (Element) photoNodes.item(i);\n photos.add(PhotoUtils.createPhoto(photoElement));\n }\n return photos;\n }",
"public JsonObject getJsonObject() {\n\n JsonObject obj = new JsonObject();\n obj.add(\"field\", this.field);\n\n obj.add(\"value\", this.value);\n\n return obj;\n }",
"@Override\n public void onRotationSensor(long timeStamp, float rotationW, float rotationX, float rotationY, float rotationZ,\n float gyroX, float gyroY, float gyroZ) {\n GVRCameraRig cameraRig = null;\n if (mMainScene != null) {\n cameraRig = mMainScene.getMainCameraRig();\n }\n\n if (cameraRig != null) {\n cameraRig.setRotationSensorData(timeStamp, rotationW, rotationX, rotationY, rotationZ, gyroX, gyroY, gyroZ);\n updateSensoredScene();\n }\n }",
"final void end() {\n final Thread thread = this.threadRef;\n this.keepRunning.set(false);\n if (thread != null) {\n // thread.interrupt();\n try {\n thread.join();\n } catch (InterruptedException e) {\n Thread.currentThread().interrupt();\n }\n }\n this.threadRef = null;\n }",
"private Properties mapToProperties(Map<String, String> map) {\r\n\t\t Properties p = new Properties();\r\n\t\t for (Map.Entry<String,String> entry : map.entrySet()) {\r\n\t\t p.put(entry.getKey(), entry.getValue());\r\n\t\t }\r\n\t\t return p;\r\n\t\t }",
"String getStatusHelp(CmsUser user, boolean disabled, boolean newUser) {\n\n if (disabled) {\n return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_DISABLED_HELP_0);\n }\n if (newUser) {\n return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_INACTIVE_HELP_0);\n }\n if (isUserPasswordReset(user)) {\n return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_PASSWORT_RESET_HELP_0);\n }\n long lastLogin = user.getLastlogin();\n return CmsVaadinUtils.getMessageText(\n Messages.GUI_USERMANAGEMENT_USER_ACTIVE_HELP_1,\n CmsDateUtil.getDateTime(new Date(lastLogin), DateFormat.SHORT, A_CmsUI.get().getLocale()));\n }"
] |
Sinc function.
@param x Value.
@return Sinc of the value. | [
"public static double Sinc(double x) {\r\n return Math.sin(Math.PI * x) / (Math.PI * x);\r\n }"
] | [
"private static void addVersionInfo(byte[] grid, int size, int version) {\n // TODO: Zint masks with 0x41 instead of 0x01; which is correct? https://sourceforge.net/p/zint/tickets/110/\n long version_data = QR_ANNEX_D[version - 7];\n for (int i = 0; i < 6; i++) {\n grid[((size - 11) * size) + i] += (version_data >> (i * 3)) & 0x01;\n grid[((size - 10) * size) + i] += (version_data >> ((i * 3) + 1)) & 0x01;\n grid[((size - 9) * size) + i] += (version_data >> ((i * 3) + 2)) & 0x01;\n grid[(i * size) + (size - 11)] += (version_data >> (i * 3)) & 0x01;\n grid[(i * size) + (size - 10)] += (version_data >> ((i * 3) + 1)) & 0x01;\n grid[(i * size) + (size - 9)] += (version_data >> ((i * 3) + 2)) & 0x01;\n }\n }",
"protected RollbackPatch createRollbackPatch(final String patchId, final Patch.PatchType patchType) {\n // Process elements\n final List<PatchElement> elements = new ArrayList<PatchElement>();\n // Process layers\n for (final PatchEntry entry : getLayers()) {\n final PatchElement element = createRollbackElement(entry);\n elements.add(element);\n }\n // Process add-ons\n for (final PatchEntry entry : getAddOns()) {\n final PatchElement element = createRollbackElement(entry);\n elements.add(element);\n }\n\n final InstalledIdentity installedIdentity = modification.getUnmodifiedInstallationState();\n final String name = installedIdentity.getIdentity().getName();\n final IdentityImpl identity = new IdentityImpl(name, modification.getVersion());\n if (patchType == Patch.PatchType.CUMULATIVE) {\n identity.setPatchType(Patch.PatchType.CUMULATIVE);\n identity.setResultingVersion(installedIdentity.getIdentity().getVersion());\n } else if (patchType == Patch.PatchType.ONE_OFF) {\n identity.setPatchType(Patch.PatchType.ONE_OFF);\n }\n final List<ContentModification> modifications = identityEntry.rollbackActions;\n final Patch delegate = new PatchImpl(patchId, \"rollback patch\", identity, elements, modifications);\n return new PatchImpl.RollbackPatchImpl(delegate, installedIdentity);\n }",
"public String get(final long index) {\n return doWithJedis(new JedisCallable<String>() {\n @Override\n public String call(Jedis jedis) {\n return jedis.lindex(getKey(), index);\n }\n });\n }",
"public static void addItemsHandled(String handledItemsType, int handledItemsNumber) {\n \tJobLogger jobLogger = (JobLogger) getInstance();\n if (jobLogger == null) {\n return;\n }\n\n jobLogger.addItemsHandledInstance(handledItemsType, handledItemsNumber);\n }",
"private void stream(InputStream is, File destFile) throws IOException {\n try {\n startProgress();\n OutputStream os = new FileOutputStream(destFile);\n \n boolean finished = false;\n try {\n byte[] buf = new byte[1024 * 10];\n int read;\n while ((read = is.read(buf)) >= 0) {\n os.write(buf, 0, read);\n processedBytes += read;\n logProgress();\n }\n \n os.flush();\n finished = true;\n } finally {\n os.close();\n if (!finished) {\n destFile.delete();\n }\n }\n } finally {\n is.close();\n completeProgress();\n }\n }",
"void buildControl(BinaryPackageControlFile packageControlFile, File[] controlFiles, List<String> conffiles, StringBuilder checksums, File output) throws IOException, ParseException {\n final File dir = output.getParentFile();\n if (dir != null && (!dir.exists() || !dir.isDirectory())) {\n throw new IOException(\"Cannot write control file at '\" + output.getAbsolutePath() + \"'\");\n }\n\n final TarArchiveOutputStream outputStream = new TarArchiveOutputStream(new GZIPOutputStream(new FileOutputStream(output)));\n outputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);\n\n boolean foundConffiles = false;\n\n // create the final package control file out of the \"control\" file, copy all other files, ignore the directories\n for (File file : controlFiles) {\n if (file.isDirectory()) {\n // warn about the misplaced directory, except for directories ignored by default (.svn, cvs, etc)\n if (!isDefaultExcludes(file)) {\n console.warn(\"Found directory '\" + file + \"' in the control directory. Maybe you are pointing to wrong dir?\");\n }\n continue;\n }\n\n if (\"conffiles\".equals(file.getName())) {\n foundConffiles = true;\n }\n\n if (CONFIGURATION_FILENAMES.contains(file.getName()) || MAINTAINER_SCRIPTS.contains(file.getName())) {\n FilteredFile configurationFile = new FilteredFile(new FileInputStream(file), resolver);\n configurationFile.setOpenToken(openReplaceToken);\n configurationFile.setCloseToken(closeReplaceToken);\n addControlEntry(file.getName(), configurationFile.toString(), outputStream);\n\n } else if (!\"control\".equals(file.getName())) {\n // initialize the information stream to guess the type of the file\n InformationInputStream infoStream = new InformationInputStream(new FileInputStream(file));\n Utils.copy(infoStream, NullOutputStream.NULL_OUTPUT_STREAM);\n infoStream.close();\n\n // fix line endings for shell scripts\n InputStream in = new FileInputStream(file);\n if (infoStream.isShell() && !infoStream.hasUnixLineEndings()) {\n byte[] buf = Utils.toUnixLineEndings(in);\n in = new ByteArrayInputStream(buf);\n }\n\n addControlEntry(file.getName(), IOUtils.toString(in), outputStream);\n\n in.close();\n }\n }\n\n if (foundConffiles) {\n console.info(\"Found file 'conffiles' in the control directory. Skipping conffiles generation.\");\n } else if ((conffiles != null) && (conffiles.size() > 0)) {\n addControlEntry(\"conffiles\", createPackageConffilesFile(conffiles), outputStream);\n } else {\n console.info(\"Skipping 'conffiles' generation. No entries defined in maven/pom or ant/build.xml.\");\n }\n\n if (packageControlFile == null) {\n throw new FileNotFoundException(\"No 'control' file found in \" + controlFiles.toString());\n }\n\n addControlEntry(\"control\", packageControlFile.toString(), outputStream);\n addControlEntry(\"md5sums\", checksums.toString(), outputStream);\n\n outputStream.close();\n }",
"public static Iterable<BoxUser.Info> getAppUsersByExternalAppUserID(final BoxAPIConnection api,\n final String externalAppUserId, final String... fields) {\n return getUsersInfoForType(api, null, null, externalAppUserId, fields);\n }",
"public static File copyResourceToLocalFile(String sourceResource, String destFileName) throws Exception {\n try {\n Resource keystoreFile = new ClassPathResource(sourceResource);\n InputStream in = keystoreFile.getInputStream();\n\n File outKeyStoreFile = new File(destFileName);\n FileOutputStream fop = new FileOutputStream(outKeyStoreFile);\n byte[] buf = new byte[512];\n int num;\n while ((num = in.read(buf)) != -1) {\n fop.write(buf, 0, num);\n }\n fop.flush();\n fop.close();\n in.close();\n return outKeyStoreFile;\n } catch (IOException ioe) {\n throw new Exception(\"Could not copy keystore file: \" + ioe.getMessage());\n }\n }",
"public byte[] getByteArray(Integer id, Integer type)\n {\n return (getByteArray(m_meta.getOffset(id, type)));\n }"
] |
Obtains a local date in Discordian calendar system from the
proleptic-year, month-of-year and day-of-month fields.
@param prolepticYear the proleptic-year
@param month the month-of-year
@param dayOfMonth the day-of-month
@return the Discordian local date, not null
@throws DateTimeException if unable to create the date | [
"@Override\n public DiscordianDate date(int prolepticYear, int month, int dayOfMonth) {\n return DiscordianDate.of(prolepticYear, month, dayOfMonth);\n }"
] | [
"public void deleteById(Object id) {\n\n int count = beginDelete().whereEquals(idColumn.getColumnName(), id).delete();\n\n if (count == 0) {\n throw new RowNotFoundException(table, id);\n }\n }",
"public static void addService(final ServiceTarget serviceTarget, final Bootstrap.Configuration configuration,\n final ControlledProcessState processState, final BootstrapListener bootstrapListener,\n final RunningModeControl runningModeControl, final AbstractVaultReader vaultReader, final ManagedAuditLogger auditLogger,\n final DelegatingConfigurableAuthorizer authorizer, final ManagementSecurityIdentitySupplier securityIdentitySupplier,\n final SuspendController suspendController) {\n\n // Install Executor services\n final ThreadGroup threadGroup = new ThreadGroup(\"ServerService ThreadGroup\");\n final String namePattern = \"ServerService Thread Pool -- %t\";\n final ThreadFactory threadFactory = doPrivileged(new PrivilegedAction<ThreadFactory>() {\n public ThreadFactory run() {\n return new JBossThreadFactory(threadGroup, Boolean.FALSE, null, namePattern, null, null);\n }\n });\n\n // TODO determine why QueuelessThreadPoolService makes boot take > 35 secs\n// final QueuelessThreadPoolService serverExecutorService = new QueuelessThreadPoolService(Integer.MAX_VALUE, false, new TimeSpec(TimeUnit.SECONDS, 5));\n// serverExecutorService.getThreadFactoryInjector().inject(threadFactory);\n final boolean forDomain = ProcessType.DOMAIN_SERVER == getProcessType(configuration.getServerEnvironment());\n final ServerExecutorService serverExecutorService = new ServerExecutorService(threadFactory, forDomain);\n serviceTarget.addService(MANAGEMENT_EXECUTOR, serverExecutorService)\n .addAliases(Services.JBOSS_SERVER_EXECUTOR, ManagementRemotingServices.SHUTDOWN_EXECUTOR_NAME) // Use this executor for mgmt shutdown for now\n .install();\n final ServerScheduledExecutorService serverScheduledExecutorService = new ServerScheduledExecutorService(threadFactory);\n serviceTarget.addService(JBOSS_SERVER_SCHEDULED_EXECUTOR, serverScheduledExecutorService)\n .addAliases(JBOSS_SERVER_SCHEDULED_EXECUTOR)\n .addDependency(MANAGEMENT_EXECUTOR, ExecutorService.class, serverScheduledExecutorService.executorInjector)\n .install();\n\n final CapabilityRegistry capabilityRegistry = configuration.getCapabilityRegistry();\n ServerService service = new ServerService(configuration, processState, null, bootstrapListener, new ServerDelegatingResourceDefinition(),\n runningModeControl, vaultReader, auditLogger, authorizer, securityIdentitySupplier, capabilityRegistry, suspendController);\n\n ExternalManagementRequestExecutor.install(serviceTarget, threadGroup, EXECUTOR_CAPABILITY.getCapabilityServiceName(), service.getStabilityMonitor());\n\n ServiceBuilder<?> serviceBuilder = serviceTarget.addService(Services.JBOSS_SERVER_CONTROLLER, service);\n serviceBuilder.addDependency(DeploymentMountProvider.SERVICE_NAME,DeploymentMountProvider.class, service.injectedDeploymentRepository);\n serviceBuilder.addDependency(ContentRepository.SERVICE_NAME, ContentRepository.class, service.injectedContentRepository);\n serviceBuilder.addDependency(Services.JBOSS_SERVICE_MODULE_LOADER, ServiceModuleLoader.class, service.injectedModuleLoader);\n serviceBuilder.addDependency(Services.JBOSS_EXTERNAL_MODULE_SERVICE, ExternalModuleService.class,\n service.injectedExternalModuleService);\n serviceBuilder.addDependency(PATH_MANAGER_CAPABILITY.getCapabilityServiceName(), PathManager.class, service.injectedPathManagerService);\n if (configuration.getServerEnvironment().isAllowModelControllerExecutor()) {\n serviceBuilder.addDependency(MANAGEMENT_EXECUTOR, ExecutorService.class, service.getExecutorServiceInjector());\n }\n if (configuration.getServerEnvironment().getLaunchType() == ServerEnvironment.LaunchType.DOMAIN) {\n serviceBuilder.addDependency(HostControllerConnectionService.SERVICE_NAME, ControllerInstabilityListener.class,\n service.getContainerInstabilityInjector());\n }\n\n serviceBuilder.install();\n }",
"public void runOnBrowserCreatedPlugins(EmbeddedBrowser newBrowser) {\n\t\tLOGGER.debug(\"Running OnBrowserCreatedPlugins...\");\n\t\tcounters.get(OnBrowserCreatedPlugin.class).inc();\n\t\tfor (Plugin plugin : plugins.get(OnBrowserCreatedPlugin.class)) {\n\t\t\tif (plugin instanceof OnBrowserCreatedPlugin) {\n\t\t\t\tLOGGER.debug(\"Calling plugin {}\", plugin);\n\t\t\t\ttry {\n\t\t\t\t\t((OnBrowserCreatedPlugin) plugin)\n\t\t\t\t\t\t\t.onBrowserCreated(newBrowser);\n\t\t\t\t} catch (RuntimeException e) {\n\t\t\t\t\treportFailingPlugin(plugin, e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"public ModelNode translateOperationForProxy(final ModelNode op) {\n return translateOperationForProxy(op, PathAddress.pathAddress(op.get(OP_ADDR)));\n }",
"private static void defineField(Map<String, FieldType> container, String name, FieldType type, String alias)\n {\n container.put(name, type);\n if (alias != null)\n {\n ALIASES.put(type, alias);\n }\n }",
"public AT_Row setPaddingLeft(int paddingLeft) {\r\n\t\tif(this.hasCells()){\r\n\t\t\tfor(AT_Cell cell : this.getCells()){\r\n\t\t\t\tcell.getContext().setPaddingLeft(paddingLeft);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}",
"@SuppressWarnings({\"unused\", \"WeakerAccess\"})\n public static void changeCredentials(String accountID, String token, String region) {\n if(defaultConfig != null){\n Logger.i(\"CleverTap SDK already initialized with accountID:\"+defaultConfig.getAccountId()\n +\" and token:\"+defaultConfig.getAccountToken()+\". Cannot change credentials to \"\n + accountID + \" and \" + token);\n return;\n }\n\n ManifestInfo.changeCredentials(accountID,token,region);\n }",
"MongoCollection<BsonDocument> getLocalCollection(final MongoNamespace namespace) {\n return getLocalCollection(\n namespace,\n BsonDocument.class,\n MongoClientSettings.getDefaultCodecRegistry());\n }",
"public static tunneltrafficpolicy get(nitro_service service, String name) throws Exception{\n\t\ttunneltrafficpolicy obj = new tunneltrafficpolicy();\n\t\tobj.set_name(name);\n\t\ttunneltrafficpolicy response = (tunneltrafficpolicy) obj.get_resource(service);\n\t\treturn response;\n\t}"
] |
Read properties from the active profiles.
Goes through all active profiles (in the order the
profiles are defined in settings.xml) and extracts
the desired properties (if present). The prefix is
used when looking up properties in the profile but
not in the returned map.
@param prefix The prefix to use or null if no prefix should be used
@param properties The properties to read
@return A map containing the values for the properties that were found | [
"public Map<String, String> readPropertiesFromActiveProfiles( final String prefix,\n final String... properties ) {\n if (settings == null) {\n console.debug(\"No maven setting injected\");\n return Collections.emptyMap();\n }\n\n final List<String> activeProfilesList = settings.getActiveProfiles();\n if (activeProfilesList.isEmpty()) {\n console.debug(\"No active profiles found\");\n return Collections.emptyMap();\n }\n\n final Map<String, String> map = new HashMap<String, String>();\n final Set<String> activeProfiles = new HashSet<String>(activeProfilesList);\n\n // Iterate over all active profiles in order\n for (final Profile profile : settings.getProfiles()) {\n // Check if the profile is active\n final String profileId = profile.getId();\n if (activeProfiles.contains(profileId)) {\n console.debug(\"Trying active profile \" + profileId);\n for (final String property : properties) {\n final String propKey = prefix != null ? prefix + property : property;\n final String value = profile.getProperties().getProperty(propKey);\n if (value != null) {\n console.debug(\"Found property \" + property + \" in profile \" + profileId);\n map.put(property, value);\n }\n }\n }\n }\n\n return map;\n }"
] | [
"public PlaybackState getFurthestPlaybackState() {\n PlaybackState result = null;\n for (PlaybackState state : playbackStateMap.values()) {\n if (result == null || (!result.playing && state.playing) ||\n (result.position < state.position) && (state.playing || !result.playing)) {\n result = state;\n }\n }\n return result;\n }",
"public static base_response update(nitro_service client, clusterinstance resource) throws Exception {\n\t\tclusterinstance updateresource = new clusterinstance();\n\t\tupdateresource.clid = resource.clid;\n\t\tupdateresource.deadinterval = resource.deadinterval;\n\t\tupdateresource.hellointerval = resource.hellointerval;\n\t\tupdateresource.preemption = resource.preemption;\n\t\treturn updateresource.update_resource(client);\n\t}",
"@Override\n\tpublic T next() {\n\t\tSQLException sqlException = null;\n\t\ttry {\n\t\t\tT result = nextThrow();\n\t\t\tif (result != null) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t} catch (SQLException e) {\n\t\t\tsqlException = e;\n\t\t}\n\t\t// we have to throw if there is no next or on a SQLException\n\t\tlast = null;\n\t\tcloseQuietly();\n\t\tthrow new IllegalStateException(\"Could not get next result for \" + dataClass, sqlException);\n\t}",
"public static base_response renumber(nitro_service client) throws Exception {\n\t\tnspbr6 renumberresource = new nspbr6();\n\t\treturn renumberresource.perform_operation(client,\"renumber\");\n\t}",
"@SuppressWarnings({ \"unchecked\", \"rawtypes\", \"unused\" })\n private void commitToVoldemort(List<String> storeNamesToCommit) {\n\n if(logger.isDebugEnabled()) {\n logger.debug(\"Trying to commit to Voldemort\");\n }\n\n boolean hasError = false;\n if(nodesToStream == null || nodesToStream.size() == 0) {\n if(logger.isDebugEnabled()) {\n logger.debug(\"No nodes to stream to. Returning.\");\n }\n return;\n }\n\n for(Node node: nodesToStream) {\n\n for(String store: storeNamesToCommit) {\n if(!nodeIdStoreInitialized.get(new Pair(store, node.getId())))\n continue;\n\n nodeIdStoreInitialized.put(new Pair(store, node.getId()), false);\n\n DataOutputStream outputStream = nodeIdStoreToOutputStreamRequest.get(new Pair(store,\n node.getId()));\n\n try {\n ProtoUtils.writeEndOfStream(outputStream);\n outputStream.flush();\n DataInputStream inputStream = nodeIdStoreToInputStreamRequest.get(new Pair(store,\n node.getId()));\n VAdminProto.UpdatePartitionEntriesResponse.Builder updateResponse = ProtoUtils.readToBuilder(inputStream,\n VAdminProto.UpdatePartitionEntriesResponse.newBuilder());\n if(updateResponse.hasError()) {\n hasError = true;\n }\n\n } catch(IOException e) {\n logger.error(\"Exception during commit\", e);\n hasError = true;\n if(!faultyNodes.contains(node.getId()))\n faultyNodes.add(node.getId());\n }\n }\n\n }\n\n if(streamingresults == null) {\n logger.warn(\"StreamingSession may not have been initialized since Variable streamingresults is null. Skipping callback \");\n return;\n }\n\n // remove redundant callbacks\n if(hasError) {\n\n logger.info(\"Invoking the Recovery Callback\");\n Future future = streamingresults.submit(recoveryCallback);\n try {\n future.get();\n\n } catch(InterruptedException e1) {\n MARKED_BAD = true;\n logger.error(\"Recovery Callback failed\", e1);\n throw new VoldemortException(\"Recovery Callback failed\");\n } catch(ExecutionException e1) {\n MARKED_BAD = true;\n logger.error(\"Recovery Callback failed during execution\", e1);\n throw new VoldemortException(\"Recovery Callback failed during execution\");\n }\n } else {\n if(logger.isDebugEnabled()) {\n logger.debug(\"Commit successful\");\n logger.debug(\"calling checkpoint callback\");\n }\n Future future = streamingresults.submit(checkpointCallback);\n try {\n future.get();\n\n } catch(InterruptedException e1) {\n logger.warn(\"Checkpoint callback failed!\", e1);\n } catch(ExecutionException e1) {\n logger.warn(\"Checkpoint callback failed during execution!\", e1);\n }\n }\n\n }",
"@SuppressWarnings(\"rawtypes\")\n private static <T> Constructor<T> findConstructor(final Class<T> clazz, final Object... args)\n throws NoSuchConstructorException, AmbiguousConstructorException {\n final Object[] cArgs = (args == null) ? new Object[0] : args;\n Constructor<T> constructorToUse = null;\n final Constructor<?>[] candidates = clazz.getConstructors();\n Arrays.sort(candidates, ConstructorComparator.INSTANCE);\n int minTypeDiffWeight = Integer.MAX_VALUE;\n Set<Constructor<?>> ambiguousConstructors = null;\n for (final Constructor candidate : candidates) {\n final Class[] paramTypes = candidate.getParameterTypes();\n if (constructorToUse != null && cArgs.length > paramTypes.length) {\n // Already found greedy constructor that can be satisfied.\n // Do not look any further, there are only less greedy\n // constructors left.\n break;\n }\n if (paramTypes.length != cArgs.length) {\n continue;\n }\n final int typeDiffWeight = getTypeDifferenceWeight(paramTypes, cArgs);\n if (typeDiffWeight < minTypeDiffWeight) { \n // Choose this constructor if it represents the closest match.\n constructorToUse = candidate;\n minTypeDiffWeight = typeDiffWeight;\n ambiguousConstructors = null;\n } else if (constructorToUse != null && typeDiffWeight == minTypeDiffWeight) {\n if (ambiguousConstructors == null) {\n ambiguousConstructors = new LinkedHashSet<Constructor<?>>();\n ambiguousConstructors.add(constructorToUse);\n }\n ambiguousConstructors.add(candidate);\n }\n }\n if (ambiguousConstructors != null && !ambiguousConstructors.isEmpty()) {\n throw new AmbiguousConstructorException(clazz, cArgs, ambiguousConstructors);\n }\n if (constructorToUse == null) {\n throw new NoSuchConstructorException(clazz, cArgs);\n }\n return constructorToUse;\n }",
"public static Set<Dependency> getAllDependencies(final Module module, final List<String> producedArtifacts) {\n final Set<Dependency> dependencies = new HashSet<Dependency>();\n\n for(final Dependency dependency: module.getDependencies()){\n if(!producedArtifacts.contains(dependency.getTarget().getGavc())){\n dependencies.add(dependency);\n }\n }\n\n for(final Module subModule: module.getSubmodules()){\n dependencies.addAll(getAllDependencies(subModule, producedArtifacts));\n }\n\n return dependencies;\n }",
"@SuppressWarnings(\"rawtypes\")\n\tpublic static MonetaryAmountFactory getAmountFactory(MonetaryAmountFactoryQuery query) {\n return Optional.ofNullable(monetaryAmountsSingletonQuerySpi()).orElseThrow(() -> new MonetaryException(\n \"No MonetaryAmountsSingletonQuerySpi loaded, query functionality is not available.\"))\n .getAmountFactory(query);\n }",
"protected Patch createProcessedPatch(final Patch original) {\n\n // Process elements\n final List<PatchElement> elements = new ArrayList<PatchElement>();\n // Process layers\n for (final PatchEntry entry : getLayers()) {\n final PatchElement element = createPatchElement(entry, entry.element.getId(), entry.modifications);\n elements.add(element);\n }\n // Process add-ons\n for (final PatchEntry entry : getAddOns()) {\n final PatchElement element = createPatchElement(entry, entry.element.getId(), entry.modifications);\n elements.add(element);\n }\n\n // Swap the patch element modifications, keep the identity ones since we don't need to fix the misc modifications\n return new PatchImpl(original.getPatchId(), original.getDescription(), original.getLink(), original.getIdentity(), elements, identityEntry.modifications);\n }"
] |
Sets the value of the setting with the specified key.
@param key name of the setting
@param value the setting value
@return this {@code EnvironmentConfig} instance | [
"@Override\n public EnvironmentConfig setSetting(@NotNull final String key, @NotNull final Object value) {\n return (EnvironmentConfig) super.setSetting(key, value);\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 void enable(ConduitSelectorHolder conduitSelectorHolder, SLPropertiesMatcher matcher,\n String selectionStrategy) {\n LocatorTargetSelector selector = new LocatorTargetSelector();\n selector.setEndpoint(conduitSelectorHolder.getConduitSelector().getEndpoint());\n\n String actualStrategy = selectionStrategy != null ? selectionStrategy : defaultLocatorSelectionStrategy;\n \n LocatorSelectionStrategy locatorSelectionStrategy = getLocatorSelectionStrategy(actualStrategy);\n locatorSelectionStrategy.setServiceLocator(locatorClient);\n if (matcher != null) {\n locatorSelectionStrategy.setMatcher(matcher);\n }\n selector.setLocatorSelectionStrategy(locatorSelectionStrategy);\n\n if (LOG.isLoggable(Level.INFO)) {\n LOG.log(Level.INFO, \"Client enabled with strategy \"\n + locatorSelectionStrategy.getClass().getName() + \".\");\n }\n conduitSelectorHolder.setConduitSelector(selector);\n\n if (LOG.isLoggable(Level.FINE)) {\n LOG.log(Level.FINE, \"Successfully enabled client \" + conduitSelectorHolder\n + \" for the service locator\");\n }\n }",
"public static AnalysisResult fakeSuccess() {\n return new AnalysisResult(null, new Extensions(Collections.emptyMap(), Collections.emptyMap(),\n Collections.emptyMap(), Collections.emptyMap()));\n }",
"public static CharSequence getRelativeTimeSpanString(Context context, ReadableInstant time, int flags) {\n boolean abbrevRelative = (flags & (FORMAT_ABBREV_RELATIVE | FORMAT_ABBREV_ALL)) != 0;\n\n // We set the millis to 0 so we aren't off by a fraction of a second when counting intervals\n DateTime now = DateTime.now(time.getZone()).withMillisOfSecond(0);\n DateTime timeDt = new DateTime(time).withMillisOfSecond(0);\n boolean past = !now.isBefore(timeDt);\n Interval interval = past ? new Interval(timeDt, now) : new Interval(now, timeDt);\n\n int resId;\n long count;\n if (Minutes.minutesIn(interval).isLessThan(Minutes.ONE)) {\n count = Seconds.secondsIn(interval).getSeconds();\n if (past) {\n if (abbrevRelative) {\n resId = R.plurals.joda_time_android_abbrev_num_seconds_ago;\n }\n else {\n resId = R.plurals.joda_time_android_num_seconds_ago;\n }\n }\n else {\n if (abbrevRelative) {\n resId = R.plurals.joda_time_android_abbrev_in_num_seconds;\n }\n else {\n resId = R.plurals.joda_time_android_in_num_seconds;\n }\n }\n }\n else if (Hours.hoursIn(interval).isLessThan(Hours.ONE)) {\n count = Minutes.minutesIn(interval).getMinutes();\n if (past) {\n if (abbrevRelative) {\n resId = R.plurals.joda_time_android_abbrev_num_minutes_ago;\n }\n else {\n resId = R.plurals.joda_time_android_num_minutes_ago;\n }\n }\n else {\n if (abbrevRelative) {\n resId = R.plurals.joda_time_android_abbrev_in_num_minutes;\n }\n else {\n resId = R.plurals.joda_time_android_in_num_minutes;\n }\n }\n }\n else if (Days.daysIn(interval).isLessThan(Days.ONE)) {\n count = Hours.hoursIn(interval).getHours();\n if (past) {\n if (abbrevRelative) {\n resId = R.plurals.joda_time_android_abbrev_num_hours_ago;\n }\n else {\n resId = R.plurals.joda_time_android_num_hours_ago;\n }\n }\n else {\n if (abbrevRelative) {\n resId = R.plurals.joda_time_android_abbrev_in_num_hours;\n }\n else {\n resId = R.plurals.joda_time_android_in_num_hours;\n }\n }\n }\n else if (Weeks.weeksIn(interval).isLessThan(Weeks.ONE)) {\n count = Days.daysIn(interval).getDays();\n if (past) {\n if (abbrevRelative) {\n resId = R.plurals.joda_time_android_abbrev_num_days_ago;\n }\n else {\n resId = R.plurals.joda_time_android_num_days_ago;\n }\n }\n else {\n if (abbrevRelative) {\n resId = R.plurals.joda_time_android_abbrev_in_num_days;\n }\n else {\n resId = R.plurals.joda_time_android_in_num_days;\n }\n }\n }\n else {\n return formatDateRange(context, time, time, flags);\n }\n\n String format = context.getResources().getQuantityString(resId, (int) count);\n return String.format(format, count);\n }",
"private void initStyleGenerators() {\n\n if (m_model.hasMasterMode()) {\n m_styleGenerators.put(\n CmsMessageBundleEditorTypes.EditMode.MASTER,\n new CmsMessageBundleEditorTypes.TranslateTableCellStyleGenerator(\n m_model.getEditableColumns(CmsMessageBundleEditorTypes.EditMode.MASTER)));\n }\n m_styleGenerators.put(\n CmsMessageBundleEditorTypes.EditMode.DEFAULT,\n new CmsMessageBundleEditorTypes.TranslateTableCellStyleGenerator(\n m_model.getEditableColumns(CmsMessageBundleEditorTypes.EditMode.DEFAULT)));\n\n }",
"public List<File> getInactiveHistory() throws PatchingException {\n if (validHistory == null) {\n walk();\n }\n final File[] inactiveDirs = installedIdentity.getInstalledImage().getPatchesDir().listFiles(new FileFilter() {\n @Override\n public boolean accept(File pathname) {\n return pathname.isDirectory() && !validHistory.contains(pathname.getName());\n }\n });\n return inactiveDirs == null ? Collections.<File>emptyList() : Arrays.asList(inactiveDirs);\n }",
"private String formatRate(Rate value)\n {\n String result = null;\n if (value != null)\n {\n StringBuilder buffer = new StringBuilder(m_formats.getCurrencyFormat().format(value.getAmount()));\n buffer.append(\"/\");\n buffer.append(formatTimeUnit(value.getUnits()));\n result = buffer.toString();\n }\n return (result);\n }",
"static void showWarning(final String caption, final String description) {\n\n Notification warning = new Notification(caption, description, Type.WARNING_MESSAGE, true);\n warning.setDelayMsec(-1);\n warning.show(UI.getCurrent().getPage());\n\n }",
"public String getUncPath() {\n getUncPath0();\n if( share == null ) {\n return \"\\\\\\\\\" + url.getHost();\n }\n return \"\\\\\\\\\" + url.getHost() + canon.replace( '/', '\\\\' );\n }"
] |
Decode a content Type header line into types and parameters pairs | [
"void decodeContentType(String rawLine) {\r\n int slash = rawLine.indexOf('/');\r\n if (slash == -1) {\r\n// if (DEBUG) getLogger().debug(\"decoding ... no slash found\");\r\n return;\r\n } else {\r\n primaryType = rawLine.substring(0, slash).trim();\r\n }\r\n int semicolon = rawLine.indexOf(';');\r\n if (semicolon == -1) {\r\n// if (DEBUG) getLogger().debug(\"decoding ... no semicolon found\");\r\n secondaryType = rawLine.substring(slash + 1).trim();\r\n return;\r\n }\r\n // have parameters\r\n secondaryType = rawLine.substring(slash + 1, semicolon).trim();\r\n Header h = new Header(rawLine);\r\n parameters = h.getParams();\r\n }"
] | [
"public static appfwjsoncontenttype[] get(nitro_service service, options option) throws Exception{\n\t\tappfwjsoncontenttype obj = new appfwjsoncontenttype();\n\t\tappfwjsoncontenttype[] response = (appfwjsoncontenttype[])obj.get_resources(service,option);\n\t\treturn response;\n\t}",
"private Client getClient(){\n final ClientConfig cfg = new DefaultClientConfig();\n cfg.getClasses().add(com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider.class);\n cfg.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, timeout);\n\n return Client.create(cfg);\n }",
"String getQueryString(Map<String, String> params) {\n\t\tStringBuilder builder = new StringBuilder();\n\t\ttry {\n\t\t\tboolean first = true;\n\t\t\tfor (Map.Entry<String,String> entry : params.entrySet()) {\n\t\t\t\tif (first) {\n\t\t\t\t\tfirst = false;\n\t\t\t\t} else {\n\t\t\t\t\tbuilder.append(\"&\");\n\t\t\t\t}\n\t\t\t\tbuilder.append(URLEncoder.encode(entry.getKey(), \"UTF-8\"));\n\t\t\t\tbuilder.append(\"=\");\n\t\t\t\tbuilder.append(URLEncoder.encode(entry.getValue(), \"UTF-8\"));\n\t\t\t}\n\t\t} catch (UnsupportedEncodingException e) {\n\t\t\tthrow new RuntimeException(\n\t\t\t\t\t\"Your Java version does not support UTF-8 encoding.\");\n\t\t}\n\n\t\treturn builder.toString();\n\t}",
"public static final Double parsePercent(String value)\n {\n return value == null ? null : Double.valueOf(Double.parseDouble(value) * 100.0);\n }",
"public static byte[] hashPath(MessageDigest messageDigest, Path path) throws IOException {\n try (InputStream in = getRecursiveContentStream(path)) {\n return hashContent(messageDigest, in);\n }\n }",
"public boolean evaluate(FieldContainer container, Map<GenericCriteriaPrompt, Object> promptValues)\n {\n //\n // Retrieve the LHS value\n //\n FieldType field = m_leftValue;\n Object lhs;\n\n if (field == null)\n {\n lhs = null;\n }\n else\n {\n lhs = container.getCurrentValue(field);\n switch (field.getDataType())\n {\n case DATE:\n {\n if (lhs != null)\n {\n lhs = DateHelper.getDayStartDate((Date) lhs);\n }\n break;\n }\n\n case DURATION:\n {\n if (lhs != null)\n {\n Duration dur = (Duration) lhs;\n lhs = dur.convertUnits(TimeUnit.HOURS, m_properties);\n }\n else\n {\n lhs = Duration.getInstance(0, TimeUnit.HOURS);\n }\n break;\n }\n\n case STRING:\n {\n lhs = lhs == null ? \"\" : lhs;\n break;\n }\n\n default:\n {\n break;\n }\n }\n }\n\n //\n // Retrieve the RHS values\n //\n Object[] rhs;\n if (m_symbolicValues == true)\n {\n rhs = processSymbolicValues(m_workingRightValues, container, promptValues);\n }\n else\n {\n rhs = m_workingRightValues;\n }\n\n //\n // Evaluate\n //\n boolean result;\n switch (m_operator)\n {\n case AND:\n case OR:\n {\n result = evaluateLogicalOperator(container, promptValues);\n break;\n }\n\n default:\n {\n result = m_operator.evaluate(lhs, rhs);\n break;\n }\n }\n\n return result;\n }",
"protected final void setDerivedEndType() {\n\n m_endType = getPatternType().equals(PatternType.NONE) || getPatternType().equals(PatternType.INDIVIDUAL)\n ? EndType.SINGLE\n : null != getSeriesEndDate() ? EndType.DATE : EndType.TIMES;\n }",
"@SuppressWarnings(\"SameParameterValue\")\n private void assembleAndSendPacket(Util.PacketType kind, byte[] payload, InetAddress destination, int port) throws IOException {\n DatagramPacket packet = Util.buildPacket(kind,\n ByteBuffer.wrap(announcementBytes, DEVICE_NAME_OFFSET, DEVICE_NAME_LENGTH).asReadOnlyBuffer(),\n ByteBuffer.wrap(payload));\n packet.setAddress(destination);\n packet.setPort(port);\n socket.get().send(packet);\n }",
"private Renderer createRenderer(T content, ViewGroup parent) {\n int prototypeIndex = getPrototypeIndex(content);\n Renderer renderer = getPrototypeByIndex(prototypeIndex).copy();\n renderer.onCreate(content, layoutInflater, parent);\n return renderer;\n }"
] |
Do not call directly.
@deprecated | [
"public void onDrawFrame(float frameTime) {\n final GVRSceneObject owner = getOwnerObject();\n if (owner == null) {\n return;\n }\n\n final int size = mRanges.size();\n final GVRTransform t = getGVRContext().getMainScene().getMainCameraRig().getCenterCamera().getTransform();\n\n for (final Object[] range : mRanges) {\n ((GVRSceneObject)range[1]).setEnable(false);\n }\n\n for (int i = size - 1; i >= 0; --i) {\n final Object[] range = mRanges.get(i);\n final GVRSceneObject child = (GVRSceneObject) range[1];\n if (child.getParent() != owner) {\n Log.w(TAG, \"the scene object for distance greater than \" + range[0] + \" is not a child of the owner; skipping it\");\n continue;\n }\n\n final float[] values = child.getBoundingVolumeRawValues();\n mCenter.set(values[0], values[1], values[2], 1.0f);\n mVector.set(t.getPositionX(), t.getPositionY(), t.getPositionZ(), 1.0f);\n\n mVector.sub(mCenter);\n mVector.negate();\n\n float distance = mVector.dot(mVector);\n\n if (distance >= (Float) range[0]) {\n child.setEnable(true);\n break;\n }\n }\n }"
] | [
"private void debugLogStart(String operationType,\n Long originTimeInMS,\n Long requestReceivedTimeInMs,\n String keyString) {\n long durationInMs = requestReceivedTimeInMs - originTimeInMS;\n logger.debug(\"Received a new request. Operation Type: \" + operationType + \" , key(s): \"\n + keyString + \" , Store: \" + this.storeName + \" , Origin time (in ms): \"\n + originTimeInMS + \" . Request received at time(in ms): \"\n + requestReceivedTimeInMs\n + \" , Duration from RESTClient to CoordinatorFatClient(in ms): \"\n + durationInMs);\n\n }",
"private Class[] getInterfaces(Class clazz) {\r\n Class superClazz = clazz;\r\n Class[] interfaces = clazz.getInterfaces();\r\n\r\n // clazz can be an interface itself and when getInterfaces()\r\n // is called on an interface it returns only the extending\r\n // interfaces, not the interface itself.\r\n if (clazz.isInterface()) {\r\n Class[] tempInterfaces = new Class[interfaces.length + 1];\r\n tempInterfaces[0] = clazz;\r\n\r\n System.arraycopy(interfaces, 0, tempInterfaces, 1, interfaces.length);\r\n interfaces = tempInterfaces;\r\n }\r\n\r\n // add all interfaces implemented by superclasses to the interfaces array\r\n while ((superClazz = superClazz.getSuperclass()) != null) {\r\n Class[] superInterfaces = superClazz.getInterfaces();\r\n Class[] combInterfaces = new Class[interfaces.length + superInterfaces.length];\r\n System.arraycopy(interfaces, 0, combInterfaces, 0, interfaces.length);\r\n System.arraycopy(superInterfaces, 0, combInterfaces, interfaces.length, superInterfaces.length);\r\n interfaces = combInterfaces;\r\n }\r\n\r\n /**\r\n * Must remove duplicate interfaces before calling Proxy.getProxyClass().\r\n * Duplicates can occur if a subclass re-declares that it implements\r\n * the same interface as one of its ancestor classes.\r\n **/\r\n HashMap unique = new HashMap();\r\n for (int i = 0; i < interfaces.length; i++) {\r\n unique.put(interfaces[i].getName(), interfaces[i]);\r\n }\r\n /* Add the OJBProxy interface as well */\r\n unique.put(OJBProxy.class.getName(), OJBProxy.class);\r\n\r\n interfaces = (Class[])unique.values().toArray(new Class[unique.size()]);\r\n\r\n return interfaces;\r\n }",
"@Override\n public List<JobInstance> getJobs(Query query)\n {\n return JqmClientFactory.getClient().getJobs(query);\n }",
"protected FieldDescriptor getFieldDescriptor(TableAlias aTableAlias, PathInfo aPathInfo)\r\n {\r\n FieldDescriptor fld = null;\r\n String colName = aPathInfo.column;\r\n\r\n if (aTableAlias != null)\r\n {\r\n fld = aTableAlias.cld.getFieldDescriptorByName(colName);\r\n if (fld == null)\r\n {\r\n ObjectReferenceDescriptor ord = aTableAlias.cld.getObjectReferenceDescriptorByName(colName);\r\n if (ord != null)\r\n {\r\n fld = getFldFromReference(aTableAlias, ord);\r\n }\r\n else\r\n {\r\n fld = getFldFromJoin(aTableAlias, colName);\r\n }\r\n }\r\n }\r\n\r\n return fld;\r\n }",
"public void setTextureBufferSize(final int size) {\n mRootViewGroup.post(new Runnable() {\n @Override\n public void run() {\n mRootViewGroup.setTextureBufferSize(size);\n }\n });\n }",
"private static String getAttribute(String name, Element firstElement, Element secondElement) {\r\n String val = firstElement.getAttribute(name);\r\n if (val.length() == 0 && secondElement != null) {\r\n val = secondElement.getAttribute(name);\r\n }\r\n return val;\r\n }",
"public void retrieveCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException\r\n {\r\n doRetrieveCollections(newObj, cld, forced, false);\r\n }",
"@Override\n public final PArray getArray(final String key) {\n PArray result = optArray(key);\n if (result == null) {\n throw new ObjectMissingException(this, key);\n }\n return result;\n }",
"public LayoutParams getLayoutParams() {\n if (mLayoutParams == null) {\n mLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);\n }\n return mLayoutParams;\n }"
] |
Use this API to fetch vpnvserver_vpnnexthopserver_binding resources of given name . | [
"public static vpnvserver_vpnnexthopserver_binding[] get(nitro_service service, String name) throws Exception{\n\t\tvpnvserver_vpnnexthopserver_binding obj = new vpnvserver_vpnnexthopserver_binding();\n\t\tobj.set_name(name);\n\t\tvpnvserver_vpnnexthopserver_binding response[] = (vpnvserver_vpnnexthopserver_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}"
] | [
"public long removeRangeByLex(final LexRange lexRange) {\n return doWithJedis(new JedisCallable<Long>() {\n @Override\n public Long call(Jedis jedis) {\n return jedis.zremrangeByLex(getKey(), lexRange.from(), lexRange.to());\n }\n });\n }",
"public static ReportGenerator.Format getFormat( String... args ) {\n ConfigOptionParser configParser = new ConfigOptionParser();\n List<ConfigOption> configOptions = Arrays.asList( format, help );\n\n for( ConfigOption co : configOptions ) {\n if( co.hasDefault() ) {\n configParser.parsedOptions.put( co.getLongName(), co.getValue() );\n }\n }\n\n for( String arg : args ) {\n configParser.commandLineLookup( arg, format, configOptions );\n }\n\n // TODO properties\n // TODO environment\n\n if( !configParser.hasValue( format ) ) {\n configParser.printUsageAndExit( configOptions );\n }\n return (ReportGenerator.Format) configParser.getValue( format );\n }",
"public void addModuleToExport(final String moduleName) {\n\n if (m_modulesToExport == null) {\n m_modulesToExport = new HashSet<String>();\n }\n m_modulesToExport.add(moduleName);\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 }",
"public static void registerParams(DynamicJasperDesign jd, Map _parameters) {\n for (Object key : _parameters.keySet()) {\n if (key instanceof String) {\n try {\n Object value = _parameters.get(key);\n if (jd.getParametersMap().get(key) != null) {\n log.warn(\"Parameter \\\"\" + key + \"\\\" already registered, skipping this one: \" + value);\n continue;\n }\n\n JRDesignParameter parameter = new JRDesignParameter();\n\n if (value == null) //There are some Map implementations that allows nulls values, just go on\n continue;\n\n//\t\t\t\t\tparameter.setValueClassName(value.getClass().getCanonicalName());\n Class clazz = value.getClass().getComponentType();\n if (clazz == null)\n clazz = value.getClass();\n parameter.setValueClass(clazz); //NOTE this is very strange\n //when using an array as subreport-data-source, I must pass the parameter class name like this: value.getClass().getComponentType()\n parameter.setName((String) key);\n jd.addParameter(parameter);\n } catch (JRException e) {\n //nothing to do\n }\n }\n\n }\n\n }",
"public void removeSource(GVRAudioSource audioSource)\n {\n synchronized (mAudioSources)\n {\n audioSource.setListener(null);\n mAudioSources.remove(audioSource);\n }\n }",
"public final static String process(final String input, final Configuration configuration)\n {\n try\n {\n return process(new StringReader(input), configuration);\n }\n catch (final IOException e)\n {\n // This _can never_ happen\n return null;\n }\n }",
"public static void setPropertySafely(Marshaller marshaller, String name, Object value) {\n try {\n marshaller.setProperty(name, value);\n } catch (PropertyException e) {\n LOGGER.warn(String.format(\"Can't set \\\"%s\\\" property to given marshaller\", name), e);\n }\n }",
"public Collection values()\r\n {\r\n if (values != null) return values;\r\n values = new AbstractCollection()\r\n {\r\n public int size()\r\n {\r\n return size;\r\n }\r\n\r\n public void clear()\r\n {\r\n ReferenceMap.this.clear();\r\n }\r\n\r\n public Iterator iterator()\r\n {\r\n return new ValueIterator();\r\n }\r\n };\r\n return values;\r\n }"
] |
Returns a Client object for a clientUUID and profileId
@param clientUUID UUID or friendlyName of client
@param profileId - can be null, safer if it is not null
@return Client object or null
@throws Exception exception | [
"public Client findClient(String clientUUID, Integer profileId) throws Exception {\n Client client = null;\n /* ERROR CODE: 500 WHEN TRYING TO DELETE A SERVER GROUP.\n THIS APPEARS TO BE BECAUSE CLIENT UUID IS NULL.\n */\n /* CODE ADDED TO PREVENT NULL POINTERS. */\n if (clientUUID == null) {\n clientUUID = \"\";\n }\n\n // first see if the clientUUID is actually a uuid.. it might be a friendlyName and need conversion\n /* A UUID IS A UNIVERSALLY UNIQUE IDENTIFIER. */\n if (clientUUID.compareTo(Constants.PROFILE_CLIENT_DEFAULT_ID) != 0 &&\n !clientUUID.matches(\"[\\\\w]{8}-[\\\\w]{4}-[\\\\w]{4}-[\\\\w]{4}-[\\\\w]{12}\")) {\n Client tmpClient = this.findClientFromFriendlyName(profileId, clientUUID);\n\n // if we can't find a client then fall back to the default ID\n if (tmpClient == null) {\n clientUUID = Constants.PROFILE_CLIENT_DEFAULT_ID;\n } else {\n return tmpClient;\n }\n }\n\n PreparedStatement statement = null;\n ResultSet results = null;\n try (Connection sqlConnection = sqlService.getConnection()) {\n String queryString = \"SELECT * FROM \" + Constants.DB_TABLE_CLIENT +\n \" WHERE \" + Constants.CLIENT_CLIENT_UUID + \" = ?\";\n\n if (profileId != null) {\n queryString += \" AND \" + Constants.GENERIC_PROFILE_ID + \"=?\";\n }\n\n statement = sqlConnection.prepareStatement(queryString);\n statement.setString(1, clientUUID);\n\n if (profileId != null) {\n statement.setInt(2, profileId);\n }\n\n results = statement.executeQuery();\n if (results.next()) {\n client = this.getClientFromResultSet(results);\n }\n } catch (Exception e) {\n throw e;\n } finally {\n try {\n if (results != null) {\n results.close();\n }\n } catch (Exception e) {\n }\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n\n return client;\n }"
] | [
"@Override\n public List<ConfigIssue> init(Service.Context context) {\n this.context = context;\n return init();\n }",
"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 }",
"Object readResolve() throws ObjectStreamException {\n Bean<?> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<Object>, Object>getContextual(beanId);\n if (bean == null) {\n throw BeanLogger.LOG.proxyDeserializationFailure(beanId);\n }\n return Container.instance(contextId).deploymentManager().getClientProxyProvider().getClientProxy(bean);\n }",
"public List<Ticket> checkTickets(Set<String> tickets) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_CHECK_TICKETS);\r\n\r\n StringBuffer sb = new StringBuffer();\r\n Iterator<String> it = tickets.iterator();\r\n while (it.hasNext()) {\r\n if (sb.length() > 0) {\r\n sb.append(\",\");\r\n }\r\n Object obj = it.next();\r\n if (obj instanceof Ticket) {\r\n sb.append(((Ticket) obj).getTicketId());\r\n } else {\r\n sb.append(obj);\r\n }\r\n }\r\n parameters.put(\"tickets\", sb.toString());\r\n\r\n Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n\r\n // <uploader>\r\n // <ticket id=\"128\" complete=\"1\" photoid=\"2995\" />\r\n // <ticket id=\"129\" complete=\"0\" />\r\n // <ticket id=\"130\" complete=\"2\" />\r\n // <ticket id=\"131\" invalid=\"1\" />\r\n // </uploader>\r\n\r\n List<Ticket> list = new ArrayList<Ticket>();\r\n Element uploaderElement = response.getPayload();\r\n NodeList ticketNodes = uploaderElement.getElementsByTagName(\"ticket\");\r\n int n = ticketNodes.getLength();\r\n for (int i = 0; i < n; i++) {\r\n Element ticketElement = (Element) ticketNodes.item(i);\r\n String id = ticketElement.getAttribute(\"id\");\r\n String complete = ticketElement.getAttribute(\"complete\");\r\n boolean invalid = \"1\".equals(ticketElement.getAttribute(\"invalid\"));\r\n String photoId = ticketElement.getAttribute(\"photoid\");\r\n Ticket info = new Ticket();\r\n info.setTicketId(id);\r\n info.setInvalid(invalid);\r\n info.setStatus(Integer.parseInt(complete));\r\n info.setPhotoId(photoId);\r\n list.add(info);\r\n }\r\n return list;\r\n }",
"public Date getDate(String path) throws ParseException {\n return BoxDateFormat.parse(this.getValue(path).asString());\n }",
"public static int getPercentage(String percentage) {\n if (isNotEmpty(percentage) && isNumeric(percentage)) {\n int p = Integer.parseInt(percentage);\n return p;\n } else {\n return 0;\n }\n }",
"public MediaType copyQualityValue(MediaType mediaType) {\n\t\tif (!mediaType.parameters.containsKey(PARAM_QUALITY_FACTOR)) {\n\t\t\treturn this;\n\t\t}\n\t\tMap<String, String> params = new LinkedHashMap<String, String>(this.parameters);\n\t\tparams.put(PARAM_QUALITY_FACTOR, mediaType.parameters.get(PARAM_QUALITY_FACTOR));\n\t\treturn new MediaType(this, params);\n\t}",
"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 }",
"public static ComplexNumber Pow(ComplexNumber z1, double n) {\r\n\r\n double norm = Math.pow(z1.getMagnitude(), n);\r\n double angle = 360 - Math.abs(Math.toDegrees(Math.atan(z1.imaginary / z1.real)));\r\n\r\n double common = n * angle;\r\n\r\n double r = norm * Math.cos(Math.toRadians(common));\r\n double i = norm * Math.sin(Math.toRadians(common));\r\n\r\n return new ComplexNumber(r, i);\r\n\r\n }"
] |
Convert the Phoenix representation of a finish date time into a Date instance.
@param value Phoenix date time
@return Date instance | [
"public static final Date parseFinishDateTime(String value)\n {\n Date result = parseDateTime(value);\n if (result != null)\n {\n result = DateHelper.addDays(result, -1);\n }\n return result;\n }"
] | [
"public Object get(String name, ObjectFactory<?> factory) {\n\t\tThreadScopeContext context = ThreadScopeContextHolder.getContext();\n\n\t\tObject result = context.getBean(name);\n\t\tif (null == result) {\n\t\t\tresult = factory.getObject();\n\t\t\tcontext.setBean(name, result);\n\t\t}\n\t\treturn result;\n\t}",
"public PeriodicEvent runEvery(Runnable task, float delay, float period,\n KeepRunning callback) {\n validateDelay(delay);\n validatePeriod(period);\n return new Event(task, delay, period, callback);\n }",
"private void addDateRange(ProjectCalendarHours hours, Date start, Date end)\n {\n if (start != null && end != null)\n {\n Calendar cal = DateHelper.popCalendar(end);\n // If the time ends on midnight, the date should be the next day. Otherwise problems occur.\n if (cal.get(Calendar.HOUR_OF_DAY) == 0 && cal.get(Calendar.MINUTE) == 0 && cal.get(Calendar.SECOND) == 0 && cal.get(Calendar.MILLISECOND) == 0)\n {\n cal.add(Calendar.DAY_OF_YEAR, 1);\n }\n end = cal.getTime();\n DateHelper.pushCalendar(cal);\n \n hours.addRange(new DateRange(start, end));\n }\n }",
"public void update(Record record, boolean isText) throws MPXJException\n {\n int length = record.getLength();\n\n for (int i = 0; i < length; i++)\n {\n if (isText == true)\n {\n add(getTaskCode(record.getString(i)));\n }\n else\n {\n add(record.getInteger(i).intValue());\n }\n }\n }",
"int query(int downloadId) {\n\t\tsynchronized (mCurrentRequests) {\n\t\t\tfor (DownloadRequest request : mCurrentRequests) {\n\t\t\t\tif (request.getDownloadId() == downloadId) {\n\t\t\t\t\treturn request.getDownloadState();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn DownloadManager.STATUS_NOT_FOUND;\n\t}",
"void countNonZeroInR( int[] parent ) {\n TriangularSolver_DSCC.postorder(parent,n,post,gwork);\n columnCounts.process(A,parent,post,countsR);\n nz_in_R = 0;\n for (int k = 0; k < n; k++) {\n nz_in_R += countsR[k];\n }\n if( nz_in_R < 0)\n throw new RuntimeException(\"Too many elements. Numerical overflow in R counts\");\n }",
"public static void main(String[] args) {\r\n\r\n String[] s = {\"there once was a man\", \"this one is a manic\", \"hey there\", \"there once was a mane\", \"once in a manger.\", \"where is one match?\", \"Jo3seph Smarr!\", \"Joseph R Smarr\"};\r\n for (int i = 0; i < 8; i++) {\r\n for (int j = 0; j < 8; j++) {\r\n System.out.println(\"s1: \" + s[i]);\r\n System.out.println(\"s2: \" + s[j]);\r\n System.out.println(\"edit distance: \" + editDistance(s[i], s[j]));\r\n System.out.println(\"LCS: \" + longestCommonSubstring(s[i], s[j]));\r\n System.out.println(\"LCCS: \" + longestCommonContiguousSubstring(s[i], s[j]));\r\n System.out.println();\r\n }\r\n }\r\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 void writeExceptions12(Project.Calendars.Calendar calendar, List<ProjectCalendarException> exceptions)\n {\n Exceptions ce = m_factory.createProjectCalendarsCalendarExceptions();\n calendar.setExceptions(ce);\n List<Exceptions.Exception> el = ce.getException();\n\n for (ProjectCalendarException exception : exceptions)\n {\n Exceptions.Exception ex = m_factory.createProjectCalendarsCalendarExceptionsException();\n el.add(ex);\n\n ex.setName(exception.getName());\n boolean working = exception.getWorking();\n ex.setDayWorking(Boolean.valueOf(working));\n\n if (exception.getRecurring() == null)\n {\n ex.setEnteredByOccurrences(Boolean.FALSE);\n ex.setOccurrences(BigInteger.ONE);\n ex.setType(BigInteger.ONE);\n }\n else\n {\n populateRecurringException(exception, ex);\n }\n\n Project.Calendars.Calendar.Exceptions.Exception.TimePeriod period = m_factory.createProjectCalendarsCalendarExceptionsExceptionTimePeriod();\n ex.setTimePeriod(period);\n period.setFromDate(exception.getFromDate());\n period.setToDate(exception.getToDate());\n\n if (working)\n {\n Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes times = m_factory.createProjectCalendarsCalendarExceptionsExceptionWorkingTimes();\n ex.setWorkingTimes(times);\n List<Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();\n\n for (DateRange range : exception)\n {\n Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarExceptionsExceptionWorkingTimesWorkingTime();\n timesList.add(time);\n\n time.setFromTime(range.getStart());\n time.setToTime(range.getEnd());\n }\n }\n }\n }"
] |
Add the specified files in reverse order. | [
"private void addReverse(final File[] files) {\n for (int i = files.length - 1; i >= 0; --i) {\n stack.add(files[i]);\n }\n }"
] | [
"public void overrideCubeProperties(DockerCompositions overrideDockerCompositions) {\n final Set<String> containerIds = overrideDockerCompositions.getContainerIds();\n for (String containerId : containerIds) {\n\n // main definition of containers contains a container that must be overrode\n if (containers.containsKey(containerId)) {\n final CubeContainer cubeContainer = containers.get(containerId);\n final CubeContainer overrideCubeContainer = overrideDockerCompositions.get(containerId);\n\n cubeContainer.setRemoveVolumes(overrideCubeContainer.getRemoveVolumes());\n \n cubeContainer.setAlwaysPull(overrideCubeContainer.getAlwaysPull());\n\n if (overrideCubeContainer.hasAwait()) {\n cubeContainer.setAwait(overrideCubeContainer.getAwait());\n }\n\n if (overrideCubeContainer.hasBeforeStop()) {\n cubeContainer.setBeforeStop(overrideCubeContainer.getBeforeStop());\n }\n\n if (overrideCubeContainer.isManual()) {\n cubeContainer.setManual(overrideCubeContainer.isManual());\n }\n\n if (overrideCubeContainer.isKillContainer()) {\n cubeContainer.setKillContainer(overrideCubeContainer.isKillContainer());\n }\n } else {\n logger.warning(String.format(\"Overriding Container %s are not defined in main definition of containers.\",\n containerId));\n }\n }\n }",
"public double getDurationMs() {\n double durationMs = 0;\n for (Duration duration : durations) {\n if (duration.taskFinished()) {\n durationMs += duration.getDurationMS();\n }\n }\n return durationMs;\n }",
"public Widget addControl(String name, int resId, Widget.OnTouchListener listener) {\n return addControl(name, resId, null, listener, -1);\n }",
"public int getTotalCreatedConnections(){\r\n\t\tint total=0;\r\n\t\tfor (int i=0; i < this.partitionCount && this.partitions[i] != null; i++){\r\n\t\t\ttotal+=this.partitions[i].getCreatedConnections();\r\n\t\t}\r\n\t\treturn total;\r\n\t}",
"public ContentAssistEntry createProposal(final String proposal, final String prefix, final ContentAssistContext context, final String kind, final Procedure1<? super ContentAssistEntry> init) {\n boolean _isValidProposal = this.isValidProposal(proposal, prefix, context);\n if (_isValidProposal) {\n final ContentAssistEntry result = new ContentAssistEntry();\n result.setProposal(proposal);\n result.setPrefix(prefix);\n if ((kind != null)) {\n result.setKind(kind);\n }\n if ((init != null)) {\n init.apply(result);\n }\n return result;\n }\n return null;\n }",
"public void writeTagsToJavaScript(Writer writer) throws IOException\n {\n writer.append(\"function fillTagService(tagService) {\\n\");\n writer.append(\"\\t// (name, isPrime, isPseudo, color), [parent tags]\\n\");\n for (Tag tag : definedTags.values())\n {\n writer.append(\"\\ttagService.registerTag(new Tag(\");\n escapeOrNull(tag.getName(), writer);\n writer.append(\", \");\n escapeOrNull(tag.getTitle(), writer);\n writer.append(\", \").append(\"\" + tag.isPrime())\n .append(\", \").append(\"\" + tag.isPseudo())\n .append(\", \");\n escapeOrNull(tag.getColor(), writer);\n writer.append(\")\").append(\", [\");\n\n // We only have strings, not references, so we're letting registerTag() getOrCreate() the tag.\n for (Tag parentTag : tag.getParentTags())\n {\n writer.append(\"'\").append(StringEscapeUtils.escapeEcmaScript(parentTag.getName())).append(\"',\");\n }\n writer.append(\"]);\\n\");\n }\n writer.append(\"}\\n\");\n }",
"private static void checkPreconditions(final List<String> forbiddenSubStrings) {\n\t\tif( forbiddenSubStrings == null ) {\n\t\t\tthrow new NullPointerException(\"forbiddenSubStrings list should not be null\");\n\t\t} else if( forbiddenSubStrings.isEmpty() ) {\n\t\t\tthrow new IllegalArgumentException(\"forbiddenSubStrings list should not be empty\");\n\t\t}\n\t}",
"public Collection<Group> getGroups() throws FlickrException {\r\n GroupList<Group> groups = new GroupList<Group>();\r\n\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_GROUPS);\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 groupsElement = response.getPayload();\r\n groups.setPage(groupsElement.getAttribute(\"page\"));\r\n groups.setPages(groupsElement.getAttribute(\"pages\"));\r\n groups.setPerPage(groupsElement.getAttribute(\"perpage\"));\r\n groups.setTotal(groupsElement.getAttribute(\"total\"));\r\n NodeList groupNodes = groupsElement.getElementsByTagName(\"group\");\r\n for (int i = 0; i < groupNodes.getLength(); i++) {\r\n Element groupElement = (Element) groupNodes.item(i);\r\n Group group = new Group();\r\n group.setId(groupElement.getAttribute(\"id\"));\r\n group.setName(groupElement.getAttribute(\"name\"));\r\n group.setAdmin(\"1\".equals(groupElement.getAttribute(\"admin\")));\r\n group.setPrivacy(groupElement.getAttribute(\"privacy\"));\r\n group.setIconServer(groupElement.getAttribute(\"iconserver\"));\r\n group.setIconFarm(groupElement.getAttribute(\"iconfarm\"));\r\n group.setPhotoCount(groupElement.getAttribute(\"photos\"));\r\n groups.add(group);\r\n }\r\n return groups;\r\n }",
"public static lbvserver_stats[] get(nitro_service service) throws Exception{\n\t\tlbvserver_stats obj = new lbvserver_stats();\n\t\tlbvserver_stats[] response = (lbvserver_stats[])obj.stat_resources(service);\n\t\treturn response;\n\t}"
] |
Use this API to fetch vrid6 resource of given name . | [
"public static vrid6 get(nitro_service service, Long id) throws Exception{\n\t\tvrid6 obj = new vrid6();\n\t\tobj.set_id(id);\n\t\tvrid6 response = (vrid6) obj.get_resource(service);\n\t\treturn response;\n\t}"
] | [
"public static void parse(Reader src, StatementHandler handler)\n throws IOException {\n new NTriplesParser(src, handler).parse();\n }",
"public static base_response update(nitro_service client, autoscaleaction resource) throws Exception {\n\t\tautoscaleaction updateresource = new autoscaleaction();\n\t\tupdateresource.name = resource.name;\n\t\tupdateresource.profilename = resource.profilename;\n\t\tupdateresource.parameters = resource.parameters;\n\t\tupdateresource.vmdestroygraceperiod = resource.vmdestroygraceperiod;\n\t\tupdateresource.quiettime = resource.quiettime;\n\t\tupdateresource.vserver = resource.vserver;\n\t\treturn updateresource.update_resource(client);\n\t}",
"@Override public void setID(Integer val)\n {\n ProjectFile parent = getParentFile();\n Integer previous = getID();\n\n if (previous != null)\n {\n parent.getTasks().unmapID(previous);\n }\n\n parent.getTasks().mapID(val, this);\n\n set(TaskField.ID, val);\n }",
"public void resize(int w, int h) {\n\n // using the new approach of Java 2D API\n BufferedImage buf = new BufferedImage(w, h, image.getType());\n Graphics2D g2d = (Graphics2D) buf.getGraphics();\n g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);\n g2d.drawImage(image, 0, 0, w, h, null);\n g2d.dispose();\n image = buf;\n width = w;\n height = h;\n updateColorArray();\n }",
"public boolean clearParameters() {\n this.query = null;\n this.fields = null;\n this.scope = null;\n this.fileExtensions = null;\n this.createdRange = null;\n this.updatedRange = null;\n this.sizeRange = null;\n this.ownerUserIds = null;\n this.ancestorFolderIds = null;\n this.contentTypes = null;\n this.type = null;\n this.trashContent = null;\n this.metadataFilter = null;\n this.sort = null;\n this.direction = null;\n return true;\n }",
"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 }",
"public static void registerParams(DynamicJasperDesign jd, Map _parameters) {\n for (Object key : _parameters.keySet()) {\n if (key instanceof String) {\n try {\n Object value = _parameters.get(key);\n if (jd.getParametersMap().get(key) != null) {\n log.warn(\"Parameter \\\"\" + key + \"\\\" already registered, skipping this one: \" + value);\n continue;\n }\n\n JRDesignParameter parameter = new JRDesignParameter();\n\n if (value == null) //There are some Map implementations that allows nulls values, just go on\n continue;\n\n//\t\t\t\t\tparameter.setValueClassName(value.getClass().getCanonicalName());\n Class clazz = value.getClass().getComponentType();\n if (clazz == null)\n clazz = value.getClass();\n parameter.setValueClass(clazz); //NOTE this is very strange\n //when using an array as subreport-data-source, I must pass the parameter class name like this: value.getClass().getComponentType()\n parameter.setName((String) key);\n jd.addParameter(parameter);\n } catch (JRException e) {\n //nothing to do\n }\n }\n\n }\n\n }",
"private void setCalendarToOrdinalRelativeDay(Calendar calendar, int dayNumber)\n {\n int currentDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);\n int requiredDayOfWeek = getDayOfWeek().getValue();\n int dayOfWeekOffset = 0;\n if (requiredDayOfWeek > currentDayOfWeek)\n {\n dayOfWeekOffset = requiredDayOfWeek - currentDayOfWeek;\n }\n else\n {\n if (requiredDayOfWeek < currentDayOfWeek)\n {\n dayOfWeekOffset = 7 - (currentDayOfWeek - requiredDayOfWeek);\n }\n }\n\n if (dayOfWeekOffset != 0)\n {\n calendar.add(Calendar.DAY_OF_YEAR, dayOfWeekOffset);\n }\n\n if (dayNumber > 1)\n {\n calendar.add(Calendar.DAY_OF_YEAR, (7 * (dayNumber - 1)));\n }\n }",
"private static void addEcc(int[] fullstream, int[] datastream, int version, int data_cw, int blocks) {\n\n int ecc_cw = QR_TOTAL_CODEWORDS[version - 1] - data_cw;\n int short_data_block_length = data_cw / blocks;\n int qty_long_blocks = data_cw % blocks;\n int qty_short_blocks = blocks - qty_long_blocks;\n int ecc_block_length = ecc_cw / blocks;\n int i, j, length_this_block, posn;\n\n int[] data_block = new int[short_data_block_length + 2];\n int[] ecc_block = new int[ecc_block_length + 2];\n int[] interleaved_data = new int[data_cw + 2];\n int[] interleaved_ecc = new int[ecc_cw + 2];\n\n posn = 0;\n\n for (i = 0; i < blocks; i++) {\n if (i < qty_short_blocks) {\n length_this_block = short_data_block_length;\n } else {\n length_this_block = short_data_block_length + 1;\n }\n\n for (j = 0; j < ecc_block_length; j++) {\n ecc_block[j] = 0;\n }\n\n for (j = 0; j < length_this_block; j++) {\n data_block[j] = datastream[posn + j];\n }\n\n ReedSolomon rs = new ReedSolomon();\n rs.init_gf(0x11d);\n rs.init_code(ecc_block_length, 0);\n rs.encode(length_this_block, data_block);\n\n for (j = 0; j < ecc_block_length; j++) {\n ecc_block[j] = rs.getResult(j);\n }\n\n for (j = 0; j < short_data_block_length; j++) {\n interleaved_data[(j * blocks) + i] = data_block[j];\n }\n\n if (i >= qty_short_blocks) {\n interleaved_data[(short_data_block_length * blocks) + (i - qty_short_blocks)] = data_block[short_data_block_length];\n }\n\n for (j = 0; j < ecc_block_length; j++) {\n interleaved_ecc[(j * blocks) + i] = ecc_block[ecc_block_length - j - 1];\n }\n\n posn += length_this_block;\n }\n\n for (j = 0; j < data_cw; j++) {\n fullstream[j] = interleaved_data[j];\n }\n for (j = 0; j < ecc_cw; j++) {\n fullstream[j + data_cw] = interleaved_ecc[j];\n }\n }"
] |
Read the given source byte array, then overwrite this buffer's contents
@param src source byte array
@param srcOffset offset in source byte array to read from
@param destOffset offset in this buffer to read to
@param length max number of bytes to read
@return the number of bytes read | [
"public int readFrom(byte[] src, int srcOffset, long destOffset, int length) {\n int readLen = (int) Math.min(src.length - srcOffset, Math.min(size() - destOffset, length));\n ByteBuffer b = toDirectByteBuffer(destOffset, readLen);\n b.position(0);\n b.put(src, srcOffset, readLen);\n return readLen;\n }"
] | [
"public static String takeWhile(GString self, @ClosureParams(value=SimpleType.class, options=\"char\") Closure condition) {\n return (String) takeWhile(self.toString(), condition);\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 void addRequiredValues(@Nonnull final Values sourceValues) {\n Object taskDirectory = sourceValues.getObject(TASK_DIRECTORY_KEY, Object.class);\n MfClientHttpRequestFactoryProvider requestFactoryProvider =\n sourceValues.getObject(CLIENT_HTTP_REQUEST_FACTORY_KEY,\n MfClientHttpRequestFactoryProvider.class);\n Template template = sourceValues.getObject(TEMPLATE_KEY, Template.class);\n PDFConfig pdfConfig = sourceValues.getObject(PDF_CONFIG_KEY, PDFConfig.class);\n String subReportDir = sourceValues.getString(SUBREPORT_DIR_KEY);\n\n this.values.put(TASK_DIRECTORY_KEY, taskDirectory);\n this.values.put(CLIENT_HTTP_REQUEST_FACTORY_KEY, requestFactoryProvider);\n this.values.put(TEMPLATE_KEY, template);\n this.values.put(PDF_CONFIG_KEY, pdfConfig);\n this.values.put(SUBREPORT_DIR_KEY, subReportDir);\n this.values.put(VALUES_KEY, this);\n this.values.put(JOB_ID_KEY, sourceValues.getString(JOB_ID_KEY));\n this.values.put(LOCALE_KEY, sourceValues.getObject(LOCALE_KEY, Locale.class));\n }",
"public UriComponentsBuilder queryParams(MultiValueMap<String, String> params) {\n\t\tAssert.notNull(params, \"'params' must not be null\");\n\t\tthis.queryParams.putAll(params);\n\t\treturn this;\n\t}",
"public void clear() {\n if (arrMask != null) {\n for (int y = 0; y < height; y++) {\n for (int x = 0; x < width; x++) {\n arrMask[x][y] = false;\n }\n }\n }\n }",
"private static X509Certificate getReqSigCert(Message message) {\n\t\tList<WSHandlerResult> results = \n CastUtils.cast((List<?>)\n message.getExchange().getInMessage().get(WSHandlerConstants.RECV_RESULTS));\n\n if (results == null) {\n \treturn null;\n }\n \n /*\n\t\t * Scan the results for a matching actor. Use results only if the\n\t\t * receiving Actor and the sending Actor match.\n\t\t */\n\t\tfor (WSHandlerResult rResult : results) {\n\t\t\tList<WSSecurityEngineResult> wsSecEngineResults = rResult\n\t\t\t\t\t.getResults();\n\t\t\t/*\n\t\t\t * Scan the results for the first Signature action. Use the\n\t\t\t * certificate of this Signature to set the certificate for the\n\t\t\t * encryption action :-).\n\t\t\t */\n\t\t\tfor (WSSecurityEngineResult wser : wsSecEngineResults) {\n\t\t\t\tInteger actInt = (Integer) wser\n\t\t\t\t\t\t.get(WSSecurityEngineResult.TAG_ACTION);\n\t\t\t\tif (actInt.intValue() == WSConstants.SIGN) {\n\t\t\t\t\treturn (X509Certificate) wser\n\t\t\t\t\t\t\t.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}",
"public OperationBuilder addInputStream(final InputStream in) {\n Assert.checkNotNullParam(\"in\", in);\n if (inputStreams == null) {\n inputStreams = new ArrayList<InputStream>();\n }\n inputStreams.add(in);\n return this;\n }",
"public static Set<Map<String, Object>> setify(ObjectMapper mapper, Object source) {\n return (Set<Map<String, Object>>) collectify(mapper, source, Set.class);\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 }"
] |
Used to ensure that the general footer label will be at the same Y position as the variables in the band.
@param band
@return | [
"private int findYOffsetForGroupLabel(JRDesignBand band) {\n\t\tint offset = 0;\n\t\tfor (JRChild jrChild : band.getChildren()) {\n\t\t\tJRDesignElement elem = (JRDesignElement) jrChild;\n\t\t\tif (elem.getKey() != null && elem.getKey().startsWith(\"variable_for_column_\")) {\n\t\t\t\toffset = elem.getY();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn offset;\n\t}"
] | [
"private void readProjectProperties(Document cdp)\n {\n WorkspaceProperties props = cdp.getWorkspaceProperties();\n ProjectProperties mpxjProps = m_projectFile.getProjectProperties();\n mpxjProps.setSymbolPosition(props.getCurrencyPosition());\n mpxjProps.setCurrencyDigits(props.getCurrencyDigits());\n mpxjProps.setCurrencySymbol(props.getCurrencySymbol());\n mpxjProps.setDaysPerMonth(props.getDaysPerMonth());\n mpxjProps.setMinutesPerDay(props.getHoursPerDay());\n mpxjProps.setMinutesPerWeek(props.getHoursPerWeek());\n\n m_workHoursPerDay = mpxjProps.getMinutesPerDay().doubleValue() / 60.0;\n }",
"public final static String process(final String input, final Configuration configuration)\n {\n try\n {\n return process(new StringReader(input), configuration);\n }\n catch (final IOException e)\n {\n // This _can never_ happen\n return null;\n }\n }",
"@SuppressWarnings({\"WeakerAccess\", \"unused\"}) // For library users\n public void enableKeyboardAutoHiding() {\n keyboardListener = new OnScrollListener() {\n @Override\n public void onScrolled(RecyclerView recyclerView, int dx, int dy) {\n if (dx != 0 || dy != 0) {\n imeManager.hideSoftInputFromWindow(\n Hits.this.getWindowToken(),\n InputMethodManager.HIDE_NOT_ALWAYS);\n }\n super.onScrolled(recyclerView, dx, dy);\n }\n };\n addOnScrollListener(keyboardListener);\n }",
"@Override\n protected void addBuildInfoProperties(BuildInfoBuilder builder) {\n if (envVars != null) {\n for (Map.Entry<String, String> entry : envVars.entrySet()) {\n builder.addProperty(BuildInfoProperties.BUILD_INFO_ENVIRONMENT_PREFIX + entry.getKey(), entry.getValue());\n }\n }\n\n if (sysVars != null) {\n for (Map.Entry<String, String> entry : sysVars.entrySet()) {\n builder.addProperty(entry.getKey(), entry.getValue());\n }\n }\n }",
"public List<WbSearchEntitiesResult> wbSearchEntities(String search, String language,\n Boolean strictLanguage, String type, Long limit, Long offset)\n throws MediaWikiApiErrorException {\n\n Map<String, String> parameters = new HashMap<String, String>();\n parameters.put(ApiConnection.PARAM_ACTION, \"wbsearchentities\");\n\n if (search != null) {\n parameters.put(\"search\", search);\n } else {\n throw new IllegalArgumentException(\n \"Search parameter must be specified for this action.\");\n }\n\n if (language != null) {\n parameters.put(\"language\", language);\n } else {\n throw new IllegalArgumentException(\n \"Language parameter must be specified for this action.\");\n }\n if (strictLanguage != null) {\n parameters.put(\"strictlanguage\", Boolean.toString(strictLanguage));\n }\n\n if (type != null) {\n parameters.put(\"type\", type);\n }\n\n if (limit != null) {\n parameters.put(\"limit\", Long.toString(limit));\n }\n\n if (offset != null) {\n parameters.put(\"continue\", Long.toString(offset));\n }\n\n List<WbSearchEntitiesResult> results = new ArrayList<>();\n\n try {\n JsonNode root = this.connection.sendJsonRequest(\"POST\", parameters);\n JsonNode entities = root.path(\"search\");\n for (JsonNode entityNode : entities) {\n try {\n JacksonWbSearchEntitiesResult ed = mapper.treeToValue(entityNode,\n JacksonWbSearchEntitiesResult.class);\n results.add(ed);\n } catch (JsonProcessingException e) {\n LOGGER.error(\"Error when reading JSON for entity \"\n + entityNode.path(\"id\").asText(\"UNKNOWN\") + \": \"\n + e.toString());\n }\n }\n } catch (IOException e) {\n LOGGER.error(\"Could not retrive data: \" + e.toString());\n }\n\n return results;\n }",
"private void setViewPagerScroller() {\n try {\n Field scrollerField = ViewPager.class.getDeclaredField(\"mScroller\");\n scrollerField.setAccessible(true);\n Field interpolatorField = ViewPager.class.getDeclaredField(\"sInterpolator\");\n interpolatorField.setAccessible(true);\n\n scroller = new CustomDurationScroller(getContext(), (Interpolator)interpolatorField.get(null));\n scrollerField.set(this, scroller);\n } catch (Exception e) {\n e.printStackTrace();\n }\n }",
"public static final Duration parseDurationInThousanthsOfMinutes(ProjectProperties properties, Number value, TimeUnit targetTimeUnit)\n {\n return parseDurationInFractionsOfMinutes(properties, value, targetTimeUnit, 1000);\n }",
"private String extractAndConvertTaskType(Task task)\n {\n String activityType = (String) task.getCachedValue(m_activityTypeField);\n if (activityType == null)\n {\n activityType = \"Resource Dependent\";\n }\n else\n {\n if (ACTIVITY_TYPE_MAP.containsKey(activityType))\n {\n activityType = ACTIVITY_TYPE_MAP.get(activityType);\n }\n }\n return activityType;\n }",
"public 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}"
] |
Parse the XML for a collection as returned by getTree call.
@param collectionElement
@return | [
"private Collection parseTreeCollection(Element collectionElement) {\n\n Collection collection = new Collection();\n parseCommonFields(collectionElement, collection);\n collection.setTitle(collectionElement.getAttribute(\"title\"));\n collection.setDescription(collectionElement.getAttribute(\"description\"));\n\n // Collections can contain either sets or collections (but not both)\n NodeList childCollectionElements = collectionElement.getElementsByTagName(\"collection\");\n for (int i = 0; i < childCollectionElements.getLength(); i++) {\n Element childCollectionElement = (Element) childCollectionElements.item(i);\n collection.addCollection(parseTreeCollection(childCollectionElement));\n }\n\n NodeList childPhotosetElements = collectionElement.getElementsByTagName(\"set\");\n for (int i = 0; i < childPhotosetElements.getLength(); i++) {\n Element childPhotosetElement = (Element) childPhotosetElements.item(i);\n collection.addPhotoset(createPhotoset(childPhotosetElement));\n }\n\n return collection;\n }"
] | [
"static ChangeEvent<BsonDocument> changeEventForLocalInsert(\n final MongoNamespace namespace,\n final BsonDocument document,\n final boolean writePending\n ) {\n final BsonValue docId = BsonUtils.getDocumentId(document);\n return new ChangeEvent<>(\n new BsonDocument(),\n OperationType.INSERT,\n document,\n namespace,\n new BsonDocument(\"_id\", docId),\n null,\n writePending);\n }",
"public static double huntKennedyCMSFloorValue(\n\t\t\tdouble forwardSwaprate,\n\t\t\tdouble volatility,\n\t\t\tdouble swapAnnuity,\n\t\t\tdouble optionMaturity,\n\t\t\tdouble swapMaturity,\n\t\t\tdouble payoffUnit,\n\t\t\tdouble optionStrike)\n\t{\n\t\tdouble huntKennedyCMSOptionValue = huntKennedyCMSOptionValue(forwardSwaprate, volatility, swapAnnuity, optionMaturity, swapMaturity, payoffUnit, optionStrike);\n\n\t\t// A floor is an option plus the strike (max(X,K) = max(X-K,0) + K)\n\t\treturn huntKennedyCMSOptionValue + optionStrike * payoffUnit;\n\t}",
"private void writeBufferedValsToStorage() {\n List<Versioned<byte[]>> obsoleteVals = storageEngine.multiVersionPut(currBufferedKey,\n currBufferedVals);\n // log Obsolete versions in debug mode\n if(logger.isDebugEnabled() && obsoleteVals.size() > 0) {\n logger.debug(\"updateEntries (Streaming multi-version-put) rejected these versions as obsolete : \"\n + StoreUtils.getVersions(obsoleteVals) + \" for key \" + currBufferedKey);\n }\n currBufferedVals = new ArrayList<Versioned<byte[]>>(VALS_BUFFER_EXPECTED_SIZE);\n }",
"public GVRAnimator start(int animIndex)\n {\n if ((animIndex < 0) || (animIndex >= mAnimations.size()))\n {\n throw new IndexOutOfBoundsException(\"Animation index out of bounds\");\n }\n GVRAnimator anim = mAnimations.get(animIndex);\n start(anim);\n return anim;\n }",
"public synchronized void addRange(final float range, final GVRSceneObject sceneObject)\n {\n if (null == sceneObject) {\n throw new IllegalArgumentException(\"sceneObject must be specified!\");\n }\n if (range < 0) {\n throw new IllegalArgumentException(\"range cannot be negative\");\n }\n\n final int size = mRanges.size();\n final float rangePow2 = range*range;\n final Object[] newElement = new Object[] {rangePow2, sceneObject};\n\n for (int i = 0; i < size; ++i) {\n final Object[] el = mRanges.get(i);\n final Float r = (Float)el[0];\n if (r > rangePow2) {\n mRanges.add(i, newElement);\n break;\n }\n }\n\n if (mRanges.size() == size) {\n mRanges.add(newElement);\n }\n\n final GVRSceneObject owner = getOwnerObject();\n if (null != owner) {\n owner.addChildObject(sceneObject);\n }\n }",
"@Override\n public ModelNode resolveValue(ExpressionResolver resolver, ModelNode value) throws OperationFailedException {\n\n // Pass non-LIST values through the superclass so it can reject weird values and, in the odd chance\n // that's how this object is set up, turn undefined into a default list value.\n ModelNode superResult = value.getType() == ModelType.LIST ? value : super.resolveValue(resolver, value);\n\n // If it's not a LIST (almost certainly UNDEFINED), then nothing more we can do\n if (superResult.getType() != ModelType.LIST) {\n return superResult;\n }\n // Resolve each element.\n // Don't mess with the original value\n ModelNode clone = superResult == value ? value.clone() : superResult;\n ModelNode result = new ModelNode();\n result.setEmptyList();\n for (ModelNode element : clone.asList()) {\n result.add(valueType.resolveValue(resolver, element));\n }\n // Validate the entire list\n getValidator().validateParameter(getName(), result);\n return result;\n }",
"GVRShader makeTemplate(Class<? extends GVRShader> id, GVRContext ctx)\n {\n try\n {\n Constructor<? extends GVRShader> maker = id.getDeclaredConstructor(GVRContext.class);\n return maker.newInstance(ctx);\n }\n catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException ex)\n {\n try\n {\n Constructor<? extends GVRShader> maker = id.getDeclaredConstructor();\n return maker.newInstance();\n }\n catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException ex2)\n {\n ctx.getEventManager().sendEvent(ctx, IErrorEvents.class, \"onError\", new Object[] {ex2.getMessage(), this});\n return null;\n }\n }\n }",
"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 }",
"void gc() {\n if (stopped) {\n return;\n }\n long expirationTime = System.currentTimeMillis() - timeout;\n for (Iterator<Map.Entry<InputStreamKey, TimedStreamEntry>> iter = streamMap.entrySet().iterator(); iter.hasNext();) {\n if (stopped) {\n return;\n }\n Map.Entry<InputStreamKey, TimedStreamEntry> entry = iter.next();\n TimedStreamEntry timedStreamEntry = entry.getValue();\n if (timedStreamEntry.timestamp.get() <= expirationTime) {\n iter.remove();\n InputStreamKey key = entry.getKey();\n //noinspection SynchronizationOnLocalVariableOrMethodParameter\n synchronized (timedStreamEntry) { // ensure there's no race with a request that got a ref before we removed it\n closeStreamEntry(timedStreamEntry, key.requestId, key.index);\n }\n }\n }\n }"
] |
Private helper function that performs some assignability checks for the
provided GenericArrayType. | [
"private static boolean isAssignableFrom(Type from, GenericArrayType to) {\n\t\tType toGenericComponentType = to.getGenericComponentType();\n\t\tif (toGenericComponentType instanceof ParameterizedType) {\n\t\t\tType t = from;\n\t\t\tif (from instanceof GenericArrayType) {\n\t\t\t\tt = ((GenericArrayType) from).getGenericComponentType();\n\t\t\t} else if (from instanceof Class) {\n\t\t\t\tClass<?> classType = (Class<?>) from;\n\t\t\t\twhile (classType.isArray()) {\n\t\t\t\t\tclassType = classType.getComponentType();\n\t\t\t\t}\n\t\t\t\tt = classType;\n\t\t\t}\n\t\t\treturn isAssignableFrom(t,\n\t\t\t\t\t(ParameterizedType) toGenericComponentType,\n\t\t\t\t\tnew HashMap<String, Type>());\n\t\t}\n\t\t// No generic defined on \"to\"; therefore, return true and let other\n\t\t// checks determine assignability\n\t\treturn true;\n\t}"
] | [
"private void listGreetings(String guestbookName) throws DatastoreException {\n Query.Builder query = Query.newBuilder();\n query.addKindBuilder().setName(GREETING_KIND);\n query.setFilter(makeFilter(KEY_PROPERTY, PropertyFilter.Operator.HAS_ANCESTOR,\n makeValue(makeKey(GUESTBOOK_KIND, guestbookName))));\n query.addOrder(makeOrder(DATE_PROPERTY, PropertyOrder.Direction.DESCENDING));\n\n List<Entity> greetings = runQuery(query.build());\n if (greetings.size() == 0) {\n System.out.println(\"no greetings in \" + guestbookName);\n }\n for (Entity greeting : greetings) {\n Map<String, Value> propertyMap = greeting.getProperties();\n System.out.println(\n DatastoreHelper.toDate(propertyMap.get(DATE_PROPERTY)) + \": \" +\n DatastoreHelper.getString(propertyMap.get(USER_PROPERTY)) + \" says \" +\n DatastoreHelper.getString(propertyMap.get(MESSAGE_PROPERTY)));\n }\n }",
"protected String classOf(List<IN> lineInfos, int pos) {\r\n Datum<String, String> d = makeDatum(lineInfos, pos, featureFactory);\r\n return classifier.classOf(d);\r\n }",
"public IntBuffer getIntVec(String attributeName)\n {\n int size = getAttributeSize(attributeName);\n if (size <= 0)\n {\n return null;\n }\n size *= 4 * getVertexCount();\n ByteBuffer buffer = ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder());\n IntBuffer data = buffer.asIntBuffer();\n if (!NativeVertexBuffer.getIntVec(getNative(), attributeName, data, 0, 0))\n {\n throw new IllegalArgumentException(\"Attribute name \" + attributeName + \" cannot be accessed\");\n }\n return data;\n }",
"public static JRDesignExpression getReportConnectionExpression() {\n JRDesignExpression connectionExpression = new JRDesignExpression();\n connectionExpression.setText(\"$P{\" + JRDesignParameter.REPORT_CONNECTION + \"}\");\n connectionExpression.setValueClass(Connection.class);\n return connectionExpression;\n }",
"public void addRegexRoute(String urlPattern, Class<? extends Actor> actorClass) throws RouteAlreadyMappedException {\n addRoute(new Route(urlPattern, true), actorClass);\n }",
"public void viewDocument(DocumentEntry entry)\n {\n InputStream is = null;\n\n try\n {\n is = new DocumentInputStream(entry);\n byte[] data = new byte[is.available()];\n is.read(data);\n m_model.setData(data);\n updateTables();\n }\n\n catch (IOException ex)\n {\n throw new RuntimeException(ex);\n }\n\n finally\n {\n StreamHelper.closeQuietly(is);\n }\n\n }",
"public MaterializeBuilder withActivity(Activity activity) {\n this.mRootView = (ViewGroup) activity.findViewById(android.R.id.content);\n this.mActivity = activity;\n return this;\n }",
"private static Class getClassForClassNode(ClassNode type) {\r\n // todo hamlet - move to a different \"InferenceUtil\" object\r\n Class primitiveType = getPrimitiveType(type);\r\n if (primitiveType != null) {\r\n return primitiveType;\r\n } else if (classNodeImplementsType(type, String.class)) {\r\n return String.class;\r\n } else if (classNodeImplementsType(type, ReentrantLock.class)) {\r\n return ReentrantLock.class;\r\n } else if (type.getName() != null && type.getName().endsWith(\"[]\")) {\r\n return Object[].class; // better type inference could be done, but oh well\r\n }\r\n return null;\r\n }",
"public static Set<Dependency> getAllDependencies(final Module module, final List<String> producedArtifacts) {\n final Set<Dependency> dependencies = new HashSet<Dependency>();\n\n for(final Dependency dependency: module.getDependencies()){\n if(!producedArtifacts.contains(dependency.getTarget().getGavc())){\n dependencies.add(dependency);\n }\n }\n\n for(final Module subModule: module.getSubmodules()){\n dependencies.addAll(getAllDependencies(subModule, producedArtifacts));\n }\n\n return dependencies;\n }"
] |
Retrieves the work variance.
@return work variance | [
"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 }"
] | [
"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}",
"boolean applyDomainModel(ModelNode result) {\n if(! result.hasDefined(ModelDescriptionConstants.RESULT)) {\n return false;\n }\n final List<ModelNode> bootOperations= result.get(ModelDescriptionConstants.RESULT).asList();\n return callback.applyDomainModel(bootOperations);\n }",
"public void setHomeAsUpIndicator(Drawable indicator) {\n if(!deviceSupportMultiPane()) {\n pulsante.setHomeAsUpIndicator(indicator);\n }\n else {\n actionBar.setHomeAsUpIndicator(indicator);\n }\n }",
"public static Properties loadProperties(String[] filesToLoad)\n {\n Properties p = new Properties();\n InputStream fis = null;\n for (String path : filesToLoad)\n {\n try\n {\n fis = Db.class.getClassLoader().getResourceAsStream(path);\n if (fis != null)\n {\n p.load(fis);\n jqmlogger.info(\"A jqm.properties file was found at {}\", path);\n }\n }\n catch (IOException e)\n {\n // We allow no configuration files, but not an unreadable configuration file.\n throw new DatabaseException(\"META-INF/jqm.properties file is invalid\", e);\n }\n finally\n {\n closeQuietly(fis);\n }\n }\n\n // Overload the datasource name from environment variable if any (tests only).\n String dbName = System.getenv(\"DB\");\n if (dbName != null)\n {\n p.put(\"com.enioka.jqm.jdbc.datasource\", \"jdbc/\" + dbName);\n }\n\n // Done\n return p;\n }",
"public int getCostRateTableIndex()\n {\n Integer value = (Integer) getCachedValue(AssignmentField.COST_RATE_TABLE);\n return value == null ? 0 : value.intValue();\n }",
"public NamespacesList<Pair> getPairs(String namespace, String predicate, int perPage, int page) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n NamespacesList<Pair> nsList = new NamespacesList<Pair>();\r\n parameters.put(\"method\", METHOD_GET_PAIRS);\r\n\r\n if (namespace != null) {\r\n parameters.put(\"namespace\", namespace);\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(\"pair\");\r\n nsList.setPage(nsElement.getAttribute(\"page\"));\r\n nsList.setPages(nsElement.getAttribute(\"pages\"));\r\n nsList.setPerPage(nsElement.getAttribute(\"perPage\"));\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(parsePair(element));\r\n }\r\n return nsList;\r\n }",
"public static GVRMesh createQuad(GVRContext gvrContext, float width, float height) {\n GVRMesh mesh = new GVRMesh(gvrContext);\n\n float[] vertices = { width * -0.5f, height * 0.5f, 0.0f, width * -0.5f,\n height * -0.5f, 0.0f, width * 0.5f, height * 0.5f, 0.0f,\n width * 0.5f, height * -0.5f, 0.0f };\n mesh.setVertices(vertices);\n\n final float[] normals = { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.0f, 1.0f, 0.0f, 0.0f, 1.0f };\n mesh.setNormals(normals);\n\n final float[] texCoords = { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,\n 1.0f };\n mesh.setTexCoords(texCoords);\n\n char[] triangles = { 0, 1, 2, 1, 3, 2 };\n mesh.setIndices(triangles);\n\n return mesh;\n }",
"public static StitchAppClient getAppClient(\n @Nonnull final String clientAppId\n ) {\n ensureInitialized();\n\n synchronized (Stitch.class) {\n if (!appClients.containsKey(clientAppId)) {\n throw new IllegalStateException(\n String.format(\"client for app '%s' has not yet been initialized\", clientAppId));\n }\n return appClients.get(clientAppId);\n }\n }",
"private void setObjectForStatement(PreparedStatement stmt, int index, Object value, int sqlType)\r\n throws SQLException\r\n {\r\n if (value == null)\r\n {\r\n m_platform.setNullForStatement(stmt, index, sqlType);\r\n }\r\n else\r\n {\r\n m_platform.setObjectForStatement(stmt, index, value, sqlType);\r\n }\r\n }"
] |
Helper method for formatting connection establishment messages.
@param connectionName
The name of the connection
@param host
The remote host
@param connectionReason
The reason for establishing the connection
@return A formatted message in the format:
"[<connectionName>] remote host[<host>] <connectionReason>"
<br/>
e.g. [con1] remote host[123.123.123.123] connection to ECMG. | [
"public static String formatConnectionEstablishmentMessage(final String connectionName, final String host, final String connectionReason) {\n\t\treturn CON_ESTABLISHMENT_FORMAT.format(new Object[] { connectionName, host, connectionReason });\n\t}"
] | [
"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 }",
"protected void rehash(int newCapacity) {\r\n\tint oldCapacity = table.length;\r\n\t//if (oldCapacity == newCapacity) return;\r\n\t\r\n\tlong oldTable[] = table;\r\n\tint oldValues[] = values;\r\n\tbyte oldState[] = state;\r\n\r\n\tlong newTable[] = new long[newCapacity];\r\n\tint newValues[] = new int[newCapacity];\r\n\tbyte newState[] = new byte[newCapacity];\r\n\r\n\tthis.lowWaterMark = chooseLowWaterMark(newCapacity,this.minLoadFactor);\r\n\tthis.highWaterMark = chooseHighWaterMark(newCapacity,this.maxLoadFactor);\r\n\r\n\tthis.table = newTable;\r\n\tthis.values = newValues;\r\n\tthis.state = newState;\r\n\tthis.freeEntries = newCapacity-this.distinct; // delta\r\n\t\r\n\tfor (int i = oldCapacity ; i-- > 0 ;) {\r\n\t\tif (oldState[i]==FULL) {\r\n\t\t\tlong element = oldTable[i];\r\n\t\t\tint index = indexOfInsertion(element);\r\n\t\t\tnewTable[index]=element;\r\n\t\t\tnewValues[index]=oldValues[i];\r\n\t\t\tnewState[index]=FULL;\r\n\t\t}\r\n\t}\r\n}",
"public static CmsPair<String, Map<String, String>> parseEmbeddedGalleryOptions(String configuration) {\n\n final Map<String, String> galleryOptions = Maps.newHashMap();\n String resultConfig = CmsStringUtil.substitute(\n PATTERN_EMBEDDED_GALLERY_CONFIG,\n configuration,\n new I_CmsRegexSubstitution() {\n\n public String substituteMatch(String string, Matcher matcher) {\n\n String galleryName = string.substring(matcher.start(1), matcher.end(1));\n String embeddedConfig = string.substring(matcher.start(2), matcher.end(2));\n galleryOptions.put(galleryName, embeddedConfig);\n return galleryName;\n }\n });\n return CmsPair.create(resultConfig, galleryOptions);\n }",
"public final void setOrientation(int orientation) {\n mOrientation = orientation;\n mOrientationState = getOrientationStateFromParam(mOrientation);\n invalidate();\n if (mOuterAdapter != null) {\n mOuterAdapter.setOrientation(mOrientation);\n }\n\n }",
"private static CmsUUID toUuid(String uuid) {\n\n if (\"null\".equals(uuid) || CmsStringUtil.isEmpty(uuid)) {\n return null;\n }\n return new CmsUUID(uuid);\n\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 isSpreadSafe(Expression expression) {\r\n if (expression instanceof MethodCallExpression) {\r\n return ((MethodCallExpression) expression).isSpreadSafe();\r\n }\r\n if (expression instanceof PropertyExpression) {\r\n return ((PropertyExpression) expression).isSpreadSafe();\r\n }\r\n return false;\r\n }",
"protected void updatePicker(MotionEvent event, boolean isActive)\n {\n final MotionEvent newEvent = (event != null) ? event : null;\n final ControllerPick controllerPick = new ControllerPick(mPicker, newEvent, isActive);\n context.runOnGlThread(controllerPick);\n }",
"public static Chart getTrajectoryChart(String title, Trajectory t){\n\t\tif(t.getDimension()==2){\n\t\t \tdouble[] xData = new double[t.size()];\n\t\t double[] yData = new double[t.size()];\n\t\t for(int i = 0; i < t.size(); i++){\n\t\t \txData[i] = t.get(i).x;\n\t\t \tyData[i] = t.get(i).y;\n\t\t \t\n\t\t }\n\t\t // Create Chart\n\t\t Chart chart = QuickChart.getChart(title, \"X\", \"Y\", \"y(x)\", xData, yData);\n\t\n\t\t return chart;\n\t\t //Show it\n\t\t // SwingWrapper swr = new SwingWrapper(chart);\n\t\t // swr.displayChart();\n\t\t} \n\t\treturn null;\n\t}"
] |
Send a master changed announcement to all registered master listeners.
@param update the message announcing the new tempo master | [
"private void deliverMasterChangedAnnouncement(final DeviceUpdate update) {\n for (final MasterListener listener : getMasterListeners()) {\n try {\n listener.masterChanged(update);\n } catch (Throwable t) {\n logger.warn(\"Problem delivering master changed announcement to listener\", t);\n }\n }\n }"
] | [
"public static void addActionsTo(\n SourceBuilder code,\n Set<MergeAction> mergeActions,\n boolean forBuilder) {\n SetMultimap<String, String> nounsByVerb = TreeMultimap.create();\n mergeActions.forEach(mergeAction -> {\n if (forBuilder || !mergeAction.builderOnly) {\n nounsByVerb.put(mergeAction.verb, mergeAction.noun);\n }\n });\n List<String> verbs = ImmutableList.copyOf(nounsByVerb.keySet());\n String lastVerb = getLast(verbs, null);\n for (String verb : nounsByVerb.keySet()) {\n code.add(\", %s%s\", (verbs.size() > 1 && verb.equals(lastVerb)) ? \"and \" : \"\", verb);\n List<String> nouns = ImmutableList.copyOf(nounsByVerb.get(verb));\n for (int i = 0; i < nouns.size(); ++i) {\n String separator = (i == 0) ? \"\" : (i == nouns.size() - 1) ? \" and\" : \",\";\n code.add(\"%s %s\", separator, nouns.get(i));\n }\n }\n }",
"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 }",
"private static void checkPreconditions(final Map<Object, Object> mapping) {\n\t\tif( mapping == null ) {\n\t\t\tthrow new NullPointerException(\"mapping should not be null\");\n\t\t} else if( mapping.isEmpty() ) {\n\t\t\tthrow new IllegalArgumentException(\"mapping should not be empty\");\n\t\t}\n\t}",
"public TransformersSubRegistration getServerRegistration(final ModelVersionRange range) {\n final PathAddress address = PathAddress.EMPTY_ADDRESS.append(HOST, SERVER);\n return new TransformersSubRegistrationImpl(range, domain, address);\n }",
"public static final PhotoList<Photo> createPhotoList(Element photosElement) {\r\n PhotoList<Photo> photos = new PhotoList<Photo>();\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 ServiceName moduleResolvedServiceName(ModuleIdentifier identifier) {\n if (!isDynamicModule(identifier)) {\n throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX);\n }\n return MODULE_RESOLVED_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot());\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 }",
"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 static Element getChild(Element element, String name) {\r\n return (Element) element.getElementsByTagName(name).item(0);\r\n }"
] |
Generates a comment regarding the parameters.
@param entityId - id of the commented entity
@param entityType - type of the entity
@param action - the action performed by the user
@param commentedText - comment text
@param user - comment left by
@param date - date comment was created
@return - comment entity | [
"public static Comment createComment(final String entityId,\n\t\t\t\t\t\t\t\t\t\tfinal String entityType,\n\t\t\t\t\t\t\t\t\t\tfinal String action,\n\t\t\t\t\t\t\t\t\t\tfinal String commentedText,\n\t\t\t\t\t\t\t\t\t\tfinal String user,\n\t\t\t\t\t\t\t\t\t\tfinal Date date) {\n\n\t\tfinal Comment comment = new Comment();\n\t\tcomment.setEntityId(entityId);\n\t\tcomment.setEntityType(entityType);\n\t\tcomment.setAction(action);\n\t\tcomment.setCommentText(commentedText);\n\t\tcomment.setCommentedBy(user);\n\t\tcomment.setCreatedDateTime(date);\n\t\treturn comment;\n\t}"
] | [
"public static int getPrecedence( int type, boolean throwIfInvalid ) {\n\n switch( type ) {\n\n case LEFT_PARENTHESIS:\n return 0;\n\n case EQUAL:\n case PLUS_EQUAL:\n case MINUS_EQUAL:\n case MULTIPLY_EQUAL:\n case DIVIDE_EQUAL:\n case INTDIV_EQUAL:\n case MOD_EQUAL:\n case POWER_EQUAL:\n case LOGICAL_OR_EQUAL:\n case LOGICAL_AND_EQUAL:\n case LEFT_SHIFT_EQUAL:\n case RIGHT_SHIFT_EQUAL:\n case RIGHT_SHIFT_UNSIGNED_EQUAL:\n case BITWISE_OR_EQUAL:\n case BITWISE_AND_EQUAL:\n case BITWISE_XOR_EQUAL:\n return 5;\n\n case QUESTION:\n return 10;\n\n case LOGICAL_OR:\n return 15;\n\n case LOGICAL_AND:\n return 20;\n\n case BITWISE_OR:\n case BITWISE_AND:\n case BITWISE_XOR:\n return 22;\n\n case COMPARE_IDENTICAL:\n case COMPARE_NOT_IDENTICAL:\n return 24;\n\n case COMPARE_NOT_EQUAL:\n case COMPARE_EQUAL:\n case COMPARE_LESS_THAN:\n case COMPARE_LESS_THAN_EQUAL:\n case COMPARE_GREATER_THAN:\n case COMPARE_GREATER_THAN_EQUAL:\n case COMPARE_TO:\n case FIND_REGEX:\n case MATCH_REGEX:\n case KEYWORD_INSTANCEOF:\n return 25;\n\n case DOT_DOT:\n case DOT_DOT_DOT:\n return 30;\n\n case LEFT_SHIFT:\n case RIGHT_SHIFT:\n case RIGHT_SHIFT_UNSIGNED:\n return 35;\n\n case PLUS:\n case MINUS:\n return 40;\n\n case MULTIPLY:\n case DIVIDE:\n case INTDIV:\n case MOD:\n return 45;\n\n case NOT:\n case REGEX_PATTERN:\n return 50;\n\n case SYNTH_CAST:\n return 55;\n\n case PLUS_PLUS:\n case MINUS_MINUS:\n case PREFIX_PLUS_PLUS:\n case PREFIX_MINUS_MINUS:\n case POSTFIX_PLUS_PLUS:\n case POSTFIX_MINUS_MINUS:\n return 65;\n\n case PREFIX_PLUS:\n case PREFIX_MINUS:\n return 70;\n\n case POWER:\n return 72;\n\n case SYNTH_METHOD:\n case LEFT_SQUARE_BRACKET:\n return 75;\n\n case DOT:\n case NAVIGATE:\n return 80;\n\n case KEYWORD_NEW:\n return 85;\n }\n\n if( throwIfInvalid ) {\n throw new GroovyBugError( \"precedence requested for non-operator\" );\n }\n\n return -1;\n }",
"@Deprecated\n public static TraceContextHolder wrap(TraceContext traceContext) {\n return (traceContext != null) ? new TraceContextHolder(traceContext) : TraceContextHolder.EMPTY;\n }",
"void writeBestRankTriples() {\n\t\tfor (Resource resource : this.rankBuffer.getBestRankedStatements()) {\n\t\t\ttry {\n\t\t\t\tthis.rdfWriter.writeTripleUriObject(resource,\n\t\t\t\t\t\tRdfWriter.RDF_TYPE, RdfWriter.WB_BEST_RANK.toString());\n\t\t\t} catch (RDFHandlerException e) {\n\t\t\t\tthrow new RuntimeException(e.getMessage(), e);\n\t\t\t}\n\t\t}\n\t\tthis.rankBuffer.clear();\n\t}",
"@Nullable\n public StitchUserT getUser() {\n authLock.readLock().lock();\n try {\n return activeUser;\n } finally {\n authLock.readLock().unlock();\n }\n }",
"public static ResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) {\n StringBuilder prefix = new StringBuilder(SUBSYSTEM_NAME);\n for (String kp : keyPrefix) {\n prefix.append('.').append(kp);\n }\n return new StandardResourceDescriptionResolver(prefix.toString(), RESOURCE_NAME, LoggingExtension.class.getClassLoader(), true, false) {\n @Override\n public String getOperationParameterDescription(final String operationName, final String paramName, final Locale locale, final ResourceBundle bundle) {\n if (DELEGATE_DESC_OPTS.contains(operationName)) {\n return getResourceAttributeDescription(paramName, locale, bundle);\n }\n return super.getOperationParameterDescription(operationName, paramName, locale, bundle);\n }\n\n @Override\n public String getOperationParameterValueTypeDescription(final String operationName, final String paramName, final Locale locale,\n final ResourceBundle bundle, final String... suffixes) {\n if (DELEGATE_DESC_OPTS.contains(operationName)) {\n return getResourceAttributeDescription(paramName, locale, bundle);\n }\n return super.getOperationParameterValueTypeDescription(operationName, paramName, locale, bundle, suffixes);\n }\n\n @Override\n public String getOperationParameterDeprecatedDescription(final String operationName, final String paramName, final Locale locale, final ResourceBundle bundle) {\n if (DELEGATE_DESC_OPTS.contains(operationName)) {\n return getResourceAttributeDeprecatedDescription(paramName, locale, bundle);\n }\n return super.getOperationParameterDeprecatedDescription(operationName, paramName, locale, bundle);\n }\n };\n }",
"private void processTasks(Gantt gantt)\n {\n ProjectCalendar calendar = m_projectFile.getDefaultCalendar();\n\n for (Gantt.Tasks.Task ganttTask : gantt.getTasks().getTask())\n {\n String wbs = ganttTask.getID();\n ChildTaskContainer parentTask = getParentTask(wbs);\n\n Task task = parentTask.addTask();\n //ganttTask.getB() // bar type\n //ganttTask.getBC() // bar color\n task.setCost(ganttTask.getC());\n task.setName(ganttTask.getContent());\n task.setDuration(ganttTask.getD());\n task.setDeadline(ganttTask.getDL());\n //ganttTask.getH() // height\n //ganttTask.getIn(); // indent\n task.setWBS(wbs);\n task.setPercentageComplete(ganttTask.getPC());\n task.setStart(ganttTask.getS());\n //ganttTask.getU(); // Unknown\n //ganttTask.getVA(); // Valign\n\n task.setFinish(calendar.getDate(task.getStart(), task.getDuration(), false));\n m_taskMap.put(wbs, task);\n }\n }",
"public final void notifyHeaderItemRangeChanged(int positionStart, int itemCount) {\n if (positionStart < 0 || itemCount < 0 || positionStart + itemCount >= headerItemCount) {\n throw new IndexOutOfBoundsException(\"The given range [\" + positionStart + \" - \" + (positionStart + itemCount - 1) + \"] is not within the position bounds for header items [0 - \" + (headerItemCount - 1) + \"].\");\n }\n notifyItemRangeChanged(positionStart, itemCount);\n }",
"public List<CmsUser> getVisibleUser() {\n\n if (!m_fullyLoaded) {\n return m_users;\n }\n if (size() == m_users.size()) {\n return m_users;\n }\n List<CmsUser> directs = new ArrayList<CmsUser>();\n for (CmsUser user : m_users) {\n if (!m_indirects.contains(user)) {\n directs.add(user);\n }\n }\n return directs;\n }",
"public static nsdiameter get(nitro_service service) throws Exception{\n\t\tnsdiameter obj = new nsdiameter();\n\t\tnsdiameter[] response = (nsdiameter[])obj.get_resources(service);\n\t\treturn response[0];\n\t}"
] |
Write a Byte Order Mark at the beginning of the file
@param stream the FileOutputStream to write the BOM to
@param bigEndian true if UTF 16 Big Endian or false if Low Endian
@throws IOException if an IOException occurs.
@since 1.0 | [
"private static void writeUtf16Bom(OutputStream stream, boolean bigEndian) throws IOException {\n if (bigEndian) {\n stream.write(-2);\n stream.write(-1);\n } else {\n stream.write(-1);\n stream.write(-2);\n }\n }"
] | [
"public final PJsonObject optJSONObject(final String key) {\n final JSONObject val = this.obj.optJSONObject(key);\n return val != null ? new PJsonObject(this, val, key) : null;\n }",
"public static long getVisibilityCacheWeight(FluoConfiguration conf) {\n long size = conf.getLong(VISIBILITY_CACHE_WEIGHT, VISIBILITY_CACHE_WEIGHT_DEFAULT);\n if (size <= 0) {\n throw new IllegalArgumentException(\n \"Cache size must be positive for \" + VISIBILITY_CACHE_WEIGHT);\n }\n return size;\n }",
"public double getValue(int[] batch) {\n double value = 0.0;\n for (int i=0; i<batch.length; i++) {\n value += getValue(i);\n }\n return value;\n }",
"private void reorder()\r\n {\r\n if(getTransaction().isOrdering() && needsCommit && mhtObjectEnvelopes.size() > 1)\r\n {\r\n ObjectEnvelopeOrdering ordering = new ObjectEnvelopeOrdering(mvOrderOfIds, mhtObjectEnvelopes);\r\n ordering.reorder();\r\n Identity[] newOrder = ordering.getOrdering();\r\n\r\n mvOrderOfIds.clear();\r\n for(int i = 0; i < newOrder.length; i++)\r\n {\r\n mvOrderOfIds.add(newOrder[i]);\r\n }\r\n }\r\n }",
"public void setPatternScheme(final boolean isWeekDayBased) {\n\n if (isWeekDayBased ^ (null != m_model.getWeekDay())) {\n removeExceptionsOnChange(new Command() {\n\n public void execute() {\n\n if (isWeekDayBased) {\n m_model.setWeekDay(getPatternDefaultValues().getWeekDay());\n m_model.setWeekOfMonth(getPatternDefaultValues().getWeekOfMonth());\n } else {\n m_model.setWeekDay(null);\n m_model.setWeekOfMonth(null);\n }\n m_model.setMonth(getPatternDefaultValues().getMonth());\n m_model.setDayOfMonth(getPatternDefaultValues().getDayOfMonth());\n m_model.setInterval(getPatternDefaultValues().getInterval());\n onValueChange();\n }\n });\n }\n }",
"public void findMatch(ArrayList<String> speechResult) {\n\n loadCadidateString();\n\n for (String matchCandidate : speechResult) {\n\n Locale localeDefault = mGvrContext.getActivity().getResources().getConfiguration().locale;\n if (volumeUp.equals(matchCandidate)) {\n startVolumeUp();\n break;\n } else if (volumeDown.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {\n startVolumeDown();\n break;\n } else if (zoomIn.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {\n startZoomIn();\n break;\n } else if (zoomOut.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {\n startZoomOut();\n break;\n } else if (invertedColors.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {\n startInvertedColors();\n break;\n } else if (talkBack.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {\n enableTalkBack();\n } else if (disableTalkBack.toLowerCase(localeDefault).equals(matchCandidate.toLowerCase(localeDefault))) {\n disableTalkBack();\n }\n }\n }",
"public PreparedStatement getInsertStatement(ClassDescriptor cds) throws PersistenceBrokerSQLException, PersistenceBrokerException\r\n {\r\n try\r\n {\r\n return cds.getStatementsForClass(m_conMan).getInsertStmt(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 <T extends CoreLabel> Datum<String, String> makeDatum(List<IN> info, int loc, FeatureFactory featureFactory) {\r\n PaddedList<IN> pInfo = new PaddedList<IN>(info, pad);\r\n\r\n Collection<String> features = new ArrayList<String>();\r\n List<Clique> cliques = featureFactory.getCliques();\r\n for (Clique c : cliques) {\r\n Collection<String> feats = featureFactory.getCliqueFeatures(pInfo, loc, c);\r\n feats = addOtherClasses(feats, pInfo, loc, c);\r\n features.addAll(feats);\r\n }\r\n\r\n printFeatures(pInfo.get(loc), features);\r\n CoreLabel c = info.get(loc);\r\n return new BasicDatum<String, String>(features, c.get(AnswerAnnotation.class));\r\n }",
"public static TaskField getMpxjField(int value)\n {\n TaskField result = null;\n\n if (value >= 0 && value < MPX_MPXJ_ARRAY.length)\n {\n result = MPX_MPXJ_ARRAY[value];\n }\n\n return (result);\n }"
] |
Transposes a block matrix.
@param A Original matrix. Not modified.
@param A_tran Transposed matrix. Modified. | [
"public static DMatrixRBlock transpose(DMatrixRBlock A , DMatrixRBlock A_tran )\n {\n if( A_tran != null ) {\n if( A.numRows != A_tran.numCols || A.numCols != A_tran.numRows )\n throw new IllegalArgumentException(\"Incompatible dimensions.\");\n if( A.blockLength != A_tran.blockLength )\n throw new IllegalArgumentException(\"Incompatible block size.\");\n } else {\n A_tran = new DMatrixRBlock(A.numCols,A.numRows,A.blockLength);\n\n }\n\n for( int i = 0; i < A.numRows; i += A.blockLength ) {\n int blockHeight = Math.min( A.blockLength , A.numRows - i);\n\n for( int j = 0; j < A.numCols; j += A.blockLength ) {\n int blockWidth = Math.min( A.blockLength , A.numCols - j);\n\n int indexA = i*A.numCols + blockHeight*j;\n int indexC = j*A_tran.numCols + blockWidth*i;\n\n transposeBlock( A , A_tran , indexA , indexC , blockWidth , blockHeight );\n }\n }\n\n return A_tran;\n }"
] | [
"public GroovyMethodDoc[] methods() {\n Collections.sort(methods);\n return methods.toArray(new GroovyMethodDoc[methods.size()]);\n }",
"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 synchronized void setDeviceName(String name) {\n if (name.getBytes().length > DEVICE_NAME_LENGTH) {\n throw new IllegalArgumentException(\"name cannot be more than \" + DEVICE_NAME_LENGTH + \" bytes long\");\n }\n Arrays.fill(announcementBytes, DEVICE_NAME_OFFSET, DEVICE_NAME_LENGTH, (byte)0);\n System.arraycopy(name.getBytes(), 0, announcementBytes, DEVICE_NAME_OFFSET, name.getBytes().length);\n }",
"public void commitWorkingCopy(final String commitMessage) throws IOException, InterruptedException {\n build.getWorkspace().act(new SVNCommitWorkingCopyCallable(commitMessage, getLocation(),\n getSvnAuthenticationProvider(build), buildListener));\n }",
"protected static void appendHandler(LogRecordHandler parent, LogRecordHandler child){\r\n RecordHandlerTree p = handlers.find(parent);\r\n if(p != null){\r\n p.addChild(child);\r\n } else {\r\n throw new IllegalArgumentException(\"No such parent handler: \" + parent);\r\n }\r\n }",
"private void populateResourceAssignment(Record record, ResourceAssignment assignment) throws MPXJException\n {\n //\n // Handle malformed MPX files - ensure that we can locate the resource\n // using either the Unique ID attribute or the ID attribute.\n //\n Resource resource = m_projectFile.getResourceByUniqueID(record.getInteger(12));\n if (resource == null)\n {\n resource = m_projectFile.getResourceByID(record.getInteger(0));\n }\n\n assignment.setUnits(record.getUnits(1));\n assignment.setWork(record.getDuration(2));\n assignment.setBaselineWork(record.getDuration(3));\n assignment.setActualWork(record.getDuration(4));\n assignment.setOvertimeWork(record.getDuration(5));\n assignment.setCost(record.getCurrency(6));\n assignment.setBaselineCost(record.getCurrency(7));\n assignment.setActualCost(record.getCurrency(8));\n assignment.setStart(record.getDateTime(9));\n assignment.setFinish(record.getDateTime(10));\n assignment.setDelay(record.getDuration(11));\n\n //\n // Calculate the remaining work\n //\n Duration work = assignment.getWork();\n Duration actualWork = assignment.getActualWork();\n if (work != null && actualWork != null)\n {\n if (work.getUnits() != actualWork.getUnits())\n {\n actualWork = actualWork.convertUnits(work.getUnits(), m_projectFile.getProjectProperties());\n }\n\n assignment.setRemainingWork(Duration.getInstance(work.getDuration() - actualWork.getDuration(), work.getUnits()));\n }\n\n if (resource != null)\n {\n assignment.setResourceUniqueID(resource.getUniqueID());\n resource.addResourceAssignment(assignment);\n }\n\n m_eventManager.fireAssignmentReadEvent(assignment);\n }",
"public int evaluate(FieldContainer container)\n {\n //\n // First step - determine the list of criteria we are should use\n //\n List<GraphicalIndicatorCriteria> criteria;\n if (container instanceof Task)\n {\n Task task = (Task) container;\n if (NumberHelper.getInt(task.getUniqueID()) == 0)\n {\n if (m_projectSummaryInheritsFromSummaryRows == false)\n {\n criteria = m_projectSummaryCriteria;\n }\n else\n {\n if (m_summaryRowsInheritFromNonSummaryRows == false)\n {\n criteria = m_summaryRowCriteria;\n }\n else\n {\n criteria = m_nonSummaryRowCriteria;\n }\n }\n }\n else\n {\n if (task.getSummary() == true)\n {\n if (m_summaryRowsInheritFromNonSummaryRows == false)\n {\n criteria = m_summaryRowCriteria;\n }\n else\n {\n criteria = m_nonSummaryRowCriteria;\n }\n }\n else\n {\n criteria = m_nonSummaryRowCriteria;\n }\n }\n }\n else\n {\n // It is possible to have a resource summary row, but at the moment\n // I can't see how you can determine this.\n criteria = m_nonSummaryRowCriteria;\n }\n\n //\n // Now we have the criteria, evaluate each one until we get a result\n //\n int result = -1;\n for (GraphicalIndicatorCriteria gic : criteria)\n {\n result = gic.evaluate(container);\n if (result != -1)\n {\n break;\n }\n }\n\n //\n // If we still don't have a result at the end, return the\n // default value, which is 0\n //\n if (result == -1)\n {\n result = 0;\n }\n\n return (result);\n }",
"public static Expression type(String lhs, Type rhs) {\n return new Expression(lhs, \"$type\", rhs.toString());\n }",
"public static Map<String, String> mapStringToMap(String map) {\r\n String[] m = map.split(\"[,;]\");\r\n Map<String, String> res = new HashMap<String, String>();\r\n for (String str : m) {\r\n int index = str.lastIndexOf('=');\r\n String key = str.substring(0, index);\r\n String val = str.substring(index + 1);\r\n res.put(key.trim(), val.trim());\r\n }\r\n return res;\r\n }"
] |
Returns a list of the rekordbox IDs of the tracks contained in the cache.
@return a list containing the rekordbox ID for each track present in the cache, in the order they appear | [
"public List<Integer> getTrackIds() {\n ArrayList<Integer> results = new ArrayList<Integer>(trackCount);\n Enumeration<? extends ZipEntry> entries = zipFile.entries();\n while (entries.hasMoreElements()) {\n ZipEntry entry = entries.nextElement();\n if (entry.getName().startsWith(CACHE_METADATA_ENTRY_PREFIX)) {\n String idPart = entry.getName().substring(CACHE_METADATA_ENTRY_PREFIX.length());\n if (idPart.length() > 0) {\n results.add(Integer.valueOf(idPart));\n }\n }\n }\n\n return Collections.unmodifiableList(results);\n }"
] | [
"public Diff compare(CtElement left, CtElement right) {\n\t\tfinal SpoonGumTreeBuilder scanner = new SpoonGumTreeBuilder();\n\t\treturn new DiffImpl(scanner.getTreeContext(), scanner.getTree(left), scanner.getTree(right));\n\t}",
"private String generatedBuilderSimpleName(TypeElement type) {\n String packageName = elements.getPackageOf(type).getQualifiedName().toString();\n String originalName = type.getQualifiedName().toString();\n checkState(originalName.startsWith(packageName + \".\"));\n String nameWithoutPackage = originalName.substring(packageName.length() + 1);\n return String.format(BUILDER_SIMPLE_NAME_TEMPLATE, nameWithoutPackage.replaceAll(\"\\\\.\", \"_\"));\n }",
"public ChangesResult getChanges() {\n final URI uri = this.databaseHelper.changesUri(\"feed\", \"normal\");\n return client.get(uri, ChangesResult.class);\n }",
"protected static <K, T> void groupAnswer(final Map<K, List<T>> answer, T element, K value) {\n if (answer.containsKey(value)) {\n answer.get(value).add(element);\n } else {\n List<T> groupedElements = new ArrayList<T>();\n groupedElements.add(element);\n answer.put(value, groupedElements);\n }\n }",
"public static void abortSystem(final Throwable error) {\n DaemonStarter.currentPhase.set(LifecyclePhase.ABORTING);\n try {\n DaemonStarter.getLifecycleListener().aborting();\n } catch (Exception e) {\n DaemonStarter.rlog.error(\"Custom abort failed\", e);\n }\n if (error != null) {\n DaemonStarter.rlog.error(\"Unrecoverable error encountered --> Exiting : {}\", error.getMessage());\n DaemonStarter.getLifecycleListener().exception(LifecyclePhase.ABORTING, error);\n } else {\n DaemonStarter.rlog.error(\"Unrecoverable error encountered --> Exiting\");\n }\n // Exit system with failure return code\n System.exit(1);\n }",
"public void check(ClassDescriptorDef classDef, String checkLevel) throws ConstraintException\r\n {\r\n ensureNoTableInfoIfNoRepositoryInfo(classDef, checkLevel);\r\n checkModifications(classDef, checkLevel);\r\n checkExtents(classDef, checkLevel);\r\n ensureTableIfNecessary(classDef, checkLevel);\r\n checkFactoryClassAndMethod(classDef, checkLevel);\r\n checkInitializationMethod(classDef, checkLevel);\r\n checkPrimaryKey(classDef, checkLevel);\r\n checkProxyPrefetchingLimit(classDef, checkLevel);\r\n checkRowReader(classDef, checkLevel);\r\n checkObjectCache(classDef, checkLevel);\r\n checkProcedures(classDef, checkLevel);\r\n }",
"protected void checkObserverMethods() {\n Collection<EnhancedAnnotatedMethod<?, ? super T>> observerMethods = BeanMethods.getObserverMethods(this.getEnhancedAnnotated());\n Collection<EnhancedAnnotatedMethod<?, ? super T>> asyncObserverMethods = BeanMethods.getAsyncObserverMethods(this.getEnhancedAnnotated());\n checkObserverMethods(observerMethods);\n checkObserverMethods(asyncObserverMethods);\n }",
"private void getDailyDates(Calendar calendar, int frequency, List<Date> dates)\n {\n while (moreDates(calendar, dates))\n {\n dates.add(calendar.getTime());\n calendar.add(Calendar.DAY_OF_YEAR, frequency);\n }\n }",
"public void close() throws IOException {\n\t\tSystem.out.println(\"Serialized \"\n\t\t\t\t+ this.jsonSerializer.getEntityDocumentCount()\n\t\t\t\t+ \" item documents to JSON file \" + OUTPUT_FILE_NAME + \".\");\n\t\tthis.jsonSerializer.close();\n\t}"
] |
Use this API to fetch responderhtmlpage resource of given name . | [
"public static responderhtmlpage get(nitro_service service, String name) throws Exception{\n\t\tresponderhtmlpage obj = new responderhtmlpage();\n\t\tobj.set_name(name);\n\t\tresponderhtmlpage response = (responderhtmlpage) obj.get_resource(service);\n\t\treturn response;\n\t}"
] | [
"@PostConstruct\n\tprotected void postConstruct() throws GeomajasException {\n\t\tif (null != crsDefinitions) {\n\t\t\tfor (CrsInfo crsInfo : crsDefinitions.values()) {\n\t\t\t\ttry {\n\t\t\t\t\tCoordinateReferenceSystem crs = CRS.parseWKT(crsInfo.getCrsWkt());\n\t\t\t\t\tString code = crsInfo.getKey();\n\t\t\t\t\tcrsCache.put(code, CrsFactory.getCrs(code, crs));\n\t\t\t\t} catch (FactoryException e) {\n\t\t\t\t\tthrow new GeomajasException(e, ExceptionCode.CRS_DECODE_FAILURE_FOR_MAP, crsInfo.getKey());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (null != crsTransformDefinitions) {\n\t\t\tfor (CrsTransformInfo crsTransformInfo : crsTransformDefinitions.values()) {\n\t\t\t\tString key = getTransformKey(crsTransformInfo);\n\t\t\t\ttransformCache.put(key, getCrsTransform(key, crsTransformInfo));\n\t\t\t}\n\t\t}\n\t\tGeometryFactory factory = new GeometryFactory();\n\t\tEMPTY_GEOMETRIES.put(Point.class, factory.createPoint((Coordinate) null));\n\t\tEMPTY_GEOMETRIES.put(LineString.class, factory.createLineString((Coordinate[]) null));\n\t\tEMPTY_GEOMETRIES.put(Polygon.class, factory.createPolygon(null, null));\n\t\tEMPTY_GEOMETRIES.put(MultiPoint.class, factory.createMultiPoint((Coordinate[]) null));\n\t\tEMPTY_GEOMETRIES.put(MultiLineString.class, factory.createMultiLineString((LineString[]) null)); // cast needed!\n\t\tEMPTY_GEOMETRIES.put(MultiPolygon.class, factory.createMultiPolygon((Polygon[]) null)); // cast needed!\n\t\tEMPTY_GEOMETRIES.put(Geometry.class, factory.createGeometryCollection(null));\n\t}",
"public void seekToMonth(String direction, String seekAmount, String month) {\n int seekAmountInt = Integer.parseInt(seekAmount);\n int monthInt = Integer.parseInt(month);\n assert(direction.equals(DIR_LEFT) || direction.equals(DIR_RIGHT));\n assert(monthInt >= 1 && monthInt <= 12);\n \n markDateInvocation();\n \n // set the day to the first of month. This step is necessary because if we seek to the \n // current day of a month whose number of days is less than the current day, we will \n // pushed into the next month.\n _calendar.set(Calendar.DAY_OF_MONTH, 1);\n \n // seek to the appropriate year\n if(seekAmountInt > 0) {\n int currentMonth = _calendar.get(Calendar.MONTH) + 1;\n int sign = direction.equals(DIR_RIGHT) ? 1 : -1;\n int numYearsToShift = seekAmountInt +\n (currentMonth == monthInt ? 0 : (currentMonth < monthInt ? sign > 0 ? -1 : 0 : sign > 0 ? 0 : -1));\n\n _calendar.add(Calendar.YEAR, (numYearsToShift * sign));\n }\n \n // now set the month\n _calendar.set(Calendar.MONTH, monthInt - 1);\n }",
"private void readResourceCustomFields(net.sf.mpxj.ganttproject.schema.Resource gpResource, Resource mpxjResource)\n {\n //\n // Populate custom field default values\n //\n Map<FieldType, Object> customFields = new HashMap<FieldType, Object>();\n for (Pair<FieldType, String> definition : m_resourcePropertyDefinitions.values())\n {\n customFields.put(definition.getFirst(), definition.getSecond());\n }\n\n //\n // Update with custom field actual values\n //\n for (CustomResourceProperty property : gpResource.getCustomProperty())\n {\n Pair<FieldType, String> definition = m_resourcePropertyDefinitions.get(property.getDefinitionId());\n if (definition != null)\n {\n //\n // Retrieve the value. If it is empty, use the default.\n //\n String value = property.getValueAttribute();\n if (value.isEmpty())\n {\n value = null;\n }\n\n //\n // If we have a value,convert it to the correct type\n //\n if (value != null)\n {\n Object result;\n\n switch (definition.getFirst().getDataType())\n {\n case NUMERIC:\n {\n if (value.indexOf('.') == -1)\n {\n result = Integer.valueOf(value);\n }\n else\n {\n result = Double.valueOf(value);\n }\n break;\n }\n\n case DATE:\n {\n try\n {\n result = m_localeDateFormat.parse(value);\n }\n catch (ParseException ex)\n {\n result = null;\n }\n break;\n }\n\n case BOOLEAN:\n {\n result = Boolean.valueOf(value.equals(\"true\"));\n break;\n }\n\n default:\n {\n result = value;\n break;\n }\n }\n\n if (result != null)\n {\n customFields.put(definition.getFirst(), result);\n }\n }\n }\n }\n\n for (Map.Entry<FieldType, Object> item : customFields.entrySet())\n {\n if (item.getValue() != null)\n {\n mpxjResource.set(item.getKey(), item.getValue());\n }\n }\n }",
"public static systemsession[] get(nitro_service service) throws Exception{\n\t\tsystemsession obj = new systemsession();\n\t\tsystemsession[] response = (systemsession[])obj.get_resources(service);\n\t\treturn response;\n\t}",
"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 final void setWeekDays(SortedSet<WeekDay> weekDays) {\n\n m_weekDays.clear();\n if (null != weekDays) {\n m_weekDays.addAll(weekDays);\n }\n }",
"protected void printCenterWithLead(String lead, String format, Object ... args) {\n String text = S.fmt(format, args);\n int len = 80 - lead.length();\n info(S.concat(lead, S.center(text, len)));\n }",
"public boolean isAlive(Connection conn)\r\n {\r\n try\r\n {\r\n return con != null ? !con.isClosed() : false;\r\n }\r\n catch (SQLException e)\r\n {\r\n log.error(\"IsAlive check failed, running connection was invalid!!\", e);\r\n return false;\r\n }\r\n }",
"void updateFromResponseOnPutPatch(Response<ResponseBody> response) throws CloudException, IOException {\n String responseContent = null;\n if (response.body() != null) {\n responseContent = response.body().string();\n response.body().close();\n }\n\n if (responseContent == null || responseContent.isEmpty()) {\n throw new CloudException(\"polling response does not contain a valid body\", response);\n }\n\n PollingResource resource = serializerAdapter.deserialize(responseContent, PollingResource.class);\n final int statusCode = response.code();\n if (resource != null && resource.properties != null && resource.properties.provisioningState != null) {\n this.withStatus(resource.properties.provisioningState, statusCode);\n } else {\n this.withStatus(AzureAsyncOperation.SUCCESS_STATUS, statusCode);\n }\n\n CloudError error = new CloudError();\n this.withErrorBody(error);\n error.withCode(this.status());\n error.withMessage(\"Long running operation failed\");\n this.withResponse(response);\n this.withResource(serializerAdapter.<T>deserialize(responseContent, resourceType));\n }"
] |
calculate the point a's angle of rectangle consist of point a,point b, point c;
@param vertex
@param A
@param B
@return | [
"private static double threePointsAngle(Point vertex, Point A, Point B) {\n double b = pointsDistance(vertex, A);\n double c = pointsDistance(A, B);\n double a = pointsDistance(B, vertex);\n\n return Math.toDegrees(Math.acos((a * a + b * b - c * c) / (2 * a * b)));\n\n }"
] | [
"protected long getUniqueLong(FieldDescriptor field) throws SequenceManagerException\r\n {\r\n boolean needsCommit = false;\r\n long result = 0;\r\n /*\r\n arminw:\r\n use the associated broker instance, check if broker was in tx or\r\n we need to commit used connection.\r\n */\r\n PersistenceBroker targetBroker = getBrokerForClass();\r\n if(!targetBroker.isInTransaction())\r\n {\r\n targetBroker.beginTransaction();\r\n needsCommit = true;\r\n }\r\n try\r\n {\r\n // lookup sequence name\r\n String sequenceName = calculateSequenceName(field);\r\n try\r\n {\r\n result = buildNextSequence(targetBroker, field.getClassDescriptor(), sequenceName);\r\n /*\r\n if 0 was returned we assume that the stored procedure\r\n did not work properly.\r\n */\r\n if (result == 0)\r\n {\r\n throw new SequenceManagerException(\"No incremented value retrieved\");\r\n }\r\n }\r\n catch (Exception e)\r\n {\r\n // maybe the sequence was not created\r\n log.info(\"Could not grab next key, message was \" + e.getMessage() +\r\n \" - try to write a new sequence entry to database\");\r\n try\r\n {\r\n // on create, make sure to get the max key for the table first\r\n long maxKey = SequenceManagerHelper.getMaxForExtent(targetBroker, field);\r\n createSequence(targetBroker, field, sequenceName, maxKey);\r\n }\r\n catch (Exception e1)\r\n {\r\n String eol = SystemUtils.LINE_SEPARATOR;\r\n throw new SequenceManagerException(eol + \"Could not grab next id, failed with \" + eol +\r\n e.getMessage() + eol + \"Creation of new sequence failed with \" +\r\n eol + e1.getMessage() + eol, e1);\r\n }\r\n try\r\n {\r\n result = buildNextSequence(targetBroker, field.getClassDescriptor(), sequenceName);\r\n }\r\n catch (Exception e1)\r\n {\r\n throw new SequenceManagerException(\"Could not grab next id although a sequence seems to exist\", e);\r\n }\r\n }\r\n }\r\n finally\r\n {\r\n if(targetBroker != null && needsCommit)\r\n {\r\n targetBroker.commitTransaction();\r\n }\r\n }\r\n return result;\r\n }",
"public static <T> JacksonParser<T> json(Class<T> contentType) {\n return new JacksonParser<>(null, contentType);\n }",
"@Override\n public void perform(GraphRewrite event, EvaluationContext context)\n {\n checkVariableName(event, context);\n WindupVertexFrame payload = resolveVariable(event, getVariableName());\n if (payload instanceof FileReferenceModel)\n {\n FileModel file = ((FileReferenceModel) payload).getFile();\n perform(event, context, (XmlFileModel) file);\n }\n else\n {\n super.perform(event, context);\n }\n\n }",
"private String visibility(Options opt, ProgramElementDoc e) {\n\treturn opt.showVisibility ? Visibility.get(e).symbol : \" \";\n }",
"public static String replaceFullRequestContent(\n String requestContentTemplate, String replacementString) {\n return (requestContentTemplate.replace(\n PcConstants.COMMAND_VAR_DEFAULT_REQUEST_CONTENT,\n replacementString));\n }",
"public ModelNode getDeploymentSubsystemModel(final String subsystemName) {\n assert subsystemName != null : \"The subsystemName cannot be null\";\n return getDeploymentSubModel(subsystemName, PathAddress.EMPTY_ADDRESS, null, deploymentUnit);\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 }",
"private int calculateRowHeaderMaxWidth(DJCrosstabColumn crosstabColumn) {\n\t\tint auxWidth = 0;\n\t\tboolean firstTime = true;\n\t\tList<DJCrosstabColumn> auxList = new ArrayList<DJCrosstabColumn>(djcross.getColumns());\n\t\tCollections.reverse(auxList);\n\t\tfor (DJCrosstabColumn col : auxList) {\n\t\t\tif (col.equals(crosstabColumn)){\n\t\t\t\tif (auxWidth == 0)\n\t\t\t\t\tauxWidth = col.getWidth();\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (firstTime){\n\t\t\t\tauxWidth += col.getWidth();\n\t\t\t\tfirstTime = false;\n\t\t\t}\n\t\t\tif (col.isShowTotals()) {\n\t\t\t\tauxWidth += col.getWidth();\n\t\t\t}\n\t\t}\n\t\treturn auxWidth;\n\t}",
"private void initXmlBundle() throws CmsException {\n\n CmsFile file = m_cms.readFile(m_resource);\n m_bundleFiles.put(null, m_resource);\n m_xmlBundle = CmsXmlContentFactory.unmarshal(m_cms, file);\n initKeySetForXmlBundle();\n\n }"
] |
Output the SQL type for the default value for the type. | [
"private void appendDefaultValue(StringBuilder sb, FieldType fieldType, Object defaultValue) {\n\t\tif (fieldType.isEscapedDefaultValue()) {\n\t\t\tappendEscapedWord(sb, defaultValue.toString());\n\t\t} else {\n\t\t\tsb.append(defaultValue);\n\t\t}\n\t}"
] | [
"public void selectTab() {\n for (Widget child : getChildren()) {\n if (child instanceof HasHref) {\n String href = ((HasHref) child).getHref();\n if (parent != null && !href.isEmpty()) {\n parent.selectTab(href.replaceAll(\"[^a-zA-Z\\\\d\\\\s:]\", \"\"));\n parent.reload();\n break;\n }\n }\n }\n }",
"public double totalCount() {\r\n if (depth() == 1) {\r\n return total; // I think this one is always OK. Not very principled here, though.\r\n } else {\r\n double result = 0.0;\r\n for (K o: topLevelKeySet()) {\r\n result += conditionalizeOnce(o).totalCount();\r\n }\r\n return result;\r\n }\r\n }",
"public static double Magnitude(ComplexNumber z) {\r\n return Math.sqrt(z.real * z.real + z.imaginary * z.imaginary);\r\n }",
"public List<TerminalString> getOptionLongNamesWithDash() {\n List<ProcessedOption> opts = getOptions();\n List<TerminalString> names = new ArrayList<>(opts.size());\n for (ProcessedOption o : opts) {\n if(o.getValues().size() == 0 &&\n o.activator().isActivated(new ParsedCommand(this)))\n names.add(o.getRenderedNameWithDashes());\n }\n\n return names;\n }",
"public StitchObjectMapper withCodecRegistry(final CodecRegistry codecRegistry) {\n // We can't detect if their codecRegistry has any duplicate providers. There's also a chance\n // that putting ours first may prevent decoding of some of their classes if for example they\n // have their own way of decoding an Integer.\n final CodecRegistry newReg =\n CodecRegistries.fromRegistries(BsonUtils.DEFAULT_CODEC_REGISTRY, codecRegistry);\n return new StitchObjectMapper(this, newReg);\n }",
"public 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 }",
"public Jar setJarPrefix(Path file) {\n verifyNotSealed();\n if (jos != null)\n throw new IllegalStateException(\"Really executable cannot be set after entries are added.\");\n if (file != null && jarPrefixStr != null)\n throw new IllegalStateException(\"A prefix has already been set (\" + jarPrefixStr + \")\");\n this.jarPrefixFile = file;\n return this;\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}",
"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 }"
] |
Assigns one variable to one value
@param action an Assign Action
@param possibleStateList a current list of possible states produced so far from expanding a model state
@return the same list, with every possible state augmented with an assigned variable, defined by action | [
"public List<Map<String, String>> pipelinePossibleStates(Assign action, List<Map<String, String>> possibleStateList) {\r\n for (Map<String, String> possibleState : possibleStateList) {\r\n possibleState.put(action.getName(), action.getExpr());\r\n }\n\r\n return possibleStateList;\r\n }"
] | [
"public CollectionRequest<ProjectMembership> findByProject(String project) {\n \n String path = String.format(\"/projects/%s/project_memberships\", project);\n return new CollectionRequest<ProjectMembership>(this, ProjectMembership.class, path, \"GET\");\n }",
"public static String getButtonName(String gallery) {\n\n StringBuffer sb = new StringBuffer(GUI_BUTTON_PREF);\n sb.append(gallery.toUpperCase());\n sb.append(GUI_BUTTON_SUF);\n return sb.toString();\n }",
"public static String taskListToString(List<RebalanceTaskInfo> infos) {\n StringBuffer sb = new StringBuffer();\n for (RebalanceTaskInfo info : infos) {\n sb.append(\"\\t\").append(info.getDonorId()).append(\" -> \").append(info.getStealerId()).append(\" : [\");\n for (String storeName : info.getPartitionStores()) {\n sb.append(\"{\").append(storeName).append(\" : \").append(info.getPartitionIds(storeName)).append(\"}\");\n }\n sb.append(\"]\").append(Utils.NEWLINE);\n }\n return sb.toString();\n }",
"public static base_response update(nitro_service client, nsip6 resource) throws Exception {\n\t\tnsip6 updateresource = new nsip6();\n\t\tupdateresource.ipv6address = resource.ipv6address;\n\t\tupdateresource.td = resource.td;\n\t\tupdateresource.nd = resource.nd;\n\t\tupdateresource.icmp = resource.icmp;\n\t\tupdateresource.vserver = resource.vserver;\n\t\tupdateresource.telnet = resource.telnet;\n\t\tupdateresource.ftp = resource.ftp;\n\t\tupdateresource.gui = resource.gui;\n\t\tupdateresource.ssh = resource.ssh;\n\t\tupdateresource.snmp = resource.snmp;\n\t\tupdateresource.mgmtaccess = resource.mgmtaccess;\n\t\tupdateresource.restrictaccess = resource.restrictaccess;\n\t\tupdateresource.state = resource.state;\n\t\tupdateresource.map = resource.map;\n\t\tupdateresource.dynamicrouting = resource.dynamicrouting;\n\t\tupdateresource.hostroute = resource.hostroute;\n\t\tupdateresource.ip6hostrtgw = resource.ip6hostrtgw;\n\t\tupdateresource.metric = resource.metric;\n\t\tupdateresource.vserverrhilevel = resource.vserverrhilevel;\n\t\tupdateresource.ospf6lsatype = resource.ospf6lsatype;\n\t\tupdateresource.ospfarea = resource.ospfarea;\n\t\treturn updateresource.update_resource(client);\n\t}",
"public static EventType map(Event event) {\n EventType eventType = new EventType();\n eventType.setTimestamp(Converter.convertDate(event.getTimestamp()));\n eventType.setEventType(convertEventType(event.getEventType()));\n OriginatorType origType = mapOriginator(event.getOriginator());\n eventType.setOriginator(origType);\n MessageInfoType miType = mapMessageInfo(event.getMessageInfo());\n eventType.setMessageInfo(miType);\n eventType.setCustomInfo(convertCustomInfo(event.getCustomInfo()));\n eventType.setContentCut(event.isContentCut());\n if (event.getContent() != null) {\n DataHandler datHandler = getDataHandlerForString(event);\n eventType.setContent(datHandler);\n }\n return eventType;\n }",
"@SuppressWarnings(\"deprecation\")\n public boolean cancelOnTargetHosts(List<String> targetHosts) {\n\n boolean success = false;\n\n try {\n\n switch (state) {\n\n case IN_PROGRESS:\n if (executionManager != null\n && !executionManager.isTerminated()) {\n executionManager.tell(new CancelTaskOnHostRequest(\n targetHosts), executionManager);\n logger.info(\n \"asked task to stop from running on target hosts with count {}...\",\n targetHosts.size());\n } else {\n logger.info(\"manager already killed or not exist.. NO OP\");\n }\n success = true;\n break;\n case COMPLETED_WITHOUT_ERROR:\n case COMPLETED_WITH_ERROR:\n case WAITING:\n logger.info(\"will NO OP for cancelOnTargetHost as it is not in IN_PROGRESS state\");\n success = true;\n break;\n default:\n break;\n\n }\n\n } catch (Exception e) {\n logger.error(\n \"cancel task {} on hosts with count {} error with exception details \",\n this.getTaskId(), targetHosts.size(), e);\n }\n\n return success;\n }",
"protected void addSpecialMethods(ClassFile proxyClassType, ClassMethod staticConstructor) {\n try {\n // Add special methods for interceptors\n for (Method method : LifecycleMixin.class.getMethods()) {\n BeanLogger.LOG.addingMethodToProxy(method);\n MethodInformation methodInfo = new RuntimeMethodInformation(method);\n createInterceptorBody(proxyClassType.addMethod(method), methodInfo, false, staticConstructor);\n }\n Method getInstanceMethod = TargetInstanceProxy.class.getMethod(\"weld_getTargetInstance\");\n Method getInstanceClassMethod = TargetInstanceProxy.class.getMethod(\"weld_getTargetClass\");\n generateGetTargetInstanceBody(proxyClassType.addMethod(getInstanceMethod));\n generateGetTargetClassBody(proxyClassType.addMethod(getInstanceClassMethod));\n\n Method setMethodHandlerMethod = ProxyObject.class.getMethod(\"weld_setHandler\", MethodHandler.class);\n generateSetMethodHandlerBody(proxyClassType.addMethod(setMethodHandlerMethod));\n\n Method getMethodHandlerMethod = ProxyObject.class.getMethod(\"weld_getHandler\");\n generateGetMethodHandlerBody(proxyClassType.addMethod(getMethodHandlerMethod));\n } catch (Exception e) {\n throw new WeldException(e);\n }\n }",
"synchronized public void completeTask(int taskId, int partitionStoresMigrated) {\n tasksInFlight.remove(taskId);\n\n numTasksCompleted++;\n numPartitionStoresMigrated += partitionStoresMigrated;\n\n updateProgressBar();\n }",
"@SuppressWarnings(\"unchecked\")\n private void addPrivateFieldsAccessors(ClassNode node) {\n Set<ASTNode> accessedFields = (Set<ASTNode>) node.getNodeMetaData(StaticTypesMarker.PV_FIELDS_ACCESS);\n if (accessedFields==null) return;\n Map<String, MethodNode> privateConstantAccessors = (Map<String, MethodNode>) node.getNodeMetaData(PRIVATE_FIELDS_ACCESSORS);\n if (privateConstantAccessors!=null) {\n // already added\n return;\n }\n int acc = -1;\n privateConstantAccessors = new HashMap<String, MethodNode>();\n final int access = Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC;\n for (FieldNode fieldNode : node.getFields()) {\n if (accessedFields.contains(fieldNode)) {\n\n acc++;\n Parameter param = new Parameter(node.getPlainNodeReference(), \"$that\");\n Expression receiver = fieldNode.isStatic()?new ClassExpression(node):new VariableExpression(param);\n Statement stmt = new ExpressionStatement(new PropertyExpression(\n receiver,\n fieldNode.getName()\n ));\n MethodNode accessor = node.addMethod(\"pfaccess$\"+acc, access, fieldNode.getOriginType(), new Parameter[]{param}, ClassNode.EMPTY_ARRAY, stmt);\n privateConstantAccessors.put(fieldNode.getName(), accessor);\n }\n }\n node.setNodeMetaData(PRIVATE_FIELDS_ACCESSORS, privateConstantAccessors);\n }"
] |
This method is called to format a units value.
@param value numeric value
@return currency value | [
"private String formatUnits(Number value)\n {\n return (value == null ? null : m_formats.getUnitsDecimalFormat().format(value.doubleValue() / 100));\n }"
] | [
"private void checkOrMarkPrivateAccess(Expression source, FieldNode fn) {\n if (fn!=null && Modifier.isPrivate(fn.getModifiers()) &&\n (fn.getDeclaringClass() != typeCheckingContext.getEnclosingClassNode() || typeCheckingContext.getEnclosingClosure()!=null) &&\n fn.getDeclaringClass().getModule() == typeCheckingContext.getEnclosingClassNode().getModule()) {\n addPrivateFieldOrMethodAccess(source, fn.getDeclaringClass(), StaticTypesMarker.PV_FIELDS_ACCESS, fn);\n }\n }",
"private void readCollectionElement(\n\t\tfinal Object optionalOwner,\n\t\tfinal Serializable optionalKey,\n\t\tfinal CollectionPersister persister,\n\t\tfinal CollectionAliases descriptor,\n\t\tfinal ResultSet rs,\n\t\tfinal SharedSessionContractImplementor session)\n\t\t\t\tthrows HibernateException, SQLException {\n\n\t\tfinal PersistenceContext persistenceContext = session.getPersistenceContext();\n\n\t\t//implement persister.readKey using the grid type (later)\n\t\tfinal Serializable collectionRowKey = (Serializable) persister.readKey(\n\t\t\t\trs,\n\t\t\t\tdescriptor.getSuffixedKeyAliases(),\n\t\t\t\tsession\n\t\t);\n\n\t\tif ( collectionRowKey != null ) {\n\t\t\t// we found a collection element in the result set\n\n\t\t\tif ( log.isDebugEnabled() ) {\n\t\t\t\tlog.debug(\n\t\t\t\t\t\t\"found row of collection: \" +\n\t\t\t\t\t\tMessageHelper.collectionInfoString( persister, collectionRowKey, getFactory() )\n\t\t\t\t\t);\n\t\t\t}\n\n\t\t\tObject owner = optionalOwner;\n\t\t\tif ( owner == null ) {\n\t\t\t\towner = persistenceContext.getCollectionOwner( collectionRowKey, persister );\n\t\t\t\tif ( owner == null ) {\n\t\t\t\t\t//TODO: This is assertion is disabled because there is a bug that means the\n\t\t\t\t\t//\t original owner of a transient, uninitialized collection is not known\n\t\t\t\t\t//\t if the collection is re-referenced by a different object associated\n\t\t\t\t\t//\t with the current Session\n\t\t\t\t\t//throw new AssertionFailure(\"bug loading unowned collection\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tPersistentCollection rowCollection = persistenceContext.getLoadContexts()\n\t\t\t\t\t.getCollectionLoadContext( rs )\n\t\t\t\t\t.getLoadingCollection( persister, collectionRowKey );\n\n\t\t\tif ( rowCollection != null ) {\n\t\t\t\thydrateRowCollection( persister, descriptor, rs, owner, rowCollection );\n\t\t\t}\n\n\t\t}\n\t\telse if ( optionalKey != null ) {\n\t\t\t// we did not find a collection element in the result set, so we\n\t\t\t// ensure that a collection is created with the owner's identifier,\n\t\t\t// since what we have is an empty collection\n\n\t\t\tif ( log.isDebugEnabled() ) {\n\t\t\t\tlog.debug(\n\t\t\t\t\t\t\"result set contains (possibly empty) collection: \" +\n\t\t\t\t\t\tMessageHelper.collectionInfoString( persister, optionalKey, getFactory() )\n\t\t\t\t\t);\n\t\t\t}\n\n\t\t\tpersistenceContext.getLoadContexts()\n\t\t\t\t\t.getCollectionLoadContext( rs )\n\t\t\t\t\t.getLoadingCollection( persister, optionalKey ); // handle empty collection\n\n\t\t}\n\n\t\t// else no collection element, but also no owner\n\n\t}",
"protected boolean shouldApplyThisRuleTo(ClassNode classNode) {\r\n // TODO Consider caching applyTo, doNotApplyTo and associated WildcardPatterns\r\n boolean shouldApply = true;\r\n\r\n String applyTo = getApplyToClassNames();\r\n String doNotApplyTo = getDoNotApplyToClassNames();\r\n\r\n if (applyTo != null && applyTo.length() > 0) {\r\n WildcardPattern pattern = new WildcardPattern(applyTo, true);\r\n shouldApply = pattern.matches(classNode.getNameWithoutPackage()) || pattern.matches(classNode.getName());\r\n }\r\n\r\n if (shouldApply && doNotApplyTo != null && doNotApplyTo.length() > 0) {\r\n WildcardPattern pattern = new WildcardPattern(doNotApplyTo, true);\r\n shouldApply = !pattern.matches(classNode.getNameWithoutPackage()) && !pattern.matches(classNode.getName());\r\n }\r\n\r\n return shouldApply;\r\n }",
"public ILog getOrCreateLog(String topic, int partition) throws IOException {\n final int configPartitionNumber = getPartition(topic);\n if (partition >= configPartitionNumber) {\n throw new IOException(\"partition is bigger than the number of configuration: \" + configPartitionNumber);\n }\n boolean hasNewTopic = false;\n Pool<Integer, Log> parts = getLogPool(topic, partition);\n if (parts == null) {\n Pool<Integer, Log> found = logs.putIfNotExists(topic, new Pool<Integer, Log>());\n if (found == null) {\n hasNewTopic = true;\n }\n parts = logs.get(topic);\n }\n //\n Log log = parts.get(partition);\n if (log == null) {\n log = createLog(topic, partition);\n Log found = parts.putIfNotExists(partition, log);\n if (found != null) {\n Closer.closeQuietly(log, logger);\n log = found;\n } else {\n logger.info(format(\"Created log for [%s-%d], now create other logs if necessary\", topic, partition));\n final int configPartitions = getPartition(topic);\n for (int i = 0; i < configPartitions; i++) {\n getOrCreateLog(topic, i);\n }\n }\n }\n if (hasNewTopic && config.getEnableZookeeper()) {\n topicRegisterTasks.add(new TopicTask(TopicTask.TaskType.CREATE, topic));\n }\n return log;\n }",
"public static FullTypeSignature getTypeSignature(String typeSignatureString,\n\t\t\tboolean useInternalFormFullyQualifiedName) {\n\t\tString key;\n\t\tif (!useInternalFormFullyQualifiedName) {\n\t\t\tkey = typeSignatureString.replace('.', '/')\n\t\t\t\t\t.replace('$', '.');\n\t\t} else {\n\t\t\tkey = typeSignatureString;\n\t\t}\n\n\t\t// we always use the internal form as a key for cache\n\t\tFullTypeSignature typeSignature = typeSignatureCache\n\t\t\t\t.get(key);\n\t\tif (typeSignature == null) {\n\t\t\tClassFileTypeSignatureParser typeSignatureParser = new ClassFileTypeSignatureParser(\n\t\t\t\t\ttypeSignatureString);\n\t\t\ttypeSignatureParser.setUseInternalFormFullyQualifiedName(useInternalFormFullyQualifiedName);\n\t\t\ttypeSignature = typeSignatureParser.parseTypeSignature();\n\t\t\ttypeSignatureCache.put(typeSignatureString, typeSignature);\n\t\t}\n\t\treturn typeSignature;\n\t}",
"public void rollback() throws GeomajasException {\n\t\ttry {\n\t\t\tsetConfigLocations(previousConfigLocations);\n\t\t\trefresh();\n\t\t} catch (Exception e) {\n\t\t\tthrow new GeomajasException(e, ExceptionCode.REFRESH_CONFIGURATION_FAILED);\n\t\t}\n\t}",
"MongoCollection<BsonDocument> getLocalCollection(final MongoNamespace namespace) {\n return getLocalCollection(\n namespace,\n BsonDocument.class,\n MongoClientSettings.getDefaultCodecRegistry());\n }",
"public static base_response update(nitro_service client, aaaparameter resource) throws Exception {\n\t\taaaparameter updateresource = new aaaparameter();\n\t\tupdateresource.enablestaticpagecaching = resource.enablestaticpagecaching;\n\t\tupdateresource.enableenhancedauthfeedback = resource.enableenhancedauthfeedback;\n\t\tupdateresource.defaultauthtype = resource.defaultauthtype;\n\t\tupdateresource.maxaaausers = resource.maxaaausers;\n\t\tupdateresource.maxloginattempts = resource.maxloginattempts;\n\t\tupdateresource.failedlogintimeout = resource.failedlogintimeout;\n\t\tupdateresource.aaadnatip = resource.aaadnatip;\n\t\treturn updateresource.update_resource(client);\n\t}",
"public void strokeRectangle(Rectangle rect, Color color, float linewidth) {\n\t\tstrokeRectangle(rect, color, linewidth, null);\n\t}"
] |
Convert the MSPDI representation of a UUID into a Java UUID instance.
@param value MSPDI UUID
@return Java UUID instance | [
"public static final UUID parseUUID(String value)\n {\n return value == null || value.isEmpty() ? null : UUID.fromString(value);\n }"
] | [
"private boolean verify(String key, BoxSignatureAlgorithm actualAlgorithm, String actualSignature,\n String webHookPayload, String deliveryTimestamp) {\n if (actualSignature == null) {\n return false;\n }\n\n byte[] actual = Base64.decode(actualSignature);\n byte[] expected = this.signRaw(actualAlgorithm, key, webHookPayload, deliveryTimestamp);\n\n return Arrays.equals(expected, actual);\n }",
"public BoxFile.Info commit(String digest, List<BoxFileUploadSessionPart> parts,\n Map<String, String> attributes, String ifMatch, String ifNoneMatch) {\n\n URL commitURL = this.sessionInfo.getSessionEndpoints().getCommitEndpoint();\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), commitURL, HttpMethod.POST);\n request.addHeader(HttpHeaders.DIGEST, DIGEST_HEADER_PREFIX_SHA + digest);\n request.addHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON);\n\n if (ifMatch != null) {\n request.addHeader(HttpHeaders.IF_MATCH, ifMatch);\n }\n\n if (ifNoneMatch != null) {\n request.addHeader(HttpHeaders.IF_NONE_MATCH, ifNoneMatch);\n }\n\n //Creates the body of the request\n String body = this.getCommitBody(parts, attributes);\n request.setBody(body);\n\n BoxAPIResponse response = request.send();\n //Retry the commit operation after the given number of seconds if the HTTP response code is 202.\n if (response.getResponseCode() == 202) {\n String retryInterval = response.getHeaderField(\"retry-after\");\n if (retryInterval != null) {\n try {\n Thread.sleep(new Integer(retryInterval) * 1000);\n } catch (InterruptedException ie) {\n throw new BoxAPIException(\"Commit retry failed. \", ie);\n }\n\n return this.commit(digest, parts, attributes, ifMatch, ifNoneMatch);\n }\n }\n\n if (response instanceof BoxJSONResponse) {\n //Create the file instance from the response\n return this.getFile((BoxJSONResponse) response);\n } else {\n throw new BoxAPIException(\"Commit response content type is not application/json. The response code : \"\n + response.getResponseCode());\n }\n }",
"public static int cudnnConvolutionForward(\n cudnnHandle handle, \n Pointer alpha, \n cudnnTensorDescriptor xDesc, \n Pointer x, \n cudnnFilterDescriptor wDesc, \n Pointer w, \n cudnnConvolutionDescriptor convDesc, \n int algo, \n Pointer workSpace, \n long workSpaceSizeInBytes, \n Pointer beta, \n cudnnTensorDescriptor yDesc, \n Pointer y)\n {\n return checkResult(cudnnConvolutionForwardNative(handle, alpha, xDesc, x, wDesc, w, convDesc, algo, workSpace, workSpaceSizeInBytes, beta, yDesc, y));\n }",
"public boolean mapsCell(String cell) {\n return mappedCells.stream().anyMatch(x -> x.equals(cell));\n }",
"protected static List<String> parseMandatoryStringValues(JSONObject json, String key) throws JSONException {\n\n List<String> list = null;\n JSONArray array = json.getJSONArray(key);\n list = new ArrayList<String>(array.length());\n for (int i = 0; i < array.length(); i++) {\n try {\n String entry = array.getString(i);\n list.add(entry);\n } catch (JSONException e) {\n LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_STRING_ENTRY_UNPARSABLE_1, key), e);\n }\n }\n return list;\n }",
"private void readRecord(Tokenizer tk, List<String> record) throws IOException\n {\n record.clear();\n while (tk.nextToken() == Tokenizer.TT_WORD)\n {\n record.add(tk.getToken());\n }\n }",
"public <T> T getNodeMetaData(Object key) {\n if (metaDataMap == null) {\n return (T) null;\n }\n return (T) metaDataMap.get(key);\n }",
"void applyFreshParticleOffScreen(\n @NonNull final Scene scene,\n final int position) {\n final int w = scene.getWidth();\n final int h = scene.getHeight();\n if (w == 0 || h == 0) {\n throw new IllegalStateException(\n \"Cannot generate particles if scene width or height is 0\");\n }\n\n float x = random.nextInt(w);\n float y = random.nextInt(h);\n\n // The offset to make when creating point of out bounds\n final short offset = (short) (scene.getParticleRadiusMin() + scene.getLineLength());\n\n // Point angle range\n final float startAngle;\n float endAngle;\n\n // Make random offset and calulate angles so that the direction of travel will always be\n // towards our View\n switch (random.nextInt(4)) {\n case 0:\n // offset to left\n x = (short) -offset;\n startAngle = angleDeg(pcc, pcc, x, y);\n endAngle = angleDeg(pcc, h - pcc, x, y);\n break;\n\n case 1:\n // offset to top\n y = (short) -offset;\n startAngle = angleDeg(w - pcc, pcc, x, y);\n endAngle = angleDeg(pcc, pcc, x, y);\n break;\n\n case 2:\n // offset to right\n x = (short) (w + offset);\n startAngle = angleDeg(w - pcc, h - pcc, x, y);\n endAngle = angleDeg(w - pcc, pcc, x, y);\n break;\n\n case 3:\n // offset to bottom\n y = (short) (h + offset);\n startAngle = angleDeg(pcc, h - pcc, x, y);\n endAngle = angleDeg(w - pcc, h - pcc, x, y);\n break;\n\n default:\n throw new IllegalArgumentException(\"Supplied value out of range\");\n }\n\n if (endAngle < startAngle) {\n endAngle += 360;\n }\n\n // Get random angle from angle range\n final float randomAngleInRange = startAngle + (random\n .nextInt((int) Math.abs(endAngle - startAngle)));\n final double direction = Math.toRadians(randomAngleInRange);\n\n final float dCos = (float) Math.cos(direction);\n final float dSin = (float) Math.sin(direction);\n final float speedFactor = newRandomIndividualParticleSpeedFactor();\n final float radius = newRandomIndividualParticleRadius(scene);\n\n scene.setParticleData(\n position,\n x,\n y,\n dCos,\n dSin,\n radius,\n speedFactor);\n }",
"public static authorizationpolicylabel_binding get(nitro_service service, String labelname) throws Exception{\n\t\tauthorizationpolicylabel_binding obj = new authorizationpolicylabel_binding();\n\t\tobj.set_labelname(labelname);\n\t\tauthorizationpolicylabel_binding response = (authorizationpolicylabel_binding) obj.get_resource(service);\n\t\treturn response;\n\t}"
] |
Removes each of the specified followers from the task if they are
following. Returns the complete, updated record for the affected task.
@param task The task to remove followers from.
@return Request object | [
"public ItemRequest<Task> removeFollowers(String task) {\n \n String path = String.format(\"/tasks/%s/removeFollowers\", task);\n return new ItemRequest<Task>(this, Task.class, path, \"POST\");\n }"
] | [
"private void processClassMethods(XMLStreamWriter writer, Class<?> aClass, Set<Method> methodSet) throws XMLStreamException\n {\n Method[] methods = aClass.getDeclaredMethods();\n for (Method method : methods)\n {\n if (!methodSet.contains(method) && Modifier.isPublic(method.getModifiers()) && !Modifier.isInterface(method.getModifiers()))\n {\n if (Modifier.isStatic(method.getModifiers()))\n {\n // TODO Handle static methods here\n }\n else\n {\n String name = method.getName();\n String methodSignature = createMethodSignature(method);\n String fullJavaName = aClass.getCanonicalName() + \".\" + name + methodSignature;\n\n if (!ignoreMethod(fullJavaName))\n {\n //\n // Hide the original method\n //\n writer.writeStartElement(\"method\");\n writer.writeAttribute(\"name\", name);\n writer.writeAttribute(\"sig\", methodSignature);\n\n writer.writeStartElement(\"attribute\");\n writer.writeAttribute(\"type\", \"System.ComponentModel.EditorBrowsableAttribute\");\n writer.writeAttribute(\"sig\", \"(Lcli.System.ComponentModel.EditorBrowsableState;)V\");\n writer.writeStartElement(\"parameter\");\n writer.writeCharacters(\"Never\");\n writer.writeEndElement();\n writer.writeEndElement();\n writer.writeEndElement();\n\n //\n // Create a wrapper method\n //\n name = name.toUpperCase().charAt(0) + name.substring(1);\n\n writer.writeStartElement(\"method\");\n writer.writeAttribute(\"name\", name);\n writer.writeAttribute(\"sig\", methodSignature);\n writer.writeAttribute(\"modifiers\", \"public\");\n\n writer.writeStartElement(\"body\");\n\n for (int index = 0; index <= method.getParameterTypes().length; index++)\n {\n if (index < 4)\n {\n writer.writeEmptyElement(\"ldarg_\" + index);\n }\n else\n {\n writer.writeStartElement(\"ldarg_s\");\n writer.writeAttribute(\"argNum\", Integer.toString(index));\n writer.writeEndElement();\n }\n }\n\n writer.writeStartElement(\"callvirt\");\n writer.writeAttribute(\"class\", aClass.getName());\n writer.writeAttribute(\"name\", method.getName());\n writer.writeAttribute(\"sig\", methodSignature);\n writer.writeEndElement();\n\n if (!method.getReturnType().getName().equals(\"void\"))\n {\n writer.writeEmptyElement(\"ldnull\");\n writer.writeEmptyElement(\"pop\");\n }\n writer.writeEmptyElement(\"ret\");\n writer.writeEndElement();\n writer.writeEndElement();\n\n /*\n * The private method approach doesn't work... so\n * 3. Add EditorBrowsableAttribute (Never) to original methods\n * 4. Generate C Sharp and VB variants of the DLL to avid case-sensitivity issues\n * 5. Implement static method support?\n <attribute type=\"System.ComponentModel.EditorBrowsableAttribute\" sig=\"(Lcli.System.ComponentModel.EditorBrowsableState;)V\">\n 914 <parameter>Never</parameter>\n 915 </attribute>\n */\n\n m_responseList.add(fullJavaName);\n }\n }\n }\n }\n }",
"public Object remove(String name) {\n\t\tThreadScopeContext context = ThreadScopeContextHolder.getContext();\n\t\treturn context.remove(name);\n\t}",
"public static void setTranslucentNavigationFlag(Activity activity, boolean on) {\n if (Build.VERSION.SDK_INT >= 19) {\n setFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, on);\n }\n }",
"private Map<Integer, List<Row>> createTimeEntryMap(List<Row> rows) throws ParseException\n {\n Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>();\n for (Row row : rows)\n {\n Integer workPatternID = row.getInteger(\"ID\");\n String shifts = row.getString(\"SHIFTS\");\n map.put(workPatternID, createTimeEntryRowList(shifts));\n }\n return map;\n }",
"public void print() {\n Iterator<String> iter = getKeys();\n while (iter.hasNext()) {\n String key = iter.next();\n log.info(key + \" = \" + getRawString(key));\n }\n }",
"private void readResource(net.sf.mpxj.planner.schema.Resource plannerResource) throws MPXJException\n {\n Resource mpxjResource = m_projectFile.addResource();\n\n //mpxjResource.setResourceCalendar(m_projectFile.getBaseCalendarByUniqueID(getInteger(plannerResource.getCalendar())));\n mpxjResource.setEmailAddress(plannerResource.getEmail());\n mpxjResource.setUniqueID(getInteger(plannerResource.getId()));\n mpxjResource.setName(plannerResource.getName());\n mpxjResource.setNotes(plannerResource.getNote());\n mpxjResource.setInitials(plannerResource.getShortName());\n mpxjResource.setType(getInt(plannerResource.getType()) == 2 ? ResourceType.MATERIAL : ResourceType.WORK);\n //plannerResource.getStdRate();\n //plannerResource.getOvtRate();\n //plannerResource.getUnits();\n //plannerResource.getProperties();\n\n ProjectCalendar calendar = mpxjResource.addResourceCalendar();\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 ProjectCalendar baseCalendar = m_projectFile.getCalendarByUniqueID(getInteger(plannerResource.getCalendar()));\n if (baseCalendar == null)\n {\n baseCalendar = m_defaultCalendar;\n }\n calendar.setParent(baseCalendar);\n\n m_eventManager.fireResourceReadEvent(mpxjResource);\n }",
"public T withLabel(String text, String languageCode) {\n\t\twithLabel(factory.getMonolingualTextValue(text, languageCode));\n\t\treturn getThis();\n\t}",
"public void swapSubstring(BitString other, int start, int length)\n {\n assertValidIndex(start);\n other.assertValidIndex(start);\n \n int word = start / WORD_LENGTH;\n\n int partialWordSize = (WORD_LENGTH - start) % WORD_LENGTH;\n if (partialWordSize > 0)\n {\n swapBits(other, word, 0xFFFFFFFF << (WORD_LENGTH - partialWordSize));\n ++word;\n }\n\n int remainingBits = length - partialWordSize;\n int stop = remainingBits / WORD_LENGTH;\n for (int i = word; i < stop; i++)\n {\n int temp = data[i];\n data[i] = other.data[i];\n other.data[i] = temp;\n }\n\n remainingBits %= WORD_LENGTH;\n if (remainingBits > 0)\n {\n swapBits(other, word, 0xFFFFFFFF >>> (WORD_LENGTH - remainingBits));\n }\n }",
"public static base_response update(nitro_service client, transformpolicy resource) throws Exception {\n\t\ttransformpolicy updateresource = new transformpolicy();\n\t\tupdateresource.name = resource.name;\n\t\tupdateresource.rule = resource.rule;\n\t\tupdateresource.profilename = resource.profilename;\n\t\tupdateresource.comment = resource.comment;\n\t\tupdateresource.logaction = resource.logaction;\n\t\treturn updateresource.update_resource(client);\n\t}"
] |
Clears the Parameters before performing a new search.
@return this.true; | [
"public boolean clearParameters() {\n this.query = null;\n this.fields = null;\n this.scope = null;\n this.fileExtensions = null;\n this.createdRange = null;\n this.updatedRange = null;\n this.sizeRange = null;\n this.ownerUserIds = null;\n this.ancestorFolderIds = null;\n this.contentTypes = null;\n this.type = null;\n this.trashContent = null;\n this.metadataFilter = null;\n this.sort = null;\n this.direction = null;\n return true;\n }"
] | [
"public static final String printAccrueType(AccrueType value)\n {\n return (Integer.toString(value == null ? AccrueType.PRORATED.getValue() : value.getValue()));\n }",
"@SuppressWarnings({\"unused\", \"WeakerAccess\"})\n public void pushEvent(String eventName) {\n if (eventName == null || eventName.trim().equals(\"\"))\n return;\n\n pushEvent(eventName, null);\n }",
"public CRFDatum<List<String>, CRFLabel> makeDatum(List<IN> info, int loc,\r\n edu.stanford.nlp.sequences.FeatureFactory<IN> featureFactory) {\r\n pad.set(AnswerAnnotation.class, flags.backgroundSymbol);\r\n PaddedList<IN> pInfo = new PaddedList<IN>(info, pad);\r\n\r\n ArrayList<List<String>> features = new ArrayList<List<String>>();\r\n\r\n // for (int i = 0; i < windowSize; i++) {\r\n // List featuresC = new ArrayList();\r\n // for (int j = 0; j < FeatureFactory.win[i].length; j++) {\r\n // featuresC.addAll(featureFactory.features(info, loc,\r\n // FeatureFactory.win[i][j]));\r\n // }\r\n // features.add(featuresC);\r\n // }\r\n\r\n Collection<Clique> done = new HashSet<Clique>();\r\n for (int i = 0; i < windowSize; i++) {\r\n List<String> featuresC = new ArrayList<String>();\r\n List<Clique> windowCliques = FeatureFactory.getCliques(i, 0);\r\n windowCliques.removeAll(done);\r\n done.addAll(windowCliques);\r\n for (Clique c : windowCliques) {\r\n featuresC.addAll(featureFactory.getCliqueFeatures(pInfo, loc, c)); //todo useless copy because of typing reasons\r\n }\r\n features.add(featuresC);\r\n }\r\n\r\n int[] labels = new int[windowSize];\r\n\r\n for (int i = 0; i < windowSize; i++) {\r\n String answer = pInfo.get(loc + i - windowSize + 1).get(AnswerAnnotation.class);\r\n labels[i] = classIndex.indexOf(answer);\r\n }\r\n\r\n printFeatureLists(pInfo.get(loc), features);\r\n\r\n CRFDatum<List<String>, CRFLabel> d = new CRFDatum<List<String>, CRFLabel>(features, new CRFLabel(labels));\r\n // System.err.println(d);\r\n return d;\r\n }",
"private void writePropertyStatisticsToFile(UsageStatistics usageStatistics,\n\t\t\tString fileName) {\n\t\ttry (PrintStream out = new PrintStream(\n\t\t\t\tExampleHelpers.openExampleFileOuputStream(fileName))) {\n\n\t\t\tout.println(\"Property id,in statements,in qualifiers,in references,total\");\n\n\t\t\tfor (Entry<PropertyIdValue, Integer> entry : usageStatistics.propertyCountsMain\n\t\t\t\t\t.entrySet()) {\n\t\t\t\tint qCount = usageStatistics.propertyCountsQualifier.get(entry\n\t\t\t\t\t\t.getKey());\n\t\t\t\tint rCount = usageStatistics.propertyCountsReferences.get(entry\n\t\t\t\t\t\t.getKey());\n\t\t\t\tint total = entry.getValue() + qCount + rCount;\n\t\t\t\tout.println(entry.getKey().getId() + \",\" + entry.getValue()\n\t\t\t\t\t\t+ \",\" + qCount + \",\" + rCount + \",\" + total);\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"private static float angleDeg(final float ax, final float ay,\n final float bx, final float by) {\n final double angleRad = Math.atan2(ay - by, ax - bx);\n double angle = Math.toDegrees(angleRad);\n if (angleRad < 0) {\n angle += 360;\n }\n return (float) angle;\n }",
"private String decodeStr(String str) {\r\n try {\r\n return MimeUtility.decodeText(str);\r\n } catch (UnsupportedEncodingException e) {\r\n return str;\r\n }\r\n }",
"private ClassNode getGenericsResolvedTypeOfFieldOrProperty(AnnotatedNode an, ClassNode type) {\n if (!type.isUsingGenerics()) return type;\n Map<String, GenericsType> connections = new HashMap();\n //TODO: inner classes mean a different this-type. This is ignored here!\n extractGenericsConnections(connections, typeCheckingContext.getEnclosingClassNode(), an.getDeclaringClass());\n type= applyGenericsContext(connections, type);\n return type;\n }",
"private void writeCalendarHours(ProjectCalendar parentCalendar, ProjectCalendarHours record) throws IOException\n {\n m_buffer.setLength(0);\n\n int recordNumber;\n\n if (!parentCalendar.isDerived())\n {\n recordNumber = MPXConstants.BASE_CALENDAR_HOURS_RECORD_NUMBER;\n }\n else\n {\n recordNumber = MPXConstants.RESOURCE_CALENDAR_HOURS_RECORD_NUMBER;\n }\n\n DateRange range1 = record.getRange(0);\n if (range1 == null)\n {\n range1 = DateRange.EMPTY_RANGE;\n }\n\n DateRange range2 = record.getRange(1);\n if (range2 == null)\n {\n range2 = DateRange.EMPTY_RANGE;\n }\n\n DateRange range3 = record.getRange(2);\n if (range3 == null)\n {\n range3 = DateRange.EMPTY_RANGE;\n }\n\n m_buffer.append(recordNumber);\n m_buffer.append(m_delimiter);\n m_buffer.append(format(record.getDay()));\n m_buffer.append(m_delimiter);\n m_buffer.append(format(formatTime(range1.getStart())));\n m_buffer.append(m_delimiter);\n m_buffer.append(format(formatTime(range1.getEnd())));\n m_buffer.append(m_delimiter);\n m_buffer.append(format(formatTime(range2.getStart())));\n m_buffer.append(m_delimiter);\n m_buffer.append(format(formatTime(range2.getEnd())));\n m_buffer.append(m_delimiter);\n m_buffer.append(format(formatTime(range3.getStart())));\n m_buffer.append(m_delimiter);\n m_buffer.append(format(formatTime(range3.getEnd())));\n stripTrailingDelimiters(m_buffer);\n m_buffer.append(MPXConstants.EOL);\n\n m_writer.write(m_buffer.toString());\n }",
"@Override\n public ActivityInterface getActivityInterface() {\n if (activityInterface == null) {\n activityInterface = new ActivityInterface(apiKey, sharedSecret, transport);\n }\n return activityInterface;\n }"
] |
Use this API to flush cachecontentgroup. | [
"public static base_response flush(nitro_service client, cachecontentgroup resource) throws Exception {\n\t\tcachecontentgroup flushresource = new cachecontentgroup();\n\t\tflushresource.name = resource.name;\n\t\tflushresource.query = resource.query;\n\t\tflushresource.host = resource.host;\n\t\tflushresource.selectorvalue = resource.selectorvalue;\n\t\tflushresource.force = resource.force;\n\t\treturn flushresource.perform_operation(client,\"flush\");\n\t}"
] | [
"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 static double getRobustTreeEditDistance(String dom1, String dom2) {\n\n\t\tLblTree domTree1 = null, domTree2 = null;\n\t\ttry {\n\t\t\tdomTree1 = getDomTree(dom1);\n\t\t\tdomTree2 = getDomTree(dom2);\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\tdouble DD = 0.0;\n\t\tRTED_InfoTree_Opt rted;\n\t\tdouble ted;\n\n\t\trted = new RTED_InfoTree_Opt(1, 1, 1);\n\n\t\t// compute tree edit distance\n\t\trted.init(domTree1, domTree2);\n\n\t\tint maxSize = Math.max(domTree1.getNodeCount(), domTree2.getNodeCount());\n\n\t\trted.computeOptimalStrategy();\n\t\tted = rted.nonNormalizedTreeDist();\n\t\tted /= (double) maxSize;\n\n\t\tDD = ted;\n\t\treturn DD;\n\t}",
"public float conditionalLogProb(int[] given, int of) {\r\n if (given.length != windowSize - 1) {\r\n System.err.println(\"error computing conditional log prob\");\r\n System.exit(0);\r\n }\r\n int[] label = indicesFront(given);\r\n float[] masses = new float[label.length];\r\n for (int i = 0; i < masses.length; i++) {\r\n masses[i] = table[label[i]];\r\n }\r\n float z = ArrayMath.logSum(masses);\r\n\r\n return table[indexOf(given, of)] - z;\r\n }",
"@SafeVarargs\n private final <T> Set<T> join(Set<T>... sets)\n {\n Set<T> result = new HashSet<>();\n if (sets == null)\n return result;\n\n for (Set<T> set : sets)\n {\n if (set != null)\n result.addAll(set);\n }\n return result;\n }",
"@Override\n public boolean parseAndValidateRequest() {\n boolean result = false;\n if(!super.parseAndValidateRequest() || !hasVectorClock(this.isVectorClockOptional)\n || !hasContentLength() || !hasContentType()) {\n result = false;\n } else {\n result = true;\n }\n\n return result;\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 }",
"protected TokenList.Token parseBlockNoParentheses(TokenList tokens, Sequence sequence, boolean insideMatrixConstructor) {\n\n // search for matrix bracket operations\n if( !insideMatrixConstructor ) {\n parseBracketCreateMatrix(tokens, sequence);\n }\n\n // First create sequences from anything involving a colon\n parseSequencesWithColons(tokens, sequence );\n\n // process operators depending on their priority\n parseNegOp(tokens, sequence);\n parseOperationsL(tokens, sequence);\n parseOperationsLR(new Symbol[]{Symbol.POWER, Symbol.ELEMENT_POWER}, tokens, sequence);\n parseOperationsLR(new Symbol[]{Symbol.TIMES, Symbol.RDIVIDE, Symbol.LDIVIDE, Symbol.ELEMENT_TIMES, Symbol.ELEMENT_DIVIDE}, tokens, sequence);\n parseOperationsLR(new Symbol[]{Symbol.PLUS, Symbol.MINUS}, tokens, sequence);\n\n // Commas are used in integer sequences. Can be used to force to compiler to treat - as negative not\n // minus. They can now be removed since they have served their purpose\n stripCommas(tokens);\n\n // now construct rest of the lists and combine them together\n parseIntegerLists(tokens);\n parseCombineIntegerLists(tokens);\n\n if( !insideMatrixConstructor ) {\n if (tokens.size() > 1) {\n System.err.println(\"Remaining tokens: \"+tokens.size);\n TokenList.Token t = tokens.first;\n while( t != null ) {\n System.err.println(\" \"+t);\n t = t.next;\n }\n throw new RuntimeException(\"BUG in parser. There should only be a single token left\");\n }\n return tokens.first;\n } else {\n return null;\n }\n }",
"@ArgumentsChecked\n\t@Throws(IllegalNullArgumentException.class)\n\tpublic static double checkDouble(@Nonnull final Number number) {\n\t\tCheck.notNull(number, \"number\");\n\t\tif (!isInDoubleRange(number)) {\n\t\t\tthrow new IllegalNumberRangeException(number.toString(), DOUBLE_MIN, DOUBLE_MAX);\n\t\t}\n\n\t\treturn number.doubleValue();\n\t}",
"static SortedSet<String> createStatsItems(String statsType)\n throws IOException {\n SortedSet<String> statsItems = new TreeSet<>();\n SortedSet<String> functionItems = new TreeSet<>();\n if (statsType != null) {\n Matcher m = fpStatsItems.matcher(statsType.trim());\n while (m.find()) {\n String tmpStatsItem = m.group(2).trim();\n if (STATS_TYPES.contains(tmpStatsItem)) {\n statsItems.add(tmpStatsItem);\n } else if (tmpStatsItem.equals(STATS_TYPE_ALL)) {\n for (String type : STATS_TYPES) {\n statsItems.add(type);\n }\n } else if (STATS_FUNCTIONS.contains(tmpStatsItem)) {\n if (m.group(3) == null) {\n throw new IOException(\"'\" + tmpStatsItem + \"' should be called as '\"\n + tmpStatsItem + \"()' with an optional argument\");\n } else {\n functionItems.add(m.group(1).trim());\n }\n } else {\n throw new IOException(\"unknown statsType '\" + tmpStatsItem + \"'\");\n }\n }\n }\n if (statsItems.size() == 0 && functionItems.size() == 0) {\n statsItems.add(STATS_TYPE_SUM);\n statsItems.add(STATS_TYPE_N);\n statsItems.add(STATS_TYPE_MEAN);\n }\n if (functionItems.size() > 0) {\n statsItems.addAll(functionItems);\n }\n return statsItems;\n }"
] |
Adds a node to this graph.
@param node the node | [
"public void addNode(NodeT node) {\n node.setOwner(this);\n nodeTable.put(node.key(), node);\n }"
] | [
"public boolean preHandle(HttpServletRequest request,\n HttpServletResponse response, Object handler) throws Exception {\n\n String queryString = request.getQueryString() == null ? \"\" : request.getQueryString();\n\n if (ConfigurationService.getInstance().isValid()\n || request.getServletPath().startsWith(\"/configuration\")\n || request.getServletPath().startsWith(\"/resources\")\n || queryString.contains(\"requestFromConfiguration=true\")) {\n return true;\n } else {\n response.sendRedirect(\"configuration\");\n return false;\n }\n }",
"private void addCalendars(MpxjTreeNode parentNode, ProjectFile file)\n {\n for (ProjectCalendar calendar : file.getCalendars())\n {\n addCalendar(parentNode, calendar);\n }\n }",
"@SuppressWarnings(\"unchecked\")\n public static void executeCommand(String[] args) throws IOException {\n\n OptionParser parser = getParser();\n\n // declare parameters\n List<String> metaKeys = null;\n String url = null;\n\n // parse command-line input\n args = AdminToolUtils.copyArrayAddFirst(args, \"--\" + OPT_HEAD_META_CHECK);\n OptionSet options = parser.parse(args);\n if(options.has(AdminParserUtils.OPT_HELP)) {\n printHelp(System.out);\n return;\n }\n\n // check required options and/or conflicting options\n AdminParserUtils.checkRequired(options, OPT_HEAD_META_CHECK);\n AdminParserUtils.checkRequired(options, AdminParserUtils.OPT_URL);\n\n // load parameters\n metaKeys = (List<String>) options.valuesOf(OPT_HEAD_META_CHECK);\n url = (String) options.valueOf(AdminParserUtils.OPT_URL);\n\n\n // execute command\n if(metaKeys.size() == 0\n || (metaKeys.size() == 1 && metaKeys.get(0).equals(METAKEY_ALL))) {\n metaKeys = Lists.newArrayList();\n metaKeys.add(MetadataStore.CLUSTER_KEY);\n metaKeys.add(MetadataStore.STORES_KEY);\n metaKeys.add(MetadataStore.SERVER_STATE_KEY);\n }\n\n AdminClient adminClient = AdminToolUtils.getAdminClient(url);\n\n doMetaCheck(adminClient, metaKeys);\n }",
"public static base_response update(nitro_service client, sslcertkey resource) throws Exception {\n\t\tsslcertkey updateresource = new sslcertkey();\n\t\tupdateresource.certkey = resource.certkey;\n\t\tupdateresource.expirymonitor = resource.expirymonitor;\n\t\tupdateresource.notificationperiod = resource.notificationperiod;\n\t\treturn updateresource.update_resource(client);\n\t}",
"public void symm2x2_fast( double a11 , double a12, double a22 )\n {\n// double p = (a11 - a22)*0.5;\n// double r = Math.sqrt(p*p + a12*a12);\n//\n// value0.real = a22 + a12*a12/(r-p);\n// value1.real = a22 - a12*a12/(r+p);\n// }\n//\n// public void symm2x2_std( double a11 , double a12, double a22 )\n// {\n double left = (a11+a22)*0.5;\n double b = (a11-a22)*0.5;\n double right = Math.sqrt(b*b+a12*a12);\n value0.real = left + right;\n value1.real = left - right;\n }",
"public float getPositionX(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 * SIZEOF_FLOAT);\n }",
"public Map<String, String> getSitePath() {\n\n if (m_sitePaths == null) {\n m_sitePaths = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() {\n\n public Object transform(Object rootPath) {\n\n if (rootPath instanceof String) {\n return getRequestContext().removeSiteRoot((String)rootPath);\n }\n return null;\n }\n });\n }\n return m_sitePaths;\n }",
"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 }",
"protected boolean closeAtomically() {\n if (isClosed.compareAndSet(false, true)) {\n Closeable.closeQuietly(networkStatsListener);\n return true;\n } else {\n //was already closed.\n return false;\n }\n }"
] |
Add a dependency to the module.
@param dependency Dependency | [
"public void addDependency(final Dependency dependency) {\n if(dependency != null && !dependencies.contains(dependency)){\n this.dependencies.add(dependency);\n }\n }"
] | [
"private Map<String, Integer> runSampling(\n final ProctorContext proctorContext,\n final Set<String> targetTestNames,\n final TestType testType,\n final int determinationsToRun\n ) {\n final Set<String> targetTestGroups = getTargetTestGroups(targetTestNames);\n final Map<String, Integer> testGroupToOccurrences = Maps.newTreeMap();\n for (final String testGroup : targetTestGroups) {\n testGroupToOccurrences.put(testGroup, 0);\n }\n\n for (int i = 0; i < determinationsToRun; ++i) {\n final Identifiers identifiers = TestType.RANDOM.equals(testType)\n ? new Identifiers(Collections.<TestType, String>emptyMap(), /* randomEnabled */ true)\n : Identifiers.of(testType, Long.toString(random.nextLong()));\n final AbstractGroups groups = supplier.getRandomGroups(proctorContext, identifiers);\n for (final Entry<String, TestBucket> e : groups.getProctorResult().getBuckets().entrySet()) {\n final String testName = e.getKey();\n if (targetTestNames.contains(testName)) {\n final int group = e.getValue().getValue();\n final String testGroup = testName + group;\n testGroupToOccurrences.put(testGroup, testGroupToOccurrences.get(testGroup) + 1);\n }\n }\n }\n\n return testGroupToOccurrences;\n }",
"public static Duration add(Duration a, Duration b, ProjectProperties defaults)\n {\n if (a == null && b == null)\n {\n return null;\n }\n if (a == null)\n {\n return b;\n }\n if (b == null)\n {\n return a;\n }\n TimeUnit unit = a.getUnits();\n if (b.getUnits() != unit)\n {\n b = b.convertUnits(unit, defaults);\n }\n\n return Duration.getInstance(a.getDuration() + b.getDuration(), unit);\n }",
"protected void processCalendarData(ProjectCalendar calendar, Row row)\n {\n int dayIndex = row.getInt(\"CD_DAY_OR_EXCEPTION\");\n if (dayIndex == 0)\n {\n processCalendarException(calendar, row);\n }\n else\n {\n processCalendarHours(calendar, row, dayIndex);\n }\n }",
"@SafeVarargs\n public static <K, V> Map<K, V> map(final Entry<? extends K, ? extends V>... entries) {\n final Map<K, V> map = new LinkedHashMap<K, V>(entries.length);\n for (final Entry<? extends K, ? extends V> entry : entries) {\n map.put(entry.getKey(), entry.getValue());\n }\n return map;\n }",
"private void nodeProperties(Options opt) {\n\tOptions def = opt.getGlobalOptions();\n\tif (opt.nodeFontName != def.nodeFontName)\n\t w.print(\",fontname=\\\"\" + opt.nodeFontName + \"\\\"\");\n\tif (opt.nodeFontColor != def.nodeFontColor)\n\t w.print(\",fontcolor=\\\"\" + opt.nodeFontColor + \"\\\"\");\n\tif (opt.nodeFontSize != def.nodeFontSize)\n\t w.print(\",fontsize=\" + fmt(opt.nodeFontSize));\n\tw.print(opt.shape.style);\n\tw.println(\"];\");\n }",
"public static base_response update(nitro_service client, nsconfig resource) throws Exception {\n\t\tnsconfig updateresource = new nsconfig();\n\t\tupdateresource.ipaddress = resource.ipaddress;\n\t\tupdateresource.netmask = resource.netmask;\n\t\tupdateresource.nsvlan = resource.nsvlan;\n\t\tupdateresource.ifnum = resource.ifnum;\n\t\tupdateresource.tagged = resource.tagged;\n\t\tupdateresource.httpport = resource.httpport;\n\t\tupdateresource.maxconn = resource.maxconn;\n\t\tupdateresource.maxreq = resource.maxreq;\n\t\tupdateresource.cip = resource.cip;\n\t\tupdateresource.cipheader = resource.cipheader;\n\t\tupdateresource.cookieversion = resource.cookieversion;\n\t\tupdateresource.securecookie = resource.securecookie;\n\t\tupdateresource.pmtumin = resource.pmtumin;\n\t\tupdateresource.pmtutimeout = resource.pmtutimeout;\n\t\tupdateresource.ftpportrange = resource.ftpportrange;\n\t\tupdateresource.crportrange = resource.crportrange;\n\t\tupdateresource.timezone = resource.timezone;\n\t\tupdateresource.grantquotamaxclient = resource.grantquotamaxclient;\n\t\tupdateresource.exclusivequotamaxclient = resource.exclusivequotamaxclient;\n\t\tupdateresource.grantquotaspillover = resource.grantquotaspillover;\n\t\tupdateresource.exclusivequotaspillover = resource.exclusivequotaspillover;\n\t\tupdateresource.nwfwmode = resource.nwfwmode;\n\t\treturn updateresource.update_resource(client);\n\t}",
"private void removeGroupIdFromTablePaths(int groupIdToRemove) {\n PreparedStatement queryStatement = null;\n PreparedStatement statement = null;\n ResultSet results = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n queryStatement = sqlConnection.prepareStatement(\"SELECT * FROM \" + Constants.DB_TABLE_PATH);\n results = queryStatement.executeQuery();\n // this is a hashamp from a pathId to the string of groups\n HashMap<Integer, String> idToGroups = new HashMap<Integer, String>();\n while (results.next()) {\n int pathId = results.getInt(Constants.GENERIC_ID);\n String stringGroupIds = results.getString(Constants.PATH_PROFILE_GROUP_IDS);\n int[] groupIds = Utils.arrayFromStringOfIntegers(stringGroupIds);\n String newGroupIds = \"\";\n for (int i = 0; i < groupIds.length; i++) {\n if (groupIds[i] != groupIdToRemove) {\n newGroupIds += (groupIds[i] + \",\");\n }\n }\n idToGroups.put(pathId, newGroupIds);\n }\n\n // now i want to go though the hashmap and for each pathId, add\n // update the newGroupIds\n for (Map.Entry<Integer, String> entry : idToGroups.entrySet()) {\n Integer pathId = entry.getKey();\n String newGroupIds = entry.getValue();\n\n statement = sqlConnection.prepareStatement(\n \"UPDATE \" + Constants.DB_TABLE_PATH\n + \" SET \" + Constants.PATH_PROFILE_GROUP_IDS + \" = ? \"\n + \" WHERE \" + Constants.GENERIC_ID + \" = ?\"\n );\n statement.setString(1, newGroupIds);\n statement.setInt(2, pathId);\n statement.executeUpdate();\n }\n } catch (SQLException 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 (queryStatement != null) {\n queryStatement.close();\n }\n } catch (Exception e) {\n }\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n }",
"private void setFittingWeekDay(Calendar date) {\n\n date.set(Calendar.DAY_OF_MONTH, 1);\n int weekDayFirst = date.get(Calendar.DAY_OF_WEEK);\n int firstFittingWeekDay = (((m_weekDay.toInt() + I_CmsSerialDateValue.NUM_OF_WEEKDAYS) - weekDayFirst)\n % I_CmsSerialDateValue.NUM_OF_WEEKDAYS) + 1;\n int fittingWeekDay = firstFittingWeekDay + (I_CmsSerialDateValue.NUM_OF_WEEKDAYS * m_weekOfMonth.ordinal());\n if (fittingWeekDay > date.getActualMaximum(Calendar.DAY_OF_MONTH)) {\n fittingWeekDay -= I_CmsSerialDateValue.NUM_OF_WEEKDAYS;\n }\n date.set(Calendar.DAY_OF_MONTH, fittingWeekDay);\n }",
"public Headers toHeaders() {\n Headers headers = new Headers();\n if (!getMatch().isEmpty()) {\n headers = headers.add(new Header(HeaderConstants.IF_MATCH, buildTagHeaderValue(getMatch())));\n }\n if (!getNoneMatch().isEmpty()) {\n headers = headers.add(new Header(HeaderConstants.IF_NONE_MATCH, buildTagHeaderValue(getNoneMatch())));\n }\n if (modifiedSince.isPresent()) {\n headers = headers.set(HeaderUtils.toHttpDate(HeaderConstants.IF_MODIFIED_SINCE, modifiedSince.get()));\n }\n if (unModifiedSince.isPresent()) {\n headers = headers.set(HeaderUtils.toHttpDate(HeaderConstants.IF_UNMODIFIED_SINCE, unModifiedSince.get()));\n }\n\n return headers;\n }"
] |
Creates a descriptor for the bundle in the same folder where the bundle files are located.
@throws CmsException thrown if creation fails. | [
"private void createAndLockDescriptorFile() throws CmsException {\n\n String sitePath = m_sitepath + m_basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX;\n m_desc = m_cms.createResource(\n sitePath,\n OpenCms.getResourceManager().getResourceType(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR.toString()));\n m_descFile = LockedFile.lockResource(m_cms, m_desc);\n m_descFile.setCreated(true);\n }"
] | [
"public ActivityCodeValue addValue(Integer uniqueID, String name, String description)\n {\n ActivityCodeValue value = new ActivityCodeValue(this, uniqueID, name, description);\n m_values.add(value);\n return value;\n }",
"public static clusterinstance get(nitro_service service, Long clid) throws Exception{\n\t\tclusterinstance obj = new clusterinstance();\n\t\tobj.set_clid(clid);\n\t\tclusterinstance response = (clusterinstance) obj.get_resource(service);\n\t\treturn response;\n\t}",
"@SuppressWarnings(\"unchecked\")\n protected static void visitSubreports(DynamicReport dr, Map _parameters) {\n for (DJGroup group : dr.getColumnsGroups()) {\n //Header Subreports\n for (Subreport subreport : group.getHeaderSubreports()) {\n if (subreport.getDynamicReport() != null) {\n visitSubreport(dr, subreport);\n visitSubreports(subreport.getDynamicReport(), _parameters);\n }\n }\n\n //Footer Subreports\n for (Subreport subreport : group.getFooterSubreports()) {\n if (subreport.getDynamicReport() != null) {\n visitSubreport(dr, subreport);\n visitSubreports(subreport.getDynamicReport(), _parameters);\n }\n }\n }\n\n }",
"private static ChangeEvent<BsonDocument> coalesceChangeEvents(\n final ChangeEvent<BsonDocument> lastUncommittedChangeEvent,\n final ChangeEvent<BsonDocument> newestChangeEvent\n ) {\n if (lastUncommittedChangeEvent == null) {\n return newestChangeEvent;\n }\n switch (lastUncommittedChangeEvent.getOperationType()) {\n case INSERT:\n switch (newestChangeEvent.getOperationType()) {\n // Coalesce replaces/updates to inserts since we believe at some point a document did not\n // exist remotely and that this replace or update should really be an insert if we are\n // still in an uncommitted state.\n case REPLACE:\n case UPDATE:\n return new ChangeEvent<>(\n newestChangeEvent.getId(),\n OperationType.INSERT,\n newestChangeEvent.getFullDocument(),\n newestChangeEvent.getNamespace(),\n newestChangeEvent.getDocumentKey(),\n null,\n newestChangeEvent.hasUncommittedWrites()\n );\n default:\n break;\n }\n break;\n case DELETE:\n switch (newestChangeEvent.getOperationType()) {\n // Coalesce inserts to replaces since we believe at some point a document existed\n // remotely and that this insert should really be an replace if we are still in an\n // uncommitted state.\n case INSERT:\n return new ChangeEvent<>(\n newestChangeEvent.getId(),\n OperationType.REPLACE,\n newestChangeEvent.getFullDocument(),\n newestChangeEvent.getNamespace(),\n newestChangeEvent.getDocumentKey(),\n null,\n newestChangeEvent.hasUncommittedWrites()\n );\n default:\n break;\n }\n break;\n case UPDATE:\n switch (newestChangeEvent.getOperationType()) {\n case UPDATE:\n return new ChangeEvent<>(\n newestChangeEvent.getId(),\n OperationType.UPDATE,\n newestChangeEvent.getFullDocument(),\n newestChangeEvent.getNamespace(),\n newestChangeEvent.getDocumentKey(),\n lastUncommittedChangeEvent.getUpdateDescription() != null\n ? lastUncommittedChangeEvent\n .getUpdateDescription()\n .merge(newestChangeEvent.getUpdateDescription())\n : newestChangeEvent.getUpdateDescription(),\n newestChangeEvent.hasUncommittedWrites()\n );\n case REPLACE:\n return new ChangeEvent<>(\n newestChangeEvent.getId(),\n OperationType.REPLACE,\n newestChangeEvent.getFullDocument(),\n newestChangeEvent.getNamespace(),\n newestChangeEvent.getDocumentKey(),\n null,\n newestChangeEvent.hasUncommittedWrites()\n );\n default:\n break;\n }\n break;\n case REPLACE:\n switch (newestChangeEvent.getOperationType()) {\n case UPDATE:\n return new ChangeEvent<>(\n newestChangeEvent.getId(),\n OperationType.REPLACE,\n newestChangeEvent.getFullDocument(),\n newestChangeEvent.getNamespace(),\n newestChangeEvent.getDocumentKey(),\n null,\n newestChangeEvent.hasUncommittedWrites()\n );\n default:\n break;\n }\n break;\n default:\n break;\n }\n return newestChangeEvent;\n }",
"public float get(int row, int col) {\n if (row < 0 || row > 3) {\n throw new IndexOutOfBoundsException(\"Index: \" + row + \", Size: 4\");\n }\n if (col < 0 || col > 3) {\n throw new IndexOutOfBoundsException(\"Index: \" + col + \", Size: 4\");\n }\n\n return m_data[row * 4 + col];\n }",
"protected void layoutGroupFooterLabels(DJGroup djgroup, JRDesignGroup jgroup, int x, int y, int width, int height) {\n\t\t//List footerVariables = djgroup.getFooterVariables();\n\t\tDJGroupLabel label = djgroup.getFooterLabel();\n\n\t\t//if (label == null || footerVariables.isEmpty())\n\t\t\t//return;\n\n\t\t//PropertyColumn col = djgroup.getColumnToGroupBy();\n\t\tJRDesignBand band = LayoutUtils.getBandFromSection((JRDesignSection) jgroup.getGroupFooterSection());\n\n//\t\tlog.debug(\"Adding footer group label for group \" + djgroup);\n\n\t\t/*DJGroupVariable lmvar = findLeftMostColumn(footerVariables);\n\t\tAbstractColumn lmColumn = lmvar.getColumnToApplyOperation();\n\t\tint width = lmColumn.getPosX().intValue() - col.getPosX().intValue();\n\n\t\tint yOffset = findYOffsetForGroupLabel(band);*/\n\n\t\tJRDesignExpression labelExp;\n\t\tif (label.isJasperExpression()) //a text with things like \"$F{myField}\"\n\t\t\tlabelExp = ExpressionUtils.createStringExpression(label.getText());\n\t\telse if (label.getLabelExpression() != null){\n\t\t\tlabelExp = ExpressionUtils.createExpression(jgroup.getName() + \"_labelExpression\", label.getLabelExpression(), true);\n\t\t} else //a simple text\n\t\t\t//labelExp = ExpressionUtils.createStringExpression(\"\\\"\"+ Utils.escapeTextForExpression(label.getText())+ \"\\\"\");\n\t\t\tlabelExp = ExpressionUtils.createStringExpression(\"\\\"\"+ label.getText() + \"\\\"\");\n\t\tJRDesignTextField labelTf = new JRDesignTextField();\n\t\tlabelTf.setExpression(labelExp);\n\t\tlabelTf.setWidth(width);\n\t\tlabelTf.setHeight(height);\n\t\tlabelTf.setX(x);\n\t\tlabelTf.setY(y);\n\t\t//int yOffsetGlabel = labelTf.getHeight();\n\t\tlabelTf.setPositionType( PositionTypeEnum.FIX_RELATIVE_TO_TOP );\n\t\tapplyStyleToElement(label.getStyle(), labelTf);\n\t\tband.addElement(labelTf);\n\t}",
"private static void addCauseToBacktrace(final Throwable cause, final List<String> bTrace) {\n if (cause.getMessage() == null) {\n bTrace.add(BT_CAUSED_BY_PREFIX + cause.getClass().getName());\n } else {\n bTrace.add(BT_CAUSED_BY_PREFIX + cause.getClass().getName() + \": \" + cause.getMessage());\n }\n for (final StackTraceElement ste : cause.getStackTrace()) {\n bTrace.add(BT_PREFIX + ste.toString());\n }\n if (cause.getCause() != null) {\n addCauseToBacktrace(cause.getCause(), bTrace);\n }\n }",
"public ResponseOnSingeRequest onComplete(Response response) {\n\n cancelCancellable();\n try {\n \n Map<String, List<String>> responseHeaders = null;\n if (responseHeaderMeta != null) {\n responseHeaders = new LinkedHashMap<String, List<String>>();\n if (responseHeaderMeta.isGetAll()) {\n for (Map.Entry<String, List<String>> header : response\n .getHeaders()) {\n responseHeaders.put(header.getKey().toLowerCase(Locale.ROOT), header.getValue());\n }\n } else {\n for (String key : responseHeaderMeta.getKeys()) {\n if (response.getHeaders().containsKey(key)) {\n responseHeaders.put(key.toLowerCase(Locale.ROOT),\n response.getHeaders().get(key));\n }\n }\n }\n }\n\n int statusCodeInt = response.getStatusCode();\n String statusCode = statusCodeInt + \" \" + response.getStatusText();\n String charset = ParallecGlobalConfig.httpResponseBodyCharsetUsesResponseContentType &&\n response.getContentType()!=null ? \n AsyncHttpProviderUtils.parseCharset(response.getContentType())\n : ParallecGlobalConfig.httpResponseBodyDefaultCharset;\n if(charset == null){\n getLogger().error(\"charset is not provided from response content type. Use default\");\n charset = ParallecGlobalConfig.httpResponseBodyDefaultCharset; \n }\n reply(response.getResponseBody(charset), false, null, null, statusCode,\n statusCodeInt, responseHeaders);\n } catch (IOException e) {\n getLogger().error(\"fail response.getResponseBody \" + e);\n }\n\n return null;\n }",
"public Map<String, Object> getArtifactFieldsFilters() {\n\t\tfinal Map<String, Object> params = new HashMap<String, Object>();\n\n for(final Filter filter: filters){\n params.putAll(filter.artifactFilterFields());\n }\n\n\t\treturn params;\n\t}"
] |
Convert raw value as read from the MPP file into a Java type.
@param type MPP value type
@param value raw value data
@return Java object | [
"protected Object getTypedValue(int type, byte[] value)\n {\n Object result;\n\n switch (type)\n {\n case 4: // Date\n {\n result = MPPUtility.getTimestamp(value, 0);\n break;\n }\n\n case 6: // Duration\n {\n TimeUnit units = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(value, 4), m_properties.getDefaultDurationUnits());\n result = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(value, 0), units);\n break;\n }\n\n case 9: // Cost\n {\n result = Double.valueOf(MPPUtility.getDouble(value, 0) / 100);\n break;\n }\n\n case 15: // Number\n {\n result = Double.valueOf(MPPUtility.getDouble(value, 0));\n break;\n }\n\n case 36058:\n case 21: // Text\n {\n result = MPPUtility.getUnicodeString(value, 0);\n break;\n }\n\n default:\n {\n result = value;\n break;\n }\n }\n\n return result;\n }"
] | [
"public void removePathnameFromProfile(int path_id, int profileId) {\n PreparedStatement statement = null;\n try (Connection sqlConnection = sqlService.getConnection()) {\n statement = sqlConnection.prepareStatement(\n \"DELETE FROM \" + Constants.DB_TABLE_ENABLED_OVERRIDE +\n \" WHERE \" + Constants.ENABLED_OVERRIDES_PATH_ID + \" = ?\"\n );\n statement.setInt(1, path_id);\n statement.executeUpdate();\n statement.close();\n\n statement = sqlConnection.prepareStatement(\n \"DELETE FROM \" + Constants.DB_TABLE_PATH +\n \" WHERE \" + Constants.GENERIC_ID + \" = ?\"\n );\n statement.setInt(1, path_id);\n statement.executeUpdate();\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n }",
"public static URI createRestURI(\n final String matrixId, final int row, final int col,\n final WMTSLayerParam layerParam) throws URISyntaxException {\n String path = layerParam.baseURL;\n if (layerParam.dimensions != null) {\n for (int i = 0; i < layerParam.dimensions.length; i++) {\n String dimension = layerParam.dimensions[i];\n String value = layerParam.dimensionParams.optString(dimension);\n if (value == null) {\n value = layerParam.dimensionParams.getString(dimension.toUpperCase());\n }\n path = path.replace(\"{\" + dimension + \"}\", value);\n }\n }\n path = path.replace(\"{TileMatrixSet}\", layerParam.matrixSet);\n path = path.replace(\"{TileMatrix}\", matrixId);\n path = path.replace(\"{TileRow}\", String.valueOf(row));\n path = path.replace(\"{TileCol}\", String.valueOf(col));\n path = path.replace(\"{style}\", layerParam.style);\n path = path.replace(\"{Layer}\", layerParam.layer);\n\n return new URI(path);\n }",
"public GetAssignmentGroupOptions includes(List<Include> includes) {\n List<Include> assignmentDependents = Arrays.asList(Include.DISCUSSION_TOPIC, Include.ASSIGNMENT_VISIBILITY, Include.SUBMISSION);\n if(includes.stream().anyMatch(assignmentDependents::contains) && !includes.contains(Include.ASSIGNMENTS)) {\n throw new IllegalArgumentException(\"Including discussion topics, all dates, assignment visibility or submissions is only valid if you also include submissions\");\n }\n addEnumList(\"include[]\", includes);\n return this;\n }",
"public static void applyWsdlExtensions(Bus bus) {\n\n ExtensionRegistry registry = bus.getExtension(WSDLManager.class).getExtensionRegistry();\n\n try {\n\n JAXBExtensionHelper.addExtensions(registry,\n javax.wsdl.Definition.class,\n org.talend.esb.mep.requestcallback.impl.wsdl.PLType.class);\n\n JAXBExtensionHelper.addExtensions(registry,\n javax.wsdl.Binding.class,\n org.talend.esb.mep.requestcallback.impl.wsdl.CallbackExtension.class);\n\n } catch (JAXBException e) {\n throw new RuntimeException(\"Failed to add WSDL JAXB extensions\", e);\n }\n }",
"public CustomField getCustomField(FieldType field)\n {\n CustomField result = m_configMap.get(field);\n if (result == null)\n {\n result = new CustomField(field, this);\n m_configMap.put(field, result);\n }\n return result;\n }",
"public static void rebuild(final MODE newMode) {\n if (mode != newMode) {\n mode = newMode;\n TYPE type;\n switch (mode) {\n case DEBUG:\n type = TYPE.ANDROID;\n Log.startFullLog();\n break;\n case DEVELOPER:\n type = TYPE.PERSISTENT;\n Log.stopFullLog();\n break;\n case USER:\n type = TYPE.ANDROID;\n break;\n default:\n type = DEFAULT_TYPE;\n Log.stopFullLog();\n break;\n }\n currentLog = getLog(type);\n }\n }",
"public Duration getWork(Date date, TimeUnit format)\n {\n ProjectCalendarDateRanges ranges = getRanges(date, null, null);\n long time = getTotalTime(ranges);\n return convertFormat(time, format);\n }",
"protected void runScript(File script) {\n if (!script.exists()) {\n JOptionPane.showMessageDialog(cliGuiCtx.getMainPanel(), script.getAbsolutePath() + \" does not exist.\",\n \"Unable to run script.\", JOptionPane.ERROR_MESSAGE);\n return;\n }\n\n int choice = JOptionPane.showConfirmDialog(cliGuiCtx.getMainPanel(), \"Run CLI script \" + script.getName() + \"?\",\n \"Confirm run script\", JOptionPane.YES_NO_OPTION);\n if (choice != JOptionPane.YES_OPTION) return;\n\n menu.addScript(script);\n\n cliGuiCtx.getTabs().setSelectedIndex(1); // set to Output tab to view the output\n output.post(\"\\n\");\n\n SwingWorker scriptRunner = new ScriptRunner(script);\n scriptRunner.execute();\n }",
"public static String getPropertyName(String name) {\n if(name != null && (name.startsWith(\"get\") || name.startsWith(\"set\"))) {\n StringBuilder b = new StringBuilder(name);\n b.delete(0, 3);\n b.setCharAt(0, Character.toLowerCase(b.charAt(0)));\n return b.toString();\n } else {\n return name;\n }\n }"
] |
Get the content-type, including the optional ";base64". | [
"public String getFullContentType() {\n final String url = this.url.toExternalForm().substring(\"data:\".length());\n final int endIndex = url.indexOf(',');\n if (endIndex >= 0) {\n final String contentType = url.substring(0, endIndex);\n if (!contentType.isEmpty()) {\n return contentType;\n }\n }\n return \"text/plain;charset=US-ASCII\";\n }"
] | [
"public String getPermalinkForCurrentPage(CmsObject cms) {\n\n return getPermalink(cms, cms.getRequestContext().getUri(), cms.getRequestContext().getDetailContentId());\n }",
"public static <T, C extends Comparable<? super C>> List<T> sortBy(Iterable<T> iterable,\n\t\t\tfinal Functions.Function1<? super T, C> key) {\n\t\treturn ListExtensions.sortInplaceBy(Lists.newArrayList(iterable), key);\n\t}",
"protected final StringBuilder getBaseUrl(final HttpServletRequest httpServletRequest) {\n StringBuilder baseURL = new StringBuilder();\n if (httpServletRequest.getContextPath() != null && !httpServletRequest.getContextPath().isEmpty()) {\n baseURL.append(httpServletRequest.getContextPath());\n }\n if (httpServletRequest.getServletPath() != null && !httpServletRequest.getServletPath().isEmpty()) {\n baseURL.append(httpServletRequest.getServletPath());\n }\n return baseURL;\n }",
"@Override\n public Set<String> getProviderNames() {\n Set<String> result = new HashSet<>();\n for (RoundingProviderSpi prov : Bootstrap.getServices(RoundingProviderSpi.class)) {\n try {\n result.add(prov.getProviderName());\n } catch (Exception e) {\n Logger.getLogger(Monetary.class.getName())\n .log(Level.SEVERE, \"Error loading RoundingProviderSpi from provider: \" + prov, e);\n }\n }\n return result;\n }",
"private void writeCalendars() throws JAXBException\n {\n //\n // Create the new Planner calendar list\n //\n Calendars calendars = m_factory.createCalendars();\n m_plannerProject.setCalendars(calendars);\n writeDayTypes(calendars);\n List<net.sf.mpxj.planner.schema.Calendar> calendar = calendars.getCalendar();\n\n //\n // Process each calendar in turn\n //\n for (ProjectCalendar mpxjCalendar : m_projectFile.getCalendars())\n {\n net.sf.mpxj.planner.schema.Calendar plannerCalendar = m_factory.createCalendar();\n calendar.add(plannerCalendar);\n writeCalendar(mpxjCalendar, plannerCalendar);\n }\n }",
"public CredentialsConfig getResolvingCredentialsConfig() {\n if (resolverCredentialsConfig != null && resolverCredentialsConfig.isCredentialsProvided()) {\n return getResolverCredentialsConfig();\n }\n if (deployerCredentialsConfig != null) {\n return getDeployerCredentialsConfig();\n }\n\n return CredentialsConfig.EMPTY_CREDENTIALS_CONFIG;\n }",
"public static final PolylineOptions buildOpenArc(LatLong center, LatLong start, LatLong end) {\n MVCArray res = buildArcPoints(center, start, end);\n return new PolylineOptions().path(res);\n }",
"public static void logBeforeExit(ExitLogger logger) {\n try {\n if (logged.compareAndSet(false, true)) {\n logger.logExit();\n }\n } catch (Throwable ignored){\n // ignored\n }\n }",
"public static int getDayAsReadableInt(long time) {\n Calendar cal = calendarThreadLocal.get();\n cal.setTimeInMillis(time);\n return getDayAsReadableInt(cal);\n }"
] |
Creates a text box with the given parent and text node assigned.
@param contblock The parent node (and the containing block in the same time)
@param n The corresponding text node in the DOM tree.
@return The new text box. | [
"protected TextBox createTextBox(BlockBox contblock, Text n)\n {\n TextBox text = new TextBox(n, (Graphics2D) contblock.getGraphics().create(), contblock.getVisualContext().create());\n text.setOrder(next_order++);\n text.setContainingBlockBox(contblock);\n text.setClipBlock(contblock);\n text.setViewport(viewport);\n text.setBase(baseurl);\n return text;\n }"
] | [
"public boolean isValidStore(String name) {\n readLock.lock();\n try {\n if(this.storeNames.contains(name)) {\n return true;\n }\n return false;\n } finally {\n readLock.unlock();\n }\n }",
"@Override\n\tpublic CrawlSession call() {\n\t\tInjector injector = Guice.createInjector(new CoreModule(config));\n\t\tcontroller = injector.getInstance(CrawlController.class);\n\t\tCrawlSession session = controller.call();\n\t\treason = controller.getReason();\n\t\treturn session;\n\t}",
"public UriComponentsBuilder pathSegment(String... pathSegments) throws IllegalArgumentException {\n\t\tAssert.notNull(pathSegments, \"'segments' must not be null\");\n\t\tthis.pathBuilder.addPathSegments(pathSegments);\n\t\tresetSchemeSpecificPart();\n\t\treturn this;\n\t}",
"public int getIndexFromOffset(int offset)\n {\n int result = -1;\n\n for (int loop = 0; loop < m_offset.length; loop++)\n {\n if (m_offset[loop] == offset)\n {\n result = loop;\n break;\n }\n }\n\n return (result);\n }",
"public void explore() {\n if (isLeaf) return;\n if (isGeneric) return;\n removeAllChildren();\n\n try {\n String addressPath = addressPath();\n ModelNode resourceDesc = executor.doCommand(addressPath + \":read-resource-description\");\n resourceDesc = resourceDesc.get(\"result\");\n ModelNode response = executor.doCommand(addressPath + \":read-resource(include-runtime=true,include-defaults=true)\");\n ModelNode result = response.get(\"result\");\n if (!result.isDefined()) return;\n\n List<String> childrenTypes = getChildrenTypes(addressPath);\n for (ModelNode node : result.asList()) {\n Property prop = node.asProperty();\n if (childrenTypes.contains(prop.getName())) { // resource node\n if (hasGenericOperations(addressPath, prop.getName())) {\n add(new ManagementModelNode(cliGuiCtx, new UserObject(node, prop.getName())));\n }\n if (prop.getValue().isDefined()) {\n for (ModelNode innerNode : prop.getValue().asList()) {\n UserObject usrObj = new UserObject(innerNode, prop.getName(), innerNode.asProperty().getName());\n add(new ManagementModelNode(cliGuiCtx, usrObj));\n }\n }\n } else { // attribute node\n UserObject usrObj = new UserObject(node, resourceDesc, prop.getName(), prop.getValue().asString());\n add(new ManagementModelNode(cliGuiCtx, usrObj));\n }\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n }",
"public void fireResourceWrittenEvent(Resource resource)\n {\n if (m_projectListeners != null)\n {\n for (ProjectListener listener : m_projectListeners)\n {\n listener.resourceWritten(resource);\n }\n }\n }",
"public static Type[] getActualTypeArguments(Type type) {\n Type resolvedType = Types.getCanonicalType(type);\n if (resolvedType instanceof ParameterizedType) {\n return ((ParameterizedType) resolvedType).getActualTypeArguments();\n } else {\n return EMPTY_TYPES;\n }\n }",
"public static void log(String label, String data)\n {\n if (LOG != null)\n {\n LOG.write(label);\n LOG.write(\": \");\n LOG.println(data);\n LOG.flush();\n }\n }",
"public void hideKeyboard() {\n InputMethodManager inputMethodManager = (InputMethodManager) getContext().getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);\n inputMethodManager.hideSoftInputFromWindow(mPhoneEdit.getWindowToken(), 0);\n }"
] |
Create a new Violation for the AST node.
@param sourceCode - the SourceCode
@param node - the Groovy AST Node
@param message - the message for the violation; defaults to null | [
"protected Violation createViolation(SourceCode sourceCode, ASTNode node, String message) {\n String sourceLine = sourceCode.line(node.getLineNumber()-1);\n return createViolation(node.getLineNumber(), sourceLine, message);\n }"
] | [
"public static LocalDateTime getDateFromFloatingPointDate(LocalDateTime referenceDate, double floatingPointDate) {\n\t\tif(referenceDate == null) {\n\t\t\treturn null;\n\t\t}\n\n\t\tDuration duration = Duration.ofSeconds(Math.round(floatingPointDate * SECONDS_PER_DAY));\n\t\treturn referenceDate.plus(duration);\n\t}",
"public static base_response unset(nitro_service client, aaaparameter resource, String[] args) throws Exception{\n\t\taaaparameter unsetresource = new aaaparameter();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}",
"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 }",
"private void handleDmrString(final ModelNode node, final String name, final String value) {\n final String realValue = value.substring(2);\n node.get(name).set(ModelNode.fromString(realValue));\n }",
"private List<TaskField> getAllTaskExtendedAttributes()\n {\n ArrayList<TaskField> result = new ArrayList<TaskField>();\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_TEXT));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_START));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_FINISH));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_COST));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_DATE));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_FLAG));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_NUMBER));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_DURATION));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_OUTLINE_CODE));\n result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_COST));\n result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_DATE));\n result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_DURATION));\n result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_FLAG));\n result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_NUMBER));\n result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_TEXT));\n return result;\n }",
"public static DMatrixSparseTriplet uniform(int numRows , int numCols , int nz_total ,\n double min , double max , Random rand ) {\n // Create a list of all the possible element values\n int N = numCols*numRows;\n if( N < 0 )\n throw new IllegalArgumentException(\"matrix size is too large\");\n nz_total = Math.min(N,nz_total);\n\n int selected[] = new int[N];\n for (int i = 0; i < N; i++) {\n selected[i] = i;\n }\n\n for (int i = 0; i < nz_total; i++) {\n int s = rand.nextInt(N);\n int tmp = selected[s];\n selected[s] = selected[i];\n selected[i] = tmp;\n }\n\n // Create a sparse matrix\n DMatrixSparseTriplet ret = new DMatrixSparseTriplet(numRows,numCols,nz_total);\n\n for (int i = 0; i < nz_total; i++) {\n int row = selected[i]/numCols;\n int col = selected[i]%numCols;\n\n double value = rand.nextDouble()*(max-min)+min;\n\n ret.addItem(row,col, value);\n }\n\n return ret;\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}",
"private Boolean readOptionalBoolean(JSONValue val) {\n\n JSONBoolean b = null == val ? null : val.isBoolean();\n if (b != null) {\n return Boolean.valueOf(b.booleanValue());\n }\n return null;\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}"
] |
This private method allows the caller to determine if a given date is a
working day. This method takes account of calendar exceptions. It assumes
that the caller has already calculated the day of the week on which
the given day falls.
@param date Date to be tested
@param day Day of the week for the date under test
@return boolean flag | [
"private boolean isWorkingDate(Date date, Day day)\n {\n ProjectCalendarDateRanges ranges = getRanges(date, null, day);\n return ranges.getRangeCount() != 0;\n }"
] | [
"public Integer getInteger(String fieldName) {\n\t\ttry {\n\t\t\treturn hasValue(fieldName) ? Integer.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}",
"public static void ensureXPathNotNull(Node node, String expression) {\n if (node == null) {\n throw LOG.unableToFindXPathExpression(expression);\n }\n }",
"void notifyMwRevisionProcessors(MwRevision mwRevision, boolean isCurrent) {\n\t\tif (mwRevision == null || mwRevision.getPageId() <= 0) {\n\t\t\treturn;\n\t\t}\n\t\tfor (MwRevisionProcessorBroker.RevisionSubscription rs : this.revisionSubscriptions) {\n\t\t\tif (rs.onlyCurrentRevisions == isCurrent\n\t\t\t\t\t&& (rs.model == null || mwRevision.getModel().equals(\n\t\t\t\t\t\t\trs.model))) {\n\t\t\t\trs.mwRevisionProcessor.processRevision(mwRevision);\n\t\t\t}\n\t\t}\n\t}",
"protected void appendFacetOption(StringBuffer query, final String name, final String value) {\n\n query.append(\" facet.\").append(name).append(\"=\").append(value);\n }",
"@Deprecated\n\tpublic void setResolutions(List<Double> resolutions) {\n\t\tgetZoomLevels().clear();\n\t\tfor (Double resolution : resolutions) {\n\t\t\tgetZoomLevels().add(new ScaleInfo(1. / resolution));\n\t\t}\n\t}",
"private void checkForCycles(DefaultDirectedWeightedGraph<RuleProvider, DefaultEdge> graph)\n {\n CycleDetector<RuleProvider, DefaultEdge> cycleDetector = new CycleDetector<>(graph);\n\n if (cycleDetector.detectCycles())\n {\n // if we have cycles, then try to throw an exception with some usable data\n Set<RuleProvider> cycles = cycleDetector.findCycles();\n StringBuilder errorSB = new StringBuilder();\n for (RuleProvider cycle : cycles)\n {\n errorSB.append(\"Found dependency cycle involving: \" + cycle.getMetadata().getID()).append(System.lineSeparator());\n Set<RuleProvider> subCycleSet = cycleDetector.findCyclesContainingVertex(cycle);\n for (RuleProvider subCycle : subCycleSet)\n {\n errorSB.append(\"\\tSubcycle: \" + subCycle.getMetadata().getID()).append(System.lineSeparator());\n }\n }\n throw new RuntimeException(\"Dependency cycles detected: \" + errorSB.toString());\n }\n }",
"public void setClassOfObject(Class c)\r\n {\r\n m_Class = c;\r\n isAbstract = Modifier.isAbstract(m_Class.getModifiers());\r\n // TODO : Shouldn't the HashMap in DescriptorRepository be updated as well?\r\n }",
"public static base_response clear(nitro_service client) throws Exception {\n\t\tnssimpleacl clearresource = new nssimpleacl();\n\t\treturn clearresource.perform_operation(client,\"clear\");\n\t}",
"public void add(IConverter converter, Object sourceObject,\n\t\t\tTypeReference<?> destinationType, Object convertedObject) {\n\t\tconvertedObjects.put(new ConvertedObjectsKey(converter, sourceObject,\n\t\t\t\tdestinationType), convertedObject);\n\t}"
] |
Use this API to fetch vpnvserver_rewritepolicy_binding resources of given name . | [
"public static vpnvserver_rewritepolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tvpnvserver_rewritepolicy_binding obj = new vpnvserver_rewritepolicy_binding();\n\t\tobj.set_name(name);\n\t\tvpnvserver_rewritepolicy_binding response[] = (vpnvserver_rewritepolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}"
] | [
"public static dospolicy[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{\n\t\tdospolicy obj = new dospolicy();\n\t\toptions option = new options();\n\t\toption.set_filter(filter);\n\t\tdospolicy[] response = (dospolicy[]) obj.getfiltered(service, option);\n\t\treturn response;\n\t}",
"public static Object getObjectFromColumn(ResultSet rs, Integer jdbcType, int columnId)\r\n throws SQLException\r\n {\r\n return getObjectFromColumn(rs, null, jdbcType, null, columnId);\r\n }",
"public Replication targetOauth(String consumerSecret,\r\n String consumerKey, String tokenSecret, String token) {\r\n this.replication = replication.targetOauth(consumerSecret, consumerKey,\r\n tokenSecret, token);\r\n return this;\r\n }",
"private static EndpointReferenceType createEPR(String address, SLProperties props) {\n EndpointReferenceType epr = WSAEndpointReferenceUtils.getEndpointReference(address);\n if (props != null) {\n addProperties(epr, props);\n }\n return epr;\n }",
"static void export(String path, String queueName, DbConn cnx) throws JqmXmlException\n {\n // Argument tests\n if (queueName == null)\n {\n throw new IllegalArgumentException(\"queue name cannot be null\");\n }\n if (cnx == null)\n {\n throw new IllegalArgumentException(\"database connection cannot be null\");\n }\n Queue q = CommonXml.findQueue(queueName, cnx);\n if (q == null)\n {\n throw new IllegalArgumentException(\"there is no queue named \" + queueName);\n }\n\n List<Queue> l = new ArrayList<>();\n l.add(q);\n export(path, l, cnx);\n }",
"public static double Y(double x) {\r\n if (x < 8.0) {\r\n double y = x * x;\r\n double ans1 = x * (-0.4900604943e13 + y * (0.1275274390e13\r\n + y * (-0.5153438139e11 + y * (0.7349264551e9\r\n + y * (-0.4237922726e7 + y * 0.8511937935e4)))));\r\n double ans2 = 0.2499580570e14 + y * (0.4244419664e12\r\n + y * (0.3733650367e10 + y * (0.2245904002e8\r\n + y * (0.1020426050e6 + y * (0.3549632885e3 + y)))));\r\n return (ans1 / ans2) + 0.636619772 * (J(x) * Math.log(x) - 1.0 / x);\r\n } else {\r\n double z = 8.0 / x;\r\n double y = z * z;\r\n double xx = x - 2.356194491;\r\n double ans1 = 1.0 + y * (0.183105e-2 + y * (-0.3516396496e-4\r\n + y * (0.2457520174e-5 + y * (-0.240337019e-6))));\r\n double ans2 = 0.04687499995 + y * (-0.2002690873e-3\r\n + y * (0.8449199096e-5 + y * (-0.88228987e-6\r\n + y * 0.105787412e-6)));\r\n return Math.sqrt(0.636619772 / x) *\r\n (Math.sin(xx) * ans1 + z * Math.cos(xx) * ans2);\r\n }\r\n }",
"private static List<CmsCategory> getCategories(CmsObject cms, CmsResource resource) {\n\n if ((null != resource) && (null != cms)) {\n try {\n return CmsCategoryService.getInstance().readResourceCategories(cms, resource);\n } catch (CmsException e) {\n LOG.error(e.getLocalizedMessage(), e);\n }\n }\n return new ArrayList<CmsCategory>(0);\n }",
"private void enforceSrid(Object feature) throws LayerException {\n\t\tGeometry geom = getFeatureModel().getGeometry(feature);\n\t\tif (null != geom) {\n\t\t\tgeom.setSRID(srid);\n\t\t\tgetFeatureModel().setGeometry(feature, geom);\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 }"
] |
Sets the stream for a resource.
This function allows you to provide a stream that is already open to
an existing resource. It will throw an exception if that resource
already has an open stream.
@param s InputStream currently open stream to use for I/O. | [
"protected synchronized void setStream(InputStream s)\n {\n if (stream != null)\n {\n throw new UnsupportedOperationException(\"Cannot set the stream of an open resource\");\n }\n stream = s;\n streamState = StreamStates.OPEN;\n }"
] | [
"public static Boolean compareMultipleClientConfigAvro(String configAvro1, String configAvro2) {\n Map<String, Properties> mapStoreToProps1 = readMultipleClientConfigAvro(configAvro1);\n Map<String, Properties> mapStoreToProps2 = readMultipleClientConfigAvro(configAvro2);\n Set<String> keySet1 = mapStoreToProps1.keySet();\n Set<String> keySet2 = mapStoreToProps2.keySet();\n if(!keySet1.equals(keySet2)) {\n return false;\n }\n for(String storeName: keySet1) {\n Properties props1 = mapStoreToProps1.get(storeName);\n Properties props2 = mapStoreToProps2.get(storeName);\n if(!props1.equals(props2)) {\n return false;\n }\n }\n return true;\n }",
"public static tunnelip_stats get(nitro_service service, String tunnelip) throws Exception{\n\t\ttunnelip_stats obj = new tunnelip_stats();\n\t\tobj.set_tunnelip(tunnelip);\n\t\ttunnelip_stats response = (tunnelip_stats) obj.stat_resource(service);\n\t\treturn response;\n\t}",
"public static final FieldType getInstance(int fieldID)\n {\n FieldType result;\n int prefix = fieldID & 0xFFFF0000;\n int index = fieldID & 0x0000FFFF;\n\n switch (prefix)\n {\n case MPPTaskField.TASK_FIELD_BASE:\n {\n result = MPPTaskField.getInstance(index);\n if (result == null)\n {\n result = getPlaceholder(TaskField.class, index);\n }\n break;\n }\n\n case MPPResourceField.RESOURCE_FIELD_BASE:\n {\n result = MPPResourceField.getInstance(index);\n if (result == null)\n {\n result = getPlaceholder(ResourceField.class, index);\n }\n break;\n }\n\n case MPPAssignmentField.ASSIGNMENT_FIELD_BASE:\n {\n result = MPPAssignmentField.getInstance(index);\n if (result == null)\n {\n result = getPlaceholder(AssignmentField.class, index);\n }\n break;\n }\n\n case MPPConstraintField.CONSTRAINT_FIELD_BASE:\n {\n result = MPPConstraintField.getInstance(index);\n if (result == null)\n {\n result = getPlaceholder(ConstraintField.class, index);\n }\n break;\n }\n\n default:\n {\n result = getPlaceholder(null, index);\n break;\n }\n }\n\n return result;\n }",
"public Set<RateType> getRateTypes() {\n @SuppressWarnings(\"unchecked\")\n Set<RateType> rateSet = get(KEY_RATE_TYPES, Set.class);\n if (rateSet == null) {\n return Collections.emptySet();\n }\n return Collections.unmodifiableSet(rateSet);\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 }",
"public List<Long> getOffsets(OffsetRequest offsetRequest) {\n ILog log = getLog(offsetRequest.topic, offsetRequest.partition);\n if (log != null) {\n return log.getOffsetsBefore(offsetRequest);\n }\n return ILog.EMPTY_OFFSETS;\n }",
"public static PacketType validateHeader(DatagramPacket packet, int port) {\n byte[] data = packet.getData();\n\n if (data.length < PACKET_TYPE_OFFSET) {\n logger.warn(\"Packet is too short to be a Pro DJ Link packet; must be at least \" + PACKET_TYPE_OFFSET +\n \" bytes long, was only \" + data.length + \".\");\n return null;\n }\n\n if (!getMagicHeader().equals(ByteBuffer.wrap(data, 0, MAGIC_HEADER.length))) {\n logger.warn(\"Packet did not have correct nine-byte header for the Pro DJ Link protocol.\");\n return null;\n }\n\n final Map<Byte, PacketType> portMap = PACKET_TYPE_MAP.get(port);\n if (portMap == null) {\n logger.warn(\"Do not know any Pro DJ Link packets that are received on port \" + port + \".\");\n return null;\n }\n\n final PacketType result = portMap.get(data[PACKET_TYPE_OFFSET]);\n if (result == null) {\n logger.warn(\"Do not know any Pro DJ Link packets received on port \" + port + \" with type \" +\n String.format(\"0x%02x\", data[PACKET_TYPE_OFFSET]) + \".\");\n }\n\n return result;\n }",
"public static sslcipher_individualcipher_binding[] get_filtered(nitro_service service, String ciphergroupname, filtervalue[] filter) throws Exception{\n\t\tsslcipher_individualcipher_binding obj = new sslcipher_individualcipher_binding();\n\t\tobj.set_ciphergroupname(ciphergroupname);\n\t\toptions option = new options();\n\t\toption.set_filter(filter);\n\t\tsslcipher_individualcipher_binding[] response = (sslcipher_individualcipher_binding[]) obj.getfiltered(service, option);\n\t\treturn response;\n\t}",
"protected static BufferedReader createFileReader(String file_name)\n throws BeastException {\n try {\n return new BufferedReader(new FileReader(file_name));\n } catch (FileNotFoundException e) {\n Logger logger = Logger.getLogger(MASReader.class.getName());\n logger.severe(\"ERROR: \" + e.toString());\n throw new BeastException(\"ERROR: \" + e.toString(), e);\n }\n }"
] |
Send the message using the JavaMail session defined in the message
@param mimeMessage Message to send | [
"public static void sendMimeMessage(MimeMessage mimeMessage) {\r\n try {\r\n Transport.send(mimeMessage);\r\n } catch (MessagingException e) {\r\n throw new IllegalStateException(\"Can not send message \" + mimeMessage, e);\r\n }\r\n }"
] | [
"public final static int readUntil(final StringBuilder out, final String in, final int start, final char end)\n {\n int pos = start;\n while (pos < in.length())\n {\n final char ch = in.charAt(pos);\n if (ch == '\\\\' && pos + 1 < in.length())\n {\n pos = escape(out, in.charAt(pos + 1), pos);\n }\n else\n {\n if (ch == end)\n {\n break;\n }\n out.append(ch);\n }\n pos++;\n }\n\n return (pos == in.length()) ? -1 : pos;\n }",
"public Rectangle toRelative(Rectangle rect) {\n\t\treturn new Rectangle(rect.getLeft() - origX, rect.getBottom() - origY, rect.getRight() - origX, rect.getTop()\n\t\t\t\t- origY);\n\t}",
"private boolean isSatisfied() {\n if(pipelineData.getZonesRequired() != null) {\n return ((pipelineData.getSuccesses() >= required) && (pipelineData.getZoneResponses()\n .size() >= (pipelineData.getZonesRequired() + 1)));\n } else {\n return pipelineData.getSuccesses() >= required;\n }\n }",
"private boolean isClockwise(Point center, Point a, Point b) {\n double cross = (a.x - center.x) * (b.y - center.y) - (b.x - center.x) * (a.y - center.y);\n return cross > 0;\n }",
"public Task<Void> sendResetPasswordEmail(@NonNull final String email) {\n return dispatcher.dispatchTask(\n new Callable<Void>() {\n @Override\n public Void call() {\n sendResetPasswordEmailInternal(email);\n return null;\n }\n });\n }",
"public List<Action> getRootActions() {\n\t\tfinal List<Action> rootActions = srcUpdTrees.stream().map(t -> originalActionsSrc.get(t))\n\t\t\t\t.collect(Collectors.toList());\n\n\t\trootActions.addAll(srcDelTrees.stream() //\n\t\t\t\t.filter(t -> !srcDelTrees.contains(t.getParent()) && !srcUpdTrees.contains(t.getParent())) //\n\t\t\t\t.map(t -> originalActionsSrc.get(t)) //\n\t\t\t\t.collect(Collectors.toList()));\n\n\t\trootActions.addAll(dstAddTrees.stream() //\n\t\t\t\t.filter(t -> !dstAddTrees.contains(t.getParent()) && !dstUpdTrees.contains(t.getParent())) //\n\t\t\t\t.map(t -> originalActionsDst.get(t)) //\n\t\t\t\t.collect(Collectors.toList()));\n\n\t\trootActions.addAll(dstMvTrees.stream() //\n\t\t\t\t.filter(t -> !dstMvTrees.contains(t.getParent())) //\n\t\t\t\t.map(t -> originalActionsDst.get(t)) //\n\t\t\t\t.collect(Collectors.toList()));\n\n\t\trootActions.removeAll(Collections.singleton(null));\n\t\treturn rootActions;\n\t}",
"private boolean tryCustomErrorPage(CmsObject cms, HttpServletRequest req, HttpServletResponse res, int errorCode) {\n\n String siteRoot = OpenCms.getSiteManager().matchRequest(req).getSiteRoot();\n CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot);\n if (site != null) {\n // store current site root and URI\n String currentSiteRoot = cms.getRequestContext().getSiteRoot();\n String currentUri = cms.getRequestContext().getUri();\n try {\n if (site.getErrorPage() != null) {\n String rootPath = site.getErrorPage();\n if (loadCustomErrorPage(cms, req, res, rootPath)) {\n return true;\n }\n }\n String rootPath = CmsStringUtil.joinPaths(siteRoot, \"/.errorpages/handle\" + errorCode + \".html\");\n if (loadCustomErrorPage(cms, req, res, rootPath)) {\n return true;\n }\n } finally {\n cms.getRequestContext().setSiteRoot(currentSiteRoot);\n cms.getRequestContext().setUri(currentUri);\n }\n }\n return false;\n }",
"public static final Integer parseMinutesFromHours(String value)\n {\n Integer result = null;\n if (value != null)\n {\n result = Integer.valueOf(Integer.parseInt(value) * 60);\n }\n return result;\n }",
"void lockSharedInterruptibly(final Integer permit) throws InterruptedException {\n if (permit == null) {\n throw new IllegalArgumentException();\n }\n sync.acquireSharedInterruptibly(permit);\n }"
] |
add a Component to this Worker. After the call dragging is enabled for this
Component.
@param c the Component to register | [
"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 }"
] | [
"private boolean isSecuredByProperty(Server server) {\n boolean isSecured = false;\n Object value = server.getEndpoint().get(\"org.talend.tesb.endpoint.secured\"); //Property name TBD\n\n if (value instanceof String) {\n try {\n isSecured = Boolean.valueOf((String) value);\n } catch (Exception ex) {\n }\n }\n\n return isSecured;\n }",
"private void writeNotes(int recordNumber, String text) throws IOException\n {\n m_buffer.setLength(0);\n\n m_buffer.append(recordNumber);\n m_buffer.append(m_delimiter);\n\n if (text != null)\n {\n String note = stripLineBreaks(text, MPXConstants.EOL_PLACEHOLDER_STRING);\n boolean quote = (note.indexOf(m_delimiter) != -1 || note.indexOf('\"') != -1);\n int length = note.length();\n char c;\n\n if (quote == true)\n {\n m_buffer.append('\"');\n }\n\n for (int loop = 0; loop < length; loop++)\n {\n c = note.charAt(loop);\n\n switch (c)\n {\n case '\"':\n {\n m_buffer.append(\"\\\"\\\"\");\n break;\n }\n\n default:\n {\n m_buffer.append(c);\n break;\n }\n }\n }\n\n if (quote == true)\n {\n m_buffer.append('\"');\n }\n }\n\n m_buffer.append(MPXConstants.EOL);\n\n m_writer.write(m_buffer.toString());\n }",
"public void cleanup() {\n List<String> keys = new ArrayList<>(created.keySet());\n keys.sort(String::compareTo);\n for (String key : keys) {\n created.remove(key)\n .stream()\n .sorted(Comparator.comparing(HasMetadata::getKind))\n .forEach(metadata -> {\n log.info(String.format(\"Deleting %s : %s\", key, metadata.getKind()));\n deleteWithRetries(metadata);\n });\n }\n }",
"public AssemblyResponse cancelAssembly(String url)\n throws RequestException, LocalOperationException {\n Request request = new Request(this);\n return new AssemblyResponse(request.delete(url, new HashMap<String, Object>()));\n }",
"void reset()\n {\n if (!hasStopped)\n {\n throw new IllegalStateException(\"cannot reset a non stopped queue poller\");\n }\n hasStopped = false;\n run = true;\n lastLoop = null;\n loop = new Semaphore(0);\n }",
"public int getJdbcType(String ojbType) throws SQLException\r\n {\r\n int result;\r\n if(ojbType == null) ojbType = \"\";\r\n\t\tojbType = ojbType.toLowerCase();\r\n if (ojbType.equals(\"bit\"))\r\n result = Types.BIT;\r\n else if (ojbType.equals(\"tinyint\"))\r\n result = Types.TINYINT;\r\n else if (ojbType.equals(\"smallint\"))\r\n result = Types.SMALLINT;\r\n else if (ojbType.equals(\"integer\"))\r\n result = Types.INTEGER;\r\n else if (ojbType.equals(\"bigint\"))\r\n result = Types.BIGINT;\r\n\r\n else if (ojbType.equals(\"float\"))\r\n result = Types.FLOAT;\r\n else if (ojbType.equals(\"real\"))\r\n result = Types.REAL;\r\n else if (ojbType.equals(\"double\"))\r\n result = Types.DOUBLE;\r\n\r\n else if (ojbType.equals(\"numeric\"))\r\n result = Types.NUMERIC;\r\n else if (ojbType.equals(\"decimal\"))\r\n result = Types.DECIMAL;\r\n\r\n else if (ojbType.equals(\"char\"))\r\n result = Types.CHAR;\r\n else if (ojbType.equals(\"varchar\"))\r\n result = Types.VARCHAR;\r\n else if (ojbType.equals(\"longvarchar\"))\r\n result = Types.LONGVARCHAR;\r\n\r\n else if (ojbType.equals(\"date\"))\r\n result = Types.DATE;\r\n else if (ojbType.equals(\"time\"))\r\n result = Types.TIME;\r\n else if (ojbType.equals(\"timestamp\"))\r\n result = Types.TIMESTAMP;\r\n\r\n else if (ojbType.equals(\"binary\"))\r\n result = Types.BINARY;\r\n else if (ojbType.equals(\"varbinary\"))\r\n result = Types.VARBINARY;\r\n else if (ojbType.equals(\"longvarbinary\"))\r\n result = Types.LONGVARBINARY;\r\n\r\n\t\telse if (ojbType.equals(\"clob\"))\r\n \t\tresult = Types.CLOB;\r\n\t\telse if (ojbType.equals(\"blob\"))\r\n\t\t\tresult = Types.BLOB;\r\n else\r\n throw new SQLException(\r\n \"The type '\"+ ojbType + \"' is not a valid jdbc type.\");\r\n return result;\r\n }",
"public static base_response update(nitro_service client, cacheselector resource) throws Exception {\n\t\tcacheselector updateresource = new cacheselector();\n\t\tupdateresource.selectorname = resource.selectorname;\n\t\tupdateresource.rule = resource.rule;\n\t\treturn updateresource.update_resource(client);\n\t}",
"boolean applyDomainModel(ModelNode result) {\n if(! result.hasDefined(ModelDescriptionConstants.RESULT)) {\n return false;\n }\n final List<ModelNode> bootOperations= result.get(ModelDescriptionConstants.RESULT).asList();\n return callback.applyDomainModel(bootOperations);\n }",
"public String userAgent() {\n return String.format(\"Azure-SDK-For-Java/%s OS:%s MacAddressHash:%s Java:%s\",\n getClass().getPackage().getImplementationVersion(),\n OS,\n MAC_ADDRESS_HASH,\n JAVA_VERSION);\n }"
] |
Sanity check precondition for above setters | [
"private void precheckStateAllNull() throws IllegalStateException {\n if ((doubleValue != null) || (doubleArray != null)\n || (longValue != null) || (longArray != null)\n || (stringValue != null) || (stringArray != null)\n || (map != null)) {\n throw new IllegalStateException(\"Expected all properties to be empty: \" + this);\n }\n }"
] | [
"public List<MapRow> read() throws IOException\n {\n List<MapRow> result = new ArrayList<MapRow>();\n int fileCount = m_stream.readInt();\n if (fileCount != 0)\n {\n for (int index = 0; index < fileCount; index++)\n {\n // We use a LinkedHashMap to preserve insertion order in iteration\n // Useful when debugging the file format.\n Map<String, Object> map = new LinkedHashMap<String, Object>();\n readBlock(map);\n result.add(new MapRow(map));\n }\n }\n return result;\n }",
"private void updateDevices(DeviceAnnouncement announcement) {\n firstDeviceTime.compareAndSet(0, System.currentTimeMillis());\n devices.put(announcement.getAddress(), announcement);\n }",
"protected boolean hasKey() {\n boolean result = false;\n String requestURI = this.request.getUri();\n parseKeys(requestURI);\n\n if(this.parsedKeys != null) {\n result = true;\n } else {\n logger.error(\"Error when validating request. No key specified.\");\n RestErrorHandler.writeErrorResponse(this.messageEvent,\n HttpResponseStatus.BAD_REQUEST,\n \"Error: No key specified !\");\n }\n return result;\n }",
"private void addTable(TableDef table)\r\n {\r\n table.setOwner(this);\r\n _tableDefs.put(table.getName(), table);\r\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 }",
"private void batchStatusLog(int batchCount,\n int numBatches,\n int partitionStoreCount,\n int numPartitionStores,\n long totalTimeMs) {\n // Calculate the estimated end time and pretty print stats\n double rate = 1;\n long estimatedTimeMs = 0;\n if(numPartitionStores > 0) {\n rate = partitionStoreCount / numPartitionStores;\n estimatedTimeMs = (long) (totalTimeMs / rate) - totalTimeMs;\n }\n\n StringBuilder sb = new StringBuilder();\n sb.append(\"Batch Complete!\")\n .append(Utils.NEWLINE)\n .append(\"\\tbatches moved: \")\n .append(batchCount)\n .append(\" out of \")\n .append(numBatches)\n .append(Utils.NEWLINE)\n .append(\"\\tPartition stores moved: \")\n .append(partitionStoreCount)\n .append(\" out of \")\n .append(numPartitionStores)\n .append(Utils.NEWLINE)\n .append(\"\\tPercent done: \")\n .append(decimalFormatter.format(rate * 100.0))\n .append(Utils.NEWLINE)\n .append(\"\\tEstimated time left: \")\n .append(estimatedTimeMs)\n .append(\" ms (\")\n .append(TimeUnit.MILLISECONDS.toHours(estimatedTimeMs))\n .append(\" hours)\");\n RebalanceUtils.printBatchLog(batchCount, logger, sb.toString());\n }",
"private void instanceAlreadyLoaded(\n\t\tfinal Tuple resultset,\n\t\tfinal int i,\n\t\t\t//TODO create an interface for this usage\n\t\tfinal OgmEntityPersister persister,\n\t\tfinal org.hibernate.engine.spi.EntityKey key,\n\t\tfinal Object object,\n\t\tfinal LockMode lockMode,\n\t\tfinal SharedSessionContractImplementor session)\n\tthrows HibernateException {\n\t\tif ( !persister.isInstance( object ) ) {\n\t\t\tthrow new WrongClassException(\n\t\t\t\t\t\"loaded object was of wrong class \" + object.getClass(),\n\t\t\t\t\tkey.getIdentifier(),\n\t\t\t\t\tpersister.getEntityName()\n\t\t\t\t);\n\t\t}\n\n\t\tif ( LockMode.NONE != lockMode && upgradeLocks() ) { // no point doing this if NONE was requested\n\n\t\t\tfinal boolean isVersionCheckNeeded = persister.isVersioned() &&\n\t\t\t\t\tsession.getPersistenceContext().getEntry( object )\n\t\t\t\t\t\t\t.getLockMode().lessThan( lockMode );\n\t\t\t// we don't need to worry about existing version being uninitialized\n\t\t\t// because this block isn't called by a re-entrant load (re-entrant\n\t\t\t// loads _always_ have lock mode NONE)\n\t\t\tif ( isVersionCheckNeeded ) {\n\t\t\t\t//we only check the version when _upgrading_ lock modes\n\t\t\t\tObject oldVersion = session.getPersistenceContext().getEntry( object ).getVersion();\n\t\t\t\tpersister.checkVersionAndRaiseSOSE( key.getIdentifier(), oldVersion, session, resultset );\n\t\t\t\t//we need to upgrade the lock mode to the mode requested\n\t\t\t\tsession.getPersistenceContext().getEntry( object )\n\t\t\t\t\t\t.setLockMode( lockMode );\n\t\t\t}\n\t\t}\n\t}",
"protected void buildSuperJoinTree(TableAlias left, ClassDescriptor cld, String name, boolean useOuterJoin)\r\n {\r\n ClassDescriptor superCld = cld.getSuperClassDescriptor();\r\n if (superCld != null)\r\n {\r\n SuperReferenceDescriptor superRef = cld.getSuperReference();\r\n FieldDescriptor[] leftFields = superRef.getForeignKeyFieldDescriptors(cld);\r\n TableAlias base_alias = getTableAliasForPath(name, null, null);\r\n String aliasName = String.valueOf(getAliasChar()) + m_aliasCount++;\r\n TableAlias right = new TableAlias(superCld, aliasName, useOuterJoin, null);\r\n\r\n Join join1to1 = new Join(left, leftFields, right, superCld.getPkFields(), useOuterJoin, \"superClass\");\r\n base_alias.addJoin(join1to1);\r\n\r\n buildSuperJoinTree(right, superCld, name, useOuterJoin);\r\n }\r\n }",
"public static void showUserInfo(CmsSessionInfo session) {\n\n final Window window = CmsBasicDialog.prepareWindow(DialogWidth.wide);\n CmsUserInfoDialog dialog = new CmsUserInfoDialog(session, new Runnable() {\n\n public void run() {\n\n window.close();\n }\n\n });\n window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_SHOW_USER_0));\n window.setContent(dialog);\n A_CmsUI.get().addWindow(window);\n }"
] |
Get a list of referrers from a given domain to a photoset.
@param date
(Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will
automatically be rounded down to the start of the day.
@param domain
(Required) The domain to return referrers for. This should be a hostname (eg: "flickr.com") with no protocol or pathname.
@param photosetId
(Optional) The id of the photoset to get stats for. If not provided, stats for all sets will be returned.
@param perPage
(Optional) Number of domains to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100.
@param page
(Optional) The page of results to return. If this argument is omitted, it defaults to 1.
@see "http://www.flickr.com/services/api/flickr.stats.getPhotosetReferrers.html" | [
"public ReferrerList getPhotosetReferrers(Date date, String domain, String photosetId, int perPage, int page) throws FlickrException {\n return getReferrers(METHOD_GET_PHOTOSET_REFERRERS, domain, \"photoset_id\", photosetId, date, perPage, page);\n }"
] | [
"static String createStatsType(Set<String> statsItems, String sortType,\n MtasFunctionParserFunction functionParser) {\n String statsType = STATS_BASIC;\n for (String statsItem : statsItems) {\n if (STATS_FULL_TYPES.contains(statsItem)) {\n statsType = STATS_FULL;\n break;\n } else if (STATS_ADVANCED_TYPES.contains(statsItem)) {\n statsType = STATS_ADVANCED;\n } else if (statsType != STATS_ADVANCED\n && STATS_BASIC_TYPES.contains(statsItem)) {\n statsType = STATS_BASIC;\n } else {\n Matcher m = fpStatsFunctionItems.matcher(statsItem.trim());\n if (m.find()) {\n if (STATS_FUNCTIONS.contains(m.group(2).trim())) {\n statsType = STATS_FULL;\n break;\n }\n }\n }\n }\n if (sortType != null && STATS_TYPES.contains(sortType)) {\n if (STATS_FULL_TYPES.contains(sortType)) {\n statsType = STATS_FULL;\n } else if (STATS_ADVANCED_TYPES.contains(sortType)) {\n statsType = (statsType == null || statsType != STATS_FULL)\n ? STATS_ADVANCED : statsType;\n }\n }\n return statsType;\n }",
"private static void listResources(ProjectFile file)\n {\n for (Resource resource : file.getResources())\n {\n System.out.println(\"Resource: \" + resource.getName() + \" (Unique ID=\" + resource.getUniqueID() + \") Start=\" + resource.getStart() + \" Finish=\" + resource.getFinish());\n }\n System.out.println();\n }",
"static Style get(final GridParam params) {\n final StyleBuilder builder = new StyleBuilder();\n\n final Symbolizer pointSymbolizer = crossSymbolizer(\"shape://plus\", builder, CROSS_SIZE,\n params.gridColor);\n final Style style = builder.createStyle(pointSymbolizer);\n final List<Symbolizer> symbolizers = style.featureTypeStyles().get(0).rules().get(0).symbolizers();\n\n if (params.haloRadius > 0.0) {\n Symbolizer halo = crossSymbolizer(\"cross\", builder, CROSS_SIZE + params.haloRadius * 2.0,\n params.haloColor);\n symbolizers.add(0, halo);\n }\n\n return style;\n }",
"public History[] refreshHistory(int limit, int offset) throws Exception {\n BasicNameValuePair[] params = {\n new BasicNameValuePair(\"limit\", String.valueOf(limit)),\n new BasicNameValuePair(\"offset\", String.valueOf(offset))\n };\n return constructHistory(params);\n }",
"public static void addItemsHandled(String handledItemsType, int handledItemsNumber) {\n \tJobLogger jobLogger = (JobLogger) getInstance();\n if (jobLogger == null) {\n return;\n }\n\n jobLogger.addItemsHandledInstance(handledItemsType, handledItemsNumber);\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 }",
"private <T extends TimephasedItem<?>> int getStartIndex(DateRange range, List<T> assignments, int startIndex)\n {\n int result = -1;\n if (assignments != null)\n {\n long rangeStart = range.getStart().getTime();\n long rangeEnd = range.getEnd().getTime();\n\n for (int loop = startIndex; loop < assignments.size(); loop++)\n {\n T assignment = assignments.get(loop);\n int compareResult = DateHelper.compare(assignment.getStart(), assignment.getFinish(), rangeStart);\n\n //\n // The start of the target range falls after the assignment end -\n // move on to test the next assignment.\n //\n if (compareResult > 0)\n {\n continue;\n }\n\n //\n // The start of the target range falls within the assignment -\n // return the index of this assignment to the caller.\n //\n if (compareResult == 0)\n {\n result = loop;\n break;\n }\n\n //\n // At this point, we know that the start of the target range is before\n // the assignment start. We need to determine if the end of the\n // target range overlaps the assignment.\n //\n compareResult = DateHelper.compare(assignment.getStart(), assignment.getFinish(), rangeEnd);\n if (compareResult >= 0)\n {\n result = loop;\n break;\n }\n }\n }\n return result;\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}",
"protected boolean inViewPort(final int dataIndex) {\n boolean inViewPort = true;\n\n for (Layout layout: mLayouts) {\n inViewPort = inViewPort && (layout.inViewPort(dataIndex) || !layout.isClippingEnabled());\n }\n return inViewPort;\n }"
] |
Searches the type and its sub types for the nearest ojb-persistent type and returns its name.
@param type The type to search
@return The qualified name of the found type or <code>null</code> if no type has been found | [
"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 static JSONObject parseTarget(Shape target) throws JSONException {\n JSONObject targetObject = new JSONObject();\n\n targetObject.put(\"resourceId\",\n target.getResourceId().toString());\n\n return targetObject;\n }",
"public void stop() {\n syncLock.lock();\n try {\n if (syncThread == null) {\n return;\n }\n instanceChangeStreamListener.stop();\n syncThread.interrupt();\n try {\n syncThread.join();\n } catch (final InterruptedException e) {\n return;\n }\n syncThread = null;\n isRunning = false;\n } finally {\n syncLock.unlock();\n }\n }",
"public User getLimits() throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_LIMITS);\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 userElement = response.getPayload();\r\n User user = new User();\r\n user.setId(userElement.getAttribute(\"nsid\"));\r\n NodeList photoNodes = userElement.getElementsByTagName(\"photos\");\r\n for (int i = 0; i < photoNodes.getLength(); i++) {\r\n Element plElement = (Element) photoNodes.item(i);\r\n PhotoLimits pl = new PhotoLimits();\r\n user.setPhotoLimits(pl);\r\n pl.setMaxDisplay(plElement.getAttribute(\"maxdisplaypx\"));\r\n pl.setMaxUpload(plElement.getAttribute(\"maxupload\"));\r\n }\r\n NodeList videoNodes = userElement.getElementsByTagName(\"videos\");\r\n for (int i = 0; i < videoNodes.getLength(); i++) {\r\n Element vlElement = (Element) videoNodes.item(i);\r\n VideoLimits vl = new VideoLimits();\r\n user.setPhotoLimits(vl);\r\n vl.setMaxDuration(vlElement.getAttribute(\"maxduration\"));\r\n vl.setMaxUpload(vlElement.getAttribute(\"maxupload\"));\r\n }\r\n return user;\r\n }",
"public <L extends Listener> void popEvent(Event<?, L> expected) {\n synchronized (this.stack) {\n final Event<?, ?> actual = this.stack.pop();\n if (actual != expected) {\n throw new IllegalStateException(String.format(\n \"Unbalanced pop: expected '%s' but encountered '%s'\",\n expected.getListenerClass(), actual));\n }\n }\n }",
"private Long string2long(String text, DateTimeFormat fmt) {\n \n // null or \"\" returns null\n if (text == null) return null;\n text = text.trim();\n if (text.length() == 0) return null;\n \n Date date = fmt.parse(text);\n return date != null ? UTCDateBox.date2utc(date) : null;\n }",
"protected void updateFontTable()\n {\n PDResources resources = pdpage.getResources();\n if (resources != null)\n {\n try\n {\n processFontResources(resources, fontTable);\n } catch (IOException e) {\n log.error(\"Error processing font resources: \"\n + \"Exception: {} {}\", e.getMessage(), e.getClass());\n }\n }\n }",
"public void setCurrencyDigits(Integer currDigs)\n {\n if (currDigs == null)\n {\n currDigs = DEFAULT_CURRENCY_DIGITS;\n }\n set(ProjectField.CURRENCY_DIGITS, currDigs);\n }",
"public Set<PlaybackState> getPlaybackState() {\n Set<PlaybackState> result = new HashSet<PlaybackState>(playbackStateMap.values());\n return Collections.unmodifiableSet(result);\n }",
"public static void registerDataPersisters(DataPersister... dataPersisters) {\n\t\t// we build the map and replace it to lower the chance of concurrency issues\n\t\tList<DataPersister> newList = new ArrayList<DataPersister>();\n\t\tif (registeredPersisters != null) {\n\t\t\tnewList.addAll(registeredPersisters);\n\t\t}\n\t\tfor (DataPersister persister : dataPersisters) {\n\t\t\tnewList.add(persister);\n\t\t}\n\t\tregisteredPersisters = newList;\n\t}"
] |
Use this API to update onlinkipv6prefix resources. | [
"public static base_responses update(nitro_service client, onlinkipv6prefix resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tonlinkipv6prefix updateresources[] = new onlinkipv6prefix[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tupdateresources[i] = new onlinkipv6prefix();\n\t\t\t\tupdateresources[i].ipv6prefix = resources[i].ipv6prefix;\n\t\t\t\tupdateresources[i].onlinkprefix = resources[i].onlinkprefix;\n\t\t\t\tupdateresources[i].autonomusprefix = resources[i].autonomusprefix;\n\t\t\t\tupdateresources[i].depricateprefix = resources[i].depricateprefix;\n\t\t\t\tupdateresources[i].decrementprefixlifetimes = resources[i].decrementprefixlifetimes;\n\t\t\t\tupdateresources[i].prefixvalidelifetime = resources[i].prefixvalidelifetime;\n\t\t\t\tupdateresources[i].prefixpreferredlifetime = resources[i].prefixpreferredlifetime;\n\t\t\t}\n\t\t\tresult = update_bulk_request(client, updateresources);\n\t\t}\n\t\treturn result;\n\t}"
] | [
"private static long scanForEndSig(final File file, final FileChannel channel, final ScanContext context) throws IOException {\n\n\n\n // TODO Consider just reading in MAX_REVERSE_SCAN bytes -- increased peak memory cost but less complex\n\n ByteBuffer bb = getByteBuffer(CHUNK_SIZE);\n long start = channel.size();\n long end = Math.max(0, start - MAX_REVERSE_SCAN);\n long channelPos = Math.max(0, start - CHUNK_SIZE);\n long lastChannelPos = channelPos;\n while (lastChannelPos >= end) {\n\n read(bb, channel, channelPos);\n\n int actualRead = bb.limit();\n int bufferPos = actualRead - 1;\n while (bufferPos >= SIG_PATTERN_LENGTH) {\n\n // Following is based on the Boyer Moore algorithm but simplified to reflect\n // a) the pattern is static\n // b) the pattern has no repeating bytes\n\n int patternPos;\n for (patternPos = SIG_PATTERN_LENGTH - 1;\n patternPos >= 0 && context.matches(patternPos, bb.get(bufferPos - patternPos));\n --patternPos) {\n // empty loop while bytes match\n }\n\n // Switch gives same results as checking the \"good suffix array\" in the Boyer Moore algorithm\n switch (patternPos) {\n case -1: {\n final State state = context.state;\n // Pattern matched. Confirm is this is the start of a valid end of central dir record\n long startEndRecord = channelPos + bufferPos - SIG_PATTERN_LENGTH + 1;\n if (validateEndRecord(file, channel, startEndRecord, context.getSig())) {\n if (state == State.FOUND) {\n return startEndRecord;\n } else {\n return -1;\n }\n }\n // wasn't a valid end 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 -= BAD_BYTE_SKIP[idx];\n break;\n }\n default:\n // 1 or more bytes matched\n bufferPos -= 4;\n }\n }\n\n // Move back a full chunk. If we didn't read a full chunk, that's ok,\n // it means we read all data and the outer while loop will terminate\n if (channelPos <= bufferPos) {\n break;\n }\n lastChannelPos = channelPos;\n channelPos -= Math.min(channelPos - bufferPos, CHUNK_SIZE - bufferPos);\n }\n\n return -1;\n }",
"public CoordinatorConfig setBootstrapURLs(List<String> bootstrapUrls) {\n this.bootstrapURLs = Utils.notNull(bootstrapUrls);\n if(this.bootstrapURLs.size() <= 0)\n throw new IllegalArgumentException(\"Must provide at least one bootstrap URL.\");\n return this;\n }",
"private boolean interpolationsDisagree(TrackPositionUpdate lastUpdate, TrackPositionUpdate currentUpdate) {\n long now = System.nanoTime();\n return Math.abs(interpolateTimeSinceUpdate(lastUpdate, now) - interpolateTimeSinceUpdate(currentUpdate, now)) >\n slack.get();\n }",
"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 QueryBuilder<T, ID> groupByRaw(String rawSql) {\n\t\taddGroupBy(ColumnNameOrRawSql.withRawSql(rawSql));\n\t\treturn this;\n\t}",
"public static lbvserver get(nitro_service service, String name) throws Exception{\n\t\tlbvserver obj = new lbvserver();\n\t\tobj.set_name(name);\n\t\tlbvserver response = (lbvserver) obj.get_resource(service);\n\t\treturn response;\n\t}",
"@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 static void writeShort(byte[] bytes, short value, int offset) {\n bytes[offset] = (byte) (0xFF & (value >> 8));\n bytes[offset + 1] = (byte) (0xFF & value);\n }",
"public void setCloseConnectionWatchTimeout(long closeConnectionWatchTimeout, TimeUnit timeUnit) {\n\t\tthis.closeConnectionWatchTimeoutInMs = TimeUnit.MILLISECONDS.convert(closeConnectionWatchTimeout, timeUnit);\n\t}"
] |
Get the multicast socket address.
@return the multicast address | [
"public InetSocketAddress getMulticastSocketAddress() {\n if (multicastAddress == null) {\n throw MESSAGES.noMulticastBinding(name);\n }\n return new InetSocketAddress(multicastAddress, multicastPort);\n }"
] | [
"public synchronized Message menuRequestTyped(Message.KnownType requestType, Message.MenuIdentifier targetMenu,\n CdjStatus.TrackSourceSlot slot, CdjStatus.TrackType trackType, Field... arguments)\n throws IOException {\n\n if (!menuLock.isHeldByCurrentThread()) {\n throw new IllegalStateException(\"renderMenuItems() cannot be called without first successfully calling tryLockingForMenuOperation()\");\n }\n\n Field[] combinedArguments = new Field[arguments.length + 1];\n combinedArguments[0] = buildRMST(targetMenu, slot, trackType);\n System.arraycopy(arguments, 0, combinedArguments, 1, arguments.length);\n final Message response = simpleRequest(requestType, Message.KnownType.MENU_AVAILABLE, combinedArguments);\n final NumberField reportedRequestType = (NumberField)response.arguments.get(0);\n if (reportedRequestType.getValue() != requestType.protocolValue) {\n throw new IOException(\"Menu request did not return result for same type as request; sent type: \" +\n requestType.protocolValue + \", received type: \" + reportedRequestType.getValue() +\n \", response: \" + response);\n }\n return response;\n }",
"public final static void appendDecEntity(final StringBuilder out, final char value)\n {\n out.append(\"&#\");\n out.append((int)value);\n out.append(';');\n }",
"public ArrayList<Duration> segmentWork(ProjectCalendar projectCalendar, List<TimephasedWork> work, TimescaleUnits rangeUnits, List<DateRange> dateList)\n {\n ArrayList<Duration> result = new ArrayList<Duration>(dateList.size());\n int lastStartIndex = 0;\n\n //\n // Iterate through the list of dates range we are interested in.\n // Each date range in this list corresponds to a column\n // shown on the \"timescale\" view by MS Project\n //\n for (DateRange range : dateList)\n {\n //\n // If the current date range does not intersect with any of the\n // assignment date ranges in the list, then we show a zero\n // duration for this date range.\n //\n int startIndex = lastStartIndex == -1 ? -1 : getStartIndex(range, work, lastStartIndex);\n if (startIndex == -1)\n {\n result.add(Duration.getInstance(0, TimeUnit.HOURS));\n }\n else\n {\n //\n // We have found an assignment which intersects with the current\n // date range, call the method below to determine how\n // much time from this resource assignment can be allocated\n // to the current date range.\n //\n result.add(getRangeDuration(projectCalendar, rangeUnits, range, work, startIndex));\n lastStartIndex = startIndex;\n }\n }\n\n return result;\n }",
"public void fireResourceWrittenEvent(Resource resource)\n {\n if (m_projectListeners != null)\n {\n for (ProjectListener listener : m_projectListeners)\n {\n listener.resourceWritten(resource);\n }\n }\n }",
"public static Multimap<String, String> getParameters(final String rawQuery) {\n Multimap<String, String> result = HashMultimap.create();\n if (rawQuery == null) {\n return result;\n }\n\n StringTokenizer tokens = new StringTokenizer(rawQuery, \"&\");\n while (tokens.hasMoreTokens()) {\n String pair = tokens.nextToken();\n int pos = pair.indexOf('=');\n String key;\n String value;\n if (pos == -1) {\n key = pair;\n value = \"\";\n } else {\n\n try {\n key = URLDecoder.decode(pair.substring(0, pos), \"UTF-8\");\n value = URLDecoder.decode(pair.substring(pos + 1), \"UTF-8\");\n } catch (UnsupportedEncodingException e) {\n throw ExceptionUtils.getRuntimeException(e);\n }\n }\n\n result.put(key, value);\n }\n return result;\n }",
"public Metadata updateMetadata(Metadata metadata) {\n String scope;\n if (metadata.getScope().equals(Metadata.GLOBAL_METADATA_SCOPE)) {\n scope = Metadata.GLOBAL_METADATA_SCOPE;\n } else {\n scope = Metadata.ENTERPRISE_METADATA_SCOPE;\n }\n\n URL url = METADATA_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID(),\n scope, metadata.getTemplateName());\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"PUT\");\n request.addHeader(\"Content-Type\", \"application/json-patch+json\");\n request.setBody(metadata.getPatch());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n return new Metadata(JsonObject.readFrom(response.getJSON()));\n }",
"@SuppressWarnings(\"unchecked\")\r\n\tpublic <T> T convertElement(ConversionContext context, Object source,\r\n\t\t\tTypeReference<T> destinationType) throws ConverterException {\r\n\t\treturn (T) elementConverter.convert(context, source, destinationType);\r\n\t}",
"public static Command newStartProcess(String processId,\n Map<String, Object> parameters) {\n return getCommandFactoryProvider().newStartProcess( processId,\n parameters );\n }",
"@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoLocalDateTime<Symmetry010Date> localDateTime(TemporalAccessor temporal) {\n return (ChronoLocalDateTime<Symmetry010Date>) super.localDateTime(temporal);\n }"
] |
Gets the actual type arguments of a Type
@param type The type to examine
@return The type arguments | [
"public static Type[] getActualTypeArguments(Type type) {\n Type resolvedType = Types.getCanonicalType(type);\n if (resolvedType instanceof ParameterizedType) {\n return ((ParameterizedType) resolvedType).getActualTypeArguments();\n } else {\n return EMPTY_TYPES;\n }\n }"
] | [
"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 static FormValidation validateEmails(String emails) {\n if (!Strings.isNullOrEmpty(emails)) {\n String[] recipients = StringUtils.split(emails, \" \");\n for (String email : recipients) {\n FormValidation validation = validateInternetAddress(email);\n if (validation != FormValidation.ok()) {\n return validation;\n }\n }\n }\n return FormValidation.ok();\n }",
"private List<UDFAssignmentType> writeUDFType(FieldTypeClass type, FieldContainer mpxj)\n {\n List<UDFAssignmentType> out = new ArrayList<UDFAssignmentType>();\n for (CustomField cf : m_sortedCustomFieldsList)\n {\n FieldType fieldType = cf.getFieldType();\n if (fieldType != null && type == fieldType.getFieldTypeClass())\n {\n Object value = mpxj.getCachedValue(fieldType);\n if (FieldTypeHelper.valueIsNotDefault(fieldType, value))\n {\n UDFAssignmentType udf = m_factory.createUDFAssignmentType();\n udf.setTypeObjectId(FieldTypeHelper.getFieldID(fieldType));\n setUserFieldValue(udf, fieldType.getDataType(), value);\n out.add(udf);\n }\n }\n }\n return out;\n }",
"public Map<String, Table> process(File directory, String prefix) throws IOException\n {\n String filePrefix = prefix.toUpperCase();\n Map<String, Table> tables = new HashMap<String, Table>();\n File[] files = directory.listFiles();\n if (files != null)\n {\n for (File file : files)\n {\n String name = file.getName().toUpperCase();\n if (!name.startsWith(filePrefix))\n {\n continue;\n }\n\n int typeIndex = name.lastIndexOf('.') - 3;\n String type = name.substring(typeIndex, typeIndex + 3);\n TableDefinition definition = TABLE_DEFINITIONS.get(type);\n if (definition != null)\n {\n Table table = new Table();\n TableReader reader = new TableReader(definition);\n reader.read(file, table);\n tables.put(type, table);\n //dumpCSV(type, definition, table);\n }\n }\n }\n return tables;\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 static boolean isAscii(Slice utf8)\n {\n int length = utf8.length();\n int offset = 0;\n\n // Length rounded to 8 bytes\n int length8 = length & 0x7FFF_FFF8;\n for (; offset < length8; offset += 8) {\n if ((utf8.getLongUnchecked(offset) & TOP_MASK64) != 0) {\n return false;\n }\n }\n // Enough bytes left for 32 bits?\n if (offset + 4 < length) {\n if ((utf8.getIntUnchecked(offset) & TOP_MASK32) != 0) {\n return false;\n }\n\n offset += 4;\n }\n // Do the rest one by one\n for (; offset < length; offset++) {\n if ((utf8.getByteUnchecked(offset) & 0x80) != 0) {\n return false;\n }\n }\n\n return true;\n }",
"public static base_responses expire(nitro_service client, cachecontentgroup resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tcachecontentgroup expireresources[] = new cachecontentgroup[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\texpireresources[i] = new cachecontentgroup();\n\t\t\t\texpireresources[i].name = resources[i].name;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, expireresources,\"expire\");\n\t\t}\n\t\treturn result;\n\t}",
"@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoLocalDateTime<InternationalFixedDate> localDateTime(TemporalAccessor temporal) {\n return (ChronoLocalDateTime<InternationalFixedDate>) super.localDateTime(temporal);\n }",
"public static boolean isSymmetric( DMatrixSparseCSC A , double tol ) {\n if( A.numRows != A.numCols )\n return false;\n\n int N = A.numCols;\n\n for (int i = 0; i < N; i++) {\n int idx0 = A.col_idx[i];\n int idx1 = A.col_idx[i+1];\n\n for (int index = idx0; index < idx1; index++) {\n int j = A.nz_rows[index];\n double value_ji = A.nz_values[index];\n double value_ij = A.get(i,j);\n\n if( Math.abs(value_ij-value_ji) > tol )\n return false;\n }\n }\n\n return true;\n }"
] |
Creates a list of placeholders for use in a PreparedStatement
@param length number of placeholders
@return String of placeholders, seperated by comma | [
"private static String preparePlaceHolders(int length) {\n StringBuilder builder = new StringBuilder();\n for (int i = 0; i < length; ) {\n builder.append(\"?\");\n if (++i < length) {\n builder.append(\",\");\n }\n }\n return builder.toString();\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 }",
"public static boolean bidiagOuterBlocks( final int blockLength ,\n final DSubmatrixD1 A ,\n final double gammasU[],\n final double gammasV[])\n {\n// System.out.println(\"---------- Orig\");\n// A.original.print();\n\n int width = Math.min(blockLength,A.col1-A.col0);\n int height = Math.min(blockLength,A.row1-A.row0);\n\n int min = Math.min(width,height);\n\n for( int i = 0; i < min; i++ ) {\n //--- Apply reflector to the column\n\n // compute the householder vector\n if (!computeHouseHolderCol(blockLength, A, gammasU, i))\n return false;\n\n // apply to rest of the columns in the column block\n rank1UpdateMultR_Col(blockLength,A,i,gammasU[A.col0+i]);\n\n // apply to the top row block\n rank1UpdateMultR_TopRow(blockLength,A,i,gammasU[A.col0+i]);\n\n System.out.println(\"After column stuff\");\n A.original.print();\n\n //-- Apply reflector to the row\n if(!computeHouseHolderRow(blockLength,A,gammasV,i))\n return false;\n \n // apply to rest of the rows in the row block\n rank1UpdateMultL_Row(blockLength,A,i,i+1,gammasV[A.row0+i]);\n\n System.out.println(\"After update row\");\n A.original.print();\n\n // apply to the left column block\n // TODO THIS WON'T WORK!!!!!!!!!!!!!\n // Needs the whole matrix to have been updated by the left reflector to compute the correct solution\n// rank1UpdateMultL_LeftCol(blockLength,A,i,i+1,gammasV[A.row0+i]);\n\n System.out.println(\"After row stuff\");\n A.original.print();\n }\n\n return true;\n }",
"protected void copyStream(File outputDirectory,\n InputStream stream,\n String targetFileName) throws IOException\n {\n File resourceFile = new File(outputDirectory, targetFileName);\n BufferedReader reader = null;\n Writer writer = null;\n try\n {\n reader = new BufferedReader(new InputStreamReader(stream, ENCODING));\n writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(resourceFile), ENCODING));\n\n String line = reader.readLine();\n while (line != null)\n {\n writer.write(line);\n writer.write('\\n');\n line = reader.readLine();\n }\n writer.flush();\n }\n finally\n {\n if (reader != null)\n {\n reader.close();\n }\n if (writer != null)\n {\n writer.close();\n }\n }\n }",
"public boolean getWorkModified(List<TimephasedWork> list)\n {\n boolean result = false;\n for (TimephasedWork assignment : list)\n {\n result = assignment.getModified();\n if (result)\n {\n break;\n }\n }\n return result;\n }",
"private Object initializeLazyPropertiesFromCache(\n\t\t\tfinal String fieldName,\n\t\t\tfinal Object entity,\n\t\t\tfinal SharedSessionContractImplementor session,\n\t\t\tfinal EntityEntry entry,\n\t\t\tfinal CacheEntry cacheEntry\n\t) {\n\t\tthrow new NotSupportedException( \"OGM-9\", \"Lazy properties not supported in OGM\" );\n\t}",
"public boolean find() {\r\n if (findIterator == null) {\r\n findIterator = root.iterator();\r\n }\r\n if (findCurrent != null && matches()) {\r\n return true;\r\n }\r\n while (findIterator.hasNext()) {\r\n findCurrent = findIterator.next();\r\n resetChildIter(findCurrent);\r\n if (matches()) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }",
"public synchronized Object removeRoleMapping(final String roleName) {\n /*\n * Would not expect this to happen during boot so don't offer the 'immediate' optimisation.\n */\n HashMap<String, RoleMappingImpl> newRoles = new HashMap<String, RoleMappingImpl>(roleMappings);\n if (newRoles.containsKey(roleName)) {\n RoleMappingImpl removed = newRoles.remove(roleName);\n Object removalKey = new Object();\n removedRoles.put(removalKey, removed);\n roleMappings = Collections.unmodifiableMap(newRoles);\n\n return removalKey;\n }\n\n return null;\n }",
"public void syncInternalStateFromFileSystem(boolean alsoSyncRemoteState) {\n // Make sure versions missing from the file-system are cleaned up from the internal state\n for (Long version: versionToEnabledMap.keySet()) {\n File[] existingVersionDirs = ReadOnlyUtils.getVersionDirs(rootDir, version, version);\n if (existingVersionDirs.length == 0) {\n removeVersion(version, alsoSyncRemoteState);\n }\n }\n\n // Make sure we have all versions on the file-system in the internal state\n File[] versionDirs = ReadOnlyUtils.getVersionDirs(rootDir);\n if (versionDirs != null) {\n for (File versionDir: versionDirs) {\n long versionNumber = ReadOnlyUtils.getVersionId(versionDir);\n boolean versionEnabled = isVersionEnabled(versionDir);\n versionToEnabledMap.put(versionNumber, versionEnabled);\n }\n }\n\n // Identify the current version (based on a symlink in the file-system)\n File currentVersionDir = ReadOnlyUtils.getCurrentVersion(rootDir);\n if (currentVersionDir != null) {\n currentVersion = ReadOnlyUtils.getVersionId(currentVersionDir);\n } else {\n currentVersion = -1; // Should we throw instead?\n }\n\n logger.info(\"Successfully synced internal state from local file-system: \" + this.toString());\n }",
"protected boolean isTransient(ClassDescriptor cld, Object obj, Identity oid)\r\n {\r\n // if the Identity is transient we assume a non-persistent object\r\n boolean isNew = oid != null && oid.isTransient();\r\n /*\r\n detection of new objects is costly (select of ID in DB to check if object\r\n already exists) we do:\r\n a. check if the object has nullified PK field\r\n b. check if the object is already registered\r\n c. lookup from cache and if not found, last option select on DB\r\n */\r\n if(!isNew)\r\n {\r\n final PersistenceBroker pb = getBroker();\r\n if(cld == null)\r\n {\r\n cld = pb.getClassDescriptor(obj.getClass());\r\n }\r\n isNew = pb.serviceBrokerHelper().hasNullPKField(cld, obj);\r\n if(!isNew)\r\n {\r\n if(oid == null)\r\n {\r\n oid = pb.serviceIdentity().buildIdentity(cld, obj);\r\n }\r\n final ObjectEnvelope mod = objectEnvelopeTable.getByIdentity(oid);\r\n if(mod != null)\r\n {\r\n // already registered object, use current state\r\n isNew = mod.needsInsert();\r\n }\r\n else\r\n {\r\n // if object was found cache, assume it's old\r\n // else make costly check against the DB\r\n isNew = pb.serviceObjectCache().lookup(oid) == null\r\n && !pb.serviceBrokerHelper().doesExist(cld, oid, obj);\r\n }\r\n }\r\n }\r\n return isNew;\r\n }"
] |
Only call with the read lock held | [
"private OperationEntry getInheritableOperationEntryLocked(final String operationName) {\n final OperationEntry entry = operations == null ? null : operations.get(operationName);\n if (entry != null && entry.isInherited()) {\n return entry;\n }\n return null;\n }"
] | [
"public AT_Row setPaddingTopChar(Character paddingTopChar) {\r\n\t\tif(this.hasCells()){\r\n\t\t\tfor(AT_Cell cell : this.getCells()){\r\n\t\t\t\tcell.getContext().setPaddingTopChar(paddingTopChar);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}",
"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 }",
"public AlbumArt requestArtworkFrom(final DataReference artReference, final CdjStatus.TrackType trackType) {\n ensureRunning();\n AlbumArt artwork = findArtInMemoryCaches(artReference); // First check the in-memory artwork caches.\n if (artwork == null) {\n artwork = requestArtworkInternal(artReference, trackType, false);\n }\n return artwork;\n }",
"public static List<Dependency> getCorporateDependencies(final Module module, final List<String> corporateFilters) {\n final List<Dependency> corporateDependencies = new ArrayList<Dependency>();\n final Pattern corporatePattern = generateCorporatePattern(corporateFilters);\n\n for(final Dependency dependency: getAllDependencies(module)){\n if(dependency.getTarget().getGavc().matches(corporatePattern.pattern())){\n corporateDependencies.add(dependency);\n }\n }\n\n return corporateDependencies;\n }",
"public void setHomeAsUpIndicator(Drawable indicator) {\n if(!deviceSupportMultiPane()) {\n pulsante.setHomeAsUpIndicator(indicator);\n }\n else {\n actionBar.setHomeAsUpIndicator(indicator);\n }\n }",
"private void setTableAliasForPath(String aPath, List hintClasses, TableAlias anAlias)\r\n {\r\n m_pathToAlias.put(buildAliasKey(aPath, hintClasses), anAlias);\r\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 }",
"@Deprecated\n public String get(String path) {\n final JsonValue value = this.values.get(this.pathToProperty(path));\n if (value == null) {\n return null;\n }\n if (!value.isString()) {\n return value.toString();\n }\n return value.asString();\n }",
"private synchronized void flushData() {\n BufferedWriter writer = null;\n try {\n writer = new BufferedWriter(new FileWriter(new File(this.inputPath)));\n for(String key: this.metadataMap.keySet()) {\n writer.write(NEW_PROPERTY_SEPARATOR + key.toString() + \"]\" + NEW_LINE);\n writer.write(this.metadataMap.get(key).toString());\n writer.write(\"\" + NEW_LINE + \"\" + NEW_LINE);\n }\n writer.flush();\n } catch(IOException e) {\n logger.error(\"IO exception while flushing data to file backed storage: \"\n + e.getMessage());\n }\n\n try {\n if(writer != null)\n writer.close();\n } catch(Exception e) {\n logger.error(\"Error while flushing data to file backed storage: \" + e.getMessage());\n }\n }"
] |
Create a TableAlias for path or userAlias
@param aTable
@param aPath
@param aUserAlias
@return TableAlias | [
"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 void addJarToClasspath(ClassLoader loader, URL url) throws IOException,\n IllegalAccessException, IllegalArgumentException, InvocationTargetException,\n NoSuchMethodException, SecurityException {\n URLClassLoader sysloader = (URLClassLoader) loader;\n Class<?> sysclass = URLClassLoader.class;\n\n Method method =\n sysclass.getDeclaredMethod(MyClasspathUtils.ADD_URL_METHOD, new Class[] {URL.class});\n method.setAccessible(true);\n method.invoke(sysloader, new Object[] {url});\n\n }",
"public static IPAddressSeqRange[] join(IPAddressSeqRange... ranges) {\n\t\tint joinedCount = 0;\n\t\tArrays.sort(ranges, Address.ADDRESS_LOW_VALUE_COMPARATOR);\n\t\tfor(int i = 0; i < ranges.length; i++) {\n\t\t\tIPAddressSeqRange range = ranges[i];\n\t\t\tif(range == null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor(int j = i + 1; j < ranges.length; j++) {\n\t\t\t\tIPAddressSeqRange range2 = ranges[j];\n\t\t\t\tif(range2 == null) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tIPAddress upper = range.getUpper();\n\t\t\t\tIPAddress lower = range2.getLower();\n\t\t\t\tif(compareLowValues(upper, lower) >= 0\n\t\t\t\t\t\t|| upper.increment(1).equals(lower)) {\n\t\t\t\t\t//join them\n\t\t\t\t\tranges[i] = range = range.create(range.getLower(), range2.getUpper());\n\t\t\t\t\tranges[j] = null;\n\t\t\t\t\tjoinedCount++;\n\t\t\t\t} else break;\n\t\t\t}\n\t\t}\n\t\tif(joinedCount == 0) {\n\t\t\treturn ranges;\n\t\t}\n\t\tIPAddressSeqRange joined[] = new IPAddressSeqRange[ranges.length - joinedCount];\n\t\tfor(int i = 0, j = 0; i < ranges.length; i++) {\n\t\t\tIPAddressSeqRange range = ranges[i];\n\t\t\tif(range == null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tjoined[j++] = range;\n\t\t\tif(j >= joined.length) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn joined;\n\t}",
"private void updateGhostStyle() {\n\n if (CmsStringUtil.isEmpty(m_realValue)) {\n if (CmsStringUtil.isEmpty(m_ghostValue)) {\n updateTextArea(m_realValue);\n return;\n }\n if (!m_focus) {\n setGhostStyleEnabled(true);\n updateTextArea(m_ghostValue);\n } else {\n // don't show ghost mode while focused\n setGhostStyleEnabled(false);\n }\n } else {\n setGhostStyleEnabled(false);\n updateTextArea(m_realValue);\n }\n }",
"public static ComponentsMultiThread getComponentsMultiThread() {\n TransactionLogger instance = getInstance();\n if (instance == null) {\n return null;\n }\n\n return instance.componentsMultiThread;\n }",
"public GVRMesh findMesh(GVRSceneObject model)\n {\n class MeshFinder implements GVRSceneObject.ComponentVisitor\n {\n private GVRMesh meshFound = null;\n public GVRMesh getMesh() { return meshFound; }\n public boolean visit(GVRComponent comp)\n {\n GVRRenderData rdata = (GVRRenderData) comp;\n meshFound = rdata.getMesh();\n return (meshFound == null);\n }\n };\n MeshFinder findMesh = new MeshFinder();\n model.forAllComponents(findMesh, GVRRenderData.getComponentType());\n return findMesh.getMesh();\n }",
"private String escapeQuotes(String value)\n {\n StringBuilder sb = new StringBuilder();\n int length = value.length();\n char c;\n\n sb.append('\"');\n for (int index = 0; index < length; index++)\n {\n c = value.charAt(index);\n sb.append(c);\n\n if (c == '\"')\n {\n sb.append('\"');\n }\n }\n sb.append('\"');\n\n return (sb.toString());\n }",
"public void addNotBetween(Object attribute, Object value1, Object value2)\r\n {\r\n // PAW\r\n\t\t// addSelectionCriteria(ValueCriteria.buildNotBeweenCriteria(attribute, value1, value2, getAlias()));\r\n\t\taddSelectionCriteria(ValueCriteria.buildNotBeweenCriteria(attribute, value1, value2, getUserAlias(attribute)));\r\n }",
"private int decode(Huffman h) throws IOException\n {\n int len; /* current number of bits in code */\n int code; /* len bits being decoded */\n int first; /* first code of length len */\n int count; /* number of codes of length len */\n int index; /* index of first code of length len in symbol table */\n int bitbuf; /* bits from stream */\n int left; /* bits left in next or left to process */\n //short *next; /* next number of codes */\n\n bitbuf = m_bitbuf;\n left = m_bitcnt;\n code = first = index = 0;\n len = 1;\n int nextIndex = 1; // next = h->count + 1;\n while (true)\n {\n while (left-- != 0)\n {\n code |= (bitbuf & 1) ^ 1; /* invert code */\n bitbuf >>= 1;\n //count = *next++;\n count = h.m_count[nextIndex++];\n if (code < first + count)\n { /* if length len, return symbol */\n m_bitbuf = bitbuf;\n m_bitcnt = (m_bitcnt - len) & 7;\n return h.m_symbol[index + (code - first)];\n }\n index += count; /* else update for next length */\n first += count;\n first <<= 1;\n code <<= 1;\n len++;\n }\n left = (MAXBITS + 1) - len;\n if (left == 0)\n {\n break;\n }\n if (m_left == 0)\n {\n m_in = m_input.read();\n m_left = m_in == -1 ? 0 : 1;\n if (m_left == 0)\n {\n throw new IOException(\"out of input\"); /* out of input */\n }\n }\n bitbuf = m_in;\n m_left--;\n if (left > 8)\n {\n left = 8;\n }\n }\n return -9; /* ran out of codes */\n }",
"@Override\n protected void onDraw(Canvas canvas) {\n super.onDraw(canvas);\n\n // If the API level is less than 11, we can't rely on the view animation system to\n // do the scrolling animation. Need to tick it here and call postInvalidate() until the scrolling is done.\n if (Build.VERSION.SDK_INT < 11) {\n tickScrollAnimation();\n if (!mScroller.isFinished()) {\n mGraph.postInvalidate();\n }\n }\n }"
] |
Saves the project file displayed in this panel.
@param file target file
@param type file type | [
"public void saveFile(File file, String type)\n {\n if (file != null)\n {\n m_treeController.saveFile(file, type);\n }\n }"
] | [
"@Override\n public boolean invokeFunction(String funcName, Object[] params) {\n // Run script if it is dirty. This makes sure the script is run\n // on the same thread as the caller (suppose the caller is always\n // calling from the same thread).\n checkDirty();\n\n // Skip bad functions\n if (isBadFunction(funcName)) {\n return false;\n }\n\n String statement = getInvokeStatementCached(funcName, params);\n\n synchronized (mEngineLock) {\n localBindings = mLocalEngine.getBindings(ScriptContext.ENGINE_SCOPE);\n if (localBindings == null) {\n localBindings = mLocalEngine.createBindings();\n mLocalEngine.setBindings(localBindings, ScriptContext.ENGINE_SCOPE);\n }\n }\n\n fillBindings(localBindings, params);\n\n try {\n mLocalEngine.eval(statement);\n } catch (ScriptException e) {\n // The function is either undefined or throws, avoid invoking it later\n addBadFunction(funcName);\n mLastError = e.getMessage();\n return false;\n } finally {\n removeBindings(localBindings, params);\n }\n\n return true;\n }",
"public void recordCheckoutQueueLength(SocketDestination dest, int queueLength) {\n if(dest != null) {\n getOrCreateNodeStats(dest).recordCheckoutQueueLength(null, queueLength);\n recordCheckoutQueueLength(null, queueLength);\n } else {\n this.checkoutQueueLengthHistogram.insert(queueLength);\n checkMonitoringInterval();\n }\n }",
"private Project.Calendars.Calendar writeCalendar(ProjectCalendar bc)\n {\n //\n // Create a calendar\n //\n Project.Calendars.Calendar calendar = m_factory.createProjectCalendarsCalendar();\n calendar.setUID(NumberHelper.getBigInteger(bc.getUniqueID()));\n calendar.setIsBaseCalendar(Boolean.valueOf(!bc.isDerived()));\n\n ProjectCalendar base = bc.getParent();\n // SF-329: null default required to keep Powerproject happy when importing MSPDI files\n calendar.setBaseCalendarUID(base == null ? NULL_CALENDAR_ID : NumberHelper.getBigInteger(base.getUniqueID()));\n calendar.setName(bc.getName());\n\n //\n // Create a list of normal days\n //\n Project.Calendars.Calendar.WeekDays days = m_factory.createProjectCalendarsCalendarWeekDays();\n Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime time;\n ProjectCalendarHours bch;\n\n List<Project.Calendars.Calendar.WeekDays.WeekDay> dayList = days.getWeekDay();\n\n for (int loop = 1; loop < 8; loop++)\n {\n DayType workingFlag = bc.getWorkingDay(Day.getInstance(loop));\n\n if (workingFlag != DayType.DEFAULT)\n {\n Project.Calendars.Calendar.WeekDays.WeekDay day = m_factory.createProjectCalendarsCalendarWeekDaysWeekDay();\n dayList.add(day);\n day.setDayType(BigInteger.valueOf(loop));\n day.setDayWorking(Boolean.valueOf(workingFlag == DayType.WORKING));\n\n if (workingFlag == DayType.WORKING)\n {\n Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimes();\n day.setWorkingTimes(times);\n List<Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();\n\n bch = bc.getCalendarHours(Day.getInstance(loop));\n if (bch != null)\n {\n for (DateRange range : bch)\n {\n if (range != null)\n {\n time = m_factory.createProjectCalendarsCalendarWeekDaysWeekDayWorkingTimesWorkingTime();\n timesList.add(time);\n\n time.setFromTime(range.getStart());\n time.setToTime(range.getEnd());\n }\n }\n }\n }\n }\n }\n\n //\n // Create a list of exceptions\n //\n // A quirk of MS Project is that these exceptions must be\n // in date order in the file, otherwise they are ignored\n //\n List<ProjectCalendarException> exceptions = new ArrayList<ProjectCalendarException>(bc.getCalendarExceptions());\n if (!exceptions.isEmpty())\n {\n Collections.sort(exceptions);\n writeExceptions(calendar, dayList, exceptions);\n }\n\n //\n // Do not add a weekdays tag to the calendar unless it\n // has valid entries.\n // Fixes SourceForge bug 1854747: MPXJ and MSP 2007 XML formats\n //\n if (!dayList.isEmpty())\n {\n calendar.setWeekDays(days);\n }\n\n writeWorkWeeks(calendar, bc);\n\n m_eventManager.fireCalendarWrittenEvent(bc);\n\n return (calendar);\n }",
"public double getBearing(LatLong end) {\n if (this.equals(end)) {\n return 0;\n }\n\n double lat1 = latToRadians();\n double lon1 = longToRadians();\n double lat2 = end.latToRadians();\n double lon2 = end.longToRadians();\n\n double angle = -Math.atan2(Math.sin(lon1 - lon2) * Math.cos(lat2),\n Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1)\n * Math.cos(lat2) * Math.cos(lon1 - lon2));\n\n if (angle < 0.0) {\n angle += Math.PI * 2.0;\n }\n if (angle > Math.PI) {\n angle -= Math.PI * 2.0;\n }\n\n return Math.toDegrees(angle);\n }",
"private void checkLocking(FieldDescriptorDef fieldDef, String checkLevel) throws ConstraintException\r\n {\r\n if (CHECKLEVEL_NONE.equals(checkLevel))\r\n {\r\n return;\r\n }\r\n\r\n String jdbcType = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE);\r\n\r\n if (!\"TIMESTAMP\".equals(jdbcType) && !\"INTEGER\".equals(jdbcType))\r\n {\r\n if (fieldDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_LOCKING, false))\r\n {\r\n throw new ConstraintException(\"The field \"+fieldDef.getName()+\" in class \"+fieldDef.getOwner().getName()+\" has locking set to true though it is not of TIMESTAMP or INTEGER type\");\r\n }\r\n if (fieldDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_UPDATE_LOCK, false))\r\n {\r\n throw new ConstraintException(\"The field \"+fieldDef.getName()+\" in class \"+fieldDef.getOwner().getName()+\" has update-lock set to true though it is not of TIMESTAMP or INTEGER type\");\r\n }\r\n }\r\n }",
"protected String getArgString(Object arg) {\n //if (arg instanceof LatLong) {\n // return ((LatLong) arg).getVariableName();\n //} else \n if (arg instanceof JavascriptObject) {\n return ((JavascriptObject) arg).getVariableName();\n // return ((JavascriptObject) arg).getPropertiesAsString();\n } else if( arg instanceof JavascriptEnum ) {\n return ((JavascriptEnum) arg).getEnumValue().toString();\n } else {\n return arg.toString();\n }\n }",
"public Where<T, ID> rawComparison(String columnName, String rawOperator, Object value) throws SQLException {\n\t\taddClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, rawOperator));\n\t\treturn this;\n\t}",
"Object readResolve() throws ObjectStreamException {\n Bean<?> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<Object>, Object>getContextual(beanId);\n if (bean == null) {\n throw BeanLogger.LOG.proxyDeserializationFailure(beanId);\n }\n return Container.instance(contextId).deploymentManager().getClientProxyProvider().getClientProxy(bean);\n }",
"private void initializeVideoInfo() {\n VIDEO_INFO.put(\"The Big Bang Theory\", \"http://thetvdb.com/banners/_cache/posters/80379-9.jpg\");\n VIDEO_INFO.put(\"Breaking Bad\", \"http://thetvdb.com/banners/_cache/posters/81189-22.jpg\");\n VIDEO_INFO.put(\"Arrow\", \"http://thetvdb.com/banners/_cache/posters/257655-15.jpg\");\n VIDEO_INFO.put(\"Game of Thrones\", \"http://thetvdb.com/banners/_cache/posters/121361-26.jpg\");\n VIDEO_INFO.put(\"Lost\", \"http://thetvdb.com/banners/_cache/posters/73739-2.jpg\");\n VIDEO_INFO.put(\"How I met your mother\",\n \"http://thetvdb.com/banners/_cache/posters/75760-29.jpg\");\n VIDEO_INFO.put(\"Dexter\", \"http://thetvdb.com/banners/_cache/posters/79349-24.jpg\");\n VIDEO_INFO.put(\"Sleepy Hollow\", \"http://thetvdb.com/banners/_cache/posters/269578-5.jpg\");\n VIDEO_INFO.put(\"The Vampire Diaries\", \"http://thetvdb.com/banners/_cache/posters/95491-27.jpg\");\n VIDEO_INFO.put(\"Friends\", \"http://thetvdb.com/banners/_cache/posters/79168-4.jpg\");\n VIDEO_INFO.put(\"New Girl\", \"http://thetvdb.com/banners/_cache/posters/248682-9.jpg\");\n VIDEO_INFO.put(\"The Mentalist\", \"http://thetvdb.com/banners/_cache/posters/82459-1.jpg\");\n VIDEO_INFO.put(\"Sons of Anarchy\", \"http://thetvdb.com/banners/_cache/posters/82696-1.jpg\");\n }"
] |
Validates operations against their description providers
@param operations The operations to validate
@throws IllegalArgumentException if any operation is not valid | [
"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 }"
] | [
"public float conditionalLogProb(int[] given, int of) {\r\n if (given.length != windowSize - 1) {\r\n System.err.println(\"error computing conditional log prob\");\r\n System.exit(0);\r\n }\r\n int[] label = indicesFront(given);\r\n float[] masses = new float[label.length];\r\n for (int i = 0; i < masses.length; i++) {\r\n masses[i] = table[label[i]];\r\n }\r\n float z = ArrayMath.logSum(masses);\r\n\r\n return table[indexOf(given, of)] - z;\r\n }",
"private boolean shouldIgnore(String typeReference)\n {\n typeReference = typeReference.replace('/', '.').replace('\\\\', '.');\n return JavaClassIgnoreResolver.singletonInstance().matches(typeReference);\n }",
"public static dospolicy[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{\n\t\tdospolicy obj = new dospolicy();\n\t\toptions option = new options();\n\t\toption.set_filter(filter);\n\t\tdospolicy[] response = (dospolicy[]) obj.getfiltered(service, option);\n\t\treturn response;\n\t}",
"public void cache(Identity oid, Object obj)\r\n {\r\n if (oid != null && obj != null)\r\n {\r\n ObjectCache cache = getCache(oid, obj, METHOD_CACHE);\r\n if (cache != null)\r\n {\r\n cache.cache(oid, obj);\r\n }\r\n }\r\n }",
"@Pure\n\tpublic static <K, V> Map<K, V> operator_minus(Map<K, V> left, final Pair<? extends K, ? extends V> right) {\n\t\treturn Maps.filterEntries(left, new Predicate<Entry<K, V>>() {\n\t\t\t@Override\n\t\t\tpublic boolean apply(Entry<K, V> input) {\n\t\t\t\treturn !Objects.equal(input.getKey(), right.getKey()) || !Objects.equal(input.getValue(), right.getValue());\n\t\t\t}\n\t\t});\n\t}",
"public Date dateTime(ImapRequestLineReader request) throws ProtocolException {\n char next = request.nextWordChar();\n String dateString;\n // From https://tools.ietf.org/html/rfc3501 :\n // date-time = DQUOTE date-day-fixed \"-\" date-month \"-\" date-year\n // SP time SP zone DQUOTE\n // zone = (\"+\" / \"-\") 4DIGIT\n if (next == '\"') {\n dateString = consumeQuoted(request);\n } else {\n throw new ProtocolException(\"DateTime values must be quoted.\");\n }\n\n try {\n // You can use Z or zzzz\n return new SimpleDateFormat(\"dd-MMM-yyyy hh:mm:ss Z\", Locale.US).parse(dateString);\n } catch (ParseException e) {\n throw new ProtocolException(\"Invalid date format <\" + dateString + \">, should comply to dd-MMM-yyyy hh:mm:ss Z\");\n }\n }",
"public static sslpolicylabel get(nitro_service service, String labelname) throws Exception{\n\t\tsslpolicylabel obj = new sslpolicylabel();\n\t\tobj.set_labelname(labelname);\n\t\tsslpolicylabel response = (sslpolicylabel) obj.get_resource(service);\n\t\treturn response;\n\t}",
"private void processCurrency(Row row)\n {\n String currencyName = row.getString(\"curr_short_name\");\n DecimalFormatSymbols symbols = new DecimalFormatSymbols();\n symbols.setDecimalSeparator(row.getString(\"decimal_symbol\").charAt(0));\n symbols.setGroupingSeparator(row.getString(\"digit_group_symbol\").charAt(0));\n DecimalFormat nf = new DecimalFormat();\n nf.setDecimalFormatSymbols(symbols);\n nf.applyPattern(\"#.#\");\n m_currencyMap.put(currencyName, nf);\n\n if (currencyName.equalsIgnoreCase(m_defaultCurrencyName))\n {\n m_numberFormat = nf;\n m_defaultCurrencyData = row;\n }\n }",
"protected synchronized void setStream(InputStream s)\n {\n if (stream != null)\n {\n throw new UnsupportedOperationException(\"Cannot set the stream of an open resource\");\n }\n stream = s;\n streamState = StreamStates.OPEN;\n }"
] |
Extracts the column of A and copies it into u while computing the magnitude of the
largest element and returning it.
<pre>
u[ (offsetU+row0+i)*2 ] = A.getReal(row0+i,col)
u[ (offsetU+row0+i)*2 + 1] = A.getImag(row0+i,col)
</pre>
@param A Complex matrix
@param row0 First row in A to be copied
@param row1 Last row in A + 1 to be copied
@param col Column in A
@param u Output array storage
@param offsetU first index in U
@return magnitude of largest element | [
"public static double extractColumnAndMax( ZMatrixRMaj A ,\n int row0 , int row1 ,\n int col , double u[], int offsetU) {\n int indexU = (offsetU+row0)*2;\n\n // find the largest value in this column\n // this is used to normalize the column and mitigate overflow/underflow\n double max = 0;\n\n int indexA = A.getIndex(row0,col);\n double h[] = A.data;\n\n for( int i = row0; i < row1; i++, indexA += A.numCols*2 ) {\n // copy the householder vector to an array to reduce cache misses\n // big improvement on larger matrices and a relatively small performance hit on small matrices.\n double realVal = u[indexU++] = h[indexA];\n double imagVal = u[indexU++] = h[indexA+1];\n\n double magVal = realVal*realVal + imagVal*imagVal;\n if( max < magVal ) {\n max = magVal;\n }\n }\n return Math.sqrt(max);\n }"
] | [
"@Override\n public void onNewState(CrawlerContext context, StateVertex vertex) {\n LOG.debug(\"onNewState\");\n StateBuilder state = outModelCache.addStateIfAbsent(vertex);\n visitedStates.putIfAbsent(state.getName(), vertex);\n\n saveScreenshot(context.getBrowser(), state.getName(), vertex);\n\n outputBuilder.persistDom(state.getName(), context.getBrowser().getUnStrippedDom());\n }",
"private Duration assignmentDuration(Task task, Duration work)\n {\n Duration result = work;\n\n if (result != null)\n {\n if (result.getUnits() == TimeUnit.PERCENT)\n {\n Duration taskWork = task.getWork();\n if (taskWork != null)\n {\n result = Duration.getInstance(taskWork.getDuration() * result.getDuration(), taskWork.getUnits());\n }\n }\n }\n return result;\n }",
"private void setTaskNotes(Task task, byte[] data, ExtendedData taskExtData, FixDeferFix taskVarData)\n {\n String notes = taskExtData.getString(TASK_NOTES);\n if (notes == null && data.length == 366)\n {\n byte[] offsetData = taskVarData.getByteArray(getOffset(data, 362));\n if (offsetData != null && offsetData.length >= 12)\n {\n notes = taskVarData.getString(getOffset(offsetData, 8));\n \n // We do pick up some random stuff with this approach, and \n // we don't know enough about the file format to know when to ignore it\n // so we'll use a heuristic here to ignore anything that\n // doesn't look like RTF.\n if (notes != null && notes.indexOf('{') == -1)\n {\n notes = null;\n }\n }\n }\n \n if (notes != null)\n {\n if (m_reader.getPreserveNoteFormatting() == false)\n {\n notes = RtfHelper.strip(notes);\n }\n\n task.setNotes(notes);\n }\n }",
"public static double huntKennedyCMSAdjustedRate(\n\t\t\tdouble forwardSwaprate,\n\t\t\tdouble volatility,\n\t\t\tdouble swapAnnuity,\n\t\t\tdouble optionMaturity,\n\t\t\tdouble swapMaturity,\n\t\t\tdouble payoffUnit)\n\t{\n\t\tdouble a = 1.0/swapMaturity;\n\t\tdouble b = (payoffUnit / swapAnnuity - a) / forwardSwaprate;\n\t\tdouble convexityAdjustment = Math.exp(volatility*volatility*optionMaturity);\n\n\t\tdouble rateUnadjusted\t= forwardSwaprate;\n\t\tdouble rateAdjusted\t\t= forwardSwaprate * convexityAdjustment;\n\n\t\treturn (a * rateUnadjusted + b * forwardSwaprate * rateAdjusted) * swapAnnuity / payoffUnit;\n\t}",
"private void handleDirectory(final Predicate<String> filter, final File rootDir, final List<String> discoveredFiles)\n {\n try\n {\n new DirectoryWalker<String>()\n {\n private Path startDir;\n\n public void walk() throws IOException\n {\n this.startDir = rootDir.toPath();\n this.walk(rootDir, discoveredFiles);\n }\n\n @Override\n protected void handleFile(File file, int depth, Collection<String> discoveredFiles) throws IOException\n {\n String newPath = startDir.relativize(file.toPath()).toString();\n if (filter.accept(newPath))\n discoveredFiles.add(newPath);\n }\n\n }.walk();\n }\n catch (IOException ex)\n {\n LOG.log(Level.SEVERE, \"Error reading Furnace addon directory\", ex);\n }\n }",
"public static Map<String, StoreDefinition> getSystemStoreDefMap() {\n Map<String, StoreDefinition> sysStoreDefMap = Maps.newHashMap();\n List<StoreDefinition> storesDefs = SystemStoreConstants.getAllSystemStoreDefs();\n for(StoreDefinition def: storesDefs) {\n sysStoreDefMap.put(def.getName(), def);\n }\n return sysStoreDefMap;\n }",
"public AutomatonInstance doClone() {\n\t\tAutomatonInstance clone = new AutomatonInstance(this.automatonEng, this.current, this.instanceId, this.safeGuard);\n\t\tclone.failed = this.failed;\n\t\tclone.transitionCount = this.transitionCount;\n\t\tclone.failCount = this.failCount;\n\t\tclone.iterateCount = this.iterateCount;\n\t\tclone.backtrackCount = this.backtrackCount;\n\t\tclone.trace = new LinkedList<>();\n\t\tfor(StateExploration se:this.trace) {\n\t\t\tclone.trace.add(se.doClone());\n\t\t}\n\t\treturn clone;\n\t}",
"public static String encodeUserInfo(String userInfo, String encoding) throws UnsupportedEncodingException {\n\t\treturn HierarchicalUriComponents.encodeUriComponent(userInfo, encoding, HierarchicalUriComponents.Type.USER_INFO);\n\t}",
"public static double[][] factorReductionUsingCommonsMath(double[][] correlationMatrix, int numberOfFactors) {\n\n\t\t// Extract factors corresponding to the largest eigenvalues\n\t\tdouble[][] factorMatrix = getFactorMatrix(correlationMatrix, numberOfFactors);\n\n\t\t// Renormalize rows\n\t\tfor (int row = 0; row < correlationMatrix.length; row++) {\n\t\t\tdouble sumSquared = 0;\n\t\t\tfor (int factor = 0; factor < numberOfFactors; factor++) {\n\t\t\t\tsumSquared += factorMatrix[row][factor] * factorMatrix[row][factor];\n\t\t\t}\n\t\t\tif(sumSquared != 0) {\n\t\t\t\tfor (int factor = 0; factor < numberOfFactors; factor++) {\n\t\t\t\t\tfactorMatrix[row][factor] = factorMatrix[row][factor] / Math.sqrt(sumSquared);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// This is a rare case: The factor reduction of a completely decorrelated system to 1 factor\n\t\t\t\tfor (int factor = 0; factor < numberOfFactors; factor++) {\n\t\t\t\t\tfactorMatrix[row][factor] = 1.0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Orthogonalized again\n\t\tdouble[][] reducedCorrelationMatrix = (new Array2DRowRealMatrix(factorMatrix).multiply(new Array2DRowRealMatrix(factorMatrix).transpose())).getData();\n\n\t\treturn getFactorMatrix(reducedCorrelationMatrix, numberOfFactors);\n\t}"
] |
Returns the approximate size of slop to help in throttling
@param slopVersioned The versioned slop whose size we want
@return Size in bytes | [
"private int slopSize(Versioned<Slop> slopVersioned) {\n int nBytes = 0;\n Slop slop = slopVersioned.getValue();\n nBytes += slop.getKey().length();\n nBytes += ((VectorClock) slopVersioned.getVersion()).sizeInBytes();\n switch(slop.getOperation()) {\n case PUT: {\n nBytes += slop.getValue().length;\n break;\n }\n case DELETE: {\n break;\n }\n default:\n logger.error(\"Unknown slop operation: \" + slop.getOperation());\n }\n return nBytes;\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 }",
"private List<Row> getRows(String sql) throws SQLException\n {\n allocateConnection();\n\n try\n {\n List<Row> result = new LinkedList<Row>();\n\n m_ps = m_connection.prepareStatement(sql);\n m_rs = m_ps.executeQuery();\n populateMetaData();\n while (m_rs.next())\n {\n result.add(new MpdResultSetRow(m_rs, m_meta));\n }\n\n return (result);\n }\n\n finally\n {\n releaseConnection();\n }\n }",
"public boolean projectExists(String name) throws IllegalArgumentException {\n if (name == null || name.isEmpty()) {\n throw new IllegalArgumentException(\"Project name cannot be empty\");\n }\n return listProjects().stream()\n .map(p -> p.getMetadata().getName())\n .anyMatch(Predicate.isEqual(name));\n }",
"public static void assertValidNode(MetadataStore metadataStore, Integer nodeId) {\n if(!metadataStore.getCluster().hasNodeWithId(nodeId)) {\n throw new InvalidMetadataException(\"NodeId \" + nodeId + \" is not or no longer in this cluster\");\n }\n }",
"public static base_response update(nitro_service client, vpnclientlessaccesspolicy resource) throws Exception {\n\t\tvpnclientlessaccesspolicy updateresource = new vpnclientlessaccesspolicy();\n\t\tupdateresource.name = resource.name;\n\t\tupdateresource.rule = resource.rule;\n\t\tupdateresource.profilename = resource.profilename;\n\t\treturn updateresource.update_resource(client);\n\t}",
"public static String encodePath(String path, String encoding) throws UnsupportedEncodingException {\n\t\treturn HierarchicalUriComponents.encodeUriComponent(path, encoding, HierarchicalUriComponents.Type.PATH);\n\t}",
"private void stopAllServersAndRemoveCamelContext(CamelContext camelContext) {\n log.debug(\"Stopping all servers associated with {}\", camelContext);\n List<SingleBusLocatorRegistrar> registrars = locatorRegistrar.getAllRegistars(camelContext);\n registrars.forEach(registrar -> registrar.stopAllServersAndRemoveCamelContext());\n }",
"public <T> T getState(HttpConnectionInterceptor interceptor, String stateName, Class<T>\n stateType) {\n Map<String, Object> state = interceptorStates.get(interceptor);\n if (state != null) {\n return stateType.cast(state.get(stateName));\n } else {\n return null;\n }\n }",
"private boolean removeKeyForAllLanguages(String key) {\n\n try {\n if (hasDescriptor()) {\n lockDescriptor();\n }\n loadAllRemainingLocalizations();\n lockAllLocalizations(key);\n } catch (CmsException | IOException e) {\n LOG.warn(\"Not able lock all localications for bundle.\", e);\n return false;\n }\n if (!hasDescriptor()) {\n\n for (Entry<Locale, SortedProperties> entry : m_localizations.entrySet()) {\n SortedProperties localization = entry.getValue();\n if (localization.containsKey(key)) {\n localization.remove(key);\n m_changedTranslations.add(entry.getKey());\n }\n }\n }\n return true;\n }"
] |
Processes the template for all indices of the current table.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block"
@doc.param name="unique" optional="true" description="Whether to process the unique indices or not"
values="true,false" | [
"public void forAllIndices(String template, Properties attributes) throws XDocletException\r\n {\r\n boolean processUnique = TypeConversionUtil.stringToBoolean(attributes.getProperty(ATTRIBUTE_UNIQUE), false);\r\n\r\n // first the default index\r\n _curIndexDef = _curTableDef.getIndex(null);\r\n if ((_curIndexDef != null) && (processUnique == _curIndexDef.isUnique()))\r\n {\r\n generate(template);\r\n }\r\n for (Iterator it = _curTableDef.getIndices(); it.hasNext(); )\r\n {\r\n _curIndexDef = (IndexDef)it.next();\r\n if (!_curIndexDef.isDefault() && (processUnique == _curIndexDef.isUnique()))\r\n { \r\n generate(template);\r\n }\r\n }\r\n _curIndexDef = null;\r\n }"
] | [
"public void setKnotType(int n, int type) {\n\t\tknotTypes[n] = (byte)((knotTypes[n] & ~COLOR_MASK) | type);\n\t\trebuildGradient();\n\t}",
"public static final String printBookingType(BookingType value)\n {\n return (Integer.toString(value == null ? BookingType.COMMITTED.getValue() : value.getValue()));\n }",
"public String getString(Integer offset)\n {\n String result = null;\n\n if (offset != null)\n {\n byte[] value = m_map.get(offset);\n if (value != null)\n {\n result = MPPUtility.getString(value, 0);\n }\n }\n\n return (result);\n }",
"public String getCanonicalTypeName(Object object) {\n ensureNotNull(\"object\", object);\n\n for (TypeDetector typeDetector : typeDetectors) {\n if (typeDetector.canHandle(object)) {\n return typeDetector.detectType(object);\n }\n }\n\n throw LOG.unableToDetectCanonicalType(object);\n }",
"boolean hasNoAlternativeWildcardRegistration() {\n return parent == null || PathElement.WILDCARD_VALUE.equals(valueString) || !parent.getChildNames().contains(PathElement.WILDCARD_VALUE);\n }",
"private void readCalendar(Gantt gantt)\n {\n Gantt.Calendar ganttCalendar = gantt.getCalendar();\n m_projectFile.getProjectProperties().setWeekStartDay(ganttCalendar.getWeekStart());\n\n ProjectCalendar calendar = m_projectFile.addCalendar();\n calendar.setName(\"Standard\");\n m_projectFile.setDefaultCalendar(calendar);\n\n String workingDays = ganttCalendar.getWorkDays();\n calendar.setWorkingDay(Day.SUNDAY, workingDays.charAt(0) == '1');\n calendar.setWorkingDay(Day.MONDAY, workingDays.charAt(1) == '1');\n calendar.setWorkingDay(Day.TUESDAY, workingDays.charAt(2) == '1');\n calendar.setWorkingDay(Day.WEDNESDAY, workingDays.charAt(3) == '1');\n calendar.setWorkingDay(Day.THURSDAY, workingDays.charAt(4) == '1');\n calendar.setWorkingDay(Day.FRIDAY, workingDays.charAt(5) == '1');\n calendar.setWorkingDay(Day.SATURDAY, workingDays.charAt(6) == '1');\n\n for (int i = 1; i <= 7; i++)\n {\n Day day = Day.getInstance(i);\n ProjectCalendarHours hours = calendar.addCalendarHours(day);\n if (calendar.isWorkingDay(day))\n {\n hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);\n hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);\n }\n }\n\n for (Gantt.Holidays.Holiday holiday : gantt.getHolidays().getHoliday())\n {\n ProjectCalendarException exception = calendar.addCalendarException(holiday.getDate(), holiday.getDate());\n exception.setName(holiday.getContent());\n }\n }",
"public static dos_stats get(nitro_service service, options option) throws Exception{\n\t\tdos_stats obj = new dos_stats();\n\t\tdos_stats[] response = (dos_stats[])obj.stat_resources(service,option);\n\t\treturn response[0];\n\t}",
"void init( DMatrixSparseCSC A ) {\n this.A = A;\n this.m = A.numRows;\n this.n = A.numCols;\n\n this.next = 0;\n this.head = m;\n this.tail = m + n;\n this.nque = m + 2*n;\n\n if( parent.length < n || leftmost.length < m) {\n parent = new int[n];\n post = new int[n];\n pinv = new int[m+n];\n countsR = new int[n];\n leftmost = new int[m];\n }\n gwork.reshape(m+3*n);\n }",
"public static String getDays(RecurringTask task)\n {\n StringBuilder sb = new StringBuilder();\n for (Day day : Day.values())\n {\n sb.append(task.getWeeklyDay(day) ? \"1\" : \"0\");\n }\n return sb.toString();\n }"
] |
Check from another ConcurrentGroupServerUpdatePolicy whose plans are meant to
execute once this policy's plans are successfully completed.
@return <code>true</code> if the successor can proceed | [
"private boolean canSuccessorProceed() {\n\n if (predecessor != null && !predecessor.canSuccessorProceed()) {\n return false;\n }\n\n synchronized (this) {\n while (responseCount < groups.size()) {\n try {\n wait();\n } catch (InterruptedException e) {\n Thread.currentThread().interrupt();\n return false;\n }\n }\n return !failed;\n }\n }"
] | [
"public static boolean isVector(DMatrixSparseCSC a) {\n return (a.numCols == 1 && a.numRows > 1) || (a.numRows == 1 && a.numCols>1);\n }",
"public ItemRequest<Workspace> findById(String workspace) {\n \n String path = String.format(\"/workspaces/%s\", workspace);\n return new ItemRequest<Workspace>(this, Workspace.class, path, \"GET\");\n }",
"public HashMap<K2, HashMap<K3, V>> get(final K1 firstKey) {\n\t\treturn map.get(firstKey);\n\t}",
"static Project convert(\n String name, com.linecorp.centraldogma.server.storage.project.Project project) {\n return new Project(name);\n }",
"public static <T> Method getMethod(Class<T> c, String name, Class<?>... argTypes) {\n try {\n return c.getMethod(name, argTypes);\n } catch(NoSuchMethodException e) {\n throw new IllegalArgumentException(e);\n }\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 static synchronized FormInputValueHelper getInstance(\n\t\t\tInputSpecification inputSpecification, FormFillMode formFillMode) {\n\t\tif (instance == null)\n\t\t\tinstance = new FormInputValueHelper(inputSpecification,\n\t\t\t\t\tformFillMode);\n\t\treturn instance;\n\t}",
"private PoolingHttpClientConnectionManager createConnectionMgr() {\n PoolingHttpClientConnectionManager connectionMgr;\n\n // prepare SSLContext\n SSLContext sslContext = buildSslContext();\n ConnectionSocketFactory plainsf = PlainConnectionSocketFactory.getSocketFactory();\n // we allow to disable host name verification against CA certificate,\n // notice: in general this is insecure and should be avoided in production,\n // (this type of configuration is useful for development purposes)\n boolean noHostVerification = false;\n LayeredConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(\n sslContext,\n noHostVerification ? NoopHostnameVerifier.INSTANCE : new DefaultHostnameVerifier()\n );\n Registry<ConnectionSocketFactory> r = RegistryBuilder.<ConnectionSocketFactory>create()\n .register(\"http\", plainsf)\n .register(\"https\", sslsf)\n .build();\n connectionMgr = new PoolingHttpClientConnectionManager(r, null, null,\n null, connectionPoolTimeToLive, TimeUnit.SECONDS);\n\n connectionMgr.setMaxTotal(maxConnectionsTotal);\n connectionMgr.setDefaultMaxPerRoute(maxConnectionsPerRoute);\n HttpHost localhost = new HttpHost(\"localhost\", 80);\n connectionMgr.setMaxPerRoute(new HttpRoute(localhost), maxConnectionsPerRoute);\n return connectionMgr;\n }",
"public static void checkEigenvalues() {\n DoubleMatrix A = new DoubleMatrix(new double[][]{\n {3.0, 2.0, 0.0},\n {2.0, 3.0, 2.0},\n {0.0, 2.0, 3.0}\n });\n\n DoubleMatrix E = new DoubleMatrix(3, 1);\n\n NativeBlas.dsyev('N', 'U', 3, A.data, 0, 3, E.data, 0);\n check(\"checking existence of dsyev...\", true);\n }"
] |
Use this API to fetch aaagroup_vpntrafficpolicy_binding resources of given name . | [
"public static aaagroup_vpntrafficpolicy_binding[] get(nitro_service service, String groupname) throws Exception{\n\t\taaagroup_vpntrafficpolicy_binding obj = new aaagroup_vpntrafficpolicy_binding();\n\t\tobj.set_groupname(groupname);\n\t\taaagroup_vpntrafficpolicy_binding response[] = (aaagroup_vpntrafficpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}"
] | [
"private void startRelayWithPortTollerance(HttpServer server, SslListener relay, int tries) throws Exception {\n if (tries >= 5) {\n throw new BindException(\"Unable to bind to several ports, most recently \" + relay.getPort() + \". Giving up\");\n }\n try {\n if (server.isStarted()) {\n relay.start();\n } else {\n throw new RuntimeException(\"Can't start SslRelay: server is not started (perhaps it was just shut down?)\");\n }\n } catch (BindException e) {\n // doh - the port is being used up, let's pick a new port\n LOG.info(\"Unable to bind to port %d, going to try port %d now\", relay.getPort(), relay.getPort() + 1);\n relay.setPort(relay.getPort() + 1);\n startRelayWithPortTollerance(server, relay, tries + 1);\n }\n }",
"public final Object copy(final Object toCopy, PersistenceBroker broker)\r\n\t{\r\n\t\treturn clone(toCopy, IdentityMapFactory.getIdentityMap(), new HashMap());\r\n\t}",
"protected void processCalendarData(ProjectCalendar calendar, Row row)\n {\n int dayIndex = row.getInt(\"CD_DAY_OR_EXCEPTION\");\n if (dayIndex == 0)\n {\n processCalendarException(calendar, row);\n }\n else\n {\n processCalendarHours(calendar, row, dayIndex);\n }\n }",
"private void registerRequirement(RuntimeRequirementRegistration requirement) {\n assert writeLock.isHeldByCurrentThread();\n CapabilityId dependentId = requirement.getDependentId();\n if (!capabilities.containsKey(dependentId)) {\n throw ControllerLogger.MGMT_OP_LOGGER.unknownCapabilityInContext(dependentId.getName(),\n dependentId.getScope().getName());\n }\n Map<CapabilityId, Map<String, RuntimeRequirementRegistration>> requirementMap =\n requirement.isRuntimeOnly() ? runtimeOnlyRequirements : requirements;\n\n Map<String, RuntimeRequirementRegistration> dependents = requirementMap.get(dependentId);\n if (dependents == null) {\n dependents = new HashMap<>();\n requirementMap.put(dependentId, dependents);\n }\n RuntimeRequirementRegistration existing = dependents.get(requirement.getRequiredName());\n if (existing == null) {\n dependents.put(requirement.getRequiredName(), requirement);\n } else {\n existing.addRegistrationPoint(requirement.getOldestRegistrationPoint());\n }\n modified = true;\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 }",
"public static dnsaaaarec[] get(nitro_service service) throws Exception{\n\t\tdnsaaaarec obj = new dnsaaaarec();\n\t\tdnsaaaarec[] response = (dnsaaaarec[])obj.get_resources(service);\n\t\treturn response;\n\t}",
"public BufferedImage getBufferedImage(int width, int height) {\n // using the new approach of Java 2D API\n BufferedImage buf = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);\n Graphics2D g2d = (Graphics2D) buf.getGraphics();\n g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);\n g2d.drawImage(image, 0, 0, width, height, null);\n g2d.dispose();\n return (buf);\n }",
"public static ModelNode determineHostAddress(final ModelControllerClient client) throws IOException, OperationExecutionException {\n final ModelNode op = Operations.createReadAttributeOperation(EMPTY_ADDRESS, \"local-host-name\");\n ModelNode response = client.execute(op);\n if (Operations.isSuccessfulOutcome(response)) {\n return DeploymentOperations.createAddress(\"host\", Operations.readResult(response).asString());\n }\n throw new OperationExecutionException(op, response);\n }",
"public Map<Integer, List<Row>> createTimeEntryMap(List<Row> rows)\n {\n Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>();\n for (Row row : rows)\n {\n Integer workPatternID = row.getInteger(\"TIME_ENTRYID\");\n List<Row> list = map.get(workPatternID);\n if (list == null)\n {\n list = new LinkedList<Row>();\n map.put(workPatternID, list);\n }\n list.add(row);\n }\n return map;\n }"
] |
If there are any observer methods, they must be static or business
methods. | [
"protected void checkObserverMethods() {\n Collection<EnhancedAnnotatedMethod<?, ? super T>> observerMethods = BeanMethods.getObserverMethods(this.getEnhancedAnnotated());\n Collection<EnhancedAnnotatedMethod<?, ? super T>> asyncObserverMethods = BeanMethods.getAsyncObserverMethods(this.getEnhancedAnnotated());\n checkObserverMethods(observerMethods);\n checkObserverMethods(asyncObserverMethods);\n }"
] | [
"private static int getContainerPort(Service service, Annotation... qualifiers) {\n for (Annotation q : qualifiers) {\n if (q instanceof Port) {\n Port port = (Port) q;\n if (port.value() > 0) {\n return port.value();\n }\n }\n }\n\n ServicePort servicePort = findQualifiedServicePort(service, qualifiers);\n if (servicePort != null) {\n return servicePort.getTargetPort().getIntVal();\n }\n return 0;\n }",
"public static String getPrefix(String column) {\n\t\treturn column.contains( \".\" ) ? DOT_SEPARATOR_PATTERN.split( column )[0] : null;\n\t}",
"public Set<Tag> getAncestorTags(Tag tag)\n {\n Set<Tag> ancestors = new HashSet<>();\n getAncestorTags(tag, ancestors);\n return ancestors;\n }",
"public static boolean isDiagonalPositive( DMatrixRMaj a ) {\n for( int i = 0; i < a.numRows; i++ ) {\n if( !(a.get(i,i) >= 0) )\n return false;\n }\n return true;\n }",
"public static long decodeLong(byte[] ba, int offset) {\n return ((((long) ba[offset + 0] << 56) + ((long) (ba[offset + 1] & 255) << 48)\n + ((long) (ba[offset + 2] & 255) << 40) + ((long) (ba[offset + 3] & 255) << 32)\n + ((long) (ba[offset + 4] & 255) << 24) + ((ba[offset + 5] & 255) << 16)\n + ((ba[offset + 6] & 255) << 8) + ((ba[offset + 7] & 255) << 0)));\n }",
"private void saveLocalization() {\n\n SortedProperties localization = new SortedProperties();\n for (Object itemId : m_container.getItemIds()) {\n Item item = m_container.getItem(itemId);\n String key = item.getItemProperty(TableProperty.KEY).getValue().toString();\n String value = item.getItemProperty(TableProperty.TRANSLATION).getValue().toString();\n if (!(key.isEmpty() || value.isEmpty())) {\n localization.put(key, value);\n }\n }\n m_keyset.updateKeySet(m_localizations.get(m_locale).keySet(), localization.keySet());\n m_localizations.put(m_locale, localization);\n\n }",
"public static <T> T[] concat(T firstElement, T... array) {\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tT[] result = (T[]) Array.newInstance( firstElement.getClass(), 1 + array.length );\n\t\tresult[0] = firstElement;\n\t\tSystem.arraycopy( array, 0, result, 1, array.length );\n\n\t\treturn result;\n\t}",
"public static base_responses renumber(nitro_service client, nspbr6 resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tnspbr6 renumberresources[] = new nspbr6[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\trenumberresources[i] = new nspbr6();\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, renumberresources,\"renumber\");\n\t\t}\n\t\treturn result;\n\t}",
"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 }"
] |
Add a new server group
@param groupName name of the group
@param profileId ID of associated profile
@return id of server group
@throws Exception | [
"public int addServerGroup(String groupName, int profileId) throws Exception {\n int groupId = -1;\n PreparedStatement statement = null;\n ResultSet results = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n statement = sqlConnection.prepareStatement(\"INSERT INTO \" + Constants.DB_TABLE_SERVER_GROUPS\n + \"(\" + Constants.GENERIC_NAME + \",\" +\n Constants.GENERIC_PROFILE_ID + \")\"\n + \" VALUES (?, ?);\", PreparedStatement.RETURN_GENERATED_KEYS);\n statement.setString(1, groupName);\n statement.setInt(2, profileId);\n statement.executeUpdate();\n\n results = statement.getGeneratedKeys();\n\n if (results.next()) {\n groupId = results.getInt(1);\n } else {\n // something went wrong\n throw new Exception(\"Could not add group\");\n }\n } catch (SQLException 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 groupId;\n }"
] | [
"public static route6[] get(nitro_service service, route6_args args) throws Exception{\n\t\troute6 obj = new route6();\n\t\toptions option = new options();\n\t\toption.set_args(nitro_util.object_to_string_withoutquotes(args));\n\t\troute6[] response = (route6[])obj.get_resources(service, option);\n\t\treturn response;\n\t}",
"public static appfwprofile_stats get(nitro_service service, String name) throws Exception{\n\t\tappfwprofile_stats obj = new appfwprofile_stats();\n\t\tobj.set_name(name);\n\t\tappfwprofile_stats response = (appfwprofile_stats) obj.stat_resource(service);\n\t\treturn response;\n\t}",
"public static DMatrixRMaj convert(DMatrixRBlock src , DMatrixRMaj dst )\n {\n return ConvertDMatrixStruct.convert(src,dst);\n }",
"public static int cudnnSoftmaxForward(\n cudnnHandle handle, \n int algo, \n int mode, \n Pointer alpha, \n cudnnTensorDescriptor xDesc, \n Pointer x, \n Pointer beta, \n cudnnTensorDescriptor yDesc, \n Pointer y)\n {\n return checkResult(cudnnSoftmaxForwardNative(handle, algo, mode, alpha, xDesc, x, beta, yDesc, y));\n }",
"public GVRMesh findMesh(GVRSceneObject model)\n {\n class MeshFinder implements GVRSceneObject.ComponentVisitor\n {\n private GVRMesh meshFound = null;\n public GVRMesh getMesh() { return meshFound; }\n public boolean visit(GVRComponent comp)\n {\n GVRRenderData rdata = (GVRRenderData) comp;\n meshFound = rdata.getMesh();\n return (meshFound == null);\n }\n };\n MeshFinder findMesh = new MeshFinder();\n model.forAllComponents(findMesh, GVRRenderData.getComponentType());\n return findMesh.getMesh();\n }",
"private boolean removeRelation(List<Relation> relationList, Task targetTask, RelationType type, Duration lag)\n {\n boolean matchFound = false;\n for (Relation relation : relationList)\n {\n if (relation.getTargetTask() == targetTask)\n {\n if (relation.getType() == type && relation.getLag().compareTo(lag) == 0)\n {\n matchFound = relationList.remove(relation);\n break;\n }\n }\n }\n return matchFound;\n }",
"@Override\n public List<Assignment> assign(Collection<String> suiteNames, int slaves, long seed) {\n // Read hints first.\n final Map<String,List<Long>> hints = ExecutionTimesReport.mergeHints(resources, suiteNames);\n\n // Preprocess and sort costs. Take the median for each suite's measurements as the \n // weight to avoid extreme measurements from screwing up the average.\n final List<SuiteHint> costs = new ArrayList<>();\n for (String suiteName : suiteNames) {\n final List<Long> suiteHint = hints.get(suiteName);\n if (suiteHint != null) {\n // Take the median for each suite's measurements as the weight\n // to avoid extreme measurements from screwing up the average.\n Collections.sort(suiteHint);\n final Long median = suiteHint.get(suiteHint.size() / 2);\n costs.add(new SuiteHint(suiteName, median));\n }\n }\n Collections.sort(costs, SuiteHint.DESCENDING_BY_WEIGHT);\n\n // Apply the assignment heuristic.\n final PriorityQueue<SlaveLoad> pq = new PriorityQueue<SlaveLoad>(\n slaves, SlaveLoad.ASCENDING_BY_ESTIMATED_FINISH);\n for (int i = 0; i < slaves; i++) {\n pq.add(new SlaveLoad(i));\n }\n\n final List<Assignment> assignments = new ArrayList<>();\n for (SuiteHint hint : costs) {\n SlaveLoad slave = pq.remove();\n slave.estimatedFinish += hint.cost;\n pq.add(slave);\n\n owner.log(\"Expected execution time for \" + hint.suiteName + \": \" +\n Duration.toHumanDuration(hint.cost),\n Project.MSG_DEBUG);\n\n assignments.add(new Assignment(hint.suiteName, slave.id, (int) hint.cost));\n }\n\n // Dump estimated execution times.\n TreeMap<Integer, SlaveLoad> ordered = new TreeMap<Integer, SlaveLoad>();\n while (!pq.isEmpty()) {\n SlaveLoad slave = pq.remove();\n ordered.put(slave.id, slave);\n }\n for (Integer id : ordered.keySet()) {\n final SlaveLoad slave = ordered.get(id);\n owner.log(String.format(Locale.ROOT, \n \"Expected execution time on JVM J%d: %8.2fs\",\n slave.id,\n slave.estimatedFinish / 1000.0f), \n verbose ? Project.MSG_INFO : Project.MSG_DEBUG);\n }\n\n return assignments;\n }",
"protected int readInt(InputStream is) throws IOException\n {\n byte[] data = new byte[4];\n if (is.read(data) != data.length)\n {\n throw new EOFException();\n }\n\n return (MPPUtility.getInt(data, 0));\n }",
"public static boolean unzipFileOrFolder(File zipFile, String unzippedFolder){\n\t\tInputStream is;\n\t\tArchiveInputStream in = null;\n\t\tOutputStream out = null;\n\t\t\n\t\tif(!zipFile.isFile()){\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif(unzippedFolder == null){\n\t\t\tunzippedFolder = FilenameUtils.removeExtension(zipFile.getAbsolutePath());\n\t\t}\n\t\ttry {\n\t\t\tis = new FileInputStream(zipFile);\n\t\t\tnew File(unzippedFolder).mkdir();\n\t\t\t\n\t\t\tin = new ArchiveStreamFactory().createArchiveInputStream(ArchiveStreamFactory.ZIP, is);\n\t\t\t\n\t\t\tZipArchiveEntry entry = (ZipArchiveEntry)in.getNextEntry();\n\t\t\twhile(entry != null){\n\t\t\t\tif(entry.isDirectory()){\n\t\t\t\t\tnew File(unzippedFolder,entry.getName()).mkdir();\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tout = new FileOutputStream(new File(unzippedFolder, entry.getName()));\n\t\t\t\t\tIOUtils.copy(in, out);\n\t\t\t\t\tout.close();\n\t\t\t\t\tout = null;\n\t\t\t\t}\n\t\t\t\tentry = (ZipArchiveEntry)in.getNextEntry();\n\t\t\t}\t\n\t\t} catch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t\treturn false;\n\t\t} catch (ArchiveException e) {\n\t\t\te.printStackTrace();\n\t\t\treturn false;\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t\treturn false;\n\t\t}\n\t\tfinally{\n\t\t\tif(out != null){\n\t\t\t\ttry {\n\t\t\t\t\tout.close();\n\t\t\t\t} catch (IOException e) {}\n\t\t\t}\n\t\t\tif(in != null){\n\t\t\t\ttry {\n\t\t\t\t\tin.close();\n\t\t\t\t} catch (IOException e) {}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.