2009-03-01から1ヶ月間の記事一覧

libharu:HPDFPage#draw_image

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page image = pdf.load_png_image_from_file("pngsuite/basn0g01.png") page.draw_image(image, 100, 100, 50, 50) page.draw_image(image, 300, 100, 100, 100) pdf.save_to_file(Fil…

Commons Lang、BooleanUtils.toStringYesNo()

import org.apache.commons.lang.BooleanUtils; public class C2009033100 { public static void main(String[] args) { System.out.println(BooleanUtils.toStringYesNo(true)); System.out.println(BooleanUtils.toStringYesNo(false)); System.out.printl…

*Constants.java

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } TOKEN : { <A: "a"> | <B: "b"> } void Input() : {} { ( <A> | <B> | "c" | "de</b></a></b:></a:></space:>…

libharu:HPDFPage#curve_to3

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page page.move_to(100, 100) page.curve_to3(250, 250, 280, 150) page.stroke pdf.save_to_file(File.basename($0, ".rb") + ".pdf")

Commons Lang、BooleanUtils.toStringTrueFalse()

import org.apache.commons.lang.BooleanUtils; public class C2009033000 { public static void main(String[] args) { System.out.println(BooleanUtils.toStringTrueFalse(true)); System.out.println(BooleanUtils.toStringTrueFalse(false)); System.ou…

getNextToken()

字句解析内での呼び出し PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } TOKEN : { <A: "a"> { getNextToken(); }</a:></space:>…

libharu:HPDFPage#curve_to2

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page page.move_to(100, 100) page.curve_to2(250, 250, 280, 150) page.stroke pdf.save_to_file(File.basename($0, ".rb") + ".pdf")

Commons Lang、BooleanUtils.toStringOnOff()

import org.apache.commons.lang.BooleanUtils; public class C2009032900 { public static void main(String[] args) { System.out.println(BooleanUtils.toStringOnOff(true)); System.out.println(BooleanUtils.toStringOnOff(false)); System.out.printl…

Token の位置情報、next

matchedToken も Token クラスだから、それと同じか〜 PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } TO</space:>…

libharu:HPDFPage#curve_to

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page page.move_to(100, 100) page.curve_to(200, 300, 250, 250, 240, 50) page.stroke pdf.save_to_file(File.basename($0, ".rb") + ".pdf")

Commons Lang、BooleanUtils.toString()

import org.apache.commons.lang.BooleanUtils; public class C2009032800 { public static void main(String[] args) { System.out.println(BooleanUtils.toString(true, "foo", "bar")); System.out.println(BooleanUtils.toString(false, "foo", "bar"));…

字句解析:input_stream.get*()

SKIP 内では、matchedToken が使えないから、input_stream.get*() を使うらしい(使う機会は余りなさそうな気もするけど) PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(S…

libharu:HPDFPage#concat

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_trans_matrix rad = 45 / 180.0 * Math::PI page.concat(Math.cos(rad), Math.sin(rad), -Math.sin(rad), Math.cos(rad), 100, 100) p page.get_trans_matrix page.mo…

Commons Lang、BooleanUtils.toIntegerObject()

import org.apache.commons.lang.BooleanUtils; public class C2009032700 { public static void main(String[] args) { System.out.println(BooleanUtils.toIntegerObject(true)); System.out.println(BooleanUtils.toIntegerObject(false)); System.out.pr…

字句解析:SwitchTo()

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) <*>SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } TOKEN : { <A: "a"> : STATE1 } <STATE1>TOKEN : { <S1A: "a"> { SwitchTo(0); } }</s1a:></state1></a:></space:>…

libharu:HPDFPage#close_path_fill_stroke

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page page.move_to(100, 100) page.line_to(150, 100) page.line_to(150, 50) page.close_path_fill_stroke pdf.save_to_file(File.basename($0, ".rb") + ".pdf")

Commons Lang、BooleanUtils.toInteger()

import org.apache.commons.lang.BooleanUtils; public class C2009032600 { public static void main(String[] args) { System.out.println(BooleanUtils.toInteger(true)); System.out.println(BooleanUtils.toInteger(false)); System.out.println(Boolea…

字句解析:input_stream

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } TOKEN : { <A: "a"> { System.out.print(input_stream); } } void</a:></space:>…

libharu:HPDFPage#close_path_stroke

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page page.move_to(100, 100) page.line_to(150, 100) page.line_to(150, 50) page.close_path_stroke pdf.save_to_file(File.basename($0, ".rb") + ".pdf")

Commons Lang、BooleanUtils.toBooleanObject()

import org.apache.commons.lang.BooleanUtils; public class C2009032500 { public static void main(String[] args) { System.out.println(BooleanUtils.toBooleanObject(true)); System.out.println(BooleanUtils.toBooleanObject(false)); System.out.pr…

字句解析:curLexState

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } TOKEN : { <A: "a"> { System.out.print("curLexState: "); Syste</a:></space:>…

libharu:HPDFPage#close_path

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page page.move_to(100, 100) page.line_to(150, 100) page.line_to(150, 50) page.close_path page.stroke pdf.save_to_file(File.basename($0, ".rb") + ".pdf")

Commons Lang、BooleanUtils.toBooleanDefaultIfNull()

import org.apache.commons.lang.BooleanUtils; public class C2009032400 { public static void main(String[] args) { System.out.println(BooleanUtils.toBooleanDefaultIfNull(true, true)); System.out.println(BooleanUtils.toBooleanDefaultIfNull(fa…

字句解析:lengthOfMatch

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } TOKEN : { <A: "a"> { System.out.print("lengthOfMatch: "); Sys</a:></space:>…

libharu:HPDFPage#circle

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page page.circle(100, 100, 100) page.fill page.circle(300, 100, 50) page.stroke page.circle(200, 500, 10) page.stroke pdf.save_to_file(File.basename($0, ".rb") + ".pdf")

Commons Lang、BooleanUtils.toBoolean()

import org.apache.commons.lang.BooleanUtils; public class C2009032300 { public static void main(String[] args) { System.out.println(BooleanUtils.toBoolean(true)); System.out.println(BooleanUtils.toBoolean((Boolean)null)); System.out.printl…

字句解析:MORE と image の置き換え

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } TOKEN : { <A: "a"> } MORE : { <B: "b"> { System.out.println("+"); ima</b:></a:></space:>…

libharu:HPDFPage#arc

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page page.arc(100, 100, 90, 0, 270) page.fill page.arc(300, 100, 90, 90, 360) page.stroke page.arc(200, 500, 10, 90, 360) page.stroke pdf.save_to_file(File.basename($0, ".…

Commons Lang、BooleanUtils.negate()

import org.apache.commons.lang.BooleanUtils; public class C2009032200 { public static void main(String[] args) { System.out.println(BooleanUtils.negate(true)); System.out.println(BooleanUtils.negate(false)); System.out.println(BooleanUtils…

字句解析:TOKEN_MGR_DECLS

PARSER_BEGIN(Test) public class Test { public static void main(String args[]) throws ParseException { Test parser = new Test(System.in); parser.Input(); } } PARSER_END(Test) TOKEN_MGR_DECLS : { static int x = 1; } SKIP : { <SPACE: " " | "\t" | "\n" | "\r"> } TOKEN : { <A: "a"> { </a:></space:>…