當前位置: 首頁>>代碼示例>>Java>>正文


Java Transition類代碼示例

本文整理匯總了Java中gov.nasa.jpf.vm.Transition的典型用法代碼示例。如果您正苦於以下問題:Java Transition類的具體用法?Java Transition怎麽用?Java Transition使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Transition類屬於gov.nasa.jpf.vm包,在下文中一共展示了Transition類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: computeHeuristicValue

import gov.nasa.jpf.vm.Transition; //導入依賴的package包/類
@Override
protected int computeHeuristicValue () {
  Transition t = vm.getLastTransition();

  if (t == null) {
    return 1;
  }

  String tn = vm.getThreadName();

  for (int i = 0; i < preferredThreads.length; i++) {
    if (tn.equals(preferredThreads[i])) {
      return 0;
    }
  }

  return 1;
}
 
開發者ID:grzesuav,項目名稱:gjpf-core,代碼行數:19,代碼來源:PreferThreads.java

示例2: publishOutput

import gov.nasa.jpf.vm.Transition; //導入依賴的package包/類
@Override
protected void publishOutput() {
  Path path = reporter.getPath();

  if (path.size() == 0) {
    return; // nothing to publish
  }

  publishTopicStart("output " + reporter.getCurrentErrorId());

  if (path.hasOutput()) {
    for (Transition t : path) {
      String s = t.getOutput();
      if (s != null){
        out.print(s);
      }
    }
  } else {
    out.println("no output");
  }
}
 
開發者ID:grzesuav,項目名稱:gjpf-core,代碼行數:22,代碼來源:ConsolePublisher.java

示例3: publishOutput

import gov.nasa.jpf.vm.Transition; //導入依賴的package包/類
@Override
protected void publishOutput() {
  Path path = reporter.getPath();

  if (path.size() == 0) {
    return; // nothing to publish
  }
      
  if (path.hasOutput()) {
    out.println("  <output>");
    for (Transition t : path) {
      String s = t.getOutput();
      if (s != null){
        out.print(s);
      }
    }
    out.println("  </output>");
  }
}
 
開發者ID:grzesuav,項目名稱:gjpf-core,代碼行數:20,代碼來源:XMLPublisher.java

示例4: makeGdfLabel

import gov.nasa.jpf.vm.Transition; //導入依賴的package包/類
/**
 * Return the string that will be used to label this state in the GDF graph.
 */
private String makeGdfLabel(Search state, int my_id) {
  Transition trans = state.getTransition();
  if (trans == null) {
	  return "-init-";
	}

	StringBuilder result = new StringBuilder();

	if (transition_numbers) {
	  result.append(my_id);
	  result.append(':');
	}

	Step last_trans_step = trans.getLastStep();
	result.append(last_trans_step.toString());

	if (show_source) {
	  String source_line=last_trans_step.getLineString();
	  if ((source_line != null) && !source_line.equals("")) {

	    // We need to deal with gdf-specific special characters which couls appear
	    // in the Java source line, such as '"'.
	    result.append(source_line);
	  	convertGdfSpecial(result);
	  }
  }
	return result.toString();
}
 
開發者ID:grzesuav,項目名稱:gjpf-core,代碼行數:32,代碼來源:StateSpaceDot.java

示例5: addEdge

import gov.nasa.jpf.vm.Transition; //導入依賴的package包/類
/**
 * Create an edge in the graph file from old_id to new_id.
 */
