本文整理汇总了Java中java.util.Hashtable.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Hashtable.isEmpty方法的具体用法?Java Hashtable.isEmpty怎么用?Java Hashtable.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Hashtable
的用法示例。
在下文中一共展示了Hashtable.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertNativeConfig
import java.util.Hashtable; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static Hashtable<String, Object> convertNativeConfig(
Hashtable<String, Object> stanzaTable) throws IOException {
// convert SCDynamicStore realm structure to Java realm structure
Hashtable<String, ?> realms =
(Hashtable<String, ?>) stanzaTable.get("realms");
if (realms == null || realms.isEmpty()) {
throw new IOException(
"SCDynamicStore contains an empty Kerberos setting");
}
stanzaTable.remove("realms");
Hashtable<String, Object> realmsTable = convertRealmConfigs(realms);
stanzaTable.put("realms", realmsTable);
WrapAllStringInVector(stanzaTable);
if (DEBUG) System.out.println("stanzaTable : " + stanzaTable);
return stanzaTable;
}
示例2: fromSerializableHashtable
import java.util.Hashtable; //导入方法依赖的package包/类
public static AttributeValues
fromSerializableHashtable(Hashtable<Object, Object> ht)
{
AttributeValues result = new AttributeValues();
if (ht != null && !ht.isEmpty()) {
for (Map.Entry<Object, Object> e: ht.entrySet()) {
Object key = e.getKey();
Object val = e.getValue();
if (key.equals(DEFINED_KEY)) {
result.defineAll(((Integer)val).intValue());
} else {
try {
EAttribute ea =
EAttribute.forAttribute((Attribute)key);
if (ea != null) {
result.set(ea, val);
}
}
catch (ClassCastException ex) {
}
}
}
}
return result;
}
示例3: getMaterialStatus
import java.util.Hashtable; //导入方法依赖的package包/类
protected static Hashtable<String, Hashtable<String, String>> getMaterialStatus(
InventoryConfig ic) {
Hashtable<String, Hashtable<String, String>> mStHt = new Hashtable<>(1);
Map<String, MatStatusConfig> mStMap = ic.getMatStatusConfigMapByType();
if (mStMap != null && !mStMap.isEmpty()) {
Set<String> transTypes = mStMap.keySet();
if (!transTypes.isEmpty()) {
for (String transType : transTypes) {
MatStatusConfig mStConfig = mStMap.get(transType);
Hashtable<String, String> mTyStHt = new Hashtable<>();
if (mStConfig != null) {
if(mStConfig.getDf() !=null) {
String df = StringUtil.getUniqueValueCSV(mStConfig.getDf());
if (StringUtils.isNotEmpty(df)) {
mTyStHt.put(JsonTagsZ.ALL, df);
}
}
if(mStConfig.getEtsm() != null) {
String etsm = StringUtil.getUniqueValueCSV(mStConfig.getEtsm());
if (StringUtils.isNotEmpty(etsm)) {
mTyStHt.put(JsonTagsZ.TEMP_SENSITVE_MATERIALS, etsm);
}
}
if (!mTyStHt.isEmpty()) {
mTyStHt.put(JsonTagsZ.MANDATORY, String.valueOf(mStConfig.isStatusMandatory()));
mStHt.put(transType, mTyStHt);
}
}
}
}
}
return mStHt;
}
示例4: toString
import java.util.Hashtable; //导入方法依赖的package包/类
/**
* Expresa la tabla en texto
*
*@return Texto con la tabla de estados
*/
public String toString()
{
String dev = "LEYENDA: Estado: input/accion -> estado siguiente";
dev += "\n------------------------------------------------------";
java.util.Enumeration nombres = clasificacionEstados.keys();
String input = "";
String accion = "";
String estsig = "";
String id = "";
while (nombres.hasMoreElements())
{
id = (String) nombres.nextElement();
Hashtable inp = (Hashtable) inputsDeEstados.get(id);
if (!inp.isEmpty())
{
java.util.Enumeration inps = inp.keys();
while (inps.hasMoreElements())
{
input = (String) inps.nextElement();
Operacion op = (Operacion) inp.get(input);
accion = op.accionSemantica;
estsig = op.estadoSiguiente;
dev += "\n" + id + ": " + input + " / " + accion + " -> " + estsig;
}
}
else
{
dev += "\n" + id + " <- ES UN ESTADO FINAL";
}
}
return dev += "\n------------------------------------------------------";
}
示例5: getProjection
import java.util.Hashtable; //导入方法依赖的package包/类
@Override
public float getProjection(String areaAbbv, String clasfCode, String majorCode) {
if (iAreaClasfMajor2Proj.isEmpty()) return 1.0f;
Hashtable<String,Hashtable<String, Float>> clasf2major2proj = (areaAbbv == null ? null : iAreaClasfMajor2Proj.get(areaAbbv));
if (clasf2major2proj == null || clasf2major2proj.isEmpty()) return 1.0f;
Hashtable<String, Float> major2proj = (clasfCode == null ? null : clasf2major2proj.get(clasfCode));
if (major2proj == null) return 1.0f;
Float projection = (majorCode == null ? null : major2proj.get(majorCode));
if (projection == null)
projection = major2proj.get("");
return (projection == null ? 1.0f : projection);
}
示例6: getDemands
import java.util.Hashtable; //导入方法依赖的package包/类
public Set<WeightedStudentId> getDemands(CourseOffering course) {
if (iDemands.isEmpty()) return iFallback.getDemands(course);
Set<WeightedStudentId> demands = iDemands.get(course.getUniqueId());
if (!iIncludeOtherStudents) return demands;
if (demands == null) {
demands = new HashSet<WeightedStudentId>();
iDemands.put(course.getUniqueId(), demands);
}
if (iCheckedCourses.add(course.getUniqueId())) {
int was = demands.size();
Hashtable<String,Set<String>> curricula = iLoadedCurricula.get(course.getUniqueId());
Set<WeightedStudentId> other = iFallback.getDemands(course);
if (curricula == null || curricula.isEmpty()) {
demands.addAll(other);
} else {
other: for (WeightedStudentId student: other) {
// if (student.getMajors().isEmpty()) continue; // ignore students w/o academic area
for (AreaClasfMajor acm: student.getMajors()) {
Set<String> majors = curricula.get(acm.getArea());
if (majors != null && (majors.contains("") || student.match(acm.getArea(), majors))) continue other; // all majors or match
}
demands.add(student);
}
}
if (demands.size() > was)
sLog.info(course.getCourseName() + " has " + (demands.size() - was) + " other students (besides of the " + was + " curriculum students).");
}
return demands;
}
示例7: getProjection
import java.util.Hashtable; //导入方法依赖的package包/类
public float getProjection(Hashtable<String,HashMap<String, Float>> clasf2major2proj, String majorCode, String clasfCode) {
if (clasf2major2proj == null || clasf2major2proj.isEmpty()) return 1.0f;
HashMap<String, Float> major2proj = clasf2major2proj.get(clasfCode);
if (major2proj == null) return 1.0f;
Float projection = major2proj.get(majorCode);
if (projection == null)
projection = major2proj.get("");
return (projection == null ? 1.0f : projection);
}
示例8: getSnapshotProjection
import java.util.Hashtable; //导入方法依赖的package包/类
public float getSnapshotProjection(Hashtable<String, HashMap<String, Float>> clasf2major2ssproj, String majorCode,
String clasfCode) {
if (clasf2major2ssproj == null || clasf2major2ssproj.isEmpty())
return 1.0f;
HashMap<String, Float> major2ssproj = clasf2major2ssproj.get(clasfCode);
if (major2ssproj == null)
return 1.0f;
Float snapshotProjection = major2ssproj.get(majorCode);
if (snapshotProjection == null)
snapshotProjection = major2ssproj.get("");
return (snapshotProjection == null ? 1.0f : snapshotProjection);
}
示例9: getProjection
import java.util.Hashtable; //导入方法依赖的package包/类
private float getProjection(Hashtable<String,HashMap<String, Float>> clasf2major2proj, String majorCode, String clasfCode) {
if (clasf2major2proj == null || clasf2major2proj.isEmpty()) return 1.0f;
HashMap<String, Float> major2proj = clasf2major2proj.get(clasfCode);
if (major2proj == null) return 1.0f;
Float projection = major2proj.get(majorCode);
if (projection == null)
projection = major2proj.get("");
return (projection == null ? 1.0f : projection);
}
示例10: getProjection
import java.util.Hashtable; //导入方法依赖的package包/类
public float getProjection(Hashtable<String,Hashtable<String, Float>> clasf2major2proj, String majorCode, String clasfCode) {
if (clasf2major2proj == null || clasf2major2proj.isEmpty()) return 1.0f;
Hashtable<String, Float> major2proj = clasf2major2proj.get(clasfCode);
if (major2proj == null) return 1.0f;
Float projection = major2proj.get(majorCode);
if (projection == null)
projection = major2proj.get("");
return (projection == null ? 1.0f : projection);
}
示例11: callUserDataHandlers
import java.util.Hashtable; //导入方法依赖的package包/类
/**
* Call user data handlers when a node is deleted (finalized)
* @param n The node this operation applies to.
* @param c The copy node or null.
* @param operation The operation - import, clone, or delete.
*/
void callUserDataHandlers(Node n, Node c, short operation) {
if (userData == null) {
return;
}
//Hashtable t = (Hashtable) userData.get(n);
if(n instanceof NodeImpl){
Hashtable t = ((NodeImpl)n).getUserDataRecord();
if (t == null || t.isEmpty()) {
return;
}
callUserDataHandlers(n, c, operation,t);
}
}
示例12: getReasonsByTag
import java.util.Hashtable; //导入方法依赖的package包/类
private static Hashtable<String, Hashtable<String, String>> getReasonsByTag(InventoryConfig ic) {
Hashtable<String, Hashtable<String, String>> rsnsByMtag = new Hashtable<>(1);
// For Issue
Map<String, String> iMtagReasons = ic.getImTransReasons();
if (iMtagReasons != null && !iMtagReasons.isEmpty()) {
Hashtable<String, String> iMtagReasonsHt = getHashtableFromMap(iMtagReasons);
if (iMtagReasonsHt != null && !iMtagReasonsHt.isEmpty()) {
rsnsByMtag.put(JsonTagsZ.ISSUES, iMtagReasonsHt);
}
}
// For Receipt
Map<String, String> rMtagReasons = ic.getRmTransReasons();
if (rMtagReasons != null && !rMtagReasons.isEmpty()) {
Hashtable<String, String> rMTagReasonsHt = getHashtableFromMap(rMtagReasons);
if (rMTagReasonsHt != null && !rMTagReasonsHt.isEmpty()) {
rsnsByMtag.put(JsonTagsZ.RECEIPTS, rMTagReasonsHt);
}
}
// For Physical stock count
Map<String, String> scMtagReasons = ic.getSmTransReasons();
if (scMtagReasons != null && !scMtagReasons.isEmpty()) {
Hashtable<String, String> scMTagReasonsHt = getHashtableFromMap(scMtagReasons);
if (scMTagReasonsHt != null && !scMTagReasonsHt.isEmpty()) {
rsnsByMtag.put(JsonTagsZ.PHYSICAL_STOCK, scMTagReasonsHt);
}
}
// For Wastage/Discards
Map<String, String> wMtagReasons = ic.getDmTransReasons();
if (wMtagReasons != null && !wMtagReasons.isEmpty()) {
Hashtable<String, String> wMTagReasonsHt = getHashtableFromMap(wMtagReasons);
if (wMTagReasonsHt != null && !wMTagReasonsHt.isEmpty()) {
rsnsByMtag.put(JsonTagsZ.DISCARDS, wMTagReasonsHt);
}
}
// For Transfer
Map<String, String> tMtagReasons = ic.getTmTransReasons();
if (tMtagReasons != null && !tMtagReasons.isEmpty()) {
Hashtable<String, String> tMTagReasonsHt = getHashtableFromMap(tMtagReasons);
if (tMTagReasonsHt != null && !tMTagReasonsHt.isEmpty()) {
rsnsByMtag.put(JsonTagsZ.TRANSFER, tMTagReasonsHt);
}
}
return rsnsByMtag;
}
示例13: toMessageString
import java.util.Hashtable; //导入方法依赖的package包/类
public Vector toMessageString() throws ProtocolException {
String msg = version + " " + statusCode;
if (!status) {
if (errMsg == null) {
if (hasOrders) {
if (orders == null || orders.isEmpty()) {
errMsg = protoMessages.getString("error.noorders");
}
} else {
if (materials == null || materials.isEmpty()) {
errMsg = protoMessages.getString("error.nomaterials");
}
}
}
msg += " " + MessageUtil.encode(errMsg);
} else {
if (hasOrders) {
msg += " " + MODE_ORDER;
int numOrders = orders.size();
msg += " " + numOrders;
Enumeration en = orders.elements();
while (en.hasMoreElements()) {
Hashtable ord = (Hashtable) en.nextElement();
if (ord == null || ord.isEmpty()) {
throw new ProtocolException(protoMessages.getString("error.noorder"));
}
msg += " " + MessageUtil.getOrderString(ord, version);
}
} else {
msg += " " + MODE_DEMAND;
String cur = MessageUtil.DUMMY;
if (currency != null && currency.length() > 0) {
cur = currency;
}
msg += " " + cur; // currency
////int numMaterials = materials.size();
////msg += " " + numMaterials; // num. materials
msg +=
" " + MessageUtil
.getMaterialsString(materials, MessageUtil.QUANTITY_AND_PRICE, true); // materials
}
}
return MessageUtil.split(msg, getMessageId());
}
示例14: getOrderString
import java.util.Hashtable; //导入方法依赖的package包/类
public static String getOrderString(Hashtable order, String version) throws ProtocolException {
if (order == null || order.isEmpty()) {
throw new ProtocolException("No order specified");
}
String msg = (String) order.get(JsonTagsZ.TRACKING_ID) + SEP2 +
(String) order.get(JsonTagsZ.ORDER_STATUS) + SEP2 +
(String) order.get(JsonTagsZ.QUANTITY) + SEP2 +
encode((String) order.get(JsonTagsZ.TIMESTAMP));
String value = null;
if ((value = (String) order.get(JsonTagsZ.UPDATED_TIME)) != null && !value.equals("")) {
msg += SEP2 + encode(value);
} else {
msg += SEP2 + DUMMY;
}
if ((value = (String) order.get(JsonTagsZ.TOTAL_PRICE)) != null && !value.equals("")) {
msg += SEP2 + value;
} else {
msg += SEP2 + DUMMY;
}
if ((value = (String) order.get(JsonTagsZ.CURRENCY)) != null && !value.equals("")) {
msg += SEP2 + value;
} else {
msg += SEP2 + DUMMY;
}
if ((value = (String) order.get(JsonTagsZ.MESSAGE)) != null && !value.equals("")) {
msg += SEP2 + encode(value);
} else {
msg += SEP2 + DUMMY;
}
if (Integer.parseInt(version) >= Integer
.parseInt(MessageHeader.VERSION02)) { // MessageHeader.VERSION02.equals( version ) ) {
// Vendor ID
if ((value = (String) order.get(JsonTagsZ.VENDORID)) != null && !value.equals("")) {
msg += SEP2 + value;
} else {
msg += SEP2 + DUMMY;
}
}
if (Integer.parseInt(version) >= Integer
.parseInt(MessageHeader.VERSION05)) { // version 05 onwards
// Discount
if ((value = (String) order.get(JsonTagsZ.DISCOUNT)) != null && !value.equals("")) {
msg += SEP2 + value;
} else {
msg += SEP2 + DUMMY;
}
}
if (Integer.parseInt(version) >= Integer
.parseInt(MessageHeader.VERSION06)) { // version 06 onwards
// Kiosk Id (Customer)
if ((value = (String) order.get(JsonTagsZ.KIOSK_ID)) != null && !value.equals("")) {
msg += SEP2 + value;
} else {
msg += SEP2 + DUMMY;
}
}
// Add materials
msg +=
SEP2 + getMaterialsString((Vector) order.get(JsonTagsZ.MATERIALS), QUANTITY_AND_PRICE,
true);
// Split message
return msg;
}
示例15: JenrlInfo
import java.util.Hashtable; //导入方法依赖的package包/类
public JenrlInfo(Solver solver, JenrlConstraint jc) {
super();
Assignment<Lecture, Placement> assignment = solver.currentSolution().getAssignment();
TimetableModel model = (TimetableModel)solver.currentSolution().getModel();
Lecture first = (Lecture)jc.first();
Placement firstPl = (Placement)assignment.getValue(first);
Lecture second = (Lecture)jc.second();
Placement secondPl = (Placement)assignment.getValue(second);
if (solver!=null) {
if (firstPl!=null)
iFirst = new ClassAssignmentDetails(solver,first,firstPl,false);
if (secondPl!=null)
iSecond = new ClassAssignmentDetails(solver,second,secondPl,false);
}
if (firstPl==null || secondPl==null) return;
setJenrl(jc.getJenrl());
setIsSatisfied(jc.isInConflict(assignment));
if (jc.isInConflict(assignment)) {
setIsHard(first.areStudentConflictsHard(second));
setIsFixed(first.nrTimeLocations()==1 && second.nrTimeLocations()==1);
setIsDistance(!firstPl.getTimeLocation().hasIntersection(secondPl.getTimeLocation()));
setIsCommited(jc.areStudentConflictsCommitted());
if (isDistance())
setDistance(Placement.getDistanceInMeters(model.getDistanceMetric(),firstPl,secondPl));
StudentConflict imp = (StudentConflict)model.getCriterion(ImportantStudentConflict.class);
setIsImportant(imp != null && imp.isApplicable(first, second) && imp.inConflict(firstPl, secondPl));
setIsInstructor(jc.getNrInstructors() > 0);
}
Hashtable<String, Double> curriculum2nrStudents = new Hashtable<String, Double>();
for (Student student: jc.first().sameStudents(jc.second())) {
if (student.getCurriculum() == null || student.getCurriculum().isEmpty()) continue;
for (String c: student.getCurriculum().split("\\|")) {
Double nrStudents = curriculum2nrStudents.get(c);
curriculum2nrStudents.put(student.getCurriculum(), jc.getJenrlWeight(student) + (nrStudents == null ? 0.0 : nrStudents));
}
}
if (!curriculum2nrStudents.isEmpty()) {
iCurriculum2nrStudents = new TreeSet<CurriculumInfo>();
for (Map.Entry<String, Double> entry: curriculum2nrStudents.entrySet()) {
iCurriculum2nrStudents.add(new CurriculumInfo(entry.getKey(), entry.getValue()));
}
}
}