idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
6,000
private ProxyType extendedProxyTypeAsProxyType ( ExtendedProxyType pt ) { switch ( pt ) { case DRAFT_RFC : return ProxyType . DRAFT_RFC ; case LEGACY : return ProxyType . LEGACY ; case RFC3820 : return ProxyType . RFC3820 ; default : return null ; } }
Why we have to do this nonsense?
67
8
6,001
@ Pure @ SuppressWarnings ( "checkstyle:magicnumber" ) public static String encodeBase26 ( int number ) { final StringBuilder value = new StringBuilder ( ) ; int code = number ; do { final int rest = code % 26 ; value . insert ( 0 , ( char ) ( ' ' + rest ) ) ; code = code / 26 - 1 ; } while ( code >= 0 ) ; return value...
Replies a base 26 encoding string for the given number .
96
12
6,002
@ Pure @ SuppressWarnings ( "checkstyle:npathcomplexity" ) public static Map < Character , String > getJavaToHTMLTranslationTable ( ) { Map < Character , String > map = null ; try { LOCK . lock ( ) ; if ( javaToHtmlTransTbl != null ) { map = javaToHtmlTransTbl . get ( ) ; } } finally { LOCK . unlock ( ) ; } if ( map !=...
Replies the java - to - html s translation table .
403
12
6,003
@ Pure @ SuppressWarnings ( "checkstyle:magicnumber" ) public static String parseHTML ( String html ) { if ( html == null ) { return null ; } final Map < String , Integer > transTbl = getHtmlToJavaTranslationTable ( ) ; assert transTbl != null ; if ( transTbl . isEmpty ( ) ) { return html ; } final Pattern pattern = Pa...
Parse the given HTML text and replace all the HTML entities by the corresponding unicode character .
432
19
6,004
@ Pure public static String toHTML ( String text ) { if ( text == null ) { return null ; } final Map < Character , String > transTbl = getJavaToHTMLTranslationTable ( ) ; assert transTbl != null ; if ( transTbl . isEmpty ( ) ) { return text ; } final StringBuilder patternStr = new StringBuilder ( ) ; for ( final Charac...
Translate all the special character from the given text to their equivalent HTML entities .
390
16
6,005
public static void cutStringAsArray ( String text , CutStringCritera critera , List < String > output ) { cutStringAlgo ( text , critera , new CutStringToArray ( output ) ) ; }
Format the text to be sure that each line is not more longer than the specified critera .
46
19
6,006
@ Pure public static char getMnemonicChar ( String text ) { if ( text != null ) { final int pos = text . indexOf ( ' ' ) ; if ( ( pos != - 1 ) && ( pos < text . length ( ) - 1 ) ) { return text . charAt ( pos + 1 ) ; } } return ' ' ; }
Replies the character which follow the first &amp ; .
75
12
6,007
@ Pure public static String removeMnemonicChar ( String text ) { if ( text == null ) { return text ; } return text . replaceFirst ( "&" , "" ) ; //$NON-NLS-1$ //$NON-NLS-2$ }
Remove the mnemonic char from the specified string .
60
11
6,008
@ Pure @ SuppressWarnings ( "checkstyle:npathcomplexity" ) public static Map < Character , String > getAccentTranslationTable ( ) { Map < Character , String > map = null ; try { LOCK . lock ( ) ; if ( accentTransTbl != null ) { map = accentTransTbl . get ( ) ; } } finally { LOCK . unlock ( ) ; } if ( map != null ) { re...
Replies the accent s translation table .
338
8
6,009
@ Pure public static String removeAccents ( String text ) { final Map < Character , String > map = getAccentTranslationTable ( ) ; if ( ( map == null ) || ( map . isEmpty ( ) ) ) { return text ; } return removeAccents ( text , map ) ; }
Remove the accents inside the specified string .
63
8
6,010
@ Pure public static String [ ] split ( char leftSeparator , char rightSeparator , String str ) { final SplitSeparatorToArrayAlgorithm algo = new SplitSeparatorToArrayAlgorithm ( ) ; splitSeparatorAlgorithm ( leftSeparator , rightSeparator , str , algo ) ; return algo . toArray ( ) ; }
Split the given string according to the separators . The separators are used to delimit the groups of characters .
82
23
6,011
@ Pure public static < T > String join ( char leftSeparator , char rightSeparator , @ SuppressWarnings ( "unchecked" ) T ... strs ) { final StringBuilder buffer = new StringBuilder ( ) ; for ( final Object s : strs ) { buffer . append ( leftSeparator ) ; if ( s != null ) { buffer . append ( s . toString ( ) ) ; } buffe...
Merge the given strings with to separators . The separators are used to delimit the groups of characters .
111
23
6,012
@ Pure public static String toUpperCaseWithoutAccent ( String text , Map < Character , String > map ) { final StringBuilder buffer = new StringBuilder ( ) ; for ( final char c : text . toCharArray ( ) ) { final String trans = map . get ( c ) ; if ( trans != null ) { buffer . append ( trans . toUpperCase ( ) ) ; } else ...
Translate the specified string to upper case and remove the accents .
112
13
6,013
@ Pure public static String formatDouble ( double amount , int decimalCount ) { final int dc = ( decimalCount < 0 ) ? 0 : decimalCount ; final StringBuilder str = new StringBuilder ( "#0" ) ; //$NON-NLS-1$ if ( dc > 0 ) { str . append ( ' ' ) ; for ( int i = 0 ; i < dc ; ++ i ) { str . append ( ' ' ) ; } } final Decima...
Format the given double value .
124
6
6,014
public static int getLevenshteinDistance ( String firstString , String secondString ) { final String s0 = firstString == null ? "" : firstString ; //$NON-NLS-1$ final String s1 = secondString == null ? "" : secondString ; //$NON-NLS-1$ final int len0 = s0 . length ( ) + 1 ; final int len1 = s1 . length ( ) + 1 ; // the...
Compute the Levenshstein distance between two strings .
403
12
6,015
@ Pure public static String toJavaString ( String text ) { final StringEscaper escaper = new StringEscaper ( ) ; return escaper . escape ( text ) ; }
Translate the given string to its Java string equivalent . All the special characters will be escaped . The enclosing double quote characters are not added .
37
29
6,016
@ Pure public static String toJsonString ( String text ) { final StringEscaper escaper = new StringEscaper ( StringEscaper . JAVA_ESCAPE_CHAR , StringEscaper . JAVA_STRING_CHAR , StringEscaper . JAVA_ESCAPE_CHAR , StringEscaper . JSON_SPECIAL_ESCAPED_CHAR ) ; return escaper . escape ( text ) ; }
Translate the given string to its Json string equivalent . All the special characters will be escaped . The enclosing double quote characters are not added .
93
30
6,017
public static VariableDecls extend ( Binder binder ) { return new VariableDecls ( io . bootique . BQCoreModule . extend ( binder ) ) ; }
Create an extended from the given binder .
37
9
6,018
public VariableDecls declareVar ( String bootiqueVariable ) { this . extender . declareVar ( bootiqueVariable , VariableNames . toEnvironmentVariableName ( bootiqueVariable ) ) ; return this ; }
Declare an environment variable which is linked to the given Bootique variable and has its name defined from the name of the Bootique variable .
43
28
6,019
protected void initializeElements ( ) { final BusItinerary itinerary = getBusItinerary ( ) ; if ( itinerary != null ) { int i = 0 ; for ( final BusItineraryHalt halt : itinerary . busHalts ( ) ) { onBusItineraryHaltAdded ( halt , i , null ) ; ++ i ; } } }
Run the initialization of the elements from the current bus itinerary .
80
13
6,020
@ Pure @ SuppressWarnings ( "unchecked" ) protected static < VALUET > VALUET maskNull ( VALUET value ) { return ( value == null ) ? ( VALUET ) NULL_VALUE : value ; }
Mask the null values given by the used of this map .
52
12
6,021
@ Pure protected static < VALUET > VALUET unmaskNull ( VALUET value ) { return ( value == NULL_VALUE ) ? null : value ; }
Unmask the null values given by the used of this map .
36
13
6,022
@ SuppressWarnings ( "unchecked" ) static < T > T [ ] finishToArray ( T [ ] array , Iterator < ? > it ) { T [ ] rp = array ; int i = rp . length ; while ( it . hasNext ( ) ) { final int cap = rp . length ; if ( i == cap ) { int newCap = ( ( cap / 2 ) + 1 ) * 3 ; if ( newCap <= cap ) { // integer overflow if ( cap == In...
Reallocates the array being used within toArray when the iterator returned more elements than expected and finishes filling it from the iterator .
201
26
6,023
protected final ReferencableValue < K , V > makeValue ( K key , V value ) { return makeValue ( key , value , this . queue ) ; }
Create a storage object that permits to put the specified elements inside this map .
36
15
6,024
@ Pure public static String getFirstFreeBusItineraryName ( BusLine busline ) { if ( busline == null ) { return null ; } int nb = busline . getBusItineraryCount ( ) ; String name ; do { ++ nb ; name = Locale . getString ( "NAME_TEMPLATE" , Integer . toString ( nb ) ) ; //$NON-NLS-1$ } while ( busline . getBusItinerary (...
Replies a bus itinerary name that was not exist in the specified bus line .
116
17
6,025
public void invert ( ) { final boolean isEventFirable = isEventFirable ( ) ; setEventFirable ( false ) ; try { final int count = this . roadSegments . getRoadSegmentCount ( ) ; // Invert the segments this . roadSegments . invert ( ) ; // Invert the bus halts and their indexes. final int middle = this . validHalts . siz...
Invert the order of this itinerary .
418
9
6,026
@ Pure public boolean hasBusHaltOnSegment ( RoadSegment segment ) { if ( this . roadSegments . isEmpty ( ) || this . validHalts . isEmpty ( ) ) { return false ; } int cIdxSegment ; int lIdxSegment = - 1 ; RoadSegment cSegment ; for ( final BusItineraryHalt bushalt : this . validHalts ) { cIdxSegment = bushalt . getRoad...
Replies if the given segment has a bus halt on it .
204
13
6,027
@ Pure public List < BusItineraryHalt > getBusHaltsOnSegment ( RoadSegment segment ) { if ( this . roadSegments . isEmpty ( ) || this . validHalts . isEmpty ( ) ) { return Collections . emptyList ( ) ; } int cIdxSegment ; int lIdxSegment = - 1 ; int sIdxSegment = - 1 ; RoadSegment cSegment ; final List < BusItineraryHa...
Replies the bus halts on the given segment .
310
11
6,028
@ Pure public Map < BusItineraryHalt , Pair < Integer , Double > > getBusHaltBinding ( ) { final Comparator < BusItineraryHalt > comp = ( elt1 , elt2 ) -> { if ( elt1 == elt2 ) { return 0 ; } if ( elt1 == null ) { return - 1 ; } if ( elt2 == null ) { return 1 ; } return elt1 . getName ( ) . compareTo ( elt2 . getName (...
Replies the binding informations for all the bus halts of this itinerary .
209
17
6,029
public void setBusHaltBinding ( Map < BusItineraryHalt , Pair < Integer , Float > > binding ) { if ( binding != null ) { BusItineraryHalt halt ; boolean shapeChanged = false ; for ( final Entry < BusItineraryHalt , Pair < Integer , Float > > entry : binding . entrySet ( ) ) { halt = entry . getKey ( ) ; halt . setRoadS...
Set the binding informations for all the bus halts of this itinerary .
212
16
6,030
@ Pure public double getLength ( ) { double length = this . roadSegments . getLength ( ) ; if ( isValidPrimitive ( ) ) { BusItineraryHalt halt = this . validHalts . get ( 0 ) ; assert halt != null ; RoadSegment sgmt = halt . getRoadSegment ( ) ; assert sgmt != null ; Direction1D dir = this . roadSegments . getRoadSegme...
Replies the length of this itinerary .
322
9
6,031
@ Pure public double getDistanceBetweenBusHalts ( int firsthaltIndex , int lasthaltIndex ) { if ( firsthaltIndex < 0 || firsthaltIndex >= this . validHalts . size ( ) - 1 ) { throw new ArrayIndexOutOfBoundsException ( firsthaltIndex ) ; } if ( lasthaltIndex <= firsthaltIndex || lasthaltIndex >= this . validHalts . size...
Replies the distance between two bus halt .
420
9
6,032
boolean addBusHalt ( BusItineraryHalt halt , int insertToIndex ) { //set index for right ordering when add to invalid list ! if ( insertToIndex < 0 ) { halt . setInvalidListIndex ( this . insertionIndex ) ; } else { halt . setInvalidListIndex ( insertToIndex ) ; } if ( halt . isValidPrimitive ( ) ) { ListUtil . addIfAb...
Add the given bus halt in this itinerary .
245
10
6,033
public void removeAllBusHalts ( ) { for ( final BusItineraryHalt bushalt : this . invalidHalts ) { bushalt . setContainer ( null ) ; bushalt . setRoadSegmentIndex ( - 1 ) ; bushalt . setPositionOnSegment ( Float . NaN ) ; bushalt . checkPrimitiveValidity ( ) ; } final BusItineraryHalt [ ] halts = new BusItineraryHalt [...
Remove all the bus halts from the current itinerary .
272
12
6,034
public boolean removeBusHalt ( BusItineraryHalt bushalt ) { try { int index = ListUtil . indexOf ( this . validHalts , VALID_HALT_COMPARATOR , bushalt ) ; if ( index >= 0 ) { return removeBusHalt ( index ) ; } index = ListUtil . indexOf ( this . invalidHalts , INVALID_HALT_COMPARATOR , bushalt ) ; if ( index >= 0 ) { i...
Remove a bus bus from this itinerary .
139
9
6,035
public boolean removeBusHalt ( String name ) { Iterator < BusItineraryHalt > iterator = this . validHalts . iterator ( ) ; BusItineraryHalt bushalt ; int i = 0 ; while ( iterator . hasNext ( ) ) { bushalt = iterator . next ( ) ; if ( name . equals ( bushalt . getName ( ) ) ) { return removeBusHalt ( i ) ; } ++ i ; } it...
Remove the bus halt with the given name .
165
9
6,036
public boolean removeBusHalt ( int index ) { try { final BusItineraryHalt removedBushalt ; if ( index < this . validHalts . size ( ) ) { removedBushalt = this . validHalts . remove ( index ) ; } else { final int idx = index - this . validHalts . size ( ) ; removedBushalt = this . invalidHalts . remove ( idx ) ; } remov...
Remove the bus halt at the specified index .
242
9
6,037
@ Pure public int indexOf ( BusItineraryHalt bushalt ) { if ( bushalt == null ) { return - 1 ; } if ( bushalt . isValidPrimitive ( ) ) { return ListUtil . indexOf ( this . validHalts , VALID_HALT_COMPARATOR , bushalt ) ; } int idx = ListUtil . indexOf ( this . invalidHalts , INVALID_HALT_COMPARATOR , bushalt ) ; if ( i...
Replies the index of the specified bus halt .
131
10
6,038
@ Pure public boolean contains ( BusItineraryHalt bushalt ) { if ( bushalt == null ) { return false ; } if ( bushalt . isValidPrimitive ( ) ) { return ListUtil . contains ( this . validHalts , VALID_HALT_COMPARATOR , bushalt ) ; } return ListUtil . contains ( this . invalidHalts , INVALID_HALT_COMPARATOR , bushalt ) ; ...
Replies if the given bus halt is inside this bus itinerary .
98
14
6,039
@ Pure public BusItineraryHalt getBusHaltAt ( int index ) { if ( index < this . validHalts . size ( ) ) { return this . validHalts . get ( index ) ; } return this . invalidHalts . get ( index - this . validHalts . size ( ) ) ; }
Replies the halt at the specified index .
70
9
6,040
@ Pure public BusItineraryHalt getBusHalt ( UUID uuid ) { if ( uuid == null ) { return null ; } for ( final BusItineraryHalt busHalt : this . validHalts ) { if ( uuid . equals ( busHalt . getUUID ( ) ) ) { return busHalt ; } } for ( final BusItineraryHalt busHalt : this . invalidHalts ) { if ( uuid . equals ( busHalt ....
Replies the bus halt with the specified uuid .
128
11
6,041
@ Pure public BusItineraryHalt getBusHalt ( String name , Comparator < String > nameComparator ) { if ( name == null ) { return null ; } final Comparator < String > cmp = nameComparator == null ? BusNetworkUtilities . NAME_COMPARATOR : nameComparator ; for ( final BusItineraryHalt bushalt : this . validHalts ) { if ( c...
Replies the bus halt with the specified name .
164
10
6,042
@ Pure public BusItineraryHalt [ ] toBusHaltArray ( ) { final BusItineraryHalt [ ] tab = new BusItineraryHalt [ this . validHalts . size ( ) + this . invalidHalts . size ( ) ] ; int i = 0 ; for ( final BusItineraryHalt h : this . validHalts ) { tab [ i ] = h ; ++ i ; } for ( final BusItineraryHalt h : this . invalidHal...
Replies an array of the bus halts inside this itinerary . This function copy the internal data structures into the array .
126
25
6,043
@ Pure public BusItineraryHalt [ ] toInvalidBusHaltArray ( ) { final BusItineraryHalt [ ] tab = new BusItineraryHalt [ this . invalidHalts . size ( ) ] ; return this . invalidHalts . toArray ( tab ) ; }
Replies an array of the invalid bus halts inside this itinerary . This function copy the internal data structures into the array .
64
26
6,044
@ Pure public BusItineraryHalt [ ] toValidBusHaltArray ( ) { final BusItineraryHalt [ ] tab = new BusItineraryHalt [ this . validHalts . size ( ) ] ; return this . validHalts . toArray ( tab ) ; }
Replies an array of the valid bus halts inside this itinerary . This function copy the internal data structures into the array .
64
26
6,045
@ Pure public RoadSegment getNearestRoadSegment ( Point2D < ? , ? > point ) { assert point != null ; double distance = Double . MAX_VALUE ; RoadSegment nearestSegment = null ; final Iterator < RoadSegment > iterator = this . roadSegments . roadSegments ( ) ; RoadSegment segment ; while ( iterator . hasNext ( ) ) { segm...
Replies the nearest road segment from this itinerary to the given point .
128
15
6,046
public boolean addRoadSegments ( RoadPath segments , boolean autoConnectHalts , boolean enableLoopAutoBuild ) { if ( segments == null || segments . isEmpty ( ) ) { return false ; } BusItineraryHalt halt ; RoadSegment sgmt ; final Map < BusItineraryHalt , RoadSegment > haltMapping = new TreeMap <> ( ( obj1 , obj2 ) -> I...
Add road segments inside the bus itinerary .
656
9
6,047
@ SuppressWarnings ( "checkstyle:nestedifdepth" ) public boolean putHaltOnRoad ( BusItineraryHalt halt , RoadSegment road ) { if ( contains ( halt ) ) { final BusStop stop = halt . getBusStop ( ) ; if ( stop != null ) { final Point2d stopPosition = stop . getPosition2D ( ) ; if ( stopPosition != null ) { final int idx ...
Put the given bus itinerary halt on the nearest point on road .
249
14
6,048
public void removeAllRoadSegments ( ) { for ( final BusItineraryHalt halt : this . invalidHalts ) { halt . setRoadSegmentIndex ( - 1 ) ; halt . setPositionOnSegment ( Float . NaN ) ; halt . checkPrimitiveValidity ( ) ; } final BusItineraryHalt [ ] halts = new BusItineraryHalt [ this . validHalts . size ( ) ] ; this . v...
Remove all the road segments from the current itinerary .
281
11
6,049
public boolean removeRoadSegment ( int segmentIndex ) { if ( segmentIndex >= 0 && segmentIndex < this . roadSegments . getRoadSegmentCount ( ) ) { final RoadSegment segment = this . roadSegments . getRoadSegmentAt ( segmentIndex ) ; if ( segment != null ) { // // Invalidate the bus halts on the segment // final Map < B...
Remove a road segment from this itinerary .
615
9
6,050
@ Pure public Iterable < RoadSegment > roadSegments ( ) { return new Iterable < RoadSegment > ( ) { @ Override public Iterator < RoadSegment > iterator ( ) { return roadSegmentsIterator ( ) ; } } ; }
Replies the list of the road segments of the bus itinerary .
55
14
6,051
@ SuppressWarnings ( "unchecked" ) /** * Creates an aligner given a single function from items to equivalence classes (requires left * and right items to both be of types compatible with this function). */ public static < InT , EqClass > EquivalenceBasedProvenancedAligner < InT , InT , EqClass > forEquivalenceFunction ...
we don t need
158
4
6,052
@ Pure public static String getExecutableFilename ( String name ) { if ( OperatingSystem . WIN . isCurrentOS ( ) ) { return name + ".exe" ; //$NON-NLS-1$ } return name ; }
Replies a binary executable filename depending of the current platform .
50
12
6,053
@ Pure public static String getVMBinary ( ) { final String javaHome = System . getProperty ( "java.home" ) ; //$NON-NLS-1$ final File binDir = new File ( new File ( javaHome ) , "bin" ) ; //$NON-NLS-1$ if ( binDir . isDirectory ( ) ) { File exec = new File ( binDir , getExecutableFilename ( "javaw" ) ) ; //$NON-NLS-1$ ...
Replies the current java VM binary .
188
8
6,054
@ SuppressWarnings ( "checkstyle:magicnumber" ) public static Process launchVMWithJar ( File jarFile , String ... additionalParams ) throws IOException { final String javaBin = getVMBinary ( ) ; if ( javaBin == null ) { throw new FileNotFoundException ( "java" ) ; //$NON-NLS-1$ } final long totalMemory = Runtime . getR...
Run a jar file inside a new VM .
272
9
6,055
@ Pure @ SuppressWarnings ( { "checkstyle:cyclomaticcomplexity" , "checkstyle:npathcomplexity" } ) public static String [ ] getAllCommandLineParameters ( ) { final int osize = commandLineOptions == null ? 0 : commandLineOptions . size ( ) ; final int psize = commandLineParameters == null ? 0 : commandLineParameters . l...
Replies the command line including the options and the standard parameters .
434
13
6,056
public static String shiftCommandLineParameters ( ) { String removed = null ; if ( commandLineParameters != null ) { if ( commandLineParameters . length == 0 ) { commandLineParameters = null ; } else if ( commandLineParameters . length == 1 ) { removed = commandLineParameters [ 0 ] ; commandLineParameters = null ; } el...
Shift the command line parameters by one on the left . The first parameter is removed from the list .
138
20
6,057
@ Pure public static Map < String , List < Object > > getCommandLineOptions ( ) { if ( commandLineOptions != null ) { return Collections . unmodifiableSortedMap ( commandLineOptions ) ; } return Collections . emptyMap ( ) ; }
Replies the command line options .
54
7
6,058
@ Pure public static List < Object > getCommandLineOption ( String name ) { if ( commandLineOptions != null && commandLineOptions . containsKey ( name ) ) { final List < Object > value = commandLineOptions . get ( name ) ; return value == null ? Collections . emptyList ( ) : value ; } return Collections . emptyList ( )...
Replies one command option .
76
6
6,059
@ Pure @ SuppressWarnings ( "static-method" ) public Object getFirstOptionValue ( String optionLabel ) { final List < Object > options = getCommandLineOption ( optionLabel ) ; if ( options == null || options . isEmpty ( ) ) { return null ; } return options . get ( 0 ) ; }
Replies the first value of the option .
70
9
6,060
@ Pure @ SuppressWarnings ( "static-method" ) public List < Object > getOptionValues ( String optionLabel ) { final List < Object > options = getCommandLineOption ( optionLabel ) ; if ( options == null ) { return Collections . emptyList ( ) ; } return Collections . unmodifiableList ( options ) ; }
Replies the values of the option .
73
8
6,061
@ Pure @ SuppressWarnings ( "static-method" ) public boolean isParameterExists ( int index ) { final String [ ] params = getCommandLineParameters ( ) ; return index >= 0 && index < params . length && params [ index ] != null ; }
Replies if the given index corresponds to a command line parameter .
58
13
6,062
private int firstInGroup ( int groupIndex ) { if ( this . pointCoordinates == null ) { throw new IndexOutOfBoundsException ( ) ; } final int count = getGroupCount ( ) ; if ( groupIndex < 0 ) { throw new IndexOutOfBoundsException ( groupIndex + "<0" ) ; //$NON-NLS-1$ } if ( groupIndex >= count ) { throw new IndexOutOfBo...
Replies the starting index of a point in a group .
168
12
6,063
private int lastInGroup ( int groupIndex ) { if ( this . pointCoordinates == null ) { throw new IndexOutOfBoundsException ( ) ; } final int count = getGroupCount ( ) ; if ( groupIndex < 0 ) { throw new IndexOutOfBoundsException ( groupIndex + "<0" ) ; //$NON-NLS-1$ } if ( groupIndex >= count ) { throw new IndexOutOfBou...
Replies the ending index of a point in a group .
168
12
6,064
private int groupIndexForPoint ( int pointIndex ) { if ( this . pointCoordinates == null || pointIndex < 0 || pointIndex >= this . pointCoordinates . length ) { throw new IndexOutOfBoundsException ( ) ; } if ( this . partIndexes == null ) { return 0 ; } for ( int i = 0 ; i < this . partIndexes . length ; ++ i ) { if ( ...
Replies the group index inside which the point is located at the specified index .
119
16
6,065
@ Pure public int getPointCountInGroup ( int groupIndex ) { if ( groupIndex == 0 && this . pointCoordinates == null ) { return 0 ; } final int firstInGroup = firstInGroup ( groupIndex ) ; final int lastInGroup = lastInGroup ( groupIndex ) ; return ( lastInGroup - firstInGroup ) / 2 + 1 ; }
Replies the count of points in the specified group .
80
11
6,066
@ Pure public int getPointIndex ( int groupIndex , int position ) { final int groupMemberCount = getPointCountInGroup ( groupIndex ) ; final int pos ; if ( position < 0 ) { pos = 0 ; } else if ( position >= groupMemberCount ) { pos = groupMemberCount - 1 ; } else { pos = position ; } // Move the start/end indexes to co...
Replies the global index of the point that corresponds to the position in the given group .
108
18
6,067
@ Pure public int getPointIndex ( int groupIndex , Point2D < ? , ? > point2d ) { if ( ! this . containsPoint ( point2d , groupIndex ) ) { return - 1 ; } Point2d cur = null ; int pos = - 1 ; for ( int i = 0 ; i < getPointCountInGroup ( groupIndex ) ; ++ i ) { cur = getPointAt ( groupIndex , i ) ; if ( cur . epsilonEqual...
Replies the global index of the point2d in the given group .
153
15
6,068
@ Pure public PointGroup getGroupAt ( int index ) { final int count = getGroupCount ( ) ; if ( index < 0 ) { throw new IndexOutOfBoundsException ( index + "<0" ) ; //$NON-NLS-1$ } if ( index >= count ) { throw new IndexOutOfBoundsException ( index + ">=" + count ) ; //$NON-NLS-1$ } return new PointGroup ( index ) ; }
Replies the part at the specified index .
102
9
6,069
@ Pure public Iterable < PointGroup > groups ( ) { return new Iterable < PointGroup > ( ) { @ Override public Iterator < PointGroup > iterator ( ) { return MapComposedElement . this . groupIterator ( ) ; } } ; }
Replies the iterator on the groups .
55
8
6,070
@ Pure public Iterable < Point2d > points ( ) { return new Iterable < Point2d > ( ) { @ Override public Iterator < Point2d > iterator ( ) { return MapComposedElement . this . pointIterator ( ) ; } } ; }
Replies the iterator on the points .
58
8
6,071
public int addPoint ( double x , double y ) { int pointIndex ; if ( this . pointCoordinates == null ) { this . pointCoordinates = new double [ ] { x , y } ; this . partIndexes = null ; pointIndex = 0 ; } else { double [ ] pts = new double [ this . pointCoordinates . length + 2 ] ; System . arraycopy ( this . pointCoord...
Add the specified point at the end of the last group .
173
12
6,072
public int addGroup ( double x , double y ) { int pointIndex ; if ( this . pointCoordinates == null ) { this . pointCoordinates = new double [ ] { x , y } ; this . partIndexes = null ; pointIndex = 0 ; } else { double [ ] pts = new double [ this . pointCoordinates . length + 2 ] ; System . arraycopy ( this . pointCoord...
Add the specified point into a newgroup .
259
9
6,073
public MapComposedElement invertPointsIn ( int groupIndex ) { if ( this . pointCoordinates == null ) { throw new IndexOutOfBoundsException ( ) ; } final int grpCount = getGroupCount ( ) ; if ( groupIndex < 0 ) { throw new IndexOutOfBoundsException ( groupIndex + "<0" ) ; //$NON-NLS-1$ } if ( groupIndex > grpCount ) { t...
invert the points coordinates of this element on the groupIndex in argument .
271
15
6,074
public MapComposedElement invert ( ) { if ( this . pointCoordinates == null ) { throw new IndexOutOfBoundsException ( ) ; } double [ ] tmp = new double [ this . pointCoordinates . length ] ; for ( int i = 0 ; i < this . pointCoordinates . length ; i += 2 ) { tmp [ i ] = this . pointCoordinates [ this . pointCoordinates...
Invert the order of points coordinates of this element and reorder the groupIndex too .
296
18
6,075
@ Pure public Point2d getPointAt ( int index ) { final int count = getPointCount ( ) ; int idx = index ; if ( idx < 0 ) { idx = count + idx ; } if ( idx < 0 ) { throw new IndexOutOfBoundsException ( idx + "<0" ) ; //$NON-NLS-1$ } if ( idx >= count ) { throw new IndexOutOfBoundsException ( idx + ">=" + count ) ; //$NON-...
Replies the specified point at the given index .
157
10
6,076
@ Pure public Point2d getPointAt ( int groupIndex , int indexInGroup ) { final int startIndex = firstInGroup ( groupIndex ) ; // Besure that the member's index is in the group index's range final int groupMemberCount = getPointCountInGroup ( groupIndex ) ; if ( indexInGroup < 0 ) { throw new IndexOutOfBoundsException (...
Replies the specified point at the given index in the specified group .
190
14
6,077
public boolean removeGroupAt ( int groupIndex ) { try { final int startIndex = firstInGroup ( groupIndex ) ; final int lastIndex = lastInGroup ( groupIndex ) ; final int ptsToRemoveCount = ( lastIndex - startIndex + 2 ) / 2 ; int rest = this . pointCoordinates . length / 2 - ptsToRemoveCount ; if ( rest > 0 ) { // Remo...
Remove the specified group .
450
5
6,078
public Point2d removePointAt ( int groupIndex , int indexInGroup ) { final int startIndex = firstInGroup ( groupIndex ) ; final int lastIndex = lastInGroup ( groupIndex ) ; // Translate local point's coordinate into global point's coordinate final int g = indexInGroup * 2 + startIndex ; // Be sure that the member's ind...
Remove the specified point at the given index in the specified group .
574
13
6,079
private boolean canonize ( int index ) { final int count = getPointCount ( ) ; int ix = index ; if ( ix < 0 ) { ix = count + ix ; } if ( ix < 0 ) { throw new IndexOutOfBoundsException ( ix + "<0" ) ; //$NON-NLS-1$ } if ( ix >= count ) { throw new IndexOutOfBoundsException ( ix + ">=" + count ) ; //$NON-NLS-1$ } final i...
Remove unnecessary points from the specified index .
719
8
6,080
private Optional < IncludeAllPageWithOutput > addOutputInformation ( IncludeAllPage pages , FileResource baseResource , Path includeAllBasePath , Locale locale ) { // depth = 0 is the file that has the include-all directive if ( pages . depth == 0 ) { return of ( new IncludeAllPageWithOutput ( pages , pages . files . g...
generate the final output path
236
6
6,081
public Reactor getReactorByIndex ( int index ) { if ( index < 0 || index > reactorSet . length - 1 ) { throw new ArrayIndexOutOfBoundsException ( ) ; } return reactorSet [ index ] ; }
Find reactor by index
50
4
6,082
@ SuppressWarnings ( "rawtypes" ) public static CompoundPainter getCompoundPainter ( final Color matte , final Color gloss , final GlossPainter . GlossPosition position , final double angle , final Color pinstripe ) { final MattePainter mp = new MattePainter ( matte ) ; final GlossPainter gp = new GlossPainter ( gloss ...
Gets a CompoundPainter object .
134
9
6,083
@ SuppressWarnings ( "rawtypes" ) public static CompoundPainter getCompoundPainter ( final Color color , final GlossPainter . GlossPosition position , final double angle ) { final MattePainter mp = new MattePainter ( color ) ; final GlossPainter gp = new GlossPainter ( color , position ) ; final PinstripePainter pp = n...
Gets the compound painter .
122
6
6,084
public static MattePainter getMattePainter ( final int width , final int height , final float [ ] fractions , final Color ... colors ) { final LinearGradientPaint gradientPaint = new LinearGradientPaint ( 0.0f , 0.0f , width , height , fractions , colors ) ; final MattePainter mattePainter = new MattePainter ( gradient...
Gets a MattePainter object .
91
8
6,085
@ Override public void set ( Point3D center , double radius1 ) { this . cx = center . getX ( ) ; this . cy = center . getY ( ) ; this . cz = center . getZ ( ) ; this . radius = Math . abs ( radius1 ) ; }
Change the frame of te sphere .
63
7
6,086
public ListProperty < T > elementsProperty ( ) { if ( this . elements == null ) { this . elements = new SimpleListProperty <> ( this , MathFXAttributeNames . ELEMENTS , new InternalObservableList <> ( ) ) ; } return this . elements ; }
Replies the property that contains all the shapes in this multishape .
60
15
6,087
@ SuppressWarnings ( "unchecked" ) protected static < E > Class < ? extends E > extractClassFrom ( Collection < ? extends E > collection ) { Class < ? extends E > clazz = null ; for ( final E elt : collection ) { clazz = ( Class < ? extends E > ) ReflectionUtil . getCommonType ( clazz , elt . getClass ( ) ) ; } return ...
Extract the upper class that contains all the elements of this array .
110
14
6,088
public HelpSet getHelpSet ( ) { HelpSet hs = null ; final String filename = "simple-hs.xml" ; final String path = "help/" + filename ; URL hsURL ; hsURL = ClassExtensions . getResource ( path ) ; try { if ( hsURL != null ) { hs = new HelpSet ( ClassExtensions . getClassLoader ( ) , hsURL ) ; } else { hs = new HelpSet (...
Gets the help set .
229
6
6,089
protected JMenu newHelpMenu ( final ActionListener listener ) { // Help menu final JMenu menuHelp = new JMenu ( newLabelTextHelp ( ) ) ; menuHelp . setMnemonic ( ' ' ) ; // Help JMenuItems // Help content final JMenuItem mihHelpContent = JComponentFactory . newJMenuItem ( newLabelTextContent ( ) , ' ' , ' ' ) ; menuHel...
Creates the help menu .
418
6
6,090
protected JMenu newLookAndFeelMenu ( final ActionListener listener ) { final JMenu menuLookAndFeel = new JMenu ( "Look and Feel" ) ; menuLookAndFeel . setMnemonic ( ' ' ) ; // Look and Feel JMenuItems // GTK JMenuItem jmiPlafGTK ; jmiPlafGTK = new JMenuItem ( "GTK" , ' ' ) ; //$NON-NLS-1$ MenuExtensions . setCtrlAccele...
Creates the look and feel menu .
714
8
6,091
public NYTCorpusDocument parseNYTCorpusDocumentFromFile ( File file , boolean validating ) { Document document = null ; if ( validating ) { document = loadValidating ( file ) ; } else { document = loadNonValidating ( file ) ; } return parseNYTCorpusDocumentFromDOMDocument ( file , document ) ; }
Parse an New York Times Document from a file .
74
11
6,092
private Document loadNonValidating ( InputStream is ) { Document document ; StringBuffer sb = new StringBuffer ( ) ; BufferedReader in = null ; try { in = new BufferedReader ( new InputStreamReader ( is , "UTF8" ) ) ; String line = null ; while ( ( line = in . readLine ( ) ) != null ) { sb . append ( line + "\n" ) ; } ...
Load a document without validating it . Since instructing the java . xml libraries to do this does not actually disable validation this method disables validation by removing the doctype declaration from the XML document before it is parsed .
327
44
6,093
private Document parseStringToDOM ( String s , String encoding ) { try { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setValidating ( false ) ; InputStream is = new ByteArrayInputStream ( s . getBytes ( encoding ) ) ; Document doc = factory . newDocumentBuilder ( ) . parse ( is ...
Parse a string to a DOM document .
175
9
6,094
private Document getDOMObject ( String filename , boolean validating ) throws SAXException , IOException , ParserConfigurationException { // Create a builder factory DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; if ( ! validating ) { factory . setValidating ( validating ) ; factory . setSc...
Parse a file containing an XML document into a DOM object .
121
13
6,095
@ Pure @ SuppressWarnings ( "unchecked" ) public Class < ? extends T > getValueType ( ) { if ( this . object == null ) { return null ; } return ( Class < ? extends T > ) this . object . getClass ( ) ; }
Replies the type of the value .
59
8
6,096
public void add ( T newValue ) { if ( this . isSet ) { if ( ! this . isMultiple && newValue != this . object && ( newValue == null || ! newValue . equals ( this . object ) ) ) { this . isMultiple = true ; this . object = null ; } } else { this . object = newValue ; this . isSet = true ; this . isMultiple = false ; } }
Add the given value to the styored value .
91
10
6,097
public String commandsWritingDataTo ( File dataDirectory ) throws IOException { final Map < DatafileReference , File > refsToFiles = Maps . newHashMap ( ) ; for ( final DatafileReference datafileReference : datafileReferences ) { final File randomFile = File . createTempFile ( "plotBundle" , ".dat" , dataDirectory ) ; ...
Writes the plot data to the indicated directory and returns the GnuPlot commands for the plot as a string . These commands will reference the written data files .
269
32
6,098
public void setCodePage ( DBaseCodePage code ) { if ( this . columns != null ) { throw new IllegalStateException ( ) ; } if ( code != null ) { this . language = code ; } }
Replies the output language to use in the dBASE file .
46
13
6,099
@ SuppressWarnings ( "checkstyle:magicnumber" ) private void writeDBFDate ( Date date ) throws IOException { final SimpleDateFormat format = new SimpleDateFormat ( "yyyyMMdd" ) ; //$NON-NLS-1$ writeDBFString ( format . format ( date ) , 8 , ( byte ) ' ' ) ; }
Write a formated date according to the Dbase specifications .
80
12