private void addEdge(int old_id, int new_id, Search state) throws IOException {
  int my_id = edge_id++;
  if (format==GDF_FORMAT) {
    Transition trans=state.getTransition();
    int thread = trans.getThreadIndex();

    // edgedef>node1,node2,label,labelvisible,directed,thread INT

    // Old State -> Transition - labeled with the source info if any.
    gdfEdges.add(
    		makeGdfEdgeString("st"+old_id, "tr"+my_id,
    				          makeGdfLabel(state, my_id),
    				          thread));

    // Transition node: name,label,style,color
    graph.write("tr" + my_id + ",\"" +my_id+"\","+transition_node_style);

    graph.newLine();
    // Transition -> New State - labeled with the last output if any.

    String lastOutputLabel=
    	replaceString(convertGdfSpecial(trans.getOutput()), "\"", "\'\'");
    gdfEdges.add(
    	makeGdfEdgeString("tr"+my_id, "st"+new_id, lastOutputLabel, thread));
  } else { // DOT
    graph.write("  st" + old_id + " -> tr" + my_id + ";");
    graph.newLine();
    graph.write("  tr" + my_id + " [label=\"" + makeDotLabel(state, my_id) +
                "\",shape=box]");
    graph.newLine();
    graph.write("  tr" + my_id + " -> st" + new_id + ";");
  }
}
 
開發者ID:grzesuav,項目名稱:gjpf-core,代碼行數:37,代碼來源:StateSpaceDot.java

示例6: publishTrace

import gov.nasa.jpf.vm.Transition; //導入依賴的package包/類
@Override
protected void publishTrace() {
  Path path = reporter.getPath();
  int i=0;

  if (path.size() == 0) {
    return; // nothing to publish
  }
  
  out.println("  <trace>");
  for (Transition t : path) {
    ChoiceGenerator<?> cg = t.getChoiceGenerator();
    out.println("    <transition id=\"" + i++ + "\" thread=\"" + t.getThreadIndex() + "\">");
    out.println("      <cg class=\""+cg.getClass().getName() + "\" choice=\"" +
                cg.getProcessedNumberOfChoices() + "\"/>");
    for (Step s : t) {
      out.print("      <insn src=\"" + s.getLocationString() + "\">");
      String insn = s.getInstruction().toString();
      if (insn.indexOf('<') >= 0) { // <init> and <clinit> clash with XML
        insn = insn.replaceAll("<", "&lt;");
        insn = insn.replaceAll(">", "&gt;");
      }
      out.print(insn);
      out.println("</insn>");
    }
    out.println("    </transition>");      
  }
  out.println("  </trace>");
}
 
開發者ID:grzesuav,項目名稱:gjpf-core,代碼行數:30,代碼來源:XMLPublisher.java

示例7: log

import gov.nasa.jpf.vm.Transition; //導入依賴的package包/類
private boolean log(Search search)
{
   VM vm;
   Path path;
   Transition trans;
   ChoiceGenerator cg;
   double percent, delta;
   long currentState, expectedState, currentTime, expectedTime;
   int i, size, processed;

   vm       = search.getVM();
   path      = vm.getPath();
   size      = path.size();
   percent   = 0.0;
   delta     = 1.0;
   processed = 0;
   
   for (i = 0; i < size; i++)
   {
      trans      = path.get(i);
      cg         = trans.getChoiceGenerator();
      delta     /= cg.getTotalNumberOfChoices();
      processed  = cg.getProcessedNumberOfChoices() - 1;
      percent   += delta * processed;
   }
   
   if (size == 0)
      percent = 1.0;
   
   if (m_lastPercent > percent)  // Sometimes a state is declared as processed but doesn't show up in the path so the percentage appears to go backwards.
      return(false);
   
   m_lastPercent = percent;
      
   currentState  = vm.getStateCount();
   expectedState = (long) (currentState / percent);
   
   currentTime   = System.currentTimeMillis() - m_startTime;
   expectedTime  = (long) (currentTime / percent);
   
   m_formatter.format("State:  %,d / %,d (%g%%)    Time:  ", currentState, expectedState, 100.0 * percent);
   
   formatTime(expectedTime);
   m_buffer.append(" - ");
   formatTime(currentTime);
   m_buffer.append(" = ");
   formatTime(expectedTime - currentTime);

   m_out.println(m_buffer.toString());
   m_buffer.setLength(0);
   
   return(true);
}
 
