id
int32 0
3k
| input
stringlengths 43
33.8k
| gt
stringclasses 1
value |
---|---|---|
700 | <s> package org . oddjob . jmx . client ; import javax . management . ObjectName ; import org . apache . log4j . Logger ; import org . oddjob . framework . Transportable ; import org . oddjob . jmx . ObjectNames ; public class ComponentTransportable implements Transportable { private static final long serialVersionUID = 20051116 ; private static final Logger logger = Logger . getLogger ( ComponentTransportable . class ) ; private | |
701 | <s> package org . rubypeople . rdt . ui . actions ; public class RdtActionConstants { public static final String OPEN = "" ; public static final String OPEN_TYPE_HIERARCHY = "" ; public static final String OPEN_CALL_HIERARCHY = "" ; public static final String SHOW_RUBY_DOC = "" ; public static final String FIND_REFERENCES_IN_WORKSPACE = "" ; public static final String FIND_REFERENCES_IN_PROJECT = "" ; public static final String FIND_REFERENCES_IN_HIERARCHY = "" ; public static final String FIND_REFERENCES_IN_WORKING_SET = "" ; public static final String FIND_READ_ACCESS_IN_WORKSPACE = "" ; public static final String FIND_READ_ACCESS_IN_PROJECT = "" ; public static final String FIND_READ_ACCESS_IN_WORKING_SET = "" ; public static final String FIND_OCCURRENCES_IN_FILE = | |
702 | <s> package org . oddjob . oddballs ; import java . io . File ; import java . io . IOException ; import java . net . URL ; import java . util . Arrays ; import java . util . HashSet ; import org . oddjob . OurDirs ; import junit . framework . TestCase ; public class DirectoryOddball2Test extends TestCase { public void testURLs ( ) throws IOException { DirectoryOddball test = new DirectoryOddball ( ) ; OurDirs dirs = new OurDirs ( ) ; URL [ ] urls = test . classpathURLs ( dirs . base ( ) ) ; HashSet < | |
703 | <s> package com . asakusafw . vocabulary . operator ; import java . lang . annotation . Documented ; import java . lang . annotation . ElementType ; import java . lang . annotation . Retention ; import java . lang . annotation . RetentionPolicy ; | |
704 | <s> package org . rubypeople . rdt . internal . ui . typehierarchy ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . ITypeHierarchy ; public class HierarchyViewerSorter extends AbstractHierarchyViewerSorter { private final TypeHierarchyLifeCycle fHierarchy ; private boolean fSortByDefiningType ; public HierarchyViewerSorter ( TypeHierarchyLifeCycle cycle ) { fHierarchy = cycle ; } public void setSortByDefiningType ( boolean sortByDefiningType ) { fSortByDefiningType = sortByDefiningType ; } | |
705 | <s> package net . sf . sveditor . core . tests . constraint_parser ; import java . util . List ; import junit . framework . TestCase ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . ISVDBScopeItem ; import net . sf . sveditor . core . db . SVDBConstraint ; import net . sf . sveditor . core . db . SVDBItemType ; public class SmokeTest extends TestCase { public static void find_constraints ( ISVDBScopeItem | |
706 | <s> package de . fuberlin . wiwiss . d2rq . map ; import java . util . ArrayList ; import java . util . Collection ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import com . hp . hpl . jena . rdf . model . Property ; import com . hp . hpl . jena . rdf . model . Resource ; import com . hp . hpl . jena . vocabulary . RDF ; import de . fuberlin . wiwiss . d2rq . D2RQException ; import de . fuberlin . wiwiss . d2rq . algebra . Relation ; import de . fuberlin . wiwiss . d2rq . algebra . TripleRelation ; import de . fuberlin . wiwiss . d2rq . pp . PrettyPrinter ; import de . fuberlin . wiwiss . d2rq . values . Pattern ; import de . fuberlin . wiwiss . d2rq . vocab . D2RQ ; public class ClassMap extends ResourceMap { private Resource resource ; private Database database = null ; private Collection < Resource > classes = new ArrayList < Resource > ( ) ; private Collection < PropertyBridge > propertyBridges = new ArrayList < PropertyBridge > ( ) ; private Collection < TripleRelation > compiledPropertyBridges = null ; private Log log = LogFactory . getLog ( ClassMap . class ) ; public ClassMap ( Resource classMapResource ) { super ( classMapResource , false ) ; this . resource = classMapResource ; } public Resource resource ( ) { return this . resource ; } public Collection < Resource > getClasses ( ) { return classes ; } public void setDatabase ( Database database ) { assertNotYetDefined ( this . database , D2RQ . dataStorage , D2RQException . CLASSMAP_DUPLICATE_DATABASE ) ; assertArgumentNotNull ( database , D2RQ . dataStorage , D2RQException . CLASSMAP_INVALID_DATABASE ) ; this . database = database ; } public Database database ( ) { return this . database ; } public void addClass ( Resource class_ ) { this . classes . add ( class_ ) ; } public void addPropertyBridge ( PropertyBridge bridge ) { this . propertyBridges . add ( bridge ) ; } public Collection < PropertyBridge > propertyBridges ( ) { return this . propertyBridges ; } public void validate ( ) throws D2RQException { assertHasBeenDefined ( this . database , D2RQ . dataStorage , D2RQException . CLASSMAP_NO_DATABASE ) ; assertHasPrimarySpec ( new Property [ ] { D2RQ . uriColumn , D2RQ . uriPattern , D2RQ . uriSqlExpression , D2RQ . bNodeIdColumns , D2RQ . constantValue } ) ; if ( this . constantValue != null && this . constantValue . isLiteral ( ) ) { throw new D2RQException ( "" + toString ( ) + "" , D2RQException . CLASSMAP_INVALID_CONSTANTVALUE ) ; } if ( this . uriPattern != null && new Pattern ( uriPattern ) . attributes ( ) . size ( ) == 0 ) { this . log . warn ( toString ( ) + "" + "" ) ; } for ( PropertyBridge bridge : propertyBridges ) { bridge . validate ( ) ; } } public boolean hasProperties ( ) { return ( ! this . classes . isEmpty ( ) || | |
707 | <s> package bonsai . app ; import android . app . Activity ; import android . content . Intent ; import android . net . Uri ; import android . os . Bundle ; import android . view . View ; import android . widget . Toast ; import android . view . View . OnClickListener ; import android . widget . Button ; public class MoreActivity extends Activity { @ Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . more ) ; final Button btn = ( Button ) findViewById ( R . id . contactbutton ) ; btn . setOnClickListener ( new OnClickListener ( ) { public void onClick ( View arg0 ) { Intent intent = | |
708 | <s> package org . rubypeople . rdt . internal . cheatsheets ; import org . eclipse . ui . plugin . AbstractUIPlugin ; import org . osgi . framework . BundleContext ; public class RdtPlugin extends AbstractUIPlugin { public static final String PLUGIN_ID = "" ; protected static RdtPlugin plugin ; public RdtPlugin ( ) { plugin = this ; } public static RdtPlugin getDefault ( ) { return plugin ; } public void start ( BundleContext context ) throws Exception { super . start ( context ) ; } | |
709 | <s> package com . asakusafw . utils . java . internal . parser . javadoc . ir ; import java . util . ArrayList ; import java . util . LinkedList ; import java . util . List ; public class IrDocQualifiedName extends IrDocName { private static final long serialVersionUID = 1L ; private IrDocName qualifier ; private IrDocSimpleName name ; public IrDocQualifiedName ( IrDocName qualifier , IrDocSimpleName name ) { super ( ) ; if ( qualifier == null ) { throw new IllegalArgumentException ( "qualifier" ) ; } if ( name == null ) { throw new IllegalArgumentException ( "name" ) ; } this . qualifier = qualifier ; this . name = name ; } @ Override public IrDocElementKind getKind ( ) { return IrDocElementKind . QUALIFIED_NAME ; } public IrDocName getQualifier ( ) { return this . qualifier ; } public void setQualifier ( IrDocName qualifier ) { if ( qualifier == null ) { throw new IllegalArgumentException ( "qualifier" ) ; } checkCyclic ( qualifier ) ; this . qualifier = qualifier ; } private void checkCyclic ( IrDocName target ) { IrDocName current = target ; while ( current . getKind ( ) == IrDocElementKind . QUALIFIED_NAME ) { if ( current == this ) { throw new IllegalArgumentException ( target . toString ( ) ) ; } | |
710 | <s> package net . sf . sveditor . core . parser ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . db . SVDBLocation ; import net . sf . sveditor . core . db . SVDBScopeItem ; import net . sf . sveditor . core . db . expr . SVDBIdentifierExpr ; import net . sf . sveditor . core . log . ILogHandle ; import net . sf . sveditor . core . log . ILogLevelListener ; public class SVParserBase implements ISVParser , ILogLevelListener { protected boolean fDebugEn = false ; protected ISVParser fParser ; protected SVLexer fLexer ; protected SVParsers fParsers ; protected SVParserBase ( ISVParser parser ) { fParser = parser ; fLexer = parser | |
711 | <s> package org . oddjob . jmx . server ; import org . oddjob . arooa . registry . Address ; import org . oddjob . arooa . registry . BeanDirectory ; import org . oddjob . arooa . registry . ServerId ; import org . oddjob . logging . ConsoleArchiver ; import org . oddjob . logging . LogArchiver ; public class MockServerContext implements ServerContext { public ServerContext addChild ( Object child ) throws ServerLoopBackException { throw new RuntimeException ( "" + getClass ( ) ) ; } | |
712 | <s> package com . asakusafw . thundergate . runtime . cache . mapreduce ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . Externalizable ; import java . io . IOException ; import java . io . ObjectInput ; import java . io . ObjectOutput ; import org . apache . hadoop . io . VIntWritable ; import org . apache . hadoop . io . VLongWritable ; import org . apache . hadoop . io . Writable ; import org . apache . hadoop . io . WritableComparable ; import org . apache . hadoop . io . WritableComparator ; import org . apache . hadoop . io . WritableFactories ; import org . apache . hadoop . io . WritableFactory ; import org . apache . hadoop . io . WritableUtils ; import com . asakusafw . thundergate . runtime . cache . ThunderGateCacheSupport ; public class PatchApplyKey implements WritableComparable < PatchApplyKey > { static final int POSITION_PATCH = 0 ; static final int POSITION_BASE = 1 ; final VLongWritable systemId = new VLongWritable ( ) ; final VIntWritable position = new VIntWritable ( ) ; public void setPatch ( ThunderGateCacheSupport model ) { systemId . set ( model . __tgc__SystemId ( ) ) ; position . set ( POSITION_PATCH ) ; } public void setBase ( ThunderGateCacheSupport model ) { systemId . set ( model . __tgc__SystemId ( ) ) ; position . set ( POSITION_BASE ) ; } @ Override public void write ( DataOutput out ) throws IOException { systemId . write ( out ) ; position . write ( out ) ; } @ Override public void readFields ( DataInput in ) throws IOException { systemId . readFields ( in ) ; position . readFields ( in ) ; } @ Override public int compareTo ( PatchApplyKey other ) { int diffSystemId = systemId . compareTo ( other . systemId ) ; if ( diffSystemId != 0 ) { return diffSystemId ; } int diffPosition = position . compareTo ( other . position ) ; if ( diffPosition != 0 ) { return diffPosition ; } return 0 ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + position . hashCode ( ) ; result = prime * result + systemId . 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 ; } PatchApplyKey other = ( PatchApplyKey ) obj ; if ( ! position . equals ( other . position ) ) { return false ; } if ( ! systemId . equals ( other . systemId ) ) { return false ; } return true ; } @ Override public String toString ( ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( "" ) ; builder . append ( systemId ) ; builder . append ( ", position=" ) ; builder . append ( position ) ; builder . append ( "]" ) ; return builder . toString ( ) ; } public static final class SortComparator extends WritableComparator implements Externalizable { public SortComparator ( ) { super ( PatchApplyKey . class ) ; } @ Override public int compare ( byte [ ] b1 , int s1 , int l1 , byte [ ] b2 , int s2 , int l2 ) { try { long id1 = readVLong ( b1 , s1 ) ; long id2 = readVLong ( b2 , s2 ) ; if ( id1 < id2 ) { return - 1 ; } else if ( id1 > id2 ) { return + 1 ; } int offset1 = WritableUtils . decodeVIntSize ( b1 [ s1 ] ) ; int offset2 = WritableUtils . decodeVIntSize ( b2 [ s2 ] ) ; long pos1 = readVLong ( b1 , s1 + offset1 ) ; long pos2 = readVLong ( b2 , s2 + offset2 ) ; if ( pos1 < pos2 ) { return - 1 ; } else if ( pos1 > pos2 ) { return + 1 ; } return 0 ; } catch ( IOException e ) { throw new IllegalStateException ( e ) ; } } @ Override public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { return ; } @ Override public void writeExternal ( ObjectOutput out ) throws IOException { return ; } private Object readResolve ( ) { return new SortComparator ( ) ; } } @ SuppressWarnings ( "rawtypes" ) public static final class GroupComparator extends WritableComparator implements Externalizable { public GroupComparator ( ) { super ( PatchApplyKey . class ) ; } @ Override public int compare ( WritableComparable a , WritableComparable b ) { PatchApplyKey w1 = ( PatchApplyKey ) a ; PatchApplyKey w2 = ( PatchApplyKey ) b ; return w1 . systemId . compareTo ( w2 . systemId | |
713 | <s> package com . asakusafw . testdriver . directio ; import java . lang . annotation . Annotation ; import java . util . Collection ; import java . util . Collections ; import org . apache . hadoop . io . Text ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . DataModelReflection ; import com . asakusafw . testdriver . core . PropertyName ; import com . asakusafw . testdriver . core . PropertyType ; public class MockTextDefinition implements DataModelDefinition < Text > { static final PropertyName VALUE = PropertyName . newInstance ( "value" ) ; @ Override public Class < Text > getModelClass ( ) { return Text . class ; } @ Override public < A extends Annotation > A getAnnotation ( Class < A > annotationType ) { return null ; } @ Override public Collection < PropertyName > getProperties ( ) { return Collections . singleton ( VALUE ) ; } @ Override public PropertyType getType ( PropertyName name ) { if ( VALUE . equals ( name ) ) { return PropertyType . STRING ; } return null ; } @ Override public < A extends Annotation > A getAnnotation ( PropertyName name , Class < A > annotationType ) { return null ; } @ Override public Builder < Text | |
714 | <s> package org . oddjob . scheduling ; import java . util . Date ; import org . oddjob . Resetable ; import org . oddjob . arooa . deploy . annotations . ArooaAttribute ; import org . oddjob . arooa . life . ComponentPersistException ; import org . oddjob . schedules . Interval ; import org . oddjob . state . CompleteOrNotOp ; import org . oddjob . state . State ; import org . oddjob . state . StateOperator ; public class Retry extends TimerBase { private static final long serialVersionUID = 2009091400L ; private Interval limits ; @ Override protected StateOperator getStateOp ( ) { return new CompleteOrNotOp ( ) ; } @ Override protected void begin ( ) throws ComponentPersistException { super . begin ( ) ; contextData . clear ( ) ; Date use = getClock ( ) . getDate ( ) ; if ( getLimits ( ) != null && use . compareTo ( getLimits ( ) . getToDate ( ) ) >= 0 ) { use = getLimits ( ) . getFromDate | |
715 | <s> package org . rubypeople . rdt . refactoring . tests . core . renamemethod . conditioncheck ; import junit . framework . Test ; import org . rubypeople . rdt . refactoring . tests . FileTestSuite ; public class TS_RenameMethodChecks extends FileTestSuite { public static | |
716 | <s> package org . rubypeople . rdt . internal . ui . text . template . contentassist ; import org . eclipse . core . runtime . Assert ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Status ; import org . eclipse . jface . dialogs . MessageDialog ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . BadPositionCategoryException ; import org . eclipse . jface . text . DocumentEvent ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IInformationControlCreator ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . jface . text . Position ; import org . eclipse . jface . text . Region ; import org . eclipse . jface . text . contentassist . ICompletionProposal ; import org . eclipse . jface . text . contentassist . ICompletionProposalExtension2 ; import org . eclipse . jface . text . contentassist . ICompletionProposalExtension3 ; import org . eclipse . jface . text . contentassist . ICompletionProposalExtension4 ; import org . eclipse . jface . text . contentassist . IContextInformation ; import org . eclipse . jface . text . link . ILinkedModeListener ; import org . eclipse . jface . text . link . InclusivePositionUpdater ; import org . eclipse . jface . text . link . LinkedModeModel ; import org . eclipse . jface . text . link . LinkedModeUI ; import org . eclipse . jface . text . link . LinkedPosition ; import org . eclipse . jface . text . link . LinkedPositionGroup ; import org . eclipse . jface . text . link . ProposalPosition ; import org . eclipse . jface . text . templates . DocumentTemplateContext ; import org . eclipse . jface . text . templates . GlobalTemplateVariables ; import org . eclipse . jface . text . templates . Template ; import org . eclipse . jface . text . templates . TemplateBuffer ; import org . eclipse . jface . text . templates . TemplateContext ; import org . eclipse . jface . text . templates . TemplateException ; import org . eclipse . jface . text . templates . TemplateVariable ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . graphics . Point ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . texteditor . link . EditorLinkedModeUI ; import org . rubypeople . rdt . internal . corext . template . ruby . RubyScriptContext ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . rubyeditor . EditorHighlightingSynchronizer ; import org . rubypeople . rdt . internal . ui . rubyeditor . RubyEditor ; import org . rubypeople . rdt . internal . ui . util . ExceptionHandler ; import org . rubypeople . rdt . ui . text . ruby . IRubyCompletionProposal ; public class TemplateProposal implements IRubyCompletionProposal , ICompletionProposalExtension2 , ICompletionProposalExtension3 , ICompletionProposalExtension4 { private final Template fTemplate ; private final TemplateContext fContext ; private final Image fImage ; private IRegion fRegion ; private int fRelevance ; private IRegion fSelectedRegion ; private String fDisplayString ; public TemplateProposal ( Template template , TemplateContext context , IRegion region , Image image ) { Assert . isNotNull ( template ) ; Assert . isNotNull ( context ) ; Assert . isNotNull ( region ) ; fTemplate = template ; fContext = context ; fImage = image ; fRegion = region ; fDisplayString = null ; fRelevance = computeRelevance ( ) ; } private int computeRelevance ( ) { final int R_DEFAULT = 0 ; final int R_INTERESTING = 5 ; final int R_CASE = 10 ; final int R_NON_RESTRICTED = 3 ; final int R_EXACT_NAME = 4 ; final int R_INLINE_TAG = 31 ; int base = R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED ; try { if ( fContext instanceof DocumentTemplateContext ) { DocumentTemplateContext templateContext = ( DocumentTemplateContext ) fContext ; IDocument document = templateContext . getDocument ( ) ; String content = document . get ( fRegion . getOffset ( ) , fRegion . getLength ( ) ) ; if ( fTemplate . getName ( ) . startsWith ( content ) ) base += R_CASE ; if ( fTemplate . getName ( ) . equalsIgnoreCase ( | |
717 | <s> package org . vaadin . teemu . clara ; import static org . junit . Assert . assertEquals ; import static org . junit . Assert . assertTrue ; import org . junit . Before ; import org . junit . Test ; import org . vaadin . teemu . clara . inflater . PrimitiveAttributeParser ; public class PrimitiveAttributeParserTest { private PrimitiveAttributeParser handler ; @ Before public void setUp ( ) { handler = new PrimitiveAttributeParser ( ) ; } @ Test public void testBoolean ( ) throws Exception { assertTrue ( handler . isSupported ( Boolean . TYPE ) ) ; assertTrue ( handler . isSupported ( Boolean . class ) ) ; assertEquals ( true , handler . getValueAs ( "true" , Boolean . TYPE ) ) ; assertEquals ( false , handler . getValueAs ( "false" , Boolean . TYPE ) ) ; assertEquals ( true , handler . getValueAs ( "true" , Boolean . class ) ) ; assertEquals ( false , handler . getValueAs ( "false" , Boolean . class ) ) ; } @ Test public void testInteger ( ) throws Exception { assertTrue ( handler . isSupported ( Integer . TYPE ) ) ; assertTrue ( handler . isSupported ( Integer . class ) ) ; assertEquals ( 10 , handler . getValueAs ( "10" , Integer . TYPE ) ) ; assertEquals ( - 10 , handler . getValueAs ( "-10" , Integer . TYPE ) ) ; assertEquals ( 20 , handler . getValueAs ( "20" , Integer . class ) ) ; assertEquals ( - 20 , handler . getValueAs ( "-20" , Integer . class ) ) ; } @ Test public void testByte ( ) throws Exception { assertTrue ( handler . isSupported ( Byte . TYPE ) ) ; assertTrue ( handler . isSupported ( Byte . class ) ) ; assertEquals ( ( byte ) 10 , handler . getValueAs ( "10" , Byte . TYPE ) ) ; assertEquals ( ( byte ) - 10 , handler . getValueAs ( "-10" , Byte . TYPE ) ) ; assertEquals | |
718 | <s> package org . oddjob . jmx . server ; import org . oddjob . Structural ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . registry . BeanDirectory ; import org . oddjob . arooa . registry . BeanDirectoryOwner ; import org . oddjob . structural . ChildHelper ; import org . oddjob . structural . StructuralListener ; public class ServerMainBean implements BeanDirectoryOwner , Structural { private final ChildHelper < Object > childHelper = new ChildHelper < Object > ( this ) ; private final BeanDirectory beanDirectory ; public ServerMainBean ( Object root , BeanDirectory beanDirectory ) { this . childHelper . insertChild ( 0 , root ) ; this . beanDirectory = beanDirectory ; } public BeanDirectory provideBeanDirectory ( ) { return new BeanDirectory ( ) { public Object lookup ( String path ) throws ArooaPropertyException { return beanDirectory . lookup ( path ) ; } public < T > T lookup ( String path , Class < T > required ) throws ArooaPropertyException , ArooaConversionException { return beanDirectory . lookup ( path , required ) ; } public < T > Iterable < T > getAllByType | |
719 | <s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Set ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jface . viewers . CheckStateChangedEvent ; import org . eclipse . jface . viewers . CheckboxTreeViewer ; import org . eclipse . jface . viewers . ICheckStateListener ; import org . eclipse . jface . viewers . ILabelProvider ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . SelectionChangedEvent ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . jface . viewers . ViewerFilter ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . SWT ; import org . eclipse . swt . custom . BusyIndicator ; import org . eclipse . swt . events . SelectionAdapter ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . swt . widgets . Tree ; import org . eclipse . ui . dialogs . NewFolderDialog ; import org . eclipse . ui . dialogs . SelectionStatusDialog ; import org . eclipse . ui . views . navigator . ResourceSorter ; import org . rubypeople . rdt . internal . ui . dialogs . StatusInfo ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; public class MultipleFolderSelectionDialog extends SelectionStatusDialog implements ISelectionChangedListener { private CheckboxTreeViewer fViewer ; private ILabelProvider fLabelProvider ; private ITreeContentProvider fContentProvider ; private List fFilters ; private Object fInput ; private Button fNewFolderButton ; private IContainer fSelectedContainer ; private Set fExisting ; private Object fFocusElement ; public MultipleFolderSelectionDialog ( Shell parent , ILabelProvider labelProvider , ITreeContentProvider contentProvider ) { super ( parent ) ; fLabelProvider = labelProvider ; fContentProvider = contentProvider ; setSelectionResult ( null ) ; setStatusLineAboveButtons ( true ) ; int shellStyle = getShellStyle ( ) ; setShellStyle ( shellStyle | SWT . MAX | SWT . RESIZE ) ; fExisting = null ; fFocusElement = null ; fFilters = null ; } public void setExisting ( Object [ ] existing ) { fExisting = new HashSet ( ) ; for ( int i = 0 ; i < existing . length ; i ++ ) { fExisting . add ( existing [ i ] ) ; } } public void setInput ( Object input ) { fInput = input ; } public void addFilter ( ViewerFilter filter ) { if ( fFilters == null ) fFilters = new ArrayList ( 4 ) ; fFilters . add ( filter ) ; } protected void cancelPressed ( ) { setSelectionResult ( null ) ; super . cancelPressed ( ) ; } protected void computeResult ( ) { Object [ ] checked = fViewer . getCheckedElements ( ) ; if ( fExisting == null ) { if ( checked . length == 0 ) { checked = null ; } } else { ArrayList res = new ArrayList ( ) ; for ( int i = 0 ; i < checked . length ; i ++ ) { Object elem = checked [ i ] ; if ( ! fExisting . contains ( elem ) ) { res . add ( elem ) ; } } if ( ! res . isEmpty ( ) ) { checked = res . toArray ( ) ; } else { checked = null ; } } setSelectionResult ( checked ) ; } private void access$superCreate ( ) { super . create ( ) ; } public void create ( ) { BusyIndicator . showWhile ( null , new Runnable ( ) { public void run ( ) { access$superCreate ( ) ; fViewer . setCheckedElements ( getInitialElementSelections ( ) . toArray ( | |
720 | <s> package org . oddjob . jmx . client ; import javax . management . ObjectName ; import org . apache . log4j . Logger ; import org . oddjob . arooa . ArooaSession ; public class MockClientSession implements ClientSession { @ Override public Object create ( ObjectName objectName ) { throw new RuntimeException ( "" + getClass ( ) ) ; } @ Override public void destroy ( Object proxy ) { throw new RuntimeException ( "" + getClass ( ) ) ; } @ Override public ArooaSession getArooaSession ( ) { throw new RuntimeException ( "" + getClass ( ) ) ; } @ Override public ObjectName nameFor ( Object object ) { throw new RuntimeException ( "" + getClass ( ) ) ; } @ Override public Object objectFor ( ObjectName objectName ) { throw new RuntimeException ( "" + getClass ( ) ) ; } @ Override | |
721 | <s> package com . asakusafw . runtime . directio ; import static com . asakusafw . runtime . directio . FilePattern . PatternElementKind . * ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . util . Arrays ; import java . util . List ; import org . hamcrest . BaseMatcher ; import org . hamcrest . Description ; import org . hamcrest . Matcher ; import org . junit . Test ; import com . asakusafw . runtime . directio . FilePattern . PatternElement ; import com . asakusafw . runtime . directio . FilePattern . PatternElementKind ; import com . asakusafw . runtime . directio . FilePattern . Segment ; public class FilePatternTest { @ Test public void traverse ( ) { FilePattern compiled = FilePattern . compile ( "**" ) ; List < Segment > segments = compiled . getSegments ( ) ; assertThat ( segments . size ( ) , is ( 1 ) ) ; assertThat ( segments . get ( 0 ) . isTraverse ( ) , is ( true ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( kind ( ) ) ) ; } @ Test public void token ( ) { FilePattern compiled = FilePattern . compile ( "a" ) ; assertThat ( compiled . containsVariables ( ) , is ( false ) ) ; List < Segment > segments = compiled . getSegments ( ) ; assertThat ( segments . size ( ) , is ( 1 ) ) ; assertThat ( segments . get ( 0 ) . isTraverse ( ) , is ( false ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( kind ( TOKEN ) ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( token ( "a" ) ) ) ; } @ Test public void wildcard ( ) { FilePattern compiled = FilePattern . compile ( "*" ) ; assertThat ( compiled . containsVariables ( ) , is ( false ) ) ; List < Segment > segments = compiled . getSegments ( ) ; assertThat ( segments . size ( ) , is ( 1 ) ) ; assertThat ( segments . get ( 0 ) . isTraverse ( ) , is ( false ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( kind ( WILDCARD ) ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( token ( "*" ) ) ) ; } @ Test public void variable ( ) { FilePattern compiled = FilePattern . compile ( "${v}" ) ; assertThat ( compiled . containsVariables ( ) , is ( true ) ) ; List < Segment > segments = compiled . getSegments ( ) ; assertThat ( segments . size ( ) , is ( 1 ) ) ; assertThat ( segments . get ( 0 ) . isTraverse ( ) , is ( false ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( kind ( VARIABLE ) ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( token ( "${v}" ) ) ) ; } @ Test public void variable_empty ( ) { FilePattern compiled = FilePattern . compile ( "${}" ) ; List < Segment > segments = compiled . getSegments ( ) ; assertThat ( segments . size ( ) , is ( 1 ) ) ; assertThat ( segments . get ( 0 ) . isTraverse ( ) , is ( false ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( kind ( VARIABLE ) ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( token ( "${}" ) ) ) ; } @ Test public void selection ( ) { FilePattern compiled = FilePattern . compile ( "" ) ; assertThat ( compiled . containsVariables ( ) , is ( false ) ) ; List < Segment > segments = compiled . getSegments ( ) ; assertThat ( segments . size ( ) , is ( 1 ) ) ; assertThat ( segments . get ( 0 ) . isTraverse ( ) , is ( false ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( kind ( SELECTION ) ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( token ( "" ) ) ) ; } @ Test public void containsWildcard ( ) { FilePattern compiled = FilePattern . compile ( "data-*.csv" ) ; List < Segment > segments = compiled . getSegments ( ) ; assertThat ( segments . size ( ) , is ( 1 ) ) ; assertThat ( segments . get ( 0 ) . isTraverse ( ) , is ( false ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( kind ( TOKEN , WILDCARD , TOKEN ) ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( token ( "data-" , "*" , ".csv" ) ) ) ; } @ Test public void selection_containsEmpty ( ) { FilePattern compiled = FilePattern . compile ( "" ) ; assertThat ( compiled . containsVariables ( ) , is ( false ) ) ; List < Segment > segments = compiled . getSegments ( ) ; assertThat ( segments . size ( ) , is ( 1 ) ) ; assertThat ( segments . get ( 0 ) . isTraverse ( ) , is ( false ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( kind ( SELECTION ) ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( token ( "" ) ) ) ; } @ Test public void selection_empty ( ) { FilePattern compiled = FilePattern . compile ( "{}" ) ; assertThat ( compiled . containsVariables ( ) , is ( false ) ) ; List < Segment > segments = compiled . getSegments ( ) ; assertThat ( segments . size ( ) , is ( 1 ) ) ; assertThat ( segments . get ( 0 ) . isTraverse ( ) , is ( false ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( kind ( SELECTION ) ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( token ( "{}" ) ) ) ; } @ Test public void segments ( ) { FilePattern compiled = FilePattern . compile ( "" ) ; List < Segment > segments = compiled . getSegments ( ) ; assertThat ( segments . size ( ) , is ( 3 ) ) ; assertThat ( segments . get ( 0 ) . isTraverse ( ) , is ( false ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( kind ( TOKEN ) ) ) ; assertThat ( segments . get ( 0 ) . getElements ( ) , is ( | |
722 | <s> package fi . koku . services . entity . kks . 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 KksServiceFactory { private static Logger log = LoggerFactory . getLogger ( KksServiceFactory . class ) ; public static String SERVICE_AREA_DAYCARE = "" ; public static String SERVICE_AREA_BASIC_EDUCATION = "" ; public static String SERVICE_AREA_CHILD_HEALTH = "" ; private String uid ; private String pwd ; private String | |
723 | <s> package org . rubypeople . rdt . refactoring . core . inlineclass ; import java . util . ArrayList ; import java . util . Collection ; import org . jruby . ast . AssignableNode ; import org . jruby . ast . Node ; import org . jruby . lexer . yacc . ISourcePosition ; import org . rubypeople . rdt . refactoring . classnodeprovider . ClassNodeProvider ; import org . rubypeople . rdt . refactoring . core . IRefactoringConfig ; import org . rubypeople . rdt . refactoring . core . RefactoringConditionChecker ; import org . rubypeople . rdt . refactoring . core . SelectionNodeProvider ; import org . rubypeople . rdt . refactoring . documentprovider . IDocumentProvider ; import org . rubypeople . rdt . refactoring . exception . NoClassNodeException ; import org . rubypeople . rdt . refactoring . nodewrapper . ClassNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . MethodNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . PartialClassNodeWrapper ; import org . rubypeople . rdt . refactoring . util . Constants ; public class InlineClassConditionChecker extends RefactoringConditionChecker { private InlineClassConfig config ; private IDocumentProvider docProvider ; private ClassNodeWrapper selectedClass ; public InlineClassConditionChecker ( InlineClassConfig config ) { super ( config ) ; } public void init ( IRefactoringConfig configObj ) { this . config = ( InlineClassConfig ) configObj ; docProvider = config . getDocumentProvider ( ) ; intiSourceClass ( ) ; initPossibleTargetClasses ( ) ; } private void intiSourceClass ( ) { int caretPosition = config . getCaretPosition ( ) ; Node rootNode = docProvider . getActiveFileRootNode ( ) ; try { selectedClass = SelectionNodeProvider . getSelectedClassNode ( rootNode , caretPosition ) ; config . setSourceClass ( selectedClass ) ; } catch ( NoClassNodeException e ) { } } @ Override protected void checkFinalConditions ( ) { if ( equalClassPartPosition ( selectedClass . getFirstPartialClassNode ( ) , config . getTargetClassPart ( ) ) ) { | |
724 | <s> package com . asakusafw . compiler . flow . join . operator ; import java . lang . annotation . Documented ; import java . lang . annotation . Retention ; import java . lang . annotation . RetentionPolicy ; | |
725 | <s> package com . asakusafw . runtime . flow ; import | |
726 | <s> package com . asakusafw . vocabulary . windgate ; import java . sql . PreparedStatement ; import java . sql . ResultSet ; import java . util . List ; import com . asakusafw . windgate . core . vocabulary . DataModelJdbcSupport ; public abstract class MockJdbcSupport < T > implements DataModelJdbcSupport < T > { @ Override public boolean isSupported ( List < String > columnNames ) { return true ; } @ Override public DataModelResultSet < T > createResultSetSupport ( ResultSet | |
727 | <s> package com . sun . tools . hat . internal . parser ; import java . io . IOException ; import java . io . RandomAccessFile ; import java . nio . MappedByteBuffer ; import java . nio . channels . FileChannel ; class MappedReadBuffer implements ReadBuffer { private final MappedByteBuffer buf ; MappedReadBuffer ( MappedByteBuffer buf ) { this . buf = buf ; } static ReadBuffer create ( RandomAccessFile file ) throws IOException { FileChannel ch = file . getChannel ( ) ; long size = ch . size ( ) ; if ( canUseFileMap ( ) && ( size <= Integer . MAX_VALUE ) ) { MappedByteBuffer buf ; try { buf = ch . map ( FileChannel . | |
728 | <s> package net . sf . sveditor . core . db . search ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db . ISVDBChildItem ; import net . sf . sveditor . core . db . ISVDBChildParent ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . ISVDBNamedItem ; import net . sf . sveditor . core . db . SVDBClassDecl ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBModIfcDecl ; import net . sf . sveditor . core . db . SVDBTask ; import net . sf . sveditor . core . db . index . ISVDBIndexIterator ; import net . sf . sveditor . core . db . stmt . SVDBParamPortDecl ; import net . sf . sveditor . core . db . stmt . SVDBStmt ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclItem ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclStmt ; public class SVDBFindVarsByNameInScopes { private ISVDBIndexIterator fIndexIterator ; private ISVDBFindNameMatcher fMatcher ; private SVDBFindDefaultNameMatcher fDefaultMatcher ; public SVDBFindVarsByNameInScopes ( ISVDBIndexIterator index_it , ISVDBFindNameMatcher matcher ) { fIndexIterator = index_it ; fMatcher = matcher ; fDefaultMatcher = new SVDBFindDefaultNameMatcher ( ) ; } public List < ISVDBItemBase > find ( ISVDBChildItem context , String name , boolean stop_on_first_match ) { List < ISVDBItemBase > ret = new ArrayList < ISVDBItemBase > ( ) ; ISVDBChildItem context_save = context ; while ( context != null && context instanceof ISVDBChildParent ) { for ( ISVDBItemBase it : ( ( ISVDBChildParent ) context ) . getChildren ( ) ) { if ( SVDBStmt . isType ( it , SVDBItemType . VarDeclStmt ) ) { boolean stop = false ; for ( ISVDBChildItem c : ( ( SVDBVarDeclStmt ) it ) . getChildren ( ) ) { SVDBVarDeclItem vi = ( SVDBVarDeclItem ) c ; if ( vi . getName ( ) . equals ( name ) ) { ret . add ( vi ) ; if ( stop_on_first_match ) { stop = true ; break ; } } if ( stop ) { break ; } } } } if ( ret . size ( ) > 0 && stop_on_first_match ) { break ; } if ( context . getType ( ) == SVDBItemType . Function || context . getType ( ) == SVDBItemType . Task ) { for ( SVDBParamPortDecl it : ( ( SVDBTask ) context ) . getParams ( ) ) { boolean stop = false ; for ( ISVDBChildItem c : it . getChildren ( ) ) { SVDBVarDeclItem vi = | |
729 | <s> package com . asakusafw . bulkloader . transfer ; import java . text . MessageFormat ; import java . util . Properties ; import com . asakusafw . thundergate . runtime . cache . CacheInfo ; public class FileProtocol { public static final String KEY_KIND = "kind" ; public static final String KEY_LOCATION = "location" ; private final Kind kind ; private final String location ; private final CacheInfo info ; public FileProtocol ( Kind kind , String location , CacheInfo info ) { if ( kind == null ) { throw new IllegalArgumentException ( "" ) ; } if ( location == null ) { throw new IllegalArgumentException ( "" ) ; } if ( kind . hasCacheInfo ( ) && info == null ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , kind ) ) ; } this . kind = kind ; this . location = location ; this . info = info ; } public Kind getKind ( ) { | |
730 | <s> package org . rubypeople . rdt . internal . corext . template . ruby ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . templates . DocumentTemplateContext ; import org . eclipse . jface . text . templates . TemplateContextType ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . internal . ui . text . template . contentassist . MultiVariableGuess ; public class RubyScriptContext extends DocumentTemplateContext { private IRubyScript fRubyScript ; protected boolean fForceEvaluation ; protected MultiVariableGuess fMultiVariableGuess ; protected RubyScriptContext ( TemplateContextType type , IDocument document , int completionOffset , int completionLength , IRubyScript rubyScript ) { super ( type , document , completionOffset , completionLength ) ; fRubyScript = | |
731 | <s> package net . sf . sveditor . core . text ; import java . io . ByteArrayOutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . StringInputStream ; import net . sf . sveditor . core . templates . ITemplateParameterProvider ; public class TagProcessor { private List < ITemplateParameterProvider > fProviders ; public TagProcessor ( ) { fProviders = new ArrayList < ITemplateParameterProvider > ( ) ; } public void addParameterProvider ( ITemplateParameterProvider p ) { fProviders . add ( p ) ; } public void removeParameterProvider ( ITemplateParameterProvider p ) { fProviders . remove ( p ) ; } public String process ( String in ) { StringInputStream in_str = new StringInputStream ( in ) ; ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; try { process ( in_str , out ) ; } catch ( IOException e ) { } return out . toString ( ) ; } public int process ( InputStream in , OutputStream out ) throws IOException { int ch ; int n_replacements = 0 ; StringBuilder sb = new StringBuilder ( ) ; while ( ( ch = in . read ( ) ) != - 1 ) { if ( ch | |
732 | <s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage ; import java . lang . reflect . InvocationTargetException ; import java . util . List ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . resource . ImageDescriptor ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . ui | |
733 | <s> package test . modelgen . table . model ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import javax . annotation . Generated ; import org . apache . hadoop . io . Writable ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . vocabulary . model . DataModel ; import com . asakusafw . vocabulary . model . Property ; import com . asakusafw . vocabulary . model . TableModel ; @ Generated ( "" ) @ DataModel @ TableModel ( name = "" , columns = { "TEMP_SID" } , primary = { "TEMP_SID" } ) @ SuppressWarnings ( "deprecation" ) public class ExportTempImportTarget11Df implements Writable { @ Property ( name = "TEMP_SID" ) private LongOption tempSid = new LongOption ( ) ; public long getTempSid ( ) { return this . tempSid . get ( ) ; } public void setTempSid ( long tempSid ) { this . tempSid . modify ( tempSid ) ; } public LongOption getTempSidOption ( ) { return this . tempSid ; } public void setTempSidOption ( LongOption tempSid ) { this . tempSid . copyFrom ( tempSid ) ; } public void copyFrom ( ExportTempImportTarget11Df source ) { this . tempSid . copyFrom ( source . tempSid ) ; } @ Override public void write ( DataOutput out ) throws IOException { tempSid . write ( out ) ; } @ Override public void readFields ( DataInput in ) throws IOException { tempSid . readFields ( in ) ; } @ Override public int hashCode ( ) { int prime = 31 ; | |
734 | <s> package com . team1160 . scouting . frontend . elements ; import java . awt . Component ; import java . awt . Dimension ; import javax . swing . JTable ; import javax . swing . JTextArea ; import javax . swing . UIManager ; import javax . swing . border . EmptyBorder ; import javax . swing . table . TableCellRenderer ; public class MultiLineTableCellRenderer extends JTextArea implements TableCellRenderer { private static final long serialVersionUID = 913219999734482766L ; public MultiLineTableCellRenderer ( ) { setLineWrap ( true ) ; setWrapStyleWord ( true ) ; setOpaque ( true ) ; } public Component getTableCellRendererComponent ( JTable table , Object value , boolean isSelected , boolean hasFocus , int row , int column ) { if ( isSelected ) { setForeground ( table . getSelectionForeground ( ) ) ; setBackground ( table . getSelectionBackground ( ) ) ; } else { setForeground ( table . getForeground ( ) ) ; setBackground ( table . getBackground ( ) ) ; } setFont ( table . getFont ( ) ) ; if ( hasFocus ) { setBorder ( UIManager . getBorder ( "" ) ) ; if ( table . isCellEditable ( row , column ) ) { setForeground | |
735 | <s> package org . oddjob . state ; import java . util . Date ; import org . oddjob . Stateful ; import org . oddjob . framework . JobDestroyedException ; public class StateExchange { private final StateChanger < ParentState > recipient ; private final Stateful source ; private boolean running ; private final StateListener stateListener = new StateListener ( ) { @ Override public void jobStateChange ( StateEvent event ) { ParentState state = ( ParentState ) event . getState ( ) ; Date time = event . getTime ( ) ; switch ( state ) { case DESTROYED : break ; case EXCEPTION : Throwable throwable = event . getException ( ) ; recipient . setStateException ( throwable , time ) ; break ; default : recipient . setState ( state , time ) ; break ; } } } ; public StateExchange ( Stateful source , StateChanger < ParentState > recipient ) { this . source = source ; this . recipient = recipient ; } | |
736 | <s> package net . bioclipse . opentox . api ; import java . util . HashMap ; import java . util . Map ; import net . bioclipse . core . domain . IStringMatrix ; import net . bioclipse . rdf . business . RDFManager ; public abstract class Algorithm { private static RDFManager rdf = new RDFManager ( ) ; public static Map < String , String > getProperties ( String ontologyServer , String feature ) { String propertiesQuery = "" + " <" + feature + "" + "}" ; Map < String , String > properties = new HashMap < String , String > ( ) ; IStringMatrix matrix = rdf . sparqlRemote ( ontologyServer , propertiesQuery , null ) ; for ( int i = 0 ; i < matrix . getRowCount ( ) ; | |
737 | <s> package com . asakusafw . runtime . value ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import org . junit . Test ; @ SuppressWarnings ( "deprecation" ) public class LongOptionTest extends ValueOptionTestRoot { @ Test public void init ( ) { LongOption option = new LongOption ( ) ; assertThat ( option . isNull ( ) , is ( true ) ) ; } @ Test public void get ( ) { LongOption option = new LongOption ( ) ; option . modify ( 100 ) ; assertThat ( option . get ( ) , is ( 100L ) ) ; assertThat ( option . isNull ( ) , is ( false ) ) ; } @ Test public void or ( ) { LongOption option = new LongOption ( ) ; assertThat ( option . or ( 30 ) , is ( 30L ) ) ; assertThat ( option . isNull ( ) , is ( true ) ) ; } | |
738 | <s> package de . fuberlin . wiwiss . d2rq . algebra ; import java . util . List ; import java . util . Set ; import de . fuberlin . wiwiss . d2rq . expr . Expression ; public class MutableRelation implements RelationalOperators { private Relation relation ; public MutableRelation ( Relation initialState ) { this . relation = initialState ; } public Relation immutableSnapshot ( ) { return this . relation ; } public Relation renameColumns ( ColumnRenamer renamer ) { return this . relation = this . relation . renameColumns ( renamer ) ; } public Relation empty ( ) { return this . relation = Relation . EMPTY ; } public Relation select ( Expression condition ) { if ( condition . isFalse ( ) ) { return empty ( ) ; } return this . relation = this . relation . select ( condition ) ; } public Relation orderBy ( List < OrderSpec > orderSpecs ) { return relation = new RelationImpl ( relation . database ( ) , relation . aliases ( ) , relation . condition ( ) , relation . softCondition ( ) , relation . joinConditions ( ) , relation . projections ( ) , relation . isUnique ( ) , orderSpecs , relation . limit ( ) , relation . limitInverse ( ) ) ; } public Relation swapLimits ( ) { return relation = new RelationImpl ( relation . database ( ) , relation . aliases ( ) , relation . condition ( ) , relation . softCondition ( ) , relation . joinConditions ( ) , relation . projections ( ) , relation . isUnique ( ) , relation . orderSpecs | |
739 | <s> package com . asakusafw . compiler . operator . processor ; import static org . junit . Assert . * ; import org . junit . Test ; import com . asakusafw . compiler . operator . OperatorCompilerTestRoot ; import com . asakusafw . compiler . operator . model . MockHoge ; import com . asakusafw . utils . graph . Graph ; import com . asakusafw . vocabulary . flow . testing . MockIn ; import com . asakusafw . vocabulary . flow . testing . MockOut ; public class LoggingOperatorProcessorTest extends OperatorCompilerTestRoot { @ Test public void simple ( ) { add ( "" ) ; ClassLoader loader = start ( new LoggingOperatorProcessor ( ) ) ; Object factory = create ( loader , "" ) ; MockIn < MockHoge > in = MockIn . of ( MockHoge . class , "in" ) ; MockOut < MockHoge > out = MockOut . of ( MockHoge . class , "out" ) ; Object logging = invoke ( factory , "example" , in ) ; out . add ( output ( MockHoge . class , logging , "out" ) ) ; Graph < String > graph = toGraph ( in ) ; assertThat ( graph . getConnected ( "in" ) , isJust ( "" ) ) ; assertThat ( graph . getConnected ( "" ) , isJust ( "out" ) ) ; } @ Test public void parameterized ( ) { add ( "" ) ; ClassLoader loader = start ( new LoggingOperatorProcessor ( ) ) ; Object factory = create ( loader , "" ) ; MockIn < MockHoge > in = MockIn . of ( MockHoge . class , "in" ) ; MockOut < MockHoge > out = MockOut . of ( MockHoge . class , "out" ) ; Object logging = invoke ( factory , "example" , in , 100 ) ; out . add ( output | |
740 | <s> package net . sf . sveditor . core . tests . index . cache ; import java . io . ByteArrayInputStream ; import java . io . ByteArrayOutputStream ; import java . io . DataInputStream ; import java . io . DataOutputStream ; import java . io . File ; import java . io . IOException ; import java . util . List ; import junit . framework . TestCase ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . index . ISVDBIndex ; import net . sf . sveditor . core . db . index . ISVDBItemIterator ; import net . sf . sveditor . core . db . index . SVDBArgFileIndexFactory ; import net . sf . sveditor . core . db . index . SVDBIndexRegistry ; import net . sf . sveditor . core . db . index . SVDBLibPathIndexFactory ; import net . sf . sveditor . core . db . index . cache . ISVDBIndexCache ; import net . sf . sveditor . core . db . index . cache . ISVDBIndexCacheFactory ; import net . sf . sveditor . core . db . index . cache . SVDBDirFS ; import net . sf . sveditor . core . db . index . cache . SVDBFileIndexCache ; import net . sf . sveditor . core . db . persistence . DBFormatException ; import net . sf . sveditor . core . db . persistence . DBWriteException ; import net . sf . sveditor . core . db . persistence . IDBReader ; import net . sf . sveditor . core . db . persistence . IDBWriter ; import net . sf . sveditor . core . db . persistence . SVDBPersistenceRW ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . tests . CoreReleaseTests ; import net . sf . sveditor . core . tests . SVCoreTestsPlugin ; import net . sf . sveditor . core . tests . TestNullIndexCacheFactory ; import net . sf . sveditor . core . tests . utils . BundleUtils ; import net . sf . sveditor . core . tests . utils . TestUtils ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . runtime . NullProgressMonitor ; public class TestIndexCache extends TestCase { private File fTmpDir ; private IProject fProject ; @ Override protected void setUp ( ) throws Exception { fTmpDir = TestUtils . createTempDir ( ) ; fProject = null ; } @ Override protected void tearDown ( ) throws Exception { SVCorePlugin . getJobMgr ( ) . dispose ( ) ; if ( fProject != null ) { TestUtils . deleteProject ( fProject ) ; } if ( fTmpDir . exists ( ) ) { TestUtils . delete ( fTmpDir ) ; } } public void testFileCacheBasics ( ) { String testname = "" ; BundleUtils utils = new BundleUtils ( | |
741 | <s> package org . rubypeople . eclipse . shams . debug . core ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Set ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . debug . core . ILaunch ; import org . eclipse . debug . core . ILaunchConfiguration ; import org . eclipse . debug . core . ILaunchConfigurationType ; import org . eclipse . debug . core . ILaunchConfigurationWorkingCopy ; import org . eclipse . debug . core . ILaunchDelegate ; public class ShamLaunchConfigurationWorkingCopy implements ILaunchConfigurationWorkingCopy { protected Map attributes = new HashMap ( ) ; public ShamLaunchConfigurationWorkingCopy ( ) { super ( ) ; } public boolean isDirty ( ) { throw new RuntimeException ( "" ) ; } public ILaunchConfiguration doSave ( ) throws CoreException { return new ShamLaunchConfiguration ( ) ; } public void setAttribute ( String attributeName , int value ) { throw new RuntimeException ( "" ) ; } public void setAttribute ( String attributeName , String value ) { attributes . put ( attributeName , value ) ; } public void setAttribute ( String attributeName , List value ) { throw new RuntimeException ( "" ) ; } public | |
742 | <s> package org . rubypeople . rdt . internal . debug . ui . actions ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . text . ITextSelection ; import org . eclipse . jface . text . TextSelection ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . ui . IEditorPart ; import org . rubypeople . rdt . internal . debug . ui . evaluation . EvaluationExpression ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; public class ExpressionInspectAction extends Action { private EvaluationExpression expression ; private ISelection selection ; public ExpressionInspectAction ( EvaluationExpression expression , ISelection selection ) { this . expression = expression ; this . setText ( expression . getName ( ) ) ; this . selection = selection ; } public void run ( ) { if ( ! ( | |
743 | <s> package org . rubypeople . rdt . internal . formatter . rewriter ; import org . jruby . ast . StrNode ; import org | |
744 | <s> package org . oddjob . util ; public class MockThreadManager implements ThreadManager { public String [ ] activeDescriptions ( ) { throw new | |
745 | <s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . jface . action . ToolBarManager ; import org . eclipse . jface . operation . IRunnableContext ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . swt . SWT ; import org . eclipse . swt . custom . SashForm ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . forms . events . ExpansionAdapter ; import org . eclipse . ui . forms . events . ExpansionEvent ; import org . eclipse . ui . forms . widgets . ExpandableComposite ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . ISourceFolderRoot ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . buildpath . LoadpathModifier ; import org . rubypeople . rdt . internal . corext . buildpath . LoadpathModifier . ILoadpathModifierListener ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . preferences . ScrolledPageContent ; import org . rubypeople . rdt . internal . ui . util . PixelConverter ; import org . rubypeople . rdt . internal . ui . util . ViewerPane ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . BuildPathBasePage ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . BuildPathsBlock ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . CPListElement ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . CPListElementAttribute ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . ListDialogField ; public class NewSourceContainerWorkbookPage extends BuildPathBasePage implements ILoadpathModifierListener { public static final String OPEN_SETTING = "" ; private ListDialogField fClassPathList ; private HintTextGroup fHintTextGroup ; private DialogPackageExplorer fPackageExplorer ; private final BuildPathsBlock fBuildPathsBlock ; private IRubyProject fRubyProject ; public NewSourceContainerWorkbookPage ( ListDialogField classPathList , IRunnableContext context , BuildPathsBlock buildPathsBlock ) { fClassPathList = classPathList ; fBuildPathsBlock = buildPathsBlock ; fPackageExplorer = new DialogPackageExplorer ( ) ; fHintTextGroup = new HintTextGroup ( fPackageExplorer , context , this ) ; } public void init ( IRubyProject javaProject ) { fRubyProject = javaProject ; fHintTextGroup . setRubyProject ( javaProject ) ; fPackageExplorer . setInput ( javaProject ) ; } public Control getControl ( Composite parent ) { final int [ ] sashWeight = { 60 } ; final IPreferenceStore preferenceStore = RubyPlugin . getDefault ( ) . getPreferenceStore ( ) ; preferenceStore . setDefault ( OPEN_SETTING , true ) ; ScrolledPageContent scrolledContent = new ScrolledPageContent ( parent ) ; Composite body = scrolledContent . getBody ( ) ; body . setLayout ( new GridLayout ( ) ) ; final SashForm sashForm = new SashForm ( body , SWT . VERTICAL | SWT . NONE ) ; sashForm . setFont ( sashForm . getFont ( ) ) ; ViewerPane pane = new ViewerPane ( sashForm , SWT . BORDER | SWT . FLAT ) ; pane . setContent ( fPackageExplorer . createControl ( pane ) ) ; fPackageExplorer . setContentProvider ( ) ; final ExpandableComposite excomposite = new ExpandableComposite ( sashForm , SWT . NONE , ExpandableComposite . TWISTIE | ExpandableComposite . CLIENT_INDENT ) ; excomposite . setFont ( sashForm . getFont ( ) ) ; excomposite . setText ( NewWizardMessages . NewSourceContainerWorkbookPage_HintTextGroup_title ) ; final boolean isExpanded = preferenceStore . getBoolean ( OPEN_SETTING ) ; excomposite . setExpanded ( isExpanded ) ; excomposite . addExpansionListener ( new ExpansionAdapter ( ) { public void expansionStateChanged ( ExpansionEvent e ) { ScrolledPageContent parentScrolledComposite = getParentScrolledComposite ( excomposite ) ; if ( parentScrolledComposite != null ) { boolean expanded = excomposite . isExpanded ( ) ; parentScrolledComposite . reflow ( true ) ; adjustSashForm ( sashWeight , sashForm , expanded ) ; preferenceStore . setValue ( OPEN_SETTING , expanded ) ; } } } ) ; excomposite . setClient ( fHintTextGroup . createControl ( excomposite ) ) ; final DialogPackageExplorerActionGroup actionGroup = new DialogPackageExplorerActionGroup ( fHintTextGroup , this ) ; ToolBarManager tbm = actionGroup . createLeftToolBarManager ( pane ) ; pane . setTopCenter ( null ) ; pane . setTopLeft ( tbm . getControl ( ) ) ; tbm = actionGroup . createLeftToolBar ( pane ) ; pane | |
746 | <s> package org . oddjob . monitor . view ; import java . awt . GraphicsEnvironment ; import javax . swing . JMenu ; import junit . framework . TestCase ; import org . oddjob . monitor . action . HardResetAction ; import org . oddjob . monitor . actions . | |
747 | <s> package com . aptana . rdt . internal . ui . rspec ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . jface . resource . ImageDescriptor ; import org . eclipse . jface . viewers . IBaseLabelProvider ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . LabelProvider ; import org . eclipse . swt . graphics . Image ; import org . jruby . ast . RootNode ; import org . rubypeople . rdt . core . IImportContainer ; import org . rubypeople . rdt . core . IParent ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . rubyeditor . ASTProvider ; import org . rubypeople . rdt . internal . ui . rubyeditor . RubyOutlinePage ; import org . rubypeople . rdt . internal . ui . viewsupport . RubyElementImageProvider ; import org . rubypeople . rdt . ui . RubyElementLabels ; import org . rubypeople . rdt . ui . rubyeditor . ICustomRubyOutlinePage ; import org . rubypeople . rdt . ui . viewsupport . ImageDescriptorRegistry ; import com . aptana . rdt . core . rspec . Behavior ; import com . aptana . rdt . core . rspec . Example ; import com . aptana . rdt . core . rspec . RSpecStructureCreator ; import com . aptana . rdt . ui . AptanaRDTUIPlugin ; public class RSpecOutlinePage extends RubyOutlinePage implements ICustomRubyOutlinePage { private static final String SPEC_FILENAME_SUFFIX = "_spec.rb" ; protected ITreeContentProvider getContentProvider ( ) { return new RSpecChildrenProvider ( ) ; } @ Override protected IBaseLabelProvider getLabelProvider ( ) { return new LabelProvider ( ) { public String getText ( Object element ) { if ( element instanceof Example ) { return ( ( Example ) element ) . getDescription ( ) ; } if ( element instanceof Behavior ) { return ( ( Behavior ) element ) . getClassName ( ) ; } if ( element instanceof IRubyElement ) { return RubyElementLabels . getTextLabel ( element , 0 ) ; } return super . getText ( element ) ; } public Image getImage ( Object element ) { ImageDescriptorRegistry registry = RubyPlugin . getImageDescriptorRegistry ( ) ; ImageDescriptor descriptor = null ; if ( | |
748 | <s> package org . oddjob . jmx . server ; import javax . management . MBeanAttributeInfo ; import javax . management . MBeanNotificationInfo ; import javax . management . MBeanOperationInfo ; import org . oddjob . jmx . client . ClientHandlerResolver ; public class MockServerInterfaceHandlerFactory < X , Y > implements ServerInterfaceHandlerFactory < X , Y > { public ClientHandlerResolver < Y > clientHandlerFactory ( ) { throw new RuntimeException ( "" + getClass ( ) ) ; } public ServerInterfaceHandler createServerHandler ( X target , ServerSideToolkit ojmb ) { throw new RuntimeException ( "" + getClass ( ) ) ; } public MBeanAttributeInfo [ ] getMBeanAttributeInfo ( ) { throw new RuntimeException | |
749 | <s> package net . sf . sveditor . core . db . stmt ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . expr . SVDBExpr ; public class SVDBCaseStmt extends SVDBStmt { public enum CaseType { Case , Casex , Casez , Randcase } ; public CaseType fCaseType ; public SVDBExpr fExpr ; public List < SVDBCaseItem > fCaseItemList ; public SVDBCaseStmt ( ) { this ( CaseType . Case ) ; } public SVDBCaseStmt ( CaseType type ) { super ( SVDBItemType . CaseStmt ) ; fCaseItemList = new ArrayList < SVDBCaseItem > ( ) ; fCaseType = type ; } public CaseType getCaseType ( ) { return fCaseType ; } public void setExpr ( SVDBExpr expr ) | |
750 | <s> package com . asakusafw . compiler . flow . packager ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . ByteArrayInputStream ; import java . io . ByteArrayOutputStream ; import java . io . IOException ; import java . io . OutputStream ; import java . io . PrintWriter ; import java . util . Arrays ; import java . util . Collections ; import java . util . Set ; import java . util . jar . JarEntry ; import java . util . jar . JarInputStream ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . batch . ResourceRepository ; import com . asakusafw . compiler . flow . JobflowCompilerTestRoot ; import com . asakusafw . compiler . flow . Packager ; import com . asakusafw . utils . collections . Sets ; import com . asakusafw . utils . java . model . syntax . Comment ; import com . asakusafw . utils . java . model . syntax . CompilationUnit ; import com . asakusafw . utils . java . model . syntax . ImportDeclaration ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . TypeBodyDeclaration ; import com . asakusafw . utils . java . model . syntax . TypeParameterDeclaration ; import com . asakusafw . utils . java . model . util . AttributeBuilder ; import com . asakusafw . utils . java . model . util . Models ; public class FilePackagerTest extends JobflowCompilerTestRoot { static final Logger LOG = LoggerFactory . getLogger ( FilePackagerTest . class ) ; @ Rule public TemporaryFolder folder = new TemporaryFolder ( ) ; @ Test public void build_java ( ) throws Exception { Set < String > entries = Sets . create ( ) ; FilePackager packager = new FilePackager ( folder . newFolder ( ) , Arrays . < ResourceRepository > asList ( ) ) ; packager . initialize ( environment ) ; emit ( packager , java ( "Hello" ) ) ; build ( entries , packager ) ; assertThat ( entries , hasItem ( "" ) ) ; } @ Test public void build_resource ( ) throws Exception { Set < String > entries = Sets . create ( ) ; | |
751 | <s> package com . asakusafw . utils . java . jsr199 . testing ; import java . io . IOException ; import java . io . PrintWriter ; import java . io . Writer ; import java . lang . reflect . Field ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashSet ; import java . util . Set ; import javax . annotation . processing . AbstractProcessor ; import javax . annotation . processing . RoundEnvironment ; import javax . annotation . processing . SupportedAnnotationTypes ; import javax . annotation . processing . SupportedSourceVersion ; import javax . lang . model . SourceVersion ; import javax . lang . model . element . Element ; import javax . lang . model . element . TypeElement ; import javax . tools . FileObject ; import javax . tools . JavaFileObject ; import javax . tools . StandardLocation ; @ SupportedAnnotationTypes ( { "" } ) @ SupportedSourceVersion ( SourceVersion . RELEASE_6 ) public class MockProcessor extends AbstractProcessor { @ Override public | |
752 | <s> package org . oddjob . framework ; public class RunnableProxyGenerator extends ProxyGenerator < Runnable > { public Object generate ( Runnable runnable , ClassLoader classLoader ) { return generate ( runnable , new BaseWrapperFactory < Runnable > ( ) { @ Override public ComponentWrapper wrapperFor ( Runnable wrapped | |
753 | <s> package net . sf . sveditor . ui . explorer ; import java . util . List ; import net . sf . sveditor . core . db . ISVDBChildItem ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . ui . SVUiPlugin ; import net . sf . sveditor . ui . editor . SVEditor ; import org . eclipse . core . filesystem . EFS ; import org . eclipse . core . filesystem . IFileStore ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . Path ; import org . eclipse . jface . action . IMenuManager ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . ui . IActionBars ; import org . eclipse . ui . IEditorDescriptor ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . IEditorReference ; import org . eclipse . ui . IEditorRegistry ; import org . eclipse . ui . IURIEditorInput ; import org . eclipse . ui . IWorkbench ; import org . eclipse . ui . IWorkbenchPage ; import org . eclipse . ui . IWorkbenchWindow ; import org . eclipse . ui . PartInitException ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . actions . SelectionListenerAction ; import org . eclipse . ui . ide . FileStoreEditorInput ; import org . eclipse . ui . navigator . CommonActionProvider ; import org . eclipse . ui . navigator . ICommonActionConstants ; import org . eclipse . ui . navigator . ICommonActionExtensionSite ; import org . eclipse . ui . part . FileEditorInput ; public class OpenSVDBItem extends CommonActionProvider { private OpenItemAction fOpenItem ; private static LogHandle fLog ; static { fLog = LogFactory . getLogHandle ( "OpenSVDBItem" ) ; } @ Override public void init ( ICommonActionExtensionSite site ) { super . init ( site ) ; fOpenItem = new OpenItemAction ( ) ; } @ Override public void fillContextMenu ( IMenuManager menu ) { menu . add ( fOpenItem ) ; fOpenItem . selectionChanged ( ( IStructuredSelection ) getContext ( ) . getSelection ( ) ) ; super . fillContextMenu ( menu ) ; } @ Override public void fillActionBars ( IActionBars actionBars ) { super . fillActionBars ( actionBars ) ; actionBars . setGlobalActionHandler ( ICommonActionConstants . OPEN , fOpenItem ) ; fOpenItem . selectionChanged ( ( IStructuredSelection ) getContext ( ) . getSelection ( ) ) ; } private class OpenItemAction extends SelectionListenerAction { | |
754 | <s> package net . thucydides . showcase . simple ; import net . thucydides . core . annotations . Managed ; import net . thucydides . core . annotations . ManagedPages ; import net . thucydides . core . annotations . Steps ; import net . thucydides . core . annotations . Story ; import net . thucydides . core . pages . Pages ; import net . | |
755 | <s> package com . aptana . rdt . rake ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Status ; import org . eclipse . ui . plugin . AbstractUIPlugin ; import org . osgi . framework . BundleContext ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . launching . RubyRuntime ; import com . aptana . rdt . AptanaRDTPlugin ; import com . aptana . rdt . internal . rake . RakeTasksHelper ; public class RakePlugin extends AbstractUIPlugin { public static final String PLUGIN_ID = "" ; private static final String RAKE = "rake" ; private static RakePlugin plugin ; private IRakeHelper rakeHelper ; public RakePlugin ( ) { super ( ) ; } public void start ( BundleContext context ) throws Exception { plugin = this ; super . start ( context ) ; rakeHelper = RakeTasksHelper . getInstance ( ) ; } public void stop ( BundleContext context ) throws Exception { plugin = null ; super . stop ( context ) ; } public static RakePlugin getDefault ( ) { return plugin ; } public String getRakePath ( ) { String path = getSavedPath ( PreferenceConstants . PREF_RAKE_PATH ) ; if ( path != null && path . trim ( ) . length ( ) > 0 ) return path ; return buildBinExecutablePath ( RAKE ) ; } private String getSavedPath ( String prefKey ) { String path = getPreferenceStore ( ) . getString ( prefKey ) ; if ( path == null || path . trim ( ) . length ( ) == 0 ) return null ; if ( path . endsWith ( ".bat" ) || path . endsWith ( ".cmd" ) ) { return path . substring ( 0 , path . length ( ) - 4 ) ; } | |
756 | <s> package com . asakusafw . vocabulary . batch ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . io . InputStream ; import java . text . MessageFormat ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import java . util . Properties ; import java . util . TreeMap ; public class ScriptWorkDescription extends WorkDescription { public static final String K_NAME = "name" ; public static final String K_COMMAND = "command" ; public static final String K_PROFILE = "profile" ; public static final String K_ENVIRONMENT_PREFIX = "env." ; private String name ; private String command ; private String profileName ; private Map < String , String > variables ; public ScriptWorkDescription ( String name , String command , String profileName , Map < String , String > variables ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } if ( command == null ) { throw new IllegalArgumentException ( "" ) ; } if ( profileName == null ) { throw new IllegalArgumentException ( "" ) ; } if ( variables == null ) { throw new IllegalArgumentException ( "" ) ; } if ( isValidName ( name ) == false ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , name , command ) ) ; } this . name = name ; this . command = command ; this . profileName = profileName ; this . variables = Collections . unmodifiableSortedMap ( new TreeMap < String , String > ( variables ) ) ; } @ Override public String getName ( ) { return name ; } public String getCommand ( ) { return command ; } public String getProfileName ( ) { return profileName ; } public Map < String , String > getVariables ( ) { return variables ; } public static ScriptWorkDescription load ( Class < ? > context , String path ) throws IOException { if ( context == null ) { throw new IllegalArgumentException ( "" ) ; } if ( path == null ) { throw new IllegalArgumentException ( "" ) ; } InputStream stream = context . getResourceAsStream ( path ) ; if ( stream == null ) { throw new FileNotFoundException ( path ) ; } Properties properties = new Properties ( ) ; try { properties . load ( stream ) ; } finally { stream . close ( ) ; } return load ( properties ) ; } private static ScriptWorkDescription load ( Properties properties ) { assert properties != null ; String name = properties . getProperty ( K_NAME ) ; String command = properties . getProperty ( K_COMMAND ) ; String profile = properties . getProperty ( K_PROFILE ) ; properties . remove ( K_COMMAND ) ; properties . remove ( K_PROFILE ) ; Map < String , String > env = new HashMap < String , String > ( ) ; for ( Map . Entry < ? , ? > entry : properties . entrySet ( ) ) { if ( ( entry . getKey ( ) instanceof String ) == false ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , entry . getKey ( ) , entry . getKey ( ) . getClass ( ) . getName ( ) ) ) ; } if ( ( entry . getValue ( ) instanceof String ) == false ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , entry . getValue ( ) , entry . getValue ( ) . getClass ( ) . getName ( ) ) ) ; } String key = ( String ) entry . getKey ( ) ; if ( key . startsWith ( K_ENVIRONMENT_PREFIX ) == false ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , entry . getKey ( ) , K_ENVIRONMENT_PREFIX ) ) ; } key = key . substring ( K_ENVIRONMENT_PREFIX . length ( ) ) ; String value = ( String ) entry . getValue ( ) ; env . put ( key , value ) ; } return new ScriptWorkDescription ( | |
757 | <s> package com . asakusafw . modelgen . emitter ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . File ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import javax . annotation . Generated ; import org . apache . hadoop . io . Writable ; import com . asakusafw . modelgen . Constants ; import com . asakusafw . modelgen . model . ModelDescription ; import com . asakusafw . modelgen . model . ModelProperty ; import com . asakusafw . modelgen . model . PropertyType ; import com . asakusafw . utils . java . model . syntax . Annotation ; import com . asakusafw . utils . java . model . syntax . Attribute ; import com . asakusafw . utils . java . model . syntax . Block ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . FieldDeclaration ; import com . asakusafw . utils . java . model . syntax . FormalParameterDeclaration ; import com . asakusafw . utils . java . model . syntax . InfixOperator ; import com . asakusafw . utils . java . model . syntax . Javadoc ; import com . asakusafw . utils . java . model . syntax . MethodDeclaration ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . ModifierKind ; import com . asakusafw . utils . java . model . syntax . PackageDeclaration ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Statement ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . TypeBodyDeclaration ; import com . asakusafw . utils . java . model . syntax . TypeDeclaration ; import com . asakusafw . utils . java . model . syntax . TypeParameterDeclaration ; import com . asakusafw . utils . java . model . util . AttributeBuilder ; import com . asakusafw . utils . java . model . util . ExpressionBuilder ; import com . asakusafw . utils . java . model . util . JavadocBuilder ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . utils . java . model . util . TypeBuilder ; public abstract class ModelEntityEmitter < T extends ModelDescription > extends BaseEmitter < T > { private static final int HASHCODE_PRIME = 31 ; public ModelEntityEmitter ( ModelFactory factory , File output , String packageName , List < String > headerComment ) { super ( factory , output , packageName , headerComment ) ; } public abstract Class < T > getEmitTargetType ( ) ; @ Override protected PackageDeclaration createPackageDeclaration ( T model ) { return f . newPackageDeclaration ( common . getPackageNameOf ( model . getReference ( ) , Constants . CATEGORY_MODEL ) ) ; } @ Override protected TypeDeclaration createTypeDeclaration ( T model ) { bless ( common . getModelType ( model . getReference ( ) ) ) ; List < Annotation > annotations = createAnnotationsForModel ( model ) ; List < Attribute > modifiers = new ArrayList < Attribute > ( ) ; modifiers . addAll ( new AttributeBuilder ( f ) . annotation ( bless ( Generated . class ) , Models . toLiteral ( f , MessageFormat . format ( "{0}:{1}" , getClass ( ) . getSimpleName ( ) , Constants . VERSION ) ) ) . toAnnotations ( ) ) ; modifiers . addAll ( annotations ) ; modifiers . add ( f . newModifier ( ModifierKind . PUBLIC ) ) ; return f . newClassDeclaration ( createJavadocForModel ( model ) , modifiers , common . getTypeNameOf ( model . getReference ( ) ) , Collections . < TypeParameterDeclaration > emptyList ( ) , null , createSuperInterfaces ( model ) , createMembers ( model ) ) ; } protected List < TypeBodyDeclaration > createMembers ( T model ) { List < ModelProperty > properties = model . getProperties ( ) ; List < TypeBodyDeclaration > body = new ArrayList < TypeBodyDeclaration > ( ) ; for ( ModelProperty property : properties ) { TypeBodyDeclaration member = createField ( property ) ; body . add ( member ) ; } for ( ModelProperty property : properties ) { TypeBodyDeclaration getter = createGetter ( property ) ; body . add ( getter ) ; TypeBodyDeclaration setter = createSetter ( property ) ; body . add ( setter ) ; TypeBodyDeclaration altGetter = createAltGetter ( property ) ; if ( altGetter != null ) { body . add ( altGetter ) ; } TypeBodyDeclaration altSetter = createAltSetter ( property ) ; if ( altSetter != null ) { body . add ( altSetter ) ; } TypeBodyDeclaration optionGetter = createOptionGetter ( property ) ; body . add ( optionGetter ) ; TypeBodyDeclaration optionSetter = createOptionSetter ( property ) ; body . add ( optionSetter ) ; } body . add ( createCopier ( model ) ) ; body . add ( createWritableWrite ( model ) ) ; body . add ( createWritableReadFields ( model ) ) ; body . add ( createHashCode ( model ) ) ; body . add ( createEquals ( model ) ) ; body . add ( createToString ( model ) ) ; return body ; } protected FieldDeclaration createField ( ModelProperty property ) { List < Annotation > annotations = createAnnotationsForField ( property ) ; List < Attribute > modifiers = new ArrayList < Attribute > ( ) ; modifiers . addAll ( annotations ) ; modifiers . add ( f . newModifier ( ModifierKind . PRIVATE ) ) ; return f . newFieldDeclaration ( createJavadocForField ( property ) , modifiers , bless ( common . getOptionType ( property . getType ( ) ) ) , common . getFieldNameOf ( property . getName ( ) , property . getType ( ) ) , createInitializerForField ( property ) ) ; } protected MethodDeclaration createGetter ( ModelProperty property ) { List < Annotation > annotations = createAnnotationsForGetter ( property ) ; List < Attribute > modifiers = new ArrayList < Attribute > ( ) ; modifiers . addAll ( annotations ) ; modifiers . add ( f . newModifier ( ModifierKind . PUBLIC ) ) ; return f . newMethodDeclaration ( createJavadocForGetter ( property ) , modifiers , Collections . < TypeParameterDeclaration > emptyList ( ) , bless ( common . getRawType ( property . getType ( ) ) ) , common . getGetterNameOf ( property . getName ( ) , property . getType ( ) ) , Collections . < FormalParameterDeclaration > emptyList ( ) , 0 , Collections . < Type > emptyList ( ) , createBodyForGetter ( property ) ) ; } protected MethodDeclaration createSetter ( ModelProperty property ) { List < Annotation > annotations = createAnnotationsForSetter ( property ) ; List < Attribute > modifiers = new ArrayList < Attribute > ( ) ; modifiers . addAll ( annotations ) ; modifiers . add ( f . newModifier ( ModifierKind . PUBLIC ) ) ; SimpleName parameterName = createNameForParameter ( property ) ; return f . newMethodDeclaration ( createJavadocForSetter ( property ) , modifiers , Collections . < TypeParameterDeclaration > emptyList ( ) , Models . toType ( f , void . class ) , common . getSetterNameOf ( property . getName ( ) , property . getType ( ) ) , Collections . singletonList ( f . newFormalParameterDeclaration ( bless ( common . getRawType ( property . getType ( ) ) ) , parameterName ) ) , 0 , Collections . < Type > emptyList ( ) , createBodyForSetter ( property , parameterName ) ) ; } protected MethodDeclaration createAltGetter ( ModelProperty property ) { SimpleName name = common . getAltGetterNameOf ( property . getName ( ) , property . getType ( ) ) ; if ( name == null ) { return null ; } List < Annotation > annotations = createAnnotationsForGetter ( property ) ; List < Attribute > modifiers = new ArrayList < Attribute > ( ) ; modifiers . addAll ( annotations ) ; modifiers . add ( f . newModifier ( ModifierKind . PUBLIC ) ) ; return f . newMethodDeclaration ( createJavadocForGetter ( property ) , modifiers , Collections . < TypeParameterDeclaration > emptyList ( ) , bless ( common . getAltType ( property . getType ( ) ) ) , name , Collections . < FormalParameterDeclaration > emptyList ( ) , 0 , Collections . < Type > emptyList ( ) , createBodyForAltGetter ( property ) ) ; } protected MethodDeclaration createAltSetter ( ModelProperty property ) { SimpleName name = common | |
758 | <s> package net . sf . sveditor . core . tests ; import java . io . ByteArrayInputStream ; import java . io . ByteArrayOutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import net . sf . sveditor . core . StringInputStream ; public class TextTagPosUtils { private ByteArrayOutputStream fStrippedData ; private Map < String , Integer > fPosMap ; private Map < String , Integer > fLineMap ; private int fUngetCh ; private int fLastCh ; private int fLineno ; private int fPos ; private InputStream fInputStream ; public TextTagPosUtils ( InputStream in ) { fInputStream = in ; fPosMap = new HashMap < String , Integer > ( ) ; fLineMap = new HashMap < String , Integer > ( ) ; fStrippedData = new ByteArrayOutputStream ( ) ; process ( ) ; } public TextTagPosUtils ( String in ) { this ( new StringInputStream ( in ) ) ; } public Map < String , Integer > getPosMap ( ) { return fPosMap ; } public int getTagPos ( String tag ) { if ( ! fPosMap . containsKey ( tag ) ) { return - 1 ; } else { return fPosMap . get ( tag ) ; } } public Map < String , Integer > getLineMap ( ) { return fLineMap ; } public InputStream openStream ( ) { return new ByteArrayInputStream ( fStrippedData . toByteArray ( ) ) ; } public String getStrippedData ( ) { return fStrippedData . toString ( ) ; } private void process ( ) { fUngetCh = - 1 ; fLastCh = - 1 ; fLineno = 1 ; fPos = 0 ; int ch , ch2 ; StringBuilder tmp | |
759 | <s> package net . sf . sveditor . core . templates ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . Tuple ; import net . sf . sveditor . core . log . LogFactory ; import org . eclipse . core . runtime . IConfigurationElement ; import org . eclipse . core . runtime . IExtension ; import org . eclipse . core . runtime . IExtensionPoint ; import org . eclipse . core . runtime . IExtensionRegistry ; import org . eclipse . core . runtime . Platform ; import org . osgi . framework . Bundle ; public class ExtensionTemplateFinder extends AbstractTemplateFinder { public ExtensionTemplateFinder ( ) { super ( ) ; fLog = LogFactory . getLogHandle ( "" ) ; } public void find ( ) { IExtensionRegistry ext_rgy = Platform . getExtensionRegistry ( ) ; IExtensionPoint ext_pt = ext_rgy . getExtensionPoint ( SVCorePlugin . PLUGIN_ID , "SVTemplates" ) ; IExtension ext_list [ ] = ext_pt . getExtensions ( ) ; for ( IExtension ext : ext_list ) { IConfigurationElement ce_l [ ] = ext . getConfigurationElements ( ) ; for ( IConfigurationElement ce : ce_l ) { String name = ce | |
760 | <s> package org . oddjob . persist ; import java . io . File ; import java . net . URISyntaxException ; import java . net . URL ; import java . util . Properties ; import junit . framework . TestCase ; import org . apache . commons . io . FileUtils ; import org . oddjob . Helper ; import org . oddjob . Loadable ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . OurDirs ; import org . oddjob . Resetable ; import org . oddjob . arooa . MockArooaSession ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . life . ComponentPersistException ; import org . oddjob . arooa . life . ComponentPersister ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . registry . ComponentPool ; import org . oddjob . arooa . registry . MockComponentPool ; import org . oddjob . arooa . registry . Path ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . framework . SerializableJob ; import org . oddjob . state . JobState ; import org . oddjob . state . ParentState ; public class FilePersisterTest extends TestCase { File DIR ; @ Override protected void setUp ( ) throws Exception { OurDirs ourDirs = new OurDirs ( ) ; DIR = ourDirs . relative ( "work/persist" ) ; if ( DIR . exists ( ) ) { FileUtils . forceDelete ( DIR ) ; } FileUtils . forceMkdir ( DIR ) ; } public static class OurJob extends SerializableJob { private static final long serialVersionUID = 2008110500 ; private String name ; private String text ; public void setName ( String name ) { this . name = name ; } public void setText ( String text ) { this . text = text ; } @ Override protected int execute ( ) throws Throwable { return 0 ; } } public void testPersistAndLoad ( ) throws ComponentPersistException { OurJob job = new OurJob ( ) ; job . setName ( "Test" ) ; job . setText ( "Hello World" ) ; job . run ( ) ; StandardArooaSession session = new StandardArooaSession | |
761 | <s> package org . oddjob . schedules ; import java . text . ParseException ; import java . util . Date ; import java . util . HashMap ; import junit . framework . TestCase ; import org . oddjob . arooa . utils . DateHelper ; import org . oddjob . schedules . schedules . IntervalSchedule ; import org . oddjob . schedules . schedules . DailySchedule ; import org . oddjob . scheduling . ManualClock ; import org . oddjob . util . Clock ; public class ScheduleCalculatorTest2 extends TestCase { class OurClock implements Clock { boolean boobyTrapped ; public Date getDate ( ) { if ( boobyTrapped ) { throw new RuntimeException ( ) ; } else { try { return DateHelper . parseDateTime ( "" ) ; } catch ( ParseException e ) { throw new RuntimeException ( e ) ; } } } } class Results implements ScheduleListener { Date scheduleDate ; Date retryDate ; boolean failed ; @ Override public void complete ( Date scheduleDate , ScheduleResult lastComplete ) { throw new RuntimeException ( "Unexpected." ) ; } @ Override public void failed ( Date scheduleDate ) { this . scheduleDate = scheduleDate ; retryDate = null ; failed = true ; } @ Override public void initialised ( Date scheduleDate ) { this . scheduleDate = scheduleDate ; } @ Override public void retry ( Date scheduleDate , Date retryDate ) { if ( ! scheduleDate . equals ( this . scheduleDate ) ) { throw new RuntimeException ( ) ; } this . retryDate = retryDate ; } } public void testUserGuideScheduleExample ( ) throws ParseException { DailySchedule schedule = new DailySchedule ( ) ; schedule . setFrom ( "07:00" ) ; DailySchedule retry = new DailySchedule ( ) ; retry . setFrom ( "07:00" ) ; retry . setTo ( "14:00" ) ; IntervalSchedule interval = new IntervalSchedule ( ) ; interval . setInterval ( "00:15" ) ; retry . setRefinement ( interval ) ; OurClock clock = new OurClock ( ) ; ScheduleCalculator test = new ScheduleCalculator ( clock , schedule , retry ) ; Results results = new Results ( ) ; test . addScheduleListener ( results ) ; test . initialise ( null , new HashMap < Object , Object > ( ) ) ; assertEquals ( DateHelper . parseDateTime ( "" ) , results . scheduleDate ) ; | |
762 | <s> package org . oddjob . scheduling ; class RunnableWrapper implements Runnable { private final Runnable runnable ; private Thread t ; public RunnableWrapper ( Runnable runnable ) { this . runnable = runnable ; } public void run ( | |
763 | <s> package org . oddjob . jmx . client ; import java . util . ArrayList ; import java . util . List ; import org . oddjob . arooa . ClassResolver ; public class ResolverHelper { private final ClassResolver classResolver ; public ResolverHelper ( ClassResolver classResolver ) { this . classResolver = classResolver ; } public ClientInterfaceHandlerFactory < ? > [ ] resolveAll ( | |
764 | <s> package org . rubypeople . rdt . internal . ui . wizards ; import org . eclipse . core . runtime . Assert ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerFilter ; public class TypedViewerFilter extends ViewerFilter { private | |
765 | <s> package org . rubypeople . rdt . refactoring . core . renamelocal ; import org . jruby . ast . MethodDefNode ; import org . jruby . ast . Node ; import org . jruby . ast . types . INameNode ; import org . rubypeople . rdt . refactoring . core . IRefactoringConfig ; import org . rubypeople . rdt . refactoring . documentprovider . IDocumentProvider ; public class RenameLocalConfig implements IRefactoringConfig { private IDocumentProvider docProvider ; private int caretPosition ; private Node selectedNode ; private Node selectedMethod ; private String [ ] localNames ; private RenameLocalEditProvider editProvider ; public RenameLocalConfig ( IDocumentProvider docProvider , int caretPosition ) { this . docProvider = docProvider ; this . caretPosition = caretPosition ; } public String getSelectedNodeName ( ) { if ( selectedNode instanceof INameNode ) { return ( ( INameNode ) selectedNode ) . getName ( ) ; } else | |
766 | <s> package org . rubypeople . rdt . internal ; import org . rubypeople . rdt . internal . codeassist . TS_InternalCodeAssist ; import org . rubypeople . rdt . internal . core . TS_InternalCore ; import org . rubypeople . rdt . internal . formatter . TS_InternalFormatter ; import org . rubypeople . rdt . internal . ti . TS_TypeInference ; import junit . framework . | |
767 | <s> package org . rubypeople . rdt . internal . ui . search ; import org . eclipse . core . resources . IFile ; import org . eclipse . jface . dialogs . MessageDialog ; import org . eclipse . search . ui . NewSearchUI ; import org . eclipse . search . ui . text . Match ; import org . eclipse . ui . IEditorDescriptor ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . IEditorReference ; import org . eclipse . ui . IEditorRegistry ; import org . eclipse . ui . IPartListener ; import org . eclipse . ui . IPartService ; import org . eclipse . ui . IReusableEditor ; import org . eclipse . ui . IWorkbenchPage ; import org . eclipse . ui . IWorkbenchPart ; import org . eclipse . ui . PartInitException ; import org . eclipse . ui . ide . IDE ; import org . eclipse . ui . part . FileEditorInput ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . rubyeditor . EditorUtility ; public class RubySearchEditorOpener { private static class ReusedEditorWatcher implements IPartListener { private IEditorPart fReusedEditor ; private IPartService fPartService ; public ReusedEditorWatcher ( ) { fReusedEditor = null ; fPartService = null ; } public IEditorPart getReusedEditor ( ) { return fReusedEditor ; } public void initialize ( IEditorPart editor ) { if ( fReusedEditor != null ) { fPartService . removePartListener ( this ) ; } fReusedEditor = editor ; if ( editor != null ) { fPartService = editor . getSite ( ) . getWorkbenchWindow ( ) . getPartService ( ) ; fPartService . addPartListener ( this ) ; } else { fPartService = null ; } } public void partOpened ( IWorkbenchPart part ) { } public void partDeactivated ( IWorkbenchPart part ) { } public void partClosed ( IWorkbenchPart part ) { if ( part == fReusedEditor ) { initialize ( null ) ; } } public void partActivated ( IWorkbenchPart part ) { } public void partBroughtToTop ( IWorkbenchPart part ) { } } private ReusedEditorWatcher fReusedEditorWatcher ; public IEditorPart openElement ( Object element ) throws PartInitException , RubyModelException { IWorkbenchPage wbPage = RubyPlugin . getActivePage ( ) ; if ( NewSearchUI . reuseEditor ( ) ) return showWithReuse ( element , wbPage ) ; else return showWithoutReuse ( element , wbPage ) ; } public IEditorPart openMatch ( Match match ) throws PartInitException , RubyModelException { Object element = getElementToOpen ( match ) ; return openElement ( element ) ; } protected Object getElementToOpen ( Match match ) { return match . getElement ( ) ; } private IEditorPart showWithoutReuse ( Object element , IWorkbenchPage wbPage ) throws PartInitException , RubyModelException { return EditorUtility . openInEditor ( element , false ) ; } private IEditorPart showWithReuse ( Object element , IWorkbenchPage wbPage ) throws RubyModelException , PartInitException { IFile file = getFile ( element ) ; if ( file != null ) { String editorID = getEditorID ( file ) ; return showInEditor ( wbPage , new FileEditorInput ( file ) , editorID ) ; } return showWithoutReuse ( element , wbPage ) ; } private IFile getFile ( Object element ) throws RubyModelException { if ( element instanceof IFile ) return ( IFile ) element ; if ( element instanceof IRubyElement ) { IRubyElement jElement = ( IRubyElement ) element ; IRubyScript cu = ( IRubyScript ) jElement . getAncestor ( IRubyElement . SCRIPT ) ; if ( cu != null ) { return ( IFile ) cu . getCorrespondingResource ( ) ; } } return null ; } private String getEditorID ( IFile file ) throws PartInitException { IEditorDescriptor desc = IDE . getEditorDescriptor ( file ) ; if ( desc == null ) return RubyPlugin . getDefault ( ) . getWorkbench ( ) . getEditorRegistry | |
768 | <s> package com . asakusafw . runtime . io . util ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import org . junit . Test ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . runtime . value . StringOption ; @ SuppressWarnings ( "deprecation" ) public class WritableUnionTest extends WritableTestRoot { @ Test public void createFromClasses ( ) throws Exception { Union union = new WritableUnion ( IntOption . class , LongOption . class , StringOption . class ) ; assertThat ( union . switchObject ( 0 ) , instanceOf ( IntOption . class ) ) ; assertThat ( union . switchObject ( 1 ) , instanceOf ( LongOption . class ) ) ; assertThat ( union . switchObject ( 2 ) , instanceOf ( StringOption . class ) ) ; ( ( IntOption ) union . switchObject ( 0 ) ) . modify ( 100 ) ; assertThat ( union . getPosition ( ) , is ( 0 ) ) ; ( ( LongOption ) union . switchObject ( 1 ) ) . modify ( 200L ) ; assertThat ( union . getPosition ( ) , is ( 1 ) ) ; ( ( StringOption ) union . switchObject ( 2 ) ) . modify ( "" ) ; assertThat ( union . getPosition ( ) , is ( 2 ) ) ; assertThat ( union . switchObject ( 0 ) , is ( ( Object ) new IntOption ( 100 ) ) ) ; assertThat ( union . switchObject ( 1 ) , is ( ( Object ) new LongOption ( 200L ) ) ) ; assertThat ( union . switchObject ( 2 ) , is ( ( Object ) new StringOption ( "" ) ) ) ; } @ Test public void createFromObject ( ) throws Exception { Union union = new WritableUnion ( new IntOption ( 100 ) , new LongOption ( 200L ) , new StringOption ( "" ) ) ; assertThat ( union . switchObject ( 0 ) , is ( ( Object ) new IntOption ( 100 ) ) ) ; assertThat ( union . switchObject ( 1 ) , is ( ( Object ) new LongOption ( 200L ) ) ) ; | |
769 | <s> package osgiutils . services ; import java . util . ArrayList ; import java . util . Collection ; import java . util . Collections ; import org . osgi . framework . BundleContext ; import org . osgi . framework . FrameworkUtil ; import org . osgi . framework . InvalidSyntaxException ; import org . osgi . framework . ServiceReference ; public final class Services { private static BundleContext context = FrameworkUtil . getBundle ( Services . class ) . getBundleContext ( ) ; private Services ( ) { } public static < T , R > R run ( final Class < T > serviceClass , final ServiceRunnable < T , R > runnable ) { return runService ( context . getServiceReference ( serviceClass . getName ( ) ) , runnable ) ; } public static < T , R > Collection < R > runAll ( final Class < T > serviceClass , final ServiceRunnable < T , R > runnable ) { return runAll ( serviceClass , null , runnable ) ; } public static < T , R > Collection < R > runAll ( final Class < T > serviceClass , final String filter , final ServiceRunnable < T , R > runnable ) { try { final ServiceReference [ ] references = context . getServiceReferences ( serviceClass . getName | |
770 | <s> package com . asakusafw . utils . java . model . util ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . LinkedList ; import java . util . List ; import java . util . Map ; import java . util . Set ; import com . asakusafw . utils . java . model . syntax . ArrayType ; import com . asakusafw . utils . java . model . syntax . BasicType ; import com . asakusafw . utils . java . model . syntax . ImportDeclaration ; import com . asakusafw . utils . java . model . syntax . ImportKind ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . Name ; import com . asakusafw . utils . java . model . syntax . NamedType ; import com . asakusafw . utils . java . model . syntax . PackageDeclaration ; import com . asakusafw . utils . java . model . syntax . ParameterizedType ; import com . asakusafw . utils . java . model . syntax . QualifiedName ; import com . asakusafw . utils . java . model . syntax . QualifiedType ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . StrictVisitor ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . Wildcard ; import com . asakusafw . utils . java . model . syntax . WildcardBoundKind ; public class ImportBuilder { private final PackageDeclaration packageDecl ; private final Resolver resolver ; public ImportBuilder ( ModelFactory factory , PackageDeclaration packageDecl , Strategy strategy ) { if ( factory == null ) { throw new IllegalArgumentException ( "" ) ; } if ( strategy == null ) { throw new IllegalArgumentException ( "" ) ; } this . resolver = new Resolver ( factory , strategy , packageDecl ) ; this . packageDecl = packageDecl ; } public Type resolvePackageMember ( Name name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } Type type ; if ( name . getModelKind ( ) == ModelKind . SIMPLE_NAME ) { type = reservePackageMember ( ( SimpleName ) name ) ; } else { type = reservePackageMember ( ( QualifiedName ) name ) ; } return resolve ( type ) ; } private Type reservePackageMember ( SimpleName name ) { assert name != null ; if ( packageDecl == null ) { return resolver . factory . newNamedType ( name ) ; } else { Name qualified = Models . append ( resolver . factory , packageDecl . getName ( ) , name ) ; return resolver . factory . newNamedType ( qualified ) ; } } private Type reservePackageMember ( QualifiedName name ) { assert name != null ; List < SimpleName > list = name . toNameList ( ) ; Name current ; Iterator < SimpleName > iter = list . iterator ( ) ; assert iter . hasNext ( ) ; SimpleName first = iter . next ( ) ; if ( packageDecl == null ) { current = first ; } else { current = resolver . factory . newQualifiedName ( packageDecl . getName ( ) , first ) ; } resolver . reserved . put ( first , current ) ; while ( iter . hasNext ( ) ) { SimpleName next = iter . next ( ) ; current = resolver . factory . newQualifiedName ( current , next ) ; resolver . reserved . put ( next , current ) ; } return resolver . factory . newNamedType ( current ) ; } public Type resolve ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } return type . accept ( resolver , null ) ; } public Type toType ( Name name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } return resolve ( resolver . factory . newNamedType ( name ) ) ; } public Type toType ( java . lang . reflect . Type type ) { if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } return resolve ( Models . toType ( resolver . factory , type ) ) ; } public List < ImportDeclaration > toImportDeclarations ( ) { ModelFactory f = resolver . factory ; Map < QualifiedName , SimpleName > imported = resolver . imported ; Set < Name > implicit = createImplicit ( ) ; List < ImportDeclaration > results = new ArrayList < ImportDeclaration > ( ) ; for ( QualifiedName name : imported . keySet ( ) ) { if ( implicit . contains ( name . getQualifier ( ) ) ) { continue ; } results . add ( f . newImportDeclaration ( ImportKind . SINGLE_TYPE , name ) ) ; } Collections . sort ( results , ImportComparator . INSTANCE ) ; return results ; } public PackageDeclaration getPackageDeclaration ( ) { return this . packageDecl ; } private Set < Name > createImplicit ( ) { Set < Name > implicit = new HashSet < Name > ( ) ; implicit . add ( Models . toName ( resolver . factory , "java.lang" ) ) ; if ( packageDecl != null ) { implicit . add ( packageDecl . getName ( ) ) ; } return implicit ; } private enum ImportComparator implements Comparator < ImportDeclaration > { INSTANCE , ; @ Override public int compare ( ImportDeclaration o1 , ImportDeclaration o2 ) { if ( o1 . getImportKind ( ) != o2 . getImportKind ( ) ) { return o1 . getImportKind ( ) . compareTo ( o2 . getImportKind ( ) ) ; } return o1 . getName ( ) . toNameString ( ) . compareTo ( o2 . getName ( ) . toNameString ( ) ) ; } } private static class Resolver extends StrictVisitor < Type , Void , NoThrow > { final Strategy strategy ; final Map < QualifiedName , SimpleName > imported ; final Map < SimpleName , Name > reserved ; private Set < Name > knownPackageNames = new HashSet < Name > ( ) ; final ModelFactory factory ; Resolver ( ModelFactory factory , Strategy strategy , PackageDeclaration packageDecl ) { this . factory = factory ; this . strategy = strategy ; this . knownPackageNames = new HashSet < Name > ( ) ; if ( packageDecl != null ) { Name current = packageDecl . getName ( ) ; while ( current instanceof QualifiedName ) { this . knownPackageNames . add ( current ) ; current = ( ( QualifiedName ) current ) . getQualifier ( ) ; } this . knownPackageNames . add ( current ) ; } this . imported = new HashMap < QualifiedName , SimpleName > ( ) ; this . reserved = new HashMap < SimpleName , Name > ( ) ; } @ Override public Type visitArrayType ( ArrayType elem , Void _ ) { Type component = elem . getComponentType ( ) . accept ( this , _ ) ; if ( elem . getComponentType ( ) . equals ( component ) ) { return elem ; } return factory . newArrayType ( component ) ; } @ Override public Type visitBasicType ( BasicType elem , Void _ ) { return elem ; } @ Override public Type visitNamedType ( NamedType elem , Void _ ) { Name name = elem . getName ( ) ; if ( name . getModelKind ( ) == ModelKind . SIMPLE_NAME ) { reserved . put ( ( SimpleName ) name , elem . getName ( ) ) ; return elem ; } LinkedList < SimpleName > segments = new LinkedList < SimpleName > ( ) ; name = normalize ( name , segments ) ; if ( name . getModelKind ( ) == ModelKind . SIMPLE_NAME ) { reserved . put ( ( SimpleName ) name , elem . getName ( ) ) ; return elem ; } QualifiedName qname = ( QualifiedName ) name ; | |
771 | <s> package com . asakusafw . windgate . bootstrap ; import static org . hamcrest . CoreMatchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . FileNotFoundException ; import java . io . FileOutputStream ; import java . io . IOException ; import java . net . URI ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . Properties ; import org . junit . Assume ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; public class CommandLineUtilTest { @ Rule public TemporaryFolder folder = new TemporaryFolder ( ) ; @ Test public void loadProperties_local ( ) throws Exception { Properties p = new Properties ( ) ; p . setProperty ( "hello" , "world!" ) ; File file = store ( p ) ; Properties loaded = CommandLineUtil . loadProperties ( new URI ( file . toURI ( ) . getPath ( ) ) , null ) ; assertThat ( loaded , is ( p ) ) ; } @ Test public void loadProperties_uri ( ) throws Exception { Properties p = new Properties ( ) ; p . setProperty ( "hello" , "world!" ) ; File file = store ( p ) ; Properties loaded = CommandLineUtil . loadProperties ( file . toURI ( ) , null ) ; assertThat ( loaded , is ( p ) ) ; } @ Test public void loadProperties_classpath ( ) throws Exception { String className = getClass ( ) . getName ( ) ; String packageName = className . substring ( 0 , className . lastIndexOf ( '.' ) ) ; URI uri = new URI ( "classpath:" + packageName . replace ( '.' , '/' ) + "" ) ; Properties loaded = CommandLineUtil . loadProperties ( uri , getClass ( ) . getClassLoader ( ) ) ; Properties p = new Properties ( ) ; p . setProperty ( "hello" , "world!" ) ; assertThat ( loaded , is ( p ) ) ; } @ Test ( expected = IOException . class ) public void loadProperties_classpath_missing ( ) throws Exception { URI uri = new URI ( "" ) ; CommandLineUtil . loadProperties ( uri , null ) ; } @ Test public void parseFileList ( ) throws Exception { File a = folder . newFile ( "a.properties" ) ; File b = folder . newFile ( "c.properties" ) ; File c = folder . newFile ( "b.properties" ) ; StringBuilder buf = new StringBuilder ( ) ; buf . append ( a ) ; buf . append ( File . pathSeparatorChar ) ; buf . append ( b ) ; buf . append ( File . pathSeparatorChar ) ; buf . append ( c ) ; List < File > result = canonicalize ( CommandLineUtil . parseFileList ( buf . toString ( ) ) ) ; assertThat ( result , is ( Arrays . asList ( a , b , c ) ) ) ; } @ Test public void parseFileList_null ( ) { List < File > result = canonicalize ( CommandLineUtil . parseFileList ( null ) ) ; assertThat ( result , is ( Arrays . < File > asList ( ) ) ) ; } @ Test public void parseFileList_empty ( ) { List < File > result = canonicalize ( CommandLineUtil . parseFileList ( "" ) ) ; assertThat ( result , is ( Arrays . < File > asList ( ) ) ) ; } private List < File > canonicalize ( List < File > list ) { List < File > results = new ArrayList < File > ( ) ; for ( File f : list ) { try { results . add ( f . getCanonicalFile ( ) ) ; } catch ( IOException e ) { throw new AssertionError ( e ) ; } } return results ; } @ Test public void buildPluginLoader ( ) throws Exception { File cp1 = folder . newFolder ( "cp1" ) ; File cp2 = folder . newFolder ( "cp2" ) ; new File ( cp1 , "a" ) . createNewFile ( ) ; new File ( cp2 , "b" ) . createNewFile ( ) ; ClassLoader cl = CommandLineUtil . buildPluginLoader ( getClass ( ) . getClassLoader ( ) , Arrays . asList ( cp1 , cp2 ) ) ; assertThat ( cl . getResource ( "a" ) , is ( not ( nullValue ( ) ) ) ) ; assertThat ( cl . getResource ( "b" ) , is ( not ( nullValue ( ) ) ) ) ; assertThat ( cl . getResource ( "c" ) , is ( nullValue ( ) ) ) ; } @ Test public void buildPluginLoader_missing_path ( ) throws Exception { File cp1 = folder . newFolder ( "cp1" ) ; File cp2 = folder . newFolder ( "cp2" ) ; new File ( cp1 , "a" ) . createNewFile ( ) ; Assume . assumeTrue ( cp2 . delete ( ) ) ; ClassLoader cl = CommandLineUtil . buildPluginLoader ( getClass ( ) . getClassLoader ( ) , Arrays . asList ( cp1 , cp2 ) ) ; assertThat ( cl . getResource ( "a" ) , is ( not ( nullValue ( ) ) ) ) ; assertThat ( cl . getResource ( "b" ) , is ( nullValue ( ) ) ) ; assertThat ( cl . getResource ( "c" ) | |
772 | <s> package com . asakusafw . testdriver . directio ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . Scanner ; import org . apache . hadoop . io . Text ; import com . asakusafw . runtime . directio . BinaryStreamFormat ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . ModelOutput ; public class MockStreamFormat extends BinaryStreamFormat < | |
773 | <s> package com . pogofish . jadt . sink ; import static org . junit . Assert . assertEquals ; import java . io . BufferedReader ; import java . io . BufferedWriter ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileOutputStream ; import java . io . IOException ; import java . io . InputStreamReader ; import java . io . OutputStreamWriter ; import org . junit . Test ; public class FileSinkTest { @ Test public void testMissingFile ( ) throws IOException { final File temp = File . createTempFile ( "testFactory" , "java" ) ; try { temp . delete ( ) ; final FileSink sink = new FileSink ( temp . getAbsolutePath ( ) ) ; try { sink . write ( "hello" ) ; } finally { sink . close ( ) ; } final BufferedReader reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( temp ) , "UTF-8" ) ) ; final String contents = reader . readLine ( ) ; assertEquals ( "hello" , contents ) ; } finally { if ( temp . exists ( ) ) { temp . delete ( ) ; } } } @ Test public void testExistingFile ( ) throws IOException { final File temp = File . createTempFile ( "testFactory" , "java" ) ; try { | |
774 | <s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . CacheFiles ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . RecordParser ; @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public final class CacheFilesModelInput implements ModelInput < CacheFiles > { private final RecordParser parser ; public CacheFilesModelInput ( RecordParser parser ) { if ( parser == null ) { throw new IllegalArgumentException ( | |
775 | <s> package org . rubypeople . rdt . refactoring . tests ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collection ; import java . util . StringTokenizer ; import org . jruby . ast . Node ; import org . rubypeople . rdt . refactoring . util . FileHelper ; public class MultiFileTestData extends FilePropertyData { private String testName ; private String sourceSuffix ; private String resultSuffix ; public MultiFileTestData ( String testName ) throws FileNotFoundException | |
776 | <s> package org . oddjob . monitor . contexts ; import junit . framework . TestCase ; import org . oddjob . Oddjob ; import org . oddjob . monitor . context . ContextInitialiser ; import org . oddjob . monitor . context . ExplorerContext ; import org . oddjob . monitor . model . ExplorerContextImpl ; import org . oddjob . monitor . model . MockExplorerModel ; import org . oddjob . util . ThreadManager ; public class ContextInitializerTest extends TestCase { class OurInitialiser implements ContextInitialiser { public void initialise ( ExplorerContext context ) { if ( context . getParent ( ) == null ) { context . setValue ( "fruit" , "apple" ) ; } else { context . setValue ( "fruit" , "orange" ) ; } } } class OurModel extends MockExplorerModel { @ Override public Oddjob getOddjob ( ) { return new Oddjob ( ) ; } @ Override public ThreadManager getThreadManager ( ) { return null ; } @ Override public ContextInitialiser [ ] getContextInitialisers ( ) { return new ContextInitialiser [ ] { new OurInitialiser ( ) } ; } } public void testInFirstLevel ( ) { ExplorerContext context = | |
777 | <s> package org . rubypeople . rdt . internal . ui . viewsupport ; import org . eclipse . swt . widgets . Control ; import org . eclipse . jface . util . Assert ; import org . eclipse . jface . viewers . StructuredViewer ; import org . eclipse . core . resources . IResourceChangeEvent ; import org . eclipse . core . resources . IResourceChangeListener ; import org . eclipse . core . resources . IResourceDelta ; public class FilterUpdater implements IResourceChangeListener { private StructuredViewer fViewer ; public FilterUpdater ( StructuredViewer viewer ) { Assert . isNotNull ( viewer ) ; fViewer = viewer ; } public void resourceChanged ( IResourceChangeEvent event ) { IResourceDelta delta = event . getDelta ( ) ; if ( delta == null ) return ; IResourceDelta [ ] projDeltas = delta . getAffectedChildren ( IResourceDelta . CHANGED ) ; for ( int i = 0 ; i < projDeltas . length ; i ++ ) { IResourceDelta pDelta = projDeltas [ i ] ; if ( ( pDelta | |
778 | <s> package net . bioclipse . opentox . business ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IConfigurationElement ; import org . eclipse . core . runtime . IExecutableExtension ; import org . eclipse . core . runtime . IExecutableExtensionFactory ; import net . bioclipse . opentox . Activator ; public class OpentoxManagerFactory | |
779 | <s> package org . rubypeople . rdt . internal . launching ; public class LibraryInfo { private String fVersion ; private String [ ] fBootpath ; public LibraryInfo ( String version , String [ ] bootpath ) { | |
780 | <s> package org . rubypeople . rdt . refactoring . offsetprovider ; import org . jruby . ast . DefnNode ; import org . jruby . ast . Node ; import org . rubypeople . rdt . refactoring . core . NodeProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . ClassNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . PartialClassNodeWrapper ; public class AfterLastMethodInClassOffsetProvider extends OffsetProvider { private Node insertAfterNode ; public AfterLastMethodInClassOffsetProvider ( ClassNodeWrapper classNode , String document ) { this ( classNode . getFirstPartialClassNode ( ) , document ) ; } public AfterLastMethodInClassOffsetProvider ( PartialClassNodeWrapper classPart , String document ) { super ( document ) ; Node contentNode = classPart . getClassBodyNode ( ) ; if ( contentNode == null ) { insertAfterNode = classPart . getDeclarationEndNode ( ) ; } else { insertAfterNode = NodeProvider . getLastChildNode ( contentNode | |
781 | <s> package org . rubypeople . rdt . internal . debug . core . parsing ; import org . rubypeople . rdt . debug . core . RdtDebugCorePlugin ; import org . rubypeople . rdt . internal . debug . core . model . RubyProcessingException ; import org . xmlpull . v1 . XmlPullParser ; public class EvalReader extends XmlStreamReader { private String exceptionType ; private String exceptionMessage ; private String name ; private String value ; public EvalReader ( XmlPullParser xpp ) { super ( xpp ) ; } public EvalReader ( AbstractReadStrategy readStrategy ) { super ( readStrategy ) ; } @ Override protected boolean processStartElement ( XmlPullParser xpp ) throws XmlStreamReaderException { boolean result = false ; if ( xpp . getName ( ) . equals ( "" ) ) { exceptionType = xpp . getAttributeValue ( "" , "type" ) ; exceptionMessage = xpp . getAttributeValue ( "" , "message" ) ; result = true ; } else if ( xpp . getName ( ) . equals ( "eval" ) ) { name = xpp . getAttributeValue ( "" , "name" ) ; value = xpp . getAttributeValue ( "" , "value" ) ; result = true ; } return result ; } public String readEvalResult ( ) throws RubyProcessingException { try { this . read ( ) ; } catch ( Exception ex ) { RdtDebugCorePlugin . log ( ex ) ; return null ; } | |
782 | <s> package com . asakusafw . dmdl . java . emitter ; import java . io . IOException ; import java . util . Collections ; import java . util . Comparator ; import java . util . List ; import java . util . ServiceLoader ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . dmdl . java . spi . JavaDataModelDriver ; import com . asakusafw . dmdl . semantics . ModelDeclaration ; import com . asakusafw . dmdl . semantics . PropertyDeclaration ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . java . model . syntax . Annotation ; import com . asakusafw . utils . java . model . syntax . FieldDeclaration ; import com . asakusafw . utils . java . model . syntax . MethodDeclaration ; import com . asakusafw . utils . java . model . syntax . Type ; public class CompositeDataModelDriver extends JavaDataModelDriver { static final Logger LOG = LoggerFactory . getLogger ( CompositeDataModelDriver . class ) ; private final List < JavaDataModelDriver > drivers ; public CompositeDataModelDriver ( ClassLoader serviceClassLoader ) { if ( serviceClassLoader == null ) { throw new IllegalArgumentException ( "" ) ; } this . drivers = Lists . freeze ( loadSpi ( serviceClassLoader ) ) ; } private List < JavaDataModelDriver > loadSpi ( ClassLoader serviceClassLoader ) { assert serviceClassLoader != null ; List < JavaDataModelDriver > results = Lists . create ( ) ; ServiceLoader < JavaDataModelDriver > loader = ServiceLoader . load ( JavaDataModelDriver . class , serviceClassLoader ) ; for ( JavaDataModelDriver driver : loader ) { LOG . debug ( "" , driver . getClass ( ) . getName ( ) ) ; results . add ( driver ) ; } Collections . sort ( results , new Comparator < Object > ( ) { @ Override public int compare ( Object o1 , Object o2 ) { assert o2 != null ; int diff = o1 . getClass ( ) . getSimpleName ( ) . compareTo ( o2 . getClass ( ) . getSimpleName ( ) ) ; if ( diff != 0 ) { return diff ; } return o1 . getClass ( ) . getName ( ) . compareTo ( o2 . getClass ( ) . getName ( ) ) ; } } ) ; return results ; } public CompositeDataModelDriver ( List < ? extends JavaDataModelDriver > drivers ) { if ( drivers == null ) { throw new IllegalArgumentException ( "" ) ; } this . drivers = Lists . freeze ( drivers ) ; } public List < JavaDataModelDriver > getDrivers ( ) { return drivers ; } @ Override public void generateResources ( EmitContext context , ModelDeclaration model ) | |
783 | <s> package com . pogofish . jadt . emitter ; import com . pogofish . jadt . ast . Doc ; import com . pogofish . jadt . sink . Sink ; import com . pogofish . jadt . sink . SinkFactory ; public class DummyDocEmitter implements DocEmitter { private final Doc testDoc ; private final String className ; public DummyDocEmitter ( Doc testDoc , String className ) { super ( ) ; this . testDoc = testDoc ; this . className = className ; } @ Override | |
784 | <s> package org . rubypeople . rdt . internal . debug . ui ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . preference . PreferenceConverter ; import org . eclipse . jface . resource . JFaceResources ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITypedRegion ; import org . eclipse . jface . text . contentassist . IContentAssistant ; import org . eclipse . jface . text . source . IVerticalRuler ; import org . eclipse . jface . text . source . SourceViewer ; import org . eclipse . jface . text . source . SourceViewerConfiguration ; import org . eclipse . jface . util . IPropertyChangeListener ; import org . eclipse . jface . util . PropertyChangeEvent ; import org . eclipse . swt . custom . BidiSegmentEvent ; import org . eclipse . swt . custom . BidiSegmentListener ; import org . eclipse . swt . custom . StyledText ; import org . eclipse . swt . graphics . Color ; import org . eclipse . swt . graphics . Font ; import org . eclipse . swt . graphics . FontData ; import org . eclipse . swt . graphics . Point ; import org . eclipse . swt . graphics . RGB ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Display ; import org . eclipse . ui . texteditor . AbstractTextEditor ; import org . rubypeople . rdt . internal . debug . ui . display . DisplayViewerConfiguration ; import org . rubypeople . rdt . internal . ui . text . IRubyPartitions ; public class RubyDebugSourceViewer extends SourceViewer implements IPropertyChangeListener { private Font fFont ; private Color fBackgroundColor ; private Color fForegroundColor ; private IPreferenceStore fStore ; private DisplayViewerConfiguration fConfiguration ; public RubyDebugSourceViewer ( Composite parent , IVerticalRuler ruler , int styles ) { super ( parent , ruler , styles ) ; StyledText text = this . getTextWidget ( ) ; text . addBidiSegmentListener ( new BidiSegmentListener ( ) { public void lineGetSegments ( BidiSegmentEvent event ) { try { event . segments = getBidiLineSegments ( event . lineOffset ) ; } catch ( BadLocationException x ) { } } } ) ; } private void updateViewerFont ( ) { IPreferenceStore store = getPreferenceStore ( ) ; if ( store != null ) { FontData data = null ; if ( store . contains ( JFaceResources . TEXT_FONT ) && ! store . isDefault ( JFaceResources . TEXT_FONT ) ) { data = PreferenceConverter . getFontData ( store , JFaceResources . TEXT_FONT ) ; } else { data = PreferenceConverter . getDefaultFontData ( store , JFaceResources . TEXT_FONT ) ; } if ( data != null ) { Font font = new Font ( getTextWidget ( ) . getDisplay ( ) , data ) ; applyFont ( font ) ; if ( getFont ( ) != null ) { getFont ( ) . dispose ( ) ; } setFont ( font ) ; return ; } } applyFont ( JFaceResources . getTextFont ( ) ) ; } private void setFont ( Font font ) { fFont = font ; } private Font getFont ( ) { return fFont ; } private void applyFont ( Font font ) { IDocument doc = getDocument ( ) ; if ( doc != null && doc . getLength ( ) > 0 ) { Point selection = getSelectedRange ( ) ; int topIndex = getTopIndex ( ) ; StyledText styledText = getTextWidget ( ) ; styledText . setRedraw ( false ) ; styledText . setFont ( font ) ; setSelectedRange ( selection . x , selection . y ) ; setTopIndex ( topIndex ) ; styledText . setRedraw ( true ) ; } else { getTextWidget ( ) . setFont ( font ) ; } } public void updateViewerColors ( ) { IPreferenceStore store = getPreferenceStore ( ) ; if ( store != null ) { StyledText styledText = getTextWidget ( ) ; Color color = store . getBoolean ( AbstractTextEditor . PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT ) ? null : createColor ( store , AbstractTextEditor . PREFERENCE_COLOR_FOREGROUND , styledText . getDisplay ( ) ) ; styledText . setForeground ( color ) ; if ( getForegroundColor ( ) != null ) { getForegroundColor ( ) . dispose ( ) ; } setForegroundColor ( color ) ; color = store . getBoolean ( AbstractTextEditor . PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT ) ? null : createColor ( store , AbstractTextEditor . PREFERENCE_COLOR_BACKGROUND , styledText . getDisplay ( ) ) ; styledText . setBackground ( color ) ; if ( getBackgroundColor ( ) != null ) { getBackgroundColor ( ) . dispose ( ) ; } setBackgroundColor ( color ) ; } } private Color createColor ( IPreferenceStore store , String key , Display display ) { RGB rgb = null ; if ( store . contains ( key ) ) { if ( store . isDefault ( key ) ) { rgb = PreferenceConverter . getDefaultColor ( store , key ) ; } else { rgb = PreferenceConverter . getColor ( store , key ) ; } if ( rgb != null ) { return new Color ( | |
785 | <s> package com . asakusafw . runtime . directio . hadoop ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import org . apache . hadoop . conf . Configuration ; import org . apache . hadoop . conf . Configured ; import org . apache . hadoop . fs . FileSystem ; import org . apache . hadoop . fs . Path ; import com . asakusafw . runtime . directio . Counter ; import com . asakusafw . runtime . directio . FragmentableDataFormat ; import | |
786 | <s> package com . asakusafw . vocabulary . model ; import java . lang . annotation . Documented ; import java . lang . annotation . ElementType ; import java . lang . annotation . Retention ; import java . lang . annotation . RetentionPolicy ; import java . lang . annotation . Target ; @ Deprecated @ Target ( ElementType . TYPE ) @ Retention ( RetentionPolicy . RUNTIME ) @ Documented public @ interface SummarizedModel { ModelRef from ( ) ; interface Interface | |
787 | <s> package com . asakusafw . dmdl . thundergate . view . model ; import java . text . MessageFormat ; import java . util . List ; import java . util . Set ; import com . asakusafw . dmdl . thundergate . model . Aggregator ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Sets ; public class CreateView { public final Name name ; public final List < Select > selectList ; public final From from ; public final List < Name > groupBy ; public CreateView ( Name name , List < Select > selectList , From from , List < Name > groupBy ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } if ( selectList == null ) { throw new IllegalArgumentException ( "" ) ; } if ( from == null ) { throw new IllegalArgumentException ( "" ) ; } if ( groupBy == null ) { throw new IllegalArgumentException ( "" ) ; } this . name = name ; this . selectList = Lists . freeze ( selectList ) ; this . from = from ; this . groupBy = Lists . freeze ( groupBy ) ; } public CreateView . Kind getKind ( ) { boolean join = ( from . join != null ) ; boolean summarize = ( groupBy . isEmpty ( ) == false ) ; if ( summarize == false ) { for ( Select select : selectList ) { if ( select . aggregator != Aggregator . IDENT ) { summarize = true ; break ; } } } if ( join && summarize == false ) { return Kind . JOINED ; } if ( summarize && join == false ) { return Kind . SUMMARIZED ; } return Kind . UNKNOWN ; } public Set < Name > getDependencies ( ) { Set < Name > results = Sets . create ( ) ; results . add ( from . table ) ; if ( from . join != null ) { results . add ( from . join . table ) ; } return results ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + from . hashCode ( ) ; result = prime * result | |
788 | <s> package net . sf . sveditor . ui . text ; import java . util . Vector ; public class StringMatcher { protected String fPattern ; protected int fLength ; protected boolean fIgnoreWildCards ; protected boolean fIgnoreCase ; protected boolean fHasLeadingStar ; protected boolean fHasTrailingStar ; protected String fSegments [ ] ; protected int fBound = 0 ; protected static final char fSingleWildCard = ' ' ; public static class Position { int start ; int end ; public Position ( int start , int end ) { this . start = start ; this . end = end ; } public int getStart ( ) { return start ; } public int getEnd ( ) { return end ; } } public StringMatcher ( String pattern , boolean ignoreCase , boolean ignoreWildCards ) { if ( pattern == null ) throw new IllegalArgumentException ( ) ; fIgnoreCase = ignoreCase ; fIgnoreWildCards = ignoreWildCards ; fPattern = pattern ; fLength = pattern . length ( ) ; if ( fIgnoreWildCards ) { parseNoWildCards ( ) ; } else { parseWildCards ( ) ; } } public StringMatcher . Position find ( String text , int start , int end ) { if ( text == null ) throw new IllegalArgumentException ( ) ; int tlen = text . length ( ) ; if ( start < 0 ) start = 0 ; if ( end > tlen ) end = tlen ; if ( end < 0 || start >= end ) return null ; if ( fLength == 0 ) return new Position ( start , start ) ; if ( fIgnoreWildCards ) { int x = posIn ( text , start , end ) ; if ( x < 0 ) return null ; return new Position ( x , x + fLength ) ; } int segCount = fSegments . length ; if ( segCount == 0 ) return new Position ( start , end ) ; int curPos = start ; int matchStart = - 1 ; int i ; for ( i = 0 ; i < segCount && curPos < end ; ++ i ) { String current = fSegments [ i ] ; int nextMatch = regExpPosIn ( text , curPos , end , current ) ; if ( nextMatch < 0 ) return null ; if ( i == 0 ) matchStart = nextMatch ; curPos = nextMatch + current . length ( ) ; } if ( i < segCount ) return null ; return new Position ( matchStart , curPos ) ; } public boolean match ( String text ) { return match ( text , 0 , text . length ( ) ) ; } public boolean match ( String text , int start , int end ) { if ( null == text ) throw new IllegalArgumentException ( ) ; if ( start > end ) return false ; if ( fIgnoreWildCards ) return ( end - start == fLength ) && fPattern . regionMatches ( fIgnoreCase , 0 , text , start , fLength ) ; int segCount = fSegments . length ; if ( segCount == 0 && ( fHasLeadingStar || fHasTrailingStar ) ) return true ; if ( start == end ) return fLength == 0 ; if ( fLength == 0 ) return start == end ; int tlen = text . length ( ) ; if ( start < 0 ) start = 0 ; if ( end > tlen ) end = tlen ; int tCurPos = start ; int bound = end - fBound ; if ( bound < 0 ) return false ; int i = 0 ; String current = fSegments [ i ] ; int segLength = current . length ( ) ; if ( ! fHasLeadingStar ) { if ( ! regExpRegionMatches ( text , start , current , 0 , segLength ) ) { return false ; } else { ++ i ; tCurPos = tCurPos + segLength ; } } if ( ( fSegments . length == 1 ) && ( ! fHasLeadingStar ) && ( ! fHasTrailingStar ) ) { return tCurPos == end ; } while ( i < segCount ) { current = fSegments [ i ] ; int currentMatch ; int k = current . indexOf ( fSingleWildCard ) ; if ( k < 0 ) { currentMatch = textPosIn ( text , tCurPos , end , current ) ; if ( currentMatch < 0 ) return false ; } else { currentMatch = regExpPosIn ( text , tCurPos , end , current ) ; if ( currentMatch < 0 ) return false ; } tCurPos = currentMatch + current . length ( ) ; i ++ ; } if ( ! fHasTrailingStar && tCurPos != end ) { int clen = current . length ( ) ; return regExpRegionMatches ( text , end - clen , current , 0 , clen ) ; } return i == segCount ; } private void parseNoWildCards ( ) { fSegments = new String [ 1 ] ; fSegments [ 0 ] = fPattern ; fBound = fLength ; } private void parseWildCards ( ) { if ( fPattern . startsWith ( "*" ) ) fHasLeadingStar = true ; if ( fPattern . endsWith ( "*" ) ) { if ( fLength > 1 && fPattern . charAt ( fLength - 2 ) != '\\' ) { fHasTrailingStar = true ; } } Vector < String > temp = new Vector < String > ( ) ; int pos = 0 ; StringBuffer buf = new StringBuffer ( ) ; while ( pos < fLength ) { char c = fPattern . charAt ( pos ++ ) ; switch ( c ) { case '\\' : if ( pos >= fLength ) { buf . append ( c ) ; } else { char next = fPattern . charAt ( pos ++ ) ; if ( next == '*' || next == '?' || next == '\\' ) { buf . append ( next ) ; } else { buf . append ( c ) ; buf . append ( next ) ; } } break ; case '*' : if ( buf . length ( ) > 0 ) { temp . addElement ( buf . toString ( ) ) ; fBound += buf . length ( ) ; buf . setLength ( 0 ) ; } break ; case | |
789 | <s> package com . asakusafw . compiler . flow ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; public class FlowCompilerConfiguration { private ModelFactory factory ; private Packager packager ; private FlowElementProcessor . Repository processors ; private DataClassRepository dataClasses ; private ExternalIoDescriptionProcessor . Repository externals ; private FlowGraphRewriter . Repository graphRewriters ; private String batchId ; private String flowId ; private String rootPackageName ; private Location rootLocation ; private ClassLoader serviceClassLoader ; private FlowCompilerOptions options ; private String buildId ; public ModelFactory getFactory ( ) { return factory ; } public void setFactory ( ModelFactory factory ) { this . factory = factory ; } public Packager getPackager ( ) { return packager ; } public void setPackager ( Packager packager ) { this . packager = packager ; } public FlowElementProcessor . Repository getProcessors ( ) { return processors ; } public void setProcessors ( FlowElementProcessor . Repository processors ) { this . processors = processors ; } public DataClassRepository getDataClasses ( ) { return dataClasses ; } public void setDataClasses ( DataClassRepository dataClasses ) { this . dataClasses = dataClasses ; } public ExternalIoDescriptionProcessor . Repository getExternals ( ) { return externals ; } public void setExternals ( ExternalIoDescriptionProcessor . Repository externals ) { this . externals = externals ; } public FlowGraphRewriter . Repository getGraphRewriters ( ) { return graphRewriters ; } public void setGraphRewriters ( FlowGraphRewriter . Repository graphRewriters ) { this . graphRewriters = graphRewriters ; } public String getBatchId ( ) { return batchId ; } public void setBatchId ( String batchId | |
790 | <s> package com . asakusafw . testdriver . excel ; import org . apache . poi . ss . usermodel . CellStyle ; import org . apache . poi . ss . usermodel . CreationHelper ; import org . apache . poi . ss . usermodel . DataFormat ; import org . apache . poi . ss . usermodel . Font ; import org . apache . poi . ss . usermodel . IndexedColors ; import org . apache . poi . ss . usermodel . Workbook ; class WorkbookInfo { final Workbook workbook ; private final CellStyle commonStyle ; final CellStyle titleStyle ; final CellStyle dataStyle ; final CellStyle dateDataStyle ; final CellStyle timeDataStyle ; final CellStyle datetimeDataStyle ; public WorkbookInfo ( Workbook workbook ) { if ( workbook == null ) { throw new IllegalArgumentException ( "" ) ; } this . workbook = workbook ; Font font = workbook . createFont ( ) ; commonStyle = workbook . createCellStyle ( ) ; commonStyle . setFont ( font ) ; commonStyle . setBorderTop ( CellStyle . BORDER_THIN ) ; | |
791 | <s> package org . rubypeople . rdt . internal . core ; public class RubyFieldElementInfo extends MemberElementInfo { | |
792 | <s> package com . asakusafw . dmdl . model ; import com . asakusafw . dmdl . Region ; public class AstSummarize extends AbstractAstNode implements AstTerm < AstSummarize > { private final Region region ; public final AstModelReference reference ; public final AstModelFolding folding ; public final AstGrouping grouping ; public AstSummarize ( Region region , AstModelReference reference , AstModelFolding folding , AstGrouping grouping ) { if ( reference == null ) { throw new IllegalArgumentException ( "" ) ; } if ( folding == null ) { throw new IllegalArgumentException ( "" ) ; } this . region = region ; this . reference = reference ; this . folding = folding ; this | |
793 | <s> package org . oddjob . jmx ; import javax . swing . ImageIcon ; import junit . framework . TestCase ; import org . oddjob . Iconic ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . Resetable ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . images . IconEvent ; import org . oddjob . images . IconHelper ; import org . oddjob . images . IconListener ; public class IconicTest extends TestCase { class Result implements IconListener { IconEvent event ; public void iconEvent ( IconEvent e ) { this . event = e ; synchronized ( this ) { notifyAll ( ) ; } } } public | |
794 | <s> package com . asakusafw . dmdl . windgate . csv . driver ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . nio . charset . Charset ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . dmdl . java . emitter . EmitContext ; import com . asakusafw . dmdl . java . spi . JavaDataModelDriver ; import com . asakusafw . dmdl . semantics . ModelDeclaration ; import com . asakusafw . dmdl . semantics . PropertyDeclaration ; import com . asakusafw . dmdl . semantics . Type ; import com . asakusafw . dmdl . semantics . type . BasicType ; import com . asakusafw . dmdl . windgate . csv . driver . CsvFieldTrait . Kind ; import com . asakusafw . dmdl . windgate . csv . driver . CsvSupportTrait . Configuration ; import com . asakusafw . runtime . io . csv . CsvConfiguration ; import com . asakusafw . runtime . io . csv . CsvEmitter ; import com . asakusafw . runtime . io . csv . CsvParser ; import com . asakusafw . runtime . value . StringOption ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . java . model . syntax . ClassDeclaration ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ExpressionStatement ; import com . asakusafw . utils . java . model . syntax . FieldDeclaration ; import com . asakusafw . utils . java . model . syntax . FormalParameterDeclaration ; import com . asakusafw . utils . java . model . syntax . InfixOperator ; import com . asakusafw . utils . java . model . syntax . MethodDeclaration ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . Name ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Statement ; import com . asakusafw . utils . java . model . syntax . TypeBodyDeclaration ; import com . asakusafw . utils . java . model . syntax . TypeParameterDeclaration ; import com . asakusafw . utils . java . model . syntax . WildcardBoundKind ; import com . asakusafw . utils . java . model . util . AttributeBuilder ; import com . asakusafw . utils . java . model . util . ExpressionBuilder ; import com . asakusafw . utils . java . model . util . JavadocBuilder ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . utils . java . model . util . TypeBuilder ; import com . asakusafw . windgate . core . vocabulary . DataModelStreamSupport ; import com . asakusafw . windgate . core . vocabulary . DataModelStreamSupport . DataModelReader ; import com . asakusafw . windgate . core . vocabulary . DataModelStreamSupport . DataModelWriter ; public class CsvSupportEmitter extends JavaDataModelDriver { static final Logger LOG = LoggerFactory . getLogger ( CsvSupportEmitter . class ) ; public static final String CATEGORY_STREAM = "csv" ; @ Override public void generateResources ( EmitContext context , ModelDeclaration model ) throws IOException { if ( isTarget ( model ) == false ) { return ; } checkPropertyType ( model ) ; Name supportName = generateSupport ( context , model ) ; generateImporter ( context , model , supportName ) ; generateExporter ( context , model , supportName ) ; } private Name generateSupport ( EmitContext context , ModelDeclaration model ) throws IOException { assert context != null ; assert model != null ; EmitContext next = new EmitContext ( context . getSemantics ( ) , context . getConfiguration ( ) , model , CATEGORY_STREAM , "" ) ; LOG . debug ( "" , context . getQualifiedTypeName ( ) . toNameString ( ) ) ; SupportGenerator . emit ( next , model , model . getTrait ( CsvSupportTrait . class ) . getConfiguration ( ) ) ; LOG . debug ( "" , context . getQualifiedTypeName ( ) . toNameString ( ) , next . getQualifiedTypeName ( ) . toNameString ( ) ) ; return next . getQualifiedTypeName ( ) ; } private Name generateImporter ( EmitContext context , ModelDeclaration model , Name supportName ) throws IOException { assert context != null ; assert model != null ; assert supportName != null ; EmitContext next = new EmitContext ( context . getSemantics ( ) , context . getConfiguration ( ) , model , CATEGORY_STREAM , "" ) ; LOG . debug ( "" , context . getQualifiedTypeName ( ) . toNameString ( ) ) ; DescriptionGenerator . emitImporter ( next , model , supportName ) ; LOG . debug ( "" , context . getQualifiedTypeName ( ) . toNameString ( ) , next . getQualifiedTypeName ( ) . toNameString ( ) ) ; return next . getQualifiedTypeName ( ) ; } private Name generateExporter ( EmitContext context , ModelDeclaration model , Name supportName ) throws IOException { assert context != null ; assert model != null ; assert supportName != null ; EmitContext next = new EmitContext ( context . getSemantics ( ) , context . getConfiguration ( ) , model , CATEGORY_STREAM , "" ) ; LOG . debug ( "" , context . getQualifiedTypeName ( ) . toNameString ( ) ) ; DescriptionGenerator . emitExporter ( next , model , supportName ) ; LOG . debug ( "" , context . getQualifiedTypeName ( ) . toNameString ( ) , next . getQualifiedTypeName ( ) . toNameString ( ) ) ; return next . getQualifiedTypeName ( ) ; } private boolean isTarget ( ModelDeclaration model ) { assert model != null ; CsvSupportTrait trait = model . getTrait ( CsvSupportTrait . class ) ; return trait != null ; } private void checkPropertyType ( ModelDeclaration model ) throws IOException { assert model != null ; for ( PropertyDeclaration prop : model . getDeclaredProperties ( ) ) { if ( isValueField ( prop ) ) { Type type = prop . getType ( ) ; if ( ( type instanceof BasicType ) == false ) { throw new IOException ( MessageFormat . format ( "" , type , prop . getOwner ( ) . getName ( ) . identifier , prop . getName ( ) . identifier ) ) ; } } } } static boolean isValueField ( PropertyDeclaration property ) { assert property != null ; return CsvFieldTrait . getKind ( property , Kind . VALUE ) == Kind . VALUE ; } private static final class SupportGenerator { private static final String NAME_READER = "StreamReader" ; private static final String NAME_WRITER = "StreamWriter" ; private static final String METHOD_CONFIG = "" ; private static final String FIELD_PATH_NAME = "pathText" ; private final EmitContext context ; private final ModelDeclaration model ; private final Configuration conf ; private final ModelFactory f ; private SupportGenerator ( EmitContext context , ModelDeclaration model , Configuration configuration ) { assert context != null ; assert model != null ; assert configuration != null ; this . context = context ; this . model = model ; this . conf = configuration ; this . f = context . getModelFactory ( ) ; } static void emit ( EmitContext context , ModelDeclaration model , Configuration conf ) throws IOException { assert context != null ; assert model != null ; assert conf != null ; SupportGenerator emitter = new SupportGenerator ( context , model , conf ) ; emitter . emit ( ) ; } private void emit ( ) throws IOException { ClassDeclaration decl = f . newClassDeclaration ( new JavadocBuilder ( f ) . text ( "" ) . linkType ( context . resolve ( model . getSymbol ( ) ) ) . text ( "." ) . toJavadoc ( ) , new AttributeBuilder ( f ) . Public ( ) . toAttributes ( ) , context . getTypeName ( ) , Collections . < TypeParameterDeclaration > emptyList ( ) , null , Collections . singletonList ( f . newParameterizedType ( context . resolve ( DataModelStreamSupport . class ) , context . resolve ( model . getSymbol ( ) ) ) ) , createMembers ( ) ) ; context . emit ( decl ) ; } private List < TypeBodyDeclaration > createMembers ( ) { List < TypeBodyDeclaration > results = Lists . create ( ) ; results . add ( createGetConfiguration ( ) ) ; results . add ( createGetSupportedType ( ) ) ; results . add ( createCreateReader ( ) ) ; results . add ( createCreateWriter ( ) ) ; results . add ( createReaderClass ( ) ) ; results . add ( createWriterClass ( ) ) ; return results ; } private MethodDeclaration createGetConfiguration ( ) { List < Statement > statements = Lists . create ( ) ; List < Expression > arguments = Lists . create ( ) ; arguments . add ( new TypeBuilder ( f , context . resolve ( Charset . class ) ) . method ( "forName" , Models . toLiteral ( f , conf . getCharsetName ( ) ) ) . toExpression ( ) ) ; if ( conf . isEnableHeader ( ) ) { SimpleName headers = f . newSimpleName ( "headers" ) ; statements . add ( new TypeBuilder ( f , context . resolve ( ArrayList . class ) ) . parameterize ( context . resolve ( String . class ) ) . newObject ( ) . toLocalVariableDeclaration ( new TypeBuilder ( f , context . resolve ( List . class ) ) . parameterize ( context . resolve ( String . class ) ) . toType ( ) , headers ) ) ; for ( PropertyDeclaration property : model . getDeclaredProperties ( ) ) { if ( isValueField ( property ) ) { String fieldName = CsvFieldTrait . getFieldName ( property ) ; statements . add ( new ExpressionBuilder ( f , headers ) . method ( "add" , Models . toLiteral ( f , fieldName ) ) . toStatement ( ) ) ; } } arguments . add ( headers ) ; } else { arguments . add ( new TypeBuilder ( f , context . resolve ( CsvConfiguration . class ) ) . field ( "" ) . toExpression ( ) ) ; } arguments . add ( Models . toLiteral ( f , conf . getTrueFormat ( ) ) ) ; arguments . add ( Models . toLiteral ( f , conf . getFalseFormat ( ) ) ) ; arguments . add ( Models . toLiteral ( f , conf . getDateFormat ( ) ) ) ; arguments . add ( Models . toLiteral ( f , conf . getDateTimeFormat ( ) ) ) ; statements . add ( new TypeBuilder ( f , context . resolve ( CsvConfiguration . class ) ) . newObject ( arguments ) . toReturnStatement ( ) ) ; return f . newMethodDeclaration ( new JavadocBuilder ( f ) . text ( "" ) . returns ( ) . text ( "" ) . toJavadoc ( ) , new AttributeBuilder ( f ) . Protected ( ) . toAttributes ( ) , context . resolve ( CsvConfiguration . class ) , f . newSimpleName ( METHOD_CONFIG ) , Collections . < FormalParameterDeclaration > emptyList ( ) , statements ) ; } private MethodDeclaration createGetSupportedType ( ) { MethodDeclaration decl = f . newMethodDeclaration ( null , new AttributeBuilder ( f ) . annotation ( context . resolve ( Override . class ) ) . Public ( ) . toAttributes ( ) , f . newParameterizedType ( context . resolve ( Class . class ) , context . resolve ( model . getSymbol ( ) ) ) , f . newSimpleName ( "" ) , Collections . < FormalParameterDeclaration > emptyList ( ) , Arrays . asList ( new Statement [ ] { new TypeBuilder ( f , context . resolve ( model . getSymbol ( ) ) ) . dotClass ( ) . toReturnStatement ( ) } ) ) ; return decl ; } private MethodDeclaration createCreateReader ( ) { SimpleName path = f . newSimpleName ( "path" ) ; SimpleName stream = f . newSimpleName ( "stream" ) ; List < Statement > statements = Lists . create ( ) ; statements . add ( createNullCheck ( path ) ) ; statements . add ( createNullCheck ( stream ) ) ; SimpleName parser = f . newSimpleName ( "parser" ) ; statements . add ( new TypeBuilder ( f , context . resolve ( CsvParser . class ) ) . newObject ( stream , path , new ExpressionBuilder ( f , f . newThis ( ) ) . method ( METHOD_CONFIG ) . toExpression ( ) ) . toLocalVariableDeclaration ( context . resolve ( CsvParser . class ) , parser ) ) ; statements . add ( new TypeBuilder ( f , f . newNamedType ( f . newSimpleName ( NAME_READER ) ) ) . newObject ( parser ) . toReturnStatement ( ) ) ; MethodDeclaration decl = f . newMethodDeclaration ( null , new AttributeBuilder ( f ) . annotation ( context . resolve ( Override . class ) ) . Public ( ) . toAttributes ( ) , Collections . < TypeParameterDeclaration > emptyList ( ) , context . resolve ( f . newParameterizedType ( context . resolve ( DataModelReader . class ) , context . resolve ( model . getSymbol ( ) ) ) ) , f . newSimpleName ( "createReader" ) , Arrays . asList ( f . newFormalParameterDeclaration ( context . resolve ( String . class ) , path ) , f . newFormalParameterDeclaration ( context . resolve ( InputStream . class ) , stream ) ) , 0 , Arrays . asList ( context . resolve ( IOException . class ) ) , f . newBlock ( statements ) ) ; return decl ; } private MethodDeclaration createCreateWriter ( ) { SimpleName path = f . newSimpleName ( "path" ) ; SimpleName stream = f . newSimpleName ( "stream" ) ; List < Statement > statements = Lists . create ( ) ; statements . add ( createNullCheck ( path ) ) ; statements . add ( createNullCheck ( stream ) ) ; SimpleName emitter = f . newSimpleName ( "emitter" ) ; statements . add ( new TypeBuilder ( f , context . resolve ( CsvEmitter . class ) ) . newObject ( stream , path , new ExpressionBuilder ( f , f . newThis ( ) ) . method ( METHOD_CONFIG ) . toExpression ( ) ) . toLocalVariableDeclaration ( context . resolve ( CsvEmitter . class ) , emitter ) ) ; statements . add ( new TypeBuilder ( f , f . newNamedType ( f . newSimpleName ( NAME_WRITER ) ) ) . newObject ( emitter ) . toReturnStatement ( ) ) ; MethodDeclaration decl = f . newMethodDeclaration ( null , new AttributeBuilder ( f ) . annotation ( context . resolve ( Override . class ) ) . Public ( ) . toAttributes ( ) , Collections . < TypeParameterDeclaration > emptyList ( ) , context . resolve ( f . newParameterizedType ( context . resolve ( DataModelWriter . class ) , context . resolve ( model . getSymbol ( ) ) ) ) , f . newSimpleName ( "createWriter" ) , Arrays . asList ( f . newFormalParameterDeclaration ( context . resolve ( String . class ) , path ) , f . newFormalParameterDeclaration ( context . resolve ( OutputStream . class ) , stream ) ) , 0 , Arrays . asList ( context . resolve ( IOException . class ) ) , f . newBlock ( statements ) ) ; return decl ; } private Statement createNullCheck ( SimpleName parameter ) { assert parameter != null ; return f . newIfStatement ( new ExpressionBuilder ( f , parameter ) . apply ( InfixOperator . EQUALS , Models . toNullLiteral ( f ) ) . toExpression ( ) , f . newBlock ( new TypeBuilder ( f , context . resolve ( IllegalArgumentException . class ) ) . newObject ( Models . toLiteral ( f , MessageFormat . format ( "" , parameter . getToken ( ) ) ) ) . toThrowStatement ( ) ) ) ; } private ClassDeclaration createReaderClass ( ) { SimpleName parser = f . newSimpleName ( "parser" ) ; List < TypeBodyDeclaration > members = Lists . create ( ) ; members . add ( createPrivateField ( CsvParser . class , parser ) ) ; List < ExpressionStatement > constructorStatements = Lists . create ( ) ; constructorStatements . add ( mapField ( parser ) ) ; if ( hasFileName ( ) ) { members . add ( createPrivateField ( StringOption . class , f . newSimpleName ( FIELD_PATH_NAME ) ) ) ; constructorStatements . add ( new ExpressionBuilder ( f , f . newSimpleName ( FIELD_PATH_NAME ) ) . assignFrom ( new TypeBuilder ( f , context . resolve ( StringOption . class ) ) . newObject ( new ExpressionBuilder ( f , parser ) . method ( "getPath" ) . toExpression ( ) ) . toExpression ( ) ) . toStatement ( ) ) ; } members . add ( f . newConstructorDeclaration ( null , new AttributeBuilder ( f ) . toAttributes ( ) , f . newSimpleName ( NAME_READER ) , Arrays . asList ( f . newFormalParameterDeclaration ( context . resolve ( CsvParser . class ) , parser ) ) , constructorStatements ) ) ; SimpleName object = f . newSimpleName ( "object" ) ; List < Statement > statements = Lists . create ( ) ; statements . add ( f . newIfStatement ( new ExpressionBuilder ( f , parser ) . method ( "next" ) . apply ( InfixOperator . EQUALS , Models . toLiteral ( f , | |
795 | <s> package org . oddjob ; import java . lang . reflect . InvocationHandler ; import java . lang . reflect . Proxy ; import java . util . concurrent . Callable ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . life . ComponentProxyResolver ; import org . oddjob . framework . CallableProxyGenerator ; import org . oddjob . framework . ServiceStrategies ; import org . oddjob . framework . RunnableProxyGenerator ; import org . oddjob . framework . ServiceAdaptor ; import org . oddjob . framework . ServiceProxyGenerator ; import org . oddjob . framework . WrapperInvocationHandler ; public class OddjobComponentResolver implements ComponentProxyResolver { @ Override public Object resolve ( final Object component , ArooaSession session ) { Object proxy ; if ( component instanceof Stateful ) { proxy = component ; } else if ( component instanceof Callable ) { proxy = new CallableProxyGenerator ( ) . generate ( ( Callable < ? > ) component , component . getClass ( ) . getClassLoader ( ) ) ; } else if ( component instanceof Runnable ) { proxy = new RunnableProxyGenerator ( ) . generate ( ( Runnable ) component , component . getClass | |
796 | <s> package com . asakusafw . compiler . operator . processor ; import static org . junit . Assert . * ; import org . junit . Test ; import com . asakusafw . compiler . operator . OperatorCompilerTestRoot ; import com . asakusafw . compiler . operator . model . MockFoo ; import com . asakusafw . compiler . operator . model . MockHoge ; import com . asakusafw . utils . graph . Graph ; import com . asakusafw . vocabulary . flow . testing . MockIn ; import com . asakusafw . vocabulary . flow . testing . MockOut ; public class MasterJoinUpdateOperatorProcessorTest extends OperatorCompilerTestRoot { @ Test public void simple ( ) { add ( "" ) ; ClassLoader loader = start ( new MasterJoinUpdateOperatorProcessor ( ) ) ; Object factory = create ( loader , "" ) ; MockIn < MockHoge > a = MockIn . of ( MockHoge . class , "a" ) ; MockIn < MockFoo > b = MockIn . of ( MockFoo . class , "b" ) ; MockOut < MockFoo > updated = MockOut . of ( MockFoo . class , "updated" ) ; MockOut < MockFoo > missed = MockOut . of ( MockFoo . class , "missed" ) ; Object masterJoinUpdate = invoke ( factory , "example" , a , b ) ; updated . add ( output ( MockFoo . class , masterJoinUpdate , "updated" ) ) ; missed . add ( output ( MockFoo . class , masterJoinUpdate , "missed" ) ) ; Graph < String > graph = toGraph ( a , b ) ; assertThat ( graph . getConnected ( "a" ) , isJust ( "" ) ) ; assertThat ( graph . getConnected ( "b" ) , isJust ( "" ) ) ; assertThat ( graph . getConnected ( "" ) , isJust ( "updated" , "missed" ) ) ; } @ Test public void selector ( ) { add ( "" ) ; ClassLoader loader = start ( new MasterJoinUpdateOperatorProcessor ( ) ) ; Object factory = create ( loader , "" ) ; MockIn < MockHoge > a = MockIn . of ( MockHoge . class , "a" ) ; MockIn < MockFoo > b = MockIn . of ( MockFoo . class , "b" ) ; MockOut < MockFoo > updated = MockOut . of ( MockFoo . class , "updated" ) ; MockOut < MockFoo > missed = MockOut . of ( MockFoo . class , "missed" ) ; Object masterJoinUpdate = invoke ( factory , "example" , a , b ) ; updated . add ( output ( MockFoo . class , masterJoinUpdate , "updated" ) ) ; missed . add ( output ( MockFoo . class , masterJoinUpdate , "missed" ) ) ; Graph < String > graph = toGraph ( a , b ) ; assertThat ( graph . getConnected ( "a" ) , isJust ( "" ) ) ; assertThat ( graph . getConnected ( "b" ) , isJust ( "" ) ) ; assertThat ( graph . getConnected ( "" ) | |
797 | <s> package net . sf . sveditor . core . db ; public class SVDBInclude extends SVDBItem { public SVDBInclude ( ) { super ( "" , SVDBItemType . Include ) ; } public SVDBInclude ( String name ) { super ( name , SVDBItemType . Include ) ; } @ Override public SVDBInclude duplicate ( ) { return ( SVDBInclude | |
798 | <s> package com . asakusafw . runtime . io . util ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import org . junit . Test ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . runtime . value . StringOption ; @ SuppressWarnings ( "deprecation" ) public class WritableRawComparableUnionTest extends WritableTestRoot { @ Test public void createFromClasses ( ) throws Exception { Union union = new WritableRawComparableUnion ( IntOption . class , LongOption . class , StringOption . class ) ; assertThat ( union . switchObject ( 0 ) , instanceOf ( IntOption . class ) ) ; assertThat ( union . switchObject ( 1 ) , instanceOf ( LongOption . class ) ) ; assertThat ( union . switchObject ( 2 ) , instanceOf ( StringOption . class ) ) ; ( ( IntOption ) union . switchObject ( 0 ) ) . modify ( 100 ) ; assertThat ( union . getPosition ( ) , is ( 0 ) ) ; ( ( LongOption ) union . switchObject ( 1 ) ) . modify ( 200L ) ; assertThat ( union . getPosition ( ) , is ( 1 ) ) ; ( ( StringOption ) union . switchObject ( 2 ) ) . modify ( "" ) ; assertThat ( union . getPosition ( ) , is ( 2 ) ) ; assertThat ( union . switchObject ( 0 ) , is ( ( Object ) new IntOption ( 100 ) ) ) ; assertThat ( union . switchObject ( 1 ) , is ( ( Object ) new LongOption ( 200L ) ) ) ; assertThat ( union . switchObject ( 2 ) , is ( ( Object ) new StringOption ( "" ) ) ) ; } @ Test public void createFromObject ( ) throws Exception { Union union = new WritableRawComparableUnion ( new IntOption ( 100 ) , new LongOption ( 200L ) , new StringOption ( "" ) ) ; assertThat ( union . switchObject ( 0 ) , is ( ( Object ) new IntOption ( 100 ) ) ) ; assertThat ( union . switchObject ( 1 ) , is ( ( Object ) new LongOption ( 200L ) ) ) ; assertThat ( union . switchObject ( 2 ) , is ( ( Object ) new StringOption ( "" ) ) ) ; } @ Test public void serialize ( ) throws Exception { WritableRawComparableUnion union = new WritableRawComparableUnion ( new IntOption ( 100 ) , new LongOption ( 200L ) , new StringOption ( "" ) , new StringOption ( ) ) ; StringBuilder buf = new StringBuilder ( 100000 ) ; for ( int i = 0 , n = buf . capacity ( ) ; i < n ; i ++ ) { buf . append ( ( char ) ( 'A' + ( i * 257 % 26 ) ) ) ; } ( ( StringOption ) union . switchObject ( 3 ) ) . modify ( buf . toString ( ) ) ; WritableRawComparableUnion r0 = new WritableRawComparableUnion ( IntOption . class , LongOption . class , StringOption . class ) ; union . switchObject ( 0 ) ; byte [ ] s0 = ser ( union ) ; des ( r0 , s0 ) ; assertThat ( r0 . getPosition ( ) , is ( 0 ) ) ; assertThat ( r0 . getObject ( ) , is ( ( Object ) new IntOption ( 100 ) ) ) ; WritableRawComparableUnion r1 = new WritableRawComparableUnion ( IntOption . class , LongOption . class , StringOption . class ) ; union . switchObject ( 1 ) ; byte [ ] s1 = ser ( union ) ; des ( r1 , s1 ) ; assertThat ( r1 . getPosition ( ) , is ( 1 ) ) ; assertThat ( r1 . getObject ( ) , is ( ( Object ) new LongOption ( 200L ) ) ) ; WritableRawComparableUnion r2 = new WritableRawComparableUnion ( IntOption . class , LongOption . class , StringOption . class ) ; union . switchObject ( 2 ) ; byte [ ] s2 = ser ( union ) ; des ( r2 , s2 ) ; assertThat ( r2 . getPosition ( ) , is ( 2 ) ) ; assertThat ( r2 . getObject ( ) , is ( ( Object ) | |
799 | <s> package org . rubypeople . rdt . internal . ui . viewsupport ; import org . eclipse . jface . action . Action ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . ui . actions . * ; public class MemberFilterAction extends Action { private int fFilterProperty ; private MemberFilterActionGroup fFilterActionGroup ; |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.