query
stringlengths
7
3.3k
positive
sequencelengths
1
1
negative
sequencelengths
9
9
Executes the rebalance plan. Does so batch-by-batch. Between each batch, status is dumped to logger.info. @param rebalancePlan
[ "private void executePlan(RebalancePlan rebalancePlan) {\n logger.info(\"Starting to execute rebalance Plan!\");\n\n int batchCount = 0;\n int partitionStoreCount = 0;\n long totalTimeMs = 0;\n\n List<RebalanceBatchPlan> entirePlan = rebalancePlan.getPlan();\n int numBatches = entirePlan.size();\n int numPartitionStores = rebalancePlan.getPartitionStoresMoved();\n\n for(RebalanceBatchPlan batchPlan: entirePlan) {\n logger.info(\"======== REBALANCING BATCH \" + (batchCount + 1)\n + \" ========\");\n RebalanceUtils.printBatchLog(batchCount,\n logger,\n batchPlan.toString());\n\n long startTimeMs = System.currentTimeMillis();\n // ACTUALLY DO A BATCH OF REBALANCING!\n executeBatch(batchCount, batchPlan);\n totalTimeMs += (System.currentTimeMillis() - startTimeMs);\n\n // Bump up the statistics\n batchCount++;\n partitionStoreCount += batchPlan.getPartitionStoreMoves();\n batchStatusLog(batchCount,\n numBatches,\n partitionStoreCount,\n numPartitionStores,\n totalTimeMs);\n }\n }" ]
[ "@Override\n public void writeText(PDDocument doc, Writer outputStream) throws IOException\n {\n try\n {\n DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();\n DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation(\"LS\");\n LSSerializer writer = impl.createLSSerializer();\n LSOutput output = impl.createLSOutput();\n writer.getDomConfig().setParameter(\"format-pretty-print\", true);\n output.setCharacterStream(outputStream);\n createDOM(doc);\n writer.write(getDocument(), output);\n } catch (ClassCastException e) {\n throw new IOException(\"Error: cannot initialize the DOM serializer\", e);\n } catch (ClassNotFoundException e) {\n throw new IOException(\"Error: cannot initialize the DOM serializer\", e);\n } catch (InstantiationException e) {\n throw new IOException(\"Error: cannot initialize the DOM serializer\", e);\n } catch (IllegalAccessException e) {\n throw new IOException(\"Error: cannot initialize the DOM serializer\", e);\n }\n }", "@Override\n protected <T> CompletableFuture<T> doExecute(Command<T> command) throws Exception {\n final CompletableFuture<T> future = new CompletableFuture<>();\n executor.execute(() -> {\n try {\n future.complete(blockingExecute(command));\n } catch (Throwable t) {\n future.completeExceptionally(t);\n }\n });\n return future;\n }", "@Override\r\n public <VALUEBASE, VALUE extends VALUEBASE, KEY extends Key<CoreMap, VALUEBASE>>\r\n VALUE set(Class<KEY> key, VALUE value) {\r\n \r\n if (immutableKeys.contains(key)) {\r\n throw new HashableCoreMapException(\"Attempt to change value \" +\r\n \t\t\"of immutable field \"+key.getSimpleName());\r\n }\r\n \r\n return super.set(key, value);\r\n }", "public static String flatten(String left, String right) {\n\t\treturn left == null || left.isEmpty() ? right : left + \".\" + right;\n\t}", "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 retrieveCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException\r\n {\r\n doRetrieveCollections(newObj, cld, forced, false);\r\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 boolean process( DMatrixSparseCSC A ) {\n init(A);\n\n TriangularSolver_DSCC.eliminationTree(A,true,parent,gwork);\n\n countNonZeroInR(parent);\n countNonZeroInV(parent);\n\n // if more columns than rows it's possible that Q*R != A. That's because a householder\n // would need to be created that's outside the m by m Q matrix. In reality it has\n // a partial solution. Column pivot are needed.\n if( m < n ) {\n for (int row = 0; row <m; row++) {\n if( gwork.data[head+row] < 0 ) {\n return false;\n }\n }\n }\n return true;\n }", "public static double getRadiusToBoundedness(double D, int N, double timelag, double B){\n\t\tdouble cov_area = a(N)*D*timelag;\n\t\tdouble radius = Math.sqrt(cov_area/(4*B));\n\t\treturn radius;\n\t}" ]
Use this API to add dnspolicylabel resources.
[ "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}" ]
[ "private void closeClient(Client client) {\n logger.debug(\"Closing client {}\", client);\n client.close();\n openClients.remove(client.targetPlayer);\n useCounts.remove(client);\n timestamps.remove(client);\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 }", "private synchronized static Cluster getCluster(URI baseUrl, String[] personalities) throws IOException\n {\n final Entry<URI, Set<String>> key = Maps.immutableEntry(baseUrl, (Set<String>)ImmutableSet.copyOf(personalities));\n\n Cluster result = CLUSTERS.get(key);\n if (result != null) {\n return result;\n }\n\n result = new Cluster(EmbeddedPostgreSQL.start());\n\n final DBI dbi = new DBI(result.getPg().getTemplateDatabase());\n final Migratory migratory = new Migratory(new MigratoryConfig() {}, dbi, dbi);\n migratory.addLocator(new DatabasePreparerLocator(migratory, baseUrl));\n\n final MigrationPlan plan = new MigrationPlan();\n int priority = 100;\n\n for (final String personality : personalities) {\n plan.addMigration(personality, Integer.MAX_VALUE, priority--);\n }\n\n migratory.dbMigrate(plan);\n\n result.start();\n\n CLUSTERS.put(key, result);\n return result;\n }", "private void logOriginalRequestHistory(String requestType,\n HttpServletRequest request, History history) {\n logger.info(\"Storing original request history\");\n history.setRequestType(requestType);\n history.setOriginalRequestHeaders(HttpUtilities.getHeaders(request));\n history.setOriginalRequestURL(request.getRequestURL().toString());\n history.setOriginalRequestParams(request.getQueryString() == null ? \"\" : request.getQueryString());\n logger.info(\"Done storing\");\n }", "public static csvserver_copolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tcsvserver_copolicy_binding obj = new csvserver_copolicy_binding();\n\t\tobj.set_name(name);\n\t\tcsvserver_copolicy_binding response[] = (csvserver_copolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "public static final PatchOperationTarget createHost(final String hostName, final ModelControllerClient client) {\n final PathElement host = PathElement.pathElement(HOST, hostName);\n final PathAddress address = PathAddress.EMPTY_ADDRESS.append(host, CORE_SERVICES);\n return new RemotePatchOperationTarget(address, client);\n }", "public float getMetallic()\n {\n Property p = getProperty(PropertyKey.METALLIC.m_key);\n\n if (null == p || null == p.getData())\n {\n throw new IllegalArgumentException(\"Metallic property not found\");\n }\n Object rawValue = p.getData();\n if (rawValue instanceof java.nio.ByteBuffer)\n {\n java.nio.FloatBuffer fbuf = ((java.nio.ByteBuffer) rawValue).asFloatBuffer();\n return fbuf.get();\n }\n else\n {\n return (Float) rawValue;\n }\n }", "public ScheduleDescriptor generateScheduleDescriptor(LocalDate startDate, LocalDate endDate) {\r\n\t\treturn new ScheduleDescriptor(startDate, endDate, getFrequency(), getDaycountConvention(), getShortPeriodConvention(), getDateRollConvention(),\r\n\t\t\t\tgetBusinessdayCalendar(), getFixingOffsetDays(), getPaymentOffsetDays(), isUseEndOfMonth());\r\n\t}", "public void okResponse(String responseCode, String message) {\r\n untagged();\r\n message(OK);\r\n responseCode(responseCode);\r\n message(message);\r\n end();\r\n }" ]
Generate a path select string @return Select query string
[ "private String getPathSelectString() {\n String queryString = \"SELECT \" + Constants.DB_TABLE_REQUEST_RESPONSE + \".\" + Constants.GENERIC_CLIENT_UUID +\n \",\" + Constants.DB_TABLE_PATH + \".\" + Constants.GENERIC_ID +\n \",\" + Constants.PATH_PROFILE_PATHNAME +\n \",\" + Constants.PATH_PROFILE_ACTUAL_PATH +\n \",\" + Constants.PATH_PROFILE_BODY_FILTER +\n \",\" + Constants.PATH_PROFILE_GROUP_IDS +\n \",\" + Constants.DB_TABLE_PATH + \".\" + Constants.PATH_PROFILE_PROFILE_ID +\n \",\" + Constants.PATH_PROFILE_PATH_ORDER +\n \",\" + Constants.REQUEST_RESPONSE_REPEAT_NUMBER +\n \",\" + Constants.REQUEST_RESPONSE_REQUEST_ENABLED +\n \",\" + Constants.REQUEST_RESPONSE_RESPONSE_ENABLED +\n \",\" + Constants.PATH_PROFILE_CONTENT_TYPE +\n \",\" + Constants.PATH_PROFILE_REQUEST_TYPE +\n \",\" + Constants.PATH_PROFILE_GLOBAL +\n \" FROM \" + Constants.DB_TABLE_PATH +\n \" JOIN \" + Constants.DB_TABLE_REQUEST_RESPONSE +\n \" ON \" + Constants.DB_TABLE_PATH + \".\" + Constants.GENERIC_ID +\n \"=\" + Constants.DB_TABLE_REQUEST_RESPONSE + \".\" + Constants.REQUEST_RESPONSE_PATH_ID +\n \" AND \" + Constants.DB_TABLE_REQUEST_RESPONSE + \".\" + Constants.GENERIC_CLIENT_UUID + \" = ?\";\n\n return queryString;\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 ThumborUrlBuilder resize(int width, int height) {\n if (width < 0 && width != ORIGINAL_SIZE) {\n throw new IllegalArgumentException(\"Width must be a positive number.\");\n }\n if (height < 0 && height != ORIGINAL_SIZE) {\n throw new IllegalArgumentException(\"Height must be a positive number.\");\n }\n if (width == 0 && height == 0) {\n throw new IllegalArgumentException(\"Both width and height must not be zero.\");\n }\n hasResize = true;\n resizeWidth = width;\n resizeHeight = height;\n return this;\n }", "protected DateTimeException _peelDTE(DateTimeException e) {\n while (true) {\n Throwable t = e.getCause();\n if (t != null && t instanceof DateTimeException) {\n e = (DateTimeException) t;\n continue;\n }\n break;\n }\n return e;\n }", "public <V> V attach(final AttachmentKey<V> key, final V value) {\n assert key != null;\n return key.cast(contextAttachments.put(key, value));\n }", "private String getJSONFromMap(Map<String, Object> propMap) {\n try {\n return new JSONObject(propMap).toString();\n } catch (Exception e) {\n return \"{}\";\n }\n }", "public List<MapRow> readUnknownTable(int rowSize, int rowMagicNumber) throws IOException\n {\n TableReader reader = new UnknownTableReader(this, rowSize, rowMagicNumber);\n reader.read();\n return reader.getRows();\n }", "public static List<File> extract(File zipFile, File outputFolder) throws IOException {\n List<File> extracted = new ArrayList<File>();\n\n byte[] buffer = new byte[2048];\n\n if (!outputFolder.exists()) {\n outputFolder.mkdir();\n }\n\n ZipInputStream zipInput = new ZipInputStream(new FileInputStream(zipFile));\n\n ZipEntry zipEntry = zipInput.getNextEntry();\n\n while (zipEntry != null) {\n\n String neFileNameName = zipEntry.getName();\n File newFile = new File(outputFolder + File.separator + neFileNameName);\n\n newFile.getParentFile().mkdirs();\n\n if (!zipEntry.isDirectory()) {\n FileOutputStream fos = new FileOutputStream(newFile);\n\n int size;\n while ((size = zipInput.read(buffer)) > 0) {\n fos.write(buffer, 0, size);\n }\n\n fos.close();\n extracted.add(newFile);\n }\n\n zipEntry = zipInput.getNextEntry();\n }\n\n zipInput.closeEntry();\n zipInput.close();\n\n return extracted;\n\n }", "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 static PluginManager getInstance() {\n if (_instance == null) {\n _instance = new PluginManager();\n _instance.classInformation = new HashMap<String, ClassInformation>();\n _instance.methodInformation = new HashMap<String, com.groupon.odo.proxylib.models.Method>();\n _instance.jarInformation = new ArrayList<String>();\n\n if (_instance.proxyLibPath == null) {\n //Get the System Classloader\n ClassLoader sysClassLoader = Thread.currentThread().getContextClassLoader();\n\n //Get the URLs\n URL[] urls = ((URLClassLoader) sysClassLoader).getURLs();\n\n for (int i = 0; i < urls.length; i++) {\n if (urls[i].getFile().contains(\"proxylib\")) {\n // store the path to the proxylib\n _instance.proxyLibPath = urls[i].getFile();\n break;\n }\n }\n }\n _instance.initializePlugins();\n }\n return _instance;\n }" ]
Read the calendar data from a Gantt Designer file. @param gantt Gantt Designer file.
[ "private void readCalendar(Gantt gantt)\n {\n Gantt.Calendar ganttCalendar = gantt.getCalendar();\n m_projectFile.getProjectProperties().setWeekStartDay(ganttCalendar.getWeekStart());\n\n ProjectCalendar calendar = m_projectFile.addCalendar();\n calendar.setName(\"Standard\");\n m_projectFile.setDefaultCalendar(calendar);\n\n String workingDays = ganttCalendar.getWorkDays();\n calendar.setWorkingDay(Day.SUNDAY, workingDays.charAt(0) == '1');\n calendar.setWorkingDay(Day.MONDAY, workingDays.charAt(1) == '1');\n calendar.setWorkingDay(Day.TUESDAY, workingDays.charAt(2) == '1');\n calendar.setWorkingDay(Day.WEDNESDAY, workingDays.charAt(3) == '1');\n calendar.setWorkingDay(Day.THURSDAY, workingDays.charAt(4) == '1');\n calendar.setWorkingDay(Day.FRIDAY, workingDays.charAt(5) == '1');\n calendar.setWorkingDay(Day.SATURDAY, workingDays.charAt(6) == '1');\n\n for (int i = 1; i <= 7; i++)\n {\n Day day = Day.getInstance(i);\n ProjectCalendarHours hours = calendar.addCalendarHours(day);\n if (calendar.isWorkingDay(day))\n {\n hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);\n hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);\n }\n }\n\n for (Gantt.Holidays.Holiday holiday : gantt.getHolidays().getHoliday())\n {\n ProjectCalendarException exception = calendar.addCalendarException(holiday.getDate(), holiday.getDate());\n exception.setName(holiday.getContent());\n }\n }" ]
[ "protected FluentModelTImpl prepareForFutureCommitOrPostRun(FluentModelTImpl childResource) {\n if (this.isPostRunMode) {\n if (!childResource.taskGroup().dependsOn(this.parentTaskGroup)) {\n this.parentTaskGroup.addPostRunDependentTaskGroup(childResource.taskGroup());\n }\n return childResource;\n } else {\n return childResource;\n }\n }", "@Override\n public View getView(int position, View convertView, ViewGroup parent) {\n Country country = getItem(position);\n\n if (convertView == null) {\n convertView = new ImageView(getContext());\n }\n\n ((ImageView) convertView).setImageResource(getFlagResource(country));\n\n return convertView;\n }", "public static Set<Annotation> filterInterceptorBindings(BeanManagerImpl beanManager, Collection<Annotation> annotations) {\n Set<Annotation> interceptorBindings = new InterceptorBindingSet(beanManager);\n for (Annotation annotation : annotations) {\n if (beanManager.isInterceptorBinding(annotation.annotationType())) {\n interceptorBindings.add(annotation);\n }\n }\n return interceptorBindings;\n }", "private EventType createEventType(EventEnumType type) {\n EventType eventType = new EventType();\n eventType.setTimestamp(Converter.convertDate(new Date()));\n eventType.setEventType(type);\n\n OriginatorType origType = new OriginatorType();\n origType.setProcessId(Converter.getPID());\n try {\n InetAddress inetAddress = InetAddress.getLocalHost();\n origType.setIp(inetAddress.getHostAddress());\n origType.setHostname(inetAddress.getHostName());\n } catch (UnknownHostException e) {\n origType.setHostname(\"Unknown hostname\");\n origType.setIp(\"Unknown ip address\");\n }\n eventType.setOriginator(origType);\n\n String path = System.getProperty(\"karaf.home\");\n CustomInfoType ciType = new CustomInfoType();\n CustomInfoType.Item cItem = new CustomInfoType.Item();\n cItem.setKey(\"path\");\n cItem.setValue(path);\n ciType.getItem().add(cItem);\n eventType.setCustomInfo(ciType);\n\n return eventType;\n }", "public GenericCriteria process(ProjectProperties properties, byte[] data, int dataOffset, int entryOffset, List<GenericCriteriaPrompt> prompts, List<FieldType> fields, boolean[] criteriaType)\n {\n m_properties = properties;\n m_prompts = prompts;\n m_fields = fields;\n m_criteriaType = criteriaType;\n m_dataOffset = dataOffset;\n if (m_criteriaType != null)\n {\n m_criteriaType[0] = true;\n m_criteriaType[1] = true;\n }\n\n m_criteriaBlockMap.clear();\n\n m_criteriaData = data;\n m_criteriaTextStart = MPPUtility.getShort(m_criteriaData, m_dataOffset + getCriteriaTextStartOffset());\n\n //\n // Populate the map\n //\n int criteriaStartOffset = getCriteriaStartOffset();\n int criteriaBlockSize = getCriteriaBlockSize();\n\n //System.out.println();\n //System.out.println(ByteArrayHelper.hexdump(data, dataOffset, criteriaStartOffset, false));\n\n if (m_criteriaData.length <= m_criteriaTextStart)\n {\n return null; // bad data\n }\n\n while (criteriaStartOffset + criteriaBlockSize <= m_criteriaTextStart)\n {\n byte[] block = new byte[criteriaBlockSize];\n System.arraycopy(m_criteriaData, m_dataOffset + criteriaStartOffset, block, 0, criteriaBlockSize);\n m_criteriaBlockMap.put(Integer.valueOf(criteriaStartOffset), block);\n //System.out.println(Integer.toHexString(criteriaStartOffset) + \": \" + ByteArrayHelper.hexdump(block, false));\n criteriaStartOffset += criteriaBlockSize;\n }\n\n if (entryOffset == -1)\n {\n entryOffset = getCriteriaStartOffset();\n }\n\n List<GenericCriteria> list = new LinkedList<GenericCriteria>();\n processBlock(list, m_criteriaBlockMap.get(Integer.valueOf(entryOffset)));\n GenericCriteria criteria;\n if (list.isEmpty())\n {\n criteria = null;\n }\n else\n {\n criteria = list.get(0);\n }\n return criteria;\n }", "ProtectionDomain getProtectionDomainForProxy(ProtectionDomain domain) {\n if (domain.getCodeSource() == null) {\n // no codesource to cache on\n return create(domain);\n }\n ProtectionDomain proxyProtectionDomain = proxyProtectionDomains.get(domain.getCodeSource());\n if (proxyProtectionDomain == null) {\n // as this is not atomic create() may be called multiple times for the same domain\n // we ignore that\n proxyProtectionDomain = create(domain);\n ProtectionDomain existing = proxyProtectionDomains.putIfAbsent(domain.getCodeSource(), proxyProtectionDomain);\n if (existing != null) {\n proxyProtectionDomain = existing;\n }\n }\n return proxyProtectionDomain;\n }", "public void visitExport(String packaze, int access, String... modules) {\n if (mv != null) {\n mv.visitExport(packaze, access, modules);\n }\n }", "public static Method getBridgeMethodTarget(Method someMethod) {\n TraitBridge annotation = someMethod.getAnnotation(TraitBridge.class);\n if (annotation==null) {\n return null;\n }\n Class aClass = annotation.traitClass();\n String desc = annotation.desc();\n for (Method method : aClass.getDeclaredMethods()) {\n String methodDescriptor = BytecodeHelper.getMethodDescriptor(method.getReturnType(), method.getParameterTypes());\n if (desc.equals(methodDescriptor)) {\n return method;\n }\n }\n return null;\n }", "public static long hash(final BsonDocument doc) {\n if (doc == null) {\n return 0L;\n }\n\n final byte[] docBytes = toBytes(doc);\n long hashValue = FNV_64BIT_OFFSET_BASIS;\n\n for (int offset = 0; offset < docBytes.length; offset++) {\n hashValue ^= (0xFF & docBytes[offset]);\n hashValue *= FNV_64BIT_PRIME;\n }\n\n return hashValue;\n }" ]
Read the role definitions from a GanttProject project. @param gpProject GanttProject project
[ "private void readRoleDefinitions(Project gpProject)\n {\n m_roleDefinitions.put(\"Default:1\", \"project manager\");\n\n for (Roles roles : gpProject.getRoles())\n {\n if (\"Default\".equals(roles.getRolesetName()))\n {\n continue;\n }\n\n for (Role role : roles.getRole())\n {\n m_roleDefinitions.put(role.getId(), role.getName());\n }\n }\n }" ]
[ "public IntervalFrequency getRefreshFrequency() {\n switch (mRefreshInterval) {\n case REALTIME_REFRESH_INTERVAL:\n return IntervalFrequency.REALTIME;\n case HIGH_REFRESH_INTERVAL:\n return IntervalFrequency.HIGH;\n case LOW_REFRESH_INTERVAL:\n return IntervalFrequency.LOW;\n case MEDIUM_REFRESH_INTERVAL:\n return IntervalFrequency.MEDIUM;\n default:\n return IntervalFrequency.NONE;\n }\n }", "public void append(Object object, String indentation) {\n\t\tappend(object, indentation, segments.size());\n\t}", "public Date toDate(String dateString) {\n Date date = null;\n DateFormat df = new SimpleDateFormat(\"yyyy-MM-dd\");\n try {\n date = df.parse(dateString);\n } catch (ParseException ex) {\n System.out.println(ex.fillInStackTrace());\n }\n return date;\n }", "public AT_Row setTargetTranslator(TargetTranslator targetTranslator) {\r\n\t\tif(this.hasCells()){\r\n\t\t\tfor(AT_Cell cell : this.getCells()){\r\n\t\t\t\tcell.getContext().setTargetTranslator(targetTranslator);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}", "private void readAssignment(Resource resource, Assignment assignment)\n {\n Task task = m_activityMap.get(assignment.getActivity());\n if (task != null)\n {\n task.addResourceAssignment(resource);\n }\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 }", "private ModelNode addLocalHost(final ModelNode address, final List<ModelNode> operationList, final String hostName) {\n\n String resolvedHost = hostName != null ? hostName : defaultHostControllerName;\n\n // All further operations should modify the newly added host so the address passed in is updated.\n address.add(HOST, resolvedHost);\n\n // Add a step to setup the ManagementResourceRegistrations for the root host resource\n final ModelNode hostAddOp = new ModelNode();\n hostAddOp.get(OP).set(HostAddHandler.OPERATION_NAME);\n hostAddOp.get(OP_ADDR).set(address);\n\n operationList.add(hostAddOp);\n\n // Add a step to store the HC name\n ModelNode nameValue = hostName == null ? new ModelNode() : new ModelNode(hostName);\n final ModelNode writeName = Util.getWriteAttributeOperation(address, NAME, nameValue);\n operationList.add(writeName);\n return hostAddOp;\n }", "public static <T> SessionBean<T> of(BeanAttributes<T> attributes, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl beanManager, EnhancedAnnotatedType<T> type) {\n return new SessionBeanImpl<T>(attributes, type, ejbDescriptor, new StringBeanIdentifier(SessionBeans.createIdentifier(type, ejbDescriptor)), beanManager);\n }", "@Override\n public List<String> setTargetHostsFromLineByLineText(String sourcePath,\n HostsSourceType sourceType) throws TargetHostsLoadException {\n\n List<String> targetHosts = new ArrayList<String>();\n try {\n String content = getContentFromPath(sourcePath, sourceType);\n\n targetHosts = setTargetHostsFromString(content);\n\n } catch (IOException e) {\n throw new TargetHostsLoadException(\"IEException when reading \"\n + sourcePath, e);\n }\n\n return targetHosts;\n\n }" ]
Uncheck all items in the list including all sub-items. @param list list of CmsTreeItem entries.
[ "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 }" ]
[ "@Override\n public ModelNode resolveValue(ExpressionResolver resolver, ModelNode value) throws OperationFailedException {\n\n // Pass non-LIST values through the superclass so it can reject weird values and, in the odd chance\n // that's how this object is set up, turn undefined into a default list value.\n ModelNode superResult = value.getType() == ModelType.LIST ? value : super.resolveValue(resolver, value);\n\n // If it's not a LIST (almost certainly UNDEFINED), then nothing more we can do\n if (superResult.getType() != ModelType.LIST) {\n return superResult;\n }\n // Resolve each element.\n // Don't mess with the original value\n ModelNode clone = superResult == value ? value.clone() : superResult;\n ModelNode result = new ModelNode();\n result.setEmptyList();\n for (ModelNode element : clone.asList()) {\n result.add(valueType.resolveValue(resolver, element));\n }\n // Validate the entire list\n getValidator().validateParameter(getName(), result);\n return result;\n }", "protected boolean determineFeatureState(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, boolean defaultState) {\n final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(context.getConfiguration());\n final IStandardExpression expression = expressionParser.parseExpression(context, attributeValue);\n final Object value = expression.execute(context);\n if (value != null) {\n return isFeatureActive(value.toString());\n }\n else {\n return defaultState;\n }\n }", "private void srand(int ijkl) {\n u = new double[97];\n\n int ij = ijkl / 30082;\n int kl = ijkl % 30082;\n\n // Handle the seed range errors\n // First random number seed must be between 0 and 31328\n // Second seed must have a value between 0 and 30081\n if (ij < 0 || ij > 31328 || kl < 0 || kl > 30081) {\n ij = ij % 31329;\n kl = kl % 30082;\n }\n\n int i = ((ij / 177) % 177) + 2;\n int j = (ij % 177) + 2;\n int k = ((kl / 169) % 178) + 1;\n int l = kl % 169;\n\n int m;\n double s, t;\n for (int ii = 0; ii < 97; ii++) {\n s = 0.0;\n t = 0.5;\n for (int jj = 0; jj < 24; jj++) {\n m = (((i * j) % 179) * k) % 179;\n i = j;\n j = k;\n k = m;\n l = (53 * l + 1) % 169;\n if (((l * m) % 64) >= 32) {\n s += t;\n }\n t *= 0.5;\n }\n u[ii] = s;\n }\n\n c = 362436.0 / 16777216.0;\n cd = 7654321.0 / 16777216.0;\n cm = 16777213.0 / 16777216.0;\n i97 = 96;\n j97 = 32;\n }", "public\tRandomVariableInterface[]\tgetFactorLoading(double time, double component, RandomVariableInterface[] realizationAtTimeIndex) {\n\t\tint componentIndex = liborPeriodDiscretization.getTimeIndex(component);\n\t\tif(componentIndex < 0) {\n\t\t\tcomponentIndex = -componentIndex - 2;\n\t\t}\n\t\treturn getFactorLoading(time, componentIndex, realizationAtTimeIndex);\n\t}", "public static final Date parseExtendedAttributeDate(String value)\n {\n Date result = null;\n\n if (value != null)\n {\n try\n {\n result = DATE_FORMAT.get().parse(value);\n }\n\n catch (ParseException ex)\n {\n // ignore exceptions\n }\n }\n\n return (result);\n }", "public static base_response Import(nitro_service client, responderhtmlpage resource) throws Exception {\n\t\tresponderhtmlpage Importresource = new responderhtmlpage();\n\t\tImportresource.src = resource.src;\n\t\tImportresource.name = resource.name;\n\t\tImportresource.comment = resource.comment;\n\t\tImportresource.overwrite = resource.overwrite;\n\t\treturn Importresource.perform_operation(client,\"Import\");\n\t}", "public static LayersConfig getLayersConfig(final File repoRoot) throws IOException {\n final File layersList = new File(repoRoot, LAYERS_CONF);\n if (!layersList.exists()) {\n return new LayersConfig();\n }\n final Properties properties = PatchUtils.loadProperties(layersList);\n return new LayersConfig(properties);\n }", "private static Document objectForInsert(Tuple tuple, Document dbObject) {\n\t\tMongoDBTupleSnapshot snapshot = (MongoDBTupleSnapshot) tuple.getSnapshot();\n\t\tfor ( TupleOperation operation : tuple.getOperations() ) {\n\t\t\tString column = operation.getColumn();\n\t\t\tif ( notInIdField( snapshot, column ) ) {\n\t\t\t\tswitch ( operation.getType() ) {\n\t\t\t\t\tcase PUT:\n\t\t\t\t\t\tMongoHelpers.setValue( dbObject, column, operation.getValue() );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase PUT_NULL:\n\t\t\t\t\tcase REMOVE:\n\t\t\t\t\t\tMongoHelpers.resetValue( dbObject, column );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn dbObject;\n\t}", "private void writeTimeUnitsField(String fieldName, Object value) throws IOException\n {\n TimeUnit val = (TimeUnit) value;\n if (val != m_projectFile.getProjectProperties().getDefaultDurationUnits())\n {\n m_writer.writeNameValuePair(fieldName, val.toString());\n }\n }" ]
This produces a canonical string. RFC 5952 describes canonical representations. http://en.wikipedia.org/wiki/IPv6_address#Recommended_representation_as_text http://tools.ietf.org/html/rfc5952
[ "@Override\n\tpublic String toCanonicalString() {\n\t\tString result;\n\t\tif(hasNoStringCache() || (result = stringCache.canonicalString) == null) {\n\t\t\tstringCache.canonicalString = result = toNormalizedString(IPv6StringCache.canonicalParams);\n\t\t}\n\t\treturn result;\n\t}" ]
[ "protected void resize( VariableMatrix mat , int numRows , int numCols ) {\n if( mat.isTemp() ) {\n mat.matrix.reshape(numRows,numCols);\n }\n }", "private List<ExpandableWrapper<P, C>> generateFlattenedParentChildList(List<P> parentList) {\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 generateParentWrapper(flatItemList, parent, parent.isInitiallyExpanded());\n }\n\n return flatItemList;\n }", "@RequestMapping(value = \"/api/plugins\", method = RequestMethod.GET)\n public\n @ResponseBody\n HashMap<String, Object> getPluginInformation() {\n return pluginInformation();\n }", "public Date getStart()\n {\n Date result = (Date) getCachedValue(AssignmentField.START);\n if (result == null)\n {\n result = getTask().getStart();\n }\n return result;\n }", "public ForeignkeyDef getForeignkey(String name, String tableName)\r\n {\r\n String realName = (name == null ? \"\" : name);\r\n ForeignkeyDef def = null;\r\n\r\n for (Iterator it = getForeignkeys(); it.hasNext();)\r\n {\r\n def = (ForeignkeyDef)it.next();\r\n if (realName.equals(def.getName()) &&\r\n def.getTableName().equals(tableName))\r\n {\r\n return def;\r\n }\r\n }\r\n return null;\r\n }", "public void setEndTime(final Date date) {\r\n\r\n if (!Objects.equals(m_model.getEnd(), date)) {\r\n m_model.setEnd(date);\r\n valueChanged();\r\n }\r\n\r\n }", "protected String consumeQuoted(ImapRequestLineReader request)\n throws ProtocolException {\n // The 1st character must be '\"'\n consumeChar(request, '\"');\n\n StringBuilder quoted = new StringBuilder();\n char next = request.nextChar();\n while (next != '\"') {\n if (next == '\\\\') {\n request.consume();\n next = request.nextChar();\n if (!isQuotedSpecial(next)) {\n throw new ProtocolException(\"Invalid escaped character in quote: '\" +\n next + '\\'');\n }\n }\n quoted.append(next);\n request.consume();\n next = request.nextChar();\n }\n\n consumeChar(request, '\"');\n\n return quoted.toString();\n }", "static void addDeployOperationStep(final CompositeOperationBuilder builder, final DeploymentDescription deployment) {\n final String name = deployment.getName();\n\n final Set<String> serverGroups = deployment.getServerGroups();\n // If the server groups are empty this is a standalone deployment\n if (serverGroups.isEmpty()) {\n final ModelNode address = createAddress(DEPLOYMENT, name);\n builder.addStep(createOperation(DEPLOYMENT_DEPLOY_OPERATION, address));\n } else {\n for (String serverGroup : serverGroups) {\n final ModelNode address = createAddress(SERVER_GROUP, serverGroup, DEPLOYMENT, name);\n builder.addStep(createOperation(DEPLOYMENT_DEPLOY_OPERATION, address));\n }\n }\n }", "public double distanceSquared(Vector3d v) {\n double dx = x - v.x;\n double dy = y - v.y;\n double dz = z - v.z;\n\n return dx * dx + dy * dy + dz * dz;\n }" ]
Sets the Red, Green, and Blue color variables. This will automatically populate the Hue, Saturation and Brightness and Hexadecimal fields, too. The RGB color model is an additive color model in which red, green, and blue light are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three additive primary colors, red, green, and blue. @param red strength - valid range is 0-255 @param green strength - valid range is 0-255 @param blue strength - valid range is 0-255 @throws java.lang.Exception Exception if the Red, Green or Blue variables are out of range.
[ "public void setRGB(int red, int green, int blue) throws Exception {\r\n\r\n CmsColor color = new CmsColor();\r\n color.setRGB(red, green, blue);\r\n\r\n m_red = red;\r\n m_green = green;\r\n m_blue = blue;\r\n m_hue = color.getHue();\r\n m_saturation = color.getSaturation();\r\n m_brightness = color.getValue();\r\n\r\n m_tbRed.setText(Integer.toString(m_red));\r\n m_tbGreen.setText(Integer.toString(m_green));\r\n m_tbBlue.setText(Integer.toString(m_blue));\r\n m_tbHue.setText(Integer.toString(m_hue));\r\n m_tbSaturation.setText(Integer.toString(m_saturation));\r\n m_tbBrightness.setText(Integer.toString(m_brightness));\r\n m_tbHexColor.setText(color.getHex());\r\n setPreview(color.getHex());\r\n\r\n updateSliders();\r\n }" ]
[ "public CurrencyQueryBuilder setCurrencyCodes(String... codes) {\n return set(CurrencyQuery.KEY_QUERY_CURRENCY_CODES, Arrays.asList(codes));\n }", "public static Type getArrayComponentType(Type type) {\n if (type instanceof GenericArrayType) {\n return GenericArrayType.class.cast(type).getGenericComponentType();\n }\n if (type instanceof Class<?>) {\n Class<?> clazz = (Class<?>) type;\n if (clazz.isArray()) {\n return clazz.getComponentType();\n }\n }\n throw new IllegalArgumentException(\"Not an array type \" + type);\n }", "public void setQueryExecuteTimeLimit(long queryExecuteTimeLimit, TimeUnit timeUnit) {\n\t\tthis.queryExecuteTimeLimitInMs = TimeUnit.MILLISECONDS.convert(queryExecuteTimeLimit, timeUnit);\n\t}", "private static TechReportPlacement processPlaceLabels(GraphContext graphContext, Set<String> tagNames)\n {\n TagGraphService tagService = new TagGraphService(graphContext);\n\n if (tagNames.size() < 3)\n throw new WindupException(\"There should always be exactly 3 placement labels - row, sector, column/box. It was: \" + tagNames);\n if (tagNames.size() > 3)\n LOG.severe(\"There should always be exactly 3 placement labels - row, sector, column/box. It was: \" + tagNames);\n\n TechReportPlacement placement = new TechReportPlacement();\n\n final TagModel placeSectorsTag = tagService.getTagByName(\"techReport:placeSectors\");\n final TagModel placeBoxesTag = tagService.getTagByName(\"techReport:placeBoxes\");\n final TagModel placeRowsTag = tagService.getTagByName(\"techReport:placeRows\");\n\n Set<String> unknownTags = new HashSet<>();\n for (String name : tagNames)\n {\n final TagModel tag = tagService.getTagByName(name);\n if (null == tag)\n continue;\n\n if (TagGraphService.isTagUnderTagOrSame(tag, placeSectorsTag))\n {\n placement.sector = tag;\n }\n else if (TagGraphService.isTagUnderTagOrSame(tag, placeBoxesTag))\n {\n placement.box = tag;\n }\n else if (TagGraphService.isTagUnderTagOrSame(tag, placeRowsTag))\n {\n placement.row = tag;\n }\n else\n {\n unknownTags.add(name);\n }\n }\n placement.unknown = unknownTags;\n\n LOG.fine(String.format(\"\\t\\tLabels %s identified as: sector: %s, box: %s, row: %s\", tagNames, placement.sector, placement.box,\n placement.row));\n if (placement.box == null || placement.row == null)\n {\n LOG.severe(String.format(\n \"There should always be exactly 3 placement labels - row, sector, column/box. Found: %s, of which box: %s, row: %s\", tagNames,\n placement.box, placement.row));\n }\n return placement;\n }", "private void readWorkWeeks(Project.Calendars.Calendar xmlCalendar, ProjectCalendar mpxjCalendar)\n {\n WorkWeeks ww = xmlCalendar.getWorkWeeks();\n if (ww != null)\n {\n for (WorkWeek xmlWeek : ww.getWorkWeek())\n {\n ProjectCalendarWeek week = mpxjCalendar.addWorkWeek();\n week.setName(xmlWeek.getName());\n Date startTime = xmlWeek.getTimePeriod().getFromDate();\n Date endTime = xmlWeek.getTimePeriod().getToDate();\n week.setDateRange(new DateRange(startTime, endTime));\n\n WeekDays xmlWeekDays = xmlWeek.getWeekDays();\n if (xmlWeekDays != null)\n {\n for (WeekDay xmlWeekDay : xmlWeekDays.getWeekDay())\n {\n int dayNumber = xmlWeekDay.getDayType().intValue();\n Day day = Day.getInstance(dayNumber);\n week.setWorkingDay(day, BooleanHelper.getBoolean(xmlWeekDay.isDayWorking()));\n ProjectCalendarHours hours = week.addCalendarHours(day);\n\n Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes times = xmlWeekDay.getWorkingTimes();\n if (times != null)\n {\n for (Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime period : times.getWorkingTime())\n {\n startTime = period.getFromTime();\n endTime = period.getToTime();\n\n if (startTime != null && endTime != null)\n {\n if (startTime.getTime() >= endTime.getTime())\n {\n endTime = DateHelper.addDays(endTime, 1);\n }\n\n hours.addRange(new DateRange(startTime, endTime));\n }\n }\n }\n }\n }\n }\n }\n }", "public PromotionEvaluationReport getModulePromotionReport(final String name, final String version) throws GrapesCommunicationException {\n return getModulePromotionReportRaw(name, version, false, PromotionEvaluationReport.class);\n }", "@SafeVarargs\n public static <K> Set<K> set(final K... keys) {\n return new LinkedHashSet<K>(Arrays.asList(keys));\n }", "private int getResourceCode(String field) throws MPXJException\n {\n Integer result = m_resourceNumbers.get(field);\n\n if (result == null)\n {\n throw new MPXJException(MPXJException.INVALID_RESOURCE_FIELD_NAME + \" \" + field);\n }\n\n return (result.intValue());\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 }" ]
Notifies that a content item is changed. @param position the position.
[ "public final void notifyContentItemChanged(int position) {\n if (position < 0 || position >= contentItemCount) {\n throw new IndexOutOfBoundsException(\"The given position \" + position\n + \" is not within the position bounds for content items [0 - \" + (contentItemCount - 1) + \"].\");\n }\n notifyItemChanged(position + headerItemCount);\n }" ]
[ "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 addColumnPair(String localColumn, String remoteColumn)\r\n {\r\n if (!_localColumns.contains(localColumn))\r\n { \r\n _localColumns.add(localColumn);\r\n }\r\n if (!_remoteColumns.contains(remoteColumn))\r\n { \r\n _remoteColumns.add(remoteColumn);\r\n }\r\n }", "GVRShader makeTemplate(Class<? extends GVRShader> id, GVRContext ctx)\n {\n try\n {\n Constructor<? extends GVRShader> maker = id.getDeclaredConstructor(GVRContext.class);\n return maker.newInstance(ctx);\n }\n catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException ex)\n {\n try\n {\n Constructor<? extends GVRShader> maker = id.getDeclaredConstructor();\n return maker.newInstance();\n }\n catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException ex2)\n {\n ctx.getEventManager().sendEvent(ctx, IErrorEvents.class, \"onError\", new Object[] {ex2.getMessage(), this});\n return null;\n }\n }\n }", "public void setSelectionType(MaterialDatePickerType selectionType) {\n this.selectionType = selectionType;\n switch (selectionType) {\n case MONTH_DAY:\n options.selectMonths = true;\n break;\n case YEAR_MONTH_DAY:\n options.selectYears = yearsToDisplay;\n options.selectMonths = true;\n break;\n case YEAR:\n options.selectYears = yearsToDisplay;\n options.selectMonths = false;\n break;\n }\n }", "private void registerProxyCreator(Node source,\n BeanDefinitionHolder holder,\n ParserContext context) {\n\n String beanName = holder.getBeanName();\n String proxyName = beanName + \"Proxy\";\n String interceptorName = beanName + \"PerformanceMonitorInterceptor\";\n\n BeanDefinitionBuilder initializer =\n BeanDefinitionBuilder.rootBeanDefinition(BeanNameAutoProxyCreator.class);\n\n initializer.addPropertyValue(\"beanNames\", beanName);\n initializer.addPropertyValue(\"interceptorNames\", interceptorName);\n\n BeanDefinitionRegistry registry = context.getRegistry();\n registry.registerBeanDefinition(proxyName, initializer.getBeanDefinition());\n }", "public PhotoList<Photo> getPublicPhotos(String userId, Set<String> extras, int perPage, int page) throws FlickrException {\r\n PhotoList<Photo> photos = new PhotoList<Photo>();\r\n\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_PUBLIC_PHOTOS);\r\n\r\n parameters.put(\"user_id\", userId);\r\n\r\n if (perPage > 0) {\r\n parameters.put(\"per_page\", \"\" + perPage);\r\n }\r\n if (page > 0) {\r\n parameters.put(\"page\", \"\" + page);\r\n }\r\n\r\n if (extras != null) {\r\n parameters.put(Extras.KEY_EXTRAS, StringUtilities.join(extras, \",\"));\r\n }\r\n\r\n Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n Element photosElement = response.getPayload();\r\n photos.setPage(photosElement.getAttribute(\"page\"));\r\n photos.setPages(photosElement.getAttribute(\"pages\"));\r\n photos.setPerPage(photosElement.getAttribute(\"perpage\"));\r\n photos.setTotal(photosElement.getAttribute(\"total\"));\r\n\r\n NodeList photoNodes = photosElement.getElementsByTagName(\"photo\");\r\n for (int i = 0; i < photoNodes.getLength(); i++) {\r\n Element photoElement = (Element) photoNodes.item(i);\r\n photos.add(PhotoUtils.createPhoto(photoElement));\r\n }\r\n return photos;\r\n }", "private ProjectFile readFile(String inputFile) throws MPXJException\n {\n ProjectReader reader = new UniversalProjectReader();\n ProjectFile projectFile = reader.read(inputFile);\n if (projectFile == null)\n {\n throw new IllegalArgumentException(\"Unsupported file type\");\n }\n return projectFile;\n }", "public void setColorRange(int firstIndex, int lastIndex, int color1, int color2) {\n\t\tfor (int i = firstIndex; i <= lastIndex; i++)\n\t\t\tmap[i] = ImageMath.mixColors((float)(i-firstIndex)/(lastIndex-firstIndex), color1, color2);\n\t}", "@SuppressWarnings(\"SameParameterValue\")\n private void delegatingRepaint(int x, int y, int width, int height) {\n final RepaintDelegate delegate = repaintDelegate.get();\n if (delegate != null) {\n //logger.info(\"Delegating repaint: \" + x + \", \" + y + \", \" + width + \", \" + height);\n delegate.repaint(x, y, width, height);\n } else {\n //logger.info(\"Normal repaint: \" + x + \", \" + y + \", \" + width + \", \" + height);\n repaint(x, y, width, height);\n }\n }" ]
Disply available use cases.
[ "public void displayUseCases()\r\n {\r\n System.out.println();\r\n for (int i = 0; i < useCases.size(); i++)\r\n {\r\n System.out.println(\"[\" + i + \"] \" + ((UseCase) useCases.get(i)).getDescription());\r\n }\r\n }" ]
[ "public void createEnterpriseCustomFieldMap(Props props, Class<?> c)\n {\n byte[] fieldMapData = null;\n for (Integer key : ENTERPRISE_CUSTOM_KEYS)\n {\n fieldMapData = props.getByteArray(key);\n if (fieldMapData != null)\n {\n break;\n }\n }\n\n if (fieldMapData != null)\n {\n int index = 4;\n while (index < fieldMapData.length)\n {\n //Looks like the custom fields have varying types, it may be that the last byte of the four represents the type?\n //System.out.println(ByteArrayHelper.hexdump(fieldMapData, index, 4, false));\n int typeValue = MPPUtility.getInt(fieldMapData, index);\n FieldType type = getFieldType(typeValue);\n if (type != null && type.getClass() == c && type.toString().startsWith(\"Enterprise Custom Field\"))\n {\n int varDataKey = (typeValue & 0xFFFF);\n FieldItem item = new FieldItem(type, FieldLocation.VAR_DATA, 0, 0, varDataKey, 0, 0);\n m_map.put(type, item);\n //System.out.println(item);\n }\n //System.out.println((type == null ? \"?\" : type.getClass().getSimpleName() + \".\" + type) + \" \" + Integer.toHexString(typeValue));\n\n index += 4;\n }\n }\n }", "private FilePath copyClassWorldsFile(FilePath ws, URL resource) {\n try {\n FilePath remoteClassworlds =\n ws.createTextTempFile(\"classworlds\", \"conf\", \"\");\n remoteClassworlds.copyFrom(resource);\n return remoteClassworlds;\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }", "public void setKnots(int[] x, int[] y, byte[] types, int offset, int count) {\n\t\tnumKnots = count;\n\t\txKnots = new int[numKnots];\n\t\tyKnots = new int[numKnots];\n\t\tknotTypes = new byte[numKnots];\n\t\tSystem.arraycopy(x, offset, xKnots, 0, numKnots);\n\t\tSystem.arraycopy(y, offset, yKnots, 0, numKnots);\n\t\tSystem.arraycopy(types, offset, knotTypes, 0, numKnots);\n\t\tsortKnots();\n\t\trebuildGradient();\n\t}", "public String getLinkUrl(JSONObject jsonObject){\n if(jsonObject == null) return null;\n try {\n JSONObject urlObject = jsonObject.has(\"url\") ? jsonObject.getJSONObject(\"url\") : null;\n if(urlObject == null) return null;\n JSONObject androidObject = urlObject.has(\"android\") ? urlObject.getJSONObject(\"android\") : null;\n if(androidObject != null){\n return androidObject.has(\"text\") ? androidObject.getString(\"text\") : \"\";\n }else{\n return \"\";\n }\n } catch (JSONException e) {\n Logger.v(\"Unable to get Link URL with JSON - \"+e.getLocalizedMessage());\n return null;\n }\n }", "public boolean isUpToDate(final DbArtifact artifact) {\n final List<String> versions = repoHandler.getArtifactVersions(artifact);\n final String currentVersion = artifact.getVersion();\n\n final String lastDevVersion = getLastVersion(versions);\n final String lastReleaseVersion = getLastRelease(versions);\n\n if(lastDevVersion == null || lastReleaseVersion == null) {\n // Plain Text comparison against version \"strings\"\n for(final String version: versions){\n if(version.compareTo(currentVersion) > 0){\n return false;\n }\n }\n return true;\n } else {\n return currentVersion.equals(lastDevVersion) || currentVersion.equals(lastReleaseVersion);\n }\n }", "public static boolean isTodoItem(final Document todoItemDoc) {\n return todoItemDoc.containsKey(ID_KEY)\n && todoItemDoc.containsKey(TASK_KEY)\n && todoItemDoc.containsKey(CHECKED_KEY);\n }", "@SuppressWarnings({\"unused\", \"WeakerAccess\"})\n public synchronized void pushInstallReferrer(String source, String medium, String campaign) {\n if (source == null && medium == null && campaign == null) return;\n try {\n // If already pushed, don't send it again\n int status = StorageHelper.getInt(context, \"app_install_status\", 0);\n if (status != 0) {\n Logger.d(\"Install referrer has already been set. Will not override it\");\n return;\n }\n StorageHelper.putInt(context, \"app_install_status\", 1);\n\n if (source != null) source = Uri.encode(source);\n if (medium != null) medium = Uri.encode(medium);\n if (campaign != null) campaign = Uri.encode(campaign);\n\n String uriStr = \"wzrk://track?install=true\";\n if (source != null) uriStr += \"&utm_source=\" + source;\n if (medium != null) uriStr += \"&utm_medium=\" + medium;\n if (campaign != null) uriStr += \"&utm_campaign=\" + campaign;\n\n Uri uri = Uri.parse(uriStr);\n pushDeepLink(uri, true);\n } catch (Throwable t) {\n Logger.v(\"Failed to push install referrer\", t);\n }\n }", "public void addProducer(Broker broker) {\n Properties props = new Properties();\n props.put(\"host\", broker.host);\n props.put(\"port\", \"\" + broker.port);\n props.putAll(config.getProperties());\n if (sync) {\n SyncProducer producer = new SyncProducer(new SyncProducerConfig(props));\n logger.info(\"Creating sync producer for broker id = \" + broker.id + \" at \" + broker.host + \":\" + broker.port);\n syncProducers.put(broker.id, producer);\n } else {\n AsyncProducer<V> producer = new AsyncProducer<V>(new AsyncProducerConfig(props),//\n new SyncProducer(new SyncProducerConfig(props)),//\n serializer,//\n eventHandler,//\n config.getEventHandlerProperties(),//\n this.callbackHandler, //\n config.getCbkHandlerProperties());\n producer.start();\n logger.info(\"Creating async producer for broker id = \" + broker.id + \" at \" + broker.host + \":\" + broker.port);\n asyncProducers.put(broker.id, producer);\n }\n }", "protected boolean intersect(GVRSceneObject.BoundingVolume bv1, GVRSceneObject.BoundingVolume bv2)\n {\n return (bv1.maxCorner.x >= bv2.minCorner.x) &&\n (bv1.maxCorner.y >= bv2.minCorner.y) &&\n (bv1.maxCorner.z >= bv2.minCorner.z) &&\n (bv1.minCorner.x <= bv2.maxCorner.x) &&\n (bv1.minCorner.y <= bv2.maxCorner.y) &&\n (bv1.minCorner.z <= bv2.maxCorner.z);\n }" ]
Print a work group. @param value WorkGroup instance @return work group value
[ "public static final String printWorkGroup(WorkGroup value)\n {\n return (Integer.toString(value == null ? WorkGroup.DEFAULT.getValue() : value.getValue()));\n }" ]
[ "public boolean ifTaskCompletedSuccessOrFailureFromResponse(\n ResponseOnSingeRequest myResponse) {\n\n boolean isCompleted = false;\n try {\n\n if (myResponse == null || myResponse.isFailObtainResponse()) {\n return isCompleted;\n }\n\n String responseBody = myResponse.getResponseBody();\n if (responseBody.matches(successRegex)\n || responseBody.matches(failureRegex)) {\n isCompleted = true;\n }\n\n } catch (Exception t) {\n logger.error(\"fail \" + t);\n\n }\n return isCompleted;\n }", "private void setLanguageFilters(String filters) {\n\t\tthis.filterLanguages = new HashSet<>();\n\t\tif (!\"-\".equals(filters)) {\n\t\t\tCollections.addAll(this.filterLanguages, filters.split(\",\"));\n\t\t}\n\t}", "public void handleConnectOriginal(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException {\n URI uri = request.getURI();\n\n try {\n LOG.fine(\"CONNECT: \" + uri);\n InetAddrPort addrPort;\n // When logging, we'll attempt to send messages to hosts that don't exist\n if (uri.toString().endsWith(\".selenium.doesnotexist:443\")) {\n // so we have to do set the host to be localhost (you can't new up an IAP with a non-existent hostname)\n addrPort = new InetAddrPort(443);\n } else {\n addrPort = new InetAddrPort(uri.toString());\n }\n\n if (isForbidden(HttpMessage.__SSL_SCHEME, addrPort.getHost(), addrPort.getPort(), false)) {\n sendForbid(request, response, uri);\n } else {\n HttpConnection http_connection = request.getHttpConnection();\n http_connection.forceClose();\n\n HttpServer server = http_connection.getHttpServer();\n\n SslListener listener = getSslRelayOrCreateNewOdo(uri, addrPort, server);\n\n int port = listener.getPort();\n\n // Get the timeout\n int timeoutMs = 30000;\n Object maybesocket = http_connection.getConnection();\n if (maybesocket instanceof Socket) {\n Socket s = (Socket) maybesocket;\n timeoutMs = s.getSoTimeout();\n }\n\n // Create the tunnel\n HttpTunnel tunnel = newHttpTunnel(request, response, InetAddress.getByName(null), port, timeoutMs);\n\n if (tunnel != null) {\n // TODO - need to setup semi-busy loop for IE.\n if (_tunnelTimeoutMs > 0) {\n tunnel.getSocket().setSoTimeout(_tunnelTimeoutMs);\n if (maybesocket instanceof Socket) {\n Socket s = (Socket) maybesocket;\n s.setSoTimeout(_tunnelTimeoutMs);\n }\n }\n tunnel.setTimeoutMs(timeoutMs);\n\n customizeConnection(pathInContext, pathParams, request, tunnel.getSocket());\n request.getHttpConnection().setHttpTunnel(tunnel);\n response.setStatus(HttpResponse.__200_OK);\n response.setContentLength(0);\n }\n request.setHandled(true);\n }\n } catch (Exception e) {\n LOG.fine(\"error during handleConnect\", e);\n response.sendError(HttpResponse.__500_Internal_Server_Error, e.toString());\n }\n }", "@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoZonedDateTime<Symmetry454Date> zonedDateTime(TemporalAccessor temporal) {\n return (ChronoZonedDateTime<Symmetry454Date>) super.zonedDateTime(temporal);\n }", "public static Element getChild(Element element, String name) {\r\n return (Element) element.getElementsByTagName(name).item(0);\r\n }", "public void deploySchema(String generatedProtobufName, RemoteCache<String, String> protobufCache, SchemaCapture schemaCapture, SchemaOverride schemaOverrideService,\n\t\t\tURL schemaOverrideResource) {\n\t\t// user defined schema\n\t\tif ( schemaOverrideService != null || schemaOverrideResource != null ) {\n\t\t\tcachedSchema = new SchemaValidator( this, schemaOverrideService, schemaOverrideResource, generatedProtobufName ).provideSchema();\n\t\t}\n\n\t\t// or generate them\n\t\tgenerateProtoschema();\n\n\t\ttry {\n\t\t\tprotobufCache.put( generatedProtobufName, cachedSchema );\n\t\t\tString errors = protobufCache.get( generatedProtobufName + \".errors\" );\n\t\t\tif ( errors != null ) {\n\t\t\t\tthrow LOG.errorAtSchemaDeploy( generatedProtobufName, errors );\n\t\t\t}\n\t\t\tLOG.successfulSchemaDeploy( generatedProtobufName );\n\t\t}\n\t\tcatch (HotRodClientException hrce) {\n\t\t\tthrow LOG.errorAtSchemaDeploy( generatedProtobufName, hrce );\n\t\t}\n\t\tif ( schemaCapture != null ) {\n\t\t\tschemaCapture.put( generatedProtobufName, cachedSchema );\n\t\t}\n\t}", "public static CallSite bootstrapCurrent(Lookup caller, String name, MethodType type) {\n return realBootstrap(caller, name, CALL_TYPES.METHOD.ordinal(), type, false, true, false);\n }", "synchronized void storeUninstallTimestamp() {\n\n if (!this.belowMemThreshold()) {\n getConfigLogger().verbose(\"There is not enough space left on the device to store data, data discarded\");\n return ;\n }\n final String tableName = Table.UNINSTALL_TS.getName();\n\n try {\n final SQLiteDatabase db = dbHelper.getWritableDatabase();\n final ContentValues cv = new ContentValues();\n cv.put(KEY_CREATED_AT, System.currentTimeMillis());\n db.insert(tableName, null, cv);\n } catch (final SQLiteException e) {\n getConfigLogger().verbose(\"Error adding data to table \" + tableName + \" Recreating DB\");\n dbHelper.deleteDatabase();\n } finally {\n dbHelper.close();\n }\n\n }", "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 }" ]
Computes the inner product of A times A and stores the results in B. The inner product is symmetric and this function will only store the lower triangle. The value of the upper triangular matrix is undefined. <p>B = A<sup>T</sup>*A</sup> @param A (Input) Matrix @param B (Output) Storage for output.
[ "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 }" ]
[ "private String determineAndCacheOuterMostNullEmbeddable(String column, String[] path) {\n\t\tString embeddable = path[0];\n\t\t// process each embeddable from less specific to most specific\n\t\t// exclude path leaves as it's a column and not an embeddable\n\t\tfor ( int index = 0; index < path.length - 1; index++ ) {\n\t\t\tSet<String> columnsOfEmbeddable = getColumnsOfEmbeddableAndComputeEmbeddableNullness( embeddable );\n\n\t\t\tif ( nullEmbeddables.contains( embeddable ) ) {\n\t\t\t\t// the current embeddable only has null columns; cache that info for all the columns\n\t\t\t\tfor ( String columnOfEmbeddable : columnsOfEmbeddable ) {\n\t\t\t\t\tcolumnToOuterMostNullEmbeddableCache.put( columnOfEmbeddable, embeddable );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmaybeCacheOnNonNullEmbeddable( path, index, columnsOfEmbeddable );\n\t\t\t}\n\t\t\t// a more specific null embeddable might be present, carry on\n\t\t\tembeddable += \".\" + path[index + 1];\n\t\t}\n\t\treturn columnToOuterMostNullEmbeddableCache.get( column );\n\t}", "public static List<File> listFilesByRegex(String regex, File... directories) {\n return listFiles(directories,\n new RegexFileFilter(regex),\n CanReadFileFilter.CAN_READ);\n }", "public void setKnotType(int n, int type) {\n\t\tknotTypes[n] = (byte)((knotTypes[n] & ~COLOR_MASK) | type);\n\t\trebuildGradient();\n\t}", "public void process(InputStream is) throws Exception\n {\n readHeader(is);\n readVersion(is);\n readTableData(readTableHeaders(is), is);\n }", "public static <T> T columnStringToObject(Class<?> objClass, String str, Pattern delimiterPattern, String[] fieldNames)\r\n throws InstantiationException, IllegalAccessException, NoSuchMethodException, NoSuchFieldException, InvocationTargetException\r\n {\r\n String[] fields = delimiterPattern.split(str);\r\n T item = ErasureUtils.<T>uncheckedCast(objClass.newInstance());\r\n for (int i = 0; i < fields.length; i++) {\r\n try {\r\n Field field = objClass.getDeclaredField(fieldNames[i]);\r\n field.set(item, fields[i]);\r\n } catch (IllegalAccessException ex) {\r\n Method method = objClass.getDeclaredMethod(\"set\" + StringUtils.capitalize(fieldNames[i]), String.class);\r\n method.invoke(item, fields[i]);\r\n }\r\n }\r\n return item;\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 void validateAliases(\r\n final CmsUUID uuid,\r\n final Map<String, String> aliasPaths,\r\n final AsyncCallback<Map<String, String>> callback) {\r\n\r\n CmsRpcAction<Map<String, String>> action = new CmsRpcAction<Map<String, String>>() {\r\n\r\n /**\r\n * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()\r\n */\r\n @Override\r\n public void execute() {\r\n\r\n start(200, true);\r\n CmsCoreProvider.getVfsService().validateAliases(uuid, aliasPaths, this);\r\n }\r\n\r\n /**\r\n * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)\r\n */\r\n @Override\r\n protected void onResponse(Map<String, String> result) {\r\n\r\n stop(false);\r\n callback.onSuccess(result);\r\n }\r\n\r\n };\r\n action.execute();\r\n }", "void successfulBoot() throws ConfigurationPersistenceException {\n synchronized (this) {\n if (doneBootup.get()) {\n return;\n }\n final File copySource;\n if (!interactionPolicy.isReadOnly()) {\n copySource = mainFile;\n } else {\n\n if ( FilePersistenceUtils.isParentFolderWritable(mainFile) ) {\n copySource = new File(mainFile.getParentFile(), mainFile.getName() + \".boot\");\n } else{\n copySource = new File(configurationDir, mainFile.getName() + \".boot\");\n }\n\n FilePersistenceUtils.deleteFile(copySource);\n }\n\n try {\n if (!bootFile.equals(copySource)) {\n FilePersistenceUtils.copyFile(bootFile, copySource);\n }\n\n createHistoryDirectory();\n\n final File historyBase = new File(historyRoot, mainFile.getName());\n lastFile = addSuffixToFile(historyBase, LAST);\n final File boot = addSuffixToFile(historyBase, BOOT);\n final File initial = addSuffixToFile(historyBase, INITIAL);\n\n if (!initial.exists()) {\n FilePersistenceUtils.copyFile(copySource, initial);\n }\n\n FilePersistenceUtils.copyFile(copySource, lastFile);\n FilePersistenceUtils.copyFile(copySource, boot);\n } catch (IOException e) {\n throw ControllerLogger.ROOT_LOGGER.failedToCreateConfigurationBackup(e, bootFile);\n } finally {\n if (interactionPolicy.isReadOnly()) {\n //Delete the temporary file\n try {\n FilePersistenceUtils.deleteFile(copySource);\n } catch (Exception ignore) {\n }\n }\n }\n doneBootup.set(true);\n }\n }", "public static base_responses add(nitro_service client, dnsaaaarec resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tdnsaaaarec addresources[] = new dnsaaaarec[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new dnsaaaarec();\n\t\t\t\taddresources[i].hostname = resources[i].hostname;\n\t\t\t\taddresources[i].ipv6address = resources[i].ipv6address;\n\t\t\t\taddresources[i].ttl = resources[i].ttl;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}" ]
This method is used to launch mock agents. First it creates them, with the generic df_service_name \"mock_agent\", and then the method sends to the agent a message with the new df_service_name and its behaviour. @param agent_name The name of the mock agent @param agent_path The path of the agent, described in mocks/jadex/common/Definitions file @param configuration Where the new df_service_name and the agents behaviour is saved @param scenario The Scenario of the Test
[ "public static void startMockJadexAgent(String agent_name,\n String agent_path, MockConfiguration configuration,\n BeastTestCase story) {\n\n story.startAgent(agent_name, agent_path);\n story.sendMessageToAgent(agent_name, SFipa.INFORM, configuration);\n story.setExecutionTime(2000); // To get time to execute the DF rename goal\n }" ]
[ "public AsciiTable setPaddingTop(int paddingTop) {\r\n\t\tfor(AT_Row row : this.rows){\r\n\t\t\tif(row.getType()==TableRowType.CONTENT){\r\n\t\t\t\trow.setPaddingTop(paddingTop);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}", "public static base_responses add(nitro_service client, sslocspresponder resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tsslocspresponder addresources[] = new sslocspresponder[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new sslocspresponder();\n\t\t\t\taddresources[i].name = resources[i].name;\n\t\t\t\taddresources[i].url = resources[i].url;\n\t\t\t\taddresources[i].cache = resources[i].cache;\n\t\t\t\taddresources[i].cachetimeout = resources[i].cachetimeout;\n\t\t\t\taddresources[i].batchingdepth = resources[i].batchingdepth;\n\t\t\t\taddresources[i].batchingdelay = resources[i].batchingdelay;\n\t\t\t\taddresources[i].resptimeout = resources[i].resptimeout;\n\t\t\t\taddresources[i].respondercert = resources[i].respondercert;\n\t\t\t\taddresources[i].trustresponder = resources[i].trustresponder;\n\t\t\t\taddresources[i].producedattimeskew = resources[i].producedattimeskew;\n\t\t\t\taddresources[i].signingcert = resources[i].signingcert;\n\t\t\t\taddresources[i].usenonce = resources[i].usenonce;\n\t\t\t\taddresources[i].insertclientcert = resources[i].insertclientcert;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "protected void processStart(Endpoint endpoint, EventTypeEnum eventType) {\n if (!sendLifecycleEvent) {\n return;\n }\n\n Event event = createEvent(endpoint, eventType);\n queue.add(event);\n }", "protected final void setDerivedEndType() {\n\n m_endType = getPatternType().equals(PatternType.NONE) || getPatternType().equals(PatternType.INDIVIDUAL)\n ? EndType.SINGLE\n : null != getSeriesEndDate() ? EndType.DATE : EndType.TIMES;\n }", "public long getTimeRemainingInMillis()\n {\n long batchTime = System.currentTimeMillis() - startTime;\n double timePerIteration = (double) batchTime / (double) worked.get();\n return (long) (timePerIteration * (total - worked.get()));\n }", "@Deprecated\n public ClientConfig setNodeBannagePeriod(int nodeBannagePeriod, TimeUnit unit) {\n this.failureDetectorBannagePeriod = unit.toMillis(nodeBannagePeriod);\n return this;\n }", "public static String regexFindFirst(String pattern, String str) {\n return regexFindFirst(Pattern.compile(pattern), str, 1);\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 synchronized void stop(long quietPeriod, long timeout, TimeUnit unit) throws Exception {\n if (state == State.STOPPED) {\n LOG.debug(\"Ignore stop() call on HTTP service {} since it has already been stopped.\", serviceName);\n return;\n }\n\n LOG.info(\"Stopping HTTP Service {}\", serviceName);\n\n try {\n try {\n channelGroup.close().awaitUninterruptibly();\n } finally {\n try {\n shutdownExecutorGroups(quietPeriod, timeout, unit,\n bootstrap.config().group(), bootstrap.config().childGroup(), eventExecutorGroup);\n } finally {\n resourceHandler.destroy(handlerContext);\n }\n }\n } catch (Throwable t) {\n state = State.FAILED;\n throw t;\n }\n state = State.STOPPED;\n LOG.debug(\"Stopped HTTP Service {} on address {}\", serviceName, bindAddress);\n }" ]
Add utility routes the router @param router
[ "public ProteusApplication addDefaultRoutes(RoutingHandler router)\n {\n\n if (config.hasPath(\"health.statusPath\")) {\n try {\n final String statusPath = config.getString(\"health.statusPath\");\n\n router.add(Methods.GET, statusPath, (final HttpServerExchange exchange) ->\n {\n exchange.getResponseHeaders().add(Headers.CONTENT_TYPE, MediaType.TEXT_PLAIN);\n exchange.getResponseSender().send(\"OK\");\n });\n\n this.registeredEndpoints.add(EndpointInfo.builder().withConsumes(\"*/*\").withProduces(\"text/plain\").withPathTemplate(statusPath).withControllerName(\"Internal\").withMethod(Methods.GET).build());\n\n } catch (Exception e) {\n log.error(\"Error adding health status route.\", e.getMessage());\n }\n }\n\n if (config.hasPath(\"application.favicon\")) {\n try {\n\n final ByteBuffer faviconImageBuffer;\n\n final File faviconFile = new File(config.getString(\"application.favicon\"));\n\n if (!faviconFile.exists()) {\n try (final InputStream stream = this.getClass().getResourceAsStream(config.getString(\"application.favicon\"))) {\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n\n byte[] buffer = new byte[4096];\n int read = 0;\n while (read != -1) {\n read = stream.read(buffer);\n if (read > 0) {\n baos.write(buffer, 0, read);\n }\n }\n\n faviconImageBuffer = ByteBuffer.wrap(baos.toByteArray());\n }\n\n } else {\n try (final InputStream stream = Files.newInputStream(Paths.get(config.getString(\"application.favicon\")))) {\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n\n byte[] buffer = new byte[4096];\n int read = 0;\n while (read != -1) {\n read = stream.read(buffer);\n if (read > 0) {\n baos.write(buffer, 0, read);\n }\n }\n\n faviconImageBuffer = ByteBuffer.wrap(baos.toByteArray());\n }\n }\n\n router.add(Methods.GET, \"favicon.ico\", (final HttpServerExchange exchange) ->\n {\n exchange.getResponseHeaders().add(Headers.CONTENT_TYPE, io.sinistral.proteus.server.MediaType.IMAGE_X_ICON.toString());\n exchange.getResponseSender().send(faviconImageBuffer);\n });\n\n } catch (Exception e) {\n log.error(\"Error adding favicon route.\", e.getMessage());\n }\n }\n\n return this;\n }" ]
[ "@Override\n protected URL getDefinitionsURL() {\n try {\n URL url = CustomEPSGCodes.class.getResource(CUSTOM_EPSG_CODES_FILE);\n // quickly test url\n try (InputStream stream = url.openStream()) {\n //noinspection ResultOfMethodCallIgnored\n stream.read();\n }\n return url;\n } catch (Throwable e) {\n throw new AssertionError(\"Unable to load /epsg.properties file from root of classpath.\");\n }\n }", "public void addOpacityBar(OpacityBar bar) {\n\t\tmOpacityBar = bar;\n\t\t// Give an instance of the color picker to the Opacity bar.\n\t\tmOpacityBar.setColorPicker(this);\n\t\tmOpacityBar.setColor(mColor);\n\t}", "@Deprecated\n @SuppressWarnings(\"deprecation\")\n public void push(String eventName, HashMap<String, Object> chargeDetails,\n ArrayList<HashMap<String, Object>> items)\n throws InvalidEventNameException {\n // This method is for only charged events\n if (!eventName.equals(Constants.CHARGED_EVENT)) {\n throw new InvalidEventNameException(\"Not a charged event\");\n }\n CleverTapAPI cleverTapAPI = weakReference.get();\n if(cleverTapAPI == null){\n Logger.d(\"CleverTap Instance is null.\");\n } else {\n cleverTapAPI.pushChargedEvent(chargeDetails, items);\n }\n }", "public void addProfile(Object key, DescriptorRepository repository)\r\n {\r\n if (metadataProfiles.contains(key))\r\n {\r\n throw new MetadataException(\"Duplicate profile key. Key '\" + key + \"' already exists.\");\r\n }\r\n metadataProfiles.put(key, repository);\r\n }", "public String getUnicodeString(Integer type)\n {\n String result = null;\n\n byte[] item = m_map.get(type);\n if (item != null)\n {\n result = MPPUtility.getUnicodeString(item, 0);\n }\n\n return (result);\n }", "public static String encodeQuery(String query, String encoding) throws UnsupportedEncodingException {\n\t\treturn HierarchicalUriComponents.encodeUriComponent(query, encoding, HierarchicalUriComponents.Type.QUERY);\n\t}", "public static Boolean assertFalse(Boolean value, String message) {\n if (Boolean.valueOf(value))\n throw new IllegalArgumentException(message);\n return value;\n }", "public Method getGetMethod(final Object object, final String fieldName) {\n\t\tif( object == null ) {\n\t\t\tthrow new NullPointerException(\"object should not be null\");\n\t\t} else if( fieldName == null ) {\n\t\t\tthrow new NullPointerException(\"fieldName should not be null\");\n\t\t}\n\t\t\n\t\tMethod method = getCache.get(object.getClass().getName(), fieldName);\n\t\tif( method == null ) {\n\t\t\tmethod = ReflectionUtils.findGetter(object, fieldName);\n\t\t\tgetCache.set(object.getClass().getName(), fieldName, method);\n\t\t}\n\t\treturn method;\n\t}", "public static String getCountryCodeAndCheckDigit(final String iban) {\n return iban.substring(COUNTRY_CODE_INDEX,\n COUNTRY_CODE_INDEX + COUNTRY_CODE_LENGTH + CHECK_DIGIT_LENGTH);\n }" ]
Prints a suggestion to stderr for the argument based on the levenshtein distance metric @param arg the argument which could not be assigned to a flag @param co the {@link ConfigOption} List where every flag is stored
[ "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 }" ]
[ "@Nonnull\n public final Style getDefaultStyle(@Nonnull final String geometryType) {\n String normalizedGeomName = GEOMETRY_NAME_ALIASES.get(geometryType.toLowerCase());\n if (normalizedGeomName == null) {\n normalizedGeomName = geometryType.toLowerCase();\n }\n Style style = this.defaultStyle.get(normalizedGeomName.toLowerCase());\n if (style == null) {\n style = this.namedStyles.get(normalizedGeomName.toLowerCase());\n }\n\n if (style == null) {\n StyleBuilder builder = new StyleBuilder();\n final Symbolizer symbolizer;\n if (isPointType(normalizedGeomName)) {\n symbolizer = builder.createPointSymbolizer();\n } else if (isLineType(normalizedGeomName)) {\n symbolizer = builder.createLineSymbolizer(Color.black, 2);\n } else if (isPolygonType(normalizedGeomName)) {\n symbolizer = builder.createPolygonSymbolizer(Color.lightGray, Color.black, 2);\n } else if (normalizedGeomName.equalsIgnoreCase(Constants.Style.Raster.NAME)) {\n symbolizer = builder.createRasterSymbolizer();\n } else if (normalizedGeomName.startsWith(Constants.Style.OverviewMap.NAME)) {\n symbolizer = createMapOverviewStyle(normalizedGeomName, builder);\n } else {\n final Style geomStyle = this.defaultStyle.get(Geometry.class.getSimpleName().toLowerCase());\n if (geomStyle != null) {\n return geomStyle;\n } else {\n symbolizer = builder.createPointSymbolizer();\n }\n }\n style = builder.createStyle(symbolizer);\n }\n return style;\n }", "public static String getPrefix(String column) {\n\t\treturn column.contains( \".\" ) ? DOT_SEPARATOR_PATTERN.split( column )[0] : null;\n\t}", "public static String toSafeFileName(String name) {\n int size = name.length();\n StringBuilder builder = new StringBuilder(size * 2);\n for (int i = 0; i < size; i++) {\n char c = name.charAt(i);\n boolean valid = c >= 'a' && c <= 'z';\n valid = valid || (c >= 'A' && c <= 'Z');\n valid = valid || (c >= '0' && c <= '9');\n valid = valid || (c == '_') || (c == '-') || (c == '.');\n\n if (valid) {\n builder.append(c);\n } else {\n // Encode the character using hex notation\n builder.append('x');\n builder.append(Integer.toHexString(i));\n }\n }\n return builder.toString();\n }", "public List<T> resolveConflicts(List<T> values) {\n if(values.size() > 1)\n return values;\n else\n return Collections.singletonList(values.get(0));\n }", "public void open(File versionDir) {\n /* acquire modification lock */\n fileModificationLock.writeLock().lock();\n try {\n /* check that the store is currently closed */\n if(isOpen)\n throw new IllegalStateException(\"Attempt to open already open store.\");\n\n // Find version directory from symbolic link or max version id\n if(versionDir == null) {\n versionDir = ReadOnlyUtils.getCurrentVersion(storeDir);\n\n if(versionDir == null)\n versionDir = new File(storeDir, \"version-0\");\n }\n\n // Set the max version id\n long versionId = ReadOnlyUtils.getVersionId(versionDir);\n if(versionId == -1) {\n throw new VoldemortException(\"Unable to parse id from version directory \"\n + versionDir.getAbsolutePath());\n }\n Utils.mkdirs(versionDir);\n\n // Validate symbolic link, and create it if it doesn't already exist\n Utils.symlink(versionDir.getAbsolutePath(), storeDir.getAbsolutePath() + File.separator + \"latest\");\n this.fileSet = new ChunkedFileSet(versionDir, routingStrategy, nodeId, maxValueBufferAllocationSize);\n storeVersionManager.syncInternalStateFromFileSystem(false);\n this.lastSwapped = System.currentTimeMillis();\n this.isOpen = true;\n } catch(IOException e) {\n logger.error(\"Error in opening store\", e);\n } finally {\n fileModificationLock.writeLock().unlock();\n }\n }", "public static base_responses add(nitro_service client, dnssuffix resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tdnssuffix addresources[] = new dnssuffix[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new dnssuffix();\n\t\t\t\taddresources[i].Dnssuffix = resources[i].Dnssuffix;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "protected void checkVariableName(GraphRewrite event, EvaluationContext context)\n {\n if (variableName == null)\n {\n setVariableName(Iteration.getPayloadVariableName(event, context));\n }\n }", "private String getCurrencyFormat(CurrencySymbolPosition position)\n {\n String result;\n\n switch (position)\n {\n case AFTER:\n {\n result = \"1.1#\";\n break;\n }\n\n case AFTER_WITH_SPACE:\n {\n result = \"1.1 #\";\n break;\n }\n\n case BEFORE_WITH_SPACE:\n {\n result = \"# 1.1\";\n break;\n }\n\n default:\n case BEFORE:\n {\n result = \"#1.1\";\n break;\n }\n }\n\n return result;\n }", "@UiHandler(\"m_everyDay\")\r\n void onEveryDayChange(ValueChangeEvent<String> event) {\r\n\r\n if (handleChange()) {\r\n m_controller.setInterval(m_everyDay.getFormValueAsString());\r\n }\r\n\r\n }" ]
Quick and dirty XML text escape. @param sb working string buffer @param text input text @return escaped text
[ "private String escapeText(StringBuilder sb, String text)\n {\n int length = text.length();\n char c;\n\n sb.setLength(0);\n\n for (int loop = 0; loop < length; loop++)\n {\n c = text.charAt(loop);\n\n switch (c)\n {\n case '<':\n {\n sb.append(\"&lt;\");\n break;\n }\n\n case '>':\n {\n sb.append(\"&gt;\");\n break;\n }\n\n case '&':\n {\n sb.append(\"&amp;\");\n break;\n }\n\n default:\n {\n if (validXMLCharacter(c))\n {\n if (c > 127)\n {\n sb.append(\"&#\" + (int) c + \";\");\n }\n else\n {\n sb.append(c);\n }\n }\n\n break;\n }\n }\n }\n\n return (sb.toString());\n }" ]
[ "protected static <R extends AddressSection, S extends AddressSegment> R fastIncrement(\n\t\t\tR section,\n\t\t\tlong increment,\n\t\t\tAddressCreator<?, R, ?, S> addrCreator, \n\t\t\tSupplier<R> lowerProducer,\n\t\t\tSupplier<R> upperProducer,\n\t\t\tInteger prefixLength) {\n\t\tif(increment >= 0) {\n\t\t\tBigInteger count = section.getCount();\n\t\t\tif(count.compareTo(LONG_MAX) <= 0) {\n\t\t\t\tlong longCount = count.longValue();\n\t\t\t\tif(longCount > increment) {\n\t\t\t\t\tif(longCount == increment + 1) {\n\t\t\t\t\t\treturn upperProducer.get();\n\t\t\t\t\t}\n\t\t\t\t\treturn incrementRange(section, increment, addrCreator, lowerProducer, prefixLength);\n\t\t\t\t}\n\t\t\t\tBigInteger value = section.getValue();\n\t\t\t\tBigInteger upperValue;\n\t\t\t\tif(value.compareTo(LONG_MAX) <= 0 && (upperValue = section.getUpperValue()).compareTo(LONG_MAX) <= 0) {\n\t\t\t\t\treturn increment(\n\t\t\t\t\t\t\tsection,\n\t\t\t\t\t\t\tincrement,\n\t\t\t\t\t\t\taddrCreator,\n\t\t\t\t\t\t\tcount.longValue(),\n\t\t\t\t\t\t\tvalue.longValue(),\n\t\t\t\t\t\t\tupperValue.longValue(),\n\t\t\t\t\t\t\tlowerProducer,\n\t\t\t\t\t\t\tupperProducer,\n\t\t\t\t\t\t\tprefixLength);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tBigInteger value = section.getValue();\n\t\t\tif(value.compareTo(LONG_MAX) <= 0) {\n\t\t\t\treturn add(lowerProducer.get(), value.longValue(), increment, addrCreator, prefixLength);\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "public static Properties loadProperties(String[] filesToLoad)\n {\n Properties p = new Properties();\n InputStream fis = null;\n for (String path : filesToLoad)\n {\n try\n {\n fis = Db.class.getClassLoader().getResourceAsStream(path);\n if (fis != null)\n {\n p.load(fis);\n jqmlogger.info(\"A jqm.properties file was found at {}\", path);\n }\n }\n catch (IOException e)\n {\n // We allow no configuration files, but not an unreadable configuration file.\n throw new DatabaseException(\"META-INF/jqm.properties file is invalid\", e);\n }\n finally\n {\n closeQuietly(fis);\n }\n }\n\n // Overload the datasource name from environment variable if any (tests only).\n String dbName = System.getenv(\"DB\");\n if (dbName != null)\n {\n p.put(\"com.enioka.jqm.jdbc.datasource\", \"jdbc/\" + dbName);\n }\n\n // Done\n return p;\n }", "public String getCanonicalTypeName(Object object) {\n ensureNotNull(\"object\", object);\n\n for (TypeDetector typeDetector : typeDetectors) {\n if (typeDetector.canHandle(object)) {\n return typeDetector.detectType(object);\n }\n }\n\n throw LOG.unableToDetectCanonicalType(object);\n }", "public static base_response update(nitro_service client, nsspparams resource) throws Exception {\n\t\tnsspparams updateresource = new nsspparams();\n\t\tupdateresource.basethreshold = resource.basethreshold;\n\t\tupdateresource.throttle = resource.throttle;\n\t\treturn updateresource.update_resource(client);\n\t}", "public static @Nullable CleverTapAPI getInstance(Context context) throws CleverTapMetaDataNotFoundException, CleverTapPermissionsNotSatisfied {\n // For Google Play Store/Android Studio tracking\n sdkVersion = BuildConfig.SDK_VERSION_STRING;\n return getDefaultInstance(context);\n }", "private void addMembers(Collection memberNames, HashMap members, XClass type, String tagName, String paramName, String paramValue) throws XDocletException\r\n {\r\n if (!type.isInterface() && (type.getFields() != null)) {\r\n XField field;\r\n\r\n for (Iterator it = type.getFields().iterator(); it.hasNext(); ) {\r\n field = (XField)it.next();\r\n if (!field.isFinal() && !field.isStatic() && !field.isTransient()) {\r\n if (checkTagAndParam(field.getDoc(), tagName, paramName, paramValue)) {\r\n // already processed ?\r\n if (!members.containsKey(field.getName())) {\r\n memberNames.add(field.getName());\r\n members.put(field.getName(), field);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (type.getMethods() != null) {\r\n XMethod method;\r\n String propertyName;\r\n\r\n for (Iterator it = type.getMethods().iterator(); it.hasNext(); ) {\r\n method = (XMethod)it.next();\r\n if (!method.isConstructor() && !method.isNative() && !method.isStatic()) {\r\n if (checkTagAndParam(method.getDoc(), tagName, paramName, paramValue)) {\r\n if (MethodTagsHandler.isGetterMethod(method) || MethodTagsHandler.isSetterMethod(method)) {\r\n propertyName = MethodTagsHandler.getPropertyNameFor(method);\r\n if (!members.containsKey(propertyName)) {\r\n memberNames.add(propertyName);\r\n members.put(propertyName, method);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }", "public Map<String, SetAndCount> getAggregateResultFullSummary() {\n\n Map<String, SetAndCount> summaryMap = new ConcurrentHashMap<String, SetAndCount>();\n\n for (Entry<String, LinkedHashSet<String>> entry : aggregateResultMap\n .entrySet()) {\n summaryMap.put(entry.getKey(), new SetAndCount(entry.getValue()));\n }\n\n return summaryMap;\n }", "protected Boolean getIgnoreQuery() {\n\n Boolean isIgnoreQuery = parseOptionalBooleanValue(m_configObject, JSON_KEY_IGNORE_QUERY);\n return (null == isIgnoreQuery) && (m_baseConfig != null)\n ? Boolean.valueOf(m_baseConfig.getGeneralConfig().getIgnoreQueryParam())\n : isIgnoreQuery;\n }", "public Map<String, ClientWidgetInfo> securityClone(Map<String, ClientWidgetInfo> widgetInfo) {\n\t\tMap<String, ClientWidgetInfo> res = new HashMap<String, ClientWidgetInfo>();\n\t\tfor (Map.Entry<String, ClientWidgetInfo> entry : widgetInfo.entrySet()) {\n\t\t\tClientWidgetInfo value = entry.getValue();\n\t\t\tif (!(value instanceof ServerSideOnlyInfo)) {\n\t\t\t\tres.put(entry.getKey(), value);\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t}" ]
General API -> compile each of supplied files -> recompile any required types for which we have an incomplete principle structure
[ "private void compile(ICompilationUnit[] sourceUnits, boolean lastRound) {\n this.stats.startTime = System.currentTimeMillis();\n try {\n // build and record parsed units\n reportProgress(Messages.compilation_beginningToCompile);\n\n if (this.options.complianceLevel >= ClassFileConstants.JDK9) {\n // in Java 9 the compiler must never ask the oracle for a module that is contained in the input units:\n sortModuleDeclarationsFirst(sourceUnits);\n }\n if (this.annotationProcessorManager == null) {\n beginToCompile(sourceUnits);\n } else {\n ICompilationUnit[] originalUnits = sourceUnits.clone(); // remember source units in case a source type collision occurs\n try {\n beginToCompile(sourceUnits);\n if (!lastRound) {\n processAnnotations();\n }\n if (!this.options.generateClassFiles) {\n // -proc:only was set on the command line\n return;\n }\n } catch (SourceTypeCollisionException e) {\n backupAptProblems();\n reset();\n // a generated type was referenced before it was created\n // the compiler either created a MissingType or found a BinaryType for it\n // so add the processor's generated files & start over,\n // but remember to only pass the generated files to the annotation processor\n int originalLength = originalUnits.length;\n int newProcessedLength = e.newAnnotationProcessorUnits.length;\n ICompilationUnit[] combinedUnits = new ICompilationUnit[originalLength + newProcessedLength];\n System.arraycopy(originalUnits, 0, combinedUnits, 0, originalLength);\n System.arraycopy(e.newAnnotationProcessorUnits, 0, combinedUnits, originalLength, newProcessedLength);\n this.annotationProcessorStartIndex = originalLength;\n compile(combinedUnits, e.isLastRound);\n return;\n }\n }\n // Restore the problems before the results are processed and cleaned up.\n restoreAptProblems();\n processCompiledUnits(0, lastRound);\n } catch (AbortCompilation e) {\n this.handleInternalException(e, null);\n }\n if (this.options.verbose) {\n if (this.totalUnits > 1) {\n this.out.println(\n Messages.bind(Messages.compilation_units, String.valueOf(this.totalUnits)));\n } else {\n this.out.println(\n Messages.bind(Messages.compilation_unit, String.valueOf(this.totalUnits)));\n }\n }\n }" ]
[ "protected void checkVariableName(GraphRewrite event, EvaluationContext context)\n {\n if (variableName == null)\n {\n setVariableName(Iteration.getPayloadVariableName(event, context));\n }\n }", "public void update(int width, int height, int sampleCount) {\n if (capturing) {\n throw new IllegalStateException(\"Cannot update backing texture while capturing\");\n }\n\n this.width = width;\n this.height = height;\n\n if (sampleCount == 0)\n captureTexture = new GVRRenderTexture(getGVRContext(), width, height);\n else\n captureTexture = new GVRRenderTexture(getGVRContext(), width, height, sampleCount);\n\n setRenderTexture(captureTexture);\n readBackBuffer = new int[width * height];\n }", "protected static BoxCollaboration.Info create(BoxAPIConnection api, JsonObject accessibleBy, JsonObject item,\n BoxCollaboration.Role role, Boolean notify, Boolean canViewPath) {\n\n\n String queryString = \"\";\n if (notify != null) {\n queryString = new QueryStringBuilder().appendParam(\"notify\", notify.toString()).toString();\n }\n URL url;\n if (queryString.length() > 0) {\n url = COLLABORATIONS_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), queryString);\n } else {\n url = COLLABORATIONS_URL_TEMPLATE.build(api.getBaseURL());\n }\n\n JsonObject requestJSON = new JsonObject();\n requestJSON.add(\"item\", item);\n requestJSON.add(\"accessible_by\", accessibleBy);\n requestJSON.add(\"role\", role.toJSONString());\n if (canViewPath != null) {\n requestJSON.add(\"can_view_path\", canViewPath.booleanValue());\n }\n\n BoxJSONRequest request = new BoxJSONRequest(api, url, \"POST\");\n\n request.setBody(requestJSON.toString());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n\n BoxCollaboration newCollaboration = new BoxCollaboration(api, responseJSON.get(\"id\").asString());\n return newCollaboration.new Info(responseJSON);\n }", "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 }", "protected void updateTables()\n {\n byte[] data = m_model.getData();\n int columns = m_model.getColumns();\n int rows = (data.length / columns) + 1;\n int offset = m_model.getOffset();\n\n String[][] hexData = new String[rows][columns];\n String[][] asciiData = new String[rows][columns];\n\n int row = 0;\n int column = 0;\n StringBuilder hexValue = new StringBuilder();\n for (int index = offset; index < data.length; index++)\n {\n int value = data[index];\n hexValue.setLength(0);\n hexValue.append(HEX_DIGITS[(value & 0xF0) >> 4]);\n hexValue.append(HEX_DIGITS[value & 0x0F]);\n\n char c = (char) value;\n if ((c > 200) || (c < 27))\n {\n c = ' ';\n }\n\n hexData[row][column] = hexValue.toString();\n asciiData[row][column] = Character.toString(c);\n\n ++column;\n if (column == columns)\n {\n column = 0;\n ++row;\n }\n }\n\n String[] columnHeadings = new String[columns];\n TableModel hexTableModel = new DefaultTableModel(hexData, columnHeadings)\n {\n @Override public boolean isCellEditable(int r, int c)\n {\n return false;\n }\n };\n\n TableModel asciiTableModel = new DefaultTableModel(asciiData, columnHeadings)\n {\n @Override public boolean isCellEditable(int r, int c)\n {\n return false;\n }\n };\n\n m_model.setSizeValueLabel(Integer.toString(data.length));\n m_model.setHexTableModel(hexTableModel);\n m_model.setAsciiTableModel(asciiTableModel);\n m_model.setCurrentSelectionIndex(0);\n m_model.setPreviousSelectionIndex(0);\n }", "private void getDailyDates(Calendar calendar, int frequency, List<Date> dates)\n {\n while (moreDates(calendar, dates))\n {\n dates.add(calendar.getTime());\n calendar.add(Calendar.DAY_OF_YEAR, frequency);\n }\n }", "public GVRTexture getSplashTexture(GVRContext gvrContext) {\n Bitmap bitmap = BitmapFactory.decodeResource( //\n gvrContext.getContext().getResources(), //\n R.drawable.__default_splash_screen__);\n GVRTexture tex = new GVRTexture(gvrContext);\n tex.setImage(new GVRBitmapImage(gvrContext, bitmap));\n return tex;\n }", "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}", "private static URI createRaster(\n final Dimension targetSize, final RasterReference rasterReference,\n final Double rotation, final Color backgroundColor,\n final File workingDir) throws IOException {\n final File path = File.createTempFile(\"north-arrow-\", \".png\", workingDir);\n\n final BufferedImage newImage =\n new BufferedImage(targetSize.width, targetSize.height, BufferedImage.TYPE_4BYTE_ABGR);\n final Graphics2D graphics2d = newImage.createGraphics();\n try {\n final BufferedImage originalImage = ImageIO.read(rasterReference.inputStream);\n if (originalImage == null) {\n LOGGER.warn(\"Unable to load NorthArrow graphic: {}, it is not an image format that can be \" +\n \"decoded\",\n rasterReference.uri);\n throw new IllegalArgumentException();\n }\n\n // set background color\n graphics2d.setColor(backgroundColor);\n graphics2d.fillRect(0, 0, targetSize.width, targetSize.height);\n\n // scale the original image to fit the new size\n int newWidth;\n int newHeight;\n if (originalImage.getWidth() > originalImage.getHeight()) {\n newWidth = targetSize.width;\n newHeight = Math.min(\n targetSize.height,\n (int) Math.ceil(newWidth / (originalImage.getWidth() /\n (double) originalImage.getHeight())));\n } else {\n newHeight = targetSize.height;\n newWidth = Math.min(\n targetSize.width,\n (int) Math.ceil(newHeight / (originalImage.getHeight() /\n (double) originalImage.getWidth())));\n }\n\n // position the original image in the center of the new\n int deltaX = (int) Math.floor((targetSize.width - newWidth) / 2.0);\n int deltaY = (int) Math.floor((targetSize.height - newHeight) / 2.0);\n\n if (!FloatingPointUtil.equals(rotation, 0.0)) {\n final AffineTransform rotate = AffineTransform.getRotateInstance(\n rotation, targetSize.width / 2.0, targetSize.height / 2.0);\n graphics2d.setTransform(rotate);\n }\n\n graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,\n RenderingHints.VALUE_INTERPOLATION_BICUBIC);\n graphics2d.drawImage(originalImage, deltaX, deltaY, newWidth, newHeight, null);\n\n ImageUtils.writeImage(newImage, \"png\", path);\n } finally {\n graphics2d.dispose();\n }\n return path.toURI();\n }" ]
Generate a Jongo query regarding a set of parameters. @param params Map<queryKey, queryValue> of query parameters @return String
[ "public static String generateQuery(final Map<String,Object> params){\n\t\tfinal StringBuilder sb = new StringBuilder();\n\t\tboolean newEntry = false;\n\t\t\n\t\tsb.append(\"{\");\n\t\tfor(final Entry<String,Object> param: params.entrySet()){\n\t\t\tif(newEntry){\n\t\t\t\tsb.append(\", \");\n\t\t\t}\n\n\t\t\tsb.append(param.getKey());\n\t\t\tsb.append(\": \");\n\t\t\tsb.append(getParam(param.getValue()));\n\t\t\tnewEntry = true;\n\t\t}\n\t\tsb.append(\"}\");\n\t\t\n\t\treturn sb.toString();\n\t}" ]
[ "public RandomVariableInterface[] getBasisFunctions(double exerciseDate, LIBORModelMonteCarloSimulationInterface model) throws CalculationException {\n\n\t\tArrayList<RandomVariableInterface> basisFunctions = new ArrayList<RandomVariableInterface>();\n\n\t\tRandomVariableInterface basisFunction;\n\n\t\t// Constant\n\t\tbasisFunction = model.getRandomVariableForConstant(1.0);\n\t\tbasisFunctions.add(basisFunction);\n\n\t\t// LIBORs\n\t\tint liborPeriodIndex, liborPeriodIndexEnd;\n\t\tRandomVariableInterface rate;\n\n\t\t// 1 Period\n\t\tbasisFunction = model.getRandomVariableForConstant(1.0);\n\t\tliborPeriodIndex = model.getLiborPeriodIndex(exerciseDate);\n\t\tif(liborPeriodIndex < 0) {\n\t\t\tliborPeriodIndex = -liborPeriodIndex-1;\n\t\t}\n\t\tliborPeriodIndexEnd = liborPeriodIndex+1;\n\t\tdouble periodLength1 = model.getLiborPeriod(liborPeriodIndexEnd) - model.getLiborPeriod(liborPeriodIndex);\n\n\t\trate = model.getLIBOR(exerciseDate, model.getLiborPeriod(liborPeriodIndex), model.getLiborPeriod(liborPeriodIndexEnd));\n\t\tbasisFunction = basisFunction.discount(rate, periodLength1);\n\t\tbasisFunctions.add(basisFunction);//.div(Math.sqrt(basisFunction.mult(basisFunction).getAverage())));\n\n\t\tbasisFunction = basisFunction.discount(rate, periodLength1);\n\t\tbasisFunctions.add(basisFunction);//.div(Math.sqrt(basisFunction.mult(basisFunction).getAverage())));\n\n\t\t// n/2 Period\n\t\tbasisFunction = model.getRandomVariableForConstant(1.0);\n\t\tliborPeriodIndex = model.getLiborPeriodIndex(exerciseDate);\n\t\tif(liborPeriodIndex < 0) {\n\t\t\tliborPeriodIndex = -liborPeriodIndex-1;\n\t\t}\n\t\tliborPeriodIndexEnd = (liborPeriodIndex + model.getNumberOfLibors())/2;\n\n\t\tdouble periodLength2 = model.getLiborPeriod(liborPeriodIndexEnd) - model.getLiborPeriod(liborPeriodIndex);\n\n\t\tif(periodLength2 != periodLength1) {\n\t\t\trate = model.getLIBOR(exerciseDate, model.getLiborPeriod(liborPeriodIndex), model.getLiborPeriod(liborPeriodIndexEnd));\n\t\t\tbasisFunction = basisFunction.discount(rate, periodLength2);\n\t\t\tbasisFunctions.add(basisFunction);//.div(Math.sqrt(basisFunction.mult(basisFunction).getAverage())));\n\n\t\t\tbasisFunction = basisFunction.discount(rate, periodLength2);\n\t\t\t//\t\t\tbasisFunctions.add(basisFunction);//.div(Math.sqrt(basisFunction.mult(basisFunction).getAverage())));\n\n\t\t\tbasisFunction = basisFunction.discount(rate, periodLength2);\n\t\t\t//\t\t\tbasisFunctions.add(basisFunction);//.div(Math.sqrt(basisFunction.mult(basisFunction).getAverage())));\n\t\t}\n\n\n\t\t// n Period\n\t\tbasisFunction = model.getRandomVariableForConstant(1.0);\n\t\tliborPeriodIndex = model.getLiborPeriodIndex(exerciseDate);\n\t\tif(liborPeriodIndex < 0) {\n\t\t\tliborPeriodIndex = -liborPeriodIndex-1;\n\t\t}\n\t\tliborPeriodIndexEnd = model.getNumberOfLibors();\n\t\tdouble periodLength3 = model.getLiborPeriod(liborPeriodIndexEnd) - model.getLiborPeriod(liborPeriodIndex);\n\n\t\tif(periodLength3 != periodLength1 && periodLength3 != periodLength2) {\n\t\t\trate = model.getLIBOR(exerciseDate, model.getLiborPeriod(liborPeriodIndex), model.getLiborPeriod(liborPeriodIndexEnd));\n\t\t\tbasisFunction = basisFunction.discount(rate, periodLength3);\n\t\t\tbasisFunctions.add(basisFunction);//.div(Math.sqrt(basisFunction.mult(basisFunction).getAverage())));\n\n\t\t\tbasisFunction = basisFunction.discount(rate, periodLength3);\n\t\t\t//\t\t\tbasisFunctions.add(basisFunction);//.div(Math.sqrt(basisFunction.mult(basisFunction).getAverage())));\n\t\t}\n\n\t\treturn basisFunctions.toArray(new RandomVariableInterface[0]);\n\t}", "protected static void validateSignature(final DataInput input) throws IOException {\n final byte[] signatureBytes = new byte[4];\n input.readFully(signatureBytes);\n if (!Arrays.equals(ManagementProtocol.SIGNATURE, signatureBytes)) {\n throw ProtocolLogger.ROOT_LOGGER.invalidSignature(Arrays.toString(signatureBytes));\n }\n }", "private void addListeners(ProjectReader reader)\n {\n if (m_projectListeners != null)\n {\n for (ProjectListener listener : m_projectListeners)\n {\n reader.addProjectListener(listener);\n }\n }\n }", "private void allClustersEqual(final List<String> clusterUrls) {\n Validate.notEmpty(clusterUrls, \"clusterUrls cannot be null\");\n // If only one clusterUrl return immediately\n if (clusterUrls.size() == 1)\n return;\n AdminClient adminClientLhs = adminClientPerCluster.get(clusterUrls.get(0));\n Cluster clusterLhs = adminClientLhs.getAdminClientCluster();\n for (int index = 1; index < clusterUrls.size(); index++) {\n AdminClient adminClientRhs = adminClientPerCluster.get(clusterUrls.get(index));\n Cluster clusterRhs = adminClientRhs.getAdminClientCluster();\n if (!areTwoClustersEqual(clusterLhs, clusterRhs))\n throw new VoldemortException(\"Cluster \" + clusterLhs.getName()\n + \" is not the same as \" + clusterRhs.getName());\n }\n }", "private void addDependencyToGraph(final DbDependency dependency, final AbstractGraph graph, final int depth, final String parentId) {\n // In that case of Axway artifact we will add a module to the graph\n if (filters.getCorporateFilter().filter(dependency)) {\n final DbModule dbTarget = repoHandler.getModuleOf(dependency.getTarget());\n\n // if there is no module, add the artifact to the graph\n if(dbTarget == null){\n LOG.error(\"Got missing reference: \" + dependency.getTarget());\n final DbArtifact dbArtifact = DataUtils.createDbArtifact(dependency.getTarget());\n final String targetElementId = graph.getId(dbArtifact);\n graph.addElement(targetElementId, dbArtifact.getVersion(), false);\n graph.addDependency(parentId, targetElementId, dependency.getScope());\n return;\n }\n\n // Add the element to the graph\n addModuleToGraph(dbTarget, graph, depth + 1);\n\n //Add the dependency to the graph\n final String moduleElementId = graph.getId(dbTarget);\n graph.addDependency(parentId, moduleElementId, dependency.getScope());\n }\n // In case a third-party we will add an artifact\n else {\n final DbArtifact dbTarget = repoHandler.getArtifact(dependency.getTarget());\n if(dbTarget == null){\n LOG.error(\"Got missing artifact: \" + dependency.getTarget());\n return;\n }\n\n if(!graph.isTreated(graph.getId(dbTarget))){\n final ModelMapper modelMapper = new ModelMapper(repoHandler);\n final Artifact target = modelMapper.getArtifact(dbTarget);\n final String targetElementId = graph.getId(target);\n graph.addElement(targetElementId, target.getVersion(), false);\n graph.addDependency(parentId, targetElementId, dependency.getScope());\n }\n }\n }", "public static base_response update(nitro_service client, Interface resource) throws Exception {\n\t\tInterface updateresource = new Interface();\n\t\tupdateresource.id = resource.id;\n\t\tupdateresource.speed = resource.speed;\n\t\tupdateresource.duplex = resource.duplex;\n\t\tupdateresource.flowctl = resource.flowctl;\n\t\tupdateresource.autoneg = resource.autoneg;\n\t\tupdateresource.hamonitor = resource.hamonitor;\n\t\tupdateresource.tagall = resource.tagall;\n\t\tupdateresource.trunk = resource.trunk;\n\t\tupdateresource.lacpmode = resource.lacpmode;\n\t\tupdateresource.lacpkey = resource.lacpkey;\n\t\tupdateresource.lagtype = resource.lagtype;\n\t\tupdateresource.lacppriority = resource.lacppriority;\n\t\tupdateresource.lacptimeout = resource.lacptimeout;\n\t\tupdateresource.ifalias = resource.ifalias;\n\t\tupdateresource.throughput = resource.throughput;\n\t\tupdateresource.bandwidthhigh = resource.bandwidthhigh;\n\t\tupdateresource.bandwidthnormal = resource.bandwidthnormal;\n\t\treturn updateresource.update_resource(client);\n\t}", "public static appqoepolicy[] get(nitro_service service) throws Exception{\n\t\tappqoepolicy obj = new appqoepolicy();\n\t\tappqoepolicy[] response = (appqoepolicy[])obj.get_resources(service);\n\t\treturn response;\n\t}", "@ArgumentsChecked\n\t@Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class })\n\tpublic static void isNumber(final boolean condition, @Nonnull final String value) {\n\t\tif (condition) {\n\t\t\tCheck.isNumber(value);\n\t\t}\n\t}", "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 }" ]
This method allows a subsection of a byte array to be copied. @param data source data @param offset offset into the source data @param size length of the source data to copy @return new byte array containing copied data
[ "public static final byte[] cloneSubArray(byte[] data, int offset, int size)\n {\n byte[] newData = new byte[size];\n System.arraycopy(data, offset, newData, 0, size);\n return (newData);\n }" ]
[ "private void addFoldersToSearchIn(final List<String> folders) {\n\n if (null == folders) {\n return;\n }\n\n for (String folder : folders) {\n if (!CmsResource.isFolder(folder)) {\n folder += \"/\";\n }\n\n m_foldersToSearchIn.add(folder);\n }\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 }", "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 final int toChars(int[] src, int srcOff, int srcLen, char[] dest, int destOff) {\n if (srcLen < 0) {\n throw new IllegalArgumentException(\"srcLen must be >= 0\");\n }\n int written = 0;\n for (int i = 0; i < srcLen; ++i) {\n written += Character.toChars(src[srcOff + i], dest, destOff + written);\n }\n return written;\n }", "public static base_responses flush(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 flushresources[] = new cacheobject[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tflushresources[i] = new cacheobject();\n\t\t\t\tflushresources[i].locator = resources[i].locator;\n\t\t\t\tflushresources[i].url = resources[i].url;\n\t\t\t\tflushresources[i].host = resources[i].host;\n\t\t\t\tflushresources[i].port = resources[i].port;\n\t\t\t\tflushresources[i].groupname = resources[i].groupname;\n\t\t\t\tflushresources[i].httpmethod = resources[i].httpmethod;\n\t\t\t\tflushresources[i].force = resources[i].force;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, flushresources,\"flush\");\n\t\t}\n\t\treturn result;\n\t}", "public static base_response kill(nitro_service client, systemsession resource) throws Exception {\n\t\tsystemsession killresource = new systemsession();\n\t\tkillresource.sid = resource.sid;\n\t\tkillresource.all = resource.all;\n\t\treturn killresource.perform_operation(client,\"kill\");\n\t}", "void writeNoValueRestriction(RdfWriter rdfWriter, String propertyUri,\n\t\t\tString rangeUri, String subject) throws RDFHandlerException {\n\n\t\tResource bnodeSome = rdfWriter.getFreshBNode();\n\t\trdfWriter.writeTripleValueObject(subject, RdfWriter.RDF_TYPE,\n\t\t\t\tRdfWriter.OWL_CLASS);\n\t\trdfWriter.writeTripleValueObject(subject, RdfWriter.OWL_COMPLEMENT_OF,\n\t\t\t\tbnodeSome);\n\t\trdfWriter.writeTripleValueObject(bnodeSome, RdfWriter.RDF_TYPE,\n\t\t\t\tRdfWriter.OWL_RESTRICTION);\n\t\trdfWriter.writeTripleUriObject(bnodeSome, RdfWriter.OWL_ON_PROPERTY,\n\t\t\t\tpropertyUri);\n\t\trdfWriter.writeTripleUriObject(bnodeSome,\n\t\t\t\tRdfWriter.OWL_SOME_VALUES_FROM, rangeUri);\n\t}", "private D createAndRegisterDeclaration(Map<String, Object> metadata) {\n D declaration;\n if (klass.equals(ImportDeclaration.class)) {\n declaration = (D) ImportDeclarationBuilder.fromMetadata(metadata).build();\n } else if (klass.equals(ExportDeclaration.class)) {\n declaration = (D) ExportDeclarationBuilder.fromMetadata(metadata).build();\n } else {\n throw new IllegalStateException(\"\");\n }\n declarationRegistrationManager.registerDeclaration(declaration);\n return declaration;\n }", "@Deprecated\n public String get(String path) {\n final JsonValue value = this.values.get(this.pathToProperty(path));\n if (value == null) {\n return null;\n }\n if (!value.isString()) {\n return value.toString();\n }\n return value.asString();\n }" ]
Read the project data and return a ProjectFile instance. @return ProjectFile instance
[ "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 void set( T a ) {\n if( a.getType() == getType() )\n mat.set(a.getMatrix());\n else {\n setMatrix(a.mat.copy());\n }\n }", "public static appfwprofile_denyurl_binding[] get(nitro_service service, String name) throws Exception{\n\t\tappfwprofile_denyurl_binding obj = new appfwprofile_denyurl_binding();\n\t\tobj.set_name(name);\n\t\tappfwprofile_denyurl_binding response[] = (appfwprofile_denyurl_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "public final int toChars(int[] src, int srcOff, int srcLen, char[] dest, int destOff) {\n if (srcLen < 0) {\n throw new IllegalArgumentException(\"srcLen must be >= 0\");\n }\n int written = 0;\n for (int i = 0; i < srcLen; ++i) {\n written += Character.toChars(src[srcOff + i], dest, destOff + written);\n }\n return written;\n }", "public static authenticationradiusaction get(nitro_service service, String name) throws Exception{\n\t\tauthenticationradiusaction obj = new authenticationradiusaction();\n\t\tobj.set_name(name);\n\t\tauthenticationradiusaction response = (authenticationradiusaction) obj.get_resource(service);\n\t\treturn response;\n\t}", "public InputStream getStream(String url, RasterLayer layer) throws IOException {\n\t\tif (layer instanceof ProxyLayerSupport) {\n\t\t\tProxyLayerSupport proxyLayer = (ProxyLayerSupport) layer;\n\t\t\tif (proxyLayer.isUseCache() && null != cacheManagerService) {\n\t\t\t\tObject cachedObject = cacheManagerService.get(proxyLayer, CacheCategory.RASTER, url);\n\t\t\t\tif (null != cachedObject) {\n\t\t\t\t\ttestRecorder.record(TEST_RECORDER_GROUP, TEST_RECORDER_GET_FROM_CACHE);\n\t\t\t\t\treturn new ByteArrayInputStream((byte[]) cachedObject);\n\t\t\t\t} else {\n\t\t\t\t\ttestRecorder.record(TEST_RECORDER_GROUP, TEST_RECORDER_PUT_IN_CACHE);\n\t\t\t\t\tInputStream stream = super.getStream(url, proxyLayer);\n\t\t\t\t\tByteArrayOutputStream os = new ByteArrayOutputStream();\n\t\t\t\t\tint b;\n\t\t\t\t\twhile ((b = stream.read()) >= 0) {\n\t\t\t\t\t\tos.write(b);\n\t\t\t\t\t}\n\t\t\t\t\tcacheManagerService.put(proxyLayer, CacheCategory.RASTER, url, os.toByteArray(),\n\t\t\t\t\t\t\tgetLayerEnvelope(proxyLayer));\n\t\t\t\t\treturn new ByteArrayInputStream((byte[]) os.toByteArray());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn super.getStream(url, layer);\n\t}", "public static BoxItem.Info getSharedItem(BoxAPIConnection api, String sharedLink, String password) {\n BoxAPIConnection newAPI = new SharedLinkAPIConnection(api, sharedLink, password);\n URL url = SHARED_ITEM_URL_TEMPLATE.build(newAPI.getBaseURL());\n BoxAPIRequest request = new BoxAPIRequest(newAPI, url, \"GET\");\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject json = JsonObject.readFrom(response.getJSON());\n return (BoxItem.Info) BoxResource.parseInfo(newAPI, json);\n }", "public void set(int i, double value) {\n switch (i) {\n case 0: {\n x = value;\n break;\n }\n case 1: {\n y = value;\n break;\n }\n case 2: {\n z = value;\n break;\n }\n default: {\n throw new ArrayIndexOutOfBoundsException(i);\n }\n }\n }", "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 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 }" ]
Set the face to be culled @param cullFace {@code GVRCullFaceEnum.Back} Tells Graphics API to discard back faces, {@code GVRCullFaceEnum.Front} Tells Graphics API to discard front faces, {@code GVRCullFaceEnum.None} Tells Graphics API to not discard any face @param passIndex The rendering pass to set cull face state
[ "public GVRRenderData setCullFace(GVRCullFaceEnum cullFace, int passIndex) {\n if (passIndex < mRenderPassList.size()) {\n mRenderPassList.get(passIndex).setCullFace(cullFace);\n } else {\n Log.e(TAG, \"Trying to set cull face to a invalid pass. Pass \" + passIndex + \" was not created.\");\n }\n return this;\n }" ]
[ "public List<TimephasedWork> getTimephasedBaselineWork(int index)\n {\n return m_timephasedBaselineWork[index] == null ? null : m_timephasedBaselineWork[index].getData();\n }", "@GwtIncompatible(\"Class.getDeclaredFields\")\n\tpublic ToStringBuilder addDeclaredFields() {\n\t\tField[] fields = instance.getClass().getDeclaredFields();\n\t\tfor(Field field : fields) {\n\t\t\taddField(field);\n\t\t}\n\t\treturn this;\n\t}", "public static long count(nitro_service service, String vservername) throws Exception{\n\t\tsslvserver_sslciphersuite_binding obj = new sslvserver_sslciphersuite_binding();\n\t\tobj.set_vservername(vservername);\n\t\toptions option = new options();\n\t\toption.set_count(true);\n\t\tsslvserver_sslciphersuite_binding response[] = (sslvserver_sslciphersuite_binding[]) obj.get_resources(service,option);\n\t\tif (response != null) {\n\t\t\treturn response[0].__count;\n\t\t}\n\t\treturn 0;\n\t}", "public <T extends CanvasWriter> T getWriter(Class<T> type, OauthToken oauthToken) {\n return getWriter(type, oauthToken, false);\n }", "public static boolean validate(Statement stmt) {\n try {\n Connection conn = stmt.getConnection();\n if (conn == null)\n return false;\n\n if (!conn.isClosed() && conn.isValid(10))\n return true;\n\n stmt.close();\n conn.close();\n } catch (SQLException e) {\n // this may well fail. that doesn't matter. we're just making an\n // attempt to clean up, and if we can't, that's just too bad.\n }\n return false;\n }", "void resetCurrentRevisionData() {\n\t\tthis.revisionId = NO_REVISION_ID; // impossible as an id in MediaWiki\n\t\tthis.parentRevisionId = NO_REVISION_ID;\n\t\tthis.text = null;\n\t\tthis.comment = null;\n\t\tthis.format = null;\n\t\tthis.timeStamp = null;\n\t\tthis.model = null;\n\t}", "@Override\n public void handleExceptions(MessageEvent messageEvent, Exception exception) {\n\n if(exception instanceof InvalidMetadataException) {\n logger.error(\"Exception when deleting. The requested key does not exist in this partition\",\n exception);\n writeErrorResponse(messageEvent,\n HttpResponseStatus.REQUESTED_RANGE_NOT_SATISFIABLE,\n \"The requested key does not exist in this partition\");\n } else if(exception instanceof PersistenceFailureException) {\n logger.error(\"Exception when deleting. Operation failed\", exception);\n writeErrorResponse(messageEvent,\n HttpResponseStatus.INTERNAL_SERVER_ERROR,\n \"Operation failed\");\n } else if(exception instanceof UnsupportedOperationException) {\n logger.error(\"Exception when deleting. Operation not supported in read-only store \",\n exception);\n writeErrorResponse(messageEvent,\n HttpResponseStatus.METHOD_NOT_ALLOWED,\n \"Operation not supported in read-only store\");\n } else if(exception instanceof StoreTimeoutException) {\n String errorDescription = \"DELETE Request timed out: \" + exception.getMessage();\n logger.error(errorDescription);\n writeErrorResponse(messageEvent, HttpResponseStatus.REQUEST_TIMEOUT, errorDescription);\n } else if(exception instanceof InsufficientOperationalNodesException) {\n String errorDescription = \"DELETE Request failed: \" + exception.getMessage();\n logger.error(errorDescription);\n writeErrorResponse(messageEvent,\n HttpResponseStatus.INTERNAL_SERVER_ERROR,\n errorDescription);\n } else {\n super.handleExceptions(messageEvent, exception);\n }\n }", "public List<Long> getOffsets(OffsetRequest offsetRequest) {\n ILog log = getLog(offsetRequest.topic, offsetRequest.partition);\n if (log != null) {\n return log.getOffsetsBefore(offsetRequest);\n }\n return ILog.EMPTY_OFFSETS;\n }", "private void writeCostRateTables(Project.Resources.Resource xml, Resource mpx)\n {\n //Rates rates = m_factory.createProjectResourcesResourceRates();\n //xml.setRates(rates);\n //List<Project.Resources.Resource.Rates.Rate> ratesList = rates.getRate();\n\n List<Project.Resources.Resource.Rates.Rate> ratesList = null;\n\n for (int tableIndex = 0; tableIndex < 5; tableIndex++)\n {\n CostRateTable table = mpx.getCostRateTable(tableIndex);\n if (table != null)\n {\n Date from = DateHelper.FIRST_DATE;\n for (CostRateTableEntry entry : table)\n {\n if (costRateTableWriteRequired(entry, from))\n {\n if (ratesList == null)\n {\n Rates rates = m_factory.createProjectResourcesResourceRates();\n xml.setRates(rates);\n ratesList = rates.getRate();\n }\n\n Project.Resources.Resource.Rates.Rate rate = m_factory.createProjectResourcesResourceRatesRate();\n ratesList.add(rate);\n\n rate.setCostPerUse(DatatypeConverter.printCurrency(entry.getCostPerUse()));\n rate.setOvertimeRate(DatatypeConverter.printRate(entry.getOvertimeRate()));\n rate.setOvertimeRateFormat(DatatypeConverter.printTimeUnit(entry.getOvertimeRateFormat()));\n rate.setRatesFrom(from);\n from = entry.getEndDate();\n rate.setRatesTo(from);\n rate.setRateTable(BigInteger.valueOf(tableIndex));\n rate.setStandardRate(DatatypeConverter.printRate(entry.getStandardRate()));\n rate.setStandardRateFormat(DatatypeConverter.printTimeUnit(entry.getStandardRateFormat()));\n }\n }\n }\n }\n }" ]
Extract task data.
[ "private void processTasks() throws IOException\n {\n TaskReader reader = new TaskReader(m_data.getTableData(\"Tasks\"));\n reader.read();\n for (MapRow row : reader.getRows())\n {\n processTask(m_project, row);\n }\n updateDates();\n }" ]
[ "public void animate(float animationTime, Matrix4f mat)\n {\n mRotInterpolator.animate(animationTime, mRotKey);\n mPosInterpolator.animate(animationTime, mPosKey);\n mSclInterpolator.animate(animationTime, mScaleKey);\n mat.translationRotateScale(mPosKey[0], mPosKey[1], mPosKey[2], mRotKey[0], mRotKey[1], mRotKey[2], mRotKey[3], mScaleKey[0], mScaleKey[1], mScaleKey[2]);\n\n }", "final void begin() {\n if (this.properties.isDateRollEnforced()) {\n final Thread thread = new Thread(this,\n \"Log4J Time-based File-roll Enforcer\");\n thread.setDaemon(true);\n thread.start();\n this.threadRef = thread;\n }\n }", "public void logAttributeWarning(PathAddress address, Set<String> attributes) {\n logAttributeWarning(address, null, null, attributes);\n }", "private void configureCustomFields()\n {\n CustomFieldContainer customFields = m_projectFile.getCustomFields();\n\n // If the caller hasn't already supplied a value for this field\n if (m_activityIDField == null)\n {\n m_activityIDField = (TaskField) customFields.getFieldByAlias(FieldTypeClass.TASK, \"Code\");\n if (m_activityIDField == null)\n {\n m_activityIDField = TaskField.WBS;\n }\n }\n\n // If the caller hasn't already supplied a value for this field\n if (m_activityTypeField == null)\n {\n m_activityTypeField = (TaskField) customFields.getFieldByAlias(FieldTypeClass.TASK, \"Activity Type\");\n }\n }", "public static Number parseDouble(String value) throws ParseException\n {\n\n Number result = null;\n value = parseString(value);\n\n // If we still have a value\n if (value != null && !value.isEmpty() && !value.equals(\"-1 -1\"))\n {\n int index = value.indexOf(\"E+\");\n if (index != -1)\n {\n value = value.substring(0, index) + 'E' + value.substring(index + 2, value.length());\n }\n\n if (value.indexOf('E') != -1)\n {\n result = DOUBLE_FORMAT.get().parse(value);\n }\n else\n {\n result = Double.valueOf(value);\n }\n }\n\n return result;\n }", "public static String defaultString(final String str, final String fallback) {\n return isNullOrEmpty(str) ? fallback : str;\n }", "private Object getLiteralValue(Expression expression) {\n\t\tif (!(expression instanceof Literal)) {\n\t\t\tthrow new IllegalArgumentException(\"Expression \" + expression + \" is not a Literal.\");\n\t\t}\n\t\treturn ((Literal) expression).getValue();\n\t}", "@SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n public List<HazeltaskTask<G>> shutdownNow() {\n\t return (List<HazeltaskTask<G>>) (List) localExecutorPool.shutdownNow();\n\t}", "private static String buildErrorMsg(List<String> dependencies, String message) {\n final StringBuilder buffer = new StringBuilder();\n boolean isFirstElement = true;\n for (String dependency : dependencies) {\n if (!isFirstElement) {\n buffer.append(\", \");\n }\n // check if it is an instance of Artifact - add the gavc else append the object\n buffer.append(dependency);\n\n isFirstElement = false;\n }\n return String.format(message, buffer.toString());\n }" ]
This method inserts a name value pair into internal storage. @param field task field @param value attribute value
[ "private void set(FieldType field, boolean value)\n {\n set(field, (value ? Boolean.TRUE : Boolean.FALSE));\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 static base_responses add(nitro_service client, route6 resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\troute6 addresources[] = new route6[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new route6();\n\t\t\t\taddresources[i].network = resources[i].network;\n\t\t\t\taddresources[i].gateway = resources[i].gateway;\n\t\t\t\taddresources[i].vlan = resources[i].vlan;\n\t\t\t\taddresources[i].weight = resources[i].weight;\n\t\t\t\taddresources[i].distance = resources[i].distance;\n\t\t\t\taddresources[i].cost = resources[i].cost;\n\t\t\t\taddresources[i].advertise = resources[i].advertise;\n\t\t\t\taddresources[i].msr = resources[i].msr;\n\t\t\t\taddresources[i].monitor = resources[i].monitor;\n\t\t\t\taddresources[i].td = resources[i].td;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "public static base_response unset(nitro_service client, tmsessionparameter resource, String[] args) throws Exception{\n\t\ttmsessionparameter unsetresource = new tmsessionparameter();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "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 }", "public AsciiTable setPaddingRight(int paddingRight) {\r\n\t\tfor(AT_Row row : this.rows){\r\n\t\t\tif(row.getType()==TableRowType.CONTENT){\r\n\t\t\t\trow.setPaddingRight(paddingRight);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}", "@Override\n public void handleExceptions(MessageEvent messageEvent, Exception exception) {\n\n if(exception instanceof InvalidMetadataException) {\n logger.error(\"Exception when deleting. The requested key does not exist in this partition\",\n exception);\n writeErrorResponse(messageEvent,\n HttpResponseStatus.REQUESTED_RANGE_NOT_SATISFIABLE,\n \"The requested key does not exist in this partition\");\n } else if(exception instanceof PersistenceFailureException) {\n logger.error(\"Exception when deleting. Operation failed\", exception);\n writeErrorResponse(messageEvent,\n HttpResponseStatus.INTERNAL_SERVER_ERROR,\n \"Operation failed\");\n } else if(exception instanceof UnsupportedOperationException) {\n logger.error(\"Exception when deleting. Operation not supported in read-only store \",\n exception);\n writeErrorResponse(messageEvent,\n HttpResponseStatus.METHOD_NOT_ALLOWED,\n \"Operation not supported in read-only store\");\n } else if(exception instanceof StoreTimeoutException) {\n String errorDescription = \"DELETE Request timed out: \" + exception.getMessage();\n logger.error(errorDescription);\n writeErrorResponse(messageEvent, HttpResponseStatus.REQUEST_TIMEOUT, errorDescription);\n } else if(exception instanceof InsufficientOperationalNodesException) {\n String errorDescription = \"DELETE Request failed: \" + exception.getMessage();\n logger.error(errorDescription);\n writeErrorResponse(messageEvent,\n HttpResponseStatus.INTERNAL_SERVER_ERROR,\n errorDescription);\n } else {\n super.handleExceptions(messageEvent, exception);\n }\n }", "public static bridgegroup_vlan_binding[] get(nitro_service service, Long id) throws Exception{\n\t\tbridgegroup_vlan_binding obj = new bridgegroup_vlan_binding();\n\t\tobj.set_id(id);\n\t\tbridgegroup_vlan_binding response[] = (bridgegroup_vlan_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "@Deprecated\r\n public static URL buildUrl(String host, int port, String path, Map<String, String> parameters) throws MalformedURLException {\r\n return buildUrl(\"http\", port, path, parameters);\r\n }", "public static String generateQuery(final String key, final Object value) {\n\t\tfinal Map<String, Object> params = new HashMap<>();\n\t\tparams.put(key, value);\n\t\treturn generateQuery(params);\n\t}" ]
Sets a string-valued additional info entry on the user. @param username the name of the user @param infoName the additional info key @param value the additional info value @throws CmsException if something goes wrong
[ "public void setUserInfo(String username, String infoName, String value) throws CmsException {\n\n CmsUser user = m_cms.readUser(username);\n user.setAdditionalInfo(infoName, value);\n m_cms.writeUser(user);\n }" ]
[ "public byte[] serialize() throws PersistenceBrokerException\r\n {\r\n // Identity is serialized and written to an ObjectOutputStream\r\n // This ObjectOutputstream is compressed by a GZIPOutputStream\r\n // and finally written to a ByteArrayOutputStream.\r\n // the resulting byte[] is returned\r\n try\r\n {\r\n final ByteArrayOutputStream bao = new ByteArrayOutputStream();\r\n final GZIPOutputStream gos = new GZIPOutputStream(bao);\r\n final ObjectOutputStream oos = new ObjectOutputStream(gos);\r\n oos.writeObject(this);\r\n oos.close();\r\n gos.close();\r\n bao.close();\r\n return bao.toByteArray();\r\n }\r\n catch (Exception ignored)\r\n {\r\n throw new PersistenceBrokerException(ignored);\r\n }\r\n }", "public boolean getBooleanProperty(String name, boolean defaultValue)\r\n {\r\n return PropertyHelper.toBoolean(_properties.getProperty(name), defaultValue);\r\n }", "public static boolean isArray(Type type) {\n return (type instanceof GenericArrayType) || (type instanceof Class<?> && ((Class<?>) type).isArray());\n }", "public ParsedWord pollParsedWord() {\n if(hasNextWord()) {\n //set correct next char\n if(parsedLine.words().size() > (word+1))\n character = parsedLine.words().get(word+1).lineIndex();\n else\n character = -1;\n return parsedLine.words().get(word++);\n }\n else\n return new ParsedWord(null, -1);\n }", "public void setOjbQuery(org.apache.ojb.broker.query.Query ojbQuery)\r\n {\r\n this.ojbQuery = ojbQuery;\r\n }", "public static String createCustomExpressionInvocationText(CustomExpression customExpression, String customExpName, boolean usePreviousFieldValues) {\n String stringExpression;\n if (customExpression instanceof DJSimpleExpression) {\n DJSimpleExpression varexp = (DJSimpleExpression) customExpression;\n String symbol;\n switch (varexp.getType()) {\n case DJSimpleExpression.TYPE_FIELD:\n symbol = \"F\";\n break;\n case DJSimpleExpression.TYPE_VARIABLE:\n symbol = \"V\";\n break;\n case DJSimpleExpression.TYPE_PARAMATER:\n symbol = \"P\";\n break;\n default:\n throw new DJException(\"Invalid DJSimpleExpression, type must be FIELD, VARIABLE or PARAMETER\");\n }\n stringExpression = \"$\" + symbol + \"{\" + varexp.getVariableName() + \"}\";\n\n } else {\n String fieldsMap = \"((\" + DJDefaultScriptlet.class.getName() + \")$P{REPORT_SCRIPTLET}).getCurrentFields()\";\n if (usePreviousFieldValues) {\n fieldsMap = \"((\" + DJDefaultScriptlet.class.getName() + \")$P{REPORT_SCRIPTLET}).getPreviousFields()\";\n }\n\n String parametersMap = \"((\" + DJDefaultScriptlet.class.getName() + \")$P{REPORT_SCRIPTLET}).getCurrentParams()\";\n String variablesMap = \"((\" + DJDefaultScriptlet.class.getName() + \")$P{REPORT_SCRIPTLET}).getCurrentVariables()\";\n\n stringExpression = \"((\" + CustomExpression.class.getName() + \")$P{REPORT_PARAMETERS_MAP}.get(\\\"\" + customExpName + \"\\\")).\"\n + CustomExpression.EVAL_METHOD_NAME + \"( \" + fieldsMap + \", \" + variablesMap + \", \" + parametersMap + \" )\";\n }\n\n return stringExpression;\n }", "public List<BoxAPIResponse> execute(List<BoxAPIRequest> requests) {\n this.prepareRequest(requests);\n BoxJSONResponse batchResponse = (BoxJSONResponse) send();\n return this.parseResponse(batchResponse);\n }", "private TransactionManager getTransactionManager()\r\n {\r\n TransactionManager retval = null;\r\n try\r\n {\r\n if (log.isDebugEnabled()) log.debug(\"getTransactionManager called\");\r\n retval = TransactionManagerFactoryFactory.instance().getTransactionManager();\r\n }\r\n catch (TransactionManagerFactoryException e)\r\n {\r\n log.warn(\"Exception trying to obtain TransactionManager from Factory\", e);\r\n e.printStackTrace();\r\n }\r\n return retval;\r\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}" ]
Constructs the appropriate MenuDrawer based on the position.
[ "private static MenuDrawer createMenuDrawer(Activity activity, int dragMode, Position position, Type type) {\n MenuDrawer drawer;\n\n if (type == Type.STATIC) {\n drawer = new StaticDrawer(activity);\n\n } else if (type == Type.OVERLAY) {\n drawer = new OverlayDrawer(activity, dragMode);\n if (position == Position.LEFT || position == Position.START) {\n drawer.setupUpIndicator(activity);\n }\n\n } else {\n drawer = new SlidingDrawer(activity, dragMode);\n if (position == Position.LEFT || position == Position.START) {\n drawer.setupUpIndicator(activity);\n }\n }\n\n drawer.mDragMode = dragMode;\n drawer.setPosition(position);\n\n return drawer;\n }" ]
[ "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 static <K,V> Map<K,V> asImmutable(Map<? extends K, ? extends V> self) {\n return Collections.unmodifiableMap(self);\n }", "public double[] getRegressionCoefficients(RandomVariable value) {\n\t\tif(basisFunctions.length == 0) {\n\t\t\treturn new double[] { };\n\t\t}\n\t\telse if(basisFunctions.length == 1) {\n\t\t\t/*\n\t\t\t * Regression with one basis function is just a projection on that vector. <b,x>/<b,b>\n\t\t\t */\n\t\t\treturn new double[] { value.mult(basisFunctions[0]).getAverage() / basisFunctions[0].squared().getAverage() };\n\t\t}\n\t\telse if(basisFunctions.length == 2) {\n\t\t\t/*\n\t\t\t * Regression with two basis functions can be solved explicitly if determinant != 0 (otherwise we will fallback to SVD)\n\t\t\t */\n\t\t\tdouble a = basisFunctions[0].squared().getAverage();\n\t\t\tdouble b = basisFunctions[0].mult(basisFunctions[1]).average().squared().doubleValue();\n\t\t\tdouble c = b;\n\t\t\tdouble d = basisFunctions[1].squared().getAverage();\n\n\t\t\tdouble determinant = (a * d - b * c);\n\t\t\tif(determinant != 0) {\n\t\t\t\tdouble x = value.mult(basisFunctions[0]).getAverage();\n\t\t\t\tdouble y = value.mult(basisFunctions[1]).getAverage();\n\n\t\t\t\tdouble alpha0 = (d * x - b * y) / determinant;\n\t\t\t\tdouble alpha1 = (a * y - c * x) / determinant;\n\n\t\t\t\treturn new double[] { alpha0, alpha1 };\n\t\t\t}\n\t\t}\n\n\t\t/*\n\t\t * General case\n\t\t */\n\n\t\t// Build regression matrix\n\t\tdouble[][] BTB = new double[basisFunctions.length][basisFunctions.length];\n\t\tfor(int i=0; i<basisFunctions.length; i++) {\n\t\t\tfor(int j=0; j<=i; j++) {\n\t\t\t\tdouble covariance = basisFunctions[i].mult(basisFunctions[j]).getAverage();\n\t\t\t\tBTB[i][j] = covariance;\n\t\t\t\tBTB[j][i] = covariance;\n\t\t\t}\n\t\t}\n\n\t\tdouble[] BTX = new double[basisFunctions.length];\n\t\tfor(int i=0; i<basisFunctions.length; i++) {\n\t\t\tdouble covariance = basisFunctions[i].mult(value).getAverage();\n\t\t\tBTX[i] = covariance;\n\t\t}\n\n\t\treturn LinearAlgebra.solveLinearEquationLeastSquare(BTB, BTX);\n\t}", "static void addDeployOperationStep(final CompositeOperationBuilder builder, final DeploymentDescription deployment) {\n final String name = deployment.getName();\n\n final Set<String> serverGroups = deployment.getServerGroups();\n // If the server groups are empty this is a standalone deployment\n if (serverGroups.isEmpty()) {\n final ModelNode address = createAddress(DEPLOYMENT, name);\n builder.addStep(createOperation(DEPLOYMENT_DEPLOY_OPERATION, address));\n } else {\n for (String serverGroup : serverGroups) {\n final ModelNode address = createAddress(SERVER_GROUP, serverGroup, DEPLOYMENT, name);\n builder.addStep(createOperation(DEPLOYMENT_DEPLOY_OPERATION, address));\n }\n }\n }", "public void deleteObject(Object object)\r\n {\r\n PersistenceBroker broker = null;\r\n try\r\n {\r\n broker = getBroker();\r\n broker.delete(object);\r\n }\r\n finally\r\n {\r\n if (broker != null) broker.close();\r\n }\r\n }", "public void propagateIfCancelException(final Throwable t) {\n final RuntimeException cancelException = this.getPlatformOperationCanceledException(t);\n if ((cancelException != null)) {\n throw cancelException;\n }\n }", "@SuppressWarnings({\"WeakerAccess\"})\n protected void initDeviceID() {\n getDeviceCachedInfo(); // put this here to avoid running on main thread\n\n // generate a provisional while we do the rest async\n generateProvisionalGUID();\n // grab and cache the googleAdID in any event if available\n // if we already have a deviceID we won't user ad id as the guid\n cacheGoogleAdID();\n\n // if we already have a device ID use it and just notify\n // otherwise generate one, either from ad id if available or the provisional\n String deviceID = getDeviceID();\n if (deviceID == null || deviceID.trim().length() <= 2) {\n generateDeviceID();\n }\n\n }", "public static boolean any(Object self, Closure closure) {\n BooleanClosureWrapper bcw = new BooleanClosureWrapper(closure);\n for (Iterator iter = InvokerHelper.asIterator(self); iter.hasNext();) {\n if (bcw.call(iter.next())) return true;\n }\n return false;\n }", "public static appfwwsdl get(nitro_service service) throws Exception{\n\t\tappfwwsdl obj = new appfwwsdl();\n\t\tappfwwsdl[] response = (appfwwsdl[])obj.get_resources(service);\n\t\treturn response[0];\n\t}" ]
Converts an object to an object, with squiggly filters applied. @param mapper the object mapper @param source the source to convert @return target instance @see SquigglyUtils#objectify(ObjectMapper, Object, Class)
[ "public static Object objectify(ObjectMapper mapper, Object source) {\n return objectify(mapper, source, Object.class);\n }" ]
[ "protected static void error(\n final HttpServletResponse httpServletResponse, final String message, final HttpStatus code) {\n try {\n httpServletResponse.setContentType(\"text/plain\");\n httpServletResponse.setStatus(code.value());\n setNoCache(httpServletResponse);\n try (PrintWriter out = httpServletResponse.getWriter()) {\n out.println(\"Error while processing request:\");\n out.println(message);\n }\n\n LOGGER.error(\"Error while processing request: {}\", message);\n } catch (IOException ex) {\n throw ExceptionUtils.getRuntimeException(ex);\n }\n }", "public void declareInternalData(int maxRows, int maxCols) {\n this.maxRows = maxRows;\n this.maxCols = maxCols;\n\n U_tran = new DMatrixRMaj(maxRows,maxRows);\n Qm = new DMatrixRMaj(maxRows,maxRows);\n\n r_row = new double[ maxCols ];\n }", "public static List<ObjectModelResolver> getResolvers() {\n if (resolvers == null) {\n synchronized (serviceLoader) {\n if (resolvers == null) {\n List<ObjectModelResolver> foundResolvers = new ArrayList<ObjectModelResolver>();\n for (ObjectModelResolver resolver : serviceLoader) {\n foundResolvers.add(resolver);\n }\n resolvers = foundResolvers;\n }\n }\n }\n\n return resolvers;\n }", "void persist(final String key, final String value, final boolean enableDisableMode, final boolean disable, final File file, final String realm) throws IOException, StartException {\n final PropertiesFileLoader propertiesHandler = realm == null ? new PropertiesFileLoader(file.getAbsolutePath(), null) :\n new UserPropertiesFileLoader(file.getAbsolutePath(), null);\n try {\n propertiesHandler.start(null);\n if (realm != null) {\n ((UserPropertiesFileLoader) propertiesHandler).setRealmName(realm);\n }\n Properties prob = propertiesHandler.getProperties();\n if (value != null) {\n prob.setProperty(key, value);\n }\n if (enableDisableMode) {\n prob.setProperty(key + \"!disable\", String.valueOf(disable));\n }\n propertiesHandler.persistProperties();\n } finally {\n propertiesHandler.stop(null);\n }\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}", "public static Method findGetter(final Object object, final String fieldName) {\n\t\tif( object == null ) {\n\t\t\tthrow new NullPointerException(\"object should not be null\");\n\t\t} else if( fieldName == null ) {\n\t\t\tthrow new NullPointerException(\"fieldName should not be null\");\n\t\t}\n\t\t\n\t\tfinal Class<?> clazz = object.getClass();\n\t\t\n\t\t// find a standard getter\n\t\tfinal String standardGetterName = getMethodNameForField(GET_PREFIX, fieldName);\n\t\tMethod getter = findGetterWithCompatibleReturnType(standardGetterName, clazz, false);\n\t\t\n\t\t// if that fails, try for an isX() style boolean getter\n\t\tif( getter == null ) {\n\t\t\tfinal String booleanGetterName = getMethodNameForField(IS_PREFIX, fieldName);\n\t\t\tgetter = findGetterWithCompatibleReturnType(booleanGetterName, clazz, true);\n\t\t}\n\t\t\n\t\tif( getter == null ) {\n\t\t\tthrow new SuperCsvReflectionException(\n\t\t\t\tString\n\t\t\t\t\t.format(\n\t\t\t\t\t\t\"unable to find getter for field %s in class %s - check that the corresponding nameMapping element matches the field name in the bean\",\n\t\t\t\t\t\tfieldName, clazz.getName()));\n\t\t}\n\t\t\n\t\treturn getter;\n\t}", "public boolean shouldCompress(String requestUri) {\n\t\tString uri = requestUri.toLowerCase();\n\t\treturn checkSuffixes(uri, zipSuffixes);\n\t}", "public static String getPropertyUri(PropertyIdValue propertyIdValue,\n\t\t\tPropertyContext propertyContext) {\n\t\tswitch (propertyContext) {\n\t\tcase DIRECT:\n\t\t\treturn PREFIX_PROPERTY_DIRECT + propertyIdValue.getId();\n\t\tcase STATEMENT:\n\t\t\treturn PREFIX_PROPERTY + propertyIdValue.getId();\n\t\tcase VALUE_SIMPLE:\n\t\t\treturn PREFIX_PROPERTY_STATEMENT + propertyIdValue.getId();\n\t\tcase VALUE:\n\t\t\treturn PREFIX_PROPERTY_STATEMENT_VALUE + propertyIdValue.getId();\n\t\tcase QUALIFIER:\n\t\t\treturn PREFIX_PROPERTY_QUALIFIER_VALUE + propertyIdValue.getId();\n\t\tcase QUALIFIER_SIMPLE:\n\t\t\treturn PREFIX_PROPERTY_QUALIFIER + propertyIdValue.getId();\n\t\tcase REFERENCE:\n\t\t\treturn PREFIX_PROPERTY_REFERENCE_VALUE + propertyIdValue.getId();\n\t\tcase REFERENCE_SIMPLE:\n\t\t\treturn PREFIX_PROPERTY_REFERENCE + propertyIdValue.getId();\n\t\tcase NO_VALUE:\n\t\t\treturn PREFIX_WIKIDATA_NO_VALUE + propertyIdValue.getId();\n\t\tcase NO_QUALIFIER_VALUE:\n\t\t\treturn PREFIX_WIKIDATA_NO_QUALIFIER_VALUE + propertyIdValue.getId();\n\t\tdefault:\n\t\t\treturn null;\n\t\t}\n\t}", "private String readLine(boolean trim) throws IOException {\n boolean done = false;\n boolean sawCarriage = false;\n // bytes to trim (the \\r and the \\n)\n int removalBytes = 0;\n while (!done) {\n if (isReadBufferEmpty()) {\n offset = 0;\n end = 0;\n int bytesRead = inputStream.read(buffer, end, Math.min(DEFAULT_READ_COUNT, buffer.length - end));\n if (bytesRead < 0) {\n // we failed to read anything more...\n throw new IOException(\"Reached the end of the stream\");\n } else {\n end += bytesRead;\n }\n }\n\n int originalOffset = offset;\n for (; !done && offset < end; offset++) {\n if (buffer[offset] == LF) {\n int cpLength = offset - originalOffset + 1;\n if (trim) {\n int length = 0;\n if (buffer[offset] == LF) {\n length ++;\n if (sawCarriage) {\n length++;\n }\n }\n cpLength -= length;\n }\n\n if (cpLength > 0) {\n copyToStrBuffer(buffer, originalOffset, cpLength);\n } else {\n // negative length means we need to trim a \\r from strBuffer\n removalBytes = cpLength;\n }\n done = true;\n } else {\n // did not see newline:\n sawCarriage = buffer[offset] == CR;\n }\n }\n\n if (!done) {\n copyToStrBuffer(buffer, originalOffset, end - originalOffset);\n offset = end;\n }\n }\n int strLength = strBufferIndex + removalBytes;\n strBufferIndex = 0;\n return new String(strBuffer, 0, strLength, charset);\n }" ]
Returns the number of key-value mappings in this map for the second key. @param firstKey the first key @return Returns the number of key-value mappings in this map for the second key.
[ "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}" ]
[ "protected boolean isValidLayout(Gravity gravity, Orientation orientation) {\n boolean isValid = true;\n\n switch (gravity) {\n case TOP:\n case BOTTOM:\n isValid = (!isUnlimitedSize() && orientation == Orientation.VERTICAL);\n break;\n case LEFT:\n case RIGHT:\n isValid = (!isUnlimitedSize() && orientation == Orientation.HORIZONTAL);\n break;\n case FRONT:\n case BACK:\n isValid = (!isUnlimitedSize() && orientation == Orientation.STACK);\n break;\n case FILL:\n isValid = !isUnlimitedSize();\n break;\n case CENTER:\n break;\n default:\n isValid = false;\n break;\n }\n if (!isValid) {\n Log.w(TAG, \"Cannot set the gravity %s and orientation %s - \" +\n \"due to unlimited bounds or incompatibility\", gravity, orientation);\n }\n return isValid;\n }", "public static LocalDate getDateFromFloatingPointDate(LocalDate referenceDate, double floatingPointDate) {\n\t\tif(referenceDate == null) {\n\t\t\treturn null;\n\t\t}\n\t\treturn referenceDate.plusDays((int)Math.round(floatingPointDate*365.0));\n\t}", "@SuppressWarnings(\"unchecked\")\n public final FluentModelImplT withoutTag(String key) {\n if (this.inner().getTags() != null) {\n this.inner().getTags().remove(key);\n }\n return (FluentModelImplT) this;\n }", "public static String make512Safe(StringBuffer input, String newline) {\n\t\tStringBuilder result = new StringBuilder();\n\t\tString content = input.toString();\n\t\tString rest = content;\n\t\twhile (!rest.isEmpty()) {\n\t\t\tif (rest.contains(\"\\n\")) {\n\t\t\t\tString line = rest.substring(0, rest.indexOf(\"\\n\"));\n\t\t\t\trest = rest.substring(rest.indexOf(\"\\n\") + 1);\n\t\t\t\tif (line.length() > 1 && line.charAt(line.length() - 1) == '\\r')\n\t\t\t\t\tline = line.substring(0, line.length() - 1);\n\t\t\t\tappend512Safe(line, result, newline);\n\t\t\t} else {\n\t\t\t\tappend512Safe(rest, result, newline);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn result.toString();\n\t}", "public static auditnslogpolicy_systemglobal_binding[] get(nitro_service service, String name) throws Exception{\n\t\tauditnslogpolicy_systemglobal_binding obj = new auditnslogpolicy_systemglobal_binding();\n\t\tobj.set_name(name);\n\t\tauditnslogpolicy_systemglobal_binding response[] = (auditnslogpolicy_systemglobal_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "public static base_response Import(nitro_service client, appfwsignatures resource) throws Exception {\n\t\tappfwsignatures Importresource = new appfwsignatures();\n\t\tImportresource.src = resource.src;\n\t\tImportresource.name = resource.name;\n\t\tImportresource.xslt = resource.xslt;\n\t\tImportresource.comment = resource.comment;\n\t\tImportresource.overwrite = resource.overwrite;\n\t\tImportresource.merge = resource.merge;\n\t\tImportresource.sha1 = resource.sha1;\n\t\treturn Importresource.perform_operation(client,\"Import\");\n\t}", "public PeriodicEvent runEvery(Runnable task, float delay, float period,\n int repetitions) {\n if (repetitions < 1) {\n return null;\n } else if (repetitions == 1) {\n // Better to burn a handful of CPU cycles than to churn memory by\n // creating a new callback\n return runAfter(task, delay);\n } else {\n return runEvery(task, delay, period, new RunFor(repetitions));\n }\n }", "public static <T> IteratorFromReaderFactory<T> getFactory(String delim, Function<String,T> op) {\r\n return new DelimitRegExIteratorFactory<T>(delim, op);\r\n }", "public int size(final K1 firstKey, final K2 secondKey) {\n\t\t// existence check on inner map\n\t\tfinal HashMap<K2, HashMap<K3, V>> innerMap1 = map.get(firstKey);\n\t\tif( innerMap1 == null ) {\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t\t// existence check on inner map1\n\t\tfinal HashMap<K3, V> innerMap2 = innerMap1.get(secondKey);\n\t\tif( innerMap2 == null ) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn innerMap2.size();\n\t}" ]
Convenience method for retrieving a Map resource. @param locale locale identifier @param key resource key @return resource value
[ "@SuppressWarnings(\"rawtypes\") public static final Map getMap(Locale locale, String key)\n {\n ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale);\n return ((Map) bundle.getObject(key));\n }" ]
[ "public void addFile(String description, FileModel fileModel)\n {\n Map<FileModel, ProblemFileSummary> files = addDescription(description);\n\n if (files.containsKey(fileModel))\n {\n files.get(fileModel).addOccurrence();\n } else {\n files.put(fileModel, new ProblemFileSummary(fileModel, 1));\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 <E> Collection<E> sampleWithoutReplacement(Collection<E> c, int n) {\r\n return sampleWithoutReplacement(c, n, new Random());\r\n }", "public static void openLogFile() throws IOException\n {\n if (LOG_FILE != null)\n {\n System.out.println(\"SynchroLogger Configured\");\n LOG = new PrintWriter(new FileWriter(LOG_FILE));\n }\n }", "public static double distance(double lat1, double lon1,\n double lat2, double lon2) {\n double dLat = Math.toRadians(lat2-lat1);\n double dLon = Math.toRadians(lon2-lon1);\n lat1 = Math.toRadians(lat1);\n lat2 = Math.toRadians(lat2);\n\n double a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); \n double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n return R * c;\n }", "public void close() {\n Closer.closeQuietly(acceptor);\n for (Processor processor : processors) {\n Closer.closeQuietly(processor);\n }\n }", "@Override\n\tpublic void processItemDocument(ItemDocument itemDocument) {\n\t\tthis.countItems++;\n\n\t\t// Do some printing for demonstration/debugging.\n\t\t// Only print at most 50 items (or it would get too slow).\n\t\tif (this.countItems < 10) {\n\t\t\tSystem.out.println(itemDocument);\n\t\t} else if (this.countItems == 10) {\n\t\t\tSystem.out.println(\"*** I won't print any further items.\\n\"\n\t\t\t\t\t+ \"*** We will never finish if we print all the items.\\n\"\n\t\t\t\t\t+ \"*** Maybe remove this debug output altogether.\");\n\t\t}\n\t}", "final void begin() {\n if (this.properties.isDateRollEnforced()) {\n final Thread thread = new Thread(this,\n \"Log4J Time-based File-roll Enforcer\");\n thread.setDaemon(true);\n thread.start();\n this.threadRef = thread;\n }\n }", "private void deliverFoundAnnouncement(final DeviceAnnouncement announcement) {\n for (final DeviceAnnouncementListener listener : getDeviceAnnouncementListeners()) {\n SwingUtilities.invokeLater(new Runnable() {\n @Override\n public void run() {\n try {\n listener.deviceFound(announcement);\n } catch (Throwable t) {\n logger.warn(\"Problem delivering device found announcement to listener\", t);\n }\n }\n });\n }\n }" ]
Sets the quaternion of the keyframe.
[ "public void setValue(Quaternionf rot) {\n mX = rot.x;\n mY = rot.y;\n mZ = rot.z;\n mW = rot.w;\n }" ]
[ "public static Variable deserialize(String s,\n VariableType variableType) {\n return deserialize(s,\n variableType,\n null);\n }", "public Client getClient(int clientId) throws Exception {\n Client client = null;\n\n PreparedStatement statement = null;\n ResultSet results = null;\n try (Connection sqlConnection = sqlService.getConnection()) {\n String queryString = \"SELECT * FROM \" + Constants.DB_TABLE_CLIENT +\n \" WHERE \" + Constants.GENERIC_ID + \" = ?\";\n\n statement = sqlConnection.prepareStatement(queryString);\n statement.setInt(1, clientId);\n\n results = statement.executeQuery();\n if (results.next()) {\n client = this.getClientFromResultSet(results);\n }\n } catch (Exception e) {\n throw e;\n } finally {\n try {\n if (results != null) {\n results.close();\n }\n } catch (Exception e) {\n }\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n\n return client;\n }", "public void setMatrix(int[] matrix) {\n\t\tthis.matrix = matrix;\n\t\tsum = 0;\n\t\tfor (int i = 0; i < matrix.length; i++)\n\t\t\tsum += matrix[i];\n\t}", "public static boolean isInSubDirectory(File dir, File file)\n {\n if (file == null)\n return false;\n\n if (file.equals(dir))\n return true;\n\n return isInSubDirectory(dir, file.getParentFile());\n }", "public static Iterable<BoxUser.Info> getAppUsersByExternalAppUserID(final BoxAPIConnection api,\n final String externalAppUserId, final String... fields) {\n return getUsersInfoForType(api, null, null, externalAppUserId, fields);\n }", "public Integer getIdFromName(String profileName) {\n PreparedStatement query = null;\n ResultSet results = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n query = sqlConnection.prepareStatement(\"SELECT * FROM \" + Constants.DB_TABLE_PROFILE +\n \" WHERE \" + Constants.PROFILE_PROFILE_NAME + \" = ?\");\n query.setString(1, profileName);\n results = query.executeQuery();\n if (results.next()) {\n Object toReturn = results.getObject(Constants.GENERIC_ID);\n query.close();\n return (Integer) toReturn;\n }\n query.close();\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 (query != null) {\n query.close();\n }\n } catch (Exception e) {\n }\n }\n return null;\n }", "private void readRecurringData(ProjectCalendarException bce, Project.Calendars.Calendar.Exceptions.Exception exception)\n {\n RecurrenceType rt = getRecurrenceType(NumberHelper.getInt(exception.getType()));\n if (rt != null)\n {\n RecurringData rd = new RecurringData();\n rd.setStartDate(bce.getFromDate());\n rd.setFinishDate(bce.getToDate());\n rd.setRecurrenceType(rt);\n rd.setRelative(getRelative(NumberHelper.getInt(exception.getType())));\n rd.setOccurrences(NumberHelper.getInteger(exception.getOccurrences()));\n\n switch (rd.getRecurrenceType())\n {\n case DAILY:\n {\n rd.setFrequency(getFrequency(exception));\n break;\n }\n\n case WEEKLY:\n {\n rd.setWeeklyDaysFromBitmap(NumberHelper.getInteger(exception.getDaysOfWeek()), DAY_MASKS);\n rd.setFrequency(getFrequency(exception));\n break;\n }\n\n case MONTHLY:\n {\n if (rd.getRelative())\n {\n rd.setDayOfWeek(Day.getInstance(NumberHelper.getInt(exception.getMonthItem()) - 2));\n rd.setDayNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonthPosition()) + 1));\n }\n else\n {\n rd.setDayNumber(NumberHelper.getInteger(exception.getMonthDay()));\n }\n rd.setFrequency(getFrequency(exception));\n break;\n }\n\n case YEARLY:\n {\n if (rd.getRelative())\n {\n rd.setDayOfWeek(Day.getInstance(NumberHelper.getInt(exception.getMonthItem()) - 2));\n rd.setDayNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonthPosition()) + 1));\n }\n else\n {\n rd.setDayNumber(NumberHelper.getInteger(exception.getMonthDay()));\n }\n rd.setMonthNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonth()) + 1));\n break;\n }\n }\n\n if (rd.getRecurrenceType() != RecurrenceType.DAILY || rd.getDates().length > 1)\n {\n bce.setRecurring(rd);\n }\n }\n }", "public double Function2D(double x, double y) {\n return Math.exp(-(x * x + y * y) / (2 * sqrSigma)) / (2 * Math.PI * sqrSigma);\n }", "public static appfwpolicylabel_binding get(nitro_service service, String labelname) throws Exception{\n\t\tappfwpolicylabel_binding obj = new appfwpolicylabel_binding();\n\t\tobj.set_labelname(labelname);\n\t\tappfwpolicylabel_binding response = (appfwpolicylabel_binding) obj.get_resource(service);\n\t\treturn response;\n\t}" ]
Gets the current instance of plugin manager @return PluginManager
[ "public static PluginManager getInstance() {\n if (_instance == null) {\n _instance = new PluginManager();\n _instance.classInformation = new HashMap<String, ClassInformation>();\n _instance.methodInformation = new HashMap<String, com.groupon.odo.proxylib.models.Method>();\n _instance.jarInformation = new ArrayList<String>();\n\n if (_instance.proxyLibPath == null) {\n //Get the System Classloader\n ClassLoader sysClassLoader = Thread.currentThread().getContextClassLoader();\n\n //Get the URLs\n URL[] urls = ((URLClassLoader) sysClassLoader).getURLs();\n\n for (int i = 0; i < urls.length; i++) {\n if (urls[i].getFile().contains(\"proxylib\")) {\n // store the path to the proxylib\n _instance.proxyLibPath = urls[i].getFile();\n break;\n }\n }\n }\n _instance.initializePlugins();\n }\n return _instance;\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 List<TimephasedWork> getCompleteWork(ProjectCalendar calendar, ResourceAssignment resourceAssignment, byte[] data)\n {\n LinkedList<TimephasedWork> list = new LinkedList<TimephasedWork>();\n\n if (calendar != null && data != null && data.length > 2 && MPPUtility.getShort(data, 0) > 0)\n {\n Date startDate = resourceAssignment.getStart();\n double finishTime = MPPUtility.getInt(data, 24);\n\n int blockCount = MPPUtility.getShort(data, 0);\n double previousCumulativeWork = 0;\n TimephasedWork previousAssignment = null;\n\n int index = 32;\n int currentBlock = 0;\n while (currentBlock < blockCount && index + 20 <= data.length)\n {\n double time = MPPUtility.getInt(data, index + 0);\n\n // If the start of this block is before the start of the assignment, or after the end of the assignment\n // the values don't make sense, so we'll just set the start of this block to be the start of the assignment.\n // This deals with an issue where odd timephased data like this was causing an MPP file to be read\n // extremely slowly.\n if (time < 0 || time > finishTime)\n {\n time = 0;\n }\n else\n {\n time /= 80;\n }\n Duration startWork = Duration.getInstance(time, TimeUnit.MINUTES);\n\n double currentCumulativeWork = (long) MPPUtility.getDouble(data, index + 4);\n double assignmentDuration = currentCumulativeWork - previousCumulativeWork;\n previousCumulativeWork = currentCumulativeWork;\n assignmentDuration /= 1000;\n Duration totalWork = Duration.getInstance(assignmentDuration, TimeUnit.MINUTES);\n time = (long) MPPUtility.getDouble(data, index + 12);\n time /= 125;\n time *= 6;\n Duration workPerDay = Duration.getInstance(time, TimeUnit.MINUTES);\n\n Date start;\n if (startWork.getDuration() == 0)\n {\n start = startDate;\n }\n else\n {\n start = calendar.getDate(startDate, startWork, true);\n }\n\n TimephasedWork assignment = new TimephasedWork();\n assignment.setStart(start);\n assignment.setAmountPerDay(workPerDay);\n assignment.setTotalAmount(totalWork);\n\n if (previousAssignment != null)\n {\n Date finish = calendar.getDate(startDate, startWork, false);\n previousAssignment.setFinish(finish);\n if (previousAssignment.getStart().getTime() == previousAssignment.getFinish().getTime())\n {\n list.removeLast();\n }\n }\n\n list.add(assignment);\n previousAssignment = assignment;\n\n index += 20;\n ++currentBlock;\n }\n\n if (previousAssignment != null)\n {\n Duration finishWork = Duration.getInstance(finishTime / 80, TimeUnit.MINUTES);\n Date finish = calendar.getDate(startDate, finishWork, false);\n previousAssignment.setFinish(finish);\n if (previousAssignment.getStart().getTime() == previousAssignment.getFinish().getTime())\n {\n list.removeLast();\n }\n }\n }\n\n return list;\n }", "public void clear() {\n\t\tfor (Bean bean : beans.values()) {\n\t\t\tif (null != bean.destructionCallback) {\n\t\t\t\tbean.destructionCallback.run();\n\t\t\t}\n\t\t}\n\t\tbeans.clear();\n\t}", "public AsciiTable setTargetTranslator(TargetTranslator targetTranslator) {\r\n\t\tfor(AT_Row row : this.rows){\r\n\t\t\tif(row.getType()==TableRowType.CONTENT){\r\n\t\t\t\trow.setTargetTranslator(targetTranslator);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}", "private ArrayList<String> getRemoveHeaders() throws Exception {\n ArrayList<String> headersToRemove = new ArrayList<String>();\n\n for (EndpointOverride selectedPath : requestInformation.get().selectedResponsePaths) {\n // check to see if there is custom override data or if we have headers to remove\n List<EnabledEndpoint> points = selectedPath.getEnabledEndpoints();\n for (EnabledEndpoint endpoint : points) {\n // skip if repeat count is 0\n if (endpoint.getRepeatNumber() == 0) {\n continue;\n }\n\n if (endpoint.getOverrideId() == Constants.PLUGIN_RESPONSE_HEADER_OVERRIDE_REMOVE) {\n // add to remove headers array\n headersToRemove.add(endpoint.getArguments()[0].toString());\n endpoint.decrementRepeatNumber();\n }\n }\n }\n\n return headersToRemove;\n }", "void saveAction() {\n\n Map<Object, Object> filters = getFilters();\n m_table.clearFilters();\n\n try {\n\n m_model.save();\n disableSaveButtons();\n\n } catch (CmsException e) {\n LOG.error(m_messages.key(Messages.ERR_SAVING_CHANGES_0), e);\n CmsErrorDialog.showErrorDialog(m_messages.key(Messages.ERR_SAVING_CHANGES_0), e);\n }\n\n setFilters(filters);\n\n }", "void throwCloudExceptionIfInFailedState() {\n if (this.isStatusFailed()) {\n if (this.errorBody() != null) {\n throw new CloudException(\"Async operation failed with provisioning state: \" + this.status(), this.response(), this.errorBody());\n } else {\n throw new CloudException(\"Async operation failed with provisioning state: \" + this.status(), this.response());\n }\n }\n }", "public void checkin(AdminClient client) {\n if (isClosed.get()) {\n throw new IllegalStateException(\"Pool is closing\");\n }\n\n if (client == null) {\n throw new IllegalArgumentException(\"client is null\");\n }\n\n boolean isCheckedIn = clientCache.offer(client);\n\n if (!isCheckedIn) {\n // Cache is already full, close this AdminClient\n client.close();\n }\n }", "public void remove(RowKey key) {\n\t\tcurrentState.put( key, new AssociationOperation( key, null, REMOVE ) );\n\t}" ]
So we will follow rfc 1035 and in addition allow the underscore.
[ "static ParsedHost validateHostImpl(HostName fromHost) throws HostNameException {\n\t\tfinal String str = fromHost.toString();\n\t\tHostNameParameters validationOptions = fromHost.getValidationOptions();\n\t\treturn validateHost(fromHost, str, validationOptions);\n\t}" ]
[ "private double getConstraint(double x1, double x2)\n {\n double c1,c2,h;\n c1 = -x1*x1-x2*x2+1+0.1*Math.cos(16*Math.atan(x1/x2));\n c2 = (x1-0.5)*(x1-0.5)+(x2-0.5)*(x2-0.5)-0.5;\n if(c1>c2)\n h = (c1>0)?c1:0;\n else\n h = (c2>0)?c2:0;\n return h;\n }", "private void loadLocalizationFromXmlBundle(Locale locale) {\n\n CmsXmlContentValueSequence messages = m_xmlBundle.getValueSequence(\"Message\", locale);\n SortedProperties props = new SortedProperties();\n if (null != messages) {\n for (I_CmsXmlContentValue msg : messages.getValues()) {\n String msgpath = msg.getPath();\n props.put(\n m_xmlBundle.getStringValue(m_cms, msgpath + \"/Key\", locale),\n m_xmlBundle.getStringValue(m_cms, msgpath + \"/Value\", locale));\n }\n }\n m_localizations.put(locale, props);\n }", "@PostConstruct\n\tprotected void postConstruct() {\n\t\tif (pixelPerUnitBased) {\n\t\t\t//\tCalculate numerator and denominator\n\t\t\tif (pixelPerUnit > PIXEL_PER_METER) {\n\t\t\t\tthis.numerator = pixelPerUnit / conversionFactor;\n\t\t\t\tthis.denominator = 1;\n\t\t\t} else {\n\t\t\t\tthis.numerator = 1;\n\t\t\t\tthis.denominator = PIXEL_PER_METER / pixelPerUnit;\n\t\t\t}\n\t\t\tsetPixelPerUnitBased(false);\n\t\t} else {\n\t\t\t// Calculate PPU\n\t\t\tthis.pixelPerUnit = numerator / denominator * conversionFactor;\n\t\t\tsetPixelPerUnitBased(true);\n\t\t}\n\t}", "public Photo getListPhoto(String photoId) throws FlickrException {\n\n Map<String, Object> parameters = new HashMap<String, Object>();\n parameters.put(\"method\", METHOD_GET_LIST_PHOTO);\n\n parameters.put(\"photo_id\", photoId);\n\n Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);\n if (response.isError()) {\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\n }\n\n Element photoElement = response.getPayload();\n Photo photo = new Photo();\n photo.setId(photoElement.getAttribute(\"id\"));\n\n List<Tag> tags = new ArrayList<Tag>();\n Element tagsElement = (Element) photoElement.getElementsByTagName(\"tags\").item(0);\n NodeList tagElements = tagsElement.getElementsByTagName(\"tag\");\n for (int i = 0; i < tagElements.getLength(); i++) {\n Element tagElement = (Element) tagElements.item(i);\n Tag tag = new Tag();\n tag.setId(tagElement.getAttribute(\"id\"));\n tag.setAuthor(tagElement.getAttribute(\"author\"));\n tag.setAuthorName(tagElement.getAttribute(\"authorname\"));\n tag.setRaw(tagElement.getAttribute(\"raw\"));\n tag.setValue(((Text) tagElement.getFirstChild()).getData());\n tags.add(tag);\n }\n photo.setTags(tags);\n return photo;\n }", "public static Map<String, IDiagramPlugin>\n getLocalPluginsRegistry(ServletContext context) {\n if (LOCAL == null) {\n LOCAL = initializeLocalPlugins(context);\n }\n return LOCAL;\n }", "public NamespacesList<Pair> getPairs(String namespace, String predicate, int perPage, int page) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n NamespacesList<Pair> nsList = new NamespacesList<Pair>();\r\n parameters.put(\"method\", METHOD_GET_PAIRS);\r\n\r\n if (namespace != null) {\r\n parameters.put(\"namespace\", namespace);\r\n }\r\n if (predicate != null) {\r\n parameters.put(\"predicate\", predicate);\r\n }\r\n if (perPage > 0) {\r\n parameters.put(\"per_page\", \"\" + perPage);\r\n }\r\n if (page > 0) {\r\n parameters.put(\"page\", \"\" + page);\r\n }\r\n\r\n Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n Element nsElement = response.getPayload();\r\n NodeList nsNodes = nsElement.getElementsByTagName(\"pair\");\r\n nsList.setPage(nsElement.getAttribute(\"page\"));\r\n nsList.setPages(nsElement.getAttribute(\"pages\"));\r\n nsList.setPerPage(nsElement.getAttribute(\"perPage\"));\r\n nsList.setTotal(\"\" + nsNodes.getLength());\r\n for (int i = 0; i < nsNodes.getLength(); i++) {\r\n Element element = (Element) nsNodes.item(i);\r\n nsList.add(parsePair(element));\r\n }\r\n return nsList;\r\n }", "public static void stop(){\r\n //--Close logger\r\n isClosed = true; // <- not a thread-safe boolean\r\n Thread.yield(); //poor man's synchronization attempt (let everything else log that wants to)\r\n Thread.yield();\r\n //--Close Tracks\r\n while(depth > 0){\r\n depth -= 1;\r\n //(send signal to handlers)\r\n handlers.process(null, MessageType.END_TRACK, depth, System.currentTimeMillis());\r\n }\r\n //--Shutdown\r\n handlers.process(null, MessageType.SHUTDOWN, 0, System.currentTimeMillis());\r\n }", "public By getWebDriverBy() {\n\n\t\tswitch (how) {\n\t\t\tcase name:\n\t\t\t\treturn By.name(this.value);\n\n\t\t\tcase xpath:\n\t\t\t\t// Work around HLWK driver bug\n\t\t\t\treturn By.xpath(this.value.replaceAll(\"/BODY\\\\[1\\\\]/\", \"/BODY/\"));\n\n\t\t\tcase id:\n\t\t\t\treturn By.id(this.value);\n\n\t\t\tcase tag:\n\t\t\t\treturn By.tagName(this.value);\n\n\t\t\tcase text:\n\t\t\t\treturn By.linkText(this.value);\n\n\t\t\tcase partialText:\n\t\t\t\treturn By.partialLinkText(this.value);\n\n\t\t\tdefault:\n\t\t\t\treturn null;\n\n\t\t}\n\n\t}", "@Api\n\tpublic static void configureNoCaching(HttpServletResponse response) {\n\t\t// HTTP 1.0 header:\n\t\tresponse.setHeader(HTTP_EXPIRES_HEADER, HTTP_EXPIRES_HEADER_NOCACHE_VALUE);\n\t\tresponse.setHeader(HTTP_CACHE_PRAGMA, HTTP_CACHE_PRAGMA_VALUE);\n\n\t\t// HTTP 1.1 header:\n\t\tresponse.setHeader(HTTP_CACHE_CONTROL_HEADER, HTTP_CACHE_CONTROL_HEADER_NOCACHE_VALUE);\n\t}" ]
Convert custom info. @param customInfo the custom info map @return the custom info type
[ "private static CustomInfoType convertCustomInfo(Map<String, String> customInfo) {\n if (customInfo == null) {\n return null;\n }\n\n CustomInfoType ciType = new CustomInfoType();\n for (Entry<String, String> entry : customInfo.entrySet()) {\n CustomInfoType.Item cItem = new CustomInfoType.Item();\n cItem.setKey(entry.getKey());\n cItem.setValue(entry.getValue());\n ciType.getItem().add(cItem);\n }\n\n return ciType;\n }" ]
[ "public boolean add(long key) {\n final int index = ((((int) (key >>> 32)) ^ ((int) (key))) & 0x7fffffff) % capacity;\n final Entry entryOriginal = table[index];\n for (Entry entry = entryOriginal; entry != null; entry = entry.next) {\n if (entry.key == key) {\n return false;\n }\n }\n table[index] = new Entry(key, entryOriginal);\n size++;\n if (size > threshold) {\n setCapacity(2 * capacity);\n }\n return true;\n }", "public static Map<String,List<Long>> readHints(File hints) throws IOException {\n Map<String,List<Long>> result = new HashMap<>();\n InputStream is = new FileInputStream(hints);\n mergeHints(is, result);\n return result;\n }", "private JSONArray getApplicablePathNames (String requestUrl, Integer requestType) throws Exception {\n RequestInformation requestInfo = requestInformation.get();\n List<EndpointOverride> applicablePaths;\n JSONArray pathNames = new JSONArray();\n // Get all paths that match the request\n applicablePaths = PathOverrideService.getInstance().getSelectedPaths(Constants.OVERRIDE_TYPE_REQUEST, requestInfo.client,\n requestInfo.profile,\n requestUrl + \"?\" + requestInfo.originalRequestInfo.getQueryString(),\n requestType, true);\n // Extract just the path name from each path\n for (EndpointOverride path : applicablePaths) {\n JSONObject pathName = new JSONObject();\n pathName.put(\"name\", path.getPathName());\n pathNames.put(pathName);\n }\n\n return pathNames;\n }", "public static <T> T columnStringToObject(Class<?> objClass, String str, Pattern delimiterPattern, String[] fieldNames)\r\n throws InstantiationException, IllegalAccessException, NoSuchMethodException, NoSuchFieldException, InvocationTargetException\r\n {\r\n String[] fields = delimiterPattern.split(str);\r\n T item = ErasureUtils.<T>uncheckedCast(objClass.newInstance());\r\n for (int i = 0; i < fields.length; i++) {\r\n try {\r\n Field field = objClass.getDeclaredField(fieldNames[i]);\r\n field.set(item, fields[i]);\r\n } catch (IllegalAccessException ex) {\r\n Method method = objClass.getDeclaredMethod(\"set\" + StringUtils.capitalize(fieldNames[i]), String.class);\r\n method.invoke(item, fields[i]);\r\n }\r\n }\r\n return item;\r\n }", "protected RendererViewHolder buildRendererViewHolder() {\n validateAttributesToCreateANewRendererViewHolder();\n\n Renderer renderer = getPrototypeByIndex(viewType).copy();\n renderer.onCreate(null, layoutInflater, parent);\n return new RendererViewHolder(renderer);\n }", "public static base_response unset(nitro_service client, nslimitselector resource, String[] args) throws Exception{\n\t\tnslimitselector unsetresource = new nslimitselector();\n\t\tunsetresource.selectorname = resource.selectorname;\n\t\treturn unsetresource.unset_resource(client,args);\n\t}", "public static List<List<RTFEmbeddedObject>> getEmbeddedObjects(String text)\n {\n List<List<RTFEmbeddedObject>> objects = null;\n List<RTFEmbeddedObject> objectData;\n\n int offset = text.indexOf(OBJDATA);\n if (offset != -1)\n {\n objects = new LinkedList<List<RTFEmbeddedObject>>();\n\n while (offset != -1)\n {\n objectData = new LinkedList<RTFEmbeddedObject>();\n objects.add(objectData);\n offset = readObjectData(offset, text, objectData);\n offset = text.indexOf(OBJDATA, offset);\n }\n }\n\n return (objects);\n }", "public AsciiTable setPaddingRight(int paddingRight) {\r\n\t\tfor(AT_Row row : this.rows){\r\n\t\t\tif(row.getType()==TableRowType.CONTENT){\r\n\t\t\t\trow.setPaddingRight(paddingRight);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}", "@Pure\n\tpublic static <P1, P2, P3, P4, P5> Procedure4<P2, P3, P4, P5> curry(final Procedure5<? super P1, ? super P2, ? super P3, ? super P4, ? super P5> procedure,\n\t\t\tfinal P1 argument) {\n\t\tif (procedure == null)\n\t\t\tthrow new NullPointerException(\"procedure\");\n\t\treturn new Procedure4<P2, P3, P4, P5>() {\n\t\t\t@Override\n\t\t\tpublic void apply(P2 p2, P3 p3, P4 p4, P5 p5) {\n\t\t\t\tprocedure.apply(argument, p2, p3, p4, p5);\n\t\t\t}\n\t\t};\n\t}" ]
Set the on-finish callback. The basic {@link GVROnFinish} callback will notify you when the animation runs to completion. This is a good time to do things like removing now-invisible objects from the scene graph. <p> The extended {@link GVROnRepeat} callback will be called after every iteration of an indefinite (repeat count less than 0) animation, giving you a way to stop the animation when it's not longer appropriate. @param callback A {@link GVROnFinish} or {@link GVROnRepeat} implementation. <p> <em>Note</em>: Supplying a {@link GVROnRepeat} callback will {@linkplain #setRepeatCount(int) set the repeat count} to a negative number. Calling {@link #setRepeatCount(int)} with a non-negative value after setting a {@link GVROnRepeat} callback will effectively convert the callback to a {@link GVROnFinish}. @return {@code this}, so you can chain setProperty() calls.
[ "public GVRAnimation setOnFinish(GVROnFinish callback) {\n mOnFinish = callback;\n\n // Do the instance-of test at set-time, not at use-time\n mOnRepeat = callback instanceof GVROnRepeat ? (GVROnRepeat) callback\n : null;\n if (mOnRepeat != null) {\n mRepeatCount = -1; // loop until iterate() returns false\n }\n return this;\n }" ]
[ "public static java.util.Date newDateTime() {\n return new java.util.Date((System.currentTimeMillis() / SECOND_MILLIS) * SECOND_MILLIS);\n }", "protected boolean clearSpecial(DatabaseConnection connection, Logger logger) {\n\t\tNestedConnection currentSaved = specialConnection.get();\n\t\tboolean cleared = false;\n\t\tif (connection == null) {\n\t\t\t// ignored\n\t\t} else if (currentSaved == null) {\n\t\t\tlogger.error(\"no connection has been saved when clear() called\");\n\t\t} else if (currentSaved.connection == connection) {\n\t\t\tif (currentSaved.decrementAndGet() == 0) {\n\t\t\t\t// we only clear the connection if nested counter is 0\n\t\t\t\tspecialConnection.set(null);\n\t\t\t}\n\t\t\tcleared = true;\n\t\t} else {\n\t\t\tlogger.error(\"connection saved {} is not the one being cleared {}\", currentSaved.connection, connection);\n\t\t}\n\t\t// release should then be called after clear\n\t\treturn cleared;\n\t}", "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 Set<D> getMatchedDeclaration() {\n Set<D> bindedSet = new HashSet<D>();\n for (Map.Entry<ServiceReference<D>, Boolean> e : declarations.entrySet()) {\n if (e.getValue()) {\n bindedSet.add(getDeclaration(e.getKey()));\n }\n }\n return bindedSet;\n }", "public RowColumn following() {\n if (row.equals(Bytes.EMPTY)) {\n return RowColumn.EMPTY;\n } else if (col.equals(Column.EMPTY)) {\n return new RowColumn(followingBytes(row));\n } else if (!col.isQualifierSet()) {\n return new RowColumn(row, new Column(followingBytes(col.getFamily())));\n } else if (!col.isVisibilitySet()) {\n return new RowColumn(row, new Column(col.getFamily(), followingBytes(col.getQualifier())));\n } else {\n return new RowColumn(row,\n new Column(col.getFamily(), col.getQualifier(), followingBytes(col.getVisibility())));\n }\n }", "private String toResourceNameOnClasspath(String classPathRootOnDisk, File file) {\n String fileName = file.getAbsolutePath().replace(\"\\\\\", \"/\");\n return fileName.substring(classPathRootOnDisk.length());\n }", "public static dos_stats get(nitro_service service, options option) throws Exception{\n\t\tdos_stats obj = new dos_stats();\n\t\tdos_stats[] response = (dos_stats[])obj.stat_resources(service,option);\n\t\treturn response[0];\n\t}", "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 }", "protected static String getTimePrecisionString(byte precision) {\n\t\tswitch (precision) {\n\t\tcase TimeValue.PREC_SECOND:\n\t\t\treturn \"sec\";\n\t\tcase TimeValue.PREC_MINUTE:\n\t\t\treturn \"min\";\n\t\tcase TimeValue.PREC_HOUR:\n\t\t\treturn \"hour\";\n\t\tcase TimeValue.PREC_DAY:\n\t\t\treturn \"day\";\n\t\tcase TimeValue.PREC_MONTH:\n\t\t\treturn \"month\";\n\t\tcase TimeValue.PREC_YEAR:\n\t\t\treturn \"year\";\n\t\tcase TimeValue.PREC_DECADE:\n\t\t\treturn \"decade\";\n\t\tcase TimeValue.PREC_100Y:\n\t\t\treturn \"100 years\";\n\t\tcase TimeValue.PREC_1KY:\n\t\t\treturn \"1000 years\";\n\t\tcase TimeValue.PREC_10KY:\n\t\t\treturn \"10K years\";\n\t\tcase TimeValue.PREC_100KY:\n\t\t\treturn \"100K years\";\n\t\tcase TimeValue.PREC_1MY:\n\t\t\treturn \"1 million years\";\n\t\tcase TimeValue.PREC_10MY:\n\t\t\treturn \"10 million years\";\n\t\tcase TimeValue.PREC_100MY:\n\t\t\treturn \"100 million years\";\n\t\tcase TimeValue.PREC_1GY:\n\t\t\treturn \"1000 million years\";\n\t\tdefault:\n\t\t\treturn \"Unsupported precision \" + precision;\n\t\t}\n\t}" ]
Use this API to delete snmpmanager.
[ "public static base_response delete(nitro_service client, snmpmanager resource) throws Exception {\n\t\tsnmpmanager deleteresource = new snmpmanager();\n\t\tdeleteresource.ipaddress = resource.ipaddress;\n\t\tdeleteresource.netmask = resource.netmask;\n\t\treturn deleteresource.delete_resource(client);\n\t}" ]
[ "public String renameApp(String appName, String newName) {\n return connection.execute(new AppRename(appName, newName), apiKey).getName();\n }", "public final void setVolumeByIncrement(float level) throws IOException {\n Volume volume = this.getStatus().volume;\n float total = volume.level;\n\n if (volume.increment <= 0f) {\n throw new ChromeCastException(\"Volume.increment is <= 0\");\n }\n\n // With floating points we always have minor decimal variations, using the Math.min/max\n // works around this issue\n // Increase volume\n if (level > total) {\n while (total < level) {\n total = Math.min(total + volume.increment, level);\n setVolume(total);\n }\n // Decrease Volume\n } else if (level < total) {\n while (total > level) {\n total = Math.max(total - volume.increment, level);\n setVolume(total);\n }\n }\n }", "@Deprecated public Duration getDuration(String calendarName, Date startDate, Date endDate) throws MPXJException\n {\n ProjectCalendar calendar = getCalendarByName(calendarName);\n\n if (calendar == null)\n {\n throw new MPXJException(MPXJException.CALENDAR_ERROR + \": \" + calendarName);\n }\n\n return (calendar.getDuration(startDate, endDate));\n }", "private String alterPrefix(String word, String oldPrefix, String newPrefix) {\n\n if (word.startsWith(oldPrefix)) {\n return word.replaceFirst(oldPrefix, newPrefix);\n }\n return (newPrefix + word);\n }", "public InsertIntoTable set(String name, Object value) {\n builder.set(name, value);\n return this;\n }", "public static <T> JacksonParser<T> json(Class<T> contentType) {\n return new JacksonParser<>(null, contentType);\n }", "public boolean containsNonZeroHosts(IPAddressSection other) {\n\t\tif(!other.isPrefixed()) {\n\t\t\treturn contains(other);\n\t\t}\n\t\tint otherPrefixLength = other.getNetworkPrefixLength();\n\t\tif(otherPrefixLength == other.getBitCount()) {\n\t\t\treturn contains(other);\n\t\t}\n\t\treturn containsNonZeroHostsImpl(other, otherPrefixLength);\n\t}", "public boolean isHomeKeyPresent() {\n final GVRApplication application = mApplication.get();\n if (null != application) {\n final String model = getHmtModel();\n if (null != model && model.contains(\"R323\")) {\n return true;\n }\n }\n return false;\n }", "public static List<ClassReference> analyze(WildcardImportResolver importResolver, Set<String> libraryPaths, Set<String> sourcePaths,\n Path sourceFile)\n {\n ASTParser parser = ASTParser.newParser(AST.JLS11);\n parser.setEnvironment(libraryPaths.toArray(new String[libraryPaths.size()]), sourcePaths.toArray(new String[sourcePaths.size()]), null, true);\n parser.setBindingsRecovery(false);\n parser.setResolveBindings(true);\n Map options = JavaCore.getOptions();\n JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options);\n parser.setCompilerOptions(options);\n String fileName = sourceFile.getFileName().toString();\n parser.setUnitName(fileName);\n try\n {\n parser.setSource(FileUtils.readFileToString(sourceFile.toFile()).toCharArray());\n }\n catch (IOException e)\n {\n throw new ASTException(\"Failed to get source for file: \" + sourceFile.toString() + \" due to: \" + e.getMessage(), e);\n }\n parser.setKind(ASTParser.K_COMPILATION_UNIT);\n CompilationUnit cu = (CompilationUnit) parser.createAST(null);\n ReferenceResolvingVisitor visitor = new ReferenceResolvingVisitor(importResolver, cu, sourceFile.toString());\n cu.accept(visitor);\n return visitor.getJavaClassReferences();\n }" ]
Utility function to get the current text.
[ "public static final String getSelectedText(ListBox list) {\n\tint index = list.getSelectedIndex();\n\treturn (index >= 0) ? list.getItemText(index) : null;\n }" ]
[ "private static void freeTempLOB(ClobWrapper clob, BlobWrapper blob)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif (clob != null)\r\n\t\t\t{\r\n\t\t\t\t// If the CLOB is open, close it\r\n\t\t\t\tif (clob.isOpen())\r\n\t\t\t\t{\r\n\t\t\t\t\tclob.close();\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Free the memory used by this CLOB\r\n\t\t\t\tclob.freeTemporary();\r\n\t\t\t}\r\n\r\n\t\t\tif (blob != null)\r\n\t\t\t{\r\n\t\t\t\t// If the BLOB is open, close it\r\n\t\t\t\tif (blob.isOpen())\r\n\t\t\t\t{\r\n\t\t\t\t\tblob.close();\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Free the memory used by this BLOB\r\n\t\t\t\tblob.freeTemporary();\r\n\t\t\t}\r\n\t\t}\r\n\t\tcatch (Exception e)\r\n\t\t{\r\n logger.error(\"Error during temporary LOB release\", e);\r\n\t\t}\r\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 void alias( double value , String name ) {\n if( isReserved(name))\n throw new RuntimeException(\"Reserved word or contains a reserved character. '\"+name+\"'\");\n\n VariableDouble old = (VariableDouble)variables.get(name);\n if( old == null ) {\n variables.put(name, new VariableDouble(value));\n }else {\n old.value = value;\n }\n }", "public void setIndexBuffer(GVRIndexBuffer ibuf)\n {\n mIndices = ibuf;\n NativeMesh.setIndexBuffer(getNative(), (ibuf != null) ? ibuf.getNative() : 0L);\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 int readFrom(byte[] src, int srcOffset, long destOffset, int length) {\n int readLen = (int) Math.min(src.length - srcOffset, Math.min(size() - destOffset, length));\n ByteBuffer b = toDirectByteBuffer(destOffset, readLen);\n b.position(0);\n b.put(src, srcOffset, readLen);\n return readLen;\n }", "private void processCalendarHours(ProjectCalendar calendar, Record dayRecord)\n {\n // ... for each day of the week\n Day day = Day.getInstance(Integer.parseInt(dayRecord.getField()));\n // Get hours\n List<Record> recHours = dayRecord.getChildren();\n if (recHours.size() == 0)\n {\n // No data -> not working\n calendar.setWorkingDay(day, false);\n }\n else\n {\n calendar.setWorkingDay(day, true);\n // Read hours\n ProjectCalendarHours hours = calendar.addCalendarHours(day);\n for (Record recWorkingHours : recHours)\n {\n addHours(hours, recWorkingHours);\n }\n }\n }", "public String convertToPrefixLength() throws AddressStringException {\n\t\tIPAddress address = toAddress();\n\t\tInteger prefix;\n\t\tif(address == null) {\n\t\t\tif(isPrefixOnly()) {\n\t\t\t\tprefix = getNetworkPrefixLength();\n\t\t\t} else {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t} else {\n\t\t\tprefix = address.getBlockMaskPrefixLength(true);\n\t\t\tif(prefix == null) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\treturn IPAddressSegment.toUnsignedString(prefix, 10, \n\t\t\t\tnew StringBuilder(IPAddressSegment.toUnsignedStringLength(prefix, 10) + 1).append(IPAddress.PREFIX_LEN_SEPARATOR)).toString();\n\t}", "protected void addLabelForNumbers(ItemIdValue itemIdValue) {\n\n\t\tString qid = itemIdValue.getId();\n\n\t\ttry {\n\t\t\t// Fetch the online version of the item to make sure we edit the\n\t\t\t// current version:\n\t\t\tItemDocument currentItemDocument = (ItemDocument) dataFetcher\n\t\t\t\t\t.getEntityDocument(qid);\n\t\t\tif (currentItemDocument == null) {\n\t\t\t\tSystem.out.println(\"*** \" + qid\n\t\t\t\t\t\t+ \" could not be fetched. Maybe it has been deleted.\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Check if we still have exactly one numeric value:\n\t\t\tQuantityValue number = currentItemDocument\n\t\t\t\t\t.findStatementQuantityValue(\"P1181\");\n\t\t\tif (number == null) {\n\t\t\t\tSystem.out.println(\"*** No unique numeric value for \" + qid);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Check if the item is in a known numeric class:\n\t\t\tif (!currentItemDocument.hasStatementValue(\"P31\", numberClasses)) {\n\t\t\t\tSystem.out\n\t\t\t\t\t\t.println(\"*** \"\n\t\t\t\t\t\t\t\t+ qid\n\t\t\t\t\t\t\t\t+ \" is not in a known class of integer numbers. Skipping.\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Check if the value is integer and build label string:\n\t\t\tString numberString;\n\t\t\ttry {\n\t\t\t\tBigInteger intValue = number.getNumericValue()\n\t\t\t\t\t\t.toBigIntegerExact();\n\t\t\t\tnumberString = intValue.toString();\n\t\t\t} catch (ArithmeticException e) {\n\t\t\t\tSystem.out.println(\"*** Numeric value for \" + qid\n\t\t\t\t\t\t+ \" is not an integer: \" + number.getNumericValue());\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Construct data to write:\n\t\t\tItemDocumentBuilder itemDocumentBuilder = ItemDocumentBuilder\n\t\t\t\t\t.forItemId(itemIdValue).withRevisionId(\n\t\t\t\t\t\t\tcurrentItemDocument.getRevisionId());\n\t\t\tArrayList<String> languages = new ArrayList<>(\n\t\t\t\t\tarabicNumeralLanguages.length);\n\t\t\tfor (int i = 0; i < arabicNumeralLanguages.length; i++) {\n\t\t\t\tif (!currentItemDocument.getLabels().containsKey(\n\t\t\t\t\t\tarabicNumeralLanguages[i])) {\n\t\t\t\t\titemDocumentBuilder.withLabel(numberString,\n\t\t\t\t\t\t\tarabicNumeralLanguages[i]);\n\t\t\t\t\tlanguages.add(arabicNumeralLanguages[i]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (languages.size() == 0) {\n\t\t\t\tSystem.out.println(\"*** Labels already complete for \" + qid);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlogEntityModification(currentItemDocument.getEntityId(),\n\t\t\t\t\tnumberString, languages);\n\n\t\t\tdataEditor.editItemDocument(itemDocumentBuilder.build(), false,\n\t\t\t\t\t\"Set labels to numeric value (Task MB1)\");\n\t\t} catch (MediaWikiApiErrorException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}" ]
dst is just for log information
[ "private void doSend(byte[] msg, boolean wait, KNXAddress dst)\r\n\t\tthrows KNXAckTimeoutException, KNXLinkClosedException\r\n\t{\r\n\t\tif (closed)\r\n\t\t\tthrow new KNXLinkClosedException(\"link closed\");\r\n\t\ttry {\r\n\t\t\tlogger.info(\"send message to \" + dst + (wait ? \", wait for ack\" : \"\"));\r\n\t\t\tlogger.trace(\"EMI \" + DataUnitBuilder.toHex(msg, \" \"));\r\n\t\t\tconn.send(msg, wait);\r\n\t\t\tlogger.trace(\"send to \" + dst + \" succeeded\");\r\n\t\t}\r\n\t\tcatch (final KNXPortClosedException e) {\r\n\t\t\tlogger.error(\"send error, closing link\", e);\r\n\t\t\tclose();\r\n\t\t\tthrow new KNXLinkClosedException(\"link closed, \" + e.getMessage());\r\n\t\t}\r\n\t}" ]
[ "public static String dump(final int displayOffset, final byte[] data, final int offset, final int len)\n {\n StringBuilder sb = new StringBuilder();\n Formatter formatter = new Formatter(sb);\n StringBuilder ascii = new StringBuilder();\n\n int dataNdx = offset;\n final int maxDataNdx = offset + len;\n final int lines = (len + 16) / 16;\n for (int i = 0; i < lines; i++) {\n ascii.append(\" |\");\n formatter.format(\"%08x \", displayOffset + (i * 16));\n\n for (int j = 0; j < 16; j++) {\n if (dataNdx < maxDataNdx) {\n byte b = data[dataNdx++];\n formatter.format(\"%02x \", b);\n ascii.append((b > MIN_VISIBLE && b < MAX_VISIBLE) ? (char) b : ' ');\n }\n else {\n sb.append(\" \");\n }\n\n if (j == 7) {\n sb.append(' ');\n }\n }\n\n ascii.append('|');\n sb.append(ascii).append('\\n');\n ascii.setLength(0);\n }\n\n formatter.close();\n return sb.toString();\n }", "private ClassMatcher buildMatcher(String tagText) {\n\t// check there are at least @match <type> and a parameter\n\tString[] strings = StringUtil.tokenize(tagText);\n\tif (strings.length < 2) {\n\t System.err.println(\"Skipping uncomplete @match tag, type missing: \" + tagText + \" in view \" + viewDoc);\n\t return null;\n\t}\n\t\n\ttry {\n\t if (strings[0].equals(\"class\")) {\n\t\treturn new PatternMatcher(Pattern.compile(strings[1]));\n\t } else if (strings[0].equals(\"context\")) {\n\t\treturn new ContextMatcher(root, Pattern.compile(strings[1]), getGlobalOptions(), \n\t\t\tfalse);\n\t } else if (strings[0].equals(\"outgoingContext\")) {\n\t\treturn new ContextMatcher(root, Pattern.compile(strings[1]), getGlobalOptions(), \n\t\t\tfalse);\n\t } else if (strings[0].equals(\"interface\")) {\n\t\treturn new InterfaceMatcher(root, Pattern.compile(strings[1]));\n\t } else if (strings[0].equals(\"subclass\")) {\n\t\treturn new SubclassMatcher(root, Pattern.compile(strings[1]));\n\t } else {\n\t\tSystem.err.println(\"Skipping @match tag, unknown match type, in view \" + viewDoc);\n\t }\n\t} catch (PatternSyntaxException pse) {\n\t System.err.println(\"Skipping @match tag due to invalid regular expression '\" + tagText\n\t\t + \"'\" + \" in view \" + viewDoc);\n\t} catch (Exception e) {\n\t System.err.println(\"Skipping @match tag due to an internal error '\" + tagText\n\t\t + \"'\" + \" in view \" + viewDoc);\n\t e.printStackTrace();\n\t}\n\treturn null;\n }", "public static Processor<DataSourceTask> source(DataSource source, int parallelism, String description, UserConfig taskConf, ActorSystem system) {\n io.gearpump.streaming.Processor<DataSourceTask<Object, Object>> p =\n DataSourceProcessor.apply(source, parallelism, description, taskConf, system);\n return new Processor(p);\n }", "private void sendAnnouncement(InetAddress broadcastAddress) {\n try {\n DatagramPacket announcement = new DatagramPacket(announcementBytes, announcementBytes.length,\n broadcastAddress, DeviceFinder.ANNOUNCEMENT_PORT);\n socket.get().send(announcement);\n Thread.sleep(getAnnounceInterval());\n } catch (Throwable t) {\n logger.warn(\"Unable to send announcement packet, shutting down\", t);\n stop();\n }\n }", "@Override protected View inflate(LayoutInflater inflater, ViewGroup parent) {\n View inflatedView = inflater.inflate(R.layout.video_renderer, parent, false);\n /*\n * You don't have to use ButterKnife library to implement the mapping between your layout\n * and your widgets you can implement setUpView and hookListener methods declared in\n * Renderer<T> class.\n */\n ButterKnife.bind(this, inflatedView);\n return inflatedView;\n }", "public static base_response add(nitro_service client, ntpserver resource) throws Exception {\n\t\tntpserver addresource = new ntpserver();\n\t\taddresource.serverip = resource.serverip;\n\t\taddresource.servername = resource.servername;\n\t\taddresource.minpoll = resource.minpoll;\n\t\taddresource.maxpoll = resource.maxpoll;\n\t\taddresource.autokey = resource.autokey;\n\t\taddresource.key = resource.key;\n\t\treturn addresource.add_resource(client);\n\t}", "private void init()\n {\n style = new BoxStyle(UNIT);\n textLine = new StringBuilder();\n textMetrics = null;\n graphicsPath = new Vector<PathSegment>();\n startPage = 0;\n endPage = Integer.MAX_VALUE;\n fontTable = new FontTable();\n }", "public static URI setPath(final URI initialUri, final String path) {\n String finalPath = path;\n if (!finalPath.startsWith(\"/\")) {\n finalPath = '/' + path;\n }\n try {\n if (initialUri.getHost() == null && initialUri.getAuthority() != null) {\n return new URI(initialUri.getScheme(), initialUri.getAuthority(), finalPath,\n initialUri.getQuery(),\n initialUri.getFragment());\n } else {\n return new URI(initialUri.getScheme(), initialUri.getUserInfo(), initialUri.getHost(),\n initialUri.getPort(),\n finalPath, initialUri.getQuery(), initialUri.getFragment());\n }\n } catch (URISyntaxException e) {\n throw ExceptionUtils.getRuntimeException(e);\n }\n }", "private void addNewGenderName(EntityIdValue entityIdValue, String name) {\n\t\tthis.genderNames.put(entityIdValue, name);\n\t\tthis.genderNamesList.add(entityIdValue);\n\t}" ]
Obtains a Symmetry010 zoned date-time from another date-time object. @param temporal the date-time object to convert, not null @return the Symmetry010 zoned date-time, not null @throws DateTimeException if unable to create the date-time
[ "@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoZonedDateTime<Symmetry010Date> zonedDateTime(TemporalAccessor temporal) {\n return (ChronoZonedDateTime<Symmetry010Date>) super.zonedDateTime(temporal);\n }" ]
[ "private void processResourceAssignment(Task task, MapRow row)\n {\n Resource resource = m_resourceMap.get(row.getUUID(\"RESOURCE_UUID\"));\n task.addResourceAssignment(resource);\n }", "public List<Callouts.Callout> getCallout()\n {\n if (callout == null)\n {\n callout = new ArrayList<Callouts.Callout>();\n }\n return this.callout;\n }", "private boolean runQueuedTask(boolean hasPermit) {\n if (!hasPermit && beginRequest(paused) == RunResult.REJECTED) {\n return false;\n }\n QueuedTask task = null;\n if (!paused) {\n task = taskQueue.poll();\n } else {\n //the container is suspended, but we still need to run any force queued tasks\n task = findForcedTask();\n }\n if (task != null) {\n if(!task.runRequest()) {\n decrementRequestCount();\n }\n return true;\n } else {\n decrementRequestCount();\n return false;\n }\n }", "@Override\n public void onClick(View v) {\n String tag = (String) v.getTag();\n mContentTextView.setText(String.format(\"%s clicked.\", tag));\n mMenuDrawer.setActiveView(v);\n }", "public ScopedToken getLowerScopedToken(List<String> scopes, String resource) {\n assert (scopes != null);\n assert (scopes.size() > 0);\n URL url = null;\n try {\n url = new URL(this.getTokenURL());\n } catch (MalformedURLException e) {\n assert false : \"An invalid refresh URL indicates a bug in the SDK.\";\n throw new RuntimeException(\"An invalid refresh URL indicates a bug in the SDK.\", e);\n }\n\n StringBuilder spaceSeparatedScopes = new StringBuilder();\n for (int i = 0; i < scopes.size(); i++) {\n spaceSeparatedScopes.append(scopes.get(i));\n if (i < scopes.size() - 1) {\n spaceSeparatedScopes.append(\" \");\n }\n }\n\n String urlParameters = null;\n\n if (resource != null) {\n //this.getAccessToken() ensures we have a valid access token\n urlParameters = String.format(\"grant_type=urn:ietf:params:oauth:grant-type:token-exchange\"\n + \"&subject_token_type=urn:ietf:params:oauth:token-type:access_token&subject_token=%s\"\n + \"&scope=%s&resource=%s\",\n this.getAccessToken(), spaceSeparatedScopes, resource);\n } else {\n //this.getAccessToken() ensures we have a valid access token\n urlParameters = String.format(\"grant_type=urn:ietf:params:oauth:grant-type:token-exchange\"\n + \"&subject_token_type=urn:ietf:params:oauth:token-type:access_token&subject_token=%s\"\n + \"&scope=%s\",\n this.getAccessToken(), spaceSeparatedScopes);\n }\n\n BoxAPIRequest request = new BoxAPIRequest(this, url, \"POST\");\n request.shouldAuthenticate(false);\n request.setBody(urlParameters);\n\n String json;\n try {\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n json = response.getJSON();\n } catch (BoxAPIException e) {\n this.notifyError(e);\n throw e;\n }\n\n JsonObject jsonObject = JsonObject.readFrom(json);\n ScopedToken token = new ScopedToken(jsonObject);\n token.setObtainedAt(System.currentTimeMillis());\n token.setExpiresIn(jsonObject.get(\"expires_in\").asLong() * 1000);\n return token;\n }", "public void deleteProduct(final String name) {\n final DbProduct dbProduct = getProduct(name);\n repositoryHandler.deleteProduct(dbProduct.getName());\n }", "private synchronized void setInitializationMethod(Method newMethod)\r\n {\r\n if (newMethod != null)\r\n {\r\n // make sure it's a no argument method\r\n if (newMethod.getParameterTypes().length > 0)\r\n {\r\n throw new MetadataException(\r\n \"Initialization methods must be zero argument methods: \"\r\n + newMethod.getClass().getName()\r\n + \".\"\r\n + newMethod.getName());\r\n }\r\n\r\n // make it accessible if it's not already\r\n if (!newMethod.isAccessible())\r\n {\r\n newMethod.setAccessible(true);\r\n }\r\n }\r\n this.initializationMethod = newMethod;\r\n }", "protected void prepareRequest(List<BoxAPIRequest> requests) {\n JsonObject body = new JsonObject();\n JsonArray requestsJSONArray = new JsonArray();\n for (BoxAPIRequest request: requests) {\n JsonObject batchRequest = new JsonObject();\n batchRequest.add(\"method\", request.getMethod());\n batchRequest.add(\"relative_url\", request.getUrl().toString().substring(this.api.getBaseURL().length() - 1));\n //If the actual request has a JSON body then add it to vatch request\n if (request instanceof BoxJSONRequest) {\n BoxJSONRequest jsonRequest = (BoxJSONRequest) request;\n batchRequest.add(\"body\", jsonRequest.getBodyAsJsonValue());\n }\n //Add any headers that are in the request, except Authorization\n if (request.getHeaders() != null) {\n JsonObject batchRequestHeaders = new JsonObject();\n for (RequestHeader header: request.getHeaders()) {\n if (header.getKey() != null && !header.getKey().isEmpty()\n && !HttpHeaders.AUTHORIZATION.equals(header.getKey())) {\n batchRequestHeaders.add(header.getKey(), header.getValue());\n }\n }\n batchRequest.add(\"headers\", batchRequestHeaders);\n }\n\n //Add the request to array\n requestsJSONArray.add(batchRequest);\n }\n //Add the requests array to body\n body.add(\"requests\", requestsJSONArray);\n super.setBody(body);\n }", "static Shell createTerminalConsoleShell(String prompt, String appName,\n ShellCommandHandler mainHandler, InputStream input, OutputStream output) {\n try {\n PrintStream out = new PrintStream(output);\n\n // Build jline terminal\n jline.Terminal term = TerminalFactory.get();\n final ConsoleReader console = new ConsoleReader(input, output, term);\n console.setBellEnabled(true);\n console.setHistoryEnabled(true);\n\n // Build console\n BufferedReader in = new BufferedReader(new InputStreamReader(\n new ConsoleReaderInputStream(console)));\n\n ConsoleIO.PromptListener promptListener = new ConsoleIO.PromptListener() {\n @Override\n public boolean onPrompt(String prompt) {\n console.setPrompt(prompt);\n return true; // suppress normal prompt\n }\n };\n\n return createConsoleShell(prompt, appName, mainHandler, in, out, out, promptListener);\n } catch (Exception e) {\n // Failover: use default shell\n BufferedReader in = new BufferedReader(new InputStreamReader(input));\n PrintStream out = new PrintStream(output);\n\n return createConsoleShell(prompt, appName, mainHandler, in, out, out, null);\n }\n }" ]
List all apps for the current user's account. @param range The range of apps provided by {@link Range#getNextRange()} @return a list of apps
[ "public Range<App> listApps(String range) {\n return connection.execute(new AppList(range), apiKey);\n }" ]
[ "public static String toJson(Date date) {\n if (date == null) {\n return NULL_VALUE;\n }\n\n CharBuf buffer = CharBuf.create(26);\n writeDate(date, buffer);\n\n return buffer.toString();\n }", "public byte[] getThumbnail(ThumbnailFileType fileType, int minWidth, int minHeight, int maxWidth, int maxHeight) {\n QueryStringBuilder builder = new QueryStringBuilder();\n builder.appendParam(\"min_width\", minWidth);\n builder.appendParam(\"min_height\", minHeight);\n builder.appendParam(\"max_width\", maxWidth);\n builder.appendParam(\"max_height\", maxHeight);\n\n URLTemplate template;\n if (fileType == ThumbnailFileType.PNG) {\n template = GET_THUMBNAIL_PNG_TEMPLATE;\n } else if (fileType == ThumbnailFileType.JPG) {\n template = GET_THUMBNAIL_JPG_TEMPLATE;\n } else {\n throw new BoxAPIException(\"Unsupported thumbnail file type\");\n }\n URL url = template.buildWithQuery(this.getAPI().getBaseURL(), builder.toString(), this.getID());\n\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"GET\");\n BoxAPIResponse response = request.send();\n\n ByteArrayOutputStream thumbOut = new ByteArrayOutputStream();\n InputStream body = response.getBody();\n byte[] buffer = new byte[BUFFER_SIZE];\n try {\n int n = body.read(buffer);\n while (n != -1) {\n thumbOut.write(buffer, 0, n);\n n = body.read(buffer);\n }\n } catch (IOException e) {\n throw new BoxAPIException(\"Error reading thumbnail bytes from response body\", e);\n } finally {\n response.disconnect();\n }\n\n return thumbOut.toByteArray();\n }", "public PayloadBuilder customField(final String key, final Object value) {\n root.put(key, value);\n return this;\n }", "public void delete(Object element, boolean testForEquality) {\r\n\tint index = indexOfFromTo(element, 0, size-1, testForEquality);\r\n\tif (index>=0) removeFromTo(index,index);\r\n}", "static byte[] hmacSha1(StringBuilder message, String key) {\n try {\n Mac mac = Mac.getInstance(\"HmacSHA1\");\n mac.init(new SecretKeySpec(key.getBytes(), \"HmacSHA1\"));\n return mac.doFinal(message.toString().getBytes());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }", "public static void acceptsHex(OptionParser parser) {\n parser.acceptsAll(Arrays.asList(OPT_X, OPT_HEX), \"fetch key/entry by key value of hex type\")\n .withRequiredArg()\n .describedAs(\"key-list\")\n .withValuesSeparatedBy(',')\n .ofType(String.class);\n }", "public final SimpleFeatureCollection autoTreat(final Template template, final String features)\n throws IOException {\n SimpleFeatureCollection featuresCollection = treatStringAsURL(template, features);\n if (featuresCollection == null) {\n featuresCollection = treatStringAsGeoJson(features);\n }\n return featuresCollection;\n }", "public boolean detectNintendo() {\r\n\r\n if ((userAgent.indexOf(deviceNintendo) != -1)\r\n || (userAgent.indexOf(deviceWii) != -1)\r\n || (userAgent.indexOf(deviceNintendoDs) != -1)) {\r\n return true;\r\n }\r\n return false;\r\n }", "public List<Object> getAll(int dataSet) throws SerializationException {\r\n\t\tList<Object> result = new ArrayList<Object>();\r\n\t\tfor (Iterator<DataSet> i = dataSets.iterator(); i.hasNext();) {\r\n\t\t\tDataSet ds = i.next();\r\n\t\t\tDataSetInfo info = ds.getInfo();\r\n\t\t\tif (info.getDataSetNumber() == dataSet) {\r\n\t\t\t\tresult.add(getData(ds));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t}" ]
Use this API to add cmppolicylabel resources.
[ "public static base_responses add(nitro_service client, cmppolicylabel resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tcmppolicylabel addresources[] = new cmppolicylabel[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new cmppolicylabel();\n\t\t\t\taddresources[i].labelname = resources[i].labelname;\n\t\t\t\taddresources[i].type = resources[i].type;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}" ]
[ "public static double JaccardDistance(double[] p, double[] q) {\n double distance = 0;\n int intersection = 0, union = 0;\n\n for (int x = 0; x < p.length; x++) {\n if ((p[x] != 0) || (q[x] != 0)) {\n if (p[x] == q[x]) {\n intersection++;\n }\n\n union++;\n }\n }\n\n if (union != 0)\n distance = 1.0 - ((double) intersection / (double) union);\n else\n distance = 0;\n\n return distance;\n }", "public void execute() {\n try {\n while(true) {\n Event event = null;\n\n try {\n event = eventQueue.poll(timeout, unit);\n } catch(InterruptedException e) {\n throw new InsufficientOperationalNodesException(operation.getSimpleName()\n + \" operation interrupted!\", e);\n }\n\n if(event == null)\n throw new VoldemortException(operation.getSimpleName()\n + \" returned a null event\");\n\n if(event.equals(Event.ERROR)) {\n if(logger.isTraceEnabled())\n logger.trace(operation.getSimpleName()\n + \" request, events complete due to error\");\n\n break;\n } else if(event.equals(Event.COMPLETED)) {\n if(logger.isTraceEnabled())\n logger.trace(operation.getSimpleName() + \" request, events complete\");\n\n break;\n }\n\n Action action = eventActions.get(event);\n\n if(action == null)\n throw new IllegalStateException(\"action was null for event \" + event);\n\n if(logger.isTraceEnabled())\n logger.trace(operation.getSimpleName() + \" request, action \"\n + action.getClass().getSimpleName() + \" to handle \" + event\n + \" event\");\n\n action.execute(this);\n }\n } finally {\n finished = true;\n }\n }", "public static inatparam get(nitro_service service) throws Exception{\n\t\tinatparam obj = new inatparam();\n\t\tinatparam[] response = (inatparam[])obj.get_resources(service);\n\t\treturn response[0];\n\t}", "private List<Row> buildRowHierarchy(List<Row> bars, List<Row> expandedTasks, List<Row> tasks, List<Row> milestones)\n {\n //\n // Create a list of leaf nodes by merging the task and milestone lists\n //\n List<Row> leaves = new ArrayList<Row>();\n leaves.addAll(tasks);\n leaves.addAll(milestones);\n\n //\n // Sort the bars and the leaves\n //\n Collections.sort(bars, BAR_COMPARATOR);\n Collections.sort(leaves, LEAF_COMPARATOR);\n\n //\n // Map bar IDs to bars\n //\n Map<Integer, Row> barIdToBarMap = new HashMap<Integer, Row>();\n for (Row bar : bars)\n {\n barIdToBarMap.put(bar.getInteger(\"BARID\"), bar);\n }\n\n //\n // Merge expanded task attributes with parent bars\n // and create an expanded task ID to bar map.\n //\n Map<Integer, Row> expandedTaskIdToBarMap = new HashMap<Integer, Row>();\n for (Row expandedTask : expandedTasks)\n {\n Row bar = barIdToBarMap.get(expandedTask.getInteger(\"BAR\"));\n bar.merge(expandedTask, \"_\");\n Integer expandedTaskID = bar.getInteger(\"_EXPANDED_TASKID\");\n expandedTaskIdToBarMap.put(expandedTaskID, bar);\n }\n\n //\n // Build the hierarchy\n //\n List<Row> parentBars = new ArrayList<Row>();\n for (Row bar : bars)\n {\n Integer expandedTaskID = bar.getInteger(\"EXPANDED_TASK\");\n Row parentBar = expandedTaskIdToBarMap.get(expandedTaskID);\n if (parentBar == null)\n {\n parentBars.add(bar);\n }\n else\n {\n parentBar.addChild(bar);\n }\n }\n\n //\n // Attach the leaves\n //\n for (Row leaf : leaves)\n {\n Integer barID = leaf.getInteger(\"BAR\");\n Row bar = barIdToBarMap.get(barID);\n bar.addChild(leaf);\n }\n\n //\n // Prune any \"displaced items\" from the top level.\n // We're using a heuristic here as this is the only thing I\n // can see which differs between bars that we want to include\n // and bars that we want to exclude.\n //\n Iterator<Row> iter = parentBars.iterator();\n while (iter.hasNext())\n {\n Row bar = iter.next();\n String barName = bar.getString(\"NAMH\");\n if (barName == null || barName.isEmpty() || barName.equals(\"Displaced Items\"))\n {\n iter.remove();\n }\n }\n\n //\n // If we only have a single top level node (effectively a summary task) prune that too.\n //\n if (parentBars.size() == 1)\n {\n parentBars = parentBars.get(0).getChildRows();\n }\n\n return parentBars;\n }", "public static void writeProcessorOutputToValues(\n final Object output,\n final Processor<?, ?> processor,\n final Values values) {\n Map<String, String> mapper = processor.getOutputMapperBiMap();\n if (mapper == null) {\n mapper = Collections.emptyMap();\n }\n\n final Collection<Field> fields = getAllAttributes(output.getClass());\n for (Field field: fields) {\n String name = getOutputValueName(processor.getOutputPrefix(), mapper, field);\n try {\n final Object value = field.get(output);\n if (value != null) {\n values.put(name, value);\n } else {\n values.remove(name);\n }\n } catch (IllegalAccessException e) {\n throw ExceptionUtils.getRuntimeException(e);\n }\n }\n }", "public static RemoteProxyController create(final TransactionalProtocolClient client, final PathAddress pathAddress,\n final ProxyOperationAddressTranslator addressTranslator,\n final ModelVersion targetKernelVersion) {\n return new RemoteProxyController(client, pathAddress, addressTranslator, targetKernelVersion);\n }", "public static Transformers.ResourceIgnoredTransformationRegistry createServerIgnoredRegistry(final RequiredConfigurationHolder rc, final Transformers.ResourceIgnoredTransformationRegistry delegate) {\n return new Transformers.ResourceIgnoredTransformationRegistry() {\n @Override\n public boolean isResourceTransformationIgnored(PathAddress address) {\n final int length = address.size();\n if (length == 0) {\n return false;\n } else if (length >= 1) {\n if (delegate.isResourceTransformationIgnored(address)) {\n return true;\n }\n\n final PathElement element = address.getElement(0);\n final String type = element.getKey();\n switch (type) {\n case ModelDescriptionConstants.EXTENSION:\n // Don't ignore extensions for now\n return false;\n// if (local) {\n// return false; // Always include all local extensions\n// } else if (rc.getExtensions().contains(element.getValue())) {\n// return false;\n// }\n// break;\n case ModelDescriptionConstants.PROFILE:\n if (rc.getProfiles().contains(element.getValue())) {\n return false;\n }\n break;\n case ModelDescriptionConstants.SERVER_GROUP:\n if (rc.getServerGroups().contains(element.getValue())) {\n return false;\n }\n break;\n case ModelDescriptionConstants.SOCKET_BINDING_GROUP:\n if (rc.getSocketBindings().contains(element.getValue())) {\n return false;\n }\n break;\n }\n }\n return true;\n }\n };\n }", "public static dnsnsecrec get(nitro_service service, String hostname) throws Exception{\n\t\tdnsnsecrec obj = new dnsnsecrec();\n\t\tobj.set_hostname(hostname);\n\t\tdnsnsecrec response = (dnsnsecrec) obj.get_resource(service);\n\t\treturn response;\n\t}", "public static base_response add(nitro_service client, dnssuffix resource) throws Exception {\n\t\tdnssuffix addresource = new dnssuffix();\n\t\taddresource.Dnssuffix = resource.Dnssuffix;\n\t\treturn addresource.add_resource(client);\n\t}" ]
Appends the given string encoding special HTML characters. @param out The StringBuilder to write to. @param in Input String. @param start Input String starting position. @param end Input String end position.
[ "public final static void appendCode(final StringBuilder out, final String in, final int start, final int end)\n {\n for (int i = start; i < end; i++)\n {\n final char c;\n switch (c = in.charAt(i))\n {\n case '&':\n out.append(\"&amp;\");\n break;\n case '<':\n out.append(\"&lt;\");\n break;\n case '>':\n out.append(\"&gt;\");\n break;\n default:\n out.append(c);\n break;\n }\n }\n }" ]
[ "public MapBounds getRotatedBounds(final Rectangle2D.Double paintAreaPrecise, final Rectangle paintArea) {\n final MapBounds rotatedBounds = this.getRotatedBounds();\n\n if (rotatedBounds instanceof CenterScaleMapBounds) {\n return rotatedBounds;\n }\n\n final ReferencedEnvelope envelope = ((BBoxMapBounds) rotatedBounds).toReferencedEnvelope(null);\n // the paint area size and the map bounds are rotated independently. because\n // the paint area size is rounded to integers, the map bounds have to be adjusted\n // to these rounding changes.\n final double widthRatio = paintArea.getWidth() / paintAreaPrecise.getWidth();\n final double heightRatio = paintArea.getHeight() / paintAreaPrecise.getHeight();\n\n final double adaptedWidth = envelope.getWidth() * widthRatio;\n final double adaptedHeight = envelope.getHeight() * heightRatio;\n\n final double widthDiff = adaptedWidth - envelope.getWidth();\n final double heigthDiff = adaptedHeight - envelope.getHeight();\n envelope.expandBy(widthDiff / 2.0, heigthDiff / 2.0);\n\n return new BBoxMapBounds(envelope);\n }", "public static base_responses flush(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 flushresources[] = new cachecontentgroup[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tflushresources[i] = new cachecontentgroup();\n\t\t\t\tflushresources[i].name = resources[i].name;\n\t\t\t\tflushresources[i].query = resources[i].query;\n\t\t\t\tflushresources[i].host = resources[i].host;\n\t\t\t\tflushresources[i].selectorvalue = resources[i].selectorvalue;\n\t\t\t\tflushresources[i].force = resources[i].force;\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, flushresources,\"flush\");\n\t\t}\n\t\treturn result;\n\t}", "private void readResources(Storepoint phoenixProject)\n {\n Resources resources = phoenixProject.getResources();\n if (resources != null)\n {\n for (net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource res : resources.getResource())\n {\n Resource resource = readResource(res);\n readAssignments(resource, res);\n }\n }\n }", "public static String formatConnectionTerminationMessage(final String connectionName, final String host, final String connectionReason, final String terminationReason) {\n\t\treturn CON_TERMINATION_FORMAT.format(new Object[] { connectionName, host, connectionReason, terminationReason });\n\t}", "public MBeanOperationInfo getOperationInfo(String operationName)\n throws OperationNotFoundException, UnsupportedEncodingException {\n\n String decodedOperationName = sanitizer.urlDecode(operationName, encoding);\n Map<String, MBeanOperationInfo> operationMap = getOperationMetadata();\n if (operationMap.containsKey(decodedOperationName)) {\n return operationMap.get(decodedOperationName);\n }\n throw new OperationNotFoundException(\"Could not find operation \" + operationName + \" on MBean \" +\n objectName.getCanonicalName());\n }", "public int addPathnameToProfile(int id, String pathname, String actualPath) throws Exception {\n int pathOrder = getPathOrder(id).size() + 1;\n int pathId = -1;\n PreparedStatement statement = null;\n ResultSet results = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n statement = sqlConnection.prepareStatement(\n \"INSERT INTO \" + Constants.DB_TABLE_PATH\n + \"(\" + Constants.PATH_PROFILE_PATHNAME + \",\"\n + Constants.PATH_PROFILE_ACTUAL_PATH + \",\"\n + Constants.PATH_PROFILE_GROUP_IDS + \",\"\n + Constants.PATH_PROFILE_PROFILE_ID + \",\"\n + Constants.PATH_PROFILE_PATH_ORDER + \",\"\n + Constants.PATH_PROFILE_CONTENT_TYPE + \",\"\n + Constants.PATH_PROFILE_REQUEST_TYPE + \",\"\n + Constants.PATH_PROFILE_GLOBAL + \")\"\n + \" VALUES (?, ?, ?, ?, ?, ?, ?, ?);\",\n PreparedStatement.RETURN_GENERATED_KEYS\n );\n statement.setString(1, pathname);\n statement.setString(2, actualPath);\n statement.setString(3, \"\");\n statement.setInt(4, id);\n statement.setInt(5, pathOrder);\n statement.setString(6, Constants.PATH_PROFILE_DEFAULT_CONTENT_TYPE); // should be set by UI/API\n statement.setInt(7, Constants.REQUEST_TYPE_GET); // should be set by UI/API\n statement.setBoolean(8, false);\n statement.executeUpdate();\n\n // execute statement and get resultSet which will have the generated path ID as the first field\n results = statement.getGeneratedKeys();\n\n if (results.next()) {\n pathId = results.getInt(1);\n } else {\n // something went wrong\n throw new Exception(\"Could not add path\");\n }\n } catch (SQLException e) {\n throw e;\n } finally {\n try {\n if (results != null) {\n results.close();\n }\n } catch (Exception e) {\n }\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n\n // need to add to request response table for all clients\n for (Client client : ClientService.getInstance().findAllClients(id)) {\n this.addPathToRequestResponseTable(id, client.getUUID(), pathId);\n }\n\n return pathId;\n }", "public void validate() throws PackagingException {\n if (control == null || !control.isDirectory()) {\n throw new PackagingException(\"The 'control' attribute doesn't point to a directory. \" + control);\n }\n\n if (changesIn != null) {\n\n if (changesIn.exists() && (!changesIn.isFile() || !changesIn.canRead())) {\n throw new PackagingException(\"The 'changesIn' setting needs to point to a readable file. \" + changesIn + \" was not found/readable.\");\n }\n\n if (changesOut != null && !isWritableFile(changesOut)) {\n throw new PackagingException(\"Cannot write the output for 'changesOut' to \" + changesOut);\n }\n\n if (changesSave != null && !isWritableFile(changesSave)) {\n throw new PackagingException(\"Cannot write the output for 'changesSave' to \" + changesSave);\n }\n\n } else {\n if (changesOut != null || changesSave != null) {\n throw new PackagingException(\"The 'changesOut' or 'changesSave' settings may only be used when there is a 'changesIn' specified.\");\n }\n }\n\n if (Compression.toEnum(compression) == null) {\n throw new PackagingException(\"The compression method '\" + compression + \"' is not supported (expected 'none', 'gzip', 'bzip2' or 'xz')\");\n }\n\n if (deb == null) {\n throw new PackagingException(\"You need to specify where the deb file is supposed to be created.\");\n }\n\n getDigestCode(digest);\n }", "public static snmpalarm[] get(nitro_service service, String trapname[]) throws Exception{\n\t\tif (trapname !=null && trapname.length>0) {\n\t\t\tsnmpalarm response[] = new snmpalarm[trapname.length];\n\t\t\tsnmpalarm obj[] = new snmpalarm[trapname.length];\n\t\t\tfor (int i=0;i<trapname.length;i++) {\n\t\t\t\tobj[i] = new snmpalarm();\n\t\t\t\tobj[i].set_trapname(trapname[i]);\n\t\t\t\tresponse[i] = (snmpalarm) obj[i].get_resource(service);\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t\treturn null;\n\t}", "public static boolean checkVersionDirName(File versionDir) {\n return (versionDir.isDirectory() && versionDir.getName().contains(\"version-\") && !versionDir.getName()\n .endsWith(\".bak\"));\n }" ]
Use this API to fetch transformpolicylabel resource of given name .
[ "public static transformpolicylabel get(nitro_service service, String labelname) throws Exception{\n\t\ttransformpolicylabel obj = new transformpolicylabel();\n\t\tobj.set_labelname(labelname);\n\t\ttransformpolicylabel response = (transformpolicylabel) obj.get_resource(service);\n\t\treturn response;\n\t}" ]
[ "protected Object getObjectFromResultSet() throws PersistenceBrokerException\r\n {\r\n\r\n try\r\n {\r\n // if all primitive attributes of the object are contained in the ResultSet\r\n // the fast direct mapping can be used\r\n return super.getObjectFromResultSet();\r\n }\r\n // if the full loading failed we assume that at least PK attributes are contained\r\n // in the ResultSet and perform a slower Identity based loading...\r\n // This may of course also fail and can throw another PersistenceBrokerException\r\n catch (PersistenceBrokerException e)\r\n {\r\n Identity oid = getIdentityFromResultSet();\r\n return getBroker().getObjectByIdentity(oid);\r\n }\r\n\r\n }", "public static cmppolicylabel_stats[] get(nitro_service service) throws Exception{\n\t\tcmppolicylabel_stats obj = new cmppolicylabel_stats();\n\t\tcmppolicylabel_stats[] response = (cmppolicylabel_stats[])obj.stat_resources(service);\n\t\treturn response;\n\t}", "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}", "@SuppressWarnings(\"unchecked\")\n protected String addPostRunDependent(Appliable<? extends Indexable> appliable) {\n TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) appliable;\n return this.addPostRunDependent(dependency);\n }", "public Iterable<BoxFileVersionLegalHold.Info> getFileVersionHolds(int limit, String ... fields) {\n QueryStringBuilder queryString = new QueryStringBuilder().appendParam(\"policy_id\", this.getID());\n if (fields.length > 0) {\n queryString.appendParam(\"fields\", fields);\n }\n URL url = LIST_OF_FILE_VERSION_HOLDS_URL_TEMPLATE.buildWithQuery(getAPI().getBaseURL(), queryString.toString());\n return new BoxResourceIterable<BoxFileVersionLegalHold.Info>(getAPI(), url, limit) {\n\n @Override\n protected BoxFileVersionLegalHold.Info factory(JsonObject jsonObject) {\n BoxFileVersionLegalHold assignment\n = new BoxFileVersionLegalHold(getAPI(), jsonObject.get(\"id\").asString());\n return assignment.new Info(jsonObject);\n }\n\n };\n }", "public static CharSequence formatDuration(Context context, ReadableDuration readableDuration) {\n Resources res = context.getResources();\n Duration duration = readableDuration.toDuration();\n\n final int hours = (int) duration.getStandardHours();\n if (hours != 0) {\n return res.getQuantityString(R.plurals.joda_time_android_duration_hours, hours, hours);\n }\n\n final int minutes = (int) duration.getStandardMinutes();\n if (minutes != 0) {\n return res.getQuantityString(R.plurals.joda_time_android_duration_minutes, minutes, minutes);\n }\n\n final int seconds = (int) duration.getStandardSeconds();\n return res.getQuantityString(R.plurals.joda_time_android_duration_seconds, seconds, seconds);\n }", "public static String getDefaultJdbcTypeFor(String javaType)\r\n {\r\n return _jdbcMappings.containsKey(javaType) ? (String)_jdbcMappings.get(javaType) : JDBC_DEFAULT_TYPE;\r\n }", "public static base_responses update(nitro_service client, sslocspresponder resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tsslocspresponder updateresources[] = new sslocspresponder[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\tupdateresources[i] = new sslocspresponder();\n\t\t\t\tupdateresources[i].name = resources[i].name;\n\t\t\t\tupdateresources[i].url = resources[i].url;\n\t\t\t\tupdateresources[i].cache = resources[i].cache;\n\t\t\t\tupdateresources[i].cachetimeout = resources[i].cachetimeout;\n\t\t\t\tupdateresources[i].batchingdepth = resources[i].batchingdepth;\n\t\t\t\tupdateresources[i].batchingdelay = resources[i].batchingdelay;\n\t\t\t\tupdateresources[i].resptimeout = resources[i].resptimeout;\n\t\t\t\tupdateresources[i].respondercert = resources[i].respondercert;\n\t\t\t\tupdateresources[i].trustresponder = resources[i].trustresponder;\n\t\t\t\tupdateresources[i].producedattimeskew = resources[i].producedattimeskew;\n\t\t\t\tupdateresources[i].signingcert = resources[i].signingcert;\n\t\t\t\tupdateresources[i].usenonce = resources[i].usenonce;\n\t\t\t\tupdateresources[i].insertclientcert = resources[i].insertclientcert;\n\t\t\t}\n\t\t\tresult = update_bulk_request(client, updateresources);\n\t\t}\n\t\treturn result;\n\t}", "public void build(double[] coords, int nump) throws IllegalArgumentException {\n if (nump < 4) {\n throw new IllegalArgumentException(\"Less than four input points specified\");\n }\n if (coords.length / 3 < nump) {\n throw new IllegalArgumentException(\"Coordinate array too small for specified number of points\");\n }\n initBuffers(nump);\n setPoints(coords, nump);\n buildHull();\n }" ]
Creates a player wrapper for the Android MediaPlayer.
[ "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 void addCommandClass(ZWaveCommandClass commandClass) {\r\n\t\tZWaveCommandClass.CommandClass key = commandClass.getCommandClass();\r\n\t\tif (!supportedCommandClasses.containsKey(key)) {\r\n\t\t\tsupportedCommandClasses.put(key, commandClass);\r\n\t\t}\r\n\t}", "public void loadWithTimeout(int timeout) {\n\n for (String stylesheet : m_stylesheets) {\n boolean alreadyLoaded = checkStylesheet(stylesheet);\n if (alreadyLoaded) {\n m_loadCounter += 1;\n } else {\n appendStylesheet(stylesheet, m_jsCallback);\n }\n }\n checkAllLoaded();\n if (timeout > 0) {\n Timer timer = new Timer() {\n\n @SuppressWarnings(\"synthetic-access\")\n @Override\n public void run() {\n\n callCallback();\n }\n };\n\n timer.schedule(timeout);\n }\n }", "public MessageSet read(long readOffset, long size) throws IOException {\n return new FileMessageSet(channel, this.offset + readOffset, //\n Math.min(this.offset + readOffset + size, highWaterMark()), false, new AtomicBoolean(false));\n }", "private static String clearPath(String path) {\n try {\n ExpressionBaseState state = new ExpressionBaseState(\"EXPR\", true, false);\n if (Util.isWindows()) {\n // to not require escaping FS name separator\n state.setDefaultHandler(WordCharacterHandler.IGNORE_LB_ESCAPE_OFF);\n } else {\n state.setDefaultHandler(WordCharacterHandler.IGNORE_LB_ESCAPE_ON);\n }\n // Remove escaping characters\n path = ArgumentWithValue.resolveValue(path, state);\n } catch (CommandFormatException ex) {\n // XXX OK, continue translation\n }\n // Remove quote to retrieve candidates.\n if (path.startsWith(\"\\\"\")) {\n path = path.substring(1);\n }\n // Could be an escaped \" character. We don't take into account this corner case.\n // concider it the end of the quoted part.\n if (path.endsWith(\"\\\"\")) {\n path = path.substring(0, path.length() - 1);\n }\n return path;\n }", "@Override protected View inflate(LayoutInflater inflater, ViewGroup parent) {\n View inflatedView = inflater.inflate(R.layout.video_renderer, parent, false);\n /*\n * You don't have to use ButterKnife library to implement the mapping between your layout\n * and your widgets you can implement setUpView and hookListener methods declared in\n * Renderer<T> class.\n */\n ButterKnife.bind(this, inflatedView);\n return inflatedView;\n }", "public void setStructuredAppendMessageId(String messageId) {\r\n if (messageId != null && !messageId.matches(\"^[\\\\x21-\\\\x7F]+$\")) {\r\n throw new IllegalArgumentException(\"Invalid Aztec Code structured append message ID: \" + messageId);\r\n }\r\n this.structuredAppendMessageId = messageId;\r\n }", "private void stereotype(Options opt, Doc c, Align align) {\n\tfor (Tag tag : c.tags(\"stereotype\")) {\n\t String t[] = tokenize(tag.text());\n\t if (t.length != 1) {\n\t\tSystem.err.println(\"@stereotype expects one field: \" + tag.text());\n\t\tcontinue;\n\t }\n\t tableLine(align, guilWrap(opt, t[0]));\n\t}\n }", "public static String getChildValue(Element element, String name) {\r\n return getValue(getChild(element, name));\r\n }", "@Override\n\tpublic void validate() throws AddressStringException {\n\t\tif(isValidated()) {\n\t\t\treturn;\n\t\t}\n\t\tsynchronized(this) {\n\t\t\tif(isValidated()) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t//we know nothing about this address. See what it is.\n\t\t\ttry {\n\t\t\t\tparsedAddress = getValidator().validateAddress(this);\n\t\t\t\tisValid = true;\n\t\t\t} catch(AddressStringException e) {\n\t\t\t\tcachedException = e;\n\t\t\t\tisValid = false;\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\t}" ]
Creates an element that represents a single positioned box with no content. @return the resulting DOM element
[ "protected Element createTextElement(float width)\n {\n Element el = doc.createElement(\"div\");\n el.setAttribute(\"id\", \"p\" + (textcnt++));\n el.setAttribute(\"class\", \"p\");\n String style = curstyle.toString();\n style += \"width:\" + width + UNIT + \";\";\n el.setAttribute(\"style\", style);\n return el;\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 }", "private StepFormatter.Formatting<?, ?> getFormatting( Annotation[] annotations, Set<Class<?>> visitedTypes,\n Annotation originalAnnotation, String parameterName ) {\n List<StepFormatter.Formatting<?, ?>> foundFormatting = Lists.newArrayList();\n Table tableAnnotation = null;\n for( Annotation annotation : annotations ) {\n try {\n if( annotation instanceof Format ) {\n Format arg = (Format) annotation;\n foundFormatting.add( new StepFormatter.ArgumentFormatting( ReflectionUtil.newInstance( arg.value() ), arg.args() ) );\n } else if( annotation instanceof Table ) {\n tableAnnotation = (Table) annotation;\n } else if( annotation instanceof AnnotationFormat ) {\n AnnotationFormat arg = (AnnotationFormat) annotation;\n foundFormatting.add( new StepFormatter.ArgumentFormatting(\n new StepFormatter.AnnotationBasedFormatter( arg.value().newInstance(), originalAnnotation ) ) );\n } else {\n Class<? extends Annotation> annotationType = annotation.annotationType();\n if( !visitedTypes.contains( annotationType ) ) {\n visitedTypes.add( annotationType );\n StepFormatter.Formatting<?, ?> formatting = getFormatting( annotationType.getAnnotations(), visitedTypes,\n annotation, parameterName );\n if( formatting != null ) {\n foundFormatting.add( formatting );\n }\n }\n }\n } catch( Exception e ) {\n throw Throwables.propagate( e );\n }\n }\n\n if( foundFormatting.size() > 1 ) {\n Formatting<?, ?> innerFormatting = Iterables.getLast( foundFormatting );\n foundFormatting.remove( innerFormatting );\n\n ChainedFormatting<?> chainedFormatting = new StepFormatter.ChainedFormatting<Object>( (ObjectFormatter<Object>) innerFormatting );\n for( StepFormatter.Formatting<?, ?> formatting : Lists.reverse( foundFormatting ) ) {\n chainedFormatting.addFormatting( (StepFormatter.Formatting<?, String>) formatting );\n }\n\n foundFormatting.clear();\n foundFormatting.add( chainedFormatting );\n }\n\n if( tableAnnotation != null ) {\n ObjectFormatter<?> objectFormatter = foundFormatting.isEmpty()\n ? DefaultFormatter.INSTANCE\n : foundFormatting.get( 0 );\n return getTableFormatting( annotations, parameterName, tableAnnotation, objectFormatter );\n }\n\n if( foundFormatting.isEmpty() ) {\n return null;\n }\n\n return foundFormatting.get( 0 );\n }", "public static void doMetaGetRO(AdminClient adminClient,\n Collection<Integer> nodeIds,\n List<String> storeNames,\n List<String> metaKeys) throws IOException {\n for(String key: metaKeys) {\n System.out.println(\"Metadata: \" + key);\n if(!key.equals(KEY_MAX_VERSION) && !key.equals(KEY_CURRENT_VERSION)\n && !key.equals(KEY_STORAGE_FORMAT)) {\n System.out.println(\" Invalid read-only metadata key: \" + key);\n } else {\n for(Integer nodeId: nodeIds) {\n String hostName = adminClient.getAdminClientCluster()\n .getNodeById(nodeId)\n .getHost();\n System.out.println(\" Node: \" + hostName + \":\" + nodeId);\n if(key.equals(KEY_MAX_VERSION)) {\n Map<String, Long> mapStoreToROVersion = adminClient.readonlyOps.getROMaxVersion(nodeId,\n storeNames);\n for(String storeName: mapStoreToROVersion.keySet()) {\n System.out.println(\" \" + storeName + \":\"\n + mapStoreToROVersion.get(storeName));\n }\n } else if(key.equals(KEY_CURRENT_VERSION)) {\n Map<String, Long> mapStoreToROVersion = adminClient.readonlyOps.getROCurrentVersion(nodeId,\n storeNames);\n for(String storeName: mapStoreToROVersion.keySet()) {\n System.out.println(\" \" + storeName + \":\"\n + mapStoreToROVersion.get(storeName));\n }\n } else if(key.equals(KEY_STORAGE_FORMAT)) {\n Map<String, String> mapStoreToROFormat = adminClient.readonlyOps.getROStorageFormat(nodeId,\n storeNames);\n for(String storeName: mapStoreToROFormat.keySet()) {\n System.out.println(\" \" + storeName + \":\"\n + mapStoreToROFormat.get(storeName));\n }\n }\n }\n }\n System.out.println();\n }\n }", "public synchronized void insert(long data) {\n resetIfNeeded();\n long index = 0;\n if(data >= this.upperBound) {\n index = nBuckets - 1;\n } else if(data < 0) {\n logger.error(data + \" can't be bucketed because it is negative!\");\n return;\n } else {\n index = data / step;\n }\n if(index < 0 || index >= nBuckets) {\n // This should be dead code. Defending against code changes in\n // future.\n logger.error(data + \" can't be bucketed because index is not in range [0,nBuckets).\");\n return;\n }\n buckets[(int) index]++;\n sum += data;\n size++;\n }", "private static void invokeSetter(final Object bean, final Method setMethod, final Object fieldValue) {\n\t\ttry {\n\t\t\tsetMethod.setAccessible(true);\n\t\t\tsetMethod.invoke(bean, fieldValue);\n\t\t}\n\t\tcatch(final Exception e) {\n\t\t\tthrow new SuperCsvReflectionException(String.format(\"error invoking method %s()\", setMethod.getName()), e);\n\t\t}\n\t}", "public static BoxRetentionPolicy.Info createIndefinitePolicy(BoxAPIConnection api, String name) {\r\n return createRetentionPolicy(api, name, TYPE_INDEFINITE, 0, ACTION_REMOVE_RETENTION);\r\n }", "@RequestMapping(value = \"api/edit/disableAll\", method = RequestMethod.POST)\n public\n @ResponseBody\n String disableAll(Model model, int profileID,\n @RequestParam(defaultValue = Constants.PROFILE_CLIENT_DEFAULT_ID) String clientUUID) {\n editService.disableAll(profileID, clientUUID);\n return null;\n }", "public void setDateMax(Date dateMax) {\n this.dateMax = dateMax;\n\n if (isAttached() && dateMax != null) {\n getPicker().set(\"max\", JsDate.create((double) dateMax.getTime()));\n }\n }", "public ProjectCalendar getByName(String calendarName)\n {\n ProjectCalendar calendar = null;\n\n if (calendarName != null && calendarName.length() != 0)\n {\n Iterator<ProjectCalendar> iter = iterator();\n while (iter.hasNext() == true)\n {\n calendar = iter.next();\n String name = calendar.getName();\n\n if ((name != null) && (name.equalsIgnoreCase(calendarName) == true))\n {\n break;\n }\n\n calendar = null;\n }\n }\n\n return (calendar);\n }" ]
Used to get the complex value of a matrix element. @param row The row of the element. @param col The column of the element. @param output Storage for the value
[ "public void get( int row , int col , Complex_F64 output ) {\n ops.get(mat,row,col,output);\n }" ]
[ "public void deleteProduct(final String name) {\n final DbProduct dbProduct = getProduct(name);\n repositoryHandler.deleteProduct(dbProduct.getName());\n }", "public void checkConnection() {\n long start = Time.currentTimeMillis();\n\n while (clientChannel == null) {\n\n tcpSocketConsumer.checkNotShutdown();\n\n if (start + timeoutMs > Time.currentTimeMillis())\n try {\n condition.await(1, TimeUnit.MILLISECONDS);\n\n } catch (InterruptedException e) {\n throw new IORuntimeException(\"Interrupted\");\n }\n else\n throw new IORuntimeException(\"Not connected to \" + socketAddressSupplier);\n }\n\n if (clientChannel == null)\n throw new IORuntimeException(\"Not connected to \" + socketAddressSupplier);\n }", "public void execute(CommandHandler handler,\n int timeout,\n TimeUnit unit) throws\n CommandLineException,\n InterruptedException, ExecutionException, TimeoutException {\n ExecutableBuilder builder = new ExecutableBuilder() {\n CommandContext c = newTimeoutCommandContext(ctx);\n @Override\n public Executable build() {\n return () -> {\n handler.handle(c);\n };\n }\n\n @Override\n public CommandContext getCommandContext() {\n return c;\n }\n };\n execute(builder, timeout, unit);\n }", "public ParallelTaskBuilder prepareHttpHead(String url) {\n reinitIfClosed();\n ParallelTaskBuilder cb = new ParallelTaskBuilder();\n cb.getHttpMeta().setHttpMethod(HttpMethod.HEAD);\n cb.getHttpMeta().setRequestUrlPostfix(url);\n return cb;\n }", "public 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 }", "private Object tryConvert(\n final MfClientHttpRequestFactory clientHttpRequestFactory,\n final Object rowValue) throws URISyntaxException, IOException {\n if (this.converters.isEmpty()) {\n return rowValue;\n }\n\n String value = String.valueOf(rowValue);\n for (TableColumnConverter<?> converter: this.converters) {\n if (converter.canConvert(value)) {\n return converter.resolve(clientHttpRequestFactory, value);\n }\n }\n\n return rowValue;\n }", "private static void writeUtf16Bom(OutputStream stream, boolean bigEndian) throws IOException {\n if (bigEndian) {\n stream.write(-2);\n stream.write(-1);\n } else {\n stream.write(-1);\n stream.write(-2);\n }\n }", "public List<EndpointOverride> getPaths(int profileId, String clientUUID, String[] filters) throws Exception {\n ArrayList<EndpointOverride> properties = new ArrayList<EndpointOverride>();\n PreparedStatement statement = null;\n ResultSet results = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n String queryString = this.getPathSelectString();\n queryString += \" AND \" + Constants.DB_TABLE_PATH + \".\" + Constants.GENERIC_PROFILE_ID + \"=? \" +\n \" ORDER BY \" + Constants.PATH_PROFILE_PATH_ORDER + \" ASC\";\n\n statement = sqlConnection.prepareStatement(queryString);\n statement.setString(1, clientUUID);\n statement.setInt(2, profileId);\n\n results = statement.executeQuery();\n while (results.next()) {\n EndpointOverride endpoint = this.getEndpointOverrideFromResultSet(results);\n endpoint.setFilters(filters);\n properties.add(endpoint);\n }\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n try {\n if (results != null) {\n results.close();\n }\n } catch (Exception e) {\n }\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n\n return properties;\n }", "private void onShow() {\n\n if (m_detailsFieldset != null) {\n m_detailsFieldset.getContentPanel().getElement().getStyle().setPropertyPx(\n \"maxHeight\",\n getAvailableHeight(m_messageWidget.getOffsetHeight()));\n }\n }" ]
Appends the accumulated words to the resulting words. Trailing whitespace is removed because of the postprocessing that inserts custom whitespace @param currentWords is the {@link StringBuilder} of the accumulated words @param formattedWords is the list that is being appended to
[ "private static void flushCurrentWord( StringBuilder currentWords, List<Word> formattedWords, boolean cutWhitespace ) {\n if( currentWords.length() > 0 ) {\n if( cutWhitespace && currentWords.charAt( currentWords.length() - 1 ) == ' ' ) {\n currentWords.setLength( currentWords.length() - 1 );\n }\n formattedWords.add( new Word( currentWords.toString() ) );\n currentWords.setLength( 0 );\n }\n }" ]
[ "@SuppressWarnings(\"checkstyle:illegalcatch\")\n private boolean sendMessage(final byte[] messageToSend) {\n try {\n connectionPool.execute(new PooledObjectConsumer<TcpConnection>() {\n @Override\n public void accept(final TcpConnection tcpConnection) throws IOException {\n tcpConnection.write(messageToSend);\n }\n });\n } catch (final Exception e) {\n addError(String.format(\"Error sending message via tcp://%s:%s\",\n getGraylogHost(), getGraylogPort()), e);\n\n return false;\n }\n\n return true;\n }", "public void writeAuxiliaryTriples() throws RDFHandlerException {\n\t\tfor (PropertyRestriction pr : this.someValuesQueue) {\n\t\t\twriteSomeValueRestriction(pr.propertyUri, pr.rangeUri, pr.subject);\n\t\t}\n\t\tthis.someValuesQueue.clear();\n\n\t\tthis.valueRdfConverter.writeAuxiliaryTriples();\n\t}", "public static String pennPOSToWordnetPOS(String s) {\r\n if (s.matches(\"NN|NNP|NNS|NNPS\")) {\r\n return \"noun\";\r\n }\r\n if (s.matches(\"VB|VBD|VBG|VBN|VBZ|VBP|MD\")) {\r\n return \"verb\";\r\n }\r\n if (s.matches(\"JJ|JJR|JJS|CD\")) {\r\n return \"adjective\";\r\n }\r\n if (s.matches(\"RB|RBR|RBS|RP|WRB\")) {\r\n return \"adverb\";\r\n }\r\n return null;\r\n }", "protected void onLegendDataChanged() {\n\n int legendCount = mLegendList.size();\n float margin = (mGraphWidth / legendCount);\n float currentOffset = 0;\n\n for (LegendModel model : mLegendList) {\n model.setLegendBounds(new RectF(currentOffset, 0, currentOffset + margin, mLegendHeight));\n currentOffset += margin;\n }\n\n Utils.calculateLegendInformation(mLegendList, 0, mGraphWidth, mLegendPaint);\n\n invalidateGlobal();\n }", "public ItemRequest<Project> createInWorkspace(String workspace) {\n \n String path = String.format(\"/workspaces/%s/projects\", workspace);\n return new ItemRequest<Project>(this, Project.class, path, \"POST\");\n }", "@SuppressWarnings(\"deprecation\")\n\tprivate static WriteConcern mergeWriteConcern(WriteConcern original, WriteConcern writeConcern) {\n\t\tif ( original == null ) {\n\t\t\treturn writeConcern;\n\t\t}\n\t\telse if ( writeConcern == null ) {\n\t\t\treturn original;\n\t\t}\n\t\telse if ( original.equals( writeConcern ) ) {\n\t\t\treturn original;\n\t\t}\n\n\t\tObject wObject;\n\t\tint wTimeoutMS;\n\t\tboolean fsync;\n\t\tBoolean journal;\n\n\t\tif ( original.getWObject() instanceof String ) {\n\t\t\twObject = original.getWString();\n\t\t}\n\t\telse if ( writeConcern.getWObject() instanceof String ) {\n\t\t\twObject = writeConcern.getWString();\n\t\t}\n\t\telse {\n\t\t\twObject = Math.max( original.getW(), writeConcern.getW() );\n\t\t}\n\n\t\twTimeoutMS = Math.min( original.getWtimeout(), writeConcern.getWtimeout() );\n\n\t\tfsync = original.getFsync() || writeConcern.getFsync();\n\n\t\tif ( original.getJournal() == null ) {\n\t\t\tjournal = writeConcern.getJournal();\n\t\t}\n\t\telse if ( writeConcern.getJournal() == null ) {\n\t\t\tjournal = original.getJournal();\n\t\t}\n\t\telse {\n\t\t\tjournal = original.getJournal() || writeConcern.getJournal();\n\t\t}\n\n\t\tif ( wObject instanceof String ) {\n\t\t\treturn new WriteConcern( (String) wObject, wTimeoutMS, fsync, journal );\n\t\t}\n\t\telse {\n\t\t\treturn new WriteConcern( (int) wObject, wTimeoutMS, fsync, journal );\n\t\t}\n\t}", "protected void buildSuperJoinTree(TableAlias left, ClassDescriptor cld, String name, boolean useOuterJoin)\r\n {\r\n ClassDescriptor superCld = cld.getSuperClassDescriptor();\r\n if (superCld != null)\r\n {\r\n SuperReferenceDescriptor superRef = cld.getSuperReference();\r\n FieldDescriptor[] leftFields = superRef.getForeignKeyFieldDescriptors(cld);\r\n TableAlias base_alias = getTableAliasForPath(name, null, null);\r\n String aliasName = String.valueOf(getAliasChar()) + m_aliasCount++;\r\n TableAlias right = new TableAlias(superCld, aliasName, useOuterJoin, null);\r\n\r\n Join join1to1 = new Join(left, leftFields, right, superCld.getPkFields(), useOuterJoin, \"superClass\");\r\n base_alias.addJoin(join1to1);\r\n\r\n buildSuperJoinTree(right, superCld, name, useOuterJoin);\r\n }\r\n }", "private void writeFinalResults() {\n\t\t// Print a final report:\n\t\tprintStatus();\n\n\t\t// Store property counts in files:\n\t\twritePropertyStatisticsToFile(this.itemStatistics,\n\t\t\t\t\"item-property-counts.csv\");\n\t\twritePropertyStatisticsToFile(this.propertyStatistics,\n\t\t\t\t\"property-property-counts.csv\");\n\n\t\t// Store site link statistics in file:\n\t\ttry (PrintStream out = new PrintStream(\n\t\t\t\tExampleHelpers\n\t\t\t\t\t\t.openExampleFileOuputStream(\"site-link-counts.csv\"))) {\n\n\t\t\tout.println(\"Site key,Site links\");\n\t\t\tfor (Entry<String, Integer> entry : this.siteLinkStatistics\n\t\t\t\t\t.entrySet()) {\n\t\t\t\tout.println(entry.getKey() + \",\" + entry.getValue());\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\t// Store term statistics in file:\n\t\twriteTermStatisticsToFile(this.itemStatistics, \"item-term-counts.csv\");\n\t\twriteTermStatisticsToFile(this.propertyStatistics,\n\t\t\t\t\"property-term-counts.csv\");\n\t}", "public void create(final DbProduct dbProduct) {\n if(repositoryHandler.getProduct(dbProduct.getName()) != null){\n throw new WebApplicationException(Response.status(Response.Status.CONFLICT).entity(\"Product already exist!\").build());\n }\n\n repositoryHandler.store(dbProduct);\n }" ]
Creates a date from the equivalent long value. This conversion takes account of the time zone. @param date date expressed as a long integer @return new Date instance
[ "public static Date getDateFromLong(long date)\n {\n TimeZone tz = TimeZone.getDefault();\n return (new Date(date - tz.getRawOffset()));\n }" ]
[ "protected final void hardcodeValidCopyMethod(Class<?> fieldType, String fullyQualifiedMethodName, Class<?> argType) {\r\n if (argType==null || fieldType==null || fullyQualifiedMethodName==null) {\r\n throw new IllegalArgumentException(\"All parameters must be supplied - no nulls\");\r\n }\r\n String className = fullyQualifiedMethodName.substring(0, fullyQualifiedMethodName.lastIndexOf(\".\"));\r\n String methodName = fullyQualifiedMethodName.substring(fullyQualifiedMethodName.lastIndexOf(\".\")+1);\r\n\r\n \r\n String desc = null;\r\n try {\r\n if (MethodIs.aConstructor(methodName)) {\r\n Constructor<?> ctor = Class.forName(className).getDeclaredConstructor(argType);\r\n desc = Type.getConstructorDescriptor(ctor);\r\n } else {\r\n Method method = Class.forName(className).getMethod(methodName, argType);\r\n desc = Type.getMethodDescriptor(method);\r\n }\r\n } catch (NoSuchMethodException e) {\r\n rethrow(\"No such method\", e);\r\n } catch (SecurityException e) {\r\n rethrow(\"Security error\", e);\r\n } catch (ClassNotFoundException e) {\r\n rethrow(\"Class not found\", e);\r\n }\r\n CopyMethod copyMethod = new CopyMethod(dotted(className), methodName, desc);\r\n hardcodeValidCopyMethod(fieldType, copyMethod);\r\n }", "public void init(Configuration configuration) {\n if (devMode && reload && !listeningToDispatcher) {\n // this is the only way I found to be able to get added to to\n // ConfigurationProvider list\n // listening to events in Dispatcher\n listeningToDispatcher = true;\n Dispatcher.addDispatcherListener(this);\n }\n }", "public void addWatcher(final MongoNamespace namespace,\n final Callback<ChangeEvent<BsonDocument>, Object> watcher) {\n instanceChangeStreamListener.addWatcher(namespace, watcher);\n }", "protected static PatchElement createPatchElement(final PatchEntry entry, String patchId, final List<ContentModification> modifications) {\n final PatchElement patchElement = entry.element;\n final PatchElementImpl element = new PatchElementImpl(patchId);\n element.setProvider(patchElement.getProvider());\n // Add all the rollback actions\n element.getModifications().addAll(modifications);\n element.setDescription(patchElement.getDescription());\n return element;\n }", "protected void solveL(double[] vv) {\n\n int ii = 0;\n\n for( int i = 0; i < n; i++ ) {\n int ip = indx[i];\n double sumReal = vv[ip*2];\n double sumImg = vv[ip*2+1];\n\n vv[ip*2] = vv[i*2];\n vv[ip*2+1] = vv[i*2+1];\n\n if( ii != 0 ) {\n// for( int j = ii-1; j < i; j++ )\n// sum -= dataLU[i* n +j]*vv[j];\n int index = i*stride + (ii-1)*2;\n for( int j = ii-1; j < i; j++ ){\n double luReal = dataLU[index++];\n double luImg = dataLU[index++];\n\n double vvReal = vv[j*2];\n double vvImg = vv[j*2+1];\n\n sumReal -= luReal*vvReal - luImg*vvImg;\n sumImg -= luReal*vvImg + luImg*vvReal;\n }\n } else if( sumReal*sumReal + sumImg*sumImg != 0.0 ) {\n ii=i+1;\n }\n vv[i*2] = sumReal;\n vv[i*2+1] = sumImg;\n }\n }", "public List<DbMigration> getMigrationsSinceVersion(int version) {\n List<DbMigration> dbMigrations = new ArrayList<>();\n migrationScripts.stream().filter(script -> script.getVersion() > version).forEach(script -> {\n String content = loadScriptContent(script);\n dbMigrations.add(new DbMigration(script.getScriptName(), script.getVersion(), content));\n });\n return dbMigrations;\n }", "public static String frame(String imageUrl) {\n if (imageUrl == null || imageUrl.length() == 0) {\n throw new IllegalArgumentException(\"Image URL must not be blank.\");\n }\n return FILTER_FRAME + \"(\" + imageUrl + \")\";\n }", "public void executeDelete(ClassDescriptor cld, Object obj) throws PersistenceBrokerException\r\n {\r\n if (logger.isDebugEnabled())\r\n {\r\n logger.debug(\"executeDelete: \" + obj);\r\n }\r\n\r\n final StatementManagerIF sm = broker.serviceStatementManager();\r\n PreparedStatement stmt = null;\r\n try\r\n {\r\n stmt = sm.getDeleteStatement(cld);\r\n if (stmt == null)\r\n {\r\n logger.error(\"getDeleteStatement returned a null statement\");\r\n throw new PersistenceBrokerException(\"JdbcAccessImpl: getDeleteStatement returned a null statement\");\r\n }\r\n\r\n sm.bindDelete(stmt, cld, obj);\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"executeDelete: \" + stmt);\r\n\r\n // @todo: clearify semantics\r\n // thma: the following check is not secure. The object could be deleted *or* changed.\r\n // if it was deleted it makes no sense to throw an OL exception.\r\n // does is make sense to throw an OL exception if the object was changed?\r\n if (stmt.executeUpdate() == 0 && cld.isLocking()) //BRJ\r\n {\r\n /**\r\n * Kuali Foundation modification -- 6/19/2009\r\n */\r\n \tString objToString = \"\";\r\n \ttry {\r\n \t\tobjToString = obj.toString();\r\n \t} catch (Exception ex) {}\r\n throw new OptimisticLockException(\"Object has been modified or deleted by someone else: \" + objToString, obj);\r\n /**\r\n * End of Kuali Foundation modification\r\n */\r\n }\r\n\r\n // Harvest any return values.\r\n harvestReturnValues(cld.getDeleteProcedure(), obj, stmt);\r\n }\r\n catch (OptimisticLockException e)\r\n {\r\n // Don't log as error\r\n if (logger.isDebugEnabled())\r\n logger.debug(\"OptimisticLockException during the execution of delete: \"\r\n + e.getMessage(), e);\r\n throw e;\r\n }\r\n catch (PersistenceBrokerException e)\r\n {\r\n logger.error(\"PersistenceBrokerException during the execution of delete: \"\r\n + e.getMessage(), e);\r\n throw e;\r\n }\r\n catch (SQLException e)\r\n {\r\n final String sql = broker.serviceSqlGenerator().getPreparedDeleteStatement(cld).getStatement();\r\n throw ExceptionHelper.generateException(e, sql, cld, logger, obj);\r\n }\r\n finally\r\n {\r\n sm.closeResources(stmt, null);\r\n }\r\n }", "private void handleDmrString(final ModelNode node, final String name, final String value) {\n final String realValue = value.substring(2);\n node.get(name).set(ModelNode.fromString(realValue));\n }" ]
Determines whether a project has the specified publisher type, wrapped by the "Flexible Publish" publisher. @param project The project @param type The type of the publisher @return true if the project contains a publisher of the specified type wrapped by the "Flexible Publish" publisher.
[ "public boolean isPublisherWrapped(AbstractProject<?, ?> project, Class<T> type) {\n return find(project, type) != null;\n }" ]
[ "public static GridLabelFormat fromConfig(final GridParam param) {\n if (param.labelFormat != null) {\n return new GridLabelFormat.Simple(param.labelFormat);\n } else if (param.valueFormat != null) {\n return new GridLabelFormat.Detailed(\n param.valueFormat, param.unitFormat,\n param.formatDecimalSeparator, param.formatGroupingSeparator);\n }\n return null;\n }", "public static base_response create(nitro_service client, sslfipskey resource) throws Exception {\n\t\tsslfipskey createresource = new sslfipskey();\n\t\tcreateresource.fipskeyname = resource.fipskeyname;\n\t\tcreateresource.modulus = resource.modulus;\n\t\tcreateresource.exponent = resource.exponent;\n\t\treturn createresource.perform_operation(client,\"create\");\n\t}", "public Collection<Photocount> getCounts(Date[] dates, Date[] takenDates) throws FlickrException {\r\n List<Photocount> photocounts = new ArrayList<Photocount>();\r\n\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_COUNTS);\r\n\r\n if (dates == null && takenDates == null) {\r\n throw new IllegalArgumentException(\"You must provide a value for either dates or takenDates\");\r\n }\r\n\r\n if (dates != null) {\r\n List<String> dateList = new ArrayList<String>();\r\n for (int i = 0; i < dates.length; i++) {\r\n dateList.add(String.valueOf(dates[i].getTime() / 1000L));\r\n }\r\n parameters.put(\"dates\", StringUtilities.join(dateList, \",\"));\r\n }\r\n\r\n if (takenDates != null) {\r\n List<String> takenDateList = new ArrayList<String>();\r\n for (int i = 0; i < takenDates.length; i++) {\r\n takenDateList.add(String.valueOf(takenDates[i].getTime() / 1000L));\r\n }\r\n parameters.put(\"taken_dates\", StringUtilities.join(takenDateList, \",\"));\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 photocountsElement = response.getPayload();\r\n NodeList photocountNodes = photocountsElement.getElementsByTagName(\"photocount\");\r\n for (int i = 0; i < photocountNodes.getLength(); i++) {\r\n Element photocountElement = (Element) photocountNodes.item(i);\r\n Photocount photocount = new Photocount();\r\n photocount.setCount(photocountElement.getAttribute(\"count\"));\r\n photocount.setFromDate(photocountElement.getAttribute(\"fromdate\"));\r\n photocount.setToDate(photocountElement.getAttribute(\"todate\"));\r\n photocounts.add(photocount);\r\n }\r\n return photocounts;\r\n }", "private List<TaskField> getAllTaskExtendedAttributes()\n {\n ArrayList<TaskField> result = new ArrayList<TaskField>();\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_TEXT));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_START));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_FINISH));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_COST));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_DATE));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_FLAG));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_NUMBER));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_DURATION));\n result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_OUTLINE_CODE));\n result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_COST));\n result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_DATE));\n result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_DURATION));\n result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_FLAG));\n result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_NUMBER));\n result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_TEXT));\n return result;\n }", "public Sequence compile( String equation , boolean assignment, boolean debug ) {\n\n functions.setManagerTemp(managerTemp);\n\n Sequence sequence = new Sequence();\n TokenList tokens = extractTokens(equation,managerTemp);\n\n if( tokens.size() < 3 )\n throw new RuntimeException(\"Too few tokens\");\n\n TokenList.Token t0 = tokens.getFirst();\n\n if( t0.word != null && t0.word.compareToIgnoreCase(\"macro\") == 0 ) {\n parseMacro(tokens,sequence);\n } else {\n insertFunctionsAndVariables(tokens);\n insertMacros(tokens);\n if (debug) {\n System.out.println(\"Parsed tokens:\\n------------\");\n tokens.print();\n System.out.println();\n }\n\n // Get the results variable\n if (t0.getType() != Type.VARIABLE && t0.getType() != Type.WORD) {\n compileTokens(sequence,tokens);\n // If there's no output then this is acceptable, otherwise it's assumed to be a bug\n // If there's no output then a configuration was changed\n Variable variable = tokens.getFirst().getVariable();\n if( variable != null ) {\n if( assignment )\n throw new IllegalArgumentException(\"No assignment to an output variable could be found. Found \" + t0);\n else {\n sequence.output = variable; // set this to be the output for print()\n }\n }\n\n } else {\n compileAssignment(sequence, tokens, t0);\n }\n\n if (debug) {\n System.out.println(\"Operations:\\n------------\");\n for (int i = 0; i < sequence.operations.size(); i++) {\n System.out.println(sequence.operations.get(i).name());\n }\n }\n }\n\n return sequence;\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 Object newInstance(String className) throws InstantiationException,\r\n IllegalAccessException,\r\n ClassNotFoundException\r\n {\r\n return newInstance(getClass(className));\r\n }", "public static Type getCanonicalType(Class<?> clazz) {\n if (clazz.isArray()) {\n Class<?> componentType = clazz.getComponentType();\n Type resolvedComponentType = getCanonicalType(componentType);\n if (componentType != resolvedComponentType) {\n // identity check intentional\n // a different identity means that we actually replaced the component Class with a ParameterizedType\n return new GenericArrayTypeImpl(resolvedComponentType);\n }\n }\n if (clazz.getTypeParameters().length > 0) {\n Type[] actualTypeParameters = clazz.getTypeParameters();\n return new ParameterizedTypeImpl(clazz, actualTypeParameters, clazz.getDeclaringClass());\n }\n return clazz;\n }", "void checkRmModelConformance() {\n final AmVisitor<AmObject, AmConstraintContext> visitor = AmVisitors.preorder(new ConformanceVisitor());\n ArchetypeWalker.walkConstraints(visitor, archetype, new AmConstraintContext());\n }" ]
compute Sinh using Taylor Series. @param x An angle, in radians. @param nTerms Number of terms. @return Result.
[ "public static double Sinh(double x, int nTerms) {\r\n if (nTerms < 2) return x;\r\n if (nTerms == 2) {\r\n return x + (x * x * x) / 6D;\r\n } else {\r\n\r\n double mult = x * x * x;\r\n double fact = 6;\r\n int factS = 5;\r\n double result = x + mult / fact;\r\n for (int i = 3; i <= nTerms; i++) {\r\n mult *= x * x;\r\n fact *= factS * (factS - 1);\r\n factS += 2;\r\n result += mult / fact;\r\n }\r\n\r\n return result;\r\n }\r\n }" ]
[ "public WebSocketContext sendJsonToUser(Object data, String username) {\n return sendToTagged(JSON.toJSONString(data), username);\n }", "public void build(Point3d[] points, int nump) throws IllegalArgumentException {\n if (nump < 4) {\n throw new IllegalArgumentException(\"Less than four input points specified\");\n }\n if (points.length < nump) {\n throw new IllegalArgumentException(\"Point array too small for specified number of points\");\n }\n initBuffers(nump);\n setPoints(points, nump);\n buildHull();\n }", "public 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 static void transformChar(Reader self, Writer writer, @ClosureParams(value=SimpleType.class, options=\"java.lang.String\") Closure closure) throws IOException {\n int c;\n try {\n char[] chars = new char[1];\n while ((c = self.read()) != -1) {\n chars[0] = (char) c;\n writer.write((String) closure.call(new String(chars)));\n }\n writer.flush();\n\n Writer temp2 = writer;\n writer = null;\n temp2.close();\n Reader temp1 = self;\n self = null;\n temp1.close();\n } finally {\n closeWithWarning(self);\n closeWithWarning(writer);\n }\n }", "public void processAnonymousReference(Properties attributes) throws XDocletException\r\n {\r\n ReferenceDescriptorDef refDef = _curClassDef.getReference(\"super\");\r\n String attrName;\r\n\r\n if (refDef == null)\r\n {\r\n refDef = new ReferenceDescriptorDef(\"super\");\r\n _curClassDef.addReference(refDef);\r\n }\r\n refDef.setAnonymous();\r\n LogHelper.debug(false, OjbTagsHandler.class, \"processAnonymousReference\", \" Processing anonymous reference\");\r\n\r\n for (Enumeration attrNames = attributes.propertyNames(); attrNames.hasMoreElements(); )\r\n {\r\n attrName = (String)attrNames.nextElement();\r\n refDef.setProperty(attrName, attributes.getProperty(attrName));\r\n }\r\n }", "protected List splitInCriteria(Object attribute, Collection values, boolean negative, int inLimit)\r\n {\r\n List result = new ArrayList();\r\n Collection inCollection = new ArrayList();\r\n\r\n if (values == null || values.isEmpty())\r\n {\r\n // OQL creates empty Criteria for late binding\r\n result.add(buildInCriteria(attribute, negative, values));\r\n }\r\n else\r\n {\r\n Iterator iter = values.iterator();\r\n\r\n while (iter.hasNext())\r\n {\r\n inCollection.add(iter.next());\r\n if (inCollection.size() == inLimit || !iter.hasNext())\r\n {\r\n result.add(buildInCriteria(attribute, negative, inCollection));\r\n inCollection = new ArrayList();\r\n }\r\n }\r\n }\r\n return result;\r\n }", "public boolean getHidden() throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_HIDDEN);\r\n\r\n Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n\r\n Element personElement = response.getPayload();\r\n return personElement.getAttribute(\"hidden\").equals(\"1\") ? true : false;\r\n }", "protected List<String> parseOptionalStringValues(final String path) {\n\n final List<I_CmsXmlContentValue> values = m_xml.getValues(path, m_locale);\n if (values == null) {\n return null;\n } else {\n List<String> stringValues = new ArrayList<String>(values.size());\n for (I_CmsXmlContentValue value : values) {\n stringValues.add(value.getStringValue(null));\n }\n return stringValues;\n }\n }", "private void logError(LifecycleListener listener, Exception e) {\n LOGGER.error(\"Error for listener \" + listener.getClass(), e);\n }" ]
Add a resource assignment which has been populated elsewhere. @param assignment resource assignment
[ "public void addResourceAssignment(ResourceAssignment assignment)\n {\n if (getExistingResourceAssignment(assignment.getResource()) == null)\n {\n m_assignments.add(assignment);\n getParentFile().getResourceAssignments().add(assignment);\n\n Resource resource = assignment.getResource();\n if (resource != null)\n {\n resource.addResourceAssignment(assignment);\n }\n }\n }" ]
[ "public void remove(RowKey key) {\n\t\tcurrentState.put( key, new AssociationOperation( key, null, REMOVE ) );\n\t}", "public static boolean isFileExist(String filePath) {\n\n File f = new File(filePath);\n\n return f.exists() && !f.isDirectory();\n }", "public ProjectCalendarException addCalendarException(Date fromDate, Date toDate)\n {\n ProjectCalendarException bce = new ProjectCalendarException(fromDate, toDate);\n m_exceptions.add(bce);\n m_expandedExceptions.clear();\n m_exceptionsSorted = false;\n clearWorkingDateCache();\n return bce;\n }", "public final void notifyHeaderItemRangeInserted(int positionStart, int itemCount) {\n int newHeaderItemCount = getHeaderItemCount();\n if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > newHeaderItemCount) {\n throw new IndexOutOfBoundsException(\"The given range [\" + positionStart + \" - \" + (positionStart + itemCount - 1) + \"] is not within the position bounds for header items [0 - \" + (newHeaderItemCount - 1) + \"].\");\n }\n notifyItemRangeInserted(positionStart, itemCount);\n }", "@RequestMapping(value = \"api/edit/repeatNumber\", method = RequestMethod.POST)\n public\n @ResponseBody\n String updateRepeatNumber(Model model, int newNum, int path_id,\n @RequestParam(defaultValue = Constants.PROFILE_CLIENT_DEFAULT_ID) String clientUUID) throws Exception {\n logger.info(\"want to update repeat number of path_id={}, to newNum={}\", path_id, newNum);\n editService.updateRepeatNumber(newNum, path_id, clientUUID);\n return null;\n }", "public static <T extends WindupVertexFrame> WindupVertexFrame removeTypeFromModel(GraphContext graphContext, WindupVertexFrame frame, Class<T> type)\n {\n Vertex vertex = frame.getElement();\n graphContext.getGraphTypeManager().removeTypeFromElement(type, vertex);\n return graphContext.getFramed().frameElement(vertex, WindupVertexFrame.class);\n }", "private Integer getKeyPartitionId(byte[] key) {\n Integer keyPartitionId = storeInstance.getNodesPartitionIdForKey(nodeId, key);\n\n Utils.notNull(keyPartitionId);\n return keyPartitionId;\n }", "public ApiResponse<TokenInfoSuccessResponse> tokenInfoWithHttpInfo() throws ApiException {\n com.squareup.okhttp.Call call = tokenInfoValidateBeforeCall(null, null);\n Type localVarReturnType = new TypeToken<TokenInfoSuccessResponse>(){}.getType();\n return apiClient.execute(call, localVarReturnType);\n }", "private double convertTenor(int maturityInMonths, int tenorInMonths) {\r\n\t\tSchedule schedule = fixMetaSchedule.generateSchedule(referenceDate, maturityInMonths, tenorInMonths);\r\n\t\treturn schedule.getPayment(schedule.getNumberOfPeriods()-1);\r\n\t}" ]
Flush the in-memory data to the file
[ "private synchronized void flushData() {\n BufferedWriter writer = null;\n try {\n writer = new BufferedWriter(new FileWriter(new File(this.inputPath)));\n for(String key: this.metadataMap.keySet()) {\n writer.write(NEW_PROPERTY_SEPARATOR + key.toString() + \"]\" + NEW_LINE);\n writer.write(this.metadataMap.get(key).toString());\n writer.write(\"\" + NEW_LINE + \"\" + NEW_LINE);\n }\n writer.flush();\n } catch(IOException e) {\n logger.error(\"IO exception while flushing data to file backed storage: \"\n + e.getMessage());\n }\n\n try {\n if(writer != null)\n writer.close();\n } catch(Exception e) {\n logger.error(\"Error while flushing data to file backed storage: \" + e.getMessage());\n }\n }" ]
[ "public @Nullable ChangeEvent<BsonDocument> getUnprocessedEventForDocumentId(\n final BsonValue documentId\n ) {\n final ChangeEvent<BsonDocument> event;\n nsLock.readLock().lock();\n try {\n event = this.events.get(documentId);\n } finally {\n nsLock.readLock().unlock();\n }\n\n nsLock.writeLock().lock();\n try {\n this.events.remove(documentId);\n return event;\n } finally {\n nsLock.writeLock().unlock();\n }\n }", "public void setWorkingDay(Day day, boolean working)\n {\n setWorkingDay(day, (working ? DayType.WORKING : DayType.NON_WORKING));\n }", "@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoLocalDateTime<CopticDate> localDateTime(TemporalAccessor temporal) {\n return (ChronoLocalDateTime<CopticDate>) super.localDateTime(temporal);\n }", "public Set<String> getConfiguredWorkplaceBundles() {\n\n CmsADEConfigData configData = internalLookupConfiguration(null, null);\n return configData.getConfiguredWorkplaceBundles();\n }", "private void processAssignments() throws SQLException\n {\n List<Row> rows = getRows(\"select * from zscheduleitem where zproject=? and z_ent=? order by zorderinactivity\", m_projectID, m_entityMap.get(\"Assignment\"));\n for (Row row : rows)\n {\n Task task = m_project.getTaskByUniqueID(row.getInteger(\"ZACTIVITY_\"));\n Resource resource = m_project.getResourceByUniqueID(row.getInteger(\"ZRESOURCE\"));\n if (task != null && resource != null)\n {\n ResourceAssignment assignment = task.addResourceAssignment(resource);\n assignment.setGUID(row.getUUID(\"ZUNIQUEID\"));\n assignment.setActualFinish(row.getTimestamp(\"ZGIVENACTUALENDDATE_\"));\n assignment.setActualStart(row.getTimestamp(\"ZGIVENACTUALSTARTDATE_\"));\n\n assignment.setWork(assignmentDuration(task, row.getWork(\"ZGIVENWORK_\")));\n assignment.setOvertimeWork(assignmentDuration(task, row.getWork(\"ZGIVENWORKOVERTIME_\")));\n assignment.setActualWork(assignmentDuration(task, row.getWork(\"ZGIVENACTUALWORK_\")));\n assignment.setActualOvertimeWork(assignmentDuration(task, row.getWork(\"ZGIVENACTUALWORKOVERTIME_\")));\n assignment.setRemainingWork(assignmentDuration(task, row.getWork(\"ZGIVENREMAININGWORK_\")));\n\n assignment.setLevelingDelay(row.getDuration(\"ZLEVELINGDELAY_\"));\n\n if (assignment.getRemainingWork() == null)\n {\n assignment.setRemainingWork(assignment.getWork());\n }\n\n if (resource.getType() == ResourceType.WORK)\n {\n assignment.setUnits(Double.valueOf(NumberHelper.getDouble(row.getDouble(\"ZRESOURCEUNITS_\")) * 100.0));\n }\n }\n }\n }", "private Revision uncachedHeadRevision() {\n try (RevWalk revWalk = new RevWalk(jGitRepository)) {\n final ObjectId headRevisionId = jGitRepository.resolve(R_HEADS_MASTER);\n if (headRevisionId != null) {\n final RevCommit revCommit = revWalk.parseCommit(headRevisionId);\n return CommitUtil.extractRevision(revCommit.getFullMessage());\n }\n } catch (CentralDogmaException e) {\n throw e;\n } catch (Exception e) {\n throw new StorageException(\"failed to get the current revision\", e);\n }\n\n throw new StorageException(\"failed to determine the HEAD: \" + jGitRepository.getDirectory());\n }", "public void delete() {\n URL url = STORAGE_POLICY_ASSIGNMENT_WITH_ID_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, HttpMethod.DELETE);\n\n request.send();\n }", "static String encodeUriComponent(String source, String encoding, Type type) throws UnsupportedEncodingException {\n\t\tif (source == null) {\n\t\t\treturn null;\n\t\t}\n\t\tAssert.hasLength(encoding, \"Encoding must not be empty\");\n\t\tbyte[] bytes = encodeBytes(source.getBytes(encoding), type);\n\t\treturn new String(bytes, \"US-ASCII\");\n\t}", "public static Object findResult(Object self, Object defaultResult, Closure closure) {\n Object result = findResult(self, closure);\n if (result == null) return defaultResult;\n return result;\n }" ]
Revisit message to set their item ref to a item definition @param def Definitions
[ "private void revisitMessages(Definitions def) {\n List<RootElement> rootElements = def.getRootElements();\n List<ItemDefinition> toAddDefinitions = new ArrayList<ItemDefinition>();\n for (RootElement root : rootElements) {\n if (root instanceof Message) {\n if (!existsMessageItemDefinition(rootElements,\n root.getId())) {\n ItemDefinition itemdef = Bpmn2Factory.eINSTANCE.createItemDefinition();\n itemdef.setId(root.getId() + \"Type\");\n toAddDefinitions.add(itemdef);\n ((Message) root).setItemRef(itemdef);\n }\n }\n }\n for (ItemDefinition id : toAddDefinitions) {\n def.getRootElements().add(id);\n }\n }" ]
[ "public static final Rect getViewportBounds() {\n return new Rect(Window.getScrollLeft(), Window.getScrollTop(), Window.getClientWidth(), Window.getClientHeight());\n }", "public static final BigDecimal printCurrency(Number value)\n {\n return (value == null || value.doubleValue() == 0 ? null : new BigDecimal(value.doubleValue() * 100));\n }", "private void deliverMediaDetailsUpdate(final MediaDetails details) {\n for (MediaDetailsListener listener : getMediaDetailsListeners()) {\n try {\n listener.detailsAvailable(details);\n } catch (Throwable t) {\n logger.warn(\"Problem delivering media details response to listener\", t);\n }\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 static void log(String label, String data)\n {\n if (LOG != null)\n {\n LOG.write(label);\n LOG.write(\": \");\n LOG.println(data);\n LOG.flush();\n }\n }", "public double getBearing(LatLong end) {\n if (this.equals(end)) {\n return 0;\n }\n\n double lat1 = latToRadians();\n double lon1 = longToRadians();\n double lat2 = end.latToRadians();\n double lon2 = end.longToRadians();\n\n double angle = -Math.atan2(Math.sin(lon1 - lon2) * Math.cos(lat2),\n Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1)\n * Math.cos(lat2) * Math.cos(lon1 - lon2));\n\n if (angle < 0.0) {\n angle += Math.PI * 2.0;\n }\n if (angle > Math.PI) {\n angle -= Math.PI * 2.0;\n }\n\n return Math.toDegrees(angle);\n }", "private static long hexdump(InputStream is, PrintWriter pw) throws Exception\n {\n byte[] buffer = new byte[BUFFER_SIZE];\n long byteCount = 0;\n\n char c;\n int loop;\n int count;\n StringBuilder sb = new StringBuilder();\n\n while (true)\n {\n count = is.read(buffer);\n if (count == -1)\n {\n break;\n }\n\n byteCount += count;\n\n sb.setLength(0);\n\n for (loop = 0; loop < count; loop++)\n {\n sb.append(\" \");\n sb.append(HEX_DIGITS[(buffer[loop] & 0xF0) >> 4]);\n sb.append(HEX_DIGITS[buffer[loop] & 0x0F]);\n }\n\n while (loop < BUFFER_SIZE)\n {\n sb.append(\" \");\n ++loop;\n }\n\n sb.append(\" \");\n\n for (loop = 0; loop < count; loop++)\n {\n c = (char) buffer[loop];\n if (c > 200 || c < 27)\n {\n c = ' ';\n }\n\n sb.append(c);\n }\n\n pw.println(sb.toString());\n }\n\n return (byteCount);\n }", "public List<GVRAtlasInformation> getAtlasInformation()\n {\n if ((mImage != null) && (mImage instanceof GVRImageAtlas))\n {\n return ((GVRImageAtlas) mImage).getAtlasInformation();\n }\n return null;\n }", "public void addWord(MtasCQLParserWordFullCondition w) throws ParseException {\n assert w.getCondition()\n .not() == false : \"condition word should be positive in sentence definition\";\n if (!simplified) {\n partList.add(w);\n } else {\n throw new ParseException(\"already simplified\");\n }\n }" ]
The normalized string returned by this method is consistent with java.net.Inet6address. IPs are not compressed nor mixed in this representation. If this has a prefix length, that will be included in the string.
[ "@Override\n\tpublic String toNormalizedString() {\n\t\tString result;\n\t\tif(hasNoStringCache() || (result = stringCache.normalizedString) == null) {\n\t\t\tif(hasZone()) {\n\t\t\t\tstringCache.normalizedString = result = toNormalizedString(IPv6StringCache.normalizedParams);\n\t\t\t} else {\n\t\t\t\tresult = getSection().toNormalizedString();//the cache is shared so no need to update it here\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}" ]
[ "public GVRRenderData setDrawMode(int drawMode) {\n if (drawMode != GL_POINTS && drawMode != GL_LINES\n && drawMode != GL_LINE_STRIP && drawMode != GL_LINE_LOOP\n && drawMode != GL_TRIANGLES && drawMode != GL_TRIANGLE_STRIP\n && drawMode != GL_TRIANGLE_FAN) {\n throw new IllegalArgumentException(\n \"drawMode must be one of GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLES, GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP.\");\n }\n NativeRenderData.setDrawMode(getNative(), drawMode);\n return this;\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 final void debug(Object pObject)\r\n\t{\r\n\t\tgetLogger().log(FQCN, Level.DEBUG, pObject, null);\r\n\t}", "public void performImplicitDoubleStep(int x1, int x2 , double real , double img ) {\n double a11 = A.get(x1,x1);\n double a21 = A.get(x1+1,x1);\n double a12 = A.get(x1,x1+1);\n double a22 = A.get(x1+1,x1+1);\n double a32 = A.get(x1+2,x1+1);\n\n double p_plus_t = 2.0*real;\n double p_times_t = real*real + img*img;\n\n double b11,b21,b31;\n if( useStandardEq ) {\n b11 = (a11*a11 - p_plus_t*a11+p_times_t)/a21 + a12;\n b21 = a11+a22-p_plus_t;\n b31 = a32;\n } else {\n // this is different from the version in the book and seems in my testing to be more resilient to\n // over flow issues\n b11 = (a11*a11 - p_plus_t*a11+p_times_t) + a12*a21;\n b21 = (a11+a22-p_plus_t)*a21;\n b31 = a32*a21;\n }\n\n performImplicitDoubleStep(x1, x2, b11, b21, b31);\n }", "public static base_response kill(nitro_service client, systemsession resource) throws Exception {\n\t\tsystemsession killresource = new systemsession();\n\t\tkillresource.sid = resource.sid;\n\t\tkillresource.all = resource.all;\n\t\treturn killresource.perform_operation(client,\"kill\");\n\t}", "public void cross(Vector3d v1, Vector3d v2) {\n double tmpx = v1.y * v2.z - v1.z * v2.y;\n double tmpy = v1.z * v2.x - v1.x * v2.z;\n double tmpz = v1.x * v2.y - v1.y * v2.x;\n\n x = tmpx;\n y = tmpy;\n z = tmpz;\n }", "private int getLiteralId(String literal) throws PersistenceBrokerException\r\n {\r\n ////logger.debug(\"lookup: \" + literal);\r\n try\r\n {\r\n return tags.getIdByTag(literal);\r\n }\r\n catch (NullPointerException t)\r\n {\r\n throw new MetadataException(\"unknown literal: '\" + literal + \"'\",t);\r\n }\r\n\r\n }", "private void disableCertificateVerification()\n throws KeyManagementException, NoSuchAlgorithmException {\n // Create a trust manager that does not validate certificate chains\n final TrustManager[] trustAllCerts = new TrustManager[] { new CustomTrustManager() };\n\n // Install the all-trusting trust manager\n final SSLContext sslContext = SSLContext.getInstance(\"SSL\");\n sslContext.init(null, trustAllCerts, new SecureRandom());\n final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();\n HttpsURLConnection.setDefaultSSLSocketFactory(sslSocketFactory);\n final HostnameVerifier verifier = new HostnameVerifier() {\n @Override\n public boolean verify(final String hostname,\n final SSLSession session) {\n return true;\n }\n };\n\n HttpsURLConnection.setDefaultHostnameVerifier(verifier);\n }", "public String validationErrors() {\n\n List<String> errors = new ArrayList<>();\n for (File config : getConfigFiles()) {\n String filename = config.getName();\n try (FileInputStream stream = new FileInputStream(config)) {\n CmsXmlUtils.unmarshalHelper(CmsFileUtil.readFully(stream, false), new CmsXmlEntityResolver(null), true);\n } catch (CmsXmlException e) {\n errors.add(filename + \":\" + e.getCause().getMessage());\n } catch (Exception e) {\n errors.add(filename + \":\" + e.getMessage());\n }\n }\n if (errors.size() == 0) {\n return null;\n }\n String errString = CmsStringUtil.listAsString(errors, \"\\n\");\n JSONObject obj = new JSONObject();\n try {\n obj.put(\"err\", errString);\n } catch (JSONException e) {\n\n }\n return obj.toString();\n }" ]
Check, if the resource should be exported with minimal meta-data. This holds for resources that are not part of the export, but must be exported as super-folders. @param path export-site relative path of the resource to check. @return flag, indicating if the resource should be exported with minimal meta data.
[ "protected boolean exportWithMinimalMetaData(String path) {\n\n String checkPath = path.startsWith(\"/\") ? path + \"/\" : \"/\" + path + \"/\";\n for (String p : m_parameters.getResourcesToExportWithMetaData()) {\n if (checkPath.startsWith(p)) {\n return false;\n }\n }\n return true;\n }" ]
[ "public Map<String, Attribute> getAttributes() {\n Map<String, Attribute> result = new HashMap<>();\n DataSourceAttribute datasourceAttribute = new DataSourceAttribute();\n Map<String, Attribute> dsResult = new HashMap<>();\n dsResult.put(MAP_KEY, this.mapAttribute);\n datasourceAttribute.setAttributes(dsResult);\n result.put(\"datasource\", datasourceAttribute);\n return result;\n }", "@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoLocalDateTime<Symmetry010Date> localDateTime(TemporalAccessor temporal) {\n return (ChronoLocalDateTime<Symmetry010Date>) super.localDateTime(temporal);\n }", "public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context) {\n return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, null);\n }", "public TransformersSubRegistration getHostRegistration(final ModelVersionRange range) {\n final PathAddress address = PathAddress.EMPTY_ADDRESS.append(HOST);\n return new TransformersSubRegistrationImpl(range, domain, address);\n }", "public static int serialize(OutputStream stream, Object obj) {\n ObjectMapper mapper = createMapperWithJaxbAnnotationInspector();\n\n try (DataOutputStream data = new DataOutputStream(stream);\n OutputStreamWriter writer = new OutputStreamWriter(data, StandardCharsets.UTF_8)) {\n mapper.writerWithDefaultPrettyPrinter().writeValue(writer, obj);\n return data.size();\n } catch (IOException e) {\n throw new ReportGenerationException(e);\n }\n }", "public GVRCursorController findCursorController(GVRControllerType type) {\n for (int index = 0, size = cache.size(); index < size; index++)\n {\n int key = cache.keyAt(index);\n GVRCursorController controller = cache.get(key);\n if (controller.getControllerType().equals(type)) {\n return controller;\n }\n }\n return null;\n }", "public void stop()\n {\n if (mAudioListener != null)\n {\n Log.d(\"SOUND\", \"stopping audio source %d %s\", getSourceId(), getSoundFile());\n mAudioListener.getAudioEngine().stopSound(getSourceId());\n }\n }", "@Override\n protected void checkType() {\n if (!isDependent() && getEnhancedAnnotated().isParameterizedType()) {\n throw BeanLogger.LOG.managedBeanWithParameterizedBeanClassMustBeDependent(type);\n }\n boolean passivating = beanManager.isPassivatingScope(getScope());\n if (passivating && !isPassivationCapableBean()) {\n if (!getEnhancedAnnotated().isSerializable()) {\n throw BeanLogger.LOG.passivatingBeanNeedsSerializableImpl(this);\n } else if (hasDecorators() && !allDecoratorsArePassivationCapable()) {\n throw BeanLogger.LOG.passivatingBeanHasNonPassivationCapableDecorator(this, getFirstNonPassivationCapableDecorator());\n } else if (hasInterceptors() && !allInterceptorsArePassivationCapable()) {\n throw BeanLogger.LOG.passivatingBeanHasNonPassivationCapableInterceptor(this, getFirstNonPassivationCapableInterceptor());\n }\n }\n }", "public Float getFloat(String fieldName) {\n\t\ttry {\n\t\t\treturn hasValue(fieldName) ? Float.valueOf(String.valueOf(resultMap.get(fieldName))) : null;\n\t\t} catch (NumberFormatException e) {\n\t\t\tthrow new FqlException(\"Field '\" + fieldName +\"' is not a number.\", e);\n\t\t}\n\t}" ]
Loads the configuration file, using CmsVfsMemoryObjectCache for caching. @param cms the CMS context @return the template mapper configuration
[ "private CmsTemplateMapperConfiguration getConfiguration(final CmsObject cms) {\n\n if (!m_enabled) {\n return CmsTemplateMapperConfiguration.EMPTY_CONFIG;\n }\n\n if (m_configPath == null) {\n m_configPath = OpenCms.getSystemInfo().getConfigFilePath(cms, \"template-mapping.xml\");\n }\n\n return (CmsTemplateMapperConfiguration)(CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().loadVfsObject(\n cms,\n m_configPath,\n new Transformer() {\n\n @Override\n public Object transform(Object input) {\n\n try {\n CmsFile file = cms.readFile(m_configPath, CmsResourceFilter.IGNORE_EXPIRATION);\n SAXReader saxBuilder = new SAXReader();\n try (ByteArrayInputStream stream = new ByteArrayInputStream(file.getContents())) {\n Document document = saxBuilder.read(stream);\n CmsTemplateMapperConfiguration config = new CmsTemplateMapperConfiguration(cms, document);\n return config;\n }\n } catch (Exception e) {\n LOG.warn(e.getLocalizedMessage(), e);\n return new CmsTemplateMapperConfiguration(); // empty configuration, does not do anything\n }\n\n }\n }));\n }" ]
[ "public static URI createRestURI(\n final String matrixId, final int row, final int col,\n final WMTSLayerParam layerParam) throws URISyntaxException {\n String path = layerParam.baseURL;\n if (layerParam.dimensions != null) {\n for (int i = 0; i < layerParam.dimensions.length; i++) {\n String dimension = layerParam.dimensions[i];\n String value = layerParam.dimensionParams.optString(dimension);\n if (value == null) {\n value = layerParam.dimensionParams.getString(dimension.toUpperCase());\n }\n path = path.replace(\"{\" + dimension + \"}\", value);\n }\n }\n path = path.replace(\"{TileMatrixSet}\", layerParam.matrixSet);\n path = path.replace(\"{TileMatrix}\", matrixId);\n path = path.replace(\"{TileRow}\", String.valueOf(row));\n path = path.replace(\"{TileCol}\", String.valueOf(col));\n path = path.replace(\"{style}\", layerParam.style);\n path = path.replace(\"{Layer}\", layerParam.layer);\n\n return new URI(path);\n }", "public 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 }", "@Deprecated\n public void parseAndSetParameter(String value, ModelNode operation, XMLStreamReader reader) throws XMLStreamException {\n //we use manual parsing here, and not #getParser().. to preserve backward compatibility.\n if (value != null) {\n for (String element : value.split(\",\")) {\n parseAndAddParameterElement(element.trim(), operation, reader);\n }\n }\n }", "public String putDocument(Document document) {\n\t\tString key = UUID.randomUUID().toString();\n\t\tdocumentMap.put(key, document);\n\t\treturn key;\n\t}", "public void alias( double value , String name ) {\n if( isReserved(name))\n throw new RuntimeException(\"Reserved word or contains a reserved character. '\"+name+\"'\");\n\n VariableDouble old = (VariableDouble)variables.get(name);\n if( old == null ) {\n variables.put(name, new VariableDouble(value));\n }else {\n old.value = value;\n }\n }", "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 static File createDir(String dir) {\n // create outdir\n File directory = null;\n if(dir != null) {\n directory = new File(dir);\n if(!(directory.exists() || directory.mkdir())) {\n Utils.croak(\"Can't find or create directory \" + dir);\n }\n }\n return directory;\n }", "public static ServiceName moduleSpecServiceName(ModuleIdentifier identifier) {\n if (!isDynamicModule(identifier)) {\n throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX);\n }\n return MODULE_SPEC_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot());\n }", "public final PJsonObject optJSONObject(final String key) {\n final JSONObject val = this.obj.optJSONObject(key);\n return val != null ? new PJsonObject(this, val, key) : null;\n }" ]
Use this API to unset the properties of filterhtmlinjectionparameter resource. Properties that need to be unset are specified in args array.
[ "public static base_response unset(nitro_service client, filterhtmlinjectionparameter resource, String[] args) throws Exception{\n\t\tfilterhtmlinjectionparameter unsetresource = new filterhtmlinjectionparameter();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}" ]
[ "public void setDay(Day d)\n {\n if (m_day != null)\n {\n m_parentCalendar.removeHoursFromDay(this);\n }\n\n m_day = d;\n\n m_parentCalendar.attachHoursToDay(this);\n }", "private static boolean containsGreekLetter(String s) {\r\n Matcher m = biogreek.matcher(s);\r\n return m.find();\r\n }", "@SuppressWarnings({\"unused\", \"WeakerAccess\"})\n public int getInboxMessageUnreadCount(){\n synchronized (inboxControllerLock) {\n if (this.ctInboxController != null) {\n return ctInboxController.unreadCount();\n } else {\n getConfigLogger().debug(getAccountId(), \"Notification Inbox not initialized\");\n return -1;\n }\n }\n }", "public void parseVersion( String version )\n {\n DefaultVersioning artifactVersion = new DefaultVersioning( version );\n\n getLog().debug( \"Parsed Version\" );\n getLog().debug( \" major: \" + artifactVersion.getMajor() );\n getLog().debug( \" minor: \" + artifactVersion.getMinor() );\n getLog().debug( \" incremental: \" + artifactVersion.getPatch() );\n getLog().debug( \" buildnumber: \" + artifactVersion.getBuildNumber() );\n getLog().debug( \" qualifier: \" + artifactVersion.getQualifier() );\n\n defineVersionProperty( \"majorVersion\", artifactVersion.getMajor() );\n defineVersionProperty( \"minorVersion\", artifactVersion.getMinor() );\n defineVersionProperty( \"incrementalVersion\", artifactVersion.getPatch() );\n defineVersionProperty( \"buildNumber\", artifactVersion.getBuildNumber() );\n\n defineVersionProperty( \"nextMajorVersion\", artifactVersion.getMajor() + 1 );\n defineVersionProperty( \"nextMinorVersion\", artifactVersion.getMinor() + 1 );\n defineVersionProperty( \"nextIncrementalVersion\", artifactVersion.getPatch() + 1 );\n defineVersionProperty( \"nextBuildNumber\", artifactVersion.getBuildNumber() + 1 );\n\n defineFormattedVersionProperty( \"majorVersion\", String.format( formatMajor, artifactVersion.getMajor() ) );\n defineFormattedVersionProperty( \"minorVersion\", String.format( formatMinor, artifactVersion.getMinor() ) );\n defineFormattedVersionProperty( \"incrementalVersion\", String.format( formatIncremental, artifactVersion.getPatch() ) );\n defineFormattedVersionProperty( \"buildNumber\", String.format( formatBuildNumber, artifactVersion.getBuildNumber() ));\n\n defineFormattedVersionProperty( \"nextMajorVersion\", String.format( formatMajor, artifactVersion.getMajor() + 1 ));\n defineFormattedVersionProperty( \"nextMinorVersion\", String.format( formatMinor, artifactVersion.getMinor() + 1 ));\n defineFormattedVersionProperty( \"nextIncrementalVersion\", String.format( formatIncremental, artifactVersion.getPatch() + 1 ));\n defineFormattedVersionProperty( \"nextBuildNumber\", String.format( formatBuildNumber, artifactVersion.getBuildNumber() + 1 ));\n \n String osgi = artifactVersion.getAsOSGiVersion();\n\n String qualifier = artifactVersion.getQualifier();\n String qualifierQuestion = \"\";\n if ( qualifier == null )\n {\n qualifier = \"\";\n } else {\n qualifierQuestion = qualifierPrefix;\n }\n\n defineVersionProperty( \"qualifier\", qualifier );\n defineVersionProperty( \"qualifier?\", qualifierQuestion + qualifier );\n\n defineVersionProperty( \"osgiVersion\", osgi );\n }", "public static Trajectory combineTrajectory(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\tif(a.size()!=b.size()){\n\t\t\tthrow new IllegalArgumentException(\"Combination not possible: The trajectorys does not \"\n\t\t\t\t\t+ \"have the same number of steps a=\"+a.size() + \" b=\"+b.size());\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+b.get(i).x, \n\t\t\t\t\ta.get(i).y+b.get(i).y, \n\t\t\t\t\ta.get(i).z+b.get(i).z);\n\t\t\tc.add(pos);\n\t\t}\n\t\t\n\t\treturn c;\n\t}", "public static Resource getSetupPage(I_SetupUiContext context, String name) {\n\n String path = CmsStringUtil.joinPaths(context.getSetupBean().getContextPath(), CmsSetupBean.FOLDER_SETUP, name);\n Resource resource = new ExternalResource(path);\n return resource;\n }", "protected boolean isFiltered(AbstractElement canddiate, Param param) {\n\t\tif (canddiate instanceof Group) {\n\t\t\tGroup group = (Group) canddiate;\n\t\t\tif (group.getGuardCondition() != null) {\n\t\t\t\tSet<Parameter> context = param.getAssignedParametes();\n\t\t\t\tConditionEvaluator evaluator = new ConditionEvaluator(context);\n\t\t\t\tif (!evaluator.evaluate(group.getGuardCondition())) {\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}", "public GVRAnimator findAnimation(String name)\n {\n for (GVRAnimator anim : mAnimations)\n {\n if (name.equals(anim.getName()))\n {\n return anim;\n }\n }\n return null;\n }", "public static tmtrafficpolicy_tmglobal_binding[] get(nitro_service service, String name) throws Exception{\n\t\ttmtrafficpolicy_tmglobal_binding obj = new tmtrafficpolicy_tmglobal_binding();\n\t\tobj.set_name(name);\n\t\ttmtrafficpolicy_tmglobal_binding response[] = (tmtrafficpolicy_tmglobal_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}" ]
Returns an empty map with expected size matching the iterable size if it's of type Collection. Otherwise, an empty map with the default size is returned.
[ "public static <K, V> HashMap<K, V> newEmptyHashMap(Iterable<?> iterable) {\n if(iterable instanceof Collection<?>)\n return Maps.newHashMapWithExpectedSize(((Collection<?>) iterable).size());\n return Maps.newHashMap();\n }" ]
[ "@SuppressWarnings(\"deprecation\")\n\tpublic static boolean dateTimeEquals(java.util.Date d1, java.util.Date d2) {\n if (d1 == null || d2 == null) {\n return false;\n }\n\n return d1.getDate() == d2.getDate()\n && d1.getMonth() == d2.getMonth()\n && d1.getYear() == d2.getYear()\n && d1.getHours() == d2.getHours()\n && d1.getMinutes() == d2.getMinutes()\n && d1.getSeconds() == d2.getSeconds();\n }", "public boolean getNumericBoolean(int field)\n {\n boolean result = false;\n\n if ((field < m_fields.length) && (m_fields[field].length() != 0))\n {\n result = Integer.parseInt(m_fields[field]) == 1;\n }\n\n return (result);\n }", "public static boolean isPunct(String s){\r\n Pattern p = Pattern.compile(\"^[\\\\p{Punct}]+$\");\r\n Matcher m = p.matcher(s);\r\n return m.matches();\r\n }", "public final void fatal(Object pObject)\r\n\t{\r\n\t\tgetLogger().log(FQCN, Level.FATAL, pObject, null);\r\n\t}", "public void put(String key, Object object, Envelope envelope) {\n\t\tindex.put(key, envelope);\n\t\tcache.put(key, object);\n\t}", "private String toResourceNameOnClasspath(String classPathRootOnDisk, File file) {\n String fileName = file.getAbsolutePath().replace(\"\\\\\", \"/\");\n return fileName.substring(classPathRootOnDisk.length());\n }", "public static Integer parseInteger(String value) throws ParseException\n {\n Integer result = null;\n\n if (value.length() > 0 && value.indexOf(' ') == -1)\n {\n if (value.indexOf('.') == -1)\n {\n result = Integer.valueOf(value);\n }\n else\n {\n Number n = DatatypeConverter.parseDouble(value);\n result = Integer.valueOf(n.intValue());\n }\n }\n\n return result;\n }", "public static String replaceAnyOf(String value, String chars,\n char replacement) {\n char[] tmp = new char[value.length()];\n int pos = 0;\n for (int ix = 0; ix < tmp.length; ix++) {\n char ch = value.charAt(ix);\n if (chars.indexOf(ch) != -1)\n tmp[pos++] = replacement;\n else\n tmp[pos++] = ch;\n }\n return new String(tmp, 0, tmp.length);\n }", "protected BoxWatermark applyWatermark(URLTemplate itemUrl, String imprint) {\n URL watermarkUrl = itemUrl.build(this.getAPI().getBaseURL(), this.getID());\n URL url = WATERMARK_URL_TEMPLATE.build(watermarkUrl.toString());\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, \"PUT\");\n JsonObject body = new JsonObject()\n .add(BoxWatermark.WATERMARK_JSON_KEY, new JsonObject()\n .add(BoxWatermark.WATERMARK_IMPRINT_JSON_KEY, imprint));\n request.setBody(body.toString());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n return new BoxWatermark(response.getJSON());\n }" ]
Prepare the baseURL to make a request. @param matrixId matrixId @param row row @param col cold @param layerParam layerParam
[ "public static URI createRestURI(\n final String matrixId, final int row, final int col,\n final WMTSLayerParam layerParam) throws URISyntaxException {\n String path = layerParam.baseURL;\n if (layerParam.dimensions != null) {\n for (int i = 0; i < layerParam.dimensions.length; i++) {\n String dimension = layerParam.dimensions[i];\n String value = layerParam.dimensionParams.optString(dimension);\n if (value == null) {\n value = layerParam.dimensionParams.getString(dimension.toUpperCase());\n }\n path = path.replace(\"{\" + dimension + \"}\", value);\n }\n }\n path = path.replace(\"{TileMatrixSet}\", layerParam.matrixSet);\n path = path.replace(\"{TileMatrix}\", matrixId);\n path = path.replace(\"{TileRow}\", String.valueOf(row));\n path = path.replace(\"{TileCol}\", String.valueOf(col));\n path = path.replace(\"{style}\", layerParam.style);\n path = path.replace(\"{Layer}\", layerParam.layer);\n\n return new URI(path);\n }" ]
[ "public void takeNoteOfGradient(IntDoubleVector gradient) {\n gradient.iterate(new FnIntDoubleToVoid() { \n @Override\n public void call(int index, double value) {\n gradSumSquares[index] += value * value;\n assert !Double.isNaN(gradSumSquares[index]);\n }\n });\n }", "public static TaskField getMpxjField(int value)\n {\n TaskField result = null;\n\n if (value >= 0 && value < MPX_MPXJ_ARRAY.length)\n {\n result = MPX_MPXJ_ARRAY[value];\n }\n\n return (result);\n }", "private List<I_CmsSearchFieldMapping> getMappings() {\n\n CmsSearchManager manager = OpenCms.getSearchManager();\n I_CmsSearchFieldConfiguration fieldConfig = manager.getFieldConfiguration(getParamFieldconfiguration());\n CmsLuceneField field;\n List<I_CmsSearchFieldMapping> result = null;\n Iterator<CmsSearchField> itFields;\n if (fieldConfig != null) {\n itFields = fieldConfig.getFields().iterator();\n while (itFields.hasNext()) {\n field = (CmsLuceneField)itFields.next();\n if (field.getName().equals(getParamField())) {\n result = field.getMappings();\n }\n }\n } else {\n result = Collections.emptyList();\n if (LOG.isErrorEnabled()) {\n LOG.error(\n Messages.get().getBundle().key(\n Messages.ERR_SEARCHINDEX_EDIT_MISSING_PARAM_1,\n A_CmsFieldConfigurationDialog.PARAM_FIELDCONFIGURATION));\n }\n }\n return result;\n }", "@ArgumentsChecked\n\t@Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class })\n\tpublic static void isNumber(final boolean condition, @Nonnull final String value) {\n\t\tif (condition) {\n\t\t\tCheck.isNumber(value);\n\t\t}\n\t}", "public ItemRequest<Task> addFollowers(String task) {\n \n String path = String.format(\"/tasks/%s/addFollowers\", task);\n return new ItemRequest<Task>(this, Task.class, path, \"POST\");\n }", "public void sendJsonToUrl(Object data, String url) {\n sendToUrl(JSON.toJSONString(data), url);\n }", "public Mapping<T> addFields() {\n\n if (idColumn == null) {\n throw new RuntimeException(\"Map ID column before adding class fields\");\n }\n\n for (Field f : ReflectionUtils.getDeclaredFieldsInHierarchy(clazz)) {\n if (!Modifier.isStatic(f.getModifiers())\n && !isFieldMapped(f.getName())\n && !ignoredFields.contains(f.getName())) {\n addColumn(f.getName());\n }\n }\n\n return this;\n }", "public void addModuleDir(final String moduleDir) {\n if (moduleDir == null) {\n throw LauncherMessages.MESSAGES.nullParam(\"moduleDir\");\n }\n // Validate the path\n final Path path = Paths.get(moduleDir).normalize();\n modulesDirs.add(path.toString());\n }", "public static base_response unset(nitro_service client, tmsessionparameter resource, String[] args) throws Exception{\n\t\ttmsessionparameter unsetresource = new tmsessionparameter();\n\t\treturn unsetresource.unset_resource(client,args);\n\t}" ]
Utility function that creates directory. @param dir Directory path @return File object of directory.
[ "public static File createDir(String dir) {\n // create outdir\n File directory = null;\n if(dir != null) {\n directory = new File(dir);\n if(!(directory.exists() || directory.mkdir())) {\n Utils.croak(\"Can't find or create directory \" + dir);\n }\n }\n return directory;\n }" ]
[ "@GwtIncompatible(\"Class.getDeclaredFields\")\n\tpublic ToStringBuilder addDeclaredFields() {\n\t\tField[] fields = instance.getClass().getDeclaredFields();\n\t\tfor(Field field : fields) {\n\t\t\taddField(field);\n\t\t}\n\t\treturn this;\n\t}", "public void setContentType(String photoId, String contentType) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_SET_CONTENTTYPE);\r\n\r\n parameters.put(\"photo_id\", photoId);\r\n parameters.put(\"content_type\", contentType);\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 double[] calculateDrift(ArrayList<T> tracks){\n\t\tdouble[] result = new double[3];\n\t\t\n\t\tdouble sumX =0;\n\t\tdouble sumY = 0;\n\t\tdouble sumZ = 0;\n\t\tint N=0;\n\t\tfor(int i = 0; i < tracks.size(); i++){\n\t\t\tT t = tracks.get(i);\n\t\t\tTrajectoryValidIndexTimelagIterator it = new TrajectoryValidIndexTimelagIterator(t,1);\n\t\n\t\t\t//for(int j = 1; j < t.size(); j++){\n\t\t\twhile(it.hasNext()) {\n\t\t\t\tint j = it.next();\n\t\t\t\tsumX += t.get(j+1).x - t.get(j).x;\n\t\t\t\tsumY += t.get(j+1).y - t.get(j).y;\n\t\t\t\tsumZ += t.get(j+1).z - t.get(j).z;\n\t\t\t\tN++;\n\t\t\t}\n\t\t}\n\t\tresult[0] = sumX/N;\n\t\tresult[1] = sumY/N;\n\t\tresult[2] = sumZ/N;\n\t\treturn result;\n\t}", "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 init() {\n if (initialized.compareAndSet(false, true)) {\n final RowSorter<? extends TableModel> rowSorter = table.getRowSorter();\n rowSorter.toggleSortOrder(1); // sort by date\n rowSorter.toggleSortOrder(1); // descending\n final TableColumnModel columnModel = table.getColumnModel();\n columnModel.getColumn(1).setCellRenderer(dateRenderer);\n columnModel.getColumn(2).setCellRenderer(sizeRenderer);\n }\n }", "public SpinJsonDataFormatException unableToParseValue(String expectedType, JsonNodeType type) {\n return new SpinJsonDataFormatException(exceptionMessage(\"002\", \"Expected '{}', got '{}'\", expectedType, type.toString()));\n }", "@Beta\n public MSICredentials withIdentityId(String identityId) {\n this.identityId = identityId;\n this.clientId = null;\n this.objectId = null;\n return this;\n }", "private void readUnread(CommitData cd, Consumer<Entry<Key, Value>> locksSeen) {\n // TODO make async\n // TODO need to keep track of ranges read (not ranges passed in, but actual data read... user\n // may not iterate over entire range\n Map<Bytes, Set<Column>> columnsToRead = new HashMap<>();\n\n for (Entry<Bytes, Set<Column>> entry : cd.getRejected().entrySet()) {\n Set<Column> rowColsRead = columnsRead.get(entry.getKey());\n if (rowColsRead == null) {\n columnsToRead.put(entry.getKey(), entry.getValue());\n } else {\n HashSet<Column> colsToRead = new HashSet<>(entry.getValue());\n colsToRead.removeAll(rowColsRead);\n if (!colsToRead.isEmpty()) {\n columnsToRead.put(entry.getKey(), colsToRead);\n }\n }\n }\n\n for (Entry<Bytes, Set<Column>> entry : columnsToRead.entrySet()) {\n getImpl(entry.getKey(), entry.getValue(), locksSeen);\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 }" ]
disables the current active id, enables the new one selected @param profileId profile ID of the client @param clientUUID UUID of the client @param active true to make client active, false to make client inactive @throws Exception exception
[ "public void updateActive(int profileId, String clientUUID, Boolean active) throws Exception {\n PreparedStatement statement = null;\n try (Connection sqlConnection = sqlService.getConnection()) {\n statement = sqlConnection.prepareStatement(\n \"UPDATE \" + Constants.DB_TABLE_CLIENT +\n \" SET \" + Constants.CLIENT_IS_ACTIVE + \"= ?\" +\n \" WHERE \" + Constants.GENERIC_CLIENT_UUID + \"= ? \" +\n \" AND \" + Constants.GENERIC_PROFILE_ID + \"= ?\"\n );\n statement.setBoolean(1, active);\n statement.setString(2, clientUUID);\n statement.setInt(3, profileId);\n statement.executeUpdate();\n } catch (Exception e) {\n // ok to swallow this.. just means there wasn't any\n } finally {\n try {\n if (statement != null) {\n statement.close();\n }\n } catch (Exception e) {\n }\n }\n }" ]
[ "@RequestMapping(value = \"api/servergroup\", method = RequestMethod.GET)\n public\n @ResponseBody\n HashMap<String, Object> getServerGroups(Model model,\n @RequestParam(value = \"profileId\", required = false) Integer profileId,\n @RequestParam(value = \"search\", required = false) String search,\n @RequestParam(value = \"profileIdentifier\", required = false) String profileIdentifier) throws Exception {\n if (profileId == null && profileIdentifier == null) {\n throw new Exception(\"profileId required\");\n }\n if (profileId == null) {\n profileId = ProfileService.getInstance().getIdFromName(profileIdentifier);\n }\n\n List<ServerGroup> serverGroups = ServerRedirectService.getInstance().tableServerGroups(profileId);\n\n if (search != null) {\n Iterator<ServerGroup> iterator = serverGroups.iterator();\n while (iterator.hasNext()) {\n ServerGroup serverGroup = iterator.next();\n if (!serverGroup.getName().toLowerCase().contains(search.toLowerCase())) {\n iterator.remove();\n }\n }\n }\n HashMap<String, Object> returnJson = Utils.getJQGridJSON(serverGroups, \"servergroups\");\n return returnJson;\n }", "private void writeUserFieldDefinitions()\n {\n for (CustomField cf : m_sortedCustomFieldsList)\n {\n if (cf.getFieldType() != null && cf.getFieldType().getDataType() != null)\n {\n UDFTypeType udf = m_factory.createUDFTypeType();\n udf.setObjectId(Integer.valueOf(FieldTypeHelper.getFieldID(cf.getFieldType())));\n\n udf.setDataType(UserFieldDataType.inferUserFieldDataType(cf.getFieldType().getDataType()));\n udf.setSubjectArea(UserFieldDataType.inferUserFieldSubjectArea(cf.getFieldType()));\n udf.setTitle(cf.getAlias());\n m_apibo.getUDFType().add(udf);\n }\n }\n }", "public CompletableFuture<Void> stop() {\n numPendingStopRequests.incrementAndGet();\n return startStop.stop().thenRun(numPendingStopRequests::decrementAndGet);\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 }", "public Double getAvgEventValue() {\n resetIfNeeded();\n synchronized(this) {\n long eventsLastInterval = numEventsLastInterval - numEventsLastLastInterval;\n if(eventsLastInterval > 0)\n return ((totalEventValueLastInterval - totalEventValueLastLastInterval) * 1.0)\n / eventsLastInterval;\n else\n return 0.0;\n }\n }", "public void sub(Vector3d v1) {\n x -= v1.x;\n y -= v1.y;\n z -= v1.z;\n }", "public static <T> String listToString(List<T> list, final boolean justValue,\r\n final String separator) {\r\n StringBuilder s = new StringBuilder();\r\n for (Iterator<T> wordIterator = list.iterator(); wordIterator.hasNext();) {\r\n T o = wordIterator.next();\r\n s.append(wordToString(o, justValue, separator));\r\n if (wordIterator.hasNext()) {\r\n s.append(' ');\r\n }\r\n }\r\n return s.toString();\r\n }", "private void set(FieldType field, boolean value)\n {\n set(field, (value ? Boolean.TRUE : Boolean.FALSE));\n }", "public static Double getDistanceWithinThresholdOfCoordinates(\r\n Tuple2<Double, Double> point1, Tuple2<Double, Double> point2) {\r\n throw new NotImplementedError();\r\n }" ]
Sets an attribute in the main section of the manifest to a map. The map entries will be joined with a single whitespace character, and each key-value pair will be joined with a '='. @param name the attribute's name @param values the attribute's value @return {@code this} @throws IllegalStateException if entries have been added or the JAR has been written prior to calling this methods.
[ "public Jar setMapAttribute(String name, Map<String, ?> values) {\n return setAttribute(name, join(values));\n }" ]
[ "public synchronized int get(byte[] dst, int off, int len) {\n if (available == 0) {\n return 0;\n }\n\n // limit is last index to read + 1\n int limit = idxGet < idxPut ? idxPut : capacity;\n int count = Math.min(limit - idxGet, len);\n System.arraycopy(buffer, idxGet, dst, off, count);\n idxGet += count;\n\n if (idxGet == capacity) {\n // Array end reached, check if we have more\n int count2 = Math.min(len - count, idxPut);\n if (count2 > 0) {\n System.arraycopy(buffer, 0, dst, off + count, count2);\n idxGet = count2;\n count += count2;\n } else {\n idxGet = 0;\n }\n }\n available -= count;\n return count;\n }", "public static <E> Collection<E> sampleWithReplacement(Collection<E> c, int n) {\r\n return sampleWithReplacement(c, n, new Random());\r\n }", "private void readCalendar(Project.Calendars.Calendar calendar, HashMap<BigInteger, ProjectCalendar> map, List<Pair<ProjectCalendar, BigInteger>> baseCalendars)\n {\n ProjectCalendar bc = m_projectFile.addCalendar();\n bc.setUniqueID(NumberHelper.getInteger(calendar.getUID()));\n bc.setName(calendar.getName());\n BigInteger baseCalendarID = calendar.getBaseCalendarUID();\n if (baseCalendarID != null)\n {\n baseCalendars.add(new Pair<ProjectCalendar, BigInteger>(bc, baseCalendarID));\n }\n\n readExceptions(calendar, bc);\n boolean readExceptionsFromDays = bc.getCalendarExceptions().isEmpty();\n\n Project.Calendars.Calendar.WeekDays days = calendar.getWeekDays();\n if (days != null)\n {\n for (Project.Calendars.Calendar.WeekDays.WeekDay weekDay : days.getWeekDay())\n {\n readDay(bc, weekDay, readExceptionsFromDays);\n }\n }\n else\n {\n bc.setWorkingDay(Day.SUNDAY, DayType.DEFAULT);\n bc.setWorkingDay(Day.MONDAY, DayType.DEFAULT);\n bc.setWorkingDay(Day.TUESDAY, DayType.DEFAULT);\n bc.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT);\n bc.setWorkingDay(Day.THURSDAY, DayType.DEFAULT);\n bc.setWorkingDay(Day.FRIDAY, DayType.DEFAULT);\n bc.setWorkingDay(Day.SATURDAY, DayType.DEFAULT);\n }\n\n readWorkWeeks(calendar, bc);\n\n map.put(calendar.getUID(), bc);\n\n m_eventManager.fireCalendarReadEvent(bc);\n }", "public void rotateToFaceCamera(final GVRTransform transform) {\n //see http://stackoverflow.com/questions/5782658/extracting-yaw-from-a-quaternion\n final GVRTransform t = getMainCameraRig().getHeadTransform();\n final Quaternionf q = new Quaternionf(0, t.getRotationY(), 0, t.getRotationW()).normalize();\n\n transform.rotateWithPivot(q.w, q.x, q.y, q.z, 0, 0, 0);\n }", "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 void doDelete(Object obj, boolean ignoreReferences) throws PersistenceBrokerException\n {\n //logger.info(\"DELETING \" + obj);\n // object is not null\n if (obj != null)\n {\n obj = getProxyFactory().getRealObject(obj);\n /**\n * Kuali Foundation modification -- 8/24/2007\n */\n if ( obj == null ) return;\n /**\n * End of Kuali Foundation modification\n */\n /**\n * MBAIRD\n * 1. if we are marked for delete already, avoid recursing on this object\n *\n * arminw:\n * use object instead Identity object in markedForDelete List,\n * because using objects we get a better performance. I can't find\n * side-effects in doing so.\n */\n if (markedForDelete.contains(obj))\n {\n return;\n }\n \n ClassDescriptor cld = getClassDescriptor(obj.getClass());\n //BRJ: check for valid pk\n if (!serviceBrokerHelper().assertValidPkForDelete(cld, obj))\n {\n String msg = \"Cannot delete object without valid PKs. \" + obj;\n logger.error(msg);\n return;\n }\n \n /**\n * MBAIRD\n * 2. register object in markedForDelete map.\n */\n markedForDelete.add(obj);\n Identity oid = serviceIdentity().buildIdentity(cld, obj);\n\n // Invoke events on PersistenceBrokerAware instances and listeners\n BEFORE_DELETE_EVENT.setTarget(obj);\n fireBrokerEvent(BEFORE_DELETE_EVENT);\n BEFORE_DELETE_EVENT.setTarget(null);\n\n // now perform deletion\n performDeletion(cld, obj, oid, ignoreReferences);\n \t \t \n // Invoke events on PersistenceBrokerAware instances and listeners\n AFTER_DELETE_EVENT.setTarget(obj);\n fireBrokerEvent(AFTER_DELETE_EVENT);\n AFTER_DELETE_EVENT.setTarget(null);\n \t \t \t\n // let the connection manager to execute batch\n connectionManager.executeBatchIfNecessary();\n }\n }", "public ResourceTransformerEntry resolveResourceTransformer(final PathAddress address, final PlaceholderResolver placeholderResolver) {\n return resolveResourceTransformer(address.iterator(), null, placeholderResolver);\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 }", "public AT_Row setPaddingBottom(int paddingBottom) {\r\n\t\tif(this.hasCells()){\r\n\t\t\tfor(AT_Cell cell : this.getCells()){\r\n\t\t\t\tcell.getContext().setPaddingBottom(paddingBottom);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}" ]
Registers add operation @param registration resource on which to register @param handler operation handler to register @param flags with flags @deprecated use {@link #registerAddOperation(org.jboss.as.controller.registry.ManagementResourceRegistration, AbstractAddStepHandler, org.jboss.as.controller.registry.OperationEntry.Flag...)}
[ "@Deprecated\n @SuppressWarnings(\"deprecation\")\n protected void registerAddOperation(final ManagementResourceRegistration registration, final OperationStepHandler handler, OperationEntry.Flag... flags) {\n if (handler instanceof DescriptionProvider) {\n registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD,\n (DescriptionProvider) handler, OperationEntry.EntryType.PUBLIC,flags)\n , handler);\n\n } else {\n registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD,\n new DefaultResourceAddDescriptionProvider(registration, descriptionResolver, orderedChild),\n OperationEntry.EntryType.PUBLIC,\n flags)\n , handler);\n }\n }" ]
[ "private void processCalendarData(List<ProjectCalendar> calendars) throws SQLException\n {\n for (ProjectCalendar calendar : calendars)\n {\n processCalendarData(calendar, getRows(\"SELECT * FROM MSP_CALENDAR_DATA WHERE PROJ_ID=? AND CAL_UID=?\", m_projectID, calendar.getUniqueID()));\n }\n }", "public static String workDays(ProjectCalendar input)\n {\n StringBuilder result = new StringBuilder();\n DayType[] test = input.getDays(); // get the array from MPXJ ProjectCalendar\n for (DayType i : test)\n { // go through every day in the given array\n if (i == DayType.NON_WORKING)\n {\n result.append(\"N\"); // only put N for non-working day of the week\n }\n else\n {\n result.append(\"Y\"); // Assume WORKING day unless NON_WORKING\n }\n }\n return result.toString(); // According to USACE specs., exceptions will be specified in HOLI records\n }", "public void resetQuotaAndRecoverEnforcement() {\n for(Integer nodeId: nodeIds) {\n boolean quotaEnforcement = mapNodeToQuotaEnforcingEnabled.get(nodeId);\n adminClient.metadataMgmtOps.updateRemoteMetadata(Arrays.asList(nodeId),\n MetadataStore.QUOTA_ENFORCEMENT_ENABLED_KEY,\n Boolean.toString(quotaEnforcement));\n }\n for(String storeName: storeNames) {\n adminClient.quotaMgmtOps.rebalanceQuota(storeName);\n }\n }", "public static Object lookup(String jndiName)\r\n {\r\n if(log.isDebugEnabled()) log.debug(\"lookup(\"+jndiName+\") was called\");\r\n try\r\n {\r\n return getContext().lookup(jndiName);\r\n }\r\n catch (NamingException e)\r\n {\r\n throw new OJBRuntimeException(\"Lookup failed for: \" + jndiName, e);\r\n }\r\n catch(OJBRuntimeException e)\r\n {\r\n throw e;\r\n }\r\n }", "public static base_response delete(nitro_service client, snmpmanager resource) throws Exception {\n\t\tsnmpmanager deleteresource = new snmpmanager();\n\t\tdeleteresource.ipaddress = resource.ipaddress;\n\t\tdeleteresource.netmask = resource.netmask;\n\t\treturn deleteresource.delete_resource(client);\n\t}", "public Map<Integer, Row> createWorkPatternMap(List<Row> rows)\n {\n Map<Integer, Row> map = new HashMap<Integer, Row>();\n for (Row row : rows)\n {\n map.put(row.getInteger(\"WORK_PATTERNID\"), row);\n }\n return map;\n }", "public List<ServerRedirect> tableServers(int profileId, int serverGroupId) {\n ArrayList<ServerRedirect> servers = new ArrayList<>();\n PreparedStatement queryStatement = null;\n ResultSet results = null;\n\n try (Connection sqlConnection = sqlService.getConnection()) {\n queryStatement = sqlConnection.prepareStatement(\n \"SELECT * FROM \" + Constants.DB_TABLE_SERVERS +\n \" WHERE \" + Constants.GENERIC_PROFILE_ID + \" = ?\" +\n \" AND \" + Constants.SERVER_REDIRECT_GROUP_ID + \" = ?\"\n );\n queryStatement.setInt(1, profileId);\n queryStatement.setInt(2, serverGroupId);\n results = queryStatement.executeQuery();\n while (results.next()) {\n ServerRedirect curServer = new ServerRedirect(results.getInt(Constants.GENERIC_ID),\n results.getString(Constants.SERVER_REDIRECT_REGION),\n results.getString(Constants.SERVER_REDIRECT_SRC_URL),\n results.getString(Constants.SERVER_REDIRECT_DEST_URL),\n results.getString(Constants.SERVER_REDIRECT_HOST_HEADER));\n curServer.setProfileId(profileId);\n servers.add(curServer);\n }\n } catch (SQLException e) {\n e.printStackTrace();\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n try {\n if (results != null) {\n results.close();\n }\n } catch (Exception e) {\n }\n try {\n if (queryStatement != null) {\n queryStatement.close();\n }\n } catch (Exception e) {\n }\n }\n return servers;\n }", "private Task readTask(ChildTaskContainer parent, Integer id)\n {\n Table a0 = getTable(\"A0TAB\");\n Table a1 = getTable(\"A1TAB\");\n Table a2 = getTable(\"A2TAB\");\n Table a3 = getTable(\"A3TAB\");\n Table a4 = getTable(\"A4TAB\");\n\n Task task = parent.addTask();\n MapRow a1Row = a1.find(id);\n MapRow a2Row = a2.find(id);\n\n setFields(A0TAB_FIELDS, a0.find(id), task);\n setFields(A1TAB_FIELDS, a1Row, task);\n setFields(A2TAB_FIELDS, a2Row, task);\n setFields(A3TAB_FIELDS, a3.find(id), task);\n setFields(A5TAB_FIELDS, a4.find(id), task);\n\n task.setStart(task.getEarlyStart());\n task.setFinish(task.getEarlyFinish());\n if (task.getName() == null)\n {\n task.setName(task.getText(1));\n }\n\n m_eventManager.fireTaskReadEvent(task);\n\n return task;\n }", "private Map<String, I_CmsSearchConfigurationFacetField> getDefaultFieldFacets(boolean categoryConjunction) {\n\n Map<String, I_CmsSearchConfigurationFacetField> fieldFacets = new HashMap<String, I_CmsSearchConfigurationFacetField>();\n fieldFacets.put(\n CmsListManager.FIELD_CATEGORIES,\n new CmsSearchConfigurationFacetField(\n CmsListManager.FIELD_CATEGORIES,\n null,\n Integer.valueOf(1),\n Integer.valueOf(200),\n null,\n \"Category\",\n SortOrder.index,\n null,\n Boolean.valueOf(categoryConjunction),\n null,\n Boolean.TRUE));\n fieldFacets.put(\n CmsListManager.FIELD_PARENT_FOLDERS,\n new CmsSearchConfigurationFacetField(\n CmsListManager.FIELD_PARENT_FOLDERS,\n null,\n Integer.valueOf(1),\n Integer.valueOf(200),\n null,\n \"Folders\",\n SortOrder.index,\n null,\n Boolean.FALSE,\n null,\n Boolean.TRUE));\n return Collections.unmodifiableMap(fieldFacets);\n\n }" ]
Get the service name of a top-level deployment unit. @param name the simple name of the deployment @param phase the deployment phase @return the service name
[ "public static ServiceName deploymentUnitName(String name, Phase phase) {\n return JBOSS_DEPLOYMENT_UNIT.append(name, phase.name());\n }" ]
[ "protected boolean hasContentType() {\n\n boolean result = false;\n if(this.request.getHeader(RestMessageHeaders.CONTENT_TYPE) != null) {\n result = true;\n } else {\n logger.error(\"Error when validating put request. Missing Content-Type header.\");\n RestErrorHandler.writeErrorResponse(this.messageEvent,\n HttpResponseStatus.BAD_REQUEST,\n \"Missing Content-Type header\");\n }\n return result;\n }", "public String getEditedFilePath() {\n\n switch (getBundleType()) {\n case DESCRIPTOR:\n return m_cms.getSitePath(m_desc);\n case PROPERTY:\n return null != m_lockedBundleFiles.get(getLocale())\n ? m_cms.getSitePath(m_lockedBundleFiles.get(getLocale()).getFile())\n : m_cms.getSitePath(m_resource);\n case XML:\n return m_cms.getSitePath(m_resource);\n default:\n throw new IllegalArgumentException();\n }\n }", "public void updateBuildpackInstallations(String appName, List<String> buildpacks) {\n connection.execute(new BuildpackInstallationUpdate(appName, buildpacks), apiKey);\n }", "public void populateContainer(Class<? extends FieldType> type, FieldContainer container, Integer id, byte[][] fixedData, Var2Data varData)\n {\n //System.out.println(container.getClass().getSimpleName()+\": \" + id);\n for (FieldItem item : m_map.values())\n {\n if (item.getType().getClass().equals(type))\n {\n //System.out.println(item.m_type);\n Object value = item.read(id, fixedData, varData);\n //System.out.println(item.m_type.getClass().getSimpleName() + \".\" + item.m_type + \": \" + value);\n container.set(item.getType(), value);\n }\n }\n }", "public static authenticationvserver_authenticationtacacspolicy_binding[] get(nitro_service service, String name) throws Exception{\n\t\tauthenticationvserver_authenticationtacacspolicy_binding obj = new authenticationvserver_authenticationtacacspolicy_binding();\n\t\tobj.set_name(name);\n\t\tauthenticationvserver_authenticationtacacspolicy_binding response[] = (authenticationvserver_authenticationtacacspolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "private void sendMessage(Message message) throws IOException {\n logger.debug(\"Sending> {}\", message);\n int totalSize = 0;\n for (Field field : message.fields) {\n totalSize += field.getBytes().remaining();\n }\n ByteBuffer combined = ByteBuffer.allocate(totalSize);\n for (Field field : message.fields) {\n logger.debug(\"..sending> {}\", field);\n combined.put(field.getBytes());\n }\n combined.flip();\n Util.writeFully(combined, channel);\n }", "public static ModelNode determineHostAddress(final ModelControllerClient client) throws IOException, OperationExecutionException {\n final ModelNode op = Operations.createReadAttributeOperation(EMPTY_ADDRESS, \"local-host-name\");\n ModelNode response = client.execute(op);\n if (Operations.isSuccessfulOutcome(response)) {\n return DeploymentOperations.createAddress(\"host\", Operations.readResult(response).asString());\n }\n throw new OperationExecutionException(op, response);\n }", "private static void defineField(Map<String, FieldType> container, String name, FieldType type, String alias)\n {\n container.put(name, type);\n if (alias != null)\n {\n ALIASES.put(type, alias);\n }\n }", "private void loadResourceFile(URL configurationResourceUrl, Properties hotRodConfiguration) {\n\t\tif ( configurationResourceUrl != null ) {\n\t\t\ttry ( InputStream openStream = configurationResourceUrl.openStream() ) {\n\t\t\t\thotRodConfiguration.load( openStream );\n\t\t\t}\n\t\t\tcatch (IOException e) {\n\t\t\t\tthrow log.failedLoadingHotRodConfigurationProperties( e );\n\t\t\t}\n\t\t}\n\t}" ]
Set the role info for this user. If set, this will be used to set the user's authorizations. @param roles the roles @since 1.10.0
[ "public void setRoles(List<NamedRoleInfo> roles) {\n\t\tthis.roles = roles;\n\t\tList<AuthorizationInfo> authorizations = new ArrayList<AuthorizationInfo>();\n\t\tfor (NamedRoleInfo role : roles) {\n\t\t\tauthorizations.addAll(role.getAuthorizations());\n\t\t}\n\t\tsuper.setAuthorizations(authorizations);\n\t}" ]
[ "public String isChecked(String value1, String value2) {\n\n if ((value1 == null) || (value2 == null)) {\n return \"\";\n }\n\n if (value1.trim().equalsIgnoreCase(value2.trim())) {\n return \"checked\";\n }\n\n return \"\";\n }", "public final void notifyContentItemRangeInserted(int positionStart, int itemCount) {\n int newHeaderItemCount = getHeaderItemCount();\n int newContentItemCount = getContentItemCount();\n if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > newContentItemCount) {\n throw new IndexOutOfBoundsException(\"The given range [\" + positionStart + \" - \"\n + (positionStart + itemCount - 1) + \"] is not within the position bounds for content items [0 - \"\n + (newContentItemCount - 1) + \"].\");\n }\n notifyItemRangeInserted(positionStart + newHeaderItemCount, itemCount);\n }", "public static URI setPath(final URI initialUri, final String path) {\n String finalPath = path;\n if (!finalPath.startsWith(\"/\")) {\n finalPath = '/' + path;\n }\n try {\n if (initialUri.getHost() == null && initialUri.getAuthority() != null) {\n return new URI(initialUri.getScheme(), initialUri.getAuthority(), finalPath,\n initialUri.getQuery(),\n initialUri.getFragment());\n } else {\n return new URI(initialUri.getScheme(), initialUri.getUserInfo(), initialUri.getHost(),\n initialUri.getPort(),\n finalPath, initialUri.getQuery(), initialUri.getFragment());\n }\n } catch (URISyntaxException e) {\n throw ExceptionUtils.getRuntimeException(e);\n }\n }", "@Nonnull\n public static Map<String, Integer> parseForcedGroups(@Nonnull final HttpServletRequest request) {\n final String forceGroupsList = getForceGroupsStringFromRequest(request);\n return parseForceGroupsList(forceGroupsList);\n }", "public ViewGroup getContentContainer() {\n if (mDragMode == MENU_DRAG_CONTENT) {\n return mContentContainer;\n } else {\n return (ViewGroup) findViewById(android.R.id.content);\n }\n }", "@UiThread\n protected void collapseView() {\n setExpanded(false);\n onExpansionToggled(true);\n\n if (mParentViewHolderExpandCollapseListener != null) {\n mParentViewHolderExpandCollapseListener.onParentCollapsed(getAdapterPosition());\n }\n }", "static EntityIdValue fromId(String id, String siteIri) {\n\t\tswitch (guessEntityTypeFromId(id)) {\n\t\t\tcase EntityIdValueImpl.JSON_ENTITY_TYPE_ITEM:\n\t\t\t\treturn new ItemIdValueImpl(id, siteIri);\n\t\t\tcase EntityIdValueImpl.JSON_ENTITY_TYPE_PROPERTY:\n\t\t\t\treturn new PropertyIdValueImpl(id, siteIri);\n\t\t\tcase EntityIdValueImpl.JSON_ENTITY_TYPE_LEXEME:\n\t\t\t\treturn new LexemeIdValueImpl(id, siteIri);\n\t\t\tcase EntityIdValueImpl.JSON_ENTITY_TYPE_FORM:\n\t\t\t\treturn new FormIdValueImpl(id, siteIri);\n\t\t\tcase EntityIdValueImpl.JSON_ENTITY_TYPE_SENSE:\n\t\t\t\treturn new SenseIdValueImpl(id, siteIri);\n\t\t\tdefault:\n\t\t\t\tthrow new IllegalArgumentException(\"Entity id \\\"\" + id + \"\\\" is not supported.\");\n\t\t}\n\t}", "public void postProcess() {\n\t\tif (foreignColumnName != null) {\n\t\t\tforeignAutoRefresh = true;\n\t\t}\n\t\tif (foreignAutoRefresh && maxForeignAutoRefreshLevel == NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED) {\n\t\t\tmaxForeignAutoRefreshLevel = DatabaseField.DEFAULT_MAX_FOREIGN_AUTO_REFRESH_LEVEL;\n\t\t}\n\t}", "protected List<String> arguments() {\n List<String> args = new ArgumentsBuilder()\n .flag(\"-v\", verbose)\n .flag(\"--package-dir\", packageDir)\n .param(\"-d\", outputDirectory.getPath())\n .param(\"-p\", packageName)\n .map(\"--package:\", packageNameMap())\n .param(\"--class-prefix\", classPrefix)\n .param(\"--param-prefix\", parameterPrefix)\n .param(\"--chunk-size\", chunkSize)\n .flag(\"--no-dispatch-client\", !generateDispatchClient)\n .flag(\"--dispatch-as\", generateDispatchAs)\n .param(\"--dispatch-version\", dispatchVersion)\n .flag(\"--no-runtime\", !generateRuntime)\n .intersperse(\"--wrap-contents\", wrapContents)\n .param(\"--protocol-file\", protocolFile)\n .param(\"--protocol-package\", protocolPackage)\n .param(\"--attribute-prefix\", attributePrefix)\n .flag(\"--prepend-family\", prependFamily)\n .flag(\"--blocking\", !async)\n .flag(\"--lax-any\", laxAny)\n .flag(\"--no-varargs\", !varArgs)\n .flag(\"--ignore-unknown\", ignoreUnknown)\n .flag(\"--autopackages\", autoPackages)\n .flag(\"--mutable\", mutable)\n .flag(\"--visitor\", visitor)\n\n .getArguments();\n return unmodifiableList(args);\n }" ]
Delivers the correct JSON Object for the Bounds @param bounds @throws org.json.JSONException
[ "private static JSONObject parseBounds(Bounds bounds) throws JSONException {\n if (bounds != null) {\n JSONObject boundsObject = new JSONObject();\n JSONObject lowerRight = new JSONObject();\n JSONObject upperLeft = new JSONObject();\n\n lowerRight.put(\"x\",\n bounds.getLowerRight().getX().doubleValue());\n lowerRight.put(\"y\",\n bounds.getLowerRight().getY().doubleValue());\n\n upperLeft.put(\"x\",\n bounds.getUpperLeft().getX().doubleValue());\n upperLeft.put(\"y\",\n bounds.getUpperLeft().getY().doubleValue());\n\n boundsObject.put(\"lowerRight\",\n lowerRight);\n boundsObject.put(\"upperLeft\",\n upperLeft);\n\n return boundsObject;\n }\n\n return new JSONObject();\n }" ]
[ "public boolean removeHandlerFor(final GVRSceneObject sceneObject) {\n sceneObject.detachComponent(GVRCollider.getComponentType());\n return null != touchHandlers.remove(sceneObject);\n }", "@SafeVarargs\n public static <T> Set<T> create(final T... values) {\n Set<T> result = new HashSet<>(values.length);\n Collections.addAll(result, values);\n return result;\n }", "void reset()\n {\n if (!hasStopped)\n {\n throw new IllegalStateException(\"cannot reset a non stopped queue poller\");\n }\n hasStopped = false;\n run = true;\n lastLoop = null;\n loop = new Semaphore(0);\n }", "public static long count(nitro_service service, Long td) throws Exception{\n\t\tnstrafficdomain_bridgegroup_binding obj = new nstrafficdomain_bridgegroup_binding();\n\t\tobj.set_td(td);\n\t\toptions option = new options();\n\t\toption.set_count(true);\n\t\tnstrafficdomain_bridgegroup_binding response[] = (nstrafficdomain_bridgegroup_binding[]) obj.get_resources(service,option);\n\t\tif (response != null) {\n\t\t\treturn response[0].__count;\n\t\t}\n\t\treturn 0;\n\t}", "public static void copy(byte[] in, OutputStream out) throws IOException {\n\t\tAssert.notNull(in, \"No input byte array specified\");\n\t\tAssert.notNull(out, \"No OutputStream specified\");\n\t\tout.write(in);\n\t}", "public static int getPercentage(String percentage) {\n if (isNotEmpty(percentage) && isNumeric(percentage)) {\n int p = Integer.parseInt(percentage);\n return p;\n } else {\n return 0;\n }\n }", "public static Integer parseInteger(String value) throws ParseException\n {\n Integer result = null;\n\n if (value.length() > 0 && value.indexOf(' ') == -1)\n {\n if (value.indexOf('.') == -1)\n {\n result = Integer.valueOf(value);\n }\n else\n {\n Number n = DatatypeConverter.parseDouble(value);\n result = Integer.valueOf(n.intValue());\n }\n }\n\n return result;\n }", "private static ClassLoader getParentCl()\n {\n try\n {\n Method m = ClassLoader.class.getMethod(\"getPlatformClassLoader\");\n return (ClassLoader) m.invoke(null);\n }\n catch (NoSuchMethodException e)\n {\n // Java < 9, just use the bootstrap CL.\n return null;\n }\n catch (Exception e)\n {\n throw new JqmInitError(\"Could not fetch Platform Class Loader\", e);\n }\n }", "public void validate(final List<Throwable> validationErrors) {\n if (this.matchers == null) {\n validationErrors.add(new IllegalArgumentException(\n \"Matchers cannot be null. There should be at least a !acceptAll matcher\"));\n }\n if (this.matchers != null && this.matchers.isEmpty()) {\n validationErrors.add(new IllegalArgumentException(\n \"There are no url matchers defined. There should be at least a \" +\n \"!acceptAll matcher\"));\n }\n }" ]
What is something came in between when we last checked and when this method is called
[ "public void waitForBuffer(long timeoutMilli) {\n //assert(callerProcessing.booleanValue() == false);\n\n synchronized(buffer) {\n if( dirtyBuffer )\n return;\n if( !foundEOF() ) {\n logger.trace(\"Waiting for things to come in, or until timeout\");\n try {\n if( timeoutMilli > 0 )\n buffer.wait(timeoutMilli);\n else\n buffer.wait();\n } catch(InterruptedException ie) {\n logger.trace(\"Woken up, while waiting for buffer\");\n }\n // this might went early, but running the processing again isn't a big deal\n logger.trace(\"Waited\");\n }\n }\n }" ]
[ "@SuppressWarnings(\"resource\")\n public static FileChannel openChannel(File file, boolean mutable) throws IOException {\n if (mutable) {\n return new RandomAccessFile(file, \"rw\").getChannel();\n }\n return new FileInputStream(file).getChannel();\n }", "private static TechReportPlacement processPlaceLabels(GraphContext graphContext, Set<String> tagNames)\n {\n TagGraphService tagService = new TagGraphService(graphContext);\n\n if (tagNames.size() < 3)\n throw new WindupException(\"There should always be exactly 3 placement labels - row, sector, column/box. It was: \" + tagNames);\n if (tagNames.size() > 3)\n LOG.severe(\"There should always be exactly 3 placement labels - row, sector, column/box. It was: \" + tagNames);\n\n TechReportPlacement placement = new TechReportPlacement();\n\n final TagModel placeSectorsTag = tagService.getTagByName(\"techReport:placeSectors\");\n final TagModel placeBoxesTag = tagService.getTagByName(\"techReport:placeBoxes\");\n final TagModel placeRowsTag = tagService.getTagByName(\"techReport:placeRows\");\n\n Set<String> unknownTags = new HashSet<>();\n for (String name : tagNames)\n {\n final TagModel tag = tagService.getTagByName(name);\n if (null == tag)\n continue;\n\n if (TagGraphService.isTagUnderTagOrSame(tag, placeSectorsTag))\n {\n placement.sector = tag;\n }\n else if (TagGraphService.isTagUnderTagOrSame(tag, placeBoxesTag))\n {\n placement.box = tag;\n }\n else if (TagGraphService.isTagUnderTagOrSame(tag, placeRowsTag))\n {\n placement.row = tag;\n }\n else\n {\n unknownTags.add(name);\n }\n }\n placement.unknown = unknownTags;\n\n LOG.fine(String.format(\"\\t\\tLabels %s identified as: sector: %s, box: %s, row: %s\", tagNames, placement.sector, placement.box,\n placement.row));\n if (placement.box == null || placement.row == null)\n {\n LOG.severe(String.format(\n \"There should always be exactly 3 placement labels - row, sector, column/box. Found: %s, of which box: %s, row: %s\", tagNames,\n placement.box, placement.row));\n }\n return placement;\n }", "protected MetaMatcher createMetaMatcher(String filterAsString, Map<String, MetaMatcher> metaMatchers) {\n \tfor ( String key : metaMatchers.keySet() ){\n \t\tif ( filterAsString.startsWith(key)){\n \t\t\treturn metaMatchers.get(key);\n \t\t}\n \t}\n if (filterAsString.startsWith(GROOVY)) {\n return new GroovyMetaMatcher();\n }\n return new DefaultMetaMatcher();\n }", "@Pure\n\tpublic static <P1, P2, P3, RESULT> Function2<P2, P3, RESULT> curry(final Function3<? super P1, ? super P2, ? super P3, ? extends RESULT> function,\n\t\t\tfinal P1 argument) {\n\t\tif (function == null)\n\t\t\tthrow new NullPointerException(\"function\");\n\t\treturn new Function2<P2, P3, RESULT>() {\n\t\t\t@Override\n\t\t\tpublic RESULT apply(P2 p2, P3 p3) {\n\t\t\t\treturn function.apply(argument, p2, p3);\n\t\t\t}\n\t\t};\n\t}", "public void removeSource(GVRAudioSource audioSource)\n {\n synchronized (mAudioSources)\n {\n audioSource.setListener(null);\n mAudioSources.remove(audioSource);\n }\n }", "private void setMax(MtasRBTreeNode n) {\n n.max = n.right;\n if (n.leftChild != null) {\n n.max = Math.max(n.max, n.leftChild.max);\n }\n if (n.rightChild != null) {\n n.max = Math.max(n.max, n.rightChild.max);\n }\n }", "public static base_response add(nitro_service client, ipset resource) throws Exception {\n\t\tipset addresource = new ipset();\n\t\taddresource.name = resource.name;\n\t\taddresource.td = resource.td;\n\t\treturn addresource.add_resource(client);\n\t}", "@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 recordPreparedOperation(final ServerIdentity identity, final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> prepared) {\n final ModelNode preparedResult = prepared.getPreparedResult();\n // Hmm do the server results need to get translated as well as the host one?\n // final ModelNode transformedResult = prepared.getOperation().transformResult(preparedResult);\n updatePolicy.recordServerResult(identity, preparedResult);\n executor.recordPreparedOperation(prepared);\n }" ]
Add a simple property to the map file. @param writer xml stream writer @param name property name @param propertyType property type @param readMethod read method name @param writeMethod write method name @throws XMLStreamException
[ "private void addProperty(XMLStreamWriter writer, String name, Class<?> propertyType, String readMethod, String writeMethod) throws XMLStreamException\n {\n if (name.length() != 0)\n {\n writer.writeStartElement(\"property\");\n\n // convert property name to .NET style (i.e. first letter uppercase)\n String propertyName = name.substring(0, 1).toUpperCase() + name.substring(1);\n writer.writeAttribute(\"name\", propertyName);\n\n String type = getTypeString(propertyType);\n\n writer.writeAttribute(\"sig\", \"()\" + type);\n if (readMethod != null)\n {\n writer.writeStartElement(\"getter\");\n writer.writeAttribute(\"name\", readMethod);\n writer.writeAttribute(\"sig\", \"()\" + type);\n writer.writeEndElement();\n }\n if (writeMethod != null)\n {\n writer.writeStartElement(\"setter\");\n writer.writeAttribute(\"name\", writeMethod);\n writer.writeAttribute(\"sig\", \"(\" + type + \")V\");\n writer.writeEndElement();\n }\n\n writer.writeEndElement();\n }\n }" ]
[ "public static ZMatrixRMaj hermitian(int length, double min, double max, Random rand) {\n ZMatrixRMaj A = new ZMatrixRMaj(length,length);\n\n fillHermitian(A, min, max, rand);\n\n return A;\n }", "public void histogramToStructure(int histogram[] ) {\n col_idx[0] = 0;\n int index = 0;\n for (int i = 1; i <= numCols; i++) {\n col_idx[i] = index += histogram[i-1];\n }\n nz_length = index;\n growMaxLength( nz_length , false);\n if( col_idx[numCols] != nz_length )\n throw new RuntimeException(\"Egads\");\n }", "public static appfwpolicy_csvserver_binding[] get(nitro_service service, String name) throws Exception{\n\t\tappfwpolicy_csvserver_binding obj = new appfwpolicy_csvserver_binding();\n\t\tobj.set_name(name);\n\t\tappfwpolicy_csvserver_binding response[] = (appfwpolicy_csvserver_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "public static Set<Annotation> filterInterceptorBindings(BeanManagerImpl beanManager, Collection<Annotation> annotations) {\n Set<Annotation> interceptorBindings = new InterceptorBindingSet(beanManager);\n for (Annotation annotation : annotations) {\n if (beanManager.isInterceptorBinding(annotation.annotationType())) {\n interceptorBindings.add(annotation);\n }\n }\n return interceptorBindings;\n }", "public static String escapeDoubleQuotesForJson(String text) {\n\t\tif ( text == null ) {\n\t\t\treturn null;\n\t\t}\n\t\tStringBuilder builder = new StringBuilder( text.length() );\n\t\tfor ( int i = 0; i < text.length(); i++ ) {\n\t\t\tchar c = text.charAt( i );\n\t\t\tswitch ( c ) {\n\t\t\t\tcase '\"':\n\t\t\t\tcase '\\\\':\n\t\t\t\t\tbuilder.append( \"\\\\\" );\n\t\t\t\tdefault:\n\t\t\t\t\tbuilder.append( c );\n\t\t\t}\n\t\t}\n\t\treturn builder.toString();\n\t}", "public static synchronized void unregisterDao(ConnectionSource connectionSource, Dao<?, ?> dao) {\n\t\tif (connectionSource == null) {\n\t\t\tthrow new IllegalArgumentException(\"connectionSource argument cannot be null\");\n\t\t}\n\t\tremoveDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()));\n\t}", "public SwaptionDataLattice convertLattice(QuotingConvention targetConvention, double displacement, AnalyticModel model) {\r\n\r\n\t\tif(displacement != 0 && targetConvention != QuotingConvention.PAYERVOLATILITYLOGNORMAL) {\r\n\t\t\tthrow new IllegalArgumentException(\"SwaptionDataLattice only supports displacement, when using QuotingCOnvention.PAYERVOLATILITYLOGNORMAL.\");\r\n\t\t}\r\n\r\n\t\t//Reverse sign of moneyness, if switching between payer and receiver convention.\r\n\t\tint reverse = ((targetConvention == QuotingConvention.RECEIVERPRICE) ^ (quotingConvention == QuotingConvention.RECEIVERPRICE)) ? -1 : 1;\r\n\r\n\t\tList<Integer> maturities\t= new ArrayList<>();\r\n\t\tList<Integer> tenors\t\t= new ArrayList<>();\r\n\t\tList<Integer> moneynesss\t= new ArrayList<>();\r\n\t\tList<Double> values\t\t= new ArrayList<>();\r\n\r\n\t\tfor(DataKey key : entryMap.keySet()) {\r\n\t\t\tmaturities.add(key.maturity);\r\n\t\t\ttenors.add(key.tenor);\r\n\t\t\tmoneynesss.add(key.moneyness * reverse);\r\n\t\t\tvalues.add(getValue(key.maturity, key.tenor, key.moneyness, targetConvention, displacement, model));\r\n\t\t}\r\n\r\n\t\treturn new SwaptionDataLattice(referenceDate, targetConvention, displacement,\r\n\t\t\t\tforwardCurveName, discountCurveName, floatMetaSchedule, fixMetaSchedule,\r\n\t\t\t\tmaturities.stream().mapToInt(Integer::intValue).toArray(),\r\n\t\t\t\ttenors.stream().mapToInt(Integer::intValue).toArray(),\r\n\t\t\t\tmoneynesss.stream().mapToInt(Integer::intValue).toArray(),\r\n\t\t\t\tvalues.stream().mapToDouble(Double::doubleValue).toArray());\r\n\t}", "public void checkpoint(ObjectEnvelope mod)\r\n throws org.apache.ojb.broker.PersistenceBrokerException\r\n {\r\n mod.doUpdate();\r\n }", "@SuppressWarnings(\"WeakerAccess\")\n public Color segmentColor(final int segment, final boolean front) {\n final ByteBuffer bytes = getData();\n if (isColor) {\n final int base = segment * 6;\n final int backHeight = segmentHeight(segment, false);\n if (backHeight == 0) {\n return Color.BLACK;\n }\n final int maxLevel = front? 255 : 191;\n final int red = Util.unsign(bytes.get(base + 3)) * maxLevel / backHeight;\n final int green = Util.unsign(bytes.get(base + 4)) * maxLevel / backHeight;\n final int blue = Util.unsign(bytes.get(base + 5)) * maxLevel / backHeight;\n return new Color(red, green, blue);\n } else {\n final int intensity = getData().get(segment * 2 + 1) & 0x07;\n return (intensity >= 5) ? INTENSE_COLOR : NORMAL_COLOR;\n }\n }" ]
Creates new metadata template. @param api the API connection to be used. @param scope the scope of the object. @param templateKey a unique identifier for the template. @param displayName the display name of the field. @param hidden whether this template is hidden in the UI. @param fields the ordered set of fields for the template @return the metadata template returned from the server.
[ "public static MetadataTemplate createMetadataTemplate(BoxAPIConnection api, String scope, String templateKey,\n String displayName, boolean hidden, List<Field> fields) {\n\n JsonObject jsonObject = new JsonObject();\n jsonObject.add(\"scope\", scope);\n jsonObject.add(\"displayName\", displayName);\n jsonObject.add(\"hidden\", hidden);\n\n if (templateKey != null) {\n jsonObject.add(\"templateKey\", templateKey);\n }\n\n JsonArray fieldsArray = new JsonArray();\n if (fields != null && !fields.isEmpty()) {\n for (Field field : fields) {\n JsonObject fieldObj = getFieldJsonObject(field);\n\n fieldsArray.add(fieldObj);\n }\n\n jsonObject.add(\"fields\", fieldsArray);\n }\n\n URL url = METADATA_TEMPLATE_SCHEMA_URL_TEMPLATE.build(api.getBaseURL());\n BoxJSONRequest request = new BoxJSONRequest(api, url, \"POST\");\n request.setBody(jsonObject.toString());\n\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n\n return new MetadataTemplate(responseJSON);\n }" ]
[ "public static base_response update(nitro_service client, snmpuser resource) throws Exception {\n\t\tsnmpuser updateresource = new snmpuser();\n\t\tupdateresource.name = resource.name;\n\t\tupdateresource.group = resource.group;\n\t\tupdateresource.authtype = resource.authtype;\n\t\tupdateresource.authpasswd = resource.authpasswd;\n\t\tupdateresource.privtype = resource.privtype;\n\t\tupdateresource.privpasswd = resource.privpasswd;\n\t\treturn updateresource.update_resource(client);\n\t}", "private void updateMaxMin(IntervalRBTreeNode<T> n, IntervalRBTreeNode<T> c) {\n if (c != null) {\n if (n.max < c.max) {\n n.max = c.max;\n }\n if (n.min > c.min) {\n n.min = c.min;\n }\n }\n }", "public static authenticationradiuspolicy_vpnvserver_binding[] get(nitro_service service, String name) throws Exception{\n\t\tauthenticationradiuspolicy_vpnvserver_binding obj = new authenticationradiuspolicy_vpnvserver_binding();\n\t\tobj.set_name(name);\n\t\tauthenticationradiuspolicy_vpnvserver_binding response[] = (authenticationradiuspolicy_vpnvserver_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "public void work(RepositoryHandler repoHandler, DbProduct product) {\n if (!product.getDeliveries().isEmpty()) {\n\n product.getDeliveries().forEach(delivery -> {\n\n final Set<Artifact> artifacts = new HashSet<>();\n\n final DataFetchingUtils utils = new DataFetchingUtils();\n final DependencyHandler depHandler = new DependencyHandler(repoHandler);\n final Set<String> deliveryDependencies = utils.getDeliveryDependencies(repoHandler, depHandler, delivery);\n\n final Set<String> fullGAVCSet = deliveryDependencies.stream().filter(DataUtils::isFullGAVC).collect(Collectors.toSet());\n final Set<String> shortIdentiferSet = deliveryDependencies.stream().filter(entry -> !DataUtils.isFullGAVC(entry)).collect(Collectors.toSet());\n\n\n processDependencySet(repoHandler,\n shortIdentiferSet,\n batch -> String.format(BATCH_TEMPLATE_REGEX, StringUtils.join(batch, '|')),\n 1,\n artifacts::add\n );\n\n processDependencySet(repoHandler,\n fullGAVCSet,\n batch -> QueryUtils.quoteIds(batch, BATCH_TEMPLATE),\n 10,\n artifacts::add\n );\n\n if (!artifacts.isEmpty()) {\n delivery.setAllArtifactDependencies(new ArrayList<>(artifacts));\n }\n });\n\n repoHandler.store(product);\n }\n }", "protected void addArguments(FieldDescriptor field[])\r\n {\r\n for (int i = 0; i < field.length; i++)\r\n {\r\n ArgumentDescriptor arg = new ArgumentDescriptor(this);\r\n arg.setValue(field[i].getAttributeName(), false);\r\n this.addArgument(arg);\r\n }\r\n }", "public void set(int index, T object) {\n synchronized (mLock) {\n if (mOriginalValues != null) {\n mOriginalValues.set(index, object);\n } else {\n mObjects.set(index, object);\n }\n }\n if (mNotifyOnChange) notifyDataSetChanged();\n }", "@Override\n public void stopTransition() {\n //call listeners so they can perform their actions first, like modifying this adapter's transitions\n for (int i = 0, size = mListenerList.size(); i < size; i++) {\n mListenerList.get(i).onTransitionEnd(this);\n }\n\n for (int i = 0, size = mTransitionList.size(); i < size; i++) {\n mTransitionList.get(i).stopTransition();\n }\n }", "private ProjectFile handleSQLiteFile(InputStream stream) throws Exception\n {\n File file = InputStreamHelper.writeStreamToTempFile(stream, \".sqlite\");\n\n try\n {\n Class.forName(\"org.sqlite.JDBC\");\n String url = \"jdbc:sqlite:\" + file.getCanonicalPath();\n Set<String> tableNames = populateTableNames(url);\n\n if (tableNames.contains(\"EXCEPTIONN\"))\n {\n return readProjectFile(new AstaDatabaseFileReader(), file);\n }\n\n if (tableNames.contains(\"PROJWBS\"))\n {\n Connection connection = null;\n try\n {\n Properties props = new Properties();\n props.setProperty(\"date_string_format\", \"yyyy-MM-dd HH:mm:ss\");\n connection = DriverManager.getConnection(url, props);\n PrimaveraDatabaseReader reader = new PrimaveraDatabaseReader();\n reader.setConnection(connection);\n addListeners(reader);\n return reader.read();\n }\n finally\n {\n if (connection != null)\n {\n connection.close();\n }\n }\n }\n\n if (tableNames.contains(\"ZSCHEDULEITEM\"))\n {\n return readProjectFile(new MerlinReader(), file);\n }\n\n return null;\n }\n\n finally\n {\n FileHelper.deleteQuietly(file);\n }\n }", "public String getModulePaths() {\n final StringBuilder result = new StringBuilder();\n if (addDefaultModuleDir) {\n result.append(wildflyHome.resolve(\"modules\").toString());\n }\n if (!modulesDirs.isEmpty()) {\n if (addDefaultModuleDir) result.append(File.pathSeparator);\n for (Iterator<String> iterator = modulesDirs.iterator(); iterator.hasNext(); ) {\n result.append(iterator.next());\n if (iterator.hasNext()) {\n result.append(File.pathSeparator);\n }\n }\n }\n return result.toString();\n }" ]
Get file size @return Long
[ "public static Long getSize(final File file){\n if ( file!=null && file.exists() ){\n return file.length();\n }\n return null;\n }" ]
[ "public static dnsnsecrec get(nitro_service service, String hostname) throws Exception{\n\t\tdnsnsecrec obj = new dnsnsecrec();\n\t\tobj.set_hostname(hostname);\n\t\tdnsnsecrec response = (dnsnsecrec) obj.get_resource(service);\n\t\treturn response;\n\t}", "public void addConverter(int index, IConverter converter) {\r\n\t\tconverterList.add(index, converter);\r\n\t\tif (converter instanceof IContainerConverter) {\r\n\t\t\tIContainerConverter containerConverter = (IContainerConverter) converter;\r\n\t\t\tif (containerConverter.getElementConverter() == null) {\r\n\t\t\t\tcontainerConverter.setElementConverter(elementConverter);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "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 int[] getCompressIndexAndCount(CompressOptions options, boolean createMixed) {\n\t\tif(options != null) {\n\t\t\tCompressionChoiceOptions rangeSelection = options.rangeSelection;\n\t\t\tRangeList compressibleSegs = rangeSelection.compressHost() ? getZeroRangeSegments() : getZeroSegments();\n\t\t\tint maxIndex = -1, maxCount = 0;\n\t\t\tint segmentCount = getSegmentCount();\n\t\t\t\n\t\t\tboolean compressMixed = createMixed && options.compressMixedOptions.compressMixed(this);\n\t\t\tboolean preferHost = (rangeSelection == CompressOptions.CompressionChoiceOptions.HOST_PREFERRED);\n\t\t\tboolean preferMixed = createMixed && (rangeSelection == CompressOptions.CompressionChoiceOptions.MIXED_PREFERRED);\n\t\t\tfor(int i = compressibleSegs.size() - 1; i >= 0 ; i--) {\n\t\t\t\tRange range = compressibleSegs.getRange(i);\n\t\t\t\tint index = range.index;\n\t\t\t\tint count = range.length;\n\t\t\t\tif(createMixed) {\n\t\t\t\t\t//so here we shorten the range to exclude the mixed part if necessary\n\t\t\t\t\tint mixedIndex = IPv6Address.MIXED_ORIGINAL_SEGMENT_COUNT - addressSegmentIndex;\n\t\t\t\t\tif(!compressMixed ||\n\t\t\t\t\t\t\tindex > mixedIndex || index + count < segmentCount) { //range does not include entire mixed part. We never compress only part of a mixed part.\n\t\t\t\t\t\t//the compressible range must stop at the mixed part\n\t\t\t\t\t\tcount = Math.min(count, mixedIndex - index);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//select this range if is the longest\n\t\t\t\tif(count > 0 && count >= maxCount && (options.compressSingle || count > 1)) {\n\t\t\t\t\tmaxIndex = index;\n\t\t\t\t\tmaxCount = count;\n\t\t\t\t}\n\t\t\t\tif(preferHost && isPrefixed() &&\n\t\t\t\t\t\t((index + count) * IPv6Address.BITS_PER_SEGMENT) > getNetworkPrefixLength()) { //this range contains the host\n\t\t\t\t\t//Since we are going backwards, this means we select as the maximum any zero segment that includes the host\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(preferMixed && index + count >= segmentCount) { //this range contains the mixed section\n\t\t\t\t\t//Since we are going backwards, this means we select to compress the mixed segment\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(maxIndex >= 0) {\n\t\t\t\treturn new int[] {maxIndex, maxCount};\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "public CompositeGeneratorNode appendTemplate(final CompositeGeneratorNode parent, final StringConcatenationClient templateString) {\n final TemplateNode proc = new TemplateNode(templateString, this);\n List<IGeneratorNode> _children = parent.getChildren();\n _children.add(proc);\n return parent;\n }", "public void forAllTables(String template, Properties attributes) throws XDocletException\r\n {\r\n for (Iterator it = _torqueModel.getTables(); it.hasNext(); )\r\n {\r\n _curTableDef = (TableDef)it.next();\r\n generate(template);\r\n }\r\n _curTableDef = null;\r\n }", "public synchronized boolean acquireRebalancingPermit(int nodeId) {\n boolean added = rebalancePermits.add(nodeId);\n logger.info(\"Acquiring rebalancing permit for node id \" + nodeId + \", returned: \" + added);\n\n return added;\n }", "public IPv6AddressSegment join(IPv6AddressCreator creator, IPv4AddressSegment low) throws IncompatibleAddressException {\r\n\t\tint shift = IPv4Address.BITS_PER_SEGMENT;\r\n\t\tInteger prefix = getJoinedSegmentPrefixLength(shift, getSegmentPrefixLength(), low.getSegmentPrefixLength());\r\n\t\tif(isMultiple()) {\r\n\t\t\t//if the high segment has a range, the low segment must match the full range, \r\n\t\t\t//otherwise it is not possible to create an equivalent range when joining\r\n\t\t\tif(!low.isFullRange()) {\r\n\t\t\t\tthrow new IncompatibleAddressException(this, low, \"ipaddress.error.invalidMixedRange\");\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn creator.createSegment(\r\n\t\t\t\t(getSegmentValue() << shift) | low.getSegmentValue(), \r\n\t\t\t\t(getUpperSegmentValue() << shift) | low.getUpperSegmentValue(),\r\n\t\t\t\tprefix);\r\n\t}", "public ProjectCalendarHours addCalendarHours(Day day)\n {\n ProjectCalendarHours bch = new ProjectCalendarHours(this);\n bch.setDay(day);\n m_hours[day.getValue() - 1] = bch;\n return (bch);\n }" ]
Adds a parameter to the MIMEType. @param name name of parameter @param value value of parameter @return returns a new instance with the parameter set
[ "public MIMEType addParameter(String name, String value) {\n Map<String, String> copy = new LinkedHashMap<>(this.parameters);\n copy.put(name, value);\n return new MIMEType(type, subType, copy);\n }" ]
[ "public Map<String, String> listConfig(String appName) {\n return connection.execute(new ConfigList(appName), apiKey);\n }", "public static String resourceTypeFromResourceId(String id) {\n return (id != null) ? ResourceId.fromString(id).resourceType() : null;\n }", "public Date toDate(Object date) {\n\n Date d = null;\n if (null != date) {\n if (date instanceof Date) {\n d = (Date)date;\n } else if (date instanceof Long) {\n d = new Date(((Long)date).longValue());\n } else {\n try {\n long l = Long.parseLong(date.toString());\n d = new Date(l);\n } catch (Exception e) {\n // do nothing, just let d remain null\n }\n }\n }\n return d;\n }", "public void cross(Vector3d v1, Vector3d v2) {\n double tmpx = v1.y * v2.z - v1.z * v2.y;\n double tmpy = v1.z * v2.x - v1.x * v2.z;\n double tmpz = v1.x * v2.y - v1.y * v2.x;\n\n x = tmpx;\n y = tmpy;\n z = tmpz;\n }", "public static Iterable<BoxCollection.Info> getAllCollections(final BoxAPIConnection api) {\n return new Iterable<BoxCollection.Info>() {\n public Iterator<BoxCollection.Info> iterator() {\n URL url = GET_COLLECTIONS_URL_TEMPLATE.build(api.getBaseURL());\n return new BoxCollectionIterator(api, url);\n }\n };\n }", "public static <T> void filterListToMap(final Map<String, T> destinationMap, final String[] nameMapping,\n\t\tfinal List<? extends T> sourceList) {\n\t\tif( destinationMap == null ) {\n\t\t\tthrow new NullPointerException(\"destinationMap should not be null\");\n\t\t} else if( nameMapping == null ) {\n\t\t\tthrow new NullPointerException(\"nameMapping should not be null\");\n\t\t} else if( sourceList == null ) {\n\t\t\tthrow new NullPointerException(\"sourceList should not be null\");\n\t\t} else if( nameMapping.length != sourceList.size() ) {\n\t\t\tthrow new SuperCsvException(\n\t\t\t\tString\n\t\t\t\t\t.format(\n\t\t\t\t\t\t\"the nameMapping array and the sourceList should be the same size (nameMapping length = %d, sourceList size = %d)\",\n\t\t\t\t\t\tnameMapping.length, sourceList.size()));\n\t\t}\n\t\t\n\t\tdestinationMap.clear();\n\t\t\n\t\tfor( int i = 0; i < nameMapping.length; i++ ) {\n\t\t\tfinal String key = nameMapping[i];\n\t\t\t\n\t\t\tif( key == null ) {\n\t\t\t\tcontinue; // null's in the name mapping means skip column\n\t\t\t}\n\t\t\t\n\t\t\t// no duplicates allowed\n\t\t\tif( destinationMap.containsKey(key) ) {\n\t\t\t\tthrow new SuperCsvException(String.format(\"duplicate nameMapping '%s' at index %d\", key, i));\n\t\t\t}\n\t\t\t\n\t\t\tdestinationMap.put(key, sourceList.get(i));\n\t\t}\n\t}", "public GVRShaderId getShaderType(Class<? extends GVRShader> shaderClass)\n {\n GVRShaderId shaderId = mShaderTemplates.get(shaderClass);\n\n if (shaderId == null)\n {\n GVRContext ctx = getGVRContext();\n shaderId = new GVRShaderId(shaderClass);\n mShaderTemplates.put(shaderClass, shaderId);\n shaderId.getTemplate(ctx);\n }\n return shaderId;\n }", "void updateFromResponseOnPutPatch(Response<ResponseBody> response) throws CloudException, IOException {\n String responseContent = null;\n if (response.body() != null) {\n responseContent = response.body().string();\n response.body().close();\n }\n\n if (responseContent == null || responseContent.isEmpty()) {\n throw new CloudException(\"polling response does not contain a valid body\", response);\n }\n\n PollingResource resource = serializerAdapter.deserialize(responseContent, PollingResource.class);\n final int statusCode = response.code();\n if (resource != null && resource.properties != null && resource.properties.provisioningState != null) {\n this.withStatus(resource.properties.provisioningState, statusCode);\n } else {\n this.withStatus(AzureAsyncOperation.SUCCESS_STATUS, statusCode);\n }\n\n CloudError error = new CloudError();\n this.withErrorBody(error);\n error.withCode(this.status());\n error.withMessage(\"Long running operation failed\");\n this.withResponse(response);\n this.withResource(serializerAdapter.<T>deserialize(responseContent, resourceType));\n }", "public static<A, B, Z> Function2<A, B, Z> lift(Func2<A, B, Z> f) {\n\treturn bridge.lift(f);\n }" ]
Use this API to fetch responderpolicylabel_responderpolicy_binding resources of given name .
[ "public static responderpolicylabel_responderpolicy_binding[] get(nitro_service service, String labelname) throws Exception{\n\t\tresponderpolicylabel_responderpolicy_binding obj = new responderpolicylabel_responderpolicy_binding();\n\t\tobj.set_labelname(labelname);\n\t\tresponderpolicylabel_responderpolicy_binding response[] = (responderpolicylabel_responderpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}" ]
[ "public final ReadOnlyObjectProperty<LatLongBounds> boundsProperty() {\n if (bounds == null) {\n bounds = new ReadOnlyObjectWrapper<>(getBounds());\n addStateEventHandler(MapStateEventType.idle, () -> {\n bounds.set(getBounds());\n });\n }\n return bounds.getReadOnlyProperty();\n }", "public ParallelTaskBuilder setResponseContext(\n Map<String, Object> responseContext) {\n if (responseContext != null)\n this.responseContext = responseContext;\n else\n logger.error(\"context cannot be null. skip set.\");\n return this;\n }", "public void removeAccessory(HomekitAccessory accessory) {\n this.registry.remove(accessory);\n logger.info(\"Removed accessory \" + accessory.getLabel());\n if (started) {\n registry.reset();\n webHandler.resetConnections();\n }\n }", "protected TokenList.Token parseSubmatrixToExtract(TokenList.Token variableTarget,\n TokenList tokens, Sequence sequence) {\n\n\n List<TokenList.Token> inputs = parseParameterCommaBlock(tokens, sequence);\n\n List<Variable> variables = new ArrayList<Variable>();\n\n // for the operation, the first variable must be the matrix which is being manipulated\n variables.add(variableTarget.getVariable());\n\n addSubMatrixVariables(inputs, variables);\n if( variables.size() != 2 && variables.size() != 3 ) {\n throw new ParseError(\"Unexpected number of variables. 1 or 2 expected\");\n }\n\n // first parameter is the matrix it will be extracted from. rest specify range\n Operation.Info info;\n\n // only one variable means its referencing elements\n // two variables means its referencing a sub matrix\n if( inputs.size() == 1 ) {\n Variable varA = variables.get(1);\n if( varA.getType() == VariableType.SCALAR ) {\n info = functions.create(\"extractScalar\", variables);\n } else {\n info = functions.create(\"extract\", variables);\n }\n } else if( inputs.size() == 2 ) {\n Variable varA = variables.get(1);\n Variable varB = variables.get(2);\n\n if( varA.getType() == VariableType.SCALAR && varB.getType() == VariableType.SCALAR) {\n info = functions.create(\"extractScalar\", variables);\n } else {\n info = functions.create(\"extract\", variables);\n }\n } else {\n throw new ParseError(\"Expected 2 inputs to sub-matrix\");\n }\n\n sequence.addOperation(info.op);\n\n return new TokenList.Token(info.output);\n }", "public byte byteAt(int i) {\n\n if (i < 0) {\n throw new IndexOutOfBoundsException(\"i < 0, \" + i);\n }\n\n if (i >= length) {\n throw new IndexOutOfBoundsException(\"i >= length, \" + i + \" >= \" + length);\n }\n\n return data[offset + i];\n }", "@SuppressWarnings(\"unchecked\")\n public static <T> T getJlsDefaultValue(Class<T> type) {\n if(!type.isPrimitive()) {\n return null;\n }\n return (T) JLS_PRIMITIVE_DEFAULT_VALUES.get(type);\n }", "public void updateInfo(BoxWebLink.Info info) {\n URL url = WEB_LINK_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, \"PUT\");\n request.setBody(info.getPendingChanges());\n String body = info.getPendingChanges();\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject jsonObject = JsonObject.readFrom(response.getJSON());\n info.update(jsonObject);\n }", "public static List<Integer> getStolenPrimaryPartitions(final Cluster currentCluster,\n final Cluster finalCluster,\n final int stealNodeId) {\n List<Integer> finalList = new ArrayList<Integer>(finalCluster.getNodeById(stealNodeId)\n .getPartitionIds());\n\n List<Integer> currentList = new ArrayList<Integer>();\n if(currentCluster.hasNodeWithId(stealNodeId)) {\n currentList = currentCluster.getNodeById(stealNodeId).getPartitionIds();\n } else {\n if(logger.isDebugEnabled()) {\n logger.debug(\"Current cluster does not contain stealer node (cluster : [[[\"\n + currentCluster + \"]]], node id \" + stealNodeId + \")\");\n }\n }\n finalList.removeAll(currentList);\n\n return finalList;\n }", "public void clearResponseSettings(int pathId, String clientUUID) throws Exception {\n logger.info(\"clearing response settings\");\n this.setResponseEnabled(pathId, false, clientUUID);\n OverrideService.getInstance().disableAllOverrides(pathId, clientUUID, Constants.OVERRIDE_TYPE_RESPONSE);\n EditService.getInstance().updateRepeatNumber(Constants.OVERRIDE_TYPE_RESPONSE, pathId, clientUUID);\n }" ]
Find the scheme to use to connect to the service. Uses java annotations first and if not found, uses kubernetes annotations on the service object. @param service The target service. @param qualifiers The set of qualifiers. @return Returns the resolved scheme of 'http' as a fallback.
[ "private static String getScheme(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\n return DEFAULT_SCHEME;\n }" ]
[ "public float getBoundsWidth() {\n if (mSceneObject != null) {\n GVRSceneObject.BoundingVolume v = mSceneObject.getBoundingVolume();\n return v.maxCorner.x - v.minCorner.x;\n }\n return 0f;\n }", "private static void bodyWithConcatenation(\n SourceBuilder code,\n Map<Property, PropertyCodeGenerator> generatorsByProperty,\n String typename) {\n code.add(\" return \\\"%s{\", typename);\n String prefix = \"\";\n for (Property property : generatorsByProperty.keySet()) {\n PropertyCodeGenerator generator = generatorsByProperty.get(property);\n code.add(\"%s%s=\\\" + %s + \\\"\",\n prefix, property.getName(), (Excerpt) generator::addToStringValue);\n prefix = \", \";\n }\n code.add(\"}\\\";%n\");\n }", "public static String getParentDirectory(String filePath) throws IllegalArgumentException {\n if (Pattern.matches(sPatternUrl, filePath))\n return getURLParentDirectory(filePath);\n\n return new File(filePath).getParent();\n }", "private static boolean isWideningPrimitive(Class<?> argumentClass, Class<?> targetClass) {\n return WIDENING_TABLE.containsKey(argumentClass) && WIDENING_TABLE.get(argumentClass).contains(targetClass);\n }", "@Nullable\n public T getItem(final int position) {\n if (position < 0 || position >= mObjects.size()) {\n return null;\n }\n return mObjects.get(position);\n }", "public static boolean decomposeSafe(DecompositionInterface<ZMatrixRMaj> decomposition, ZMatrixRMaj a) {\n\n if( decomposition.inputModified() ) {\n a = a.copy();\n }\n return decomposition.decompose(a);\n }", "public ByteBuffer[] toDirectByteBuffers(long offset, long size) {\n long pos = offset;\n long blockSize = Integer.MAX_VALUE;\n long limit = offset + size;\n int numBuffers = (int) ((size + (blockSize - 1)) / blockSize);\n ByteBuffer[] result = new ByteBuffer[numBuffers];\n int index = 0;\n while (pos < limit) {\n long blockLength = Math.min(limit - pos, blockSize);\n result[index++] = UnsafeUtil.newDirectByteBuffer(address() + pos, (int) blockLength, this)\n .order(ByteOrder.nativeOrder());\n pos += blockLength;\n }\n return result;\n\n }", "public static OgmCollectionPersister getInverseCollectionPersister(OgmCollectionPersister mainSidePersister) {\n\t\tif ( mainSidePersister.isInverse() || !mainSidePersister.isManyToMany() || !mainSidePersister.getElementType().isEntityType() ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tEntityPersister inverseSidePersister = mainSidePersister.getElementPersister();\n\n\t\t// process collection-typed properties of inverse side and try to find association back to main side\n\t\tfor ( Type type : inverseSidePersister.getPropertyTypes() ) {\n\t\t\tif ( type.isCollectionType() ) {\n\t\t\t\tOgmCollectionPersister inverseCollectionPersister = getPersister( mainSidePersister.getFactory(), (CollectionType) type );\n\t\t\t\tif ( isCollectionMatching( mainSidePersister, inverseCollectionPersister ) ) {\n\t\t\t\t\treturn inverseCollectionPersister;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}", "public static <IN> PaddedList<IN> valueOf(List<IN> list, IN padding) {\r\n return new PaddedList<IN>(list, padding);\r\n }" ]
Connect sync. @param configuration the protocol configuration @return the connection @throws IOException
[ "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 }" ]
[ "public void addChildTask(Task child)\n {\n child.m_parent = this;\n m_children.add(child);\n setSummary(true);\n\n if (getParentFile().getProjectConfig().getAutoOutlineLevel() == true)\n {\n child.setOutlineLevel(Integer.valueOf(NumberHelper.getInt(getOutlineLevel()) + 1));\n }\n }", "public static String fill(int color) {\n final String colorCode = Integer.toHexString(color & 0xFFFFFF); // Strip alpha\n return FILTER_FILL + \"(\" + colorCode + \")\";\n }", "public synchronized void stop() {\n if (isRunning()) {\n running.set(false);\n DeviceFinder.getInstance().removeDeviceAnnouncementListener(announcementListener);\n dbServerPorts.clear();\n for (Client client : openClients.values()) {\n try {\n client.close();\n } catch (Exception e) {\n logger.warn(\"Problem closing \" + client + \" when stopping\", e);\n }\n }\n openClients.clear();\n useCounts.clear();\n deliverLifecycleAnnouncement(logger, false);\n }\n }", "public static snmpmanager[] get(nitro_service service) throws Exception{\n\t\tsnmpmanager obj = new snmpmanager();\n\t\tsnmpmanager[] response = (snmpmanager[])obj.get_resources(service);\n\t\treturn response;\n\t}", "protected B fields(List<F> fields) {\n if (instance.def.fields == null) {\n instance.def.fields = new ArrayList<F>(fields.size());\n }\n instance.def.fields.addAll(fields);\n return returnThis();\n }", "public static FullTypeSignature getTypeSignature(Class<?> clazz, Class<?>[] typeArgs) {\n\t\tClassTypeSignature rawClassTypeSignature = (ClassTypeSignature) javaTypeToTypeSignature\n\t\t\t\t.getTypeSignature(clazz);\n\t\tTypeArgSignature[] typeArgSignatures = new TypeArgSignature[typeArgs.length];\n\t\tfor (int i = 0; i < typeArgs.length; i++) {\n\t\t\ttypeArgSignatures[i] = new TypeArgSignature(\n\t\t\t\t\tTypeArgSignature.NO_WILDCARD,\n\t\t\t\t\t(FieldTypeSignature) javaTypeToTypeSignature\n\t\t\t\t\t\t\t.getTypeSignature(typeArgs[i]));\n\t\t}\n\t\tClassTypeSignature classTypeSignature = new ClassTypeSignature(\n\t\t\t\trawClassTypeSignature.getBinaryName(), typeArgSignatures,\n\t\t\t\trawClassTypeSignature.getOwnerTypeSignature());\n\n\t\treturn classTypeSignature;\n\t}", "public void startScenario( Class<?> testClass, Method method, List<NamedArgument> arguments ) {\n listener.scenarioStarted( testClass, method, arguments );\n\n if( method.isAnnotationPresent( Pending.class ) ) {\n Pending annotation = method.getAnnotation( Pending.class );\n\n if( annotation.failIfPass() ) {\n failIfPass();\n } else if( !annotation.executeSteps() ) {\n methodInterceptor.disableMethodExecution();\n executeLifeCycleMethods = false;\n }\n suppressExceptions = true;\n } else if( method.isAnnotationPresent( NotImplementedYet.class ) ) {\n NotImplementedYet annotation = method.getAnnotation( NotImplementedYet.class );\n\n if( annotation.failIfPass() ) {\n failIfPass();\n } else if( !annotation.executeSteps() ) {\n methodInterceptor.disableMethodExecution();\n executeLifeCycleMethods = false;\n }\n suppressExceptions = true;\n }\n\n }", "public static void clearallLocalDBs() {\n for (final Map.Entry<MongoClient, Boolean> entry : localInstances.entrySet()) {\n for (final String dbName : entry.getKey().listDatabaseNames()) {\n entry.getKey().getDatabase(dbName).drop();\n }\n }\n }", "public static final String printExtendedAttributeCurrency(Number value)\n {\n return (value == null ? null : NUMBER_FORMAT.get().format(value.doubleValue() * 100));\n }" ]
Installs a provider either in the scope or the pool of unbound providers. @param clazz the class for which to install the provider. @param bindingName the name, possibly {@code null}, for which to install the scoped provider. @param internalProvider the internal provider to install. @param isBound whether or not the provider is bound to the scope or belongs to the pool of unbound providers. @param isTestProvider whether or not is a test provider, installed through a Test Module that should override existing providers for the same class-bindingname. @param <T> the type of {@code clazz}. Note to maintainers : we don't use this method directly, both {@link #installBoundProvider(Class, String, InternalProviderImpl, boolean)} and {@link #installUnBoundProvider(Class, String, InternalProviderImpl)} are a facade of this method and make the calls more clear.
[ "private <T> InternalProviderImpl installInternalProvider(Class<T> clazz, String bindingName, InternalProviderImpl<? extends T> internalProvider,\n boolean isBound, boolean isTestProvider) {\n if (bindingName == null) {\n if (isBound) {\n return installUnNamedProvider(mapClassesToUnNamedBoundProviders, clazz, internalProvider, isTestProvider);\n } else {\n return installUnNamedProvider(mapClassesToUnNamedUnBoundProviders, clazz, internalProvider, isTestProvider);\n }\n } else {\n return installNamedProvider(mapClassesToNamedBoundProviders, clazz, bindingName, internalProvider, isTestProvider);\n }\n }" ]
[ "public Iterable<BoxItem.Info> getChildren(final String... fields) {\n return new Iterable<BoxItem.Info>() {\n @Override\n public Iterator<BoxItem.Info> iterator() {\n String queryString = new QueryStringBuilder().appendParam(\"fields\", fields).toString();\n URL url = GET_ITEMS_URL.buildWithQuery(getAPI().getBaseURL(), queryString, getID());\n return new BoxItemIterator(getAPI(), url);\n }\n };\n }", "private static <D, T> D createDaoFromConfig(ConnectionSource connectionSource, Class<T> clazz) throws SQLException {\n\t\t// no loaded configs\n\t\tif (configMap == null) {\n\t\t\treturn null;\n\t\t}\n\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tDatabaseTableConfig<T> config = (DatabaseTableConfig<T>) configMap.get(clazz);\n\t\t// if we don't config information cached return null\n\t\tif (config == null) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// else create a DAO using configuration\n\t\tDao<T, ?> configedDao = doCreateDao(connectionSource, config);\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tD castDao = (D) configedDao;\n\t\treturn castDao;\n\t}", "public long removeRangeByLex(final LexRange lexRange) {\n return doWithJedis(new JedisCallable<Long>() {\n @Override\n public Long call(Jedis jedis) {\n return jedis.zremrangeByLex(getKey(), lexRange.from(), lexRange.to());\n }\n });\n }", "public static String getTokenText(INode node) {\n\t\tif (node instanceof ILeafNode)\n\t\t\treturn ((ILeafNode) node).getText();\n\t\telse {\n\t\t\tStringBuilder builder = new StringBuilder(Math.max(node.getTotalLength(), 1));\n\t\t\tboolean hiddenSeen = false;\n\t\t\tfor (ILeafNode leaf : node.getLeafNodes()) {\n\t\t\t\tif (!leaf.isHidden()) {\n\t\t\t\t\tif (hiddenSeen && builder.length() > 0)\n\t\t\t\t\t\tbuilder.append(' ');\n\t\t\t\t\tbuilder.append(leaf.getText());\n\t\t\t\t\thiddenSeen = false;\n\t\t\t\t} else {\n\t\t\t\t\thiddenSeen = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn builder.toString();\n\t\t}\n\t}", "public ItemRequest<Webhook> deleteById(String webhook) {\n \n String path = String.format(\"/webhooks/%s\", webhook);\n return new ItemRequest<Webhook>(this, Webhook.class, path, \"DELETE\");\n }", "public ReferenceDescriptorDef getReference(String name)\r\n {\r\n ReferenceDescriptorDef refDef;\r\n\r\n for (Iterator it = _references.iterator(); it.hasNext(); )\r\n {\r\n refDef = (ReferenceDescriptorDef)it.next();\r\n if (refDef.getName().equals(name))\r\n {\r\n return refDef;\r\n }\r\n }\r\n return null;\r\n }", "public static Configuration loadFromString(String config)\n throws IOException, SAXException {\n ConfigurationImpl cfg = new ConfigurationImpl();\n\n XMLReader parser = XMLReaderFactory.createXMLReader();\n parser.setContentHandler(new ConfigHandler(cfg, null));\n Reader reader = new StringReader(config);\n parser.parse(new InputSource(reader));\n return cfg;\n }", "public static List<CompiledAutomaton> createAutomata(String prefix,\n String regexp, Map<String, Automaton> automatonMap) throws IOException {\n List<CompiledAutomaton> list = new ArrayList<>();\n Automaton automatonRegexp = null;\n if (regexp != null) {\n RegExp re = new RegExp(prefix + MtasToken.DELIMITER + regexp + \"\\u0000*\");\n automatonRegexp = re.toAutomaton();\n }\n int step = 500;\n List<String> keyList = new ArrayList<>(automatonMap.keySet());\n for (int i = 0; i < keyList.size(); i += step) {\n int localStep = step;\n boolean success = false;\n CompiledAutomaton compiledAutomaton = null;\n while (!success) {\n success = true;\n int next = Math.min(keyList.size(), i + localStep);\n List<Automaton> listAutomaton = new ArrayList<>();\n for (int j = i; j < next; j++) {\n listAutomaton.add(automatonMap.get(keyList.get(j)));\n }\n Automaton automatonList = Operations.union(listAutomaton);\n Automaton automaton;\n if (automatonRegexp != null) {\n automaton = Operations.intersection(automatonList, automatonRegexp);\n } else {\n automaton = automatonList;\n }\n try {\n compiledAutomaton = new CompiledAutomaton(automaton);\n } catch (TooComplexToDeterminizeException e) {\n log.debug(e);\n success = false;\n if (localStep > 1) {\n localStep /= 2;\n } else {\n throw new IOException(\"TooComplexToDeterminizeException\");\n }\n }\n }\n list.add(compiledAutomaton);\n }\n return list;\n }", "public void deleteMetadata(String templateName, String scope) {\n URL url = METADATA_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID(), scope, templateName);\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"DELETE\");\n BoxAPIResponse response = request.send();\n response.disconnect();\n }" ]
Dumps a texture coordinate set of a mesh to stdout. @param mesh the mesh @param coords the coordinates
[ "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 }" ]
[ "@SuppressWarnings(\"WeakerAccess\")\n public synchronized void stop() {\n if (isRunning()) {\n final Set<DeviceAnnouncement> lastDevices = getCurrentDevices();\n socket.get().close();\n socket.set(null);\n devices.clear();\n firstDeviceTime.set(0);\n // Report the loss of all our devices, on the proper thread, outside our lock\n SwingUtilities.invokeLater(new Runnable() {\n @Override\n public void run() {\n for (DeviceAnnouncement announcement : lastDevices) {\n deliverLostAnnouncement(announcement);\n }\n }\n });\n deliverLifecycleAnnouncement(logger, false);\n }\n }", "public final static String process(final String input, final Configuration configuration)\n {\n try\n {\n return process(new StringReader(input), configuration);\n }\n catch (final IOException e)\n {\n // This _can never_ happen\n return null;\n }\n }", "protected final void verify() {\n collectInitialisers();\n verifyCandidates();\n verifyInitialisers();\n collectPossibleInitialValues();\n verifyPossibleInitialValues();\n collectEffectiveAssignmentInstructions();\n verifyEffectiveAssignmentInstructions();\n collectAssignmentGuards();\n verifyAssignmentGuards();\n end();\n }", "public void finished() throws Throwable {\n if( state == FINISHED ) {\n return;\n }\n\n State previousState = state;\n\n state = FINISHED;\n methodInterceptor.enableMethodInterception( false );\n\n try {\n if( previousState == STARTED ) {\n callFinishLifeCycleMethods();\n }\n } finally {\n listener.scenarioFinished();\n }\n }", "public List<ConnectionInfo> getConnections() {\n final URI uri = uriWithPath(\"./connections/\");\n return Arrays.asList(this.rt.getForObject(uri, ConnectionInfo[].class));\n }", "public ItemRequest<Workspace> removeUser(String workspace) {\n \n String path = String.format(\"/workspaces/%s/removeUser\", workspace);\n return new ItemRequest<Workspace>(this, Workspace.class, path, \"POST\");\n }", "public boolean detectBlackBerryTouch() {\r\n\r\n if (detectBlackBerry()\r\n && ((userAgent.indexOf(deviceBBStorm) != -1)\r\n || (userAgent.indexOf(deviceBBTorch) != -1)\r\n || (userAgent.indexOf(deviceBBBoldTouch) != -1)\r\n || (userAgent.indexOf(deviceBBCurveTouch) != -1))) {\r\n return true;\r\n }\r\n return false;\r\n }", "private static long daysBetween(Date date1, Date date2) {\n long diff;\n if (date2.after(date1)) {\n diff = date2.getTime() - date1.getTime();\n } else {\n diff = date1.getTime() - date2.getTime();\n }\n return diff / (24 * 60 * 60 * 1000);\n }", "public PhotoList<Photo> getPhotos(String photosetId, Set<String> extras, int privacy_filter, int perPage, int page) throws FlickrException {\r\n PhotoList<Photo> photos = new PhotoList<Photo>();\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_GET_PHOTOS);\r\n\r\n parameters.put(\"photoset_id\", photosetId);\r\n\r\n if (perPage > 0) {\r\n parameters.put(\"per_page\", String.valueOf(perPage));\r\n }\r\n\r\n if (page > 0) {\r\n parameters.put(\"page\", String.valueOf(page));\r\n }\r\n\r\n if (privacy_filter > 0) {\r\n parameters.put(\"privacy_filter\", \"\" + privacy_filter);\r\n }\r\n\r\n if (extras != null && !extras.isEmpty()) {\r\n parameters.put(Extras.KEY_EXTRAS, StringUtilities.join(extras, \",\"));\r\n }\r\n\r\n Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n\r\n Element photoset = response.getPayload();\r\n NodeList photoElements = photoset.getElementsByTagName(\"photo\");\r\n photos.setPage(photoset.getAttribute(\"page\"));\r\n photos.setPages(photoset.getAttribute(\"pages\"));\r\n photos.setPerPage(photoset.getAttribute(\"per_page\"));\r\n photos.setTotal(photoset.getAttribute(\"total\"));\r\n\r\n for (int i = 0; i < photoElements.getLength(); i++) {\r\n Element photoElement = (Element) photoElements.item(i);\r\n photos.add(PhotoUtils.createPhoto(photoElement, photoset));\r\n }\r\n\r\n return photos;\r\n }" ]
Checks if the duration option is valid. NOTE: This does NOT check, if too many events are specified. @return a flag, indicating if the duration option is valid.
[ "protected final boolean isDurationValid() {\n\n if (isValidEndTypeForPattern()) {\n switch (getEndType()) {\n case DATE:\n return (getStart().getTime() < (getSeriesEndDate().getTime() + DAY_IN_MILLIS));\n case TIMES:\n return getOccurrences() > 0;\n case SINGLE:\n return true;\n default:\n return false;\n }\n } else {\n return false;\n }\n }" ]
[ "@Override\n public void close() throws VoldemortException {\n logger.debug(\"Close called for read-only store.\");\n this.fileModificationLock.writeLock().lock();\n\n try {\n if(isOpen) {\n this.isOpen = false;\n fileSet.close();\n } else {\n logger.debug(\"Attempt to close already closed store \" + getName());\n }\n } finally {\n this.fileModificationLock.writeLock().unlock();\n }\n }", "public static base_response update(nitro_service client, callhome resource) throws Exception {\n\t\tcallhome updateresource = new callhome();\n\t\tupdateresource.emailaddress = resource.emailaddress;\n\t\tupdateresource.proxymode = resource.proxymode;\n\t\tupdateresource.ipaddress = resource.ipaddress;\n\t\tupdateresource.port = resource.port;\n\t\treturn updateresource.update_resource(client);\n\t}", "private void processCalendar(MapRow row)\n {\n ProjectCalendar calendar = m_project.addCalendar();\n\n Map<UUID, List<DateRange>> dayTypeMap = processDayTypes(row.getRows(\"DAY_TYPES\"));\n\n calendar.setName(row.getString(\"NAME\"));\n\n processRanges(dayTypeMap.get(row.getUUID(\"SUNDAY_DAY_TYPE\")), calendar.addCalendarHours(Day.SUNDAY));\n processRanges(dayTypeMap.get(row.getUUID(\"MONDAY_DAY_TYPE\")), calendar.addCalendarHours(Day.MONDAY));\n processRanges(dayTypeMap.get(row.getUUID(\"TUESDAY_DAY_TYPE\")), calendar.addCalendarHours(Day.TUESDAY));\n processRanges(dayTypeMap.get(row.getUUID(\"WEDNESDAY_DAY_TYPE\")), calendar.addCalendarHours(Day.WEDNESDAY));\n processRanges(dayTypeMap.get(row.getUUID(\"THURSDAY_DAY_TYPE\")), calendar.addCalendarHours(Day.THURSDAY));\n processRanges(dayTypeMap.get(row.getUUID(\"FRIDAY_DAY_TYPE\")), calendar.addCalendarHours(Day.FRIDAY));\n processRanges(dayTypeMap.get(row.getUUID(\"SATURDAY_DAY_TYPE\")), calendar.addCalendarHours(Day.SATURDAY));\n\n for (MapRow assignment : row.getRows(\"DAY_TYPE_ASSIGNMENTS\"))\n {\n Date date = assignment.getDate(\"DATE\");\n processRanges(dayTypeMap.get(assignment.getUUID(\"DAY_TYPE_UUID\")), calendar.addCalendarException(date, date));\n }\n\n m_calendarMap.put(row.getUUID(\"UUID\"), calendar);\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 CustomHeadersInterceptor addHeaderMultimap(Map<String, List<String>> headers) {\n this.headers.putAll(headers);\n return this;\n }", "private void readExceptions(Project.Calendars.Calendar calendar, ProjectCalendar bc)\n {\n Project.Calendars.Calendar.Exceptions exceptions = calendar.getExceptions();\n if (exceptions != null)\n {\n for (Project.Calendars.Calendar.Exceptions.Exception exception : exceptions.getException())\n {\n readException(bc, exception);\n }\n }\n }", "public static ServiceActivator create(final ModelNode endpointConfig, final URI managementURI, final String serverName, final String serverProcessName,\n final String authKey, final boolean managementSubsystemEndpoint, final Supplier<SSLContext> sslContextSupplier) {\n\n return new DomainServerCommunicationServices(endpointConfig, managementURI, serverName, serverProcessName, authKey, managementSubsystemEndpoint, sslContextSupplier);\n }", "public static base_responses unset(nitro_service client, String selectorname[], String args[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (selectorname != null && selectorname.length > 0) {\n\t\t\tnslimitselector unsetresources[] = new nslimitselector[selectorname.length];\n\t\t\tfor (int i=0;i<selectorname.length;i++){\n\t\t\t\tunsetresources[i] = new nslimitselector();\n\t\t\t\tunsetresources[i].selectorname = selectorname[i];\n\t\t\t}\n\t\t\tresult = unset_bulk_request(client, unsetresources,args);\n\t\t}\n\t\treturn result;\n\t}", "public ClassNode annotatedWith(String name) {\n ClassNode anno = infoBase.node(name);\n this.annotations.add(anno);\n anno.annotated.add(this);\n return this;\n }" ]
Clean wait task queue.
[ "public synchronized void cleanWaitTaskQueue() {\n\n for (ParallelTask task : waitQ) {\n task.setState(ParallelTaskState.COMPLETED_WITH_ERROR);\n task.getTaskErrorMetas().add(\n new TaskErrorMeta(TaskErrorType.USER_CANCELED, \"NA\"));\n logger.info(\n \"task {} removed from wait q. This task has been marked as USER CANCELED.\",\n task.getTaskId());\n\n }\n\n waitQ.clear();\n }" ]
[ "private void putEvent(EventType eventType) throws Exception {\n List<EventType> eventTypes = Collections.singletonList(eventType);\n\n int i;\n for (i = 0; i < retryNum; ++i) {\n try {\n monitoringService.putEvents(eventTypes);\n break;\n } catch (Exception e) {\n LOG.log(Level.SEVERE, e.getMessage(), e);\n }\n Thread.sleep(retryDelay);\n }\n\n if (i == retryNum) {\n LOG.warning(\"Could not send events to monitoring service after \" + retryNum + \" retries.\");\n throw new Exception(\"Send SERVER_START/SERVER_STOP event to SAM Server failed\");\n }\n\n }", "protected Iterable<URI> getTargetURIs(final EObject primaryTarget) {\n\t\tfinal TargetURIs result = targetURIsProvider.get();\n\t\turiCollector.add(primaryTarget, result);\n\t\treturn result;\n\t}", "public void clearRequestSettings(int pathId, String clientUUID) throws Exception {\n this.setRequestEnabled(pathId, false, clientUUID);\n OverrideService.getInstance().disableAllOverrides(pathId, clientUUID, Constants.OVERRIDE_TYPE_REQUEST);\n EditService.getInstance().updateRepeatNumber(Constants.OVERRIDE_TYPE_REQUEST, pathId, clientUUID);\n }", "@Pure\n\tpublic static <K, V> Map<K, V> operator_minus(Map<K, V> left, final Map<? extends K, ? extends V> right) {\n\t\treturn Maps.filterEntries(left, new Predicate<Entry<K, V>>() {\n\t\t\t@Override\n\t\t\tpublic boolean apply(Entry<K, V> input) {\n\t\t\t\tfinal V value = right.get(input.getKey());\n\t\t\t\tif (value == null) {\n\t\t\t\t\treturn input.getValue() == null && right.containsKey(input.getKey());\n\t\t\t\t}\n\t\t\t\treturn !Objects.equal(input.getValue(), value);\n\t\t\t}\n\t\t});\n\t}", "public static final Double parsePercent(String value)\n {\n return value == null ? null : Double.valueOf(Double.parseDouble(value) * 100.0);\n }", "public static cmpparameter get(nitro_service service) throws Exception{\n\t\tcmpparameter obj = new cmpparameter();\n\t\tcmpparameter[] response = (cmpparameter[])obj.get_resources(service);\n\t\treturn response[0];\n\t}", "public static void removeZeros( DMatrixSparseCSC input , DMatrixSparseCSC output , double tol ) {\n ImplCommonOps_DSCC.removeZeros(input,output,tol);\n }", "public static int positionOf(char value, char[] array) {\n for (int i = 0; i < array.length; i++) {\n if (value == array[i]) {\n return i;\n }\n }\n throw new OkapiException(\"Unable to find character '\" + value + \"' in character array.\");\n }", "public static HashMap<String, String> getParameters(String query) {\n HashMap<String, String> params = new HashMap<String, String>();\n if (query == null || query.length() == 0) {\n return params;\n }\n\n String[] splitQuery = query.split(\"&\");\n for (String splitItem : splitQuery) {\n String[] items = splitItem.split(\"=\");\n\n if (items.length == 1) {\n params.put(items[0], \"\");\n } else {\n params.put(items[0], items[1]);\n }\n }\n\n return params;\n }" ]
Get the number of views, comments and favorites on a photoset for a given date. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param photosetId (Required) The id of the photoset to get stats for. @see "http://www.flickr.com/services/api/flickr.stats.getPhotosetStats.htm"
[ "public Stats getPhotosetStats(String photosetId, Date date) throws FlickrException {\n return getStats(METHOD_GET_PHOTOSET_STATS, \"photoset_id\", photosetId, date);\n }" ]
[ "public void overrideCubeProperties(DockerCompositions overrideDockerCompositions) {\n final Set<String> containerIds = overrideDockerCompositions.getContainerIds();\n for (String containerId : containerIds) {\n\n // main definition of containers contains a container that must be overrode\n if (containers.containsKey(containerId)) {\n final CubeContainer cubeContainer = containers.get(containerId);\n final CubeContainer overrideCubeContainer = overrideDockerCompositions.get(containerId);\n\n cubeContainer.setRemoveVolumes(overrideCubeContainer.getRemoveVolumes());\n \n cubeContainer.setAlwaysPull(overrideCubeContainer.getAlwaysPull());\n\n if (overrideCubeContainer.hasAwait()) {\n cubeContainer.setAwait(overrideCubeContainer.getAwait());\n }\n\n if (overrideCubeContainer.hasBeforeStop()) {\n cubeContainer.setBeforeStop(overrideCubeContainer.getBeforeStop());\n }\n\n if (overrideCubeContainer.isManual()) {\n cubeContainer.setManual(overrideCubeContainer.isManual());\n }\n\n if (overrideCubeContainer.isKillContainer()) {\n cubeContainer.setKillContainer(overrideCubeContainer.isKillContainer());\n }\n } else {\n logger.warning(String.format(\"Overriding Container %s are not defined in main definition of containers.\",\n containerId));\n }\n }\n }", "public long getLong(Integer type)\n {\n long result = 0;\n\n byte[] item = m_map.get(type);\n if (item != null)\n {\n result = MPPUtility.getLong6(item, 0);\n }\n\n return (result);\n }", "void initialize(DMatrixSparseCSC A) {\n m = A.numRows;\n n = A.numCols;\n int s = 4*n + (ata ? (n+m+1) : 0);\n\n gw.reshape(s);\n w = gw.data;\n\n // compute the transpose of A\n At.reshape(A.numCols,A.numRows,A.nz_length);\n CommonOps_DSCC.transpose(A,At,gw);\n\n // initialize w\n Arrays.fill(w,0,s,-1); // assign all values in workspace to -1\n\n ancestor = 0;\n maxfirst = n;\n prevleaf = 2*n;\n first = 3*n;\n }", "protected ClassDescriptor getClassDescriptor()\r\n {\r\n ClassDescriptor cld = (ClassDescriptor) m_classDescriptor.get();\r\n if(cld == null)\r\n {\r\n throw new OJBRuntimeException(\"Requested ClassDescriptor instance was already GC by JVM\");\r\n }\r\n return cld;\r\n }", "private List<org.jfrog.hudson.pipeline.types.File> getBuildFilesList(Stream<? extends BaseBuildFileBean> buildFilesStream) {\n return buildFilesStream\n .filter(buildFile -> StringUtils.isNotBlank(buildFile.getLocalPath()))\n .filter(buildFile -> StringUtils.isNotBlank(buildFile.getRemotePath()))\n .map(org.jfrog.hudson.pipeline.types.File::new)\n .distinct()\n .collect(Collectors.toList());\n }", "public static boolean isDouble(CharSequence self) {\n try {\n Double.valueOf(self.toString().trim());\n return true;\n } catch (NumberFormatException nfe) {\n return false;\n }\n }", "private static int checkResult(int result)\n {\n if (exceptionsEnabled && result !=\n cudnnStatus.CUDNN_STATUS_SUCCESS)\n {\n throw new CudaException(cudnnStatus.stringFor(result));\n }\n return result;\n }", "@UiHandler(\"m_atNumber\")\r\n void onWeekOfMonthChange(ValueChangeEvent<String> event) {\r\n\r\n if (handleChange()) {\r\n m_controller.setWeekOfMonth(event.getValue());\r\n }\r\n }", "@SuppressWarnings(\"unchecked\")\n public static Map<String, Properties> readMultipleClientConfigAvro(String configAvro) {\n Map<String, Properties> mapStoreToProps = Maps.newHashMap();\n try {\n JsonDecoder decoder = new JsonDecoder(CLIENT_CONFIGS_AVRO_SCHEMA, configAvro);\n GenericDatumReader<Object> datumReader = new GenericDatumReader<Object>(CLIENT_CONFIGS_AVRO_SCHEMA);\n\n Map<Utf8, Map<Utf8, Utf8>> storeConfigs = (Map<Utf8, Map<Utf8, Utf8>>) datumReader.read(null,\n decoder);\n // Store config props to return back\n for(Utf8 storeName: storeConfigs.keySet()) {\n Properties props = new Properties();\n Map<Utf8, Utf8> singleConfig = storeConfigs.get(storeName);\n\n for(Utf8 key: singleConfig.keySet()) {\n props.put(key.toString(), singleConfig.get(key).toString());\n }\n\n if(storeName == null || storeName.length() == 0) {\n throw new Exception(\"Invalid store name found!\");\n }\n\n mapStoreToProps.put(storeName.toString(), props);\n }\n } catch(Exception e) {\n e.printStackTrace();\n }\n return mapStoreToProps;\n }" ]
Specifies the ARM resource id of the user assigned managed service identity resource that should be used to retrieve the access token. @param identityId the ARM resource id of the user assigned identity resource @return MSICredentials
[ "@Beta\n public MSICredentials withIdentityId(String identityId) {\n this.identityId = identityId;\n this.clientId = null;\n this.objectId = null;\n return this;\n }" ]
[ "@ArgumentsChecked\n\t@Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class })\n\tpublic static void isNumber(final boolean condition, @Nonnull final String value) {\n\t\tif (condition) {\n\t\t\tCheck.isNumber(value);\n\t\t}\n\t}", "private void writeResource(Resource record) throws IOException\n {\n m_buffer.setLength(0);\n\n //\n // Write the resource record\n //\n int[] fields = m_resourceModel.getModel();\n\n m_buffer.append(MPXConstants.RESOURCE_RECORD_NUMBER);\n for (int loop = 0; loop < fields.length; loop++)\n {\n int mpxFieldType = fields[loop];\n if (mpxFieldType == -1)\n {\n break;\n }\n\n ResourceField resourceField = MPXResourceField.getMpxjField(mpxFieldType);\n Object value = record.getCachedValue(resourceField);\n value = formatType(resourceField.getDataType(), value);\n\n m_buffer.append(m_delimiter);\n m_buffer.append(format(value));\n }\n\n stripTrailingDelimiters(m_buffer);\n m_buffer.append(MPXConstants.EOL);\n m_writer.write(m_buffer.toString());\n\n //\n // Write the resource notes\n //\n String notes = record.getNotes();\n if (notes.length() != 0)\n {\n writeNotes(MPXConstants.RESOURCE_NOTES_RECORD_NUMBER, notes);\n }\n\n //\n // Write the resource calendar\n //\n if (record.getResourceCalendar() != null)\n {\n writeCalendar(record.getResourceCalendar());\n }\n\n m_eventManager.fireResourceWrittenEvent(record);\n }", "public static base_responses add(nitro_service client, nsip6 resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tnsip6 addresources[] = new nsip6[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\taddresources[i] = new nsip6();\n\t\t\t\taddresources[i].ipv6address = resources[i].ipv6address;\n\t\t\t\taddresources[i].scope = resources[i].scope;\n\t\t\t\taddresources[i].type = resources[i].type;\n\t\t\t\taddresources[i].vlan = resources[i].vlan;\n\t\t\t\taddresources[i].nd = resources[i].nd;\n\t\t\t\taddresources[i].icmp = resources[i].icmp;\n\t\t\t\taddresources[i].vserver = resources[i].vserver;\n\t\t\t\taddresources[i].telnet = resources[i].telnet;\n\t\t\t\taddresources[i].ftp = resources[i].ftp;\n\t\t\t\taddresources[i].gui = resources[i].gui;\n\t\t\t\taddresources[i].ssh = resources[i].ssh;\n\t\t\t\taddresources[i].snmp = resources[i].snmp;\n\t\t\t\taddresources[i].mgmtaccess = resources[i].mgmtaccess;\n\t\t\t\taddresources[i].restrictaccess = resources[i].restrictaccess;\n\t\t\t\taddresources[i].dynamicrouting = resources[i].dynamicrouting;\n\t\t\t\taddresources[i].hostroute = resources[i].hostroute;\n\t\t\t\taddresources[i].ip6hostrtgw = resources[i].ip6hostrtgw;\n\t\t\t\taddresources[i].metric = resources[i].metric;\n\t\t\t\taddresources[i].vserverrhilevel = resources[i].vserverrhilevel;\n\t\t\t\taddresources[i].ospf6lsatype = resources[i].ospf6lsatype;\n\t\t\t\taddresources[i].ospfarea = resources[i].ospfarea;\n\t\t\t\taddresources[i].state = resources[i].state;\n\t\t\t\taddresources[i].map = resources[i].map;\n\t\t\t\taddresources[i].ownernode = resources[i].ownernode;\n\t\t\t\taddresources[i].td = resources[i].td;\n\t\t\t}\n\t\t\tresult = add_bulk_request(client, addresources);\n\t\t}\n\t\treturn result;\n\t}", "public TwoDHashMap<K2, K3, V> getAs2d(final K1 firstKey) {\n\t\tfinal HashMap<K2, HashMap<K3, V>> innerMap1 = map.get(firstKey);\n\t\tif( innerMap1 != null ) {\n\t\t\treturn new TwoDHashMap<K2, K3, V>(innerMap1);\n\t\t} else {\n\t\t\treturn new TwoDHashMap<K2, K3, V>();\n\t\t}\n\t\t\n\t}", "public static boolean isTemplatePath(String string) {\n int sz = string.length();\n if (sz == 0) {\n return true;\n }\n for (int i = 0; i < sz; ++i) {\n char c = string.charAt(i);\n switch (c) {\n case ' ':\n case '\\t':\n case '\\b':\n case '<':\n case '>':\n case '(':\n case ')':\n case '[':\n case ']':\n case '{':\n case '}':\n case '!':\n case '@':\n case '#':\n case '*':\n case '?':\n case '%':\n case '|':\n case ',':\n case ':':\n case ';':\n case '^':\n case '&':\n return false;\n }\n }\n return true;\n }", "public final PrintJobResultExtImpl getResult(final URI reportURI) {\n final CriteriaBuilder builder = getSession().getCriteriaBuilder();\n final CriteriaQuery<PrintJobResultExtImpl> criteria =\n builder.createQuery(PrintJobResultExtImpl.class);\n final Root<PrintJobResultExtImpl> root = criteria.from(PrintJobResultExtImpl.class);\n criteria.where(builder.equal(root.get(\"reportURI\"), reportURI.toString()));\n return getSession().createQuery(criteria).uniqueResult();\n }", "public void alias( double value , String name ) {\n if( isReserved(name))\n throw new RuntimeException(\"Reserved word or contains a reserved character. '\"+name+\"'\");\n\n VariableDouble old = (VariableDouble)variables.get(name);\n if( old == null ) {\n variables.put(name, new VariableDouble(value));\n }else {\n old.value = value;\n }\n }", "public static String getLocalizedKey(Map<String, ?> propertiesMap, String key, Locale locale) {\n\n List<String> localizedKeys = CmsLocaleManager.getLocaleVariants(key, locale, true, false);\n for (String localizedKey : localizedKeys) {\n if (propertiesMap.containsKey(localizedKey)) {\n return localizedKey;\n }\n }\n return key;\n }", "private void writeMapFile(String mapFileName, File jarFile, boolean mapClassMethods) throws IOException, XMLStreamException, ClassNotFoundException, IntrospectionException\n {\n FileWriter fw = new FileWriter(mapFileName);\n XMLOutputFactory xof = XMLOutputFactory.newInstance();\n XMLStreamWriter writer = xof.createXMLStreamWriter(fw);\n //XMLStreamWriter writer = new IndentingXMLStreamWriter(xof.createXMLStreamWriter(fw));\n\n writer.writeStartDocument();\n writer.writeStartElement(\"root\");\n writer.writeStartElement(\"assembly\");\n\n addClasses(writer, jarFile, mapClassMethods);\n\n writer.writeEndElement();\n writer.writeEndElement();\n writer.writeEndDocument();\n writer.flush();\n writer.close();\n\n fw.flush();\n fw.close();\n }" ]
Write a double attribute. @param name attribute name @param value attribute value
[ "public void writeNameValuePair(String name, double value) throws IOException\n {\n internalWriteNameValuePair(name, Double.toString(value));\n }" ]
[ "public FieldType getFieldByAlias(FieldTypeClass typeClass, String alias)\n {\n return m_aliasMap.get(new Pair<FieldTypeClass, String>(typeClass, alias));\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 }", "private static void waitUntilFinished(FluoConfiguration config) {\n try (Environment env = new Environment(config)) {\n List<TableRange> ranges = getRanges(env);\n\n outer: while (true) {\n long ts1 = env.getSharedResources().getOracleClient().getStamp().getTxTimestamp();\n for (TableRange range : ranges) {\n boolean sawNotifications = waitTillNoNotifications(env, range);\n if (sawNotifications) {\n ranges = getRanges(env);\n // This range had notifications. Processing those notifications may have created\n // notifications in previously scanned ranges, so start over.\n continue outer;\n }\n }\n long ts2 = env.getSharedResources().getOracleClient().getStamp().getTxTimestamp();\n\n // Check to ensure the Oracle issued no timestamps during the scan for notifications.\n if (ts2 - ts1 == 1) {\n break;\n }\n }\n } catch (Exception e) {\n log.error(\"An exception was thrown -\", e);\n System.exit(-1);\n }\n }", "public static boolean isRegularQueue(final Jedis jedis, final String key) {\n return LIST.equalsIgnoreCase(jedis.type(key));\n }", "public Configuration getConfiguration(String name) {\n Configuration[] values = getConfigurations(name);\n\n if (values == null) {\n return null;\n }\n\n return values[0];\n }", "public void createNewFile() throws SmbException {\n if( getUncPath0().length() == 1 ) {\n throw new SmbException( \"Invalid operation for workgroups, servers, or shares\" );\n }\n close( open0( O_RDWR | O_CREAT | O_EXCL, 0, ATTR_NORMAL, 0 ), 0L );\n }", "public AssemblyResponse cancelAssembly(String url)\n throws RequestException, LocalOperationException {\n Request request = new Request(this);\n return new AssemblyResponse(request.delete(url, new HashMap<String, Object>()));\n }", "private static void bodyWithBuilder(\n SourceBuilder code,\n Datatype datatype,\n Map<Property, PropertyCodeGenerator> generatorsByProperty,\n String typename,\n Predicate<PropertyCodeGenerator> isOptional) {\n Variable result = new Variable(\"result\");\n\n code.add(\" %1$s %2$s = new %1$s(\\\"%3$s{\", StringBuilder.class, result, typename);\n boolean midStringLiteral = true;\n boolean midAppends = true;\n boolean prependCommas = false;\n\n PropertyCodeGenerator lastOptionalGenerator = generatorsByProperty.values()\n .stream()\n .filter(isOptional)\n .reduce((first, second) -> second)\n .get();\n\n for (Property property : generatorsByProperty.keySet()) {\n PropertyCodeGenerator generator = generatorsByProperty.get(property);\n if (isOptional.test(generator)) {\n if (midStringLiteral) {\n code.add(\"\\\")\");\n }\n if (midAppends) {\n code.add(\";%n \");\n }\n code.add(\"if (\");\n if (generator.initialState() == Initially.OPTIONAL) {\n generator.addToStringCondition(code);\n } else {\n code.add(\"!%s.contains(%s.%s)\",\n UNSET_PROPERTIES, datatype.getPropertyEnum(), property.getAllCapsName());\n }\n code.add(\") {%n %s.append(\\\"\", result);\n if (prependCommas) {\n code.add(\", \");\n }\n code.add(\"%s=\\\").append(%s)\", property.getName(), property.getField());\n if (!prependCommas) {\n code.add(\".append(\\\", \\\")\");\n }\n code.add(\";%n }%n \");\n if (generator.equals(lastOptionalGenerator)) {\n code.add(\"return %s.append(\\\"\", result);\n midStringLiteral = true;\n midAppends = true;\n } else {\n midStringLiteral = false;\n midAppends = false;\n }\n } else {\n if (!midAppends) {\n code.add(\"%s\", result);\n }\n if (!midStringLiteral) {\n code.add(\".append(\\\"\");\n }\n if (prependCommas) {\n code.add(\", \");\n }\n code.add(\"%s=\\\").append(%s)\", property.getName(), (Excerpt) generator::addToStringValue);\n midStringLiteral = false;\n midAppends = true;\n prependCommas = true;\n }\n }\n\n checkState(prependCommas, \"Unexpected state at end of toString method\");\n checkState(midAppends, \"Unexpected state at end of toString method\");\n if (!midStringLiteral) {\n code.add(\".append(\\\"\");\n }\n code.add(\"}\\\").toString();%n\", result);\n }", "public static Date setTime(Date date, Date canonicalTime)\n {\n Date result;\n if (canonicalTime == null)\n {\n result = date;\n }\n else\n {\n //\n // The original naive implementation of this method generated\n // the \"start of day\" date (midnight) for the required day\n // then added the milliseconds from the canonical time\n // to move the time forward to the required point. Unfortunately\n // if the date we'e trying to do this for is the entry or\n // exit from DST, the result is wrong, hence I've switched to\n // the approach below.\n //\n Calendar cal = popCalendar(canonicalTime);\n int dayOffset = cal.get(Calendar.DAY_OF_YEAR) - 1;\n int hourOfDay = cal.get(Calendar.HOUR_OF_DAY);\n int minute = cal.get(Calendar.MINUTE);\n int second = cal.get(Calendar.SECOND);\n int millisecond = cal.get(Calendar.MILLISECOND);\n\n cal.setTime(date);\n\n if (dayOffset != 0)\n {\n // The canonical time can be +1 day.\n // It's to do with the way we've historically\n // managed time ranges and midnight.\n cal.add(Calendar.DAY_OF_YEAR, dayOffset);\n }\n\n cal.set(Calendar.MILLISECOND, millisecond);\n cal.set(Calendar.SECOND, second);\n cal.set(Calendar.MINUTE, minute);\n cal.set(Calendar.HOUR_OF_DAY, hourOfDay);\n\n result = cal.getTime();\n pushCalendar(cal);\n }\n return result;\n }" ]
Returns a predicate that takes no parameters. The given SQL expression is used directly. @param sql SQL text of the expression
[ "public static Predicate is(final String sql) {\n return new Predicate() {\n public String toSql() {\n return sql;\n }\n public void init(AbstractSqlCreator creator) {\n }\n };\n }" ]
[ "public static String createOdataFilterForTags(String tagName, String tagValue) {\n if (tagName == null) {\n return null;\n } else if (tagValue == null) {\n return String.format(\"tagname eq '%s'\", tagName);\n } else {\n return String.format(\"tagname eq '%s' and tagvalue eq '%s'\", tagName, tagValue);\n }\n }", "@ArgumentsChecked\n\t@Throws(IllegalNullArgumentException.class)\n\tpublic static double checkDouble(@Nonnull final Number number) {\n\t\tCheck.notNull(number, \"number\");\n\t\tif (!isInDoubleRange(number)) {\n\t\t\tthrow new IllegalNumberRangeException(number.toString(), DOUBLE_MIN, DOUBLE_MAX);\n\t\t}\n\n\t\treturn number.doubleValue();\n\t}", "public static Configuration getDefaultFreemarkerConfiguration()\n {\n freemarker.template.Configuration configuration = new freemarker.template.Configuration(Configuration.VERSION_2_3_26);\n DefaultObjectWrapperBuilder objectWrapperBuilder = new DefaultObjectWrapperBuilder(Configuration.VERSION_2_3_26);\n objectWrapperBuilder.setUseAdaptersForContainers(true);\n objectWrapperBuilder.setIterableSupport(true);\n configuration.setObjectWrapper(objectWrapperBuilder.build());\n configuration.setAPIBuiltinEnabled(true);\n\n configuration.setTemplateLoader(new FurnaceFreeMarkerTemplateLoader());\n configuration.setTemplateUpdateDelayMilliseconds(3600);\n return configuration;\n }", "private Map<String, String> mergeItem(\r\n String item,\r\n Map<String, String> localeValues,\r\n Map<String, String> resultLocaleValues) {\r\n\r\n if (resultLocaleValues.get(item) != null) {\r\n if (localeValues.get(item) != null) {\r\n localeValues.put(item, localeValues.get(item) + \" \" + resultLocaleValues.get(item));\r\n } else {\r\n localeValues.put(item, resultLocaleValues.get(item));\r\n }\r\n }\r\n\r\n return localeValues;\r\n }", "private void writeTask(Task task)\n {\n if (!task.getNull())\n {\n if (extractAndConvertTaskType(task) == null || task.getSummary())\n {\n writeWBS(task);\n }\n else\n {\n writeActivity(task);\n }\n }\n }", "public static String getOperationName(final ModelNode op) {\n if (op.hasDefined(OP)) {\n return op.get(OP).asString();\n }\n throw ControllerClientLogger.ROOT_LOGGER.operationNameNotFound();\n }", "public static <X, Y> Pair<X, Y> makePair(X x, Y y) {\r\n return new Pair<X, Y>(x, y);\r\n }", "public ValueContainer[] getKeyValues(ClassDescriptor cld, Identity oid, boolean convertToSql) throws PersistenceBrokerException\r\n {\r\n FieldDescriptor[] pkFields = cld.getPkFields();\r\n ValueContainer[] result = new ValueContainer[pkFields.length];\r\n Object[] pkValues = oid.getPrimaryKeyValues();\r\n\r\n try\r\n {\r\n for(int i = 0; i < result.length; i++)\r\n {\r\n FieldDescriptor fd = pkFields[i];\r\n Object cv = pkValues[i];\r\n if(convertToSql)\r\n {\r\n // BRJ : apply type and value mapping\r\n cv = fd.getFieldConversion().javaToSql(cv);\r\n }\r\n result[i] = new ValueContainer(cv, fd.getJdbcType());\r\n }\r\n }\r\n catch(Exception e)\r\n {\r\n throw new PersistenceBrokerException(\"Can't generate primary key values for given Identity \" + oid, e);\r\n }\r\n return result;\r\n }", "boolean hasNoAlternativeWildcardRegistration() {\n return parent == null || PathElement.WILDCARD_VALUE.equals(valueString) || !parent.getChildNames().contains(PathElement.WILDCARD_VALUE);\n }" ]
Acquire a calendar instance. @return Calendar instance
[ "public static Calendar popCalendar()\n {\n Calendar result;\n Deque<Calendar> calendars = CALENDARS.get();\n if (calendars.isEmpty())\n {\n result = Calendar.getInstance();\n }\n else\n {\n result = calendars.pop();\n }\n return result;\n }" ]
[ "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 void generateRoutes()\n {\n try {\n\n//\t\t\tOptional<io.sinistral.proteus.annotations.Chain> typeLevelWrapAnnotation = Optional.ofNullable(controllerClass.getAnnotation(io.sinistral.proteus.annotations.Chain.class));\n//\t\t\t\n//\t\t\ttypeLevelWrapAnnotation.ifPresent( a -> {\n//\t\t\t\t \n//\t\t\t\tio.sinistral.proteus.annotations.Chain w = typeLevelWrapAnnotation.get();\n//\n//\t\t\t\tClass<? extends HandlerWrapper> wrapperClasses[] = w.value();\n//\n//\t\t\t\tfor (int i = 0; i < wrapperClasses.length; i++)\n//\t\t\t\t{\n//\t\t\t\t\tClass<? extends HandlerWrapper> wrapperClass = wrapperClasses[i];\n//\n//\t\t\t\t\tString wrapperName = generateFieldName(wrapperClass.getCanonicalName());\n//\n//\t\t\t\t\thandlerWrapperMap.put(wrapperClass, wrapperName);\n//\t\t\t\t}\n//\t\t\t\t\n//\t\t\t});\n//\t\t\t\n//\t\t\tfor(Method m : this.controllerClass.getDeclaredMethods())\n//\t\t\t{\n//\t\t\t\n//\t\t\t\tOptional<io.sinistral.proteus.annotations.Chain> methodLevelWrapAnnotation = Optional.ofNullable(m.getAnnotation(io.sinistral.proteus.annotations.Chain.class));\n//\t\t\t\t\n//\t\t\t\tmethodLevelWrapAnnotation.ifPresent( a -> {\n//\t\t\t\t\t \n//\t\t\t\t\tio.sinistral.proteus.annotations.Chain w = methodLevelWrapAnnotation.get();\n//\t\n//\t\t\t\t\tClass<? extends HandlerWrapper> wrapperClasses[] = w.value();\n//\t\n//\t\t\t\t\tfor (int i = 0; i < wrapperClasses.length; i++)\n//\t\t\t\t\t{\n//\t\t\t\t\t\tClass<? extends HandlerWrapper> wrapperClass = wrapperClasses[i];\n//\t\n//\t\t\t\t\t\tString wrapperName = generateFieldName(wrapperClass.getCanonicalName());\n//\t\n//\t\t\t\t\t\thandlerWrapperMap.put(wrapperClass, wrapperName);\n//\t\t\t\t\t}\n//\t\t\t\t\t\n//\t\t\t\t});\n//\n//\t\t\t}\n//\t\t\t\n//\t\t\tlog.info(\"handlerWrapperMap: \" + handlerWrapperMap);\n\n TypeSpec.Builder typeBuilder = TypeSpec.classBuilder(className).addModifiers(Modifier.PUBLIC)\n .addSuperinterface(ParameterizedTypeName.get(Supplier.class, RoutingHandler.class));\n\n ClassName extractorClass = ClassName.get(\"io.sinistral.proteus.server\", \"Extractors\");\n\n ClassName injectClass = ClassName.get(\"com.google.inject\", \"Inject\");\n\n\n MethodSpec.Builder constructor = MethodSpec.constructorBuilder().addModifiers(Modifier.PUBLIC).addAnnotation(injectClass);\n\n String className = this.controllerClass.getSimpleName().toLowerCase() + \"Controller\";\n\n typeBuilder.addField(this.controllerClass, className, Modifier.PROTECTED, Modifier.FINAL);\n\n ClassName wrapperClass = ClassName.get(\"io.undertow.server\", \"HandlerWrapper\");\n ClassName stringClass = ClassName.get(\"java.lang\", \"String\");\n ClassName mapClass = ClassName.get(\"java.util\", \"Map\");\n\n TypeName mapOfWrappers = ParameterizedTypeName.get(mapClass, stringClass, wrapperClass);\n\n TypeName annotatedMapOfWrappers = mapOfWrappers\n .annotated(AnnotationSpec.builder(com.google.inject.name.Named.class).addMember(\"value\", \"$S\", \"registeredHandlerWrappers\").build());\n\n typeBuilder.addField(mapOfWrappers, \"registeredHandlerWrappers\", Modifier.PROTECTED, Modifier.FINAL);\n\n\n constructor.addParameter(this.controllerClass, className);\n constructor.addParameter(annotatedMapOfWrappers, \"registeredHandlerWrappers\");\n\n constructor.addStatement(\"this.$N = $N\", className, className);\n constructor.addStatement(\"this.$N = $N\", \"registeredHandlerWrappers\", \"registeredHandlerWrappers\");\n\n addClassMethodHandlers(typeBuilder, this.controllerClass);\n\n typeBuilder.addMethod(constructor.build());\n\n JavaFile javaFile = JavaFile.builder(packageName, typeBuilder.build()).addStaticImport(extractorClass, \"*\").build();\n\n StringBuilder sb = new StringBuilder();\n\n javaFile.writeTo(sb);\n\n this.sourceString = sb.toString();\n\n } catch (Exception e) {\n log.error(e.getMessage(), e);\n }\n }", "private String getLogRequestIdentifier() {\n if (logIdentifier == null) {\n logIdentifier = String.format(\"%s-%s %s %s\", Integer.toHexString(hashCode()),\n numberOfRetries, connection.getRequestMethod(), connection.getURL());\n }\n return logIdentifier;\n }", "public static String md5sum(InputStream input) throws IOException {\r\n InputStream in = new BufferedInputStream(input);\r\n try {\r\n MessageDigest digest = java.security.MessageDigest.getInstance(\"MD5\");\r\n DigestInputStream digestInputStream = new DigestInputStream(in, digest);\r\n while(digestInputStream.read() >= 0) {\r\n }\r\n OutputStream md5out = new ByteArrayOutputStream();\r\n md5out.write(digest.digest());\r\n return md5out.toString();\r\n }\r\n catch(NoSuchAlgorithmException e) {\r\n throw new IllegalStateException(\"MD5 algorithm is not available: \" + e.getMessage());\r\n }\r\n finally {\r\n in.close();\r\n }\r\n }", "public AT_Row setPaddingLeftChar(Character paddingLeftChar) {\r\n\t\tif(this.hasCells()){\r\n\t\t\tfor(AT_Cell cell : this.getCells()){\r\n\t\t\t\tcell.getContext().setPaddingLeftChar(paddingLeftChar);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}", "VersionExcludeData getVersionIgnoreData(int major, int minor, int micro) {\n VersionExcludeData result = registry.get(new VersionKey(major, minor, micro));\n if (result == null) {\n result = registry.get(new VersionKey(major, minor, null));\n }\n return result;\n }", "public Stats getPhotosetStats(String photosetId, Date date) throws FlickrException {\n return getStats(METHOD_GET_PHOTOSET_STATS, \"photoset_id\", photosetId, date);\n }", "public BoxTaskAssignment.Info addAssignment(BoxUser assignTo) {\n JsonObject taskJSON = new JsonObject();\n taskJSON.add(\"type\", \"task\");\n taskJSON.add(\"id\", this.getID());\n\n JsonObject assignToJSON = new JsonObject();\n assignToJSON.add(\"id\", assignTo.getID());\n\n JsonObject requestJSON = new JsonObject();\n requestJSON.add(\"task\", taskJSON);\n requestJSON.add(\"assign_to\", assignToJSON);\n\n URL url = ADD_TASK_ASSIGNMENT_URL_TEMPLATE.build(this.getAPI().getBaseURL());\n BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, \"POST\");\n request.setBody(requestJSON.toString());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n\n BoxTaskAssignment addedAssignment = new BoxTaskAssignment(this.getAPI(), responseJSON.get(\"id\").asString());\n return addedAssignment.new Info(responseJSON);\n }", "public static base_responses renumber(nitro_service client, nspbr6 resources[]) throws Exception {\n\t\tbase_responses result = null;\n\t\tif (resources != null && resources.length > 0) {\n\t\t\tnspbr6 renumberresources[] = new nspbr6[resources.length];\n\t\t\tfor (int i=0;i<resources.length;i++){\n\t\t\t\trenumberresources[i] = new nspbr6();\n\t\t\t}\n\t\t\tresult = perform_operation_bulk_request(client, renumberresources,\"renumber\");\n\t\t}\n\t\treturn result;\n\t}" ]
Add a file to notify the script that asked to stop the print that it is now done processing the remain jobs.
[ "private void notifyIfStopped() {\n if (isAcceptingNewJobs() || !this.runningTasksFutures.isEmpty()) {\n return;\n }\n final File stoppedFile = new File(this.workingDirectories.getWorking(), \"stopped\");\n try {\n LOGGER.info(\"The print has finished processing jobs and can now stop\");\n stoppedFile.createNewFile();\n } catch (IOException e) {\n LOGGER.warn(\"Cannot create the {} file\", stoppedFile, e);\n }\n }" ]
[ "private void handleMemoryGetId(SerialMessage incomingMessage) {\n\t\tthis.homeId = ((incomingMessage.getMessagePayloadByte(0)) << 24) | \n\t\t\t\t((incomingMessage.getMessagePayloadByte(1)) << 16) | \n\t\t\t\t((incomingMessage.getMessagePayloadByte(2)) << 8) | \n\t\t\t\t(incomingMessage.getMessagePayloadByte(3));\n\t\tthis.ownNodeId = incomingMessage.getMessagePayloadByte(4);\n\t\tlogger.debug(String.format(\"Got MessageMemoryGetId response. Home id = 0x%08X, Controller Node id = %d\", this.homeId, this.ownNodeId));\n\t}", "private void postProcessTasks() throws MPXJException\n {\n //\n // Renumber ID values using a large increment to allow\n // space for later inserts.\n //\n TreeMap<Integer, Integer> taskMap = new TreeMap<Integer, Integer>();\n\n // I've found a pathological case of an MPP file with around 102k blank tasks...\n int nextIDIncrement = 102000;\n int nextID = (m_file.getTaskByUniqueID(Integer.valueOf(0)) == null ? nextIDIncrement : 0);\n for (Map.Entry<Long, Integer> entry : m_taskOrder.entrySet())\n {\n taskMap.put(Integer.valueOf(nextID), entry.getValue());\n nextID += nextIDIncrement;\n }\n\n //\n // Insert any null tasks into the correct location\n //\n int insertionCount = 0;\n Map<Integer, Integer> offsetMap = new HashMap<Integer, Integer>();\n for (Map.Entry<Integer, Integer> entry : m_nullTaskOrder.entrySet())\n {\n int idValue = entry.getKey().intValue();\n int baseTargetIdValue = (idValue - insertionCount) * nextIDIncrement;\n int targetIDValue = baseTargetIdValue;\n Integer previousOffsetKey = Integer.valueOf(baseTargetIdValue);\n Integer previousOffset = offsetMap.get(previousOffsetKey);\n int offset = previousOffset == null ? 0 : previousOffset.intValue() + 1;\n ++insertionCount;\n\n while (taskMap.containsKey(Integer.valueOf(targetIDValue)))\n {\n ++offset;\n if (offset == nextIDIncrement)\n {\n throw new MPXJException(\"Unable to fix task order\");\n }\n targetIDValue = baseTargetIdValue - (nextIDIncrement - offset);\n }\n\n offsetMap.put(previousOffsetKey, Integer.valueOf(offset));\n taskMap.put(Integer.valueOf(targetIDValue), entry.getValue());\n }\n\n //\n // Finally, we can renumber the tasks\n //\n nextID = (m_file.getTaskByUniqueID(Integer.valueOf(0)) == null ? 1 : 0);\n for (Map.Entry<Integer, Integer> entry : taskMap.entrySet())\n {\n Task task = m_file.getTaskByUniqueID(entry.getValue());\n if (task != null)\n {\n task.setID(Integer.valueOf(nextID));\n }\n nextID++;\n }\n }", "public Set<Tag> getAncestorTags(Tag tag)\n {\n Set<Tag> ancestors = new HashSet<>();\n getAncestorTags(tag, ancestors);\n return ancestors;\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 }", "@SuppressWarnings(\"unchecked\")\n public <T> Map<String, T> find(final Class<T> valueTypeToFind) {\n return (Map<String, T>) this.values.entrySet().stream()\n .filter(input -> valueTypeToFind.isInstance(input.getValue()))\n .collect(\n Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));\n }", "protected static void statistics(int from, int to) {\r\n\t// check that primes contain no accidental errors\r\n\tfor (int i=0; i<primeCapacities.length-1; i++) {\r\n\t\tif (primeCapacities[i] >= primeCapacities[i+1]) throw new RuntimeException(\"primes are unsorted or contain duplicates; detected at \"+i+\"@\"+primeCapacities[i]);\r\n\t}\r\n\t\r\n\tdouble accDeviation = 0.0;\r\n\tdouble maxDeviation = - 1.0;\r\n\r\n\tfor (int i=from; i<=to; i++) {\r\n\t\tint primeCapacity = nextPrime(i);\r\n\t\t//System.out.println(primeCapacity);\r\n\t\tdouble deviation = (primeCapacity - i) / (double)i;\r\n\t\t\r\n\t\tif (deviation > maxDeviation) {\r\n\t\t\tmaxDeviation = deviation;\r\n\t\t\tSystem.out.println(\"new maxdev @\"+i+\"@dev=\"+maxDeviation);\r\n\t\t}\r\n\r\n\t\taccDeviation += deviation;\r\n\t}\r\n\tlong width = 1 + (long)to - (long)from;\r\n\t\r\n\tdouble meanDeviation = accDeviation/width;\r\n\tSystem.out.println(\"Statistics for [\"+ from + \",\"+to+\"] are as follows\");\r\n\tSystem.out.println(\"meanDeviation = \"+(float)meanDeviation*100+\" %\");\r\n\tSystem.out.println(\"maxDeviation = \"+(float)maxDeviation*100+\" %\");\r\n}", "public List<WebSocketConnection> get(String key) {\n final List<WebSocketConnection> retList = new ArrayList<>();\n accept(key, C.F.addTo(retList));\n return retList;\n }", "public static base_response update(nitro_service client, sslcertkey resource) throws Exception {\n\t\tsslcertkey updateresource = new sslcertkey();\n\t\tupdateresource.certkey = resource.certkey;\n\t\tupdateresource.expirymonitor = resource.expirymonitor;\n\t\tupdateresource.notificationperiod = resource.notificationperiod;\n\t\treturn updateresource.update_resource(client);\n\t}", "private void updateBeatGrid(TrackMetadataUpdate update, BeatGrid beatGrid) {\n hotCache.put(DeckReference.getDeckReference(update.player, 0), beatGrid); // Main deck\n if (update.metadata.getCueList() != null) { // Update the cache with any hot cues in this track as well\n for (CueList.Entry entry : update.metadata.getCueList().entries) {\n if (entry.hotCueNumber != 0) {\n hotCache.put(DeckReference.getDeckReference(update.player, entry.hotCueNumber), beatGrid);\n }\n }\n }\n deliverBeatGridUpdate(update.player, beatGrid);\n }" ]
Performs a similar transform on A-pI
[ "protected void createBulge( int x1 , double p , boolean byAngle ) {\n double a11 = diag[x1];\n double a22 = diag[x1+1];\n double a12 = off[x1];\n double a23 = off[x1+1];\n\n if( byAngle ) {\n c = Math.cos(p);\n s = Math.sin(p);\n\n c2 = c*c;\n s2 = s*s;\n cs = c*s;\n } else {\n computeRotation(a11-p, a12);\n }\n\n // multiply the rotator on the top left.\n diag[x1] = c2*a11 + 2.0*cs*a12 + s2*a22;\n diag[x1+1] = c2*a22 - 2.0*cs*a12 + s2*a11;\n off[x1] = a12*(c2-s2) + cs*(a22 - a11);\n off[x1+1] = c*a23;\n bulge = s*a23;\n\n if( Q != null )\n updateQ(x1,x1+1,c,s);\n }" ]
[ "private void addGreeting(String guestbookName, String user, String message)\n throws DatastoreException {\n Entity.Builder greeting = Entity.newBuilder();\n greeting.setKey(makeKey(GUESTBOOK_KIND, guestbookName, GREETING_KIND));\n greeting.getMutableProperties().put(USER_PROPERTY, makeValue(user).build());\n greeting.getMutableProperties().put(MESSAGE_PROPERTY, makeValue(message).build());\n greeting.getMutableProperties().put(DATE_PROPERTY, makeValue(new Date()).build());\n Key greetingKey = insert(greeting.build());\n System.out.println(\"greeting key is: \" + greetingKey);\n }", "private void addListeners(ProjectReader reader)\n {\n if (m_projectListeners != null)\n {\n for (ProjectListener listener : m_projectListeners)\n {\n reader.addProjectListener(listener);\n }\n }\n }", "protected void createDocument() throws ParserConfigurationException\n {\n DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();\n DocumentBuilder builder = builderFactory.newDocumentBuilder();\n DocumentType doctype = builder.getDOMImplementation().createDocumentType(\"html\", \"-//W3C//DTD XHTML 1.1//EN\", \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\");\n doc = builder.getDOMImplementation().createDocument(\"http://www.w3.org/1999/xhtml\", \"html\", doctype);\n \n head = doc.createElement(\"head\");\n Element meta = doc.createElement(\"meta\");\n meta.setAttribute(\"http-equiv\", \"content-type\");\n meta.setAttribute(\"content\", \"text/html;charset=utf-8\");\n head.appendChild(meta);\n title = doc.createElement(\"title\");\n title.setTextContent(\"PDF Document\");\n head.appendChild(title);\n globalStyle = doc.createElement(\"style\");\n globalStyle.setAttribute(\"type\", \"text/css\");\n //globalStyle.setTextContent(createGlobalStyle());\n head.appendChild(globalStyle);\n \n body = doc.createElement(\"body\");\n \n Element root = doc.getDocumentElement();\n root.appendChild(head);\n root.appendChild(body);\n }", "public void setBackgroundColor(int colorRes) {\n if (getBackground() instanceof ShapeDrawable) {\n final Resources res = getResources();\n ((ShapeDrawable) getBackground()).getPaint().setColor(res.getColor(colorRes));\n }\n }", "public static List getAt(Matcher self, Collection indices) {\n List result = new ArrayList();\n for (Object value : indices) {\n if (value instanceof Range) {\n result.addAll(getAt(self, (Range) value));\n } else {\n int idx = DefaultTypeTransformation.intUnbox(value);\n result.add(getAt(self, idx));\n }\n }\n return result;\n }", "public void validateInjectionPoint(InjectionPoint ij, BeanManagerImpl beanManager) {\n validateInjectionPointForDefinitionErrors(ij, ij.getBean(), beanManager);\n validateMetadataInjectionPoint(ij, ij.getBean(), ValidatorLogger.INJECTION_INTO_NON_BEAN);\n validateEventMetadataInjectionPoint(ij);\n validateInjectionPointForDeploymentProblems(ij, ij.getBean(), beanManager);\n }", "private RandomVariable getShortRate(int timeIndex) throws CalculationException {\n\t\tdouble time = getProcess().getTime(timeIndex);\n\t\tdouble timePrev = timeIndex > 0 ? getProcess().getTime(timeIndex-1) : time;\n\t\tdouble timeNext = getProcess().getTime(timeIndex+1);\n\n\t\tRandomVariable zeroRate = getZeroRateFromForwardCurve(time); //getDiscountFactorFromForwardCurve(time).div(getDiscountFactorFromForwardCurve(timeNext)).log().div(timeNext-time);\n\n\t\tRandomVariable alpha = getDV(0, time);\n\n\t\tRandomVariable value = getProcess().getProcessValue(timeIndex, 0);\n\t\tvalue = value.add(alpha);\n\t\t//\t\tvalue = value.sub(Math.log(value.exp().getAverage()));\n\n\t\tvalue = value.add(zeroRate);\n\n\t\treturn value;\n\t}", "okhttp3.Response delete(String url, Map<String, Object> params)\n throws RequestException, LocalOperationException {\n okhttp3.Request request = new okhttp3.Request.Builder()\n .url(getFullUrl(url))\n .delete(getBody(toPayload(params), null))\n .addHeader(\"Transloadit-Client\", version)\n .build();\n\n try {\n return httpClient.newCall(request).execute();\n } catch (IOException e) {\n throw new RequestException(e);\n }\n }", "protected final void setParentNode(final DiffNode parentNode)\n\t{\n\t\tif (this.parentNode != null && this.parentNode != parentNode)\n\t\t{\n\t\t\tthrow new IllegalStateException(\"The parent of a node cannot be changed, once it's set.\");\n\t\t}\n\t\tthis.parentNode = parentNode;\n\t}" ]
Triggers a replication request, blocks while the replication is in progress. @return ReplicationResult encapsulating the result
[ "public com.cloudant.client.api.model.ReplicationResult trigger() {\r\n ReplicationResult couchDbReplicationResult = replication.trigger();\r\n com.cloudant.client.api.model.ReplicationResult replicationResult = new com.cloudant\r\n .client.api.model.ReplicationResult(couchDbReplicationResult);\r\n return replicationResult;\r\n }" ]
[ "public static BoxUser.Info createEnterpriseUser(BoxAPIConnection api, String login, String name,\n CreateUserParams params) {\n\n JsonObject requestJSON = new JsonObject();\n requestJSON.add(\"login\", login);\n requestJSON.add(\"name\", name);\n\n if (params != null) {\n if (params.getRole() != null) {\n requestJSON.add(\"role\", params.getRole().toJSONValue());\n }\n\n if (params.getStatus() != null) {\n requestJSON.add(\"status\", params.getStatus().toJSONValue());\n }\n\n requestJSON.add(\"language\", params.getLanguage());\n requestJSON.add(\"is_sync_enabled\", params.getIsSyncEnabled());\n requestJSON.add(\"job_title\", params.getJobTitle());\n requestJSON.add(\"phone\", params.getPhone());\n requestJSON.add(\"address\", params.getAddress());\n requestJSON.add(\"space_amount\", params.getSpaceAmount());\n requestJSON.add(\"can_see_managed_users\", params.getCanSeeManagedUsers());\n requestJSON.add(\"timezone\", params.getTimezone());\n requestJSON.add(\"is_exempt_from_device_limits\", params.getIsExemptFromDeviceLimits());\n requestJSON.add(\"is_exempt_from_login_verification\", params.getIsExemptFromLoginVerification());\n requestJSON.add(\"is_platform_access_only\", params.getIsPlatformAccessOnly());\n requestJSON.add(\"external_app_user_id\", params.getExternalAppUserId());\n }\n\n URL url = USERS_URL_TEMPLATE.build(api.getBaseURL());\n BoxJSONRequest request = new BoxJSONRequest(api, url, \"POST\");\n request.setBody(requestJSON.toString());\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n\n BoxUser createdUser = new BoxUser(api, responseJSON.get(\"id\").asString());\n return createdUser.new Info(responseJSON);\n }", "private boolean isEqual(FieldDescriptorDef first, FieldDescriptorDef second)\r\n {\r\n return first.getName().equals(second.getName()) &&\r\n first.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN).equals(second.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN)) &&\r\n first.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE).equals(second.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE));\r\n }", "private void ensureColumn(FieldDescriptorDef fieldDef, String checkLevel)\r\n {\r\n if (!fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_COLUMN))\r\n {\r\n String javaname = fieldDef.getName();\r\n\r\n if (fieldDef.isNested())\r\n { \r\n int pos = javaname.indexOf(\"::\");\r\n\r\n // we convert nested names ('_' for '::')\r\n if (pos > 0)\r\n {\r\n StringBuffer newJavaname = new StringBuffer(javaname.substring(0, pos));\r\n int lastPos = pos + 2;\r\n\r\n do\r\n {\r\n pos = javaname.indexOf(\"::\", lastPos);\r\n newJavaname.append(\"_\");\r\n if (pos > 0)\r\n { \r\n newJavaname.append(javaname.substring(lastPos, pos));\r\n lastPos = pos + 2;\r\n }\r\n else\r\n {\r\n newJavaname.append(javaname.substring(lastPos));\r\n }\r\n }\r\n while (pos > 0);\r\n javaname = newJavaname.toString();\r\n }\r\n }\r\n fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_COLUMN, javaname);\r\n }\r\n }", "public void check(ReferenceDescriptorDef refDef, String checkLevel) throws ConstraintException\r\n {\r\n ensureClassRef(refDef, checkLevel);\r\n checkProxyPrefetchingLimit(refDef, checkLevel);\r\n }", "@SuppressWarnings(\"deprecation\")\n protected ModelNode executeReadOnlyOperation(final ModelNode operation, final OperationMessageHandler handler, final OperationTransactionControl control, final OperationStepHandler prepareStep, final int operationId) {\n final AbstractOperationContext delegateContext = getDelegateContext(operationId);\n CurrentOperationIdHolder.setCurrentOperationID(operationId);\n try {\n return executeReadOnlyOperation(operation, delegateContext.getManagementModel(), control, prepareStep, delegateContext);\n } finally {\n CurrentOperationIdHolder.setCurrentOperationID(null);\n }\n }", "public synchronized void delete(String name) {\n if (isEmpty(name)) {\n indexedProps.remove(name);\n } else {\n synchronized (context) {\n int scope = context.getAttributesScope(name);\n if (scope != -1) {\n context.removeAttribute(name, scope);\n }\n }\n }\n }", "public static filterpolicy_binding get(nitro_service service, String name) throws Exception{\n\t\tfilterpolicy_binding obj = new filterpolicy_binding();\n\t\tobj.set_name(name);\n\t\tfilterpolicy_binding response = (filterpolicy_binding) obj.get_resource(service);\n\t\treturn response;\n\t}", "public Bundler put(String key, Parcelable value) {\n delegate.putParcelable(key, value);\n return this;\n }", "public void deleteDescriptorIfNecessary() throws CmsException {\n\n if (m_removeDescriptorOnCancel && (m_desc != null)) {\n m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(2));\n }\n\n }" ]
Add a management request handler factory to this context. @param factory the request handler to add
[ "public void addHandlerFactory(ManagementRequestHandlerFactory factory) {\n for (;;) {\n final ManagementRequestHandlerFactory[] snapshot = updater.get(this);\n final int length = snapshot.length;\n final ManagementRequestHandlerFactory[] newVal = new ManagementRequestHandlerFactory[length + 1];\n System.arraycopy(snapshot, 0, newVal, 0, length);\n newVal[length] = factory;\n if (updater.compareAndSet(this, snapshot, newVal)) {\n return;\n }\n }\n }" ]
[ "public UniqueEntityLoader buildLoader(\n\t\t\tOuterJoinLoadable persister,\n\t\t\tint batchSize,\n\t\t\tLockMode lockMode,\n\t\t\tSessionFactoryImplementor factory,\n\t\t\tLoadQueryInfluencers influencers,\n\t\t\tBatchableEntityLoaderBuilder innerEntityLoaderBuilder) {\n\t\tif ( batchSize <= 1 ) {\n\t\t\t// no batching\n\t\t\treturn buildNonBatchingLoader( persister, lockMode, factory, influencers, innerEntityLoaderBuilder );\n\t\t}\n\t\treturn buildBatchingLoader( persister, batchSize, lockMode, factory, influencers, innerEntityLoaderBuilder );\n\t}", "private void loadCadidateString() {\n volumeUp = mGvrContext.getActivity().getResources().getString(R.string.volume_up);\n volumeDown = mGvrContext.getActivity().getResources().getString(R.string.volume_down);\n zoomIn = mGvrContext.getActivity().getResources().getString(R.string.zoom_in);\n zoomOut = mGvrContext.getActivity().getResources().getString(R.string.zoom_out);\n invertedColors = mGvrContext.getActivity().getResources().getString(R.string.inverted_colors);\n talkBack = mGvrContext.getActivity().getResources().getString(R.string.talk_back);\n disableTalkBack = mGvrContext.getActivity().getResources().getString(R.string.disable_talk_back);\n }", "public void init(Map<String, String> testConfig, Map<String, String> hiveVars) {\n\n context.init();\n\n HiveConf hiveConf = context.getHiveConf();\n\n // merge test case properties with hive conf before HiveServer is started.\n for (Map.Entry<String, String> property : testConfig.entrySet()) {\n hiveConf.set(property.getKey(), property.getValue());\n }\n\n try {\n hiveServer2 = new HiveServer2();\n hiveServer2.init(hiveConf);\n\n // Locate the ClIService in the HiveServer2\n for (Service service : hiveServer2.getServices()) {\n if (service instanceof CLIService) {\n client = (CLIService) service;\n }\n }\n\n Preconditions.checkNotNull(client, \"ClIService was not initialized by HiveServer2\");\n\n sessionHandle = client.openSession(\"noUser\", \"noPassword\", null);\n\n SessionState sessionState = client.getSessionManager().getSession(sessionHandle).getSessionState();\n currentSessionState = sessionState;\n currentSessionState.setHiveVariables(hiveVars);\n } catch (Exception e) {\n throw new IllegalStateException(\"Failed to create HiveServer :\" + e.getMessage(), e);\n }\n\n // Ping hive server before we do anything more with it! If validation\n // is switched on, this will fail if metastorage is not set up properly\n pingHiveServer();\n }", "public final void printClientConfig(final JSONWriter json) throws JSONException {\n json.key(\"attributes\");\n json.array();\n for (Map.Entry<String, Attribute> entry: this.attributes.entrySet()) {\n Attribute attribute = entry.getValue();\n if (attribute.getClass().getAnnotation(InternalAttribute.class) == null) {\n json.object();\n attribute.printClientConfig(json, this);\n json.endObject();\n }\n }\n json.endArray();\n }", "public static CmsJspResourceWrapper convertResource(CmsObject cms, Object input) throws CmsException {\n\n CmsJspResourceWrapper result;\n if (input instanceof CmsResource) {\n result = CmsJspResourceWrapper.wrap(cms, (CmsResource)input);\n } else {\n result = CmsJspResourceWrapper.wrap(cms, convertRawResource(cms, input));\n }\n return result;\n }", "private void writeTasks() throws JAXBException\n {\n Tasks tasks = m_factory.createTasks();\n m_plannerProject.setTasks(tasks);\n List<net.sf.mpxj.planner.schema.Task> taskList = tasks.getTask();\n for (Task task : m_projectFile.getChildTasks())\n {\n writeTask(task, taskList);\n }\n }", "@Override\n public final float getFloat(final String key) {\n Float result = optFloat(key);\n if (result == null) {\n throw new ObjectMissingException(this, key);\n }\n return result;\n }", "void nextExecuted(String sql) throws SQLException\r\n {\r\n count++;\r\n\r\n if (_order.contains(sql))\r\n {\r\n return;\r\n }\r\n\r\n String sqlCmd = sql.substring(0, 7);\r\n String rest = sql.substring(sqlCmd.equals(\"UPDATE \") ? 7 // \"UPDATE \"\r\n : 12); // \"INSERT INTO \" or \"DELETE FROM \"\r\n String tableName = rest.substring(0, rest.indexOf(' '));\r\n HashSet fkTables = (HashSet) _fkInfo.get(tableName);\r\n\r\n // we should not change order of INSERT/DELETE/UPDATE\r\n // statements for the same table\r\n if (_touched.contains(tableName))\r\n {\r\n executeBatch();\r\n }\r\n if (sqlCmd.equals(\"INSERT \"))\r\n {\r\n if (_dontInsert != null && _dontInsert.contains(tableName))\r\n {\r\n // one of the previous INSERTs contained a table\r\n // that references this table.\r\n // Let's execute that previous INSERT right now so that\r\n // in the future INSERTs into this table will go first\r\n // in the _order array.\r\n executeBatch();\r\n }\r\n }\r\n else\r\n //if (sqlCmd.equals(\"DELETE \") || sqlCmd.equals(\"UPDATE \"))\r\n {\r\n // We process UPDATEs in the same way as DELETEs\r\n // because setting FK to NULL in UPDATE is equivalent\r\n // to DELETE from the referential integrity point of view.\r\n\r\n if (_deleted != null && fkTables != null)\r\n {\r\n HashSet intersection = (HashSet) _deleted.clone();\r\n\r\n intersection.retainAll(fkTables);\r\n if (!intersection.isEmpty())\r\n {\r\n // one of the previous DELETEs contained a table\r\n // that is referenced from this table.\r\n // Let's execute that previous DELETE right now so that\r\n // in the future DELETEs into this table will go first\r\n // in the _order array.\r\n executeBatch();\r\n }\r\n }\r\n }\r\n\r\n _order.add(sql);\r\n\r\n _touched.add(tableName);\r\n if (sqlCmd.equals(\"INSERT \"))\r\n {\r\n if (fkTables != null)\r\n {\r\n if (_dontInsert == null)\r\n {\r\n _dontInsert = new HashSet();\r\n }\r\n _dontInsert.addAll(fkTables);\r\n }\r\n }\r\n else if (sqlCmd.equals(\"DELETE \"))\r\n {\r\n if (_deleted == null)\r\n {\r\n _deleted = new HashSet();\r\n }\r\n _deleted.add(tableName);\r\n }\r\n }", "@Override\n public <E> DynamicType.Builder<E> processMethod(final DynamicType.Builder<E> builder, final Method method, final Annotation annotation)\n {\n String methodName = method.getName();\n if (ReflectionUtility.isGetMethod(method))\n return createInterceptor(builder, method);\n else if (ReflectionUtility.isSetMethod(method))\n return createInterceptor(builder, method);\n else if (methodName.startsWith(\"addAll\"))\n return createInterceptor(builder, method);\n else if (methodName.startsWith(\"add\"))\n return createInterceptor(builder, method);\n else\n throw new WindupException(\"Only get*, set*, add*, and addAll* method names are supported for @\"\n + SetInProperties.class.getSimpleName() + \", found at: \" + method.getName());\n }" ]
Use this API to fetch aaagroup_vpnsessionpolicy_binding resources of given name .
[ "public static aaagroup_vpnsessionpolicy_binding[] get(nitro_service service, String groupname) throws Exception{\n\t\taaagroup_vpnsessionpolicy_binding obj = new aaagroup_vpnsessionpolicy_binding();\n\t\tobj.set_groupname(groupname);\n\t\taaagroup_vpnsessionpolicy_binding response[] = (aaagroup_vpnsessionpolicy_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}" ]
[ "private boolean findBinding(Injector injector, Class<?> type) {\n boolean found = false;\n for (Key<?> key : injector.getBindings().keySet()) {\n if (key.getTypeLiteral().getRawType().equals(type)) {\n found = true;\n break;\n }\n }\n if (!found && injector.getParent() != null) {\n return findBinding(injector.getParent(), type);\n }\n\n return found;\n }", "public NestedDef getNested(String name)\r\n {\r\n NestedDef nestedDef = null;\r\n\r\n for (Iterator it = _nested.iterator(); it.hasNext(); )\r\n {\r\n nestedDef = (NestedDef)it.next();\r\n if (nestedDef.getName().equals(name))\r\n {\r\n return nestedDef;\r\n }\r\n }\r\n return null;\r\n }", "public static boolean isOperationDefined(final ModelNode operation) {\n for (final AttributeDefinition def : ROOT_ATTRIBUTES) {\n if (operation.hasDefined(def.getName())) {\n return true;\n }\n }\n return false;\n }", "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 }", "public static int secondsDiff(Date earlierDate, Date laterDate) {\n if (earlierDate == null || laterDate == null) {\n return 0;\n }\n\n return (int) ((laterDate.getTime() / SECOND_MILLIS) - (earlierDate.getTime() / SECOND_MILLIS));\n }", "private void deriveProjectCalendar()\n {\n //\n // Count the number of times each calendar is used\n //\n Map<ProjectCalendar, Integer> map = new HashMap<ProjectCalendar, Integer>();\n for (Task task : m_project.getTasks())\n {\n ProjectCalendar calendar = task.getCalendar();\n Integer count = map.get(calendar);\n if (count == null)\n {\n count = Integer.valueOf(1);\n }\n else\n {\n count = Integer.valueOf(count.intValue() + 1);\n }\n map.put(calendar, count);\n }\n\n //\n // Find the most frequently used calendar\n //\n int maxCount = 0;\n ProjectCalendar defaultCalendar = null;\n\n for (Entry<ProjectCalendar, Integer> entry : map.entrySet())\n {\n if (entry.getValue().intValue() > maxCount)\n {\n maxCount = entry.getValue().intValue();\n defaultCalendar = entry.getKey();\n }\n }\n\n //\n // Set the default calendar for the project\n // and remove it's use as a task-specific calendar.\n //\n if (defaultCalendar != null)\n {\n m_project.setDefaultCalendar(defaultCalendar);\n for (Task task : m_project.getTasks())\n {\n if (task.getCalendar() == defaultCalendar)\n {\n task.setCalendar(null);\n }\n }\n }\n }", "public static Method getSAMMethod(Class<?> c) {\n // SAM = single public abstract method\n // if the class is not abstract there is no abstract method\n if (!Modifier.isAbstract(c.getModifiers())) return null;\n if (c.isInterface()) {\n Method[] methods = c.getMethods();\n // res stores the first found abstract method\n Method res = null;\n for (Method mi : methods) {\n // ignore methods, that are not abstract and from Object\n if (!Modifier.isAbstract(mi.getModifiers())) continue;\n // ignore trait methods which have a default implementation\n if (mi.getAnnotation(Traits.Implemented.class)!=null) continue;\n try {\n Object.class.getMethod(mi.getName(), mi.getParameterTypes());\n continue;\n } catch (NoSuchMethodException e) {/*ignore*/}\n\n // we have two methods, so no SAM\n if (res!=null) return null;\n res = mi;\n }\n return res;\n\n } else {\n\n LinkedList<Method> methods = new LinkedList();\n getAbstractMethods(c, methods);\n if (methods.isEmpty()) return null;\n ListIterator<Method> it = methods.listIterator();\n while (it.hasNext()) {\n Method m = it.next();\n if (hasUsableImplementation(c, m)) it.remove();\n }\n return getSingleNonDuplicateMethod(methods);\n }\n }", "public static void init() {\n reports.clear();\n Reflections reflections = new Reflections(REPORTS_PACKAGE);\n final Set<Class<? extends Report>> reportClasses = reflections.getSubTypesOf(Report.class);\n\n for(Class<? extends Report> c : reportClasses) {\n LOG.info(\"Report class: \" + c.getName());\n try {\n reports.add(c.newInstance());\n } catch (IllegalAccessException | InstantiationException e) {\n LOG.error(\"Error while loading report implementation classes\", e);\n }\n }\n\n if(LOG.isInfoEnabled()) {\n LOG.info(String.format(\"Detected %s reports\", reports.size()));\n }\n }", "public 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 }" ]
Overridden to skip some symbolizers.
[ "@Override\n\tpublic void visit(Rule rule) {\n\t\tRule copy = null;\n\t\tFilter filterCopy = null;\n\n\t\tif (rule.getFilter() != null) {\n\t\t\tFilter filter = rule.getFilter();\n\t\t\tfilterCopy = copy(filter);\n\t\t}\n\n\t\tList<Symbolizer> symsCopy = new ArrayList<Symbolizer>();\n\t\tfor (Symbolizer sym : rule.symbolizers()) {\n\t\t\tif (!skipSymbolizer(sym)) {\n\t\t\t\tSymbolizer symCopy = copy(sym);\n\t\t\t\tsymsCopy.add(symCopy);\n\t\t\t}\n\t\t}\n\n\t\tGraphic[] legendCopy = rule.getLegendGraphic();\n\t\tfor (int i = 0; i < legendCopy.length; i++) {\n\t\t\tlegendCopy[i] = copy(legendCopy[i]);\n\t\t}\n\n\t\tDescription descCopy = rule.getDescription();\n\t\tdescCopy = copy(descCopy);\n\n\t\tcopy = sf.createRule();\n\t\tcopy.symbolizers().addAll(symsCopy);\n\t\tcopy.setDescription(descCopy);\n\t\tcopy.setLegendGraphic(legendCopy);\n\t\tcopy.setName(rule.getName());\n\t\tcopy.setFilter(filterCopy);\n\t\tcopy.setElseFilter(rule.isElseFilter());\n\t\tcopy.setMaxScaleDenominator(rule.getMaxScaleDenominator());\n\t\tcopy.setMinScaleDenominator(rule.getMinScaleDenominator());\n\n\t\tif (STRICT && !copy.equals(rule)) {\n\t\t\tthrow new IllegalStateException(\n\t\t\t\t\t\"Was unable to duplicate provided Rule:\" + rule);\n\t\t}\n\t\tpages.push(copy);\n\t}" ]
[ "public void save() throws CmsException {\n\n if (hasChanges()) {\n switch (m_bundleType) {\n case PROPERTY:\n saveLocalization();\n saveToPropertyVfsBundle();\n break;\n\n case XML:\n saveLocalization();\n saveToXmlVfsBundle();\n\n break;\n\n case DESCRIPTOR:\n break;\n default:\n throw new IllegalArgumentException();\n }\n if (null != m_descFile) {\n saveToBundleDescriptor();\n }\n\n resetChanges();\n }\n\n }", "private void sortFileList() {\n if (this.size() > 1) {\n Collections.sort(this.fileList, new Comparator() {\n\n public final int compare(final Object o1, final Object o2) {\n final File f1 = (File) o1;\n final File f2 = (File) o2;\n final Object[] f1TimeAndCount = backupSuffixHelper\n .backupTimeAndCount(f1.getName(), baseFile);\n final Object[] f2TimeAndCount = backupSuffixHelper\n .backupTimeAndCount(f2.getName(), baseFile);\n final long f1TimeSuffix = ((Long) f1TimeAndCount[0]).longValue();\n final long f2TimeSuffix = ((Long) f2TimeAndCount[0]).longValue();\n if ((0L == f1TimeSuffix) && (0L == f2TimeSuffix)) {\n final long f1Time = f1.lastModified();\n final long f2Time = f2.lastModified();\n if (f1Time < f2Time) {\n return -1;\n }\n if (f1Time > f2Time) {\n return 1;\n }\n return 0;\n }\n if (f1TimeSuffix < f2TimeSuffix) {\n return -1;\n }\n if (f1TimeSuffix > f2TimeSuffix) {\n return 1;\n }\n final int f1Count = ((Integer) f1TimeAndCount[1]).intValue();\n final int f2Count = ((Integer) f2TimeAndCount[1]).intValue();\n if (f1Count < f2Count) {\n return -1;\n }\n if (f1Count > f2Count) {\n return 1;\n }\n if (f1Count == f2Count) {\n if (fileHelper.isCompressed(f1)) {\n return -1;\n }\n if (fileHelper.isCompressed(f2)) {\n return 1;\n }\n }\n return 0;\n }\n });\n }\n }", "public void writeTo(IIMWriter writer) throws IOException {\r\n\t\tfinal boolean doLog = log != null;\r\n\t\tfor (Iterator<DataSet> i = dataSets.iterator(); i.hasNext();) {\r\n\t\t\tDataSet ds = i.next();\r\n\t\t\twriter.write(ds);\r\n\t\t\tif (doLog) {\r\n\t\t\t\tlog.debug(\"Wrote data set \" + ds);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void clear()\r\n {\r\n Class collClass = getCollectionClass();\r\n\r\n // ECER: assure we notify all objects being removed, \r\n // necessary for RemovalAwareCollections...\r\n if (IRemovalAwareCollection.class.isAssignableFrom(collClass))\r\n {\r\n getData().clear();\r\n }\r\n else\r\n {\r\n Collection coll;\r\n // BRJ: use an empty collection so isLoaded will return true\r\n // for non RemovalAwareCollections only !! \r\n try\r\n {\r\n coll = (Collection) collClass.newInstance();\r\n }\r\n catch (Exception e)\r\n {\r\n coll = new ArrayList();\r\n }\r\n\r\n setData(coll);\r\n }\r\n _size = 0;\r\n }", "public static void validateZip(File file) throws IOException {\n ZipInputStream zipInput = new ZipInputStream(new FileInputStream(file));\n ZipEntry zipEntry = zipInput.getNextEntry();\n\n while (zipEntry != null) {\n zipEntry = zipInput.getNextEntry();\n }\n\n try {\n if (zipInput != null) {\n zipInput.close();\n }\n } catch (IOException e) {\n }\n }", "private Observable<Response<ResponseBody>> pollAsync(String url, String loggingContext) {\n URL endpoint;\n try {\n endpoint = new URL(url);\n } catch (MalformedURLException e) {\n return Observable.error(e);\n }\n AsyncService service = restClient().retrofit().create(AsyncService.class);\n if (loggingContext != null && !loggingContext.endsWith(\" (poll)\")) {\n loggingContext += \" (poll)\";\n }\n return service.get(endpoint.getFile(), serviceClientUserAgent, loggingContext)\n .flatMap(new Func1<Response<ResponseBody>, Observable<Response<ResponseBody>>>() {\n @Override\n public Observable<Response<ResponseBody>> call(Response<ResponseBody> response) {\n RuntimeException exception = createExceptionFromResponse(response, 200, 201, 202, 204);\n if (exception != null) {\n return Observable.error(exception);\n } else {\n return Observable.just(response);\n }\n }\n });\n }", "public static void serialize(final File folder, final String content, final String fileName) throws IOException {\n if (!folder.exists()) {\n folder.mkdirs();\n }\n\n final File output = new File(folder, fileName);\n\n try (\n final FileWriter writer = new FileWriter(output);\n ) {\n writer.write(content);\n writer.flush();\n } catch (Exception e) {\n throw new IOException(\"Failed to serialize the notification in folder \" + folder.getPath(), e);\n }\n }", "public double getAccruedInterest(LocalDate date, AnalyticModel model) {\n\t\tint periodIndex=schedule.getPeriodIndex(date);\n\t\tPeriod period=schedule.getPeriod(periodIndex);\n\t\tDayCountConvention dcc= schedule.getDaycountconvention();\n\t\tdouble accruedInterest=getCouponPayment(periodIndex,model)*(dcc.getDaycountFraction(period.getPeriodStart(), date))/schedule.getPeriodLength(periodIndex);\n\t\treturn accruedInterest;\n\t}", "private void revisitGateways(Definitions def) {\n List<RootElement> rootElements = def.getRootElements();\n for (RootElement root : rootElements) {\n if (root instanceof Process) {\n setGatewayInfo((Process) root);\n }\n }\n }" ]
Moves the given row down. @param row the row to move
[ "public void moveDown(I_CmsEditableGroupRow row) {\n\n int index = m_container.getComponentIndex(row);\n if ((index >= 0) && (index < (m_container.getComponentCount() - 1))) {\n m_container.removeComponent(row);\n m_container.addComponent(row, index + 1);\n }\n updateButtonBars();\n }" ]
[ "private void recurseAndAddFiles(GraphRewrite event, FileService fileService, WindupJavaConfigurationService javaConfigurationService, FileModel file)\n {\n if (javaConfigurationService.checkIfIgnored(event, file))\n return;\n\n String filePath = file.getFilePath();\n File fileReference = new File(filePath);\n Long directorySize = new Long(0);\n\n if (fileReference.isDirectory())\n {\n File[] subFiles = fileReference.listFiles();\n if (subFiles != null)\n {\n for (File reference : subFiles)\n {\n FileModel subFile = fileService.createByFilePath(file, reference.getAbsolutePath());\n recurseAndAddFiles(event, fileService, javaConfigurationService, subFile);\n if (subFile.isDirectory())\n {\n directorySize = directorySize + subFile.getDirectorySize();\n }\n else\n {\n directorySize = directorySize + subFile.getSize();\n }\n }\n }\n file.setDirectorySize(directorySize);\n }\n }", "public <T> T cached(String key) {\n H.Session sess = session();\n if (null != sess) {\n return sess.cached(key);\n } else {\n return app().cache().get(key);\n }\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 static servicegroup_lbmonitor_binding[] get(nitro_service service, String servicegroupname) throws Exception{\n\t\tservicegroup_lbmonitor_binding obj = new servicegroup_lbmonitor_binding();\n\t\tobj.set_servicegroupname(servicegroupname);\n\t\tservicegroup_lbmonitor_binding response[] = (servicegroup_lbmonitor_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "public void createRelationFieldMap(Props props)\n {\n byte[] fieldMapData = null;\n for (Integer key : RELATION_KEYS)\n {\n fieldMapData = props.getByteArray(key);\n if (fieldMapData != null)\n {\n break;\n }\n }\n\n if (fieldMapData == null)\n {\n populateDefaultData(getDefaultRelationData());\n }\n else\n {\n createFieldMap(fieldMapData);\n }\n }", "@SuppressWarnings(\"unchecked\")\n\tstatic void logToFile(String filename) {\n\t\tLogger rootLogger = (Logger) LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);\n\n\t\tFileAppender<ILoggingEvent> fileappender = new FileAppender<>();\n\t\tfileappender.setContext(rootLogger.getLoggerContext());\n\t\tfileappender.setFile(filename);\n\t\tfileappender.setName(\"FILE\");\n\n\t\tConsoleAppender<?> console = (ConsoleAppender<?>) rootLogger.getAppender(\"STDOUT\");\n\t\tfileappender.setEncoder((Encoder<ILoggingEvent>) console.getEncoder());\n\n\t\tfileappender.start();\n\n\t\trootLogger.addAppender(fileappender);\n\n\t\tconsole.stop();\n\t}", "public MBeanOperationInfo getOperationInfo(String operationName)\n throws OperationNotFoundException, UnsupportedEncodingException {\n\n String decodedOperationName = sanitizer.urlDecode(operationName, encoding);\n Map<String, MBeanOperationInfo> operationMap = getOperationMetadata();\n if (operationMap.containsKey(decodedOperationName)) {\n return operationMap.get(decodedOperationName);\n }\n throw new OperationNotFoundException(\"Could not find operation \" + operationName + \" on MBean \" +\n objectName.getCanonicalName());\n }", "public static vpntrafficpolicy_aaagroup_binding[] get(nitro_service service, String name) throws Exception{\n\t\tvpntrafficpolicy_aaagroup_binding obj = new vpntrafficpolicy_aaagroup_binding();\n\t\tobj.set_name(name);\n\t\tvpntrafficpolicy_aaagroup_binding response[] = (vpntrafficpolicy_aaagroup_binding[]) obj.get_resources(service);\n\t\treturn response;\n\t}", "private Expression correctClassClassChain(PropertyExpression pe) {\n LinkedList<Expression> stack = new LinkedList<Expression>();\n ClassExpression found = null;\n for (Expression it = pe; it != null; it = ((PropertyExpression) it).getObjectExpression()) {\n if (it instanceof ClassExpression) {\n found = (ClassExpression) it;\n break;\n } else if (!(it.getClass() == PropertyExpression.class)) {\n return pe;\n }\n stack.addFirst(it);\n }\n if (found == null) return pe;\n\n if (stack.isEmpty()) return pe;\n Object stackElement = stack.removeFirst();\n if (!(stackElement.getClass() == PropertyExpression.class)) return pe;\n PropertyExpression classPropertyExpression = (PropertyExpression) stackElement;\n String propertyNamePart = classPropertyExpression.getPropertyAsString();\n if (propertyNamePart == null || !propertyNamePart.equals(\"class\")) return pe;\n\n found.setSourcePosition(classPropertyExpression);\n if (stack.isEmpty()) return found;\n stackElement = stack.removeFirst();\n if (!(stackElement.getClass() == PropertyExpression.class)) return pe;\n PropertyExpression classPropertyExpressionContainer = (PropertyExpression) stackElement;\n\n classPropertyExpressionContainer.setObjectExpression(found);\n return pe;\n }" ]
gets the first non annotation line number of a node, taking into account annotations.
[ "public static int findFirstNonAnnotationLine(ASTNode node, SourceCode sourceCode) {\r\n if (node instanceof AnnotatedNode && !((AnnotatedNode) node).getAnnotations().isEmpty()) {\r\n\r\n // HACK: Groovy line numbers are broken when annotations have a parameter :(\r\n // so we must look at the lineNumber, not the lastLineNumber\r\n AnnotationNode lastAnnotation = null;\r\n for (AnnotationNode annotation : ((AnnotatedNode) node).getAnnotations()) {\r\n if (lastAnnotation == null) lastAnnotation = annotation;\r\n else if (lastAnnotation.getLineNumber() < annotation.getLineNumber()) lastAnnotation = annotation;\r\n }\r\n\r\n String rawLine = getRawLine(sourceCode, lastAnnotation.getLastLineNumber()-1);\r\n\r\n if(rawLine == null) {\r\n return node.getLineNumber();\r\n }\r\n\r\n // is the annotation the last thing on the line?\r\n if (rawLine.length() > lastAnnotation.getLastColumnNumber()) {\r\n // no it is not\r\n return lastAnnotation.getLastLineNumber();\r\n }\r\n // yes it is the last thing, return the next thing\r\n return lastAnnotation.getLastLineNumber() + 1;\r\n }\r\n return node.getLineNumber();\r\n }" ]
[ "public static ReportGenerator.Format getFormat( String... args ) {\n ConfigOptionParser configParser = new ConfigOptionParser();\n List<ConfigOption> configOptions = Arrays.asList( format, help );\n\n for( ConfigOption co : configOptions ) {\n if( co.hasDefault() ) {\n configParser.parsedOptions.put( co.getLongName(), co.getValue() );\n }\n }\n\n for( String arg : args ) {\n configParser.commandLineLookup( arg, format, configOptions );\n }\n\n // TODO properties\n // TODO environment\n\n if( !configParser.hasValue( format ) ) {\n configParser.printUsageAndExit( configOptions );\n }\n return (ReportGenerator.Format) configParser.getValue( format );\n }", "public void deleteIndex(String indexName, String designDocId, String type) {\n assertNotEmpty(indexName, \"indexName\");\n assertNotEmpty(designDocId, \"designDocId\");\n assertNotNull(type, \"type\");\n if (!designDocId.startsWith(\"_design\")) {\n designDocId = \"_design/\" + designDocId;\n }\n URI uri = new DatabaseURIHelper(db.getDBUri()).path(\"_index\").path(designDocId)\n .path(type).path(indexName).build();\n InputStream response = null;\n try {\n HttpConnection connection = Http.DELETE(uri);\n response = client.couchDbClient.executeToInputStream(connection);\n getResponse(response, Response.class, client.getGson());\n } finally {\n close(response);\n }\n }", "public static scala.collection.Iterable linkedListToScalaIterable(LinkedList<?> linkedList) {\n return JavaConverters.asScalaIterableConverter(linkedList).asScala();\n }", "private <T> Observable<PollingState<T>> updateStateFromLocationHeaderOnPutAsync(final PollingState<T> pollingState) {\n return pollAsync(pollingState.locationHeaderLink(), pollingState.loggingContext())\n .flatMap(new Func1<Response<ResponseBody>, Observable<PollingState<T>>>() {\n @Override\n public Observable<PollingState<T>> call(Response<ResponseBody> response) {\n int statusCode = response.code();\n if (statusCode == 202) {\n pollingState.withResponse(response);\n pollingState.withStatus(AzureAsyncOperation.IN_PROGRESS_STATUS, statusCode);\n } else if (statusCode == 200 || statusCode == 201) {\n try {\n pollingState.updateFromResponseOnPutPatch(response);\n } catch (CloudException | IOException e) {\n return Observable.error(e);\n }\n }\n return Observable.just(pollingState);\n }\n });\n }", "public static <T> Set<T> asSet(T[] o) {\r\n return new HashSet<T>(Arrays.asList(o));\r\n }", "private void validateAttributes() {\n if (content == null) {\n throw new NullContentException(\"RendererBuilder needs content to create Renderer instances\");\n }\n\n if (parent == null) {\n throw new NullParentException(\"RendererBuilder needs a parent to inflate Renderer instances\");\n }\n\n if (layoutInflater == null) {\n throw new NullLayoutInflaterException(\n \"RendererBuilder needs a LayoutInflater to inflate Renderer instances\");\n }\n }", "private void lockAndRegisterReferences(ClassDescriptor cld, Object sourceObject, int lockMode, List registeredObjects) throws LockNotGrantedException\r\n {\r\n if (implicitLocking)\r\n {\r\n Iterator i = cld.getObjectReferenceDescriptors(true).iterator();\r\n while (i.hasNext())\r\n {\r\n ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();\r\n Object refObj = rds.getPersistentField().get(sourceObject);\r\n if (refObj != null)\r\n {\r\n boolean isProxy = ProxyHelper.isProxy(refObj);\r\n RuntimeObject rt = isProxy ? new RuntimeObject(refObj, this, false) : new RuntimeObject(refObj, this);\r\n if (!registrationList.contains(rt.getIdentity()))\r\n {\r\n lockAndRegister(rt, lockMode, registeredObjects);\r\n }\r\n }\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 Set<RGBColor> colours() {\n return stream().map(Pixel::toColor).collect(Collectors.toSet());\n }" ]
Checks length and compare order of field names with declared PK fields in metadata.
[ "private boolean isOrdered(FieldDescriptor[] flds, String[] pkFieldNames)\r\n {\r\n if((flds.length > 1 && pkFieldNames == null) || flds.length != pkFieldNames.length)\r\n {\r\n throw new PersistenceBrokerException(\"pkFieldName length does not match number of defined PK fields.\" +\r\n \" Expected number of PK fields is \" + flds.length + \", given number was \" +\r\n (pkFieldNames != null ? pkFieldNames.length : 0));\r\n }\r\n boolean result = true;\r\n for(int i = 0; i < flds.length; i++)\r\n {\r\n FieldDescriptor fld = flds[i];\r\n result = result && fld.getPersistentField().getName().equals(pkFieldNames[i]);\r\n }\r\n return result;\r\n }" ]
[ "protected boolean isTransient(ClassDescriptor cld, Object obj, Identity oid)\r\n {\r\n // if the Identity is transient we assume a non-persistent object\r\n boolean isNew = oid != null && oid.isTransient();\r\n /*\r\n detection of new objects is costly (select of ID in DB to check if object\r\n already exists) we do:\r\n a. check if the object has nullified PK field\r\n b. check if the object is already registered\r\n c. lookup from cache and if not found, last option select on DB\r\n */\r\n if(!isNew)\r\n {\r\n final PersistenceBroker pb = getBroker();\r\n if(cld == null)\r\n {\r\n cld = pb.getClassDescriptor(obj.getClass());\r\n }\r\n isNew = pb.serviceBrokerHelper().hasNullPKField(cld, obj);\r\n if(!isNew)\r\n {\r\n if(oid == null)\r\n {\r\n oid = pb.serviceIdentity().buildIdentity(cld, obj);\r\n }\r\n final ObjectEnvelope mod = objectEnvelopeTable.getByIdentity(oid);\r\n if(mod != null)\r\n {\r\n // already registered object, use current state\r\n isNew = mod.needsInsert();\r\n }\r\n else\r\n {\r\n // if object was found cache, assume it's old\r\n // else make costly check against the DB\r\n isNew = pb.serviceObjectCache().lookup(oid) == null\r\n && !pb.serviceBrokerHelper().doesExist(cld, oid, obj);\r\n }\r\n }\r\n }\r\n return isNew;\r\n }", "public String login(String token, Authentication authentication) {\n\t\tif (null == token) {\n\t\t\treturn login(authentication);\n\t\t}\n\t\ttokens.put(token, new TokenContainer(authentication));\n\t\treturn token;\n\t}", "public void setKnots(int[] x, int[] rgb, byte[] types) {\n\t\tnumKnots = rgb.length+2;\n\t\txKnots = new int[numKnots];\n\t\tyKnots = new int[numKnots];\n\t\tknotTypes = new byte[numKnots];\n\t\tif (x != null)\n\t\t\tSystem.arraycopy(x, 0, xKnots, 1, numKnots-2);\n\t\telse\n\t\t\tfor (int i = 1; i > numKnots-1; i++)\n\t\t\t\txKnots[i] = 255*i/(numKnots-2);\n\t\tSystem.arraycopy(rgb, 0, yKnots, 1, numKnots-2);\n\t\tif (types != null)\n\t\t\tSystem.arraycopy(types, 0, knotTypes, 1, numKnots-2);\n\t\telse\n\t\t\tfor (int i = 0; i > numKnots; i++)\n\t\t\t\tknotTypes[i] = RGB|SPLINE;\n\t\tsortKnots();\n\t\trebuildGradient();\n\t}", "protected void eigenvalue2by2( int x1 ) {\n double a = diag[x1];\n double b = off[x1];\n double c = diag[x1+1];\n\n // normalize to reduce overflow\n double absA = Math.abs(a);\n double absB = Math.abs(b);\n double absC = Math.abs(c);\n\n double scale = absA > absB ? absA : absB;\n if( absC > scale ) scale = absC;\n\n // see if it is a pathological case. the diagonal must already be zero\n // and the eigenvalues are all zero. so just return\n if( scale == 0 ) {\n off[x1] = 0;\n diag[x1] = 0;\n diag[x1+1] = 0;\n return;\n }\n\n a /= scale;\n b /= scale;\n c /= scale;\n\n eigenSmall.symm2x2_fast(a,b,c);\n\n off[x1] = 0;\n diag[x1] = scale*eigenSmall.value0.real;\n diag[x1+1] = scale*eigenSmall.value1.real;\n }", "public static base_response add(nitro_service client, onlinkipv6prefix resource) throws Exception {\n\t\tonlinkipv6prefix addresource = new onlinkipv6prefix();\n\t\taddresource.ipv6prefix = resource.ipv6prefix;\n\t\taddresource.onlinkprefix = resource.onlinkprefix;\n\t\taddresource.autonomusprefix = resource.autonomusprefix;\n\t\taddresource.depricateprefix = resource.depricateprefix;\n\t\taddresource.decrementprefixlifetimes = resource.decrementprefixlifetimes;\n\t\taddresource.prefixvalidelifetime = resource.prefixvalidelifetime;\n\t\taddresource.prefixpreferredlifetime = resource.prefixpreferredlifetime;\n\t\treturn addresource.add_resource(client);\n\t}", "private OperationEntry getInheritableOperationEntryLocked(final String operationName) {\n final OperationEntry entry = operations == null ? null : operations.get(operationName);\n if (entry != null && entry.isInherited()) {\n return entry;\n }\n return null;\n }", "private static EventEnumType convertEventType(org.talend.esb.sam.common.event.EventTypeEnum eventType) {\n if (eventType == null) {\n return null;\n }\n return EventEnumType.valueOf(eventType.name());\n }", "public Class<T> getProxyClass() {\n String suffix = \"_$$_Weld\" + getProxyNameSuffix();\n String proxyClassName = getBaseProxyName();\n if (!proxyClassName.endsWith(suffix)) {\n proxyClassName = proxyClassName + suffix;\n }\n if (proxyClassName.startsWith(JAVA)) {\n proxyClassName = proxyClassName.replaceFirst(JAVA, \"org.jboss.weld\");\n }\n Class<T> proxyClass = null;\n Class<?> originalClass = bean != null ? bean.getBeanClass() : proxiedBeanType;\n BeanLogger.LOG.generatingProxyClass(proxyClassName);\n try {\n // First check to see if we already have this proxy class\n proxyClass = cast(classLoader == null? proxyServices.loadClass(originalClass, proxyClassName) : classLoader.loadClass(proxyClassName));\n } catch (ClassNotFoundException e) {\n // Create the proxy class for this instance\n try {\n proxyClass = createProxyClass(originalClass, proxyClassName);\n } catch (Throwable e1) {\n //attempt to load the class again, just in case another thread\n //defined it between the check and the create method\n try {\n proxyClass = cast(classLoader == null? proxyServices.loadClass(originalClass, proxyClassName) : classLoader.loadClass(proxyClassName));\n } catch (ClassNotFoundException e2) {\n BeanLogger.LOG.catchingDebug(e1);\n throw BeanLogger.LOG.unableToLoadProxyClass(bean, proxiedBeanType, e1);\n }\n }\n }\n return proxyClass;\n }", "protected boolean isPrefixBlock(long divisionValue, long upperValue, int divisionPrefixLen) {\n\t\tif(divisionPrefixLen == 0) {\n\t\t\treturn divisionValue == 0 && upperValue == getMaxValue();\n\t\t}\n\t\tlong ones = ~0L;\n\t\tlong divisionBitMask = ~(ones << getBitCount());\n\t\tlong divisionPrefixMask = ones << (getBitCount() - divisionPrefixLen);\n\t\tlong divisionNonPrefixMask = ~divisionPrefixMask;\n\t\treturn testRange(divisionValue,\n\t\t\t\tupperValue,\n\t\t\t\tupperValue,\n\t\t\t\tdivisionPrefixMask & divisionBitMask,\n\t\t\t\tdivisionNonPrefixMask);\n\t}" ]
Creates a new Logger instance for the specified name.
[ "private Logger createLoggerInstance(String loggerName) throws Exception\r\n {\r\n Class loggerClass = getConfiguration().getLoggerClass();\r\n Logger log = (Logger) ClassHelper.newInstance(loggerClass, String.class, loggerName);\r\n log.configure(getConfiguration());\r\n return log;\r\n }" ]
[ "public void forAllIndexDescriptorColumns(String template, Properties attributes) throws XDocletException\r\n {\r\n String fields = _curIndexDescriptorDef.getProperty(PropertyHelper.OJB_PROPERTY_FIELDS);\r\n FieldDescriptorDef fieldDef;\r\n String name;\r\n\r\n for (CommaListIterator it = new CommaListIterator(fields); it.hasNext();)\r\n {\r\n name = it.getNext();\r\n fieldDef = _curClassDef.getField(name);\r\n if (fieldDef == null)\r\n {\r\n throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class,\r\n XDocletModulesOjbMessages.INDEX_FIELD_MISSING,\r\n new String[]{name, _curIndexDescriptorDef.getName(), _curClassDef.getName()}));\r\n }\r\n _curIndexColumn = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN);\r\n generate(template);\r\n }\r\n _curIndexColumn = null;\r\n }", "public static String encodeUrlIso(String stringToEncode) {\n try {\n return URLEncoder.encode(stringToEncode, \"ISO-8859-1\");\n } catch (UnsupportedEncodingException e1) {\n throw new RuntimeException(e1);\n }\n }", "public Object getRealObjectIfMaterialized(Object objectOrProxy)\r\n {\r\n if(isNormalOjbProxy(objectOrProxy))\r\n {\r\n String msg;\r\n\r\n try\r\n {\r\n IndirectionHandler handler = getIndirectionHandler(objectOrProxy);\r\n\r\n return handler.alreadyMaterialized() ? handler.getRealSubject() : null;\r\n }\r\n catch(ClassCastException e)\r\n {\r\n // shouldn't happen but still ...\r\n msg = \"The InvocationHandler for the provided Proxy was not an instance of \" + IndirectionHandler.class.getName();\r\n log.error(msg);\r\n throw new PersistenceBrokerException(msg, e);\r\n }\r\n catch(IllegalArgumentException e)\r\n {\r\n msg = \"Could not retrieve real object for given Proxy: \" + objectOrProxy;\r\n log.error(msg);\r\n throw new PersistenceBrokerException(msg, e);\r\n }\r\n catch(PersistenceBrokerException e)\r\n {\r\n log.error(\"Could not retrieve real object for given Proxy: \" + objectOrProxy);\r\n throw e;\r\n }\r\n }\r\n else if(isVirtualOjbProxy(objectOrProxy))\r\n {\r\n try\r\n {\r\n VirtualProxy proxy = (VirtualProxy) objectOrProxy;\r\n\r\n return proxy.alreadyMaterialized() ? proxy.getRealSubject() : null;\r\n }\r\n catch(PersistenceBrokerException e)\r\n {\r\n log.error(\"Could not retrieve real object for VirtualProxy: \" + objectOrProxy);\r\n throw e;\r\n }\r\n }\r\n else\r\n {\r\n return objectOrProxy;\r\n }\r\n }", "protected FluentModelTImpl find(String key) {\n for (Map.Entry<String, FluentModelTImpl> entry : this.childCollection.entrySet()) {\n if (entry.getKey().equalsIgnoreCase(key)) {\n return entry.getValue();\n }\n }\n return null;\n }", "public MessageSet read(long offset, int length) throws IOException {\n List<LogSegment> views = segments.getView();\n LogSegment found = findRange(views, offset, views.size());\n if (found == null) {\n if (logger.isTraceEnabled()) {\n logger.trace(format(\"NOT FOUND MessageSet from Log[%s], offset=%d, length=%d\", name, offset, length));\n }\n return MessageSet.Empty;\n }\n return found.getMessageSet().read(offset - found.start(), length);\n }", "public final TagConfiguration.Builder configureTag( Class<? extends Annotation> tagAnnotation ) {\n TagConfiguration configuration = new TagConfiguration( tagAnnotation );\n tagConfigurations.put( tagAnnotation, configuration );\n return new TagConfiguration.Builder( configuration );\n }", "public static DMatrixRMaj copyTriangle(DMatrixRMaj src , DMatrixRMaj dst , boolean upper ) {\n if( dst == null ) {\n dst = new DMatrixRMaj(src.numRows,src.numCols);\n } else if( src.numRows != dst.numRows || src.numCols != dst.numCols ) {\n throw new IllegalArgumentException(\"src and dst must have the same dimensions.\");\n }\n\n if( upper ) {\n int N = Math.min(src.numRows,src.numCols);\n for( int i = 0; i < N; i++ ) {\n int index = i*src.numCols+i;\n System.arraycopy(src.data,index,dst.data,index,src.numCols-i);\n }\n } else {\n for( int i = 0; i < src.numRows; i++ ) {\n int length = Math.min(i+1,src.numCols);\n int index = i*src.numCols;\n System.arraycopy(src.data,index,dst.data,index,length);\n }\n }\n\n return dst;\n }", "public static sslciphersuite[] get(nitro_service service, options option) throws Exception{\n\t\tsslciphersuite obj = new sslciphersuite();\n\t\tsslciphersuite[] response = (sslciphersuite[])obj.get_resources(service,option);\n\t\treturn response;\n\t}", "public Map getPathClasses()\r\n\t{\r\n\t\tif (m_pathClasses.isEmpty())\r\n\t\t{\r\n\t\t\tif (m_parentCriteria == null)\r\n\t\t\t{\r\n\t\t\t\tif (m_query == null)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn m_pathClasses;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\treturn m_query.getPathClasses();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\treturn m_parentCriteria.getPathClasses();\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn m_pathClasses;\r\n\t\t}\r\n\t}" ]
Checks that the targetClass is widening the argument class @param argumentClass @param targetClass @return
[ "private static boolean isWideningPrimitive(Class<?> argumentClass, Class<?> targetClass) {\n return WIDENING_TABLE.containsKey(argumentClass) && WIDENING_TABLE.get(argumentClass).contains(targetClass);\n }" ]
[ "public Set<DeviceAnnouncement> findUnreachablePlayers() {\n ensureRunning();\n Set<DeviceAnnouncement> result = new HashSet<DeviceAnnouncement>();\n for (DeviceAnnouncement candidate: DeviceFinder.getInstance().getCurrentDevices()) {\n if (!Util.sameNetwork(matchedAddress.getNetworkPrefixLength(), matchedAddress.getAddress(), candidate.getAddress())) {\n result.add(candidate);\n }\n }\n return Collections.unmodifiableSet(result);\n }", "public double getProgressFromResponse(ResponseOnSingeRequest myResponse) {\n\n double progress = 0.0;\n try {\n\n if (myResponse == null || myResponse.isFailObtainResponse()) {\n return progress;\n }\n\n String responseBody = myResponse.getResponseBody();\n Pattern regex = Pattern.compile(progressRegex);\n Matcher matcher = regex.matcher(responseBody);\n if (matcher.matches()) {\n String progressStr = matcher.group(1);\n progress = Double.parseDouble(progressStr);\n }\n\n } catch (Exception t) {\n logger.error(\"fail \" + t);\n\n }\n\n return progress;\n }", "private Map<String, String> fillInitialVariables() {\r\n Map<String, TransitionTarget> targets = model.getChildren();\n\r\n Set<String> variables = new HashSet<>();\r\n for (TransitionTarget target : targets.values()) {\r\n OnEntry entry = target.getOnEntry();\r\n List<Action> actions = entry.getActions();\r\n for (Action action : actions) {\r\n if (action instanceof Assign) {\r\n String variable = ((Assign) action).getName();\r\n variables.add(variable);\r\n } else if (action instanceof SetAssignExtension.SetAssignTag) {\r\n String variable = ((SetAssignExtension.SetAssignTag) action).getName();\r\n variables.add(variable);\r\n }\r\n }\r\n }\n\r\n Map<String, String> result = new HashMap<>();\r\n for (String variable : variables) {\r\n result.put(variable, \"\");\r\n }\n\r\n return result;\r\n }", "public TileMap getCapabilities(TmsLayer layer) throws TmsLayerException {\n\t\ttry {\n\t\t\t// Create a JaxB unmarshaller:\n\t\t\tJAXBContext context = JAXBContext.newInstance(TileMap.class);\n\t\t\tUnmarshaller um = context.createUnmarshaller();\n\n\t\t\t// Find out where to retrieve the capabilities and unmarshall:\n\t\t\tif (layer.getBaseTmsUrl().startsWith(CLASSPATH)) {\n\t\t\t\tString location = layer.getBaseTmsUrl().substring(CLASSPATH.length());\n\t\t\t\tif (location.length() > 0 && location.charAt(0) == '/') {\n\t\t\t\t\t// classpath resources should not start with a slash, but they often do\n\t\t\t\t\tlocation = location.substring(1);\n\t\t\t\t}\n\t\t\t\tClassLoader cl = Thread.currentThread().getContextClassLoader();\n\t\t\t\tif (null == cl) {\n\t\t\t\t\tcl = getClass().getClassLoader(); // NOSONAR fallback from proper behaviour for some environments\n\t\t\t\t}\n\t\t\t\tInputStream is = cl.getResourceAsStream(location);\n\t\t\t\tif (null != is) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn (TileMap) um.unmarshal(is);\n\t\t\t\t\t} finally {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tis.close();\n\t\t\t\t\t\t} catch (IOException ioe) {\n\t\t\t\t\t\t\t// ignore, just closing the stream\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthrow new TmsLayerException(TmsLayerException.COULD_NOT_FIND_FILE, layer.getBaseTmsUrl());\n\t\t\t}\n\n\t\t\t// Normal case, find the URL and unmarshal:\n\t\t\treturn (TileMap) um.unmarshal(httpService.getStream(layer.getBaseTmsUrl(), layer));\n\t\t} catch (JAXBException e) {\n\t\t\tthrow new TmsLayerException(e, TmsLayerException.COULD_NOT_READ_FILE, layer.getBaseTmsUrl());\n\t\t} catch (IOException e) {\n\t\t\tthrow new TmsLayerException(e, TmsLayerException.COULD_NOT_READ_FILE, layer.getBaseTmsUrl());\n\t\t}\n\t}", "@SuppressWarnings(\"rawtypes\") public static final Map getMap(Locale locale, String key)\n {\n ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale);\n return ((Map) bundle.getObject(key));\n }", "public static void validateClusterPartitionCounts(final Cluster lhs, final Cluster rhs) {\n if(lhs.getNumberOfPartitions() != rhs.getNumberOfPartitions())\n throw new VoldemortException(\"Total number of partitions should be equal [ lhs cluster (\"\n + lhs.getNumberOfPartitions()\n + \") not equal to rhs cluster (\"\n + rhs.getNumberOfPartitions() + \") ]\");\n }", "private List<Entry> getChildNodes(DirectoryEntry parent)\n {\n List<Entry> result = new ArrayList<Entry>();\n Iterator<Entry> entries = parent.getEntries();\n while (entries.hasNext())\n {\n result.add(entries.next());\n }\n return result;\n }", "public ItemRequest<Task> addProject(String task) {\n \n String path = String.format(\"/tasks/%s/addProject\", task);\n return new ItemRequest<Task>(this, Task.class, path, \"POST\");\n }", "public static final Boolean parseBoolean(String value)\n {\n return (value == null || value.charAt(0) != '1' ? Boolean.FALSE : Boolean.TRUE);\n }" ]
Returns a new analysis context builder that extracts the information about the available extensions from the provided Revapi instance. <p>The extensions have to be known so that both old and new style of configuration can be usefully worked with. @param revapi the revapi instance to read the available extensions from @return a new analysis context builder
[ "@Nonnull\n public static Builder builder(Revapi revapi) {\n List<String> knownExtensionIds = new ArrayList<>();\n\n addExtensionIds(revapi.getPipelineConfiguration().getApiAnalyzerTypes(), knownExtensionIds);\n addExtensionIds(revapi.getPipelineConfiguration().getTransformTypes(), knownExtensionIds);\n addExtensionIds(revapi.getPipelineConfiguration().getFilterTypes(), knownExtensionIds);\n addExtensionIds(revapi.getPipelineConfiguration().getReporterTypes(), knownExtensionIds);\n\n return new Builder(knownExtensionIds);\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 }", "@JsonInclude(Include.NON_EMPTY)\n\t@JsonProperty(\"id\")\n\tpublic String getJsonId() {\n\t\tif (!EntityIdValue.SITE_LOCAL.equals(this.siteIri)) {\n\t\t\treturn this.entityId;\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}", "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 org.apache.log4j.helpers.PatternParser createPatternParser(final String pattern) {\n\t\treturn new FoundationLoggingPatternParser(pattern);\n\t}", "public Date getFinish()\n {\n Date result = (Date) getCachedValue(AssignmentField.FINISH);\n if (result == null)\n {\n result = getTask().getFinish();\n }\n return result;\n }", "public void fatal(Throwable throwable, String msg, Object[] argArray) {\n\t\tlogIfEnabled(Level.FATAL, throwable, msg, UNKNOWN_ARG, UNKNOWN_ARG, UNKNOWN_ARG, argArray);\n\t}", "public ThumborUrlBuilder buildImage(String image) {\n if (image == null || image.length() == 0) {\n throw new IllegalArgumentException(\"Image must not be blank.\");\n }\n return new ThumborUrlBuilder(host, key, image);\n }", "@SuppressWarnings({\"unused\", \"WeakerAccess\"})\n public static NotificationInfo getNotificationInfo(final Bundle extras) {\n if (extras == null) return new NotificationInfo(false, false);\n\n boolean fromCleverTap = extras.containsKey(Constants.NOTIFICATION_TAG);\n boolean shouldRender = fromCleverTap && extras.containsKey(\"nm\");\n return new NotificationInfo(fromCleverTap, shouldRender);\n }", "private Map<String, Table> getIndex(Table table)\n {\n Map<String, Table> result;\n\n if (!table.getResourceFlag())\n {\n result = m_taskTablesByName;\n }\n else\n {\n result = m_resourceTablesByName;\n }\n return result;\n }" ]
The normalized string returned by this method is consistent with java.net.Inet6address. IPs are not compressed nor mixed in this representation.
[ "@Override\n\tpublic String toNormalizedString() {\n\t\tString result;\n\t\tif(hasNoStringCache() || (result = getStringCache().normalizedString) == null) {\n\t\t\tgetStringCache().normalizedString = result = toNormalizedString(IPv6StringCache.normalizedParams);\n\t\t}\n\t\treturn result;\n\t}" ]
[ "protected LogContext getOrCreate(final String loggingProfile) {\n LogContext result = profileContexts.get(loggingProfile);\n if (result == null) {\n result = LogContext.create();\n final LogContext current = profileContexts.putIfAbsent(loggingProfile, result);\n if (current != null) {\n result = current;\n }\n }\n return result;\n }", "private EditorState getDefaultState() {\n\n List<TableProperty> cols = new ArrayList<TableProperty>(1);\n cols.add(TableProperty.TRANSLATION);\n\n return new EditorState(cols, false);\n }", "public static dnsnsecrec get(nitro_service service, String hostname) throws Exception{\n\t\tdnsnsecrec obj = new dnsnsecrec();\n\t\tobj.set_hostname(hostname);\n\t\tdnsnsecrec response = (dnsnsecrec) obj.get_resource(service);\n\t\treturn response;\n\t}", "private Query getFKQuery(Object obj, ClassDescriptor cld, CollectionDescriptor cds)\r\n {\r\n Query fkQuery;\r\n QueryByCriteria fkQueryCrit;\r\n\r\n if (cds.isMtoNRelation())\r\n {\r\n fkQueryCrit = getFKQueryMtoN(obj, cld, cds);\r\n }\r\n else\r\n {\r\n fkQueryCrit = getFKQuery1toN(obj, cld, cds);\r\n }\r\n\r\n // check if collection must be ordered\r\n if (!cds.getOrderBy().isEmpty())\r\n {\r\n Iterator iter = cds.getOrderBy().iterator();\r\n while (iter.hasNext())\r\n {\r\n fkQueryCrit.addOrderBy((FieldHelper)iter.next());\r\n }\r\n }\r\n\r\n // BRJ: customize the query\r\n if (cds.getQueryCustomizer() != null)\r\n {\r\n fkQuery = cds.getQueryCustomizer().customizeQuery(obj, pb, cds, fkQueryCrit);\r\n }\r\n else\r\n {\r\n fkQuery = fkQueryCrit;\r\n }\r\n\r\n return fkQuery;\r\n }", "public double[] getMoneynessAsOffsets() {\r\n\t\tDoubleStream moneyness = getGridNodesPerMoneyness().keySet().stream().mapToDouble(Integer::doubleValue);\r\n\t\tif(quotingConvention == QuotingConvention.PAYERVOLATILITYLOGNORMAL) {\r\n\t\t\tmoneyness = moneyness.map(new DoubleUnaryOperator() {\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic double applyAsDouble(double x) {\r\n\t\t\t\t\treturn x * 0.01;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t} else if(quotingConvention == QuotingConvention.RECEIVERPRICE) {\r\n\t\t\tmoneyness = moneyness.map(new DoubleUnaryOperator() {\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic double applyAsDouble(double x) {\r\n\t\t\t\t\treturn - x * 0.0001;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\tmoneyness = moneyness.map(new DoubleUnaryOperator() {\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic double applyAsDouble(double x) {\r\n\t\t\t\t\treturn x * 0.0001;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn moneyness.toArray();\r\n\t}", "@PreDestroy\n public void disconnectLocator() throws InterruptedException,\n ServiceLocatorException {\n if (LOG.isLoggable(Level.FINE)) {\n LOG.fine(\"Destroy Locator client\");\n }\n\n if (endpointCollector != null) {\n endpointCollector.stopScheduledCollection();\n }\n \n if (locatorClient != null) {\n locatorClient.disconnect();\n locatorClient = null;\n }\n }", "public AsciiTable setTextAlignment(TextAlignment textAlignment){\r\n\t\tfor(AT_Row row : this.rows){\r\n\t\t\tif(row.getType()==TableRowType.CONTENT){\r\n\t\t\t\trow.setTextAlignment(textAlignment);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn this;\r\n\t}", "public static EventLog getEnterpriseEvents(BoxAPIConnection api, Date after, Date before, BoxEvent.Type... types) {\n return getEnterpriseEvents(api, null, after, before, ENTERPRISE_LIMIT, types);\n }", "public ArrayList<String> getCarouselImages(){\n ArrayList<String> carouselImages = new ArrayList<>();\n for(CTInboxMessageContent ctInboxMessageContent: getInboxMessageContents()){\n carouselImages.add(ctInboxMessageContent.getMedia());\n }\n return carouselImages;\n }" ]
Add an additional binary type
[ "@Override\n public void accept(IBinaryType binaryType, PackageBinding packageBinding, AccessRestriction accessRestriction) {\n if (this.options.verbose) {\n this.out.println(\n Messages.bind(Messages.compilation_loadBinary, new String(binaryType.getName())));\n//\t\t\tnew Exception(\"TRACE BINARY\").printStackTrace(System.out);\n//\t\t System.out.println();\n }\n LookupEnvironment env = packageBinding.environment;\n env.createBinaryTypeFrom(binaryType, packageBinding, accessRestriction);\n }" ]
[ "public Iterator getAllExtentClasses()\r\n {\r\n ArrayList subTypes = new ArrayList();\r\n\r\n subTypes.addAll(_extents);\r\n\r\n for (int idx = 0; idx < subTypes.size(); idx++)\r\n {\r\n ClassDescriptorDef curClassDef = (ClassDescriptorDef)subTypes.get(idx);\r\n\r\n for (Iterator it = curClassDef.getExtentClasses(); it.hasNext();)\r\n {\r\n ClassDescriptorDef curSubTypeDef = (ClassDescriptorDef)it.next();\r\n\r\n if (!subTypes.contains(curSubTypeDef))\r\n {\r\n subTypes.add(curSubTypeDef);\r\n }\r\n }\r\n }\r\n return subTypes.iterator();\r\n }", "public static String post(String url, Map<String, String> customHeaders, Map<String, String> params) throws IOException, HTTPException {\n LOGGER.log(Level.INFO, \"Sending POST request to the url {0}\", url);\n\n HttpPost httpPost = new HttpPost(url);\n\n populateHeaders(httpPost, customHeaders);\n\n if (params != null && params.size() > 0) {\n List<NameValuePair> nameValuePairs = new ArrayList<>();\n for (Map.Entry<String, String> param : params.entrySet()) {\n nameValuePairs.add(new BasicNameValuePair(param.getKey(), param.getValue()));\n }\n httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));\n }\n\n HttpClient httpClient = HttpClientBuilder.create().build();\n\n HttpResponse httpResponse = httpClient.execute(httpPost);\n\n int statusCode = httpResponse.getStatusLine().getStatusCode();\n if (isErrorStatus(statusCode)) {\n String jsonErrorResponse = EntityUtils.toString(httpResponse.getEntity(), StandardCharsets.UTF_8);\n throw new HTTPException(statusCode, httpResponse.getStatusLine().getReasonPhrase(), jsonErrorResponse);\n }\n\n return EntityUtils.toString(httpResponse.getEntity(), StandardCharsets.UTF_8);\n }", "public static <S extends Matrix, D extends Matrix> LinearSolver<S,D> safe(LinearSolver<S,D> solver ) {\n if( solver.modifiesA() || solver.modifiesB() ) {\n if( solver instanceof LinearSolverDense ) {\n return new LinearSolverSafe((LinearSolverDense)solver);\n } else if( solver instanceof LinearSolverSparse ) {\n return new LinearSolverSparseSafe((LinearSolverSparse)solver);\n } else {\n throw new IllegalArgumentException(\"Unknown solver type\");\n }\n } else {\n return solver;\n }\n }", "public NamespacesList<Pair> getPairs(String namespace, String predicate, int perPage, int page) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n NamespacesList<Pair> nsList = new NamespacesList<Pair>();\r\n parameters.put(\"method\", METHOD_GET_PAIRS);\r\n\r\n if (namespace != null) {\r\n parameters.put(\"namespace\", namespace);\r\n }\r\n if (predicate != null) {\r\n parameters.put(\"predicate\", predicate);\r\n }\r\n if (perPage > 0) {\r\n parameters.put(\"per_page\", \"\" + perPage);\r\n }\r\n if (page > 0) {\r\n parameters.put(\"page\", \"\" + page);\r\n }\r\n\r\n Response response = transportAPI.get(transportAPI.getPath(), parameters, apiKey, sharedSecret);\r\n if (response.isError()) {\r\n throw new FlickrException(response.getErrorCode(), response.getErrorMessage());\r\n }\r\n Element nsElement = response.getPayload();\r\n NodeList nsNodes = nsElement.getElementsByTagName(\"pair\");\r\n nsList.setPage(nsElement.getAttribute(\"page\"));\r\n nsList.setPages(nsElement.getAttribute(\"pages\"));\r\n nsList.setPerPage(nsElement.getAttribute(\"perPage\"));\r\n nsList.setTotal(\"\" + nsNodes.getLength());\r\n for (int i = 0; i < nsNodes.getLength(); i++) {\r\n Element element = (Element) nsNodes.item(i);\r\n nsList.add(parsePair(element));\r\n }\r\n return nsList;\r\n }", "@Api\n\tpublic void setFeatureModel(FeatureModel featureModel) throws LayerException {\n\t\tthis.featureModel = featureModel;\n\t\tif (null != getLayerInfo()) {\n\t\t\tfeatureModel.setLayerInfo(getLayerInfo());\n\t\t}\n\t\tfilterService.registerFeatureModel(featureModel);\n\t}", "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}", "@SuppressWarnings({\"unused\", \"WeakerAccess\"})\n public static void changeCredentials(String accountID, String token, String region) {\n if(defaultConfig != null){\n Logger.i(\"CleverTap SDK already initialized with accountID:\"+defaultConfig.getAccountId()\n +\" and token:\"+defaultConfig.getAccountToken()+\". Cannot change credentials to \"\n + accountID + \" and \" + token);\n return;\n }\n\n ManifestInfo.changeCredentials(accountID,token,region);\n }", "public static Operation createDeployOperation(final DeploymentDescription deployment) {\n Assert.checkNotNullParam(\"deployment\", deployment);\n final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true);\n addDeployOperationStep(builder, deployment);\n return builder.build();\n }", "public JSONObject getJsonFormatted(Map<String, String> dataMap) {\r\n JSONObject oneRowJson = new JSONObject();\n\r\n for (int i = 0; i < outTemplate.length; i++) {\r\n oneRowJson.put(outTemplate[i], dataMap.get(outTemplate[i]));\r\n }\n\n\r\n return oneRowJson;\r\n }" ]
Generates the InputValue for the form input by inspecting the current value of the corresponding WebElement on the DOM. @return The current InputValue for the element on the DOM.
[ "private InputValue getInputValue(FormInput input) {\n\n\t\t/* Get the DOM element from Selenium. */\n\t\tWebElement inputElement = browser.getWebElement(input.getIdentification());\n\n\t\tswitch (input.getType()) {\n\t\t\tcase TEXT:\n\t\t\tcase PASSWORD:\n\t\t\tcase HIDDEN:\n\t\t\tcase SELECT:\n\t\t\tcase TEXTAREA:\n\t\t\t\treturn new InputValue(inputElement.getAttribute(\"value\"));\n\t\t\tcase RADIO:\n\t\t\tcase CHECKBOX:\n\t\t\tdefault:\n\t\t\t\tString value = inputElement.getAttribute(\"value\");\n\t\t\t\tBoolean checked = inputElement.isSelected();\n\t\t\t\treturn new InputValue(value, checked);\n\t\t}\n\n\t}" ]
[ "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 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 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 void setWholeDay(Boolean isWholeDay) {\r\n\r\n if (m_model.isWholeDay() ^ ((null != isWholeDay) && isWholeDay.booleanValue())) {\r\n m_model.setWholeDay(isWholeDay);\r\n valueChanged();\r\n }\r\n }", "private void initDurationPanel() {\n\n m_durationPrefixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_PREFIX_0));\n m_durationAfterPostfixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_OCC_POSTFIX_0));\n m_seriesEndDate.setDateOnly(true);\n m_seriesEndDate.setAllowInvalidValue(true);\n m_seriesEndDate.setValue(m_model.getSeriesEndDate());\n m_seriesEndDate.getTextField().addFocusHandler(new FocusHandler() {\n\n public void onFocus(FocusEvent event) {\n\n if (handleChange()) {\n onSeriesEndDateFocus(event);\n }\n\n }\n });\n }", "public static String encodeQuery(String query, String encoding) throws UnsupportedEncodingException {\n\t\treturn HierarchicalUriComponents.encodeUriComponent(query, encoding, HierarchicalUriComponents.Type.QUERY);\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 }", "@PostConstruct\n\tprotected void postConstruct() {\n\t\tif (null == authenticationServices) {\n\t\t\tauthenticationServices = new ArrayList<AuthenticationService>();\n\t\t}\n\t\tif (!excludeDefault) {\n\t\t\tauthenticationServices.add(staticAuthenticationService);\n\t\t}\n\t}", "private String getProperty(String name) {\n return System.getSecurityManager() == null ? System.getProperty(name) : doPrivileged(new ReadPropertyAction(name));\n }" ]
checks if there is a writelock for transaction tx on object obj. Returns true if so, else false.
[ "public synchronized boolean checkWrite(TransactionImpl tx, Object obj)\r\n {\r\n if (log.isDebugEnabled()) log.debug(\"LM.checkWrite(tx-\" + tx.getGUID() + \", \" + new Identity(obj, tx.getBroker()).toString() + \")\");\r\n LockStrategy lockStrategy = LockStrategyFactory.getStrategyFor(obj);\r\n return lockStrategy.checkWrite(tx, obj);\r\n }" ]
[ "public void addExtraInfo(String key, Object value) {\n // Turn extraInfo into map\n Map<String, Object> infoMap = (HashMap<String, Object>)getMapFromJSON(extraInfo);\n // Add value\n infoMap.put(key, value);\n\n // Turn back into string\n extraInfo = getJSONFromMap(infoMap);\n }", "public boolean getOverAllocated()\n {\n Boolean overallocated = (Boolean) getCachedValue(ResourceField.OVERALLOCATED);\n if (overallocated == null)\n {\n Number peakUnits = getPeakUnits();\n Number maxUnits = getMaxUnits();\n overallocated = Boolean.valueOf(NumberHelper.getDouble(peakUnits) > NumberHelper.getDouble(maxUnits));\n set(ResourceField.OVERALLOCATED, overallocated);\n }\n return (overallocated.booleanValue());\n }", "public static <T> OptionalValue<T> ofNullable(T value) {\n return new GenericOptionalValue<T>(RUNTIME_SOURCE, DEFAULT_KEY, value);\n }", "@UiHandler(\"m_seriesCheckBox\")\n void onSeriesChange(ValueChangeEvent<Boolean> event) {\n\n if (handleChange()) {\n m_controller.setIsSeries(event.getValue());\n }\n }", "public static base_response update(nitro_service client, rsskeytype resource) throws Exception {\n\t\trsskeytype updateresource = new rsskeytype();\n\t\tupdateresource.rsstype = resource.rsstype;\n\t\treturn updateresource.update_resource(client);\n\t}", "private static Data loadLeapSeconds(URL url) throws ClassNotFoundException, IOException {\n List<String> lines;\n try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), StandardCharsets.UTF_8))) {\n lines = reader.lines().collect(Collectors.toList());\n }\n List<Long> dates = new ArrayList<>();\n List<Integer> offsets = new ArrayList<>();\n for (String line : lines) {\n line = line.trim();\n if (line.isEmpty() || line.startsWith(\"#\")) {\n continue;\n }\n Matcher matcher = LEAP_FILE_FORMAT.matcher(line);\n if (matcher.matches() == false) {\n throw new StreamCorruptedException(\"Invalid leap second file\");\n }\n dates.add(LocalDate.parse(matcher.group(1)).getLong(JulianFields.MODIFIED_JULIAN_DAY));\n offsets.add(Integer.valueOf(matcher.group(2)));\n }\n long[] datesData = new long[dates.size()];\n int[] offsetsData = new int[dates.size()];\n long[] taiData = new long[dates.size()];\n for (int i = 0; i < datesData.length; i++) {\n datesData[i] = dates.get(i);\n offsetsData[i] = offsets.get(i);\n taiData[i] = tai(datesData[i], offsetsData[i]);\n }\n return new Data(datesData, offsetsData, taiData);\n }", "public void addForeignkey(String relationName, String remoteTable, List localColumns, List remoteColumns)\r\n {\r\n ForeignkeyDef foreignkeyDef = new ForeignkeyDef(relationName, remoteTable);\r\n\r\n // the field arrays have the same length if we already checked the constraints\r\n for (int idx = 0; idx < localColumns.size(); idx++)\r\n {\r\n foreignkeyDef.addColumnPair((String)localColumns.get(idx),\r\n (String)remoteColumns.get(idx));\r\n }\r\n\r\n // we got to determine whether this foreignkey is already present \r\n ForeignkeyDef def = null;\r\n\r\n for (Iterator it = getForeignkeys(); it.hasNext();)\r\n {\r\n def = (ForeignkeyDef)it.next();\r\n if (foreignkeyDef.equals(def))\r\n {\r\n return;\r\n }\r\n }\r\n foreignkeyDef.setOwner(this);\r\n _foreignkeys.add(foreignkeyDef);\r\n }", "private ServerSetup[] createServerSetup() {\n List<ServerSetup> setups = new ArrayList<>();\n if (smtpProtocol) {\n smtpServerSetup = createTestServerSetup(ServerSetup.SMTP);\n setups.add(smtpServerSetup);\n }\n if (smtpsProtocol) {\n smtpsServerSetup = createTestServerSetup(ServerSetup.SMTPS);\n setups.add(smtpsServerSetup);\n }\n if (pop3Protocol) {\n setups.add(createTestServerSetup(ServerSetup.POP3));\n }\n if (pop3sProtocol) {\n setups.add(createTestServerSetup(ServerSetup.POP3S));\n }\n if (imapProtocol) {\n setups.add(createTestServerSetup(ServerSetup.IMAP));\n }\n if (imapsProtocol) {\n setups.add(createTestServerSetup(ServerSetup.IMAPS));\n }\n return setups.toArray(new ServerSetup[setups.size()]);\n }", "public void setOccurrences(String occurrences) {\r\n\r\n int o = CmsSerialDateUtil.toIntWithDefault(occurrences, -1);\r\n if (m_model.getOccurrences() != o) {\r\n m_model.setOccurrences(o);\r\n valueChanged();\r\n }\r\n }" ]
Writes all error responses to the client. TODO REST-Server 1. collect error stats @param messageEvent - for retrieving the channel details @param status - error code @param message - error message
[ "public static void writeErrorResponse(MessageEvent messageEvent,\n HttpResponseStatus status,\n String message) {\n\n // Create the Response object\n HttpResponse response = new DefaultHttpResponse(HTTP_1_1, status);\n response.setHeader(CONTENT_TYPE, \"text/plain; charset=UTF-8\");\n response.setContent(ChannelBuffers.copiedBuffer(\"Failure: \" + status.toString() + \". \"\n + message + \"\\r\\n\", CharsetUtil.UTF_8));\n response.setHeader(CONTENT_LENGTH, response.getContent().readableBytes());\n\n // Write the response to the Netty Channel\n messageEvent.getChannel().write(response);\n }" ]
[ "private int calculateRowHeaderMaxWidth(DJCrosstabColumn crosstabColumn) {\n\t\tint auxWidth = 0;\n\t\tboolean firstTime = true;\n\t\tList<DJCrosstabColumn> auxList = new ArrayList<DJCrosstabColumn>(djcross.getColumns());\n\t\tCollections.reverse(auxList);\n\t\tfor (DJCrosstabColumn col : auxList) {\n\t\t\tif (col.equals(crosstabColumn)){\n\t\t\t\tif (auxWidth == 0)\n\t\t\t\t\tauxWidth = col.getWidth();\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (firstTime){\n\t\t\t\tauxWidth += col.getWidth();\n\t\t\t\tfirstTime = false;\n\t\t\t}\n\t\t\tif (col.isShowTotals()) {\n\t\t\t\tauxWidth += col.getWidth();\n\t\t\t}\n\t\t}\n\t\treturn auxWidth;\n\t}", "private void deliverSyncCommand(byte command) {\n for (final SyncListener listener : getSyncListeners()) {\n try {\n switch (command) {\n\n case 0x01:\n listener.becomeMaster();\n\n case 0x10:\n listener.setSyncMode(true);\n break;\n\n case 0x20:\n listener.setSyncMode(false);\n break;\n\n }\n } catch (Throwable t) {\n logger.warn(\"Problem delivering sync command to listener\", t);\n }\n }\n }", "public void replaceItem(@NonNull final T oldObject, @NonNull final T newObject) {\n synchronized (mLock) {\n final int position = getPosition(oldObject);\n if (position == -1) {\n // not found, don't replace\n return;\n }\n\n mObjects.remove(position);\n mObjects.add(position, newObject);\n\n if (isItemTheSame(oldObject, newObject)) {\n if (isContentTheSame(oldObject, newObject)) {\n // visible content hasn't changed, don't notify\n return;\n }\n\n // item with same stable id has changed\n notifyItemChanged(position, newObject);\n } else {\n // item replaced with another one with a different id\n notifyItemRemoved(position);\n notifyItemInserted(position);\n }\n }\n }", "public static long count(nitro_service service, String ciphergroupname) throws Exception{\n\t\tsslcipher_individualcipher_binding obj = new sslcipher_individualcipher_binding();\n\t\tobj.set_ciphergroupname(ciphergroupname);\n\t\toptions option = new options();\n\t\toption.set_count(true);\n\t\tsslcipher_individualcipher_binding response[] = (sslcipher_individualcipher_binding[]) obj.get_resources(service,option);\n\t\tif (response != null) {\n\t\t\treturn response[0].__count;\n\t\t}\n\t\treturn 0;\n\t}", "public List<BoxTask.Info> getTasks(String... fields) {\n QueryStringBuilder builder = new QueryStringBuilder();\n if (fields.length > 0) {\n builder.appendParam(\"fields\", fields).toString();\n }\n URL url = GET_TASKS_URL_TEMPLATE.buildWithQuery(this.getAPI().getBaseURL(), builder.toString(), this.getID());\n BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, \"GET\");\n BoxJSONResponse response = (BoxJSONResponse) request.send();\n JsonObject responseJSON = JsonObject.readFrom(response.getJSON());\n\n int totalCount = responseJSON.get(\"total_count\").asInt();\n List<BoxTask.Info> tasks = new ArrayList<BoxTask.Info>(totalCount);\n JsonArray entries = responseJSON.get(\"entries\").asArray();\n for (JsonValue value : entries) {\n JsonObject taskJSON = value.asObject();\n BoxTask task = new BoxTask(this.getAPI(), taskJSON.get(\"id\").asString());\n BoxTask.Info info = task.new Info(taskJSON);\n tasks.add(info);\n }\n\n return tasks;\n }", "public void removeLicenseFromArtifact(final String gavc, final String licenseId) {\n final DbArtifact dbArtifact = getArtifact(gavc);\n\n //\n // The artifact may not have the exact string associated with it, but rather one\n // matching license regexp expression.\n //\n repositoryHandler.removeLicenseFromArtifact(dbArtifact, licenseId, licenseMatcher);\n }", "private SortedSet<Date> calculateDates() {\n\n if (null == m_allDates) {\n SortedSet<Date> result = new TreeSet<>();\n if (isAnyDatePossible()) {\n Calendar date = getFirstDate();\n int previousOccurrences = 0;\n while (showMoreEntries(date, previousOccurrences)) {\n result.add(date.getTime());\n toNextDate(date);\n previousOccurrences++;\n }\n }\n m_allDates = result;\n }\n return m_allDates;\n }", "@Override\n @SuppressWarnings(\"unchecked\")\n public ChronoZonedDateTime<PaxDate> zonedDateTime(TemporalAccessor temporal) {\n return (ChronoZonedDateTime<PaxDate>) super.zonedDateTime(temporal);\n }", "protected InputStream getCompressorInputStream(InputStream inputStream,\n\t\t\tCompressionType compressionType) throws IOException {\n\t\tswitch (compressionType) {\n\t\tcase NONE:\n\t\t\treturn inputStream;\n\t\tcase GZIP:\n\t\t\treturn new GZIPInputStream(inputStream);\n\t\tcase BZ2:\n\t\t\treturn new BZip2CompressorInputStream(new BufferedInputStream(\n\t\t\t\t\tinputStream));\n\t\tdefault:\n\t\t\tthrow new IllegalArgumentException(\"Unsupported compression type: \"\n\t\t\t\t\t+ compressionType);\n\t\t}\n\t}" ]
Print a resource type. @param value ResourceType instance @return resource type value
[ "public static final String printResourceType(ResourceType value)\n {\n return (Integer.toString(value == null ? ResourceType.WORK.getValue() : value.getValue()));\n }" ]
[ "public void setTargetBytecode(String version) {\n if (CompilerConfiguration.PRE_JDK5.equals(version) || CompilerConfiguration.POST_JDK5.equals(version)) {\n this.targetBytecode = version;\n }\n }", "public static Boolean assertFalse(Boolean value, String message) {\n if (Boolean.valueOf(value))\n throw new IllegalArgumentException(message);\n return value;\n }", "public static <K, V, T> Map<K, List<Versioned<V>>> getAll(Store<K, V, T> storageEngine,\n Iterable<K> keys,\n Map<K, T> transforms) {\n Map<K, List<Versioned<V>>> result = newEmptyHashMap(keys);\n for(K key: keys) {\n List<Versioned<V>> value = storageEngine.get(key,\n transforms != null ? transforms.get(key)\n : null);\n if(!value.isEmpty())\n result.put(key, value);\n }\n return result;\n }", "public void setDataOffsets(int[] offsets)\n {\n assert(mLevels == offsets.length);\n NativeBitmapImage.updateCompressed(getNative(), mWidth, mHeight, mImageSize, mData, mLevels, offsets);\n mData = null;\n }", "@SuppressWarnings(\"rawtypes\") public static final Map getMap(Locale locale, String key)\n {\n ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale);\n return ((Map) bundle.getObject(key));\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}", "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 void populateConstraints(Row row, Task task)\n {\n Date endDateMax = row.getTimestamp(\"ZGIVENENDDATEMAX_\");\n Date endDateMin = row.getTimestamp(\"ZGIVENENDDATEMIN_\");\n Date startDateMax = row.getTimestamp(\"ZGIVENSTARTDATEMAX_\");\n Date startDateMin = row.getTimestamp(\"ZGIVENSTARTDATEMIN_\");\n\n ConstraintType constraintType = null;\n Date constraintDate = null;\n\n if (endDateMax != null)\n {\n constraintType = ConstraintType.FINISH_NO_LATER_THAN;\n constraintDate = endDateMax;\n }\n\n if (endDateMin != null)\n {\n constraintType = ConstraintType.FINISH_NO_EARLIER_THAN;\n constraintDate = endDateMin;\n }\n\n if (endDateMin != null && endDateMin == endDateMax)\n {\n constraintType = ConstraintType.MUST_FINISH_ON;\n constraintDate = endDateMin;\n }\n\n if (startDateMax != null)\n {\n constraintType = ConstraintType.START_NO_LATER_THAN;\n constraintDate = startDateMax;\n }\n\n if (startDateMin != null)\n {\n constraintType = ConstraintType.START_NO_EARLIER_THAN;\n constraintDate = startDateMin;\n }\n\n if (startDateMin != null && startDateMin == endDateMax)\n {\n constraintType = ConstraintType.MUST_START_ON;\n constraintDate = endDateMin;\n }\n\n task.setConstraintType(constraintType);\n task.setConstraintDate(constraintDate);\n }", "public static <R extends Resource<?>, U extends PaginatedResponse<R>> Flux<R> getResources(U response) {\n return Flux.fromIterable(response.getResources());\n }" ]
Append the text at the end of the Path. @param self a Path @param text the text to append at the end of the Path @throws java.io.IOException if an IOException occurs. @since 2.3.0
[ "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 }" ]
[ "@SuppressWarnings(\"unchecked\")\n\tpublic Map<String, ?> decodeSignedRequest(String signedRequest) throws SignedRequestException {\n\t\treturn decodeSignedRequest(signedRequest, Map.class);\n\t}", "public void checkConstraints(String checkLevel) throws ConstraintException\r\n {\r\n // now checking constraints\r\n FieldDescriptorConstraints fieldConstraints = new FieldDescriptorConstraints();\r\n ReferenceDescriptorConstraints refConstraints = new ReferenceDescriptorConstraints();\r\n CollectionDescriptorConstraints collConstraints = new CollectionDescriptorConstraints();\r\n\r\n for (Iterator it = getFields(); it.hasNext();)\r\n {\r\n fieldConstraints.check((FieldDescriptorDef)it.next(), checkLevel);\r\n }\r\n for (Iterator it = getReferences(); it.hasNext();)\r\n {\r\n refConstraints.check((ReferenceDescriptorDef)it.next(), checkLevel);\r\n }\r\n for (Iterator it = getCollections(); it.hasNext();)\r\n {\r\n collConstraints.check((CollectionDescriptorDef)it.next(), checkLevel);\r\n }\r\n new ClassDescriptorConstraints().check(this, checkLevel);\r\n }", "protected String getUniqueString(FieldDescriptor field) throws SequenceManagerException\r\n {\r\n ResultSetAndStatement rsStmt = null;\r\n String returnValue = null;\r\n try\r\n {\r\n rsStmt = getBrokerForClass().serviceJdbcAccess().executeSQL(\r\n \"select newid()\", field.getClassDescriptor(), Query.NOT_SCROLLABLE);\r\n if (rsStmt.m_rs.next())\r\n {\r\n returnValue = rsStmt.m_rs.getString(1);\r\n }\r\n else\r\n {\r\n LoggerFactory.getDefaultLogger().error(this.getClass()\r\n + \": Can't lookup new oid for field \" + field);\r\n }\r\n }\r\n catch (PersistenceBrokerException e)\r\n {\r\n throw new SequenceManagerException(e);\r\n }\r\n catch (SQLException e)\r\n {\r\n throw new SequenceManagerException(e);\r\n }\r\n\r\n finally\r\n {\r\n // close the used resources\r\n if (rsStmt != null) rsStmt.close();\r\n }\r\n return returnValue;\r\n }", "@Override\n protected void onGraphDraw(Canvas _Canvas) {\n super.onGraphDraw(_Canvas);\n _Canvas.translate(-mCurrentViewport.left, -mCurrentViewport.top);\n drawBars(_Canvas);\n }", "public static void writeInt(byte[] bytes, int value, int offset) {\n bytes[offset] = (byte) (0xFF & (value >> 24));\n bytes[offset + 1] = (byte) (0xFF & (value >> 16));\n bytes[offset + 2] = (byte) (0xFF & (value >> 8));\n bytes[offset + 3] = (byte) (0xFF & value);\n }", "public void postConstruct() throws URISyntaxException {\n WmsVersion.lookup(this.version);\n Assert.isTrue(validateBaseUrl(), \"invalid baseURL\");\n\n Assert.isTrue(this.layers.length > 0, \"There must be at least one layer defined for a WMS request\" +\n \" to make sense\");\n\n // OpenLayers 2 compatibility. It will post a single empty style no matter how many layers there are\n\n if (this.styles != null && this.styles.length != this.layers.length && this.styles.length == 1 &&\n this.styles[0].trim().isEmpty()) {\n this.styles = null;\n } else {\n Assert.isTrue(this.styles == null || this.layers.length == this.styles.length,\n String.format(\n \"If styles are defined then there must be one for each layer. Number of\" +\n \" layers: %s\\nStyles: %s\", this.layers.length,\n Arrays.toString(this.styles)));\n }\n\n if (this.imageFormat.indexOf('/') < 0) {\n LOGGER.warn(\"The format {} should be a mime type\", this.imageFormat);\n this.imageFormat = \"image/\" + this.imageFormat;\n }\n\n Assert.isTrue(this.method == HttpMethod.GET || this.method == HttpMethod.POST,\n String.format(\"Unsupported method %s for WMS layer\", this.method.toString()));\n }", "public static Map<String, IDiagramPlugin>\n getLocalPluginsRegistry(ServletContext context) {\n if (LOCAL == null) {\n LOCAL = initializeLocalPlugins(context);\n }\n return LOCAL;\n }", "public static Object newInstance(Class target, Class[] types, Object[] args) throws InstantiationException,\r\n IllegalAccessException,\r\n IllegalArgumentException,\r\n InvocationTargetException,\r\n NoSuchMethodException,\r\n SecurityException\r\n {\r\n return newInstance(target, types, args, false);\r\n }", "private void writeDayTypes(Calendars calendars)\n {\n DayTypes dayTypes = m_factory.createDayTypes();\n calendars.setDayTypes(dayTypes);\n List<DayType> typeList = dayTypes.getDayType();\n\n DayType dayType = m_factory.createDayType();\n typeList.add(dayType);\n dayType.setId(\"0\");\n dayType.setName(\"Working\");\n dayType.setDescription(\"A default working day\");\n\n dayType = m_factory.createDayType();\n typeList.add(dayType);\n dayType.setId(\"1\");\n dayType.setName(\"Nonworking\");\n dayType.setDescription(\"A default non working day\");\n\n dayType = m_factory.createDayType();\n typeList.add(dayType);\n dayType.setId(\"2\");\n dayType.setName(\"Use base\");\n dayType.setDescription(\"Use day from base calendar\");\n }" ]