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


Java XMLControl.getInt方法代码示例

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


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

示例1: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  Histogram his = (Histogram) obj;
  double[] bins = (double[]) control.getObject("bins"); //$NON-NLS-1$
  double[] vals = (double[]) control.getObject("vals"); //$NON-NLS-1$
  his.name = control.getString("name");                           //$NON-NLS-1$
  his.xColumnName = control.getString("x_column_name");           //$NON-NLS-1$
  his.yColumnName = control.getString("y_column_name");           //$NON-NLS-1$
  his.binColumnName = control.getString("bin_column_name");       //$NON-NLS-1$
  his.logScale = control.getBoolean("log_scale");                 //$NON-NLS-1$
  his.discrete = control.getBoolean("discrete");                  //$NON-NLS-1$
  his.adjustForWidth = control.getBoolean("adjust_for_width");    //$NON-NLS-1$
  his.binFillColor = (Color) control.getObject("bin_fill_color"); //$NON-NLS-1$
  his.binEdgeColor = (Color) control.getObject("bin_edge_color"); //$NON-NLS-1$
  his.binStyle = control.getInt("bin_style");                     //$NON-NLS-1$
  his.binWidth = control.getDouble("bin_width");                  //$NON-NLS-1$
  his.binOffset = control.getDouble("bin_offset");                //$NON-NLS-1$
  his.adjustForWidth = control.getBoolean("adjust_for_width");    //$NON-NLS-1$
  if((bins!=null)&&(vals!=null)) {
    for(int i = 0, n = bins.length; i<n; i++) {
      his.append(bins[i], vals[i]);
    }
  }
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:25,代码来源:Histogram.java

示例2: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Loads data from the xml control into the ColorMapper object.
 * @param control XMLControl
 * @param obj Object
 * @return Object
 */
