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


Java Config.getInstance方法代码示例

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


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

示例1: HeuristicListener

import gov.nasa.jpf.Config; //导入方法依赖的package包/类
public HeuristicListener(Config jpfConf, JPF jpf) {
  super(jpfConf, jpf);
  policiesEnabled = jpfConf.getBoolean(WorstCaseAnalyzer.ENABLE_POLICIES, WorstCaseAnalyzer.ENABLE_POLICIES_DEF);

  if (policiesEnabled) {
    PolicyManager policyManager = new PolicyManager(new File(getSerializedInputDir(jpfConf)));

    try {
      this.heuristicPolicy = policyManager.loadPolicy(measuredMethods, Policy.class);
    } catch (IOException | PolicyManagerException e) {
      logger.severe(e.getMessage());
      throw new RuntimeException(e);
    }
  }

  // Set termination strategy
  this.terminationStrategy = jpfConf.getInstance(TERMINATION_STRATEGY_CONF,
      TerminationStrategy.class, DEFAULT_TERMINATION_STRATEGY);
}
 
开发者ID:isstac,项目名称:spf-wca,代码行数:20,代码来源:HeuristicListener.java

示例2: addToFieldWatchList

import gov.nasa.jpf.Config; //导入方法依赖的package包/类
protected void addToFieldWatchList (Config conf, String id){
  String keyPrefix = "perturb." + id;

  String fs = conf.getString(keyPrefix + ".field");
  if (fs != null) {
    FieldSpec fieldSpec = FieldSpec.createFieldSpec(fs);
    if (fieldSpec != null){
      Object[] args = {conf, keyPrefix};
      OperandPerturbator perturbator = conf.getInstance(keyPrefix + ".class", OperandPerturbator.class, argTypes, args);
      if (perturbator != null) {
        String loc = conf.getString(keyPrefix + ".location");
        FieldPerturbation p = new FieldPerturbation(fieldSpec, perturbator, loc);
        fieldWatchList.add(p);
      } else {
        log.warning("invalid perturbator spec for ", keyPrefix);
      }
    } else {
      log.warning("malformed field specification for ", keyPrefix);
    }

  } else {
    log.warning("missing field specification for ", keyPrefix);
  }
}
 
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:25,代码来源:Perturbator.java

示例3: addToReturnWatchList

import gov.nasa.jpf.Config; //导入方法依赖的package包/类
protected void addToReturnWatchList (Config conf, String id){
  String keyPrefix = "perturb." + id;

  String ms = conf.getString(keyPrefix + ".method");
  if (ms != null) {
    MethodSpec mthSpec = MethodSpec.createMethodSpec(ms);
    if (mthSpec != null) {
      Object[] args = {conf, keyPrefix};
      OperandPerturbator perturbator = conf.getInstance(keyPrefix + ".class", OperandPerturbator.class, argTypes, args);
      if (perturbator != null) {
        String loc = conf.getString(keyPrefix + ".location");
        ReturnPerturbation p = new ReturnPerturbation(mthSpec, perturbator, loc);
        returnWatchList.add(p);
      } else {
        log.warning("invalid perturbator spec for ", keyPrefix);
      }

    } else {
      log.warning("malformed method specification for ", keyPrefix);
    }

  } else {
    log.warning("missing method specification for ", keyPrefix);
  }
}
 
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:26,代码来源:Perturbator.java

示例4: addToParamsWatchList

import gov.nasa.jpf.Config; //导入方法依赖的package包/类
protected void addToParamsWatchList (Config conf, String id){
  String keyPrefix = "perturb." + id;

  String ms = conf.getString(keyPrefix + ".method");
  if (ms != null) {
    MethodSpec mthSpec = MethodSpec.createMethodSpec(ms);
    if (mthSpec != null) {
      Object[] args = {conf, keyPrefix};
      OperandPerturbator perturbator = conf.getInstance(keyPrefix + ".class", OperandPerturbator.class, argTypes, args);        
      if (perturbator != null) {
        String loc = conf.getString(keyPrefix + ".location");
        ParamsPerturbation p = new ParamsPerturbation(mthSpec, perturbator, loc);
        paramsWatchList.add(p);
      } else {
        log.warning("invalid perturbator spec for ", keyPrefix);
      }

    } else {
      log.warning("malformed method specification for ", keyPrefix);
    }
  } else {
    log.warning("missing method specification for ", keyPrefix);
  }
}
 
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:25,代码来源:Perturbator.java

