id
int32
0
3k
input
stringlengths
43
33.8k
gt
stringclasses
1 value
200
<s> package com . asakusafw . windgate . core . vocabulary ; public enum FileProcess implements ConfigurationItem { FILE ( "file" , "" ) , ; private final String key ; private final String description ; private FileProcess ( String key , String description ) { assert key != null ; assert description != null ; this . key = key ; this . description = description ; } @ Override public final String key
201
<s> package og . android . tether . system ; import java . io . BufferedReader ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileOutputStream ; import java . io . FilenameFilter ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Date ; import java . util . HashMap ; import java . util . Hashtable ; import og . android . tether . data . ClientData ; import android . util . Log ; public class CoreTask { public static final String MSG_TAG = "" ; public String DATA_FILE_PATH ; private static final String FILESET_VERSION = "94" ; private static final String defaultDNS1 = "" ; private Hashtable < String , String > runningProcesses = new Hashtable < String , String > ( ) ; public void setPath ( String path ) { this . DATA_FILE_PATH = path ; } public class Whitelist { public ArrayList < String > whitelist ; public Whitelist ( ) { this . whitelist = new ArrayList < String > ( ) ; } public boolean exists ( ) { File file = new File ( DATA_FILE_PATH + "" ) ; return ( file . exists ( ) && file . canRead ( ) ) ; } public boolean remove ( ) { File file = new File ( DATA_FILE_PATH + "" ) ; if ( file . exists ( ) ) return file . delete ( ) ; return false ; } public void touch ( ) throws IOException { File file = new File ( DATA_FILE_PATH + "" ) ; file . createNewFile ( ) ; } public void save ( ) throws Exception { FileOutputStream fos = null ; File file = new File ( DATA_FILE_PATH + "" ) ; try { fos = new FileOutputStream ( file ) ; for ( String mac : this . whitelist ) { fos . write ( ( mac + "n" ) . getBytes ( ) ) ; } } finally { if ( fos != null ) { try { fos . close ( ) ; } catch ( IOException e ) { } } } } public ArrayList < String > get ( ) { return readLinesFromFile ( DATA_FILE_PATH + "" ) ; } } public class WpaSupplicant { public boolean exists ( ) { File file = new File ( DATA_FILE_PATH + "" ) ; return ( file . exists ( ) && file . canRead ( ) ) ; } public boolean remove ( ) { File file = new File ( DATA_FILE_PATH + "" ) ; if ( file . exists ( ) ) { return file . delete ( ) ; } return false ; } public Hashtable < String , String > get ( ) { File inFile = new File ( DATA_FILE_PATH + "" ) ; if ( inFile . exists ( ) == false ) { return null ; } Hashtable < String , String > SuppConf = new Hashtable < String , String > ( ) ; ArrayList < String > lines = readLinesFromFile ( DATA_FILE_PATH + "" ) ; for ( String line : lines ) { if ( line . contains ( "=" ) ) { String [ ] pair = line . split ( "=" ) ; if ( pair [ 0 ] != null && pair [ 1 ] != null && pair [ 0 ] . length ( ) > 0 && pair [ 1 ] . length ( ) > 0 ) { SuppConf . put ( pair [ 0 ] . trim ( ) , pair [ 1 ] . trim ( ) ) ; } } } return SuppConf ; } public synchronized boolean write ( Hashtable < String , String > values ) { String filename = DATA_FILE_PATH + "" ; String fileString = "" ; ArrayList < String > inputLines = readLinesFromFile ( filename ) ; for ( String line : inputLines ) { if ( line . contains ( "=" ) ) { String key = line . split ( "=" ) [ 0 ] ; if ( values . containsKey ( key ) ) { line = key + "=" + values . get ( key ) ; } } line += "n" ; fileString += line ; } if ( writeLinesToFile ( filename , fileString ) ) { CoreTask . this . chmod ( filename , "0644" ) ; return true ; } return false ; } } public class TiWlanConf { public Hashtable < String , String > get ( ) { Hashtable < String , String > tiWlanConf = new Hashtable < String , String > ( ) ; ArrayList < String > lines = readLinesFromFile ( DATA_FILE_PATH + "" ) ; for ( String line : lines ) { String [ ] pair = line . split ( "=" ) ; if ( pair [ 0 ] != null && pair [ 1 ] != null && pair [ 0 ] . length ( ) > 0 && pair [ 1 ] . length ( ) > 0 ) { tiWlanConf . put ( pair [ 0 ] . trim ( ) , pair [ 1 ] . trim ( ) ) ; } } return tiWlanConf ; } public synchronized boolean write ( String name , String value ) { Hashtable < String , String > table = new Hashtable < String , String > ( ) ; table . put ( name , value ) ; return write ( table ) ; } public synchronized boolean write ( Hashtable < String , String > values ) { String filename = DATA_FILE_PATH + "" ; ArrayList < String > valueNames = Collections . list ( values . keys ( ) ) ; String fileString = "" ; ArrayList < String > inputLines = readLinesFromFile ( filename ) ; for ( String line : inputLines ) { for ( String name : valueNames ) { if ( line . contains ( name ) ) { line = name + " = " + values . get ( name ) ; break ; } } line += "n" ; fileString += line ; } return writeLinesToFile ( filename , fileString ) ; } } public class TetherConfig extends HashMap < String , String > { private static final long serialVersionUID = 1L ; public HashMap < String , String > read ( ) { String filename = DATA_FILE_PATH + "" ; this . clear ( ) ; for ( String line : readLinesFromFile ( filename ) ) { if ( line . startsWith ( "#" ) ) continue ; if ( ! line . contains ( "=" ) ) continue ; String [ ] data = line . split ( "=" ) ; if ( data . length > 1 ) { this . put ( data [ 0 ] , data [ 1 ] ) ; } else { this . put ( data [ 0 ] , "" ) ; } } return this ; } public boolean write ( ) { String lines = new String ( ) ; for ( String key : this . keySet ( ) ) { lines += key + "=" + this . get ( key ) + "n" ; } return writeLinesToFile ( DATA_FILE_PATH + "" , lines ) ; } } public class HostapdConfig extends HashMap < String , String > { private static final long serialVersionUID = 1L ; public HashMap < String , String > read ( ) { String filename = DATA_FILE_PATH + "" ; this . clear ( ) ; for ( String line : readLinesFromFile ( filename ) ) { if ( line . startsWith ( "#" ) ) continue ; if ( ! line . contains ( "=" ) ) continue ; String [ ] data = line . split ( "=" ) ; if ( data . length > 1 ) { this . put ( data [ 0 ] , data [ 1 ] ) ; } else { this . put ( data [ 0 ] , "" ) ; } } return this ; } public boolean write ( ) { String lines = new String ( ) ; for ( String key : this . keySet ( ) ) { lines += key + "=" + this . get ( key ) + "n" ; } return writeLinesToFile ( DATA_FILE_PATH + "" , lines ) ; } } public class DnsmasqConfig { private static final long serialVersionUID = 1L ; private String lanconfig ; public void set ( String lanconfig ) { this . lanconfig = lanconfig ; } public boolean write ( ) { String [ ] lanparts = lanconfig . split ( "\\." ) ; String iprange = lanparts [ 0 ] + "." + lanparts [ 1 ] + "." + lanparts [ 2 ] + ".100," + lanparts [ 0 ] + "." + lanparts [ 1 ] + "." + lanparts [ 2 ] + ".105,12h" ; StringBuffer buffer = new StringBuffer ( ) ; ; ArrayList < String > inputLines = readLinesFromFile ( DATA_FILE_PATH + "" ) ; for ( String line : inputLines ) { if ( line . contains ( "dhcp-range" ) ) { line = "dhcp-range=" + iprange ; } buffer . append ( line + "n" ) ; } if ( writeLinesToFile ( DATA_FILE_PATH + "" , buffer . toString ( ) ) == false ) { Log . e ( MSG_TAG , "" ) ; return false ; } return true ; } } public class BluetoothConfig { private static final long serialVersionUID = 1L ; private String lanconfig ; public void set ( String lanconfig ) { this . lanconfig = lanconfig ; } public boolean write ( ) { String [ ] lanparts = lanconfig . split ( "\\." ) ; String gateway = lanparts [ 0 ] + "." + lanparts [ 1 ] + "." + lanparts [ 2 ] + ".254" ; StringBuffer buffer = new StringBuffer ( ) ; ; ArrayList < String > inputLines = readLinesFromFile ( DATA_FILE_PATH + "" ) ; for ( String line : inputLines ) { if ( line . contains ( "" ) && line . endsWith ( "" ) ) { line = reassembleLine ( line , " " , "bnep0" , gateway ) ; } buffer . append ( line + "n" ) ; } if ( writeLinesToFile ( DATA_FILE_PATH + "" , buffer . toString ( ) ) == false ) { Log . e ( MSG_TAG , "" ) ; return false ; } return true ; } } public Hashtable < String , ClientData > getLeases ( ) throws Exception { Hashtable < String , ClientData > returnHash = new Hashtable < String , ClientData > ( ) ; ClientData clientData ; ArrayList < String > lines = readLinesFromFile ( this . DATA_FILE_PATH + "" ) ; for ( String line : lines ) { clientData = new ClientData ( ) ; String [ ] data = line . split ( " " ) ; Date connectTime = new Date ( Long . parseLong ( data [ 0 ] + "000" ) ) ; String macAddress = data [ 1 ] ; String ipAddress = data
202
<s> package com . asakusafw . dmdl . java . emitter . driver ; import java . util . List ; import com . asakusafw . dmdl . java . emitter . EmitContext ; import com . asakusafw . dmdl . java . spi . JavaDataModelDriver ; import com . asakusafw . dmdl . semantics . ModelDeclaration ; import com . asakusafw . dmdl . semantics . PropertyDeclaration ; import com . asakusafw . runtime . model . PropertyOrder ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . java . model . syntax . Annotation ; import com . asakusafw . utils . java . model . syntax . Literal ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . util . AttributeBuilder ; import com . asakusafw . utils . java . model . util . Models ; public class PropertyOrderDriver extends JavaDataModelDriver { @ Override public List < Annotation > getTypeAnnotations ( EmitContext context , ModelDeclaration model ) { ModelFactory f = context . getModelFactory ( ) ;
203
<s> package com . asakusafw . vocabulary . operator ; import java . lang . annotation . Documented ; import java . lang . annotation . ElementType ; import java . lang . annotation . Retention ; import java . lang . annotation . RetentionPolicy ; import java . lang . annotation . Target ; import com . asakusafw . vocabulary . model . Joined ; @ Target ( ElementType . METHOD ) @ Retention ( RetentionPolicy . RUNTIME ) @ Documented public @ interface MasterJoin { int ID_INPUT_MASTER = 0 ; int ID_INPUT_TRANSACTION = 1 ; int ID_OUTPUT_JOINED = 0 ; int
204
<s> package org . oddjob . launch ; import java . io . File ; import java . util . ArrayList ; import java . util . List ; public class PathParser { private String [ ] elements ; public String [ ] getElements ( ) { return elements ; } public String [ ] processArgs ( String [ ] args ) { List < String > returned = new ArrayList < String > ( ) ;
205
<s> package org . vaadin . teemu . clara . binder ; import java . lang . reflect . InvocationHandler ; import java . lang . reflect . InvocationTargetException ; import java . lang . reflect . Method ; import java . lang . reflect . Proxy ; import java . util . Set ; import java . util . logging . Logger ; import org . vaadin . teemu . clara . Clara ; import org . vaadin . teemu . clara . binder . annotation . DataSource ; import org . vaadin . teemu . clara . binder . annotation . EventHandler ; import org . vaadin . teemu . clara . util . ReflectionUtils ; import com . vaadin . data . Container ; import com . vaadin . data . Item ; import com . vaadin . data . Property ; import com . vaadin . ui . Component ; public class Binder { protected Logger getLogger ( ) { return Logger . getLogger ( Binder . class . getName ( ) ) ; } public void bind ( Component componentRoot , Object controller ) { Method [ ] methods = controller . getClass ( ) . getMethods ( ) ; for ( Method method : methods ) { if ( method . isAnnotationPresent ( DataSource . class ) ) { bindDataSource ( componentRoot , controller , method , method . getAnnotation ( DataSource . class ) ) ; } if ( method . isAnnotationPresent ( EventHandler . class ) ) { bindEventHandler ( componentRoot , controller , method , method . getAnnotation ( EventHandler . class ) ) ; } } } private void bindEventHandler ( Component componentRoot , Object controller , Method method , EventHandler eventListener ) { String componentId = eventListener . value ( ) ; Component
206
<s> package org . oddjob . values . properties ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . arooa . xml . XMLConfiguration ; public class PropertiesJobSystemTest extends TestCase { private static final Logger logger = Logger . getLogger ( PropertiesJobSystemTest . class ) ; protected void setUp ( ) { logger . debug ( "" + getName ( ) + "" ) ; if ( System . getProperty ( "oddjob.test" ) != null ) { throw new IllegalStateException ( "" ) ; } System . setProperty ( "oddjob.test" ,
207
<s> package com . asakusafw . testdriver . core ; import java . lang . annotation . Annotation ; import java . text . MessageFormat ; import java . util . Collection ; import java . util . HashMap ; import java . util . Map ; public interface DataModelDefinition < T > { Class < T > getModelClass ( ) ; < A extends Annotation > A getAnnotation ( Class < A > annotationType ) ; Collection < PropertyName > getProperties ( ) ; PropertyType getType ( PropertyName name ) ; < A extends Annotation > A getAnnotation ( PropertyName name , Class < A > annotationType ) ; DataModelDefinition . Builder < T > newReflection ( ) ; DataModelReflection toReflection ( T object ) ; T toObject ( DataModelReflection reflection ) ; public class Builder
208
<s> package net . ggtools . grand . ui . prefs ; public interface PreferenceKeys { public static final String MAX_RECENT_FILES_PREFS_KEY = "" ; public static final String RECENT_FILES_PREFS_KEY = "recent files" ; public static final String GRAPH_PREFIX = "graph." ; public static final String NODE_PREFIX = GRAPH_PREFIX + "node." ; public static final String GRAPH_BUS_ENABLED_DEFAULT = GRAPH_PREFIX + "" ; public static final String GRAPH_BUS_OUT_THRESHOLD = GRAPH_PREFIX + "" ; public static final String GRAPH_BUS_IN_THRESHOLD = GRAPH_PREFIX + "" ; public static final String LINK_SUBANT_COLOR = GRAPH_PREFIX + "" ; public static final String LINK_SUBANT_LINEWIDTH = GRAPH_PREFIX + "" ; public static final String LINK_WEAK_COLOR = GRAPH_PREFIX + "" ; public static
209
<s> package org . rubypeople . rdt . internal . ui . wizards . dialogfields ; import org . eclipse . swt . SWT ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Display ; import org . eclipse . swt . widgets . Label ; import org . eclipse . jface . util . Assert ; public class DialogField { private Label fLabel ; protected String fLabelText ; private IDialogFieldListener fDialogFieldListener ; private boolean fEnabled ; public DialogField ( ) { fEnabled = true ; fLabel = null ; fLabelText = "" ; } public void setLabelText ( String labeltext ) { fLabelText = labeltext ; if ( isOkToUse ( fLabel ) ) { fLabel . setText ( labeltext ) ; } } public final void setDialogFieldListener ( IDialogFieldListener listener ) { fDialogFieldListener = listener ; } public void dialogFieldChanged ( ) { if ( fDialogFieldListener != null ) { fDialogFieldListener . dialogFieldChanged ( this ) ; } } public boolean setFocus ( ) { return false ; } public void postSetFocusOnDialogField ( Display display ) { if ( display != null ) { display . asyncExec ( new Runnable ( ) { public void run ( ) { setFocus ( ) ; } } ) ; } } public Control [ ] doFillIntoGrid ( Composite parent , int nColumns ) { assertEnoughColumns ( nColumns ) ; Label label = getLabelControl ( parent ) ; label . setLayoutData ( gridDataForLabel ( nColumns ) ) ; return new Control [ ] { label } ; } public int getNumberOfControls ( ) { return 1 ; } protected static GridData gridDataForLabel ( int span ) { GridData gd = new GridData ( GridData . HORIZONTAL_ALIGN_FILL ) ; gd . horizontalSpan = span ; return gd ; } public Label getLabelControl ( Composite parent )
210
<s> package net . sf . sveditor . core . parser ; import java . io . InputStream ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import java . util . Stack ; import net . sf . sveditor . core . db . SVDBLocation ; import net . sf . sveditor . core . db . SVDBTypeInfo ; import net . sf . sveditor . core . db . expr . SVCoverageExpr ; import net . sf . sveditor . core . db . expr . SVDBArrayAccessExpr ; import net . sf . sveditor . core . db . expr . SVDBAssignExpr ; import net . sf . sveditor . core . db . expr . SVDBAssignmentPatternExpr ; import net . sf . sveditor . core . db . expr . SVDBAssignmentPatternRepeatExpr ; import net . sf . sveditor . core . db . expr . SVDBBinaryExpr ; import net . sf . sveditor . core . db . expr . SVDBCastExpr ; import net . sf . sveditor . core . db . expr . SVDBClockingEventExpr ; import net . sf . sveditor . core . db . expr . SVDBClockingEventExpr . ClockingEventType ; import net . sf . sveditor . core . db . expr . SVDBConcatenationExpr ; import net . sf . sveditor . core . db . expr . SVDBCondExpr ; import net . sf . sveditor . core . db . expr . SVDBCoverBinsExpr ; import net . sf . sveditor . core . db . expr . SVDBCoverpointExpr ; import net . sf . sveditor . core . db . expr . SVDBCtorExpr ; import net . sf . sveditor . core . db . expr . SVDBCtorExpr . CtorType ; import net . sf . sveditor . core . db . expr . SVDBCycleDelayExpr ; import net . sf . sveditor . core . db . expr . SVDBExpr ; import net . sf . sveditor . core . db . expr . SVDBFieldAccessExpr ; import net . sf . sveditor . core . db . expr . SVDBIdentifierExpr ; import net . sf . sveditor . core . db . expr . SVDBIncDecExpr ; import net . sf . sveditor . core . db . expr . SVDBInsideExpr ; import net . sf . sveditor . core . db . expr . SVDBLiteralExpr ; import net . sf . sveditor . core . db . expr . SVDBMinTypMaxExpr ; import net . sf . sveditor . core . db . expr . SVDBNameMappedExpr ; import net . sf . sveditor . core . db . expr . SVDBNamedArgExpr ; import net . sf . sveditor . core . db . expr . SVDBNullExpr ; import net . sf . sveditor . core . db . expr . SVDBParamIdExpr ; import net . sf . sveditor . core . db . expr . SVDBParenExpr ; import net . sf . sveditor . core . db . expr . SVDBRandomizeCallExpr ; import net . sf . sveditor . core . db . expr . SVDBRangeDollarBoundExpr ; import net . sf . sveditor . core . db . expr . SVDBRangeExpr ; import net . sf . sveditor . core . db . expr . SVDBStringExpr ; import net . sf . sveditor . core . db . expr . SVDBTFCallExpr ; import net . sf . sveditor . core . db . expr . SVDBTypeExpr ; import net . sf . sveditor . core . db . expr . SVDBUnaryExpr ; import net . sf . sveditor . core . scanner . SVKeywords ; public class SVExprParser extends SVParserBase { public static boolean fUseFullExprParser = true ; private Stack < Boolean > fEventExpr ; private Stack < Boolean > fAssertionExpr ; private boolean fEnableNameMappedPrimary = false ; public SVExprParser ( ISVParser parser ) { super ( parser ) ; fAssertionExpr = new Stack < Boolean > ( ) ; fAssertionExpr . push ( false ) ; fEventExpr = new Stack < Boolean > ( ) ; fEventExpr . push ( false ) ; } public SVDBClockingEventExpr clocking_event ( ) throws SVParseException { SVDBClockingEventExpr expr = new SVDBClockingEventExpr ( ) ; fLexer . readOperator ( "@" ) ; if ( fLexer . peekOperator ( "(" ) ) { SVDBParenExpr p = new SVDBParenExpr ( ) ; p . setLocation ( fLexer . getStartLocation ( ) ) ; fLexer . eatToken ( ) ; if ( fLexer . peekOperator ( "*" ) ) { fLexer . readOperator ( "*" ) ; expr . setClockingEventType ( ClockingEventType . Any ) ; } else { expr . setClockingEventType ( ClockingEventType . Expr ) ; p . setExpr ( event_expression ( ) ) ; expr . setExpr ( p ) ; } fLexer . readOperator ( ")" ) ; } else if ( fLexer . peekOperator ( "*" ) ) { expr . setClockingEventType ( ClockingEventType . Any ) ; fLexer . readOperator ( "*" ) ; } else { expr . setClockingEventType ( ClockingEventType . Expr ) ; expr . setExpr ( idExpr ( ) ) ; } return expr ; } private final static Set < String > fUnaryModulePathOperators ; private final static Set < String > fBinaryModulePathOperators ; static { fUnaryModulePathOperators = new HashSet < String > ( ) ; fUnaryModulePathOperators . add ( "!" ) ; fUnaryModulePathOperators . add ( "~" ) ; fUnaryModulePathOperators . add ( "&" ) ; fUnaryModulePathOperators . add ( "~&" ) ; fUnaryModulePathOperators . add ( "|" ) ; fUnaryModulePathOperators . add ( "~|" ) ; fUnaryModulePathOperators . add ( "^" ) ; fUnaryModulePathOperators . add ( "~^" ) ; fUnaryModulePathOperators . add ( "^~" ) ; fBinaryModulePathOperators = new HashSet < String > ( ) ; fBinaryModulePathOperators . add ( "==" ) ; fBinaryModulePathOperators . add ( "!=" ) ; fBinaryModulePathOperators . add ( "&&" ) ; fBinaryModulePathOperators . add ( "||" ) ; fBinaryModulePathOperators . add ( "&" ) ; fBinaryModulePathOperators . add ( "|" ) ; fBinaryModulePathOperators . add ( "^" ) ; fBinaryModulePathOperators . add ( "^~" ) ; fBinaryModulePathOperators . add ( "~^" ) ; } public SVDBExpr module_path_expression ( ) throws SVParseException { SVDBExpr ret = null ; if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } if ( fLexer . peekOperator ( fUnaryModulePathOperators ) ) { fLexer . eatToken ( ) ; module_path_primary ( ) ; } if ( fLexer . peekOperator ( fBinaryModulePathOperators ) ) { String op = fLexer . eatToken ( ) ; module_path_expression ( ) ; } module_path_primary ( ) ; if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } return ret ; } private SVDBExpr module_path_primary ( ) throws SVParseException { SVDBExpr ret = null ; if ( fLexer . peekNumber ( ) ) { ret = literalExpr ( ) ; } else if ( fLexer . peekId ( ) ) { ret = idExpr ( ) ; if ( fLexer . peekOperator ( "(" ) ) { error ( "" ) ; } } else if ( fLexer . peekOperator ( "{" ) ) { error ( "" ) ; fLexer . eatToken ( ) ; if ( fLexer . peekOperator ( "{" ) ) { } else { } } else if ( fLexer . peekOperator ( "(" ) ) { error ( "" ) ; } return ret ; } public SVDBExpr cycle_delay ( ) throws SVParseException { SVDBCycleDelayExpr expr = new SVDBCycleDelayExpr ( ) ; expr . setLocation ( fLexer . getStartLocation ( ) ) ; fLexer . readOperator ( "##" ) ; if ( fLexer . peekNumber ( ) ) { expr . setExpr ( literalExpr ( ) ) ; } else if ( fLexer . peekOperator ( "(" ) ) { fLexer . readOperator ( "(" ) ; expr . setExpr ( expression ( ) ) ; fLexer . readOperator ( ")" ) ; } else { expr . setExpr ( idExpr ( ) ) ; } return expr ; } public SVDBExpr delay_expr ( int max_delays ) throws SVParseException { SVDBExpr expr = null ; if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } if ( ( max_delays != 2 ) && ( max_delays != 3 ) ) { error ( "" ) ; } fLexer . readOperator ( "#" ) ; if ( fLexer . peekOperator ( "(" ) ) { fLexer . eatToken ( ) ; expr = fParsers . exprParser ( ) . expression ( ) ; if ( fLexer . peekOperator ( ":" ) ) { fLexer . readOperator ( ":" ) ; expr = fParsers . exprParser ( ) . expression ( ) ; fLexer . readOperator ( ":" ) ; expr = fParsers . exprParser ( ) . expression ( ) ; } for ( int i = 2 ; i <= max_delays ; i ++ ) { if ( fLexer . peekOperator ( "," ) ) { fLexer . eatToken ( ) ; expr = fParsers . exprParser ( ) . expression ( ) ; if ( fLexer . peekOperator ( ":" ) ) { fLexer . readOperator ( ":" ) ; expr = fParsers . exprParser ( ) . expression ( ) ; fLexer . readOperator ( ":" ) ; expr = fParsers . exprParser ( ) . expression ( ) ; } } } fLexer . readOperator ( ")" ) ; } else { expr = delay_value ( ) ; } if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } return expr ; } private SVDBExpr delay_value ( ) throws SVParseException { SVDBExpr ret = null ; if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } if ( fLexer . peekNumber ( ) ) { if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } ret = new SVDBLiteralExpr ( fLexer . eatToken ( ) ) ; } else if ( fLexer . peekKeyword ( "1step" ) ) { ret = new SVDBLiteralExpr ( fLexer . eatToken ( ) ) ; } else if ( fLexer . peekId ( ) ) { if ( fDebugEn ) { debug ( "" ) ; } ret = idExpr ( ) ; if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } while ( fLexer . peekOperator ( "::" , "." , "[" ) ) { SVToken t = fLexer . consumeToken ( ) ; if ( fAssertionExpr . peek ( ) ) { if ( ! fLexer . peekOperator ( ) ) { fLexer . ungetToken ( t ) ; ret = selector ( ret ) ; } else { fLexer . ungetToken ( t ) ; break ; } } else { fLexer . ungetToken ( t ) ; ret = selector ( ret ) ; } } } else { error ( "" + fLexer . peek ( ) ) ; } if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } return ret ; } public SVDBExpr datatype_or_expression ( ) throws SVParseException { if ( fLexer . peekKeyword ( "virtual" , "const" ) || fLexer . peekKeyword ( SVKeywords . fBuiltinTypes ) ) { SVDBTypeExpr expr = new SVDBTypeExpr ( ) ; expr . setLocation ( fLexer . getStartLocation ( ) ) ; SVDBTypeInfo info = fParsers . dataTypeParser ( ) . data_type ( 0 ) ; expr . setTypeInfo ( info ) ; return expr ; } else { return expression ( ) ; } } public SVDBExpr assert_expression ( ) throws SVParseException { fAssertionExpr . push ( true ) ; fEventExpr . push ( true ) ; try { return expression ( ) ; } finally { fAssertionExpr . pop ( ) ; fEventExpr . pop ( ) ; } } public SVDBExpr event_expression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } fEventExpr . push ( true ) ; try { return expression ( ) ; } finally { fEventExpr . pop ( ) ; } } public SVDBExpr variable_lvalue ( ) throws SVParseException { SVDBExpr lvalue ; if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } if ( fLexer . peekOperator ( "{" ) ) { lvalue = concatenation_or_repetition ( ) ; } else { lvalue = unaryExpression ( ) ; } if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } return lvalue ; } public SVDBExpr const_or_range_expression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } SVDBExpr expr = expression ( ) ; if ( fLexer . peekOperator ( ":" ) ) { fLexer . eatToken ( ) ; expr = new SVDBRangeExpr ( expr , expression ( ) ) ; } if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } return expr ; } public SVDBExpr constant_mintypmax_expression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } SVDBExpr expr = expression ( ) ; if ( fLexer . peekOperator ( ":" ) ) { fLexer . eatToken ( ) ; SVDBExpr typ = expression ( ) ; fLexer . readOperator ( ":" ) ; SVDBExpr max = expression ( ) ; expr = new SVDBMinTypMaxExpr ( expr , typ , max ) ; } if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } return expr ; } public SVDBExpr expression ( ) throws SVParseException { SVDBExpr expr = null ; if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } expr = assignmentExpression ( ) ; if ( fEventExpr . peek ( ) && fLexer . peekKeyword ( "iff" ) ) { fLexer . eatToken ( ) ; expr = new SVDBBinaryExpr ( expr , "iff" , expression ( ) ) ; } if ( fEventExpr . peek ( ) && fLexer . peekOperator ( "," ) ) { fLexer . eatToken ( ) ; expr = new SVDBBinaryExpr ( expr , "," , expression ( ) ) ; } if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } return expr ; } public SVDBExpr hierarchical_identifier ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } SVDBExpr ret ; String id = fLexer . readId ( ) ; if ( fLexer . peekOperator ( "." , "::" ) ) { ret = new SVDBFieldAccessExpr ( new SVDBIdentifierExpr ( id ) , false , hierarchical_identifier_int ( ) ) ; } else { ret = new SVDBIdentifierExpr ( id ) ; } if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } return ret ; } private SVDBExpr hierarchical_identifier_int ( ) throws SVParseException { fLexer . readOperator ( "." , "::" ) ; String id = fLexer . readId ( ) ; if ( fLexer . peekOperator ( "." , "::" ) ) { return new SVDBFieldAccessExpr ( new SVDBIdentifierExpr ( id ) , false , hierarchical_identifier_int ( ) ) ; } else { return new SVDBIdentifierExpr ( id ) ; } } public void coverpoint_target ( SVDBCoverpointExpr coverpoint ) throws SVParseException { try { SVDBExpr target = expression ( ) ; coverpoint . setTarget ( target ) ; if ( fLexer . peekKeyword ( "iff" ) ) { fLexer . eatToken ( ) ; fLexer . readOperator ( "(" ) ; SVDBExpr iff_expr = expression ( ) ; fLexer . readOperator ( ")" ) ; coverpoint . setIFFExpr ( iff_expr ) ; } } catch ( EOFException e ) { e . printStackTrace ( ) ; } } private static final Set < String > cp_body_items ; static { cp_body_items = new HashSet < String > ( ) ; cp_body_items . add ( "wildcard" ) ; cp_body_items . add ( "bins" ) ; cp_body_items . add ( "ignore_bins" ) ; cp_body_items . add ( "illegal_bins" ) ; cp_body_items . add ( "option" ) ; cp_body_items . add ( "type_option" ) ; } public void coverpoint_body ( SVDBCoverpointExpr coverpoint ) throws SVParseException { try { while ( fLexer . peekKeyword ( cp_body_items ) ) { if ( fLexer . peekKeyword ( "option" , "type_option" ) ) { String kw = fLexer . eatToken ( ) ; fLexer . readOperator ( "." ) ; String option = fLexer . readId ( ) ; if ( ! fLexer . peekString ( ) && ! fLexer . peekNumber ( ) ) { error ( "" + fLexer . peek ( ) + "\"" ) ; } if ( kw . equals ( "option" ) ) { coverpoint . addOption ( option , fLexer . eatToken ( ) ) ; } else { coverpoint . addTypeOption ( option , fLexer . eatToken ( ) ) ; } } else { if ( fLexer . peekKeyword ( "wildcard" ) ) { fLexer . eatToken ( ) ; } String bins_kw = fLexer . readKeyword ( "bins" , "ignore_bins" , "illegal_bins" ) ; String bins_id = fLexer . readId ( ) ; SVDBCoverBinsExpr bins = new SVDBCoverBinsExpr ( bins_id , bins_kw ) ; if ( fLexer . peekOperator ( "[" ) ) { fLexer . eatToken ( ) ; bins . setIsArray ( true ) ; if ( ! fLexer . peekOperator ( "]" ) ) { bins . setArrayExpr ( expression ( ) ) ; } fLexer . readOperator ( "]" ) ; } fLexer . readOperator ( "=" ) ; if ( fLexer . peekOperator ( "{" ) ) { open_range_list ( bins . getRangeList ( ) ) ; } else if ( fLexer . peekKeyword ( "default" ) ) { fLexer . eatToken ( ) ; bins . setIsDefault ( true ) ; } else { error ( "" + fLexer . peek ( ) ) ; } coverpoint . getCoverBins ( ) . add ( bins ) ; if ( fLexer . peekOperator ( ";" ) ) { fLexer . eatToken ( ) ; } } } } catch ( EOFException e ) { } } public List < SVCoverageExpr > parse_covercross ( InputStream in ) throws SVParseException { return null ; } public SVDBExpr assignmentExpression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } SVDBExpr a = conditionalExpression ( ) ; if ( fLexer . peekOperator ( SVKeywords . fAssignmentOps ) ) { String op = fLexer . readOperator ( ) ; SVDBExpr rhs = assignmentExpression ( ) ; a = new SVDBAssignExpr ( a , op , rhs ) ; } else if ( fLexer . peekKeyword ( "inside" ) ) { fLexer . eatToken ( ) ; SVDBInsideExpr inside = new SVDBInsideExpr ( a ) ; open_range_list ( inside . getValueRangeList ( ) ) ; a = inside ; if ( fLexer . peekOperator ( SVKeywords . fBinaryOps ) ) { a = new SVDBBinaryExpr ( a , fLexer . eatToken ( ) , expression ( ) ) ; } } if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } return a ; } public void open_range_list ( List < SVDBExpr > list ) throws SVParseException { if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } fLexer . readOperator ( "{" ) ; do { if ( fLexer . peekOperator ( "," ) ) { fLexer . eatToken ( ) ; } if ( fLexer . peekOperator ( "[" ) ) { list . add ( parse_range ( ) ) ; } else { list . add ( expression ( ) ) ; } } while ( fLexer . peekOperator ( "," ) ) ; fLexer . readOperator ( "}" ) ; if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } } public SVDBRangeExpr parse_range ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } fLexer . readOperator ( "[" ) ; SVDBExpr left = expression ( ) ; SVDBExpr right ; fLexer . readOperator ( ":" ) ; if ( fLexer . peekOperator ( "$" ) ) { fLexer . eatToken ( ) ; right = new SVDBRangeDollarBoundExpr ( ) ; } else { right = expression ( ) ; } fLexer . readOperator ( "]" ) ; if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } return new SVDBRangeExpr ( left , right ) ; } public SVDBExpr conditionalExpression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } SVDBExpr a = conditionalOrExpression ( ) ; if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } if ( fLexer . peekOperator ( "?" ) ) { fLexer . eatToken ( ) ; SVDBExpr lhs = a ; SVDBExpr mhs = expression ( ) ; fLexer . readOperator ( ":" ) ; SVDBExpr rhs = conditionalExpression ( ) ; a = new SVDBCondExpr ( lhs , mhs , rhs ) ; } if ( fDebugEn ) { debug ( "" ) ; } return a ; } public SVDBExpr conditionalOrExpression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } SVDBExpr a = conditionalAndExpression ( ) ; while ( fLexer . peekOperator ( "||" ) || ( fEventExpr . peek ( ) && fLexer . peekKeyword ( "or" ) ) ) { String op = fLexer . eatToken ( ) ; a = new SVDBBinaryExpr ( a , op , conditionalAndExpression ( ) ) ; } if ( fDebugEn ) { debug ( "" ) ; } return a ; } public SVDBExpr conditionalAndExpression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } SVDBExpr a = inclusiveOrExpression ( ) ; while ( fLexer . peekOperator ( "&&" ) ) { fLexer . eatToken ( ) ; a = new SVDBBinaryExpr ( a , "&&" , inclusiveOrExpression ( ) ) ; } if ( fDebugEn ) { debug ( "" ) ; } return a ; } public SVDBExpr inclusiveOrExpression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } SVDBExpr a = exclusiveOrExpression ( ) ; while ( fLexer . peekOperator ( "|" ) ) { fLexer . eatToken ( ) ; a = new SVDBBinaryExpr ( a , "|" , exclusiveOrExpression ( ) ) ; } if ( fDebugEn ) { debug ( "" ) ; } return a ; } public SVDBExpr exclusiveOrExpression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } SVDBExpr a = exclusiveNorExpression1 ( ) ; while ( fLexer . peekOperator ( "^" ) ) { fLexer . eatToken ( ) ; a = new SVDBBinaryExpr ( a , "^" , exclusiveNorExpression1 ( ) ) ; } if ( fDebugEn ) { debug ( "" ) ; } return a ; } public SVDBExpr exclusiveNorExpression1 ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } SVDBExpr a = exclusiveNorExpression2 ( ) ; while ( fLexer . peekOperator ( "^~" ) ) { fLexer . eatToken ( ) ; a = new SVDBBinaryExpr ( a , "^~" , exclusiveNorExpression2 ( ) ) ; } if ( fDebugEn ) { debug ( "" ) ; } return a ; } public SVDBExpr exclusiveNorExpression2 ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } SVDBExpr a = andExpression ( ) ; while ( fLexer . peekOperator ( "~^" ) ) { fLexer . eatToken ( ) ; a = new SVDBBinaryExpr ( a , "~^" , andExpression ( ) ) ; } if ( fDebugEn ) { debug ( "" ) ; } return a ; } public SVDBExpr andExpression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } SVDBExpr a = equalityExpression ( ) ; while ( fLexer . peekOperator ( "&" ) ) { fLexer . eatToken ( ) ; a = new SVDBBinaryExpr ( a , "&" , equalityExpression ( ) ) ; } if ( fDebugEn ) { debug ( "" ) ; } return a ; } public SVDBExpr equalityExpression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } SVDBExpr a = relationalExpression ( ) ; while ( fLexer . peekOperator ( "==" , "!=" , "===" , "!==" , "==?" , "!=?" ) ) { a = new SVDBBinaryExpr ( a , fLexer . readOperator ( ) , relationalExpression ( ) ) ; } if ( fDebugEn ) { debug ( "" ) ; } return a ; } public SVDBExpr relationalExpression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } SVDBExpr a = shiftExpression ( ) ; while ( fLexer . peekOperator ( "<" , ">" , "<=" , ">=" ) ) { a = new SVDBBinaryExpr ( a , fLexer . readOperator ( ) , shiftExpression ( ) ) ; } if ( fDebugEn ) { debug ( "" ) ; } return a ; } public SVDBExpr shiftExpression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } SVDBExpr a = additiveExpression ( ) ; while ( fLexer . peekOperator ( "<<" , "<<<" , ">>" , ">>>" ) ) { a = new SVDBBinaryExpr ( a , fLexer . readOperator ( ) , additiveExpression ( ) ) ; } if ( fDebugEn ) { debug ( "" ) ; } return a ; } public SVDBExpr additiveExpression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" ) ; } SVDBExpr a = multiplicativeExpression ( ) ; while ( fLexer . peekOperator ( "+" , "-" ) ) { a = new SVDBBinaryExpr ( a , fLexer . readOperator ( ) , multiplicativeExpression ( ) ) ; } if ( fDebugEn ) { debug ( "" ) ; } return a ; } public SVDBExpr multiplicativeExpression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } SVDBExpr a = unaryExpression ( ) ; while ( fLexer . peekOperator ( "*" , "/" , "%" , "**" ) ) { a = new SVDBBinaryExpr ( a , fLexer . readOperator ( ) , unaryExpression ( ) ) ; } if ( fDebugEn ) { debug ( "" ) ; } return a ; } public SVDBExpr unaryExpression ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } if ( fLexer . peekOperator ( "++" , "--" ) ) { return new SVDBIncDecExpr ( fLexer . readOperator ( ) , unaryExpression ( ) ) ; } else if ( fEventExpr . peek ( ) && fLexer . peekKeyword ( "posedge" , "negedge" , "edge" ) ) { SVDBExpr ret = new SVDBUnaryExpr ( fLexer . eatToken ( ) , expression ( ) ) ; if ( fLexer . peekKeyword ( "iff" ) ) { fLexer . eatToken ( ) ; ret = new SVDBBinaryExpr ( ret , "iff" , expression ( ) ) ; } return ret ; } if ( fLexer . peekOperator ( "+" , "-" , "~" , "!" , "&" , "~&" , "|" , "~|" , "^" , "~^" , "^~" ) || ( fAssertionExpr . peek ( ) && fLexer . peekOperator ( "*" ) ) ) { String op = fLexer . readOperator ( ) ; SVDBUnaryExpr ret = new SVDBUnaryExpr ( op , unaryExpression ( ) ) ; if ( fDebugEn ) { debug ( "" + op ) ; } return ret ; } else if ( fLexer . peekOperator ( "'" ) ) { return assignment_pattern_expr ( ) ; } SVDBExpr a = primary ( ) ; if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } while ( fLexer . peekOperator ( "::" , "." , "[" ) ) { SVToken t = fLexer . consumeToken ( ) ; if ( fAssertionExpr . peek ( ) ) { if ( ! fLexer . peekOperator ( ) ) { fLexer . ungetToken ( t ) ; a = selector ( a ) ; } else { fLexer . ungetToken ( t ) ; break ; } } else { fLexer . ungetToken ( t ) ; a = selector ( a ) ; } } if ( fLexer . peekOperator ( "'" ) ) { SVToken tok = fLexer . consumeToken ( ) ; if ( fLexer . peekOperator ( "{" ) ) { fLexer . ungetToken ( tok ) ; a = assignment_pattern_expr ( ) ; } else { if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } a = new SVDBCastExpr ( a , expression ( ) ) ; } } while ( fLexer . peekOperator ( "++" , "--" ) ) { a = new SVDBIncDecExpr ( fLexer . readOperator ( ) , a ) ; } return a ; } private SVDBExpr assignment_pattern_expr ( ) throws SVParseException { SVDBExpr ret_top ; fLexer . readOperator ( "'" ) ; fLexer . readOperator ( "{" ) ; if ( fDebugEn ) { debug ( "" ) ; } if ( fLexer . peekOperator ( "}" ) ) { fLexer . eatToken ( ) ; ret_top = new SVDBConcatenationExpr ( ) ; } else { try { fEnableNameMappedPrimary = true ; SVDBExpr expr1 = expression ( ) ; if ( fLexer . peekOperator ( "{" ) ) { SVDBAssignmentPatternRepeatExpr ret = new SVDBAssignmentPatternRepeatExpr ( expr1 ) ; fLexer . eatToken ( ) ; while ( true ) { SVDBExpr expr = expression ( ) ; ret . getPatternList ( ) . add ( expr ) ; if ( fLexer . peekOperator ( "," ) ) { fLexer . eatToken ( ) ; } else { break ; } } fLexer . readOperator ( "}" ) ; ret_top = ret ; } else { SVDBAssignmentPatternExpr ret = new SVDBAssignmentPatternExpr ( ) ; ret . getPatternList ( ) . add ( expr1 ) ; while ( fLexer . peekOperator ( "," ) ) { fLexer . eatToken ( ) ; SVDBExpr expr = expression ( ) ; ret . getPatternList ( ) . add ( expr ) ; } ret_top = ret ; } fLexer . readOperator ( "}" ) ; } finally { fEnableNameMappedPrimary = false ; } } return ret_top ; } public SVDBExpr primary ( ) throws SVParseException { if ( fDebugEn ) { debug ( "" + fLexer . peek ( ) ) ; } SVDBExpr ret = null ; if ( fLexer . peekOperator ( "(" ) ) { if ( fDebugEn ) { debug ( "" ) ; } fLexer . eatToken ( ) ; SVDBExpr a = expression ( ) ; if ( fLexer . peekOperator ( ":" ) ) { fLexer . eatToken ( ) ; SVDBExpr expr = fParsers . exprParser ( ) . expression ( ) ; if ( fLexer . peekOperator ( ":" ) ) { fLexer . eatToken ( ) ; expr = fParsers . exprParser ( ) . expression ( ) ; } } fLexer . readOperator ( ")" ) ; fLexer . peek ( ) ; if ( fLexer . isNumber ( ) || fLexer . isIdentifier ( ) || fLexer . peekOperator ( "(" , "~" , "!" ) || fLexer . peekKeyword ( "this" , "super" , "new" ) ) { ret = new SVDBCastExpr ( a , unaryExpression ( ) ) ; } else { ret = new SVDBParenExpr ( a ) ; } } else { fLexer . peek ( ) ; if ( fLexer . isNumber ( ) ) { if ( fDebugEn ) { debug ( "" ) ; } SVToken tmp = fLexer . consumeToken ( ) ; if ( fEnableNameMappedPrimary && fLexer . peekOperator ( ":" ) ) { fLexer . eatToken ( ) ; ret = new SVDBNameMappedExpr ( tmp . getImage ( ) , expression ( ) ) ; } else { ret = new SVDBLiteralExpr ( tmp . getImage ( ) ) ; } } else if ( fLexer . peekOperator ( "$" ) ) { fLexer . eatToken ( ) ; ret = new SVDBRangeDollarBoundExpr ( ) ; } else if ( fLexer . peekString ( ) ) { if ( fDebugEn ) { debug ( "" ) ; } SVToken tmp = fLexer . consumeToken ( ) ; if ( fEnableNameMappedPrimary && fLexer . peekOperator ( ":" ) ) { fLexer . eatToken ( ) ; ret = new SVDBNameMappedExpr ( tmp . getImage ( ) , expression ( ) ) ; } else { ret = new SVDBStringExpr ( tmp . getImage ( ) ) ; } } else if ( fLexer . peekKeyword ( "null" ) ) { if ( fDebugEn ) { debug ( "" ) ; } fLexer . eatToken ( ) ; ret = new SVDBNullExpr ( ) ; } else if ( fLexer . isIdentifier ( ) || SVKeywords . isBuiltInType ( fLexer . peek ( ) ) || fLexer . peekKeyword ( "new" , "default" , "local" , "const" ) ) { if ( fDebugEn ) { debug ( " primary \"" + fLexer . getImage ( ) + "" ) ; } String id = fLexer . eatToken ( ) ; if ( fLexer . peekOperator ( "(*" ) ) { fParsers . attrParser ( ) . parse ( null ) ; } if ( fLexer . peekOperator ( "#" ) ) { if ( fDebugEn ) { debug ( "" ) ; } ret = new SVDBParamIdExpr ( id ) ; fLexer . eatToken ( ) ; fLexer . readOperator ( "(" ) ; while ( fLexer . peek ( ) != null && ! fLexer . peekOperator ( ")" ) ) { ( ( SVDBParamIdExpr ) ret ) . addParamExpr ( datatype_or_expression ( ) ) ; if ( fLexer . peekOperator ( "," ) ) { fLexer . eatToken ( ) ; } else { break ; } } fLexer . readOperator ( ")" ) ; } else if ( fLexer . peekOperator ( "(" ) || fLexer . peekKeyword ( "with" ) ) { if ( id . equals ( "randomize" ) ) { ret = randomize_call ( null ) ; } else if ( fLexer . peekOperator ( "(" ) ) { ret = tf_args_call ( null , id ) ; } else { ret = tf_noargs_with_call ( null , id ) ; } } else if ( id . equals ( "new" ) ) { ret = ctor_call ( ) ; } else if ( fLexer . peekKeyword ( SVKeywords . fBuiltinDeclTypes ) || fLexer . peekKeyword ( "const" ) ) { fLexer . startCapture ( ) ; fLexer
211
<s> package org . rubypeople . rdt . launching ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . debug . core . ILaunchConfiguration ; import org . rubypeople . rdt . core . IRubyProject ; public class StandardLoadpathProvider implements IRuntimeLoadpathProvider { public IRuntimeLoadpathEntry [ ] computeUnresolvedLoadpath ( ILaunchConfiguration configuration ) throws CoreException { boolean useDefault = configuration . getAttribute ( IRubyLaunchConfigurationConstants . ATTR_DEFAULT_LOADPATH , true ) ; if ( useDefault ) { IRubyProject proj = RubyRuntime . getRubyProject ( configuration ) ; IRuntimeLoadpathEntry jreEntry = RubyRuntime . computeRubyVMEntry ( configuration ) ; if ( proj == null ) { if ( jreEntry == null ) { return new IRuntimeLoadpathEntry [ 0 ] ; } return new IRuntimeLoadpathEntry [ ] { jreEntry } ; } IRuntimeLoadpathEntry [ ] entries = RubyRuntime . computeUnresolvedRuntimeLoadpath ( proj ) ; IRuntimeLoadpathEntry projEntry = RubyRuntime . computeRubyVMEntry ( proj ) ; if ( jreEntry != null && projEntry != null ) { if ( ! jreEntry . equals ( projEntry
212
<s> package org . rubypeople . rdt . internal . ui . text . ruby ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . StringTokenizer ; import org . eclipse . core . runtime . Preferences ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . text . Assert ; import org . eclipse . jface . text . rules . ICharacterScanner ; import org . eclipse . jface . text . rules . IToken ; import org . eclipse . jface . text . rules . IWordDetector ; import org . eclipse . jface . text . rules . Token ; import org . eclipse . jface . util . PropertyChangeEvent ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . ui . text . IRubyColorConstants ; import org . rubypeople . rdt . internal . ui . text . ruby . CombinedWordRule . WordMatcher ; import org . rubypeople . rdt . ui . text . IColorManager ; public class RubyCommentScanner extends AbstractRubyScanner { private static class AtRubyIdentifierDetector implements IWordDetector { public boolean isWordStart ( char c ) { return c == '@' || Character . isJavaIdentifierStart ( c ) ; } public boolean isWordPart ( char c ) { return Character . isJavaIdentifierPart ( c ) ; } } private class TaskTagMatcher extends CombinedWordRule . WordMatcher { private IToken fToken ; private Map fUppercaseWords = new HashMap ( ) ; private boolean fCaseSensitive = true ; private CombinedWordRule . CharacterBuffer fBuffer = new CombinedWordRule . CharacterBuffer ( 16 ) ; public TaskTagMatcher ( IToken token ) { fToken = token ; } public synchronized void clearWords ( ) { super . clearWords ( ) ; fUppercaseWords . clear ( ) ; } public synchronized void addTaskTags ( String value ) { String [ ] tasks = split ( value , "," ) ; for ( int i = 0 ; i < tasks . length ; i ++ ) { if ( tasks [ i ] . length ( ) > 0 ) { addWord ( tasks [ i ] , fToken ) ; } } } private String [ ] split ( String value , String delimiters ) { StringTokenizer tokenizer = new StringTokenizer ( value , delimiters ) ; int size = tokenizer . countTokens ( ) ; String [ ] tokens = new String [ size ] ; int i = 0 ; while ( i < size ) tokens [ i ++ ] = tokenizer . nextToken ( ) ; return tokens ; } public synchronized void addWord ( String word , IToken token ) { Assert . isNotNull ( word ) ; Assert . isNotNull ( token ) ; super . addWord ( word , token ) ; fUppercaseWords . put ( new CombinedWordRule . CharacterBuffer ( word . toUpperCase ( ) ) , token ) ; } public synchronized IToken evaluate ( ICharacterScanner scanner , CombinedWordRule . CharacterBuffer word ) { if ( fCaseSensitive ) return super . evaluate ( scanner , word ) ; fBuffer . clear ( ) ; for ( int i = 0 , n = word . length ( ) ; i < n ; i ++ ) fBuffer . append ( Character . toUpperCase ( word . charAt ( i ) ) ) ; IToken token = ( IToken ) fUppercaseWords . get ( fBuffer ) ; if ( token != null ) return token ; return Token . UNDEFINED ; } public boolean isCaseSensitive ( ) { return fCaseSensitive ; } public void setCaseSensitive ( boolean caseSensitive ) { fCaseSensitive = caseSensitive ; } } private static final String COMPILER_TASK_TAGS = RubyCore . COMPILER_TASK_TAGS ; protected static final String TASK_TAG = IRubyColorConstants . TASK_TAG ; private static final String COMPILER_TASK_CASE_SENSITIVE =
213
<s> package com . asakusafw . runtime . directio ; public final class OutputAttemptContext { private final String transactionId ; private final String attemptId ; private final String outputId ; private final Counter counter ; public OutputAttemptContext ( String transactionId , String attemptId , String outputId , Counter counter ) { if ( transactionId == null ) { throw new IllegalArgumentException ( "" ) ; } if ( attemptId == null ) { throw new IllegalArgumentException ( "" ) ; } if ( outputId == null ) { throw new IllegalArgumentException ( "" ) ; } if ( counter == null ) { throw new IllegalArgumentException ( "" ) ; } this . transactionId = transactionId ; this . attemptId = attemptId ; this . outputId = outputId ; this . counter = counter ; } public OutputTransactionContext getTransactionContext ( ) { return new OutputTransactionContext
214
<s> package test . modelgen . table . model ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import javax . annotation . Generated ; import org . apache . hadoop . io . Text ; import org . apache . hadoop . io . Writable ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . StringOption ; import com . asakusafw . vocabulary . model . DataModel ; import com . asakusafw . vocabulary . model . Property ; import com . asakusafw . vocabulary . model . TableModel ; @ Generated ( "" ) @ DataModel @ TableModel ( name = "locked_table" , columns = { "JOBFLOW_SID" , "TABLE_NAME" } , primary = { "JOBFLOW_SID" , "TABLE_NAME" } ) @ SuppressWarnings ( "deprecation" ) public class LockedTable implements Writable { @ Property ( name = "JOBFLOW_SID" ) private IntOption jobflowSid = new IntOption ( ) ; @ Property ( name = "TABLE_NAME" ) private StringOption tableName = new StringOption ( ) ; public int getJobflowSid ( ) { return this . jobflowSid . get ( ) ; } public void setJobflowSid ( int jobflowSid ) { this . jobflowSid . modify ( jobflowSid ) ; } public IntOption getJobflowSidOption ( ) { return this . jobflowSid ; } public void setJobflowSidOption ( IntOption jobflowSid ) { this . jobflowSid . copyFrom ( jobflowSid ) ; } public Text getTableName ( ) { return this . tableName . get ( ) ; } public void setTableName ( Text tableName ) { this . tableName . modify ( tableName ) ; } public String getTableNameAsString ( ) { return this . tableName . getAsString ( ) ; } public void setTableNameAsString ( String tableName ) { this . tableName . modify ( tableName ) ; } public StringOption getTableNameOption ( ) { return this . tableName ; } public void setTableNameOption ( StringOption tableName ) { this . tableName . copyFrom ( tableName ) ; } public void copyFrom ( LockedTable source ) { this . jobflowSid . copyFrom ( source . jobflowSid ) ; this . tableName . copyFrom ( source . tableName ) ; } @ Override public void write ( DataOutput out ) throws IOException { jobflowSid . write ( out ) ; tableName . write ( out ) ; } @ Override public void readFields ( DataInput in ) throws IOException { jobflowSid . readFields ( in ) ; tableName . readFields ( in ) ; } @ Override public int hashCode ( ) { int prime = 31 ; int result = 1 ; result = prime * result + jobflowSid . hashCode ( ) ; result = prime * result + tableName . hashCode ( ) ; return result ; } @ Override public boolean equals ( Object obj ) { if ( this == obj ) { return true ; } if ( obj == null )
215
<s> package de . fuberlin . wiwiss . d2rq . engine ; import java . util . HashSet ; import java . util . Set ; import com . hp . hpl . jena . graph . Node ; import com . hp . hpl . jena . graph . Triple ; import com . hp . hpl . jena . sparql . algebra . Op ; import com . hp . hpl . jena . sparql . algebra . OpVisitorBase ; import com . hp . hpl . jena . sparql . algebra . OpWalker ; import com . hp . hpl . jena . sparql . algebra . op . OpAssign ; import com . hp . hpl . jena . sparql . algebra . op . OpBGP ; import com . hp . hpl . jena . sparql . algebra . op . OpDatasetNames ; import com . hp . hpl . jena
216
<s> package com . asakusafw . dmdl . source ; import java . io . File ; import java . io . IOException ; import java . nio . charset . Charset ; import java . util . ArrayList ; import java . util . List ; import java . util . regex . Pattern ; public class DmdlSourceDirectory implements DmdlSourceRepository { private File directory ; private Charset encoding ; private Pattern inclusionPattern ; private Pattern exclusionPattern ; public DmdlSourceDirectory ( File directory , Charset encoding , Pattern inclusionPattern , Pattern exclusionPattern ) { if ( directory == null ) { throw new IllegalArgumentException ( "" ) ; } if ( encoding == null ) { throw new IllegalArgumentException ( "" ) ; } if ( inclusionPattern == null ) { throw new IllegalArgumentException ( "" ) ; } if ( exclusionPattern == null ) { throw new IllegalArgumentException ( "" ) ; } this . directory = directory ; this . encoding = encoding ; this . inclusionPattern = inclusionPattern ; this . exclusionPattern = exclusionPattern ; } @ Override public Cursor createCursor ( ) throws IOException { List < File > files = collect ( directory , new ArrayList < File > ( ) ) ; return new DmdlSourceFile . FileListCursor ( files . iterator ( ) , encoding ) ; } private List < File > collect ( File current , List < File >
217
<s> package org . oddjob . monitor . action ; import javax . swing . KeyStroke ; import org . oddjob . arooa . ArooaConfiguration ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . ArooaType ; import org . oddjob . arooa . ConfigurationHandle ; import org . oddjob . arooa . design . DesignParser ; import org . oddjob . arooa . design . designer . ArooaDesignerForm ; import org . oddjob . arooa . design . screem . Form ; import org . oddjob . arooa . parsing . ConfigurationOwner ; import org . oddjob . arooa . parsing . ConfigurationSession ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . monitor . Standards ; import org . oddjob . monitor . actions . FormAction ; import org . oddjob . monitor . context . ExplorerContext ; import org . oddjob . monitor . model . JobFormAction ; public class DesignInsideAction extends JobFormAction implements FormAction { private ArooaConfiguration config ; private DesignParser parser ; private ConfigurationHandle configHandle ; public String getName ( ) { return "" ; } public String getGroup ( ) { return DESIGN_GROUP ; } public Integer getMnemonicKey ( ) { return Standards . DESIGN_INSIDE_MNEMONIC_KEY ; } public KeyStroke getAcceleratorKey ( ) { return Standards . DESIGNER_INSIDE_ACCELERATOR_KEY ; } @ Override protected void doPrepare ( ExplorerContext context ) { ConfigurationOwner configOwner = null ; if ( context . getThisComponent ( ) instanceof ConfigurationOwner ) { configOwner = ( ConfigurationOwner ) context . getThisComponent ( ) ; } if ( configOwner == null || configOwner . rootDesignFactory ( ) == null ) { setEnabled ( false ) ; setVisible ( false ) ; } else { setVisible
218
<s> package com . asakusafw . bulkloader . importer ; import static org . junit . Assert . * ; import java . io . File ; import java . util . Arrays ; import java . util . Calendar ; import java . util . Date ; import java . util . LinkedHashMap ; import java . util . List ; import java . util . Map ; import org . junit . After ; import org . junit . AfterClass ; import org . junit . Before ; import org . junit . BeforeClass ; import org . junit . Test ; import com . asakusafw . bulkloader . bean . ImportBean ; import com . asakusafw . bulkloader . bean . ImportTargetTableBean ; import com . asakusafw . bulkloader . common . BulkLoaderInitializer ; import com . asakusafw . bulkloader . common . ImportTableLockType ; import com . asakusafw . bulkloader . common . ImportTableLockedOperation ; import com . asakusafw . bulkloader . exception . BulkLoaderReRunnableException ; import com . asakusafw . bulkloader . testutil . UnitTestUtil ; import com . asakusafw . testtools . TestUtils ; import com . asakusafw . testtools . inspect . Cause ; public class TargetDataLockTest { private static List < String > PROPERTYS = Arrays . asList ( new String [ ] { "" } ) ; private static String targetName = "target1" ; private static String jobflowId = "JOB_FLOW01" ; private static String executionId = "" ; @ BeforeClass public static void setUpBeforeClass ( ) throws Exception { UnitTestUtil . setUpBeforeClass ( ) ; UnitTestUtil . setUpEnv ( ) ; BulkLoaderInitializer . initDBServer ( jobflowId , executionId , PROPERTYS , targetName ) ; UnitTestUtil . setUpDB ( ) ; } @ AfterClass public static void tearDownAfterClass ( ) throws Exception { UnitTestUtil . tearDownDB ( ) ; UnitTestUtil . tearDownAfterClass ( ) ; } @ Before public void setUp ( ) throws Exception { BulkLoaderInitializer . initDBServer ( jobflowId , executionId , PROPERTYS , "target1" ) ; UnitTestUtil . startUp ( ) ; } @ After public void tearDown ( ) throws Exception { UnitTestUtil . tearDown ( ) ; } @ Test public void lockTest01 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; Map < String , ImportTargetTableBean > targetTable = new LinkedHashMap < String , ImportTargetTableBean > ( ) ; ImportTargetTableBean tableBean = new ImportTargetTableBean ( ) ; tableBean . setImportTargetColumns ( Arrays . asList ( new String [ ] { "TEXTDATA1" , "INTDATA1" , "DATEDATA1" } ) ) ; tableBean . setSearchCondition ( null ) ; tableBean . setUseCache ( false ) ; tableBean . setLockType ( ImportTableLockType . TABLE ) ; tableBean . setLockedOperation ( ImportTableLockedOperation . ERROR ) ; tableBean . setImportTargetType ( null ) ; tableBean . setDfsFilePath ( null ) ; targetTable . put ( "" , tableBean ) ; ImportBean bean = createBean ( new String [ ] { jobflowId , executionId , "" , "3" , "5" } , targetTable ) ; TargetDataLock lock = new TargetDataLock ( ) ; boolean result = lock . lock ( bean ) ; assertTrue ( result ) ; util . loadFromDatabase ( ) ; if ( ! util . inspect ( ) ) { for ( Cause cause : util . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; } fail ( util . getCauseMessage ( ) ) ; } } @ Test public void lockTest02 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; Map < String , ImportTargetTableBean > targetTable = new LinkedHashMap < String , ImportTargetTableBean > ( ) ; ImportTargetTableBean tableBean1 = new ImportTargetTableBean ( ) ; tableBean1 . setImportTargetColumns ( Arrays . asList ( new String [ ] { "TEXTDATA1" , "INTDATA1" , "DATEDATA1" } ) ) ; tableBean1 . setSearchCondition ( "INTDATA1=11" ) ; tableBean1 . setUseCache ( false ) ; tableBean1 . setLockType ( ImportTableLockType . NONE ) ; tableBean1 . setLockedOperation ( ImportTableLockedOperation . FORCE ) ; tableBean1 . setImportTargetType ( null ) ; tableBean1 . setDfsFilePath ( null ) ; targetTable . put ( "" , tableBean1 ) ; ImportTargetTableBean tableBean2 = new ImportTargetTableBean ( ) ; tableBean2 . setImportTargetColumns ( Arrays . asList ( new String [ ] { "TEXTDATA2" } ) ) ; tableBean2 . setSearchCondition ( "" ) ; tableBean2 . setUseCache ( false ) ; tableBean2 . setLockType ( ImportTableLockType . RECORD ) ; tableBean2 . setLockedOperation ( ImportTableLockedOperation . OFF ) ; tableBean2 . setImportTargetType ( null ) ; tableBean2 . setDfsFilePath ( null ) ; targetTable . put ( "" , tableBean2 ) ; ImportBean bean = createBean ( new String [ ] { jobflowId , executionId , "" , "3" , "5" } , targetTable ) ; TargetDataLock lock = new TargetDataLock ( ) ; boolean result = lock . lock ( bean ) ; assertTrue ( result ) ; util . loadFromDatabase ( ) ; if ( ! util . inspect ( ) ) { for ( Cause cause : util . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; } fail ( util . getCauseMessage ( ) ) ; } } @ Test public void lockTest03 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; Map < String , ImportTargetTableBean > targetTable = new LinkedHashMap < String , ImportTargetTableBean > ( ) ; ImportTargetTableBean tableBean = new ImportTargetTableBean ( ) ; tableBean . setImportTargetColumns ( Arrays . asList ( new String [ ] { "TEXTDATA1" , "INTDATA1" , "DATEDATA1" } ) ) ; tableBean . setSearchCondition ( "" ) ; tableBean . setUseCache ( false ) ; tableBean . setLockType ( ImportTableLockType . RECORD ) ; tableBean . setLockedOperation ( ImportTableLockedOperation . ERROR ) ; tableBean . setImportTargetType ( null ) ; tableBean . setDfsFilePath ( null ) ; targetTable . put ( "" , tableBean ) ; ImportBean bean = createBean ( new String [ ] { jobflowId , executionId , "" , "3" , "1" } , targetTable ) ; TargetDataLock lock = new TargetDataLock ( ) ; try { lock . lock ( bean ) ; fail ( ) ; } catch ( BulkLoaderReRunnableException e ) { } util . loadFromDatabase ( ) ; if ( ! util . inspect ( ) ) { for ( Cause cause : util . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; } fail ( util . getCauseMessage ( ) ) ; } } @ Test public void lockTest04 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; Map < String , ImportTargetTableBean > targetTable = new LinkedHashMap < String , ImportTargetTableBean > ( ) ; ImportTargetTableBean tableBean1 = new ImportTargetTableBean ( ) ; tableBean1 . setImportTargetColumns ( Arrays . asList ( new String [ ] { "TEXTDATA1" , "INTDATA1" , "DATEDATA1" } ) ) ; tableBean1 . setSearchCondition ( "INTDATA1=11" ) ; tableBean1 . setUseCache ( false ) ; tableBean1 . setLockType ( ImportTableLockType . RECORD ) ; tableBean1 . setLockedOperation ( ImportTableLockedOperation . ERROR ) ; tableBean1 . setImportTargetType ( null ) ; tableBean1 . setDfsFilePath ( null ) ; targetTable . put ( "" , tableBean1 ) ; ImportTargetTableBean tableBean2 = new ImportTargetTableBean ( ) ; tableBean2 . setImportTargetColumns ( Arrays . asList ( new String [ ] { "TEXTDATA2" } ) ) ; tableBean2 . setSearchCondition ( "" ) ; tableBean2 . setUseCache ( false ) ; tableBean2 . setLockType ( ImportTableLockType . NONE ) ; tableBean2 . setLockedOperation ( ImportTableLockedOperation . ERROR ) ; tableBean2 . setImportTargetType ( null ) ; tableBean2 . setDfsFilePath ( null ) ; targetTable . put ( "" , tableBean2 ) ; ImportBean bean = createBean ( new String [ ] { jobflowId , executionId , "" , "3" , "5" } , targetTable ) ; TargetDataLock lock = new TargetDataLock ( ) ; boolean result = lock . lock ( bean ) ; assertTrue ( result ) ; util . loadFromDatabase ( ) ; if ( ! util . inspect ( ) ) { for ( Cause cause : util . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; } fail ( util . getCauseMessage ( ) ) ; } } @ Test public void lockTest05 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; Map < String , ImportTargetTableBean > targetTable = new LinkedHashMap < String , ImportTargetTableBean > ( ) ; ImportTargetTableBean tableBean = new ImportTargetTableBean ( ) ; tableBean . setImportTargetColumns ( Arrays . asList ( new String [ ] { "TEXTDATA1" , "INTDATA1" , "DATEDATA1" } ) ) ; tableBean . setSearchCondition ( null ) ; tableBean . setUseCache ( false ) ; tableBean . setLockType ( ImportTableLockType . TABLE ) ; tableBean . setLockedOperation ( ImportTableLockedOperation . ERROR ) ; tableBean . setImportTargetType ( null ) ; tableBean . setDfsFilePath ( null ) ; targetTable . put ( "" , tableBean ) ; ImportBean bean = createBean ( new String [ ] { jobflowId , executionId , "" , "3" , "5" } , targetTable ) ; TargetDataLock lock = new TargetDataLock ( ) ; boolean result = lock . lock ( bean ) ; assertTrue ( result ) ; util . loadFromDatabase ( ) ; if ( ! util . inspect ( ) ) { for ( Cause cause : util . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; } fail ( util . getCauseMessage ( ) ) ; } } @ Test public void lockTest06 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; Map < String , ImportTargetTableBean > targetTable = new LinkedHashMap < String , ImportTargetTableBean > ( ) ; ImportTargetTableBean tableBean = new ImportTargetTableBean ( ) ; tableBean . setImportTargetColumns ( Arrays . asList ( new String [ ] { "TEXTDATA1" , "INTDATA1" , "DATEDATA1" } ) ) ; tableBean . setSearchCondition ( null ) ; tableBean . setUseCache ( false ) ; tableBean . setLockType ( ImportTableLockType . NONE ) ; tableBean . setLockedOperation ( ImportTableLockedOperation . FORCE ) ; tableBean . setImportTargetType ( null ) ; tableBean . setDfsFilePath ( null ) ; targetTable . put ( "" , tableBean ) ; ImportBean bean = createBean ( new String [ ] { jobflowId , executionId , "" , "3" , "5" } , targetTable ) ; TargetDataLock lock = new TargetDataLock ( ) ; boolean result = lock . lock ( bean ) ; assertTrue ( result ) ; util . loadFromDatabase ( ) ; if ( ! util . inspect ( ) ) { for ( Cause cause : util . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; } fail ( util . getCauseMessage ( ) ) ; } } @ Test public void lockTest07 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; Map < String , ImportTargetTableBean > targetTable = new LinkedHashMap < String , ImportTargetTableBean > ( ) ; ImportTargetTableBean tableBean = new ImportTargetTableBean ( ) ; tableBean . setImportTargetColumns ( Arrays . asList ( new String [ ] { "TEXTDATA2" } ) ) ; tableBean . setSearchCondition ( null ) ; tableBean . setUseCache ( false ) ; tableBean . setLockType ( ImportTableLockType . RECORD ) ; tableBean . setLockedOperation ( ImportTableLockedOperation . OFF ) ; tableBean . setImportTargetType ( null ) ; tableBean . setDfsFilePath ( null ) ; targetTable . put ( "" , tableBean ) ; ImportBean bean = createBean ( new String [ ] { jobflowId , executionId , "" , "3" , "5" } , targetTable ) ; TargetDataLock lock = new TargetDataLock ( ) ; boolean result = lock . lock ( bean ) ; assertTrue ( result ) ; util . loadFromDatabase ( ) ; if ( ! util . inspect ( ) ) { for ( Cause cause : util . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; } fail ( util . getCauseMessage ( ) ) ; } } @ Test public void lockTest08 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; Map < String , ImportTargetTableBean > targetTable = new LinkedHashMap < String , ImportTargetTableBean > ( ) ; ImportTargetTableBean tableBean = new ImportTargetTableBean ( ) ; tableBean . setImportTargetColumns ( Arrays . asList ( new String [ ] { "TEXTDATA1" , "INTDATA1" , "DATEDATA1" } ) ) ; tableBean . setSearchCondition ( "" ) ; tableBean . setUseCache ( false ) ; tableBean . setLockType ( ImportTableLockType . RECORD ) ; tableBean . setLockedOperation ( ImportTableLockedOperation . ERROR ) ; tableBean . setImportTargetType ( null ) ; tableBean . setDfsFilePath ( null ) ; targetTable . put ( "" , tableBean ) ; ImportBean bean = createBean ( new String [ ] { jobflowId , executionId , "" , "3" , "1" } , targetTable ) ; TargetDataLock lock = new TargetDataLock ( ) ; try { lock . lock ( bean ) ; fail ( ) ; } catch ( BulkLoaderReRunnableException e ) { } util . loadFromDatabase ( ) ; if ( ! util . inspect ( ) ) { for ( Cause cause : util . getCauses ( ) ) { System . out . println ( cause . getMessage ( ) ) ; } fail ( util . getCauseMessage ( ) ) ; } } @ Test public void lockTest09 ( ) throws Exception { File testDataDir = new File ( "" ) ; TestUtils util = new TestUtils ( testDataDir ) ; util . storeToDatabase ( false ) ; Map < String , ImportTargetTableBean > targetTable = new LinkedHashMap < String , ImportTargetTableBean > ( ) ; ImportTargetTableBean tableBean = new ImportTargetTableBean ( ) ; tableBean .
219
<s> package com . pogofish . jadt . sink ; import java . io . IOException ; import java . io . StringWriter ; import com . pogofish . jadt . util . ExceptionAction ; import com . pogofish . jadt . util . Util ; public class StringSink implements Sink { private final StringWriter writer ; private boolean closed = false ; private final String name ; @ Override public String getInfo ( ) { return name ; }
220
<s> package com . asakusafw . compiler . batch . batch ; import com . asakusafw
221
<s> package com . asakusafw . runtime . directio . hadoop ; import java . text . MessageFormat ; import org . apache . hadoop . util . Progressable ; import com . asakusafw . runtime . directio . Counter ; public final class ProgressableCounter extends Counter { private final Progressable progressable ; public ProgressableCounter ( Progressable progressable ) {
222
<s> package com . asakusafw . testdriver . bulkloader ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . List ; import org . junit . Rule ; import org . junit . Test ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . DataModelReflection ; import com . asakusafw . testdriver . core . DataModelSource ; import com . asakusafw . testdriver . core . PropertyName ; import com . asakusafw . testdriver . model . SimpleDataModelDefinition ; import com . asakusafw . vocabulary . bulkloader . BulkLoadExporterDescription ; import com . asakusafw . vocabulary . bulkloader . DupCheckDbExporterDescription ; public class BulkLoadExporterRetrieverTest { static final DataModelDefinition < Simple > SIMPLE = new SimpleDataModelDefinition < Simple > ( Simple . class ) ; static final DataModelDefinition < DupCheck > DUP_CHECK = new SimpleDataModelDefinition < DupCheck > ( DupCheck . class ) ; static final BulkLoadExporterDescription NORMAL = new DupCheckDbExporterDescription ( ) { @ Override public Class < ? > getModelType ( ) { return Simple . class ; } @ Override public String getTargetName ( ) { return "exporter" ; } @ Override protected Class < ? > getNormalModelType ( ) { return Simple . class ; } @ Override protected Class < ? > getErrorModelType ( ) { return DupCheck . class ; } @ Override protected String getErrorCodeValue ( ) { return "aaa" ; } @ Override protected String getErrorCodeColumnName ( ) { return "TEXT" ; } @ Override protected List < String > getCheckColumnNames ( ) { return Arrays . asList ( "NUMBER" ) ; } } ; static final BulkLoadExporterDescription MISSING = new DupCheckDbExporterDescription ( ) { @ Override public Class < ? > getModelType ( ) { return Simple . class ; } @ Override public String getTargetName ( ) { return "exporter" ; } @ Override protected Class < ? > getNormalModelType ( ) { return Simple . class ; } @ Override protected Class < ? > getErrorModelType ( ) { return DupCheck . class ; } @ Override protected String getNormalTableName ( ) { return "" ; } @ Override protected String getErrorTableName ( ) { return "" ; } @ Override protected String getErrorCodeValue ( ) { return "aaa" ; } @ Override protected String getErrorCodeColumnName ( ) { return "TEXT" ; } @ Override protected List < String > getCheckColumnNames ( ) { return Arrays . asList ( "NUMBER" ) ; } } ; @ Rule public H2Resource h2 = new H2Resource ( "exporter" ) { @ Override protected void before ( ) throws Exception { executeFile ( "" ) ; executeFile ( "" ) ; } } ; @ Rule public ConfigurationContext context = new ConfigurationContext (
223
<s> package org . rubypeople . rdt . ui . actions ; import org . eclipse . ui . IWorkbenchSite ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . core . IField ; import org . rubypeople . rdt . core . IImportDeclaration ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . ISourceFolder ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . search . IRubySearchScope ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . rubyeditor . RubyEditor ; import org . rubypeople . rdt . internal . ui . search . RubySearchScopeFactory ; import org . rubypeople . rdt . internal . ui . search . SearchMessages ; import org . rubypeople . rdt . ui . search
224
<s> package test . modelgen . table . model ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import javax . annotation . Generated ; import org . apache . hadoop . io . Text ; import org . apache . hadoop . io . Writable ; import com . asakusafw . runtime . value . DateTime ; import com . asakusafw . runtime . value . DateTimeOption ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . runtime . value . StringOption ; import com . asakusafw . vocabulary . model . DataModel ; import com . asakusafw . vocabulary . model . Property ; import com . asakusafw . vocabulary . model . TableModel ; @ Generated ( "" ) @ DataModel @ TableModel ( name = "" , columns = { "TEMP_SID" , "SID" , "VERSION_NO" , "RGST_DATE" , "UPDT_DATE" , "" , "TEXTDATA1" , "INTDATA1" , "DATEDATA1" } , primary = { "tempSid" } ) @ SuppressWarnings ( "deprecation" ) public class ExportTempImportTarget11 implements Writable { @ Property ( name = "TEMP_SID" ) private LongOption tempSid = new LongOption ( ) ; @ Property ( name = "SID" ) private LongOption sid = new LongOption ( ) ; @ Property ( name = "VERSION_NO" ) private LongOption versionNo = new LongOption ( ) ; @ Property ( name = "RGST_DATE" ) private DateTimeOption rgstDate = new DateTimeOption ( ) ; @ Property ( name = "UPDT_DATE" ) private DateTimeOption updtDate = new DateTimeOption ( ) ; @ Property ( name = "" ) private StringOption duplicateFlg = new StringOption ( ) ; @ Property ( name = "TEXTDATA1" ) private StringOption textdata1 = new StringOption ( ) ; @ Property ( name = "INTDATA1" ) private IntOption intdata1 = new IntOption ( ) ; @ Property ( name = "DATEDATA1" ) private DateTimeOption datedata1 = new DateTimeOption ( ) ; public long getTempSid ( ) { return this . tempSid . get ( ) ; } public void setTempSid ( long tempSid ) { this . tempSid . modify ( tempSid ) ; } public LongOption getTempSidOption ( ) { return this . tempSid ; } public void setTempSidOption ( LongOption tempSid ) { this . tempSid . copyFrom ( tempSid ) ; } public long getSid ( ) { return this . sid . get ( ) ; } public void setSid ( long sid ) { this . sid . modify ( sid ) ; } public LongOption getSidOption ( ) { return this . sid ; } public void setSidOption ( LongOption sid ) { this . sid . copyFrom ( sid ) ; } public long getVersionNo ( ) { return this . versionNo . get ( ) ; } public void setVersionNo ( long versionNo ) { this . versionNo . modify ( versionNo ) ; } public LongOption getVersionNoOption ( ) { return this . versionNo ; } public void setVersionNoOption ( LongOption versionNo ) { this . versionNo . copyFrom ( versionNo ) ; } public DateTime getRgstDate ( ) { return this . rgstDate . get ( ) ; } public void setRgstDate ( DateTime rgstDate ) { this . rgstDate . modify ( rgstDate ) ; } public DateTimeOption getRgstDateOption ( ) { return this . rgstDate ; } public void setRgstDateOption ( DateTimeOption rgstDate ) { this . rgstDate . copyFrom ( rgstDate ) ; } public DateTime getUpdtDate ( ) { return this . updtDate . get ( ) ; } public void setUpdtDate ( DateTime updtDate ) { this . updtDate . modify ( updtDate ) ; } public DateTimeOption getUpdtDateOption ( ) { return this . updtDate ; } public void setUpdtDateOption ( DateTimeOption updtDate ) { this . updtDate . copyFrom ( updtDate ) ; } public Text getDuplicateFlg ( ) { return this . duplicateFlg . get ( ) ; } public void setDuplicateFlg ( Text duplicateFlg ) { this . duplicateFlg . modify ( duplicateFlg ) ; } public String getDuplicateFlgAsString ( ) { return this . duplicateFlg . getAsString ( ) ; } public void setDuplicateFlgAsString ( String duplicateFlg ) { this . duplicateFlg . modify ( duplicateFlg ) ; } public StringOption getDuplicateFlgOption ( ) { return this . duplicateFlg ; } public void setDuplicateFlgOption ( StringOption duplicateFlg ) { this . duplicateFlg . copyFrom ( duplicateFlg ) ; } public Text getTextdata1 ( ) { return this . textdata1 . get ( ) ; } public void setTextdata1 ( Text textdata1 ) { this . textdata1 . modify ( textdata1 ) ; } public String getTextdata1AsString ( ) { return this . textdata1 . getAsString ( ) ; } public void setTextdata1AsString ( String textdata1 ) { this . textdata1 . modify ( textdata1 ) ; } public StringOption getTextdata1Option ( ) { return this . textdata1 ; } public void setTextdata1Option ( StringOption textdata1 ) { this . textdata1 . copyFrom ( textdata1 ) ; } public int getIntdata1 ( ) { return this . intdata1 . get ( ) ; } public void setIntdata1 ( int intdata1 ) { this . intdata1 . modify ( intdata1 ) ; } public IntOption getIntdata1Option ( ) { return this . intdata1 ; } public void setIntdata1Option ( IntOption intdata1 ) { this . intdata1 . copyFrom ( intdata1 ) ; } public DateTime getDatedata1 ( ) { return this . datedata1 . get ( ) ; } public void setDatedata1 ( DateTime datedata1 ) { this . datedata1 . modify ( datedata1 ) ; } public DateTimeOption getDatedata1Option ( ) { return this . datedata1 ; } public void setDatedata1Option ( DateTimeOption datedata1 ) { this . datedata1 . copyFrom ( datedata1 ) ; } public void copyFrom ( ExportTempImportTarget11 source ) { this . tempSid . copyFrom ( source . tempSid ) ; this . sid . copyFrom ( source . sid ) ; this . versionNo . copyFrom ( source . versionNo ) ; this . rgstDate . copyFrom ( source . rgstDate ) ; this . updtDate . copyFrom ( source . updtDate ) ; this . duplicateFlg . copyFrom
225
<s> package org . rubypeople . rdt . internal . debug . core . parsing ; import java . io . IOException ; import org . rubypeople . rdt . debug . core . RdtDebugCorePlugin ; import org . rubypeople . rdt . internal . debug . core . BreakpointSuspensionPoint ; import org . rubypeople . rdt . internal . debug . core . ExceptionSuspensionPoint ; import org . rubypeople . rdt . internal . debug . core . StepSuspensionPoint ; import org . rubypeople . rdt . internal . debug . core . SuspensionPoint ; import org . xmlpull . v1 . XmlPullParser ; import org . xmlpull . v1 . XmlPullParserException ; public class SuspensionReader extends XmlStreamReader { private SuspensionPoint suspensionPoint ; public SuspensionReader ( XmlPullParser xpp ) { super ( xpp ) ; } public SuspensionReader ( AbstractReadStrategy readStrategy ) { super ( readStrategy ) ; }
226
<s> package org . oddjob . describe ; import java . lang . annotation . ElementType ; import java . lang . annotation . Retention ; import java . lang . annotation . RetentionPolicy ; import java . lang .
227
<s> package org . rubypeople . rdt . refactoring . core . mergewithexternalclassparts ; import org . jruby . ast . Node ; import org . rubypeople . rdt . refactoring . core . NodeFactory ; import org . rubypeople . rdt . refactoring . editprovider . InsertEditProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . ClassNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . PartialClassNodeWrapper ; import org . rubypeople . rdt . refactoring . offsetprovider . AfterLastMethodInClassOffsetProvider ; public class ClassInsertProvider extends InsertEditProvider { Node classBody ; PartialClassNodeWrapper destinationClass ; public ClassInsertProvider ( Node classBody , PartialClassNodeWrapper classNodeWrapper ) { super ( true ) ; this . classBody = classBody ; this . destinationClass = classNodeWrapper ; } @ Override protected Node getInsertNode ( int offset , String document ) { boolean endNewLine = lastEditInGroup && ! isNextLineEmpty ( offset , document ) ; return
228
<s> package org . oddjob . monitor . view ; import java . awt . BorderLayout ; import java . awt . GridBagConstraints ; import java . awt . GridBagLayout ; import java . awt . Insets ; import java . util . Observable ; import java . util . Observer ; import javax . swing . JLabel ; import javax . swing . JPanel ; import javax . swing . JScrollPane ; import javax . swing . JTextArea ; import javax . swing . JTextField ; import javax . swing . SwingUtilities ; import org . oddjob . monitor . model . StateModel ; public class StatePanel extends JPanel implements Observer { private static final long serialVersionUID = 2005010100L ; private final JTextField stateField = new JTextField ( 20 ) ; private final JTextField timeField = new JTextField ( 20 ) ; private final JTextArea exceptionField = new JTextArea ( ) ; public StatePanel ( ) { stateField . setEditable ( false ) ; timeField . setEditable ( false ) ; exceptionField . setEditable ( false ) ; exceptionField . setLineWrap ( false ) ; JPanel main = new JPanel ( ) ; JLabel l1 = new JLabel ( "State" , JLabel . TRAILING ) ; JLabel l2 = new JLabel ( "Time" , JLabel . TRAILING ) ; JLabel l3 = new JLabel ( "Exception" , JLabel . TRAILING ) ; JScrollPane scl = new JScrollPane ( ) ; scl . setViewportView ( exceptionField ) ; main . setLayout ( new GridBagLayout ( ) ) ; GridBagConstraints c = new GridBagConstraints ( ) ; c . weightx = 0.0 ; c . weighty = 0.0 ; c . fill = GridBagConstraints . HORIZONTAL ; c . anchor = GridBagConstraints . NORTH ; c . insets = new Insets ( 3 , 15 , 3 , 5 ) ; c . gridx = 0 ; c . gridy = 0 ; main . add ( l1 , c ) ; c . gridx = 0 ; c . gridy = 1 ; main . add ( l2 , c ) ; c . gridx = 0 ; c . gridy = 2 ; main . add ( l3 , c ) ; c . insets = new Insets ( 3 , 5 , 3 , 5
229
<s> package com . asakusafw . modelgen . emitter ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . util . Arrays ; import java . util . List ; import org . hamcrest . Matcher ; import org . junit . Test ; public class JavaNameTest { @ Test public void snake_name_of ( ) { JavaName name = JavaName . of ( "snake_name" ) ; assertThat ( name . getSegments ( ) , contains ( "snake" , "name" ) ) ; } @ Test public void CONSTANT_NAME_OF ( ) { JavaName name = JavaName . of ( "" ) ; assertThat ( name . getSegments ( ) , contains ( "constant" , "name" ) ) ; } @ Test public void memberNameOf ( ) { JavaName name =
230
<s> package org . rubypeople . rdt . core . search ; import org . eclipse . core . resources . IResource ; import org . rubypeople . rdt . core . IRubyElement ; public class FieldReferenceMatch extends SearchMatch { private boolean isReadAccess ; private boolean isWriteAccess ; private IRubyElement binding ; public FieldReferenceMatch ( IRubyElement enclosingElement , IRubyElement binding , int accuracy , int offset , int length , boolean isReadAccess , boolean isWriteAccess , boolean insideDocComment , SearchParticipant participant , IResource resource ) { super ( enclosingElement , accuracy , offset , length , participant , resource ) ; this . binding = binding ; this . isReadAccess =
231
<s> package org . rubypeople . rdt . refactoring . ui ; import org . eclipse . jface . viewers . CheckStateChangedEvent ; import org . eclipse . jface . viewers . ICheckStateListener ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . ui . dialogs . ContainerCheckedTreeViewer ; public class NotifiedContainerCheckedTree extends ContainerCheckedTreeViewer { public NotifiedContainerCheckedTree ( Composite parent , ITreeContentProvider contentProvider , final IItemSelectionReceiver receiver ) { super ( parent ) ; this . setAutoExpandLevel ( 3
232
<s> package com . asakusafw . bulkloader . cache ; import java . sql . Connection ; import java . util . Arrays ; import java . util . List ; import com . asakusafw . bulkloader . common . BulkLoaderInitializer ; import com . asakusafw . bulkloader . common . Constants ; import com . asakusafw . bulkloader . common . DBConnection ; import com . asakusafw . bulkloader . exception . BulkLoaderSystemException ; import com . asakusafw . bulkloader . log . Log ; import com . asakusafw . runtime . core . context . RuntimeContext ; public class DeleteCacheInfo { static final Log LOG = new Log ( DeleteCacheInfo . class ) ; private static final List < String > PROPERTIES = Constants . PROPERTIES_DB ; public static void main ( String [ ] args ) { RuntimeContext . set ( RuntimeContext . DEFAULT . apply ( System . getenv ( ) ) ) ; if ( args . length < 2 ) { LOG . error ( "" , "-UNK-" , Arrays . toString ( args ) ) ; System . exit ( Constants . EXIT_CODE_ERROR ) ; return ; } String subCommandName = args [ 0 ] ; SubCommand subCommand = SubCommand . find ( subCommandName ) ; if ( subCommand == null ) { LOG . error ( "" , "" , Arrays . toString ( args ) ) ; System . exit ( Constants . EXIT_CODE_ERROR ) ; return ; } String targetName = args [ 1 ] ; if ( initialize ( subCommand , targetName ) == false ) { System . exit ( Constants . EXIT_CODE_ERROR ) ; } List < String > subArguments = Arrays . asList ( args ) . subList ( 2 , args . length ) ; int exitCode = new DeleteCacheInfo ( ) . execute ( subCommand , targetName , subArguments ) ; System . exit ( exitCode ) ; } private static boolean initialize ( SubCommand subCommand , String targetName ) { if ( ! BulkLoaderInitializer . initDBServer ( "" , subCommand . name ( ) , PROPERTIES , targetName ) ) { LOG . error ( "" , targetName ) ; return false ; } return true ; } public int execute ( SubCommand subCommand , String targetName , List < String > subArguments ) { if ( subCommand == null ) { throw new IllegalArgumentException ( "" ) ; } if ( targetName == null ) { throw new IllegalArgumentException ( "" ) ; } if ( subArguments == null ) { throw new IllegalArgumentException ( "" ) ; } if ( subCommand . arity != subArguments . size ( ) ) { LOG . error ( "" , "" , subArguments ) ; return Constants . EXIT_CODE_ERROR ; } try { Connection connection = DBConnection . getConnection ( ) ; try { LocalCacheInfoRepository repo = new LocalCacheInfoRepository ( connection ) ; if ( subCommand == SubCommand . CACHE ) { String cacheId = subArguments . get ( 0 ) ; LOG . info ( "" , targetName , cacheId ) ; boolean deleted ; if ( RuntimeContext . get ( ) . canExecute ( repo ) ) { deleted = repo . deleteCacheInfo ( cacheId ) ; } else { deleted = true ; } if ( deleted ) { LOG . info ( "" , targetName , cacheId ) ; } else { LOG . info ( "" , targetName , cacheId ) ; } } else if ( subCommand == SubCommand . TABLE ) { String tableName = subArguments . get ( 0 ) ; LOG . info ( "" , targetName , tableName ) ; int deleted ; if ( RuntimeContext . get ( ) . canExecute ( repo ) ) { deleted = repo . deleteTableCacheInfo ( tableName ) ; } else { deleted = 1 ; } if ( deleted > 0 ) { LOG . info ( "" , targetName , tableName , deleted ) ; } else { LOG . info ( "" , targetName , tableName ) ; } } else if ( subCommand == SubCommand . ALL ) { LOG . info ( "" , targetName ) ;
233
<s> package net . sf . sveditor . core . tests . job_mgr ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . job_mgr . IJob ; import net . sf . sveditor . core . job_mgr . JobMgr ; import junit . framework . TestCase ; import
234
<s> package net . sf . sveditor . core . db . expr ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db . SVDBItemType ; public class SVDBCrossBinsSelectConditionExpr extends SVDBExpr { public SVDBExpr fBinsExpr ; public List < SVDBExpr > fIntersectList ; public SVDBCrossBinsSelectConditionExpr ( ) { super ( SVDBItemType . CrossBinsSelectConditionExpr ) ; fIntersectList = new ArrayList < SVDBExpr > ( ) ; } public void setBinsExpr ( SVDBExpr expr ) { fBinsExpr = expr ; }
235
<s> package de . fuberlin . wiwiss . d2rq . values ; import java . util . Collections ; import java . util . List ; import java . util . Set ; import de . fuberlin . wiwiss . d2rq . algebra . ColumnRenamer ; import de . fuberlin . wiwiss . d2rq . algebra . ExpressionProjectionSpec ; import de . fuberlin . wiwiss . d2rq . algebra . OrderSpec ; import de . fuberlin . wiwiss . d2rq . algebra . ProjectionSpec ; import de . fuberlin . wiwiss . d2rq . expr . Equality ; import de . fuberlin . wiwiss . d2rq . expr . Expression ; import de . fuberlin . wiwiss . d2rq . nodes . NodeSetFilter ; import de . fuberlin . wiwiss . d2rq . sql . ResultRow ; public class SQLExpressionValueMaker implements ValueMaker { private final Expression expression ; private final ProjectionSpec projection ; public SQLExpressionValueMaker ( Expression expression ) { this . expression = expression ; this . projection = new ExpressionProjectionSpec ( expression ) ; } public void describeSelf ( NodeSetFilter c ) { c . limitValuesToExpression ( expression ) ; } public Set < ProjectionSpec > projectionSpecs ( ) { return Collections . singleton ( projection ) ; } public String makeValue ( ResultRow row ) { return row . get ( projection ) ; } public Expression valueExpression ( String value ) { return Equality . createExpressionValue ( expression , value ) ; } public ValueMaker renameAttributes ( ColumnRenamer renamer ) { return new SQLExpressionValueMaker ( renamer . applyTo ( expression ) ) ; } public List < OrderSpec > orderSpecs ( boolean ascending ) { return Collections . singletonList
236
<s> package org . rubypeople . rdt . refactoring . core . splitlocal ; import java . util . ArrayList ; import java . util . Collection ; import org . jruby . ast . AssignableNode ; import org . jruby . ast . DAsgnNode ; import org . jruby . ast . DVarNode ; import org . jruby . ast . IterNode ; import org . jruby . ast . LocalAsgnNode ; import org . jruby . ast . LocalVarNode ; import org . jruby . ast . Node ; import org . jruby . ast . types . INameNode ; import org . rubypeople . rdt . refactoring . core . NodeProvider ; import org . rubypeople . rdt . refactoring . core . SelectionNodeProvider ; import org . rubypeople . rdt . refactoring . core . inlinemethod . TargetClassFinder ; import org . rubypeople . rdt . refactoring . documentprovider . IDocumentProvider ; import org . rubypeople . rdt . refactoring . util . NodeUtil ; public class LocalVarFinder implements ILocalVarFinder { private Node enclosingMethod ; public Collection < LocalVarUsage > findLocalUsages ( IDocumentProvider doc , int caretPosition ) { Node rootNode = doc . getActiveFileRootNode ( ) ; INameNode selectedAssignment = findAssignment ( doc , caretPosition , rootNode ) ; if
237
<s> package com . asakusafw . testdriver . temporary ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . Set ; import org . apache . hadoop . conf . Configuration ; import org . apache . hadoop . fs . FileSystem ; import org . apache . hadoop . fs . Path ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . testing . TemporaryInputDescription ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . stage . temporary . TemporaryStorage ; import com . asakusafw . runtime . util . VariableTable ; import com . asakusafw . testdriver . core . BaseImporterPreparator ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . ImporterPreparator ; import com . asakusafw . testdriver . core . TestContext ; import com . asakusafw . testdriver . hadoop . ConfigurationFactory ; public class TemporaryInputPreparator extends BaseImporterPreparator < TemporaryInputDescription > { static final Logger LOG = LoggerFactory . getLogger ( TemporaryInputPreparator . class ) ; private final ConfigurationFactory configurations ; public TemporaryInputPreparator ( ) { this ( ConfigurationFactory . getDefault ( ) ) ; } public TemporaryInputPreparator ( ConfigurationFactory configurations ) { if ( configurations == null ) { throw new IllegalArgumentException ( "" ) ; } this . configurations = configurations ; } @ Override public void truncate ( TemporaryInputDescription description , TestContext context ) throws IOException { LOG . info ( "" , description ) ; VariableTable variables = createVariables ( context ) ; Configuration config = configurations . newInstance ( ) ; FileSystem fs = FileSystem .
238
<s> package com . asakusafw . testtools ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; public final class Constants { public static final int MAX_ROWS = 10000 ; private static final String [ ] ENV_PREFIX = { "ASAKUSA_" , "NS_" } ; public static final List < String > ENV_PROPERTIES = buildEnvProperties ( "" ) ; public static final List < String > ENV_BASE_PACKAGE = buildEnvProperties (
239
<s> package com . asakusafw . windgate . jdbc ; import java . sql . PreparedStatement ; import java . sql . ResultSet ; import java . util . List ; import com . asakusafw . windgate . core . vocabulary . DataModelJdbcSupport ; public class SupportWithPrivateConstructor implements DataModelJdbcSupport < Object > { private SupportWithPrivateConstructor ( ) { return ; } @ Override public Class < Object > getSupportedType ( ) { throw new UnsupportedOperationException ( ) ; } @ Override public boolean isSupported ( List < String > columnNames
240
<s> package org . rubypeople . rdt . internal . core ; import java . io . IOException ; import java . io . InputStream ; import java . net . URL ; import java . util . Properties ; import org . eclipse . core . runtime . FileLocator ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . Status ; import org . eclipse . core . runtime . jobs .
241
<s> package com . asakusafw . compiler . operator . processor ; import java . util . Collections ; import java . util . List ; import javax . lang . model . element . VariableElement ; import com . asakusafw . compiler . common . JavaName ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . common . TargetOperator ; import com . asakusafw . compiler . operator . AbstractOperatorProcessor ; import com . asakusafw . compiler . operator . ExecutableAnalyzer ; import com . asakusafw . compiler . operator . OperatorMethodDescriptor ; import com . asakusafw . compiler . operator . OperatorMethodDescriptor . Builder ; import com . asakusafw . vocabulary . operator . Branch ; @ TargetOperator ( Branch . class ) public class BranchOperatorProcessor extends AbstractOperatorProcessor { @ Override public OperatorMethodDescriptor describe ( Context context ) { Precondition . checkMustNotBeNull ( context , "context" ) ; ExecutableAnalyzer a = new ExecutableAnalyzer ( context . environment , context . element ) ; if ( a . isAbstract ( ) ) { a . error ( "" ) ; } List < VariableElement > constants = Collections . emptyList ( ) ; if ( a . getReturnType ( ) . isEnum ( ) == false ) { a . error ( "" ) ; } else { constants = a . getReturnType ( ) . getEnumConstants ( ) ; if ( constants . isEmpty ( ) ) { a . error ( "" ) ; } } if ( a . getParameterType ( 0 ) . isModel ( ) == false ) { a . error ( 0 , "" ) ; } for ( int i = 1 , n = a . countParameters ( ) ; i
242
<s> package com . asakusafw . utils . java . model . util ; import java . util . Arrays ; import java . util . Collections ; import java . util . List ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ExpressionStatement ; import com . asakusafw . utils . java . model . syntax . InfixOperator ; import com . asakusafw . utils . java . model . syntax . LocalVariableDeclaration ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . PostfixOperator ; import com . asakusafw . utils . java . model . syntax . ReturnStatement ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . ThrowStatement ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . UnaryOperator ; public class ExpressionBuilder { private ModelFactory f ; private Expression context ; public ExpressionBuilder ( ModelFactory factory , Expression context ) { if ( factory == null ) { throw new IllegalArgumentException ( "" ) ; } if ( context == null ) { throw new IllegalArgumentException ( "" ) ; } this . f = factory ; this . context = context ; } public ExpressionBuilder copy ( ) { return new ExpressionBuilder ( f , context ) ; } public Expression toExpression ( ) { return context ; } public ExpressionStatement toStatement ( ) { return f . newExpressionStatement ( toExpression ( ) ) ; } public ThrowStatement toThrowStatement ( ) { return f . newThrowStatement ( toExpression ( ) ) ; } public ReturnStatement toReturnStatement ( ) { return f . newReturnStatement ( toExpression ( ) ) ; } public LocalVariableDeclaration toLocalVariableDeclaration ( Type type , String name ) { if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } return toLocalVariableDeclaration ( type , f . newSimpleName ( name ) ) ; } public LocalVariableDeclaration toLocalVariableDeclaration ( Type type , SimpleName name ) { if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } return f . newLocalVariableDeclaration ( type , name , context ) ; } public ExpressionBuilder apply ( InfixOperator operator , Expression right ) { if ( operator == null ) { throw new IllegalArgumentException ( "" ) ; } if ( right == null ) { throw new IllegalArgumentException ( "" ) ; } return chain ( f . newInfixExpression ( context , operator , right ) ) ; } public ExpressionBuilder apply ( UnaryOperator operator ) { if ( operator == null ) { throw new IllegalArgumentException ( "" ) ; } return chain ( f . newUnaryExpression ( operator , context ) ) ; } public ExpressionBuilder apply ( PostfixOperator operator ) { if ( operator == null ) { throw new IllegalArgumentException ( "" ) ; } return chain ( f . newPostfixExpression ( context , operator ) ) ; } public ExpressionBuilder assignFrom ( Expression rightHandSide ) { if ( rightHandSide == null ) { throw new IllegalArgumentException ( "" ) ; } return assignFrom ( InfixOperator . ASSIGN , rightHandSide ) ; } public ExpressionBuilder assignFrom ( InfixOperator operator , Expression rightHandSide ) { if ( operator == null ) { throw new IllegalArgumentException ( "" ) ; } if ( rightHandSide == null ) { throw new IllegalArgumentException ( "" ) ; } return chain ( f . newAssignmentExpression ( context , operator , rightHandSide ) ) ; } public ExpressionBuilder castTo ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } return chain ( f . newCastExpression ( type , context ) ) ; } public ExpressionBuilder castTo ( java . lang . reflect . Type type ) { if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } return castTo ( Models . toType ( f , type ) ) ; } public ExpressionBuilder instanceOf ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } return chain ( f . newInstanceofExpression ( context , type ) ) ; } public ExpressionBuilder instanceOf ( java . lang . reflect . Type type ) { if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } return instanceOf ( Models . toType ( f , type ) ) ; } public ExpressionBuilder field ( String name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } return field ( f . newSimpleName ( name ) ) ; } public ExpressionBuilder field ( SimpleName name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } return chain ( f . newFieldAccessExpression ( context , name ) ) ; } public ExpressionBuilder array ( int index ) { return array ( Models . toLiteral ( f , index ) ) ; } public ExpressionBuilder array ( String index ) { if ( index == null ) { throw new IllegalArgumentException ( "" ) ; } return array ( Models . toName ( f , index ) ) ; } public ExpressionBuilder array ( Expression index ) { if ( index == null ) { throw new IllegalArgumentException ( "" ) ; } return chain ( f . newArrayAccessExpression ( context , index ) ) ; } public ExpressionBuilder method ( String name , Expression ... arguments ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } if ( arguments == null ) { throw new IllegalArgumentException ( "" ) ; } return method ( Collections . < Type > emptyList ( ) , name , Arrays . asList ( arguments ) ) ; } public ExpressionBuilder method ( List < ? extends Type > typeArguments , String name , Expression ... arguments ) { if ( typeArguments == null ) { throw new IllegalArgumentException ( "" ) ; } if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } if (
243
<s> package com . asakusafw . dmdl . model ; import java . util . List ; import com . asakusafw . dmdl . Region ; import com . asakusafw . utils . collections . Lists ; public class AstRecordDefinition extends AbstractAstNode implements AstRecord { private final Region region ; public final List < AstPropertyDefinition > properties ; public AstRecordDefinition ( Region region , List < AstPropertyDefinition > properties ) { this . region = region ; this . properties = Lists . freeze ( properties ) ; } @ Override public Region getRegion ( ) { return region ; } @ Override public AstRecord getUnit ( ) { return this ; } @ Override public
244
<s> package com . asakusafw . utils . java . jsr199 . testing ; import java . util . Set ; import javax . annotation . processing . Completion ; import javax . annotation . processing . ProcessingEnvironment ; import javax . annotation . processing . Processor ; import javax . annotation . processing . RoundEnvironment ; import javax . lang . model . SourceVersion ; import javax . lang . model . element . AnnotationMirror ; import javax . lang . model . element . Element ; import javax . lang . model . element . ExecutableElement ; import javax . lang . model . element . TypeElement ; public class SafeProcessor implements Processor { private Processor delegate ; private RuntimeException runtimeException ; private Error error ; public SafeProcessor ( Processor delegate ) { if ( delegate == null ) { throw new IllegalArgumentException ( "" ) ; } this . delegate = delegate ; } public void rethrow ( ) { if ( runtimeException != null ) { throw runtimeException ; } else if ( error != null ) { throw error ; } } @ Override public void init ( ProcessingEnvironment processingEnv ) { this . delegate . init ( processingEnv ) ; } @ Override public Set < String > getSupportedOptions ( ) { return this . delegate . getSupportedOptions ( ) ; } @ Override public Set < String > getSupportedAnnotationTypes ( ) { return this . delegate . getSupportedAnnotationTypes ( ) ; } @ Override public SourceVersion getSupportedSourceVersion ( ) { return this . delegate . getSupportedSourceVersion ( ) ; } @ Override public boolean process ( Set < ? extends TypeElement > annotations ,
245
<s> package de . fuberlin . wiwiss . d2rq ; import org . apache . log4j . Level ; import org . apache . log4j . Logger ; public class Log4jHelper { public static void turnLoggingOff ( ) { System . err . println ( "" ) ;
246
<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 . SimpleDesignProperty ; import org . oddjob . arooa . design . SimpleTextProperty ; import org . oddjob . arooa . design . screem . BorderedGroup ; import org . oddjob . arooa . design . screem . FieldSelection ; import org . oddjob . arooa .
247
<s> package net . sf . sveditor . ui . pref ; public class SVEditorPrefsConstants { public static final String P_DEFAULT_C = "" ; public static final String P_SL_COMMENT_C = "" ; public static final String P_ML_COMMENT_C = "" ; public static final String P_KEYWORD_C = "" ; public static final String P_STRING_C = "" ; public static final String P_DEFAULT_S = "" ; public static
248
<s> package org . rubypeople . rdt . internal . core . search . processing ; import org .
249
<s> package net . sf . sveditor . core . tests . content_assist ; import java . io . InputStream ; import java . util . HashSet ; import java . util . Set ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . index . AbstractSVDBIndex ; import net . sf . sveditor . core . db . index . ISVDBIndexChangeListener ; import net . sf . sveditor . core . db . index . ISVDBItemIterator ; import net . sf . sveditor . core . db . index . cache . InMemoryIndexCache ; import net . sf . sveditor . core . db . search . SVDBSearchResult ; import org . eclipse . core . runtime . IProgressMonitor ; public class ContentAssistIndex extends AbstractSVDBIndex { private SVDBFile fFile ; public ContentAssistIndex ( ) { super ( "GLOBAL" , "" , null , new InMemoryIndexCache ( ) , null ) ; }
250
<s> package net . sf . sveditor . ui . editor ; import org . eclipse . jface . text . rules . ICharacterScanner ; import org . eclipse . jface . text . rules . IPredicateRule ; import org . eclipse . jface . text . rules . IToken ; import org . eclipse . jface . text . rules . Token ; public class CCommentRule implements IPredicateRule { private IToken fToken ; public CCommentRule ( IToken tok ) { fToken = tok ; } public IToken evaluate ( ICharacterScanner scanner , boolean resume ) { boolean in_comment = resume ; if ( ! resume ) { if ( scanner . read ( ) == '/' ) { if ( scanner . read ( ) == '*' ) { in_comment = true ; } scanner . unread ( ) ; } else { scanner . unread ( ) ; } } if ( in_comment ) {
251
<s> package com . asakusafw . compiler . operator . processor ; import java . util . List ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . common . TargetOperator ; import com . asakusafw . compiler . operator . AbstractOperatorProcessor ; import com . asakusafw . compiler . operator . ExecutableAnalyzer ; import com . asakusafw . compiler . operator . ExecutableAnalyzer . TypeConstraint ; import com . asakusafw . compiler . operator . ImplementationBuilder ; import com . asakusafw . compiler . operator . OperatorMethodDescriptor ; import com . asakusafw . compiler . operator . OperatorMethodDescriptor . Builder ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . TypeBodyDeclaration ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . utils . java . model . util . TypeBuilder ; import com . asakusafw .
252
<s> package hudson . jbpm . model . gpd ; import java . awt . geom . Rectangle2D ; import java . util . List ; import com . thoughtworks . xstream . annotations . XStreamAlias ; import com . thoughtworks . xstream . annotations . XStreamAsAttribute ; import com . thoughtworks . xstream . annotations . XStreamImplicit ; @ XStreamAlias ( "node" ) public class Node { public void setName ( String name ) { this . name = name ; } public void setX ( int x ) { this . x = x ; } public void setY ( int y ) { this . y = y ; } public void setWidth ( int width ) { this . width = width ; } public void setHeight ( int height ) { this . height = height ; } public void setEdges ( List < Edge > edges ) { this . edges = edges ; } @ XStreamAsAttribute String name ; @ XStreamAsAttribute int x , y , width , height ; @ XStreamImplicit ( itemFieldName = "edge" ) public List < Edge > edges ; private transient NodeState state ; public NodeState getState ( ) { return state ; } public void setState ( NodeState state ) { this . state = state ; } public String getName ( ) { return name ; } public int getX ( ) { return x ; } public int getY
253
<s> package org . rubypeople . rdt . internal . ui . text . correction ; import java . io . StringWriter ; import java . util . ArrayList ; import java . util . Collection ; import java . util . HashSet ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . swt . graphics . Image ; import org . eclipse . ui . ISharedImages ; import org . jruby . ast . Node ; import org . jruby . lexer . yacc . ISourcePosition ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . compiler . IProblem ; import org . rubypeople . rdt . core . formatter . EditableFormatHelper ; import org . rubypeople . rdt . core . formatter . FormatHelper ; import org . rubypeople . rdt . core . formatter . ReWriteVisitor ; import org . rubypeople . rdt . core . formatter . ReWriterContext ; import org . rubypeople . rdt . internal . core . util . ASTUtil ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . ui . RubyUI ; import org . rubypeople . rdt . ui . text . correction . CorrectionProposal ; import org . rubypeople . rdt . ui . text . ruby . IInvocationContext ; import org . rubypeople . rdt . ui . text . ruby . IProblemLocation ; import org . rubypeople . rdt . ui . text . ruby . IQuickFixProcessor ; import org . rubypeople . rdt . ui . text . ruby . IRubyCompletionProposal ; public class QuickFixProcessor implements IQuickFixProcessor { public IRubyCompletionProposal [ ] getCorrections ( IInvocationContext context , IProblemLocation [ ] locations ) throws CoreException { if ( locations == null || locations . length == 0 ) { return null ; } HashSet < Integer > handledProblems = new HashSet < Integer > ( locations . length ) ; ArrayList < IRubyCompletionProposal > resultingCollections = new ArrayList < IRubyCompletionProposal > ( ) ; for ( int i = 0 ; i < locations . length ; i ++ ) { IProblemLocation curr = locations [ i ] ; Integer id = new Integer ( curr . getProblemId ( ) ) ; if ( handledProblems . add ( id ) ) { process ( context , curr , resultingCollections ) ; } } return ( IRubyCompletionProposal [ ] ) resultingCollections . toArray ( new IRubyCompletionProposal [ resultingCollections . size ( ) ] ) ; } private void process ( IInvocationContext context , IProblemLocation problem , Collection < IRubyCompletionProposal > proposals ) throws CoreException { int id = problem . getProblemId ( ) ; if ( id == 0 ) { return ; } switch ( id ) { case IProblem . UnusedPrivateMethod : case IProblem . UnusedPrivateField : case IProblem . LocalVariableIsNeverUsed : case IProblem . ArgumentIsNeverUsed : addUnusedMemberProposal ( context , problem , proposals ) ; break ; case IProblem . MultineCommentNotAtFirstColumn : addShiftMultilineCommentProposal ( context , problem , proposals ) ; break ; case IProblem . ParenthesizeArguments : addParenthesizeArgumentsProposal ( context , problem , proposals ) ; break ; case IProblem . HashCommaSyntax : addFixHashSyntaxProposal ( context , problem , proposals ) ; break ; case IProblem . ColonAfterWhenStatement : addFixWhenStatementProposal ( context , problem , proposals ) ; break ; default : addIgnoreWarningFix ( context , problem , proposals ) ; } } private void addFixWhenStatementProposal ( IInvocationContext context , IProblemLocation problem , Collection < IRubyCompletionProposal > proposals ) { String corrected = "then" ; Image image = RubyUI . getSharedImages ( ) . getImage ( org . rubypeople . rdt . ui . ISharedImages . IMG_OBJS_CORRECTION_CHANGE ) ; CorrectionProposal proposal = new CorrectionProposal ( corrected , problem . getOffset ( ) , 1 , image , "" , 100 ) ; proposals . add ( proposal ) ; } private void addFixHashSyntaxProposal ( IInvocationContext context , IProblemLocation problem , Collection < IRubyCompletionProposal > proposals ) { HashSyntaxCorrectionProposal proposal = new HashSyntaxCorrectionProposal ( context , problem , 100 ) ; proposals . add ( proposal ) ; } private void addIgnoreWarningFix ( IInvocationContext context , IProblemLocation problem , Collection < IRubyCompletionProposal > proposals ) { proposals . add ( new IgnoreWarningProposal ( context , problem ) ) ; } private void addParenthesizeArgumentsProposal ( IInvocationContext context , IProblemLocation problem , Collection < IRubyCompletionProposal > proposals ) throws RubyModelException { Image image = RubyPlugin . getDefault ( ) . getWorkbench ( ) . getSharedImages ( ) . getImage ( ISharedImages . IMG_TOOL_DELETE ) ; StringWriter out = new StringWriter ( ) ; String src = getSource ( context ) ; ReWriterContext config = new ReWriterContext ( out , getSource ( context ) , getFormatHelper ( ) ) ; ReWriteVisitor visitor = new ReWriteVisitor ( config ) ; Node covering = problem . getCoveredNode ( context . getASTRoot ( ) ) ; String corrected = ASTUtil . stringRepresentation ( covering ) + "(" ; ISourcePosition pos = covering . getPosition ( ) ; covering . accept ( visitor ) ; corrected += out . toString ( ) + ")n" ; CorrectionProposal proposal = new CorrectionProposal
254
<s> package org . rubypeople . rdt . refactoring . core . mergeclasspartsinfile ; import java . util . ArrayList ; import java . util . Collection ; import org . rubypeople . rdt . refactoring . classnodeprovider . IncludedClassesProvider ; import org . rubypeople . rdt . refactoring . core . IRefactoringConfig ; import org . rubypeople . rdt . refactoring . core . RefactoringConditionChecker ; import org . rubypeople . rdt . refactoring . nodewrapper . ClassNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . PartialClassNodeWrapper ; public class MergeClassPartsInFileConditionChecker extends RefactoringConditionChecker { private MergeClassPartInFileConfig config ; public MergeClassPartsInFileConditionChecker ( MergeClassPartInFileConfig config ) { super ( config ) ; } public void init ( IRefactoringConfig configObj ) { this . config = ( MergeClassPartInFileConfig ) configObj ; config . setClassNodeProvider ( new IncludedClassesProvider ( config . getDocumentProvider ( ) ) ) ; initSelectableClasses ( ) ; } private void initSelectableClasses ( ) { Collection < ClassNodeWrapper > selectableClasses = new ArrayList < ClassNodeWrapper > ( ) ; for ( ClassNodeWrapper currentClassNode : config . getAllClassNodes ( ) ) { if ( currentClassNode . getPartialClassNodesOfFile ( config . getDocumentProvider ( ) . getActiveFileName ( ) ) . size ( ) >= 2 ) selectableClasses . add ( currentClassNode ) ; } config . setSelectableClasses ( selectableClasses ) ; } @ Override protected
255
<s> package com . asakusafw . compiler . operator ; import java . text . MessageFormat ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import javax . lang . model . element . AnnotationMirror ; import javax . lang . model . element . AnnotationValue ; import javax . lang . model . element . Element ; import javax . lang . model . element . ElementKind ; import javax . lang . model . element . ExecutableElement ; import javax . lang . model . element . Modifier ; import javax . lang . model . element . TypeElement ; import javax . lang . model . element . VariableElement ; import javax . lang . model . type . DeclaredType ; import javax . lang . model . type . TypeKind ; import javax . lang . model . type . TypeMirror ; import javax . lang . model . util . Types ; import javax . tools . Diagnostic ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . compiler . operator . DataModelMirror . Kind ; import com . asakusafw . runtime . core . Result ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . utils . collections . Maps ; import com . asakusafw . utils . java . model . syntax . DocBlock ; import com . asakusafw . utils . java . model . syntax . DocElement ; 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 . SimpleName ; import com . asakusafw . utils . java . parser . javadoc . JavadocConverter ; import com . asakusafw . utils . java . parser . javadoc . JavadocParseException ; import com . asakusafw . vocabulary . flow . In ; import com . asakusafw . vocabulary . flow . Operator ; import com . asakusafw . vocabulary . flow . Out ; import com . asakusafw . vocabulary . flow . graph . ObservationCount ; import com . asakusafw . vocabulary . flow . graph . ShuffleKey ; import com . asakusafw . vocabulary . model . Joined ; import com . asakusafw . vocabulary . model . Key ; import com . asakusafw . vocabulary . model . Summarized ; import com . asakusafw . vocabulary . operator . Sticky ; import com . asakusafw . vocabulary . operator . Volatile ; public class ExecutableAnalyzer { final OperatorCompilingEnvironment environment ; final ExecutableElement executable ; final Javadoc documentation ; private boolean sawError ; public ExecutableAnalyzer ( OperatorCompilingEnvironment environment , ExecutableElement executable ) { Precondition . checkMustNotBeNull ( environment , "environment" ) ; Precondition . checkMustNotBeNull ( executable , "executable" ) ; this . environment = environment ; this . executable = executable ; this . documentation = getJavadoc ( environment , executable ) ; this . sawError = false ; } public void error ( String message , Object ... arguments ) { Precondition . checkMustNotBeNull ( message , "message" ) ; environment . getMessager ( ) . printMessage ( Diagnostic . Kind . ERROR , format ( message , arguments ) , executable ) ; sawError = true ; } public void error ( int parameterIndex , String message , Object ... arguments ) { Precondition . checkMustNotBeNull ( message , "message" ) ; if ( parameterIndex < 0 || parameterIndex >= executable . getParameters ( ) . size ( ) ) { error ( format ( message , arguments ) ) ; return ; } environment . getMessager ( ) . printMessage ( Diagnostic . Kind . ERROR , format ( message , arguments ) , executable . getParameters ( ) . get ( parameterIndex ) ) ; sawError = true ; } boolean typeEqual ( TypeMirror a , TypeMirror b ) { Types types = environment . getTypeUtils ( ) ; return types . isSameType ( a , b ) ; } boolean typeDeclEqual ( TypeMirror a , TypeMirror b ) { if ( a . getKind ( ) != TypeKind . DECLARED ) { return false ; } if ( b . getKind ( ) != TypeKind . DECLARED ) { return false ; } Types types = environment . getTypeUtils ( ) ; if ( types . isSameType ( a , b ) ) { return true ; } DeclaredType at = ( DeclaredType ) a ; DeclaredType bt = ( DeclaredType ) b ; return at . asElement ( ) . equals ( bt . asElement ( ) ) ; } private String format ( String message , Object ... arguments ) { if ( arguments == null || arguments . length == 0 ) { return message ; } else { return MessageFormat . format ( message , arguments ) ; } } public boolean hasError ( ) { return sawError ; } public boolean isAbstract ( ) { return executable . getModifiers ( ) . contains ( Modifier . ABSTRACT ) ; } public boolean isGeneric ( ) { return executable . getTypeParameters ( ) . isEmpty ( ) == false ; } public ObservationCount getObservationCount ( ObservationCount ... defaults ) { Precondition . checkMustNotBeNull ( defaults , "defaults" ) ; ObservationCount current = ObservationCount . DONT_CARE ; for ( ObservationCount oc : defaults ) { current = current . and ( oc ) ; } if ( current . atLeastOnce == false ) { if ( executable . getAnnotation ( Sticky . class ) != null ) { current = current . and ( ObservationCount . AT_LEAST_ONCE ) ; } } if ( current . atMostOnce == false ) { if ( executable . getAnnotation ( Volatile . class ) != null ) { current = current . and ( ObservationCount . AT_MOST_ONCE ) ; } } return current ; } public List < ? extends DocElement > getDocument ( Element element ) { Precondition . checkMustNotBeNull ( element , "element" ) ; Javadoc doc = getJavadoc ( environment , element ) ; return getAbstractBlock ( doc ) ; } private static Javadoc getJavadoc ( OperatorCompilingEnvironment environment , Element element ) { assert environment != null ; assert element != null ; ModelFactory f = environment . getFactory ( ) ; String comment = environment . getElementUtils ( ) . getDocComment ( element ) ; if ( comment == null ) { return f . newJavadoc ( Collections . < DocBlock > emptyList ( ) ) ; } if ( comment . startsWith ( "/**" ) == false ) { comment = "/**" + comment ; } if ( comment . endsWith ( "*/" ) == false ) { comment = comment + "*/" ; } try { return new JavadocConverter ( f ) . convert ( comment , 0 ) ; } catch ( JavadocParseException e ) { environment . getMessager ( ) . printMessage ( Diagnostic . Kind . ERROR , e . getMessage ( ) , element ) ; return f . newJavadoc ( Collections . < DocBlock > emptyList ( ) ) ; } } private static List < ? extends DocElement > getAbstractBlock ( Javadoc doc ) { assert doc != null ; List < ? extends DocBlock > blocks = doc . getBlocks ( ) ; if ( blocks . isEmpty ( ) ) { return Collections . emptyList ( ) ; } DocBlock first = blocks . get ( 0 ) ; if ( first . getTag ( ) . equals ( "" ) == false ) { return Collections . emptyList ( ) ; } return first . getElements ( ) ; } public int countParameters ( ) { return executable . getParameters ( ) . size ( ) ; } public TypeConstraint getReturnType ( ) { return new TypeConstraint ( executable . getReturnType ( ) ) ; } public TypeConstraint getParameterType ( int index ) { List < ? extends VariableElement > parameters = executable . getParameters ( ) ; if ( index >= parameters . size ( ) ) { return new TypeConstraint ( environment . getTypeUtils ( ) . getNoType ( TypeKind . NONE ) ) ; } return new TypeConstraint ( parameters . get ( index ) . asType ( ) ) ; } public String getParameterName ( int index ) { List < ? extends VariableElement > parameters = executable . getParameters ( ) ; String name = parameters . get ( index ) . getSimpleName ( ) . toString ( ) ; return name ; } public ShuffleKey getParameterKey ( int index ) { VariableElement parameter = executable . getParameters ( ) . get ( index ) ; TypeConstraint type = getParameterType ( index ) ; TypeConstraint arg = type . getTypeArgument ( ) ; if ( arg . exists ( ) ) { type = arg ; } DataModelMirror model = environment . loadDataModel ( type . getType ( ) ) ; if ( model == null ) { return null ; } return toShuffleKey ( index , model , findAnnotation ( parameter , environment . getDeclaredType ( Key . class ) ) ) ; } public List < ? extends DocElement > getExecutableDocument ( ) { Javadoc doc = documentation ; return getAbstractBlock ( doc ) ; } public List < ? extends DocElement > getParameterDocument ( int index ) { String name = getParameterName ( index ) ; for ( DocBlock block : documentation . getBlocks ( ) ) { if ( block . getTag ( ) . equals ( "@param" ) == false ) { continue ; } List < ? extends DocElement > elements = block . getElements ( ) ; if ( elements . isEmpty ( ) ) { continue ; } DocElement
256
<s> package com . asakusafw . dmdl . model ; import java . util . List ; import com . asakusafw . dmdl . Region ; import com . asakusafw . utils . collections . Lists ; public class AstUnionExpression < T extends AstTerm < T > > extends AbstractAstNode implements AstExpression < T > { private final Region region ; public final List < T > terms ; public AstUnionExpression ( Region region , List < ? extends T > terms
257
<s> package com . asakusafw . testdriver . bulkloader ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . sql . Connection ; import java . sql . DriverManager ; import java . sql . ResultSet ; import java . sql . Statement ; import java . util . List ; import org . junit . Rule ; import org . junit . Test ; public class H2ResourceTest { @ Rule public H2Resource h2 = new H2Resource ( "test" ) { @ Override protected void before ( ) throws Exception { execute ( "" + "" + "" + "" + ")" ) ; } } ; @ Test public void execute_resource ( ) throws Exception { h2 . execute ( "" ) ; List < List < Object > > results = h2 . query ( "" ) ; assertThat ( results . size ( ) , is ( 1 ) ) ; List < Object > columns = results . get ( 0 ) ; assertThat ( columns . size ( ) , is ( 2 ) ) ; assertThat (
258
<s> package com . asakusafw . vocabulary . operator ; import java . lang . annotation . Documented ; import java . lang . annotation . ElementType ; import java . lang . annotation . Retention ; import java . lang . annotation . RetentionPolicy ; import java . lang . annotation . Target ; import java . util . List ; import com . asakusafw . vocabulary . flow . processor . InputBuffer ; import com . asakusafw . vocabulary . model . Key ;
259
<s> package com . asakusafw . runtime . directio . util ; import java . io . IOException ; import java . io . InputStream ; import com . asakusafw . runtime . directio . Counter ; public class CountInputStream extends InputStream { private final InputStream target ; private final Counter counter ; public CountInputStream ( InputStream target , Counter counter ) { if ( target == null ) { throw new IllegalArgumentException ( "" ) ; } if ( counter == null ) { throw new IllegalArgumentException ( "" ) ; } this . target = target ; this . counter = counter ; } public long getCount ( ) { return counter . get ( ) ; } @ Override public int read ( ) throws IOException { int read = target . read ( ) ; if ( read > 0 ) { counter . add ( 1 ) ; } return read ; } @ Override public int read ( byte [ ] b ) throws IOException { int read = target . read ( b ) ; if ( read > 0 ) { counter . add ( read ) ; } return read ; } @ Override public int read ( byte [ ] b , int off , int len ) throws IOException { int read = target . read ( b , off , len ) ; if ( read > 0 ) { counter . add ( read ) ; } return read ; } @ Override public long skip ( long n ) throws IOException { long read = target . skip ( n ) ; return read ; } @ Override public int available (
260
<s> package com . asakusafw . dmdl . thundergate . util ; import com . asakusafw . dmdl . thundergate . model . ModelDescription ; import com . asakusafw . dmdl . thundergate . model . ModelReference ; public abstract class ModelBuilder < T extends ModelBuilder < T
261
<s> package org . rubypeople . rdt . internal . ui . workingsets ; import org . eclipse . jface . action . IMenuManager ; public interface IWorkingSetActionGroup { public static final String ACTION_GROUP = "" ; public void fillViewMenu ( IMenuManager
262
<s> package org . oddjob . framework ; import java . io . File ; import java . net . MalformedURLException ; import java . util . concurrent . Callable ; import junit . framework . TestCase ; import org . oddjob . Helper ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . OurDirs ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . state . JobState ; import org . oddjob . state . ParentState ; import org . oddjob . util . URLClassLoaderType ; import org . oddjob . util . URLClassLoaderTypeTest ; public class CallableWrapperTest extends TestCase { public static class OurCallable implements Callable < Integer > { boolean ran ; int status ; public Integer call ( ) { ran = true ; return new Integer ( status ) ; } public boolean isRan ( ) { return ran ; } public void setStatus ( int status ) { this . status = status ; } public String toString ( ) { return "OurCallable" ; } } public void testInOddjob ( ) throws Exception { String xml = "<oddjob>" + " <job>" + "" + OurCallable . class . getName ( ) + "' id='r' />" + " </job>" + "</oddjob>" ; Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; oddjob . run ( ) ; OddjobLookup lookup = new OddjobLookup ( oddjob ) ; Object runnable = lookup . lookup ( "r" ) ; assertEquals ( JobState . COMPLETE , Helper . getJobState ( runnable ) ) ; Boolean ran = lookup . lookup ( "r.ran" , Boolean . class ) ; assertEquals ( new Boolean ( true ) , ran ) ; oddjob . destroy ( ) ; } public void testIncompleteInOddjob ( ) throws Exception { String xml = "<oddjob>" + " <job>" + "" + OurCallable . class . getName ( ) + "" + " </job>" + "</oddjob>" ; Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; oddjob . run ( ) ; OddjobLookup lookup = new OddjobLookup ( oddjob ) ; Object runnable = lookup . lookup ( "r" ) ; assertEquals ( JobState . INCOMPLETE , Helper . getJobState ( runnable ) ) ; Boolean ran = lookup . lookup ( "r.ran" , Boolean . class ) ; assertEquals ( new Boolean ( true ) , ran ) ; oddjob . destroy ( ) ; } public static class OurCallable2 implements Callable < Void > { boolean ran ; public Void call ( ) { ran = true ; return null ; } public boolean isRan ( ) { return ran ; } public String toString ( ) { return "OurCallable" ; } } public void testVoidCallableInOddjob ( ) throws Exception { String xml = "<oddjob>" + " <job>" + "" + OurCallable2 . class . getName ( ) + "' id='r' />" + " </job>" + "</oddjob>" ; Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; oddjob . run ( ) ; OddjobLookup lookup = new OddjobLookup ( oddjob ) ; Object runnable = lookup . lookup ( "r" ) ; assertEquals ( JobState . COMPLETE , Helper . getJobState ( runnable ) ) ; Boolean ran = lookup . lookup ( "r.ran" , Boolean . class ) ; assertEquals ( new Boolean ( true ) , ran ) ; oddjob . destroy ( ) ; } public static class BadCallable implements Callable < Void > { public Void call ( ) throws Exception { throw new Exception ( "" ) ; } public String toString ( ) { return "OurCallable" ; } } public void testExceptionInOddjob ( )
263
<s> package com . asakusafw . yaess . core ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Collection ; import java . util . Collections ; import java . util . Comparator ; import java . util . EnumMap ; import java . util . Iterator ; import java . util . LinkedHashSet ; import java . util . List ; import java . util . Map ; import java . util . NavigableMap ; import java . util . Properties ; import java . util . Set ; import java . util . TreeMap ; import java . util . TreeSet ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . yaess . core . util . PropertiesUtil ; public final class FlowScript { static final Logger LOG = LoggerFactory . getLogger ( FlowScript . class ) ; public static final String KEY_FLOW_PREFIX = "flow." ; public static final String KEY_ID = "id" ; public static final String KEY_BLOCKERS = "blockerIds" ; public static final String KEY_KIND = "kind" ; public static final String KEY_CLASS_NAME = "class" ; public static final String KEY_PROFILE = "profile" ; public static final String KEY_MODULE = "module" ; public static final String KEY_ENV_PREFIX = "env." ; private static final String KEY_COMMAND_PREFIX = "command." ; private static final String KEY_PROP_PREFIX = "prop." ; private static final Comparator < ExecutionScript > SCRIPT_COMPARATOR = new Comparator < ExecutionScript > ( ) { @ Override public int compare ( ExecutionScript o1 , ExecutionScript o2 ) { return o1 . getId ( ) . compareTo ( o2 . getId ( ) ) ; } } ; private final String id ; private final Set < String > blockerIds ; private final Map < ExecutionPhase , Set < ExecutionScript > > scripts ; public FlowScript ( String id , Set < String > blockerIds , Map < ExecutionPhase , ? extends Collection < ? extends ExecutionScript > > scripts ) { if ( id == null ) { throw new IllegalArgumentException ( "" ) ; } if ( id . indexOf ( '.' ) >= 0 ) { throw new IllegalArgumentException ( "" ) ; } if ( blockerIds == null ) { throw new IllegalArgumentException ( "" ) ; } if ( scripts == null ) { throw new IllegalArgumentException ( "" ) ; } this . id = id ; this . blockerIds = Collections . unmodifiableSet ( new LinkedHashSet < String > ( blockerIds ) ) ; EnumMap < ExecutionPhase , Set < ExecutionScript > > map = new EnumMap < ExecutionPhase , Set < ExecutionScript > > ( ExecutionPhase . class ) ; for ( ExecutionPhase phase : ExecutionPhase . values ( ) ) { if ( scripts . containsKey ( phase ) ) { TreeSet < ExecutionScript > set = new TreeSet < ExecutionScript > ( SCRIPT_COMPARATOR ) ; set . addAll ( scripts . get ( phase ) ) ; if ( set . size ( ) != scripts . get ( phase ) . size ( ) ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , id , phase ) ) ; } map . put ( phase , Collections . unmodifiableSet ( set ) ) ; } else { map . put ( phase , Collections . < ExecutionScript > emptySet ( ) ) ; } } this . scripts = Collections . unmodifiableMap ( map ) ; } public String getId ( ) { return id ; } public Set < String > getBlockerIds ( ) { return blockerIds ; } public Map < ExecutionPhase , Set < ExecutionScript > > getScripts ( ) { return scripts ; } private static String getPrefix ( String flowId ) { assert flowId != null ; return KEY_FLOW_PREFIX + flowId + '.' ; } private static String getPrefix ( String flowId , ExecutionPhase phase ) { assert flowId != null ; assert phase != null ; return getPrefix ( flowId ) + phase . getSymbol ( ) + '.' ; } private static String getPrefix ( String flowId , ExecutionPhase phase , String nodeId ) { assert flowId != null ; assert phase != null ; assert nodeId != null ; return getPrefix ( flowId , phase ) + nodeId + '.' ; } public static FlowScript load ( Properties properties , String flowId ) { if ( properties == null ) { throw new IllegalArgumentException ( "" ) ; } if ( flowId == null ) { throw new IllegalArgumentException ( "" ) ; } String prefix = getPrefix ( flowId ) ; LOG . debug ( "" , prefix ) ; NavigableMap < String , String > flowMap = PropertiesUtil . createPrefixMap ( properties , prefix ) ; String blockersString = extract ( flowMap , prefix , KEY_BLOCKERS ) ; Set < String > blockerIds = parseTokens ( blockersString ) ; EnumMap < ExecutionPhase , List < ExecutionScript > > scripts = new EnumMap < ExecutionPhase , List < ExecutionScript > > ( ExecutionPhase . class ) ; for ( ExecutionPhase phase : ExecutionPhase . values ( ) ) { scripts . put ( phase , Collections . < ExecutionScript > emptyList ( ) ) ; } int count = 0 ; Map < String , NavigableMap < String , String > > phaseMap = partitioning ( flowMap ) ; for ( Map . Entry < String , NavigableMap < String , String > > entry : phaseMap . entrySet ( ) ) { String phaseSymbol = entry . getKey ( ) ; NavigableMap < String , String > phaseContents = entry . getValue ( ) ; ExecutionPhase phase = ExecutionPhase . findFromSymbol ( phaseSymbol ) ; if ( phase == null ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , flowId , phaseSymbol ) ) ; } List < ExecutionScript > scriptsInPhase = loadScripts ( flowId , phase , phaseContents ) ; scripts . put ( phase , scriptsInPhase ) ; count += scriptsInPhase . size ( ) ; } FlowScript script = new FlowScript ( flowId , blockerIds , scripts ) ; LOG . debug ( "" , count , prefix ) ; LOG . trace ( "" , prefix , script ) ; return script ; } public static Set < ExecutionScript > load ( Properties properties , String flowId , ExecutionPhase phase ) { if ( properties == null ) { throw new IllegalArgumentException ( "" ) ; } if ( flowId == null ) { throw new IllegalArgumentException ( "" ) ; } if ( phase == null ) { throw new IllegalArgumentException ( "" ) ; } String prefix = getPrefix ( flowId , phase ) ; LOG . debug ( "" , prefix ) ; Set < String > availableFlowIds = extractFlowIds ( properties ) ; if ( availableFlowIds . contains ( flowId ) == false ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , flowId ) ) ; } NavigableMap < String , String > contents = PropertiesUtil . createPrefixMap ( properties , prefix ) ; List < ExecutionScript > scripts = loadScripts ( flowId , phase , contents ) ; LOG . debug ( "" , scripts . size ( ) , prefix ) ; LOG . trace ( "" , prefix , scripts ) ; TreeSet < ExecutionScript > results = new TreeSet < ExecutionScript > ( SCRIPT_COMPARATOR ) ; results . addAll ( scripts ) ; return results ; } private static List < ExecutionScript > loadScripts ( String flowId , ExecutionPhase phase , NavigableMap < String , String > contents ) { assert flowId != null ; assert phase != null ; assert contents != null ; if ( contents . isEmpty ( ) ) { return Collections . emptyList ( ) ; } List < ExecutionScript > results = new ArrayList < ExecutionScript > ( ) ; Map < String , NavigableMap < String , String > > scripts = partitioning ( contents ) ; for ( Map . Entry < String , NavigableMap < String , String > > entry : scripts . entrySet ( ) ) { String scriptId = entry . getKey ( ) ; NavigableMap < String , String > scriptContents = entry . getValue ( ) ; ExecutionScript script = loadScript ( flowId , phase , scriptId , scriptContents ) ; results . add ( script ) ; } checkBlockers ( flowId , phase , results ) ; return results ; } private static void checkBlockers ( String flowId , ExecutionPhase phase , List < ExecutionScript > scripts ) { assert flowId != null ; assert phase != null ; assert scripts != null ; } private static ExecutionScript loadScript ( String flowId , ExecutionPhase phase , String nodeId , Map < String , String > contents ) { assert flowId != null ; assert phase != null ; assert nodeId != null ; assert contents != null ; String prefix = getPrefix ( flowId , phase , nodeId ) ; String scriptId = extract ( contents , prefix , KEY_ID ) ; String kindSymbol = extract ( contents , prefix , KEY_KIND ) ; ExecutionScript . Kind kind = ExecutionScript . Kind . findFromSymbol ( kindSymbol ) ; String blockersString = extract ( contents , prefix , KEY_BLOCKERS ) ; Set < String > blockers = parseTokens ( blockersString ) ; Map < String , String > environmentVariables = PropertiesUtil . createPrefixMap ( contents , KEY_ENV_PREFIX ) ; ExecutionScript script ; if ( kind == ExecutionScript . Kind . COMMAND ) { String profileName = extract ( contents , prefix , KEY_PROFILE ) ; String moduleName = extract ( contents , prefix , KEY_MODULE ) ; NavigableMap < String , String > commandMap = PropertiesUtil . createPrefixMap ( contents , KEY_COMMAND_PREFIX ) ; if ( commandMap . isEmpty ( ) ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , prefix + KEY_COMMAND_PREFIX ) ) ; } List < String > command = new ArrayList < String > ( commandMap . values ( ) ) ; script = new CommandScript ( scriptId , blockers , profileName , moduleName , command , environmentVariables ) ; } else if ( kind == ExecutionScript . Kind . HADOOP ) { String className = extract ( contents , prefix , KEY_CLASS_NAME ) ; Map < String , String > properties = PropertiesUtil . createPrefixMap ( contents , KEY_PROP_PREFIX ) ; script = new HadoopScript ( scriptId , blockers , className , properties , environmentVariables ) ; } else { throw new IllegalArgumentException ( MessageFormat . format ( "" , prefix + KEY_KIND , kindSymbol ) ) ; } LOG . trace ( "" , script ) ; return script ; } private static String extract ( Map < String , String > contents , String prefix , String key ) { assert contents != null ; assert prefix != null ; assert key != null ; String kindSymbol = contents . remove ( key ) ; if ( kindSymbol == null ) { throw new IllegalArgumentException ( MessageFormat . format ( "" , prefix + key ) ) ; } return kindSymbol ; } private static Map < String , NavigableMap < String , String > > partitioning ( NavigableMap < String , String > map ) { assert map != null ; Map < String , NavigableMap < String , String > > results = new TreeMap < String , NavigableMap < String , String > > ( ) ; while ( map . isEmpty ( ) == false ) { String name = map . firstKey ( ) ; int index = name . indexOf ( '.' ) ; if ( index >= 0 ) { name = name . substring ( 0 , index ) ; } String
264
<s> package net . bioclipse . opentox . qsar ; import org . apache . log4j . Logger ; import java . util . ArrayList ; import java . util . List ; import net . bioclipse . core . business . BioclipseException ; import net . bioclipse . core . domain . IStringMatrix ; import net . bioclipse . opentox . Activator ; import net . bioclipse . opentox . business . IOpentoxManager ; import net . bioclipse . qsar . descriptor . IDescriptorCalculator ; import net . bioclipse . qsar . descriptor . model . DescriptorImpl ; import net . bioclipse . qsar . descriptor . model . DescriptorProvider ; import net . bioclipse . qsar . discovery . IDiscoveryService ; public class OpenToxProviderDiscovery implements IDiscoveryService { private static final Logger logger = Logger . getLogger ( OpenToxProviderDiscovery . class ) ; private static List < OpenToxProvider > providers ; @ Override public String getName ( ) { return "OpenTox" ; } @ Override public List < DescriptorProvider > discoverProvidersAndImpls ( ) { List < DescriptorProvider > returnList = new ArrayList < DescriptorProvider > ( ) ; IOpentoxManager opentox = Activator . getDefault ( ) . getJavaOpentoxManager ( ) ; logger . debug ( "" ) ; providers = discoverProviders ( ) ; for ( OpenToxProvider provider : providers ) { logger . debug ( "" + provider . name ) ; } for ( OpenToxProvider provider : providers ) { DescriptorProvider dp = new DescriptorProvider ( provider . getId ( ) , provider . getName ( ) ) ; dp . setShortName ( provider . getName ( ) ) ; IDescriptorCalculator calculator = new OpenToxDescriptorCalculator ( provider . getId ( ) , provider . getService ( ) ) ; dp . setCalculator ( calculator ) ; List < DescriptorImpl > impls = new ArrayList < DescriptorImpl > ( ) ; logger . debug ( "" + provider . getService ( ) ) ; IStringMatrix stringMat ; try { stringMat = opentox . listDescriptors ( provider . getServiceSPARQL ( ) ) ; } catch ( BioclipseException e ) { e . printStackTrace ( ) ; return returnList ; } for ( int i = 0 ; i < stringMat . getRowCount ( ) ; i ++ ) { String implID = stringMat . get ( i , 1 ) ; String bodo = stringMat . get ( i , 2 ) ; String implName = "" ; if ( bodo . length ( ) > 4 ) implName = bodo . substring ( bodo . indexOf ( "#" ) + 1 ) ; if ( implID == null || implID . length ( ) < 1 ) { logger . error ( "" + implID + ", " + bodo + ", " + ", " + implName ) ; }
265
<s> package org . rubypeople . rdt . internal . ui . dnd ; import org . eclipse . core . runtime . SafeRunner ; import org . eclipse . swt . dnd . DND ; import org . eclipse . swt . dnd . DropTargetEvent ; import org . eclipse . swt . dnd . DropTargetListener ; import org . eclipse . swt . dnd . Transfer ; import org . eclipse . swt . dnd . TransferData ; import org . eclipse . jface . util . Assert ; import org . eclipse . jface . util . SafeRunnable ; import org . eclipse . jface . util . TransferDropTargetListener ; public class DelegatingDropAdapter implements DropTargetListener { private TransferDropTargetListener [ ] fListeners ; private TransferDropTargetListener fCurrentListener ; private int fOriginalDropType ; public DelegatingDropAdapter ( TransferDropTargetListener [ ] listeners ) { Assert . isNotNull ( listeners ) ; fListeners = listeners ; } public void dragEnter ( DropTargetEvent event ) { fOriginalDropType = event . detail ; updateCurrentListener ( event ) ; } public void dragLeave ( final DropTargetEvent event ) { setCurrentListener ( null , event ) ; } public void dragOperationChanged ( final DropTargetEvent event ) { fOriginalDropType = event . detail ; TransferDropTargetListener oldListener = getCurrentListener ( ) ; updateCurrentListener ( event ) ; final TransferDropTargetListener newListener = getCurrentListener ( ) ; if ( newListener != null && newListener == oldListener ) { SafeRunner . run ( new SafeRunnable ( ) { public void run ( ) throws Exception { newListener . dragOperationChanged ( event ) ; } } ) ; } } public void dragOver ( final DropTargetEvent event ) { TransferDropTargetListener oldListener = getCurrentListener ( ) ;
266
<s> package com . asakusafw . testdriver . core ; import java . io . IOException ; import java . net . URI ; import java . util . List ; import java . util . ServiceLoader ; public class SpiDifferenceSinkProvider implements DifferenceSinkProvider { private final List < DifferenceSinkProvider > elements ; public SpiDifferenceSinkProvider ( ClassLoader serviceClassLoader ) { if ( serviceClassLoader == null ) { throw new IllegalArgumentException ( "" ) ; } this
267
<s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . ExportTempTable ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public final class ExportTempTableModelOutput implements
268
<s> package org . oddjob . jmx . server ; import java . io . FileInputStream ; import java . io . IOException ; import java . security . AccessControlContext ; import java . security . AccessController ; import java . security . Principal ; import java . security . PrivilegedAction ; import java . util . Collection ; import java . util . Iterator ; import java . util . Properties ; import java . util . Set ; import javax . management . MBeanOperationInfo ; import javax . management . MBeanServer ; import javax . security . auth . Subject ; public class OddjobJMXFileAccessController implements OddjobJMXAccessController { public static final String READONLY = "readonly" ; public static final String READWRITE = "readwrite" ; public OddjobJMXFileAccessController ( String accessFileName ) throws IOException { super ( ) ; this . accessFileName = accessFileName ; props = propertiesFromFile ( accessFileName ) ; checkValues ( props ) ; } public OddjobJMXFileAccessController ( Properties accessFileProps ) throws IOException { super ( ) ; if ( accessFileProps == null ) throw new IllegalArgumentException ( "" ) ; originalProps = accessFileProps ; props = ( Properties ) accessFileProps . clone ( ) ; checkValues ( props ) ; } @ Override public boolean isAccessable ( MBeanOperationInfo opInfo ) { if ( opInfo . getImpact ( ) == MBeanOperationInfo . INFO ) { return checkAccessLevel ( READONLY ) ; } else { return checkAccessLevel ( READWRITE ) ; } } public void refresh ( ) throws IOException { synchronized ( props ) { if ( accessFileName == null ) props = ( Properties ) originalProps . clone ( ) ; else props = propertiesFromFile ( accessFileName ) ; checkValues ( props ) ; } } private static Properties propertiesFromFile ( String fname ) throws IOException { FileInputStream fin = new FileInputStream ( fname ) ; Properties p = new Properties ( ) ; p . load ( fin ) ; fin . close ( ) ; return p ; } private boolean checkAccessLevel ( String accessLevel ) { final AccessControlContext acc = AccessController . getContext ( ) ; final Subject s = ( Subject ) AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { return Subject . getSubject ( acc ) ; } } ) ; if ( s == null ) return true ; final Set < Principal > principals = s . getPrincipals ( ) ; for ( Iterator < Principal > i = principals . iterator ( ) ; i . hasNext ( ) ; ) { final Principal p = ( Principal ) i . next ( ) ; String grantedAccessLevel ; synchronized ( props ) { grantedAccessLevel = props . getProperty ( p . getName ( ) ) ; } if ( grantedAccessLevel != null ) { if ( accessLevel
269
<s> package com . mcbans . firestar . mcbans . bukkitListeners ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . net . URL ; import java . net . URLEncoder ; import com . mcbans . firestar . mcbans . BukkitInterface ; import com . mcbans . firestar . mcbans . pluginInterface . Connect ; import com . mcbans . firestar . mcbans . pluginInterface . Disconnect ; import org . bukkit . entity . Player ; import org . bukkit . event . EventHandler ; import org . bukkit . event . EventPriority ; import org . bukkit . event . Listener ; import org . bukkit . event . player . AsyncPlayerPreLoginEvent ; import org . bukkit . event . player . PlayerJoinEvent ; import org . bukkit . event . player . PlayerPreLoginEvent . Result ; import org . bukkit . event . player . PlayerQuitEvent ; public class PlayerListener implements Listener { private BukkitInterface MCBans ; public PlayerListener ( BukkitInterface plugin ) { MCBans = plugin ; } @ EventHandler ( priority =
270
<s> package com . asakusafw . compiler . operator . io ; import java . io . IOException ; import com . asakusafw . compiler . operator . model . MockFoo ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; public final class MockFooOutput implements ModelOutput < MockFoo > { private final RecordEmitter emitter ; public MockFooOutput ( RecordEmitter emitter ) { if ( emitter == null ) { throw new IllegalArgumentException ( ) ; } this . emitter = emitter ; } @ Override public void write ( MockFoo model ) throws IOException { emitter . emit ( model .
271
<s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths ; import java . lang . reflect . InvocationTargetException ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import java . util . Map . Entry ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . resources . IWorkspaceRunnable ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . KeyEvent ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . preferences . IWorkbenchPreferenceContainer ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . actions . WorkbenchRunnableAdapter ; import org . rubypeople . rdt . internal . ui . util . ExceptionHandler ; import org . rubypeople . rdt . internal . ui . util . PixelConverter ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . CheckedListDialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . DialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . IDialogFieldListener ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . ITreeListAdapter ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . LayoutUtil ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . ListDialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . TreeListDialogField ; import org . rubypeople . rdt . ui . wizards . BuildPathDialogAccess ; public class LibrariesWorkbookPage extends BuildPathBasePage { private ListDialogField fClassPathList ; private IRubyProject fCurrJProject ; private TreeListDialogField fLibrariesList ; private Control fSWTControl ; private final int IDX_ADDEXT = 0 ; private final int IDX_ADDVAR = 1 ; private final int IDX_EDIT = 3 ; private final int IDX_REMOVE = 4 ; public LibrariesWorkbookPage ( CheckedListDialogField classPathList , IWorkbenchPreferenceContainer pageContainer ) { fClassPathList = classPathList ; fSWTControl = null ; String [ ] buttonLabels = new String [ ] { NewWizardMessages . LibrariesWorkbookPage_libraries_addextjar_button , NewWizardMessages . LibrariesWorkbookPage_libraries_addvariable_button , null , NewWizardMessages . LibrariesWorkbookPage_libraries_edit_button , NewWizardMessages . LibrariesWorkbookPage_libraries_remove_button , } ; LibrariesAdapter adapter = new LibrariesAdapter ( ) ; fLibrariesList = new TreeListDialogField ( adapter , buttonLabels , new CPListLabelProvider ( ) ) ; fLibrariesList . setDialogFieldListener ( adapter ) ; fLibrariesList . setLabelText ( NewWizardMessages . LibrariesWorkbookPage_libraries_label ) ; fLibrariesList . enableButton ( IDX_REMOVE , false ) ; fLibrariesList . enableButton ( IDX_EDIT , false ) ; fLibrariesList . setViewerSorter ( new CPListElementSorter ( ) ) ; } public void init ( IRubyProject jproject ) { fCurrJProject = jproject ; updateLibrariesList ( ) ; } private void updateLibrariesList ( ) { List cpelements = fClassPathList . getElements ( ) ; List libelements = new ArrayList ( cpelements . size ( ) ) ; int nElements = cpelements . size ( ) ; for ( int i = 0 ; i < nElements ; i ++ ) { CPListElement cpe = ( CPListElement ) cpelements . get ( i ) ; if ( isEntryKind ( cpe . getEntryKind ( ) ) ) { libelements . add ( cpe ) ; } } fLibrariesList . setElements ( libelements ) ; } public Control getControl ( Composite parent ) { PixelConverter converter = new PixelConverter ( parent ) ; Composite composite = new Composite ( parent , SWT . NONE ) ; LayoutUtil . doDefaultLayout ( composite , new DialogField [ ] { fLibrariesList } , true , SWT . DEFAULT , SWT . DEFAULT ) ; LayoutUtil . setHorizontalGrabbing ( fLibrariesList . getTreeControl ( null ) ) ; int buttonBarWidth = converter . convertWidthInCharsToPixels ( 24 ) ; fLibrariesList . setButtonsMinWidth ( buttonBarWidth ) ; fLibrariesList . getTreeViewer ( ) . setSorter ( new CPListElementSorter ( ) ) ; fSWTControl = composite ; return composite ; } private Shell getShell ( ) { if ( fSWTControl != null ) { return fSWTControl . getShell ( ) ; } return RubyPlugin . getActiveWorkbenchShell ( ) ; } private class LibrariesAdapter implements IDialogFieldListener , ITreeListAdapter { private final Object [ ] EMPTY_ARR = new Object [ 0 ] ; public void customButtonPressed ( TreeListDialogField field , int index ) { libaryPageCustomButtonPressed ( field , index ) ; } public void selectionChanged ( TreeListDialogField field ) { libaryPageSelectionChanged ( field ) ; } public void doubleClicked ( TreeListDialogField field ) { libaryPageDoubleClicked ( field ) ; } public void keyPressed ( TreeListDialogField field , KeyEvent event ) { libaryPageKeyPressed ( field , event ) ; } public Object [ ] getChildren ( TreeListDialogField field , Object element ) { if ( element instanceof CPListElement ) { return ( ( CPListElement ) element ) . getChildren ( false ) ; } return EMPTY_ARR ; } public Object getParent ( TreeListDialogField field , Object element ) { if ( element instanceof CPListElementAttribute ) { return ( ( CPListElementAttribute ) element ) . getParent ( ) ; } return null ; } public boolean hasChildren ( TreeListDialogField field , Object element ) { return getChildren ( field , element ) . length > 0 ; } public void dialogFieldChanged ( DialogField field ) { libaryPageDialogFieldChanged ( field ) ; } } private void libaryPageCustomButtonPressed ( DialogField field , int index ) { CPListElement [ ] libentries = null ; switch ( index ) { case IDX_ADDEXT : libentries = openExtFolderDialog ( null ) ; break ; case IDX_ADDVAR : libentries = openVariableSelectionDialog ( null ) ; break ; case IDX_EDIT : editEntry ( ) ; return ; case IDX_REMOVE : removeEntry ( ) ; return ; } if ( libentries != null ) { int nElementsChosen = libentries . length ; List cplist = fLibrariesList . getElements ( ) ; List elementsToAdd = new ArrayList ( nElementsChosen ) ; for ( int i = 0 ; i < nElementsChosen ; i ++ ) { CPListElement curr = libentries [ i ] ; if ( ! cplist . contains ( curr ) && ! elementsToAdd . contains ( curr ) ) { elementsToAdd . add ( curr ) ; } } fLibrariesList . addElements ( elementsToAdd ) ; fLibrariesList . postSetSelection ( new StructuredSelection ( libentries ) ) ; } } private CPListElement [ ] openExtFolderDialog ( CPListElement existing ) { if ( existing == null ) { IPath [ ] selected = BuildPathDialogAccess . chooseExternalFolderEntries ( getShell ( ) ) ; if ( selected != null ) { ArrayList res = new ArrayList ( ) ; for ( int i = 0 ; i < selected . length ; i ++ ) { res . add ( new CPListElement ( fCurrJProject , ILoadpathEntry . CPE_LIBRARY , selected [ i ] , null ) ) ; } return ( CPListElement [ ] ) res . toArray ( new CPListElement [ res . size ( ) ] ) ; } } else { IPath configured = BuildPathDialogAccess . configureExternalFolderEntry ( getShell ( ) , existing . getPath ( ) ) ; if ( configured != null ) { return new CPListElement [ ] { new CPListElement ( fCurrJProject , ILoadpathEntry . CPE_LIBRARY , configured , null ) } ; } } return null ; } public void addElement ( CPListElement element ) { fLibrariesList . addElement ( element ) ; fLibrariesList . postSetSelection ( new StructuredSelection ( element ) ) ; } protected void libaryPageDoubleClicked ( TreeListDialogField field ) { List selection = fLibrariesList . getSelectedElements ( ) ; if ( canEdit ( selection ) ) { editEntry ( ) ; } } protected void libaryPageKeyPressed ( TreeListDialogField field , KeyEvent event ) { if ( field == fLibrariesList ) { if ( event . character == SWT . DEL && event . stateMask == 0 ) { List selection = field . getSelectedElements ( ) ; if ( canRemove ( selection ) ) { removeEntry ( ) ; } } } } private void removeEntry ( ) { List selElements = fLibrariesList . getSelectedElements ( ) ; HashMap containerEntriesToUpdate = new HashMap ( ) ; for ( int i = selElements . size ( ) - 1 ; i >= 0 ; i -- ) { Object elem = selElements . get ( i ) ; if ( elem instanceof CPListElementAttribute ) { CPListElementAttribute attrib = ( CPListElementAttribute ) elem ; String key = attrib . getKey ( ) ; Object value = null ; attrib . getParent ( ) . setAttribute ( key , value ) ; selElements . remove ( i ) ; if ( attrib . getParent ( ) . getParentContainer ( ) instanceof CPListElement ) { CPListElement containerEntry = attrib . getParent ( ) ; HashSet changedAttributes = ( HashSet ) containerEntriesToUpdate . get ( containerEntry ) ; if ( changedAttributes == null ) { changedAttributes = new HashSet ( ) ; containerEntriesToUpdate . put ( containerEntry , changedAttributes ) ; } changedAttributes . add ( key ) ; } } } if ( selElements . isEmpty ( ) ) { fLibrariesList . refresh ( ) ; fClassPathList . dialogFieldChanged ( ) ; } else { fLibrariesList . removeElements ( selElements ) ; } for ( Iterator iter = containerEntriesToUpdate . entrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Map . Entry entry = ( Entry ) iter . next ( ) ; CPListElement curr = ( CPListElement ) entry . getKey ( ) ; HashSet attribs = ( HashSet ) entry . getValue ( ) ; String [ ] changedAttributes = ( String [ ] ) attribs . toArray ( new String [ attribs . size ( ) ] ) ; ILoadpathEntry changedEntry = curr . getLoadpathEntry ( ) ; updateContainerEntry ( changedEntry , changedAttributes , fCurrJProject , ( ( CPListElement ) curr . getParentContainer ( ) ) . getPath ( ) ) ; } } private boolean canRemove ( List selElements ) { if ( selElements . size ( ) == 0 ) { return false ; } for ( int i = 0 ; i < selElements . size ( ) ; i ++ ) { Object elem = selElements . get ( i ) ; if ( elem instanceof CPListElementAttribute ) { CPListElementAttribute attrib = ( CPListElementAttribute ) elem ; if ( attrib . isInNonModifiableContainer ( ) ) { return false ; } if ( attrib . getValue ( ) == null ) { return false ; } } else if ( elem instanceof CPListElement ) { CPListElement curr = ( CPListElement ) elem ; if ( curr . getParentContainer ( ) != null ) { return false ; } } else { return false ; } } return true ; } private void editEntry ( ) { List selElements = fLibrariesList . getSelectedElements ( ) ; if ( selElements . size ( ) != 1 ) { return ; } Object elem = selElements . get ( 0 ) ; if ( fLibrariesList . getIndexOfElement ( elem ) != - 1 ) { editElementEntry ( ( CPListElement ) elem ) ; } } private void updateContainerEntry ( final ILoadpathEntry newEntry , final String [ ] changedAttributes , final IRubyProject jproject , final IPath containerPath ) { try { IWorkspaceRunnable runnable = new IWorkspaceRunnable ( ) { public void run ( IProgressMonitor monitor ) throws CoreException { BuildPathSupport . modifyLoadpathEntry ( null , newEntry , changedAttributes , jproject , containerPath , monitor ) ; } } ; PlatformUI . getWorkbench ( ) . getProgressService ( ) . run ( true , true , new WorkbenchRunnableAdapter ( runnable ) ) ; } catch ( InvocationTargetException e ) { String title = NewWizardMessages . LibrariesWorkbookPage_configurecontainer_error_title ; String message = NewWizardMessages . LibrariesWorkbookPage_configurecontainer_error_message ; ExceptionHandler . handle ( e , getShell ( ) , title , message ) ; } catch ( InterruptedException e ) { } } private void editElementEntry ( CPListElement elem ) { CPListElement [ ] res = null ; switch ( elem . getEntryKind ( ) ) { case ILoadpathEntry . CPE_LIBRARY : IResource resource = elem . getResource ( ) ; if ( resource == null ) { res = openExtFolderDialog ( elem ) ; } else if ( resource . getType ( ) == IResource . FOLDER ) { if ( resource . exists ( ) ) { res = openScriptFolderDialog ( elem ) ; } else { res = openNewScriptFolderDialog ( elem ) ; } } break ; case ILoadpathEntry . CPE_VARIABLE : res = openVariableSelectionDialog ( elem
272
<s> package com . asakusafw . testdriver . windgate ; import java . io . IOException ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . testdriver . core . BaseImporterPreparator ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . ImporterPreparator ; import com . asakusafw . testdriver . core . TestContext ; import com . asakusafw . vocabulary . windgate . WindGateImporterDescription ; import com . asakusafw . windgate . core . ParameterList ;
273
<s> package com . asakusafw . utils . java . internal . model . syntax ; import com . asakusafw . utils . java . model . syntax . AssignmentExpression ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . InfixOperator ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils
274
<s> package com . asakusafw . utils . java . parser . javadoc ; import static com . asakusafw . utils . java . internal . parser . javadoc . ir . JavadocTokenKind . * ; import static org . junit . Assert . * ; import org . junit . Test ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . JavadocToken ; public class DefaultJavadocScannerTest extends JavadocTestRoot { @ Test public void testNewInstanceEmpty ( ) { String text = load ( "" ) ; DefaultJavadocScanner scanner = DefaultJavadocScanner . newInstance ( text ) ; assertEquals ( SLASH , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( SLASH , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( EOF , scanner . nextToken ( ) . getKind ( ) ) ; } @ Test public void testNewInstanceSingleSpace ( ) { String text = load ( "" ) ; DefaultJavadocScanner scanner = DefaultJavadocScanner . newInstance ( text ) ; assertEquals ( SLASH , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( WHITE_SPACES , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( SLASH , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( EOF , scanner . nextToken ( ) . getKind ( ) ) ; } @ Test public void testNewInstance3Lines ( ) { String text = load ( "" ) ; DefaultJavadocScanner scanner = DefaultJavadocScanner . newInstance ( text ) ; assertEquals ( SLASH , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( LINE_BREAK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( WHITE_SPACES , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( LINE_BREAK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( WHITE_SPACES , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( SLASH , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( EOF , scanner . nextToken ( ) . getKind ( ) ) ; } @ Test public void testNewInstanceSynopsis ( ) { String text = load ( "" ) ; DefaultJavadocScanner scanner = DefaultJavadocScanner . newInstance ( text ) ; assertEquals ( SLASH , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( LINE_BREAK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( WHITE_SPACES , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( WHITE_SPACES , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( IDENTIFIER , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( COMMA , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( WHITE_SPACES , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( IDENTIFIER , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( TEXT , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( LINE_BREAK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( WHITE_SPACES , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( SLASH , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( EOF , scanner . nextToken ( ) . getKind ( ) ) ; } @ Test public void testGetIndex ( ) { String text = load ( "" ) ; DefaultJavadocScanner scanner = DefaultJavadocScanner . newInstance ( text ) ; int index = 0 ; while ( true ) { assertEquals ( index , scanner . getIndex ( ) ) ; JavadocToken t = scanner . nextToken ( ) ; if ( t . getKind ( ) == EOF ) { break ; } index ++ ; } assertEquals ( index , scanner . getIndex ( ) ) ; scanner . nextToken ( ) ; assertEquals ( index , scanner . getIndex ( ) ) ; } @ Test public void testSeek ( ) { String text = load ( "" ) ; DefaultJavadocScanner scanner = DefaultJavadocScanner . newInstance ( text ) ; assertEquals ( SLASH , scanner . nextToken ( ) . getKind ( ) ) ; scanner . seek ( 0 ) ; assertEquals ( SLASH , scanner . nextToken ( ) . getKind ( ) ) ; scanner . seek ( 4 ) ; assertEquals ( SLASH , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( EOF , scanner . nextToken ( ) . getKind ( ) ) ; scanner . seek ( 1 ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; assertEquals ( ASTERISK , scanner . nextToken ( ) . getKind ( ) ) ; } @ Test public void testConsume ( ) { String text = load ( "" ) ;
275
<s> package com . asakusafw . bulkloader . transfer ; import java . io . Closeable ; import java . io . IOException ;
276
<s> package br . com . caelum . vraptor . dash . matchers ; import org . hamcrest . Description ; import org . hamcrest . Factory ; import org . hamcrest . TypeSafeMatcher ; import br . com . caelum . vraptor . dash . hibernate . stats . OpenRequest ; import br . com . caelum . vraptor . resource . ResourceMethod ; public final class IsOfResourceMatcher extends TypeSafeMatcher < OpenRequest > { private final ResourceMethod resourceMethod ; private IsOfResourceMatcher ( ResourceMethod resourceMethod ) { this . resourceMethod = resourceMethod ; } @ Override public void describeTo ( Description description ) { description . appendText ( "" ) ; description . appendValue ( resourceMethod ) ; } @ Override protected boolean matchesSafely ( OpenRequest item ) { return
277
<s> package org . rubypeople . rdt . astviewer . views ; import java . io . IOException ; import java . io . InputStream ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . jface . viewers . IStructuredContentProvider ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . IFileEditorInput ; import org . eclipse . ui . IStorageEditorInput ; import org . eclipse . ui . IViewSite ; import org . eclipse . ui . IWorkbenchPage ; import org . eclipse . ui . PlatformUI ; import org . jruby . ast . CommentNode ; import org . jruby . ast . NewlineNode ; import org . jruby . ast . Node ; import org . jruby . common . NullWarnings ; import org . jruby . parser . DefaultRubyParser ; import org . jruby . parser . RubyParserPool ; import org . rubypeople . rdt . astviewer . Activator ; import org . rubypeople . rdt . internal . core . parser . RubyParser ; import org . rubypeople . rdt . internal . core . util . Util ; import org . rubypeople . rdt . internal . ui . rubyeditor . RubyEditor ; class ViewContentProvider implements IStructuredContentProvider , ITreeContentProvider { private TreeParent invisibleRoot ; private IViewSite viewSite ; private RubyEditor editor ; private DefaultRubyParser parser ; private boolean showNewline ; public ViewContentProvider ( IViewSite viewSite ) { this . viewSite = viewSite ; parser = RubyParserPool . getInstance ( ) . borrowParser ( ) ; parser . setWarnings ( new NullWarnings ( ) ) ; } public void inputChanged ( @ SuppressWarnings ( "unused" ) Viewer v , @ SuppressWarnings ( "unused" ) Object oldInput , @ SuppressWarnings ( "unused" ) Object newInput ) { } public void dispose ( ) { RubyParserPool . getInstance ( ) . returnParser ( parser ) ; } protected IFile getFile ( ) { IEditorInput input = editor . getEditorInput ( ) ; if ( input instanceof IFileEditorInput ) { return ( ( IFileEditorInput ) input ) . getFile ( ) ; } return null ; } public Object [ ] getElements ( Object parent ) { if ( parent . equals ( viewSite ) ) { if ( invisibleRoot == null ) initialize ( ) ; return getChildren ( invisibleRoot ) ; } return getChildren ( parent ) ; } public Object getParent ( Object child ) { if ( child instanceof TreeObject ) { return ( ( TreeObject ) child ) . getParent ( ) ; } return null ; } public Object [ ] getChildren ( Object parent ) { if ( parent instanceof TreeParent ) { return ( ( TreeParent ) parent ) . getChildren ( ) ; } return new Object [ 0 ] ; } public boolean hasChildren ( Object parent ) { if ( parent instanceof TreeParent ) return ( ( TreeParent ) parent ) . hasChildren ( ) ; return false ; } public Node getRootNode ( ) { try { return new RubyParser ( ) . parse ( getName ( ) , new String ( Util . getInputStreamAsCharArray ( getContents ( ) , - 1 , null ) ) ) . getAST ( ) ; } catch ( CoreException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return null ; } private String getName ( ) throws CoreException { IFile file = getFile ( ) ; if ( file != null ) return file . getName ( ) ; IEditorInput input = editor . getEditorInput ( ) ; if ( input instanceof IStorageEditorInput ) { IStorageEditorInput storageInput = ( IStorageEditorInput ) input ; return storageInput . getStorage ( ) . getName ( ) ; } return "" ; } private InputStream getContents ( ) throws CoreException { IFile file = getFile ( ) ; if ( file != null ) return file . getContents ( ) ; IEditorInput input = editor . getEditorInput ( ) ; if ( input instanceof IStorageEditorInput ) { IStorageEditorInput storageInput = ( IStorageEditorInput ) input ; return storageInput . getStorage
278
<s> package org . rubypeople . rdt . ui . actions ; import java . util . Iterator ; import org . eclipse . jface . action . IAction ; import org . eclipse . jface . action . IMenuManager ; import org . eclipse . jface . action . MenuManager ; import org . eclipse . jface . action . Separator ; import org . eclipse . jface . util . Assert ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . ISelectionProvider ; import org . eclipse . search . ui . IContextMenuConstants ; import org . eclipse . ui . IActionBars ; import org . eclipse . ui . IWorkbenchSite ; import org . eclipse . ui . IWorkingSet ; import org . eclipse . ui . actions . ActionGroup ; import org . eclipse . ui . texteditor . ITextEditorActionConstants ; import org . rubypeople . rdt . internal . ui . rubyeditor . RubyEditor ; import org . rubypeople . rdt . internal . ui
279
<s> package fi . koku . services . entity . family . v1 ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import fi . koku . services . entity . community . v1 . CommunityQueryCriteriaType ; import fi . koku . services . entity . community . v1 . CommunityServiceFactory ; import fi . koku . services . entity . community . v1 . CommunityServicePortType ; import fi . koku . services . entity . community . v1 . CommunityType ; import fi . koku . services . entity . community . v1 . MemberPicsType ; import fi . koku . services . entity . community . v1 . MemberType ; import fi . koku . services . entity . community . v1 . ServiceFault ; import fi . koku . services . entity . customer . v1 . CustomerQueryCriteriaType ; import fi . koku . services . entity . customer . v1 . CustomerServiceFactory ; import fi . koku . services . entity . customer . v1 . CustomerServicePortType ; import fi . koku . services . entity . customer . v1 . CustomerType ; import fi . koku . services . entity . customer . v1 . CustomersType ; import fi . koku . services . entity . customer . v1 . PicsType ; import fi . koku . services . entity . family . FamilyConstants ; public class FamilyService { private static final Logger LOG = LoggerFactory . getLogger ( FamilyService . class ) ; private CustomerServicePortType customerService ; private CommunityServicePortType communityService ; public FamilyService ( String customerServiceUserId , String customerServicePassword , String communityServiceUserId , String communityServicePassword ) { CustomerServiceFactory customerServiceFactory = new CustomerServiceFactory ( customerServiceUserId , customerServicePassword , FamilyConstants . CUSTOMER_SERVICE_ENDPOINT ) ; customerService = customerServiceFactory . getCustomerService ( ) ; CommunityServiceFactory communityServiceFactory =
280
<s> package org . rubypeople . rdt . internal . ui . wizards . buildpaths . newsourcepage ; import java . lang . reflect . InvocationTargetException ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . resources . IWorkspaceRunnable ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . eclipse . core . runtime . jobs . ISchedulingRule ; import org . eclipse . core . runtime . jobs . Job ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . dialogs . ErrorDialog ; import org . eclipse . jface . dialogs . MessageDialog ; import org . eclipse . jface . operation . IRunnableWithProgress ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . SelectionChangedEvent ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . jface . wizard . WizardDialog ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . IWorkbenchPage ; import org . eclipse . ui . IWorkbenchPart ; import org . eclipse . ui . IWorkbenchPartReference ; import org . eclipse . ui . IWorkbenchSite ; import org . eclipse . ui . part . ISetSelectionTarget ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . buildpath . LoadpathModifier ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyPluginImages ; import org . rubypeople . rdt . internal . ui . actions . WorkbenchRunnableAdapter ; import org . rubypeople . rdt . internal . ui . packageview . LoadPathContainer ; import org . rubypeople . rdt . internal . ui . util . PixelConverter ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . CPListElement ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . LoadpathContainerWizard ; public class AddLibraryToBuildpathAction extends Action implements ISelectionChangedListener { private IRubyProject fSelectedProject ; private final IWorkbenchSite fSite ; public AddLibraryToBuildpathAction ( IWorkbenchSite site ) { super ( NewWizardMessages . NewSourceContainerWorkbookPage_ToolBar_AddLibCP_label , RubyPluginImages . DESC_OBJS_LIBRARY ) ; setToolTipText ( NewWizardMessages . NewSourceContainerWorkbookPage_ToolBar_AddLibCP_tooltip ) ; fSite = site ; } public void run ( ) { final IRubyProject project = fSelectedProject ; Shell shell = fSite . getShell ( ) ; if ( shell == null ) { shell = RubyPlugin . getActiveWorkbenchShell ( ) ; } ILoadpathEntry [ ] classpath ; try { classpath = project . getRawLoadpath ( ) ; } catch ( RubyModelException e1 ) { showExceptionDialog ( e1 ) ; return ; } LoadpathContainerWizard wizard = new LoadpathContainerWizard ( ( ILoadpathEntry ) null , project , classpath ) { public boolean performFinish ( ) { if ( super . performFinish ( ) ) { IWorkspaceRunnable op = new IWorkspaceRunnable ( ) { public void run ( IProgressMonitor monitor ) throws CoreException , OperationCanceledException { try { finishPage ( monitor ) ; } catch ( InterruptedException e ) { throw new OperationCanceledException ( e . getMessage ( ) ) ; } } } ; try { ISchedulingRule rule = null ; Job job = Platform . getJobManager ( ) . currentJob ( ) ; if ( job != null ) rule = job . getRule ( ) ; IRunnableWithProgress runnable = null ; if ( rule != null ) runnable = new WorkbenchRunnableAdapter ( op , rule , true ) ; else runnable = new WorkbenchRunnableAdapter ( op , ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ) ; getContainer ( ) . run ( false , true , runnable ) ; } catch ( InvocationTargetException e ) { RubyPlugin . log ( e ) ; return false ; } catch ( InterruptedException e ) { return false ; } return true ; } return false ; } private void finishPage ( IProgressMonitor pm ) throws InterruptedException { ILoadpathEntry [ ] selected = getNewEntries (
281
<s> package com . pogofish . jadt . samples . ast . data ; import java . util . List ; public abstract class Statement { private Statement ( ) { } public static final Statement _Declaration ( Type type , String name , Expression expression ) { return new Declaration ( type , name , expression ) ; } public static final Statement _Assignment ( String name , Expression expression ) { return new Assignment ( name , expression ) ; } public static final Statement _Return ( Expression expression ) { return new Return ( expression ) ; } public static interface MatchBlock < ResultType > { ResultType _case ( Declaration x ) ; ResultType _case ( Assignment x ) ; ResultType _case ( Return x ) ; } public static abstract class MatchBlockWithDefault < ResultType > implements MatchBlock < ResultType > { @ Override public ResultType _case ( Declaration x ) { return _default ( x ) ; } @ Override public ResultType _case ( Assignment x ) { return _default ( x ) ; } @ Override public ResultType _case ( Return x ) { return _default ( x ) ; } protected abstract ResultType _default ( Statement x ) ; } public static interface SwitchBlock { void _case ( Declaration x ) ; void _case ( Assignment x ) ; void _case ( Return x ) ; } public static abstract class SwitchBlockWithDefault implements SwitchBlock { @ Override public void _case ( Declaration x ) { _default ( x ) ; } @ Override public void _case ( Assignment x ) { _default ( x ) ; } @ Override public void _case ( Return x ) { _default ( x ) ; } protected abstract void _default ( Statement x ) ; } public static final class Declaration extends Statement { public final Type type ; public final String name ; public final Expression expression ; public Declaration ( Type type , String name , Expression expression ) { this . type = type ; this . name = name ; this . expression = expression ; } @ Override public < ResultType > ResultType match ( MatchBlock < ResultType > matchBlock ) { return matchBlock . _case ( this ) ; } @ Override public void _switch ( SwitchBlock switchBlock ) { switchBlock . _case ( this ) ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + ( ( type == null ) ? 0 : type . hashCode ( ) ) ; result = prime * result + ( ( name == null ) ? 0 : name . hashCode ( ) ) ; result = prime * result + ( ( expression == null ) ? 0 : expression . hashCode ( ) ) ; return result ; } @ Override public boolean equals ( Object obj ) { if ( this == obj ) return true ; if ( obj == null ) return false ; if ( getClass ( ) != obj . getClass ( ) ) return false ; Declaration other = ( Declaration ) obj ; if ( type == null ) { if ( other . type != null ) return false ; } else if ( ! type . equals ( other . type ) ) return false ; if ( name == null ) { if ( other . name != null ) return false ; } else if ( ! name . equals ( other . name ) ) return false ; if ( expression == null ) { if ( other . expression != null ) return false ; } else if ( ! expression . equals ( other . expression ) ) return false ; return true ; } @ Override public String toString ( ) { return "" + type + ", name = " + name + "" + expression + ")" ; } } public static final class Assignment extends Statement { public final String name ; public final Expression expression ; public Assignment ( String name , Expression expression ) { this . name = name ; this . expression = expression ; } @ Override public < ResultType > ResultType match ( MatchBlock < ResultType > matchBlock ) { return matchBlock . _case (
282
<s> package org . rubypeople . rdt . ui . wizards ; import java . util . ArrayList ; import org . eclipse . core . resources . IContainer ; import org . eclipse . core . resources . IFolder ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IWorkspaceRoot ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . Path ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . SWT ; import org . eclipse . swt . widgets . DirectoryDialog ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . model . WorkbenchContentProvider ; import org . eclipse . ui . model . WorkbenchLabelProvider ; import org . rubypeople . rdt . internal . ui . IUIConstants ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . TypedViewerFilter ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . EditVariableEntryDialog ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . MultipleFolderSelectionDialog ; import org . rubypeople . rdt . internal . ui . wizards . buildpaths . NewVariableEntryDialog ; public final class BuildPathDialogAccess { private BuildPathDialogAccess ( ) { } public static IPath [ ] chooseSourceFolderEntries ( Shell shell , IPath initialSelection , IPath [ ] usedEntries ) { if ( usedEntries == null ) { throw new IllegalArgumentException ( ) ; } String title = NewWizardMessages . BuildPathDialogAccess_ExistingSourceFolderDialog_new_title ; String message = NewWizardMessages . BuildPathDialogAccess_ExistingSourceFolderDialog_new_description ; return internalChooseFolderEntry ( shell , initialSelection , usedEntries , title , message ) ; } private static IPath [ ] internalChooseFolderEntry ( Shell shell , IPath initialSelection , IPath [ ] usedEntries , String title , String message ) { Class [ ] acceptedClasses = new Class [ ] { IProject . class , IFolder . class } ; ArrayList usedContainers = new ArrayList ( usedEntries . length ) ; IWorkspaceRoot root = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; for ( int i = 0 ; i < usedEntries . length ; i ++ ) { IResource resource = root . findMember ( usedEntries [ i ] ) ; if ( resource instanceof IContainer ) { usedContainers . add ( resource ) ; } } IResource focus = initialSelection != null ? root . findMember ( initialSelection ) : null ; Object [ ] used = usedContainers . toArray ( ) ; MultipleFolderSelectionDialog dialog = new MultipleFolderSelectionDialog ( shell , new WorkbenchLabelProvider ( ) , new WorkbenchContentProvider ( ) ) ; dialog . setExisting ( used ) ; dialog . setTitle ( title ) ; dialog . setMessage ( message ) ; dialog . setHelpAvailable ( false ) ; dialog . addFilter ( new TypedViewerFilter ( acceptedClasses , used ) ) ; dialog . setInput ( root ) ; dialog . setInitialFocus ( focus ) ; if ( dialog . open ( ) == Window . OK ) { Object [ ] elements = dialog . getResult ( ) ; IPath [ ] res = new IPath [ elements . length ] ; for ( int i = 0 ; i < res . length ; i ++ ) { IResource elem = ( IResource ) elements [ i ] ; res [ i ] = elem . getFullPath ( ) ; } return res ; } return null ; } public static IPath [ ] chooseExternalFolderEntries ( Shell shell ) { String lastUsedPath = RubyPlugin . getDefault ( ) . getDialogSettings ( ) . get ( IUIConstants . DIALOGSTORE_LASTEXTJAR ) ; if ( lastUsedPath == null ) { lastUsedPath = "" ; } DirectoryDialog dialog = new DirectoryDialog ( shell , SWT . MULTI ) ; dialog . setText ( NewWizardMessages . BuildPathDialogAccess_ExtJARArchiveDialog_new_title ) ; dialog . setFilterPath ( lastUsedPath ) ; String res = dialog . open ( ) ; if ( res == null ) { return null ; } String dirName = dialog . getText ( ) ; IPath filterPath = Path . fromOSString ( dialog . getFilterPath ( ) ) ; IPath [ ] elems = { filterPath } ; RubyPlugin . getDefault ( ) . getDialogSettings ( ) . put ( IUIConstants . DIALOGSTORE_LASTEXTJAR
283
<s> package org . rubypeople . rdt . refactoring . ui . pages . extractmethod ; import java . util . Observable ; import java . util . Observer ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Event ; import org . eclipse . swt . widgets . Listener ; import org . eclipse . swt . widgets . Table ; import org . eclipse . swt . widgets . TableItem ; public class ButtonStateListener implements Observer , Listener { private final Table table ; private final Button upButton ; private final Button downButton ; private final Button editButton ; public ButtonStateListener ( Table table , Button upButton , Button downButton , Button editButton ) { this . table = table ; this . upButton = upButton ; this . downButton = downButton ; this . editButton = editButton ; } public void handleEvent ( Event event ) { setButtonStates ( ) ; } private void setButtonStates ( ) { TableItem [ ] tableItems = table . getSelection ( ) ; if ( tableItems == null || tableItems . length < 1 ) { editButton . setEnabled ( false ) ; return ; } MethodArgumentTableItem item = (
284
<s> package org . rubypeople . rdt . refactoring . core . pushdown ; import java . util . ArrayList ; import java . util . Collection ; import org . jruby . ast . BlockNode ; import org . jruby . ast . Node ; import org . jruby . lexer . yacc . IDESourcePosition ; import org . rubypeople . rdt . refactoring . core . NodeFactory ; import org . rubypeople . rdt . refactoring . editprovider . InsertEditProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . MethodNodeWrapper ; import org . rubypeople . rdt . refactoring . offsetprovider . IOffsetProvider ; public class DownPushedMethodsClass extends InsertEditProvider { private Collection < MethodNodeWrapper > methodNodes ; private Collection < MethodNodeWrapper > constructorNodes ; private String className ; public DownPushedMethodsClass ( String className , Collection < MethodNodeWrapper > allMethodNodes ) { super ( true ) ; this . className = className ; initConstrucorAndMethodNodes ( allMethodNodes ) ; } private void initConstrucorAndMethodNodes ( Collection < MethodNodeWrapper > allMethodNodes ) { methodNodes = new ArrayList < MethodNodeWrapper > ( ) ; constructorNodes = new ArrayList < MethodNodeWrapper > ( ) ; for ( MethodNodeWrapper node : allMethodNodes ) { if ( node . getSignature ( ) . isConstructor ( ) ) constructorNodes . add ( node ) ; else methodNodes . add
285
<s> package org . oddjob . jobs ; import java . io . IOException ; import java . io . ObjectInputStream ; import java . io . ObjectOutputStream ; import java . io . Serializable ; import org . oddjob . launch . Launcher ; public class LaunchJob implements Runnable , Serializable { private static final long serialVersionUID = 2010071400L ; private String name ;
286
<s> import java . awt . AWTException ; import java . awt . BorderLayout ; import java . awt . Desktop ; import java . awt . Rectangle ; import java . awt . SystemTray ; import java . awt . TrayIcon ; import java . awt . TrayIcon . MessageType ; import java . awt . event . ActionEvent ; import java . awt . event . ActionListener ; import java . io . File ; import java . io . IOException ; import javax . swing . ImageIcon ; import javax . swing . JColorChooser ; import javax . swing . JFrame ; import javax . swing . JMenu ; import javax . swing . JMenuItem ; import javax . swing . JOptionPane ; import javax . swing . JPopupMenu ; import javax . swing . UIManager ; import javax . swing . UnsupportedLookAndFeelException ; import com . melloware . jintellitype . HotkeyListener ; import com . melloware . jintellitype . JIntellitype ; import com . melloware . jintellitype . JIntellitypeConstants ; public class Tray extends JFrame implements ActionListener { private static final long serialVersionUID = - 3673374650195882019L ; OverlayPanel overlayPanel ; Preferences preferences ; Upload upload ; Upload textUpload ; int x1 = 0 , y1 = 0 , x2 = 0 , y2 = 0 ; int screenW , screenH ; Tray tray ; JXTrayIcon trayIcon ; String os = System . getProperty ( "os.name" ) ; JColorChooser colorChooser ; public Tray ( ) { new DataDirectory ( ) ; tray = this ; this . setAlwaysOnTop ( true ) ; if ( ! SystemTray . isSupported ( ) ) { System . out . println ( "" ) ; return ; } try { if ( os . indexOf ( "Win" ) >= 0 ) JIntellitype . getInstance ( ) . addHotKeyListener ( new HotkeyListener ( ) { @ Override public void onHotKey ( int identifier ) { if ( identifier == 1 ) { overlayPanel . setUploadSnippet ( ) ; } else if ( identifier == 2 ) { overlayPanel . setUploadScreenshot ( ) ; } else if ( identifier == 3 ) { overlayPanel . setSaveSnippet ( ) ; } else if ( identifier == 4 ) { overlayPanel . setSaveScreenshot ( ) ; } else if ( identifier == 5 ) { textUpload = new Upload ( false , tray ) ; } } } ) ; else JOptionPane . showMessageDialog ( null , "" , "" , JOptionPane . WARNING_MESSAGE ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } initializeTray ( ) ; setUndecorated ( true ) ; if ( os . indexOf ( "Win" ) >= 0 ) registerHotkeys ( ) ; initializeOverlayPanel ( ) ; } private void initializeTray ( ) { String icon ; if ( os . indexOf ( "Win" ) >= 0 ) icon = "trayIcon.png" ; else icon = "" ; ImageIcon ii = new ImageIcon ( this . getClass ( ) . getResource ( "/images/" + icon ) ) ; final JPopupMenu popup = new JPopupMenu ( ) ; trayIcon = new JXTrayIcon ( ii . getImage ( ) ) ; trayIcon . addActionListener ( this ) ; trayIcon . setActionCommand ( "tray" ) ; final SystemTray tray = SystemTray . getSystemTray ( ) ; JMenu uploadMenu = new JMenu ( "Upload" ) ; uploadMenu . setIcon ( new ImageIcon ( this . getClass ( ) . getResource ( "" ) ) ) ; JMenu saveMenu = new JMenu ( "Save" ) ; saveMenu . setIcon ( new ImageIcon ( this . getClass ( ) . getResource ( "" ) ) ) ; JMenuItem prefMenu = new JMenuItem ( "Preferences" ) ; prefMenu . setIcon ( new ImageIcon ( this . getClass ( ) . getResource ( "" ) ) ) ; prefMenu . addActionListener ( this ) ; prefMenu . setActionCommand ( "preferences" ) ; JMenuItem uScreenshot = new JMenuItem ( "" ) ; uScreenshot . setIcon ( new ImageIcon ( this . getClass ( ) . getResource ( "" ) ) ) ; uScreenshot . addActionListener ( this ) ; uScreenshot . setActionCommand ( "uScreen" ) ; JMenuItem uSnippet = new JMenuItem ( "" ) ; uSnippet . setIcon ( new ImageIcon ( this . getClass ( ) . getResource ( "" ) ) ) ; uSnippet . addActionListener ( this ) ; uSnippet . setActionCommand ( "uSnippet" ) ; JMenuItem uClipboard = new JMenuItem ( "" ) ; uClipboard . setIcon ( new ImageIcon ( this . getClass ( ) . getResource ( "" ) ) ) ; uClipboard . addActionListener ( this ) ; uClipboard . setActionCommand ( "uClipboard" ) ; JMenuItem sScreenshot = new JMenuItem ( "" ) ; sScreenshot . setIcon ( new ImageIcon ( this . getClass ( ) . getResource ( "" ) ) ) ; sScreenshot . addActionListener ( this ) ; sScreenshot . setActionCommand ( "sScreen" ) ; JMenuItem sSnippet = new JMenuItem ( "" ) ; sSnippet . setIcon ( new ImageIcon ( this . getClass ( ) . getResource ( "" ) ) ) ; sSnippet . addActionListener ( this ) ; sSnippet . setActionCommand ( "sSnippet" ) ; JMenuItem multiUploadItem = new JMenuItem ( "" ) ; multiUploadItem . setIcon ( new ImageIcon ( this . getClass ( ) . getResource ( "" ) ) ) ; multiUploadItem . addActionListener ( this ) ; multiUploadItem . setActionCommand ( "multi_upload" ) ; JMenuItem exitItem = new JMenuItem ( "Quit" ) ; exitItem . setIcon ( new ImageIcon ( this . getClass ( ) . getResource ( "" ) ) ) ; exitItem . addActionListener ( this ) ; exitItem . setActionCommand ( "exit" ) ; JMenuItem aboutItem = new JMenuItem ( "About" ) ; aboutItem . setIcon ( new ImageIcon ( this . getClass ( ) . getResource ( "" ) ) ) ; aboutItem . addActionListener ( this ) ; aboutItem . setActionCommand ( "about" ) ; uploadMenu . add ( uClipboard ) ; uploadMenu . addSeparator ( ) ; uploadMenu . add ( uSnippet ) ; uploadMenu . add ( uScreenshot ) ; uploadMenu . addSeparator ( ) ; uploadMenu . add ( multiUploadItem ) ; saveMenu . add ( sSnippet ) ; saveMenu . addSeparator ( ) ; saveMenu . add ( sScreenshot ) ; popup . add ( aboutItem ) ; popup . add ( prefMenu ) ; popup . addSeparator ( ) ; popup . add ( uploadMenu ) ; popup . add ( saveMenu ) ; popup . addSeparator ( ) ; popup . add ( exitItem ) ; popup . setLightWeightPopupEnabled ( true ) ; trayIcon . setJPopupMenu ( popup ) ; try { tray . add ( trayIcon ) ; trayIcon . displayMessage ( "" , "" , MessageType . INFO ) ; } catch ( AWTException e ) { System . out . println ( "" ) ; } } private void registerHotkeys ( ) { JIntellitype keyhook = JIntellitype .
287
<s> package org . springframework . social . google . api . plus . person . impl ; import java . io . IOException ; import org . springframework . http . HttpHeaders ; import org . springframework . http . HttpRequest ; import org . springframework . http . client . ClientHttpRequestExecution ; import org . springframework . http . client . ClientHttpRequestInterceptor ; import org . springframework . http . client . ClientHttpResponse ; import org . springframework . social . support . HttpRequestDecorator ; class OAuth2Draft10RequestInterceptor implements ClientHttpRequestInterceptor { private static final String AUTHORIZATION = "" ; @ Override public ClientHttpResponse intercept ( HttpRequest request , byte [ ] body , ClientHttpRequestExecution execution ) throws IOException { HttpRequest
288
<s> package com . asakusafw . testdriver . rule ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . LinkedHashMap ; import java . util . List ; import java . util . Map ; import java . util . Set ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . PropertyName ; import com . asakusafw . testdriver . core . PropertyType ; import com . asakusafw . testdriver . core . VerifyRule ; public class VerifyRuleBuilder { private final DataModelDefinition < ? > definition ; private final Set < DataModelCondition > dataModelConditions ; private final Map < PropertyName , Property > propertyConditions ; public VerifyRuleBuilder ( DataModelDefinition < ? > definition ) { if ( definition == null ) { throw new IllegalArgumentException ( "" ) ; } this . definition = definition ; this . dataModelConditions = new HashSet < DataModelCondition > ( ) ; this . propertyConditions = new LinkedHashMap < PropertyName , VerifyRuleBuilder . Property > ( ) ; } public VerifyRuleBuilder acceptIfAbsent ( ) { this . dataModelConditions . add ( DataModelCondition . IGNORE_ABSENT ) ; return this ; } public VerifyRuleBuilder acceptIfUnexpected ( ) { this . dataModelConditions . add ( DataModelCondition . IGNORE_UNEXPECTED ) ; return this ; } public Property property ( String name ) { if ( name == null ) { throw new IllegalArgumentException ( "" ) ; } String [ ] words = name . split ( "_|-|\\s+" ) ; PropertyName propertyName = PropertyName . newInstance (
289
<s> package org . rubypeople . rdt . internal . ui . preferences ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jface . dialogs . Dialog ; import org . eclipse . jface . dialogs . IDialogConstants ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . preference . PreferencePage ; import org . eclipse . jface . resource . JFaceResources ; import org . eclipse . swt . SWT ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . ui . IWorkbench ; import org . eclipse . ui . IWorkbenchPreferencePage ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . dialogs . StatusInfo ; import org . rubypeople . rdt . internal . ui . dialogs . StatusUtil ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . DialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . IDialogFieldListener ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . SelectionButtonDialogField ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . Separator ; import org . rubypeople . rdt . ui . PreferenceConstants ; public class AppearancePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { private static final String PREF_METHOD_PARAMETER_NAMES = PreferenceConstants . APPEARANCE_METHOD_PARAMETER_NAMES ; private static final String STACK_BROWSING_VIEWS_VERTICALLY = PreferenceConstants . BROWSING_STACK_VERTICALLY ; public static final String PREF_COLORED_LABELS = "" ; private SelectionButtonDialogField fStackBrowsingViewsVertically ; private SelectionButtonDialogField fShowMethodParameterNames ; public AppearancePreferencePage ( ) { setPreferenceStore ( RubyPlugin . getDefault ( ) . getPreferenceStore ( ) ) ; setDescription ( PreferencesMessages . AppearancePreferencePage_description ) ; IDialogFieldListener listener = new IDialogFieldListener ( ) { public void dialogFieldChanged ( DialogField field ) { doDialogFieldChanged ( field ) ; } } ; fShowMethodParameterNames = new SelectionButtonDialogField ( SWT . CHECK ) ; fShowMethodParameterNames . setDialogFieldListener ( listener ) ; fShowMethodParameterNames . setLabelText ( PreferencesMessages . AppearancePreferencePage_methodtypeparams_label ) ; fStackBrowsingViewsVertically = new SelectionButtonDialogField ( SWT . CHECK ) ; fStackBrowsingViewsVertically . setDialogFieldListener ( listener ) ; fStackBrowsingViewsVertically . setLabelText ( PreferencesMessages . AppearancePreferencePage_stackViewsVerticallyInTheRubyBrowsingPerspective ) ; } private void initFields ( ) { IPreferenceStore prefs = getPreferenceStore ( ) ; fShowMethodParameterNames . setSelection ( prefs . getBoolean ( PREF_METHOD_PARAMETER_NAMES ) ) ; fStackBrowsingViewsVertically . setSelection ( prefs . getBoolean ( STACK_BROWSING_VIEWS_VERTICALLY ) ) ; } public void createControl ( Composite parent ) { super . createControl ( parent ) ; PlatformUI . getWorkbench ( ) . getHelpSystem ( ) . setHelp ( getControl ( ) , IRubyHelpContextIds . APPEARANCE_PREFERENCE_PAGE ) ; } protected Control createContents ( Composite parent ) { initializeDialogUnits ( parent ) ; int nColumns = 1 ; Composite result = new Composite ( parent , SWT . NONE ) ; result . setFont ( parent . getFont ( ) ) ; GridLayout layout = new GridLayout ( ) ; layout . marginHeight = convertVerticalDLUsToPixels ( IDialogConstants . VERTICAL_MARGIN ) ; layout . marginWidth = 0 ; layout . numColumns = nColumns ; result . setLayout ( layout ) ; fShowMethodParameterNames . doFillIntoGrid ( result , nColumns ) ; new Separator ( ) . doFillIntoGrid ( result , nColumns ) ; fStackBrowsingViewsVertically . doFillIntoGrid ( result , nColumns ) ; String noteTitle = PreferencesMessages . AppearancePreferencePage_note ; String noteMessage
290
<s> package com . asakusafw . runtime . stage . collector ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import org . apache . hadoop . io . DataInputBuffer ; import org . apache . hadoop . io . DataOutputBuffer ; import org . apache . hadoop . io . Writable ; import org . apache . hadoop . io . WritableUtils ; public class WritableSlot implements Writable { private final DataOutputBuffer output = new DataOutputBuffer ( ) ; private final DataInputBuffer input = new DataInputBuffer ( ) ; public void
291
<s> package com . asakusafw . utils . java . model . syntax ; import
292
<s> package com . asakusafw . testtools ; import java . util . HashMap ; import java . util . Map ; public enum ColumnMatchingCondition { NONE ( "-UNK-" ) , EXACT ( "-UNK-" ) , PARTIAL ( "-UNK-" ) , NOW ( "-UNK-" ) , TODAY ( "-UNK-" ) ; private String japaneseName ; private ColumnMatchingCondition ( String japaneseName ) { this . japaneseName = japaneseName ; } public String getJapaneseName ( ) { return japaneseName ; } private static Map < String , ColumnMatchingCondition > japaneseNameMap = new HashMap < String , ColumnMatchingCondition > ( ) ; static { for ( ColumnMatchingCondition conditon : ColumnMatchingCondition . values ( ) ) { String key = conditon . getJapaneseName ( ) ; if ( japaneseNameMap . containsKey ( key ) ) { throw new RuntimeException ( "-UNK-" ) ; } japaneseNameMap . put ( key , conditon ) ; } } public static ColumnMatchingCondition getConditonByJapanseName ( String key ) { return japaneseNameMap . get ( key ) ; } public static String [ ] getJapaneseNames ( ) { ColumnMatchingCondition [ ] values = ColumnMatchingCondition
293
<s> package br . com . caelum . vraptor . dash . audit ; import java . lang . annotation . ElementType ; import java . lang . annotation . Retention ; import java . lang . annotation . RetentionPolicy ; import java . lang . annotation . Target ; @ Retention ( RetentionPolicy . RUNTIME )
294
<s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . ExportTempImportTarget11 ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . RecordParser ; @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public final class ExportTempImportTarget11ModelInput implements ModelInput < ExportTempImportTarget11 > { private final RecordParser parser ; public ExportTempImportTarget11ModelInput ( RecordParser parser ) { if ( parser == null ) { throw new IllegalArgumentException ( ) ; } this . parser = parser ; } @ Override public boolean readTo ( ExportTempImportTarget11 model ) throws IOException { if ( parser . next ( ) == false ) { return false ; } parser . fill ( model . getTempSidOption ( ) ) ; parser . fill ( model . getSidOption ( ) ) ; parser . fill ( model . getVersionNoOption ( ) ) ; parser . fill ( model . getRgstDateOption ( ) ) ; parser . fill ( model . getUpdtDateOption ( ) ) ; parser . fill ( model . getDuplicateFlgOption ( ) ) ;
295
<s> package org . rubypeople . rdt . internal . ui . search ; import com . ibm . icu . text . Collator ; import java . util . Comparator ; import org . eclipse . ui . IWorkingSet ; public class WorkingSetComparator implements Comparator { private Collator fCollator = Collator . getInstance ( ) ; public int compare ( Object o1 , Object o2 ) { String name1 = null ; String name2 =
296
<s> package net . sf . sveditor . core . tests . content_assist ; 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 . content_assist . SVCompletionProposal ; import net . sf . sveditor . core . db . ISVDBFileFactory ; 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 . SVDBMarker ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . scanutils . StringBIDITextScanner ; import net . sf . sveditor . core . tests . FileIndexIterator ; import net . sf . sveditor . core . tests . TextTagPosUtils ; public class TestContentAssistStruct extends TestCase { public void testContentAssistStructTypedef ( ) { LogHandle log = LogFactory . getLogHandle ( "" ) ; String doc1 = "" + "endclassn" + "n" + "" + "" + "" + "" + "n" + "" + "" + "n" + "" + "" + "" + "n" + "endclassn" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; TextTagPosUtils tt_utils = new TextTagPosUtils ( new StringInputStream ( doc1 ) ) ; ISVDBFileFactory factory = SVCorePlugin . createFileFactory ( null ) ; List < SVDBMarker > markers = new ArrayList < SVDBMarker > ( ) ; SVDBFile file = factory . parse ( tt_utils . openStream ( ) , "doc1" , markers ) ; StringBIDITextScanner scanner = new StringBIDITextScanner ( tt_utils . getStrippedData ( ) ) ; for ( ISVDBItemBase it : file . getChildren ( ) ) { log . debug ( " it: " + it . getType ( ) + " " + SVDBItem . getName ( it ) ) ; } TestCompletionProcessor cp = new TestCompletionProcessor ( log , file , new FileIndexIterator ( file ) ) ; scanner . seek ( tt_utils . getPosMap ( ) . get ( "MARK" ) ) ; cp . computeProposals ( scanner , file , tt_utils . getLineMap ( ) . get ( "MARK" ) ) ; List < SVCompletionProposal > proposals = cp . getCompletionProposals ( ) ; ContentAssistTests . validateResults ( new String [ ] { "my_int_field" , "my_bit_field" } , proposals ) ; LogFactory . removeLogHandle ( log ) ; } public void testContentAssistStructModuleInput ( ) { LogHandle log = LogFactory . getLogHandle ( "" ) ; String doc1 = "" + "endclassn" + "n" + "" + "" + "" + "" + "n" + "" + "n" + "" + "" + "" + "n" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; TextTagPosUtils tt_utils = new TextTagPosUtils ( new StringInputStream ( doc1 ) ) ; ISVDBFileFactory factory = SVCorePlugin . createFileFactory ( null ) ; List < SVDBMarker > markers = new ArrayList < SVDBMarker > ( ) ; SVDBFile file = factory . parse ( tt_utils . openStream ( ) , "doc1" , markers ) ; StringBIDITextScanner scanner = new StringBIDITextScanner ( tt_utils . getStrippedData ( ) ) ; for ( ISVDBItemBase it : file . getChildren ( ) ) { log . debug ( " it: " + it . getType ( ) + " " + SVDBItem . getName ( it ) ) ; } TestCompletionProcessor cp = new TestCompletionProcessor ( log , file , new FileIndexIterator ( file ) ) ; scanner . seek ( tt_utils . getPosMap ( ) . get ( "MARK" ) ) ; cp . computeProposals ( scanner , file , tt_utils . getLineMap ( ) . get ( "MARK" ) ) ; List < SVCompletionProposal > proposals = cp . getCompletionProposals ( ) ; ContentAssistTests . validateResults ( new String [ ] { "my_int_field" , "my_bit_field" } , proposals ) ; LogFactory . removeLogHandle ( log ) ; } public void testContentAssistStructModuleInputModuleScope ( ) { LogHandle log = LogFactory . getLogHandle ( "" ) ; String doc1 = "" + "endclassn" + "n" + "" + "" + "" + "} s;n" + "n" + "" + "n" + "" + "endmodulen" ; SVCorePlugin . getDefault ( ) . enableDebug ( false ) ; TextTagPosUtils tt_utils = new TextTagPosUtils ( new StringInputStream ( doc1 ) ) ; ISVDBFileFactory factory = SVCorePlugin . createFileFactory ( null ) ; List < SVDBMarker > markers = new ArrayList < SVDBMarker > ( ) ; SVDBFile file = factory . parse ( tt_utils . openStream ( ) , "doc1" , markers ) ; StringBIDITextScanner scanner = new StringBIDITextScanner ( tt_utils . getStrippedData ( ) ) ; for ( ISVDBItemBase it : file . getChildren ( ) ) { log . debug ( " it: " + it . getType ( ) + " " + SVDBItem . getName ( it ) ) ; } TestCompletionProcessor cp = new TestCompletionProcessor ( log , file , new FileIndexIterator ( file ) ) ; scanner . seek ( tt_utils . getPosMap ( ) .
297
<s> package org . rubypeople . rdt . refactoring . tests . core . inlinemethod ; import org . jruby . ast . LocalAsgnNode ; import org . jruby . lexer . yacc . IDESourcePosition ; import org . rubypeople . rdt . refactoring . core . inlinemethod . ReturnStatementReplacer ; import org . rubypeople . rdt . refactoring . documentprovider . IDocumentProvider ; import org . rubypeople . rdt . refactoring . tests . core . MultipleDocumentsInOneProvider ; public class TC_ReturnStatementReplacer extends FinderTestsBase { public void testMultipleReturns ( ) { doc . setActive ( "test1" ) ; assertFalse ( new ReturnStatementReplacer ( ) . singleReturnOnLastLine ( doc ) ) ; } public void testSingleReturn ( ) { doc . setActive ( "test2" ) ; assertTrue ( new ReturnStatementReplacer ( ) . singleReturnOnLastLine ( doc ) ) ; } public void testReturnNotAtTheEnd ( ) { doc . setActive ( "test3" ) ; assertFalse ( new ReturnStatementReplacer ( ) . singleReturnOnLastLine ( doc ) ) ; } public void testReturnLastLine ( ) { doc . setActive ( "test4" ) ; assertTrue ( new ReturnStatementReplacer ( ) . singleReturnOnLastLine ( doc ) ) ; } public void testExplicitReturn ( ) { doc . setActive ( "test5" ) ; IDocumentProvider resultDocument = new ReturnStatementReplacer ( ) . replaceReturn ( doc , new LocalAsgnNode ( new IDESourcePosition ( ) , "result" , 2 , null ) ) ; assertEquals ( "result = var" , lastLine ( resultDocument ) ) ; } public void testImplicitReturn ( ) { doc . setActive ( "test6" ) ; IDocumentProvider resultDocument = new ReturnStatementReplacer ( ) . replaceReturn ( doc , new LocalAsgnNode ( new IDESourcePosition ( ) , "result" , 2 , null ) ) ; assertEquals ( "" , lastLine ( resultDocument ) ) ; } public void testFactorialReturn ( ) { doc . setActive ( "test7" ) ; IDocumentProvider resultDocument = new ReturnStatementReplacer ( ) . replaceReturn ( doc , new LocalAsgnNode ( new IDESourcePosition ( ) , "fac" , 2 , null ) ) ; assertEquals ( "" , lastLine ( resultDocument ) ) ; } public void testReturnFixnum ( ) { doc . setActive ( "test8" ) ; IDocumentProvider resultDocument = new ReturnStatementReplacer ( ) . replaceReturn ( doc , new LocalAsgnNode ( new IDESourcePosition ( ) , "var" , 2 , null ) ) ; assertEquals ( "var = 5" , lastLine ( resultDocument ) ) ; } public void testErroneousDocument ( ) { doc . setActive ( "test3" ) ; IDocumentProvider resultDocument
298
<s> package net . thucydides . showcase . simple . pages ; import ch . lambdaj . function . convert . Converter ; import net . thucydides . core . matchers . BeanMatcher ; import net . thucydides . core . pages . PageObject ; import net . thucydides . core . pages . WebElementFacade ; import org . openqa . selenium . By ; import org . openqa . selenium . WebDriver ; import org . openqa . selenium . WebElement ; import org . openqa . selenium . support . FindBy ; import java . util . ArrayList ; import java . util . List ; import java . util . Map ; import static ch . lambdaj . Lambda . convert ; import static net . thucydides . core . pages . components . HtmlTable . filterRows ; import static net . thucydides . core . pages . components . HtmlTable . rowsFrom ; public class SearchResultsPage extends PageObject { @ FindBy ( xpath = "" ) WebElement resultTable ; public SearchResultsPage ( WebDriver driver ) { super ( driver ) ; } public List < Map < Object , String > > getSearchResults ( ) { return rowsFrom ( resultTable ) ; } public class Artifact { private final String groupId ; private final String artifactId ; private final String latestVersion ; public Artifact ( String groupId , String artifactId , String latestVersion ) { this . groupId = groupId ; this . artifactId = artifactId ; this . latestVersion = latestVersion ; } public String getGroupId ( ) { return groupId ; } public String getArtifactId ( ) { return
299
<s> package org . rubypeople . rdt . internal . core . parser . warnings ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; public class EmptyStatementVisitorTest extends AbstractRubyLintVisitorTestCase { @ Override protected RubyLintVisitor createVisitor ( String src ) { return new EmptyStatementVisitor ( src ) { @ Override protected String getSeverity ( ) { return RubyCore . WARNING ; } } ; } public void testComplainsAboutEmptyMethod ( ) throws Exception { String src = "" ; assertEquals ( 1 , getProblems ( src ) . size ( ) ) ; } public void testDoesntComplainAboutMethodWithBody ( ) throws Exception { String src = "" ; assertEquals ( 0 , getProblems ( src ) . size ( ) ) ; } public void testComplainsAboutEmptySingletonMethod ( ) throws Exception { String src = "" ; assertEquals ( 1 , getProblems ( src ) . size ( ) ) ; } public void testDoesntComplainAboutSingletonMethodWithBody ( ) throws Exception { String src = "" ; assertEquals ( 0 , getProblems ( src ) . size ( ) ) ; } public void testComplainsAboutEmptyIfBody ( ) throws Exception { String src = "if truen" + "end" ; assertEquals ( 1 , getProblems ( src ) . size ( ) ) ; } public void testDoesntComplainAboutIfWithBody