id
int32
0
3k
input
stringlengths
43
33.8k
gt
stringclasses
1 value
2,700
<s> package org . rubypeople . rdt . core . search ; import java . util . List ; import org . eclipse . core . resources . IResource ; import org . rubypeople . rdt . core . IRubyElement ; public class MethodReferenceMatch extends SearchMatch { private boolean constructor ; private IRubyElement binding ; private List < String > arguments ; public MethodReferenceMatch ( IRubyElement enclosingElement , int accuracy , int offset , int length , boolean insideDocComment , SearchParticipant participant , IResource resource ) { super ( enclosingElement , accuracy , offset , length , participant , resource ) ; setInsideDocComment ( insideDocComment ) ; } public MethodReferenceMatch ( IRubyElement enclosingElement , IRubyElement binding , List < String > args , int accuracy , int offset , int length , boolean constructor , boolean insideDocComment , SearchParticipant participant , IResource
2,701
<s> package com . asakusafw . compiler . bulkloader ; import com . asakusafw . vocabulary . flow . FlowDescription ; import com . asakusafw . vocabulary . flow . In ; import com . asakusafw . vocabulary . flow . Out ; public class IdentityFlow < T > extends FlowDescription { private In < T > in ; private
2,702
<s> package com . asakusafw . utils . java . parser . javadoc ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . EnumSet ; import java . util . List ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . IrDocBlock ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . IrDocComment ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . IrLocation ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . JavadocToken ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . JavadocTokenKind ; public final class JavadocParser extends JavadocBaseParser { public JavadocParser ( List < ? extends JavadocBlockParser > blockParsers ) { super ( blockParsers ) ; } public IrDocComment parse ( JavadocScanner scanner ) throws JavadocParseException { if ( scanner == null ) { throw new IllegalArgumentException ( "scanner" ) ; } int index = scanner . getIndex ( ) ; try { JavadocInfo info = fetchJavadocInfo ( scanner ) ; List < IrDocBlock > blocks = new ArrayList < IrDocBlock > ( info . getBlocks ( ) . size ( ) ) ; for ( JavadocBlockInfo b : info . getBlocks ( ) ) { IrDocBlock block = parseBlock ( b ) ; blocks . add ( block ) ; } IrDocComment elem = new IrDocComment ( ) ; elem . setBlocks ( blocks ) ; elem . setLocation ( info . getLocation ( ) ) ; return elem ; } catch ( JavadocParseException e ) { scanner . seek ( index ) ; throw e ; } } public IrDocBlock parseBlock ( JavadocScanner scanner ) throws JavadocParseException { if ( scanner == null ) { throw new IllegalArgumentException ( "scanner" ) ; } int eoc = JavadocScannerUtil . countUntilCommentEnd ( scanner , true , 0 ) ; if ( eoc >= 0 ) { throw new IllegalEndOfCommentException ( scanner . lookahead ( 0 ) . getLocation ( ) , null ) ; } JavadocTokenKind kind = scanner . lookahead ( 0 ) . getKind ( ) ; int index = scanner . getIndex ( ) ; try { JavadocBlockInfo info ; if ( kind == JavadocTokenKind . AT ) { info = fetchStandAloneBlock ( scanner , scanner . getTokens ( ) ) ; } else { info = fetchSynopsisBlock ( scanner ) ; } if ( info == null ) { throw new IllegalArgumentException ( "Empty block" ) ; } return parseBlock ( info ) ; } catch ( JavadocParseException e ) { scanner . seek ( index ) ; throw e ; } } private static JavadocInfo fetchJavadocInfo ( JavadocScanner scanner ) throws IllegalDocCommentFormatException { int offset = 0 ; IrLocation firstLocation = scanner . lookahead ( 0 ) . getLocation ( ) ; if ( ! hasJavadocHead ( scanner , offset ) ) { throw new IllegalDocCommentFormatException ( true , scanner . lookahead ( 0 ) . getLocation ( ) , null ) ; } offset += 3 ; if ( scanner . lookahead ( offset ) . getKind ( ) == JavadocTokenKind . SLASH ) { throw new IllegalDocCommentFormatException ( true , scanner . lookahead ( 0 ) . getLocation ( ) , null ) ; } int bodyStart = offset ; offset += JavadocScannerUtil . countUntilCommentEnd ( scanner , false , offset ) ; int bodyEnd = offset ; if ( ! hasJavadocTail ( scanner , offset ) ) { throw new IllegalDocCommentFormatException ( false , scanner . lookahead ( 0 ) . getLocation ( ) , null ) ; } IrLocation lastLocation = scanner . lookahead ( offset + 1 ) . getLocation ( ) ; int base = scanner . getIndex ( ) ; JavadocScanner bodyScanner = new DefaultJavadocScanner ( scanner . getTokens ( ) . subList ( base + bodyStart , base + bodyEnd ) , scanner . lookahead ( offset ) . getStartPosition ( ) ) ; List < JavadocBlockInfo > blockScanners = splitBlocks ( bodyScanner ) ; int locStart = firstLocation . getStartPosition ( ) ; int locEnd = lastLocation . getStartPosition ( ) + lastLocation . getLength ( ) ; IrLocation location = new IrLocation ( locStart , locEnd - locStart ) ; scanner . consume ( offset ) ; return new JavadocInfo ( location , blockScanners ) ; } private static List < JavadocBlockInfo > splitBlocks ( JavadocScanner scanner ) { List < JavadocBlockInfo > blocks = new ArrayList < JavadocBlockInfo > ( ) ; JavadocBlockInfo synopsis = fetchSynopsisBlock ( scanner ) ; if ( synopsis != null ) { blocks . add ( synopsis ) ; } List < JavadocToken > tokens = scanner . getTokens ( ) ; while ( true ) { JavadocBlockInfo info = fetchStandAloneBlock ( scanner , tokens ) ; if ( info == null ) { break ; }
2,703
<s> package org . oddjob . io ; import java . io . IOException ; import java . io . InputStream ; import java . net . URL ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . ArooaValue ; import org . oddjob . arooa . ClassResolver ; import org . oddjob . arooa . convert . ConversionProvider ; import org . oddjob . arooa . convert . ConversionRegistry ; import org . oddjob . arooa . convert . Convertlet ; import org . oddjob . arooa . convert . ConvertletException ; import org . oddjob
2,704
<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 . SVDBItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBModIfcClassParam ; import net . sf . sveditor . core . db . SVDBModIfcDecl ; import net . sf . sveditor . core . db . SVDBModIfcInst ; import net . sf . sveditor . core . db . SVDBTask ; import net . sf . sveditor . core . db . SVDBTypeInfoEnum ; import net . sf . sveditor . core . db . SVDBTypeInfoEnumerator ; import net . sf . sveditor . core . db . index . ISVDBIndexIterator ; import net . sf . sveditor . core . db . stmt . SVDBParamPortDecl ; import net . sf . sveditor . core . db . stmt . SVDBTypedefStmt ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclItem ; import net . sf . sveditor . core . db . stmt . SVDBVarDeclStmt ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; public class SVDBFindByNameInScopes { private ISVDBFindNameMatcher fMatcher ; private LogHandle fLog ; public SVDBFindByNameInScopes ( ISVDBIndexIterator index_it ) { fMatcher = SVDBFindDefaultNameMatcher . getDefault ( ) ; fLog = LogFactory . getLogHandle ( "" ) ; } public SVDBFindByNameInScopes ( ISVDBIndexIterator index_it , ISVDBFindNameMatcher matcher ) { fMatcher = matcher ; fLog = LogFactory . getLogHandle ( "" ) ; } public List < ISVDBItemBase > find ( ISVDBChildItem context , String name , boolean stop_on_first_match , SVDBItemType ... types ) { List < ISVDBItemBase > ret = new ArrayList < ISVDBItemBase > ( ) ; fLog . debug ( "" + ( ( context != null ) ? SVDBItem . getName ( context ) : "null" ) + " type=" + ( ( context != null ) ? context . getType ( ) : "null" ) + " name=" + name ) ; while ( context != null && context instanceof ISVDBChildParent ) { if ( context . getType ( ) == SVDBItemType . ClassDecl ) { SVDBClassDecl cls = ( SVDBClassDecl ) context ; if ( cls . getParameters ( ) != null ) { for ( SVDBModIfcClassParam p : cls . getParameters ( ) ) { if ( fMatcher . match ( p , name ) ) { ret . add ( p ) ; } } } } for ( ISVDBItemBase it : ( ( ISVDBChildParent ) context ) . getChildren ( ) ) { fLog . debug ( "Scope " + SVDBItem . getName ( context ) + " child " + SVDBItem . getName ( it ) ) ; if ( it instanceof SVDBVarDeclStmt ) { for ( ISVDBItemBase it_t : ( ( SVDBVarDeclStmt ) it ) . getChildren ( ) ) { fLog . debug ( " Variable " + SVDBItem . getName ( it_t ) + " (match " + name + ")" ) ; if ( it_t instanceof ISVDBNamedItem && fMatcher . match ( ( ISVDBNamedItem ) it_t , name ) ) { boolean match = ( types . length == 0 || it_t . getType ( ) . isElemOf ( types ) ) ; if ( match ) { fLog . debug ( "" + SVDBItem . getName ( it_t ) ) ; ret . add ( it_t ) ; if ( stop_on_first_match ) { break ; } } } } } else if ( it instanceof SVDBModIfcInst ) { for ( ISVDBItemBase it_t : ( ( SVDBModIfcInst ) it ) . getChildren ( ) ) { if ( it_t instanceof ISVDBNamedItem && fMatcher . match ( ( ISVDBNamedItem ) it_t , name ) ) { boolean match = ( types . length == 0 ) ; for ( SVDBItemType t : types ) { if ( it_t . getType ( ) == t ) { match = true ; break ; } }
2,705
<s> package com . asakusafw . compiler . windgate ; import com . asakusafw . vocabulary . flow . FlowDescription ; import com . asakusafw . vocabulary . flow . In ; import com . asakusafw . vocabulary . flow . Out ; public class DualIdentityFlow < T > extends FlowDescription { private In < T > in1 ; private In < T
2,706
<s> package com . asakusafw . utils . java . internal . model . syntax ; import com . asakusafw . utils . java . model . syntax . DocMethodParameter ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class DocMethodParameterImpl extends ModelRoot implements DocMethodParameter { private Type type ; private SimpleName name ; private boolean variableArity ; @ Override public Type getType ( ) { return this . type ; } public void setType ( Type type ) { Util . notNull ( type , "type" ) ; this . type = type ; } @ Override public SimpleName
2,707
<s> package com . asakusafw . testdriver . core ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . List ; import java . util . ServiceLoader ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . vocabulary . external . ExporterDescription ; public class SpiExporterRetriever implements ExporterRetriever < ExporterDescription > { @ SuppressWarnings ( "rawtypes" ) private final List < ExporterRetriever > elements ; public SpiExporterRetriever ( ClassLoader serviceClassLoader ) { if ( serviceClassLoader == null ) { throw new IllegalArgumentException ( "" ) ; } this . elements = Util . loadService ( ExporterRetriever . class , serviceClassLoader ) ; } @ SuppressWarnings ( "rawtypes" ) public SpiExporterRetriever ( List < ? extends ExporterRetriever < ? > > elements ) { if ( elements == null ) { throw new IllegalArgumentException ( "" ) ; } this . elements = new ArrayList < ExporterRetriever > ( elements ) ; } @ Override public Class < ExporterDescription > getDescriptionClass ( ) { return ExporterDescription . class ; } @ Override public void truncate ( ExporterDescription description , TestContext context ) throws IOException { for ( ExporterRetriever < ? > element : elements ) { if ( element . getDescriptionClass ( ) . isAssignableFrom ( description . getClass ( ) ) ) { truncate0 ( element , description , context ) ; return ; } } throw new IOException ( MessageFormat . format ( "" , description ) ) ; } private < T extends ExporterDescription > void truncate0 ( ExporterRetriever < T > preparator , ExporterDescription description , TestContext context ) throws IOException { assert preparator != null ; assert description != null ; T desc = preparator . getDescriptionClass ( ) . cast ( description ) ; preparator . truncate ( desc , context ) ; } @ Override public < V > ModelOutput < V > createOutput ( DataModelDefinition < V > definition , ExporterDescription description , TestContext context ) throws IOException { for ( ExporterRetriever < ? > element : elements )
2,708
<s> package com . asakusafw . compiler . flow ; import java . io . Serializable ; import java . util . Collections ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . runtime . util . VariableTable ; public class ExternalIoCommandProvider implements Serializable { private static final long serialVersionUID = 1L ; public String getName ( ) { return "default" ; } public List < Command > getImportCommand ( CommandContext context ) { return Collections . emptyList ( ) ; } public List < Command > getExportCommand ( CommandContext context ) { return Collections . emptyList ( ) ; } @ Deprecated public List < Command > getRecoverCommand ( CommandContext context ) { return Collections . emptyList ( ) ; } public List < Command > getInitializeCommand ( CommandContext context ) { return Collections . emptyList ( ) ; } public List < Command > getFinalizeCommand ( CommandContext context ) { return Collections . emptyList ( ) ; } public static class CommandContext { private final String homePathPrefix ; private final String executionId ; private final String variableList ; public CommandContext ( String homePathPrefix , String executionId , String variableList ) { Precondition . checkMustNotBeNull ( homePathPrefix , "" ) ; Precondition . checkMustNotBeNull ( executionId , "executionId" ) ; Precondition . checkMustNotBeNull ( variableList , "variableList" ) ; this . homePathPrefix = homePathPrefix ; this . executionId = executionId ; this . variableList = variableList ; } public CommandContext ( String homePathPrefix , String executionId , Map < String , String > variables ) { Precondition . checkMustNotBeNull ( homePathPrefix , "" ) ; Precondition . checkMustNotBeNull ( executionId , "executionId" ) ; Precondition .
2,709
<s> package org . oddjob . designer . components ; import org . oddjob . arooa . design . DesignFactory ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignProperty ; import org . oddjob . arooa . design . SimpleTextAttribute ; import org . oddjob . arooa . design . screem . BorderedGroup ; import org . oddjob . arooa . design . screem . Form ; import org . oddjob . arooa . design . screem . StandardForm ; import org .
2,710
<s> package com . sun . tools . hat . internal . lang . jruby12 ; import com . sun . tools . hat . internal . lang . Model ; import com . sun . tools . hat . internal . lang . ModelFactory ; import com . sun . tools . hat . internal . lang . ModelFactoryFactory ; import com . sun . tools . hat . internal . lang . Models ; import com . sun . tools . hat . internal . lang . jruby . JRubyArray ; import com . sun . tools . hat . internal . lang . jruby . JRubyString ;
2,711
<s> package com . asakusafw . runtime . stage . input ; import java . io . IOException ; import org . apache . hadoop . mapreduce
2,712
<s> package com . asakusafw . compiler . flow . testing . io ; import java . io . IOException ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; public final class Ex1Output implements ModelOutput < Ex1 > { private final RecordEmitter emitter ; public Ex1Output ( RecordEmitter emitter ) { if ( emitter == null ) { throw new IllegalArgumentException ( ) ; } this . emitter = emitter ; } @ Override public void write ( Ex1 model ) throws IOException { emitter . emit ( model . getSidOption (
2,713
<s> package com . asakusafw . compiler . windgate . testing . jdbc ; import java . sql . ParameterMetaData ; import java . sql . PreparedStatement ; import java . sql . ResultSet ; import java . sql . SQLException ; import java . util . List ; import java . util . Map ; import java . util . TreeMap ; import org . apache . hadoop . io . Text ; import com . asakusafw . compiler . windgate . testing . model . Pair ; import com . asakusafw . windgate . core . vocabulary . DataModelJdbcSupport ; public final class PairJdbcSupport implements DataModelJdbcSupport < Pair > { private static final Map < String , Integer > PROPERTY_POSITIONS ; static { Map < String , Integer > map = new TreeMap < String , Integer > ( ) ; map . put ( "KEY" , 0 ) ; map . put ( "VALUE" , 1 ) ; PROPERTY_POSITIONS = map ; } @ Override public Class < Pair > getSupportedType ( ) { return Pair . class ; } @ Override public boolean isSupported ( List < String > columnNames ) { if ( columnNames == null ) { throw new IllegalArgumentException ( "" ) ; } if ( columnNames . isEmpty ( ) ) { return false ; }
2,714
<s> package com . aptana . rdt . internal . core . gems ; import java . util . HashSet ; import java . util . Set ; import org . xml . sax . Attributes ; import org . xml . sax . ContentHandler ; import org . xml . sax . Locator ; import org . xml . sax . SAXException ;
2,715
<s> package com . asakusafw . testtools ; import org . junit . runner . RunWith ; import org . junit . runners . Suite ; import org . junit . runners . Suite . SuiteClasses ; import com . asakusafw . testtools . db . DbUtilTest ; import com . asakusafw . testtools . excel . ExcelUtilsTest ; import com . asakusafw . testtools .
2,716
<s> package org . rubypeople . rdt . internal . core ; import java . io . ByteArrayOutputStream ; import java . io . OutputStreamWriter ; import java . io . UnsupportedEncodingException ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . runtime . AssertionFailedException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . rubypeople . rdt . core . ILoadpathAttribute ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IRubyModelStatus ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . core . util . CharOperation ; import org . rubypeople . rdt . internal . core . util . Messages ; import org . w3c . dom . DOMException ; import org . w3c . dom . Element ; import org . w3c . dom . NamedNodeMap ; import org . w3c . dom . Node ; import org . w3c . dom . NodeList ; import org . w3c . dom . Text ; public class LoadpathEntry implements ILoadpathEntry { public static final String TAG_LOADPATH = "loadpath" ; public static final String TAG_LOADPATHENTRY = "pathentry" ; public static final String TAG_KIND = "type" ; public static final String TAG_PATH = "path" ; public static final String TAG_EXPORTED = "exported" ; public static final String TAG_INCLUDING = "including" ; public static final String TAG_EXCLUDING = "excluding" ; public static final String TAG_ATTRIBUTES = "attributes" ; public static final String TAG_ATTRIBUTE = "attribute" ; public static final String TAG_ATTRIBUTE_NAME = "name" ; public static final String TAG_ATTRIBUTE_VALUE = "value" ; static class UnknownXmlElements { String [ ] attributes ; ArrayList children ; } private static final String TYPE_PROJECT = "project" ; private String rootID ; private int entryKind ; private IPath path ; private IPath [ ] inclusionPatterns ; private char [ ] [ ] fullInclusionPatternChars ; private IPath [ ] exclusionPatterns ; private char [ ] [ ] fullExclusionPatternChars ; private final static char [ ] [ ] UNINIT_PATTERNS = new char [ ] [ ] { "" . toCharArray ( ) } ; public final static ILoadpathAttribute [ ] NO_EXTRA_ATTRIBUTES = { } ; public final static IPath [ ] INCLUDE_ALL = { } ; public final static IPath [ ] EXCLUDE_NONE = { } ; private IProject project ; private boolean isExported ; ILoadpathAttribute [ ] extraAttributes ; public LoadpathEntry ( int entryKind , IPath path , IPath [ ] inclusionPatterns , IPath [ ] exclusionPatterns , ILoadpathAttribute [ ] extraAttributes , boolean isExported ) { this . path = path ; this . entryKind = entryKind ; this . inclusionPatterns = inclusionPatterns ; this . exclusionPatterns = exclusionPatterns ; this . extraAttributes = extraAttributes ; if ( inclusionPatterns != INCLUDE_ALL && inclusionPatterns . length > 0 ) { this . fullInclusionPatternChars = UNINIT_PATTERNS ; } if ( exclusionPatterns . length > 0 ) { this . fullExclusionPatternChars = UNINIT_PATTERNS ; } this . isExported = isExported ; } public IPath getPath ( ) { return path ; } public int getEntryKind ( ) { return this . entryKind ; } static String kindToString ( int kind ) { switch ( kind ) { case ILoadpathEntry . CPE_PROJECT : return TYPE_PROJECT ; case ILoadpathEntry . CPE_SOURCE : return "src" ; case ILoadpathEntry . CPE_LIBRARY : return "lib" ; case ILoadpathEntry . CPE_VARIABLE : return "var" ; case ILoadpathEntry . CPE_CONTAINER : return "con" ; default : return "unknown" ; } } public String toXML ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "" ) ; buffer . append ( LoadpathEntry . kindToString ( entryKind ) + "\" " ) ; buffer . append ( "path=\"" + getPath ( ) + "\"/>" ) ; return buffer . toString ( ) ; } public String rootID ( ) { if ( this . rootID == null ) { switch ( this . entryKind ) { case ILoadpathEntry . CPE_LIBRARY : this . rootID = "[LIB]" + this . path ; break ; case ILoadpathEntry . CPE_PROJECT : this . rootID = "[PRJ]" + this . path ; break ; case ILoadpathEntry . CPE_SOURCE : this . rootID = "[SRC]" + this . path ; break ; case ILoadpathEntry . CPE_VARIABLE : this . rootID = "[VAR]" + this . path ; break ; case ILoadpathEntry . CPE_CONTAINER : this . rootID = "[CON]" + this . path ; break ; default : this . rootID = "" ; break ; } } return this . rootID ; } public char [ ] [ ] fullExclusionPatternChars ( ) { if ( this . fullExclusionPatternChars == UNINIT_PATTERNS ) { int length = this . exclusionPatterns . length ; this . fullExclusionPatternChars = new char [ length ] [ ] ; IPath prefixPath = this . path . removeTrailingSeparator ( ) ; for ( int i = 0 ; i < length ; i ++ ) { this . fullExclusionPatternChars [ i ] = prefixPath . append ( this . exclusionPatterns [ i ] ) . toString ( ) . toCharArray ( ) ; } } return this . fullExclusionPatternChars ; } public char [ ] [ ] fullInclusionPatternChars ( ) { if ( this . fullInclusionPatternChars == UNINIT_PATTERNS ) { int length = this . inclusionPatterns . length ; this . fullInclusionPatternChars = new char [ length ] [ ] ; IPath prefixPath = this . path . removeTrailingSeparator ( ) ; for ( int i = 0 ; i < length ; i ++ ) { this . fullInclusionPatternChars [ i ] = prefixPath . append ( this . inclusionPatterns [ i ] ) . toString ( ) . toCharArray ( ) ; } } return this . fullInclusionPatternChars ; } public boolean isExported ( ) { return this . isExported ; } public IPath [ ] getExclusionPatterns ( ) { return exclusionPatterns ; } public IPath [ ] getInclusionPatterns ( ) { return inclusionPatterns ; } public LoadpathEntry combineWith ( LoadpathEntry referringEntry ) { if ( referringEntry == null ) return this ; if ( referringEntry . isExported ( ) ) { return new LoadpathEntry ( getEntryKind ( ) , getPath ( ) , this . inclusionPatterns , this . exclusionPatterns , this . extraAttributes , referringEntry . isExported ( ) || this . isExported ) ; } return this ; } public static ILoadpathEntry elementDecode ( Element element , IRubyProject project , Map unknownElements ) { IPath projectPath = project . getProject ( ) . getFullPath ( ) ; NamedNodeMap attributes = element . getAttributes ( ) ; NodeList children = element . getChildNodes ( ) ; boolean [ ] foundChildren = new boolean [ children . getLength ( ) ] ; String kindAttr = removeAttribute ( TAG_KIND , attributes ) ; String pathAttr = removeAttribute ( TAG_PATH , attributes ) ; IPath path = new Path ( pathAttr ) ; int kind = kindFromString ( kindAttr ) ; if ( kind != ILoadpathEntry . CPE_VARIABLE && kind != ILoadpathEntry . CPE_CONTAINER && ! path . isAbsolute ( ) ) { path = projectPath . append ( path ) ; } boolean isExported = removeAttribute ( TAG_EXPORTED , attributes ) . equals ( "true" ) ; IPath [ ] inclusionPatterns = decodePatterns ( attributes , TAG_INCLUDING ) ; if ( inclusionPatterns == null ) inclusionPatterns = INCLUDE_ALL ; IPath [ ] exclusionPatterns = decodePatterns ( attributes , TAG_EXCLUDING ) ; if ( exclusionPatterns == null ) exclusionPatterns = EXCLUDE_NONE ; NodeList attributeList = getChildAttributes ( TAG_ATTRIBUTES , children , foundChildren ) ; ILoadpathAttribute [ ] extraAttributes = decodeExtraAttributes ( attributeList ) ; String [ ] unknownAttributes = null ; ArrayList unknownChildren = null ; if ( unknownElements != null ) { int unknownAttributeLength = attributes . getLength ( ) ; if ( unknownAttributeLength != 0 ) { unknownAttributes = new String [ unknownAttributeLength * 2 ] ; for ( int i = 0 ; i < unknownAttributeLength ; i ++ ) { Node attribute = attributes . item ( i ) ; unknownAttributes [ i * 2 ] = attribute . getNodeName ( ) ; unknownAttributes [ i * 2 + 1 ] = attribute . getNodeValue ( ) ; } } for ( int i = 0 , length = foundChildren . length ; i < length ; i ++ ) { if ( ! foundChildren [ i ] ) { Node node = children . item ( i ) ; if ( node . getNodeType ( ) != Node . ELEMENT_NODE ) continue ; if ( unknownChildren == null ) unknownChildren = new ArrayList ( ) ; StringBuffer buffer = new StringBuffer ( ) ; decodeUnknownNode ( node , buffer , project ) ; unknownChildren . add ( buffer . toString ( ) ) ; } } } ILoadpathEntry entry = null ; switch ( kind ) { case ILoadpathEntry . CPE_PROJECT : entry = new LoadpathEntry ( ILoadpathEntry . CPE_PROJECT , path , LoadpathEntry . INCLUDE_ALL , LoadpathEntry . EXCLUDE_NONE , extraAttributes , isExported ) ; break ; case ILoadpathEntry . CPE_LIBRARY : entry = RubyCore . newLibraryEntry ( path , extraAttributes , isExported ) ; break ; case ILoadpathEntry . CPE_SOURCE : String projSegment = path . segment ( 0 ) ; if ( projSegment != null && projSegment . equals ( project . getElementName ( ) ) ) { entry = RubyCore . newSourceEntry ( path , inclusionPatterns , exclusionPatterns , extraAttributes ) ; } else { if ( path . segmentCount ( ) == 1 ) { entry = RubyCore . newProjectEntry ( path , extraAttributes , isExported ) ; } else { entry = RubyCore . newSourceEntry ( path , inclusionPatterns , exclusionPatterns , extraAttributes ) ; } } break ; case ILoadpathEntry . CPE_VARIABLE : entry = RubyCore . newVariableEntry ( path , extraAttributes , isExported ) ; break ; case ILoadpathEntry . CPE_CONTAINER : entry = RubyCore . newContainerEntry ( path , extraAttributes , isExported ) ; break ; default : throw new AssertionFailedException ( Messages . bind (
2,717
<s> package org . rubypeople . rdt . debug . ui . launchConfigurations ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . debug . core . ILaunchConfiguration ; import org . eclipse . debug . core . ILaunchConfigurationWorkingCopy ; import org . eclipse . debug . ui . AbstractLaunchConfigurationTab ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . IWorkbenchPage ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . debug . ui . RdtDebugUiPlugin ; import org . rubypeople . rdt . launching . IRubyLaunchConfigurationConstants ; public abstract class RubyLaunchTab extends AbstractLaunchConfigurationTab { private ILaunchConfiguration fLaunchConfig ; protected IRubyElement getContext ( ) { IWorkbenchPage page = RdtDebugUiPlugin . getActivePage ( ) ; if ( page != null ) { ISelection selection = page .
2,718
<s> package com . aptana . rdt . internal . parser . warnings ; import java . util . ArrayList ; import java . util . List ; import org . jruby . ast . ArgsNode ; import org . jruby . ast . ClassNode ; import org . jruby . ast . FCallNode ; import org . jruby . ast . LocalAsgnNode ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import org . rubypeople . rdt . internal . core . util . ASTUtil ; import com . aptana . rdt . AptanaRDTPlugin ; import com . aptana . rdt . IProblem ; public class LocalVariablePossibleAttributeAccess extends RubyLintVisitor { private List < LocalAsgnNode > locals = new ArrayList < LocalAsgnNode > ( ) ; private List < String > attributes = new ArrayList < String > ( ) ; private boolean insideMethodSignature ; public LocalVariablePossibleAttributeAccess ( String contents ) { super ( AptanaRDTPlugin . getDefault ( ) . getOptions ( ) , contents ) ; } @ Override protected String getOptionKey ( ) { return AptanaRDTPlugin . COMPILER_PB_LOCAL_VARIABLE_POSSIBLE_ATTRIBUTE_ACCESS ; } @ Override public Object visitClassNode ( ClassNode iVisited ) { locals . clear ( ) ; attributes . clear ( ) ; return super . visitClassNode ( iVisited ) ; } @ Override public Object visitLocalAsgnNode ( LocalAsgnNode iVisited ) { if ( ! insideMethodSignature ) locals . add ( iVisited ) ; return super . visitLocalAsgnNode ( iVisited ) ; } @ Override public Object visitArgsNode ( ArgsNode iVisited ) { insideMethodSignature = true ; return super . visitArgsNode ( iVisited ) ; } @ Override public void exitArgsNode ( ArgsNode iVisited ) { super . exitArgsNode ( iVisited ) ; insideMethodSignature = false ; } @ Override public Object visitFCallNode ( FCallNode iVisited ) { String name = iVisited . getName ( ) ; if ( name . equals ( "" ) || name . equals ( "attr_writer" ) || name . equals ( "attr" ) ) { List < String > args = filterColonsFromSymbols ( ASTUtil . getArgumentsFromFunctionCall ( iVisited ) ) ; if ( name . equals ( "attr" ) ) { if ( args . size ( ) < 2 ) { return super . visitFCallNode ( iVisited ) ; } if ( !
2,719
<s> package org . oddjob . sql ; import java . sql . SQLException ; import java . util . ArrayList ; import java . util . List ; import java . util . concurrent . ScheduledFuture ; import java . util . concurrent . TimeUnit ; import junit . framework . TestCase ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . io . BufferType ; import org . oddjob . schedules . schedules . CountSchedule ; import org . oddjob . scheduling . LoosingOutcome ; import org . oddjob . scheduling . MockScheduledExecutorService ; import org . oddjob . scheduling . MockScheduledFuture ; import org . oddjob . scheduling . Outcome ; import org . oddjob . scheduling . WinningOutcome ; import org . oddjob . state . JobState ; import org . oddjob . state . StateListener ; import org . oddjob . state . State ; import org . oddjob . state . StateEvent ; public class SQLKeeperTest extends TestCase { ConnectionType ct ; @ Override protected void setUp ( ) throws Exception { ct = new ConnectionType ( ) ; ct . setDriver ( "" ) ; ct . setUrl ( "" ) ; ct . setUsername ( "sa" ) ; ct . setPassword ( "" ) ; BufferType buffer = new BufferType ( ) ; buffer . setText ( "" + "" + "" + "" + "" + "" ) ; buffer . configured ( ) ; SQLJob sql = new SQLJob ( ) ; sql . setArooaSession ( new StandardArooaSession ( ) ) ; sql . setInput ( buffer . toInputStream ( ) ) ; sql . setConnection ( ct . toValue ( ) ) ; sql . run ( ) ; } @ Override protected void tearDown ( ) throws Exception { BufferType buffer = new BufferType ( ) ; buffer . setText ( "shutdown" ) ; buffer . configured ( ) ; SQLJob sql = new SQLJob ( ) ; sql . setArooaSession ( new StandardArooaSession ( ) ) ; sql . setInput ( buffer . toInputStream ( ) ) ; sql . setConnection ( ct . toValue ( ) ) ; sql . run ( ) ; } private class OurListener implements StateListener { List < State > states = new ArrayList < State > ( ) ; @ Override public void jobStateChange ( StateEvent event ) { states . add ( event . getState ( ) ) ; } } private class OurFuture extends MockScheduledFuture < Void > { boolean canceled ; @ Override public boolean cancel ( boolean mayInterruptIfRunning ) { this . canceled = true ; return true ; } } private class OurExcecutor extends MockScheduledExecutorService { Runnable runnable ; OurFuture future = new OurFuture ( ) ; @ Override public ScheduledFuture < ? > schedule ( Runnable command , long delay , TimeUnit unit ) { this . runnable = command ; return future ; } } public void testFreshRun ( ) throws SQLException , ArooaConversionException { OurExcecutor executor = new OurExcecutor ( ) ; SQLKeeperService test = new SQLKeeperService ( ) ; test . setConnection ( ct . toValue ( ) ) ; test . setScheduleExecutorService ( executor ) ; test . start (
2,720
<s> package net . sf . sveditor . ui . tests . editor ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . StringInputStream ; import net . sf . sveditor . core . db . ISVDBFileFactory ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . SVDBMarker ; import net . sf . sveditor . core . db . index . ISVDBIndexIterator ; import net . sf . sveditor . core . tests . FileIndexIterator ; import net . sf . sveditor . ui . editor . ISVEditor ; import net . sf . sveditor . ui . tests . UiReleaseTests ; import net . sf . sveditor . ui . tests . editor . utils . AutoEditTester ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . ITextSelection ; public class SVEditorTester implements ISVEditor { private IDocument fDoc ; private AutoEditTester fAutoEditTester ; private ISVDBIndexIterator fIndexIt ; private SVDBFile fSVDBFile ; private ITextSelection fTextSel ; public SVEditorTester ( AutoEditTester auto_ed , ISVDBIndexIterator index_it , SVDBFile file ) { fAutoEditTester = auto_ed ; fIndexIt = index_it ; fSVDBFile = file ; fTextSel = null ; } public SVEditorTester ( String doc , String filename ) throws BadLocationException { fAutoEditTester = UiReleaseTests . createAutoEditTester ( ) ; fAutoEditTester . setContent ( doc ) ; ISVDBFileFactory factory = SVCorePlugin . createFileFactory ( null ) ; List < SVDBMarker > markers
2,721
<s> package org . rubypeople . rdt . refactoring . tests . core . movemethod ; import junit . framework . Test ; import junit . framework . TestSuite ; import org . rubypeople . rdt . refactoring . tests . FileTestSuite ; import org . rubypeople . rdt . refactoring . tests . core . movemethod . conditionchecks . TS_MoveMethodChecks ; public class TS_MoveMethod extends FileTestSuite { public static Test suite ( ) { TestSuite suite = createSuite ( "MoveMethod"
2,722
<s> package com . postmark . java ; import com . google . gson . Gson ; import com . google . gson . GsonBuilder ; import org . apache . http . client . HttpClient ; import org . apache . http . client . HttpResponseException ; import org . apache . http . client . ResponseHandler ; import org . apache . http . client . methods . HttpPost ; import org . apache . http . entity . StringEntity ; import org . apache . http . impl . client . BasicResponseHandler ; import org . apache . http . impl . client . DefaultHttpClient ; import org . joda . time . DateTime ; import java . util . List ; import java . util . logging . ConsoleHandler ; import java . util . logging . Level ; import java . util . logging . Logger ; public class PostmarkClient { private static Logger logger = Logger . getLogger ( "" ) ; private String serverToken ; private static GsonBuilder gsonBuilder = new GsonBuilder ( ) ; static { gsonBuilder . registerTypeAdapter ( DateTime . class , new DateTimeTypeAdapter ( ) ) ; gsonBuilder . setPrettyPrinting ( ) ; gsonBuilder . setExclusionStrategies ( new SkipMeExclusionStrategy ( Boolean . class ) ) ; logger . addHandler ( new ConsoleHandler ( ) ) ; logger . setLevel ( Level . ALL ) ; } public PostmarkClient ( String serverToken ) { this . serverToken = serverToken ; } public PostmarkResponse sendMessage ( String from , String to , String replyTo , String cc , String subject , String body , boolean isHTML , String tag ) throws PostmarkException { return sendMessage ( from , to , replyTo , cc , subject , body , isHTML , tag , null ) ; } public PostmarkResponse sendMessage ( String from , String to , String replyTo , String cc , String subject , String body , boolean isHTML ,
2,723
<s> package net . sf . sveditor . ui . editor ; import java . util . EnumMap ; import org . eclipse . jface . text . TextAttribute ; import org . eclipse . jface . text . source . SourceViewer ; public class SVHighlightingManager { private static EnumMap < SVEditorColors , TextAttribute > fHighlightAttr ; static { if ( fHighlightAttr == null ) { EnumMap < SVEditorColors , TextAttribute > tmp = new EnumMap < SVEditorColors , TextAttribute > ( SVEditorColors . class ) ; for ( SVEditorColors c : new SVEditorColors [ ]
2,724
<s> package com . asakusafw . testtools . db ; import java . io . Closeable ; import java . sql . Connection ; import java . sql . DriverManager ; import java . sql . ResultSet ; import java . sql . SQLException ; import java . sql . Statement ; import java . util . List ; import com . asakusafw . testtools . ColumnInfo ; import com . asakusafw . testtools . Configuration ; public final class DbUtils { public static void createTable ( Connection conn , List < ColumnInfo > list ) throws SQLException { if ( list == null || list . size ( ) == 0 ) { throw new RuntimeException ( "-UNK-" ) ; } StringBuilder sb = new StringBuilder ( ) ; boolean firstElement = true ; for ( ColumnInfo info : list ) { if ( firstElement ) { firstElement = false ; sb . append ( "" ) ; sb . append ( info . getTableName ( ) ) ; sb . append ( "(n" ) ; } else { sb . append ( ",n" ) ; } sb . append ( " " ) ; sb . append ( String . format ( " %-32s %s" , info . getColumnName ( ) , info . getDataType ( ) . getDataTypeString ( ) ) ) ; switch ( info . getDataType ( ) ) { case CHAR : case VARCHAR : sb . append ( String . format ( "(%d)" , info . getCharacterMaximumLength ( ) ) ) ; break ; case DECIMAL : sb . append ( String . format ( "(%d,%d)" , info . getNumericPrecision ( ) , info . getNumericScale ( ) ) ) ; break ; default : break ; } if ( info . getColumnComment ( ) != null && info . getColumnComment ( ) . length ( ) != 0 ) { sb . append ( " COMMENT " ) ; sb . append ( "'" ) ; sb . append ( info . getColumnComment ( ) ) ; sb . append ( "'" ) ; } } sb . append ( "" ) ; String sql = sb . toString ( ) ; Statement stmt = null ; try { stmt = conn . createStatement ( ) ; stmt . executeUpdate ( sql ) ; } finally { closeQuietly ( stmt ) ; } } public static void dropTable ( Connection conn , String tablename ) throws SQLException { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "" ) ; sb . append ( tablename ) ; String sql = sb . toString ( ) ; Statement stmt = null ; try { stmt = conn . createStatement ( ) ; stmt . executeUpdate ( sql ) ; } finally { closeQuietly ( stmt ) ; } } public static void truncateTable ( Connection conn , String
2,725
<s> package com . aptana . rdt . internal . core . gems ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . Status ; import org . eclipse . core . runtime . jobs . Job ; import org . osgi . framework . Bundle ; import org . rubypeople . rdt . launching . IVMInstall ; import org . rubypeople . rdt . launching . IVMInstallChangedListener ; import org . rubypeople . rdt . launching . PropertyChangeEvent ; import org . rubypeople . rdt . launching . RubyRuntime ; import com . aptana . rdt . AptanaRDTPlugin ; public class RubyGemsInitializer extends Job implements IVMInstallChangedListener { private boolean initialized ; public RubyGemsInitializer ( ) { super ( "" ) ; } public void
2,726
<s> package org . oddjob . logging . cache ; import java . util . ArrayList ; import java . util . List ; import org . oddjob . Structural ; import org . oddjob . logging . ArchiveNameResolver ; import org . oddjob . logging . LogArchiver ; import org . oddjob . structural . StructuralEvent ; import org . oddjob . structural . StructuralListener ; public class StructuralArchiverCache extends AbstractArchiverCache { private final StructuralListener structuralListener = new StructuralListener ( ) { public void childAdded ( StructuralEvent event ) { Object node = event . getChild ( ) ; addChild ( node ) ; } public void childRemoved ( StructuralEvent event ) { Object node = event . getChild ( ) ; removeChild ( node ) ; } } ; private final List < Structural > listeningTo = new ArrayList < Structural > ( ) ; public StructuralArchiverCache ( Object root , ArchiveNameResolver resolver ) { this ( root , LogArchiver . MAX_HISTORY , resolver ) ; } public StructuralArchiverCache ( Object root , int maxHistory , ArchiveNameResolver resolver ) { super ( resolver , maxHistory ) ; addChild ( root ) ; } void addChild ( Object node ) { addArchive ( node ) ; if ( node instanceof LogArchiver ) { return ; } if ( node instanceof Structural ) { ( ( Structural ) node ) .
2,727
<s> package com . asakusafw . compiler . flow . stage ; import java . io . IOException ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import org . apache . hadoop . io . NullWritable ; import org . apache . hadoop . mapreduce . Mapper ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . common . NameGenerator ; import com . asakusafw . compiler . common . Naming ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . DataClass ; import com . asakusafw . compiler . flow . FlowCompilingEnvironment ; import com . asakusafw . compiler . flow . FlowElementProcessor ; import com . asakusafw . compiler . flow . plan . FlowBlock ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . java . model . syntax . Comment ; import com . asakusafw . utils . java . model . syntax . CompilationUnit ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . FieldDeclaration ; 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 . Name ; import com . asakusafw . utils . java . model . syntax . QualifiedName ; 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 . ImportBuilder ; import com . asakusafw . utils . java . model . util . JavadocBuilder ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . vocabulary . flow . graph . FlowElementInput ; import com . asakusafw . vocabulary . flow . graph . FlowElementPortDescription ; public class MapperEmitter { static final Logger LOG = LoggerFactory . getLogger ( MapperEmitter . class ) ; private final FlowCompilingEnvironment environment ; public MapperEmitter
2,728
<s> package com . asakusafw . testdriver . core ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import org . junit . Test ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . vocabulary . external . ImporterDescription ; public class AbstractImporterPreparatorTest { @ Test public void getDescriptionClass ( ) { class Target extends AbstractImporterPreparator < DummyImporterDescription > { @ Override public void truncate ( DummyImporterDescription description ) { return ; } @ Override public < V > ModelOutput < V > createOutput ( DataModelDefinition < V > definition , DummyImporterDescription description ) { return null ; } } Target obj = new Target (
2,729
<s> package org . rubypeople . rdt . refactoring . editprovider ; import org . eclipse . text . edits . InsertEdit ; import org . eclipse . text . edits . TextEdit ; import org . jruby . ast . Node ; import org . rubypeople . rdt . refactoring . util . Constants ; public abstract class InsertEditProvider extends EditProvider { public static final int INSERT_AFTER_EXISTING_NODE = 0 ; public static final int INSERT_AT_BEGIN_OF_LINE = 1 ; private static final int DEFAULT_INSERT_TYPE = INSERT_AFTER_EXISTING_NODE ; private int insertType ; public InsertEditProvider ( boolean doFormat ) { super ( doFormat , false ) ; insertType = DEFAULT_INSERT_TYPE ; } public
2,730
<s> package org . rubypeople . rdt . refactoring . classnodeprovider ; import org . rubypeople . rdt . refactoring . documentprovider . IDocumentProvider ; public class AllFilesClassNodeProvider extends ClassNodeProvider { public AllFilesClassNodeProvider ( IDocumentProvider docProvider ) { super ( docProvider , false ) ; for ( String fileName : docProvider
2,731
<s> package com . asakusafw . utils . java . internal . model . util ; import java . util . List ; import com . asakusafw . utils . java . model . syntax . * ; import com . asakusafw . utils . java . model . util . NoThrow ; public final class ModelDigester extends StrictVisitor < Void , DigestContext , NoThrow > { public static final ModelDigester INSTANCE = new ModelDigester ( ) ; private ModelDigester ( ) { } public static int compute ( Model model ) { if ( model == null ) { throw new IllegalArgumentException ( "" ) ; } DigestContext digest = new DigestContext ( ) ; model . accept ( INSTANCE , digest ) ; return digest . total ; } @ Override public Void visitAlternateConstructorInvocation ( AlternateConstructorInvocation elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getTypeArguments ( ) , context ) ; digest ( elem . getArguments ( ) , context ) ; return null ; } @ Override public Void visitAnnotationDeclaration ( AnnotationDeclaration elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getJavadoc ( ) , context ) ; digest ( elem . getModifiers ( ) , context ) ; digest ( elem . getName ( ) , context ) ; digest ( elem . getBodyDeclarations ( ) , context ) ; return null ; } @ Override public Void visitAnnotationElement ( AnnotationElement elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getName ( ) , context ) ; digest ( elem . getExpression ( ) , context ) ; return null ; } @ Override public Void visitAnnotationElementDeclaration ( AnnotationElementDeclaration elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getJavadoc ( ) , context ) ; digest ( elem . getModifiers ( ) , context ) ; digest ( elem . getType ( ) , context ) ; digest ( elem . getName ( ) , context ) ; digest ( elem . getDefaultExpression ( ) , context ) ; return null ; } @ Override public Void visitArrayAccessExpression ( ArrayAccessExpression elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getArray ( ) , context ) ; digest ( elem . getIndex ( ) , context ) ; return null ; } @ Override public Void visitArrayCreationExpression ( ArrayCreationExpression elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getType ( ) , context ) ; digest ( elem . getDimensionExpressions ( ) , context ) ; digest ( elem . getArrayInitializer ( ) , context ) ; return null ; } @ Override public Void visitArrayInitializer ( ArrayInitializer elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getElements ( ) , context ) ; return null ; } @ Override public Void visitArrayType ( ArrayType elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getComponentType ( ) , context ) ; return null ; } @ Override public Void visitAssertStatement ( AssertStatement elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getExpression ( ) , context ) ; digest ( elem . getMessage ( ) , context ) ; return null ; } @ Override public Void visitAssignmentExpression ( AssignmentExpression elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getLeftHandSide ( ) , context ) ; digest ( elem . getOperator ( ) , context ) ; digest ( elem . getRightHandSide ( ) , context ) ; return null ; } @ Override public Void visitBasicType ( BasicType elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getTypeKind ( ) , context ) ; return null ; } @ Override public Void visitBlock ( Block elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getStatements ( ) , context ) ; return null ; } @ Override public Void visitBlockComment ( BlockComment elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getString ( ) , context ) ; return null ; } @ Override public Void visitBreakStatement ( BreakStatement elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getTarget ( ) , context ) ; return null ; } @ Override public Void visitCastExpression ( CastExpression elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getType ( ) , context ) ; digest ( elem . getExpression ( ) , context ) ; return null ; } @ Override public Void visitCatchClause ( CatchClause elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getParameter ( ) , context ) ; digest ( elem . getBody ( ) , context ) ; return null ; } @ Override public Void visitClassBody ( ClassBody elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getBodyDeclarations ( ) , context ) ; return null ; } @ Override public Void visitClassDeclaration ( ClassDeclaration elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getJavadoc ( ) , context ) ; digest ( elem . getModifiers ( ) , context ) ; digest ( elem . getName ( ) , context ) ; digest ( elem . getTypeParameters ( ) , context ) ; digest ( elem . getSuperClass ( ) , context ) ; digest ( elem . getSuperInterfaceTypes ( ) , context ) ; digest ( elem . getBodyDeclarations ( ) , context ) ; return null ; } @ Override public Void visitClassInstanceCreationExpression ( ClassInstanceCreationExpression elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getQualifier ( ) , context ) ; digest ( elem . getTypeArguments ( ) , context ) ; digest ( elem . getType ( ) , context ) ; digest ( elem . getArguments ( ) , context ) ; digest ( elem . getBody ( ) , context ) ; return null ; } @ Override public Void visitClassLiteral ( ClassLiteral elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getType ( ) , context ) ; return null ; } @ Override public Void visitCompilationUnit ( CompilationUnit elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getPackageDeclaration ( ) , context ) ; digest ( elem . getImportDeclarations ( ) , context ) ; digest ( elem . getTypeDeclarations ( ) , context ) ; digest ( elem . getComments ( ) , context ) ; return null ; } @ Override public Void visitConditionalExpression ( ConditionalExpression elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getCondition ( ) , context ) ; digest ( elem . getThenExpression ( ) , context ) ; digest ( elem . getElseExpression ( ) , context ) ; return null ; } @ Override public Void visitConstructorDeclaration ( ConstructorDeclaration elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getJavadoc ( ) , context ) ; digest ( elem . getModifiers ( ) , context ) ; digest ( elem . getTypeParameters ( ) , context ) ; digest ( elem . getName ( ) , context ) ; digest ( elem . getFormalParameters ( ) , context ) ; digest ( elem . getExceptionTypes ( ) , context ) ; digest ( elem . getBody ( ) , context ) ; return null ; } @ Override public Void visitContinueStatement ( ContinueStatement elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getTarget ( ) , context ) ; return null ; } @ Override public Void visitDoStatement ( DoStatement elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getBody ( ) , context ) ; digest ( elem . getCondition ( ) , context ) ; return null ; } @ Override public Void visitDocBlock ( DocBlock elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getTag ( ) , context ) ; digest ( elem . getElements ( ) , context ) ; return null ; } @ Override public Void visitDocField ( DocField elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getType ( ) , context ) ; digest ( elem . getName ( ) , context ) ; return null ; } @ Override public Void visitDocMethod ( DocMethod elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getType ( ) , context ) ; digest ( elem . getName ( ) , context ) ; digest ( elem . getFormalParameters ( ) , context ) ; return null ; } @ Override public Void visitDocMethodParameter ( DocMethodParameter elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getType ( ) , context ) ; digest ( elem . getName ( ) , context ) ; digest ( elem . isVariableArity ( ) , context ) ; return null ; } @ Override public Void visitDocText ( DocText elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getString ( ) , context ) ; return null ; } @ Override public Void visitEmptyStatement ( EmptyStatement elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; return null ; } @ Override public Void visitEnhancedForStatement ( EnhancedForStatement elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getParameter ( ) , context ) ; digest ( elem . getExpression ( ) , context ) ; digest ( elem . getBody ( ) , context ) ; return null ; } @ Override public Void visitEnumConstantDeclaration ( EnumConstantDeclaration elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getJavadoc ( ) , context ) ; digest ( elem . getModifiers ( ) , context ) ; digest ( elem . getName ( ) , context ) ; digest ( elem . getArguments ( ) , context ) ; digest ( elem . getBody ( ) , context ) ; return null ; } @ Override public Void visitEnumDeclaration ( EnumDeclaration elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getJavadoc ( ) , context ) ; digest ( elem . getModifiers ( ) , context ) ; digest ( elem . getName ( ) , context ) ; digest ( elem . getSuperInterfaceTypes ( ) , context ) ; digest ( elem . getConstantDeclarations ( ) , context ) ; digest ( elem . getBodyDeclarations ( ) , context ) ; return null ; } @ Override public Void visitExpressionStatement ( ExpressionStatement elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getExpression ( ) , context ) ; return null ; } @ Override public Void visitFieldAccessExpression ( FieldAccessExpression elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getQualifier ( ) , context ) ; digest ( elem . getName ( ) , context ) ; return null ; } @ Override public Void visitFieldDeclaration ( FieldDeclaration elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getJavadoc ( ) , context ) ; digest ( elem . getModifiers ( ) , context ) ; digest ( elem . getType ( ) , context ) ; digest ( elem . getVariableDeclarators ( ) , context ) ; return null ; } @ Override public Void visitForStatement ( ForStatement elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getInitialization ( ) , context ) ; digest ( elem . getCondition ( ) , context ) ; digest ( elem . getUpdate ( ) , context ) ; digest ( elem . getBody ( ) , context ) ; return null ; } @ Override public Void visitFormalParameterDeclaration ( FormalParameterDeclaration elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getModifiers ( ) , context ) ; digest ( elem . getType ( ) , context ) ; digest ( elem . isVariableArity ( ) , context ) ; digest ( elem . getName ( ) , context ) ; digest ( elem . getExtraDimensions ( ) , context ) ; return null ; } @ Override public Void visitIfStatement ( IfStatement elem , DigestContext context ) { digest ( elem . getModelKind ( ) , context ) ; digest ( elem . getCondition ( ) , context ) ; digest ( elem . getThenStatement ( ) , context ) ; digest ( elem . getElseStatement ( ) , context ) ; return null ; } @ Override
2,732
<s> package net . sf . sveditor . core . db . stmt ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . expr . SVDBExpr ;
2,733
<s> package org . oddjob . jmx . client ; import java . io . Serializable ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Map ; import java . util . Set ; import javax . management . Attribute ; import javax . management . AttributeList ; import javax . management . AttributeNotFoundException ; import javax . management . DynamicMBean ; import javax . management . InstanceNotFoundException ; import javax . management . IntrospectionException ; import javax . management . InvalidAttributeValueException ; import javax . management . MBeanAttributeInfo ; import javax . management . MBeanConstructorInfo ; import javax . management . MBeanException ; import javax . management . MBeanInfo ; import javax . management . MBeanNotificationInfo ; import javax . management . MBeanOperationInfo ; import javax . management . MBeanServer ; import javax . management . MBeanServerFactory ; import javax . management . NotificationBroadcasterSupport ; import javax . management . ObjectName ; import javax . management . ReflectionException ; import junit . framework . TestCase ; import org . apache . commons . beanutils . DynaBean ; import org . apache . commons . beanutils . DynaClass ; import org . apache . commons . beanutils . DynaProperty ; import org . apache . log4j . Logger ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . ClassResolver ; import org . oddjob . arooa . MockArooaDescriptor ; import org . oddjob . arooa . MockArooaSession ; import org . oddjob . arooa . MockClassResolver ; import org . oddjob . arooa . beanutils . BeanUtilsPropertyAccessor ; import org . oddjob . arooa . registry . Address ; import org . oddjob . arooa . registry . BeanRegistry ; import org . oddjob . arooa . registry . MockBeanRegistry ; import org . oddjob . arooa . registry . Path ; import org . oddjob . arooa . registry . ServerId ; import org . oddjob . arooa . registry . SimpleBeanRegistry ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . describe . UniversalDescriber ; import org . oddjob . jmx . RemoteOddjobBean ; import org . oddjob . jmx . handlers . DynaBeanHandlerFactory ; import org . oddjob . jmx . handlers . LogPollableHandlerFactory ; import org . oddjob . jmx . handlers . ObjectInterfaceHandlerFactory ; import org . oddjob . jmx . handlers . RemoteOddjobHandlerFactory ; import org . oddjob . jmx . handlers . RunnableHandlerFactory ; import org . oddjob . jmx . server . MockServerSession ; import org . oddjob . jmx . server . OddjobMBean ; import org . oddjob . jmx . server . OddjobMBeanFactory ; import org . oddjob . jmx . server . ServerContext ; import org . oddjob . jmx . server . ServerContextImpl ; import org . oddjob . jmx . server . ServerInfo ; import org . oddjob . jmx . server . ServerInterfaceManagerFactoryImpl ; import org . oddjob . jmx . server . ServerModel ; import org . oddjob . jmx . server . ServerModelImpl ; import org . oddjob . logging . LogEnabled ; import org . oddjob . logging . LogEvent ; import org . oddjob . logging . LogLevel ; import org . oddjob . util . MockThreadManager ; public class ClientNodeTest extends TestCase { public static final Logger logger = Logger . getLogger ( ClientNodeTest . class ) ; public interface OJMBeanInternals extends RemoteOddjobBean { public String toString ( ) ; } int unique ; public abstract class BaseMockOJMBean extends NotificationBroadcasterSupport implements OJMBeanInternals { int instance = unique ++ ; protected final Set < ClientHandlerResolver < ? > > handlerFactories = new HashSet < ClientHandlerResolver < ? > > ( ) ; { handlerFactories . add ( new RemoteOddjobHandlerFactory ( ) . clientHandlerFactory ( ) ) ; handlerFactories . add ( new ObjectInterfaceHandlerFactory ( ) . clientHandlerFactory ( ) ) ; } public ServerInfo serverInfo ( ) { return new ServerInfo ( new Address ( new ServerId ( url ( ) ) , new Path ( id ( ) ) ) , ( ClientHandlerResolver [ ] ) handlerFactories . toArray ( new ClientHandlerResolver [ 0 ] ) ) ; } public void noop ( ) { } protected String url ( ) { return "//test" ; } protected String id ( ) { return "x" + instance ; } public String toString ( ) { return "MockOJMBean." ; } public String loggerName ( ) { return "" ; } } public interface SimpleMBean extends OJMBeanInternals { } public class Simple extends BaseMockOJMBean implements SimpleMBean { public String toString ( ) { return "test" ; } } private class OurArooaSession extends MockArooaSession { @ Override public ArooaDescriptor getArooaDescriptor ( ) { return new MockArooaDescriptor ( ) { @ Override public ClassResolver getClassResolver ( ) { return new MockClassResolver ( ) { @ Override public Class < ? > findClass ( String className ) { try { return Class . forName ( className ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( e ) ; } } } ; } } ; } } public void testSimple ( ) throws Exception { Simple mb = new Simple ( ) ; MBeanServer mbs = MBeanServerFactory . createMBeanServer ( ) ; ObjectName on = new ObjectName ( "" ) ; mbs . registerMBean ( mb , on ) ; ClientSessionImpl clientSession = new ClientSessionImpl ( mbs , new DummyNotificationProcessor ( ) , new OurArooaSession ( ) , logger ) ; Object proxy = clientSession . create ( on ) ; assertEquals ( "test" , proxy . toString ( ) ) ; } public void testEquals ( ) throws Exception { Simple mb = new Simple ( ) ; MBeanServer mbs = MBeanServerFactory . createMBeanServer ( ) ; ObjectName on = new ObjectName ( "" ) ; mbs . registerMBean ( mb , on ) ; ClientSessionImpl clientSession = new ClientSessionImpl ( mbs , new DummyNotificationProcessor ( ) , new OurArooaSession ( ) , logger ) ; Object proxy = clientSession . create ( on ) ; assertEquals ( proxy , proxy ) ; assertEquals ( proxy . hashCode ( ) , proxy . hashCode ( ) ) ; } public interface MockRunnableMBean extends Runnable , OJMBeanInternals { } public class MockRunnable extends BaseMockOJMBean implements MockRunnableMBean { boolean ran ; public MockRunnable ( ) { handlerFactories . add ( new RunnableHandlerFactory ( ) . clientHandlerFactory ( ) ) ; } public void run ( ) { ran = true ; } } private BeanRegistry cr ; public void setUp ( ) { logger . debug ( "" + getName ( ) + "" ) ; System . setProperty ( "" , "trace" ) ; cr = new SimpleBeanRegistry ( ) ; cr . register ( "this" , this ) ; } public void testRunnable ( ) throws Exception { MockRunnable mb = new MockRunnable ( ) ; MBeanServer mbs = MBeanServerFactory . createMBeanServer ( ) ; ObjectName on = new ObjectName ( "" ) ; mbs . registerMBean ( mb , on ) ; ClientSessionImpl clientSession = new ClientSessionImpl ( mbs , new DummyNotificationProcessor ( ) , new OurArooaSession ( ) , logger ) ; Object proxy = clientSession . create ( on ) ; assertTrue ( "Runnable" , proxy instanceof Runnable ) ; ( ( Runnable ) proxy ) . run ( ) ; assertTrue ( "Ran" , mb . ran ) ; } public static class Fred implements Serializable { private static final long serialVersionUID = 20051117 ; public String getFruit ( ) { return "apples" ; } } public class MyDC implements DynaClass , Serializable { private static final long serialVersionUID = 20051117 ; public DynaProperty [ ] getDynaProperties ( ) { return new DynaProperty [ ] { new DynaProperty ( "fred" , Fred . class ) , } ; } public DynaProperty getDynaProperty ( String arg0 ) { return new DynaProperty ( arg0 ) ; } public String getName ( ) { return "MyDynaClass" ; } public DynaBean newInstance ( ) throws IllegalAccessException , InstantiationException { throw new UnsupportedOperationException ( "newInstance" ) ; } } public class Bean implements DynaBean , LogEnabled { public boolean contains ( String name , String key ) { logger . debug ( "contains(" + name + ", " + key + ")" ) ; return false ; } public Object get ( String name ) { logger . debug ( "get(" + name + ")" ) ; if ( "fred" . equals ( name ) ) { return new Fred ( ) ; } else if ( "description" . equals ( name ) ) { Map < Object , Object > m = new HashMap < Object , Object > ( ) ; m . put ( "fooled" , "you" ) ; return m ; } return null ; } public Object get ( String name , int index ) { logger . debug ( "get(" + name + ", " + index + ")" ) ; return null ; } public Object get ( String name , String key ) { logger . debug ( "get(" + name + ", " + key + ")" ) ; return null ; } public DynaClass getDynaClass ( ) { logger . debug ( "getDynaClass" ) ; return new MyDC ( ) ; } public void remove ( String name , String key ) { logger . debug ( "remove(" + name + ", " + key + ")" ) ; } public void set ( String name , int index , Object value ) { logger . debug ( "set(" + name + ", " + index + ", " + value + ")" ) ; } public void set ( String name , Object value ) { logger . debug ( "set(" + name + ", " + value + ")" ) ; } public void set ( String name , String key , Object value ) { logger . debug ( "set(" + name + ", " + key + ", " + value + ")" ) ; } public String loggerName ( ) { return "" ; } } public class MyDynamicMBean extends NotificationBroadcasterSupport implements DynamicMBean { public Object getAttribute ( String attribute ) throws AttributeNotFoundException , MBeanException , ReflectionException { logger . debug ( "" + attribute + "]" ) ; throw new UnsupportedOperationException ( ) ; } public AttributeList getAttributes ( String [ ] attributes ) { return null ; } public MBeanInfo getMBeanInfo ( ) { return new MBeanInfo ( this . getClass ( ) . getName ( ) , "Test MBean" , new MBeanAttributeInfo [ 0 ] , new MBeanConstructorInfo [ 0 ] , new MBeanOperationInfo [ 0 ] , new MBeanNotificationInfo [ 0 ] ) ; } public Object invoke ( String actionName , Object [ ] arguments , String [ ] signature ) throws MBeanException , ReflectionException { logger . debug ( "" + actionName + "]" ) ; if ( "toString" . equals ( actionName ) ) { return "" ; } else if ( "serverInfo" . equals ( actionName ) ) { return new ServerInfo ( new Address ( new ServerId ( "//foo/" ) , new Path ( "whatever" ) ) , new ClientHandlerResolver [ ] { new ObjectInterfaceHandlerFactory ( ) . clientHandlerFactory ( ) , new RemoteOddjobHandlerFactory ( ) . clientHandlerFactory ( ) , new DynaBeanHandlerFactory ( ) . clientHandlerFactory ( ) } ) ; } else if ( "toString" . equals ( actionName ) ) { return "" ; } else if ( "loggerName" . equals ( actionName ) ) { return "" ; } else if ( "getDynaClass" . equals ( actionName ) ) { return new MyDC ( ) ; } else if ( "get" . equals ( actionName ) ) { return new Fred ( ) ; } else { throw new MBeanException ( new UnsupportedOperationException ( "" + actionName + "]" ) ) ; } } public void setAttribute ( Attribute attribute ) throws AttributeNotFoundException , InvalidAttributeValueException , MBeanException , ReflectionException { throw new UnsupportedOperationException ( ) ; } public AttributeList setAttributes ( AttributeList attributes ) { throw new UnsupportedOperationException ( ) ; } } public void testSimpleGet ( ) throws Exception { MyDynamicMBean firstBean = new MyDynamicMBean ( ) ; MBeanServer mbs = MBeanServerFactory . createMBeanServer ( ) ; ObjectName on = new ObjectName ( "" ) ; mbs . registerMBean ( firstBean , on ) ; ClientSessionImpl clientSession = new ClientSessionImpl ( mbs , new DummyNotificationProcessor ( ) , new
2,734
<s> package org . rubypeople . rdt . internal . core . builder ; import java . util . List ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . SubMonitor ; import org . rubypeople . rdt . core . compiler . BuildContext ; public class CleanRdtCompiler extends AbstractRdtCompiler { private List < BuildContext > contexts ; public CleanRdtCompiler ( IProject project ) { this ( project , new MarkerManager ( ) ) ; } public CleanRdtCompiler ( IProject project , IMarkerManager markerManager ) {
2,735
<s> package org . rubypeople . rdt . debug . ui ; import java . net . MalformedURLException ; import java . net . URL ; import org . eclipse . jface . action . IAction ; import org . eclipse . jface . resource . ImageDescriptor ; import org . eclipse . jface . resource . ImageRegistry ; import org . eclipse . swt . graphics . Image ; import org . rubypeople . rdt . internal . debug . ui . RdtDebugUiPlugin ; public class RdtDebugUiImages { protected static final String NAME_PREFIX = "" ; protected static final int NAME_PREFIX_LENGTH = NAME_PREFIX . length ( ) ; protected static URL iconBaseURL ; static { iconBaseURL = RdtDebugUiPlugin . getDefault ( ) . getBundle ( ) . getEntry ( "/icons/full/" ) ; } protected static final ImageRegistry IMAGE_REGISTRY = new ImageRegistry ( ) ; protected static final String CTOOL_PREFIX = "ctool16" ; protected static final String EVIEW_PREFIX = "eview16" ; public static final String IMG_EVIEW_ARGUMENTS_TAB = NAME_PREFIX + "" ; public static final ImageDescriptor DESC_EVIEW_ARGUMENTS_TAB = createManaged ( EVIEW_PREFIX , IMG_EVIEW_ARGUMENTS_TAB ) ; public static Image get ( String key ) { return IMAGE_REGISTRY . get ( key ) ; } public static void setToolImageDescriptors ( IAction action , String iconName ) { setImageDescriptors ( action , "tool16" , iconName ) ; } public static void setLocalImageDescriptors ( IAction action , String iconName ) { setImageDescriptors ( action , "lcl16" , iconName ) ; } public static ImageRegistry getImageRegistry ( ) { return IMAGE_REGISTRY ; } protected static void setImageDescriptors ( IAction action , String type , String relPath ) { try { ImageDescriptor id = ImageDescriptor . createFromURL ( makeIconFileURL ( "d" + type , relPath ) ) ; if ( id != null ) action . setDisabledImageDescriptor ( id ) ; } catch ( MalformedURLException e ) { } try { ImageDescriptor id = ImageDescriptor . createFromURL ( makeIconFileURL ( "c" + type , relPath ) ) ; if ( id != null ) action . setHoverImageDescriptor ( id ) ; } catch ( MalformedURLException e ) { }
2,736
<s> package com . asakusafw . modelgen . util ; import static org . hamcrest . CoreMatchers . * ; import static org . junit . Assert . * ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import org . junit . Test ; import com . asakusafw . modelgen . model . JoinedModelDescription ; import com . asakusafw . modelgen . model . ModelDescription ; import com . asakusafw . modelgen . model . ModelProperty ; import com . asakusafw . modelgen . model . PropertyTypeKind ; import com . asakusafw . modelgen . model . Source ; import com . asakusafw . modelgen . model . StringType ; import com . asakusafw . modelgen . model . TableModelDescription ; public class JoinedModelBuilderTest { @ Test public void simple ( ) { TableModelDescription a = new TableModelBuilder ( "A" ) . add ( null , "id" , PropertyTypeKind . LONG ) . add ( null , "hoge" , new StringType ( 255 ) ) . toDescription ( ) ; TableModelDescription b = new TableModelBuilder ( "B" ) . add ( null , "id" , PropertyTypeKind . LONG ) . add ( null , "foo" , new StringType ( 255 ) ) . toDescription ( ) ; JoinedModelBuilder target = new JoinedModelBuilder ( "J" , a , "a" , b , "b" ) ; target . on ( "a.id" , "b.id" ) ; target . add ( "id" , "a.id" ) ; target . add ( "hoge" , "a.hoge" ) ; target . add ( "bar" , "b.foo" ) ; JoinedModelDescription desc = target . toDescription ( ) ; assertThat ( desc . getFromModel ( ) . getSimpleName ( ) , is ( "A" ) ) ; assertThat ( desc . getJoinModel ( ) . getSimpleName ( ) , is ( "B" ) ) ; assertThat ( desc . getFromCondition ( ) , is ( sources ( a , "id" ) ) ) ; assertThat ( desc . getJoinCondition ( ) , is ( sources ( b , "id" ) ) ) ; List < ModelProperty > props = desc . getProperties ( ) ; assertThat ( props . size ( ) , is ( 3 ) ) ; ModelProperty id = props . get ( 0 ) ; assertThat ( id . getName ( ) , is ( "id" ) ) ; assertThat ( id . getType ( ) . getKind ( ) , is ( PropertyTypeKind . LONG ) ) ;
2,737
<s> package org . rubypeople . rdt . internal . core . search . matching ; import java . util . ArrayList ; import org . jruby . ast . Node ; import org . rubypeople . rdt . core . search . SearchMatch ; import org . rubypeople . rdt . core . search . SearchPattern ; import org . rubypeople . rdt . internal . compiler . util . HashtableOfLong ; import org . rubypeople . rdt . internal . compiler . util . SimpleLookupTable ; import org . rubypeople . rdt . internal . compiler . util . SimpleSet ; import org . rubypeople . rdt . internal . core . util . Util ; public class MatchingNodeSet { SimpleLookupTable matchingNodes = new SimpleLookupTable ( 3 ) ; private HashtableOfLong matchingNodesKeys = new HashtableOfLong ( 3 ) ; static Integer EXACT_MATCH = new Integer ( SearchMatch . A_ACCURATE ) ; static Integer POTENTIAL_MATCH = new Integer ( SearchMatch . A_INACCURATE ) ; static Integer ERASURE_MATCH = new Integer ( SearchPattern . R_ERASURE_MATCH ) ; public boolean mustResolve ; SimpleSet possibleMatchingNodesSet = new SimpleSet ( 7 ) ; private HashtableOfLong possibleMatchingNodesKeys = new HashtableOfLong ( 7 ) ; public MatchingNodeSet ( boolean mustResolvePattern ) { super ( ) ; mustResolve = mustResolvePattern ; } public int addMatch ( Node node , int matchLevel ) { int maskedLevel = matchLevel & PatternLocator . MATCH_LEVEL_MASK ; switch ( maskedLevel ) { case PatternLocator . INACCURATE_MATCH : if ( matchLevel != maskedLevel ) { addTrustedMatch ( node , new Integer ( SearchMatch . A_INACCURATE + ( matchLevel & PatternLocator . FLAVORS_MASK ) ) ) ; } else { addTrustedMatch ( node , POTENTIAL_MATCH ) ; } break ; case PatternLocator . POSSIBLE_MATCH : addPossibleMatch ( node ) ; break ; case PatternLocator . ERASURE_MATCH : if ( matchLevel != maskedLevel ) { addTrustedMatch ( node , new Integer ( SearchPattern . R_ERASURE_MATCH + ( matchLevel & PatternLocator . FLAVORS_MASK ) ) ) ; } else { addTrustedMatch ( node , ERASURE_MATCH ) ; } break ; case PatternLocator . ACCURATE_MATCH : if ( matchLevel != maskedLevel ) { addTrustedMatch ( node , new Integer ( SearchMatch . A_ACCURATE + ( matchLevel & PatternLocator . FLAVORS_MASK ) ) ) ; } else { addTrustedMatch ( node , EXACT_MATCH ) ; } break ; } return matchLevel ; } public void addPossibleMatch ( Node node ) { long key = ( ( ( long ) node . getPosition ( ) . getStartOffset ( ) ) << 32 ) + node . getPosition ( ) . getEndOffset ( ) ; Node existing = ( Node ) this . possibleMatchingNodesKeys . get ( key ) ; if ( existing != null && existing . getClass ( ) . equals ( node . getClass ( ) ) ) this . possibleMatchingNodesSet . remove ( existing ) ; this . possibleMatchingNodesSet . add ( node ) ; this . possibleMatchingNodesKeys . put ( key , node ) ; } public void addTrustedMatch ( Node node , boolean isExact ) { addTrustedMatch ( node , isExact ? EXACT_MATCH : POTENTIAL_MATCH ) ; } void addTrustedMatch ( Node node , Integer level ) { long key = ( ( ( long ) node . getPosition ( ) . getStartOffset ( ) ) << 32 ) + node . getPosition ( ) . getEndOffset ( ) ; Node existing = ( Node ) this . matchingNodesKeys . get ( key ) ; if ( existing != null && existing . getClass ( ) . equals ( node . getClass ( ) ) ) this . matchingNodes . removeKey ( existing ) ; this . matchingNodes . put ( node , level ) ; this . matchingNodesKeys . put ( key , node ) ; } protected boolean hasPossibleNodes ( int start , int end ) { Object [ ] nodes = this . possibleMatchingNodesSet . values ; for ( int i = 0 , l = nodes . length ; i < l ; i ++ ) { Node node = ( Node ) nodes [ i ] ; if ( node != null && start <= node . getPosition ( ) . getStartOffset ( ) && node . getPosition ( ) . getEndOffset ( ) <= end ) return true ; } nodes = this . matchingNodes . keyTable ; for ( int i = 0 , l = nodes . length ; i < l ; i ++ ) { Node node = ( Node ) nodes [ i ] ; if ( node != null && start <= node . getPosition ( ) . getStartOffset ( ) && node . getPosition ( ) . getEndOffset ( ) <= end ) return true ; } return false ; } protected Node [ ] matchingNodes ( int start , int end ) { ArrayList nodes = null ; Object [ ] keyTable = this . matchingNodes . keyTable ; for ( int i = 0 , l = keyTable . length ; i < l ; i ++ ) { Node node = ( Node ) keyTable [ i ] ; if ( node != null && start <= node . getPosition ( ) . getStartOffset ( ) && node . getPosition ( ) . getEndOffset ( ) <= end ) { if ( nodes == null ) nodes = new ArrayList ( ) ; nodes . add ( node ) ; } } if ( nodes == null ) return null ; Node [ ] result = new Node [ nodes . size ( ) ] ; nodes . toArray ( result ) ; Util . Comparer comparer = new Util . Comparer ( ) { public int compare ( Object o1 , Object o2 ) { return ( ( Node ) o1 ) . getPosition ( ) . getStartOffset ( ) - ( ( Node ) o2 ) . getPosition ( ) . getStartOffset ( ) ; } } ; Util . sort ( result , comparer ) ; return result ; } public Object removePossibleMatch ( Node node )
2,738
<s> package org . oddjob ; import java . io . IOException ; import java . io . Serializable ; import junit . framework . TestCase ; import org . oddjob . arooa . MockArooaSession ; import org . oddjob . framework . Service ; public class OddjobComponentResolverTest extends TestCase { public void testRunnable ( ) { OddjobComponentResolver test = new OddjobComponentResolver ( ) ; Runnable runnable = new Runnable ( ) { public void run ( ) { } } ; Object proxy
2,739
<s> package com . asakusafw . vocabulary . flow ; import java . util . concurrent . atomic . AtomicBoolean ; public abstract class FlowDescription { private final AtomicBoolean described = new AtomicBoolean ( false ) ; public final void start ( ) { if ( described . compareAndSet ( false , true ) == false ) { return ; } describe ( ) ; } protected abstract void describe ( ) ; public boolean isJobFlow ( ) { return isJobFlow ( getClass ( ) ) ; } public boolean isFlowPart ( ) { return isFlowPart ( getClass ( ) ) ; } public static boolean isJobFlow ( Class < ? extends FlowDescription > aClass )
2,740
<s> package org . rubypeople . rdt . internal . ui ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Status ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . core . runtime . jobs . Job ; import org . eclipse . ui . progress . UIJob ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . ui . RubyUI ; public class InitializeAfterLoadJob extends UIJob { private final class RealJob extends Job { public RealJob ( String name ) { super ( name ) ; } protected IStatus run ( IProgressMonitor monitor ) { monitor . beginTask ( "" , 10 ) ; try { RubyCore . initializeAfterLoad ( new SubProgressMonitor ( monitor , 6 ) ) ; RubyPlugin . getDefault ( ) . initializeAfterLoad ( new SubProgressMonitor ( monitor , 4 ) ) ; } catch ( CoreException e ) { RubyPlugin . log ( e ) ; return e . getStatus ( ) ; } return new Status ( IStatus .
2,741
<s> package org . rubypeople . rdt . ui . text . ruby ; import java . util . List ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jface . text . contentassist . ICompletionProposal ; import org . eclipse . jface . text . contentassist . IContextInformation ; public interface IRubyCompletionProposalComputer { void sessionStarted (
2,742
<s> package org . springframework . social . google . api . plus . person . impl ; import org . springframework . social . google . api . plus . person . Person ;
2,743
<s> package com . asakusafw . compiler . testing . flow ; import com . asakusafw . compiler . flow . testing . external . Ex1MockImporterDescription ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . operator . ExOperatorFactory ; import com . asakusafw . compiler .
2,744
<s> package com . loiane . model ; public class Author { private int id ; private String name ; private String email ; public int getId ( ) { return id ; } public void setId ( int id ) { this . id = id ; } public String getName ( ) { return name ; } public void setName ( String name ) { this . name = name ; } public String getEmail ( ) { return email ; } public void setEmail (
2,745
<s> package com . asakusafw . utils . java . internal . parser . javadoc . ir ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; public class IrDocMethod extends IrDocMember { private static final long serialVersionUID = 1L ; private List < ? extends IrDocMethodParameter > parameters ; public IrDocMethod ( ) { super ( ) ; this . parameters = Collections . emptyList ( ) ; } @ Override public IrDocElementKind getKind ( ) { return IrDocElementKind . METHOD ; } public List < ? extends IrDocMethodParameter > getParameters ( ) { return this . parameters ; } public void setParameters ( List < ? extends IrDocMethodParameter > parameters ) { if ( parameters == null ) { throw new IllegalArgumentException ( "parameters" ) ; } this . parameters = Collections . unmodifiableList ( new ArrayList < IrDocMethodParameter > ( parameters ) ) ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; IrDocNamedType type = getDeclaringType ( ) ; result = prime * result + ( type == null ? 0 : type . hashCode ( ) ) ; IrDocSimpleName name = getName ( ) ; result = prime * result + ( name == null ? 0 : name . hashCode ( ) ) ; result = prime * result + ( parameters == null ? 0 : parameters . hashCode ( ) ) ; return result ; } @ Override public boolean equals ( Object obj ) { if ( this == obj ) { return true ; } if ( obj == null ) { return false ; } if ( getClass ( ) != obj
2,746
<s> package net . sf . sveditor . core . db ; public class SVDBFieldItem extends SVDBItem implements IFieldItemAttr { public int fFieldAttr ; public SVDBFieldItem ( String name , SVDBItemType type ) { super ( name , type ) ; SVDBInclude inc = new SVDBInclude ( ) ; inc . fName = "foo" ; } public int getAttr ( ) { return fFieldAttr ; } public
2,747
<s> package org . rubypeople . rdt . ui . text . ruby ; import org . eclipse . jface . text . Assert ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . ITextViewer ; import org . rubypeople . rdt . core . RubyConventions ; public class ContentAssistInvocationContext { private final ITextViewer fViewer ; private final IDocument fDocument ; private final int fOffset ; private CharSequence fPrefix ; private String fStatementPrefix ; public ContentAssistInvocationContext ( ITextViewer viewer ) { this ( viewer , viewer . getSelectedRange ( ) . x ) ; } public ContentAssistInvocationContext ( ITextViewer viewer , int offset ) { Assert . isNotNull ( viewer ) ; fViewer = viewer ; fDocument = null ; fOffset = offset ; } protected ContentAssistInvocationContext ( ) { fDocument = null ; fViewer = null ; fOffset = - 1 ; } public ContentAssistInvocationContext ( IDocument document , int offset ) { Assert . isNotNull ( document ) ; Assert . isTrue ( offset >= 0 ) ; fViewer = null ; fDocument = document ; fOffset = offset ; } public final int getInvocationOffset ( ) { return fOffset ; } public final ITextViewer getViewer
2,748
<s> package net . sf . sveditor . core . db ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db . stmt . SVDBParamPortDecl ; public class SVDBModIfcDecl extends SVDBScopeItem { public List < SVDBModIfcClassParam > fParams ; public List < SVDBParamPortDecl > fPorts ; protected SVDBModIfcDecl ( String name , SVDBItemType type ) { super ( name , type ) ; fParams = new ArrayList < SVDBModIfcClassParam > ( ) ; fPorts = new ArrayList < SVDBParamPortDecl > ( ) ; } public List < SVDBModIfcClassParam > getParameters ( ) { return fParams ; } public List < SVDBParamPortDecl > getPorts ( ) { return fPorts ; } public boolean isParameterized ( ) { return ( fParams != null && fParams . size ( ) > 0 ) ; } public SVDBModIfcDecl duplicate ( ) { return ( SVDBModIfcDecl ) super . duplicate ( ) ; } public void init ( SVDBItemBase other ) { super . init
2,749
<s> package com . asakusafw . windgate . core ; import java . text . MessageFormat ; import java . util . ResourceBundle ; public class WindGateCoreLogger extends WindGateLogger { private static final ResourceBundle BUNDLE =
2,750
<s> package org . rubypeople . rdt . internal . ui . text . ruby ; import java . util . HashMap ; import java . util . Map ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . preference . PreferenceConverter ; import org . eclipse . jface . resource . StringConverter ; import org . eclipse . jface . text . TextAttribute ; import org . eclipse . jface . text . rules . ITokenScanner ; import org . eclipse . jface . text . rules . Token ; import org . eclipse . jface . util . PropertyChangeEvent ; import org . eclipse . swt . SWT ; import org . eclipse . swt . graphics . Color ; import org . eclipse . swt . graphics . RGB ; import org . eclipse . swt . widgets . Display ; import org . rubypeople . rdt . ui . PreferenceConstants ; import org . rubypeople . rdt . ui . text . IAbstractManagedScanner ; import org . rubypeople . rdt . ui . text . IColorManager ; import org . rubypeople . rdt . ui . text . IColorManagerExtension ; public abstract class AbstractRubyTokenScanner implements ITokenScanner , IAbstractManagedScanner { private String [ ] fPropertyNamesColor ; private String [ ] fPropertyNamesBgColor ; private String [ ] fPropertyNamesBold ; private String [ ] fPropertyNamesBGEnabled ; private String [ ] fPropertyNamesItalic ; private String [ ] fPropertyNamesStrikethrough ; private String [ ] fPropertyNamesUnderline ; private IColorManager fColorManager ; private IPreferenceStore fPreferenceStore ; private boolean fNeedsLazyColorLoading ; private Map fTokenMap = new HashMap ( ) ; public AbstractRubyTokenScanner ( IColorManager manager , IPreferenceStore store ) { super ( ) ; fColorManager = manager ; fPreferenceStore = store ; } protected IPreferenceStore getPreferenceStore ( ) { return fPreferenceStore ; } abstract protected String [ ] getTokenProperties ( ) ; public final void initialize ( ) { fPropertyNamesColor = getTokenProperties ( ) ; int length = fPropertyNamesColor . length ; fPropertyNamesBgColor = new String [ length ] ; fPropertyNamesBGEnabled = new String [ length ] ; fPropertyNamesBold = new String [ length ] ; fPropertyNamesItalic = new String [ length ] ; fPropertyNamesStrikethrough = new String [ length ] ; fPropertyNamesUnderline = new String [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { fPropertyNamesBgColor [ i ] = getBGKey ( fPropertyNamesColor [ i ] ) ; fPropertyNamesBold [ i ] = getBoldKey ( fPropertyNamesColor [ i ] ) ; fPropertyNamesBGEnabled [ i ] = getBGEnabledKey ( fPropertyNamesColor [ i ] ) ; fPropertyNamesItalic [ i ] = getItalicKey ( fPropertyNamesColor [ i ] ) ; fPropertyNamesStrikethrough [ i ] = getStrikethroughKey ( fPropertyNamesColor [ i ] ) ; fPropertyNamesUnderline [ i ] = getUnderlineKey ( fPropertyNamesColor [ i ] ) ; } fNeedsLazyColorLoading = Display . getCurrent ( ) == null ; for ( int i = 0 ; i < length ; i ++ ) { if ( fNeedsLazyColorLoading ) addTokenWithProxyAttribute ( fPropertyNamesColor [ i ] , fPropertyNamesBgColor [ i ] , fPropertyNamesBGEnabled [ i ] , fPropertyNamesBold [ i ] , fPropertyNamesItalic [ i ] , fPropertyNamesStrikethrough [ i ] , fPropertyNamesUnderline [ i ] ) ; else addToken ( fPropertyNamesColor [ i ] , fPropertyNamesBgColor [ i ] , fPropertyNamesBGEnabled [ i ] , fPropertyNamesBold [ i ] , fPropertyNamesItalic [ i ] , fPropertyNamesStrikethrough [ i ] , fPropertyNamesUnderline [ i ] ) ; } } protected String getBoldKey ( String colorKey ) { return colorKey + PreferenceConstants . EDITOR_BOLD_SUFFIX ; } protected String getBGKey ( String colorKey ) { return colorKey + PreferenceConstants . EDITOR_BG_SUFFIX ; } protected String getBGEnabledKey ( String colorKey ) { return colorKey + PreferenceConstants . EDITOR_BG_ENABLED_SUFFIX ; } protected String getItalicKey ( String colorKey ) { return colorKey + PreferenceConstants . EDITOR_ITALIC_SUFFIX ; } protected String getStrikethroughKey ( String colorKey ) { return colorKey + PreferenceConstants . EDITOR_STRIKETHROUGH_SUFFIX ; } protected String getUnderlineKey ( String colorKey ) { return colorKey + PreferenceConstants . EDITOR_UNDERLINE_SUFFIX ; } private void addTokenWithProxyAttribute ( String colorKey , String bgColorKey , String bgEnabledKey , String boldKey , String italicKey , String strikethroughKey , String underlineKey ) { fTokenMap . put ( colorKey , new Token ( createTextAttribute ( null , null , bgEnabledKey , boldKey , italicKey , strikethroughKey , underlineKey ) ) ) ; } private void resolveProxyAttributes ( ) { if ( fNeedsLazyColorLoading && Display . getCurrent ( ) != null ) { for ( int i = 0 ; i < fPropertyNamesColor . length ; i ++ ) { addToken ( fPropertyNamesColor [ i ] , fPropertyNamesBgColor [ i ] , fPropertyNamesBGEnabled [ i ] , fPropertyNamesBold [ i ] , fPropertyNamesItalic [ i ] , fPropertyNamesStrikethrough [ i ] , fPropertyNamesUnderline [ i ] ) ; } fNeedsLazyColorLoading = false ; } } private void addToken ( String colorKey , String bgColorKey , String bgEnabledKey , String boldKey , String italicKey , String strikethroughKey , String underlineKey ) { bindColor ( colorKey ) ; bindColor ( bgColorKey ) ; if ( ! fNeedsLazyColorLoading ) fTokenMap . put ( colorKey , new Token ( createTextAttribute ( colorKey , bgColorKey , bgEnabledKey , boldKey , italicKey , strikethroughKey , underlineKey ) ) ) ; else { Token token = ( ( Token ) fTokenMap . get ( colorKey ) ) ; if ( token != null ) token . setData ( createTextAttribute ( colorKey , bgColorKey , bgEnabledKey , boldKey , italicKey , strikethroughKey , underlineKey ) ) ; } } private void bindColor ( String colorKey ) { if ( fColorManager != null && colorKey != null && fColorManager . getColor ( colorKey ) == null ) { RGB rgb = PreferenceConverter . getColor ( fPreferenceStore , colorKey ) ; if ( rgb == PreferenceConverter . COLOR_DEFAULT_DEFAULT && ! colorKey . endsWith ( PreferenceConstants . EDITOR_BG_SUFFIX ) ) return ; if ( fColorManager instanceof IColorManagerExtension ) { IColorManagerExtension ext = ( IColorManagerExtension ) fColorManager ; ext . unbindColor ( colorKey ) ; ext . bindColor ( colorKey , rgb ) ; } } } public Token getToken ( String key ) { if ( fNeedsLazyColorLoading ) resolveProxyAttributes ( ) ; return ( Token ) fTokenMap . get ( key ) ; } private TextAttribute createTextAttribute ( String colorKey , String bgColorKey , String bgEnabledKey , String boldKey , String italicKey , String strikethroughKey , String underlineKey ) { Color color = null ; if ( colorKey != null ) color = fColorManager . getColor ( colorKey ) ; boolean useBG = fPreferenceStore . getBoolean ( bgEnabledKey ) ; Color bgColor = null ; if ( bgColorKey != null && useBG ) bgColor = fColorManager . getColor ( bgColorKey ) ; int style = fPreferenceStore . getBoolean ( boldKey ) ? SWT . BOLD : SWT . NORMAL ; if ( fPreferenceStore . getBoolean ( italicKey ) ) style |= SWT . ITALIC ; if ( fPreferenceStore . getBoolean ( strikethroughKey ) ) style |= TextAttribute . STRIKETHROUGH ; if ( fPreferenceStore . getBoolean ( underlineKey ) ) style |= TextAttribute . UNDERLINE ; return new TextAttribute ( color , bgColor , style ) ; } public boolean affectsBehavior ( PropertyChangeEvent event ) { return indexOf ( event . getProperty ( ) ) >= 0 ; } public void adaptToPreferenceChange ( PropertyChangeEvent event ) { String p = event . getProperty ( ) ; int index = indexOf ( p ) ; Token token = getToken ( fPropertyNamesColor [ index ] ) ; if ( fPropertyNamesColor [ index ] . equals ( p ) ) adaptToColorChange ( token , event ) ; if ( fPropertyNamesBgColor [ index ] . equals ( p ) || fPropertyNamesBGEnabled [ index ] . equals ( p ) ) adaptToBgColorChange ( token , event ) ; else if ( fPropertyNamesBold [ index ] . equals ( p ) ) adaptToStyleChange ( token , event , SWT . BOLD ) ; else if ( fPropertyNamesItalic [ index ] . equals ( p ) ) adaptToStyleChange ( token , event , SWT . ITALIC ) ; else if ( fPropertyNamesStrikethrough [ index ] . equals ( p ) ) adaptToStyleChange ( token , event , TextAttribute . STRIKETHROUGH ) ; else if ( fPropertyNamesUnderline [ index ] . equals ( p ) ) adaptToStyleChange ( token , event , TextAttribute . UNDERLINE ) ; } private void adaptToStyleChange ( Token token , PropertyChangeEvent event , int styleAttribute ) { boolean eventValue = false ; Object value = event . getNewValue ( ) ; if ( value instanceof Boolean ) eventValue = ( ( Boolean ) value ) . booleanValue ( ) ; else if ( IPreferenceStore . TRUE . equals ( value ) ) eventValue = true ; Object data = token . getData ( ) ; if ( data instanceof TextAttribute ) { TextAttribute oldAttr = ( TextAttribute ) data ; boolean activeValue = ( oldAttr . getStyle ( ) & styleAttribute ) == styleAttribute ; if ( activeValue != eventValue ) token . setData ( new TextAttribute ( oldAttr . getForeground ( ) , oldAttr . getBackground ( ) , eventValue ? oldAttr . getStyle ( ) | styleAttribute : oldAttr . getStyle ( ) & ~ styleAttribute ) ) ; } } private void adaptToColorChange ( Token token , PropertyChangeEvent event ) { adaptToSomeColorChange ( token , event , true ) ; } private void adaptToBgColorChange ( Token token , PropertyChangeEvent event ) { adaptToSomeColorChange ( token , event , false ) ; } private void adaptToSomeColorChange ( Token token , PropertyChangeEvent event , boolean isForeground ) { if ( event . getProperty ( ) . endsWith ( PreferenceConstants . EDITOR_BG_ENABLED_SUFFIX ) ) { Object value = event . getNewValue ( ) ; boolean enabling = false ; if ( value instanceof Boolean ) { enabling = ( ( Boolean ) value ) . booleanValue ( ) ; } else if ( value instanceof String ) { enabling = Boolean . parseBoolean ( ( String )
2,751
<s> package com . asakusafw . modelgen . model ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; public class SummarizedModelDescription extends ModelDescription { private final List < Source > groupBy ; public SummarizedModelDescription ( ModelReference reference , List < ModelProperty > properties , List < Source > groupBy ) { super ( reference , properties ) ; this . groupBy = Collections . unmodifiableList ( new ArrayList < Source > ( groupBy ) ) ; Set < String > groupKeys = new HashSet < String > ( ) ; for ( Source source : groupBy ) { groupKeys . add ( source . getName ( ) ) ; } for ( ModelProperty property : properties ) { if ( property . getJoined ( ) != null ) { throw
2,752
<s> package org . oddjob . monitor . actions ; import junit . framework . TestCase ; import org . oddjob . OddjobSessionFactory ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . monitor . action . AddJobAction ; import org . oddjob . monitor . action . DesignInsideAction ; import org . oddjob . monitor . action . DesignerAction ; import org . oddjob . monitor . action . ExecuteAction ; import org . oddjob . monitor .
2,753
<s> package com . asakusafw . utils . java . model . util ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import java . util . regex . Pattern ; import com . asakusafw . utils . java . model . syntax . DocBlock ; import com . asakusafw . utils . java . model . syntax . DocElement ; import com . asakusafw . utils . java . model . syntax . DocMethodParameter ; import com . asakusafw . utils . java . model . syntax . DocText ; import com . asakusafw . utils . java . model . syntax . Javadoc ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . NamedType ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Type ; public class JavadocBuilder { private static final Pattern ESCAPE = Pattern . compile ( "@" ) ; private ModelFactory f ; private List < DocBlock > blocks ; private String currentTag ; private List < DocElement > elements ; public JavadocBuilder ( ModelFactory factory ) { if ( factory == null ) { throw new IllegalArgumentException ( "" ) ; } this . f = factory ; this . blocks = new ArrayList < DocBlock > ( ) ; this . currentTag = "" ; this . elements = new ArrayList < DocElement > ( ) ; } public JavadocBuilder copy ( ) { JavadocBuilder copy = new JavadocBuilder ( f ) ; copy . blocks = new ArrayList < DocBlock > ( blocks ) ; copy . currentTag = currentTag ; copy . elements = new ArrayList < DocElement > ( elements ) ; return copy ; } public Javadoc toJavadoc ( ) { flushBlock ( "" ) ; return f . newJavadoc ( blocks ) ; } public JavadocBuilder block ( String tag ) { if ( tag == null ) { throw new IllegalArgumentException ( "" ) ; } if ( tag . startsWith ( "@" ) ) { flushBlock ( tag ) ; } else { flushBlock ( "@" + tag ) ; } return this ; } public JavadocBuilder inline ( DocElement element ) { if ( element == null ) { throw new IllegalArgumentException ( "" ) ; } elements . add ( element ) ; return this ; } public JavadocBuilder inline ( List < ? extends DocElement > elems ) { if ( elems == null ) { throw new IllegalArgumentException ( "" ) ; } elements . addAll ( elems ) ; return this ; } public JavadocBuilder param ( String name ) { return param ( f . newSimpleName ( name ) ) ; } public JavadocBuilder param ( SimpleName name ) { block ( "@param" ) ; elements . add ( name ) ; return this ; } public JavadocBuilder typeParam ( String name ) { return typeParam ( f . newSimpleName ( name ) ) ; } public JavadocBuilder typeParam ( SimpleName name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } block ( "@param" ) ; elements . add ( f . newDocText ( "<" ) ) ; elements . add ( name ) ; elements . add ( f . newDocText ( ">" ) ) ; return this ; } public JavadocBuilder typeParam ( Type typeVariable ) { if ( typeVariable == null ) { throw new IllegalArgumentException ( "" ) ; } if ( typeVariable . getModelKind ( ) != ModelKind . NAMED_TYPE ) { throw new IllegalArgumentException ( "" ) ; } NamedType named = ( NamedType ) typeVariable ; if ( named . getModelKind ( ) != ModelKind . SIMPLE_NAME ) { throw new IllegalArgumentException ( "" ) ; } return typeParam ( ( SimpleName ) named . getName ( ) ) ; } public JavadocBuilder returns ( ) { block ( "@return" ) ; return this ; } public JavadocBuilder exception ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } if ( type . getModelKind ( ) != ModelKind . NAMED_TYPE ) { throw new IllegalArgumentException ( "" ) ; } block ( "@throws" ) ; elements . add ( ( ( NamedType ) type ) . getName ( ) ) ; return this ; } public JavadocBuilder seeType ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } if ( type . getModelKind ( ) != ModelKind . NAMED_TYPE ) { throw new IllegalArgumentException ( "" ) ; } return see ( ( ( NamedType ) type ) . getName ( ) ) ; } public JavadocBuilder seeField ( String name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } return seeField ( null , f . newSimpleName ( name ) ) ; } public JavadocBuilder seeField ( Type type , String name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } return seeField ( type , f . newSimpleName ( name ) ) ; } public JavadocBuilder seeField ( SimpleName name ) { return seeField ( null , name ) ; } public JavadocBuilder seeField ( Type type , SimpleName name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } return see ( f . newDocField ( type , name ) ) ; } public JavadocBuilder seeMethod ( String name , Type ... parameterTypes ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } if ( parameterTypes == null ) { throw new IllegalArgumentException ( "" ) ; } return seeMethod ( null , f . newSimpleName ( name ) , Arrays . asList ( parameterTypes ) ) ; } public JavadocBuilder seeMethod ( String name , List < ? extends Type > parameterTypes ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } if ( parameterTypes == null ) { throw new IllegalArgumentException ( "" ) ; } return seeMethod ( null , f . newSimpleName ( name ) , parameterTypes ) ; } public JavadocBuilder seeMethod ( SimpleName name , Type ... parameterTypes ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } if ( parameterTypes == null ) { throw new IllegalArgumentException ( "" ) ; } return seeMethod ( null , name , Arrays . asList ( parameterTypes ) ) ; } public JavadocBuilder seeMethod ( SimpleName name , List < ? extends Type > parameterTypes ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } if ( parameterTypes == null ) { throw new IllegalArgumentException ( "" ) ; } return seeMethod ( null , name , parameterTypes ) ; } public JavadocBuilder seeMethod ( Type type , String name , Type ... parameterTypes ) { if
2,754
<s> package org . rubypeople . rdt . internal . testunit . ui ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jface . dialogs . MessageDialog ; import org . eclipse . ui . texteditor . ITextEditor ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . ISourceRange ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . ITypeHierarchy ; import org . rubypeople . rdt . core . RubyConventions ; import org . rubypeople .
2,755
<s> package com . asakusafw . cleaner . common ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . List ; import java . util . Map ; import java . util . Properties ; import java . util . Set ; import com . asakusafw . cleaner . exception . CleanerSystemException ; public final class ConfigurationLoader { private static Properties prop = new Properties ( ) ; private static Map < String , String > env = null ; private static Properties sysProp = null ; private ConfigurationLoader ( ) { return ; } public static void cleanProp ( ) { prop = new Properties ( ) ; } public static void init ( String [ ] propertys , boolean doLocalCleanPropCheck , boolean doHDFSCleanPropCheck ) throws CleanerSystemException , Exception { env = System . getenv ( ) ; sysProp = System . getProperties ( ) ; checkEnv ( ) ; loadPropertyes ( propertys ) ; if ( doLocalCleanPropCheck ) { checkAndSetParamLocalFileClean ( ) ; } if ( doHDFSCleanPropCheck ) { checkAndSetParamHDFSClean ( ) ; } } protected static void checkEnv ( ) throws Exception { String cleanHome = getEnvProperty ( Constants . CLEAN_HOME ) ; if ( isEmpty ( cleanHome ) ) { System . err . println ( MessageFormat . format ( "" , Constants . CLEAN_HOME ) ) ; throw new Exception ( MessageFormat . format ( "" , Constants . CLEAN_HOME ) ) ; } File cleanHomeDir = new File ( cleanHome ) ; if ( ! cleanHomeDir . exists ( ) ) { System . err . println ( MessageFormat . format ( "" , Constants . CLEAN_HOME , cleanHome ) ) ; throw new Exception ( MessageFormat . format ( "" , Constants . CLEAN_HOME , cleanHome ) ) ; } } protected static void checkAndSetParamLocalFileClean ( )
2,756
<s> package net . sf . sveditor . core . db . project ; import java . io . InputStream ; import java . io . OutputStream ; import java . util . ArrayList ; import java . util . List ; import java . util . Properties ; import javax . xml . parsers . DocumentBuilder ; import javax . xml . parsers . DocumentBuilderFactory ; import javax . xml . transform . OutputKeys ; import javax . xml . transform . dom . DOMSource ; import javax . xml . transform . sax . SAXTransformerFactory ; import javax . xml . transform . sax . TransformerHandler ; import javax . xml . transform . stream . StreamResult ; import net . sf . sveditor . core . Tuple ; import org . w3c . dom . Document ; import org . w3c . dom . Element ; import org . w3c . dom . NodeList ; import org . xml . sax . ErrorHandler ; import org . xml . sax . SAXException ; import org . xml . sax . SAXParseException ; public class SVProjectFileWrapper { private Document fDocument ; private List < Tuple < String , String > > fGlobalDefines ; private List < SVDBPath > fIncludePaths ; private List < SVDBPath > fLibraryPaths ; private List < SVDBPath > fBuildPaths ; private List < SVDBPath > fPluginPaths ; private List < SVDBPath > fArgFilePaths ; private List < SVDBSourceCollection > fSourceCollections ; private List < SVDBPath > fProjectReferences ; public SVProjectFileWrapper ( ) { fGlobalDefines = new ArrayList < Tuple < String , String > > ( ) ; fIncludePaths = new ArrayList < SVDBPath > ( ) ; fLibraryPaths = new ArrayList < SVDBPath > ( ) ; fBuildPaths = new ArrayList < SVDBPath > ( ) ; fPluginPaths = new ArrayList < SVDBPath > ( ) ; fArgFilePaths = new ArrayList < SVDBPath > ( ) ; fSourceCollections = new ArrayList < SVDBSourceCollection > ( ) ; fProjectReferences = new ArrayList < SVDBPath > ( ) ; DocumentBuilderFactory f = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder b = null ; try { b = f . newDocumentBuilder ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e . getMessage ( ) ) ; } fDocument = b . newDocument ( ) ; init ( ) ; } public SVProjectFileWrapper ( InputStream in ) throws Exception { fGlobalDefines = new ArrayList < Tuple < String , String > > ( ) ; fIncludePaths = new ArrayList < SVDBPath > ( ) ; fLibraryPaths = new ArrayList < SVDBPath > ( ) ; fBuildPaths = new ArrayList < SVDBPath > ( ) ; fPluginPaths = new ArrayList < SVDBPath > ( ) ; fArgFilePaths = new ArrayList < SVDBPath > ( ) ; fSourceCollections = new ArrayList < SVDBSourceCollection > ( ) ; fProjectReferences = new ArrayList < SVDBPath > ( ) ; DocumentBuilderFactory f = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder b = f . newDocumentBuilder ( ) ; b . setErrorHandler ( fErrorHandler ) ; fDocument = b . parse ( in ) ; init ( ) ; } private boolean init ( ) { NodeList svprojectList = fDocument . getElementsByTagName ( "svproject" ) ; Element svproject ; boolean change = false ; if ( svprojectList . getLength ( ) == 0 ) { svproject = fDocument . createElement ( "svproject" ) ; fDocument . appendChild ( svproject ) ; } else { svproject = ( Element ) svprojectList . item ( 0 ) ; } change |= init_defines ( svproject ) ; change |= init_paths ( svproject , "includePaths" , "includePath" , fIncludePaths ) ; change |= init_paths ( svproject , "buildPaths" , "buildPath" , fBuildPaths ) ; change |= init_paths ( svproject , "pluginPaths" , "pluginPath" , fPluginPaths ) ; change |= init_paths ( svproject , "libraryPaths" , "libraryPath" , fLibraryPaths ) ; change |= init_paths ( svproject , "argFilePaths" , "argFilePath" , fArgFilePaths ) ; change |= init_source_collections ( svproject , "" , "" , fSourceCollections ) ; change |= init_paths ( svproject , "projectRefs" , "projectRef" , fProjectReferences ) ; return change ; } private boolean init_paths ( Element svproject , String containerName , String elementName , List < SVDBPath > element_list ) { boolean change = false ; NodeList pathsList = svproject . getElementsByTagName ( containerName ) ; Element paths = null ; if ( pathsList . getLength ( ) > 0 ) { paths = ( Element ) pathsList . item ( 0 ) ; } else { paths = fDocument . createElement ( containerName ) ; svproject . appendChild ( paths ) ; change = true ; } NodeList includePathList = paths . getElementsByTagName ( elementName ) ; for ( int i = 0 ; i < includePathList . getLength ( ) ; i ++ ) { Element includePath = ( Element ) includePathList . item ( i ) ; String path = includePath . getAttribute ( "path" ) ; if ( path == null ) { path = "" ; } element_list . add ( new SVDBPath ( path , false ) ) ; } return change ; } private boolean init_defines ( Element svproject ) { boolean change = false ; NodeList definesList = svproject . getElementsByTagName ( "defines" ) ; Element paths = null ; if ( definesList . getLength ( ) > 0 ) { paths = ( Element ) definesList . item ( 0 ) ; } else { paths = fDocument . createElement ( "defines" ) ; svproject . appendChild ( paths ) ; change = true ; } NodeList defineList = paths . getElementsByTagName ( "define" ) ; for ( int i = 0 ; i < defineList . getLength ( ) ; i ++ ) { Element define = ( Element ) defineList . item ( i ) ; String key = define . getAttribute ( "key" ) ; String val = define . getAttribute ( "val" ) ; if ( key == null ) { key = "" ; } fGlobalDefines . add ( new Tuple < String , String > ( key , val ) ) ; } return change ; } private boolean init_source_collections ( Element svproject , String containerName , String elementName , List < SVDBSourceCollection > element_list ) { boolean change = false ; NodeList pathsList = svproject . getElementsByTagName ( containerName ) ; Element paths = null ; if ( pathsList . getLength ( ) > 0 ) { paths = ( Element ) pathsList . item ( 0 ) ; } else { paths = fDocument . createElement ( containerName ) ; svproject . appendChild ( paths ) ; change = true ; } NodeList sourceCollectionList = paths . getElementsByTagName ( elementName ) ; for ( int i = 0 ; i < sourceCollectionList . getLength ( ) ; i ++ ) { Element sourceCollection = ( Element ) sourceCollectionList . item ( i ) ; String baseLocation = sourceCollection . getAttribute ( "baseLocation" ) ; if ( baseLocation == null ) { continue ; } SVDBSourceCollection c ; if ( sourceCollection . hasAttribute ( "" ) ) { boolean dflt_inc_excl = ( sourceCollection . getAttribute ( "" ) . equals ( "true" ) ) ; c = new SVDBSourceCollection ( baseLocation , dflt_inc_excl ) ; if ( ! dflt_inc_excl ) { NodeList includeList = sourceCollection . getElementsByTagName ( "include" ) ; for ( int j = 0 ; j < includeList . getLength ( ) ; j ++ ) { Element inc = ( Element ) includeList . item ( j ) ; String expr = inc . getAttribute ( "expr" ) ; if ( expr != null && ! expr . equals ( "" ) ) { c . getIncludes ( ) . add ( expr ) ; } } NodeList excludeList = sourceCollection . getElementsByTagName ( "exclude" ) ; for ( int j = 0 ; j < excludeList . getLength ( ) ; j ++ ) { Element excl = ( Element ) excludeList . item ( j ) ; String expr = excl . getAttribute ( "expr" ) ; if ( expr != null && ! expr . equals ( "" ) ) { c . getExcludes ( ) . add ( expr ) ; } } } } else { c = new SVDBSourceCollection ( baseLocation , false ) ; NodeList includeList = sourceCollection . getElementsByTagName ( "include" ) ; for ( int j = 0 ; j < includeList . getLength ( ) ; j ++ ) { Element inc = ( Element ) includeList . item ( j ) ; String expr = inc . getAttribute ( "expr" ) ; if ( expr != null && ! expr . equals ( "" ) ) { c . getIncludes ( ) . add ( expr ) ; } } NodeList excludeList = sourceCollection . getElementsByTagName ( "exclude" ) ; for ( int j = 0 ; j < excludeList . getLength ( ) ; j ++ ) { Element excl = ( Element ) excludeList . item ( j ) ; String expr = excl . getAttribute ( "expr" ) ; if ( expr != null && ! expr . equals ( "" ) ) { c . getExcludes ( ) . add ( expr ) ; } } } element_list . add ( c ) ; } return change ; } private void marshall ( ) { NodeList svprojectList = fDocument . getElementsByTagName ( "svproject" ) ; Element svproject ; if ( svprojectList . getLength ( ) == 0 ) { svproject = fDocument . createElement ( "svproject" ) ; fDocument . appendChild ( svproject ) ; } else { svproject = ( Element ) svprojectList . item ( 0 ) ; } marshall_defines ( svproject ) ; marshall_paths ( svproject , "includePaths" , "includePath" , fIncludePaths ) ; marshall_paths ( svproject , "buildPaths" , "buildPath" , fBuildPaths ) ; marshall_paths ( svproject , "libraryPaths" , "libraryPath" , fLibraryPaths ) ; marshall_paths ( svproject , "pluginPaths" , "pluginPath" , fPluginPaths ) ; marshall_paths ( svproject , "argFilePaths" , "argFilePath" , fArgFilePaths ) ; marshall_source_collections ( svproject , fSourceCollections ) ; marshall_paths ( svproject , "projectRefs" , "projectRef" , fProjectReferences ) ; } private void marshall_paths ( Element svproject , String containerName , String elementName , List < SVDBPath > element_list ) { NodeList pathsList = svproject . getElementsByTagName ( containerName ) ; Element paths = null ; if ( pathsList . getLength ( ) > 0 ) { paths = ( Element ) pathsList . item ( 0 ) ; } else { paths = fDocument . createElement ( containerName ) ; svproject . appendChild ( paths ) ; } NodeList includePathList = paths . getElementsByTagName ( elementName ) ; for ( int i = 0 ; i < includePathList . getLength ( ) ; i ++ ) { paths . removeChild ( ( Element ) includePathList . item ( i ) ) ; } for ( SVDBPath ip : element_list ) { Element path = fDocument . createElement ( elementName ) ; path . setAttribute ( "path" , ip . getPath ( ) ) ; paths . appendChild ( path ) ; } } private void marshall_defines ( Element svproject ) { NodeList definesList = svproject . getElementsByTagName ( "defines" ) ; Element defines = null ; if ( definesList . getLength ( ) > 0 ) { defines = ( Element ) definesList . item ( 0 ) ; } else { defines = fDocument . createElement ( "defines" ) ; svproject . appendChild ( defines ) ; } NodeList defineList = defines . getElementsByTagName ( "define" ) ; for ( int i = 0 ; i < defineList . getLength ( ) ; i ++ ) { defines . removeChild ( ( Element ) defineList . item ( i ) ) ; } for ( Tuple < String , String > def : fGlobalDefines ) { Element def_e = fDocument . createElement ( "define" ) ; def_e . setAttribute ( "key" , def . first ( ) ) ; def_e . setAttribute ( "val" , def . second ( ) ) ; defines . appendChild ( def_e ) ; } } private void marshall_source_collections ( Element svproject , List < SVDBSourceCollection > source_collections ) { NodeList collectionsList = svproject . getElementsByTagName ( "" ) ; Element paths = null ; if ( collectionsList . getLength ( ) > 0 ) { paths = ( Element ) collectionsList . item ( 0 ) ; } else { paths = fDocument . createElement ( "" ) ; svproject . appendChild ( paths ) ; } NodeList sourceCollections = paths . getElementsByTagName ( "" ) ; for ( int i = 0 ; i < sourceCollections . getLength ( ) ; i ++ ) { paths . removeChild ( ( Element ) sourceCollections . item ( i ) ) ; } for ( SVDBSourceCollection c : source_collections ) { Element path = fDocument . createElement ( "" ) ; path . setAttribute ( "baseLocation" , c . getBaseLocation ( ) ) ; path . setAttribute ( "" , ( c . getDefaultIncExcl ( ) ) ? "true" : "false" ) ; if ( ! c . getDefaultIncExcl ( ) ) { for ( String inc : c . getIncludes ( ) ) { Element inc_e = fDocument . createElement ( "include" ) ; inc_e . setAttribute ( "expr" , inc ) ; path . appendChild ( inc_e ) ; } for ( String excl : c . getExcludes ( ) ) { Element excl_e = fDocument . createElement ( "exclude" ) ; excl_e . setAttribute ( "expr" , excl ) ; path . appendChild ( excl_e ) ; } } paths . appendChild ( path ) ; } } public List < SVDBPath > getIncludePaths ( ) { return fIncludePaths ; } public List < SVDBPath > getLibraryPaths ( ) { return fLibraryPaths ; } public List < SVDBPath > getBuildPaths ( ) { return fBuildPaths ; } public List < SVDBPath > getPluginPaths ( ) { return fPluginPaths ; } public List < SVDBPath > getArgFilePaths ( ) { return fArgFilePaths ; } public void addArgFilePath ( String path ) { SVDBPath arg_path = new SVDBPath ( path ) ; if ( ! fArgFilePaths . contains ( arg_path ) ) { fArgFilePaths . add ( arg_path ) ; } }
2,757
<s> package net . sf . sveditor . core . db ; import net . sf . sveditor . core . db . attr . SVDBParentAttr ; import net . sf . sveditor . core . db . expr . SVDBIdentifierExpr ; public class SVDBItem extends SVDBItemBase implements ISVDBNamedItem , ISVDBChildItem { @ SVDBParentAttr public ISVDBChildItem fParent ; public String fName ; public SVDBItem ( String name , SVDBItemType type ) { super ( type ) ; if ( name == null
2,758
<s> package com . asakusafw . yaess . jobqueue . client ; import java . io . IOException ;
2,759
<s> package com . asakusafw . runtime . value ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import org . junit . Test ; @ SuppressWarnings ( "deprecation" ) public class DateTimeOptionTest extends ValueOptionTestRoot { @ Test public void init ( ) { DateTimeOption option = new DateTimeOption ( ) ; assertThat ( "-UNK-null" , option . isNull ( ) , is ( true ) ) ; } @ Test public void setLong ( ) { DateTimeOption option = new DateTimeOption ( ) ; option . modify ( 500 ) ; assertThat ( option . isNull ( ) , is ( false ) ) ; assertThat ( option . get ( ) , is ( time ( 500 ) ) ) ; } @ Test public void intOr ( ) { DateTimeOption option = new DateTimeOption ( ) ; assertThat ( option . or ( 100 ) , is ( 100L ) ) ; assertThat ( option . isNull ( ) , is ( true ) ) ; option . modify ( 200 ) ; assertThat ( option . or ( 300 ) , is ( 200L ) ) ; } @ Test public void string ( ) { DateTimeOption option = new DateTimeOption ( ) ; option . modify ( time ( 999 ) ) ; assertThat ( option . isNull ( ) , is ( false ) ) ; assertThat ( option . get ( ) , is ( time ( 999 ) ) ) ; } @ Test public void stringOr ( ) { DateTimeOption option = new DateTimeOption ( ) ; assertThat ( option . or ( time ( 200 ) ) , is ( time ( 200 ) ) ) ; assertThat ( option . isNull ( ) , is ( true ) ) ; option . modify ( time ( 300 ) ) ; assertThat ( option . or ( time ( 400 ) ) , is ( time ( 300 ) ) ) ; } @ Test public void modifyNull ( ) { DateTimeOption option = new DateTimeOption ( ) ; option . modify ( time ( 100 ) ) ; assertThat ( option . isNull ( ) , is ( false ) ) ; option . modify ( ( DateTime
2,760
<s> package org . rubypeople . rdt . refactoring . action ; import org . rubypeople . rdt
2,761
<s> package org . rubypeople . rdt . launching ; import java . util . Map ; import org . rubypeople . rdt . internal . launching . LaunchingMessages ; public class VMRunnerConfiguration { private String fFileToLaunch ; private String [ ] fVMArgs ; private String [ ] fProgramArgs ; private String [ ] fEnvironment ; private String [ ] fLoadPath ; private String fWorkingDirectory ; private Map fVMSpecificAttributesMap ; private boolean fResume = true ; private boolean fIsSudo ; private String fSudoMessage ; private static final String [ ] fgEmpty = new String [ 0 ] ; public VMRunnerConfiguration ( String fileToLaunch , String [ ] loadPath ) { if ( fileToLaunch == null ) { throw new IllegalArgumentException ( LaunchingMessages . vmRunnerConfig_assert_classNotNull ) ; } if ( loadPath == null ) { throw new IllegalArgumentException ( LaunchingMessages . vmRunnerConfig_assert_classPathNotNull ) ; } fFileToLaunch = fileToLaunch ;
2,762
<s> package com . aptana . rdt . internal . parser . warnings ; import java . util . HashSet ; import java . util . Map ; import java . util . Set ; import org . jruby . ast . DefnNode ; import org . jruby . ast . DefsNode ; import org . jruby . ast . LocalAsgnNode ; import org . jruby . ast . RootNode ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import com . aptana . rdt . AptanaRDTPlugin ; public class TooManyLocalsVisitor extends RubyLintVisitor { public static final int DEFAULT_MAX_LOCALS = 4 ; private int maxLocals ; private Set < String > locals ; public
2,763
<s> package com . asakusafw . bulkloader . cache ; import java . text . SimpleDateFormat ; import java . util . Calendar ; public class LocalCacheInfo { private final String id ; private final Calendar localTimestamp ; private final Calendar remoteTimestamp ; private final String tableName ; private final String path ; public LocalCacheInfo ( String id , Calendar localTimestamp , Calendar remoteTimestamp , String tableName , String path ) { if ( id == null ) { throw new IllegalArgumentException ( "" ) ; } if ( tableName == null ) { throw new IllegalArgumentException ( "" ) ; } if ( path == null ) { throw new IllegalArgumentException ( "" ) ; } this . id = id ; this . localTimestamp = copy ( localTimestamp ) ; this .
2,764
<s> package com . asakusafw . compiler . flow . mapreduce . parallel ; import java . util . List ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . DataClass ; import com . asakusafw . compiler . flow . DataClass . Property ; import com . asakusafw . compiler . flow . FlowCompilingEnvironment ; import com . asakusafw . utils . collections . Lists ; public class SlotResolver { private FlowCompilingEnvironment environment ; public SlotResolver ( FlowCompilingEnvironment environment ) { Precondition . checkMustNotBeNull ( environment , "environment" ) ; this . environment = environment ; } public List < ResolvedSlot > resolve ( List < Slot > slots ) { Precondition . checkMustNotBeNull ( slots , "slots" ) ; List < ResolvedSlot > results = Lists . create ( ) ; int number = 0 ; for ( Slot slot : slots ) { ResolvedSlot compiled = compile ( slot , number ++ ) ; results . add ( compiled ) ; } return results ; } private ResolvedSlot compile ( Slot slot , int number ) { assert slot != null ; DataClass valueClass = environment . getDataClasses ( ) . load ( slot . getType ( )
2,765
<s> package com . asakusafw . compiler . directio . emitter ; import java . io . IOException ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . directio . OutputPattern . CompiledOrder ; import com . asakusafw . compiler . flow . DataClass ; import com . asakusafw . compiler . flow . FlowCompilingEnvironment ; import com . asakusafw . runtime . io . util . InvertOrder ; import com . asakusafw . runtime . stage . directio . DirectOutputOrder ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . java . model . syntax . Comment ; import com . asakusafw . utils . java . model . syntax . CompilationUnit ; import com . asakusafw . utils . java . model . syntax . ConstructorDeclaration ; 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 . Javadoc ; 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 . QualifiedName ; 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 . ImportBuilder ; 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 class OrderingClassEmitter { static final Logger LOG = LoggerFactory . getLogger ( OrderingClassEmitter . class ) ; private final FlowCompilingEnvironment environment ; private final String moduleId ; public OrderingClassEmitter ( FlowCompilingEnvironment environment , String moduleId ) { Precondition . checkMustNotBeNull ( environment , "environment" ) ; Precondition . checkMustNotBeNull ( moduleId , "moduleId" ) ; this . environment = environment ; this . moduleId = moduleId ; } public Name emit ( String outputName , int index , DataClass dataType , List < CompiledOrder > orderingInfo ) throws IOException { if ( outputName == null ) { throw new IllegalArgumentException ( "" ) ; } if ( dataType == null ) { throw new IllegalArgumentException ( "" ) ; } if ( orderingInfo == null ) { throw new IllegalArgumentException ( "" ) ; } LOG . debug ( "" , new Object [ ] { environment . getBatchId ( ) , environment . getFlowId ( ) , outputName , } ) ; Engine engine = new Engine ( environment , moduleId , outputName , index , dataType , orderingInfo ) ; CompilationUnit source = engine . generate ( ) ; environment . emit ( source ) ; Name packageName = source . getPackageDeclaration ( ) . getName ( ) ; SimpleName simpleName = source . getTypeDeclarations ( ) . get ( 0 ) . getName ( ) ; QualifiedName name = environment . getModelFactory ( ) . newQualifiedName ( packageName , simpleName ) ; LOG . debug ( "" , new Object [ ] { environment . getBatchId ( ) , environment . getFlowId ( ) , outputName , name . toNameString ( ) , } ) ; return name ; } private static final class Engine { private final String moduleId ; private final String outputName ; private final int index ; private final DataClass dataType ; private final List < CompiledOrder > orderingInfo ; private final ModelFactory factory ; private final ImportBuilder importer ; Engine ( FlowCompilingEnvironment environment , String moduleId , String outputName , int index , DataClass dataType , List < CompiledOrder > orderingInfo ) { assert environment != null ; assert moduleId != null ; assert outputName != null ; assert dataType != null ; assert orderingInfo != null ; this . moduleId = moduleId ; this . outputName = outputName ; this . index = index ; this . dataType = dataType ; this . orderingInfo = orderingInfo ; this . factory = environment . getModelFactory ( ) ; Name packageName = environment . getEpiloguePackageName ( moduleId ) ; this . importer = new ImportBuilder ( factory , factory . newPackageDeclaration ( packageName ) , ImportBuilder . Strategy . TOP_LEVEL ) ; } public CompilationUnit generate ( ) { TypeDeclaration type = createType ( ) ; return factory . newCompilationUnit ( importer . getPackageDeclaration ( ) , importer . toImportDeclarations ( ) , Collections . singletonList ( type ) , Collections . < Comment > emptyList ( ) ) ; } private TypeDeclaration createType ( ) { SimpleName name = getClassName ( ) ; importer . resolvePackageMember ( name ) ; List < TypeBodyDeclaration > members = Lists . create ( ) ; members . addAll ( createFields ( ) ) ; members . add ( createConstructor ( ) ) ; members . add ( createSetMethod ( ) ) ; return factory . newClassDeclaration ( createJavadoc ( ) , new AttributeBuilder ( factory ) . Public ( ) . Final ( ) . toAttributes ( ) , name , Collections . < TypeParameterDeclaration > emptyList ( ) , t ( DirectOutputOrder . class ) , Collections . < Type > emptyList ( ) , members ) ; } private List < FieldDeclaration > createFields ( ) { List < FieldDeclaration > results = Lists . create ( ) ; for ( CompiledOrder order : orderingInfo ) { results . add ( factory . newFieldDeclaration ( null , new AttributeBuilder ( factory ) . Private ( ) . Final ( ) . toAttributes ( ) , t ( order . getTarget ( ) . getType ( ) ) , factory . newSimpleName ( order . getTarget ( ) . getName ( ) ) , null ) ) ; } return results ; } private ConstructorDeclaration createConstructor ( ) { List < Expression > arguments = Lists . create ( ) ; for ( CompiledOrder order : orderingInfo ) { Expression arg = order . getTarget ( ) . createNewInstance ( t ( order . getTarget ( ) . getType ( ) ) ) ; if ( order . isAscend ( ) == false ) { arg = new TypeBuilder ( factory , t ( InvertOrder . class ) ) . newObject ( arg ) . toExpression ( ) ; } arguments . add ( arg ) ; } List < Statement > statements = Lists . create ( ) ; statements . add ( factory . newSuperConstructorInvocation ( arguments ) ) ; int position = 0 ; for ( CompiledOrder order : orderingInfo ) { Expression obj = new ExpressionBuilder ( factory , factory . newThis ( ) ) . method ( "get" , Models . toLiteral ( factory , position ) ) . toExpression ( ) ; if ( order . isAscend ( ) == false ) { Expression invert = factory . newParenthesizedExpression ( new ExpressionBuilder ( factory , obj ) . castTo ( t ( InvertOrder . class ) ) . toExpression ( ) ) ; obj = new ExpressionBuilder ( factory , invert ) . method ( "getEntity" ) . toExpression ( ) ; } statements . add ( new ExpressionBuilder ( factory , factory . newThis ( ) ) . field ( order . getTarget ( ) . getName ( ) ) . assignFrom ( new ExpressionBuilder ( factory , obj ) . castTo (
2,766
<s> package org . springframework . social . google . connect ; import org . springframework . social . google . api . Google ; import org . springframework . social . google . api . impl . GoogleTemplate ; import org . springframework . social . oauth2 .
2,767
<s> package org . rubypeople . rdt . refactoring . tests . core . renamelocal . conditionchecks ; import java . io . FileNotFoundException ; import java . io . IOException ; import org . rubypeople . rdt . refactoring . core . renamelocal . RenameLocalConditionChecker ; import org . rubypeople . rdt . refactoring . core . renamelocal . RenameLocalConfig ; import org . rubypeople . rdt . refactoring . tests . FilePropertyData ; import org . rubypeople . rdt . refactoring . tests . FileTestData ; import org .
2,768
<s> package org . rubypeople . rdt . internal . core . parser ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import org . jruby . common . IRubyWarnings ; import org . jruby . lexer . yacc . IDESourcePosition ; import org . jruby . lexer . yacc . ISourcePosition ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . compiler . CategorizedProblem ; import org . rubypeople . rdt . core . compiler . IProblem ; import org . rubypeople . rdt . internal . core . util . Util ; public class RdtWarnings implements IRubyWarnings { private List < CategorizedProblem > warnings ; private String fileName ; public RdtWarnings ( String fileName ) { this . fileName = fileName ; warnings = new ArrayList < CategorizedProblem > ( ) ; } public List
2,769
<s> package com . asakusafw . compiler . testing ; import java . io . File ; import java . util . List ; import com . asakusafw . compiler . batch . Workflow ; import com . asakusafw . compiler . common . Precondition ; public class BatchInfo { private final Workflow workflow ; private final List < JobflowInfo > jobflows ; private final File output ; public BatchInfo ( Workflow workflow , File output , List < JobflowInfo > jobflows ) { Precondition . checkMustNotBeNull ( workflow , "workflow" ) ; Precondition . checkMustNotBeNull ( output , "output" ) ; Precondition . checkMustNotBeNull ( jobflows , "jobflows" ) ; this . workflow =
2,770
<s> package org . rubypeople . rdt . internal . launching ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import org . eclipse . core . runtime . IPath ; import org . rubypeople . rdt . core . ILoadpathContainer ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . launching . IVMInstall ; import org . rubypeople . rdt . launching . IVMInstallChangedListener ; import org . rubypeople . rdt . launching . PropertyChangeEvent ; import org . rubypeople . rdt . launching . RubyRuntime ; public class RubyVMContainer implements ILoadpathContainer { private static Map fgLoadpathEntries ; private IVMInstall fInterpreter ; private IPath fPath ; public RubyVMContainer ( IVMInstall interpreter , IPath path ) { fInterpreter = interpreter ; fPath = path ; } public String getDescription ( ) { return "" ; } public ILoadpathEntry [ ] getLoadpathEntries ( ) { return getLoadpathEntries ( fInterpreter ) ; } private static ILoadpathEntry [ ] getLoadpathEntries ( IVMInstall vm ) { if ( fgLoadpathEntries == null ) { fgLoadpathEntries = new HashMap ( 10 ) ; IVMInstallChangedListener listener = new IVMInstallChangedListener ( ) { public void defaultVMInstallChanged ( IVMInstall previous , IVMInstall current ) { } public void vmChanged ( PropertyChangeEvent
2,771
<s> package org . rubypeople . rdt . core . tests . util ; import java . io . File ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . CoreException ; public class Util { private static int DELETE_MAX_TIME = 0 ; public static boolean DELETE_DEBUG = false ; public static int DELETE_MAX_WAIT = 10000 ; public static String convertToIndependantLineDelimiter ( String source ) { if ( source . indexOf ( '\n' ) == - 1 && source . indexOf ( '\r' ) == - 1 ) return source ; StringBuffer buffer = new StringBuffer ( ) ; for ( int i = 0 , length = source . length ( ) ; i < length ; i ++ ) { char car = source . charAt ( i ) ; if ( car == '\r' ) { buffer . append ( '\n' ) ; if ( i < length - 1 && source . charAt ( i + 1 ) == '\n' ) { i ++ ; } } else { buffer . append ( car ) ; } } return buffer . toString ( ) ; } public static boolean delete ( IResource resource ) { try { resource . delete ( true , null ) ; if ( isResourceDeleted ( resource ) ) { return true ; } } catch ( CoreException e ) { } return waitUntilResourceDeleted ( resource ) ; } public static boolean isResourceDeleted ( IResource resource ) { return ! resource . isAccessible ( ) && getParentChildResource ( resource ) == null ; } private static IResource getParentChildResource ( IResource resource ) { IContainer parent = resource . getParent ( ) ; if ( parent == null || ! parent . exists ( ) ) return null ; try { IResource [ ] members = parent . members ( ) ; int length = members == null ? 0 : members . length ; if ( length > 0 ) { for ( int i = 0 ; i < length ; i ++ ) { if ( members [ i ] == resource ) { return members [ i ] ; } else if ( members [ i ] . equals ( resource ) ) { return members [ i ] ; } else if ( members [ i ] . getFullPath ( ) . equals ( resource . getFullPath ( ) ) ) { return members [ i ] ; } } } } catch ( CoreException ce ) { } return null ; } private static boolean waitUntilResourceDeleted ( IResource resource ) { File file = resource . getLocation ( ) . toFile ( ) ; if ( DELETE_DEBUG ) { System . out . println ( ) ; System . out . println ( "" + getTestName ( ) ) ; System . out . println ( "" + resource ) ; printRdtCoreStackTrace ( null , 1 ) ; printFileInfo ( file . getParentFile ( ) , 1 , - 1 ) ; System . out . print ( "" + DELETE_MAX_WAIT + "ms max): " ) ; } int count = 0 ; int delay = 10 ; int maxRetry = DELETE_MAX_WAIT / delay ; int time = 0 ; while ( count < maxRetry ) { try { count ++ ; Thread . sleep ( delay ) ; time += delay ; if ( time > DELETE_MAX_TIME ) DELETE_MAX_TIME = time ; if ( DELETE_DEBUG ) System . out . print ( '.' ) ; if ( resource . isAccessible ( ) ) { try { resource . delete ( true , null ) ; if ( isResourceDeleted ( resource ) && isFileDeleted ( file ) ) { if ( DELETE_DEBUG ) { System . out . println ( ) ; System . out . println ( "" + time + "ms (max=" + DELETE_MAX_TIME + "ms)" ) ; System . out . println ( ) ; } return true ; } } catch ( CoreException e ) { } } if ( isResourceDeleted ( resource ) && isFileDeleted ( file ) ) { if ( DELETE_DEBUG ) { System . out . println ( ) ; System . out . println ( "" + time + "ms (max=" + DELETE_MAX_TIME + "ms)" ) ; System . out . println ( ) ; } return true ; } if ( count >= 10 && delay <= 100 ) { count = 1 ; delay *= 10 ; maxRetry = DELETE_MAX_WAIT / delay ; if ( ( DELETE_MAX_WAIT % delay ) != 0 ) { maxRetry ++ ; } } } catch ( InterruptedException ie ) { break ; } } if ( ! DELETE_DEBUG ) { System . out . println ( ) ; System . out . println ( "" + getTestName ( ) ) ; System . out . println ( "" + resource ) ; printRdtCoreStackTrace ( null , 1 ) ; printFileInfo ( file . getParentFile ( ) , 1 , - 1 ) ; } System . out . println ( ) ; System . out . println ( "t!!! ERROR: " + resource + "" + DELETE_MAX_TIME + "ms!!!" ) ; System . out . println ( ) ; return false ; } private static String getTestName ( ) { StackTraceElement [ ] elements = new Exception ( ) . getStackTrace ( ) ; int idx = 0 , length = elements . length ; while ( idx < length && ! elements [ idx ++ ] . getClassName ( ) . startsWith ( "" ) ) { } if ( idx < length ) { StackTraceElement testElement = null ; while ( idx < length && elements [ idx ] . getClassName ( ) . startsWith ( "" ) ) { testElement = elements [ idx ++ ] ; } if ( testElement != null ) { return testElement . getClassName ( ) + " - " + testElement . getMethodName ( ) ; } } return "?" ; } public static boolean isFileDeleted ( File file ) { return ! file . exists ( ) && getParentChildFile ( file ) == null ; } private static File getParentChildFile ( File file ) { File parent = file . getParentFile ( ) ; if ( parent == null || ! parent . exists ( ) ) return null ; File [ ] files = parent . listFiles ( ) ; int length = files == null ? 0 : files . length ; if ( length > 0 ) { for ( int i = 0 ; i < length ; i ++ ) { if ( files [ i ] == file ) { return files [ i ] ; } else if ( files [ i ] . equals ( file ) ) { return files [ i ] ; } else if ( files [ i ] . getPath ( ) . equals ( file . getPath ( ) ) ) { return files [ i ] ; } } } return null ; } private static void printFileInfo ( File file , int indent , int recurse ) { String tab = "" ; for ( int i = 0 ; i < indent ; i ++ ) tab += "t" ; System . out . print ( tab + "- " + file . getName ( ) + " file info: " ) ; String sep = "" ; if ( file . canRead ( ) ) { System . out . print ( "read" ) ; sep = ", " ; } if ( file . canWrite ( ) ) { System . out . print ( sep + "write" ) ; sep = ", " ; } if ( file . exists ( ) ) { System . out . print ( sep + "exist" ) ; sep = ", " ; } if ( file . isDirectory ( ) ) { System . out . print ( sep + "dir" ) ; sep = ", " ; } if ( file . isFile ( ) ) { System . out . print ( sep + "file" ) ; sep = ", " ; } if ( file . isHidden ( ) ) { System . out . print ( sep + "hidden" ) ; sep = ", " ; } System . out . println ( ) ; File [ ] files = file . listFiles ( ) ; int length = files == null ? 0 : files . length ; if ( length > 0 ) { boolean children = recurse < 0 ; System . out . print ( tab + "" ) ; if ( children ) System . out . println ( ) ; for ( int i = 0 ; i < length ; i ++ ) { if ( children ) { printFileInfo ( files [ i ] , indent + 2 , - 1 ) ; } else { if ( i > 0 ) System . out . print ( ", " ) ; System . out . print ( files [ i ] . getName ( ) ) ; if ( files [ i ] . isDirectory ( ) ) System . out . print ( "[dir]" ) ; else if ( files [ i ] . isFile ( ) ) System . out . print ( "[file]" ) ; else System . out . print ( "[?]" ) ; } } if ( ! children ) System . out . println ( ) ; } if ( recurse > 0 ) { File parent = file . getParentFile ( ) ; if ( parent != null ) printFileInfo ( parent , indent + 1 , recurse - 1 ) ; } } private static void printRdtCoreStackTrace ( Exception exception , int indent ) { String tab = "" ; for ( int i = 0 ; i < indent ; i ++ ) tab += "t" ; StackTraceElement [ ] elements = ( exception == null ? new Exception ( ) : exception ) . getStackTrace ( ) ; int idx = 0 , length = elements . length ; while ( idx < length && ! elements [ idx ++ ] . getClassName ( ) . startsWith ( "" ) ) { } if ( idx < length ) { System . out . print ( tab + "" ) ; if ( exception == null ) System . out . println ( ":" ) ; else System . out . println ( "" + exception + ":" ) ; while ( idx < length && elements [ idx ] . getClassName ( ) . startsWith ( "" ) ) { StackTraceElement testElement = elements [ idx ++ ] ; System . out . println ( tab + "t-> " + testElement ) ; } } else { exception . printStackTrace ( System . out ) ; } } public static String displayString ( String inputString , int indent ) { return displayString ( inputString , indent , false ) ; } public static String displayString ( String inputString ) { return displayString ( inputString , 0 ) ; } public static String displayString ( String inputString , int indent , boolean shift ) { if ( inputString == null ) return "null" ; int length = inputString . length ( ) ; StringBuffer buffer = new StringBuffer ( length ) ; java . util . StringTokenizer tokenizer = new java . util . StringTokenizer ( inputString , "nr" , true ) ; for ( int i = 0 ; i < indent ; i ++ ) buffer . append ( "t" ) ; if ( shift ) indent ++ ; buffer . append ( "\"" ) ; while ( tokenizer . hasMoreTokens ( ) ) { String token = tokenizer . nextToken ( ) ; if ( token . equals ( "r" ) ) { buffer . append ( "\\r" ) ; if ( tokenizer . hasMoreTokens ( ) ) { token = tokenizer . nextToken ( ) ; if ( token . equals ( "n" ) ) { buffer . append ( "\\n" ) ; if ( tokenizer . hasMoreTokens ( ) ) { buffer . append ( "\" + n" ) ; for ( int i = 0 ; i < indent ; i ++ ) buffer . append ( "t" ) ; buffer . append ( "\"" ) ; } continue ; } buffer . append ( "\" + n" ) ; for ( int i = 0 ; i < indent ; i ++ ) buffer . append ( "t" ) ; buffer . append ( "\"" ) ; } else { continue ; } } else if ( token . equals ( "n" ) ) { buffer . append ( "\\n" ) ; if ( tokenizer . hasMoreTokens ( ) ) { buffer . append ( "\" + n" ) ; for ( int i = 0 ; i < indent ; i ++ ) buffer . append ( "t" ) ; buffer . append ( "\"" ) ; } continue ; } StringBuffer tokenBuffer = new StringBuffer ( ) ; for ( int i = 0 ; i < token . length ( ) ; i ++ ) { char c = token . charAt ( i ) ; switch ( c ) { case '\r' : tokenBuffer . append ( "\\r" ) ; break ; case '\n' : tokenBuffer . append ( "\\n" ) ; break ; case '\b' :
2,772
<s> package com . asakusafw . compiler . yaess . testing . batch ; import com . asakusafw . compiler . yaess
2,773
<s> package org . rubypeople . rdt . internal . launching ; import org . rubypeople . rdt . launching . IRubyLaunchConfigurationConstants ; public interface RubyLaunchConfigurationAttribute { static final String SELECTED_INTERPRETER = IRubyLaunchConfigurationConstants . ATTR_VM_INSTALL_NAME ; static final
2,774
<s> package com . pogofish . jadt . samples . ast ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Set ; import org . junit . Test ; import com . pogofish . jadt . samples . ast . Usage ; import com . pogofish . jadt . samples . ast . data . * ; import static com . pogofish . jadt . samples . ast . data . Arg . _Arg ; import static com . pogofish . jadt . samples . ast . data . Expression . * ; import static com . pogofish . jadt . samples . ast . data . Function . * ; import static com . pogofish . jadt . samples . ast . data . Statement . * ; import static com . pogofish . jadt . samples . ast . data . Type . * ; import static java . util . Arrays . asList ; import static org . junit . Assert . * ; public class UsageTest { static final Usage usage = new Usage ( ) ; @ Test public void testSampleFunction ( ) { final Function expectedFunction = _Function ( _Int ( ) , "addTwo" , asList ( _Arg ( _Int ( ) , "x" ) , _Arg ( _Int ( ) , "y" ) ) , asList ( _Return ( _Add ( _Variable ( "x" ) , _Variable ( "y" ) ) ) ) ) ; assertEquals
2,775
<s> package org . oddjob . state ; import org . oddjob . images . IconHelper ;
2,776
<s> package br . com . caelum . vraptor . dash . statistics ; import java . util . List ; import br . com . caelum . vraptor . Result ; public class Collectors implements Collector { private List < Collector > collectors ; public Collectors ( List < Collector > collectors ) { this . collectors = collectors ; } @ Override public void collect ( Result
2,777
<s> package org . rubypeople . rdt . core . formatter ; import java . util . Map ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . formatter . DefaultCodeFormatterOptions ; public class DefaultCodeFormatterConstants { public static final String MIXED = "mixed" ; public static final String FORMATTER_INDENTATION_SIZE = RubyCore . PLUGIN_ID + "" ;
2,778
<s> package com . asakusafw . compiler . fileio . operator ; import java . util . Arrays ; import java . util . List ; import javax . annotation . Generated ; import com . asakusafw . compiler . fileio . model . Ex1 ; import com . asakusafw . compiler . fileio . model . Ex2 ; import com . asakusafw . compiler . fileio . model . ExSummarized ; import com . asakusafw . runtime . core . Result ; import com . asakusafw . vocabulary . flow . Operator ; import com . asakusafw . vocabulary . flow . Source ; import com . asakusafw . vocabulary . flow . graph . Connectivity ; import com . asakusafw . vocabulary . flow . graph . FlowBoundary ; import com . asakusafw . vocabulary . flow . graph . FlowElementResolver ; import com . asakusafw . vocabulary . flow . graph . ObservationCount ; import com . asakusafw . vocabulary . flow . graph . OperatorDescription ; import com . asakusafw . vocabulary . flow . graph . ShuffleKey ; import com . asakusafw . vocabulary . flow . processor . InputBuffer ; import com . asakusafw . vocabulary . flow . processor . PartialAggregation ; import com . asakusafw . vocabulary . operator . CoGroup ; import com . asakusafw . vocabulary . operator . Fold ; @ Generated ( "" ) public class ExOperatorFactory { public static final class FoldAdd implements Operator { private final FlowElementResolver $ ; public final Source < Ex1 > out ; FoldAdd ( Source < Ex1 > in ) { OperatorDescription . Builder builder = new OperatorDescription . Builder ( Fold . class ) ; builder . declare ( ExOperator . class , ExOperatorImpl . class , "foldAdd" ) ; builder . declareParameter ( Ex1 . class ) ; builder . declareParameter ( Ex1 . class ) ; builder . addInput ( "in" , in , new ShuffleKey ( Arrays . asList ( new String [ ] { "STRING" } ) , Arrays . asList ( new ShuffleKey . Order [ ] { } ) ) ) ; builder . addOutput ( "out" , in ) ; builder . addAttribute ( FlowBoundary . SHUFFLE ) ; builder . addAttribute ( ObservationCount . DONT_CARE ) ; builder . addAttribute ( PartialAggregation . DEFAULT ) ; this . $ = builder . toResolver ( ) ; this . $ . resolveInput ( "in" , in ) ; this . out = this . $ . resolveOutput ( "out" ) ; } public ExOperatorFactory . FoldAdd as ( String newName ) { this . $ . setName ( newName ) ; return this ; } } public ExOperatorFactory . FoldAdd foldAdd ( Source < Ex1 > in ) { return new ExOperatorFactory . FoldAdd ( in ) ; } public static final class Update implements Operator { private final FlowElementResolver $ ; public final Source < Ex1 > out ; Update ( Source < Ex1 > model , int value ) { OperatorDescription . Builder builder0 = new OperatorDescription . Builder ( com . asakusafw . vocabulary . operator . Update . class ) ; builder0 . declare ( ExOperator . class , ExOperatorImpl . class , "update" ) ; builder0 . declareParameter ( Ex1 . class ) ; builder0
2,779
<s> package net . sf . sveditor . ui . compare ; import net . sf . sveditor . ui . editor . SVDocumentPartitions ; import net . sf . sveditor . ui . editor . SVDocumentSetupParticipant ; import net . sf . sveditor . ui . editor . SVSourceViewerConfiguration ; import org . eclipse . compare . CompareConfiguration ; import org . eclipse . compare . contentmergeviewer . TextMergeViewer ; import org . eclipse . jface . text . IDocumentPartitioner ; import org . eclipse . jface . text . TextViewer ; import org . eclipse . jface . text . source . SourceViewer ; import org . eclipse . swt . SWT ; import org . eclipse . swt . widgets . Composite ; public class SVCompareViewer extends TextMergeViewer { public SVCompareViewer ( Composite parent , CompareConfiguration configuration ) { super ( parent , SWT . LEFT_TO_RIGHT , configuration ) ; } @ Override protected void configureTextViewer ( TextViewer textViewer ) { if ( textViewer instanceof SourceViewer ) { SourceViewer
2,780
<s> package com . loiane . dao ; import java . util . List ; import org . apache . ibatis . session . SqlSession ; import org . apache . ibatis . session . SqlSessionFactory ; import com . loiane . data . BlogMapper ; import com . loiane . model . Blog ; public class BlogAnnotationDAO { public List < Blog > selectAllBlogs ( ) { SqlSessionFactory sqlSessionFactory = MyBatisConnectionFactory . getSqlSessionFactory ( ) ; SqlSession session = sqlSessionFactory . openSession (
2,781
<s> package org . rubypeople . rdt . refactoring . offsetprovider ; import org . jruby . ast . MethodDefNode ; import org . jruby . ast . Node ; import org . rubypeople . rdt . refactoring . nodewrapper . MethodNodeWrapper ; public class AfterMethodOffsetProvider
2,782
<s> package org . rubypeople . rdt . refactoring . ui . pages ; import java . util . ArrayList ; import java . util . Collection ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . layout . FillLayout ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Event ; import org . eclipse . swt . widgets . List ; import org . eclipse . swt . widgets . Listener ; import org . eclipse . swt . widgets . Table ; import org . eclipse . swt . widgets . TableItem ; import org . jruby . ast . Node ; import org . rubypeople . rdt . core . formatter . ReWriteVisitor ; import org . rubypeople . rdt . refactoring . core . NodeFactory ; import org . rubypeople . rdt . refactoring . core . mergeclasspartsinfile . MergeClassPartInFileConfig ; 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 . ui . RdtCodeViewer ; import org . rubypeople . rdt . refactoring . ui . util . SwtUtils ; public class MergeClassPartsInFilePage extends RefactoringWizardPage { private static final String TITLE = Messages . MergeClassPartsInFilePage_SelectClassParts ; private RdtCodeViewer classView ; private String activeFileName ; private MergeClassPartInFileConfig config ; public MergeClassPartsInFilePage ( MergeClassPartInFileConfig config ) { super ( TITLE ) ; setTitle ( TITLE ) ; activeFileName = config . getDocumentProvider ( ) . getActiveFileName ( ) ; this . config = config ; } public void createControl ( Composite parent ) { Composite control = new Composite ( parent , SWT . NONE ) ; FillLayout baseLayout = new FillLayout ( ) ; baseLayout . spacing = 5 ; control . setLayout ( baseLayout ) ; initList ( control ) ; initSidePanel ( control ) ; setControl ( control ) ; } private void initSidePanel ( Composite control ) { Composite sidePanel = new Composite ( control , SWT . NONE ) ; FillLayout sidePanelLayout = new FillLayout ( SWT . VERTICAL ) ; sidePanelLayout . spacing = 5 ; sidePanel . setLayout ( sidePanelLayout ) ; String explTitle = Messages . MergeClassPartsInFilePage_Description ; String explText = Messages . MergeClassPartsInFilePage_Explanation ; SwtUtils . initExplanation ( sidePanel , explTitle , explText ) ; classView = RdtCodeViewer . create ( sidePanel ) ; } private void initList ( Composite control ) { Composite listSide = new Composite ( control , SWT . NONE ) ; FillLayout listSideLayout = new FillLayout ( SWT . VERTICAL ) ; listSideLayout . spacing = 5 ; listSide . setLayout ( listSideLayout ) ; final List classSelection = new List ( listSide , SWT . H_SCROLL | SWT . V_SCROLL | SWT . BORDER | SWT . SINGLE ) ; final Collection < ClassNodeWrapper > selectableClasses = config . getSelectableClasses ( ) ; for ( ClassNodeWrapper currentClass : selectableClasses ) { classSelection . add ( currentClass . getName ( ) ) ; } final Table partTable = new Table ( listSide , SWT . V_SCROLL | SWT . H_SCROLL | SWT . BORDER | SWT . CHECK | SWT . SINGLE ) ; classSelection . addSelectionListener ( createClassSelectionListener ( classSelection , selectableClasses , partTable ) ) ; partTable . addListener ( SWT . Selection , createPartSelectionListener ( partTable ) ) ; } private Listener createPartSelectionListener ( final Table partTable ) { return new Listener ( ) { private void setClassView ( final Table partTable ) { TableItem selectedItem = partTable . getSelection ( ) [ 0 ] ; PartialClassNodeWrapper classPart = ( PartialClassNodeWrapper ) selectedItem . getData ( ) ; Node classNode = classPart . getWrappedNode ( ) ; classView . setPreviewText ( ReWriteVisitor . createCodeFromNode ( NodeFactory . createNewLineNode ( classNode ) , "" ) ) ; } public void handleEvent ( Event event ) { ArrayList < PartialClassNodeWrapper > checkedParts = new ArrayList < PartialClassNodeWrapper > ( ) ; for ( TableItem currentItem : partTable . getItems ( ) ) { if ( currentItem . getChecked ( ) ) { checkedParts . add ( ( PartialClassNodeWrapper ) currentItem . getData ( ) ) ; } } partTable .
2,783
<s> package org . rubypeople . rdt . internal . corext . util ; import java . util . Arrays ; import java . util . Comparator ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . Path ; import org . rubypeople . rdt . core . IRubyModel ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; public class TypeInfoFactory { private String [ ] fProjects ; private TypeInfo fLast ; private char [ ] fBuffer ; private static final String RUBY = "rb" ; public TypeInfoFactory ( ) { super ( ) ; fProjects = getProjectList ( ) ; fLast = null ; fBuffer = new char [ 512 ] ; } public TypeInfo create ( char [ ] packageName , char [ ] typeName , char [ ] [ ] enclosingName , boolean isModule , String path ) { path = new Path ( path ) . toPortableString ( ) ; String pn = getPackageName ( packageName ) ; String tn = new String ( typeName ) ; TypeInfo result = null ; String project = getProject ( path ) ; if ( project != null ) { result = createIFileTypeInfo ( pn , tn , enclosingName , isModule , path , getIFileTypeInfo ( fLast ) , project ) ; } else { result = createExternalFileTypeInfo ( pn , tn , enclosingName , isModule , path ) ; } if ( result == null ) { result = new UnresolvableTypeInfo ( pn , tn , enclosingName , isModule , path ) ; } else { fLast = result ; } return result ; } private TypeInfo createExternalFileTypeInfo ( String packageName , String typeName , char [ ] [ ] enclosingName , boolean isModule , String path ) { return new ExternalFileTypeInfo ( packageName , typeName , enclosingName , isModule , path ) ; } private static IFileTypeInfo getIFileTypeInfo ( TypeInfo info ) { if ( info == null || info . getElementType ( ) != TypeInfo . IFILE_TYPE_INFO ) return null ; return ( IFileTypeInfo ) info ; } private TypeInfo createIFileTypeInfo ( String packageName , String typeName , char [ ] [ ] enclosingName , boolean isModule , String path , IFileTypeInfo last , String project ) { String rest = path . substring ( project . length ( ) + 1 ) ; int index = rest . lastIndexOf ( TypeInfo . SEPARATOR ) ; if ( index == - 1 ) return null ; String middle = rest . substring ( 0 , index ) ; rest = rest . substring ( index + 1 ) ; index = rest . lastIndexOf ( TypeInfo . EXTENSION_SEPARATOR ) ; String file = null ; String extension = null ; if ( index != - 1 ) { file = rest . substring ( 0 , index ) ; extension = rest . substring ( index + 1 ) ; } else { return null ; } String src = null ; int ml = middle . length ( ) ; int pl = packageName . length ( ) ; if ( ml > 0 && ml - 1 > pl ) { src = middle . substring ( 1 , ml - pl - ( pl > 0 ? 1 : 0 ) ) ; } if ( last != null ) { if ( src != null && src . equals ( last . getFolder ( ) ) ) src = last . getFolder ( ) ; } if ( typeName . equals ( file ) ) { file = typeName ; } else { file = createString ( file ) ; } if ( RUBY . equals ( extension ) ) extension = RUBY ; else extension = createString ( extension ) ; return new IFileTypeInfo ( packageName , typeName , enclosingName , isModule , project , src , file , extension ) ; } private String getPackageName ( char [ ] packageName ) { if ( fLast == null ) return new String ( packageName ) ; String lastPackageName = fLast . getPackageName ( ) ; if ( Strings . equals ( lastPackageName , packageName ) ) return lastPackageName ; return new String ( packageName ) ; } private String getProject ( String path ) { for ( int i = 0 ; i < fProjects . length ; i ++ ) { String project = fProjects
2,784
<s> package net . sf . sveditor . core . diagrams ; import net . sf . sveditor . core . db . ISVDBChildParent ; import net . sf . sveditor . core . db . SVDBClassDecl ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . index . ISVDBIndex ; import net . sf . sveditor . core . db . search . SVDBFindSuperClass ; public class ClassDiagModelFactory extends AbstractDiagModelFactory { private SVDBClassDecl fClassDecl ; public ClassDiagModelFactory ( ISVDBIndex index , SVDBClassDecl
2,785
<s> package net . sf . sveditor . core . tests . index . src_collection ; import java . io . File ; import java . util . ArrayList ; import java . util . List ; import junit . framework . TestCase ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . StringInputStream ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBMarker ; import net . sf . sveditor . core . db . index . ISVDBIndex ; import net . sf . sveditor . core . db . index . ISVDBIndexChangeListener ; import net . sf . sveditor . core . db . index . ISVDBItemIterator ; import net . sf . sveditor . core . db . index . SVDBIndexRegistry ; import net . sf . sveditor . core . db . index . SVDBSourceCollectionIndexFactory ; import net . sf . sveditor . core . db . project . SVDBProjectData ; import net . sf . sveditor . core . db . project . SVDBProjectManager ; import net . sf . sveditor . core . tests . SVCoreTestsPlugin ; import net . sf . sveditor . core . tests . TestIndexCacheFactory ; import net . sf . sveditor . core . tests . utils . BundleUtils ; import net . sf . sveditor . core . tests . utils . TestUtils ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . NullProgressMonitor ; public class TestSrcCollectionWSChanges extends TestCase implements ISVDBIndexChangeListener { private int fIndexRebuilt ; private File fTmpDir ; @ Override protected void setUp ( ) throws Exception { super . setUp ( ) ; fTmpDir = TestUtils . createTempDir ( ) ; } @ Override protected void tearDown ( ) throws Exception { super . tearDown ( ) ; SVCorePlugin . getDefault ( ) . getSVDBIndexRegistry ( ) . save_state ( ) ; if ( fTmpDir != null ) { TestUtils . delete ( fTmpDir ) ; fTmpDir = null ; } } public void testFileAdded ( ) { fIndexRebuilt = 0 ; BundleUtils utils = new BundleUtils ( SVCoreTestsPlugin . getDefault ( ) . getBundle ( ) ) ; IProject project_dir = TestUtils . createProject ( "project" ) ; utils . copyBundleDirToWS ( "" , project_dir ) ; File db = new File ( fTmpDir , "db" ) ; if ( db . exists ( ) ) { db . delete ( ) ; } SVDBIndexRegistry rgy = SVCorePlugin . getDefault ( ) . getSVDBIndexRegistry ( ) ; rgy . init ( TestIndexCacheFactory . instance ( db ) ) ; SVCorePlugin . getDefault ( ) . getProjMgr ( ) . init ( ) ; ISVDBIndex index = rgy . findCreateIndex ( new NullProgressMonitor ( ) , "project" , "" , SVDBSourceCollectionIndexFactory . TYPE , null ) ; index . addChangeListener ( this ) ; SVDBProjectManager p_mgr = SVCorePlugin . getDefault ( ) . getProjMgr ( ) ; SVDBProjectData p_data = p_mgr . getProjectData ( project_dir ) ; p_data . getProjectIndexMgr ( ) . getItemIterator ( new NullProgressMonitor ( ) ) ; String class_str = "" + "" + "" + "endclassn" ; IFile class_1_2_file = project_dir . getFile ( "" ) ; try { class_1_2_file . create ( new StringInputStream ( class_str ) , true , new NullProgressMonitor ( ) ) ; } catch ( CoreException e ) { e . printStackTrace ( ) ; fail ( "" + e . getMessage ( ) ) ; } try { index . parse ( new NullProgressMonitor ( ) , class_1_2_file . getContents ( ) , "" + class_1_2_file . getFullPath ( ) , null ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; fail ( "" + e . getMessage ( ) ) ; }
2,786
<s> package com . asakusafw . windgate . stream ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . FileOutputStream ; import java . io . IOException ; import java . io . OutputStream ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . List ; import java . util . Scanner ; import org . junit . Assume ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; public class StreamDrainDriverTest { @ Rule public TemporaryFolder folder = new TemporaryFolder ( ) ; @ Test public void simple ( ) throws Exception { File file = folder . newFile ( "testing" ) ; StreamDrainDriver < StringBuilder > driver = new StreamDrainDriver < StringBuilder > ( "streaming" , "testing" , wrap ( new FileOutputStreamProvider
2,787
<s> package de . fuberlin . wiwiss . d2rq . jena ; import java . util . HashMap ; import java . util . Map ; import com . hp . hpl . jena . graph . Graph ; import com . hp . hpl . jena . graph . Node ; import com . hp . hpl . jena . graph . Triple ; import com . hp . hpl . jena . graph . query . BindingQueryPlan ; import com . hp . hpl . jena . graph . query . Domain ; import com . hp . hpl . jena . graph . query . Query ; import com . hp . hpl . jena . graph . query . QueryHandler ; import com . hp . hpl . jena . graph . query . SimpleQueryHandler ; import com . hp . hpl . jena . graph . query . TreeQueryPlan ; import com . hp . hpl . jena . sparql . algebra . op . OpBGP ; import com . hp . hpl . jena . sparql . core . BasicPattern ; import com . hp . hpl . jena . sparql . core . DatasetGraph ; import com . hp . hpl . jena . sparql . core . DatasetGraphFactory ; import com . hp . hpl . jena . sparql . core . Var ; import com . hp . hpl . jena . sparql . engine . Plan ; import com . hp . hpl . jena . sparql . engine . binding . Binding ; import com . hp . hpl . jena . util . iterator . ExtendedIterator ; import com . hp . hpl . jena . util . iterator . Map1 ; import com . hp . hpl . jena . util . iterator . Map1Iterator ; import de . fuberlin . wiwiss . d2rq . engine . QueryEngineD2RQ ; public class D2RQQueryHandler extends SimpleQueryHandler { private final DatasetGraph dataset ; private Node [ ] variables ; private Map < Node , Integer > indexes ; public D2RQQueryHandler ( GraphD2RQ graph ) { super ( graph ) ; dataset = DatasetGraphFactory . createOneGraph ( graph ) ; } public TreeQueryPlan prepareTree ( Graph pattern ) { throw new RuntimeException ( "" ) ; } public BindingQueryPlan prepareBindings ( Query q , Node [ ] variables ) { this . variables = variables ; this . indexes = new HashMap < Node , Integer > ( ) ; for ( int i = 0 ; i < variables . length ; i ++ ) { indexes . put ( variables [ i ] , new Integer ( i ) ) ; } BasicPattern pattern = new BasicPattern ( ) ; for ( Triple t : q . getPattern ( ) ) { pattern . add ( t ) ; } Plan plan = QueryEngineD2RQ . getFactory ( ) . create ( new OpBGP ( pattern ) , dataset , null , null ) ; final ExtendedIterator < Domain > queryIterator = new Map1Iterator < Binding , Domain > ( new BindingToDomain ( )
2,788
<s> package com . asakusafw . compiler . flow . mapreduce . parallel ; import java . io . IOException ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import org . apache . hadoop . io . Writable ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . common . Naming ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . flow . DataClass ; import com . asakusafw . compiler . flow . FlowCompilingEnvironment ; import com . asakusafw . compiler . flow . stage . CompiledType ; import com . asakusafw . runtime . stage . collector . SlotSorter ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . java . model . syntax . Comment ; import com . asakusafw . utils . java . model . syntax . CompilationUnit ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . FormalParameterDeclaration ; 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 . Type ; 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 . ImportBuilder ; import com . asakusafw . utils . java . model . util . ImportBuilder . Strategy ; import com . asakusafw . utils . java . model . util . JavadocBuilder ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . utils . java . model . util . TypeBuilder ; final class ParallelSortReducerEmitter { static final Logger LOG = LoggerFactory . getLogger ( ParallelSortReducerEmitter . class ) ; private final FlowCompilingEnvironment environment ; public ParallelSortReducerEmitter ( FlowCompilingEnvironment environment ) { Precondition . checkMustNotBeNull ( environment , "environment" ) ; this . environment = environment ; } public CompiledType emit ( String moduleId , List < ResolvedSlot > slots ) throws IOException { LOG . debug ( "" , moduleId ) ; Engine engine = new Engine ( environment , moduleId , slots ) ; CompilationUnit source = engine . generate ( ) ; environment . emit ( source ) ; Name packageName = source . getPackageDeclaration (
2,789
<s> package com . asakusafw . windgate . hadoopfs . jsch ; import java . io . IOException ; import java . io . InputStream ; import java . io . OutputStream ; import java . text . MessageFormat ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . concurrent . TimeUnit ; import java . util . regex . Pattern ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . runtime . core . context . RuntimeContext ; import com . asakusafw . windgate . core . WindGateLogger ; import com . asakusafw . windgate . hadoopfs . HadoopFsLogger ; import com . asakusafw . windgate . hadoopfs . ssh . SshConnection ; import com . asakusafw . windgate . hadoopfs . ssh . SshProfile ; import com . jcraft . jsch . ChannelExec ; import com . jcraft . jsch . JSch ; import com . jcraft . jsch . JSchException ; import com . jcraft . jsch . Session ; class JschConnection implements SshConnection { static final WindGateLogger WGLOG = new HadoopFsLogger ( JschConnection . class ) ; static final Logger LOG = LoggerFactory . getLogger ( JschConnection . class ) ; private static final Pattern SH_NAME = Pattern . compile ( "" ) ; private static final Pattern SH_METACHARACTERS = Pattern . compile ( "[\\$`\"\\\\n]" ) ; private final Session session ; private final ChannelExec channel ; private final SshProfile profile ; private final String command ; public JschConnection ( SshProfile profile , List < String > commandLineTokens ) throws IOException { if ( profile == null ) { throw new IllegalArgumentException ( "" ) ; } if ( commandLineTokens == null ) { throw new IllegalArgumentException ( "" ) ; } this . profile = profile ; this . command = buildCommand ( commandLineTokens , profile . getEnvironmentVariables ( ) ) ; try { JSch jsch = new JSch ( ) ; jsch . addIdentity ( profile . getPrivateKey ( ) , profile . getPassPhrase ( ) ) ; session = jsch . getSession ( profile . getUser ( ) , profile . getHost ( ) , profile . getPort ( ) ) ; session . setConfig ( "" , "no" ) ; session . setServerAliveInterval ( ( int ) TimeUnit . SECONDS . toMillis ( 10 ) ) ; session . setTimeout ( ( int ) TimeUnit . SECONDS . toMillis ( 60 ) ) ; WGLOG . info ( "I30001" , profile . getResourceName ( ) , profile . getUser ( ) , profile . getHost ( ) , profile . getPort ( ) ) ; session . connect ( ) ; WGLOG . info ( "I30002" , profile . getResourceName ( ) , profile . getUser ( ) , profile . getHost ( ) ,
2,790
<s> package com . asakusafw . compiler . flow . processor . flow ; import com . asakusafw . compiler . flow . processor . ExtendFlowProcessor ; import com . asakusafw . compiler . flow . testing . external . Ex1MockExporterDescription ; import com . asakusafw . compiler . flow . testing . external . Part1MockImporterDescription ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . model . Part1 ; import com . asakusafw . vocabulary . flow . Export ; import com . asakusafw . vocabulary . flow . FlowDescription ; import com . asakusafw . vocabulary . flow . Import ; import com . asakusafw . vocabulary . flow . In ; import com . asakusafw . vocabulary . flow . JobFlow ; import com . asakusafw . vocabulary . flow . Out ; import com . asakusafw . vocabulary . flow . util . CoreOperatorFactory ; import com . asakusafw . vocabulary . flow . util . CoreOperatorFactory . Extend ; @ JobFlow ( name = "testing" ) public class ExtendFlowSimple extends FlowDescription { private final In < Part1 > in ; private final
2,791
<s> package org . oddjob . schedules . schedules ; import java . io . Serializable ; import java . util . Calendar ; import java . util . Date ; import java . util . TimeZone ; import org . oddjob . arooa . deploy . annotations . ArooaAttribute ; import org . oddjob . schedules . CalendarUnit ; import org . oddjob . schedules . CalendarUtils ; import org . oddjob . schedules . ConstrainedSchedule ; import org . oddjob . schedules . units . DayOfWeek ; final public class WeeklySchedule extends ConstrainedSchedule implements Serializable { private static final long serialVersionUID = 20050226 ; private DayOfWeek from ; private DayOfWeek to ;
2,792
<s> package com . asakusafw . testtools . inspect ; import java . lang . reflect . InvocationTargetException ; import java . lang . reflect . Method ; import java . util . Calendar ; import org . apache . hadoop . io . Writable ; import com . asakusafw . runtime . value . Date ; import com . asakusafw . runtime . value . DateOption ; import com . asakusafw . runtime . value . DateTime ; import com . asakusafw . runtime . value . DateTimeOption ; import com . asakusafw . runtime . value . StringOption ; import com . asakusafw . runtime . value . ValueOption ; import com . asakusafw . testtools . ColumnInfo ; import com . asakusafw . testtools . inspect . Cause . Type ; public final class DefaultInspector extends AbstractInspector { @ Override protected void inspect ( Writable expectRow , Writable actualRow ) { for ( ColumnInfo columnInfo : getColumnInfos ( ) ) { Method method ; try { method = expectRow . getClass ( ) . getMethod ( columnInfo . getGetterName ( ) ) ; ValueOption < ? > expectVal = ( ValueOption < ? > ) method . invoke ( expectRow ) ; ValueOption < ? > actualVal = ( ValueOption < ? > ) method . invoke ( actualRow ) ; inspect ( expectRow , actualRow , expectVal , actualVal , columnInfo ) ; } catch ( SecurityException e ) { throw new RuntimeException ( e ) ; } catch ( NoSuchMethodException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalArgumentException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; } catch ( InvocationTargetException e ) { throw new RuntimeException ( e ) ; } } } private void inspect ( Writable expect , Writable actual , ValueOption < ? > expectVal , ValueOption < ? > actualVal , ColumnInfo columnInfo ) { if ( actualVal . isNull ( ) ) { switch ( columnInfo . getNullValueCondition ( ) ) { case NULL_IS_NG : fail ( Type . COLUMN_VALUE_MISSMATCH , expect , actual , expectVal , actualVal , columnInfo ) ; return ; case NULL_IS_OK : return ; case NORMAL : case NOT_NULL_IS_NG : case NOT_NULL_IS_OK : break ; default : throw new RuntimeException ( "" ) ; } } if ( ! actualVal . isNull ( ) ) { switch ( columnInfo . getNullValueCondition ( ) ) { case NOT_NULL_IS_NG : fail ( Type . COLUMN_VALUE_MISSMATCH , expect , actual , expectVal , actualVal , columnInfo ) ; return ; case NOT_NULL_IS_OK : return ; case NORMAL : case NULL_IS_OK : case NULL_IS_NG : break ; default : throw new RuntimeException ( "" ) ; } } switch ( columnInfo . getColumnMatchingCondition ( ) ) { case EXACT : inspectExact ( expect , actual , expectVal , actualVal , columnInfo ) ; break ; case NONE : return ; case NOW : inspectNow ( expect , actual , expectVal , actualVal , columnInfo ) ; break ; case TODAY : inspectToday ( expect , actual , expectVal , actualVal , columnInfo ) ; break ; case PARTIAL : inspectPartialt ( expect , actual , expectVal , actualVal , columnInfo ) ; break ; default : throw new RuntimeException ( "" ) ; } } private void inspectExact ( Writable expect , Writable actual , ValueOption < ? > expectVal , ValueOption < ? > actualVal , ColumnInfo columnInfo ) { if ( ! expectVal . equals ( actualVal ) ) { fail ( Type . COLUMN_VALUE_MISSMATCH , expect , actual , expectVal , actualVal , columnInfo ) ; return ; } else { return ; } } private void inspectPartialt ( Writable expect , Writable actual , ValueOption < ? > expectVal , ValueOption < ? > actualVal , ColumnInfo columnInfo ) { StringOption actualStringOption ; StringOption expectStringOption ; if ( actualVal instanceof StringOption ) { actualStringOption = ( StringOption ) actualVal ; expectStringOption = ( StringOption ) expectVal ; } else { fail ( Type . CONDITION_PARTIAL_ON_INVALID_COLUMN , expect , actual , expectVal , actualVal , columnInfo ) ; return ; } if ( actualStringOption . equals ( expectStringOption ) ) { return ; } if ( actualStringOption . isNull ( ) || expectStringOption . isNull ( ) || actualStringOption . getAsString ( ) . length ( ) == 0 || expectStringOption . getAsString ( ) . length ( ) == 0 ) { fail ( Type . COLUMN_VALUE_MISSMATCH , expect , actual , expectVal , actualVal , columnInfo ) ; return ; } String actualString = actualStringOption . getAsString ( ) ; String expectString = expectStringOption . getAsString ( ) ; if ( actualString . indexOf ( expectString ) == - 1 ) { fail ( Type . COLUMN_VALUE_MISSMATCH , expect , actual , expectVal , actualVal
2,793
<s> package org . rubypeople . rdt . internal . ui . preferences . formatter ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import java . util . Observable ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . ProjectScope ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . preferences . IEclipsePreferences ; import org . eclipse . core . runtime . preferences . IScopeContext ; import org . eclipse . core . runtime . preferences . InstanceScope ; import org . osgi . service . prefs . BackingStoreException ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . formatter . DefaultCodeFormatterConstants ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . preferences . PreferencesAccess ; import org . rubypeople . rdt . ui . PreferenceConstants ; import org . rubypeople . rdt . ui . RubyUI ; public class ProfileManager extends Observable { private final static String ID_PREFIX = "_" ; public static abstract class Profile implements Comparable { public abstract String getName ( ) ; public abstract Profile rename ( String name , ProfileManager manager ) ; public abstract Map getSettings ( ) ; public abstract void setSettings ( Map settings ) ; public int getVersion ( ) { return ProfileVersioner . CURRENT_VERSION ; } public boolean hasEqualSettings ( Map otherMap , List allKeys ) { Map settings = getSettings ( ) ; for ( Iterator iter = allKeys . iterator ( ) ; iter . hasNext ( ) ; ) { String key = ( String ) iter . next ( ) ; Object other = otherMap . get ( key ) ; Object curr = settings . get ( key ) ; if ( other == null ) { if ( curr != null ) { return false ; } } else if ( ! other . equals ( curr ) ) { return false ; } } return true ; } public abstract boolean isProfileToSave ( ) ; public abstract String getID ( ) ; public boolean isSharedProfile ( ) { return false ; } public boolean isBuiltInProfile ( ) { return false ; } } public final static class BuiltInProfile extends Profile { private final String fName ; private final String fID ; private final Map fSettings ; private final int fOrder ; protected BuiltInProfile ( String ID , String name , Map settings , int order ) { fName = name ; fID = ID ; fSettings = settings ; fOrder = order ; } public String getName ( ) { return fName ; } public Profile rename ( String name , ProfileManager manager ) { final String trimmed = name . trim ( ) ; CustomProfile newProfile = new CustomProfile ( trimmed , fSettings , ProfileVersioner . CURRENT_VERSION ) ; manager . addProfile ( newProfile ) ; return newProfile ; } public Map getSettings ( ) { return fSettings ; } public void setSettings ( Map settings ) { } public String getID ( ) { return fID ; } public final int compareTo ( Object o ) { if ( o instanceof BuiltInProfile ) { return fOrder - ( ( BuiltInProfile ) o ) . fOrder ; } return - 1 ; } public boolean isProfileToSave ( ) { return false ; } public boolean isBuiltInProfile ( ) { return true ; } } public static class CustomProfile extends Profile { private String fName ; private Map fSettings ; protected ProfileManager fManager ; private int fVersion ; public CustomProfile ( String name , Map settings , int version ) { fName = name ; fSettings = settings ; fVersion = version ; } public String getName ( ) { return fName ; } public Profile rename ( String name , ProfileManager manager ) { final String trimmed = name . trim ( ) ; if ( trimmed . equals ( getName ( ) ) ) return this ; String oldID = getID ( ) ; fName = trimmed ; manager . profileRenamed ( this , oldID ) ; return this ; } public Map getSettings ( ) { return fSettings ; } public void setSettings ( Map settings ) { if ( settings == null ) throw new IllegalArgumentException ( ) ; fSettings = settings ; if ( fManager != null ) { fManager . profileChanged ( this ) ; } } public String getID ( ) { return ID_PREFIX + fName ; } public void setManager ( ProfileManager profileManager ) { fManager = profileManager ; } public ProfileManager getManager ( ) { return fManager ; } public int getVersion ( ) { return fVersion ; } public void setVersion ( int version ) { fVersion = version ; } public int compareTo ( Object o ) { if ( o instanceof SharedProfile ) { return - 1 ; } if ( o instanceof CustomProfile ) { return getName ( ) . compareToIgnoreCase ( ( ( Profile ) o ) . getName ( ) ) ; } return 1 ; } public boolean isProfileToSave ( ) { return true ; } } public final static class SharedProfile extends CustomProfile { public SharedProfile ( String oldName , Map options ) { super ( oldName , options , ProfileVersioner . CURRENT_VERSION ) ; } public Profile rename ( String name , ProfileManager manager ) { CustomProfile profile = new CustomProfile ( name . trim ( ) , getSettings ( ) , getVersion ( ) ) ; manager . profileReplaced ( this , profile ) ; return profile ; } public String getID ( ) { return SHARED_PROFILE ; } public final int compareTo ( Object o ) { return 1 ; } public boolean isProfileToSave ( ) { return false ; } public boolean isSharedProfile ( ) { return true ; } } public final static int SELECTION_CHANGED_EVENT = 1 ; public final static int PROFILE_DELETED_EVENT = 2 ; public final static int PROFILE_RENAMED_EVENT = 3 ; public final static int PROFILE_CREATED_EVENT = 4 ; public final static int SETTINGS_CHANGED_EVENT = 5 ; private final static String PROFILE_KEY = PreferenceConstants . FORMATTER_PROFILE ; private final static String FORMATTER_SETTINGS_VERSION = "" ; public final static String ECLIPSE_PROFILE = "" ; public final static String RUBY_PROFILE = "" ; public final static String SHARED_PROFILE = "" ; public final static String DEFAULT_PROFILE = ECLIPSE_PROFILE ; private final Map fProfiles ; private final List fProfilesByName ; private Profile fSelected ; private final static List fUIKeys = Collections . EMPTY_LIST ; private final static List fCoreKeys = new ArrayList ( DefaultCodeFormatterConstants . getRubyConventionsSettings ( ) . keySet ( ) ) ; private final static List fKeys ; private final PreferencesAccess fPreferencesAccess ; static { fKeys = new ArrayList ( ) ; fKeys . addAll ( fUIKeys ) ; fKeys . addAll ( fCoreKeys ) ; Collections . sort ( fKeys ) ; } public ProfileManager ( List profiles , IScopeContext context , PreferencesAccess preferencesAccess ) { fPreferencesAccess = preferencesAccess ; fProfiles = new HashMap ( ) ; fProfilesByName = new ArrayList ( ) ; addBuiltinProfiles ( fProfiles , fProfilesByName ) ; for ( final Iterator iter = profiles . iterator ( ) ; iter . hasNext ( ) ; ) { final CustomProfile profile = ( CustomProfile ) iter . next ( ) ; profile . setManager ( this ) ; fProfiles . put ( profile . getID ( ) , profile ) ; fProfilesByName . add ( profile ) ; } Collections . sort ( fProfilesByName ) ; IScopeContext instanceScope = fPreferencesAccess . getInstanceScope ( ) ; String profileId = instanceScope . getNode ( RubyUI . ID_PLUGIN ) . get ( PROFILE_KEY , null ) ; if ( profileId == null ) { profileId = DEFAULT_PROFILE ; IEclipsePreferences node = instanceScope . getNode ( RubyCore . PLUGIN_ID ) ; if ( node != null ) { String tabSetting = node . get ( DefaultCodeFormatterConstants . FORMATTER_TAB_CHAR , null ) ; if ( RubyCore . SPACE . equals ( tabSetting ) ) { profileId = RUBY_PROFILE ; } } } Profile profile = ( Profile ) fProfiles . get ( profileId ) ; if ( profile == null ) { profile = ( Profile ) fProfiles . get ( DEFAULT_PROFILE ) ; } fSelected = profile ; if ( context . getName ( ) == ProjectScope . SCOPE && hasProjectSpecificSettings ( context ) ) { Map map = readFromPreferenceStore ( context , profile ) ; if ( map != null ) { Profile matching = null ; String projProfileId = context . getNode ( RubyUI . ID_PLUGIN ) . get ( PROFILE_KEY , null ) ; if ( projProfileId != null ) { Profile curr = ( Profile ) fProfiles . get ( projProfileId ) ; if ( curr != null && ( curr . isBuiltInProfile ( ) || curr . hasEqualSettings ( map , getKeys ( ) ) ) ) { matching = curr ; } } else { for ( final Iterator iter = fProfilesByName . iterator ( ) ; iter . hasNext ( ) ; ) { Profile curr = ( Profile ) iter . next ( ) ; if ( curr . hasEqualSettings ( map , getKeys ( ) ) ) { matching = curr ; break ; } } } if ( matching == null ) { String name ; if ( projProfileId != null && ! fProfiles . containsKey ( projProfileId ) ) { name = Messages . format ( FormatterMessages . ProfileManager_unmanaged_profile_with_name , projProfileId . substring ( ID_PREFIX . length ( ) ) ) ; } else { name = FormatterMessages . ProfileManager_unmanaged_profile ; } SharedProfile shared = new SharedProfile ( name , map ) ; shared . setManager ( this ) ; fProfiles . put ( shared . getID ( ) , shared ) ; fProfilesByName . add ( shared ) ; matching = shared ; } fSelected = matching ; } } } protected void notifyObservers ( int message ) { setChanged ( ) ; notifyObservers ( new Integer ( message ) ) ; } public static boolean hasProjectSpecificSettings ( IScopeContext context ) { IEclipsePreferences corePrefs = context . getNode ( RubyCore . PLUGIN_ID ) ; for ( final Iterator keyIter = fCoreKeys . iterator ( ) ; keyIter . hasNext ( ) ; ) { final String key = ( String ) keyIter . next ( ) ; Object val = corePrefs . get ( key , null ) ; if ( val != null ) { return true ; } } IEclipsePreferences uiPrefs = context . getNode ( RubyUI . ID_PLUGIN ) ; for ( final Iterator keyIter = fUIKeys . iterator ( ) ; keyIter . hasNext ( ) ; ) { final String key = ( String ) keyIter . next ( ) ; Object val = uiPrefs . get ( key , null ) ; if ( val != null ) { return true ; } } return false ; } public Map readFromPreferenceStore ( IScopeContext context , Profile workspaceProfile ) { final Map profileOptions = new HashMap ( ) ; IEclipsePreferences uiPrefs = context . getNode ( RubyUI . ID_PLUGIN ) ; IEclipsePreferences corePrefs = context . getNode ( RubyCore . PLUGIN_ID ) ; int version = uiPrefs . getInt ( FORMATTER_SETTINGS_VERSION , ProfileVersioner . VERSION_1 ) ; if ( version != ProfileVersioner . CURRENT_VERSION ) { Map allOptions = new HashMap ( ) ; addAll ( uiPrefs , allOptions ) ; addAll ( corePrefs , allOptions ) ; return ProfileVersioner . updateAndComplete ( allOptions , version ) ; } boolean hasValues = false ; for ( final Iterator keyIter = fCoreKeys . iterator ( ) ; keyIter . hasNext ( ) ; ) { final String key = ( String ) keyIter . next ( ) ; Object val = corePrefs . get ( key , null ) ; if ( val != null ) { hasValues = true ; } else { val = workspaceProfile . getSettings ( ) . get ( key ) ; } profileOptions . put ( key , val ) ; } for ( final Iterator keyIter = fUIKeys . iterator ( ) ; keyIter . hasNext ( ) ; ) { final String key = ( String ) keyIter . next ( ) ; Object val = uiPrefs . get ( key , null ) ; if ( val != null ) { hasValues = true ; } else { val = workspaceProfile . getSettings ( ) . get ( key ) ; } profileOptions . put ( key , val ) ; } if ( ! hasValues ) { return null ; } return profileOptions ; } private void addAll ( IEclipsePreferences uiPrefs , Map allOptions ) { try { String [ ] keys = uiPrefs . keys
2,794
<s> package com . asakusafw . testdriver . core ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . net . URI ; import org . junit . Test ; public class SpiVerifyRuleProviderTest extends SpiTestRoot { @ Test public void open ( ) throws Exception { ClassLoader cl = register ( VerifyRuleProvider . class , MockVerifyRuleProvider . class ) ; SpiVerifyRuleProvider target = new SpiVerifyRuleProvider ( cl ) ; VerifyContext context = new VerifyContext ( new TestContext . Empty ( ) ) ; context . testFinished ( ) ; VerifyRule rule = target . get ( ValueDefinition . of ( String . class ) , context , new URI ( "default:rule" ) ) ; assertThat ( rule , not ( nullValue ( ) ) ) ; DataModelReflection ref = ValueDefinition . of ( String . class ) . toReflection ( "" ) ; assertThat ( rule . getKey ( ref ) , is ( ( Object ) ref ) ) ; } @ Test public void
2,795
<s> package com . team1160 . scouting . frontend . elements ; import java . awt . event . ActionEvent ; import java . awt . event . ActionListener ; import com . team1160 . scouting . frontend . resourcePackets . CardLayoutPacket ; import javax . swing . JMenuItem ; public class JumpMenuItem extends JMenuItem implements ActionListener { private static final long serialVersionUID = 6467946924538464832L ; CardLayoutPacket layout ; String
2,796
<s> package org . rubypeople . rdt . debug . core ; import org . eclipse . core . resources . IWorkspace ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . Plugin ; import org . eclipse . core . runtime . Status ; import org . osgi . framework . BundleContext ; import org . rubypeople . rdt . core . RubyCore ; public class RdtDebugCorePlugin extends Plugin { public static final String PLUGIN_ID = "" ; public static final String MODEL_IDENTIFIER = "" ; public static final int INTERNAL_ERROR = 120 ; private static boolean isRubyDebuggerVerbose = false ; protected static RdtDebugCorePlugin plugin ; public RdtDebugCorePlugin ( ) { super ( ) ; } public static Plugin getDefault ( ) { return plugin ; } public static IWorkspace getWorkspace ( ) { return RubyCore . getWorkspace ( ) ; } public void start ( BundleContext context ) throws Exception { plugin = this ; super . start ( context ) ; String rubyDebuggerVerboseOption = Platform . getDebugOption ( RdtDebugCorePlugin . PLUGIN_ID + "" ) ; isRubyDebuggerVerbose = rubyDebuggerVerboseOption == null ? false : rubyDebuggerVerboseOption . equalsIgnoreCase ( "true" ) ; } public static void log ( int severity , String message ) { Status status = new Status ( severity , PLUGIN_ID , IStatus . OK , message , null ) ; RdtDebugCorePlugin . log ( status ) ; } public static void log ( String message , Throwable e ) { log ( new Status ( IStatus . ERROR , PLUGIN_ID , IStatus . ERROR , message , e ) ) ; } public static void log ( IStatus status ) { if ( RdtDebugCorePlugin . getDefault ( ) != null ) { getDefault ( ) . getLog ( ) . log ( status ) ; } else { System . out . println ( "Error: " ) ; System . out . println ( status . getMessage ( ) ) ; } } public static void log ( Throwable e ) { log ( new Status ( IStatus . ERROR , PLUGIN_ID , IStatus . ERROR , "" , e ) ) ; } public static void debug ( Object message ) { if ( RdtDebugCorePlugin . getDefault ( ) != null ) { if ( RdtDebugCorePlugin . getDefault ( ) . isDebugging ( ) ) { System . out . println ( message . toString ( ) ) ; } } else { System .
2,797
<s> package com . asakusafw . windgate . hadoopfs . jsch ; import java . io . IOException ; import java . util . List ; import org . apache . hadoop . conf . Configuration ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . runtime . core . context . SimulationSupport ; import com . asakusafw . windgate . core . ParameterList ; import com . asakusafw . windgate . core . resource . ResourceMirror ; import com . asakusafw . windgate . core . vocabulary . FileProcess ; import com . asakusafw . windgate . hadoopfs . ssh . AbstractSshHadoopFsMirror ; import com . asakusafw . windgate . hadoopfs . ssh . SshConnection ; import com . asakusafw . windgate . hadoopfs . ssh . SshProfile ; @ SimulationSupport public class JschHadoopFsMirror extends AbstractSshHadoopFsMirror { static final Logger LOG = LoggerFactory . getLogger ( JschHadoopFsMirror .
2,798
<s> package net . sf . sveditor . ui . svt . editor ; import org . eclipse . jface . viewers . LabelProvider ; import org . eclipse . swt . graphics . Image ; import org . w3c . dom . Element ; public class SVTLabelProvider extends LabelProvider { @ Override public Image getImage ( Object element ) { return super . getImage ( element ) ; } @ Override public String getText ( Object element ) { if ( element instanceof Element ) { Element e = ( Element ) element ; if ( e . getNodeName ( ) . equals ( "template" ) ) { return getAttr ( e , "name" , "[Unnamed]" ) ; } else if ( e . getNodeName ( ) . equals ( "parameters" ) ) { return "Parameters" ; } else if ( e . getNodeName ( ) . equals ( "parameter" ) ) { return getAttr ( e , "name" , "[Unnamed]" ) + " : " + getAttr ( e , "type" , "[Untyped]" ) ; } else if ( e . getNodeName ( )
2,799
<s> package com . asakusafw . windgate . stream . file ; import java . io . BufferedInputStream ; import java . io . File ; import java . io . FileInputStream ; import java . io . IOException ; import java . util . Arrays ; import java . util . Iterator ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . windgate . stream . CountingInputStream ; import com . asakusafw . windgate . stream . InputStreamProvider ; public class FileInputStreamProvider extends InputStreamProvider { static final Logger LOG = LoggerFactory . getLogger ( FileInputStreamProvider . class ) ; private static final int BUFFER_SIZE = 1024 * 64 ; private final Iterator < File > iterator ; private File current ; public FileInputStreamProvider ( File file ) { if ( file == null ) { throw