示例5: addConfiguredPublishers

import gov.nasa.jpf.Config; //导入方法依赖的package包/类
void addConfiguredPublishers (Config conf) {
  String[] def = { "console" };

  Class<?>[] argTypes = { Config.class, Reporter.class };
  Object[] args = { conf, this };

  for (String id : conf.getStringArray("report.publisher", def)){
    Publisher p = conf.getInstance("report." + id + ".class",
                                   Publisher.class, argTypes, args);
    if (p != null){
      publishers.add(p);
    } else {
      log.warning("could not instantiate publisher class: " + id);
    }
  }
}
 
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:17,代码来源:Reporter.java

示例6: init

import gov.nasa.jpf.Config; //导入方法依赖的package包/类
/**
 * note - this is not allowed to fail, since we couldn't log that. Hardcoded default
 * values have to do in this case (make sure we catch the proper Config exceptions)
 */
public static void init (Config conf) {
  try {
    defaultLevel = Level.parse( conf.getString("log.level", "INFO").toUpperCase());
  } catch (Throwable x) {
    defaultLevel = Level.WARNING;
  }
  
  activeSevere = conf.getStringArray("log.severe");
  activeWarning = conf.getStringArray("log.warning");
  activeInfo = conf.getStringArray("log.info");
  activeConfig = conf.getStringArray("log.config");
  activeFine = conf.getStringArray("log.fine");
  activeFiner = conf.getStringArray("log.finer");
  activeFinest = conf.getStringArray("log.finest");
  
  handler = conf.getInstance("log.handler.class", Handler.class);
}
 
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:22,代码来源:LogManager.java

示例7: DebugCopyPreservingStateSet

import gov.nasa.jpf.Config; //导入方法依赖的package包/类
public DebugCopyPreservingStateSet(Config conf){
  String serializerCls = conf.getString("vm.serializer.class");

  if (serializerCls == null) {
      serializerCls = "gov.nasa.jpf.abstraction.util.DebugPredicateAbstractionSerializer";
  }

  try {
      serializer = conf.getInstance(null, serializerCls, DebugStateSerializer.class);
  } catch (Throwable t) {
      throw new JPFConfigException("Debug StateSet cannot instantiate debug serializer: " + serializerCls, t);
  }

  String path = conf.getString("vm.serializer.output", "tmp");
  outputDir = new File(path);
  if (!outputDir.isDirectory()){
    if (!outputDir.mkdirs()){
      throw new JPFConfigException("Debug StateSet cannot create output dir: " + outputDir.getAbsolutePath());
    }
  }

  outputFile = new File( outputDir, LOGFILE);
}
 
开发者ID:d3sformal,项目名称:panda,代码行数:24,代码来源:DebugCopyPreservingStateSet.java

示例8: getFieldAbstractions

import gov.nasa.jpf.Config; //导入方法依赖的package包/类
protected List<FieldAbstraction> getFieldAbstractions(Config conf){
  List<FieldAbstraction> list = null;
  
  String[] fids = conf.getCompactTrimmedStringArray("das.fields");
  for (String id : fids) {
    String keyPrefix = "das." + id;
    String fs = conf.getString(keyPrefix + ".field");
    if (fs != null) {
      FieldSpec fspec = FieldSpec.createFieldSpec(fs);
      if (fspec != null) {
        String aKey = keyPrefix + ".abstraction";
        Abstraction abstraction = conf.getInstance(aKey, Abstraction.class);

        logger.info("found field abstraction for ", fspec, " = ", abstraction.getClass().getName());
        
        if (list == null){
          list = new LinkedList<FieldAbstraction>();
        }
        
        list.add(new FieldAbstraction(fspec, abstraction));
      }
    } else {
      logger.warning("no field spec for id: " + id);
    }
  }
  
  return list;
}
 
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:29,代码来源:DynamicAbstractionSerializer.java

