idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
4,900
private AdvancedModelWrapper updateEOByUpdatedModel ( EDBModelObject reference , AdvancedModelWrapper model , Map < Object , AdvancedModelWrapper > updated ) { ModelDescription source = model . getModelDescription ( ) ; ModelDescription description = reference . getModelDescription ( ) ; AdvancedModelWrapper wrapper = ...
Updates an Engineering Object given as EDBObject based on the update on the given model which is referenced by the given Engineering Object .
157
27
4,901
private void enhanceCommitInserts ( EKBCommit commit ) throws EKBException { for ( OpenEngSBModel model : commit . getInserts ( ) ) { AdvancedModelWrapper simple = AdvancedModelWrapper . wrap ( model ) ; if ( simple . isEngineeringObject ( ) ) { performInsertEOLogic ( simple . toEngineeringObject ( ) ) ; } } }
Enhances the EKBCommit for the insertion of EngineeringObjects .
85
16
4,902
private void performInsertEOLogic ( EngineeringObjectModelWrapper model ) { for ( Field field : model . getForeignKeyFields ( ) ) { mergeEngineeringObjectWithReferencedModel ( field , model ) ; } }
Performs the logic for the enhancement needed to be performed to insert an Engineering Object into the EDB .
50
21
4,903
private AdvancedModelWrapper performMerge ( AdvancedModelWrapper source , AdvancedModelWrapper target ) { if ( source == null || target == null ) { return null ; } ModelDescription sourceDesc = source . getModelDescription ( ) ; ModelDescription targetDesc = target . getModelDescription ( ) ; Object transformResult = t...
Performs the merge from the source model to the target model and returns the result . Returns null if either the source or the target is null .
141
29
4,904
private void mergeEngineeringObjectWithReferencedModel ( Field field , EngineeringObjectModelWrapper model ) { AdvancedModelWrapper result = performMerge ( loadReferencedModel ( model , field ) , model ) ; if ( result != null ) { model = result . toEngineeringObject ( ) ; } }
Merges the given EngineeringObject with the referenced model which is defined in the given field .
67
18
4,905
public static < T > T createModel ( Class < T > model , List < OpenEngSBModelEntry > entries ) { if ( ! ModelWrapper . isModel ( model ) ) { throw new IllegalArgumentException ( "The given class is no model" ) ; } try { T instance = model . newInstance ( ) ; for ( OpenEngSBModelEntry entry : entries ) { if ( tryToSetVa...
Creates a model of the given type and uses the list of OpenEngSBModelEntries as initialization data .
234
23
4,906
private static boolean tryToSetValueThroughField ( OpenEngSBModelEntry entry , Object instance ) throws IllegalAccessException { try { Field field = instance . getClass ( ) . getDeclaredField ( entry . getKey ( ) ) ; field . setAccessible ( true ) ; field . set ( instance , entry . getValue ( ) ) ; field . setAccessibl...
Tries to set the value of an OpenEngSBModelEntry to its corresponding field of the model . Returns true if the field can be set returns false if not .
150
34
4,907
private static boolean tryToSetValueThroughSetter ( OpenEngSBModelEntry entry , Object instance ) throws IllegalAccessException { try { String setterName = getSetterName ( entry . getKey ( ) ) ; Method method = instance . getClass ( ) . getMethod ( setterName , entry . getType ( ) ) ; method . invoke ( instance , entry...
Tries to set the value of an OpenEngSBModelEntry to its corresponding setter of the model . Returns true if the setter can be called returns false if not .
190
36
4,908
public static DestinationUrl createDestinationUrl ( String destination ) { String [ ] split = splitDestination ( destination ) ; String host = split [ 0 ] . trim ( ) ; String jmsDestination = split [ 1 ] . trim ( ) ; return new DestinationUrl ( host , jmsDestination ) ; }
Creates an instance of an connection URL based on an destination string . In case that the destination string does not match the form HOST?QUEUE||TOPIC an IllegalArgumentException is thrown .
66
42
4,909
public static < K , V > Map < K , List < V > > group ( Collection < V > collection , Function < V , K > keyFn ) { Map < K , List < V > > map = new HashMap <> ( ) ; for ( V value : collection ) { K key = keyFn . apply ( value ) ; if ( map . get ( key ) == null ) { map . put ( key , new ArrayList < V > ( ) ) ; } map . ge...
Does a group by or map aggregation on a collection based on keys that are emitted by the given function . For each key emitted by the function the map will contain a list at that key entry containing at least one element from the collection .
120
47
4,910
public < T > JdbcIndex < T > buildIndex ( Class < T > model ) { JdbcIndex < T > index = new JdbcIndex <> ( ) ; index . setModelClass ( model ) ; index . setName ( indexNameTranslator . translate ( model ) ) ; index . setFields ( buildFields ( index ) ) ; return index ; }
Builds a JdbcIndex instance for the given model Class .
83
14
4,911
public static String extractAttributeValueNoEmptyCheck ( Entry entry , String attributeType ) { Attribute attribute = entry . get ( attributeType ) ; if ( attribute == null ) { return null ; } try { return attribute . getString ( ) ; } catch ( LdapInvalidAttributeValueException e ) { throw new LdapRuntimeException ( e ...
Returns the value of the attribute of attributeType from entry .
77
12
4,912
public void removeSimilarClassesFromFile1 ( ) throws IOException { logging . info ( "Start reding cs File" ) ; List < String > linescs1 = getFileLinesAsList ( csFile1 ) ; logging . info ( "Start reding cs File" ) ; List < String > linescs2 = getFileLinesAsList ( csFile2 ) ; logging . info ( "Search classes" ) ; List < ...
Removes similar classes in the first cs File
351
9
4,913
public List < String > replaceAbstractClasses ( List < String > lines ) { List < String > result = new LinkedList < String > ( ) ; for ( int i = 0 ; i < lines . size ( ) ; i ++ ) { result . add ( removeAbstract ( lines . get ( i ) ) ) ; } return result ; }
Searches for abstract classes and replace it by an interface .
73
13
4,914
private String getClassName ( String line ) { String result = line . substring ( line . indexOf ( CSHARP_CLASS_NAME ) + CSHARP_CLASS_NAME . length ( ) ) ; if ( result . contains ( "{" ) ) { result = result . substring ( 0 , result . indexOf ( "{" ) ) ; } if ( result . contains ( ":" ) ) { result = result . substring ( ...
Returns the Class name of a line
122
7
4,915
public List < String > getFileLinesAsList ( File f ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( new DataInputStream ( new FileInputStream ( f ) ) ) ) ; List < String > result = new LinkedList < String > ( ) ; String strLine ; while ( ( strLine = br . readLine ( ) ) != null ) {...
Reads a file and returns the content as List
106
10
4,916
public static void removeSimilaritiesAndSaveFiles ( List < String > filepathes , Log logging , Boolean isWindows ) throws IOException { List < File > files = new LinkedList < File > ( ) ; for ( String path : filepathes ) { files . add ( new File ( path ) ) ; } FileComparer fcomparer ; for ( int i = 0 ; i < files . size...
Removes all the similar parts from all the files
160
10
4,917
public static Filter getFilterForLocation ( Class < ? > clazz , String location , String context ) throws IllegalArgumentException { String filter = makeLocationFilterString ( location , context ) ; return FilterUtils . makeFilter ( clazz , filter ) ; }
returns a filter that matches services with the given class and location in both the given context and the root - context
55
23
4,918
public static Filter getFilterForLocation ( Class < ? > clazz , String location ) throws IllegalArgumentException { return getFilterForLocation ( clazz , location , ContextHolder . get ( ) . getCurrentContextId ( ) ) ; }
returns a filter that matches services with the given class and location in both the current context and the root - context
52
23
4,919
public static Filter getFilterForLocation ( String location , String context ) throws IllegalArgumentException { String filter = makeLocationFilterString ( location , context ) ; try { return FrameworkUtil . createFilter ( filter ) ; } catch ( InvalidSyntaxException e ) { throw new IllegalArgumentException ( "location ...
returns a filter that matches services with the given location in both the given context and the root - context
77
21
4,920
protected void checkInputSize ( List < Object > input ) throws TransformationOperationException { int inputCount = getOperationInputCount ( ) ; int inputSize = input . size ( ) ; if ( inputCount == - 2 ) { return ; } else if ( inputCount == - 1 && input . size ( ) < 1 ) { throw new TransformationOperationException ( "T...
Checks if the input size is matching with the operation defined input count . If not a TransformationOperationException is thrown .
126
24
4,921
protected String getParameterOrDefault ( Map < String , String > parameters , String paramName , String defaultValue ) throws TransformationOperationException { return getParameter ( parameters , paramName , false , defaultValue ) ; }
Get the parameter with the given parameter name from the parameter map . If the parameters does not contain such a parameter take the default value instead .
44
28
4,922
protected String getParameterOrException ( Map < String , String > parameters , String paramName ) throws TransformationOperationException { return getParameter ( parameters , paramName , true , null ) ; }
Get the parameter with the given parameter name from the parameter map . If the parameters does not contain such a parameter the function throws a TransformationOperationException .
39
30
4,923
private String getParameter ( Map < String , String > parameters , String paramName , boolean abortOnError , String defaultValue ) throws TransformationOperationException { String value = parameters . get ( paramName ) ; if ( value != null ) { return value ; } if ( abortOnError ) { String error = String . format ( "The...
Get a parameter from the parameter map . If abortOnError is true then a TransformationOperationException is thrown in case that the asked parameter does not exists . If this value is false the default value will be taken instead of throwing an exception .
136
48
4,924
protected Integer parseIntString ( String string , boolean abortOnError , int def ) throws TransformationOperationException { Integer integer = def ; if ( string == null ) { logger . debug ( "Given string is empty so the default value is taken." ) ; } try { integer = Integer . parseInt ( string ) ; } catch ( NumberForm...
Parses a string to an integer object . AbortOnError defines if the function should throw an exception if an error occurs during the parsing . If it doesn t abort the given default value is given back as result on error .
190
47
4,925
protected Matcher generateMatcher ( String regex , String valueString ) throws TransformationOperationException { if ( regex == null ) { throw new TransformationOperationException ( "No regex defined. The step will be skipped." ) ; } try { Pattern pattern = Pattern . compile ( regex ) ; return pattern . matcher ( value...
Generates a matcher for the given valueString with the given regular expression .
124
16
4,926
protected void configureJaxbMarshaller ( javax . xml . bind . Marshaller marshaller ) throws PropertyException { marshaller . setProperty ( javax . xml . bind . Marshaller . JAXB_FORMATTED_OUTPUT , m_formatOutput ) ; }
Configure a JAXB marshaller .
65
10
4,927
public Object getEntryValue ( JPAEntry entry ) { try { Class < ? > typeClass = loadClass ( entry . getType ( ) ) ; if ( typeClass == null ) { return entry . getValue ( ) ; } if ( typeClass == Character . class ) { if ( entry . getValue ( ) . length ( ) > 1 ) { LOGGER . warn ( "Too many chars in the string for a charact...
Tries to get the object value for a given JPAEntry . To instantiate the type first the static method valueOf of the type will be tried . If that didn t work then the constructor of the object with a string parameter is used . If that didn t work either the simple string will be set in the entry .
448
66
4,928
private Class < ? > loadClass ( String className ) { try { return EDBUtils . class . getClassLoader ( ) . loadClass ( className ) ; } catch ( ClassNotFoundException e ) { LOGGER . debug ( "Class {} can not be found by the EDB. This object type is not supported by the EDB." + " Maybe the conversion need to be done at mo...
Tries to load the class with the given name . Returns the class object if the class can be loaded . Returns null if the class could not be loaded .
97
32
4,929
private Object invokeValueOf ( Class < ? > clazz , String value ) throws IllegalAccessException , InvocationTargetException { try { return MethodUtils . invokeExactStaticMethod ( clazz , "valueOf" , value ) ; } catch ( NoSuchMethodException e ) { return null ; } }
Tries to invoke the method valueOf of the given class object . If this method can be called the result will be given back based on the given value which is used as parameter for the method . If this method can t be called null will be given back .
65
53
4,930
protected synchronized Expression getParsedExpression ( ) { if ( parsedExpression == null ) { try { parsedExpression = EXPRESSION_PARSER . parseExpression ( getExpression ( ) ) ; } catch ( ParseException e ) { throw new IllegalArgumentException ( "[" + getExpression ( ) + "] is not a valid SpEL expression" , e ) ; } } ...
Return a parsed SpEL expression .
92
7
4,931
public static VaadinConfirmDialog show ( final UI ui , final String windowCaption , final String message , final String okCaption , final String cancelCaption , final Runnable r ) { VaadinConfirmDialog d = getFactory ( ) . create ( windowCaption , message , okCaption , cancelCaption , null ) ; d . show ( ui , new Liste...
Shows a modal VaadinConfirmDialog in given window and executes Runnable if OK is chosen .
139
23
4,932
public final void show ( final UI ui , final Listener listener , final boolean modal ) { confirmListener = listener ; center ( ) ; setModal ( modal ) ; ui . addWindow ( this ) ; }
Show confirm dialog .
48
4
4,933
public EKBCommit addInsert ( Object insert ) { if ( insert != null ) { checkIfModel ( insert ) ; inserts . add ( ( OpenEngSBModel ) insert ) ; } return this ; }
Adds a model to the list of models which shall be inserted into the EDB . If the given object is not a model an IllegalArgumentException is thrown .
45
33
4,934
public EKBCommit addInserts ( Collection < ? > inserts ) { if ( inserts != null ) { for ( Object insert : inserts ) { checkIfModel ( insert ) ; this . inserts . add ( ( OpenEngSBModel ) insert ) ; } } return this ; }
Adds a collection of models which shall be inserted into the EDB . If one of the given objects is not a model an IllegalArgumentException is thrown .
60
32
4,935
public EKBCommit addUpdate ( Object update ) { if ( update != null ) { checkIfModel ( update ) ; updates . add ( ( OpenEngSBModel ) update ) ; } return this ; }
Adds a model to the list of models which shall be updated in the EDB . If the given object is not a model an IllegalArgumentException is thrown .
45
33
4,936
public EKBCommit addUpdates ( Collection < ? > updates ) { if ( updates != null ) { for ( Object update : updates ) { checkIfModel ( update ) ; this . updates . add ( ( OpenEngSBModel ) update ) ; } } return this ; }
Adds a collection of models which shall be updated in the EDB . If one of the given objects is not a model an IllegalArgumentException is thrown .
60
32
4,937
public EKBCommit addDelete ( Object delete ) { if ( delete != null ) { checkIfModel ( delete ) ; deletes . add ( ( OpenEngSBModel ) delete ) ; } return this ; }
Adds an model to the list of models which shall be deleted from the EDB . If the given object is not a model an IllegalArgumentException is thrown .
46
33
4,938
public EKBCommit addDeletes ( Collection < ? > deletes ) { if ( deletes != null ) { for ( Object delete : deletes ) { checkIfModel ( delete ) ; this . deletes . add ( ( OpenEngSBModel ) delete ) ; } } return this ; }
Adds a collection of models which shall be deleted from the EDB . If one of the given objects is not a model an IllegalArgumentException is thrown .
64
32
4,939
public Set < OWLClassExpression > getNestedClassExpressions ( ) { Set < OWLClassExpression > subConcepts = new HashSet < OWLClassExpression > ( ) ; for ( OWLAxiom ax : justification ) { subConcepts . addAll ( ax . getNestedClassExpressions ( ) ) ; } return subConcepts ; }
Gets the sub - concepts that appear in the axioms in this explanation
83
16
4,940
public static void store ( Explanation < OWLAxiom > explanation , OutputStream os ) throws IOException { try { OWLOntologyManager manager = OWLManager . createOWLOntologyManager ( ) ; OWLOntology ontology = manager . createOntology ( explanation . getAxioms ( ) ) ; OWLDataFactory df = manager . getOWLDataFactory ( ) ; ...
Stores the specified explanation to the specified output stream
299
10
4,941
public static Explanation < OWLAxiom > load ( InputStream is ) throws IOException { try { OWLOntologyManager manager = OWLManager . createOWLOntologyManager ( ) ; OWLOntology ontology = manager . loadOntologyFromOntologyDocument ( new BufferedInputStream ( is ) ) ; OWLDataFactory df = manager . getOWLDataFactory ( ) ; ...
Loads a previously stored explanation from the specified input stream
311
11
4,942
public static boolean hasAnnotation ( CtClass clazz , String annotationName ) { ClassFile cf = clazz . getClassFile2 ( ) ; AnnotationsAttribute ainfo = ( AnnotationsAttribute ) cf . getAttribute ( AnnotationsAttribute . invisibleTag ) ; AnnotationsAttribute ainfo2 = ( AnnotationsAttribute ) cf . getAttribute ( Annotati...
Returns true if the given class has an annotation set with the given name returns false otherwise .
91
18
4,943
public static boolean hasAnnotation ( CtField field , String annotationName ) { FieldInfo info = field . getFieldInfo ( ) ; AnnotationsAttribute ainfo = ( AnnotationsAttribute ) info . getAttribute ( AnnotationsAttribute . invisibleTag ) ; AnnotationsAttribute ainfo2 = ( AnnotationsAttribute ) info . getAttribute ( Ann...
Returns true if the given field has an annotation set with the given name returns false otherwise .
88
18
4,944
private static boolean checkAnnotation ( AnnotationsAttribute invisible , AnnotationsAttribute visible , String annotationName ) { boolean exist1 = false ; boolean exist2 = false ; if ( invisible != null ) { exist1 = invisible . getAnnotation ( annotationName ) != null ; } if ( visible != null ) { exist2 = visible . ge...
Checks if an annotation with the given name is either in the invisible or in the visible annotation attributes .
86
21
4,945
private void checkBounds ( String source , Integer from , Integer to ) throws TransformationOperationException { Integer length = source . length ( ) ; if ( from > to ) { throw new TransformationOperationException ( "The from parameter is bigger than the to parameter" ) ; } if ( from < 0 || from > length ) { throw new ...
Checks if the from and the to parameters are valid for the given source
125
15
4,946
private Integer getFromParameter ( Map < String , String > parameters ) throws TransformationOperationException { return getSubStringParameter ( parameters , fromParam , 0 ) ; }
Get the from parameter from the parameters . If the parameter is not set 0 is taken instead .
34
19
4,947
private Integer getToParameter ( Map < String , String > parameters , Integer defaultValue ) throws TransformationOperationException { return getSubStringParameter ( parameters , toParam , defaultValue ) ; }
Get the to parameter from the parameters . If the parameter is not set the defaultValue is taken instead .
39
21
4,948
private Integer getSubStringParameter ( Map < String , String > parameters , String parameterName , Integer defaultValue ) throws TransformationOperationException { String parameter = parameters . get ( parameterName ) ; if ( parameter == null ) { getLogger ( ) . debug ( "The {} parameter is not set, so the default val...
Returns the substring parameter with the given parameter or the given default value if the parameter name is not set .
127
22
4,949
@ Override public void storeAll ( Map mapEntries ) { int batchSize = getBatchSize ( ) ; if ( batchSize == 0 || mapEntries . size ( ) < batchSize ) { storeBatch ( mapEntries ) ; } else { Map batch = new HashMap ( batchSize ) ; while ( ! mapEntries . isEmpty ( ) ) { Iterator iter = mapEntries . entrySet ( ) . iterator ( ...
Persist all entries from the specified map into the data store .
188
13
4,950
private static < E > List < OWLAxiom > getOrderedJustifications ( List < OWLAxiom > mups , final Set < Explanation < E > > allJustifications ) { Comparator < OWLAxiom > mupsComparator = new Comparator < OWLAxiom > ( ) { public int compare ( OWLAxiom o1 , OWLAxiom o2 ) { // The checker that appears in most MUPS has the ...
Orders the axioms in a single MUPS by the frequency of which they appear in all MUPS .
167
23
4,951
private static < E > int getOccurrences ( OWLAxiom ax , Set < Explanation < E > > axiomSets ) { int count = 0 ; for ( Explanation < E > explanation : axiomSets ) { if ( explanation . getAxioms ( ) . contains ( ax ) ) { count ++ ; } } return count ; }
Given an checker and a set of explanations this method determines how many explanations contain the checker .
77
20
4,952
protected void onMissingTypeVisit ( Table table , IndexField < ? > field ) { if ( ! Introspector . isModelClass ( field . getType ( ) ) ) { return ; } Field idField = Introspector . getOpenEngSBModelIdField ( field . getType ( ) ) ; if ( idField == null ) { LOG . warn ( "@Model class {} does not have an @OpenEngSBModel...
Called when type map returns null .
240
8
4,953
public Column set ( Option option , boolean set ) { if ( set ) { options . add ( option ) ; } else { options . remove ( option ) ; } return this ; }
Sets or unsets the given option for this column according to the set flag given .
38
18
4,954
public void setStart ( int x1 , int y1 ) { start . x = x1 ; start . y = y1 ; needsRefresh = true ; }
Sets the start point .
35
6
4,955
public void setEnd ( int x2 , int y2 ) { end . x = x2 ; end . y = y2 ; needsRefresh = true ; }
Sets the end point .
35
6
4,956
public void draw ( Graphics2D g ) { if ( needsRefresh ) refreshCurve ( ) ; g . draw ( curve ) ; // Draws the main part of the arrow. drawArrow ( g , end , control ) ; // Draws the arrow head. drawText ( g ) ; }
Draws the arrow on the indicated graphics environment .
64
10
4,957
public void drawHighlight ( Graphics2D g ) { if ( needsRefresh ) refreshCurve ( ) ; Graphics2D g2 = ( Graphics2D ) g . create ( ) ; g2 . setStroke ( new java . awt . BasicStroke ( 6.0f ) ) ; g2 . setColor ( HIGHLIGHT_COLOR ) ; g2 . draw ( curve ) ; g2 . transform ( affineToText ) ; g2 . fill ( bounds ) ; g2 . dispose (...
Draws a highlight of the curve .
116
8
4,958
public void setLabel ( String label ) { this . label = label ; // if (GRAPHICS == null) return; bounds = METRICS . getStringBounds ( getLabel ( ) , GRAPHICS ) ; boolean upsideDown = end . x < start . x ; float dx = ( float ) bounds . getWidth ( ) / 2.0f ; float dy = ( curvy < 0.0f ) ^ upsideDown ? METRICS . getAscent (...
Sets the label that will be drawn on the high arc point .
166
14
4,959
private void drawArrow ( Graphics g , Point head , Point away ) { int endX , endY ; double angle = Math . atan2 ( ( double ) ( away . x - head . x ) , ( double ) ( away . y - head . y ) ) ; angle += ARROW_ANGLE ; endX = ( ( int ) ( Math . sin ( angle ) * ARROW_LENGTH ) ) + head . x ; endY = ( ( int ) ( Math . cos ( ang...
Draws an arrow head on the graphics object . The arrow geometry is based on the point of its head as well as another point which the arrow is defined as facing away from . This arrow head has no body .
232
43
4,960
public void refreshCurve ( ) { // System.out.println("Curve refreshing"); needsRefresh = false ; double lengthx = end . x - start . x ; double lengthy = end . y - start . y ; double centerx = ( ( double ) ( start . x + end . x ) ) / 2.0 ; double centery = ( ( double ) ( start . y + end . y ) ) / 2.0 ; double length = M...
Refreshes the curve object .
359
7
4,961
public Rectangle2D getBounds ( ) { if ( needsRefresh ) refreshCurve ( ) ; Rectangle2D b = curve . getBounds ( ) ; Area area = new Area ( bounds ) ; area . transform ( affineToText ) ; b . add ( area . getBounds ( ) ) ; return b ; }
Returns the bounds .
73
4
4,962
private boolean intersects ( Point point , int fudge , QuadCurve2D . Float c ) { if ( ! c . intersects ( point . x - fudge , point . y - fudge , fudge << 1 , fudge << 1 ) ) return false ; if ( c . getFlatness ( ) < fudge ) return true ; QuadCurve2D . Float f1 = new QuadCurve2D . Float ( ) , f2 = new QuadCurve2D . Float...
Checks if something is on the line . If it appears to be then it subdivides the curve into halves and tries again recursively until the flatness of the curve is less than the fudge . Frankly I am a fucking genius . I am one of two people in this department that could have possibly thought of this .
148
67
4,963
public HashMap < Variable , Object > chooseValues ( ) { MultiVariable mv = ( MultiVariable ) myVariable ; Variable [ ] internalVars = mv . getInternalVariables ( ) ; HashMap < Variable , Object > values = new HashMap < Variable , Object > ( ) ; for ( Variable v : internalVars ) { if ( v instanceof MultiVariable ) { Mul...
Chooses values for all internal domains according to their own value choice functions .
192
15
4,964
public Rectangle getMinRectabgle ( ) { return new Rectangle ( ( int ) xLB . min , ( int ) yLB . min , ( int ) ( xUB . min - xLB . min ) , ( int ) ( yUB . min - yLB . min ) ) ; }
give min rectangle
65
3
4,965
public Rectangle getMaxRectabgle ( ) { return new Rectangle ( ( int ) xLB . max , ( int ) yLB . max , ( int ) ( xUB . max - xLB . max ) , ( int ) ( yUB . max - yLB . max ) ) ; }
give max rectangle
65
3
4,966
private boolean setLocation ( String global , String context , Map < String , Object > properties ) { String locationKey = "location." + context ; Object propvalue = properties . get ( locationKey ) ; if ( propvalue == null ) { properties . put ( locationKey , global ) ; } else if ( propvalue . getClass ( ) . isArray (...
returns true if location is not already set in the properties otherwise false
219
14
4,967
@ SuppressWarnings ( { "unchecked" } ) @ Override public Map processAll ( Set setEntries ) { Map results = new LiteMap ( ) ; for ( BinaryEntry entry : ( Set < BinaryEntry > ) setEntries ) { Object result = processEntry ( entry ) ; if ( result != NO_RESULT ) { results . put ( entry . getKey ( ) , result ) ; } } return r...
Process all entries in the specified set .
94
8
4,968
protected Object processEntry ( BinaryEntry entry ) { Binary binCurrent = entry . getBinaryValue ( ) ; if ( binCurrent == null && ! fAllowInsert ) { return fReturn ? null : NO_RESULT ; } PofValue pvCurrent = getPofValue ( binCurrent ) ; PofValue pvNew = getPofValue ( "newValue" ) ; Integer versionCurrent = ( Integer ) ...
Process the specified entry .
177
5
4,969
public static byte [ ] enhanceModel ( byte [ ] byteCode , ClassLoader ... loaders ) throws IOException , CannotCompileException { return enhanceModel ( byteCode , new Version ( "1.0.0" ) , loaders ) ; }
Try to enhance the object defined by the given byte code . Returns the enhanced class or null if the given class is no model as byte array . The version of the model will be set statical to 1 . 0 . 0 . There may be class loaders appended if needed .
53
57
4,970
public static byte [ ] enhanceModel ( byte [ ] byteCode , Version modelVersion , ClassLoader ... loaders ) throws IOException , CannotCompileException { CtClass cc = doModelModifications ( byteCode , modelVersion , loaders ) ; if ( cc == null ) { return null ; } byte [ ] newClass = cc . toBytecode ( ) ; cc . defrost ( ...
Try to enhance the object defined by the given byte code . Returns the enhanced class or null if the given class is no model as byte array . There may be class loaders appended if needed .
95
40
4,971
private static CtClass doModelModifications ( byte [ ] byteCode , Version modelVersion , ClassLoader ... loaders ) { if ( ! initiated ) { initiate ( ) ; } CtClass cc = null ; LoaderClassPath [ ] classloaders = new LoaderClassPath [ loaders . length ] ; try { InputStream stream = new ByteArrayInputStream ( byteCode ) ; ...
Try to perform the actual model enhancing .
424
8
4,972
private static void doEnhancement ( CtClass cc , Version modelVersion ) throws CannotCompileException , NotFoundException , ClassNotFoundException { CtClass inter = cp . get ( OpenEngSBModel . class . getName ( ) ) ; cc . addInterface ( inter ) ; addFields ( cc ) ; addGetOpenEngSBModelTail ( cc ) ; addSetOpenEngSBModel...
Does the steps for the model enhancement .
213
8
4,973
private static void addFields ( CtClass clazz ) throws CannotCompileException , NotFoundException { CtField tail = CtField . make ( String . format ( "private Map %s = new HashMap();" , TAIL_FIELD ) , clazz ) ; clazz . addField ( tail ) ; String loggerDefinition = "private static final Logger %s = LoggerFactory.getLogg...
Adds the fields for the model tail and the logger to the class .
141
14
4,974
private static void addGetOpenEngSBModelTail ( CtClass clazz ) throws CannotCompileException , NotFoundException { CtClass [ ] params = generateClassField ( ) ; CtMethod method = new CtMethod ( cp . get ( List . class . getName ( ) ) , "getOpenEngSBModelTail" , params , clazz ) ; StringBuilder body = new StringBuilder ...
Adds the getOpenEngSBModelTail method to the class .
163
14
4,975
private static void addSetOpenEngSBModelTail ( CtClass clazz ) throws CannotCompileException , NotFoundException { CtClass [ ] params = generateClassField ( List . class ) ; CtMethod method = new CtMethod ( CtClass . voidType , "setOpenEngSBModelTail" , params , clazz ) ; StringBuilder builder = new StringBuilder ( ) ;...
Adds the setOpenEngSBModelTail method to the class .
217
14
4,976
private static void addRetrieveModelName ( CtClass clazz ) throws CannotCompileException , NotFoundException { CtClass [ ] params = generateClassField ( ) ; CtMethod method = new CtMethod ( cp . get ( String . class . getName ( ) ) , "retrieveModelName" , params , clazz ) ; StringBuilder builder = new StringBuilder ( )...
Adds the retreiveModelName method to the class .
151
12
4,977
private static void addRetrieveInternalModelId ( CtClass clazz ) throws NotFoundException , CannotCompileException { CtField modelIdField = null ; CtClass temp = clazz ; while ( temp != null ) { for ( CtField field : temp . getDeclaredFields ( ) ) { if ( JavassistUtils . hasAnnotation ( field , OpenEngSBModelId . class...
Adds the retrieveInternalModelId method to the class .
411
11
4,978
private static void addRetrieveInternalModelTimestamp ( CtClass clazz ) throws NotFoundException , CannotCompileException { CtClass [ ] params = generateClassField ( ) ; CtMethod method = new CtMethod ( cp . get ( Long . class . getName ( ) ) , "retrieveInternalModelTimestamp" , params , clazz ) ; StringBuilder builder...
Adds the retrieveInternalModelTimestamp method to the class .
188
12
4,979
private static void addRetrieveInternalModelVersion ( CtClass clazz ) throws NotFoundException , CannotCompileException { CtClass [ ] params = generateClassField ( ) ; CtMethod method = new CtMethod ( cp . get ( Integer . class . getName ( ) ) , "retrieveInternalModelVersion" , params , clazz ) ; StringBuilder builder ...
Adds the retrieveInternalModelVersion method to the class .
182
11
4,980
private static void addToOpenEngSBModelValues ( CtClass clazz ) throws NotFoundException , CannotCompileException , ClassNotFoundException { StringBuilder builder = new StringBuilder ( ) ; CtClass [ ] params = generateClassField ( ) ; CtMethod m = new CtMethod ( cp . get ( List . class . getName ( ) ) , "toOpenEngSBMod...
Adds the toOpenEngSBModelValues method to the class .
188
13
4,981
private static void addToOpenEngSBModelEntries ( CtClass clazz ) throws NotFoundException , CannotCompileException , ClassNotFoundException { CtClass [ ] params = generateClassField ( ) ; CtMethod m = new CtMethod ( cp . get ( List . class . getName ( ) ) , "toOpenEngSBModelEntries" , params , clazz ) ; StringBuilder b...
Adds the getOpenEngSBModelEntries method to the class .
212
14
4,982
private static String createModelEntryList ( CtClass clazz ) throws NotFoundException , CannotCompileException { StringBuilder builder = new StringBuilder ( ) ; CtClass tempClass = clazz ; while ( tempClass != null ) { for ( CtField field : tempClass . getDeclaredFields ( ) ) { String property = field . getName ( ) ; i...
Generates the list of OpenEngSBModelEntries which need to be added . Also adds the entries of the super classes .
194
26
4,983
private static String handleField ( CtField field , CtClass clazz ) throws NotFoundException , CannotCompileException { StringBuilder builder = new StringBuilder ( ) ; CtClass fieldType = field . getType ( ) ; String property = field . getName ( ) ; if ( fieldType . equals ( cp . get ( File . class . getName ( ) ) ) ) ...
Analyzes the given field and add logic based on the type of the field .
374
16
4,984
private static String handleFileField ( String property , CtClass clazz ) throws NotFoundException , CannotCompileException { String wrapperName = property + "wrapper" ; StringBuilder builder = new StringBuilder ( ) ; builder . append ( createTrace ( String . format ( "Handle File type property '%s'" , property ) ) ) ....
Creates the logic which is needed to handle fields which are File types since they need special treatment .
259
20
4,985
private static CtMethod getFieldGetter ( CtField field , CtClass clazz ) throws NotFoundException { if ( field == null ) { return null ; } return getFieldGetter ( field , clazz , false ) ; }
Returns the getter to a given field of the given class object and returns null if there is no getter for the given field defined .
49
28
4,986
private static CtMethod getFieldGetter ( CtField field , CtClass clazz , boolean failover ) throws NotFoundException { CtMethod method = new CtMethod ( field . getType ( ) , "descCreateMethod" , new CtClass [ ] { } , clazz ) ; String desc = method . getSignature ( ) ; String getter = getPropertyGetter ( field , failove...
Returns the getter method in case it exists or returns null if this is not the case . The failover parameter is needed to deal with boolean types since it should be allowed to allow getters in the form of isXXX or getXXX .
189
49
4,987
private static String getPropertyGetter ( CtField field , boolean failover ) throws NotFoundException { String property = field . getName ( ) ; if ( ! failover && isBooleanType ( field ) ) { return String . format ( "is%s%s" , Character . toUpperCase ( property . charAt ( 0 ) ) , property . substring ( 1 ) ) ; } else {...
Returns the name of the corresponding getter to a properties name and type . The failover is needed to support both getter name types for boolean properties .
127
31
4,988
private static CtClass [ ] generateClassField ( Class < ? > ... classes ) throws NotFoundException { CtClass [ ] result = new CtClass [ classes . length ] ; for ( int i = 0 ; i < classes . length ; i ++ ) { result [ i ] = cp . get ( classes [ i ] . getName ( ) ) ; } return result ; }
Generates a CtClass field out of a Class field .
79
12
4,989
private static void addFileFunction ( CtClass clazz , String property ) throws NotFoundException , CannotCompileException { String wrapperName = property + "wrapper" ; String funcName = "set" ; funcName = funcName + Character . toUpperCase ( wrapperName . charAt ( 0 ) ) ; funcName = funcName + wrapperName . substring (...
Adds the functionality that the models can handle File objects themselves .
211
12
4,990
private static String urlEncodeParameter ( String parameter ) { try { return URLEncoder . encode ( parameter , "UTF-8" ) ; } catch ( UnsupportedEncodingException ex ) { log . warn ( "Could not encode parameter." , ex ) ; } return parameter ; }
URLEncodes the given Parameter in UTF - 8
61
12
4,991
public static void runWithContext ( Runnable r ) { try { browserStack . push ( SwingFrame . getActiveWindow ( ) . getVisibleTab ( ) ) ; Subject . setCurrent ( SwingFrame . getActiveWindow ( ) . getSubject ( ) ) ; r . run ( ) ; } finally { Subject . setCurrent ( null ) ; browserStack . pop ( ) ; } }
As the current subject can be different for each Swing Window this method ensure that no wrong subject stays as current subject
83
22
4,992
protected Reader createResourceReader ( Resource resource ) { try { return new InputStreamReader ( resource . getInputStream ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
Create a reader for the specified resource .
45
8
4,993
public void shutdown ( ) { ClassLoader origClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { ClassLoader orientClassLoader = OIndexes . class . getClassLoader ( ) ; Thread . currentThread ( ) . setContextClassLoader ( orientClassLoader ) ; graph . close ( ) ; } finally { Thread . currentThrea...
Shuts down the graph database
91
6
4,994
public void cleanDatabase ( ) { lockingMechanism . writeLock ( ) . lock ( ) ; try { for ( ODocument edge : graph . browseEdges ( ) ) { edge . delete ( ) ; } for ( ODocument node : graph . browseVertices ( ) ) { node . delete ( ) ; } } finally { lockingMechanism . writeLock ( ) . unlock ( ) ; } }
Deletes all edges and nodes from the graph database . This method is used in the tests to have at every test the same start situation .
84
28
4,995
private void checkTransformationDescriptionId ( TransformationDescription description ) { if ( description . getId ( ) == null ) { description . setId ( "EKBInternal-" + counter . incrementAndGet ( ) ) ; } }
Tests if a transformation description has an id and adds an unique id if it hasn t one .
47
20
4,996
private List < ODocument > getEdgesBetweenModels ( String source , String target ) { ODocument from = getModel ( source ) ; ODocument to = getModel ( target ) ; String query = "select from E where out = ? AND in = ?" ; return graph . query ( new OSQLSynchQuery < ODocument > ( query ) , from , to ) ; }
Returns all edges which start at the source model and end in the target model .
83
16
4,997
private List < ODocument > getNeighborsOfModel ( String model ) { String query = String . format ( "select from Models where in.out.%s in [?]" , OGraphDatabase . LABEL ) ; List < ODocument > neighbors = graph . query ( new OSQLSynchQuery < ODocument > ( query ) , model ) ; return neighbors ; }
Returns all neighbors of a model .
81
7
4,998
private ODocument getOrCreateModel ( String model ) { ODocument node = getModel ( model ) ; if ( node == null ) { node = graph . createVertex ( "Models" ) ; OrientModelGraphUtils . setIdFieldValue ( node , model . toString ( ) ) ; OrientModelGraphUtils . setActiveFieldValue ( node , false ) ; node . save ( ) ; } return...
Returns the model with the given name or creates one if it isn t existing until then and returns the new one .
91
23
4,999
private ODocument getModel ( String model ) { String query = String . format ( "select from Models where %s = ?" , OGraphDatabase . LABEL ) ; List < ODocument > from = graph . query ( new OSQLSynchQuery < ODocument > ( query ) , model ) ; if ( from . size ( ) > 0 ) { return from . get ( 0 ) ; } else { return null ; } }
Returns the model with the given name .
93
8