query
stringlengths
7
3.3k
positive
sequencelengths
1
1
negative
sequencelengths
9
9
Sets object for statement at specific index, adhering to platform- and null-rules. @param stmt the statement @param index the current parameter index @param value the value to set @param sqlType the JDBC SQL-type of the value @throws SQLException on platform error
[ "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 }" ]
[ "private Profile getProfileFromResultSet(ResultSet result) throws Exception {\n Profile profile = new Profile();\n profile.setId(result.getInt(Constants.GENERIC_ID));\n Clob clobProfileName = result.getClob(Constants.PROFILE_PROFILE_NAME);\n String profileName = clobProfileName.getSubString(1, (int) clobProfileName.length());\n profile.setName(profileName);\n return profile;\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 void checkId(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 id = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_ID);\r\n\r\n if ((id != null) && (id.length() > 0))\r\n {\r\n try\r\n {\r\n Integer.parseInt(id);\r\n }\r\n catch (NumberFormatException ex)\r\n {\r\n throw new ConstraintException(\"The id attribute of field \"+fieldDef.getName()+\" in class \"+fieldDef.getOwner().getName()+\" is not a valid number\");\r\n }\r\n }\r\n }", "public Jar setMapAttribute(String name, Map<String, ?> values) {\n return setAttribute(name, join(values));\n }", "public void close() {\n boolean isPreviouslyClosed = isClosed.getAndSet(true);\n if (isPreviouslyClosed) {\n return;\n }\n\n AdminClient client;\n while ((client = clientCache.poll()) != null) {\n client.close();\n }\n }", "public static Optional<Variable> freshBuilder(SourceBuilder code, Datatype datatype) {\n if (!datatype.getBuilderFactory().isPresent()) {\n return Optional.empty();\n }\n return Optional.of(code.scope().computeIfAbsent(Declaration.FRESH_BUILDER, () -> {\n Variable defaults = new Variable(\"defaults\");\n code.addLine(\"%s %s = %s;\",\n datatype.getGeneratedBuilder(),\n defaults,\n datatype.getBuilderFactory().get()\n .newBuilder(datatype.getBuilder(), TypeInference.INFERRED_TYPES));\n return defaults;\n }));\n }", "public static void setFaceNames(String[] nameArray)\n {\n if (nameArray.length != 6)\n {\n throw new IllegalArgumentException(\"nameArray length is not 6.\");\n }\n for (int i = 0; i < 6; i++)\n {\n faceIndexMap.put(nameArray[i], i);\n }\n }", "protected void addFacetPart(CmsSolrQuery query) {\n\n StringBuffer value = new StringBuffer();\n value.append(\"{!key=\").append(m_config.getName());\n addFacetOptions(value);\n if (m_config.getIgnoreAllFacetFilters()\n || (!m_state.getCheckedEntries().isEmpty() && !m_config.getIsAndFacet())) {\n value.append(\" ex=\").append(m_config.getIgnoreTags());\n }\n value.append(\"}\");\n value.append(m_config.getRange());\n query.add(\"facet.range\", value.toString());\n }", "public static <T> T assertNotNull(T value, String message) {\n if (value == null)\n throw new IllegalStateException(message);\n return value;\n }" ]
Parses operations where the input comes from variables to its left only. Hard coded to only look for transpose for now @param tokens List of all the tokens @param sequence List of operation sequence
[ "protected void parseOperationsL(TokenList tokens, Sequence sequence) {\n\n if( tokens.size == 0 )\n return;\n\n TokenList.Token token = tokens.first;\n\n if( token.getType() != Type.VARIABLE )\n throw new ParseError(\"The first token in an equation needs to be a variable and not \"+token);\n\n while( token != null ) {\n if( token.getType() == Type.FUNCTION ) {\n throw new ParseError(\"Function encountered with no parentheses\");\n } else if( token.getType() == Type.SYMBOL && token.getSymbol() == Symbol.TRANSPOSE) {\n if( token.previous.getType() == Type.VARIABLE )\n token = insertTranspose(token.previous,tokens,sequence);\n else\n throw new ParseError(\"Expected variable before transpose\");\n }\n token = token.next;\n }\n }" ]
[ "private void map(Resource root) {\n\n for (Resource.ResourceEntry serverGroup : root.getChildren(SERVER_GROUP)) {\n String serverGroupName = serverGroup.getName();\n ModelNode serverGroupModel = serverGroup.getModel();\n String profile = serverGroupModel.require(PROFILE).asString();\n store(serverGroupName, profile, profilesToGroups);\n String socketBindingGroup = serverGroupModel.require(SOCKET_BINDING_GROUP).asString();\n store(serverGroupName, socketBindingGroup, socketsToGroups);\n\n for (Resource.ResourceEntry deployment : serverGroup.getChildren(DEPLOYMENT)) {\n store(serverGroupName, deployment.getName(), deploymentsToGroups);\n }\n\n for (Resource.ResourceEntry overlay : serverGroup.getChildren(DEPLOYMENT_OVERLAY)) {\n store(serverGroupName, overlay.getName(), overlaysToGroups);\n }\n\n }\n\n for (Resource.ResourceEntry host : root.getChildren(HOST)) {\n String hostName = host.getPathElement().getValue();\n for (Resource.ResourceEntry serverConfig : host.getChildren(SERVER_CONFIG)) {\n ModelNode serverConfigModel = serverConfig.getModel();\n String serverGroupName = serverConfigModel.require(GROUP).asString();\n store(serverGroupName, hostName, hostsToGroups);\n }\n }\n }", "public final static int readMdLink(final StringBuilder out, final String in, final int start)\n {\n int pos = start;\n int counter = 1;\n while (pos < in.length())\n {\n final char ch = in.charAt(pos);\n if (ch == '\\\\' && pos + 1 < in.length())\n {\n pos = escape(out, in.charAt(pos + 1), pos);\n }\n else\n {\n boolean endReached = false;\n switch (ch)\n {\n case '(':\n counter++;\n break;\n case ' ':\n if (counter == 1)\n {\n endReached = true;\n }\n break;\n case ')':\n counter--;\n if (counter == 0)\n {\n endReached = true;\n }\n break;\n }\n if (endReached)\n {\n break;\n }\n out.append(ch);\n }\n pos++;\n }\n\n return (pos == in.length()) ? -1 : pos;\n }", "private ProjectFile read() throws Exception\n {\n m_project = new ProjectFile();\n m_eventManager = m_project.getEventManager();\n\n ProjectConfig config = m_project.getProjectConfig();\n config.setAutoCalendarUniqueID(false);\n config.setAutoTaskUniqueID(false);\n config.setAutoResourceUniqueID(false);\n\n m_project.getProjectProperties().setFileApplication(\"Merlin\");\n m_project.getProjectProperties().setFileType(\"SQLITE\");\n\n m_eventManager.addProjectListeners(m_projectListeners);\n\n populateEntityMap();\n processProject();\n processCalendars();\n processResources();\n processTasks();\n processAssignments();\n processDependencies();\n\n return m_project;\n }", "public static void calculateLegendInformation(List<? extends BaseModel> _Models, float _StartX, float _EndX, Paint _Paint) {\n float textMargin = Utils.dpToPx(10.f);\n float lastX = _StartX;\n\n // calculate the legend label positions and check if there is enough space to display the label,\n // if not the label will not be shown\n for (BaseModel model : _Models) {\n if (!model.isIgnore()) {\n Rect textBounds = new Rect();\n RectF legendBounds = model.getLegendBounds();\n\n _Paint.getTextBounds(model.getLegendLabel(), 0, model.getLegendLabel().length(), textBounds);\n model.setTextBounds(textBounds);\n\n float centerX = legendBounds.centerX();\n float centeredTextPos = centerX - (textBounds.width() / 2);\n float textStartPos = centeredTextPos - textMargin;\n\n // check if the text is too big to fit on the screen\n if (centeredTextPos + textBounds.width() > _EndX - textMargin) {\n model.setShowLabel(false);\n } else {\n // check if the current legend label overrides the label before\n // if the label overrides the label before, the current label will not be shown.\n // If not the label will be shown and the label position is calculated\n if (textStartPos < lastX) {\n if (lastX + textMargin < legendBounds.left) {\n model.setLegendLabelPosition((int) (lastX + textMargin));\n model.setShowLabel(true);\n lastX = lastX + textMargin + textBounds.width();\n } else {\n model.setShowLabel(false);\n }\n } else {\n model.setShowLabel(true);\n model.setLegendLabelPosition((int) centeredTextPos);\n lastX = centerX + (textBounds.width() / 2);\n }\n }\n }\n }\n\n }", "private static JSONArray parseChildShapesRecursive(ArrayList<Shape> childShapes) throws JSONException {\n if (childShapes != null) {\n JSONArray childShapesArray = new JSONArray();\n\n for (Shape childShape : childShapes) {\n JSONObject childShapeObject = new JSONObject();\n\n childShapeObject.put(\"resourceId\",\n childShape.getResourceId().toString());\n childShapeObject.put(\"properties\",\n parseProperties(childShape.getProperties()));\n childShapeObject.put(\"stencil\",\n parseStencil(childShape.getStencilId()));\n childShapeObject.put(\"childShapes\",\n parseChildShapesRecursive(childShape.getChildShapes()));\n childShapeObject.put(\"outgoing\",\n parseOutgoings(childShape.getOutgoings()));\n childShapeObject.put(\"bounds\",\n parseBounds(childShape.getBounds()));\n childShapeObject.put(\"dockers\",\n parseDockers(childShape.getDockers()));\n\n if (childShape.getTarget() != null) {\n childShapeObject.put(\"target\",\n parseTarget(childShape.getTarget()));\n }\n\n childShapesArray.put(childShapeObject);\n }\n\n return childShapesArray;\n }\n\n return new JSONArray();\n }", "public void ifHasMemberWithTag(String template, Properties attributes) throws XDocletException\r\n {\r\n ArrayList allMemberNames = new ArrayList();\r\n HashMap allMembers = new HashMap();\r\n boolean hasTag = false;\r\n\r\n addMembers(allMemberNames, allMembers, getCurrentClass(), null, null, null);\r\n for (Iterator it = allMemberNames.iterator(); it.hasNext(); ) {\r\n XMember member = (XMember) allMembers.get(it.next());\r\n\r\n if (member instanceof XField) {\r\n setCurrentField((XField)member);\r\n if (hasTag(attributes, FOR_FIELD)) {\r\n hasTag = true;\r\n }\r\n setCurrentField(null);\r\n }\r\n else if (member instanceof XMethod) {\r\n setCurrentMethod((XMethod)member);\r\n if (hasTag(attributes, FOR_METHOD)) {\r\n hasTag = true;\r\n }\r\n setCurrentMethod(null);\r\n }\r\n if (hasTag) {\r\n generate(template);\r\n break;\r\n }\r\n }\r\n }", "public static authenticationvserver_authenticationcertpolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tauthenticationvserver_authenticationcertpolicy_binding obj = new authenticationvserver_authenticationcertpolicy_binding();\n\t\tobj.set_name(name);\n\t\tauthenticationvserver_authenticationcertpolicy_binding response[] = (authenticationvserver_authenticationcertpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "private static void close(Closeable closeable) {\n\t\tif (closeable != null) {\n\t\t\ttry {\n\t\t\t\tcloseable.close();\n\t\t\t} catch (IOException ignored) {\n\t\t\t\tlogger.error(\"Failed to close output stream: \"\n\t\t\t\t\t\t+ ignored.getMessage());\n\t\t\t}\n\t\t}\n\t}", "public static IndexedContainer getPrincipalContainer(\n CmsObject cms,\n List<? extends I_CmsPrincipal> list,\n String captionID,\n String descID,\n String iconID,\n String ouID,\n String icon,\n List<FontIcon> iconList) {\n\n IndexedContainer res = new IndexedContainer();\n\n res.addContainerProperty(captionID, String.class, \"\");\n res.addContainerProperty(ouID, String.class, \"\");\n res.addContainerProperty(iconID, FontIcon.class, new CmsCssIcon(icon));\n if (descID != null) {\n res.addContainerProperty(descID, String.class, \"\");\n }\n\n for (I_CmsPrincipal group : list) {\n\n Item item = res.addItem(group);\n item.getItemProperty(captionID).setValue(group.getSimpleName());\n item.getItemProperty(ouID).setValue(group.getOuFqn());\n if (descID != null) {\n item.getItemProperty(descID).setValue(group.getDescription(A_CmsUI.get().getLocale()));\n }\n }\n\n for (int i = 0; i < iconList.size(); i++) {\n res.getItem(res.getIdByIndex(i)).getItemProperty(iconID).setValue(iconList.get(i));\n }\n\n return res;\n }" ]
URLDecode a string @param s @return
[ "public String urlDecode(String s) {\n if (s == null || s.isEmpty()) {\n return s;\n }\n return URL.decodeQueryString(s);\n }" ]
[ "@Override\n public void process(TestCaseResult context) {\n context.getParameters().add(new Parameter()\n .withName(getName())\n .withValue(getValue())\n .withKind(ParameterKind.valueOf(getKind()))\n );\n }", "private void checkExistingTracks() {\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 checkIfSignatureReady(entry.getKey().player);\n }\n }\n }\n });\n }", "public void clear() {\n valueBoxBase.setText(\"\");\n clearStatusText();\n\n if (getPlaceholder() == null || getPlaceholder().isEmpty()) {\n label.removeStyleName(CssName.ACTIVE);\n }\n }", "public PhotoList<Photo> getRecent(Set<String> extras, int perPage, int page) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_RECENT);\r\n\r\n if (extras != null && !extras.isEmpty()) {\r\n parameters.put(Extras.KEY_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\r\n Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n Element photosElement = response.getPayload();\r\n PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement);\r\n return photos;\r\n }", "public Version putVersionedWithCustomTimeout(CompositeVoldemortRequest<K, V> requestWrapper)\n throws ObsoleteVersionException {\n validateTimeout(requestWrapper.getRoutingTimeoutInMs());\n for(int attempts = 0; attempts < this.metadataRefreshAttempts; attempts++) {\n try {\n String keyHexString = \"\";\n long startTimeInMs = System.currentTimeMillis();\n if(logger.isDebugEnabled()) {\n ByteArray key = (ByteArray) requestWrapper.getKey();\n keyHexString = RestUtils.getKeyHexString(key);\n debugLogStart(\"PUT_VERSION\",\n requestWrapper.getRequestOriginTimeInMs(),\n startTimeInMs,\n keyHexString);\n }\n store.put(requestWrapper);\n if(logger.isDebugEnabled()) {\n debugLogEnd(\"PUT_VERSION\",\n requestWrapper.getRequestOriginTimeInMs(),\n startTimeInMs,\n System.currentTimeMillis(),\n keyHexString,\n 0);\n }\n return requestWrapper.getValue().getVersion();\n } catch(InvalidMetadataException e) {\n logger.info(\"Received invalid metadata exception during put [ \" + e.getMessage()\n + \" ] on store '\" + storeName + \"'. Rebootstrapping\");\n bootStrap();\n }\n }\n throw new VoldemortException(this.metadataRefreshAttempts\n + \" metadata refresh attempts failed.\");\n }", "private void initManagementPart() {\n\n m_manageExceptionsButton.setText(Messages.get().key(Messages.GUI_SERIALDATE_BUTTON_MANAGE_EXCEPTIONS_0));\n m_manageExceptionsButton.getElement().getStyle().setFloat(Style.Float.RIGHT);\n }", "public static void setBackgroundDrawable(View view, Drawable drawable) {\n if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {\n view.setBackgroundDrawable(drawable);\n } else {\n view.setBackground(drawable);\n }\n }", "public static List<String> getChildrenParentMayNotExist(ZkClient zkClient, String path) {\n try {\n return zkClient.getChildren(path);\n } catch (ZkNoNodeException e) {\n return null;\n }\n }", "public List<Message> requestTrackMenuFrom(final SlotReference slotReference, final int sortOrder)\n throws Exception {\n\n ConnectionManager.ClientTask<List<Message>> task = new ConnectionManager.ClientTask<List<Message>>() {\n @Override\n public List<Message> useClient(Client client) throws Exception {\n return MetadataFinder.getInstance().getFullTrackList(slotReference.slot, client, sortOrder);\n }\n };\n\n return ConnectionManager.getInstance().invokeWithClientSession(slotReference.player, task, \"requesting track menu\");\n }" ]
Builder method for specifying the name of an app. @param name The name to give an app. @return A copy of the {@link App}
[ "public App named(String name) {\n App newApp = copy();\n newApp.name = name;\n return newApp;\n }" ]
[ "public static base_response unset(nitro_service client, systemuser resource, String[] args) throws Exception{\n\t\tsystemuser unsetresource = new systemuser();\n\t\tunsetresource.username = resource.username;\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "protected void removeWatermark(URLTemplate itemUrl) {\n URL watermarkUrl = itemUrl.build(this.getAPI().getBaseURL(), this.getID());\n URL url = WATERMARK_URL_TEMPLATE.build(watermarkUrl.toString());\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"DELETE\");\n BoxAPIResponse response = request.send();\n response.disconnect();\n }", "public Future<HazeltaskTask<GROUP>> addPendingTaskAsync(HazeltaskTask<GROUP> task) {\n return pendingTask.putAsync(task.getId(), task);\n }", "protected void boot(final BootContext context) throws ConfigurationPersistenceException {\n List<ModelNode> bootOps = configurationPersister.load();\n ModelNode op = registerModelControllerServiceInitializationBootStep(context);\n if (op != null) {\n bootOps.add(op);\n }\n boot(bootOps, false);\n finishBoot();\n }", "public static CurrencySymbolPosition getSymbolPosition(int value)\n {\n CurrencySymbolPosition result;\n\n switch (value)\n {\n case 1:\n {\n result = CurrencySymbolPosition.AFTER;\n break;\n }\n\n case 2:\n {\n result = CurrencySymbolPosition.BEFORE_WITH_SPACE;\n break;\n }\n\n case 3:\n {\n result = CurrencySymbolPosition.AFTER_WITH_SPACE;\n break;\n }\n\n case 0:\n default:\n {\n result = CurrencySymbolPosition.BEFORE;\n break;\n }\n }\n\n return (result);\n }", "private void checkModifications(ClassDescriptorDef classDef, String checkLevel) throws ConstraintException\r\n {\r\n if (CHECKLEVEL_NONE.equals(checkLevel))\r\n {\r\n return;\r\n }\r\n\r\n HashMap features = new HashMap();\r\n FeatureDescriptorDef def;\r\n\r\n for (Iterator it = classDef.getFields(); it.hasNext();)\r\n {\r\n def = (FeatureDescriptorDef)it.next();\r\n features.put(def.getName(), def);\r\n }\r\n for (Iterator it = classDef.getReferences(); it.hasNext();)\r\n {\r\n def = (FeatureDescriptorDef)it.next();\r\n features.put(def.getName(), def);\r\n }\r\n for (Iterator it = classDef.getCollections(); it.hasNext();)\r\n {\r\n def = (FeatureDescriptorDef)it.next();\r\n features.put(def.getName(), def);\r\n }\r\n\r\n // now checking the modifications\r\n Properties mods;\r\n String modName;\r\n String propName;\r\n\r\n for (Iterator it = classDef.getModificationNames(); it.hasNext();)\r\n {\r\n modName = (String)it.next();\r\n if (!features.containsKey(modName))\r\n {\r\n throw new ConstraintException(\"Class \"+classDef.getName()+\" contains a modification for an unknown feature \"+modName);\r\n }\r\n def = (FeatureDescriptorDef)features.get(modName);\r\n if (def.getOriginal() == null)\r\n {\r\n throw new ConstraintException(\"Class \"+classDef.getName()+\" contains a modification for a feature \"+modName+\" that is not inherited but defined in the same class\");\r\n }\r\n // checking modification\r\n mods = classDef.getModification(modName);\r\n for (Iterator propIt = mods.keySet().iterator(); propIt.hasNext();)\r\n {\r\n propName = (String)propIt.next();\r\n if (!PropertyHelper.isPropertyAllowed(def.getClass(), propName))\r\n {\r\n throw new ConstraintException(\"The modification of attribute \"+propName+\" in class \"+classDef.getName()+\" is not applicable to the feature \"+modName);\r\n }\r\n }\r\n }\r\n }", "protected int getCenterChild(CacheDataSet cache) {\n if (cache.count() == 0)\n return -1;\n\n int id = cache.getId(0);\n switch (getGravityInternal()) {\n case TOP:\n case LEFT:\n case FRONT:\n case FILL:\n break;\n case BOTTOM:\n case RIGHT:\n case BACK:\n id = cache.getId(cache.count() - 1);\n break;\n case CENTER:\n int i = cache.count() / 2;\n while (i < cache.count() && i >= 0) {\n id = cache.getId(i);\n if (cache.getStartDataOffset(id) <= 0) {\n if (cache.getEndDataOffset(id) >= 0) {\n break;\n } else {\n i++;\n }\n } else {\n i--;\n }\n }\n break;\n default:\n break;\n }\n\n Log.d(LAYOUT, TAG, \"getCenterChild = %d \", id);\n return id;\n }", "public void generateMapFile(File jarFile, String mapFileName, boolean mapClassMethods) throws XMLStreamException, IOException, ClassNotFoundException, IntrospectionException\n {\n m_responseList = new LinkedList<String>();\n writeMapFile(mapFileName, jarFile, mapClassMethods);\n }", "protected synchronized void streamingSlopPut(ByteArray key,\n Versioned<byte[]> value,\n String storeName,\n int failedNodeId) throws IOException {\n\n Slop slop = new Slop(storeName,\n Slop.Operation.PUT,\n key,\n value.getValue(),\n null,\n failedNodeId,\n new Date());\n\n ByteArray slopKey = slop.makeKey();\n Versioned<byte[]> slopValue = new Versioned<byte[]>(slopSerializer.toBytes(slop),\n value.getVersion());\n\n Node failedNode = adminClient.getAdminClientCluster().getNodeById(failedNodeId);\n HandoffToAnyStrategy slopRoutingStrategy = new HandoffToAnyStrategy(adminClient.getAdminClientCluster(),\n true,\n failedNode.getZoneId());\n // node Id which will receive the slop\n int slopDestination = slopRoutingStrategy.routeHint(failedNode).get(0).getId();\n\n VAdminProto.PartitionEntry partitionEntry = VAdminProto.PartitionEntry.newBuilder()\n .setKey(ProtoUtils.encodeBytes(slopKey))\n .setVersioned(ProtoUtils.encodeVersioned(slopValue))\n .build();\n\n VAdminProto.UpdatePartitionEntriesRequest.Builder updateRequest = VAdminProto.UpdatePartitionEntriesRequest.newBuilder()\n .setStore(SLOP_STORE)\n .setPartitionEntry(partitionEntry);\n\n DataOutputStream outputStream = nodeIdStoreToOutputStreamRequest.get(new Pair<String, Integer>(SLOP_STORE,\n slopDestination));\n\n if(nodeIdStoreInitialized.get(new Pair<String, Integer>(SLOP_STORE, slopDestination))) {\n ProtoUtils.writeMessage(outputStream, updateRequest.build());\n } else {\n ProtoUtils.writeMessage(outputStream,\n VAdminProto.VoldemortAdminRequest.newBuilder()\n .setType(VAdminProto.AdminRequestType.UPDATE_PARTITION_ENTRIES)\n .setUpdatePartitionEntries(updateRequest)\n .build());\n outputStream.flush();\n nodeIdStoreInitialized.put(new Pair<String, Integer>(SLOP_STORE, slopDestination), true);\n\n }\n\n throttler.maybeThrottle(1);\n\n }" ]
Set the given column name to the given value. @param name The column name to set. @param value the value to set. @return {@code this} @throws IllegalArgumentException if a column name does not exist in the table.
[ "public InsertIntoTable set(String name, Object value) {\n builder.set(name, value);\n return this;\n }" ]
[ "private Month readOptionalMonth(JSONValue val) {\n\n String str = readOptionalString(val);\n if (null != str) {\n try {\n return Month.valueOf(str);\n } catch (@SuppressWarnings(\"unused\") IllegalArgumentException e) {\n // Do nothing -return the default value\n }\n }\n return null;\n }", "public static Enum castToEnum(Object object, Class<? extends Enum> type) {\n if (object==null) return null;\n if (type.isInstance(object)) return (Enum) object;\n if (object instanceof String || object instanceof GString) {\n return Enum.valueOf(type, object.toString());\n }\n throw new GroovyCastException(object, type);\n }", "public static final Date getTimestampFromTenths(byte[] data, int offset)\n {\n long ms = ((long) getInt(data, offset)) * 6000;\n return (DateHelper.getTimestampFromLong(EPOCH + ms));\n }", "public static responderpolicy[] get(nitro_service service) throws Exception{\n\t\tresponderpolicy obj = new responderpolicy();\n\t\tresponderpolicy[] response = (responderpolicy[])obj.get_resources(service);\n\t\treturn response;\n\t}", "public static base_response unset(nitro_service client, clusterinstance resource, String[] args) throws Exception{\n\t\tclusterinstance unsetresource = new clusterinstance();\n\t\tunsetresource.clid = resource.clid;\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "public static String stripHtml(String html) {\n\n if (html == null) {\n return null;\n }\n Element el = DOM.createDiv();\n el.setInnerHTML(html);\n return el.getInnerText();\n }", "public <T extends Widget & Checkable> boolean addOnCheckChangedListener\n (OnCheckChangedListener listener) {\n final boolean added;\n synchronized (mListeners) {\n added = mListeners.add(listener);\n }\n if (added) {\n List<T> c = getCheckableChildren();\n for (int i = 0; i < c.size(); ++i) {\n listener.onCheckChanged(this, c.get(i), i);\n }\n }\n return added;\n }", "public static String truncate(int n, int smallestDigit, int biggestDigit) {\r\n int numDigits = biggestDigit - smallestDigit + 1;\r\n char[] result = new char[numDigits];\r\n for (int j = 1; j < smallestDigit; j++) {\r\n n = n / 10;\r\n }\r\n for (int j = numDigits - 1; j >= 0; j--) {\r\n result[j] = Character.forDigit(n % 10, 10);\r\n n = n / 10;\r\n }\r\n return new String(result);\r\n }", "static boolean matchPath(String[] tokenizedPattern, String[] strDirs, boolean isCaseSensitive) {\n int patIdxStart = 0;\n int patIdxEnd = tokenizedPattern.length - 1;\n int strIdxStart = 0;\n int strIdxEnd = strDirs.length - 1;\n\n // up to first '**'\n while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {\n String patDir = tokenizedPattern[patIdxStart];\n if (patDir.equals(DEEP_TREE_MATCH)) {\n break;\n }\n if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) {\n return false;\n }\n patIdxStart++;\n strIdxStart++;\n }\n if (strIdxStart > strIdxEnd) {\n // String is exhausted\n for (int i = patIdxStart; i <= patIdxEnd; i++) {\n if (!tokenizedPattern[i].equals(DEEP_TREE_MATCH)) {\n return false;\n }\n }\n return true;\n } else {\n if (patIdxStart > patIdxEnd) {\n // String not exhausted, but pattern is. Failure.\n return false;\n }\n }\n\n // up to last '**'\n while (patIdxStart <= patIdxEnd && strIdxStart <= strIdxEnd) {\n String patDir = tokenizedPattern[patIdxEnd];\n if (patDir.equals(DEEP_TREE_MATCH)) {\n break;\n }\n if (!match(patDir, strDirs[strIdxEnd], isCaseSensitive)) {\n return false;\n }\n patIdxEnd--;\n strIdxEnd--;\n }\n if (strIdxStart > strIdxEnd) {\n // String is exhausted\n for (int i = patIdxStart; i <= patIdxEnd; i++) {\n if (!tokenizedPattern[i].equals(DEEP_TREE_MATCH)) {\n return false;\n }\n }\n return true;\n }\n\n while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) {\n int patIdxTmp = -1;\n for (int i = patIdxStart + 1; i <= patIdxEnd; i++) {\n if (tokenizedPattern[i].equals(DEEP_TREE_MATCH)) {\n patIdxTmp = i;\n break;\n }\n }\n if (patIdxTmp == patIdxStart + 1) {\n // '**/**' situation, so skip one\n patIdxStart++;\n continue;\n }\n // Find the pattern between padIdxStart & padIdxTmp in str between\n // strIdxStart & strIdxEnd\n int patLength = (patIdxTmp - patIdxStart - 1);\n int strLength = (strIdxEnd - strIdxStart + 1);\n int foundIdx = -1;\n strLoop:\n for (int i = 0; i <= strLength - patLength; i++) {\n for (int j = 0; j < patLength; j++) {\n String subPat = tokenizedPattern[patIdxStart + j + 1];\n String subStr = strDirs[strIdxStart + i + j];\n if (!match(subPat, subStr, isCaseSensitive)) {\n continue strLoop;\n }\n }\n\n foundIdx = strIdxStart + i;\n break;\n }\n\n if (foundIdx == -1) {\n return false;\n }\n\n patIdxStart = patIdxTmp;\n strIdxStart = foundIdx + patLength;\n }\n\n for (int i = patIdxStart; i <= patIdxEnd; i++) {\n if (!tokenizedPattern[i].equals(DEEP_TREE_MATCH)) {\n return false;\n }\n }\n\n return true;\n }" ]
Reads the entity hosting the association from the datastore and applies any property changes from the server side.
[ "private void updateHostingEntityIfRequired() {\n\t\tif ( hostingEntity != null && hostingEntityRequiresReadAfterUpdate() ) {\n\t\t\tOgmEntityPersister entityPersister = getHostingEntityPersister();\n\n\t\t\tif ( GridDialects.hasFacet( gridDialect, GroupingByEntityDialect.class ) ) {\n\t\t\t\t( (GroupingByEntityDialect) gridDialect ).flushPendingOperations( getAssociationKey().getEntityKey(),\n\t\t\t\t\t\tentityPersister.getTupleContext( session ) );\n\t\t\t}\n\n\t\t\tentityPersister.processUpdateGeneratedProperties(\n\t\t\t\t\tentityPersister.getIdentifier( hostingEntity, session ),\n\t\t\t\t\thostingEntity,\n\t\t\t\t\tnew Object[entityPersister.getPropertyNames().length],\n\t\t\t\t\tsession\n\t\t\t);\n\t\t}\n\t}" ]
[ "public synchronized void initTaskSchedulerIfNot() {\n\n if (scheduler == null) {\n scheduler = Executors\n .newSingleThreadScheduledExecutor(DaemonThreadFactory\n .getInstance());\n CapacityAwareTaskScheduler runner = new CapacityAwareTaskScheduler();\n scheduler.scheduleAtFixedRate(runner,\n ParallecGlobalConfig.schedulerInitDelay,\n ParallecGlobalConfig.schedulerCheckInterval,\n TimeUnit.MILLISECONDS);\n logger.info(\"initialized daemon task scheduler to evaluate waitQ tasks.\");\n \n }\n }", "@Beta\n public MSICredentials withObjectId(String objectId) {\n this.objectId = objectId;\n this.clientId = null;\n this.identityId = null;\n return this;\n }", "public static appfwjsoncontenttype get(nitro_service service, String jsoncontenttypevalue) throws Exception{\n\t\tappfwjsoncontenttype obj = new appfwjsoncontenttype();\n\t\tobj.set_jsoncontenttypevalue(jsoncontenttypevalue);\n\t\tappfwjsoncontenttype response = (appfwjsoncontenttype) obj.get_resource(service);\n\t\treturn response;\n\t}", "public void setHighlightStrength(float _highlightStrength) {\n mHighlightStrength = _highlightStrength;\n for (PieModel model : mPieData) {\n highlightSlice(model);\n }\n invalidateGlobal();\n }", "public static boolean isStandaloneRunning(final ModelControllerClient client) {\n try {\n final ModelNode response = client.execute(Operations.createReadAttributeOperation(EMPTY_ADDRESS, \"server-state\"));\n if (Operations.isSuccessfulOutcome(response)) {\n final String state = Operations.readResult(response).asString();\n return !CONTROLLER_PROCESS_STATE_STARTING.equals(state)\n && !CONTROLLER_PROCESS_STATE_STOPPING.equals(state);\n }\n } catch (RuntimeException | IOException e) {\n LOGGER.trace(\"Interrupted determining if standalone is running\", e);\n }\n return false;\n }", "public void sendSyncModeCommand(int deviceNumber, boolean synced) throws IOException {\n final DeviceUpdate update = getLatestStatusFor(deviceNumber);\n if (update == null) {\n throw new IllegalArgumentException(\"Device \" + deviceNumber + \" not found on network.\");\n }\n sendSyncModeCommand(update, synced);\n }", "public Where<T, ID> between(String columnName, Object low, Object high) throws SQLException {\n\t\taddClause(new Between(columnName, findColumnFieldType(columnName), low, high));\n\t\treturn this;\n\t}", "private static synchronized boolean isLog4JConfigured()\r\n {\r\n if(!log4jConfigured)\r\n {\r\n Enumeration en = org.apache.log4j.Logger.getRootLogger().getAllAppenders();\r\n\r\n if (!(en instanceof org.apache.log4j.helpers.NullEnumeration))\r\n {\r\n log4jConfigured = true;\r\n }\r\n else\r\n {\r\n Enumeration cats = LogManager.getCurrentLoggers();\r\n while (cats.hasMoreElements())\r\n {\r\n org.apache.log4j.Logger c = (org.apache.log4j.Logger) cats.nextElement();\r\n if (!(c.getAllAppenders() instanceof org.apache.log4j.helpers.NullEnumeration))\r\n {\r\n log4jConfigured = true;\r\n }\r\n }\r\n }\r\n if(log4jConfigured)\r\n {\r\n String msg = \"Log4J is already configured, will not search for log4j properties file\";\r\n LoggerFactory.getBootLogger().info(msg);\r\n }\r\n else\r\n {\r\n LoggerFactory.getBootLogger().info(\"Log4J is not configured\");\r\n }\r\n }\r\n return log4jConfigured;\r\n }", "public boolean equalId(Element otherElement) {\r\n\t\tif (getElementId() == null || otherElement.getElementId() == null) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn getElementId().equalsIgnoreCase(otherElement.getElementId());\r\n\t}" ]
Commit all changes if there are uncommitted changes. @param msg the commit message. @throws GitAPIException
[ "public void commit(String msg) throws GitAPIException {\n try (Git git = getGit()) {\n Status status = git.status().call();\n if (!status.isClean()) {\n git.commit().setMessage(msg).setAll(true).setNoVerify(true).call();\n }\n }\n }" ]
[ "public PreparedStatement getUpdateStatement(ClassDescriptor cds) throws PersistenceBrokerSQLException, PersistenceBrokerException\r\n {\r\n try\r\n {\r\n return cds.getStatementsForClass(m_conMan).getUpdateStmt(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 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 }", "protected byte[] getUpperBytesInternal() {\n\t\tbyte cached[];\n\t\tif(hasNoValueCache()) {\n\t\t\tValueCache cache = valueCache;\n\t\t\tcache.upperBytes = cached = getBytesImpl(false);\n\t\t\tif(!isMultiple()) {\n\t\t\t\tcache.lowerBytes = cached;\n\t\t\t}\n\t\t} else {\n\t\t\tValueCache cache = valueCache;\n\t\t\tif((cached = cache.upperBytes) == null) {\n\t\t\t\tif(!isMultiple()) {\n\t\t\t\t\tif((cached = cache.lowerBytes) != null) {\n\t\t\t\t\t\tcache.upperBytes = cached;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcache.lowerBytes = cache.upperBytes = cached = getBytesImpl(false);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tcache.upperBytes = cached = getBytesImpl(false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cached;\n\t}", "public void scale(double v){\n\t\tfor(int i = 0; i < this.size(); i++){\n\t\t\tthis.get(i).scale(v);;\n\t\t}\n\t}", "public LogStreamResponse getLogs(String appName, Boolean tail) {\n return connection.execute(new Log(appName, tail), apiKey);\n }", "public DockerContainerObjectBuilder<T> withContainerObjectClass(Class<T> containerObjectClass) {\n if (containerObjectClass == null) {\n throw new IllegalArgumentException(\"container object class cannot be null\");\n }\n this.containerObjectClass = containerObjectClass;\n\n //First we check if this ContainerObject is defining a @CubeDockerFile in static method\n final List<Method> methodsWithCubeDockerFile =\n ReflectionUtil.getMethodsWithAnnotation(containerObjectClass, CubeDockerFile.class);\n\n if (methodsWithCubeDockerFile.size() > 1) {\n throw new IllegalArgumentException(\n String.format(\n \"More than one %s annotation found and only one was expected. Methods where annotation was found are: %s\",\n CubeDockerFile.class.getSimpleName(), methodsWithCubeDockerFile));\n }\n\n classHasMethodWithCubeDockerFile = !methodsWithCubeDockerFile.isEmpty();\n classDefinesCubeDockerFile = containerObjectClass.isAnnotationPresent(CubeDockerFile.class);\n classDefinesImage = containerObjectClass.isAnnotationPresent(Image.class);\n\n if (classHasMethodWithCubeDockerFile) {\n methodWithCubeDockerFile = methodsWithCubeDockerFile.get(0);\n boolean isMethodStatic = Modifier.isStatic(methodWithCubeDockerFile.getModifiers());\n boolean methodHasNoArguments = methodWithCubeDockerFile.getParameterCount() == 0;\n boolean methodReturnsAnArchive = Archive.class.isAssignableFrom(methodWithCubeDockerFile.getReturnType());\n if (!isMethodStatic || !methodHasNoArguments || !methodReturnsAnArchive) {\n throw new IllegalArgumentException(\n String.format(\"Method %s annotated with %s is expected to be static, no args and return %s.\",\n methodWithCubeDockerFile, CubeDockerFile.class.getSimpleName(), Archive.class.getSimpleName()));\n }\n }\n\n // User has defined @CubeDockerfile on the class and a method\n if (classHasMethodWithCubeDockerFile && classDefinesCubeDockerFile) {\n throw new IllegalArgumentException(\n String.format(\n \"More than one %s annotation found and only one was expected. Both class and method %s has the annotation.\",\n CubeDockerFile.class.getSimpleName(), methodWithCubeDockerFile));\n }\n\n // User has defined @CubeDockerfile and @Image\n if ((classHasMethodWithCubeDockerFile || classDefinesCubeDockerFile) && classDefinesImage) {\n throw new IllegalArgumentException(\n String.format(\"Container Object %s has defined %s annotation and %s annotation together.\",\n containerObjectClass.getSimpleName(), Image.class.getSimpleName(),\n CubeDockerFile.class.getSimpleName()));\n }\n\n // User has not defined either @CubeDockerfile or @Image\n if (!classDefinesCubeDockerFile && !classDefinesImage && !classHasMethodWithCubeDockerFile) {\n throw new IllegalArgumentException(\n String.format(\"Container Object %s is not annotated with either %s or %s annotations.\",\n containerObjectClass.getName(), CubeDockerFile.class.getSimpleName(), Image.class.getSimpleName()));\n }\n\n return this;\n }", "public void clearHistory(int profileId, String clientUUID) {\n PreparedStatement query = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n String sqlQuery = \"DELETE FROM \" + Constants.DB_TABLE_HISTORY + \" \";\n\n // see if profileId is null or not (-1)\n if (profileId != -1) {\n sqlQuery += \"WHERE \" + Constants.GENERIC_PROFILE_ID + \"=\" + profileId;\n }\n\n // see if clientUUID is null or not\n if (clientUUID != null && clientUUID.compareTo(\"\") != 0) {\n sqlQuery += \" AND \" + Constants.GENERIC_CLIENT_UUID + \"='\" + clientUUID + \"'\";\n }\n\n sqlQuery += \";\";\n\n logger.info(\"Query: {}\", sqlQuery);\n query = sqlConnection.prepareStatement(sqlQuery);\n query.executeUpdate();\n } catch (Exception e) {\n } finally {\n try {\n if (query != null) {\n query.close();\n }\n } catch (Exception e) {\n }\n }\n }", "public double getValueWithGivenSpreadOverCurve(double evaluationTime,Curve referenceCurve, double spread, AnalyticModel model) {\n\t\tdouble value=0;\n\t\tfor(int periodIndex=0; periodIndex<schedule.getNumberOfPeriods();periodIndex++) {\n\t\t\tdouble paymentDate\t= schedule.getPayment(periodIndex);\n\t\t\tvalue+= paymentDate>evaluationTime ? getCouponPayment(periodIndex,model)*Math.exp(-spread*paymentDate)*referenceCurve.getValue(paymentDate): 0.0;\n\t\t}\n\n\t\tdouble paymentDate\t= schedule.getPayment(schedule.getNumberOfPeriods()-1);\n\t\treturn paymentDate>evaluationTime ? value+Math.exp(-spread*paymentDate)*referenceCurve.getValue(paymentDate):0.0;\n\t}", "@Override\n public final Double optDouble(final String key) {\n double result = this.obj.optDouble(key, Double.NaN);\n if (Double.isNaN(result)) {\n return null;\n }\n return result;\n }" ]
Use this API to fetch a appfwglobal_auditsyslogpolicy_binding resources.
[ "public static appfwglobal_auditsyslogpolicy_binding[] get(nitro_service service) throws Exception{\n\t\tappfwglobal_auditsyslogpolicy_binding obj = new appfwglobal_auditsyslogpolicy_binding();\n\t\tappfwglobal_auditsyslogpolicy_binding response[] = (appfwglobal_auditsyslogpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}" ]
[ "public static gslbservice_stats get(nitro_service service, String servicename) throws Exception{\n\t\tgslbservice_stats obj = new gslbservice_stats();\n\t\tobj.set_servicename(servicename);\n\t\tgslbservice_stats response = (gslbservice_stats) obj.stat_resource(service);\n\t\treturn response;\n\t}", "public Date getEnd() {\n\n if (null != m_explicitEnd) {\n return isWholeDay() ? adjustForWholeDay(m_explicitEnd, true) : m_explicitEnd;\n }\n if ((null == m_end) && (m_series.getInstanceDuration() != null)) {\n m_end = new Date(m_start.getTime() + m_series.getInstanceDuration().longValue());\n }\n return isWholeDay() && !m_series.isWholeDay() ? adjustForWholeDay(m_end, true) : m_end;\n }", "public static vrid6[] get(nitro_service service) throws Exception{\n\t\tvrid6 obj = new vrid6();\n\t\tvrid6[] response = (vrid6[])obj.get_resources(service);\n\t\treturn response;\n\t}", "public boolean nextSplit() {\n if( numSplits == 0 )\n return false;\n x2 = splits[--numSplits];\n if( numSplits > 0 )\n x1 = splits[numSplits-1]+1;\n else\n x1 = 0;\n\n return true;\n }", "public static base_response delete(nitro_service client, String sitename) throws Exception {\n\t\tgslbsite deleteresource = new gslbsite();\n\t\tdeleteresource.sitename = sitename;\n\t\treturn deleteresource.delete_resource(client);\n\t}", "public void setRightTableModel(TableModel model)\n {\n TableModel old = m_rightTable.getModel();\n m_rightTable.setModel(model);\n firePropertyChange(\"rightTableModel\", old, model);\n }", "private static JSONObject parseStencil(String stencilId) throws JSONException {\n JSONObject stencilObject = new JSONObject();\n\n stencilObject.put(\"id\",\n stencilId.toString());\n\n return stencilObject;\n }", "public static synchronized Class< ? > locate(final String serviceName) {\n if ( serviceName == null ) {\n throw new IllegalArgumentException( \"serviceName cannot be null\" );\n }\n if ( factories != null ) {\n List<Callable<Class< ? >>> l = factories.get( serviceName );\n if ( l != null && !l.isEmpty() ) {\n Callable<Class< ? >> c = l.get( l.size() - 1 );\n try {\n return c.call();\n } catch ( Exception e ) {\n }\n }\n }\n return null;\n }", "public boolean hasRequiredMiniFluoProps() {\n boolean valid = true;\n if (getMiniStartAccumulo()) {\n // ensure that client properties are not set since we are using MiniAccumulo\n valid &= verifyStringPropNotSet(ACCUMULO_USER_PROP, CLIENT_ACCUMULO_USER_PROP);\n valid &= verifyStringPropNotSet(ACCUMULO_PASSWORD_PROP, CLIENT_ACCUMULO_PASSWORD_PROP);\n valid &= verifyStringPropNotSet(ACCUMULO_INSTANCE_PROP, CLIENT_ACCUMULO_INSTANCE_PROP);\n valid &= verifyStringPropNotSet(ACCUMULO_ZOOKEEPERS_PROP, CLIENT_ACCUMULO_ZOOKEEPERS_PROP);\n valid &= verifyStringPropNotSet(CONNECTION_ZOOKEEPERS_PROP, CLIENT_ZOOKEEPER_CONNECT_PROP);\n if (valid == false) {\n log.error(\"Client properties should not be set in your configuration if MiniFluo is \"\n + \"configured to start its own accumulo (indicated by fluo.mini.start.accumulo being \"\n + \"set to true)\");\n }\n } else {\n valid &= hasRequiredClientProps();\n valid &= hasRequiredAdminProps();\n valid &= hasRequiredOracleProps();\n valid &= hasRequiredWorkerProps();\n }\n return valid;\n }" ]
Throw fault. @param code the fault code @param message the message @param t the throwable type @throws PutEventsFault
[ "private static void throwFault(String code, String message, Throwable t) throws PutEventsFault {\n if (LOG.isLoggable(Level.SEVERE)) {\n LOG.log(Level.SEVERE, \"Throw Fault \" + code + \" \" + message, t);\n }\n\n FaultType faultType = new FaultType();\n faultType.setFaultCode(code);\n faultType.setFaultMessage(message);\n\n StringWriter stringWriter = new StringWriter();\n PrintWriter printWriter = new PrintWriter(stringWriter);\n\n t.printStackTrace(printWriter);\n\n faultType.setStackTrace(stringWriter.toString());\n\n throw new PutEventsFault(message, faultType, t);\n }" ]
[ "public List<Dependency> getModuleAncestors(final String moduleName, final String moduleVersion) throws GrapesCommunicationException {\n final Client client = getClient();\n final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactAncestors(moduleName, moduleVersion));\n final ClientResponse response = resource.queryParam(ServerAPI.SCOPE_COMPILE_PARAM, \"true\")\n .queryParam(ServerAPI.SCOPE_PROVIDED_PARAM, \"true\")\n .queryParam(ServerAPI.SCOPE_RUNTIME_PARAM, \"true\")\n .queryParam(ServerAPI.SCOPE_TEST_PARAM, \"true\")\n .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);\n\n client.destroy();\n if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){\n final String message = String.format(FAILED_TO_GET_MODULE, \"get module ancestors\", moduleName, moduleVersion);\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<Dependency>>(){});\n }", "private void updateDurationTimeUnit(FastTrackColumn column)\n {\n if (m_durationTimeUnit == null && isDurationColumn(column))\n {\n int value = ((DurationColumn) column).getTimeUnitValue();\n if (value != 1)\n {\n m_durationTimeUnit = FastTrackUtility.getTimeUnit(value);\n }\n }\n }", "private static void processResourceFilter(ProjectFile project, Filter filter)\n {\n for (Resource resource : project.getResources())\n {\n if (filter.evaluate(resource, null))\n {\n System.out.println(resource.getID() + \",\" + resource.getUniqueID() + \",\" + resource.getName());\n }\n }\n }", "public EmailAlias addEmailAlias(String email, boolean isConfirmed) {\n URL url = EMAIL_ALIASES_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, \"POST\");\n\n JsonObject requestJSON = new JsonObject()\n .add(\"email\", email);\n\n if (isConfirmed) {\n requestJSON.add(\"is_confirmed\", isConfirmed);\n }\n\n request.setBody(requestJSON.toString());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n return new EmailAlias(responseJSON);\n }", "public static DMatrixRMaj symmetric(int length, double min, double max, Random rand) {\n DMatrixRMaj A = new DMatrixRMaj(length,length);\n\n symmetric(A,min,max,rand);\n\n return A;\n }", "public static void main(String[] args) throws Exception {\r\n StringUtils.printErrInvocationString(\"CMMClassifier\", args);\r\n\r\n Properties props = StringUtils.argsToProperties(args);\r\n CMMClassifier cmm = new CMMClassifier<CoreLabel>(props);\r\n String testFile = cmm.flags.testFile;\r\n String textFile = cmm.flags.textFile;\r\n String loadPath = cmm.flags.loadClassifier;\r\n String serializeTo = cmm.flags.serializeTo;\r\n\r\n // cmm.crossValidateTrainAndTest(trainFile);\r\n if (loadPath != null) {\r\n cmm.loadClassifierNoExceptions(loadPath, props);\r\n } else if (cmm.flags.loadJarClassifier != null) {\r\n cmm.loadJarClassifier(cmm.flags.loadJarClassifier, props);\r\n } else if (cmm.flags.trainFile != null) {\r\n if (cmm.flags.biasedTrainFile != null) {\r\n cmm.trainSemiSup();\r\n } else {\r\n cmm.train();\r\n }\r\n } else {\r\n cmm.loadDefaultClassifier();\r\n }\r\n\r\n if (serializeTo != null) {\r\n cmm.serializeClassifier(serializeTo);\r\n }\r\n\r\n if (testFile != null) {\r\n cmm.classifyAndWriteAnswers(testFile, cmm.makeReaderAndWriter());\r\n } else if (cmm.flags.testFiles != null) {\r\n cmm.classifyAndWriteAnswers(cmm.flags.baseTestDir, cmm.flags.testFiles,\r\n cmm.makeReaderAndWriter());\r\n }\r\n\r\n if (textFile != null) {\r\n DocumentReaderAndWriter readerAndWriter =\r\n new PlainTextDocumentReaderAndWriter();\r\n cmm.classifyAndWriteAnswers(textFile, readerAndWriter);\r\n }\r\n }", "public synchronized final void closeStream() {\n try {\n if ((stream != null) && (streamState == StreamStates.OPEN)) {\n stream.close();\n stream = null;\n }\n streamState = StreamStates.CLOSED;\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "public synchronized Set<RegistrationPoint> getRegistrationPoints() {\n Set<RegistrationPoint> result = new HashSet<>();\n for (List<RegistrationPoint> registrationPoints : registrationPoints.values()) {\n result.addAll(registrationPoints);\n }\n return Collections.unmodifiableSet(result);\n }", "public static void readAndCheckVersion(ObjectInput input, int supportedVersion, Class<?> externalizedType) throws IOException {\n\t\tint version = input.readInt();\n\n\t\tif ( version != supportedVersion ) {\n\t\t\tthrow LOG.unexpectedKeyVersion( externalizedType, version, supportedVersion );\n\t\t}\n\t}" ]
Updates a path table value for column columnName @param columnName name of the column to update @param newData new content to set @param path_id ID of the path to update
[ "public static void updatePathTable(String columnName, Object newData, int path_id) {\n PreparedStatement statement = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n statement = sqlConnection.prepareStatement(\n \"UPDATE \" + Constants.DB_TABLE_PATH +\n \" SET \" + columnName + \" = ?\" +\n \" WHERE \" + Constants.GENERIC_ID + \" = ?\"\n );\n statement.setObject(1, newData);\n statement.setInt(2, 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 }" ]
[ "private Serializable doWorkInIsolationTransaction(final SharedSessionContractImplementor session)\n\t\t\tthrows HibernateException {\n\t\tclass Work extends AbstractReturningWork<IntegralDataTypeHolder> {\n\t\t\tprivate final SharedSessionContractImplementor localSession = session;\n\n\t\t\t@Override\n\t\t\tpublic IntegralDataTypeHolder execute(Connection connection) throws SQLException {\n\t\t\t\ttry {\n\t\t\t\t\treturn doWorkInCurrentTransactionIfAny( localSession );\n\t\t\t\t}\n\t\t\t\tcatch ( RuntimeException sqle ) {\n\t\t\t\t\tthrow new HibernateException( \"Could not get or update next value\", sqle );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//we want to work out of transaction\n\t\tboolean workInTransaction = false;\n\t\tWork work = new Work();\n\t\tSerializable generatedValue = session.getTransactionCoordinator().createIsolationDelegate().delegateWork( work, workInTransaction );\n\t\treturn generatedValue;\n\t}", "public void unlink(Object obj, ObjectReferenceDescriptor ord, boolean insert)\r\n {\r\n linkOrUnlink(false, obj, ord, insert);\r\n }", "public void setQueryExecuteTimeLimit(long queryExecuteTimeLimit, TimeUnit timeUnit) {\n\t\tthis.queryExecuteTimeLimitInMs = TimeUnit.MILLISECONDS.convert(queryExecuteTimeLimit, timeUnit);\n\t}", "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 }", "@SuppressWarnings({\"WeakerAccess\", \"unused\"}) // For library users\n public void registerWidget(View widget) {\n prepareWidget(widget);\n\n if (widget instanceof AlgoliaResultsListener) {\n AlgoliaResultsListener listener = (AlgoliaResultsListener) widget;\n if (!this.resultListeners.contains(listener)) {\n this.resultListeners.add(listener);\n }\n searcher.registerResultListener(listener);\n }\n if (widget instanceof AlgoliaErrorListener) {\n AlgoliaErrorListener listener = (AlgoliaErrorListener) widget;\n if (!this.errorListeners.contains(listener)) {\n this.errorListeners.add(listener);\n }\n searcher.registerErrorListener(listener);\n }\n if (widget instanceof AlgoliaSearcherListener) {\n AlgoliaSearcherListener listener = (AlgoliaSearcherListener) widget;\n listener.initWithSearcher(searcher);\n }\n }", "@Override\n public synchronized void resume() {\n this.paused = false;\n ServerActivityCallback listener = listenerUpdater.get(this);\n if (listener != null) {\n listenerUpdater.compareAndSet(this, listener, null);\n }\n while (!taskQueue.isEmpty() && (activeRequestCount < maxRequestCount || maxRequestCount < 0)) {\n runQueuedTask(false);\n }\n }", "public static void writeShortString(ByteBuffer buffer, String s) {\n if (s == null) {\n buffer.putShort((short) -1);\n } else if (s.length() > Short.MAX_VALUE) {\n throw new IllegalArgumentException(\"String exceeds the maximum size of \" + Short.MAX_VALUE + \".\");\n } else {\n byte[] data = getBytes(s); //topic support non-ascii character\n buffer.putShort((short) data.length);\n buffer.put(data);\n }\n }", "public void validateUniqueIDsForMicrosoftProject()\n {\n if (!isEmpty())\n {\n for (T entity : this)\n {\n if (NumberHelper.getInt(entity.getUniqueID()) > MS_PROJECT_MAX_UNIQUE_ID)\n {\n renumberUniqueIDs();\n break;\n }\n }\n }\n }", "public void dumpKnownFieldMaps(Props props)\n {\n //for (int key=131092; key < 131098; key++)\n for (int key = 50331668; key < 50331674; key++)\n {\n byte[] fieldMapData = props.getByteArray(Integer.valueOf(key));\n if (fieldMapData != null)\n {\n System.out.println(\"KEY: \" + key);\n createFieldMap(fieldMapData);\n System.out.println(toString());\n clear();\n }\n }\n }" ]
Send the started notification
[ "synchronized void started() {\n try {\n if(isConnected()) {\n channelHandler.executeRequest(new ServerStartedRequest(), null).getResult().await();\n }\n } catch (Exception e) {\n ServerLogger.AS_ROOT_LOGGER.debugf(e, \"failed to send started notification\");\n }\n }" ]
[ "public static Class<?> resolveReturnType(Method method, Class<?> clazz) {\n\t\tAssert.notNull(method, \"Method must not be null\");\n\t\tType genericType = method.getGenericReturnType();\n\t\tAssert.notNull(clazz, \"Class must not be null\");\n\t\tMap<TypeVariable, Type> typeVariableMap = getTypeVariableMap(clazz);\n\t\tType rawType = getRawType(genericType, typeVariableMap);\n\t\treturn (rawType instanceof Class ? (Class<?>) rawType : method.getReturnType());\n\t}", "public Widget addControl(String name, int resId, Widget.OnTouchListener listener, int position) {\n Widget control = findChildByName(name);\n if (control == null) {\n control = createControlWidget(resId, name, null);\n }\n setupControl(name, control, listener, position);\n return control;\n }", "private long validateMessage(FileChannel channel, long start, long len, ByteBuffer buffer) throws IOException {\n buffer.rewind();\n int read = channel.read(buffer, start);\n if (read < 4) return -1;\n\n // check that we have sufficient bytes left in the file\n int size = buffer.getInt(0);\n if (size < Message.MinHeaderSize) return -1;\n\n long next = start + 4 + size;\n if (next > len) return -1;\n\n // read the message\n ByteBuffer messageBuffer = ByteBuffer.allocate(size);\n long curr = start + 4;\n while (messageBuffer.hasRemaining()) {\n read = channel.read(messageBuffer, curr);\n if (read < 0) throw new IllegalStateException(\"File size changed during recovery!\");\n else curr += read;\n }\n messageBuffer.rewind();\n Message message = new Message(messageBuffer);\n if (!message.isValid()) return -1;\n else return next;\n }", "void lockInterruptibly(final Integer permit) throws InterruptedException {\n if (permit == null) {\n throw new IllegalArgumentException();\n }\n sync.acquireInterruptibly(permit);\n }", "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 List<Message> requestFolderMenuFrom(final SlotReference slotReference, final int sortOrder, final int folderId)\n throws Exception {\n\n ConnectionManager.ClientTask<List<Message>> task = new ConnectionManager.ClientTask<List<Message>>() {\n @Override\n public List<Message> useClient(Client client) throws Exception {\n if (client.tryLockingForMenuOperations(MetadataFinder.MENU_TIMEOUT, TimeUnit.SECONDS)) {\n try {\n logger.debug(\"Requesting Key menu.\");\n Message response = client.menuRequestTyped(Message.KnownType.FOLDER_MENU_REQ, Message.MenuIdentifier.MAIN_MENU, slotReference.slot,\n CdjStatus.TrackType.UNANALYZED, new NumberField(sortOrder), new NumberField(folderId), new NumberField(0xffffff));\n return client.renderMenuItems(Message.MenuIdentifier.MAIN_MENU, slotReference.slot, CdjStatus.TrackType.UNANALYZED, response);\n } finally {\n client.unlockForMenuOperations();\n }\n } else {\n throw new TimeoutException(\"Unable to lock player for menu operations.\");\n }\n }\n };\n\n return ConnectionManager.getInstance().invokeWithClientSession(slotReference.player, task, \"requesting folder menu\");\n }", "public void setChildren(List<PrintComponent<?>> children) {\n\t\tthis.children = children;\n\t\t// needed for Json unmarshall !!!!\n\t\tfor (PrintComponent<?> child : children) {\n\t\t\tchild.setParent(this);\n\t\t}\n\t}", "public void sendLoadTrackCommand(DeviceUpdate target, int rekordboxId,\n int sourcePlayer, CdjStatus.TrackSourceSlot sourceSlot, CdjStatus.TrackType sourceType)\n throws IOException {\n ensureRunning();\n byte[] payload = new byte[LOAD_TRACK_PAYLOAD.length];\n System.arraycopy(LOAD_TRACK_PAYLOAD, 0, payload, 0, LOAD_TRACK_PAYLOAD.length);\n payload[0x02] = getDeviceNumber();\n payload[0x05] = getDeviceNumber();\n payload[0x09] = (byte)sourcePlayer;\n payload[0x0a] = sourceSlot.protocolValue;\n payload[0x0b] = sourceType.protocolValue;\n Util.numberToBytes(rekordboxId, payload, 0x0d, 4);\n assembleAndSendPacket(Util.PacketType.LOAD_TRACK_COMMAND, payload, target.getAddress(), UPDATE_PORT);\n }", "public static dnsview[] get(nitro_service service) throws Exception{\n\t\tdnsview obj = new dnsview();\n\t\tdnsview[] response = (dnsview[])obj.get_resources(service);\n\t\treturn response;\n\t}" ]
Add tags to a photo. This method requires authentication with 'write' permission. @param photoId The photo ID @param tags The tags @throws FlickrException
[ "public void addTags(String photoId, String[] tags) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_ADD_TAGS);\r\n\r\n parameters.put(\"photo_id\", photoId);\r\n parameters.put(\"tags\", StringUtilities.join(tags, \" \", true));\r\n\r\n Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n }" ]
[ "private static final String correctNumberFormat(String value)\n {\n String result;\n int index = value.indexOf(',');\n if (index == -1)\n {\n result = value;\n }\n else\n {\n char[] chars = value.toCharArray();\n chars[index] = '.';\n result = new String(chars);\n }\n return result;\n }", "public static boolean isLong(CharSequence self) {\n try {\n Long.valueOf(self.toString().trim());\n return true;\n } catch (NumberFormatException nfe) {\n return false;\n }\n }", "public void putEvents(List<Event> events) {\n List<Event> filteredEvents = filterEvents(events);\n executeHandlers(filteredEvents);\n for (Event event : filteredEvents) {\n persistenceHandler.writeEvent(event);\n }\n }", "public static boolean isPrimitiveWrapperArray(Class<?> clazz) {\n\t\tAssert.notNull(clazz, \"Class must not be null\");\n\t\treturn (clazz.isArray() && isPrimitiveWrapper(clazz.getComponentType()));\n\t}", "public String getResourcePath()\n {\n switch (resourceType)\n {\n case ANDROID_ASSETS: return assetPath;\n\n case ANDROID_RESOURCE: return resourceFilePath;\n\n case LINUX_FILESYSTEM: return filePath;\n\n case NETWORK: return url.getPath();\n\n case INPUT_STREAM: return inputStreamName;\n\n default: return null;\n }\n }", "public static nslimitidentifier_binding get(nitro_service service, String limitidentifier) throws Exception{\n\t\tnslimitidentifier_binding obj = new nslimitidentifier_binding();\n\t\tobj.set_limitidentifier(limitidentifier);\n\t\tnslimitidentifier_binding response = (nslimitidentifier_binding) obj.get_resource(service);\n\t\treturn response;\n\t}", "public ConverterServerBuilder requestTimeout(long timeout, TimeUnit unit) {\n assertNumericArgument(timeout, true);\n this.requestTimeout = unit.toMillis(timeout);\n return this;\n }", "private void ensureNoTableInfoIfNoRepositoryInfo(ClassDescriptorDef classDef, String checkLevel)\r\n {\r\n if (!classDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_GENERATE_REPOSITORY_INFO, true))\r\n {\r\n classDef.setProperty(PropertyHelper.OJB_PROPERTY_GENERATE_TABLE_INFO, \"false\");\r\n }\r\n }", "private void processCalendars() throws IOException\n {\n CalendarReader reader = new CalendarReader(m_data.getTableData(\"Calendars\"));\n reader.read();\n\n for (MapRow row : reader.getRows())\n {\n processCalendar(row);\n }\n\n m_project.setDefaultCalendar(m_calendarMap.get(reader.getDefaultCalendarUUID()));\n }" ]
Deletes the disabled marker file in the directory of the specified version. @param version to enable @throws PersistenceFailureException if the marker file could not be deleted (can happen if the storage system has become read-only or is otherwise inaccessible).
[ "private void persistEnabledVersion(long version) throws PersistenceFailureException {\n File disabledMarker = getDisabledMarkerFile(version);\n if (disabledMarker.exists()) {\n if (!disabledMarker.delete()) {\n throw new PersistenceFailureException(\"Failed to create the disabled marker at path: \" +\n disabledMarker.getAbsolutePath() + \"\\nThe store/version \" +\n \"will remain enabled only until the next restart.\");\n }\n }\n }" ]
[ "public void visitParameter(String name, int access) {\n if (mv != null) {\n mv.visitParameter(name, access);\n }\n }", "public static void addToMediaStore(Context context, File file) {\n String[] path = new String[]{file.getPath()};\n MediaScannerConnection.scanFile(context, path, null, null);\n }", "public static MBeanParameterInfo[] extractParameterInfo(Method m) {\n Class<?>[] types = m.getParameterTypes();\n Annotation[][] annotations = m.getParameterAnnotations();\n MBeanParameterInfo[] params = new MBeanParameterInfo[types.length];\n for(int i = 0; i < params.length; i++) {\n boolean hasAnnotation = false;\n for(int j = 0; j < annotations[i].length; j++) {\n if(annotations[i][j] instanceof JmxParam) {\n JmxParam param = (JmxParam) annotations[i][j];\n params[i] = new MBeanParameterInfo(param.name(),\n types[i].getName(),\n param.description());\n hasAnnotation = true;\n break;\n }\n }\n if(!hasAnnotation) {\n params[i] = new MBeanParameterInfo(\"\", types[i].getName(), \"\");\n }\n }\n\n return params;\n }", "public void addSubmodule(final Module submodule) {\n if (!submodules.contains(submodule)) {\n submodule.setSubmodule(true);\n\n if (promoted) {\n submodule.setPromoted(promoted);\n }\n\n submodules.add(submodule);\n }\n }", "private void uncheckAll(CmsList<? extends I_CmsListItem> list) {\r\n\r\n for (Widget it : list) {\r\n CmsTreeItem treeItem = (CmsTreeItem)it;\r\n treeItem.getCheckBox().setChecked(false);\r\n uncheckAll(treeItem.getChildren());\r\n }\r\n }", "public ReferrerList getPhotoReferrers(Date date, String domain, String photoId, int perPage, int page) throws FlickrException {\n return getReferrers(METHOD_GET_PHOTO_REFERRERS, domain, \"photo_id\", photoId, date, perPage, page);\n }", "public static int compare(Integer n1, Integer n2)\n {\n int result;\n if (n1 == null || n2 == null)\n {\n result = (n1 == null && n2 == null ? 0 : (n1 == null ? 1 : -1));\n }\n else\n {\n result = n1.compareTo(n2);\n }\n return (result);\n }", "public List<ServerRedirect> getServerMappings() {\n ArrayList<ServerRedirect> servers = new ArrayList<ServerRedirect>();\n try {\n JSONObject response = new JSONObject(doGet(BASE_SERVER, null));\n JSONArray serverArray = response.getJSONArray(\"servers\");\n\n for (int i = 0; i < serverArray.length(); i++) {\n JSONObject jsonServer = serverArray.getJSONObject(i);\n ServerRedirect server = getServerRedirectFromJSON(jsonServer);\n if (server != null) {\n servers.add(server);\n }\n }\n } catch (Exception e) {\n e.printStackTrace();\n return null;\n }\n return servers;\n }", "public static List<String> getArgumentNames(MethodCallExpression methodCall) {\r\n ArrayList<String> result = new ArrayList<String>();\r\n\r\n Expression arguments = methodCall.getArguments();\r\n List<Expression> argExpressions = null;\r\n if (arguments instanceof ArrayExpression) {\r\n argExpressions = ((ArrayExpression) arguments).getExpressions();\r\n } else if (arguments instanceof ListExpression) {\r\n argExpressions = ((ListExpression) arguments).getExpressions();\r\n } else if (arguments instanceof TupleExpression) {\r\n argExpressions = ((TupleExpression) arguments).getExpressions();\r\n } else {\r\n LOG.warn(\"getArgumentNames arguments is not an expected type\");\r\n }\r\n\r\n if (argExpressions != null) {\r\n for (Expression exp : argExpressions) {\r\n if (exp instanceof VariableExpression) {\r\n result.add(((VariableExpression) exp).getName());\r\n }\r\n }\r\n }\r\n return result;\r\n }" ]
Adds a table to this model. @param table The table
[ "private void addTable(TableDef table)\r\n {\r\n table.setOwner(this);\r\n _tableDefs.put(table.getName(), table);\r\n }" ]
[ "public Boolean getBoolean(int field, String falseText)\n {\n Boolean result;\n\n if ((field < m_fields.length) && (m_fields[field].length() != 0))\n {\n result = ((m_fields[field].equalsIgnoreCase(falseText) == true) ? Boolean.FALSE : Boolean.TRUE);\n }\n else\n {\n result = null;\n }\n\n return (result);\n }", "public static ExtensibleConfigurationPersister createHostXmlConfigurationPersister(final ConfigurationFile file, final HostControllerEnvironment environment,\n final ExecutorService executorService, final ExtensionRegistry hostExtensionRegistry,\n final LocalHostControllerInfo localHostControllerInfo) {\n String defaultHostname = localHostControllerInfo.getLocalHostName();\n if (environment.getRunningModeControl().isReloaded()) {\n if (environment.getRunningModeControl().getReloadHostName() != null) {\n defaultHostname = environment.getRunningModeControl().getReloadHostName();\n }\n }\n HostXml hostXml = new HostXml(defaultHostname, environment.getRunningModeControl().getRunningMode(),\n environment.isUseCachedDc(), Module.getBootModuleLoader(), executorService, hostExtensionRegistry);\n BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister(file, new QName(Namespace.CURRENT.getUriString(), \"host\"), hostXml, hostXml, false);\n for (Namespace namespace : Namespace.domainValues()) {\n if (!namespace.equals(Namespace.CURRENT)) {\n persister.registerAdditionalRootElement(new QName(namespace.getUriString(), \"host\"), hostXml);\n }\n }\n hostExtensionRegistry.setWriterRegistry(persister);\n return persister;\n }", "private void toCorrectDateWithDay(Calendar date, WeekOfMonth week) {\n\n date.set(Calendar.DAY_OF_MONTH, 1);\n int daysToFirstWeekDayMatch = ((m_weekDay.toInt() + I_CmsSerialDateValue.NUM_OF_WEEKDAYS)\n - (date.get(Calendar.DAY_OF_WEEK))) % I_CmsSerialDateValue.NUM_OF_WEEKDAYS;\n date.add(Calendar.DAY_OF_MONTH, daysToFirstWeekDayMatch);\n int wouldBeDayOfMonth = date.get(Calendar.DAY_OF_MONTH)\n + ((week.ordinal()) * I_CmsSerialDateValue.NUM_OF_WEEKDAYS);\n if (wouldBeDayOfMonth > date.getActualMaximum(Calendar.DAY_OF_MONTH)) {\n date.set(Calendar.DAY_OF_MONTH, wouldBeDayOfMonth - I_CmsSerialDateValue.NUM_OF_WEEKDAYS);\n } else {\n date.set(Calendar.DAY_OF_MONTH, wouldBeDayOfMonth);\n }\n\n }", "public void put(String key, Object object, Envelope envelope) {\n\t\tindex.put(key, envelope);\n\t\tcache.put(key, object);\n\t}", "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 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 ClassNode addInterface(String name) {\n ClassNode intf = infoBase.node(name);\n addInterface(intf);\n return this;\n }", "public static boolean validate(final String ip) {\n Matcher matcher = pattern.matcher(ip);\n return matcher.matches();\n }", "public void logAttributeWarning(PathAddress address, String message, Set<String> attributes) {\n messageQueue.add(new AttributeLogEntry(address, null, message, attributes));\n }" ]
Creates a polling state. @param response the response from Retrofit REST call that initiate the long running operation. @param lroOptions long running operation options. @param defaultRetryTimeout the long running operation retry timeout. @param resourceType the type of the resource the long running operation returns @param serializerAdapter the adapter for the Jackson object mapper @param <T> the result type @return the polling state @throws IOException thrown by deserialization
[ "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 }" ]
[ "@Override\n public GroupDiscussInterface getDiscussionInterface() {\n if (discussionInterface == null) {\n discussionInterface = new GroupDiscussInterface(apiKey, sharedSecret, transport);\n }\n return discussionInterface;\n }", "public static Trajectory concactTrajectorie(Trajectory a, Trajectory b){\n\t\tif(a.getDimension()!=b.getDimension()){\n\t\t\tthrow new IllegalArgumentException(\"Combination not possible: The trajectorys does not have the same dimension\");\n\t\t}\n\t\tTrajectory c = new Trajectory(a.getDimension());\n\t\t\n\t\tfor(int i = 0 ; i < a.size(); i++){\n\t\t\tPoint3d pos = new Point3d(a.get(i).x, \n\t\t\t\t\ta.get(i).y, \n\t\t\t\t\ta.get(i).z);\n\t\t\tc.add(pos);\n\t\t}\n\t\t\n\t\tdouble dx = a.get(a.size()-1).x - b.get(0).x;\n\t\tdouble dy = a.get(a.size()-1).y - b.get(0).y;\n\t\tdouble dz = a.get(a.size()-1).z - b.get(0).z;\n\t\t\n\t\tfor(int i = 1 ; i < b.size(); i++){\n\t\t\tPoint3d pos = new Point3d(b.get(i).x+dx, \n\t\t\t\t\tb.get(i).y+dy, \n\t\t\t\t\tb.get(i).z+dz);\n\t\t\tc.add(pos);\n\t\t}\n\t\t\n\t\treturn c;\n\t\t\n\t}", "private void showGlobalContextActionBar() {\n ActionBar actionBar = getActionBar();\n actionBar.setDisplayShowTitleEnabled(true);\n actionBar.setTitle(R.string.app_name);\n }", "public static void sqrt(Complex_F64 input, Complex_F64 root)\n {\n double r = input.getMagnitude();\n double a = input.real;\n\n root.real = Math.sqrt((r+a)/2.0);\n root.imaginary = Math.sqrt((r-a)/2.0);\n if( input.imaginary < 0 )\n root.imaginary = -root.imaginary;\n }", "public static base_response add(nitro_service client, dbdbprofile resource) throws Exception {\n\t\tdbdbprofile addresource = new dbdbprofile();\n\t\taddresource.name = resource.name;\n\t\taddresource.interpretquery = resource.interpretquery;\n\t\taddresource.stickiness = resource.stickiness;\n\t\taddresource.kcdaccount = resource.kcdaccount;\n\t\taddresource.conmultiplex = resource.conmultiplex;\n\t\treturn addresource.add_resource(client);\n\t}", "public IGoal[] getAgentGoals(final String agent_name, Connector connector) {\n ((IExternalAccess) connector.getAgentsExternalAccess(agent_name))\n .scheduleStep(new IComponentStep<Plan>() {\n\n public IFuture<Plan> execute(IInternalAccess ia) {\n IBDIInternalAccess bia = (IBDIInternalAccess) ia;\n\n goals = bia.getGoalbase().getGoals();\n return null;\n }\n }).get(new ThreadSuspendable());\n\n return goals;\n }", "public static int cudnnBatchNormalizationBackward(\n cudnnHandle handle, \n int mode, \n Pointer alphaDataDiff, \n Pointer betaDataDiff, \n Pointer alphaParamDiff, \n Pointer betaParamDiff, \n cudnnTensorDescriptor xDesc, /** same desc for x, dx, dy */\n Pointer x, \n cudnnTensorDescriptor dyDesc, \n Pointer dy, \n cudnnTensorDescriptor dxDesc, \n Pointer dx, \n /** Shared tensor desc for the 4 tensors below */\n cudnnTensorDescriptor dBnScaleBiasDesc, \n Pointer bnScale, /** bnBias doesn't affect backpropagation */\n /** scale and bias diff are not backpropagated below this layer */\n Pointer dBnScaleResult, \n Pointer dBnBiasResult, \n /** Same epsilon as forward pass */\n double epsilon, \n /** Optionally cached intermediate results from\n forward pass */\n Pointer savedMean, \n Pointer savedInvVariance)\n {\n return checkResult(cudnnBatchNormalizationBackwardNative(handle, mode, alphaDataDiff, betaDataDiff, alphaParamDiff, betaParamDiff, xDesc, x, dyDesc, dy, dxDesc, dx, dBnScaleBiasDesc, bnScale, dBnScaleResult, dBnBiasResult, epsilon, savedMean, savedInvVariance));\n }", "public base_response enable_features(String[] features) throws Exception\n\t{\n\t\tbase_response result = null;\n\t\tnsfeature resource = new nsfeature();\n\t\tresource.set_feature(features);\n\t\toptions option = new options();\n\t\toption.set_action(\"enable\");\n\t\tresult = resource.perform_operation(this, option);\n\t\treturn result;\n\t}", "public void addRow(String primaryKeyColumnName, Map<String, Object> map)\n {\n Integer rowNumber = Integer.valueOf(m_rowNumber++);\n map.put(\"ROW_NUMBER\", rowNumber);\n Object primaryKey = null;\n if (primaryKeyColumnName != null)\n {\n primaryKey = map.get(primaryKeyColumnName);\n }\n\n if (primaryKey == null)\n {\n primaryKey = rowNumber;\n }\n\n MapRow newRow = new MapRow(map);\n MapRow oldRow = m_rows.get(primaryKey);\n if (oldRow == null)\n {\n m_rows.put(primaryKey, newRow);\n }\n else\n {\n int oldVersion = oldRow.getInteger(\"ROW_VERSION\").intValue();\n int newVersion = newRow.getInteger(\"ROW_VERSION\").intValue();\n if (newVersion > oldVersion)\n {\n m_rows.put(primaryKey, newRow);\n }\n }\n }" ]
Retrieve the default mapping between MPXJ resource fields and Primavera resource field names. @return mapping
[ "public static Map<FieldType, String> getDefaultResourceFieldMap()\n {\n Map<FieldType, String> map = new LinkedHashMap<FieldType, String>();\n\n map.put(ResourceField.UNIQUE_ID, \"rsrc_id\");\n map.put(ResourceField.GUID, \"guid\");\n map.put(ResourceField.NAME, \"rsrc_name\");\n map.put(ResourceField.CODE, \"employee_code\");\n map.put(ResourceField.EMAIL_ADDRESS, \"email_addr\");\n map.put(ResourceField.NOTES, \"rsrc_notes\");\n map.put(ResourceField.CREATED, \"create_date\");\n map.put(ResourceField.TYPE, \"rsrc_type\");\n map.put(ResourceField.INITIALS, \"rsrc_short_name\");\n map.put(ResourceField.PARENT_ID, \"parent_rsrc_id\");\n\n return map;\n }" ]
[ "private EndpointOverride getEndpointOverrideFromResultSet(ResultSet results) throws Exception {\n EndpointOverride endpoint = new EndpointOverride();\n endpoint.setPathId(results.getInt(Constants.GENERIC_ID));\n endpoint.setPath(results.getString(Constants.PATH_PROFILE_ACTUAL_PATH));\n endpoint.setBodyFilter(results.getString(Constants.PATH_PROFILE_BODY_FILTER));\n endpoint.setPathName(results.getString(Constants.PATH_PROFILE_PATHNAME));\n endpoint.setContentType(results.getString(Constants.PATH_PROFILE_CONTENT_TYPE));\n endpoint.setRequestType(results.getInt(Constants.PATH_PROFILE_REQUEST_TYPE));\n endpoint.setRepeatNumber(results.getInt(Constants.REQUEST_RESPONSE_REPEAT_NUMBER));\n endpoint.setGroupIds(results.getString(Constants.PATH_PROFILE_GROUP_IDS));\n endpoint.setRequestEnabled(results.getBoolean(Constants.REQUEST_RESPONSE_REQUEST_ENABLED));\n endpoint.setResponseEnabled(results.getBoolean(Constants.REQUEST_RESPONSE_RESPONSE_ENABLED));\n endpoint.setClientUUID(results.getString(Constants.GENERIC_CLIENT_UUID));\n endpoint.setProfileId(results.getInt(Constants.GENERIC_PROFILE_ID));\n endpoint.setGlobal(results.getBoolean(Constants.PATH_PROFILE_GLOBAL));\n return endpoint;\n }", "protected void updateStyle(BoxStyle bstyle, TextPosition text)\n {\n String font = text.getFont().getName();\n String family = null;\n String weight = null;\n String fstyle = null;\n\n bstyle.setFontSize(text.getFontSizeInPt());\n bstyle.setLineHeight(text.getHeight());\n\n if (font != null)\n {\n \t//font style and weight\n for (int i = 0; i < pdFontType.length; i++)\n {\n if (font.toLowerCase().lastIndexOf(pdFontType[i]) >= 0)\n {\n weight = cssFontWeight[i];\n fstyle = cssFontStyle[i];\n break;\n }\n }\n if (weight != null)\n \tbstyle.setFontWeight(weight);\n else\n \tbstyle.setFontWeight(cssFontWeight[0]);\n if (fstyle != null)\n \tbstyle.setFontStyle(fstyle);\n else\n \tbstyle.setFontStyle(cssFontStyle[0]);\n\n //font family\n //If it's a known common font don't embed in html output to save space\n String knownFontFamily = findKnownFontFamily(font);\n if (!knownFontFamily.equals(\"\"))\n family = knownFontFamily;\n else\n {\n family = fontTable.getUsedName(text.getFont());\n if (family == null)\n family = font;\n }\n\n if (family != null)\n \tbstyle.setFontFamily(family);\n }\n\n updateStyleForRenderingMode();\n }", "public void setSegmentReject(String reject) {\n\t\tif (!StringUtils.hasText(reject)) {\n\t\t\treturn;\n\t\t}\n\t\tInteger parsedLimit = null;\n\t\ttry {\n\t\t\tparsedLimit = Integer.parseInt(reject);\n\t\t\tsegmentRejectType = SegmentRejectType.ROWS;\n\t\t} catch (NumberFormatException e) {\n\t\t}\n\t\tif (parsedLimit == null && reject.contains(\"%\")) {\n\t\t\ttry {\n\t\t\t\tparsedLimit = Integer.parseInt(reject.replace(\"%\", \"\").trim());\n\t\t\t\tsegmentRejectType = SegmentRejectType.PERCENT;\n\t\t\t} catch (NumberFormatException e) {\n\t\t\t}\n\t\t}\n\t\tsegmentRejectLimit = parsedLimit;\n\t}", "public HttpRequestFactory makeClient(DatastoreOptions options) {\n Credential credential = options.getCredential();\n HttpTransport transport = options.getTransport();\n if (transport == null) {\n transport = credential == null ? new NetHttpTransport() : credential.getTransport();\n transport = transport == null ? new NetHttpTransport() : transport;\n }\n return transport.createRequestFactory(credential);\n }", "public static base_responses link(nitro_service client, sslcertkey resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tsslcertkey linkresources[] = new sslcertkey[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tlinkresources[i] = new sslcertkey();\n\t\t\t\tlinkresources[i].certkey = resources[i].certkey;\n\t\t\t\tlinkresources[i].linkcertkeyname = resources[i].linkcertkeyname;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, linkresources,\"link\");\n\t\t}\n\t\treturn result;\n\t}", "public GreenMailConfiguration build(Properties properties) {\n GreenMailConfiguration configuration = new GreenMailConfiguration();\n String usersParam = properties.getProperty(GREENMAIL_USERS);\n if (null != usersParam) {\n String[] usersArray = usersParam.split(\",\");\n for (String user : usersArray) {\n extractAndAddUser(configuration, user);\n }\n }\n String disabledAuthentication = properties.getProperty(GREENMAIL_AUTH_DISABLED);\n if (null != disabledAuthentication) {\n configuration.withDisabledAuthentication();\n }\n return configuration;\n }", "public void registerComponent(java.awt.Component c)\r\n {\r\n unregisterComponent(c);\r\n if (recognizerAbstractClass == null)\r\n {\r\n hmDragGestureRecognizers.put(c, \r\n dragSource.createDefaultDragGestureRecognizer(c, \r\n dragWorker.getAcceptableActions(c), dgListener)\r\n );\r\n }\r\n else\r\n {\r\n hmDragGestureRecognizers.put(c, \r\n dragSource.createDragGestureRecognizer (recognizerAbstractClass,\r\n c, dragWorker.getAcceptableActions(c), dgListener)\r\n );\r\n }\r\n }", "public void appointTempoMaster(int deviceNumber) throws IOException {\n final DeviceUpdate update = getLatestStatusFor(deviceNumber);\n if (update == null) {\n throw new IllegalArgumentException(\"Device \" + deviceNumber + \" not found on network.\");\n }\n appointTempoMaster(update);\n }", "public static AbstractBuild<?, ?> getRootBuild(AbstractBuild<?, ?> currentBuild) {\n AbstractBuild<?, ?> rootBuild = null;\n AbstractBuild<?, ?> parentBuild = getUpstreamBuild(currentBuild);\n while (parentBuild != null) {\n if (isPassIdentifiedDownstream(parentBuild)) {\n rootBuild = parentBuild;\n }\n parentBuild = getUpstreamBuild(parentBuild);\n }\n if (rootBuild == null && isPassIdentifiedDownstream(currentBuild)) {\n return currentBuild;\n }\n return rootBuild;\n }" ]
Determines if this value is the default value for the given field type. @param type field type @param value value @return true if the value is not default
[ "public static final boolean valueIsNotDefault(FieldType type, Object value)\n {\n boolean result = true;\n\n if (value == null)\n {\n result = false;\n }\n else\n {\n DataType dataType = type.getDataType();\n switch (dataType)\n {\n case BOOLEAN:\n {\n result = ((Boolean) value).booleanValue();\n break;\n }\n\n case CURRENCY:\n case NUMERIC:\n {\n result = !NumberHelper.equals(((Number) value).doubleValue(), 0.0, 0.00001);\n break;\n }\n\n case DURATION:\n {\n result = (((Duration) value).getDuration() != 0);\n break;\n }\n\n default:\n {\n break;\n }\n }\n }\n\n return result;\n }" ]
[ "public T removeBundle(final String moduleName, final String slot, final byte[] existingHash) {\n final ContentItem item = createBundleItem(moduleName, slot, NO_CONTENT);\n addContentModification(createContentModification(item, ModificationType.REMOVE, existingHash));\n return returnThis();\n }", "public static Cluster getCluster(ZkClient zkClient) {\n Cluster cluster = new Cluster();\n List<String> nodes = getChildrenParentMayNotExist(zkClient, BrokerIdsPath);\n for (String node : nodes) {\n final String brokerInfoString = readData(zkClient, BrokerIdsPath + \"/\" + node);\n cluster.add(Broker.createBroker(Integer.valueOf(node), brokerInfoString));\n }\n return cluster;\n }", "public static void unregisterMbean(MBeanServer server, ObjectName name) {\n try {\n server.unregisterMBean(name);\n } catch(Exception e) {\n logger.error(\"Error unregistering mbean\", e);\n }\n }", "public static void withInstance(String url, Closure c) throws SQLException {\n Sql sql = null;\n try {\n sql = newInstance(url);\n c.call(sql);\n } finally {\n if (sql != null) sql.close();\n }\n }", "private int getReplicaTypeForPartition(int partitionId) {\n List<Integer> routingPartitionList = routingStrategy.getReplicatingPartitionList(partitionId);\n\n // Determine if we should host this partition, and if so, whether we are a primary,\n // secondary or n-ary replica for it\n int correctReplicaType = -1;\n for (int replica = 0; replica < routingPartitionList.size(); replica++) {\n if(nodePartitionIds.contains(routingPartitionList.get(replica))) {\n // This means the partitionId currently being iterated on should be hosted\n // by this node. Let's remember its replica type in order to make sure the\n // files we have are properly named.\n correctReplicaType = replica;\n break;\n }\n }\n\n return correctReplicaType;\n }", "public Deployment setServerGroups(final Collection<String> serverGroups) {\n this.serverGroups.clear();\n this.serverGroups.addAll(serverGroups);\n return this;\n }", "protected Violation createViolationForImport(SourceCode sourceCode, String className, String alias, String violationMessage) {\n Map importInfo = ImportUtil.sourceLineAndNumberForImport(sourceCode, className, alias);\n Violation violation = new Violation();\n violation.setRule(this);\n violation.setSourceLine((String) importInfo.get(\"sourceLine\"));\n violation.setLineNumber((Integer) importInfo.get(\"lineNumber\"));\n violation.setMessage(violationMessage);\n return violation;\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 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 }" ]
Generate a VideoCollection with random data obtained form VIDEO_INFO map. You don't need o create your own AdapteeCollections. Review ListAdapteeCollection if needed. @param videoCount size of the collection. @return VideoCollection generated.
[ "public VideoCollection generate(final int videoCount) {\n List<Video> videos = new LinkedList<Video>();\n for (int i = 0; i < videoCount; i++) {\n Video video = generateRandomVideo();\n videos.add(video);\n }\n return new VideoCollection(videos);\n }" ]
[ "private static int readObjectData(int offset, String text, List<RTFEmbeddedObject> objects)\n {\n LinkedList<byte[]> blocks = new LinkedList<byte[]>();\n\n offset += (OBJDATA.length());\n offset = skipEndOfLine(text, offset);\n int length;\n int lastOffset = offset;\n\n while (offset != -1)\n {\n length = getBlockLength(text, offset);\n lastOffset = readDataBlock(text, offset, length, blocks);\n offset = skipEndOfLine(text, lastOffset);\n }\n\n RTFEmbeddedObject headerObject;\n RTFEmbeddedObject dataObject;\n\n while (blocks.isEmpty() == false)\n {\n headerObject = new RTFEmbeddedObject(blocks, 2);\n objects.add(headerObject);\n\n if (blocks.isEmpty() == false)\n {\n dataObject = new RTFEmbeddedObject(blocks, headerObject.getTypeFlag2());\n objects.add(dataObject);\n }\n }\n\n return (lastOffset);\n }", "private void tryRefreshAccessToken(final Long reqStartedAt) {\n authLock.writeLock().lock();\n try {\n if (!isLoggedIn()) {\n throw new StitchClientException(StitchClientErrorCode.LOGGED_OUT_DURING_REQUEST);\n }\n\n try {\n final Jwt jwt = Jwt.fromEncoded(getAuthInfo().getAccessToken());\n if (jwt.getIssuedAt() >= reqStartedAt) {\n return;\n }\n } catch (final IOException e) {\n // Swallow\n }\n\n // retry\n refreshAccessToken();\n } finally {\n authLock.writeLock().unlock();\n }\n }", "public void unlock() {\n String queryString = new QueryStringBuilder().appendParam(\"fields\", \"lock\").toString();\n URL url = FILE_URL_TEMPLATE.buildWithQuery(this.getAPI().getBaseURL(), queryString, this.getID());\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"PUT\");\n\n JsonObject lockObject = new JsonObject();\n lockObject.add(\"lock\", JsonObject.NULL);\n\n request.setBody(lockObject.toString());\n request.send();\n }", "private static boolean containsGreekLetter(String s) {\r\n Matcher m = biogreek.matcher(s);\r\n return m.find();\r\n }", "private void initHasMasterMode() throws CmsException {\n\n if (hasDescriptor()\n && m_cms.hasPermissions(m_desc, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL)) {\n m_hasMasterMode = true;\n } else {\n m_hasMasterMode = false;\n }\n }", "private void readResource(Document.Resources.Resource resource)\n {\n Resource mpxjResource = m_projectFile.addResource();\n mpxjResource.setName(resource.getName());\n mpxjResource.setResourceCalendar(m_calendarMap.get(resource.getCalendarID()));\n mpxjResource.setStandardRate(new Rate(resource.getCost(), resource.getCostTimeUnit()));\n mpxjResource.setEmailAddress(resource.getEMail());\n mpxjResource.setGroup(resource.getGroup());\n //resource.getHyperlinks()\n mpxjResource.setUniqueID(resource.getID());\n //resource.getMarkerID()\n mpxjResource.setNotes(resource.getNote());\n mpxjResource.setID(Integer.valueOf(resource.getOutlineNumber()));\n //resource.getStyleProject()\n mpxjResource.setType(resource.getSubType() == null ? resource.getType() : resource.getSubType());\n }", "public static base_responses disable(nitro_service client, String trapname[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (trapname != null && trapname.length > 0) {\n\t\t\tsnmpalarm disableresources[] = new snmpalarm[trapname.length];\n\t\t\tfor (int i=0;i<trapname.length;i++){\n\t\t\t\tdisableresources[i] = new snmpalarm();\n\t\t\t\tdisableresources[i].trapname = trapname[i];\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, disableresources,\"disable\");\n\t\t}\n\t\treturn result;\n\t}", "public static autoscaleprofile[] get(nitro_service service) throws Exception{\n\t\tautoscaleprofile obj = new autoscaleprofile();\n\t\tautoscaleprofile[] response = (autoscaleprofile[])obj.get_resources(service);\n\t\treturn response;\n\t}", "private CompiledStatement assignStatementArguments(CompiledStatement stmt) throws SQLException {\n\t\tboolean ok = false;\n\t\ttry {\n\t\t\tif (limit != null) {\n\t\t\t\t// we use this if SQL statement LIMITs are not supported by this database type\n\t\t\t\tstmt.setMaxRows(limit.intValue());\n\t\t\t}\n\t\t\t// set any arguments if we are logging our object\n\t\t\tObject[] argValues = null;\n\t\t\tif (logger.isLevelEnabled(Level.TRACE) && argHolders.length > 0) {\n\t\t\t\targValues = new Object[argHolders.length];\n\t\t\t}\n\t\t\tfor (int i = 0; i < argHolders.length; i++) {\n\t\t\t\tObject argValue = argHolders[i].getSqlArgValue();\n\t\t\t\tFieldType fieldType = argFieldTypes[i];\n\t\t\t\tSqlType sqlType;\n\t\t\t\tif (fieldType == null) {\n\t\t\t\t\tsqlType = argHolders[i].getSqlType();\n\t\t\t\t} else {\n\t\t\t\t\tsqlType = fieldType.getSqlType();\n\t\t\t\t}\n\t\t\t\tstmt.setObject(i, argValue, sqlType);\n\t\t\t\tif (argValues != null) {\n\t\t\t\t\targValues[i] = argValue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlogger.debug(\"prepared statement '{}' with {} args\", statement, argHolders.length);\n\t\t\tif (argValues != null) {\n\t\t\t\t// need to do the (Object) cast to force args to be a single object\n\t\t\t\tlogger.trace(\"prepared statement arguments: {}\", (Object) argValues);\n\t\t\t}\n\t\t\tok = true;\n\t\t\treturn stmt;\n\t\t} finally {\n\t\t\tif (!ok) {\n\t\t\t\tIOUtils.closeThrowSqlException(stmt, \"statement\");\n\t\t\t}\n\t\t}\n\t}" ]
Extracts the postal code, country code and service code from the primary data and returns the corresponding primary message codewords. @return the primary message codewords
[ "private int[] getPrimaryCodewords() {\r\n\r\n assert mode == 2 || mode == 3;\r\n\r\n if (primaryData.length() != 15) {\r\n throw new OkapiException(\"Invalid Primary String\");\r\n }\r\n\r\n for (int i = 9; i < 15; i++) { /* check that country code and service are numeric */\r\n if (primaryData.charAt(i) < '0' || primaryData.charAt(i) > '9') {\r\n throw new OkapiException(\"Invalid Primary String\");\r\n }\r\n }\r\n\r\n String postcode;\r\n if (mode == 2) {\r\n postcode = primaryData.substring(0, 9);\r\n int index = postcode.indexOf(' ');\r\n if (index != -1) {\r\n postcode = postcode.substring(0, index);\r\n }\r\n } else {\r\n // if (mode == 3)\r\n postcode = primaryData.substring(0, 6);\r\n }\r\n\r\n int country = Integer.parseInt(primaryData.substring(9, 12));\r\n int service = Integer.parseInt(primaryData.substring(12, 15));\r\n\r\n if (debug) {\r\n System.out.println(\"Using mode \" + mode);\r\n System.out.println(\" Postcode: \" + postcode);\r\n System.out.println(\" Country Code: \" + country);\r\n System.out.println(\" Service: \" + service);\r\n }\r\n\r\n if (mode == 2) {\r\n return getMode2PrimaryCodewords(postcode, country, service);\r\n } else { // mode == 3\r\n return getMode3PrimaryCodewords(postcode, country, service);\r\n }\r\n }" ]
[ "public static vpnglobal_intranetip_binding[] get(nitro_service service) throws Exception{\n\t\tvpnglobal_intranetip_binding obj = new vpnglobal_intranetip_binding();\n\t\tvpnglobal_intranetip_binding response[] = (vpnglobal_intranetip_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "public static int getDayAsReadableInt(Calendar calendar) {\n int day = calendar.get(Calendar.DAY_OF_MONTH);\n int month = calendar.get(Calendar.MONTH) + 1;\n int year = calendar.get(Calendar.YEAR);\n return year * 10000 + month * 100 + day;\n }", "public static authenticationradiusaction[] get(nitro_service service) throws Exception{\n\t\tauthenticationradiusaction obj = new authenticationradiusaction();\n\t\tauthenticationradiusaction[] response = (authenticationradiusaction[])obj.get_resources(service);\n\t\treturn response;\n\t}", "public double getCouponPayment(int periodIndex, AnalyticModel model) {\n\n\t\tForwardCurve forwardCurve = model.getForwardCurve(forwardCurveName);\n\t\tif(forwardCurve == null && forwardCurveName != null && forwardCurveName.length() > 0) {\n\t\t\tthrow new IllegalArgumentException(\"No forward curve with name '\" + forwardCurveName + \"' was found in the model:\\n\" + model.toString());\n\t\t}\n\n\t\tdouble periodLength\t= schedule.getPeriodLength(periodIndex);\n\t\tdouble couponPayment=fixedCoupon ;\n\t\tif(forwardCurve != null ) {\n\t\t\tcouponPayment = floatingSpread+forwardCurve.getForward(model, schedule.getFixing(periodIndex));\n\t\t}\n\t\treturn couponPayment*periodLength;\n\t}", "private String formatDateTimeNull(Date value)\n {\n return (value == null ? m_formats.getNullText() : m_formats.getDateTimeFormat().format(value));\n }", "public static void append(Path self, Object text) throws IOException {\n Writer writer = null;\n try {\n writer = new OutputStreamWriter(Files.newOutputStream(self, CREATE, APPEND), Charset.defaultCharset());\n InvokerHelper.write(writer, text);\n writer.flush();\n\n Writer temp = writer;\n writer = null;\n temp.close();\n } finally {\n closeWithWarning(writer);\n }\n }", "private static ResourceBundle tryBundle(String baseName, Locale locale, boolean wantBase) {\n\n I_CmsResourceBundle first = null; // The most specialized bundle.\n I_CmsResourceBundle last = null; // The least specialized bundle.\n\n List<String> bundleNames = CmsLocaleManager.getLocaleVariants(baseName, locale, true, true);\n for (String bundleName : bundleNames) {\n // break if we would try the base bundle, but we do not want it directly\n if (bundleName.equals(baseName) && !wantBase && (first == null)) {\n break;\n }\n I_CmsResourceBundle foundBundle = tryBundle(bundleName);\n if (foundBundle != null) {\n if (first == null) {\n first = foundBundle;\n }\n\n if (last != null) {\n last.setParent((ResourceBundle)foundBundle);\n }\n foundBundle.setLocale(locale);\n\n last = foundBundle;\n }\n }\n return (ResourceBundle)first;\n }", "private void doFileRoll(final File from, final File to) {\n final FileHelper fileHelper = FileHelper.getInstance();\n if (!fileHelper.deleteExisting(to)) {\n this.getAppender().getErrorHandler()\n .error(\"Unable to delete existing \" + to + \" for rename\");\n }\n final String original = from.toString();\n if (fileHelper.rename(from, to)) {\n LogLog.debug(\"Renamed \" + original + \" to \" + to);\n } else {\n this.getAppender().getErrorHandler()\n .error(\"Unable to rename \" + original + \" to \" + to);\n }\n }", "public static systemcore get(nitro_service service) throws Exception{\n\t\tsystemcore obj = new systemcore();\n\t\tsystemcore[] response = (systemcore[])obj.get_resources(service);\n\t\treturn response[0];\n\t}" ]
Binds the Identities Primary key values to the statement.
[ "public void bindSelect(PreparedStatement stmt, Identity oid, ClassDescriptor cld, boolean callableStmt) throws SQLException\r\n {\r\n ValueContainer[] values = null;\r\n int i = 0;\r\n int j = 0;\r\n\r\n if (cld == null)\r\n {\r\n cld = m_broker.getClassDescriptor(oid.getObjectsRealClass());\r\n }\r\n try\r\n {\r\n if(callableStmt)\r\n {\r\n // First argument is the result set\r\n m_platform.registerOutResultSet((CallableStatement) stmt, 1);\r\n j++;\r\n }\r\n\r\n values = getKeyValues(m_broker, cld, oid);\r\n for (/*void*/; i < values.length; i++, j++)\r\n {\r\n setObjectForStatement(stmt, j + 1, values[i].getValue(), values[i].getJdbcType().getType());\r\n }\r\n }\r\n catch (SQLException e)\r\n {\r\n m_log.error(\"bindSelect failed for: \" + oid.toString() + \", PK: \" + i + \", value: \" + values[i]);\r\n throw e;\r\n }\r\n }" ]
[ "public void sub(Vector3d v1) {\n x -= v1.x;\n y -= v1.y;\n z -= v1.z;\n }", "public void checkConstraints(String checkLevel) throws ConstraintException\r\n {\r\n // check constraints now after all classes have been processed\r\n for (Iterator it = getClasses(); it.hasNext();)\r\n {\r\n ((ClassDescriptorDef)it.next()).checkConstraints(checkLevel);\r\n }\r\n // additional model constraints that either deal with bigger parts of the model or\r\n // can only be checked after the individual classes have been checked (e.g. specific\r\n // attributes have been ensured)\r\n new ModelConstraints().check(this, checkLevel);\r\n }", "public static Comparator getComparator()\r\n {\r\n return new Comparator()\r\n {\r\n public int compare(Object o1, Object o2)\r\n {\r\n FieldDescriptor fmd1 = (FieldDescriptor) o1;\r\n FieldDescriptor fmd2 = (FieldDescriptor) o2;\r\n if (fmd1.getColNo() < fmd2.getColNo())\r\n {\r\n return -1;\r\n }\r\n else if (fmd1.getColNo() > fmd2.getColNo())\r\n {\r\n return 1;\r\n }\r\n else\r\n {\r\n return 0;\r\n }\r\n }\r\n };\r\n }", "public String getTitle(Locale locale)\n {\n String result = null;\n\n if (m_title != null)\n {\n result = m_title;\n }\n else\n {\n if (m_fieldType != null)\n {\n result = m_project.getCustomFields().getCustomField(m_fieldType).getAlias();\n if (result == null)\n {\n result = m_fieldType.getName(locale);\n }\n }\n }\n\n return (result);\n }", "public static void addToString(\n SourceBuilder code,\n Datatype datatype,\n Map<Property, PropertyCodeGenerator> generatorsByProperty,\n boolean forPartial) {\n String typename = (forPartial ? \"partial \" : \"\") + datatype.getType().getSimpleName();\n Predicate<PropertyCodeGenerator> isOptional = generator -> {\n Initially initially = generator.initialState();\n return (initially == Initially.OPTIONAL || (initially == Initially.REQUIRED && forPartial));\n };\n boolean anyOptional = generatorsByProperty.values().stream().anyMatch(isOptional);\n boolean allOptional = generatorsByProperty.values().stream().allMatch(isOptional)\n && !generatorsByProperty.isEmpty();\n\n code.addLine(\"\")\n .addLine(\"@%s\", Override.class)\n .addLine(\"public %s toString() {\", String.class);\n if (allOptional) {\n bodyWithBuilderAndSeparator(code, datatype, generatorsByProperty, typename);\n } else if (anyOptional) {\n bodyWithBuilder(code, datatype, generatorsByProperty, typename, isOptional);\n } else {\n bodyWithConcatenation(code, generatorsByProperty, typename);\n }\n code.addLine(\"}\");\n }", "public void setPropertyDestinationType(Class<?> clazz, String propertyName,\r\n\t\t\tTypeReference<?> destinationType) {\r\n\t\tpropertiesDestinationTypes.put(new ClassProperty(clazz, propertyName), destinationType);\r\n\t}", "private static List<Integer> stripNodeIds(List<Node> nodeList) {\n List<Integer> nodeidList = new ArrayList<Integer>();\n if(nodeList != null) {\n for(Node node: nodeList) {\n nodeidList.add(node.getId());\n }\n }\n return nodeidList;\n }", "public static HorizontalBandAlignment buildAligment(byte aligment){\n\t\tif (aligment == RIGHT.getAlignment())\n\t\t\treturn RIGHT;\n\t\telse if (aligment == LEFT.getAlignment())\n\t\t\treturn LEFT;\n\t\telse if (aligment == CENTER.getAlignment())\n\t\t\treturn CENTER;\n\n\t\treturn LEFT;\n\t}", "private AsyncResourceRequest<V> getNextUnexpiredResourceRequest(Queue<AsyncResourceRequest<V>> requestQueue) {\n AsyncResourceRequest<V> resourceRequest = requestQueue.poll();\n while(resourceRequest != null) {\n if(resourceRequest.getDeadlineNs() < System.nanoTime()) {\n resourceRequest.handleTimeout();\n resourceRequest = requestQueue.poll();\n } else {\n break;\n }\n }\n return resourceRequest;\n }" ]
Returns if a request should be retried based on the retry count, current response, and the current strategy. @param retryCount The current retry attempt count. @param response The exception that caused the retry conditions to occur. @return true if the request should be retried; false otherwise.
[ "@Override\n public boolean shouldRetry(int retryCount, Response response) {\n int code = response.code();\n //CHECKSTYLE IGNORE MagicNumber FOR NEXT 2 LINES\n return retryCount < this.retryCount\n && (code == 408 || (code >= 500 && code != 501 && code != 505));\n }" ]
[ "protected I_CmsSearchConfigurationFacetField parseFieldFacet(JSONObject fieldFacetObject) {\n\n try {\n String field = fieldFacetObject.getString(JSON_KEY_FACET_FIELD);\n String name = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_NAME);\n String label = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_LABEL);\n Integer minCount = parseOptionalIntValue(fieldFacetObject, JSON_KEY_FACET_MINCOUNT);\n Integer limit = parseOptionalIntValue(fieldFacetObject, JSON_KEY_FACET_LIMIT);\n String prefix = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_PREFIX);\n String sorder = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_ORDER);\n I_CmsSearchConfigurationFacet.SortOrder order;\n try {\n order = I_CmsSearchConfigurationFacet.SortOrder.valueOf(sorder);\n } catch (Exception e) {\n order = null;\n }\n String filterQueryModifier = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_FILTERQUERYMODIFIER);\n Boolean isAndFacet = parseOptionalBooleanValue(fieldFacetObject, JSON_KEY_FACET_ISANDFACET);\n List<String> preselection = parseOptionalStringValues(fieldFacetObject, JSON_KEY_FACET_PRESELECTION);\n Boolean ignoreFilterAllFacetFilters = parseOptionalBooleanValue(\n fieldFacetObject,\n JSON_KEY_FACET_IGNOREALLFACETFILTERS);\n return new CmsSearchConfigurationFacetField(\n field,\n name,\n minCount,\n limit,\n prefix,\n label,\n order,\n filterQueryModifier,\n isAndFacet,\n preselection,\n ignoreFilterAllFacetFilters);\n } catch (JSONException e) {\n LOG.error(\n Messages.get().getBundle().key(Messages.ERR_FIELD_FACET_MANDATORY_KEY_MISSING_1, JSON_KEY_FACET_FIELD),\n e);\n return null;\n }\n }", "public String save() {\n JsonObject state = new JsonObject()\n .add(\"accessToken\", this.accessToken)\n .add(\"refreshToken\", this.refreshToken)\n .add(\"lastRefresh\", this.lastRefresh)\n .add(\"expires\", this.expires)\n .add(\"userAgent\", this.userAgent)\n .add(\"tokenURL\", this.tokenURL)\n .add(\"baseURL\", this.baseURL)\n .add(\"baseUploadURL\", this.baseUploadURL)\n .add(\"autoRefresh\", this.autoRefresh)\n .add(\"maxRequestAttempts\", this.maxRequestAttempts);\n return state.toString();\n }", "public static PersistenceBroker createPersistenceBroker(String jcdAlias,\r\n String user,\r\n String password) throws PBFactoryException\r\n {\r\n return PersistenceBrokerFactoryFactory.instance().\r\n createPersistenceBroker(jcdAlias, user, password);\r\n }", "@PostConstruct\n public void loadTagDefinitions()\n {\n Map<Addon, List<URL>> addonToResourcesMap = scanner.scanForAddonMap(new FileExtensionFilter(\"tags.xml\"));\n for (Map.Entry<Addon, List<URL>> entry : addonToResourcesMap.entrySet())\n {\n for (URL resource : entry.getValue())\n {\n log.info(\"Reading tags definitions from: \" + resource.toString() + \" from addon \" + entry.getKey().getId());\n try(InputStream is = resource.openStream())\n {\n tagService.readTags(is);\n }\n catch( Exception ex )\n {\n throw new WindupException(\"Failed reading tags definition: \" + resource.toString() + \" from addon \" + entry.getKey().getId() + \":\\n\" + ex.getMessage(), ex);\n }\n }\n }\n }", "public static ProxyMetaClass getInstance(Class theClass) throws IntrospectionException {\n MetaClassRegistry metaRegistry = GroovySystem.getMetaClassRegistry();\n MetaClass meta = metaRegistry.getMetaClass(theClass);\n return new ProxyMetaClass(metaRegistry, theClass, meta);\n }", "public static List<String> getChildrenParentMayNotExist(ZkClient zkClient, String path) {\n try {\n return zkClient.getChildren(path);\n } catch (ZkNoNodeException e) {\n return null;\n }\n }", "public static void doBatchEnqueue(final Jedis jedis, final String namespace, final String queue, final List<String> jobJsons) {\n Pipeline pipelined = jedis.pipelined();\n pipelined.sadd(JesqueUtils.createKey(namespace, QUEUES), queue);\n for (String jobJson : jobJsons) {\n pipelined.rpush(JesqueUtils.createKey(namespace, QUEUE, queue), jobJson);\n }\n pipelined.sync();\n }", "public static int getIbanLength(final CountryCode countryCode) {\n final BbanStructure structure = getBbanStructure(countryCode);\n return COUNTRY_CODE_LENGTH + CHECK_DIGIT_LENGTH + structure.getBbanLength();\n }", "private synchronized void finishTransition(final InternalState current, final InternalState next) {\n internalSetState(getTransitionTask(next), current, next);\n transition();\n }" ]
Enables or disables auto closing when selecting a date.
[ "public void setAutoClose(boolean autoClose) {\n this.autoClose = autoClose;\n\n if (autoCloseHandlerRegistration != null) {\n autoCloseHandlerRegistration.removeHandler();\n autoCloseHandlerRegistration = null;\n }\n\n if (autoClose) {\n autoCloseHandlerRegistration = registerHandler(addValueChangeHandler(event -> close()));\n }\n }" ]
[ "@VisibleForTesting\n @Nullable\n protected LineSymbolizer createLineSymbolizer(final PJsonObject styleJson) {\n final Stroke stroke = createStroke(styleJson, true);\n if (stroke == null) {\n return null;\n } else {\n return this.styleBuilder.createLineSymbolizer(stroke);\n }\n }", "public String getHostAddress() {\n if( addr instanceof NbtAddress ) {\n return ((NbtAddress)addr).getHostAddress();\n }\n return ((InetAddress)addr).getHostAddress();\n }", "private Integer getNextOrdinalForMethodId(int methodId, String pathName) throws Exception {\n String pathInfo = doGet(BASE_PATH + uriEncode(pathName), new BasicNameValuePair[0]);\n JSONObject pathResponse = new JSONObject(pathInfo);\n\n JSONArray enabledEndpoints = pathResponse.getJSONArray(\"enabledEndpoints\");\n int lastOrdinal = 0;\n for (int x = 0; x < enabledEndpoints.length(); x++) {\n if (enabledEndpoints.getJSONObject(x).getInt(\"overrideId\") == methodId) {\n lastOrdinal++;\n }\n }\n return lastOrdinal + 1;\n }", "public int size(final K1 firstKey) {\n\t\t// existence check on inner map\n\t\tfinal HashMap<K2, HashMap<K3, V>> innerMap = map.get(firstKey);\n\t\tif( innerMap == null ) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn innerMap.size();\n\t}", "public static csvserver_spilloverpolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tcsvserver_spilloverpolicy_binding obj = new csvserver_spilloverpolicy_binding();\n\t\tobj.set_name(name);\n\t\tcsvserver_spilloverpolicy_binding response[] = (csvserver_spilloverpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "public EventBus emitAsync(Enum<?> event, Object... args) {\n return _emitWithOnceBus(eventContextAsync(event, args));\n }", "void onEndTypeChange() {\n\n EndType endType = m_model.getEndType();\n m_groupDuration.selectButton(getDurationButtonForType(endType));\n switch (endType) {\n case DATE:\n case TIMES:\n m_durationPanel.setVisible(true);\n m_seriesEndDate.setValue(m_model.getSeriesEndDate());\n int occurrences = m_model.getOccurrences();\n if (!m_occurrences.isFocused()) {\n m_occurrences.setFormValueAsString(occurrences > 0 ? \"\" + occurrences : \"\");\n }\n break;\n default:\n m_durationPanel.setVisible(false);\n break;\n }\n updateExceptions();\n }", "public void put(String key, String value) {\n synchronized (this.cache) {\n this.cache.put(key, value);\n }\n }", "public AsciiTable setPaddingLeft(int paddingLeft) {\r\n\t\tfor(AT_Row row : this.rows){\r\n\t\t\tif(row.getType()==TableRowType.CONTENT){\r\n\t\t\t\trow.setPaddingLeft(paddingLeft);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}" ]
Record the checkout wait time in us @param dest Destination of the socket to checkout. Will actually record if null. Otherwise will call this on self and corresponding child with this param null. @param checkoutTimeUs The number of us to wait before getting a socket
[ "public void recordCheckoutTimeUs(SocketDestination dest, long checkoutTimeUs) {\n if(dest != null) {\n getOrCreateNodeStats(dest).recordCheckoutTimeUs(null, checkoutTimeUs);\n recordCheckoutTimeUs(null, checkoutTimeUs);\n } else {\n this.checkoutTimeRequestCounter.addRequest(checkoutTimeUs * Time.NS_PER_US);\n }\n }" ]
[ "private String format(Object o)\n {\n String result;\n\n if (o == null)\n {\n result = \"\";\n }\n else\n {\n if (o instanceof Boolean == true)\n {\n result = LocaleData.getString(m_locale, (((Boolean) o).booleanValue() == true ? LocaleData.YES : LocaleData.NO));\n }\n else\n {\n if (o instanceof Float == true || o instanceof Double == true)\n {\n result = (m_formats.getDecimalFormat().format(((Number) o).doubleValue()));\n }\n else\n {\n if (o instanceof Day)\n {\n result = Integer.toString(((Day) o).getValue());\n }\n else\n {\n result = o.toString();\n }\n }\n }\n\n //\n // At this point there should be no line break characters in\n // the file. If we find any, replace them with spaces\n //\n result = stripLineBreaks(result, MPXConstants.EOL_PLACEHOLDER_STRING);\n\n //\n // Finally we check to ensure that there are no embedded\n // quotes or separator characters in the value. If there are, then\n // we quote the value and escape any existing quote characters.\n //\n if (result.indexOf('\"') != -1)\n {\n result = escapeQuotes(result);\n }\n else\n {\n if (result.indexOf(m_delimiter) != -1)\n {\n result = '\"' + result + '\"';\n }\n }\n }\n\n return (result);\n }", "protected void parseIntegerLists(TokenList tokens) {\n TokenList.Token t = tokens.getFirst();\n if( t == null || t.next == null )\n return;\n\n int state = 0;\n\n TokenList.Token start = null;\n TokenList.Token prev = t;\n\n boolean last = false;\n while( true ) {\n if( state == 0 ) {\n if( isVariableInteger(t) ) {\n start = t;\n state = 1;\n }\n } else if( state == 1 ) {\n // var ?\n if( isVariableInteger(t)) { // see if its explicit number sequence\n state = 2;\n } else { // just scalar integer, skip\n state = 0;\n }\n } else if ( state == 2 ) {\n // var var ....\n if( !isVariableInteger(t) ) {\n // create explicit list sequence\n IntegerSequence sequence = new IntegerSequence.Explicit(start,prev);\n VariableIntegerSequence varSequence = functions.getManagerTemp().createIntegerSequence(sequence);\n replaceSequence(tokens, varSequence, start, prev);\n state = 0;\n }\n }\n\n if( last ) {\n break;\n } else if( t.next == null ) {\n // handle the case where it is the last token in the sequence\n last = true;\n }\n prev = t;\n t = t.next;\n }\n }", "public void addControl(String name, JSONObject properties, Widget.OnTouchListener listener) {\n final JSONObject allowedProperties = new JSONObject();\n put(allowedProperties, Widget.Properties.name, optString(properties, Widget.Properties.name));\n put(allowedProperties, Widget.Properties.size, new PointF(mControlDimensions.x, mControlDimensions.y));\n put(allowedProperties, Widget.Properties.states, optJSONObject(properties, Widget.Properties.states));\n\n Widget control = new Widget(getGVRContext(), allowedProperties);\n setupControl(name, control, listener, -1);\n }", "public synchronized void stop() {\n if (isRunning()) {\n try {\n setSendingStatus(false);\n } catch (Throwable t) {\n logger.error(\"Problem stopping sending status during shutdown\", t);\n }\n DeviceFinder.getInstance().removeIgnoredAddress(socket.get().getLocalAddress());\n socket.get().close();\n socket.set(null);\n broadcastAddress.set(null);\n updates.clear();\n setTempoMaster(null);\n setDeviceNumber((byte)0); // Set up for self-assignment if restarted.\n deliverLifecycleAnnouncement(logger, false);\n }\n }", "private static String getPath(Service service, Annotation... qualifiers) {\n for (Annotation q : qualifiers) {\n if (q instanceof Scheme) {\n return ((Scheme) q).value();\n }\n }\n\n if (service.getMetadata() != null && service.getMetadata().getAnnotations() != null) {\n String s = service.getMetadata().getAnnotations().get(SERVICE_SCHEME);\n if (s != null && s.isEmpty()) {\n return s;\n }\n }\n return DEFAULT_PATH;\n }", "public void execute() {\n State currentState = state.getAndSet(State.RUNNING);\n if (currentState == State.RUNNING) {\n throw new IllegalStateException(\n \"ExecutionChain is already running!\");\n }\n executeRunnable = new ExecuteRunnable();\n }", "public static <T> Iterator<T> concat(Iterator<? extends Iterator<? extends T>> iterators) {\n Preconditions.checkArgumentNotNull(iterators, \"iterators\");\n return new CombinedIterator<T>(iterators);\n }", "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 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 }" ]
Update a variable name with a date if the variable is detected as being a date. @param variableName the variable name. @param date the date to replace the value with if the variable is a date variable.
[ "public static String findReplacement(final String variableName, final Date date) {\n if (variableName.equalsIgnoreCase(\"date\")) {\n return cleanUpName(DateFormat.getDateInstance().format(date));\n } else if (variableName.equalsIgnoreCase(\"datetime\")) {\n return cleanUpName(DateFormat.getDateTimeInstance().format(date));\n } else if (variableName.equalsIgnoreCase(\"time\")) {\n return cleanUpName(DateFormat.getTimeInstance().format(date));\n } else {\n try {\n return new SimpleDateFormat(variableName).format(date);\n } catch (Exception e) {\n LOGGER.error(\"Unable to format timestamp according to pattern: {}\", variableName, e);\n return \"${\" + variableName + \"}\";\n }\n }\n }" ]
[ "public void hide() {\n div.removeFromParent();\n if (scrollDisabled) {\n RootPanel.get().getElement().getStyle().setOverflow(Style.Overflow.AUTO);\n }\n if (type == LoaderType.CIRCULAR) {\n preLoader.removeFromParent();\n } else if (type == LoaderType.PROGRESS) {\n progress.removeFromParent();\n }\n }", "@Override\n public CompletableFuture<Map<String, Change<?>>> diff(Revision from, Revision to, String pathPattern) {\n final ServiceRequestContext ctx = context();\n return CompletableFuture.supplyAsync(() -> {\n requireNonNull(from, \"from\");\n requireNonNull(to, \"to\");\n requireNonNull(pathPattern, \"pathPattern\");\n\n failFastIfTimedOut(this, logger, ctx, \"diff\", from, to, pathPattern);\n\n final RevisionRange range = normalizeNow(from, to).toAscending();\n readLock();\n try (RevWalk rw = new RevWalk(jGitRepository)) {\n final RevTree treeA = rw.parseTree(commitIdDatabase.get(range.from()));\n final RevTree treeB = rw.parseTree(commitIdDatabase.get(range.to()));\n\n // Compare the two Git trees.\n // Note that we do not cache here because CachingRepository caches the final result already.\n return toChangeMap(blockingCompareTreesUncached(treeA, treeB,\n pathPatternFilterOrTreeFilter(pathPattern)));\n } catch (StorageException e) {\n throw e;\n } catch (Exception e) {\n throw new StorageException(\"failed to parse two trees: range=\" + range, e);\n } finally {\n readUnlock();\n }\n }, repositoryWorker);\n }", "public static boolean isPostJDK5(String bytecodeVersion) {\n return JDK5.equals(bytecodeVersion)\n || JDK6.equals(bytecodeVersion)\n || JDK7.equals(bytecodeVersion)\n || JDK8.equals(bytecodeVersion);\n }", "public BoxFileUploadSession.Info createUploadSession(long fileSize) {\n URL url = UPLOAD_SESSION_URL_TEMPLATE.build(this.getAPI().getBaseUploadURL(), this.getID());\n\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, \"POST\");\n request.addHeader(\"Content-Type\", \"application/json\");\n\n JsonObject body = new JsonObject();\n body.add(\"file_size\", fileSize);\n request.setBody(body.toString());\n\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject jsonObject = JsonObject.readFrom(response.getJSON());\n\n String sessionId = jsonObject.get(\"id\").asString();\n BoxFileUploadSession session = new BoxFileUploadSession(this.getAPI(), sessionId);\n return session.new Info(jsonObject);\n }", "private void readTaskCustomPropertyDefinitions(Tasks gpTasks)\n {\n for (Taskproperty definition : gpTasks.getTaskproperties().getTaskproperty())\n {\n //\n // Ignore everything but custom values\n //\n if (!\"custom\".equals(definition.getType()))\n {\n continue;\n }\n\n //\n // Find the next available field of the correct type.\n //\n String type = definition.getValuetype();\n FieldType fieldType = TASK_PROPERTY_TYPES.get(type).getField();\n\n //\n // If we have run out of fields of the right type, try using a text field.\n //\n if (fieldType == null)\n {\n fieldType = TASK_PROPERTY_TYPES.get(\"text\").getField();\n }\n\n //\n // If we actually have a field available, set the alias to match\n // the name used in GanttProject.\n //\n if (fieldType != null)\n {\n CustomField field = m_projectFile.getCustomFields().getCustomField(fieldType);\n field.setAlias(definition.getName());\n String defaultValue = definition.getDefaultvalue();\n if (defaultValue != null && defaultValue.isEmpty())\n {\n defaultValue = null;\n }\n m_taskPropertyDefinitions.put(definition.getId(), new Pair<FieldType, String>(fieldType, defaultValue));\n }\n }\n }", "public static String encodeQueryParam(String queryParam, String encoding) throws UnsupportedEncodingException {\n\t\treturn HierarchicalUriComponents.encodeUriComponent(queryParam, encoding, HierarchicalUriComponents.Type.QUERY_PARAM);\n\t}", "public void setLabels(Collection<LabelType> labels) {\r\n this.labels.clear();\r\n if (labels != null) {\r\n this.labels.addAll(labels);\r\n }\r\n }", "protected I_CmsSearchDocument createDefaultIndexDocument() {\n\n try {\n return m_index.getFieldConfiguration().createDocument(m_cms, m_res, m_index, null);\n } catch (CmsException e) {\n LOG.error(\n \"Default document for \"\n + m_res.getRootPath()\n + \" and index \"\n + m_index.getName()\n + \" could not be created.\",\n e);\n return null;\n }\n }", "public double estimateExcludedVolumeFraction(){\n\t\t//Calculate volume/area of the of the scene without obstacles\n\t\tif(recalculateVolumeFraction){\n\t\t\tCentralRandomNumberGenerator r = CentralRandomNumberGenerator.getInstance();\n\t\t\tboolean firstRandomDraw = false;\n\t\t\tif(randomNumbers==null){\n\t\t\t\trandomNumbers = new double[nRandPoints*dimension];\n\t\t\t\tfirstRandomDraw = true;\n\t\t\t}\n\t\t\tint countCollision = 0;\n\t\t\tfor(int i = 0; i< nRandPoints; i++){\n\t\t\t\tdouble[] pos = new double[dimension];\n\t\t\t\tfor(int j = 0; j < dimension; j++){\n\t\t\t\t\tif(firstRandomDraw){\n\t\t\t\t\t\trandomNumbers[i*dimension + j] = r.nextDouble();\n\t\t\t\t\t}\n\t\t\t\t\tpos[j] = randomNumbers[i*dimension + j]*size[j];\n\t\t\t\t}\n\t\t\t\tif(checkCollision(pos)){\n\t\t\t\t\tcountCollision++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfraction = countCollision*1.0/nRandPoints;\n\t\t\trecalculateVolumeFraction = false;\n\t\t}\n\t\treturn fraction;\n\t}" ]
Initialize VIDEO_INFO data.
[ "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 }" ]
[ "private void checkCollectionForeignkeys(ModelDef modelDef, String checkLevel) throws ConstraintException\r\n {\r\n if (CHECKLEVEL_NONE.equals(checkLevel))\r\n {\r\n return;\r\n }\r\n\r\n ClassDescriptorDef classDef;\r\n CollectionDescriptorDef collDef;\r\n\r\n for (Iterator it = modelDef.getClasses(); it.hasNext();)\r\n {\r\n classDef = (ClassDescriptorDef)it.next();\r\n for (Iterator collIt = classDef.getCollections(); collIt.hasNext();)\r\n {\r\n collDef = (CollectionDescriptorDef)collIt.next();\r\n if (!collDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_IGNORE, false))\r\n {\r\n if (collDef.hasProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE))\r\n {\r\n checkIndirectionTable(modelDef, collDef);\r\n }\r\n else\r\n { \r\n checkCollectionForeignkeys(modelDef, collDef);\r\n }\r\n }\r\n }\r\n }\r\n }", "public int blast(InputStream input, OutputStream output) throws IOException\n {\n m_input = input;\n m_output = output;\n\n int lit; /* true if literals are coded */\n int dict; /* log2(dictionary size) - 6 */\n int symbol; /* decoded symbol, extra bits for distance */\n int len; /* length for copy */\n int dist; /* distance for copy */\n int copy; /* copy counter */\n //unsigned char *from, *to; /* copy pointers */\n\n /* read header */\n lit = bits(8);\n if (lit > 1)\n {\n return -1;\n }\n dict = bits(8);\n if (dict < 4 || dict > 6)\n {\n return -2;\n }\n\n /* decode literals and length/distance pairs */\n do\n {\n if (bits(1) != 0)\n {\n /* get length */\n symbol = decode(LENCODE);\n len = BASE[symbol] + bits(EXTRA[symbol]);\n if (len == 519)\n {\n break; /* end code */\n }\n\n /* get distance */\n symbol = len == 2 ? 2 : dict;\n dist = decode(DISTCODE) << symbol;\n dist += bits(symbol);\n dist++;\n if (m_first != 0 && dist > m_next)\n {\n return -3; /* distance too far back */\n }\n\n /* copy length bytes from distance bytes back */\n do\n {\n //to = m_out + m_next;\n int to = m_next;\n int from = to - dist;\n copy = MAXWIN;\n if (m_next < dist)\n {\n from += copy;\n copy = dist;\n }\n copy -= m_next;\n if (copy > len)\n {\n copy = len;\n }\n len -= copy;\n m_next += copy;\n do\n {\n //*to++ = *from++;\n m_out[to++] = m_out[from++];\n }\n while (--copy != 0);\n if (m_next == MAXWIN)\n {\n //if (s->outfun(s->outhow, s->out, s->next)) return 1;\n m_output.write(m_out, 0, m_next);\n m_next = 0;\n m_first = 0;\n }\n }\n while (len != 0);\n }\n else\n {\n /* get literal and write it */\n symbol = lit != 0 ? decode(LITCODE) : bits(8);\n m_out[m_next++] = (byte) symbol;\n if (m_next == MAXWIN)\n {\n //if (s->outfun(s->outhow, s->out, s->next)) return 1;\n m_output.write(m_out, 0, m_next);\n m_next = 0;\n m_first = 0;\n }\n }\n }\n while (true);\n\n if (m_next != 0)\n {\n m_output.write(m_out, 0, m_next);\n }\n\n return 0;\n }", "public void clearMarkers() {\n if (markers != null && !markers.isEmpty()) {\n markers.forEach((m) -> {\n m.setMap(null);\n });\n markers.clear();\n }", "protected List<Versioned<V>> resolveAndConstructVersionsToPersist(List<Versioned<V>> valuesInStorage,\n List<Versioned<V>> multiPutValues) {\n List<Versioned<V>> obsoleteVals = new ArrayList<Versioned<V>>(multiPutValues.size());\n // Go over all the values and determine whether the version is\n // acceptable\n for(Versioned<V> value: multiPutValues) {\n Iterator<Versioned<V>> iter = valuesInStorage.iterator();\n boolean obsolete = false;\n // Compare the current version with a set of accepted versions\n while(iter.hasNext()) {\n Versioned<V> curr = iter.next();\n Occurred occurred = value.getVersion().compare(curr.getVersion());\n if(occurred == Occurred.BEFORE) {\n obsolete = true;\n break;\n } else if(occurred == Occurred.AFTER) {\n iter.remove();\n }\n }\n if(obsolete) {\n // add to return value if obsolete\n obsoleteVals.add(value);\n } else {\n // else update the set of accepted versions\n valuesInStorage.add(value);\n }\n }\n\n return obsoleteVals;\n }", "@Override public Integer getOffset(Integer id, Integer type)\n {\n Integer result = null;\n\n Map<Integer, Integer> map = m_table.get(id);\n if (map != null && type != null)\n {\n result = map.get(type);\n }\n\n return (result);\n }", "private PBKey buildDefaultKey()\r\n {\r\n List descriptors = connectionRepository().getAllDescriptor();\r\n JdbcConnectionDescriptor descriptor;\r\n PBKey result = null;\r\n for (Iterator iterator = descriptors.iterator(); iterator.hasNext();)\r\n {\r\n descriptor = (JdbcConnectionDescriptor) iterator.next();\r\n if (descriptor.isDefaultConnection())\r\n {\r\n if(result != null)\r\n {\r\n log.error(\"Found additional connection descriptor with enabled 'default-connection' \"\r\n + descriptor.getPBKey() + \". This is NOT allowed. Will use the first found descriptor \" + result\r\n + \" as default connection\");\r\n }\r\n else\r\n {\r\n result = descriptor.getPBKey();\r\n }\r\n }\r\n }\r\n\r\n if(result == null)\r\n {\r\n log.info(\"No 'default-connection' attribute set in jdbc-connection-descriptors,\" +\r\n \" thus it's currently not possible to use 'defaultPersistenceBroker()' \" +\r\n \" convenience method to lookup PersistenceBroker instances. But it's possible\"+\r\n \" to enable this at runtime using 'setDefaultKey' method.\");\r\n }\r\n return result;\r\n }", "public static boolean ensureJedisConnection(final Jedis jedis) {\n final boolean jedisOK = testJedisConnection(jedis);\n if (!jedisOK) {\n try {\n jedis.quit();\n } catch (Exception e) {\n } // Ignore\n try {\n jedis.disconnect();\n } catch (Exception e) {\n } // Ignore\n jedis.connect();\n }\n return jedisOK;\n }", "public void signIn(String key, WebSocketConnection connection) {\n ConcurrentMap<WebSocketConnection, WebSocketConnection> bag = ensureConnectionList(key);\n bag.put(connection, connection);\n }", "@Override\n public Map<String, String> values() {\n Map<String, String> values = new LinkedHashMap<>();\n for (Row each : delegates) {\n for (Entry<String, String> entry : each.values().entrySet()) {\n String name = entry.getKey();\n if (!values.containsKey(name)) {\n values.put(name, entry.getValue());\n }\n }\n }\n return values;\n }" ]
Sets a parameter for the creator.
[ "public AbstractSqlCreator setParameter(String name, Object value) {\n ppsc.setParameter(name, value);\n return this;\n }" ]
[ "private List<String> generateDateTimePatterns(String datePattern, String[] timePatterns)\n {\n List<String> patterns = new ArrayList<String>();\n for (String timePattern : timePatterns)\n {\n patterns.add(datePattern + \" \" + timePattern);\n }\n\n // Always fall back on the date-only pattern\n patterns.add(datePattern);\n\n return patterns;\n }", "public synchronized void abortTransaction() throws TransactionNotInProgressException\n {\n if(isInTransaction())\n {\n fireBrokerEvent(BEFORE_ROLLBACK_EVENT);\n setInTransaction(false);\n clearRegistrationLists();\n referencesBroker.removePrefetchingListeners();\n /*\n arminw:\n check if we in local tx, before do local rollback\n Necessary, because ConnectionManager may do a rollback by itself\n or in managed environments the used connection is already be closed\n */\n if(connectionManager.isInLocalTransaction()) this.connectionManager.localRollback();\n fireBrokerEvent(AFTER_ROLLBACK_EVENT);\n }\n }", "private SortedSet<Date> filterExceptions(SortedSet<Date> dates) {\n\n SortedSet<Date> result = new TreeSet<Date>();\n for (Date d : dates) {\n if (!m_exceptions.contains(d)) {\n result.add(d);\n }\n }\n return result;\n }", "public static sslcertkey get(nitro_service service, String certkey) throws Exception{\n\t\tsslcertkey obj = new sslcertkey();\n\t\tobj.set_certkey(certkey);\n\t\tsslcertkey response = (sslcertkey) obj.get_resource(service);\n\t\treturn response;\n\t}", "private Pair<Cluster, List<StoreDefinition>> getCurrentClusterState() {\n\n // Retrieve the latest cluster metadata from the existing nodes\n Versioned<Cluster> currentVersionedCluster = adminClient.rebalanceOps.getLatestCluster(Utils.nodeListToNodeIdList(Lists.newArrayList(adminClient.getAdminClientCluster()\n .getNodes())));\n Cluster cluster = currentVersionedCluster.getValue();\n List<StoreDefinition> storeDefs = adminClient.rebalanceOps.getCurrentStoreDefinitions(cluster);\n return new Pair<Cluster, List<StoreDefinition>>(cluster, storeDefs);\n }", "boolean isUserPasswordReset(CmsUser user) {\n\n if (USER_PASSWORD_STATUS.containsKey(user.getId())) { //Check if user was checked before\n if (!USER_PASSWORD_STATUS.get(user.getId()).booleanValue()) { // was false before, false->true is never done without changing map\n return false;\n }\n if (m_checkedUserPasswordReset.contains(user.getId())) { //was true before, true->false happens when user resets password. Only check one time per table load.\n return true; //Set gets flushed on reloading table\n }\n }\n CmsUser currentUser = user;\n if (user.getAdditionalInfo().size() < 3) {\n\n try {\n currentUser = m_cms.readUser(user.getId());\n } catch (CmsException e) {\n LOG.error(\"Can not read user\", e);\n }\n }\n if (currentUser.getAdditionalInfo(CmsUserSettings.ADDITIONAL_INFO_PASSWORD_RESET) != null) {\n USER_PASSWORD_STATUS.put(currentUser.getId(), new Boolean(true));\n m_checkedUserPasswordReset.add(currentUser.getId());\n return true;\n }\n USER_PASSWORD_STATUS.put(currentUser.getId(), new Boolean(false));\n return false;\n }", "public static base_response export(nitro_service client, appfwlearningdata resource) throws Exception {\n\t\tappfwlearningdata exportresource = new appfwlearningdata();\n\t\texportresource.profilename = resource.profilename;\n\t\texportresource.securitycheck = resource.securitycheck;\n\t\texportresource.target = resource.target;\n\t\treturn exportresource.perform_operation(client,\"export\");\n\t}", "private void writeInterfaceCriteria(final XMLExtendedStreamWriter writer, final ModelNode subModel, final boolean nested) throws XMLStreamException {\n for (final Property property : subModel.asPropertyList()) {\n if (property.getValue().isDefined()) {\n writeInterfaceCriteria(writer, property, nested);\n }\n }\n }", "public <CT> CT callBatchTasks(ConnectionSource connectionSource, Callable<CT> callable) throws SQLException {\n\t\tif (connectionSource.isSingleConnection(tableInfo.getTableName())) {\n\t\t\tsynchronized (this) {\n\t\t\t\treturn doCallBatchTasks(connectionSource, callable);\n\t\t\t}\n\t\t} else {\n\t\t\treturn doCallBatchTasks(connectionSource, callable);\n\t\t}\n\t}" ]
Given a field node, checks if we are calling a private field from an inner class.
[ "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 }" ]
[ "protected ClassDescriptor selectClassDescriptor(Map row) throws PersistenceBrokerException\r\n {\r\n ClassDescriptor result = m_cld;\r\n Class ojbConcreteClass = (Class) row.get(OJB_CONCRETE_CLASS_KEY);\r\n if(ojbConcreteClass != null)\r\n {\r\n result = m_cld.getRepository().getDescriptorFor(ojbConcreteClass);\r\n // if we can't find class-descriptor for concrete class, something wrong with mapping\r\n if (result == null)\r\n {\r\n throw new PersistenceBrokerException(\"Can't find class-descriptor for ojbConcreteClass '\"\r\n + ojbConcreteClass + \"', the main class was \" + m_cld.getClassNameOfObject());\r\n }\r\n }\r\n return result;\r\n }", "public void print( String equation ) {\n // first assume it's just a variable\n Variable v = lookupVariable(equation);\n if( v == null ) {\n Sequence sequence = compile(equation,false,false);\n sequence.perform();\n v = sequence.output;\n }\n\n if( v instanceof VariableMatrix ) {\n ((VariableMatrix)v).matrix.print();\n } else if(v instanceof VariableScalar ) {\n System.out.println(\"Scalar = \"+((VariableScalar)v).getDouble() );\n } else {\n System.out.println(\"Add support for \"+v.getClass().getSimpleName());\n }\n }", "protected void registerValueFormatter(DJGroupVariable djVariable, String variableName) {\n\t\tif ( djVariable.getValueFormatter() == null){\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tJRDesignParameter dparam = new JRDesignParameter();\n\t\tdparam.setName(variableName + \"_vf\"); //value formater suffix\n\t\tdparam.setValueClassName(DJValueFormatter.class.getName());\n\t\tlog.debug(\"Registering value formatter parameter for property \" + dparam.getName() );\n\t\ttry {\n\t\t\tgetDjd().addParameter(dparam);\n\t\t} catch (JRException e) {\n\t\t\tthrow new EntitiesRegistrationException(e.getMessage(),e);\n\t\t}\n\t\tgetDjd().getParametersWithValues().put(dparam.getName(), djVariable.getValueFormatter());\t\t\n\t\t\n\t}", "public static Timespan create(Timespan... timespans) {\n if (timespans == null) {\n return null;\n }\n\n if (timespans.length == 0) {\n return ZERO_MILLISECONDS;\n }\n\n Timespan res = timespans[0];\n\n for (int i = 1; i < timespans.length; i++) {\n Timespan timespan = timespans[i];\n res = res.add(timespan);\n }\n\n return res;\n }", "@SuppressWarnings(\"WeakerAccess\")\n public synchronized void stop() {\n if (isRunning()) {\n MetadataFinder.getInstance().removeTrackMetadataListener(metadataListener);\n running.set(false);\n pendingUpdates.clear();\n queueHandler.interrupt();\n queueHandler = null;\n\n // Report the loss of our waveforms, on the proper thread, outside our lock\n final Set<DeckReference> dyingPreviewCache = new HashSet<DeckReference>(previewHotCache.keySet());\n previewHotCache.clear();\n final Set<DeckReference> dyingDetailCache = new HashSet<DeckReference>(detailHotCache.keySet());\n detailHotCache.clear();\n SwingUtilities.invokeLater(new Runnable() {\n @Override\n public void run() {\n for (DeckReference deck : dyingPreviewCache) { // Report the loss of our previews.\n if (deck.hotCue == 0) {\n deliverWaveformPreviewUpdate(deck.player, null);\n }\n }\n for (DeckReference deck : dyingDetailCache) { // Report the loss of our details.\n if (deck.hotCue == 0) {\n deliverWaveformDetailUpdate(deck.player, null);\n }\n }\n }\n });\n deliverLifecycleAnnouncement(logger, false);\n }\n }", "public void fillRectangle(Rectangle rect, Color color) {\n\t\ttemplate.saveState();\n\t\tsetFill(color);\n\t\ttemplate.rectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight());\n\t\ttemplate.fill();\n\t\ttemplate.restoreState();\n\t}", "public CollectionRequest<Project> findByTeam(String team) {\n \n String path = String.format(\"/teams/%s/projects\", team);\n return new CollectionRequest<Project>(this, Project.class, path, \"GET\");\n }", "private List<TimephasedWork> splitWork(CostRateTable table, ProjectCalendar calendar, TimephasedWork work, int rateIndex)\n {\n List<TimephasedWork> result = new LinkedList<TimephasedWork>();\n work.setTotalAmount(Duration.getInstance(0, work.getAmountPerDay().getUnits()));\n\n while (true)\n {\n CostRateTableEntry rate = table.get(rateIndex);\n Date splitDate = rate.getEndDate();\n if (splitDate.getTime() >= work.getFinish().getTime())\n {\n result.add(work);\n break;\n }\n\n Date currentPeriodEnd = calendar.getPreviousWorkFinish(splitDate);\n\n TimephasedWork currentPeriod = new TimephasedWork(work);\n currentPeriod.setFinish(currentPeriodEnd);\n result.add(currentPeriod);\n\n Date nextPeriodStart = calendar.getNextWorkStart(splitDate);\n work.setStart(nextPeriodStart);\n\n ++rateIndex;\n }\n\n return result;\n }", "public static base_responses delete(nitro_service client, appfwlearningdata resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tappfwlearningdata deleteresources[] = new appfwlearningdata[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tdeleteresources[i] = new appfwlearningdata();\n\t\t\t\tdeleteresources[i].profilename = resources[i].profilename;\n\t\t\t\tdeleteresources[i].starturl = resources[i].starturl;\n\t\t\t\tdeleteresources[i].cookieconsistency = resources[i].cookieconsistency;\n\t\t\t\tdeleteresources[i].fieldconsistency = resources[i].fieldconsistency;\n\t\t\t\tdeleteresources[i].formactionurl_ffc = resources[i].formactionurl_ffc;\n\t\t\t\tdeleteresources[i].crosssitescripting = resources[i].crosssitescripting;\n\t\t\t\tdeleteresources[i].formactionurl_xss = resources[i].formactionurl_xss;\n\t\t\t\tdeleteresources[i].sqlinjection = resources[i].sqlinjection;\n\t\t\t\tdeleteresources[i].formactionurl_sql = resources[i].formactionurl_sql;\n\t\t\t\tdeleteresources[i].fieldformat = resources[i].fieldformat;\n\t\t\t\tdeleteresources[i].formactionurl_ff = resources[i].formactionurl_ff;\n\t\t\t\tdeleteresources[i].csrftag = resources[i].csrftag;\n\t\t\t\tdeleteresources[i].csrfformoriginurl = resources[i].csrfformoriginurl;\n\t\t\t\tdeleteresources[i].xmldoscheck = resources[i].xmldoscheck;\n\t\t\t\tdeleteresources[i].xmlwsicheck = resources[i].xmlwsicheck;\n\t\t\t\tdeleteresources[i].xmlattachmentcheck = resources[i].xmlattachmentcheck;\n\t\t\t\tdeleteresources[i].totalxmlrequests = resources[i].totalxmlrequests;\n\t\t\t}\n\t\t\tresult = delete_bulk_request(client, deleteresources);\n\t\t}\n\t\treturn result;\n\t}" ]
Updates metadata versions on stores. @param adminClient An instance of AdminClient points to given cluster @param oldStoreDefs List of old store definitions @param newStoreDefs List of new store definitions
[ "public static void doMetaUpdateVersionsOnStores(AdminClient adminClient,\n List<StoreDefinition> oldStoreDefs,\n List<StoreDefinition> newStoreDefs) {\n Set<String> storeNamesUnion = new HashSet<String>();\n Map<String, StoreDefinition> oldStoreDefinitionMap = new HashMap<String, StoreDefinition>();\n Map<String, StoreDefinition> newStoreDefinitionMap = new HashMap<String, StoreDefinition>();\n List<String> storesChanged = new ArrayList<String>();\n for(StoreDefinition storeDef: oldStoreDefs) {\n String storeName = storeDef.getName();\n storeNamesUnion.add(storeName);\n oldStoreDefinitionMap.put(storeName, storeDef);\n }\n for(StoreDefinition storeDef: newStoreDefs) {\n String storeName = storeDef.getName();\n storeNamesUnion.add(storeName);\n newStoreDefinitionMap.put(storeName, storeDef);\n }\n for(String storeName: storeNamesUnion) {\n StoreDefinition oldStoreDef = oldStoreDefinitionMap.get(storeName);\n StoreDefinition newStoreDef = newStoreDefinitionMap.get(storeName);\n if(oldStoreDef == null && newStoreDef != null || oldStoreDef != null\n && newStoreDef == null || oldStoreDef != null && newStoreDef != null\n && !oldStoreDef.equals(newStoreDef)) {\n storesChanged.add(storeName);\n }\n }\n System.out.println(\"Updating metadata version for the following stores: \"\n + storesChanged);\n try {\n adminClient.metadataMgmtOps.updateMetadataversion(adminClient.getAdminClientCluster()\n .getNodeIds(),\n storesChanged);\n } catch(Exception e) {\n System.err.println(\"Error while updating metadata version for the specified store.\");\n }\n }" ]
[ "public String calculateCacheKey(String sql, int[] columnIndexes) {\r\n\t\tStringBuilder tmp = new StringBuilder(sql.length()+4);\r\n\t\ttmp.append(sql);\r\n\t\tfor (int i=0; i < columnIndexes.length; i++){\r\n\t\t\ttmp.append(columnIndexes[i]);\r\n\t\t\ttmp.append(\"CI,\");\r\n\t\t}\r\n\t\treturn tmp.toString();\r\n\t}", "@Override\n public Object[] getAgentPlans(String agent_name, Connector connector) {\n // Not supported in JADE\n connector.getLogger().warning(\"Non suported method for Jade Platform. There is no plans in Jade platform.\");\n throw new java.lang.UnsupportedOperationException(\"Non suported method for Jade Platform. There is no extra properties.\");\n }", "public void setPerms(String photoId, Permissions permissions) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_SET_PERMS);\r\n\r\n parameters.put(\"photo_id\", photoId);\r\n parameters.put(\"is_public\", permissions.isPublicFlag() ? \"1\" : \"0\");\r\n parameters.put(\"is_friend\", permissions.isFriendFlag() ? \"1\" : \"0\");\r\n parameters.put(\"is_family\", permissions.isFamilyFlag() ? \"1\" : \"0\");\r\n parameters.put(\"perm_comment\", Integer.toString(permissions.getComment()));\r\n parameters.put(\"perm_addmeta\", Integer.toString(permissions.getAddmeta()));\r\n\r\n Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n }", "public void remove( Token token ) {\n if( token == first ) {\n first = first.next;\n }\n if( token == last ) {\n last = last.previous;\n }\n if( token.next != null ) {\n token.next.previous = token.previous;\n }\n if( token.previous != null ) {\n token.previous.next = token.next;\n }\n\n token.next = token.previous = null;\n size--;\n }", "public EventBus emitSync(String event, Object... args) {\n return _emitWithOnceBus(eventContextSync(event, args));\n }", "public static List<Number> findIndexValues(Object self, Number startIndex, Closure closure) {\n List<Number> result = new ArrayList<Number>();\n long count = 0;\n long startCount = startIndex.longValue();\n BooleanClosureWrapper bcw = new BooleanClosureWrapper(closure);\n for (Iterator iter = InvokerHelper.asIterator(self); iter.hasNext(); count++) {\n Object value = iter.next();\n if (count < startCount) {\n continue;\n }\n if (bcw.call(value)) {\n result.add(count);\n }\n }\n return result;\n }", "protected AbsoluteURI getGeneratedLocation(PersistedTrace trace) {\n\t\tAbsoluteURI path = trace.getPath();\n\t\tString fileName = traceFileNameProvider.getJavaFromTrace(path.getURI().toString());\n\t\treturn new AbsoluteURI(fileName);\n\t}", "public void recordGetAllTime(long timeNS,\n int requested,\n int returned,\n long totalValueBytes,\n long totalKeyBytes) {\n recordTime(Tracked.GET_ALL,\n timeNS,\n requested - returned,\n totalValueBytes,\n totalKeyBytes,\n requested);\n }", "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 }" ]
Parse duration time units. Note that we don't differentiate between confirmed and unconfirmed durations. Unrecognised duration types are default the supplied default value. @param value BigInteger value @param defaultValue if value is null, use this value as the result @return Duration units
[ "public static final TimeUnit parseDurationTimeUnits(BigInteger value, TimeUnit defaultValue)\n {\n TimeUnit result = defaultValue;\n\n if (value != null)\n {\n switch (value.intValue())\n {\n case 3:\n case 35:\n {\n result = TimeUnit.MINUTES;\n break;\n }\n\n case 4:\n case 36:\n {\n result = TimeUnit.ELAPSED_MINUTES;\n break;\n }\n\n case 5:\n case 37:\n {\n result = TimeUnit.HOURS;\n break;\n }\n\n case 6:\n case 38:\n {\n result = TimeUnit.ELAPSED_HOURS;\n break;\n }\n\n case 7:\n case 39:\n case 53:\n {\n result = TimeUnit.DAYS;\n break;\n }\n\n case 8:\n case 40:\n {\n result = TimeUnit.ELAPSED_DAYS;\n break;\n }\n\n case 9:\n case 41:\n {\n result = TimeUnit.WEEKS;\n break;\n }\n\n case 10:\n case 42:\n {\n result = TimeUnit.ELAPSED_WEEKS;\n break;\n }\n\n case 11:\n case 43:\n {\n result = TimeUnit.MONTHS;\n break;\n }\n\n case 12:\n case 44:\n {\n result = TimeUnit.ELAPSED_MONTHS;\n break;\n }\n\n case 19:\n case 51:\n {\n result = TimeUnit.PERCENT;\n break;\n }\n\n case 20:\n case 52:\n {\n result = TimeUnit.ELAPSED_PERCENT;\n break;\n }\n\n default:\n {\n result = PARENT_FILE.get().getProjectProperties().getDefaultDurationUnits();\n break;\n }\n }\n }\n\n return (result);\n }" ]
[ "public static final Bytes of(byte[] data, int offset, int length) {\n Objects.requireNonNull(data);\n if (length == 0) {\n return EMPTY;\n }\n byte[] copy = new byte[length];\n System.arraycopy(data, offset, copy, 0, length);\n return new Bytes(copy);\n }", "@Override\n public void setCursorDepth(float depth)\n {\n super.setCursorDepth(depth);\n if (mRayModel != null)\n {\n mRayModel.getTransform().setScaleZ(mCursorDepth);\n }\n }", "private void processActivityCodes(Storepoint storepoint)\n {\n for (Code code : storepoint.getActivityCodes().getCode())\n {\n int sequence = 0;\n for (Value value : code.getValue())\n {\n UUID uuid = getUUID(value.getUuid(), value.getName());\n m_activityCodeValues.put(uuid, value.getName());\n m_activityCodeSequence.put(uuid, Integer.valueOf(++sequence));\n }\n }\n }", "public RandomVariable getValues(double evaluationTime, LIBORMarketModel model) {\n\t\tif(evaluationTime > 0) {\n\t\t\tthrow new RuntimeException(\"Forward start evaluation currently not supported.\");\n\t\t}\n\n\t\t// Fetch the covariance model of the model\n\t\tLIBORCovarianceModel covarianceModel = model.getCovarianceModel();\n\n\t\t// We sum over all forward rates\n\t\tint numberOfComponents = covarianceModel.getLiborPeriodDiscretization().getNumberOfTimeSteps();\n\n\t\t// Accumulator\n\t\tRandomVariable\tintegratedLIBORCurvature\t= new RandomVariableFromDoubleArray(0.0);\n\t\tfor(int componentIndex = 0; componentIndex < numberOfComponents; componentIndex++) {\n\n\t\t\t// Integrate from 0 up to the fixing of the rate\n\t\t\tdouble timeEnd\t\t= covarianceModel.getLiborPeriodDiscretization().getTime(componentIndex);\n\t\t\tint timeEndIndex\t= covarianceModel.getTimeDiscretization().getTimeIndex(timeEnd);\n\n\t\t\t// If timeEnd is not in the time discretization we get timeEndIndex = -insertionPoint-1. In that case, we use the index prior to the insertionPoint\n\t\t\tif(timeEndIndex < 0) {\n\t\t\t\ttimeEndIndex = -timeEndIndex - 2;\n\t\t\t}\n\n\t\t\t// Sum squared second derivative of the variance for all components at this time step\n\t\t\tRandomVariable integratedLIBORCurvatureCurrentRate = new RandomVariableFromDoubleArray(0.0);\n\t\t\tfor(int timeIndex = 0; timeIndex < timeEndIndex-2; timeIndex++) {\n\t\t\t\tdouble timeStep1\t= covarianceModel.getTimeDiscretization().getTimeStep(timeIndex);\n\t\t\t\tdouble timeStep2\t= covarianceModel.getTimeDiscretization().getTimeStep(timeIndex+1);\n\n\t\t\t\tRandomVariable covarianceLeft\t\t= covarianceModel.getCovariance(timeIndex+0, componentIndex, componentIndex, null);\n\t\t\t\tRandomVariable covarianceCenter\t= covarianceModel.getCovariance(timeIndex+1, componentIndex, componentIndex, null);\n\t\t\t\tRandomVariable covarianceRight\t\t= covarianceModel.getCovariance(timeIndex+2, componentIndex, componentIndex, null);\n\n\t\t\t\t// Calculate second derivative\n\t\t\t\tRandomVariable curvatureSquared = covarianceRight.sub(covarianceCenter.mult(2.0)).add(covarianceLeft);\n\t\t\t\tcurvatureSquared = curvatureSquared.div(timeStep1 * timeStep2);\n\n\t\t\t\t// Take square\n\t\t\t\tcurvatureSquared = curvatureSquared.squared();\n\n\t\t\t\t// Integrate over time\n\t\t\t\tintegratedLIBORCurvatureCurrentRate = integratedLIBORCurvatureCurrentRate.add(curvatureSquared.mult(timeStep1));\n\t\t\t}\n\n\t\t\t// Empty intervall - skip\n\t\t\tif(timeEnd == 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Average over time\n\t\t\tintegratedLIBORCurvatureCurrentRate = integratedLIBORCurvatureCurrentRate.div(timeEnd);\n\n\t\t\t// Take square root\n\t\t\tintegratedLIBORCurvatureCurrentRate = integratedLIBORCurvatureCurrentRate.sqrt();\n\n\t\t\t// Take max over all forward rates\n\t\t\tintegratedLIBORCurvature = integratedLIBORCurvature.add(integratedLIBORCurvatureCurrentRate);\n\t\t}\n\n\t\tintegratedLIBORCurvature = integratedLIBORCurvature.div(numberOfComponents);\n\t\treturn integratedLIBORCurvature.sub(tolerance).floor(0.0);\n\t}", "public double[][] getU() {\n double[][] X = new double[n][n];\n double[][] U = X;\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (i <= j) {\n U[i][j] = LU[i][j];\n } else {\n U[i][j] = 0.0;\n }\n }\n }\n return X;\n }", "@Override\n @SuppressFBWarnings(value = \"UL_UNRELEASED_LOCK\", justification = \"False positive from FindBugs\")\n public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) {\n if (!isActive()) {\n throw new ContextNotActiveException();\n }\n checkContextInitialized();\n final BeanStore beanStore = getBeanStore();\n if (beanStore == null) {\n return null;\n }\n if (contextual == null) {\n throw ContextLogger.LOG.contextualIsNull();\n }\n BeanIdentifier id = getId(contextual);\n ContextualInstance<T> beanInstance = beanStore.get(id);\n if (beanInstance != null) {\n return beanInstance.getInstance();\n } else if (creationalContext != null) {\n LockedBean lock = null;\n try {\n if (multithreaded) {\n lock = beanStore.lock(id);\n beanInstance = beanStore.get(id);\n if (beanInstance != null) {\n return beanInstance.getInstance();\n }\n }\n T instance = contextual.create(creationalContext);\n if (instance != null) {\n beanInstance = new SerializableContextualInstanceImpl<Contextual<T>, T>(contextual, instance, creationalContext, serviceRegistry.get(ContextualStore.class));\n beanStore.put(id, beanInstance);\n }\n return instance;\n } finally {\n if (lock != null) {\n lock.unlock();\n }\n }\n } else {\n return null;\n }\n }", "protected synchronized void quit() {\n log.debug(\"Stopping {}\", getName());\n closeServerSocket();\n\n // Close all handlers. Handler threads terminate if run loop exits\n synchronized (handlers) {\n for (ProtocolHandler handler : handlers) {\n handler.close();\n }\n handlers.clear();\n }\n log.debug(\"Stopped {}\", getName());\n }", "@Override public Object instantiateItem(ViewGroup parent, int position) {\n T content = getItem(position);\n rendererBuilder.withContent(content);\n rendererBuilder.withParent(parent);\n rendererBuilder.withLayoutInflater(LayoutInflater.from(parent.getContext()));\n Renderer<T> renderer = rendererBuilder.build();\n if (renderer == null) {\n throw new NullRendererBuiltException(\"RendererBuilder have to return a not null Renderer\");\n }\n updateRendererExtraValues(content, renderer, position);\n renderer.render();\n View view = renderer.getRootView();\n parent.addView(view);\n return view;\n }", "private I_CmsSearchIndex getIndex() {\n\n I_CmsSearchIndex index = null;\n // get the configured index or the selected index\n if (isInitialCall()) {\n // the search form is in the initial state\n // get the configured index\n index = OpenCms.getSearchManager().getIndex(getSettings().getUserSettings().getWorkplaceSearchIndexName());\n } else {\n // the search form is not in the inital state, the submit button was used already or the\n // search index was changed already\n // get the selected index in the search dialog\n index = OpenCms.getSearchManager().getIndex(getJsp().getRequest().getParameter(\"indexName.0\"));\n }\n return index;\n }" ]
Check if we still need more nodes from the given zone and reduce the zoneReplicationFactor count accordingly. @param requiredRepFactor @param zoneId @return
[ "private boolean checkZoneRequirement(HashMap<Integer, Integer> requiredRepFactor, int zoneId) {\n if(requiredRepFactor.containsKey(zoneId)) {\n if(requiredRepFactor.get(zoneId) == 0) {\n return false;\n } else {\n requiredRepFactor.put(zoneId, requiredRepFactor.get(zoneId) - 1);\n return true;\n }\n }\n return false;\n\n }" ]
[ "private List<Entity> runQuery(Query query) throws DatastoreException {\n RunQueryRequest.Builder request = RunQueryRequest.newBuilder();\n request.setQuery(query);\n RunQueryResponse response = datastore.runQuery(request.build());\n\n if (response.getBatch().getMoreResults() == QueryResultBatch.MoreResultsType.NOT_FINISHED) {\n System.err.println(\"WARNING: partial results\\n\");\n }\n List<EntityResult> results = response.getBatch().getEntityResultsList();\n List<Entity> entities = new ArrayList<Entity>(results.size());\n for (EntityResult result : results) {\n entities.add(result.getEntity());\n }\n return entities;\n }", "private void clearDeck(CdjStatus update) {\n if (hotCache.remove(DeckReference.getDeckReference(update.getDeviceNumber(), 0)) != null) {\n deliverTrackMetadataUpdate(update.getDeviceNumber(), null);\n }\n }", "public static base_responses add(nitro_service client, dnspolicylabel resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tdnspolicylabel addresources[] = new dnspolicylabel[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new dnspolicylabel();\n\t\t\t\taddresources[i].labelname = resources[i].labelname;\n\t\t\t\taddresources[i].transform = resources[i].transform;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "@RequestMapping(value = \"api/edit/enable/custom\", method = RequestMethod.POST)\n public\n @ResponseBody\n String enableCustomResponse(Model model, String custom, int path_id,\n @RequestParam(defaultValue = Constants.PROFILE_CLIENT_DEFAULT_ID) String clientUUID) throws Exception {\n if (custom.equals(\"undefined\"))\n return null;\n editService.enableCustomResponse(custom, path_id, clientUUID);\n return null;\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 }", "protected Date getPickerDate() {\n try {\n JsDate pickerDate = getPicker().get(\"select\").obj;\n return new Date((long) pickerDate.getTime());\n } catch (Exception e) {\n e.printStackTrace();\n return null;\n }\n }", "public static cacheselector get(nitro_service service, String selectorname) throws Exception{\n\t\tcacheselector obj = new cacheselector();\n\t\tobj.set_selectorname(selectorname);\n\t\tcacheselector response = (cacheselector) obj.get_resource(service);\n\t\treturn response;\n\t}", "public static void extractHouseholderColumn( ZMatrixRMaj A ,\n int row0 , int row1 ,\n int col , double u[], int offsetU )\n {\n int indexU = (row0+offsetU)*2;\n u[indexU++] = 1;\n u[indexU++] = 0;\n\n for (int row = row0+1; row < row1; row++) {\n int indexA = A.getIndex(row,col);\n u[indexU++] = A.data[indexA];\n u[indexU++] = A.data[indexA+1];\n }\n }", "private void populateResourceAssignmentWorkgroupFields(Record record, ResourceAssignmentWorkgroupFields workgroup) throws MPXJException\n {\n workgroup.setMessageUniqueID(record.getString(0));\n workgroup.setConfirmed(NumberHelper.getInt(record.getInteger(1)) == 1);\n workgroup.setResponsePending(NumberHelper.getInt(record.getInteger(1)) == 1);\n workgroup.setUpdateStart(record.getDateTime(3));\n workgroup.setUpdateFinish(record.getDateTime(4));\n workgroup.setScheduleID(record.getString(5));\n }" ]
Runs the given xpath and returns a boolean result.
[ "public static boolean xpathExists(Node document, String xpathExpression, Map<String, String> namespaceMapping) throws XPathException,\n MarshallingException\n {\n Boolean result = (Boolean) executeXPath(document, xpathExpression, namespaceMapping, XPathConstants.BOOLEAN);\n return result != null && result;\n }" ]
[ "public void setAllowBlank(boolean allowBlank) {\n this.allowBlank = allowBlank;\n\n // Setup the allow blank validation\n if (!allowBlank) {\n if (blankValidator == null) {\n blankValidator = createBlankValidator();\n }\n setupBlurValidation();\n addValidator(blankValidator);\n } else {\n removeValidator(blankValidator);\n }\n }", "public void updateColor(TestColor color) {\n\n switch (color) {\n case green:\n m_forwardButton.setEnabled(true);\n m_confirmCheckbox.setVisible(false);\n m_status.setValue(STATUS_GREEN);\n break;\n case yellow:\n m_forwardButton.setEnabled(false);\n m_confirmCheckbox.setVisible(true);\n m_status.setValue(STATUS_YELLOW);\n break;\n case red:\n m_forwardButton.setEnabled(false);\n m_confirmCheckbox.setVisible(true);\n m_status.setValue(STATUS_RED);\n break;\n default:\n break;\n }\n }", "public List<NodeValue<K, V>> getRepairs(List<NodeValue<K, V>> nodeValues) {\n int size = nodeValues.size();\n if(size <= 1)\n return Collections.emptyList();\n\n Map<K, List<NodeValue<K, V>>> keyToNodeValues = Maps.newHashMap();\n for(NodeValue<K, V> nodeValue: nodeValues) {\n List<NodeValue<K, V>> keyNodeValues = keyToNodeValues.get(nodeValue.getKey());\n if(keyNodeValues == null) {\n keyNodeValues = Lists.newArrayListWithCapacity(5);\n keyToNodeValues.put(nodeValue.getKey(), keyNodeValues);\n }\n keyNodeValues.add(nodeValue);\n }\n\n List<NodeValue<K, V>> result = Lists.newArrayList();\n for(List<NodeValue<K, V>> keyNodeValues: keyToNodeValues.values())\n result.addAll(singleKeyGetRepairs(keyNodeValues));\n return result;\n }", "private boolean parseRemoteDomainControllerAttributes_1_5(final XMLExtendedStreamReader reader, final ModelNode address,\n final List<ModelNode> list, boolean allowDiscoveryOptions) throws XMLStreamException {\n\n final ModelNode update = new ModelNode();\n update.get(OP_ADDR).set(address);\n update.get(OP).set(RemoteDomainControllerAddHandler.OPERATION_NAME);\n\n // Handle attributes\n AdminOnlyDomainConfigPolicy adminOnlyPolicy = AdminOnlyDomainConfigPolicy.DEFAULT;\n boolean requireDiscoveryOptions = false;\n final int count = reader.getAttributeCount();\n for (int i = 0; i < count; i++) {\n final String value = reader.getAttributeValue(i);\n if (!isNoNamespaceAttribute(reader, i)) {\n throw unexpectedAttribute(reader, i);\n } else {\n final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));\n switch (attribute) {\n case HOST: {\n DomainControllerWriteAttributeHandler.HOST.parseAndSetParameter(value, update, reader);\n break;\n }\n case PORT: {\n DomainControllerWriteAttributeHandler.PORT.parseAndSetParameter(value, update, reader);\n break;\n }\n case SECURITY_REALM: {\n DomainControllerWriteAttributeHandler.SECURITY_REALM.parseAndSetParameter(value, update, reader);\n break;\n }\n case USERNAME: {\n DomainControllerWriteAttributeHandler.USERNAME.parseAndSetParameter(value, update, reader);\n break;\n }\n case ADMIN_ONLY_POLICY: {\n DomainControllerWriteAttributeHandler.ADMIN_ONLY_POLICY.parseAndSetParameter(value, update, reader);\n ModelNode nodeValue = update.get(DomainControllerWriteAttributeHandler.ADMIN_ONLY_POLICY.getName());\n if (nodeValue.getType() != ModelType.EXPRESSION) {\n adminOnlyPolicy = AdminOnlyDomainConfigPolicy.getPolicy(nodeValue.asString());\n }\n break;\n }\n default:\n throw unexpectedAttribute(reader, i);\n }\n }\n }\n\n if (!update.hasDefined(DomainControllerWriteAttributeHandler.HOST.getName())) {\n if (allowDiscoveryOptions) {\n requireDiscoveryOptions = isRequireDiscoveryOptions(adminOnlyPolicy);\n } else {\n throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.HOST.getLocalName()));\n }\n }\n if (!update.hasDefined(DomainControllerWriteAttributeHandler.PORT.getName())) {\n if (allowDiscoveryOptions) {\n requireDiscoveryOptions = requireDiscoveryOptions || isRequireDiscoveryOptions(adminOnlyPolicy);\n } else {\n throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.PORT.getLocalName()));\n }\n }\n\n list.add(update);\n return requireDiscoveryOptions;\n }", "public JSONObject getPathFromEndpoint(String pathValue, String requestType) throws Exception {\n int type = getRequestTypeFromString(requestType);\n String url = BASE_PATH;\n JSONObject response = new JSONObject(doGet(url, null));\n JSONArray paths = response.getJSONArray(\"paths\");\n for (int i = 0; i < paths.length(); i++) {\n JSONObject path = paths.getJSONObject(i);\n if (path.getString(\"path\").equals(pathValue) && path.getInt(\"requestType\") == type) {\n return path;\n }\n }\n return null;\n }", "public E setById(final int id, final E element) {\n VListKey<K> key = new VListKey<K>(_key, id);\n UpdateElementById<K, E> updateElementAction = new UpdateElementById<K, E>(key, element);\n\n if(!_storeClient.applyUpdate(updateElementAction))\n throw new ObsoleteVersionException(\"update failed\");\n\n return updateElementAction.getResult();\n }", "public BoxUser.Info getInfo(String... fields) {\n URL url;\n if (fields.length > 0) {\n String queryString = new QueryStringBuilder().appendParam(\"fields\", fields).toString();\n url = USER_URL_TEMPLATE.buildWithQuery(this.getAPI().getBaseURL(), queryString, this.getID());\n } else {\n url = USER_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());\n }\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"GET\");\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject jsonObject = JsonObject.readFrom(response.getJSON());\n return new Info(jsonObject);\n }", "public BoxFolder.Info createFolder(String name) {\n JsonObject parent = new JsonObject();\n parent.add(\"id\", this.getID());\n\n JsonObject newFolder = new JsonObject();\n newFolder.add(\"name\", name);\n newFolder.add(\"parent\", parent);\n\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), CREATE_FOLDER_URL.build(this.getAPI().getBaseURL()),\n \"POST\");\n request.setBody(newFolder.toString());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n\n BoxFolder createdFolder = new BoxFolder(this.getAPI(), responseJSON.get(\"id\").asString());\n return createdFolder.new Info(responseJSON);\n }", "@SuppressWarnings({\"WeakerAccess\", \"unused\"}) // For library users\n public Searcher cancelPendingRequests() {\n if (pendingRequests.size() != 0) {\n for (int i = 0; i < pendingRequests.size(); i++) {\n int reqId = pendingRequests.keyAt(i);\n Request r = pendingRequests.valueAt(i);\n if (!r.isFinished() && !r.isCancelled()) {\n cancelRequest(r, reqId);\n }\n }\n }\n return this;\n }" ]
Use this API to fetch all the dnsaaaarec resources that are configured on netscaler.
[ "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}" ]
[ "private double u_neg_inf(double x, double tau) {\n\t\treturn f(boundaryCondition.getValueAtLowerBoundary(model, f_t(tau), f_s(x)), x, tau);\n\t}", "private void processChildTasks(Task parentTask) throws SQLException\n {\n List<Row> rows = getRows(\"select * from zscheduleitem where zparentactivity_=? and z_ent=? order by zorderinparentactivity\", parentTask.getUniqueID(), m_entityMap.get(\"Activity\"));\n for (Row row : rows)\n {\n Task task = parentTask.addTask();\n populateTask(row, task);\n processChildTasks(task);\n }\n }", "public void addCorporateGroupId(final String organizationId, final String corporateGroupId) {\n final DbOrganization dbOrganization = getOrganization(organizationId);\n\n if(!dbOrganization.getCorporateGroupIdPrefixes().contains(corporateGroupId)){\n dbOrganization.getCorporateGroupIdPrefixes().add(corporateGroupId);\n repositoryHandler.store(dbOrganization);\n }\n\n repositoryHandler.addModulesOrganization(corporateGroupId, dbOrganization);\n }", "private static LblTree createTree(TreeWalker walker) {\n\t\tNode parent = walker.getCurrentNode();\n\t\tLblTree node = new LblTree(parent.getNodeName(), -1); // treeID = -1\n\t\tfor (Node n = walker.firstChild(); n != null; n = walker.nextSibling()) {\n\t\t\tnode.add(createTree(walker));\n\t\t}\n\t\twalker.setCurrentNode(parent);\n\t\treturn node;\n\t}", "@Subscribe\n public void onSuiteResult(AggregatedSuiteResultEvent e) {\n // Calculate summaries.\n summaryListener.suiteSummary(e);\n\n Description suiteDescription = e.getDescription();\n String displayName = suiteDescription.getDisplayName();\n if (displayName.trim().isEmpty()) {\n junit4.log(\"Could not emit XML report for suite (null description).\", \n Project.MSG_WARN);\n return;\n }\n\n if (!suiteCounts.containsKey(displayName)) {\n suiteCounts.put(displayName, 1);\n } else {\n int newCount = suiteCounts.get(displayName) + 1;\n suiteCounts.put(displayName, newCount);\n if (!ignoreDuplicateSuites && newCount == 2) {\n junit4.log(\"Duplicate suite name used with XML reports: \"\n + displayName + \". This may confuse tools that process XML reports. \"\n + \"Set 'ignoreDuplicateSuites' to true to skip this message.\", Project.MSG_WARN);\n }\n displayName = displayName + \"-\" + newCount;\n }\n \n try {\n File reportFile = new File(dir, \"TEST-\" + displayName + \".xml\");\n RegistryMatcher rm = new RegistryMatcher();\n rm.bind(String.class, new XmlStringTransformer());\n Persister persister = new Persister(rm);\n persister.write(buildModel(e), reportFile);\n } catch (Exception x) {\n junit4.log(\"Could not serialize report for suite \"\n + displayName + \": \" + x.toString(), x, Project.MSG_WARN);\n }\n }", "public Collection<SerialMessage> initialize() {\r\n\t\tArrayList<SerialMessage> result = new ArrayList<SerialMessage>();\r\n\t\t\r\n\t\tif (this.getNode().getManufacturer() == 0x010F && this.getNode().getDeviceType() == 0x0501) {\r\n\t\t\t\tlogger.warn(\"Detected Fibaro FGBS001 Universal Sensor - this device fails to respond to SENSOR_ALARM_GET and SENSOR_ALARM_SUPPORTED_GET.\");\r\n\t\t\t\treturn result;\r\n\t\t}\r\n\t\t\r\n\t\tresult.add(this.getSupportedMessage());\r\n\t\treturn result;\r\n\t}", "@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 }", "public static base_response delete(nitro_service client, String serverip) throws Exception {\n\t\tntpserver deleteresource = new ntpserver();\n\t\tdeleteresource.serverip = serverip;\n\t\treturn deleteresource.delete_resource(client);\n\t}", "public void errorFuture(UUID taskId, Exception e) {\n DistributedFuture<GROUP, Serializable> future = remove(taskId);\n if(future != null) {\n future.setException(e);\n }\n }" ]
Get the bounding-box containing all features of all layers.
[ "@Nonnull\n private ReferencedEnvelope getFeatureBounds(\n final MfClientHttpRequestFactory clientHttpRequestFactory,\n final MapAttributeValues mapValues, final ExecutionContext context) {\n final MapfishMapContext mapContext = createMapContext(mapValues);\n\n String layerName = mapValues.zoomToFeatures.layer;\n ReferencedEnvelope bounds = new ReferencedEnvelope();\n for (MapLayer layer: mapValues.getLayers()) {\n context.stopIfCanceled();\n\n if ((!StringUtils.isEmpty(layerName) && layerName.equals(layer.getName())) ||\n (StringUtils.isEmpty(layerName) && layer instanceof AbstractFeatureSourceLayer)) {\n AbstractFeatureSourceLayer featureLayer = (AbstractFeatureSourceLayer) layer;\n FeatureSource<?, ?> featureSource =\n featureLayer.getFeatureSource(clientHttpRequestFactory, mapContext);\n FeatureCollection<?, ?> features;\n try {\n features = featureSource.getFeatures();\n } catch (IOException e) {\n throw ExceptionUtils.getRuntimeException(e);\n }\n\n if (!features.isEmpty()) {\n final ReferencedEnvelope curBounds = features.getBounds();\n bounds.expandToInclude(curBounds);\n }\n }\n }\n\n return bounds;\n }" ]
[ "private static void addProperties(EndpointReferenceType epr, SLProperties props) {\n MetadataType metadata = WSAEndpointReferenceUtils.getSetMetadata(epr);\n ServiceLocatorPropertiesType jaxbProps = SLPropertiesConverter.toServiceLocatorPropertiesType(props);\n\n JAXBElement<ServiceLocatorPropertiesType>\n slp = SL_OBJECT_FACTORY.createServiceLocatorProperties(jaxbProps);\n metadata.getAny().add(slp);\n }", "private void showGlobalContextActionBar() {\n ActionBar actionBar = getActionBar();\n actionBar.setDisplayShowTitleEnabled(true);\n actionBar.setTitle(R.string.app_name);\n }", "protected String extractHeaderComment( File xmlFile )\n throws MojoExecutionException\n {\n\n try\n {\n SAXParser parser = SAXParserFactory.newInstance().newSAXParser();\n SaxHeaderCommentHandler handler = new SaxHeaderCommentHandler();\n parser.setProperty( \"http://xml.org/sax/properties/lexical-handler\", handler );\n parser.parse( xmlFile, handler );\n return handler.getHeaderComment();\n }\n catch ( Exception e )\n {\n throw new MojoExecutionException( \"Failed to parse XML from \" + xmlFile, e );\n }\n }", "public static <E> Set<E> union(Set<E> s1, Set<E> s2) {\r\n Set<E> s = new HashSet<E>();\r\n s.addAll(s1);\r\n s.addAll(s2);\r\n return s;\r\n }", "private TableAlias getTableAliasForPath(String aPath, String aUserAlias, List hintClasses)\r\n {\r\n if (aUserAlias == null)\r\n {\r\n return getTableAliasForPath(aPath, hintClasses);\r\n }\r\n else\r\n {\r\n\t\t\treturn getTableAliasForPath(aUserAlias + ALIAS_SEPARATOR + aPath, hintClasses);\r\n }\r\n }", "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 }", "@Deprecated\n public static OptionMap create(final ExpressionResolver resolver, final ModelNode model, final OptionMap defaults) throws OperationFailedException {\n final OptionMap map = OptionMap.builder()\n .addAll(defaults)\n .set(Options.WORKER_READ_THREADS, RemotingSubsystemRootResource.WORKER_READ_THREADS.resolveModelAttribute(resolver, model).asInt())\n .set(Options.WORKER_TASK_CORE_THREADS, RemotingSubsystemRootResource.WORKER_TASK_CORE_THREADS.resolveModelAttribute(resolver, model).asInt())\n .set(Options.WORKER_TASK_KEEPALIVE, RemotingSubsystemRootResource.WORKER_TASK_KEEPALIVE.resolveModelAttribute(resolver, model).asInt())\n .set(Options.WORKER_TASK_LIMIT, RemotingSubsystemRootResource.WORKER_TASK_LIMIT.resolveModelAttribute(resolver, model).asInt())\n .set(Options.WORKER_TASK_MAX_THREADS, RemotingSubsystemRootResource.WORKER_TASK_MAX_THREADS.resolveModelAttribute(resolver, model).asInt())\n .set(Options.WORKER_WRITE_THREADS, RemotingSubsystemRootResource.WORKER_WRITE_THREADS.resolveModelAttribute(resolver, model).asInt())\n .set(Options.WORKER_READ_THREADS, RemotingSubsystemRootResource.WORKER_READ_THREADS.resolveModelAttribute(resolver, model).asInt())\n .getMap();\n return map;\n }", "public static SimpleDeploymentDescription of(final String name, @SuppressWarnings(\"TypeMayBeWeakened\") final Set<String> serverGroups) {\n final SimpleDeploymentDescription result = of(name);\n if (serverGroups != null) {\n result.addServerGroups(serverGroups);\n }\n return result;\n }", "public static List<DockerImage> getDockerImagesFromAgents(final int buildInfoId, TaskListener listener) throws IOException, InterruptedException {\n List<DockerImage> dockerImages = new ArrayList<DockerImage>();\n\n // Collect images from the master:\n dockerImages.addAll(getAndDiscardImagesByBuildId(buildInfoId));\n\n // Collect images from all the agents:\n List<Node> nodes = Jenkins.getInstance().getNodes();\n for (Node node : nodes) {\n if (node == null || node.getChannel() == null) {\n continue;\n }\n try {\n List<DockerImage> partialDockerImages = node.getChannel().call(new MasterToSlaveCallable<List<DockerImage>, IOException>() {\n public List<DockerImage> call() throws IOException {\n List<DockerImage> dockerImages = new ArrayList<DockerImage>();\n dockerImages.addAll(getAndDiscardImagesByBuildId(buildInfoId));\n return dockerImages;\n }\n });\n dockerImages.addAll(partialDockerImages);\n } catch (Exception e) {\n listener.getLogger().println(\"Could not collect docker images from Jenkins node '\" + node.getDisplayName() + \"' due to: \" + e.getMessage());\n }\n }\n return dockerImages;\n }" ]
Perform the work of processing the various OperationContext.Stage queues, and then the DONE stage.
[ "private void processStages() {\n\n // Locate the next step to execute.\n ModelNode primaryResponse = null;\n Step step;\n do {\n step = steps.get(currentStage).pollFirst();\n if (step == null) {\n\n if (currentStage == Stage.MODEL && addModelValidationSteps()) {\n continue;\n }\n // No steps remain in this stage; give subclasses a chance to check status\n // and approve moving to the next stage\n if (!tryStageCompleted(currentStage)) {\n // Can't continue\n resultAction = ResultAction.ROLLBACK;\n executeResultHandlerPhase(null);\n return;\n }\n // Proceed to the next stage\n if (currentStage.hasNext()) {\n currentStage = currentStage.next();\n if (currentStage == Stage.VERIFY) {\n // a change was made to the runtime. Thus, we must wait\n // for stability before resuming in to verify.\n try {\n awaitServiceContainerStability();\n } catch (InterruptedException e) {\n cancelled = true;\n handleContainerStabilityFailure(primaryResponse, e);\n executeResultHandlerPhase(null);\n return;\n } catch (TimeoutException te) {\n // The service container is in an unknown state; but we don't require restart\n // because rollback may allow the container to stabilize. We force require-restart\n // in the rollback handling if the container cannot stabilize (see OperationContextImpl.releaseStepLocks)\n //processState.setRestartRequired(); // don't use our restartRequired() method as this is not reversible in rollback\n handleContainerStabilityFailure(primaryResponse, te);\n executeResultHandlerPhase(null);\n return;\n }\n }\n }\n } else {\n // The response to the first step is what goes to the outside caller\n if (primaryResponse == null) {\n primaryResponse = step.response;\n }\n // Execute the step, but make sure we always finalize any steps\n Throwable toThrow = null;\n // Whether to return after try/finally\n boolean exit = false;\n try {\n CapabilityRegistry.RuntimeStatus stepStatus = getStepExecutionStatus(step);\n if (stepStatus == RuntimeCapabilityRegistry.RuntimeStatus.NORMAL) {\n executeStep(step);\n } else {\n String header = stepStatus == RuntimeCapabilityRegistry.RuntimeStatus.RESTART_REQUIRED\n ? OPERATION_REQUIRES_RESTART : OPERATION_REQUIRES_RELOAD;\n step.response.get(RESPONSE_HEADERS, header).set(true);\n }\n } catch (RuntimeException | Error re) {\n resultAction = ResultAction.ROLLBACK;\n toThrow = re;\n } finally {\n // See if executeStep put us in a state where we shouldn't do any more\n if (toThrow != null || !canContinueProcessing()) {\n // We're done.\n executeResultHandlerPhase(toThrow);\n exit = true; // we're on the return path\n }\n }\n if (exit) {\n return;\n }\n }\n } while (currentStage != Stage.DONE);\n\n assert primaryResponse != null; // else ModelControllerImpl executed an op with no steps\n\n // All steps ran and canContinueProcessing returned true for the last one, so...\n executeDoneStage(primaryResponse);\n }" ]
[ "public static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName) {\n\t\tif (unknownEnumName == null || unknownEnumName.length() == 0) {\n\t\t\treturn null;\n\t\t}\n\t\tfor (Enum<?> enumVal : (Enum<?>[]) field.getType().getEnumConstants()) {\n\t\t\tif (enumVal.name().equals(unknownEnumName)) {\n\t\t\t\treturn enumVal;\n\t\t\t}\n\t\t}\n\t\tthrow new IllegalArgumentException(\"Unknwown enum unknown name \" + unknownEnumName + \" for field \" + field);\n\t}", "public Collection<Group> getPublicGroups(String userId) throws FlickrException {\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_GET_PUBLIC_GROUPS);\r\n\r\n parameters.put(\"user_id\", userId);\r\n\r\n Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n Element groupsElement = response.getPayload();\r\n NodeList groupNodes = groupsElement.getElementsByTagName(\"group\");\r\n for (int i = 0; i < groupNodes.getLength(); i++) {\r\n Element groupElement = (Element) groupNodes.item(i);\r\n Group group = new Group();\r\n group.setId(groupElement.getAttribute(\"nsid\"));\r\n group.setName(groupElement.getAttribute(\"name\"));\r\n group.setAdmin(\"1\".equals(groupElement.getAttribute(\"admin\")));\r\n group.setEighteenPlus(groupElement.getAttribute(\"eighteenplus\").equals(\"0\") ? false : true);\r\n groups.add(group);\r\n }\r\n return groups;\r\n }", "private void checkProcedures(ClassDescriptorDef classDef, String checkLevel) throws ConstraintException\r\n {\r\n if (CHECKLEVEL_NONE.equals(checkLevel))\r\n {\r\n return;\r\n }\r\n\r\n ProcedureDef procDef;\r\n String type;\r\n String name;\r\n String fieldName;\r\n String argName;\r\n \r\n for (Iterator it = classDef.getProcedures(); it.hasNext();)\r\n {\r\n procDef = (ProcedureDef)it.next();\r\n type = procDef.getName();\r\n name = procDef.getProperty(PropertyHelper.OJB_PROPERTY_NAME);\r\n if ((name == null) || (name.length() == 0))\r\n {\r\n throw new ConstraintException(\"The \"+type+\"-procedure in class \"+classDef.getName()+\" doesn't have a name\");\r\n }\r\n fieldName = procDef.getProperty(PropertyHelper.OJB_PROPERTY_RETURN_FIELD_REF);\r\n if ((fieldName != null) && (fieldName.length() > 0))\r\n {\r\n if (classDef.getField(fieldName) == null)\r\n {\r\n throw new ConstraintException(\"The \"+type+\"-procedure \"+name+\" in class \"+classDef.getName()+\" references an unknown or non-persistent return field \"+fieldName);\r\n }\r\n }\r\n for (CommaListIterator argIt = new CommaListIterator(procDef.getProperty(PropertyHelper.OJB_PROPERTY_ARGUMENTS)); argIt.hasNext();)\r\n {\r\n argName = argIt.getNext();\r\n if (classDef.getProcedureArgument(argName) == null)\r\n {\r\n throw new ConstraintException(\"The \"+type+\"-procedure \"+name+\" in class \"+classDef.getName()+\" references an unknown argument \"+argName);\r\n }\r\n }\r\n }\r\n\r\n ProcedureArgumentDef argDef;\r\n\r\n for (Iterator it = classDef.getProcedureArguments(); it.hasNext();)\r\n {\r\n argDef = (ProcedureArgumentDef)it.next();\r\n type = argDef.getProperty(PropertyHelper.OJB_PROPERTY_TYPE);\r\n if (\"runtime\".equals(type))\r\n {\r\n fieldName = argDef.getProperty(PropertyHelper.OJB_PROPERTY_FIELD_REF);\r\n if ((fieldName != null) && (fieldName.length() > 0))\r\n {\r\n if (classDef.getField(fieldName) == null)\r\n {\r\n throw new ConstraintException(\"The \"+type+\"-argument \"+argDef.getName()+\" in class \"+classDef.getName()+\" references an unknown or non-persistent return field \"+fieldName);\r\n }\r\n }\r\n }\r\n }\r\n }", "protected int readShort(InputStream is) throws IOException\n {\n byte[] data = new byte[2];\n if (is.read(data) != data.length)\n {\n throw new EOFException();\n }\n\n return (MPPUtility.getShort(data, 0));\n }", "public static ProjectReader getProjectReader(String name) throws MPXJException\n {\n int index = name.lastIndexOf('.');\n if (index == -1)\n {\n throw new IllegalArgumentException(\"Filename has no extension: \" + name);\n }\n\n String extension = name.substring(index + 1).toUpperCase();\n\n Class<? extends ProjectReader> fileClass = READER_MAP.get(extension);\n if (fileClass == null)\n {\n throw new IllegalArgumentException(\"Cannot read files of type: \" + extension);\n }\n\n try\n {\n ProjectReader file = fileClass.newInstance();\n return (file);\n }\n\n catch (Exception ex)\n {\n throw new MPXJException(\"Failed to load project reader\", ex);\n }\n }", "private void handleMultiInstanceReportResponse(SerialMessage serialMessage,\r\n\t\t\tint offset) {\r\n\t\tlogger.trace(\"Process Multi-instance Report\");\r\n\t\tint commandClassCode = serialMessage.getMessagePayloadByte(offset);\r\n\t\tint instances = serialMessage.getMessagePayloadByte(offset + 1);\r\n\r\n\t\tif (instances == 0) {\r\n\t\t\tsetInstances(1);\r\n\t\t} else \r\n\t\t{\r\n\t\t\tCommandClass commandClass = CommandClass.getCommandClass(commandClassCode);\r\n\t\t\t\r\n\t\t\tif (commandClass == null) {\r\n\t\t\t\tlogger.error(String.format(\"Unsupported command class 0x%02x\", commandClassCode));\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tlogger.debug(String.format(\"Node %d Requested Command Class = %s (0x%02x)\", this.getNode().getNodeId(), commandClass.getLabel() , commandClassCode));\r\n\t\t\tZWaveCommandClass zwaveCommandClass = this.getNode().getCommandClass(commandClass);\r\n\t\t\t\r\n\t\t\tif (zwaveCommandClass == null) {\r\n\t\t\t\tlogger.error(String.format(\"Unsupported command class %s (0x%02x)\", commandClass.getLabel(), commandClassCode));\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tzwaveCommandClass.setInstances(instances);\r\n\t\t\tlogger.debug(String.format(\"Node %d Instances = %d, number of instances set.\", this.getNode().getNodeId(), instances));\r\n\t\t}\r\n\t\t\r\n\t\tfor (ZWaveCommandClass zwaveCommandClass : this.getNode().getCommandClasses())\r\n\t\t\tif (zwaveCommandClass.getInstances() == 0) // still waiting for an instance report of another command class. \r\n\t\t\t\treturn;\r\n\t\t\r\n\t\t// advance node stage.\r\n\t\tthis.getNode().advanceNodeStage();\r\n\t}", "private FieldDescriptor getFldFromJoin(TableAlias aTableAlias, String aColName)\r\n {\r\n FieldDescriptor fld = null;\r\n\r\n // Search Join Structure for attribute\r\n if (aTableAlias.joins != null)\r\n {\r\n Iterator itr = aTableAlias.joins.iterator();\r\n while (itr.hasNext())\r\n {\r\n Join join = (Join) itr.next();\r\n ClassDescriptor cld = join.right.cld;\r\n\r\n if (cld != null)\r\n {\r\n fld = cld.getFieldDescriptorByName(aColName);\r\n if (fld != null)\r\n {\r\n break;\r\n }\r\n\r\n }\r\n }\r\n }\r\n return fld;\r\n }", "public Date getPreviousWorkFinish(Date date)\n {\n Calendar cal = Calendar.getInstance();\n cal.setTime(date);\n updateToPreviousWorkFinish(cal);\n return cal.getTime();\n }", "public static Mono<Void> waitForCompletion(CloudFoundryClient cloudFoundryClient, Duration completionTimeout, String jobId) {\n return requestJobV3(cloudFoundryClient, jobId)\n .filter(job -> JobState.PROCESSING != job.getState())\n .repeatWhenEmpty(exponentialBackOff(Duration.ofSeconds(1), Duration.ofSeconds(15), completionTimeout))\n .filter(job -> JobState.FAILED == job.getState())\n .flatMap(JobUtils::getError);\n }" ]
delegate to each contained OJBIterator and release its resources.
[ "public void releaseDbResources()\r\n {\r\n Iterator it = m_rsIterators.iterator();\r\n while (it.hasNext())\r\n {\r\n ((OJBIterator) it.next()).releaseDbResources();\r\n }\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 }", "public static void setTime(Calendar cal, Date time)\n {\n if (time != null)\n {\n Calendar startCalendar = popCalendar(time);\n cal.set(Calendar.HOUR_OF_DAY, startCalendar.get(Calendar.HOUR_OF_DAY));\n cal.set(Calendar.MINUTE, startCalendar.get(Calendar.MINUTE));\n cal.set(Calendar.SECOND, startCalendar.get(Calendar.SECOND));\n pushCalendar(startCalendar);\n }\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 ByteArray readBytes(int size) throws IOException\n {\n byte[] data = new byte[size];\n m_stream.read(data);\n return new ByteArray(data);\n }", "public void reset(int profileId, String clientUUID) throws Exception {\n PreparedStatement statement = null;\n\n // TODO: need a better way to do this than brute force.. but the iterative approach is too slow\n try (Connection sqlConnection = sqlService.getConnection()) {\n\n // first remove all enabled overrides with this client uuid\n String queryString = \"DELETE FROM \" + Constants.DB_TABLE_ENABLED_OVERRIDE +\n \" WHERE \" + Constants.GENERIC_CLIENT_UUID + \"= ? \" +\n \" AND \" + Constants.GENERIC_PROFILE_ID + \" = ?\";\n statement = sqlConnection.prepareStatement(queryString);\n statement.setString(1, clientUUID);\n statement.setInt(2, profileId);\n statement.executeUpdate();\n statement.close();\n\n // clean up request response table for this uuid\n queryString = \"UPDATE \" + Constants.DB_TABLE_REQUEST_RESPONSE +\n \" SET \" + Constants.REQUEST_RESPONSE_CUSTOM_REQUEST + \"=?, \"\n + Constants.REQUEST_RESPONSE_CUSTOM_RESPONSE + \"=?, \"\n + Constants.REQUEST_RESPONSE_REPEAT_NUMBER + \"=-1, \"\n + Constants.REQUEST_RESPONSE_REQUEST_ENABLED + \"=0, \"\n + Constants.REQUEST_RESPONSE_RESPONSE_ENABLED + \"=0 \"\n + \"WHERE \" + Constants.GENERIC_CLIENT_UUID + \"=? \" +\n \" AND \" + Constants.GENERIC_PROFILE_ID + \"=?\";\n statement = sqlConnection.prepareStatement(queryString);\n statement.setString(1, \"\");\n statement.setString(2, \"\");\n statement.setString(3, clientUUID);\n statement.setInt(4, profileId);\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\n this.updateActive(profileId, clientUUID, false);\n }", "public static void Forward(double[][] data) {\n double[][] result = new double[data.length][data[0].length];\n\n for (int m = 0; m < data.length; m++) {\n for (int n = 0; n < data[0].length; n++) {\n double sum = 0;\n for (int i = 0; i < result.length; i++) {\n for (int k = 0; k < data.length; k++) {\n sum += data[i][k] * cas(((2.0 * Math.PI) / data.length) * (i * m + k * n));\n }\n result[m][n] = (1.0 / data.length) * sum;\n }\n }\n }\n\n for (int i = 0; i < data.length; i++) {\n for (int j = 0; j < data[0].length; j++) {\n data[i][j] = result[i][j];\n }\n }\n }", "public boolean removeWriter(Object key, Object resourceId)\r\n {\r\n boolean result = false;\r\n ObjectLocks objectLocks = null;\r\n synchronized(locktable)\r\n {\r\n objectLocks = (ObjectLocks) locktable.get(resourceId);\r\n if(objectLocks != null)\r\n {\r\n /**\r\n * MBAIRD, last one out, close the door and turn off the lights.\r\n * if no locks (readers or writers) exist for this object, let's remove\r\n * it from the locktable.\r\n */\r\n LockEntry entry = objectLocks.getWriter();\r\n if(entry != null && entry.isOwnedBy(key))\r\n {\r\n objectLocks.setWriter(null);\r\n result = true;\r\n\r\n // no need to check if writer is null, we just set it.\r\n if(objectLocks.getReaders().size() == 0)\r\n {\r\n locktable.remove(resourceId);\r\n }\r\n }\r\n }\r\n }\r\n return result;\r\n }", "public static DMatrixSparseCSC rectangle(int numRows , int numCols , int nz_total ,\n double min , double max , Random rand ) {\n\n nz_total = Math.min(numCols*numRows,nz_total);\n int[] selected = UtilEjml.shuffled(numRows*numCols, nz_total, rand);\n Arrays.sort(selected,0,nz_total);\n\n DMatrixSparseCSC ret = new DMatrixSparseCSC(numRows,numCols,nz_total);\n ret.indicesSorted = true;\n\n // compute the number of elements in each column\n int hist[] = new int[ numCols ];\n for (int i = 0; i < nz_total; i++) {\n hist[selected[i]/numRows]++;\n }\n\n // define col_idx\n ret.histogramToStructure(hist);\n\n for (int i = 0; i < nz_total; i++) {\n int row = selected[i]%numRows;\n\n ret.nz_rows[i] = row;\n ret.nz_values[i] = rand.nextDouble()*(max-min)+min;\n }\n\n return ret;\n }", "public static final Rate parseRate(BigDecimal value)\n {\n Rate result = null;\n\n if (value != null)\n {\n result = new Rate(value, TimeUnit.HOURS);\n }\n\n return (result);\n }" ]
Finish the work of building and sending a protocol packet. @param kind the type of packet to create and send @param payload the content which will follow our device name in the packet @param destination where the packet should be sent @param port the port to which the packet should be sent @throws IOException if there is a problem sending the packet
[ "@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 }" ]
[ "public static boolean setCustomResponseForDefaultProfile(String pathName, String customData) {\n try {\n return setCustomForDefaultProfile(pathName, true, customData);\n } catch (Exception e) {\n e.printStackTrace();\n }\n return false;\n }", "public JsonNode apply(final JsonNode node) {\n requireNonNull(node, \"node\");\n JsonNode ret = node.deepCopy();\n for (final JsonPatchOperation operation : operations) {\n ret = operation.apply(ret);\n }\n\n return ret;\n }", "void setParent(ProjectCalendarWeek parent)\n {\n m_parent = parent;\n\n for (int loop = 0; loop < m_days.length; loop++)\n {\n if (m_days[loop] == null)\n {\n m_days[loop] = DayType.DEFAULT;\n }\n }\n }", "public void registerDatatype(Class<? extends GVRHybridObject> textureClass,\n AsyncLoaderFactory<? extends GVRHybridObject, ?> asyncLoaderFactory) {\n mFactories.put(textureClass, asyncLoaderFactory);\n }", "protected DatabaseConnection getSavedConnection() {\n\t\tNestedConnection nested = specialConnection.get();\n\t\tif (nested == null) {\n\t\t\treturn null;\n\t\t} else {\n\t\t\treturn nested.connection;\n\t\t}\n\t}", "private String getOrdinal(Integer value)\n {\n String result;\n int index = value.intValue();\n if (index >= ORDINAL.length)\n {\n result = \"every \" + index + \"th\";\n }\n else\n {\n result = ORDINAL[index];\n }\n return result;\n }", "public static GVRVideoSceneObjectPlayer<MediaPlayer> makePlayerInstance(final MediaPlayer mediaPlayer) {\n return new GVRVideoSceneObjectPlayer<MediaPlayer>() {\n @Override\n public MediaPlayer getPlayer() {\n return mediaPlayer;\n }\n\n @Override\n public void setSurface(Surface surface) {\n mediaPlayer.setSurface(surface);\n }\n\n @Override\n public void release() {\n mediaPlayer.release();\n }\n\n @Override\n public boolean canReleaseSurfaceImmediately() {\n return true;\n }\n\n @Override\n public void pause() {\n try {\n mediaPlayer.pause();\n } catch (final IllegalStateException exc) {\n //intentionally ignored; might have been released already or never got to be\n //initialized\n }\n }\n\n @Override\n public void start() {\n mediaPlayer.start();\n }\n\n @Override\n public boolean isPlaying() {\n return mediaPlayer.isPlaying();\n }\n };\n }", "public static void closeThrowSqlException(Closeable closeable, String label) throws SQLException {\n\t\tif (closeable != null) {\n\t\t\ttry {\n\t\t\t\tcloseable.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow SqlExceptionUtil.create(\"could not close \" + label, e);\n\t\t\t}\n\t\t}\n\t}", "public Metadata replace(String path, String value) {\n this.values.set(this.pathToProperty(path), value);\n this.addOp(\"replace\", path, value);\n return this;\n }" ]
gets the count of addresses that this address division grouping may represent If this address division grouping is not a subnet block of multiple addresses or has no range of values, then there is only one such address. @return
[ "@Override\n\tpublic BigInteger getCount() {\n\t\tBigInteger cached = cachedCount;\n\t\tif(cached == null) {\n\t\t\tcachedCount = cached = getCountImpl();\n\t\t}\n\t\treturn cached;\n\t}" ]
[ "public boolean matches(PathAddress address) {\n if (address == null) {\n return false;\n }\n if (equals(address)) {\n return true;\n }\n if (size() != address.size()) {\n return false;\n }\n for (int i = 0; i < size(); i++) {\n PathElement pe = getElement(i);\n PathElement other = address.getElement(i);\n if (!pe.matches(other)) {\n // Could be a multiTarget with segments\n if (pe.isMultiTarget() && !pe.isWildcard()) {\n boolean matched = false;\n for (String segment : pe.getSegments()) {\n if (segment.equals(other.getValue())) {\n matched = true;\n break;\n }\n }\n if (!matched) {\n return false;\n }\n } else {\n return false;\n }\n }\n }\n return true;\n }", "static ChangeEvent<BsonDocument> changeEventForLocalReplace(\n final MongoNamespace namespace,\n final BsonValue documentId,\n final BsonDocument document,\n final boolean writePending\n ) {\n return new ChangeEvent<>(\n new BsonDocument(),\n OperationType.REPLACE,\n document,\n namespace,\n new BsonDocument(\"_id\", documentId),\n null,\n writePending);\n }", "public String getUniqueFilename(String baseFileName, String extension, boolean cleanBaseFileName, String... ancestorFolders)\n {\n if (cleanBaseFileName)\n {\n baseFileName = PathUtil.cleanFileName(baseFileName);\n }\n\n if (ancestorFolders != null)\n {\n Path pathToFile = Paths.get(\"\", Stream.of(ancestorFolders).map(ancestor -> PathUtil.cleanFileName(ancestor)).toArray(String[]::new)).resolve(baseFileName);\n baseFileName = pathToFile.toString();\n }\n String filename = baseFileName + \".\" + extension;\n\n // FIXME this looks nasty\n while (usedFilenames.contains(filename))\n {\n filename = baseFileName + \".\" + index.getAndIncrement() + \".\" + extension;\n }\n usedFilenames.add(filename);\n\n return filename;\n }", "private void cleanupDestination(DownloadRequest request, boolean forceClean) {\n if (!request.isResumable() || forceClean) {\n Log.d(\"cleanupDestination() deleting \" + request.getDestinationURI().getPath());\n File destinationFile = new File(request.getDestinationURI().getPath());\n if (destinationFile.exists()) {\n destinationFile.delete();\n }\n }\n }", "protected Date getPickerDate() {\n try {\n JsDate pickerDate = getPicker().get(\"select\").obj;\n return new Date((long) pickerDate.getTime());\n } catch (Exception e) {\n e.printStackTrace();\n return null;\n }\n }", "protected Object buildOrRefreshObject(Map row, ClassDescriptor targetClassDescriptor, Object targetObject)\r\n {\r\n Object result = targetObject;\r\n FieldDescriptor fmd;\r\n FieldDescriptor[] fields = targetClassDescriptor.getFieldDescriptor(true);\r\n\r\n if(targetObject == null)\r\n {\r\n // 1. create new object instance if needed\r\n result = ClassHelper.buildNewObjectInstance(targetClassDescriptor);\r\n }\r\n\r\n // 2. fill all scalar attributes of the new object\r\n for (int i = 0; i < fields.length; i++)\r\n {\r\n fmd = fields[i];\r\n fmd.getPersistentField().set(result, row.get(fmd.getColumnName()));\r\n }\r\n\r\n if(targetObject == null)\r\n {\r\n // 3. for new build objects, invoke the initialization method for the class if one is provided\r\n Method initializationMethod = targetClassDescriptor.getInitializationMethod();\r\n if (initializationMethod != null)\r\n {\r\n try\r\n {\r\n initializationMethod.invoke(result, NO_ARGS);\r\n }\r\n catch (Exception ex)\r\n {\r\n throw new PersistenceBrokerException(\"Unable to invoke initialization method:\" + initializationMethod.getName() + \" for class:\" + m_cld.getClassOfObject(), ex);\r\n }\r\n }\r\n }\r\n return result;\r\n }", "public App on(Heroku.Stack stack) {\n App newApp = copy();\n newApp.stack = new App.Stack(stack);\n return newApp;\n }", "private static final int getUnicodeStringLengthInBytes(byte[] data, int offset)\n {\n int result;\n if (data == null || offset >= data.length)\n {\n result = 0;\n }\n else\n {\n result = data.length - offset;\n\n for (int loop = offset; loop < (data.length - 1); loop += 2)\n {\n if (data[loop] == 0 && data[loop + 1] == 0)\n {\n result = loop - offset;\n break;\n }\n }\n }\n return result;\n }", "public static void putUnsignedInt(ByteBuffer buffer, int index, long value) {\n buffer.putInt(index, (int) (value & 0xffffffffL));\n }" ]
Get the rate types set. @return the rate types set, or an empty array, but never null.
[ "@SuppressWarnings(\"unchecked\")\n public Set<RateType> getRateTypes() {\n Set<RateType> result = get(KEY_RATE_TYPES, Set.class);\n if (result == null) {\n return Collections.emptySet();\n }\n return result;\n }" ]
[ "public static Connection connectSync(final ProtocolConnectionConfiguration configuration) throws IOException {\n long timeoutMillis = configuration.getConnectionTimeout();\n CallbackHandler handler = configuration.getCallbackHandler();\n final CallbackHandler actualHandler;\n ProtocolTimeoutHandler timeoutHandler = configuration.getTimeoutHandler();\n // Note: If a client supplies a ProtocolTimeoutHandler it is taking on full responsibility for timeout management.\n if (timeoutHandler == null) {\n GeneralTimeoutHandler defaultTimeoutHandler = new GeneralTimeoutHandler();\n // No point wrapping our AnonymousCallbackHandler.\n actualHandler = handler != null ? new WrapperCallbackHandler(defaultTimeoutHandler, handler) : null;\n timeoutHandler = defaultTimeoutHandler;\n } else {\n actualHandler = handler;\n }\n\n final IoFuture<Connection> future = connect(actualHandler, configuration);\n\n IoFuture.Status status = timeoutHandler.await(future, timeoutMillis);\n\n if (status == IoFuture.Status.DONE) {\n return future.get();\n }\n if (status == IoFuture.Status.FAILED) {\n throw ProtocolLogger.ROOT_LOGGER.failedToConnect(configuration.getUri(), future.getException());\n }\n throw ProtocolLogger.ROOT_LOGGER.couldNotConnect(configuration.getUri());\n }", "private void logOriginalResponseHistory(\n PluginResponse httpServletResponse, History history) throws URIException {\n RequestInformation requestInfo = requestInformation.get();\n if (requestInfo.handle && requestInfo.client.getIsActive()) {\n logger.info(\"Storing original response history\");\n history.setOriginalResponseHeaders(HttpUtilities.getHeaders(httpServletResponse));\n history.setOriginalResponseCode(Integer.toString(httpServletResponse.getStatus()));\n history.setOriginalResponseContentType(httpServletResponse.getContentType());\n history.setOriginalResponseData(httpServletResponse.getContentString());\n logger.info(\"Done storing\");\n }\n }", "protected void progressInfoMessage(final String tag) {\n if(logger.isInfoEnabled()) {\n long totalTimeS = (System.currentTimeMillis() - startTimeMs) / Time.MS_PER_SECOND;\n\n logger.info(tag + \" : scanned \" + scanned + \" and fetched \" + fetched + \" for store '\"\n + storageEngine.getName() + \"' partitionIds:\" + partitionIds + \" in \"\n + totalTimeS + \" s\");\n }\n }", "private void handleApplicationCommandRequest(SerialMessage incomingMessage) {\n\t\tlogger.trace(\"Handle Message Application Command Request\");\n\t\tint nodeId = incomingMessage.getMessagePayloadByte(1);\n\t\tlogger.debug(\"Application Command Request from Node \" + nodeId);\n\t\tZWaveNode node = getNode(nodeId);\n\t\t\n\t\tif (node == null) {\n\t\t\tlogger.warn(\"Node {} not initialized yet, ignoring message.\", nodeId);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tnode.resetResendCount();\n\t\t\n\t\tint commandClassCode = incomingMessage.getMessagePayloadByte(3);\n\t\tZWaveCommandClass.CommandClass commandClass = ZWaveCommandClass.CommandClass.getCommandClass(commandClassCode);\n\n\t\tif (commandClass == null) {\n\t\t\tlogger.error(String.format(\"Unsupported command class 0x%02x\", commandClassCode));\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tlogger.debug(String.format(\"Incoming command class %s (0x%02x)\", commandClass.getLabel(), commandClass.getKey()));\n\t\tZWaveCommandClass zwaveCommandClass = node.getCommandClass(commandClass);\n\t\t\n\t\t// We got an unsupported command class, return.\n\t\tif (zwaveCommandClass == null) {\n\t\t\tlogger.error(String.format(\"Unsupported command class %s (0x%02x)\", commandClass.getLabel(), commandClassCode));\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tlogger.trace(\"Found Command Class {}, passing to handleApplicationCommandRequest\", zwaveCommandClass.getCommandClass().getLabel());\n\t\tzwaveCommandClass.handleApplicationCommandRequest(incomingMessage, 4, 1);\n\n\t\tif (incomingMessage.getMessageClass() == this.lastSentMessage.getExpectedReply() && nodeId == this.lastSentMessage.getMessageNode() && !incomingMessage.isTransActionCanceled()) {\n\t\t\t\tnotifyEventListeners(new ZWaveEvent(ZWaveEventType.TRANSACTION_COMPLETED_EVENT, this.lastSentMessage.getMessageNode(), 1, this.lastSentMessage));\n\t\t\t\ttransactionCompleted.release();\n\t\t\t\tlogger.trace(\"Released. Transaction completed permit count -> {}\", transactionCompleted.availablePermits());\n\t\t}\n\t}", "@Deprecated\n\t@SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n\tpublic Map<String, PrimitiveAttribute<?>> getAttributes() {\n\t\tif (!isPrimitiveOnly()) {\n\t\t\tthrow new UnsupportedOperationException(\"Primitive API not supported for nested association values\");\n\t\t}\n\t\treturn (Map) attributes;\n\t}", "private String commaSeparate(Collection<String> strings)\n {\n StringBuilder buffer = new StringBuilder();\n Iterator<String> iterator = strings.iterator();\n while (iterator.hasNext())\n {\n String string = iterator.next();\n buffer.append(string);\n if (iterator.hasNext())\n {\n buffer.append(\", \");\n }\n }\n return buffer.toString();\n }", "public void setRotation(String rotation) {\r\n if (rotation != null) {\r\n try {\r\n setRotation(Integer.parseInt(rotation));\r\n } catch (NumberFormatException e) {\r\n setRotation(-1);\r\n }\r\n }\r\n }", "@GuardedBy(\"elementsLock\")\n\t@Override\n\tpublic boolean markChecked(CandidateElement element) {\n\t\tString generalString = element.getGeneralString();\n\t\tString uniqueString = element.getUniqueString();\n\t\tsynchronized (elementsLock) {\n\t\t\tif (elements.contains(uniqueString)) {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\telements.add(generalString);\n\t\t\t\telements.add(uniqueString);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}", "@Override\n protected void stopInner() {\n /*\n * TODO REST-Server Need to handle inflight operations. What happens to\n * the existing async operations when a channel.close() is issued in\n * Netty?\n */\n if(this.nettyServerChannel != null) {\n this.nettyServerChannel.close();\n }\n\n if(allChannels != null) {\n allChannels.close().awaitUninterruptibly();\n }\n this.bootstrap.releaseExternalResources();\n }" ]
Read a list of sub projects. @param data byte array @param uniqueIDOffset offset of unique ID @param filePathOffset offset of file path @param fileNameOffset offset of file name @param subprojectIndex index of the subproject, used to calculate unique id offset
[ "private void readSubProjects(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex)\n {\n while (uniqueIDOffset < filePathOffset)\n {\n readSubProject(data, uniqueIDOffset, filePathOffset, fileNameOffset, subprojectIndex++);\n uniqueIDOffset += 4;\n }\n }" ]
[ "public static gslbldnsentries[] get(nitro_service service) throws Exception{\n\t\tgslbldnsentries obj = new gslbldnsentries();\n\t\tgslbldnsentries[] response = (gslbldnsentries[])obj.get_resources(service);\n\t\treturn response;\n\t}", "private int getItemViewType(Class prototypeClass) {\n int itemViewType = -1;\n for (Renderer renderer : prototypes) {\n if (renderer.getClass().equals(prototypeClass)) {\n itemViewType = getPrototypeIndex(renderer);\n break;\n }\n }\n if (itemViewType == -1) {\n throw new PrototypeNotFoundException(\n \"Review your RendererBuilder implementation, you are returning one\"\n + \" prototype class not found in prototypes collection\");\n }\n return itemViewType;\n }", "public int executeRefresh(DatabaseConnection databaseConnection, T data, ObjectCache objectCache)\n\t\t\tthrows SQLException {\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tID id = (ID) idField.extractJavaFieldValue(data);\n\t\t// we don't care about the cache here\n\t\tT result = super.execute(databaseConnection, id, null);\n\t\tif (result == null) {\n\t\t\treturn 0;\n\t\t}\n\t\t// copy each field from the result into the passed in object\n\t\tfor (FieldType fieldType : resultsFieldTypes) {\n\t\t\tif (fieldType != idField) {\n\t\t\t\tfieldType.assignField(connectionSource, data, fieldType.extractJavaFieldValue(result), false,\n\t\t\t\t\t\tobjectCache);\n\t\t\t}\n\t\t}\n\t\treturn 1;\n\t}", "public static String joinStrings(List<String> strings, boolean fixCase, char withChar) {\n if (strings == null || strings.size() == 0) {\n return \"\";\n }\n StringBuilder result = null;\n for (String s : strings) {\n if (fixCase) {\n s = fixCase(s);\n }\n if (result == null) {\n result = new StringBuilder(s);\n } else {\n result.append(withChar);\n result.append(s);\n }\n }\n return result.toString();\n }", "public static Authentication build(String crypt) throws IllegalArgumentException {\n if(crypt == null) {\n return new PlainAuth(null);\n }\n String[] value = crypt.split(\":\");\n \n if(value.length == 2 ) {\n String type = value[0].trim();\n String password = value[1].trim();\n if(password!=null&&password.length()>0) {\n if(\"plain\".equals(type)) {\n return new PlainAuth(password);\n }\n if(\"md5\".equals(type)) {\n return new Md5Auth(password);\n }\n if(\"crc32\".equals(type)) {\n return new Crc32Auth(Long.parseLong(password));\n }\n }\n }\n throw new IllegalArgumentException(\"error password: \"+crypt);\n }", "private XopBean createXopBean() throws Exception {\n XopBean xop = new XopBean();\n xop.setName(\"xopName\");\n \n InputStream is = getClass().getResourceAsStream(\"/java.jpg\");\n byte[] data = IOUtils.readBytesFromStream(is);\n \n // Pass java.jpg as an array of bytes\n xop.setBytes(data);\n \n // Wrap java.jpg as a DataHandler\n xop.setDatahandler(new DataHandler(\n new ByteArrayDataSource(data, \"application/octet-stream\")));\n \n if (Boolean.getBoolean(\"java.awt.headless\")) {\n System.out.println(\"Running headless. Ignoring an Image property.\");\n } else {\n xop.setImage(getImage(\"/java.jpg\"));\n }\n \n return xop;\n }", "private void _handleMultiValues(ArrayList<String> values, String key, String command) {\n if (key == null) return;\n\n if (values == null || values.isEmpty()) {\n _generateEmptyMultiValueError(key);\n return;\n }\n\n ValidationResult vr;\n\n // validate the key\n vr = validator.cleanMultiValuePropertyKey(key);\n\n // Check for an error\n if (vr.getErrorCode() != 0) {\n pushValidationResult(vr);\n }\n\n // reset the key\n Object _key = vr.getObject();\n String cleanKey = (_key != null) ? vr.getObject().toString() : null;\n\n // if key is empty generate an error and return\n if (cleanKey == null || cleanKey.isEmpty()) {\n _generateInvalidMultiValueKeyError(key);\n return;\n }\n\n key = cleanKey;\n\n try {\n JSONArray currentValues = _constructExistingMultiValue(key, command);\n JSONArray newValues = _cleanMultiValues(values, key);\n _validateAndPushMultiValue(currentValues, newValues, values, key, command);\n\n } catch (Throwable t) {\n getConfigLogger().verbose(getAccountId(), \"Error handling multi value operation for key \" + key, t);\n }\n }", "private void updateToNextWorkStart(Calendar cal)\n {\n Date originalDate = cal.getTime();\n\n //\n // Find the date ranges for the current day\n //\n ProjectCalendarDateRanges ranges = getRanges(originalDate, cal, null);\n\n if (ranges != null)\n {\n //\n // Do we have a start time today?\n //\n Date calTime = DateHelper.getCanonicalTime(cal.getTime());\n Date startTime = null;\n for (DateRange range : ranges)\n {\n Date rangeStart = DateHelper.getCanonicalTime(range.getStart());\n Date rangeEnd = DateHelper.getCanonicalTime(range.getEnd());\n Date rangeStartDay = DateHelper.getDayStartDate(range.getStart());\n Date rangeEndDay = DateHelper.getDayStartDate(range.getEnd());\n\n if (rangeStartDay.getTime() != rangeEndDay.getTime())\n {\n rangeEnd = DateHelper.addDays(rangeEnd, 1);\n }\n\n if (calTime.getTime() < rangeEnd.getTime())\n {\n if (calTime.getTime() > rangeStart.getTime())\n {\n startTime = calTime;\n }\n else\n {\n startTime = rangeStart;\n }\n break;\n }\n }\n\n //\n // If we don't have a start time today - find the next working day\n // then retrieve the start time.\n //\n if (startTime == null)\n {\n Day day;\n int nonWorkingDayCount = 0;\n do\n {\n cal.set(Calendar.DAY_OF_YEAR, cal.get(Calendar.DAY_OF_YEAR) + 1);\n day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK));\n ++nonWorkingDayCount;\n if (nonWorkingDayCount > MAX_NONWORKING_DAYS)\n {\n cal.setTime(originalDate);\n break;\n }\n }\n while (!isWorkingDate(cal.getTime(), day));\n\n startTime = getStartTime(cal.getTime());\n }\n\n DateHelper.setTime(cal, startTime);\n }\n }", "public static base_responses change(nitro_service client, sslcertkey resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tsslcertkey updateresources[] = new sslcertkey[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tupdateresources[i] = new sslcertkey();\n\t\t\t\tupdateresources[i].certkey = resources[i].certkey;\n\t\t\t\tupdateresources[i].cert = resources[i].cert;\n\t\t\t\tupdateresources[i].key = resources[i].key;\n\t\t\t\tupdateresources[i].password = resources[i].password;\n\t\t\t\tupdateresources[i].fipskey = resources[i].fipskey;\n\t\t\t\tupdateresources[i].inform = resources[i].inform;\n\t\t\t\tupdateresources[i].passplain = resources[i].passplain;\n\t\t\t\tupdateresources[i].nodomaincheck = resources[i].nodomaincheck;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, updateresources,\"update\");\n\t\t}\n\t\treturn result;\n\t}" ]
Ask the specified player for the specified waveform detail from the specified media slot, first checking if we have a cached copy. @param dataReference uniquely identifies the desired waveform detail @return the waveform detail, if it was found, or {@code null} @throws IllegalStateException if the WaveformFinder is not running
[ "public WaveformDetail requestWaveformDetailFrom(final DataReference dataReference) {\n ensureRunning();\n for (WaveformDetail cached : detailHotCache.values()) {\n if (cached.dataReference.equals(dataReference)) { // Found a hot cue hit, use it.\n return cached;\n }\n }\n return requestDetailInternal(dataReference, false);\n }" ]
[ "public static double[] toDouble(int[] array) {\n double[] n = new double[array.length];\n for (int i = 0; i < array.length; i++) {\n n[i] = (double) array[i];\n }\n return n;\n }", "public String 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 String fixLanguageCodeIfDeprecated(String wikimediaLanguageCode) {\n\t\tif (DEPRECATED_LANGUAGE_CODES.containsKey(wikimediaLanguageCode)) {\n\t\t\treturn DEPRECATED_LANGUAGE_CODES.get(wikimediaLanguageCode);\n\t\t} else {\n\t\t\treturn wikimediaLanguageCode;\n\t\t}\n\t}", "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 static void addStory(File caseManager, String storyName,\n String testPath, String user, String feature, String benefit) throws BeastException {\n FileWriter caseManagerWriter;\n\n String storyClass = SystemReader.createClassName(storyName);\n try {\n BufferedReader reader = new BufferedReader(new FileReader(\n caseManager));\n String targetLine1 = \" public void \"\n + MASReader.createFirstLowCaseName(storyName) + \"() {\";\n String targetLine2 = \" Result result = JUnitCore.runClasses(\" + testPath + \".\"\n + storyClass + \".class);\";\n String in;\n while ((in = reader.readLine()) != null) {\n if (in.equals(targetLine1)) {\n while ((in = reader.readLine()) != null) {\n if (in.equals(targetLine2)) {\n reader.close();\n // This test is already written in the case manager.\n return;\n }\n }\n reader.close();\n throw new BeastException(\"Two different stories with the same name (same method name) are being created in the same CaseManager file. That is not possible. Please, change the name of the story: \" + testPath + \".\"\n + storyClass + \".java\");\n }\n }\n reader.close();\n caseManagerWriter = new FileWriter(caseManager, true);\n caseManagerWriter.write(\" /**\\n\");\n caseManagerWriter.write(\" * This is the story: \" + storyName\n + \"\\n\");\n caseManagerWriter.write(\" * requested by: \" + user + \"\\n\");\n caseManagerWriter.write(\" * providing the feature: \" + feature\n + \"\\n\");\n caseManagerWriter.write(\" * so the user gets the benefit: \"\n + benefit + \"\\n\");\n caseManagerWriter.write(\" */\\n\");\n caseManagerWriter.write(\" @Test\\n\");\n caseManagerWriter.write(\" public void \"\n + MASReader.createFirstLowCaseName(storyName) + \"() {\\n\");\n caseManagerWriter.write(\" Result result = JUnitCore.runClasses(\" + testPath\n + \".\" + storyClass + \".class);\\n\");\n caseManagerWriter.write(\" Assert.assertTrue(result.wasSuccessful());\\n\");\n caseManagerWriter.write(\" }\\n\");\n caseManagerWriter.write(\"\\n\");\n caseManagerWriter.flush();\n caseManagerWriter.close();\n } catch (IOException e) {\n Logger logger = Logger.getLogger(\"CreateMASCaseManager.createTest\");\n logger.info(\"ERROR writing the file\");\n }\n\n }", "public Object getProperty(Object object) {\n return java.lang.reflect.Array.getLength(object);\n }", "public String getResourceFilename() {\n switch (resourceType) {\n case ANDROID_ASSETS:\n return assetPath\n .substring(assetPath.lastIndexOf(File.separator) + 1);\n\n case ANDROID_RESOURCE:\n return resourceFilePath.substring(\n resourceFilePath.lastIndexOf(File.separator) + 1);\n\n case LINUX_FILESYSTEM:\n return filePath.substring(filePath.lastIndexOf(File.separator) + 1);\n\n case NETWORK:\n return url.getPath().substring(url.getPath().lastIndexOf(\"/\") + 1);\n\n case INPUT_STREAM:\n return inputStreamName;\n\n default:\n return null;\n }\n }", "public void removeWorstFit() {\n // find the observation with the most error\n int worstIndex=-1;\n double worstError = -1;\n\n for( int i = 0; i < y.numRows; i++ ) {\n double predictedObs = 0;\n\n for( int j = 0; j < coef.numRows; j++ ) {\n predictedObs += A.get(i,j)*coef.get(j,0);\n }\n\n double error = Math.abs(predictedObs- y.get(i,0));\n\n if( error > worstError ) {\n worstError = error;\n worstIndex = i;\n }\n }\n\n // nothing left to remove, so just return\n if( worstIndex == -1 )\n return;\n\n // remove that observation\n removeObservation(worstIndex);\n\n // update A\n solver.removeRowFromA(worstIndex);\n\n // solve for the parameters again\n solver.solve(y,coef);\n }", "private List<Row> getTable(String name)\n {\n List<Row> result = m_tables.get(name);\n if (result == null)\n {\n result = Collections.emptyList();\n }\n return result;\n }" ]
Returns a query filter for the given document _id and version. The version is allowed to be null. The query will match only if there is either no version on the document in the database in question if we have no reference of the version or if the version matches the database's version. @param documentId the _id of the document. @param version the expected version of the document, if any. @return a query filter for the given document _id and version for a remote operation.
[ "static BsonDocument getVersionedFilter(\n @Nonnull final BsonValue documentId,\n @Nullable final BsonValue version\n ) {\n final BsonDocument filter = new BsonDocument(\"_id\", documentId);\n if (version == null) {\n filter.put(DOCUMENT_VERSION_FIELD, new BsonDocument(\"$exists\", BsonBoolean.FALSE));\n } else {\n filter.put(DOCUMENT_VERSION_FIELD, version);\n }\n return filter;\n }" ]
[ "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 }", "private void onConnectionClose(final Connection closed) {\n synchronized (this) {\n if(connection == closed) {\n connection = null;\n if(shutdown) {\n connectTask = DISCONNECTED;\n return;\n }\n final ConnectTask previous = connectTask;\n connectTask = previous.connectionClosed();\n }\n }\n }", "public static List<String> toList(CharSequence self) {\n String s = self.toString();\n int size = s.length();\n List<String> answer = new ArrayList<String>(size);\n for (int i = 0; i < size; i++) {\n answer.add(s.substring(i, i + 1));\n }\n return answer;\n }", "protected boolean boot(List<ModelNode> bootOperations, boolean rollbackOnRuntimeFailure) throws ConfigurationPersistenceException {\n return boot(bootOperations, rollbackOnRuntimeFailure, false, ModelControllerImpl.getMutableRootResourceRegistrationProvider());\n }", "@GET\n @Produces(MediaType.APPLICATION_JSON)\n @Path(\"/graph/{name}/{version}\")\n public Response getModuleGraph(@PathParam(\"name\") final String moduleName,\n @PathParam(\"version\") final String moduleVersion,\n @Context final UriInfo uriInfo){\n\n LOG.info(\"Dependency Checker got a get module graph export request.\");\n\n if(moduleName == null || moduleVersion == null){\n return Response.serverError().status(HttpStatus.NOT_ACCEPTABLE_406).build();\n }\n\n final FiltersHolder filters = new FiltersHolder();\n filters.init(uriInfo.getQueryParameters());\n\n final String moduleId = DbModule.generateID(moduleName, moduleVersion);\n final AbstractGraph moduleGraph = getGraphsHandler(filters).getModuleGraph(moduleId);\n\n return Response.ok(moduleGraph).build();\n }", "private ClassTypeSignature getClassTypeSignature(\r\n\t\t\tParameterizedType parameterizedType) {\r\n\t\tClass<?> rawType = (Class<?>) parameterizedType.getRawType();\r\n\t\tType[] typeArguments = parameterizedType.getActualTypeArguments();\r\n\t\tTypeArgSignature[] typeArgSignatures = new TypeArgSignature[typeArguments.length];\r\n\t\tfor (int i = 0; i < typeArguments.length; i++) {\r\n\t\t\ttypeArgSignatures[i] = getTypeArgSignature(typeArguments[i]);\r\n\t\t}\r\n\r\n\t\tString binaryName = rawType.isMemberClass() ? rawType.getSimpleName()\r\n\t\t\t\t: rawType.getName();\r\n\t\tClassTypeSignature ownerTypeSignature = parameterizedType\r\n\t\t\t\t.getOwnerType() == null ? null\r\n\t\t\t\t: (ClassTypeSignature) getFullTypeSignature(parameterizedType\r\n\t\t\t\t\t\t.getOwnerType());\r\n\t\tClassTypeSignature classTypeSignature = new ClassTypeSignature(\r\n\t\t\t\tbinaryName, typeArgSignatures, ownerTypeSignature);\r\n\t\treturn classTypeSignature;\r\n\t}", "public static nstimer_binding get(nitro_service service, String name) throws Exception{\n\t\tnstimer_binding obj = new nstimer_binding();\n\t\tobj.set_name(name);\n\t\tnstimer_binding response = (nstimer_binding) obj.get_resource(service);\n\t\treturn response;\n\t}", "public Point measureImage(Resources resources) {\n BitmapFactory.Options justBoundsOptions = new BitmapFactory.Options();\n justBoundsOptions.inJustDecodeBounds = true;\n\n if (bitmap != null) {\n return new Point(bitmap.getWidth(), bitmap.getHeight());\n } else if (resId != null) {\n BitmapFactory.decodeResource(resources, resId, justBoundsOptions);\n float scale = (float) justBoundsOptions.inTargetDensity / justBoundsOptions.inDensity;\n return new Point((int) (justBoundsOptions.outWidth * scale + 0.5f), (int) (justBoundsOptions.outHeight * scale + 0.5f));\n } else if (fileToBitmap != null) {\n BitmapFactory.decodeFile(fileToBitmap.getAbsolutePath(), justBoundsOptions);\n } else if (inputStream != null) {\n BitmapFactory.decodeStream(inputStream, null, justBoundsOptions);\n try {\n inputStream.reset();\n } catch (IOException ignored) {\n }\n } else if (view != null) {\n return new Point(view.getWidth(), view.getHeight());\n }\n return new Point(justBoundsOptions.outWidth, justBoundsOptions.outHeight);\n }", "private static MonolingualTextValue toTerm(MonolingualTextValue term) {\n\t\treturn term instanceof TermImpl ? term : new TermImpl(term.getLanguageCode(), term.getText());\n\t}" ]
Obtains a Pax local date-time from another date-time object. @param temporal the date-time object to convert, not null @return the Pax local date-time, not null @throws DateTimeException if unable to create the date-time
[ "@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoLocalDateTime<PaxDate> localDateTime(TemporalAccessor temporal) {\n return (ChronoLocalDateTime<PaxDate>) super.localDateTime(temporal);\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 ItemRequest<Task> removeTag(String task) {\n \n String path = String.format(\"/tasks/%s/removeTag\", task);\n return new ItemRequest<Task>(this, Task.class, path, \"POST\");\n }", "private int read() {\n int curByte = 0;\n try {\n curByte = rawData.get() & 0xFF;\n } catch (Exception e) {\n header.status = GifDecoder.STATUS_FORMAT_ERROR;\n }\n return curByte;\n }", "public DiscreteInterval plus(DiscreteInterval other) {\n return new DiscreteInterval(this.min + other.min, this.max + other.max);\n }", "public static vpnsessionaction[] get(nitro_service service) throws Exception{\n\t\tvpnsessionaction obj = new vpnsessionaction();\n\t\tvpnsessionaction[] response = (vpnsessionaction[])obj.get_resources(service);\n\t\treturn response;\n\t}", "public 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 }", "public PhotoList<Photo> getContactsPhotos(int count, boolean justFriends, boolean singlePhoto, boolean includeSelf) throws FlickrException {\r\n PhotoList<Photo> photos = new PhotoList<Photo>();\r\n\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_CONTACTS_PHOTOS);\r\n\r\n if (count > 0) {\r\n parameters.put(\"count\", Integer.toString(count));\r\n }\r\n if (justFriends) {\r\n parameters.put(\"just_friends\", \"1\");\r\n }\r\n if (singlePhoto) {\r\n parameters.put(\"single_photo\", \"1\");\r\n }\r\n if (includeSelf) {\r\n parameters.put(\"include_self\", \"1\");\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 NodeList photoNodes = photosElement.getElementsByTagName(\"photo\");\r\n photos.setPage(\"1\");\r\n photos.setPages(\"1\");\r\n photos.setPerPage(\"\" + photoNodes.getLength());\r\n photos.setTotal(\"\" + photoNodes.getLength());\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 synchronized ControlPoint getControlPoint(final String deploymentName, final String entryPointName) {\n ControlPointIdentifier id = new ControlPointIdentifier(deploymentName, entryPointName);\n ControlPoint ep = entryPoints.get(id);\n if (ep == null) {\n ep = new ControlPoint(this, deploymentName, entryPointName, trackIndividualControlPoints);\n entryPoints.put(id, ep);\n }\n ep.increaseReferenceCount();\n return ep;\n }", "public static VectorTile.Tile.GeomType toGeomType(Geometry geometry) {\n VectorTile.Tile.GeomType result = VectorTile.Tile.GeomType.UNKNOWN;\n\n if(geometry instanceof Point\n || geometry instanceof MultiPoint) {\n result = VectorTile.Tile.GeomType.POINT;\n\n } else if(geometry instanceof LineString\n || geometry instanceof MultiLineString) {\n result = VectorTile.Tile.GeomType.LINESTRING;\n\n } else if(geometry instanceof Polygon\n || geometry instanceof MultiPolygon) {\n result = VectorTile.Tile.GeomType.POLYGON;\n }\n\n return result;\n }" ]
Generate a call to the delegate object.
[ "protected MethodVisitor makeDelegateCall(final String name, final String desc, final String signature, final String[] exceptions, final int accessFlags) {\n MethodVisitor mv = super.visitMethod(accessFlags, name, desc, signature, exceptions);\n mv.visitVarInsn(ALOAD, 0); // load this\n mv.visitFieldInsn(GETFIELD, proxyName, DELEGATE_OBJECT_FIELD, BytecodeHelper.getTypeDescription(delegateClass)); // load delegate\n // using InvokerHelper to allow potential intercepted calls\n int size;\n mv.visitLdcInsn(name); // method name\n Type[] args = Type.getArgumentTypes(desc);\n BytecodeHelper.pushConstant(mv, args.length);\n mv.visitTypeInsn(ANEWARRAY, \"java/lang/Object\");\n size = 6;\n int idx = 1;\n for (int i = 0; i < args.length; i++) {\n Type arg = args[i];\n mv.visitInsn(DUP);\n BytecodeHelper.pushConstant(mv, i);\n // primitive types must be boxed\n if (isPrimitive(arg)) {\n mv.visitIntInsn(getLoadInsn(arg), idx);\n String wrappedType = getWrappedClassDescriptor(arg);\n mv.visitMethodInsn(INVOKESTATIC, wrappedType, \"valueOf\", \"(\" + arg.getDescriptor() + \")L\" + wrappedType + \";\", false);\n } else {\n mv.visitVarInsn(ALOAD, idx); // load argument i\n }\n size = Math.max(size, 5+registerLen(arg));\n idx += registerLen(arg);\n mv.visitInsn(AASTORE); // store value into array\n }\n mv.visitMethodInsn(INVOKESTATIC, \"org/codehaus/groovy/runtime/InvokerHelper\", \"invokeMethod\", \"(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;\", false);\n unwrapResult(mv, desc);\n mv.visitMaxs(size, registerLen(args) + 1);\n\n return mv;\n }" ]
[ "static GVRPerspectiveCamera makePerspShadowCamera(GVRPerspectiveCamera centerCam, float coneAngle)\n {\n GVRPerspectiveCamera camera = new GVRPerspectiveCamera(centerCam.getGVRContext());\n float near = centerCam.getNearClippingDistance();\n float far = centerCam.getFarClippingDistance();\n\n camera.setNearClippingDistance(near);\n camera.setFarClippingDistance(far);\n camera.setFovY((float) Math.toDegrees(coneAngle));\n camera.setAspectRatio(1.0f);\n return camera;\n }", "protected String sourceLine(ASTNode node) {\r\n return sourceCode.getLines().get(AstUtil.findFirstNonAnnotationLine(node, sourceCode) - 1);\r\n }", "public double compute( DMatrix1Row mat ) {\n if( width != mat.numCols || width != mat.numRows ) {\n throw new RuntimeException(\"Unexpected matrix dimension\");\n }\n\n // make sure everything is in the proper state before it starts\n initStructures();\n\n// System.arraycopy(mat.data,0,minorMatrix[0],0,mat.data.length);\n\n int level = 0;\n while( true ) {\n int levelWidth = width-level;\n int levelIndex = levelIndexes[level];\n\n if( levelIndex == levelWidth ) {\n if( level == 0 ) {\n return levelResults[0];\n }\n int prevLevelIndex = levelIndexes[level-1]++;\n\n double val = mat.get((level-1)*width+levelRemoved[level-1]);\n if( prevLevelIndex % 2 == 0 ) {\n levelResults[level-1] += val * levelResults[level];\n } else {\n levelResults[level-1] -= val * levelResults[level];\n }\n\n putIntoOpen(level-1);\n\n levelResults[level] = 0;\n levelIndexes[level] = 0;\n level--;\n } else {\n int excluded = openRemove( levelIndex );\n\n levelRemoved[level] = excluded;\n\n if( levelWidth == minWidth ) {\n createMinor(mat);\n double subresult = mat.get(level*width+levelRemoved[level]);\n\n subresult *= UnrolledDeterminantFromMinor_DDRM.det(tempMat);\n\n if( levelIndex % 2 == 0 ) {\n levelResults[level] += subresult;\n } else {\n levelResults[level] -= subresult;\n }\n\n // put it back into the list\n putIntoOpen(level);\n levelIndexes[level]++;\n } else {\n level++;\n }\n }\n }\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 UpdateBuilder<T, ID> updateColumnExpression(String columnName, String expression) throws SQLException {\n\t\tFieldType fieldType = verifyColumnName(columnName);\n\t\tif (fieldType.isForeignCollection()) {\n\t\t\tthrow new SQLException(\"Can't update foreign colletion field: \" + columnName);\n\t\t}\n\t\taddUpdateColumnToList(columnName, new SetExpression(columnName, fieldType, expression));\n\t\treturn this;\n\t}", "public String getNextDay(String dateString, boolean onlyBusinessDays) {\n DateTimeFormatter parser = ISODateTimeFormat.date();\n DateTime date = parser.parseDateTime(dateString).plusDays(1);\n Calendar cal = Calendar.getInstance();\n cal.setTime(date.toDate());\n\n if (onlyBusinessDays) {\n if (cal.get(Calendar.DAY_OF_WEEK) == 1 || cal.get(Calendar.DAY_OF_WEEK) == 7\n || isHoliday(date.toString().substring(0, 10))) {\n return getNextDay(date.toString().substring(0, 10), true);\n } else {\n return parser.print(date);\n }\n } else {\n return parser.print(date);\n }\n }", "public Indexes listIndexes() {\n URI uri = new DatabaseURIHelper(db.getDBUri()).path(\"_index\").build();\n return client.couchDbClient.get(uri, Indexes.class);\n }", "public static base_response update(nitro_service client, nsdiameter resource) throws Exception {\n\t\tnsdiameter updateresource = new nsdiameter();\n\t\tupdateresource.identity = resource.identity;\n\t\tupdateresource.realm = resource.realm;\n\t\tupdateresource.serverclosepropagation = resource.serverclosepropagation;\n\t\treturn updateresource.update_resource(client);\n\t}", "protected int getRequestTypeFromString(String requestType) {\n if (\"GET\".equals(requestType)) {\n return REQUEST_TYPE_GET;\n }\n if (\"POST\".equals(requestType)) {\n return REQUEST_TYPE_POST;\n }\n if (\"PUT\".equals(requestType)) {\n return REQUEST_TYPE_PUT;\n }\n if (\"DELETE\".equals(requestType)) {\n return REQUEST_TYPE_DELETE;\n }\n return REQUEST_TYPE_ALL;\n }" ]
Inserts 'token' after 'where'. if where is null then it is inserted to the beginning of the list. @param where Where 'token' should be inserted after. if null the put at it at the beginning @param token The token that is to be inserted
[ "public void insert( Token where , Token token ) {\n if( where == null ) {\n // put at the front of the list\n if( size == 0 )\n push(token);\n else {\n first.previous = token;\n token.previous = null;\n token.next = first;\n first = token;\n size++;\n }\n } else if( where == last || null == last ) {\n push(token);\n } else {\n token.next = where.next;\n token.previous = where;\n where.next.previous = token;\n where.next = token;\n size++;\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 }", "private static Data loadLeapSeconds() {\n Data bestData = null;\n URL url = null;\n try {\n // this is the new location of the file, working on Java 8, Java 9 class path and Java 9 module path\n Enumeration<URL> en = Thread.currentThread().getContextClassLoader().getResources(\"META-INF/\" + LEAP_SECONDS_TXT);\n while (en.hasMoreElements()) {\n url = en.nextElement();\n Data candidate = loadLeapSeconds(url);\n if (bestData == null || candidate.getNewestDate() > bestData.getNewestDate()) {\n bestData = candidate;\n }\n }\n // this location does not work on Java 9 module path because the resource is encapsulated\n en = Thread.currentThread().getContextClassLoader().getResources(LEAP_SECONDS_TXT);\n while (en.hasMoreElements()) {\n url = en.nextElement();\n Data candidate = loadLeapSeconds(url);\n if (bestData == null || candidate.getNewestDate() > bestData.getNewestDate()) {\n bestData = candidate;\n }\n }\n // this location is the canonical one, and class-based loading works on Java 9 module path\n url = SystemUtcRules.class.getResource(\"/\" + LEAP_SECONDS_TXT);\n if (url != null) {\n Data candidate = loadLeapSeconds(url);\n if (bestData == null || candidate.getNewestDate() > bestData.getNewestDate()) {\n bestData = candidate;\n }\n }\n } catch (Exception ex) {\n throw new RuntimeException(\"Unable to load time-zone rule data: \" + url, ex);\n }\n if (bestData == null) {\n // no data on classpath, but we allow manual registration of leap seconds\n // setup basic known data - MJD 1972-01-01 is 41317L, where offset was 10\n bestData = new Data(new long[] {41317L}, new int[] {10}, new long[] {tai(41317L, 10)});\n }\n return bestData;\n }", "public static appfwpolicylabel_stats[] get(nitro_service service) throws Exception{\n\t\tappfwpolicylabel_stats obj = new appfwpolicylabel_stats();\n\t\tappfwpolicylabel_stats[] response = (appfwpolicylabel_stats[])obj.stat_resources(service);\n\t\treturn response;\n\t}", "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 static boolean strictCheckMatchingTags(Collection<String> tags, Set<String> includeTags, Set<String> excludeTags)\n {\n boolean includeTagsEnabled = !includeTags.isEmpty();\n\n for (String tag : tags)\n {\n boolean isIncluded = includeTags.contains(tag);\n boolean isExcluded = excludeTags.contains(tag);\n\n if ((includeTagsEnabled && isIncluded) || (!includeTagsEnabled && !isExcluded))\n {\n return true;\n }\n }\n\n return false;\n }", "public static Integer convertPathIdentifier(String identifier, Integer profileId) throws Exception {\n Integer pathId = -1;\n try {\n pathId = Integer.parseInt(identifier);\n } catch (NumberFormatException ne) {\n // this is OK.. just means it's not a #\n if (profileId == null)\n throw new Exception(\"A profileId must be specified\");\n\n pathId = PathOverrideService.getInstance().getPathId(identifier, profileId);\n }\n\n return pathId;\n }", "public static JsonPatch generate(final JsonNode source, final JsonNode target, ReplaceMode replaceMode) {\n requireNonNull(source, \"source\");\n requireNonNull(target, \"target\");\n final DiffProcessor processor = new DiffProcessor(replaceMode, () -> unchangedValues(source, target));\n generateDiffs(processor, EMPTY_JSON_POINTER, source, target);\n return processor.getPatch();\n }", "public StatementBuilder withQualifierValue(PropertyIdValue propertyIdValue,\n\t\t\tValue value) {\n\t\twithQualifier(factory.getValueSnak(propertyIdValue, value));\n\t\treturn getThis();\n\t}", "public static <GIVEN, WHEN, THEN> Scenario<GIVEN, WHEN, THEN> create( Class<GIVEN> givenClass, Class<WHEN> whenClass,\n Class<THEN> thenClass ) {\n return new Scenario<GIVEN, WHEN, THEN>( givenClass, whenClass, thenClass );\n }" ]
Read activity code types and values. @param types activity code type data @param typeValues activity code value data @param assignments activity code task assignments
[ "public void processActivityCodes(List<Row> types, List<Row> typeValues, List<Row> assignments)\n {\n ActivityCodeContainer container = m_project.getActivityCodes();\n Map<Integer, ActivityCode> map = new HashMap<Integer, ActivityCode>();\n\n for (Row row : types)\n {\n ActivityCode code = new ActivityCode(row.getInteger(\"actv_code_type_id\"), row.getString(\"actv_code_type\"));\n container.add(code);\n map.put(code.getUniqueID(), code);\n }\n\n for (Row row : typeValues)\n {\n ActivityCode code = map.get(row.getInteger(\"actv_code_type_id\"));\n if (code != null)\n {\n ActivityCodeValue value = code.addValue(row.getInteger(\"actv_code_id\"), row.getString(\"short_name\"), row.getString(\"actv_code_name\"));\n m_activityCodeMap.put(value.getUniqueID(), value);\n }\n }\n\n for (Row row : assignments)\n {\n Integer taskID = row.getInteger(\"task_id\");\n List<Integer> list = m_activityCodeAssignments.get(taskID);\n if (list == null)\n {\n list = new ArrayList<Integer>();\n m_activityCodeAssignments.put(taskID, list);\n }\n list.add(row.getInteger(\"actv_code_id\"));\n }\n }" ]
[ "public static void calculateLegendInformation(List<? extends BaseModel> _Models, float _StartX, float _EndX, Paint _Paint) {\n float textMargin = Utils.dpToPx(10.f);\n float lastX = _StartX;\n\n // calculate the legend label positions and check if there is enough space to display the label,\n // if not the label will not be shown\n for (BaseModel model : _Models) {\n if (!model.isIgnore()) {\n Rect textBounds = new Rect();\n RectF legendBounds = model.getLegendBounds();\n\n _Paint.getTextBounds(model.getLegendLabel(), 0, model.getLegendLabel().length(), textBounds);\n model.setTextBounds(textBounds);\n\n float centerX = legendBounds.centerX();\n float centeredTextPos = centerX - (textBounds.width() / 2);\n float textStartPos = centeredTextPos - textMargin;\n\n // check if the text is too big to fit on the screen\n if (centeredTextPos + textBounds.width() > _EndX - textMargin) {\n model.setShowLabel(false);\n } else {\n // check if the current legend label overrides the label before\n // if the label overrides the label before, the current label will not be shown.\n // If not the label will be shown and the label position is calculated\n if (textStartPos < lastX) {\n if (lastX + textMargin < legendBounds.left) {\n model.setLegendLabelPosition((int) (lastX + textMargin));\n model.setShowLabel(true);\n lastX = lastX + textMargin + textBounds.width();\n } else {\n model.setShowLabel(false);\n }\n } else {\n model.setShowLabel(true);\n model.setLegendLabelPosition((int) centeredTextPos);\n lastX = centerX + (textBounds.width() / 2);\n }\n }\n }\n }\n\n }", "@Override\n public final synchronized void stopService(long millis) {\n running = false;\n try {\n if (keepRunning) {\n keepRunning = false;\n interrupt();\n quit();\n if (0L == millis) {\n join();\n } else {\n join(millis);\n }\n }\n } catch (InterruptedException e) {\n //its possible that the thread exits between the lines keepRunning=false and interrupt above\n log.warn(\"Got interrupted while stopping {}\", this, e);\n\n Thread.currentThread().interrupt();\n }\n }", "@Override\n public final String getString(final String key) {\n String result = optString(key);\n if (result == null) {\n throw new ObjectMissingException(this, key);\n }\n return result;\n }", "private void deliverMasterYieldCommand(int toPlayer) {\n for (final MasterHandoffListener listener : getMasterHandoffListeners()) {\n try {\n listener.yieldMasterTo(toPlayer);\n } catch (Throwable t) {\n logger.warn(\"Problem delivering master yield command to listener\", t);\n }\n }\n }", "protected void concatenateReports() {\n\n if (!concatenatedReports.isEmpty()) { // dummy group for page break if needed\n DJGroup globalGroup = createDummyGroup();\n report.getColumnsGroups().add(0, globalGroup);\n }\n\n for (Subreport subreport : concatenatedReports) {\n DJGroup globalGroup = createDummyGroup();\n globalGroup.getFooterSubreports().add(subreport);\n report.getColumnsGroups().add(0, globalGroup);\n }\n }", "public static Cluster swapGreedyRandomPartitions(final Cluster nextCandidateCluster,\n final List<Integer> nodeIds,\n final int greedySwapMaxPartitionsPerNode,\n final int greedySwapMaxPartitionsPerZone,\n List<StoreDefinition> storeDefs) {\n\n System.out.println(\"GreedyRandom : nodeIds:\" + nodeIds);\n Cluster returnCluster = Cluster.cloneCluster(nextCandidateCluster);\n double currentUtility = new PartitionBalance(returnCluster, storeDefs).getUtility();\n int nodeIdA = -1;\n int nodeIdB = -1;\n int partitionIdA = -1;\n int partitionIdB = -1;\n\n for(int nodeIdAPrime: nodeIds) {\n System.out.println(\"GreedyRandom : processing nodeId:\" + nodeIdAPrime);\n List<Integer> partitionIdsAPrime = new ArrayList<Integer>();\n partitionIdsAPrime.addAll(returnCluster.getNodeById(nodeIdAPrime).getPartitionIds());\n Collections.shuffle(partitionIdsAPrime);\n\n int maxPartitionsInAPrime = Math.min(greedySwapMaxPartitionsPerNode,\n partitionIdsAPrime.size());\n\n for(int offsetAPrime = 0; offsetAPrime < maxPartitionsInAPrime; offsetAPrime++) {\n Integer partitionIdAPrime = partitionIdsAPrime.get(offsetAPrime);\n List<Pair<Integer, Integer>> partitionIdsZone = new ArrayList<Pair<Integer, Integer>>();\n for(int nodeIdBPrime: nodeIds) {\n if(nodeIdBPrime == nodeIdAPrime)\n continue;\n for(Integer partitionIdBPrime: returnCluster.getNodeById(nodeIdBPrime)\n .getPartitionIds()) {\n partitionIdsZone.add(new Pair<Integer, Integer>(nodeIdBPrime,\n partitionIdBPrime));\n }\n }\n\n Collections.shuffle(partitionIdsZone);\n int maxPartitionsInZone = Math.min(greedySwapMaxPartitionsPerZone,\n partitionIdsZone.size());\n for(int offsetZone = 0; offsetZone < maxPartitionsInZone; offsetZone++) {\n Integer nodeIdBPrime = partitionIdsZone.get(offsetZone).getFirst();\n Integer partitionIdBPrime = partitionIdsZone.get(offsetZone).getSecond();\n Cluster swapResult = swapPartitions(returnCluster,\n nodeIdAPrime,\n partitionIdAPrime,\n nodeIdBPrime,\n partitionIdBPrime);\n double swapUtility = new PartitionBalance(swapResult, storeDefs).getUtility();\n if(swapUtility < currentUtility) {\n currentUtility = swapUtility;\n System.out.println(\" -> \" + currentUtility);\n nodeIdA = nodeIdAPrime;\n partitionIdA = partitionIdAPrime;\n nodeIdB = nodeIdBPrime;\n partitionIdB = partitionIdBPrime;\n }\n }\n }\n }\n\n if(nodeIdA == -1) {\n return returnCluster;\n }\n return swapPartitions(returnCluster, nodeIdA, partitionIdA, nodeIdB, partitionIdB);\n }", "public void onDrawFrame(float frameTime)\n {\n if (isEnabled() && (mScene != null) && mPickEventLock.tryLock())\n {\n // Don't call if we are in the middle of processing another pick\n try\n {\n doPick();\n }\n finally\n {\n mPickEventLock.unlock();\n }\n }\n }", "public static void validate(final Module module) {\n if (null == module) {\n throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)\n .entity(\"Module cannot be null!\")\n .build());\n }\n if(module.getName() == null ||\n module.getName().isEmpty()){\n throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)\n .entity(\"Module name cannot be null or empty!\")\n .build());\n }\n if(module.getVersion()== null ||\n module.getVersion().isEmpty()){\n throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)\n .entity(\"Module version cannot be null or empty!\")\n .build());\n }\n\n // Check artifacts\n for(final Artifact artifact: DataUtils.getAllArtifacts(module)){\n validate(artifact);\n }\n\n // Check dependencies\n for(final Dependency dependency: DataUtils.getAllDependencies(module)){\n validate(dependency.getTarget());\n }\n }", "private String getCacheFormatEntry() throws IOException {\n ZipEntry zipEntry = zipFile.getEntry(CACHE_FORMAT_ENTRY);\n InputStream is = zipFile.getInputStream(zipEntry);\n try {\n Scanner s = new Scanner(is, \"UTF-8\").useDelimiter(\"\\\\A\");\n String tag = null;\n if (s.hasNext()) tag = s.next();\n return tag;\n } finally {\n is.close();\n }\n }" ]
Use this API to update autoscaleaction.
[ "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}" ]
[ "public Where<T, ID> or() {\n\t\tManyClause clause = new ManyClause(pop(\"OR\"), ManyClause.OR_OPERATION);\n\t\tpush(clause);\n\t\taddNeedsFuture(clause);\n\t\treturn this;\n\t}", "private void addClasses(XMLStreamWriter writer, File jarFile, boolean mapClassMethods) throws IOException, ClassNotFoundException, XMLStreamException, IntrospectionException\n {\n ClassLoader currentThreadClassLoader = Thread.currentThread().getContextClassLoader();\n\n URLClassLoader loader = new URLClassLoader(new URL[]\n {\n jarFile.toURI().toURL()\n }, currentThreadClassLoader);\n\n JarFile jar = new JarFile(jarFile);\n Enumeration<JarEntry> enumeration = jar.entries();\n while (enumeration.hasMoreElements())\n {\n JarEntry jarEntry = enumeration.nextElement();\n if (!jarEntry.isDirectory() && jarEntry.getName().endsWith(\".class\"))\n {\n addClass(loader, jarEntry, writer, mapClassMethods);\n }\n }\n jar.close();\n }", "protected void capture3DScreenShot(GVRRenderTarget renderTarget, boolean isMultiview) {\n if (mScreenshot3DCallback == null) {\n return;\n }\n final Bitmap[] bitmaps = new Bitmap[6];\n renderSixCamerasAndReadback(mMainScene.getMainCameraRig(), bitmaps, renderTarget, isMultiview);\n returnScreenshot3DToCaller(mScreenshot3DCallback, bitmaps, mReadbackBufferWidth, mReadbackBufferHeight);\n\n mScreenshot3DCallback = null;\n }", "public RedwoodConfiguration clear(){\r\n tasks = new LinkedList<Runnable>();\r\n tasks.add(new Runnable(){ public void run(){\r\n Redwood.clearHandlers();\r\n Redwood.restoreSystemStreams();\r\n Redwood.clearLoggingClasses();\r\n } });\r\n return this;\r\n }", "private void populateCalendarException(Record record, ProjectCalendar calendar) throws MPXJException\n {\n Date fromDate = record.getDate(0);\n Date toDate = record.getDate(1);\n boolean working = record.getNumericBoolean(2);\n\n // I have found an example MPX file where a single day exception is expressed with just the start date set.\n // If we find this for we assume that the end date is the same as the start date.\n if (fromDate != null && toDate == null)\n {\n toDate = fromDate;\n }\n\n ProjectCalendarException exception = calendar.addCalendarException(fromDate, toDate);\n if (working)\n {\n addExceptionRange(exception, record.getTime(3), record.getTime(4));\n addExceptionRange(exception, record.getTime(5), record.getTime(6));\n addExceptionRange(exception, record.getTime(7), record.getTime(8));\n }\n }", "@Override\n protected void _acceptTimestampVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)\n throws JsonMappingException\n {\n SerializerProvider prov = visitor.getProvider();\n if ((prov != null) && useNanoseconds(prov)) {\n JsonNumberFormatVisitor v2 = visitor.expectNumberFormat(typeHint);\n if (v2 != null) {\n v2.numberType(NumberType.BIG_DECIMAL);\n }\n } else {\n JsonIntegerFormatVisitor v2 = visitor.expectIntegerFormat(typeHint);\n if (v2 != null) {\n v2.numberType(NumberType.LONG);\n }\n }\n }", "public void setMonth(String monthStr) {\n\n final Month month = Month.valueOf(monthStr);\n if ((m_model.getMonth() == null) || !m_model.getMonth().equals(monthStr)) {\n removeExceptionsOnChange(new Command() {\n\n public void execute() {\n\n m_model.setMonth(month);\n onValueChange();\n\n }\n });\n }\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}", "public static BoxRetentionPolicyAssignment.Info createAssignmentToMetadata(BoxAPIConnection api,\r\n String policyID,\r\n String templateID,\r\n MetadataFieldFilter... filter) {\r\n JsonObject assignTo = new JsonObject().add(\"type\", TYPE_METADATA).add(\"id\", templateID);\r\n JsonArray filters = null;\r\n if (filter.length > 0) {\r\n filters = new JsonArray();\r\n for (MetadataFieldFilter f : filter) {\r\n filters.add(f.getJsonObject());\r\n }\r\n }\r\n return createAssignment(api, policyID, assignTo, filters);\r\n }" ]
Obtains a local date in Julian calendar system from the era, year-of-era and day-of-year fields. @param era the Julian era, not null @param yearOfEra the year-of-era @param dayOfYear the day-of-year @return the Julian local date, not null @throws DateTimeException if unable to create the date @throws ClassCastException if the {@code era} is not a {@code JulianEra}
[ "@Override\n public JulianDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {\n return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);\n }" ]
[ "public static String parseServers(String zookeepers) {\n int slashIndex = zookeepers.indexOf(\"/\");\n if (slashIndex != -1) {\n return zookeepers.substring(0, slashIndex);\n }\n return zookeepers;\n }", "public static Variable upcastToGeneratedBuilder(\n SourceBuilder code, Datatype datatype, String builder) {\n return code.scope().computeIfAbsent(Declaration.UPCAST, () -> {\n Variable base = new Variable(\"base\");\n code.addLine(UPCAST_COMMENT)\n .addLine(\"%s %s = %s;\", datatype.getGeneratedBuilder(), base, builder);\n return base;\n });\n }", "public static int getId(Context context, String id, String defType) {\n String type = \"R.\" + defType + \".\";\n if (id.startsWith(type)) {\n id = id.substring(type.length());\n }\n\n Resources r = context.getResources();\n int resId = r.getIdentifier(id, defType,\n context.getPackageName());\n if (resId > 0) {\n return resId;\n } else {\n throw new RuntimeAssertion(\"Specified resource '%s' could not be found\", id);\n }\n }", "public List<Dependency> getModuleDependencies(final String moduleName, final String moduleVersion, final Boolean fullRecursive, final Boolean corporate, final Boolean thirdParty) throws GrapesCommunicationException {\n final Client client = getClient();\n final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactDependencies(moduleName, moduleVersion));\n final ClientResponse response = resource.queryParam(ServerAPI.SCOPE_COMPILE_PARAM, \"true\")\n .queryParam(ServerAPI.SCOPE_PROVIDED_PARAM, \"true\")\n .queryParam(ServerAPI.SCOPE_RUNTIME_PARAM, \"true\")\n .queryParam(ServerAPI.SCOPE_TEST_PARAM, \"true\")\n .queryParam(ServerAPI.RECURSIVE_PARAM, fullRecursive.toString())\n .queryParam(ServerAPI.SHOW_CORPORATE_PARAM, corporate.toString())\n .queryParam(ServerAPI.SHOW_THIRPARTY_PARAM, thirdParty.toString())\n .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);\n\n client.destroy();\n if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){\n final String message = String.format(FAILED_TO_GET_MODULE, \"get module ancestors \", moduleName, moduleVersion);\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<Dependency>>(){});\n }", "synchronized void start(final ManagedServerBootCmdFactory factory) {\n final InternalState required = this.requiredState;\n // Ignore if the server is already started\n if(required == InternalState.SERVER_STARTED) {\n return;\n }\n // In case the server failed to start, try to start it again\n if(required != InternalState.FAILED) {\n final InternalState current = this.internalState;\n if(current != required) {\n // TODO this perhaps should wait?\n throw new IllegalStateException();\n }\n }\n operationID = CurrentOperationIdHolder.getCurrentOperationID();\n bootConfiguration = factory.createConfiguration();\n requiredState = InternalState.SERVER_STARTED;\n ROOT_LOGGER.startingServer(serverName);\n transition();\n }", "@ArgumentsChecked\n\t@Throws(IllegalNullArgumentException.class)\n\tpublic static int checkLong(@Nonnull final Number number) {\n\t\tCheck.notNull(number, \"number\");\n\t\tif (!isInLongRange(number)) {\n\t\t\tthrow new IllegalNumberRangeException(number.toString(), LONG_MIN, LONG_MAX);\n\t\t}\n\n\t\treturn number.intValue();\n\t}", "public static int read(ReadableByteChannel channel, ByteBuffer buffer) throws IOException {\n int count = channel.read(buffer);\n if (count == -1) throw new EOFException(\"Received -1 when reading from channel, socket has likely been closed.\");\n return count;\n }", "public void originalClass(String template, Properties attributes) throws XDocletException\r\n {\r\n pushCurrentClass(_curClassDef.getOriginalClass());\r\n generate(template);\r\n popCurrentClass();\r\n }", "private ClassTypeSignature getClassTypeSignature(\r\n\t\t\tParameterizedType parameterizedType) {\r\n\t\tClass<?> rawType = (Class<?>) parameterizedType.getRawType();\r\n\t\tType[] typeArguments = parameterizedType.getActualTypeArguments();\r\n\t\tTypeArgSignature[] typeArgSignatures = new TypeArgSignature[typeArguments.length];\r\n\t\tfor (int i = 0; i < typeArguments.length; i++) {\r\n\t\t\ttypeArgSignatures[i] = getTypeArgSignature(typeArguments[i]);\r\n\t\t}\r\n\r\n\t\tString binaryName = rawType.isMemberClass() ? rawType.getSimpleName()\r\n\t\t\t\t: rawType.getName();\r\n\t\tClassTypeSignature ownerTypeSignature = parameterizedType\r\n\t\t\t\t.getOwnerType() == null ? null\r\n\t\t\t\t: (ClassTypeSignature) getFullTypeSignature(parameterizedType\r\n\t\t\t\t\t\t.getOwnerType());\r\n\t\tClassTypeSignature classTypeSignature = new ClassTypeSignature(\r\n\t\t\t\tbinaryName, typeArgSignatures, ownerTypeSignature);\r\n\t\treturn classTypeSignature;\r\n\t}" ]
call with lock on 'children' held
[ "private void registerChildInternal(IgnoreDomainResourceTypeResource child) {\n child.setParent(this);\n children.put(child.getName(), child);\n }" ]
[ "private void cleanupDestination(DownloadRequest request, boolean forceClean) {\n if (!request.isResumable() || forceClean) {\n Log.d(\"cleanupDestination() deleting \" + request.getDestinationURI().getPath());\n File destinationFile = new File(request.getDestinationURI().getPath());\n if (destinationFile.exists()) {\n destinationFile.delete();\n }\n }\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 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 Style createStyle(final List<Rule> styleRules) {\n final Rule[] rulesArray = styleRules.toArray(new Rule[0]);\n final FeatureTypeStyle featureTypeStyle = this.styleBuilder.createFeatureTypeStyle(null, rulesArray);\n final Style style = this.styleBuilder.createStyle();\n style.featureTypeStyles().add(featureTypeStyle);\n return style;\n }", "public void process(Resource resource, int index, byte[] data)\n {\n CostRateTable result = new CostRateTable();\n\n if (data != null)\n {\n for (int i = 16; i + 44 <= data.length; i += 44)\n {\n Rate standardRate = new Rate(MPPUtility.getDouble(data, i), TimeUnit.HOURS);\n TimeUnit standardRateFormat = getFormat(MPPUtility.getShort(data, i + 8));\n Rate overtimeRate = new Rate(MPPUtility.getDouble(data, i + 16), TimeUnit.HOURS);\n TimeUnit overtimeRateFormat = getFormat(MPPUtility.getShort(data, i + 24));\n Double costPerUse = NumberHelper.getDouble(MPPUtility.getDouble(data, i + 32) / 100.0);\n Date endDate = MPPUtility.getTimestampFromTenths(data, i + 40);\n CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRateFormat, overtimeRate, overtimeRateFormat, costPerUse, endDate);\n result.add(entry);\n }\n Collections.sort(result);\n }\n else\n {\n //\n // MS Project economises by not actually storing the first cost rate\n // table if it doesn't need to, so we take this into account here.\n //\n if (index == 0)\n {\n Rate standardRate = resource.getStandardRate();\n Rate overtimeRate = resource.getOvertimeRate();\n Number costPerUse = resource.getCostPerUse();\n CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRate.getUnits(), overtimeRate, overtimeRate.getUnits(), costPerUse, CostRateTableEntry.DEFAULT_ENTRY.getEndDate());\n result.add(entry);\n }\n else\n {\n result.add(CostRateTableEntry.DEFAULT_ENTRY);\n }\n }\n\n resource.setCostRateTable(index, result);\n }", "protected void eciProcess() {\n\n EciMode eci = EciMode.of(content, \"ISO8859_1\", 3)\n .or(content, \"ISO8859_2\", 4)\n .or(content, \"ISO8859_3\", 5)\n .or(content, \"ISO8859_4\", 6)\n .or(content, \"ISO8859_5\", 7)\n .or(content, \"ISO8859_6\", 8)\n .or(content, \"ISO8859_7\", 9)\n .or(content, \"ISO8859_8\", 10)\n .or(content, \"ISO8859_9\", 11)\n .or(content, \"ISO8859_10\", 12)\n .or(content, \"ISO8859_11\", 13)\n .or(content, \"ISO8859_13\", 15)\n .or(content, \"ISO8859_14\", 16)\n .or(content, \"ISO8859_15\", 17)\n .or(content, \"ISO8859_16\", 18)\n .or(content, \"Windows_1250\", 21)\n .or(content, \"Windows_1251\", 22)\n .or(content, \"Windows_1252\", 23)\n .or(content, \"Windows_1256\", 24)\n .or(content, \"SJIS\", 20)\n .or(content, \"UTF8\", 26);\n\n if (EciMode.NONE.equals(eci)) {\n throw new OkapiException(\"Unable to determine ECI mode.\");\n }\n\n eciMode = eci.mode;\n inputData = toBytes(content, eci.charset);\n\n encodeInfo += \"ECI Mode: \" + eci.mode + \"\\n\";\n encodeInfo += \"ECI Charset: \" + eci.charset.name() + \"\\n\";\n }", "protected static void checkQueues(final Iterable<String> queues) {\n if (queues == null) {\n throw new IllegalArgumentException(\"queues must not be null\");\n }\n for (final String queue : queues) {\n if (queue == null || \"\".equals(queue)) {\n throw new IllegalArgumentException(\"queues' members must not be null: \" + queues);\n }\n }\n }", "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 }", "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}" ]
When creating barcode columns @return
[ "protected AbstractColumn buildSimpleBarcodeColumn() {\n\t\tBarCodeColumn column = new BarCodeColumn();\n\t\tpopulateCommonAttributes(column);\n\t\tcolumn.setColumnProperty(columnProperty);\n\t\tcolumn.setExpressionToGroupBy(customExpressionToGroupBy);\n\t\tcolumn.setScaleMode(imageScaleMode);\n\t\tcolumn.setApplicationIdentifier(applicationIdentifier);\n\t\tcolumn.setBarcodeType(barcodeType);\n\t\tcolumn.setShowText(showText);\n\t\tcolumn.setCheckSum(checkSum);\n\t\treturn column;\n\t}" ]
[ "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 }", "private void addAllWithFilter(Map<String, String> toMap, Map<String, String> fromMap, IncludeExcludePatterns pattern) {\n for (Object o : fromMap.entrySet()) {\n Map.Entry entry = (Map.Entry) o;\n String key = (String) entry.getKey();\n if (PatternMatcher.pathConflicts(key, pattern)) {\n continue;\n }\n toMap.put(key, (String) entry.getValue());\n }\n }", "private Properties parseXML(Document doc, String sectionName) {\n\t\tint found = -1;\n\t\tProperties results = new Properties();\n\t\tNodeList config = null;\n\t\tif (sectionName == null){\n\t\t\tconfig = doc.getElementsByTagName(\"default-config\");\n\t\t\tfound = 0;\n\t\t} else {\n\t\t\tconfig = doc.getElementsByTagName(\"named-config\");\n\t\t\tif(config != null && config.getLength() > 0) {\n\t\t\t\tfor (int i = 0; i < config.getLength(); i++) {\n\t\t\t\t\tNode node = config.item(i);\n\t\t\t\t\tif(node.getNodeType() == Node.ELEMENT_NODE ){\n\t\t\t\t\t\tNamedNodeMap attributes = node.getAttributes();\n\t\t\t\t\t\tif (attributes != null && attributes.getLength() > 0){\n\t\t\t\t\t\t\tNode name = attributes.getNamedItem(\"name\");\n\t\t\t\t\t\t\tif (name.getNodeValue().equalsIgnoreCase(sectionName)){\n\t\t\t\t\t\t\t\tfound = i;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (found == -1){\n\t\t\t\tconfig = null;\n\t\t\t\tlogger.warn(\"Did not find \"+sectionName+\" section in config file. Reverting to defaults.\");\n\t\t\t}\n\t\t}\n\n\t\tif(config != null && config.getLength() > 0) {\n\t\t\tNode node = config.item(found);\n\t\t\tif(node.getNodeType() == Node.ELEMENT_NODE){\n\t\t\t\tElement elementEntry = (Element)node;\n\t\t\t\tNodeList childNodeList = elementEntry.getChildNodes();\n\t\t\t\tfor (int j = 0; j < childNodeList.getLength(); j++) {\n\t\t\t\t\tNode node_j = childNodeList.item(j);\n\t\t\t\t\tif (node_j.getNodeType() == Node.ELEMENT_NODE) {\n\t\t\t\t\t\tElement piece = (Element) node_j;\n\t\t\t\t\t\tNamedNodeMap attributes = piece.getAttributes();\n\t\t\t\t\t\tif (attributes != null && attributes.getLength() > 0){\n\t\t\t\t\t\t\tresults.put(attributes.item(0).getNodeValue(), piece.getTextContent());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn results;\n\t}", "public RandomVariable[]\tgetParameter() {\n\t\tdouble[] parameterAsDouble = this.getParameterAsDouble();\n\t\tRandomVariable[] parameter = new RandomVariable[parameterAsDouble.length];\n\t\tfor(int i=0; i<parameter.length; i++) {\n\t\t\tparameter[i] = new Scalar(parameterAsDouble[i]);\n\t\t}\n\t\treturn parameter;\n\t}", "public NodeList getAt(String name) {\n NodeList answer = new NodeList();\n for (Object child : this) {\n if (child instanceof Node) {\n Node childNode = (Node) child;\n Object temp = childNode.get(name);\n if (temp instanceof Collection) {\n answer.addAll((Collection) temp);\n } else {\n answer.add(temp);\n }\n }\n }\n return answer;\n }", "@Override\n public void process(TestCaseResult context) {\n context.getParameters().add(new Parameter()\n .withName(getName())\n .withValue(getValue())\n .withKind(ParameterKind.valueOf(getKind()))\n );\n }", "public List<Group> findAllGroups() {\n ArrayList<Group> allGroups = new ArrayList<Group>();\n PreparedStatement queryStatement = null;\n ResultSet results = null;\n try (Connection sqlConnection = sqlService.getConnection()) {\n queryStatement = sqlConnection.prepareStatement(\"SELECT * FROM \"\n + Constants.DB_TABLE_GROUPS +\n \" ORDER BY \" + Constants.GROUPS_GROUP_NAME);\n results = queryStatement.executeQuery();\n while (results.next()) {\n Group group = new Group();\n group.setId(results.getInt(Constants.GENERIC_ID));\n group.setName(results.getString(Constants.GROUPS_GROUP_NAME));\n allGroups.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 (queryStatement != null) {\n queryStatement.close();\n }\n } catch (Exception e) {\n }\n }\n\n return allGroups;\n }", "private void checkOrderby(CollectionDescriptorDef collDef, 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 orderbySpec = collDef.getProperty(PropertyHelper.OJB_PROPERTY_ORDERBY);\r\n\r\n if ((orderbySpec == null) || (orderbySpec.length() == 0))\r\n {\r\n return;\r\n }\r\n\r\n ClassDescriptorDef ownerClass = (ClassDescriptorDef)collDef.getOwner();\r\n String elementClassName = collDef.getProperty(PropertyHelper.OJB_PROPERTY_ELEMENT_CLASS_REF).replace('$', '.');\r\n ClassDescriptorDef elementClass = ((ModelDef)ownerClass.getOwner()).getClass(elementClassName);\r\n FieldDescriptorDef fieldDef;\r\n String token;\r\n String fieldName;\r\n String ordering;\r\n int pos;\r\n\r\n for (CommaListIterator it = new CommaListIterator(orderbySpec); it.hasNext();)\r\n {\r\n token = it.getNext();\r\n pos = token.indexOf('=');\r\n if (pos == -1)\r\n {\r\n fieldName = token;\r\n ordering = null;\r\n }\r\n else\r\n {\r\n fieldName = token.substring(0, pos);\r\n ordering = token.substring(pos + 1);\r\n }\r\n fieldDef = elementClass.getField(fieldName);\r\n if (fieldDef == null)\r\n {\r\n throw new ConstraintException(\"The field \"+fieldName+\" specified in the orderby attribute of the collection \"+collDef.getName()+\" in class \"+ownerClass.getName()+\" hasn't been found in the element class \"+elementClass.getName());\r\n }\r\n if ((ordering != null) && (ordering.length() > 0) &&\r\n !\"ASC\".equals(ordering) && !\"DESC\".equals(ordering))\r\n {\r\n throw new ConstraintException(\"The ordering \"+ordering+\" specified in the orderby attribute of the collection \"+collDef.getName()+\" in class \"+ownerClass.getName()+\" is invalid\");\r\n }\r\n }\r\n }", "protected void checkVariableName(GraphRewrite event, EvaluationContext context)\n {\n if (variableName == null)\n {\n setVariableName(Iteration.getPayloadVariableName(event, context));\n }\n }" ]
Checks whether an XPath expression starts with an XPath eventable condition. @param dom The DOM String. @param eventableCondition The eventable condition. @param xpath The XPath. @return boolean whether xpath starts with xpath location of eventable condition xpath condition @throws XPathExpressionException @throws CrawljaxException when eventableCondition is null or its inXPath has not been set
[ "public boolean checkXpathStartsWithXpathEventableCondition(Document dom,\n\t\t\tEventableCondition eventableCondition, String xpath) throws XPathExpressionException {\n\t\tif (eventableCondition == null || Strings\n\t\t\t\t.isNullOrEmpty(eventableCondition.getInXPath())) {\n\t\t\tthrow new CrawljaxException(\"Eventable has no XPath condition\");\n\t\t}\n\t\tList<String> expressions =\n\t\t\t\tXPathHelper.getXpathForXPathExpressions(dom, eventableCondition.getInXPath());\n\n\t\treturn checkXPathUnderXPaths(xpath, expressions);\n\t}" ]
[ "public List<String> getServiceImplementations(String serviceTypeName) {\n final List<String> strings = services.get(serviceTypeName);\n return strings == null ? Collections.<String>emptyList() : Collections.unmodifiableList(strings);\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}", "@Subscribe\n @SuppressForbidden(\"legitimate printStackTrace().\")\n public void onSuiteResult(AggregatedSuiteResultEvent e) {\n try {\n if (jsonWriter == null)\n return;\n\n slaves.put(e.getSlave().id, e.getSlave());\n e.serialize(jsonWriter, outputStreams);\n } catch (Exception ex) {\n ex.printStackTrace();\n junit4.log(\"Error serializing to JSON file: \"\n + Throwables.getStackTraceAsString(ex), Project.MSG_WARN);\n if (jsonWriter != null) {\n try {\n jsonWriter.close();\n } catch (Throwable ignored) {\n // Ignore.\n } finally {\n jsonWriter = null;\n }\n }\n }\n }", "private synchronized Constructor getIndirectionHandlerConstructor()\r\n {\r\n if(_indirectionHandlerConstructor == null)\r\n {\r\n Class[] paramType = {PBKey.class, Identity.class};\r\n\r\n try\r\n {\r\n _indirectionHandlerConstructor = getIndirectionHandlerClass().getConstructor(paramType);\r\n }\r\n catch(NoSuchMethodException ex)\r\n {\r\n throw new MetadataException(\"The class \"\r\n + _indirectionHandlerClass.getName()\r\n + \" specified for IndirectionHandlerClass\"\r\n + \" is required to have a public constructor with signature (\"\r\n + PBKey.class.getName()\r\n + \", \"\r\n + Identity.class.getName()\r\n + \").\");\r\n }\r\n }\r\n return _indirectionHandlerConstructor;\r\n }", "public static final String printWorkGroup(WorkGroup value)\n {\n return (Integer.toString(value == null ? WorkGroup.DEFAULT.getValue() : value.getValue()));\n }", "public static int[] Argsort(final float[] array, final boolean ascending) {\n Integer[] indexes = new Integer[array.length];\n for (int i = 0; i < indexes.length; i++) {\n indexes[i] = i;\n }\n Arrays.sort(indexes, new Comparator<Integer>() {\n @Override\n public int compare(final Integer i1, final Integer i2) {\n return (ascending ? 1 : -1) * Float.compare(array[i1], array[i2]);\n }\n });\n return asArray(indexes);\n }", "public static DMatrixRMaj diagonal(int N , double min , double max , Random rand ) {\n return diagonal(N,N,min,max,rand);\n }", "private void deliverBeatAnnouncement(final Beat beat) {\n for (final MasterListener listener : getMasterListeners()) {\n try {\n listener.newBeat(beat);\n } catch (Throwable t) {\n logger.warn(\"Problem delivering master beat announcement to listener\", t);\n }\n }\n }", "public boolean forall(PixelPredicate predicate) {\n return Arrays.stream(points()).allMatch(p -> predicate.test(p.x, p.y, pixel(p)));\n }" ]
Convert string to qname. @param str the string @return the qname
[ "private static QName convertString(String str) {\n if (str != null) {\n return QName.valueOf(str);\n } else {\n return null;\n }\n }" ]
[ "public static base_response update(nitro_service client, gslbsite resource) throws Exception {\n\t\tgslbsite updateresource = new gslbsite();\n\t\tupdateresource.sitename = resource.sitename;\n\t\tupdateresource.metricexchange = resource.metricexchange;\n\t\tupdateresource.nwmetricexchange = resource.nwmetricexchange;\n\t\tupdateresource.sessionexchange = resource.sessionexchange;\n\t\tupdateresource.triggermonitor = resource.triggermonitor;\n\t\treturn updateresource.update_resource(client);\n\t}", "protected void parseOperationsLR(Symbol ops[], TokenList tokens, Sequence sequence) {\n\n if( tokens.size == 0 )\n return;\n\n TokenList.Token token = tokens.first;\n\n if( token.getType() != Type.VARIABLE )\n throw new ParseError(\"The first token in an equation needs to be a variable and not \"+token);\n\n boolean hasLeft = false;\n while( token != null ) {\n if( token.getType() == Type.FUNCTION ) {\n throw new ParseError(\"Function encountered with no parentheses\");\n } else if( token.getType() == Type.VARIABLE ) {\n if( hasLeft ) {\n if( isTargetOp(token.previous,ops)) {\n token = createOp(token.previous.previous,token.previous,token,tokens,sequence);\n }\n } else {\n hasLeft = true;\n }\n } else {\n if( token.previous.getType() == Type.SYMBOL ) {\n throw new ParseError(\"Two symbols next to each other. \"+token.previous+\" and \"+token);\n }\n }\n token = token.next;\n }\n }", "public void setConnectionTimeout(long connectionTimeout, TimeUnit timeUnit) {\n\t\tthis.connectionTimeoutInMs = TimeUnit.MILLISECONDS.convert(connectionTimeout, timeUnit);\n\t}", "void commitTempFile(File temp) throws ConfigurationPersistenceException {\n if (!doneBootup.get()) {\n return;\n }\n if (!interactionPolicy.isReadOnly()) {\n FilePersistenceUtils.moveTempFileToMain(temp, mainFile);\n } else {\n FilePersistenceUtils.moveTempFileToMain(temp, lastFile);\n }\n }", "public static void zeroTriangle( boolean upper , DMatrixRBlock A )\n {\n int blockLength = A.blockLength;\n\n if( upper ) {\n for( int i = 0; i < A.numRows; i += blockLength ) {\n int h = Math.min(blockLength,A.numRows-i);\n\n for( int j = i; j < A.numCols; j += blockLength ) {\n int w = Math.min(blockLength,A.numCols-j);\n\n int index = i*A.numCols + h*j;\n\n if( j == i ) {\n for( int k = 0; k < h; k++ ) {\n for( int l = k+1; l < w; l++ ) {\n A.data[index + w*k+l ] = 0;\n }\n }\n } else {\n for( int k = 0; k < h; k++ ) {\n for( int l = 0; l < w; l++ ) {\n A.data[index + w*k+l ] = 0;\n }\n }\n }\n }\n }\n } else {\n for( int i = 0; i < A.numRows; i += blockLength ) {\n int h = Math.min(blockLength,A.numRows-i);\n\n for( int j = 0; j <= i; j += blockLength ) {\n int w = Math.min(blockLength,A.numCols-j);\n\n int index = i*A.numCols + h*j;\n\n if( j == i ) {\n for( int k = 0; k < h; k++ ) {\n int z = Math.min(k,w);\n for( int l = 0; l < z; l++ ) {\n A.data[index + w*k+l ] = 0;\n }\n }\n } else {\n for( int k = 0; k < h; k++ ) {\n for( int l = 0; l < w; l++ ) {\n A.data[index + w*k+l ] = 0;\n }\n }\n }\n }\n }\n }\n }", "public List<TimephasedWork> getTimephasedBaselineWork(int index)\n {\n return m_timephasedBaselineWork[index] == null ? null : m_timephasedBaselineWork[index].getData();\n }", "private static XMLStreamException unexpectedElement(final XMLStreamReader reader) {\n return SecurityManagerLogger.ROOT_LOGGER.unexpectedElement(reader.getName(), reader.getLocation());\n }", "public void start() {\n if (TransitionConfig.isDebug()) {\n getTransitionStateHolder().start();\n }\n\n mLastProgress = Float.MIN_VALUE;\n\n TransitionController transitionController;\n for (int i = 0, size = mTransitionControls.size(); i < size; i++) {\n transitionController = mTransitionControls.get(i);\n if (mInterpolator != null) {\n transitionController.setInterpolator(mInterpolator);\n }\n //required for ViewPager transitions to work\n if (mTarget != null) {\n transitionController.setTarget(mTarget);\n }\n transitionController.setUpdateStateAfterUpdateProgress(mUpdateStateAfterUpdateProgress);\n transitionController.start();\n }\n }", "public void reset(int profileId, String clientUUID) throws Exception {\n PreparedStatement statement = null;\n\n // TODO: need a better way to do this than brute force.. but the iterative approach is too slow\n try (Connection sqlConnection = sqlService.getConnection()) {\n\n // first remove all enabled overrides with this client uuid\n String queryString = \"DELETE FROM \" + Constants.DB_TABLE_ENABLED_OVERRIDE +\n \" WHERE \" + Constants.GENERIC_CLIENT_UUID + \"= ? \" +\n \" AND \" + Constants.GENERIC_PROFILE_ID + \" = ?\";\n statement = sqlConnection.prepareStatement(queryString);\n statement.setString(1, clientUUID);\n statement.setInt(2, profileId);\n statement.executeUpdate();\n statement.close();\n\n // clean up request response table for this uuid\n queryString = \"UPDATE \" + Constants.DB_TABLE_REQUEST_RESPONSE +\n \" SET \" + Constants.REQUEST_RESPONSE_CUSTOM_REQUEST + \"=?, \"\n + Constants.REQUEST_RESPONSE_CUSTOM_RESPONSE + \"=?, \"\n + Constants.REQUEST_RESPONSE_REPEAT_NUMBER + \"=-1, \"\n + Constants.REQUEST_RESPONSE_REQUEST_ENABLED + \"=0, \"\n + Constants.REQUEST_RESPONSE_RESPONSE_ENABLED + \"=0 \"\n + \"WHERE \" + Constants.GENERIC_CLIENT_UUID + \"=? \" +\n \" AND \" + Constants.GENERIC_PROFILE_ID + \"=?\";\n statement = sqlConnection.prepareStatement(queryString);\n statement.setString(1, \"\");\n statement.setString(2, \"\");\n statement.setString(3, clientUUID);\n statement.setInt(4, profileId);\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\n this.updateActive(profileId, clientUUID, false);\n }" ]
Provides a RunAs client login context
[ "private LoginContext getClientLoginContext() throws LoginException {\n Configuration config = new Configuration() {\n @Override\n public AppConfigurationEntry[] getAppConfigurationEntry(String name) {\n Map<String, String> options = new HashMap<String, String>();\n options.put(\"multi-threaded\", \"true\");\n options.put(\"restore-login-identity\", \"true\");\n\n AppConfigurationEntry clmEntry = new AppConfigurationEntry(ClientLoginModule.class.getName(), LoginModuleControlFlag.REQUIRED, options);\n return new AppConfigurationEntry[] { clmEntry };\n }\n };\n return getLoginContext(config);\n }" ]
[ "public void shutdown() {\n final Connection connection;\n synchronized (this) {\n if(shutdown) return;\n shutdown = true;\n connection = this.connection;\n if(connectTask != null) {\n connectTask.shutdown();\n }\n }\n if (connection != null) {\n connection.closeAsync();\n }\n }", "public static <T> T withObjectStreams(Socket socket, @ClosureParams(value=SimpleType.class, options={\"java.io.ObjectInputStream\",\"java.io.ObjectOutputStream\"}) Closure<T> closure) throws IOException {\n InputStream input = socket.getInputStream();\n OutputStream output = socket.getOutputStream();\n ObjectOutputStream oos = new ObjectOutputStream(output);\n ObjectInputStream ois = new ObjectInputStream(input);\n try {\n T result = closure.call(new Object[]{ois, oos});\n\n InputStream temp1 = ois;\n ois = null;\n temp1.close();\n temp1 = input;\n input = null;\n temp1.close();\n OutputStream temp2 = oos;\n oos = null;\n temp2.close();\n temp2 = output;\n output = null;\n temp2.close();\n\n return result;\n } finally {\n closeWithWarning(ois);\n closeWithWarning(input);\n closeWithWarning(oos);\n closeWithWarning(output);\n }\n }", "public static int Mode( int[] values ){\n int mode = 0, curMax = 0;\n\n for ( int i = 0, length = values.length; i < length; i++ )\n {\n if ( values[i] > curMax )\n {\n curMax = values[i];\n mode = i;\n }\n }\n return mode;\n }", "private OJBIterator getReportQueryIteratorFromQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException\n {\n RsIteratorFactory factory = ReportRsIteratorFactoryImpl.getInstance();\n OJBIterator result = getRsIteratorFromQuery(query, cld, factory);\n\n if (query.usePaging())\n {\n result = new PagingIterator(result, query.getStartAtIndex(), query.getEndAtIndex());\n }\n\n return result;\n }", "public static List<String> asListLines(String content) {\n List<String> retorno = new ArrayList<String>();\n content = content.replace(CARRIAGE_RETURN, RETURN);\n content = content.replace(RETURN, CARRIAGE_RETURN);\n for (String str : content.split(CARRIAGE_RETURN)) {\n retorno.add(str);\n }\n return retorno;\n }", "public static void dumpTexCoords(AiMesh mesh, int coords) {\n if (!mesh.hasTexCoords(coords)) {\n System.out.println(\"mesh has no texture coordinate set \" + coords);\n return;\n }\n \n for (int i = 0; i < mesh.getNumVertices(); i++) {\n int numComponents = mesh.getNumUVComponents(coords);\n System.out.print(\"[\" + mesh.getTexCoordU(i, coords));\n \n if (numComponents > 1) {\n System.out.print(\", \" + mesh.getTexCoordV(i, coords));\n }\n \n if (numComponents > 2) {\n System.out.print(\", \" + mesh.getTexCoordW(i, coords));\n }\n \n System.out.println(\"]\");\n }\n }", "public Where<T, ID> in(String columnName, Iterable<?> objects) throws SQLException {\n\t\taddClause(new In(columnName, findColumnFieldType(columnName), objects, true));\n\t\treturn this;\n\t}", "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 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}" ]
Convert a url to a file object. No checks are made to see if file exists but there are some hacks that are needed to convert uris to files across platforms. @param fileURI the uri to convert
[ "protected static File platformIndependentUriToFile(final URI fileURI) {\n File file;\n try {\n file = new File(fileURI);\n } catch (IllegalArgumentException e) {\n if (fileURI.toString().startsWith(\"file://\")) {\n file = new File(fileURI.toString().substring(\"file://\".length()));\n } else {\n throw e;\n }\n }\n return file;\n }" ]
[ "@SuppressWarnings(\"unchecked\")\n public void setVars(final Map<String, ? extends Object> vars) {\n this.vars = (Map<String, Object>)vars;\n }", "@ArgumentsChecked\n\t@Throws(IllegalNullArgumentException.class)\n\tpublic static int checkInteger(@Nonnull final Number number) {\n\t\tCheck.notNull(number, \"number\");\n\t\tif (!isInIntegerRange(number)) {\n\t\t\tthrow new IllegalNumberRangeException(number.toString(), INTEGER_MIN, INTEGER_MAX);\n\t\t}\n\n\t\treturn number.intValue();\n\t}", "public static <E> Set<E> setify(ObjectMapper mapper, Object source, Class<E> targetElementType) {\n return (Set<E>) collectify(mapper, source, Set.class, targetElementType);\n }", "private synchronized HostServerGroupEffect getHostEffect(PathAddress address, String host, Resource root) {\n if (requiresMapping) {\n map(root);\n requiresMapping = false;\n }\n Set<String> mapped = hostsToGroups.get(host);\n if (mapped == null) {\n // Unassigned host. Treat like an unassigned profile or socket-binding-group;\n // i.e. available to all server group scoped roles.\n // Except -- WFLY-2085 -- the master HC is not open to all s-g-s-rs\n Resource hostResource = root.getChild(PathElement.pathElement(HOST, host));\n if (hostResource != null) {\n ModelNode dcModel = hostResource.getModel().get(DOMAIN_CONTROLLER);\n if (!dcModel.hasDefined(REMOTE)) {\n mapped = Collections.emptySet(); // prevents returning HostServerGroupEffect.forUnassignedHost(address, host)\n }\n }\n }\n return mapped == null ? HostServerGroupEffect.forUnassignedHost(address, host)\n : HostServerGroupEffect.forMappedHost(address, mapped, host);\n\n }", "public ColumnBuilder addFieldProperty(String propertyName, String value) {\n\t\tfieldProperties.put(propertyName, value);\n\t\treturn this;\n\t}", "public CollectionRequest<Task> findByProject(String projectId) {\n \n String path = String.format(\"/projects/%s/tasks\", projectId);\n return new CollectionRequest<Task>(this, Task.class, path, \"GET\");\n }", "@RequestMapping(value = \"/api/plugins\", method = RequestMethod.POST)\n public\n @ResponseBody\n HashMap<String, Object> addPluginPath(Model model, Plugin add) throws Exception {\n PluginManager.getInstance().addPluginPath(add.getPath());\n\n return pluginInformation();\n }", "public static base_response unset(nitro_service client, coparameter resource, String[] args) throws Exception{\n\t\tcoparameter unsetresource = new coparameter();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "private static FieldType getPlaceholder(final Class<?> type, final int fieldID)\n {\n return new FieldType()\n {\n @Override public FieldTypeClass getFieldTypeClass()\n {\n return FieldTypeClass.UNKNOWN;\n }\n\n @Override public String name()\n {\n return \"UNKNOWN\";\n }\n\n @Override public int getValue()\n {\n return fieldID;\n }\n\n @Override public String getName()\n {\n return \"Unknown \" + (type == null ? \"\" : type.getSimpleName() + \"(\" + fieldID + \")\");\n }\n\n @Override public String getName(Locale locale)\n {\n return getName();\n }\n\n @Override public DataType getDataType()\n {\n return null;\n }\n\n @Override public FieldType getUnitsType()\n {\n return null;\n }\n\n @Override public String toString()\n {\n return getName();\n }\n };\n }" ]
Load the given class using the default constructor @param className The name of the class @return The class object
[ "public static Class<?> loadClass(String className) {\n try {\n return Class.forName(className);\n } catch(ClassNotFoundException e) {\n throw new IllegalArgumentException(e);\n }\n }" ]
[ "private void setHex() {\r\n\r\n String hRed = Integer.toHexString(getRed());\r\n String hGreen = Integer.toHexString(getGreen());\r\n String hBlue = Integer.toHexString(getBlue());\r\n\r\n if (hRed.length() == 0) {\r\n hRed = \"00\";\r\n }\r\n if (hRed.length() == 1) {\r\n hRed = \"0\" + hRed;\r\n }\r\n if (hGreen.length() == 0) {\r\n hGreen = \"00\";\r\n }\r\n if (hGreen.length() == 1) {\r\n hGreen = \"0\" + hGreen;\r\n }\r\n if (hBlue.length() == 0) {\r\n hBlue = \"00\";\r\n }\r\n if (hBlue.length() == 1) {\r\n hBlue = \"0\" + hBlue;\r\n }\r\n\r\n m_hex = hRed + hGreen + hBlue;\r\n }", "public static void showOnlyChannels(Object... channels){\r\n for(LogRecordHandler handler : handlers){\r\n if(handler instanceof VisibilityHandler){\r\n VisibilityHandler visHandler = (VisibilityHandler) handler;\r\n visHandler.hideAll();\r\n for (Object channel : channels) {\r\n visHandler.alsoShow(channel);\r\n }\r\n }\r\n }\r\n }", "public final static int readMdLink(final StringBuilder out, final String in, final int start)\n {\n int pos = start;\n int counter = 1;\n while (pos < in.length())\n {\n final char ch = in.charAt(pos);\n if (ch == '\\\\' && pos + 1 < in.length())\n {\n pos = escape(out, in.charAt(pos + 1), pos);\n }\n else\n {\n boolean endReached = false;\n switch (ch)\n {\n case '(':\n counter++;\n break;\n case ' ':\n if (counter == 1)\n {\n endReached = true;\n }\n break;\n case ')':\n counter--;\n if (counter == 0)\n {\n endReached = true;\n }\n break;\n }\n if (endReached)\n {\n break;\n }\n out.append(ch);\n }\n pos++;\n }\n\n return (pos == in.length()) ? -1 : pos;\n }", "public void updateLinks(ServiceReference<S> serviceReference) {\n for (D declaration : linkerManagement.getMatchedDeclaration()) {\n boolean isAlreadyLinked = declaration.getStatus().getServiceReferencesBounded().contains(serviceReference);\n boolean canBeLinked = linkerManagement.canBeLinked(declaration, serviceReference);\n if (isAlreadyLinked && !canBeLinked) {\n linkerManagement.unlink(declaration, serviceReference);\n } else if (!isAlreadyLinked && canBeLinked) {\n linkerManagement.link(declaration, serviceReference);\n }\n }\n }", "private static void logVersionWarnings(String label1, String version1, String label2, String version2) {\n\t\tif (version1 == null) {\n\t\t\tif (version2 != null) {\n\t\t\t\twarning(null, \"Unknown version\", \" for {}, version for {} is '{}'\", new Object[] { label1, label2,\n\t\t\t\t\t\tversion2 });\n\t\t\t}\n\t\t} else {\n\t\t\tif (version2 == null) {\n\t\t\t\twarning(null, \"Unknown version\", \" for {}, version for {} is '{}'\", new Object[] { label2, label1,\n\t\t\t\t\t\tversion1 });\n\t\t\t} else if (!version1.equals(version2)) {\n\t\t\t\twarning(null, \"Mismatched versions\", \": {} is '{}', while {} is '{}'\", new Object[] { label1, version1,\n\t\t\t\t\t\tlabel2, version2 });\n\t\t\t}\n\t\t}\n\t}", "public static String removeOpenCmsContext(final String path) {\n\n String context = OpenCms.getSystemInfo().getOpenCmsContext();\n if (path.startsWith(context + \"/\")) {\n return path.substring(context.length());\n }\n String renderPrefix = OpenCms.getStaticExportManager().getVfsPrefix();\n if (path.startsWith(renderPrefix + \"/\")) {\n return path.substring(renderPrefix.length());\n }\n return path;\n }", "public static <T> FastEvent<T> of(Class<T> type, BeanManagerImpl manager, ObserverNotifier notifier, Annotation... qualifiers) {\n ResolvedObservers<T> resolvedObserverMethods = notifier.<T> resolveObserverMethods(type, qualifiers);\n if (resolvedObserverMethods.isMetadataRequired()) {\n EventMetadata metadata = new EventMetadataImpl(type, null, qualifiers);\n CurrentEventMetadata metadataService = manager.getServices().get(CurrentEventMetadata.class);\n return new FastEventWithMetadataPropagation<T>(resolvedObserverMethods, metadata, metadataService);\n } else {\n return new FastEvent<T>(resolvedObserverMethods);\n }\n }", "public void setSlideDrawable(Drawable drawable) {\n mSlideDrawable = new SlideDrawable(drawable);\n mSlideDrawable.setIsRtl(ViewHelper.getLayoutDirection(this) == LAYOUT_DIRECTION_RTL);\n\n if (mActionBarHelper != null) {\n mActionBarHelper.setDisplayShowHomeAsUpEnabled(true);\n\n if (mDrawerIndicatorEnabled) {\n mActionBarHelper.setActionBarUpIndicator(mSlideDrawable,\n isMenuVisible() ? mDrawerOpenContentDesc : mDrawerClosedContentDesc);\n }\n }\n }", "public void editPhotos(String photosetId, String primaryPhotoId, String[] photoIds) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_EDIT_PHOTOS);\r\n\r\n parameters.put(\"photoset_id\", photosetId);\r\n parameters.put(\"primary_photo_id\", primaryPhotoId);\r\n parameters.put(\"photo_ids\", StringUtilities.join(photoIds, \",\"));\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 }" ]
Register a new TypeConverter for parsing and serialization. @param cls The class for which the TypeConverter should be used. @param converter The TypeConverter
[ "public static <E> void registerTypeConverter(Class<E> cls, TypeConverter<E> converter) {\n TYPE_CONVERTERS.put(cls, converter);\n }" ]
[ "public static base_response update(nitro_service client, responderpolicy resource) throws Exception {\n\t\tresponderpolicy updateresource = new responderpolicy();\n\t\tupdateresource.name = resource.name;\n\t\tupdateresource.rule = resource.rule;\n\t\tupdateresource.action = resource.action;\n\t\tupdateresource.undefaction = resource.undefaction;\n\t\tupdateresource.comment = resource.comment;\n\t\tupdateresource.logaction = resource.logaction;\n\t\tupdateresource.appflowaction = resource.appflowaction;\n\t\treturn updateresource.update_resource(client);\n\t}", "private void doFileRoll(final File from, final File to) {\n final FileHelper fileHelper = FileHelper.getInstance();\n if (!fileHelper.deleteExisting(to)) {\n this.getAppender().getErrorHandler()\n .error(\"Unable to delete existing \" + to + \" for rename\");\n }\n final String original = from.toString();\n if (fileHelper.rename(from, to)) {\n LogLog.debug(\"Renamed \" + original + \" to \" + to);\n } else {\n this.getAppender().getErrorHandler()\n .error(\"Unable to rename \" + original + \" to \" + to);\n }\n }", "public String clean(String value) {\n String orig = value;\n \n // check if there's a + before the first digit\n boolean initialplus = findPlus(value);\n \n // remove everything but digits\n value = sub.clean(value);\n if (value == null)\n return null;\n\n // check for initial '00'\n boolean zerozero = !initialplus && value.startsWith(\"00\");\n if (zerozero)\n value = value.substring(2); // strip off the zeros\n\n // look for country code\n CountryCode ccode = findCountryCode(value);\n if (ccode == null) {\n // no country code, let's do what little we can\n if (initialplus || zerozero)\n return orig; // this number is messed up. dare not touch\n return value;\n\n } else {\n value = value.substring(ccode.getPrefix().length()); // strip off ccode\n if (ccode.getStripZero() && value.startsWith(\"0\"))\n value = value.substring(1); // strip the zero\n\n if (ccode.isRightFormat(value))\n return \"+\" + ccode.getPrefix() + \" \" + value;\n else\n return orig; // don't dare touch this\n }\n }", "@Inject(\"struts.json.action.fileProtocols\")\n\tpublic void setFileProtocols(String fileProtocols) {\n\t\tif (StringUtils.isNotBlank(fileProtocols)) {\n\t\t\tthis.fileProtocols = TextParseUtil.commaDelimitedStringToSet(fileProtocols);\n\t\t}\n\t}", "public Map<String, Object> getModuleFieldsFilters() {\n final Map<String, Object> params = new HashMap<String, Object>();\n\n for(final Filter filter: filters){\n params.putAll(filter.moduleFilterFields());\n }\n\n return params;\n }", "public boolean isDuplicateName(String name) {\n if (name == null || name.trim().isEmpty()) {\n return false;\n }\n List<AssignmentRow> as = view.getAssignmentRows();\n if (as != null && !as.isEmpty()) {\n int nameCount = 0;\n for (AssignmentRow row : as) {\n if (name.trim().compareTo(row.getName()) == 0) {\n nameCount++;\n if (nameCount > 1) {\n return true;\n }\n }\n }\n }\n return false;\n }", "void checkRmModelConformance() {\n final AmVisitor<AmObject, AmConstraintContext> visitor = AmVisitors.preorder(new ConformanceVisitor());\n ArchetypeWalker.walkConstraints(visitor, archetype, new AmConstraintContext());\n }", "public Token add( Variable variable ) {\n Token t = new Token(variable);\n push( t );\n return t;\n }", "public <T> T invokeWithClientSession(int targetPlayer, ClientTask<T> task, String description)\n throws Exception {\n if (!isRunning()) {\n throw new IllegalStateException(\"ConnectionManager is not running, aborting \" + description);\n }\n\n final Client client = allocateClient(targetPlayer, description);\n try {\n return task.useClient(client);\n } finally {\n freeClient(client);\n }\n }" ]
Gets the actual type arguments of a class @param clazz The class to examine @return The type arguments
[ "public static Type[] getActualTypeArguments(Class<?> clazz) {\n Type type = Types.getCanonicalType(clazz);\n if (type instanceof ParameterizedType) {\n return ((ParameterizedType) type).getActualTypeArguments();\n } else {\n return EMPTY_TYPES;\n }\n }" ]
[ "public static Date getDateFromLong(long date)\n {\n TimeZone tz = TimeZone.getDefault();\n return (new Date(date - tz.getRawOffset()));\n }", "public RedwoodConfiguration loggingClass(final Class<?> classToIgnoreInTraces){\r\n tasks.add(new Runnable() { public void run() { Redwood.addLoggingClass(classToIgnoreInTraces.getName()); } });\r\n return this;\r\n }", "private FieldDescriptor getFldFromJoin(TableAlias aTableAlias, String aColName)\r\n {\r\n FieldDescriptor fld = null;\r\n\r\n // Search Join Structure for attribute\r\n if (aTableAlias.joins != null)\r\n {\r\n Iterator itr = aTableAlias.joins.iterator();\r\n while (itr.hasNext())\r\n {\r\n Join join = (Join) itr.next();\r\n ClassDescriptor cld = join.right.cld;\r\n\r\n if (cld != null)\r\n {\r\n fld = cld.getFieldDescriptorByName(aColName);\r\n if (fld != null)\r\n {\r\n break;\r\n }\r\n\r\n }\r\n }\r\n }\r\n return fld;\r\n }", "public int[] getDefalutValuesArray() {\n int[] defaultValues = new int[5];\n\n defaultValues[0] = GLES20.GL_LINEAR_MIPMAP_NEAREST; // MIN FILTER\n defaultValues[1] = GLES20.GL_LINEAR; // MAG FILTER\n defaultValues[2] = 1; // ANISO FILTER\n defaultValues[3] = GLES20.GL_CLAMP_TO_EDGE; // WRAP S\n defaultValues[4] = GLES20.GL_CLAMP_TO_EDGE; // WRAP T\n\n return defaultValues;\n }", "public String getStatement()\r\n {\r\n if(sql == null)\r\n {\r\n StringBuffer stmt = new StringBuffer(128);\r\n ClassDescriptor cld = getClassDescriptor();\r\n\r\n FieldDescriptor[] fieldDescriptors = cld.getPkFields();\r\n if(fieldDescriptors == null || fieldDescriptors.length == 0)\r\n {\r\n throw new OJBRuntimeException(\"No PK fields defined in metadata for \" + cld.getClassNameOfObject());\r\n }\r\n FieldDescriptor field = fieldDescriptors[0];\r\n\r\n stmt.append(SELECT);\r\n stmt.append(field.getColumnName());\r\n stmt.append(FROM);\r\n stmt.append(cld.getFullTableName());\r\n appendWhereClause(cld, false, stmt);\r\n\r\n sql = stmt.toString();\r\n }\r\n return sql;\r\n }", "public byte[] getByteArray(Integer id, Integer type)\n {\n return (getByteArray(m_meta.getOffset(id, type)));\n }", "synchronized void bulkRegisterSingleton() {\n for (Map.Entry<Class<? extends AppService>, AppService> entry : registry.entrySet()) {\n if (isSingletonService(entry.getKey())) {\n app.registerSingleton(entry.getKey(), entry.getValue());\n }\n }\n }", "private void createPropertyVfsBundleFiles() throws CmsIllegalArgumentException, CmsLoaderException, CmsException {\n\n String bundleFileBasePath = m_sitepath + m_basename + \"_\";\n for (Locale l : m_localizations.keySet()) {\n CmsResource res = m_cms.createResource(\n bundleFileBasePath + l.toString(),\n OpenCms.getResourceManager().getResourceType(\n CmsMessageBundleEditorTypes.BundleType.PROPERTY.toString()));\n m_bundleFiles.put(l, res);\n LockedFile file = LockedFile.lockResource(m_cms, res);\n file.setCreated(true);\n m_lockedBundleFiles.put(l, file);\n m_changedTranslations.add(l);\n }\n\n }", "public Duration getBaselineDuration()\n {\n Object result = getCachedValue(TaskField.BASELINE_DURATION);\n if (result == null)\n {\n result = getCachedValue(TaskField.BASELINE_ESTIMATED_DURATION);\n }\n\n if (!(result instanceof Duration))\n {\n result = null;\n }\n return (Duration) result;\n }" ]
Use this API to fetch cmppolicylabel_cmppolicy_binding resources of given name .
[ "public static cmppolicylabel_cmppolicy_binding[] get(nitro_service service, String labelname) throws Exception{\n\t\tcmppolicylabel_cmppolicy_binding obj = new cmppolicylabel_cmppolicy_binding();\n\t\tobj.set_labelname(labelname);\n\t\tcmppolicylabel_cmppolicy_binding response[] = (cmppolicylabel_cmppolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}" ]
[ "public void setOutlineCode(int index, String value)\n {\n set(selectField(TaskFieldLists.CUSTOM_OUTLINE_CODE, index), value);\n }", "public void invalidate(final int dataIndex) {\n synchronized (mMeasuredChildren) {\n Log.d(Log.SUBSYSTEM.LAYOUT, TAG, \"invalidate [%d]\", dataIndex);\n mMeasuredChildren.remove(dataIndex);\n }\n }", "public ComplexDouble divi(ComplexDouble c, ComplexDouble result) {\n double d = c.r * c.r + c.i * c.i;\n double newR = (r * c.r + i * c.i) / d;\n double newI = (i * c.r - r * c.i) / d;\n result.r = newR;\n result.i = newI;\n return result;\n }", "private void writeCustomField(CustomField field) throws IOException\n {\n if (field.getAlias() != null)\n {\n m_writer.writeStartObject(null);\n m_writer.writeNameValuePair(\"field_type_class\", field.getFieldType().getFieldTypeClass().name().toLowerCase());\n m_writer.writeNameValuePair(\"field_type\", field.getFieldType().name().toLowerCase());\n m_writer.writeNameValuePair(\"field_alias\", field.getAlias());\n m_writer.writeEndObject();\n }\n }", "public static String stringMatcherByPattern(String input, String patternStr) {\n\n String output = PcConstants.SYSTEM_FAIL_MATCH_REGEX;\n\n // 20140105: fix the NPE issue\n if (patternStr == null) {\n logger.error(\"patternStr is NULL! (Expected when the aggregation rule is not defined at \"\n + PcDateUtils.getNowDateTimeStrStandard());\n return output;\n }\n\n if (input == null) {\n logger.error(\"input (Expected when the response is null and now try to match on response) is NULL in stringMatcherByPattern() at \"\n + PcDateUtils.getNowDateTimeStrStandard());\n return output;\n } else {\n input = input.replace(\"\\n\", \"\").replace(\"\\r\", \"\");\n }\n\n logger.debug(\"input: \" + input);\n logger.debug(\"patternStr: \" + patternStr);\n\n Pattern patternMetric = Pattern.compile(patternStr, Pattern.MULTILINE);\n\n final Matcher matcher = patternMetric.matcher(input);\n if (matcher.matches()) {\n output = matcher.group(1);\n }\n return output;\n }", "public void addItem(T value, Direction dir, String text) {\n addItem(value, dir, text, true);\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 Build getBuildInfo(String appName, String buildId) {\n return connection.execute(new BuildInfo(appName, buildId), apiKey);\n }", "protected String getBundleJarPath() throws MalformedURLException {\n Path path = PROPERTIES.getAllureHome().resolve(\"app/allure-bundle.jar\").toAbsolutePath();\n if (Files.notExists(path)) {\n throw new AllureCommandException(String.format(\"Bundle not found by path <%s>\", path));\n }\n return path.toUri().toURL().toString();\n }" ]
Returns timezone offset from a session instance. The offset is in minutes to UTC time @param session the session instance @return the offset to UTC time in minutes
[ "public static int timezoneOffset(H.Session session) {\n String s = null != session ? session.get(SESSION_KEY) : null;\n return S.notBlank(s) ? Integer.parseInt(s) : serverTimezoneOffset();\n }" ]
[ "static ItemIdValueImpl fromIri(String iri) {\n\t\tint separator = iri.lastIndexOf('/') + 1;\n\t\ttry {\n\t\t\treturn new ItemIdValueImpl(iri.substring(separator), iri.substring(0, separator));\n\t\t} catch (IllegalArgumentException e) {\n\t\t\tthrow new IllegalArgumentException(\"Invalid Wikibase entity IRI: \" + iri, e);\n\t\t}\n\t}", "public static double JensenShannonDivergence(double[] p, double[] q) {\n double[] m = new double[p.length];\n for (int i = 0; i < m.length; i++) {\n m[i] = (p[i] + q[i]) / 2;\n }\n\n return (KullbackLeiblerDivergence(p, m) + KullbackLeiblerDivergence(q, m)) / 2;\n }", "public void setAttribute(final String name, final Attribute attribute) {\n if (name.equals(MAP_KEY)) {\n this.mapAttribute = (MapAttribute) attribute;\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 }", "public static vpath get(nitro_service service, String name) throws Exception{\n\t\tvpath obj = new vpath();\n\t\tobj.set_name(name);\n\t\tvpath response = (vpath) obj.get_resource(service);\n\t\treturn response;\n\t}", "private Statement createStatement(Connection con, boolean scrollable, int explicitFetchSizeHint)\r\n throws java.sql.SQLException\r\n {\r\n Statement result;\r\n try\r\n {\r\n // if necessary use JDBC1.0 methods\r\n if (!FORCEJDBC1_0)\r\n {\r\n result =\r\n con.createStatement(\r\n scrollable\r\n ? ResultSet.TYPE_SCROLL_INSENSITIVE\r\n : ResultSet.TYPE_FORWARD_ONLY,\r\n ResultSet.CONCUR_READ_ONLY);\r\n afterJdbc2CapableStatementCreate(result, explicitFetchSizeHint);\r\n }\r\n else\r\n {\r\n result = con.createStatement();\r\n }\r\n }\r\n catch (AbstractMethodError err)\r\n {\r\n // if a JDBC1.0 driver is used, the signature\r\n // createStatement(int, int) is not defined.\r\n // we then call the JDBC1.0 variant createStatement()\r\n log.warn(\"Used driver seems not JDBC 2.0 compatible, use the JDBC 1.0 mode\", err);\r\n result = con.createStatement();\r\n FORCEJDBC1_0 = true;\r\n }\r\n catch (SQLException eSql)\r\n {\r\n // there are JDBC Driver that nominally implement JDBC 2.0, but\r\n // throw DriverNotCapableExceptions. If we catch one of these\r\n // we force usage of JDBC 1.0\r\n if (eSql.getClass().getName()\r\n .equals(\"interbase.interclient.DriverNotCapableException\"))\r\n {\r\n log.warn(\"JDBC 2.0 problems with this interbase driver, we use the JDBC 1.0 mode\");\r\n FORCEJDBC1_0 = true;\r\n result = con.createStatement();\r\n }\r\n else\r\n {\r\n throw eSql;\r\n }\r\n }\r\n try\r\n {\r\n platform.afterStatementCreate(result);\r\n }\r\n catch (PlatformException e)\r\n {\r\n log.error(\"Platform dependend failure\", e);\r\n }\r\n return result;\r\n }", "protected static boolean isMaskCompatibleWithRange(long value, long upperValue, long maskValue, long maxValue) {\n\t\tif(value == upperValue || maskValue == maxValue || maskValue == 0) {\n\t\t\treturn true;\n\t\t}\n\n\t\t//algorithm:\n\t\t//here we find the highest bit that is part of the range, highestDifferingBitInRange (ie changes from lower to upper)\n\t\t//then we find the highest bit in the mask that is 1 that is the same or below highestDifferingBitInRange (if such a bit exists)\n\t\t\n\t\t//this gives us the highest bit that is part of the masked range (ie changes from lower to upper after applying the mask)\n\t\t//if this latter bit exists, then any bit below it in the mask must be 1 to include the entire range.\n\t\t\n\t\tlong differing = value ^ upperValue;\n\t\tboolean foundDiffering = (differing != 0);\n\t\tboolean differingIsLowestBit = (differing == 1);\n\t\tif(foundDiffering && !differingIsLowestBit) {\n\t\t\tint highestDifferingBitInRange = Long.numberOfLeadingZeros(differing);\n\t\t\tlong maskMask = ~0L >>> highestDifferingBitInRange;\n\t\t\tlong differingMasked = maskValue & maskMask;\n\t\t\tfoundDiffering = (differingMasked != 0);\n\t\t\tdifferingIsLowestBit = (differingMasked == 1);\n\t\t\tif(foundDiffering && !differingIsLowestBit) {\n\t\t\t\t//anything below highestDifferingBitMasked in the mask must be ones\n\t\t\t\t//Also, if we have masked out any 1 bit in the original, then anything that we do not mask out that follows must be all 1s\n\t\t\t\tint highestDifferingBitMasked = Long.numberOfLeadingZeros(differingMasked);\n\t\t\t\tlong hostMask = ~0L >>> (highestDifferingBitMasked + 1);//for the first mask bit that is 1, all bits that follow must also be 1\n\t\t\t\tif((maskValue & hostMask) != hostMask) { //check if all ones below\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif(highestDifferingBitMasked > highestDifferingBitInRange) {\n\t\t\t\t\t//We have masked out a 1 bit, so we need to check that all bits in upper value that we do not mask out are also 1 bits, otherwise we end up missing values in the masked range\n\t\t\t\t\t//This check is unnecessary for prefix-length subnets, only non-standard ranges might fail this check.\n\t\t\t\t\t//For instance, if we have range 0000 to 1010\n\t\t\t\t\t//and we mask upper and lower with 0111\n\t\t\t\t\t//we get 0000 to 0010, but 0111 was in original range, and the mask of that value retains that value\n\t\t\t\t\t//so that value needs to be in final range, and it's not.\n\t\t\t\t\t//What went wrong is that we masked out the top bit, and any other bit that is not masked out must be 1.\n\t\t\t\t\t//To work, our original range needed to be 0000 to 1111, with the three 1s following the first masked-out 1\n\t\t\t\t\tlong hostMaskUpper = ~0L >>> highestDifferingBitMasked;\n\t\t\t\t\tif((upperValue & hostMaskUpper) != hostMaskUpper) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "public static Path getRootFolderForSource(Path sourceFilePath, String packageName)\n {\n if (packageName == null || packageName.trim().isEmpty())\n {\n return sourceFilePath.getParent();\n }\n String[] packageNameComponents = packageName.split(\"\\\\.\");\n Path currentPath = sourceFilePath.getParent();\n for (int i = packageNameComponents.length; i > 0; i--)\n {\n String packageComponent = packageNameComponents[i - 1];\n if (!StringUtils.equals(packageComponent, currentPath.getFileName().toString()))\n {\n return null;\n }\n currentPath = currentPath.getParent();\n }\n return currentPath;\n }", "public void setAppender(final Appender appender) {\n if (this.appender != null) {\n close();\n }\n checkAccess(this);\n if (applyLayout && appender != null) {\n final Formatter formatter = getFormatter();\n appender.setLayout(formatter == null ? null : new FormatterLayout(formatter));\n }\n appenderUpdater.set(this, appender);\n }" ]
Allow the given job type to be executed. @param jobName the job name as seen @param jobType the job type to allow
[ "public void addJobType(final String jobName, final Class<?> jobType) {\n checkJobType(jobName, jobType);\n this.jobTypes.put(jobName, jobType);\n }" ]
[ "public final void loadCollection(\n\t\tfinal SharedSessionContractImplementor session,\n\t\tfinal Serializable id,\n\t\tfinal Type type) throws HibernateException {\n\n\t\tif ( log.isDebugEnabled() ) {\n\t\t\tlog.debug(\n\t\t\t\t\t\"loading collection: \" +\n\t\t\t\t\tMessageHelper.collectionInfoString( getCollectionPersisters()[0], id, getFactory() )\n\t\t\t\t);\n\t\t}\n\n\t\tSerializable[] ids = new Serializable[]{id};\n\t\tQueryParameters qp = new QueryParameters( new Type[]{type}, ids, ids );\n\t\tdoQueryAndInitializeNonLazyCollections(\n\t\t\t\tsession,\n\t\t\t\tqp,\n\t\t\t\tOgmLoadingContext.EMPTY_CONTEXT,\n\t\t\t\ttrue\n\t\t\t);\n\n\t\tlog.debug( \"done loading collection\" );\n\n\t}", "@ArgumentsChecked\n\t@Throws(IllegalNullArgumentException.class)\n\tpublic static short checkShort(@Nonnull final Number number) {\n\t\tCheck.notNull(number, \"number\");\n\t\tif (!isInShortRange(number)) {\n\t\t\tthrow new IllegalNumberRangeException(number.toString(), SHORT_MIN, SHORT_MAX);\n\t\t}\n\n\t\treturn number.shortValue();\n\t}", "void rejectAttributes(RejectedAttributesLogContext rejectedAttributes, ModelNode attributeValue) {\n for (RejectAttributeChecker checker : checks) {\n rejectedAttributes.checkAttribute(checker, name, attributeValue);\n }\n }", "public Set<Action.ActionEffect> getActionEffects() {\n switch(getImpact()) {\n case CLASSLOADING:\n case WRITE:\n return WRITES;\n case READ_ONLY:\n return READS;\n default:\n throw new IllegalStateException();\n }\n\n }", "public Set<String> rangeByLexReverse(final LexRange lexRange) {\n return doWithJedis(new JedisCallable<Set<String>>() {\n @Override\n public Set<String> call(Jedis jedis) {\n if (lexRange.hasLimit()) {\n return jedis.zrevrangeByLex(getKey(), lexRange.fromReverse(), lexRange.toReverse(), lexRange.offset(), lexRange.count());\n } else {\n return jedis.zrevrangeByLex(getKey(), lexRange.fromReverse(), lexRange.toReverse());\n }\n }\n });\n }", "@Override public Integer getOffset(Integer id, Integer type)\n {\n Integer result = null;\n\n Map<Integer, Integer> map = m_table.get(id);\n if (map != null && type != null)\n {\n result = map.get(type);\n }\n\n return (result);\n }", "public static double J0(double x) {\r\n double ax;\r\n\r\n if ((ax = Math.abs(x)) < 8.0) {\r\n double y = x * x;\r\n double ans1 = 57568490574.0 + y * (-13362590354.0 + y * (651619640.7\r\n + y * (-11214424.18 + y * (77392.33017 + y * (-184.9052456)))));\r\n double ans2 = 57568490411.0 + y * (1029532985.0 + y * (9494680.718\r\n + y * (59272.64853 + y * (267.8532712 + y * 1.0))));\r\n\r\n return ans1 / ans2;\r\n } else {\r\n double z = 8.0 / ax;\r\n double y = z * z;\r\n double xx = ax - 0.785398164;\r\n double ans1 = 1.0 + y * (-0.1098628627e-2 + y * (0.2734510407e-4\r\n + y * (-0.2073370639e-5 + y * 0.2093887211e-6)));\r\n double ans2 = -0.1562499995e-1 + y * (0.1430488765e-3\r\n + y * (-0.6911147651e-5 + y * (0.7621095161e-6\r\n - y * 0.934935152e-7)));\r\n\r\n return Math.sqrt(0.636619772 / ax) *\r\n (Math.cos(xx) * ans1 - z * Math.sin(xx) * ans2);\r\n }\r\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 void logError(String message, Object sender) {\n getEventManager().sendEvent(this, IErrorEvents.class, \"onError\", new Object[] { message, sender });\n }" ]
as it is daemon thread TODO when release external resources should shutdown the scheduler.
[ "public synchronized void initTaskSchedulerIfNot() {\n\n if (scheduler == null) {\n scheduler = Executors\n .newSingleThreadScheduledExecutor(DaemonThreadFactory\n .getInstance());\n CapacityAwareTaskScheduler runner = new CapacityAwareTaskScheduler();\n scheduler.scheduleAtFixedRate(runner,\n ParallecGlobalConfig.schedulerInitDelay,\n ParallecGlobalConfig.schedulerCheckInterval,\n TimeUnit.MILLISECONDS);\n logger.info(\"initialized daemon task scheduler to evaluate waitQ tasks.\");\n \n }\n }" ]
[ "public static void show(DMatrixD1 A , String title ) {\n JFrame frame = new JFrame(title);\n\n int width = 300;\n int height = 300;\n\n if( A.numRows > A.numCols) {\n width = width*A.numCols/A.numRows;\n } else {\n height = height*A.numRows/A.numCols;\n }\n\n DMatrixComponent panel = new DMatrixComponent(width,height);\n panel.setMatrix(A);\n\n frame.add(panel, BorderLayout.CENTER);\n\n frame.pack();\n frame.setVisible(true);\n\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 }", "private void countPropertyMain(UsageStatistics usageStatistics,\n\t\t\tPropertyIdValue property, int count) {\n\t\taddPropertyCounters(usageStatistics, property);\n\t\tusageStatistics.propertyCountsMain.put(property,\n\t\t\t\tusageStatistics.propertyCountsMain.get(property) + count);\n\t}", "static int lastArgMatchesVarg(Parameter[] params, ClassNode... args) {\n if (!isVargs(params)) return -1;\n // case length ==0 handled already\n // we have now two cases,\n // the argument is wrapped in the vargs array or\n // the argument is an array that can be used for the vargs part directly\n // we test only the wrapping part, since the non wrapping is done already\n ClassNode lastParamType = params[params.length - 1].getType();\n ClassNode ptype = lastParamType.getComponentType();\n ClassNode arg = args[args.length - 1];\n if (isNumberType(ptype) && isNumberType(arg) && !ptype.equals(arg)) return -1;\n return isAssignableTo(arg, ptype)?Math.min(getDistance(arg, lastParamType), getDistance(arg, ptype)):-1;\n }", "private Send handle(SelectionKey key, Receive request) {\n final short requestTypeId = request.buffer().getShort();\n final RequestKeys requestType = RequestKeys.valueOf(requestTypeId);\n if (requestLogger.isTraceEnabled()) {\n if (requestType == null) {\n throw new InvalidRequestException(\"No mapping found for handler id \" + requestTypeId);\n }\n String logFormat = \"Handling %s request from %s\";\n requestLogger.trace(format(logFormat, requestType, channelFor(key).socket().getRemoteSocketAddress()));\n }\n RequestHandler handlerMapping = requesthandlerFactory.mapping(requestType, request);\n if (handlerMapping == null) {\n throw new InvalidRequestException(\"No handler found for request\");\n }\n long start = System.nanoTime();\n Send maybeSend = handlerMapping.handler(requestType, request);\n stats.recordRequest(requestType, System.nanoTime() - start);\n return maybeSend;\n }", "public double nonNormalizedTreeDist(LblTree t1, LblTree t2) {\n\t\tinit(t1, t2);\n\t\tSTR = new int[size1][size2];\n\t\tcomputeOptimalStrategy();\n\t\treturn computeDistUsingStrArray(it1, it2);\n\t}", "public RasterLayerInfo asLayerInfo(TileMap tileMap) {\n\t\tRasterLayerInfo layerInfo = new RasterLayerInfo();\n\n\t\tlayerInfo.setCrs(tileMap.getSrs());\n\t\tlayerInfo.setDataSourceName(tileMap.getTitle());\n\t\tlayerInfo.setLayerType(LayerType.RASTER);\n\t\tlayerInfo.setMaxExtent(asBbox(tileMap.getBoundingBox()));\n\t\tlayerInfo.setTileHeight(tileMap.getTileFormat().getHeight());\n\t\tlayerInfo.setTileWidth(tileMap.getTileFormat().getWidth());\n\n\t\tList<ScaleInfo> zoomLevels = new ArrayList<ScaleInfo>(tileMap.getTileSets().getTileSets().size());\n\t\tfor (TileSet tileSet : tileMap.getTileSets().getTileSets()) {\n\t\t\tzoomLevels.add(asScaleInfo(tileSet));\n\t\t}\n\t\tlayerInfo.setZoomLevels(zoomLevels);\n\n\t\treturn layerInfo;\n\t}", "public void sendJsonToUrl(Object data, String url) {\n sendToUrl(JSON.toJSONString(data), url);\n }", "public int bindShader(GVRContext context, GVRShaderData material, String vertexDesc)\n {\n String signature = getClass().getSimpleName();\n GVRShaderManager shaderManager = context.getShaderManager();\n\n synchronized (shaderManager)\n {\n int nativeShader = shaderManager.getShader(signature);\n if (nativeShader == 0)\n {\n nativeShader = addShader(shaderManager, signature, material);\n }\n return nativeShader;\n }\n }" ]
Convenience method for setting the value of a private object field, without the stress of checked exceptions in the reflection API. @param object Object containing the field. @param fieldName Name of the field to set. @param value Value to which to set the field.
[ "public static void setFieldValue(Object object, String fieldName, Object value) {\n try {\n getDeclaredFieldInHierarchy(object.getClass(), fieldName).set(object, value);\n } catch (IllegalArgumentException e) {\n throw new RuntimeException(e);\n } catch (IllegalAccessException e) {\n throw new RuntimeException(e);\n }\n }" ]
[ "public void put(String key, Object object, Envelope envelope) {\n\t\tindex.put(key, envelope);\n\t\tcache.put(key, object);\n\t}", "protected boolean hasTimeOutHeader() {\n\n boolean result = false;\n String timeoutValStr = this.request.getHeader(RestMessageHeaders.X_VOLD_REQUEST_TIMEOUT_MS);\n if(timeoutValStr != null) {\n try {\n this.parsedTimeoutInMs = Long.parseLong(timeoutValStr);\n if(this.parsedTimeoutInMs < 0) {\n RestErrorHandler.writeErrorResponse(messageEvent,\n HttpResponseStatus.BAD_REQUEST,\n \"Time out cannot be negative \");\n\n } else {\n result = true;\n }\n } catch(NumberFormatException nfe) {\n logger.error(\"Exception when validating request. Incorrect timeout parameter. Cannot parse this to long: \"\n + timeoutValStr,\n nfe);\n RestErrorHandler.writeErrorResponse(this.messageEvent,\n HttpResponseStatus.BAD_REQUEST,\n \"Incorrect timeout parameter. Cannot parse this to long: \"\n + timeoutValStr);\n }\n } else {\n logger.error(\"Error when validating request. Missing timeout parameter.\");\n RestErrorHandler.writeErrorResponse(this.messageEvent,\n HttpResponseStatus.BAD_REQUEST,\n \"Missing timeout parameter.\");\n }\n return result;\n }", "private void readResourceBaselines(Project.Resources.Resource xmlResource, Resource mpxjResource)\n {\n for (Project.Resources.Resource.Baseline baseline : xmlResource.getBaseline())\n {\n int number = NumberHelper.getInt(baseline.getNumber());\n\n Double cost = DatatypeConverter.parseCurrency(baseline.getCost());\n Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.HOURS, baseline.getWork());\n\n if (number == 0)\n {\n mpxjResource.setBaselineCost(cost);\n mpxjResource.setBaselineWork(work);\n }\n else\n {\n mpxjResource.setBaselineCost(number, cost);\n mpxjResource.setBaselineWork(number, work);\n }\n }\n }", "public static base_response unset(nitro_service client, inatparam resource, String[] args) throws Exception{\n\t\tinatparam unsetresource = new inatparam();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "public static byte[] hashPath(MessageDigest messageDigest, Path path) throws IOException {\n try (InputStream in = getRecursiveContentStream(path)) {\n return hashContent(messageDigest, in);\n }\n }", "public static String retrieveVendorId() {\n if (MapboxTelemetry.applicationContext == null) {\n return updateVendorId();\n }\n\n SharedPreferences sharedPreferences = obtainSharedPreferences(MapboxTelemetry.applicationContext);\n String mapboxVendorId = sharedPreferences.getString(MAPBOX_SHARED_PREFERENCE_KEY_VENDOR_ID, \"\");\n if (TelemetryUtils.isEmpty(mapboxVendorId)) {\n mapboxVendorId = TelemetryUtils.updateVendorId();\n }\n return mapboxVendorId;\n }", "public StringBuilder getSQLCondition(StringBuilder builder, String columnName) {\n\t\tString string = networkString.getString();\n\t\tif(isEntireAddress) {\n\t\t\tmatchString(builder, columnName, string);\n\t\t} else {\n\t\t\tmatchSubString(\n\t\t\t\t\tbuilder,\n\t\t\t\t\tcolumnName,\n\t\t\t\t\tnetworkString.getTrailingSegmentSeparator(),\n\t\t\t\t\tnetworkString.getTrailingSeparatorCount() + 1,\n\t\t\t\t\tstring);\n\t\t}\n\t\treturn builder;\n\t}", "okhttp3.Response get(String url, Map<String, Object> params)\n throws RequestException, LocalOperationException {\n\n String fullUrl = getFullUrl(url);\n okhttp3.Request request = new okhttp3.Request.Builder()\n .url(addUrlParams(fullUrl, toPayload(params)))\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 void addEmailStats(final InternetAddress[] recipients, final boolean storageUsed) {\n this.storageUsed = storageUsed;\n for (InternetAddress recipient: recipients) {\n emailDests.add(recipient.getAddress());\n }\n }" ]
convenience method for setting working or non-working days. @param day required day @param working flag indicating if the day is a working day
[ "public void setWorkingDay(Day day, boolean working)\n {\n setWorkingDay(day, (working ? DayType.WORKING : DayType.NON_WORKING));\n }" ]
[ "@Override\n public void setDraggable(Element elem, String draggable) {\n super.setDraggable(elem, draggable);\n if (\"true\".equals(draggable)) {\n elem.getStyle().setProperty(\"webkitUserDrag\", \"element\");\n } else {\n elem.getStyle().clearProperty(\"webkitUserDrag\");\n }\n }", "public static String getStringOption(Map<String, String> configOptions, String optionKey, String defaultValue) {\n\n String result = configOptions.get(optionKey);\n return null != result ? result : defaultValue;\n }", "@Override\n public void deploy(InputStream inputStream) throws IOException {\n final List<? extends HasMetadata> entities = deploy(\"application\", inputStream);\n\n if (this.applicationName == null) {\n\n Optional<String> deploymentConfig = entities.stream()\n .filter(hm -> hm instanceof DeploymentConfig)\n .map(hm -> (DeploymentConfig) hm)\n .map(dc -> dc.getMetadata().getName()).findFirst();\n\n deploymentConfig.ifPresent(name -> this.applicationName = name);\n }\n }", "public void createInsertionSql(Database model, Platform platform, Writer writer) throws IOException\r\n {\r\n for (Iterator it = _beans.iterator(); it.hasNext();)\r\n {\r\n writer.write(platform.getInsertSql(model, (DynaBean)it.next()));\r\n if (it.hasNext())\r\n {\r\n writer.write(\"\\n\");\r\n }\r\n }\r\n }", "public static final Path resolveSecurely(Path rootPath, String path) {\n Path resolvedPath;\n if(path == null || path.isEmpty()) {\n resolvedPath = rootPath.normalize();\n } else {\n String relativePath = removeSuperflousSlashes(path);\n resolvedPath = rootPath.resolve(relativePath).normalize();\n }\n if(!resolvedPath.startsWith(rootPath)) {\n throw DeploymentRepositoryLogger.ROOT_LOGGER.forbiddenPath(path);\n }\n return resolvedPath;\n }", "public float getTexCoordU(int vertex, int coords) {\n if (!hasTexCoords(coords)) {\n throw new IllegalStateException(\n \"mesh has no texture coordinate set \" + coords);\n }\n \n checkVertexIndexBounds(vertex);\n /* bound checks for coords are done by java for us */\n \n return m_texcoords[coords].getFloat(\n vertex * m_numUVComponents[coords] * SIZEOF_FLOAT);\n }", "@Override\n public void checkin(K key, V resource) {\n super.checkin(key, resource);\n // NB: Blocking checkout calls for synchronous requests get the resource\n // checked in above before processQueueLoop() attempts checkout below.\n // There is therefore a risk that asynchronous requests will be starved.\n processQueueLoop(key);\n }", "public static rnatparam get(nitro_service service) throws Exception{\n\t\trnatparam obj = new rnatparam();\n\t\trnatparam[] response = (rnatparam[])obj.get_resources(service);\n\t\treturn response[0];\n\t}", "public DbProduct getProduct(final String name) {\n final DbProduct dbProduct = repositoryHandler.getProduct(name);\n\n if(dbProduct == null){\n throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)\n .entity(\"Product \" + name + \" does not exist.\").build());\n }\n\n return dbProduct;\n }" ]
Create a MfClientHttpRequestFactory for adding the specified headers. @param requestFactory the basic request factory. It should be unmodified and just wrapped with a proxy class. @param matchers The matchers. @param headers The headers. @return
[ "public static MfClientHttpRequestFactory createFactoryWrapper(\n final MfClientHttpRequestFactory requestFactory,\n final UriMatchers matchers, final Map<String, List<String>> headers) {\n return new AbstractMfClientHttpRequestFactoryWrapper(requestFactory, matchers, false) {\n @Override\n protected ClientHttpRequest createRequest(\n final URI uri,\n final HttpMethod httpMethod,\n final MfClientHttpRequestFactory requestFactory) throws IOException {\n final ClientHttpRequest request = requestFactory.createRequest(uri, httpMethod);\n request.getHeaders().putAll(headers);\n return request;\n }\n };\n }" ]
[ "public void resolveLazyCrossReferences(final CancelIndicator mon) {\n\t\tfinal CancelIndicator monitor = mon == null ? CancelIndicator.NullImpl : mon;\n\t\tTreeIterator<Object> iterator = EcoreUtil.getAllContents(this, true);\n\t\twhile (iterator.hasNext()) {\n\t\t\toperationCanceledManager.checkCanceled(monitor);\n\t\t\tInternalEObject source = (InternalEObject) iterator.next();\n\t\t\tEStructuralFeature[] eStructuralFeatures = ((EClassImpl.FeatureSubsetSupplier) source.eClass()\n\t\t\t\t\t.getEAllStructuralFeatures()).crossReferences();\n\t\t\tif (eStructuralFeatures != null) {\n\t\t\t\tfor (EStructuralFeature crossRef : eStructuralFeatures) {\n\t\t\t\t\toperationCanceledManager.checkCanceled(monitor);\n\t\t\t\t\tresolveLazyCrossReference(source, crossRef);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private boolean loadCustomErrorPage(\n CmsObject cms,\n HttpServletRequest req,\n HttpServletResponse res,\n String rootPath) {\n\n try {\n\n // get the site of the error page resource\n CmsSite errorSite = OpenCms.getSiteManager().getSiteForRootPath(rootPath);\n cms.getRequestContext().setSiteRoot(errorSite.getSiteRoot());\n String relPath = cms.getRequestContext().removeSiteRoot(rootPath);\n if (cms.existsResource(relPath)) {\n cms.getRequestContext().setUri(relPath);\n OpenCms.getResourceManager().loadResource(cms, cms.readResource(relPath), req, res);\n return true;\n } else {\n return false;\n }\n } catch (Throwable e) {\n // something went wrong log the exception and return false\n LOG.error(e.getMessage(), e);\n return false;\n }\n }", "public void recordConnectionEstablishmentTimeUs(SocketDestination dest, long connEstTimeUs) {\n if(dest != null) {\n getOrCreateNodeStats(dest).recordConnectionEstablishmentTimeUs(null, connEstTimeUs);\n recordConnectionEstablishmentTimeUs(null, connEstTimeUs);\n } else {\n this.connectionEstablishmentRequestCounter.addRequest(connEstTimeUs * Time.NS_PER_US);\n }\n }", "public CollectionRequest<Story> findByTask(String task) {\n \n String path = String.format(\"/tasks/%s/stories\", task);\n return new CollectionRequest<Story>(this, Story.class, path, \"GET\");\n }", "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 boolean checkXpathStartsWithXpathEventableCondition(Document dom,\n\t\t\tEventableCondition eventableCondition, String xpath) throws XPathExpressionException {\n\t\tif (eventableCondition == null || Strings\n\t\t\t\t.isNullOrEmpty(eventableCondition.getInXPath())) {\n\t\t\tthrow new CrawljaxException(\"Eventable has no XPath condition\");\n\t\t}\n\t\tList<String> expressions =\n\t\t\t\tXPathHelper.getXpathForXPathExpressions(dom, eventableCondition.getInXPath());\n\n\t\treturn checkXPathUnderXPaths(xpath, expressions);\n\t}", "public static appflowglobal_binding get(nitro_service service) throws Exception{\n\t\tappflowglobal_binding obj = new appflowglobal_binding();\n\t\tappflowglobal_binding response = (appflowglobal_binding) obj.get_resource(service);\n\t\treturn response;\n\t}", "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 static base_responses expire(nitro_service client, cacheobject resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tcacheobject expireresources[] = new cacheobject[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\texpireresources[i] = new cacheobject();\n\t\t\t\texpireresources[i].locator = resources[i].locator;\n\t\t\t\texpireresources[i].url = resources[i].url;\n\t\t\t\texpireresources[i].host = resources[i].host;\n\t\t\t\texpireresources[i].port = resources[i].port;\n\t\t\t\texpireresources[i].groupname = resources[i].groupname;\n\t\t\t\texpireresources[i].httpmethod = resources[i].httpmethod;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, expireresources,\"expire\");\n\t\t}\n\t\treturn result;\n\t}" ]
Get a property as a double or defaultValue. @param key the property name @param defaultValue the default value
[ "@Override\n public final Double optDouble(final String key, final Double defaultValue) {\n Double result = optDouble(key);\n return result == null ? defaultValue : result;\n }" ]
[ "public void setMenuView(int layoutResId) {\n mMenuContainer.removeAllViews();\n mMenuView = LayoutInflater.from(getContext()).inflate(layoutResId, mMenuContainer, false);\n mMenuContainer.addView(mMenuView);\n }", "public RandomVariable getValues(double evaluationTime, LIBORMarketModel model) {\n\t\tif(evaluationTime > 0) {\n\t\t\tthrow new RuntimeException(\"Forward start evaluation currently not supported.\");\n\t\t}\n\n\t\t// Fetch the covariance model of the model\n\t\tLIBORCovarianceModel covarianceModel = model.getCovarianceModel();\n\n\t\t// We sum over all forward rates\n\t\tint numberOfComponents = covarianceModel.getLiborPeriodDiscretization().getNumberOfTimeSteps();\n\n\t\t// Accumulator\n\t\tRandomVariable\tintegratedLIBORCurvature\t= new RandomVariableFromDoubleArray(0.0);\n\t\tfor(int componentIndex = 0; componentIndex < numberOfComponents; componentIndex++) {\n\n\t\t\t// Integrate from 0 up to the fixing of the rate\n\t\t\tdouble timeEnd\t\t= covarianceModel.getLiborPeriodDiscretization().getTime(componentIndex);\n\t\t\tint timeEndIndex\t= covarianceModel.getTimeDiscretization().getTimeIndex(timeEnd);\n\n\t\t\t// If timeEnd is not in the time discretization we get timeEndIndex = -insertionPoint-1. In that case, we use the index prior to the insertionPoint\n\t\t\tif(timeEndIndex < 0) {\n\t\t\t\ttimeEndIndex = -timeEndIndex - 2;\n\t\t\t}\n\n\t\t\t// Sum squared second derivative of the variance for all components at this time step\n\t\t\tRandomVariable integratedLIBORCurvatureCurrentRate = new RandomVariableFromDoubleArray(0.0);\n\t\t\tfor(int timeIndex = 0; timeIndex < timeEndIndex-2; timeIndex++) {\n\t\t\t\tdouble timeStep1\t= covarianceModel.getTimeDiscretization().getTimeStep(timeIndex);\n\t\t\t\tdouble timeStep2\t= covarianceModel.getTimeDiscretization().getTimeStep(timeIndex+1);\n\n\t\t\t\tRandomVariable covarianceLeft\t\t= covarianceModel.getCovariance(timeIndex+0, componentIndex, componentIndex, null);\n\t\t\t\tRandomVariable covarianceCenter\t= covarianceModel.getCovariance(timeIndex+1, componentIndex, componentIndex, null);\n\t\t\t\tRandomVariable covarianceRight\t\t= covarianceModel.getCovariance(timeIndex+2, componentIndex, componentIndex, null);\n\n\t\t\t\t// Calculate second derivative\n\t\t\t\tRandomVariable curvatureSquared = covarianceRight.sub(covarianceCenter.mult(2.0)).add(covarianceLeft);\n\t\t\t\tcurvatureSquared = curvatureSquared.div(timeStep1 * timeStep2);\n\n\t\t\t\t// Take square\n\t\t\t\tcurvatureSquared = curvatureSquared.squared();\n\n\t\t\t\t// Integrate over time\n\t\t\t\tintegratedLIBORCurvatureCurrentRate = integratedLIBORCurvatureCurrentRate.add(curvatureSquared.mult(timeStep1));\n\t\t\t}\n\n\t\t\t// Empty intervall - skip\n\t\t\tif(timeEnd == 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Average over time\n\t\t\tintegratedLIBORCurvatureCurrentRate = integratedLIBORCurvatureCurrentRate.div(timeEnd);\n\n\t\t\t// Take square root\n\t\t\tintegratedLIBORCurvatureCurrentRate = integratedLIBORCurvatureCurrentRate.sqrt();\n\n\t\t\t// Take max over all forward rates\n\t\t\tintegratedLIBORCurvature = integratedLIBORCurvature.add(integratedLIBORCurvatureCurrentRate);\n\t\t}\n\n\t\tintegratedLIBORCurvature = integratedLIBORCurvature.div(numberOfComponents);\n\t\treturn integratedLIBORCurvature.sub(tolerance).floor(0.0);\n\t}", "private static void bodyWithBuilderAndSeparator(\n SourceBuilder code,\n Datatype datatype,\n Map<Property, PropertyCodeGenerator> generatorsByProperty,\n String typename) {\n Variable result = new Variable(\"result\");\n Variable separator = new Variable(\"separator\");\n\n code.addLine(\" %1$s %2$s = new %1$s(\\\"%3$s{\\\");\", StringBuilder.class, result, typename);\n if (generatorsByProperty.size() > 1) {\n // If there's a single property, we don't actually use the separator variable\n code.addLine(\" %s %s = \\\"\\\";\", String.class, separator);\n }\n\n Property first = generatorsByProperty.keySet().iterator().next();\n Property last = getLast(generatorsByProperty.keySet());\n for (Property property : generatorsByProperty.keySet()) {\n PropertyCodeGenerator generator = generatorsByProperty.get(property);\n switch (generator.initialState()) {\n case HAS_DEFAULT:\n throw new RuntimeException(\"Internal error: unexpected default field\");\n\n case OPTIONAL:\n code.addLine(\" if (%s) {\", (Excerpt) generator::addToStringCondition);\n break;\n\n case REQUIRED:\n code.addLine(\" if (!%s.contains(%s.%s)) {\",\n UNSET_PROPERTIES, datatype.getPropertyEnum(), property.getAllCapsName());\n break;\n }\n code.add(\" \").add(result);\n if (property != first) {\n code.add(\".append(%s)\", separator);\n }\n code.add(\".append(\\\"%s=\\\").append(%s)\",\n property.getName(), (Excerpt) generator::addToStringValue);\n if (property != last) {\n code.add(\";%n %s = \\\", \\\"\", separator);\n }\n code.add(\";%n }%n\");\n }\n code.addLine(\" return %s.append(\\\"}\\\").toString();\", result);\n }", "public static nd6ravariables[] get(nitro_service service, options option) throws Exception{\n\t\tnd6ravariables obj = new nd6ravariables();\n\t\tnd6ravariables[] response = (nd6ravariables[])obj.get_resources(service,option);\n\t\treturn response;\n\t}", "public static List<String> asListLinesIgnore(String content, Pattern ignorePattern) {\n List<String> retorno = new ArrayList<String>();\n content = content.replace(CARRIAGE_RETURN, RETURN);\n content = content.replace(RETURN, CARRIAGE_RETURN);\n for (String str : content.split(CARRIAGE_RETURN)) {\n if (!ignorePattern.matcher(str).matches()) {\n retorno.add(str);\n }\n }\n return retorno;\n }", "public static RequiredConfigurationHolder populateHostResolutionContext(final HostInfo hostInfo, final Resource root, final ExtensionRegistry extensionRegistry) {\n final RequiredConfigurationHolder rc = new RequiredConfigurationHolder();\n for (IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo info : hostInfo.getServerConfigInfos()) {\n processServerConfig(root, rc, info, extensionRegistry);\n }\n return rc;\n }", "public void setEnterpriseNumber(int index, Number value)\n {\n set(selectField(AssignmentFieldLists.ENTERPRISE_NUMBER, index), value);\n }", "public static String soundex(String str) {\n if (str.length() < 1)\n return \"\"; // no soundex key for the empty string (could use 000)\n \n char[] key = new char[4];\n key[0] = str.charAt(0);\n int pos = 1;\n char prev = '0';\n for (int ix = 1; ix < str.length() && pos < 4; ix++) {\n char ch = str.charAt(ix);\n int charno;\n if (ch >= 'A' && ch <= 'Z')\n charno = ch - 'A';\n else if (ch >= 'a' && ch <= 'z')\n charno = ch - 'a';\n else\n continue;\n\n if (number[charno] != '0' && number[charno] != prev)\n key[pos++] = number[charno];\n prev = number[charno];\n }\n\n for ( ; pos < 4; pos++)\n key[pos] = '0';\n\n return new String(key);\n }", "public static String plus(Number value, String right) {\n return DefaultGroovyMethods.toString(value) + right;\n }" ]
Enable or disable this component. @param flag true to enable, false to disable. @see #enable() @see #disable() @see #isEnabled()
[ "public void setEnable(boolean flag) {\n if (flag == mIsEnabled)\n return;\n\n mIsEnabled = flag;\n\n if (getNative() != 0)\n {\n NativeComponent.setEnable(getNative(), flag);\n }\n if (flag)\n {\n onEnable();\n }\n else\n {\n onDisable();\n }\n }" ]
[ "public static String[] copyArrayAddFirst(String[] arr, String add) {\n String[] arrCopy = new String[arr.length + 1];\n arrCopy[0] = add;\n System.arraycopy(arr, 0, arrCopy, 1, arr.length);\n return arrCopy;\n }", "public static nspbr6 get(nitro_service service, String name) throws Exception{\n\t\tnspbr6 obj = new nspbr6();\n\t\tobj.set_name(name);\n\t\tnspbr6 response = (nspbr6) obj.get_resource(service);\n\t\treturn response;\n\t}", "public DiffNode getChild(final NodePath nodePath)\n\t{\n\t\tif (parentNode != null)\n\t\t{\n\t\t\treturn parentNode.getChild(nodePath.getElementSelectors());\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn getChild(nodePath.getElementSelectors());\n\t\t}\n\t}", "private void readResourceAssignments(Project gpProject)\n {\n Allocations allocations = gpProject.getAllocations();\n if (allocations != null)\n {\n for (Allocation allocation : allocations.getAllocation())\n {\n readResourceAssignment(allocation);\n }\n }\n }", "public boolean updateSelectedItemsList(int dataIndex, boolean select) {\n boolean done = false;\n boolean contains = isSelected(dataIndex);\n if (select) {\n if (!contains) {\n if (!mMultiSelectionSupported) {\n clearSelection(false);\n }\n Log.d(Log.SUBSYSTEM.LAYOUT, TAG, \"updateSelectedItemsList add index = %d\", dataIndex);\n mSelectedItemsList.add(dataIndex);\n done = true;\n }\n } else {\n if (contains) {\n Log.d(Log.SUBSYSTEM.LAYOUT, TAG, \"updateSelectedItemsList remove index = %d\", dataIndex);\n mSelectedItemsList.remove(dataIndex);\n done = true;\n }\n }\n return done;\n }", "public static Trajectory addPositionNoise(Trajectory t, double sd){\n\t\tCentralRandomNumberGenerator r = CentralRandomNumberGenerator.getInstance();\n\t\tTrajectory newt = new Trajectory(t.getDimension());\n\t\t\n\t\tfor(int i = 0; i < t.size(); i++){\n\t\t\tnewt.add(t.get(i));\n\t\t\tfor(int j = 1; j <= t.getDimension(); j++){\n\t\t\t\tswitch (j) {\n\t\t\t\tcase 1:\n\t\t\t\t\tnewt.get(i).setX(newt.get(i).x + r.nextGaussian()*sd);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tnewt.get(i).setY(newt.get(i).y + r.nextGaussian()*sd);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tnewt.get(i).setZ(newt.get(i).z + r.nextGaussian()*sd);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn newt;\n\t\t\n\t}", "public void prepareStatus() {\n globalLineCounter = new AtomicLong(0);\n time = new AtomicLong(System.currentTimeMillis());\n startTime = System.currentTimeMillis();\n lastCount = 0;\n\n // Status thread regularly reports on what is happening\n Thread statusThread = new Thread() {\n public void run() {\n while (true) {\n try {\n Thread.sleep(1000);\n } catch (InterruptedException e) {\n System.out.println(\"Status thread interrupted\");\n }\n\n long thisTime = System.currentTimeMillis();\n long currentCount = globalLineCounter.get();\n\n if (thisTime - time.get() > 1000) {\n long oldTime = time.get();\n time.set(thisTime);\n double avgRate = 1000.0 * currentCount / (thisTime - startTime);\n double instRate = 1000.0 * (currentCount - lastCount) / (thisTime - oldTime);\n lastCount = currentCount;\n System.out.println(currentCount + \" AvgRage:\" + ((int) avgRate) + \" lines/sec instRate:\"\n + ((int) instRate) + \" lines/sec Unassigned Work: \"\n + remainingBlocks.get() + \" blocks\");\n }\n }\n }\n };\n statusThread.start();\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 }", "public ValueContainer[] getKeyValues(ClassDescriptor cld, Object objectOrProxy) throws PersistenceBrokerException\r\n {\r\n return getKeyValues(cld, objectOrProxy, true);\r\n }" ]
Use this API to update csparameter.
[ "public static base_response update(nitro_service client, csparameter resource) throws Exception {\n\t\tcsparameter updateresource = new csparameter();\n\t\tupdateresource.stateupdate = resource.stateupdate;\n\t\treturn updateresource.update_resource(client);\n\t}" ]
[ "public static KieRuntimeLogger newFileLogger(KieRuntimeEventManager session,\n String fileName) {\n return getKnowledgeRuntimeLoggerProvider().newFileLogger( session,\n fileName );\n }", "public static base_responses reset(nitro_service client, appfwlearningdata resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tappfwlearningdata resetresources[] = new appfwlearningdata[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tresetresources[i] = new appfwlearningdata();\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, resetresources,\"reset\");\n\t\t}\n\t\treturn result;\n\t}", "private void ensureConversion(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 // we issue a warning if we encounter a field with a java.util.Date java type without a conversion\r\n if (\"java.util.Date\".equals(fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_JAVA_TYPE)) &&\r\n !fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_CONVERSION))\r\n {\r\n LogHelper.warn(true,\r\n FieldDescriptorConstraints.class,\r\n \"ensureConversion\",\r\n \"The field \"+fieldDef.getName()+\" in class \"+fieldDef.getOwner().getName()+\r\n \" of type java.util.Date is directly mapped to jdbc-type \"+\r\n fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE)+\r\n \". However, most JDBC drivers can't handle java.util.Date directly so you might want to \"+\r\n \" use a conversion for converting it to a JDBC datatype like TIMESTAMP.\");\r\n }\r\n\r\n String conversionClass = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_CONVERSION);\r\n\r\n if (((conversionClass == null) || (conversionClass.length() == 0)) &&\r\n fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CONVERSION) &&\r\n fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_JDBC_TYPE).equals(fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE)))\r\n {\r\n conversionClass = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_DEFAULT_CONVERSION);\r\n fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_CONVERSION, conversionClass);\r\n }\r\n // now checking\r\n if (CHECKLEVEL_STRICT.equals(checkLevel) && (conversionClass != null) && (conversionClass.length() > 0))\r\n {\r\n InheritanceHelper helper = new InheritanceHelper();\r\n\r\n try\r\n {\r\n if (!helper.isSameOrSubTypeOf(conversionClass, CONVERSION_INTERFACE))\r\n {\r\n throw new ConstraintException(\"The conversion class specified for field \"+fieldDef.getName()+\" in class \"+fieldDef.getOwner().getName()+\" does not implement the necessary interface \"+CONVERSION_INTERFACE);\r\n }\r\n }\r\n catch (ClassNotFoundException ex)\r\n {\r\n throw new ConstraintException(\"The class \"+ex.getMessage()+\" hasn't been found on the classpath while checking the conversion class specified for field \"+fieldDef.getName()+\" in class \"+fieldDef.getOwner().getName());\r\n }\r\n }\r\n}", "@SuppressWarnings(\"unchecked\")\n public Multimap<String, Processor> getAllRequiredAttributes() {\n Multimap<String, Processor> requiredInputs = HashMultimap.create();\n for (ProcessorGraphNode root: this.roots) {\n final BiMap<String, String> inputMapper = root.getInputMapper();\n for (String attr: inputMapper.keySet()) {\n requiredInputs.put(attr, root.getProcessor());\n }\n final Object inputParameter = root.getProcessor().createInputParameter();\n if (inputParameter instanceof Values) {\n continue;\n } else if (inputParameter != null) {\n final Class<?> inputParameterClass = inputParameter.getClass();\n final Set<String> requiredAttributesDefinedInInputParameter =\n getAttributeNames(inputParameterClass,\n FILTER_ONLY_REQUIRED_ATTRIBUTES);\n for (String attName: requiredAttributesDefinedInInputParameter) {\n try {\n if (inputParameterClass.getField(attName).getType() == Values.class) {\n continue;\n }\n } catch (NoSuchFieldException e) {\n throw new RuntimeException(e);\n }\n String mappedName = ProcessorUtils.getInputValueName(\n root.getProcessor().getInputPrefix(),\n inputMapper, attName);\n requiredInputs.put(mappedName, root.getProcessor());\n }\n }\n }\n\n return requiredInputs;\n }", "public void fire(StepStartedEvent event) {\n Step step = new Step();\n event.process(step);\n stepStorage.put(step);\n\n notifier.fire(event);\n }", "public static boolean isSameStructure(DMatrixSparseCSC a , DMatrixSparseCSC b) {\n if( a.numRows == b.numRows && a.numCols == b.numCols && a.nz_length == b.nz_length) {\n for (int i = 0; i <= a.numCols; i++) {\n if( a.col_idx[i] != b.col_idx[i] )\n return false;\n }\n for (int i = 0; i < a.nz_length; i++) {\n if( a.nz_rows[i] != b.nz_rows[i] )\n return false;\n }\n return true;\n }\n return false;\n }", "void insertOne(final MongoNamespace namespace, final BsonDocument document) {\n this.waitUntilInitialized();\n\n try {\n ongoingOperationsGroup.enter();\n // Remove forbidden fields from the document before inserting it into the local collection.\n final BsonDocument docForStorage = sanitizeDocument(document);\n\n final NamespaceSynchronizationConfig nsConfig =\n this.syncConfig.getNamespaceConfig(namespace);\n final Lock lock = nsConfig.getLock().writeLock();\n lock.lock();\n final ChangeEvent<BsonDocument> event;\n final BsonValue documentId;\n try {\n getLocalCollection(namespace).insertOne(docForStorage);\n documentId = BsonUtils.getDocumentId(docForStorage);\n event = ChangeEvents.changeEventForLocalInsert(namespace, docForStorage, true);\n final CoreDocumentSynchronizationConfig config = syncConfig.addAndGetSynchronizedDocument(\n namespace,\n documentId\n );\n config.setSomePendingWritesAndSave(logicalT, event);\n } finally {\n lock.unlock();\n }\n checkAndInsertNamespaceListener(namespace);\n eventDispatcher.emitEvent(nsConfig, event);\n } finally {\n ongoingOperationsGroup.exit();\n }\n }", "public static service_dospolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tservice_dospolicy_binding obj = new service_dospolicy_binding();\n\t\tobj.set_name(name);\n\t\tservice_dospolicy_binding response[] = (service_dospolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "private Charset getCharset()\n {\n Charset result = m_charset;\n if (result == null)\n {\n // We default to CP1252 as this seems to be the most common encoding\n result = m_encoding == null ? CharsetHelper.CP1252 : Charset.forName(m_encoding);\n }\n return result;\n }" ]
Copy the given Collection into a Class array. The Collection must contain Class elements only. @param collection the Collection to copy @return the Class array ({@code null} if the passed-in Collection was {@code null})
[ "public static Class<?>[] toClassArray(Collection<Class<?>> collection) {\n\t\tif (collection == null) {\n\t\t\treturn null;\n\t\t}\n\t\treturn collection.toArray(new Class<?>[collection.size()]);\n\t}" ]
[ "public void setStartTime(final Date date) {\r\n\r\n if (!Objects.equals(m_model.getStart(), date)) {\r\n removeExceptionsOnChange(new Command() {\r\n\r\n public void execute() {\r\n\r\n m_model.setStart(date);\r\n setPatternDefaultValues(date);\r\n valueChanged();\r\n }\r\n });\r\n }\r\n\r\n }", "public static AT_Row createRule(TableRowType type, TableRowStyle style){\r\n\t\tValidate.notNull(type);\r\n\t\tValidate.validState(type!=TableRowType.UNKNOWN);\r\n\t\tValidate.validState(type!=TableRowType.CONTENT);\r\n\t\tValidate.notNull(style);\r\n\t\tValidate.validState(style!=TableRowStyle.UNKNOWN);\r\n\r\n\t\treturn new AT_Row(){\r\n\t\t\t@Override\r\n\t\t\tpublic TableRowType getType(){\r\n\t\t\t\treturn type;\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic TableRowStyle getStyle(){\r\n\t\t\t\treturn style;\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public static double SquaredEuclidean(double[] x, double[] y) {\n double d = 0.0, u;\n\n for (int i = 0; i < x.length; i++) {\n u = x[i] - y[i];\n d += u * u;\n }\n\n return d;\n }", "public ReportWriter getReportWriter(final JasperPrint _jasperPrint, final String _format, final Map<JRExporterParameter,Object> _parameters) {\n final JRExporter exporter = FormatInfoRegistry.getInstance().getExporter(_format);\n exporter.setParameters(_parameters);\n\n if (_jasperPrint.getPages().size() > PAGES_THRESHHOLD) {\n return new FileReportWriter(_jasperPrint, exporter);\n } else {\n return new MemoryReportWriter(_jasperPrint, exporter);\n }\n }", "static void addOperationAddress(final ModelNode operation, final PathAddress base, final String key, final String value) {\n operation.get(OP_ADDR).set(base.append(key, value).toModelNode());\n }", "public static void deleteFilePath(FilePath workspace, String path) throws IOException {\n if (StringUtils.isNotBlank(path)) {\n try {\n FilePath propertiesFile = new FilePath(workspace, path);\n propertiesFile.delete();\n } catch (Exception e) {\n throw new IOException(\"Could not delete temp file: \" + path);\n }\n }\n }", "public Token add( Variable variable ) {\n Token t = new Token(variable);\n push( t );\n return t;\n }", "public static int[] ConcatenateInt(List<int[]> arrays) {\n\n int size = 0;\n for (int i = 0; i < arrays.size(); i++) {\n size += arrays.get(i).length;\n }\n\n int[] all = new int[size];\n int idx = 0;\n\n for (int i = 0; i < arrays.size(); i++) {\n int[] v = arrays.get(i);\n for (int j = 0; j < v.length; j++) {\n all[idx++] = v[i];\n }\n }\n\n return all;\n }", "public 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}" ]
end AnchorImplementation class
[ "private void SetNewViewpoint(String url) {\n Viewpoint vp = null;\n // get the name without the '#' sign\n String vpURL = url.substring(1, url.length());\n for (Viewpoint viewpoint : viewpoints) {\n if ( viewpoint.getName().equalsIgnoreCase(vpURL) ) {\n vp = viewpoint;\n }\n }\n if ( vp != null ) {\n // found the Viewpoint matching the url\n GVRCameraRig mainCameraRig = gvrContext.getMainScene().getMainCameraRig();\n float[] cameraPosition = vp.getPosition();\n mainCameraRig.getTransform().setPosition( cameraPosition[0], cameraPosition[1], cameraPosition[2] );\n\n // Set the Gaze controller position which is where the pick ray\n // begins in the direction of camera.lookt()\n GVRCursorController gazeController = null;\n GVRInputManager inputManager = gvrContext.getInputManager();\n\n List<GVRCursorController> controllerList = inputManager.getCursorControllers();\n\n for(GVRCursorController controller: controllerList){\n if(controller.getControllerType() == GVRControllerType.GAZE);\n {\n gazeController = controller;\n break;\n }\n }\n if ( gazeController != null) {\n gazeController.setOrigin(cameraPosition[0], cameraPosition[1], cameraPosition[2]);\n }\n }\n else {\n Log.e(TAG, \"Viewpoint named \" + vpURL + \" not found (defined).\");\n }\n }" ]
[ "private String getResourceType(Resource resource)\n {\n String result;\n net.sf.mpxj.ResourceType type = resource.getType();\n if (type == null)\n {\n type = net.sf.mpxj.ResourceType.WORK;\n }\n\n switch (type)\n {\n case MATERIAL:\n {\n result = \"Material\";\n break;\n }\n\n case COST:\n {\n result = \"Nonlabor\";\n break;\n }\n\n default:\n {\n result = \"Labor\";\n break;\n }\n }\n\n return result;\n }", "@RequestMapping(value = \"/api/scripts\", method = RequestMethod.POST)\n public\n @ResponseBody\n Script addScript(Model model,\n @RequestParam(required = true) String name,\n @RequestParam(required = true) String script) throws Exception {\n\n return ScriptService.getInstance().addScript(name, script);\n }", "public void weeksChange(String week, Boolean value) {\n\n final WeekOfMonth changedWeek = WeekOfMonth.valueOf(week);\n boolean newValue = (null != value) && value.booleanValue();\n boolean currentValue = m_model.getWeeksOfMonth().contains(changedWeek);\n if (newValue != currentValue) {\n if (newValue) {\n setPatternScheme(true, false);\n m_model.addWeekOfMonth(changedWeek);\n onValueChange();\n } else {\n removeExceptionsOnChange(new Command() {\n\n public void execute() {\n\n m_model.removeWeekOfMonth(changedWeek);\n onValueChange();\n }\n });\n }\n }\n }", "public static netbridge_vlan_binding[] get(nitro_service service, String name) throws Exception{\n\t\tnetbridge_vlan_binding obj = new netbridge_vlan_binding();\n\t\tobj.set_name(name);\n\t\tnetbridge_vlan_binding response[] = (netbridge_vlan_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "public void setConvergence( int maxIterations , double ftol , double gtol ) {\n this.maxIterations = maxIterations;\n this.ftol = ftol;\n this.gtol = gtol;\n }", "public static auditsyslogpolicy_lbvserver_binding[] get(nitro_service service, String name) throws Exception{\n\t\tauditsyslogpolicy_lbvserver_binding obj = new auditsyslogpolicy_lbvserver_binding();\n\t\tobj.set_name(name);\n\t\tauditsyslogpolicy_lbvserver_binding response[] = (auditsyslogpolicy_lbvserver_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "private void processRemarks(Gantt gantt)\n {\n processRemarks(gantt.getRemarks());\n processRemarks(gantt.getRemarks1());\n processRemarks(gantt.getRemarks2());\n processRemarks(gantt.getRemarks3());\n processRemarks(gantt.getRemarks4());\n }", "public void setDefault() {\n try {\n TelephonyManager telephonyManager = (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);\n String phone = telephonyManager.getLine1Number();\n if (phone != null && !phone.isEmpty()) {\n this.setNumber(phone);\n } else {\n String iso = telephonyManager.getNetworkCountryIso();\n setEmptyDefault(iso);\n }\n } catch (SecurityException e) {\n setEmptyDefault();\n }\n }", "private boolean applyRemoteDomainModel(final List<ModelNode> bootOperations, final HostInfo hostInfo) {\n try {\n HostControllerLogger.ROOT_LOGGER.debug(\"Applying domain level boot operations provided by master\");\n SyncModelParameters parameters =\n new SyncModelParameters(domainController, ignoredDomainResourceRegistry,\n hostControllerEnvironment, extensionRegistry, operationExecutor, true, serverProxies, remoteFileRepository, contentRepository);\n final SyncDomainModelOperationHandler handler =\n new SyncDomainModelOperationHandler(hostInfo, parameters);\n final ModelNode operation = APPLY_DOMAIN_MODEL.clone();\n operation.get(DOMAIN_MODEL).set(bootOperations);\n\n final ModelNode result = operationExecutor.execute(OperationBuilder.create(operation).build(), OperationMessageHandler.DISCARD, ModelController.OperationTransactionControl.COMMIT, handler);\n\n final String outcome = result.get(OUTCOME).asString();\n final boolean success = SUCCESS.equals(outcome);\n\n // check if anything we synced triggered reload-required or restart-required.\n // if they did we log a warning on the synced slave.\n if (result.has(RESPONSE_HEADERS)) {\n final ModelNode headers = result.get(RESPONSE_HEADERS);\n if (headers.hasDefined(OPERATION_REQUIRES_RELOAD) && headers.get(OPERATION_REQUIRES_RELOAD).asBoolean()) {\n HostControllerLogger.ROOT_LOGGER.domainModelAppliedButReloadIsRequired();\n }\n if (headers.hasDefined(OPERATION_REQUIRES_RESTART) && headers.get(OPERATION_REQUIRES_RESTART).asBoolean()) {\n HostControllerLogger.ROOT_LOGGER.domainModelAppliedButRestartIsRequired();\n }\n }\n if (!success) {\n ModelNode failureDesc = result.hasDefined(FAILURE_DESCRIPTION) ? result.get(FAILURE_DESCRIPTION) : new ModelNode();\n HostControllerLogger.ROOT_LOGGER.failedToApplyDomainConfig(outcome, failureDesc);\n return false;\n } else {\n return true;\n }\n } catch (Exception e) {\n HostControllerLogger.ROOT_LOGGER.failedToApplyDomainConfig(e);\n return false;\n }\n }" ]
Transmits the SerialMessage to a single Z-Wave Node. Sets the transmission options as well. @param serialMessage the Serial message to send.
[ "public void sendData(SerialMessage serialMessage)\n\t{\n \tif (serialMessage.getMessageClass() != SerialMessage.SerialMessageClass.SendData) {\n \t\tlogger.error(String.format(\"Invalid message class %s (0x%02X) for sendData\", serialMessage.getMessageClass().getLabel(), serialMessage.getMessageClass().getKey()));\n \t\treturn;\n \t}\n \tif (serialMessage.getMessageType() != SerialMessage.SerialMessageType.Request) {\n \t\tlogger.error(\"Only request messages can be sent\");\n \t\treturn;\n \t}\n \t\n \tZWaveNode node = this.getNode(serialMessage.getMessageNode());\n \t\t\t\n \tif (node.getNodeStage() == NodeStage.NODEBUILDINFO_DEAD) {\n \t\tlogger.debug(\"Node {} is dead, not sending message.\", node.getNodeId());\n\t\t\treturn;\n \t}\n\t\t\n \tif (!node.isListening() && serialMessage.getPriority() != SerialMessage.SerialMessagePriority.Low) {\n\t\t\tZWaveWakeUpCommandClass wakeUpCommandClass = (ZWaveWakeUpCommandClass)node.getCommandClass(ZWaveCommandClass.CommandClass.WAKE_UP);\n\t\t\t\n\t\t\tif (wakeUpCommandClass != null && !wakeUpCommandClass.isAwake()) {\n\t\t\t\twakeUpCommandClass.putInWakeUpQueue(serialMessage); //it's a battery operated device, place in wake-up queue.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n \t\n \tserialMessage.setTransmitOptions(TRANSMIT_OPTION_ACK | TRANSMIT_OPTION_AUTO_ROUTE | TRANSMIT_OPTION_EXPLORE);\n \tif (++sentDataPointer > 0xFF)\n \t\tsentDataPointer = 1;\n \tserialMessage.setCallbackId(sentDataPointer);\n \tlogger.debug(\"Callback ID = {}\", sentDataPointer);\n \tthis.enqueue(serialMessage);\n\t}" ]
[ "@SuppressWarnings(\"unchecked\")\r\n public static <E> E[] filter(E[] elems, Filter<E> filter) {\r\n List<E> filtered = new ArrayList<E>();\r\n for (E elem: elems) {\r\n if (filter.accept(elem)) {\r\n filtered.add(elem);\r\n }\r\n }\r\n return (filtered.toArray((E[]) Array.newInstance(elems.getClass().getComponentType(), filtered.size())));\r\n }", "public SignedJWT verifyToken(String jwtString) throws ParseException {\n try {\n SignedJWT jwt = SignedJWT.parse(jwtString);\n if (jwt.verify(new MACVerifier(this.jwtSharedSecret))) {\n return jwt;\n }\n return null;\n } catch (JOSEException e) {\n throw new RuntimeException(\"Error verifying JSON Web Token\", e);\n }\n }", "public String getAccuracyDescription(int numDigits) {\r\n NumberFormat nf = NumberFormat.getNumberInstance();\r\n nf.setMaximumFractionDigits(numDigits);\r\n Triple<Double, Integer, Integer> accu = getAccuracyInfo();\r\n return nf.format(accu.first()) + \" (\" + accu.second() + \"/\" + (accu.second() + accu.third()) + \")\";\r\n }", "public Enumeration getPKEnumerationByQuery(Class primaryKeyClass, Query query) throws PersistenceBrokerException\n {\n if (logger.isDebugEnabled()) logger.debug(\"getPKEnumerationByQuery \" + query);\n\n query.setFetchSize(1);\n ClassDescriptor cld = getClassDescriptor(query.getSearchClass());\n return new PkEnumeration(query, cld, primaryKeyClass, this);\n }", "public void initialize(BinaryPackageControlFile packageControlFile) {\n set(\"Binary\", packageControlFile.get(\"Package\"));\n set(\"Source\", Utils.defaultString(packageControlFile.get(\"Source\"), packageControlFile.get(\"Package\")));\n set(\"Architecture\", packageControlFile.get(\"Architecture\"));\n set(\"Version\", packageControlFile.get(\"Version\"));\n set(\"Maintainer\", packageControlFile.get(\"Maintainer\"));\n set(\"Changed-By\", packageControlFile.get(\"Maintainer\"));\n set(\"Distribution\", packageControlFile.get(\"Distribution\"));\n\n for (Entry<String, String> entry : packageControlFile.getUserDefinedFields().entrySet()) {\n set(entry.getKey(), entry.getValue());\n }\n\n StringBuilder description = new StringBuilder();\n description.append(packageControlFile.get(\"Package\"));\n if (packageControlFile.get(\"Description\") != null) {\n description.append(\" - \");\n description.append(packageControlFile.getShortDescription());\n }\n set(\"Description\", description.toString());\n }", "private static String getColumnTitle(final PropertyDescriptor _property) {\n final StringBuilder buffer = new StringBuilder();\n final String name = _property.getName();\n buffer.append(Character.toUpperCase(name.charAt(0)));\n for (int i = 1; i < name.length(); i++) {\n final char c = name.charAt(i);\n if (Character.isUpperCase(c)) {\n buffer.append(' ');\n }\n buffer.append(c);\n }\n return buffer.toString();\n }", "public static AnnotationNode getAnnotation(AnnotatedNode node, String name) {\r\n List<AnnotationNode> annotations = node.getAnnotations();\r\n for (AnnotationNode annot : annotations) {\r\n if (annot.getClassNode().getName().equals(name)) {\r\n return annot;\r\n }\r\n }\r\n return null;\r\n }", "private List<ExpandableWrapper<P, C>> generateFlattenedParentChildList(List<P> parentList, Map<P, Boolean> savedLastExpansionState) {\n List<ExpandableWrapper<P, C>> flatItemList = new ArrayList<>();\n\n int parentCount = parentList.size();\n for (int i = 0; i < parentCount; i++) {\n P parent = parentList.get(i);\n Boolean lastExpandedState = savedLastExpansionState.get(parent);\n boolean shouldExpand = lastExpandedState == null ? parent.isInitiallyExpanded() : lastExpandedState;\n\n generateParentWrapper(flatItemList, parent, shouldExpand);\n }\n\n return flatItemList;\n }", "private String convertOutputToHtml(String content) {\n\n if (content.length() == 0) {\n return \"\";\n }\n StringBuilder buffer = new StringBuilder();\n for (String line : content.split(\"\\n\")) {\n buffer.append(CmsEncoder.escapeXml(line) + \"<br>\");\n }\n return buffer.toString();\n }" ]
Obtains a Julian local date-time from another date-time object. @param temporal the date-time object to convert, not null @return the Julian local date-time, not null @throws DateTimeException if unable to create the date-time
[ "@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoLocalDateTime<JulianDate> localDateTime(TemporalAccessor temporal) {\n return (ChronoLocalDateTime<JulianDate>) super.localDateTime(temporal);\n }" ]
[ "private static MessageInfo mapMessageInfo(MessageInfoType messageInfoType) {\n MessageInfo messageInfo = new MessageInfo();\n if (messageInfoType != null) {\n messageInfo.setFlowId(messageInfoType.getFlowId());\n messageInfo.setMessageId(messageInfoType.getMessageId());\n messageInfo.setOperationName(messageInfoType.getOperationName());\n messageInfo.setPortType(messageInfoType.getPorttype() == null\n ? \"\" : messageInfoType.getPorttype().toString());\n messageInfo.setTransportType(messageInfoType.getTransport());\n }\n return messageInfo;\n }", "@SuppressWarnings(\"WeakerAccess\")\n public ByteBuffer getRawData() {\n if (rawData != null) {\n rawData.rewind();\n return rawData.slice();\n }\n return null;\n }", "public void prepare(Properties p, Connection cnx)\n {\n this.tablePrefix = p.getProperty(\"com.enioka.jqm.jdbc.tablePrefix\", \"\");\n queries.putAll(DbImplBase.queries);\n for (Map.Entry<String, String> entry : DbImplBase.queries.entrySet())\n {\n queries.put(entry.getKey(), this.adaptSql(entry.getValue()));\n }\n }", "protected Object getObjectFromResultSet() throws PersistenceBrokerException\r\n {\r\n\r\n try\r\n {\r\n // if all primitive attributes of the object are contained in the ResultSet\r\n // the fast direct mapping can be used\r\n return super.getObjectFromResultSet();\r\n }\r\n // if the full loading failed we assume that at least PK attributes are contained\r\n // in the ResultSet and perform a slower Identity based loading...\r\n // This may of course also fail and can throw another PersistenceBrokerException\r\n catch (PersistenceBrokerException e)\r\n {\r\n Identity oid = getIdentityFromResultSet();\r\n return getBroker().getObjectByIdentity(oid);\r\n }\r\n\r\n }", "private Duration getDuration(String value)\n {\n Duration result = null;\n\n if (value != null && value.length() != 0)\n {\n double seconds = getLong(value);\n double hours = seconds / (60 * 60);\n double days = hours / 8;\n\n if (days < 1)\n {\n result = Duration.getInstance(hours, TimeUnit.HOURS);\n }\n else\n {\n double durationDays = hours / 8;\n result = Duration.getInstance(durationDays, TimeUnit.DAYS);\n }\n }\n\n return (result);\n }", "static void initSingleParam(String key, String initValue, DbConn cnx)\n {\n try\n {\n cnx.runSelectSingle(\"globalprm_select_by_key\", 2, String.class, key);\n return;\n }\n catch (NoResultException e)\n {\n GlobalParameter.create(cnx, key, initValue);\n }\n catch (NonUniqueResultException e)\n {\n // It exists! Nothing to do...\n }\n }", "public static byte[] toUnixLineEndings( InputStream input ) throws IOException {\n String encoding = \"ISO-8859-1\";\n FixCrLfFilter filter = new FixCrLfFilter(new InputStreamReader(input, encoding));\n filter.setEol(FixCrLfFilter.CrLf.newInstance(\"unix\"));\n\n ByteArrayOutputStream filteredFile = new ByteArrayOutputStream();\n Utils.copy(new ReaderInputStream(filter, encoding), filteredFile);\n\n return filteredFile.toByteArray();\n }", "private static char[] buildTable() {\n char[] table = new char[26];\n for (int ix = 0; ix < table.length; ix++)\n table[ix] = '0';\n table['B' - 'A'] = '1';\n table['P' - 'A'] = '1';\n table['F' - 'A'] = '1';\n table['V' - 'A'] = '1';\n table['C' - 'A'] = '2';\n table['S' - 'A'] = '2';\n table['K' - 'A'] = '2';\n table['G' - 'A'] = '2';\n table['J' - 'A'] = '2';\n table['Q' - 'A'] = '2';\n table['X' - 'A'] = '2';\n table['Z' - 'A'] = '2';\n table['D' - 'A'] = '3';\n table['T' - 'A'] = '3';\n table['L' - 'A'] = '4';\n table['M' - 'A'] = '5';\n table['N' - 'A'] = '5';\n table['R' - 'A'] = '6';\n return table;\n }", "private CmsXmlContent unmarshalXmlContent(CmsFile file) throws CmsXmlException {\n\n CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file);\n content.setAutoCorrectionEnabled(true);\n content.correctXmlStructure(m_cms);\n\n return content;\n }" ]
Sets a custom response on an endpoint using default profile and client @param pathValue path (endpoint) value @param requestType path request type. "GET", "POST", etc @param customData custom response data @return true if success, false otherwise
[ "public static boolean setDefaultCustomResponse(String pathValue, String requestType, String customData) {\n try {\n JSONObject profile = getDefaultProfile();\n String profileName = profile.getString(\"name\");\n PathValueClient client = new PathValueClient(profileName, false);\n return client.setCustomResponse(pathValue, requestType, customData);\n } catch (Exception e) {\n e.printStackTrace();\n }\n return false;\n }" ]
[ "private void writeResources() throws IOException\n {\n writeAttributeTypes(\"resource_types\", ResourceField.values());\n\n m_writer.writeStartList(\"resources\");\n for (Resource resource : m_projectFile.getResources())\n {\n writeFields(null, resource, ResourceField.values());\n }\n m_writer.writeEndList();\n }", "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 }", "private void readNetscapeExt() {\n do {\n readBlock();\n if (block[0] == 1) {\n // Loop count sub-block.\n int b1 = ((int) block[1]) & 0xff;\n int b2 = ((int) block[2]) & 0xff;\n header.loopCount = (b2 << 8) | b1;\n if(header.loopCount == 0) {\n header.loopCount = GifDecoder.LOOP_FOREVER;\n }\n }\n } while ((blockSize > 0) && !err());\n }", "public void printInterceptorChain(InterceptorChain chain) {\n Iterator<Interceptor<? extends Message>> it = chain.iterator();\n String phase = \"\";\n StringBuilder builder = null;\n while (it.hasNext()) {\n Interceptor<? extends Message> interceptor = it.next();\n if (interceptor instanceof DemoInterceptor) {\n continue;\n }\n if (interceptor instanceof PhaseInterceptor) {\n PhaseInterceptor pi = (PhaseInterceptor)interceptor;\n if (!phase.equals(pi.getPhase())) {\n if (builder != null) {\n System.out.println(builder.toString());\n } else {\n builder = new StringBuilder(100);\n }\n builder.setLength(0);\n builder.append(\" \");\n builder.append(pi.getPhase());\n builder.append(\": \");\n phase = pi.getPhase();\n }\n String id = pi.getId();\n int idx = id.lastIndexOf('.');\n if (idx != -1) {\n id = id.substring(idx + 1);\n }\n builder.append(id);\n builder.append(' ');\n }\n }\n\n }", "private Envelope getMaxScreenEnvelope(InternalTile tile, Coordinate panOrigin) {\n\t\tint nrOfTilesX = Math.max(1, MAXIMUM_TILE_COORDINATE / tile.getScreenWidth());\n\t\tint nrOfTilesY = Math.max(1, MAXIMUM_TILE_COORDINATE / tile.getScreenHeight());\n\n\t\tdouble x1 = panOrigin.x - nrOfTilesX * tile.getTileWidth();\n\t\t// double x2 = x1 + (nrOfTilesX * tileWidth * 2);\n\t\tdouble x2 = panOrigin.x + nrOfTilesX * tile.getTileWidth();\n\t\tdouble y1 = panOrigin.y - nrOfTilesY * tile.getTileHeight();\n\t\t// double y2 = y1 + (nrOfTilesY * tileHeight * 2);\n\t\tdouble y2 = panOrigin.y + nrOfTilesY * tile.getTileHeight();\n\t\treturn new Envelope(x1, x2, y1, y2);\n\t}", "public static<T> Vendor<T> vendor(Callable<T> f) {\n\treturn j.vendor(f);\n }", "public ItemRequest<Section> findById(String section) {\n \n String path = String.format(\"/sections/%s\", section);\n return new ItemRequest<Section>(this, Section.class, path, \"GET\");\n }", "protected FieldDescriptor resolvePayloadField(Message message) {\n for (FieldDescriptor field : message.getDescriptorForType().getFields()) {\n if (message.hasField(field)) {\n return field;\n }\n }\n\n throw new RuntimeException(\"No payload found in message \" + message);\n }", "public void forceApply(String conflictResolution) {\n\n URL url = FORCE_METADATA_CASCADE_POLICIES_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, \"POST\");\n JsonObject requestJSON = new JsonObject()\n .add(\"conflict_resolution\", conflictResolution);\n request.setBody(requestJSON.toString());\n request.send();\n }" ]
Use this API to fetch autoscalepolicy_binding resource of given name .
[ "public static autoscalepolicy_binding get(nitro_service service, String name) throws Exception{\n\t\tautoscalepolicy_binding obj = new autoscalepolicy_binding();\n\t\tobj.set_name(name);\n\t\tautoscalepolicy_binding response = (autoscalepolicy_binding) obj.get_resource(service);\n\t\treturn response;\n\t}" ]
[ "public static Shell createSubshell(String pathElement, Shell parent, String appName, Object mainHandler) {\n return createSubshell(pathElement, parent, appName, mainHandler, new EmptyMultiMap<String, Object>());\n }", "public void addPieSlice(PieModel _Slice) {\n highlightSlice(_Slice);\n mPieData.add(_Slice);\n mTotalValue += _Slice.getValue();\n onDataChanged();\n }", "@PreDestroy\n public final void shutdown() {\n this.timer.shutdownNow();\n this.executor.shutdownNow();\n if (this.cleanUpTimer != null) {\n this.cleanUpTimer.shutdownNow();\n }\n }", "public static Cluster getCluster(ZkClient zkClient) {\n Cluster cluster = new Cluster();\n List<String> nodes = getChildrenParentMayNotExist(zkClient, BrokerIdsPath);\n for (String node : nodes) {\n final String brokerInfoString = readData(zkClient, BrokerIdsPath + \"/\" + node);\n cluster.add(Broker.createBroker(Integer.valueOf(node), brokerInfoString));\n }\n return cluster;\n }", "private boolean containsValue(StatementGroup statementGroup, Value value) {\n\t\tfor (Statement s : statementGroup) {\n\t\t\tif (value.equals(s.getValue())) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "private boolean ignoreMethod(String name)\n {\n boolean result = false;\n\n for (String ignoredName : IGNORED_METHODS)\n {\n if (name.matches(ignoredName))\n {\n result = true;\n break;\n }\n }\n\n return result;\n }", "public int getModifiers() {\n MetaMethod getter = getGetter();\n MetaMethod setter = getSetter();\n if (setter != null && getter == null) return setter.getModifiers();\n if (getter != null && setter == null) return getter.getModifiers();\n int modifiers = getter.getModifiers() | setter.getModifiers();\n int visibility = 0;\n if (Modifier.isPublic(modifiers)) visibility = Modifier.PUBLIC;\n if (Modifier.isProtected(modifiers)) visibility = Modifier.PROTECTED;\n if (Modifier.isPrivate(modifiers)) visibility = Modifier.PRIVATE;\n int states = getter.getModifiers() & setter.getModifiers();\n states &= ~(Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE);\n states |= visibility;\n return states;\n }", "protected void processStop(Endpoint endpoint, EventTypeEnum eventType) {\n if (!sendLifecycleEvent) {\n return;\n }\n\n Event event = createEvent(endpoint, eventType);\n monitoringServiceClient.putEvents(Collections.singletonList(event));\n if (LOG.isLoggable(Level.INFO)) {\n LOG.info(\"Send \" + eventType + \" event to SAM Server successful!\");\n }\n }", "public void writeNameValuePair(String name, long value) throws IOException\n {\n internalWriteNameValuePair(name, Long.toString(value));\n }" ]
Updates the font table by adding new fonts used at the current page.
[ "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 }" ]
[ "protected void readUUID(StreamReader stream, Map<String, Object> map) throws IOException\n {\n int unknown0Size = stream.getMajorVersion() > 5 ? 8 : 16;\n map.put(\"UNKNOWN0\", stream.readBytes(unknown0Size));\n map.put(\"UUID\", stream.readUUID()); \n }", "void writeSomeValueRestriction(String propertyUri, String rangeUri,\n\t\t\tResource bnode) throws RDFHandlerException {\n\t\tthis.rdfWriter.writeTripleValueObject(bnode, RdfWriter.RDF_TYPE,\n\t\t\t\tRdfWriter.OWL_RESTRICTION);\n\t\tthis.rdfWriter.writeTripleUriObject(bnode, RdfWriter.OWL_ON_PROPERTY,\n\t\t\t\tpropertyUri);\n\t\tthis.rdfWriter.writeTripleUriObject(bnode,\n\t\t\t\tRdfWriter.OWL_SOME_VALUES_FROM, rangeUri);\n\t}", "public EventBus emitAsync(EventObject event, Object... args) {\n return _emitWithOnceBus(eventContextAsync(event, args));\n }", "public ImmutableMap<String, String> getConfigurationTweak(String dbModuleName)\n {\n final DbInfo db = cluster.getNextDb();\n return ImmutableMap.of(\"ness.db.\" + dbModuleName + \".uri\", getJdbcUri(db),\n \"ness.db.\" + dbModuleName + \".ds.user\", db.user);\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 static ServiceController<InstallationManager> installService(ServiceTarget serviceTarget) {\n final InstallationManagerService service = new InstallationManagerService();\n return serviceTarget.addService(InstallationManagerService.NAME, service)\n .addDependency(JBOSS_PRODUCT_CONFIG_SERVICE, ProductConfig.class, service.productConfig)\n .setInitialMode(ServiceController.Mode.ACTIVE)\n .install();\n }", "public int refresh(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException {\n\t\tif (mappedRefresh == null) {\n\t\t\tmappedRefresh = MappedRefresh.build(dao, tableInfo);\n\t\t}\n\t\treturn mappedRefresh.executeRefresh(databaseConnection, data, objectCache);\n\t}", "public DomainList getPhotostreamDomains(Date date, int perPage, int page) throws FlickrException {\n return getDomains(METHOD_GET_PHOTOSTREAM_DOMAINS, null, null, date, perPage, page);\n\n }", "public synchronized void stopDebugServer() {\n if (mDebugServer == null) {\n Log.e(TAG, \"Debug server is not running.\");\n return;\n }\n\n mDebugServer.shutdown();\n mDebugServer = null;\n }" ]
Return an input stream to read the data from the named table. @param name table name @return InputStream instance @throws IOException
[ "public StreamReader getTableData(String name) throws IOException\n {\n InputStream stream = new ByteArrayInputStream(m_tableData.get(name));\n if (m_majorVersion > 5)\n { \n byte[] header = new byte[24];\n stream.read(header);\n SynchroLogger.log(\"TABLE HEADER\", header);\n }\n return new StreamReader(m_majorVersion, stream);\n }" ]
[ "protected static void checkQueues(final Iterable<String> queues) {\n if (queues == null) {\n throw new IllegalArgumentException(\"queues must not be null\");\n }\n for (final String queue : queues) {\n if (queue == null || \"\".equals(queue)) {\n throw new IllegalArgumentException(\"queues' members must not be null: \" + queues);\n }\n }\n }", "public static nsspparams get(nitro_service service) throws Exception{\n\t\tnsspparams obj = new nsspparams();\n\t\tnsspparams[] response = (nsspparams[])obj.get_resources(service);\n\t\treturn response[0];\n\t}", "public String getLinkCopyText(JSONObject jsonObject){\n if(jsonObject == null) return \"\";\n try {\n JSONObject copyObject = jsonObject.has(\"copyText\") ? jsonObject.getJSONObject(\"copyText\") : null;\n if(copyObject != null){\n return copyObject.has(\"text\") ? copyObject.getString(\"text\") : \"\";\n }else{\n return \"\";\n }\n } catch (JSONException e) {\n Logger.v(\"Unable to get Link Text with JSON - \"+e.getLocalizedMessage());\n return \"\";\n }\n }", "public Date getStartDate()\n {\n Date startDate = null;\n\n for (Task task : m_tasks)\n {\n //\n // If a hidden \"summary\" task is present we ignore it\n //\n if (NumberHelper.getInt(task.getUniqueID()) == 0)\n {\n continue;\n }\n\n //\n // Select the actual or forecast start date. Note that the\n // behaviour is different for milestones. The milestone end date\n // is always correct, the milestone start date may be different\n // to reflect a missed deadline.\n //\n Date taskStartDate;\n if (task.getMilestone() == true)\n {\n taskStartDate = task.getActualFinish();\n if (taskStartDate == null)\n {\n taskStartDate = task.getFinish();\n }\n }\n else\n {\n taskStartDate = task.getActualStart();\n if (taskStartDate == null)\n {\n taskStartDate = task.getStart();\n }\n }\n\n if (taskStartDate != null)\n {\n if (startDate == null)\n {\n startDate = taskStartDate;\n }\n else\n {\n if (taskStartDate.getTime() < startDate.getTime())\n {\n startDate = taskStartDate;\n }\n }\n }\n }\n\n return (startDate);\n }", "public static <T> T get(String key, Class<T> clz) {\n return (T)m().get(key);\n }", "private TaskField getTaskField(int field)\n {\n TaskField result = MPPTaskField14.getInstance(field);\n\n if (result != null)\n {\n switch (result)\n {\n case START_TEXT:\n {\n result = TaskField.START;\n break;\n }\n\n case FINISH_TEXT:\n {\n result = TaskField.FINISH;\n break;\n }\n\n case DURATION_TEXT:\n {\n result = TaskField.DURATION;\n break;\n }\n\n default:\n {\n break;\n }\n }\n }\n\n return result;\n }", "public static boolean isMessageContentToBeLogged(final Message message, final boolean logMessageContent,\n boolean logMessageContentOverride) {\n\n /*\n * If controlling of logging behavior is not allowed externally\n * then log according to global property value\n */\n if (!logMessageContentOverride) {\n return logMessageContent;\n }\n\n Object logMessageContentExtObj = message.getContextualProperty(EXTERNAL_PROPERTY_NAME);\n\n if (null == logMessageContentExtObj) {\n\n return logMessageContent;\n\n } else if (logMessageContentExtObj instanceof Boolean) {\n\n return ((Boolean) logMessageContentExtObj).booleanValue();\n\n } else if (logMessageContentExtObj instanceof String) {\n\n String logMessageContentExtVal = (String) logMessageContentExtObj;\n\n if (logMessageContentExtVal.equalsIgnoreCase(\"true\")) {\n\n return true;\n\n } else if (logMessageContentExtVal.equalsIgnoreCase(\"false\")) {\n\n return false;\n\n } else {\n\n return logMessageContent;\n }\n } else {\n\n return logMessageContent;\n }\n }", "private ProjectFile readDatabaseFile(InputStream inputStream) throws MPXJException\n {\n ProjectReader reader = new AstaDatabaseFileReader();\n addListeners(reader);\n return reader.read(inputStream);\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 }" ]
Adds a shutdown hook for the process. @param process the process to add a shutdown hook for @return the thread set as the shutdown hook @throws java.lang.SecurityException If a security manager is present and it denies {@link java.lang.RuntimePermission <code>RuntimePermission("shutdownHooks")</code>}
[ "public static Thread addShutdownHook(final Process process) {\n final Thread thread = new Thread(new Runnable() {\n @Override\n public void run() {\n if (process != null) {\n process.destroy();\n try {\n process.waitFor();\n } catch (InterruptedException e) {\n throw new RuntimeException(e);\n }\n }\n }\n });\n thread.setDaemon(true);\n Runtime.getRuntime().addShutdownHook(thread);\n return thread;\n }" ]
[ "private GenericCriteriaPrompt getPromptValue(FieldType field, byte[] block)\n {\n int textOffset = getPromptOffset(block);\n String value = MPPUtility.getUnicodeString(m_criteriaData, m_criteriaTextStart + textOffset);\n GenericCriteriaPrompt prompt = new GenericCriteriaPrompt(field.getDataType(), value);\n if (m_prompts != null)\n {\n m_prompts.add(prompt);\n }\n return prompt;\n }", "public static base_responses update(nitro_service client, nsacl6 resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tnsacl6 updateresources[] = new nsacl6[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tupdateresources[i] = new nsacl6();\n\t\t\t\tupdateresources[i].acl6name = resources[i].acl6name;\n\t\t\t\tupdateresources[i].aclaction = resources[i].aclaction;\n\t\t\t\tupdateresources[i].srcipv6 = resources[i].srcipv6;\n\t\t\t\tupdateresources[i].srcipop = resources[i].srcipop;\n\t\t\t\tupdateresources[i].srcipv6val = resources[i].srcipv6val;\n\t\t\t\tupdateresources[i].srcport = resources[i].srcport;\n\t\t\t\tupdateresources[i].srcportop = resources[i].srcportop;\n\t\t\t\tupdateresources[i].srcportval = resources[i].srcportval;\n\t\t\t\tupdateresources[i].destipv6 = resources[i].destipv6;\n\t\t\t\tupdateresources[i].destipop = resources[i].destipop;\n\t\t\t\tupdateresources[i].destipv6val = resources[i].destipv6val;\n\t\t\t\tupdateresources[i].destport = resources[i].destport;\n\t\t\t\tupdateresources[i].destportop = resources[i].destportop;\n\t\t\t\tupdateresources[i].destportval = resources[i].destportval;\n\t\t\t\tupdateresources[i].srcmac = resources[i].srcmac;\n\t\t\t\tupdateresources[i].protocol = resources[i].protocol;\n\t\t\t\tupdateresources[i].protocolnumber = resources[i].protocolnumber;\n\t\t\t\tupdateresources[i].icmptype = resources[i].icmptype;\n\t\t\t\tupdateresources[i].icmpcode = resources[i].icmpcode;\n\t\t\t\tupdateresources[i].vlan = resources[i].vlan;\n\t\t\t\tupdateresources[i].Interface = resources[i].Interface;\n\t\t\t\tupdateresources[i].priority = resources[i].priority;\n\t\t\t\tupdateresources[i].established = resources[i].established;\n\t\t\t}\n\t\t\tresult = update_bulk_request(client, updateresources);\n\t\t}\n\t\treturn result;\n\t}", "private static Bitmap crop(Bitmap srcBmp, View canvasView, int downsampling) {\n float scale = 1f / downsampling;\n return Bitmap.createBitmap(\n srcBmp,\n (int) Math.floor((ViewCompat.getX(canvasView)) * scale),\n (int) Math.floor((ViewCompat.getY(canvasView)) * scale),\n (int) Math.floor((canvasView.getWidth()) * scale),\n (int) Math.floor((canvasView.getHeight()) * scale)\n );\n }", "public ItemRequest<User> findById(String user) {\n \n String path = String.format(\"/users/%s\", user);\n return new ItemRequest<User>(this, User.class, path, \"GET\");\n }", "private void processPredecessor(Task task, MapRow row)\n {\n Task predecessor = m_taskMap.get(row.getUUID(\"PREDECESSOR_UUID\"));\n if (predecessor != null)\n {\n task.addPredecessor(predecessor, row.getRelationType(\"RELATION_TYPE\"), row.getDuration(\"LAG\"));\n }\n }", "public DbLicense resolve(final String licenseId) {\n\n for (final Entry<String, DbLicense> regexp : licensesRegexp.entrySet()) {\n try {\n if (licenseId.matches(regexp.getKey())) {\n return regexp.getValue();\n }\n } catch (PatternSyntaxException e) {\n LOG.error(\"Wrong pattern for the following license \" + regexp.getValue().getName(), e);\n continue;\n }\n }\n\n if(LOG.isWarnEnabled()) {\n LOG.warn(String.format(\"No matching pattern for license %s\", licenseId));\n }\n return null;\n }", "public List<Throwable> getCauses(Throwable t)\n {\n List<Throwable> causes = new LinkedList<Throwable>();\n Throwable next = t;\n while (next.getCause() != null)\n {\n next = next.getCause();\n causes.add(next);\n }\n return causes;\n }", "private ImmutableList<Element> getNodeListForTagElement(Document dom,\n\t\t\tCrawlElement crawlElement,\n\t\t\tEventableConditionChecker eventableConditionChecker) {\n\n\t\tBuilder<Element> result = ImmutableList.builder();\n\n\t\tif (crawlElement.getTagName() == null) {\n\t\t\treturn result.build();\n\t\t}\n\n\t\tEventableCondition eventableCondition =\n\t\t\t\teventableConditionChecker.getEventableCondition(crawlElement.getId());\n\t\t// TODO Stefan; this part of the code should be re-factored, Hack-ed it this way to prevent\n\t\t// performance problems.\n\t\tImmutableList<String> expressions = getFullXpathForGivenXpath(dom, eventableCondition);\n\n\t\tNodeList nodeList = dom.getElementsByTagName(crawlElement.getTagName());\n\n\t\tfor (int k = 0; k < nodeList.getLength(); k++) {\n\n\t\t\tElement element = (Element) nodeList.item(k);\n\t\t\tboolean matchesXpath =\n\t\t\t\t\telementMatchesXpath(eventableConditionChecker, eventableCondition,\n\t\t\t\t\t\t\texpressions, element);\n\t\t\tLOG.debug(\"Element {} matches Xpath={}\", DomUtils.getElementString(element),\n\t\t\t\t\tmatchesXpath);\n\t\t\t/*\n\t\t\t * TODO Stefan This is a possible Thread-Interleaving problem, as / isChecked can return\n\t\t\t * false and when needed to add it can return true. / check if element is a candidate\n\t\t\t */\n\t\t\tString id = element.getNodeName() + \": \" + DomUtils.getAllElementAttributes(element);\n\t\t\tif (matchesXpath && !checkedElements.isChecked(id)\n\t\t\t\t\t&& !isExcluded(dom, element, eventableConditionChecker)) {\n\t\t\t\taddElement(element, result, crawlElement);\n\t\t\t} else {\n\t\t\t\tLOG.debug(\"Element {} was not added\", element);\n\t\t\t}\n\t\t}\n\t\treturn result.build();\n\t}", "public void strokeRectangle(Rectangle rect, Color color, float linewidth) {\n\t\tstrokeRectangle(rect, color, linewidth, null);\n\t}" ]
Copy the contents of this buffer begginning from the srcOffset to a destination byte array @param srcOffset @param destArray @param destOffset @param size
[ "public void copyTo(int srcOffset, byte[] destArray, int destOffset, int size) {\n int cursor = destOffset;\n for (ByteBuffer bb : toDirectByteBuffers(srcOffset, size)) {\n int bbSize = bb.remaining();\n if ((cursor + bbSize) > destArray.length)\n throw new ArrayIndexOutOfBoundsException(String.format(\"cursor + bbSize = %,d\", cursor + bbSize));\n bb.get(destArray, cursor, bbSize);\n cursor += bbSize;\n }\n }" ]
[ "private static int getPort(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.getPort();\n }\n return 0;\n }", "public static sslocspresponder get(nitro_service service, String name) throws Exception{\n\t\tsslocspresponder obj = new sslocspresponder();\n\t\tobj.set_name(name);\n\t\tsslocspresponder response = (sslocspresponder) obj.get_resource(service);\n\t\treturn response;\n\t}", "public void setDiffuseIntensity(float r, float g, float b, float a) {\n setVec4(\"diffuse_intensity\", r, g, b, a);\n }", "public void bind(T service, Map<String, Object> props) {\n synchronized (serviceMap) {\n serviceMap.put(ServiceUtil.getComparableForServiceRanking(props), service);\n updateSortedServices();\n }\n }", "public void prepareStatus() {\n globalLineCounter = new AtomicLong(0);\n time = new AtomicLong(System.currentTimeMillis());\n startTime = System.currentTimeMillis();\n lastCount = 0;\n\n // Status thread regularly reports on what is happening\n Thread statusThread = new Thread() {\n public void run() {\n while (true) {\n try {\n Thread.sleep(1000);\n } catch (InterruptedException e) {\n System.out.println(\"Status thread interrupted\");\n }\n\n long thisTime = System.currentTimeMillis();\n long currentCount = globalLineCounter.get();\n\n if (thisTime - time.get() > 1000) {\n long oldTime = time.get();\n time.set(thisTime);\n double avgRate = 1000.0 * currentCount / (thisTime - startTime);\n double instRate = 1000.0 * (currentCount - lastCount) / (thisTime - oldTime);\n lastCount = currentCount;\n System.out.println(currentCount + \" AvgRage:\" + ((int) avgRate) + \" lines/sec instRate:\"\n + ((int) instRate) + \" lines/sec Unassigned Work: \"\n + remainingBlocks.get() + \" blocks\");\n }\n }\n }\n };\n statusThread.start();\n }", "public static <T> void addAll(Collection<T> collection, Iterable<? extends T> items) {\r\n for (T item : items) {\r\n collection.add(item);\r\n }\r\n }", "@Deprecated\n private static ListAttributeDefinition wrapAsList(final AttributeDefinition def) {\n final ListAttributeDefinition list = new ListAttributeDefinition(new SimpleListAttributeDefinition.Builder(def.getName(), def)\n .setElementValidator(def.getValidator())) {\n\n\n @Override\n public ModelNode getNoTextDescription(boolean forOperation) {\n final ModelNode model = super.getNoTextDescription(forOperation);\n setValueType(model);\n return model;\n }\n\n @Override\n protected void addValueTypeDescription(final ModelNode node, final ResourceBundle bundle) {\n setValueType(node);\n }\n\n @Override\n public void marshallAsElement(final ModelNode resourceModel, final boolean marshalDefault, final XMLStreamWriter writer) throws XMLStreamException {\n throw new RuntimeException();\n }\n\n @Override\n protected void addAttributeValueTypeDescription(ModelNode node, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle) {\n setValueType(node);\n }\n\n @Override\n protected void addOperationParameterValueTypeDescription(ModelNode node, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle) {\n setValueType(node);\n }\n\n private void setValueType(ModelNode node) {\n node.get(ModelDescriptionConstants.VALUE_TYPE).set(ModelType.STRING);\n }\n };\n return list;\n }", "protected String getExecutableJar() throws IOException {\n Manifest manifest = new Manifest();\n manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, \"1.0\");\n manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, MAIN);\n manifest.getMainAttributes().put(Attributes.Name.CLASS_PATH, getClasspath());\n\n Path jar = createTempDirectory(\"exec\").resolve(\"generate.jar\");\n try (JarOutputStream output = new JarOutputStream(Files.newOutputStream(jar), manifest)) {\n output.putNextEntry(new JarEntry(\"allure.properties\"));\n Path allureConfig = PROPERTIES.getAllureConfig();\n if (Files.exists(allureConfig)) {\n byte[] bytes = Files.readAllBytes(allureConfig);\n output.write(bytes);\n }\n output.closeEntry();\n }\n\n return jar.toAbsolutePath().toString();\n }", "public static vlan get(nitro_service service, Long id) throws Exception{\n\t\tvlan obj = new vlan();\n\t\tobj.set_id(id);\n\t\tvlan response = (vlan) obj.get_resource(service);\n\t\treturn response;\n\t}" ]
Pops the top event off the current event stack. This action has to be performed immediately after the event has been dispatched to all listeners. @param <L> Type of the listener. @param expected The Event which is expected at the top of the stack. @see #pushEvent(Event)
[ "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 }" ]
[ "public static void pullImage(String imageTag, String username, String password, String host) throws IOException {\n final AuthConfig authConfig = new AuthConfig();\n authConfig.withUsername(username);\n authConfig.withPassword(password);\n\n DockerClient dockerClient = null;\n try {\n dockerClient = getDockerClient(host);\n dockerClient.pullImageCmd(imageTag).withAuthConfig(authConfig).exec(new PullImageResultCallback()).awaitSuccess();\n } finally {\n closeQuietly(dockerClient);\n }\n }", "public static ComplexNumber Add(ComplexNumber z1, ComplexNumber z2) {\r\n return new ComplexNumber(z1.real + z2.real, z1.imaginary + z2.imaginary);\r\n }", "@Override\n public void onDismiss(DialogInterface dialog) {\n if (mOldDialog != null && mOldDialog == dialog) {\n // This is the callback from the old progress dialog that was already dismissed before\n // the device orientation change, so just ignore it.\n return;\n }\n super.onDismiss(dialog);\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 Iterable<RowKey> getKeys() {\n\t\tif ( currentState.isEmpty() ) {\n\t\t\tif ( cleared ) {\n\t\t\t\t// if the association has been cleared and the currentState is empty, we consider that there are no rows.\n\t\t\t\treturn Collections.emptyList();\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// otherwise, the snapshot rows are the current ones\n\t\t\t\treturn snapshot.getRowKeys();\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// It may be a bit too large in case of removals, but that's fine for now\n\t\t\tSet<RowKey> keys = CollectionHelper.newLinkedHashSet( cleared ? currentState.size() : snapshot.size() + currentState.size() );\n\n\t\t\tif ( !cleared ) {\n\t\t\t\t// we add the snapshot RowKeys only if the association has not been cleared\n\t\t\t\tfor ( RowKey rowKey : snapshot.getRowKeys() ) {\n\t\t\t\t\tkeys.add( rowKey );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor ( Map.Entry<RowKey,AssociationOperation> op : currentState.entrySet() ) {\n\t\t\t\tswitch ( op.getValue().getType() ) {\n\t\t\t\t\tcase PUT:\n\t\t\t\t\t\tkeys.add( op.getKey() );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase REMOVE:\n\t\t\t\t\t\tkeys.remove( op.getKey() );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn keys;\n\t\t}\n\t}", "public Collection<Contact> getList() throws FlickrException {\r\n \t ContactList<Contact> contacts = new ContactList<Contact>();\r\n \r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_LIST);\r\n\r\n Response response = transportAPI.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 contactsElement = response.getPayload();\r\n contacts.setPage(contactsElement.getAttribute(\"page\"));\r\n contacts.setPages(contactsElement.getAttribute(\"pages\"));\r\n contacts.setPerPage(contactsElement.getAttribute(\"perpage\"));\r\n contacts.setTotal(contactsElement.getAttribute(\"total\"));\r\n NodeList contactNodes = contactsElement.getElementsByTagName(\"contact\");\r\n for (int i = 0; i < contactNodes.getLength(); i++) {\r\n Element contactElement = (Element) contactNodes.item(i);\r\n Contact contact = new Contact();\r\n contact.setId(contactElement.getAttribute(\"nsid\"));\r\n contact.setUsername(contactElement.getAttribute(\"username\"));\r\n contact.setRealName(contactElement.getAttribute(\"realname\"));\r\n contact.setFriend(\"1\".equals(contactElement.getAttribute(\"friend\")));\r\n contact.setFamily(\"1\".equals(contactElement.getAttribute(\"family\")));\r\n contact.setIgnored(\"1\".equals(contactElement.getAttribute(\"ignored\")));\r\n String lPathAlias = contactElement.getAttribute(\"path_alias\");\r\n contact.setPathAlias(lPathAlias == null || \"\".equals(lPathAlias) ? null : lPathAlias);\r\n contact.setOnline(OnlineStatus.fromType(contactElement.getAttribute(\"online\")));\r\n contact.setIconFarm(contactElement.getAttribute(\"iconfarm\"));\r\n contact.setIconServer(contactElement.getAttribute(\"iconserver\"));\r\n if (contact.getOnline() == OnlineStatus.AWAY) {\r\n contactElement.normalize();\r\n contact.setAwayMessage(XMLUtilities.getValue(contactElement));\r\n }\r\n contacts.add(contact);\r\n }\r\n return contacts;\r\n }", "public static ServiceController<DeploymentScanner> addService(final OperationContext context, final PathAddress resourceAddress, final String relativeTo, final String path,\n final int scanInterval, TimeUnit unit, final boolean autoDeployZip,\n final boolean autoDeployExploded, final boolean autoDeployXml, final boolean scanEnabled, final long deploymentTimeout, boolean rollbackOnRuntimeFailure,\n final FileSystemDeploymentService bootTimeService, final ScheduledExecutorService scheduledExecutorService) {\n final DeploymentScannerService service = new DeploymentScannerService(resourceAddress, relativeTo, path, scanInterval, unit, autoDeployZip,\n autoDeployExploded, autoDeployXml, scanEnabled, deploymentTimeout, rollbackOnRuntimeFailure, bootTimeService);\n final ServiceName serviceName = getServiceName(resourceAddress.getLastElement().getValue());\n service.scheduledExecutorValue.inject(scheduledExecutorService);\n final ServiceBuilder<DeploymentScanner> sb = context.getServiceTarget().addService(serviceName, service);\n sb.addDependency(context.getCapabilityServiceName(PATH_MANAGER_CAPABILITY, PathManager.class), PathManager.class, service.pathManagerValue);\n sb.addDependency(context.getCapabilityServiceName(\"org.wildfly.management.notification-handler-registry\", null),\n NotificationHandlerRegistry.class, service.notificationRegistryValue);\n sb.addDependency(context.getCapabilityServiceName(\"org.wildfly.management.model-controller-client-factory\", null),\n ModelControllerClientFactory.class, service.clientFactoryValue);\n sb.requires(org.jboss.as.server.deployment.Services.JBOSS_DEPLOYMENT_CHAINS);\n sb.addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.controlledProcessStateServiceValue);\n return sb.install();\n }", "private DiscountCurve createDiscountCurve(String discountCurveName) {\n\t\tDiscountCurve discountCurve\t= model.getDiscountCurve(discountCurveName);\n\t\tif(discountCurve == null) {\n\t\t\tdiscountCurve = DiscountCurveInterpolation.createDiscountCurveFromDiscountFactors(discountCurveName, new double[] { 0.0 }, new double[] { 1.0 });\n\t\t\tmodel = model.addCurves(discountCurve);\n\t\t}\n\n\t\treturn discountCurve;\n\t}", "private static void listCalendars(ProjectFile file)\n {\n for (ProjectCalendar cal : file.getCalendars())\n {\n System.out.println(cal.toString());\n }\n }" ]
Use this API to fetch auditnslogpolicy_vpnvserver_binding resources of given name .
[ "public static auditnslogpolicy_vpnvserver_binding[] get(nitro_service service, String name) throws Exception{\n\t\tauditnslogpolicy_vpnvserver_binding obj = new auditnslogpolicy_vpnvserver_binding();\n\t\tobj.set_name(name);\n\t\tauditnslogpolicy_vpnvserver_binding response[] = (auditnslogpolicy_vpnvserver_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}" ]
[ "private int collectCandidates(Map<Long, Score> candidates,\n List<Bucket> buckets,\n int threshold) {\n int ix;\n for (ix = 0; ix < threshold &&\n candidates.size() < (CUTOFF_FACTOR_1 * max_search_hits); ix++) {\n Bucket b = buckets.get(ix);\n long[] ids = b.records;\n double score = b.getScore();\n \n for (int ix2 = 0; ix2 < b.nextfree; ix2++) {\n Score s = candidates.get(ids[ix2]);\n if (s == null) {\n s = new Score(ids[ix2]);\n candidates.put(ids[ix2], s);\n }\n s.score += score;\n }\n if (DEBUG)\n System.out.println(\"Bucket \" + b.nextfree + \" -> \" + candidates.size());\n }\n return ix;\n }", "private Number calculateDurationPercentComplete(Row row)\n {\n double result = 0;\n double targetDuration = row.getDuration(\"target_drtn_hr_cnt\").getDuration();\n double remainingDuration = row.getDuration(\"remain_drtn_hr_cnt\").getDuration();\n\n if (targetDuration == 0)\n {\n if (remainingDuration == 0)\n {\n if (\"TK_Complete\".equals(row.getString(\"status_code\")))\n {\n result = 100;\n }\n }\n }\n else\n {\n if (remainingDuration < targetDuration)\n {\n result = ((targetDuration - remainingDuration) * 100) / targetDuration;\n }\n }\n\n return NumberHelper.getDouble(result);\n }", "public List<TimephasedCost> getTimephasedActualCost()\n {\n if (m_timephasedActualCost == null)\n {\n Resource r = getResource();\n ResourceType type = r != null ? r.getType() : ResourceType.WORK;\n\n //for Work and Material resources, we will calculate in the normal way\n if (type != ResourceType.COST)\n {\n if (m_timephasedActualWork != null && m_timephasedActualWork.hasData())\n {\n if (hasMultipleCostRates())\n {\n m_timephasedActualCost = getTimephasedCostMultipleRates(getTimephasedActualWork(), getTimephasedActualOvertimeWork());\n }\n else\n {\n m_timephasedActualCost = getTimephasedCostSingleRate(getTimephasedActualWork(), getTimephasedActualOvertimeWork());\n }\n }\n }\n else\n {\n m_timephasedActualCost = getTimephasedActualCostFixedAmount();\n }\n\n }\n\n return m_timephasedActualCost;\n }", "protected Boolean getSearchForEmptyQuery() {\n\n Boolean isSearchForEmptyQuery = parseOptionalBooleanValue(m_configObject, JSON_KEY_SEARCH_FOR_EMPTY_QUERY);\n return (isSearchForEmptyQuery == null) && (null != m_baseConfig)\n ? Boolean.valueOf(m_baseConfig.getGeneralConfig().getSearchForEmptyQueryParam())\n : isSearchForEmptyQuery;\n }", "public List<String> getListAttribute(String section, String name) {\n return split(getAttribute(section, name));\n }", "public static Boolean parseBoolean(String value) throws ParseException\n {\n Boolean result = null;\n Integer number = parseInteger(value);\n if (number != null)\n {\n result = number.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE;\n }\n\n return result;\n }", "public static boolean updatingIndexNecessesary(CmsObject cms) {\n\n // Set request to the offline project.\n setCmsOfflineProject(cms);\n\n // Check whether the spellcheck index directories are empty.\n // If they are, the index has to be built obviously.\n if (isSolrSpellcheckIndexDirectoryEmpty()) {\n return true;\n }\n\n // Compare the most recent date of a dictionary with the oldest timestamp\n // that determines when an index has been built.\n long dateMostRecentDictionary = getMostRecentDate(cms);\n long dateOldestIndexWrite = getOldestIndexDate(cms);\n\n return dateMostRecentDictionary > dateOldestIndexWrite;\n }", "private void toCorrectDateWithDay(Calendar date, WeekOfMonth week) {\n\n date.set(Calendar.DAY_OF_MONTH, 1);\n int daysToFirstWeekDayMatch = ((m_weekDay.toInt() + I_CmsSerialDateValue.NUM_OF_WEEKDAYS)\n - (date.get(Calendar.DAY_OF_WEEK))) % I_CmsSerialDateValue.NUM_OF_WEEKDAYS;\n date.add(Calendar.DAY_OF_MONTH, daysToFirstWeekDayMatch);\n int wouldBeDayOfMonth = date.get(Calendar.DAY_OF_MONTH)\n + ((week.ordinal()) * I_CmsSerialDateValue.NUM_OF_WEEKDAYS);\n if (wouldBeDayOfMonth > date.getActualMaximum(Calendar.DAY_OF_MONTH)) {\n date.set(Calendar.DAY_OF_MONTH, wouldBeDayOfMonth - I_CmsSerialDateValue.NUM_OF_WEEKDAYS);\n } else {\n date.set(Calendar.DAY_OF_MONTH, wouldBeDayOfMonth);\n }\n\n }", "void commitTempFile(File temp) throws ConfigurationPersistenceException {\n if (!doneBootup.get()) {\n return;\n }\n if (!interactionPolicy.isReadOnly()) {\n FilePersistenceUtils.moveTempFileToMain(temp, mainFile);\n } else {\n FilePersistenceUtils.moveTempFileToMain(temp, lastFile);\n }\n }" ]
This method writes extended attribute data for a task. @param xml MSPDI task @param mpx MPXJ task
[ "private void writeTaskExtendedAttributes(Project.Tasks.Task xml, Task mpx)\n {\n Project.Tasks.Task.ExtendedAttribute attrib;\n List<Project.Tasks.Task.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();\n\n for (TaskField mpxFieldID : getAllTaskExtendedAttributes())\n {\n Object value = mpx.getCachedValue(mpxFieldID);\n\n if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))\n {\n m_extendedAttributesInUse.add(mpxFieldID);\n\n Integer xmlFieldID = Integer.valueOf(MPPTaskField.getID(mpxFieldID) | MPPTaskField.TASK_FIELD_BASE);\n\n attrib = m_factory.createProjectTasksTaskExtendedAttribute();\n extendedAttributes.add(attrib);\n attrib.setFieldID(xmlFieldID.toString());\n attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));\n attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));\n }\n }\n }" ]
[ "public void destroy() throws Exception {\n if (_clientId == null) {\n return;\n }\n\n // delete the clientId here\n String uri = BASE_PROFILE + uriEncode(_profileName) + \"/\" + BASE_CLIENTS + \"/\" + _clientId;\n try {\n doDelete(uri, null);\n } catch (Exception e) {\n // some sort of error\n throw new Exception(\"Could not delete a proxy client\");\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 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 }", "private void processCalendarHours(ProjectCalendar calendar, Row row, int dayIndex)\n {\n Day day = Day.getInstance(dayIndex);\n boolean working = row.getInt(\"CD_WORKING\") != 0;\n calendar.setWorkingDay(day, working);\n if (working == true)\n {\n ProjectCalendarHours hours = calendar.addCalendarHours(day);\n\n Date start = row.getDate(\"CD_FROM_TIME1\");\n Date end = row.getDate(\"CD_TO_TIME1\");\n if (start != null && end != null)\n {\n hours.addRange(new DateRange(start, end));\n }\n\n start = row.getDate(\"CD_FROM_TIME2\");\n end = row.getDate(\"CD_TO_TIME2\");\n if (start != null && end != null)\n {\n hours.addRange(new DateRange(start, end));\n }\n\n start = row.getDate(\"CD_FROM_TIME3\");\n end = row.getDate(\"CD_TO_TIME3\");\n if (start != null && end != null)\n {\n hours.addRange(new DateRange(start, end));\n }\n\n start = row.getDate(\"CD_FROM_TIME4\");\n end = row.getDate(\"CD_TO_TIME4\");\n if (start != null && end != null)\n {\n hours.addRange(new DateRange(start, end));\n }\n\n start = row.getDate(\"CD_FROM_TIME5\");\n end = row.getDate(\"CD_TO_TIME5\");\n if (start != null && end != null)\n {\n hours.addRange(new DateRange(start, end));\n }\n }\n }", "public boolean isEmpty() {\n\t\tint snapshotSize = cleared ? 0 : snapshot.size();\n\t\t//nothing in both\n\t\tif ( snapshotSize == 0 && currentState.isEmpty() ) {\n\t\t\treturn true;\n\t\t}\n\t\t//snapshot bigger than changeset\n\t\tif ( snapshotSize > currentState.size() ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn size() == 0;\n\t}", "void rejectAttributes(RejectedAttributesLogContext rejectedAttributes, ModelNode attributeValue) {\n for (RejectAttributeChecker checker : checks) {\n rejectedAttributes.checkAttribute(checker, name, attributeValue);\n }\n }", "public static clusterinstance[] get(nitro_service service) throws Exception{\n\t\tclusterinstance obj = new clusterinstance();\n\t\tclusterinstance[] response = (clusterinstance[])obj.get_resources(service);\n\t\treturn response;\n\t}", "public void store(Object obj, ObjectModification mod) throws PersistenceBrokerException\n {\n obj = extractObjectToStore(obj);\n // null for unmaterialized Proxy\n if (obj == null)\n {\n return;\n }\n\n ClassDescriptor cld = getClassDescriptor(obj.getClass());\n // this call ensures that all autoincremented primary key attributes are filled\n Identity oid = serviceIdentity().buildIdentity(cld, obj);\n // select flag for insert / update selection by checking the ObjectModification\n if (mod.needsInsert())\n {\n store(obj, oid, cld, true);\n }\n else if (mod.needsUpdate())\n {\n store(obj, oid, cld, false);\n }\n /*\n arminw\n TODO: Why we need this behaviour? What about 1:1 relations?\n */\n else\n {\n // just store 1:n and m:n associations\n storeCollections(obj, cld, mod.needsInsert());\n }\n }", "public Tree determineHead(Tree t, Tree parent) {\r\n if (nonTerminalInfo == null) {\r\n throw new RuntimeException(\"Classes derived from AbstractCollinsHeadFinder must\" + \" create and fill HashMap nonTerminalInfo.\");\r\n }\r\n if (t == null || t.isLeaf()) {\r\n return null;\r\n }\r\n if (DEBUG) {\r\n System.err.println(\"determineHead for \" + t.value());\r\n }\r\n \r\n Tree[] kids = t.children();\r\n\r\n Tree theHead;\r\n // first check if subclass found explicitly marked head\r\n if ((theHead = findMarkedHead(t)) != null) {\r\n if (DEBUG) {\r\n System.err.println(\"Find marked head method returned \" +\r\n theHead.label() + \" as head of \" + t.label());\r\n }\r\n return theHead;\r\n }\r\n\r\n // if the node is a unary, then that kid must be the head\r\n // it used to special case preterminal and ROOT/TOP case\r\n // but that seemed bad (especially hardcoding string \"ROOT\")\r\n if (kids.length == 1) {\r\n if (DEBUG) {\r\n System.err.println(\"Only one child determines \" +\r\n kids[0].label() + \" as head of \" + t.label());\r\n }\r\n return kids[0];\r\n }\r\n\r\n return determineNonTrivialHead(t, parent);\r\n }" ]
Use this API to fetch lbvserver_scpolicy_binding resources of given name .
[ "public static lbvserver_scpolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tlbvserver_scpolicy_binding obj = new lbvserver_scpolicy_binding();\n\t\tobj.set_name(name);\n\t\tlbvserver_scpolicy_binding response[] = (lbvserver_scpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}" ]
[ "public static <K, V> void operator_remove(Map<K, V> map, Iterable<? super K> keysToRemove) {\n\t\tfor (final Object key : keysToRemove) {\n\t\t\tmap.remove(key);\n\t\t}\n\t}", "protected boolean showMoreEntries(Calendar nextDate, int previousOccurrences) {\n\n switch (getSerialEndType()) {\n case DATE:\n boolean moreByDate = nextDate.getTimeInMillis() < m_endMillis;\n boolean moreByOccurrences = previousOccurrences < CmsSerialDateUtil.getMaxEvents();\n if (moreByDate && !moreByOccurrences) {\n m_hasTooManyOccurrences = Boolean.TRUE;\n }\n return moreByDate && moreByOccurrences;\n case TIMES:\n case SINGLE:\n return previousOccurrences < getOccurrences();\n default:\n throw new IllegalArgumentException();\n }\n }", "static void createMessage(String textMessage, JobInstance jobInstance, DbConn cnx)\n {\n cnx.runUpdate(\"message_insert\", jobInstance.getId(), textMessage);\n }", "public String getResourcePath()\n {\n switch (resourceType)\n {\n case ANDROID_ASSETS: return assetPath;\n\n case ANDROID_RESOURCE: return resourceFilePath;\n\n case LINUX_FILESYSTEM: return filePath;\n\n case NETWORK: return url.getPath();\n\n case INPUT_STREAM: return inputStreamName;\n\n default: return null;\n }\n }", "private void printSuggestion( String arg, List<ConfigOption> co ) {\n List<ConfigOption> sortedList = new ArrayList<ConfigOption>( co );\n Collections.sort( sortedList, new ConfigOptionLevenshteinDistance( arg ) );\n System.err.println( \"Parse error for argument \\\"\" + arg + \"\\\", did you mean \" + sortedList.get( 0 ).getCommandLineOption()\n .showFlagInfo() + \"? Ignoring for now.\" );\n\n }", "public static ProtocolConnectionManager create(final Connection connection, final ConnectionOpenHandler openHandler) {\n return create(new EstablishedConnection(connection, openHandler));\n }", "public void sendFaderStartCommand(Set<Integer> deviceNumbersToStart, Set<Integer> deviceNumbersToStop) throws IOException {\n ensureRunning();\n byte[] payload = new byte[FADER_START_PAYLOAD.length];\n System.arraycopy(FADER_START_PAYLOAD, 0, payload, 0, FADER_START_PAYLOAD.length);\n payload[2] = getDeviceNumber();\n\n for (int i = 1; i <= 4; i++) {\n if (deviceNumbersToStart.contains(i)) {\n payload[i + 4] = 0;\n }\n if (deviceNumbersToStop.contains(i)) {\n payload[i + 4] = 1;\n }\n }\n\n assembleAndSendPacket(Util.PacketType.FADER_START_COMMAND, payload, getBroadcastAddress(), BeatFinder.BEAT_PORT);\n }", "public static String get(Properties props, String name, String defval) {\n String value = props.getProperty(name);\n if (value == null)\n value = defval;\n return value;\n }", "public BeanDefinitionInfo toDto(BeanDefinition beanDefinition) {\n\t\tif (beanDefinition instanceof GenericBeanDefinition) {\n\t\t\tGenericBeanDefinitionInfo info = new GenericBeanDefinitionInfo();\n\t\t\tinfo.setClassName(beanDefinition.getBeanClassName());\n\n\t\t\tif (beanDefinition.getPropertyValues() != null) {\n\t\t\t\tMap<String, BeanMetadataElementInfo> propertyValues = new HashMap<String, BeanMetadataElementInfo>();\n\t\t\t\tfor (PropertyValue value : beanDefinition.getPropertyValues().getPropertyValueList()) {\n\t\t\t\t\tObject obj = value.getValue();\n\t\t\t\t\tif (obj instanceof BeanMetadataElement) {\n\t\t\t\t\t\tpropertyValues.put(value.getName(), toDto((BeanMetadataElement) obj));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new IllegalArgumentException(\"Type \" + obj.getClass().getName()\n\t\t\t\t\t\t\t\t+ \" is not a BeanMetadataElement for property: \" + value.getName());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tinfo.setPropertyValues(propertyValues);\n\t\t\t}\n\t\t\treturn info;\n\t\t} else {\n\t\t\tthrow new IllegalArgumentException(\"Conversion to DTO of \" + beanDefinition.getClass().getName()\n\t\t\t\t\t+ \" not implemented\");\n\t\t}\n\t}" ]
Use this API to add vlan resources.
[ "public static base_responses add(nitro_service client, vlan resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tvlan addresources[] = new vlan[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new vlan();\n\t\t\t\taddresources[i].id = resources[i].id;\n\t\t\t\taddresources[i].aliasname = resources[i].aliasname;\n\t\t\t\taddresources[i].ipv6dynamicrouting = resources[i].ipv6dynamicrouting;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}" ]
[ "public static int getStatusBarHeight(Context context, boolean force) {\n int result = 0;\n int resourceId = context.getResources().getIdentifier(\"status_bar_height\", \"dimen\", \"android\");\n if (resourceId > 0) {\n result = context.getResources().getDimensionPixelSize(resourceId);\n }\n\n int dimenResult = context.getResources().getDimensionPixelSize(R.dimen.tool_bar_top_padding);\n //if our dimension is 0 return 0 because on those devices we don't need the height\n if (dimenResult == 0 && !force) {\n return 0;\n } else {\n //if our dimens is > 0 && the result == 0 use the dimenResult else the result;\n return result == 0 ? dimenResult : result;\n }\n }", "public void rollback() throws GitAPIException {\n try (Git git = getGit()) {\n git.reset().setMode(ResetCommand.ResetType.HARD).setRef(HEAD).call();\n }\n }", "public static String encode(String component) {\n if (component != null) {\n try {\n return URLEncoder.encode(component, UTF_8.name());\n } catch (UnsupportedEncodingException e) {\n throw new RuntimeException(\"JVM must support UTF-8\", e);\n }\n }\n return null;\n }", "public Object copy(final Object obj, PersistenceBroker broker)\r\n\t\t\tthrows ObjectCopyException\r\n\t{\r\n\t\tObjectOutputStream oos = null;\r\n\t\tObjectInputStream ois = null;\r\n\t\ttry\r\n\t\t{\r\n\t\t\tfinal ByteArrayOutputStream bos = new ByteArrayOutputStream();\r\n\t\t\toos = new ObjectOutputStream(bos);\r\n\t\t\t// serialize and pass the object\r\n\t\t\toos.writeObject(obj);\r\n\t\t\toos.flush();\r\n\t\t\tfinal ByteArrayInputStream bin =\r\n\t\t\t\t\tnew ByteArrayInputStream(bos.toByteArray());\r\n\t\t\tois = new ObjectInputStream(bin);\r\n\t\t\t// return the new object\r\n\t\t\treturn ois.readObject();\r\n\t\t}\r\n\t\tcatch (Exception e)\r\n\t\t{\r\n\t\t\tthrow new ObjectCopyException(e);\r\n\t\t}\r\n\t\tfinally\r\n\t\t{\r\n\t\t\ttry\r\n\t\t\t{\r\n\t\t\t\tif (oos != null)\r\n\t\t\t\t{\r\n\t\t\t\t\toos.close();\r\n\t\t\t\t}\r\n\t\t\t\tif (ois != null)\r\n\t\t\t\t{\r\n\t\t\t\t\tois.close();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcatch (IOException ioe)\r\n\t\t\t{\r\n\t\t\t\t// ignore\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static double diagProd( DMatrix1Row T )\n {\n double prod = 1.0;\n int N = Math.min(T.numRows,T.numCols);\n for( int i = 0; i < N; i++ ) {\n prod *= T.unsafe_get(i,i);\n }\n\n return prod;\n }", "public static void fillProcessorAttributes(\n final List<Processor> processors,\n final Map<String, Attribute> initialAttributes) {\n Map<String, Attribute> currentAttributes = new HashMap<>(initialAttributes);\n for (Processor processor: processors) {\n if (processor instanceof RequireAttributes) {\n for (ProcessorDependencyGraphFactory.InputValue inputValue:\n ProcessorDependencyGraphFactory.getInputs(processor)) {\n if (inputValue.type == Values.class) {\n if (processor instanceof CustomDependencies) {\n for (String attributeName: ((CustomDependencies) processor).getDependencies()) {\n Attribute attribute = currentAttributes.get(attributeName);\n if (attribute != null) {\n ((RequireAttributes) processor).setAttribute(\n attributeName, currentAttributes.get(attributeName));\n }\n }\n\n } else {\n for (Map.Entry<String, Attribute> attribute: currentAttributes.entrySet()) {\n ((RequireAttributes) processor).setAttribute(\n attribute.getKey(), attribute.getValue());\n }\n }\n } else {\n try {\n ((RequireAttributes) processor).setAttribute(\n inputValue.internalName,\n currentAttributes.get(inputValue.name));\n } catch (ClassCastException e) {\n throw new IllegalArgumentException(String.format(\"The processor '%s' requires \" +\n \"the attribute '%s' \" +\n \"(%s) but he has the \" +\n \"wrong type:\\n%s\",\n processor, inputValue.name,\n inputValue.internalName,\n e.getMessage()), e);\n }\n }\n }\n }\n if (processor instanceof ProvideAttributes) {\n Map<String, Attribute> newAttributes = ((ProvideAttributes) processor).getAttributes();\n for (ProcessorDependencyGraphFactory.OutputValue ouputValue:\n ProcessorDependencyGraphFactory.getOutputValues(processor)) {\n currentAttributes.put(\n ouputValue.name, newAttributes.get(ouputValue.internalName));\n }\n }\n }\n }", "@VisibleForTesting\n protected static double getNearestNiceValue(\n final double value, final DistanceUnit scaleUnit, final boolean lockUnits) {\n DistanceUnit bestUnit = bestUnit(scaleUnit, value, lockUnits);\n double factor = scaleUnit.convertTo(1.0, bestUnit);\n\n // nearest power of 10 lower than value\n int digits = (int) Math.floor((Math.log(value * factor) / Math.log(10)));\n double pow10 = Math.pow(10, digits);\n\n // ok, find first character\n double firstChar = value * factor / pow10;\n\n // right, put it into the correct bracket\n int barLen;\n if (firstChar >= 10.0) {\n barLen = 10;\n } else if (firstChar >= 5.0) {\n barLen = 5;\n } else if (firstChar >= 2.0) {\n barLen = 2;\n } else {\n barLen = 1;\n }\n\n // scale it up the correct power of 10\n return barLen * pow10 / factor;\n }", "private boolean processQueue(K key) {\n Queue<AsyncResourceRequest<V>> requestQueue = getRequestQueueForKey(key);\n if(requestQueue.isEmpty()) {\n return false;\n }\n\n // Attempt to get a resource.\n Pool<V> resourcePool = getResourcePoolForKey(key);\n V resource = null;\n Exception ex = null;\n try {\n // Must attempt non-blocking checkout to ensure resources are\n // created for the pool.\n resource = attemptNonBlockingCheckout(key, resourcePool);\n } catch(Exception e) {\n destroyResource(key, resourcePool, resource);\n ex = e;\n resource = null;\n }\n // Neither we got a resource, nor an exception. So no requests can be\n // processed return\n if(resource == null && ex == null) {\n return false;\n }\n\n // With resource in hand, process the resource requests\n AsyncResourceRequest<V> resourceRequest = getNextUnexpiredResourceRequest(requestQueue);\n if(resourceRequest == null) {\n if(resource != null) {\n // Did not use the resource! Directly check in via super to\n // avoid\n // circular call to processQueue().\n try {\n super.checkin(key, resource);\n } catch(Exception e) {\n logger.error(\"Exception checking in resource: \", e);\n }\n } else {\n // Poor exception, no request to tag this exception onto\n // drop it on the floor and continue as usual.\n }\n return false;\n } else {\n // We have a request here.\n if(resource != null) {\n resourceRequest.useResource(resource);\n } else {\n resourceRequest.handleException(ex);\n }\n return true;\n }\n }", "public <T extends CanvasReader> T getReader(Class<T> type, OauthToken oauthToken) {\n return getReader(type, oauthToken, null);\n }" ]
Add an individual class to the map file. @param loader jar file class loader @param jarEntry jar file entry @param writer XML stream writer @param mapClassMethods true if we want to produce .Net style class method names @throws ClassNotFoundException @throws XMLStreamException @throws IntrospectionException
[ "private void addClass(URLClassLoader loader, JarEntry jarEntry, XMLStreamWriter writer, boolean mapClassMethods) throws ClassNotFoundException, XMLStreamException, IntrospectionException\n {\n String className = jarEntry.getName().replaceAll(\"\\\\.class\", \"\").replaceAll(\"/\", \".\");\n writer.writeStartElement(\"class\");\n writer.writeAttribute(\"name\", className);\n\n Set<Method> methodSet = new HashSet<Method>();\n Class<?> aClass = loader.loadClass(className);\n\n processProperties(writer, methodSet, aClass);\n\n if (mapClassMethods && !Modifier.isInterface(aClass.getModifiers()))\n {\n processClassMethods(writer, aClass, methodSet);\n }\n writer.writeEndElement();\n }" ]
[ "@UiHandler(\"m_atDay\")\r\n void onWeekDayChange(ValueChangeEvent<String> event) {\r\n\r\n if (handleChange()) {\r\n m_controller.setWeekDay(event.getValue());\r\n }\r\n }", "protected void putResponse(JSONObject json,\n String param,\n Object value) {\n try {\n json.put(param,\n value);\n } catch (JSONException e) {\n logger.error(\"json write error\",\n e);\n }\n }", "public static autoscaleprofile[] get(nitro_service service) throws Exception{\n\t\tautoscaleprofile obj = new autoscaleprofile();\n\t\tautoscaleprofile[] response = (autoscaleprofile[])obj.get_resources(service);\n\t\treturn response;\n\t}", "private Resource readResource(net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource phoenixResource)\n {\n Resource mpxjResource = m_projectFile.addResource();\n\n TimeUnit rateUnits = phoenixResource.getMonetarybase();\n if (rateUnits == null)\n {\n rateUnits = TimeUnit.HOURS;\n }\n\n // phoenixResource.getMaximum()\n mpxjResource.setCostPerUse(phoenixResource.getMonetarycostperuse());\n mpxjResource.setStandardRate(new Rate(phoenixResource.getMonetaryrate(), rateUnits));\n mpxjResource.setStandardRateUnits(rateUnits);\n mpxjResource.setName(phoenixResource.getName());\n mpxjResource.setType(phoenixResource.getType());\n mpxjResource.setMaterialLabel(phoenixResource.getUnitslabel());\n //phoenixResource.getUnitsperbase()\n mpxjResource.setGUID(phoenixResource.getUuid());\n\n m_eventManager.fireResourceReadEvent(mpxjResource);\n\n return mpxjResource;\n }", "public static String[] addStringToArray(String[] array, String str) {\n if (isEmpty(array)) {\n return new String[]{str};\n }\n String[] newArr = new String[array.length + 1];\n System.arraycopy(array, 0, newArr, 0, array.length);\n newArr[array.length] = str;\n return newArr;\n }", "public boolean canLockBecauseOfInactivity(CmsObject cms, CmsUser user) {\n\n return !user.isManaged()\n && !user.isWebuser()\n && !OpenCms.getDefaultUsers().isDefaultUser(user.getName())\n && !OpenCms.getRoleManager().hasRole(cms, user.getName(), CmsRole.ROOT_ADMIN);\n }", "@SuppressWarnings(\"deprecation\")\n @Deprecated\n public final void validateAndSet(ModelNode operationObject, final ModelNode model) throws OperationFailedException {\n validateOperation(operationObject);\n for (AttributeDefinition ad : this.parameters) {\n ad.validateAndSet(operationObject, model);\n }\n }", "public static int cudnnPoolingForward(\n cudnnHandle handle, \n cudnnPoolingDescriptor poolingDesc, \n Pointer alpha, \n cudnnTensorDescriptor xDesc, \n Pointer x, \n Pointer beta, \n cudnnTensorDescriptor yDesc, \n Pointer y)\n {\n return checkResult(cudnnPoolingForwardNative(handle, poolingDesc, alpha, xDesc, x, beta, yDesc, y));\n }", "protected <T extends Listener> Collection<T> copyList(Class<T> listenerClass,\n Stream<Object> listeners, int sizeHint) {\n if (sizeHint == 0) {\n return Collections.emptyList();\n }\n return listeners\n .map(listenerClass::cast)\n .collect(Collectors.toCollection(() -> new ArrayList<>(sizeHint)));\n }" ]
Checks that index is valid an throw an exception if not. @param type the type @param index the index to check
[ "private void checkTexRange(AiTextureType type, int index) {\n if (index < 0 || index > m_numTextures.get(type)) {\n throw new IndexOutOfBoundsException(\"Index: \" + index + \", Size: \" +\n m_numTextures.get(type));\n }\n }" ]
[ "private void initDeactivationPanel() {\n\n m_deactivationPanel.setVisible(false);\n m_deactivationText.setText(Messages.get().key(Messages.GUI_SERIALDATE_DEACTIVE_TEXT_0));\n\n }", "public static vpnvserver_auditnslogpolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tvpnvserver_auditnslogpolicy_binding obj = new vpnvserver_auditnslogpolicy_binding();\n\t\tobj.set_name(name);\n\t\tvpnvserver_auditnslogpolicy_binding response[] = (vpnvserver_auditnslogpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "List<W3CEndpointReference> lookupEndpoints(QName serviceName,\n MatcherDataType matcherData) throws ServiceLocatorFault,\n InterruptedExceptionFault {\n SLPropertiesMatcher matcher = createMatcher(matcherData);\n List<String> names = null;\n List<W3CEndpointReference> result = new ArrayList<W3CEndpointReference>();\n String adress;\n try {\n initLocator();\n if (matcher == null) {\n names = locatorClient.lookup(serviceName);\n } else {\n names = locatorClient.lookup(serviceName, matcher);\n }\n } catch (ServiceLocatorException e) {\n ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail();\n serviceFaultDetail.setLocatorFaultDetail(serviceName.toString()\n + \"throws ServiceLocatorFault\");\n throw new ServiceLocatorFault(e.getMessage(), serviceFaultDetail);\n } catch (InterruptedException e) {\n InterruptionFaultDetail interruptionFaultDetail = new InterruptionFaultDetail();\n interruptionFaultDetail.setInterruptionDetail(serviceName\n .toString() + \"throws InterruptionFault\");\n throw new InterruptedExceptionFault(e.getMessage(),\n interruptionFaultDetail);\n }\n if (names != null && !names.isEmpty()) {\n for (int i = 0; i < names.size(); i++) {\n adress = names.get(i);\n result.add(buildEndpoint(serviceName, adress));\n }\n } else {\n if (LOG.isLoggable(Level.WARNING)) {\n LOG.log(Level.WARNING, \"lookup Endpoints for \" + serviceName\n + \" failed, service is not known.\");\n }\n ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail();\n serviceFaultDetail.setLocatorFaultDetail(\"lookup Endpoint for \"\n + serviceName + \" failed, service is not known.\");\n throw new ServiceLocatorFault(\"Can not find Endpoint\",\n serviceFaultDetail);\n }\n return result;\n }", "public List<CRFCliqueTree> getCliqueTrees(String filename, DocumentReaderAndWriter<IN> readerAndWriter) {\r\n // only for the OCR data does this matter\r\n flags.ocrTrain = false;\r\n\r\n List<CRFCliqueTree> cts = new ArrayList<CRFCliqueTree>();\r\n ObjectBank<List<IN>> docs = makeObjectBankFromFile(filename, readerAndWriter);\r\n for (List<IN> doc : docs) {\r\n cts.add(getCliqueTree(doc));\r\n }\r\n\r\n return cts;\r\n }", "@Override\n\tpublic Object getCurrentVersion(Serializable id, SharedSessionContractImplementor session) throws HibernateException {\n\n\t\tif ( log.isTraceEnabled() ) {\n\t\t\tlog.trace( \"Getting version: \" + MessageHelper.infoString( this, id, getFactory() ) );\n\t\t}\n\t\tfinal Tuple resultset = getFreshTuple( EntityKeyBuilder.fromPersister( this, id, session ), session );\n\n\t\tif ( resultset == null ) {\n\t\t\treturn null;\n\t\t}\n\t\telse {\n\t\t\treturn gridVersionType.nullSafeGet( resultset, getVersionColumnName(), session, null );\n\t\t}\n\t}", "public static String groupFromResourceId(String id) {\n return (id != null) ? ResourceId.fromString(id).resourceGroupName() : null;\n }", "public static DMatrixRMaj extractColumn(DMatrixRMaj a , int column , DMatrixRMaj out ) {\n if( out == null)\n out = new DMatrixRMaj(a.numRows,1);\n else if( !MatrixFeatures_DDRM.isVector(out) || out.getNumElements() != a.numRows )\n throw new MatrixDimensionException(\"Output must be a vector of length \"+a.numRows);\n\n int index = column;\n for (int i = 0; i < a.numRows; i++, index += a.numCols ) {\n out.data[i] = a.data[index];\n }\n return out;\n }", "public boolean detectTierRichCss() {\r\n\r\n boolean result = false;\r\n //The following devices are explicitly ok.\r\n //Note: 'High' BlackBerry devices ONLY\r\n if (detectMobileQuick()) {\r\n\r\n //Exclude iPhone Tier and e-Ink Kindle devices.\r\n if (!detectTierIphone() && !detectKindle()) {\r\n\r\n //The following devices are explicitly ok.\r\n //Note: 'High' BlackBerry devices ONLY\r\n //Older Windows 'Mobile' isn't good enough for iPhone Tier.\r\n if (detectWebkit()\r\n || detectS60OssBrowser()\r\n || detectBlackBerryHigh()\r\n || detectWindowsMobile()\r\n || (userAgent.indexOf(engineTelecaQ) != -1)) {\r\n result = true;\r\n } // if detectWebkit()\r\n } //if !detectTierIphone()\r\n } //if detectMobileQuick()\r\n return result;\r\n }", "public void start() {\n syncLock.lock();\n try {\n if (!this.isConfigured) {\n return;\n }\n instanceChangeStreamListener.stop();\n if (listenersEnabled) {\n instanceChangeStreamListener.start();\n }\n\n if (syncThread == null) {\n syncThread = new Thread(\n new DataSynchronizerRunner(\n new WeakReference<>(this),\n networkMonitor,\n logger\n ),\n \"dataSynchronizerRunnerThread\"\n );\n }\n if (syncThreadEnabled && !isRunning) {\n syncThread.start();\n isRunning = true;\n }\n } finally {\n syncLock.unlock();\n }\n }" ]
Clones the given field. @param fieldDef The field descriptor @param prefix A prefix for the name @return The cloned field
[ "private FieldDescriptorDef cloneField(FieldDescriptorDef fieldDef, String prefix)\r\n {\r\n FieldDescriptorDef copyFieldDef = new FieldDescriptorDef(fieldDef, prefix);\r\n\r\n copyFieldDef.setOwner(this);\r\n // we remove properties that are only relevant to the class the features are declared in\r\n copyFieldDef.setProperty(PropertyHelper.OJB_PROPERTY_IGNORE, null);\r\n\r\n Properties mod = getModification(copyFieldDef.getName());\r\n\r\n if (mod != null)\r\n {\r\n if (!PropertyHelper.toBoolean(mod.getProperty(PropertyHelper.OJB_PROPERTY_IGNORE), false) &&\r\n hasFeature(copyFieldDef.getName()))\r\n {\r\n LogHelper.warn(true,\r\n ClassDescriptorDef.class,\r\n \"process\",\r\n \"Class \"+getName()+\" has a feature that has the same name as its included field \"+\r\n copyFieldDef.getName()+\" from class \"+fieldDef.getOwner().getName()); \r\n }\r\n copyFieldDef.applyModifications(mod);\r\n }\r\n return copyFieldDef;\r\n }" ]
[ "public ArrayList getPrimaryKeys()\r\n {\r\n ArrayList result = new ArrayList();\r\n FieldDescriptorDef fieldDef;\r\n\r\n for (Iterator it = getFields(); it.hasNext();)\r\n {\r\n fieldDef = (FieldDescriptorDef)it.next();\r\n if (fieldDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_PRIMARYKEY, false))\r\n {\r\n result.add(fieldDef);\r\n }\r\n }\r\n return result;\r\n }", "public void associateTypeJndiResource(JNDIResourceModel resource, String type)\n {\n if (type == null || resource == null)\n {\n return;\n }\n\n if (StringUtils.equals(type, \"javax.sql.DataSource\") && !(resource instanceof DataSourceModel))\n {\n DataSourceModel ds = GraphService.addTypeToModel(this.getGraphContext(), resource, DataSourceModel.class);\n }\n else if (StringUtils.equals(type, \"javax.jms.Queue\") && !(resource instanceof JmsDestinationModel))\n {\n JmsDestinationModel jms = GraphService.addTypeToModel(this.getGraphContext(), resource, JmsDestinationModel.class);\n jms.setDestinationType(JmsDestinationType.QUEUE);\n }\n else if (StringUtils.equals(type, \"javax.jms.QueueConnectionFactory\") && !(resource instanceof JmsConnectionFactoryModel))\n {\n JmsConnectionFactoryModel jms = GraphService.addTypeToModel(this.getGraphContext(), resource, JmsConnectionFactoryModel.class);\n jms.setConnectionFactoryType(JmsDestinationType.QUEUE);\n }\n else if (StringUtils.equals(type, \"javax.jms.Topic\") && !(resource instanceof JmsDestinationModel))\n {\n JmsDestinationModel jms = GraphService.addTypeToModel(this.getGraphContext(), resource, JmsDestinationModel.class);\n jms.setDestinationType(JmsDestinationType.TOPIC);\n }\n else if (StringUtils.equals(type, \"javax.jms.TopicConnectionFactory\") && !(resource instanceof JmsConnectionFactoryModel))\n {\n JmsConnectionFactoryModel jms = GraphService.addTypeToModel(this.getGraphContext(), resource, JmsConnectionFactoryModel.class);\n jms.setConnectionFactoryType(JmsDestinationType.TOPIC);\n }\n }", "public void close() throws SQLException {\r\n\t\ttry {\r\n\r\n\t\t\tif (this.resetConnectionOnClose /*FIXME: && !getAutoCommit() && !isTxResolved() */){\r\n\t\t\t\t/*if (this.autoCommitStackTrace != null){\r\n\t\t\t\t\t\tlogger.debug(this.autoCommitStackTrace);\r\n\t\t\t\t\t\tthis.autoCommitStackTrace = null; \r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tlogger.debug(DISABLED_AUTO_COMMIT_WARNING);\r\n\t\t\t\t\t}*/\r\n\t\t\t\trollback();\r\n\t\t\t\tif (!getAutoCommit()){\r\n\t\t\t\t\tsetAutoCommit(true);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (this.logicallyClosed.compareAndSet(false, true)) {\r\n\r\n\r\n\t\t\t\tif (this.threadWatch != null){\r\n\t\t\t\t\tthis.threadWatch.interrupt(); // if we returned the connection to the pool, terminate thread watch thread if it's\r\n\t\t\t\t\t// running even if thread is still alive (eg thread has been recycled for use in some\r\n\t\t\t\t\t// container).\r\n\t\t\t\t\tthis.threadWatch = null;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (this.closeOpenStatements){\r\n\t\t\t\t\tfor (Entry<Statement, String> statementEntry: this.trackedStatement.entrySet()){\r\n\t\t\t\t\t\tstatementEntry.getKey().close();\r\n\t\t\t\t\t\tif (this.detectUnclosedStatements){\r\n\t\t\t\t\t\t\tlogger.warn(String.format(UNCLOSED_LOG_ERROR_MESSAGE, statementEntry.getValue()));\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.trackedStatement.clear();\r\n\t\t\t\t} \r\n\r\n\t\t\t\tif (!this.connectionTrackingDisabled){\r\n\t\t\t\t\tpool.getFinalizableRefs().remove(this.connection);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tConnectionHandle handle = null;\r\n\r\n\t\t\t\t//recreate can throw a SQLException in constructor on recreation\r\n\t\t\t\ttry {\r\n\t\t\t\t handle = this.recreateConnectionHandle();\r\n\t\t\t\t this.pool.connectionStrategy.cleanupConnection(this, handle);\r\n\t\t\t\t this.pool.releaseConnection(handle);\t\t\t\t \r\n\t\t\t\t} catch(SQLException e) {\r\n\t\t\t\t //check if the connection was already closed by the recreation\r\n\t\t\t\t if (!isClosed()) {\r\n\t\t\t\t \tthis.pool.connectionStrategy.cleanupConnection(this, handle);\r\n\t\t\t\t \tthis.pool.releaseConnection(this);\r\n\t\t\t\t }\r\n\t\t\t\t throw e;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tif (this.doubleCloseCheck){\r\n\t\t\t\t\tthis.doubleCloseException = this.pool.captureStackTrace(CLOSED_TWICE_EXCEPTION_MESSAGE);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (this.doubleCloseCheck && this.doubleCloseException != null){\r\n\t\t\t\t\tString currentLocation = this.pool.captureStackTrace(\"Last closed trace from thread [\"+Thread.currentThread().getName()+\"]:\\n\");\r\n\t\t\t\t\tlogger.error(String.format(LOG_ERROR_MESSAGE, this.doubleCloseException, currentLocation));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} catch (SQLException e) {\r\n\t\t\tthrow markPossiblyBroken(e);\r\n\t\t}\r\n\t}", "public ClassNode annotatedWith(String name) {\n ClassNode anno = infoBase.node(name);\n this.annotations.add(anno);\n anno.annotated.add(this);\n return this;\n }", "@Nonnull\n\tpublic static InterfaceAnalysis analyze(@Nonnull final String code) {\n\t\tCheck.notNull(code, \"code\");\n\n\t\tfinal CompilationUnit unit = Check.notNull(SourceCodeReader.parse(code), \"compilationUnit\");\n\t\tfinal List<TypeDeclaration> types = Check.notEmpty(unit.getTypes(), \"typeDeclarations\");\n\t\tCheck.stateIsTrue(types.size() == 1, \"only one interface declaration per analysis is supported\");\n\n\t\tfinal ClassOrInterfaceDeclaration type = (ClassOrInterfaceDeclaration) types.get(0);\n\n\t\tfinal Imports imports = SourceCodeReader.findImports(unit.getImports());\n\t\tfinal Package pkg = unit.getPackage() != null ? new Package(unit.getPackage().getName().toString()) : Package.UNDEFINED;\n\t\tfinal List<Annotation> annotations = SourceCodeReader.findAnnotations(type.getAnnotations(), imports);\n\t\tfinal List<Method> methods = SourceCodeReader.findMethods(type.getMembers(), imports);\n\t\tCheck.stateIsTrue(!hasPossibleMutatingMethods(methods), \"The passed interface '%s' seems to have mutating methods\", type.getName());\n\t\tfinal List<Interface> extendsInterfaces = SourceCodeReader.findExtends(type);\n\t\tfinal String interfaceName = type.getName();\n\t\treturn new ImmutableInterfaceAnalysis(annotations, extendsInterfaces, imports.asList(), interfaceName, methods, pkg);\n\t}", "public void spawnThread(DukeController controller, int check_interval) {\n this.controller = controller;\n timer = mgr.schedule(this, 0, check_interval * 1000); // convert to ms\n }", "public void linkOneToMany(Object obj, CollectionDescriptor cod, boolean insert)\n {\n Object referencedObjects = cod.getPersistentField().get(obj);\n storeAndLinkOneToMany(true, obj, cod,referencedObjects, insert);\n }", "public static <E> void retainAll(Collection<E> elems, Filter<? super E> filter) {\r\n for (Iterator<E> iter = elems.iterator(); iter.hasNext();) {\r\n E elem = iter.next();\r\n if ( ! filter.accept(elem)) {\r\n iter.remove();\r\n }\r\n }\r\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}" ]
Get a property as a json object or null. @param key the property name
[ "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 }" ]
[ "@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 String dir = null;\n List<Integer> nodeIds = null;\n Boolean allNodes = true;\n Boolean verbose = false;\n\n // parse command-line input\n args = AdminToolUtils.copyArrayAddFirst(args, \"--\" + OPT_HEAD_META_GET);\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_GET);\n AdminParserUtils.checkRequired(options, AdminParserUtils.OPT_URL);\n AdminParserUtils.checkOptional(options,\n AdminParserUtils.OPT_NODE,\n AdminParserUtils.OPT_ALL_NODES);\n\n // load parameters\n metaKeys = (List<String>) options.valuesOf(OPT_HEAD_META_GET);\n url = (String) options.valueOf(AdminParserUtils.OPT_URL);\n if(options.has(AdminParserUtils.OPT_DIR)) {\n dir = (String) options.valueOf(AdminParserUtils.OPT_DIR);\n }\n if(options.has(AdminParserUtils.OPT_NODE)) {\n nodeIds = (List<Integer>) options.valuesOf(AdminParserUtils.OPT_NODE);\n allNodes = false;\n }\n if(options.has(OPT_VERBOSE)) {\n verbose = true;\n }\n\n // execute command\n File directory = AdminToolUtils.createDir(dir);\n AdminClient adminClient = AdminToolUtils.getAdminClient(url);\n\n if(allNodes) {\n nodeIds = AdminToolUtils.getAllNodeIds(adminClient);\n }\n\n if(metaKeys.size() == 1 && metaKeys.get(0).equals(METAKEY_ALL)) {\n metaKeys = Lists.newArrayList();\n for(Object key: MetadataStore.METADATA_KEYS) {\n metaKeys.add((String) key);\n }\n }\n\n doMetaGet(adminClient, nodeIds, metaKeys, directory, verbose);\n }", "@Override\n public void stop()\n {\n synchronized (killHook)\n {\n jqmlogger.info(\"JQM engine \" + this.node.getName() + \" has received a stop order\");\n\n // Kill hook should be removed\n try\n {\n if (!Runtime.getRuntime().removeShutdownHook(killHook))\n {\n jqmlogger.error(\"The engine could not unregister its shutdown hook\");\n }\n }\n catch (IllegalStateException e)\n {\n // This happens if the stop sequence is initiated by the shutdown hook itself.\n jqmlogger.info(\"Stop order is due to an admin operation (KILL/INT)\");\n }\n }\n\n // Stop pollers\n int pollerCount = pollers.size();\n for (QueuePoller p : pollers.values())\n {\n p.stop();\n }\n\n // Scheduler\n this.scheduler.stop();\n\n // Jetty is closed automatically when all pollers are down\n\n // Wait for the end of the world\n if (pollerCount > 0)\n {\n try\n {\n this.ended.acquire();\n }\n catch (InterruptedException e)\n {\n jqmlogger.error(\"interrupted\", e);\n }\n }\n\n // Send a KILL signal to remaining job instances, and wait some more.\n if (this.getCurrentlyRunningJobCount() > 0)\n {\n this.runningJobInstanceManager.killAll();\n try\n {\n Thread.sleep(10000);\n }\n catch (InterruptedException e)\n {\n jqmlogger.error(\"interrupted\", e);\n }\n }\n\n jqmlogger.debug(\"Stop order was correctly handled. Engine for node \" + this.node.getName() + \" has stopped.\");\n }", "private String toResourceNameOnClasspath(String classPathRootOnDisk, File file) {\n String fileName = file.getAbsolutePath().replace(\"\\\\\", \"/\");\n return fileName.substring(classPathRootOnDisk.length());\n }", "public synchronized ControlPoint getControlPoint(final String deploymentName, final String entryPointName) {\n ControlPointIdentifier id = new ControlPointIdentifier(deploymentName, entryPointName);\n ControlPoint ep = entryPoints.get(id);\n if (ep == null) {\n ep = new ControlPoint(this, deploymentName, entryPointName, trackIndividualControlPoints);\n entryPoints.put(id, ep);\n }\n ep.increaseReferenceCount();\n return ep;\n }", "public static dnszone_domain_binding[] get(nitro_service service, String zonename) throws Exception{\n\t\tdnszone_domain_binding obj = new dnszone_domain_binding();\n\t\tobj.set_zonename(zonename);\n\t\tdnszone_domain_binding response[] = (dnszone_domain_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "private void processScheduleOptions()\n {\n List<Row> rows = getRows(\"schedoptions\", \"proj_id\", m_projectID);\n if (rows.isEmpty() == false)\n {\n Row row = rows.get(0);\n Map<String, Object> customProperties = new HashMap<String, Object>();\n customProperties.put(\"LagCalendar\", row.getString(\"sched_calendar_on_relationship_lag\"));\n customProperties.put(\"RetainedLogic\", Boolean.valueOf(row.getBoolean(\"sched_retained_logic\")));\n customProperties.put(\"ProgressOverride\", Boolean.valueOf(row.getBoolean(\"sched_progress_override\")));\n customProperties.put(\"IgnoreOtherProjectRelationships\", row.getString(\"sched_outer_depend_type\"));\n customProperties.put(\"StartToStartLagCalculationType\", Boolean.valueOf(row.getBoolean(\"sched_lag_early_start_flag\")));\n m_reader.getProject().getProjectProperties().setCustomProperties(customProperties);\n }\n }", "public void mergeSubtree(final OperationTransformerRegistry targetRegistry, final Map<PathAddress, ModelVersion> subTree) {\n for(Map.Entry<PathAddress, ModelVersion> entry: subTree.entrySet()) {\n mergeSubtree(targetRegistry, entry.getKey(), entry.getValue());\n }\n }", "public static void inner_reorder_lower(DMatrix1Row A , DMatrix1Row B )\n {\n final int cols = A.numCols;\n B.reshape(cols,cols);\n\n Arrays.fill(B.data,0);\n for (int i = 0; i <cols; i++) {\n for (int j = 0; j <=i; j++) {\n B.data[i*cols+j] += A.data[i]*A.data[j];\n }\n\n for (int k = 1; k < A.numRows; k++) {\n int indexRow = k*cols;\n double valI = A.data[i+indexRow];\n int indexB = i*cols;\n for (int j = 0; j <= i; j++) {\n B.data[indexB++] += valI*A.data[indexRow++];\n }\n }\n }\n }", "public static csparameter get(nitro_service service) throws Exception{\n\t\tcsparameter obj = new csparameter();\n\t\tcsparameter[] response = (csparameter[])obj.get_resources(service);\n\t\treturn response[0];\n\t}" ]
Returns the compact records for all stories on the task. @param task Globally unique identifier for the task. @return Request object
[ "public CollectionRequest<Story> findByTask(String task) {\n \n String path = String.format(\"/tasks/%s/stories\", task);\n return new CollectionRequest<Story>(this, Story.class, path, \"GET\");\n }" ]
[ "@Override public void setUniqueID(Integer uniqueID)\n {\n ProjectFile parent = getParentFile();\n\n if (m_uniqueID != null)\n {\n parent.getCalendars().unmapUniqueID(m_uniqueID);\n }\n\n parent.getCalendars().mapUniqueID(uniqueID, this);\n\n m_uniqueID = uniqueID;\n }", "private boolean isAllNumeric(TokenStream stream) {\n List<Token> tokens = ((NattyTokenSource) stream.getTokenSource()).getTokens();\n for(Token token:tokens) {\n try {\n Integer.parseInt(token.getText());\n } catch(NumberFormatException e) {\n return false;\n }\n }\n return true;\n }", "public int size() {\n\t\tint size = cleared ? 0 : snapshot.size();\n\t\tfor ( Map.Entry<RowKey,AssociationOperation> op : currentState.entrySet() ) {\n\t\t\tswitch ( op.getValue().getType() ) {\n\t\t\t\tcase PUT:\n\t\t\t\t\tif ( cleared || !snapshot.containsKey( op.getKey() ) ) {\n\t\t\t\t\t\tsize++;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase REMOVE:\n\t\t\t\t\tif ( !cleared && snapshot.containsKey( op.getKey() ) ) {\n\t\t\t\t\t\tsize--;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn size;\n\t}", "public 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 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 }", "public void useNewRESTServiceWithOldClient() throws Exception {\n List<Object> providers = createJAXRSProviders();\n\n com.example.customerservice.CustomerService customerService = JAXRSClientFactory\n .createFromModel(\"http://localhost:\" + port + \"/examples/direct/new-rest\", \n com.example.customerservice.CustomerService.class,\n \"classpath:/model/CustomerService-jaxrs.xml\", \n providers, \n null);\n \n // The outgoing old Customer data needs to be transformed for \n // the new service to understand it and the response from the new service\n // needs to be transformed for this old client to understand it.\n ClientConfiguration config = WebClient.getConfig(customerService);\n addTransformInterceptors(config.getInInterceptors(),\n config.getOutInterceptors(),\n false);\n \n \n System.out.println(\"Using new RESTful CustomerService with old Client\");\n\n customer.v1.Customer customer = createOldCustomer(\"Smith Old to New REST\");\n customerService.updateCustomer(customer);\n\n customer = customerService.getCustomerByName(\"Smith Old to New REST\");\n printOldCustomerDetails(customer);\n }", "@Override\n public ModelNode resolveValue(ExpressionResolver resolver, ModelNode value) throws OperationFailedException {\n\n // Pass non-OBJECT 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.OBJECT ? value : super.resolveValue(resolver, value);\n\n // If it's not an OBJECT (almost certainly UNDEFINED), then nothing more we can do\n if (superResult.getType() != ModelType.OBJECT) {\n return superResult;\n }\n\n // Resolve each field.\n // Don't mess with the original value\n ModelNode clone = superResult == value ? value.clone() : superResult;\n ModelNode result = new ModelNode();\n for (AttributeDefinition field : valueTypes) {\n String fieldName = field.getName();\n if (clone.has(fieldName)) {\n result.get(fieldName).set(field.resolveValue(resolver, clone.get(fieldName)));\n } else {\n // Input doesn't have a child for this field.\n // Don't create one in the output unless the AD produces a default value.\n // TBH this doesn't make a ton of sense, since any object should have\n // all of its fields, just some may be undefined. But doing it this\n // way may avoid breaking some code that is incorrectly checking node.has(\"xxx\")\n // instead of node.hasDefined(\"xxx\")\n ModelNode val = field.resolveValue(resolver, new ModelNode());\n if (val.isDefined()) {\n result.get(fieldName).set(val);\n }\n }\n }\n // Validate the entire object\n getValidator().validateParameter(getName(), result);\n return result;\n }", "public static base_response update(nitro_service client, inat resource) throws Exception {\n\t\tinat updateresource = new inat();\n\t\tupdateresource.name = resource.name;\n\t\tupdateresource.privateip = resource.privateip;\n\t\tupdateresource.tcpproxy = resource.tcpproxy;\n\t\tupdateresource.ftp = resource.ftp;\n\t\tupdateresource.tftp = resource.tftp;\n\t\tupdateresource.usip = resource.usip;\n\t\tupdateresource.usnip = resource.usnip;\n\t\tupdateresource.proxyip = resource.proxyip;\n\t\tupdateresource.mode = resource.mode;\n\t\treturn updateresource.update_resource(client);\n\t}", "@Override\n public Configuration configuration() {\n return new MostUsefulConfiguration()\n // where to find the stories\n .useStoryLoader(new LoadFromClasspath(this.getClass())) \n // CONSOLE and TXT reporting\n .useStoryReporterBuilder(new StoryReporterBuilder().withDefaultFormats().withFormats(Format.CONSOLE, Format.TXT)); \n }" ]
Toggle between single events and series. @param isSeries flag, indicating if we want a series of events.
[ "public void setIsSeries(Boolean isSeries) {\r\n\r\n if (null != isSeries) {\r\n final boolean series = isSeries.booleanValue();\r\n if ((null != m_model.getParentSeriesId()) && series) {\r\n m_removeSeriesBindingConfirmDialog.show(new Command() {\r\n\r\n public void execute() {\r\n\r\n m_model.setParentSeriesId(null);\r\n setPattern(PatternType.DAILY.toString());\r\n\r\n }\r\n });\r\n } else {\r\n setPattern(series ? PatternType.DAILY.toString() : PatternType.NONE.toString());\r\n }\r\n }\r\n }" ]
[ "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 int deleteById(DatabaseConnection databaseConnection, ID id, ObjectCache objectCache) throws SQLException {\n\t\tif (mappedDelete == null) {\n\t\t\tmappedDelete = MappedDelete.build(dao, tableInfo);\n\t\t}\n\t\tint result = mappedDelete.deleteById(databaseConnection, id, objectCache);\n\t\tif (dao != null && !localIsInBatchMode.get()) {\n\t\t\tdao.notifyChanges();\n\t\t}\n\t\treturn result;\n\t}", "private void\n executeSubBatch(final int batchId,\n RebalanceBatchPlanProgressBar progressBar,\n final Cluster batchRollbackCluster,\n final List<StoreDefinition> batchRollbackStoreDefs,\n final List<RebalanceTaskInfo> rebalanceTaskPlanList,\n boolean hasReadOnlyStores,\n boolean hasReadWriteStores,\n boolean finishedReadOnlyStores) {\n RebalanceUtils.printBatchLog(batchId,\n logger,\n \"Submitting rebalance tasks \");\n\n // Get an ExecutorService in place used for submitting our tasks\n ExecutorService service = RebalanceUtils.createExecutors(maxParallelRebalancing);\n\n // Sub-list of the above list\n final List<RebalanceTask> failedTasks = Lists.newArrayList();\n final List<RebalanceTask> incompleteTasks = Lists.newArrayList();\n\n // Semaphores for donor nodes - To avoid multiple disk sweeps\n Map<Integer, Semaphore> donorPermits = new HashMap<Integer, Semaphore>();\n for(Node node: batchRollbackCluster.getNodes()) {\n donorPermits.put(node.getId(), new Semaphore(1));\n }\n\n try {\n // List of tasks which will run asynchronously\n List<RebalanceTask> allTasks = executeTasks(batchId,\n progressBar,\n service,\n rebalanceTaskPlanList,\n donorPermits);\n RebalanceUtils.printBatchLog(batchId,\n logger,\n \"All rebalance tasks submitted\");\n\n // Wait and shutdown after (infinite) timeout\n RebalanceUtils.executorShutDown(service, Long.MAX_VALUE);\n RebalanceUtils.printBatchLog(batchId,\n logger,\n \"Finished waiting for executors\");\n\n // Collects all failures + incomplete tasks from the rebalance\n // tasks.\n List<Exception> failures = Lists.newArrayList();\n for(RebalanceTask task: allTasks) {\n if(task.hasException()) {\n failedTasks.add(task);\n failures.add(task.getError());\n } else if(!task.isComplete()) {\n incompleteTasks.add(task);\n }\n }\n\n if(failedTasks.size() > 0) {\n throw new VoldemortRebalancingException(\"Rebalance task terminated unsuccessfully on tasks \"\n + failedTasks,\n failures);\n }\n\n // If there were no failures, then we could have had a genuine\n // timeout ( Rebalancing took longer than the operator expected ).\n // We should throw a VoldemortException and not a\n // VoldemortRebalancingException ( which will start reverting\n // metadata ). The operator may want to manually then resume the\n // process.\n if(incompleteTasks.size() > 0) {\n throw new VoldemortException(\"Rebalance tasks are still incomplete / running \"\n + incompleteTasks);\n }\n\n } catch(VoldemortRebalancingException e) {\n\n logger.error(\"Failure while migrating partitions for rebalance task \"\n + batchId);\n\n if(hasReadOnlyStores && hasReadWriteStores\n && finishedReadOnlyStores) {\n // Case 0\n adminClient.rebalanceOps.rebalanceStateChange(null,\n batchRollbackCluster,\n null,\n batchRollbackStoreDefs,\n null,\n true,\n true,\n false,\n false,\n false);\n } else if(hasReadWriteStores && finishedReadOnlyStores) {\n // Case 4\n adminClient.rebalanceOps.rebalanceStateChange(null,\n batchRollbackCluster,\n null,\n batchRollbackStoreDefs,\n null,\n false,\n true,\n false,\n false,\n false);\n }\n\n throw e;\n\n } finally {\n if(!service.isShutdown()) {\n RebalanceUtils.printErrorLog(batchId,\n logger,\n \"Could not shutdown service cleanly for rebalance task \"\n + batchId,\n null);\n service.shutdownNow();\n }\n }\n }", "public SingleAssetEuropeanOptionProductDescriptor getDescriptor(LocalDate referenceDate, int index) throws ArrayIndexOutOfBoundsException{\n\t\tLocalDate maturityDate = FloatingpointDate.getDateFromFloatingPointDate(referenceDate, maturity);\n\t\tif(index >= strikes.length) {\n\t\t\tthrow new ArrayIndexOutOfBoundsException(\"Strike index out of bounds\");\n\t\t}else {\n\t\t\treturn new SingleAssetEuropeanOptionProductDescriptor(underlyingName, maturityDate, strikes[index]);\n\t\t}\n\t}", "public void setValueSelected(T value, boolean selected) {\n int idx = getIndex(value);\n if (idx >= 0) {\n setItemSelectedInternal(idx, selected);\n }\n }", "public static <E> Collection<E> collectify(ObjectMapper mapper, Object source, Class<? extends Collection> targetCollectionType, Class<E> targetElementType) {\n CollectionType collectionType = mapper.getTypeFactory().constructCollectionType(targetCollectionType, targetElementType);\n return objectify(mapper, convertToCollection(source), collectionType);\n }", "public void applyToOr(TextView textView, ColorStateList colorDefault) {\n if (mColorInt != 0) {\n textView.setTextColor(mColorInt);\n } else if (mColorRes != -1) {\n textView.setTextColor(ContextCompat.getColor(textView.getContext(), mColorRes));\n } else if (colorDefault != null) {\n textView.setTextColor(colorDefault);\n }\n }", "protected boolean checkPackageLocators(String classPackageName) {\n\t\tif (packageLocators != null && !disablePackageLocatorsScanning && classPackageName.length() > 0\n\t\t\t\t&& (packageLocatorsBasePackage == null || classPackageName.startsWith(packageLocatorsBasePackage))) {\n\t\t\tfor (String packageLocator : packageLocators) {\n\t\t\t\tString[] splitted = classPackageName.split(\"\\\\.\");\n\n\t\t\t\tif (es.cenobit.struts2.json.util.StringUtils.contains(splitted, packageLocator, false))\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "public synchronized void stop() {\r\n\r\n if (m_thread != null) {\r\n long timeBeforeShutdownWasCalled = System.currentTimeMillis();\r\n JLANServer.shutdownServer(new String[] {});\r\n while (m_thread.isAlive()\r\n && ((System.currentTimeMillis() - timeBeforeShutdownWasCalled) < MAX_SHUTDOWN_WAIT_MILLIS)) {\r\n try {\r\n Thread.sleep(500);\r\n } catch (InterruptedException e) {\r\n // ignore\r\n }\r\n }\r\n }\r\n\r\n }" ]
Parse the URI and get all the parameters in map form. Query name -&gt; List of Query values. @param rawQuery query portion of the uri to analyze.
[ "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 }" ]
[ "private void validateQuery(Query query) throws IllegalArgumentException {\n if (query.getKindCount() != 1) {\n throw new IllegalArgumentException(\"Query must have exactly one kind.\");\n }\n if (query.getOrderCount() != 0) {\n throw new IllegalArgumentException(\"Query cannot have any sort orders.\");\n }\n if (query.hasFilter()) {\n validateFilter(query.getFilter());\n }\n }", "public static String base64Encode(byte[] bytes) {\n if (bytes == null) {\n throw new IllegalArgumentException(\"Input bytes must not be null.\");\n }\n if (bytes.length >= BASE64_UPPER_BOUND) {\n throw new IllegalArgumentException(\n \"Input bytes length must not exceed \" + BASE64_UPPER_BOUND);\n }\n\n // Every three bytes is encoded into four characters.\n //\n // Example:\n // input |0 1 0 1 0 0 1 0|0 1 1 0 1 1 1 1|0 1 1 0 0 0 1 0|\n // encode grouping |0 1 0 1 0 0|1 0 0 1 1 0|1 1 1 1 0 1|1 0 0 0 1 0|\n // encoded ascii | U | m | 9 | i |\n\n int triples = bytes.length / 3;\n\n // If the number of input bytes is not a multiple of three, padding characters will be added.\n if (bytes.length % 3 != 0) {\n triples += 1;\n }\n\n // The encoded string will have four characters for every three bytes.\n char[] encoding = new char[triples << 2];\n\n for (int in = 0, out = 0; in < bytes.length; in += 3, out += 4) {\n int triple = (bytes[in] & 0xff) << 16;\n if (in + 1 < bytes.length) {\n triple |= ((bytes[in + 1] & 0xff) << 8);\n }\n if (in + 2 < bytes.length) {\n triple |= (bytes[in + 2] & 0xff);\n }\n encoding[out] = BASE64_CHARS.charAt((triple >> 18) & 0x3f);\n encoding[out + 1] = BASE64_CHARS.charAt((triple >> 12) & 0x3f);\n encoding[out + 2] = BASE64_CHARS.charAt((triple >> 6) & 0x3f);\n encoding[out + 3] = BASE64_CHARS.charAt(triple & 0x3f);\n }\n\n // Add padding characters if needed.\n for (int i = encoding.length - (triples * 3 - bytes.length); i < encoding.length; i++) {\n encoding[i] = '=';\n }\n\n return String.valueOf(encoding);\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 boolean respondsTo(Object object, String methodName) {\r\n MetaClass metaClass = DefaultGroovyMethods.getMetaClass(object);\r\n if (!metaClass.respondsTo(object, methodName).isEmpty()) {\r\n return true;\r\n }\r\n Map properties = DefaultGroovyMethods.getProperties(object);\r\n return properties.containsKey(methodName);\r\n }", "public final void updateLastCheckTime(final String id, final long lastCheckTime) {\n final CriteriaBuilder builder = getSession().getCriteriaBuilder();\n final CriteriaUpdate<PrintJobStatusExtImpl> update =\n builder.createCriteriaUpdate(PrintJobStatusExtImpl.class);\n final Root<PrintJobStatusExtImpl> root = update.from(PrintJobStatusExtImpl.class);\n update.where(builder.equal(root.get(\"referenceId\"), id));\n update.set(root.get(\"lastCheckTime\"), lastCheckTime);\n getSession().createQuery(update).executeUpdate();\n }", "public URI withEmptyAuthority(final URI uri) {\n URI _xifexpression = null;\n if ((uri.isFile() && (uri.authority() == null))) {\n _xifexpression = URI.createHierarchicalURI(uri.scheme(), \"\", uri.device(), uri.segments(), uri.query(), uri.fragment());\n } else {\n _xifexpression = uri;\n }\n return _xifexpression;\n }", "public CmsScheduledJobInfo getJob(String id) {\n\n Iterator<CmsScheduledJobInfo> it = m_jobs.iterator();\n while (it.hasNext()) {\n CmsScheduledJobInfo job = it.next();\n if (job.getId().equals(id)) {\n return job;\n }\n }\n // not found\n return null;\n }", "public BeanDefinitionInfo toDto(BeanDefinition beanDefinition) {\n\t\tif (beanDefinition instanceof GenericBeanDefinition) {\n\t\t\tGenericBeanDefinitionInfo info = new GenericBeanDefinitionInfo();\n\t\t\tinfo.setClassName(beanDefinition.getBeanClassName());\n\n\t\t\tif (beanDefinition.getPropertyValues() != null) {\n\t\t\t\tMap<String, BeanMetadataElementInfo> propertyValues = new HashMap<String, BeanMetadataElementInfo>();\n\t\t\t\tfor (PropertyValue value : beanDefinition.getPropertyValues().getPropertyValueList()) {\n\t\t\t\t\tObject obj = value.getValue();\n\t\t\t\t\tif (obj instanceof BeanMetadataElement) {\n\t\t\t\t\t\tpropertyValues.put(value.getName(), toDto((BeanMetadataElement) obj));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new IllegalArgumentException(\"Type \" + obj.getClass().getName()\n\t\t\t\t\t\t\t\t+ \" is not a BeanMetadataElement for property: \" + value.getName());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tinfo.setPropertyValues(propertyValues);\n\t\t\t}\n\t\t\treturn info;\n\t\t} else {\n\t\t\tthrow new IllegalArgumentException(\"Conversion to DTO of \" + beanDefinition.getClass().getName()\n\t\t\t\t\t+ \" not implemented\");\n\t\t}\n\t}", "@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 }" ]
Helper method that encapsulates the minimum logic for adding jobs to a queue. @param jedis the connection to Redis @param namespace the Resque namespace @param queue the Resque queue name @param jobJsons a list of jobs serialized as JSON
[ "public static void doBatchEnqueue(final Jedis jedis, final String namespace, final String queue, final List<String> jobJsons) {\n Pipeline pipelined = jedis.pipelined();\n pipelined.sadd(JesqueUtils.createKey(namespace, QUEUES), queue);\n for (String jobJson : jobJsons) {\n pipelined.rpush(JesqueUtils.createKey(namespace, QUEUE, queue), jobJson);\n }\n pipelined.sync();\n }" ]
[ "@Override\n public int getShadowSize() {\n\tElement shadowElement = shadow.getElement();\n\tshadowElement.setScrollTop(10000);\n\treturn shadowElement.getScrollTop();\n }", "public static final Date utc2date(Long time) {\n\n // don't accept negative values\n if (time == null || time < 0) return null;\n \n // add the timezone offset\n time += timezoneOffsetMillis(new Date(time));\n\n return new Date(time);\n }", "public static <ResultT> PollingState<ResultT> createFromPollingState(PollingState<?> other, ResultT result) {\n PollingState<ResultT> pollingState = new PollingState<>();\n pollingState.resource = result;\n pollingState.initialHttpMethod = other.initialHttpMethod();\n pollingState.status = other.status();\n pollingState.statusCode = other.statusCode();\n pollingState.azureAsyncOperationHeaderLink = other.azureAsyncOperationHeaderLink();\n pollingState.locationHeaderLink = other.locationHeaderLink();\n pollingState.putOrPatchResourceUri = other.putOrPatchResourceUri();\n pollingState.defaultRetryTimeout = other.defaultRetryTimeout;\n pollingState.retryTimeout = other.retryTimeout;\n pollingState.loggingContext = other.loggingContext;\n pollingState.finalStateVia = other.finalStateVia;\n return pollingState;\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 }", "private void readProjectExtendedAttributes(Project project)\n {\n Project.ExtendedAttributes attributes = project.getExtendedAttributes();\n if (attributes != null)\n {\n for (Project.ExtendedAttributes.ExtendedAttribute ea : attributes.getExtendedAttribute())\n {\n readFieldAlias(ea);\n }\n }\n }", "private void registerInterceptor(Node source,\n String beanName,\n BeanDefinitionRegistry registry) {\n List<String> methodList = buildMethodList(source);\n\n BeanDefinitionBuilder initializer =\n BeanDefinitionBuilder.rootBeanDefinition(SingleServiceWrapperInterceptor.class);\n initializer.addPropertyValue(\"methods\", methodList);\n\n String perfMonitorName = beanName + \"PerformanceMonitor\";\n initializer.addPropertyReference(\"serviceWrapper\", perfMonitorName);\n\n String interceptorName = beanName + \"PerformanceMonitorInterceptor\";\n registry.registerBeanDefinition(interceptorName, initializer.getBeanDefinition());\n }", "public int executeTask(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, final ServerUpdateTask task) {\n try {\n return execute(listener, task.getServerIdentity(), task.getOperation());\n } catch (OperationFailedException e) {\n // Handle failures operation transformation failures\n final ServerIdentity identity = task.getServerIdentity();\n final ServerOperation serverOperation = new ServerOperation(identity, task.getOperation(), null, null, OperationResultTransformer.ORIGINAL_RESULT);\n final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e);\n listener.operationPrepared(result);\n recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), OperationResultTransformer.ORIGINAL_RESULT));\n return 1; // 1 ms timeout since there is no reason to wait for the locally stored result\n }\n\n }", "private static void updateBaseCalendarNames(List<Pair<ProjectCalendar, BigInteger>> baseCalendars, HashMap<BigInteger, ProjectCalendar> map)\n {\n for (Pair<ProjectCalendar, BigInteger> pair : baseCalendars)\n {\n ProjectCalendar cal = pair.getFirst();\n BigInteger baseCalendarID = pair.getSecond();\n ProjectCalendar baseCal = map.get(baseCalendarID);\n if (baseCal != null)\n {\n cal.setParent(baseCal);\n }\n }\n\n }", "protected void mergeHardcodedResultsFrom(Configuration otherConfiguration) {\r\n Map<Dotted, AnalysisResult> resultsMap = hardcodedResults.build().stream()\r\n .collect(Collectors.toMap(r -> r.className, r -> r));\r\n resultsMap.putAll(otherConfiguration.hardcodedResults());\r\n hardcodedResults = ImmutableSet.<AnalysisResult>builder().addAll(resultsMap.values());\r\n }" ]
Get all views from the list content @return list of views currently visible
[ "public List<Widget> getAllViews() {\n List<Widget> views = new ArrayList<>();\n for (Widget child: mContent.getChildren()) {\n Widget item = ((ListItemHostWidget) child).getGuest();\n if (item != null) {\n views.add(item);\n }\n }\n return views;\n }" ]
[ "public int getXForBeat(int beat) {\n BeatGrid grid = beatGrid.get();\n if (grid != null) {\n return millisecondsToX(grid.getTimeWithinTrack(beat));\n }\n return 0;\n }", "public static String makeHTMLTable(String[][] table, String[] rowLabels, String[] colLabels) {\r\n StringBuilder buff = new StringBuilder();\r\n buff.append(\"<table class=\\\"auto\\\" border=\\\"1\\\" cellspacing=\\\"0\\\">\\n\");\r\n // top row\r\n buff.append(\"<tr>\\n\");\r\n buff.append(\"<td></td>\\n\"); // the top left cell\r\n for (int j = 0; j < table[0].length; j++) { // assume table is a rectangular matrix\r\n buff.append(\"<td class=\\\"label\\\">\").append(colLabels[j]).append(\"</td>\\n\");\r\n }\r\n buff.append(\"</tr>\\n\");\r\n // all other rows\r\n for (int i = 0; i < table.length; i++) {\r\n // one row\r\n buff.append(\"<tr>\\n\");\r\n buff.append(\"<td class=\\\"label\\\">\").append(rowLabels[i]).append(\"</td>\\n\");\r\n for (int j = 0; j < table[i].length; j++) {\r\n buff.append(\"<td class=\\\"data\\\">\");\r\n buff.append(((table[i][j] != null) ? table[i][j] : \"\"));\r\n buff.append(\"</td>\\n\");\r\n }\r\n buff.append(\"</tr>\\n\");\r\n }\r\n buff.append(\"</table>\");\r\n return buff.toString();\r\n }", "public <T extends StatementDocument> void nullEdit(ItemIdValue itemId)\n\t\t\tthrows IOException, MediaWikiApiErrorException {\n\t\tItemDocument currentDocument = (ItemDocument) this.wikibaseDataFetcher\n\t\t\t\t.getEntityDocument(itemId.getId());\n\t\t\n\t\tnullEdit(currentDocument);\n\t}", "public static final String hexdump(byte[] buffer, int offset, int length, boolean ascii, int columns, String prefix)\n {\n StringBuilder sb = new StringBuilder();\n if (buffer != null)\n {\n int index = offset;\n DecimalFormat df = new DecimalFormat(\"00000\");\n\n while (index < (offset + length))\n {\n if (index + columns > (offset + length))\n {\n columns = (offset + length) - index;\n }\n\n sb.append(prefix);\n sb.append(df.format(index - offset));\n sb.append(\":\");\n sb.append(hexdump(buffer, index, columns, ascii));\n sb.append('\\n');\n\n index += columns;\n }\n }\n\n return (sb.toString());\n }", "public Metadata replace(String path, String value) {\n this.values.set(this.pathToProperty(path), value);\n this.addOp(\"replace\", path, value);\n return this;\n }", "public IPv4Address getEmbeddedIPv4Address(int byteIndex) {\n\t\tif(byteIndex == IPv6Address.MIXED_ORIGINAL_SEGMENT_COUNT * IPv6Address.BYTES_PER_SEGMENT) {\n\t\t\treturn getEmbeddedIPv4Address();\n\t\t}\n\t\tIPv4AddressCreator creator = getIPv4Network().getAddressCreator();\n\t\treturn creator.createAddress(getSection().getEmbeddedIPv4AddressSection(byteIndex, byteIndex + IPv4Address.BYTE_COUNT)); /* address creation */\n\t}", "public String getHealthMemory() {\n StringBuilder sb = new StringBuilder();\n sb.append(\"Logging JVM Stats\\n\");\n MonitorProvider mp = MonitorProvider.getInstance();\n PerformUsage perf = mp.getJVMMemoryUsage();\n sb.append(perf.toString());\n\n if (perf.memoryUsagePercent >= THRESHOLD_PERCENT) {\n sb.append(\"========= WARNING: MEM USAGE > \" + THRESHOLD_PERCENT\n + \"!!\");\n sb.append(\" !! Live Threads List=============\\n\");\n sb.append(mp.getThreadUsage().toString());\n sb.append(\"========================================\\n\");\n sb.append(\"========================JVM Thread Dump====================\\n\");\n ThreadInfo[] threadDump = mp.getThreadDump();\n for (ThreadInfo threadInfo : threadDump) {\n sb.append(threadInfo.toString() + \"\\n\");\n }\n sb.append(\"===========================================================\\n\");\n }\n sb.append(\"Logged JVM Stats\\n\");\n\n return sb.toString();\n }", "private static boolean scanForEndSig(File file, FileChannel channel) throws IOException, NonScannableZipException {\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 boolean firstRead = true;\n while (lastChannelPos >= end) {\n\n read(bb, channel, channelPos);\n\n int actualRead = bb.limit();\n if (firstRead) {\n long expectedRead = Math.min(CHUNK_SIZE, start);\n if (actualRead > expectedRead) {\n // File is still growing\n return false;\n }\n firstRead = false;\n }\n\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 && ENDSIG_PATTERN[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 // 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)) {\n return true;\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 -= END_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 false;\n }", "protected static List<StackTraceElement> filterStackTrace(StackTraceElement[] stack) {\r\n List<StackTraceElement> filteredStack = new ArrayList<StackTraceElement>();\r\n\r\n int i = 2; // we can skip the first two (first is getStackTrace(), second is this method)\r\n while (i < stack.length) {\r\n boolean isLoggingClass = false;\r\n for (String loggingClass : loggingClasses) {\r\n String className = stack[i].getClassName();\r\n if (className.startsWith(loggingClass)) {\r\n isLoggingClass = true;\r\n break;\r\n }\r\n }\r\n if (!isLoggingClass) {\r\n filteredStack.add(stack[i]);\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n // if we didn't find anything, keep the full stack\r\n if (filteredStack.size() == 0) {\r\n return Arrays.asList(stack);\r\n }\r\n return filteredStack;\r\n }" ]
Use this API to fetch dnstxtrec resources of given names .
[ "public static dnstxtrec[] get(nitro_service service, String domain[]) throws Exception{\n\t\tif (domain !=null && domain.length>0) {\n\t\t\tdnstxtrec response[] = new dnstxtrec[domain.length];\n\t\t\tdnstxtrec obj[] = new dnstxtrec[domain.length];\n\t\t\tfor (int i=0;i<domain.length;i++) {\n\t\t\t\tobj[i] = new dnstxtrec();\n\t\t\t\tobj[i].set_domain(domain[i]);\n\t\t\t\tresponse[i] = (dnstxtrec) obj[i].get_resource(service);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t\treturn null;\n\t}" ]
[ "public Table createTable(ProjectFile file, byte[] data, VarMeta varMeta, Var2Data varData)\n {\n Table table = new Table();\n\n table.setID(MPPUtility.getInt(data, 0));\n table.setResourceFlag(MPPUtility.getShort(data, 108) == 1);\n table.setName(MPPUtility.removeAmpersands(MPPUtility.getUnicodeString(data, 4)));\n\n byte[] columnData = null;\n Integer tableID = Integer.valueOf(table.getID());\n if (m_tableColumnDataBaseline != null)\n {\n columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataBaseline));\n }\n\n if (columnData == null)\n {\n columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataEnterprise));\n if (columnData == null)\n {\n columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataStandard));\n }\n }\n\n processColumnData(file, table, columnData);\n\n //System.out.println(table);\n\n return (table);\n }", "public Date getNextWorkStart(Date date)\n {\n Calendar cal = Calendar.getInstance();\n cal.setTime(date);\n updateToNextWorkStart(cal);\n return cal.getTime();\n }", "public static boolean inArea(Point point, Rect area, float offsetRatio) {\n int offset = (int) (area.width() * offsetRatio);\n return point.x >= area.left - offset && point.x <= area.right + offset &&\n point.y >= area.top - offset && point.y <= area.bottom + offset;\n }", "public boolean contains(String id) {\n assertNotEmpty(id, \"id\");\n InputStream response = null;\n try {\n response = couchDbClient.head(new DatabaseURIHelper(dbUri).documentUri(id));\n } catch (NoDocumentException e) {\n return false;\n } finally {\n close(response);\n }\n return true;\n }", "public void addFileSet(FileSet fs) {\n add(fs);\n if (fs.getProject() == null) {\n fs.setProject(getProject());\n }\n }", "public static base_response add(nitro_service client, nssimpleacl resource) throws Exception {\n\t\tnssimpleacl addresource = new nssimpleacl();\n\t\taddresource.aclname = resource.aclname;\n\t\taddresource.aclaction = resource.aclaction;\n\t\taddresource.td = resource.td;\n\t\taddresource.srcip = resource.srcip;\n\t\taddresource.destport = resource.destport;\n\t\taddresource.protocol = resource.protocol;\n\t\taddresource.ttl = resource.ttl;\n\t\treturn addresource.add_resource(client);\n\t}", "public void update()\n {\n ProjectProperties properties = m_projectFile.getProjectProperties();\n char decimalSeparator = properties.getDecimalSeparator();\n char thousandsSeparator = properties.getThousandsSeparator();\n m_unitsDecimalFormat.applyPattern(\"#.##\", null, decimalSeparator, thousandsSeparator);\n m_decimalFormat.applyPattern(\"0.00#\", null, decimalSeparator, thousandsSeparator);\n m_durationDecimalFormat.applyPattern(\"#.##\", null, decimalSeparator, thousandsSeparator);\n m_percentageDecimalFormat.applyPattern(\"##0.##\", null, decimalSeparator, thousandsSeparator);\n updateCurrencyFormats(properties, decimalSeparator, thousandsSeparator);\n updateDateTimeFormats(properties);\n }", "private void fillWeekPanel() {\r\n\r\n addCheckBox(WeekOfMonth.FIRST.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_1_0);\r\n addCheckBox(WeekOfMonth.SECOND.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_2_0);\r\n addCheckBox(WeekOfMonth.THIRD.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_3_0);\r\n addCheckBox(WeekOfMonth.FOURTH.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_4_0);\r\n addCheckBox(WeekOfMonth.LAST.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_5_0);\r\n }", "public static bridgegroup_nsip_binding[] get(nitro_service service, Long id) throws Exception{\n\t\tbridgegroup_nsip_binding obj = new bridgegroup_nsip_binding();\n\t\tobj.set_id(id);\n\t\tbridgegroup_nsip_binding response[] = (bridgegroup_nsip_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}" ]
Scans all Forge addons for files accepted by given filter.
[ "public List<URL> scan(Predicate<String> filter)\n {\n List<URL> discoveredURLs = new ArrayList<>(128);\n\n // For each Forge addon...\n for (Addon addon : furnace.getAddonRegistry().getAddons(AddonFilters.allStarted()))\n {\n List<String> filteredResourcePaths = filterAddonResources(addon, filter);\n for (String filePath : filteredResourcePaths)\n {\n URL ruleFile = addon.getClassLoader().getResource(filePath);\n if (ruleFile != null)\n discoveredURLs.add(ruleFile);\n }\n }\n return discoveredURLs;\n }" ]
[ "public static appfwprofile_safeobject_binding[] get(nitro_service service, String name) throws Exception{\n\t\tappfwprofile_safeobject_binding obj = new appfwprofile_safeobject_binding();\n\t\tobj.set_name(name);\n\t\tappfwprofile_safeobject_binding response[] = (appfwprofile_safeobject_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "public final void reset()\n {\n for (int i = 0; i < combinationIndices.length; i++)\n {\n combinationIndices[i] = i;\n }\n remainingCombinations = totalCombinations;\n }", "public List<CmsCategory> getTopItems() {\n\n List<CmsCategory> categories = new ArrayList<CmsCategory>();\n String matcher = Pattern.quote(m_mainCategoryPath) + \"[^/]*/\";\n for (CmsCategory category : m_categories) {\n if (category.getPath().matches(matcher)) {\n categories.add(category);\n }\n }\n return categories;\n }", "public PayloadBuilder sound(final String sound) {\n if (sound != null) {\n aps.put(\"sound\", sound);\n } else {\n aps.remove(\"sound\");\n }\n return this;\n }", "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 }", "public static Integer getDurationUnits(RecurringTask recurrence)\n {\n Duration duration = recurrence.getDuration();\n Integer result = null;\n\n if (duration != null)\n {\n result = UNITS_MAP.get(duration.getUnits());\n }\n\n return (result);\n }", "private Object getValue(FieldType field, byte[] block)\n {\n Object result = null;\n\n switch (block[0])\n {\n case 0x07: // Field\n {\n result = getFieldType(block);\n break;\n }\n\n case 0x01: // Constant value\n {\n result = getConstantValue(field, block);\n break;\n }\n\n case 0x00: // Prompt\n {\n result = getPromptValue(field, block);\n break;\n }\n }\n\n return result;\n }", "public void fireAssignmentReadEvent(ResourceAssignment resourceAssignment)\n {\n if (m_projectListeners != null)\n {\n for (ProjectListener listener : m_projectListeners)\n {\n listener.assignmentRead(resourceAssignment);\n }\n }\n }", "protected Connection newConnectionFromDataSource(JdbcConnectionDescriptor jcd)\r\n throws LookupException\r\n {\r\n Connection retval = null;\r\n // use JNDI lookup\r\n DataSource ds = jcd.getDataSource();\r\n\r\n if (ds == null)\r\n {\r\n // [tomdz] Would it suffice to store the datasources only at the JCDs ?\r\n // Only possible problem would be serialization of the JCD because\r\n // the data source object in the JCD does not 'survive' this\r\n ds = (DataSource) dataSourceCache.get(jcd.getDatasourceName());\r\n }\r\n try\r\n {\r\n if (ds == null)\r\n {\r\n /**\r\n * this synchronization block won't be a big deal as we only look up\r\n * new datasources not found in the map.\r\n */\r\n synchronized (dataSourceCache)\r\n {\r\n InitialContext ic = new InitialContext();\r\n ds = (DataSource) ic.lookup(jcd.getDatasourceName());\r\n /**\r\n * cache the datasource lookup.\r\n */\r\n dataSourceCache.put(jcd.getDatasourceName(), ds);\r\n }\r\n }\r\n if (jcd.getUserName() == null)\r\n {\r\n retval = ds.getConnection();\r\n }\r\n else\r\n {\r\n retval = ds.getConnection(jcd.getUserName(), jcd.getPassWord());\r\n }\r\n }\r\n catch (SQLException sqlEx)\r\n {\r\n log.error(\"SQLException thrown while trying to get Connection from Datasource (\" +\r\n jcd.getDatasourceName() + \")\", sqlEx);\r\n throw new LookupException(\"SQLException thrown while trying to get Connection from Datasource (\" +\r\n jcd.getDatasourceName() + \")\", sqlEx);\r\n }\r\n catch (NamingException namingEx)\r\n {\r\n log.error(\"Naming Exception while looking up DataSource (\" + jcd.getDatasourceName() + \")\", namingEx);\r\n throw new LookupException(\"Naming Exception while looking up DataSource (\" + jcd.getDatasourceName() +\r\n \")\", namingEx);\r\n }\r\n // initialize connection\r\n initializeJdbcConnection(retval, jcd);\r\n if(log.isDebugEnabled()) log.debug(\"Create new connection using DataSource: \"+retval);\r\n return retval;\r\n }" ]
Bilinear interpolation of ARGB values. @param x the X interpolation parameter 0..1 @param y the y interpolation parameter 0..1 @param rgb array of four ARGB values in the order NW, NE, SW, SE @return the interpolated value
[ "public static int bilinearInterpolate(float x, float y, int nw, int ne, int sw, int se) {\n\t\tfloat m0, m1;\n\t\tint a0 = (nw >> 24) & 0xff;\n\t\tint r0 = (nw >> 16) & 0xff;\n\t\tint g0 = (nw >> 8) & 0xff;\n\t\tint b0 = nw & 0xff;\n\t\tint a1 = (ne >> 24) & 0xff;\n\t\tint r1 = (ne >> 16) & 0xff;\n\t\tint g1 = (ne >> 8) & 0xff;\n\t\tint b1 = ne & 0xff;\n\t\tint a2 = (sw >> 24) & 0xff;\n\t\tint r2 = (sw >> 16) & 0xff;\n\t\tint g2 = (sw >> 8) & 0xff;\n\t\tint b2 = sw & 0xff;\n\t\tint a3 = (se >> 24) & 0xff;\n\t\tint r3 = (se >> 16) & 0xff;\n\t\tint g3 = (se >> 8) & 0xff;\n\t\tint b3 = se & 0xff;\n\n\t\tfloat cx = 1.0f-x;\n\t\tfloat cy = 1.0f-y;\n\n\t\tm0 = cx * a0 + x * a1;\n\t\tm1 = cx * a2 + x * a3;\n\t\tint a = (int)(cy * m0 + y * m1);\n\n\t\tm0 = cx * r0 + x * r1;\n\t\tm1 = cx * r2 + x * r3;\n\t\tint r = (int)(cy * m0 + y * m1);\n\n\t\tm0 = cx * g0 + x * g1;\n\t\tm1 = cx * g2 + x * g3;\n\t\tint g = (int)(cy * m0 + y * m1);\n\n\t\tm0 = cx * b0 + x * b1;\n\t\tm1 = cx * b2 + x * b3;\n\t\tint b = (int)(cy * m0 + y * m1);\n\n\t\treturn (a << 24) | (r << 16) | (g << 8) | b;\n\t}" ]
[ "public void setFrustum(float[] frustum)\n {\n Matrix4f projMatrix = new Matrix4f();\n projMatrix.setFrustum(frustum[0], frustum[3], frustum[1], frustum[4], frustum[2], frustum[5]);\n setFrustum(projMatrix);\n }", "public static base_response add(nitro_service client, locationfile resource) throws Exception {\n\t\tlocationfile addresource = new locationfile();\n\t\taddresource.Locationfile = resource.Locationfile;\n\t\taddresource.format = resource.format;\n\t\treturn addresource.add_resource(client);\n\t}", "@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoLocalDateTime<JulianDate> localDateTime(TemporalAccessor temporal) {\n return (ChronoLocalDateTime<JulianDate>) super.localDateTime(temporal);\n }", "public static base_response add(nitro_service client, vpnsessionaction resource) throws Exception {\n\t\tvpnsessionaction addresource = new vpnsessionaction();\n\t\taddresource.name = resource.name;\n\t\taddresource.httpport = resource.httpport;\n\t\taddresource.winsip = resource.winsip;\n\t\taddresource.dnsvservername = resource.dnsvservername;\n\t\taddresource.splitdns = resource.splitdns;\n\t\taddresource.sesstimeout = resource.sesstimeout;\n\t\taddresource.clientsecurity = resource.clientsecurity;\n\t\taddresource.clientsecuritygroup = resource.clientsecuritygroup;\n\t\taddresource.clientsecuritymessage = resource.clientsecuritymessage;\n\t\taddresource.clientsecuritylog = resource.clientsecuritylog;\n\t\taddresource.splittunnel = resource.splittunnel;\n\t\taddresource.locallanaccess = resource.locallanaccess;\n\t\taddresource.rfc1918 = resource.rfc1918;\n\t\taddresource.spoofiip = resource.spoofiip;\n\t\taddresource.killconnections = resource.killconnections;\n\t\taddresource.transparentinterception = resource.transparentinterception;\n\t\taddresource.windowsclienttype = resource.windowsclienttype;\n\t\taddresource.defaultauthorizationaction = resource.defaultauthorizationaction;\n\t\taddresource.authorizationgroup = resource.authorizationgroup;\n\t\taddresource.clientidletimeout = resource.clientidletimeout;\n\t\taddresource.proxy = resource.proxy;\n\t\taddresource.allprotocolproxy = resource.allprotocolproxy;\n\t\taddresource.httpproxy = resource.httpproxy;\n\t\taddresource.ftpproxy = resource.ftpproxy;\n\t\taddresource.socksproxy = resource.socksproxy;\n\t\taddresource.gopherproxy = resource.gopherproxy;\n\t\taddresource.sslproxy = resource.sslproxy;\n\t\taddresource.proxyexception = resource.proxyexception;\n\t\taddresource.proxylocalbypass = resource.proxylocalbypass;\n\t\taddresource.clientcleanupprompt = resource.clientcleanupprompt;\n\t\taddresource.forcecleanup = resource.forcecleanup;\n\t\taddresource.clientoptions = resource.clientoptions;\n\t\taddresource.clientconfiguration = resource.clientconfiguration;\n\t\taddresource.sso = resource.sso;\n\t\taddresource.ssocredential = resource.ssocredential;\n\t\taddresource.windowsautologon = resource.windowsautologon;\n\t\taddresource.usemip = resource.usemip;\n\t\taddresource.useiip = resource.useiip;\n\t\taddresource.clientdebug = resource.clientdebug;\n\t\taddresource.loginscript = resource.loginscript;\n\t\taddresource.logoutscript = resource.logoutscript;\n\t\taddresource.homepage = resource.homepage;\n\t\taddresource.icaproxy = resource.icaproxy;\n\t\taddresource.wihome = resource.wihome;\n\t\taddresource.citrixreceiverhome = resource.citrixreceiverhome;\n\t\taddresource.wiportalmode = resource.wiportalmode;\n\t\taddresource.clientchoices = resource.clientchoices;\n\t\taddresource.epaclienttype = resource.epaclienttype;\n\t\taddresource.iipdnssuffix = resource.iipdnssuffix;\n\t\taddresource.forcedtimeout = resource.forcedtimeout;\n\t\taddresource.forcedtimeoutwarning = resource.forcedtimeoutwarning;\n\t\taddresource.ntdomain = resource.ntdomain;\n\t\taddresource.clientlessvpnmode = resource.clientlessvpnmode;\n\t\taddresource.emailhome = resource.emailhome;\n\t\taddresource.clientlessmodeurlencoding = resource.clientlessmodeurlencoding;\n\t\taddresource.clientlesspersistentcookie = resource.clientlesspersistentcookie;\n\t\taddresource.allowedlogingroups = resource.allowedlogingroups;\n\t\taddresource.securebrowse = resource.securebrowse;\n\t\taddresource.storefronturl = resource.storefronturl;\n\t\taddresource.kcdaccount = resource.kcdaccount;\n\t\treturn addresource.add_resource(client);\n\t}", "public static base_responses unlink(nitro_service client, sslcertkey resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tsslcertkey unlinkresources[] = new sslcertkey[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tunlinkresources[i] = new sslcertkey();\n\t\t\t\tunlinkresources[i].certkey = resources[i].certkey;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, unlinkresources,\"unlink\");\n\t\t}\n\t\treturn result;\n\t}", "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 double computeHouseholder(double []x , int xStart , int xEnd , double max , DScalar gamma ) {\n double tau = 0;\n for (int i = xStart; i < xEnd ; i++) {\n double val = x[i] /= max;\n tau += val*val;\n }\n tau = Math.sqrt(tau);\n if( x[xStart] < 0 ) {\n tau = -tau;\n }\n double u_0 = x[xStart] + tau;\n gamma.value = u_0/tau;\n x[xStart] = 1;\n for (int i = xStart+1; i < xEnd ; i++) {\n x[i] /= u_0;\n }\n\n return -tau*max;\n }", "public void signOff(String key, WebSocketConnection connection) {\n ConcurrentMap<WebSocketConnection, WebSocketConnection> connections = registry.get(key);\n if (null == connections) {\n return;\n }\n connections.remove(connection);\n }", "private static void validatePseudoScopedBean(Bean<?> bean, BeanManagerImpl beanManager) {\n if (bean.getInjectionPoints().isEmpty()) {\n // Skip validation if there are no injection points (e.g. for classes which are not intended to be used as beans)\n return;\n }\n reallyValidatePseudoScopedBean(bean, beanManager, new LinkedHashSet<Object>(), new HashSet<Bean<?>>());\n }" ]
Handles adding a key. Calls the registered listener and wraps it's method in some GUI adjustments.
[ "void handleAddKey() {\n\n String key = m_addKeyInput.getValue();\n if (m_listener.handleAddKey(key)) {\n Notification.show(\n key.isEmpty()\n ? m_messages.key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_EMPTY_KEY_SUCCESSFULLY_ADDED_0)\n : m_messages.key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_KEY_SUCCESSFULLY_ADDED_1, key));\n } else {\n CmsMessageBundleEditorTypes.showWarning(\n m_messages.key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_KEY_ALREADEY_EXISTS_CAPTION_0),\n m_messages.key(Messages.GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_KEY_ALREADEY_EXISTS_DESCRIPTION_1, key));\n\n }\n m_addKeyInput.focus();\n m_addKeyInput.selectAll();\n }" ]
[ "private void printKeySet() {\r\n Set<?> keys = keySet();\r\n System.out.println(\"printing keyset:\");\r\n for (Object o: keys) {\r\n //System.out.println(Arrays.asList((Object[]) i.next()));\r\n System.out.println(o);\r\n }\r\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 }", "public PhotoList<Photo> getRecent(Set<String> extras, int perPage, int page) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_RECENT);\r\n\r\n if (extras != null && !extras.isEmpty()) {\r\n parameters.put(Extras.KEY_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\r\n Response response = transport.get(transport.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n Element photosElement = response.getPayload();\r\n PhotoList<Photo> photos = PhotoUtils.createPhotoList(photosElement);\r\n return photos;\r\n }", "public static byte[] domainControllerDataToByteBuffer(List<DomainControllerData> data) throws Exception {\n final ByteArrayOutputStream out_stream = new ByteArrayOutputStream(512);\n byte[] result;\n try (DataOutputStream out = new DataOutputStream(out_stream)) {\n Iterator<DomainControllerData> iter = data.iterator();\n while (iter.hasNext()) {\n DomainControllerData dcData = iter.next();\n dcData.writeTo(out);\n if (iter.hasNext()) {\n S3Util.writeString(SEPARATOR, out);\n }\n }\n result = out_stream.toByteArray();\n }\n return result;\n }", "public static base_responses reset(nitro_service client, Interface resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tInterface resetresources[] = new Interface[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tresetresources[i] = new Interface();\n\t\t\t\tresetresources[i].id = resources[i].id;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, resetresources,\"reset\");\n\t\t}\n\t\treturn result;\n\t}", "public String toDecodedString(final java.net.URI uri) {\n final String scheme = uri.getScheme();\n final String part = uri.getSchemeSpecificPart();\n if ((scheme == null)) {\n return part;\n }\n return ((scheme + \":\") + part);\n }", "public SslHandler create(ByteBufAllocator bufferAllocator) {\n SSLEngine engine = sslContext.newEngine(bufferAllocator);\n engine.setNeedClientAuth(needClientAuth);\n engine.setUseClientMode(false);\n return new SslHandler(engine);\n }", "private HiveShellContainer createHiveServerContainer(final List<? extends Script> scripts, final Object testCase, TemporaryFolder baseDir) \n throws IOException {\n\n HiveServerContext context = new StandaloneHiveServerContext(baseDir, config);\n\n final HiveServerContainer hiveTestHarness = new HiveServerContainer(context);\n\n HiveShellBuilder hiveShellBuilder = new HiveShellBuilder();\n hiveShellBuilder.setCommandShellEmulation(config.getCommandShellEmulator());\n\n HiveShellField shellSetter = loadScriptUnderTest(testCase, hiveShellBuilder);\n if (scripts != null) {\n hiveShellBuilder.overrideScriptsUnderTest(scripts);\n }\n\n hiveShellBuilder.setHiveServerContainer(hiveTestHarness);\n\n loadAnnotatedResources(testCase, hiveShellBuilder);\n\n loadAnnotatedProperties(testCase, hiveShellBuilder);\n\n loadAnnotatedSetupScripts(testCase, hiveShellBuilder);\n\n // Build shell\n final HiveShellContainer shell = hiveShellBuilder.buildShell();\n\n // Set shell\n shellSetter.setShell(shell);\n\n if (shellSetter.isAutoStart()) {\n shell.start();\n }\n\n return shell;\n }", "public List<Versioned<V>> getWithCustomTimeout(CompositeVoldemortRequest<K, V> requestWrapper) {\n validateTimeout(requestWrapper.getRoutingTimeoutInMs());\n for(int attempts = 0; attempts < this.metadataRefreshAttempts; attempts++) {\n try {\n long startTimeInMs = System.currentTimeMillis();\n String keyHexString = \"\";\n if(logger.isDebugEnabled()) {\n ByteArray key = (ByteArray) requestWrapper.getKey();\n keyHexString = RestUtils.getKeyHexString(key);\n debugLogStart(\"GET\",\n requestWrapper.getRequestOriginTimeInMs(),\n startTimeInMs,\n keyHexString);\n }\n List<Versioned<V>> items = store.get(requestWrapper);\n if(logger.isDebugEnabled()) {\n int vcEntrySize = 0;\n for(Versioned<V> vc: items) {\n vcEntrySize += ((VectorClock) vc.getVersion()).getVersionMap().size();\n }\n debugLogEnd(\"GET\",\n requestWrapper.getRequestOriginTimeInMs(),\n startTimeInMs,\n System.currentTimeMillis(),\n keyHexString,\n vcEntrySize);\n }\n return items;\n } catch(InvalidMetadataException e) {\n logger.info(\"Received invalid metadata exception during get [ \" + e.getMessage()\n + \" ] on store '\" + storeName + \"'. Rebootstrapping\");\n bootStrap();\n }\n }\n throw new VoldemortException(this.metadataRefreshAttempts\n + \" metadata refresh attempts failed.\");\n }" ]
Get the filters ImporterServiceFilter and ImportDeclarationFilter from the properties, stop the instance if one of. them is invalid.
[ "private void processProperties() {\n state = true;\n try {\n importerServiceFilter = getFilter(importerServiceFilterProperty);\n } catch (InvalidFilterException invalidFilterException) {\n LOG.debug(\"The value of the Property \" + FILTER_IMPORTERSERVICE_PROPERTY + \" is invalid,\"\n + \" the recuperation of the Filter has failed. The instance gonna stop.\", invalidFilterException);\n state = false;\n return;\n }\n\n try {\n importDeclarationFilter = getFilter(importDeclarationFilterProperty);\n } catch (InvalidFilterException invalidFilterException) {\n LOG.debug(\"The value of the Property \" + FILTER_IMPORTDECLARATION_PROPERTY + \" is invalid,\"\n + \" the recuperation of the Filter has failed. The instance gonna stop.\", invalidFilterException);\n state = false;\n return;\n }\n }" ]
[ "public HiveShellContainer evaluateStatement(List<? extends Script> scripts, Object target, TemporaryFolder temporaryFolder, Statement base) throws Throwable {\n container = null;\n FileUtil.setPermission(temporaryFolder.getRoot(), FsPermission.getDirDefault());\n try {\n LOGGER.info(\"Setting up {} in {}\", getName(), temporaryFolder.getRoot().getAbsolutePath());\n container = createHiveServerContainer(scripts, target, temporaryFolder);\n base.evaluate();\n return container;\n } finally {\n tearDown();\n }\n }", "public void init( DMatrixRMaj A ) {\n if( A.numRows != A.numCols)\n throw new IllegalArgumentException(\"Must be square\");\n\n if( A.numCols != N ) {\n N = A.numCols;\n QT.reshape(N,N, false);\n\n if( w.length < N ) {\n w = new double[ N ];\n gammas = new double[N];\n b = new double[N];\n }\n }\n\n // just copy the top right triangle\n QT.set(A);\n }", "public Authentication getAuthentication(String token) {\n\t\tif (null != token) {\n\t\t\tTokenContainer container = tokens.get(token);\n\t\t\tif (null != container) {\n\t\t\t\tif (container.isValid()) {\n\t\t\t\t\treturn container.getAuthentication();\n\t\t\t\t} else {\n\t\t\t\t\tlogout(token);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "public void setSize(ButtonSize size) {\n if (this.size != null) {\n removeStyleName(this.size.getCssName());\n }\n this.size = size;\n\n if (size != null) {\n addStyleName(size.getCssName());\n }\n }", "public static base_responses enable(nitro_service client, String trapname[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (trapname != null && trapname.length > 0) {\n\t\t\tsnmpalarm enableresources[] = new snmpalarm[trapname.length];\n\t\t\tfor (int i=0;i<trapname.length;i++){\n\t\t\t\tenableresources[i] = new snmpalarm();\n\t\t\t\tenableresources[i].trapname = trapname[i];\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, enableresources,\"enable\");\n\t\t}\n\t\treturn result;\n\t}", "public void createDB() throws PlatformException\r\n {\r\n if (_creationScript == null)\r\n {\r\n createCreationScript();\r\n }\r\n\r\n Project project = new Project();\r\n TorqueDataModelTask modelTask = new TorqueDataModelTask();\r\n File tmpDir = null;\r\n File scriptFile = null;\r\n \r\n try\r\n {\r\n tmpDir = new File(getWorkDir(), \"schemas\");\r\n tmpDir.mkdir();\r\n\r\n scriptFile = new File(tmpDir, CREATION_SCRIPT_NAME);\r\n\r\n writeCompressedText(scriptFile, _creationScript);\r\n\r\n project.setBasedir(tmpDir.getAbsolutePath());\r\n\r\n // we use the ant task 'sql' to perform the creation script\r\n\t SQLExec sqlTask = new SQLExec();\r\n\t SQLExec.OnError onError = new SQLExec.OnError();\r\n\t\r\n\t onError.setValue(\"continue\");\r\n\t sqlTask.setProject(project);\r\n\t sqlTask.setAutocommit(true);\r\n\t sqlTask.setDriver(_jcd.getDriver());\r\n\t sqlTask.setOnerror(onError);\r\n\t sqlTask.setUserid(_jcd.getUserName());\r\n\t sqlTask.setPassword(_jcd.getPassWord() == null ? \"\" : _jcd.getPassWord());\r\n\t sqlTask.setUrl(getDBCreationUrl());\r\n\t sqlTask.setSrc(scriptFile);\r\n\t sqlTask.execute();\r\n\r\n\t deleteDir(tmpDir);\r\n }\r\n catch (Exception ex)\r\n {\r\n // clean-up\r\n if ((tmpDir != null) && tmpDir.exists())\r\n {\r\n try\r\n {\r\n scriptFile.delete();\r\n }\r\n catch (NullPointerException e) \r\n {\r\n LoggerFactory.getLogger(this.getClass()).error(\"NPE While deleting scriptFile [\" + scriptFile.getName() + \"]\", e);\r\n }\r\n }\r\n throw new PlatformException(ex);\r\n }\r\n }", "public long number(ImapRequestLineReader request) throws ProtocolException {\n String digits = consumeWord(request, new DigitCharValidator());\n return Long.parseLong(digits);\n }", "public boolean getBooleanProperty(String name, boolean defaultValue)\r\n {\r\n return PropertyHelper.toBoolean(_properties.getProperty(name), defaultValue);\r\n }", "public static base_response update(nitro_service client, cachecontentgroup resource) throws Exception {\n\t\tcachecontentgroup updateresource = new cachecontentgroup();\n\t\tupdateresource.name = resource.name;\n\t\tupdateresource.weakposrelexpiry = resource.weakposrelexpiry;\n\t\tupdateresource.heurexpiryparam = resource.heurexpiryparam;\n\t\tupdateresource.relexpiry = resource.relexpiry;\n\t\tupdateresource.relexpirymillisec = resource.relexpirymillisec;\n\t\tupdateresource.absexpiry = resource.absexpiry;\n\t\tupdateresource.absexpirygmt = resource.absexpirygmt;\n\t\tupdateresource.weaknegrelexpiry = resource.weaknegrelexpiry;\n\t\tupdateresource.hitparams = resource.hitparams;\n\t\tupdateresource.invalparams = resource.invalparams;\n\t\tupdateresource.ignoreparamvaluecase = resource.ignoreparamvaluecase;\n\t\tupdateresource.matchcookies = resource.matchcookies;\n\t\tupdateresource.invalrestrictedtohost = resource.invalrestrictedtohost;\n\t\tupdateresource.polleverytime = resource.polleverytime;\n\t\tupdateresource.ignorereloadreq = resource.ignorereloadreq;\n\t\tupdateresource.removecookies = resource.removecookies;\n\t\tupdateresource.prefetch = resource.prefetch;\n\t\tupdateresource.prefetchperiod = resource.prefetchperiod;\n\t\tupdateresource.prefetchperiodmillisec = resource.prefetchperiodmillisec;\n\t\tupdateresource.prefetchmaxpending = resource.prefetchmaxpending;\n\t\tupdateresource.flashcache = resource.flashcache;\n\t\tupdateresource.expireatlastbyte = resource.expireatlastbyte;\n\t\tupdateresource.insertvia = resource.insertvia;\n\t\tupdateresource.insertage = resource.insertage;\n\t\tupdateresource.insertetag = resource.insertetag;\n\t\tupdateresource.cachecontrol = resource.cachecontrol;\n\t\tupdateresource.quickabortsize = resource.quickabortsize;\n\t\tupdateresource.minressize = resource.minressize;\n\t\tupdateresource.maxressize = resource.maxressize;\n\t\tupdateresource.memlimit = resource.memlimit;\n\t\tupdateresource.ignorereqcachinghdrs = resource.ignorereqcachinghdrs;\n\t\tupdateresource.minhits = resource.minhits;\n\t\tupdateresource.alwaysevalpolicies = resource.alwaysevalpolicies;\n\t\tupdateresource.persist = resource.persist;\n\t\tupdateresource.pinned = resource.pinned;\n\t\tupdateresource.lazydnsresolve = resource.lazydnsresolve;\n\t\tupdateresource.hitselector = resource.hitselector;\n\t\tupdateresource.invalselector = resource.invalselector;\n\t\treturn updateresource.update_resource(client);\n\t}" ]
Reconnect to the HC. @return whether the server is still in sync @throws IOException
[ "synchronized boolean doReConnect() throws IOException {\n\n // In case we are still connected, test the connection and see if we can reuse it\n if(connectionManager.isConnected()) {\n try {\n final Future<Long> result = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult();\n result.get(15, TimeUnit.SECONDS); // Hmm, perhaps 15 is already too much\n return true;\n } catch (Exception e) {\n ServerLogger.AS_ROOT_LOGGER.debugf(e, \"failed to ping the host-controller, going to reconnect\");\n }\n // Disconnect - the HC might have closed the connection without us noticing and is asking for a reconnect\n final Connection connection = connectionManager.getConnection();\n StreamUtils.safeClose(connection);\n if(connection != null) {\n try {\n // Wait for the connection to be closed\n connection.awaitClosed();\n } catch (InterruptedException e) {\n throw new InterruptedIOException();\n }\n }\n }\n\n boolean ok = false;\n final Connection connection = connectionManager.connect();\n try {\n // Reconnect to the host-controller\n final ActiveOperation<Boolean, Void> result = channelHandler.executeRequest(new ServerReconnectRequest(), null);\n try {\n boolean inSync = result.getResult().get();\n ok = true;\n reconnectRunner = null;\n return inSync;\n } catch (ExecutionException e) {\n throw new IOException(e);\n } catch (InterruptedException e) {\n throw new InterruptedIOException();\n }\n } finally {\n if(!ok) {\n StreamUtils.safeClose(connection);\n }\n }\n }" ]
[ "public List<Map<String, String>> produceNWise(int nWise, String[] coVariables, Map<String, String[]> variableDomains) {\r\n List<Set<String>> tuples = makeNWiseTuples(coVariables, nWise);\n\r\n List<Map<String, String>> testCases = new ArrayList<>();\r\n for (Set<String> tuple : tuples) {\r\n testCases.addAll(expandTupleIntoTestCases(tuple, variableDomains));\r\n }\n\r\n return testCases;\r\n }", "public boolean checkSuffixes(String uri, String[] patterns) {\n\t\tfor (String pattern : patterns) {\n\t\t\tif (pattern.length() > 0) {\n\t\t\t\tif (uri.endsWith(pattern)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "@SuppressWarnings(\"unchecked\")\n public <V3, M4, C, N, Q> V3 getUp(AiWrapperProvider<V3, M4, C, N, Q> \n wrapperProvider) {\n \n return (V3) m_up;\n }", "@UiHandler({\"m_atMonth\", \"m_everyMonth\"})\r\n void onMonthChange(ValueChangeEvent<String> event) {\r\n\r\n if (handleChange()) {\r\n m_controller.setMonth(event.getValue());\r\n }\r\n }", "private String parseLayerId(HttpServletRequest request) {\n\t\tStringTokenizer tokenizer = new StringTokenizer(request.getRequestURI(), \"/\");\n\t\tString token = \"\";\n\t\twhile (tokenizer.hasMoreTokens()) {\n\t\t\ttoken = tokenizer.nextToken();\n\t\t}\n\t\treturn token;\n\t}", "static BsonDocument getVersionedFilter(\n @Nonnull final BsonValue documentId,\n @Nullable final BsonValue version\n ) {\n final BsonDocument filter = new BsonDocument(\"_id\", documentId);\n if (version == null) {\n filter.put(DOCUMENT_VERSION_FIELD, new BsonDocument(\"$exists\", BsonBoolean.FALSE));\n } else {\n filter.put(DOCUMENT_VERSION_FIELD, version);\n }\n return filter;\n }", "public static void main(String[] args) throws Exception {\n if(args.length < 1)\n Utils.croak(\"USAGE: java \" + HdfsFetcher.class.getName()\n + \" url [keytab-location kerberos-username hadoop-config-path [destDir]]\");\n String url = args[0];\n\n VoldemortConfig config = new VoldemortConfig(-1, \"\");\n\n HdfsFetcher fetcher = new HdfsFetcher(config);\n\n String destDir = null;\n Long diskQuotaSizeInKB;\n if(args.length >= 4) {\n fetcher.voldemortConfig.setReadOnlyKeytabPath(args[1]);\n fetcher.voldemortConfig.setReadOnlyKerberosUser(args[2]);\n fetcher.voldemortConfig.setHadoopConfigPath(args[3]);\n }\n if(args.length >= 5)\n destDir = args[4];\n\n if(args.length >= 6)\n diskQuotaSizeInKB = Long.parseLong(args[5]);\n else\n diskQuotaSizeInKB = null;\n\n // for testing we want to be able to download a single file\n allowFetchingOfSingleFile = true;\n\n FileSystem fs = HadoopUtils.getHadoopFileSystem(fetcher.voldemortConfig, url);\n Path p = new Path(url);\n\n FileStatus status = fs.listStatus(p)[0];\n long size = status.getLen();\n long start = System.currentTimeMillis();\n if(destDir == null)\n destDir = System.getProperty(\"java.io.tmpdir\") + File.separator + start;\n\n File location = fetcher.fetch(url, destDir, null, null, -1, null, diskQuotaSizeInKB);\n\n double rate = size * Time.MS_PER_SECOND / (double) (System.currentTimeMillis() - start);\n NumberFormat nf = NumberFormat.getInstance();\n nf.setMaximumFractionDigits(2);\n System.out.println(\"Fetch to \" + location + \" completed: \"\n + nf.format(rate / (1024.0 * 1024.0)) + \" MB/sec.\");\n fs.close();\n }", "public void setModificationState(ModificationState newModificationState)\r\n {\r\n if(newModificationState != modificationState)\r\n {\r\n if(log.isDebugEnabled())\r\n {\r\n log.debug(\"object state transition for object \" + this.oid + \" (\"\r\n + modificationState + \" --> \" + newModificationState + \")\");\r\n// try{throw new Exception();}catch(Exception e)\r\n// {\r\n// e.printStackTrace();\r\n// }\r\n }\r\n modificationState = newModificationState;\r\n }\r\n }", "public TransformersSubRegistration getServerRegistration(final ModelVersionRange range) {\n final PathAddress address = PathAddress.EMPTY_ADDRESS.append(HOST, SERVER);\n return new TransformersSubRegistrationImpl(range, domain, address);\n }" ]
Start speech recognizer. @param speechListener
[ "public void start(GVRAccessibilitySpeechListener speechListener) {\n mTts.setSpeechListener(speechListener);\n mTts.getSpeechRecognizer().startListening(mTts.getSpeechRecognizerIntent());\n }" ]
[ "@VisibleForTesting\n public static void runMain(final String[] args) throws Exception {\n final CliHelpDefinition helpCli = new CliHelpDefinition();\n\n try {\n Args.parse(helpCli, args);\n if (helpCli.help) {\n printUsage(0);\n return;\n }\n } catch (IllegalArgumentException invalidOption) {\n // Ignore because it is probably one of the non-help options.\n }\n\n final CliDefinition cli = new CliDefinition();\n try {\n List<String> unusedArguments = Args.parse(cli, args);\n\n if (!unusedArguments.isEmpty()) {\n System.out.println(\"\\n\\nThe following arguments are not recognized: \" + unusedArguments);\n printUsage(1);\n return;\n }\n } catch (IllegalArgumentException invalidOption) {\n System.out.println(\"\\n\\n\" + invalidOption.getMessage());\n printUsage(1);\n return;\n }\n configureLogs(cli.verbose);\n\n AbstractXmlApplicationContext context = new ClassPathXmlApplicationContext(DEFAULT_SPRING_CONTEXT);\n\n if (cli.springConfig != null) {\n context = new ClassPathXmlApplicationContext(DEFAULT_SPRING_CONTEXT, cli.springConfig);\n }\n try {\n context.getBean(Main.class).run(cli);\n } finally {\n context.close();\n }\n }", "private double getExpectedProbability(double x)\n {\n double y = 1 / (standardDeviation * Math.sqrt(Math.PI * 2));\n double z = -(Math.pow(x - mean, 2) / (2 * Math.pow(standardDeviation, 2)));\n return y * Math.exp(z);\n }", "public Integer getTextureMagFilter(AiTextureType type, int index) {\n checkTexRange(type, index);\n\n Property p = getProperty(PropertyKey.TEX_MAG_FILTER.m_key);\n\n if (null == p || null == p.getData()) {\n return (Integer) m_defaults.get(PropertyKey.TEX_MAG_FILTER);\n }\n Object rawValue = p.getData();\n if (rawValue instanceof java.nio.ByteBuffer)\n {\n java.nio.IntBuffer ibuf = ((java.nio.ByteBuffer) rawValue).asIntBuffer();\n return ibuf.get();\n }\n else\n {\n return (Integer) rawValue;\n }\n }", "@Deprecated\n public ClientConfig setNodeBannagePeriod(int nodeBannagePeriod, TimeUnit unit) {\n this.failureDetectorBannagePeriod = unit.toMillis(nodeBannagePeriod);\n return this;\n }", "public void removeLinks(ServiceReference<S> declarationBinderRef) {\n for (D declaration : linkerManagement.getMatchedDeclaration()) {\n if (declaration.getStatus().getServiceReferencesBounded().contains(declarationBinderRef)) {\n linkerManagement.unlink(declaration, declarationBinderRef);\n }\n }\n }", "public RedwoodConfiguration printChannels(final int width){\r\n tasks.add(new Runnable() { public void run() { Redwood.Util.printChannels(width);} });\r\n return this;\r\n }", "protected void debugLog(String operationType, Long receivedTimeInMs) {\n long durationInMs = receivedTimeInMs - (this.parsedRequestOriginTimeInMs);\n int numVectorClockEntries = (this.parsedVectorClock == null ? 0\n : this.parsedVectorClock.getVersionMap()\n .size());\n logger.debug(\"Received a new request. Operation type: \" + operationType + \" , Key(s): \"\n + keysHexString(this.parsedKeys) + \" , Store: \" + this.storeName\n + \" , Origin time (in ms): \" + (this.parsedRequestOriginTimeInMs)\n + \" , Request received at time(in ms): \" + receivedTimeInMs\n + \" , Num vector clock entries: \" + numVectorClockEntries\n + \" , Duration from RESTClient to CoordinatorRestRequestValidator(in ms): \"\n + durationInMs);\n\n }", "public final void printClientConfig(final JSONWriter json) throws JSONException {\n json.key(\"layouts\");\n json.array();\n final Map<String, Template> accessibleTemplates = getTemplates();\n accessibleTemplates.entrySet().stream().sorted(Comparator.comparing(Map.Entry::getKey))\n .forEach(entry -> {\n json.object();\n json.key(\"name\").value(entry.getKey());\n entry.getValue().printClientConfig(json);\n json.endObject();\n });\n json.endArray();\n json.key(\"smtp\").object();\n json.key(\"enabled\").value(smtp != null);\n if (smtp != null) {\n json.key(\"storage\").object();\n json.key(\"enabled\").value(smtp.getStorage() != null);\n json.endObject();\n }\n json.endObject();\n }", "public static <T> boolean addAll(Collection<T> target, Iterable<? extends T> iterable) {\n if (iterable instanceof Collection) {\n return target.addAll((Collection<? extends T>) iterable);\n }\n return Iterators.addAll(target, iterable.iterator());\n }" ]
This method writes a single predecessor link to the MSPDI file. @param taskID The task UID @param type The predecessor type @param lag The lag duration @return A new link to be added to the MSPDI file
[ "private Project.Tasks.Task.PredecessorLink writePredecessor(Integer taskID, RelationType type, Duration lag)\n {\n Project.Tasks.Task.PredecessorLink link = m_factory.createProjectTasksTaskPredecessorLink();\n\n link.setPredecessorUID(NumberHelper.getBigInteger(taskID));\n link.setType(BigInteger.valueOf(type.getValue()));\n link.setCrossProject(Boolean.FALSE); // SF-300: required to keep P6 happy when importing MSPDI files\n\n if (lag != null && lag.getDuration() != 0)\n {\n double linkLag = lag.getDuration();\n if (lag.getUnits() != TimeUnit.PERCENT && lag.getUnits() != TimeUnit.ELAPSED_PERCENT)\n {\n linkLag = 10.0 * Duration.convertUnits(linkLag, lag.getUnits(), TimeUnit.MINUTES, m_projectFile.getProjectProperties()).getDuration();\n }\n link.setLinkLag(BigInteger.valueOf((long) linkLag));\n link.setLagFormat(DatatypeConverter.printDurationTimeUnits(lag.getUnits(), false));\n }\n else\n {\n // SF-329: default required to keep Powerproject happy when importing MSPDI files\n link.setLinkLag(BIGINTEGER_ZERO);\n link.setLagFormat(DatatypeConverter.printDurationTimeUnits(m_projectFile.getProjectProperties().getDefaultDurationUnits(), false));\n }\n\n return (link);\n }" ]
[ "public void sendValue(int nodeId, int endpoint, int value) {\n\t\tZWaveNode node = this.getNode(nodeId);\n\t\tZWaveSetCommands zwaveCommandClass = null;\n\t\tSerialMessage serialMessage = null;\n\t\t\n\t\tfor (ZWaveCommandClass.CommandClass commandClass : new ZWaveCommandClass.CommandClass[] { ZWaveCommandClass.CommandClass.SWITCH_MULTILEVEL, ZWaveCommandClass.CommandClass.SWITCH_BINARY, ZWaveCommandClass.CommandClass.BASIC }) {\n\t\t\tzwaveCommandClass = (ZWaveSetCommands)node.resolveCommandClass(commandClass, endpoint);\n\t\t\tif (zwaveCommandClass != null)\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tif (zwaveCommandClass == null) {\n\t\t\tlogger.error(\"No Command Class found on node {}, instance/endpoint {} to request level.\", nodeId, endpoint);\n\t\t\treturn;\n\t\t}\n\t\t\t \n\t\tserialMessage = node.encapsulate(zwaveCommandClass.setValueMessage(value), (ZWaveCommandClass)zwaveCommandClass, endpoint);\n\t\t\n\t\tif (serialMessage != null)\n\t\t\tthis.sendData(serialMessage);\n\t\t\n\t\t// read back level on \"ON\" command\n\t\tif (((ZWaveCommandClass)zwaveCommandClass).getCommandClass() == ZWaveCommandClass.CommandClass.SWITCH_MULTILEVEL && value == 255)\n\t\t\tthis.requestValue(nodeId, endpoint);\n\t}", "public void createContainer(String container) {\n\n ContainerController controller = this.platformContainers.get(container);\n if (controller == null) {\n\n // TODO make this configurable\n Profile p = new ProfileImpl();\n p.setParameter(Profile.PLATFORM_ID, PLATFORM_ID);\n p.setParameter(Profile.MAIN_HOST, MAIN_HOST);\n p.setParameter(Profile.MAIN_PORT, MAIN_PORT);\n p.setParameter(Profile.LOCAL_HOST, MAIN_HOST);\n int port = Integer.parseInt(MAIN_PORT);\n port = port + 1 + this.platformContainers.size();\n p.setParameter(Profile.LOCAL_PORT, Integer.toString(port));\n p.setParameter(Profile.CONTAINER_NAME, container);\n logger.fine(\"Creating container \" + container + \"...\");\n ContainerController agentContainer = this.runtime\n .createAgentContainer(p);\n this.platformContainers.put(container, agentContainer);\n logger.fine(\"Container \" + container + \" created successfully.\");\n } else {\n logger.fine(\"Container \" + container + \" is already created.\");\n }\n\n }", "@Override\n public void run() {\n try {\n threadContext.activate();\n // run the original thread\n runnable.run();\n } finally {\n threadContext.invalidate();\n threadContext.deactivate();\n }\n\n }", "public Where<T, ID> le(String columnName, Object value) throws SQLException {\n\t\taddClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value,\n\t\t\t\tSimpleComparison.LESS_THAN_EQUAL_TO_OPERATION));\n\t\treturn this;\n\t}", "public static base_response add(nitro_service client, cachepolicylabel resource) throws Exception {\n\t\tcachepolicylabel addresource = new cachepolicylabel();\n\t\taddresource.labelname = resource.labelname;\n\t\taddresource.evaluates = resource.evaluates;\n\t\treturn addresource.add_resource(client);\n\t}", "public void signOff(String key, Collection<WebSocketConnection> connections) {\n if (connections.isEmpty()) {\n return;\n }\n ConcurrentMap<WebSocketConnection, WebSocketConnection> bag = ensureConnectionList(key);\n bag.keySet().removeAll(connections);\n }", "public CSTNode set( int index, CSTNode element ) \n {\n \n if( elements == null ) \n {\n throw new GroovyBugError( \"attempt to set() on a EMPTY Reduction\" );\n }\n\n if( index == 0 && !(element instanceof Token) ) \n {\n\n //\n // It's not the greatest of design that the interface allows this, but it\n // is a tradeoff with convenience, and the convenience is more important.\n\n throw new GroovyBugError( \"attempt to set() a non-Token as root of a Reduction\" );\n }\n\n\n //\n // Fill slots with nulls, if necessary.\n\n int count = elements.size();\n if( index >= count ) \n {\n for( int i = count; i <= index; i++ ) \n {\n elements.add( null );\n }\n }\n\n //\n // Then set in the element.\n\n elements.set( index, element );\n\n return element;\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}", "public void trace(String msg) {\n\t\tlogIfEnabled(Level.TRACE, null, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, null);\n\t}" ]
Fetch the next event from a given stream @return the next event @throws IOException any io exception that could occur
[ "public StitchEvent<T> nextEvent() throws IOException {\n final Event nextEvent = eventStream.nextEvent();\n if (nextEvent == null) {\n return null;\n }\n\n return StitchEvent.fromEvent(nextEvent, this.decoder);\n }" ]
[ "public Conditionals addIfMatch(Tag tag) {\n Preconditions.checkArgument(!modifiedSince.isPresent(), String.format(ERROR_MESSAGE, HeaderConstants.IF_MATCH, HeaderConstants.IF_MODIFIED_SINCE));\n Preconditions.checkArgument(noneMatch.isEmpty(), String.format(ERROR_MESSAGE, HeaderConstants.IF_MATCH, HeaderConstants.IF_NONE_MATCH));\n List<Tag> match = new ArrayList<>(this.match);\n\n if (tag == null) {\n tag = Tag.ALL;\n }\n if (Tag.ALL.equals(tag)) {\n match.clear();\n }\n if (!match.contains(Tag.ALL)) {\n if (!match.contains(tag)) {\n match.add(tag);\n }\n }\n else {\n throw new IllegalArgumentException(\"Tag ALL already in the list\");\n }\n return new Conditionals(Collections.unmodifiableList(match), empty(), Optional.empty(), unModifiedSince);\n }", "protected void reportProgress(String taskDecription) {\n if (this.progress != null) {\n if (this.progress.isCanceled()) {\n // Only AbortCompilation can stop the compiler cleanly.\n // We check cancellation again following the call to compile.\n throw new AbortCompilation(true, null);\n }\n this.progress.setTaskName(taskDecription);\n }\n }", "private void performTeardownExchange() throws IOException {\n Message teardownRequest = new Message(0xfffffffeL, Message.KnownType.TEARDOWN_REQ);\n sendMessage(teardownRequest);\n // At this point, the server closes the connection from its end, so we can’t read any more.\n }", "public static final CurrencySymbolPosition parseCurrencySymbolPosition(String value)\n {\n CurrencySymbolPosition result = CurrencySymbolPosition.BEFORE;\n\n switch (NumberHelper.getInt(value))\n {\n case 0:\n {\n result = CurrencySymbolPosition.BEFORE;\n break;\n }\n\n case 1:\n {\n result = CurrencySymbolPosition.AFTER;\n break;\n }\n\n case 2:\n {\n result = CurrencySymbolPosition.BEFORE_WITH_SPACE;\n break;\n }\n\n case 3:\n {\n result = CurrencySymbolPosition.AFTER_WITH_SPACE;\n break;\n }\n }\n\n return (result);\n }", "Map<String, EntityDocument> getEntityDocumentMap(int numOfEntities,\n\t\t\tWbGetEntitiesActionData properties)\n\t\t\tthrows MediaWikiApiErrorException, IOException {\n\t\tif (numOfEntities == 0) {\n\t\t\treturn Collections.emptyMap();\n\t\t}\n\t\tconfigureProperties(properties);\n\t\treturn this.wbGetEntitiesAction.wbGetEntities(properties);\n\t}", "public static CharSequence getAt(CharSequence text, Range range) {\n RangeInfo info = subListBorders(text.length(), range);\n CharSequence sequence = text.subSequence(info.from, info.to);\n return info.reverse ? reverse(sequence) : sequence;\n }", "public static<T> Vendor<T> vendor(Callable<T> f) {\n\treturn j.vendor(f);\n }", "private static I_CmsResourceBundle tryBundle(String localizedName) {\n\n I_CmsResourceBundle result = null;\n\n try {\n\n String resourceName = localizedName.replace('.', '/') + \".properties\";\n URL url = CmsResourceBundleLoader.class.getClassLoader().getResource(resourceName);\n\n I_CmsResourceBundle additionalBundle = m_permanentCache.get(localizedName);\n if (additionalBundle != null) {\n result = additionalBundle.getClone();\n } else if (url != null) {\n // the resource was found on the file system\n InputStream is = null;\n String path = CmsFileUtil.normalizePath(url);\n File file = new File(path);\n try {\n // try to load the resource bundle from a file, NOT with the resource loader first\n // this is important since using #getResourceAsStream() may return cached results,\n // for example Tomcat by default does cache all resources loaded by the class loader\n // this means a changed resource bundle file is not loaded\n is = new FileInputStream(file);\n } catch (IOException ex) {\n // this will happen if the resource is contained for example in a .jar file\n is = CmsResourceBundleLoader.class.getClassLoader().getResourceAsStream(resourceName);\n } catch (AccessControlException acex) {\n // fixed bug #1550\n // this will happen if the resource is contained for example in a .jar file\n // and security manager is turned on.\n is = CmsResourceBundleLoader.class.getClassLoader().getResourceAsStream(resourceName);\n }\n if (is != null) {\n result = new CmsPropertyResourceBundle(is);\n }\n }\n } catch (IOException ex) {\n // can't localized these message since this may lead to a chicken-egg problem\n MissingResourceException mre = new MissingResourceException(\n \"Failed to load bundle '\" + localizedName + \"'\",\n localizedName,\n \"\");\n mre.initCause(ex);\n throw mre;\n }\n\n return result;\n }", "public static Boolean compareSingleClientConfigAvro(String configAvro1, String configAvro2) {\n Properties props1 = readSingleClientConfigAvro(configAvro1);\n Properties props2 = readSingleClientConfigAvro(configAvro2);\n if(props1.equals(props2)) {\n return true;\n } else {\n return false;\n }\n }" ]
Returns a color for a given absolute number that is to be shown on the map. @param value @return
[ "private int getColor(int value) {\n\t\tif (value == 0) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tdouble scale = Math.log10(value) / Math.log10(this.topValue);\n\t\tdouble lengthScale = Math.min(1.0, scale) * (colors.length - 1);\n\t\tint index = 1 + (int) lengthScale;\n\t\tif (index == colors.length) {\n\t\t\tindex--;\n\t\t}\n\t\tdouble partScale = lengthScale - (index - 1);\n\n\t\tint r = (int) (colors[index - 1][0] + partScale\n\t\t\t\t* (colors[index][0] - colors[index - 1][0]));\n\t\tint g = (int) (colors[index - 1][1] + partScale\n\t\t\t\t* (colors[index][1] - colors[index - 1][1]));\n\t\tint b = (int) (colors[index - 1][2] + partScale\n\t\t\t\t* (colors[index][2] - colors[index - 1][2]));\n\n\t\tr = Math.min(255, r);\n\t\tb = Math.min(255, b);\n\t\tg = Math.min(255, g);\n\t\treturn (r << 16) | (g << 8) | b;\n\t}" ]
[ "public void setCapacity(int capacity) {\n if (capacity <= 0) {\n throw new IllegalArgumentException(\"capacity must be greater than 0\");\n }\n\n synchronized (queue) {\n // If the capacity was reduced, we remove oldest elements until the\n // queue fits inside the specified capacity\n if (capacity < this.capacity) {\n while (queue.size() > capacity) {\n queue.removeFirst();\n }\n }\n }\n\n this.capacity = capacity;\n }", "public void log(Level level, Throwable throwable, String msg, Object[] argArray) {\n\t\tlogIfEnabled(level, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);\n\t}", "public static aaauser_binding get(nitro_service service, String username) throws Exception{\n\t\taaauser_binding obj = new aaauser_binding();\n\t\tobj.set_username(username);\n\t\taaauser_binding response = (aaauser_binding) obj.get_resource(service);\n\t\treturn response;\n\t}", "@Override\n public T getById(Object id)\n {\n return context.getFramed().getFramedVertex(this.type, id);\n }", "@JsonProperty(\"aliases\")\n @JsonInclude(Include.NON_EMPTY)\n public Map<String, List<TermImpl>> getAliasUpdates() {\n \t\n \tMap<String, List<TermImpl>> updatedValues = new HashMap<>();\n \tfor(Map.Entry<String,AliasesWithUpdate> entry : newAliases.entrySet()) {\n \t\tAliasesWithUpdate update = entry.getValue();\n \t\tif (!update.write) {\n \t\t\tcontinue;\n \t\t}\n \t\tList<TermImpl> convertedAliases = new ArrayList<>();\n \t\tfor(MonolingualTextValue alias : update.aliases) {\n \t\t\tconvertedAliases.add(monolingualToJackson(alias));\n \t\t}\n \t\tupdatedValues.put(entry.getKey(), convertedAliases);\n \t}\n \treturn updatedValues;\n }", "public static base_response add(nitro_service client, sslcipher resource) throws Exception {\n\t\tsslcipher addresource = new sslcipher();\n\t\taddresource.ciphergroupname = resource.ciphergroupname;\n\t\taddresource.ciphgrpalias = resource.ciphgrpalias;\n\t\treturn addresource.add_resource(client);\n\t}", "public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException {\n if (!locale.isPresent()) {\n return Optional.absent();\n }\n\n synchronized (msgBundles) {\n SoyMsgBundle soyMsgBundle = null;\n if (isHotReloadModeOff()) {\n soyMsgBundle = msgBundles.get(locale.get());\n }\n if (soyMsgBundle == null) {\n soyMsgBundle = createSoyMsgBundle(locale.get());\n if (soyMsgBundle == null) {\n soyMsgBundle = createSoyMsgBundle(new Locale(locale.get().getLanguage()));\n }\n\n if (soyMsgBundle == null && fallbackToEnglish) {\n soyMsgBundle = createSoyMsgBundle(Locale.ENGLISH);\n }\n\n if (soyMsgBundle == null) {\n return Optional.absent();\n }\n\n if (isHotReloadModeOff()) {\n msgBundles.put(locale.get(), soyMsgBundle);\n }\n }\n\n return Optional.fromNullable(soyMsgBundle);\n }\n }", "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 }", "public BoxRetentionPolicyAssignment.Info assignTo(BoxFolder folder) {\r\n return BoxRetentionPolicyAssignment.createAssignmentToFolder(this.getAPI(), this.getID(), folder.getID());\r\n }" ]