示例9: DebugJenkinsStateSet

import gov.nasa.jpf.Config; //导入方法依赖的package包/类
public DebugJenkinsStateSet (Config conf){
  String serializerCls = conf.getString("vm.serializer.class");
  if (serializerCls != null){
    int idx = serializerCls.lastIndexOf('.') + 1;
    String cname = serializerCls.substring(idx);
    
    if (!cname.startsWith("Debug")){
      if (idx > 0){
        serializerCls = serializerCls.substring(0,idx) + "Debug" + cname;
      } else {
        serializerCls = "Debug" + cname;
      }
    }
    
    serializer = conf.getInstance(null, serializerCls, DebugStateSerializer.class);
    if (serializer == null){
      throw new JPFConfigException("Debug StateSet cannot instantiate serializer: " + serializerCls);
    }
  }
  
  String path = conf.getString("vm.serializer.output", "tmp");
  outputDir = new File(path);
  if (!outputDir.isDirectory()){
    if (!outputDir.mkdirs()){
      throw new JPFConfigException("Debug StateSet cannot create output dir: " + outputDir.getAbsolutePath());        
    }
  }
  
  outputFile = new File( outputDir, LOGFILE);
}
 
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:31,代码来源:DebugJenkinsStateSet.java

示例10: initFields

import gov.nasa.jpf.Config; //导入方法依赖的package包/类
public void initFields (Config config) {
  path = new Path("fix-this!");
  out = null;

  ss = new SystemState(config, this);

  stateSet = config.getInstance("vm.storage.class", StateSet.class);
  if (stateSet != null) stateSet.attach(this);
  backtracker = config.getEssentialInstance("vm.backtracker.class", Backtracker.class);
  backtracker.attach(this);

  scheduler = config.getEssentialInstance("vm.scheduler.class", Scheduler.class);
  
  newStateId = -1;
}
 
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:16,代码来源:VM.java

示例11: JPF_gov_nasa_jpf_EventProducer

import gov.nasa.jpf.Config; //导入方法依赖的package包/类
public JPF_gov_nasa_jpf_EventProducer (Config config){
  eventTree = config.getEssentialInstance(EventTree.CONFIG_KEY, EventTree.class);
  ctx = config.getInstance("event.context.class", EventContext.class);
  
  logger.info("event tree generated by: ", eventTree.getClass().getName());
  if (ctx != null){
    logger.info("using context event: ", ctx.getClass().getName());
  }
}
 
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:10,代码来源:JPF_gov_nasa_jpf_EventProducer.java

示例12: PathListener

