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

libharu:HPDFPage#set_slide_show

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new font = pdf.get_font("Helvetica", nil) [HPDFDoc::HPDF_TS_WIPE_RIGHT, HPDFDoc::HPDF_TS_WIPE_UP, HPDFDoc::HPDF_TS_WIPE_LEFT, HPDFDoc::HPDF_TS_WIPE_DOWN, HPDFDoc::HPDF_TS_BARN_DOORS_HORIZONT…

Commons Lang、ArrayUtils.toString()

import org.apache.commons.lang.ArrayUtils; public class C2009032100 { public static void main(String[] args) { Integer[] X = { 0, 1, 2 }; System.out.println(X.toString()); System.out.println(ArrayUtils.toString(X)); System.out.println(Arra…

日本語のトークン

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

libharu:HPDFPage#get_gstate_depth

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_gstate_depth で、 1

Commons Lang、ArrayUtils.toPrimitive()

import org.apache.commons.lang.ArrayUtils; public class C2009032000 { public static void main(String[] args) { Integer[] X = { 0, 1, 2 }; int[] x = ArrayUtils.toPrimitive(X); System.out.println(x); System.out.println(x[0]); } } で、 [I@198…

字句解析: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"> { image.insert(0, "*"); image.append("*");</a:></space:>…

libharu:HPDFPage#get_text_matrix

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_text_matrix で、 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

Commons Lang、ArrayUtils.toObject()

import org.apache.commons.lang.ArrayUtils; public class C2009031900 { public static void main(String[] args) { int[] x = { 0, 1, 2 }; Integer[] X = ArrayUtils.toObject(x); System.out.println(X); System.out.println(X[0]); } } で、 [Ljava.la…

字句解析:matchedToken

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.println("*" + matchedToken.ki</a:></space:>…

libharu:HPDFPage#get_filling_color_space

「return NUM2INT(i);」は「return INT2NUM(i);」に修正 #!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_filling_color_space で、 0

Commons Lang、ArrayUtils.toMap()

import org.apache.commons.lang.ArrayUtils; import java.util.*; public class C2009031800 { public static void main(String[] args) { Map colorMap = ArrayUtils.toMap(new String[][] { {"RED", "#FF0000"}, {"GREEN", "#00FF00"}, {"BLUE", "#0000FF…

字句解析: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"> { System.out.println("*" + image + "*"); }</a:></space:>…

libharu:HPDFPage#get_stroking_color_space

「return NUM2INT(i);」は「return INT2NUM(i);」に修正 #!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_stroking_color_space で、 0

Commons Lang、ArrayUtils.reverse()

import org.apache.commons.lang.ArrayUtils; public class C2009031700 { public static void main(String[] args) { int[] x = { 0, 1, 2 }; ArrayUtils.reverse(x); System.out.println(x); for (int i = 0; i < x.length; i++) { System.out.println(x[i…

字句解析:マッチしたときのアクション

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.println("*A*"); } | <B: "b"> { System</b:></a:></space:>…

libharu:HPDFPage#get_gray_stroke

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_gray_stroke で、 0.0

Commons Lang、ArrayUtils.lastIndexOf()

import org.apache.commons.lang.ArrayUtils; public class C2009031600 { public static void main(String[] args) { int[] x = { 10, 11, 12, 10 }; int[] n = { }; System.out.println(ArrayUtils.lastIndexOf(x, 10)); System.out.println(ArrayUtils.la…

字句解析:MORE

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"> | <C: "c"> } MORE : { <B: "b"> } void Input() : { Token t;</b:></c:></a:></space:>…

libharu:HPDFPage#get_gray_fill

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_gray_fill で、 0.0

Commons Lang、ArrayUtils.isSameType()

import org.apache.commons.lang.ArrayUtils; public class C2009031500 { public static void main(String[] args) { int[] x1 = { 0, 1, 2 }; int[] x2 = { 1, 2, 3 }; char[] x3 = { 1, 2, 3 }; int[][] x4 = { {} }; System.out.println(ArrayUtils.isSa…

bison マニュアルの多機能電卓

練習問題2『JavaCC―コンパイラ・コンパイラfor Java』の calculator.jj を参考に options { LOOKAHEAD = 2; FORCE_LA_CHECK = true; } PARSER_BEGIN(Calc) import java.util.*; public class Calc { public static void main(String args[]) throws ParseExc…

libharu:HPDFPage#get_cmyk_stroke

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_cmyk_stroke で、 [0.0, 0.0, 0.0, 0.0]

Commons Lang、ArrayUtils.isSameLength()

import org.apache.commons.lang.ArrayUtils; public class C2009031400 { public static void main(String[] args) { int[] x1 = { 0, 1, 2 }; int[] x2 = { 1, 2, 3 }; int[] x3 = { 0, 1, 2, 3 }; int[] x4 = { }; System.out.println(ArrayUtils.isSameL…

bison マニュアルの多機能電卓

『JavaCC―コンパイラ・コンパイラfor Java』の calculator.jj を参考に options { LOOKAHEAD = 2; } PARSER_BEGIN(Calc) import java.util.*; public class Calc { public static void main(String args[]) throws ParseException { Calc parser = new Calc(…

libharu:HPDFPage#get_cmyk_fill

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_cmyk_fill で、 [0.0, 0.0, 0.0, 0.0]

Commons Lang、ArrayUtils.isEquals()

import org.apache.commons.lang.ArrayUtils; public class C2009031300 { public static void main(String[] args) { int[] x1 = { 0, 1, 2 }; int[] x2 = { 0, 1, 2 }; int[] x3 = { 1, 2, 3 }; int[] x4 = { }; System.out.println(ArrayUtils.isEquals(x…

bison マニュアルの中間記法電卓

『JavaCC―コンパイラ・コンパイラfor Java』の calculator.jj を参考に入力に小数も認め、計算を double で PARSER_BEGIN(Calc) public class Calc { public static void main(String args[]) throws ParseException { Calc parser = new Calc(System.in); p…

libharu:HPDFPage#get_rgb_stroke

#!/usr/bin/env ruby require "hpdf" pdf = HPDFDoc.new page = pdf.add_page p page.get_rgb_stroke で、 [0.0, 0.0, 0.0]

Commons Lang、ArrayUtils.indexOf()

import org.apache.commons.lang.ArrayUtils; public class C2009031200 { public static void main(String[] args) { int[] x = { 10, 11, 12, 10 }; int[] n = { }; System.out.println(ArrayUtils.indexOf(x, 12)); System.out.println(ArrayUtils.indexO…

bison マニュアルの中間記法電卓

『JavaCC―コンパイラ・コンパイラfor Java』の calculator.jj を参考に PARSER_BEGIN(Calc) public class Calc { public static void main(String args[]) throws ParseException { Calc parser = new Calc(System.in); parser.Input(); } } PARSER_END(Calc…