public Object loadObject(XMLControl control, Object obj) {
  ColorMapper mapper = (ColorMapper) obj;
  int paletteType = control.getInt("palette type");   //$NON-NLS-1$
  int numColors = control.getInt("number of colors"); //$NON-NLS-1$
  double floor = control.getDouble("floor");          //$NON-NLS-1$
  double ceil = control.getDouble("ceiling");         //$NON-NLS-1$
  if(paletteType==CUSTOM) {
    Color[] colors = (Color[]) control.getObject("colors"); //$NON-NLS-1$
    mapper.setColorPalette(colors);
  } else {
    mapper.setPaletteType(paletteType);
    mapper.setNumberOfColors(numColors);
  }
  mapper.setScale(floor, ceil);
  Color floorColor = (Color) control.getObject("floor color");  //$NON-NLS-1$
  Color ceilColor = (Color) control.getObject("ceiling color"); //$NON-NLS-1$
  mapper.setFloorCeilColor(floorColor, ceilColor);
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:26,代码来源:ColorMapper.java

示例3: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Loads a filter with data from an XMLControl.
 *
 * @param control the control
 * @param obj the filter
 * @return the loaded object
 */
public Object loadObject(XMLControl control, Object obj) {
  final BrightnessFilter filter = (BrightnessFilter) obj;
  if(control.getPropertyNames().contains("brightness")) { //$NON-NLS-1$
    filter.setBrightness(control.getInt("brightness"));   //$NON-NLS-1$
  }
  if(control.getPropertyNames().contains("contrast")) { //$NON-NLS-1$
    filter.setContrast(control.getDouble("contrast"));  //$NON-NLS-1$
  }
  filter.inspectorX = control.getInt("inspector_x"); //$NON-NLS-1$
  filter.inspectorY = control.getInt("inspector_y"); //$NON-NLS-1$
  filter.previousState = null;
  filter.changed = false;
  if (filter.inspector!=null) {
    filter.inspector.updateDisplay();
  }
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:25,代码来源:BrightnessFilter.java

示例4: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Loads a VideoClip with data from an XMLControl.
 *
 * @param control the element
 * @param obj the object
 * @return the loaded object
 */
public Object loadObject(XMLControl control, Object obj) {
  ClipControl clipControl = (ClipControl) obj;
  // set rate
  double rate = control.getDouble("rate"); //$NON-NLS-1$
  if(rate!=Double.NaN) {
    clipControl.setRate(rate);
  }
  // set dt
  double dt = control.getDouble("delta_t"); //$NON-NLS-1$
  if(dt!=Double.NaN) {
    clipControl.setFrameDuration(dt);
  }
  // set looping and playing
  clipControl.setLooping(control.getBoolean("looping")); //$NON-NLS-1$
  // set frame number
  if (control.getPropertyNames().contains("frame")) { //$NON-NLS-1$
  	int n = control.getInt("frame"); //$NON-NLS-1$
  	n = clipControl.getVideoClip().frameToStep(n);
  	clipControl.setStepNumber(n);
  }
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:30,代码来源:ClipControl.java

示例5: send

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
@Override
public void send(Job job, Tool replyTo) throws RemoteException {
   XMLControl control = new XMLControlElement();
   control.readXML(job.getXML());
   if (control.failedToRead()) return;
   int sourceID = control.getInt("sourceID"); //$NON-NLS-1$
   if (control.getBoolean("handshake")) { //$NON-NLS-1$
   	connected = true;
   	support.firePropertyChange("tracker_ready", sourceID, null); //$NON-NLS-1$
   }
   else if (control.getBoolean("exiting")) { //$NON-NLS-1$
   	remoteTool = null;
   	connected = false;
   	support.firePropertyChange("tracker_exited", null, null); //$NON-NLS-1$
   }

}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:18,代码来源:DataTrackSupport.java

示例6: main

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Main entry point when used as application.
 *
 * @param args args[0] may be an xml file name
 */
public static void main(String[] args) {
  //    java.util.Locale.setDefault(new java.util.Locale("es"));
  //    OSPLog.setLevel(ConsoleLevel.ALL);
  // get current memory size
  java.lang.management.MemoryMXBean memory
		= java.lang.management.ManagementFactory.getMemoryMXBean();
  long memorySize = memory.getHeapMemoryUsage().getMax()/(1024*1024);
  // open default xset, if any, and look for desired memory size
  if (OSPRuntime.getLaunchJarName()!=null) {
  	String xset = XML.stripExtension(OSPRuntime.getLaunchJarName())+".xset"; //$NON-NLS-1$
    String jarBase = OSPRuntime.getLaunchJarDirectory();
    String path = XML.getResolvedPath(xset, jarBase);
    XMLControl control = new XMLControlElement(path);
    if (!control.failedToRead() && control.getPropertyNames().contains("memory_size")) { //$NON-NLS-1$
    	memorySize = control.getInt("memory_size"); //$NON-NLS-1$
    }
  }
  start(args, memorySize);
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:25,代码来源:Launcher.java

示例7: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Loads a filter with data from an XMLControl.
 *
 * @param control the control
 * @param obj the filter
 * @return the loaded object
 */
public Object loadObject(XMLControl control, Object obj) {
  StrobeFilter filter = (StrobeFilter) obj;
  if(control.getPropertyNames().contains("fade")) { //$NON-NLS-1$
    filter.setFade(control.getDouble("fade"));      //$NON-NLS-1$
  }
  filter.setBrightTrails(control.getBoolean("bright_trails"));      //$NON-NLS-1$
  filter.inspectorX = control.getInt("inspector_x"); //$NON-NLS-1$
  filter.inspectorY = control.getInt("inspector_y"); //$NON-NLS-1$
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:18,代码来源:StrobeFilter.java

示例8: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Loads a filter with data from an XMLControl.
 *
 * @param control the control
 * @param obj the filter
 * @return the loaded object
 */
public Object loadObject(XMLControl control, Object obj) {
  final GrayScaleFilter filter = (GrayScaleFilter) obj;
  if(control.getPropertyNames().contains("weights")) {          //$NON-NLS-1$
    filter.setWeights((double[]) control.getObject("weights")); //$NON-NLS-1$
  }
  filter.inspectorX = control.getInt("inspector_x"); //$NON-NLS-1$
  filter.inspectorY = control.getInt("inspector_y"); //$NON-NLS-1$
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:17,代码来源:GrayScaleFilter.java

示例9: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  ComplexDataset data = (ComplexDataset) obj;
  double[][] points = (double[][]) control.getObject("points"); //$NON-NLS-1$
  if((points!=null)&&(points[0]!=null)) {
    data.clear();
    for(int i = 0; i<points.length; i++) {
      data.append(points[i][0], points[i][1], points[i][2]);
    }
  }
  // for backward compatibility
  double[] xPoints = (double[]) control.getObject("x_points"); //$NON-NLS-1$
  double[] yPoints = (double[]) control.getObject("y_points"); //$NON-NLS-1$
  if((xPoints!=null)&&(yPoints!=null)) {
    data.clear();
    data.append(xPoints, yPoints);
  }
  if(control.getPropertyNames().contains("marker_shape")) { //$NON-NLS-1$
    data.setMarkerShape(control.getInt("marker_shape"));    //$NON-NLS-1$
  }
  if(control.getPropertyNames().contains("marker_size")) { //$NON-NLS-1$
    data.setMarkerSize(control.getInt("marker_size"));     //$NON-NLS-1$
  }
  data.setSorted(control.getBoolean("sorted"));       //$NON-NLS-1$
  data.setConnected(control.getBoolean("connected")); //$NON-NLS-1$
  data.name = control.getString("name");            //$NON-NLS-1$
  data.xColumnName = control.getString("x_name");   //$NON-NLS-1$
  data.reColumnName = control.getString("re_name"); //$NON-NLS-1$
  data.imColumnName = control.getString("im_name"); //$NON-NLS-1$
  Color color = (Color) control.getObject("line_color"); //$NON-NLS-1$
  if(color!=null) {
    data.lineColor = color;
  }
  data.index = control.getInt("index"); //$NON-NLS-1$
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:36,代码来源:ComplexDataset.java

示例10: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Loads data from the xml control into the Circle object.
 * @param control XMLControl
 * @param obj Object
 * @return Object
 */
public Object loadObject(XMLControl control, Object obj) {
  Circle circle = (Circle) obj;
  circle.x = control.getDouble("x"); //$NON-NLS-1$
  circle.y = control.getDouble("y"); //$NON-NLS-1$
  int r = 6; // the default
  if(control.getObject("drawing r")!=null) { //$NON-NLS-1$
    r = control.getInt("drawing r");         //$NON-NLS-1$
  } else if(control.getObject("r")!=null) {  // included to be backward compatible with old loader //$NON-NLS-1$
    r = control.getInt("r");                 //$NON-NLS-1$
  }
  circle.pixRadius = (r<=0) ? 6 : r;
  circle.color = (Color) control.getObject("color"); //$NON-NLS-1$
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:21,代码来源:CircleLoader.java

示例11: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  Trail trail = (Trail) obj;
  trail.connected = control.getBoolean("connected");                   //$NON-NLS-1$
  trail.color = (Color) control.getObject("color");                    //$NON-NLS-1$
  trail.numpts = control.getInt("number of pts");                      //$NON-NLS-1$
  trail.generalPath = (GeneralPath) control.getObject("general path"); //$NON-NLS-1$
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:9,代码来源:Trail.java

示例12: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  TrailBezier trail = (TrailBezier) obj;
  trail.closed = control.getBoolean("closed");      //$NON-NLS-1$
  trail.color = (Color) control.getObject("color"); //$NON-NLS-1$
  trail.numpts = control.getInt("number of pts");   //$NON-NLS-1$
  //trail.generalPath = (GeneralPath) control.getObject("general path");
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:9,代码来源:TrailBezier.java

示例13: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
public Object loadObject(XMLControl control, Object obj) {
  Resolution res = (Resolution) obj;
  res.type = control.getInt("type");               //$NON-NLS-1$
  res.maxLength = control.getDouble("max length"); //$NON-NLS-1$
  res.n1 = control.getInt("n1");                   //$NON-NLS-1$
  res.n2 = control.getInt("n2");                   //$NON-NLS-1$
  res.n3 = control.getInt("n3");                   //$NON-NLS-1$
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:10,代码来源:Resolution.java

示例14: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Loads a filter with data from an XMLControl.
 *
 * @param control the control
 * @param obj the filter
 * @return the loaded object
 */
public Object loadObject(XMLControl control, Object obj) {
  final DeinterlaceFilter filter = (DeinterlaceFilter) obj;
  if(control.getPropertyNames().contains("field")) { //$NON-NLS-1$
    if(control.getString("field").equals("odd")) { //$NON-NLS-1$ //$NON-NLS-2$
      filter.setOdd(true);                           
    } else {
      filter.setOdd(false);
    }
  }
  filter.inspectorX = control.getInt("inspector_x"); //$NON-NLS-1$
  filter.inspectorY = control.getInt("inspector_y"); //$NON-NLS-1$
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:21,代码来源:DeinterlaceFilter.java

示例15: loadObject

import org.opensourcephysics.controls.XMLControl; //导入方法依赖的package包/类
/**
 * Loads a filter with data from an XMLControl.
 *
 * @param control the control
 * @param obj the filter
 * @return the loaded object
 */
public Object loadObject(XMLControl control, Object obj) {
  final DarkGhostFilter filter = (DarkGhostFilter) obj;
  if(control.getPropertyNames().contains("fade")) { //$NON-NLS-1$
    filter.setFade(control.getDouble("fade"));      //$NON-NLS-1$
  }
  filter.inspectorX = control.getInt("inspector_x"); //$NON-NLS-1$
  filter.inspectorY = control.getInt("inspector_y"); //$NON-NLS-1$
  return obj;
}
 
开发者ID:OpenSourcePhysics,项目名称:osp,代码行数:17,代码来源:DarkGhostFilter.java


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