Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
294,100
boolean (PsiElement[] elements, int discardCost) { if (elements.length != myElementAnchors.length) { return false; } for (int i = 0; i < myElementAnchors.length; i++) { PsiElement one = myElementAnchors[i].retrieve(); PsiElement two = elements[i]; if (one == null || two == null || !myHasher.areTreesEqual(one, two, discardCost)) { return false; } } return true; }
isEqual
294,101
void (@Nullable CustomPortService manager) { this.manager = manager; }
setManager
294,102
boolean () { return manager != null && manager.isBound(); }
isBound
294,103
void () { if (manager != null) { manager.rebind(); } }
portChanged
294,104
Object (@NotNull ComponentManager componentManager, @NotNull PluginDescriptor pluginDescriptor) { if (service == null) { return super.createInstance(componentManager, pluginDescriptor); } else { try { return ApplicationManager.getApplication().getService(Class.forName(service, true, pluginDescriptor.getPluginClassLoader())); } catch (Throwable e) { throw new PluginException(e, pluginDescriptor.getPluginId()); } } }
createInstance
294,105
void (@NotNull Throwable e) { //noinspection CallToPrintStackTrace e.printStackTrace(); }
exceptionCaught
294,106
void (@NotNull Client client, @Nullable Map<String, List<String>> parameters) { }
connected
294,107
void (@NotNull Client client) { }
disconnected
294,108
EventLoop () { return channel.eventLoop(); }
getEventLoop
294,109
ByteBufAllocator () { return channel.alloc(); }
getByteBufAllocator
294,110
void (@NotNull ExceptionHandler exceptionHandler) { if (!messageCallbackMap.isEmpty()) { for (AsyncPromise<?> promise : messageCallbackMap.values()) { try { promise.setError("rejected"); } catch (Throwable e) { exceptionHandler.exceptionCaught(e); } } } }
rejectAsyncResults
294,111
JsonRpcServer () { return BinaryRequestHandler.EP_NAME.findExtension(RpcBinaryRequestHandler.class).getServer(); }
getRpcServerInstance
294,112
JsonRpcServer () { clientManager.getValue(); return rpcServer; }
getServer
294,113
UUID () { return ID; }
getId
294,114
ChannelHandler (@NotNull ChannelHandlerContext context) { SocketClient client = new SocketClient(context.channel()); context.channel().attr(ClientManagerKt.getCLIENT()).set(client); clientManager.getValue().addClient(client); connected(client, null); return new MyDecoder(client); }
getInboundHandler
294,115
void (@NotNull Throwable e) { LOG.error(e); }
exceptionCaught
294,116
void (@NotNull Client client, @Nullable Map<String, List<String>> parameters) { }
connected
294,117
void (@NotNull Client client) { }
disconnected
294,118
void (@NotNull ChannelHandlerContext context, @NotNull ByteBuf input) { while (true) { switch (state) { case LENGTH: { ByteBuf buffer = getBufferIfSufficient(input, 4, context); if (buffer == null) { return; } state = State.CONTENT; contentLength = buffer.readInt(); } case CONTENT: { CharSequence content = readChars(input); if (content == null) { return; } try { rpcServer.messageReceived(client, content); } catch (Throwable e) { clientManager.getValue().getExceptionHandler().exceptionCaught(e); } finally { contentLength = 0; state = State.LENGTH; } } } } }
messageReceived
294,119
void (ChannelHandlerContext context) { Client client = context.channel().attr(ClientManagerKt.getCLIENT()).get(); // if null, so, has already been explicitly removed if (client != null) { clientManager.getValue().disconnectClient(context.channel(), client, false); } }
channelInactive
294,120
ChannelFuture (@NotNull ByteBuf message) { if (channel.isOpen()) { ByteBuf lengthBuffer = channel.alloc().ioBuffer(4); lengthBuffer.writeInt(message.readableBytes()); channel.write(lengthBuffer); return channel.writeAndFlush(message); } else { return channel.newFailedFuture(new ClosedChannelException()); } }
send
294,121
void () { }
sendHeartbeat
294,122
boolean (@NotNull FullHttpRequest request) { return request.method() == HttpMethod.GET && "WebSocket".equalsIgnoreCase(request.headers().getAsString(HttpHeaderNames.UPGRADE)) && request.uri().length() > 2; }
isSupported
294,123
void (@NotNull ClientManager server) { }
serverCreated
294,124
void (@NotNull Throwable e) { NettyUtil.log(e, LOG); }
exceptionCaught
294,125
boolean (@NotNull QueryStringDecoder urlDecoder, @NotNull FullHttpRequest request, @NotNull ChannelHandlerContext context) { handleWebSocketRequest(context, request, urlDecoder); return true; }
process
294,126
void (@NotNull final ChannelHandlerContext context, @NotNull FullHttpRequest request, @NotNull final QueryStringDecoder uriDecoder) { WebSocketServerHandshakerFactory factory = new WebSocketServerHandshakerFactory("ws://" + request.headers().getAsString(HttpHeaderNames.HOST) + uriDecoder.path(), null, false, NettyUtil.MAX_CONTENT_LENGTH); //NON-NLS WebSocketServerHandshaker handshaker = factory.newHandshaker(request); if (handshaker == null) { WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(context.channel()); return; } if (!context.channel().isOpen()) { return; } final Client client = new WebSocketClient(context.channel(), handshaker); context.channel().attr(ClientManagerKt.getCLIENT()).set(client); handshaker.handshake(context.channel(), request).addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) { if (future.isSuccess()) { ClientManager clientManager = WebSocketHandshakeHandler.this.clientManager.getValue(); clientManager.addClient(client); MessageChannelHandler messageChannelHandler = new MessageChannelHandler(clientManager, getMessageServer()); BuiltInServer.Companion.replaceDefaultHandler(context, messageChannelHandler); ChannelHandlerContext messageChannelHandlerContext = context.pipeline().context(messageChannelHandler); context.pipeline().addBefore(messageChannelHandlerContext.name(), "webSocketFrameAggregator", new WebSocketFrameAggregator(NettyUtil.MAX_CONTENT_LENGTH)); messageChannelHandlerContext.channel().attr(ClientManagerKt.getCLIENT()).set(client); connected(client, uriDecoder.parameters()); } } }); }
handleWebSocketRequest
294,127
void (ChannelFuture future) { if (future.isSuccess()) { ClientManager clientManager = WebSocketHandshakeHandler.this.clientManager.getValue(); clientManager.addClient(client); MessageChannelHandler messageChannelHandler = new MessageChannelHandler(clientManager, getMessageServer()); BuiltInServer.Companion.replaceDefaultHandler(context, messageChannelHandler); ChannelHandlerContext messageChannelHandlerContext = context.pipeline().context(messageChannelHandler); context.pipeline().addBefore(messageChannelHandlerContext.name(), "webSocketFrameAggregator", new WebSocketFrameAggregator(NettyUtil.MAX_CONTENT_LENGTH)); messageChannelHandlerContext.channel().attr(ClientManagerKt.getCLIENT()).set(client); connected(client, uriDecoder.parameters()); } }
operationComplete
294,128
void (@NotNull Client client, @Nullable Map<String, List<String>> parameters) { }
connected
294,129
WebSocketServerOptions (int value) { heartbeatDelay = value; return this; }
heartbeatDelay
294,130
WebSocketServerOptions (int value) { closeTimeout = value; return this; }
closeTimeout
294,131
ChannelFuture (@NotNull ByteBuf message) { return sendFrame(message, false); }
send
294,132
ChannelFuture (@NotNull ByteBuf message, boolean binary) { if (channel.isOpen()) { return channel.writeAndFlush(binary ? new BinaryWebSocketFrame(message) : new TextWebSocketFrame(message)); } else { return channel.newFailedFuture(new ClosedChannelException()); } }
sendFrame
294,133
void () { channel.writeAndFlush(new PingWebSocketFrame()); }
sendHeartbeat
294,134
void (@NotNull CloseWebSocketFrame frame) { handshaker.close(channel, frame); }
disconnect
294,135
void (@NotNull Channel channel, @NotNull CloseWebSocketFrame message) { WebSocketClient client = (WebSocketClient)channel.attr(ClientManagerKt.getCLIENT()).get(); if (client == null) { super.closeFrameReceived(channel, message); } else { try { clientManager.disconnectClient(channel, client, false); } finally { client.disconnect(message); } } }
closeFrameReceived
294,136
void (@NotNull Channel channel, @NotNull TextWebSocketFrame message) { WebSocketClient client = (WebSocketClient)channel.attr(ClientManagerKt.getCLIENT()).get(); CharSequence chars; try { chars = readUtf8(message.content()); } catch (Throwable e) { try { message.release(); } finally { clientManager.getExceptionHandler().exceptionCaught(e); } return; } try { messageServer.messageReceived(client, chars); } catch (Throwable e) { clientManager.getExceptionHandler().exceptionCaught(e); } }
textFrameReceived
294,137
void (@NotNull ChannelHandlerContext context, @NotNull Throwable cause) { try { clientManager.getExceptionHandler().exceptionCaught(cause); } finally { super.exceptionCaught(context, cause); } }
exceptionCaught
294,138
ConsoleView (@NotNull NetService netService) { if (console == null) { createConsole(netService); } return console; }
getConsole
294,139
void (@NotNull final NetService netService) { TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(netService.getProject()); netService.configureConsole(consoleBuilder); console = consoleBuilder.getConsole(); ApplicationManager.getApplication().invokeLater(() -> { ActionGroup actionGroup = netService.getConsoleToolWindowActions(); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("BuiltInServer", actionGroup, false); SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true); toolWindowPanel.setContent(console.getComponent()); toolWindowPanel.setToolbar(toolbar.getComponent()); ToolWindow toolWindow = ToolWindowManager.getInstance(netService.getProject()) .registerToolWindow(netService.getConsoleToolWindowId(), false, ToolWindowAnchor.BOTTOM, netService.getProject(), true); toolWindow.setIcon(netService.getConsoleToolWindowIcon()); Content content = ContentFactory.getInstance().createContent(toolWindowPanel, "", false); Disposer.register(content, console); toolWindow.getContentManager().addContent(content); }, netService.getProject().getDisposed()); }
createConsole
294,140
BuiltInServerOptions () { return ApplicationManager.getApplication().getService(BuiltInServerOptions.class); }
getInstance
294,141
BuiltInServerOptions () { return this; }
getState
294,142
void (@NotNull BuiltInServerOptions state) { XmlSerializerUtil.copyBean(state, this); }
loadState
294,143
int () { MyCustomPortServerManager portServerManager = CustomPortServerManager.EP_NAME.findExtensionOrFail(MyCustomPortServerManager.class); if (!portServerManager.isBound()) { return BuiltInServerManager.getInstance().getPort(); } return builtInServerPort; }
getEffectiveBuiltInServerPort
294,144
void (@NotNull Exception e, int port) { String message = BuiltInServerBundle.message("notification.content.cannot.start.built.in.http.server.on.custom.port", port, ApplicationNamesInfo.getInstance().getFullProductName()); new Notification(BuiltInServerManagerImpl.NOTIFICATION_GROUP, message, NotificationType.ERROR).notify(null); }
cannotBind
294,145
int () { int port = getInstance().builtInServerPort; return port == DEFAULT_PORT ? -1 : port; }
getPort
294,146
boolean () { return getInstance().builtInServerAvailableExternally; }
isAvailableExternally
294,147
void () { CustomPortServerManager.EP_NAME.forEachExtensionSafe(extension -> { CustomPortServerManagerBase baseManager = (CustomPortServerManagerBase) extension; if (baseManager != null) { baseManager.portChanged(); } }); }
onBuiltInServerPortChanged
294,148
String (Date date) { return simpleDateFormat.format(date); }
format
294,149
TimeZone () { return simpleDateFormat.getTimeZone(); }
getTimeZone
294,150
void (TimeZone timeZone) { simpleDateFormat.setTimeZone(timeZone); }
setTimeZone
294,151
String (String pattern) { boolean inside = false; boolean mark = false; boolean modifiedCommand = false; StringBuilder buf = new StringBuilder(); for (int i = 0; i < pattern.length(); i++) { char c = pattern.charAt(i); if (c == '%' && !mark) { mark = true; } else { if (mark) { if (modifiedCommand) { //don't do anything--we just wanted to skip a char modifiedCommand = false; mark = false; } else { inside = translateCommand(buf, pattern, i, inside); //It's a modifier code if (c == 'O' || c == 'E') { modifiedCommand = true; } else { mark = false; } } } else { if (!inside && c != ' ') { //We start a literal, which we need to quote buf.append("'"); inside = true; } buf.append(c); } } } if (buf.length() > 0) { char lastChar = buf.charAt(buf.length() - 1); if (lastChar != '\'' && inside) { buf.append('\''); } } return buf.toString(); }
convertDateFormat
294,152
String (String str, boolean insideQuotes) { String retVal = str; if (!insideQuotes) { retVal = '\'' + retVal + '\''; } return retVal; }
quote
294,153
boolean (StringBuilder buf, String pattern, int index, boolean oldInside) { char firstChar = pattern.charAt(index); boolean newInside = oldInside; //O and E are modifiers, they mean to present an alternative representation of the next char //we just handle the next char as if the O or E wasn't there if (firstChar == 'O' || firstChar == 'E') { if (index + 1 < pattern.length()) { newInside = translateCommand(buf, pattern, index + 1, oldInside); } else { buf.append(quote("%" + firstChar, oldInside)); } } else { String command = translate.get(String.valueOf(firstChar)); //If we don't find a format, treat it as a literal--That's what apache does if (command == null) { buf.append(quote("%" + firstChar, oldInside)); } else { //If we were inside quotes, close the quotes if (oldInside) { buf.append('\''); } buf.append(command); newInside = false; } } return newInside; }
translateCommand
294,154
void (String configTimeFmt, boolean fromConstructor) { this.configTimeFmt = configTimeFmt; this.strftime = new Strftime(configTimeFmt, Locale.US); setDateVariables(fromConstructor); }
setConfigTimeFormat
294,155
String (String variableName) { return getVariableValue(variableName, "none"); }
getVariableValue
294,156
String (@NotNull String variableName, String encoding) { String variableValue = ssiExternalResolver.getVariableValue(variableName); return variableValue == null ? null : encode(variableValue, encoding); }
getVariableValue
294,157
String (String val) { // If it has no references or HTML entities then no work // need to be done if (val.indexOf('$') < 0 && val.indexOf('&') < 0) { return val; } val = val.replace("&lt;", "<"); val = val.replace("&gt;", ">"); val = val.replace("&quot;", "\""); val = val.replace("&amp;", "&"); StringBuilder sb = new StringBuilder(val); int charStart = sb.indexOf("&#"); while (charStart > -1) { int charEnd = sb.indexOf(";", charStart); if (charEnd > -1) { char c = (char)Integer.parseInt( sb.substring(charStart + 2, charEnd)); sb.delete(charStart, charEnd + 1); sb.insert(charStart, c); charStart = sb.indexOf("&#"); } else { break; } } for (int i = 0; i < sb.length(); ) { // Find the next $ for (; i < sb.length(); i++) { if (sb.charAt(i) == '$') { i++; break; } } if (i == sb.length()) break; // Check to see if the $ is escaped if (i > 1 && sb.charAt(i - 2) == '\\') { sb.deleteCharAt(i - 2); i--; continue; } int nameStart = i; int start = i - 1; int end; int nameEnd; char endChar = ' '; // Check for {} wrapped var if (sb.charAt(i) == '{') { nameStart++; endChar = '}'; } // Find the end of the var reference for (; i < sb.length(); i++) { if (sb.charAt(i) == endChar) break; } end = i; nameEnd = end; if (endChar == '}') end++; // We should now have enough to extract the var name String varName = sb.substring(nameStart, nameEnd); String value = getVariableValue(varName); if (value == null) value = ""; // Replace the var name with its value sb.replace(start, end, value); // Start searching for the next $ after the value // that was just substituted. i = start + value.length(); }
substituteVariables
294,158
void (boolean fromConstructor) { if (fromConstructor && alreadySet) { return; } alreadySet = true; Date date = new Date(); TimeZone timeZone = TimeZone.getTimeZone("GMT"); ssiExternalResolver.setVariableValue("DATE_GMT", formatDate(date, timeZone)); ssiExternalResolver.setVariableValue("DATE_LOCAL", formatDate(date, null)); ssiExternalResolver.setVariableValue("LAST_MODIFIED", formatDate(new Date(lastModifiedDate), null)); }
setDateVariables
294,159
String (@NotNull Date date, @Nullable TimeZone timeZone) { if (timeZone == null) { return strftime.format(date); } else { TimeZone oldTimeZone = strftime.getTimeZone(); strftime.setTimeZone(timeZone); String retVal = strftime.format(date); strftime.setTimeZone(oldTimeZone); return retVal; } }
formatDate
294,160
String (@NotNull String value, @NotNull String encoding) { if (encoding.equalsIgnoreCase("url")) { return urlEscaper.escape(value); } else if (encoding.equalsIgnoreCase("none")) { return value; } else if (encoding.equalsIgnoreCase("entity")) { return HtmlEscapers.htmlEscaper().escape(value); } else { throw new IllegalArgumentException("Unknown encoding: " + encoding); } }
encode
294,161
long (@NotNull SsiProcessingState state, @NotNull String commandName, @NotNull List<String> paramNames, String @NotNull [] paramValues, @NotNull ByteBufUtf8Writer writer) { long lastModified = 0; String configErrMsg = state.configErrorMessage; for (int i = 0; i < paramNames.size(); i++) { String paramName = paramNames.get(i); String paramValue = paramValues[i]; String substitutedValue = state.substituteVariables(paramValue); if (paramName.equalsIgnoreCase("file") || paramName.equalsIgnoreCase("virtual")) { boolean virtual = paramName.equalsIgnoreCase("virtual"); lastModified = state.ssiExternalResolver.getFileLastModified(substitutedValue, virtual); writer.write(formatSize(state.ssiExternalResolver.getFileSize(substitutedValue, virtual), state.configSizeFmt)); } else { SsiProcessorKt.getLOG().info("#fsize--Invalid attribute: " + paramName); writer.write(configErrMsg); } } return lastModified; }
process
294,162
String (long size, @NotNull String format) { if (format.equalsIgnoreCase("bytes")) { return new DecimalFormat("#,##0").format(size); } String result; if (size == 0) { result = "0k"; } else if (size < ONE_KILOBYTE) { result = "1k"; } else if (size < ONE_MEGABYTE) { result = (size + 512) / ONE_KILOBYTE + "k"; } else if (size < 99 * ONE_MEGABYTE) { result = new DecimalFormat("0.0M").format(size / (double)ONE_MEGABYTE); } else { result = (size + (529 * ONE_KILOBYTE)) / ONE_MEGABYTE + "M"; } int charsToAdd = 5 - result.length(); if (charsToAdd < 0) { throw new IllegalArgumentException("Num chars can't be negative"); } if (charsToAdd == 0) { return result; } return " ".repeat(charsToAdd) + result; }
formatSize
294,163
boolean () { return root.evaluate(); }
evaluateTree
294,164
void (OppNode node) { // If node is null then it's just a group marker if (node == null) { oppStack.add(0, null); return; } while (true) { if (oppStack.size() == 0) break; OppNode top = oppStack.get(0); // If the top is a spacer then don't pop // anything if (top == null) break; // If the top node has a lower precedence then // let it stay if (top.getPrecedence() < node.getPrecedence()) break; // Remove the top node oppStack.remove(0); // Let it fill its branches top.popValues(nodeStack); // Stick it on the resolved node stack nodeStack.add(0, top); } // Add the new node to the opp stack oppStack.add(0, node); }
pushOpp
294,165
void () { OppNode top; while ((top = oppStack.remove(0)) != null) { // Let it fill its branches top.popValues(nodeStack); // Stick it on the resolved node stack nodeStack.add(0, top); } }
resolveGroup
294,166
String () { if (resolved == null) { resolved = ssiProcessingState.substituteVariables(value.toString()); } return resolved; }
getValue
294,167
boolean () { return !(getValue().length() == 0); }
evaluate
294,168
String () { return value.toString(); }
toString
294,169
void (List<Node> values) { right = values.remove(0); left = values.remove(0); }
popValues
294,170
boolean () { return !left.evaluate(); }
evaluate
294,171
int () { return PRECEDENCE_NOT; }
getPrecedence
294,172
void (List<Node> values) { left = values.remove(0); }
popValues
294,173
String () { return left + " NOT"; }
toString
294,174
boolean () { if (!left.evaluate()) // Short circuit { return false; } return right.evaluate(); }
evaluate
294,175
int () { return PRECEDENCE_LOGICAL; }
getPrecedence
294,176
String () { return left + " " + right + " AND"; }
toString
294,177
boolean () { if (left.evaluate()) // Short circuit { return true; } return right.evaluate(); }
evaluate
294,178
int () { return PRECEDENCE_LOGICAL; }
getPrecedence
294,179
String () { return left + " " + right + " OR"; }
toString
294,180
int () { String val1 = ((StringNode)left).getValue(); String val2 = ((StringNode)right).getValue(); int val2Len = val2.length(); if (val2Len > 1 && val2.charAt(0) == '/' && val2.charAt(val2Len - 1) == '/') { // Treat as a regular expression String expr = val2.substring(1, val2Len - 1); try { Pattern pattern = Pattern.compile(expr); // Regular expressions will only ever be used with EqualNode // so return zero for equal and non-zero for not equal if (pattern.matcher(val1).find()) { return 0; } else { return -1; } } catch (PatternSyntaxException e) { SsiProcessorKt.getLOG().warn("Invalid expression: " + expr, e); return 0; } } return val1.compareTo(val2); }
compareBranches
294,181
boolean () { return (compareBranches() == 0); }
evaluate
294,182
int () { return PRECEDENCE_COMPARE; }
getPrecedence
294,183
String () { return left + " " + right + " EQ"; }
toString
294,184
boolean () { return (compareBranches() > 0); }
evaluate
294,185
int () { return PRECEDENCE_COMPARE; }
getPrecedence
294,186
String () { return left + " " + right + " GT"; }
toString
294,187
boolean () { return (compareBranches() < 0); }
evaluate
294,188
int () { return PRECEDENCE_COMPARE; }
getPrecedence
294,189
String () { return left + " " + right + " LT"; }
toString
294,190
boolean () { return index < length; }
hasMoreTokens
294,191
int () { return index; }
getIndex
294,192
boolean (char c) { return Character.isWhitespace(c) || c == '(' || c == ')' || c == '!' || c == '<' || c == '>' || c == '|' || c == '&' || c == '='; }
isMetaChar
294,193
int () { // Skip any leading white space while (index < length && Character.isWhitespace(expr[index])) { index++; } // Clear the current token val tokenVal = null; if (index == length) return TOKEN_END; // End of string int start = index; char currentChar = expr[index]; char nextChar = (char)0; index++; if (index < length) nextChar = expr[index]; // Check for a known token start switch (currentChar) { case '(' -> { return TOKEN_LBRACE; } case ')' -> { return TOKEN_RBRACE; } case '=' -> { return TOKEN_EQ; } case '!' -> { if (nextChar == '=') { index++; return TOKEN_NOT_EQ; } return TOKEN_NOT; } case '|' -> { if (nextChar == '|') { index++; return TOKEN_OR; } } case '&' -> { if (nextChar == '&') { index++; return TOKEN_AND; } } case '>' -> { if (nextChar == '=') { index++; return TOKEN_GE; // Greater than or equal } return TOKEN_GT; // Greater than } case '<' -> { if (nextChar == '=') { index++; return TOKEN_LE; // Less than or equal } return TOKEN_LT; // Less than } default -> { } // Otherwise it's a string } int end = index; if (currentChar == '"' || currentChar == '\'') { // It's a quoted string and the end is the next unescaped quote char endChar = currentChar; boolean escaped = false; start++; for (; index < length; index++) { if (expr[index] == '\\' && !escaped) { escaped = true; continue; } if (expr[index] == endChar && !escaped) break; escaped = false; } end = index; index++; // Skip the end quote } else if (currentChar == '/') { // It's a regular expression and the end is the next unescaped / char endChar = currentChar; boolean escaped = false; for (; index < length; index++) { if (expr[index] == '\\' && !escaped) { escaped = true; continue; } if (expr[index] == endChar && !escaped) break; escaped = false; } end = ++index; } else { // End is the next whitespace character for (; index < length; index++) { if (isMetaChar(expr[index])) break; } end = index; } // Extract the string from the array this.tokenVal = new String(expr, start, end - start); return TOKEN_STRING; }
nextToken
294,194
String () { return tokenVal; }
getTokenValue
294,195
long (@NotNull SsiProcessingState ssiProcessingState, @NotNull String commandName, @NotNull List<String> paramNames, String @NotNull [] paramValues, @NotNull ByteBufUtf8Writer writer) { // Assume anything using conditionals was modified by it long lastModified = System.currentTimeMillis(); // Retrieve the current state information SsiProcessingState.SsiConditionalState state = ssiProcessingState.conditionalState; if ("if".equalsIgnoreCase(commandName)) { // Do nothing if we are nested in a false branch // except count it if (state.processConditionalCommandsOnly) { state.nestingCount++; return lastModified; } state.nestingCount = 0; // Evaluate the expression if (evaluateArguments(paramNames, paramValues, ssiProcessingState)) { // No more branches can be taken for this if block state.branchTaken = true; } else { // Do not process this branch state.processConditionalCommandsOnly = true; state.branchTaken = false; } } else if ("elif".equalsIgnoreCase(commandName)) { // No need to even execute if we are nested in // a false branch if (state.nestingCount > 0) return lastModified; // If a branch was already taken in this if block // then disable output and return if (state.branchTaken) { state.processConditionalCommandsOnly = true; return lastModified; } // Evaluate the expression if (evaluateArguments(paramNames, paramValues, ssiProcessingState)) { // Turn back on output and mark the branch state.processConditionalCommandsOnly = false; state.branchTaken = true; } else { // Do not process this branch state.processConditionalCommandsOnly = true; state.branchTaken = false; } } else if ("else".equalsIgnoreCase(commandName)) { // No need to even execute if we are nested in // a false branch if (state.nestingCount > 0) return lastModified; // If we've already taken another branch then // disable output otherwise enable it. state.processConditionalCommandsOnly = state.branchTaken; // And in any case, it's safe to say a branch // has been taken. state.branchTaken = true; } else if ("endif".equalsIgnoreCase(commandName)) { // If we are nested inside a false branch then pop out // one level on the nesting count if (state.nestingCount > 0) { state.nestingCount--; return lastModified; } // Turn output back on state.processConditionalCommandsOnly = false; // Reset the branch status for any outer if blocks, // since clearly we took a branch to have gotten here // in the first place. state.branchTaken = true; } else { throw new SsiStopProcessingException(); } return lastModified; }
process
294,196
boolean (@NotNull List<String> names, String @NotNull [] values, @NotNull SsiProcessingState ssiProcessingState) { String expression = "expr".equalsIgnoreCase(names.get(0)) ? values[0] : null; if (expression == null) { throw new SsiStopProcessingException(); } try { return new ExpressionParseTree(expression, ssiProcessingState).evaluateTree(); } catch (ParseException e) { throw new SsiStopProcessingException(); } }
evaluateArguments
294,197
ChangeApplier (@NotNull List<? extends @NotNull VFileEvent> events) { return WebServerPageConnectionService.Companion.getInstance() .reloadRelatedClients(ContainerUtil.mapNotNull(events, VFileEvent::getFile)); }
prepareChange
294,198
ProxySelector (String pacUrlForUse) { ProxySelector newProxySelector; if (pacUrlForUse == null) { ProxySearch proxySearch = ProxySearch.getDefaultProxySearch(); // cache 32 urls for up to 10 min proxySearch.setPacCacheSettings(32, 10 * 60 * 1000, BufferedProxySelector.CacheScope.CACHE_SCOPE_HOST); newProxySelector = proxySearch.getProxySelector(); } else { newProxySelector = new PacProxySelector(new UrlPacScriptSource(pacUrlForUse)); } return newProxySelector; }
getProxySelector
294,199
PowerStatus () { return PowerService.Companion.getService().status(); }
getPowerStatus