Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Rhino JavaScript Java Library Source Code
Rhino JavaScript Java Library is an open-source implementation of JavaScript
written entirely in Java.
Rhino JavaScript Java Library Source Code files are provided in binary package (rhino-1.7.14.zip).
You can also browse the source code below:
✍: FYIcenter.com
⏎ org/mozilla/javascript/ast/SwitchCase.java
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mozilla.javascript.ast; import java.util.ArrayList; import java.util.List; import org.mozilla.javascript.Token; /** * Switch-case AST node type. The switch case is always part of a * switch statement. * Node type is {@link Token#CASE}. * * <pre><i>CaseBlock</i> : * { [CaseClauses] } * { [CaseClauses] DefaultClause [CaseClauses] } * <i>CaseClauses</i> : * CaseClause * CaseClauses CaseClause * <i>CaseClause</i> : * <b>case</b> Expression : [StatementList] * <i>DefaultClause</i> : * <b>default</b> : [StatementList]</pre> */ public class SwitchCase extends AstNode { private AstNode expression; private List<AstNode> statements; { type = Token.CASE; } public SwitchCase() { } public SwitchCase(int pos) { super(pos); } public SwitchCase(int pos, int len) { super(pos, len); } /** * Returns the case expression, {@code null} for default case */ public AstNode getExpression() { return expression; } /** * Sets the case expression, {@code null} for default case. * Note that for empty fall-through cases, they still have * a case expression. In {@code case 0: case 1: break;} the * first case has an {@code expression} that is a * {@link NumberLiteral} with value {@code 0}. */ public void setExpression(AstNode expression) { this.expression = expression; if (expression != null) expression.setParent(this); } /** * Return true if this is a default case. * @return true if {@link #getExpression} would return {@code null} */ public boolean isDefault() { return expression == null; } /** * Returns statement list, which may be {@code null}. */ public List<AstNode> getStatements() { return statements; } /** * Sets statement list. May be {@code null}. Replaces any existing * statements. Each element in the list has its parent set to this node. */ public void setStatements(List<AstNode> statements) { if (this.statements != null) { this.statements.clear(); } for (AstNode s : statements) { addStatement(s); } } /** * Adds a statement to the end of the statement list. * Sets the parent of the new statement to this node, updates * its start offset to be relative to this node, and sets the * length of this node to include the new child. * * @param statement a child statement * @throws IllegalArgumentException} if statement is {@code null} */ public void addStatement(AstNode statement) { assertNotNull(statement); if (statements == null) { statements = new ArrayList<AstNode>(); } int end = statement.getPosition() + statement.getLength(); this.setLength(end - this.getPosition()); statements.add(statement); statement.setParent(this); } @Override public String toSource(int depth) { StringBuilder sb = new StringBuilder(); sb.append(makeIndent(depth)); if (expression == null) { sb.append("default:\n"); } else { sb.append("case "); sb.append(expression.toSource(0)); sb.append(":"); if(this.getInlineComment() != null) { sb.append(this.getInlineComment().toSource(depth + 1)); } sb.append("\n"); } if (statements != null) { for (AstNode s : statements) { sb.append(s.toSource(depth+1)); if(s.getType() == Token.COMMENT && ((Comment)s).getCommentType() == Token.CommentType.LINE) { sb.append("\n"); } } } return sb.toString(); } /** * Visits this node, then the case expression if present, then * each statement (if any are specified). */ @Override public void visit(NodeVisitor v) { if (v.visit(this)) { if (expression != null) { expression.visit(v); } if (statements != null) { for (AstNode s : statements) { s.visit(v); } } } } }
⏎ org/mozilla/javascript/ast/SwitchCase.java
Or download all of them as a single archive file:
File name: rhino-1.7.14-sources.jar File size: 1029165 bytes Release date: 2022-01-06 Download
⇒ Example code to Test rhino-runtime-1.7.14.jar
⇐ Download Rhino JavaScript Binary Package
2022-05-03, ≈77🔥, 1💬
Popular Posts:
What Is ojdbc14.jar for Oracle 10g R2? ojdbc14.jar for Oracle 10g R2 is the JAR files of ojdbc.jar, ...
How to download and install Apache XMLBeans-2.6.0.zip? If you want to try the XMLBeans Java library,...
JDK 17 jdk.jfr.jmod is the JMOD file for JDK 17 JFR module. JDK 17 JFR module compiled class files a...
How to download and install iText7-Core-7.1.4.zip? iText7-Core-7.1.4.zip is the binary package of iT...
JDK 11 java.sql.jmod is the JMOD file for JDK 11 SQL (Structured Query Language) module. JDK 11 SQL ...