id
int32
0
3k
input
stringlengths
43
33.8k
gt
stringclasses
1 value
100
<s> package bonsai . app . weather ; import java . util . ArrayList ; import java . util . List ; import org . xml . sax . Attributes ; import org . xml . sax . helpers . DefaultHandler ; public class XmlHandler extends DefaultHandler { int n = 0 ; private List < Weather > weathers = new ArrayList < Weather > ( ) ; private Weather weatherActual ; public List < Weather > getweather ( ) { return weathers ; } public void startElement ( String uri , String name , String qName , Attributes atts ) { if ( qName . compareTo ( "day_of_week" ) == 0 ) { String day = atts . getValue ( 0 ) ; System . out . println ( "Day: " + day ) ; weatherActual = new Weather ( ) ; } if ( qName . compareToIgnoreCase ( "low" ) == 0 ) { int low = Integer . parseInt ( atts . getValue ( 0 ) ) ; System . out . println
101
<s> package edsdk . utils ; import java . awt . image . BufferedImage ; import java . io . File ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . Map ; import java . util . concurrent . ConcurrentLinkedQueue ; import com . sun . jna . Library ; import com . sun . jna . Native ; import com . sun . jna . NativeLong ; import com . sun . jna . Pointer ; import com . sun . jna . platform . win32 . User32 ; import com . sun . jna . platform . win32 . User32 . MSG ; import com . sun . jna . ptr . NativeLongByReference ; import com . sun . jna . win32 . StdCallLibrary ; import edsdk . EdSdkLibrary ; import edsdk . EdSdkLibrary . EdsObjectEventHandler ; import edsdk . EdSdkLibrary . EdsVoid ; import edsdk . EdSdkLibrary . __EdsObject ; import edsdk . utils . commands . GetPropertyTask ; import edsdk . utils . commands . LiveViewTask ; import edsdk . utils . commands . SetPropertyTask ; import edsdk . utils . commands . ShootTask ; public class CanonCamera implements EdsObjectEventHandler { private static final Map < String , Integer > options = new HashMap < String , Integer > ( ) ; static { options . put ( Library . OPTION_CALLING_CONVENTION , StdCallLibrary . STDCALL_CONVENTION ) ; } public static EdSdkLibrary EDSDK = ( EdSdkLibrary ) Native . loadLibrary ( "" , EdSdkLibrary . class , options ) ; private static final User32 lib = User32 . INSTANCE ; private static ConcurrentLinkedQueue < CanonTask < ? > > queue = new ConcurrentLinkedQueue < CanonTask < ? > > ( ) ; private static ArrayList < EdsObjectEventHandler > objectEventHandlers = new ArrayList < EdsObjectEventHandler > ( 10 ) ; private static Thread dispatcherThread ; static { dispatcherThread = new Thread ( ) { public void run ( ) { dispatchMessages ( ) ; } } ; dispatcherThread . start ( ) ; Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ) { @ Override public void run ( ) { CanonCamera . close ( ) ; } } ) ; } private __EdsObject edsCamera ; private String errorMessage ; private int errorCode ; public CanonCamera ( ) { } public boolean openSession ( ) { return executeNow ( new OpenSessionCommand ( ) ) ; } public boolean closeSession ( ) { return executeNow ( new CloseSessionCommand ( ) ) ; } public __EdsObject getEdsCamera ( ) { return edsCamera ; } public File shoot ( ) { return executeNow ( new ShootTask ( ) ) ; } public Boolean setProperty ( long property , long value ) { return executeNow ( new SetPropertyTask ( property , value ) ) ; } public Long getProperty ( long property ) { return executeNow ( new GetPropertyTask ( property ) ) ; } public void execute ( CanonTask < ? > cmd ) { cmd . setSLR ( this ) ; queue . add ( cmd ) ; } public < T > T executeNow ( CanonTask < T > cmd ) { execute ( cmd ) ; return cmd . result ( ) ; } public boolean setError ( int result , String message ) { errorMessage = message + " (code=" + result +
102
<s> package com . asakusafw . testdriver . excel ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashSet ; import java . util . Set ; import com . asakusafw . testdriver . rule . DataModelCondition ; public enum TotalConditionKind { STRICT ( "Strict" , "-UNK-" ) , SKIP_UNEXPECTED ( "Expect" , "-UNK-" , DataModelCondition . IGNORE_UNEXPECTED ) , SKIP_ABSENT ( "Actual" , "-UNK-" , DataModelCondition . IGNORE_ABSENT ) , INTERSECT ( "Intersect" , "" , DataModelCondition . IGNORE_UNEXPECTED , DataModelCondition . IGNORE_ABSENT )
103
<s> package com . asakusafw . utils . java . internal . parser . javadoc . ir ; public class IrDocNamedType extends AbstractIrDocElement implements IrDocFragment , IrDocType { private static final long serialVersionUID = 1L ; private IrDocName name ; public IrDocNamedType ( IrDocName name ) { super ( ) ; if ( name == null ) { throw new IllegalArgumentException ( "name" ) ; } this . name = name ; } @ Override public IrDocElementKind getKind ( ) { return IrDocElementKind . NAMED_TYPE ; } public IrDocName getName ( ) { return this . name ; } public void setName ( IrDocName name ) { if ( name == null ) { throw new IllegalArgumentException ( "name" ) ; } this . name = name ; } @ Override public int hashCode ( ) { final int prime = 31 ; int result = 1 ; result = prime * result + ( ( name == null ) ? 0 : name . 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 ; } final IrDocNamedType other = ( IrDocNamedType ) obj ;
104
<s> package com . asakusafw . bulkloader . common ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; @ Deprecated public enum CacheUseType { USE ( "1" ) , NONE ( "2" ) ; private String cacheUseType ;
105
<s> package org . oddjob . schedules . schedules ; import java . text . ParseException ; import java . util . Date ; import java . util . TimeZone ; import junit . framework . TestCase ; import org . oddjob . OddjobDescriptorFactory ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . standard . StandardFragmentParser ; import org . oddjob . arooa . utils . DateHelper ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . schedules . Interval ; import org . oddjob . schedules . IntervalTo ; import org . oddjob . schedules . Schedule ; import org . oddjob . schedules . ScheduleContext ; import org . oddjob . schedules . ScheduleResult ; import org . oddjob . schedules . ScheduleRoller ; import org . oddjob . schedules . units . DayOfMonth ; import org . oddjob . schedules . units . Month ; public class MonthScheduleTest extends TestCase { @ Override protected void setUp ( ) throws Exception { TimeZone . setDefault ( null ) ; } public void testFromAndTo ( ) throws ParseException { YearlySchedule schedule = new YearlySchedule ( ) ; schedule . setFromMonth ( Month . Months . FEBRUARY ) ; schedule . setToMonth ( Month . Months . APRIL ) ; Date now1 = DateHelper . parseDateTime ( "" ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDate ( "2003-02-01" ) , DateHelper . parseDate ( "2003-05-01" ) ) ; Interval result = schedule . nextDue ( new ScheduleContext ( now1 ) ) ; assertEquals ( expected , result ) ; } public void testAfter ( ) throws ParseException { YearlySchedule schedule = new YearlySchedule ( ) ; schedule . setFromMonth ( Month . Months . FEBRUARY ) ; schedule . setToMonth ( Month . Months . APRIL ) ; Date now1 = DateHelper . parseDateTime ( "" ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDate ( "2004-02-01" ) , DateHelper . parseDate ( "2004-05-01" ) ) ; Interval result = schedule . nextDue ( new ScheduleContext ( now1 ) ) ; assertEquals ( expected , result ) ; } public void testOverBoundry ( ) throws
106
<s> package org . oddjob . oddballs ; import java . io . File ; import org . apache . log4j . Logger ; import org . oddjob . OurDirs ; import org . oddjob . io . CopyJob ; import org . oddjob . io . FilesType ; import org . oddjob . tools . CompileJob ; public class BuildOddballs implements Runnable { private static final Logger logger = Logger . getLogger ( BuildOddballs . class ) ; public void run ( ) { build ( "apple" ) ; build ( "orange" ) ; } public void build ( String oddball ) { final OurDirs dirs = new OurDirs (
107
<s> package com . asakusafw . utils . java . internal . model . syntax ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . Statement ; import com . asakusafw . utils . java . model . syntax . Visitor ; import com . asakusafw . utils . java . model . syntax . WhileStatement ; public final class WhileStatementImpl extends ModelRoot implements WhileStatement { private Expression condition ; private Statement body ; @ Override public Expression getCondition ( ) { return this . condition ; } public void setCondition ( Expression condition )
108
<s> package org . rubypeople . rdt . internal . ui . typehierarchy ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionProvider ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . util . SelectionUtil ; import org . rubypeople . rdt . ui . RubyElementLabels ; public class FocusOnSelectionAction extends Action { private TypeHierarchyViewPart fViewPart ; public FocusOnSelectionAction ( TypeHierarchyViewPart part ) { super ( TypeHierarchyMessages . FocusOnSelectionAction_label ) ; setDescription ( TypeHierarchyMessages . FocusOnSelectionAction_description ) ; setToolTipText ( TypeHierarchyMessages . FocusOnSelectionAction_tooltip ) ; fViewPart = part ; PlatformUI . getWorkbench ( ) . getHelpSystem ( ) . setHelp ( this , IRubyHelpContextIds . FOCUS_ON_SELECTION_ACTION ) ; } private ISelection getSelection ( ) { ISelectionProvider provider = fViewPart . getSite ( ) . getSelectionProvider ( ) ; if ( provider != null ) { return provider . getSelection ( ) ; } return null ; } public void run ( ) { Object element = SelectionUtil . getSingleElement ( getSelection ( ) ) ;
109
<s> package de . fuberlin . wiwiss . d2rq . sql . vendor ; import java . lang . reflect . Method ; import java . sql . Connection ; import java . sql . ResultSet ; import java . sql . SQLException ; import java . sql . Statement ; import java . sql . Timestamp ; import java . sql . Types ; import java . text . DateFormat ; import java . text . SimpleDateFormat ; import java . util . Arrays ; import java . util . Calendar ; import java . util . GregorianCalendar ; import java . util . TimeZone ; import java . util . regex . Pattern ; import de . fuberlin . wiwiss . d2rq . D2RQException ; import de . fuberlin . wiwiss . d2rq . expr . BooleanToIntegerCaseExpression ; import de . fuberlin . wiwiss . d2rq . expr . Expression ; import de . fuberlin . wiwiss . d2rq . expr . SQLExpression ; import de . fuberlin . wiwiss . d2rq . map . Database ; import de . fuberlin . wiwiss . d2rq . sql . types . DataType ; import de . fuberlin . wiwiss . d2rq . sql . types . SQLApproximateNumeric ; import de . fuberlin . wiwiss . d2rq . sql . types . SQLBinary ; import de . fuberlin . wiwiss . d2rq . sql . types . SQLCharacterString ; import de . fuberlin . wiwiss . d2rq . sql . types . SQLTimestamp ; import de . fuberlin . wiwiss . d2rq . sql . types . UnsupportedDataType ; public class Oracle extends SQL92 { public Oracle ( ) { super ( false ) ; } @ Override public Expression getRowNumLimitAsExpression ( int limit ) { if ( limit == Database . NO_LIMIT ) return Expression . TRUE ; return SQLExpression . create ( "ROWNUM <= " + limit ) ; } @ Override public String getRowNumLimitAsQueryAppendage ( int limit ) { return "" ; } @ Override public String quoteBinaryLiteral ( String hexString ) { return quoteStringLiteral ( hexString ) ; } @ Override public DataType getDataType ( int jdbcType , String name , int size ) { if ( jdbcType == Types . CLOB || "NCLOB" . equals ( name ) ) { return new SQLCharacterString ( this , name , false ) ; } if ( jdbcType == Types . BLOB ) { return new SQLBinary ( this , name , false ) ; } DataType standard = super . getDataType ( jdbcType , name , size ) ; if ( standard != null ) return standard ; if ( name . contains ( "" ) || "TIMESTAMPLTZ" . equals ( name ) ) { return new OracleCompatibilityTimeZoneLocalDataType ( this , name ) ; } if ( name . contains ( "" ) || "TIMESTAMPTZ" . equals ( name ) ) { return new OracleCompatibilityTimeZoneDataType ( this , name ) ; } if ( "VARCHAR2" . equals ( name ) || "NVARCHAR2" . equals ( name ) ) { return new SQLCharacterString ( this , name , true ) ; } if ( "BINARY_FLOAT" . equals ( name ) || "" . equals ( name ) ) { return new SQLApproximateNumeric ( this , name ) ; } if ( "BFILE" . equals ( name ) ) { return new UnsupportedDataType ( jdbcType , name ) ; } return null ; } @ Override public void initializeConnection ( Connection connection ) throws SQLException { Statement stmt = connection . createStatement ( ) ; try { stmt . execute ( "" ) ; stmt . execute ( "" ) ; setSessionTimeZone ( connection , getTimeZoneForSession ( ) . getID ( ) ) ; } catch ( Exception ex ) { throw new D2RQException ( ex ) ; } finally { stmt . close ( ) ; } } private void setSessionTimeZone ( Connection connection , String timeZoneID ) throws Exception { Class < ? > c = Class . forName ( "" ) ; Method setSessionTimeZone = c . getMethod ( "" , String . class ) ; setSessionTimeZone . invoke ( connection , timeZoneID ) ; } private static TimeZone getTimeZoneForSession ( ) { return TimeZone . getDefault ( ) ; } public Expression booleanExpressionToSimpleExpression ( Expression expression ) { return new BooleanToIntegerCaseExpression ( expression ) ; } @ Override public boolean isIgnoredTable ( String schema , String table ) { if ( Arrays . binarySearch ( IGNORED_SCHEMAS , schema ) >= 0 ) return true ; if ( IGNORED_SCHEMAS_PATTERN . matcher ( schema ) . matches ( ) ) return true ; if ( table . startsWith ( "BIN$" ) ) return true ; if ( table . startsWith ( "SYS_NT" ) ) return true ; return false ; } private static final String
110
<s> package com . aptana . rdt . internal . ui . actions ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . jobs . Job ; import org . eclipse . jface . action . IAction ; import org . eclipse . jface . dialogs . MessageDialog ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . IObjectActionDelegate ; import org . eclipse . ui . IViewActionDelegate ; import org . eclipse . ui . IViewPart ; import org . eclipse . ui . IWorkbenchPart ; import org . eclipse . ui . PlatformUI ; import com . aptana . rdt . AptanaRDTPlugin ; public class CleanupGemsActionDelegate implements IObjectActionDelegate , IViewActionDelegate { private IWorkbenchPart targetPart ; public void setActivePart ( IAction action , IWorkbenchPart targetPart ) { this . targetPart = targetPart ; } public void run ( IAction action ) { Shell shell = null ; if ( targetPart != null && targetPart . getSite ( ) != null ) shell = targetPart . getSite ( ) . getShell ( ) ; if ( shell == null ) shell = PlatformUI . getWorkbench ( ) . getDisplay ( ) . getActiveShell ( ) ; boolean doIt = MessageDialog . openConfirm ( shell , "" , "" ) ; if ( ! doIt ) return ; Job job
111
<s> package org . rubypeople . rdt . launching ; import java . io . BufferedReader ; import java . io . File ; import java . io . IOException ; import java . io . StringReader ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import org . eclipse . core . runtime . IConfigurationElement ; import org . eclipse . core . runtime . IExecutableExtension ; import org . eclipse . core . runtime . Path ; import org . eclipse . debug . core . DebugPlugin ; import org . eclipse . debug . core . ILaunchManager ; import org . eclipse . debug . core . Launch ; import org . eclipse . debug . core . model . IProcess ; import org . eclipse . debug . core . model . IStreamsProxy ; import org . rubypeople . rdt . internal . launching . LaunchingMessages ; import org . rubypeople . rdt . internal . launching . LaunchingPlugin ; import org . rubypeople . rdt . internal . launching . LibraryInfo ; public abstract class AbstractVMInstallType implements IVMInstallType , IExecutableExtension { private List < IVMInstall > fVMs ; private String fId ; protected AbstractVMInstallType ( ) { fVMs = new ArrayList < IVMInstall > ( 10 ) ; } public IVMInstall [ ] getVMInstalls ( ) { IVMInstall [ ] vms = new IVMInstall [ fVMs . size ( ) ] ; return ( IVMInstall [ ] ) fVMs . toArray ( vms ) ; } public void disposeVMInstall ( String id ) { for ( int i = 0 ; i < fVMs . size ( ) ; i ++ ) { IVMInstall vm = ( IVMInstall ) fVMs .
112
<s> package net . sf . sveditor . core . hierarchy ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . SVDBItem ; public class HierarchyTreeNode { private String fName ; private HierarchyTreeNode fParent ; private SVDBItem fItemDecl ; private ISVDBItemBase fItemType ; private
113
<s> package org . rubypeople . rdt . internal . debug . core ; public class BreakpointSuspensionPoint extends SuspensionPoint
114
<s> package org . oddjob . io ; import java . io . BufferedOutputStream ; import java . io . File ; import java . io . FileNotFoundException ; import java . io . FileOutputStream ; import java . io . OutputStream ; import org . oddjob . arooa . ArooaValue ; import org .
115
<s> package org . rubypeople . rdt . refactoring . tests ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . util . ArrayList ; import java . util . Collection ; import org . rubypeople . rdt . refactoring . util . FileHelper ; public class FileTestData extends FilePropertyData { private String fileName ; private String source ; private String expectedResult ; private final String sourceSuffix ; private final String resultSuffix ; public FileTestData ( String fileName , String sourceSuffix , String resultSuffix ) throws FileNotFoundException , IOException { super ( fileName + "" ) ; this . fileName = fileName ; this . sourceSuffix = sourceSuffix ; this . resultSuffix = resultSuffix ; source = initSourceFile ( ) ; expectedResult = initExpectedFile ( ) ; } public String getFileName ( ) { return fileName ; } public FileTestData ( String fileName ) throws FileNotFoundException , IOException { this ( fileName , ".test_source" , ".test_result" ) ; } private String initSourceFile ( ) { return FileHelper . getFileContent ( TestsPlugin . getFile ( fileName + sourceSuffix ) ) ; } private String initExpectedFile ( ) { return FileHelper . getFileContent ( TestsPlugin . getFile ( fileName + resultSuffix ) ) ; } public String getSource ( ) { return source ; } public
116
<s> package com . asakusafw . testdriver . rule ; import java . math . BigDecimal ; import java . text . MessageFormat ; public class DecimalRange implements ValuePredicate < BigDecimal > { private final BigDecimal lowerBound ; private final BigDecimal upperBound ; public DecimalRange ( BigDecimal lowerBound , BigDecimal upperBound ) { this . lowerBound = lowerBound ; this . upperBound = upperBound ; } @ Override public boolean accepts ( BigDecimal expected , BigDecimal actual ) { if ( expected ==
117
<s> package net . sf . sveditor . core . db ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db . expr . SVDBExpr ; public class SVDBBind extends SVDBChildItem implements ISVDBAddChildItem , ISVDBNamedItem { public SVDBExpr fTargetTypeName ; public List < SVDBExpr > fTargetInstNameList ; public SVDBModIfcInst fBindInst ; public SVDBBind ( ) { super ( SVDBItemType . Bind ) ; fTargetInstNameList = new ArrayList < SVDBExpr > ( ) ; } public String getName ( ) { return fTargetTypeName . toString ( ) ; }
118
<s> package net . sf . sveditor . ui . prop_pages ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . Tuple ; import net . sf . sveditor . core . db . project . SVProjectFileWrapper ; import net . sf . sveditor . ui . SVUiPlugin ; import org . eclipse . core . resources . IProject ; import org . eclipse . jface . viewers . ILabelProviderListener ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . IStructuredContentProvider ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . ITableLabelProvider ; import org . eclipse . jface . viewers . SelectionChangedEvent ; import org . eclipse . jface . viewers . TableViewer ; import org . eclipse . jface . viewers . TableViewerColumn ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; public class GlobalDefinesPage implements ISVProjectPropsPage , IStructuredContentProvider , ITableLabelProvider { private TableViewer fGlobalDefines ; private SVProjectFileWrapper fProjectWrapper ; private List < Tuple < String , String > > fDefineList ; private Button fAdd ; private Button fRemove ; private Button fEdit ; public GlobalDefinesPage ( IProject p ) { fDefineList = new ArrayList < Tuple < String , String > > ( ) ; } public void init ( SVProjectFileWrapper project_wrapper ) { fProjectWrapper = project_wrapper ; fDefineList . clear ( ) ; for ( Tuple < String , String > p : fProjectWrapper . getGlobalDefines ( ) ) { Tuple < String , String > dup = new Tuple < String , String > ( p . first ( ) , p . second ( ) ) ; fDefineList . add ( dup ) ; } } public Control createContents ( Composite parent ) { Composite frame = new Composite ( parent , SWT . NONE ) ; frame . setLayout ( new GridLayout ( 2 , false ) ) ; fGlobalDefines = new TableViewer ( frame , SWT . MULTI + SWT . BORDER ) ; fGlobalDefines . getTable ( ) . setHeaderVisible ( true ) ; fGlobalDefines . getTable ( ) . setLinesVisible ( true ) ; TableViewerColumn tc = new TableViewerColumn ( fGlobalDefines , SWT . NONE ) ; tc . getColumn ( ) . setText ( "Name" ) ; tc . getColumn ( ) . setWidth ( 100 ) ; tc = new TableViewerColumn ( fGlobalDefines , SWT . NONE ) ; tc . getColumn ( ) . setText ( "Value" ) ; tc . getColumn ( ) . setWidth ( 100 ) ; fGlobalDefines . getControl ( ) . setLayoutData ( new GridData ( SWT . FILL , SWT . FILL , true , true ) ) ; fGlobalDefines . setContentProvider ( this ) ; fGlobalDefines . setLabelProvider ( this ) ; fGlobalDefines . setInput ( fDefineList ) ; fGlobalDefines . addSelectionChangedListener ( new ISelectionChangedListener ( ) { public void selectionChanged ( SelectionChangedEvent event ) { updateSelection ( ) ; } } ) ; Composite button_bar = new Composite ( frame , SWT . NONE ) ; button_bar . setLayoutData ( new GridData ( SWT . FILL , SWT . FILL , false , true ) ) ; button_bar . setLayout ( new GridLayout ( 1 , true ) ) ; fAdd = new Button ( button_bar , SWT . PUSH ) ; fAdd . setText ( "Add" ) ; fAdd . setLayoutData ( new GridData ( SWT . FILL , SWT . CENTER , true , false ) ) ; fAdd . addSelectionListener ( new SelectionListener ( ) { public void widgetDefaultSelected ( SelectionEvent e ) { } public void widgetSelected ( SelectionEvent e ) { add ( ) ; } } ) ; fEdit = new Button ( button_bar , SWT . PUSH ) ; fEdit . setText ( "Edit" ) ; fEdit . setLayoutData ( new GridData ( SWT . FILL , SWT . CENTER , true , false ) ) ; fEdit . addSelectionListener ( new SelectionListener ( ) { public void widgetDefaultSelected ( SelectionEvent e ) { } public void widgetSelected ( SelectionEvent e ) { edit ( ) ; } } ) ; fRemove = new Button ( button_bar , SWT . PUSH ) ; fRemove . setText ( "Remove" ) ; fRemove . setLayoutData ( new GridData ( SWT . FILL , SWT . CENTER , true , false ) ) ; fRemove . addSelectionListener ( new SelectionListener ( ) { public void widgetDefaultSelected ( SelectionEvent e ) { } public void widgetSelected ( SelectionEvent e ) { remove ( ) ; } } ) ; updateSelection ( ) ; return frame ; } public Image getIcon ( ) { return SVUiPlugin . getImage ( "" ) ; } public String getName ( ) { return "" ; } public void perfomOk ( ) { fProjectWrapper . getGlobalDefines ( ) . clear ( ) ; for ( Tuple < String , String > p : fDefineList ) { Tuple < String , String > dup = new Tuple < String , String > ( p . first ( ) , p . second ( ) ) ; fProjectWrapper . getGlobalDefines ( ) . add ( dup ) ; } } public Object [ ] getElements ( Object inputElement ) { return fDefineList . toArray ( ) ; } public boolean isLabelProperty ( Object element , String property ) { return false ; } public Image getColumnImage ( Object element ,
119
<s> package com . asakusafw . windgate . core ; import java . io . IOException ; import java . text . MessageFormat ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; public abstract class BaseProfile < S extends BaseProfile < S , T > , T extends BaseProvider < S > > { static final WindGateLogger WGLOG = new WindGateCoreLogger ( BaseProfile . class ) ; static final Logger LOG = LoggerFactory . getLogger ( BaseProfile . class ) ; public static final char QUALIFIER = '.' ; public abstract Class < ? extends T > getProviderClass ( ) ; public abstract ProfileContext getContext ( ) ; @ Deprecated public ClassLoader getClassLoader ( ) { return getContext ( ) . getClassLoader ( ) ; } protected abstract S getThis ( ) ; protected static <
120
<s> package org . springframework . social . google . api . plus . person ; public class Address { private String type ; private String streetAddress ; private String locality ; private String region ; private String postalCode ; private String country ; private String formatted ; @ Override public String toString ( ) { return formatted ; } public String getType ( ) { return type ; } public String getStreetAddress ( ) { return streetAddress ; } public String getLocality ( ) { return locality ; } public String
121
<s> package net . sf . sveditor . core . db . search ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . SVDBInclude ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBModIfcDecl ; import net . sf . sveditor . core . db . SVDBPackageDecl ; import net . sf . sveditor . core . db . index . ISVDBIndexIterator ; public class SVDBPackageItemFinder { private ISVDBIndexIterator fIndexIt ; private ISVDBFindNameMatcher fMatcher ; public SVDBPackageItemFinder ( ISVDBIndexIterator index_it , ISVDBFindNameMatcher matcher ) { fIndexIt = index_it ; fMatcher = matcher ; } public List < SVDBItem > find ( SVDBPackageDecl pkg , String name ) { SVDBFindIncludedFile inc_finder = new SVDBFindIncludedFile ( fIndexIt
122
<s> package org . rubypeople . rdt . internal . ui . text . ruby . hover ; import org . eclipse . jface . text . IInformationControlCreator ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITextHoverExtension ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . jface . text . information . IInformationProviderExtension2 ; import org . eclipse . ui . IEditorPart ; import org . rubypeople . rdt . ui . text . ruby . hover . IRubyEditorTextHover ; public class RubyEditorTextHoverProxy extends AbstractRubyEditorTextHover implements ITextHoverExtension , IInformationProviderExtension2 { private RubyEditorTextHoverDescriptor fHoverDescriptor ; private IRubyEditorTextHover fHover ; public RubyEditorTextHoverProxy ( RubyEditorTextHoverDescriptor descriptor , IEditorPart editor ) { fHoverDescriptor = descriptor ; setEditor ( editor ) ; } public void setEditor ( IEditorPart editor ) { super . setEditor ( editor ) ; if ( fHover != null ) fHover . setEditor ( getEditor ( ) ) ; } public boolean isEnabled ( ) { return true ; } public IRegion getHoverRegion ( ITextViewer textViewer , int offset ) { if ( ensureHoverCreated ( ) ) return fHover . getHoverRegion ( textViewer , offset ) ; return null ; } public String getHoverInfo ( ITextViewer textViewer , IRegion hoverRegion ) { if ( ensureHoverCreated ( ) ) return fHover . getHoverInfo ( textViewer , hoverRegion ) ; return null ; } private boolean ensureHoverCreated ( ) { if ( ! isEnabled ( ) || fHoverDescriptor == null ) return false ; return isCreated ( )
123
<s> package org . oddjob . framework ; import java . lang . annotation . ElementType ; import java . lang . annotation . Retention ; import java . lang . annotation .
124
<s> package com . asakusafw . compiler . bootstrap ; import java . io . File ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . net . URL ; import java . net . URLClassLoader ; import java . security . AccessController ; import java . security . PrivilegedAction ; import java . text . MessageFormat ; import java . util . List ; import org . apache . commons . cli . BasicParser ; import org . apache . commons . cli . CommandLine ; import org . apache . commons . cli . CommandLineParser ; import org . apache . commons . cli . HelpFormatter ; import org . apache . commons . cli . Option ; import org . apache . commons . cli . Options ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . batch . BatchDriver ; import com . asakusafw . compiler . flow . FlowCompilerOptions ; import com . asakusafw . compiler . flow . Location ; import com . asakusafw . compiler . testing . DirectBatchCompiler ; import com . asakusafw . utils . collections . Lists ; import com . asakusafw . vocabulary . batch . BatchDescription ; public final class BatchCompilerDriver { static final Logger LOG = LoggerFactory . getLogger ( BatchCompilerDriver . class ) ; private static final Option OPT_OUTPUT ; private static final Option OPT_PACKAGE ; private static final Option OPT_HADOOPWORK ; private static final Option OPT_COMPILERWORK ; private static final Option OPT_LINK ; private static final Option OPT_PLUGIN ; private static final Option OPT_CLASS ; private static final Options OPTIONS ; static { OPT_OUTPUT = new Option ( "output" , true , "" ) ; OPT_OUTPUT . setArgName ( "" ) ; OPT_OUTPUT . setValueSeparator ( File . pathSeparatorChar ) ; OPT_OUTPUT . setRequired ( true ) ; OPT_PACKAGE = new Option ( "package" , true , "" ) ; OPT_PACKAGE . setArgName ( "pkg.name" ) ; OPT_PACKAGE . setRequired ( true ) ; OPT_HADOOPWORK = new Option ( "hadoopwork" , true , "" ) ; OPT_HADOOPWORK . setArgName ( "" ) ; OPT_HADOOPWORK . setRequired ( true ) ; OPT_COMPILERWORK = new Option ( "compilerwork" , true , "" ) ; OPT_COMPILERWORK . setArgName ( "" ) ; OPT_COMPILERWORK . setRequired ( false ) ; OPT_LINK = new Option ( "link" , true , "" ) ; OPT_LINK . setArgName ( "classlib.jar" + File . pathSeparatorChar + "" ) ; OPT_PLUGIN = new Option ( "plugin" , true , "" ) ; OPT_PLUGIN . setArgName ( "plugin-1.jar" + File . pathSeparatorChar + "plugin-2.jar" ) ; OPT_PLUGIN . setRequired ( false ) ; OPT_CLASS = new Option ( "class" , true , "" ) ; OPT_CLASS . setArgName ( "class-name" ) ; OPT_CLASS . setRequired ( true ) ; OPTIONS = new Options ( ) ; OPTIONS . addOption ( OPT_OUTPUT ) ; OPTIONS . addOption ( OPT_PACKAGE ) ; OPTIONS . addOption ( OPT_HADOOPWORK ) ; OPTIONS . addOption ( OPT_COMPILERWORK ) ; OPTIONS . addOption ( OPT_LINK ) ; OPTIONS . addOption ( OPT_PLUGIN ) ; OPTIONS . addOption ( OPT_CLASS ) ; } public static void main ( String ... args ) { try { if ( start ( args ) == false ) { System . exit ( 1 ) ; } } catch ( Exception e ) { HelpFormatter formatter = new HelpFormatter ( ) ; formatter . setWidth ( Integer . MAX_VALUE ) ; formatter . printHelp ( MessageFormat . format ( "" , BatchCompilerDriver . class . getName ( ) ) , OPTIONS , true ) ; e . printStackTrace ( System . out ) ; System . exit ( 1 ) ; } } private static boolean start ( String [ ] args ) throws Exception { CommandLineParser parser = new BasicParser ( ) ; CommandLine cmd = parser . parse ( OPTIONS , args ) ; String output = cmd . getOptionValue ( OPT_OUTPUT . getOpt ( ) ) ; String className = cmd . getOptionValue ( OPT_CLASS . getOpt ( ) ) ; String packageName = cmd . getOptionValue ( OPT_PACKAGE . getOpt ( ) ) ; String hadoopWork = cmd . getOptionValue ( OPT_HADOOPWORK . getOpt ( ) ) ; String compilerWork = cmd . getOptionValue ( OPT_COMPILERWORK . getOpt ( ) ) ; String link = cmd . getOptionValue ( OPT_LINK . getOpt ( ) ) ; String plugin = cmd . getOptionValue ( OPT_PLUGIN . getOpt ( ) ) ; File outputDirectory = new File ( output ) ; Location hadoopWorkLocation = Location . fromPath ( hadoopWork , '/' ) ; File compilerWorkDirectory = new File ( compilerWork ) ; List < File > linkingResources = Lists . create ( ) ; if ( link != null ) { for ( String s : link .
125
<s> package org . rubypeople . rdt . internal . ui . preferences ; import java . io . BufferedReader ; import java . io . File ; import java . io . IOException ; import java . io . InputStreamReader ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . Map ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . Preferences ; import org . eclipse . jface . dialogs . Dialog ; import org . eclipse . jface . dialogs . MessageDialog ; import org . eclipse . jface . preference . ColorSelector ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . preference . PreferenceConverter ; import org . eclipse . jface . resource . JFaceResources ; import org . eclipse . jface . text . Document ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . LabelProvider ; import org . eclipse . jface . viewers . SelectionChangedEvent ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . jface . viewers . StructuredViewer ; import org . eclipse . jface . viewers . TreeViewer ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerSorter ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . SelectionAdapter ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . graphics . Font ; import org . eclipse . swt . graphics . FontMetrics ; import org . eclipse . swt . graphics . GC ; import org . eclipse . swt . graphics . RGB ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . FileDialog ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . Link ; import org . eclipse . swt . widgets . ScrollBar ; import org . eclipse . swt . widgets . Scrollable ; import org . eclipse . ui . dialogs . PreferencesUtil ; import org . eclipse . ui . editors . text . EditorsUI ; import org . eclipse . ui . texteditor . ChainedPreferenceStore ; 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 . rubyeditor . RubySourceViewer ; import org . rubypeople . rdt . internal . ui . text . IRubyColorConstants ; import org . rubypeople . rdt . internal . ui . text . IRubyPartitions ; import org . rubypeople . rdt . internal . ui . text . PreferencesAdapter ; import org . rubypeople . rdt . internal . ui . text . RubyColorManager ; import org . rubypeople . rdt . internal . ui . text . SimpleRubySourceViewerConfiguration ; import org . rubypeople . rdt . internal . ui . util . ExceptionHandler ; import org . rubypeople . rdt . internal . ui . util . PixelConverter ; import org . rubypeople . rdt . internal . ui . util . SWTUtil ; import org . rubypeople . rdt . ui . PreferenceConstants ; import org . rubypeople . rdt . ui . RubyUI ; import org . rubypeople . rdt . ui . text . IColorManager ; class RubyEditorColoringConfigurationBlock extends AbstractConfigurationBlock { private static final String DIALOGSTORE_LASTLOADPATH = RubyUI . ID_PLUGIN + "" ; private static final String DIALOGSTORE_LASTSAVEPATH = RubyUI . ID_PLUGIN + "" ; public static class HighlightingColorListItem { private String fDisplayName ; private String fColorKey ; private String fBoldKey ; private String fBackgroundKey ; private String fItalicKey ; private String fStrikethroughKey ; private String fUnderlineKey ; private String fBackgroundEnabledKey ; public HighlightingColorListItem ( String displayName , String colorKey , String bgColorKey , String bgEnabledKey , String boldKey , String italicKey , String strikethroughKey , String underlineKey ) { fDisplayName = displayName ; fColorKey = colorKey ; fBackgroundKey = bgColorKey ; fBackgroundEnabledKey = bgEnabledKey ; fBoldKey = boldKey ; fItalicKey = italicKey ; fStrikethroughKey = strikethroughKey ; fUnderlineKey = underlineKey ; } public String getBoldKey ( ) { return fBoldKey ; } public String getBackgroundKey ( ) { return fBackgroundKey ; } public String getItalicKey ( ) { return fItalicKey ; } public String getStrikethroughKey ( ) { return fStrikethroughKey ; } public String getUnderlineKey ( ) { return fUnderlineKey ; } public String getColorKey ( ) { return fColorKey ; } public String getDisplayName ( ) { return fDisplayName ; } public String getBackgroundEnabledKey ( ) { return fBackgroundEnabledKey ; } } private static class SemanticHighlightingColorListItem extends HighlightingColorListItem { private final String fEnableKey ; public SemanticHighlightingColorListItem ( String displayName , String colorKey , String bgColorKey , String bgEnabledKey , String boldKey , String italicKey , String strikethroughKey , String underlineKey , String enableKey ) { super ( displayName , colorKey , bgColorKey , bgEnabledKey , boldKey , italicKey , strikethroughKey , underlineKey ) ; fEnableKey = enableKey ; } public String getEnableKey ( ) { return fEnableKey ; } } private class ColorListLabelProvider extends LabelProvider { public String getText ( Object element ) { if ( element instanceof String ) return ( String ) element ; return ( ( HighlightingColorListItem ) element ) . getDisplayName ( ) ; } } private class ColorListContentProvider implements ITreeContentProvider { public Object [ ] getElements ( Object inputElement ) { return new String [ ] { fRubyCategory } ; } public void dispose ( ) { } public void inputChanged ( Viewer viewer , Object oldInput , Object newInput ) { } public Object [ ] getChildren ( Object parentElement ) { if ( parentElement instanceof String ) { String entry = ( String ) parentElement ; if ( fRubyCategory . equals ( entry ) ) return fListModel . toArray ( ) ; } return new Object [ 0 ] ; } public Object getParent ( Object element ) { if ( element instanceof String ) return null ; return fRubyCategory ; } public boolean hasChildren ( Object element ) { return element instanceof String ; } } private static final String BOLD = PreferenceConstants . EDITOR_BOLD_SUFFIX ; private static final String BACKGROUND = PreferenceConstants . EDITOR_BG_SUFFIX ; private static final String BACKGROUND_ENABLED = PreferenceConstants . EDITOR_BG_ENABLED_SUFFIX ; private static final String ITALIC = PreferenceConstants . EDITOR_ITALIC_SUFFIX ; private static final String STRIKETHROUGH = PreferenceConstants . EDITOR_STRIKETHROUGH_SUFFIX ; private static final String UNDERLINE = PreferenceConstants . EDITOR_UNDERLINE_SUFFIX ; private static final String COMPILER_TASK_TAGS = RubyCore . COMPILER_TASK_TAGS ; private final String [ ] [ ] fSyntaxColorListModel = new String [ ] [ ] { { PreferencesMessages . RubyEditorPreferencePage_multiLineComment , IRubyColorConstants . RUBY_MULTI_LINE_COMMENT } , { PreferencesMessages . RubyEditorPreferencePage_singleLineComment , IRubyColorConstants . RUBY_SINGLE_LINE_COMMENT } , { PreferencesMessages . RubyEditorPreferencePage_rubyCommentTaskTags , IRubyColorConstants . TASK_TAG } , { PreferencesMessages . RubyEditorPreferencePage_keywords , IRubyColorConstants . RUBY_KEYWORD } , { PreferencesMessages . RubyEditorPreferencePage_strings , IRubyColorConstants . RUBY_STRING } , { PreferencesMessages . RubyEditorPreferencePage_characters , IRubyColorConstants . RUBY_CHARACTER } , { PreferencesMessages . RubyEditorPreferencePage_commands , IRubyColorConstants . RUBY_COMMAND } , { PreferencesMessages . RubyEditorPreferencePage_fixnums , IRubyColorConstants . RUBY_FIXNUM } , { PreferencesMessages . RubyEditorPreferencePage_globals , IRubyColorConstants . RUBY_GLOBAL } , { PreferencesMessages . RubyEditorPreferencePage_regular_expressions , IRubyColorConstants . RUBY_REGEXP } , { PreferencesMessages . RubyEditorPreferencePage_symbols , IRubyColorConstants . RUBY_SYMBOL } , { PreferencesMessages . RubyEditorPreferencePage_instance_variables , IRubyColorConstants . RUBY_INSTANCE_VARIABLE } , { PreferencesMessages . RubyEditorPreferencePage_class_variables , IRubyColorConstants . RUBY_CLASS_VARIABLE } , { PreferencesMessages . RubyEditorPreferencePage_others , IRubyColorConstants . RUBY_DEFAULT } } ; private final String fRubyCategory = PreferencesMessages . RubyEditorPreferencePage_coloring_category_ruby ; private ColorSelector fSyntaxForegroundColorEditor ; private ColorSelector fSyntaxBackgroundColorEditor ; private Label fColorEditorLabel ; private Button fBoldCheckBox ; private Button fEnableCheckbox ; private Button fItalicCheckBox ; private Button fStrikethroughCheckBox ; private Button fUnderlineCheckBox ; private final java . util . List fListModel = new ArrayList ( ) ; private StructuredViewer fListViewer ; private RubySourceViewer fPreviewViewer ; private IColorManager fColorManager ; private FontMetrics fFontMetrics ; private Button fLoadButton ; private Button fSaveButton ; private Composite fComposite ; private Button fEnableBackgroundCheckbox ; public RubyEditorColoringConfigurationBlock ( OverlayPreferenceStore store ) { super ( store ) ; fColorManager = new RubyColorManager ( false ) ; for ( int i = 0 , n = fSyntaxColorListModel . length ; i < n ; i ++ ) fListModel . add ( new HighlightingColorListItem ( fSyntaxColorListModel [ i ] [ 0 ] , fSyntaxColorListModel [ i ] [ 1 ] , fSyntaxColorListModel [ i ] [ 1 ] + BACKGROUND , fSyntaxColorListModel [ i ] [ 1 ] + BACKGROUND_ENABLED , fSyntaxColorListModel [ i ] [ 1 ] + BOLD , fSyntaxColorListModel [ i ] [ 1 ] + ITALIC , fSyntaxColorListModel [ i ] [ 1 ] + STRIKETHROUGH , fSyntaxColorListModel [ i ] [ 1 ] + UNDERLINE ) ) ; store . addKeys ( createOverlayStoreKeys ( ) ) ; } private OverlayPreferenceStore . OverlayKey [ ] createOverlayStoreKeys ( ) { ArrayList overlayKeys = new ArrayList ( ) ; for ( int i = 0 , n = fListModel . size ( ) ; i < n ; i ++ ) { HighlightingColorListItem item = ( HighlightingColorListItem ) fListModel . get ( i ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . STRING , item . getColorKey ( ) ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . STRING , item . getBackgroundKey ( ) ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , item . getBackgroundEnabledKey ( ) ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , item . getBoldKey ( ) ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , item . getItalicKey ( ) ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , item . getStrikethroughKey ( ) ) ) ; overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , item . getUnderlineKey ( ) ) ) ; if ( item instanceof SemanticHighlightingColorListItem ) overlayKeys . add ( new OverlayPreferenceStore . OverlayKey ( OverlayPreferenceStore . BOOLEAN , ( ( SemanticHighlightingColorListItem ) item ) . getEnableKey ( ) ) ) ; } OverlayPreferenceStore . OverlayKey [ ] keys = new OverlayPreferenceStore . OverlayKey [ overlayKeys . size ( ) ] ; overlayKeys . toArray ( keys ) ; return keys ; } public Control createControl ( Composite parent ) { initializeDialogUnits ( parent ) ; return createSyntaxPage ( parent ) ; } private int convertWidthInCharsToPixels ( int chars ) { if ( fFontMetrics == null ) return 0 ; return Dialog . convertWidthInCharsToPixels ( fFontMetrics , chars ) ; } private int convertHeightInCharsToPixels ( int chars ) { if ( fFontMetrics == null ) return 0 ; return Dialog . convertHeightInCharsToPixels ( fFontMetrics , chars ) ; } public void initialize ( ) { super . initialize ( ) ; fListViewer . setInput ( fListModel ) ; fListViewer . setSelection ( new StructuredSelection ( fRubyCategory ) ) ; } public void performDefaults ( ) { super . performDefaults ( ) ; handleSyntaxColorListSelection ( ) ; fPreviewViewer . invalidateTextPresentation ( ) ; } public void dispose ( ) { fColorManager . dispose ( ) ; super . dispose ( ) ; } private void handleSyntaxColorListSelection ( ) { HighlightingColorListItem item = getHighlightingColorListItem ( ) ; if ( item == null ) { fEnableCheckbox . setEnabled ( false ) ; fSyntaxForegroundColorEditor . getButton ( ) . setEnabled ( false ) ; fSyntaxBackgroundColorEditor . getButton ( ) . setEnabled ( false ) ; fColorEditorLabel . setEnabled ( false ) ; fBoldCheckBox . setEnabled ( false ) ; fItalicCheckBox . setEnabled ( false ) ; fStrikethroughCheckBox . setEnabled ( false ) ; fUnderlineCheckBox . setEnabled ( false ) ; return ; } RGB rgb = PreferenceConverter . getColor ( getPreferenceStore ( ) , item . getColorKey ( ) ) ; fSyntaxForegroundColorEditor . setColorValue ( rgb ) ; rgb = PreferenceConverter . getColor ( getPreferenceStore ( ) , item . getBackgroundKey ( ) ) ; fSyntaxBackgroundColorEditor . setColorValue ( rgb ) ; fBoldCheckBox . setSelection ( getPreferenceStore ( ) . getBoolean ( item . getBoldKey ( ) ) ) ; fItalicCheckBox . setSelection ( getPreferenceStore ( ) . getBoolean ( item . getItalicKey ( ) ) ) ; fStrikethroughCheckBox . setSelection ( getPreferenceStore ( ) . getBoolean ( item . getStrikethroughKey ( ) ) ) ; fUnderlineCheckBox . setSelection ( getPreferenceStore ( ) . getBoolean ( item . getUnderlineKey ( ) ) ) ; if ( item instanceof SemanticHighlightingColorListItem ) { fEnableCheckbox . setEnabled ( true ) ; boolean enable = getPreferenceStore ( ) . getBoolean ( ( ( SemanticHighlightingColorListItem ) item ) . getEnableKey ( ) ) ; fEnableCheckbox . setSelection ( enable ) ; fSyntaxForegroundColorEditor . getButton ( ) . setEnabled ( enable ) ; fColorEditorLabel . setEnabled ( enable ) ; fBoldCheckBox . setEnabled ( enable ) ; fItalicCheckBox . setEnabled ( enable ) ; fStrikethroughCheckBox . setEnabled ( enable ) ; fUnderlineCheckBox . setEnabled ( enable ) ; fEnableBackgroundCheckbox . setEnabled ( enable ) ; boolean bgEnabled = getPreferenceStore ( ) . getBoolean ( ( ( SemanticHighlightingColorListItem ) item ) . getBackgroundEnabledKey ( ) ) ; fEnableBackgroundCheckbox . setSelection ( bgEnabled ) ; fSyntaxBackgroundColorEditor . getButton ( ) . setEnabled ( bgEnabled ) ; } else { fSyntaxForegroundColorEditor . getButton ( ) . setEnabled ( true ) ; fColorEditorLabel . setEnabled ( true ) ; fBoldCheckBox . setEnabled ( true ) ; fItalicCheckBox . setEnabled ( true ) ; fStrikethroughCheckBox . setEnabled ( true ) ; fUnderlineCheckBox . setEnabled ( true ) ; fEnableCheckbox . setEnabled ( false ) ; fEnableCheckbox . setSelection ( true ) ; fEnableBackgroundCheckbox . setEnabled ( true ) ; boolean bgEnabled = getPreferenceStore ( ) . getBoolean ( item . getBackgroundEnabledKey ( ) ) ; fEnableBackgroundCheckbox . setSelection ( bgEnabled ) ; fSyntaxBackgroundColorEditor . getButton ( ) . setEnabled ( bgEnabled ) ; } } private Control createSyntaxPage ( final Composite parent ) { Composite colorComposite = new Composite ( parent , SWT . NONE ) ; fComposite = colorComposite ; GridLayout layout = new GridLayout ( ) ; layout . marginHeight = 0 ; layout . marginWidth = 0 ; colorComposite . setLayout ( layout ) ; Link link = new Link ( colorComposite , SWT . NONE ) ; link . setText ( PreferencesMessages . RubyEditorColoringConfigurationBlock_link ) ; link . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { PreferencesUtil . createPreferenceDialogOn ( parent . getShell ( ) , e . text , null , null ) ; } } ) ; GridData gridData = new GridData ( SWT . FILL , SWT . BEGINNING , true , false ) ; gridData . widthHint = 150 ; gridData . horizontalSpan = 2 ; link . setLayoutData ( gridData ) ; addFiller ( colorComposite , 1 ) ; final Composite group = createComposite ( colorComposite , 4 ) ; final GridData groupData = new GridData ( GridData . HORIZONTAL_ALIGN_FILL ) ; groupData . horizontalSpan = 4 ; group . setLayoutData ( groupData ) ; fLoadButton = createButton ( group , "Import" , GridData . HORIZONTAL_ALIGN_END ) ; fSaveButton = createButton ( group , "Export" , GridData . HORIZONTAL_ALIGN_END ) ; new ButtonController ( ) ; Label label ; label = new Label ( colorComposite , SWT . LEFT ) ; label . setText ( PreferencesMessages . RubyEditorPreferencePage_coloring_element ) ; label . setLayoutData ( new GridData ( GridData . FILL_HORIZONTAL ) ) ; Composite editorComposite = new Composite ( colorComposite , SWT . NONE ) ; layout = new GridLayout ( ) ; layout . numColumns = 2 ; layout . marginHeight = 0 ; layout . marginWidth = 0 ; editorComposite . setLayout ( layout ) ; GridData gd = new GridData ( SWT . FILL , SWT . BEGINNING , true , false ) ; editorComposite . setLayoutData ( gd ) ; fListViewer = new TreeViewer ( editorComposite , SWT . SINGLE | SWT . BORDER ) ; fListViewer . setLabelProvider ( new ColorListLabelProvider ( ) ) ; fListViewer . setContentProvider ( new ColorListContentProvider ( ) ) ; fListViewer . setSorter ( new ViewerSorter ( ) { public int category ( Object element ) { if ( fRubyCategory . equals ( element ) ) return 0 ; return 0 ; } } ) ; gd = new GridData ( SWT . BEGINNING , SWT . BEGINNING , false , true ) ; gd . heightHint = convertHeightInCharsToPixels ( 9 ) ; int maxWidth = 0 ; for ( Iterator it = fListModel . iterator ( ) ; it . hasNext ( ) ; ) { HighlightingColorListItem item = ( HighlightingColorListItem ) it . next ( ) ; maxWidth = Math . max ( maxWidth , convertWidthInCharsToPixels ( item . getDisplayName ( ) . length ( ) ) ) ; } ScrollBar vBar = ( ( Scrollable ) fListViewer . getControl ( ) ) . getVerticalBar ( ) ; if ( vBar != null ) maxWidth += vBar . getSize ( ) . x * 3 ; gd . widthHint = maxWidth ; fListViewer . getControl ( ) . setLayoutData ( gd ) ; Composite stylesComposite = new Composite ( editorComposite , SWT . NONE ) ; layout = new GridLayout ( ) ; layout . marginHeight = 0 ; layout . marginWidth = 0 ; layout . numColumns = 2 ; stylesComposite . setLayout ( layout ) ; stylesComposite . setLayoutData ( new GridData ( GridData . FILL_BOTH ) ) ; fEnableCheckbox = new Button ( stylesComposite , SWT . CHECK ) ; fEnableCheckbox . setText ( PreferencesMessages . RubyEditorPreferencePage_enable ) ; gd = new GridData ( GridData . FILL_HORIZONTAL ) ; gd . horizontalAlignment = GridData . BEGINNING ; gd . horizontalSpan = 2 ; fEnableCheckbox . setLayoutData ( gd ) ; fColorEditorLabel = new Label ( stylesComposite , SWT . LEFT ) ; fColorEditorLabel . setText ( PreferencesMessages . RubyEditorPreferencePage_color ) ; gd = new GridData ( GridData . HORIZONTAL_ALIGN_BEGINNING ) ; gd . horizontalIndent = 20 ; fColorEditorLabel
126
<s> package org . oddjob . schedules . schedules ; import java . text . ParseException ; import java . util . Date ; import junit . framework . TestCase ; import org . oddjob . OddjobSessionFactory ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . standard . StandardFragmentParser ; import org . oddjob . arooa . utils . DateHelper ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . schedules . Interval ; import org . oddjob . schedules . IntervalTo ; import org . oddjob . schedules . Schedule ; import org . oddjob . schedules . ScheduleContext ; import org . oddjob . schedules . ScheduleList ; import org . oddjob . schedules . ScheduleResult ; import org . oddjob . schedules . ScheduleRoller ; import org . oddjob . schedules . SimpleScheduleResult ; import org . oddjob . schedules . units . DayOfWeek ; import org . oddjob . schedules . units . Month ; public class DayBeforeScheduleTest extends TestCase { public void testDayBeforeInterval ( ) throws ParseException { DayBeforeSchedule test = new DayBeforeSchedule ( ) ; ScheduleContext context = new ScheduleContext ( new Date ( ) ) ; context = context . spawn ( new Date ( ) , new IntervalTo ( DateHelper . parseDate ( "2011-09-15" ) , DateHelper . parseDate ( "2011-09-16"
127
<s> package org . rubypeople . rdt . internal . ui . callhierarchy ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Status ; import org . eclipse . jface . dialogs . ErrorDialog ; import org . eclipse . jface . dialogs . MessageDialog ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . util . Assert ; import org . eclipse . jface . util . OpenStrategy ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . IWorkbenchPage ; import org . eclipse . ui . IWorkbenchWindow ; import org . eclipse . ui . PartInitException ; import org . eclipse . ui . texteditor . ITextEditor ; import org . rubypeople . rdt . core . IMember ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . ISourceRange ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . callhierarchy . CallHierarchy ; import org . rubypeople . rdt . internal . corext . callhierarchy . CallLocation ; import org . rubypeople . rdt . internal . corext . callhierarchy . MethodWrapper ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . ui . IRubyStatusConstants ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . actions . OpenActionUtil ; import org . rubypeople . rdt . internal . ui . rubyeditor . EditorUtility ; import org . rubypeople . rdt . internal . ui . util . ExceptionHandler ; import org . rubypeople . rdt . ui . RubyUI ; public class CallHierarchyUI { private static final int DEFAULT_MAX_CALL_DEPTH = 10 ; private static final String PREF_MAX_CALL_DEPTH = "" ; private static CallHierarchyUI fgInstance ; private CallHierarchyUI ( ) { } public static CallHierarchyUI getDefault ( ) { if ( fgInstance == null ) { fgInstance = new CallHierarchyUI ( ) ; } return fgInstance ; } public int getMaxCallDepth ( ) { int maxCallDepth ; IPreferenceStore settings = RubyPlugin . getDefault ( ) . getPreferenceStore ( ) ; maxCallDepth = settings . getInt ( PREF_MAX_CALL_DEPTH ) ; if ( maxCallDepth < 1 || maxCallDepth > 99 ) { maxCallDepth = DEFAULT_MAX_CALL_DEPTH ; } return maxCallDepth ; } public void setMaxCallDepth ( int maxCallDepth ) { IPreferenceStore settings = RubyPlugin . getDefault ( ) . getPreferenceStore ( ) ; settings . setValue ( PREF_MAX_CALL_DEPTH , maxCallDepth ) ; } public static void jumpToMember ( IRubyElement element ) { if ( element != null ) { try { IEditorPart methodEditor = EditorUtility . openInEditor ( element , true ) ; RubyUI . revealInEditor ( methodEditor , element ) ; } catch ( RubyModelException e ) { RubyPlugin . log ( e ) ; } catch ( PartInitException e ) { RubyPlugin . log ( e ) ; } } } public static void jumpToLocation ( CallLocation callLocation ) { try { IEditorPart methodEditor = EditorUtility . openInEditor ( callLocation . getMember ( ) , false ) ; if ( methodEditor instanceof ITextEditor ) { ITextEditor editor = ( ITextEditor ) methodEditor ; editor . selectAndReveal ( callLocation . getStart ( ) , ( callLocation . getEnd ( ) - callLocation . getStart ( ) ) ) ; } } catch ( RubyModelException e ) { RubyPlugin . log ( e ) ; } catch ( PartInitException e ) { RubyPlugin . log ( e ) ; } } public static boolean openInEditor ( Object element , Shell shell , String title ) { CallLocation callLocation = CallHierarchy . getCallLocation ( element ) ; try { IMember enclosingMember ; int selectionStart ; int selectionLength ; if ( callLocation != null ) { enclosingMember = callLocation . getMember ( ) ; selectionStart = callLocation . getStart ( ) ; selectionLength = callLocation . getEnd ( ) - selectionStart ; } else if ( element instanceof MethodWrapper ) { enclosingMember = ( ( MethodWrapper ) element ) . getMember ( ) ; ISourceRange selectionRange = enclosingMember . getNameRange ( ) ; if ( selectionRange == null ) selectionRange = enclosingMember . getSourceRange ( ) ; if ( selectionRange == null ) return true ; selectionStart = selectionRange . getOffset ( ) ; selectionLength = selectionRange . getLength ( ) ; } else { return true ; } boolean activateOnOpen = OpenStrategy .
128
<s> package com . asakusafw . vocabulary . flow . util ; import static com . asakusafw . vocabulary . flow . util . PseudElementDescription . * ; import java . lang . reflect . Type ; import java . util . ArrayList ; import java . util . List ; import com . asakusafw . vocabulary . flow . Operator ; import com . asakusafw . vocabulary . flow . Source ; import com . asakusafw . vocabulary . flow . graph . FlowBoundary ; import com . asakusafw . vocabulary . flow . graph . FlowElementOutput ; import com . asakusafw . vocabulary . flow . graph . FlowElementResolver ; import com . asakusafw . vocabulary . flow . graph . OperatorDescription ; public class CoreOperatorFactory { public static final String EMPTY_NAME = "empty" ; public static final String STOP_NAME = "stop" ; public static final String CONFLUENT_NAME = "confluent" ; public static final String CHECKPOINT_NAME = "checkpoint" ; public static final String PROJECT_NAME = "project" ; public static final String EXTEND_NAME = "extend" ; public static final String RESTRUCTURE_NAME = "restructure" ; public < T > Empty < T > empty ( Class < T > type ) { return empty ( ( Type ) type ) ; } public < T > Empty < T > empty ( Type type ) { if ( type == null ) { throw new IllegalArgumentException ( "" ) ; } return new Empty < T > ( type ) ; } public void stop ( Source < ? > in ) { if ( in == null ) { throw new IllegalArgumentException ( "" ) ; } PseudElementDescription desc = new PseudElementDescription ( STOP_NAME , getPortType ( in ) , true , false , FlowBoundary . STAGE ) ; FlowElementResolver resolver = new FlowElementResolver ( desc ) ; resolver . resolveInput ( INPUT_PORT_NAME , in ) ; } public < T > Confluent < T > confluent ( Source < T > a , Source < T > b ) { if ( a == null ) { throw new IllegalArgumentException ( "" ) ; } if ( b == null ) { throw new IllegalArgumentException ( "" ) ; } Type type = getPortType ( a ) ; List < Source < T > > input = new ArrayList < Source < T > > ( ) ; input . add ( a ) ; input . add ( b ) ; return new Confluent < T > ( type , input ) ; } public < T > Confluent < T > confluent ( Source < T > a , Source < T > b , Source < T > c ) { if ( a == null ) { throw new IllegalArgumentException ( "" ) ; } if ( b == null ) { throw new IllegalArgumentException ( "" ) ; } if ( c == null ) { throw new IllegalArgumentException ( "" ) ; } Type type = getPortType ( a ) ; List < Source < T > > input = new ArrayList < Source < T > > ( ) ; input . add ( a ) ; input . add ( b ) ; input . add ( c ) ; return new Confluent < T > ( type , input ) ; } public < T > Confluent < T > confluent ( Source < T > a , Source < T > b , Source < T > c , Source < T > d ) { if ( a == null ) { throw new IllegalArgumentException ( "" ) ; } if ( b == null ) { throw new IllegalArgumentException ( "" ) ; } if ( c == null ) { throw new IllegalArgumentException ( "" ) ; } if ( d == null ) { throw new IllegalArgumentException ( "" ) ; } Type type = getPortType ( a ) ; List < Source < T > > input = new ArrayList < Source < T > > ( ) ; input . add ( a ) ; input . add ( b ) ; input . add ( c ) ; input . add ( d ) ; return new Confluent < T > ( type , input ) ; } public < T > Confluent < T > confluent ( Iterable < ? extends Source < T > > inputs ) { if ( inputs == null ) { throw new IllegalArgumentException ( "" ) ; } List < Source < T > > input = new ArrayList < Source < T > > ( ) ; for ( Source < T > in : inputs ) { if ( in == null ) { throw new IllegalArgumentException ( "" ) ; } input . add ( in ) ; } if ( input . isEmpty ( ) ) { throw new IllegalArgumentException ( "" ) ; } Type type = getPortType ( input . get ( 0 ) ) ; return new Confluent < T > ( type , input ) ; } public < T > Checkpoint < T > checkpoint ( Source < T > in ) { if ( in == null ) { throw new IllegalArgumentException ( "" ) ; } Type type = getPortType ( in ) ; return new Checkpoint < T > ( type , in ) ; } public < T > Project < T > project ( Source < ? > in , Class < T > targetType ) { if ( in == null ) { throw new IllegalArgumentException ( "" ) ; } if ( targetType == null ) { throw new IllegalArgumentException ( "" ) ; } return new Project < T > ( in , targetType ) ; } public < T > Extend < T > extend ( Source < ? > in , Class < T > targetType ) { if ( in == null ) { throw new IllegalArgumentException ( "" ) ; } if ( targetType == null ) { throw new IllegalArgumentException ( "" ) ; } return
129
<s> package de . fuberlin . wiwiss . d2rq . map ; import com . hp . hpl . jena . rdf . model . Resource ; import de . fuberlin . wiwiss . d2rq . D2RQException ; public class Configuration extends MapObject { private boolean serveVocabulary = true ; private boolean
130
<s> package com . asakusafw . utils . java . model . syntax ; public enum LiteralKind { INT , LONG , FLOAT , DOUBLE , CHAR , BOOLEAN , STRING , NULL , ; public static final
131
<s> package com . asakusafw . yaess . bootstrap ; import java . io . BufferedInputStream ; import java . io . File ; import java . io . FileInputStream ; import java . io . FileNotFoundException ; import java . io . IOException ; import java . net . URL ; import java . net . URLClassLoader ; import java . security . AccessController ; import java . security . PrivilegedAction ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import java . util . Properties ; import java . util . TreeMap ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import org . slf4j . MDC ; import com . asakusafw . yaess . core . YaessLogger ; public final class CommandLineUtil { static final YaessLogger YSLOG = new YaessBootstrapLogger ( CommandLineUtil . class ) ; static final Logger LOG = LoggerFactory . getLogger ( CommandLineUtil . class ) ; public static final String LOG_CONTEXT_PREFIX = "" ; public static final String SCHEME_CLASSPATH = "classpath" ; public static void prepareLogContext ( ) { Map < String , String > registered = new TreeMap < String , String > ( ) ; Properties properties = System . getProperties ( ) ; for ( Map . Entry < Object , Object >
132
<s> package fi . koku . services . utility . log . v1 ; import java . net . URL ; import javax . xml . namespace . QName ; import javax . xml . ws . BindingProvider ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; public class LogServiceFactory { private String uid ; private String pwd ; private String endpointBaseUrl ; private final URL wsdlLocation = getClass ( ) . getClassLoader ( ) . getResource ( "" ) ; private static Logger log = LoggerFactory . getLogger ( LogServiceFactory . class ) ; public LogServiceFactory ( String uid , String pwd , String endpointBaseUrl ) { this . uid
133
<s> package com . asakusafw . windgate . hadoopfs ; import java . io . IOException ; import java . text . MessageFormat ; import org . apache . hadoop . conf . Configuration ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . windgate . core . ParameterList ; import com . asakusafw . windgate . core . resource . ResourceMirror ; import com . asakusafw . windgate . core . resource . ResourceProfile ; import com . asakusafw . windgate . core . resource . ResourceProvider ; public class HadoopFsProvider extends ResourceProvider { static final Logger LOG = LoggerFactory . getLogger ( HadoopFsProvider . class ) ; private volatile Configuration configuration ; private volatile HadoopFsProfile hfsProfile ; @ Override protected void configure (
134
<s> package net . sf . sveditor . core . db . persistence ; import java . io . DataInput ; import java . io . DataOutput ; import java . util . HashSet ; import java . util . Set ; import net . sf . sveditor . core . db . SVDBItemType ; @ SuppressWarnings ( "rawtypes" ) public abstract class SVDBPersistenceRWDelegateBase extends SVDBPersistenceRWBase implements ISVDBPersistenceRWDelegate { protected Set < SVDBItemType > fSupportedItems ; protected Set < Class > fSupportedObjects ; protected ISVDBPersistenceRWDelegateParent fParent ; public SVDBPersistenceRWDelegateBase ( ) { fSupportedItems = new HashSet < SVDBItemType > ( ) ; fSupportedObjects = new HashSet < Class > ( ) ; } public void init ( ISVDBPersistenceRWDelegateParent parent , DataInput in , DataOutput out ) { fParent = parent ; fIn = in ; fOut = out ; } public void init ( Set < SVDBItemType >
135
<s> package org . xmlpull . v1 ; import java . io . InputStream ; import java . util . Enumeration ; import java . util . Hashtable ; import java . util . Vector ; public class XmlPullParserFactory { public static final String PROPERTY_NAME = "" ; private static final String RESOURCE_NAME = "" + PROPERTY_NAME ; protected Vector parserClasses ; protected String classNamesLocation ; protected Vector serializerClasses ; protected Hashtable features = new Hashtable ( ) ; protected XmlPullParserFactory ( ) { } public void setFeature ( String name , boolean state ) throws XmlPullParserException { features . put ( name , new Boolean ( state ) ) ; } public boolean getFeature ( String name ) { Boolean value = ( Boolean ) features . get ( name ) ; return value != null ? value . booleanValue ( ) : false ; } public void setNamespaceAware ( boolean awareness ) { features . put ( XmlPullParser . FEATURE_PROCESS_NAMESPACES , new Boolean ( awareness ) ) ; } public boolean isNamespaceAware ( ) { return getFeature ( XmlPullParser . FEATURE_PROCESS_NAMESPACES ) ; } public void setValidating ( boolean validating ) { features . put ( XmlPullParser . FEATURE_VALIDATION , new Boolean ( validating ) ) ; } public boolean isValidating ( ) { return getFeature ( XmlPullParser . FEATURE_VALIDATION ) ; } public XmlPullParser newPullParser ( ) throws XmlPullParserException { if ( parserClasses == null ) throw new XmlPullParserException ( "" + classNamesLocation ) ; if ( parserClasses . size ( ) == 0 ) throw new XmlPullParserException ( "" + classNamesLocation ) ; StringBuffer issues = new StringBuffer ( ) ; for ( int i = 0 ; i < parserClasses . size ( ) ; i ++ ) { Class ppClass = ( Class ) parserClasses . elementAt ( i ) ; try { XmlPullParser pp = ( XmlPullParser ) ppClass . newInstance ( ) ; for ( Enumeration e = features . keys ( ) ; e . hasMoreElements ( ) ; ) { String key = ( String ) e . nextElement ( ) ; Boolean value = ( Boolean ) features . get ( key ) ; if ( value != null && value . booleanValue ( ) ) { pp . setFeature ( key , true ) ; } } return pp ; } catch ( Exception ex ) { issues . append ( ppClass . getName ( ) + ": " + ex . toString ( ) + "; " ) ; } } throw new XmlPullParserException ( "" + issues ) ; } public XmlSerializer newSerializer ( ) throws XmlPullParserException { if ( serializerClasses == null ) { throw new XmlPullParserException ( "" + classNamesLocation ) ; } if ( serializerClasses . size ( ) == 0 ) { throw new XmlPullParserException ( "" + classNamesLocation ) ; } StringBuffer issues = new StringBuffer ( ) ; for ( int i = 0 ; i < serializerClasses . size ( ) ; i ++ ) { Class ppClass = ( Class ) serializerClasses . elementAt ( i ) ; try { XmlSerializer ser = ( XmlSerializer ) ppClass . newInstance ( ) ; return ser ; } catch ( Exception ex ) { issues . append ( ppClass . getName ( ) + ": " + ex . toString ( ) + "; " ) ; } } throw new XmlPullParserException ( "" + issues ) ; } public static XmlPullParserFactory newInstance ( ) throws XmlPullParserException { return newInstance ( null , null ) ; } public static XmlPullParserFactory newInstance ( String classNames , Class context ) throws XmlPullParserException { if ( context == null ) context = "" . getClass ( ) ; String classNamesLocation = null ; if ( classNames == null || classNames . length ( ) == 0 || "DEFAULT" . equals ( classNames ) ) { try { InputStream is = context . getResourceAsStream ( RESOURCE_NAME ) ; if ( is == null ) throw new XmlPullParserException ( "" + RESOURCE_NAME ) ; StringBuffer sb = new StringBuffer ( ) ; while ( true ) { int ch = is . read ( ) ; if ( ch < 0 ) break ; else if ( ch > ' ' ) sb . append ( ( char ) ch ) ; } is . close ( ) ; classNames = sb . toString ( ) ; } catch ( Exception e ) { throw new XmlPullParserException ( null , null , e ) ; } classNamesLocation = "resource " + RESOURCE_NAME + "" + classNames + "'" ; } else { classNamesLocation = "" + classNames + "'" ; } XmlPullParserFactory factory = null ; Vector parserClasses = new Vector ( ) ; Vector serializerClasses = new Vector ( ) ; int pos = 0 ; while
136
<s> package de . fuberlin . wiwiss . d2rq . expr ; import java . util . Set ; import de . fuberlin . wiwiss . d2rq . algebra . AliasMap ; import de . fuberlin . wiwiss . d2rq . algebra . Attribute ; import de . fuberlin . wiwiss . d2rq . algebra . ColumnRenamer ; import de . fuberlin . wiwiss . d2rq . sql . ConnectedDB ; public class UnaryMinus extends Expression { private Expression base ; public UnaryMinus ( Expression base ) { this . base = base ; } public Expression getBase ( ) { return base ; } public Set < Attribute > attributes ( ) { return base . attributes ( ) ; } public boolean isFalse (
137
<s> package com . asakusafw . directio . tools ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . LinkedList ; import java . util . List ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . apache . hadoop . conf . Configuration ; import org . apache . hadoop . conf . Configured ; import org . apache . hadoop . util . Tool ; import org . apache . hadoop . util . ToolRunner ; import com . asakusafw . runtime . directio . Counter ; import com . asakusafw . runtime . directio . DirectDataSource ; import com . asakusafw . runtime . directio . DirectDataSourceRepository ; import com . asakusafw . runtime . directio . FilePattern ; import com . asakusafw . runtime . directio . ResourceInfo ; import com . asakusafw . runtime . directio . ResourcePattern ; import com . asakusafw . runtime . directio . hadoop . HadoopDataSourceUtil ; public final class DirectIoList extends Configured implements Tool { static final Log LOG = LogFactory . getLog ( DirectIoList . class ) ; private DirectDataSourceRepository repository ; public DirectIoList ( ) { return ; } DirectIoList ( DirectDataSourceRepository repository ) { this . repository = repository ; } @ Override public int run ( String [ ] args ) throws Exception { LinkedList < String > argList = new LinkedList < String > ( ) ; Collections . addAll ( argList , args ) ; while ( argList . isEmpty ( ) == false ) { String arg = argList . removeFirst ( ) ; if ( arg . equals ( "--" ) ) {
138
<s> package org . rubypeople . rdt . refactoring . tests . core . renamelocal . conditionchecks ; import junit . framework . Test ; import org . rubypeople . rdt . refactoring . tests . FileTestSuite ; public class TS_RenameLocalCondition extends FileTestSuite { public
139
<s> package com . asakusafw . compiler . flow . testing . model ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import org . apache . hadoop . io . Writable ; import com . asakusafw . compiler . flow . testing . io . ExJoined2Input ; import com . asakusafw . compiler . flow . testing . io . ExJoined2Output ; import com . asakusafw . runtime . model . DataModel ; import com . asakusafw . runtime . model . DataModelKind ; import com . asakusafw . runtime . model . ModelInputLocation ; import com . asakusafw . runtime . model . ModelOutputLocation ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . vocabulary . model . Joined ; import com . asakusafw . vocabulary . model . Key ; @ DataModelKind ( "DMDL" ) @ Joined ( terms = { @ Joined . Term ( source = Ex1 . class , mappings = { @ Joined . Mapping ( source = "sid" , destination = "sid1" ) , @ Joined . Mapping ( source = "value" , destination = "key" ) } , shuffle = @ Key ( group = { "value" } ) ) , @ Joined . Term ( source = Ex2 . class , mappings = { @ Joined . Mapping ( source = "sid" , destination = "sid2" ) , @ Joined . Mapping ( source = "value" , destination = "key" ) } , shuffle = @ Key ( group = { "value" } ) ) } ) @ ModelInputLocation ( ExJoined2Input . class ) @ ModelOutputLocation ( ExJoined2Output . class ) public class ExJoined2 implements DataModel < ExJoined2 > , Writable { private final LongOption sid1 = new LongOption ( ) ; private final IntOption key = new IntOption ( ) ; private final LongOption sid2 = new LongOption ( ) ; @ Override @ SuppressWarnings ( "deprecation" ) public void reset ( ) { this . sid1 . setNull ( ) ; this . key . setNull ( ) ; this . sid2 . setNull ( ) ; } @ Override @ SuppressWarnings ( "deprecation" ) public void copyFrom ( ExJoined2 other ) { this . sid1 . copyFrom ( other . sid1 ) ; this . key . copyFrom ( other . key ) ; this . sid2 . copyFrom ( other . sid2 ) ; } public long getSid1 ( ) { return this . sid1 . get ( ) ; } @ SuppressWarnings ( "deprecation" ) public void setSid1 ( long value ) { this . sid1 . modify ( value ) ; } public LongOption getSid1Option ( ) { return this . sid1 ; } @ SuppressWarnings ( "deprecation" ) public void setSid1Option ( LongOption option ) { this . sid1 . copyFrom ( option ) ; } public int getKey ( ) { return this . key . get ( ) ; } @ SuppressWarnings ( "deprecation" ) public void setKey ( int value ) { this . key . modify ( value ) ; } public IntOption getKeyOption ( ) { return this . key ; } @ SuppressWarnings ( "deprecation" ) public void setKeyOption ( IntOption option ) { this . key . copyFrom ( option ) ; } public long getSid2 ( ) { return this . sid2 . get ( ) ; } @ SuppressWarnings ( "deprecation" ) public void setSid2 ( long value ) { this . sid2 . modify ( value ) ; } public LongOption getSid2Option ( ) { return this . sid2 ; } @ SuppressWarnings ( "deprecation" ) public void setSid2Option ( LongOption option ) { this . sid2 . copyFrom ( option ) ; } @ Override public String toString ( ) { StringBuilder result = new StringBuilder ( ) ; result . append ( "{" ) ; result . append ( "" ) ; result . append ( ", sid1=" ) ; result . append ( this . sid1 ) ; result . append ( ", key=" ) ; result . append ( this . key ) ; result . append ( ", sid2=" ) ; result . append ( this . sid2 ) ; result . append ( "}" ) ; return result . toString ( ) ; } @ Override public int hashCode ( ) { int prime = 31 ; int result = 1 ; result = prime * result
140
<s> package net . sf . sveditor . core . templates ; public class DefaultTemplateParameterProvider extends TemplateParameterProvider { public static final String FILE_HEADER = "file_header" ; public static final String FILE_HEADER_DFLT = "" + "" + "" ; public
141
<s> package org . springframework . social . google . api . plus . person . impl ; import static org . springframework . social . google . api . plus . person . impl . PersonTemplate . PEOPLE_SEARCH_URL ; import org . springframework .
142
<s> package com . asakusafw . windgate . core . util ; import java . io . IOException ; import java . text . MessageFormat ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . windgate . core . ProcessScript ; import com . asakusafw . windgate . core . WindGateCoreLogger ; import com . asakusafw . windgate . core . WindGateLogger ; public final class ProcessUtil { static final WindGateLogger WGLOG = new WindGateCoreLogger ( ProcessUtil
143
<s> package com . asakusafw . compiler . operator . io ; import java . io . IOException ; import com . asakusafw . compiler . operator . model . MockJoined ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; public final class MockJoinedOutput implements ModelOutput < MockJoined > { private final RecordEmitter emitter ; public MockJoinedOutput (
144
<s> package org . oddjob . schedules . schedules ; import java . text . ParseException ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . arooa . utils . DateHelper ; import org . oddjob . schedules . Interval ; import org . oddjob . schedules . IntervalTo ; import org . oddjob . schedules . ScheduleContext ; import org . oddjob . schedules . ScheduleResult ; import org . oddjob . schedules . ScheduleRoller ; import org . oddjob . schedules . SimpleInterval ; import org . oddjob . schedules . SimpleScheduleResult ; import org . oddjob . schedules . units . DayOfMonth ; import org . oddjob . schedules . units . DayOfWeek ; public class TimeScheduleTest extends TestCase { private static final Logger logger = Logger . getLogger ( "org.oddjob" ) ; protected void setUp ( ) { logger . debug ( "" + getName ( ) + "" ) ; } public void testStandardIntervalDifferentStarts ( ) throws ParseException { TimeSchedule test = new TimeSchedule ( ) ; test . setFrom ( "10:00" ) ; test . setTo ( "11:00" ) ; ScheduleResult result , expected ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; result = test . nextDue ( context ) ; expected = new SimpleScheduleResult ( new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) , null ) ; assertEquals ( expected , result ) ; context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; result = test . nextDue ( context ) ; assertEquals ( expected , result ) ; context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; result = test . nextDue ( context ) ; expected = null ; assertEquals ( expected , result ) ; } public void testForwardInterval ( ) throws ParseException { TimeSchedule s = new TimeSchedule ( ) ; s . setFrom ( "11:00" ) ; s . setTo ( "10:00" ) ; ScheduleResult expected , result ; expected = new SimpleScheduleResult ( new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) , null ) ; result = s . nextDue ( new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ) ; assertEquals ( expected , result ) ; result = s . nextDue ( new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ) ; expected = new SimpleScheduleResult ( new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) , null ) ; assertEquals ( expected , result ) ; result = s . nextDue ( new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ) ; assertEquals ( expected , result ) ; } public void testOn ( ) throws ParseException { TimeSchedule s = new TimeSchedule ( ) ; s . setAt ( "12:00" ) ; ScheduleContext context ; ScheduleResult expected , result ; context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; expected = new SimpleScheduleResult ( new IntervalTo ( DateHelper . parseDateTime ( "" ) ) , null ) ; result = s . nextDue ( context ) ; assertEquals ( expected , result ) ; context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; expected = new SimpleScheduleResult ( new IntervalTo ( DateHelper . parseDateTime ( "" ) ) , null ) ; result = s . nextDue ( context ) ; assertEquals ( expected , result ) ; context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; expected = null ; result = s . nextDue ( context ) ; assertEquals ( expected , result ) ; } public void testWithLimits ( ) throws ParseException { TimeSchedule test = new TimeSchedule ( ) ; test . setAt ( "12:00" ) ; ScheduleContext context ; ScheduleResult expected , result ; context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; context = context . spawn ( new IntervalTo ( DateHelper . parseDate ( "2020-06-21" ) , DateHelper . parseDate ( "2020-06-22" ) ) ) ; result = test . nextDue ( context ) ; expected = new SimpleScheduleResult ( new IntervalTo ( DateHelper . parseDateTime ( "" ) ) , null ) ; assertEquals ( expected , result ) ; } public void testDefaultTo ( ) throws Exception { TimeSchedule test = new TimeSchedule ( ) ; test . setFrom ( "10:00" ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; Interval result = test . nextDue ( context ) ; logger . debug ( "result " + result ) ; Interval expected = new SimpleScheduleResult ( new IntervalTo ( DateHelper . parseDateTime ( "" ) , Interval . END_OF_TIME ) , null ) ; assertEquals ( expected , result ) ; } public void testDefaultFrom ( ) throws Exception { TimeSchedule s = new TimeSchedule ( ) ; s . setTo ( "10:00" ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; Interval result = s . nextDue ( context ) ; logger . debug ( "result " + result ) ; Interval expected = new SimpleScheduleResult ( new IntervalTo ( Interval . START_OF_TIME , DateHelper . parseDateTime ( "" ) ) , null ) ; assertEquals ( expected , result ) ; } public void testWithInterval ( ) throws Exception { TimeSchedule timeSchedule = new TimeSchedule ( ) ; timeSchedule . setFrom ( "08:00" ) ; timeSchedule . setTo ( "11:57" ) ; IntervalSchedule intervalSchedule = new IntervalSchedule ( ) ; intervalSchedule . setInterval ( "00:15" ) ; timeSchedule . setRefinement ( intervalSchedule ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; ScheduleResult result = timeSchedule . nextDue ( context ) ; logger . debug ( "result " + result ) ; ScheduleResult expected = ( new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ) ; assertEquals ( expected , result ) ; result = timeSchedule . nextDue ( context . move ( result . getUseNext ( ) ) ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; result = timeSchedule . nextDue ( context ) ; expected = new SimpleScheduleResult ( new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) , null ) ; assertEquals ( expected , result ) ; context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; result = timeSchedule . nextDue ( context ) ; expected = new SimpleScheduleResult ( new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) , null ) ; assertEquals ( expected , result ) ; context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; result = timeSchedule . nextDue ( context ) ; expected = null ; assertEquals ( expected , result ) ; } public void testWithIntervalOverMidnight ( ) throws Exception { TimeSchedule timeSchedule = new TimeSchedule ( ) ; timeSchedule . setFrom ( "23:00" ) ; timeSchedule . setTo ( "01:50" ) ; IntervalSchedule intervalSchedule = new IntervalSchedule ( ) ; intervalSchedule . setInterval ( "00:15" ) ; timeSchedule . setRefinement ( intervalSchedule ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; ScheduleResult result = timeSchedule . nextDue ( context ) ; ScheduleResult expected = new SimpleScheduleResult ( new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) , null ) ; assertEquals ( expected , result ) ; } public void testNextIntervalWithParent ( ) throws ParseException { TimeSchedule test = new TimeSchedule ( ) ; test . setFrom ( "10:00" ) ; test . setTo ( "17:00" ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; context = context . spawn ( new IntervalTo ( DateHelper . parseDate ( "2003-05-26" ) , DateHelper . parseDate ( "2003-05-27" ) ) ) ; Interval result = test . nextInterval ( context ) ; Interval expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; context = context . move ( DateHelper . parseDateTime ( "" ) ) ; result = test . nextInterval ( context ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; context = context . move ( DateHelper . parseDateTime ( "" ) ) ; result = test . nextInterval ( context ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; context = context . move ( DateHelper . parseDateTime ( "" ) ) ; result = test . nextInterval ( context ) ; expected = null ; assertEquals ( expected , result ) ; } public void testLastInterval ( ) throws ParseException { TimeSchedule test = new TimeSchedule ( ) ; test . setFrom ( "10:00" ) ; test . setTo ( "17:00" ) ; Interval expected , result ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; result = test . lastInterval ( context ) ; expected = null ; assertEquals ( expected , result ) ; context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; result = test . lastInterval ( context ) ; expected = null ; assertEquals ( expected , result ) ; context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; result = test . lastInterval ( context ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; } public void testLastIntervalOverMidnight ( ) throws ParseException { TimeSchedule test = new TimeSchedule ( ) ; test . setFrom ( "22:00" ) ; test . setTo ( "07:00" ) ; Interval expected , result ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; result = test . lastInterval ( context ) ; expected = null ; assertEquals ( expected , result ) ; context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; result = test . lastInterval ( context ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; result = test . lastInterval ( context ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; } public void testWithParent ( ) throws ParseException { TimeSchedule test = new TimeSchedule ( ) ; test . setFrom ( "10:00" ) ; test . setTo ( "17:00" ) ; WeeklySchedule weekly = new WeeklySchedule ( ) ; weekly . setOn ( DayOfWeek . Days . MONDAY ) ; weekly . setRefinement ( test ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; ScheduleResult result = weekly . nextDue ( context ) ; ScheduleResult expected ; expected = new SimpleScheduleResult ( new SimpleInterval ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ) ; assertEquals ( expected , result ) ; expected = new SimpleScheduleResult ( new SimpleInterval ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ) ; result = weekly . nextDue ( context . move ( result . getUseNext ( ) ) ) ; assertEquals ( expected , result ) ; } public void testAtWithParentWeekly ( ) throws ParseException { TimeSchedule test = new TimeSchedule ( ) ; test . setAt ( "17:00" ) ; WeeklySchedule weekly = new WeeklySchedule ( ) ; weekly . setOn ( DayOfWeek . Days . MONDAY ) ; weekly . setRefinement ( test ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; ScheduleResult result = weekly . nextDue ( context ) ; ScheduleResult expected ; expected = new SimpleScheduleResult ( new SimpleInterval ( DateHelper . parseDateTime ( "" ) ) ) ; assertEquals ( expected , result ) ; expected = new SimpleScheduleResult ( new SimpleInterval ( DateHelper . parseDateTime ( "" ) ) ) ; result = weekly . nextDue ( context . move ( result . getUseNext ( ) ) ) ; assertEquals ( expected , result ) ; } public void testAtWithParentMonthly ( ) throws ParseException { TimeSchedule test = new TimeSchedule ( ) ; test . setAt ( "17:00" ) ; MonthlySchedule monthly = new MonthlySchedule ( ) ; monthly . setFromDay ( new DayOfMonth . Number ( 17 ) ) ; monthly . setToDay ( new DayOfMonth . Number ( 22 ) ) ; monthly . setRefinement ( test ) ; ScheduleResult result , expected ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; result = monthly . nextDue ( context ) ; expected = new SimpleScheduleResult ( new SimpleInterval ( DateHelper . parseDateTime ( "" ) ) ) ; assertEquals ( expected , result ) ; context = context . move ( DateHelper . parseDateTime ( "" ) ) ; result = monthly . nextDue ( context ) ; expected = new SimpleScheduleResult ( new SimpleInterval ( DateHelper . parseDateTime ( "" ) ) ) ; assertEquals ( expected , result ) ; expected = new SimpleScheduleResult ( new SimpleInterval ( DateHelper . parseDateTime ( "" ) ) ) ; result = monthly . nextDue ( context . move ( result . getUseNext ( ) ) ) ; assertEquals ( expected , result ) ; } public void testAsChildWithInterval ( ) throws Exception { TimeSchedule test = new TimeSchedule ( ) ; test . setFrom ( "10:00" ) ; test . setTo ( "17:00" ) ; IntervalSchedule intervalSchedule = new IntervalSchedule ( ) ; intervalSchedule . setInterval ( "05:00" ) ; WeeklySchedule weekly = new WeeklySchedule ( ) ; weekly . setOn ( DayOfWeek . Days . MONDAY ) ; test . setRefinement ( intervalSchedule ) ; weekly . setRefinement ( test ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; ScheduleResult result = weekly . nextDue ( context ) ; ScheduleResult expected ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; context = context . move
145
<s> package org . oddjob . state ; import java . io . ByteArrayInputStream ; import java . io . ByteArrayOutputStream ; import java . io . IOException ; import java . io . ObjectInput ; import java . io . ObjectInputStream ; import java . io . ObjectOutput ; import java . io . ObjectOutputStream ; import java . util . Date ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . MockStateful ; import org . oddjob . OddjobException ; public class JobStateEventTest extends TestCase { private static final Logger logger = Logger . getLogger ( StateEvent . class ) ; String message = "" ; class NotSerializable { } class OurStateful extends MockStateful { public void addStateListener ( StateListener listener ) { throw new RuntimeException ( "Unexpected." ) ; } public void removeStateListener ( StateListener listener ) { throw new RuntimeException ( "Unexpected." ) ; } } class NotSerializableException extends Exception { private static final long serialVersionUID = 2009021000L ; public NotSerializableException ( ) { super ( message ) ; } NotSerializable ns = new NotSerializable ( ) ; } public void testSerialize1 ( ) throws IOException , ClassNotFoundException { OurStateful source = new OurStateful ( ) ; StateEvent event = new StateEvent ( source , JobState . EXCEPTION , new Date ( 1234 ) , new OddjobException ( message ) ) ; StateEvent event2 = ( StateEvent ) outAndBack ( event ) ;
146
<s> package de . fuberlin . wiwiss . d2rq . server ; import javax . servlet . ServletContext ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . joseki . RDFServer ; import org . joseki . Registry ; import org . joseki . Service ; import org . joseki . ServiceRegistry ; import org . joseki . processors . SPARQL ; import com . hp . hpl . jena . graph . BulkUpdateHandler ; import com . hp . hpl . jena . query . ARQ ; import com . hp . hpl . jena . rdf . model . Model ; import com . hp . hpl . jena . rdf . model . Resource ; import com . hp . hpl . jena . shared . PrefixMapping ; import com . hp . hpl . jena . sparql . core . describe . DescribeHandler ; import com . hp . hpl . jena . sparql . core . describe . DescribeHandlerFactory ; import com . hp . hpl . jena . sparql . core . describe . DescribeHandlerRegistry ; import com . hp . hpl . jena . sparql . util . Context ; import de . fuberlin . wiwiss . d2rq . ResourceDescriber ; import de . fuberlin . wiwiss . d2rq . SystemLoader ; import de . fuberlin . wiwiss . d2rq . algebra . Relation ; import de . fuberlin . wiwiss . d2rq . map . Mapping ; public class D2RServer { private final static String SPARQL_SERVICE_NAME = "sparql" ; private final static String RESOURCE_SERVICE_NAME = "resource" ; private final static String DATASET_SERVICE_NAME = "dataset" ; private final static String DATA_SERVICE_NAME = "data" ; private final static String PAGE_SERVICE_NAME = "page" ; private final static String VOCABULARY_STEM = "vocab/" ; private final static String DEFAULT_SERVER_NAME = "D2R Server" ; private final static String SYSTEM_LOADER = "" ; private static final Log log = LogFactory . getLog ( D2RServer . class ) ; private final SystemLoader loader ; private final ConfigLoader config ; private String overrideBaseURI = null ; private AutoReloadableDataset dataset ; private boolean startupError = false ; public D2RServer ( SystemLoader loader ) { this . loader = loader ; this . config = loader . getServerConfig ( ) ; } public static D2RServer fromServletContext ( ServletContext context ) { return retrieveSystemLoader ( context ) . getD2RServer ( ) ; } public void overrideBaseURI ( String baseURI ) { if ( ! baseURI . endsWith ( "/" ) && ! baseURI . endsWith ( "#" ) ) { baseURI += "/" ; } if ( baseURI . indexOf ( '#' ) != - 1 ) { log . warn ( "" ) ; } this . overrideBaseURI = baseURI ; } public String baseURI ( ) { if ( this . overrideBaseURI != null ) { return this . overrideBaseURI ; } return this . config . baseURI ( ) ; } public String serverName ( ) { if ( this . config . serverName ( ) != null ) { return this . config . serverName ( ) ; } return D2RServer . DEFAULT_SERVER_NAME ; } public boolean hasTruncatedResults ( ) { return dataset . hasTruncatedResults ( ) ; } public String resourceBaseURI ( String serviceStem ) { if ( this . baseURI ( ) . endsWith ( "#" ) ) { return this . baseURI ( ) ; } return this . baseURI ( ) + serviceStem + D2RServer . RESOURCE_SERVICE_NAME + "/" ; } public String resourceBaseURI ( ) { return resourceBaseURI ( "" ) ; } public static String getResourceServiceName ( ) { return RESOURCE_SERVICE_NAME ; } public static String getDataServiceName ( ) { return DATA_SERVICE_NAME ; } public static String getPageServiceName ( ) { return PAGE_SERVICE_NAME ; } public static String getDatasetServiceName ( ) { return DATASET_SERVICE_NAME ; } public static String getSparqlServiceName ( ) { return SPARQL_SERVICE_NAME ; } public String dataURL ( String serviceStem , String relativeResourceURI ) { return this . baseURI ( ) + serviceStem + DATA_SERVICE_NAME + "/" + relativeResourceURI ; } public String pageURL ( String serviceStem , String relativeResourceURI ) { return this . baseURI ( ) + serviceStem + PAGE_SERVICE_NAME + "/" + relativeResourceURI ; } public boolean isVocabularyResource ( Resource r ) { return r . getURI ( ) . startsWith ( resourceBaseURI ( VOCABULARY_STEM ) ) ; } public void addDocumentMetadata ( Model document , Resource documentResource ) { this . config . addDocumentMetadata ( document , documentResource ) ; } public AutoReloadableDataset dataset ( ) { return this . dataset ; } public Mapping getMapping ( ) { return loader . getMapping ( ) ; } public void checkMappingFileChanged ( ) { dataset . checkMappingFileChanged ( ) ; } public PrefixMapping getPrefixes ( ) { return dataset . getPrefixMapping ( ) ; } public void start ( ) { startupError = true ; if ( config . isLocalMappingFile ( ) ) { this . dataset = new AutoReloadableDataset ( loader , config . getLocalMappingFilename ( ) , config . getAutoReloadMapping ( ) ) ; } else { this . dataset = new AutoReloadableDataset ( loader , null , false ) ; } if ( loader . getMapping ( ) . configuration ( ) . getUseAllOptimizations ( ) ) { log . info ( "" ) ; } else { log . info ( "" ) ; } DescribeHandlerRegistry . get ( ) . clear ( ) ; DescribeHandlerRegistry . get ( ) . add ( new DescribeHandlerFactory ( ) { public DescribeHandler create ( ) { return new DescribeHandler ( ) { private BulkUpdateHandler adder ; public void start ( Model accumulateResultModel , Context qContext ) { adder = accumulateResultModel . getGraph ( ) . getBulkUpdateHandler ( ) ; } public void describe ( Resource resource ) { log . info ( "DESCRIBE <" + resource + ">" ) ; boolean outgoingTriplesOnly = isVocabularyResource ( resource ) && ! getConfig ( ) . getVocabularyIncludeInstances
147
<s> package com . asakusafw . dmdl . java . emitter . driver ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . math . BigDecimal ; import org . apache . hadoop . io . DataInputBuffer ; import org . apache . hadoop . io . DataOutputBuffer ; import org . apache . hadoop . io . Text ; import org . apache . hadoop . io . Writable ; import org . junit . Before ; import org . junit . Test ; import com . asakusafw . dmdl . java . GeneratorTesterRoot ; import com . asakusafw . runtime . value . Date ; import com . asakusafw . runtime . value . DateTime ; public class WritableDriverTest extends GeneratorTesterRoot { @ Before public void setUp ( ) throws Exception { emitDrivers . add ( new WritableDriver ( ) ) ; emitDrivers . add ( new ObjectDriver ( ) ) ; } @ Test public void primitives ( ) throws Exception { ModelLoader loader = generate ( ) ; ModelWrapper object = loader . newModel ( "Primitives" ) ; assertThat ( object . unwrap ( ) , instanceOf ( Writable . class )
148
<s> package org . oddjob . jmx . server ; import junit . framework . TestCase ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . OddjobSessionFactory ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . life . ArooaSessionAware ; import org . oddjob . arooa . xml . XMLConfiguration ; public class ResourceFactoryProviderTest extends TestCase { public void testProvideFactories ( ) throws ArooaParseException { ArooaSession session = new OddjobSessionFactory ( ) . createSession ( ) ; ResourceFactoryProvider test = new ResourceFactoryProvider ( session ) ; ServerInterfaceHandlerFactory < ? , ? > [ ] handlerFactories = test
149
<s> package com . aptana . rdt . internal . parser . warnings ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Set ; import org . jruby . ast . CallNode ; import org . jruby . ast . ClassNode ; import org . jruby . ast . DefnNode ; import org . jruby . ast . FCallNode ; import org . jruby . ast . Node ; import org . jruby . ast . SelfNode ; import org . jruby . ast . SymbolNode ; import org . jruby . ast . VCallNode ; import org . jruby . runtime . Visibility ; import org . rubypeople . rdt . core . compiler . IProblem ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import org . rubypeople . rdt . internal . core . util . ASTUtil ; import com . aptana . rdt . AptanaRDTPlugin ; public class UnusedPrivateMethodVisitor extends RubyLintVisitor { private Map < String , Node > privateMethods = new HashMap < String , Node > ( ) ; private Set < String > usedMethods = new HashSet < String
150
<s> package net . sf . sveditor . core . db ; public class SVDBFunction extends SVDBTask { public SVDBTypeInfo fRetType ; public SVDBFunction ( ) { super ( "" , SVDBItemType . Function ) ; } public SVDBFunction ( String name , SVDBTypeInfo ret_type ) { super ( name , SVDBItemType . Function ) ; fRetType = ret_type ; } public SVDBTypeInfo getReturnType ( ) { return fRetType ; } public void setReturnType ( SVDBTypeInfo ret ) { fRetType = ret ; } @ Override public
151
<s> package org . oddjob . script ; import junit . framework . TestCase ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . reflect . ArooaPropertyException ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . persist . MapPersister ; import org . oddjob . persist . OddjobPersister ; import org . oddjob . state . ParentState ; public class InvokeJobTest extends TestCase {
152
<s> package br . com . caelum . vraptor . dash . cache ; import java . io . IOException ; import javax . servlet . Filter ; import javax . servlet . FilterChain ; import javax . servlet . FilterConfig ; import javax . servlet . ServletException ; import javax . servlet . ServletRequest ; import javax . servlet . ServletResponse ; import javax . servlet . http . HttpServletResponse ; import org . apache . log4j . Logger ; public class CacheCheckFilter implements Filter { private final static Logger LOGGER = Logger . getLogger ( CacheCheckFilter . class ) ; public void destroy ( ) { } public void doFilter ( ServletRequest req , ServletResponse res , FilterChain chain ) throws IOException ,
153
<s> package org . rubypeople . rdt . refactoring . core . inlinelocal ; import java . util . Collection ; import org . jruby . ast . MethodDefNode ; import org . jruby . ast . Node ; import org . rubypeople . rdt . refactoring . core . IRefactoringConfig ; import org . rubypeople . rdt . refactoring . documentprovider . DocumentProvider ; import org . rubypeople . rdt . refactoring . documentprovider . IDocumentProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . LocalNodeWrapper ; public class InlineLocalConfig implements IRefactoringConfig { private boolean replaceTempWithQuery ; private String newMethodName = "" ; private IDocumentProvider docProvider ; private int caretPosition ;
154
<s> package net . sf . sveditor . ui . prop_pages ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . SVCorePlugin ; import net . sf . sveditor . core . db . project . SVDBSourceCollection ; import net . sf . sveditor . core . db . project . SVProjectFileWrapper ; import net . sf . sveditor . ui . SVUiPlugin ; import org . eclipse . core . resources . IProject ; import org . eclipse . jface . viewers . ILabelProvider ; import org . eclipse . jface . viewers . ILabelProviderListener ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . ITreeContentProvider ; import org . eclipse . jface . viewers . SelectionChangedEvent ; import org . eclipse . jface . viewers . TreeViewer ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Button ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; public class SourceCollectionsPage implements ISVProjectPropsPage , ITreeContentProvider , ILabelProvider { private TreeViewer fSourceCollectionsTree ; private SVProjectFileWrapper fFileWrapper ; private Button fAddButton ; private Button fEditButton ; private Button fRemoveButton ; private List < SVDBSourceCollection > fSourceCollections ; private IProject fProject ; public SourceCollectionsPage ( IProject p ) { fSourceCollections = new ArrayList < SVDBSourceCollection > ( ) ; fProject = p ; } public void init ( SVProjectFileWrapper project_wrapper ) { fFileWrapper = project_wrapper ;
155
<s> package de . fuberlin . wiwiss . d2rq . algebra ; import junit . framework . Test ; import junit . framework . TestSuite ; public class AllTests { public static Test suite ( ) { TestSuite suite = new TestSuite ( "" ) ; suite . addTestSuite ( RelationTest . class ) ; suite . addTestSuite ( AliasMapTest .
156
<s> package net . sf . sveditor . core . db . index ; import java . io . InputStream ; import java . util . List ; import java . util . Set ; import net . sf . sveditor . core . Tuple ; import net . sf . sveditor . core . db . SVDBFile ; import net . sf . sveditor . core . db . SVDBMarker ; import net . sf . sveditor . core . db . index . cache . ISVDBIndexCache ; import org . eclipse . core . runtime . IProgressMonitor ; public interface ISVDBIndex extends ISVDBIndexIterator , ISVDBIncludeFileProvider , ISVDBDeclCache { public void init ( IProgressMonitor monitor ) ; Tuple < SVDBFile , SVDBFile > parse ( IProgressMonitor monitor , InputStream in , String path , List < SVDBMarker > markers ) ; void setEnableAutoRebuild ( boolean en ) ; boolean isDirty ( ) ;
157
<s> package org . oddjob . logging . log4j ; import org . apache . log4j . AppenderSkeleton ; import org . apache . log4j . Layout ; import org . apache . log4j . spi . LoggingEvent ; import org . oddjob . logging . LoggingConstants ; import org . oddjob . logging . cache . LogArchiverCache ; public class ArchiveAppender extends AppenderSkeleton implements LoggingConstants { private final LogArchiverCache logArchiver ; public ArchiveAppender ( LogArchiverCache logArchiver , Layout layout ) { this . logArchiver = logArchiver ; this . layout = layout ; } public void close ( ) { } public void append ( LoggingEvent event ) { String archive = event . getLoggerName ( ) ; if ( ! logArchiver . hasArchive
158
<s> package net . sf . sveditor . core . db . expr ; import net . sf . sveditor . core . db . SVDBItemType ; public class SVDBLiteralExpr extends SVDBExpr { public String fLiteral ; public SVDBLiteralExpr ( ) { this ( null ) ; }
159
<s> package com . asakusafw . compiler . directio ; import com . asakusafw . vocabulary . flow . FlowDescription ; import com . asakusafw . vocabulary . flow . In ; import
160
<s> package org . oddjob . tools ; import java . io . BufferedReader ; import java . io . File ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . OutputStream ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . util . regex . Matcher ; import java . util . regex . Pattern ; import org . oddjob . tools . includes . JavaCodeFileLoader ; import org . oddjob . tools . includes . XMLFileLoader ; import org . oddjob . tools . includes . XMLResourceLoader ; public class DocPostProcessor implements Runnable { private File baseDir ; private InputStream input ; private OutputStream output ; @ Override public void run ( ) { Injector injector1 = new JavaCodeInjector ( ) ; Injector injector2 = new XMLResourceInjector ( ) ; Injector injector3 = new XMLFileInjector ( ) ; try { BufferedReader reader = new BufferedReader ( new InputStreamReader ( input ) ) ; PrintWriter writer = new PrintWriter ( new OutputStreamWriter ( output ) ) ; while ( true ) { String line = reader . readLine ( ) ; if ( line == null ) { break ; } if ( ! injector1 . parse ( line , writer ) && ! injector2 . parse ( line , writer ) && ! injector3 . parse ( line , writer ) ) { writer . println ( line ) ; } } reader . close ( ) ; writer . close ( ) ; }
161
<s> package net . ggtools . grand . ui . event ; import java . lang . ref . WeakReference ; import java . lang . reflect . Method ; import java . util . Iterator ; import java . util . LinkedList ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; public class EventManager implements Runnable { private final class DispatchEventAction implements Runnable { private final Dispatcher dispatcher ; private final Object event ; public DispatchEventAction ( final Object event , final Dispatcher dispatcher ) { this . event = event ; this . dispatcher = dispatcher ; } public void run ( ) { dispatchOneEvent ( event , dispatcher ) ; } } private final class SubscriptionAction implements Runnable { private Object subscriber ; public SubscriptionAction ( final Object subscriber ) { this . subscriber = subscriber ; } public void run ( ) { doSubscribtion ( subscriber ) ; } } private final class UnsubscriptionAction implements Runnable { private Object subscriber ; public UnsubscriptionAction ( final Object subscriber ) { this . subscriber = subscriber ; } public void run ( ) { doUnsubscription ( subscriber ) ; } } private static final Log log = LogFactory . getLog ( EventManager . class ) ; private boolean defaultDispatchAsynchronous = true ; private final DispatcherFactory dispatcherFactory ; private Thread dispatcherThread ; private final LinkedList < Runnable > eventQueue = new LinkedList < Runnable > ( ) ; private final LinkedList < WeakReference < Object > > listenerList = new LinkedList < WeakReference < Object > > ( ) ; private final String name ; public EventManager ( ) { this ( "Anonymous" ) ; } public EventManager ( final String name ) { this . name = name ; dispatcherThread = new Thread ( this , "" + name ) ; dispatcherThread . start ( ) ; dispatcherFactory = DispatcherFactory . getInstance ( ) ; } public void clear ( ) { if ( log . isInfoEnabled ( ) ) { log . info ( "" ) ; } synchronized ( eventQueue ) { eventQueue . clear ( ) ; } synchronized ( listenerList ) { listenerList . clear ( ) ; } } public Dispatcher createDispatcher ( final Method method ) { return dispatcherFactory . createDispatcher ( this , method ) ; } final public String getName ( ) { return name ; } public boolean isDefaultDispatchAnsynchronous ( ) { return defaultDispatchAsynchronous ; } public void run ( ) { while ( true ) { Runnable nextEvent ; do { nextEvent = null ; synchronized ( eventQueue ) { if ( ! eventQueue . isEmpty ( ) ) { nextEvent = eventQueue . removeFirst ( ) ; } } if ( nextEvent != null ) { nextEvent . run ( ) ; } } while ( nextEvent != null ) ; try { synchronized ( eventQueue ) { eventQueue . wait ( ) ; } } catch ( final InterruptedException e ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "" ) ; } } } } public void setDefaultDispatchAnsynchronous ( final boolean defaultDispatchAnsynchronous ) { defaultDispatchAsynchronous = defaultDispatchAnsynchronous ; } public void subscribe ( final Object listener ) { synchronized ( eventQueue ) { eventQueue . add ( new SubscriptionAction ( listener ) ) ; } } public void unSubscribe ( final Object listener ) { synchronized ( eventQueue ) { eventQueue . add ( new UnsubscriptionAction ( listener ) ) ; } } private final void asynchronousDispatchEvent ( final Object event , final Dispatcher dispatcher ) { synchronized ( eventQueue ) { eventQueue . add ( new DispatchEventAction ( event , dispatcher ) ) ; eventQueue . notify ( ) ; } } private void dispatchOneEvent ( final Object eventData , final Dispatcher dispatcher ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "" + dispatcher ) ; } synchronized ( listenerList ) { for ( final Iterator < WeakReference < Object > > iterator = listenerList . iterator ( ) ; iterator . hasNext ( ) ; ) { final WeakReference weakReference = iterator . next ( ) ; final Object subscriber = weakReference . get ( ) ; if ( subscriber != null ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "Dispatching " + eventData + " to " + subscriber ) ; } dispatcher . sendEventToSubscriber ( subscriber , eventData ) ; } else { if ( log . isDebugEnabled ( ) ) { log
162
<s> package com . asakusafw . modelgen . emitter ; import java . math . BigDecimal ; import java . text . MessageFormat ; import java . util . HashSet ; import java . util . Set ; import org . apache . hadoop . io . Text ; import com . asakusafw . modelgen . Constants ; import com . asakusafw . modelgen . model . ModelDescription ; import com . asakusafw . modelgen . model . ModelProperty ; import com . asakusafw . modelgen . model . ModelReference ; import com . asakusafw . modelgen . model . PropertyType ; import com . asakusafw . runtime . value . BooleanOption ; import com . asakusafw . runtime . value . ByteOption ; import com . asakusafw . runtime . value . Date ; import com . asakusafw . runtime . value . DateOption ; import com . asakusafw . runtime . value . DateTime ; import com . asakusafw . runtime . value . DateTimeOption ; import com . asakusafw . runtime . value . DecimalOption ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . runtime . value . ShortOption ; import com . asakusafw . runtime . value . StringOption ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . Name ; import com . asakusafw . utils . java . model . syntax . SimpleName ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . util . ImportBuilder ; import com . asakusafw . utils . java . model . util . Models ; import com . asakusafw . utils . java . model . util . TypeBuilder ; import com . asakusafw . vocabulary . model . DataModel ; import com . asakusafw . vocabulary . model . JoinedModel ; import com . asakusafw . vocabulary . model . SummarizedModel ; public class CommonEmitter { private final ModelFactory f ; private final Name baseNamespace ; public CommonEmitter ( ModelFactory factory , String baseNamespace ) { this . f = factory ; this . baseNamespace = Models . toName ( f , baseNamespace ) ; } public Type getModelType ( ModelReference reference ) { Name pkg = getPackageNameOf ( reference , Constants . CATEGORY_MODEL ) ; if ( pkg == null ) { return f . newNamedType ( getTypeNameOf ( reference ) ) ; } else { return f . newNamedType ( f . newQualifiedName ( pkg ,
163
<s> package org . rubypeople . rdt . ui . wizards ; 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 . CoreException ; import org . eclipse . core . runtime . IAdaptable ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Path ; import org . eclipse . jface . text . ITextSelection ; import org . eclipse . jface . viewers . ILabelProvider ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionProvider ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . Viewer ; import org . eclipse . jface . viewers . ViewerFilter ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . IWorkbenchPart ; import org . eclipse . ui . dialogs . ElementTreeSelectionDialog ; import org . eclipse . ui . views . contentoutline . ContentOutline ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyModel ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . ISourceFolder ; import org . rubypeople . rdt . core . ISourceFolderRoot ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . util . Messages ; import org . rubypeople . rdt . internal . corext . util . RubyModelUtil ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . dialogs . StatusInfo ; import org . rubypeople . rdt . internal . ui . viewsupport . IViewPartInputProvider ; import org . rubypeople . rdt . internal . ui . wizards . NewWizardMessages ; import org . rubypeople . rdt . internal . ui . wizards . TypedElementSelectionValidator ; import org . rubypeople . rdt . internal . ui . wizards . TypedViewerFilter ; 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 . IStringButtonAdapter ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . LayoutUtil ; import org . rubypeople . rdt . internal . ui . wizards . dialogfields . StringButtonDialogField ; import org . rubypeople . rdt . ui . RubyElementLabelProvider ; import org . rubypeople . rdt . ui . RubyElementSorter ; import org . rubypeople . rdt . ui . StandardRubyElementContentProvider ; public abstract class NewContainerWizardPage extends NewElementWizardPage { protected static final String CONTAINER = "" ; protected IStatus fContainerStatus ; private IWorkspaceRoot fWorkspaceRoot ; private StringButtonDialogField fContainerDialogField ; private ISourceFolder fCurrSourceFolder ; public NewContainerWizardPage ( String name ) { super ( name ) ; fWorkspaceRoot = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; ContainerFieldAdapter adapter = new ContainerFieldAdapter ( ) ; fContainerDialogField = new StringButtonDialogField ( adapter ) ; fContainerDialogField . setDialogFieldListener ( adapter ) ; fContainerDialogField . setLabelText ( getContainerLabel ( ) ) ; fContainerDialogField . setButtonLabel ( NewWizardMessages . NewContainerWizardPage_container_button ) ; fContainerStatus = new StatusInfo ( ) ; fCurrSourceFolder = null ; } protected IRubyElement getInitialRubyElement ( IStructuredSelection selection ) { IRubyElement jelem = null ; if ( selection != null && ! selection . isEmpty ( ) ) { Object selectedElement = selection . getFirstElement ( ) ; if ( selectedElement instanceof IAdaptable ) { IAdaptable adaptable = ( IAdaptable ) selectedElement ; jelem = ( IRubyElement ) adaptable . getAdapter ( IRubyElement . class ) ; if ( jelem == null ) { IResource resource = ( IResource ) adaptable . getAdapter ( IResource . class ) ; if ( resource != null && resource . getType ( ) != IResource . ROOT ) { while ( jelem == null && resource . getType ( ) != IResource . PROJECT ) { resource = resource . getParent ( ) ; jelem = ( IRubyElement ) resource . getAdapter ( IRubyElement . class ) ; } if ( jelem == null ) { jelem = RubyCore . create ( resource ) ; } } } } } if ( jelem == null ) { IWorkbenchPart part = RubyPlugin . getActivePage ( ) . getActivePart ( ) ; if ( part instanceof ContentOutline ) { part = RubyPlugin . getActivePage ( ) . getActiveEditor ( ) ; } if ( part instanceof IViewPartInputProvider ) { Object elem = ( ( IViewPartInputProvider ) part ) . getViewPartInput ( ) ; if ( elem instanceof IRubyElement ) { jelem = ( IRubyElement ) elem ; } } } if ( jelem == null || jelem . getElementType ( ) == IRubyElement . RUBY_MODEL ) { try { IRubyProject [ ] projects = RubyCore . create ( getWorkspaceRoot ( ) ) . getRubyProjects ( ) ; if ( projects . length == 1 ) { jelem = projects [ 0 ] ; } } catch ( RubyModelException e ) { RubyPlugin . log ( e ) ; } } return jelem ; } protected IWorkspaceRoot getWorkspaceRoot ( ) { return fWorkspaceRoot ; } protected void createContainerControls ( Composite parent , int nColumns ) { fContainerDialogField . doFillIntoGrid ( parent , nColumns ) ; LayoutUtil . setWidthHint ( fContainerDialogField . getTextControl ( null ) , getMaxFieldWidth ( ) ) ; } protected int getMaxFieldWidth ( ) { return convertWidthInCharsToPixels ( 40 ) ; } protected String getContainerLabel ( ) { return NewWizardMessages . NewContainerWizardPage_container_label ; } protected ITextSelection getCurrentTextSelection ( ) { IWorkbenchPart part = RubyPlugin . getActivePage ( ) . getActivePart ( ) ; if ( part instanceof IEditorPart ) { ISelectionProvider selectionProvider = part . getSite ( ) . getSelectionProvider ( ) ; if ( selectionProvider != null ) { ISelection selection = selectionProvider . getSelection ( ) ; if ( selection instanceof ITextSelection ) { return ( ITextSelection ) selection ; } } } return null ; } private void containerChangeControlPressed ( DialogField field ) { ISourceFolder root = chooseContainer ( ) ; if ( root != null ) { setSourceFolder ( root , true ) ; } } public String getProjectText ( ) { return fContainerDialogField . getText ( ) ; } public String getSourceFolderText ( ) { return fContainerDialogField . getText ( ) ; } protected IStatus containerChanged ( ) { StatusInfo status = new StatusInfo ( ) ; fCurrSourceFolder = null ; String str = getSourceFolderText ( ) ; if ( str . length ( ) == 0 ) { status . setError ( NewWizardMessages . NewContainerWizardPage_error_EnterContainerName ) ; return status ; } IPath path = new Path ( str ) ; IResource res = fWorkspaceRoot . findMember ( path ) ; if ( res != null ) { int resType = res . getType ( ) ; if ( resType == IResource . PROJECT || resType == IResource . FOLDER ) { IProject proj = res . getProject ( ) ; if ( ! proj . isOpen ( ) ) { status . setError ( Messages . format ( NewWizardMessages . NewContainerWizardPage_error_ProjectClosed , proj . getFullPath ( ) . toString ( ) ) ) ; return status ; } IRubyProject rproject = RubyCore . create ( proj ) ; IRubyElement element = RubyCore . create ( res ) ; fCurrSourceFolder = RubyModelUtil . getSourceFolder ( element ) ; if ( res . exists ( ) ) { try { if ( ! proj . hasNature ( RubyCore . NATURE_ID ) ) { if ( resType == IResource . PROJECT ) { status . setError (
164
<s> package com . mcbans . firestar . mcbans . pluginInterface ; import com . mcbans . firestar . mcbans . BukkitInterface ; import com . mcbans . firestar . mcbans . log . LogLevels ; import com . mcbans . firestar . mcbans . org . json . JSONException ; import com . mcbans . firestar . mcbans . org . json . JSONObject ; import com . mcbans . firestar . mcbans . request . JsonHandler ; import org . bukkit . ChatColor ; import java . util . HashMap ; public class Connect implements Runnable { private BukkitInterface MCBans ; private String PlayerIP ; private String PlayerName ; public void ConnectSet ( BukkitInterface p , String pn , String pi ) { MCBans = p ; PlayerIP = pi ; PlayerName = pn ; } public void run ( ) { while ( MCBans . notSelectedServer ) { try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { } } JsonHandler webHandle = new JsonHandler ( MCBans ) ; HashMap < String , String > url_items = new HashMap < String , String > ( ) ; url_items . put ( "player" , PlayerName ) ; url_items . put ( "playerip" , PlayerIP ) ; url_items . put ( "exec" , "" ) ; JSONObject response = webHandle . hdl_jobj ( url_items ) ; try { if ( ! response . has ( "banStatus" ) ) { } else { if ( MCBans . Settings . getBoolean ( "" ) ) { MCBans . broadcastPlayer ( PlayerName , ChatColor
165
<s> package de . fuberlin . wiwiss . d2rq . helpers ; import java . util . HashSet ; import java . util . Set ; import junit . framework . TestCase ; import com . hp . hpl . jena . graph . Node ; import com . hp . hpl . jena . graph . Triple ; import com . hp . hpl . jena . rdf . model . Model ; import com . hp . hpl . jena . rdf . model . ModelFactory ; import com . hp . hpl . jena . rdf . model . RDFNode ; import com . hp . hpl . jena . util . iterator . ExtendedIterator ; import de . fuberlin . wiwiss . d2rq . D2RQTestSuite ; import de . fuberlin . wiwiss . d2rq . jena . GraphD2RQ ; import de . fuberlin . wiwiss . d2rq . jena . ModelD2RQ ; import de . fuberlin . wiwiss . d2rq . pp . PrettyPrinter ; public class FindTestFramework extends TestCase { protected static final Model m = ModelFactory . createDefaultModel ( ) ; private GraphD2RQ graph ; private Set < Triple > resultTriples ; protected void setUp ( ) throws Exception { this . graph = ( GraphD2RQ ) new ModelD2RQ ( D2RQTestSuite . ISWC_MAP , "TURTLE" , "http://test/" ) . getGraph (
166
<s> package de . fuberlin . wiwiss . d2rq . vocab ; import com . hp . hpl . jena . rdf . model . * ; public class SKOS { private static Model m_model = ModelFactory . createDefaultModel ( ) ; public static final String NS = "" ; public static String getURI ( ) { return NS ; } public static final Resource NAMESPACE = m_model . createResource ( NS ) ; public static final Property altLabel = m_model . createProperty ( "" ) ; public static final Property scopeNote = m_model . createProperty ( "" ) ; public static final Property narrower = m_model . createProperty ( "" ) ; public static final Property note = m_model . createProperty ( "" ) ; public static final Property isSubjectOf = m_model . createProperty ( "" ) ; public static final Property altSymbol = m_model . createProperty ( "" ) ; public static final Property broader = m_model . createProperty ( "" ) ; public static final Property definition = m_model . createProperty ( "" ) ; public static final Property subjectIndicator = m_model . createProperty ( "" ) ; public static final Property subject = m_model . createProperty ( "" ) ; public static final Property inScheme = m_model . createProperty ( "" ) ; public static final Property historyNote = m_model . createProperty ( "" ) ; public static final Property hiddenLabel = m_model . createProperty ( "" ) ; public static final Property prefSymbol = m_model . createProperty ( "" ) ; public static final Property primarySubject = m_model . createProperty ( "" ) ; public static final Property related = m_model . createProperty ( "" ) ; public static final Property member = m_model . createProperty ( "" ) ; public static final Property memberList = m_model . createProperty ( "" ) ; public static final Property example =
167
<s> package com . asakusafw . yaess . core ; import java . text . MessageFormat ; import java . util . Collections ; import java . util . HashMap ; import java . util . Map ; import java . util . regex . Pattern ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; public class ExecutionContext { static final Logger LOG = LoggerFactory . getLogger ( ExecutionContext . class ) ; private final String batchId ; private final String flowId ; private final String executionId ; private final ExecutionPhase phase ; private final Map < String , String > arguments ; private final Map < String , String > environmentVariables ; public ExecutionContext ( String batchId , String flowId , String executionId , ExecutionPhase phase , Map < String , String > arguments ) { this ( batchId , flowId , executionId , phase , arguments , Collections . < String , String > emptyMap ( ) ) ; } public ExecutionContext ( String batchId , String flowId , String executionId , ExecutionPhase phase , Map < String , String > arguments , Map < String , String > environmentVariables ) { if ( batchId == null ) { throw new IllegalArgumentException ( "" ) ; } if ( flowId == null ) { throw new IllegalArgumentException ( "" ) ; } if ( executionId == null ) { throw new IllegalArgumentException ( "" ) ; } if ( phase == null ) { throw new IllegalArgumentException ( "" ) ; } if ( arguments == null ) { throw new IllegalArgumentException ( "" ) ; } this . batchId = batchId ; this . flowId = flowId ; this . executionId = executionId ; this . phase = phase ; this . arguments = Collections . unmodifiableMap ( new HashMap < String , String > ( arguments ) ) ; this . environmentVariables = Collections . unmodifiableMap ( new HashMap < String , String > ( environmentVariables ) ) ; }
168
<s> package net . michaelkerley ; import javax . microedition . lcdui . Graphics ; import javax . microedition . lcdui . Image ; public class Pipe { private int x , y ; private int gridX , gridY ; private byte connections = 0 ; private boolean inConnectedSet = false ; public static final int CONN_UP = 1 ; public static final int CONN_RIGHT = 2 ; public static final int CONN_DOWN = 4 ; public static final int CONN_LEFT = 8 ; private static final int CONN_OVERFLOW = 16 ; private static int size = 9 ; private static final int [ ] bitmapSizes = { 42 , 21 , 15 , 9 } ; private static Image [ ] disconnectedBmps = null ; private static Image [ ] connectedBmps = null ; private static boolean bmpsLoaded = false ; private static final int NUM_BMPS = 16 ; private static int sizePlusOne = size + 1 ; private static int size_2 = size / 2 ; private static int size_3 = size / 3 ; public static final int CONNECTED_COLOR = 0x00ff00 ; public static final int DISCONNECTED_COLOR = 0xff0000 ; public static final int DIM_CONNECTED_COLOR = 0x006600 ; public static final int DIM_DISCONNECTED_COLOR = 0x660000 ; public Pipe ( ) { } public void paint ( Graphics g , boolean bright ) { if ( bright ) { paint ( g , inConnectedSet ? CONNECTED_COLOR : DISCONNECTED_COLOR , true ) ; } else { paint ( g , inConnectedSet ? DIM_CONNECTED_COLOR : DIM_DISCONNECTED_COLOR , false ) ; } } public void paint ( Graphics g , int color , boolean preferBitmap ) { if ( preferBitmap && bmpsLoaded
169
<s> package net . sf . sveditor . core ; import net . sf . sveditor . core . db . project . SVDBProjectData ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . runtime . IAdapterFactory ; public class SVProjectDataAdapter implements IAdapterFactory { @ SuppressWarnings ( "rawtypes" ) public Object getAdapter ( Object adaptableObject , Class adapterType ) { if ( adaptableObject instanceof IProject ) { IProject p
170
<s> package org . rubypeople . rdt . internal . ui . text . ruby ; import org . eclipse . osgi . util . NLS ; final class RubyTextMessages extends NLS { private static final String BUNDLE_NAME = RubyTextMessages . class . getName ( ) ; private RubyTextMessages ( ) { } public static String CompletionProcessor_error_accessing_title ; public static String
171
<s> package com . asakusafw . utils . java . model . util ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . util . ArrayList ; import java . util . Calendar ; import java . util . Collections ; import java . util . Date ; import java . util . List ; import java . util . Map ; import java . util . Set ; import java . util . TreeSet ; import org . junit . Test ; import com . asakusafw . utils . java . model . syntax . ImportDeclaration ; import com . asakusafw . utils . java . model . syntax . ImportKind ; import com . asakusafw . utils . java . model . syntax . ModelFactory ; import com . asakusafw . utils . java . model . syntax . PackageDeclaration ; import com . asakusafw . utils . java . model . syntax . QualifiedType ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . util . ImportBuilder . Strategy ; public class ImportBuilderTest { ModelFactory f = Models . getModelFactory ( ) ; @ Test public void primitive ( ) { ImportBuilder importer = new ImportBuilder ( f , null , Strategy . TOP_LEVEL ) ; assertThat ( importer . toType ( int . class ) , is ( type ( int . class ) ) ) ; assertImported ( importer ) ; } @ Test public void aClass ( ) { ImportBuilder importer = new ImportBuilder ( f , null , Strategy . TOP_LEVEL ) ; assertThat ( importer . toType ( Date . class ) , is ( type ( Date . class . getSimpleName ( ) ) ) ) ; assertImported ( importer , Date . class ) ; } @ Test public void array ( ) { ImportBuilder importer = new ImportBuilder ( f , null , Strategy . TOP_LEVEL ) ; assertThat ( importer . toType ( int [ ] . class ) , is ( type ( int [ ] .
172
<s> package net . sf . sveditor . core . log ; public interface ILogHandle extends ILogLevel { String LOG_CAT_DEFAULT = "DEFAULT" ; String LOG_CAT_PARSER = "Parser" ; String getName ( ) ;
173
<s> package com . sun . tools . hat . internal . util ; import com . google . common . base . Function ; import com . google . common . base . Predicate ; import com . google . common . base . Predicates ; import com . google . common . collect . ImmutableSet ; import com . google . common . collect . Sets ; import com . sun . tools . hat . internal . model . AbstractJavaHeapObjectVisitor ; import com . sun . tools . hat . internal . model . JavaClass ; import com . sun . tools . hat . internal . model . JavaHeapObject ; public class Misc { private enum GetClass implements Function < JavaHeapObject , JavaClass > { INSTANCE ; @ Override public JavaClass apply ( JavaHeapObject obj ) { return obj . getClazz ( ) ; } } private static final String digits = "" ; public final static String toHex ( int addr ) { StringBuilder sb = new StringBuilder ( "0x" ) ; for ( int s = 28 ; s >= 0 ; s -= 4 ) { sb . append ( digits . charAt ( ( addr >>> s ) & 0xf ) ) ; } return sb . toString ( ) ; } public final static String toHex ( long addr ) { return "0x" + Long . toHexString ( addr ) ; } public final
174
<s> package org . rubypeople . rdt . ui . text ; import java . util . Vector ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . jface . dialogs . IDialogSettings ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . text . AbstractInformationControlManager ; import org . eclipse . jface . text . DefaultInformationControl ; import org . eclipse . jface . text . IAutoEditStrategy ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IInformationControl ; import org . eclipse . jface . text . IInformationControlCreator ; import org . eclipse . jface . text . ITextDoubleClickStrategy ; import org . eclipse . jface . text . ITextHover ; import org . eclipse . jface . text . contentassist . ContentAssistant ; import org . eclipse . jface . text . contentassist . IContentAssistProcessor ; import org . eclipse . jface . text . contentassist . IContentAssistant ; import org . eclipse . jface . text . formatter . IContentFormatter ; import org . eclipse . jface . text . formatter . MultiPassContentFormatter ; import org . eclipse . jface . text . hyperlink . IHyperlinkDetector ; import org . eclipse . jface . text . information . IInformationPresenter ; import org . eclipse . jface . text . information . IInformationProvider ; import org . eclipse . jface . text . information . InformationPresenter ; import org . eclipse . jface . text . presentation . IPresentationReconciler ; import org . eclipse . jface . text . presentation . PresentationReconciler ; import org . eclipse . jface . text . quickassist . IQuickAssistAssistant ; import org . eclipse . jface . text . reconciler . IReconciler ; import org . eclipse . jface . text . rules . DefaultDamagerRepairer ; import org . eclipse . jface . text . rules . ITokenScanner ; import org . eclipse . jface . text . source . IAnnotationHover ; import org . eclipse . jface . text . source . ISourceViewer ; import org . eclipse . jface . util . Assert ; import org . eclipse . jface . util . PropertyChangeEvent ; import org . eclipse . swt . SWT ; import org . eclipse . swt . widgets . Shell ; import org . eclipse . ui . IEditorInput ; import org . eclipse . ui . editors . text . TextSourceViewerConfiguration ; import org . eclipse . ui . texteditor . AbstractDecoratedTextEditorPreferenceConstants ; import org . eclipse . ui . texteditor . IDocumentProvider ; import org . eclipse . ui . texteditor . ITextEditor ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . formatter . DefaultCodeFormatterConstants ; import org . rubypeople . rdt . internal . corext . util . CodeFormatterUtil ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . rubyeditor . IRubyScriptDocumentProvider ; import org . rubypeople . rdt . internal . ui . text . ContentAssistPreference ; import org . rubypeople . rdt . internal . ui . text . HTMLTextPresenter ; import org . rubypeople . rdt . internal . ui . text . IRubyColorConstants ; import org . rubypeople . rdt . internal . ui . text . IRubyPartitions ; import org . rubypeople . rdt . internal . ui . text . RubyAnnotationHover ; import org . rubypeople . rdt . internal . ui . text . RubyCompositeReconcilingStrategy ; import org . rubypeople . rdt . internal . ui . text . RubyDoubleClickSelector ; import org . rubypeople . rdt . internal . ui . text . RubyElementProvider ; import org . rubypeople . rdt . internal . ui . text . RubyOutlineInformationControl ; import org . rubypeople . rdt . internal . ui . text . RubyPartitionScanner ; import org . rubypeople . rdt . internal . ui . text . RubyPresentationReconciler ; import org . rubypeople . rdt . internal . ui . text . RubyReconciler ; import org . rubypeople . rdt . internal . ui . text . comment . CommentFormattingStrategy ; import org . rubypeople . rdt . internal . ui . text . comment . RubyCommentAutoIndentStrategy ; import org . rubypeople . rdt . internal . ui . text . correction . RubyCorrectionAssistant ; import org . rubypeople . rdt . internal . ui . text . hyperlinks . RubyHyperLinkDetector ; import org . rubypeople . rdt . internal . ui . text . ruby . AbstractRubyScanner ; import org . rubypeople . rdt . internal . ui . text . ruby . AbstractRubyTokenScanner ; import org . rubypeople . rdt . internal . ui . text . ruby . RubyAutoIndentStrategy ; import org . rubypeople . rdt . internal . ui . text . ruby . RubyColoringTokenScanner ; import org . rubypeople . rdt . internal . ui . text . ruby . RubyCommentScanner ; import org . rubypeople . rdt . internal . ui . text . ruby . RubyCompletionProcessor ; import org . rubypeople . rdt . internal . ui . text . ruby . RubyFormattingStrategy ; import org . rubypeople . rdt . internal . ui . text . ruby . SingleTokenRubyScanner ; import org . rubypeople . rdt . internal . ui . text . ruby . hover . RubyEditorTextHoverDescriptor ; import org . rubypeople . rdt . internal . ui . text . ruby . hover . RubyEditorTextHoverProxy ; import org . rubypeople . rdt . internal . ui . text . ruby . hover . RubyInformationProvider ; import org . rubypeople . rdt . ui . actions . IRubyEditorActionDefinitionIds ; public class RubySourceViewerConfiguration extends TextSourceViewerConfiguration { protected RubyTextTools textTools ; protected ITextEditor fTextEditor ; private String fDocumentPartitioning ; private IColorManager fColorManager ; protected AbstractRubyTokenScanner fCodeScanner ; protected AbstractRubyScanner fMultilineCommentScanner , fSinglelineCommentScanner , fStringScanner , fRegexScanner , fCommandScanner ; private RubyDoubleClickSelector fRubyDoubleClickSelector ; public RubySourceViewerConfiguration ( IColorManager colorManager , IPreferenceStore preferenceStore , ITextEditor editor , String partitioning ) { super ( preferenceStore ) ; fColorManager = colorManager ; fTextEditor = editor ; fDocumentPartitioning = partitioning ; initializeScanners ( ) ; } public IContentFormatter getContentFormatter ( ISourceViewer sourceViewer ) { final MultiPassContentFormatter formatter = new MultiPassContentFormatter ( getConfiguredDocumentPartitioning ( sourceViewer ) , IDocument . DEFAULT_CONTENT_TYPE ) ; formatter . setMasterStrategy ( new RubyFormattingStrategy ( ) ) ; formatter . setSlaveStrategy ( new CommentFormattingStrategy ( ) , IRubyPartitions . RUBY_SINGLE_LINE_COMMENT ) ; formatter . setSlaveStrategy ( new CommentFormattingStrategy ( ) , IRubyPartitions . RUBY_MULTI_LINE_COMMENT ) ; return formatter ; } @ Override public IHyperlinkDetector [ ] getHyperlinkDetectors ( ISourceViewer sourceViewer ) { if ( ! fPreferenceStore . getBoolean ( AbstractDecoratedTextEditorPreferenceConstants . EDITOR_HYPERLINKS_ENABLED ) ) return null ; IHyperlinkDetector [ ] inheritedDetectors = super . getHyperlinkDetectors ( sourceViewer ) ; if ( fTextEditor == null ) return inheritedDetectors ; int inheritedDetectorsLength = inheritedDetectors != null ? inheritedDetectors . length : 0 ; IHyperlinkDetector [ ] detectors = new IHyperlinkDetector [ inheritedDetectorsLength + 1 ] ; detectors [ 0 ] = new RubyHyperLinkDetector ( fTextEditor . getEditorInput ( ) ) ; for ( int i = 0 ; i < inheritedDetectorsLength ; i ++ ) detectors [ i + 1 ] = inheritedDetectors [ i ] ; return detectors ; } public boolean affectsTextPresentation ( PropertyChangeEvent event ) { return fCodeScanner . affectsBehavior ( event ) || fMultilineCommentScanner . affectsBehavior ( event ) || fSinglelineCommentScanner . affectsBehavior ( event ) || fStringScanner . affectsBehavior ( event ) || fRegexScanner . affectsBehavior ( event ) ; } public void handlePropertyChangeEvent ( PropertyChangeEvent event ) { Assert . isTrue ( isNewSetup ( ) ) ; if ( fCodeScanner . affectsBehavior ( event ) ) fCodeScanner . adaptToPreferenceChange ( event ) ; if ( fMultilineCommentScanner . affectsBehavior ( event ) ) fMultilineCommentScanner . adaptToPreferenceChange ( event ) ; if ( fSinglelineCommentScanner . affectsBehavior ( event ) ) fSinglelineCommentScanner . adaptToPreferenceChange ( event ) ; if ( fStringScanner . affectsBehavior ( event ) ) fStringScanner . adaptToPreferenceChange ( event ) ; if ( fRegexScanner . affectsBehavior ( event ) ) fRegexScanner . adaptToPreferenceChange ( event ) ; } private void initializeScanners ( ) { Assert . isTrue ( isNewSetup ( ) ) ; fCodeScanner = new RubyColoringTokenScanner ( getColorManager ( ) , fPreferenceStore ) ; fMultilineCommentScanner = new RubyCommentScanner ( getColorManager ( ) , fPreferenceStore , IRubyColorConstants . RUBY_MULTI_LINE_COMMENT ) ; fSinglelineCommentScanner = new RubyCommentScanner ( getColorManager ( ) , fPreferenceStore , IRubyColorConstants . RUBY_SINGLE_LINE_COMMENT ) ; fStringScanner = new SingleTokenRubyScanner ( getColorManager ( ) , fPreferenceStore , IRubyColorConstants . RUBY_STRING ) ; fRegexScanner = new SingleTokenRubyScanner ( getColorManager ( ) , fPreferenceStore , IRubyColorConstants . RUBY_REGEXP ) ; fCommandScanner = new SingleTokenRubyScanner ( getColorManager ( ) , fPreferenceStore , IRubyColorConstants . RUBY_COMMAND ) ; } private boolean isNewSetup ( ) { return textTools == null ; }
175
<s> package com . asakusafw . yaess . core ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . util . Arrays ; import java . util . HashMap ; import java . util . Map ; import java . util . Set ; import java . util . TreeSet ; import org . junit . Rule ; import org . junit . Test ; import org . junit . rules . TemporaryFolder ; public class CommandScriptTest { @ Rule public final TemporaryFolder folder = new TemporaryFolder ( ) ; @ Test public void simple ( ) { CommandScript script = new CommandScript ( "testing" , set ( "blk1" , "blk2" ) , "profile" , "module" , Arrays . asList ( "cmd1" , "cmd2" ) , map ( "ASAKUSA_HOME" , folder . getRoot ( ) . getAbsolutePath ( ) ) ) ; assertThat ( script . getKind ( ) , is ( ExecutionScript . Kind . COMMAND ) ) ; assertThat ( script . getId ( ) , is ( "testing" ) ) ; assertThat ( script . getBlockerIds ( ) , is ( set ( "blk1" , "blk2" ) ) ) ; assertThat ( script . getProfileName ( ) , is ( "profile" ) ) ; assertThat ( script . getModuleName ( )
176
<s> package com . asakusafw . testdriver . json ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . File ; import java . io . IOException ; import java . net . URI ; import java . net . URL ; import org . junit . Test ; import com . asakusafw . testdriver . core . DataModelDefinition ; import com . asakusafw . testdriver . core . DataModelSource ; import com . asakusafw . testdriver . core . DataModelSourceProvider ; import com . asakusafw . testdriver . core . SpiDataModelSourceProvider ; import com . asakusafw . testdriver . core . TestContext ; import com . asakusafw . testdriver . model . SimpleDataModelDefinition ; public class JsonSourceProviderTest { static final DataModelDefinition < Simple > SIMPLE = new SimpleDataModelDefinition < Simple > ( Simple . class ) ; @ Test public void simple ( ) throws Exception { JsonSourceProvider provider = new JsonSourceProvider ( ) ; DataModelSource source = provider . open ( SIMPLE , uri ( "simple.json" ) , new TestContext . Empty ( ) ) ; assertThat ( source , not ( nullValue ( ) ) ) ; try { Simple s1 = SIMPLE . toObject ( source . next ( ) ) ; assertThat ( s1 . number , is ( 100 ) ) ; assertThat ( source . next ( ) , is ( nullValue ( ) ) ) ; } finally { source . close ( ) ; } } @ Test public void spi ( ) throws Exception { DataModelSourceProvider provider = new SpiDataModelSourceProvider ( JsonSourceProvider . class . getClassLoader ( ) ) ; DataModelSource source = provider . open ( SIMPLE , uri ( "simple.json" ) , new TestContext . Empty ( ) ) ; assertThat ( source , not ( nullValue ( ) ) ) ; try { Simple s1 = SIMPLE . toObject ( source . next ( ) ) ; assertThat ( s1 . number , is ( 100 ) ) ; assertThat ( source . next ( ) , is ( nullValue ( ) ) ) ; } finally { source . close ( ) ; } } @ Test public void invalid_extension ( ) throws Exception { JsonSourceProvider provider = new JsonSourceProvider ( ) ; DataModelSource source = provider . open ( SIMPLE , uri ( "simple.txt" ) , new TestContext . Empty ( ) ) ; assertThat ( source , is ( nullValue ( ) ) ) ; } @ Test ( expected = IOException . class ) public void not_found (
177
<s> package com . asakusafw . runtime . io ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . math . BigDecimal ; import org . junit . After ; import org . junit . Test ; import com . asakusafw . runtime . value . BooleanOption ; import com . asakusafw . runtime . value . ByteOption ; import com . asakusafw . runtime . value . Date ; import com . asakusafw . runtime . value . DateOption ; import com . asakusafw . runtime . value . DateTime ; import com . asakusafw . runtime . value . DateTimeOption ; import com . asakusafw . runtime . value . DateUtil ; import com . asakusafw . runtime . value . DecimalOption ; import com . asakusafw . runtime . value . DoubleOption ; import com . asakusafw . runtime . value . FloatOption ; import com . asakusafw . runtime . value . IntOption ; import com . asakusafw . runtime . value . LongOption ; import com . asakusafw . runtime . value . ShortOption ; import com . asakusafw . runtime . value . StringOption ; public class TsvParserTest { private static final String LONG_STRING = "" ; private TsvParser parser ; private void create ( String fileName ) throws IOException { InputStream in = TsvParserTest . class . getResourceAsStream ( "tsv/" + fileName ) ; assertThat ( fileName , in , is ( not ( nullValue ( ) ) ) ) ; parser = new TsvParser ( new InputStreamReader ( in , "UTF-8" ) ) ; } @ After public void tearDown ( ) throws Exception { if ( parser != null ) { parser . close ( ) ; } } @ Test public void fillBoolean ( ) throws Exception { BooleanOption value = new BooleanOption ( ) ; create ( "boolean" ) ; assertThat ( parser . next ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( false ) ) ; parser . endRecord ( ) ; assertThat ( parser . next ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( false ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( true ) ) ; parser . endRecord ( ) ; assertThat ( parser . next ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . isNull ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . isNull ( ) , is ( false ) ) ; parser . endRecord ( ) ; } @ Test public void fillByte ( ) throws Exception { ByteOption value = new ByteOption ( ) ; create ( "byte" ) ; assertThat ( parser . next ( ) , is ( true ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( ( byte ) 0 ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( ( byte ) 10 ) ) ; parser . fill ( value ) ; assertThat ( value . get ( ) , is ( ( byte ) - 10 )
178
<s> package org . rubypeople . rdt . internal . core . search . matching ; import org . rubypeople . rdt . core . search . SearchPattern ; import org . rubypeople . rdt . internal . core . RubyScript ; public class OrLocator extends PatternLocator { protected PatternLocator [ ] patternLocators ; public
179
<s> package org . rubypeople . rdt . internal . ui . text ; import org . eclipse . jface . text . IRegion ; import org . eclipse . jface . text . ITextViewer ; import org . eclipse . jface . text . Region ; import org . eclipse . jface . text . information . IInformationProvider ; import org . eclipse . jface . text . information . IInformationProviderExtension ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . ui . IEditorPart ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . ui . actions . SelectionConverter ; import org . rubypeople . rdt . internal . ui
180
<s> package com . asakusafw . runtime . stage . input ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import org . apache . commons . logging . Log ; import org . apache . commons . logging . LogFactory ; import org . apache . hadoop . conf . Configurable ; import org . apache . hadoop . conf . Configuration ; import org . apache . hadoop . io . NullWritable ; import org . apache . hadoop . io . Writable ; import org . apache . hadoop . io . WritableUtils ; import org . apache . hadoop . mapreduce . InputFormat ; import org . apache . hadoop . mapreduce . InputSplit ; import org . apache . hadoop . mapreduce . JobContext ; import org . apache . hadoop . mapreduce . RecordReader ; import org . apache . hadoop . mapreduce . TaskAttemptContext ; import org . apache . hadoop . util . ReflectionUtils ; import com . asakusafw . runtime . directio . Counter ; import com . asakusafw . runtime . directio . DataFormat ; import com . asakusafw . runtime . directio . DirectDataSource ; import com . asakusafw . runtime . directio . DirectDataSourceConstants ; import com . asakusafw . runtime . directio . DirectDataSourceRepository ; import com . asakusafw . runtime . directio . DirectInputFragment ; import com . asakusafw . runtime . directio . FilePattern ; import com . asakusafw . runtime . directio . hadoop . HadoopDataSourceUtil ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . stage . StageConstants ; import com . asakusafw . runtime . stage . StageInput ; import com . asakusafw . runtime . util . VariableTable ; public final class BridgeInputFormat extends InputFormat < NullWritable , Object > { static final Log LOG = LogFactory . getLog ( BridgeInputFormat . class ) ; @ Override @ Deprecated public List < InputSplit > getSplits ( JobContext context ) throws IOException , InterruptedException { throw new UnsupportedOperationException ( "" ) ; } public List < InputSplit > getSplits ( JobContext context , List < StageInput > inputList ) throws IOException , InterruptedException { if ( context == null ) { throw new IllegalArgumentException ( "" ) ; } if ( inputList == null ) { throw new IllegalArgumentException ( "" ) ; } if ( LOG . isInfoEnabled ( ) ) { LOG . info ( MessageFormat . format ( "" , inputList . size ( ) ) ) ; } DirectDataSourceRepository repo = getDataSourceRepository ( context ) ; List < InputSplit > results = new ArrayList < InputSplit > ( ) ; Map < DirectInputGroup , List < InputPath > > patternGroups = extractInputList ( context , repo , inputList ) ; long totalSize = 0 ; for ( Map . Entry < DirectInputGroup , List < InputPath > > entry : patternGroups . entrySet ( ) ) { DirectInputGroup group = entry . getKey ( ) ; List < InputPath > paths = entry . getValue ( ) ; DataFormat < ? > format = ReflectionUtils . newInstance ( group . formatClass , context . getConfiguration ( ) ) ; DirectDataSource dataSource = repo . getRelatedDataSource ( group . containerPath ) ; for ( InputPath path : paths ) { List < DirectInputFragment > fragments = getFragments ( repo , group , path , format , dataSource ) ; for ( DirectInputFragment fragment : fragments ) { totalSize += fragment . getSize ( ) ; results . add ( new BridgeInputSplit ( group , fragment ) ) ; } } } if ( LOG . isInfoEnabled ( ) ) { LOG
181
<s> package org . oddjob . jmx ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . Resetable ; import org . oddjob . Stateful ; import org . oddjob . arooa . convert . ArooaConversionException ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . state . JobState ; import org . oddjob . state . StateEvent ; import org . oddjob . state . StateListener ; import junit . framework . TestCase ; public class StatefulTest extends TestCase { class Result implements StateListener { StateEvent event ; public void jobStateChange ( StateEvent event ) { this . event = event ; synchronized ( this ) { notifyAll ( ) ; } } } public void testState ( ) throws ArooaConversionException , InterruptedException { String xml = "" + " <job>" + "" + " <jobs>" + "" + "" + "" + "" + "" + " </jobs>" + "" + " </job>" + "</oddjob>" ; Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; oddjob . run ( ) ; String address = new OddjobLookup
182
<s> package org . rubypeople . rdt . internal . core ; import java . util . HashMap ; import java . util . Iterator ; import org . eclipse . core . runtime . ISafeRunnable ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . core . runtime . SafeRunner ; import org . jruby . ast . RootNode ; import org . rubypeople . rdt . core . IProblemRequestor ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyModelStatus ; import org . rubypeople . rdt . core . IRubyModelStatusConstants ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . WorkingCopyOwner ; import org . rubypeople . rdt . core . compiler . CategorizedProblem ; import org . rubypeople . rdt . core . compiler . CompilationParticipant ; import org . rubypeople . rdt . core . compiler . ReconcileContext ; import org . rubypeople . rdt . internal . core . parser . MarkerUtility ; import org . rubypeople . rdt . internal . core . util . Messages ; import org . rubypeople . rdt . internal . core . util . Util ; public class ReconcileWorkingCopyOperation extends RubyModelOperation { public static boolean PERF = false ; boolean createAST ; boolean forceProblemDetection ; WorkingCopyOwner workingCopyOwner ; public RootNode ast ; public RubyElementDeltaBuilder deltaBuilder ; public HashMap problems ; public ReconcileWorkingCopyOperation ( IRubyElement workingCopy , boolean forceProblemDetection , WorkingCopyOwner workingCopyOwner ) { super ( new IRubyElement [ ] { workingCopy } ) ; this . forceProblemDetection = forceProblemDetection ; this . workingCopyOwner = workingCopyOwner ; } protected void executeOperation ( ) throws RubyModelException { if ( this . progressMonitor != null ) { if ( this . progressMonitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; this . progressMonitor . beginTask ( Messages . element_reconciling , 2 ) ; } RubyScript workingCopy = getWorkingCopy ( ) ; boolean wasConsistent = workingCopy . isConsistent ( ) ; IProblemRequestor problemRequestor = workingCopy . getPerWorkingCopyInfo ( ) ; this . deltaBuilder = new RubyElementDeltaBuilder ( workingCopy ) ; makeConsistent ( workingCopy , problemRequestor ) ; notifyParticipants ( workingCopy ) ; if ( this . problems != null && ( this . forceProblemDetection || ! wasConsistent ) ) { try { problemRequestor . beginReporting ( ) ; for ( Iterator iteraror = this . problems . values ( ) . iterator ( ) ; iteraror . hasNext ( ) ; ) { CategorizedProblem [ ] categorizedProblems = ( CategorizedProblem [ ] ) iteraror . next ( ) ; if ( categorizedProblems == null ) continue ; for ( int i = 0 , length = categorizedProblems . length ; i < length ; i ++ ) { CategorizedProblem problem = categorizedProblems [ i ] ; if ( RubyModelManager . VERBOSE ) { System . out . println ( "" + problem . getMessage ( ) ) ; } if ( this . progressMonitor != null && this . progressMonitor . isCanceled ( ) ) break ; if ( ! MarkerUtility . ignoring ( workingCopy . getResource ( ) , problem . getID ( ) , problem . getSourceStart ( ) , problem . getSourceEnd ( ) ) ) problemRequestor . acceptProblem ( problem ) ; } } } finally { problemRequestor . endReporting ( ) ; } } try { RubyElementDelta delta = this . deltaBuilder . delta ; if ( delta != null ) { addReconcileDelta ( workingCopy , delta ) ; } } finally { if ( this . progressMonitor != null ) this . progressMonitor . done ( ) ; } } public RootNode makeConsistent ( RubyScript workingCopy , IProblemRequestor problemRequestor ) throws RubyModelException { if ( ! workingCopy . isConsistent ( ) ) { if ( this . problems == null ) this . problems = new HashMap ( ) ; this . ast = workingCopy . makeConsistent ( true , this . problems , this . progressMonitor ) ; this . deltaBuilder . buildDeltas ( ) ; if ( this . ast != null && this . deltaBuilder . delta != null ) this . deltaBuilder . delta . changedAST ( this . ast ) ; return this . ast ; } if ( this . ast != null ) return this . ast ; if ( this . forceProblemDetection ) { if ( RubyProject . hasRubyNature ( workingCopy . getRubyProject ( ) . getProject ( ) ) ) { HashMap problemMap ; if ( this . problems == null ) { problemMap = new HashMap ( ) ; if ( this . forceProblemDetection ) this . problems = problemMap ; } else problemMap = this . problems ; char [ ] contents = workingCopy . getContents ( ) ; this . ast = RubyScriptProblemFinder . process ( workingCopy , contents , problemMap , this . progressMonitor ) ; if ( this . ast != null ) { this . deltaBuilder . delta = new RubyElementDelta ( workingCopy ) ; this . deltaBuilder . delta . changedAST (
183
<s> package com . asakusafw . utils . java . parser . javadoc ; import java . util . ArrayList ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . IrDocBlock ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . IrDocFragment ; import com . asakusafw . utils . java . internal . parser . javadoc . ir . IrDocNamedType ; public class FollowsNamedTypeBlockParser extends AcceptableJavadocBlockParser { public FollowsNamedTypeBlockParser ( String ... tagNames ) { super ( tagNames ) ; } @ Override public IrDocBlock parse ( String tag , JavadocScanner scanner ) throws JavadocParseException
184
<s> package org . rubypeople . rdt . refactoring . core . inlinelocal ; import java . util . HashMap ; import java . util . Map ; import org . jruby . ast . CallNode ; import org . jruby . ast . Node ; import org . jruby . lexer . yacc . ISourcePosition ; import org . rubypeople . rdt . core . formatter . EditableFormatHelper ; import org . rubypeople . rdt . core . formatter . FormatHelper ; import org . rubypeople . rdt . refactoring . core . NodeProvider ; import org . rubypeople . rdt . refactoring . editprovider . ReplaceEditProvider ; import org . rubypeople . rdt . refactoring . nodewrapper . LocalNodeWrapper ; import org . rubypeople . rdt . refactoring . nodewrapper . MethodCallNodeWrapper ; import org . rubypeople . rdt . refactoring . util . JRubyRefactoringUtils ; import org . rubypeople . rdt . refactoring . util . NodeUtil ; public class LocalValueReplaceProvider extends ReplaceEditProvider { private LocalNodeWrapper targetNode ; private LocalNodeWrapper inlinedNode ; private boolean addBrackets ; private InlineLocalConfig config ; public LocalValueReplaceProvider ( LocalNodeWrapper targetNode , InlineLocalConfig config , boolean addBrackets ) { super ( false ) ; this . config = config ; this . inlinedNode = config . getDefinitionNode ( ) ; this . targetNode = targetNode ; this . addBrackets = addBrackets ; } @ Override protected int getOffsetLength ( ) { ISourcePosition replacePos = targetNode . getWrappedNode ( ) . getPosition ( ) ; return replacePos . getEndOffset ( ) - replacePos . getStartOffset ( ) ; } @ Override protected Node getEditNode ( int offset , String document ) { return inlinedNode . getValueNode ( ) ; } @ Override protected int getOffset ( String document ) { return targetNode . getWrappedNode ( ) . getPosition ( ) . getStartOffset ( ) ; } protected String getFormatedNode ( String document ) { if ( addBrackets ) { return '(' + super . getFormatedNode ( document ) + ')' ; } return super . getFormatedNode ( document ) ; } @ Override protected FormatHelper getFormatHelper ( ) { if ( callNeedsBrackets ( ) ) { Map < String , Object > options
185
<s> package org . rubypeople . rdt . internal . formatter . rewriter ; import java . util . HashSet ; public abstract class Operators { private static HashSet < String > operatorSet = new HashSet < String > ( ) ;
186
<s> package org . rubypeople . rdt . ui . actions ; import org . eclipse . ui . IWorkbenchSite ; import org . eclipse . ui . PlatformUI ; import org . rubypeople . rdt . core . IRubyElement ; 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 .
187
<s> package com . asakusafw . runtime . core . context ; 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 ;
188
<s> package com . aptana . rdt . internal . core . parser . warnings ; import java . util . Map ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . parser . warnings . RubyLintVisitor ; import com . aptana . rdt . AptanaRDTPlugin ; import com . aptana . rdt . internal . parser . warnings . TooManyArgumentsVisitor ; public class TC_CodeComplexityTooManyArguments extends WarningVisitorTest { private static final int MAX_ARGS ; static { Map < String , String > options = AptanaRDTPlugin . getDefault ( ) . getOptions ( ) ; int max ; try { max = Integer . parseInt ( ( String ) options . get ( AptanaRDTPlugin . COMPILER_PB_MAX_ARGUMENTS ) ) ; } catch ( NumberFormatException e ) { max = TooManyArgumentsVisitor . DEFAULT_MAX_ARGS ; } MAX_ARGS = max ; } @ Override protected RubyLintVisitor createVisitor ( String code ) { return new TooManyArgumentsVisitor ( code ) { @ Override protected String getSeverity ( ) { return RubyCore . WARNING ; } } ; } public void testTooManyArgs ( ) throws Exception { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "def method(" ) ; for ( int i
189
<s> package org . oddjob . persist ; import java . io . IOException ; import java . util . Map ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . Describeable ; import org . oddjob . Helper ; import org . oddjob . Iconic ; import org . oddjob . Stateful ; import org . oddjob . Structural ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . ComponentTrinity ; import org . oddjob . arooa . parsing . MockArooaContext ; import org . oddjob . arooa . registry . ComponentPool ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . describe . UniversalDescriber ; import org . oddjob . images . IconHelper ; import org . oddjob . jobs . EchoJob ; import org . oddjob . jobs . structural . SequentialJob ; import org . oddjob . state . FlagState ; import org . oddjob . state . JobState ; public class SilhouetteFactoryTest extends TestCase { private static final Logger logger = Logger . getLogger ( SilhouetteFactoryTest . class ) ; @ Override protected void setUp ( ) throws Exception { if ( Thread . interrupted ( ) ) { logger . warn ( "" ) ; } } public void testEqualsAndHashCode ( ) throws IOException , ClassNotFoundException { String a = new String ( "A" ) ; String b = new String ( "B" ) ; ArooaSession session = new StandardArooaSession ( ) ; Object silhouetteA = Helper . copy ( new SilhouetteFactory ( ) . create ( a , session ) ) ; Object silhouetteB = Helper . copy ( new SilhouetteFactory ( ) . create ( b , session ) ) ; assertEquals ( silhouetteA , silhouetteA ) ; assertEquals ( silhouetteB , silhouetteB ) ; assertFalse ( silhouetteA . equals ( silhouetteB ) ) ; assertEquals ( silhouetteA . hashCode ( ) , silhouetteA . hashCode ( ) ) ; assertEquals ( silhouetteB . hashCode ( ) , silhouetteB . hashCode ( ) ) ; assertFalse ( silhouetteA . hashCode ( ) == silhouetteB . hashCode ( ) ) ; } public void testSimple ( ) throws IOException , ClassNotFoundException { EchoJob echo = new EchoJob ( ) ; echo . setText ( "Hello" ) ; echo . setName ( "Greeting" ) ; echo . run ( ) ; ArooaSession session = new StandardArooaSession ( ) ; Object silhouette = Helper . copy ( new SilhouetteFactory ( ) . create ( echo , session ) ) ; assertTrue ( silhouette instanceof Describeable ) ; assertFalse ( silhouette instanceof Stateful ) ; assertFalse ( silhouette instanceof Structural ) ; assertFalse ( silhouette instanceof Iconic ) ; Map < String , String
190
<s> package org . rubypeople . rdt . core ; import org . rubypeople . rdt . core . compiler . IProblem ; public abstract class CompletionRequestor { private int ignoreSet = 0 ; public CompletionRequestor ( ) { } public final boolean isIgnored ( int completionProposalKind ) { if ( completionProposalKind < CompletionProposal . FIRST_KIND || completionProposalKind > CompletionProposal . LAST_KIND ) { throw new IllegalArgumentException ( "" + completionProposalKind ) ; } return 0 != ( this . ignoreSet & ( 1 << completionProposalKind ) ) ; } public final void setIgnored ( int completionProposalKind , boolean
191
<s> package org . rubypeople . rdt . internal . core ; import java . io . CharArrayReader ; import java . io . File ; import java . io . IOException ; import java . util . Map ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . jruby . ast . Node ; import org . jruby . lexer . yacc . SyntaxException ; import org . rubypeople . rdt . core . IBuffer ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . WorkingCopyOwner ; import org . rubypeople . rdt . core . util . Util ; import org . rubypeople . rdt . internal . core . buffer . BufferManager ; import org . rubypeople . rdt . internal . core . parser . RubyParser ; public class ExternalRubyScript extends RubyScript { public ExternalRubyScript ( ExternalSourceFolder
192
<s> package org . rubypeople . rdt . internal . core ; import org . rubypeople . rdt . core . IRubyElementDelta ; public class SimpleDelta { protected int kind = 0 ; protected int changeFlags = 0 ; public void added ( ) { this . kind = IRubyElementDelta . ADDED ; } public void changed ( int flags ) { this . kind = IRubyElementDelta . CHANGED ; this . changeFlags |= flags ; } public int getFlags ( ) { return this . changeFlags ; } public int getKind ( ) { return this . kind ; } public void modifiers ( ) { changed ( IRubyElementDelta . F_MODIFIERS ) ; } public void removed ( ) { this . kind = IRubyElementDelta . REMOVED ; this . changeFlags = 0 ; } public void superTypes ( ) { changed ( IRubyElementDelta . F_SUPER_TYPES ) ; } protected void toDebugString ( StringBuffer buffer ) { buffer . append ( "[" ) ; switch ( getKind ( ) ) { case IRubyElementDelta . ADDED : buffer . append ( '+' ) ; break ; case IRubyElementDelta . REMOVED : buffer . append ( '-' ) ; break ; case IRubyElementDelta . CHANGED : buffer . append ( '*' ) ; break ; default : buffer . append ( '?' ) ; break ; } buffer . append (
193
<s> package net . sf . sveditor . core . parser ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db .
194
<s> package net . sf . sveditor . core . parser ; public class SVParsers { private ISVParser fSVParser ; private ParserSVDBFileFactory fSVDBFileFactory ; private SVClassDeclParser fClassParser ; private SVCovergroupParser fCovergroupParser ; private SVParameterDeclParser fParamDeclParser ; private SVParameterPortListParser fParamPortParser ; private SVDataTypeParser fDataTypeParser ; private SVTaskFunctionParser fFunctionParser ; private SVTaskFunctionPortListParser fTFPortListParser ; private SVTaskFuncBodyParser fTFBodyParser ; private SVBlockItemDeclParser fBlockItemDeclParser ; private SVParameterValueAssignmentParser fParamValueAssignParser ; private SVBehavioralBlockParser fBehavioralBlockParser ; private SVModIfcProgDeclParser fModIfcProgParser ; private SVPortListParser fPortListParser ; private SVGenerateBlockParser fGenBlockParser ; private SVClockingBlockParser fClkBlockParser ; private SVSpecifyBlockParser fSpecifyBlockParser ; private SVImpExpStmtParser fImportParser ; private SVExprParser fExprParser ; private SVGateInstantiationParser fGateInstanceParser ; private SVAssertionParser fAssertionParser ; private SVModIfcBodyItemParser fModIfcBodyItemParser ; private SVConstraintParser fConstraintParser ; private SVAttributeParser fAttrParser ; private SVPropertyExprParser fPropertyExprParser ; private SVSequenceParser fSequenceParser ; private SVPropertyParser fPropertyParser ; private SVConfigParser fConfigParser ; public SVParsers ( ) { } public SVParsers ( ISVParser parser ) { fSVParser = parser ; } public void init ( ParserSVDBFileFactory sv_parser ) { fSVDBFileFactory = sv_parser ; init ( ( ISVParser ) sv_parser ) ; } public void init ( ISVParser parser ) { fSVParser = parser ; fClassParser = new SVClassDeclParser ( fSVParser ) ; fParamDeclParser = new SVParameterDeclParser ( fSVParser ) ;
195
<s> package org . oddjob . jmx . client ; import java . util . ArrayList ; import java . util . List ; import javax . management . Notification ; import javax . management . NotificationListener ; import junit . framework . TestCase ; public class SynchronizerTest extends TestCase { class OurListener implements NotificationListener { List < Notification > notifications = new ArrayList < Notification > ( ) ; public void handleNotification ( Notification notification , Object handback ) { notifications . add ( notification ) ; } } String type = "X" ; public void
196
<s> package org . rubypeople . rdt . internal . ui . callhierarchy ; import org . eclipse . jface . resource . ImageDescriptor ; import org . eclipse . jface . viewers . ILabelDecorator ; import org . eclipse . jface . viewers . ILabelProviderListener ; import org . eclipse . swt . graphics . Image ; import org . eclipse . swt . graphics . Point ; import org . eclipse .
197
<s> package edsdk ; import com . sun . jna . NativeLong ; import com . sun . jna . Structure ; public class EdsTime extends Structure { public NativeLong year ; public NativeLong month ; public NativeLong day ; public NativeLong hour ; public NativeLong minute ; public NativeLong second ; public NativeLong milliseconds ; public EdsTime ( ) { super ( ) ; initFieldOrder ( ) ; } protected void initFieldOrder ( ) { setFieldOrder ( new java
198
<s> package com . sun . tools . hat . internal . lang . common ; import java . util . List ; import com . sun . tools . hat . internal . lang . Models ; import com . sun . tools . hat . internal . model . JavaObject ; import com . sun . tools . hat . internal . model . JavaThing ; public final class HashCommon { public
199
<s> package com . asakusafw . compiler . flow . jobflow ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . util . List ; import java . util . Set ; import org . junit . Test ; import com . asakusafw . compiler . flow . JobflowCompilerTestRoot ; import com . asakusafw . compiler . flow . example . NoShuffleStage ; import com . asakusafw . compiler . flow . example . SequentialMultiStage ; import com . asakusafw . compiler . flow . example . SimpleShuffleStage ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Delivery ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Export ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Import ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Process ; import com . asakusafw . compiler . flow . jobflow . JobflowModel . Stage ; import com . asakusafw . compiler . flow . plan . StageGraph ; import com . asakusafw . compiler . flow . stage . StageModel ; import com . asakusafw . compiler . flow . testing . external . Ex1MockExporterDescription ; import com . asakusafw . compiler . flow . testing . external . Ex1MockImporterDescription ; import com . asakusafw . compiler . flow . testing . external . ExSummarizedMockExporterDescription ; import com . asakusafw . utils . graph . Graph ; import com . asakusafw . utils . graph . Graphs ; public class JobflowAnalyzerTest extends JobflowCompilerTestRoot { @ Test public void mapperOnly ( ) { StageGraph graph = jfToStageGraph ( NoShuffleStage . class ) ; List < StageModel > stages = compileStages ( graph ) ; JobflowAnalyzer analyzer = new JobflowAnalyzer ( environment ) ; JobflowModel jobflow = analyzer . analyze ( graph , stages ) ; assertThat ( jobflow . getStages ( ) . size ( ) , is ( 1 ) ) ; assertThat ( jobflow . getImports ( ) . size ( ) , is ( 1 ) ) ; assertThat ( jobflow . getExports ( ) . size ( ) , is ( 1 ) ) ; Import prologue = jobflow . getImports ( ) . get ( 0 ) ; assertThat ( prologue . getDescription ( ) . getName ( ) , is ( "ex1" ) ) ; assertThat ( prologue . getDescription ( ) . getImporterDescription ( ) . getClass ( ) , is ( ( Object ) Ex1MockImporterDescription . class ) ) ; Export epilogue = jobflow . getExports ( ) . get ( 0 ) ; assertThat ( epilogue . getDescription ( ) . getName ( ) , is ( "ex1" ) ) ; assertThat ( epilogue . getDescription ( ) . getExporterDescription ( ) . getClass ( ) , is ( ( Object ) Ex1MockExporterDescription . class ) ) ; Stage stage = jobflow . getStages ( ) . get ( 0 ) ; assertThat ( stage . getProcesses ( ) . size ( ) , is ( 1 ) ) ; assertThat ( stage . getReduceOrNull ( ) , is ( nullValue ( ) ) ) ; } @ Test public void single ( ) { StageGraph graph = jfToStageGraph ( SimpleShuffleStage . class ) ; List < StageModel > stages = compileStages ( graph ) ; JobflowAnalyzer analyzer = new JobflowAnalyzer ( environment ) ; JobflowModel jobflow = analyzer . analyze ( graph , stages ) ; assertThat ( jobflow . getStages ( ) . size ( ) , is ( 1 ) ) ; assertThat ( jobflow . getImports ( ) . size ( ) , is ( 1 ) ) ; assertThat ( jobflow . getExports ( ) . size ( ) , is ( 1 ) ) ; Import prologue = jobflow . getImports ( ) . get ( 0 ) ; assertThat ( prologue . getDescription ( ) . getName ( ) , is ( "ex1" ) ) ; assertThat ( prologue . getDescription ( ) . getImporterDescription ( ) . getClass ( ) , is ( ( Object ) Ex1MockImporterDescription . class ) ) ; Export epilogue = jobflow . getExports ( ) . get ( 0 ) ; assertThat ( epilogue . getDescription ( ) . getName ( ) , is ( "exs" ) ) ; assertThat ( epilogue . getDescription ( ) . getExporterDescription ( ) . getClass ( ) , is ( ( Object ) ExSummarizedMockExporterDescription . class ) ) ; Stage stage = jobflow . getStages ( ) . get ( 0 ) ; assertThat ( stage . getProcesses ( ) . size ( ) , is ( 1 ) ) ; assertThat ( stage . getReduceOrNull ( ) , not ( nullValue ( ) ) ) ; } @ Test public void multi ( )