id
int32 0
3k
| input
stringlengths 43
33.8k
| gt
stringclasses 1
value |
---|---|---|
2,300 | <s> package net . sf . sveditor . core . srcgen ; import java . util . ArrayList ; import java . util . LinkedHashMap ; import java . util . List ; import java . util . Map ; import java . util . Set ; import net . sf . sveditor . core . db . ISVDBItemBase ; import net . sf . sveditor . core . db . ISVDBNamedItem ; import net . sf . sveditor . core . db . SVDBClassDecl ; import net . sf . sveditor . core . db . SVDBItem ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . SVDBTask ; import net . sf . sveditor . core . db . index . ISVDBIndexIterator ; import net . sf . sveditor . core . db . search . SVDBFindDefaultNameMatcher ; import net . sf . sveditor . core . db . search . SVDBFindSuperClass ; import net . sf . sveditor . core . log . ILogLevel ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; public class OverrideMethodsFinder implements ILogLevel { private SVDBClassDecl fLeafClass ; private Map < SVDBClassDecl , List < SVDBTask > > fClassMap ; private ISVDBIndexIterator fIndexIt ; private LogHandle fLog ; public OverrideMethodsFinder ( SVDBClassDecl leaf_class , ISVDBIndexIterator index_it ) { fLog = LogFactory . getLogHandle ( "" ) ; fLeafClass = leaf_class ; fClassMap = new LinkedHashMap < SVDBClassDecl , List < SVDBTask > > ( ) ; fIndexIt = index_it ; findClasses ( ) ; } public Set < SVDBClassDecl > getClassSet ( ) { return fClassMap . keySet ( ) ; } public List < SVDBTask > getMethods ( SVDBClassDecl cls ) { return fClassMap . get ( cls ) ; } private void findClasses ( ) { fClassMap . clear ( ) ; SVDBClassDecl cl = fLeafClass ; SVDBFindSuperClass finder_super = new SVDBFindSuperClass ( fIndexIt , SVDBFindDefaultNameMatcher . getDefault ( ) ) ; fLog . debug ( LEVEL_MID , "" + SVDBItem . getName ( cl ) ) ; while ( cl != null ) { cl = finder_super . find ( cl ) ; if ( cl != null ) { fLog . debug ( LEVEL_MID , "" + SVDBItem . getName ( cl ) ) ; List < SVDBTask > overrides = getClassOverrideTargets ( cl ) ; if ( overrides . size ( ) > 0 ) { fClassMap . put ( cl , getClassOverrideTargets ( cl ) ) ; } } } } private List < SVDBTask > getClassOverrideTargets ( SVDBClassDecl cls ) { List < SVDBTask > ret = new ArrayList < SVDBTask > ( ) ; for ( ISVDBItemBase it : cls . getChildren ( ) ) { if | |
2,301 | <s> package net . sf . sveditor . ui . views . hierarchy ; import net . sf . sveditor . core . hierarchy . HierarchyTreeNode ; import net . sf . sveditor . ui . svcp . SVTreeLabelProvider ; import org . eclipse . jface . viewers . StyledString ; import org . eclipse | |
2,302 | <s> package com . aptana . rdt . internal . ui . text ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . jface . text . BadLocationException ; import org . jruby . ast . ArrayNode ; import org . jruby . ast . CallNode ; import org . jruby . ast . Node ; import org . jruby . ast . RootNode ; import org . rubypeople . rdt . core . CompletionProposal ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . search . CollectingSearchRequestor ; import org . rubypeople . rdt . core . search . IRubySearchConstants ; import org . rubypeople . rdt . core . search . IRubySearchScope ; import org . rubypeople . rdt . core . search . SearchEngine ; import org . rubypeople . rdt . core . search . SearchMatch ; import org . rubypeople . rdt . core . search . SearchParticipant ; import org . rubypeople . rdt . core . search . SearchPattern ; import org . rubypeople . rdt . internal . core . parser . InOrderVisitor ; import org . rubypeople . rdt . internal . core . util . ASTUtil ; import org . rubypeople . rdt . internal . ti . util . OffsetNodeLocator ; import org . rubypeople . rdt . internal . ui . rubyeditor . ASTProvider ; import org . rubypeople . rdt . internal . ui . text . ruby . RubyContentAssistInvocationContext ; import org . rubypeople . rdt . ui . text . ruby . RubyCompletionProposalComputer ; import com . aptana . rdt . AptanaRDTPlugin ; public class HashKeyHeuristicProposalComputer extends RubyCompletionProposalComputer { public HashKeyHeuristicProposalComputer ( ) { super ( ) ; } @ Override protected List < CompletionProposal > doComputeCompletionProposals ( RubyContentAssistInvocationContext context , IProgressMonitor monitor ) { return computeHashKeySuggestions ( ) ; } private List < CompletionProposal > computeHashKeySuggestions ( ) { List < CompletionProposal > proposals = new ArrayList < CompletionProposal > ( ) ; String methodCall = getMethodName ( ) ; String args = getArgumentsToMethodCall ( ) ; int argIndex = calculateArgIndex ( args ) ; List < IRubyElement > methods = search ( IRubyElement . METHOD , methodCall , IRubySearchConstants . DECLARATIONS , SearchPattern . R_EXACT_MATCH ) ; for ( IRubyElement element : methods ) { IMethod method = ( IMethod ) element ; try { String [ ] parameters = method . getParameterNames ( ) ; if ( parameters == null || parameters . length == 0 ) continue ; if ( parameters . length <= argIndex ) { argIndex = parameters . length - 1 ; } String param = parameters [ argIndex ] ; if ( ! param . endsWith ( " = {}" ) ) continue ; RootNode ast = ASTProvider . getASTProvider ( ) . getAST ( method . getRubyScript ( ) , ASTProvider . WAIT_YES , new NullProgressMonitor ( ) ) ; Node methodDefNode = OffsetNodeLocator . Instance ( ) . getNodeAtOffset ( ast , method . getSourceRange ( ) . getOffset ( ) ) ; String variableName = param . substring ( 0 , param . indexOf ( ' ' ) ) ; ValidOptionVisitor visitor = new ValidOptionVisitor ( variableName ) ; methodDefNode . accept ( visitor ) ; Set < String > options = visitor . getValidOptions ( ) ; for ( String option : options ) { CompletionProposal proposal = new CompletionProposal ( CompletionProposal . KEYWORD , option , 201 ) ; proposal . setName ( option ) ; int start = fContext . getInvocationOffset ( ) ; proposal . setReplaceRange ( start , start + option . length ( ) ) ; proposals . add ( proposal ) ; } } catch ( RubyModelException e ) { AptanaRDTPlugin . log ( e ) ; } } return proposals ; } protected List < IRubyElement > search ( int type , String patternString , int limitTo , int matchRule ) { List < IRubyElement > elements = new ArrayList < IRubyElement > ( ) ; try { SearchEngine engine = new SearchEngine ( ) ; SearchPattern pattern = SearchPattern . createPattern ( type , patternString , limitTo , matchRule ) ; SearchParticipant [ ] participants = new SearchParticipant [ ] { SearchEngine . getDefaultSearchParticipant ( ) } ; IRubySearchScope scope = null ; if ( fContext . getRubyScript ( ) == null ) { scope = SearchEngine . createWorkspaceScope ( ) ; } else { scope = SearchEngine . createRubySearchScope ( new IRubyElement [ ] { fContext . getRubyScript ( ) . getRubyProject ( ) } ) ; } CollectingSearchRequestor requestor = new CollectingSearchRequestor ( ) ; engine . search ( pattern , participants , scope , requestor , new NullProgressMonitor ( ) ) ; List < SearchMatch > matches = requestor . getResults ( ) ; for ( SearchMatch match : matches ) { elements . add ( ( IRubyElement ) match . getElement ( ) ) ; } } catch ( CoreException e ) { AptanaRDTPlugin . log ( e ) ; } return elements ; } private String getArgumentsToMethodCall ( ) { String prefix = getStatementPrefix ( ) ; String methodCall = getMethodName ( ) ; String args = prefix . trim ( ) . substring ( methodCall . length ( ) ) ; if ( args . startsWith ( "(" ) ) args = args . substring ( 1 ) ; return args ; } private String getMethodName ( ) { String prefix = getStatementPrefix ( ) ; String methodCall = prefix . trim ( ) ; int space = methodCall . indexOf ( " " ) ; if ( space != - 1 ) { methodCall = methodCall . substring ( 0 , space ) ; } | |
2,303 | <s> package com . asakusafw . windgate . core ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . Collections ; import java . util . List ; import java . util . Map ; import java . util . TreeMap ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . runtime . core . context . RuntimeContext ; import com . asakusafw . runtime . core . context . SimulationSupport ; import com . asakusafw . windgate . core . resource . ResourceProfile ; import com . asakusafw . windgate . core . resource . ResourceProvider ; import com . asakusafw . windgate . core . session . SessionException ; import com . asakusafw . windgate . core . session . SessionException . Reason ; import com . asakusafw . windgate . core . session . SessionMirror ; import com . asakusafw . windgate . core . session . SessionProfile ; import com . asakusafw . windgate . core . session . SessionProvider ; @ SimulationSupport public class AbortTask { static final WindGateLogger WGLOG = new WindGateCoreLogger ( AbortTask . class ) ; static final Logger LOG = LoggerFactory . getLogger ( AbortTask . class ) ; private final GateProfile profile ; private final String sessionId ; private final SessionProvider sessionProvider ; private final Map < String , ResourceProvider > resourceProviders ; public AbortTask ( GateProfile profile , String sessionId ) throws IOException { if ( profile == null ) { throw new IllegalArgumentException ( "" ) ; } this . profile = profile ; this . sessionId = sessionId ; this . sessionProvider = loadSessionProvider ( profile . getSession ( ) ) ; this . resourceProviders = loadResourceProviders ( profile . getResources ( ) ) ; } private SessionProvider loadSessionProvider ( SessionProfile session ) throws IOException { assert session != null ; LOG . debug ( "" , session . getProviderClass ( ) . getName ( ) ) ; SessionProvider result = session . createProvider ( ) ; return result ; } private Map < String , ResourceProvider > loadResourceProviders | |
2,304 | <s> package com . lmax . disruptor ; public interface ProducerBarrier < T extends AbstractEntry > { T nextEntry ( ) ; SequenceBatch nextEntries ( SequenceBatch sequenceBatch ) ; void commit ( T entry ) ; void | |
2,305 | <s> package org . rubypeople . rdt . tests . all ; import junit . framework . Test ; import junit . framework . TestSuite ; import org . rubypeople . rdt . debug . core . tests . FTS_Debug ; public class TS_RdtAllFunctionalTests { public static | |
2,306 | <s> package org . rubypeople . rdt . internal . ui . text . ruby . hover ; import java . util . ArrayList ; import java . util . HashMap ; import java . util . List ; import java . util . StringTokenizer ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IConfigurationElement ; import org . eclipse . core . runtime . IExtensionRegistry ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . Platform ; import org . eclipse . core . runtime . Status ; import org . eclipse . jface . text . Assert ; import org . eclipse . swt . SWT ; import org . osgi . framework . Bundle ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . rubyeditor . EditorUtility ; import org . rubypeople . rdt . ui . PreferenceConstants ; import org . rubypeople . rdt . ui . text . ruby . hover . IRubyEditorTextHover ; public class RubyEditorTextHoverDescriptor { private static final String RUBY_EDITOR_TEXT_HOVER_EXTENSION_POINT = "" ; private static final String HOVER_TAG = "hover" ; private static final String ID_ATTRIBUTE = "id" ; private static final String CLASS_ATTRIBUTE = "class" ; private static final String LABEL_ATTRIBUTE = "label" ; private static final String ACTIVATE_PLUG_IN_ATTRIBUTE = "activate" ; private static final String DESCRIPTION_ATTRIBUTE = "description" ; public static final String NO_MODIFIER = "0" ; public static final String DISABLED_TAG = "!" ; public static final String VALUE_SEPARATOR = ";" ; private int fStateMask ; private String fModifierString ; private boolean fIsEnabled ; private IConfigurationElement fElement ; public static RubyEditorTextHoverDescriptor [ ] getContributedHovers ( ) { IExtensionRegistry registry = Platform . getExtensionRegistry ( ) ; IConfigurationElement [ ] elements = registry . getConfigurationElementsFor ( RUBY_EDITOR_TEXT_HOVER_EXTENSION_POINT ) ; RubyEditorTextHoverDescriptor [ ] hoverDescs = createDescriptors ( elements ) ; initializeFromPreferences ( hoverDescs ) ; return hoverDescs ; } public static int computeStateMask ( String modifiers ) { if ( modifiers == null ) return - 1 ; if ( modifiers . length ( ) == 0 ) return SWT . NONE ; int stateMask = 0 ; StringTokenizer modifierTokenizer = new StringTokenizer ( modifiers , ",;.:+-* " ) ; while ( modifierTokenizer . hasMoreTokens ( ) ) { int modifier = EditorUtility . findLocalizedModifier ( modifierTokenizer . nextToken ( ) ) ; if ( modifier == 0 || ( stateMask & modifier ) == modifier ) return - 1 ; stateMask = stateMask | modifier ; } return stateMask ; } private RubyEditorTextHoverDescriptor ( IConfigurationElement element ) { Assert . isNotNull ( element ) ; fElement = element ; } public IRubyEditorTextHover createTextHover ( ) { String pluginId = fElement . getContributor ( ) . getName ( ) ; boolean isHoversPlugInActivated = Platform . getBundle ( pluginId ) . getState ( ) == Bundle . ACTIVE ; if ( isHoversPlugInActivated || canActivatePlugIn ( ) ) { try { return ( IRubyEditorTextHover ) fElement . createExecutableExtension ( CLASS_ATTRIBUTE ) ; } catch ( CoreException x ) { RubyPlugin . log ( new Status ( IStatus . ERROR , RubyPlugin . getPluginId ( ) , 0 , RubyHoverMessages . RubyTextHover_createTextHover , null ) ) ; } } return null ; } public String getId ( ) { return fElement . getAttribute ( ID_ATTRIBUTE ) ; } public String getHoverClassName ( ) { return fElement . getAttribute ( CLASS_ATTRIBUTE ) ; } public String getLabel ( ) { String label = fElement . getAttribute ( LABEL_ATTRIBUTE ) ; if ( label != null ) return label ; label = getHoverClassName ( ) ; int lastDot = label . lastIndexOf ( '.' ) ; if ( lastDot >= 0 && lastDot < label . length ( ) - 1 ) return label . substring ( lastDot + 1 ) ; else return label ; } public String getDescription ( ) { return fElement . getAttribute ( DESCRIPTION_ATTRIBUTE ) ; } public boolean canActivatePlugIn ( ) { return Boolean . valueOf ( fElement . getAttribute ( ACTIVATE_PLUG_IN_ATTRIBUTE ) ) . booleanValue ( ) ; } public boolean equals ( Object obj ) { if ( obj == null || ! obj . getClass ( ) . equals ( this . getClass ( ) ) || getId ( ) == null ) return false ; return getId ( ) . equals ( ( ( RubyEditorTextHoverDescriptor ) obj ) . getId ( ) ) ; } public int hashCode ( ) { return getId ( ) . hashCode ( ) ; } private static RubyEditorTextHoverDescriptor [ ] createDescriptors ( IConfigurationElement [ ] elements ) { List result = new ArrayList ( elements . length ) ; for ( int i = 0 ; i < elements . length ; i ++ ) { IConfigurationElement element = elements [ i ] ; if ( HOVER_TAG . equals ( element . getName ( ) ) ) { RubyEditorTextHoverDescriptor desc = new RubyEditorTextHoverDescriptor ( element ) ; result . add ( desc ) ; } } return ( RubyEditorTextHoverDescriptor [ ] ) result . toArray ( new RubyEditorTextHoverDescriptor [ result . size ( ) ] ) ; } private static void initializeFromPreferences ( RubyEditorTextHoverDescriptor [ ] hovers ) { String compiledTextHoverModifiers = RubyPlugin . getDefault ( ) . getPreferenceStore ( ) . getString ( PreferenceConstants . EDITOR_TEXT_HOVER_MODIFIERS ) ; StringTokenizer tokenizer = new StringTokenizer ( compiledTextHoverModifiers , VALUE_SEPARATOR ) ; HashMap idToModifier = new HashMap ( tokenizer . countTokens ( ) / 2 ) ; while ( tokenizer . hasMoreTokens ( ) ) { String id = tokenizer . nextToken ( ) ; if ( tokenizer . hasMoreTokens ( ) ) idToModifier . put ( id , tokenizer . nextToken ( ) ) ; } String compiledTextHoverModifierMasks = RubyPlugin . getDefault ( ) . getPreferenceStore ( ) . getString ( PreferenceConstants . EDITOR_TEXT_HOVER_MODIFIER_MASKS ) ; tokenizer = new StringTokenizer ( compiledTextHoverModifierMasks , VALUE_SEPARATOR ) ; HashMap idToModifierMask = new HashMap ( tokenizer . countTokens ( ) / 2 ) ; while ( tokenizer . hasMoreTokens ( ) ) { String id = tokenizer . nextToken ( ) ; if ( tokenizer . hasMoreTokens ( ) ) idToModifierMask . put ( id | |
2,307 | <s> package de . fuberlin . wiwiss . d2rq . server ; import java . io . IOException ; import java . io . OutputStreamWriter ; import javax . servlet . ServletOutputStream ; import javax . servlet . http . HttpServletRequest ; import javax . servlet . http . HttpServletResponse ; import com . hp . hpl . jena . rdf . model . Model ; import com . hp . hpl . jena . rdf . model . RDFWriter ; import com . hp . hpl . jena . shared . JenaException ; import de . fuberlin . wiwiss . pubby . negotiation . ContentTypeNegotiator ; import de . fuberlin . wiwiss . pubby . negotiation . MediaRangeSpec ; import de . fuberlin . wiwiss . pubby . negotiation . PubbyNegotiator ; public class ModelResponse { private final Model model ; private final HttpServletRequest request ; private final HttpServletResponse response ; public ModelResponse ( Model model , HttpServletRequest request , HttpServletResponse response ) { RequestParamHandler handler = new RequestParamHandler ( request ) ; if ( handler . isMatchingRequest ( ) ) { request = handler . getModifiedRequest ( ) ; } this . model = model ; this . request = request ; this . response = response ; } public void serve ( ) { try { doResponseModel ( ) ; } catch ( IOException ioEx ) { throw new RuntimeException ( ioEx ) ; } catch ( JenaException jEx ) { try { response . sendError ( HttpServletResponse . SC_INTERNAL_SERVER_ERROR , "" + jEx . getMessage ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } } private void doResponseModel ( ) throws IOException { response . addHeader ( "Vary" , "Accept" ) ; ContentTypeNegotiator negotiator = PubbyNegotiator . getDataNegotiator ( ) ; MediaRangeSpec bestMatch = negotiator . getBestMatch ( request . getHeader ( "Accept" ) , request . getHeader ( "User-Agent" ) ) ; if ( bestMatch == null ) { response . setStatus ( 406 ) ; response . setContentType ( "text/plain" ) ; ServletOutputStream out = response . getOutputStream ( ) ; out . println ( "" ) ; out . println ( "" ) ; return ; } response . setContentType ( bestMatch . getMediaType ( ) ) ; getWriter ( bestMatch . | |
2,308 | <s> package test . modelgen . table . io ; import java . io . IOException ; import javax . annotation . Generated ; import test . modelgen . table . model . ImportTarget1Error ; import com . asakusafw . runtime . io . ModelOutput ; import com . asakusafw . runtime . io . RecordEmitter ; @ Generated ( "" ) @ SuppressWarnings ( "deprecation" ) public final class ImportTarget1ErrorModelOutput | |
2,309 | <s> package com . asakusafw . compiler . flow . visualizer ; import java . util . Collections ; import java . util . Set ; import java . util . UUID ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . utils . collections . Sets ; import com . asakusafw . vocabulary . flow . graph . FlowElement ; public class VisualFlowPart implements VisualNode { private final UUID id = UUID . randomUUID ( ) ; private final FlowElement element ; private final Set < VisualNode > nodes ; public VisualFlowPart ( FlowElement element , Set < ? extends VisualNode > nodes | |
2,310 | <s> package org . rubypeople . rdt . internal . ui . typehierarchy ; import java . lang . reflect . InvocationTargetException ; import java . util . ArrayList ; import java . util . List ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . core . runtime . Status ; import org . eclipse . core . runtime . jobs . Job ; import org . eclipse . jface . action . IMenuListener ; import org . eclipse . jface . action . IMenuManager ; import org . eclipse . jface . action . IStatusLineManager ; import org . eclipse . jface . action . IToolBarManager ; import org . eclipse . jface . action . MenuManager ; import org . eclipse . jface . action . Separator ; import org . eclipse . jface . action . ToolBarManager ; import org . eclipse . jface . dialogs . IDialogSettings ; import org . eclipse . jface . dialogs . MessageDialog ; import org . eclipse . jface . util . Assert ; import org . eclipse . jface . util . IPropertyChangeListener ; import org . eclipse . jface . util . PropertyChangeEvent ; import org . eclipse . jface . util . TransferDragSourceListener ; import org . eclipse . jface . viewers . AbstractTreeViewer ; import org . eclipse . jface . viewers . IBasicPropertyConstants ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . viewers . SelectionChangedEvent ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . jface . viewers . StructuredViewer ; import org . eclipse . swt . SWT ; import org . eclipse . swt . custom . BusyIndicator ; import org . eclipse . swt . custom . CLabel ; import org . eclipse . swt . custom . SashForm ; import org . eclipse . swt . custom . ViewForm ; import org . eclipse . swt . dnd . DND ; import org . eclipse . swt . dnd . DropTarget ; import org . eclipse . swt . dnd . DropTargetAdapter ; import org . eclipse . swt . dnd . Transfer ; import org . eclipse . swt . events . ControlEvent ; import org . eclipse . swt . events . ControlListener ; import org . eclipse . swt . events . FocusEvent ; import org . eclipse . swt . events . FocusListener ; import org . eclipse . swt . events . KeyAdapter ; import org . eclipse . swt . events . KeyEvent ; import org . eclipse . swt . events . KeyListener ; import org . eclipse . swt . graphics . Point ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . swt . widgets . Display ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . ScrollBar ; import org . eclipse . swt . widgets . ToolBar ; import org . eclipse . ui . IActionBars ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . IMemento ; import org . eclipse . ui . IPageLayout ; import org . eclipse . ui . IPartListener2 ; import org . eclipse . ui . IViewSite ; import org . eclipse . ui . IWorkbenchActionConstants ; import org . eclipse . ui . IWorkbenchPart ; import org . eclipse . ui . IWorkbenchPartReference ; import org . eclipse . ui . IWorkingSet ; import org . eclipse . ui . IWorkingSetManager ; import org . eclipse . ui . PartInitException ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . actions . ActionContext ; import org . eclipse . ui . actions . ActionFactory ; import org . eclipse . ui . actions . ActionGroup ; import org . eclipse . ui . part . IShowInSource ; import org . eclipse . ui . part . IShowInTargetList ; import org . eclipse . ui . part . PageBook ; import org . eclipse . ui . part . ResourceTransfer ; import org . eclipse . ui . part . ShowInContext ; import org . eclipse . ui . part . ViewPart ; import org . eclipse . ui . views . navigator . LocalSelectionTransfer ; import org . rubypeople . rdt . core . IMember ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . ITypeHierarchy ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . core . util . Messages ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . actions . CompositeActionGroup ; import org . rubypeople . rdt . internal . ui . actions . NewWizardsActionGroup ; import org . rubypeople . rdt . internal . ui . actions . SelectAllAction ; import org . rubypeople . rdt . internal . ui . dnd . RdtViewerDragAdapter ; import org . rubypeople . rdt . internal . ui . packageview . ResourceTransferDragAdapter ; import org . rubypeople . rdt . internal . ui . packageview . SelectionTransferDragAdapter ; import org . rubypeople . rdt . internal . ui . preferences . MembersOrderPreferenceCache ; import org . rubypeople . rdt . internal . ui . rubyeditor . EditorUtility ; import org . rubypeople . rdt . internal . ui . util . ExceptionHandler ; import org . rubypeople . rdt . internal . ui . viewsupport . IViewPartInputProvider ; import org . rubypeople . rdt . internal . ui . viewsupport . RubyUILabelProvider ; import org . rubypeople . rdt . internal . ui . viewsupport . SelectionProviderMediator ; import org . rubypeople . rdt . internal . ui . viewsupport . StatusBarUpdater ; import org . rubypeople . rdt . internal . ui . workingsets . WorkingSetFilterActionGroup ; import org . rubypeople . rdt . ui . IContextMenuConstants ; import org . rubypeople . rdt . ui . ITypeHierarchyViewPart ; import org . rubypeople . rdt . ui . PreferenceConstants ; import org . rubypeople . rdt . ui . RubyElementLabels ; import org . rubypeople . rdt . ui . RubyUI ; import org . rubypeople . rdt . ui . actions . OpenEditorActionGroup ; import org . rubypeople . rdt . ui . actions . OpenViewActionGroup ; import org . rubypeople . rdt . ui . actions . RubySearchActionGroup ; public class TypeHierarchyViewPart extends ViewPart implements ITypeHierarchyViewPart , IViewPartInputProvider { public static final int VIEW_ID_TYPE = 2 ; public static final int VIEW_ID_SUPER = 0 ; public static final int VIEW_ID_SUB = 1 ; public static final int VIEW_ORIENTATION_VERTICAL = 0 ; public static final int VIEW_ORIENTATION_HORIZONTAL = 1 ; public static final int VIEW_ORIENTATION_SINGLE = 2 ; public static final int VIEW_ORIENTATION_AUTOMATIC = 3 ; private static final String DIALOGSTORE_HIERARCHYVIEW = "" ; private static final String DIALOGSTORE_VIEWORIENTATION = "" ; private static final String TAG_INPUT = "input" ; private static final String TAG_VIEW = "view" ; private static final String TAG_ORIENTATION = "orientation" ; private static final String TAG_RATIO = "ratio" ; private static final String TAG_SELECTION = "selection" ; private static final String TAG_VERTICAL_SCROLL = "" ; private static final String GROUP_FOCUS = "group.focus" ; private IType fSelectedType ; private IRubyElement fInputElement ; private ArrayList fInputHistory ; private IMemento fMemento ; private IDialogSettings fDialogSettings ; private TypeHierarchyLifeCycle fHierarchyLifeCycle ; private ITypeHierarchyLifeCycleListener fTypeHierarchyLifeCycleListener ; private IPropertyChangeListener fPropertyChangeListener ; private SelectionProviderMediator fSelectionProviderMediator ; private ISelectionChangedListener fSelectionChangedListener ; private IPartListener2 fPartListener ; private int fCurrentOrientation ; int fOrientation = VIEW_ORIENTATION_AUTOMATIC ; boolean fInComputeOrientation = false ; private boolean fLinkingEnabled ; private boolean fSelectInEditor ; private boolean fIsVisible ; private boolean fNeedRefresh ; private boolean fIsEnableMemberFilter ; private boolean fIsRefreshRunnablePosted ; private int fCurrentViewerIndex ; private TypeHierarchyViewer [ ] fAllViewers ; private MethodsViewer fMethodsViewer ; private SashForm fTypeMethodsSplitter ; private PageBook fViewerbook ; private PageBook fPagebook ; private Label fNoHierarchyShownLabel ; private Label fEmptyTypesViewer ; private ViewForm fTypeViewerViewForm ; private ViewForm fMethodViewerViewForm ; private CLabel fMethodViewerPaneLabel ; private RubyUILabelProvider fPaneLabelProvider ; private Composite fParent ; private ToggleViewAction [ ] fViewActions ; private ToggleLinkingAction fToggleLinkingAction ; private HistoryDropDownAction fHistoryDropDownAction ; private ToggleOrientationAction [ ] fToggleOrientationActions ; private EnableMemberFilterAction fEnableMemberFilterAction ; private ShowQualifiedTypeNamesAction fShowQualifiedTypeNamesAction ; private FocusOnTypeAction fFocusOnTypeAction ; private FocusOnSelectionAction fFocusOnSelectionAction ; private CompositeActionGroup fActionGroups ; private SelectAllAction fSelectAllAction ; private WorkingSetFilterActionGroup fWorkingSetActionGroup ; private Job fRestoreStateJob ; public TypeHierarchyViewPart ( ) { fSelectedType = null ; fInputElement = null ; fIsVisible = false ; fIsRefreshRunnablePosted = false ; fSelectInEditor = true ; fRestoreStateJob = null ; fHierarchyLifeCycle = new TypeHierarchyLifeCycle ( ) ; fTypeHierarchyLifeCycleListener = new ITypeHierarchyLifeCycleListener ( ) { public void typeHierarchyChanged ( TypeHierarchyLifeCycle typeHierarchy , IType [ ] changedTypes ) { doTypeHierarchyChanged ( typeHierarchy , changedTypes ) ; } } ; fHierarchyLifeCycle . addChangedListener ( fTypeHierarchyLifeCycleListener ) ; fPropertyChangeListener = new IPropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent event ) { doPropertyChange ( event ) ; } } ; PreferenceConstants . getPreferenceStore ( ) . addPropertyChangeListener ( fPropertyChangeListener ) ; fIsEnableMemberFilter = false ; fInputHistory = new ArrayList ( ) ; fAllViewers = null ; fViewActions = new ToggleViewAction [ ] { new ToggleViewAction ( this , VIEW_ID_TYPE ) , new ToggleViewAction ( this , VIEW_ID_SUPER ) , new ToggleViewAction ( this , VIEW_ID_SUB ) } ; fDialogSettings = RubyPlugin . getDefault ( ) . getDialogSettings ( ) ; fHistoryDropDownAction = new HistoryDropDownAction ( this ) ; fHistoryDropDownAction . setEnabled ( false ) ; fToggleOrientationActions = new ToggleOrientationAction [ ] { new ToggleOrientationAction ( this , VIEW_ORIENTATION_VERTICAL ) , new ToggleOrientationAction ( this , VIEW_ORIENTATION_HORIZONTAL ) , new ToggleOrientationAction ( this , VIEW_ORIENTATION_AUTOMATIC ) , new ToggleOrientationAction ( this , VIEW_ORIENTATION_SINGLE ) } ; fEnableMemberFilterAction = new EnableMemberFilterAction ( this , false ) ; fShowQualifiedTypeNamesAction = new ShowQualifiedTypeNamesAction ( this , false ) ; fFocusOnTypeAction = new FocusOnTypeAction ( this ) ; fPaneLabelProvider = new RubyUILabelProvider ( ) ; fFocusOnSelectionAction = new FocusOnSelectionAction ( this ) ; fPartListener = new IPartListener2 ( ) { public void partVisible ( IWorkbenchPartReference ref ) { IWorkbenchPart part = ref . getPart ( false ) ; if ( part == TypeHierarchyViewPart . this ) { visibilityChanged ( true ) ; } } public void partHidden ( IWorkbenchPartReference ref ) { IWorkbenchPart part = ref . getPart ( false ) ; if ( part == TypeHierarchyViewPart . this ) { visibilityChanged ( false ) ; } } public void partActivated ( IWorkbenchPartReference ref ) { IWorkbenchPart part = ref . getPart ( false ) ; if ( part instanceof IEditorPart ) editorActivated ( ( IEditorPart ) part ) ; } public void partInputChanged ( IWorkbenchPartReference ref ) { IWorkbenchPart part = ref . getPart ( false ) ; if ( part instanceof IEditorPart ) editorActivated ( ( IEditorPart ) part ) ; } public void partBroughtToTop ( IWorkbenchPartReference ref ) { } public void partClosed ( IWorkbenchPartReference ref ) { } public void partDeactivated ( IWorkbenchPartReference ref ) { } public void partOpened ( IWorkbenchPartReference ref ) { } } ; fSelectionChangedListener = new ISelectionChangedListener ( ) { public void selectionChanged ( SelectionChangedEvent event ) { doSelectionChanged ( event ) ; } } ; fLinkingEnabled = PreferenceConstants . getPreferenceStore ( ) . getBoolean ( PreferenceConstants . LINK_TYPEHIERARCHY_TO_EDITOR ) ; } protected void doPropertyChange ( PropertyChangeEvent event ) { String property = event . getProperty ( ) ; if ( fMethodsViewer != null ) { if ( MembersOrderPreferenceCache . isMemberOrderProperty ( event . getProperty ( ) ) ) { fMethodsViewer . refresh ( ) ; } } if ( IWorkingSetManager . CHANGE_WORKING_SET_CONTENT_CHANGE . equals ( property ) ) { updateHierarchyViewer ( true ) ; updateTitle ( ) ; } } private void addHistoryEntry ( IRubyElement entry ) { if ( fInputHistory . contains ( entry ) ) { fInputHistory . remove ( entry ) ; } fInputHistory . add ( 0 , entry ) ; fHistoryDropDownAction . setEnabled ( true ) ; } private void updateHistoryEntries ( ) { for ( int i = fInputHistory . size ( ) - 1 ; i >= 0 ; i -- ) { IRubyElement type = ( IRubyElement ) fInputHistory . get ( i ) ; if ( ! type . exists ( ) ) { fInputHistory . remove ( i ) ; } } fHistoryDropDownAction . setEnabled ( ! fInputHistory . isEmpty ( ) ) ; } public void gotoHistoryEntry ( IRubyElement entry ) { if ( fInputHistory . contains ( entry ) ) { updateInput ( entry ) ; } } public IRubyElement [ ] getHistoryEntries ( ) { if ( fInputHistory . size ( ) > 0 ) { updateHistoryEntries ( ) ; } return ( IRubyElement [ ] ) fInputHistory . toArray ( new IRubyElement [ fInputHistory . size ( ) ] ) ; } public void setHistoryEntries ( IRubyElement [ ] elems ) { fInputHistory . clear ( ) ; for ( int i = 0 ; i < elems . length ; i ++ ) { fInputHistory . add ( elems [ i ] ) ; } updateHistoryEntries ( ) ; } public void selectMember ( IMember member ) { fSelectInEditor = false ; if ( member . getElementType ( ) != IRubyElement . TYPE ) { Control methodControl = fMethodsViewer . getControl ( ) ; if ( methodControl != null && ! methodControl . isDisposed ( ) ) { methodControl . setFocus ( ) ; } fMethodsViewer . setSelection ( new StructuredSelection ( member ) , true ) ; } else { Control viewerControl = getCurrentViewer ( ) . getControl ( ) ; if ( viewerControl != null && ! viewerControl . isDisposed ( ) ) { viewerControl . setFocus ( ) ; } if ( ! member . equals ( fSelectedType ) ) { getCurrentViewer ( ) . setSelection ( new StructuredSelection ( member ) , true ) ; } } fSelectInEditor = true ; } public IType getInput ( ) { if ( fInputElement instanceof IType ) { return ( IType ) fInputElement ; } return null ; } public void setInput ( IType type ) { setInputElement ( type ) ; } public IRubyElement getInputElement ( ) { return fInputElement ; } public void setInputElement ( IRubyElement element ) { IMember memberToSelect = null ; if ( element != null ) { if ( element instanceof IMember ) { if ( element . getElementType ( ) != IRubyElement . TYPE ) { memberToSelect = ( IMember ) element ; element = memberToSelect . getDeclaringType ( ) ; } if ( ! element . exists ( ) ) { MessageDialog . openError ( getSite ( ) . getShell ( ) , TypeHierarchyMessages . TypeHierarchyViewPart_error_title , TypeHierarchyMessages . TypeHierarchyViewPart_error_message ) ; return ; } } else { int kind = element . getElementType ( ) ; if ( kind != IRubyElement . RUBY_PROJECT && kind != IRubyElement . SOURCE_FOLDER_ROOT && kind != IRubyElement . SOURCE_FOLDER ) { element = null ; RubyPlugin . logErrorMessage ( "" ) ; } } } if ( element != null && ! element . equals ( fInputElement ) ) { addHistoryEntry ( element ) ; } updateInput ( element ) ; if ( memberToSelect != null ) { selectMember ( memberToSelect ) ; } } private void updateInput ( IRubyElement inputElement ) { IRubyElement prevInput = fInputElement ; synchronized ( this ) { if ( fRestoreStateJob != null ) { fRestoreStateJob . cancel ( ) ; try { fRestoreStateJob . join ( ) ; } catch ( InterruptedException e ) { } finally { fRestoreStateJob = null ; } } } processOutstandingEvents ( ) ; if ( inputElement == null ) { clearInput ( ) ; } else { fInputElement = inputElement ; try { fHierarchyLifeCycle . ensureRefreshedTypeHierarchy ( inputElement , RubyPlugin . getActiveWorkbenchWindow ( ) ) ; } catch ( InvocationTargetException e ) { ExceptionHandler . handle ( e , getSite ( ) . getShell ( ) , TypeHierarchyMessages . TypeHierarchyViewPart_exception_title , TypeHierarchyMessages . TypeHierarchyViewPart_exception_message ) ; clearInput ( ) ; return ; } catch ( InterruptedException e ) { return ; } if ( inputElement . getElementType ( ) != IRubyElement . TYPE ) { setView ( VIEW_ID_TYPE ) ; } fSelectInEditor = false ; setMemberFilter ( null ) ; internalSelectType ( null , false ) ; fIsEnableMemberFilter = false ; if ( ! inputElement . equals ( prevInput ) ) { updateHierarchyViewer ( true ) ; } IType root = getSelectableType ( inputElement ) ; internalSelectType ( root , true ) ; updateMethodViewer ( root ) ; updateToolbarButtons ( ) ; updateTitle ( ) ; enableMemberFilter ( false ) ; fPagebook . showPage ( fTypeMethodsSplitter ) ; fSelectInEditor = true ; } } private void processOutstandingEvents ( ) { Display display = getDisplay ( ) ; if ( display != null && ! display . isDisposed ( ) ) display . update ( ) ; } private void clearInput ( ) { fInputElement = null ; fHierarchyLifeCycle . freeHierarchy ( ) ; updateHierarchyViewer ( false ) ; updateToolbarButtons ( ) ; } public void setFocus ( ) { fPagebook . setFocus ( ) ; } public void dispose ( ) { fHierarchyLifeCycle . freeHierarchy ( ) ; fHierarchyLifeCycle . removeChangedListener ( fTypeHierarchyLifeCycleListener ) ; fPaneLabelProvider . dispose ( ) ; if ( fMethodsViewer != null ) { fMethodsViewer . dispose ( ) ; } if ( fPropertyChangeListener != null ) { RubyPlugin . getDefault ( ) . getPreferenceStore ( ) . removePropertyChangeListener ( fPropertyChangeListener ) ; fPropertyChangeListener = null ; } getSite ( ) . getPage ( ) . removePartListener ( fPartListener ) ; if ( fActionGroups != null ) fActionGroups . dispose ( ) ; if ( fWorkingSetActionGroup != null ) { fWorkingSetActionGroup . dispose ( ) ; } super . dispose ( ) ; } public Object getAdapter ( Class key ) { if ( key == IShowInSource . class ) { return getShowInSource ( ) ; } if ( key == IShowInTargetList . class ) { return new IShowInTargetList ( ) { public String [ ] getShowInTargetIds ( ) { return new String [ ] { RubyUI . ID_RUBY_EXPLORER , IPageLayout . ID_RES_NAV } ; } } ; } return super . getAdapter ( key ) ; } private Control createTypeViewerControl ( Composite parent ) { fViewerbook = new PageBook ( parent , SWT . NULL ) ; KeyListener keyListener = createKeyListener ( ) ; TypeHierarchyViewer superTypesViewer = new SuperTypeHierarchyViewer ( fViewerbook , fHierarchyLifeCycle , this ) ; initializeTypesViewer ( superTypesViewer , keyListener , IContextMenuConstants . TARGET_ID_SUPERTYPES_VIEW ) ; TypeHierarchyViewer subTypesViewer = new SubTypeHierarchyViewer ( fViewerbook , fHierarchyLifeCycle , this ) ; initializeTypesViewer ( subTypesViewer , keyListener , IContextMenuConstants . TARGET_ID_SUBTYPES_VIEW ) ; TypeHierarchyViewer vajViewer = new TraditionalHierarchyViewer ( fViewerbook , fHierarchyLifeCycle , this ) ; initializeTypesViewer ( vajViewer , keyListener , IContextMenuConstants . TARGET_ID_HIERARCHY_VIEW ) ; fAllViewers = new TypeHierarchyViewer [ 3 ] ; fAllViewers [ VIEW_ID_SUPER ] = superTypesViewer ; fAllViewers [ VIEW_ID_SUB ] = subTypesViewer ; fAllViewers [ VIEW_ID_TYPE ] = vajViewer ; int currViewerIndex ; try { currViewerIndex = fDialogSettings . getInt ( DIALOGSTORE_HIERARCHYVIEW ) ; if ( currViewerIndex < 0 || currViewerIndex > 2 ) { currViewerIndex = VIEW_ID_TYPE ; } } catch ( NumberFormatException e ) { currViewerIndex = VIEW_ID_TYPE ; } fEmptyTypesViewer = new Label ( fViewerbook , SWT . TOP | SWT . LEFT | SWT . WRAP ) ; for ( int i = 0 ; i < fAllViewers . length ; i ++ ) { fAllViewers [ i ] . setInput ( fAllViewers [ i ] ) ; } fCurrentViewerIndex = - 1 ; setView ( currViewerIndex ) ; return fViewerbook ; } private KeyListener createKeyListener ( ) { return new KeyAdapter ( ) { public void keyReleased ( KeyEvent event ) { if ( event . stateMask == 0 ) { if ( event . keyCode == SWT . F5 ) { ITypeHierarchy hierarchy = fHierarchyLifeCycle . getHierarchy ( ) ; if ( hierarchy != null ) { fHierarchyLifeCycle . typeHierarchyChanged ( hierarchy ) ; doTypeHierarchyChangedOnViewers ( null ) ; } updateHierarchyViewer ( false ) ; return ; } } } } ; } private void initializeTypesViewer ( final TypeHierarchyViewer typesViewer , KeyListener keyListener , String cotextHelpId ) { typesViewer . getControl ( ) . setVisible ( false ) ; typesViewer . getControl ( ) . addKeyListener ( keyListener ) ; typesViewer . initContextMenu ( new IMenuListener ( ) { public void menuAboutToShow ( IMenuManager menu ) { fillTypesViewerContextMenu ( typesViewer , menu ) ; } } , cotextHelpId , getSite ( ) ) ; typesViewer . addPostSelectionChangedListener ( fSelectionChangedListener ) ; typesViewer . setQualifiedTypeName ( isShowQualifiedTypeNames ( ) ) ; typesViewer . setWorkingSetFilter ( fWorkingSetActionGroup . getWorkingSetFilter ( ) ) ; } private Control createMethodViewerControl ( Composite parent ) { fMethodsViewer = new MethodsViewer ( parent , fHierarchyLifeCycle , this ) ; fMethodsViewer . initContextMenu ( new IMenuListener ( ) { public void menuAboutToShow ( IMenuManager menu ) { fillMethodsViewerContextMenu ( menu ) ; } } , IContextMenuConstants . TARGET_ID_MEMBERS_VIEW , getSite ( ) ) ; fMethodsViewer . addPostSelectionChangedListener ( fSelectionChangedListener ) ; Control control = fMethodsViewer . getTable ( ) ; control . addKeyListener ( createKeyListener ( ) ) ; control . addFocusListener ( new FocusListener ( ) { public void focusGained ( FocusEvent e ) { fSelectAllAction . setEnabled ( true ) ; } public void focusLost ( FocusEvent e ) { fSelectAllAction . setEnabled ( false ) ; } } ) ; return control ; } private void initDragAndDrop ( ) { for ( int i = 0 ; i < fAllViewers . length ; i ++ ) { addDragAdapters ( fAllViewers [ i ] ) ; addDropAdapters ( fAllViewers [ i ] ) ; } addDragAdapters ( fMethodsViewer ) ; fMethodsViewer . addDropSupport ( DND . DROP_NONE , new Transfer [ 0 ] , new DropTargetAdapter ( ) ) ; DropTarget dropTarget = new DropTarget ( fPagebook , DND . DROP_MOVE | DND . DROP_COPY | DND . DROP_LINK | DND . DROP_DEFAULT ) ; dropTarget . setTransfer ( new Transfer [ ] { LocalSelectionTransfer . getInstance ( ) } ) ; } private void addDropAdapters ( AbstractTreeViewer viewer ) { } private void addDragAdapters ( StructuredViewer viewer ) { int ops = DND . DROP_COPY | DND . DROP_LINK ; Transfer [ ] transfers = new Transfer [ ] { LocalSelectionTransfer . getInstance ( ) , ResourceTransfer . getInstance ( ) } ; TransferDragSourceListener [ ] dragListeners = new TransferDragSourceListener [ ] { new SelectionTransferDragAdapter ( viewer ) , new ResourceTransferDragAdapter ( viewer ) } ; viewer . addDragSupport ( ops , transfers , new RdtViewerDragAdapter ( viewer , dragListeners ) ) ; } public void createPartControl ( Composite container ) { fParent = container ; addResizeListener ( container ) ; fPagebook = new PageBook ( container , SWT . NONE ) ; fWorkingSetActionGroup = new WorkingSetFilterActionGroup ( getSite ( ) , fPropertyChangeListener ) ; fNoHierarchyShownLabel = new Label ( fPagebook , SWT . TOP + SWT . LEFT + SWT . WRAP ) ; fNoHierarchyShownLabel . setText ( TypeHierarchyMessages . TypeHierarchyViewPart_empty ) ; fTypeMethodsSplitter = new SashForm ( fPagebook , SWT . VERTICAL ) ; fTypeMethodsSplitter . setVisible ( false ) ; fTypeViewerViewForm = new ViewForm ( fTypeMethodsSplitter , SWT . NONE ) ; Control typeViewerControl = createTypeViewerControl ( fTypeViewerViewForm ) ; fTypeViewerViewForm . setContent ( typeViewerControl ) ; fMethodViewerViewForm = new ViewForm ( fTypeMethodsSplitter , SWT . NONE ) ; fTypeMethodsSplitter . setWeights ( new int [ ] { 35 , 65 } ) ; Control methodViewerPart = createMethodViewerControl ( fMethodViewerViewForm ) ; fMethodViewerViewForm . setContent ( methodViewerPart ) ; fMethodViewerPaneLabel = new CLabel ( fMethodViewerViewForm , SWT . NONE ) ; fMethodViewerViewForm . setTopLeft ( fMethodViewerPaneLabel ) ; ToolBar methodViewerToolBar = new ToolBar ( fMethodViewerViewForm , SWT . FLAT | SWT . WRAP ) ; fMethodViewerViewForm . setTopCenter ( methodViewerToolBar ) ; initDragAndDrop ( ) ; MenuManager menu = new MenuManager ( ) ; menu . add ( fFocusOnTypeAction ) ; fNoHierarchyShownLabel . setMenu ( menu . createContextMenu ( fNoHierarchyShownLabel ) ) ; fPagebook . showPage ( fNoHierarchyShownLabel ) ; try { fOrientation = fDialogSettings . getInt ( DIALOGSTORE_VIEWORIENTATION ) ; if ( fOrientation < 0 || fOrientation > 3 ) { fOrientation = VIEW_ORIENTATION_VERTICAL ; } } catch ( NumberFormatException e ) { fOrientation = VIEW_ORIENTATION_AUTOMATIC ; } fCurrentOrientation = - 1 ; setOrientation ( fOrientation ) ; if ( fMemento != null ) { restoreLinkingEnabled ( fMemento ) ; } fToggleLinkingAction = new ToggleLinkingAction ( this ) ; IActionBars actionBars = getViewSite ( ) . getActionBars ( ) ; IMenuManager viewMenu = actionBars . getMenuManager ( ) ; for ( int i = 0 ; i < fViewActions . length ; i ++ ) { ToggleViewAction action = fViewActions [ i ] ; viewMenu . add ( action ) ; action . setEnabled ( false ) ; } viewMenu . add ( new Separator ( ) ) ; fWorkingSetActionGroup . fillViewMenu ( viewMenu ) ; viewMenu . add ( new Separator ( ) ) ; IMenuManager layoutSubMenu = new MenuManager ( TypeHierarchyMessages . TypeHierarchyViewPart_layout_submenu ) ; viewMenu . add ( layoutSubMenu ) ; for ( int i = 0 ; i < fToggleOrientationActions . length ; i ++ ) { layoutSubMenu . add ( fToggleOrientationActions [ i ] ) ; } viewMenu . add ( new Separator ( IWorkbenchActionConstants . MB_ADDITIONS ) ) ; viewMenu . add ( fShowQualifiedTypeNamesAction ) ; viewMenu . add ( fToggleLinkingAction ) ; ToolBarManager lowertbmanager = new ToolBarManager ( methodViewerToolBar ) ; lowertbmanager . add ( fEnableMemberFilterAction ) ; lowertbmanager . add ( new Separator ( ) ) ; fMethodsViewer . contributeToToolBar ( lowertbmanager ) ; lowertbmanager . update ( true ) ; int nHierarchyViewers = fAllViewers . length ; StructuredViewer [ ] trackedViewers = new StructuredViewer [ nHierarchyViewers + 1 ] ; for ( int i = 0 ; i < nHierarchyViewers ; i ++ ) { trackedViewers [ i ] = fAllViewers [ | |
2,311 | <s> package org . oddjob . state ; import org . oddjob . FailedToStopException ; import org . oddjob . framework . SimultaneousStructural ; abstract public class StateReflector extends SimultaneousStructural { private static final long serialVersionUID = 20010082000L ; public void stop ( ) throws FailedToStopException { if | |
2,312 | <s> package com . asakusafw . vocabulary . batch ; public class MiddleUnderConstructionBatch extends BatchDescription { @ Override protected void describe ( ) { run ( JobFlow1 . class ) . soon ( ) ; run ( | |
2,313 | <s> package org . oddjob . logging ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . Helper ; import org . oddjob . framework . ComponentBoundry ; import org . oddjob . logging . log4j . Log4jArchiver ; public class OddjobNDCTest extends TestCase implements LogEnabled { private static final Logger logger = Logger . getLogger ( OddjobNDCTest . class ) ; public void testAll ( ) { String loggerName1 = "" ; String loggerName2 = "" ; Object job1 = new Object ( ) ; Object job2 = new Object ( ) ; ComponentBoundry . push ( loggerName1 , job1 ) ; assertEquals ( loggerName1 , OddjobNDC . peek ( ) . getLogger ( ) ) ; assertEquals ( job1 , OddjobNDC . peek ( ) . getJob ( ) ) ; ComponentBoundry . push ( loggerName2 , job2 ) ; assertEquals ( loggerName2 , OddjobNDC . peek ( ) . getLogger ( ) ) ; assertEquals ( job2 , OddjobNDC . peek ( ) . getJob ( ) ) ; assertEquals ( loggerName2 , OddjobNDC . pop ( ) . getLogger ( ) ) ; assertEquals ( loggerName1 , OddjobNDC . pop ( ) . getLogger ( ) ) ; } public void testEmptyPeek ( ) { assertEquals | |
2,314 | <s> package org . rubypeople . rdt . refactoring . signatureprovider ; import java . util . ArrayList ; import java . util . Collection ; import org . rubypeople . rdt . refactoring . nodewrapper . ArgsNodeWrapper ; import org . rubypeople . rdt . refactoring . util . Constants ; public class MethodSignature { private String methodName ; private Collection < String > args ; public MethodSignature ( String methodName , Collection < String > args ) { this . methodName = methodName ; this . args = args ; } public MethodSignature ( String methodName , int argCount ) { this ( methodName , getAnnonymousArgs ( argCount ) ) ; } public MethodSignature ( String methodName , ArgsNodeWrapper args ) { this ( methodName , args . getArgsList ( ) ) ; } private static Collection < String > getAnnonymousArgs ( int argCount ) { Collection < String > args = new ArrayList < String > ( ) ; for ( int i = 0 ; i < argCount ; i ++ ) { args . | |
2,315 | <s> package org . rubypeople . rdt . refactoring . action ; | |
2,316 | <s> package org . rubypeople . rdt . internal . ui . text ; import java . io . IOException ; import java . io . Reader ; public abstract class SingleCharReader extends Reader { public abstract int read ( ) throws IOException ; public int read ( char cbuf [ ] , int | |
2,317 | <s> package com . asakusafw . compiler . yaess . testing . flow ; import com . asakusafw . compiler . yaess . testing . mock . MockExporterDescription ; import com . asakusafw . compiler . yaess . testing . mock . MockImporterDescription ; import com . asakusafw . compiler . yaess . testing . model . Dummy ; import com . asakusafw . vocabulary . flow . Export ; import com . asakusafw . vocabulary . | |
2,318 | <s> package org . rubypeople . rdt . ui . text . ruby ; import java . util . Comparator ; import org . eclipse . jface . text . contentassist . ICompletionProposal ; import org . eclipse . jface . text . templates . TemplateProposal ; import org . rubypeople . rdt . internal . ui . text . ruby . AbstractRubyCompletionProposal ; public final class CompletionProposalComparator implements Comparator { private boolean fOrderAlphabetically ; public CompletionProposalComparator ( ) { fOrderAlphabetically = false ; } public void setOrderAlphabetically ( boolean orderAlphabetically ) { fOrderAlphabetically = orderAlphabetically ; } public int compare ( Object o1 , Object o2 ) { ICompletionProposal p1 = ( ICompletionProposal ) o1 ; ICompletionProposal p2 = ( ICompletionProposal ) o2 ; if ( ! fOrderAlphabetically ) { int r1 = getRelevance ( p1 ) ; int r2 = getRelevance ( p2 ) ; int relevanceDif = r2 - r1 ; if | |
2,319 | <s> package net . sf . sveditor . core . db ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; public class SVDBModIfcInst extends SVDBFieldItem implements ISVDBChildParent { public SVDBTypeInfo fTypeInfo ; public List < SVDBModIfcInstItem > fInstList ; public SVDBModIfcInst ( ) { super ( "" , SVDBItemType . ModIfcInst ) ; fInstList = new ArrayList < SVDBModIfcInstItem > ( ) ; } public SVDBModIfcInst ( SVDBTypeInfo type ) { super ( "" , SVDBItemType . ModIfcInst ) ; fTypeInfo = type ; fInstList = new ArrayList < SVDBModIfcInstItem > ( ) ; } public List < SVDBModIfcInstItem > getInstList ( ) { return fInstList ; } @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public Iterable < ISVDBChildItem > getChildren ( ) { return new Iterable < ISVDBChildItem > ( ) { public | |
2,320 | <s> package com . asakusafw . compiler . flow . testing . io ; import java . io . IOException ; import com . asakusafw . compiler . flow . testing . model . ExSummarized ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . RecordParser ; public final class ExSummarizedInput implements ModelInput < ExSummarized > { private final RecordParser parser ; public ExSummarizedInput ( RecordParser parser ) { if ( parser == null ) { throw | |
2,321 | <s> package com . asakusafw . utils . collections ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . Iterator ; import java . util . List ; public final class Lists { public static < E > List < E > create ( ) { return new ArrayList < E > ( ) ; } public static < E > List < E > of ( E elem ) { ArrayList < E > result = new ArrayList < E > ( ) ; result . add ( elem ) ; return result ; } public static < E > List < E > of ( E elem1 , E elem2 ) { ArrayList < E > result = new ArrayList < E > ( ) ; result . add ( elem1 ) ; result . add ( elem2 ) ; return result ; } public static < E > List < E > of ( E elem1 , E elem2 , E elem3 ) { ArrayList < E > result = new ArrayList < E > ( ) ; result . add ( elem1 ) ; result . add ( elem2 ) ; result . add ( elem3 ) ; return result ; } public static < E > List < E > of ( E elem1 , E elem2 , E elem3 , E elem4 , E ... rest ) { if ( rest == null ) { throw new IllegalArgumentException ( "" ) ; } ArrayList < | |
2,322 | <s> package org . rubypeople . rdt . refactoring . core . renamefield ; import org . rubypeople . rdt . refactoring . core . IRefactoringContext ; import org . rubypeople . rdt . refactoring . core . IValidator ; import org . rubypeople . rdt . refactoring . core . RubyRefactoring ; import org . rubypeople . rdt . refactoring . documentprovider . DocumentWithIncluding ; import org . rubypeople . rdt . refactoring . ui . NewNameListener ; import org . rubypeople . rdt . refactoring . ui . pages . OccurenceReplaceSelectionPage ; import org . rubypeople . rdt . refactoring . ui . pages . RenameFieldPage ; import org . rubypeople . rdt . refactoring . util . NameValidator ; public class RenameFieldRefactoring extends RubyRefactoring { private static final class LocalVarNameValidator implements IValidator { public boolean isValid ( String test ) { return NameValidator . isValidLocalVariableName ( test | |
2,323 | <s> package com . asakusafw . testtools ; import java . io . File ; import java . util . ArrayList ; import java . util . List ; import junit . framework . Assert ; import org . junit . Test ; import test . inspector . SuccessInspector ; import com . asakusafw . testtools . inspect . Cause ; public class TestUtilsTest { @ Test public void testNormal ( ) throws Exception { String TEST_FILE = "" ; File testFile = new File ( TEST_FILE ) ; | |
2,324 | <s> package org . rubypeople . rdt . internal . corext . util ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . rubypeople . rdt . core . Flags ; import org . rubypeople . rdt . core . IMember ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . ISourceFolder ; import org . rubypeople . rdt . core . ISourceFolderRoot ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . ITypeHierarchy ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . core . util . CharOperation ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; public final class RubyModelUtil { public static final String DEFAULT_SCRIPT_SUFFIX = ".rb" ; private static boolean PRIMARY_ONLY = false ; public static IRubyScript toOriginal ( IRubyScript cu ) { if ( PRIMARY_ONLY ) { testRubyScriptOwner ( "toOriginal" , cu ) ; } if ( cu == null ) return cu ; return cu . getPrimary ( ) ; } private static void testRubyScriptOwner ( String methodName , IRubyScript cu ) { if ( cu == null ) { return ; } if ( ! isPrimary ( cu ) ) { RubyPlugin . logErrorMessage ( methodName + "" ) ; } } public static boolean isPrimary ( IRubyScript cu ) { return cu . getOwner ( ) == null ; } public static void reconcile ( IRubyScript unit ) throws RubyModelException { unit . reconcile ( false , null , null ) ; } public static IRubyElement toOriginal ( IRubyElement element ) { return element . getPrimaryElement ( ) ; } public static ISourceFolderRoot getSourceFolderRoot ( IRubyElement element ) { return ( ISourceFolderRoot ) element . getAncestor ( IRubyElement . SOURCE_FOLDER_ROOT ) ; } public static ISourceFolder getSourceFolder ( IRubyElement element ) { ISourceFolder srcFolder = ( ISourceFolder ) element . getAncestor ( IRubyElement . SOURCE_FOLDER ) ; if ( srcFolder == null ) { IRubyProject proj = element . getRubyProject ( ) ; ISourceFolderRoot root = proj . getSourceFolderRoot ( proj . getResource ( ) ) ; return root . getSourceFolder ( "" ) ; } return srcFolder ; } public static boolean isExcludedPath ( IPath resourcePath , IPath [ ] exclusionPatterns ) { char [ ] path = resourcePath . toString ( ) . toCharArray ( ) ; for ( int i = 0 , length = exclusionPatterns . length ; i < length ; i ++ ) { char [ ] pattern = exclusionPatterns [ i ] . toString ( ) . toCharArray ( ) ; if ( CharOperation . pathMatch ( pattern , path , true , '/' ) ) { return true ; } } return false ; } public static String concatenateName | |
2,325 | <s> package org . oddjob . jmx . client ; import org . apache . log4j . Logger ; import org . oddjob . arooa . ClassResolver ; public class SimpleHandlerResolver < T > implements ClientHandlerResolver < T > { private static final long serialVersionUID = 2009090500L ; private static final Logger logger = Logger . getLogger ( SimpleHandlerResolver . class ) ; private final String className ; private final HandlerVersion remoteVersion ; public SimpleHandlerResolver ( String className , HandlerVersion version ) { if ( className == null ) { throw new NullPointerException ( "Class Name." ) ; } if ( version == null ) { throw new NullPointerException ( "Version." ) ; } this . className = className ; this . remoteVersion = version ; } public String getClassName ( ) { return className ; } public HandlerVersion getRemoteVersion ( ) { return remoteVersion ; } @ SuppressWarnings ( "unchecked" ) public ClientInterfaceHandlerFactory < T > resolve ( ClassResolver classResolver ) { Class < ClientInterfaceHandlerFactory < T > > cl = ( Class < ClientInterfaceHandlerFactory < T > > ) classResolver . findClass ( className ) ; if ( cl == null ) { logger . info ( "" + className ) ; return null ; } ClientInterfaceHandlerFactory < T > factory = null ; try { factory = | |
2,326 | <s> package net . sf . sveditor . core . db . stmt ; import java . util . ArrayList ; import java . util . List ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . | |
2,327 | <s> package net . sf . sveditor . ui . argfile . editor ; import java . util . ResourceBundle ; import net . sf . sveditor . core . log . ILogLevel ; import net . sf . sveditor . ui . SVUiPlugin ; import net . sf . sveditor . ui . argfile . editor . actions . OpenDeclarationAction ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . ui . editors . text . TextEditor ; public class SVArgFileEditor extends TextEditor implements ILogLevel { private SVArgFileCodeScanner fCodeScanner ; public SVArgFileEditor ( ) { fCodeScanner = new SVArgFileCodeScanner ( ) ; } public SVArgFileCodeScanner getCodeScanner ( ) { return fCodeScanner ; } @ Override protected void createActions ( ) { super . createActions ( ) ; ResourceBundle bundle = SVUiPlugin . getDefault ( ) . getResources ( ) ; OpenDeclarationAction od_action = new OpenDeclarationAction ( bundle , this ) ; | |
2,328 | <s> package com . asakusafw . compiler . flow . plan ; import java . util . List ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . utils . collections . Lists ; public class StageGraph { private FlowBlock input ; private FlowBlock output ; private List < StageBlock > stages ; public StageGraph ( FlowBlock input , FlowBlock output , List < StageBlock > stages ) { Precondition . checkMustNotBeNull ( input , "input" ) ; Precondition . checkMustNotBeNull ( output , "output" ) ; Precondition . checkMustNotBeNull ( stages , "stages" ) ; this . input = input ; this . output = output ; this . stages = | |
2,329 | <s> package com . asakusafw . vocabulary . model ; import java . lang . annotation . Documented ; import java . lang . annotation . ElementType ; import java . lang . annotation . Retention ; import java . lang . annotation . RetentionPolicy ; import java . lang . annotation . Target ; @ Target ( ElementType . TYPE ) @ Retention ( RetentionPolicy . RUNTIME ) @ Documented public @ interface Joined { Term [ ] terms ( ) ; @ Target ( { } ) public @ interface Term { Class < ? > source ( ) ; Mapping [ ] mappings ( | |
2,330 | <s> package net . sf . sveditor . core . db . persistence ; import java . util . ArrayList ; import java . util . List ; import java . util . Set ; import net . sf . sveditor . core . db . SVDBItemType ; @ SuppressWarnings ( "rawtypes" ) public abstract class JITPersistenceDelegateBase extends SVDBPersistenceRWDelegateBase { protected List < Class > fObjectTypeList ; public JITPersistenceDelegateBase ( | |
2,331 | <s> package net . sf . sveditor . core . db ; import net . sf . sveditor . core . db . expr . SVDBExpr ; import net . sf . sveditor . core . db . expr . SVDBIdentifierExpr ; public class SVDBCoverCrossBinsSel extends SVDBItem { public SVDBExpr fSelectExpr ; public SVDBCoverCrossBinsSel ( ) { super ( "" , SVDBItemType . CoverCrossBinsSel ) ; } public SVDBCoverCrossBinsSel ( SVDBIdentifierExpr id ) | |
2,332 | <s> package org . oddjob . designer . elements . schedule ; import org . oddjob . arooa . design . DesignFactory ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignProperty ; import org . oddjob . arooa . design . DesignValueBase ; import org . oddjob . arooa . design . SimpleTextAttribute ; import org . oddjob . arooa . design . screem . BorderedGroup ; import org . oddjob . arooa . design . screem . Form ; import org . oddjob . arooa . design . screem . StandardForm ; import org . oddjob . arooa . parsing . ArooaContext ; import org . oddjob . arooa . parsing . ArooaElement ; public class IntervalScheduleDE implements DesignFactory { public DesignInstance createDesign ( ArooaElement element , ArooaContext parentContext ) { return new IntervalScheduleDesign ( element , parentContext ) ; } } class IntervalScheduleDesign extends DesignValueBase { private final SimpleTextAttribute interval ; public IntervalScheduleDesign ( ArooaElement element , ArooaContext parentContext ) { super | |
2,333 | <s> package net . sf . sveditor . core . db . index ; import java . util . Map ; import net . sf . sveditor . core . db . index . cache . ISVDBIndexCache ; import net . sf . sveditor . core . log . LogFactory ; import org . eclipse . core . runtime . IProgressMonitor ; public class SVDBLibIndex extends AbstractSVDBIndex { public SVDBLibIndex ( String project , String root , ISVDBFileSystemProvider fs_provider , ISVDBIndexCache cache , SVDBIndexConfig config ) { super ( project , root , fs_provider , cache , config | |
2,334 | <s> package org . rubypeople . rdt . refactoring . tests . util ; import junit . framework . TestCase ; import org . jruby . ast . ArgsNode ; import org . jruby . ast . BlockNode ; import org . jruby . ast . ClassNode ; import org . jruby . ast . DefnNode ; import org . jruby . ast . DefsNode ; import org . jruby . ast . InstVarNode ; import org . jruby . ast . IterNode ; import org . jruby . ast . Node ; import org . jruby . ast . RootNode ; import org . jruby . parser . BlockStaticScope ; import org . jruby . parser . LocalStaticScope ; import org . jruby . parser . StaticScope ; import org . jruby . runtime . DynamicScope ; import org . rubypeople . rdt . refactoring . util . NodeUtil ; public class TC_NodeUtil extends TestCase { public void testHasScope_RootNode ( ) { assertTrue ( NodeUtil . hasScope ( new RootNode ( null , DynamicScope . newDynamicScope ( new BlockStaticScope ( null ) , null ) , null ) ) ) ; } public void testHasScope_DefnNode ( ) { assertTrue ( NodeUtil . hasScope ( new DefnNode ( null , null , createArgsNode ( ) , | |
2,335 | <s> package com . asakusafw . compiler . batch . experimental ; import java . io . Closeable ; import java . io . File ; import java . io . IOException ; import java . io . OutputStream ; import java . io . OutputStreamWriter ; import java . io . PrintWriter ; import java . nio . charset . Charset ; import java . text . MessageFormat ; import java . util . Collection ; import java . util . List ; import java . util . Map ; import java . util . SortedMap ; import java . util . TreeMap ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . compiler . batch . AbstractWorkflowProcessor ; import com . asakusafw . compiler . batch . WorkDescriptionProcessor ; import com . asakusafw . compiler . batch . Workflow ; import com . asakusafw . compiler . batch . processor . JobFlowWorkDescriptionProcessor ; import com . asakusafw . compiler . batch . processor . ScriptWorkDescriptionProcessor ; import com . asakusafw . compiler . common . Precondition ; import com . asakusafw . utils . collections . Lists ; public class DumpEnvironmentProcessor extends AbstractWorkflowProcessor { static final Logger LOG = LoggerFactory . getLogger ( DumpEnvironmentProcessor . class ) ; static final Charset ENCODING = Charset . forName ( "UTF-8" ) ; public static final String PATH = "" ; public static final String PREFIX_ENV = "ASAKUSA_" ; public static final String PREFIX_SYSPROP = "" ; public static File getScriptOutput ( File outputDir ) { Precondition . checkMustNotBeNull | |
2,336 | <s> package com . asakusafw . compiler . flow . stage ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . util . List ; import org . junit . Test ; import com . asakusafw . compiler . flow . JobflowCompilerTestRoot ; import com . asakusafw . compiler . flow . example . NoShuffleStage ; import com . asakusafw . compiler . flow . plan . StageBlock ; import com . asakusafw . compiler . flow . plan . StageGraph ; import com . asakusafw . compiler . flow . stage . StageModel . Fragment ; import com . asakusafw . compiler . flow . stage . StageModel . MapUnit ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . runtime . core . Result ; import com . asakusafw . runtime . testing . MockResult ; import com . asakusafw . vocabulary . flow . FlowDescription ; public class MapFragmentEmitterTest extends JobflowCompilerTestRoot { @ Test | |
2,337 | <s> package com . asakusafw . runtime . io . util ; import static org . hamcrest . Matchers . * ; import static org . junit . Assert . * ; import java . io . IOException ; import java . util . Arrays ; import org . apache . hadoop . io . DataInputBuffer ; import org . apache . hadoop . io . DataOutputBuffer ; import org . apache . hadoop . io . Writable ; import org . apache . hadoop . io . WritableComparator ; public class WritableTestRoot { static byte [ ] ser ( Writable writable ) throws IOException { DataOutputBuffer out = new DataOutputBuffer ( ) ; writable . write ( out ) ; byte [ ] results = Arrays . copyOfRange ( out . getData ( ) , 0 , out . getLength ( ) ) ; return results ; } static byte [ ] ser ( WritableRawComparable writable ) throws IOException { DataOutputBuffer out = new DataOutputBuffer ( ) ; writable . write ( out ) ; assertThat ( writable . getSizeInBytes ( out . getData ( ) , 0 ) , is ( out . getLength ( ) ) ) ; byte [ ] results = Arrays . copyOfRange ( out . getData ( ) , 0 , out . getLength ( ) ) ; return results ; } static < T extends Writable > T des ( T writable , byte [ ] serialized ) throws IOException { DataInputBuffer buf = new DataInputBuffer ( ) ; buf . reset ( serialized , serialized . length ) ; writable . readFields ( buf ) ; return writable ; } static int cmp ( WritableRawComparable a , WritableRawComparable b ) throws IOException { int cmp = a . compareTo ( b ) ; assertThat ( a . equals ( b ) , is ( cmp == 0 ) ) ; if ( cmp == 0 ) { assertThat ( a . hashCode ( ) , is ( b . hashCode ( ) ) ) ; } byte [ ] serA = ser ( a ) ; byte [ ] serB = ser ( b ) ; int | |
2,338 | <s> package $ { package } . jobflow ; import java . util . Arrays ; import java . util . List ; import $ { package } . modelgen . dmdl . csv . AbstractCategorySummaryCsvOutputDescription ; public class CategorySummaryToCsv extends AbstractCategorySummaryCsvOutputDescription { @ Override public String getBasePath | |
2,339 | <s> package com . asakusafw . cleaner . log ; import java . math . BigDecimal ; import java . text . MessageFormat ; import java . util . Date ; import java . util . HashMap ; import java . util . Map ; import org . apache . commons . lang . ArrayUtils ; import org . apache . commons . lang . ObjectUtils ; import org . apache . commons . lang . StringUtils ; import org . apache . log4j . Level ; public class LogMessageManager { private static final String MESSAGE_ID_NOT_FOUND = "" ; private static final String ILLEGAL_SIZE = "" ; private Map < String , Level > levelMap = new HashMap < String , Level > ( ) ; private Map < String , String > templateMap = new HashMap < String , String > ( ) ; private Map < String , Integer > sizeMap = new HashMap < String , Integer > ( ) ; private static LogMessageManager instance = new LogMessageManager ( ) ; protected LogMessageManager ( ) { return ; } public static LogMessageManager getInstance ( ) { return LogMessageManager . instance ; } public void putLevel ( String messageId , String level ) { levelMap . put ( messageId , Level . toLevel ( level ) ) ; } public void putTemplate ( String messageId , String templates ) { templateMap . put ( messageId , templates ) ; } public void putSize ( String messageId , Integer index ) { sizeMap . put ( messageId , index ) ; } public String createLogMessage ( String messageId , Object ... messageArgs ) { Object [ ] messageArgsConverted = toStringMessageArgs ( messageArgs ) ; String templateStr = templateMap . | |
2,340 | <s> package com . asakusafw . vocabulary . operator ; import java . lang . annotation . Documented ; import java . lang . annotation . Retention ; import java . lang . annotation . RetentionPolicy ; import java . lang . annotation . Target ; import com . asakusafw . vocabulary . flow . Source ; import com . | |
2,341 | <s> package org . oddjob . oddballs ; import java . io . File ; import java . net . URL ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . Oddjob ; import org . oddjob . OddjobDescriptorFactory ; import org . oddjob . OurDirs ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . deploy . LinkedDescriptor ; import org . oddjob . arooa . standard . StandardArooaDescriptor ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . state . ParentState ; public class OddballsDescriptorFactoryTest extends TestCase { private static final Logger logger = Logger . getLogger ( OddballsDescriptorFactoryTest . class ) ; public void testOddballs ( ) throws ArooaParseException { new BuildOddballs ( ) . run ( ) ; OurDirs dirs = new OurDirs ( ) ; OddballsDirDescriptorFactory test = new OddballsDirDescriptorFactory ( ) ; test . setOddballFactory ( new DirectoryOddball ( ) ) ; test . setBaseDir ( new File ( dirs . base ( ) , "" ) ) ; Oddjob oddjob = new Oddjob ( ) ; oddjob . setDescriptorFactory ( test ) ; oddjob . setFile ( new File ( dirs . base ( ) , "" ) ) ; oddjob . run ( ) ; assertEquals ( ParentState . COMPLETE , oddjob . lastStateEvent ( ) . getState ( ) ) ; oddjob . destroy ( ) ; } public void testOddballsExample ( ) throws ArooaParseException { new BuildOddballs ( ) . run ( ) ; OurDirs dirs = new OurDirs ( ) ; Oddjob oddjob = new Oddjob ( ) ; oddjob . setConfiguration ( new XMLConfiguration ( "" , getClass ( ) . getClassLoader ( ) ) ) ; oddjob . setArgs ( new String [ ] { dirs . base ( ) . getAbsolutePath ( ) } ) ; oddjob . run ( ) ; assertEquals ( ParentState . COMPLETE , oddjob . lastStateEvent ( ) . getState ( ) ) ; oddjob . destroy ( ) ; } public void testClassResolverResources ( ) { new BuildOddballs ( ) . run ( ) ; OurDirs dirs = new OurDirs ( ) ; OddballsDirDescriptorFactory test = new OddballsDirDescriptorFactory ( ) ; test . setOddballFactory ( new DirectoryOddball ( ) ) ; test . setBaseDir ( new File ( dirs . base ( ) , "" ) ) ; | |
2,342 | <s> package org . rubypeople . rdt . internal . ui . infoviews ; import java . io . BufferedReader ; import java . io . IOException ; import java . io . InputStreamReader ; import java . net . URL ; import org . eclipse . core . runtime . FileLocator ; import org . eclipse . core . runtime . ListenerList ; import org . eclipse . core . runtime . Platform ; import org . eclipse . jface . action . Action ; import org . eclipse . jface . action . IAction ; import org . eclipse . jface . dialogs . MessageDialogWithToggle ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . BadPartitioningException ; import org . eclipse . jface . text . DefaultInformationControl ; import org . eclipse . jface . text . Document ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IDocumentExtension3 ; import org . eclipse . jface . text . ITextSelection ; import org . eclipse . jface . text . ITypedRegion ; import org . eclipse . jface . text . TextPresentation ; import org . eclipse . jface . text . TextSelection ; import org . eclipse . jface . text . TextUtilities ; import org . eclipse . jface . util . Assert ; import org . eclipse . jface . viewers . ISelection ; import org . eclipse . jface . viewers . ISelectionChangedListener ; import org . eclipse . jface . viewers . ISelectionProvider ; import org . eclipse . jface . viewers . SelectionChangedEvent ; import org . eclipse . jface . viewers . StructuredSelection ; import org . eclipse . jface . window . Window ; import org . eclipse . swt . SWT ; import org . eclipse . swt . SWTError ; import org . eclipse . swt . browser . Browser ; import org . eclipse . swt . custom . StyledText ; import org . eclipse . swt . events . ControlAdapter ; import org . eclipse . swt . events . ControlEvent ; import org . eclipse . swt . events . SelectionAdapter ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . graphics . Color ; import org . eclipse . swt . graphics . RGB ; import org . eclipse . swt . graphics . Rectangle ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Control ; import org . eclipse . ui . IWorkbenchPart ; import org . eclipse . ui . PlatformUI ; import org . eclipse . ui . texteditor . IAbstractTextEditorHelpContextIds ; import org . eclipse . ui . texteditor . IDocumentProvider ; import org . eclipse . ui . texteditor . ITextEditor ; import org . osgi . framework . Bundle ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . util . RDocUtil ; import org . rubypeople . rdt . internal . ui . IRubyHelpContextIds ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . rubyeditor . RubyEditor ; import org . rubypeople . rdt . internal . ui . text . HTMLPrinter ; import org . rubypeople . rdt . internal . ui . text . HTMLTextPresenter ; import org . rubypeople . rdt . internal . ui . text . IRubyPartitions ; public class RDocView extends AbstractInfoView { private static final String DO_NOT_WARN_PREFERENCE_KEY = "" ; private static final boolean WARNING_DIALOG_ENABLED = false ; private Browser fBrowser ; private StyledText fText ; private DefaultInformationControl . IInformationPresenter fPresenter ; private TextPresentation fPresentation = new TextPresentation ( ) ; private SelectAllAction fSelectAllAction ; private static String fgStyleSheet ; private boolean fIsUsingBrowserWidget ; private RGB fBackgroundColorRGB ; private class SelectAllAction extends Action { private Control fControl ; private SelectionProvider fSelectionProvider ; public SelectAllAction ( Control control , SelectionProvider selectionProvider ) { super ( "selectAll" ) ; Assert . isNotNull ( control ) ; Assert . isNotNull ( selectionProvider ) ; fControl = control ; fSelectionProvider = selectionProvider ; setEnabled ( ! fIsUsingBrowserWidget ) ; setText ( InfoViewMessages . SelectAllAction_label ) ; setToolTipText ( InfoViewMessages . SelectAllAction_tooltip ) ; setDescription ( InfoViewMessages . SelectAllAction_description ) ; PlatformUI . getWorkbench ( ) . getHelpSystem ( ) . setHelp ( this , IAbstractTextEditorHelpContextIds . SELECT_ALL_ACTION ) ; } public void run ( ) { if ( fControl instanceof StyledText ) ( ( StyledText ) fControl ) . selectAll ( ) ; else { if ( fSelectionProvider != null ) fSelectionProvider . fireSelectionChanged ( ) ; } } } private static class SelectionProvider implements ISelectionProvider { private ListenerList fListeners = new ListenerList ( ListenerList . IDENTITY ) ; private Control fControl ; public SelectionProvider ( Control control ) { Assert . isNotNull ( control ) ; fControl = control ; if ( fControl instanceof StyledText ) { ( ( StyledText ) fControl ) . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { fireSelectionChanged ( ) ; } } ) ; } else { } } public void fireSelectionChanged ( ) { ISelection selection = getSelection ( ) ; SelectionChangedEvent event = new SelectionChangedEvent ( this , selection ) ; Object [ ] selectionChangedListeners = fListeners . getListeners ( ) ; for ( int i = 0 ; i < selectionChangedListeners . length ; i ++ ) ( ( ISelectionChangedListener ) selectionChangedListeners [ i ] ) . selectionChanged ( event ) ; } | |
2,343 | <s> package de . fuberlin . wiwiss . d2rq . parser ; import java . util . Collections ; import java . util . HashSet ; import junit . framework . TestCase ; import com . hp . hpl . jena . rdf . model . Model ; import com . hp . hpl . jena . rdf . model . ModelFactory ; import com . hp . hpl . jena . rdf . model . Resource ; import com . hp . hpl . jena . rdf . model . ResourceFactory ; import de . fuberlin . wiwiss . d2rq . D2RQException ; import de . fuberlin . wiwiss . d2rq . algebra . AliasMap ; import de . fuberlin . wiwiss . d2rq . algebra . ProjectionSpec ; import de . fuberlin . wiwiss . d2rq . algebra . TripleRelation ; import de . fuberlin . wiwiss . d2rq . helpers . MappingHelper ; import de . fuberlin . wiwiss . d2rq . map . DownloadMap ; import de . fuberlin . wiwiss . d2rq . map . Mapping ; import de . fuberlin . wiwiss . d2rq . map . TranslationTable ; import de . fuberlin . wiwiss . d2rq . sql . ResultRow ; import de . fuberlin . wiwiss . d2rq . sql . SQL ; import de . fuberlin . wiwiss . d2rq . values . Translator ; import de . fuberlin . wiwiss . d2rq . vocab . D2RQ ; public class ParserTest extends TestCase { private final static String TABLE_URI = "" ; private Model model ; protected void setUp ( ) throws Exception { this . model = ModelFactory . createDefaultModel ( ) ; } public void testEmptyTranslationTable ( ) { Resource r = addTranslationTableResource ( ) ; Mapping mapping = new MapParser ( this . model , null ) . parse ( ) ; TranslationTable table = mapping . translationTable ( r ) ; assertNotNull ( table ) ; assertEquals ( 0 , table . size ( ) ) ; } public void testGetSameTranslationTable ( ) { Resource r = addTranslationTableResource ( ) ; addTranslationResource ( r , "foo" , "bar" ) ; Mapping mapping = | |
2,344 | <s> package de . fuberlin . wiwiss . d2rq . sql . vendor ; import java . sql . Types ; import de . fuberlin . wiwiss . d2rq . map . Database ; import de . fuberlin . wiwiss . d2rq . sql . SQL ; import de . fuberlin . wiwiss . d2rq . sql . types . DataType ; import de . fuberlin . wiwiss . d2rq . sql . types . SQLBinary ; import de . fuberlin . wiwiss . d2rq . sql . types . SQLBit ; import de . fuberlin . wiwiss . d2rq . sql . types . SQLCharacterString ; import de . fuberlin . wiwiss . d2rq . sql . types . SQLDate ; public class SQLServer extends SQL92 { public SQLServer ( ) { super ( true ) ; } @ Override public String getRowNumLimitAsSelectModifier ( int limit ) { if ( limit == Database . NO_LIMIT ) return "" ; return "TOP " + limit ; } @ Override public String getRowNumLimitAsQueryAppendage ( int limit ) { return "" ; } @ Override public String quoteBinaryLiteral ( String hexString ) { if ( ! SQL . isHexString ( hexString ) ) { throw new IllegalArgumentException ( "" + hexString + "'" ) ; } return "0x" + hexString ; } @ Override public String quoteDateLiteral ( String date ) { return quoteStringLiteral ( date ) ; } @ Override public String quoteTimeLiteral ( String time ) { return quoteStringLiteral ( time ) ; } @ Override public String quoteTimestampLiteral ( String timestamp ) { return quoteStringLiteral ( timestamp ) ; } @ Override public DataType getDataType ( int jdbcType , String name , int size ) { if ( name . equals | |
2,345 | <s> package com . asakusafw . compiler . flow . processor . flow ; import com . asakusafw . compiler . flow . processor . ConvertFlowProcessor ; import com . asakusafw . compiler . flow . processor . operator . ConvertFlowFactory ; import com . asakusafw . compiler . flow . processor . operator . ConvertFlowFactory . WithParameter ; import com . asakusafw . compiler . flow . testing . external . Ex1MockExporterDescription ; import com . asakusafw . compiler . flow . testing . external . Ex1MockImporterDescription ; import com . asakusafw . compiler . flow . testing . external . Ex2MockExporterDescription ; import com . asakusafw . compiler . flow . testing . model . Ex1 ; import com . asakusafw . compiler . flow . testing . model . Ex2 ; import com . asakusafw . vocabulary . flow . Export ; import com . asakusafw . vocabulary . flow . FlowDescription ; import com . asakusafw . vocabulary . flow . Import ; import com . asakusafw . vocabulary . flow . In ; import com . asakusafw . vocabulary . flow . JobFlow ; import com . asakusafw . vocabulary . flow . Out ; @ JobFlow ( name = "testing" ) public class ConvertFlowWithParameter extends FlowDescription { private In < Ex1 > in1 ; | |
2,346 | <s> package de . fuberlin . wiwiss . d2rq . vocab ; import com . hp . hpl . jena . rdf . model . * ; public class D2RConfig { 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 autoReloadMapping = m_model . createProperty ( "" ) ; public static final Property baseURI = m_model . createProperty ( "" ) ; public static final Property datasetMetadataTemplate = m_model . createProperty ( "" | |
2,347 | <s> package net . bioclipse . opentox . ui . wizards ; import java . net . URL ; import java . util . List ; import net . bioclipse . opentox . OpenToxService ; import org . eclipse . core . resources . IFile ; import org . eclipse . jface . viewers . IStructuredSelection ; import org . eclipse . jface . wizard . WizardPage ; import org . eclipse . swt . SWT ; import org . eclipse . swt . events . ModifyEvent ; import org . eclipse . swt . events . ModifyListener ; import org . eclipse . swt . events . SelectionEvent ; import org . eclipse . swt . events . SelectionListener ; import org . eclipse . swt . layout . GridData ; import org . eclipse . swt . layout . GridLayout ; import org . eclipse . swt . widgets . Combo ; import org . eclipse . swt . widgets . Composite ; import org . eclipse . swt . widgets . Label ; import org . eclipse . swt . widgets . Text ; import org . eclipse . ui . IWorkbench ; public class CreateDatasetPage extends WizardPage { private Combo cboLicense ; private IFile file ; private Text txtTitle ; private Text customLicense ; protected CreateDatasetPage ( ) { super ( "" ) ; setTitle ( "" ) ; setDescription ( "" ) ; } public CreateDatasetPage ( IFile file ) { this ( ) ; this . file = file ; } public void init ( IWorkbench workbench , IStructuredSelection selection ) { } public void createControl ( Composite parent ) { Composite container = new Composite ( parent , SWT . NULL ) ; GridLayout layout = new GridLayout ( ) ; container . setLayout ( layout ) ; layout . numColumns = 2 ; layout . verticalSpacing = 9 ; Label fromLabel = new Label ( container , SWT . NULL ) ; fromLabel . setText ( "File:" ) ; fromLabel . setLayoutData ( new GridData ( GridData . BEGINNING ) ) ; Label lblDSinfo = new Label ( container , SWT . NULL ) ; lblDSinfo . setText ( file . getName ( ) ) ; lblDSinfo . setLayoutData ( new GridData ( GridData . BEGINNING ) ) ; Label lblServer = new Label ( container , SWT . NULL ) ; lblServer . setText ( "Server:" ) ; lblServer . setLayoutData ( new GridData ( GridData . BEGINNING ) ) ; Combo cboServer = new Combo ( container , SWT . NONE ) ; GridData gds = new GridData ( ) ; cboServer . setLayoutData ( gds ) ; List < OpenToxService > OTservices = net . bioclipse . opentox . Activator . getOpenToxServices ( ) ; for ( OpenToxService service : OTservices ) { cboServer . add ( service . getName ( ) ) ; } cboServer . addSelectionListener ( new SelectionListener ( ) { public void widgetDefaultSelected ( SelectionEvent e ) { } public void widgetSelected ( SelectionEvent e ) { Combo cbo = ( Combo ) e . getSource ( ) ; int ix = cbo . getSelectionIndex ( ) ; String service = net . bioclipse . opentox . Activator . getOpenToxServices ( ) . get ( ix ) . getService ( ) ; ( ( CreateDatasetWizard ) getWizard ( ) ) . setService ( service ) ; } } ) ; cboServer . select ( 0 ) ; String service = net . bioclipse . opentox . Activator . getOpenToxServices ( ) . get ( 0 ) . getService ( ) ; ( ( CreateDatasetWizard ) getWizard ( ) ) . | |
2,348 | <s> package com . mcbans . firestar . mcbans . pluginInterface ; import com . mcbans . firestar . mcbans . BukkitInterface ; import com . mcbans . firestar . mcbans . Settings ; import org . bukkit . ChatColor ; import org . bukkit . entity . Player ; @ SuppressWarnings ( "unused" ) public class Kick implements Runnable { private Settings Config ; private BukkitInterface MCBans ; private String PlayerName = null ; private String PlayerAdmin = null ; private String Reason = null ; public Kick ( Settings cf , BukkitInterface p , String playerName , String playerAdmin , String reason ) { Config = cf ; MCBans = p ; PlayerName = playerName ; PlayerAdmin = playerAdmin ; Reason = reason ; } @ Override public void run ( ) { while ( MCBans . notSelectedServer ) { try { Thread . sleep ( 3000 ) ; } catch ( InterruptedException e ) { } } final Player player = MCBans . getServer ( ) . getPlayer ( PlayerName ) ; if ( player != null ) { MCBans . log ( PlayerAdmin + " has kicked " + player . getName ( ) + " [" + Reason + "]" ) ; MCBans . getServer ( ) | |
2,349 | <s> package org . rubypeople . rdt . core . codeassist ; import java . util . Arrays ; import java . util . Collections ; import java . util . Comparator ; import java . util . List ; import org . eclipse . core . resources . IFile ; import org . jruby . ast . Node ; import org . jruby . ast . RootNode ; import org . jruby . lexer . yacc . SyntaxException ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyProject ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . core . ExternalRubyScript ; import org . rubypeople . rdt . internal . core . RubyScript ; import org . rubypeople . rdt . internal . core . parser . RubyParser ; import org . rubypeople . rdt . internal . ti . util . OffsetNodeLocator ; public class ResolveContext { private IRubyScript script ; private int start ; private int end ; private RootNode root ; private Node selected ; private IRubyElement [ ] resolved = new IRubyElement [ 0 ] ; public ResolveContext ( IRubyScript script , int start , int end ) { this . script = script ; this . start = start ; this . end = end ; } | |
2,350 | <s> package net . sf . sveditor . core . batch . python ; import java . util . Properties ; import org . eclipse . core . runtime . Status ; import org . eclipse . equinox . app . IApplication ; import org . eclipse . equinox . app . IApplicationContext ; import org . python . core . PyDictionary ; import org . python . core . PyString ; import org . python . core . PySystemState ; import org . python . util . PythonInterpreter ; public class SVEditorPythonApplication implements IApplication { static boolean fInitialized ; public Object start ( IApplicationContext context ) throws Exception { String args [ ] = ( String [ ] ) context . getArguments ( ) . get ( IApplicationContext . APPLICATION_ARGS ) ; if ( args . length < 1 ) { throw new Exception ( "" ) ; } if ( ! fInitialized ) { Properties p = new Properties ( ) ; PythonInterpreter . initialize ( System . getProperties ( ) , p , new String | |
2,351 | <s> package org . rubypeople . rdt . internal . core . search ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . core . runtime . Path ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . rubypeople . rdt . core . search . IRubySearchScope ; import org . rubypeople . rdt . core . search . SearchDocument ; import org . rubypeople . rdt . core . search . SearchParticipant ; import org . rubypeople . rdt . core . search . SearchPattern ; import org . rubypeople . rdt . core . search . SearchRequestor ; import org . rubypeople . rdt . internal . core . search . indexing . SourceIndexer ; import org . rubypeople . rdt . internal . core . search . matching . MatchLocator ; import org . rubypeople . rdt . internal . core . util . Util ; public class RubySearchParticipant extends SearchParticipant { private IndexSelector indexSelector ; @ Override public SearchDocument getDocument ( String documentPath ) { if ( Util . isERBLikeFileName ( new Path ( documentPath ) . lastSegment ( ) ) ) { return new ERBSearchDocument ( documentPath , this ) ; } return new RubySearchDocument ( documentPath , this ) ; } @ Override public void indexDocument ( SearchDocument document , IPath indexLocation ) { document . removeAllIndexEntries ( ) ; String documentPath = document . getPath ( ) ; if ( org . rubypeople . rdt . internal . core . util . Util . isRubyOrERBLikeFileName ( documentPath ) ) { new SourceIndexer ( document ) . indexDocument ( ) ; } } public IPath [ ] selectIndexes ( SearchPattern pattern , IRubySearchScope scope ) { if ( this . indexSelector == null | |
2,352 | <s> package org . rubypeople . rdt . internal . ui . preferences ; import org . eclipse . jface . preference . IPreferenceStore ; import org . eclipse . jface . preference . PreferenceStore ; import org . eclipse . jface . text . Assert ; import org . eclipse . jface . util . IPropertyChangeListener ; import org . eclipse . jface . util . PropertyChangeEvent ; public class OverlayPreferenceStore implements IPreferenceStore { public static final class TypeDescriptor { private TypeDescriptor ( ) { } } public static final TypeDescriptor BOOLEAN = new TypeDescriptor ( ) ; public static final TypeDescriptor DOUBLE = new TypeDescriptor ( ) ; public static final TypeDescriptor FLOAT = new TypeDescriptor ( ) ; public static final TypeDescriptor INT = new TypeDescriptor ( ) ; public static final TypeDescriptor LONG = new TypeDescriptor ( ) ; public static final TypeDescriptor STRING = new TypeDescriptor ( ) ; public static class OverlayKey { TypeDescriptor fDescriptor ; String fKey ; public OverlayKey ( TypeDescriptor descriptor , String key ) { fDescriptor = descriptor ; fKey = key ; } } private class PropertyListener implements IPropertyChangeListener { public void propertyChange ( PropertyChangeEvent event ) { OverlayKey key = findOverlayKey ( event . getProperty ( ) ) ; if ( key != null ) propagateProperty ( fParent , key , fStore ) ; } } private IPreferenceStore fParent ; private IPreferenceStore fStore ; private OverlayKey [ ] fOverlayKeys ; private PropertyListener fPropertyListener ; private boolean fLoaded ; public OverlayPreferenceStore ( IPreferenceStore parent , OverlayKey [ ] overlayKeys ) { fParent = parent ; fOverlayKeys = overlayKeys ; fStore = new PreferenceStore ( ) ; } private OverlayKey findOverlayKey ( String key ) { for ( int i = 0 ; i < fOverlayKeys . length ; i ++ ) { if ( fOverlayKeys [ i ] . fKey . equals ( key ) ) return fOverlayKeys [ i ] ; } return null ; } private boolean covers ( String key ) { return ( findOverlayKey ( key ) != null ) ; } private void propagateProperty ( IPreferenceStore orgin , OverlayKey key , IPreferenceStore target ) { if ( orgin . isDefault ( key . fKey ) ) { if ( ! target . isDefault ( key . fKey ) ) target . setToDefault ( key . fKey ) ; return ; } TypeDescriptor d = key . fDescriptor ; if ( BOOLEAN == d ) { boolean originValue = orgin . getBoolean ( key . fKey ) ; boolean targetValue = target . getBoolean ( key . fKey ) ; if ( targetValue != originValue ) target . setValue ( key . fKey , originValue ) ; } else if ( DOUBLE == d ) { double originValue = orgin . getDouble ( key . fKey ) ; double targetValue = target . getDouble ( key . fKey ) ; if ( targetValue != originValue ) target . setValue ( key . fKey , originValue ) ; } else if ( FLOAT == d ) { float originValue = orgin . getFloat ( key . fKey ) ; float targetValue = target . getFloat ( key . fKey ) ; if ( targetValue != originValue ) target . setValue ( key . fKey , originValue ) ; } else if ( INT == d ) { int originValue = orgin . getInt ( key . fKey ) ; int targetValue = target . getInt ( key . fKey ) ; if ( targetValue != originValue ) target . setValue ( key . fKey , originValue ) ; } else if ( LONG == d ) { long originValue = orgin . getLong ( key . fKey ) ; long targetValue = target . getLong ( key . fKey ) ; if ( targetValue != originValue ) target . setValue ( key . fKey , originValue ) ; } else if ( STRING == d ) { String originValue = orgin . getString ( key . fKey ) ; String targetValue = target . getString ( key . fKey ) ; if ( targetValue != null && originValue != null && ! targetValue . equals ( originValue ) ) target . setValue ( key . fKey , originValue ) ; } } public void propagate ( ) { for ( int i = 0 ; i < fOverlayKeys . length ; i ++ ) propagateProperty ( fStore , fOverlayKeys [ i ] , fParent ) ; } private void loadProperty ( IPreferenceStore orgin , OverlayKey key , IPreferenceStore target , boolean forceInitialization ) { TypeDescriptor d = key . fDescriptor ; if ( BOOLEAN == d ) { if ( forceInitialization ) target . setValue ( key . fKey , true ) ; target . setValue ( key . fKey , orgin . getBoolean ( key . fKey ) ) ; target . setDefault ( key . fKey , orgin . getDefaultBoolean ( key . fKey ) ) ; } else if ( DOUBLE == d ) { if ( forceInitialization ) target . setValue ( key . fKey , 1.0D ) ; target . setValue ( key . fKey , orgin . getDouble ( key . fKey ) ) ; target . setDefault ( key . fKey , orgin . getDefaultDouble ( key . fKey ) ) ; } else if ( FLOAT == d ) { if ( forceInitialization ) target . setValue ( key . fKey , 1.0F ) ; target . setValue ( key . fKey , orgin . getFloat ( key . fKey ) ) ; target . setDefault ( key . fKey , orgin . getDefaultFloat ( key . fKey ) ) ; } else if ( INT == d ) { if ( forceInitialization ) target . setValue ( key . fKey , 1 ) ; target . setValue ( key . fKey , orgin . getInt ( key . fKey ) ) ; target . setDefault ( key . fKey , orgin . getDefaultInt ( key . fKey ) ) ; } else if ( LONG == d ) { if ( forceInitialization ) target . setValue ( key . fKey , 1L ) ; target . setValue ( key . fKey , orgin . getLong ( key . fKey ) ) ; target . setDefault ( key . fKey , orgin . getDefaultLong ( key . fKey ) ) ; } else if ( STRING == d ) { if ( forceInitialization ) target . setValue ( key . fKey , "1" ) ; target . setValue ( key . fKey , orgin . getString ( key . fKey ) ) ; target . setDefault ( key . fKey , orgin . getDefaultString ( key . fKey ) ) ; } } public void load ( ) { for ( int i = | |
2,353 | <s> package net . sf . sveditor . core . db . expr ; import net . sf . sveditor . core . db . stmt . SVDBConstraintDistListItem ; import net . sf . sveditor . core . db . stmt . SVDBConstraintDistListStmt ; import net . sf . sveditor . core . db . stmt . SVDBConstraintSolveBeforeStmt ; public class SVExprIterator { public void visit ( SVDBExpr expr ) { switch ( expr . getType ( ) ) { case ArrayAccessExpr : array_access ( ( SVDBArrayAccessExpr ) expr ) ; break ; case AssignExpr : assign ( ( SVDBAssignExpr ) expr ) ; break ; case CastExpr : cast ( ( SVDBCastExpr ) expr ) ; break ; case BinaryExpr : binary_expr ( ( SVDBBinaryExpr ) expr ) ; break ; case CondExpr : cond ( ( SVDBCondExpr ) expr ) ; break ; case FieldAccessExpr : field_access ( ( SVDBFieldAccessExpr ) expr ) ; break ; case IdentifierExpr : identifier ( ( SVDBIdentifierExpr ) expr ) ; break ; case IncDecExpr : inc_dec ( ( SVDBIncDecExpr ) expr ) ; break ; case InsideExpr : inside ( ( SVDBInsideExpr ) expr ) ; break ; case LiteralExpr : literal ( ( SVDBLiteralExpr ) expr ) ; break ; case ParenExpr : paren ( ( SVDBParenExpr ) expr ) ; break ; case TFCallExpr : tf_call ( ( SVDBTFCallExpr ) expr ) ; break ; case UnaryExpr : unary ( ( SVDBUnaryExpr ) expr ) ; break ; case RangeExpr : range ( ( SVDBRangeExpr ) expr ) ; break ; default : System . out . println ( "" + expr . getType ( ) ) ; break ; } } protected void array_access ( SVDBArrayAccessExpr expr ) { visit ( expr . getLhs ( ) ) ; } protected void assign ( SVDBAssignExpr expr ) { visit | |
2,354 | <s> package org . oddjob . schedules . schedules ; import java . text . ParseException ; import java . util . Date ; 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 . ScheduleRoller ; import org . oddjob . schedules . units . DayOfWeek ; public class DailyScheduleTest extends TestCase { private static final Logger logger = Logger . getLogger ( "org.oddjob" ) ; protected void setUp ( ) { logger . debug ( "" + getName ( ) + "" ) ; } public void testStandardIntervalDifferentStarts ( ) throws ParseException { DailySchedule test = new DailySchedule ( ) ; test . setFrom ( "10:00" ) ; test . setTo ( "11:00" ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; Interval result = test . nextDue ( context ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; 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 = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; } public void testStandardIntervalRollingNext ( ) throws ParseException { DailySchedule test = new DailySchedule ( ) ; test . setFrom ( "10:00" ) ; test . setTo ( "11:00" ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; Interval result = test . nextDue ( context ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; context = context . move ( result . getToDate ( ) ) ; result = test . nextDue ( context ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; context = context . move ( result . getToDate ( ) ) ; result = test . nextDue ( context ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; } public void testForwardInterval ( ) throws ParseException { DailySchedule s = new DailySchedule ( ) ; s . setFrom ( "11:00" ) ; s . setTo ( "10:00" ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; Interval result = s . nextDue ( new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ) ; assertEquals ( expected , result ) ; result = s . nextDue ( new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; result = s . nextDue ( new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ) ; assertEquals ( expected , result ) ; } public void testSimple ( ) throws ParseException { DailySchedule s = new DailySchedule ( ) ; s . setFrom ( "10:00" ) ; s . setTo ( "11:00" ) ; Date on ; ScheduleContext context ; on = DateHelper . parseDateTime ( "" ) ; context = new ScheduleContext ( on ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; Interval result = s . nextDue ( context ) ; assertEquals ( expected , result ) ; on = DateHelper . parseDateTime ( "" ) ; context = new ScheduleContext ( on ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; result = s . nextDue ( context ) ; assertEquals ( expected , result ) ; on = DateHelper . parseDateTime ( "" ) ; context = new ScheduleContext ( on ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; result = s . nextDue ( context ) ; assertEquals ( expected , result ) ; } public void testOverMidnight ( ) throws ParseException { DailySchedule s = new DailySchedule ( ) ; s . setFrom ( "23:00" ) ; s . setTo ( "01:00" ) ; Date on ; ScheduleContext context ; on = DateHelper . parseDateTime ( "" ) ; context = new ScheduleContext ( on ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; Interval result = s . nextDue ( context ) ; assertEquals ( expected , result ) ; on = DateHelper . parseDateTime ( "" ) ; context = new ScheduleContext ( on ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; result = s . nextDue ( context ) ; assertEquals ( expected , result ) ; on = DateHelper . parseDateTime ( "" ) ; context = new ScheduleContext ( on ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; result = s . nextDue ( context ) ; assertEquals ( expected , result ) ; } public void testOn ( ) throws ParseException { DailySchedule s = new DailySchedule ( ) ; s . setAt ( "12:00" ) ; Date on ; ScheduleContext context ; on = DateHelper . parseDateTime ( "" ) ; context = new ScheduleContext ( on ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) ) ; Interval result = s . nextDue ( context ) ; assertEquals ( expected , result ) ; on = DateHelper . parseDateTime ( "" ) ; context = new ScheduleContext ( on ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) ) ; result = s . nextDue ( context ) ; assertEquals ( expected , result ) ; on = DateHelper . parseDateTime ( "" ) ; context = new ScheduleContext ( on ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) ) ; result = s . nextDue ( context ) ; assertEquals ( expected , result ) ; } public void testWithLimits ( ) throws ParseException { DailySchedule test = new DailySchedule ( ) ; test . setAt ( "12:00" ) ; Date on ; ScheduleContext context ; on = DateHelper . parseDateTime ( "" ) ; context = new ScheduleContext ( on ) ; context . spawn ( new IntervalTo ( DateHelper . parseDate ( "2020-06-21" ) , DateHelper . parseDate ( "2020-06-22" ) ) ) ; Interval result = test . nextDue ( context ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; } public void testDefaultTo ( ) throws Exception { DailySchedule test = new DailySchedule ( ) ; test . setFrom ( "10:00" ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; Interval result = test . nextDue ( context ) ; logger . debug ( "result " + result ) ; IntervalTo expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; assertEquals ( expected , result ) ; context = context . move ( result . getToDate ( ) ) ; result = test . nextDue ( context ) ; expected = new IntervalTo ( DateHelper . parseDateTime ( "" ) , DateHelper . parseDateTime ( "" ) ) ; } public void testDefaultFrom ( ) throws Exception { DailySchedule s = new DailySchedule ( ) ; s . setTo ( "10:00" ) ; ScheduleContext context = new ScheduleContext ( DateHelper . parseDateTime ( "" ) ) ; Interval result = s . nextDue ( context ) ; logger . debug ( "result " + result ) ; assertEquals ( new IntervalTo ( DateHelper . parseDateTime ( "" ) , | |
2,355 | <s> package org . rubypeople . rdt . internal . ui . text . correction ; import org . eclipse . compare . rangedifferencer . IRangeComparator ; import org . eclipse . compare . rangedifferencer . RangeDifference ; import org . eclipse . compare . rangedifferencer . RangeDifferencer ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . jface . dialogs . ErrorDialog ; import org . eclipse . jface . text . BadLocationException ; import org . eclipse . jface . text . Document ; import org . eclipse . jface . text . IDocument ; import org . eclipse . jface . text . IRegion ; import org . eclipse . ltk . core . refactoring . Change ; import org . eclipse . ltk . core . refactoring . DocumentChange ; import org . eclipse . ltk . core . refactoring . TextChange ; import org . eclipse . ltk . core . refactoring . TextFileChange ; import org . eclipse . ltk . internal . core . refactoring . Resources ; import org . eclipse . swt . graphics . Image ; import org . eclipse . text . edits . MultiTextEdit ; import org . eclipse . text . edits . TextEdit ; import org . eclipse . ui . IEditorPart ; import org . eclipse . ui . IWorkbenchPage ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . internal . corext . codemanipulation . StubUtility ; import org . rubypeople . rdt . internal . corext . refactoring . changes . RubyScriptChange ; import org . rubypeople . rdt . internal . corext . util . Strings ; import org . rubypeople . rdt . internal . ui . RubyPlugin ; import org . rubypeople . rdt . internal . ui . RubyUIStatus ; import org . rubypeople . rdt . internal . ui . rubyeditor . EditorUtility ; import org . rubypeople . rdt . internal . ui . util . ExceptionHandler ; import org . rubypeople . rdt . ui . RubyUI ; import org . rubypeople . rdt . ui . text . correction . ChangeCorrectionProposal ; public class CUCorrectionProposal extends ChangeCorrectionProposal { private IRubyScript fRubyScript ; public CUCorrectionProposal ( String name , IRubyScript cu , TextChange change , int relevance , Image image ) { super ( name , change , relevance , image ) ; if ( cu == null ) { throw new IllegalArgumentException ( "" ) ; } fRubyScript = cu ; } protected CUCorrectionProposal ( String name , IRubyScript cu , int relevance , Image image ) { this ( name , cu , null , relevance , image ) ; } protected void addEdits ( IDocument document , TextEdit editRoot ) throws CoreException { if ( false ) { | |
2,356 | <s> package org . rubypeople . rdt . internal . formatter . rewriter ; import org . jruby . ast . NewlineNode ; import org . rubypeople . rdt . core | |
2,357 | <s> package org . oddjob . state ; public class IsHardResetable implements StateCondition { @ Override public boolean test ( State state ) { return state . isReady ( ) || state . isComplete ( ) || state | |
2,358 | <s> package org . rubypeople . rdt ; import junit . framework . Test ; import junit . framework . TestSuite ; import org . rubypeople . rdt . core . formatter . TC_EditableFormatHelper ; import org . rubypeople . rdt . core . formatter . TestReWriteVisitor ; import org . rubypeople . rdt . core . formatter . rewriter . TestBooleanStateStack ; import org . rubypeople . rdt . core . tests . model . BufferTests ; import org . rubypeople . rdt . core . util . TS_CoreUtil ; import org . rubypeople . rdt . internal . TS_Internal ; public class TS_RdtCore { public static Test suite | |
2,359 | <s> package org . oddjob . jmx . server ; import org . oddjob | |
2,360 | <s> package org . vaadin . teemu . clara . inflater ; import java . util . Arrays ; import java . util . List ; public class PrimitiveAttributeParser implements AttributeParser { @ SuppressWarnings ( "unchecked" ) private static final List < Class < ? > > supportedClasses = Arrays . asList ( String . class , Object . class , Boolean . class , Integer . class , Byte . class , Short . class , Long . class , Character . class , Float . class , Double . class ) ; public boolean isSupported ( Class < ? > valueType ) { return valueType != null && ( valueType . isPrimitive ( ) || supportedClasses . contains ( valueType ) ) ; } public Object getValueAs ( String value , Class < ? > type ) { if ( type == String . class || type == Object . class ) { return value ; } if ( type == Boolean . TYPE || type == Boolean . class ) { return Boolean . valueOf ( value ) ; } if ( type == Integer . TYPE || type == Integer . class ) { return Integer . valueOf ( value ) ; } if ( type == Byte . TYPE || type == Byte . class ) { return Byte . valueOf ( value ) ; } if ( type == Short . TYPE || type == Short . class ) { return Short . | |
2,361 | <s> package com . asakusafw . windgate . bootstrap ; import java . io . File ; import java . net . URI ; import java . text . MessageFormat ; import java . util . Arrays ; import java . util . List ; import java . util . Properties ; 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 . apache . commons . cli . ParseException ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import com . asakusafw . runtime . core . context . RuntimeContext ; import com . asakusafw . windgate . core . AbortTask ; import com . asakusafw . windgate . core . GateProfile ; import com . asakusafw . windgate . core . ProfileContext ; import com . asakusafw . windgate . core . WindGateLogger ; public final class WindGateAbort { static final WindGateLogger WGLOG = new WindGateBootstrapLogger ( WindGateAbort . class ) ; static final Logger LOG = LoggerFactory . getLogger ( WindGateAbort . class ) ; static final Option OPT_PROFILE ; static final Option OPT_SESSION_ID ; static final Option OPT_PLUGIN ; private static final Options OPTIONS ; static { OPT_PROFILE = new Option ( "profile" , true , "profile path" ) ; OPT_PROFILE . setArgName ( "" | |
2,362 | <s> package org . rubypeople . rdt . internal . core . search ; import java . util . ArrayList ; import java . util . Collection ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . core . runtime . SubProgressMonitor ; import org . rubypeople . rdt . core . Flags ; import org . rubypeople . rdt . core . IRubyElement ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . core . WorkingCopyOwner ; import org . rubypeople . rdt . core . search . IRubySearchConstants ; import org . rubypeople . rdt . core . search . IRubySearchScope ; import org . rubypeople . rdt . core . search . SearchDocument ; import org . rubypeople . rdt . core . search . SearchEngine ; import org . rubypeople . rdt . core . search . SearchMatch ; import org . rubypeople . rdt . core . search . SearchParticipant ; import org . rubypeople . rdt . core . search . SearchPattern ; import org . rubypeople . rdt . core . search . SearchRequestor ; import org . rubypeople . rdt . core . search . TypeNameRequestor ; import org . rubypeople . rdt . internal . core . DefaultWorkingCopyOwner ; import org . rubypeople . rdt . internal . core . RubyModelManager ; import org . rubypeople . rdt . internal . core . RubyProject ; import org . rubypeople . rdt . internal . core . RubyScript ; import org . rubypeople . rdt . internal . core . search . indexing . IIndexConstants ; import org . rubypeople . rdt . internal . core . search . indexing . IndexManager ; import org . rubypeople . rdt . internal . core . search . matching . MatchLocator ; import org . rubypeople . rdt . internal . core . search . matching . RubySearchPattern ; import org . rubypeople . rdt . internal . core . search . matching . TypeDeclarationPattern ; import org . rubypeople . rdt . internal . core . util . CharOperation ; import org . rubypeople . rdt . internal . core . util . Messages ; import org . rubypeople . rdt . internal . core . util . Util ; public class BasicSearchEngine { public static final int CLASS_DECL = 1 ; public static final int MODULE_DECL = 2 ; public static final boolean VERBOSE = false ; private IRubyScript [ ] workingCopies ; private WorkingCopyOwner workingCopyOwner ; public BasicSearchEngine ( ) { } public BasicSearchEngine ( WorkingCopyOwner workingCopyOwner ) { this . workingCopyOwner = workingCopyOwner ; } public void search ( SearchPattern pattern , SearchParticipant [ ] participants , IRubySearchScope scope , SearchRequestor requestor , IProgressMonitor monitor ) throws CoreException { if ( VERBOSE ) { Util . verbose ( "" ) ; } findMatches ( pattern , participants , scope , requestor , monitor ) ; } public static IRubySearchScope createRubySearchScope ( IRubyElement [ ] elements ) { return createRubySearchScope ( elements , true ) ; } public static IRubySearchScope createRubySearchScope ( IRubyElement [ ] elements , boolean includeReferencedProjects ) { int includeMask = IRubySearchScope . SOURCES | IRubySearchScope . APPLICATION_LIBRARIES | IRubySearchScope . SYSTEM_LIBRARIES ; if ( includeReferencedProjects ) { includeMask |= IRubySearchScope . REFERENCED_PROJECTS ; } return createRubySearchScope ( elements , includeMask ) ; } public static IRubySearchScope createRubySearchScope ( IRubyElement [ ] elements , int includeMask ) { RubySearchScope scope = new RubySearchScope ( ) ; HashSet visitedProjects = new HashSet ( 2 ) ; for ( int i = 0 , length = elements . length ; i < length ; i ++ ) { IRubyElement element = elements [ i ] ; if ( element != null ) { try { if ( element instanceof RubyProject ) { scope . add ( ( RubyProject ) element , includeMask , visitedProjects ) ; } else { scope . add ( element ) ; } } catch ( RubyModelException e ) { } } } return scope ; } void findMatches ( SearchPattern pattern , SearchParticipant [ ] participants , IRubySearchScope scope , SearchRequestor requestor , IProgressMonitor monitor ) throws CoreException { if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; try { if ( monitor != null ) monitor . beginTask ( Messages . engine_searching , 100 ) ; if ( VERBOSE ) { Util . verbose ( "" + pattern . toString ( ) ) ; Util . verbose ( scope . toString ( ) ) ; } if ( participants == null ) { if ( VERBOSE ) Util . verbose ( "" ) ; return ; } IndexManager indexManager = RubyModelManager . getRubyModelManager ( ) . getIndexManager ( ) ; requestor . beginReporting ( ) ; for ( int i = 0 , l = participants . length ; i < l ; i ++ ) { if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; SearchParticipant participant = participants [ i ] ; SubProgressMonitor subMonitor = monitor == null ? null : new SubProgressMonitor ( monitor , 1000 ) ; if ( subMonitor != null ) subMonitor . beginTask ( "" , 1000 ) ; try { if ( subMonitor != null ) subMonitor . subTask ( Messages . bind ( Messages . engine_searching_indexing , new String [ ] { participant . getDescription ( ) } ) ) ; participant . beginSearching ( ) ; requestor . enterParticipant ( participant ) ; PathCollector pathCollector = new PathCollector ( ) ; indexManager . performConcurrentJob ( new PatternSearchJob ( pattern , participant , scope , pathCollector ) , IRubySearchConstants . WAIT_UNTIL_READY_TO_SEARCH , subMonitor ) ; if ( monitor != null && monitor . isCanceled ( ) ) throw new OperationCanceledException ( ) ; if ( subMonitor != null ) subMonitor . subTask ( Messages . bind ( Messages . engine_searching_matching , new String [ ] { participant . getDescription ( ) } ) ) ; String [ ] indexMatchPaths = pathCollector . getPaths ( ) ; if ( indexMatchPaths != null ) { pathCollector = null ; int indexMatchLength = indexMatchPaths . length ; SearchDocument [ ] indexMatches = new SearchDocument [ indexMatchLength ] ; for ( int j = 0 ; j < indexMatchLength ; j ++ ) { indexMatches [ j ] = participant . getDocument ( indexMatchPaths [ j ] ) ; } SearchDocument [ ] matches = MatchLocator . addWorkingCopies ( pattern , indexMatches , getWorkingCopies ( ) , participant ) ; participant . locateMatches ( matches , pattern , scope , requestor , subMonitor ) ; } } finally { requestor . exitParticipant ( participant ) ; participant . doneSearching ( ) ; } } } finally { requestor . endReporting ( ) ; if ( monitor != null ) monitor . done ( ) ; } } private IRubyScript [ ] getWorkingCopies ( ) { IRubyScript [ ] copies ; if ( this . workingCopies != null ) { if ( this . workingCopyOwner == null ) { copies = RubyModelManager . getRubyModelManager ( ) . getWorkingCopies ( DefaultWorkingCopyOwner . PRIMARY , false ) ; if ( copies == null ) { copies = this . workingCopies ; } else { HashMap pathToCUs = new HashMap ( ) ; for ( int i = 0 , length = copies . length ; i < length ; i ++ ) { IRubyScript unit = copies [ i ] ; pathToCUs . put ( unit . getPath ( ) , unit ) ; } for ( int i = 0 , length = this . workingCopies . length ; i < length ; i ++ ) { IRubyScript unit = this . workingCopies [ i ] ; pathToCUs | |
2,363 | <s> package net . sf . sveditor . core . db . index ; import java . io . File ; public class SVDBPersistenceDescriptor { private File fDBFile ; private String fBaseLocation ; public SVDBPersistenceDescriptor ( File file , | |
2,364 | <s> package org . rubypeople . rdt . refactoring . core . mergeclasspartsinfile ; import org . eclipse . core . runtime . CoreException ; import org . rubypeople . rdt . refactoring | |
2,365 | <s> package org . rubypeople . rdt . internal . ui . search ; import org . eclipse . jface . viewers . LabelProvider ; import org . eclipse . search . ui . text | |
2,366 | <s> package org . oddjob . framework ; import java . util . Map ; import junit . framework . TestCase ; import org . apache . commons . beanutils . PropertyUtils ; import org . oddjob . Describeable ; import org . oddjob . Helper ; import org . oddjob . Oddjob ; import org . oddjob . OddjobLookup ; import org . oddjob . Resetable ; import org . oddjob . Stoppable ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . arooa . ArooaTools ; import org . oddjob . arooa . MockArooaSession ; import org . oddjob . arooa . life . ArooaContextAware ; import org . oddjob . arooa . life . ArooaSessionAware ; import org . oddjob . arooa . parsing . MockArooaContext ; import org . oddjob . arooa . registry . ComponentPool ; import org . oddjob . arooa . registry . MockComponentPool ; import org . oddjob . arooa . runtime . MockRuntimeConfiguration ; import org . oddjob . arooa . runtime . RuntimeConfiguration ; import org . oddjob . arooa . runtime . RuntimeListener ; import org . oddjob . arooa . standard . StandardArooaDescriptor ; import org . oddjob . arooa . standard . StandardTools ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . state . ParentState ; import org . oddjob . state . ServiceState ; public class ServiceWrapperTest extends TestCase { private class OurContext extends MockArooaContext { OurSession session ; @ Override public ArooaSession getSession ( ) { return session ; } @ Override public RuntimeConfiguration getRuntime ( ) { return new MockRuntimeConfiguration ( ) { @ Override public void addRuntimeListener ( RuntimeListener listener ) { } } ; } } private class OurSession extends MockArooaSession { Object configured ; Object saved ; ArooaDescriptor descriptor = new StandardArooaDescriptor ( ) ; @ Override public ArooaDescriptor getArooaDescriptor ( ) { return descriptor ; } @ Override public ComponentPool getComponentPool ( ) { return new MockComponentPool ( ) { @ Override public void configure ( Object component ) { configured = component ; } @ Override public void save ( Object component ) { saved = component ; } } ; } @ Override public ArooaTools getTools ( ) { return new StandardTools ( ) ; } } public static class MyService { boolean started ; boolean stopped ; public void start ( ) { started = true ; } public void stop ( ) { stopped = true ; } public boolean isStarted ( ) { return started ; } public boolean isStopped ( ) { return stopped ; } } public void testStartStop ( ) throws Exception { MyService myService = new MyService ( ) ; OurSession session = new OurSession ( ) ; ServiceAdaptor service = new ServiceStrategies ( ) . serviceFor ( myService , session ) ; OurContext context = new OurContext ( ) ; context . session = session ; Runnable wrapper = ( Runnable ) new ServiceProxyGenerator ( ) . generate ( service , getClass ( ) . getClassLoader ( ) ) ; ( ( ArooaSessionAware ) wrapper ) . setArooaSession ( session ) ; ( ( ArooaContextAware ) wrapper ) . setArooaContext ( context ) ; wrapper . run ( ) ; assertEquals ( wrapper , session . configured ) ; assertEquals ( ServiceState . STARTED , Helper . getJobState ( wrapper ) ) ; assertEquals ( new Boolean ( true ) , PropertyUtils . getProperty ( wrapper , "started" ) ) ; ( ( Stoppable ) wrapper ) . stop ( ) ; assertEquals ( ServiceState . COMPLETE , Helper . getJobState ( wrapper ) ) ; assertEquals ( new Boolean ( true ) , PropertyUtils . getProperty ( wrapper , "stopped" ) ) ; ( ( Resetable ) wrapper ) . hardReset ( ) ; assertNull ( session . saved ) ; assertEquals ( ServiceState . READY , Helper . getJobState ( wrapper ) ) ; } public void testInOddjob ( ) throws Exception { String xml = "<oddjob>" + " <job>" + "" + MyService . class . getName ( ) + "' id='s' />" + " </job>" + "</oddjob>" ; Oddjob oj = new Oddjob ( ) ; oj . setConfiguration ( new XMLConfiguration ( "XML" , xml ) ) ; oj . run ( ) ; Object test = new OddjobLookup ( oj ) . lookup ( "s" ) ; assertEquals ( ServiceState . STARTED , Helper . getJobState ( test ) ) ; assertEquals ( new Boolean ( true ) , PropertyUtils . getProperty ( test , "started" ) ) ; oj . stop ( ) ; assertEquals ( ServiceState . COMPLETE , Helper . getJobState ( test ) ) ; assertEquals ( new Boolean ( true ) , PropertyUtils . getProperty ( test , "stopped" ) ) ; Map < String , String > description = ( ( Describeable ) test ) . describe ( ) ; assertEquals ( "true" , description . get ( "started" ) ) ; assertEquals ( "true" , description . get ( "stopped" ) ) ; oj . | |
2,367 | <s> package de . fuberlin . wiwiss . d2rq . expr ; import java . util . ArrayList ; import java . util . Collection ; import java . util . Collections ; import java . util . HashSet ; import java . util . Iterator ; import java . util . List ; 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 Conjunction extends Expression { public static Expression create ( Collection < Expression > expressions ) { Set < Expression > elements = new HashSet < Expression > ( expressions . size ( ) ) ; for ( Expression expression : expressions ) { if ( expression . isFalse ( ) ) { return | |
2,368 | <s> package net . bioclipse . opentox . api ; import java . io . IOException ; import java . security . GeneralSecurityException ; import java . util . HashMap ; import java . util . List ; import org . apache . commons . httpclient . HttpClient ; import org . apache . commons . httpclient . HttpException ; import org . apache . commons . httpclient . methods . PostMethod ; import org . apache . log4j . Logger ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . NullProgressMonitor ; public abstract class ModelAlgorithm extends Algorithm { private static final Logger logger = Logger . getLogger ( ModelAlgorithm . class ) ; @ SuppressWarnings ( "serial" ) public static String calculate ( String service , String model , String dataSetURI , IProgressMonitor monitor ) throws HttpException , IOException , InterruptedException , GeneralSecurityException { if ( monitor == null ) monitor = new NullProgressMonitor ( ) ; int worked = 0 ; HttpClient client = new HttpClient ( ) ; dataSetURI = Dataset . normalizeURI ( dataSetURI ) ; PostMethod method = new PostMethod ( model ) ; HttpMethodHelper . addMethodHeaders ( method , new HashMap < String , String > ( ) { { put ( "Accept" , "" ) ; } } ) ; method . setParameter ( "dataset_uri" , dataSetURI ) ; method . setParameter ( "" , service + "dataset" ) ; client . executeMethod ( method ) ; int status = method . getStatusCode ( ) ; String dataset = "" ; String responseString = method . getResponseBodyAsString ( ) ; logger . debug ( "Status: " + status ) ; int tailing = 1 ; if ( status == 200 || status == 202 ) { if ( responseString . contains ( "/task/" ) ) { String task = responseString ; logger . debug ( "response: " + task ) ; Thread . sleep ( andABit ( 500 ) ) ; TaskState state = Task . getState ( task ) ; while ( ! state . isFinished ( ) && ! monitor . isCanceled ( ) ) { | |
2,369 | <s> package com . asakusafw . yaess . basic ; import java . io . IOException ; import java . io . OutputStream ; import java . util . List ; import java . util . Map ; import com . asakusafw . yaess . core . ExecutionContext ; public interface ProcessExecutor { | |
2,370 | <s> package org . rubypeople . rdt . internal . ui . packageview ; import org . eclipse . core . resources . IFolder ; import org . eclipse . jface . util . Assert ; import org . rubypeople . rdt . core . ISourceFolder ; import org . rubypeople . rdt . internal . ui . viewsupport . AppearanceAwareLabelProvider ; public class PackageExplorerLabelProvider extends AppearanceAwareLabelProvider { private PackageExplorerContentProvider fContentProvider ; private boolean fIsFlatLayout ; private PackageExplorerProblemsDecorator fProblemDecorator ; public PackageExplorerLabelProvider ( long textFlags , int imageFlags , PackageExplorerContentProvider cp ) { super ( textFlags , imageFlags ) ; fProblemDecorator = new PackageExplorerProblemsDecorator ( ) ; addLabelDecorator ( fProblemDecorator ) ; Assert . isNotNull ( cp ) ; fContentProvider = cp ; } public String getText ( Object element ) { if ( fIsFlatLayout || ! ( element instanceof ISourceFolder ) ) return super . getText ( element ) ; ISourceFolder fragment = ( ISourceFolder ) element ; if ( fragment . isDefaultPackage ( ) ) { return super . getText ( fragment ) ; } else { Object parent = fContentProvider . getSourceFolderProvider ( ) . getParent ( fragment ) ; if ( parent instanceof ISourceFolder ) { return getNameDelta ( ( ISourceFolder ) parent , fragment ) ; } else if ( parent instanceof IFolder ) { int prefixLength = getPrefixLength ( ( IFolder ) parent ) ; return fragment . getElementName ( ) . substring ( prefixLength ) ; } else return super . getText ( fragment ) ; } } private int getPrefixLength ( IFolder folder ) { Object parent = fContentProvider . getParent ( folder ) ; int folderNameLenght = folder . getName ( ) . length ( ) + 1 ; if ( parent instanceof ISourceFolder ) { String fragmentName = ( ( ISourceFolder ) parent ) . getElementName ( ) ; return fragmentName . length ( ) + 1 + folderNameLenght ; } else if ( parent instanceof IFolder ) { return | |
2,371 | <s> package org . oddjob . jmx . handlers ; import java . util . Map ; import javax . management . MBeanAttributeInfo ; import javax . management . MBeanException ; import javax . management . MBeanNotificationInfo ; import javax . management . MBeanOperationInfo ; import javax . management . ReflectionException ; import org . oddjob . Describeable ; import org . oddjob . arooa . ArooaSession ; import org . oddjob . describe . Describer ; import org . oddjob . describe . UniversalDescriber ; import org . oddjob . jmx . RemoteOperation ; import org . oddjob . jmx . client . ClientHandlerResolver ; import org . oddjob . jmx . client . HandlerVersion ; import org . oddjob . jmx . client . VanillaHandlerResolver ; import org . oddjob . jmx . server . JMXOperation ; import org . oddjob . jmx . server . JMXOperationFactory ; import org . oddjob . jmx . server . ServerInterfaceHandler ; import org . oddjob . jmx . server . ServerInterfaceHandlerFactory ; import org . oddjob . jmx . server . ServerSideToolkit ; public class DescribeableHandlerFactory implements ServerInterfaceHandlerFactory < Object , Describeable > { public static final | |
2,372 | <s> package net . sf . sveditor . core . db . persistence ; import java . io . DataInput ; import java . util . List ; import net . sf . sveditor . core . db . ISVDBChildItem ; import net . | |
2,373 | <s> package org . oddjob . util ; import java . io . IOException ; import java . io . OutputStream ; public class StreamPrinter { private static final byte [ ] EOL = System . getProperty ( "" ) . getBytes ( ) ; private final OutputStream out ; public StreamPrinter ( OutputStream out ) { if ( out == null ) { throw new NullPointerException ( "" ) ; } this . out = out ; } public void println ( ) { try { out . write ( EOL ) ; } catch | |
2,374 | <s> package com . sun . tools . hat . internal . model ; import java . lang . ref . SoftReference ; import java . util . * ; import com . google . common . collect . ImmutableList ; import com . sun . tools . hat . internal . lang . ModelFactory ; import com . sun . tools . hat . internal . lang . ModelFactoryFactory ; import com . sun . tools . hat . internal . parser . ReadBuffer ; import com . sun . tools . hat . internal . util . Misc ; public class Snapshot { public static long SMALL_ID_MASK = 0x0FFFFFFFFL ; public static final byte [ ] EMPTY_BYTE_ARRAY = new byte [ 0 ] ; private static final JavaField [ ] EMPTY_FIELD_ARRAY = new JavaField [ 0 ] ; private static final JavaStatic [ ] EMPTY_STATIC_ARRAY = new JavaStatic [ 0 ] ; private final Map < Number , JavaHeapObject > heapObjects = new HashMap < Number , JavaHeapObject > ( ) ; private final Map < Number , JavaClass > fakeClasses = new HashMap < Number , JavaClass > ( ) ; private final List < Root > roots = new ArrayList < Root > ( ) ; private final Map < String , JavaClass > classes = new TreeMap < String , JavaClass > ( ) ; private final Set < JavaHeapObject > newObjects = new HashSet < JavaHeapObject > ( ) ; private final Map < JavaHeapObject , StackTrace > siteTraces = new HashMap < JavaHeapObject , StackTrace > ( ) ; private final Map < JavaHeapObject , Root > rootsMap = new HashMap < JavaHeapObject , Root > ( ) ; private SoftReference < List < JavaHeapObject > > finalizablesCache ; private JavaThing nullThing ; private JavaClass weakReferenceClass ; private int referentFieldIndex ; private JavaClass javaLangClass ; private JavaClass javaLangString ; private JavaClass javaLangClassLoader ; private volatile JavaClass otherArrayType ; private ReachableExcludes reachableExcludes ; private ReadBuffer readBuf ; private boolean hasNewSet ; private boolean unresolvedObjectsOK ; private boolean newStyleArrayClass ; private int identifierSize = 4 ; private int minimumObjectSize ; private volatile ImmutableList < ModelFactory > modelFactories ; public Snapshot ( ReadBuffer buf ) { nullThing = new HackJavaValue ( "<null>" , 0 ) ; readBuf = buf ; } public void setSiteTrace ( JavaHeapObject obj , StackTrace trace ) { if ( trace != null && trace . getFrames ( ) . length != 0 ) { siteTraces . put ( obj , trace ) ; } } public StackTrace getSiteTrace ( JavaHeapObject obj ) { return siteTraces . get ( obj ) ; } public void setNewStyleArrayClass ( boolean value ) { newStyleArrayClass = value ; } public boolean isNewStyleArrayClass ( ) { return newStyleArrayClass ; } public void setIdentifierSize ( int size ) { identifierSize = size ; minimumObjectSize = 2 * size ; } public int getIdentifierSize ( ) { return identifierSize ; } public int getMinimumObjectSize ( ) { return minimumObjectSize ; } public void addHeapObject ( long id , JavaHeapObject ho ) { heapObjects . put ( makeId ( id ) , ho ) ; } public void addRoot ( Root r ) { r . setIndex ( roots . size ( ) ) ; roots . add ( r ) ; } public void addClass ( long id , JavaClass c ) { addHeapObject ( id , c ) ; putInClassesMap ( c ) ; } JavaClass addFakeInstanceClass ( long classID , int instSize ) { String name = "" + Misc . toHex ( classID ) + ">" ; int numInts = instSize / 4 ; int numBytes = instSize % 4 ; JavaField [ ] fields = new JavaField [ numInts + numBytes ] ; int i ; for ( i = 0 ; i < numInts ; i ++ ) { fields [ i ] = new JavaField ( "" + i , "I" ) ; } for ( i = 0 ; i < numBytes ; i ++ ) { fields [ i + numInts ] = new JavaField ( "" + i + numInts , "B" ) ; } JavaClass c = new JavaClass ( name , 0 , 0 , 0 , 0 , fields , EMPTY_STATIC_ARRAY , instSize ) ; addFakeClass ( makeId ( classID ) , c ) ; return c ; } public boolean getHasNewSet ( ) { return hasNewSet ; } private static final int DOT_LIMIT = 5000 ; public void resolve ( boolean calculateRefs ) { System . out . println ( "Resolving " + heapObjects . size ( ) + " objects..." ) ; javaLangClass = findClass ( "" ) ; if ( javaLangClass == null ) { System . out . println ( "" ) ; javaLangClass = new JavaClass ( "" , 0 , 0 , 0 , 0 , EMPTY_FIELD_ARRAY , EMPTY_STATIC_ARRAY , 0 ) ; addFakeClass ( javaLangClass ) ; } javaLangString = findClass ( "" ) ; if ( javaLangString == null ) { System . out . println ( "" ) ; javaLangString = new JavaClass ( "" , 0 , 0 , 0 , 0 , EMPTY_FIELD_ARRAY , EMPTY_STATIC_ARRAY , 0 ) ; addFakeClass ( javaLangString ) ; } javaLangClassLoader = findClass ( "" ) ; if ( javaLangClassLoader == null ) { System . out . println ( "" ) ; javaLangClassLoader = new JavaClass ( "" , 0 , 0 , 0 , 0 , EMPTY_FIELD_ARRAY , EMPTY_STATIC_ARRAY , 0 ) ; addFakeClass ( javaLangClassLoader ) ; } for ( JavaHeapObject t : heapObjects . values ( ) ) { if ( t instanceof JavaClass ) { t . resolve ( this ) ; } } for ( JavaHeapObject t : heapObjects . values ( ) ) { if ( ! ( t instanceof JavaClass ) ) { t . resolve ( this ) ; } } heapObjects . putAll ( fakeClasses ) ; fakeClasses . clear ( ) ; weakReferenceClass = findClass ( "" ) ; if ( weakReferenceClass == null ) { weakReferenceClass = findClass ( "sun.misc.Ref" ) ; referentFieldIndex = 0 ; } else { JavaField [ ] fields = weakReferenceClass . getFieldsForInstance ( ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { if ( "referent" . equals ( fields [ i ] . getName ( ) ) ) { referentFieldIndex = i ; break ; } } } if ( calculateRefs ) { calculateReferencesToObjects ( ) ; System . out . print ( "" ) ; System . out . flush ( ) ; } int count = 0 ; for ( JavaHeapObject t : heapObjects . values ( ) ) { t . setupReferers ( ) ; ++ count ; if ( calculateRefs && count % DOT_LIMIT == 0 ) { System . out . print ( "." ) ; System . out . flush ( ) ; } } if ( calculateRefs ) { System . out . println ( "" ) ; } } private void calculateReferencesToObjects ( ) { System . out . print ( "" + ( heapObjects . size ( ) / DOT_LIMIT ) + " dots" ) ; System . out . flush ( ) ; int count = 0 ; for ( final JavaHeapObject t : heapObjects . values ( ) ) { t . visitReferencedObjects ( new AbstractJavaHeapObjectVisitor ( ) { @ Override public void visit ( JavaHeapObject other ) { other . addReferenceFrom ( t ) ; } } ) ; ++ count ; if ( count % DOT_LIMIT == 0 ) { System . out . print ( "." ) ; System . out . flush ( ) ; } } System . out . println ( ) ; for ( Root r : roots ) { r . resolve ( this ) ; JavaHeapObject t = findThing ( r . getId ( ) ) ; if ( t != null ) { t . addReferenceFromRoot ( r ) ; } } } public void markNewRelativeTo ( Snapshot baseline ) { hasNewSet = true ; for ( JavaHeapObject t : heapObjects . values ( ) ) { boolean isNew ; long thingID = t . getId ( ) ; if ( thingID == 0L || thingID == - 1L ) { isNew = false ; } else { JavaThing other = baseline . findThing ( t . getId ( ) ) ; if ( other == null ) { isNew = true ; } else { isNew = ! t . isSameTypeAs ( other ) ; } } t . setNew ( isNew ) ; } } public Collection < JavaHeapObject > getThings ( ) { return heapObjects . values ( ) ; } public JavaHeapObject findThing ( long id ) { Number idObj = makeId ( id ) ; JavaHeapObject jho = heapObjects . get ( idObj ) ; return jho != null ? jho : fakeClasses . get ( idObj ) ; } public JavaHeapObject findThing ( String id ) { return findThing ( Misc . parseHex ( id ) ) ; } public JavaClass findClass ( String name ) { if ( name . startsWith ( "0x" ) ) { return ( JavaClass ) findThing ( name ) ; } else { return classes . get ( name ) ; } } public Collection < JavaClass > getClasses ( ) { return Collections . unmodifiableCollection ( classes . values ( ) ) ; } public JavaClass [ ] getClassesArray ( ) { return classes . values ( ) . toArray ( new JavaClass [ classes . size ( ) ] ) ; } public synchronized Collection < JavaHeapObject > getFinalizerObjects ( ) { if ( finalizablesCache != null ) { List < JavaHeapObject > obj = finalizablesCache . get ( ) ; if ( obj != null ) { return obj ; } } JavaClass clazz = findClass ( "" ) ; JavaObject queue = ( JavaObject ) clazz . getStaticField ( "queue" ) ; JavaThing tmp = queue . getField ( "head" ) ; List < JavaHeapObject > finalizables = new ArrayList < JavaHeapObject > ( ) ; if ( tmp != getNullThing ( ) ) { JavaObject head = ( JavaObject ) tmp ; while ( true ) { JavaHeapObject referent = ( JavaHeapObject ) head . getField ( "referent" ) ; JavaThing next = head . getField ( "next" ) ; if ( next == getNullThing ( ) || next . equals ( head ) ) { break ; } head = ( JavaObject ) next ; finalizables . add ( referent ) ; } } finalizablesCache = new SoftReference < List < JavaHeapObject > > ( finalizables ) ; return finalizables ; } public Collection < Root > getRoots ( ) { return roots ; } public Root [ ] getRootsArray ( ) { return roots . toArray ( new Root [ roots . size ( ) ] ) ; } public Root getRootAt ( int i ) { return roots . get ( i ) ; } public ReferenceChain [ ] rootsetReferencesTo ( JavaHeapObject target , boolean includeWeak ) { Queue < ReferenceChain > fifo = new ArrayDeque < ReferenceChain > ( ) ; Set < JavaHeapObject > visited = new HashSet < JavaHeapObject > ( ) ; List < ReferenceChain > result = new ArrayList < ReferenceChain > ( ) ; visited . add ( target ) ; fifo . add ( new ReferenceChain ( target | |
2,375 | <s> package org . rubypeople . rdt . refactoring . ui . pages ; import org . eclipse . swt . SWT ; 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 . Event ; import org . eclipse . swt . widgets . Listener ; import org . rubypeople . rdt . refactoring . ui . ICheckboxListener ; import org . rubypeople . rdt . refactoring . ui . LabeledTextField ; import org . rubypeople . rdt . refactoring . ui . NewNameListener ; public class RenameFieldPage extends RenamePage { private static final String NAME = Messages . RenameFieldPage_Name ; private final ICheckboxListener checkListener ; public RenameFieldPage ( String selectedVariable , NewNameListener listener , ICheckboxListener checkListener ) { super ( NAME , selectedVariable , listener ) ; this . checkListener = checkListener ; } public void createControl ( Composite parent ) { | |
2,376 | <s> package com . asakusafw . dmdl . windgate . csv . driver ; import java . text . SimpleDateFormat ; import com . asakusafw . dmdl . model . AstNode ; import com . asakusafw . dmdl . semantics . Trait ; import com . asakusafw . runtime . io . csv . CsvConfiguration ; import com . asakusafw . runtime . value . Date ; import com . asakusafw . runtime . value . DateTime ; public class CsvSupportTrait implements Trait < CsvSupportTrait > { private final AstNode originalAst ; private final Configuration configuration ; public CsvSupportTrait ( AstNode originalAst , Configuration configuration ) { if ( configuration == null ) { throw new IllegalArgumentException ( "" ) ; } this . originalAst = originalAst ; this . configuration = configuration ; } public Configuration getConfiguration ( ) { return configuration ; } @ Override public AstNode getOriginalAst ( ) { return originalAst ; } public static class Configuration { private String charsetName = "UTF-8" ; private boolean enableHeader = false ; private String trueFormat = CsvConfiguration . DEFAULT_TRUE_FORMAT ; private | |
2,377 | <s> package com . asakusafw . utils . java . internal . model . syntax ; import java . util . List ; import com . asakusafw . utils . java . model . syntax . Expression ; import com . asakusafw . utils . java . model . syntax . ModelKind ; import com . asakusafw . utils . java . model . syntax . SuperConstructorInvocation ; import com . asakusafw . utils . java . model . syntax . Type ; import com . asakusafw . utils . java . model . syntax . Visitor ; public final class SuperConstructorInvocationImpl extends ModelRoot implements SuperConstructorInvocation { private Expression qualifier ; private List < ? extends Type > typeArguments ; private List < ? extends Expression > arguments ; @ Override public Expression getQualifier ( ) { return this . qualifier ; } public void setQualifier ( Expression qualifier ) { this . qualifier = qualifier ; } @ Override public List < ? extends Type > getTypeArguments ( ) { return this . typeArguments ; } public void setTypeArguments ( List < ? extends Type > typeArguments ) { Util . notNull ( typeArguments , "" ) ; Util . notContainNull ( typeArguments , "" ) ; this . typeArguments = Util . freeze ( typeArguments ) ; } @ Override public List < ? extends Expression > getArguments ( ) { return this | |
2,378 | <s> package org . oddjob . designer . elements ; import org . oddjob . arooa . design . DesignFactory ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignProperty ; import org . oddjob . arooa . design . DesignValueBase ; import org . oddjob . arooa . design . SimpleTextAttribute ; import org . oddjob . arooa . design . etc . FileAttribute ; import org . oddjob . arooa . design . screem . BorderedGroup ; import org . oddjob . arooa . design . screem . Form ; import org . oddjob . arooa . design . screem . StandardForm ; import org . oddjob . arooa . parsing . ArooaContext ; import org . oddjob . arooa . parsing . ArooaElement ; import org . oddjob . io . FileType ; public class FileOutputDE implements DesignFactory { public DesignInstance createDesign ( ArooaElement element , ArooaContext parentContext ) { return new FileDesign ( element , parentContext ) ; } } class FileOutputDesign extends DesignValueBase { private final FileAttribute file ; private final SimpleTextAttribute append ; public FileOutputDesign ( ArooaElement element , ArooaContext parentContext ) { super ( element , | |
2,379 | <s> package org . rubypeople . rdt . internal . ui . text . spelling . engine ; import java . net . MalformedURLException ; import java . net . URL ; import java . util . Locale ; | |
2,380 | <s> package com . asakusafw . compiler . fileio . model ; import java . io . DataInput ; import java . io . DataOutput ; import java . io . IOException ; import org . apache . hadoop . io . Writable ; import com . asakusafw . compiler . fileio . io . ExJoinedInput ; import com . asakusafw . compiler . fileio . io . ExJoinedOutput ; 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 = "value" ) } , shuffle = @ Key ( group = { "value" } ) ) , @ Joined . Term ( source = Ex2 . class , mappings = { @ Joined . Mapping ( source = "sid" , destination = "sid2" ) , @ Joined . Mapping ( source = "value" , destination = "value" ) } , shuffle = @ Key ( group = { "value" } ) ) } ) @ ModelInputLocation ( ExJoinedInput . class ) @ ModelOutputLocation ( ExJoinedOutput . class ) public class ExJoined implements DataModel < ExJoined > , Writable { private final LongOption sid1 = new LongOption ( ) ; private final IntOption value = new IntOption ( ) ; private final LongOption sid2 = new LongOption ( ) ; @ Override @ SuppressWarnings ( "deprecation" ) public void reset ( ) { this . sid1 . setNull ( ) ; this . value . setNull ( ) ; this . sid2 . setNull ( ) ; } @ Override @ SuppressWarnings ( "deprecation" ) public void copyFrom ( ExJoined other ) { this . sid1 . copyFrom ( other . sid1 ) ; this . value . copyFrom ( other . value ) ; this . sid2 . copyFrom ( other . sid2 ) ; } public long getSid1 ( ) { return this . sid1 . get ( ) ; } @ SuppressWarnings ( "deprecation" ) public void setSid1 ( long value0 ) { this . sid1 . modify ( value0 ) ; } public LongOption getSid1Option ( ) { return this . sid1 ; } @ SuppressWarnings ( "deprecation" ) public void setSid1Option ( LongOption option ) { this . sid1 . copyFrom ( option ) ; } public int getValue ( ) { return this . value . get ( ) ; } @ SuppressWarnings ( "deprecation" ) public void setValue ( int value0 ) { this . value . modify ( value0 ) ; } public IntOption getValueOption ( ) { return this . value ; } @ SuppressWarnings ( "deprecation" ) public void setValueOption ( IntOption option ) { this . value . copyFrom ( option ) ; } public long getSid2 ( ) { return this . sid2 . get ( ) ; } @ SuppressWarnings ( "deprecation" ) public void setSid2 ( long value0 ) { this . sid2 . modify ( value0 ) ; } 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 ( ", value=" ) ; result . append ( this . value ) ; 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 + sid1 . hashCode ( ) ; result = prime * result + value . hashCode ( ) ; result = prime * result + sid2 . hashCode | |
2,381 | <s> package org . rubypeople . rdt . internal . core ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; import org . eclipse . core . resources . IMarkerDelta ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IResourceDelta ; import org . eclipse . core . resources . IResourceDeltaVisitor ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; public class ShamResourceDelta implements IResourceDelta { private List children = new ArrayList ( ) ; private IResource resource ; private int kind ; private int flags ; public void accept ( IResourceDeltaVisitor visitor ) throws CoreException { if ( visitor . visit ( this ) ) { for ( Iterator iter = children . iterator ( ) ; iter . hasNext ( ) ; ) { IResourceDelta delta = ( IResourceDelta ) iter . next ( ) ; delta . accept ( visitor ) ; } } } public void accept ( IResourceDeltaVisitor visitor , boolean includePhantoms ) throws CoreException { } public void accept ( IResourceDeltaVisitor visitor , int memberFlags ) throws CoreException { } public IResourceDelta findMember ( IPath path ) { return null ; } | |
2,382 | <s> package net . sf . sveditor . core . db . stmt ; import net . sf . sveditor . core . db . SVDBItemType ; import net . sf . sveditor . core . db . expr . SVDBExpr ; public class SVDBWhileStmt extends SVDBBodyStmt { public SVDBExpr fCond ; public SVDBWhileStmt ( ) { super ( SVDBItemType . WhileStmt ) ; } public SVDBWhileStmt | |
2,383 | <s> package com . pogofish . jadt . samples . visitor ; import java . io . PrintWriter ; public class ColorEnumExamples { public void printString ( ColorEnum color , PrintWriter writer ) { switch ( color ) { case Red : writer . print ( "red" ) ; break ; case Green : writer . print ( "green" ) ; | |
2,384 | <s> package org . rubypeople . rdt . internal . ui . text . correction ; import org . jruby . ast . Node ; import org . jruby . ast . RootNode ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . internal . ti . util . ClosestSpanningNodeLocator ; import org . rubypeople . rdt . internal . ti . util . INodeAcceptor ; import org . rubypeople . rdt . internal . ti . util . OffsetNodeLocator ; import org . rubypeople . rdt . internal . ui . rubyeditor . ASTProvider ; import org . rubypeople . rdt . ui . text . ruby | |
2,385 | <s> package com . asakusafw . windgate . stream ; import java . io . IOException ; import java . io . OutputStream ; import java . util . ArrayList ; import java . util . Iterator ; import java . util . List ; public class MockOutputStreamProvider extends OutputStreamProvider { private final Iterator < ? extends StreamProvider < ? extends OutputStream > > iterator ; private StreamProvider < ? extends OutputStream | |
2,386 | <s> package org . oddjob . designer . components ; import junit . framework . TestCase ; import org . apache . log4j . Logger ; import org . oddjob . Helper ; import org . oddjob . OddjobDescriptorFactory ; import org . oddjob . arooa . ArooaDescriptor ; import org . oddjob . arooa . ArooaParseException ; import org . oddjob . arooa . ArooaType ; import org . oddjob . arooa . design . DesignInstance ; import org . oddjob . arooa . design . DesignParser ; import org . oddjob . arooa . design . view . ViewMainHelper ; import org . oddjob . arooa . standard . StandardArooaSession ; import org . oddjob . arooa . xml . XMLConfiguration ; import org . oddjob . jobs . structural . JobFolder ; public class FolderDCTest extends TestCase { private static final Logger logger = Logger . getLogger ( FolderDCTest . class ) ; public void setUp ( ) { logger . debug ( "" + getName ( ) + "" ) ; } DesignInstance design ; public void testCreate ( ) throws ArooaParseException { String xml = "" + " <jobs>" + " <echo/>" + " <echo/>" + " </jobs>" + "</folder>" ; ArooaDescriptor descriptor = new OddjobDescriptorFactory ( ) . createDescriptor ( getClass ( ) . getClassLoader ( ) ) ; DesignParser parser = new DesignParser ( new StandardArooaSession ( descriptor ) ) ; parser . setArooaType ( ArooaType . COMPONENT ) ; parser . parse ( new XMLConfiguration ( | |
2,387 | <s> package net . sf . sveditor . core . db . search ; import net . sf . sveditor . core . db . ISVDBNamedItem ; import net . sf . sveditor . core . db . SVDBItemType ; public class SVDBFindByNameMatcher implements ISVDBFindNameMatcher { private SVDBItemType fTypes [ ] ; public SVDBFindByNameMatcher ( SVDBItemType ... types ) { fTypes = types ; } public boolean match ( ISVDBNamedItem it , String name ) { if ( fTypes . length | |
2,388 | <s> package com . asakusafw . bulkloader . cache ; import java . sql . Connection ; import java . sql . PreparedStatement ; import java . sql . ResultSet ; import java . sql . SQLException ; import java . sql . Statement ; import java . sql . Timestamp ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Calendar ; import java . util . List ; import com . asakusafw . bulkloader . common . DBConnection ; import com . asakusafw . bulkloader . exception . BulkLoaderSystemException ; import com . asakusafw . bulkloader . log . Log ; public class LocalCacheInfoRepository { static final Log LOG = new Log ( LocalCacheInfoRepository . class ) ; private final Connection connection ; public LocalCacheInfoRepository ( Connection connection ) { if ( connection == null ) { throw new IllegalArgumentException ( "" ) ; } this . connection = connection ; } public LocalCacheInfo getCacheInfo ( String cacheId ) throws BulkLoaderSystemException { if ( cacheId == null ) { throw new IllegalArgumentException ( "" ) ; } final String sql = "" + "" + "" ; PreparedStatement statement = null ; ResultSet resultSet = null ; try { LOG . debugMessage ( "" , cacheId ) ; statement = connection . prepareStatement ( sql ) ; statement . setString ( 1 , cacheId ) ; resultSet = statement . executeQuery ( ) ; if ( resultSet . next ( ) == false ) { LOG . debugMessage ( "" , cacheId ) ; return null ; } LocalCacheInfo result = toCacheInfoObject ( resultSet ) ; assert resultSet . next ( ) == false ; LOG . debugMessage ( "" , cacheId ) ; return result ; } catch ( SQLException e ) { throw BulkLoaderSystemException . createInstanceCauseBySQLException ( e , getClass ( ) , sql , cacheId ) ; } finally { DBConnection . closeRs ( resultSet ) ; DBConnection . closePs ( statement ) ; } } public Calendar putCacheInfo ( LocalCacheInfo current ) throws BulkLoaderSystemException { if ( current == null ) { throw new IllegalArgumentException ( "" ) ; } final String sql = "REPLACE " + "" + "" ; boolean succeed = false ; PreparedStatement statement = null ; Calendar last = null ; try { LOG . debugMessage ( "" , current ) ; last = getLastUpdated ( current . getTableName ( ) ) ; if ( last == null ) { throw new BulkLoaderSystemException ( getClass ( ) , "" , current ) ; } statement = connection . prepareStatement ( sql ) ; statement . setString ( 1 , current . getId ( ) ) ; statement . setTimestamp ( 2 , toTimestamp ( last ) ) ; statement . setTimestamp ( 3 , toTimestamp ( current . getRemoteTimestamp ( ) ) ) ; statement . setString ( 4 , current . getTableName ( ) ) ; statement . setString ( 5 , current . getPath ( ) ) ; int rows = statement . executeUpdate ( ) ; if ( rows == 0 ) { throw new BulkLoaderSystemException ( getClass ( ) , "" , current ) ; } DBConnection . commit ( connection ) ; succeed = true ; LOG . debugMessage ( "" , toTimestamp ( last ) ) ; return last ; } catch ( SQLException e ) { throw BulkLoaderSystemException . createInstanceCauseBySQLException ( e , getClass ( ) , sql , current . getId ( ) , toTimestamp ( last ) , toTimestamp ( current . getRemoteTimestamp ( ) ) , current . getTableName ( ) , current . getPath ( ) ) ; } finally { DBConnection . closePs ( statement ) ; if ( succeed == false ) { DBConnection . rollback ( connection ) ; } } } private Calendar getLastUpdated ( String tableName ) throws SQLException { assert connection != null ; assert tableName != null ; Statement statement = connection . createStatement ( ) ; ResultSet resultSet = null ; try { LOG . debugMessage ( "" , tableName ) ; statement . execute ( MessageFormat . format ( "" , tableName ) ) ; resultSet = statement . executeQuery ( "SELECT NOW()" ) ; if ( resultSet . next ( ) == false ) { return null ; } Calendar calendar = Calendar . getInstance ( ) ; Timestamp timestamp = resultSet . getTimestamp ( 1 , calendar ) ; calendar . setTime ( timestamp ) ; resultSet . close ( ) ; statement . execute ( "" ) ; LOG . debugMessage ( "" , tableName , timestamp ) ; return calendar ; } finally { DBConnection . closeRs ( resultSet ) ; DBConnection . closeStmt ( statement ) ; } } public boolean deleteCacheInfo ( String cacheId ) throws BulkLoaderSystemException { if ( cacheId == null ) { throw new IllegalArgumentException ( "" ) ; } final String sql = "" + "" + "" ; boolean succeed = false ; PreparedStatement statement = null ; try { LOG . debugMessage ( "" , cacheId ) ; statement = connection . prepareStatement ( sql ) ; statement . setString ( 1 , cacheId ) ; int rows = statement . executeUpdate ( ) ; DBConnection . commit ( connection ) ; succeed = true ; LOG . debugMessage ( "" , cacheId , rows ) ; return rows > 0 ; } catch ( SQLException e ) { throw BulkLoaderSystemException . createInstanceCauseBySQLException ( e , getClass ( ) , sql , cacheId ) ; } finally { DBConnection . closePs ( statement ) ; if ( succeed == false ) { DBConnection . rollback ( connection ) ; } } } public int deleteTableCacheInfo ( String tableName ) throws BulkLoaderSystemException { if ( tableName == null ) { throw new IllegalArgumentException ( "" ) ; } final String sql = "" + "" + "" ; boolean succeed = false ; PreparedStatement statement = | |
2,389 | <s> package com . asakusafw . compiler . flow . testing . io ; import java . io . IOException ; import com . asakusafw . compiler . flow . testing . model . KeyConflict ; import com . asakusafw . runtime . io . ModelInput ; import com . asakusafw . runtime . io . RecordParser ; public final | |
2,390 | <s> package org . rubypeople . rdt . internal . ui . wizards ; import java . text . Collator ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Comparator ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Set ; import org . eclipse . core . resources . IFile ; import org . eclipse . core . resources . IProject ; import org . eclipse . core . resources . IResource ; import org . eclipse . core . resources . IResourceProxy ; import org . eclipse . core . resources . IResourceProxyVisitor ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IPath ; import org . eclipse . core . runtime . IProgressMonitor ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . core . runtime . NullProgressMonitor ; import org . eclipse . core . runtime . OperationCanceledException ; import org . eclipse . core . runtime . Path ; import org . rubypeople . rdt . core . ILoadpathEntry ; import org . rubypeople . rdt . core . IRubyScript ; import org . rubypeople . rdt . core . RubyConventions ; import org . rubypeople . rdt . core . RubyCore ; import org . rubypeople . rdt . core . RubyModelException ; import org . rubypeople . rdt . ui . PreferenceConstants ; public class LoadPathDetector implements IResourceProxyVisitor { private HashMap fSourceFolders ; private IProject fProject ; private ILoadpathEntry [ ] fResultLoadpath ; private IProgressMonitor fMonitor ; private static class LPSorter implements Comparator { private Collator fCollator = Collator . getInstance ( ) ; public int compare ( Object o1 , Object o2 ) { ILoadpathEntry e1 = ( ILoadpathEntry ) o1 ; ILoadpathEntry e2 = ( ILoadpathEntry ) o2 ; return fCollator . compare ( e1 . getPath ( ) . toString ( ) , e2 . getPath ( ) . toString ( ) ) ; } } public LoadPathDetector ( IProject project , IProgressMonitor monitor ) throws CoreException { fSourceFolders = new HashMap ( ) ; fProject = project ; fResultLoadpath = null ; if ( monitor == null ) { monitor = new NullProgressMonitor ( ) ; } detectLoadpath ( monitor ) ; } private void detectLoadpath ( IProgressMonitor monitor ) throws CoreException { try { monitor . beginTask ( NewWizardMessages . LoadPathDetector_operation_description , 2 ) ; fMonitor = monitor ; fProject . accept ( this , IResource . NONE ) ; monitor . worked ( 1 ) ; ArrayList cpEntries = new ArrayList ( ) ; detectSourceFolders ( | |
2,391 | <s> package com . asakusafw . bulkloader . cache ; import java . io . IOException ; import java . text . MessageFormat ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; import java . util . concurrent . Callable ; import java . util . concurrent . CancellationException ; import java . util . concurrent . ExecutionException ; import java . util . concurrent . ExecutorService ; import java . util . concurrent . Executors ; import java . util . concurrent . Future ; import java . util . concurrent . ThreadFactory ; import java . util . concurrent . TimeUnit ; import java . util . concurrent . TimeoutException ; import java . util . concurrent . atomic . AtomicInteger ; import com . asakusafw . bulkloader . bean . ImportBean ; import com . asakusafw . bulkloader . bean . ImportTargetTableBean ; import com . asakusafw . bulkloader . common . ConfigurationLoader ; import com . asakusafw . bulkloader . common . Constants ; import com . asakusafw . bulkloader . exception . BulkLoaderSystemException ; import com . asakusafw . bulkloader . log . Log ; import com . asakusafw . bulkloader . transfer . FileList ; import com . asakusafw . bulkloader . transfer . FileListProvider ; import com . asakusafw . bulkloader . transfer . FileProtocol ; import com . asakusafw . bulkloader . transfer . OpenSshFileListProvider ; import com . asakusafw . runtime . core . context . RuntimeContext ; import com . asakusafw . thundergate . runtime . cache . CacheInfo ; public class GetCacheInfoLocal { static final Log LOG = new Log ( GetCacheInfoLocal . class ) ; private final ExecutorService executor = Executors . newCachedThreadPool ( new ThreadFactory ( ) { final AtomicInteger counter = new AtomicInteger ( ) ; @ Override public Thread newThread ( Runnable r ) { Thread t = new Thread ( r ) ; t . setDaemon ( true ) ; t . setName ( String . format ( "" , counter . incrementAndGet ( ) ) ) ; return t ; } } ) ; public Map < String , CacheInfo > get ( ImportBean bean ) throws BulkLoaderSystemException { if ( bean == null ) { throw new IllegalArgumentException ( "" ) ; } if ( hasCacheUser ( bean ) == false ) { return Collections . emptyMap ( ) ; } LOG . info ( "" , bean . getTargetName ( ) , bean . getBatchId ( ) , bean . getJobflowId ( ) , bean . getExecutionId ( ) ) ; FileListProvider provider = null ; try { provider = openFileList ( bean . getTargetName ( ) , bean . getBatchId ( ) , bean . getJobflowId ( ) , bean . getExecutionId ( ) ) ; Future < Void > upstream = submitUpstream ( bean , provider ) ; Future < Map < String , CacheInfo > > downstream = submitDownstream ( provider ) ; Map < String , CacheInfo > result ; while ( true ) { try { if ( upstream . isDone ( ) ) { upstream . get ( ) ; } result = downstream . get ( 1 , TimeUnit . SECONDS ) ; break ; } catch ( TimeoutException e ) { } catch ( CancellationException e ) { upstream . cancel ( true ) ; downstream . cancel ( true ) ; throw new IOException ( "" , e ) ; } catch ( ExecutionException e ) { upstream . cancel ( true ) ; | |
2,392 | <s> package de . fuberlin . wiwiss . d2rq . sql ; import java . sql . ResultSet ; import java . sql . ResultSetMetaData ; import java . sql . SQLException ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . Iterator ; import java . util . List ; import java . util . Map ; import de . fuberlin . wiwiss . d2rq . algebra . ProjectionSpec ; public class ResultRowMap implements ResultRow { public static ResultRowMap fromResultSet ( ResultSet resultSet , List < ProjectionSpec > projectionSpecs , ConnectedDB database ) throws SQLException { Map < ProjectionSpec , String > result = new HashMap < ProjectionSpec , String > ( ) ; ResultSetMetaData metaData = resultSet . getMetaData ( ) ; for ( int i = 0 ; i < projectionSpecs . size ( ) ; i ++ ) { ProjectionSpec key = projectionSpecs . get ( i ) ; int jdbcType = metaData == null ? Integer . MIN_VALUE : metaData . getColumnType ( i + 1 ) ; String name = metaData == null ? "UNKNOWN" : metaData . getColumnTypeName ( i + 1 ) ; result . put ( key , database . vendor ( ) . getDataType ( jdbcType , name . toUpperCase ( ) , - 1 ) . value ( resultSet , i + 1 ) ) ; } return new ResultRowMap ( result ) ; } private final Map < ProjectionSpec , String > projectionsToValues ; public ResultRowMap ( Map < ProjectionSpec , String > projectionsToValues ) { this . projectionsToValues = projectionsToValues ; } public String get ( ProjectionSpec projection ) { return ( String ) this . projectionsToValues . get ( projection ) ; } | |
2,393 | <s> package com . aptana . rdt . core . gems ; import org . eclipse . core | |
2,394 | <s> package org . rubypeople . rdt . internal . corext . util ; import java . util . HashMap ; import java . util . Map ; import org . rubypeople . rdt . core . IMethod ; import org . rubypeople . rdt . core . IType ; import org . rubypeople . rdt . core . ITypeHierarchy ; import org . rubypeople . rdt . core . RubyModelException ; public class MethodOverrideTester { private static class Substitutions { public static final Substitutions EMPTY_SUBST = new Substitutions ( ) ; private HashMap fMap ; public Substitutions ( ) { fMap = null ; } public void addSubstitution ( String typeVariable , String substitution , String erasure ) { if ( fMap == null ) { fMap = new HashMap ( 3 ) ; } fMap . put ( typeVariable , new String [ ] { substitution , erasure } ) ; } private String [ ] getSubstArray ( String typeVariable ) { if ( fMap != null ) { return ( String [ ] ) fMap . get ( typeVariable ) ; } return null ; } public String getSubstitution ( String typeVariable ) { String [ ] subst = getSubstArray ( typeVariable ) ; if ( subst != null ) { return subst [ 0 ] ; } return null ; } public String getErasure ( String typeVariable ) { String [ ] subst = getSubstArray ( typeVariable ) ; if ( subst != null ) { return subst [ 1 ] ; } return null ; } } private final IType fFocusType ; private final ITypeHierarchy fHierarchy ; private Map fMethodSubstitutions ; private Map fTypeVariableSubstitutions ; public MethodOverrideTester ( IType focusType , ITypeHierarchy hierarchy ) { fFocusType = focusType ; fHierarchy = hierarchy ; fTypeVariableSubstitutions = null ; fMethodSubstitutions = null ; } public IType getFocusType ( ) { return fFocusType ; } public ITypeHierarchy getTypeHierarchy ( ) { return fHierarchy ; } public IMethod findDeclaringMethod ( IMethod overriding , boolean testVisibility ) throws RubyModelException { IMethod | |
2,395 | <s> package org . rubypeople . rdt . internal . core . index ; import org . rubypeople . rdt . core . search . SearchPattern ; import org . rubypeople . rdt . internal . compiler . util . HashtableOfObject ; import org . rubypeople . rdt . internal . compiler . util . SimpleLookupTable ; import org . rubypeople . rdt . internal . compiler . util . SimpleSet ; import org . rubypeople . rdt . internal . core . util . SimpleWordSet ; public class MemoryIndex { public int NUM_CHANGES = 100 ; SimpleLookupTable docsToReferences ; SimpleWordSet allWords ; String lastDocumentName ; HashtableOfObject lastReferenceTable ; MemoryIndex ( ) { this . docsToReferences = new SimpleLookupTable ( 7 ) ; this . allWords = new SimpleWordSet ( 7 ) ; } void addDocumentNames ( String substring , SimpleSet results ) { Object [ ] paths = this . docsToReferences . keyTable ; Object [ ] referenceTables = this . docsToReferences . valueTable ; if ( substring == null ) { for ( int i = 0 , l = referenceTables . length ; i < l ; i ++ ) if ( referenceTables [ i ] != null ) results . add ( paths [ i ] ) ; } else { for ( int i = 0 , l = referenceTables . length ; i < l ; i ++ ) if ( referenceTables [ i ] != null && ( ( String ) paths [ i ] ) . startsWith ( substring , 0 ) ) results . add ( paths [ i ] ) ; } } void addIndexEntry ( char [ ] category , char [ ] key , String documentName ) { HashtableOfObject referenceTable ; if ( documentName . equals ( this . lastDocumentName ) ) referenceTable = this . lastReferenceTable ; else { referenceTable = ( HashtableOfObject ) this . docsToReferences . get ( documentName ) ; if ( referenceTable == null ) this . docsToReferences . put ( documentName , referenceTable = new HashtableOfObject ( 3 ) ) ; this . lastDocumentName = documentName ; this . lastReferenceTable = referenceTable ; } SimpleWordSet existingWords = ( SimpleWordSet ) referenceTable . get ( category ) ; if ( existingWords == null ) referenceTable . put ( category , existingWords = new SimpleWordSet ( 1 ) ) ; existingWords . add ( this . allWords . add ( key ) ) ; } HashtableOfObject addQueryResults ( char [ ] [ ] categories , char [ ] key , int matchRule , HashtableOfObject results ) { Object [ ] paths = this . docsToReferences . keyTable ; Object [ ] referenceTables = this . docsToReferences . valueTable ; if ( matchRule == ( SearchPattern . R_EXACT_MATCH | SearchPattern . R_CASE_SENSITIVE ) && key != null ) { nextPath : for ( int i = 0 , l = referenceTables . length ; i < l ; i ++ ) { HashtableOfObject categoryToWords = ( HashtableOfObject ) referenceTables [ i ] ; if ( categoryToWords != null ) { for ( int j = 0 , m = categories . length ; j < m ; j ++ | |
2,396 | <s> package net . sf . sveditor . core . parser ; import java . util . ArrayList ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; import java . util . Stack ; import net . sf . sveditor . core . db . SVDBLocation ; import net . sf . sveditor . core . log . LogFactory ; import net . sf . sveditor . core . log . LogHandle ; import net . sf . sveditor . core . scanner . SVCharacter ; import net . sf . sveditor . core . scanner . SVKeywords ; import net . sf . sveditor . core . scanutils . ITextScanner ; import net . sf . sveditor . core . scanutils . ScanLocation ; public class SVLexer extends SVToken { private ITextScanner fScanner ; private Set < String > fSeqPrefixes [ ] ; private Set < String > fOperatorSet ; private Set < String > fKeywordSet ; private List < ISVTokenListener > fTokenListeners ; private boolean fTokenConsumed ; private boolean fNewlineAsOperator ; private boolean fIsDelayControl ; private StringBuilder fStringBuffer ; private static final boolean fDebugEn = false ; private boolean fEOF ; private StringBuilder fCaptureBuffer ; private boolean fCapture ; private SVToken fCaptureLastToken ; private ISVParser fParser ; private Stack < SVToken > fUngetStack ; private boolean fInAttr ; private LogHandle fLog ; public static final String RelationalOps [ ] = { "&" , "&&" , "&&&" , "|" , "||" , "-" , "+" , "%" , "!" , "*" , "**" , "/" , "^" , "^~" , "~^" , "~" , "?" , "<" , "<<" , "<=" , "<<<" , ">" , ">>" , ">=" , ">>>" , "=" , "*=" , "/=" , "%=" , "+=" , "==" , "!=" , "-=" , "<<=" , ">>=" , "<<<=" , ">>>=" , "&=" , "^=" , "|=" , "===" , "!==" , "==?" , "!=?" } ; public static final String GroupingOps [ ] = { "(" , ")" , "{" , "}" , "[" , "]" , } ; public static final String MiscOps [ ] = { ":" , "::" , ":/" , ":=" , "+:" , "-:" , "," , ";" , "." , ".*" , "'" , "->" , "->>" , "-->" , "#" , "##" , "@" , "@@" , "(*" , "*)" , "=>" , "|=>" , "|->" , "#-#" , "#=#" , "##" , "--" , "++" } ; private static final String AllOperators [ ] ; static { AllOperators = new String [ RelationalOps . length + GroupingOps . length + MiscOps . length ] ; int idx = 0 ; for ( String o : RelationalOps ) { AllOperators [ idx ++ ] = o ; } for ( String o : GroupingOps ) { AllOperators [ idx ++ ] = o ; } for ( String o : MiscOps ) { AllOperators [ idx ++ ] = o ; } } @ SuppressWarnings ( "unchecked" ) public SVLexer ( ) { fLog = LogFactory . getLogHandle ( "SVLexer" ) ; fOperatorSet = new HashSet < String > ( ) ; fSeqPrefixes = new Set [ ] { fOperatorSet , new HashSet < String > ( ) , new HashSet < String > ( ) } ; fKeywordSet = new HashSet < String > ( ) ; fStringBuffer = new StringBuilder ( ) ; fCaptureBuffer = new StringBuilder ( ) ; fCapture = false ; fUngetStack = new Stack < SVToken > ( ) ; fTokenListeners = new ArrayList < ISVTokenListener > ( ) ; for ( String op : AllOperators ) { if ( op . length ( ) == 3 ) { fSeqPrefixes [ 1 ] . add ( op . substring ( 0 , 2 ) ) ; fSeqPrefixes [ 2 ] . add ( op . substring ( 0 , 3 ) ) ; } else if ( op . length ( ) == 2 ) { fSeqPrefixes [ 1 ] . add ( op . substring ( 0 , 2 ) ) ; } fOperatorSet . add ( op ) ; } for ( String kw : SVKeywords . getKeywords ( ) ) { if ( kw . endsWith ( "*" ) ) { kw = kw . substring ( 0 , kw . length ( ) - 1 ) ; } fKeywordSet . add ( kw ) ; } fEOF = false ; } public void addTokenListener ( ISVTokenListener l ) { fTokenListeners . add ( l ) ; } public void removeTokenListener ( ISVTokenListener l ) { fTokenListeners . remove ( l ) ; } public void setNewlineAsOperator ( boolean en ) { fNewlineAsOperator = en ; } public void setInAttr ( boolean in ) { fInAttr = in ; } public void init ( ISVParser parser , ITextScanner scanner ) { fTokenConsumed = true ; fScanner = scanner ; fEOF = false ; fParser = parser ; } public void init ( SVToken tok ) { fImage = tok . fImage ; fIsIdentifier = tok . fIsIdentifier ; fIsKeyword = tok . fIsKeyword ; fIsNumber = tok . fIsNumber ; fIsOperator = tok . fIsOperator ; fIsString = tok . fIsString ; fIsTime = tok . fIsTime ; fStartLocation = tok . fStartLocation . duplicate ( ) ; } public SVToken peekToken ( ) { peek ( ) ; return this . duplicate ( ) ; } public SVToken consumeToken ( ) { peek ( ) ; SVToken tok = this . duplicate ( ) ; eatToken ( ) ; return tok ; } public void ungetToken ( SVToken tok ) { if ( fDebugEn ) { debug ( "" + tok . getImage ( ) + "\"" ) ; } if ( ! fTokenConsumed ) { fUngetStack . push ( this . duplicate ( ) ) ; } fTokenConsumed = true ; if ( fCapture ) { if ( fCaptureBuffer . length ( ) >= tok . getImage ( ) . length ( ) ) { fCaptureBuffer . setLength ( fCaptureBuffer . length ( ) - tok . getImage ( ) . length ( ) ) ; } if ( fCaptureBuffer . length ( ) > 0 && fCaptureBuffer . charAt ( fCaptureBuffer . length ( ) - 1 ) == ' ' ) { fCaptureBuffer . setLength ( fCaptureBuffer . length ( ) - 1 ) ; } fCaptureLastToken = tok . duplicate ( ) ; } if ( fTokenListeners . size ( ) > 0 ) { for ( ISVTokenListener l : fTokenListeners ) { l . ungetToken ( tok ) ; } } fUngetStack . push ( tok ) ; peek ( ) ; if ( fDebugEn ) { debug ( "" + tok . getImage ( ) + "" + peek ( ) + "\"" ) ; } } public void ungetToken ( List < SVToken > tok_l ) { for ( int i = tok_l . size ( ) - 1 ; i >= 0 ; i -- ) { ungetToken ( tok_l . get ( i ) ) ; } } public String peek ( ) { if ( fTokenConsumed ) { if ( fEOF || ! next_token ( ) ) { fImage = null ; } if ( fDebugEn ) { debug ( "peek() -- \"" + fImage + "\" " + fEOF ) ; } } return fImage ; } public boolean isIdentifier ( ) { peek ( ) ; return fIsIdentifier ; } public boolean isNumber ( ) { peek ( ) ; return fIsNumber ; } public boolean isTime ( ) { peek ( ) ; return fIsTime ; } public boolean isKeyword ( ) { peek ( ) ; return fIsKeyword ; } public boolean isOperator ( ) { peek ( ) ; return fIsOperator ; } public boolean peekOperator ( String ... ops ) throws SVParseException { peek ( ) ; if ( fIsOperator ) { switch ( ops . length ) { case 0 : return true ; case 1 : return ( fImage . equals ( ops [ 0 ] ) ) ; case 2 : return ( fImage . equals ( ops [ 0 ] ) || fImage . equals ( ops [ 1 ] ) ) ; case 3 : return ( fImage . equals ( ops [ 0 ] ) || fImage . equals ( ops [ 1 ] ) || fImage . equals ( ops [ 2 ] ) ) ; case 4 : return ( fImage . equals ( ops [ 0 ] ) || fImage . equals ( ops [ 1 ] ) || fImage . equals ( ops [ 2 ] ) || fImage . equals ( ops [ 3 ] ) ) ; case 5 : return ( fImage . equals ( ops [ 0 ] ) || fImage . equals ( ops [ 1 ] ) || fImage . equals ( ops [ 2 ] ) || fImage . equals ( ops [ 3 ] ) || fImage . equals ( ops [ 4 ] ) ) ; case 6 : return ( fImage . equals ( ops [ 0 ] ) || fImage . equals ( ops [ 1 ] ) || fImage . equals ( ops [ 2 ] ) || fImage . equals ( ops [ 3 ] ) || fImage . equals ( ops [ 4 ] ) || fImage . equals ( ops [ 5 ] ) ) ; case 7 : return ( fImage . equals ( ops [ 0 ] ) || fImage . equals ( ops [ 1 ] ) || fImage . equals ( ops [ 2 ] ) || fImage . equals ( ops [ 3 ] ) || fImage . equals ( ops [ 4 ] ) || fImage . equals ( ops [ 5 ] ) || fImage . equals ( ops [ 6 | |
2,397 | <s> package org . rubypeople . rdt . internal . core . util ; import junit . framework . TestCase ; import org . jruby . ast . Node ; import org . rubypeople . rdt . internal . core . parser . ClosestNodeLocator ; import org . rubypeople . rdt . internal . core . parser . RubyParser ; public class ASTUtilTest extends TestCase { public void testNamespace ( ) { RubyParser parser = new RubyParser ( ) ; String src = "" + "" + "module M3n" + "" + "" + "" + "" + " endn" + " endn" + "endn" + "n" + "" + "ob" ; Node root = parser . parse ( src ) . getAST ( ) ; assertEquals ( "M3" , ASTUtil . getNamespace ( root , 82 ) ) ; assertEquals ( "M3" , ASTUtil . getNamespace ( root , 92 ) ) ; assertEquals ( "M3::Chris" , ASTUtil . getNamespace ( root , 93 ) ) ; assertEquals ( "M3::Chris" , ASTUtil . getNamespace ( root , 94 ) ) ; } public void testFullyQualifiedTypename ( ) { RubyParser parser = new RubyParser ( ) ; String src = "" + "" + "module M3n" + "" + "" + "" + "" + " endn" + " endn" + "endn" + "n" + "" + "ob" ; Node root = parser . parse ( src ) . getAST ( ) ; assertEquals ( "M3::Chris" , ASTUtil . getFullyQualifiedTypeName ( root , new ClosestNodeLocator ( ) | |
2,398 | <s> package com . asakusafw . testdriver . excel ; public enum RuleSheetFormat { FORMAT ( "Format" , 0 , 0 ) , TOTAL_CONDITION ( "-UNK-" , 1 , 0 ) , PROPERTY_NAME ( "-UNK-" , 2 , 0 ) , VALUE_CONDITION ( "-UNK-" , 2 , 1 ) , NULLITY_CONDITION ( "NULL-UNK-" , 2 , 2 | |
2,399 | <s> package org . springframework . samples . petclinic ; import javax . persistence . Basic ; import javax . persistence . Entity ; import javax . persistence . GeneratedValue ; import javax . persistence . GenerationType ; import javax . persistence . Id ; import javax . persistence . Table ; import org . hibernate . annotations . Index ; @ Entity @ Table ( name = "types" ) public class PetType implements NamedEntity { @ Id @ GeneratedValue ( strategy = GenerationType . IDENTITY ) private Integer id ; @ Override public void setId ( Integer id ) { this . id = id ; } @ Override public Integer getId ( ) |