id
int32 0
3k
| input
stringlengths 43
33.8k
| gt
stringclasses 1
value |
---|---|---|
1,100 | <s> package org . rubypeople . rdt . refactoring . core . convertlocaltofield ; import org . jruby . ast . BlockNode ; import org . jruby . ast . DefnNode ; import org . jruby . ast . NewlineNode ; import org . jruby . ast . Node ; import org . rubypeople . rdt . refactoring . core . NodeFactory ; import org . rubypeople . rdt . refactoring . editprovider . InsertEditProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . ClassNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . LocalNodeWrapper ; import org . rubypeople . rdt . refactoring . offsetprovider . AfterLastNodeInMethodOffsetProvider ; import org . rubypeople . rdt . refactoring . offsetprovider . ConstructorOffsetProvider ; import org . rubypeople . rdt . refactoring . offsetprovider . OffsetProvider ; public class InitInConstructorEditProvider extends InsertEditProvider { private ClassNodeWrapper enclosingClassNode ; private Node insertNode ; public InitInConstructorEditProvider ( LocalNodeWrapper originalNode , LocalToFieldConfig config ) { super ( true ) ; LocalToFieldEditProvider conversion = new LocalToFieldEditProvider ( originalNode , config . getNewName ( ) , config . isClassField ( ) , true ) ; insertNode = conversion . getEditNode ( 0 , null ) ; enclosingClassNode = config . getEnclosingClassNode ( ) ; } @ Override protected int getOffset ( String document ) { OffsetProvider offsetProvider ; if ( enclosingClassNode . | |
1,101 | <s> package com . aptana . rdt . internal . core . parser . warnings ; import java . util . Map ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import com . aptana . rdt . AptanaRDTPlugin ; import com . aptana . rdt . internal . parser . warnings . TooManyLinesVisitor ; import com . aptana . rdt . internal . parser . warnings . TooManyLocalsVisitor ; public class TC_CodeComplexityMaxLocals extends WarningVisitorTest { private static final int MAX_LOCALS ; static { Map < String , String > options = AptanaRDTPlugin . getDefault ( ) . getOptions ( ) ; int max ; try { max = Integer . parseInt ( ( String ) options . get ( AptanaRDTPlugin . COMPILER_PB_MAX_LOCALS ) ) ; } catch ( NumberFormatException e ) { max = TooManyLocalsVisitor . DEFAULT_MAX_LOCALS ; } MAX_LOCALS = max ; } @ Override protected RubyLintVisitor createVisitor ( String code ) { return new TooManyLocalsVisitor ( code ) { @ Override protected String getSeverity ( ) { return RubyCore . WARNING ; } } ; } public void testTooManyLocals ( ) throws Exception { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "def methodn" ) ; for ( int i = 1 ; i <= MAX_LOCALS + 1 ; i ++ ) { buffer . append ( " local_" ) ; buffer . append ( i ) ; buffer . append ( " = 1" ) ; buffer . append | |
1,102 | <s> package com . asakusafw . dmdl . model ; import com . asakusafw . dmdl . Region ; public class AstModelReference extends AbstractAstNode implements AstRecord { private final Region region ; public final AstSimpleName name ; public AstModelReference ( Region region , AstSimpleName name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } this . region = region ; this . name = name ; } @ Override public Region getRegion ( ) { return region ; } @ Override public AstRecord getUnit ( ) { return this ; } @ Override public < C , R > R accept ( C context , Visitor < C , R > visitor ) { if ( visitor == null ) { throw new | |
1,103 | <s> package org . oddjob . designer . elements . schedule ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . Helper ; import org . oddjob . OddjobDescriptorFactory ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . ArooaType ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignParser ; import org . oddjob . arooa . design . view . ViewMainHelper ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . schedules . schedules . CountSchedule ; import org . oddjob . schedules . schedules . DailySchedule ; public class DailyScheduleDETest extends TestCase { private static final Logger logger = Logger . getLogger ( DailyScheduleDETest . class ) ; public void setUp ( ) { logger . debug ( "" + getName ( ) + "" ) ; } DesignInstance design ; public void testCreate ( ) throws ArooaParseException { String xml = "" + "" + "" + "" + "" + "" ; ArooaDescriptor descriptor = new OddjobDescriptorFactory ( ) . createDescriptor ( getClass ( ) . getClassLoader ( ) ) ; DesignParser parser = new DesignParser ( new StandardArooaSession ( descriptor ) ) ; parser . setArooaType ( ArooaType . VALUE ) ; parser . parse ( | |
1,104 | <s> package de . fuberlin . wiwiss . d2rq . server ; import java . io . IOException ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Set ; import javax . servlet . ServletException ; import javax . servlet . http . HttpServlet ; import javax . servlet . http . HttpServletRequest ; import javax . servlet . http . HttpServletResponse ; import org . apache . velocity . context . Context ; import com . hp . hpl . jena . rdf . model . Model ; import com . hp . hpl . jena . rdf . model . ModelFactory ; import com . hp . hpl . jena . rdf . model . Property ; import com . hp . hpl . jena . rdf . model . ResIterator ; 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 . vocabulary . RDF ; import de . fuberlin . wiwiss . d2rq . ClassMapLister ; import de . fuberlin . wiwiss . d2rq . vocab . D2RQ ; import de . fuberlin . wiwiss . d2rq . vocab . SD ; import de . fuberlin . wiwiss . d2rq . vocab . VoID ; import de . fuberlin . wiwiss . pubby . negotiation . ContentTypeNegotiator ; import de . fuberlin . wiwiss . pubby . negotiation . MediaRangeSpec ; import de . fuberlin . wiwiss . pubby . negotiation . PubbyNegotiator ; public class DatasetDescriptionServlet extends HttpServlet { protected void doGet ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { D2RServer server = D2RServer . fromServletContext ( getServletContext ( ) ) ; if ( ! server . getConfig ( ) . serveMetadata ( ) ) { response . setStatus ( 404 ) ; response . setContentType ( "text/plain" ) ; response . getOutputStream ( ) . println ( "" ) ; return ; } Model dDesc = ModelFactory . createDefaultModel ( ) ; dDesc . setNsPrefix ( "void" , VoID . NS ) ; Resource sparqlService = dDesc . createResource ( server . getSparqlUrl ( ) ) ; Resource datasetIRI = dDesc . createResource ( server . getDatasetIri ( ) ) ; dDesc . add ( datasetIRI , RDF . type , VoID . Dataset ) ; dDesc . add ( datasetIRI , VoID . sparqlEndpoint , sparqlService ) ; dDesc . add ( datasetIRI , VoID . feature , dDesc . createResource ( "" ) ) ; dDesc . add ( datasetIRI , VoID . feature , dDesc . createResource ( "" ) ) ; dDesc . add ( datasetIRI , VoID . feature , dDesc . createResource ( "" ) ) ; ClassMapLister lister = D2RServer . retrieveSystemLoader ( getServletContext ( ) ) . getClassMapLister ( ) ; for ( String classMapName : lister . classMapNames ( ) ) { dDesc . add ( datasetIRI , VoID . rootResource , dDesc . createResource ( server . baseURI ( ) + "all/" + classMapName ) ) ; } dDesc . add ( datasetIRI , VoID . uriSpace , dDesc . createLiteral ( server . resourceBaseURI ( ) ) ) ; Model mapping = D2RServer . retrieveSystemLoader ( getServletContext ( ) ) . getMappingModel ( ) ; Set < String > prefixes = new HashSet < String > ( ) ; for ( Resource partClass : generatePartitions ( mapping , D2RQ . ClassMap , D2RQ . class_ ) ) { Resource classPartition = dDesc . createResource ( ) ; dDesc . add ( classPartition , VoID . class_ , partClass ) ; dDesc . add ( datasetIRI , VoID . classPartition , classPartition ) ; prefixes . add ( findPrefix ( partClass . getURI ( ) ) ) ; } for ( Resource partProp : generatePartitions ( mapping , D2RQ . PropertyBridge , D2RQ . property ) ) { Resource propertyPartition = dDesc . createResource ( ) ; dDesc . add ( propertyPartition , VoID . property , partProp ) ; dDesc . add ( datasetIRI , VoID . propertyPartition , propertyPartition ) ; prefixes . add ( findPrefix ( partProp . getURI ( ) ) ) ; } for ( String prefix : prefixes ) { dDesc . add ( datasetIRI , VoID . vocabulary , dDesc . createResource ( prefix ) ) ; } dDesc . setNsPrefix ( "sd" , SD . NS ) ; dDesc . add ( sparqlService , RDF . type , SD . Service ) ; dDesc . add ( sparqlService , SD . url , sparqlService ) ; dDesc . add ( sparqlService , SD . resultFormat , dDesc . createResource ( "" ) ) ; dDesc . add ( sparqlService , SD . resultFormat , dDesc . createResource ( "" ) ) ; Resource defaultDatasetDesc = dDesc . createResource ( ) ; dDesc . add ( sparqlService , SD . defaultDatasetDescription , defaultDatasetDesc ) ; dDesc . add ( defaultDatasetDesc , RDF . type , SD . Dataset ) ; dDesc . add ( defaultDatasetDesc , SD . defaultGraph , datasetIRI ) ; dDesc . add ( datasetIRI , RDF | |
1,105 | <s> package com . asakusafw . testdriver . core ; import java . io . IOException ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . vocabulary . external . ExporterDescription ; public class MockExporterRetriever extends AbstractExporterRetriever < MockExporterRetriever . Desc > { public static Desc create ( String ... lines ) { return new Desc ( Arrays . asList ( lines ) ) ; } public SpiExporterRetriever wrap ( ) { return new SpiExporterRetriever ( Collections . singletonList ( this ) ) ; } @ Override public void truncate ( Desc description ) throws IOException { description . lines . clear ( ) ; } | |
1,106 | <s> package com . asakusafw . vocabulary . windgate ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import org . junit . Test ; import com . asakusafw . windgate . core . DriverScript ; import com . asakusafw . windgate . core . vocabulary . DataModelStreamSupport ; import com . asakusafw . windgate . core . vocabulary . FileProcess ; import com . asakusafw . windgate . core . vocabulary . StreamProcess ; public class FsExporterDescriptionTest { @ Test public void simple ( ) { Mock desc = new Mock ( "example" , StringSupport . class ) ; DriverScript script = desc . getDriverScript ( ) ; assertThat ( script . getResourceName ( ) , is ( Constants . LOCAL_FILE_RESOURCE_NAME ) ) ; assertThat ( script . getConfiguration ( ) . get ( FileProcess . FILE . key ( ) ) , is ( "example" ) ) ; assertThat ( script . getConfiguration ( ) . get ( StreamProcess . STREAM_SUPPORT . key ( ) ) , is ( StringSupport . class . getName ( ) ) ) ; } @ Test ( expected = IllegalStateException . class ) public void invalid_path_null ( ) { Mock desc = new Mock ( null , StringSupport . class ) ; desc . getDriverScript ( ) ; } @ Test ( expected = IllegalStateException . class ) public void invalid_path_empty ( ) { Mock desc = new Mock ( "" , StringSupport . class ) ; desc . getDriverScript ( ) ; } @ Test ( expected = IllegalStateException . class ) public void invalid_support_null ( ) { Mock desc = new Mock ( "example" , null ) ; desc . getDriverScript ( ) ; } @ Test ( expected = IllegalStateException . class ) public void invalid_support_inconsistent ( ) { Mock desc = new Mock ( "example" , VoidSupport . class ) ; desc . getDriverScript ( ) ; } @ Test ( expected = IllegalStateException . class ) public void invalid_support_fail ( ) { Mock desc = new Mock ( "example" , InvalidSupport . class ) ; desc . getDriverScript ( ) ; } public static class StringSupport extends MockStreamSupport < String > { @ Override public Class < String > getSupportedType ( ) { return String . class ; } } public static class VoidSupport extends MockStreamSupport < Void > { @ Override public Class < Void > getSupportedType ( ) { return Void . class ; } } private static class InvalidSupport extends MockStreamSupport < Object > { @ Override | |
1,107 | <s> package org . oddjob . monitor . model ; import java . util . concurrent . Executor ; import javax . swing . event . TreeModelListener ; import javax . swing . tree . TreeModel ; import javax . swing . tree . TreeNode ; import javax . swing . tree . TreePath ; public class JobTreeModel implements TreeModel { private final TreeEventDispatcher eventDispatcher ; private JobTreeNode root ; public JobTreeModel ( ) { this ( new ExecutorTreeEventDispatcher ( new EventThreadOnlyDispatcher ( ) ) ) ; } public JobTreeModel ( Executor executor ) { this ( new ExecutorTreeEventDispatcher ( executor ) ) ; } public JobTreeModel ( TreeEventDispatcher eventDispatcher ) { if ( eventDispatcher == null ) { throw new NullPointerException ( "" ) ; } this . eventDispatcher = eventDispatcher ; } public void setRootTreeNode ( JobTreeNode node ) { this . root = node ; } public | |
1,108 | <s> package com . asakusafw . utils . java . parser . javadoc ; import java . io . IOException ; import java . io . StringReader ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import com . asakusafw . utils . java . internal . model . util . JavaEscape ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . JavadocToken ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . JavadocTokenKind ; public class DefaultJavadocScanner implements JavadocScanner { private int index ; private List < JavadocToken > tokens ; private JavadocToken eof ; public DefaultJavadocScanner ( List < JavadocToken > tokens , int successorStartsAt ) { super ( ) ; this . index = 0 ; this . tokens = tokens ; this . eof = eof ( successorStartsAt ) ; } public static DefaultJavadocScanner newInstance ( String text ) { if ( text == null ) { throw new IllegalArgumentException ( "text" ) ; } JavadocTokenizer tokenizer = new JavadocTokenizer ( new StringReader ( text ) ) ; try { while ( tokenizer . yylex ( ) != - 1 ) { } } catch ( IOException e ) { throw ( AssertionError ) new AssertionError ( tokenizer . getStore ( ) ) | |
1,109 | <s> package net . bioclipse . opentox ; public class OpenToxService { private String name ; private String service ; private String serviceSPARQL ; public OpenToxService ( String name , String service , String serviceSPARQL ) { super ( ) ; this . name = name ; | |
1,110 | <s> package org . oddjob . schedules . schedules ; import java . io . Serializable ; import java . util . Calendar ; import java . util . Date ; import java . util . GregorianCalendar ; import org . oddjob . schedules . AbstractSchedule ; import org . oddjob . schedules . Interval ; import org . oddjob . schedules . IntervalTo ; import org . oddjob . schedules . ScheduleContext ; import org . oddjob . schedules . ScheduleResult ; public class DayAfterSchedule extends AbstractSchedule implements Serializable { private static final long serialVersionUID = 200502262011092200L ; public ScheduleResult nextDue ( ScheduleContext context ) { Date use = null ; Interval interval = context . getParentInterval ( ) ; if ( interval != null ) { use = new Date ( interval . getToDate ( ) . getTime ( ) - 1L ) ; } else { use = context . getDate | |
1,111 | <s> package com . asakusafw . dmdl . model ; import java . util . List ; import com . asakusafw . dmdl . Region ; import com . asakusafw . utils . collections . Lists ; public class AstAttributeValueArray extends AbstractAstNode implements AstAttributeValue { private final Region region ; public final List < AstAttributeValue > elements ; public AstAttributeValueArray ( Region region , List < ? extends AstAttributeValue > elements ) { this . region = region ; this . elements = Lists . freeze ( elements ) ; } @ Override public Region | |
1,112 | <s> package org . rubypeople . rdt . internal . ui . text ; import org . eclipse . osgi . util . NLS ; public class TextMessages extends NLS { private static final | |
1,113 | <s> package org . oddjob . schedules ; import java . io . Serializable ; import java . text . SimpleDateFormat ; import java . util . Date ; class IntervalBase implements Serializable { private static final long serialVersionUID = 20050226 ; private final Date fromDate ; private final Date toDate ; public IntervalBase ( Date on ) { this ( on . getTime ( ) , on . getTime ( ) ) ; } public IntervalBase ( Date from , Date to ) { this ( from . getTime ( ) , to . getTime ( ) ) ; } public IntervalBase ( long fromTime , long toTime ) { fromDate = new Date ( fromTime ) ; toDate = new Date ( toTime ) ; if ( toTime < fromTime ) { throw new IllegalStateException ( "" + toDate + "" + fromDate + "]" ) ; } } public IntervalBase ( IntervalBase other ) { this ( other . fromDate . getTime ( ) , other . toDate . getTime ( ) ) ; } public Date getFromDate ( ) { return fromDate ; } protected Date getEndDate ( ) { return toDate ; } | |
1,114 | <s> package com . asakusafw . compiler . common ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . IOException ; import java . io . InputStream ; import java . util . Arrays ; import java . util . List ; import java . util . Map ; import java . util . Scanner ; import java . util . TreeMap ; import java . util . zip . ZipInputStream ; import org . junit . Rule ; import org . junit . Test ; import com . asakusafw . compiler . batch . ResourceRepository . Cursor ; import com . asakusafw . compiler . flow . Location ; import com . asakusafw . runtime . configuration . FrameworkDeployer ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Maps ; public class FileRepositoryTest { @ Rule public FrameworkDeployer framework = new FrameworkDeployer ( false ) ; @ Test public void single ( ) throws Exception { FileRepository repository = new FileRepository ( open ( "single.zip" ) ) ; Cursor cur = repository . createCursor ( ) ; Map < String , List < String > > entries = drain ( cur ) ; Map < String , List < String > > expected = Maps . create ( ) ; expected . put ( "hello.txt" , Arrays . asList ( "" ) ) ; assertThat ( entries , is ( expected ) ) ; } @ Test public void multiple ( ) throws Exception { FileRepository repository = new FileRepository ( open ( "multiple.zip" ) ) ; Cursor cur = repository . createCursor ( ) ; Map < String , List < String > > entries = drain ( cur ) ; Map < String , List < String > > expected = Maps . create ( ) ; expected . put ( "a.txt" , Arrays . asList ( "aaa" ) ) ; expected . put ( "b.txt" , Arrays . asList ( "bbb" ) | |
1,115 | <s> package org . oddjob . scheduling ; import java . text . ParseException ; import java . util . Date ; import org . apache . log4j . Logger ; import org . oddjob . arooa . utils . DateHelper ; import org . oddjob . util | |
1,116 | <s> package org . oddjob ; import org . oddjob . arooa . registry . Services ; import org . oddjob . input . InputHandler ; | |
1,117 | <s> package fi . koku . services . utility . authorizationinfo . v1 . model ; public class User { private String id ; private String firstname ; private String lastname ; public String getId ( ) { return id ; } public void setId ( String id ) { this . id = id ; } public String getFirstname ( ) { return firstname ; } public void setFirstname ( String firstname ) { this . firstname = firstname ; } public String getLastname ( ) { return lastname ; } public void | |
1,118 | <s> package org . oddjob . monitor . view ; import java . awt . Component ; import java . util . ArrayList ; import java . util . List ; import javax . swing . JMenu ; import javax . swing . JMenuItem ; import javax . swing . JSeparator ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . Oddjob ; import org . oddjob . OddjobSessionFactory ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . design . actions . ConfigurableMenus ; import org . oddjob . arooa . parsing . ConfigurationSession ; import org . oddjob . arooa . parsing . DragPoint ; import org . oddjob . arooa . parsing . MockConfigurationOwner ; import org . oddjob . arooa . parsing . MockConfigurationSession ; import org . oddjob . arooa . standard . StandardArooaDescriptor ; import org . oddjob . monitor . actions . ExplorerAction ; import org . oddjob . monitor . actions . ResourceActionProvider ; import org . oddjob . monitor . context . ExplorerContext ; import org . oddjob . monitor . model . ConfigContextInialiser ; import org . oddjob . monitor . model . MockExplorerContext ; import org . oddjob . util . MockThreadManager ; import org . oddjob . util . ThreadManager ; public class ActionModelTest extends TestCase { private static final Logger logger = Logger . getLogger ( ActionModelTest . class ) ; class OurSessionLite extends MockConfigurationSession { ArooaDescriptor descriptor = new StandardArooaDescriptor ( ) ; @ Override public ArooaDescriptor getArooaDescriptor ( ) { return descriptor ; } @ Override public DragPoint dragPointFor ( Object component ) { return null ; } } class ParentContext extends MockExplorerContext { ConfigurationSession session = new OurSessionLite ( ) ; @ Override public Object getValue ( String key ) { if ( ConfigContextInialiser . CONFIG_OWNER . equals ( key ) ) { return new MockConfigurationOwner ( ) { public ConfigurationSession provideConfigurationSession ( ) { return session ; } } ; } throw new RuntimeException ( "Unexpected: " + key ) ; } } class OurExplorerContext extends MockExplorerContext { Object thisComponent ; @ Override public Object getThisComponent ( ) { return thisComponent ; } @ Override public ThreadManager getThreadManager ( ) { return new MockThreadManager ( ) { } ; } @ Override public ExplorerContext getParent ( ) { return new ParentContext ( ) ; } } public void testSelectObject ( ) throws ArooaParseException { Object object = new Object ( ) ; OurExplorerContext econ = new OurExplorerContext ( ) ; econ . thisComponent = object ; ExplorerAction [ ] actions = new ResourceActionProvider ( new OddjobSessionFactory ( ) . createSession ( ) ) . getExplorerActions ( ) ; final ExplorerJobActions test = new ExplorerJobActions ( actions ) ; ConfigurableMenus menus = new ConfigurableMenus ( ) ; test . contributeTo ( menus ) ; test . setSelectedContext ( econ ) ; test . prepare ( ) ; JMenu menu = menus . getJMenuBar ( ) [ 0 ] ; Component [ ] components = menu . getMenuComponents ( ) ; List < JMenuItem > menuItems = new ArrayList < JMenuItem > ( ) ; for ( Component component : components ) { if ( component instanceof JMenuItem ) { JMenuItem menuItem = ( JMenuItem ) component ; logger . debug ( menuItem . getText ( ) + " " + menuItem . isEnabled ( ) ) ; menuItems . add ( menuItem ) ; } else if ( component instanceof JSeparator ) { logger . debug ( "Separator" ) ; } else { logger . debug ( component . getClass ( ) ) ; } } int i = 0 ; assertEquals ( "Load" , menuItems . get ( i ) . getText ( ) ) ; assertFalse ( menuItems . get ( i ) . isEnabled ( ) ) ; assertFalse ( menuItems . get ( i ) . isVisible ( ) ) ; assertEquals ( "Unload" , menuItems . get ( ++ i ) . getText ( ) ) ; assertFalse ( menuItems . get ( i ) . isEnabled ( ) ) ; assertFalse ( menuItems . get ( i ) . isVisible ( ) ) ; assertEquals ( "Run" , menuItems . get ( ++ i ) . getText ( ) ) ; assertFalse ( menuItems . get ( i ) . isEnabled ( ) ) ; assertEquals ( "Soft Reset" , menuItems . get ( ++ i ) . getText ( ) ) ; assertFalse ( menuItems . get ( i ) . isEnabled ( ) ) ; assertEquals ( "Hard Reset" , menuItems . get ( ++ i ) . getText ( ) ) ; assertFalse ( menuItems . get ( i ) . isEnabled ( ) ) ; assertEquals ( "Stop" , menuItems . get ( ++ i ) . getText ( ) ) ; assertFalse ( menuItems . get ( i ) . isEnabled ( ) ) ; assertEquals ( "Force" , menuItems . get ( ++ i ) . getText ( ) ) ; assertFalse ( menuItems . get ( i ) . isEnabled ( ) ) ; assertEquals | |
1,119 | <s> package org . rubypeople . rdt . internal . ui . workingsets ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . IAdaptable ; import org . eclipse . jface . dialogs . Dialog ; import org . eclipse . jface . util . Assert ; import org . eclipse . jface . viewers . CheckStateChangedEvent ; import org . eclipse . jface . viewers . CheckboxTreeViewer ; import org . eclipse . jface . viewers . ICheckStateListener ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . ITreeViewerListener ; import org . eclipse . jface . viewers . TreeExpansionEvent ; import org . eclipse . jface . wizard . WizardPage ; import org . eclipse . swt . SWT ; import org . eclipse . swt . custom . BusyIndicator ; import org . eclipse . swt . events . ModifyEvent ; import org . eclipse . swt . events . ModifyListener ; import org . eclipse . swt . events . SelectionAdapter ; import org . eclipse . swt . events . SelectionEvent ; 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 . Label ; import org . eclipse . swt . widgets . Text ; import org . eclipse . swt . widgets . TreeItem ; import org . eclipse . ui . IWorkbenchPage ; import org . eclipse . ui . IWorkbenchPart ; import org . eclipse . ui . IWorkingSet ; import org . eclipse . ui . IWorkingSetManager ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . dialogs . IWorkingSetPage ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyModel ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . ISourceFolder ; import org . rubypeople . rdt . core . ISourceFolderRoot ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . actions . SelectionConverter ; import org . rubypeople . rdt . internal . ui . util . SWTUtil ; import org . rubypeople . rdt . internal . ui . viewsupport . AppearanceAwareLabelProvider ; import org . rubypeople . rdt . internal . ui . viewsupport . DecoratingRubyLabelProvider ; import org . rubypeople . rdt . internal . ui . viewsupport . RubyElementImageProvider ; import org . rubypeople . rdt . ui . RubyElementLabels ; import org . rubypeople . rdt . ui . RubyElementSorter ; public class RubyWorkingSetPage extends WizardPage implements IWorkingSetPage { final private static String PAGE_TITLE = WorkingSetMessages . RubyWorkingSetPage_title ; final private static String PAGE_ID = "" ; private Text fWorkingSetName ; private CheckboxTreeViewer fTree ; private ITreeContentProvider fTreeContentProvider ; private boolean fFirstCheck ; private IWorkingSet fWorkingSet ; public RubyWorkingSetPage ( ) { super ( PAGE_ID , PAGE_TITLE , RubyPluginImages . DESC_WIZBAN_RUBY_WORKINGSET ) ; setDescription ( WorkingSetMessages . RubyWorkingSetPage_workingSet_description ) ; fFirstCheck = true ; } public void createControl ( Composite parent ) { initializeDialogUnits ( parent ) ; Composite composite = new Composite ( parent , SWT . NONE ) ; composite . setLayout ( new GridLayout ( ) ) ; composite . setLayoutData ( new GridData ( GridData . HORIZONTAL_ALIGN_FILL ) ) ; setControl ( composite ) ; Label label = new Label ( composite , SWT . WRAP ) ; label . setText ( WorkingSetMessages . RubyWorkingSetPage_workingSet_name ) ; GridData gd = new GridData ( GridData . GRAB_HORIZONTAL | GridData . HORIZONTAL_ALIGN_FILL | GridData . VERTICAL_ALIGN_CENTER ) ; label . setLayoutData ( gd ) ; fWorkingSetName = new Text ( composite , SWT . SINGLE | SWT . BORDER ) ; fWorkingSetName . setLayoutData ( new GridData ( GridData . GRAB_HORIZONTAL | GridData . HORIZONTAL_ALIGN_FILL ) ) ; fWorkingSetName . addModifyListener ( new ModifyListener ( ) { public void modifyText ( ModifyEvent e ) { validateInput ( ) ; } } ) ; fWorkingSetName . setFocus ( ) ; label = new Label ( composite , SWT . WRAP ) ; label . setText ( WorkingSetMessages . RubyWorkingSetPage_workingSet_content ) ; gd = new GridData ( GridData . GRAB_HORIZONTAL | GridData . HORIZONTAL_ALIGN_FILL | GridData . VERTICAL_ALIGN_CENTER ) ; label . setLayoutData ( gd ) ; fTree = new CheckboxTreeViewer ( composite , SWT . BORDER | SWT . H_SCROLL | SWT . V_SCROLL ) ; gd = new GridData ( GridData . FILL_BOTH | GridData . GRAB_VERTICAL ) ; gd . heightHint = convertHeightInCharsToPixels ( 15 ) ; fTree . getControl ( ) . setLayoutData ( gd ) ; fTreeContentProvider = new RubyWorkingSetPageContentProvider ( ) ; fTree . setContentProvider ( fTreeContentProvider ) ; AppearanceAwareLabelProvider fRubyElementLabelProvider = new AppearanceAwareLabelProvider ( AppearanceAwareLabelProvider . DEFAULT_TEXTFLAGS | RubyElementLabels . P_COMPRESSED , AppearanceAwareLabelProvider . DEFAULT_IMAGEFLAGS | RubyElementImageProvider . SMALL_ICONS ) ; fTree . setLabelProvider ( new DecoratingRubyLabelProvider ( fRubyElementLabelProvider ) ) ; fTree . setSorter ( new RubyElementSorter ( ) ) ; fTree . setUseHashlookup ( true ) ; fTree . setInput ( RubyCore . create ( ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ) ) ; fTree . addCheckStateListener ( new ICheckStateListener ( ) { public void checkStateChanged ( CheckStateChangedEvent event ) { handleCheckStateChange ( event ) ; } } ) ; fTree . addTreeListener ( new ITreeViewerListener ( ) { public void treeCollapsed ( TreeExpansionEvent event ) { } public void treeExpanded ( TreeExpansionEvent event ) { final Object element = event . getElement ( ) ; if ( fTree . getGrayed ( element ) == false ) BusyIndicator . showWhile ( getShell ( ) . getDisplay ( ) , new Runnable ( ) { public void run ( ) { setSubtreeChecked ( element , fTree . getChecked ( element ) , false ) ; } } ) ; } } ) ; Composite buttonComposite = new Composite ( composite , SWT . NONE ) ; GridLayout layout = new GridLayout ( 2 , false ) ; layout . marginWidth = 0 ; layout . marginHeight = 0 ; buttonComposite . setLayout ( layout ) ; buttonComposite . setLayoutData ( new GridData ( GridData . HORIZONTAL_ALIGN_FILL ) ) ; Button selectAllButton = new Button ( buttonComposite , SWT . PUSH ) ; selectAllButton . setText ( WorkingSetMessages . RubyWorkingSetPage_selectAll_label ) ; selectAllButton . setToolTipText ( WorkingSetMessages . RubyWorkingSetPage_selectAll_toolTip ) ; selectAllButton . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent selectionEvent ) { fTree . setCheckedElements ( fTreeContentProvider . getElements ( fTree . getInput ( ) ) ) ; validateInput ( ) ; } } ) ; selectAllButton . setLayoutData ( new GridData ( ) ) ; SWTUtil . setButtonDimensionHint ( selectAllButton ) ; Button deselectAllButton = new Button ( buttonComposite , SWT . PUSH ) ; deselectAllButton . setText ( WorkingSetMessages . RubyWorkingSetPage_deselectAll_label ) ; deselectAllButton . setToolTipText ( WorkingSetMessages . RubyWorkingSetPage_deselectAll_toolTip ) ; deselectAllButton . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent selectionEvent ) { fTree . setCheckedElements ( new Object [ 0 ] ) ; validateInput ( ) ; } } ) ; deselectAllButton . setLayoutData ( new GridData ( ) ) ; SWTUtil . setButtonDimensionHint ( deselectAllButton ) ; if ( fWorkingSet != null ) fWorkingSetName . setText ( fWorkingSet . getName ( ) ) ; initializeCheckedState ( ) ; validateInput ( ) ; Dialog . applyDialogFont ( composite ) ; } public IWorkingSet getSelection ( ) { return fWorkingSet ; } public void setSelection ( IWorkingSet workingSet ) { Assert . isNotNull ( workingSet , "" ) ; fWorkingSet = workingSet ; if ( getContainer ( ) != null && getShell ( ) != null && fWorkingSetName != null ) { fFirstCheck = false ; fWorkingSetName . setText ( fWorkingSet . getName ( ) ) ; initializeCheckedState ( ) ; validateInput ( ) ; } } public void finish ( ) { String workingSetName = fWorkingSetName . getText ( ) ; ArrayList elements = new ArrayList ( 10 ) ; findCheckedElements ( elements , fTree . getInput ( ) ) ; if ( fWorkingSet == null ) { IWorkingSetManager workingSetManager = PlatformUI . getWorkbench ( ) . getWorkingSetManager ( ) ; fWorkingSet = workingSetManager . createWorkingSet ( workingSetName , ( IAdaptable [ ] ) elements . toArray ( new IAdaptable [ elements . size ( ) ] ) ) ; } else { IAdaptable [ ] oldItems = fWorkingSet . getElements ( ) ; ArrayList closedWithChildren = new ArrayList ( elements . size ( ) ) ; for ( int i = 0 ; i < oldItems . length ; i ++ ) { IResource oldResource = null ; if ( oldItems [ i ] instanceof IResource ) { oldResource = ( IResource ) oldItems [ i ] ; } else { oldResource = ( IResource ) oldItems [ i ] . getAdapter ( IResource . class ) ; } if ( oldResource != null && oldResource . isAccessible ( ) == false ) { IProject project = oldResource . getProject ( ) ; if ( elements . contains ( project ) || closedWithChildren . contains ( project ) ) { elements . add ( oldItems [ i ] ) ; elements . remove ( project ) ; closedWithChildren . add ( project ) ; } } } fWorkingSet . setName ( workingSetName ) ; fWorkingSet . setElements ( ( IAdaptable [ ] ) elements . toArray ( new IAdaptable [ elements . size ( ) ] ) ) ; } } private void validateInput ( ) { String errorMessage = null ; String infoMessage = null ; String newText = fWorkingSetName . getText ( ) ; if ( newText . equals ( newText . trim ( ) ) == false ) errorMessage = WorkingSetMessages . RubyWorkingSetPage_warning_nameWhitespace ; if ( newText . equals ( "" ) ) { if ( fFirstCheck ) { setPageComplete ( false ) ; fFirstCheck = false ; return ; } else errorMessage = WorkingSetMessages . RubyWorkingSetPage_warning_nameMustNotBeEmpty ; } fFirstCheck = false ; if ( errorMessage == null && ( fWorkingSet == null || newText . equals ( fWorkingSet . getName ( ) ) == false ) ) { IWorkingSet [ ] workingSets = PlatformUI . getWorkbench ( ) . getWorkingSetManager ( ) . getWorkingSets ( ) ; for ( int i = 0 ; i < workingSets . length ; i ++ ) { if ( newText . equals ( workingSets [ i ] . getName ( ) ) ) { errorMessage = WorkingSetMessages . RubyWorkingSetPage_warning_workingSetExists ; } } } if ( ! hasCheckedElement ( ) ) infoMessage = WorkingSetMessages . RubyWorkingSetPage_warning_resourceMustBeChecked ; setMessage ( infoMessage , INFORMATION ) ; setErrorMessage ( errorMessage ) ; setPageComplete ( errorMessage == null ) ; } private boolean hasCheckedElement ( ) { TreeItem [ ] items = fTree . getTree ( ) . getItems ( ) ; for ( int i = 0 ; i < items . length ; i ++ ) { if ( items [ i ] . getChecked ( ) ) return true ; } return false ; } private void findCheckedElements ( List checkedResources , Object parent ) { | |
1,120 | <s> package com . pogofish . jadt . parser ; import java . util . List ; import com . pogofish . jadt . ast . Annotation ; import com . pogofish . jadt . ast . Arg ; import com . pogofish . jadt . ast . ArgModifier ; import com . pogofish . jadt . ast . Constructor ; import com . pogofish . jadt . ast . DataType ; import com . pogofish . jadt . ast . Doc ; import com . pogofish . jadt . ast . Expression ; import com . pogofish . jadt . ast . Imprt ; import com . pogofish . jadt . ast . JavaComment ; import com . pogofish . jadt . ast . Literal ; import com . pogofish . jadt . ast . Pkg ; import com . pogofish . jadt . ast . PrimitiveType ; import com . pogofish . jadt . ast . RefType ; import com . pogofish . jadt . ast . Tuple ; import com . pogofish . jadt . ast . Type ; import com . pogofish . jadt . errors . SyntaxError ; public interface ParserImpl { public abstract String getSrcInfo ( ) ; public abstract Doc doc ( ) throws Exception ; public abstract Pkg pkg ( ) throws Exception ; public abstract List < Imprt > imports ( ) throws Exception ; public abstract Imprt singleImport ( ) throws Exception ; public abstract String packageName ( ) throws Exception ; public abstract String packageSpec ( ) throws Exception ; public abstract List < DataType > dataTypes ( ) throws Exception ; public abstract DataType dataType ( ) throws Exception ; public abstract Tuple < List < JavaComment > , String > dataTypeName ( ) throws Exception ; public abstract List < String > typeArguments ( ) throws Exception ; public abstract String typeArgument ( ) throws Exception ; public abstract List < Constructor > constructors ( List < JavaComment > comments ) throws Exception ; public abstract Constructor constructor ( List < JavaComment > comments ) throws Exception ; public abstract Tuple < List < JavaComment > , String > constructorName ( ) throws Exception ; public abstract List < Arg > args ( ) throws Exception ; public abstract Arg arg ( ) throws Exception ; public abstract List < ArgModifier > argModifiers ( ) throws Exception ; public abstract ArgModifier argModifier ( ) throws Exception ; public abstract String argName ( ) throws Exception ; public abstract Type type ( ) throws Exception ; public abstract RefType refType ( ) throws Exception ; public abstract void arrayTypeBrackets ( ) throws Exception ; public abstract RefType classType ( ) throws Exception ; public abstract String className ( ) throws Exception ; public abstract List < RefType > actualTypeArguments ( ) throws Exception ; public abstract PrimitiveType primitiveType ( ) throws Exception ; public abstract String dottedIdentifier ( String expected ) throws Exception ; public abstract Tuple < List < JavaComment > , String > commentedIdentifier ( String expected ) throws Exception ; public abstract String identifier ( String expected ) throws Exception ; public abstract List < JavaComment > importKeyword ( ) throws Exception ; public abstract List < JavaComment > packageKeyword | |
1,121 | <s> package com . asakusafw . utils . java . internal . model . syntax ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . VariableDeclarator ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class VariableDeclaratorImpl extends ModelRoot implements VariableDeclarator { | |
1,122 | <s> package com . asakusafw . compiler . flow ; import java . util . ArrayList ; import java . util . List ; import java . util . Map ; import com . asakusafw . compiler . common . NameGenerator ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Maps ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . Statement ; import com . asakusafw . utils . java . model . util . ImportBuilder ; import com . asakusafw . vocabulary . flow . graph . FlowElementAttributeProvider ; import com . asakusafw . vocabulary . flow . graph . FlowElementDescription ; import com . asakusafw . vocabulary . flow . graph . FlowElementPortDescription ; import com . asakusafw . vocabulary . flow . graph . FlowResourceDescription ; import com . asakusafw . vocabulary . flow . graph . OperatorDescription ; public abstract class RendezvousProcessor extends AbstractFlowElementProcessor { @ Override public final Kind getKind ( ) { return Kind . RENDEZVOUS ; } public ShuffleDescription getShuffleDescription ( FlowElementDescription element , FlowElementPortDescription port ) { Precondition . checkMustNotBeNull ( element , "element" ) ; Precondition . checkMustNotBeNull ( port , "port" ) ; LinePartProcessor nop = new LinePartProcessor . Nop ( ) ; nop . initialize ( getEnvironment ( ) ) ; return new ShuffleDescription ( port . getDataType ( ) , port . getShuffleKey ( ) , nop ) ; } public abstract void emitRendezvous ( Context context ) ; public boolean isPartial ( FlowElementDescription description ) { Precondition . checkMustNotBeNull ( description , "description" ) ; return false ; } public static class Context extends AbstractProcessorContext { private final Map < FlowElementPortDescription , Expression > inputs ; private final Map < FlowElementPortDescription , Expression > outputs ; private final List < Statement > beginStatements ; private final Map < | |
1,123 | <s> package com . asakusafw . directio . tools ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import org . apache . hadoop . util . Tool ; import org . apache . hadoop . util . ToolRunner ; import org . junit . Test ; public class DirectIoAbortTransactionTest extends DirectIoCommandTestRoot { @ Test public void run ( ) throws Exception { Tool exec = new DirectIoAbortTransaction ( repo ) ; indoubt ( "ex1" ) ; assertThat ( count ( production1 ) , is ( 0 ) ) ; assertThat ( count ( production2 ) , is ( 0 ) ) ; assertThat ( ToolRunner . run ( conf , exec , new String [ ] { "__UNKNOWN__" } ) , is ( 0 ) ) ; assertThat ( count | |
1,124 | <s> package org . rubypeople . rdt . internal . corext . callhierarchy ; import java . util . HashMap ; import java . util . Map ; import org . rubypeople . rdt . core . IMember ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IType ; class CallSearchResultCollector { private Map < String , MethodCall > fCalledMembers ; public CallSearchResultCollector ( ) { this . fCalledMembers = createCalledMethodsData ( ) ; } public Map < String , MethodCall > getCallers ( ) { return fCalledMembers ; } protected | |
1,125 | <s> package info . naturwerk . app ; import android . app . Service ; import android . content . Intent ; import android . os . IBinder ; import android . util . Log ; public class NWUpdateService extends Service { private static final String TAG = "" ; static final int DELAY = 60000 ; private boolean runFlag = false ; private Updater updater ; @ Override public IBinder onBind ( Intent intent ) { return null ; } @ Override public void | |
1,126 | <s> package org . rubypeople . rdt . internal . ui . util ; import org . eclipse . jface . text . IDocument ; import org . eclipse . ui . texteditor . ITextEditor ; import org . jruby . lexer . yacc . ISourcePosition ; public class PositionBasedEditorOpener extends EditorOpener { private final ISourcePosition position ; public PositionBasedEditorOpener ( String filename , ISourcePosition position ) { super ( filename ) ; this . position = position ; } protected void setEditorPosition ( ITextEditor editor ) { IDocument document = editor . getDocumentProvider ( ) . getDocument ( editor | |
1,127 | <s> package org . rubypeople . rdt . internal . debug . ui . actions ; import org . eclipse . jface . viewers . Viewer ; import org . rubypeople . rdt . debug . core . model . IRubyVariable ; import org . rubypeople . rdt . debug . ui . RdtDebugUiConstants ; public class ShowStaticVariablesAction extends VariableFilterAction { protected | |
1,128 | <s> package com . asakusafw . testdriver . excel ; import java . io . IOException ; import java . net . URI ; import java . text . MessageFormat ; import java . util . Iterator ; import java . util . LinkedHashMap ; import java . util . Map ; import org . apache . poi . ss . usermodel . Cell ; import org . apache . poi . ss . usermodel . Row ; import org . apache . poi . ss . usermodel . Sheet ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . DataModelReflection ; import com . asakusafw . testdriver . core . DataModelSource ; import com . asakusafw . testdriver . core . PropertyName ; public class ExcelSheetDataModelSource implements DataModelSource { static final Logger LOG = LoggerFactory . getLogger ( ExcelSheetDataModelSource . class ) ; private final DataModelDefinition < ? > definition ; private final URI id ; private final Sheet sheet ; private final Map < PropertyName , Integer > names ; private int nextRowNumber ; public ExcelSheetDataModelSource ( DataModelDefinition < ? > definition , URI id , Sheet sheet ) throws IOException { if ( definition == null ) { throw new IllegalArgumentException ( "" ) ; } if ( sheet == null ) { throw new IllegalArgumentException ( "" ) ; } this . definition = definition ; this . id = id ; this . sheet = sheet ; this . names = extractProperties ( ) ; } private Map < PropertyName , Integer > extractProperties ( ) throws IOException { Row row = sheet . getRow ( 0 ) ; if ( row == null ) { throw new IOException ( MessageFormat . format ( "" , id ) ) ; } nextRowNumber = 1 ; Map < PropertyName , Integer > results = new LinkedHashMap < PropertyName , Integer > ( ) ; for ( Iterator < Cell > iter = row . cellIterator ( ) ; iter . hasNext ( ) ; ) { Cell cell = iter . next ( ) ; int type = cell . getCellType ( ) ; if ( type == Cell . CELL_TYPE_BLANK ) { continue ; } if ( type != Cell . CELL_TYPE_STRING || cell . getStringCellValue ( ) . isEmpty ( ) ) { throw new IOException ( MessageFormat . format ( "" , id , cell . getColumnIndex ( ) + 1 ) ) ; } String name = cell . getStringCellValue ( ) ; PropertyName property = toPropertyName ( cell , name ) ; if ( definition . getType ( property ) == null ) { throw new IOException ( MessageFormat . format ( "" , definition . getModelClass ( ) . getName ( ) , property , id , cell . getColumnIndex ( ) + 1 ) ) ; } results . put ( property , cell . getColumnIndex ( ) ) ; } if ( results . isEmpty ( ) ) { throw new IOException ( MessageFormat . format ( "" , id ) ) ; } return results ; } private PropertyName toPropertyName ( Cell cell , String name ) { assert cell != null ; assert name != null ; String [ ] words = name . split ( "(_|-)+" ) ; return PropertyName | |
1,129 | <s> package com . pogofish . jadt . emitter ; import com . pogofish . jadt . ast . DataType ; import com . pogofish . jadt . | |
1,130 | <s> package org . rubypeople . rdt . core . search ; import org . eclipse . core . resources . IResource ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . internal . core . RubyElement ; public class SearchMatch { public static final int A_ACCURATE = 0 ; public static final int A_INACCURATE = 1 ; private Object element ; private int length ; private int offset ; private int accuracy ; private SearchParticipant participant ; private IResource resource ; private boolean insideDocComment = false ; private final static int ALL_GENERIC_FLAVORS = SearchPattern . R_FULL_MATCH | SearchPattern . R_EQUIVALENT_MATCH | SearchPattern . R_ERASURE_MATCH ; private int rule = ALL_GENERIC_FLAVORS ; private boolean raw = false ; private boolean implicit = false ; public SearchMatch ( IRubyElement element , int accuracy , int offset , int length , SearchParticipant participant , IResource resource ) { this . element = element ; this . offset = offset ; this . length = length ; this . accuracy = accuracy & A_INACCURATE ; if ( accuracy > A_INACCURATE ) { int genericFlavors = accuracy & ALL_GENERIC_FLAVORS ; if ( genericFlavors > 0 ) { this . rule &= ~ ALL_GENERIC_FLAVORS ; } this . rule |= accuracy & ~ A_INACCURATE ; } this . participant = participant ; this . resource = resource ; } public final int getAccuracy ( ) { return this . accuracy ; } public final Object getElement ( ) { return this . element ; } public final int getLength ( ) { return this . length ; } public final int getOffset ( ) { return this . offset ; } public final SearchParticipant getParticipant ( ) { return this . participant ; } public final IResource getResource ( ) { return this . resource ; } public final int getRule ( ) { return this . rule ; } public final boolean isEquivalent ( ) { return isErasure ( ) && ( this . rule & SearchPattern . R_EQUIVALENT_MATCH ) != 0 ; } public final boolean isErasure ( ) { return ( this . rule & SearchPattern . R_ERASURE_MATCH ) != 0 ; } public final boolean isExact ( ) { return isEquivalent ( ) && ( this . rule & SearchPattern . R_FULL_MATCH ) != 0 ; } public final boolean isImplicit ( ) { return this . implicit ; } public final boolean isRaw ( ) { return this . raw ; } public final boolean isInsideDocComment ( ) { return this . insideDocComment ; } public final void setAccuracy ( int accuracy ) { this . accuracy = accuracy ; } public final void setElement ( Object element ) { this . element = element ; } public final void setInsideDocComment ( boolean insideDoc ) { this . insideDocComment = insideDoc ; } public final void setImplicit ( boolean implicit ) { this . implicit = implicit ; } public final void setLength ( int length ) { this . length = length ; } public final void setOffset ( int offset ) { this . offset = offset ; } public final void setParticipant ( SearchParticipant participant ) { this . | |
1,131 | <s> package com . asakusafw . compiler . bulkloader . testing . io ; import java . io . IOException ; import com . asakusafw . compiler . bulkloader . testing . model . SystemColumns ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io | |
1,132 | <s> package com . asakusafw . dmdl . windgate . csv . driver ; import java . util . Arrays ; import java . util . Map ; import com . asakusafw . dmdl . Diagnostic ; import com . asakusafw . dmdl . Diagnostic . Level ; import com . asakusafw . dmdl . model . AstAttribute ; import com . asakusafw . dmdl . model . AstAttributeElement ; import com . asakusafw . dmdl . model . BasicTypeKind ; import com . asakusafw . dmdl . semantics . DmdlSemantics ; import com . asakusafw . dmdl . semantics . PropertyDeclaration ; import com . asakusafw . dmdl . semantics . Type ; import com . asakusafw . dmdl . semantics . type . BasicType ; import com . asakusafw . dmdl . spi . PropertyAttributeDriver ; import com . asakusafw . dmdl . util . AttributeUtil ; import com . asakusafw . dmdl . windgate . csv . driver . CsvFieldTrait . Kind ; public class CsvFieldDriver extends PropertyAttributeDriver { public static final String TARGET_NAME = "" ; public static final String ELEMENT_NAME = "name" ; @ Override public String getTargetName ( ) { return TARGET_NAME ; } @ Override public void process ( DmdlSemantics environment , PropertyDeclaration declaration , AstAttribute attribute ) { Map < String , AstAttributeElement > elements = AttributeUtil . getElementMap ( attribute ) ; | |
1,133 | <s> package com . pogofish . jadt . sampleast ; import java . util . List ; public abstract class Expression { private Expression ( ) { } public static final Expression _Add ( Expression left , Expression right ) { return new Add ( left , right ) ; } public static final Expression _Variable ( String name ) { return new Variable ( name ) ; } public static final Expression _Literal ( int value ) { return new Literal ( value ) ; } public static interface Visitor < ResultType > { ResultType visit ( Add x ) ; ResultType visit ( Variable x ) ; ResultType visit ( Literal x ) ; } public static abstract class VisitorWithDefault < ResultType > implements Visitor < ResultType > { @ Override public ResultType visit ( Add x ) { return getDefault ( x ) ; } @ Override public ResultType visit ( Variable x ) { return getDefault ( x ) ; } @ Override public ResultType visit ( Literal x ) { return getDefault ( x ) ; } protected abstract ResultType getDefault ( Expression x ) ; } public static interface VoidVisitor { void visit ( Add x ) ; void visit ( Variable x ) ; void visit ( Literal x ) ; } public static abstract class VoidVisitorWithDefault implements VoidVisitor { @ Override public void visit ( Add x ) { doDefault ( x ) ; } @ Override public void visit ( Variable x ) { doDefault ( x ) ; } @ Override public void visit ( Literal x ) { doDefault ( x ) ; } protected abstract void doDefault ( Expression x ) ; } public static final class Add extends Expression { public final Expression left ; public final Expression right ; public Add ( Expression left , Expression right ) { this . left = left ; this . right = right ; } @ Override public < ResultType > ResultType accept ( Visitor < ResultType > visitor ) { return visitor . visit ( this ) ; } @ Override public void accept ( VoidVisitor visitor ) { visitor . visit ( this ) ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + ( ( left == null ) ? 0 : left . hashCode ( ) ) ; result = prime * result + ( ( right == null ) ? 0 : right . hashCode ( ) ) ; return result ; } @ Override public boolean equals ( Object obj ) { if ( this == obj ) return true ; if ( obj == null ) return false ; if ( getClass ( ) != obj . getClass ( ) ) return false ; Add other = ( Add ) obj ; if ( left == null ) { if ( other . left != null ) return false ; } else if ( ! left . equals ( other . left ) ) return false ; if ( right == null ) { if ( other . right != null ) return false ; } else if ( ! right . equals | |
1,134 | <s> package net . bioclipse . opentox . ds . wizards ; import net . bioclipse . opentox . ds . Activator ; import net . bioclipse . opentox . ds . prefs . OpenToxModelsPrefsPage ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . viewers . CheckStateChangedEvent ; import org . eclipse . jface . viewers . CheckboxTreeViewer ; import org . eclipse . jface . viewers . ICheckStateListener ; import org . eclipse . jface . wizard . WizardPage ; import org . eclipse . swt . SWT ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Composite ; public class SelectModelsPage extends WizardPage { private CheckboxTreeViewer viewer ; private AddModelsWizard wizard ; protected SelectModelsPage ( String pageName ) { super ( pageName ) ; } public void createControl ( Composite parent ) { wizard = ( AddModelsWizard ) getWizard ( ) ; setTitle ( "" ) ; setDescription ( "" + "" ) ; Composite comp = new Composite ( parent , SWT . NONE ) ; GridLayout layout = new GridLayout | |
1,135 | <s> package org . rubypeople . rdt . internal . testunit . ui ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . io . UnsupportedEncodingException ; import java . net . ServerSocket ; import java . net . Socket ; import java . net . SocketException ; import org . eclipse . core . runtime . ISafeRunnable ; import org . eclipse . core . runtime . SafeRunner ; import org . rubypeople . rdt . internal . testunit . runner . MessageIds ; import org . rubypeople . rdt . testunit . ITestRunListener ; public class RemoteTestRunnerClient { public abstract class ListenerSafeRunnable implements ISafeRunnable { public void handleException ( Throwable exception ) { TestunitPlugin . log ( exception ) ; } } abstract class ProcessingState { abstract ProcessingState readMessage ( String message ) ; } class DefaultProcessingState extends ProcessingState { ProcessingState readMessage ( String message ) { if ( message . startsWith ( MessageIds . TRACE_START ) ) { fFailedTrace = "" ; return fTraceState ; } if ( message . startsWith ( MessageIds . EXPECTED_START ) ) { fExpectedResult = null ; return fExpectedState ; } if ( message . startsWith ( MessageIds . ACTUAL_START ) ) { fActualResult = null ; return fActualState ; } if ( message . startsWith ( MessageIds . RTRACE_START ) ) { fFailedRerunTrace = "" ; return fRerunState ; } String arg = message . substring ( MessageIds . MSG_HEADER_LENGTH ) ; if ( message . startsWith ( MessageIds . TEST_RUN_START ) ) { int count = 0 ; int v = arg . indexOf ( ' ' ) ; if ( v == - 1 ) { fVersion = "v1" ; count = Integer . parseInt ( arg ) ; } else { fVersion = arg . substring ( v + 1 ) ; String sc = arg . substring ( 0 , v ) ; count = Integer . parseInt ( sc ) ; } notifyTestRunStarted ( count ) ; return this ; } if ( message . startsWith ( MessageIds . TEST_START ) ) { notifyTestStarted ( arg ) ; return this ; } if ( message . startsWith ( MessageIds . TEST_END ) ) { notifyTestEnded ( arg ) ; return this ; } if ( message . startsWith ( MessageIds . TEST_ERROR ) ) { extractFailure ( arg , ITestRunListener . STATUS_ERROR ) ; return this ; } if ( message . startsWith ( MessageIds . TEST_FAILED ) ) { extractFailure ( arg , ITestRunListener . STATUS_FAILURE ) ; return this ; } if ( message . startsWith ( MessageIds . TEST_RUN_END ) ) { long elapsedTime = Long . parseLong ( arg ) ; testRunEnded ( elapsedTime ) ; return this ; } if ( message . startsWith ( MessageIds . TEST_STOPPED ) ) { long elapsedTime = Long . parseLong ( arg ) ; notifyTestRunStopped ( elapsedTime ) ; shutDown ( ) ; return this ; } if ( message . startsWith ( MessageIds . TEST_TREE ) ) { notifyTestTreeEntry ( arg ) ; return this ; } if ( message . startsWith ( MessageIds . TEST_RERAN ) ) { if ( hasTestId ( ) ) scanReranMessage ( arg ) ; else scanOldReranMessage ( arg ) ; return this ; } return this ; } } class TraceProcessingState extends ProcessingState { ProcessingState readMessage ( String message ) { if ( message . startsWith ( MessageIds . TRACE_END ) ) { notifyTestFailed ( ) ; fFailedTrace = "" ; fExpectedResult = null ; fActualResult = null ; return fDefaultState ; } fFailedTrace += message + '\n' ; return this ; } } class ExpectedProcessingState extends ProcessingState { ProcessingState readMessage ( String message ) { if ( message . startsWith ( MessageIds . EXPECTED_END ) ) return fDefaultState ; if ( fExpectedResult == null ) fExpectedResult = message + '\n' ; else fExpectedResult += message + '\n' ; return this ; } } class ActualProcessingState extends ProcessingState { ProcessingState readMessage ( String message ) { if ( message . startsWith ( MessageIds . ACTUAL_END ) ) return fDefaultState ; if ( fActualResult == null ) fActualResult = message + '\n' ; else fActualResult += message + '\n' ; return this ; } } class RerunTraceProcessingState extends ProcessingState { ProcessingState readMessage ( String message ) { if ( message . startsWith ( MessageIds . RTRACE_END ) ) return fDefaultState ; fFailedRerunTrace += message + '\n' ; return this ; } } ProcessingState fDefaultState = new DefaultProcessingState ( ) ; ProcessingState fTraceState = new TraceProcessingState ( ) ; ProcessingState fExpectedState = new ExpectedProcessingState ( ) ; ProcessingState fActualState = new ActualProcessingState ( ) ; ProcessingState fRerunState = new RerunTraceProcessingState ( ) ; ProcessingState fCurrentState = fDefaultState ; private ITestRunListener [ ] fListeners ; private ServerSocket fServerSocket ; private Socket fSocket ; private int fPort = - 1 ; private PrintWriter fWriter ; private BufferedReader fBufferedReader ; private String fVersion ; private String fFailedTest ; private String fFailedTestId ; private String fFailedTrace ; private String fExpectedResult ; private String fActualResult ; private String fFailedRerunTrace ; private int fFailureKind ; private boolean fDebug = false ; private class ServerConnection extends Thread { int fServerPort ; public ServerConnection ( int port ) { super ( "" ) ; fServerPort = port ; } public void run ( ) { try { if ( fDebug ) System . out . println ( "" + fServerPort ) ; fServerSocket = new ServerSocket ( fServerPort ) ; fSocket = fServerSocket . accept ( ) ; try { fBufferedReader = new BufferedReader ( new InputStreamReader ( fSocket . getInputStream ( ) , "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { fBufferedReader = new BufferedReader ( new InputStreamReader ( fSocket . getInputStream ( ) ) ) ; } try { fWriter = new PrintWriter ( new OutputStreamWriter ( fSocket . getOutputStream ( ) , "UTF-8" ) , true ) ; } catch ( UnsupportedEncodingException e1 ) { fWriter = new PrintWriter ( new OutputStreamWriter ( fSocket . getOutputStream ( ) ) , true ) ; } String message ; while ( fBufferedReader != null && ( message = readMessage ( fBufferedReader ) ) != null ) receiveMessage ( message ) ; } catch ( SocketException e ) { notifyTestRunTerminated ( ) ; } catch ( IOException e ) { System . out . println ( e ) ; } shutDown ( ) ; } } public synchronized void startListening ( ITestRunListener [ ] listeners , int port ) { fListeners = listeners ; fPort = port ; ServerConnection connection = new ServerConnection ( port ) ; connection . start ( ) ; } public synchronized void stopTest ( ) { if ( isRunning ( ) ) { fWriter . println ( MessageIds . | |
1,136 | <s> package net . sf . sveditor . ui . svcp ; import net . sf . sveditor . core . db . SVDBAssign ; import net . sf . sveditor . core . db . SVDBConstraint ; import net . sf . sveditor . core . db . SVDBCovergroup ; import net . sf . sveditor . core . db . SVDBCoverpoint ; import net . sf . sveditor . core . db . SVDBCoverpointBins ; import net . sf . sveditor . core . db . SVDBCoverpointCross ; import net . sf . sveditor . core . db . SVDBGenerateBlock ; import net . sf . sveditor . core . db . SVDBInclude ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBMacroDef ; import net . sf . sveditor . core . db . SVDBModIfcInstItem ; import net . sf . sveditor . core . db . SVDBProperty ; import net . sf . sveditor . core . db . SVDBSequence ; import net . sf . sveditor . core . db . SVDBTask ; import net . sf . sveditor . core . db . SVDBTypeInfoEnum ; import net . sf . sveditor . core . db . stmt . SVDBAlwaysStmt ; import net . sf . sveditor . core . db . stmt . SVDBAssertStmt ; import net . sf . sveditor . core . db . stmt . SVDBImportItem ; import net . sf . sveditor . core . db . stmt . SVDBInitialStmt ; import net . sf . sveditor . core . db . stmt . SVDBTypedefStmt ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclItem ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerFilter ; public class SVDBDefaultContentFilter extends ViewerFilter { private boolean hide_assign_statements = true ; private boolean hide_always_statements = true ; private boolean hide_initial_blocks = true ; private boolean hide_generate_blocks = true ; private boolean hide_define_statements = true ; private boolean hide_variable_declarations = true ; private boolean hide_constraints = true ; private boolean hide_enum_typedefs = true ; private boolean hide_assertion_properties = true ; private boolean hide_cover_point_group_cross = true ; private boolean hide_task_functions = false ; private boolean hide_module_instances = false ; private boolean hide_include_files = false ; @ Override public boolean select ( Viewer viewer , Object parentElement , Object element ) { if ( element instanceof SVDBItem && ( ( ( SVDBItem ) element ) . getType ( ) == SVDBItemType . Marker ) ) { return false ; } else if ( ( hide_variable_declarations == true ) && ( ( element instanceof SVDBVarDeclItem ) ) ) { return false ; } else if | |
1,137 | <s> package com . asakusafw . bulkloader . exporter ; import static org . junit . Assert . * ; import java . io . File ; import java . util . Arrays ; import java . util . LinkedHashMap ; import java . util . List ; import java . util . Map ; import org . junit . After ; import org . junit . AfterClass ; import org . junit . Before ; import org . junit . BeforeClass ; import org . junit . Test ; import com . asakusafw . bulkloader . bean . ExportTargetTableBean ; import com . asakusafw . bulkloader . bean . ExporterBean ; import com . asakusafw . bulkloader . common . BulkLoaderInitializer ; import com . asakusafw . bulkloader . testutil . UnitTestUtil ; public class ExportFileDeleteTest { private static List < String > propertys = Arrays . asList ( new String [ ] { "" } ) ; private static String jobflowId = "JOB_FLOW01" ; private static String executionId = "" ; @ BeforeClass public static void setUpBeforeClass ( ) throws Exception { UnitTestUtil . setUpBeforeClass ( ) ; UnitTestUtil . setUpEnv ( ) ; BulkLoaderInitializer . initDBServer ( jobflowId , executionId , propertys , "target1" ) ; UnitTestUtil . setUpDB ( ) ; } @ AfterClass public static void tearDownAfterClass ( ) throws Exception { UnitTestUtil . tearDownDB ( ) ; UnitTestUtil . tearDownAfterClass ( ) ; } @ Before public void setUp ( ) throws Exception { BulkLoaderInitializer . initDBServer ( jobflowId , executionId , propertys , "target1" ) ; UnitTestUtil . startUp ( ) ; } @ After public void tearDown ( ) throws Exception { UnitTestUtil . tearDown ( ) ; } @ Test public void deleteFileTest01 ( ) throws Exception { File dumpDir = new File ( "" ) ; File importFile1 = new File ( dumpDir , "" ) ; File importFile2 = new File ( dumpDir , "" ) ; File importFile3 = new File ( dumpDir , "" ) ; importFile1 . createNewFile ( ) ; importFile2 . createNewFile ( ) ; importFile3 . createNewFile ( ) ; Map < String , ExportTargetTableBean > targetTable = new LinkedHashMap < String , ExportTargetTableBean > ( ) ; ExportTargetTableBean bean1 = new ExportTargetTableBean ( ) ; bean1 . addExportFile ( importFile1 ) ; bean1 . addExportFile ( importFile2 ) ; targetTable . put ( "" , bean1 ) ; ExportTargetTableBean bean2 = new ExportTargetTableBean ( ) ; bean2 . addExportFile ( importFile3 ) ; targetTable . put ( "" , bean2 ) ; ExporterBean bean = new ExporterBean ( ) ; bean . setExportTargetTable ( targetTable ) ; ExportFileDelete delete = new ExportFileDelete ( ) ; delete . deleteFile ( bean ) ; assertFalse ( importFile1 . exists ( ) ) ; assertFalse ( importFile2 . exists ( ) ) ; assertFalse ( importFile3 . exists ( ) ) ; assertTrue ( dumpDir . exists ( ) ) ; } @ Test public void deleteFileTest02 ( ) throws Exception { File dumpDir = new File ( "" ) ; File importFile1 = new File ( dumpDir , "" ) ; File importFile2 = new File ( dumpDir , "" ) ; File importFile3 = new File ( dumpDir , | |
1,138 | <s> package com . aptana . rdt . internal . ui . infoviews ; import com . aptana . rdt . ui . BrowserView ; | |
1,139 | <s> package org . rubypeople . rdt . internal . debug . core . model ; import java . util . Vector ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . MultiStatus ; import org . eclipse . core . runtime . Status ; import org . eclipse . core . runtime . jobs . Job ; import org . eclipse . debug . core . DebugEvent ; import org . eclipse . debug . core . DebugException ; import org . eclipse . debug . core . DebugPlugin ; import org . eclipse . debug . core . model . IBreakpoint ; import org . eclipse . debug . core . model . IDebugTarget ; import org . eclipse . debug . core . model . IStackFrame ; import org . rubypeople . rdt . debug . core . RdtDebugCorePlugin ; import org . rubypeople . rdt . debug . core . model . IRubyThread ; import org . rubypeople . rdt . internal . debug . core . RubyDebuggerProxy ; import org . rubypeople . rdt . internal . debug . core . SuspensionPoint ; public class RubyThread extends RubyDebugElement implements IRubyThread { private RubyStackFrame [ ] frames ; private boolean isSuspended = false ; private boolean isTerminated = false ; private boolean isStepping = false ; private String name ; private String status ; private int id ; private ThreadJob fRunningAsyncJob ; private ThreadJob fAsyncJob ; public RubyThread ( IDebugTarget target , int id , String status ) { super ( target ) ; this . setId ( id ) ; this . status = status ; this . updateName ( ) ; } public IStackFrame [ ] getStackFrames ( ) { if ( frames == null ) { createStackFrames ( ) ; } return frames ; } private synchronized void createStackFrames ( ) { if ( isSuspended ( ) ) { getRubyDebuggerProxy ( ) . readFrames ( this ) ; } else { frames = new RubyStackFrame [ ] { } ; } } public int getStackFramesSize ( ) { return frames . length ; } public boolean hasStackFrames ( ) { return isSuspended ; } public int getPriority ( ) throws DebugException { return 0 ; } public IStackFrame getTopStackFrame ( ) throws DebugException { IStackFrame [ ] frames = getStackFrames ( ) ; if ( frames == null || frames . length == 0 ) return null ; return frames [ 0 ] ; } public IBreakpoint [ ] getBreakpoints ( ) { return new IBreakpoint [ ] { DebugPlugin . getDefault ( ) . getBreakpointManager ( ) . getBreakpoints ( getModelIdentifier ( ) ) [ 0 ] } ; } public boolean canResume ( ) { return isSuspended ; } public boolean canSuspend ( ) { return false ; } public boolean isSuspended ( ) { return isSuspended ; } protected void setSuspended ( boolean isSuspended ) { this . isSuspended = isSuspended ; } protected void resume ( boolean isStep ) { isStepping = isStep ; isSuspended = false ; this . updateName ( ) ; this . frames = new RubyStackFrame [ ] { } ; } public void resume ( ) throws DebugException { resume ( false ) ; ( ( RubyDebugTarget ) this . getDebugTarget ( ) ) . getRubyDebuggerProxy ( ) . resume ( this ) ; DebugEvent ev = new DebugEvent ( this | |
1,140 | <s> package net . ggtools . grand . ui . widgets ; import java . io . IOException ; import net . ggtools . grand . Configuration ; import net . ggtools . grand . ui . Application ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . eclipse . jface . dialogs . Dialog ; import org . eclipse . jface . dialogs . IDialogConstants ; import org . eclipse . swt . SWT ; import org . eclipse . swt . layout . RowLayout ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . Shell ; public class AboutDialog extends Dialog { private static final Log log = LogFactory . getLog ( AboutDialog . class ) ; private Configuration coreConfiguration ; public AboutDialog ( final Shell parentShell ) { super ( parentShell ) ; try { coreConfiguration = Configuration . getConfiguration ( ) ; } catch ( final IOException e ) { log . error ( "" , e ) ; coreConfiguration = null ; } } @ Override protected void configureShell ( final Shell newShell ) { super . configureShell ( newShell ) ; newShell . setText ( "About Grand" ) ; } @ Override protected void createButtonsForButtonBar ( final Composite parent ) { createButton ( parent , IDialogConstants . OK_ID , IDialogConstants . OK_LABEL , true ) ; } @ Override protected Control createDialogArea ( final Composite parent ) { final Composite composite = ( Composite ) super | |
1,141 | <s> package org . oddjob . sql ; import junit . framework . TestCase ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . state . ParentState ; public class MySQLTest extends TestCase { public void testCallable ( ) throws ArooaPropertyException , ArooaConversionException { if ( System . getProperty ( "mysql.home" ) == null ) { return ; } Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ) ; oddjob . run ( ) ; assertEquals ( ParentState . | |
1,142 | <s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . ExportTempImportTarget11Df ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public final class ExportTempImportTarget11DfModelOutput implements ModelOutput < ExportTempImportTarget11Df > | |
1,143 | <s> package org . rubypeople . rdt . refactoring . tests . core . splitlocal ; import java . io . FileNotFoundException ; import java . io . IOException ; import org . eclipse . jface . text . BadLocationException ; import org . rubypeople . rdt . refactoring . core . splitlocal . SplitLocalConditionChecker ; import org . rubypeople . rdt . refactoring . core . | |
1,144 | <s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . Temp7 ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public final class Temp7ModelOutput implements ModelOutput < Temp7 > { private final RecordEmitter emitter ; public Temp7ModelOutput ( RecordEmitter emitter ) { if ( emitter == null ) { throw new IllegalArgumentException ( ) ; } this . emitter = emitter ; } @ Override public void write ( Temp7 model ) throws IOException { emitter . emit ( model . getTempSidOption ( ) ) ; emitter . emit ( model . getSidOption ( ) ) ; emitter . emit ( model . getVersionNoOption ( ) ) ; emitter . emit ( | |
1,145 | <s> package net . sf . sveditor . core . db ; import java . util . ArrayList ; import java . util . List ; public class SVDBTypeInfoClassType extends SVDBTypeInfoClassItem { public | |
1,146 | <s> package org . rubypeople . rdt . ui . search ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . search . IRubySearchScope ; public class ElementQuerySpecification extends QuerySpecification { private IRubyElement fElement ; | |
1,147 | <s> package org . oddjob . framework ; import java . util . concurrent . atomic . AtomicInteger ; import java . util . concurrent . atomic . AtomicReference ; import org . oddjob . FailedToStopException ; import org . oddjob . Forceable ; import org . oddjob . Resetable ; import org . oddjob . Stateful ; import org . oddjob . arooa . life . ComponentPersistException ; import org . oddjob . images . IconHelper ; import org . oddjob . persist . Persistable ; import org . oddjob . state . IsAnyState ; import org . oddjob . state . IsExecutable ; import org . oddjob . state . IsHardResetable ; import org . oddjob . state . IsSoftResetable ; import org . oddjob . state . IsStoppable ; import org . oddjob . state . JobState ; import org . oddjob . state . JobStateChanger ; import org . oddjob . state . JobStateHandler ; import org . oddjob . state . StateChanger ; public abstract class SimpleJob extends BasePrimary implements Runnable , Resetable , Stateful , Forceable { protected transient JobStateHandler stateHandler ; private final JobStateChanger stateChanger ; protected transient volatile boolean stop ; protected SimpleJob ( ) { stateHandler = new JobStateHandler ( this ) ; stateChanger = new JobStateChanger ( stateHandler , iconHelper , new Persistable ( ) { @ Override public void persist ( ) throws ComponentPersistException { save ( ) ; } } ) ; } @ Override protected JobStateHandler stateHandler ( ) { return stateHandler ; } protected StateChanger < JobState > getStateChanger ( ) { return stateChanger ; } abstract protected int execute ( ) throws Throwable ; public final void run ( ) { ComponentBoundry . push ( loggerName ( ) , this ) ; try { if ( ! stateHandler . waitToWhen ( new IsExecutable ( ) , new Runnable ( ) { public void run ( ) { getStateChanger ( ) . setState ( JobState . EXECUTING ) ; } } ) ) { return ; } logger ( ) . info ( "Executing." ) ; final AtomicInteger result = new AtomicInteger ( ) ; final AtomicReference < Throwable > exception = new AtomicReference < Throwable > ( ) ; try { configure ( ) ; result . set ( execute ( ) ) ; logger ( ) . info ( "" + result . get ( ) ) ; } catch ( Throwable e ) { logger ( ) . error ( "" , e ) ; exception . set ( e ) ; } stateHandler . waitToWhen ( new IsStoppable ( ) , new Runnable ( ) { public void run ( ) { if ( exception . get ( ) != null ) { getStateChanger ( ) . setStateException ( exception . get ( ) ) ; } else if ( result . get ( ) == 0 ) { getStateChanger ( ) . setState ( JobState . COMPLETE ) ; } else { getStateChanger ( ) . setState ( JobState . INCOMPLETE ) ; } } } ) ; } finally { ComponentBoundry . pop ( ) ; } } protected void sleep ( final long waitTime ) { stateHandler ( ) . assertAlive ( ) ; if ( ! stateHandler ( ) . waitToWhen ( new IsStoppable ( ) , new Runnable ( ) { public void run ( ) { if ( stop ) | |
1,148 | <s> package com . aptana . rdt . internal . core . parser . warnings ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import com . aptana . rdt . internal . parser . warnings . ComparableInclusionVisitor ; public class TC_ComparableInclusionVisitor extends WarningVisitorTest { @ Override protected RubyLintVisitor createVisitor ( String code ) { return new ComparableInclusionVisitor ( code | |
1,149 | <s> package net . sf . sveditor . ui . editor ; import org . eclipse . jface . text . formatter . ContextBasedFormattingStrategy ; public class SVFormattingStrategy extends ContextBasedFormattingStrategy { @ Override public void | |
1,150 | <s> package info . naturwerk . app ; import android . os | |
1,151 | <s> package com . asakusafw . utils . java . internal . parser . javadoc . ir ; import java . io . Serializable ; | |
1,152 | <s> package org . springframework . social . google . api . tasks . impl ; import static org . springframework . social . google . api . tasks . impl . TaskTemplate . TASK_LISTS_URL ; import org . springframework . social . google . api . query . impl . ApiQueryBuilderImpl ; import org . springframework | |
1,153 | <s> package org . rubypeople . rdt . internal . corext . util ; import org . rubypeople . rdt . core . search . IRubySearchConstants ; import org . rubypeople . rdt . core . search . IRubySearchScope ; import org . rubypeople . rdt . core . search . SearchEngine ; import org . rubypeople . rdt . core . search . SearchPattern ; import org . rubypeople . rdt . internal . corext . util . TypeInfo . TypeInfoAdapter ; import org . rubypeople . rdt . internal . ui . util . StringMatcher ; import org . rubypeople . rdt . ui . dialogs . ITypeInfoFilterExtension ; public class TypeInfoFilter { private static class PatternMatcher { private String fPattern ; private int fMatchKind ; private StringMatcher fStringMatcher ; private static final char END_SYMBOL = '<' ; private static final char ANY_STRING = '*' ; private static final char BLANK = ' ' ; public PatternMatcher ( String pattern , boolean ignoreCase ) { this ( pattern , SearchPattern . R_EXACT_MATCH | SearchPattern . R_PREFIX_MATCH | SearchPattern . R_PATTERN_MATCH | SearchPattern . R_CAMELCASE_MATCH ) ; } public PatternMatcher ( String pattern , int allowedModes ) { initializePatternAndMatchKind ( pattern ) ; fMatchKind = fMatchKind & allowedModes ; if ( fMatchKind == SearchPattern . R_PATTERN_MATCH ) { fStringMatcher = new StringMatcher ( fPattern , true , false ) ; } } public String getPattern ( ) { return fPattern ; } public int getMatchKind ( ) { return fMatchKind ; } public boolean matches ( String text ) { switch ( fMatchKind ) { case SearchPattern . R_PATTERN_MATCH : return fStringMatcher . match ( text ) ; case SearchPattern . R_EXACT_MATCH : return fPattern . equalsIgnoreCase ( text ) ; case SearchPattern . R_CAMELCASE_MATCH : if ( SearchPattern . camelCaseMatch ( fPattern , text ) ) { return true ; } default : return Strings . startsWithIgnoreCase ( text , fPattern ) ; } } private void initializePatternAndMatchKind ( String pattern ) { int length = pattern . length ( ) ; if ( length == 0 ) { fMatchKind = SearchPattern . R_EXACT_MATCH ; fPattern = pattern ; return ; } char last = pattern . charAt ( length - 1 ) ; if ( pattern . indexOf ( '*' ) != - 1 || pattern . indexOf ( '?' ) != - 1 ) { fMatchKind = SearchPattern . R_PATTERN_MATCH ; switch ( last ) { case END_SYMBOL : fPattern = pattern . substring ( 0 , length - 1 ) ; break ; case BLANK : fPattern = pattern . trim ( ) ; break ; case ANY_STRING : fPattern = pattern ; break ; default : fPattern = pattern + ANY_STRING ; } return ; } if ( last == END_SYMBOL ) { fMatchKind = SearchPattern . R_EXACT_MATCH ; fPattern = pattern . substring ( 0 , length - 1 ) ; return ; } if ( last == BLANK ) { fMatchKind = SearchPattern . R_EXACT_MATCH ; fPattern = pattern . trim ( ) ; return ; } if ( SearchUtils . isCamelCasePattern ( pattern ) ) { fMatchKind = SearchPattern . R_CAMELCASE_MATCH ; fPattern = pattern ; return ; } fMatchKind = SearchPattern . R_PREFIX_MATCH ; fPattern = pattern ; } } private String fText ; private IRubySearchScope fSearchScope ; private boolean fIsWorkspaceScope ; private int fElementKind ; private ITypeInfoFilterExtension fFilterExtension ; private TypeInfoAdapter fAdapter = new TypeInfoAdapter ( ) ; private PatternMatcher fNamespaceMatcher ; private PatternMatcher fNameMatcher ; public TypeInfoFilter ( String text , IRubySearchScope scope , int elementKind , ITypeInfoFilterExtension extension ) { fText = text ; fSearchScope = scope ; fIsWorkspaceScope = fSearchScope . equals ( SearchEngine . createWorkspaceScope ( ) ) ; fElementKind = elementKind ; fFilterExtension = extension ; int index = text . lastIndexOf ( "::" ) ; if ( index == - 1 ) { fNameMatcher = new PatternMatcher ( text , true ) ; } else { fNamespaceMatcher = new PatternMatcher ( text . substring ( 0 , index ) , true ) ; String name = text . substring ( index + 2 ) ; if ( name . length ( ) == 0 ) name = "*" ; fNameMatcher = new PatternMatcher ( name , true ) ; } } public String getText ( ) { return fText ; } public boolean isSubFilter ( String text ) { if ( ! fText . startsWith ( text ) ) return false ; if ( text . endsWith ( "::" ) && ! text . equals ( fText ) ) { return false ; } return fText . indexOf ( "::" , text . length ( ) ) | |
1,154 | <s> package com . aptana . rdt . internal . core . gems ; import java . util . Set ; import com . aptana . rdt . core . gems . Gem ; public class GemParserTest extends AbstractGemParserTestCase { public void testParsingLocalGems ( ) throws GemParseException { String contents = getContents ( "" ) ; Set < Gem > gems = getParser ( ) . parse ( contents ) ; assertEquals ( 77 , gems . size ( ) ) ; } public void testEndsWithTwoLineDescription ( ) throws GemParseException { String contents = getContents ( "" ) ; Set < Gem > gems = getParser ( ) . parse | |
1,155 | <s> package com . asakusafw . compiler . flow . example ; import com . asakusafw . compiler . flow . testing . external . Ex1MockExporterDescription ; import com . asakusafw . compiler . flow . testing . external . Ex1MockImporterDescription ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . operator . ExOperatorFactory ; import com . asakusafw . compiler . flow . testing . operator . ExOperatorFactory . Update ; 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 ; @ SuppressWarnings ( "all" ) @ JobFlow ( name = "testing" ) public class MultipleUpdateStage extends FlowDescription { private In < Ex1 > in ; private Out < Ex1 > out ; public MultipleUpdateStage ( @ Import ( name = "ex1" , description = Ex1MockImporterDescription . class ) In < Ex1 > in , @ Export ( name | |
1,156 | <s> package org . rubypeople . rdt . internal . debug . ui . launcher ; import junit . framework . Test ; import junit . framework . TestSuite ; public class TS_InternalDebugUiLauncher { public static Test suite ( ) { TestSuite suite = new TestSuite ( "" ) ; suite . addTestSuite ( TC_RubyArgumentsTab . class ) ; suite | |
1,157 | <s> package com . asakusafw . bulkloader . common ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . FileInputStream ; import java . io . IOException ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Iterator ; 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 . Before ; import org . junit . BeforeClass ; import org . junit . Test ; import com . asakusafw . bulkloader . bean . ExportTargetTableBean ; import com . asakusafw . bulkloader . bean . ImportTargetTableBean ; import com . asakusafw . bulkloader . testutil . UnitTestUtil ; import com . asakusafw . runtime . util . VariableTable ; @ SuppressWarnings ( { "hiding" , "deprecation" } ) public class JobFlowParamLoaderTest { private static String targetName = "target1" ; private static List < String > propertys = Arrays . asList ( new String [ ] { "" } ) ; private static String jobflowId = "JOB_FLOW01" ; private static String executionId = "" ; @ BeforeClass public static void setUpBeforeClass ( ) throws Exception { UnitTestUtil . setUpBeforeClass ( ) ; UnitTestUtil . setUpEnv ( ) ; BulkLoaderInitializer . initDBServer ( jobflowId , executionId , propertys , "target1" ) ; UnitTestUtil . setUpDB ( ) ; } @ AfterClass public static void tearDownAfterClass ( ) throws Exception { UnitTestUtil . tearDownDB ( ) ; UnitTestUtil . tearDownAfterClass ( ) ; } @ Before public void setUp ( ) throws Exception { BulkLoaderInitializer . initDBServer ( jobflowId , executionId , propertys , targetName ) ; UnitTestUtil . startUp ( ) ; } @ After public void tearDown ( ) throws Exception { UnitTestUtil . tearDown ( ) ; } @ Test public void loadImportParamTest01 ( ) throws Exception { JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getImportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadImportParam ( targetName , "batch01" , "11" , true ) ; Map < String , ImportTargetTableBean > importTargetTable = loder . getImportTargetTables ( ) ; assertTrue ( result ) ; ImportTargetTableBean table1 = importTargetTable . get ( "XXX" ) ; assertEquals ( 3 , table1 . getImportTargetColumns ( ) . size ( ) ) ; assertEquals ( "columnA" , table1 . getImportTargetColumns ( ) . get ( 0 ) ) ; assertEquals ( "columnB" , table1 . getImportTargetColumns ( ) . get ( 1 ) ) ; assertEquals ( "columnC" , table1 . getImportTargetColumns ( ) . get ( 2 ) ) ; assertEquals ( "" , table1 . getSearchCondition ( ) ) ; assertEquals ( ImportTableLockType . find ( "1" ) , table1 . getLockType ( ) ) ; assertEquals ( ImportTableLockedOperation . find ( "3" ) , table1 . getLockedOperation ( ) ) ; assertEquals ( "" , table1 . getImportTargetType ( ) . getName ( ) ) ; assertEquals ( "" , table1 . getDfsFilePath ( ) ) ; ImportTargetTableBean table2 = importTargetTable . get ( "YYY" ) ; assertEquals ( 1 , table2 . getImportTargetColumns ( ) . size ( ) ) ; assertEquals ( "columnA" , table2 . getImportTargetColumns ( ) . get ( 0 ) ) ; assertEquals ( "" , table2 . getSearchCondition ( ) ) ; assertEquals ( ImportTableLockType . find ( "2" ) , table2 . getLockType ( ) ) ; assertEquals ( ImportTableLockedOperation . find ( "1" ) , table2 . getLockedOperation ( ) ) ; assertEquals ( "" , table2 . getImportTargetType ( ) . getName ( ) ) ; assertEquals ( "" , table2 . getDfsFilePath ( ) ) ; ImportTargetTableBean table3 = importTargetTable . get ( "ZZZ" ) ; assertEquals ( 2 , table3 . getImportTargetColumns ( ) . size ( ) ) ; assertEquals ( "columnA" , table3 . getImportTargetColumns ( ) . get ( 0 ) ) ; assertEquals ( "columnB" , table3 . getImportTargetColumns ( ) . get ( 1 ) ) ; assertNull ( table3 . getSearchCondition ( ) ) ; assertEquals ( ImportTableLockType . find ( "3" ) , table3 . getLockType ( ) ) ; assertEquals ( ImportTableLockedOperation . find ( "2" ) , table3 . getLockedOperation ( ) ) ; assertEquals ( "" , table3 . getImportTargetType ( ) . getName ( ) ) ; assertEquals ( "" , table3 . getDfsFilePath ( ) ) ; } @ Test public void loadImportParamTest02 ( ) throws Exception { VariableTable table = new VariableTable ( ) ; table . defineVariable ( "user_name" , "asakusa" ) ; table . defineVariable ( "user_pass" , "hadoop" ) ; Map < String , String > env = new HashMap < String , String > ( ) ; env . put ( Constants . THUNDER_GATE_HOME , System . getenv ( Constants . THUNDER_GATE_HOME ) ) ; env . put ( Constants . ENV_ARGS , table . toSerialString ( ) ) ; ConfigurationLoader . setEnv ( env ) ; JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getImportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadImportParam ( targetName , "batch01" , "11" , true ) ; Map < String , ImportTargetTableBean > importTargetTable = loder . getImportTargetTables ( ) ; assertTrue ( result ) ; ImportTargetTableBean table1 = importTargetTable . get ( "XXX" ) ; assertEquals ( "" , table1 . getSearchCondition ( ) ) ; } @ Test public void loadImportParamTest03 ( ) throws Exception { JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getImportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadImportParam ( targetName , "batch01" , "11" , true ) ; Map < String , ImportTargetTableBean > importTargetTable = loder . getImportTargetTables ( ) ; assertTrue ( result ) ; assertEquals ( 0 , importTargetTable . size ( ) ) ; } @ Test public void loadImportParamTest04 ( ) throws Exception { JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getImportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadImportParam ( targetName , "batch01" , "11" , true ) ; Map < String , ImportTargetTableBean > importTargetTable = loder . getImportTargetTables ( ) ; assertFalse ( result ) ; assertNull ( importTargetTable ) ; } @ Test public void loadImportParamTest05 ( ) throws Exception { VariableTable table = new VariableTable ( ) ; table . defineVariable ( "user_pass" , "hadoop" ) ; Map < String , String > env = new HashMap < String , String > ( ) ; env . put ( Constants . THUNDER_GATE_HOME , System . getenv ( Constants . THUNDER_GATE_HOME ) ) ; env . put ( Constants . ENV_ARGS , table . toSerialString ( ) ) ; ConfigurationLoader . setEnv ( env ) ; JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getImportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadImportParam ( targetName , "batch01" , "11" , true ) ; assertFalse ( result ) ; } @ Test public void loadImportParamTest06 ( ) throws Exception { JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getImportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadImportParam ( targetName , "batch01" , "11" , true ) ; assertFalse ( result ) ; } @ Test public void loadImportParamTest07 ( ) throws Exception { JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getImportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadImportParam ( targetName , "batch01" , "11" , true ) ; assertFalse ( result ) ; } @ Test public void loadImportParamTest08 ( ) throws Exception { JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getImportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadImportParam ( targetName , "batch01" , "11" , true ) ; Map < String , ImportTargetTableBean > importTargetTable = loder . getImportTargetTables ( ) ; assertTrue ( result ) ; Iterator < String > it = importTargetTable . keySet ( ) . iterator ( ) ; assertEquals ( "XXX" , it . next ( ) ) ; assertEquals ( "YYY" , it . next ( ) ) ; assertEquals ( "ZZZ" , it . next ( ) ) ; } @ Test public void loadExportParamTest01 ( ) throws Exception { JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getExportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadExportParam ( targetName , "batch01" , "21" ) ; Map < String , ExportTargetTableBean > exportTargetTable = loder . getExportTargetTables ( ) ; assertTrue ( result ) ; ExportTargetTableBean table1 = exportTargetTable . get ( "XXX" ) ; assertTrue ( table1 . isDuplicateCheck ( ) ) ; assertEquals ( "XXX_ERROR" , table1 . getErrorTableName ( ) ) ; assertEquals ( 5 , table1 . getExportTsvColumn ( ) . size ( ) ) ; assertEquals ( "columnA" , table1 . getExportTsvColumn ( ) . get ( 0 ) ) ; assertEquals ( "columnB" , table1 . getExportTsvColumn ( ) . get ( 1 ) ) ; assertEquals ( "columnC" , table1 . getExportTsvColumn ( ) . get ( 2 ) ) ; assertEquals ( "columnD" , table1 . getExportTsvColumn ( ) . get ( 3 ) ) ; assertEquals ( "columnE" , table1 . getExportTsvColumn ( ) . get ( 4 ) ) ; assertEquals ( 2 , table1 . getExportTableColumns ( ) . size ( ) ) ; assertEquals ( "columnA" , table1 . getExportTableColumns ( ) . get ( 0 ) ) ; assertEquals ( "columnB" , table1 . getExportTableColumns ( ) . get ( 1 ) ) ; assertEquals ( 5 , table1 . getErrorTableColumns ( ) . size ( ) ) ; assertEquals ( "columnA" , table1 . getErrorTableColumns ( ) . get ( 0 ) ) ; assertEquals ( "columnB" , table1 . getErrorTableColumns ( ) . get ( 1 ) ) ; assertEquals ( "columnC" , table1 . getErrorTableColumns ( ) . get ( 2 ) ) ; assertEquals ( "columnD" , table1 . getErrorTableColumns ( ) . get ( 3 ) ) ; assertEquals ( "columnE" , table1 . getErrorTableColumns ( ) . get ( 4 ) ) ; assertEquals ( 1 , table1 . getKeyColumns ( ) . size ( ) ) ; assertEquals ( "columnA" , table1 . getKeyColumns ( ) . get ( 0 ) ) ; assertEquals ( "columnF" , table1 . getErrorCodeColumn ( ) ) ; assertEquals ( "ER01" , table1 . getErrorCode ( ) ) ; assertEquals ( "" , table1 . getExportTargetType ( ) . getName ( ) ) ; List < String > path1 = table1 . getDfsFilePaths ( ) ; assertEquals ( 2 , path1 . size ( ) ) ; assertEquals ( "" , path1 . get ( 0 ) ) ; assertEquals ( "" , path1 . get ( 1 ) ) ; ExportTargetTableBean table2 = exportTargetTable . get ( "YYY" ) ; assertFalse ( table2 . isDuplicateCheck ( ) ) ; assertNull ( table2 . getErrorTableName ( ) ) ; assertEquals ( 3 , table2 . getExportTsvColumn ( ) . size ( ) ) ; assertEquals ( "columnA" , table2 . getExportTsvColumn ( ) . get ( 0 ) ) ; assertEquals ( "columnB" , table2 . getExportTsvColumn ( ) . get ( 1 ) ) ; assertEquals ( "columnC" , table2 . getExportTsvColumn ( ) . get ( 2 ) ) ; assertEquals ( 3 , table2 . getExportTableColumns ( ) . size ( ) ) ; assertEquals ( "columnA" , table2 . getExportTableColumns ( ) . get ( 0 ) ) ; assertEquals ( "columnB" , table2 . getExportTableColumns ( ) . get ( 1 ) ) ; assertEquals ( "columnC" , table2 . getExportTableColumns ( ) . get ( 2 ) ) ; assertEquals ( 0 , table2 . getErrorTableColumns ( ) . size ( ) ) ; assertEquals ( 0 , table2 . getKeyColumns ( ) . size ( ) ) ; assertNull ( table2 . getErrorCodeColumn ( ) ) ; assertNull ( table2 . getErrorCode ( ) ) ; assertEquals ( "" , table2 . getExportTargetType ( ) . getName ( ) ) ; List < String > path2 = table2 . getDfsFilePaths ( ) ; assertEquals ( 1 , path2 . size ( ) ) ; assertEquals ( "" , path2 . get ( 0 ) ) ; ExportTargetTableBean table3 = exportTargetTable . get ( "ZZZ" ) ; assertFalse ( table3 . isDuplicateCheck ( ) ) ; assertNull ( table3 . getErrorTableName ( ) ) ; assertEquals ( 1 , table3 . getExportTsvColumn ( ) . size ( ) ) ; assertEquals ( "columnA" , table3 . getExportTsvColumn ( ) . get ( 0 ) ) ; assertEquals ( 1 , table3 . getExportTableColumns ( ) . size ( ) ) ; assertEquals ( "columnA" , table3 . getExportTableColumns ( ) . get ( 0 ) ) ; assertEquals ( 0 , table3 . getErrorTableColumns ( ) . size ( ) ) ; assertEquals ( 0 , table3 . getKeyColumns ( ) . size ( ) ) ; assertNull ( table3 . getErrorCodeColumn ( ) ) ; assertNull ( table3 . getErrorCode ( ) ) ; assertEquals ( "" , table3 . getExportTargetType ( ) . getName ( ) ) ; List < String > path3 = table3 . getDfsFilePaths ( ) ; assertEquals ( 1 , path3 . size ( ) ) ; assertEquals ( "" , path3 . get ( 0 ) ) ; } @ Test public void loadExportParamTest02 ( ) throws Exception { JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getExportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadExportParam ( targetName , "batch01" , "21" ) ; Map < String , ExportTargetTableBean > exportTargetTable = loder . getExportTargetTables ( ) ; assertTrue ( result ) ; assertEquals ( 0 , exportTargetTable . size ( ) ) ; } @ Test public void loadExportParamTest03 ( ) throws Exception { JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getExportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadExportParam ( targetName , "batch01" , "21" ) ; assertFalse ( result ) ; } @ Test public void loadExportParamTest04 ( ) throws Exception { JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getExportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadExportParam ( targetName , "batch01" , "21" ) ; assertFalse ( result ) ; } @ Test public void loadExportParamTest05 ( ) throws Exception { JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getExportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadExportParam ( targetName , "batch01" , "21" ) ; assertFalse ( result ) ; } @ Test public void loadExportParamTest06 ( ) throws Exception { JobFlowParamLoader loder = new JobFlowParamLoader ( ) { @ Override protected Properties getExportProp ( File dslFile , String targetName ) throws IOException { System . out . println ( dslFile ) ; File propFile = new File ( "" ) ; FileInputStream fis = new FileInputStream ( propFile ) ; Properties prop = new Properties ( ) ; prop . load ( fis ) ; return prop ; } } ; boolean result = loder . loadExportParam ( targetName , "batch01" , "21" ) ; Map < String , ExportTargetTableBean > exportTargetTable = loder . getExportTargetTables ( ) ; assertTrue ( result ) ; Iterator < String > it = exportTargetTable . keySet ( ) . iterator ( ) ; assertEquals ( "XXX" , it . next ( ) ) ; assertEquals ( "YYY" , it . next ( ) ) ; assertEquals ( "ZZZ" , it . next ( ) ) ; } @ Test public void checkImportParamTest01 ( ) throws Exception { JobFlowParamLoader loader = new JobFlowParamLoader ( ) ; Map < String , ImportTargetTableBean > targetTable = new LinkedHashMap < String , ImportTargetTableBean > ( ) ; ImportTargetTableBean tableBean1 = new ImportTargetTableBean ( ) ; tableBean1 . setImportTargetColumns ( Arrays . asList ( new String [ ] { "TEXTDATA1" , "INTDATA1" , "DATEDATA1" } ) ) ; tableBean1 . setSearchCondition ( "INTDATA1=11" ) ; tableBean1 . setUseCache ( false ) ; tableBean1 . setLockType ( ImportTableLockType . find ( "1" ) ) ; tableBean1 . setLockedOperation ( ImportTableLockedOperation . find ( "3" ) ) ; tableBean1 . setImportTargetType ( this . getClass ( ) ) ; tableBean1 . setDfsFilePath ( "" ) ; targetTable . put ( "" , tableBean1 ) ; ImportTargetTableBean tableBean2 = new ImportTargetTableBean ( ) ; | |
1,158 | <s> package org . rubypeople . rdt . refactoring . core . inlinelocal ; import java . util . ArrayList ; import java . util . Collection ; import org . jruby . ast . ClassNode ; import org . jruby . ast . IterNode ; import org . jruby . ast . MethodDefNode ; import org . jruby . ast . MultipleAsgnNode ; import org . jruby . ast . Node ; import org . jruby . ast . RootNode ; import org . jruby . lexer . yacc . ISourcePosition ; import org . rubypeople . rdt . refactoring . core . IRefactoringConfig ; import org . rubypeople . rdt . refactoring . core . NodeProvider ; import org . rubypeople . rdt . refactoring . core . RefactoringConditionChecker ; import org . rubypeople . rdt . refactoring . core . SelectionNodeProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . LocalNodeWrapper ; import org . rubypeople . rdt . refactoring . util . JRubyRefactoringUtils ; import org . rubypeople . rdt . refactoring . util . NodeUtil ; public class InlineLocalConditionChecker extends RefactoringConditionChecker { private InlineLocalConfig config ; private RootNode rootNode ; public InlineLocalConditionChecker ( InlineLocalConfig config ) { super ( config ) ; } public void init ( IRefactoringConfig configObj ) { this . config = ( InlineLocalConfig ) configObj ; rootNode = config . getDocumentProvider ( ) . getActiveFileRootNode ( ) ; int caretPosition = config . getCaretPosition ( ) ; config . setEnclosingMethod ( ( MethodDefNode ) SelectionNodeProvider . getSelectedNodeOfType ( rootNode , caretPosition , MethodDefNode . class ) ) ; config . setEnclosingScopeNode ( SelectionNodeProvider . getEnclosingScope ( rootNode , caretPosition ) ) ; Node locVarNode = SelectionNodeProvider . getSelectedNodeOfType ( rootNode , caretPosition , LocalNodeWrapper . LOCAL_NODES_CLASSES ) ; if ( locVarNode == null ) { return ; } config . setSelectedItem ( new LocalNodeWrapper ( locVarNode ) ) ; config . setSelectedItemName ( LocalNodeWrapper . getLocalNodeName ( config . getSelectedItem ( ) ) ) ; initDefinitionNode ( ) ; initLocalOccurrences ( ) ; } private void initDefinitionNode ( ) { Collection < LocalNodeWrapper > asgnNodes = LocalNodeWrapper . gatherLocalAsgnNodes ( config . getEnclosingScopeNode ( ) ) ; for ( LocalNodeWrapper currentAsgnNode : asgnNodes ) { if ( currentAsgnNode . getName ( ) . equals ( config . getSelectedItemName ( ) | |
1,159 | <s> package org . rubypeople . rdt . internal . ui . search ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . swt . graphics . Image ; import org . rubypeople . rdt . core . IRubyModel ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . ui . RubyElementLabels ; public class PostfixLabelProvider extends SearchLabelProvider { private ITreeContentProvider fContentProvider ; public PostfixLabelProvider ( RubySearchResultPage page ) { super ( page ) ; fContentProvider = new LevelTreeContentProvider . FastRubyElementProvider ( ) ; } public Image getImage ( Object element ) { Image image = super . getImage ( element ) ; if ( image != null ) return image ; return getParticipantImage ( element ) ; } public String getText ( Object element ) { String labelWithCounts = getLabelWithCounts ( element , internalGetText ( element ) ) ; StringBuffer res = new StringBuffer ( labelWithCounts ) ; ITreeContentProvider provider = ( ITreeContentProvider ) fPage . getViewer ( ) . getContentProvider ( ) ; Object visibleParent = provider . getParent ( element ) ; Object realParent = fContentProvider . getParent ( element ) ; Object lastElement = element ; while ( realParent != null && ! ( realParent instanceof IRubyModel ) && ! realParent . equals ( visibleParent ) ) { if ( ! isSameInformation ( realParent , lastElement ) ) { res . append ( RubyElementLabels . CONCAT_STRING ) . append ( internalGetText ( realParent ) ) ; } | |
1,160 | <s> package org . rubypeople . rdt . ui ; import org . eclipse . ui . IEditorInput ; import org | |
1,161 | <s> package com . asakusafw . runtime . flow ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import org . junit . Test ; public class ArrayListBufferTest { @ Test public void createEmpty ( ) { ArrayListBuffer < Holder > buf = new ArrayListBuffer < Holder > ( ) ; buf . begin ( ) ; buf . end ( ) ; assertThat ( buf . size ( ) , is ( 0 ) ) ; buf . shrink ( ) ; } @ Test public void createSingle ( ) { ArrayListBuffer < Holder > buf = new ArrayListBuffer < Holder > ( ) ; buf . begin ( ) ; assertThat ( buf . isExpandRequired ( ) , is ( true ) ) ; buf . expand ( new Holder ( "" ) ) ; assertThat ( buf . isExpandRequired ( ) , is ( false ) ) ; buf . advance ( ) . value = "Hello" ; buf . end ( ) ; assertThat ( buf . size ( ) , is ( 1 ) ) ; assertThat ( buf . get ( 0 ) , is ( new Holder ( "Hello" ) ) ) ; buf . shrink ( ) ; } @ Test public void reuse ( ) { ArrayListBuffer < Holder > buf = new ArrayListBuffer < Holder > ( ) ; buf . begin ( ) ; assertThat ( buf . isExpandRequired ( ) , is ( true ) ) ; buf . expand ( new Holder ( "" ) ) ; buf . advance ( ) . value = "Hello" ; buf . end ( ) ; buf . shrink ( ) ; buf . begin ( ) ; assertThat ( buf . getCursorPosition ( ) | |
1,162 | <s> package org . oddjob ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStream ; import java . lang . reflect . Array ; import java . util . Enumeration ; import java . util . Properties ; import org . apache . log4j . ConsoleAppender ; import org . apache . log4j . Level ; import org . apache . log4j . Logger ; import org . apache . log4j . PatternLayout ; import org . apache . log4j . PropertyConfigurator ; import org . oddjob . arooa . convert . convertlets . FileConvertlets ; import org . oddjob . input . ConsoleInputHandler ; import org . oddjob . input . StdInInputHandler ; import org . oddjob . oddballs . OddballsDescriptorFactory ; import org . oddjob . oddballs . OddballsDirDescriptorFactory ; public class Main { private static Logger logger ; private static Logger logger ( ) { if ( logger == null ) { logger = Logger . getLogger ( Main . class ) ; } return logger ; } public static final String ODDBALLS_DIR = "oddballs" ; public static final String USER_PROPERTIES = "" ; public OddjobRunner init ( String args [ ] ) throws IOException { Properties props = processUserProperties ( ) ; String oddjobFile = null ; String name = null ; String logConfig = null ; File oddballsDir = null ; String oddballsPath = null ; String oddjobHome = System . getProperty ( "oddjob.home" ) ; if ( oddjobHome != null ) { oddballsDir = new File ( oddjobHome , ODDBALLS_DIR ) ; } int startArg = 0 ; for ( int i = 0 ; i < args . length ; i ++ ) { String arg = args [ i ] ; if ( arg . equals ( "-h" ) || arg . equals ( "-help" ) ) { usage ( ) ; return null ; } else if ( arg . equals ( "-v" ) || arg . equals ( "-version" ) ) { version ( ) ; return null ; } else if ( arg . equals ( "-n" ) || arg . equals ( "-name" ) ) { name = args [ ++ i ] ; startArg += 2 ; } else if ( arg . equals ( "-l" ) || arg . equals ( "-log" ) ) { logConfig = args [ ++ i ] ; startArg += 2 ; } else if ( arg . equals ( "-f" ) || arg . equals ( "-file" ) ) { oddjobFile = args [ ++ i ] ; startArg += 2 ; } else if ( arg . equals ( "-nb" ) || arg . equals ( "-noballs" ) ) { oddballsDir = null ; startArg += 1 ; } else if ( arg . equals ( "-ob" ) || arg . equals ( "-oddballs" ) ) { oddballsDir = new File ( args [ ++ i ] ) ; startArg += 2 ; } else if ( arg . equals ( "-op" ) || arg . equals ( "-obpath" ) ) { oddballsPath = args [ ++ i ] ; startArg += 2 ; } else if ( arg . equals ( "--" ) | |
1,163 | <s> package org . apache . camel . example . reportincident ; import junit . framework . TestCase ; import org . apache . camel . CamelContext ; import org . apache . camel . impl . DefaultCamelContext ; import org . apache . cxf . jaxws . JaxWsProxyFactoryBean ; public class ReportIncidentNoSpringRoutesTest extends TestCase { private CamelContext camel ; private static String ADDRESS = "" ; protected void startCamel ( ) throws Exception { camel = new DefaultCamelContext ( ) ; camel . addRoutes ( new ReportIncidentRoutes ( ) ) ; camel . start ( ) ; } protected static ReportIncidentEndpoint createCXFClient ( ) { JaxWsProxyFactoryBean factory | |
1,164 | <s> package org . rubypeople . rdt . internal . ui . browsing ; import org . rubypeople . rdt | |
1,165 | <s> package org . oddjob . schedules . schedules ; import java . text . ParseException ; import java . util . TimeZone ; import junit . framework . TestCase ; import org . oddjob . arooa . utils . DateHelper ; import org . oddjob . schedules . IntervalTo ; import org . oddjob . schedules . ScheduleResult ; import org . oddjob . schedules . ScheduleRoller ; import org . oddjob . schedules . units . DayOfWeek ; public class TimeOverDSTBoundryTest extends TestCase { public void testDayLightSavingInAutumnWithAtBoundry ( ) throws ParseException { TimeZone . setDefault ( TimeZone . getTimeZone ( "" ) ) ; TimeSchedule test = new TimeSchedule ( ) ; test . setAt ( "01:00" ) ; WeeklySchedule weekly = new WeeklySchedule ( ) ; weekly . setOn ( DayOfWeek . Days . SUNDAY ) ; weekly . setRefinement ( test ) ; ScheduleRoller roller = new ScheduleRoller ( weekly ) ; ScheduleResult [ ] results = roller . resultsFrom ( DateHelper . parseDateTime ( "" ) ) ; ScheduleResult expected ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , results [ 0 ] ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , results [ 1 ] ) ; TimeZone . setDefault ( null ) ; } public void testDayLightSavingInSpringWithAtBoundry ( ) throws ParseException { TimeZone . setDefault ( TimeZone . getTimeZone ( "" ) ) ; TimeSchedule test = new TimeSchedule ( ) ; test . setAt ( "01:00" ) ; WeeklySchedule weekly = new WeeklySchedule ( ) ; weekly . setOn ( DayOfWeek . Days . SUNDAY ) ; weekly . setRefinement ( test ) ; ScheduleRoller roller = new ScheduleRoller ( weekly ) ; ScheduleResult [ ] results = roller . resultsFrom ( DateHelper . parseDate ( "" ) ) ; ScheduleResult expected ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , results [ 0 ] ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , results [ 1 ] ) ; TimeZone . setDefault ( null ) ; } public void testDayLightSavingInAutumnWithAtBoundry2 ( ) throws ParseException { TimeZone . setDefault ( TimeZone . getTimeZone ( "" ) ) ; TimeSchedule test = new | |
1,166 | <s> package org . rubypeople . rdt . internal . ui . dialogs ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jface . dialogs . DialogPage ; import org . eclipse . jface . dialogs . IMessageProvider ; public class StatusUtil { public static IStatus getMoreSevere ( IStatus s1 , IStatus s2 ) { if ( s1 . getSeverity ( ) > s2 . getSeverity ( ) ) { return s1 ; } return s2 ; } public | |
1,167 | <s> package org . rubypeople . rdt . core . formatter ; import java . util . HashMap ; import java . util . Map ; import org . rubypeople . rdt . internal . formatter . Indentor ; public class EditableFormatHelper implements FormatHelper { private static final String DEFAULT_LINE_DELIMITER = "n" ; private String lineDelimiter ; private boolean spaceAfterCommaInListings ; private boolean spacesBeforeAndAfterAssignments ; private boolean alwaysParanthesizeMethodCalls ; private boolean spacesAroundHashAssignment ; private boolean spacesBeforeAndAfterHashContent ; private boolean spaceBeforeIterVars ; private boolean spaceAfterIterVars ; private boolean newlineBetweenClassBodyElements ; private boolean alwaysParanthesizeMethodDefs ; private boolean spaceBeforeIterBrackets ; private boolean spaceBeforeClosingIterBrackets ; private boolean insertDoAfterWhileExpression ; private boolean collpaseOperatorSelfAssignments ; private Indentor indentor = new Indentor ( 2 , ' ' ) ; public EditableFormatHelper ( ) { this ( DEFAULT_LINE_DELIMITER ) ; } public EditableFormatHelper ( String lineDelimiter ) { this ( new HashMap < String , Object > ( ) ) ; if ( lineDelimiter != null ) this . lineDelimiter = lineDelimiter ; } public EditableFormatHelper ( Map < String , Object > options ) { spaceAfterCommaInListings = getBoolean ( options , EditableFormatHelper . SPACE_AFTER_COMMA_IN_LISTS , true ) ; alwaysParanthesizeMethodCalls = getBoolean ( options , EditableFormatHelper . ALWAYS_SURROUND_METHOD_CALLS_IN_PARENS , false ) ; alwaysParanthesizeMethodDefs = getBoolean ( options , EditableFormatHelper . ALWAYS_SURROUND_METHOD_ARGUMENTS_IN_PARENS , false ) ; spacesAroundHashAssignment = getBoolean ( options , EditableFormatHelper . SPACES_AROUND_HASH_ASSIGNMENT , true ) ; spacesBeforeAndAfterHashContent = getBoolean ( options , EditableFormatHelper . SPACES_BEFORE_AND_AFTER_HASH_CONTENT , false ) ; spacesBeforeAndAfterAssignments = getBoolean ( options , EditableFormatHelper . SPACE_BEFORE_AND_AFTER_ASSIGNMENTS , true ) ; spaceBeforeIterBrackets = getBoolean ( options , EditableFormatHelper . SPACE_BEFORE_BLOCK_BRACKETS , true ) ; spaceAfterIterVars = getBoolean ( options , EditableFormatHelper . SPACE_AFTER_ITER_VARS , true ) ; spaceBeforeIterVars = getBoolean ( options , EditableFormatHelper . SPACES_BEFORE_ITER_VARS , true ) ; spaceBeforeClosingIterBrackets = getBoolean ( options , EditableFormatHelper . SPACE_BEFORE_CLOSING_BLOCK_BRACKET , true ) ; insertDoAfterWhileExpression = getBoolean ( options , EditableFormatHelper . INSERT_DO_AFTER_WHILE_EXPRESSION , false ) ; newlineBetweenClassBodyElements = getBoolean ( options , EditableFormatHelper . NEWLINE_BETWEEN_CLASS_BODY_ELEMENTS , false ) ; collpaseOperatorSelfAssignments = getBoolean ( options , EditableFormatHelper . COLLAPSE_OPERATOR_SELF_ASSIGNMENTS , true ) ; lineDelimiter = DEFAULT_LINE_DELIMITER ; } private boolean getBoolean ( Map < String , Object > options , String key , boolean defaultValue ) { Object value = options . get ( key ) ; if ( value == null ) return defaultValue ; if ( value instanceof Boolean ) return ( Boolean ) value ; if ( value instanceof String ) { String str = ( String ) value ; if ( str . trim ( ) . toLowerCase ( ) . equals ( Boolean . TRUE . toString ( ) . toLowerCase ( ) ) ) return true ; if ( str . trim ( ) . toLowerCase ( ) . equals ( Boolean . FALSE . toString ( ) . toLowerCase ( ) ) ) return false ; } return defaultValue ; } public Indentor getIndentor ( ) { return indentor ; } public void setTabInsteadOfSpaces ( boolean tabInsteadOfSpaces ) { if ( tabInsteadOfSpaces ) { indentor . setIndentationChar ( '\t' ) ; } else { indentor . setIndentationChar ( ' ' ) ; } } public void setIndentationSteps ( int indentationSteps ) { indentor . setIndentationSteps ( indentationSteps ) ; } public void setLineDelimiter ( String lineDelimiter ) { if ( lineDelimiter != null ) this . lineDelimiter = lineDelimiter ; } public String beforeAssignment ( ) { return spacesBeforeAndAfterAssignments ? " " : "" ; } public String afterAssignment ( ) { return spacesBeforeAndAfterAssignments ? " " : "" ; } public String matchOperator ( ) { return spacesBeforeAndAfterAssignments ? " =~ " : "=~" ; } public String beforeCallArguments ( ) { return alwaysParanthesizeMethodCalls ? "(" : " " ; } public String afterCallArguments ( ) { return alwaysParanthesizeMethodCalls ? ")" : "" ; } public String beforeHashContent ( ) { return spacesBeforeAndAfterHashContent ? " " : "" ; } public String afterHashContent ( ) { return spacesBeforeAndAfterHashContent ? " " : "" ; } public String beforeIterVars ( ) { return spaceBeforeIterVars ? " " : "" ; } public String afterIterVars ( ) { return spaceAfterIterVars ? " " : "" ; } public String beforeMethodArguments ( ) { return alwaysParanthesizeMethodDefs ? "(" : " " ; } public String afterMethodArguments ( ) { return alwaysParanthesizeMethodDefs ? ")" : "" ; } public String beforeIterBrackets ( ) { return spaceBeforeIterBrackets ? " " : "" ; } public String beforeClosingIterBrackets ( ) { return spaceBeforeClosingIterBrackets ? " " : | |
1,168 | <s> package net . sf . sveditor . ui . editor . actions ; import java . util . ResourceBundle ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; | |
1,169 | <s> package com . mcbans . firestar . mcbans . org . json ; import java . io . IOException ; import java . io . Writer ; public class JSONWriter { private static final int maxdepth = 20 ; private boolean comma ; protected char mode ; private JSONObject stack [ ] ; private int top ; protected Writer writer ; public JSONWriter ( Writer w ) { this . comma = false ; this . mode = 'i' ; this . stack = new JSONObject [ maxdepth ] ; this . top = 0 ; this . writer = w ; } private JSONWriter append ( String string ) throws JSONException { if ( string == null ) { throw new JSONException ( "Null pointer" ) ; } if ( this . mode == 'o' || this . mode == 'a' ) { try { if ( this . comma && this . mode == 'a' ) { this . writer . write ( ',' ) ; } this . writer . write ( string ) ; } catch ( IOException e ) { throw new JSONException ( e ) ; } if ( this . mode == 'o' ) { | |
1,170 | <s> package org . oddjob . state ; import java . io . File ; import java . util . Properties ; import java . util . concurrent . Future ; import junit . framework . TestCase ; import org . oddjob . FragmentHelper ; import org . oddjob . OurDirs ; import org . oddjob . StateSteps ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . framework . ServicesJob ; import org . oddjob . scheduling . MockScheduledExecutorService ; import org . oddjob . scheduling . MockScheduledFuture ; public class AndStateTest extends TestCase { private class Result implements StateListener { State result ; public void jobStateChange ( StateEvent event ) { result = event . getState ( ) ; } } private class UnusedServices extends MockScheduledExecutorService { } public void testComplete ( ) { AndState test = new AndState ( ) ; test . setExecutorService ( new UnusedServices ( ) ) ; test . run ( ) ; Result listener = new Result ( ) ; test . addStateListener ( listener ) ; assertEquals ( ParentState . READY , listener . result ) ; FlagState j1 = new FlagState ( JobState . COMPLETE ) ; test . setJobs ( 0 , j1 ) ; assertEquals ( ParentState . READY , listener . result ) ; j1 . run ( ) ; assertEquals ( ParentState . COMPLETE , listener . result ) ; FlagState j2 = new FlagState ( JobState . COMPLETE ) ; test . setJobs ( 0 , j2 ) ; assertEquals ( ParentState . READY , listener . result ) ; j2 . run ( ) ; assertEquals ( ParentState . COMPLETE , listener . result ) ; test . setJobs ( 1 , null ) ; assertEquals ( ParentState . COMPLETE , listener . result ) ; test . setJobs ( 0 , null ) ; assertEquals ( ParentState . READY , listener . result ) ; } public void testException ( ) { AndState test = new AndState ( ) ; test . setExecutorService ( new UnusedServices ( ) ) ; test . run ( ) ; Result listener = new Result ( ) ; test . addStateListener ( listener ) ; assertEquals | |
1,171 | <s> package com . asakusafw . compiler . batch . batch ; import com . asakusafw . vocabulary . batch . Batch ; import com . asakusafw . vocabulary . batch . BatchDescription ; @ Batch ( name = "testing" ) public class SimpleBatch extends BatchDescription { @ Override protected void describe | |
1,172 | <s> package net . sf . sveditor . core . db . stmt ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import net . sf . sveditor . core . db . ISVDBChildItem ; import net . sf . sveditor . core . db . ISVDBChildParent ; import net . sf . sveditor . core . db . SVDBItemType ; public class SVDBImportStmt extends SVDBStmt implements ISVDBChildParent { public List < SVDBImportItem > fImportList ; public SVDBImportStmt ( ) { super ( SVDBItemType . ImportStmt ) ; fImportList = new ArrayList < SVDBImportItem > ( ) ; } | |
1,173 | <s> package com . asakusafw . yaess . multidispatch ; import java . io . IOException ; import com . asakusafw . yaess . core . CommandScript ; import com . asakusafw . yaess . core . CommandScriptHandler ; import com . asakusafw . yaess . core . ExecutionContext ; public class | |
1,174 | <s> package com . asakusafw . utils . java . internal . parser . javadoc . ir ; public interface IrDocElement { IrDocElementKind getKind ( ) ; IrLocation getLocation ( ) ; void setLocation ( IrLocation location ) ; < R | |
1,175 | <s> package org . rubypeople . rdt . internal . ui . text ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . text . IAutoEditStrategy ; import org . eclipse . jface . text . IInformationControlCreator ; import org . eclipse . jface . text . ITextHover ; import org . eclipse . jface . text . formatter . IContentFormatter ; import org . eclipse . jface . text . hyperlink . IHyperlinkDetector ; import org . eclipse . jface . text . information . IInformationPresenter ; import org . eclipse . jface . text . source . IAnnotationHover ; import org . eclipse . jface . text . source . ISourceViewer ; import org . eclipse . ui . texteditor . ITextEditor ; import org . rubypeople . rdt . ui . text . IColorManager ; import org . rubypeople . rdt . ui . text . RubySourceViewerConfiguration ; public class SimpleRubySourceViewerConfiguration extends RubySourceViewerConfiguration { private boolean fConfigureFormatter ; public SimpleRubySourceViewerConfiguration ( IColorManager colorManager , IPreferenceStore preferenceStore , ITextEditor editor , String partitioning , boolean configureFormatter ) | |
1,176 | <s> package com . asakusafw . windgate . file . session ; import java . io . File ; import java . io . FileFilter ; import java . io . IOException ; import java . io . RandomAccessFile ; import java . nio . channels . FileLock ; import java . nio . channels . OverlappingFileLockException ; import java . nio . charset . Charset ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . windgate . core . session . SessionException ; import com . asakusafw . windgate . core . session . SessionException . Reason ; import com . asakusafw . windgate . core . session . SessionMirror ; import com . asakusafw . windgate . core . session . SessionProfile ; import com . asakusafw . windgate . core . session . SessionProvider ; public class FileSessionProvider extends SessionProvider { static final FileSessionLogger WGLOG = new FileSessionLogger ( FileSessionProvider . class ) ; static final Logger LOG = LoggerFactory . getLogger ( FileSessionProvider . class ) ; private static final String VALID_STRING = "VALID" ; private static final String DISPOSED_STRING = "DISPOSED" ; private static final byte [ ] VALID = String . format ( "%-10s%n" , VALID_STRING ) . getBytes ( Charset . forName ( "ASCII" ) ) ; private static final byte [ ] DISPOSED = String . format ( "%-10s%n" , DISPOSED_STRING ) . getBytes ( Charset . forName ( "ASCII" ) ) ; public static final String KEY_DIRECTORY = "directory" ; private volatile File directory ; @ Override protected void configure ( SessionProfile profile ) throws IOException { LOG . debug ( "" , profile . getProviderClass ( ) . getName ( ) ) ; directory = prepareDirectory ( profile ) ; LOG . debug ( "" , directory ) ; } File getDirectory ( ) { return directory ; } private File prepareDirectory ( SessionProfile profile ) throws IOException { assert profile != null ; String rawPath = profile . getConfiguration ( ) . get ( KEY_DIRECTORY ) ; if ( rawPath == null || rawPath . isEmpty ( ) ) { WGLOG . error ( "E00001" , KEY_DIRECTORY , rawPath ) ; throw new IOException ( MessageFormat . format ( "" , KEY_DIRECTORY ) ) ; } String path ; try { LOG . debug ( "" , rawPath ) ; path = profile . getContext ( | |
1,177 | <s> package net . bioclipse . opentox . test ; import net . bioclipse . core . tests . coverage . AbstractCoverageTest ; import net . bioclipse . managers . business . IBioclipseManager ; import net . bioclipse . opentox . business . IOpentoxManager ; import net . bioclipse | |
1,178 | <s> package com . sun . tools . hat . internal . model ; abstract public class AbstractJavaHeapObjectVisitor implements JavaHeapObjectVisitor { abstract public void visit ( JavaHeapObject other ) ; public boolean | |
1,179 | <s> package org . oddjob . persist ; import java . io . File ; import junit . framework . TestCase ; import org . apache . commons . io . FileUtils ; import org . apache . log4j . Logger ; import org . oddjob . Helper ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . OddjobSessionFactory ; import org . oddjob . OurDirs ; import org . oddjob . Stateful ; import org . oddjob . Structural ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . life . ArooaSessionAware ; import org . oddjob . arooa . life . ComponentPersistException ; import org . oddjob . arooa . life . ComponentPersister ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . state . JobState ; import org . oddjob . state . ParentState ; public class FileSilhouettesTest extends TestCase { private static final Logger logger = Logger . getLogger ( FileSilhouettesTest . class ) ; File archiveDir ; @ Override protected void setUp ( ) throws Exception { logger . debug ( "" + getName | |
1,180 | <s> package org . rubypeople . rdt . internal . core . search . indexing ; import java . io . IOException ; import java . net . URI ; import org . eclipse . core . filesystem . EFS ; 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 . resources . IWorkspaceRoot ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . compiler . util . SimpleLookupTable ; import org . rubypeople . rdt . internal . core . LoadpathEntry ; import org . rubypeople . rdt . internal . core . RubyProject ; import org . rubypeople . rdt . internal . core . SourceElementParser ; import org . rubypeople . rdt . internal . core . index . Index ; import org . rubypeople . rdt . internal . core . search . processing . JobManager ; import org . rubypeople . rdt . internal . core . util . Util ; public class IndexAllProject extends IndexRequest { IProject project ; public IndexAllProject ( IProject project , IndexManager manager ) { super ( project . getFullPath ( ) , manager ) ; this . project = project ; } public boolean equals ( Object o ) { if ( o instanceof IndexAllProject ) return this . project . equals ( ( ( IndexAllProject ) o ) . project ) ; return false ; } public boolean execute ( IProgressMonitor progressMonitor ) { if ( this . isCancelled || progressMonitor != null && progressMonitor . isCanceled ( ) ) return true ; if ( ! project . isAccessible ( ) ) return true ; ReadWriteMonitor monitor = null ; try { RubyProject rubyProject = ( RubyProject ) RubyCore . create ( this . project ) ; ILoadpathEntry [ ] entries = rubyProject . getRawLoadpath ( ) ; int length = entries . length ; ILoadpathEntry [ ] sourceEntries = new ILoadpathEntry [ length ] ; int sourceEntriesNumber = 0 ; for ( int i = 0 ; i < length ; i ++ ) { ILoadpathEntry entry = entries [ i ] ; if ( entry . getEntryKind ( ) == ILoadpathEntry . CPE_SOURCE ) sourceEntries [ sourceEntriesNumber ++ ] = entry ; } if ( sourceEntriesNumber == 0 ) { IPath projectPath = rubyProject . getPath ( ) ; for ( int i = 0 ; i < length ; i ++ ) { ILoadpathEntry entry = entries [ i ] ; if ( entry . getEntryKind ( ) == ILoadpathEntry . CPE_LIBRARY && entry . getPath ( ) . equals ( projectPath ) ) { this . manager . indexLibrary ( projectPath , this . project ) ; return true ; } } Index index = this . manager . getIndexForUpdate ( this . containerPath , true , true ) ; if ( index != null ) this . manager . saveIndex ( index ) ; return true ; } if ( sourceEntriesNumber != length ) System . arraycopy ( sourceEntries , 0 , sourceEntries = new ILoadpathEntry [ sourceEntriesNumber ] , 0 , sourceEntriesNumber ) ; Index index = this . manager . getIndexForUpdate ( this . containerPath , true , true ) ; if ( index == null ) return true ; monitor = index . monitor ; if ( monitor == null ) return true ; monitor . enterRead ( ) ; String [ ] paths = index . queryDocumentNames ( "" ) ; int max = paths == null ? 0 : paths . length ; final SimpleLookupTable indexedFileNames = new SimpleLookupTable ( max == 0 ? 33 : max + 11 ) ; final String OK = "OK" ; final String DELETED = "DELETED" ; if ( paths != null ) { for ( int i = 0 ; i < max ; i ++ ) indexedFileNames . put ( paths [ i ] , DELETED ) ; } final long indexLastModified = max == 0 ? 0L : index . getIndexFile ( ) . lastModified ( ) ; IWorkspaceRoot root = this . project . getWorkspace ( ) . getRoot ( ) ; for ( int i = 0 ; i < sourceEntriesNumber ; i ++ ) { if ( this . isCancelled ) return false ; ILoadpathEntry entry | |
1,181 | <s> package fi . koku . services . entity . community . v1 ; import java . net . URL ; import javax . xml . namespace . QName ; import javax . xml . ws . BindingProvider ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; public class CommunityServiceFactory { private String uid ; private String pwd ; private String endpointBaseUrl ; private final URL wsdlLocation = getClass ( ) . getClassLoader ( ) . getResource ( "" ) ; private static Logger log = LoggerFactory . getLogger ( CommunityServiceFactory . class ) ; public CommunityServiceFactory ( String uid , String pwd , String endpointBaseUrl ) { this . uid = uid ; this . pwd = pwd ; this . endpointBaseUrl = endpointBaseUrl ; } public CommunityServicePortType getCommunityService ( ) { if ( wsdlLocation == null ) | |
1,182 | <s> package org . rubypeople . rdt . refactoring . tests . core . pushdown ; import junit . framework . Test ; import junit . framework . TestSuite ; import org . rubypeople . rdt . | |
1,183 | <s> package com . asakusafw . compiler . flow ; import java . io . File ; import java . io . FileOutputStream ; import java . io . IOException ; import java . io . OutputStream ; import java . text . MessageFormat ; import java . text . SimpleDateFormat ; import java . util . Date ; import java . util . List ; import java . util . Properties ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . external . ExternalIoAnalyzer ; import com . asakusafw . compiler . flow . jobflow . JobflowCompiler ; import com . asakusafw . compiler . flow . jobflow . JobflowModel ; import com . asakusafw . compiler . flow . plan . StageBlock ; import com . asakusafw . compiler . flow . plan . StageGraph ; import com . asakusafw . compiler . flow . plan . StagePlanner ; import com . asakusafw . compiler . flow . stage . StageCompiler ; import com . asakusafw . compiler . flow . stage . StageModel ; import com . asakusafw . compiler . flow . visualizer . FlowVisualizer ; import com . asakusafw . runtime . core . context . RuntimeContext ; import com . asakusafw . vocabulary . flow . graph . FlowGraph ; public class FlowCompiler { private final FlowCompilerConfiguration configuration ; private final FlowCompilingEnvironment environment ; public FlowCompiler ( FlowCompilerConfiguration configuration ) { Precondition . checkMustNotBeNull ( configuration , "" ) ; this . configuration = configuration ; this . environment = createEnvironment ( ) ; } public String getTargetFlowId ( ) { return configuration . getFlowId ( ) ; } public JobflowModel compile ( FlowGraph graph ) throws IOException { Precondition . checkMustNotBeNull ( graph , "graph" ) ; validate ( graph ) ; StageGraph stageGraph = plan ( graph ) ; visualize ( graph , stageGraph ) ; List < StageModel > stages = compileStages ( stageGraph ) ; JobflowModel jobflow = compileJobflow ( stageGraph , stages ) ; addApplicationInfo ( ) ; return jobflow ; } public void buildSources ( File output ) throws IOException { Precondition . checkMustNotBeNull ( output , "output" ) ; OutputStream stream = open ( output ) ; try { buildSources ( stream ) ; } finally { stream . close ( ) ; } } public void collectSources ( File output ) throws IOException { Precondition . checkMustNotBeNull ( output , "output" ) ; OutputStream stream = open ( output ) ; try { collectSources ( stream ) ; } finally { stream . close ( ) ; } } private OutputStream open ( File file ) throws IOException { assert file != null ; if ( file . exists ( ) == false ) { File parent = file . getParentFile ( ) ; assert parent != | |
1,184 | <s> package net . sf . sveditor . core . scanutils ; public interface ITextScanner { int get_ch ( ) ; | |
1,185 | <s> package org . rubypeople . rdt . internal . corext . dom ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . runtime . Assert ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . Region ; import org . jruby . ast . Node ; import org . rubypeople . rdt . internal . core . parser . InOrderVisitor ; public class SelectionAnalyzer extends InOrderVisitor { private Selection fSelection ; private boolean fTraverseSelectedNode ; private Node fLastCoveringNode ; private List < Node > fSelectedNodes ; public SelectionAnalyzer ( Selection selection , boolean traverseSelectedNode ) { Assert . isNotNull ( selection ) ; fSelection = selection ; fTraverseSelectedNode = traverseSelectedNode ; } public boolean hasSelectedNodes ( ) { return fSelectedNodes != null && ! fSelectedNodes . isEmpty ( ) ; } public Node [ ] getSelectedNodes ( ) { if ( fSelectedNodes == null || fSelectedNodes . isEmpty ( ) ) return new Node [ 0 ] ; return ( Node [ ] ) fSelectedNodes . toArray ( new Node [ fSelectedNodes . size ( ) ] ) ; } public Node getFirstSelectedNode ( ) { if ( fSelectedNodes == null || fSelectedNodes . isEmpty ( ) ) return null ; return ( Node ) fSelectedNodes . get ( 0 ) ; } public Node getLastSelectedNode ( ) { if ( fSelectedNodes == null || fSelectedNodes . isEmpty ( ) ) return null ; return ( Node ) fSelectedNodes . get ( fSelectedNodes . size ( ) - 1 ) ; } public IRegion getSelectedNodeRange ( ) { if ( fSelectedNodes == null || fSelectedNodes . isEmpty ( ) ) return null ; Node firstNode = ( Node ) fSelectedNodes . get ( 0 ) ; Node lastNode = ( Node ) fSelectedNodes . get ( fSelectedNodes . size ( ) - 1 ) ; int start = firstNode . getPosition ( ) . getStartOffset ( ) ; return new Region ( start , lastNode . getPosition ( ) . getEndOffset ( ) - start ) ; } public Node getLastCoveringNode ( ) { return fLastCoveringNode ; } protected Selection getSelection ( ) { return fSelection ; } protected Object visitNode ( Node node ) { if ( fSelection . liesOutside ( node ) ) { return null ; } else if ( fSelection . covers ( node ) ) { if ( isFirstNode ( ) ) { handleFirstSelectedNode ( node ) ; } else { handleNextSelectedNode ( node ) ; } return null ; } else if ( fSelection . coveredBy ( node ) ) { fLastCoveringNode = node ; return null ; } | |
1,186 | <s> package de . fuberlin . wiwiss . d2rq . algebra ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; public class Join { private List < Attribute > attributes1 = new ArrayList < Attribute > ( ) ; private List < Attribute > attributes2 = new ArrayList < Attribute > ( ) ; private RelationName table1 = null ; private RelationName table2 = null ; private Map < Attribute , Attribute > otherSide = new HashMap < Attribute , Attribute > ( 4 ) ; private int joinDirection ; public static final int DIRECTION_UNDIRECTED = 0 ; public static final int DIRECTION_LEFT = 1 ; public static final int DIRECTION_RIGHT = 2 ; public static final String [ ] joinOperators = { "=" , "<=" , "=>" } ; public Join ( Attribute oneSide , Attribute otherSide , int joinDirection ) { this ( Collections . singletonList ( oneSide ) , Collections . singletonList ( otherSide ) , joinDirection ) ; } public Join ( List < Attribute > oneSideAttributes , List < Attribute > otherSideAttributes , int joinDirection ) { RelationName oneRelation = ( ( Attribute ) oneSideAttributes . get ( 0 ) ) . relationName ( ) ; RelationName otherRelation = ( ( Attribute ) otherSideAttributes . get ( 0 ) ) . relationName ( ) ; this . attributes1 = oneSideAttributes ; this . attributes2 = otherSideAttributes ; this . table1 = oneRelation ; this . table2 = otherRelation ; this . joinDirection = joinDirection ; for ( int i = 0 ; i < this . attributes1 . size ( ) ; i ++ ) { Attribute a1 = ( Attribute ) this . attributes1 . get ( i ) ; Attribute a2 = ( Attribute ) this . attributes2 . get ( i ) ; this . otherSide . put ( a1 , a2 ) ; this . otherSide . put ( a2 , a1 ) ; } } public boolean isSameTable ( ) { return this . table1 . equals ( this . table2 ) ; } public boolean containsColumn ( Attribute column ) { return this . attributes1 . contains ( column ) || this . attributes2 . contains ( column ) ; } public RelationName table1 ( ) { return this . table1 ; } public RelationName table2 ( ) { return this . table2 ; } public List < Attribute > attributes1 ( ) { return this . attributes1 ; } public List < Attribute > attributes2 ( ) { return this . attributes2 ; } public int joinDirection ( ) { return this . joinDirection ; } public Attribute equalAttribute ( Attribute column ) { return ( Attribute ) this . otherSide . get ( column ) ; } public String toString ( ) { StringBuffer result = new StringBuffer ( "Join(" ) ; Iterator < Attribute > it = this . attributes1 . iterator ( ) ; while ( it . hasNext ( ) ) | |
1,187 | <s> package com . aptana . rdt . internal . core . parser . warnings ; import java . util . List ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . compiler . CategorizedProblem ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import org . rubypeople . rdt . internal . core . parser . warnings . AbstractRubyLintVisitorTestCase ; import com . aptana . rdt . IProblem ; import com . aptana . rdt . internal . parser . warnings . UncommunicativeName ; public class UncommunicativeNameTest extends AbstractRubyLintVisitorTestCase { @ Override protected RubyLintVisitor createVisitor ( String src ) { return new UncommunicativeName ( src ) { @ Override protected String getSeverity ( ) { return RubyCore . WARNING ; } } ; } public void testOneCharDefnName ( ) { String src = "" + "end" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . UncommunicativeName , problems . get ( 0 ) . getID ( ) ) ; } public void testOneCharWithDigitDefnName ( ) { String src = "" + "end" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . UncommunicativeName , problems . get ( 0 ) . getID ( ) ) ; } public void testOneCharDefsName ( ) { String src = "" + "end" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . UncommunicativeName , problems . get ( 0 ) . getID ( ) ) ; } public void testOneCharWithDigitDefsName ( ) { String src = "" + "end" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . UncommunicativeName , problems . get ( 0 ) . getID ( ) ) ; } public void testOneCharBlockVarName ( ) { String src = "" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . UncommunicativeName , problems . get ( 0 ) . getID ( ) ) ; } public void testOneCharWithDigitBlockVarName ( ) { String src = "" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . UncommunicativeName , problems . get ( 0 ) . getID ( ) ) ; } public void testOneCharInstanceVarName ( ) { String src = "def methodn" + " @i0 = 0n" + "end" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . UncommunicativeName , problems . get ( 0 ) . getID ( ) ) ; } public void testOneCharWithDigitInstanceVarName ( ) { String src = "def methodn" + " @i = 0n" + "end" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . UncommunicativeName , problems . get ( 0 ) . getID ( ) ) ; } public void testOnlyWarnsOnceAboutInstanceVariablesWithShortNames ( ) { String src = "def methodn" + " @i = 0n" + " puts @in" + " @i = 1n" + "end" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . UncommunicativeName , problems . get ( 0 ) . getID ( ) ) ; } public void testOnlyWarnsOnceAboutClassVariablesWithShortNames ( ) { String src = "" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . UncommunicativeName , problems . get ( 0 ) . getID ( ) ) ; } public void testOneCharClassVarName ( ) { String src = "def methodn" + " @@i0 = 0n" + "end" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . UncommunicativeName , problems . get ( 0 ) . getID ( ) ) ; } public void testOneCharWithDigitClassVarName ( ) { String src = "def methodn" + " @@i = 0n" + "end" ; List < CategorizedProblem > problems = getProblems ( src ) ; assertEquals ( 1 , problems . size ( ) ) ; assertEquals ( IProblem . UncommunicativeName , problems . get ( 0 | |
1,188 | <s> package com . pogofish . jadt . ast ; import java . util . Collections ; import java . util . List ; | |
1,189 | <s> package org . rubypeople . rdt . ui . actions ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . action . IAction ; import org . eclipse . jface . dialogs . IDialogConstants ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . IWorkbenchWindow ; import org . eclipse . ui . IWorkbenchWindowActionDelegate ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . search . IRubySearchConstants ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . RubyUIMessages ; import org . rubypeople . rdt . internal . ui . dialogs . OpenTypeSelectionDialog2 ; import org . rubypeople . rdt . internal . ui . rubyeditor . EditorUtility ; import org . rubypeople . rdt . internal . ui . util . ExceptionHandler ; public class OpenTypeAction extends Action implements IWorkbenchWindowActionDelegate { public OpenTypeAction ( ) { super ( ) ; setText ( RubyUIMessages . OpenTypeAction_label ) ; setDescription ( RubyUIMessages . OpenTypeAction_description ) ; setToolTipText ( RubyUIMessages . OpenTypeAction_tooltip ) ; setImageDescriptor ( RubyPluginImages . DESC_TOOL_OPENTYPE ) ; PlatformUI . getWorkbench ( ) . getHelpSystem ( ) . setHelp ( this , IRubyHelpContextIds . OPEN_TYPE_ACTION ) ; } public void run ( ) { Shell parent = RubyPlugin . getActiveWorkbenchShell ( ) ; OpenTypeSelectionDialog2 dialog = new OpenTypeSelectionDialog2 ( parent , false , PlatformUI . getWorkbench ( ) . getProgressService ( ) , null , IRubySearchConstants . TYPE ) ; dialog . setTitle ( RubyUIMessages . OpenTypeAction_dialogTitle ) ; dialog . setMessage ( RubyUIMessages . OpenTypeAction_dialogMessage ) ; int result = dialog . open | |
1,190 | <s> package org . oddjob . scheduling ; import java . util . concurrent . Exchanger ; import java . util . concurrent . ExecutionException ; import java . util . concurrent . ExecutorService ; import java . util . concurrent . Future ; import java . util . concurrent . RejectedExecutionException ; import java . util . concurrent . TimeUnit ; import java . util . concurrent . TimeoutException ; import junit . framework . TestCase ; public class DefaultOddjobServicesTest extends TestCase { class AJob implements Runnable { int ran ; public void run ( ) { ran ++ ; } } public void testRunAndWait ( ) throws InterruptedException , ExecutionException { DefaultExecutors test = new DefaultExecutors ( ) ; ExecutorService poolExecutor = | |
1,191 | <s> package com . asakusafw . compiler . flow . testing . model ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import org . apache . hadoop . io . Writable ; import com . asakusafw . compiler . flow . testing . io . Part1Input ; import com . asakusafw . compiler . flow . testing . io . Part1Output ; import com . asakusafw . runtime . model . DataModel ; import com . asakusafw . runtime . model . DataModelKind ; import com . asakusafw . runtime . model . ModelInputLocation ; import com . asakusafw . runtime . model . ModelOutputLocation ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; @ DataModelKind ( "DMDL" ) @ ModelInputLocation ( Part1Input . class ) @ ModelOutputLocation ( Part1Output . class ) public class Part1 implements DataModel < | |
1,192 | <s> package org . rubypeople . rdt . refactoring . core . extractmethod ; import org . eclipse . ltk . ui . refactoring . UserInputWizardPage ; import org . rubypeople . rdt . refactoring . core . RubyRefactoring ; import org . rubypeople . rdt . refactoring . core . RefactoringContext ; import org . rubypeople . rdt . refactoring . ui . pages . ExtractMethodPage ; public class ExtractMethodRefactoring extends RubyRefactoring { public static final String NAME = Messages . ExtractMethodRefactoring_Name ; public ExtractMethodRefactoring ( RefactoringContext selectionProvider ) { super ( NAME , selectionProvider ) ; ExtractMethodConfig config = new ExtractMethodConfig ( getDocumentProvider ( ) , selectionProvider ) ; ExtractMethodConditionChecker | |
1,193 | <s> package com . lmax . disruptor . support ; import com . lmax . disruptor . AbstractEntry ; import com . lmax . disruptor . EntryFactory ; public final class StubEntry extends AbstractEntry { private int value ; private String testString ; public StubEntry ( int i ) { this . value = i ; } public void copy ( StubEntry entry ) { value = entry . value ; } public int getValue ( ) { return value ; } public void setValue ( int value ) { this . value = value ; } public String getTestString ( ) { return testString ; } public void setTestString ( final String testString ) { this . testString = testString ; } public final static EntryFactory < StubEntry > ENTRY_FACTORY = new EntryFactory < StubEntry > ( ) { public | |
1,194 | <s> package org . rubypeople . rdt . internal . formatter ; public class NeutralMarker extends AbstractBlockMarker { public NeutralMarker ( String aKeyword , int | |
1,195 | <s> package org . rubypeople . rdt . internal . core ; import junit . framework . Test ; import junit . framework . TestSuite ; import org . rubypeople . rdt . internal . core . builder . TS_InternalCoreBuilder ; import org . rubypeople . rdt . internal . core . parser . TS_InternalCoreParser ; import org . rubypeople . rdt . internal . core . search . AllTests ; import org . rubypeople . rdt . internal . core . util . TS_Util ; public class TS_InternalCore { public static Test suite ( ) { TestSuite suite = new TestSuite ( "Core" ) ; suite . addTestSuite ( TC_RubyCore . class ) ; suite . addTestSuite ( TC_RubyProject . class ) ; suite . addTestSuite ( TC_LoadPathEntry . class ) ; suite . addTest ( TS_InternalCoreBuilder . suite ( ) ) ; | |
1,196 | <s> package com . asakusafw . utils . java . internal . model . util ; import java . lang . reflect . GenericArrayType ; import java . lang . reflect . ParameterizedType ; import java . lang . reflect . Type ; import java . lang . reflect . TypeVariable ; import java . lang . reflect . WildcardType ; import java . text . MessageFormat ; public abstract class ReflectionTypeVisitor < R , C , E extends Throwable > { public final R dispatch ( Type type , C context ) throws E { if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } if ( type instanceof Class < ? > ) { return visitClass ( ( | |
1,197 | <s> package net . sf . sveditor . ui . views . diagram ; import org . eclipse . draw2d . AbstractRouter ; public interface IDiagLabelProviderConfig { boolean getIncludePrivateClassFields ( ) ; boolean getIncludePublicClassFields ( ) ; boolean getIncludePrivateTasksFunctions ( ) ; boolean getIncludePublicTasksFunctions ( ) ; boolean getShowFieldTypes ( ) ; void | |
1,198 | <s> package com . asakusafw . yaess . basic ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . HashMap ; import java . util . Iterator ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Set ; import java . util . TreeSet ; import java . util . concurrent . BlockingQueue ; import java . util . concurrent . CancellationException ; import java . util . concurrent . ExecutionException ; import java . util . concurrent . LinkedBlockingQueue ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . yaess . basic . JobExecutor . Executing ; import com . asakusafw . yaess . core . ExecutionContext ; import com . asakusafw . yaess . core . Job ; import com . asakusafw . yaess . core . JobScheduler ; import com . asakusafw . yaess . core . PhaseMonitor ; import com . asakusafw . yaess . core . PhaseMonitor . JobStatus ; import com . asakusafw . yaess . core . YaessLogger ; public abstract class AbstractJobScheduler extends JobScheduler { static final YaessLogger YSLOG = new YaessBasicLogger ( AbstractJobScheduler . class ) ; static final Logger LOG = LoggerFactory . getLogger ( AbstractJobScheduler . class ) ; protected abstract JobExecutor getJobExecutor ( ) ; @ Override public final void execute ( PhaseMonitor monitor , ExecutionContext context , List < ? extends Job > jobs , ErrorHandler errorHandler ) throws InterruptedException , IOException { if ( monitor == null ) { throw new IllegalArgumentException ( "" ) ; } if ( context == null ) { throw new IllegalArgumentException ( "" ) ; } if ( jobs == null ) { throw new IllegalArgumentException ( "" ) ; } if ( errorHandler == null ) { throw new IllegalArgumentException ( "" ) ; } monitor . open ( jobs . size ( ) ) ; try { monitor . checkCancelled ( ) ; Engine engine = new Engine ( getJobExecutor ( ) , monitor , context , errorHandler , jobs ) ; engine . run ( ) ; } finally { monitor . close ( ) ; } } private static final class Engine { private final JobExecutor executor ; final PhaseMonitor monitor ; final ExecutionContext context ; private final ErrorHandler handler ; private final LinkedList < Job > waiting ; private final Map < String , Executing > executing ; private final BlockingQueue < Executing > doneQueue ; private final Set < String > blockers ; private boolean sawError ; Engine ( JobExecutor executor , PhaseMonitor monitor , ExecutionContext context , ErrorHandler handler , List < ? extends Job > waiting ) { assert executor != null ; assert monitor != null ; assert context != null ; assert handler != null ; assert waiting != null ; this . executor = executor ; this . monitor = monitor ; this . context = context ; this . handler = handler ; this . waiting = new LinkedList < Job > ( waiting ) ; this . executing = new HashMap < String , Executing > ( ) ; this . doneQueue = new LinkedBlockingQueue < Executing > ( ) ; this . blockers = new TreeSet < String > ( ) ; for ( Job job : waiting ) { blockers . add ( job . getId ( ) ) ; } this . sawError = false ; } void run ( ) throws IOException , InterruptedException { while ( waiting . isEmpty ( ) == false ) { boolean submitted = submitAllWaiting ( ) ; if ( submitted == false && executing . isEmpty ( ) ) { assert waiting . isEmpty ( ) == false ; if ( sawError ) { waiting . clear ( ) ; } else { throw new IOException ( MessageFormat . format ( "" , context . getBatchId ( ) , context . getFlowId ( ) , context . getPhase ( ) , context . getExecutionId ( ) , blockers ) ) ; } } else { waitForDone ( ) ; } } while ( executing . isEmpty ( ) == false ) { waitForDone ( ) ; } if ( sawError ) { throw new IOException ( MessageFormat . format ( "" , context . getBatchId ( ) , context . getFlowId ( ) , context . getPhase ( ) , context . getExecutionId ( ) ) ) ; } } private boolean submitAllWaiting ( ) throws IOException , InterruptedException { boolean sawSubmit = false ; for ( Iterator < Job > iter = waiting . iterator ( ) ; iter . hasNext ( ) ; ) { Job next = iter . next ( ) ; LOG . debug ( "" , next . getId ( ) ) ; if ( isBlocked ( next ) ) { LOG . debug ( "" , next . getId ( ) ) ; continue ; } iter . remove ( ) ; if ( submit ( next ) ) { sawSubmit = true ; } } return sawSubmit ; } private void waitForDone ( ) throws InterruptedException , IOException { | |
1,199 | <s> package org . rubypeople . rdt . refactoring . editprovider ; import java . util . Collection ; import java . util . HashMap ; import |
Subsets and Splits