/** * create a rigid body given a definition. No reference to the definition is retained. * * @warning This function is locked during callbacks. * @param def * @return */ public Body createBody(BodyDef def) { assert (isLocked() == false); if (isLocked()) { return null; } // TODO djm pooling Body b = new Body(def, this); // add to world doubly linked list b.m_prev = null; b.m_next = m_bodyList; if (m_bodyList != null) { m_bodyList.m_prev = b; } m_bodyList = b; ++m_bodyCount; return b; }
Content subjContent = new Content().withData("Test of Amazon SES"); Message msg = new Message().withSubject(subjContent); // Include a body in both text and HTML formats Content textContent = new Content().withData("Hello - I hope you're having a good day."); Content htmlContent = new Content().withData("<h1>Hello - I hope you're having a good day.</h1>"); Body body = new Body().withHtml(htmlContent).withText(textContent); msg.setBody(body);
/** * create a rigid body given a definition. No reference to the definition is retained. * * @warning This function is locked during callbacks. * @param def * @return */ public Body createBody(BodyDef def) { assert (isLocked() == false); if (isLocked()) { return null; } // TODO djm pooling Body b = new Body(def, this); // add to world doubly linked list b.m_prev = null; b.m_next = m_bodyList; if (m_bodyList != null) { m_bodyList.m_prev = b; } m_bodyList = b; ++m_bodyCount; return b; }
for(int i=0; i<body.length; i++) { // probably some cod here.. body[i] = new Body(..); // probably some cod here.. }
@XmlRootElement(name = "Envelope", namespace = "http://schemas.xmlsoap.org/soap/envelope/") public class Envelope { @XmlElement(name = "Body", namespace = "http://schemas.xmlsoap.org/soap/envelope/") private Body body; public Body getBody() { return body; } public void setBody() { this.body = new Body(); } }
public Car(){ engine = new Engine() body = new Body() tank = new GasTank() transmission = new Transmission() }
import javax.xml.bind.annotation.adapters.XmlAdapter; public class BodyAdapter extends XmlAdapter<Body, Object>{ @Override public Object unmarshal(Body v) throws Exception { return v.getValue(); } @Override public Body marshal(Object v) throws Exception { Body body = new Body(); body.setValue(v); return body; } }
Matcher matcher1 = Pattern.compile("(?<=\\{).*?(?<=\\})").matcher(yourInput); while(mather1.find()) { Matcher matcher2 = Pattern.compile("(?<=\\[).*?(?=\\])").matcher(matcher1.Group()); while (matcher2.find()) { Matcher matcher3 = Pattern.compile("(\\d+);(\\d+);(\\d+)").matcher(matcher2.Group()); while (matcher3.find()) { tp.add(new Point(Double.valueOf(matcher3.Group(1),Double.valueOf(matcher3.Group(2)),Double.valueOf(matcher3.Group(3)))); } sf.add(new Surface((Point[]) tp.toArray())); } convShape.add(new Body((Surface[])sf.toArray())); }
public static void main(String[] args) { Body[] bodiesArr = new Body[5]; Scanner sc=new Scanner(System.in); for(int i = 0; i < 5; i++) { double x = sc.nextDouble(); double y = sc.nextDouble(); String pic = sc.nextLine(); Body body = new Body(x, y, pic); bodiesArr[i] = body; } }
import javax.xml.bind.*; import com.rti.rim2016.v1_2.fps.*; import com.rti.rim2016.v1_2.envelope.GovTalkMessage; import com.rti.rim2016.v1_2.envelope.GovTalkMessage.Body; public class Demo { public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance("com.rti.rim2016.v1_2.fps:com.rti.rim2016.v1_2.envelope"); GovTalkMessage govTalkMessage = new GovTalkMessage(); Body body = new Body(); IRenvelope irEnvelope = new IRenvelope(); body.getAny().add(irEnvelope); govTalkMessage.setBody(body); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(govTalkMessage, System.out); } }
Body b = new Body(); Body bdum; LinkedList<Body> l = new LinkedList<Body>(); b.setB(100); l.add(b); b.setB(20); l.add(b); b.setB(300); l.add(b);
Style mainDivStyle = new Style(); mainDivStyle.addCssProperties(AlignItems.CENTER, new BackgroundColor( CssColorName.AQUA.getColorName())); Html html = new Html(null) { Body body = new Body(this) { Div mainDiv = new Div(this, mainDivStyle); Footer footer = new Footer(this); }; }; try { //to write to a file html.toOutputStream(new FileOutputStream("/home/ansgar/html_work/html-by-wffweb.html")); //to print in to console //System.out.println(html.toHtmlString()); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
Html html = new Html(null) {{ new Head(this); new Body(this) {{ new H1(this) {{ new NoTag(this, "spacial characters taken from an external resource like file/database : 女 学校 ä ö ü Ä"); }}; }}; }}; System.out.println(html.toHtmlString(StandardCharsets.UTF_8));
Html html = new Html(null) { Head head = new Head(this); Body body = new Body(this) { Blank blank = new Blank(this, "Hello World"); }; }; // prepends the doc type <!DOCTYPE html> html.setPrependDocType(true); System.out.println(html.toHtmlString());
Html html = new Html(null) { Head head = new Head(this); Body body = new Body(this) { Blank blank = new Blank(this, "Hello World"); }; }; // prepends the doc type <!DOCTYPE html> html.setPrependDocType(true); System.out.println(html.toHtmlString());
class Car implements CarElement { CarElement[] elements; public Car() { //create new Array of elements this.elements = new CarElement[] { new Wheel("front left"), new Wheel("front right"), new Wheel("back left") , new Wheel("back right"), new Body(), new Engine() }; } public void accept(CarElementVisitor visitor) { for(CarElement elem : elements) { elem.accept(visitor); } visitor.visit(this); } }