📄 groovy-reference-card.tex
字号:
\documentclass[10pt, landscape]{article}\usepackage{multicol}\usepackage{graphics}% turn off header and footer\pagestyle{empty}\setlength{\textheight}{7.5 in}\setlength{\textwidth}{11.2 in}%\setlength{\hoffset}{-2 in}%\setlength{\voffset}{-1 in}%\setlength{\footskip}{12 pt}\setlength{\oddsidemargin}{-0.74 in}\setlength{\evensidemargin}{0.5 in}\setlength{\topmargin}{-0.75 in}\setlength{\headheight}{0 in}\setlength{\headsep}{0 in}\makeatletter\renewcommand{\section}{\@startsection{section}{1}{0mm}% {-1ex plus -.5ex minus -.2ex}% {0.5ex plus .2ex}%x {\normalfont\large\bfseries}}\renewcommand{\subsection}{\@startsection{subsection}{2}{0mm}% {-1explus -.5ex minus -.2ex}% {0.5ex plus .2ex}% {\normalfont\normalsize\bfseries}}\renewcommand\subsubsection{\@startsection{subsubsection}{3}{0mm}% {-1ex plus -.5ex minus -.2ex}% {1ex plus .2ex}% {\normalfont\small\bfseries}}\makeatother% Don't print section numbers\setcounter{secnumdepth}{0}\setlength{\columnsep}{0.5 in}%\setlength{\columnseprule}{0.4 pt}\setlength{\parindent}{0pt}\setlength{\parskip}{0pt plus 0.5ex}% -------------------------\begin{document}\raggedright\footnotesize% -- tabular, good for html output\newcommand{\keywordSummaryHeader}[1]{\begin{tabular}{ll} #1 \end{tabular}}\newcommand{\keywordSummary}[2]{{\bf #1} & #2 \\}%\newcommand{\methodDetailHeader}[1]{\begin{tabular}{rll} #1 \end{tabular}}%\newcommand{\methodDetail}[3]{#1 & #2 & #3 \\}% -- tabbing, good for pdf output%\newcommand{\keywordSummaryHeader}[1]{\begin{tabbing} jez \= jez-repeated-for-tab-settings-only \kill #1 \end{tabbing}}%\newcommand{\keywordSummary}[2]{#1 \\ \> #2 \\}\newcommand{\methodDetailHeader}[1]{\begin{tabbing} jezje \= jez-repeated-for-tab-settings-only \kill #1 \end{tabbing}}\newcommand{\methodDetail}[4]{#1\>{\bf #2}#3\\{\scriptsize #4}\\}\newcommand{\methodSummaryHeader}[1]{\begin{tabbing} jezj \= jez-repeated-for-tab-settings-only \kill #1 \end{tabbing}}\newcommand{\methodSummary}[4]{#1\>{\bf #2}#3\\}\newcommand{\toolDetailHeader}[1]{\begin{tabbing} je \= jez-repeated-for-tab-settings-only \kill #1 \end{tabbing}}\newcommand{\toolDetail}[4]{#1\>{\bf #2}#3\\{\scriptsize #4}\\}\newcommand{\head}[1]{{\large\textbf{#1}}\\}\begin{multicols}{3}\setlength{\premulticols}{1pt}\setlength{\postmulticols}{1pt}\setlength{\multicolsep}{1pt}\setlength{\columnsep}{2pt}\begin{tabular}{ll}\scalebox{0.35}{\includegraphics{one-groovy-logo.mps}} & {\large\textbf{Groovy}} \\ & {\large\textbf{Reference}} \\ & {\large\textbf{Summary}}\end{tabular}\vskip 1.8in%todo: black lineGROOVY-1.0-BETA-7\vskip 0.25 in{\em Second Edition\/} (September 2004)This card is intended primarily for use by Groovy language programmers. It contains basic language information summarized from the onlinedocumentation (http://groovy.codehaus.org). The card will be updated from time to time. However the above manual and others cited on the cardare the authoritative reference sources and will be first to reflect changes.To distinguish them from instructions carried over from the Java Language,the names of instructions essentially new with Groovy are shownin italics.Comments about this publication may be sent to the address below.\vskip 2 inGroovy Technical Publications Systems groovy.codehaus.org\section{Keywords}\subsection{Grammar}\keywordSummaryHeader{\keywordSummary{{\em as} }{ import {\em type\/} as {\em id\/}}\keywordSummary{assert }{ assert {\em expr expr?\/}}\keywordSummary{break }{ break {\em lbl?\/}}\keywordSummary{case }{ switch {\em expr\/} case {\em expr stmt*\/}}\keywordSummary{catch }{ try {\em stmt*\/} catch {\em type id stmt*\/}}\keywordSummary{class }{ {\em mod*\/} class {\em id\/}}\keywordSummary{continue }{ continue {\em lbl?\/}}\keywordSummary{{\em def} }{ def {\em methodDeclaration\/}}\keywordSummary{default }{ switch {\em expr\/} case default{\em stmt*\/} }\keywordSummary{do }{ do {\em stmt*\/} while {\em expr\/}}\keywordSummary{else }{ if {\em expr stmt*\/} else if {\em expr stmt*\/}}\keywordSummary{extends }{ {\em mod*\/} class {\em id\/} extends {\em type\/}}\keywordSummary{finally }{ try {\em stmt*} finally {\em stmt*}}\keywordSummary{for }{ for {\em expr*};{\em expr};{\em expr} {\em stmt*\/}}\keywordSummary{{\em for} }{ for {\em id\/} in {\em id stmt*\/}}\keywordSummary{if }{ if {\em expr stmt*\/} else if {\em expr stmt*\/}}\keywordSummary{{\em in} }{ for {\em id\/} in {\em id stmt*\/}}\keywordSummary{implements }{ {\em mod*\/} class {\em id\/} implements {\em type*}}\keywordSummary{import }{ import {\em type\/}}\keywordSummary{instanceof }{ {\em expr\/} instanceof {\em type}}\keywordSummary{interface }{ {\em mod*\/} interface {\em id\/}}%\keywordSummary{{\em mixin} }{ {\em mod*\/} mixin {\em id\/}}\keywordSummary{new }{ new {\em type\/} }\keywordSummary{package }{ package {\em id\/}}\keywordSummary{{\em property} }{ {\em mod*\/} property {\em type?\/} {\em id\/}}\keywordSummary{return }{ return {\em expr?/} }\keywordSummary{switch }{ switch {\em expr\/} case {\em expr stmt*\/} }\keywordSummary{throw }{ throw {\em expr\/} }\keywordSummary{throws }{ {\em methodDeclaration} throws {\em type\/} }\keywordSummary{try }{ try {\em stmt*\/} catch {\em type id stmt*\/}}\keywordSummary{while }{ do {\em stmt*\/} while {\em expr\/}}\keywordSummary{ }{ while {\em expr\/} {\em stmt*\/}}}% \subsection{Types}% \keywordSummaryHeader{% \keywordSummary{boolean }{ true {\em or\/} false}% \keywordSummary{byte }{ -128 to 127}% \keywordSummary{char }{ u0000 to uFFFF }% \keywordSummary{double }{ $\pm 4.9E^{-324}$ to $\pm 1.8E^{+308}$}% \keywordSummary{float }{ $\pm 1.4E^{-45}$ to $\pm 3.4E^{+38}$}% \keywordSummary{int }{ -2,147,483,648 to 2,147,483,647}% \keywordSummary{long }{ -9,223,372,036,854,775,808 }% \keywordSummary{ }{ to 9,223,372,036,854,775,807}% \keywordSummary{short }{ -32,768 to 32,767}% \keywordSummary{void }{ }% }\vskip 0.5 in\section{Groovy JDK}% based upon DefaultGroovyMethods r1.114\subsection{Collections and properties}{\scriptsize {\em Note: cltn in this sense {\em can\/} include lists, sets, matchers, strings, charSeqs and arrays\/}}\methodDetailHeader{% a.getAt(b) and a.putAt(b,c) are equiv to a[b] and a[b] = c respectiv. %\methodDetail{ cltn. }{ getAt}{(index\textbar indices\textbar range) }{ obtains objects at specified {\em indicies\/} or in {\em range\/}}%\methodDetail{ cltn. }{ getAt}{(property) }{ obtains {\em property\/} from each object in collection}%\methodDetail{ obj. }{ putAt}{(idx, value) }{ put {\em value\/} at position {\em idx\/} } %\methodDetail{ obj. }{ putAt}{(propertyName, value) }{ put {\em value\/} in the {\em propertyName\/} }\methodDetail{ cltn }{[}{index\textbar indices\textbar range\textbar property {\bf ]}}{ obtains objects at specified location}\methodDetail{ obj }{[}{index\textbar property{\bf ] =} value }{ put {\em value\/} at location } \methodDetail{ cltn }{ \textless\textless}{ obj }{ append obj to collection}\methodSummary{ cltn }{ $+$}{ obj }{ append obj to collection}%\methodDetail{ cltn }{ $+$}{ cltn }{ append collection to collection}\methodSummary{ list }{ $-$}{ cltn }{ remove items from list}\methodDetail{ cltn }{ $*$}{ num }{ repeat items in collection a number of times}\methodDetail{ }{ }{ }{ }% no count() or getAt(range) for matchers!\methodDetail{ obj. }{ getProperties}{() }{ obtain Map of properties on {\em obj\/}}\methodDetail{ obj. }{ getMetaPropertyValues}{() }{ obtain List of meta properties on {\em obj\/}}\methodDetail{ cltn. }{ count}{(obj) * }{ counts number of occurances of {\em obj\/} in collection}\methodSummary{ map. }{ get}{(key, defaultValue) * }{ try to get {\em key \/} from map, otherwise put {\em defaultValue\/} in map and return }\methodSummary{ cltn. }{ size}{() * }{ returns size of an array or string }\methodDetail{ }{ }{ }{ }\methodDetail{ cltn. }{ collect}{() \{closure\} * }{ new collection of {\em closure \/} transformed items }\methodDetail{ obj. }{ each}{() \{closure\} * }{ iterate through object applying {\em closure\/} }\methodDetail{ obj. }{ eachWithIndex}{() \{closure\} }{ iterate through object with a counter applying {\em closure\/} }\methodDetail{ obj. }{ find}{() \{closure\} * }{ find first item picked by {\em closure \/} condition }\methodDetail{ obj. }{ findAll}{() \{closure\} * }{ returns all items picked by {\em closure\/} condition }\methodDetail{ obj. }{ findIndexOf}{() \{closure\} }{ return first index that matches condition {\em closure\/} }\methodSummary{ obj. }{ grep}{(regex\textbar range\textbar etc..) * }{ returns all matching items }\methodDetail{ cltn. }{ inject}{(value) \{closure\} }{ returns closure( closure( closure(value,item0) ,item1) ,item2) ... }\methodDetail{ cltn. }{ max}{([comparator]) \{closure\} * }{ returns the maximum value found in the collection }\methodDetail{ cltn. }{ min}{([comparator]) \{closure\} * }{ returns the minimum value found in the collection }\methodDetail{ list. }{ reverseEach}{() \{closure\} }{ iterate backwards through list applying {\em closure\/}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -