id
int32
0
3k
input
stringlengths
43
33.8k
gt
stringclasses
1 value
0
<s> package org . rubypeople . rdt . internal . ui . rubyeditor ; import java . util . Iterator ; import org . eclipse . core . resources . IMarker ; import org . eclipse . ui . texteditor . MarkerAnnotation ; import org . eclipse . ui . texteditor . MarkerUtilities ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyModelMarker ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . RubyCore ; public class RubyMarkerAnnotation extends MarkerAnnotation implements IRubyAnnotation { public static final String RUBY_MARKER_TYPE_PREFIX = "" ; public static final String ERROR_ANNOTATION_TYPE = "" ; public static final String WARNING_ANNOTATION_TYPE = "" ; public static final String INFO_ANNOTATION_TYPE = "" ; public static final String TASK_ANNOTATION_TYPE = "" ; private IRubyAnnotation fOverlay ; public RubyMarkerAnnotation ( IMarker marker ) { super ( marker ) ; } public String [ ] getArguments ( ) { return null ; } public int getId ( ) { IMarker marker = getMarker ( ) ; if ( marker == null || ! marker . exists ( ) ) return - 1 ; if ( isProblem ( ) ) return marker . getAttribute ( IRubyModelMarker . ID , - 1 ) ; return - 1 ; } public boolean isProblem ( ) { String type = getType ( ) ; return WARNING_ANNOTATION_TYPE . equals ( type ) || ERROR_ANNOTATION_TYPE . equals
1
<s> package com . asakusafw . runtime . io . util ; import java . io . IOException ; import org . apache . hadoop . io . WritableComparator ; public class WritableRawComparator extends WritableComparator { private final WritableRawComparable object ; protected WritableRawComparator ( Class < ? extends WritableRawComparable > aClass ) { super ( aClass ) ; this . object = ( WritableRawComparable ) newKey ( ) ; } @ Override public int compare ( byte [ ] b1 , int s1 , int l1 , byte [ ]
2
<s> package net . sf . sveditor . ui . prop_pages ; import java . util . List ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . index . ISVDBIndex ; import net . sf . sveditor . core . db . index . SVDBIndexCollection ; import net . sf . sveditor . core . db . project . SVDBProjectData ; import net . sf . sveditor . core . db . project . SVDBProjectManager ; import net . sf . sveditor . core . db . search . SVDBSearchResult ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core
3
<s> package com . asakusafw . utils . java . model . syntax ; import java . util . List ; public interface ConstructorInvocation extends Statement , Invocation { List < ? extends
4
<s> package org . rubypeople . rdt . internal . ui . text . comment ; import org . eclipse . jface . text . formatter . FormattingContext ; import org . rubypeople . rdt . core . formatter . DefaultCodeFormatterConstants ; public class CommentFormattingContext extends FormattingContext
5
<s> package com . asakusafw . utils . java . parser . javadoc ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . IrDocBlock ; public abstract class JavadocBaseParser { private List < ? extends JavadocBlockParser > blockParsers ; public JavadocBaseParser ( List < ? extends JavadocBlockParser > blockParsers ) { super ( ) ; setBlockParsers ( blockParsers ) ; } public final List < ? extends JavadocBlockParser > getBlockParsers ( ) { return this . blockParsers ; } public final void setBlockParsers ( List < ? extends JavadocBlockParser > blockParsers ) { if ( blockParsers == null ) { throw new IllegalArgumentException ( "blockParsers" ) ; } this . blockParsers = Collections . unmodifiableList ( new ArrayList < JavadocBlockParser > ( blockParsers ) ) ; } public IrDocBlock parseBlock ( JavadocBlockInfo block ) throws JavadocParseException { if ( block == null
6
<s> package com . asakusafw . yaess . jobqueue . client ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . net . InetSocketAddress ; import java . net . URL ; import java . util . HashMap ; import org . apache . http . HttpEntity ; import org . apache . http . HttpEntityEnclosingRequest ; import org . apache . http . HttpException ; import org . apache . http . HttpRequest ; import org . apache . http . HttpResponse ; import org . apache . http . HttpStatus ; import org . apache . http . entity . StringEntity ; import org . apache . http . localserver . LocalTestServer ; import org . apache . http . localserver . RequestBasicAuth ; import org . apache . http . localserver . ResponseBasicUnauthorized ; import org . apache . http . protocol . BasicHttpProcessor ; import org . apache . http . protocol . HttpContext ; import org . apache . http . protocol . HttpRequestHandler ; import org . apache . http . protocol . ResponseConnControl ; import org . apache . http . protocol . ResponseContent ; import org . apache . http . protocol . ResponseDate ; import org . apache . http . protocol . ResponseServer ; import org . apache . http . util . EntityUtils ; import org . junit . After ; import org . junit . Before ; import org . junit . Test ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . yaess . core . ExecutionPhase ; import com . google . gson . Gson ; import com . google . gson . JsonElement ; import com . google . gson . JsonObject ; import com . google . gson . JsonParser ; public class HttpJobClientTest { static final Logger LOG = LoggerFactory . getLogger ( HttpJobClientTest . class ) ; private LocalTestServer server ; private String baseUrl ; @ Before public void setUp ( ) throws Exception { BasicHttpProcessor proc = new BasicHttpProcessor ( ) ; proc . addInterceptor ( new ResponseDate ( ) ) ; proc . addInterceptor ( new ResponseServer ( ) ) ; proc . addInterceptor ( new ResponseContent ( ) ) ; proc . addInterceptor ( new ResponseConnControl ( ) ) ; proc . addInterceptor ( new RequestBasicAuth ( ) ) ; proc . addInterceptor ( new ResponseBasicUnauthorized ( ) ) ; server = new LocalTestServer ( proc , null ) ; server . start ( ) ; InetSocketAddress address = server . getServiceAddress ( ) ; baseUrl = new URL ( "http" , address . getHostName ( ) , address . getPort ( ) , "/" ) . toExternalForm ( ) ; } @ After public void tearDown ( ) throws Exception { server . stop ( ) ; } @ Test public void register ( ) throws Exception { JsonObject result = new JsonObject ( ) ; result . addProperty ( "status" , "initialized" ) ; result . addProperty ( "jrid" , "testing" ) ; JsonHandler handler = new JsonHandler ( result ) ; server . register ( "/jobs" , handler ) ; HttpJobClient client = new HttpJobClient ( baseUrl ) ; JobScript script = new JobScript ( ) ; script . setBatchId ( "b" ) ; script . setFlowId ( "f" ) ; script . setExecutionId ( "e" ) ; script . setPhase ( ExecutionPhase . MAIN ) ; script . setStageId ( "s" ) ; script . setMainClassName ( "Cls" ) ; script . setProperties ( new HashMap < String , String > ( ) ) ; script . setEnvironmentVariables ( new HashMap < String , String > ( ) ) ; JobId id = client . register ( script ) ; assertThat ( id , is ( new JobId ( "testing" ) ) ) ; assertThat ( handler . requestElement , is ( notNullValue ( ) ) ) ; JsonObject object = handler . requestElement ; assertThat ( object . get ( "batchId" ) . getAsString ( ) , is ( "b" ) ) ; assertThat ( object . get ( "flowId" ) . getAsString ( ) , is ( "f" ) ) ; assertThat ( object . get ( "executionId" ) . getAsString ( ) , is ( "e" ) ) ; assertThat ( object . get ( "phaseId" ) . getAsString ( ) , is ( "main" ) ) ; assertThat ( object . get ( "stageId" ) . getAsString ( ) , is (
7
<s> package com . asakusafw . vocabulary . operator ; import java . lang . annotation . Documented ; import java
8
<s> package org . rubypeople . rdt . refactoring . ui . pages ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . ModifyEvent ; import org . eclipse . swt . events . ModifyListener ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . layout . RowLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Group ; import org . rubypeople . rdt . refactoring . core . convertlocaltofield . LocalToFieldConverter ; import org . rubypeople . rdt . refactoring . ui . LabeledTextField ; import org . rubypeople . rdt . refactoring . util . NameValidator ; public class ConvertLocalToFieldPage extends RefactoringWizardPage { private static final String TITLE = Messages . ConvertTempToFieldPage_ConvertLocalVariableToField ; private LocalToFieldConverter converter ; private ConverterPageParameters pageParameters ; public ConvertLocalToFieldPage ( LocalToFieldConverter converter , ConverterPageParameters parameters ) { super ( TITLE ) ; this . converter = converter ; this . pageParameters = parameters ; } public void createControl ( Composite parent ) { Composite control = new Composite ( parent , SWT . None ) ; setControl ( control ) ; GridLayout layout = new GridLayout ( ) ; layout . numColumns = 1 ; layout . verticalSpacing = 8 ; control . setLayout ( layout ) ; final LabeledTextField labeledText = new LabeledTextField ( control , Messages . ConvertTempToFieldPage_FieldName , converter . getLocalVarName (
9
<s> package com . asakusafw . vocabulary . batch ; public class ListBatch extends BatchDescription { @ Override protected void describe ( ) { Work jf1 = run ( JobFlow1 . class ) . soon ( ) ; Work jf2 = run ( JobFlow2 . class ) . after
10
<s> package de . fuberlin . wiwiss . d2rq . functional_tests ; import junit . framework . TestCase ; import com . hp . hpl . jena . rdf . model . Property ; import com . hp . hpl . jena . rdf . model . RDFNode ; import com . hp . hpl . jena . rdf . model . Resource ; import com . hp . hpl . jena . rdf . model . Statement ; import com . hp . hpl . jena . rdf . model . StmtIterator ; import com . hp . hpl . jena
11
<s> package org . oddjob . arooa . types ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . ConsoleCapture ; import org . oddjob . Oddjob ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . state . ParentState ; public class ConvertTypeExamplesTest extends TestCase { private static final Logger logger = Logger . getLogger ( ConvertTypeExamplesTest . class ) ; public void testFruitExample ( ) { Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ) ; ConsoleCapture console = new ConsoleCapture ( ) ; console . capture ( Oddjob . CONSOLE ) ; oddjob . run ( ) ; assertEquals ( ParentState . COMPLETE , oddjob . lastStateEvent ( ) . getState ( ) ) ; console . close ( ) ; console . dump ( logger ) ; String [ ] lines = console . getLines ( ) ; assertEquals ( "grapes, red" ,
12
<s> package org . rubypeople . eclipse . shams . runtime ; import java . io . File ; import org . eclipse . core . runtime . IPath ; public class ShamIPath implements IPath { protected String path ; public ShamIPath ( String thePath ) { path = thePath ; } public IPath addFileExtension ( String extension ) { throw new RuntimeException ( "" ) ; } public IPath addTrailingSeparator ( ) { throw new RuntimeException ( "" ) ; } public IPath append ( String path ) { throw new RuntimeException ( "" ) ; } public IPath append ( IPath path ) { throw new RuntimeException ( "" ) ; } public Object clone ( ) { throw new RuntimeException ( "" ) ; } public String getDevice ( ) { throw new RuntimeException ( "" ) ; } public String getFileExtension ( ) { throw new RuntimeException ( "" ) ; } public boolean hasTrailingSeparator ( ) { throw new RuntimeException ( "" ) ; } public boolean isAbsolute ( ) { throw new RuntimeException ( "" ) ; } public boolean isEmpty ( ) { throw new RuntimeException ( "" ) ; } public boolean isPrefixOf ( IPath anotherPath ) { throw new RuntimeException ( "" ) ; } public boolean isRoot ( ) { throw new RuntimeException ( "" ) ; } public boolean isUNC ( ) { throw
13
<s> package com . asakusafw . utils . java . parser . javadoc ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . IrLocation ; public class JavadocParseException extends Exception { private static final long serialVersionUID = 1L ; private IrLocation location ; public JavadocParseException ( String message , IrLocation location , Throwable cause )
14
<s> package org . rubypeople . rdt . internal . debug . core . commands ; import org . rubypeople . rdt . internal . debug . core . parsing . AbstractReadStrategy ; import org . rubypeople
15
<s> package org . oddjob . jmx . server ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; public class AccumulatingFactoryProvider implements HandlerFactoryProvider { private List < HandlerFactoryProvider > providers = new ArrayList < HandlerFactoryProvider > ( ) ; public void addProvider ( HandlerFactoryProvider provider ) { providers . add ( provider ) ; }
16
<s> package com . asakusafw . runtime . io ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . OutputStreamWriter ; import java . nio . charset . Charset ; public class TsvIoFactory < T > extends ModelIoFactory < T > { private static final Charset CHARSET = Charset . forName
17
<s> package com . asakusafw . windgate . core . session ; import java . io . Closeable ; import java . io . IOException ; public abstract class SessionMirror implements Closeable { public abstract String getId ( ) ; public abstract void complete ( ) throws IOException ; public abstract void abort ( ) throws IOException ; @ Override public abstract void close ( ) throws IOException ; public static final class Null extends SessionMirror { private final String id ; public Null ( String id ) { if ( id == null ) { throw new IllegalArgumentException ( "" ) ; } this . id = id ; } @ Override public String
18
<s> package org . vaadin . teemu . clara . util ; import static org . junit . Assert . assertEquals ; import static org . junit . Assert . assertFalse ; import static org . junit . Assert . assertTrue ; import org . junit . Test ; import com . vaadin . ui . Button ; public class ReflectionUtilsTest { public static class ClassToExamine { public void setFooBar ( ) { } public void setFooBar ( String foo ) { } public void setFooBar ( int foo ) { } public void setFooBar ( String foo , int bar ) { } } @ Test public void test_getMethodsByNameAndParamCount ( ) { assertEquals ( 1 , ReflectionUtils . getMethodsByNameAndParamCount ( ClassToExamine . class , "setFooBar" , 0 ) . size ( ) ) ; assertEquals ( 2 , ReflectionUtils . getMethodsByNameAndParamCount ( ClassToExamine . class , "setFooBar" , 1 ) . size ( ) ) ; assertEquals ( 1 , ReflectionUtils . getMethodsByNameAndParamCount ( ClassToExamine . class , "setFooBar" , 2 ) . size ( ) ) ; assertEquals ( 0 , ReflectionUtils . getMethodsByNameAndParamCount ( ClassToExamine . class , "setFooBar" , 3 ) . size ( ) ) ; assertEquals ( 0
19
<s> package net . sf . sveditor . core . db . search ; import net . sf . sveditor . core . db . ISVDBNamedItem ; import net . sf . sveditor . core . db . SVDBItemType ; public class SVDBFindClassMatcher implements ISVDBFindNameMatcher
20
<s> package net . sf . sveditor . core . tests . parser ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . parser . SVParseException ; import junit . framework . TestCase ; public class TestParseBind extends TestCase { public void testBasicBind ( ) throws SVParseException { String testname = "" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; String doc = "module t;n" + "" + "endmodulen" ; ParserTests . runTestStrDoc ( testname , doc , new String [ ] { "m1" } ) ; } public void testHierarchicalBind ( ) throws SVParseException { String testname = "" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; String doc
21
<s> package org . rubypeople . rdt . internal . core ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . ResourcesPlugin ; public class RubyModelInfo extends OpenableElementInfo { Object [ ] nonRubyResources ; private Object [ ] computeNonRubyResources ( ) { IProject [ ] projects = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getProjects ( ) ; int length = projects . length ; Object [ ] resources = null ; int index = 0 ; for ( int i = 0 ; i < length ; i ++ ) { IProject project = projects [ i ] ; if ( ! RubyProject . hasRubyNature ( project ) ) { if ( resources
22
<s> package org . rubypeople . rdt . internal . debug . ui . rubyvms ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jface . resource . ImageDescriptor ; import org . eclipse . jface . viewers . LabelProvider ; import org . eclipse . swt . graphics . Image ; import org . rubypeople . rdt . internal . debug .
23
<s> package com . asakusafw . compiler . flow . processor . flow ; import com . asakusafw . compiler . flow . processor . ExtractFlowProcessor ; import com . asakusafw . compiler . flow . processor . operator . ExtractFlowFactory ; import com . asakusafw . compiler . flow . processor . operator . ExtractFlowFactory . WithParameter ; import com . asakusafw . compiler . flow . testing . external . Ex1MockImporterDescription ; import com . asakusafw . compiler . flow . testing . external . Ex2MockExporterDescription ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . model . Ex2 ; import com . asakusafw . vocabulary . flow . Export ; import com . asakusafw . vocabulary . flow . FlowDescription ; import com . asakusafw . vocabulary . flow . Import ; import com . asakusafw . vocabulary . flow . In ; import com . asakusafw . vocabulary . flow . JobFlow ; import com . asakusafw . vocabulary . flow . Out ; @ JobFlow ( name = "testing" ) public class ExtractFlowWithParameter extends FlowDescription {
24
<s> package org . rubypeople . rdt . refactoring . tests . core . generateconstructor ; import junit . framework . Test ; import junit . framework . TestSuite ; import org .
25
<s> package org . rubypeople . rdt . refactoring . ui . pages . extractmethod ; import org . eclipse . swt . SWT ; import org . eclipse . swt . widgets . Table ; import org . eclipse . swt . widgets
26
<s> package org . oddjob . state ; import junit . framework . TestCase ; public class WorstStateOpTest extends TestCase { public void testEvaluateSingleOp ( ) { WorstStateOp test = new WorstStateOp ( ) ; assertEquals ( ParentState . READY , test . evaluate ( JobState . READY ) ) ; assertEquals ( ParentState . ACTIVE , test . evaluate ( JobState . EXECUTING ) ) ; assertEquals ( ParentState . EXCEPTION , test . evaluate ( JobState . EXCEPTION ) ) ; assertEquals ( ParentState . INCOMPLETE , test . evaluate ( JobState . INCOMPLETE ) ) ; assertEquals ( ParentState . COMPLETE , test . evaluate ( JobState . COMPLETE ) ) ; } public void testEvaluateTwoOps ( ) { WorstStateOp test = new WorstStateOp ( ) ; assertEquals ( ParentState . READY , test . evaluate ( JobState . READY , JobState . READY ) ) ; assertEquals ( ParentState . ACTIVE , test . evaluate ( JobState . READY , JobState . EXECUTING ) ) ; assertEquals ( ParentState . READY , test . evaluate ( JobState . READY , JobState . COMPLETE ) ) ; assertEquals ( ParentState . INCOMPLETE , test . evaluate ( JobState . READY , JobState . INCOMPLETE ) ) ; assertEquals ( ParentState . EXCEPTION , test . evaluate ( JobState . READY , JobState . EXCEPTION ) ) ; assertEquals ( ParentState . ACTIVE , test . evaluate ( JobState . EXECUTING , JobState . READY ) ) ; assertEquals ( ParentState . ACTIVE , test . evaluate ( JobState . EXECUTING , JobState . EXECUTING ) ) ; assertEquals ( ParentState . ACTIVE , test . evaluate ( JobState . EXECUTING , JobState . COMPLETE ) ) ; assertEquals ( ParentState . ACTIVE , test . evaluate ( JobState . EXECUTING , JobState . INCOMPLETE ) ) ; assertEquals ( ParentState . ACTIVE , test . evaluate ( JobState . EXECUTING , JobState . EXCEPTION ) ) ; assertEquals ( ParentState . INCOMPLETE , test . evaluate ( JobState . INCOMPLETE , JobState . READY ) ) ; assertEquals ( ParentState . ACTIVE , test . evaluate ( JobState . INCOMPLETE , JobState . EXECUTING ) ) ; assertEquals ( ParentState . INCOMPLETE , test . evaluate ( JobState . INCOMPLETE , JobState . COMPLETE ) ) ; assertEquals ( ParentState . INCOMPLETE , test . evaluate ( JobState . INCOMPLETE , JobState . INCOMPLETE ) ) ; assertEquals ( ParentState . EXCEPTION , test . evaluate ( JobState . INCOMPLETE , JobState . EXCEPTION ) ) ; assertEquals ( ParentState . READY , test . evaluate ( JobState . COMPLETE , JobState . READY ) ) ; assertEquals ( ParentState . ACTIVE , test . evaluate ( JobState . COMPLETE , JobState . EXECUTING ) ) ; assertEquals ( ParentState . COMPLETE , test . evaluate ( JobState . COMPLETE , JobState . COMPLETE ) ) ; assertEquals ( ParentState . INCOMPLETE , test . evaluate ( JobState . COMPLETE , JobState .
27
<s> package com . asakusafw . testdriver . core ; import java . io . IOException ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . vocabulary . external . ImporterDescription ; public class MockImporterPreparator extends AbstractImporterPreparator < MockImporterPreparator . Desc > { public static Desc create ( ) { return new Desc ( ) ; } public SpiImporterPreparator wrap ( ) { return new SpiImporterPreparator (
28
<s> package com . asakusafw . compiler . operator ; import javax . lang . model . element . AnnotationMirror ; import javax . lang . model . element . ExecutableElement ; import com . asakusafw . compiler . common . Precondition ; public class OperatorMethod { private ExecutableElement element ; private OperatorProcessor processor ; public OperatorMethod ( ExecutableElement element , OperatorProcessor processor ) { Precondition . checkMustNotBeNull ( element , "element" ) ; Precondition . checkMustNotBeNull ( processor , "processor" ) ; this .
29
<s> package org . rubypeople . rdt . ui . actions ; import java . util . Map ; import org . eclipse . core . filebuffers . FileBuffers ; import org . eclipse . core . filebuffers . ITextFileBufferManager ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . core . runtime . Status ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . ITextSelection ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . formatter . Indents ; import org . rubypeople . rdt . internal . corext . util . RubyModelUtil ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . actions . ActionMessages ; import org . rubypeople . rdt . internal . ui . actions . SelectionConverter ; import org . rubypeople . rdt . internal . ui . rubyeditor . RubyEditor ; import org . rubypeople . rdt . internal . ui . util . ExceptionHandler ; public class SurroundWithBeginRescueAction extends SelectionDispatchAction { public static final String SURROUND_WTH_BEGIN_RESCUE = "" ; private RubyEditor fEditor ; public SurroundWithBeginRescueAction ( RubyEditor editor ) { super ( editor . getEditorSite ( ) ) ; setText ( ActionMessages . SurroundWithBeginRescueAction_label ) ; fEditor = editor ; setEnabled ( ( fEditor != null && SelectionConverter . getInputAsRubyScript ( fEditor ) != null ) ) ; PlatformUI . getWorkbench ( ) . getHelpSystem ( ) . setHelp ( this
30
<s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . ImportTarget2 ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public final class ImportTarget2ModelOutput implements ModelOutput < ImportTarget2 > { private final RecordEmitter emitter ; public ImportTarget2ModelOutput ( RecordEmitter emitter ) { if ( emitter == null ) { throw new IllegalArgumentException ( ) ; } this . emitter = emitter ; } @ Override public void write ( ImportTarget2 model ) throws IOException { emitter . emit ( model . getSidOption ( ) ) ; emitter . emit ( model . getVersionNoOption ( ) ) ; emitter
31
<s> package net . ggtools . grand . ui . graph . draw2d ; import java . io . File ; import java . util . Collection ; import java . util . Iterator ; import java . util . Map ; import net . ggtools . grand . ui . Application ; import net . ggtools . grand . ui . graph . DotGraphAttributes ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . eclipse . draw2d . FigureUtilities ; import org . eclipse . draw2d . Label ; import org . eclipse . draw2d . geometry . Dimension ; import org . eclipse . draw2d . text . BlockFlow ; import org . eclipse . draw2d . text . FlowPage ; import org . eclipse . draw2d . text . InlineFlow ; import org . eclipse . draw2d . text . TextFlow ; import org . eclipse . swt . graphics . Font ; import sf . jzgraph . IEdge ; public class LinkTooltip extends AbstractGraphTooltip implements DotGraphAttributes { private static final String ELLIPSIS = "..." ; private static final Log log = LogFactory . getLog ( LinkTooltip . class ) ; private final IEdge edge ; public LinkTooltip ( final IEdge edge ) { super ( ) ; this . edge = edge ; createContents ( ) ; } @ Override protected void createContents ( ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "" ) ; } final Label type ; if ( edge . hasAttr ( LINK_TASK_ATTR ) ) { type = new Label ( edge . getAttrAsString ( LINK_TASK_ATTR ) , Application . getInstance ( ) . getImage ( Application . LINK_ICON ) ) ; } else { type = new Label ( "depency" , Application . getInstance ( ) . getImage ( Application . LINK_ICON ) ) ; } type . setFont ( Application . getInstance ( ) . getBoldFont ( Application . TOOLTIP_FONT ) ) ; add ( type ) ; final Font italicMonospaceFont = Application . getInstance ( ) . getItalicFont ( Application . TOOLTIP_MONOSPACE_FONT ) ; final Font monospaceFont = Application . getInstance ( ) . getFont ( Application . TOOLTIP_MONOSPACE_FONT ) ; final FlowPage page = createFlowPage ( ) ; BlockFlow blockFlow = new BlockFlow ( ) ; TextFlow textFlow = new TextFlow ( "From: " ) ; blockFlow . add ( textFlow ) ; InlineFlow inline = new InlineFlow ( ) ; textFlow = new TextFlow ( edge . getTail ( ) . getName ( ) ) ; textFlow . setFont ( italicMonospaceFont ) ; inline . add ( textFlow ) ; blockFlow . add ( inline ) ; blockFlow . setBorder ( new SectionBorder ( ) ) ; page . add ( blockFlow ) ; blockFlow = new BlockFlow ( ) ; textFlow = new TextFlow ( "To: " ) ; blockFlow . add ( textFlow ) ; inline = new InlineFlow ( ) ; textFlow = new TextFlow ( edge . getHead ( ) . getName ( ) ) ; textFlow . setFont ( italicMonospaceFont ) ; inline . add ( textFlow ) ; blockFlow . add ( inline ) ; page . add ( blockFlow ) ; if ( ! "" . equals ( edge . getName ( ) ) ) { blockFlow = new BlockFlow ( ) ; textFlow = new TextFlow ( "Link #" + edge . getName ( ) ) ; blockFlow . add ( textFlow ) ; page . add ( blockFlow ) ; } if ( edge . hasAttr ( LINK_PARAMETERS_ATTR ) ) { final Map parameters = ( Map ) edge . getAttr ( LINK_PARAMETERS_ATTR ) ; if ( ! parameters . isEmpty ( ) ) { final BlockFlow outterBlock = new BlockFlow ( ) ; for ( final Iterator iter = parameters . entrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { final Map . Entry entry = ( Map . Entry ) iter . next ( ) ; final BlockFlow innerBlock = new BlockFlow ( ) ; textFlow = new TextFlow ( ( ( String ) entry . getKey ( ) ) + ": " ) ; textFlow . setFont ( monospaceFont ) ; innerBlock . add ( textFlow ) ; inline = new InlineFlow ( ) ; textFlow = new TextFlow ( ( String ) entry . getValue ( ) ) ; textFlow . setFont ( italicMonospaceFont ) ; inline . add ( textFlow ) ; innerBlock . add ( inline ) ; outterBlock . add
32
<s> package org . oddjob . state ; import java . io . File ; import java . io . IOException ; import java . util . Properties ; import junit . framework . TestCase ; import org . apache . commons . io . FileUtils ; import org . apache . log4j . Logger ; import org . oddjob . ConsoleCapture ; import org . oddjob . FailedToStopException ; import org . oddjob . Helper ; import org . oddjob . Oddjob ; import org . oddjob . OurDirs ; import org . oddjob . StateSteps ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . framework . SimpleJob ; import org . oddjob . jobs . WaitJob ; public class IfJobTest extends TestCase { private static final Logger logger = Logger . getLogger ( IfJobTest . class ) ; @ Override protected void setUp ( ) throws Exception { super . setUp ( ) ; logger . info ( "" + getName ( ) + "" ) ; } public void testIfOnlyJobComplete ( ) { FlagState child = new FlagState ( ) ; child . setState ( JobState . COMPLETE ) ; IfJob test = new IfJob ( ) ; test . setJobs ( 0 , child ) ; test . run ( ) ; assertEquals ( ParentState . COMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; test . hardReset ( ) ; assertEquals ( ParentState . READY , test . lastStateEvent ( ) . getState ( ) ) ; } public void testIfOnlyJobNotComplete ( ) { FlagState child = new FlagState ( ) ; child . setState ( JobState . INCOMPLETE ) ; IfJob test = new IfJob ( ) ; test . setJobs ( 0 , child ) ; test . run ( ) ; assertEquals ( ParentState . COMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; test . hardReset ( ) ; assertEquals ( ParentState . READY , test . lastStateEvent ( ) . getState ( ) ) ; } public void testIfOnlyJobException ( ) { FlagState child = new FlagState ( ) ; child . setState ( JobState . EXCEPTION ) ; IfJob test = new IfJob ( ) ; test . setJobs ( 0 , child ) ; test . run ( ) ; assertEquals ( ParentState . COMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; test . hardReset ( ) ; assertEquals ( ParentState . READY , test . lastStateEvent ( ) . getState ( ) ) ; } class OurJob extends SimpleJob { private JobState desired ; private int count ; protected int execute ( ) throws Exception { ++ count ; if ( desired . equals ( JobState . COMPLETE ) ) { return 0 ; } if ( desired . equals ( JobState . INCOMPLETE ) ) { return 1 ; } throw new Exception ( "" ) ; } public void setDesired ( JobState desired ) { this . desired = desired ; } } public void testThen1 ( ) throws IOException , ClassNotFoundException { FlagState depends = new FlagState ( ) ; depends . setState ( JobState . COMPLETE ) ; depends . run ( ) ; OurJob then = new OurJob ( ) ; then . setDesired ( JobState . COMPLETE ) ; IfJob test = new IfJob ( ) ; test . setJobs ( 0 , depends ) ; test . setJobs ( 1 , then ) ; test . run ( ) ; assertEquals ( JobState . COMPLETE , then . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( ParentState . COMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; IfJob copy = ( IfJob ) Helper . copy ( test ) ; copy . setJobs ( 0 , depends ) ; copy . setJobs ( 1 , then ) ; assertEquals ( ParentState . COMPLETE , copy . lastStateEvent ( ) . getState ( ) ) ; copy . hardReset ( ) ; copy . run ( ) ; assertEquals ( ParentState . COMPLETE , copy . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( 2 , then . count ) ; then . hardReset ( ) ; assertEquals ( ParentState . READY , copy . lastStateEvent ( ) . getState ( ) ) ; } public void testThen2 ( ) { FlagState depends = new FlagState ( ) ; depends . setState ( JobState . COMPLETE ) ; depends . run ( ) ; FlagState then = new FlagState ( ) ; then . setState ( JobState . INCOMPLETE ) ; IfJob test = new IfJob ( ) ; test . setJobs ( 0 , depends ) ; test . setJobs ( 1 , then ) ; test . run ( ) ; assertEquals ( ParentState . INCOMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; } public void testThen3 ( ) { FlagState depends = new FlagState ( ) ; depends . setState ( JobState . COMPLETE ) ; FlagState then = new FlagState ( ) ; then . setState ( JobState . EXCEPTION ) ; IfJob test = new IfJob ( ) ; test . setJobs ( 0 , depends ) ; test . setJobs ( 1 , then ) ; test . run ( ) ; assertEquals ( ParentState . EXCEPTION , test . lastStateEvent ( ) . getState ( ) ) ; then . softReset ( ) ; assertEquals ( ParentState . READY , test . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( JobState . COMPLETE , depends . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( JobState . READY , then . lastStateEvent ( ) . getState ( ) ) ; depends . hardReset ( ) ; assertEquals ( JobState . READY , depends . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( ParentState . COMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; test . hardReset ( ) ; assertEquals ( ParentState . READY , test . lastStateEvent ( ) . getState ( ) ) ; } public void testNotThen ( ) { FlagState depends = new FlagState ( ) ; depends . setState ( JobState . COMPLETE ) ; depends . run ( ) ; FlagState then = new FlagState ( ) ; then . setState ( JobState . EXCEPTION ) ; IfJob test = new IfJob ( ) ; test . setState ( new IsNot ( StateConditions . COMPLETE ) ) ; test . setJobs ( 0 , depends ) ; test . setJobs ( 1 , then ) ; test . run ( ) ; assertEquals ( JobState . COMPLETE , depends . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( JobState . READY , then . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( ParentState . COMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; } public void testNotThen2 ( ) { FlagState depends = new FlagState ( ) ; depends . setState ( JobState . COMPLETE ) ; depends . run ( ) ; FlagState then = new FlagState ( ) ; then . setState ( JobState . EXCEPTION ) ; IfJob test = new IfJob ( ) ; test . setState ( StateConditions . INCOMPLETE ) ; test . setJobs ( 0 , depends ) ; test . setJobs ( 1 , then ) ; test . run ( ) ; assertEquals ( JobState . COMPLETE , depends . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( JobState . READY , then . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( ParentState . COMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; } public void testElse1 ( ) { FlagState depends = new FlagState ( ) ; depends . setState ( JobState . INCOMPLETE ) ; depends . setName ( "Depends On" ) ; FlagState then = new FlagState ( JobState . EXCEPTION ) ; then . setName ( "" ) ; OurJob elze = new OurJob ( ) ; elze . setDesired ( JobState . COMPLETE ) ; IfJob test = new IfJob ( ) ; test . setJobs ( 0 , depends ) ; test . setJobs ( 1 , then ) ; test . setJobs ( 2 , elze ) ; test . run ( ) ; assertEquals ( ParentState . COMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; test . hardReset ( ) ; elze . setDesired ( JobState . INCOMPLETE ) ; test . run ( ) ; assertEquals ( ParentState . INCOMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( 2 , elze . count ) ; test . softReset ( ) ; assertEquals ( ParentState . READY , test . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( JobState . READY , elze . lastStateEvent ( ) . getState ( ) ) ; } public void testElse2 ( ) { FlagState depends = new FlagState ( ) ; depends . setState ( JobState . INCOMPLETE ) ; depends . run ( ) ; FlagState then = new FlagState ( JobState . EXCEPTION ) ; then . setName ( "" ) ; FlagState elze = new FlagState ( ) ; elze . setState ( JobState . COMPLETE ) ; IfJob test = new IfJob ( ) ; test . setJobs ( 0 , depends ) ; test . setJobs ( 1 , then ) ; test . setJobs ( 2 , elze ) ; test . run ( ) ; assertEquals ( ParentState . COMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; } public void testElse3 ( ) { FlagState depends = new FlagState ( ) ; depends . setState ( JobState . EXCEPTION ) ; depends . run ( ) ; FlagState then = new FlagState ( JobState . COMPLETE ) ; then . setName ( "" ) ; FlagState elze = new FlagState ( ) ; elze . setState (
33
<s> package org . rubypeople . rdt . internal . ui . dialogs ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jface . dialogs . IDialogConstants ; import org . eclipse . jface . viewers . CheckStateChangedEvent ; import org . eclipse . jface . viewers . CheckboxTreeViewer ; import org . eclipse . jface . viewers . ICheckStateListener ; import org . eclipse . jface . viewers . ILabelProvider ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . ViewerFilter ; import org . eclipse . jface . viewers . ViewerSorter ; import org . eclipse . swt . SWT ; import org . eclipse . swt . custom . BusyIndicator ; import org . eclipse . swt . events . SelectionAdapter ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . swt . widgets . Tree ; import org . rubypeople . rdt . internal . ui . viewsupport . ContainerCheckedTreeViewer ; public class CheckedTreeSelectionDialog extends SelectionStatusDialog { private CheckboxTreeViewer fViewer ; private ILabelProvider fLabelProvider ; private ITreeContentProvider fContentProvider ; private ISelectionValidator fValidator = null ; private ViewerSorter fSorter ; private String fEmptyListMessage = "" ; private IStatus fCurrStatus = new StatusInfo ( ) ; private List fFilters ; private Object fInput ; private boolean fIsEmpty ; private int fWidth = 60 ; private int fHeight = 18 ; private boolean fContainerMode ; private Object [ ] fExpandedElements ; public CheckedTreeSelectionDialog ( Shell parent , ILabelProvider labelProvider , ITreeContentProvider contentProvider ) { super ( parent ) ; fLabelProvider = labelProvider ; fContentProvider = contentProvider ; setResult ( new ArrayList ( 0 ) ) ; setStatusLineAboveButtons ( true ) ; fContainerMode = false ; fExpandedElements = null ; int shellStyle = getShellStyle ( ) ; setShellStyle ( shellStyle | SWT . MAX | SWT . RESIZE ) ; } public void setContainerMode ( boolean containerMode ) { fContainerMode = containerMode ; } public void setInitialSelection ( Object selection ) { setInitialSelections ( new Object [ ] { selection } ) ; } public void setEmptyListMessage ( String message ) { fEmptyListMessage = message ; } public void setSorter ( ViewerSorter sorter ) { fSorter = sorter ; } public void addFilter ( ViewerFilter filter ) { if ( fFilters == null ) fFilters = new ArrayList ( 4 ) ; fFilters . add ( filter ) ; } public void setValidator ( ISelectionValidator validator ) { fValidator = validator ; } public void setInput ( Object input ) { fInput = input ; } public void setExpandedElements ( Object [ ] elements ) { fExpandedElements = elements ; } public void setSize ( int width , int height ) { fWidth = width ; fHeight = height ; } protected void updateOKStatus ( ) { if ( ! fIsEmpty ) { if ( fValidator != null ) { fCurrStatus = fValidator . validate ( fViewer . getCheckedElements ( ) ) ; updateStatus ( fCurrStatus ) ; } else if ( ! fCurrStatus . isOK ( ) ) { fCurrStatus = new StatusInfo ( ) ; } } else { fCurrStatus = new StatusInfo ( IStatus . ERROR , fEmptyListMessage ) ; } updateStatus ( fCurrStatus ) ; } public int open ( ) { fIsEmpty = evaluateIfTreeEmpty ( fInput ) ; BusyIndicator . showWhile ( null , new Runnable ( ) { public void run ( ) { access$superOpen ( ) ; } } ) ; return getReturnCode ( ) ; } private void access$superOpen ( ) { super . open ( ) ; } protected void cancelPressed ( ) { setResult ( null ) ; super . cancelPressed ( ) ; } protected void computeResult ( ) { setResult ( Arrays . asList ( fViewer . getCheckedElements ( ) ) ) ; } public void create ( ) { super . create ( ) ; List initialSelections = getInitialElementSelections ( ) ; if ( initialSelections != null ) { fViewer . setCheckedElements ( initialSelections . toArray ( ) ) ; } if ( fExpandedElements != null ) { fViewer . setExpandedElements ( fExpandedElements ) ; } updateOKStatus ( ) ; } protected Control createDialogArea ( Composite parent ) { Composite composite = ( Composite ) super . createDialogArea ( parent ) ; Label messageLabel = createMessageArea ( composite ) ; Control treeWidget = createTreeViewer ( composite ) ; Control buttonComposite = createSelectionButtons ( composite ) ; GridData data = new GridData ( GridData . FILL_BOTH ) ; data . widthHint = convertWidthInCharsToPixels ( fWidth ) ; data . heightHint = convertHeightInCharsToPixels ( fHeight ) ; treeWidget . setLayoutData ( data ) ; if ( fIsEmpty ) { messageLabel . setEnabled ( false ) ; treeWidget . setEnabled ( false ) ; buttonComposite . setEnabled ( false ) ; } return composite ; } private Tree createTreeViewer ( Composite
34
<s> package com . asakusafw . compiler . operator ; import java . util . EnumSet ; import java . util . Set ; import com . asakusafw . utils . java . model . syntax . Attribute ; import com . asakusafw . utils . java . model . syntax . ConstructorDeclaration ; import com . asakusafw . utils . java . model . syntax . FieldDeclaration ; import com . asakusafw . utils . java . model . syntax . MethodDeclaration ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . Modifier ; import com . asakusafw . utils . java . model . syntax . ModifierKind ; import com . asakusafw . utils . java . model . syntax . TypeBodyDeclaration ; import com . asakusafw . utils . java . model . syntax . TypeDeclaration ; import com . asakusafw . utils . java
35
<s> package com . asakusafw . compiler . operator . processor ; import java . util . List ; import javax . lang . model . type . TypeMirror ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . common . TargetOperator ; import com . asakusafw . compiler . operator . AbstractOperatorProcessor ; import com . asakusafw . compiler . operator . ExecutableAnalyzer ; import com . asakusafw . compiler . operator . ExecutableAnalyzer . TypeConstraint ; import com . asakusafw . compiler . operator . OperatorMethodDescriptor ; import com . asakusafw . compiler . operator . OperatorMethodDescriptor . Builder ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . vocabulary . flow . graph . FlowBoundary ; import com . asakusafw . vocabulary . flow . graph . ShuffleKey ; import com . asakusafw . vocabulary . operator . CoGroup ; @ TargetOperator ( CoGroup . class ) public class CoGroupOperatorProcessor extends AbstractOperatorProcessor { @ Override public OperatorMethodDescriptor describe ( Context context ) { Precondition . checkMustNotBeNull ( context , "context" ) ; ExecutableAnalyzer a = new ExecutableAnalyzer ( context . environment , context . element ) ; if ( a . isAbstract ( ) ) { a . error ( "" ) ; } if ( a . getReturnType ( ) . isVoid ( ) == false ) { a . error ( "" ) ; } int startResults
36
<s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . ImportRecordLock ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . RecordParser ; @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public final class ImportRecordLockModelInput implements ModelInput < ImportRecordLock > { private final RecordParser parser ; public ImportRecordLockModelInput ( RecordParser parser ) { if ( parser ==
37
<s> package com . asakusafw . compiler . yaess ; import java . io . File ; import java . io . IOException ; import java . io . OutputStream ; import java . text . MessageFormat ; import java . util . Collection ; import java . util . Collections ; import java . util . Comparator ; import java . util . List ; import java . util . Map ; import java . util . Properties ; import java . util . Set ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . batch . AbstractWorkflowProcessor ; import com . asakusafw . compiler . batch . WorkDescriptionProcessor ; import com . asakusafw . compiler . batch . Workflow ; import com . asakusafw . compiler . batch . WorkflowProcessor ; import com . asakusafw . compiler . batch . processor . JobFlowWorkDescriptionProcessor ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . ExternalIoCommandProvider ; import com . asakusafw . compiler . flow . ExternalIoCommandProvider . Command ; import com . asakusafw . compiler . flow . ExternalIoCommandProvider . CommandContext ; import com . asakusafw . compiler . flow . jobflow . CompiledStage ; import com . asakusafw . compiler . flow . jobflow . JobflowModel ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Maps ; import com . asakusafw . utils . collections . Sets ; import com . asakusafw . utils . graph . Graph ; import com . asakusafw . utils . graph . Graph . Vertex ; import com . asakusafw . vocabulary . batch . JobFlowWorkDescription ; import com . asakusafw . yaess . core . BatchScript ; import com . asakusafw . yaess . core . CommandScript ; import com . asakusafw . yaess . core . ExecutionPhase ; import com . asakusafw . yaess . core . ExecutionScript ; import com . asakusafw . yaess . core . FlowScript ; import com . asakusafw . yaess . core . HadoopScript ; public class YaessWorkflowProcessor extends AbstractWorkflowProcessor { static final Logger LOG = LoggerFactory . getLogger ( YaessWorkflowProcessor . class ) ; public static final String PATH = "" ; public static File getScriptOutput ( File outputDir ) { Precondition . checkMustNotBeNull ( outputDir , "outputDir" ) ; return new File ( outputDir , PATH ) ; } @ Override public Collection < Class < ? extends WorkDescriptionProcessor < ? > > > getDescriptionProcessors ( ) { List < Class < ? extends WorkDescriptionProcessor < ? > > > results = Lists . create ( ) ; results . add ( JobFlowWorkDescriptionProcessor . class ) ; return results ; } @ Override public void process ( Workflow workflow ) throws IOException { LOG . debug ( "" ) ; List < FlowScript > scripts = processJobflowList ( workflow ) ; LOG . debug ( "" ) ; Properties properties = new Properties ( ) ; properties . setProperty ( BatchScript . KEY_ID , getBatchId ( ) ) ; properties . setProperty ( BatchScript . KEY_VERSION , BatchScript . VERSION ) ; properties . setProperty ( BatchScript . KEY_VERIFICATION_CODE , getEnvironment ( ) . getBuildId ( ) ) ; for ( FlowScript script : scripts ) { LOG . trace ( "" , script . getId ( ) ) ; script . storeTo ( properties ) ; } LOG . debug ( "" ) ; OutputStream output = getEnvironment ( ) . openResource ( PATH ) ; try { properties . store ( output , MessageFormat . format ( "" , getBatchId ( ) , BatchScript . VERSION ) ) ; } finally { output . close ( ) ; } LOG . debug ( "" ) ; } private List < FlowScript > processJobflowList ( Workflow workflow ) { assert workflow != null ; List < FlowScript > jobflows = Lists . create ( ) ; for ( Graph . Vertex < Workflow . Unit > vertex : sortJobflow ( workflow . getGraph ( ) ) ) { FlowScript jobflow = processJobflow ( vertex . getNode ( ) , vertex . getConnected ( ) ) ; jobflows . add ( jobflow ) ; } return jobflows ; } private List < Graph . Vertex < JobflowModel . Stage > > sortStage ( Iterable < Graph . Vertex < JobflowModel . Stage > > vertices ) { assert vertices != null ; List < Graph . Vertex < JobflowModel . Stage > > results = Lists . create ( ) ; for ( Graph . Vertex < JobflowModel . Stage > vertex : vertices ) { results . add ( vertex ) ; } Collections . sort ( results , new Comparator < Graph . Vertex < JobflowModel . Stage > > ( ) { @ Override public int compare ( Vertex < JobflowModel . Stage > o1 , Vertex < JobflowModel . Stage > o2 ) { int stage1 = o1 . getNode ( ) . getNumber ( ) ; int stage2 = o2 . getNode ( ) . getNumber ( ) ; if ( stage1 < stage2 ) { return - 1 ; } else if ( stage1 > stage2 ) { return + 1 ; } else { return 0 ; } } } ) ; return results ; } private List < Graph . Vertex < Workflow . Unit > > sortJobflow ( Iterable < Graph . Vertex < Workflow . Unit > > vertices ) { assert vertices != null ; List < Graph . Vertex < Workflow . Unit > > results = Lists . create ( ) ; for ( Graph . Vertex < Workflow . Unit > vertex : vertices ) { results . add ( vertex ) ; } Collections . sort ( results , new Comparator < Graph . Vertex < Workflow . Unit > > ( ) { @ Override public int compare ( Vertex < Workflow . Unit > o1 , Vertex < Workflow . Unit > o2 ) { return o1 . getNode ( ) . getDescription ( ) . getName ( ) . compareTo ( o2 . getNode ( ) . getDescription ( ) . getName ( ) ) ; } } ) ; return results ; } private FlowScript processJobflow ( Workflow . Unit unit , Set < Workflow . Unit > blockers ) { assert unit != null ; assert blockers != null ; JobflowModel model = toJobflowModel ( unit ) ; CommandContext context = new CommandContext ( ExecutionScript . PLACEHOLDER_HOME + '/' , ExecutionScript . PLACEHOLDER_EXECUTION_ID , ExecutionScript . PLACEHOLDER_ARGUMENTS ) ; Map < ExecutionPhase , List < ExecutionScript > > scripts = Maps . create ( ) ; scripts . put ( ExecutionPhase . INITIALIZE , processInitializers ( model , context ) ) ; scripts . put ( ExecutionPhase . IMPORT , processImporters ( model , context ) ) ; scripts . put ( ExecutionPhase . PROLOGUE , processPrologues ( model , context ) ) ; scripts . put ( ExecutionPhase . MAIN , processMain ( model , context ) ) ; scripts . put ( ExecutionPhase . EPILOGUE , processEpilogues ( model , context ) ) ; scripts . put ( ExecutionPhase . EXPORT , processExporters ( model , context ) ) ; scripts . put ( ExecutionPhase . FINALIZE , processFinalizers ( model , context ) ) ; return new FlowScript ( model . getFlowId ( ) , toUnitNames ( blockers ) , scripts ) ; } private List < ExecutionScript > processInitializers ( JobflowModel model , CommandContext context ) { assert model != null ; assert context != null ; List < ExecutionScript > results = Lists . create ( ) ; for ( ExternalIoCommandProvider provider : model . getCompiled ( ) . getCommandProviders ( ) ) { List < Command > commands = provider . getInitializeCommand ( context ) ; List < ExecutionScript > scripts = processCommands ( provider , commands ) ; results . addAll ( scripts ) ; } return results ; } private List < ExecutionScript > processImporters ( JobflowModel model , CommandContext context ) { assert model != null ; assert context != null ; List < ExecutionScript > results = Lists . create ( ) ; for ( ExternalIoCommandProvider provider : model . getCompiled ( ) . getCommandProviders ( ) ) { List < ExecutionScript > scripts = processCommands ( provider , provider . getImportCommand ( context ) ) ; results . addAll ( scripts ) ; } return results ; } private List < ExecutionScript > processExporters ( JobflowModel model , CommandContext context ) { assert model != null ; assert context != null ; List < ExecutionScript > results = Lists . create ( ) ; for ( ExternalIoCommandProvider provider : model . getCompiled ( ) . getCommandProviders ( ) ) { List < ExecutionScript > scripts = processCommands ( provider , provider . getExportCommand ( context ) ) ; results . addAll ( scripts ) ; } return results ; } private List < ExecutionScript > processFinalizers ( JobflowModel model , CommandContext context ) { assert model != null ; assert context != null ; List < ExecutionScript > results = Lists . create ( ) ; for ( ExternalIoCommandProvider provider : model . getCompiled ( ) . getCommandProviders ( ) ) { List < ExecutionScript > scripts = processCommands ( provider , provider . getFinalizeCommand ( context ) ) ; results . addAll ( scripts ) ; } return results ; } private List < ExecutionScript > processCommands ( ExternalIoCommandProvider provider , List < Command > commands ) { assert provider != null ; assert commands != null ; List < ExecutionScript > scripts = Lists . create ( ) ; String prefix = provider . getName ( ) ; int index = 0 ; for ( Command command : commands ) { String id = String . format ( "%s%s%04d" , prefix , '.' , index ++ ) ; String profile = command . getProfileName ( ) ; scripts . add ( new CommandScript ( id , Collections . < String > emptySet ( ) , profile == null ? CommandScript . DEFAULT_PROFILE_NAME : profile , command . getModuleName ( ) , command .
38
<s> package org . rubypeople . rdt . internal . debug . core . model ; import org . eclipse . debug . core . DebugEvent ; import org . eclipse . debug . core . DebugException ; import org . eclipse . debug . core . DebugPlugin ; import org . eclipse . debug . core . model . IRegisterGroup ; import org . eclipse . debug . core . model . IThread ; import org . eclipse . debug . core . model . IVariable ; import org . rubypeople . rdt . debug . core . model . IEvaluationResult ; import org . rubypeople . rdt . debug . core . model . IRubyStackFrame ; import org . rubypeople . rdt . internal . debug . core . RubyDebuggerProxy ; public class RubyStackFrame extends RubyDebugElement implements IRubyStackFrame { private RubyThread thread ; private String file ; private int lineNumber ; private int index ; private RubyVariable [ ] variables ; public RubyStackFrame ( RubyThread thread , String file , int line , int index ) { super ( thread . getDebugTarget ( ) ) ; this . lineNumber = line ; this . index = index ; this . file = file ; this . thread = thread ; } public IThread getThread ( ) { return thread ; } public void setThread ( RubyThread thread ) { this . thread = thread ; } public IVariable [ ] getVariables ( ) throws DebugException { if ( variables == null ) { variables = this . getRubyDebuggerProxy ( ) . readVariables ( this ) ; } return variables ; } public boolean hasVariables ( ) throws DebugException { return getVariables ( ) . length > 0 ; } public int
39
<s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . ExportTempImportTarget21Df ; import com . asakusafw . runtime . io . ModelInput ;
40
<s> package com . aptana . rdt . internal . launching ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . resources . IWorkspaceDescription ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . Status ; import org . eclipse . core . runtime . jobs . Job ; import org . rubypeople . rdt . core . LoadpathVariableInitializer ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . util . Util ; import org . rubypeople . rdt . internal . launching . LaunchingPlugin ; import org . rubypeople . rdt . launching . IVMInstall ; import org . rubypeople . rdt . launching . IVMInstallChangedListener ; import org . rubypeople . rdt . launching . PropertyChangeEvent ; import org . rubypeople . rdt . launching . RubyRuntime ; import com . aptana . rdt . AptanaRDTPlugin ; import com . aptana . rdt . core . gems . IGemManager ; import com . aptana . rdt . launching . IGemRuntime ; public class GemLoadpathVariablesInitializer extends LoadpathVariableInitializer implements IVMInstallChangedListener { private static final String LEOPARD_GEM_PATH_1 = "" ; private static final String LEOPARD_GEM_PATH_2 = "" ; private IProgressMonitor fMonitor ; public GemLoadpathVariablesInitializer ( ) { RubyRuntime . addVMInstallChangedListener ( this ) ; } @ Override public void initialize ( final String variable ) { if ( ! variable . equals ( IGemRuntime . GEMLIB_VARIABLE ) ) return ; IVMInstall vmInstall = RubyRuntime . getDefaultVMInstall ( ) ; if ( vmInstall == null ) return ; setQuickNDirtyPaths ( variable , vmInstall ) ; Job realJob = new Job ( "" ) { @ Override protected IStatus run ( IProgressMonitor monitor ) { IGemManager gemManager = AptanaRDTPlugin . getDefault ( ) . getGemManager ( ) ; List < IPath > gemPaths = null ; int tries = 3 ; while ( tries > 0 ) { gemPaths = gemManager . getGemInstallPaths ( ) ; if ( gemPaths != null ) break ; tries -- ; } if ( gemPaths == null ) { gemPaths = loadCachedValue ( ) ; } else { saveValue ( gemPaths ) ; } if ( gemPaths == null ) { return new Status ( Status . ERROR , AptanaRDTPlugin . PLUGIN_ID , - 1 , "" , null ) ; } IPath [ ] paths = new IPath [ gemPaths . size ( ) ] ; int i = 0 ; for ( IPath path : gemPaths ) { paths [ i ++ ] = path . append ( "gems" ) ; } if ( RubyRuntime . currentVMIsCygwin ( ) ) { File home = RubyRuntime . getDefaultVMInstall ( ) . getInstallLocation ( ) ; for ( int x = 0 ; x < paths . length ; x ++ ) { String portablePath = paths [ x ] . toOSString ( ) ; if ( portablePath . startsWith ( "\\usr\\lib" ) ) { portablePath = portablePath . substring ( 4 ) ; } String cygwinConverted = home . getAbsolutePath ( ) + portablePath ; IPath path = new Path ( cygwinConverted ) ; paths [ x ] =
41
<s> package org . rubypeople . rdt . core . search ; import org . eclipse . core . resources . IResource ; import org . rubypeople . rdt . core . IRubyElement ; public class FieldDeclarationMatch extends SearchMatch { public FieldDeclarationMatch ( IRubyElement element , int accuracy , int offset , int length , SearchParticipant
42
<s> package org . rubypeople . rdt . refactoring . ui ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . swt . custom . StyleRange ; import org . eclipse . swt . graphics . Color ; import org . eclipse . swt . graphics . RGB ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Display ; import org . rubypeople . rdt . core . formatter . DefaultCodeFormatterConstants ; import org . rubypeople . rdt . internal . ui . preferences . formatter . RubyScriptPreview ; public class RdtCodeViewer extends RubyScriptPreview { public static RdtCodeViewer create ( Composite parent ) { Map < String , String > map = new HashMap < String , String > ( ) ; map . put ( DefaultCodeFormatterConstants . FORMATTER_TAB_CHAR , " " ) ; return new RdtCodeViewer ( map , parent ) ; } protected RdtCodeViewer ( Map workingValues , Composite parent ) { super ( workingValues , parent
43
<s> package org . rubypeople . rdt . refactoring . core . renamelocal ; import java . util . ArrayList ; import java . util . Collection ; import java . util . Observable ; import java . util . Observer ; import org . jruby . ast . DAsgnNode ; import org . jruby . ast . DVarNode ; import org . jruby . ast . MethodDefNode ; import org . jruby . ast . Node ; import org . rubypeople . rdt . refactoring . editprovider . EditProvider ; import org . rubypeople . rdt . refactoring . editprovider . MultiEditProvider ; import org . rubypeople . rdt . refactoring . util . NodeUtil ; public class RenameLocalEditProvider extends MultiEditProvider implements Observer { private static final class AbortOnScope implements IAbortCondition { public boolean abort ( Node currentNode ) { return NodeUtil . hasScope ( currentNode ) ; } } private static final class AbortOnMethodDef implements IAbortCondition { public boolean abort ( Node currentNode ) { return currentNode instanceof MethodDefNode ; } } private String selectedVariableName = "" ;
44
<s> package com . asakusafw . bulkloader . exporter ; import static org . junit . Assert . * ; import java . io . ByteArrayOutputStream ; import java . io . File ; import java . io . FileInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . util . Arrays ; import java . util . LinkedHashMap ; import java . util . List ; import java . util . Map ; import java . util . Properties ; import org . junit . After ; import org . junit . AfterClass ; import org . junit . Assume ; import org . junit . Before ; import org . junit . BeforeClass ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; import com . asakusafw . bulkloader . bean . ExportTargetTableBean ; import com . asakusafw . bulkloader . bean . ExporterBean ; import com . asakusafw . bulkloader . common . BulkLoaderInitializer ; import com . asakusafw . bulkloader . common . ConfigurationLoader ; import com . asakusafw . bulkloader . common . Constants ; import com . asakusafw . bulkloader . testutil . UnitTestUtil ; import com . asakusafw . bulkloader . transfer . FileListProvider ; import com . asakusafw . bulkloader . transfer . StreamFileListProvider ; import com . asakusafw . testtools . TestUtils ; public class ExportFileReceiveTest { @ Rule public final TemporaryFolder folder = new TemporaryFolder ( ) ; private static List < String > properties = Arrays . asList ( new String [ ] { "" } ) ; private static String testBatchId = "batch01" ; private static String testJobflowId1 = "JOB_FLOW01" ; private static String testJobflowId2 = "JOB_FLOW02" ; private static String testExecutionId = "" ; @ BeforeClass public static void setUpBeforeClass ( ) throws Exception { UnitTestUtil . setUpBeforeClass ( ) ; UnitTestUtil . setUpEnv ( ) ; BulkLoaderInitializer . initDBServer ( testJobflowId1 , testExecutionId , properties , "target1" ) ; UnitTestUtil . setUpDB ( ) ; } @ AfterClass public static void tearDownAfterClass ( ) throws Exception { UnitTestUtil . tearDownDB ( ) ; UnitTestUtil . tearDownAfterClass ( ) ; } @ Before public void setUp ( ) throws Exception { BulkLoaderInitializer . initDBServer ( testJobflowId1 , testExecutionId , properties , "target1" ) ; UnitTestUtil . startUp ( ) ; } @ After public void tearDown ( ) throws Exception { UnitTestUtil . tearDown ( ) ; } @ Test public void receiveFileTest01 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; Map < String , ExportTargetTableBean > targetTable = new LinkedHashMap < String , ExportTargetTableBean > ( ) ; ExportTargetTableBean table1 = new ExportTargetTableBean ( ) ; targetTable . put ( "EXP_TARGET1" , table1 ) ; ExportTargetTableBean table2 = new ExportTargetTableBean ( ) ; targetTable . put ( "EXP_TARGET2" , table2 ) ; ExporterBean bean = new ExporterBean ( ) ; bean . setJobflowSid ( "11" ) ; bean . setExportTargetTable ( targetTable ) ; bean . setJobflowId ( testJobflowId1 ) ; bean . setExecutionId ( testExecutionId ) ; bean . setBatchId ( testBatchId ) ; bean . setTargetName ( "target1" ) ; File testFile = folder . newFile ( "testing" ) ; ExportFileReceive receive = new Mock ( testFile , "" ) ; boolean result = receive . receiveFile ( bean ) ; assertTrue ( result ) ; List < File > target1 = bean . getExportTargetTable ( "EXP_TARGET1" ) . getExportFiles ( ) ; List < File > target2 = bean . getExportTargetTable ( "EXP_TARGET2" ) . getExportFiles ( ) ; UnitTestUtil . assertSameFileList ( testFile , target1 . get ( 0 ) , target1 . get ( 1 ) , target2 . get ( 0 ) ) ; } @ SuppressWarnings ( "deprecation" ) @ Test public void receiveFileTest02 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; Map < String , ExportTargetTableBean > targetTable = new LinkedHashMap < String , ExportTargetTableBean > ( ) ; ExportTargetTableBean table1 = new ExportTargetTableBean ( ) ; targetTable . put ( "EXP_TARGET1" , table1 ) ; ExportTargetTableBean table2 = new ExportTargetTableBean ( ) ; targetTable . put ( "EXP_TARGET2" , table2 ) ; ExporterBean bean = new ExporterBean ( ) ; bean . setJobflowSid ( "12" ) ; bean . setExportTargetTable ( targetTable ) ; bean . setJobflowId ( testJobflowId2 ) ; bean . setExecutionId ( testExecutionId ) ; bean . setBatchId ( testBatchId ) ; Properties prop = ConfigurationLoader . getProperty ( ) ; prop . setProperty ( Constants . PROP_KEY_EXP_FILE_DIR , "" ) ; ConfigurationLoader . setProperty ( prop ) ; File testFile = folder . newFile ( "testing" ) ; ExportFileReceive receive = new Mock ( testFile , "" ) ; boolean result = receive . receiveFile ( bean ) ; assertTrue ( result ) ; List < File > target1 = bean . getExportTargetTable ( "EXP_TARGET1" ) . getExportFiles ( ) ; UnitTestUtil . assertSameFileList ( testFile , target1 . get ( 0 ) ) ; } @ SuppressWarnings ( "deprecation" ) @ Test public void receiveFileTest03 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; Map < String , ExportTargetTableBean > targetTable = new LinkedHashMap < String , ExportTargetTableBean > ( ) ; ExportTargetTableBean table1 = new ExportTargetTableBean ( ) ; targetTable . put ( "EXP_TARGET1" , table1 ) ; ExportTargetTableBean table2 = new ExportTargetTableBean ( ) ; targetTable . put ( "EXP_TARGET2" , table2 ) ; ExporterBean bean = new ExporterBean ( ) ; bean . setJobflowSid ( "13" ) ; bean . setExportTargetTable ( targetTable ) ; bean . setJobflowId ( testJobflowId2 ) ; bean . setExecutionId ( testExecutionId ) ; bean . setBatchId ( testBatchId ) ; File missing = folder . newFolder ( "__MISSING__" ) ; Assume . assumeTrue ( missing . delete ( ) ) ; Properties prop = ConfigurationLoader . getProperty ( ) ; prop . setProperty ( Constants . PROP_KEY_EXP_FILE_DIR , missing . getAbsolutePath ( ) ) ; ConfigurationLoader . setProperty ( prop ) ; File testFile = folder . newFile ( "testing" ) ; ExportFileReceive receive = new Mock ( testFile , "" ) ; boolean result = receive . receiveFile ( bean ) ; assertFalse ( result ) ; } @ Test public void receiveFileTest04 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase (
45
<s> package org . rubypeople . rdt . refactoring . ui . pages . movemethod ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Combo ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Group ; import org . eclipse . swt . widgets . Label ; import org . rubypeople . rdt . refactoring . core . movemethod . MoveMethodConfig ; import org . rubypeople . rdt . refactoring . nodewrapper . VisibilityNodeWrapper ; public class FirstMoveMethodPageComposite extends Composite { private MoveMethodConfig config ; public FirstMoveMethodPageComposite ( Composite parent , MoveMethodConfig config ) { super ( parent , SWT . NONE ) ; this . config = config ; initialize ( ) ; } private void initialize ( ) { GridLayout gridLayout = new GridLayout ( 2 , false ) ; setLayout ( gridLayout ) ; createSelectionGroup ( ) ; createClassSelection ( ) ; createLeaveDelegateMethodCheck ( ) ; } private void createSelectionGroup ( ) { String selectedMethodName = config . getMethodNode ( ) . getName ( ) ; String selectedMethodVisibility = VisibilityNodeWrapper . getVisibilityName ( config . getMethodVisibility ( ) ) ; String selectedClassName = config . getSourceClassNode ( ) . getName ( ) ; Group group = new Group ( this , SWT . NONE ) ; group . setLayout ( new GridLayout ( ) ) ; group . setText ( Messages . FirstMoveMethodPageComposite_Selection ) ; group . setLayoutData ( getGridData ( 2 , true ) ) ; Label selectedMethodLabel = new Label ( group , SWT . NONE ) ; selectedMethodLabel . setText ( Messages . FirstMoveMethodPageComposite_SelectedMethod + selectedMethodName ) ; Label visibilityLabel = new Label ( group , SWT . NONE ) ; visibilityLabel . setText ( Messages . FirstMoveMethodPageComposite_Visibility + selectedMethodVisibility ) ; visibilityLabel . setLayoutData (
46
<s> package test . modelgen . table . model ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import javax . annotation . Generated ; import org . apache . hadoop . io . Writable ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . vocabulary . model . DataModel ; import com . asakusafw . vocabulary . model . Property ; import com . asakusafw . vocabulary . model . TableModel ; @ Generated ( "" ) @ DataModel @ TableModel ( name = "" , columns = { "TEMP_SID" } , primary = { "TEMP_SID" } ) @ SuppressWarnings ( "deprecation" ) public class TempImportTarget2Df implements Writable { @ Property ( name = "TEMP_SID" ) private LongOption tempSid = new LongOption ( ) ; public long getTempSid ( ) { return this . tempSid . get ( ) ; } public void setTempSid ( long tempSid ) { this . tempSid . modify (
47
<s> package org . oddjob . scheduling ; import java . beans . PropertyVetoException ; import java . text . ParseException ; import java . util . ArrayList ; import java . util . Date ; import java . util . List ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . FailedToStopException ; import org . oddjob . Helper ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . Resetable ; import org . oddjob . StateSteps ; import org . oddjob . Stateful ; import org . oddjob . WaitHelper ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . types . ArooaObject ; import org . oddjob . arooa . utils . DateHelper ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . framework . SerializableJob ; import org . oddjob . framework . StopWait ; import org . oddjob . persist . ArchiveBrowserJob ; import org . oddjob . persist . MapPersister ; import org . oddjob . state . JobState ; import org . oddjob . state . ParentState ; import org . oddjob . state . StateEvent ; import org . oddjob . state . StateListener ; import org . oddjob . util . Clock ; public class TimerRetryCombinationTest extends TestCase { private static final Logger logger = Logger . getLogger ( TimerRetryCombinationTest . class ) ; @ Override protected void setUp ( ) throws Exception { super . setUp ( ) ; logger . info ( "" + getName ( ) + "" ) ; } public static class Results extends SerializableJob { private static final long serialVersionUID = 2009081400L ; private int soft ; private int hard ; private int executions ; private int result ; @ Override protected int execute ( ) throws Throwable { logger . info ( "RUNNING!!!" ) ; ++ executions ; return result ; } @ Override public boolean hardReset ( ) { if ( super . hardReset ( ) ) { logger . info ( "HARD RESET" ) ; synchronized ( this ) { hard ++ ; } return true ; } return false ; } @ Override public boolean softReset ( ) { if ( super . softReset ( ) ) { logger . info ( "SOFT RESET" ) ; synchronized ( this ) { soft ++ ; } return true ; } return false ; } public synchronized int getSoft ( ) { return soft ; } public synchronized int getHard ( ) { return hard ; } public int getExecutions ( ) { return executions ; } public int getResult ( ) { return result ; } public void setResult ( int result ) { this . result = result ; } } public void testContextReset ( ) throws ArooaConversionException , PropertyVetoException , InterruptedException { XMLConfiguration config = new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ; DefaultExecutors services = new DefaultExecutors ( ) ; MapPersister persister = new MapPersister ( ) ; persister . setPath ( "" ) ; Oddjob oddjob1 = new Oddjob ( ) ; oddjob1 . setOddjobExecutors ( services ) ; oddjob1 . setConfiguration ( config ) ; oddjob1 . setPersister ( persister ) ; logger . info ( "" ) ; StateSteps oddjob1State = new StateSteps ( oddjob1 ) ; oddjob1State . startCheck ( ParentState . READY , ParentState . EXECUTING , ParentState . ACTIVE , ParentState . INCOMPLETE ) ; oddjob1 . run ( ) ; oddjob1State . checkWait ( ) ; OddjobLookup lookup1 = new OddjobLookup ( oddjob1 ) ; int hards1 = lookup1 . lookup ( "results.hard" , Integer . TYPE ) ; int softs1 = lookup1 . lookup ( "results.soft" , Integer . TYPE ) ; int executions = lookup1 . lookup ( "" , Integer . TYPE ) ; assertEquals ( 4 , hards1 ) ; assertEquals ( 8 , softs1 ) ; assertEquals ( 8 , executions ) ; oddjob1 . softReset ( ) ; hards1 = lookup1 . lookup ( "results.hard" , Integer . TYPE ) ; softs1 = lookup1 . lookup ( "results.soft" , Integer . TYPE ) ; executions = lookup1 . lookup ( "" , Integer . TYPE ) ; assertEquals ( 4 , hards1 ) ; assertEquals ( 9 , softs1 ) ; assertEquals ( 8 , executions ) ; logger . info ( "" ) ; oddjob1State . startCheck ( ParentState . READY , ParentState . EXECUTING , ParentState . ACTIVE , ParentState . INCOMPLETE ) ; oddjob1 . run ( ) ; oddjob1State . checkWait ( ) ; hards1 = lookup1 . lookup ( "results.hard" , Integer . TYPE ) ; softs1 = lookup1 . lookup ( "results.soft" , Integer . TYPE ) ; executions = lookup1 . lookup ( "" , Integer . TYPE ) ; assertEquals ( 8 , hards1 ) ; assertEquals ( 17 , softs1 ) ; assertEquals ( 16 , executions ) ; Resetable timer = lookup1 . lookup ( "timer" , Resetable . class ) ; timer . hardReset ( ) ; oddjob1 . destroy ( ) ; Oddjob oddjob2 = new Oddjob ( ) ; oddjob2 . setOddjobExecutors ( services ) ; oddjob2 . setConfiguration ( config ) ; oddjob2 . setPersister ( persister ) ; logger . info ( "" ) ; StateSteps oddjob2State = new StateSteps ( oddjob2 ) ; oddjob2State . startCheck ( ParentState . READY , ParentState . EXECUTING , ParentState . ACTIVE , ParentState . INCOMPLETE ) ; oddjob2 . run ( ) ; oddjob2State . checkWait ( ) ; OddjobLookup lookup2 = new OddjobLookup ( oddjob2 ) ; int hards2 = lookup2 . lookup ( "results.hard" , Integer . TYPE ) ; int softs2 = lookup2 . lookup ( "results.soft" , Integer . TYPE ) ; int executions2 = lookup2 . lookup ( "" , Integer . TYPE ) ; assertEquals ( 12 , hards2 ) ; assertEquals ( 25 , softs2 ) ; assertEquals ( 24 , executions2 ) ; oddjob2 . destroy ( ) ; services . stop ( ) ; } private class RecordingStateListener implements StateListener { final List < StateEvent > eventList = new ArrayList < StateEvent > ( ) ; public synchronized void jobStateChange ( StateEvent event ) { logger . info ( "" + event . getState ( ) + "] for [" + event . getSource ( ) + "] index [" + eventList . size ( ) + "]" ) ; eventList . add ( event ) ; } public synchronized StateEvent get ( int index ) { return eventList . get ( index ) ; } public synchronized int size ( ) { return eventList . size ( ) ; } } public void testStateNotifications ( ) throws FailedToStopException { XMLConfiguration config = new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ; DefaultExecutors services = new DefaultExecutors ( ) ; Oddjob oddjob1 = new Oddjob ( ) ; oddjob1 . setOddjobExecutors ( services ) ; oddjob1 . setConfiguration ( config ) ; RecordingStateListener ojRec = new RecordingStateListener ( ) ; oddjob1 . addStateListener ( ojRec ) ; assertEquals ( 1 , ojRec . size ( ) ) ; assertEquals ( ParentState . READY , ojRec . get ( 0 ) . getState ( ) ) ; oddjob1 . load ( ) ; assertEquals ( 1 , ojRec . size ( ) ) ; Timer timer = ( Timer ) new OddjobLookup ( oddjob1 ) . lookup ( "timer" ) ; RecordingStateListener timerRec = new RecordingStateListener ( ) ; timer . addStateListener ( timerRec ) ; assertEquals ( 1 , timerRec . size ( ) ) ; assertEquals ( ParentState . READY , timerRec . get ( 0 ) . getState ( ) ) ; Retry retry = ( Retry ) new OddjobLookup ( oddjob1 ) . lookup ( "retry" ) ; RecordingStateListener retryRec = new RecordingStateListener ( ) ; retry . addStateListener ( retryRec ) ; assertEquals ( 1 , retryRec . size ( ) ) ; assertEquals ( ParentState . READY , retryRec . get ( 0 ) . getState ( ) ) ; oddjob1 . run ( ) ; new StopWait ( oddjob1 ) . run ( ) ; logger . info ( "" + oddjob1 . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( ParentState . EXECUTING , ojRec . get ( 1 ) . getState ( ) ) ; assertEquals
48
<s> package com . asakusafw . yaess . jsch ; import java . io . ByteArrayInputStream ; import java . io . IOException ; import java . io . OutputStream ; import java . text . MessageFormat ; import java . util . List ; import java . util . Map ; import java . util . concurrent . TimeUnit ; import java . util . regex . Pattern ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . yaess . basic . ProcessExecutor ; import com . asakusafw . yaess . core . ExecutionContext ; import com . asakusafw . yaess . core . VariableResolver ; import com . asakusafw . yaess . core . YaessLogger ; import com . jcraft . jsch . ChannelExec ; import com . jcraft . jsch . JSch ; import com . jcraft . jsch . JSchException ; import com . jcraft . jsch . Session ; public class JschProcessExecutor implements ProcessExecutor { static final YaessLogger YSLOG = new YaessJschLogger ( JschProcessExecutor . class ) ; static final Logger LOG = LoggerFactory . getLogger ( JschProcessExecutor . class ) ; private static final String PREFIX = "ssh." ; public static final String KEY_USER = PREFIX + "user" ; public static final String KEY_HOST = PREFIX + "host" ; public static final String KEY_PORT = PREFIX + "port" ; public static final String KEY_PRIVATE_KEY = PREFIX + "privateKey" ; public static final String KEY_PASS_PHRASE = PREFIX + "passPhrase" ; private static final Pattern SH_NAME = Pattern . compile ( "" ) ; private static final Pattern SH_METACHARACTERS = Pattern . compile ( "[\\$`\"\\\\n]" ) ; private final String user ; private final String host ; private final Integer port ; private final String privateKey ; private final String passPhrase ; private final JSch jsch ; public JschProcessExecutor ( String user , String host , Integer portOrNull , String privateKeyPath , String passPhraseOrNull ) throws JSchException { if ( user == null ) { throw new IllegalArgumentException ( "" ) ; } if ( host == null ) { throw new IllegalArgumentException ( "" ) ; } if ( privateKeyPath == null ) { throw new IllegalArgumentException ( "" ) ; } this . user = user ; this . host = host ; this . port = portOrNull ; this . jsch = new JSch ( ) ; this . privateKey = privateKeyPath ; this . passPhrase = passPhraseOrNull ; jsch . addIdentity ( privateKeyPath , passPhraseOrNull ) ; } public String getUser ( ) { return user ; } public String getHost ( ) { return host ; } public Integer getPort ( ) { return port ; } public String getPrivateKey ( ) { return privateKey ; } public String getPassPhrase ( ) { return passPhrase ; } public static JschProcessExecutor extract ( String servicePrefix , Map < String , String > configuration , VariableResolver variables ) throws JSchException { if ( servicePrefix == null ) { throw new IllegalArgumentException ( "" ) ; } if ( configuration == null ) { throw new IllegalArgumentException ( "" ) ; } if ( variables == null ) { throw new IllegalArgumentException ( "" ) ; } String user = extract ( KEY_USER , servicePrefix , configuration , variables , true ) ; String host = extract ( KEY_HOST , servicePrefix , configuration , variables , true ) ; String portString = extract ( KEY_PORT , servicePrefix , configuration , variables , false ) ; String privateKey = extract ( KEY_PRIVATE_KEY , servicePrefix , configuration , variables , false ) ; String passPhrase = extract ( KEY_PASS_PHRASE , servicePrefix , configuration , variables , false ) ; Integer port = null ; if ( portString != null ) { try { port = Integer . valueOf ( portString ) ; } catch ( NumberFormatException e ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , servicePrefix + '.' + KEY_PORT , portString ) ) ; } } return new JschProcessExecutor ( user , host , port , privateKey , passPhrase ) ; } private static String extract ( String key , String prefix , Map < String , String > configuration , VariableResolver variables , boolean mandatory ) { assert key != null ; assert prefix != null ; assert configuration != null ; assert variables != null ; String value = configuration . get ( key ) ; if ( value == null ) { if ( mandatory ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , prefix + '.' + key ) ) ; } else { return null ; } } try { return variables . replace ( value , true ) ; } catch ( IllegalArgumentException e ) { throw new IllegalArgumentException ( MessageFormat . format ( "" ,
49
<s> package org . rubypeople . rdt . refactoring . tests . core . mergeclasspartsinfile ; import java . util . ArrayList ; import java . util . Collection ; import java . util . StringTokenizer ; import java . util . Vector ; import org . rubypeople . rdt . refactoring . core . mergeclasspartsinfile . InFileClassPartsMerger ; import org . rubypeople . rdt . refactoring . core . mergeclasspartsinfile . MergeClassPartInFileConfig ; import org . rubypeople . rdt . refactoring . core . mergeclasspartsinfile . MergeClassPartsInFileConditionChecker ; import org . rubypeople . rdt . refactoring . nodewrapper . ClassNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . PartialClassNodeWrapper ; import org . rubypeople . rdt . refactoring . tests . FileTestData ; import org . rubypeople . rdt . refactoring . tests . RefactoringTestCase ; public class ClassPartSelectorTester extends RefactoringTestCase { private FileTestData testData ; public ClassPartSelectorTester ( String fileName ) { super ( fileName ) ; } private Collection < PartialClassNodeWrapper > getCheckedParts ( ClassNodeWrapper classNode ) { Collection < Integer > checkedClassPartNumbers = getCheckedPartNumbers ( ) ; ArrayList < PartialClassNodeWrapper > checkedParts = new ArrayList < PartialClassNodeWrapper > ( ) ; PartialClassNodeWrapper [ ] classParts = classNode . getPartialClassNodes ( ) .
50
<s> package org . oddjob . tools . doclet . utils ; import com . sun . javadoc . Tag ; public
51
<s> package net . sf . sveditor . core . tests . docs ; import java . io . BufferedWriter ; import java . io . File ; import java . io . FileWriter ; import java . io . IOException ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Set ; import junit . framework . TestCase ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . Tuple ; import net . sf . sveditor . core . db . index . ISVDBIndex ; import net . sf . sveditor . core . db . index . SVDBArgFileIndexFactory ; import net . sf . sveditor . core . db . index . SVDBDeclCacheItem ; import net . sf . sveditor . core . db . index . SVDBIndexRegistry ; import net . sf . sveditor . core . db . search . SVDBFindPackageMatcher ; import net . sf . sveditor . core . docs . DocGenConfig ; import net . sf . sveditor . core . docs . model . DocModel ; import net . sf . sveditor . core . docs . model . DocModelFactory ; import net . sf . sveditor . core . log . ILogLevel ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . tests . SVCoreTestsPlugin ; import net . sf . sveditor . core . tests . TestIndexCacheFactory ; import net . sf . sveditor . core . tests . utils . BundleUtils ; import net . sf . sveditor . core . tests . utils . TestUtils ; import difflib . * ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . runtime . NullProgressMonitor ; public class TestModelFactory extends TestCase { boolean fDebug = false ; private LogHandle fLog ; private File fTmpDir ; private IProject fProject ; public TestModelFactory ( ) { fLog = LogFactory . getLogHandle ( "TestParser" ) ; } @ Override protected void setUp ( ) throws Exception { super . setUp ( ) ; fTmpDir = TestUtils . createTempDir ( ) ; fProject = null ; } @ Override protected void tearDown ( ) throws Exception { super . tearDown ( ) ; SVDBIndexRegistry rgy = SVCorePlugin . getDefault ( ) . getSVDBIndexRegistry ( ) ; rgy . save_state ( ) ; if ( fProject != null && ! fDebug ) { TestUtils . deleteProject ( fProject ) ; } if ( fTmpDir != null && fTmpDir . exists ( ) && ! fDebug ) { TestUtils . delete ( fTmpDir ) ; } } public void testUVM ( ) throws IOException { String test_name = "" ; String bundle_dir_name = "basic_uvm" ; String test_bundle_dir = "" + bundle_dir_name ; doTestUVMExample ( test_name , bundle_dir_name , test_bundle_dir ) ; } public void doTestUVMExample ( String testName , String bundleDirName , String testBundleDir ) throws IOException { BundleUtils utils = new BundleUtils ( SVCoreTestsPlugin . getDefault ( ) . getBundle ( ) ) ; LogHandle log = LogFactory . getLogHandle ( testName ) ; File testDir = new File ( fTmpDir , testName ) ; File projDir = testDir ; File cpBundleDir = new File ( testDir , bundleDirName ) ; File listFile = new File ( cpBundleDir , "file.list" ) ; testDir . mkdirs ( ) ; fLog . debug ( ILogLevel . LEVEL_OFF , "" ) ; fLog . debug ( ILogLevel . LEVEL_OFF , "" + testName ) ; fLog . debug ( ILogLevel . LEVEL_OFF , "" + testBundleDir ) ; fLog . debug ( ILogLevel . LEVEL_OFF , "" + testDir . getPath ( ) ) ; fLog . debug ( ILogLevel . LEVEL_OFF , "" + cpBundleDir . getPath ( ) ) ; fLog . debug ( ILogLevel . LEVEL_OFF , "" + projDir . getPath ( ) ) ; fLog . debug ( ILogLevel . LEVEL_OFF , "" + listFile . getPath ( ) ) ; fLog . debug ( ILogLevel . LEVEL_OFF , "" ) ; fProject = TestUtils . createProject ( testName , projDir ) ; utils . unpackBundleZipToFS ( "/uvm.zip" , testDir ) ; utils . copyBundleDirToWS ( testBundleDir , fProject ) ; File db = new File ( fTmpDir , "db" ) ; if ( db . exists ( ) ) { db . delete ( ) ; } SVDBIndexRegistry rgy = SVCorePlugin . getDefault ( ) . getSVDBIndexRegistry ( ) ; rgy . init ( TestIndexCacheFactory . instance ( db ) ) ; ISVDBIndex index = rgy . findCreateIndex ( new NullProgressMonitor ( ) , "GENERIC" , listFile . toString ( ) , SVDBArgFileIndexFactory . TYPE , null ) ; index . loadIndex ( new NullProgressMonitor ( ) ) ; DocGenConfig cfg = new DocGenConfig ( ) ; Map < String , Tuple < SVDBDeclCacheItem , ISVDBIndex > > pkgMap = new HashMap < String , Tuple < SVDBDeclCacheItem , ISVDBIndex > > ( ) ; List < ISVDBIndex > projIndexList = rgy . getAllProjectLists ( ) ; for ( ISVDBIndex svdbIndex : projIndexList ) { List < SVDBDeclCacheItem > foundPkgs = svdbIndex . findGlobalScopeDecl ( new NullProgressMonitor ( ) , "pkgs" , new SVDBFindPackageMatcher ( ) ) ; for ( SVDBDeclCacheItem pkg : foundPkgs ) { if ( ! pkgMap . containsKey ( pkg . getName ( ) ) ) { pkgMap . put ( pkg . getName ( ) , new Tuple < SVDBDeclCacheItem , ISVDBIndex > ( pkg , svdbIndex ) ) ; } } } Set < Tuple < SVDBDeclCacheItem , ISVDBIndex > > pkgs = new HashSet < Tuple < SVDBDeclCacheItem , ISVDBIndex > > ( pkgMap . values ( ) ) ; cfg . setSelectedPackages ( pkgs ) ; if ( fDebug ) SVCorePlugin . getDefault ( ) .
52
<s> package com . asakusafw . compiler . flow . stage ; public class CompiledShuffleFragment { private CompiledType mapOutputType ; private CompiledType combineOutputType ; public CompiledShuffleFragment ( CompiledType mapOutput , CompiledType combineOutput ) { if ( mapOutput == null ) { throw new IllegalArgumentException ( ""
53
<s> package com . asakusafw . testdriver . rule ; public class IsNull implements ValuePredicate < Object > { @ Override public boolean accepts ( Object expected , Object actual ) { return actual == null ; }
54
<s> package com . asakusafw . utils . java . internal . model . syntax ; import java . util . List ; import com . asakusafw . utils . java . model . syntax . AlternateConstructorInvocation ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class AlternateConstructorInvocationImpl extends ModelRoot implements AlternateConstructorInvocation { private List < ? extends Type > typeArguments ; private List < ? extends Expression > arguments ; @ Override public List < ? extends Type > getTypeArguments
55
<s> package com . asakusafw . dmdl . java . emitter ; import java . io . IOException ; import com . asakusafw . dmdl . java . Configuration ; import com . asakusafw . dmdl . java . spi . JavaDataModelDriver ; import com . asakusafw . dmdl . semantics . DmdlSemantics ; import com . asakusafw . dmdl . semantics . ModelDeclaration ; public class JavaModelClassGenerator { private final DmdlSemantics semantics ; private final Configuration config ;
56
<s> package com . asakusafw . compiler . yaess . testing . mock ; import com . asakusafw . compiler . yaess . testing . model . Dummy ; import com . asakusafw .
57
<s> package org . rubypeople . rdt . internal . corext . refactoring . nls . changes ; import java . io . ByteArrayInputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . UnsupportedEncodingException ; import java . net . URI ; import org . eclipse . core . filesystem . EFS ; import org . eclipse . core . filesystem . IFileInfo ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . Assert ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . ltk . core . refactoring . Change ; import org . eclipse . ltk . core . refactoring . RefactoringStatus ; import org . rubypeople . rdt . core . IRubyModelStatusConstants ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . refactoring . base . RDTChange ; import org . rubypeople . rdt . refactoring . core . Messages ; public class CreateFileChange extends RDTChange { private String fChangeName ; private IPath fPath ; private String fSource ; private String fEncoding ; private boolean fExplicitEncoding ; private long fStampToRestore ; public CreateFileChange ( IPath path , String source , String encoding ) { this ( path , source , encoding , IResource . NULL_STAMP ) ; } public CreateFileChange ( IPath path , String source , String encoding , long stampToRestore ) { Assert . isNotNull ( path , "path" ) ; Assert . isNotNull ( source , "source" ) ; fPath = path ; fSource = source ; fEncoding = encoding ; fExplicitEncoding = fEncoding != null ; fStampToRestore = stampToRestore ; } protected void setEncoding ( String encoding , boolean explicit ) { Assert . isNotNull ( encoding , "encoding" ) ; fEncoding = encoding ; fExplicitEncoding = explicit ; } public String getName ( ) { if ( fChangeName == null ) return Messages . format ( Messages . createFile_Create_file , fPath . toOSString ( ) ) ; else return fChangeName ; } public void setName ( String name ) { fChangeName = name ; } protected void setSource ( String source ) { fSource = source ; } protected String getSource ( ) { return fSource ; } protected void setPath ( IPath path ) { fPath = path ; } protected IPath getPath ( ) { return fPath ; } public Object getModifiedElement ( ) { return ResourcesPlugin . getWorkspace ( ) . getRoot
58
<s> package com . asakusafw . vocabulary . bulkloader ; import java . lang . annotation . Documented ; import java . lang . annotation . ElementType ; import java . lang . annotation . Retention ; import java . lang . annotation . RetentionPolicy ; import java . lang . annotation . Target ; @ Target ( ElementType . TYPE ) @ Retention (
59
<s> package com . asakusafw . compiler . yaess . testing . mock ; import java . io . IOException ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import java . util . Set ; import com . asakusafw . compiler . flow . ExternalIoCommandProvider ; import com . asakusafw . compiler . flow . ExternalIoDescriptionProcessor ; import com . asakusafw . compiler . flow . Location ; import com . asakusafw . compiler . flow . jobflow . CompiledStage ; import com . asakusafw . runtime . stage . input . TemporaryInputFormat ; import com . asakusafw . utils . collections . Sets ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . vocabulary . external . ExporterDescription ; import com . asakusafw . vocabulary . external . ImporterDescription ; import com . asakusafw . vocabulary . flow . graph . InputDescription ; import com . asakusafw . vocabulary . flow . graph . OutputDescription ; public class
60
<s> package org . oddjob . doclet ; import java . util . ArrayList ; import java . util . List ; import org . oddjob . arooa . beandocs . BeanDoc ; import org . oddjob . arooa . beandocs . WriteableBeanDoc ; import com . sun . javadoc . ClassDoc ; public class Archiver { private final JobsAndTypes jats ; public Archiver ( JobsAndTypes jats ) { this . jats = jats ; } public void archive ( ClassDoc classDoc ) { String fqcn = Processor . fqcnFor (
61
<s> package com . loiane . model ; import java . util . List ; public class Post { private int id ; private String title ; private List < Tag > tags ; public int getId ( ) { return id ; } public void setId ( int id ) { this . id = id ; } public String getTitle ( ) { return title ; } public void setTitle ( String title ) { this . title = title ; } public List < Tag > getTags ( ) { return tags ; } public void setTags ( List < Tag > tags ) { this . tags = tags ; }
62
<s> package net . sf . sveditor . ui . editor ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . indent . ISVIndenter ; import net . sf . sveditor . core . indent . SVIndentScanner ; import net . sf . sveditor . core . scanutils . StringBIDITextScanner ; import org . eclipse . core . runtime . Assert ; import org . eclipse . jface . dialogs . MessageDialog ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . BadPositionCategoryException ; import org . eclipse . jface . text . DocumentEvent ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IInformationControlCreator ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . jface . text . Position ; import org . eclipse . jface . text . Region ; import org . eclipse . jface . text . contentassist . ICompletionProposal ; import org . eclipse . jface . text . contentassist . ICompletionProposalExtension ; import org . eclipse . jface . text . contentassist . ICompletionProposalExtension2 ; import org . eclipse . jface . text . contentassist . ICompletionProposalExtension3 ; import org . eclipse . jface . text . contentassist . IContextInformation ; import org . eclipse . jface . text . link . ILinkedModeListener ; import org . eclipse . jface . text . link . InclusivePositionUpdater ; import org . eclipse . jface . text . link . LinkedModeModel ; import org . eclipse . jface . text . link . LinkedModeUI ; import org . eclipse . jface . text . link . LinkedPosition ; import org . eclipse . jface . text . link . LinkedPositionGroup ; import org . eclipse . jface . text . link . ProposalPosition ; import org . eclipse . jface . text . templates . DocumentTemplateContext ; import org . eclipse . jface . text . templates . GlobalTemplateVariables ; import org . eclipse . jface . text . templates . Template ; import org . eclipse . jface . text . templates . TemplateBuffer ; import org . eclipse . jface . text . templates . TemplateContext ; import org . eclipse . jface . text . templates . TemplateException ; import org . eclipse . jface . text . templates . TemplateVariable ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . graphics . Point ; import org . eclipse . swt . widgets . Shell ; public class SVIndentingTemplateProposal implements ICompletionProposal , ICompletionProposalExtension , ICompletionProposalExtension2 , ICompletionProposalExtension3 { private final Template fTemplate ; private final TemplateContext fContext ; private final Image fImage ; private final IRegion fRegion ; private int fRelevance ; private IRegion fSelectedRegion ; private String fDisplayString ; private InclusivePositionUpdater fUpdater ; private IInformationControlCreator fInformationControlCreator ; public SVIndentingTemplateProposal ( Template template , TemplateContext context , IRegion region , Image image , int relevance ) { Assert . isNotNull ( template ) ; Assert . isNotNull ( context ) ; Assert . isNotNull ( region ) ; fTemplate = template ; fContext = context ; fImage = image ; fRegion = region ; fDisplayString = null ; fRelevance = relevance ; } public final void setInformationControlCreator ( IInformationControlCreator informationControlCreator ) { fInformationControlCreator = informationControlCreator ; } protected final Template getTemplate ( ) { return fTemplate ; } protected final TemplateContext getContext ( ) { return fContext ; } public final void apply ( IDocument document ) { } public void apply ( ITextViewer viewer , char trigger , int stateMask , int offset ) { IDocument document = viewer . getDocument ( ) ; try { fContext . setReadOnly ( false ) ; int start ; TemplateBuffer templateBuffer ; { int oldReplaceOffset = getReplaceOffset ( ) ; start = getReplaceOffset ( ) ; int shift = start - oldReplaceOffset ; int end = Math . max ( getReplaceEndOffset ( ) , offset + shift ) ; try { String pattern = indent_proposal ( document , offset , fTemplate . getPattern ( ) . substring ( end - start ) ) ; Template template_t = new Template ( fTemplate . getName ( ) , fTemplate . getDescription ( ) , fTemplate . getContextTypeId ( ) , pattern , fTemplate . isAutoInsertable ( ) ) ; templateBuffer = fContext . evaluate ( template_t ) ; } catch ( TemplateException e1 ) { fSelectedRegion = fRegion ; return ; } String templateString = templateBuffer . getString ( ) ; document . replace ( start , end - start , templateString ) ; } LinkedModeModel model = new LinkedModeModel ( ) ; TemplateVariable [ ] variables = templateBuffer . getVariables ( ) ; boolean hasPositions = false ; for ( int i = 0 ; i != variables . length ; i ++ ) {
63
<s> package org . rubypeople . rdt . internal . ui . wizards . dialogfields ; import org . eclipse . swt . SWT ; import org . eclipse . swt . graphics . GC ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . Text ; import org . eclipse . swt . layout . GridData ; import org . eclipse . jface . resource . JFaceResources ; public class StringButtonStatusDialogField extends StringButtonDialogField { private Label fStatusLabelControl ; private Object fStatus ; private String fWidthHintString ; private int fWidthHint ; public StringButtonStatusDialogField ( IStringButtonAdapter adapter ) { super ( adapter ) ; fStatus = null ; fWidthHintString = null ; fWidthHint = - 1 ; } public void setStatus ( String status ) { if ( isOkToUse ( fStatusLabelControl ) ) { fStatusLabelControl . setText ( status ) ; } fStatus = status ; }
64
<s> package org . rubypeople . rdt . launching ; import org . eclipse . core . resources . IProject ; import org . eclipse . debug . core . model . IProcess ; import org . eclipse . debug . ui . IDebugUIConstants ; import org . eclipse . debug . ui . console . IConsole ; public
65
<s> package org . rubypeople . rdt . internal . ui ; import org . eclipse . core . resources . IResource ; import org . rubypeople .
66
<s> package com . mcbans . firestar . mcbans . commands ; import com . mcbans . firestar . mcbans . BukkitInterface ; import com . mcbans . firestar . mcbans . Settings ; import com . mcbans . firestar . mcbans . callBacks . ManualSync ; import com . mcbans . firestar . mcbans . callBacks . Ping ; import com . mcbans . firestar . mcbans . callBacks . serverChoose ; import com . mcbans . firestar . mcbans . org . json . JSONObject ; import com . mcbans . firestar . mcbans . pluginInterface . Ban ; import com . mcbans . firestar . mcbans . pluginInterface . Kick ; import com . mcbans . firestar . mcbans . pluginInterface . Lookup ; import org . bukkit . ChatColor ; import org . bukkit . command . CommandSender ; import org . bukkit . entity . Player ; public class CommandHandler { private BukkitInterface MCBans ; private Settings Config ; public CommandHandler ( Settings cf , BukkitInterface p ) { MCBans = p ; Config = cf ; } public boolean execCommand ( String command , String [ ] args , CommandSender from ) { Lookup lookupControl = null ; String CommandSend = "" ; String PlayerIP = "" ; boolean commandSet = false ; boolean isPlayer = false ; String reasonString = "" ; Ban banControl = null ; if ( from instanceof Player ) { Player player = ( Player ) from ; CommandSend = player . getName ( ) ; isPlayer = true ; } else { CommandSend = "Console" ; isPlayer = false ; } if ( args . length >= 1 ) { Player target = MCBans . getServer ( ) . getPlayer ( args [ 0 ] ) ; if ( target != null ) { PlayerIP = target . getAddress ( ) . getAddress ( ) . getHostAddress ( ) ; } } switch ( Commands . valueOf ( command . toUpperCase ( ) ) ) { case GBAN : if ( args . length >= 2 ) { return handleGlobal ( command , args , CommandSend , isPlayer , PlayerIP , 1 , 2 , false , 0 ) ; } break ; case BAN : if ( args . length < 1 ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "formatError" ) ) ; return true ; } if ( args . length >= 2 ) { if ( args [ 1 ] . equalsIgnoreCase ( "g" ) ) { return handleGlobal ( command , args , CommandSend , isPlayer , PlayerIP , 2 , 3 , false , 0 ) ; } else if ( args [ 1 ] . equalsIgnoreCase ( "t" ) ) { return handleTemp ( command , args , CommandSend , isPlayer , PlayerIP , 4 , 4 , false , 0 , 2 , 3 ) ; } } if ( args . length >= 1 ) { return handleLocal ( command , args , CommandSend , isPlayer , PlayerIP , 1 , 1 , false , 0 ) ; } break ; case RBAN : if ( MCBans . Permissions . isAllow ( CommandSend , "ban.rollback" ) || ! isPlayer ) { if ( args . length < 1 ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "formatError" ) ) ; return true ; } if ( args . length > 1 ) { if ( isNum ( args [ 1 ] ) ) { if ( args . length >= 4 ) { if ( args [ 2 ] . equalsIgnoreCase ( "g" ) ) { return handleGlobal ( command , args , CommandSend , isPlayer , PlayerIP , 3 , 4 , false , Integer . valueOf ( args [ 1 ] ) ) ; } else if ( args [ 2 ] . equalsIgnoreCase ( "t" ) ) { return handleTemp ( command , args , CommandSend , isPlayer , PlayerIP , 5 , 5 , false , Integer . valueOf ( args [ 1 ] ) , 3 , 4 ) ; } } return handleLocal ( command , args , CommandSend , isPlayer , PlayerIP , 2 , 2 , false , Integer . valueOf ( args [ 1 ] ) ) ; } else { if ( args . length >= 3 ) { if ( args [ 1 ] . equalsIgnoreCase ( "g" ) ) { return handleGlobal ( command , args , CommandSend , isPlayer , PlayerIP , 2 , 3 , true , 0 ) ; } else if ( args [ 1 ] . equalsIgnoreCase ( "t" ) ) { return handleTemp ( command , args , CommandSend , isPlayer , PlayerIP , 4 , 4 , true , 0 , 2 , 3 ) ; } } } } if ( args . length >= 1 ) { return handleLocal ( command , args , CommandSend , isPlayer , PlayerIP , 1 , 1 , true , 0 ) ; } } else { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "" ) ) ; MCBans . log ( CommandSend + "" + command + "]!" ) ; } break ; case TBAN : case TEMPBAN : if ( args . length >= 3 ) { return handleTemp ( command , args , CommandSend , isPlayer , PlayerIP , 3 , 3 , false , 0 , 1 , 2 ) ; } break ; case UNBAN : if ( MCBans . Permissions . isAllow ( CommandSend , "unban" ) || ! isPlayer ) { if ( args . length < 1 ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "formatError" ) ) ; return true ; } banControl = new Ban ( MCBans , "unBan" , args [ 0 ] , "" , CommandSend , "" , "" , "" ) ; Thread triggerThread = new Thread ( banControl ) ; triggerThread . start ( ) ; } else { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "" ) ) ; MCBans . log ( CommandSend + "" + command + "]!" ) ; } commandSet = true ; break ; case KICK : if ( MCBans . Permissions . isAllow ( CommandSend , "kick" ) || ! isPlayer ) { if ( args . length < 1 ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "formatError" ) ) ; return true ; } if ( args . length == 1 ) { reasonString = Config . getString ( "defaultKick" ) ; } else { reasonString = getReason ( args , "" , 1 ) ; } Kick kickPlayer = new Kick ( MCBans . Settings , MCBans , args [ 0 ] , CommandSend , reasonString ) ; Thread triggerThread = new Thread ( kickPlayer ) ; triggerThread . start ( ) ; } else { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "" ) ) ; MCBans . log ( CommandSend + "" + command + "]!" ) ; } commandSet = true ; break ; case LOOKUP : case LUP : if ( MCBans . Permissions . isAllow ( CommandSend , "lookup" ) || ! isPlayer ) { if ( args . length < 1 ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "formatError" ) ) ; return true ; } lookupControl = new Lookup ( MCBans , args [ 0 ] , CommandSend ) ; Thread triggerThread = new Thread ( lookupControl ) ; triggerThread . start ( ) ; } else { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "" ) ) ; MCBans . log ( CommandSend + "" + command + "]!" ) ; } commandSet = true ; break ; case MCBANS : if ( args . length == 0 ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . BLUE + "MCBans Help" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "/mcbans get" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "/mcbans ping" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "/mcbans sync" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "/mcbans user" + ChatColor . BLUE + "" ) ; } else if ( args . length > 1 ) { if ( MCBans . Permissions . isAllow ( CommandSend , "admin" ) || ! isPlayer ) { if ( args [ 0 ] . equalsIgnoreCase ( "get" ) ) { if ( args [ 1 ] . equalsIgnoreCase ( "call" ) ) { long callBackInterval = 0 ; callBackInterval = 60 * MCBans . Settings . getInteger ( "" ) ; if ( callBackInterval < ( ( 60 * 1000 ) * 15 ) ) { callBackInterval = ( ( 60 * 1000 ) * 15 ) ; } String r = this . timeRemain ( ( MCBans . lastCallBack + callBackInterval ) - ( System . currentTimeMillis ( ) / 1000 ) ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . GOLD + r + "" ) ; } else if ( args [ 1 ] . equalsIgnoreCase ( "sync" ) ) { String r = this . timeRemain ( ( MCBans . lastSync + ( 60 * MCBans . Settings . getInteger ( "syncInterval" ) ) ) - ( System . currentTimeMillis ( ) / 1000 ) ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . GOLD + r + "" ) ; } } } else { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "" ) ) ; MCBans . log ( CommandSend + "" + command + "]!" ) ; } } else if ( args . length == 1 ) { if ( args [ 0 ] . equalsIgnoreCase ( "banning" ) ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; } else if ( args [ 0 ] . equalsIgnoreCase ( "user" ) ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; } else if ( args [ 0 ] . equalsIgnoreCase ( "ping" ) ) { if ( MCBans . Permissions . isAllow ( CommandSend , "admin" ) || ! isPlayer ) { Ping manualPingCheck = new Ping ( MCBans , CommandSend ) ; ( new Thread ( manualPingCheck ) ) . start ( ) ; } else { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "" ) ) ; MCBans . log ( CommandSend + "" + command + "]!" ) ; } } else if ( args [ 0 ] . equalsIgnoreCase ( "sync" ) ) { if ( MCBans . Permissions . isAllow ( CommandSend , "admin" ) || ! isPlayer ) { long ht = ( MCBans . lastSync + ( 60 * MCBans . Settings . getInteger ( "syncInterval" ) ) ) - ( System . currentTimeMillis ( ) / 1000 ) ; if ( ht > 10 ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . GREEN + "" ) ; ManualSync manualSyncBanRunner = new ManualSync ( MCBans , CommandSend ) ; ( new Thread ( manualSyncBanRunner ) ) . start ( ) ; } else { MCBans . broadcastPlayer ( CommandSend , ChatColor . RED + "" ) ; } } else { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "" ) ) ; MCBans . log ( CommandSend + "" + command + "]!" ) ; } } else if ( args [ 0 ] . equalsIgnoreCase ( "get" ) ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; MCBans . broadcastPlayer ( CommandSend , ChatColor . WHITE + "" + ChatColor . BLUE + "" ) ; } else if ( args [ 0 ] . equalsIgnoreCase ( "reload" ) ) { if ( MCBans . Permissions . isAllow ( CommandSend , "admin" ) || ! isPlayer ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . AQUA + "" ) ; Integer reloadSettings = MCBans . Settings . reload ( ) ; if ( reloadSettings == - 2 ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . RED + "" ) ; } else if ( reloadSettings == - 1 ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . RED + "" ) ; } else { MCBans . broadcastPlayer ( CommandSend , ChatColor . GREEN + "" ) ; } MCBans . broadcastPlayer ( CommandSend , ChatColor . AQUA + "" ) ; boolean reloadLanguage = MCBans . Language . reload ( ) ; if ( ! reloadLanguage ) { MCBans . broadcastPlayer ( CommandSend , ChatColor . RED + "" ) ; } else { MCBans . broadcastPlayer ( CommandSend , ChatColor . GREEN + "" ) ; } serverChoose serverChooser = new serverChoose ( MCBans ) ; ( new Thread ( serverChooser ) ) . start ( ) ; } else { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "" ) ) ; MCBans . log ( CommandSend + "" + command + "]!" ) ; } } else { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "formatError" ) ) ; } } else { MCBans . broadcastPlayer ( CommandSend , ChatColor . DARK_RED + MCBans . Language . getFormat ( "formatError" ) ) ; } commandSet = true ; break ; } return commandSet ; } private String getReason ( String [ ] args , String reason , int start ) { for ( int
67
<s> package com . asakusafw . dmdl . thundergate . source ; import java . io . Closeable ; import java . io . IOException ; import java . sql . Connection ; import java . sql . DriverManager ; import java . sql . PreparedStatement ; import java . sql . ResultSet ; import java . sql . SQLException ; import java . util . List ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . dmdl . thundergate . ModelMatcher ; import com . asakusafw . dmdl . thundergate . model . Attribute ; import com . asakusafw . dmdl . thundergate . model . DecimalType ; import com . asakusafw . dmdl . thundergate . model . ModelDescription ; import com . asakusafw . dmdl . thundergate . model . ModelRepository ; import com . asakusafw . dmdl . thundergate . model . PropertyTypeKind ; import com . asakusafw . dmdl . thundergate . model . StringType ; import com . asakusafw . dmdl . thundergate . util . TableModelBuilder ; import com . asakusafw . dmdl . thundergate . view . ViewAnalyzer ; import com . asakusafw . dmdl . thundergate . view . ViewDefinition ; import com . asakusafw . dmdl . thundergate . view . ViewParser ; import com . asakusafw . dmdl . thundergate . view . model . CreateView ; import com . asakusafw . utils . collections . Lists ; public class DatabaseSource implements Closeable { @ SuppressWarnings ( "unused" ) private static final String STR_IS_PK = "PRI" ; private static final String STR_NOT_NULL = "NO" ; static final Logger LOG = LoggerFactory . getLogger ( DatabaseSource . class ) ; private final Connection conn ; private final String databaseName ; public DatabaseSource ( String jdbcDriver , String jdbcUrl , String user , String password , String databaseName ) throws IOException , SQLException { if ( jdbcDriver == null ) { throw new IllegalArgumentException ( "" ) ; } if ( jdbcUrl == null ) { throw new IllegalArgumentException ( "" ) ; } if ( user == null ) { throw new IllegalArgumentException ( "" ) ; } if ( password == null ) { throw new IllegalArgumentException ( "" ) ; } if ( databaseName == null ) { throw new IllegalArgumentException ( "" ) ; } this . databaseName = databaseName ; try { Class . forName ( jdbcDriver ) ; } catch ( ClassNotFoundException e ) { throw new IOException ( "" , e ) ; } conn = DriverManager . getConnection ( jdbcUrl , user , password ) ; } public List < ModelDescription > collectTables ( ModelMatcher filter ) throws IOException , SQLException { String sql = "" + "SELECT" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" ; List < ModelDescription > results = Lists . create ( ) ; PreparedStatement ps = null ; ResultSet rs = null ; try { ps = conn . prepareStatement ( sql ) ; ps . setString ( 1 , databaseName ) ; rs = ps . executeQuery ( ) ; String prevTableName = null ; TableModelBuilder builder = null ; while ( rs . next ( ) ) { String tableName = rs . getString ( 1 ) ; String columnName = rs . getString ( 2 ) ; String columnComment = rs . getString ( 3 ) ; String dataType = rs . getString ( 4 ) ; long characterMaximumLength = rs . getLong ( 5 ) ; int numericPrecision = rs . getInt ( 6 ) ; int numericScale = rs . getInt ( 7 ) ; String isNullable = rs . getString ( 8 ) ; String columnKey = rs . getString ( 9 ) ; if ( filter . acceptModel ( tableName ) == false ) { if ( tableName . equals ( prevTableName ) == false ) { LOG . info ( "" , tableName ) ; prevTableName = tableName ; } continue ; } if ( builder == null || prevTableName == null || prevTableName . equals ( tableName ) == false ) { if ( builder != null ) { results . add ( builder . toDescription ( ) ) ; } builder = new TableModelBuilder ( tableName ) ; prevTableName = tableName ; } PropertyTypeKind propertyType = MySqlDataType . getPropertyTypeByString ( dataType ) ; if ( propertyType == null ) { LOG . error ( "" , new Object [ ] { dataType , tableName , columnName , } ) ; continue ; } List < Attribute > attributeList = Lists . create ( ) ; if ( isNullable != null && isNullable . equals ( STR_NOT_NULL ) ) { attributeList . add ( Attribute . NOT_NULL ) ; } if ( columnKey != null && columnKey . equals ( MySQLConstants . STR_IS_PK ) ) { attributeList . add ( Attribute . PRIMARY_KEY ) ; } Attribute [ ] attributes = attributeList . toArray ( new Attribute [ attributeList . size ( ) ] ) ; switch ( propertyType ) { case BIG_DECIMAL : DecimalType decimalType = new DecimalType ( numericPrecision , numericScale ) ; builder . add ( columnComment , columnName , decimalType , attributes ) ; break ; case STRING : StringType stringType = new StringType ( ( int ) characterMaximumLength ) ; builder . add ( columnComment , columnName , stringType , attributes ) ; break ; default : builder . add ( columnComment , columnName , propertyType , attributes ) ; break ; } } if ( builder != null ) { results . add ( builder . toDescription ( ) ) ; } } finally { if ( rs != null ) { try { rs . close ( ) ; } catch ( Exception e ) { LOG . debug ( "" , e ) ; } } if ( ps != null ) {
68
<s> package org . rubypeople . rdt . internal . debug . ui . launcher ; import java . io . File ; import java . util . HashSet ; import java . util . Set ; import junit . framework . Assert ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . debug . core . DebugPlugin ; import org . eclipse . debug . core . ILaunchConfiguration ; import org . eclipse . debug . core . ILaunchConfigurationType ; import org . eclipse . debug . core . ILaunchConfigurationWorkingCopy ; import org . eclipse . debug . core . ILaunchManager ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . part . FileEditorInput ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . tests . ModifyingResourceTest ; import org . rubypeople . rdt . debug . ui . RdtDebugUiConstants ; import org . rubypeople . rdt . internal . debug . ui . RdtDebugUiPlugin ; import org . rubypeople . rdt . internal . debug . ui . RubySourceLocator ; import org . rubypeople . rdt . internal . launching . RubyLaunchConfigurationAttribute ; import org . rubypeople . rdt . launching . IRubyLaunchConfigurationConstants ; import org . rubypeople . rdt . launching . IVMInstall ; import org . rubypeople . rdt . launching . IVMInstallType ; import org . rubypeople . rdt . launching . RubyRuntime ; import org . rubypeople . rdt . launching . VMStandin ; import org . rubypeople . rdt . ui . RubyUI ; public class TC_RubyApplicationShortcut extends ModifyingResourceTest { private static final String VM_TYPE_ID = "" ; protected ShamRubyApplicationShortcut shortcut ; protected IFile rubyFile , nonRubyFile ; private static String SHAM_LAUNCH_CONFIG_TYPE = "" ; private Set configurations = new HashSet ( ) ; public TC_RubyApplicationShortcut ( String name ) { super ( name ) ; } protected ILaunchConfiguration createConfiguration ( IFile pFile ) { ILaunchConfiguration config = null ; try { ILaunchConfigurationType configType = DebugPlugin . getDefault ( ) . getLaunchManager ( ) . getLaunchConfigurationType ( SHAM_LAUNCH_CONFIG_TYPE ) ; ILaunchConfigurationWorkingCopy wc = configType . newInstance ( null , pFile . getName ( ) ) ; wc . setAttribute ( IRubyLaunchConfigurationConstants . ATTR_PROJECT_NAME , pFile . getProject ( ) . getName ( ) ) ; wc . setAttribute ( IRubyLaunchConfigurationConstants . ATTR_FILE_NAME , pFile . getProjectRelativePath ( ) . toString ( ) ) ; wc . setAttribute ( IRubyLaunchConfigurationConstants . ATTR_WORKING_DIRECTORY , "" ) ; wc . setAttribute ( RubyLaunchConfigurationAttribute . SELECTED_INTERPRETER , RubyRuntime . getCompositeIdFromVM ( RubyRuntime . getDefaultVMInstall ( ) ) ) ; wc . setAttribute ( ILaunchConfiguration . ATTR_SOURCE_LOCATOR_ID , RdtDebugUiConstants . RUBY_SOURCE_LOCATOR ) ; config = wc . doSave ( ) ; } catch ( CoreException ce ) { } return config ; } protected ILaunchConfiguration [ ] getLaunchConfigurations ( ) throws CoreException { return ( ILaunchConfiguration [ ] ) configurations . toArray ( new ILaunchConfiguration [ configurations . size ( ) ] ) ; } private IVMInstallType vmType ; private IVMInstall vm ; protected void setUp ( ) throws Exception { super . setUp ( ) ; shortcut = new ShamRubyApplicationShortcut ( ) ; createRubyProject ( "/project1" ) ; createFolder ( "" ) ; nonRubyFile = createFile ( "" , "" ) ; rubyFile = createFile ( "" , "" ) ; ILaunchConfiguration [ ] configs = this . getLaunchConfigurations ( ) ; for ( int i = 0 ; i < configs . length ; i ++ ) { configs [ i ] . delete ( ) ; } Assert . assertEquals ( "" , 0 , this . getLaunchConfigurations ( ) . length ) ; ShamApplicationLaunchConfigurationDelegate . resetLaunches ( ) ; vmType = RubyRuntime . getVMInstallType ( VM_TYPE_ID ) ; VMStandin standin = new VMStandin ( vmType , "fake" ) ; IFolder location = createFolder ( "" ) ; createFolder ( "" ) ; createFolder ( "" ) ; createFile ( "" , "" ) ; standin . setInstallLocation ( location . getLocation ( ) . toFile ( ) ) ; standin . setName ( "" ) ; vm = standin . convertToRealVM ( ) ; RubyRuntime . setDefaultVMInstall ( vm , null , true ) ; } @ Override protected void tearDown ( ) throws Exception { super . tearDown ( ) ; vmType . disposeVMInstall ( vm . getId ( ) ) ; deleteProject ( "/project1" ) ; configurations . clear ( ) ; } public void testNoInterpreterInstalled ( ) throws Exception { vmType . disposeVMInstall ( vm . getId ( ) ) ; RubyRuntime . setDefaultVMInstall ( null , null , true ) ; ISelection selection = new StructuredSelection ( rubyFile ) ; shortcut . launch ( selection , ILaunchManager . RUN_MODE ) ; assertTrue ( "" , shortcut . didShowDialog ) ; } public void testLaunchWithSelectedRubyFile ( ) throws Exception { ISelection selection = new StructuredSelection ( rubyFile ) ; shortcut . launch ( selection , ILaunchManager . RUN_MODE ) ; assertEquals ( "" , 1 , getLaunchConfigurations ( ) . length ) ; assertEquals ( "" , 1 , shortcut . launchCount ( ) ) ; assertTrue ( "" , ! shortcut . didLog ( ) ) ; } public void testLaunchWithSelectedNonRubyFile ( ) throws Exception { ISelection selection = new StructuredSelection ( nonRubyFile ) ; shortcut . launch ( selection , ILaunchManager . RUN_MODE ) ; assertEquals ( "" , 0 , this . getLaunchConfigurations ( ) . length ) ; assertEquals ( "" , 0 , shortcut . launchCount ( ) ) ; assertTrue ( "" , shortcut . didLog ( ) ) ; } public void testLaunchWithSelectionMultipleConfigurationsExist ( ) throws Exception { createConfiguration ( rubyFile ) ; createConfiguration ( rubyFile ) ; ISelection selection = new StructuredSelection ( rubyFile ) ; shortcut . launch ( selection , ILaunchManager . RUN_MODE ) ; assertEquals ( "" , 1 , this . getLaunchConfigurations ( ) . length ) ; assertEquals ( "" , 1 , shortcut . launchCount ( ) ) ; } public void testLaunchWithSelectionMultipleSelections ( ) throws Exception { ISelection selection = new StructuredSelection ( new Object [ ] { rubyFile , createFile ( "" , "" ) } ) ; shortcut . launch ( selection , ILaunchManager . RUN_MODE ) ; ILaunchConfiguration [ ] configurations = this . getLaunchConfigurations ( ) ; assertEquals ( "" , 1 , configurations . length ) ; assertEquals ( "" , 1 , shortcut . launchCount ( ) ) ; assertTrue ( "" , ! shortcut . didLog ( ) ) ; String launchedFileName = configurations [ 0 ] . getAttribute ( IRubyLaunchConfigurationConstants . ATTR_FILE_NAME , "" ) ; assertEquals ( "" , launchedFileName ) ; } public void testLaunchWithSelectionTwice ( ) throws Exception { ISelection selection = new StructuredSelection ( rubyFile ) ; shortcut . launch ( selection , ILaunchManager . RUN_MODE ) ; shortcut . launch ( selection , ILaunchManager . RUN_MODE ) ; assertEquals ( "" , 1 , this . getLaunchConfigurations ( ) . length ) ; assertEquals ( "" , 2 , shortcut . launchCount ( ) ) ; assertTrue ( "" , !
69
<s> package com . asakusafw . utils . java . internal . model . syntax ; import java . util . List ; import com . asakusafw . utils . java . model . syntax . ArrayInitializer ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class ArrayInitializerImpl extends ModelRoot implements ArrayInitializer { private List < ? extends Expression > elements ; @ Override public List < ? extends Expression > getElements ( ) { return this . elements ; }
70
<s> package com . asakusafw . compiler . testing . flow ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . testing . TemporaryOutputDescription ; public class Out4ExporterDesc extends TemporaryOutputDescription { @ Override public Class
71
<s> package com . asakusafw . runtime . directio ; import java . io . IOException ; import java . util . List ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . ModelOutput ; public interface DirectDataSource { < T > List < DirectInputFragment >
72
<s> package org . rubypeople . rdt . internal . core . parser ; import org . eclipse . core . resources . IMarker ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . rubypeople . rdt . core . IRubyModelMarker ; class IgnoreMarker { private IResource resource ; private int id ; private int offset ; private int endOffset ; IgnoreMarker ( IMarker marker ) throws CoreException { this . id = ( ( Integer ) marker . getAttribute ( IRubyModelMarker . ID ) ) . intValue ( ) ; this . offset = ( ( Integer ) marker . getAttribute ( IMarker . CHAR_START ) ) . intValue ( ) ; this . endOffset = ( ( Integer ) marker . getAttribute ( IMarker . CHAR_END ) ) . intValue ( ) ; this . resource = marker . getResource ( ) ; } public int getEndOffset ( ) { return endOffset ; } public int getOffset ( ) { return offset ; } public int getId ( ) { return id ; }
73
<s> package org . rubypeople . rdt . internal . ui . text . ruby ; import java . io . IOException ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . runtime . IProgressMonitor ; import org . rubypeople . rdt . core . IMember ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . util . RDocUtil ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . infoviews . RiUtility ; public class ProposalInfo { private boolean fRubydocResolved = false ; private String fRubydoc = null ; protected IRubyElement fElement ; public ProposalInfo ( IMember member ) { fElement = member ; } protected ProposalInfo ( ) { fElement = null ; } public IRubyElement getRubyElement ( ) throws RubyModelException { return fElement ; } public final String getInfo ( IProgressMonitor monitor ) { if ( ! fRubydocResolved ) { fRubydocResolved = true ; fRubydoc = computeInfo ( monitor ) ; } return fRubydoc ; }
74
<s> package org . oddjob . script ; import java . io . IOException ; import junit . framework . TestCase ; import org . oddjob . arooa . convert . DefaultConverter ; import org . oddjob . io . BufferType ; import org . oddjob . state . JobState ; public class ScriptInvokerTest extends TestCase { public void testInvokeScript ( ) throws IOException { BufferType buffer = new BufferType ( ) ; buffer . setText ( ""
75
<s> package com . asakusafw . testdriver . core ; import java . io . IOException ; import java . net . URI ; public interface
76
<s> package org . rubypeople . rdt . internal . core . parser ; import java . util . Collections ; import java . util . List ; import org . jruby . ast . CommentNode ; import org . jruby . ast . Node ; import org . jruby . parser . RubyParserResult ; import org . jruby . runtime . DynamicScope ; public class NullParserResult extends RubyParserResult { @ Override public Node
77
<s> package com . asakusafw . yaess . core . util ; import static org . hamcrest . CoreMatchers . * ; import static org . junit . Assert . * ; import java . io . ByteArrayInputStream ; import java . io . ByteArrayOutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import org . junit . Test ; public class StreamRedirectTaskTest { private static final byte [ ] BYTES = new byte [ 65536 ] ; static { for ( int i = 0 ; i < BYTES . length ; i ++ ) { BYTES [ i ] = ( byte ) ( ( i >> 8 ) ^ i ) ; } } private final TestInputStream in = new TestInputStream ( BYTES ) ; private final TestOutputStream out = new TestOutputStream ( ) ; @ Test ( timeout = 10000 ) public void redirect ( ) { StreamRedirectTask t = new StreamRedirectTask ( in , out ) ; t . run ( ) ; assertThat ( out . toByteArray ( ) , is ( BYTES ) ) ; assertThat ( in . read ( ) , is ( - 1 ) ) ; assertThat ( in . closed , is ( false ) ) ; assertThat ( out . closed , is ( false ) ) ; } @ Test ( timeout = 10000 ) public void quietExitOnInputError ( ) throws Exception { StreamRedirectTask t = new StreamRedirectTask ( new ErroneousInputStream ( 65534 ) , out ) ; t . run ( ) ; } @ Test ( timeout = 10000 ) public void quietExitOnOutputError ( ) throws Exception { StreamRedirectTask t = new StreamRedirectTask ( in , new ErroneousOutputStream ( 65534 ) ) ; t . run ( ) ; assertThat ( "" , in . read ( ) ,
78
<s> package org . oddjob . framework ; import java . util . HashMap ; import java . util . Map ; import java . util . Properties ; import junit . framework . TestCase ; import org . apache . commons . beanutils . DynaBean ; import org . apache . commons . beanutils . PropertyUtils ; import org . apache . log4j . Level ; import org . apache . log4j . Logger ; import org . oddjob . Describeable ; import org . oddjob . FailedToStopException ; import org . oddjob . Forceable ; import org . oddjob . Helper ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . Resetable ; import org . oddjob . StateSteps ; import org . oddjob . Stateful ; import org . oddjob . Stoppable ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . ArooaTools ; import org . oddjob . arooa . MockArooaSession ; import org . oddjob . arooa . life . ArooaContextAware ; import org . oddjob . arooa . life . ArooaLifeAware ; import org . oddjob . arooa . life . ArooaSessionAware ; import org . oddjob . arooa . parsing . MockArooaContext ; import org . oddjob . arooa . registry . ComponentPool ; import org . oddjob . arooa . registry . MockComponentPool ; import org . oddjob . arooa . runtime . MockRuntimeConfiguration ; import org . oddjob . arooa . runtime . RuntimeConfiguration ; import org . oddjob . arooa . runtime . RuntimeListener ; import org . oddjob . arooa . standard . StandardArooaDescriptor ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . standard . StandardTools ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . describe . UniversalDescriber ; import org . oddjob . logging . LogEnabled ; import org . oddjob . logging . LogEvent ; import org . oddjob . logging . LogLevel ; import org . oddjob . logging . LogListener ; import org . oddjob . logging . log4j . Log4jArchiver ; import org . oddjob . state . JobState ; import org . oddjob . state . ParentState ; import org . oddjob . state . StateEvent ; import org . oddjob . state . StateListener ; public class RunnableWrapperTest extends TestCase { private class OurContext extends MockArooaContext { OurSession session ; @ Override public ArooaSession getSession ( ) { return session ; } @ Override public RuntimeConfiguration getRuntime ( ) { return new MockRuntimeConfiguration ( ) { @ Override public void addRuntimeListener ( RuntimeListener listener ) { } } ; } } private class OurSession extends MockArooaSession { Object configured ; Object saved ; ArooaDescriptor descriptor = new StandardArooaDescriptor ( ) ; @ Override public ArooaDescriptor getArooaDescriptor ( ) { return descriptor ; } @ Override public ComponentPool getComponentPool ( ) { return new MockComponentPool ( ) { @ Override public void configure ( Object component ) { configured = component ; } @ Override public void save ( Object component ) { saved = component ; } } ; } @ Override public ArooaTools getTools ( ) { return new StandardTools ( ) ; } } public static class OurRunnable implements Runnable { boolean ran ; public void run ( ) { ran = true ; } public boolean isRan ( ) { return ran ; } public String toString ( ) { return "OurRunnable" ; } } public void testGoodRunnable ( ) { OurSession session = new OurSession ( ) ; OurContext context = new OurContext ( ) ; context . session = session ; OurRunnable test = new OurRunnable ( ) ; Object proxy = new RunnableProxyGenerator ( ) . generate ( ( Runnable ) test , getClass ( ) . getClassLoader ( ) ) ; ( ( ArooaSessionAware ) proxy ) . setArooaSession ( session ) ; ( ( ArooaContextAware ) proxy ) . setArooaContext ( context ) ; MyStateListener stateListener = new MyStateListener ( ) ; ( ( Stateful ) proxy ) . addStateListener ( stateListener ) ; assertSame ( proxy , stateListener . lastEvent . getSource ( ) ) ; ( ( Runnable ) proxy ) . run ( ) ; assertEquals ( proxy , session . configured ) ; assertEquals ( proxy , session . saved ) ; assertTrue ( test . ran ) ; assertEquals ( "JobState" , JobState . COMPLETE , stateListener . lastEvent . getState ( ) ) ; session . saved = null ; ( ( Resetable ) proxy ) . hardReset ( ) ; assertEquals ( "JobState" , JobState . READY , stateListener . lastEvent . getState ( ) ) ; assertEquals ( proxy , session . saved ) ; ( ( Forceable ) proxy ) . force ( ) ; assertEquals ( "JobState" , JobState . COMPLETE , stateListener . lastEvent . getState ( ) ) ; } public void testBadRunnable ( ) { Runnable test = new Runnable ( ) { public void run ( ) { throw new RuntimeException ( "" ) ; } } ; Object proxy = new RunnableProxyGenerator ( ) . generate ( ( Runnable ) test ,
79
<s> package net . sf . sveditor . core . db . expr ; import net . sf . sveditor . core . db . SVDBItemType ;
80
<s> package org . rubypeople . rdt . internal . formatter ; import java . util . Map ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; import java . util . regex . PatternSyntaxException ; import org . eclipse . core . runtime . Platform ; import org . eclipse . text . edits . ReplaceEdit ; import org . eclipse . text . edits . TextEdit ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . formatter . CodeFormatter ; import org . rubypeople . rdt . core . formatter . DefaultCodeFormatterConstants ; import org . rubypeople . rdt . core . formatter . Indents ; public class OldCodeFormatter extends CodeFormatter { private final static String BLOCK_BEGIN_RE = "" ; private String BLOCK_MID_RE = "" ; private final static String BLOCK_END_RE = "(end)" ; private final static String DELIMITER_RE = "" ; private final static String [ ] LITERAL_BEGIN_LITERALS = { "\"" , "'" , "=begin" , "%[Qqrxw]?." , "/" , "" , "" } ; private final static String [ ] LITERAL_END_RES = { "" , "" , "=end" , "" , "" , "" , "" } ; private final int BLOCK_BEGIN_PAREN = 2 ; private final int BLOCK_MID_PAREN = 5 ; private final int BLOCK_END_PAREN = 8 ; private final int LITERAL_BEGIN_PAREN = 10 ; private static Pattern MODIFIER_RE ; private static Pattern OPERATOR_RE ; private static Pattern NON_BLOCK_DO_RE ; private static String LITERAL_BEGIN_RE ; private static Pattern [ ] LITERAL_END_RES_COMPILED ; static { LITERAL_END_RES_COMPILED = new Pattern [ LITERAL_END_RES . length ] ; for ( int i = 0 ; i < LITERAL_END_RES . length ; i ++ ) { try { LITERAL_END_RES_COMPILED [ i ] = Pattern . compile ( LITERAL_END_RES [ i ] ) ; } catch ( PatternSyntaxException e ) { System . out . println ( e ) ; } } StringBuffer sb = new StringBuffer ( ) ; sb . append ( "(" ) ; for ( int i = 0 ; i < LITERAL_BEGIN_LITERALS . length ; i ++ ) { sb . append ( LITERAL_BEGIN_LITERALS [ i ] ) ; if ( i < LITERAL_BEGIN_LITERALS . length - 1 ) { sb . append ( "|" ) ; } } sb . append ( ")" ) ; LITERAL_BEGIN_RE = sb . toString ( ) ; try { MODIFIER_RE = Pattern . compile ( "" ) ; OPERATOR_RE = Pattern . compile ( "" ) ; NON_BLOCK_DO_RE = Pattern . compile ( "" ) ; } catch ( PatternSyntaxException e ) { System . out . println ( e ) ; } } private DefaultCodeFormatterOptions preferences ; private Map options ; public OldCodeFormatter ( ) { this ( new DefaultCodeFormatterOptions ( DefaultCodeFormatterConstants . getRubyConventionsSettings ( ) ) , null ) ; } public OldCodeFormatter ( DefaultCodeFormatterOptions preferences ) { this ( preferences , null ) ; } public OldCodeFormatter ( DefaultCodeFormatterOptions defaultCodeFormatterOptions , Map options ) { if ( options != null ) { this . options = options ; this . preferences = new DefaultCodeFormatterOptions ( options ) ; } else { this . options = RubyCore . getOptions ( ) ; this . preferences = new DefaultCodeFormatterOptions ( DefaultCodeFormatterConstants . getRubyConventionsSettings ( ) ) ; } if ( defaultCodeFormatterOptions != null ) { this . preferences . set ( defaultCodeFormatterOptions . getMap ( ) ) ; } } public OldCodeFormatter ( Map options ) { this ( null , options ) ; } public synchronized String formatString ( String unformatted ) { AbstractBlockMarker firstAbstractBlockMarker = this . createBlockMarkerList ( unformatted ) ; if ( isDebug ( ) ) { firstAbstractBlockMarker . print ( ) ; } int initialIndentLevel = Indents . measureIndentUnits ( unformatted , preferences . tab_size , preferences . indentation_size ) ; try { return this . formatString ( unformatted , firstAbstractBlockMarker , initialIndentLevel ) ; } catch ( PatternSyntaxException ex ) { return unformatted ; } } private boolean isDebug ( ) { String codeFormatterOption = Platform . getDebugOption ( RubyCore . PLUGIN_ID + "" ) ; boolean isDebug = codeFormatterOption == null ? false : codeFormatterOption . equalsIgnoreCase ( "true" ) ; return isDebug ; } protected String formatString ( String unformatted , AbstractBlockMarker abstractBlockMarker , int initialIndentLevel ) throws PatternSyntaxException { Pattern pat = Pattern . compile ( "n" ) ; String [ ] lines = pat . split ( unformatted ) ; IndentationState state = null ; StringBuffer formatted = new StringBuffer ( ) ; Pattern whitespacePattern = Pattern . compile ( "^[t ]*" ) ; for ( int i = 0 ; i < lines . length ; i ++ ) { Matcher whitespaceMatcher = whitespacePattern . matcher ( lines [ i ] ) ; whitespaceMatcher . find ( ) ; int leadingWhitespace = whitespaceMatcher . end ( 0 ) ; if ( state == null ) { state = new IndentationState ( unformatted , leadingWhitespace , initialIndentLevel ) ; } state . incPos ( leadingWhitespace ) ; String strippedLine = new String ( lines [ i ] . substring ( leadingWhitespace ) ) ; AbstractBlockMarker newBlockMarker = this . findNextBlockMarker ( abstractBlockMarker , state . getPos ( ) , state ) ; if ( newBlockMarker != null ) { newBlockMarker . indentBeforePrint ( state ) ; newBlockMarker . appendIndentedLine ( formatted , state , lines [ i ] , strippedLine , options ) ; newBlockMarker . indentAfterPrint ( state ) ; abstractBlockMarker = newBlockMarker ; } else { abstractBlockMarker . appendIndentedLine ( formatted , state , lines [ i ] , strippedLine , options ) ; } if ( i != lines . length - 1 ) { formatted . append ( "n" ) ; } state . incPos ( strippedLine . length ( ) + 1 ) ; } if ( unformatted . lastIndexOf ( "n" ) == unformatted . length ( ) - 1 ) { formatted . append ( "n" ) ; } return formatted . toString ( ) ; } private AbstractBlockMarker findNextBlockMarker ( AbstractBlockMarker abstractBlockMarker , int pos , IndentationState state ) { AbstractBlockMarker startBlockMarker = abstractBlockMarker ; while ( abstractBlockMarker . getNext ( ) != null && abstractBlockMarker . getNext ( ) . getPos ( ) <= pos ) { if ( abstractBlockMarker != startBlockMarker ) { abstractBlockMarker . indentBeforePrint ( state ) ; abstractBlockMarker . indentAfterPrint ( state ) ; } abstractBlockMarker = abstractBlockMarker . getNext ( ) ; } return startBlockMarker == abstractBlockMarker ? null : abstractBlockMarker ; } protected AbstractBlockMarker createBlockMarkerList ( String unformatted ) { Pattern pat = null ; try { pat = Pattern . compile ( "(^|[\\s]|;)" + BLOCK_BEGIN_RE + "($|[\\s]|" + DELIMITER_RE + ")|(^|[\\s])" + getBlockMiddleRegex ( ) + "($|[\\s]|" + DELIMITER_RE + ")|(^|[\\s]|;)" + BLOCK_END_RE + "($|[\\s]|;)|" + LITERAL_BEGIN_RE + "|" + DELIMITER_RE ) ; } catch ( PatternSyntaxException e ) { System . out . println ( e ) ; } int pos = 0 ; AbstractBlockMarker lastBlockMarker = new NeutralMarker ( "start" , 0 ) ; AbstractBlockMarker firstBlockMarker = lastBlockMarker ; Matcher re = pat . matcher ( unformatted ) ; while ( pos != - 1 && re . find ( pos ) ) { AbstractBlockMarker newBlockMarker = null ; if ( re . group ( BLOCK_BEGIN_PAREN ) != null ) { pos = re . end ( BLOCK_BEGIN_PAREN ) ; String blockBeginStr = re . group ( BLOCK_BEGIN_PAREN ) ; if ( MODIFIER_RE . matcher ( blockBeginStr ) . matches ( ) && ! this . isRubyExprBegin ( unformatted , re . start ( BLOCK_BEGIN_PAREN ) , "modifier" ) ) { continue ; } if ( blockBeginStr . equals ( "do" ) && this . isNonBlockDo ( unformatted , re . start ( BLOCK_BEGIN_PAREN ) ) ) { continue ; } newBlockMarker = new BeginBlockMarker ( re . group ( BLOCK_BEGIN_PAREN ) , re . start ( BLOCK_BEGIN_PAREN ) ) ; } else if ( re . group ( BLOCK_MID_PAREN ) != null
81
<s> package com . asakusafw . compiler . flow . join ; import java . text . MessageFormat ; import java . util . Collections ; import java . util . List ; import java . util . Set ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . DataClass ; import com . asakusafw . compiler . flow . DataClass . Property ; import com . asakusafw . vocabulary . flow . graph . FlowResourceDescription ; import com . asakusafw . vocabulary . flow . graph . InputDescription ; public class JoinResourceDescription implements FlowResourceDescription { private InputDescription masterInput ; private DataClass masterDataClass ; private List < DataClass . Property > masterJoinKeys ; private DataClass transactionDataClass ; private List < DataClass . Property > transactionJoinKeys ; public JoinResourceDescription ( InputDescription masterInput , DataClass masterDataClass , List < Property > masterJoinKeys , DataClass transactionDataClass , List < Property > transactionJoinKeys ) { Precondition . checkMustNotBeNull ( masterInput , "masterInput" ) ; Precondition . checkMustNotBeNull ( masterDataClass , "" ) ; Precondition . checkMustNotBeNull ( masterJoinKeys , "" ) ; Precondition . checkMustNotBeNull ( transactionDataClass , "" ) ; Precondition . checkMustNotBeNull ( transactionJoinKeys , "" ) ; this . masterInput = masterInput ; this . masterDataClass = masterDataClass ; this . masterJoinKeys = masterJoinKeys ; this . transactionDataClass = transactionDataClass ; this . transactionJoinKeys = transactionJoinKeys ; } @ Override public Set < InputDescription > getSideDataInputs ( ) { return Collections . singleton ( masterInput ) ; } public String getCacheName ( ) { return masterInput . getName ( ) ; } public DataClass getMasterDataClass ( ) { return masterDataClass ; } public DataClass getTransactionDataClass ( ) { return transactionDataClass ; } public List < DataClass . Property > getMasterJoinKeys ( ) { return masterJoinKeys ; } public List < DataClass . Property > getTransactionJoinKeys ( ) { return transactionJoinKeys ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + masterDataClass . hashCode ( ) ; result = prime * result + masterInput . hashCode ( ) ; result = prime * result + masterJoinKeys . hashCode ( ) ; result = prime * result + transactionDataClass . hashCode ( ) ; result = prime * result + transactionJoinKeys . hashCode ( ) ; return result ; } @ Override public boolean equals ( Object obj ) { if ( this == obj ) { return true ; } if ( obj == null ) { return false ; } if
82
<s> package net . sf . sveditor . core . db . stmt ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . expr . SVDBExpr ; public class SVDBConstraintDistListStmt extends SVDBStmt { public List < SVDBExpr > fLHS ; public List < SVDBConstraintDistListItem > fDistItems ; public SVDBConstraintDistListStmt ( ) { super ( SVDBItemType . ConstraintDistListStmt ) ; fLHS = new ArrayList < SVDBExpr > ( ) ; fDistItems = new ArrayList < SVDBConstraintDistListItem > ( ) ; } public void addLHS ( SVDBExpr lhs ) { fLHS . add ( lhs ) ; } public List < SVDBExpr > getLHS
83
<s> package org . oddjob ; import java . io . IOException ; import junit . framework . TestCase ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . state . JobState ; import org . oddjob . state . ParentState ; public class OddjobSerializeTest extends TestCase { public void testSerializeAndReRun ( ) throws IOException , ClassNotFoundException { String xml = "<oddjob>" + " <job>" + "" + " </job>" + "</oddjob>" ; Oddjob test = new Oddjob ( ) ; test . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; test . run ( ) ; assertEquals ( ParentState . COMPLETE , test . lastStateEvent ( ) . getState ( ) ) ; assertEquals ( "Apples"
84
<s> package org . oddjob . state ; import org . oddjob . Stateful ; public interface State { public boolean isReady ( ) ; public boolean isStoppable (
85
<s> package org . rubypeople . rdt . refactoring . tests . core . renameclass ; import java . io . FileNotFoundException ; import java . io . IOException ; import org . eclipse . jface . text . BadLocationException ; import org . rubypeople . rdt . refactoring . core . renameclass . RenameClassConditionChecker ; import org . rubypeople . rdt . refactoring . core . renameclass . RenameClassConfig ; import org . rubypeople . rdt . refactoring . core . renameclass . RenameClassEditProvider ; import org . rubypeople .
86
<s> package org . oddjob . monitor . model ; import javax . swing . event . TreeModelListener ; import javax . swing . tree . TreeNode ; public interface TreeEventDispatcher { public void addTreeModelListener (
87
<s> package com . asakusafw . utils . java . model . syntax ; public enum ImportKind { SINGLE_TYPE ( Target . TYPE , Range . SINGLE ) , TYPE_ON_DEMAND ( Target . TYPE , Range . ON_DEMAND ) , SINGLE_STATIC ( Target . MEMBER , Range . SINGLE ) , STATIC_ON_DEMAND ( Target . MEMBER
88
<s> package de . fuberlin . wiwiss . d2rq . find ; import java . util . ArrayList ; import java . util . Collection ; import java . util . List ; import com . hp . hpl . jena . graph . Triple ; import com . hp . hpl . jena . sparql . engine . ExecutionContext ; import com . hp . hpl . jena . sparql . engine . iterator . QueryIter ; import com . hp . hpl . jena . sparql . engine . iterator . QueryIterConcat ; import de . fuberlin . wiwiss . d2rq . algebra . CompatibleRelationGroup ; import de . fuberlin . wiwiss . d2rq . algebra . JoinOptimizer ; import de . fuberlin . wiwiss . d2rq . algebra . Relation ; import de . fuberlin . wiwiss . d2rq . algebra . TripleRelation ; import de . fuberlin . wiwiss . d2rq . engine . QueryIterTableSQL ; import de . fuberlin . wiwiss . d2rq . find . URIMakerRule . URIMakerRuleChecker ; public class FindQuery { private final Triple triplePattern ; private final Collection < TripleRelation > tripleRelations ; private final int limitPerRelation ; private final ExecutionContext context ; public FindQuery ( Triple triplePattern , Collection < TripleRelation > tripleRelations , ExecutionContext context ) { this ( triplePattern , tripleRelations , Relation . NO_LIMIT , context ) ; } public FindQuery ( Triple triplePattern , Collection < TripleRelation > tripleRelations , int limit , ExecutionContext context ) { this . triplePattern = triplePattern ; this . tripleRelations = tripleRelations ; this . limitPerRelation = limit ; this . context = context ; } private List < TripleRelation > selectedTripleRelations ( ) { URIMakerRule rule = new URIMakerRule ( ) ; List < TripleRelation > sortedTripleRelations = rule . sortRDFRelations ( tripleRelations ) ; URIMakerRuleChecker subjectChecker = rule . createRuleChecker ( triplePattern . getSubject ( ) ) ; URIMakerRuleChecker predicateChecker = rule . createRuleChecker ( triplePattern . getPredicate ( ) ) ; URIMakerRuleChecker objectChecker = rule . createRuleChecker ( triplePattern . getObject ( ) ) ; List < TripleRelation > result = new ArrayList < TripleRelation > ( ) ; for ( TripleRelation tripleRelation : sortedTripleRelations ) {
89
<s> package org . rubypeople . rdt . internal . ui . dialogs ; import java . util . Arrays ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . swt . SWT ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . dialogs . SelectionDialog ; public abstract class SelectionStatusDialog extends SelectionDialog { private MessageLine fStatusLine ; private IStatus fLastStatus ; private Image fImage ; private boolean fStatusLineAboveButtons = false ; public SelectionStatusDialog ( Shell parent ) { super ( parent ) ; } public void setStatusLineAboveButtons ( boolean aboveButtons ) { fStatusLineAboveButtons = aboveButtons ; } public void setImage ( Image image ) { fImage = image ; } public Object getFirstResult ( ) { Object [ ] result = getResult ( ) ; if ( result == null || result . length == 0 ) return null ; return result [ 0 ] ; } protected void setResult ( int position , Object element ) { Object [ ] result = getResult ( ) ; result [ position ] = element ; setResult ( Arrays . asList ( result ) ) ; } protected abstract void computeResult ( ) ; protected void configureShell ( Shell shell ) { super . configureShell ( shell ) ; if ( fImage != null ) shell . setImage ( fImage ) ; } protected void updateStatus ( IStatus status ) { fLastStatus = status ;
90
<s> package com . postmark . java ; import java . util . * ; public class TestClient { public static void main ( String [ ] args ) { List < NameValuePair > headers = new ArrayList < NameValuePair > ( ) ; headers . add ( new NameValuePair ( "HEADER" , "test" ) ) ; PostmarkMessage message = new PostmarkMessage ( args [ 0 ] , args [ 1 ] , args [ 0 ] , args [ 2 ] , args [ 3 ] , args [ 4 ] , false , args [ 5 ] , headers ) ; String apiKey = "" ; if (
91
<s> package org . rubypeople . rdt . internal . ui . rubyeditor ; import org . eclipse . jface .
92
<s> package com . asakusafw . yaess . core . task ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . util . Map ; import com . asakusafw . yaess . core . ExecutionContext ; import com . asakusafw . yaess . core . ExecutionMonitor ; import com . asakusafw . yaess . core . ExecutionScriptHandlerBase ; import com . asakusafw . yaess . core . HadoopScript ; import com . asakusafw . yaess . core . HadoopScriptHandler ; import com . asakusafw . yaess . core . ServiceProfile ; public class TrackingHadoopScriptHandler extends ExecutionScriptHandlerBase implements HadoopScriptHandler {
93
<s> package org . oddjob . monitor . action ; import java . awt . Component ; import java . awt . event . WindowAdapter ; import java . awt . event . WindowEvent ; import javax . swing . JFrame ; import javax . swing . WindowConstants ; import junit . framework . TestCase ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . arooa . design . screem . Form ; import org . oddjob . arooa . design . view . SwingFormFactory ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . monitor . context . ExplorerContext ; import org . oddjob . monitor . model . MockExplorerContext ; import org . oddjob . state . ParentState ; public class DesignInsideActionTest extends TestCase { class OurExplorerContext extends MockExplorerContext { Object object ; @ Override public Object getThisComponent ( ) { return object ; } @ Override public ExplorerContext getParent ( ) { return null ; } } XMLConfiguration config ; DesignInsideAction test = new DesignInsideAction ( ) ; public void testBadRootConfig ( ) throws Exception { config = new XMLConfiguration ( "TEST" , "<wrongxml/>" ) ; Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( config ) ; oddjob . run ( ) ; assertEquals ( ParentState . EXCEPTION , oddjob . lastStateEvent ( ) . getState ( ) ) ; OurExplorerContext explorerContext = new OurExplorerContext ( ) ; explorerContext . object = oddjob ; test . setSelectedContext ( explorerContext ) ; test . prepare ( ) ; assertTrue ( test . isVisible ( ) ) ; assertTrue ( test . isEnabled ( ) ) ; Form form = test . form ( ) ; assertNotNull ( form ) ; test . setSelectedContext ( null ) ; assertFalse ( test . isVisible ( ) ) ; assertFalse ( test . isEnabled ( ) ) ; } public void testGoodRootConfig ( ) throws Exception { config = new XMLConfiguration ( "TEST" , "<oddjob/>" ) ; Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( config ) ; oddjob . run ( ) ; assertEquals ( ParentState . READY , oddjob . lastStateEvent ( ) . getState ( ) ) ; OurExplorerContext explorerContext = new OurExplorerContext ( ) ; explorerContext . object = oddjob ; test . setSelectedContext ( explorerContext ) ; test . prepare ( ) ; assertTrue ( test . isVisible ( ) ) ; assertTrue ( test . isEnabled ( ) ) ; Form form = test . form ( ) ; assertNotNull ( form ) ; test . setSelectedContext ( null ) ; assertFalse ( test . isVisible ( ) ) ; assertFalse ( test . isEnabled ( ) ) ; } public void testNonConfigurationOwner ( ) { String xml = "<oddjob>" + " <job>" + "" + " </job>" + "</oddjob>" ; config = new XMLConfiguration ( "TEST" , xml ) ; Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( config ) ; oddjob . run ( ) ; assertEquals ( ParentState . READY , oddjob . lastStateEvent ( ) . getState ( ) ) ; OurExplorerContext explorerContext = new OurExplorerContext ( ) ; explorerContext . object = new OddjobLookup ( oddjob ) . lookup ( "sequential" ) ; test . setSelectedContext ( explorerContext ) ; test . prepare ( ) ; assertFalse ( test . isVisible ( ) ) ; assertFalse ( test . isEnabled ( ) ) ; test . setSelectedContext ( null ) ; assertFalse ( test . isVisible ( ) ) ; assertFalse ( test . isEnabled ( ) ) ; } public void testNestedOddjobNoConfig ( ) { String xml = "<oddjob>" + " <job>" + "" + " </job>" + "</oddjob>" ; config = new XMLConfiguration ( "TEST" , xml ) ; Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( config ) ; oddjob . load ( ) ; assertEquals ( ParentState . READY , oddjob . lastStateEvent ( ) . getState ( ) ) ; OurExplorerContext explorerContext = new OurExplorerContext ( ) ;
94
<s> package com . pogofish . jadt . comments ; import static com . pogofish . jadt . ast . JDTagSection . _JDTagSection ; import static com . pogofish . jadt . ast . JDToken . _JDAsterisk ; import static com . pogofish . jadt . ast . JDToken . _JDEOL ; import static com . pogofish . jadt . ast . JDToken . _JDTag ; import static com . pogofish . jadt . ast . JDToken . _JDWhiteSpace ; import static com . pogofish . jadt . ast . JDToken . _JDWord ; import static com . pogofish . jadt . ast . JavaComment . _JavaDocComment ; import static com . pogofish . jadt . util . Util . list ; import static junit . framework . Assert . assertEquals ; import java . io . StringReader ; import java . util . List ; import org . junit . Test ; import com . pogofish . jadt . ast . JDTagSection ; import com . pogofish . jadt . ast . JDToken ; import com . pogofish . jadt . ast . JavaComment ; import com . pogofish . jadt . comments . javacc . generated . Token ; import com . pogofish . jadt . javadoc . javacc . JavaDocParserImpl ; import com . pogofish . jadt . printer . ASTPrinter ; import com . pogofish . jadt . util . Util ; public class JavaDocParserTest { private static final JDToken ONEEOL = _JDEOL ( "n" ) ; private static final JDToken ONEWS = _JDWhiteSpace ( " " ) ; private static final List < JDToken > NO_TOKENS = Util . < JDToken > list ( ) ;
95
<s> package org . rubypeople . rdt . internal . core . builder ; import java . io . IOException ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IResourceProxy ; import org . eclipse . core . resources . IResourceProxyVisitor ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . content . IContentDescription ; import org . eclipse . core . runtime . content . IContentType ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . compiler . BuildContext ; public class BuildContextCollector implements IResourceProxyVisitor { private static final String RUBY_SOURCE_CONTENT_TYPE_ID = "" ; private final List < BuildContext > contexts ; private HashSet < String > visitedLinks ; private IRubyProject rubyProject ; public BuildContextCollector ( IProject project ) { this . contexts = new ArrayList < BuildContext > ( ) ; this . visitedLinks = new HashSet < String > ( ) ; this . rubyProject = RubyCore . create ( project ) ; } public boolean visit ( IResourceProxy proxy ) throws CoreException { switch ( proxy . getType ( ) ) { case IResource . FILE : if ( org . rubypeople . rdt . internal . core . util . Util . isRubyLikeFileName ( proxy . getName ( ) ) ) { IFile file = getFile ( proxy ) ; contexts . add ( new BuildContext ( file ) ) ; return false ; } if ( isERB ( proxy . getName ( ) ) ) { IFile file = getFile ( proxy ) ; contexts . add ( new ERBBuildContext ( file ) ) ; return false ; } IFile file = getFile ( proxy ) ; if ( isRubySourceContentType ( file ) ) { contexts . add
96
<s> package org . rubypeople . rdt . internal . launching ; import java . io . File ; import java . io . IOException ; import java . net . URL ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . core . runtime . FileLocator ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . Status ; import org . eclipse . osgi . service . environment . Constants ; import org . osgi . framework . Bundle ; import org . rubypeople . rdt . launching . AbstractVMInstallType ; import org . rubypeople . rdt . launching . IVMInstall ; public class JRubyVMType extends AbstractVMInstallType { private static Map < String , LibraryInfo > fgFailedInstallPath = new HashMap < String , LibraryInfo > ( ) ; private static final char fgSeparator = File . separatorChar ; private static final String [ ] fgCandidateRubyFiles = { "jrubyw" , "jrubyw.bat" , "jruby" , "jruby.bat" } ; private static final String [ ] fgCandidateRubyLocations = { "" , "bin" + fgSeparator } ; @ Override protected IVMInstall doCreateVMInstall ( String id ) { return new JRubyVM ( this , id ) ; } public File detectInstallLocation ( ) { File rubyExecutable = null ; if ( Platform . getOS ( ) . equals ( Constants . OS_WIN32 ) ) { String winPath = System . getenv ( "Path" ) ; String [ ] paths = winPath . split ( ";" ) ; for ( int i = 0 ; i < paths . length ; i ++ ) { String possibleExecutablePath = paths [ i ] + File . separator + "jruby.bat" ; File possible = new File ( possibleExecutablePath ) ; if ( possible . exists ( ) ) { rubyExecutable = possible ; break ; } } } else { String [ ] cmdLine = new String [ ] { "which" , "jruby" } ; rubyExecutable = parseRubyExecutableLocation ( executeAndRead ( cmdLine ) ) ; } File location = tryLocation ( rubyExecutable ) ; if ( location != null ) return location ; return tryIncludedJRuby ( ) ; } private File tryIncludedJRuby ( ) { try { Bundle bundle = Platform . getBundle ( "org.jruby" ) ; URL url = FileLocator . find ( bundle , new Path ( "" ) , null ) ; url = FileLocator . toFileURL ( url ) ; String fileName = url . getFile ( ) ; String executable = fileName + "bin" + File . separator + "jruby" ; if ( Platform . getOS ( ) . equals ( Constants . OS_WIN32 ) ) { executable += ".bat" ; } return tryLocation ( new File ( executable ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return null ; } private File tryLocation ( File rubyExecutable ) { if ( rubyExecutable == null ) { return null ; } File bin = rubyExecutable . getParentFile ( ) ; if ( ! bin . exists ( ) ) return null ; File rubyHome = bin . getParentFile ( ) ; if ( ! rubyHome . exists ( ) ) return null ; if ( ! canDetectDefaultSystemLibraries ( rubyHome , rubyExecutable ) ) { return null ; } return rubyHome ; } public IPath [ ] getDefaultLibraryLocations ( File installLocation ) { File rubyExecutable = findRubyExecutable ( installLocation ) ; LibraryInfo info ; if ( rubyExecutable == null ) { info = getDefaultLibraryInfo ( installLocation ) ; } else { info = getLibraryInfo ( installLocation , rubyExecutable ) ; } String [ ] loadpath = info . getBootpath ( ) ; IPath [ ] paths = new IPath [ loadpath . length ] ; for ( int i = 0 ; i < loadpath . length ; i ++ ) { paths [ i ] = new Path ( loadpath [ i ] ) ; } return paths ; } public String getName ( ) { return "JRuby VM" ; } public IStatus validateInstallLocation ( File rubyHome ) { IStatus status = null ; File rubyExecutable = findRubyExecutable ( rubyHome ) ; if ( rubyExecutable == null ) { status = new Status ( IStatus . ERROR , LaunchingPlugin . getUniqueIdentifier ( ) , 0 , LaunchingMessages . StandardVMType_Not_a_JDK_Root__Java_executable_was_not_found_1 , null ) ; } else { if ( canDetectDefaultSystemLibraries ( rubyHome , rubyExecutable ) ) { status = new Status ( IStatus . OK , LaunchingPlugin . getUniqueIdentifier ( ) , 0 , LaunchingMessages . StandardVMType_ok_2 , null ) ; } else { status =
97
<s> package org . rubypeople . rdt . ui . text .
98
<s> package test . modelgen . dummy . model ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import java . math . BigDecimal ; import javax . annotation . Generated ; import org . apache . hadoop . io . Text ; import org . apache . hadoop . io . Writable ; import com . asakusafw . runtime . value . ByteOption ; import com . asakusafw . runtime . value . Date ; import com . asakusafw . runtime . value . DateOption ; import com . asakusafw . runtime . value . DecimalOption ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . runtime . value . StringOption ; import com . asakusafw . vocabulary . model . Property ; import com . asakusafw . vocabulary . model . TableModel ; @ TableModel ( name = "foo" , primary = { } ) @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public class Foo implements Writable { @ Property ( name = "PK" ) private LongOption pk = new LongOption ( ) ; @ Property ( name = "" ) private StringOption detailGroupId = new StringOption ( ) ; @ Property ( name = "DETAIL_TYPE" ) private StringOption detailType = new StringOption ( ) ; @ Property ( name = "" ) private StringOption detailSenderId = new StringOption ( ) ; @ Property ( name = "" ) private StringOption detailReceiverId = new StringOption ( ) ; @ Property ( name = "" ) private StringOption detailTestType = new StringOption ( ) ; @ Property ( name = "" ) private StringOption detailStatus = new StringOption ( ) ; @ Property ( name = "" ) private IntOption detailLineNo = new IntOption ( ) ; @ Property ( name = "DELETE_FLG" ) private StringOption deleteFlg = new StringOption ( ) ; @ Property ( name = "" ) private DateOption insertDatetime = new DateOption ( ) ; @ Property ( name = "" ) private DateOption updateDatetime = new DateOption ( ) ; @ Property ( name = "PURCHASE_NO" ) private StringOption purchaseNo = new StringOption ( ) ; @ Property ( name = "" ) private StringOption purchaseType = new StringOption ( ) ; @ Property ( name = "TRADE_TYPE" ) private StringOption tradeType = new StringOption ( ) ; @ Property ( name = "TRADE_NO" ) private StringOption tradeNo = new StringOption ( ) ; @ Property ( name = "LINE_NO" ) private ByteOption lineNo = new ByteOption ( ) ; @ Property ( name = "" ) private DateOption deliveryDate = new DateOption ( ) ; @ Property ( name = "STORE_CODE" ) private StringOption storeCode = new StringOption ( ) ; @ Property ( name = "BUYER_CODE" ) private StringOption buyerCode = new StringOption ( ) ; @ Property ( name = "" ) private StringOption salesTypeCode = new StringOption ( ) ; @ Property ( name = "SELLER_CODE" ) private StringOption sellerCode = new StringOption ( ) ; @ Property ( name = "TENANT_CODE" ) private StringOption tenantCode = new StringOption ( ) ; @ Property ( name = "" ) private LongOption netPriceTotal = new LongOption ( ) ; @ Property ( name = "" ) private LongOption sellingPriceTotal = new LongOption ( ) ; @ Property ( name = "" ) private StringOption shipmentStoreCode = new StringOption ( ) ; @ Property ( name = "" ) private StringOption shipmentSalesTypeCode = new StringOption ( ) ; @ Property ( name = "" ) private StringOption deductionCode = new StringOption ( ) ; @ Property ( name = "ACCOUNT_CODE" ) private StringOption accountCode = new StringOption ( ) ; @ Property ( name = "DEC_COL" ) private DecimalOption decCol = new DecimalOption ( ) ; @ Property ( name = "" ) private DateOption ownershipDate = new DateOption ( ) ; @ Property ( name = "CUTOFF_DATE" ) private DateOption cutoffDate = new DateOption ( ) ; @ Property ( name = "PAYOUT_DATE" ) private DateOption payoutDate = new DateOption ( ) ; @ Property ( name = "" ) private StringOption ownershipFlag = new StringOption ( ) ; @ Property ( name = "CUTOFF_FLAG" ) private StringOption cutoffFlag = new StringOption ( ) ; @ Property ( name = "PAYOUT_FLAG" ) private StringOption payoutFlag = new StringOption ( ) ; @ Property ( name = "DISPOSE_NO" ) private StringOption disposeNo = new StringOption ( ) ; @ Property ( name = "DISPOSE_DATE" ) private DateOption disposeDate = new DateOption ( ) ; public long getPk ( ) { return this . pk . get ( ) ; } public void setPk ( long pk ) { this . pk . modify ( pk ) ; } public LongOption getPkOption ( ) { return this . pk ; } public void setPkOption ( LongOption pk ) { this . pk . copyFrom ( pk ) ; } public Text getDetailGroupId ( ) { return this . detailGroupId . get ( ) ; } public void setDetailGroupId ( Text detailGroupId ) { this . detailGroupId . modify ( detailGroupId ) ; } public String getDetailGroupIdAsString ( ) { return this . detailGroupId . getAsString ( ) ; } public void setDetailGroupIdAsString ( String detailGroupId ) { this . detailGroupId . modify ( detailGroupId ) ; } public StringOption getDetailGroupIdOption ( ) { return this . detailGroupId ; } public void setDetailGroupIdOption ( StringOption detailGroupId ) { this . detailGroupId . copyFrom ( detailGroupId ) ; } public Text getDetailType ( ) { return this . detailType . get ( ) ; } public void setDetailType ( Text detailType ) { this . detailType . modify ( detailType ) ; } public String getDetailTypeAsString ( ) { return this . detailType . getAsString ( ) ; } public void setDetailTypeAsString ( String detailType ) { this . detailType . modify ( detailType ) ; } public StringOption getDetailTypeOption ( ) { return this . detailType ; } public void setDetailTypeOption ( StringOption detailType ) { this . detailType . copyFrom ( detailType ) ; } public Text getDetailSenderId ( ) { return this . detailSenderId . get ( ) ; } public void setDetailSenderId ( Text detailSenderId ) { this . detailSenderId . modify ( detailSenderId ) ; } public String getDetailSenderIdAsString ( ) { return this . detailSenderId . getAsString ( ) ; } public void setDetailSenderIdAsString ( String detailSenderId ) { this . detailSenderId . modify ( detailSenderId ) ; } public StringOption getDetailSenderIdOption ( ) { return this . detailSenderId ; } public void setDetailSenderIdOption ( StringOption detailSenderId ) { this . detailSenderId . copyFrom ( detailSenderId ) ; } public Text getDetailReceiverId ( ) { return this . detailReceiverId . get ( ) ; } public void setDetailReceiverId ( Text detailReceiverId ) { this . detailReceiverId . modify ( detailReceiverId ) ; } public String getDetailReceiverIdAsString ( ) { return this . detailReceiverId . getAsString ( ) ; } public void setDetailReceiverIdAsString ( String detailReceiverId ) { this . detailReceiverId . modify ( detailReceiverId ) ; } public StringOption getDetailReceiverIdOption ( ) { return this . detailReceiverId ; } public void setDetailReceiverIdOption ( StringOption detailReceiverId ) { this . detailReceiverId . copyFrom ( detailReceiverId ) ; } public Text getDetailTestType ( ) { return this . detailTestType . get ( ) ; } public void setDetailTestType ( Text detailTestType ) { this . detailTestType . modify ( detailTestType ) ; } public String getDetailTestTypeAsString ( ) { return this . detailTestType . getAsString ( ) ; } public void setDetailTestTypeAsString ( String detailTestType ) { this . detailTestType . modify ( detailTestType ) ; } public StringOption getDetailTestTypeOption ( ) { return this . detailTestType ; } public void setDetailTestTypeOption ( StringOption detailTestType ) { this . detailTestType . copyFrom ( detailTestType ) ; } public Text getDetailStatus ( ) { return this . detailStatus . get ( ) ; } public void setDetailStatus ( Text detailStatus ) { this . detailStatus . modify ( detailStatus ) ; } public String getDetailStatusAsString ( ) { return this . detailStatus . getAsString ( ) ; } public void setDetailStatusAsString ( String detailStatus ) { this . detailStatus . modify ( detailStatus ) ; } public StringOption getDetailStatusOption ( ) { return this . detailStatus ; } public void setDetailStatusOption ( StringOption detailStatus ) { this . detailStatus . copyFrom ( detailStatus ) ; } public int getDetailLineNo ( ) { return this . detailLineNo . get ( ) ; } public void setDetailLineNo ( int detailLineNo ) { this . detailLineNo . modify ( detailLineNo ) ; } public IntOption getDetailLineNoOption ( ) { return this . detailLineNo ; } public void setDetailLineNoOption ( IntOption detailLineNo ) { this . detailLineNo . copyFrom ( detailLineNo ) ; } public Text getDeleteFlg ( ) { return this . deleteFlg . get ( ) ; } public void setDeleteFlg ( Text deleteFlg ) { this . deleteFlg . modify ( deleteFlg ) ; } public String getDeleteFlgAsString ( ) { return this . deleteFlg . getAsString ( ) ; } public void setDeleteFlgAsString ( String deleteFlg ) { this . deleteFlg . modify ( deleteFlg ) ; } public StringOption getDeleteFlgOption ( ) { return this . deleteFlg ; } public void setDeleteFlgOption ( StringOption deleteFlg ) { this . deleteFlg . copyFrom ( deleteFlg ) ; } public Date getInsertDatetime ( ) { return this . insertDatetime . get ( ) ; } public void setInsertDatetime ( Date insertDatetime ) { this . insertDatetime . modify ( insertDatetime ) ; } public DateOption getInsertDatetimeOption ( ) { return this . insertDatetime ; } public void setInsertDatetimeOption ( DateOption insertDatetime ) { this . insertDatetime . copyFrom ( insertDatetime ) ; } public Date getUpdateDatetime ( ) { return this . updateDatetime . get ( ) ; } public void setUpdateDatetime ( Date updateDatetime ) { this . updateDatetime . modify ( updateDatetime ) ; } public DateOption getUpdateDatetimeOption ( ) { return this . updateDatetime ; } public void setUpdateDatetimeOption ( DateOption updateDatetime ) { this . updateDatetime . copyFrom ( updateDatetime ) ; } public Text getPurchaseNo ( ) { return this . purchaseNo . get ( ) ; } public void setPurchaseNo ( Text purchaseNo ) { this . purchaseNo . modify ( purchaseNo ) ; } public String getPurchaseNoAsString ( ) { return this . purchaseNo . getAsString ( ) ; } public void setPurchaseNoAsString ( String purchaseNo ) { this . purchaseNo . modify ( purchaseNo ) ; } public StringOption getPurchaseNoOption ( ) { return this . purchaseNo ; } public void setPurchaseNoOption ( StringOption purchaseNo ) { this . purchaseNo . copyFrom ( purchaseNo ) ; } public Text getPurchaseType ( ) { return this . purchaseType . get ( ) ; } public void setPurchaseType ( Text purchaseType ) { this . purchaseType . modify ( purchaseType ) ; } public String getPurchaseTypeAsString ( ) { return this . purchaseType . getAsString ( ) ; } public void setPurchaseTypeAsString ( String purchaseType ) { this . purchaseType . modify ( purchaseType ) ; } public StringOption getPurchaseTypeOption ( ) { return this . purchaseType ; } public void setPurchaseTypeOption ( StringOption purchaseType ) { this . purchaseType . copyFrom ( purchaseType ) ; } public Text getTradeType ( ) { return this . tradeType . get ( ) ; } public void setTradeType ( Text tradeType ) { this . tradeType . modify ( tradeType ) ; } public String getTradeTypeAsString ( ) { return this . tradeType . getAsString ( ) ; } public void setTradeTypeAsString ( String tradeType ) { this . tradeType . modify ( tradeType ) ; } public StringOption getTradeTypeOption ( ) { return this . tradeType ; } public void setTradeTypeOption ( StringOption tradeType ) { this . tradeType . copyFrom ( tradeType ) ; } public Text getTradeNo ( ) { return this . tradeNo . get ( ) ; } public void setTradeNo ( Text tradeNo ) { this . tradeNo . modify ( tradeNo ) ; } public String getTradeNoAsString ( ) { return this . tradeNo . getAsString ( ) ; } public void setTradeNoAsString ( String tradeNo ) { this . tradeNo . modify ( tradeNo ) ; } public StringOption getTradeNoOption ( ) { return this . tradeNo ; } public void setTradeNoOption ( StringOption tradeNo ) { this . tradeNo . copyFrom ( tradeNo ) ; } public byte getLineNo ( ) { return this . lineNo . get ( ) ; } public void setLineNo ( byte lineNo ) { this . lineNo . modify ( lineNo ) ; } public ByteOption getLineNoOption ( ) { return this . lineNo ; } public void setLineNoOption ( ByteOption lineNo ) { this . lineNo . copyFrom ( lineNo ) ; } public Date getDeliveryDate ( ) { return this . deliveryDate . get ( ) ; } public void setDeliveryDate ( Date deliveryDate ) { this . deliveryDate . modify ( deliveryDate ) ; } public DateOption getDeliveryDateOption ( ) { return this . deliveryDate ; } public void setDeliveryDateOption ( DateOption deliveryDate ) { this . deliveryDate . copyFrom ( deliveryDate ) ; } public Text getStoreCode ( ) { return this . storeCode . get ( ) ; } public void setStoreCode ( Text storeCode ) { this . storeCode . modify ( storeCode ) ; } public String getStoreCodeAsString ( ) { return this . storeCode . getAsString ( ) ; } public void setStoreCodeAsString ( String storeCode ) { this . storeCode . modify ( storeCode ) ; } public StringOption getStoreCodeOption ( ) { return this . storeCode ; } public void setStoreCodeOption ( StringOption storeCode ) { this . storeCode . copyFrom ( storeCode ) ; } public Text getBuyerCode ( ) { return this . buyerCode . get ( ) ; } public void setBuyerCode ( Text buyerCode ) { this . buyerCode . modify ( buyerCode ) ; } public String getBuyerCodeAsString ( ) { return this . buyerCode . getAsString ( ) ; } public void setBuyerCodeAsString ( String buyerCode ) { this . buyerCode . modify ( buyerCode ) ; } public StringOption getBuyerCodeOption ( ) { return this . buyerCode ; } public void setBuyerCodeOption ( StringOption buyerCode ) { this . buyerCode . copyFrom ( buyerCode ) ; } public Text getSalesTypeCode ( ) { return this . salesTypeCode . get ( ) ; } public void setSalesTypeCode ( Text salesTypeCode ) { this . salesTypeCode . modify ( salesTypeCode ) ; } public String getSalesTypeCodeAsString ( ) { return this . salesTypeCode . getAsString ( ) ; } public void setSalesTypeCodeAsString ( String salesTypeCode ) { this . salesTypeCode . modify ( salesTypeCode ) ; } public StringOption getSalesTypeCodeOption ( ) { return this . salesTypeCode ; } public void setSalesTypeCodeOption ( StringOption salesTypeCode ) { this . salesTypeCode . copyFrom ( salesTypeCode ) ; } public Text getSellerCode ( ) { return this . sellerCode . get ( ) ; } public void setSellerCode ( Text sellerCode ) { this . sellerCode . modify ( sellerCode ) ; } public String getSellerCodeAsString ( ) { return this . sellerCode . getAsString ( ) ; } public void setSellerCodeAsString ( String sellerCode ) { this . sellerCode . modify ( sellerCode ) ; } public StringOption getSellerCodeOption ( ) { return this . sellerCode ; } public void setSellerCodeOption ( StringOption sellerCode ) { this . sellerCode . copyFrom ( sellerCode ) ; } public Text getTenantCode ( ) { return this . tenantCode . get ( ) ; } public void setTenantCode ( Text tenantCode ) { this . tenantCode . modify ( tenantCode ) ; } public String getTenantCodeAsString ( ) { return this . tenantCode . getAsString ( ) ; } public void setTenantCodeAsString ( String tenantCode ) { this . tenantCode . modify ( tenantCode ) ; } public StringOption getTenantCodeOption ( ) { return this . tenantCode ; } public void setTenantCodeOption ( StringOption tenantCode ) { this . tenantCode . copyFrom ( tenantCode ) ; } public long getNetPriceTotal ( ) { return this . netPriceTotal . get ( ) ; } public void setNetPriceTotal ( long netPriceTotal ) { this . netPriceTotal . modify ( netPriceTotal ) ; } public LongOption getNetPriceTotalOption ( ) { return this . netPriceTotal ; } public void setNetPriceTotalOption ( LongOption netPriceTotal ) { this . netPriceTotal . copyFrom ( netPriceTotal ) ; } public long getSellingPriceTotal ( ) { return this . sellingPriceTotal . get ( ) ; } public void setSellingPriceTotal ( long sellingPriceTotal ) { this . sellingPriceTotal . modify ( sellingPriceTotal ) ; } public LongOption getSellingPriceTotalOption ( ) { return this . sellingPriceTotal ; } public void setSellingPriceTotalOption ( LongOption sellingPriceTotal ) { this . sellingPriceTotal . copyFrom ( sellingPriceTotal ) ; } public Text getShipmentStoreCode ( ) { return this . shipmentStoreCode . get ( ) ; } public void setShipmentStoreCode ( Text shipmentStoreCode ) { this . shipmentStoreCode . modify ( shipmentStoreCode ) ; } public String getShipmentStoreCodeAsString ( ) { return this . shipmentStoreCode . getAsString ( ) ; } public void setShipmentStoreCodeAsString ( String shipmentStoreCode ) { this . shipmentStoreCode . modify ( shipmentStoreCode ) ; } public StringOption getShipmentStoreCodeOption ( ) { return this . shipmentStoreCode ; } public void setShipmentStoreCodeOption ( StringOption shipmentStoreCode ) { this . shipmentStoreCode . copyFrom ( shipmentStoreCode ) ; } public Text getShipmentSalesTypeCode ( ) { return this . shipmentSalesTypeCode . get ( ) ; } public void setShipmentSalesTypeCode ( Text shipmentSalesTypeCode ) { this . shipmentSalesTypeCode . modify ( shipmentSalesTypeCode ) ; } public String getShipmentSalesTypeCodeAsString ( ) { return this . shipmentSalesTypeCode . getAsString ( ) ; } public void setShipmentSalesTypeCodeAsString ( String shipmentSalesTypeCode ) { this . shipmentSalesTypeCode . modify ( shipmentSalesTypeCode ) ; } public StringOption getShipmentSalesTypeCodeOption ( ) { return this . shipmentSalesTypeCode ; } public void setShipmentSalesTypeCodeOption ( StringOption shipmentSalesTypeCode ) { this . shipmentSalesTypeCode . copyFrom ( shipmentSalesTypeCode ) ; } public Text getDeductionCode ( ) { return this . deductionCode . get ( ) ; } public void setDeductionCode ( Text deductionCode ) { this . deductionCode . modify ( deductionCode ) ; } public String getDeductionCodeAsString ( ) { return this . deductionCode . getAsString ( ) ; } public void setDeductionCodeAsString ( String deductionCode ) { this . deductionCode . modify ( deductionCode ) ; } public StringOption getDeductionCodeOption ( ) { return this . deductionCode ; } public void setDeductionCodeOption ( StringOption deductionCode ) { this . deductionCode . copyFrom ( deductionCode ) ; } public Text getAccountCode ( ) { return this . accountCode . get ( ) ; } public void setAccountCode ( Text accountCode ) { this . accountCode . modify ( accountCode ) ; } public String getAccountCodeAsString ( ) { return this . accountCode . getAsString ( ) ; } public void setAccountCodeAsString ( String accountCode ) { this . accountCode . modify ( accountCode ) ; } public StringOption getAccountCodeOption ( ) { return this . accountCode ; } public void setAccountCodeOption ( StringOption accountCode ) { this . accountCode . copyFrom ( accountCode ) ; } public BigDecimal getDecCol ( ) { return this . decCol . get ( ) ; } public void setDecCol ( BigDecimal decCol ) { this . decCol . modify ( decCol ) ; } public DecimalOption getDecColOption ( ) { return this . decCol ; } public void setDecColOption ( DecimalOption decCol ) { this . decCol . copyFrom ( decCol ) ; } public Date getOwnershipDate ( ) { return this . ownershipDate . get ( ) ; } public void setOwnershipDate ( Date ownershipDate ) { this . ownershipDate . modify ( ownershipDate ) ; } public DateOption getOwnershipDateOption ( ) { return this . ownershipDate ; } public void setOwnershipDateOption ( DateOption ownershipDate ) { this . ownershipDate . copyFrom ( ownershipDate ) ; } public Date getCutoffDate ( ) { return this . cutoffDate . get ( ) ; } public void setCutoffDate ( Date cutoffDate ) { this . cutoffDate . modify ( cutoffDate ) ; } public DateOption getCutoffDateOption ( ) { return this . cutoffDate ; } public void setCutoffDateOption ( DateOption cutoffDate ) { this . cutoffDate . copyFrom ( cutoffDate ) ; } public Date getPayoutDate ( ) { return this . payoutDate . get ( ) ; } public void setPayoutDate ( Date payoutDate ) { this . payoutDate . modify ( payoutDate ) ; } public DateOption getPayoutDateOption ( ) { return this . payoutDate ; } public void setPayoutDateOption ( DateOption payoutDate ) { this . payoutDate . copyFrom ( payoutDate ) ; } public Text getOwnershipFlag ( ) { return this . ownershipFlag . get ( ) ; } public void setOwnershipFlag ( Text ownershipFlag ) { this . ownershipFlag . modify ( ownershipFlag ) ; } public String getOwnershipFlagAsString ( ) { return this . ownershipFlag . getAsString ( ) ; } public void setOwnershipFlagAsString ( String ownershipFlag ) { this . ownershipFlag . modify ( ownershipFlag ) ; } public StringOption getOwnershipFlagOption ( ) { return this . ownershipFlag ; } public void setOwnershipFlagOption ( StringOption ownershipFlag ) { this . ownershipFlag . copyFrom ( ownershipFlag ) ; } public Text getCutoffFlag ( ) { return this . cutoffFlag . get ( ) ; } public void setCutoffFlag ( Text cutoffFlag ) { this . cutoffFlag . modify ( cutoffFlag ) ; } public String getCutoffFlagAsString ( ) { return this . cutoffFlag . getAsString ( ) ; } public void setCutoffFlagAsString ( String cutoffFlag ) { this . cutoffFlag . modify ( cutoffFlag ) ; } public StringOption getCutoffFlagOption ( ) { return this . cutoffFlag ; } public void setCutoffFlagOption ( StringOption cutoffFlag ) { this . cutoffFlag . copyFrom ( cutoffFlag ) ; } public Text getPayoutFlag ( ) { return this . payoutFlag . get ( ) ; } public void setPayoutFlag ( Text payoutFlag ) { this . payoutFlag . modify ( payoutFlag ) ; } public String getPayoutFlagAsString ( ) { return this . payoutFlag . getAsString ( ) ; } public void setPayoutFlagAsString ( String payoutFlag ) { this . payoutFlag . modify ( payoutFlag ) ; } public StringOption getPayoutFlagOption ( ) { return this . payoutFlag ; } public void setPayoutFlagOption ( StringOption payoutFlag ) { this . payoutFlag . copyFrom ( payoutFlag ) ; } public Text getDisposeNo ( ) { return this . disposeNo . get ( ) ; } public void setDisposeNo ( Text disposeNo ) { this . disposeNo . modify ( disposeNo ) ; } public String getDisposeNoAsString ( ) { return this . disposeNo . getAsString ( ) ; } public void setDisposeNoAsString ( String disposeNo ) { this . disposeNo . modify ( disposeNo ) ; } public StringOption getDisposeNoOption ( ) { return this . disposeNo ; } public void setDisposeNoOption ( StringOption disposeNo ) { this . disposeNo . copyFrom ( disposeNo ) ; } public Date getDisposeDate ( ) { return this . disposeDate . get ( ) ; } public void setDisposeDate ( Date disposeDate ) { this . disposeDate . modify ( disposeDate ) ; } public DateOption getDisposeDateOption ( ) { return this . disposeDate ; } public void setDisposeDateOption ( DateOption disposeDate ) { this . disposeDate . copyFrom ( disposeDate ) ; } public void copyFrom ( Foo source ) { this . pk . copyFrom ( source . pk ) ; this . detailGroupId . copyFrom ( source . detailGroupId ) ; this . detailType . copyFrom ( source . detailType ) ; this . detailSenderId . copyFrom ( source . detailSenderId ) ; this . detailReceiverId . copyFrom ( source . detailReceiverId ) ; this . detailTestType . copyFrom ( source . detailTestType ) ; this . detailStatus . copyFrom ( source . detailStatus ) ; this . detailLineNo . copyFrom ( source . detailLineNo ) ; this . deleteFlg . copyFrom ( source . deleteFlg ) ;
99
<s> package com . asakusafw . testdriver . json ; import java . math . BigDecimal ; import java . math . BigInteger ; import java . util . Calendar ; public class Simple { public Integer number ; public String

Dataset Card for "code_x_glue_cc_code_completion_line"

Dataset Summary

CodeXGLUE CodeCompletion-line dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/CodeCompletion-line

Complete the unfinished line given previous context. Models are evaluated by exact match and edit similarity. We propose line completion task to test model's ability to autocomplete a line. Majority code completion systems behave well in token level completion, but fail in completing an unfinished line like a method call with specific parameters, a function signature, a loop condition, a variable definition and so on. When a software develop finish one or more tokens of the current line, the line level completion model is expected to generate the entire line of syntactically correct code. Line level code completion task shares the train/dev dataset with token level completion. After training a model on CodeCompletion-token, you could directly use it to test on line-level completion.

Supported Tasks and Leaderboards

  • slot-filling: The dataset can be used to train a model for completing entire code lines.

Languages

  • Java programming language
  • Python programming language

Dataset Structure

Data Instances

java

An example of 'train' looks as follows.

{
    "gt": "", 
    "id": 0, 
    "input": "<s> package org . rubypeople . rdt . internal . ui . rubyeditor ; import java . util . Iterator ; import org . eclipse . core . resources . IMarker ; import org . eclipse . ui . texteditor . MarkerAnnotation ; import org . eclipse . ui . texteditor . MarkerUtilities ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyModelMarker ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . RubyCore ; public class RubyMarkerAnnotation extends MarkerAnnotation implements IRubyAnnotation { public static final String RUBY_MARKER_TYPE_PREFIX = \"\" ; public static final String ERROR_ANNOTATION_TYPE = \"\" ; public static final String WARNING_ANNOTATION_TYPE = \"\" ; public static final String INFO_ANNOTATION_TYPE = \"\" ; public static final String TASK_ANNOTATION_TYPE = \"\" ; private IRubyAnnotation fOverlay ; public RubyMarkerAnnotation ( IMarker marker ) { super ( marker ) ; } public String [ ] getArguments ( ) { return null ; } public int getId ( ) { IMarker marker = getMarker ( ) ; if ( marker == null || ! marker . exists ( ) ) return - 1 ; if ( isProblem ( ) ) return marker . getAttribute ( IRubyModelMarker . ID , - 1 ) ; return - 1 ; } public boolean isProblem ( ) { String type = getType ( ) ; return WARNING_ANNOTATION_TYPE . equals ( type ) || ERROR_ANNOTATION_TYPE . equals"
}

python

An example of 'train' looks as follows.

{
    "gt": "", 
    "id": 0, 
    "input": "<s> from __future__ import absolute_import <EOL> import weakref <EOL> import operator <EOL> from . compat import threading , itertools_filterfalse <EOL> from . import py2k <EOL> import types <EOL> EMPTY_SET = frozenset ( ) <EOL> class KeyedTuple ( tuple ) : <EOL> def __new__ ( cls , vals , labels = None ) : <EOL> t = tuple . __new__ ( cls , vals ) <EOL> t . _labels = [ ] <EOL> if labels : <EOL> t . __dict__ . update ( zip ( labels , vals ) ) <EOL> t . _labels = labels <EOL> return t <EOL> def keys ( self ) : <EOL> return [ l for l in self . _labels if l is not None ] <EOL> @ property <EOL> def _fields ( self ) : <EOL> return tuple ( self . keys ( ) ) <EOL> def _asdict ( self ) : <EOL> return dict ( ( key , self . __dict__ [ key ] ) for key in self . keys ( ) ) <EOL> class ImmutableContainer ( object ) : <EOL> def _immutable ( self , * arg , ** kw ) : <EOL> raise TypeError ( \"\" % self . __class__ . __name__ ) <EOL> __delitem__ = __setitem__ = __setattr__ = _immutable <EOL> class immutabledict ( ImmutableContainer , dict ) : <EOL> clear = pop = popitem = setdefault = update = ImmutableContainer . _immutable <EOL> def __new__ ( cls , * args ) : <EOL> new = dict . __new__ ( cls ) <EOL> dict . __init__ ( new , * args ) <EOL> return new <EOL> def __init__ ( self , * args ) : <EOL> pass <EOL> def __reduce__ ( self ) : <EOL> return immutabledict , ( dict ( self ) , ) <EOL> def union ( self , d ) : <EOL> if not self : <EOL> return immutabledict ( d ) <EOL> else : <EOL> d2 = immutabledict ( self ) <EOL> dict . update ( d2 , d ) <EOL> return d2 <EOL> def __repr__ ( self ) : <EOL> return \"\" % dict . __repr__ ( self ) <EOL> class Properties ( object ) : <EOL> def __init__ ( self , data ) : <EOL> self . __dict__ [ '_data' ] = data <EOL> def __len__ ( self ) : <EOL> return len ( self . _data ) <EOL> def __iter__ ( self ) : <EOL> return iter ( list ( self . _data . values ( ) ) ) <EOL> def __add__ ( self , other ) : <EOL> return list ( self ) + list ( other ) <EOL> def __setitem__ ( self , key , object ) : <EOL> self . _data [ key ] = object <EOL> def __getitem__ ( self , key ) : <EOL> return self . _data [ key ] <EOL> def __delitem__ ( self , key ) : <EOL> del self . _data [ key ] <EOL> def __setattr__ ( self , key , object ) : <EOL> self . _data [ key ] = object <EOL> def __getstate__ ( self ) : <EOL> return { '_data' : self . __dict__ [ '_data' ] } <EOL> def __setstate__ ( self , state ) : <EOL> self . __dict__ [ '_data' ] = state [ '_data' ] <EOL> def __getattr__ ( self , key ) : <EOL> try : <EOL> return self . _data [ key ] <EOL> except KeyError : <EOL> raise AttributeError ( key ) <EOL> def __contains__ ( self , key ) : <EOL> return key in self . _data <EOL> def as_immutable ( self ) : <EOL> return ImmutableProperties ( self . _data ) <EOL> def update ( self , value ) : <EOL> self . _data . update ( value ) <EOL> def get ( self , key , default = None ) : <EOL> if key in self : <EOL> return self [ key ] <EOL> else : <EOL> return default <EOL> def keys ( self ) : <EOL> return list ( self . _data ) <EOL> def values ( self ) : <EOL> return list ( self . _data . values ( ) ) <EOL> def items ( self ) : <EOL> return list ( self . _data . items ( ) ) <EOL> def has_key ( self , key ) : <EOL> return key in self . _data <EOL> def clear ( self ) : <EOL> self . _data . clear ( ) <EOL> class OrderedProperties ( Properties ) : <EOL> def __init__ ( self ) : <EOL> Properties . __init__ ( self , OrderedDict ( ) ) <EOL> class ImmutableProperties ( ImmutableContainer , Properties ) : <EOL> class OrderedDict ( dict ) : <EOL> def __init__ ( self , ____sequence = None , ** kwargs ) : <EOL> self . _list = [ ] <EOL> if ____sequence is None : <EOL> if kwargs : <EOL> self . update ( ** kwargs ) <EOL> else : <EOL> self . update ( ____sequence , ** kwargs ) <EOL> def clear ( self ) : <EOL> self . _list = [ ] <EOL> dict . clear ( self ) <EOL> def copy ( self ) : <EOL> return self . __copy__ ( ) <EOL> def __copy__ ( self ) : <EOL> return OrderedDict ( self ) <EOL> def sort ( self , * arg , ** kw ) : <EOL> self . _list . sort ( * arg , ** kw ) <EOL> def update ( self , ____sequence = None , ** kwargs ) : <EOL> if ____sequence is not None : <EOL> if hasattr ( ____sequence , 'keys' ) : <EOL> for key in ____sequence . keys ( ) : <EOL> self . __setitem__ ( key , ____sequence [ key ] ) <EOL> else : <EOL> for key , value in ____sequence : <EOL> self [ key ] = value <EOL> if kwargs : <EOL> self . update ( kwargs ) <EOL> def setdefault ( self , key , value ) : <EOL> if key not in self : <EOL> self . __setitem__ ( key , value ) <EOL> return value <EOL> else : <EOL> return self . __getitem__ ( key ) <EOL> def __iter__ ( self ) : <EOL> return iter ( self . _list ) <EOL> def keys ( self ) : <EOL> return list ( self ) <EOL> def values ( self ) : <EOL> return [ self [ key ] for key in self . _list ] <EOL> def items ( self ) : <EOL> return [ ( key , self [ key ] ) for key in self . _list ] <EOL> if py2k : <EOL> def itervalues ( self ) : <EOL> return iter ( self . values ( ) ) <EOL> def iterkeys ( self ) : <EOL> return iter ( self ) <EOL> def iteritems ( self ) : <EOL> return iter ( self . items ( ) ) <EOL> def __setitem__ ( self , key , object ) : <EOL> if key not in self : <EOL> try : <EOL> self . _list . append ( key ) <EOL> except AttributeError : <EOL> self . _list = [ key ] <EOL> dict . __setitem__ ( self , key , object ) <EOL> def __delitem__ ( self , key ) : <EOL> dict . __delitem__ ( self , key ) <EOL> self . _list . remove ( key ) <EOL> def pop ( self , key , * default ) : <EOL> present = key in self <EOL> value = dict . pop ( self , key , * default ) <EOL> if present : <EOL> self . _list . remove ( key ) <EOL> return value <EOL> def popitem ( self ) : <EOL> item = dict . popitem ( self ) <EOL> self . _list . remove ( item [ 0 ] ) <EOL> return item <EOL> class OrderedSet ( set ) : <EOL> def __init__ ( self , d = None ) : <EOL> set . __init__ ( self ) <EOL> self . _list = [ ] <EOL> if d is not None : <EOL>"
}

Data Fields

In the following each data field in go is explained for each config. The data fields are the same among all splits.

java, python

field name type description
id int32 Index of the sample
input string Input code string
gt string Code string to be predicted

Data Splits

name train
java 3000
python 10000

Dataset Creation

Curation Rationale

[More Information Needed]

Source Data

Initial Data Collection and Normalization

[More Information Needed]

Who are the source language producers?

[More Information Needed]

Annotations

Annotation process

[More Information Needed]

Who are the annotators?

[More Information Needed]

Personal and Sensitive Information

[More Information Needed]

Considerations for Using the Data

Social Impact of Dataset

[More Information Needed]

Discussion of Biases

[More Information Needed]

Other Known Limitations

[More Information Needed]

Additional Information

Dataset Curators

https://github.com/microsoft, https://github.com/madlag

Licensing Information

Computational Use of Data Agreement (C-UDA) License.

Citation Information

@article{raychev2016probabilistic,
  title={Probabilistic Model for Code with Decision Trees},
  author={Raychev, Veselin and Bielik, Pavol and Vechev, Martin},
  journal={ACM SIGPLAN Notices},
  pages={731--747},
  year={2016},
  publisher={ACM New York, NY, USA}
}
@inproceedings{allamanis2013mining,
  title={Mining Source Code Repositories at Massive Scale using Language Modeling},
  author={Allamanis, Miltiadis and Sutton, Charles},
  booktitle={2013 10th Working Conference on Mining Software Repositories (MSR)},
  pages={207--216},
  year={2013},
  organization={IEEE}
}

Contributions

Thanks to @madlag (and partly also @ncoop57) for adding this dataset.

Downloads last month
99
Edit dataset card

Models trained or fine-tuned on google/code_x_glue_cc_code_completion_line