import gov.nasa.jpf.Config; //导入方法依赖的package包/类
public PathListener(Config jpfConf, JPF jpf) {
  this.jpfConf = jpfConf;
  
  //TODO: we can make this even more precise by also allowing specifying the EXACT 
  //call (e.g. src line number + class) after which count collection should start 
  if(!jpfConf.hasValue(MEASURED_METHODS) && !jpfConf.hasValue(SYMBOLIC_METHODS)) {
    RuntimeException e = new RuntimeException("Must set either " + MEASURED_METHODS + " or " + SYMBOLIC_METHODS);
    logger.severe(e.getMessage());
    throw e;
  }
  this.measuredMethods = getMeasuredMethods(this.jpfConf);
  this.symbolicMethods = getSymbolicMethods(this.jpfConf);
  logger.info("Measured methods: " + this.measuredMethods.toString());
  
  this.policyManager = new PolicyManager(this.getPolicyBaseDir(jpfConf));
  if(this.visualize(this.jpfConf))
    this.visDir = this.getVisualizationDir(this.jpfConf);
  
  this.showInstrs = jpfConf.getBoolean(SHOW_INSTRS_CONF, false);
  
  this.ctxManager = new ContextManager();
  
  //Initialize state
  if(jpfConf.hasValue(WORST_CASE_STATE_BLDR_CONF)) {
    this.stateBuilder = jpfConf.getInstance(WORST_CASE_STATE_BLDR_CONF, StateBuilder.class);
  } else
    this.stateBuilder = new DepthState.DepthStateBuilder();
  
  if(jpfConf.hasValue(POLICY_GENERATOR_CLS_CONF)) {
    this.policyGenerator = jpfConf.getInstance(POLICY_GENERATOR_CLS_CONF, PolicyGenerator.class);
    this.worstCasePathBuilder = new WorstCasePath.Builder(ctxManager);
  } else {
    HistoryBasedPolicy.Builder histGenerator = new HistoryBasedPolicy.Builder();
    if(jpfConf.hasValue(HISTORY_SIZE_CONF)) {
      this.historySize = jpfConf.getInt(HISTORY_SIZE_CONF);
      histGenerator.setMaxHistorySize(historySize);
      this.worstCasePathBuilder = new WorstCasePath.Builder(ctxManager, historySize);
    } else { // adaptive by default
      histGenerator.setAdaptive(true);
      this.worstCasePathBuilder = new WorstCasePath.Builder(ctxManager);
    }
    this.policyGenerator = histGenerator;
  }

  this.wcPath = null;
}
 
开发者ID:isstac,项目名称:spf-wca,代码行数:47,代码来源:PathListener.java

示例13: main

import gov.nasa.jpf.Config; //导入方法依赖的package包/类
public static void main (String[] args) {
  try {
    int options = getOptions(args);

    if (args.length == 0 || isOptionEnabled(HELP, options)) {
      showUsage();
      return;
    }

    if (isOptionEnabled(ADD_PROJECT, options)){
      addProject(args);
      return;
    }
    
    if (isOptionEnabled(DELAY_START, options)) {
      delay("press any key to start");
    }
    
    if (isOptionEnabled(LOG, options)) {
      Config.enableLogging(true);
    }

    Config conf = new Config(args);

    if (isOptionEnabled(SHOW, options)) {
      conf.printEntries();
    }

    ClassLoader cl = conf.initClassLoader(RunJPF.class.getClassLoader());

    if (isOptionEnabled(VERSION, options)) {
      showVersion(cl);
    }

    if (isOptionEnabled(BUILD_INFO, options)) {
      showBuild(cl);
    }

    // using JPFShell is Ok since it is just a simple non-derived interface
    // note this uses a <init>(Config) ctor in the shell class if there is one, i.e. there is no need for a separate
    // start(Config,..) or re-loading the config itself
    JPFShell shell = conf.getInstance("shell", JPFShell.class);
    if (shell != null) {
      shell.start( removeConfigArgs(args)); // responsible for exception handling itself

    } else {
      // we have to load JPF explicitly through the URLClassLoader, and
      // call its start() via reflection - interfaces would only work if
      // we instantiate a JPF object here, which would force us to duplicate all
      // the logging and event handling that preceedes JPF instantiation
      Class<?> jpfCls = cl.loadClass(JPF_CLASSNAME);
      if (!call( jpfCls, "start", new Object[] {conf,args})){
        error("cannot find 'public static start(Config,String[])' in " + JPF_CLASSNAME);
      }
    }
    
    if (isOptionEnabled(DELAY_EXIT, options)) {
      delay("press any key to exit");
    }

    
  } catch (NoClassDefFoundError ncfx){
    ncfx.printStackTrace();
  } catch (ClassNotFoundException cnfx){
    error("cannot find " + JPF_CLASSNAME);
  } catch (InvocationTargetException ix){
    // should already be handled by JPF
    ix.getCause().printStackTrace();
  }
  
}
 
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:72,代码来源:RunJPF.java


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