idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
366,584 | private String findFamilyName(@Nullable PsiElement expression, @Nullable DartType type) {<NEW_LINE>if (expression == null && type != null) {<NEW_LINE>LOG.info("Check superclass constructor for font family: " + type.getName());<NEW_LINE>// TODO Check superclass of <type> for a constructor that includes the family.<NEW_LINE>return null;<NEW_LINE>} else if (expression instanceof DartStringLiteralExpression) {<NEW_LINE>// noinspection ConstantConditions<NEW_LINE>final Pair<String, TextRange> pair = DartPsiImplUtil.getUnquotedDartStringAndItsRange(expression.getText().trim());<NEW_LINE>return pair.first;<NEW_LINE>} else {<NEW_LINE>if (expression != null) {<NEW_LINE>assert expression.getNode() != null;<NEW_LINE>if (expression.getNode().getElementType() == DartTokenTypes.REFERENCE_EXPRESSION) {<NEW_LINE><MASK><NEW_LINE>final Pair<String, TextRange> pair = DartPsiImplUtil.getUnquotedDartStringAndItsRange(expression.getText().trim());<NEW_LINE>final String varName = pair.first;<NEW_LINE>return staticVars.get(varName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | assert expression.getText() != null; |
1,685,564 | protected void drawFigure(Graphics graphics) {<NEW_LINE>graphics.pushState();<NEW_LINE>Rectangle bounds = getBounds().getCopy();<NEW_LINE>bounds.width--;<NEW_LINE>bounds.height--;<NEW_LINE>// Set line width here so that the whole figure is constrained, otherwise SVG graphics will have overspill<NEW_LINE>int lineWidth = 1;<NEW_LINE>setLineWidth(graphics, lineWidth, bounds);<NEW_LINE>int offset = 11;<NEW_LINE>int curve_y = bounds.y + bounds.height - offset;<NEW_LINE>graphics.setAlpha(getAlpha());<NEW_LINE>if (!isEnabled()) {<NEW_LINE>setDisabledState(graphics);<NEW_LINE>}<NEW_LINE>// Main Fill<NEW_LINE><MASK><NEW_LINE>path.moveTo(bounds.x, bounds.y);<NEW_LINE>path.lineTo(bounds.x, curve_y - 1);<NEW_LINE>path.quadTo(bounds.x + (bounds.width / 4), bounds.y + bounds.height + offset, bounds.x + bounds.width / 2 + 1, curve_y);<NEW_LINE>path.quadTo(bounds.x + bounds.width - (bounds.width / 4), curve_y - offset - 1, bounds.x + bounds.width, curve_y);<NEW_LINE>path.lineTo(bounds.x + bounds.width, bounds.y);<NEW_LINE>graphics.setBackgroundColor(getFillColor());<NEW_LINE>Pattern gradient = applyGradientPattern(graphics, bounds);<NEW_LINE>graphics.fillPath(path);<NEW_LINE>disposeGradientPattern(graphics, gradient);<NEW_LINE>// Outline<NEW_LINE>graphics.setAlpha(getLineAlpha());<NEW_LINE>graphics.setForegroundColor(getLineColor());<NEW_LINE>float lineOffset = (float) lineWidth / 2;<NEW_LINE>path.lineTo(bounds.x - lineOffset, bounds.y);<NEW_LINE>graphics.drawPath(path);<NEW_LINE>path.dispose();<NEW_LINE>// Icon<NEW_LINE>// drawIconImage(graphics, bounds);<NEW_LINE>drawIconImage(graphics, bounds, 0, 0, -14, 0);<NEW_LINE>graphics.popState();<NEW_LINE>} | Path path = new Path(null); |
1,784,845 | private Changes analyse(@NonNull final Context ctx, @NonNull final RootProcessor p, Predicate<ClassFile> accept) throws IOException, IllegalArgumentException {<NEW_LINE>// NOI18N<NEW_LINE>Parameters.notNull("ctx", ctx);<NEW_LINE>if (p.execute(accept)) {<NEW_LINE>if (!p.hasChanges() && timeStampsEmpty()) {<NEW_LINE>assert refs.isEmpty();<NEW_LINE>assert toDelete.isEmpty();<NEW_LINE>return Changes.UP_TO_DATE;<NEW_LINE>}<NEW_LINE>final List<Pair<ElementHandle<TypeElement>, Long><MASK><NEW_LINE>final List<Pair<ElementHandle<TypeElement>, Long>> oldState = loadCRCs(cacheRoot);<NEW_LINE>final boolean preBuildArgs = p.preBuildArgs();<NEW_LINE>store();<NEW_LINE>storeCRCs(cacheRoot, newState);<NEW_LINE>storeTimeStamps();<NEW_LINE>return diff(oldState, newState, preBuildArgs);<NEW_LINE>} else {<NEW_LINE>writer.rollback();<NEW_LINE>return Changes.FAILURE;<NEW_LINE>}<NEW_LINE>} | > newState = p.result(); |
1,563,290 | private String calcActionQualifiedPath(String id) {<NEW_LINE>for (Object child : myChildren) {<NEW_LINE>if (child instanceof QuickList) {<NEW_LINE>child = ((QuickList) child).getActionId();<NEW_LINE>}<NEW_LINE>if (child instanceof String) {<NEW_LINE>if (id.equals(child)) {<NEW_LINE>AnAction action = ActionManager.getInstance().getActionOrStub(id);<NEW_LINE>String path;<NEW_LINE>if (action != null) {<NEW_LINE>path = action.getTemplatePresentation().getText();<NEW_LINE>} else {<NEW_LINE>path = id;<NEW_LINE>}<NEW_LINE>return !isRoot() ? getName<MASK><NEW_LINE>}<NEW_LINE>} else if (child instanceof Group) {<NEW_LINE>String path = ((Group) child).calcActionQualifiedPath(id);<NEW_LINE>if (path != null) {<NEW_LINE>return !isRoot() ? getName() + " | " + path : path;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | () + " | " + path : path; |
634,498 | public static boolean isSymbolicLink(File file) throws IOException {<NEW_LINE>// first try using Java 7<NEW_LINE>try {<NEW_LINE>// use reflection here<NEW_LINE>Class<?> filesClass = Class.forName("java.nio.file.Files");<NEW_LINE>Class<?> pathClass = Class.forName("java.nio.file.Path");<NEW_LINE>Object path = File.class.getMethod("toPath").invoke(file);<NEW_LINE>return ((Boolean) filesClass.getMethod("isSymbolicLink", pathClass).invoke(null, path)).booleanValue();<NEW_LINE>} catch (InvocationTargetException exception) {<NEW_LINE><MASK><NEW_LINE>Throwables.propagateIfPossible(cause, IOException.class);<NEW_LINE>// shouldn't reach this point, but just in case...<NEW_LINE>throw new RuntimeException(cause);<NEW_LINE>} catch (ClassNotFoundException exception) {<NEW_LINE>// handled below<NEW_LINE>} catch (IllegalArgumentException exception) {<NEW_LINE>// handled below<NEW_LINE>} catch (SecurityException exception) {<NEW_LINE>// handled below<NEW_LINE>} catch (IllegalAccessException exception) {<NEW_LINE>// handled below<NEW_LINE>} catch (NoSuchMethodException exception) {<NEW_LINE>// handled below<NEW_LINE>}<NEW_LINE>// backup option compatible with earlier Java<NEW_LINE>// this won't work on Windows, which is where separator char is '\\'<NEW_LINE>if (File.separatorChar == '\\') {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>File canonical = file;<NEW_LINE>if (file.getParent() != null) {<NEW_LINE>canonical = new File(file.getParentFile().getCanonicalFile(), file.getName());<NEW_LINE>}<NEW_LINE>return !canonical.getCanonicalFile().equals(canonical.getAbsoluteFile());<NEW_LINE>} | Throwable cause = exception.getCause(); |
380,125 | private E readSchemeFromFile(@Nonnull final File file, boolean forceAdd, boolean duringLoad) {<NEW_LINE>if (!canRead(file)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Element element;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>} catch (JDOMException e) {<NEW_LINE>try {<NEW_LINE>FileUtil.copy(file, new File(myIoDir, file.getName() + ".copy"));<NEW_LINE>} catch (IOException e1) {<NEW_LINE>LOG.error(e1);<NEW_LINE>}<NEW_LINE>LOG.error("Error reading file " + file.getPath() + ": " + e.getMessage());<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>E scheme = readScheme(element, duringLoad);<NEW_LINE>if (scheme != null) {<NEW_LINE>loadScheme(scheme, forceAdd, file.getName());<NEW_LINE>}<NEW_LINE>return scheme;<NEW_LINE>} catch (final Exception e) {<NEW_LINE>ApplicationManager.getApplication().invokeLater(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>String msg = "Cannot read scheme " + file.getName() + " from '" + myFileSpec + "': " + e.getMessage();<NEW_LINE>LOG.info(msg, e);<NEW_LINE>Messages.showErrorDialog(msg, "Load Settings");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | element = JDOMUtil.load(file); |
321,678 | public OAuth2Authentication consumeAuthorizationCode(String code) throws InvalidGrantException {<NEW_LINE>performExpirationClean();<NEW_LINE>JdbcTemplate template = new JdbcTemplate(dataSource);<NEW_LINE>try {<NEW_LINE>TokenCode tokenCode = (TokenCode) template.queryForObject(SQL_SELECT_STATEMENT, rowMapper, code);<NEW_LINE>if (tokenCode != null) {<NEW_LINE>try {<NEW_LINE>if (tokenCode.isExpired()) {<NEW_LINE>logger.debug("[oauth_code] Found code, but it expired:" + tokenCode);<NEW_LINE>throw new InvalidGrantException("Authorization code expired: " + code);<NEW_LINE>} else if (tokenCode.getExpiresAt() == 0) {<NEW_LINE>return SerializationUtils.deserialize(tokenCode.getAuthentication());<NEW_LINE>} else {<NEW_LINE>return deserializeOauth2Authentication(tokenCode.getAuthentication());<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (EmptyResultDataAccessException ignored) {<NEW_LINE>}<NEW_LINE>throw new InvalidGrantException("Invalid authorization code: " + code);<NEW_LINE>} | template.update(SQL_DELETE_STATEMENT, code); |
25,855 | public Tuple<List<AggregationBuilder>, List<PipelineAggregationBuilder>> aggs(EvaluationParameters parameters, EvaluationFields evaluationFields) {<NEW_LINE>if (result.get() != null) {<NEW_LINE>return Tuple.tuple(List.of(), List.of());<NEW_LINE>}<NEW_LINE>// Store given {@code fields} for the purpose of generating error messages in {@code process}.<NEW_LINE>this.fields.trySet(evaluationFields);<NEW_LINE>double[] percentiles = IntStream.range(1, 100).mapToDouble(v -> (double) v).toArray();<NEW_LINE>AggregationBuilder percentilesAgg = AggregationBuilders.percentiles(PERCENTILES_AGG_NAME).field(evaluationFields.getPredictedProbabilityField<MASK><NEW_LINE>AggregationBuilder nestedAgg = AggregationBuilders.nested(NESTED_AGG_NAME, evaluationFields.getTopClassesField()).subAggregation(AggregationBuilders.filter(NESTED_FILTER_AGG_NAME, QueryBuilders.termQuery(evaluationFields.getPredictedClassField(), className)).subAggregation(percentilesAgg));<NEW_LINE>QueryBuilder actualIsTrueQuery = QueryBuilders.termQuery(evaluationFields.getActualField(), className);<NEW_LINE>AggregationBuilder percentilesForClassValueAgg = AggregationBuilders.filter(TRUE_AGG_NAME, actualIsTrueQuery).subAggregation(nestedAgg);<NEW_LINE>AggregationBuilder percentilesForRestAgg = AggregationBuilders.filter(NON_TRUE_AGG_NAME, QueryBuilders.boolQuery().mustNot(actualIsTrueQuery)).subAggregation(nestedAgg);<NEW_LINE>return Tuple.tuple(List.of(percentilesForClassValueAgg, percentilesForRestAgg), List.of());<NEW_LINE>} | ()).percentiles(percentiles); |
95,522 | private void initWindow() {<NEW_LINE>logger.info("Initializing display (if last line in log then likely the game crashed from an issue with your " + "video card)");<NEW_LINE>// set opengl core profile to 3.3<NEW_LINE>GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MAJOR, 3);<NEW_LINE>GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MINOR, 3);<NEW_LINE>GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_CORE_PROFILE);<NEW_LINE>long window = GLFW.glfwCreateWindow(config.getWindowWidth(), config.getWindowHeight(), "Terasology Alpha", 0, 0);<NEW_LINE>if (window == 0) {<NEW_LINE>throw new RuntimeException("Failed to create window");<NEW_LINE>}<NEW_LINE>GLFW.glfwMakeContextCurrent(window);<NEW_LINE>if (!config.isVSync()) {<NEW_LINE>GLFW.glfwSwapInterval(0);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>String root = "org/terasology/engine/icons/";<NEW_LINE>ClassLoader classLoader = getClass().getClassLoader();<NEW_LINE>BufferedImage icon16 = ImageIO.read(classLoader<MASK><NEW_LINE>BufferedImage icon32 = ImageIO.read(classLoader.getResourceAsStream(root + "gooey_sweet_32.png"));<NEW_LINE>BufferedImage icon64 = ImageIO.read(classLoader.getResourceAsStream(root + "gooey_sweet_64.png"));<NEW_LINE>BufferedImage icon128 = ImageIO.read(classLoader.getResourceAsStream(root + "gooey_sweet_128.png"));<NEW_LINE>GLFWImage.Buffer buffer = GLFWImage.create(4);<NEW_LINE>buffer.put(0, LwjglGraphicsUtil.convertToGLFWFormat(icon16));<NEW_LINE>buffer.put(1, LwjglGraphicsUtil.convertToGLFWFormat(icon32));<NEW_LINE>buffer.put(2, LwjglGraphicsUtil.convertToGLFWFormat(icon64));<NEW_LINE>buffer.put(3, LwjglGraphicsUtil.convertToGLFWFormat(icon128));<NEW_LINE>GLFW.glfwSetWindowIcon(window, buffer);<NEW_LINE>} catch (IOException | IllegalArgumentException e) {<NEW_LINE>logger.warn("Could not set icon", e);<NEW_LINE>}<NEW_LINE>lwjglDisplay.setDisplayModeSetting(config.getDisplayModeSetting(), false);<NEW_LINE>GLFW.glfwShowWindow(window);<NEW_LINE>} | .getResourceAsStream(root + "gooey_sweet_16.png")); |
1,829,643 | public void doRender(HumanoidModel<?> bipedModel, ItemStack stack, LivingEntity living, PoseStack ms, MultiBufferSource buffers, int light, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {<NEW_LINE>boolean armor = !living.getItemBySlot(EquipmentSlot.CHEST).isEmpty();<NEW_LINE>bipedModel.body.translateAndRotate(ms);<NEW_LINE>ms.translate(-0.25, 0.5, armor ? 0.05 : 0.12);<NEW_LINE>ms.scale(0.5F, -0.5F, -0.5F);<NEW_LINE>BakedModel model = MiscellaneousModels.INSTANCE.pyroclastGem;<NEW_LINE>VertexConsumer buffer = buffers.<MASK><NEW_LINE>Minecraft.getInstance().getBlockRenderer().getModelRenderer().renderModel(ms.last(), buffer, null, model, 1, 1, 1, light, OverlayTexture.NO_OVERLAY);<NEW_LINE>} | getBuffer(Sheets.cutoutBlockSheet()); |
570,045 | public WsByteBuffer buildFrameForWrite() {<NEW_LINE>WsByteBuffer buffer = super.buildFrameForWrite();<NEW_LINE>byte[] frame;<NEW_LINE>if (buffer.hasArray()) {<NEW_LINE>frame = buffer.array();<NEW_LINE>} else {<NEW_LINE>frame = super.createFrameArray();<NEW_LINE>}<NEW_LINE>// add the first 9 bytes of the array<NEW_LINE>setFrameHeaders(frame, utils.FRAME_TYPE_HEADERS);<NEW_LINE>// set up the frame payload<NEW_LINE>int frameIndex = SIZE_FRAME_BEFORE_PAYLOAD;<NEW_LINE>if (PADDED_FLAG) {<NEW_LINE>utils.Move8BitstoByteArray(paddingLength, frame, frameIndex);<NEW_LINE>frameIndex += 1;<NEW_LINE>}<NEW_LINE>if (PRIORITY_FLAG) {<NEW_LINE>utils.<MASK><NEW_LINE>if (exclusive) {<NEW_LINE>frame[frameIndex] = (byte) (frame[frameIndex] | 0x80);<NEW_LINE>}<NEW_LINE>frameIndex += 4;<NEW_LINE>utils.Move8BitstoByteArray(weight, frame, frameIndex);<NEW_LINE>frameIndex += 1;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < headerBlockFragment.length; i++) {<NEW_LINE>frame[frameIndex] = headerBlockFragment[i];<NEW_LINE>frameIndex++;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < paddingLength; i++) {<NEW_LINE>frame[frameIndex] = 0x00;<NEW_LINE>frameIndex++;<NEW_LINE>}<NEW_LINE>buffer.put(frame, 0, writeFrameLength);<NEW_LINE>buffer.flip();<NEW_LINE>return buffer;<NEW_LINE>} | Move31BitstoByteArray(streamDependency, frame, frameIndex); |
725,539 | public void checkElementToPathToElementEquivalence() {<NEW_LINE>_rootPackage.getPackage("spoon").getElements(e -> true).parallelStream().forEach(element -> {<NEW_LINE>CtPath path = element.getPath();<NEW_LINE>String pathStr = path.toString();<NEW_LINE>try {<NEW_LINE>CtPath pathRead = new CtPathStringBuilder().fromString(pathStr);<NEW_LINE>assertEquals(pathStr, pathRead.toString());<NEW_LINE>Collection<CtElement> returnedElements = pathRead.evaluateOn(_rootPackage);<NEW_LINE>// contract: CtUniqueRolePathElement.evaluateOn() returns a unique elements if provided only a list of one inputs<NEW_LINE>assertEquals(<MASK><NEW_LINE>CtElement actualElement = (CtElement) returnedElements.toArray()[0];<NEW_LINE>// contract: Element -> Path -> String -> Path -> Element leads to the original element<NEW_LINE>assertSame(element, actualElement);<NEW_LINE>} catch (CtPathException e) {<NEW_LINE>throw new AssertionError("Path " + pathStr + " is either incorrectly generated or incorrectly read", e);<NEW_LINE>} catch (AssertionError e) {<NEW_LINE>throw new AssertionError("Path " + pathStr + " detection failed on " + element.getClass().getSimpleName() + ": " + element, e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | 1, returnedElements.size()); |
629,139 | void rfftf(final double[] a, final int offa) {<NEW_LINE>if (n == 1)<NEW_LINE>return;<NEW_LINE>int l1, l2, na, kh, nf, ip, iw, ido, idl1;<NEW_LINE>final int twon = 2 * n;<NEW_LINE>nf = (int) wtable_r[1 + twon];<NEW_LINE>na = 1;<NEW_LINE>l2 = n;<NEW_LINE>iw = twon - 1;<NEW_LINE>for (int k1 = 1; k1 <= nf; ++k1) {<NEW_LINE>kh = nf - k1;<NEW_LINE>ip = (int) wtable_r[kh + 2 + twon];<NEW_LINE>l1 = l2 / ip;<NEW_LINE>ido = n / l2;<NEW_LINE>idl1 = ido * l1;<NEW_LINE>iw <MASK><NEW_LINE>na = 1 - na;<NEW_LINE>switch(ip) {<NEW_LINE>case 2:<NEW_LINE>if (na == 0) {<NEW_LINE>radf2(ido, l1, a, offa, ch, 0, iw);<NEW_LINE>} else {<NEW_LINE>radf2(ido, l1, ch, 0, a, offa, iw);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>if (na == 0) {<NEW_LINE>radf3(ido, l1, a, offa, ch, 0, iw);<NEW_LINE>} else {<NEW_LINE>radf3(ido, l1, ch, 0, a, offa, iw);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE>if (na == 0) {<NEW_LINE>radf4(ido, l1, a, offa, ch, 0, iw);<NEW_LINE>} else {<NEW_LINE>radf4(ido, l1, ch, 0, a, offa, iw);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 5:<NEW_LINE>if (na == 0) {<NEW_LINE>radf5(ido, l1, a, offa, ch, 0, iw);<NEW_LINE>} else {<NEW_LINE>radf5(ido, l1, ch, 0, a, offa, iw);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>if (ido == 1)<NEW_LINE>na = 1 - na;<NEW_LINE>if (na == 0) {<NEW_LINE>radfg(ido, ip, l1, idl1, a, offa, ch, 0, iw);<NEW_LINE>na = 1;<NEW_LINE>} else {<NEW_LINE>radfg(ido, ip, l1, idl1, ch, 0, a, offa, iw);<NEW_LINE>na = 0;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>l2 = l1;<NEW_LINE>}<NEW_LINE>if (na == 1)<NEW_LINE>return;<NEW_LINE>System.arraycopy(ch, 0, a, offa, n);<NEW_LINE>} | -= (ip - 1) * ido; |
792,888 | public void doXContent(XContentBuilder builder, Params params) throws IOException {<NEW_LINE>builder.startObject(NAME);<NEW_LINE>builder.field(QUERY_FIELD.getPreferredName(), value);<NEW_LINE>builder.<MASK><NEW_LINE>for (Map.Entry<String, Float> fieldEntry : this.fieldsAndBoosts.entrySet()) {<NEW_LINE>builder.value(fieldEntry.getKey() + "^" + fieldEntry.getValue());<NEW_LINE>}<NEW_LINE>builder.endArray();<NEW_LINE>builder.field(OPERATOR_FIELD.getPreferredName(), operator.toString());<NEW_LINE>if (minimumShouldMatch != null) {<NEW_LINE>builder.field(MINIMUM_SHOULD_MATCH_FIELD.getPreferredName(), minimumShouldMatch);<NEW_LINE>}<NEW_LINE>builder.field(ZERO_TERMS_QUERY_FIELD.getPreferredName(), zeroTermsQuery.toString());<NEW_LINE>builder.field(GENERATE_SYNONYMS_PHRASE_QUERY.getPreferredName(), autoGenerateSynonymsPhraseQuery);<NEW_LINE>printBoostAndQueryName(builder);<NEW_LINE>builder.endObject();<NEW_LINE>} | startArray(FIELDS_FIELD.getPreferredName()); |
1,638,996 | public List<NetworkAddressAlias> loadLastUpdate(long lastUpdateTime) {<NEW_LINE>List<NetworkAddressAlias> networkAddressAliases = new ArrayList<>();<NEW_LINE>try {<NEW_LINE>StringBuilder sql = new StringBuilder("select * from ");<NEW_LINE>sql.append(NetworkAddressAlias.INDEX_NAME);<NEW_LINE>sql.append(" where ").append(NetworkAddressAlias.LAST_UPDATE_TIME_BUCKET).append(">?");<NEW_LINE>try (Connection connection = h2Client.getConnection()) {<NEW_LINE>try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), lastUpdateTime)) {<NEW_LINE>NetworkAddressAlias networkAddressAlias;<NEW_LINE>do {<NEW_LINE>networkAddressAlias = (NetworkAddressAlias) toStorageData(resultSet, NetworkAddressAlias.INDEX_NAME<MASK><NEW_LINE>if (networkAddressAlias != null) {<NEW_LINE>networkAddressAliases.add(networkAddressAlias);<NEW_LINE>}<NEW_LINE>} while (networkAddressAlias != null);<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>throw new IOException(e);<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>LOGGER.error(t.getMessage(), t);<NEW_LINE>}<NEW_LINE>return networkAddressAliases;<NEW_LINE>} | , new NetworkAddressAlias.Builder()); |
1,745,751 | private Map<String, Float> sortAcceptableEncodings(Map<String, Float> encodings) {<NEW_LINE>// List of map elements<NEW_LINE>List<Map.Entry<String, Float>> list = new LinkedList<Map.Entry<String, Float>>(encodings.entrySet());<NEW_LINE>Collections.sort(list, new Comparator<Map.Entry<String, Float>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int compare(Map.Entry<String, Float> e1, Map.Entry<String, Float> e2) {<NEW_LINE>return -(Float.compare(e1.getValue(), e2.getValue()));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// put sorted list to a linkedHashMap<NEW_LINE>Map<String, Float> result = new <MASK><NEW_LINE>for (Map.Entry<String, Float> entry : list) {<NEW_LINE>result.put(entry.getKey(), entry.getValue());<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | LinkedHashMap<String, Float>(); |
1,221,039 | void kmeans(FArray x, FArray c, int n, int d) {<NEW_LINE>int[<MASK><NEW_LINE>IntVector perm = new IntVector(values);<NEW_LINE>for (int i = 0; i < n; i++) {<NEW_LINE>perm.safeSet(i, i);<NEW_LINE>}<NEW_LINE>perm.shuffle(rng);<NEW_LINE>for (int i = 0; i < ksub_; i++) {<NEW_LINE>// x -> src<NEW_LINE>// x -> src<NEW_LINE>x.// src pos<NEW_LINE>arrayCopy(// destination<NEW_LINE>perm.get(i) * d, // destination pos<NEW_LINE>c, // amount of data<NEW_LINE>i * d, d);<NEW_LINE>}<NEW_LINE>BArray codes = new BArray(new byte[n]);<NEW_LINE>for (int i = 0; i < niter_; i++) {<NEW_LINE>Estep(x, c, codes, d, n);<NEW_LINE>MStep(x, c, codes, d, n);<NEW_LINE>}<NEW_LINE>} | ] values = new int[n]; |
1,201,495 | public static AddSipAgentGroupResponse unmarshall(AddSipAgentGroupResponse addSipAgentGroupResponse, UnmarshallerContext context) {<NEW_LINE>addSipAgentGroupResponse.setRequestId(context.stringValue("AddSipAgentGroupResponse.RequestId"));<NEW_LINE>addSipAgentGroupResponse.setSuccess(context.booleanValue("AddSipAgentGroupResponse.Success"));<NEW_LINE>addSipAgentGroupResponse.setCode(context.stringValue("AddSipAgentGroupResponse.Code"));<NEW_LINE>addSipAgentGroupResponse.setMessage<MASK><NEW_LINE>addSipAgentGroupResponse.setHttpStatusCode(context.integerValue("AddSipAgentGroupResponse.HttpStatusCode"));<NEW_LINE>addSipAgentGroupResponse.setProvider(context.stringValue("AddSipAgentGroupResponse.Provider"));<NEW_LINE>List<SipAgent> sipAgents = new ArrayList<SipAgent>();<NEW_LINE>for (int i = 0; i < context.lengthValue("AddSipAgentGroupResponse.SipAgents.Length"); i++) {<NEW_LINE>SipAgent sipAgent = new SipAgent();<NEW_LINE>sipAgent.setId(context.longValue("AddSipAgentGroupResponse.SipAgents[" + i + "].Id"));<NEW_LINE>sipAgent.setName(context.stringValue("AddSipAgentGroupResponse.SipAgents[" + i + "].Name"));<NEW_LINE>sipAgent.setIp(context.stringValue("AddSipAgentGroupResponse.SipAgents[" + i + "].Ip"));<NEW_LINE>sipAgent.setPort(context.stringValue("AddSipAgentGroupResponse.SipAgents[" + i + "].Port"));<NEW_LINE>sipAgent.setSendInterface(context.integerValue("AddSipAgentGroupResponse.SipAgents[" + i + "].SendInterface"));<NEW_LINE>sipAgent.setStatus(context.booleanValue("AddSipAgentGroupResponse.SipAgents[" + i + "].Status"));<NEW_LINE>sipAgents.add(sipAgent);<NEW_LINE>}<NEW_LINE>addSipAgentGroupResponse.setSipAgents(sipAgents);<NEW_LINE>return addSipAgentGroupResponse;<NEW_LINE>} | (context.stringValue("AddSipAgentGroupResponse.Message")); |
53,781 | public int compare(Object lhsObj, Object rhsObj) {<NEW_LINE>InstantConverter conv = ConverterManager.getInstance().getInstantConverter(lhsObj);<NEW_LINE>Chronology lhsChrono = conv.getChronology(lhsObj, (Chronology) null);<NEW_LINE>long lhsMillis = conv.getInstantMillis(lhsObj, lhsChrono);<NEW_LINE>// handle null==null and other cases where objects are the same<NEW_LINE>// but only do this after checking the input is valid<NEW_LINE>if (lhsObj == rhsObj) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>conv = ConverterManager.getInstance().getInstantConverter(rhsObj);<NEW_LINE>Chronology rhsChrono = conv.getChronology(rhsObj, (Chronology) null);<NEW_LINE>long rhsMillis = <MASK><NEW_LINE>if (iLowerLimit != null) {<NEW_LINE>lhsMillis = iLowerLimit.getField(lhsChrono).roundFloor(lhsMillis);<NEW_LINE>rhsMillis = iLowerLimit.getField(rhsChrono).roundFloor(rhsMillis);<NEW_LINE>}<NEW_LINE>if (iUpperLimit != null) {<NEW_LINE>lhsMillis = iUpperLimit.getField(lhsChrono).remainder(lhsMillis);<NEW_LINE>rhsMillis = iUpperLimit.getField(rhsChrono).remainder(rhsMillis);<NEW_LINE>}<NEW_LINE>if (lhsMillis < rhsMillis) {<NEW_LINE>return -1;<NEW_LINE>} else if (lhsMillis > rhsMillis) {<NEW_LINE>return 1;<NEW_LINE>} else {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>} | conv.getInstantMillis(rhsObj, rhsChrono); |
219,211 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<NEW_LINE>// Setting IpAddress To Log and taking header for original IP if forwarded from proxy<NEW_LINE>ShepherdLogManager.setRequestIp(request.getRemoteAddr(), request.getHeader("X-Forwarded-For"));<NEW_LINE>log.debug(levelName + " Servlet Accessed");<NEW_LINE>// Translation Stuff<NEW_LINE>Locale locale = new Locale(Validate.validateLanguage(request.getSession()));<NEW_LINE>ResourceBundle errors = ResourceBundle.getBundle("i18n.servlets.errors", locale);<NEW_LINE>ResourceBundle csrfGenerics = ResourceBundle.getBundle("i18n.servlets.challenges.csrf.csrfGenerics", locale);<NEW_LINE>PrintWriter out = response.getWriter();<NEW_LINE>out.print(getServletInfo());<NEW_LINE>try {<NEW_LINE>HttpSession ses = request.getSession(true);<NEW_LINE>if (Validate.validateSession(ses)) {<NEW_LINE>ShepherdLogManager.setRequestIp(request.getRemoteAddr(), request.getHeader("X-Forwarded-For"), ses.getAttribute("userName").toString());<NEW_LINE>log.debug(levelName + " servlet accessed by: " + ses.getAttribute("userName").toString());<NEW_LINE>Cookie tokenCookie = Validate.getToken(request.getCookies());<NEW_LINE>Object tokenParmeter = request.getParameter("csrfToken");<NEW_LINE>if (Validate.validateTokens(tokenCookie, tokenParmeter)) {<NEW_LINE>String myMessage = request.getParameter("myMessage");<NEW_LINE>log.debug("User Submitted - " + myMessage);<NEW_LINE>myMessage = Validate.makeValidUrl(myMessage);<NEW_LINE>log.debug("Updating User's Stored Message");<NEW_LINE>String ApplicationRoot = getServletContext().getRealPath("");<NEW_LINE>String moduleId = Getter.getModuleIdFromHash(ApplicationRoot, levelHash);<NEW_LINE>String userId = (String) ses.getAttribute("userStamp");<NEW_LINE>Setter.setStoredMessage(<MASK><NEW_LINE>log.debug("Retrieving user's class's forum");<NEW_LINE>String classId = null;<NEW_LINE>if (ses.getAttribute("userClass") != null) {<NEW_LINE>classId = (String) ses.getAttribute("userClass");<NEW_LINE>}<NEW_LINE>String htmlOutput = Getter.getCsrfForumWithImg(ApplicationRoot, classId, moduleId, csrfGenerics);<NEW_LINE>log.debug("Outputting HTML");<NEW_LINE>out.write(htmlOutput);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>out.write(errors.getString("error.funky"));<NEW_LINE>log.fatal(levelName + " - " + e.toString());<NEW_LINE>}<NEW_LINE>} | ApplicationRoot, myMessage, userId, moduleId); |
1,216,364 | public void regenerated(final IZyNodeRealizer realizer) {<NEW_LINE>// When the realizer of a node was regenerated, all the information<NEW_LINE>// from the debugger disappeared from the node. That means we have<NEW_LINE>// to re-add them at this point.<NEW_LINE>final IDebugger activeDebugger = m_debugPerspective.getCurrentSelectedDebugger();<NEW_LINE>final TargetProcessThread currentThread = activeDebugger == null ? null : activeDebugger.getProcessManager().getActiveThread();<NEW_LINE>if (currentThread != null) {<NEW_LINE>final UnrelocatedAddress fileAddress = m_debugPerspective.getCurrentSelectedDebugger().<MASK><NEW_LINE>CDebuggerPainter.updateSingleNodeDebuggerHighlighting(m_graph, fileAddress, (NaviNode) realizer.getUserData().getNode());<NEW_LINE>}<NEW_LINE>final INaviViewNode rawNode = (INaviViewNode) realizer.getUserData().getNode().getRawNode();<NEW_LINE>if (rawNode instanceof INaviCodeNode) {<NEW_LINE>CBreakpointPainter.paintBreakpoints(m_manager, (NaviNode) realizer.getUserData().getNode(), (INaviCodeNode) rawNode);<NEW_LINE>} else if (rawNode instanceof INaviFunctionNode) {<NEW_LINE>CBreakpointPainter.paintBreakpoints(m_manager, (NaviNode) realizer.getUserData().getNode(), (INaviFunctionNode) rawNode);<NEW_LINE>}<NEW_LINE>} | memoryToFile(currentThread.getCurrentAddress()); |
424,008 | public WorkerInfo generateWorkerInfo(Set<WorkerInfoField> fieldRange, boolean isLiveWorker) {<NEW_LINE>WorkerInfo info = new WorkerInfo();<NEW_LINE>Set<WorkerInfoField> checkedFieldRange = fieldRange != null ? fieldRange : new HashSet<>(Arrays.asList(WorkerInfoField.values()));<NEW_LINE>for (WorkerInfoField field : checkedFieldRange) {<NEW_LINE>switch(field) {<NEW_LINE>case ADDRESS:<NEW_LINE><MASK><NEW_LINE>break;<NEW_LINE>case BLOCK_COUNT:<NEW_LINE>info.setBlockCount(getBlockCount());<NEW_LINE>break;<NEW_LINE>case WORKER_CAPACITY_BYTES:<NEW_LINE>info.setCapacityBytes(mUsage.mCapacityBytes);<NEW_LINE>break;<NEW_LINE>case WORKER_CAPACITY_BYTES_ON_TIERS:<NEW_LINE>info.setCapacityBytesOnTiers(mUsage.mTotalBytesOnTiers);<NEW_LINE>break;<NEW_LINE>case ID:<NEW_LINE>info.setId(mMeta.mId);<NEW_LINE>break;<NEW_LINE>case LAST_CONTACT_SEC:<NEW_LINE>info.setLastContactSec((int) ((CommonUtils.getCurrentMs() - mLastUpdatedTimeMs.get()) / Constants.SECOND_MS));<NEW_LINE>break;<NEW_LINE>case START_TIME_MS:<NEW_LINE>info.setStartTimeMs(mMeta.mStartTimeMs);<NEW_LINE>break;<NEW_LINE>case STATE:<NEW_LINE>if (isLiveWorker) {<NEW_LINE>info.setState(LIVE_WORKER_STATE);<NEW_LINE>} else {<NEW_LINE>info.setState(LOST_WORKER_STATE);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case WORKER_USED_BYTES:<NEW_LINE>info.setUsedBytes(mUsage.mUsedBytes);<NEW_LINE>break;<NEW_LINE>case WORKER_USED_BYTES_ON_TIERS:<NEW_LINE>info.setUsedBytesOnTiers(mUsage.mUsedBytesOnTiers);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>LOG.warn("Unrecognized worker info field: " + field);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return info;<NEW_LINE>} | info.setAddress(mMeta.mWorkerAddress); |
399,372 | Guard anonfun_0(Guard pc_3, EventBuffer effects, EventHandlerReturnReason outcome, NamedTupleVS var_payload) {<NEW_LINE>PrimitiveVS<Machine> var_$tmp0 = new PrimitiveVS<Machine>().restrict(pc_3);<NEW_LINE>PrimitiveVS<Machine> var_$tmp1 = new PrimitiveVS<Machine>().restrict(pc_3);<NEW_LINE>PrimitiveVS<Integer> var_$tmp2 = new PrimitiveVS<Integer>(0).restrict(pc_3);<NEW_LINE>PrimitiveVS<Integer> var_$tmp3 = new PrimitiveVS<Integer>(0).restrict(pc_3);<NEW_LINE>PrimitiveVS<Machine> temp_var_0;<NEW_LINE>temp_var_0 = (PrimitiveVS<Machine>) ((var_payload.restrict(pc_3<MASK><NEW_LINE>var_$tmp0 = var_$tmp0.updateUnderGuard(pc_3, temp_var_0);<NEW_LINE>PrimitiveVS<Machine> temp_var_1;<NEW_LINE>temp_var_1 = var_$tmp0.restrict(pc_3);<NEW_LINE>var_$tmp1 = var_$tmp1.updateUnderGuard(pc_3, temp_var_1);<NEW_LINE>PrimitiveVS<Machine> temp_var_2;<NEW_LINE>temp_var_2 = var_$tmp1.restrict(pc_3);<NEW_LINE>var_coordinator = var_coordinator.updateUnderGuard(pc_3, temp_var_2);<NEW_LINE>PrimitiveVS<Integer> temp_var_3;<NEW_LINE>temp_var_3 = (PrimitiveVS<Integer>) ((var_payload.restrict(pc_3)).getField("n"));<NEW_LINE>var_$tmp2 = var_$tmp2.updateUnderGuard(pc_3, temp_var_3);<NEW_LINE>PrimitiveVS<Integer> temp_var_4;<NEW_LINE>temp_var_4 = var_$tmp2.restrict(pc_3);<NEW_LINE>var_$tmp3 = var_$tmp3.updateUnderGuard(pc_3, temp_var_4);<NEW_LINE>PrimitiveVS<Integer> temp_var_5;<NEW_LINE>temp_var_5 = var_$tmp3.restrict(pc_3);<NEW_LINE>var_N = var_N.updateUnderGuard(pc_3, temp_var_5);<NEW_LINE>outcome.addGuardedGoto(pc_3, SendWriteTransaction);<NEW_LINE>pc_3 = Guard.constFalse();<NEW_LINE>return pc_3;<NEW_LINE>} | )).getField("coor")); |
1,541,066 | public static void clearTermuxTMPDIR(boolean onlyIfExists) {<NEW_LINE>// Existence check before clearing may be required since clearDirectory() will automatically<NEW_LINE>// re-create empty directory if doesn't exist, which should not be done for things like<NEW_LINE>// termux-reset (d6eb5e35). Moreover, TMPDIR must be a directory and not a symlink, this can<NEW_LINE>// also allow users who don't want TMPDIR to be cleared automatically on termux exit, since<NEW_LINE>// it may remove files still being used by background processes (#1159).<NEW_LINE>if (onlyIfExists && !FileUtils.directoryFileExists(TermuxConstants.TERMUX_TMP_PREFIX_DIR_PATH, false))<NEW_LINE>return;<NEW_LINE>Error error;<NEW_LINE>TermuxAppSharedProperties properties = TermuxAppSharedProperties.getProperties();<NEW_LINE>int days = properties.getDeleteTMPDIRFilesOlderThanXDaysOnExit();<NEW_LINE>// Disable currently until FileUtils.deleteFilesOlderThanXDays() is fixed.<NEW_LINE>if (days > 0)<NEW_LINE>days = 0;<NEW_LINE>if (days < 0) {<NEW_LINE><MASK><NEW_LINE>} else if (days == 0) {<NEW_LINE>error = FileUtils.clearDirectory("$TMPDIR", FileUtils.getCanonicalPath(TermuxConstants.TERMUX_TMP_PREFIX_DIR_PATH, null));<NEW_LINE>if (error != null) {<NEW_LINE>Logger.logErrorExtended(LOG_TAG, "Failed to clear termux $TMPDIR\n" + error);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>error = FileUtils.deleteFilesOlderThanXDays("$TMPDIR", FileUtils.getCanonicalPath(TermuxConstants.TERMUX_TMP_PREFIX_DIR_PATH, null), TrueFileFilter.INSTANCE, days, true, FileTypes.FILE_TYPE_ANY_FLAGS);<NEW_LINE>if (error != null) {<NEW_LINE>Logger.logErrorExtended(LOG_TAG, "Failed to delete files from termux $TMPDIR older than " + days + " days\n" + error);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Logger.logInfo(LOG_TAG, "Not clearing termux $TMPDIR"); |
1,624,413 | private NLGElement doMorphology(InflectedWordElement element) {<NEW_LINE>NLGElement realisedElement = null;<NEW_LINE>if (element.getFeatureAsBoolean(InternalFeature.NON_MORPH).booleanValue()) {<NEW_LINE>realisedElement = new StringElement(element.getBaseForm());<NEW_LINE>realisedElement.setFeature(InternalFeature.DISCOURSE_FUNCTION, element.getFeature(InternalFeature.DISCOURSE_FUNCTION));<NEW_LINE>} else {<NEW_LINE>NLGElement baseWord = element.getFeatureAsElement(InternalFeature.BASE_WORD);<NEW_LINE>if (baseWord == null && this.lexicon != null) {<NEW_LINE>baseWord = this.lexicon.lookupWord(element.getBaseForm());<NEW_LINE>}<NEW_LINE>ElementCategory category = element.getCategory();<NEW_LINE>if (category instanceof LexicalCategory) {<NEW_LINE>switch((LexicalCategory) category) {<NEW_LINE>case PRONOUN:<NEW_LINE>realisedElement = MorphologyRules.doPronounMorphology(element);<NEW_LINE>break;<NEW_LINE>case NOUN:<NEW_LINE>realisedElement = MorphologyRules.doNounMorphology<MASK><NEW_LINE>break;<NEW_LINE>case VERB:<NEW_LINE>realisedElement = MorphologyRules.doVerbMorphology(element, (WordElement) baseWord);<NEW_LINE>break;<NEW_LINE>case ADJECTIVE:<NEW_LINE>realisedElement = MorphologyRules.doAdjectiveMorphology(element, (WordElement) baseWord);<NEW_LINE>break;<NEW_LINE>case ADVERB:<NEW_LINE>realisedElement = MorphologyRules.doAdverbMorphology(element, (WordElement) baseWord);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>realisedElement = new StringElement(element.getBaseForm());<NEW_LINE>realisedElement.setFeature(InternalFeature.DISCOURSE_FUNCTION, element.getFeature(InternalFeature.DISCOURSE_FUNCTION));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return realisedElement;<NEW_LINE>} | (element, (WordElement) baseWord); |
1,444,787 | public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {<NEW_LINE>MethodSymbol method = ASTHelpers.getSymbol(tree);<NEW_LINE>Type currentClass = getOutermostClass(state);<NEW_LINE>if (method.isStatic() || method.isConstructor() || currentClass == null) {<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>}<NEW_LINE>// allow super.foo() calls to @ForOverride methods from overriding methods<NEW_LINE>if (isSuperCall(currentClass, tree, state)) {<NEW_LINE>MethodTree currentMethod = <MASK><NEW_LINE>// currentMethod might be null if we are in a field initializer<NEW_LINE>if (currentMethod != null) {<NEW_LINE>// MethodSymbol.overrides doesn't check that names match, so we need to do that first.<NEW_LINE>if (currentMethod.getName().equals(method.name)) {<NEW_LINE>MethodSymbol currentMethodSymbol = ASTHelpers.getSymbol(currentMethod);<NEW_LINE>if (currentMethodSymbol.overrides(method, (TypeSymbol) method.owner, state.getTypes(), /* checkResult= */<NEW_LINE>true)) {<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ImmutableList<MethodSymbol> overriddenMethods = getOverriddenMethods(state, method);<NEW_LINE>for (Symbol overriddenMethod : overriddenMethods) {<NEW_LINE>Type declaringClass = ASTHelpers.outermostClass(overriddenMethod).asType();<NEW_LINE>if (!ASTHelpers.isSameType(declaringClass, currentClass, state)) {<NEW_LINE>String customMessage = MESSAGE_BASE + "must not be invoked directly " + "(except by the declaring class, " + declaringClass + ")";<NEW_LINE>return buildDescription(tree).setMessage(customMessage).build();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>} | findDirectMethod(state.getPath()); |
573,749 | public MultiDataSet next(int num) {<NEW_LINE>Preconditions.checkState(hasNext(), "No next element available");<NEW_LINE>List<Pair<List<String>, String>> tokensAndLabelList;<NEW_LINE>int mbSize = 0;<NEW_LINE>int outLength;<NEW_LINE>long[] segIdOnesFrom = null;<NEW_LINE>if (sentenceProvider != null) {<NEW_LINE>List<Pair<String, String>> list = new ArrayList<>(num);<NEW_LINE>while (sentenceProvider.hasNext() && mbSize++ < num) {<NEW_LINE>list.add(sentenceProvider.nextSentence());<NEW_LINE>}<NEW_LINE>SentenceListProcessed sentenceListProcessed = tokenizeMiniBatch(list);<NEW_LINE>tokensAndLabelList = sentenceListProcessed.getTokensAndLabelList();<NEW_LINE>outLength = sentenceListProcessed.getMaxL();<NEW_LINE>} else if (sentencePairProvider != null) {<NEW_LINE>List<Triple<String, String, String>> listPairs = new ArrayList<>(num);<NEW_LINE>while (sentencePairProvider.hasNext() && mbSize++ < num) {<NEW_LINE>listPairs.add(sentencePairProvider.nextSentencePair());<NEW_LINE>}<NEW_LINE>SentencePairListProcessed sentencePairListProcessed = tokenizePairsMiniBatch(listPairs);<NEW_LINE>tokensAndLabelList = sentencePairListProcessed.getTokensAndLabelList();<NEW_LINE>outLength = sentencePairListProcessed.getMaxL();<NEW_LINE>segIdOnesFrom = sentencePairListProcessed.getSegIdOnesFrom();<NEW_LINE>} else {<NEW_LINE>// TODO - other types of iterators...<NEW_LINE>throw new UnsupportedOperationException("Labelled sentence provider is null and no other iterator types have yet been implemented");<NEW_LINE>}<NEW_LINE>Pair<INDArray[], INDArray[]> featuresAndMaskArraysPair = convertMiniBatchFeatures(tokensAndLabelList, outLength, segIdOnesFrom);<NEW_LINE>INDArray[] featureArray = featuresAndMaskArraysPair.getFirst();<NEW_LINE>INDArray[] featureMaskArray = featuresAndMaskArraysPair.getSecond();<NEW_LINE>Pair<INDArray[], INDArray[]> labelsAndMaskArraysPair = <MASK><NEW_LINE>INDArray[] labelArray = labelsAndMaskArraysPair.getFirst();<NEW_LINE>INDArray[] labelMaskArray = labelsAndMaskArraysPair.getSecond();<NEW_LINE>org.nd4j.linalg.dataset.MultiDataSet mds = new org.nd4j.linalg.dataset.MultiDataSet(featureArray, labelArray, featureMaskArray, labelMaskArray);<NEW_LINE>if (preProcessor != null)<NEW_LINE>preProcessor.preProcess(mds);<NEW_LINE>return mds;<NEW_LINE>} | convertMiniBatchLabels(tokensAndLabelList, featureArray, outLength); |
571,611 | public Description matchVariable(VariableTree tree, VisitorState state) {<NEW_LINE>VarSymbol symbol = getSymbol(tree);<NEW_LINE>if (!isConsideredFinal(symbol)) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>if (state.getPath().getParentPath().getLeaf() instanceof ClassTree) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>if (!COLLECTION_TYPE.matches(tree, state) && !PROTO_TYPE.matches(tree, state)) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>List<TreePath> initializers = new ArrayList<>();<NEW_LINE>if (tree.getInitializer() == null) {<NEW_LINE>new TreePathScanner<Void, Void>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Void visitAssignment(AssignmentTree node, Void unused) {<NEW_LINE>if (symbol.equals(getSymbol(node.getVariable()))) {<NEW_LINE>initializers.add(new TreePath(getCurrentPath(), node.getExpression()));<NEW_LINE>}<NEW_LINE>return super.visitAssignment(node, unused);<NEW_LINE>}<NEW_LINE>}.scan(state.getPath().getParentPath(), null);<NEW_LINE>} else {<NEW_LINE>initializers.add(new TreePath(state.getPath(), tree.getInitializer()));<NEW_LINE>}<NEW_LINE>if (initializers.size() != 1) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>TreePath initializerPath = getOnlyElement(initializers);<NEW_LINE>ExpressionTree initializer = (ExpressionTree) initializerPath.getLeaf();<NEW_LINE>if (!NEW_COLLECTION.matches(initializer, state) && !newFluentChain(initializer, state)) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>UnusedScanner isUnusedScanner = new UnusedScanner(symbol, state, getMatcher(tree, state));<NEW_LINE>isUnusedScanner.scan(state.getPath(<MASK><NEW_LINE>if (isUnusedScanner.isUsed) {<NEW_LINE>return NO_MATCH;<NEW_LINE>}<NEW_LINE>ImmutableList<TreePath> removals = tree.getInitializer() == null ? ImmutableList.of(state.getPath(), initializerPath) : ImmutableList.of(initializerPath);<NEW_LINE>return buildDescription(initializer).addAllFixes(isUnusedScanner.buildFixes(removals)).build();<NEW_LINE>} | ).getParentPath(), null); |
1,270,669 | final DisableProactiveEngagementResult executeDisableProactiveEngagement(DisableProactiveEngagementRequest disableProactiveEngagementRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(disableProactiveEngagementRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DisableProactiveEngagementRequest> request = null;<NEW_LINE>Response<DisableProactiveEngagementResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DisableProactiveEngagementRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(disableProactiveEngagementRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Shield");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisableProactiveEngagement");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DisableProactiveEngagementResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DisableProactiveEngagementResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
655,771 | public Mono<RxDocumentServiceResponse> performRequestInternal(RxDocumentServiceRequest request, HttpMethod method, URI requestUri) {<NEW_LINE>try {<NEW_LINE>HttpHeaders httpHeaders = this.getHttpRequestHeaders(request.getHeaders());<NEW_LINE>Flux<byte[]<MASK><NEW_LINE>HttpRequest httpRequest = new HttpRequest(method, requestUri, requestUri.getPort(), httpHeaders, contentAsByteArray);<NEW_LINE>Duration responseTimeout = Duration.ofSeconds(Configs.getHttpResponseTimeoutInSeconds());<NEW_LINE>if (OperationType.QueryPlan.equals(request.getOperationType())) {<NEW_LINE>responseTimeout = Duration.ofSeconds(Configs.getQueryPlanResponseTimeoutInSeconds());<NEW_LINE>} else if (request.isAddressRefresh()) {<NEW_LINE>responseTimeout = Duration.ofSeconds(Configs.getAddressRefreshResponseTimeoutInSeconds());<NEW_LINE>}<NEW_LINE>Mono<HttpResponse> httpResponseMono = this.httpClient.send(httpRequest, responseTimeout);<NEW_LINE>return toDocumentServiceResponse(httpResponseMono, request, httpRequest);<NEW_LINE>} catch (Exception e) {<NEW_LINE>return Mono.error(e);<NEW_LINE>}<NEW_LINE>} | > contentAsByteArray = request.getContentAsByteArrayFlux(); |
633,637 | public static List<CachableRenderStatement> computeFluidOutlineToCache(@Nonnull CollidableComponent component, @Nonnull Fluid fluid, double scaleFactor, float outlineWidth) {<NEW_LINE>Map<Fluid, List<CachableRenderStatement>> cache0 = cache.get(component);<NEW_LINE>if (cache0 == null) {<NEW_LINE>cache0 = new HashMap<Fluid, List<CachableRenderStatement>>();<NEW_LINE>cache.put(component, cache0);<NEW_LINE>}<NEW_LINE>List<CachableRenderStatement> data = cache0.get(fluid);<NEW_LINE>if (data != null) {<NEW_LINE>return data;<NEW_LINE>}<NEW_LINE>data = new ArrayList<CachableRenderStatement>();<NEW_LINE>cache0.put(fluid, data);<NEW_LINE>TextureAtlasSprite texture = RenderUtil.getStillTexture(fluid);<NEW_LINE>int color = fluid.getColor();<NEW_LINE>Vector4f colorv = new Vector4f((color >> 16 & 0xFF) / 255d, (color >> 8 & 0xFF) / 255d, (color & 0xFF) / 255d, 1);<NEW_LINE>BoundingBox bbb;<NEW_LINE>double width = outlineWidth;<NEW_LINE>scaleFactor = scaleFactor - 0.05;<NEW_LINE>final EnumFacing componentDirection = component.getDirection();<NEW_LINE>double xScale = Math.abs(componentDirection.getFrontOffsetX()) == 1 ? width : scaleFactor;<NEW_LINE>double yScale = Math.abs(componentDirection.getFrontOffsetY()) == 1 ? width : scaleFactor;<NEW_LINE>double zScale = Math.abs(componentDirection.getFrontOffsetZ(<MASK><NEW_LINE>double offSize = (0.5 - width) / 2 - width / 2;<NEW_LINE>double xOff = componentDirection.getFrontOffsetX() * offSize;<NEW_LINE>double yOff = componentDirection.getFrontOffsetY() * offSize;<NEW_LINE>double zOff = componentDirection.getFrontOffsetZ() * offSize;<NEW_LINE>bbb = component.bound.scale(xScale, yScale, zScale);<NEW_LINE>bbb = bbb.translate(new Vector3d(xOff, yOff, zOff));<NEW_LINE>for (NNIterator<EnumFacing> itr = NNList.FACING.fastIterator(); itr.hasNext(); ) {<NEW_LINE>EnumFacing face = itr.next();<NEW_LINE>if (face != componentDirection && face != componentDirection.getOpposite()) {<NEW_LINE>List<Vertex> corners = bbb.getCornersWithUvForFace(face, texture.getMinU(), texture.getMaxU(), texture.getMinV(), texture.getMaxV());<NEW_LINE>for (Vertex corner : corners) {<NEW_LINE>data.add(new CachableRenderStatement.AddVertexWithUV(corner.x(), corner.y(), corner.z(), corner.uv.x, corner.uv.y, colorv));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return data;<NEW_LINE>} | )) == 1 ? width : scaleFactor; |
19,297 | public static void main(String[] args) {<NEW_LINE>JavaUmsField ele1 = new JavaUmsField(UmsSysField.ID().toString(), JavaUmsFieldType.LONG, false);<NEW_LINE>JavaUmsField ele2 = new JavaUmsField(UmsSysField.TS().toString(), JavaUmsFieldType.DATETIME, false);<NEW_LINE>JavaUmsField ele3 = new JavaUmsField(UmsSysField.OP().toString(), JavaUmsFieldType.STRING, false);<NEW_LINE>JavaUmsField ele4 = new JavaUmsField(UmsSysField.UID().toString(), JavaUmsFieldType.STRING, false);<NEW_LINE>JavaUmsField ele5 = new JavaUmsField("key1", JavaUmsFieldType.INT, false);<NEW_LINE>JavaUmsField ele6 = new JavaUmsField(<MASK><NEW_LINE>JavaUmsField ele7 = new JavaUmsField("value1", JavaUmsFieldType.DECIMAL, true);<NEW_LINE>JavaUmsField ele8 = new JavaUmsField("value2", JavaUmsFieldType.STRING);<NEW_LINE>java.util.List<JavaUmsField> fields = Arrays.asList(ele1, ele2, ele3, ele4, ele5, ele6, ele7, ele8);<NEW_LINE>GenerateJavaUms ums = new GenerateJavaUms();<NEW_LINE>JavaTuple tuple1 = new JavaTuple(Arrays.asList("1", "2017-09-01 20:51:28.000", "i", "uid1", "1", "2", "3", "4"));<NEW_LINE>JavaTuple tuple2 = new JavaTuple(Arrays.asList("2", "2017-09-01 20:52:28.000", "u", "uid2", "5", "6", "3", "4"));<NEW_LINE>java.util.List<JavaTuple> payload = Arrays.asList(tuple1, tuple2);<NEW_LINE>String rst = ums.generateUms(UmsProtocolType.DATA_INCREMENT_DATA().toString(), "mysql.mysql0.db.table.1.0.0", fields, payload);<NEW_LINE>System.out.println(rst);<NEW_LINE>} | "key2", JavaUmsFieldType.STRING, false); |
1,572,705 | private void writeDependencies() {<NEW_LINE>final JPanel panel = new JPanel(new BorderLayout());<NEW_LINE>panel.setOpaque(false);<NEW_LINE>final JPanel buttonsPanel = new JPanel(new BorderLayout());<NEW_LINE>buttonsPanel.setOpaque(false);<NEW_LINE>final MButton dependenciesButton = new MButton(getString("Dependencies"), BEANS_ICON);<NEW_LINE>buttonsPanel.<MASK><NEW_LINE>dependenciesButton.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>try {<NEW_LINE>MainPanel.addOngletFromChild(buttonsPanel, new DependenciesPanel(getRemoteCollector()));<NEW_LINE>} catch (final IOException ex) {<NEW_LINE>showException(ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (javaInformations.doesPomXmlExists() && Parameters.isSystemActionsEnabled()) {<NEW_LINE>final MButton pomXmlButton = new MButton(getString("pom.xml"), XML_ICON);<NEW_LINE>buttonsPanel.add(pomXmlButton, BorderLayout.EAST);<NEW_LINE>pomXmlButton.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>try {<NEW_LINE>Desktop.getDesktop().browse(new URI(getMonitoringUrl().toExternalForm() + "?part=pom.xml"));<NEW_LINE>} catch (final Exception ex) {<NEW_LINE>showException(ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>panel.add(buttonsPanel, BorderLayout.WEST);<NEW_LINE>gridPanel.add(panel);<NEW_LINE>} | add(dependenciesButton, BorderLayout.WEST); |
1,764,975 | // Always accepts unprotected responses, which is needed for reception of error messages<NEW_LINE>@Override<NEW_LINE>public void receiveResponse(Exchange exchange, Response response) {<NEW_LINE>Request request = exchange.getCurrentRequest();<NEW_LINE>if (request == null) {<NEW_LINE>LOGGER.error("No request tied to this response");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// Printing of status information.<NEW_LINE>// Warns when expecting OSCORE response but unprotected response is received<NEW_LINE>boolean expectProtectedResponse = responseShouldBeProtected(exchange, response);<NEW_LINE>if (!isProtected(response) && expectProtectedResponse) {<NEW_LINE>LOGGER.warn("Incoming response is NOT OSCORE protected!");<NEW_LINE>} else if (isProtected(response) && expectProtectedResponse) {<NEW_LINE>LOGGER.info("Incoming response is OSCORE protected");<NEW_LINE>} else {<NEW_LINE>LOGGER.warn("Incoming response is OSCORE protected but it should not be");<NEW_LINE>}<NEW_LINE>// For OSCORE-protected response with the outer block2-option let<NEW_LINE>// them pass through to be re-assembled by the block-wise layer<NEW_LINE>if (response.getOptions().hasBlock2()) {<NEW_LINE>if (response.getMaxResourceBodySize() == 0) {<NEW_LINE>int maxPayloadSize = getIncomingMaxUnfragSize(response, ctxDb);<NEW_LINE>response.setMaxResourceBodySize(maxPayloadSize);<NEW_LINE>}<NEW_LINE>super.receiveResponse(exchange, response);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// If response is protected with OSCORE parse it first with prepareReceive<NEW_LINE>if (isProtected(response)) {<NEW_LINE>// Parse the OSCORE option from the corresponding request<NEW_LINE>OscoreOptionDecoder optionDecoder = new OscoreOptionDecoder(exchange.getCryptographicContextID());<NEW_LINE>int requestSequenceNumber = optionDecoder.getSequenceNumber();<NEW_LINE>response = prepareReceive(ctxDb, response, requestSequenceNumber);<NEW_LINE>}<NEW_LINE>} catch (OSException e) {<NEW_LINE>LOGGER.error("Error while receiving OSCore response: " + e.getMessage());<NEW_LINE>EmptyMessage error = CoapOSExceptionHandler.manageError(e, response);<NEW_LINE>if (error != null) {<NEW_LINE>sendEmptyMessage(exchange, error);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Remove token if this is an incoming response to an Observe<NEW_LINE>// cancellation request<NEW_LINE>if (exchange.getRequest().isObserveCancel()) {<NEW_LINE>ctxDb.removeToken(response.getToken());<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | super.receiveResponse(exchange, response); |
250,553 | private void createDetailsTab(TabFolder tabs) {<NEW_LINE>Composite detailsGroup = new Composite(tabs, SWT.NONE);<NEW_LINE>detailsGroup.setLayout(new GridLayout(1, false));<NEW_LINE>UIUtils.createControlLabel(detailsGroup, UIConnectionMessages.dialog_edit_driver_label_description);<NEW_LINE>Text descriptionText = new Text(detailsGroup, <MASK><NEW_LINE>descriptionText.setText(CommonUtils.notEmpty(library.getDescription()));<NEW_LINE>GridData gd = new GridData(GridData.FILL_HORIZONTAL);<NEW_LINE>gd.heightHint = 40;<NEW_LINE>descriptionText.setLayoutData(gd);<NEW_LINE>TabItem detailsTab = new TabItem(tabs, SWT.NONE);<NEW_LINE>detailsTab.setText(UIConnectionMessages.dialog_edit_driver_tab_detail);<NEW_LINE>detailsTab.setToolTipText(UIConnectionMessages.dialog_edit_driver_tab_detail_tooltip);<NEW_LINE>detailsTab.setControl(detailsGroup);<NEW_LINE>} | SWT.READ_ONLY | SWT.BORDER); |
1,851,136 | private void initPlayServicesPrefsCallbacks() {<NEW_LINE>Preference pref = findPreference(getString(R.string.pref_play_services));<NEW_LINE>if (pref == null)<NEW_LINE>return;<NEW_LINE>if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getActivity().getApplicationContext()) != ConnectionResult.SUCCESS) {<NEW_LINE>removePreference(getString(R.string.pref_settings_general), pref);<NEW_LINE>} else {<NEW_LINE>((TwoStatePreference) pref).<MASK><NEW_LINE>pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean onPreferenceChange(Preference preference, Object newValue) {<NEW_LINE>boolean oldVal = Config.useGoogleServices();<NEW_LINE>boolean newVal = (Boolean) newValue;<NEW_LINE>if (oldVal != newVal) {<NEW_LINE>Config.setUseGoogleService(newVal);<NEW_LINE>LocationHelper.INSTANCE.restart();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | setChecked(Config.useGoogleServices()); |
1,237,263 | private IRIx internalMakeIRI(String uriStr, long line, long col) {<NEW_LINE>if (uriStr.contains(" ")) {<NEW_LINE>// Specific check for spaces.<NEW_LINE>errorHandler.warning("Bad IRI: <" + <MASK><NEW_LINE>return IRIx.createAny(uriStr);<NEW_LINE>}<NEW_LINE>// Relative IRIs.<NEW_LINE>// jena-iri : these are errors on the<NEW_LINE>try {<NEW_LINE>IRIx iri = resolver.resolve(uriStr);<NEW_LINE>if (checking)<NEW_LINE>doChecking(iri, iri.str(), line, col);<NEW_LINE>return iri;<NEW_LINE>} catch (RelativeIRIException ex) {<NEW_LINE>errorHandler.error("Relative IRI: " + uriStr, line, col);<NEW_LINE>return IRIx.createAny(uriStr);<NEW_LINE>} catch (IRIException ex) {<NEW_LINE>// Same code as Checker.iriViolations<NEW_LINE>String msg = ex.getMessage();<NEW_LINE>Checker.iriViolationMessage(uriStr, true, msg, line, col, errorHandler);<NEW_LINE>return IRIx.createAny(uriStr);<NEW_LINE>}<NEW_LINE>} | uriStr + "> Spaces are not legal in URIs/IRIs.", line, col); |
1,556,947 | private String debugStatsString() {<NEW_LINE>final Map<String, String> stats = new LinkedHashMap<>();<NEW_LINE>if (totalBytes > 0 && byteReaderCounter > 0) {<NEW_LINE>final ProgressInfo progressInfo = new ProgressInfo(startTime, totalBytes, byteReaderCounter);<NEW_LINE>stats.put("progress", progressInfo.debugOutput());<NEW_LINE>}<NEW_LINE>stats.put("linesRead"<MASK><NEW_LINE>stats.put("bytesRead", Long.toString(byteReaderCounter));<NEW_LINE>stats.put("recordsImported", Integer.toString(recordImportCounter));<NEW_LINE>stats.put("rowsPerTransaction", Integer.toString(transactionCalculator.getTransactionSize()));<NEW_LINE>stats.put("charsPerTransaction", charsPerTransactionAverageTracker.avg().toPlainString());<NEW_LINE>stats.put("rowsPerMinute", eventRateMeter.readEventRate().setScale(2, RoundingMode.DOWN).toString());<NEW_LINE>stats.put("duration", TimeDuration.compactFromCurrent(startTime));<NEW_LINE>return StringUtil.mapToString(stats);<NEW_LINE>} | , Integer.toString(lineReaderCounter)); |
1,795,763 | public String info() {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append(format(ENGLISH, "Order : %d%n", order));<NEW_LINE>for (int i = 1; i < ngramData.length; i++) {<NEW_LINE>GramDataArray gramDataArray = ngramData[i];<NEW_LINE>if (i == 1) {<NEW_LINE>sb.append(format(ENGLISH, "1 Grams: Count= %d%n", unigramProbs.length));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>sb.append(format(ENGLISH, "%d Grams: Count= %d Fingerprint Bits= %d Probabilty Bits= %d Back-off bits= %d%n", i, gramDataArray.count, gramDataArray.fpSize * 8, gramDataArray.probSize * 8, gramDataArray.backoffSize * 8));<NEW_LINE>}<NEW_LINE>sb.append(format(ENGLISH, "Log Base : %.2f%n", logBase));<NEW_LINE>sb.append(format(ENGLISH, "Unigram Weight : %.2f%n", unigramWeight));<NEW_LINE>sb.append(format(ENGLISH, "Using Stupid Back-off?: %s%n", useStupidBackoff ? "Yes" : "No"));<NEW_LINE>if (useStupidBackoff) {<NEW_LINE>sb.append(format<MASK><NEW_LINE>}<NEW_LINE>sb.append(format(ENGLISH, "Unknown Back-off N-gram penalty: %.2f%n", unknownBackoffPenalty));<NEW_LINE>return sb.toString();<NEW_LINE>} | (ENGLISH, "Stupid Back-off Alpha Value : %.2f%n", stupidBackoffAlpha)); |
1,351,606 | private CaseAnalysis analyzeCaseTwo() throws ExprValidationException {<NEW_LINE>// Case 2 expression example:<NEW_LINE>// case p when p1 then x [when p2 then y...] [else z]<NEW_LINE>//<NEW_LINE>ExprNode[] children = this.getChildNodes();<NEW_LINE>if (children.length < 3) {<NEW_LINE>throw new ExprValidationException("Case node must have at least 3 parameters");<NEW_LINE>}<NEW_LINE>ExprNode optionalCompareExprNode = children[0];<NEW_LINE>List<UniformPair<ExprNode>> whenThenNodeList = new LinkedList<>();<NEW_LINE>int numWhenThen = (children.length - 1) / 2;<NEW_LINE>for (int i = 0; i < numWhenThen; i++) {<NEW_LINE>whenThenNodeList.add(new UniformPair<>(children[i * 2 + 1], children[<MASK><NEW_LINE>}<NEW_LINE>ExprNode optionalElseExprNode = null;<NEW_LINE>if (numWhenThen * 2 + 1 < children.length) {<NEW_LINE>optionalElseExprNode = children[children.length - 1];<NEW_LINE>}<NEW_LINE>return new CaseAnalysis(whenThenNodeList, optionalCompareExprNode, optionalElseExprNode);<NEW_LINE>} | i * 2 + 2])); |
731,240 | public void initialize(InputSplit split, TaskAttemptContext ctx) throws IOException, InterruptedException {<NEW_LINE>// set up columns that needs to read from the RCFile.<NEW_LINE>tDesc = TStructDescriptor.getInstance(typeRef.getRawClass());<NEW_LINE>thriftWritable = ThriftWritable.newInstance((Class<TBase<?, ?>>) typeRef.getRawClass());<NEW_LINE>final List<Field> tFields = tDesc.getFields();<NEW_LINE>FileSplit fsplit = (FileSplit) split;<NEW_LINE>Path file = fsplit.getPath();<NEW_LINE>LOG.info(String.format("reading %s from %s:%d:%d", typeRef.getRawClass().getName(), file.toString(), fsplit.getStart(), fsplit.getStart() + fsplit.getLength()));<NEW_LINE>Configuration <MASK><NEW_LINE>ColumnarMetadata storedInfo = RCFileUtil.readMetadata(conf, file);<NEW_LINE>// list of field numbers<NEW_LINE>List<Integer> tFieldIds = Lists.transform(tFields, new Function<Field, Integer>() {<NEW_LINE><NEW_LINE>public Integer apply(Field fd) {<NEW_LINE>return Integer.valueOf(fd.getFieldId());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>columnsBeingRead = RCFileUtil.findColumnsToRead(conf, tFieldIds, storedInfo);<NEW_LINE>for (int idx : columnsBeingRead) {<NEW_LINE>int fid = storedInfo.getFieldId(idx);<NEW_LINE>if (fid >= 0) {<NEW_LINE>knownRequiredFields.add(tFields.get(tFieldIds.indexOf(fid)));<NEW_LINE>} else {<NEW_LINE>readUnknownsColumn = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ColumnProjectionUtils.setReadColumnIDs(conf, columnsBeingRead);<NEW_LINE>// finally!<NEW_LINE>super.initialize(split, ctx);<NEW_LINE>} | conf = HadoopCompat.getConfiguration(ctx); |
718,934 | private static long hashLen0to16(byte[] byteArray) {<NEW_LINE>int len = byteArray.length;<NEW_LINE>if (len >= 8) {<NEW_LINE>long mul = k2 + len * 2L;<NEW_LINE>long a = fetch64(byteArray, 0) + k2;<NEW_LINE>long b = fetch64(byteArray, len - 8);<NEW_LINE>long c = rotate64(b, 37) * mul + a;<NEW_LINE>long d = (rotate64(a, 25) + b) * mul;<NEW_LINE>return hashLen16(c, d, mul);<NEW_LINE>}<NEW_LINE>if (len >= 4) {<NEW_LINE>long mul = k2 + len * 2;<NEW_LINE>long a = fetch32(byteArray, 0) & 0xffffffffL;<NEW_LINE>return hashLen16(len + (a << 3), fetch32(byteArray, len - 4) & 0xffffffffL, mul);<NEW_LINE>}<NEW_LINE>if (len > 0) {<NEW_LINE>int a = byteArray[0] & 0xff;<NEW_LINE>int b = byteArray[<MASK><NEW_LINE>int c = byteArray[len - 1] & 0xff;<NEW_LINE>int y = a + (b << 8);<NEW_LINE>int z = len + (c << 2);<NEW_LINE>return shiftMix(y * k2 ^ z * k0) * k2;<NEW_LINE>}<NEW_LINE>return k2;<NEW_LINE>} | len >>> 1] & 0xff; |
397,923 | protected void notifyComplete(MqttToken token) throws MqttException {<NEW_LINE>final String methodName = "notifyComplete";<NEW_LINE>MqttWireMessage message = token.internalTok.getWireMessage();<NEW_LINE>if (message != null && message instanceof MqttAck) {<NEW_LINE>// @TRACE 629=received key={0} token={1} message={2}<NEW_LINE>log.fine(CLASS_NAME, methodName, "629", new Object[] { Integer.valueOf(message.getMessageId()), token, message });<NEW_LINE>MqttAck ack = (MqttAck) message;<NEW_LINE>if (ack instanceof MqttPubAck) {<NEW_LINE>// QoS 1 - user notified now remove from persistence...<NEW_LINE>persistence<MASK><NEW_LINE>persistence.remove(getSendBufferedPersistenceKey(message));<NEW_LINE>outboundQoS1.remove(Integer.valueOf(ack.getMessageId()));<NEW_LINE>decrementInFlight();<NEW_LINE>releaseMessageId(message.getMessageId());<NEW_LINE>tokenStore.removeToken(message);<NEW_LINE>// @TRACE 650=removed Qos 1 publish. key={0}<NEW_LINE>log.fine(CLASS_NAME, methodName, "650", new Object[] { Integer.valueOf(ack.getMessageId()) });<NEW_LINE>} else if (ack instanceof MqttPubComp) {<NEW_LINE>// QoS 2 - user notified now remove from persistence...<NEW_LINE>persistence.remove(getSendPersistenceKey(message));<NEW_LINE>persistence.remove(getSendConfirmPersistenceKey(message));<NEW_LINE>persistence.remove(getSendBufferedPersistenceKey(message));<NEW_LINE>outboundQoS2.remove(Integer.valueOf(ack.getMessageId()));<NEW_LINE>inFlightPubRels--;<NEW_LINE>decrementInFlight();<NEW_LINE>releaseMessageId(message.getMessageId());<NEW_LINE>tokenStore.removeToken(message);<NEW_LINE>// @TRACE 645=removed QoS 2 publish/pubrel. key={0}, -1 inFlightPubRels={1}<NEW_LINE>log.fine(CLASS_NAME, methodName, "645", new Object[] { Integer.valueOf(ack.getMessageId()), Integer.valueOf(inFlightPubRels) });<NEW_LINE>}<NEW_LINE>checkQuiesceLock();<NEW_LINE>}<NEW_LINE>} | .remove(getSendPersistenceKey(message)); |
1,277,567 | public static DefaultHandle createHandle(final Node node) {<NEW_LINE>try {<NEW_LINE>Children.PR.enterReadAccess();<NEW_LINE>String childPath = node.getName();<NEW_LINE>if (childPath == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Node parentNode = node.getParentNode();<NEW_LINE>if (parentNode == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Node foundChild = parentNode.getChildren().findChild(childPath);<NEW_LINE>if (foundChild != node) {<NEW_LINE>Logger.getLogger(DefaultHandle.class.getName()).log(Level.WARNING, "parent could not find own child: node={0} parentNode={1} childPath={2} foundChild={3}", new Object[] { node, parentNode, childPath, foundChild });<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Node.<MASK><NEW_LINE>if (parentHandle == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return new DefaultHandle(parentHandle, childPath);<NEW_LINE>} finally {<NEW_LINE>Children.PR.exitReadAccess();<NEW_LINE>}<NEW_LINE>} | Handle parentHandle = parentNode.getHandle(); |
2,473 | private void saveMonitoringSettings() {<NEW_LINE><MASK><NEW_LINE>config.setFileExts(XDMUtils.appendStr2Array(txtFileTyp.getText()));<NEW_LINE>config.setVidExts(XDMUtils.appendStr2Array(txtVidType.getText()));<NEW_LINE>config.setBlockedHosts(XDMUtils.appendStr2Array(txtBlockedHosts.getText()));<NEW_LINE>config.setShowVideoNotification(chkVidPan.isSelected());<NEW_LINE>config.setMonitorClipboard(chkMonitorClipboard.isSelected());<NEW_LINE>if (config.isMonitorClipboard()) {<NEW_LINE>ClipboardMonitor.getInstance().startMonitoring();<NEW_LINE>} else {<NEW_LINE>ClipboardMonitor.getInstance().stopMonitoring();<NEW_LINE>}<NEW_LINE>int index = cmbMinVidSize.getSelectedIndex();<NEW_LINE>if (index >= 0) {<NEW_LINE>config.setMinVidSize(sizeArr[index]);<NEW_LINE>}<NEW_LINE>config.setDownloadAutoStart(chkDwnAuto.isSelected());<NEW_LINE>config.setFetchTs(chkGetTs.isSelected());<NEW_LINE>config.save();<NEW_LINE>} | Config config = Config.getInstance(); |
568,513 | public SourceIpConfig unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>SourceIpConfig sourceIpConfig = new SourceIpConfig();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Cidrs", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>sourceIpConfig.setCidrs(new ListUnmarshaller<String>(context.getUnmarshaller(String.class<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return sourceIpConfig;<NEW_LINE>} | )).unmarshall(context)); |
427,349 | public Set<IndexedData> resolveIndexesFor(TypeInformation<?> typeInformation, @Nullable Object value) {<NEW_LINE>if (value == null) {<NEW_LINE>return Collections.emptySet();<NEW_LINE>}<NEW_LINE>RedisPersistentEntity<?> entity = mappingContext.getPersistentEntity(typeInformation);<NEW_LINE>if (entity == null) {<NEW_LINE>return Collections.emptySet();<NEW_LINE>}<NEW_LINE>String keyspace = entity.getKeySpace();<NEW_LINE>Set<IndexedData> <MASK><NEW_LINE>for (IndexDefinition setting : settings.getIndexDefinitionsFor(keyspace)) {<NEW_LINE>if (setting instanceof SpelIndexDefinition) {<NEW_LINE>Expression expression = getAndCacheIfAbsent((SpelIndexDefinition) setting);<NEW_LINE>StandardEvaluationContext context = new StandardEvaluationContext();<NEW_LINE>context.setRootObject(value);<NEW_LINE>context.setVariable("this", value);<NEW_LINE>if (beanResolver != null) {<NEW_LINE>context.setBeanResolver(beanResolver);<NEW_LINE>}<NEW_LINE>Object index = expression.getValue(context);<NEW_LINE>if (index != null) {<NEW_LINE>indexes.add(new SimpleIndexedPropertyValue(keyspace, setting.getIndexName(), index));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return indexes;<NEW_LINE>} | indexes = new HashSet<>(); |
136,021 | public void save(Writer writer, Properties options) throws IOException {<NEW_LINE>writer.write("columnNameCount=");<NEW_LINE>writer.write(Integer.toString(_columnNames.size()));<NEW_LINE>writer.write('\n');<NEW_LINE>for (String n : _columnNames) {<NEW_LINE>writer.write(n);<NEW_LINE>writer.write('\n');<NEW_LINE>}<NEW_LINE>writer.write("oldColumnCount=");<NEW_LINE>writer.write(Integer.toString<MASK><NEW_LINE>writer.write('\n');<NEW_LINE>for (Column c : _oldColumns) {<NEW_LINE>c.save(writer);<NEW_LINE>writer.write('\n');<NEW_LINE>}<NEW_LINE>writer.write("newColumnCount=");<NEW_LINE>writer.write(Integer.toString(_newColumns.size()));<NEW_LINE>writer.write('\n');<NEW_LINE>for (Column c : _newColumns) {<NEW_LINE>c.save(writer);<NEW_LINE>writer.write('\n');<NEW_LINE>}<NEW_LINE>writer.write("removedColumnCount=");<NEW_LINE>writer.write(Integer.toString(_removedColumns.size()));<NEW_LINE>writer.write('\n');<NEW_LINE>for (Column c : _removedColumns) {<NEW_LINE>c.save(writer);<NEW_LINE>writer.write('\n');<NEW_LINE>}<NEW_LINE>writer.write("oldCellCount=");<NEW_LINE>writer.write(Integer.toString(_oldCells.length));<NEW_LINE>writer.write('\n');<NEW_LINE>for (CellAtRowCellIndex c : _oldCells) {<NEW_LINE>c.save(writer, options);<NEW_LINE>writer.write('\n');<NEW_LINE>}<NEW_LINE>writeOldColumnGroups(writer, options, _oldColumnGroups);<NEW_LINE>// end of change marker<NEW_LINE>writer.write("/ec/\n");<NEW_LINE>} | (_oldColumns.size())); |
462,057 | private Document LoadProjectFileFromController() throws IhcExecption {<NEW_LINE>try {<NEW_LINE>WSProjectInfo projectInfo = getProjectInfo();<NEW_LINE>int numberOfSegments = controllerService.getProjectNumberOfSegments();<NEW_LINE>int segmentationSize = controllerService.getProjectSegmentationSize();<NEW_LINE>logger.debug("Number of segments: {}", numberOfSegments);<NEW_LINE>logger.debug("Segmentation size: {}", segmentationSize);<NEW_LINE>ByteArrayOutputStream byteStream = new ByteArrayOutputStream();<NEW_LINE>for (int i = 0; i < numberOfSegments; i++) {<NEW_LINE>logger.debug("Downloading segment {}", i);<NEW_LINE>WSFile data = controllerService.getProjectSegment(i, projectInfo.getProjectMajorRevision(), projectInfo.getProjectMinorRevision());<NEW_LINE>byteStream.write(data.getData());<NEW_LINE>}<NEW_LINE>logger.debug("File size before base64 encoding: {} bytes", byteStream.size());<NEW_LINE>byte[] decodedBytes = javax.xml.bind.DatatypeConverter.parseBase64Binary(byteStream.toString());<NEW_LINE>logger.debug("File size after base64 encoding: {} bytes", decodedBytes.length);<NEW_LINE>GZIPInputStream gzis = new GZIPInputStream(new ByteArrayInputStream(decodedBytes));<NEW_LINE>InputStreamReader in = new InputStreamReader(gzis, "ISO-8859-1");<NEW_LINE>InputSource reader = new InputSource(in);<NEW_LINE>DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();<NEW_LINE><MASK><NEW_LINE>return db.parse(reader);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new IhcExecption(e);<NEW_LINE>}<NEW_LINE>} | DocumentBuilder db = dbf.newDocumentBuilder(); |
1,834,220 | public static List<Property> createProperties(CTTblPrBase tblPr) {<NEW_LINE>List<Property> properties = new ArrayList<Property>();<NEW_LINE>if (tblPr.getJc() != null && (tblPr.getJc().getVal().equals(JcEnumeration.CENTER) || tblPr.getJc().getVal().equals(JcEnumeration.RIGHT))) {<NEW_LINE>// ignore TblInd (since docx4j 3.0.1)<NEW_LINE>} else {<NEW_LINE>if (tblPr.getTblInd() != null)<NEW_LINE>properties.add(new org.docx4j.model.properties.table.Indent(tblPr.getTblInd()));<NEW_LINE>}<NEW_LINE>if (tblPr.getTblBorders() != null) {<NEW_LINE>TblBorders tblBorders = tblPr.getTblBorders();<NEW_LINE>if (tblBorders.getTop() != null)<NEW_LINE>properties.add(new BorderTop(tblBorders.getTop()));<NEW_LINE>if (tblBorders.getBottom() != null)<NEW_LINE>properties.add(new BorderBottom(tblBorders.getBottom()));<NEW_LINE>if (tblBorders.getLeft() != null)<NEW_LINE>properties.add(new BorderLeft(tblBorders.getLeft()));<NEW_LINE>if (tblBorders.getRight() != null)<NEW_LINE>properties.add(new BorderRight(tblBorders.getRight()));<NEW_LINE>// TODO<NEW_LINE>// if (tblBorders.getInsideH()!=null)<NEW_LINE>// properties.add(new BorderRight(tblBorders.getRight()) );<NEW_LINE>// if (tblBorders.getInsideV()!=null)<NEW_LINE>// properties.add(new BorderRight(tblBorders.getRight()) );<NEW_LINE>}<NEW_LINE>// if (tblPr.getTblCellSpacing()==null) {<NEW_LINE>// // If borderConflictResolutionRequired is required, we need<NEW_LINE>// // to set this explicitly, because in CSS, 'separate' is<NEW_LINE>// // the default. The problem is that we need to avoid<NEW_LINE>// // overruling an inherited value (ie where TblCellSpacing<NEW_LINE>// // is set).<NEW_LINE>// properties.add(new AdHocProperty("border-collapse", "collapse") );<NEW_LINE>// } else {<NEW_LINE>// properties.add(new AdHocProperty("border-collapse", "separate") ); // default<NEW_LINE>// }<NEW_LINE>if (tblPr.getTblW() != null) {<NEW_LINE>// @w:w<NEW_LINE>if (tblPr.getTblW().getW() != null && tblPr.getTblW().getW() != BigInteger.ZERO) {<NEW_LINE>properties.add(new AdHocProperty("table-layout"<MASK><NEW_LINE>} else if (tblPr.getTblW().getType() != null && tblPr.getTblW().getType().equals("auto")) {<NEW_LINE>properties.add(new AdHocProperty("table-layout", "auto", "table-layout", "auto"));<NEW_LINE>// FOP doesn't support auto, but it degrades gracefully<NEW_LINE>}<NEW_LINE>// otherwise the default 'auto' is implied<NEW_LINE>}<NEW_LINE>if (tblPr.getShd() != null) {<NEW_LINE>properties.add(new Shading(tblPr.getShd()));<NEW_LINE>}<NEW_LINE>return properties;<NEW_LINE>} | , "fixed", "table-layout", "fixed")); |
687,085 | public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {<NEW_LINE>try {<NEW_LINE>final AttributedList<Path> children = new AttributedList<Path>();<NEW_LINE>for (final DavResource resource : this.list(directory)) {<NEW_LINE>// Try to parse as RFC 2396<NEW_LINE>final String href = PathNormalizer.normalize(resource.getHref().getPath(), true);<NEW_LINE>if (href.equals(directory.getAbsolute())) {<NEW_LINE>log.warn(String.format("Ignore resource %s", href));<NEW_LINE>// Do not include self<NEW_LINE>if (resource.isDirectory()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>throw new NotfoundException(directory.getAbsolute());<NEW_LINE>}<NEW_LINE>final PathAttributes attr = attributes.toAttributes(resource);<NEW_LINE>final Path file = new Path(directory, PathNormalizer.name(href), resource.isDirectory() ? EnumSet.of(Path.Type.directory) : EnumSet.of(Path.Type.file), attr);<NEW_LINE>children.add(file);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return children;<NEW_LINE>} catch (SardineException e) {<NEW_LINE>throw new DAVExceptionMappingService().map("Listing directory {0} failed", e, directory);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new HttpExceptionMappingService().map(e, directory);<NEW_LINE>}<NEW_LINE>} | listener.chunk(directory, children); |
857,863 | private void receivedFHTState(String device, String state) {<NEW_LINE>logger.debug("Received state " + state + " for FHT device " + device);<NEW_LINE>int stateValue = Integer.parseInt(state, 16);<NEW_LINE>FHTBindingConfig config = getConfig(device, Datapoint.BATTERY);<NEW_LINE>OnOffType batteryAlarm = null;<NEW_LINE>if (stateValue % 2 == 0) {<NEW_LINE>batteryAlarm = OnOffType.OFF;<NEW_LINE>} else {<NEW_LINE>stateValue = stateValue - 1;<NEW_LINE>batteryAlarm = OnOffType.ON;<NEW_LINE>}<NEW_LINE>if (config != null) {<NEW_LINE>logger.debug("Updating item " + config.getItem().getName() + " with battery state");<NEW_LINE>eventPublisher.postUpdate(config.getItem().getName(), batteryAlarm);<NEW_LINE>}<NEW_LINE>OpenClosedType windowState = null;<NEW_LINE>if (stateValue == 0) {<NEW_LINE>windowState = OpenClosedType.CLOSED;<NEW_LINE>} else {<NEW_LINE>windowState = OpenClosedType.OPEN;<NEW_LINE>}<NEW_LINE>config = getConfig(device, Datapoint.WINDOW);<NEW_LINE>if (config != null) {<NEW_LINE>logger.debug("Updating item " + config.getItem(<MASK><NEW_LINE>eventPublisher.postUpdate(config.getItem().getName(), windowState);<NEW_LINE>} else {<NEW_LINE>logger.debug("Received FHT state from unknown device " + device);<NEW_LINE>}<NEW_LINE>} | ).getName() + " with window state"); |
1,850,585 | public void read(org.apache.thrift.protocol.TProtocol prot, TExternalCompaction struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;<NEW_LINE>java.util.BitSet incoming = iprot.readBitSet(4);<NEW_LINE>if (incoming.get(0)) {<NEW_LINE>struct.queueName = iprot.readString();<NEW_LINE>struct.setQueueNameIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(1)) {<NEW_LINE>struct.compactor = iprot.readString();<NEW_LINE>struct.setCompactorIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(2)) {<NEW_LINE>{<NEW_LINE>org.apache.thrift.protocol.TMap _map6 = iprot.readMapBegin(org.apache.thrift.protocol.TType.I64, org.apache.thrift.protocol.TType.STRUCT);<NEW_LINE>struct.updates = new java.util.HashMap<java.lang.Long, TCompactionStatusUpdate>(2 * _map6.size);<NEW_LINE>long _key7;<NEW_LINE>@org.apache.thrift.annotation.Nullable<NEW_LINE>TCompactionStatusUpdate _val8;<NEW_LINE>for (int _i9 = 0; _i9 < _map6.size; ++_i9) {<NEW_LINE>_key7 = iprot.readI64();<NEW_LINE>_val8 = new TCompactionStatusUpdate();<NEW_LINE>_val8.read(iprot);<NEW_LINE>struct.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>struct.setUpdatesIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(3)) {<NEW_LINE>struct.job = new org.apache.accumulo.core.tabletserver.thrift.TExternalCompactionJob();<NEW_LINE>struct.job.read(iprot);<NEW_LINE>struct.setJobIsSet(true);<NEW_LINE>}<NEW_LINE>} | updates.put(_key7, _val8); |
414,983 | public boolean onKey(KeyEvent event) {<NEW_LINE>boolean consumed = false;<NEW_LINE>// logger.log(Level.INFO, "onKey event: {0}", event);<NEW_LINE>event.getDeviceId();<NEW_LINE>event.getSource();<NEW_LINE>AndroidJoystick joystick = joystickIndex.get(event.getDeviceId());<NEW_LINE>if (joystick != null) {<NEW_LINE>JoystickButton button = joystick.getButton(event.getKeyCode());<NEW_LINE>boolean pressed = event.getAction() == KeyEvent.ACTION_DOWN;<NEW_LINE>if (button != null) {<NEW_LINE>JoyButtonEvent buttonEvent = new JoyButtonEvent(button, pressed);<NEW_LINE>joyInput.addEvent(buttonEvent);<NEW_LINE>consumed = true;<NEW_LINE>} else {<NEW_LINE>JoystickButton newButton = joystick.<MASK><NEW_LINE>JoyButtonEvent buttonEvent = new JoyButtonEvent(newButton, pressed);<NEW_LINE>joyInput.addEvent(buttonEvent);<NEW_LINE>consumed = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return consumed;<NEW_LINE>} | addButton(event.getKeyCode()); |
1,702,338 | private QueryResultMetaData createQueryResultMetaData() {<NEW_LINE>List<RawQueryResultColumnMetaData> columns = new ArrayList<>();<NEW_LINE>columns.add(new RawQueryResultColumnMetaData("", "Id", "Id", Types.VARCHAR, "VARCHAR", 20, 0));<NEW_LINE>columns.add(new RawQueryResultColumnMetaData("", "User", "User", Types.VARCHAR<MASK><NEW_LINE>columns.add(new RawQueryResultColumnMetaData("", "Host", "Host", Types.VARCHAR, "VARCHAR", 64, 0));<NEW_LINE>columns.add(new RawQueryResultColumnMetaData("", "db", "db", Types.VARCHAR, "VARCHAR", 64, 0));<NEW_LINE>columns.add(new RawQueryResultColumnMetaData("", "Command", "Command", Types.VARCHAR, "VARCHAR", 64, 0));<NEW_LINE>columns.add(new RawQueryResultColumnMetaData("", "Time", "Time", Types.VARCHAR, "VARCHAR", 10, 0));<NEW_LINE>columns.add(new RawQueryResultColumnMetaData("", "State", "State", Types.VARCHAR, "VARCHAR", 64, 0));<NEW_LINE>columns.add(new RawQueryResultColumnMetaData("", "Info", "Info", Types.VARCHAR, "VARCHAR", 120, 0));<NEW_LINE>return new RawQueryResultMetaData(columns);<NEW_LINE>} | , "VARCHAR", 20, 0)); |
1,359,499 | static void visitDirsRecursivelyWithoutExcluded(@Nonnull Project project, @Nonnull VirtualFile root, boolean visitIgnoredFoldersThemselves, @Nonnull Function<? super VirtualFile, Result> processor) {<NEW_LINE>ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();<NEW_LINE>Option depthLimit = limit<MASK><NEW_LINE>Pattern ignorePattern = parseDirIgnorePattern();<NEW_LINE>if (isUnderIgnoredDirectory(project, ignorePattern, visitIgnoredFoldersThemselves ? root.getParent() : root))<NEW_LINE>return;<NEW_LINE>VfsUtilCore.visitChildrenRecursively(root, new VirtualFileVisitor<Void>(NO_FOLLOW_SYMLINKS, depthLimit) {<NEW_LINE><NEW_LINE>@Nonnull<NEW_LINE>@Override<NEW_LINE>public VirtualFileVisitor.Result visitFileEx(@Nonnull VirtualFile file) {<NEW_LINE>if (!file.isDirectory()) {<NEW_LINE>return CONTINUE;<NEW_LINE>}<NEW_LINE>if (visitIgnoredFoldersThemselves) {<NEW_LINE>Result apply = processor.apply(file);<NEW_LINE>if (apply != CONTINUE) {<NEW_LINE>return apply;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (isIgnoredDirectory(project, ignorePattern, file)) {<NEW_LINE>return SKIP_CHILDREN;<NEW_LINE>}<NEW_LINE>if (ReadAction.compute(() -> project.isDisposed() || !fileIndex.isInContent(file))) {<NEW_LINE>return SKIP_CHILDREN;<NEW_LINE>}<NEW_LINE>if (!visitIgnoredFoldersThemselves) {<NEW_LINE>Result apply = processor.apply(file);<NEW_LINE>if (apply != CONTINUE) {<NEW_LINE>return apply;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return CONTINUE;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | (Registry.intValue("vcs.root.detector.folder.depth")); |
570,902 | public T visitDyadicExpr_A(DyadicExpr_AContext ctx) {<NEW_LINE>TerminalNode dyadicOper = null;<NEW_LINE>dyadicOper = operSwitch(<MASK><NEW_LINE>dyadicOper = operSwitch(dyadicOper, ctx.DIV());<NEW_LINE>dyadicOper = operSwitch(dyadicOper, ctx.DIV2());<NEW_LINE>dyadicOper = operSwitch(dyadicOper, ctx.MOD());<NEW_LINE>//<NEW_LINE>ctx.expr(0).accept(this);<NEW_LINE>ctx.expr(1).accept(this);<NEW_LINE>//<NEW_LINE>Expression expr2 = (Expression) this.instStack.pop();<NEW_LINE>Expression expr1 = (Expression) this.instStack.pop();<NEW_LINE>SymbolToken symbolToken = code(new SymbolToken(dyadicOper.getText()), dyadicOper);<NEW_LINE>this.instStack.push(code(new DyadicExpression(expr1, symbolToken, expr2), ctx));<NEW_LINE>return null;<NEW_LINE>} | dyadicOper, ctx.MUL()); |
228,642 | protected void masterOperation(Task task, GetSettingsRequest request, ClusterState state, ActionListener<GetSettingsResponse> listener) {<NEW_LINE>Index[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, request);<NEW_LINE>ImmutableOpenMap.Builder<String, Settings> indexToSettingsBuilder = ImmutableOpenMap.builder();<NEW_LINE>ImmutableOpenMap.Builder<String, Settings> indexToDefaultSettingsBuilder = ImmutableOpenMap.builder();<NEW_LINE>for (Index concreteIndex : concreteIndices) {<NEW_LINE>IndexMetadata indexMetadata = state.getMetadata().index(concreteIndex);<NEW_LINE>if (indexMetadata == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Settings indexSettings = settingsFilter.filter(indexMetadata.getSettings());<NEW_LINE>if (request.humanReadable()) {<NEW_LINE>indexSettings = IndexMetadata.addHumanReadableSettings(indexSettings);<NEW_LINE>}<NEW_LINE>if (isFilteredRequest(request)) {<NEW_LINE>indexSettings = indexSettings.filter(k -> Regex.simpleMatch(request<MASK><NEW_LINE>}<NEW_LINE>indexToSettingsBuilder.put(concreteIndex.getName(), indexSettings);<NEW_LINE>if (request.includeDefaults()) {<NEW_LINE>Settings defaultSettings = settingsFilter.filter(indexScopedSettings.diff(indexSettings, Settings.EMPTY));<NEW_LINE>if (isFilteredRequest(request)) {<NEW_LINE>defaultSettings = defaultSettings.filter(k -> Regex.simpleMatch(request.names(), k));<NEW_LINE>}<NEW_LINE>indexToDefaultSettingsBuilder.put(concreteIndex.getName(), defaultSettings);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>listener.onResponse(new GetSettingsResponse(indexToSettingsBuilder.build(), indexToDefaultSettingsBuilder.build()));<NEW_LINE>} | .names(), k)); |
1,033,196 | private MemoryMetrics createMemoryMetrics() {<NEW_LINE>MemoryMetrics.Builder memoryMetrics = MemoryMetrics.newBuilder();<NEW_LINE>long usedHeapSizePostBuild = 0;<NEW_LINE>if (MemoryProfiler.instance().getHeapUsedMemoryAtFinish() > 0) {<NEW_LINE>memoryMetrics.setUsedHeapSizePostBuild(MemoryProfiler.instance().getHeapUsedMemoryAtFinish());<NEW_LINE>}<NEW_LINE>PostGCMemoryUseRecorder.get().getPeakPostGcHeap().map(PeakHeap::bytes<MASK><NEW_LINE>if (memoryMetrics.getPeakPostGcHeapSize() < usedHeapSizePostBuild) {<NEW_LINE>// If we just did a GC and computed the heap size, update the one we got from the GC<NEW_LINE>// notification (which may arrive too late for this specific GC).<NEW_LINE>memoryMetrics.setPeakPostGcHeapSize(usedHeapSizePostBuild);<NEW_LINE>}<NEW_LINE>PostGCMemoryUseRecorder.get().getPeakPostGcHeapTenuredSpace().map(PeakHeap::bytes).ifPresent(memoryMetrics::setPeakPostGcTenuredSpaceHeapSize);<NEW_LINE>Map<String, Long> garbageStats = PostGCMemoryUseRecorder.get().getGarbageStats();<NEW_LINE>for (Map.Entry<String, Long> garbageEntry : garbageStats.entrySet()) {<NEW_LINE>GarbageMetrics.Builder garbageMetrics = GarbageMetrics.newBuilder();<NEW_LINE>garbageMetrics.setType(garbageEntry.getKey()).setGarbageCollected(garbageEntry.getValue());<NEW_LINE>memoryMetrics.addGarbageMetrics(garbageMetrics.build());<NEW_LINE>}<NEW_LINE>return memoryMetrics.build();<NEW_LINE>} | ).ifPresent(memoryMetrics::setPeakPostGcHeapSize); |
914,209 | protected void closeSheet() {<NEW_LINE>if (sheetHelper != null) {<NEW_LINE>XlsReportConfiguration configuration = getCurrentItemConfiguration();<NEW_LINE>boolean isIgnorePageMargins = configuration.isIgnorePageMargins();<NEW_LINE>if (currentSheetFirstPageNumber != null && currentSheetFirstPageNumber > 0) {<NEW_LINE>sheetHelper.exportFooter(sheetIndex, oldPageFormat == null ? pageFormat : oldPageFormat, isIgnorePageMargins, sheetAutoFilter, currentSheetPageScale, currentSheetFirstPageNumber, false, pageIndex - sheetInfo.sheetFirstPageIndex, sheetInfo.printSettings);<NEW_LINE>firstPageNotSet = false;<NEW_LINE>} else {<NEW_LINE>Integer documentFirstPageNumber = configuration.getFirstPageNumber();<NEW_LINE>if (documentFirstPageNumber != null && documentFirstPageNumber > 0 && firstPageNotSet) {<NEW_LINE>sheetHelper.exportFooter(sheetIndex, oldPageFormat == null ? pageFormat : oldPageFormat, isIgnorePageMargins, sheetAutoFilter, currentSheetPageScale, documentFirstPageNumber, false, pageIndex - sheetInfo.sheetFirstPageIndex, sheetInfo.printSettings);<NEW_LINE>firstPageNotSet = false;<NEW_LINE>} else {<NEW_LINE>sheetHelper.exportFooter(sheetIndex, oldPageFormat == null ? pageFormat : oldPageFormat, isIgnorePageMargins, sheetAutoFilter, currentSheetPageScale, null, firstPageNotSet, pageIndex - sheetInfo.sheetFirstPageIndex, sheetInfo.printSettings);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (sheetAutoFilter != null) {<NEW_LINE>int index = Math.max(0, sheetIndex - 1);<NEW_LINE>definedNames.append("<definedName name=\"_xlnm._FilterDatabase\" localSheetId=\"" + index + "\">'" + JRStringUtil.xmlEncode(currentSheetName<MASK><NEW_LINE>}<NEW_LINE>sheetHelper.close();<NEW_LINE>sheetRelsHelper.exportFooter();<NEW_LINE>sheetRelsHelper.close();<NEW_LINE>drawingHelper.exportFooter();<NEW_LINE>drawingHelper.close();<NEW_LINE>drawingRelsHelper.exportFooter();<NEW_LINE>drawingRelsHelper.close();<NEW_LINE>}<NEW_LINE>} | ) + "'!" + sheetAutoFilter + "</definedName>\n"); |
1,613,132 | final DescribeScalingPoliciesResult executeDescribeScalingPolicies(DescribeScalingPoliciesRequest describeScalingPoliciesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeScalingPoliciesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeScalingPoliciesRequest> request = null;<NEW_LINE>Response<DescribeScalingPoliciesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeScalingPoliciesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeScalingPoliciesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Application Auto Scaling");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeScalingPolicies");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeScalingPoliciesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeScalingPoliciesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
317,679 | public void marshall(CreateLaunchRequest createLaunchRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createLaunchRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createLaunchRequest.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLaunchRequest.getGroups(), GROUPS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLaunchRequest.getMetricMonitors(), METRICMONITORS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLaunchRequest.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createLaunchRequest.getRandomizationSalt(), RANDOMIZATIONSALT_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLaunchRequest.getScheduledSplitsConfig(), SCHEDULEDSPLITSCONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLaunchRequest.getTags(), TAGS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createLaunchRequest.getProject(), PROJECT_BINDING); |
281,379 | public void doPaint(Graphics2D g) {<NEW_LINE>// Draw legend content inside legend box<NEW_LINE>double startx = xOffset + chart.getStyler().getLegendPadding();<NEW_LINE>double starty = yOffset + chart.getStyler().getLegendPadding();<NEW_LINE>Object oldHint = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);<NEW_LINE>g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);<NEW_LINE>Map<String, S> map = chart.getSeriesMap();<NEW_LINE>for (S series : map.values()) {<NEW_LINE>if (!series.isShowInLegend()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (!series.isEnabled()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Map<String, Rectangle2D> seriesTextBounds = getSeriesTextBounds(series);<NEW_LINE>float legendEntryHeight = getLegendEntryHeight(seriesTextBounds, BOX_SIZE);<NEW_LINE>// paint little circle<NEW_LINE>Shape rectSmall = new Ellipse2D.Double(startx, starty, BOX_SIZE, BOX_SIZE);<NEW_LINE>g.setColor(series.getFillColor());<NEW_LINE>g.fill(rectSmall);<NEW_LINE>g.setStroke(series.getLineStyle());<NEW_LINE>g.setColor(series.getLineColor());<NEW_LINE>g.draw(rectSmall);<NEW_LINE>// paint series text<NEW_LINE>final double x = startx + BOX_SIZE + chart.getStyler().getLegendPadding();<NEW_LINE>paintSeriesText(g, <MASK><NEW_LINE>if (chart.getStyler().getLegendLayout() == Styler.LegendLayout.Vertical) {<NEW_LINE>starty += legendEntryHeight + chart.getStyler().getLegendPadding();<NEW_LINE>} else {<NEW_LINE>int markerWidth = BOX_SIZE;<NEW_LINE>if (series.getLegendRenderType() == LegendRenderType.Line) {<NEW_LINE>markerWidth = chart.getStyler().getLegendSeriesLineLength();<NEW_LINE>}<NEW_LINE>float legendEntryWidth = getLegendEntryWidth(seriesTextBounds, markerWidth);<NEW_LINE>startx += legendEntryWidth + chart.getStyler().getLegendPadding();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldHint);<NEW_LINE>} | seriesTextBounds, BOX_SIZE, x, starty); |
257,521 | private void defineFold(String bundle, String key, Tree expr) {<NEW_LINE>final ClassPath cp = ClassPath.getClassPath(anchor, ClassPath.SOURCE);<NEW_LINE>FileObject bundleFile = cp != null ? cp.findResource(bundle + ".properties") : null;<NEW_LINE>SourcePositions spos = info.getTrees().getSourcePositions();<NEW_LINE>int start = (int) spos.getStartPosition(info.getCompilationUnit(), expr);<NEW_LINE>int end = (int) spos.getEndPosition(info.getCompilationUnit(), expr);<NEW_LINE>if (start == -1 || end == -1) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (bundleFile == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String message = proc.loader.getMessage(bundleFile, key);<NEW_LINE>if (message == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int newline = message.indexOf('\n');<NEW_LINE>if (newline >= 0) {<NEW_LINE>message = <MASK><NEW_LINE>}<NEW_LINE>message = message.replace("...", "\u2026");<NEW_LINE>FoldInfo info = FoldInfo.range(start, end, JavaFoldTypeProvider.BUNDLE_STRING).withDescription(message).attach(new ResourceStringFoldInfo(bundle, key));<NEW_LINE>proc.addFold(info, -1);<NEW_LINE>} | message.substring(0, newline); |
1,477,296 | private void createCryptoTemplate(FSRL fsrl, FSBRootNode node) {<NEW_LINE>try {<NEW_LINE>String fsContainerName = fsrl.getFS().getContainer().getName();<NEW_LINE>CryptoKeyFileTemplateWriter writer = new CryptoKeyFileTemplateWriter(fsContainerName);<NEW_LINE>if (writer.exists()) {<NEW_LINE>int answer = OptionDialog.showYesNoDialog(getTool().getActiveWindow(), "WARNING!! Crypto Key File Already Exists", "WARNING!!" + "\n" + "The crypto key file already exists. " + "Are you really sure that you want to overwrite it?");<NEW_LINE>if (answer == OptionDialog.NO_OPTION) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writer.open();<NEW_LINE>try {<NEW_LINE>// gTree.expandAll( node );<NEW_LINE>writeFile(<MASK><NEW_LINE>} finally {<NEW_LINE>writer.close();<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>FSUtilities.displayException(this, getTool().getActiveWindow(), "Error writing crypt key file", e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | writer, node.getChildren()); |
134,349 | private String doEncryption(String path, String password) throws IOException, DocumentException {<NEW_LINE>String masterpwd = mSharedPrefs.getString(MASTER_PWD_STRING, appName);<NEW_LINE>String finalOutputFile = mFileUtils.getUniqueFileName(path.replace(mContext.getString(R.string.pdf_ext), mContext.getString(R.string.encrypted_file)));<NEW_LINE><MASK><NEW_LINE>PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(finalOutputFile));<NEW_LINE>stamper.setEncryption(password.getBytes(), masterpwd.getBytes(), PdfWriter.ALLOW_PRINTING | PdfWriter.ALLOW_COPY, PdfWriter.ENCRYPTION_AES_128);<NEW_LINE>stamper.close();<NEW_LINE>reader.close();<NEW_LINE>new DatabaseHelper(mContext).insertRecord(finalOutputFile, mContext.getString(R.string.encrypted));<NEW_LINE>return finalOutputFile;<NEW_LINE>} | PdfReader reader = new PdfReader(path); |
730,006 | public void onError(java.lang.Exception e) {<NEW_LINE>byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;<NEW_LINE>org.apache.thrift.TSerializable msg;<NEW_LINE>setQueryTimeParams_result result = new setQueryTimeParams_result();<NEW_LINE>if (e instanceof QueryException) {<NEW_LINE>result.err = (QueryException) e;<NEW_LINE>result.setErrIsSet(true);<NEW_LINE>msg = result;<NEW_LINE>} else if (e instanceof org.apache.thrift.transport.TTransportException) {<NEW_LINE>_LOGGER.error("TTransportException inside handler", e);<NEW_LINE>fb.close();<NEW_LINE>return;<NEW_LINE>} else if (e instanceof org.apache.thrift.TApplicationException) {<NEW_LINE>_LOGGER.error("TApplicationException inside handler", e);<NEW_LINE>msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;<NEW_LINE>msg = (org.apache.thrift.TApplicationException) e;<NEW_LINE>} else {<NEW_LINE>_LOGGER.error("Exception inside handler", e);<NEW_LINE>msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;<NEW_LINE>msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.<MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>fcall.sendResponse(fb, msg, msgType, seqid);<NEW_LINE>} catch (java.lang.Exception ex) {<NEW_LINE>_LOGGER.error("Exception writing to internal frame buffer", ex);<NEW_LINE>fb.close();<NEW_LINE>}<NEW_LINE>} | INTERNAL_ERROR, e.getMessage()); |
245,364 | private static int countDataFiles(TOTorrent torrent, String torrent_save_dir, String torrent_save_file) {<NEW_LINE>try {<NEW_LINE>int res = 0;<NEW_LINE>LocaleUtilDecoder locale_decoder = LocaleTorrentUtil.getTorrentEncoding(torrent);<NEW_LINE>TOTorrentFile[] files = torrent.getFiles();<NEW_LINE>for (int i = 0; i < files.length; i++) {<NEW_LINE>byte[][] path_comps = files[i].getPathComponents();<NEW_LINE>File file = <MASK><NEW_LINE>for (int j = 0; j < path_comps.length; j++) {<NEW_LINE>String comp = locale_decoder.decodeString(path_comps[j]);<NEW_LINE>comp = FileUtil.convertOSSpecificChars(comp, j != path_comps.length - 1);<NEW_LINE>file = FileUtil.newFile(file, comp);<NEW_LINE>}<NEW_LINE>file = file.getCanonicalFile();<NEW_LINE>File linked_file = FMFileManagerFactory.getSingleton().getFileLink(torrent, i, file);<NEW_LINE>boolean skip = false;<NEW_LINE>if (linked_file != file) {<NEW_LINE>if (!linked_file.getCanonicalPath().startsWith(FileUtil.newFile(torrent_save_dir).getCanonicalPath())) {<NEW_LINE>skip = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!skip && file.exists() && !file.isDirectory()) {<NEW_LINE>res++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return (res);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>Debug.printStackTrace(e);<NEW_LINE>return (-1);<NEW_LINE>}<NEW_LINE>} | FileUtil.newFile(torrent_save_dir, torrent_save_file); |
444,304 | public static DescribeAffectedMaliciousFileImagesResponse unmarshall(DescribeAffectedMaliciousFileImagesResponse describeAffectedMaliciousFileImagesResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeAffectedMaliciousFileImagesResponse.setRequestId(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.RequestId"));<NEW_LINE>PageInfo pageInfo = new PageInfo();<NEW_LINE>pageInfo.setCount(_ctx.integerValue("DescribeAffectedMaliciousFileImagesResponse.PageInfo.Count"));<NEW_LINE>pageInfo.setPageSize(_ctx.integerValue("DescribeAffectedMaliciousFileImagesResponse.PageInfo.PageSize"));<NEW_LINE>pageInfo.setTotalCount(_ctx.integerValue("DescribeAffectedMaliciousFileImagesResponse.PageInfo.TotalCount"));<NEW_LINE>pageInfo.setCurrentPage(_ctx.integerValue("DescribeAffectedMaliciousFileImagesResponse.PageInfo.CurrentPage"));<NEW_LINE>describeAffectedMaliciousFileImagesResponse.setPageInfo(pageInfo);<NEW_LINE>List<AffectedMaliciousFileImage> affectedMaliciousFileImagesResponse = new ArrayList<AffectedMaliciousFileImage>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse.Length"); i++) {<NEW_LINE>AffectedMaliciousFileImage affectedMaliciousFileImage = new AffectedMaliciousFileImage();<NEW_LINE>affectedMaliciousFileImage.setLayer(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].Layer"));<NEW_LINE>affectedMaliciousFileImage.setFirstScanTimestamp(_ctx.longValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].FirstScanTimestamp"));<NEW_LINE>affectedMaliciousFileImage.setLatestScanTimestamp(_ctx.longValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].LatestScanTimestamp"));<NEW_LINE>affectedMaliciousFileImage.setLatestVerifyTimestamp(_ctx.longValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].LatestVerifyTimestamp"));<NEW_LINE>affectedMaliciousFileImage.setMaliciousMd5(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].MaliciousMd5"));<NEW_LINE>affectedMaliciousFileImage.setStatus(_ctx.integerValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].Status"));<NEW_LINE>affectedMaliciousFileImage.setLevel(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].Level"));<NEW_LINE>affectedMaliciousFileImage.setImageUuid(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].ImageUuid"));<NEW_LINE>affectedMaliciousFileImage.setFilePath(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].FilePath"));<NEW_LINE>affectedMaliciousFileImage.setDigest(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].Digest"));<NEW_LINE>affectedMaliciousFileImage.setRepoRegionId(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].RepoRegionId"));<NEW_LINE>affectedMaliciousFileImage.setRepoInstanceId(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].RepoInstanceId"));<NEW_LINE>affectedMaliciousFileImage.setRepoId(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].RepoId"));<NEW_LINE>affectedMaliciousFileImage.setRepoName(_ctx.stringValue<MASK><NEW_LINE>affectedMaliciousFileImage.setNamespace(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].Namespace"));<NEW_LINE>affectedMaliciousFileImage.setTag(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].Tag"));<NEW_LINE>affectedMaliciousFileImagesResponse.add(affectedMaliciousFileImage);<NEW_LINE>}<NEW_LINE>describeAffectedMaliciousFileImagesResponse.setAffectedMaliciousFileImagesResponse(affectedMaliciousFileImagesResponse);<NEW_LINE>return describeAffectedMaliciousFileImagesResponse;<NEW_LINE>} | ("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].RepoName")); |
1,761,018 | public JsonResult execute() throws InvalidHttpRequestBodyException, InvalidOperationException {<NEW_LINE>CourseCreateRequest <MASK><NEW_LINE>String newCourseTimeZone = courseCreateRequest.getTimeZone();<NEW_LINE>String timeZoneErrorMessage = FieldValidator.getInvalidityInfoForTimeZone(newCourseTimeZone);<NEW_LINE>if (!timeZoneErrorMessage.isEmpty()) {<NEW_LINE>throw new InvalidHttpRequestBodyException(timeZoneErrorMessage);<NEW_LINE>}<NEW_LINE>String newCourseId = courseCreateRequest.getCourseId();<NEW_LINE>String newCourseName = courseCreateRequest.getCourseName();<NEW_LINE>String institute = Const.UNKNOWN_INSTITUTION;<NEW_LINE>AccountAttributes account = logic.getAccount(userInfo.getId());<NEW_LINE>if (account != null && !StringHelper.isEmpty(account.getInstitute())) {<NEW_LINE>institute = account.getInstitute();<NEW_LINE>}<NEW_LINE>CourseAttributes courseAttributes = CourseAttributes.builder(newCourseId).withName(newCourseName).withTimezone(newCourseTimeZone).withInstitute(institute).build();<NEW_LINE>try {<NEW_LINE>logic.createCourseAndInstructor(userInfo.getId(), courseAttributes);<NEW_LINE>InstructorAttributes instructorCreatedForCourse = logic.getInstructorForGoogleId(newCourseId, userInfo.getId());<NEW_LINE>taskQueuer.scheduleInstructorForSearchIndexing(instructorCreatedForCourse.getCourseId(), instructorCreatedForCourse.getEmail());<NEW_LINE>} catch (EntityAlreadyExistsException e) {<NEW_LINE>throw new InvalidOperationException("The course ID " + courseAttributes.getId() + " has been used by another course, possibly by some other user." + " Please try again with a different course ID.", e);<NEW_LINE>} catch (InvalidParametersException e) {<NEW_LINE>throw new InvalidHttpRequestBodyException(e);<NEW_LINE>}<NEW_LINE>return new JsonResult(new CourseData(logic.getCourse(newCourseId)));<NEW_LINE>} | courseCreateRequest = getAndValidateRequestBody(CourseCreateRequest.class); |
652,941 | public void fill(ToolBar parent, int index) {<NEW_LINE>if (widget != null || parent == null)<NEW_LINE>return;<NEW_LINE>ToolItem ti = new ToolItem(parent, style, index);<NEW_LINE>if (image != null) {<NEW_LINE>ti.setImage(image.image());<NEW_LINE>}<NEW_LINE>if (image == null || style == SWT.DROP_DOWN || style == SWT.PUSH) {<NEW_LINE>ti.setText(TextUtil.tooltip(label));<NEW_LINE>}<NEW_LINE>ti.setToolTipText(toolTip != null ? toolTip : label);<NEW_LINE>ti.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {<NEW_LINE>if (e.detail == SWT.ARROW || defaultAction == null) {<NEW_LINE>ToolItem <MASK><NEW_LINE>Rectangle rect = item.getBounds();<NEW_LINE>Point pt = item.getParent().toDisplay(new Point(rect.x, rect.y));<NEW_LINE>// $NON-NLS-1$<NEW_LINE>MenuManager menuMgr = new MenuManager("#PopupMenu");<NEW_LINE>menuMgr.setRemoveAllWhenShown(true);<NEW_LINE>menuMgr.addMenuListener(menuListener);<NEW_LINE>Menu menu = menuMgr.createContextMenu(item.getParent());<NEW_LINE>menu.setLocation(pt.x, pt.y + rect.height);<NEW_LINE>menu.setVisible(true);<NEW_LINE>item.addDisposeListener(event -> menu.dispose());<NEW_LINE>} else {<NEW_LINE>defaultAction.run();<NEW_LINE>}<NEW_LINE>}));<NEW_LINE>ti.addDisposeListener(e -> disposeListeners.forEach(l -> l.widgetDisposed(e)));<NEW_LINE>widget = ti;<NEW_LINE>} | item = (ToolItem) e.widget; |
92,568 | public void testCallerIdentityPropagationFailureForMultipleCPCScheduleWork(HttpServletRequest request, HttpServletResponse response) throws Throwable {<NEW_LINE>System.out.println("Begin testCallerIdentityPropagationFailureForMultipleCPCScheduleWork");<NEW_LINE>InitialContext ctx = new InitialContext();<NEW_LINE>String callerIdentity = CALLER1;<NEW_LINE>try {<NEW_LINE>SampleSessionLocal local = (SampleSessionLocal) ctx.lookup("java:comp/env/ejb/SampleSessionBean");<NEW_LINE>WorkInformation wi = new WorkInformation();<NEW_LINE>wi.setCallbacks(new String[] { WorkInformation.CALLERPRINCIPALCALLBACK, WorkInformation.CALLERPRINCIPALCALLBACK });<NEW_LINE>wi.setCalleridentity(callerIdentity);<NEW_LINE>String deliveryId = "delivery3scw";<NEW_LINE>String messageText = "testCallerIdentityPropagationFailureForMultipleCPCScheduleWork";<NEW_LINE>int state = WorkEvent.WORK_COMPLETED;<NEW_LINE>int waitTime = 75000;<NEW_LINE>Xid xid = null;<NEW_LINE>int workExecutionType = FVTMessageProvider.SCHEDULE_WORK;<NEW_LINE>MessageEndpointTestResultsImpl testResults = local.sendMessage(deliveryId, messageText, state, waitTime, xid, workExecutionType, wi);<NEW_LINE>throw new Exception("A WorkCompletedException is not thrown when multiple CallerPrincipalCallbacks are provided to the CallbackHandler.");<NEW_LINE>} catch (WorkCompletedException ex) {<NEW_LINE><MASK><NEW_LINE>return;<NEW_LINE>} finally {<NEW_LINE>System.out.println("End testCallerIdentityPropagationFailureForMultipleCPCScheduleWork");<NEW_LINE>}<NEW_LINE>} | System.out.println("Test Passed: A WorkCompletedException was thrown because an error occurred during security context setup"); |
236,389 | public long[][] queryProcessorCpuLoadTicks() {<NEW_LINE>perfstat_cpu_t[] cpu = cpuProc.get();<NEW_LINE>long[][] ticks = new long[cpu.length][TickType.values().length];<NEW_LINE>for (int i = 0; i < cpu.length; i++) {<NEW_LINE>ticks[i] = new long[TickType.values().length];<NEW_LINE>ticks[i][TickType.USER.ordinal()] = cpu[i].user * 1000L / USER_HZ;<NEW_LINE>// Skip NICE<NEW_LINE>ticks[i][TickType.SYSTEM.ordinal()] = cpu[i].sys * 1000L / USER_HZ;<NEW_LINE>ticks[i][TickType.IDLE.ordinal()] = cpu[i].idle * 1000L / USER_HZ;<NEW_LINE>ticks[i][TickType.IOWAIT.ordinal()] = cpu[i].wait * 1000L / USER_HZ;<NEW_LINE>ticks[i][TickType.IRQ.ordinal()] = cpu[i].devintrs * 1000L / USER_HZ;<NEW_LINE>ticks[i][TickType.SOFTIRQ.ordinal()] = cpu[i].softintrs * 1000L / USER_HZ;<NEW_LINE>ticks[i][TickType.STEAL.ordinal()] = (cpu[i].idle_stolen_purr + cpu[i<MASK><NEW_LINE>}<NEW_LINE>return ticks;<NEW_LINE>} | ].busy_stolen_purr) * 1000L / USER_HZ; |
676,957 | public Credentials unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>Credentials credentials = new Credentials();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("accessKeyId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>credentials.setAccessKeyId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("secretAccessKey", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>credentials.setSecretAccessKey(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("sessionToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>credentials.setSessionToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return credentials;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
976,982 | static Map<String, UserAgentParser> createUserAgentParsers(Path userAgentConfigDirectory, UserAgentCache cache) throws IOException {<NEW_LINE>Map<String, UserAgentParser> userAgentParsers = new HashMap<>();<NEW_LINE>UserAgentParser defaultParser = new UserAgentParser(DEFAULT_PARSER_NAME, IngestUserAgentPlugin.class.getResourceAsStream("/regexes.yml"), cache);<NEW_LINE>userAgentParsers.put(DEFAULT_PARSER_NAME, defaultParser);<NEW_LINE>if (Files.exists(userAgentConfigDirectory) && Files.isDirectory(userAgentConfigDirectory)) {<NEW_LINE>PathMatcher pathMatcher = userAgentConfigDirectory.<MASK><NEW_LINE>try (Stream<Path> regexFiles = Files.find(userAgentConfigDirectory, 1, (path, attr) -> attr.isRegularFile() && pathMatcher.matches(path))) {<NEW_LINE>Iterable<Path> iterable = regexFiles::iterator;<NEW_LINE>for (Path path : iterable) {<NEW_LINE>String parserName = path.getFileName().toString();<NEW_LINE>try (InputStream regexStream = Files.newInputStream(path, StandardOpenOption.READ)) {<NEW_LINE>userAgentParsers.put(parserName, new UserAgentParser(parserName, regexStream, cache));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Collections.unmodifiableMap(userAgentParsers);<NEW_LINE>} | getFileSystem().getPathMatcher("glob:**.yml"); |
387,561 | final ListAnomalyGroupRelatedMetricsResult executeListAnomalyGroupRelatedMetrics(ListAnomalyGroupRelatedMetricsRequest listAnomalyGroupRelatedMetricsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listAnomalyGroupRelatedMetricsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListAnomalyGroupRelatedMetricsRequest> request = null;<NEW_LINE>Response<ListAnomalyGroupRelatedMetricsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListAnomalyGroupRelatedMetricsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listAnomalyGroupRelatedMetricsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "LookoutMetrics");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListAnomalyGroupRelatedMetrics");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListAnomalyGroupRelatedMetricsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListAnomalyGroupRelatedMetricsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
850,823 | public final VarExprList rewrite(VarExprList lst) {<NEW_LINE>VarExprList retval = new VarExprList();<NEW_LINE>for (Var v : lst.getVars()) {<NEW_LINE>Node n = values.get(v);<NEW_LINE>if (n != null) {<NEW_LINE>if (n.isVariable()) {<NEW_LINE>retval.add(Var.alloc(n));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>retval.add(v);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Map.Entry<Var, Expr> entry : lst.getExprs().entrySet()) {<NEW_LINE>Expr target = ExprLib.nodeToExpr(entry.getKey());<NEW_LINE>Node n = values.get(entry.getKey());<NEW_LINE>Var v = entry.getKey();<NEW_LINE>Expr e = entry.getValue();<NEW_LINE>if (n != null) {<NEW_LINE>if (n.isVariable()) {<NEW_LINE>v = Var.alloc(n);<NEW_LINE>if (target.equals(e)) {<NEW_LINE>e = ExprLib.nodeToExpr(n);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>v = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (v != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return retval;<NEW_LINE>} | retval.add(v, e); |
1,783,782 | private void categorizeNote() {<NEW_LINE>String currentCategory = noteTmp.getCategory() != null ? String.valueOf(noteTmp.getCategory(<MASK><NEW_LINE>final List<Category> categories = Observable.from(DbHelper.getInstance().getCategories()).map(category -> {<NEW_LINE>if (String.valueOf(category.getId()).equals(currentCategory)) {<NEW_LINE>category.setCount(category.getCount() + 1);<NEW_LINE>}<NEW_LINE>return category;<NEW_LINE>}).toList().toBlocking().single();<NEW_LINE>final MaterialDialog dialog = new MaterialDialog.Builder(mainActivity).title(R.string.categorize_as).adapter(new CategoryRecyclerViewAdapter(mainActivity, categories), null).positiveText(R.string.add_category).positiveColorRes(R.color.colorPrimary).negativeText(R.string.remove_category).negativeColorRes(R.color.colorAccent).onPositive((dialog1, which) -> {<NEW_LINE>Intent intent = new Intent(mainActivity, CategoryActivity.class);<NEW_LINE>intent.putExtra("noHome", true);<NEW_LINE>startActivityForResult(intent, CATEGORY);<NEW_LINE>}).onNegative((dialog12, which) -> {<NEW_LINE>noteTmp.setCategory(null);<NEW_LINE>setTagMarkerColor(null);<NEW_LINE>}).build();<NEW_LINE>RecyclerViewItemClickSupport.addTo(dialog.getRecyclerView()).setOnItemClickListener((recyclerView, position, v) -> {<NEW_LINE>noteTmp.setCategory(categories.get(position));<NEW_LINE>setTagMarkerColor(categories.get(position));<NEW_LINE>dialog.dismiss();<NEW_LINE>});<NEW_LINE>dialog.show();<NEW_LINE>} | ).getId()) : null; |
9,787 | private void initServerPreFragment(Bundle savedInstanceState) {<NEW_LINE>// step 1 - load and process relevant inputs (resources, intent, savedInstanceState)<NEW_LINE>if (savedInstanceState == null) {<NEW_LINE>if (mAccount != null) {<NEW_LINE>String baseUrl = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_BASE_URL);<NEW_LINE>if (TextUtils.isEmpty(baseUrl)) {<NEW_LINE>mServerInfo.mBaseUrl = "";<NEW_LINE>} else {<NEW_LINE>mServerInfo.mBaseUrl = baseUrl;<NEW_LINE>}<NEW_LINE>// TODO do next in a setter for mBaseUrl<NEW_LINE>mServerInfo.mIsSslConn = <MASK><NEW_LINE>mServerInfo.mVersion = accountManager.getServerVersion(mAccount);<NEW_LINE>} else {<NEW_LINE>mServerInfo.mBaseUrl = getString(R.string.webview_login_url).trim();<NEW_LINE>mServerInfo.mIsSslConn = mServerInfo.mBaseUrl.startsWith(HTTPS_PROTOCOL);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>mServerStatusText = savedInstanceState.getString(KEY_SERVER_STATUS_TEXT);<NEW_LINE>mServerStatusIcon = savedInstanceState.getInt(KEY_SERVER_STATUS_ICON);<NEW_LINE>// TODO parcelable<NEW_LINE>mServerInfo.mIsSslConn = savedInstanceState.getBoolean(KEY_IS_SSL_CONN);<NEW_LINE>mServerInfo.mBaseUrl = savedInstanceState.getString(KEY_HOST_URL_TEXT);<NEW_LINE>String ocVersion = savedInstanceState.getString(KEY_OC_VERSION);<NEW_LINE>if (ocVersion != null) {<NEW_LINE>mServerInfo.mVersion = new OwnCloudVersion(ocVersion);<NEW_LINE>}<NEW_LINE>mServerInfo.mAuthMethod = AuthenticationMethod.valueOf(savedInstanceState.getString(KEY_SERVER_AUTH_METHOD));<NEW_LINE>}<NEW_LINE>} | mServerInfo.mBaseUrl.startsWith(HTTPS_PROTOCOL); |
1,817,228 | protected void initNode(MNode result) {<NEW_LINE>MBool renderable = (MBool) result.getAttr("rnd");<NEW_LINE>renderable.set(true);<NEW_LINE>MInt filmFit = (MInt) result.getAttr("ff");<NEW_LINE>// horizontal fit<NEW_LINE>filmFit.set(1);<NEW_LINE>MFloat centerOfInterest = (MFloat) result.getAttr("coi");<NEW_LINE>centerOfInterest.set(5.0f);<NEW_LINE>MFloat focalLength = (MFloat) result.getAttr("fl");<NEW_LINE>focalLength.set(35.0f);<NEW_LINE>MFloat orthographicWidth = (<MASK><NEW_LINE>orthographicWidth.set(10.0f);<NEW_LINE>MFloat2 cameraAperture = (MFloat2) result.getAttr("cap");<NEW_LINE>cameraAperture.set(3.6f, 2.4f);<NEW_LINE>MFloat lensSqueezeRatio = (MFloat) result.getAttr("lsr");<NEW_LINE>lensSqueezeRatio.set(1.0f);<NEW_LINE>MFloat f = (MFloat) result.getAttr("fcp");<NEW_LINE>f.set(1000);<NEW_LINE>f = (MFloat) result.getAttr("ncp");<NEW_LINE>f.set(.1f);<NEW_LINE>} | MFloat) result.getAttr("ow"); |
1,260,321 | public void run(RegressionEnvironment env) {<NEW_LINE>String[] fields = "c0,c1".split(",");<NEW_LINE>String epl = "@name('s0') select value in (select sum(intPrimitive) from SupportBean#keepall) as c0," + "value not in (select sum(intPrimitive) from SupportBean#keepall) as c1 " + "from SupportValueEvent";<NEW_LINE>env.compileDeployAddListenerMileZero(epl, "s0");<NEW_LINE>sendVEAndAssert(env, fields, 10, new Object<MASK><NEW_LINE>env.sendEventBean(new SupportBean("E1", 10));<NEW_LINE>sendVEAndAssert(env, fields, 10, new Object[] { true, false });<NEW_LINE>env.sendEventBean(new SupportBean("E2", 1));<NEW_LINE>sendVEAndAssert(env, fields, 10, new Object[] { false, true });<NEW_LINE>env.sendEventBean(new SupportBean("E3", -1));<NEW_LINE>sendVEAndAssert(env, fields, 10, new Object[] { true, false });<NEW_LINE>env.undeployAll();<NEW_LINE>} | [] { null, null }); |
827,237 | private Authorization toEntity(OAuth2Authorization authorization) {<NEW_LINE>Authorization entity = new Authorization();<NEW_LINE>entity.setId(authorization.getId());<NEW_LINE>entity.setRegisteredClientId(authorization.getRegisteredClientId());<NEW_LINE>entity.setPrincipalName(authorization.getPrincipalName());<NEW_LINE>entity.setAuthorizationGrantType(authorization.getAuthorizationGrantType().getValue());<NEW_LINE>entity.setAttributes(writeMap(authorization.getAttributes()));<NEW_LINE>entity.setState(authorization.getAttribute(OAuth2ParameterNames.STATE));<NEW_LINE>OAuth2Authorization.Token<OAuth2AuthorizationCode> authorizationCode = authorization.getToken(OAuth2AuthorizationCode.class);<NEW_LINE>setTokenValues(authorizationCode, entity::setAuthorizationCodeValue, entity::setAuthorizationCodeIssuedAt, entity::setAuthorizationCodeExpiresAt, entity::setAuthorizationCodeMetadata);<NEW_LINE>OAuth2Authorization.Token<OAuth2AccessToken> accessToken = authorization.getToken(OAuth2AccessToken.class);<NEW_LINE>setTokenValues(accessToken, entity::setAccessTokenValue, entity::setAccessTokenIssuedAt, entity::setAccessTokenExpiresAt, entity::setAccessTokenMetadata);<NEW_LINE>if (accessToken != null && accessToken.getToken().getScopes() != null) {<NEW_LINE>entity.setAccessTokenScopes(StringUtils.collectionToDelimitedString(accessToken.getToken().getScopes(), ","));<NEW_LINE>}<NEW_LINE>OAuth2Authorization.Token<OAuth2RefreshToken> refreshToken = <MASK><NEW_LINE>setTokenValues(refreshToken, entity::setRefreshTokenValue, entity::setRefreshTokenIssuedAt, entity::setRefreshTokenExpiresAt, entity::setRefreshTokenMetadata);<NEW_LINE>OAuth2Authorization.Token<OidcIdToken> oidcIdToken = authorization.getToken(OidcIdToken.class);<NEW_LINE>setTokenValues(oidcIdToken, entity::setOidcIdTokenValue, entity::setOidcIdTokenIssuedAt, entity::setOidcIdTokenExpiresAt, entity::setOidcIdTokenMetadata);<NEW_LINE>if (oidcIdToken != null) {<NEW_LINE>entity.setOidcIdTokenClaims(writeMap(oidcIdToken.getClaims()));<NEW_LINE>}<NEW_LINE>return entity;<NEW_LINE>} | authorization.getToken(OAuth2RefreshToken.class); |
1,049,597 | public static int totalPaths(int m, int n) {<NEW_LINE>int[][] total = new int[100][100];<NEW_LINE>for (int i = 0; i < m; i++) {<NEW_LINE>for (int j = 0; j < n; j++) {<NEW_LINE>total<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>int mx = (m > n) ? (m) : (n);<NEW_LINE>for (int i = 0; i < mx; i++) {<NEW_LINE>if (i < m) {<NEW_LINE>total[i][0] = 1;<NEW_LINE>}<NEW_LINE>if (i < n) {<NEW_LINE>total[0][i] = 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int i = 1; i < m; i++) {<NEW_LINE>for (int j = 1; j < n; j++) {<NEW_LINE>total[i][j] = total[i - 1][j] + total[i][j - 1];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return total[m - 1][n - 1];<NEW_LINE>} | [i][j] = 0; |
1,190,728 | public Product loadFromDom(final Element element) throws InitializationException {<NEW_LINE>super.loadFromDom(element);<NEW_LINE>Element child;<NEW_LINE>try {<NEW_LINE>version = Version.getVersion(element.getAttribute(VERSION_TAG_NAME));<NEW_LINE>supportedPlatforms = StringUtils.parsePlatforms(element.getAttribute(PLATFORMS_TAG_NAME));<NEW_LINE>initialStatus = StringUtils.parseStatus(element.getAttribute(STATUS_TAG_NAME));<NEW_LINE>currentStatus = initialStatus;<NEW_LINE>features = StringUtils.asList(element.getAttribute(FEATURES_TAG_NAME), StringUtils.SPACE);<NEW_LINE>logicUris.addAll(XMLUtils.parseExtendedUrisList(XMLUtils.getChild(element, CONFIGURATION_LOGIC_TAG_NAME)));<NEW_LINE>dataUris.addAll(XMLUtils.parseExtendedUrisList(XMLUtils.getChild(element, INSTALLATION_DATA_TAG_NAME)));<NEW_LINE>requiredDiskSpace = Long.parseLong(XMLUtils.getChild(element, SYSTEM_REQUIREMENTS_TAG_NAME + "/" + DISK_SPACE_TAG_NAME).getTextContent());<NEW_LINE>child = XMLUtils.getChild(element, DEPENDENCIES_TAG_NAME);<NEW_LINE>if (child != null) {<NEW_LINE>dependencies.addAll<MASK><NEW_LINE>}<NEW_LINE>} catch (ParseException e) {<NEW_LINE>throw new InitializationException(ResourceUtils.getString(Product.class, ERROR_CANNOT_LOAD_PRODUCT_KEY, getDisplayName()), e);<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | (XMLUtils.parseDependencies(child)); |
1,094,458 | public void createTableIfNotExist() {<NEW_LINE>if (!canWrite()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Connection conn = null;<NEW_LINE>PreparedStatement ps = null;<NEW_LINE>PreparedStatement psAlterTopN = null;<NEW_LINE>PreparedStatement psAlterCharSet = null;<NEW_LINE>try {<NEW_LINE>conn = MetaDbDataSource.getInstance().getDataSource().getConnection();<NEW_LINE>ps = conn.prepareStatement(CREATE_TABLE_IF_NOT_EXIST_SQL);<NEW_LINE>ps.executeUpdate();<NEW_LINE>psAlterCharSet = conn.prepareStatement(ALTER_TABLE_UTF8MB4);<NEW_LINE>psAlterCharSet.executeUpdate();<NEW_LINE>psAlterTopN = conn.prepareStatement(ALTER_TABLE_TOPN);<NEW_LINE>psAlterTopN.executeUpdate();<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (!e.getMessage().contains("Duplicate column name")) {<NEW_LINE>logger.error(<MASK><NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>JdbcUtils.close(ps);<NEW_LINE>JdbcUtils.close(psAlterTopN);<NEW_LINE>JdbcUtils.close(psAlterCharSet);<NEW_LINE>JdbcUtils.close(conn);<NEW_LINE>}<NEW_LINE>} | "create " + TABLE_NAME + " if not exist error", e); |
455,005 | public Exception mapException(RemoteException ex, int minorCode) {<NEW_LINE>String detail = ex.toString();<NEW_LINE>SystemException sysex;<NEW_LINE>// If minor code is specified, completion status must be also.<NEW_LINE>// the default completion status for the exception type is used.<NEW_LINE>if (ex instanceof NoSuchObjectException) {<NEW_LINE>sysex = new OBJECT_NOT_EXIST(detail, minorCode, CompletionStatus.COMPLETED_NO);<NEW_LINE>} else if (ex instanceof TransactionRequiredException) {<NEW_LINE>sysex = new TRANSACTION_REQUIRED(detail, minorCode, CompletionStatus.COMPLETED_NO);<NEW_LINE>} else if (ex instanceof TransactionRolledbackException) {<NEW_LINE>sysex = new TRANSACTION_ROLLEDBACK(detail, minorCode, CompletionStatus.COMPLETED_NO);<NEW_LINE>} else if (ex instanceof InvalidTransactionException) {<NEW_LINE>sysex = new INVALID_TRANSACTION(detail, minorCode, CompletionStatus.COMPLETED_MAYBE);<NEW_LINE>} else if (ex instanceof AccessException) {<NEW_LINE>sysex = new NO_PERMISSION(detail, minorCode, CompletionStatus.COMPLETED_NO);<NEW_LINE>} else {<NEW_LINE>return new UnknownException(ex);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>return sysex;<NEW_LINE>} | sysex.initCause(ex.detail); |
1,220,429 | public static HookInfoPatch toInnerForUpdate(ClientLogger logger, NotificationHook notificationHook) {<NEW_LINE>if (notificationHook instanceof EmailNotificationHook) {<NEW_LINE>EmailNotificationHook emailHook = (EmailNotificationHook) notificationHook;<NEW_LINE>EmailHookInfoPatch innerEmailHook = new EmailHookInfoPatch();<NEW_LINE>innerEmailHook.setHookName(emailHook.getName());<NEW_LINE>innerEmailHook.setDescription(emailHook.getDescription());<NEW_LINE>innerEmailHook.setExternalLink(emailHook.getExternalLink());<NEW_LINE>List<String> emailsToAlert = HookHelper.getEmailsToAlertRaw(emailHook);<NEW_LINE>if (emailsToAlert != null) {<NEW_LINE>innerEmailHook.setHookParameter(new EmailHookParameterPatch().setToList(emailsToAlert));<NEW_LINE>}<NEW_LINE>innerEmailHook.setAdmins(HookHelper.getAdminsRaw(emailHook));<NEW_LINE>return innerEmailHook;<NEW_LINE>} else if (notificationHook instanceof WebNotificationHook) {<NEW_LINE>WebNotificationHook webHook = (WebNotificationHook) notificationHook;<NEW_LINE>WebhookHookInfoPatch innerWebHook = new WebhookHookInfoPatch();<NEW_LINE>innerWebHook.setHookName(webHook.getName());<NEW_LINE>innerWebHook.<MASK><NEW_LINE>innerWebHook.setExternalLink(webHook.getExternalLink());<NEW_LINE>WebhookHookParameterPatch hookParameter = new WebhookHookParameterPatch().setEndpoint(webHook.getEndpoint()).setUsername(webHook.getUsername()).setPassword(webHook.getPassword()).setCertificateKey(webHook.getClientCertificate()).setCertificatePassword(webHook.getClientCertificatePassword());<NEW_LINE>HttpHeaders headers = HookHelper.getHttpHeadersRaw(webHook);<NEW_LINE>if (headers != null) {<NEW_LINE>hookParameter.setHeaders(headers.toMap());<NEW_LINE>}<NEW_LINE>innerWebHook.setHookParameter(hookParameter);<NEW_LINE>innerWebHook.setAdmins(HookHelper.getAdminsRaw(webHook));<NEW_LINE>return innerWebHook;<NEW_LINE>} else {<NEW_LINE>throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The notificationHook type %s not supported", notificationHook.getClass().getCanonicalName())));<NEW_LINE>}<NEW_LINE>} | setDescription(webHook.getDescription()); |
613,433 | @PostMapping(value = "/users", produces = "application/json")<NEW_LINE>public UserResponse createUser(@RequestBody UserRequest userRequest, HttpServletRequest request, HttpServletResponse response) {<NEW_LINE>if (userRequest.getId() == null) {<NEW_LINE>throw new FlowableIllegalArgumentException("Id cannot be null.");<NEW_LINE>}<NEW_LINE>// Check if a user with the given ID already exists so we return a CONFLICT<NEW_LINE>if (identityService.createUserQuery().userId(userRequest.getId()).count() > 0) {<NEW_LINE>throw new FlowableConflictException("A user with id '" + userRequest.getId() + "' already exists.");<NEW_LINE>}<NEW_LINE>User created = identityService.newUser(userRequest.getId());<NEW_LINE>created.setEmail(userRequest.getEmail());<NEW_LINE>created.setFirstName(userRequest.getFirstName());<NEW_LINE>created.setLastName(userRequest.getLastName());<NEW_LINE>created.setDisplayName(userRequest.getDisplayName());<NEW_LINE>created.setPassword(userRequest.getPassword());<NEW_LINE>if (restApiInterceptor != null) {<NEW_LINE>restApiInterceptor.createNewUser(created);<NEW_LINE>}<NEW_LINE>identityService.saveUser(created);<NEW_LINE>response.setStatus(<MASK><NEW_LINE>return idmRestResponseFactory.createUserResponse(created, false);<NEW_LINE>} | HttpStatus.CREATED.value()); |
1,444,895 | public void testBMTNonXAOptionB() throws Exception {<NEW_LINE>String deliveryID = "MD_test6d";<NEW_LINE>prepareTRA();<NEW_LINE>// construct a FVTMessage<NEW_LINE>FVTMessage message = new FVTMessage();<NEW_LINE>message.addTestResult("BMTJMS");<NEW_LINE>// Add a option B transacted delivery to another instance.<NEW_LINE>Method m = javax.jms.MessageListener.class.getMethod("onMessage", new Class[] { Message.class });<NEW_LINE>message.addDelivery("BMTJMS", FVTMessage.BEFORE_DELIVERY, m);<NEW_LINE>message.add("BMTJMS", "message1", m);<NEW_LINE>message.addDelivery("BMTJMS", FVTMessage.AFTER_DELIVERY, null);<NEW_LINE>message.addDelivery("BMTJMS", FVTMessage.BEFORE_DELIVERY, m);<NEW_LINE>message.<MASK><NEW_LINE>message.addDelivery("BMTJMS", FVTMessage.AFTER_DELIVERY, null);<NEW_LINE>System.out.println(message.toString());<NEW_LINE>baseProvider.sendDirectMessage(deliveryID, message);<NEW_LINE>MessageEndpointTestResults results = baseProvider.getTestResult(deliveryID);<NEW_LINE>assertTrue("isDeliveryTransacted returns false for a method in a BMT MDB.", !results.isDeliveryTransacted());<NEW_LINE>assertTrue("Number of messages delivered is 2", results.getNumberOfMessagesDelivered() == 2);<NEW_LINE>assertTrue("Delivery option B is used for this test.", results.optionBMessageDeliveryUsed());<NEW_LINE>// assertTrue("This message delivery is in a local transaction context.", results.mdbInvokedInLocalTransactionContext());<NEW_LINE>assertFalse("The commit should not be driven on the XAResource provided by TRA.", results.raXaResourceCommitWasDriven());<NEW_LINE>assertFalse("The RA XAResource should not be enlisted in the global transaction.", results.raXaResourceEnlisted());<NEW_LINE>baseProvider.releaseDeliveryId(deliveryID);<NEW_LINE>} | add("BMTJMS", "message2", m); |
822,088 | public void onClick(View v) {<NEW_LINE>if (mTestDataItemList.size() < 1) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int parentNumber = mTestDataItemList.size() - 1;<NEW_LINE>HorizontalParent horizontalParent = mTestDataItemList.get(parentNumber);<NEW_LINE>HorizontalParent newHorizontalParent = new HorizontalParent();<NEW_LINE>newHorizontalParent.setParentText(getString(R.string.modified_parent_text, parentNumber));<NEW_LINE>newHorizontalParent.setParentNumber(parentNumber);<NEW_LINE>int childSize = horizontalParent.getChildList().size();<NEW_LINE>List<HorizontalChild> childItemList = new ArrayList<>();<NEW_LINE>for (int i = 0; i < childSize; i++) {<NEW_LINE>HorizontalChild horizontalChild = new HorizontalChild();<NEW_LINE>horizontalChild.setChildText(getString(R.string.modified_child_text, i));<NEW_LINE>childItemList.add(horizontalChild);<NEW_LINE>}<NEW_LINE>newHorizontalParent.setChildItemList(childItemList);<NEW_LINE>mTestDataItemList.set(parentNumber, newHorizontalParent);<NEW_LINE>if (mTestDataItemList.size() < 2) {<NEW_LINE>mExpandableAdapter.notifyParentChanged(parentNumber);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>parentNumber = mTestDataItemList.size() - 2;<NEW_LINE>horizontalParent = mTestDataItemList.get(parentNumber);<NEW_LINE>newHorizontalParent = new HorizontalParent();<NEW_LINE>newHorizontalParent.setParentText(getString(R<MASK><NEW_LINE>newHorizontalParent.setParentNumber(parentNumber);<NEW_LINE>childSize = horizontalParent.getChildList().size();<NEW_LINE>childItemList = new ArrayList<>();<NEW_LINE>for (int i = 0; i < childSize; i++) {<NEW_LINE>HorizontalChild horizontalChild = new HorizontalChild();<NEW_LINE>horizontalChild.setChildText(getString(R.string.modified_child_text, i));<NEW_LINE>childItemList.add(horizontalChild);<NEW_LINE>}<NEW_LINE>newHorizontalParent.setChildItemList(childItemList);<NEW_LINE>mTestDataItemList.set(parentNumber, newHorizontalParent);<NEW_LINE>mExpandableAdapter.notifyParentRangeChanged(parentNumber, 2);<NEW_LINE>} | .string.modified_parent_text, parentNumber)); |
1,465,482 | private void checkPalette() {<NEW_LINE>if (palette == null || palette.length < 2 || palette[0].length < 2 || palette[1].length < 2) {<NEW_LINE>LOG.info("Will use default palette");<NEW_LINE>palette = getDefaultPalette(colorizationType);<NEW_LINE>}<NEW_LINE>double min;<NEW_LINE>double max = min <MASK><NEW_LINE>int minIndex = 0;<NEW_LINE>int maxIndex = 0;<NEW_LINE>double[][] sRGBPalette = new double[palette.length][2];<NEW_LINE>for (int i = 0; i < palette.length; i++) {<NEW_LINE>double[] p = palette[i];<NEW_LINE>if (p.length == 2) {<NEW_LINE>sRGBPalette[i] = p;<NEW_LINE>} else if (p.length == 4) {<NEW_LINE>int color = rgbaToDecimal((int) p[RED_COLOR_INDEX], (int) p[GREEN_COLOR_INDEX], (int) p[BLUE_COLOR_INDEX], 255);<NEW_LINE>sRGBPalette[i] = new double[] { p[VALUE_INDEX], color };<NEW_LINE>} else if (p.length >= 5) {<NEW_LINE>int color = rgbaToDecimal((int) p[RED_COLOR_INDEX], (int) p[GREEN_COLOR_INDEX], (int) p[BLUE_COLOR_INDEX], (int) p[ALPHA_COLOR_INDEX]);<NEW_LINE>sRGBPalette[i] = new double[] { p[VALUE_INDEX], color };<NEW_LINE>}<NEW_LINE>if (p[VALUE_INDEX] > max) {<NEW_LINE>max = p[VALUE_INDEX];<NEW_LINE>maxIndex = i;<NEW_LINE>}<NEW_LINE>if (p[VALUE_INDEX] < min) {<NEW_LINE>min = p[VALUE_INDEX];<NEW_LINE>minIndex = i;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>palette = sRGBPalette;<NEW_LINE>if (minValue < min) {<NEW_LINE>palette[minIndex][VALUE_INDEX] = minValue;<NEW_LINE>}<NEW_LINE>if (maxValue > max) {<NEW_LINE>palette[maxIndex][VALUE_INDEX] = maxValue;<NEW_LINE>}<NEW_LINE>} | = palette[0][VALUE_INDEX]; |
1,670,860 | public static void dismissDialog(@NonNull DialogFragment dialogFragment, int duration, AnimatorListenerAdapter listenerAdapter) {<NEW_LINE>Dialog dialog = dialogFragment.getDialog();<NEW_LINE>if (dialog != null) {<NEW_LINE>if (dialog.getWindow() != null) {<NEW_LINE>View view = dialog<MASK><NEW_LINE>if (view != null) {<NEW_LINE>int centerX = view.getWidth() / 2;<NEW_LINE>int centerY = view.getHeight() / 2;<NEW_LINE>float radius = (float) Math.sqrt(view.getWidth() * view.getWidth() / 4 + view.getHeight() * view.getHeight() / 4);<NEW_LINE>view.post(() -> {<NEW_LINE>if (ViewCompat.isAttachedToWindow(view)) {<NEW_LINE>Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, radius, 0);<NEW_LINE>animator.setDuration(duration);<NEW_LINE>animator.addListener(listenerAdapter);<NEW_LINE>animator.start();<NEW_LINE>} else {<NEW_LINE>listenerAdapter.onAnimationEnd(null);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>listenerAdapter.onAnimationEnd(null);<NEW_LINE>}<NEW_LINE>} | .getWindow().getDecorView(); |
689,575 | private void checkInjectionPointMetadata(VariableElement var, ExecutableElement method, TypeElement parent, WebBeansModel model, AtomicBoolean cancel, Result result) {<NEW_LINE>TypeElement injectionPointType = model.getCompilationController().getElements().getTypeElement(AnnotationUtil.INJECTION_POINT);<NEW_LINE>if (injectionPointType == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Element varElement = model.getCompilationController().getTypes().asElement(var.asType());<NEW_LINE>if (!injectionPointType.equals(varElement)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (cancel.get()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<AnnotationMirror> qualifiers = model.getQualifiers(varElement, true);<NEW_LINE>AnnotationHelper helper = new AnnotationHelper(model.getCompilationController());<NEW_LINE>Map<String, ? extends AnnotationMirror> qualifiersFqns = helper.getAnnotationsByType(qualifiers);<NEW_LINE>boolean hasDefault = model.hasImplicitDefaultQualifier(varElement);<NEW_LINE>if (!hasDefault && qualifiersFqns.keySet().contains(AnnotationUtil.DEFAULT_FQN)) {<NEW_LINE>hasDefault = true;<NEW_LINE>}<NEW_LINE>if (!hasDefault || cancel.get()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>String scope = model.getScope(parent);<NEW_LINE>if (scope != null && !AnnotationUtil.DEPENDENT.equals(scope)) {<NEW_LINE>// NOI18N<NEW_LINE>result.// NOI18N<NEW_LINE>addError(// NOI18N<NEW_LINE>var, // NOI18N<NEW_LINE>method, // NOI18N<NEW_LINE>model, NbBundle.getMessage<MASK><NEW_LINE>}<NEW_LINE>} catch (CdiException e) {<NEW_LINE>// this exception will be handled in the appropriate scope analyzer<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} | (InjectionPointParameterAnalyzer.class, "ERR_WrongQualifierInjectionPointMeta")); |
457,257 | public void sendProcessBlockingAlert(ProcessInstance processInstance, ProjectUser projectUser) {<NEW_LINE>Alert alert = new Alert();<NEW_LINE>String cmdName = getCommandCnName(processInstance.getCommandType());<NEW_LINE>List<ProcessAlertContent> blockingNodeList = new ArrayList<>(1);<NEW_LINE>ProcessAlertContent processAlertContent = ProcessAlertContent.newBuilder().projectCode(projectUser.getProjectCode()).projectName(projectUser.getProjectName()).owner(projectUser.getUserName()).processId(processInstance.getId()).processName(processInstance.getName()).processType(processInstance.getCommandType()).processState(processInstance.getState()).runTimes(processInstance.getRunTimes()).processStartTime(processInstance.getStartTime()).processEndTime(processInstance.getEndTime()).processHost(processInstance.getHost()).build();<NEW_LINE>blockingNodeList.add(processAlertContent);<NEW_LINE>String <MASK><NEW_LINE>alert.setTitle(cmdName + " Blocked");<NEW_LINE>alert.setContent(content);<NEW_LINE>alert.setAlertGroupId(processInstance.getWarningGroupId());<NEW_LINE>alert.setCreateTime(new Date());<NEW_LINE>alertDao.addAlert(alert);<NEW_LINE>logger.info("add alert to db, alert: {}", alert);<NEW_LINE>} | content = JSONUtils.toJsonString(blockingNodeList); |
231,737 | void collectDbStats(ArrayList<SQLiteDebug.DbStats> dbStatsList) {<NEW_LINE>// Get information about the main database.<NEW_LINE>int lookaside = nativeGetDbLookaside(mConnectionPtr);<NEW_LINE>long pageCount = 0;<NEW_LINE>long pageSize = 0;<NEW_LINE>try {<NEW_LINE>pageCount = executeForLong("PRAGMA page_count;", null, null);<NEW_LINE>pageSize = executeForLong("PRAGMA page_size;", null, null);<NEW_LINE>} catch (SQLiteException ex) {<NEW_LINE>// Ignore.<NEW_LINE>}<NEW_LINE>dbStatsList.add(getMainDbStatsUnsafe(lookaside, pageCount, pageSize));<NEW_LINE>// Get information about attached databases.<NEW_LINE>// We ignore the first row in the database list because it corresponds to<NEW_LINE>// the main database which we have already described.<NEW_LINE>CursorWindow window = new CursorWindow("collectDbStats");<NEW_LINE>try {<NEW_LINE>executeForCursorWindow("PRAGMA database_list;", null, window, 0, 0, false, null);<NEW_LINE>for (int i = 1; i < window.getNumRows(); i++) {<NEW_LINE>String name = window.getString(i, 1);<NEW_LINE>String path = window.getString(i, 2);<NEW_LINE>pageCount = 0;<NEW_LINE>pageSize = 0;<NEW_LINE>try {<NEW_LINE>pageCount = executeForLong("PRAGMA " + name + ".page_count;", null, null);<NEW_LINE>pageSize = executeForLong("PRAGMA " + name + ".page_size;", null, null);<NEW_LINE>} catch (SQLiteException ex) {<NEW_LINE>// Ignore.<NEW_LINE>}<NEW_LINE>String label = " (attached) " + name;<NEW_LINE>if (!path.isEmpty()) {<NEW_LINE>label += ": " + path;<NEW_LINE>}<NEW_LINE>dbStatsList.add(new SQLiteDebug.DbStats(label, pageCount, pageSize, 0<MASK><NEW_LINE>}<NEW_LINE>} catch (SQLiteException ex) {<NEW_LINE>// Ignore.<NEW_LINE>} finally {<NEW_LINE>window.close();<NEW_LINE>}<NEW_LINE>} | , 0, 0, 0)); |
298,651 | private MediaItem createMediaItem(Map<String, Object> content) {<NEW_LINE>SimpleYouTubeMediaItem mediaItem = new SimpleYouTubeMediaItem();<NEW_LINE>mediaItem.setBitrate(Helpers.toIntString(content.get(MediaItem.BITRATE)));<NEW_LINE>mediaItem.setUrl(String.valueOf(content.<MASK><NEW_LINE>mediaItem.setITag(Helpers.toIntString(content.get(MediaItem.ITAG)));<NEW_LINE>mediaItem.setType(String.valueOf(content.get(MediaItem.TYPE)));<NEW_LINE>mediaItem.setSignatureCipher(String.valueOf(content.get(MediaItem.S)));<NEW_LINE>mediaItem.setClen(String.valueOf(content.get(MediaItem.CLEN)));<NEW_LINE>mediaItem.setFps(String.valueOf(content.get(MediaItem.FPS)));<NEW_LINE>mediaItem.setIndex(String.valueOf(content.get(MediaItem.INDEX)));<NEW_LINE>mediaItem.setInit(String.valueOf(content.get(MediaItem.INIT)));<NEW_LINE>mediaItem.setSize(String.valueOf(content.get(MediaItem.SIZE)));<NEW_LINE>return mediaItem;<NEW_LINE>} | get(MediaItem.URL))); |
1,011,094 | // submit the map/reduce job.<NEW_LINE>public int run(final String[] args) throws Exception {<NEW_LINE>if (args.length != 1) {<NEW_LINE>return printUsage();<NEW_LINE>}<NEW_LINE>Path in_path = new Path(args[0]);<NEW_LINE>System.out.println("\n-----===[PEGASUS: A Peta-Scale Graph Mining System]===-----\n");<NEW_LINE>System.out.println("[PEGASUS] Computing L1norm. in_path=" + in_path.getName() + "\n");<NEW_LINE>final FileSystem fs = FileSystem.get(getConf());<NEW_LINE>Path l1norm_output = new Path("l1norm_output");<NEW_LINE>fs.delete(l1norm_output);<NEW_LINE>JobClient.runJob(configL1norm(in_path, l1norm_output));<NEW_LINE>System.out.println("\n[PEGASUS] L1norm computed. Output is saved in HDFS " + <MASK><NEW_LINE>return 0;<NEW_LINE>} | l1norm_output.getName() + "\n"); |
770,389 | private static void uploadProduct(String tableName, String productIndex) {<NEW_LINE>try {<NEW_LINE>// Add a book.<NEW_LINE>Map<String, AttributeValue> item = new HashMap<String, AttributeValue>();<NEW_LINE>item.put("Id", new AttributeValue().withN(productIndex));<NEW_LINE>item.put("Title", new AttributeValue().withS("Book " + productIndex + " Title"));<NEW_LINE>item.put("ISBN", new AttributeValue().withS("111-1111111111"));<NEW_LINE>item.put("Authors", new AttributeValue().withSS(Arrays.asList("Author1")));<NEW_LINE>item.put("Price", new AttributeValue().withN("2"));<NEW_LINE>item.put("Dimensions", new AttributeValue().withS("8.5 x 11.0 x 0.5"));<NEW_LINE>item.put("PageCount", new AttributeValue().withN("500"));<NEW_LINE>item.put("InPublication", new AttributeValue<MASK><NEW_LINE>item.put("ProductCategory", new AttributeValue().withS("Book"));<NEW_LINE>PutItemRequest itemRequest = new PutItemRequest().withTableName(tableName).withItem(item);<NEW_LINE>client.putItem(itemRequest);<NEW_LINE>item.clear();<NEW_LINE>} catch (AmazonServiceException ase) {<NEW_LINE>System.err.println("Failed to create item " + productIndex + " in " + tableName);<NEW_LINE>}<NEW_LINE>} | ().withBOOL(true)); |
629,813 | protected void prepare() {<NEW_LINE>ProcessInfoParameter[] para = getParametersAsArray();<NEW_LINE>for (int i = 0; i < para.length; i++) {<NEW_LINE>String name = para[i].getParameterName();<NEW_LINE>if (para[i].getParameter() == null)<NEW_LINE>;<NEW_LINE>else if (name.equals("M_PriceList_Version_ID"))<NEW_LINE>p_M_PriceList_Version_ID = para[i].getParameterAsInt();<NEW_LINE>else if (name.equals("DateValue"))<NEW_LINE>p_DateValue = (Timestamp) para[i].getParameter();<NEW_LINE>else if (name.equals("M_Warehouse_ID"))<NEW_LINE>p_M_Warehouse_ID = para[i].getParameterAsInt();<NEW_LINE>else if (name.equals("C_Currency_ID"))<NEW_LINE>p_C_Currency_ID = <MASK><NEW_LINE>else if (name.equals("M_CostElement_ID"))<NEW_LINE>p_M_CostElement_ID = para[i].getParameterAsInt();<NEW_LINE>}<NEW_LINE>if (p_DateValue == null)<NEW_LINE>p_DateValue = new Timestamp(System.currentTimeMillis());<NEW_LINE>} | para[i].getParameterAsInt(); |
1,406,632 | private void alterDocument(Uri uri, String fileName) {<NEW_LINE>logDebug("alterUri");<NEW_LINE>try {<NEW_LINE>File tempFolder = <MASK><NEW_LINE>if (!isFileAvailable(tempFolder))<NEW_LINE>return;<NEW_LINE>String sourceLocation = tempFolder.getAbsolutePath() + File.separator + fileName;<NEW_LINE>ParcelFileDescriptor pfd = getContentResolver().openFileDescriptor(uri, "w");<NEW_LINE>FileOutputStream fileOutputStream = new FileOutputStream(pfd.getFileDescriptor());<NEW_LINE>InputStream in = new FileInputStream(sourceLocation);<NEW_LINE>// Copy the bits from instream to outstream<NEW_LINE>byte[] buf = new byte[1024];<NEW_LINE>int len;<NEW_LINE>while ((len = in.read(buf)) > 0) {<NEW_LINE>fileOutputStream.write(buf, 0, len);<NEW_LINE>}<NEW_LINE>in.close();<NEW_LINE>// Let the document provider know you're done by closing the stream.<NEW_LINE>fileOutputStream.close();<NEW_LINE>pfd.close();<NEW_LINE>File deleteTemp = new File(sourceLocation);<NEW_LINE>deleteTemp.delete();<NEW_LINE>} catch (FileNotFoundException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | getCacheFolder(getApplicationContext(), TEMPORAL_FOLDER); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.