idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
652,173 | public Optional<BinaryOperationExpression> convertToSQLSegment(final SqlBasicCall sqlBasicCall) {<NEW_LINE>ExpressionConverter expressionConverter = new ExpressionConverter();<NEW_LINE>ExpressionSegment left = expressionConverter.convertToSQLSegment(sqlBasicCall.getOperandList().get(0)).orElseThrow(IllegalStateException::new);<NEW_LINE>ExpressionSegment right = expressionConverter.convertToSQLSegment(sqlBasicCall.getOperandList().get(1)).orElseThrow(IllegalStateException::new);<NEW_LINE>String operator = sqlBasicCall.getOperator().getName();<NEW_LINE>String text = sqlBasicCall.toString();<NEW_LINE>if (SqlKind.LIKE == sqlBasicCall.getOperator().getKind()) {<NEW_LINE>ListExpression listExpression = new ListExpression(getStartIndex(sqlBasicCall.getOperandList().get(1)), getStopIndex(sqlBasicCall.getOperandList().get(1)));<NEW_LINE>listExpression.getItems().add(right);<NEW_LINE>return Optional.of(new BinaryOperationExpression(getStartIndex(sqlBasicCall), getStopIndex(sqlBasicCall), left, listExpression, operator, text));<NEW_LINE>}<NEW_LINE>return Optional.of(new BinaryOperationExpression(getStartIndex(sqlBasicCall), getStopIndex(sqlBasicCall), left<MASK><NEW_LINE>} | , right, operator, text)); |
981,027 | public int[][] test(DataFrame data) {<NEW_LINE>DataFrame x = formula.x(data);<NEW_LINE>int n = x.nrow();<NEW_LINE>int ntrees = trees != null ? trees.length : forest[0].length;<NEW_LINE>int[][] prediction = new int[ntrees][n];<NEW_LINE>if (k == 2) {<NEW_LINE>for (int j = 0; j < n; j++) {<NEW_LINE>Tuple <MASK><NEW_LINE>double base = 0;<NEW_LINE>for (int i = 0; i < ntrees; i++) {<NEW_LINE>base += shrinkage * trees[i].predict(xj);<NEW_LINE>prediction[i][j] = base > 0 ? 1 : 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>double[] p = new double[k];<NEW_LINE>for (int j = 0; j < n; j++) {<NEW_LINE>Tuple xj = x.get(j);<NEW_LINE>Arrays.fill(p, 0);<NEW_LINE>for (int i = 0; i < ntrees; i++) {<NEW_LINE>for (int l = 0; l < k; l++) {<NEW_LINE>p[l] += shrinkage * forest[l][i].predict(xj);<NEW_LINE>}<NEW_LINE>prediction[i][j] = MathEx.whichMax(p);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return prediction;<NEW_LINE>} | xj = x.get(j); |
85,398 | private // LIDB2018-1<NEW_LINE>void // LIDB2018-1<NEW_LINE>initialize(// LIDB2018-1<NEW_LINE>EJSContainer container, // LIDB2018-1<NEW_LINE>EJBCache cache, // LIDB2018-1<NEW_LINE>PassivationPolicy passivationPolicy, // LIDB2018-1<NEW_LINE>StatefulPassivator passivator, SfFailoverCache failoverCache) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>Tr.entry(tc, "initialize");<NEW_LINE>this.container = container;<NEW_LINE>this.beanCache = cache;<NEW_LINE>this.passivator = passivator;<NEW_LINE>// Create table for activation locks<NEW_LINE>activationLocks = new LockTable(beanCache.getNumBuckets());<NEW_LINE>// Create activation strategies<NEW_LINE><MASK><NEW_LINE>strategies = new ActivationStrategy[NUM_STRATEGIES];<NEW_LINE>for (int type = 0; type < strategies.length; type++) {<NEW_LINE>strategies[type] = runtime.createActivationStrategy(this, type, passivationPolicy);<NEW_LINE>}<NEW_LINE>// PK04804<NEW_LINE>beanCache.setDiscardStrategy(this);<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>Tr.exit(tc, "initialize");<NEW_LINE>} | EJBRuntime runtime = container.getEJBRuntime(); |
1,449,127 | public Expression evalFieldCall(ClassField field, Expression arg) {<NEW_LINE>if (arg instanceof FunCallExpression && ((FunCallExpression) arg).getDefinition().getResultType() instanceof ClassCallExpression) {<NEW_LINE>FunCallExpression funCall = (FunCallExpression) arg;<NEW_LINE>ClassCallExpression classCall = (ClassCallExpression) funCall.getDefinition().getResultType();<NEW_LINE>Expression impl = classCall.getAbsImplementationHere(field);<NEW_LINE>if (impl != null) {<NEW_LINE>return impl.subst(new ExprSubstitution(classCall.getThisBinding(), arg).add(funCall.getDefinition().getParameters(), funCall.getDefCallArguments()), funCall.getLevelSubstitution());<NEW_LINE>}<NEW_LINE>AbsExpression absImpl = classCall.getDefinition().getImplementation(field);<NEW_LINE>if (absImpl != null) {<NEW_LINE>return absImpl.getExpression().subst(new ExprSubstitution(absImpl.getBinding(), arg).add(funCall.getDefinition().getParameters(), funCall.getDefCallArguments()), classCall.getLevelSubstitution().subst<MASK><NEW_LINE>} else if (funCall.getDefinition().getBody() == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>arg = arg.normalize(NormalizationMode.WHNF);<NEW_LINE>Expression type = arg.getType();<NEW_LINE>Expression normType = type == null ? null : type.accept(this, NormalizationMode.WHNF);<NEW_LINE>return normType instanceof ClassCallExpression ? ((ClassCallExpression) normType).getImplementation(field, arg) : null;<NEW_LINE>} | (funCall.getLevelSubstitution())); |
68,554 | private static void addMagic(SName sname) {<NEW_LINE>final String cleanName = sname.name(<MASK><NEW_LINE>addConvert(cleanName + "BackgroundColor", PName.BackGroundColor, sname);<NEW_LINE>addConvert(cleanName + "BorderColor", PName.LineColor, sname);<NEW_LINE>addConvert(cleanName + "BorderThickness", PName.LineThickness, sname);<NEW_LINE>addConvert(cleanName + "RoundCorner", PName.RoundCorner, sname);<NEW_LINE>addConvert(cleanName + "DiagonalCorner", PName.DiagonalCorner, sname);<NEW_LINE>addConvert(cleanName + "BorderStyle", PName.LineStyle, sname);<NEW_LINE>addConvert(cleanName + "StereotypeFontColor", PName.FontColor, SName.stereotype, sname);<NEW_LINE>addConFont(cleanName, sname);<NEW_LINE>} | ).replace("_", ""); |
1,190,618 | public static ListContactFlowsResponse unmarshall(ListContactFlowsResponse listContactFlowsResponse, UnmarshallerContext context) {<NEW_LINE>listContactFlowsResponse.setRequestId(context.stringValue("ListContactFlowsResponse.RequestId"));<NEW_LINE>listContactFlowsResponse.setSuccess(context.booleanValue("ListContactFlowsResponse.Success"));<NEW_LINE>listContactFlowsResponse.setCode<MASK><NEW_LINE>listContactFlowsResponse.setMessage(context.stringValue("ListContactFlowsResponse.Message"));<NEW_LINE>listContactFlowsResponse.setHttpStatusCode(context.integerValue("ListContactFlowsResponse.HttpStatusCode"));<NEW_LINE>List<ContactFlow> contactFlows = new ArrayList<ContactFlow>();<NEW_LINE>for (int i = 0; i < context.lengthValue("ListContactFlowsResponse.ContactFlows.Length"); i++) {<NEW_LINE>ContactFlow contactFlow = new ContactFlow();<NEW_LINE>contactFlow.setContactFlowId(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].ContactFlowId"));<NEW_LINE>contactFlow.setInstanceId(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].InstanceId"));<NEW_LINE>contactFlow.setContactFlowName(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].ContactFlowName"));<NEW_LINE>contactFlow.setContactFlowDescription(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].ContactFlowDescription"));<NEW_LINE>contactFlow.setType(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].Type"));<NEW_LINE>contactFlow.setAppliedVersion(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].AppliedVersion"));<NEW_LINE>List<ContactFlowVersion> versions = new ArrayList<ContactFlowVersion>();<NEW_LINE>for (int j = 0; j < context.lengthValue("ListContactFlowsResponse.ContactFlows[" + i + "].Versions.Length"); j++) {<NEW_LINE>ContactFlowVersion contactFlowVersion = new ContactFlowVersion();<NEW_LINE>contactFlowVersion.setContactFlowVersionId(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].Versions[" + j + "].ContactFlowVersionId"));<NEW_LINE>contactFlowVersion.setVersion(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].Versions[" + j + "].Version"));<NEW_LINE>contactFlowVersion.setContactFlowVersionDescription(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].Versions[" + j + "].ContactFlowVersionDescription"));<NEW_LINE>contactFlowVersion.setLastModified(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].Versions[" + j + "].LastModified"));<NEW_LINE>contactFlowVersion.setLastModifiedBy(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].Versions[" + j + "].LastModifiedBy"));<NEW_LINE>contactFlowVersion.setLockedBy(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].Versions[" + j + "].LockedBy"));<NEW_LINE>contactFlowVersion.setStatus(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].Versions[" + j + "].Status"));<NEW_LINE>versions.add(contactFlowVersion);<NEW_LINE>}<NEW_LINE>contactFlow.setVersions(versions);<NEW_LINE>List<PhoneNumber> phoneNumbers = new ArrayList<PhoneNumber>();<NEW_LINE>for (int j = 0; j < context.lengthValue("ListContactFlowsResponse.ContactFlows[" + i + "].PhoneNumbers.Length"); j++) {<NEW_LINE>PhoneNumber phoneNumber = new PhoneNumber();<NEW_LINE>phoneNumber.setPhoneNumberId(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].PhoneNumbers[" + j + "].PhoneNumberId"));<NEW_LINE>phoneNumber.setInstanceId(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].PhoneNumbers[" + j + "].InstanceId"));<NEW_LINE>phoneNumber.setNumber(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].PhoneNumbers[" + j + "].Number"));<NEW_LINE>phoneNumber.setPhoneNumberDescription(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].PhoneNumbers[" + j + "].PhoneNumberDescription"));<NEW_LINE>phoneNumber.setTestOnly(context.booleanValue("ListContactFlowsResponse.ContactFlows[" + i + "].PhoneNumbers[" + j + "].TestOnly"));<NEW_LINE>phoneNumber.setRemainingTime(context.integerValue("ListContactFlowsResponse.ContactFlows[" + i + "].PhoneNumbers[" + j + "].RemainingTime"));<NEW_LINE>phoneNumber.setAllowOutbound(context.booleanValue("ListContactFlowsResponse.ContactFlows[" + i + "].PhoneNumbers[" + j + "].AllowOutbound"));<NEW_LINE>phoneNumber.setUsage(context.stringValue("ListContactFlowsResponse.ContactFlows[" + i + "].PhoneNumbers[" + j + "].Usage"));<NEW_LINE>phoneNumber.setTrunks(context.integerValue("ListContactFlowsResponse.ContactFlows[" + i + "].PhoneNumbers[" + j + "].Trunks"));<NEW_LINE>phoneNumbers.add(phoneNumber);<NEW_LINE>}<NEW_LINE>contactFlow.setPhoneNumbers(phoneNumbers);<NEW_LINE>contactFlows.add(contactFlow);<NEW_LINE>}<NEW_LINE>listContactFlowsResponse.setContactFlows(contactFlows);<NEW_LINE>return listContactFlowsResponse;<NEW_LINE>} | (context.stringValue("ListContactFlowsResponse.Code")); |
1,124,269 | protected void uploadGlyphs(XRGlyphCacheEntry[] glyphs, ArrayList<XRGlyphCacheEntry> uncachedGlyphs, GlyphList gl, int parentXid) {<NEW_LINE>for (XRGlyphCacheEntry glyph : uncachedGlyphs) {<NEW_LINE>cachedPixels += glyph.getPixelCnt();<NEW_LINE>}<NEW_LINE>if (cachedPixels > MAX_CACHED_PIXELS) {<NEW_LINE>clearCache(glyphs);<NEW_LINE>}<NEW_LINE>EnumMap<XRGlyphCacheEntry.Type, List<XRGlyphCacheEntry<MASK><NEW_LINE>uploadGlyphs(grayGlyphSet, gl, glyphListsByType.get(XRGlyphCacheEntry.Type.GRAYSCALE));<NEW_LINE>uploadGlyphs(lcdGlyphSet, gl, glyphListsByType.get(XRGlyphCacheEntry.Type.LCD));<NEW_LINE>List<XRGlyphCacheEntry> bgraGlyphs = glyphListsByType.getOrDefault(XRGlyphCacheEntry.Type.BGRA, List.of());<NEW_LINE>if (!bgraGlyphs.isEmpty()) {<NEW_LINE>con.addBGRAGlyphImages(parentXid, bgraGlyphs);<NEW_LINE>}<NEW_LINE>} | >> glyphListsByType = separateGlyphTypes(uncachedGlyphs); |
1,680,272 | private static void pushPrimitiveCastIfRequired(MethodVisitor methodVisitor, String internalName, Type primitiveType) {<NEW_LINE>if (primitiveType != null) {<NEW_LINE>Method valueMethod = null;<NEW_LINE>switch(primitiveType.getSort()) {<NEW_LINE>case Type.BOOLEAN:<NEW_LINE>valueMethod = Method.getMethod("boolean booleanValue()");<NEW_LINE>break;<NEW_LINE>case Type.CHAR:<NEW_LINE>valueMethod = Method.getMethod("char charValue()");<NEW_LINE>break;<NEW_LINE>case Type.BYTE:<NEW_LINE><MASK><NEW_LINE>break;<NEW_LINE>case Type.SHORT:<NEW_LINE>valueMethod = Method.getMethod("short shortValue()");<NEW_LINE>break;<NEW_LINE>case Type.INT:<NEW_LINE>valueMethod = Method.getMethod("int intValue()");<NEW_LINE>break;<NEW_LINE>case Type.LONG:<NEW_LINE>valueMethod = Method.getMethod("long longValue()");<NEW_LINE>break;<NEW_LINE>case Type.DOUBLE:<NEW_LINE>valueMethod = Method.getMethod("double doubleValue()");<NEW_LINE>break;<NEW_LINE>case Type.FLOAT:<NEW_LINE>valueMethod = Method.getMethod("float floatValue()");<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>}<NEW_LINE>if (valueMethod != null) {<NEW_LINE>methodVisitor.visitMethodInsn(INVOKEVIRTUAL, internalName, valueMethod.getName(), valueMethod.getDescriptor(), false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | valueMethod = Method.getMethod("byte byteValue()"); |
268,776 | // endregion<NEW_LINE>// region DocumentOperations<NEW_LINE>@Override<NEW_LINE>public <T> Flux<T> saveAll(Mono<? extends Collection<? extends T>> entitiesPublisher, IndexCoordinates index) {<NEW_LINE>Assert.notNull(entitiesPublisher, "entitiesPublisher must not be null!");<NEW_LINE>return //<NEW_LINE>entitiesPublisher.flatMapMany(//<NEW_LINE>entities -> //<NEW_LINE>Flux.fromIterable(entities).//<NEW_LINE>concatMap(//<NEW_LINE>entity -> maybeCallBeforeConvert(entity, index))).//<NEW_LINE>collectList().//<NEW_LINE>map(Entities::new).flatMapMany(entities -> {<NEW_LINE>if (entities.isEmpty()) {<NEW_LINE>return Flux.empty();<NEW_LINE>}<NEW_LINE>return //<NEW_LINE>//<NEW_LINE>doBulkOperation(entities.indexQueries(), BulkOptions.defaultOptions(), index).index().flatMap(indexAndResponse -> {<NEW_LINE>T savedEntity = entities.entityAt(indexAndResponse.getT1());<NEW_LINE>BulkItemResponse bulkItemResponse = indexAndResponse.getT2();<NEW_LINE>DocWriteResponse response = bulkItemResponse.getResponse();<NEW_LINE>updateIndexedObject(savedEntity, IndexedObjectInformation.of(response.getId(), response.getSeqNo(), response.getPrimaryTerm()<MASK><NEW_LINE>return maybeCallAfterSave(savedEntity, index);<NEW_LINE>});<NEW_LINE>});<NEW_LINE>} | , response.getVersion())); |
1,777,591 | public void accept(TraceVisitor traceVisitor) throws Exception {<NEW_LINE>// timings for traces that are still active are normalized to the capture tick in order<NEW_LINE>// to *attempt* to present a picture of the trace at that exact tick<NEW_LINE>// (without using synchronization to block updates to the trace while it is being read)<NEW_LINE>CountingEntryVisitorWrapper entryVisitorWrapper = new CountingEntryVisitorWrapper(traceVisitor);<NEW_LINE><MASK><NEW_LINE>List<Aggregate.Query> queries = transaction.getQueries();<NEW_LINE>traceVisitor.visitQueries(queries);<NEW_LINE>traceVisitor.visitSharedQueryTexts(transaction.getSharedQueryTexts());<NEW_LINE>Profile mainThreadProfile = transaction.getMainThreadProfileProtobuf();<NEW_LINE>if (mainThreadProfile != null) {<NEW_LINE>traceVisitor.visitMainThreadProfile(mainThreadProfile);<NEW_LINE>}<NEW_LINE>long mainThreadProfileSampleCount = getProfileSampleCount(mainThreadProfile);<NEW_LINE>// mainThreadProfile can be gc'd at this point<NEW_LINE>Profile auxThreadProfile = transaction.getAuxThreadProfileProtobuf();<NEW_LINE>if (auxThreadProfile != null) {<NEW_LINE>traceVisitor.visitAuxThreadProfile(auxThreadProfile);<NEW_LINE>}<NEW_LINE>long auxThreadProfileSampleCount = getProfileSampleCount(auxThreadProfile);<NEW_LINE>// auxThreadProfile can be gc'd at this point<NEW_LINE>int entryCount = entryVisitorWrapper.count;<NEW_LINE>int queryCount = queries.size();<NEW_LINE>if (header == null) {<NEW_LINE>traceVisitor.visitHeader(createTraceHeader(transaction, slow, partial, captureTime, captureTick, entryCount, queryCount, mainThreadProfileSampleCount, auxThreadProfileSampleCount));<NEW_LINE>} else {<NEW_LINE>Trace.Header.Builder builder = header.toBuilder();<NEW_LINE>addCounts(builder, transaction, entryCount, queryCount, mainThreadProfileSampleCount, auxThreadProfileSampleCount);<NEW_LINE>traceVisitor.visitHeader(builder.build());<NEW_LINE>}<NEW_LINE>} | transaction.visitEntries(captureTick, entryVisitorWrapper); |
1,019,687 | private static boolean hasJavaRuntime(ImageReference imageReference) {<NEW_LINE>if (null == imageReference || null == imageReference.image) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Iterator<?> spaces <MASK><NEW_LINE>while ((null != spaces) && spaces.hasNext()) {<NEW_LINE>// search address spaces<NEW_LINE>Object obj = spaces.next();<NEW_LINE>if ((null != obj) && (obj instanceof ImageAddressSpace)) {<NEW_LINE>ImageAddressSpace space = (ImageAddressSpace) obj;<NEW_LINE>Iterator<?> procs = space.getProcesses();<NEW_LINE>while ((null != procs) && procs.hasNext()) {<NEW_LINE>// search processes<NEW_LINE>Object procobj = procs.next();<NEW_LINE>if ((null != procobj) && (procobj instanceof ImageProcess)) {<NEW_LINE>ImageProcess proc = (ImageProcess) procobj;<NEW_LINE>Iterator<?> runtimes = proc.getRuntimes();<NEW_LINE>while ((null != runtimes) && runtimes.hasNext()) {<NEW_LINE>Object rtobj = runtimes.next();<NEW_LINE>if ((null != rtobj) && (rtobj instanceof JavaRuntime)) {<NEW_LINE>// found a non-corrupt java runtime<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | = imageReference.image.getAddressSpaces(); |
1,187,163 | public static void renderVolume(ImageByte4 output, VolumeShort2 volume, Float3 volumeDims, Matrix4x4Float view, float nearPlane, float farPlane, float smallStep, float largeStep, Float3 light, Float3 ambient) {<NEW_LINE>for (@Parallel int y = 0; y < output.Y(); y++) {<NEW_LINE>for (@Parallel int x = 0; x < output.X(); x++) {<NEW_LINE>final Float4 hit = raycastPoint(volume, volumeDims, x, y, view, nearPlane, farPlane, smallStep, largeStep);<NEW_LINE>final Byte4 pixel;<NEW_LINE>if (hit.getW() > 0) {<NEW_LINE>final Float3 test = hit.asFloat3();<NEW_LINE>final Float3 surfNorm = grad(volume, volumeDims, test);<NEW_LINE>if (Float3.length(surfNorm) > 0) {<NEW_LINE>final Float3 diff = Float3.normalise(Float3.sub(light, test));<NEW_LINE>final Float3 normalizedSurfNorm = Float3.normalise(surfNorm);<NEW_LINE>final float dir = Math.max(Float3.dot<MASK><NEW_LINE>Float3 col = add(new Float3(dir, dir, dir), ambient);<NEW_LINE>col = Float3.clamp(col, 0f, 1f);<NEW_LINE>col = Float3.mult(col, 255f);<NEW_LINE>pixel = new Byte4((byte) col.getX(), (byte) col.getY(), (byte) col.getZ(), (byte) 0);<NEW_LINE>} else {<NEW_LINE>pixel = new Byte4();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>pixel = new Byte4();<NEW_LINE>}<NEW_LINE>output.set(x, y, pixel);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (normalizedSurfNorm, diff), 0f); |
297,663 | protected TypeBinding internalResolveType(Scope scope, int location) {<NEW_LINE>// handle the error here<NEW_LINE>this.constant = Constant.NotAConstant;<NEW_LINE>checkYieldUsage(scope);<NEW_LINE>if (this.resolvedType != null) {<NEW_LINE>// is a shared type reference which was already resolved<NEW_LINE>if (this.resolvedType.isValidBinding()) {<NEW_LINE>return this.resolvedType;<NEW_LINE>} else {<NEW_LINE>switch(this.resolvedType.problemId()) {<NEW_LINE>case ProblemReasons.NotFound:<NEW_LINE>case ProblemReasons.NotVisible:<NEW_LINE>case ProblemReasons.InheritedNameHidesEnclosingName:<NEW_LINE>TypeBinding type = this.resolvedType.closestMatch();<NEW_LINE>if (type == null)<NEW_LINE>return null;<NEW_LINE>return scope.environment().convertToRawType(type, false);<NEW_LINE>default:<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>boolean hasError;<NEW_LINE>TypeBinding type = <MASK><NEW_LINE>if (type == null) {<NEW_LINE>// detected cycle while resolving hierarchy<NEW_LINE>return null;<NEW_LINE>} else if ((hasError = !type.isValidBinding()) == true) {<NEW_LINE>if (this.isTypeNameVar(scope)) {<NEW_LINE>reportVarIsNotAllowedHere(scope);<NEW_LINE>} else {<NEW_LINE>reportInvalidType(scope);<NEW_LINE>}<NEW_LINE>switch(type.problemId()) {<NEW_LINE>case ProblemReasons.NotFound:<NEW_LINE>case ProblemReasons.NotVisible:<NEW_LINE>case ProblemReasons.InheritedNameHidesEnclosingName:<NEW_LINE>type = type.closestMatch();<NEW_LINE>if (type == null)<NEW_LINE>return null;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (type.isArrayType() && ((ArrayBinding) type).leafComponentType == TypeBinding.VOID) {<NEW_LINE>scope.problemReporter().cannotAllocateVoidArray(this);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (// QualifiedTypeReference#getTypeBinding called above will have already checked deprecation<NEW_LINE>!(this instanceof QualifiedTypeReference) && isTypeUseDeprecated(type, scope)) {<NEW_LINE>reportDeprecatedType(type, scope);<NEW_LINE>}<NEW_LINE>type = scope.environment().convertToRawType(type, false);<NEW_LINE>if (type.leafComponentType().isRawType() && (this.bits & ASTNode.IgnoreRawTypeCheck) == 0 && scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {<NEW_LINE>scope.problemReporter().rawTypeReference(this, type);<NEW_LINE>}<NEW_LINE>if (hasError) {<NEW_LINE>// don't apply null defaults to buggy type<NEW_LINE>resolveAnnotations(scope, 0);<NEW_LINE>return type;<NEW_LINE>} else {<NEW_LINE>// store the computed type only if no error, otherwise keep the problem type instead<NEW_LINE>this.resolvedType = type;<NEW_LINE>resolveAnnotations(scope, location);<NEW_LINE>// pick up value that may have been changed in resolveAnnotations(..)<NEW_LINE>return this.resolvedType;<NEW_LINE>}<NEW_LINE>} | this.resolvedType = getTypeBinding(scope); |
217,836 | public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {<NEW_LINE>String subcommand;<NEW_LINE>if (command.equals("!markmap")) {<NEW_LINE>if (args.length < 1) {<NEW_LINE>out.println("No command specified");<NEW_LINE>printHelp(out);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>subcommand = args[0];<NEW_LINE>} else {<NEW_LINE>subcommand = command.substring("!markmap".length());<NEW_LINE>}<NEW_LINE>if (subcommand.equalsIgnoreCase("ismarked")) {<NEW_LINE>isMarked(args, context, out);<NEW_LINE>} else if (subcommand.equalsIgnoreCase("near")) {<NEW_LINE>near(args, context, out);<NEW_LINE>} else if (subcommand.equalsIgnoreCase("bits")) {<NEW_LINE><MASK><NEW_LINE>} else if (subcommand.equalsIgnoreCase("fromBits")) {<NEW_LINE>fromBits(args, context, out);<NEW_LINE>} else if (subcommand.equalsIgnoreCase("source")) {<NEW_LINE>findSource(args, context, out);<NEW_LINE>} else if (subcommand.equalsIgnoreCase("scanRange")) {<NEW_LINE>scanRange(args, context, out);<NEW_LINE>} else if (subcommand.equalsIgnoreCase("show")) {<NEW_LINE>showMarkMap(args, context, out);<NEW_LINE>} else if (subcommand.equalsIgnoreCase("set")) {<NEW_LINE>setMarkMap(args, context, out);<NEW_LINE>} else if (subcommand.equals("help")) {<NEW_LINE>printHelp(out);<NEW_LINE>} else {<NEW_LINE>out.println("Unrecognised command: " + subcommand);<NEW_LINE>printHelp(out);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>} | markBits(args, context, out); |
826,885 | public void openAdvancedDevices(long handleToDownload, boolean highPriority) {<NEW_LINE>logDebug("openAdvancedDevices");<NEW_LINE>String externalPath = getExternalCardPath();<NEW_LINE>if (externalPath != null) {<NEW_LINE>logDebug("ExternalPath for advancedDevices: " + externalPath);<NEW_LINE>MegaNode node = megaApi.getNodeByHandle(handleToDownload);<NEW_LINE>if (node != null) {<NEW_LINE>File newFile = new File(node.getName());<NEW_LINE>logDebug("File: " + newFile.getPath());<NEW_LINE>Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);<NEW_LINE>// Filter to only show results that can be "opened", such as<NEW_LINE>// a file (as opposed to a list of contacts or timezones).<NEW_LINE><MASK><NEW_LINE>// Create a file with the requested MIME type.<NEW_LINE>String mimeType = MimeTypeList.getMimeType(newFile);<NEW_LINE>logDebug("Mimetype: " + mimeType);<NEW_LINE>intent.setType(mimeType);<NEW_LINE>intent.putExtra(Intent.EXTRA_TITLE, node.getName());<NEW_LINE>intent.putExtra("handleToDownload", handleToDownload);<NEW_LINE>intent.putExtra(HIGH_PRIORITY_TRANSFER, highPriority);<NEW_LINE>try {<NEW_LINE>startActivityForResult(intent, WRITE_SD_CARD_REQUEST_CODE);<NEW_LINE>} catch (Exception e) {<NEW_LINE>logError("Exception in External SDCARD", e);<NEW_LINE>Environment.getExternalStorageDirectory();<NEW_LINE>Toast toast = Toast.makeText(this, getString(R.string.no_external_SD_card_detected), Toast.LENGTH_LONG);<NEW_LINE>toast.show();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logWarning("No external SD card");<NEW_LINE>Environment.getExternalStorageDirectory();<NEW_LINE>Toast toast = Toast.makeText(this, getString(R.string.no_external_SD_card_detected), Toast.LENGTH_LONG);<NEW_LINE>toast.show();<NEW_LINE>}<NEW_LINE>} | intent.addCategory(Intent.CATEGORY_OPENABLE); |
1,348,089 | // Used by DatumReader. Applications should not call.<NEW_LINE>@SuppressWarnings(value = "unchecked")<NEW_LINE>public void put(int field$, java.lang.Object value$) {<NEW_LINE>switch(field$) {<NEW_LINE>case 0:<NEW_LINE>ownerId = (java.lang.Integer) value$;<NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>timestampLastResetMs = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 2:<NEW_LINE>timeSinceLastResetMs = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>dimension = (java.lang.CharSequence) value$;<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE>numReqBootstrap = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 5:<NEW_LINE>numReqSnapshot = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 6:<NEW_LINE>numReqCatchup = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 7:<NEW_LINE>numErrReqBootstrap = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 8:<NEW_LINE>numErrReqDatabaseTooOld = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 9:<NEW_LINE>numErrSqlException = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 10:<NEW_LINE>numReqStartSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 11:<NEW_LINE>numReqTargetSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 12:<NEW_LINE>numErrStartSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 13:<NEW_LINE>numErrTargetSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 14:<NEW_LINE>latencySnapshot = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 15:<NEW_LINE>latencyCatchup = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 16:<NEW_LINE>latencyStartSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 17:<NEW_LINE>latencyTargetSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 18:<NEW_LINE>sizeBatch = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 19:<NEW_LINE>minBootstrapSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 20:<NEW_LINE>maxBootstrapSCN = <MASK><NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new org.apache.avro.AvroRuntimeException("Bad index");<NEW_LINE>}<NEW_LINE>} | (java.lang.Long) value$; |
539,209 | protected MethodNode checkGroovyStyleConstructor(final ClassNode node, final ClassNode[] arguments, final ASTNode source) {<NEW_LINE>if (node.equals(OBJECT_TYPE) || node.equals(DYNAMIC_TYPE)) {<NEW_LINE>// in that case, we are facing a list constructor assigned to a def or object<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>List<ConstructorNode<MASK><NEW_LINE>if (constructors.isEmpty() && arguments.length == 0) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>List<MethodNode> constructorList = findMethod(node, "<init>", arguments);<NEW_LINE>if (constructorList.isEmpty()) {<NEW_LINE>if (isBeingCompiled(node) && arguments.length == 1 && LINKEDHASHMAP_CLASSNODE.equals(arguments[0])) {<NEW_LINE>// there will be a default hash map constructor added later<NEW_LINE>ConstructorNode cn = new ConstructorNode(Opcodes.ACC_PUBLIC, new Parameter[] { new Parameter(LINKEDHASHMAP_CLASSNODE, "args") }, ClassNode.EMPTY_ARRAY, EmptyStatement.INSTANCE);<NEW_LINE>return cn;<NEW_LINE>} else {<NEW_LINE>addStaticTypeError("No matching constructor found: " + prettyPrintTypeName(node) + toMethodParametersString("", arguments), source);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} else if (constructorList.size() > 1) {<NEW_LINE>addStaticTypeError("Ambiguous constructor call " + prettyPrintTypeName(node) + toMethodParametersString("", arguments), source);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return constructorList.get(0);<NEW_LINE>} | > constructors = node.getDeclaredConstructors(); |
1,166,819 | protected void handleDoubleClick(DoubleClickEvent anEvent) {<NEW_LINE>super.handleDoubleClick(anEvent);<NEW_LINE>// open the model<NEW_LINE>if (anEvent.getSelection() instanceof IStructuredSelection) {<NEW_LINE>IStructuredSelection iss = (IStructuredSelection) anEvent.getSelection();<NEW_LINE>Object firstElement = iss.getFirstElement();<NEW_LINE>if (firstElement instanceof Module) {<NEW_LINE>final Map<String, String> parameters = new HashMap<String, String>();<NEW_LINE>parameters.put(OpenModuleHandler.PARAM_MODULE, ((Module<MASK><NEW_LINE>UIHelper.runCommand(OpenModuleHandler.COMMAND_ID, parameters);<NEW_LINE>} else if (firstElement instanceof IGroup) {<NEW_LINE>// No-Op<NEW_LINE>} else if (firstElement instanceof Spec && ((Spec) firstElement).isCurrentSpec()) {<NEW_LINE>// No-op, do not re-open an open spec again.<NEW_LINE>} else {<NEW_LINE>UIHelper.runCommand(ToolboxExplorer.COMMAND_ID, new HashMap<String, String>());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ) firstElement).getModuleName()); |
464,734 | public static void vertical3(Kernel1D_S32 kernel, GrayS32 src, GrayS32 dst, int divisor, @Nullable GrowArray<DogArray_I32> workspaces) {<NEW_LINE>final int[] dataSrc = src.data;<NEW_LINE>final int[] dataDst = dst.data;<NEW_LINE>final int k1 = kernel.data[0];<NEW_LINE>final int k2 = kernel.data[1];<NEW_LINE>final int k3 = kernel.data[2];<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int imgWidth = dst.getWidth();<NEW_LINE>final int imgHeight = dst.getHeight();<NEW_LINE>final int halfDivisor = divisor / 2;<NEW_LINE>final int yEnd = imgHeight - radius;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(radius, yEnd, y -> {<NEW_LINE>for (int y = radius; y < yEnd; y++) {<NEW_LINE>int indexDst = dst.startIndex + y * dst.stride;<NEW_LINE>int i = src.startIndex + (y - radius) * src.stride;<NEW_LINE>final int iEnd = i + imgWidth;<NEW_LINE>for (; i < iEnd; i++) {<NEW_LINE>int indexSrc = i;<NEW_LINE>int total = (dataSrc[indexSrc]) * k1;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += <MASK><NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc]) * k3;<NEW_LINE>dataDst[indexDst++] = ((total + halfDivisor) / divisor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | (dataSrc[indexSrc]) * k2; |
872,175 | public List<Artifact> findAdditionalInputs(CppCompileAction action, ActionExecutionContext actionExecutionContext, IncludeScanningHeaderData includeScanningHeaderData) throws ExecException, InterruptedException {<NEW_LINE>Preconditions.checkNotNull(includeScannerSupplier, action);<NEW_LINE>Set<Artifact> includes = Sets.newConcurrentHashSet();<NEW_LINE>includes.addAll(action.getBuiltInIncludeFiles());<NEW_LINE>// Deduplicate include directories. This can occur especially with "built-in" and "system"<NEW_LINE>// include directories because of the way we retrieve them. Duplicate include directories<NEW_LINE>// really mess up #include_next directives.<NEW_LINE>Set<PathFragment> includeDirs = new LinkedHashSet<>(action.getIncludeDirs());<NEW_LINE>List<PathFragment<MASK><NEW_LINE>List<PathFragment> frameworkIncludeDirs = action.getFrameworkIncludeDirs();<NEW_LINE>List<String> cmdlineIncludes = includeScanningHeaderData.getCmdlineIncludes();<NEW_LINE>includeDirs.addAll(includeScanningHeaderData.getSystemIncludeDirs());<NEW_LINE>// Add the system include paths to the list of include paths.<NEW_LINE>List<PathFragment> absoluteBuiltInIncludeDirs = new ArrayList<>();<NEW_LINE>for (PathFragment pathFragment : action.getBuiltInIncludeDirectories()) {<NEW_LINE>if (pathFragment.isAbsolute()) {<NEW_LINE>absoluteBuiltInIncludeDirs.add(pathFragment);<NEW_LINE>}<NEW_LINE>includeDirs.add(pathFragment);<NEW_LINE>}<NEW_LINE>List<PathFragment> includeDirList = ImmutableList.copyOf(includeDirs);<NEW_LINE>IncludeScanner scanner = includeScannerSupplier.get().scannerFor(quoteIncludeDirs, includeDirList, frameworkIncludeDirs);<NEW_LINE>Artifact mainSource = action.getMainIncludeScannerSource();<NEW_LINE>Collection<Artifact> sources = action.getIncludeScannerSources();<NEW_LINE>try (SilentCloseable c = Profiler.instance().profile(ProfilerTask.SCANNER, action.getSourceFile().getExecPathString())) {<NEW_LINE>scanner.processAsync(mainSource, sources, includeScanningHeaderData, cmdlineIncludes, includes, action, actionExecutionContext, action.getGrepIncludes());<NEW_LINE>if (actionExecutionContext.getEnvironmentForDiscoveringInputs().valuesMissing()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return collect(actionExecutionContext, includes, absoluteBuiltInIncludeDirs);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new EnvironmentalExecException(e, createFailureDetail("Include scanning IOException", Code.SCANNING_IO_EXCEPTION));<NEW_LINE>} catch (NoSuchPackageException e) {<NEW_LINE>throw new EnvironmentalExecException(e, createFailureDetail("Error for BUILD file during include scanning: " + e.getMessage(), Code.PACKAGE_LOAD_FAILURE));<NEW_LINE>}<NEW_LINE>} | > quoteIncludeDirs = action.getQuoteIncludeDirs(); |
1,591,345 | public void marshall(WeeklyAutoScalingSchedule weeklyAutoScalingSchedule, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (weeklyAutoScalingSchedule == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(weeklyAutoScalingSchedule.getMonday(), MONDAY_BINDING);<NEW_LINE>protocolMarshaller.marshall(weeklyAutoScalingSchedule.getTuesday(), TUESDAY_BINDING);<NEW_LINE>protocolMarshaller.marshall(weeklyAutoScalingSchedule.getWednesday(), WEDNESDAY_BINDING);<NEW_LINE>protocolMarshaller.marshall(weeklyAutoScalingSchedule.getThursday(), THURSDAY_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(weeklyAutoScalingSchedule.getSaturday(), SATURDAY_BINDING);<NEW_LINE>protocolMarshaller.marshall(weeklyAutoScalingSchedule.getSunday(), SUNDAY_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | weeklyAutoScalingSchedule.getFriday(), FRIDAY_BINDING); |
1,043,208 | public static List<String> listByRegex(String directory, String regex) {<NEW_LINE>List<String> ret = new ArrayList<>();<NEW_LINE>File d = new File(directory);<NEW_LINE>if (!d.isDirectory()) {<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>if (url.getProtocol().equals("file")) {<NEW_LINE>d = new File(url.getFile());<NEW_LINE>} else if (url.getProtocol().equals("jar")) {<NEW_LINE>return listJarRegex(url, regex);<NEW_LINE>}<NEW_LINE>} catch (MalformedURLException ignore) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!d.isDirectory())<NEW_LINE>throw new IllegalArgumentException("Must specify an directory. " + directory);<NEW_LINE>File[] files = d.listFiles();<NEW_LINE>for (File f : files) {<NEW_LINE>if (f.isDirectory() || f.isHidden())<NEW_LINE>continue;<NEW_LINE>if (f.getName().matches(regex)) {<NEW_LINE>ret.add(f.getAbsolutePath());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} | URL url = new URL(directory); |
1,088,771 | public void mergeTrackable(final Trackable newTrackable) {<NEW_LINE>guid = StringUtils.defaultIfEmpty(newTrackable.guid, guid);<NEW_LINE>geocode = StringUtils.defaultIfEmpty(newTrackable.geocode, geocode);<NEW_LINE>iconUrl = StringUtils.defaultIfEmpty(newTrackable.iconUrl, iconUrl);<NEW_LINE>name = StringUtils.defaultIfEmpty(newTrackable.name, name);<NEW_LINE>type = ObjectUtils.defaultIfNull(newTrackable.type, type);<NEW_LINE>released = ObjectUtils.defaultIfNull(newTrackable.released, released);<NEW_LINE>logDate = ObjectUtils.defaultIfNull(newTrackable.logDate, logDate);<NEW_LINE>logType = ObjectUtils.defaultIfNull(newTrackable.logType, logType);<NEW_LINE>logGuid = ObjectUtils.defaultIfNull(newTrackable.logGuid, logGuid);<NEW_LINE>distance = newTrackable.distance == -1 ? distance : newTrackable.distance;<NEW_LINE>origin = ObjectUtils.defaultIfNull(newTrackable.origin, origin);<NEW_LINE>owner = ObjectUtils.defaultIfNull(newTrackable.owner, owner);<NEW_LINE>ownerGuid = ObjectUtils.defaultIfNull(newTrackable.ownerGuid, ownerGuid);<NEW_LINE>spottedName = ObjectUtils.defaultIfNull(newTrackable.spottedName, spottedName);<NEW_LINE>spottedType = newTrackable.spottedType == SPOTTED_UNSET ? spottedType : newTrackable.spottedType;<NEW_LINE>spottedGuid = ObjectUtils.defaultIfNull(newTrackable.spottedGuid, spottedGuid);<NEW_LINE>goal = ObjectUtils.<MASK><NEW_LINE>details = ObjectUtils.defaultIfNull(newTrackable.details, details);<NEW_LINE>image = ObjectUtils.defaultIfNull(newTrackable.image, image);<NEW_LINE>mergeLogEntry(newTrackable.logs);<NEW_LINE>trackingcode = ObjectUtils.defaultIfNull(newTrackable.trackingcode, trackingcode);<NEW_LINE>brand = ObjectUtils.defaultIfNull(newTrackable.brand, brand);<NEW_LINE>trackableConnector = ObjectUtils.defaultIfNull(newTrackable.trackableConnector, trackableConnector);<NEW_LINE>missing = ObjectUtils.defaultIfNull(newTrackable.missing, missing);<NEW_LINE>} | defaultIfNull(newTrackable.goal, goal); |
1,380,065 | public void restoreAuthSystemState() {<NEW_LINE>Boolean previousState;<NEW_LINE>try {<NEW_LINE>previousState = authStateChangeHistory.pop();<NEW_LINE>} catch (NoSuchElementException ex) {<NEW_LINE>log.warn(LogHelper.getHeader(this, "restore_auth_sys_state", "not previous state info available: {}"), ex::getLocalizedMessage);<NEW_LINE>previousState = Boolean.FALSE;<NEW_LINE>}<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>Thread currThread = Thread.currentThread();<NEW_LINE>StackTraceElement[] stackTrace = currThread.getStackTrace();<NEW_LINE>String caller = stackTrace[stackTrace.<MASK><NEW_LINE>String previousCaller;<NEW_LINE>try {<NEW_LINE>previousCaller = (String) authStateClassCallHistory.pop();<NEW_LINE>} catch (NoSuchElementException ex) {<NEW_LINE>previousCaller = "none";<NEW_LINE>log.warn(LogHelper.getHeader(this, "restore_auth_sys_state", "no previous caller info available: {}"), ex::getLocalizedMessage);<NEW_LINE>}<NEW_LINE>// if previousCaller is not the current caller *only* log a warning<NEW_LINE>if (!previousCaller.equals(caller)) {<NEW_LINE>log.warn(LogHelper.getHeader(this, "restore_auth_sys_state", "Class: " + caller + " call restore but previous state change made by " + previousCaller));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ignoreAuth = previousState;<NEW_LINE>} | length - 1].getClassName(); |
247,586 | private RexNode buildJoinCondition(RelNode convertedLeft, RelNode convertedRight, List<Integer> leftKeys, List<Integer> rightKeys, List<Boolean> filterNulls, RexBuilder builder) {<NEW_LINE>List<RexNode> equijoinList = Lists.newArrayList();<NEW_LINE>final int numLeftFields = convertedLeft.getRowType().getFieldCount();<NEW_LINE>List<RelDataTypeField> leftTypes = convertedLeft.getRowType().getFieldList();<NEW_LINE>List<RelDataTypeField> rightTypes = convertedRight.getRowType().getFieldList();<NEW_LINE>for (int i = 0; i < leftKeys.size(); i++) {<NEW_LINE>int leftKeyOrdinal = leftKeys.get(i);<NEW_LINE>int <MASK><NEW_LINE>equijoinList.add(builder.makeCall(filterNulls.get(i) ? SqlStdOperatorTable.EQUALS : SqlStdOperatorTable.IS_NOT_DISTINCT_FROM, builder.makeInputRef(leftTypes.get(leftKeyOrdinal).getType(), leftKeyOrdinal), builder.makeInputRef(rightTypes.get(rightKeyOrdinal).getType(), rightKeyOrdinal + numLeftFields)));<NEW_LINE>}<NEW_LINE>return RexUtil.composeConjunction(builder, equijoinList, false);<NEW_LINE>} | rightKeyOrdinal = rightKeys.get(i); |
1,528,197 | public void onBindViewHolder(ViewHolder holder, int position) {<NEW_LINE>if (holder.isFoot()) {<NEW_LINE>holder.count = getItemCount();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (holder.isHeader()) {<NEW_LINE>if (userData.isNewHeaderValid()) {<NEW_LINE>Size size = userData.getHeaderSize(position);<NEW_LINE><MASK><NEW_LINE>if (cellView != null) {<NEW_LINE>setLayoutParams(cellView, size);<NEW_LINE>}<NEW_LINE>userData.callFillDataHeader(holder.getCell(), position);<NEW_LINE>checkMargin(holder.getCellView());<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (userData.checkCanDoBind())<NEW_LINE>return;<NEW_LINE>int hs = getHeaderCount();<NEW_LINE>if (userData.hasCellSize()) {<NEW_LINE>Size size = userData.getCellSize(position - hs);<NEW_LINE>View cellView = holder.getCellView();<NEW_LINE>if (cellView != null) {<NEW_LINE>setLayoutParams(cellView, size);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (canCallFillCell || !MLSConfigs.lazyFillCellData) {<NEW_LINE>if (MLSEngine.DEBUG) {<NEW_LINE>long now = System.currentTimeMillis();<NEW_LINE>userData.callFillDataCell(holder.getCell(), position - hs);<NEW_LINE>// LogUtil.e("Adapter---fill data cast: " + (System.currentTimeMillis() - now) + " position: " + position);<NEW_LINE>} else {<NEW_LINE>userData.callFillDataCell(holder.getCell(), position - hs);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (lazyTasks == null) {<NEW_LINE>lazyTasks = new HashMap<>();<NEW_LINE>}<NEW_LINE>lazyTasks.put(holder, position - hs);<NEW_LINE>}<NEW_LINE>holder.setOnClickListener(userData.getClickListener(holder.getCell(), position - hs));<NEW_LINE>holder.setOnLongClickListener(userData.getLongClickListener(holder.getCell(), position - hs));<NEW_LINE>checkMargin(holder.getCellView());<NEW_LINE>setSelector(holder.itemView);<NEW_LINE>} | View cellView = holder.getCellView(); |
1,614,116 | public void invoke(@NotNull String line, @NotNull Repl api, @NotNull Supplier<@NotNull String> scanner) throws QuitReplException {<NEW_LINE>Concrete.Expression expr = api.preprocessExpr(line);<NEW_LINE>if (api.checkErrors() || expr == null)<NEW_LINE>return;<NEW_LINE>if (expr instanceof Concrete.ReferenceExpression && ((Concrete.ReferenceExpression) expr).getReferent() instanceof TCDefReferable) {<NEW_LINE>Definition def = ((TCDefReferable) ((Concrete.ReferenceExpression) expr).getReferent()).getTypechecked();<NEW_LINE>if (def == null) {<NEW_LINE>api.eprintln("[ERROR] Definition was not typechecked yet");<NEW_LINE>} else {<NEW_LINE>api.println(SizeExpressionVisitor.getSize(def));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>api.checkExpr(expr, null, result -> {<NEW_LINE>if (result != null)<NEW_LINE>api.println(SizeExpressionVisitor<MASK><NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | .getSize(result.expression)); |
339,474 | public void visit(BLangFail failNode, AnalyzerData data) {<NEW_LINE>data.failVisited = true;<NEW_LINE>analyzeExpr(failNode.expr, data);<NEW_LINE>if (data.env.scope.owner.getKind() == SymbolKind.PACKAGE) {<NEW_LINE>// Check at module level.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>typeChecker.checkExpr(<MASK><NEW_LINE>if (!data.errorTypes.empty()) {<NEW_LINE>data.errorTypes.peek().add(getErrorTypes(failNode.expr.getBType()));<NEW_LINE>}<NEW_LINE>if (!data.failureHandled) {<NEW_LINE>BType exprType = data.env.enclInvokable.getReturnTypeNode().getBType();<NEW_LINE>data.returnTypes.peek().add(exprType);<NEW_LINE>if (!types.isAssignable(getErrorTypes(failNode.expr.getBType()), exprType)) {<NEW_LINE>dlog.error(failNode.pos, DiagnosticErrorCode.FAIL_EXPR_NO_MATCHING_ERROR_RETURN_IN_ENCL_INVOKABLE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | failNode.expr, data.env); |
13,339 | public void run() {<NEW_LINE>try {<NEW_LINE>Thread.sleep(10);<NEW_LINE>} catch (InterruptedException e1) {<NEW_LINE>}<NEW_LINE>// Utils.platformLog("@@@@ ZebraPrinterBluetoothConnect Address :", mAdress);<NEW_LINE>BluetoothConnection connection = new BluetoothConnection(mAdress);<NEW_LINE>String zAdr = connection.toString();<NEW_LINE>IPrinterDevice p = getPrinterByZebraAdress(zAdr);<NEW_LINE>if (p != null) {<NEW_LINE>// Utils.platformLog("@@@@ ZebraPrinterBluetoothConnect :", "return printer from list");<NEW_LINE>mListener.onFound(p.getID());<NEW_LINE>mListener.onFinished();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>connection.open();<NEW_LINE>// Utils.platformLog("@@@@ ZebraPrinterBluetoothConnect try{ :", "open passed");<NEW_LINE>connection.close();<NEW_LINE>// Utils.platformLog("@@@@ ZebraPrinterBluetoothConnect try{ :", "close passed");<NEW_LINE>Connection c = connection;<NEW_LINE>String adr = null;<NEW_LINE>if (c instanceof TcpConnection) {<NEW_LINE>adr = ((<MASK><NEW_LINE>}<NEW_LINE>if (c instanceof BluetoothConnection) {<NEW_LINE>adr = ((BluetoothConnection) c).getMACAddress();<NEW_LINE>}<NEW_LINE>// Utils.platformLog("@@@@ ZebraPrinterBluetoothConnect try{ adr:", adr);<NEW_LINE>ZebraPrinterImpl printer = new ZebraPrinterImpl("ZEBRA_PRINTER_" + String.valueOf(ourCounter++), connection, zAdr, adr, null);<NEW_LINE>mPrinters.add(printer);<NEW_LINE>// Utils.platformLog("@@@@ ZebraPrinterBluetoothConnect try{ :", "new printer created");<NEW_LINE>mListener.onFound(printer.getID());<NEW_LINE>mListener.onFinished();<NEW_LINE>} catch (ConnectionException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>mListener.onNotConnected("cannot connect to defined Bluetooth adress: [" + mAdress + "]");<NEW_LINE>}<NEW_LINE>} | TcpConnection) c).getAddress(); |
1,767,022 | private void copyResourceFiles(String oldTenantCode, String newTenantCode, ResourceComponent resourceComponent, String srcBasePath, String dstBasePath) {<NEW_LINE>List<ResourceComponent> components = resourceComponent.getChildren();<NEW_LINE>try {<NEW_LINE>if (CollectionUtils.isNotEmpty(components)) {<NEW_LINE>for (ResourceComponent component : components) {<NEW_LINE>// verify whether exist<NEW_LINE>if (!storageOperate.exists(oldTenantCode, String.format(Constants.FORMAT_S_S, srcBasePath, component.getFullName()))) {<NEW_LINE>logger.error("resource file: {} not exist,copy error", component.getFullName());<NEW_LINE>throw new ServiceException(Status.RESOURCE_NOT_EXIST);<NEW_LINE>}<NEW_LINE>if (!component.isDirctory()) {<NEW_LINE>// copy it to dst<NEW_LINE>storageOperate.copy(String.format(Constants.FORMAT_S_S, srcBasePath, component.getFullName()), String.format(Constants.FORMAT_S_S, dstBasePath, component.getFullName()), false, true);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (CollectionUtils.isEmpty(component.getChildren())) {<NEW_LINE>// if not exist,need create it<NEW_LINE>if (!storageOperate.exists(oldTenantCode, String.format(Constants.FORMAT_S_S, dstBasePath, component.getFullName()))) {<NEW_LINE>storageOperate.mkdir(newTenantCode, String.format(Constants.FORMAT_S_S, dstBasePath, component.getFullName()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>copyResourceFiles(oldTenantCode, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.error("copy the resources failed,the error message is {}", e.getMessage());<NEW_LINE>}<NEW_LINE>} | newTenantCode, component, srcBasePath, dstBasePath); |
51,853 | public boolean onTouch(View view, MotionEvent motionEvent) {<NEW_LINE>int pointerIndex = motionEvent.getActionIndex();<NEW_LINE>int <MASK><NEW_LINE>FingerPosition position;<NEW_LINE>switch(motionEvent.getActionMasked()) {<NEW_LINE>case MotionEvent.ACTION_DOWN:<NEW_LINE>// Paranoia mode, if it's the first finger down make sure that we're in a clean slate<NEW_LINE>fingerPositions.clear();<NEW_LINE>// fall-through<NEW_LINE>case MotionEvent.ACTION_POINTER_DOWN:<NEW_LINE>position = new FingerPosition(motionEvent.getX(pointerIndex), motionEvent.getY(pointerIndex));<NEW_LINE>fingerPositions.put(pointerId, position);<NEW_LINE>break;<NEW_LINE>case MotionEvent.ACTION_MOVE:<NEW_LINE>// When the action is MotionEvent.ACTION_MOVE, the action index is meaningless, it is<NEW_LINE>// always the original pointer from ACTION_DOWN, you have to iterate through all of them<NEW_LINE>// because they all could contain updates.<NEW_LINE>for (int i = 0; i < motionEvent.getPointerCount(); i++) {<NEW_LINE>int movedPointerId = motionEvent.getPointerId(i);<NEW_LINE>position = fingerPositions.get(movedPointerId);<NEW_LINE>position.setCurrentPosition(motionEvent.getX(i), motionEvent.getY(i));<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case MotionEvent.ACTION_UP:<NEW_LINE>boolean correctlySwiped = fingerPositions.size() == numberOfFingers;<NEW_LINE>for (int i = 0; i < fingerPositions.size() && correctlySwiped; i++) {<NEW_LINE>if (!fingerPositions.valueAt(i).movedInDirectionPastThreshold(direction)) {<NEW_LINE>correctlySwiped = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (correctlySwiped) {<NEW_LINE>remixerFragment.showRemixer(fragmentManager, RemixerFragment.REMIXER_TAG);<NEW_LINE>}<NEW_LINE>// fall-through<NEW_LINE>case MotionEvent.ACTION_CANCEL:<NEW_LINE>fingerPositions.clear();<NEW_LINE>break;<NEW_LINE>case MotionEvent.ACTION_POINTER_UP:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | pointerId = motionEvent.getPointerId(pointerIndex); |
736,432 | private void reflowTableLayout(com.codename1.ui.Container parent) {<NEW_LINE>// we need to re-add all the components to the table layout since order only<NEW_LINE>// affects the layout initially<NEW_LINE>if (parent.getLayout() instanceof com.codename1.ui.table.TableLayout) {<NEW_LINE>List<com.codename1.ui.Component> cmpList = new ArrayList<com.codename1.ui.Component>();<NEW_LINE>List constraintList = new ArrayList();<NEW_LINE>for (int iter = 0; iter < parent.getComponentCount(); iter++) {<NEW_LINE>com.codename1.ui.Component currentCmp = parent.getComponentAt(iter);<NEW_LINE>cmpList.add(currentCmp);<NEW_LINE>constraintList.add(parent.getLayout().getComponentConstraint(currentCmp));<NEW_LINE>}<NEW_LINE>parent.removeAll();<NEW_LINE>for (int iter = 0; iter < cmpList.size(); iter++) {<NEW_LINE>parent.addComponent(constraintList.get(iter)<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , cmpList.get(iter)); |
1,135,271 | public static DescribeGatewayNFSClientsResponse unmarshall(DescribeGatewayNFSClientsResponse describeGatewayNFSClientsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeGatewayNFSClientsResponse.setRequestId(_ctx.stringValue("DescribeGatewayNFSClientsResponse.RequestId"));<NEW_LINE>describeGatewayNFSClientsResponse.setVersion40Enabled(_ctx.booleanValue("DescribeGatewayNFSClientsResponse.Version40Enabled"));<NEW_LINE>describeGatewayNFSClientsResponse.setVersion41Enabled(_ctx.booleanValue("DescribeGatewayNFSClientsResponse.Version41Enabled"));<NEW_LINE>describeGatewayNFSClientsResponse.setTotalCount<MASK><NEW_LINE>describeGatewayNFSClientsResponse.setMessage(_ctx.stringValue("DescribeGatewayNFSClientsResponse.Message"));<NEW_LINE>describeGatewayNFSClientsResponse.setPageSize(_ctx.integerValue("DescribeGatewayNFSClientsResponse.PageSize"));<NEW_LINE>describeGatewayNFSClientsResponse.setPageNumber(_ctx.integerValue("DescribeGatewayNFSClientsResponse.PageNumber"));<NEW_LINE>describeGatewayNFSClientsResponse.setVersion3Enabled(_ctx.booleanValue("DescribeGatewayNFSClientsResponse.Version3Enabled"));<NEW_LINE>describeGatewayNFSClientsResponse.setCode(_ctx.stringValue("DescribeGatewayNFSClientsResponse.Code"));<NEW_LINE>describeGatewayNFSClientsResponse.setSuccess(_ctx.booleanValue("DescribeGatewayNFSClientsResponse.Success"));<NEW_LINE>List<ClientInfo> clientInfoList = new ArrayList<ClientInfo>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeGatewayNFSClientsResponse.ClientInfoList.Length"); i++) {<NEW_LINE>ClientInfo clientInfo = new ClientInfo();<NEW_LINE>clientInfo.setHasNFSv40(_ctx.booleanValue("DescribeGatewayNFSClientsResponse.ClientInfoList[" + i + "].HasNFSv40"));<NEW_LINE>clientInfo.setHasNFSv41(_ctx.booleanValue("DescribeGatewayNFSClientsResponse.ClientInfoList[" + i + "].HasNFSv41"));<NEW_LINE>clientInfo.setHasNFSv3(_ctx.booleanValue("DescribeGatewayNFSClientsResponse.ClientInfoList[" + i + "].HasNFSv3"));<NEW_LINE>clientInfo.setClientIpAddr(_ctx.stringValue("DescribeGatewayNFSClientsResponse.ClientInfoList[" + i + "].ClientIpAddr"));<NEW_LINE>clientInfoList.add(clientInfo);<NEW_LINE>}<NEW_LINE>describeGatewayNFSClientsResponse.setClientInfoList(clientInfoList);<NEW_LINE>return describeGatewayNFSClientsResponse;<NEW_LINE>} | (_ctx.integerValue("DescribeGatewayNFSClientsResponse.TotalCount")); |
1,338,495 | public void actionPerformed(ActionEvent evt) {<NEW_LINE>String err = "";<NEW_LINE>try {<NEW_LINE>if (controller != null) {<NEW_LINE>setStatus("");<NEW_LINE><MASK><NEW_LINE>if (source == clearButton) {<NEW_LINE>// additionally clear the text area<NEW_LINE>err = "when clearing the views ";<NEW_LINE>messageLogger.clear();<NEW_LINE>statusLabel.setText("");<NEW_LINE>controller.clear();<NEW_LINE>} else if (source == prepareButton) {<NEW_LINE>err = "when preparing simulation ";<NEW_LINE>controller.prepare(null);<NEW_LINE>} else if (source == runButton) {<NEW_LINE>err = "when running simulation ";<NEW_LINE>setStatus("");<NEW_LINE>setSimulationThread(new SimulationThread(AgentAppFrame.this, controller, false));<NEW_LINE>getSimulationThread().start();<NEW_LINE>} else if (source == stepButton) {<NEW_LINE>err = "when executing simulation step ";<NEW_LINE>setStatus("");<NEW_LINE>setSimulationThread(new SimulationThread(AgentAppFrame.this, controller, true));<NEW_LINE>getSimulationThread().start();<NEW_LINE>} else if (source == cancelButton) {<NEW_LINE>err = "when canceling simulation ";<NEW_LINE>SimulationThread at = getSimulationThread();<NEW_LINE>if (at != null) {<NEW_LINE>if (!at.isCancelled()) {<NEW_LINE>at.interrupt();<NEW_LINE>} else {<NEW_LINE>// agent has ignored the interrupt<NEW_LINE>at.stop();<NEW_LINE>setStatus("Task stopped.");<NEW_LINE>setSimulationThread(null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (selectors.combos.contains(source)) {<NEW_LINE>err = "when preparing the agent ";<NEW_LINE>selectionChanged(selectors.getName((JComboBox<Object>) source));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>messageLogger.log("Error: Something went wrong " + err + "(" + e + ").");<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>updateEnabledState();<NEW_LINE>} | Object source = evt.getSource(); |
1,768,139 | private void lookupTabletLocation(ClientContext context, Text row, boolean retry, LockCheckerSession lcSession) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {<NEW_LINE>Text metadataRow = new Text(tableId.canonical());<NEW_LINE>metadataRow.append(new byte[] <MASK><NEW_LINE>metadataRow.append(row.getBytes(), 0, row.getLength());<NEW_LINE>TabletLocation ptl = parent.locateTablet(context, metadataRow, false, retry);<NEW_LINE>if (ptl != null) {<NEW_LINE>TabletLocations locations = locationObtainer.lookupTablet(context, ptl, metadataRow, lastTabletRow, parent);<NEW_LINE>while (locations != null && locations.getLocations().isEmpty() && locations.getLocationless().isEmpty()) {<NEW_LINE>// try the next tablet, the current tablet does not have any tablets that overlap the row<NEW_LINE>Text er = ptl.tablet_extent.endRow();<NEW_LINE>if (er != null && er.compareTo(lastTabletRow) < 0) {<NEW_LINE>// System.out.println("er "+er+" ltr "+lastTabletRow);<NEW_LINE>ptl = parent.locateTablet(context, er, true, retry);<NEW_LINE>if (ptl != null)<NEW_LINE>locations = locationObtainer.lookupTablet(context, ptl, metadataRow, lastTabletRow, parent);<NEW_LINE>else<NEW_LINE>break;<NEW_LINE>} else {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (locations == null)<NEW_LINE>return;<NEW_LINE>// cannot assume the list contains contiguous key extents... so it is probably<NEW_LINE>// best to deal with each extent individually<NEW_LINE>Text lastEndRow = null;<NEW_LINE>for (TabletLocation tabletLocation : locations.getLocations()) {<NEW_LINE>KeyExtent ke = tabletLocation.tablet_extent;<NEW_LINE>TabletLocation locToCache;<NEW_LINE>// create new location if current prevEndRow == endRow<NEW_LINE>if ((lastEndRow != null) && (ke.prevEndRow() != null) && ke.prevEndRow().equals(lastEndRow)) {<NEW_LINE>locToCache = new TabletLocation(new KeyExtent(ke.tableId(), ke.endRow(), lastEndRow), tabletLocation.tablet_location, tabletLocation.tablet_session);<NEW_LINE>} else {<NEW_LINE>locToCache = tabletLocation;<NEW_LINE>}<NEW_LINE>// save endRow for next iteration<NEW_LINE>lastEndRow = locToCache.tablet_extent.endRow();<NEW_LINE>updateCache(locToCache, lcSession);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | { ';' }, 0, 1); |
1,716,416 | public DescribeVoicesResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DescribeVoicesResult describeVoicesResult = new DescribeVoicesResult();<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 describeVoicesResult;<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("Voices", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeVoicesResult.setVoices(new ListUnmarshaller<Voice>(VoiceJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeVoicesResult.setNextToken(context.getUnmarshaller(String.<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 describeVoicesResult;<NEW_LINE>} | class).unmarshall(context)); |
1,786,186 | private void updateMultiselectMenu() {<NEW_LINE>Timber.d("updateMultiselectMenu()");<NEW_LINE>if (mActionBarMenu == null || mActionBarMenu.findItem(R.id.action_suspend_card) == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!mCheckedCards.isEmpty()) {<NEW_LINE>TaskManager.cancelAllTasks(CollectionTask.CheckCardSelection.class);<NEW_LINE>TaskManager.launchCollectionTask(new CollectionTask.CheckCardSelection(mCheckedCards), mCheckSelectedCardsHandler);<NEW_LINE>}<NEW_LINE>mActionBarMenu.findItem(R.id.action_select_all)<MASK><NEW_LINE>// Note: Theoretically should not happen, as this should kick us back to the menu<NEW_LINE>mActionBarMenu.findItem(R.id.action_select_none).setVisible(hasSelectedCards());<NEW_LINE>mActionBarMenu.findItem(R.id.action_edit_note).setVisible(canPerformMultiSelectEditNote());<NEW_LINE>mActionBarMenu.findItem(R.id.action_view_card_info).setVisible(canPerformCardInfo());<NEW_LINE>} | .setVisible(!hasSelectedAllCards()); |
1,569,880 | public GuardingNode createGuard(FixedNode before, LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, Speculation speculation, boolean negated, NodeSourcePosition noDeoptSucccessorPosition) {<NEW_LINE>StructuredGraph graph = before.graph();<NEW_LINE>if (OptEliminateGuards.getValue(graph.getOptions())) {<NEW_LINE>for (Node usage : condition.usages()) {<NEW_LINE>if (!activeGuards.isNew(usage) && activeGuards.isMarked(usage) && ((GuardNode) usage).isNegated() == negated && (before.graph().isAfterStage(StageFlag.VALUE_PROXY_REMOVAL) || nodeMap.get(((GuardNode) usage).getAnchor().asNode()).isInSameOrOuterLoopOf(nodeMap.get(before)))) {<NEW_LINE>return (GuardNode) usage;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!condition.graph().getGuardsStage().allowsFloatingGuards()) {<NEW_LINE>FixedGuardNode fixedGuard = graph.add(new FixedGuardNode(condition, deoptReason, action, speculation, negated, noDeoptSucccessorPosition));<NEW_LINE>graph.addBeforeFixed(before, fixedGuard);<NEW_LINE>DummyGuardHandle handle = graph.add(new DummyGuardHandle(fixedGuard));<NEW_LINE>fixedGuard.lower(this);<NEW_LINE><MASK><NEW_LINE>handle.safeDelete();<NEW_LINE>return result;<NEW_LINE>} else {<NEW_LINE>GuardNode newGuard = graph.unique(new GuardNode(condition, guardAnchor, deoptReason, action, negated, speculation, noDeoptSucccessorPosition));<NEW_LINE>if (OptEliminateGuards.getValue(graph.getOptions())) {<NEW_LINE>activeGuards.markAndGrow(newGuard);<NEW_LINE>}<NEW_LINE>return newGuard;<NEW_LINE>}<NEW_LINE>} | GuardingNode result = handle.getGuard(); |
1,772,872 | public AlarmNotification unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AlarmNotification alarmNotification = new AlarmNotification();<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("notificationActions", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>alarmNotification.setNotificationActions(new ListUnmarshaller<NotificationAction>(NotificationActionJsonUnmarshaller.getInstance()).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 alarmNotification;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,262,017 | public void run(Objectify datastore) throws ObjectifyException {<NEW_LINE>UserData userData = null;<NEW_LINE>if (user.getId() != null) {<NEW_LINE>userData = datastore.find(userKey(user.getId()));<NEW_LINE>}<NEW_LINE>if (userData != null) {<NEW_LINE>userData.email = user.getEmail();<NEW_LINE>userData.emaillower = userData.email.toLowerCase();<NEW_LINE>String password = user.getPassword();<NEW_LINE>if (password != null && !password.equals("")) {<NEW_LINE>userData.password = user.getPassword();<NEW_LINE>}<NEW_LINE>userData.isAdmin = user.getIsAdmin();<NEW_LINE>datastore.put(userData);<NEW_LINE>} else {<NEW_LINE>// New User<NEW_LINE>String emaillower = user.getEmail().toLowerCase();<NEW_LINE>// Need an instance not in this transaction<NEW_LINE>Objectify qDatastore = ObjectifyService.begin();<NEW_LINE>UserData tuser = qDatastore.query(UserData.class).filter("email", emaillower).get();<NEW_LINE>if (tuser != null) {<NEW_LINE>// This is a total kludge, but we have to do things this way because of<NEW_LINE>// how runJobWithRetries works<NEW_LINE>throw new ObjectifyException("User Already exists = " + user.getEmail());<NEW_LINE>}<NEW_LINE>userData = new UserData();<NEW_LINE>userData.id = UUID.randomUUID().toString();<NEW_LINE>userData.tosAccepted = false;<NEW_LINE>userData.settings = "";<NEW_LINE>userData.email = user.getEmail();<NEW_LINE>userData.emaillower = emaillower;<NEW_LINE>if (!user.getPassword().equals("")) {<NEW_LINE>userData.password = user.getPassword();<NEW_LINE>}<NEW_LINE>userData<MASK><NEW_LINE>datastore.put(userData);<NEW_LINE>}<NEW_LINE>} | .isAdmin = user.getIsAdmin(); |
710,204 | public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {<NEW_LINE>final StringBounder stringBounder = ug.getStringBounder();<NEW_LINE>final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);<NEW_LINE>if (geo.hasPointOut() == false) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Point2D p2 = getP2(stringBounder);<NEW_LINE>final Point2D p1 = geo.translate(translate(stringBounder)).getPointOut();<NEW_LINE>final Direction originalDirection = Direction.leftOrRight(p1, p2);<NEW_LINE>final double x1 = p1.getX();<NEW_LINE>final double x2 = p2.getX();<NEW_LINE>final Point2D mp1a = translate1.getTranslated(p1);<NEW_LINE>final Point2D mp2b = translate2.getTranslated(p2);<NEW_LINE>final Direction newDirection = Direction.leftOrRight(mp1a, mp2b);<NEW_LINE>final UPolygon arrow = x2 > x1 ? Arrows.asToRight() : Arrows.asToLeft();<NEW_LINE>if (originalDirection == newDirection) {<NEW_LINE>final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Hexagon.hexagonHalfSize;<NEW_LINE>final Point2D mp2bc = new Point2D.Double(mp2b.getX() + delta, mp2b.getY());<NEW_LINE>final Snake snake = Snake.create(skinParam(), myArrowColor).withMerge(MergeStrategy.LIMITED);<NEW_LINE>final double middle = (mp1a.getY() + mp2b.getY()) / 2.0;<NEW_LINE>snake.addPoint(mp1a);<NEW_LINE>snake.addPoint(mp1a.getX(), middle);<NEW_LINE>snake.addPoint(mp2bc.getX(), middle);<NEW_LINE>snake.addPoint(mp2bc);<NEW_LINE>ug.draw(snake);<NEW_LINE>final Snake small = Snake.create(skinParam(), myArrowColor, arrow).withMerge(MergeStrategy.LIMITED);<NEW_LINE>small.addPoint(mp2bc);<NEW_LINE>small.addPoint(mp2bc.getX(), mp2b.getY());<NEW_LINE>small.addPoint(mp2b);<NEW_LINE>ug.draw(small);<NEW_LINE>} else {<NEW_LINE>final double delta = (x2 > x1 ? -1 : 1) * 1.5 * Hexagon.hexagonHalfSize;<NEW_LINE>final Point2D mp2bb = new Point2D.Double(mp2b.getX() + delta, mp2b.getY(<MASK><NEW_LINE>final Snake snake = Snake.create(skinParam(), myArrowColor).withMerge(MergeStrategy.LIMITED);<NEW_LINE>snake.addPoint(mp1a);<NEW_LINE>snake.addPoint(mp1a.getX(), mp2bb.getY());<NEW_LINE>snake.addPoint(mp2bb);<NEW_LINE>ug.draw(snake);<NEW_LINE>final Snake small = Snake.create(skinParam(), myArrowColor, arrow).withMerge(MergeStrategy.LIMITED);<NEW_LINE>small.addPoint(mp2bb);<NEW_LINE>small.addPoint(mp2bb.getX(), mp2b.getY());<NEW_LINE>small.addPoint(mp2b);<NEW_LINE>ug.draw(small);<NEW_LINE>}<NEW_LINE>} | ) - 1.5 * Hexagon.hexagonHalfSize); |
392,384 | private static int[] createSorted16BitInts(int howMany) {<NEW_LINE>long[<MASK><NEW_LINE>Arrays.fill(bitset, 0L);<NEW_LINE>int consumed = 0;<NEW_LINE>while (consumed < howMany) {<NEW_LINE>int value = RANDOM.nextInt(1 << 16);<NEW_LINE>long bit = (1L << value);<NEW_LINE>consumed += 1 - Long.bitCount(bitset[value >>> 6] & bit);<NEW_LINE>bitset[value >>> 6] |= bit;<NEW_LINE>}<NEW_LINE>int[] keys = new int[howMany];<NEW_LINE>int prefix = 0;<NEW_LINE>int k = 0;<NEW_LINE>for (int i = bitset.length - 1; i >= 0; --i) {<NEW_LINE>long word = bitset[i];<NEW_LINE>while (word != 0) {<NEW_LINE>keys[k++] = prefix + Long.numberOfTrailingZeros(word);<NEW_LINE>word ^= Long.lowestOneBit(word);<NEW_LINE>}<NEW_LINE>prefix += 64;<NEW_LINE>}<NEW_LINE>return keys;<NEW_LINE>} | ] bitset = bits.get(); |
1,558,181 | private MethodInvocation injectLogMethod(MethodInvocation node) {<NEW_LINE>ExecutableElement method = node.getExecutableElement();<NEW_LINE>TypeElement cls = ElementUtil.getDeclaringClass(method);<NEW_LINE>List<Expression> args = node.getArguments();<NEW_LINE>if (!args.isEmpty() && typeUtil.isSameType(args.get(0).getTypeMirror(), javaUtilLoggingLevelClass.asType())) {<NEW_LINE>// Change log to logp, insert class and method name args.<NEW_LINE>List<Expression> logpArgs = new ArrayList<>();<NEW_LINE>List<String> argTypes = new ArrayList<>();<NEW_LINE>logpArgs.add(args.get(0).copy());<NEW_LINE>argTypes.add("java.util.logging.Level");<NEW_LINE>logpArgs.add(enclosingClassLiteral(node));<NEW_LINE>argTypes.add("java.lang.String");<NEW_LINE>logpArgs.add(enclosingMethodLiteral(node));<NEW_LINE>argTypes.add("java.lang.String");<NEW_LINE>for (int i = 1; i < args.size(); i++) {<NEW_LINE>Expression arg = args.get(i);<NEW_LINE>logpArgs.add(arg.copy());<NEW_LINE>argTypes.add(TypeUtil.getQualifiedName<MASK><NEW_LINE>}<NEW_LINE>ExecutableElement injectedMethod = ElementUtil.findMethod(cls, LOGP_METHOD, argTypes.toArray(new String[0]));<NEW_LINE>if (injectedMethod != null) {<NEW_LINE>MethodInvocation injectedInvocation = new MethodInvocation(new ExecutablePair(injectedMethod), node.getExpression().copy());<NEW_LINE>for (int i = 0; i < logpArgs.size(); i++) {<NEW_LINE>injectedInvocation.addArgument(logpArgs.get(i));<NEW_LINE>}<NEW_LINE>return injectedInvocation;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return node.copy();<NEW_LINE>} | (arg.getTypeMirror())); |
1,192,970 | public String readReleaseInfo() {<NEW_LINE>try {<NEW_LINE>final String key = "PRETTY_NAME";<NEW_LINE>// available for all distributions<NEW_LINE>final String releaseInfo = "/etc/os-release";<NEW_LINE>final ProcessOutput output = <MASK><NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE>LOG.debug("Reading release info: " + getId());<NEW_LINE>if (!output.checkSuccess(LOG))<NEW_LINE>return null;<NEW_LINE>for (String line : output.getStdoutLines(true)) {<NEW_LINE>if (line.startsWith(key) && line.length() >= (key.length() + 1)) {<NEW_LINE>final String prettyName = line.substring(key.length() + 1);<NEW_LINE>return StringUtil.nullize(StringUtil.unquoteString(prettyName));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (ExecutionException e) {<NEW_LINE>LOG.warn(e);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | executeOnWsl(10000, "cat", releaseInfo); |
1,057,836 | protected void createTitleArea(Composite parent) {<NEW_LINE>((GridData) parent.getLayoutData()).heightHint = TITLE_HEIGHT;<NEW_LINE>Label titleImageLabel = new Label(parent, SWT.NONE);<NEW_LINE>titleImageLabel.setImage(getPopupShellImage(TITLE_HEIGHT));<NEW_LINE>Label titleTextLabel = new Label(parent, SWT.NONE);<NEW_LINE>titleTextLabel.setText(getPopupShellTitle());<NEW_LINE>titleTextLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));<NEW_LINE>titleTextLabel.setForeground(getTitleForeground());<NEW_LINE>titleTextLabel.setLayoutData(new GridData(SWT.FILL, SWT<MASK><NEW_LINE>titleTextLabel.setCursor(parent.getDisplay().getSystemCursor(SWT.CURSOR_HAND));<NEW_LINE>final Label button = new Label(parent, SWT.NONE);<NEW_LINE>button.setImage(DBeaverIcons.getImage(UIIcon.NOTIFICATION_CLOSE));<NEW_LINE>button.addMouseTrackListener(new MouseTrackAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void mouseEnter(MouseEvent e) {<NEW_LINE>button.setImage(DBeaverIcons.getImage(UIIcon.NOTIFICATION_CLOSE_HOVER));<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void mouseExit(MouseEvent e) {<NEW_LINE>button.setImage(DBeaverIcons.getImage(UIIcon.NOTIFICATION_CLOSE));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>button.addMouseListener(new MouseAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void mouseUp(MouseEvent e) {<NEW_LINE>close();<NEW_LINE>setReturnCode(CANCEL);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | .CENTER, true, true)); |
1,291,987 | public int detectIndentationLevel(IDocument document, int offset, boolean isSelection, IFormattingContext formattingContext) {<NEW_LINE>int indent = 0;<NEW_LINE>try {<NEW_LINE>// detect the indentation offset with the parser, only if the given offset is not the first one in the<NEW_LINE>// current partition.<NEW_LINE>ITypedRegion partition = document.getPartition(offset);<NEW_LINE>if (partition != null && partition.getOffset() == offset) {<NEW_LINE>return super.detectIndentationLevel(document, offset);<NEW_LINE>}<NEW_LINE>String source = document.get();<NEW_LINE>IParseRootNode parseResult = ParserPoolFactory.parse(getMainContentType(), source).getRootNode();<NEW_LINE>if (parseResult != null) {<NEW_LINE>final JSFormatterNodeBuilder builder = new JSFormatterNodeBuilder();<NEW_LINE>final FormatterDocument formatterDocument = createFormatterDocument(source, offset);<NEW_LINE>IFormatterContainerNode root = builder.build(parseResult, formatterDocument);<NEW_LINE>new JSFormatterNodeRewriter(parseResult, formatterDocument).rewrite(root);<NEW_LINE>IFormatterContext context = new JSFormatterContext(0);<NEW_LINE>FormatterIndentDetector detector = new FormatterIndentDetector(offset);<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>return detector.getLevel();<NEW_LINE>} catch (Exception e) {<NEW_LINE>// ignore<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>return super.detectIndentationLevel(document, offset);<NEW_LINE>}<NEW_LINE>return indent;<NEW_LINE>} | root.accept(context, detector); |
898,017 | public void init(boolean install) throws DesktopInitialisationException {<NEW_LINE>// Registers KDE specific commands.<NEW_LINE>try {<NEW_LINE>CommandManager.registerDefaultCommand(new Command(CommandManager.FILE_OPENER_ALIAS, FILE_OPENER, CommandType.SYSTEM_COMMAND, null));<NEW_LINE>CommandManager.registerDefaultCommand(new Command(CommandManager.URL_OPENER_ALIAS, FILE_OPENER, CommandType.SYSTEM_COMMAND, null));<NEW_LINE>CommandManager.registerDefaultCommand(new Command(CommandManager.EXE_OPENER_ALIAS, EXE_OPENER<MASK><NEW_LINE>CommandManager.registerDefaultCommand(new Command(CommandManager.FILE_MANAGER_ALIAS, FILE_OPENER, CommandType.SYSTEM_COMMAND, FILE_MANAGER_NAME));<NEW_LINE>} catch (CommandException e) {<NEW_LINE>throw new DesktopInitialisationException(e);<NEW_LINE>}<NEW_LINE>} | , CommandType.SYSTEM_COMMAND, null)); |
814,145 | private void sortedMerge(List<Integer> result, int start, int end, int[] sum) {<NEW_LINE>int mid = (start + end) / 2;<NEW_LINE>int i = sum[start];<NEW_LINE>int j = sum[mid + 1];<NEW_LINE>List<Integer> temp = new ArrayList<Integer>();<NEW_LINE>while (i < sum[mid + 1] && j < sum[end + 1]) {<NEW_LINE>if (result.get(i) < result.get(j)) {<NEW_LINE>temp.add(result.get(i));<NEW_LINE>i++;<NEW_LINE>} else {<NEW_LINE>temp.add<MASK><NEW_LINE>j++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>while (i < sum[mid + 1]) {<NEW_LINE>temp.add(result.get(i));<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>while (j < sum[end + 1]) {<NEW_LINE>temp.add(result.get(j));<NEW_LINE>j++;<NEW_LINE>}<NEW_LINE>int index = sum[start];<NEW_LINE>for (int k : temp) {<NEW_LINE>result.set(index, k);<NEW_LINE>index++;<NEW_LINE>}<NEW_LINE>} | (result.get(j)); |
843,303 | protected void updateMesh() {<NEW_LINE>Vector3f a = rectangle.getA();<NEW_LINE><MASK><NEW_LINE>Vector3f c = rectangle.getC();<NEW_LINE>Vector3f d = rectangle.calculateD();<NEW_LINE>setBuffer(Type.Position, 3, new float[] { a.x, a.y, a.z, b.x, b.y, b.z, d.x, d.y, d.z, c.x, c.y, c.z });<NEW_LINE>setBuffer(Type.TexCoord, 2, BufferUtils.createFloatBuffer(texCoords));<NEW_LINE>if (normal == null) {<NEW_LINE>normal = rectangle.calculateNormal(null);<NEW_LINE>}<NEW_LINE>setBuffer(Type.Normal, 3, BufferUtils.createFloatBuffer(normal, normal, normal, normal));<NEW_LINE>if (flipped) {<NEW_LINE>setBuffer(Type.Index, 3, new short[] { 1, 0, 3, 3, 2, 1 });<NEW_LINE>} else {<NEW_LINE>setBuffer(Type.Index, 3, new short[] { 3, 0, 1, 1, 2, 3 });<NEW_LINE>}<NEW_LINE>updateBound();<NEW_LINE>setStatic();<NEW_LINE>} | Vector3f b = rectangle.getB(); |
1,009,530 | final ListLicenseConfigurationsResult executeListLicenseConfigurations(ListLicenseConfigurationsRequest listLicenseConfigurationsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listLicenseConfigurationsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListLicenseConfigurationsRequest> request = null;<NEW_LINE>Response<ListLicenseConfigurationsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListLicenseConfigurationsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listLicenseConfigurationsRequest));<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, "License Manager");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListLicenseConfigurationsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListLicenseConfigurationsResultJsonUnmarshaller());<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.OPERATION_NAME, "ListLicenseConfigurations"); |
1,204,400 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<NEW_LINE>try {<NEW_LINE>String BASE_URL = request.getParameter("baseurl");<NEW_LINE>if (BASE_URL == null || BASE_URL.equals(""))<NEW_LINE>BASE_URL = "http://localhost:8010";<NEW_LINE>Hello proxy;<NEW_LINE>String endpointAddress = "";<NEW_LINE>URL wsdlLocation = new URL(BASE_URL + "/WSATAssertionTest/HelloImplWSATAssertionService?wsdl");<NEW_LINE>HelloImplWSATAssertionService service = new HelloImplWSATAssertionService(wsdlLocation);<NEW_LINE>endpointAddress = "HelloImplWSATAssertionService";<NEW_LINE>proxy = service.getHelloImplWSATAssertionPort();<NEW_LINE>BindingProvider bind = (BindingProvider) proxy;<NEW_LINE>bind.getRequestContext().put("javax.xml.ws.service.endpoint.address", BASE_URL + "/WSATAssertionTest/" + endpointAddress);<NEW_LINE>System.out.println("Reply from server: " + proxy.sayHello());<NEW_LINE>response.getWriter().println("<html><header></header><body> Reply from server: " + proxy.sayHello() + "</body></html>");<NEW_LINE>response.getWriter().flush();<NEW_LINE>} catch (Exception e) {<NEW_LINE>response.getWriter().println("<html><header></header><body> Client catch exception: " + <MASK><NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | e.toString() + "</body></html>"); |
709,061 | public static String format(Locale locale, String pattern, Object[] arguments, boolean translateArguments) throws LanguageException {<NEW_LINE>String value = null;<NEW_LINE>User fakeUser = new User();<NEW_LINE>fakeUser.setLocale(locale);<NEW_LINE>String pattern2 = get(fakeUser, pattern);<NEW_LINE>if (!pattern.equals(pattern2)) {<NEW_LINE>pattern = pattern2;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Logger.debug(LanguageUtil.class, pattern);<NEW_LINE>if (arguments != null) {<NEW_LINE>Object[] formattedArguments = new Object[arguments.length];<NEW_LINE>for (int i = 0; i < arguments.length; i++) {<NEW_LINE>if (translateArguments) {<NEW_LINE>formattedArguments[i] = get(fakeUser, arguments[i].toString());<NEW_LINE>} else {<NEW_LINE>formattedArguments[i] = arguments[i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>value = <MASK><NEW_LINE>} else {<NEW_LINE>Logger.warn(LanguageUtil.class, pattern);<NEW_LINE>value = pattern;<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new LanguageException(e);<NEW_LINE>}<NEW_LINE>return value;<NEW_LINE>} | MessageFormat.format(pattern, formattedArguments); |
715,196 | private List<FileMetadata> loadFileMetadataTabList() {<NEW_LINE>List<DataFile> allfiles = allRelatedFiles();<NEW_LINE>List<FileMetadata> retList = new ArrayList<>();<NEW_LINE>for (DatasetVersion versionLoop : fileMetadata.getDatasetVersion().getDataset().getVersions()) {<NEW_LINE>boolean foundFmd = false;<NEW_LINE>if (versionLoop.isReleased() || versionLoop.isDeaccessioned() || permissionService.on(fileMetadata.getDatasetVersion().getDataset()).has(Permission.ViewUnpublishedDataset)) {<NEW_LINE>foundFmd = false;<NEW_LINE>for (DataFile df : allfiles) {<NEW_LINE>FileMetadata fmd = datafileService.findFileMetadataByDatasetVersionIdAndDataFileId(versionLoop.getId(), df.getId());<NEW_LINE>if (fmd != null) {<NEW_LINE>fmd.setContributorNames(datasetVersionService.getContributorsNames(versionLoop));<NEW_LINE>FileVersionDifference fvd = new FileVersionDifference<MASK><NEW_LINE>fmd.setFileVersionDifference(fvd);<NEW_LINE>retList.add(fmd);<NEW_LINE>foundFmd = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// no File metadata found make dummy one<NEW_LINE>if (!foundFmd) {<NEW_LINE>FileMetadata dummy = new FileMetadata();<NEW_LINE>dummy.setDatasetVersion(versionLoop);<NEW_LINE>dummy.setDataFile(null);<NEW_LINE>FileVersionDifference fvd = new FileVersionDifference(dummy, getPreviousFileMetadata(versionLoop));<NEW_LINE>dummy.setFileVersionDifference(fvd);<NEW_LINE>retList.add(dummy);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return retList;<NEW_LINE>} | (fmd, getPreviousFileMetadata(fmd)); |
1,732,292 | protected void index(Iterable<? extends Indexable> files, Context context) {<NEW_LINE>// NOI18N<NEW_LINE>LOGGER.log(Level.FINE, <MASK><NEW_LINE>if (context.getRoot() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<URL> toRescan = new ArrayList<>();<NEW_LINE>for (Indexable i : files) {<NEW_LINE>URL indexableURL = i.getURL();<NEW_LINE>if (indexableURL == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>FileObject file = URLMapper.findFileObject(indexableURL);<NEW_LINE>if (file == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (JsfIndexSupport.isFaceletsLibraryDescriptor(file)) {<NEW_LINE>processFaceletsLibraryDescriptors(file, context);<NEW_LINE>} else if (JsfIndexSupport.isTagLibraryDescriptor(file)) {<NEW_LINE>processTlds(file, context);<NEW_LINE>} else if (JsfUtils.XHTML_MIMETYPE.equals(file.getMIMEType())) {<NEW_LINE>processFaceletsCompositeLibraries(file, context, toRescan);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// issue #226968 - rescan files which could contain composites<NEW_LINE>if (!toRescan.isEmpty() && !context.isSupplementaryFilesIndexing()) {<NEW_LINE>context.addSupplementaryFiles(context.getRootURI(), toRescan);<NEW_LINE>}<NEW_LINE>} | "JsfCustomIndexer: indexing {0}", context.getRoot()); |
937,221 | public Optional<String> toImageBlock(Image image) {<NEW_LINE>Path currentPath = directoryService.currentParentOrWorkdir();<NEW_LINE>IOHelper.createDirectories(currentPath.resolve("images"));<NEW_LINE>List<String> buffer = new LinkedList<>();<NEW_LINE>DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(asciiDocController.getClipboardImageFilePattern());<NEW_LINE>Path path = IOHelper.getPath(dateTimeFormatter.format(LocalDateTime.now()));<NEW_LINE>Path targetImage = currentPath.resolve("images").resolve(path.getFileName());<NEW_LINE>try {<NEW_LINE>BufferedImage fromFXImage = SwingFXUtils.fromFXImage(image, null);<NEW_LINE>ImageIO.write(fromFXImage, "png", targetImage.toFile());<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.<MASK><NEW_LINE>}<NEW_LINE>buffer.add(String.format("image::images/%s[]", path.getFileName()));<NEW_LINE>if (buffer.size() > 0)<NEW_LINE>return Optional.of(String.join("\n", buffer));<NEW_LINE>return Optional.empty();<NEW_LINE>} | error("Problem occured while saving clipboard image {}", targetImage, e); |
1,555,088 | final ListUnsupportedAppVersionResourcesResult executeListUnsupportedAppVersionResources(ListUnsupportedAppVersionResourcesRequest listUnsupportedAppVersionResourcesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listUnsupportedAppVersionResourcesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<ListUnsupportedAppVersionResourcesRequest> request = null;<NEW_LINE>Response<ListUnsupportedAppVersionResourcesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListUnsupportedAppVersionResourcesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listUnsupportedAppVersionResourcesRequest));<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, "resiliencehub");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListUnsupportedAppVersionResources");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListUnsupportedAppVersionResourcesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListUnsupportedAppVersionResourcesResultJsonUnmarshaller());<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>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,005,261 | public static ClusterRerouteRequest createRequest(RestRequest request) throws IOException {<NEW_LINE>ClusterRerouteRequest clusterRerouteRequest = Requests.clusterRerouteRequest();<NEW_LINE>clusterRerouteRequest.dryRun(request.paramAsBoolean("dry_run", clusterRerouteRequest.dryRun()));<NEW_LINE>clusterRerouteRequest.explain(request.paramAsBoolean("explain", clusterRerouteRequest.explain()));<NEW_LINE>clusterRerouteRequest.timeout(request.paramAsTime("timeout", clusterRerouteRequest.timeout()));<NEW_LINE>clusterRerouteRequest.setRetryFailed(request.paramAsBoolean("retry_failed"<MASK><NEW_LINE>clusterRerouteRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterRerouteRequest.masterNodeTimeout()));<NEW_LINE>parseDeprecatedMasterTimeoutParameter(clusterRerouteRequest, request, deprecationLogger, "cluster_reroute");<NEW_LINE>request.applyContentParser(parser -> PARSER.parse(parser, clusterRerouteRequest, null));<NEW_LINE>return clusterRerouteRequest;<NEW_LINE>} | , clusterRerouteRequest.isRetryFailed())); |
287,306 | final DeleteAuthorizerResult executeDeleteAuthorizer(DeleteAuthorizerRequest deleteAuthorizerRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteAuthorizerRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<DeleteAuthorizerRequest> request = null;<NEW_LINE>Response<DeleteAuthorizerResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteAuthorizerRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteAuthorizerRequest));<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, "API Gateway");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteAuthorizer");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteAuthorizerResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteAuthorizerResultJsonUnmarshaller());<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>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
361,555 | final AssociateThirdPartyFirewallResult executeAssociateThirdPartyFirewall(AssociateThirdPartyFirewallRequest associateThirdPartyFirewallRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(associateThirdPartyFirewallRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<AssociateThirdPartyFirewallRequest> request = null;<NEW_LINE>Response<AssociateThirdPartyFirewallResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AssociateThirdPartyFirewallRequestProtocolMarshaller(protocolFactory).marshall<MASK><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, "FMS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AssociateThirdPartyFirewall");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<AssociateThirdPartyFirewallResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new AssociateThirdPartyFirewallResultJsonUnmarshaller());<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>} | (super.beforeMarshalling(associateThirdPartyFirewallRequest)); |
944,730 | public void handleMapStoreConfig(Node node, BeanDefinitionBuilder mapConfigBuilder) {<NEW_LINE>BeanDefinitionBuilder mapStoreConfigBuilder = createBeanBuilder(MapStoreConfig.class);<NEW_LINE>AbstractBeanDefinition beanDefinition = mapStoreConfigBuilder.getBeanDefinition();<NEW_LINE>for (Node child : childElements(node)) {<NEW_LINE>if ("properties".equals(cleanNodeName(child))) {<NEW_LINE>handleProperties(child, mapStoreConfigBuilder);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String implAttrName = "implementation";<NEW_LINE>String factoryImplAttrName = "factory-implementation";<NEW_LINE>String initialModeAttrName = "initial-mode";<NEW_LINE>fillAttributeValues(node, mapStoreConfigBuilder, implAttrName, factoryImplAttrName, "initialMode");<NEW_LINE>NamedNodeMap attributes = node.getAttributes();<NEW_LINE>Node implRef = attributes.getNamedItem(implAttrName);<NEW_LINE>Node factoryImplRef = attributes.getNamedItem(factoryImplAttrName);<NEW_LINE>Node initialMode = attributes.getNamedItem(initialModeAttrName);<NEW_LINE>if (factoryImplRef != null) {<NEW_LINE>mapStoreConfigBuilder.addPropertyReference(xmlToJavaName(factoryImplAttrName), getTextContent(factoryImplRef));<NEW_LINE>}<NEW_LINE>if (implRef != null) {<NEW_LINE>mapStoreConfigBuilder.addPropertyReference(xmlToJavaName(implAttrName), getTextContent(implRef));<NEW_LINE>}<NEW_LINE>if (initialMode != null) {<NEW_LINE>InitialLoadMode mode = InitialLoadMode.valueOf(upperCaseInternal(getTextContent(initialMode)));<NEW_LINE>mapStoreConfigBuilder.addPropertyValue("initialLoadMode", mode);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | mapConfigBuilder.addPropertyValue("mapStoreConfig", beanDefinition); |
31,842 | public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<NEW_LINE>Map<String, String> map = getURIParams();<NEW_LINE>String cmd = map.get("cmd");<NEW_LINE>java.lang.reflect.Method meth = null;<NEW_LINE>Class[] partypes = new Class[] { HttpServletRequest.class, HttpServletResponse.class };<NEW_LINE>Object[] arglist = new <MASK><NEW_LINE>User user = getUser();<NEW_LINE>try {<NEW_LINE>// Check permissions if the user has access to the CMS Maintenance Portlet<NEW_LINE>if (user == null || !APILocator.getLayoutAPI().doesUserHaveAccessToPortlet("maintenance", user)) {<NEW_LINE>String userName = map.get("u");<NEW_LINE>String password = map.get("p");<NEW_LINE>LoginFactory.doLogin(userName, password, false, request, response);<NEW_LINE>user = (User) request.getSession().getAttribute(WebKeys.CMS_USER);<NEW_LINE>if (user == null) {<NEW_LINE>setUser(request);<NEW_LINE>user = getUser();<NEW_LINE>}<NEW_LINE>if (user == null || !APILocator.getLayoutAPI().doesUserHaveAccessToPortlet("maintenance", user)) {<NEW_LINE>response.sendError(401);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>meth = this.getClass().getMethod(cmd, partypes);<NEW_LINE>} catch (Exception e) {<NEW_LINE>try {<NEW_LINE>cmd = "action";<NEW_LINE>meth = this.getClass().getMethod(cmd, partypes);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>Logger.error(this.getClass(), "Trying to run method:" + cmd);<NEW_LINE>Logger.error(this.getClass(), e.getMessage(), e.getCause());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>meth.invoke(this, arglist);<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.error(IndexAjaxAction.class, "Trying to run method:" + cmd);<NEW_LINE>Logger.error(IndexAjaxAction.class, e.getMessage(), e.getCause());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} | Object[] { request, response }; |
190,689 | final GetStoredQueryResult executeGetStoredQuery(GetStoredQueryRequest getStoredQueryRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getStoredQueryRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetStoredQueryRequest> request = null;<NEW_LINE>Response<GetStoredQueryResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetStoredQueryRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getStoredQueryRequest));<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.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetStoredQuery");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetStoredQueryResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetStoredQueryResultJsonUnmarshaller());<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.SERVICE_ID, "Config Service"); |
375,983 | protected ImmutableTupleN calculateCacheKey() {<NEW_LINE>int length = fSource.length();<NEW_LINE>if (length < 11) {<NEW_LINE>// If it's a small string, just keep it instead of using the hashCode().<NEW_LINE>return new ImmutableTupleN(length, fSource, fStartingOffset);<NEW_LINE>} else {<NEW_LINE>// Note: we currently use the fSource.hashCode() in order to decide if the contents of this parse equal<NEW_LINE>// the contents of another parse. Conflicts may still arise in this situation -- an md5 would be more<NEW_LINE>// accurate. As an attempt to make this just a bit better we also get 5 chars from the string from<NEW_LINE>// many locations of the string and add them to our result too, so that the chance of a collision is even<NEW_LINE>// lower.<NEW_LINE>char[] chars = new char[5];<NEW_LINE>double factor = length / 4.0;<NEW_LINE>// first char<NEW_LINE>chars[0] = fSource.charAt(0);<NEW_LINE>chars[1] = fSource.charAt((int) factor);<NEW_LINE>chars[2] = fSource.charAt((<MASK><NEW_LINE>chars[3] = fSource.charAt((int) (3 * factor));<NEW_LINE>// last char<NEW_LINE>chars[4] = fSource.charAt(length - 1);<NEW_LINE>return new ImmutableTupleN(length, fSource.hashCode(), new String(chars), fStartingOffset);<NEW_LINE>}<NEW_LINE>} | int) (2 * factor)); |
539,396 | public Object doit() {<NEW_LINE>Object targetClass = "java.lang.String";<NEW_LINE>Class c = null;<NEW_LINE>try {<NEW_LINE>// Allow the class to be specified as a String instead of<NEW_LINE>// passed-in as a java.lang.Class object.<NEW_LINE>if (targetClass instanceof String)<NEW_LINE>c = Class.forName((String) targetClass);<NEW_LINE>else if (targetClass instanceof Class)<NEW_LINE>c = (Class) targetClass;<NEW_LINE>else<NEW_LINE>throw new RuntimeException("Can't create class from " + targetClass);<NEW_LINE>Constructor constructor = getConstructor(c);<NEW_LINE>if (null == constructor)<NEW_LINE>throw new RuntimeException("No such constructor found in class " + c.getName());<NEW_LINE>return constructor.newInstance((Object[]) null);<NEW_LINE>} catch (IllegalAccessException iae) {<NEW_LINE>throw new RuntimeException("Cannot create object of type " + c, iae);<NEW_LINE>} catch (InvocationTargetException ite) {<NEW_LINE>throw new RuntimeException(c.getName() + ".<init> failed", ite.getCause());<NEW_LINE>} catch (InstantiationException ie) {<NEW_LINE>throw new RuntimeException("Cannot create " + c.getName(), ie);<NEW_LINE>} catch (ClassNotFoundException cnfe) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>} | RuntimeException("Cannot create " + targetClass, cnfe); |
1,631,240 | private DataType resolveBitFieldDataType(BitFieldDataType bitFieldDataType, DataTypeConflictHandler handler) {<NEW_LINE>// NOTE: When a bit-field is getting added it will get resolved more than once.<NEW_LINE>// The first time we will ensure that the base data type, which may be a<NEW_LINE>// TypeDef, gets resolved. If the bit-offset is too large it will be set to 0<NEW_LINE>// with the expectation that it will get corrected during subsequent packing.<NEW_LINE>DataType baseDt = bitFieldDataType.getBaseDataType();<NEW_LINE>DataType <MASK><NEW_LINE>int baseLength = resolvedBaseDt.getLength();<NEW_LINE>int baseLengthBits = 8 * baseLength;<NEW_LINE>int bitSize = bitFieldDataType.getDeclaredBitSize();<NEW_LINE>int bitOffset = bitFieldDataType.getBitOffset();<NEW_LINE>int storageSize = bitFieldDataType.getStorageSize();<NEW_LINE>int storageSizeBits = 8 * storageSize;<NEW_LINE>if ((bitOffset + bitSize) > storageSizeBits) {<NEW_LINE>// should get recomputed during packing when used within aligned structure<NEW_LINE>int effectiveBitSize = Math.min(bitSize, baseLengthBits);<NEW_LINE>bitOffset = getDataOrganization().isBigEndian() ? baseLengthBits - effectiveBitSize : 0;<NEW_LINE>storageSize = baseLength;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return new BitFieldDBDataType(resolvedBaseDt, bitSize, bitOffset);<NEW_LINE>} catch (InvalidDataTypeException e) {<NEW_LINE>throw new AssertException("unexpected", e);<NEW_LINE>}<NEW_LINE>} | resolvedBaseDt = resolve(baseDt, handler); |
1,853,166 | public static void main(String[] args) throws InterruptedException {<NEW_LINE>TagContextBuilder tagContextBuilder = tagger.currentBuilder().put(FRONTEND_KEY, TagValue.create("mobile-ios9.3.5"));<NEW_LINE>SpanBuilder spanBuilder = tracer.spanBuilder("my.org/ProcessVideo").setRecordEvents(true).setSampler(Samplers.alwaysSample());<NEW_LINE>viewManager.registerView(VIDEO_SIZE_VIEW);<NEW_LINE>LoggingTraceExporter.register();<NEW_LINE>// Process video.<NEW_LINE>// Record the processed video size.<NEW_LINE>try (Scope scopedTags = tagContextBuilder.buildScoped();<NEW_LINE>Scope scopedSpan = spanBuilder.startScopedSpan()) {<NEW_LINE>tracer.getCurrentSpan().addAnnotation("Start processing video.");<NEW_LINE>// Sleep for [0,10] milliseconds to fake work.<NEW_LINE>Thread.sleep(new Random()<MASK><NEW_LINE>statsRecorder.newMeasureMap().put(VIDEO_SIZE, 25 * MiB).record();<NEW_LINE>tracer.getCurrentSpan().addAnnotation("Finished processing video.");<NEW_LINE>} catch (Exception e) {<NEW_LINE>tracer.getCurrentSpan().addAnnotation("Exception thrown when processing video.");<NEW_LINE>tracer.getCurrentSpan().setStatus(Status.UNKNOWN);<NEW_LINE>logger.severe(e.getMessage());<NEW_LINE>}<NEW_LINE>logger.info("Wait longer than the reporting duration...");<NEW_LINE>// Wait for a duration longer than reporting duration (5s) to ensure spans are exported.<NEW_LINE>// TODO(songya): remove the gap once we add a shutdown hook for exporting unflushed spans.<NEW_LINE>Thread.sleep(5100);<NEW_LINE>ViewData viewData = viewManager.getView(VIDEO_SIZE_VIEW_NAME);<NEW_LINE>logger.info(String.format("Recorded stats for %s:\n %s", VIDEO_SIZE_VIEW_NAME.asString(), viewData));<NEW_LINE>} | .nextInt(10) + 1); |
403,518 | private ChannelInfo parseChannelInfo(String json) {<NEW_LINE>try {<NEW_LINE>JSONParser parser = new JSONParser();<NEW_LINE>JSONObject root = (JSONObject) parser.parse(json);<NEW_LINE>String name = (String) root.get("name");<NEW_LINE>String id = (String) root.get("_id");<NEW_LINE>String status = (String) root.get("status");<NEW_LINE>String game = (String) root.get("game");<NEW_LINE>String broadcaster_type = (String) root.get("broadcaster_type");<NEW_LINE>String description = (String) root.get("description");<NEW_LINE>int views = JSONUtil.getInteger(root, "views", -1);<NEW_LINE>int followers = JSONUtil.getInteger(root, "followers", -1);<NEW_LINE>long createdAt = -1;<NEW_LINE>long updatedAt = -1;<NEW_LINE>try {<NEW_LINE>createdAt = DateTime.parseDatetime(JSONUtil.getString(root, "created_at"));<NEW_LINE>updatedAt = DateTime.parseDatetime(JSONUtil<MASK><NEW_LINE>} catch (Exception ex) {<NEW_LINE>LOGGER.warning("Error parsing ChannelInfo: " + ex);<NEW_LINE>}<NEW_LINE>return new ChannelInfo(name, id, createdAt, followers, views, updatedAt, broadcaster_type, description);<NEW_LINE>} catch (ParseException ex) {<NEW_LINE>LOGGER.warning("Error parsing ChannelInfo.");<NEW_LINE>return null;<NEW_LINE>} catch (ClassCastException ex) {<NEW_LINE>LOGGER.warning("Error parsing ChannelInfo: Unexpected type");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | .getString(root, "updated_at")); |
1,267,765 | public void prepare(Map<String, Object> stormConf, TopologyContext context, OutputCollector collector) {<NEW_LINE>_collector = collector;<NEW_LINE>scheduler = Scheduler.getInstance(stormConf);<NEW_LINE>mdTransfer = MetadataTransfer.getInstance(stormConf);<NEW_LINE>useCache = ConfUtils.getBoolean(stormConf, useCacheParamName, true);<NEW_LINE>if (useCache) {<NEW_LINE>String spec = ConfUtils.getString(stormConf, cacheConfigParamName);<NEW_LINE>cache = Caffeine.<MASK><NEW_LINE>context.registerMetric("cache", new IMetric() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Object getValueAndReset() {<NEW_LINE>Map<String, Long> statsMap = new HashMap<>();<NEW_LINE>statsMap.put("hits", cacheHits);<NEW_LINE>statsMap.put("misses", cacheMisses);<NEW_LINE>statsMap.put("size", cache.estimatedSize());<NEW_LINE>cacheHits = 0;<NEW_LINE>cacheMisses = 0;<NEW_LINE>return statsMap;<NEW_LINE>}<NEW_LINE>}, 30);<NEW_LINE>}<NEW_LINE>maxFetchErrors = ConfUtils.getInt(stormConf, maxFetchErrorsParamName, 3);<NEW_LINE>String tmpdateround = ConfUtils.getString(stormConf, roundDateParamName, "SECOND");<NEW_LINE>if (tmpdateround.equalsIgnoreCase("MINUTE")) {<NEW_LINE>roundDateUnit = Calendar.MINUTE;<NEW_LINE>} else if (tmpdateround.equalsIgnoreCase("HOUR")) {<NEW_LINE>roundDateUnit = Calendar.HOUR;<NEW_LINE>}<NEW_LINE>} | from(spec).build(); |
1,773,802 | private MotionEvent rotateTouchEvent(MotionEvent ev) {<NEW_LINE>if (this.getMapOrientation() == 0) {<NEW_LINE>return ev;<NEW_LINE>}<NEW_LINE>MotionEvent rotatedEvent = MotionEvent.obtain(ev);<NEW_LINE>if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {<NEW_LINE>getProjection().unrotateAndScalePoint((int) ev.getX(), (int) ev.getY(), mRotateScalePoint);<NEW_LINE>rotatedEvent.setLocation(<MASK><NEW_LINE>} else {<NEW_LINE>// This method is preferred since it will rotate historical touch events too<NEW_LINE>try {<NEW_LINE>if (sMotionEventTransformMethod == null) {<NEW_LINE>sMotionEventTransformMethod = MotionEvent.class.getDeclaredMethod("transform", new Class<?>[] { Matrix.class });<NEW_LINE>}<NEW_LINE>sMotionEventTransformMethod.invoke(rotatedEvent, getProjection().getInvertedScaleRotateCanvasMatrix());<NEW_LINE>} catch (SecurityException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (NoSuchMethodException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (InvocationTargetException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return rotatedEvent;<NEW_LINE>} | mRotateScalePoint.x, mRotateScalePoint.y); |
1,300,262 | public String renderTemplate(Script source, WatchExecutionContext ctx, Payload payload) {<NEW_LINE>// Due the inconsistency with templates in ES 1.x, we maintain our own template format.<NEW_LINE>// This template format we use now, will become the template structure in ES 2.0<NEW_LINE>Map<String, Object> watcherContextParams = Variables.createCtxParamsMap(ctx, payload);<NEW_LINE>// Here we convert watcher template into a ES core templates. Due to the different format we use, we<NEW_LINE>// convert to the template format used in ES core<NEW_LINE>if (source.getParams() != null) {<NEW_LINE>watcherContextParams.putAll(source.getParams());<NEW_LINE>}<NEW_LINE>// Templates are always of lang mustache:<NEW_LINE>Script template = new Script(source.getType(), source.getType() == ScriptType.STORED ? null : "mustache", source.getIdOrCode(), source.getOptions(), watcherContextParams);<NEW_LINE>TemplateScript.Factory compiledTemplate = scriptService.<MASK><NEW_LINE>return compiledTemplate.newInstance(template.getParams()).execute();<NEW_LINE>} | compile(template, Watcher.SCRIPT_TEMPLATE_CONTEXT); |
430,383 | public long handle(Emulator<?> emulator) {<NEW_LINE>RegisterContext context = emulator.getContext();<NEW_LINE>UnidbgPointer object = context.getPointerArg(1);<NEW_LINE>UnidbgPointer clazz = context.getPointerArg(2);<NEW_LINE>UnidbgPointer jmethodID = context.getPointerArg(3);<NEW_LINE>UnidbgPointer va_list = context.getPointerArg(4);<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("CallNonvirtualVoidMethodV object=" + object + ", clazz=" + clazz + ", jmethodID=" + jmethodID + ", va_list=" + va_list);<NEW_LINE>}<NEW_LINE>DvmObject<?> dvmObject = getObject(object.toIntPeer());<NEW_LINE>DvmClass dvmClass = classMap.get(clazz.toIntPeer());<NEW_LINE>DvmMethod dvmMethod = dvmClass == null ? null : dvmClass.getMethod(jmethodID.toIntPeer());<NEW_LINE>if (dvmMethod == null) {<NEW_LINE>throw new BackendException();<NEW_LINE>} else {<NEW_LINE>VaList vaList = new VaList64(emulator, <MASK><NEW_LINE>if (dvmMethod.isConstructor()) {<NEW_LINE>DvmObject<?> obj = dvmMethod.newObjectV(vaList);<NEW_LINE>Objects.requireNonNull(dvmObject).setValue(obj.value);<NEW_LINE>} else {<NEW_LINE>dvmMethod.callVoidMethodV(dvmObject, vaList);<NEW_LINE>}<NEW_LINE>if (verbose) {<NEW_LINE>System.out.printf("JNIEnv->CallNonvirtualVoidMethodV(%s, %s, %s(%s)) was called from %s%n", dvmObject, dvmClass.getClassName(), dvmMethod.methodName, vaList.formatArgs(), context.getLRPointer());<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>} | DalvikVM64.this, va_list, dvmMethod); |
1,342,100 | public int matches(String str, int start, int length) {<NEW_LINE>final int end = start + length;<NEW_LINE>if (repeated instanceof AnyMatcher) {<NEW_LINE>final int stop = end - next.minLength();<NEW_LINE>for (int pos = start; pos >= 0 && pos <= stop; ++pos) {<NEW_LINE>int p = next.matches(<MASK><NEW_LINE>if (p >= start) {<NEW_LINE>return p;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Constants.NO_MATCH;<NEW_LINE>} else if (next != TrueMatcher.INSTANCE) {<NEW_LINE>final int stop = end - next.minLength();<NEW_LINE>int pos = start;<NEW_LINE>while (pos >= start && pos <= stop) {<NEW_LINE>int p = next.matches(str, pos, end - pos);<NEW_LINE>if (p >= start) {<NEW_LINE>return p;<NEW_LINE>}<NEW_LINE>// The repeated portion could potentially be an empty string matcher, to avoid an<NEW_LINE>// endless loop we need to ensure that the position has moved forward<NEW_LINE>int tmp = repeated.matches(str, pos, end - pos);<NEW_LINE>if (tmp == pos) {<NEW_LINE>return Constants.NO_MATCH;<NEW_LINE>}<NEW_LINE>pos = tmp;<NEW_LINE>}<NEW_LINE>return Constants.NO_MATCH;<NEW_LINE>} else {<NEW_LINE>int matchPos = Constants.NO_MATCH;<NEW_LINE>int pos = start;<NEW_LINE>while (pos > matchPos) {<NEW_LINE>matchPos = pos;<NEW_LINE>pos = repeated.matches(str, pos, end - pos);<NEW_LINE>}<NEW_LINE>return matchPos;<NEW_LINE>}<NEW_LINE>} | str, pos, end - pos); |
861,571 | public static CodegenExpression codegen(ExprDotNodeForgeVariable forge, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope classScope) {<NEW_LINE>CodegenExpressionField variableReader = classScope.addOrGetFieldSharable(new VariableReaderCodegenFieldSharable(forge.getVariable()));<NEW_LINE>EPTypeClass variableType;<NEW_LINE>VariableMetaData metaData = forge.getVariable();<NEW_LINE>if (metaData.getEventType() != null) {<NEW_LINE>variableType = EventBean.EPTYPE;<NEW_LINE>} else {<NEW_LINE>variableType = metaData.getType();<NEW_LINE>}<NEW_LINE>CodegenMethod methodNode = codegenMethodScope.makeChild(forge.getEvaluationType(), ExprDotNodeForgeVariableEval.class, classScope);<NEW_LINE>CodegenExpression typeInformation = constantNull();<NEW_LINE>if (classScope.isInstrumented()) {<NEW_LINE>typeInformation = classScope.addOrGetFieldSharable(new EPChainableTypeCodegenSharable(new EPChainableTypeClass(variableType), classScope));<NEW_LINE>}<NEW_LINE>CodegenBlock block = methodNode.getBlock().declareVar(variableType, "result", cast(variableType, exprDotMethod(variableReader, "getValue"))).apply(InstrumentationCode.instblock(classScope, "qExprDotChain", typeInformation, ref("result"), constant(forge.getChainForge().length)));<NEW_LINE>CodegenExpression chain = ExprDotNodeUtility.evaluateChainCodegen(methodNode, exprSymbol, classScope, ref("result"), variableType, forge.getChainForge(), forge.getResultWrapLambda());<NEW_LINE>if (!JavaClassHelper.isTypeVoid(forge.getEvaluationType().getType())) {<NEW_LINE>block.declareVar(forge.getEvaluationType(), "returned", chain).apply(InstrumentationCode.instblock(classScope, "aExprDotChain"))<MASK><NEW_LINE>} else {<NEW_LINE>block.expression(chain).apply(InstrumentationCode.instblock(classScope, "aExprDotChain"));<NEW_LINE>}<NEW_LINE>return localMethod(methodNode);<NEW_LINE>} | .methodReturn(ref("returned")); |
623,514 | void validateSelf(final boolean shouldIdCheck, final boolean descriptionOptional) throws InvalidToolException {<NEW_LINE>super.validateSelf();<NEW_LINE>// Not the expected type, the wrong Object is in use.<NEW_LINE>if (!objectType.equals(type)) {<NEW_LINE>throw new InvalidToolException(RequestNLS.formatMessage(tc<MASK><NEW_LINE>}<NEW_LINE>// check required fields for this object<NEW_LINE>final String badRQDfields = listNullFields(descriptionOptional);<NEW_LINE>if (badRQDfields.length() != 0) {<NEW_LINE>throw new InvalidToolException(RequestNLS.formatMessage(tc, "RQD_FIELDS_MISSING", badRQDfields));<NEW_LINE>}<NEW_LINE>// check for XSS and other malicious data<NEW_LINE>final String badXSSfields = listXSSFields();<NEW_LINE>if (badXSSfields.length() != 0) {<NEW_LINE>throw new InvalidToolException(RequestNLS.formatMessage(tc, "XSS_DETECTED", badXSSfields));<NEW_LINE>}<NEW_LINE>// check URL field syntax (url and icon fields)<NEW_LINE>if (!isValidURL(url)) {<NEW_LINE>throw new InvalidToolException(RequestNLS.formatMessage(tc, "URL_NOT_VALID", url));<NEW_LINE>}<NEW_LINE>// Check to see if we have an icon set. If not, then configure the default icon.<NEW_LINE>if (!isValidURL(icon)) {<NEW_LINE>throw new InvalidToolException(RequestNLS.formatMessage(tc, "ICON_NOT_VALID", icon));<NEW_LINE>}<NEW_LINE>// A URL's id must match its name<NEW_LINE>if (shouldIdCheck && !id.equals(Utils.urlEncode(name))) {<NEW_LINE>throw new InvalidToolException(RequestNLS.formatMessage(tc, "ID_NOT_VALID", id, name));<NEW_LINE>}<NEW_LINE>// name does not contain ~ & : ; / \ ? {} < > []<NEW_LINE>if (!containsValidCharacters(name)) {<NEW_LINE>throw new InvalidToolException(RequestNLS.formatMessage(tc, "NAME_NOT_VALID", name, INVALID_CHARACTERS));<NEW_LINE>}<NEW_LINE>if (description != null) {<NEW_LINE>// description does not contain ~ & : ; / \ ? {} < > []<NEW_LINE>if (!containsValidCharacters(description)) {<NEW_LINE>throw new InvalidToolException(RequestNLS.formatMessage(tc, "DESCRIPTION_NOT_VALID", description, INVALID_CHARACTERS));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , "TYPE_NOT_CORRECT", objectType, type)); |
1,752,867 | private Observable<MantisKafkaConsumer<?>> createConsumers(final Context context, final MantisKafkaSourceConfig kafkaSourceConfig, final int totalNumWorkers) {<NEW_LINE>final List<MantisKafkaConsumer<?>> consumers = new ArrayList<>();<NEW_LINE>for (int i = 0; i < kafkaSourceConfig.getNumConsumerInstances(); i++) {<NEW_LINE>final int consumerIndex = context.getWorkerInfo().getWorkerIndex() + (totalNumWorkers * i);<NEW_LINE>MantisKafkaConsumer<?> mantisKafkaConsumer = new MantisKafkaConsumer.Builder().withKafkaSourceConfig(kafkaSourceConfig).withTotalNumConsumersForJob(totalNumWorkers * kafkaSourceConfig.getNumConsumerInstances()).withContext(context).withConsumerIndex(consumerIndex).withRegistry(registry).build();<NEW_LINE>idToConsumerMap.put(mantisKafkaConsumer.getConsumerId(), mantisKafkaConsumer);<NEW_LINE><MASK><NEW_LINE>consumers.add(mantisKafkaConsumer);<NEW_LINE>}<NEW_LINE>return Observable.from(consumers);<NEW_LINE>} | LOGGER.info("created consumer {}", mantisKafkaConsumer); |
117,648 | public void handleApplicationCommandRequest(SerialMessage serialMessage, int offset, int endpoint) {<NEW_LINE>logger.debug("NODE {}: Received CLOCK command V{}", getNode().getNodeId(), getVersion());<NEW_LINE>int command = serialMessage.getMessagePayloadByte(offset);<NEW_LINE>switch(command) {<NEW_LINE>case CLOCK_REPORT:<NEW_LINE>int day = serialMessage.getMessagePayloadByte(offset + 1) >> 5;<NEW_LINE>int hour = serialMessage.getMessagePayloadByte(offset + 1) & 0x1f;<NEW_LINE>int minute = serialMessage.getMessagePayloadByte(offset + 2);<NEW_LINE>String[] days = new DateFormatSymbols().getWeekdays();<NEW_LINE>int javaDay = day == 7 ? 1 : day + 1;<NEW_LINE>logger.debug(String.format("NODE %d: Received clock report: %s %02d:%02d", getNode().getNodeId(), days[javaDay], hour, minute));<NEW_LINE><MASK><NEW_LINE>cal.set(Calendar.DAY_OF_WEEK, javaDay);<NEW_LINE>cal.set(Calendar.HOUR_OF_DAY, hour);<NEW_LINE>cal.set(Calendar.MINUTE, minute);<NEW_LINE>Date nodeTime = cal.getTime();<NEW_LINE>ZWaveCommandClassValueEvent zEvent = new ZWaveCommandClassValueEvent(getNode().getNodeId(), endpoint, getCommandClass(), nodeTime);<NEW_LINE>getController().notifyEventListeners(zEvent);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>logger.warn(String.format("NODE %d: Unsupported Command %d for command class %s (0x%02X).", getNode().getNodeId(), command, getCommandClass().getLabel(), getCommandClass().getKey()));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | Calendar cal = Calendar.getInstance(); |
1,664,759 | public void processMessage(final WebSocketMessage webSocketData) {<NEW_LINE>setDoTransactionNotifications(false);<NEW_LINE>final SecurityContext securityContext = getWebSocket().getSecurityContext();<NEW_LINE>final PropertyKey selectorsKey = StructrApp.<MASK><NEW_LINE>final List<String> classes = webSocketData.getNodeDataStringList("classes");<NEW_LINE>final String name = webSocketData.getNodeDataStringValue("name");<NEW_LINE>final String htmlId = webSocketData.getNodeDataStringValue("htmlId");<NEW_LINE>final String tag = webSocketData.getNodeDataStringValue("tag");<NEW_LINE>final App app = StructrApp.getInstance(securityContext);<NEW_LINE>if (tag != null) {<NEW_LINE>try {<NEW_LINE>final List<Widget> result = new LinkedList<>();<NEW_LINE>final Element element = new Element(tag);<NEW_LINE>for (final String css : classes) {<NEW_LINE>element.addClass(css);<NEW_LINE>}<NEW_LINE>if (name != null) {<NEW_LINE>element.attr("name", name);<NEW_LINE>}<NEW_LINE>if (htmlId != null) {<NEW_LINE>element.attr("id", htmlId);<NEW_LINE>}<NEW_LINE>try (final ResultStream<Widget> resultStream = app.nodeQuery(Widget.class).getResultStream()) {<NEW_LINE>for (final Widget widget : resultStream) {<NEW_LINE>final String[] selectors = getSelectors(widget, selectorsKey);<NEW_LINE>if (selectors != null) {<NEW_LINE>for (final String selector : selectors) {<NEW_LINE>if (element.select(selector).first() != null) {<NEW_LINE>result.add(widget);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>webSocketData.setResult(result);<NEW_LINE>// send only over local connection (no broadcast)<NEW_LINE>getWebSocket().send(webSocketData, true);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.error("", t);<NEW_LINE>getWebSocket().send(MessageBuilder.status().code(422).build(), true);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// send empty result<NEW_LINE>getWebSocket().send(webSocketData, true);<NEW_LINE>}<NEW_LINE>} | key(Widget.class, "selectors"); |
271,187 | private static double calculateSigma(double clipNorm, double eps, double targetDelta) {<NEW_LINE>double deltaZero = calculateBPositive(eps, 0);<NEW_LINE>double alpha = 1d;<NEW_LINE>if (targetDelta > deltaZero) {<NEW_LINE>double sPositive = calculateSPositive(eps, targetDelta, 0, 1);<NEW_LINE>alpha = Math.sqrt(1.0 + sPositive / 2.0) - Math.sqrt(sPositive / 2.0);<NEW_LINE>} else if (targetDelta < deltaZero) {<NEW_LINE>double sNegative = calculateSNegative(eps, targetDelta, 0, 1);<NEW_LINE>alpha = Math.sqrt(1.0 + sNegative / 2.0) + Math.sqrt(sNegative / 2.0);<NEW_LINE>} else {<NEW_LINE>LOGGER.info(Common.addTag("[Encrypt] targetDelta = deltaZero"));<NEW_LINE>}<NEW_LINE>return alpha * clipNorm / <MASK><NEW_LINE>} | Math.sqrt(2.0 * eps); |
1,156,475 | private static boolean equal(ISVNStatus e1, ISVNStatus e2) {<NEW_LINE>if (!SVNStatusKind.IGNORED.equals(e1.getTextStatus()) && !SVNStatusKind.UNVERSIONED.equals(e1.getTextStatus()) && !SVNStatusKind.ADDED.equals(e1.getTextStatus())) {<NEW_LINE>// check revisions just when it's meaningful, unversioned or ignored files have no revision and thus should be considered equal<NEW_LINE>// added/copied files make no sense either, they have no revision yet<NEW_LINE>long r1 = -1;<NEW_LINE>if (e1 != null) {<NEW_LINE>SVNRevision r = e1.getRevision();<NEW_LINE>r1 = r != null ? e1.getRevision().getNumber() : r1;<NEW_LINE>}<NEW_LINE>long r2 = -2;<NEW_LINE>if (e2 != null) {<NEW_LINE><MASK><NEW_LINE>r2 = r != null ? e2.getRevision().getNumber() : r2;<NEW_LINE>}<NEW_LINE>if (r1 != r2) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (e1.isCopied() != e2.isCopied()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return e1.getUrl() == e2.getUrl() || e1.getUrl() != null && e1.getUrl().equals(e2.getUrl());<NEW_LINE>} | SVNRevision r = e2.getRevision(); |
1,463,023 | public AwsIotAnalyticsParameters unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AwsIotAnalyticsParameters awsIotAnalyticsParameters = new AwsIotAnalyticsParameters();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><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("DataSetName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>awsIotAnalyticsParameters.setDataSetName(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 awsIotAnalyticsParameters;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
872,473 | public void marshall(HumanTaskConfig humanTaskConfig, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (humanTaskConfig == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(humanTaskConfig.getWorkteamArn(), WORKTEAMARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(humanTaskConfig.getUiConfig(), UICONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(humanTaskConfig.getPreHumanTaskLambdaArn(), PREHUMANTASKLAMBDAARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(humanTaskConfig.getTaskKeywords(), TASKKEYWORDS_BINDING);<NEW_LINE>protocolMarshaller.marshall(humanTaskConfig.getTaskTitle(), TASKTITLE_BINDING);<NEW_LINE>protocolMarshaller.marshall(humanTaskConfig.getTaskDescription(), TASKDESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(humanTaskConfig.getTaskTimeLimitInSeconds(), TASKTIMELIMITINSECONDS_BINDING);<NEW_LINE>protocolMarshaller.marshall(humanTaskConfig.getTaskAvailabilityLifetimeInSeconds(), TASKAVAILABILITYLIFETIMEINSECONDS_BINDING);<NEW_LINE>protocolMarshaller.marshall(humanTaskConfig.getMaxConcurrentTaskCount(), MAXCONCURRENTTASKCOUNT_BINDING);<NEW_LINE>protocolMarshaller.marshall(humanTaskConfig.getAnnotationConsolidationConfig(), ANNOTATIONCONSOLIDATIONCONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(humanTaskConfig.getPublicWorkforceTaskPrice(), PUBLICWORKFORCETASKPRICE_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | humanTaskConfig.getNumberOfHumanWorkersPerDataObject(), NUMBEROFHUMANWORKERSPERDATAOBJECT_BINDING); |
347,389 | private static Engine prepareEngine(int numEntities) {<NEW_LINE>Engine engine = new Engine();<NEW_LINE>engine.addSystem(new MovementSystem());<NEW_LINE>engine.addSystem(new StateSystem());<NEW_LINE>engine.addSystem(new CollisionSystem());<NEW_LINE>engine.addSystem(new RemovalSystem());<NEW_LINE>for (int i = 0; i < numEntities; ++i) {<NEW_LINE>Entity entity = new Entity();<NEW_LINE>if (Constants.shouldHaveComponent(ComponentType.POSITION, i)) {<NEW_LINE>PositionComponent pos = new PositionComponent();<NEW_LINE>pos.pos.x = MathUtils.random(Constants.MIN_POS, Constants.MAX_POS);<NEW_LINE>pos.pos.y = MathUtils.random(Constants.MIN_POS, Constants.MAX_POS);<NEW_LINE>entity.add(pos);<NEW_LINE>}<NEW_LINE>if (Constants.shouldHaveComponent(ComponentType.MOVEMENT, i)) {<NEW_LINE>MovementComponent mov = new MovementComponent();<NEW_LINE>mov.velocity.x = MathUtils.random(Constants.MIN_VEL, Constants.MAX_VEL);<NEW_LINE>mov.velocity.y = MathUtils.random(Constants.MIN_VEL, Constants.MAX_VEL);<NEW_LINE>mov.accel.x = MathUtils.random(<MASK><NEW_LINE>mov.accel.y = MathUtils.random(Constants.MIN_ACC, Constants.MAX_ACC);<NEW_LINE>entity.add(mov);<NEW_LINE>}<NEW_LINE>if (Constants.shouldHaveComponent(ComponentType.RADIUS, i)) {<NEW_LINE>RadiusComponent rad = new RadiusComponent();<NEW_LINE>rad.radius = MathUtils.random(Constants.MIN_RADIUS, Constants.MAX_RADIUS);<NEW_LINE>entity.add(rad);<NEW_LINE>}<NEW_LINE>if (Constants.shouldHaveComponent(ComponentType.STATE, i)) {<NEW_LINE>entity.add(new StateComponent());<NEW_LINE>}<NEW_LINE>engine.addEntity(entity);<NEW_LINE>}<NEW_LINE>return engine;<NEW_LINE>} | Constants.MIN_ACC, Constants.MAX_ACC); |
941,919 | public ASTNode visitCExpr(final CExprContext ctx) {<NEW_LINE>if (null != ctx.columnref()) {<NEW_LINE>return visit(ctx.columnref());<NEW_LINE>}<NEW_LINE>if (null != ctx.parameterMarker()) {<NEW_LINE>ParameterMarkerValue parameterMarker = (ParameterMarkerValue) visit(ctx.parameterMarker());<NEW_LINE>ParameterMarkerExpressionSegment segment = new ParameterMarkerExpressionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), parameterMarker.getValue(<MASK><NEW_LINE>parameterMarkerSegments.add(segment);<NEW_LINE>return segment;<NEW_LINE>}<NEW_LINE>if (null != ctx.aexprConst()) {<NEW_LINE>ASTNode astNode = visit(ctx.aexprConst());<NEW_LINE>if (astNode instanceof StringLiteralValue || astNode instanceof BooleanLiteralValue || astNode instanceof NumberLiteralValue) {<NEW_LINE>return new LiteralExpressionSegment(ctx.aexprConst().start.getStartIndex(), ctx.aexprConst().stop.getStopIndex(), ((LiteralValue) astNode).getValue());<NEW_LINE>}<NEW_LINE>return astNode;<NEW_LINE>}<NEW_LINE>if (null != ctx.aExpr()) {<NEW_LINE>return visit(ctx.aExpr());<NEW_LINE>}<NEW_LINE>if (null != ctx.funcExpr()) {<NEW_LINE>return visit(ctx.funcExpr());<NEW_LINE>}<NEW_LINE>if (null != ctx.selectWithParens()) {<NEW_LINE>return createSubqueryExpressionSegment(ctx);<NEW_LINE>}<NEW_LINE>super.visitCExpr(ctx);<NEW_LINE>String text = ctx.start.getInputStream().getText(new Interval(ctx.start.getStartIndex(), ctx.stop.getStopIndex()));<NEW_LINE>return new CommonExpressionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), text);<NEW_LINE>} | ), parameterMarker.getType()); |
381,598 | public final <K> Map<K, ?> toMap(K key1, K key2, K key3, K key4, K key5, K key6, K key7, K key8, K key9, K key10, K key11, K key12, K key13, K key14, K key15) {<NEW_LINE>Map<K, Object> result = new LinkedHashMap<>();<NEW_LINE>result.put(key1, v1);<NEW_LINE>result.put(key2, v2);<NEW_LINE>result.put(key3, v3);<NEW_LINE>result.put(key4, v4);<NEW_LINE>result.put(key5, v5);<NEW_LINE><MASK><NEW_LINE>result.put(key7, v7);<NEW_LINE>result.put(key8, v8);<NEW_LINE>result.put(key9, v9);<NEW_LINE>result.put(key10, v10);<NEW_LINE>result.put(key11, v11);<NEW_LINE>result.put(key12, v12);<NEW_LINE>result.put(key13, v13);<NEW_LINE>result.put(key14, v14);<NEW_LINE>result.put(key15, v15);<NEW_LINE>return result;<NEW_LINE>} | result.put(key6, v6); |
9,553 | // Add claims to authorization-url<NEW_LINE>private OAuth2AuthorizationRequest addClaims(HttpServletRequest httpServletRequest, OAuth2AuthorizationRequest oAuth2AuthorizationRequest) {<NEW_LINE>if (oAuth2AuthorizationRequest == null || httpServletRequest == null) {<NEW_LINE>return oAuth2AuthorizationRequest;<NEW_LINE>}<NEW_LINE>// Handle conditional access policy, step 3.<NEW_LINE>HttpSession httpSession = httpServletRequest.getSession(false);<NEW_LINE>final Map<String, Object> additionalParameters = new HashMap<>();<NEW_LINE>if (httpSession != null) {<NEW_LINE>String conditionalAccessPolicyClaims = (String) httpSession.getAttribute(Constants.CONDITIONAL_ACCESS_POLICY_CLAIMS);<NEW_LINE>if (conditionalAccessPolicyClaims != null) {<NEW_LINE><MASK><NEW_LINE>additionalParameters.put(Constants.CLAIMS, conditionalAccessPolicyClaims);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (properties != null && properties.getAuthenticateAdditionalParameters() != null) {<NEW_LINE>additionalParameters.putAll(properties.getAuthenticateAdditionalParameters());<NEW_LINE>}<NEW_LINE>additionalParameters.putAll(oAuth2AuthorizationRequest.getAdditionalParameters());<NEW_LINE>return OAuth2AuthorizationRequest.from(oAuth2AuthorizationRequest).additionalParameters(additionalParameters).build();<NEW_LINE>} | httpSession.removeAttribute(Constants.CONDITIONAL_ACCESS_POLICY_CLAIMS); |
271,036 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (opponent != null && controller != null) {<NEW_LINE>if (!opponent.getHand().isEmpty()) {<NEW_LINE>opponent.revealCards("Exile " + StaticFilters.FILTER_CARD_A_NON_LAND.getMessage(), opponent.getHand(), game);<NEW_LINE>TargetCard target = new TargetCard(<MASK><NEW_LINE>if (controller.choose(Outcome.Exile, opponent.getHand(), target, game)) {<NEW_LINE>Card card = opponent.getHand().get(target.getFirstTarget(), game);<NEW_LINE>if (card != null) {<NEW_LINE>controller.moveCardToExileWithInfo(card, null, "", source, game, Zone.HAND, true);<NEW_LINE>// Check the Delirium condition<NEW_LINE>if (!DeliriumCondition.instance.apply(game, source)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return this.applySearchAndExile(game, source, card.getName(), opponent.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | Zone.HAND, StaticFilters.FILTER_CARD_A_NON_LAND); |
1,539,530 | public void parseData(JSONArray printData, PrintOptions options) throws JSONException, UnsupportedOperationException {<NEW_LINE>dpiScale = (options.getPixelOptions().getDensity() * options.getPixelOptions().getUnits().as1Inch()) / 72.0;<NEW_LINE>for (int i = 0; i < printData.length(); i++) {<NEW_LINE>JSONObject data = printData.getJSONObject(i);<NEW_LINE>PrintingUtilities.Flavor flavor = PrintingUtilities.Flavor.valueOf(data.optString("flavor", "FILE").toUpperCase(Locale.ENGLISH));<NEW_LINE>try {<NEW_LINE>BufferedImage bi;<NEW_LINE>if (flavor == PrintingUtilities.Flavor.BASE64) {<NEW_LINE>bi = ImageIO.read(new ByteArrayInputStream(Base64.decodeBase64(data<MASK><NEW_LINE>} else {<NEW_LINE>bi = ImageIO.read(ConnectionUtilities.getInputStream(data.getString("data")));<NEW_LINE>}<NEW_LINE>images.add(bi);<NEW_LINE>} catch (IIOException e) {<NEW_LINE>if (e.getCause() != null && e.getCause() instanceof FileNotFoundException) {<NEW_LINE>throw new UnsupportedOperationException("Image file specified could not be found.", e);<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException(String.format("Cannot parse (%s)%s as an image", flavor, data.getString("data")), e);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new UnsupportedOperationException(String.format("Cannot parse (%s)%s as an image: %s", flavor, data.getString("data"), e.getLocalizedMessage()), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>log.debug("Parsed {} images for printing", images.size());<NEW_LINE>} | .getString("data")))); |
1,089,258 | private static PrivateKey generatePEMPrivateKey(final Path keyPath) throws IOException {<NEW_LINE>String key = Files.readString(keyPath, Charset.defaultCharset());<NEW_LINE>String privateKeyPEM = key.replace("-----BEGIN PRIVATE KEY-----", "").replaceAll(System.lineSeparator(), "").replace("-----END PRIVATE KEY-----", "");<NEW_LINE>byte[] decoded = Base64.getDecoder().decode(privateKeyPEM);<NEW_LINE>PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(decoded);<NEW_LINE>PrivateKey privateKey;<NEW_LINE>try {<NEW_LINE>KeyFactory kf = KeyFactory.getInstance("RSA");<NEW_LINE>privateKey = kf.generatePrivate(keySpec);<NEW_LINE>} catch (NoSuchAlgorithmException e) {<NEW_LINE>throw new IllegalStateException(e);<NEW_LINE>} catch (InvalidKeySpecException e) {<NEW_LINE>try {<NEW_LINE>KeyFactory kf = KeyFactory.getInstance("EC");<NEW_LINE>privateKey = kf.generatePrivate(keySpec);<NEW_LINE>} catch (InvalidKeySpecException e1) {<NEW_LINE>try {<NEW_LINE>KeyFactory <MASK><NEW_LINE>privateKey = kf.generatePrivate(keySpec);<NEW_LINE>} catch (InvalidKeySpecException | NoSuchAlgorithmException e2) {<NEW_LINE>throw new RuntimeException(e2);<NEW_LINE>}<NEW_LINE>} catch (NoSuchAlgorithmException e1) {<NEW_LINE>throw new IllegalStateException(e1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return privateKey;<NEW_LINE>} | kf = KeyFactory.getInstance("DSA"); |
770,364 | // load ratings data from ratings.csv<NEW_LINE>private void loadRatingData(String ratingDataPath) throws Exception {<NEW_LINE>System.out.println("Loading rating data from " + ratingDataPath + " ...");<NEW_LINE>boolean skipFirstLine = true;<NEW_LINE>int count = 0;<NEW_LINE>try (Scanner scanner = new Scanner(new File(ratingDataPath))) {<NEW_LINE>while (scanner.hasNextLine()) {<NEW_LINE>String ratingRawData = scanner.nextLine();<NEW_LINE>if (skipFirstLine) {<NEW_LINE>skipFirstLine = false;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String[] linkData = ratingRawData.split(",");<NEW_LINE>if (linkData.length == 4) {<NEW_LINE>count++;<NEW_LINE>Rating rating = new Rating();<NEW_LINE>rating.setUserId(Integer.parseInt(linkData[0]));<NEW_LINE>rating.setMovieId(Integer.parseInt(linkData[1]));<NEW_LINE>rating.setScore(Float.parseFloat(linkData[2]));<NEW_LINE>rating.setTimestamp(Long.parseLong(linkData[3]));<NEW_LINE>Movie movie = this.movieMap.get(rating.getMovieId());<NEW_LINE>if (null != movie) {<NEW_LINE>movie.addRating(rating);<NEW_LINE>}<NEW_LINE>if (!this.userMap.containsKey(rating.getUserId())) {<NEW_LINE>User user = new User();<NEW_LINE>user.setUserId(rating.getUserId());<NEW_LINE>this.userMap.put(user.getUserId(), user);<NEW_LINE>}<NEW_LINE>this.userMap.get(rating.getUserId<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("Loading rating data completed. " + count + " ratings in total.");<NEW_LINE>} | ()).addRating(rating); |
481,160 | public RouteDefinition convertRoute(GatewayStrategyRouteEntity gatewayStrategyRouteEntity) {<NEW_LINE>RouteDefinition routeDefinition = new RouteDefinition();<NEW_LINE>routeDefinition.setId(gatewayStrategyRouteEntity.getId());<NEW_LINE>routeDefinition.setUri(convertURI(gatewayStrategyRouteEntity.getUri()));<NEW_LINE>List<String> predicateList = gatewayStrategyRouteEntity.getPredicates();<NEW_LINE>List<GatewayStrategyRouteEntity.Predicate> userPredicates = gatewayStrategyRouteEntity.getUserPredicates();<NEW_LINE>List<PredicateDefinition> predicateDefinitionList = new ArrayList<PredicateDefinition>(predicateList.size() + userPredicates.size());<NEW_LINE>for (String predicate : predicateList) {<NEW_LINE>predicateDefinitionList.add(new PredicateDefinition(predicate));<NEW_LINE>}<NEW_LINE>for (GatewayStrategyRouteEntity.Predicate predicate : userPredicates) {<NEW_LINE>PredicateDefinition predicateDefinition = new PredicateDefinition();<NEW_LINE>predicateDefinition.setName(predicate.getName());<NEW_LINE>predicateDefinition.setArgs(predicate.getArgs());<NEW_LINE>predicateDefinitionList.add(predicateDefinition);<NEW_LINE>}<NEW_LINE>routeDefinition.setPredicates(predicateDefinitionList);<NEW_LINE>List<String> filterList = gatewayStrategyRouteEntity.getFilters();<NEW_LINE>List<GatewayStrategyRouteEntity.Filter> userFilters = gatewayStrategyRouteEntity.getUserFilters();<NEW_LINE>List<FilterDefinition> filterDefinitionList = new ArrayList<FilterDefinition>(filterList.size(<MASK><NEW_LINE>for (String filter : filterList) {<NEW_LINE>filterDefinitionList.add(new FilterDefinition(filter));<NEW_LINE>}<NEW_LINE>for (GatewayStrategyRouteEntity.Filter filter : userFilters) {<NEW_LINE>FilterDefinition filterDefinition = new FilterDefinition();<NEW_LINE>filterDefinition.setName(filter.getName());<NEW_LINE>filterDefinition.setArgs(filter.getArgs());<NEW_LINE>filterDefinitionList.add(filterDefinition);<NEW_LINE>}<NEW_LINE>routeDefinition.setFilters(filterDefinitionList);<NEW_LINE>routeDefinition.setOrder(gatewayStrategyRouteEntity.getOrder());<NEW_LINE>// Metadata isn't supported in Finchley and Greenwich<NEW_LINE>try {<NEW_LINE>routeDefinition.setMetadata(gatewayStrategyRouteEntity.getMetadata());<NEW_LINE>} catch (Throwable e) {<NEW_LINE>}<NEW_LINE>return routeDefinition;<NEW_LINE>} | ) + userFilters.size()); |
255,121 | /*<NEW_LINE>* We support only TEXT, CHART, DROPDOWN, TABLE, INPUT widgets as part of the suggestion<NEW_LINE>* We need string and number type fields to construct the query which will bind data to the above widgets<NEW_LINE>*/<NEW_LINE>private static DataFields collectFieldsFromData(Iterator<Map.Entry<String, JsonNode>> jsonFields) {<NEW_LINE>DataFields dataFields = new DataFields();<NEW_LINE>List<String> fields = new ArrayList<>();<NEW_LINE>List<String> numericFields = new ArrayList<>();<NEW_LINE>List<String> <MASK><NEW_LINE>while (jsonFields.hasNext()) {<NEW_LINE>Map.Entry<String, JsonNode> jsonField = jsonFields.next();<NEW_LINE>if (JsonNodeType.STRING.equals(jsonField.getValue().getNodeType())) {<NEW_LINE>fields.add(jsonField.getKey());<NEW_LINE>}<NEW_LINE>if (JsonNodeType.NUMBER.equals(jsonField.getValue().getNodeType())) {<NEW_LINE>numericFields.add(jsonField.getKey());<NEW_LINE>}<NEW_LINE>if (JsonNodeType.ARRAY.equals(jsonField.getValue().getNodeType())) {<NEW_LINE>objectFields.add(jsonField.getKey());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>dataFields.setFields(fields);<NEW_LINE>dataFields.setNumericFields(numericFields);<NEW_LINE>dataFields.setObjectFields(objectFields);<NEW_LINE>return dataFields;<NEW_LINE>} | objectFields = new ArrayList<>(); |
515,251 | private void actOnLogin(PostLoginEvent event) {<NEW_LINE>ProxiedPlayer player = event.getPlayer();<NEW_LINE>UUID playerUUID = player.getUniqueId();<NEW_LINE>String playerName = player.getName();<NEW_LINE>InetAddress address = player.getAddress().getAddress();<NEW_LINE>long time = System.currentTimeMillis();<NEW_LINE>ActiveSession session = new ActiveSession(playerUUID, serverInfo.getServerUUID(), time, null, null);<NEW_LINE>session.getExtraData().put(PlayerName.class, new PlayerName(playerName));<NEW_LINE>session.getExtraData().put(ServerName.class, new ServerName("Proxy Server"));<NEW_LINE>sessionCache.cacheSession(playerUUID, session);<NEW_LINE>Database database = dbSystem.getDatabase();<NEW_LINE>boolean gatheringGeolocations = config.isTrue(DataGatheringSettings.GEOLOCATIONS);<NEW_LINE>if (gatheringGeolocations) {<NEW_LINE>database.executeTransaction(new GeoInfoStoreTransaction(playerUUID, address, time, geolocationCache::getCountry));<NEW_LINE>}<NEW_LINE>database.executeTransaction(new PlayerRegisterTransaction(playerUUID, () -> time, playerName));<NEW_LINE>processing.submitNonCritical(() -> extensionService.updatePlayerValues(playerUUID<MASK><NEW_LINE>if (config.isTrue(ExportSettings.EXPORT_ON_ONLINE_STATUS_CHANGE)) {<NEW_LINE>processing.submitNonCritical(() -> exporter.exportPlayerPage(playerUUID, playerName));<NEW_LINE>}<NEW_LINE>} | , playerName, CallEvents.PLAYER_JOIN)); |
1,512,256 | public void change(Database database, DatabaseSession databaseSession) throws NotImplementedException, BimserverDatabaseException {<NEW_LINE>EClass eClass = eAttribute.getEContainingClass();<NEW_LINE>KeyValueStore keyValueStore = database.getKeyValueStore();<NEW_LINE>for (EClass subClass : schema.getSubClasses(eClass)) {<NEW_LINE>try {<NEW_LINE>// No data migration if the database is new<NEW_LINE>if (subClass.getEAnnotation("nodatabase") == null) {<NEW_LINE>RecordIterator recordIterator = keyValueStore.getRecordIterator(subClass.getEPackage().getName() + "_" + subClass.getName(), databaseSession);<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>while (record != null) {<NEW_LINE>ByteBuffer buffer = ByteBuffer.wrap(record.getValue());<NEW_LINE>PackageMetaData packageMetaData = database.getMetaDataManager().getPackageMetaData(subClass.getEPackage().getName());<NEW_LINE>int newUnsettedLength = packageMetaData.getUnsettedLength(subClass);<NEW_LINE>int previousUnsettedLength = packageMetaData.getUnsettedLength(subClass, eAttribute);<NEW_LINE>byte[] unsetted = new byte[newUnsettedLength];<NEW_LINE>buffer.get(unsetted, 0, previousUnsettedLength);<NEW_LINE>int fieldCounter = 0;<NEW_LINE>for (EStructuralFeature feature : subClass.getEAllStructuralFeatures()) {<NEW_LINE>if (packageMetaData.useForDatabaseStorage(subClass, feature)) {<NEW_LINE>if (feature == eAttribute) {<NEW_LINE>unsetted[fieldCounter / 8] |= (1 << (fieldCounter % 8));<NEW_LINE>}<NEW_LINE>fieldCounter++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int extra = 0;<NEW_LINE>ByteBuffer newBuffer = ByteBuffer.allocate(record.getValue().length + (newUnsettedLength - previousUnsettedLength) + extra);<NEW_LINE>newBuffer.put(unsetted);<NEW_LINE>buffer.position(previousUnsettedLength);<NEW_LINE>newBuffer.put(buffer);<NEW_LINE>keyValueStore.store(subClass.getEPackage().getName() + "_" + subClass.getName(), record.getKey(), newBuffer.array(), databaseSession);<NEW_LINE>record = recordIterator.next();<NEW_LINE>}<NEW_LINE>} catch (BimserverDatabaseException e) {<NEW_LINE>LOGGER.error("", e);<NEW_LINE>} finally {<NEW_LINE>recordIterator.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (BimserverLockConflictException e) {<NEW_LINE>LOGGER.error("", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Record record = recordIterator.next(); |
1,334,280 | private static void checkResult(LockdowndError result) {<NEW_LINE>switch(result) {<NEW_LINE>case LOCKDOWN_E_SUCCESS:<NEW_LINE>return;<NEW_LINE>case LOCKDOWN_E_INVALID_ARG:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_INVALID_ARG");<NEW_LINE>case LOCKDOWN_E_INVALID_CONF:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_INVALID_CONF");<NEW_LINE>case LOCKDOWN_E_PLIST_ERROR:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_PLIST_ERROR");<NEW_LINE>case LOCKDOWN_E_PAIRING_FAILED:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_PAIRING_FAILED");<NEW_LINE>case LOCKDOWN_E_SSL_ERROR:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_SSL_ERROR");<NEW_LINE>case LOCKDOWN_E_DICT_ERROR:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_DICT_ERROR");<NEW_LINE>case LOCKDOWN_E_START_SERVICE_FAILED:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_START_SERVICE_FAILED");<NEW_LINE>case LOCKDOWN_E_NOT_ENOUGH_DATA:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_NOT_ENOUGH_DATA");<NEW_LINE>case LOCKDOWN_E_SET_VALUE_PROHIBITED:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_SET_VALUE_PROHIBITED");<NEW_LINE>case LOCKDOWN_E_GET_VALUE_PROHIBITED:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_GET_VALUE_PROHIBITED");<NEW_LINE>case LOCKDOWN_E_REMOVE_VALUE_PROHIBITED:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_REMOVE_VALUE_PROHIBITED");<NEW_LINE>case LOCKDOWN_E_MUX_ERROR:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_MUX_ERROR");<NEW_LINE>case LOCKDOWN_E_ACTIVATION_FAILED:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_ACTIVATION_FAILED");<NEW_LINE>case LOCKDOWN_E_PASSWORD_PROTECTED:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_PASSWORD_PROTECTED");<NEW_LINE>case LOCKDOWN_E_NO_RUNNING_SESSION:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_NO_RUNNING_SESSION");<NEW_LINE>case LOCKDOWN_E_INVALID_HOST_ID:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_INVALID_HOST_ID");<NEW_LINE>case LOCKDOWN_E_INVALID_SERVICE:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_INVALID_SERVICE");<NEW_LINE>case LOCKDOWN_E_INVALID_ACTIVATION_RECORD:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_INVALID_ACTIVATION_RECORD");<NEW_LINE>case LOCKDOWN_E_PAIRING_DIALOG_PENDING:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_PAIRING_DIALOG_PENDING");<NEW_LINE>case LOCKDOWN_E_USER_DENIED_PAIRING:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_USER_DENIED_PAIRING");<NEW_LINE>case LOCKDOWN_E_UNKNOWN_ERROR:<NEW_LINE>throw new LibIMobileDeviceException(result.swigValue(), "LOCKDOWN_E_UNKNOWN_ERROR");<NEW_LINE>default:<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>} | LibIMobileDeviceException(result.swigValue()); |
449,262 | public static void main(String[] args) {<NEW_LINE>Exercise28_StackWithAQueue<Integer> exercise28_stackWithAQueue = new Exercise28_StackWithAQueue<>();<NEW_LINE>StdOut.println("IsEmpty: " + exercise28_stackWithAQueue.isEmpty() + " Expected: true");<NEW_LINE>exercise28_stackWithAQueue.push(1);<NEW_LINE>exercise28_stackWithAQueue.push(2);<NEW_LINE>exercise28_stackWithAQueue.push(3);<NEW_LINE>StdOut.println(exercise28_stackWithAQueue.pop());<NEW_LINE>StdOut.println(exercise28_stackWithAQueue.pop());<NEW_LINE>exercise28_stackWithAQueue.push(4);<NEW_LINE>exercise28_stackWithAQueue.push(5);<NEW_LINE>StdOut.println("Size: " + exercise28_stackWithAQueue.size() + " Expected: 3");<NEW_LINE>StdOut.println("IsEmpty: " + <MASK><NEW_LINE>StdOut.println(exercise28_stackWithAQueue.pop());<NEW_LINE>StdOut.println(exercise28_stackWithAQueue.pop());<NEW_LINE>StdOut.println("Expected output from pop(): 3 2 5 4");<NEW_LINE>} | exercise28_stackWithAQueue.isEmpty() + " Expected: false"); |
1,198,954 | public void start() {<NEW_LINE>final <MASK><NEW_LINE>state.name = res.getDisplayName();<NEW_LINE>duration = 0;<NEW_LINE>if (res.getMedia() != null) {<NEW_LINE>duration = (long) res.getMedia().getDurationInSeconds() * 1000;<NEW_LINE>state.duration = DurationFormatUtils.formatDuration(duration, "HH:mm:ss");<NEW_LINE>}<NEW_LINE>Runnable r = () -> {<NEW_LINE>state.playback = PLAYING;<NEW_LINE>while (res == renderer.getPlayingRes()) {<NEW_LINE>long elapsed;<NEW_LINE>if ((long) res.getLastStartPosition() == 0) {<NEW_LINE>elapsed = System.currentTimeMillis() - res.getStartTime();<NEW_LINE>} else {<NEW_LINE>elapsed = System.currentTimeMillis() - (long) res.getLastStartSystemTime();<NEW_LINE>elapsed += (long) (res.getLastStartPosition() * 1000);<NEW_LINE>}<NEW_LINE>if (duration == 0 || elapsed < duration + 500) {<NEW_LINE>// Position is valid as far as we can tell<NEW_LINE>state.position = DurationFormatUtils.formatDuration(elapsed, "HH:mm:ss");<NEW_LINE>} else {<NEW_LINE>// Position is invalid, blink instead<NEW_LINE>state.position = ("NOT_IMPLEMENTED" + (elapsed / 1000 % 2 == 0 ? " " : "--"));<NEW_LINE>}<NEW_LINE>alert();<NEW_LINE>try {<NEW_LINE>Thread.sleep(1000);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Reset only if another item hasn't already begun playing<NEW_LINE>if (renderer.getPlayingRes() == null) {<NEW_LINE>reset();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>new Thread(r).start();<NEW_LINE>} | DLNAResource res = renderer.getPlayingRes(); |
820,117 | static <K, V> MapMakerInternalMap<K, V, ? extends InternalEntry<K, V, ?>, ?> create(MapMaker builder) {<NEW_LINE>if (builder.getKeyStrength() == Strength.STRONG && builder.getValueStrength() == Strength.STRONG) {<NEW_LINE>return new MapMakerInternalMap<>(builder, StrongKeyStrongValueEntry.Helper.<K, V>instance());<NEW_LINE>}<NEW_LINE>if (builder.getKeyStrength() == Strength.STRONG && builder.getValueStrength() == Strength.WEAK) {<NEW_LINE>return new MapMakerInternalMap<>(builder, StrongKeyWeakValueEntry.Helper.<K, V>instance());<NEW_LINE>}<NEW_LINE>if (builder.getKeyStrength() == Strength.WEAK && builder.getValueStrength() == Strength.STRONG) {<NEW_LINE>return new MapMakerInternalMap<>(builder, WeakKeyStrongValueEntry.Helper.<<MASK><NEW_LINE>}<NEW_LINE>if (builder.getKeyStrength() == Strength.WEAK && builder.getValueStrength() == Strength.WEAK) {<NEW_LINE>return new MapMakerInternalMap<>(builder, WeakKeyWeakValueEntry.Helper.<K, V>instance());<NEW_LINE>}<NEW_LINE>throw new AssertionError();<NEW_LINE>} | K, V>instance()); |
887,788 | public void visitVarInsn(int opcode, int var) {<NEW_LINE>switch(opcode) {<NEW_LINE>case Opcodes.ILOAD:<NEW_LINE>push(InferredType.INT);<NEW_LINE>break;<NEW_LINE>case Opcodes.LLOAD:<NEW_LINE>push(InferredType.LONG);<NEW_LINE>push(InferredType.TOP);<NEW_LINE>break;<NEW_LINE>case Opcodes.FLOAD:<NEW_LINE>push(InferredType.FLOAT);<NEW_LINE>break;<NEW_LINE>case Opcodes.DLOAD:<NEW_LINE>push(InferredType.DOUBLE);<NEW_LINE>push(InferredType.TOP);<NEW_LINE>break;<NEW_LINE>case Opcodes.ALOAD:<NEW_LINE>push(getLocalVariable(var));<NEW_LINE>break;<NEW_LINE>case Opcodes.ISTORE:<NEW_LINE>case Opcodes.FSTORE:<NEW_LINE>case Opcodes.ASTORE:<NEW_LINE>{<NEW_LINE>StackEntry entry = pop();<NEW_LINE>setLocalVariable(var, entry);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case Opcodes.LSTORE:<NEW_LINE>case Opcodes.DSTORE:<NEW_LINE>{<NEW_LINE>StackEntry entry = pop(2);<NEW_LINE>setLocalVariable(var, entry);<NEW_LINE>setLocalVariable(var + 1, opaque(InferredType.TOP));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case Opcodes.RET:<NEW_LINE>throw new RuntimeException("The instruction RET is not supported");<NEW_LINE>default:<NEW_LINE>throw new RuntimeException("Unhandled opcode " + opcode);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | super.visitVarInsn(opcode, var); |
1,321,200 | public Mono<MatchResult> matches(ServerWebExchange exchange) {<NEW_LINE>ServerHttpRequest request = exchange.getRequest();<NEW_LINE>PathContainer path = request.getPath().pathWithinApplication();<NEW_LINE>if (this.method != null && !this.method.equals(request.getMethod())) {<NEW_LINE>return MatchResult.notMatch().doOnNext((result) -> {<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>logger.debug("Request '" + request.getMethod() + " " + path + "' doesn't match '" + this.method + " " + this.pattern.getPatternString() + "'");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>boolean match = this.pattern.matches(path);<NEW_LINE>if (!match) {<NEW_LINE>return MatchResult.notMatch().doOnNext((result) -> {<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>logger.debug("Request '" + request.getMethod() + " " + path + "' doesn't match '" + this.method + " " + this.<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>Map<String, String> pathVariables = this.pattern.matchAndExtract(path).getUriVariables();<NEW_LINE>Map<String, Object> variables = new HashMap<>(pathVariables);<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>logger.debug("Checking match of request : '" + path + "'; against '" + this.pattern.getPatternString() + "'");<NEW_LINE>}<NEW_LINE>return MatchResult.match(variables);<NEW_LINE>} | pattern.getPatternString() + "'"); |
621,667 | public void prepareDatabase() {<NEW_LINE>if (config.hasPath(RdbmsConfigConstants.SQLITE_PATH_CREATE) && config.hasPath(RdbmsConfigConstants.SQLITE_PATH_VALUE) && config.getBoolean(RdbmsConfigConstants.SQLITE_PATH_CREATE)) {<NEW_LINE>String path = config.getString(RdbmsConfigConstants.SQLITE_PATH_VALUE);<NEW_LINE>try {<NEW_LINE>Path dbPath = Files.createDirectories(Paths.get(path));<NEW_LINE>logger.info("Configured SQLite database path: {}", dbPath);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RdbmsMetastoreException(String.format("Unable to create SQLite database path [%s]: %s. " + "Optionally, path can be created manually and [%s] set to false in %s.", path, e.getMessage(), RdbmsConfigConstants.SQLITE_PATH_CREATE<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , MetastoreConfigConstants.OVERRIDE_RESOURCE_FILE_NAME), e); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.