当前位置: 首页>>代码示例>>Java>>正文


Java Vector.isEmpty方法代码示例

本文整理汇总了Java中java.util.Vector.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.isEmpty方法的具体用法?Java Vector.isEmpty怎么用?Java Vector.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Vector的用法示例。


在下文中一共展示了Vector.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import java.util.Vector; //导入方法依赖的package包/类
public void load(HttpSession session) {
    setSubjectArea(session.getAttribute("Exams.subjectArea")==null?null:(String)session.getAttribute("Exams.subjectArea"));
    iSessions = new Vector();
       setSession(session.getAttribute("Exams.session")==null?iSessions.isEmpty()?null:Long.valueOf(((ComboBoxLookup)iSessions.lastElement()).getValue()):(Long)session.getAttribute("Exams.session"));
       boolean hasSession = false;
    for (Iterator i=Session.getAllSessions().iterator();i.hasNext();) {
        Session s = (Session)i.next();
        if (s.getStatusType()!=null && (s.canNoRoleReportExamFinal() || s.canNoRoleReportExamMidterm()) && Exam.hasTimetable(s.getUniqueId())) {
            if (s.getUniqueId().equals(getSession())) hasSession = true;
            iSessions.add(new ComboBoxLookup(s.getLabel(),s.getUniqueId().toString()));
        }
    }
    if (!hasSession) { setSession(null); setSubjectArea(null); }
    if (getSession()==null && !iSessions.isEmpty()) setSession(Long.valueOf(((ComboBoxLookup)iSessions.lastElement()).getValue()));
    iSubjectAreas = new TreeSet(new SubjectAreaDAO().getSession().createQuery("select distinct sa.subjectAreaAbbreviation from SubjectArea sa").setCacheable(true).list());
    setExamType(session.getAttribute("Exams.examType")==null?iExamType:(Long)session.getAttribute("Exams.examType"));
    setCanRetrieveAllExamForAllSubjects(canDisplayAllSubjectsAtOnce());
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:19,代码来源:ExamsForm.java

示例2: DecodeThread

import java.util.Vector; //导入方法依赖的package包/类
DecodeThread(CaptureActivity activity,
             Vector<BarcodeFormat> decodeFormats,
             String characterSet,
             ResultPointCallback resultPointCallback) {

  this.activity = activity;
  handlerInitLatch = new CountDownLatch(1);

  hints = new Hashtable<DecodeHintType, Object>(3);

  if (decodeFormats == null || decodeFormats.isEmpty()) {
  	 decodeFormats = new Vector<BarcodeFormat>();
  	 decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
  	 decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
  	 decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
  }
  
  hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

  if (characterSet != null) {
    hints.put(DecodeHintType.CHARACTER_SET, characterSet);
  }

  hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:DecodeThread.java

示例3: removeProjectHistory

import java.util.Vector; //导入方法依赖的package包/类
public static void removeProjectHistory(Project prj) {
    Vector list = new Vector();
    String id;
    
    for (int i = 0; i < _list.size(); i++) {
        id = (((HistoryItem) _list.elementAt(i)).getProject()).getID();
        if (id.equals(prj.getID())) {
            list.add(_list.elementAt(i));
            p--;
            if (_list.elementAt(i).equals(prev)) {
                if (p > 0) prev = _list.get(p - 1);
                else prev = null;
            }
        }
    }
    if (!list.isEmpty()) {
        _list.removeAll(list);
        if (p < 0) {
            p = 0;
        }
        _list.setSize(p);
        next = null;
        historyBackAction.update();
        historyForwardAction.update();
    }
}
 
开发者ID:ser316asu,项目名称:SER316-Munich,代码行数:27,代码来源:History.java

示例4: fromMessageString

import java.util.Vector; //导入方法依赖的package包/类
public void fromMessageString(Vector messages) throws ProtocolException {
  if (messages == null || messages.isEmpty()) {
    throw new ProtocolException("No message specified");
  }
  // Assemble message
  String msg = MessageUtil.assemble(messages);
  if (msg == null || msg.length() == 0) {
    throw new ProtocolException("Message not assembled");
  }
  // Tokenize
  StringTokenizer st = new StringTokenizer(msg, " ");
  if (st.countTokens() < 3) {
    throw new ProtocolException("At least 3 tokens are expected");
  }
  version = st.nextToken();
  statusCode = st.nextToken();
  status = JsonTagsZ.STATUS_TRUE.equals(statusCode);
  if (!status) {
    errMsg = MessageUtil.decode(st.nextToken());
  } else {
    orderData = MessageUtil.getOrderObject(st, version);
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:24,代码来源:OrderOutput.java

示例5: addAnnotationListener

import java.util.Vector; //导入方法依赖的package包/类
/**
 *
 * Adds an annotation listener
 */
@Override
public synchronized void addAnnotationListener(AnnotationListener l) {
  @SuppressWarnings("unchecked")
  Vector<AnnotationListener> v = annotationListeners == null ? new Vector<AnnotationListener>(2) : (Vector<AnnotationListener>) annotationListeners.clone();

  //now check and if this is the first listener added,
  //start listening to all features, so their changes can
  //also be propagated
  if (v.isEmpty()) {
    FeatureMap features = getFeatures();
    if (eventHandler == null)
      eventHandler = new EventsHandler();
    features.addFeatureMapListener(eventHandler);
  }

  if (!v.contains(l)) {
    v.addElement(l);
    annotationListeners = v;
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:25,代码来源:AnnotationImpl.java

示例6: findLiveBlocks

import java.util.Vector; //导入方法依赖的package包/类
public static BasicBlock[] findLiveBlocks(BasicBlock[] blocks) {
	// add reachable blocks
	Vector next = new Vector ();
	next.addElement( blocks[0] );
	while ( ! next.isEmpty() ) {
		BasicBlock b = (BasicBlock) next.elementAt(0);
		next.removeElementAt(0);
		if ( ! b.islive ) {
			b.islive = true;
			for ( int i=0, n=b.next!=null? b.next.length: 0; i<n; i++ )
				if ( ! b.next[i].islive )
					next.addElement( b.next[i] );
		}
	}
	
	// create list in natural order
	Vector list = new Vector();
	for ( int i=0; i<blocks.length; i=blocks[i].pc1+1 )
		if ( blocks[i].islive )
			list.addElement(blocks[i]);
	
	// convert to array
	BasicBlock[] array = new BasicBlock[list.size()];
	list.copyInto(array);
	return array;
}
 
开发者ID:hsllany,项目名称:HtmlNative,代码行数:27,代码来源:BasicBlock.java

示例7: removeNotifications

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Removes all the timer notifications corresponding to the specified type from the list of notifications.
 *
 * @param type The timer notification type.
 *
 * @exception InstanceNotFoundException The specified type does not correspond to any timer notification
 * in the list of notifications of this timer MBean.
 */
public synchronized void removeNotifications(String type) throws InstanceNotFoundException {

    Vector<Integer> v = getNotificationIDs(type);

    if (v.isEmpty())
        throw new InstanceNotFoundException("Timer notifications to remove not in the list of notifications");

    for (Integer i : v)
        removeNotification(i);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:Timer.java

示例8: getRunnableParametricAnalysis

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Gets an array of String containing the description of available parametric simulations
 * @return the array
 */
public String[] getRunnableParametricAnalysis() {
	String[] runnable;
	Vector<String> runnableVector = new Vector<String>(0, 1);
	//check if "Number of customer" parametric analysis is runnable
	Vector<Object> temp = cd.getClosedClassKeys();
	if (!temp.isEmpty()) {
		runnableVector.add(ParametricAnalysis.PA_TYPE_NUMBER_OF_CUSTOMERS);
	}
	//check if "Population mix" parametric analysis is runnable
	if (temp.size() == 2) {
		runnableVector.add(ParametricAnalysis.PA_TYPE_POPULATION_MIX);
	}
	//check if "Service time" parametric analysis is runnable
	temp = checkForServiceTimesParametricAnalysisAvailableStations();
	if (!temp.isEmpty()) {
		runnableVector.add(ParametricAnalysis.PA_TYPE_SERVICE_TIMES);
	}
	//check if "Arrival rate" parametric analysis is runnable
	temp = checkForArrivalRatesParametricSimulationAvailableClasses();
	if (!temp.isEmpty()) {
		runnableVector.add(ParametricAnalysis.PA_TYPE_ARRIVAL_RATE);
	}
	//check if "Seed" parametric analysis is available
	if (!cd.getClassKeys().isEmpty() && !sd.getStationKeys().isEmpty()) {
		runnableVector.add(ParametricAnalysis.PA_TYPE_SEED);
	}
	//initialize runnable array
	runnable = new String[runnableVector.size()];
	for (int i = 0; i < runnable.length; i++) {
		runnable[i] = runnableVector.get(i);
	}
	return runnable;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:38,代码来源:ParametricAnalysisChecker.java

示例9: fromMessageString

import java.util.Vector; //导入方法依赖的package包/类
public void fromMessageString(Vector messages) throws ProtocolException {
  if (messages == null || messages.isEmpty()) {
    throw new ProtocolException("No message specified");
  }
  // Assemble
  String msg = MessageUtil.assemble(messages);
  if (msg == null || msg.length() == 0) {
    throw new ProtocolException("Message not assembled");
  }
  // Tokenize
  StringTokenizer st = new StringTokenizer(msg, " ");
  if (st.countTokens() < 3) {
    throw new ProtocolException("At least 3 tokens expected in message");
  }
  version = st.nextToken();
  statusCode = st.nextToken();
  status = JsonTagsZ.STATUS_TRUE.equals(statusCode);
  if (!status) {
    errMsg = MessageUtil.decode(st.nextToken());
  } else {
    hasOrders = MODE_ORDER.equals(st.nextToken()); // mode
    if (hasOrders) {
      int numOrders = Integer.parseInt(st.nextToken()); // number of orders
      orders = new Vector();
      for (int i = 0; i < numOrders; i++) {
        orders.addElement(MessageUtil.getOrderObject(st, version));
      }
    } else {
      currency = st.nextToken();
      if (MessageUtil.DUMMY.equals(currency)) {
        currency = null;
      }
      materials = MessageUtil.getMaterialsVector(st, null);
    }
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:37,代码来源:GetOrdersOutput.java

示例10: fromMessageString

import java.util.Vector; //导入方法依赖的package包/类
public void fromMessageString(Vector messages) throws ProtocolException {
  if (messages == null || messages.isEmpty()) {
    throw new ProtocolException("Message not specified");
  }
  String message = MessageUtil.assemble(messages);
  if (message == null || message.length() == 0) {
    throw new ProtocolException("Message not assembled");
  }
  StringTokenizer st = new StringTokenizer(message, " ");
  if (st.countTokens() < 4) {
    throw new ProtocolException("At least 4 tokens have to be present in message");
  }
  version = st.nextToken();
  String cmdM = st.nextToken();
  if (!RestConstantsZ.ACTION_GETINVENTORY.equals(cmdM)) {
    throw new ProtocolException(
        "Invalid command: " + cmdM + ". Excepted " + RestConstantsZ.ACTION_GETINVENTORY);
  }
  userId = st.nextToken();
  password = st.nextToken();
  onlyStock = "1".equals(st.nextToken());
  if (MessageHeader.VERSION03.equals(version)) {
    kid = st.nextToken();
    if (MessageUtil.DUMMY.equals(kid)) {
      kid = null;
    }
  }
  String value = null;
  if (st.hasMoreTokens()) {
    value = st.nextToken(); // check for missing response messages that did not arrive at client
  }
  if (value != null && !MessageUtil.DUMMY.equals(value)) {
    setResponseMessageNumbers(value);
  }
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:36,代码来源:GetInventoryInput.java

示例11: ConstraintStackElement

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Creates a new ConstraintStackElement instance out of the passed ComposedConstraint.
 * All disjunctions (of type ConjunctiveConstrainSystem) are recursively retrieved
 * out of the {@code constraint}'s DNF.
 * </br>
 * </br>
 * Is only called by the ConstraintStack. Hence the constructor is protected.
 * 
 * @param expression the ConstraintExpression used to create the ComposedConstraint
 * @param constraint the constraint that should be added to the constraint
 * stack.
 * @param pred the lastly added ConstraintStackElement. The new
 * ConstraintStackElement instance will directly be linked behind this
 * element.
 * @see ConjunctiveConstraintSystem
 */
protected ConstraintStackElement(ConstraintExpression expression, 
 			     ComposedConstraint constraint, 
 			     ConstraintStackElement pred){

	this.pred = pred;
	this.solutionCache = new SolutionCache(this);

	// the expression is held without changing it
	this.expression = expression;

	// get systems out of composed constraint and collect them in a Vector
	Vector<ConstraintSystem> systems = new Vector<ConstraintSystem>();
	for (int i = 0; i < constraint.getSystemCount(); i++) {
		ConstraintSystem sys = constraint.getSystem(i);
		if (!sys.isContradictory())
			systems.add(sys);
	}

	// create ConstraintSystem[] nodeSystems
	if ( systems.isEmpty() ){
		this.nodeSystems = new ConstraintSystem[1];
		this.nodeSystems[0] = ConstraintSystem.FALSESYSTEM;
	} else {
		this.nodeSystems = new ConstraintSystem[systems.size()];
		for (int i = 0; i < systems.size(); i++)
			nodeSystems[i] = systems.get(i);
	}

	// update systemCount and some indexes
	if (pred == null){
		this.systemCount = nodeSystems.length;
	} else{
		int syscount = nodeSystems.length;
		this.systemCount = pred.systemCount * syscount;
		this.firstPotentiallySolvableSystemIndex = pred.firstPotentiallySolvableSystemIndex * syscount;
		this.firstNoncontradictorySystemIndex = pred.firstNoncontradictorySystemIndex * syscount;
	}
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:55,代码来源:ConstraintStackElement.java

示例12: doBack

import java.util.Vector; //导入方法依赖的package包/类
public static boolean doBack(HttpServletRequest request, HttpServletResponse response) throws IOException {
	synchronized (request.getSession()) {
		String uri = request.getParameter("uri");
		Vector back = getBackList(request.getSession());
		if (back.isEmpty()) {
			if (uri != null) {
				response.sendRedirect(response.encodeURL(uri));
				return true;
			}
			return false;
		}
		if (uri==null) {
			uri = ((String[])back.lastElement())[0];
			back.remove(back.size()-1);
		} else {
			String uriNoBack = uri;
			if (uriNoBack.indexOf("backType=")>=0)
				uriNoBack = uriNoBack.substring(0, uriNoBack.indexOf("backType=")-1);
			while (!back.isEmpty() && !uriNoBack.equals(((String[])back.lastElement())[0]))
				back.remove(back.size()-1);
			if (!back.isEmpty())
				back.remove(back.size()-1);
		}
		if (uri.indexOf("backType=")<0 && request.getAttribute("backType")!=null && request.getAttribute("backId")!=null) {
			if (uri.indexOf('?')>0)
				uri += "&backType="+request.getAttribute("backType")+"&backId="+request.getAttribute("backId")+"#back";
			else
				uri += "?backType="+request.getAttribute("backType")+"&backId="+request.getAttribute("backId")+"#back";
			
		}
		response.sendRedirect(response.encodeURL(uri));
		return true;
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:35,代码来源:BackTracker.java

示例13: execute

import java.util.Vector; //导入方法依赖的package包/类
@Override
public void execute(String commandName, ConsoleInput console, List<String> args) {
	startNow = false;
	Vector newargs = new Vector(args);
	if (!newargs.isEmpty() && newargs.contains("now") ) {
		newargs.removeElement("now");
		startNow = true;
	}
	super.execute(commandName, console, args);
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:11,代码来源:TorrentStart.java

示例14: checkForBCMPDelayWarning

import java.util.Vector; //导入方法依赖的package包/类
private void checkForBCMPDelayWarning() {
	Vector<Object> delays = station_def.getStationKeysDelay();
	Vector<Object> classes = class_def.getClassKeys();
	if (!delays.isEmpty()) {
		for (int i = 0; i < delays.size(); i++) {
			Object thisDelay = delays.get(i);
			for (int j = 0; j < classes.size(); j++) {
				Object thisClass = classes.get(j);
				Object service = station_def.getServiceTimeDistribution(thisDelay, thisClass);
				if (service instanceof Distribution) {
					Distribution d = (Distribution) service;
					if (d.getName().equals(CommonConstants.DISTRIBUTION_PARETO)) {
						warnings[BCMP_DELAY_WARNING] = true;
						BCMPdelaysWithNonRationalServiceDistribution.add(thisDelay);
						break;
					}
				} else if (service instanceof LDStrategy) {
					LDStrategy ld = (LDStrategy) service;
					Object[] ranges = ld.getAllRanges();
					for (Object range : ranges) {
						if (ld.getRangeDistribution(range).getName().equals(CommonConstants.DISTRIBUTION_PARETO)) {
							warnings[BCMP_DELAY_WARNING] = true;
							BCMPdelaysWithNonRationalServiceDistribution.add(thisDelay);
							break;
						}
					}
				}
			}
		}
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:32,代码来源:ModelChecker.java

示例15: getMissingMessageNos

import java.util.Vector; //导入方法依赖的package包/类
public static String getMissingMessageNos(Vector messages, String outstandingMsgId)
    throws ProtocolException {
  if (messages == null || messages.isEmpty()) {
    if (outstandingMsgId == null || outstandingMsgId.length() == 0) {
      return null;
    } else {
      return outstandingMsgId;
    }
  }
  MessageHeader hd = new MessageHeader((String) messages.elementAt(0));
  String msgId = hd.getMessageId();
  int numMsgs = hd.getNumberOfMessages();
  if (numMsgs == messages.size()) {
    return ""; // no messages missing
  }
  int[] msgNos = new int[numMsgs];
  // Fill the array with 0s
  for (int i = 0; i < msgNos.length; i++) {
    msgNos[i] = 0;
  }
  // For all msg. nos. that are present, fill in 1s
  for (int i = 0; i < messages.size(); i++) {
    hd = new MessageHeader((String) messages.elementAt(i));
    if (msgId.equals(hd.getMessageId())) {
      msgNos[hd.getMessageNo() - 1] =
          1; // note: the index of message nos. starts from 1; so it is necessary to minus 1 here
    }
  }
  // Now, the array indicies with 0s are the missing message nos.
  String missingMsgNos = "";
  for (int i = 0; i < numMsgs; i++) {
    if (msgNos[i] == 0) {
      if (missingMsgNos.length() > 0) {
        missingMsgNos += ",";
      }
      missingMsgNos +=
          String.valueOf(i
              + 1); // note: the index of messages starts from 1, whereas array index starts from 0; so add 1 to index here
    }
  }
  return msgId + ";" + missingMsgNos;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:43,代码来源:MessageUtil.java


注:本文中的java.util.Vector.isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。