本文整理汇总了Java中java.util.EnumSet.range方法的典型用法代码示例。如果您正苦于以下问题:Java EnumSet.range方法的具体用法?Java EnumSet.range怎么用?Java EnumSet.range使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.EnumSet
的用法示例。
在下文中一共展示了EnumSet.range方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTimeUnit
import java.util.EnumSet; //导入方法依赖的package包/类
@Test
public void testTimeUnit() throws IOException {
final EnumSet<TimeUnit> optimizedTimeUnits =
EnumSet.range(TimeUnit.NANOSECONDS, TimeUnit.SECONDS);
for (TimeUnit v : TimeUnit.values()) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
DataSerializer.writeObject(v, out);
byte[] bytes = baos.toByteArray();
String type = DataType.getDataType(bytes); // 4?
if (optimizedTimeUnits.contains(v)) {
assertEquals("for enum " + v, "java.util.concurrent.TimeUnit", type);
} else {
assertEquals("for enum " + v, "java.lang.Enum:java.util.concurrent.TimeUnit", type);
}
}
}
示例2: main
import java.util.EnumSet; //导入方法依赖的package包/类
public static void main(String[] args) {
EnumSet<TIME_FRAME> tf = EnumSet.of(TIME_FRAME.DAY, TIME_FRAME.DAY);
System.out.println(tf.size());
IDataSource kt_data = new KTExportFutures("al", EnumSet.range(TIME_FRAME.MIN5, TIME_FRAME.DAY));
//for (Bar bar : kt_data.getBarSeries(0, TIME_FRAME.DAY)) {
//System.out.println(bar);
//}
check1(kt_data);
check2(kt_data);
int len = main_id1.length;
for (int i = 0; i < len; i++) {
if (main_id2[i] != 0) {
if (main_id1[i] + 1 != main_id2[i] % 100) {
System.out.println("i = " + i + ", " + main_id1[i] + ", " + main_id2[i]);
}
}
}
}
示例3: run
import java.util.EnumSet; //导入方法依赖的package包/类
@Override
public void run() {
final List<Activity> activities = new ArrayList<>();
for (final Stage stage : EnumSet.range(Stage.CREATED, Stage.STOPPED)) {
activities.addAll(activityLifecycleMonitor.getActivitiesInStage(stage));
}
for (final Activity activity : activities) {
if (!activity.isFinishing()) {
activity.finish();
}
}
}
示例4: testRun
import java.util.EnumSet; //导入方法依赖的package包/类
/**
* Verify getSourceVersions.
*/
@Test
public void testRun() throws Exception {
DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
Set<SourceVersion> found = tool.getSourceVersions();
Set<SourceVersion> expect = EnumSet.range(SourceVersion.RELEASE_3, SourceVersion.latest());
if (!expect.equals(found)) {
System.err.println("expect: " + expect);
System.err.println(" found: " + expect);
error("unexpected versions");
}
}
示例5: SinYeeDataSource
import java.util.EnumSet; //导入方法依赖的package包/类
public SinYeeDataSource(String instrument_name) {
this(instrument_name, EnumSet.range(TIME_FRAME.MIN1, TIME_FRAME.DAY), str -> true);
}