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:
Apache ZooKeeper Jute Source Code
Apache ZooKeeper is an open-source server which enables highly
reliable distributed coordination.
Apache ZooKeeper Jute Source Code files are provided in the source package file, apache-zookeeper-3.8.0.tar.gz.
You can download apache-zookeeper-3.8.0.tar.gz as described in the previous tutorial and go to the "zookeeper-jute" sub-folder to view Apache ZooKeeper Jute Source Code files.
You can also browse Apache ZooKeeper Jute Source Code below:
✍: FYIcenter.com
⏎ org/apache/jute/compiler/JMap.java
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jute.compiler;
/**
*
*/
public class JMap extends JCompType {
private static int level = 0;
private static String getLevel() {
return Integer.toString(level);
}
private static void incrLevel() {
level++;
}
private static void decrLevel() {
level--;
}
private static String getId(String id) {
return id + getLevel();
}
private JType mKey;
private JType mValue;
/**
* Creates a new instance of JMap.
*/
public JMap(JType t1, JType t2) {
super("#error", " ::std::map<" + t1.getCppType() + "," + t2.getCppType() + ">",
"System.Collections.Generic.SortedDictionary<string, string>", "java.util.TreeMap", "Map", "System.Collections.Generic.SortedDictionary<string, string>", "java.util.TreeMap");
mKey = t1;
mValue = t2;
}
public String getSignature() {
return "{" + mKey.getSignature() + mValue.getSignature() + "}";
}
public String genJavaCompareTo(String fname) {
return " throw new UnsupportedOperationException(\"comparing "
+ fname + " is unimplemented\");\n";
}
public String genJavaReadWrapper(String fname, String tag, boolean decl) {
StringBuilder ret = new StringBuilder("");
if (decl) {
ret.append(" java.util.TreeMap " + fname + ";\n");
}
ret.append(" {\n");
incrLevel();
ret.append(" org.apache.jute.Index " + getId("midx") + " = a_.startMap(\"" + tag + "\");\n");
ret.append(" " + fname + "=new java.util.TreeMap();\n");
ret.append(" for (; !" + getId("midx") + ".done(); " + getId("midx") + ".incr()) {\n");
ret.append(mKey.genJavaReadWrapper(getId("k"), getId("k"), true));
ret.append(mValue.genJavaReadWrapper(getId("v"), getId("v"), true));
ret.append(" " + fname + ".put(" + getId("k") + "," + getId("v") + ");\n");
ret.append(" }\n");
ret.append(" a_.endMap(\"" + tag + "\");\n");
decrLevel();
ret.append(" }\n");
return ret.toString();
}
public String genJavaReadMethod(String fname, String tag) {
return genJavaReadWrapper(fname, tag, false);
}
public String genJavaWriteWrapper(String fname, String tag) {
StringBuilder ret = new StringBuilder(" {\n");
incrLevel();
ret.append(" a_.startMap(" + fname + ",\"" + tag + "\");\n");
ret.append(" java.util.Set " + getId("es") + " = " + fname + ".entrySet();\n");
ret.append(" for(java.util.Iterator " + getId("midx") + " = " + getId("es") + ".iterator(); " + getId("midx") + ".hasNext(); ) {\n");
ret.append(" java.util.Map.Entry " + getId("me") + " = (java.util.Map.Entry) " + getId("midx") + ".next();\n");
ret.append(" " + mKey.getJavaWrapperType() + " " + getId("k") + " = (" + mKey.getJavaWrapperType() + ") " + getId("me") + ".getKey();\n");
ret.append(" " + mValue.getJavaWrapperType() + " " + getId("v") + " = (" + mValue.getJavaWrapperType() + ") " + getId("me") + ".getValue();\n");
ret.append(mKey.genJavaWriteWrapper(getId("k"), getId("k")));
ret.append(mValue.genJavaWriteWrapper(getId("v"), getId("v")));
ret.append(" }\n");
ret.append(" a_.endMap(" + fname + ",\"" + tag + "\");\n");
ret.append(" }\n");
decrLevel();
return ret.toString();
}
public String genJavaWriteMethod(String fname, String tag) {
return genJavaWriteWrapper(fname, tag);
}
public String genCsharpWriteWrapper(String fname, int tag) {
StringBuilder ret = new StringBuilder(" {\n");
incrLevel();
ret.append(" a_.StartMap(" + fname + ",\"" + tag + "\");\n");
ret.append(" java.util.Set " + getId("es") + " = " + fname + ".entrySet();\n");
ret.append(" for(java.util.Iterator " + getId("midx") + " = " + getId("es") + ".iterator(); " + getId("midx") + ".hasNext(); ) {\n");
ret.append(" java.util.Map.Entry " + getId("me") + " = (java.util.Map.Entry) " + getId("midx") + ".next();\n");
ret.append(" " + mKey.getCsharpWrapperType() + " " + getId("k") + " = (" + mKey.getCsharpWrapperType() + ") " + getId("me") + ".getKey();\n");
ret.append(" " + mValue.getCsharpWrapperType() + " " + getId("v") + " = (" + mValue.getCsharpWrapperType() + ") " + getId("me") + ".getValue();\n");
ret.append(mKey.genCsharpWriteWrapper(getId("k"), getId("k")));
ret.append(mValue.genCsharpWriteWrapper(getId("v"), getId("v")));
ret.append(" }\n");
ret.append(" a_.EndMap(" + fname + ",\"" + tag + "\");\n");
ret.append(" }\n");
decrLevel();
return ret.toString();
}
String genCsharpWriteMethod(String fname, int tag) {
return genCsharpWriteWrapper(fname, tag);
}
public String genCsharpReadWrapper(String fname, int tag, boolean decl) {
StringBuilder ret = new StringBuilder("");
if (decl) {
ret.append(" System.Collections.SortedDictionary<string,string> " + capitalize(fname) + ";\n");
}
ret.append(" {\n");
incrLevel();
ret.append(" Org.Apache.Jute.IIndex " + getId("midx") + " = a_.StartMap(\"" + tag + "\");\n");
ret.append(" " + fname + "= new System.Collections.SortedDictionary<string,string>();\n");
ret.append(" for (; !" + getId("midx") + ".done(); " + getId("midx") + ".incr()) {\n");
ret.append(mKey.genCsharpReadWrapper(getId("k"), getId("k"), true));
ret.append(mValue.genCsharpReadWrapper(getId("v"), getId("v"), true));
ret.append(" " + fname + ".Add(" + getId("k") + "," + getId("v") + ");\n");
ret.append(" }\n");
ret.append(" a_.EndMap(\"" + tag + "\");\n");
decrLevel();
ret.append(" }\n");
return ret.toString();
}
String genCsharpReadMethod(String fname, int tag) {
return genCsharpReadWrapper(fname, tag, false);
}
}
⏎ org/apache/jute/compiler/JMap.java
Or download all of them as a single archive file:
File name: zookeeper-jute-3.8.0-fyi.zip File size: 52965 bytes Release date: 2022-02-25 Download
⇒ Apache ZooKeeper IT Source Code
⇐ Apache ZooKeeper Server Source Code
2022-02-04, ∼9344🔥, 0💬
Popular Posts:
JDK 11 jdk.rmic.jmod is the JMOD file for JDK 11 RMI (Remote Method Invocation) Compiler Tool tool, ...
io.jar is a component in iText Java library to provide input/output functionalities. iText Java libr...
How to download and install JDK (Java Development Kit) 8? If you want to write Java applications, yo...
XStream is a simple library to serialize objects to XML and back again. JAR File Size and Download L...
The Jakarta-ORO Java classes are a set of text-processing Java classes that provide Perl5 compatible...