開發者ID:grzesuav,項目名稱:gjpf-core,代碼行數:54,代碼來源:StateCountEstimator.java

示例8: makeDotLabel

import gov.nasa.jpf.vm.Transition; //導入依賴的package包/類
/**
 * Return the string that will be used to label this state for the user.
 */
private String makeDotLabel(Search state, int my_id) {
  Transition trans = state.getTransition();
  if (trans == null) {
    return "-init-";
  }
  Step last_trans_step = trans.getLastStep();
  if (last_trans_step == null) {
    return "?";
  }

  StringBuilder result = new StringBuilder();

  if (transition_numbers) {
    result.append(my_id);
    result.append("\\n");
  }

  int thread = trans.getThreadIndex();

  result.append("Thd");
  result.append(thread);
  result.append(':');
  result.append(last_trans_step.toString());

  if (show_source) {
    String source_line=last_trans_step.getLineString();
    if ((source_line != null) && !source_line.equals("")) {
      result.append("\\n");

      StringBuilder sb=new StringBuilder(source_line);

      // We need to precede the dot-specific special characters which appear
      // in the Java source line, such as ']' and '"', with the '\' escape
      // characters and also to remove any new lines.

      replaceString(sb, "\n", "");
      replaceString(sb, "]", "\\]");
      replaceString(sb, "\"", "\\\"");
      result.append(sb.toString());
    }
  }

  return result.toString();
}
 
開發者ID:grzesuav,項目名稱:gjpf-core,代碼行數:48,代碼來源:StateSpaceDot.java

示例9: getTransition

import gov.nasa.jpf.vm.Transition; //導入依賴的package包/類
public Transition getTransition () {
  return vm.getLastTransition();
}
 
開發者ID:grzesuav,項目名稱:gjpf-core,代碼行數:4,代碼來源:Search.java

示例10: publishTrace

import gov.nasa.jpf.vm.Transition; //導入依賴的package包/類
/**
 * this is done as part of the property violation reporting, i.e.
 * we have an error
 */
@Override
protected void publishTrace() {
  Path path = reporter.getPath();
  int i=0;

  if (path.size() == 0) {
    return; // nothing to publish
  }

  publishTopicStart("trace " + reporter.getCurrentErrorId());

  for (Transition t : path) {
    out.print("------------------------------------------------------ ");
    out.println("transition #" + i++ + " thread: " + t.getThreadIndex());

    if (showCG){
      out.println(t.getChoiceGenerator());
    }

    if (showSteps) {
      String lastLine = null;
      MethodInfo lastMi = null;
      int nNoSrc=0;

      for (Step s : t) {
        if (showSource) {
          String line = s.getLineString();
          if (line != null) {
            if (!line.equals(lastLine)) {
              if (nNoSrc > 0){
                out.println("      [" + nNoSrc + " insn w/o sources]");
              }

              out.print("  ");
              if (showLocation) {
                out.print(Left.format(s.getLocationString(),30));
                out.print(" : ");
              }
              out.println(line.trim());
              nNoSrc = 0;

            }
          } else { // no source
            nNoSrc++;
          }
          
          lastLine = line;
        }

        if (showCode) {
          Instruction insn = s.getInstruction();
          if (showMethod){
            MethodInfo mi = insn.getMethodInfo();
            if (mi != lastMi) {
              ClassInfo mci = mi.getClassInfo();
              out.print("    ");
              if (mci != null) {
                out.print(mci.getName());
                out.print(".");
              }
              out.println(mi.getUniqueName());
              lastMi = mi;
            }
          }
          out.print("      ");
          out.println(insn);
        }
      }

      if (showSource && !showCode && (nNoSrc > 0)) {
        out.println("      [" + nNoSrc + " insn w/o sources]");
      }
    }
  }
}
 
開發者ID:grzesuav,項目名稱:gjpf-core,代碼行數:80,代碼來源:ConsolePublisher.java


注:本文中的gov.nasa.jpf.vm.Transition類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。