Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





#Java - Code Snippets for '#.Local' - 7 code snippet(s) found

 Sample 1. Code Sample / Example / Snippet of java.time.LocalTime

    public static LocalTime from(TemporalAccessor temporal) {

Objects.requireNonNull(temporal, "temporal");

LocalTime time = temporal.query(TemporalQueries.localTime());

if (time == null) {

throw new DateTimeException("Unable to obtain LocalTime from TemporalAccessor: " +

temporal + " of type " + temporal.getClass().getName());

}

return time;

}


   Like      Feedback      java.time.LocalTime


 Sample 2. Code Sample / Example / Snippet of java.time.LocalDateTime

    public boolean equals(Object obj) {

if (this == obj) {

return true;

}

if (obj instanceof LocalDateTime) {

LocalDateTime other = (LocalDateTime) obj;

return date.equals(other.date) && time.equals(other.time);

}

return false;

}


   Like      Feedback      java.time.LocalDateTime


 Sample 3. Code Sample / Example / Snippet of java.time.LocalDate

    public static LocalDateTime of(int year, Month month, int dayOfMonth, int hour, int minute) {

LocalDate date = LocalDate.of(year, month, dayOfMonth);

LocalTime time = LocalTime.of(hour, minute);

return new LocalDateTime(date, time);

}


   Like      Feedback      java.time.LocalDate


 Sample 4. Code Sample / Example / Snippet of org.apache.storm.LocalCluster

    public static void main(String[] args) throws Exception {

TopologyBuilder builder = new TopologyBuilder();

builder.setSpout("spout", new RandomIntegerSpout());

builder.setBolt("sumbolt", new WindowSumBolt().withWindow(new Count(5), new Count(3))

.withMessageIdField("msgid"), 1).shuffleGrouping("spout");

builder.setBolt("printer", new PrinterBolt(), 1).shuffleGrouping("sumbolt");

Config conf = new Config();

conf.setDebug(false);

if (args != null && args.length > 0) {

conf.setNumWorkers(1);

StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology());

} else {

LocalCluster cluster = new LocalCluster();

StormTopology topology = builder.createTopology();

cluster.submitTopology("test", conf, topology);

Utils.sleep(40000);

cluster.killTopology("test");

cluster.shutdown();

}

}


   Like      Feedback      org.apache.storm.LocalCluster


Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
 Sample 5. Code Sample / Example / Snippet of org.apache.bcel.classfile.LocalVariableTable

    public void testB79() throws ClassNotFoundException

{

final JavaClass clazz = getTestClass(PACKAGE_BASE_NAME+".data.PLSETestClass");

final ClassGen gen = new ClassGen(clazz);

final ConstantPoolGen pool = gen.getConstantPool();

final Method m = gen.getMethodAt(2);

final LocalVariableTable lvt = m.getLocalVariableTable();

final MethodGen mg = new MethodGen(m, gen.getClassName(), pool);

final LocalVariableTable new_lvt = mg.getLocalVariableTable(mg.getConstantPool());

assertEquals("number of locals", lvt.getTableLength(), new_lvt.getTableLength());

}


   Like      Feedback      org.apache.bcel.classfile.LocalVariableTable


 Sample 6. Code Sample / Example / Snippet of org.apache.bcel.generic.LocalVariableGen

    public void testRemoveLocalVariable() throws Exception {

final MethodGen mg = getMethod(Foo.class, "bar");



final LocalVariableGen lv = mg.getLocalVariables()[1];

assertEquals("variable name", "a", lv.getName());

final InstructionHandle start = lv.getStart();

final InstructionHandle end = lv.getEnd();

assertNotNull("scope start", start);

assertNotNull("scope end", end);

assertTrue("scope start not targeted by the local variable", Arrays.asList(start.getTargeters()).contains(lv));

assertTrue("scope end not targeted by the local variable", Arrays.asList(end.getTargeters()).contains(lv));



mg.removeLocalVariable(lv);



assertFalse("scope start still targeted by the removed variable", Arrays.asList(start.getTargeters()).contains(lv));

assertFalse("scope end still targeted by the removed variable", Arrays.asList(end.getTargeters()).contains(lv));

assertNull("scope start", lv.getStart());

assertNull("scope end", lv.getEnd());

}


   Like      Feedback      org.apache.bcel.generic.LocalVariableGen


 Sample 7. Code Sample / Example / Snippet of org.apache.bcel.classfile.LocalVariableTypeTable

    public Attribute copy(final ConstantPool constant_pool) {

final LocalVariableTypeTable c = (LocalVariableTypeTable) clone();



c.local_variable_type_table = new LocalVariable[local_variable_type_table.length];

for (int i = 0; i < local_variable_type_table.length; i++) {

c.local_variable_type_table[i] = local_variable_type_table[i].copy();

}



c.setConstantPool(constant_pool);

return c;

}


   Like      Feedback      org.apache.bcel.classfile.LocalVariableTypeTable



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner