idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
2,900
private int beforeHookInsertLine ( TestMethod method , int codeLineIndex ) { if ( ! isLineLastStament ( method , codeLineIndex ) ) { return - 1 ; } for ( int i = codeLineIndex ; i > 0 ; i -- ) { CodeLine thisLine = method . getCodeBody ( ) . get ( i ) ; CodeLine prevLine = method . getCodeBody ( ) . get ( i - 1 ) ; ass...
Returns - 1 if beforeHook for the codeLineIndex should not be inserted
2,901
private int afterHookInsertLine ( TestMethod method , int codeLineIndex ) { if ( ! isLineLastStament ( method , codeLineIndex ) ) { return - 1 ; } CodeLine codeLine = method . getCodeBody ( ) . get ( codeLineIndex ) ; return codeLine . getEndLine ( ) + 1 ; }
Returns - 1 if afterHook for the codeLineIndex should not be inserted
2,902
private boolean insertCodeBodyHook ( TestMethod method , CtMethod ctMethod , String classQualifiedName , String methodSimpleName , String methodArgClassesStr ) throws CannotCompileException { String hookClassName = HookMethodDef . class . getCanonicalName ( ) ; String initializeSrc = hookInitializeSrc ( ) ; boolean tra...
- returns true this method actually transform ctMethod body
2,903
public SrcTree generate ( String [ ] srcFiles , Charset srcCharset , String [ ] classPathEntries ) { CollectRootRequestor rootRequestor = new CollectRootRequestor ( ) ; parseAST ( srcFiles , srcCharset , classPathEntries , rootRequestor ) ; CollectSubRequestor subRequestor = new CollectSubRequestor ( rootRequestor . ge...
all class containing sub directories even if the class is in a named package
2,904
public QueryAtom bind ( QueryBinding binding ) { List < QueryArgument > args = new ArrayList < QueryArgument > ( ) ; for ( QueryArgument arg : this . args ) { if ( binding . isBound ( arg ) ) { args . add ( binding . get ( arg ) ) ; } else { args . add ( arg ) ; } } return new QueryAtom ( type , args ) ; }
A convenience method to clone the QueryAtom instance while inserting a new binding .
2,905
public void start ( BundleContext bundleContext ) throws Exception { try { super . start ( bundleContext ) ; } catch ( Throwable e ) { String errorMessage = "Problem when starting Kura module " + getClass ( ) . getName ( ) + ":" ; log . warn ( errorMessage , e ) ; System . err . println ( errorMessage ) ; e . printStac...
CAMEL - 9314 )
2,906
protected void activate ( ComponentContext componentContext , Map < String , Object > properties ) throws Exception { m_properties = properties ; start ( componentContext . getBundleContext ( ) ) ; updated ( properties ) ; }
CAMEL - 9351 )
2,907
public boolean waitForExpectedCondition ( ExpectedCondition < ? > condition , int timeout ) { WebDriver driver = getWebDriver ( ) ; boolean conditionMet = true ; try { new WebDriverWait ( driver , timeout ) . until ( condition ) ; } catch ( TimeoutException e ) { conditionMet = false ; } return conditionMet ; }
Waits until the expectations are full filled or timeout runs out
2,908
public void waitAndAssertForExpectedCondition ( ExpectedCondition < ? > condition , int timeout ) { if ( ! waitForExpectedCondition ( condition , timeout ) ) { fail ( String . format ( "Element does not meet condition %1$s" , condition . toString ( ) ) ) ; } }
Waits until the expectations are met and throws an assert if not
2,909
public void checkAndAssertForExpectedCondition ( ExpectedCondition < ? > condition ) { if ( ! waitForExpectedCondition ( condition , 0 ) ) { fail ( String . format ( "Element does not meet condition %1$s" , condition . toString ( ) ) ) ; } }
Checks if the expectations are met and throws an assert if not
2,910
public void waitAndSwitchToNewBrowserWindow ( int timeout ) { final Set < String > handles = SenBotContext . getSeleniumDriver ( ) . getWindowHandles ( ) ; mainWindowHandle . set ( SenBotContext . getSeleniumDriver ( ) . getWindowHandles ( ) . iterator ( ) . next ( ) ) ; if ( getWebDriver ( ) instanceof InternetExplore...
Waits for a new browser window to pop up and switches to it
2,911
public void remove ( String name ) throws IOException , IllegalArgumentException { checkWritable ( ) ; final FatLfnDirectoryEntry entry = getEntry ( name ) ; if ( entry == null ) return ; unlinkEntry ( entry ) ; final ClusterChain cc = new ClusterChain ( fat , entry . realEntry . getStartCluster ( ) , false ) ; cc . se...
Remove the entry with the given name from this directory .
2,912
void unlinkEntry ( FatLfnDirectoryEntry entry ) { final ShortName sn = entry . realEntry . getShortName ( ) ; if ( sn . equals ( ShortName . DOT ) || sn . equals ( ShortName . DOT_DOT ) ) throw new IllegalArgumentException ( "the dot entries can not be removed" ) ; final String lowerName = entry . getName ( ) . toLower...
Unlinks the specified entry from this directory without actually deleting it .
2,913
void linkEntry ( FatLfnDirectoryEntry entry ) throws IOException { checkUniqueName ( entry . getName ( ) ) ; final ShortName sn = makeShortName ( entry . getName ( ) ) ; entry . realEntry . setShortName ( sn ) ; this . longNameIndex . put ( entry . getName ( ) . toLowerCase ( Locale . ROOT ) , entry ) ; this . shortNam...
Links the specified entry to this directory updating the entrie s short name .
2,914
public String getVolumeLabel ( ) { checkClosed ( ) ; final String fromDir = rootDirStore . getLabel ( ) ; if ( fromDir == null && fatType != FatType . FAT32 ) { return ( ( Fat16BootSector ) bs ) . getVolumeLabel ( ) ; } else { return fromDir ; } }
Returns the volume label of this file system .
2,915
public void setVolumeLabel ( String label ) throws ReadOnlyException , IOException { checkClosed ( ) ; checkReadOnly ( ) ; rootDirStore . setLabel ( label ) ; if ( fatType != FatType . FAT32 ) { ( ( Fat16BootSector ) bs ) . setVolumeLabel ( label ) ; } }
Sets the volume label for this file system .
2,916
public void flush ( ) throws IOException { checkClosed ( ) ; if ( bs . isDirty ( ) ) { bs . write ( ) ; } for ( int i = 0 ; i < bs . getNrFats ( ) ; i ++ ) { fat . writeCopy ( bs . getFatOffset ( i ) ) ; } rootDir . flush ( ) ; if ( fsiSector != null ) { fsiSector . setFreeClusterCount ( fat . getFreeClusterCount ( ) )...
Flush all changed structures to the device .
2,917
public long getTotalSpace ( ) { checkClosed ( ) ; if ( fatType == FatType . FAT32 ) { return bs . getNrTotalSectors ( ) * bs . getBytesPerSector ( ) ; } return - 1 ; }
The total size of this file system .
2,918
public QueryResult execute ( Query query ) throws QueryEngineException { if ( ! ( query instanceof QueryImpl ) ) { throw new QueryEngineException ( "Couldn't cast Query to QueryImpl." ) ; } QueryImpl q = ( QueryImpl ) query ; resvarsLoop : for ( QueryArgument arg : q . getResultVars ( ) ) { for ( QueryAtomGroup g : q ....
Execute a sparql - dl query and generate the result set .
2,919
private List < QueryAtomGroupImpl > findComponents ( QueryAtomGroupImpl group ) { List < QueryAtom > atoms = new LinkedList < > ( ) ; atoms . addAll ( group . getAtoms ( ) ) ; List < QueryAtomGroupImpl > components = new LinkedList < > ( ) ; if ( atoms . isEmpty ( ) ) { components . add ( group ) ; return components ; ...
Split the query into individual components if possible to avoid cross - products in later evaluation . The first component will contain all atoms with no variables if there exist some .
2,920
private QueryResultImpl combineResults ( Queue < QueryResultImpl > results , boolean distinct ) { while ( results . size ( ) > 1 ) { QueryResultImpl a = results . remove ( ) ; QueryResultImpl b = results . remove ( ) ; results . add ( combineResults ( a , b , distinct ) ) ; } return results . remove ( ) ; }
Combine the results of the individual components with the cartesian product .
2,921
private QueryResultImpl combineResults ( QueryResultImpl a , QueryResultImpl b , boolean distinct ) { QueryResultImpl result = new QueryResultImpl ( a . getQuery ( ) ) ; for ( QueryBindingImpl bindingA : a . getBindings ( ) ) { for ( QueryBindingImpl bindingB : b . getBindings ( ) ) { QueryBindingImpl binding = new Que...
Combine two results with the cartesian product .
2,922
private QueryResultImpl eliminateDuplicates ( QueryResultImpl result ) { QueryResultImpl ret = new QueryResultImpl ( result . getQuery ( ) ) ; Set < QueryBindingImpl > distinctSet = new HashSet < > ( result . getBindings ( ) ) ; distinctSet . forEach ( ret :: add ) ; return ret ; }
Eliminate duplicate bindings .
2,923
private static StackLine getStackLine ( SrcTree srcTree , String classQualifiedName , String methodSimpleName , int line ) { StackLine rootStackLine = getStackLine ( srcTree . getRootMethodTable ( ) , classQualifiedName , methodSimpleName , line ) ; if ( rootStackLine != null ) { return rootStackLine ; } StackLine subS...
null means method does not exists in srcTree
2,924
public WebElement fillFormField_locator ( String locator , String value ) { WebElement fieldEl = seleniumElementService . translateLocatorToWebElement ( locator ) ; fieldEl . clear ( ) ; fieldEl . sendKeys ( getReferenceService ( ) . namespaceString ( value ) ) ; return fieldEl ; }
Fill out a form field with the passed value
2,925
public void toBus ( String channel , Object payload , Header ... headers ) { producerTemplate . sendBodyAndHeaders ( "amqp:" + channel , encodedPayload ( payload ) , arguments ( headers ) ) ; }
Connector channels API
2,926
public void cacheIncludeAndIgnore ( WebElement table ) { if ( getIgnoreByMatches ( ) == null ) { setIgnoreByMatches ( new ArrayList < WebElement > ( ) ) ; for ( By by : getIgnoreRowsMatching ( ) ) { getIgnoreByMatches ( ) . addAll ( table . findElements ( by ) ) ; } } if ( getIncludeByMatches ( ) == null ) { setInclude...
Does the table comparison
2,927
public static < T > T getBean ( Class < T > clazz ) { return getSenBotContext ( ) . context . getBean ( clazz ) ; }
Gets the bean class
2,928
public static File getOrCreateFile ( String url , boolean createIfNotFound ) throws IOException { File file = null ; if ( url . contains ( ResourceUtils . CLASSPATH_URL_PREFIX ) ) { url = url . replaceAll ( ResourceUtils . CLASSPATH_URL_PREFIX , "" ) ; if ( url . startsWith ( "/" ) ) { url = url . substring ( 1 ) ; } U...
Get a File on the class path or file system or create it if it does not exist
2,929
public void setChainLength ( int nrClusters ) throws IOException { if ( nrClusters < 0 ) throw new IllegalArgumentException ( "negative cluster count" ) ; if ( ( this . startCluster == 0 ) && ( nrClusters == 0 ) ) { } else if ( ( this . startCluster == 0 ) && ( nrClusters > 0 ) ) { final long [ ] chain = fat . allocNew...
Sets the length of this cluster chain in clusters .
2,930
public void moveTo ( FatLfnDirectory target , String newName ) throws IOException , ReadOnlyException { checkWritable ( ) ; if ( ! target . isFreeName ( newName ) ) { throw new IOException ( "the name \"" + newName + "\" is already in use" ) ; } this . parent . unlinkEntry ( this ) ; this . parent = target ; this . fil...
Moves this entry to a new directory under the specified name .
2,931
private Pin getPin ( ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( " Pin Id > " + iled ) ; } Pin ret = getPinPerFieldName ( ) ; if ( ret == null ) { ret = getPinPerPinAddress ( ) ; if ( ret == null ) { ret = getPinPerPinName ( ) ; } } if ( ret == null ) { throw new IllegalArgumentException ( "Cannot find gpio [" ...
Hack to retrieve the correct Pin from RaspiPin . class lib
2,932
public long getStartCluster ( ) { if ( type == FatType . FAT32 ) { return ( LittleEndian . getUInt16 ( data , 0x14 ) << 16 ) | LittleEndian . getUInt16 ( data , 0x1a ) ; } else { return LittleEndian . getUInt16 ( data , 0x1a ) ; } }
Returns the start of the file in clusters .
2,933
void setStartCluster ( long startCluster ) { if ( startCluster > Integer . MAX_VALUE ) throw new AssertionError ( ) ; if ( this . type == FatType . FAT32 ) { LittleEndian . setInt16 ( data , 0x1a , ( int ) ( startCluster & 0xffff ) ) ; LittleEndian . setInt16 ( data , 0x14 , ( int ) ( ( startCluster >> 16 ) & 0xffff ) ...
Sets the startCluster .
2,934
public static Packet decompress ( final Packet packet ) throws IOException { final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream ( packet . getData ( ) ) ; final GZIPInputStream gzipInputStream = new GZIPInputStream ( byteArrayInputStream ) ; final ByteArrayOutputStream byteArrayOutputStream = ne...
Decompresses given Packet
2,935
public static Packet compress ( final Packet packet ) throws IOException { final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ( ) ; final GZIPOutputStream gzipOutputStream = new GZIPOutputStream ( byteArrayOutputStream ) { { def . setLevel ( Deflater . BEST_COMPRESSION ) ; } } ; gzipOutputStr...
Compresses given Packet . Note that this can increase the total size when used incorrectly
2,936
public String getViewsString ( ) { if ( views == null || views . isEmpty ( ) ) return "" ; char delim = ',' ; StringBuilder buf = new StringBuilder ( ) ; for ( String value : views ) buf . append ( delim ) . append ( value ) ; return buf . substring ( 1 ) ; }
Used for generating the config UI .
2,937
public TLSBuilder withTrustStore ( final String trustStoreType , final InputStream trustStoreStream , final char [ ] trustStorePassword ) { return withKeyStore ( trustStoreType , trustStoreStream , trustStorePassword ) ; }
Sets trust store
2,938
public SSLSocket buildSocket ( ) throws KeyStoreException , CertificateException , NoSuchAlgorithmException , IOException , UnrecoverableKeyException , KeyManagementException { if ( host == null ) throw new IllegalStateException ( "Cannot create socket without host" ) ; final SSLSocket s = ( SSLSocket ) build ( ) . get...
Builds a new Socket
2,939
public SSLServerSocket buildServerSocket ( ) throws CertificateException , UnrecoverableKeyException , NoSuchAlgorithmException , KeyStoreException , KeyManagementException , IOException { final SSLServerSocket s = ( SSLServerSocket ) build ( ) . getServerSocketFactory ( ) . createServerSocket ( port ) ; s . setEnabled...
Builds a new ServerSocket
2,940
public void write ( final DataOutputStream out ) throws IOException { out . writeByte ( packetType . ordinal ( ) ) ; out . writeShort ( packetID ) ; out . writeInt ( dataLength ) ; out . write ( data ) ; }
Writes Packet into DataOutputStream
2,941
public static Packet fromStream ( final DataInputStream in ) throws IOException { final Packet . PacketType packetType = Packet . PacketType . fastValues [ in . readByte ( ) ] ; final short packetID = in . readShort ( ) ; final int dataLength = in . readInt ( ) ; final byte [ ] data = new byte [ dataLength ] ; in . rea...
Reads a Packet from raw input data
2,942
public synchronized byte [ ] readBytes ( ) throws IOException { final int dataLength = dataInputStream . readInt ( ) ; final byte [ ] data = new byte [ dataLength ] ; final int dataRead = dataInputStream . read ( data , 0 , dataLength ) ; if ( dataRead != dataLength ) throw new IOException ( "Not enough data available"...
Reads byte array into output
2,943
static String [ ] getUsable ( final List < String > available , final String [ ] supported ) { final List < String > filtered = new ArrayList < String > ( available . size ( ) ) ; final List < String > supportedList = Arrays . asList ( supported ) ; for ( final String s : available ) { if ( supportedList . contains ( s...
Returns intersection of available and supported
2,944
public synchronized void addHandler ( final short packetID , final PacketHandler packetHandler ) { if ( registry . containsKey ( packetID ) ) throw new IllegalArgumentException ( "Handler for ID: " + packetID + " already exists" ) ; registry . put ( packetID , packetHandler ) ; }
Adds a new handler for this specific Packet ID
2,945
public synchronized PacketBuilder withByte ( final byte b ) { checkBuilt ( ) ; try { dataOutputStream . writeByte ( b ) ; } catch ( final IOException e ) { logger . error ( "Unable to add byte: {} : {}" , e . getClass ( ) , e . getMessage ( ) ) ; } return this ; }
Adds a byte
2,946
public synchronized PacketBuilder withBytes ( final byte [ ] b ) { checkBuilt ( ) ; try { dataOutputStream . writeInt ( b . length ) ; dataOutputStream . write ( b ) ; } catch ( final IOException e ) { logger . error ( "Unable to add bytes: {} : {}" , e . getClass ( ) , e . getMessage ( ) ) ; } return this ; }
Adds byte array
2,947
public synchronized PacketBuilder withInt ( final int i ) { checkBuilt ( ) ; try { dataOutputStream . writeInt ( i ) ; } catch ( final IOException e ) { logger . error ( "Unable to add integer: {} : {}" , e . getClass ( ) , e . getMessage ( ) ) ; } return this ; }
Adds an integer
2,948
public synchronized PacketBuilder withString ( final String s ) { try { withBytes ( s . getBytes ( "utf-8" ) ) ; } catch ( final UnsupportedEncodingException e ) { logger . error ( "UTF-8 encoding is not supported" ) ; } return this ; }
Adds a String
2,949
public synchronized PacketBuilder withBoolean ( final boolean b ) { checkBuilt ( ) ; try { dataOutputStream . writeBoolean ( b ) ; } catch ( final IOException e ) { logger . error ( "Unable to add boolean: {} : {}" , e . getClass ( ) , e . getMessage ( ) ) ; } return this ; }
Adds a boolean
2,950
public synchronized PacketBuilder withFloat ( final float f ) { checkBuilt ( ) ; try { dataOutputStream . writeFloat ( f ) ; } catch ( final IOException e ) { logger . error ( "Unable to add float: {} : {}" , e . getClass ( ) , e . getMessage ( ) ) ; } return this ; }
Adds a float
2,951
public synchronized PacketBuilder withDouble ( final double d ) { checkBuilt ( ) ; try { dataOutputStream . writeDouble ( d ) ; } catch ( final IOException e ) { logger . error ( "Unable to add double: {} : {}" , e . getClass ( ) , e . getMessage ( ) ) ; } return this ; }
Adds a double
2,952
public synchronized PacketBuilder withLong ( final long l ) { checkBuilt ( ) ; try { dataOutputStream . writeLong ( l ) ; } catch ( final IOException e ) { logger . error ( "Unable to add long: {} : {}" , e . getClass ( ) , e . getMessage ( ) ) ; } return this ; }
Adds a long
2,953
public synchronized PacketBuilder withShort ( final short s ) { checkBuilt ( ) ; try { dataOutputStream . writeShort ( s ) ; } catch ( final IOException e ) { logger . error ( "Unable to add short: {} : {}" , e . getClass ( ) , e . getMessage ( ) ) ; } return this ; }
Adds a short
2,954
public synchronized Packet build ( ) { checkBuilt ( ) ; isBuilt = true ; try { dataOutputStream . close ( ) ; } catch ( final IOException e ) { logger . error ( "Unable to build packet: {} : {}" , e . getClass ( ) , e . getMessage ( ) ) ; } return new Packet ( packetType , packetID , byteArrayOutputStream . toByteArray...
Builds Packet with given data
2,955
public void setTargetNormal ( double nx , double ny , double nz ) { double h , f , c , vx , vy , hvx ; vx = ny ; vy = - nx ; c = nz ; h = ( 1 - c ) / ( 1 - c * c ) ; hvx = h * vx ; f = ( c < 0 ) ? - c : c ; if ( f < 1.0 - 1.0E-4 ) { m00 = c + hvx * vx ; m01 = hvx * vy ; m02 = - vy ; m10 = hvx * vy ; m11 = c + h * vy * ...
Assumes target normal is normalized
2,956
public void insertPointAfter ( PolygonPoint a , PolygonPoint newPoint ) { int index = _points . indexOf ( a ) ; if ( index != - 1 ) { newPoint . setNext ( a . getNext ( ) ) ; newPoint . setPrevious ( a ) ; a . getNext ( ) . setPrevious ( newPoint ) ; a . setNext ( newPoint ) ; _points . add ( index + 1 , newPoint ) ; }...
Will insert a point in the polygon after given point
2,957
public void addPoint ( PolygonPoint p ) { p . setPrevious ( _last ) ; p . setNext ( _last . getNext ( ) ) ; _last . setNext ( p ) ; _points . add ( p ) ; }
Will add a point after the last point added
2,958
public void prepareTriangulation ( TriangulationContext < ? > tcx ) { int hint = _points . size ( ) ; if ( _steinerPoints != null ) { hint += _steinerPoints . size ( ) ; } if ( _holes != null ) { for ( Polygon p : _holes ) { hint += p . pointCount ( ) ; } } HashMap < TriangulationPoint , TriangulationPoint > uniquePts ...
Merge equals points . Creates constraints and populates the context with points .
2,959
public static void warmup ( ) { Polygon poly = PolygonGenerator . RandomCircleSweep2 ( 50 , 50000 ) ; TriangulationProcess process = new TriangulationProcess ( ) ; process . triangulate ( poly ) ; }
Will do a warmup run to let the JVM optimize the triangulation code
2,960
private void markNeighbor ( TriangulationPoint p1 , TriangulationPoint p2 , DelaunayTriangle t ) { if ( ( p1 == points [ 2 ] && p2 == points [ 1 ] ) || ( p1 == points [ 1 ] && p2 == points [ 2 ] ) ) { neighbors [ 0 ] = t ; } else if ( ( p1 == points [ 0 ] && p2 == points [ 2 ] ) || ( p1 == points [ 2 ] && p2 == points ...
Update neighbor pointers
2,961
public void clear ( ) { DelaunayTriangle t ; for ( int i = 0 ; i < 3 ; i ++ ) { t = neighbors [ i ] ; if ( t != null ) { t . clearNeighbor ( this ) ; } } clearNeighbors ( ) ; points [ 0 ] = points [ 1 ] = points [ 2 ] = null ; }
Clears all references to all other triangles and points
2,962
public DelaunayTriangle neighborCW ( TriangulationPoint point ) { if ( point == points [ 0 ] ) { return neighbors [ 1 ] ; } else if ( point == points [ 1 ] ) { return neighbors [ 2 ] ; } return neighbors [ 0 ] ; }
The neighbor clockwise to given point
2,963
public DelaunayTriangle neighborCCW ( TriangulationPoint point ) { if ( point == points [ 0 ] ) { return neighbors [ 2 ] ; } else if ( point == points [ 1 ] ) { return neighbors [ 0 ] ; } return neighbors [ 1 ] ; }
The neighbor counter - clockwise to given point
2,964
public DelaunayTriangle neighborAcross ( TriangulationPoint opoint ) { if ( opoint == points [ 0 ] ) { return neighbors [ 0 ] ; } else if ( opoint == points [ 1 ] ) { return neighbors [ 1 ] ; } return neighbors [ 2 ] ; }
The neighbor across to given point
2,965
public void legalize ( TriangulationPoint oPoint , TriangulationPoint nPoint ) { if ( oPoint == points [ 0 ] ) { points [ 1 ] = points [ 0 ] ; points [ 0 ] = points [ 2 ] ; points [ 2 ] = nPoint ; } else if ( oPoint == points [ 1 ] ) { points [ 2 ] = points [ 1 ] ; points [ 1 ] = points [ 0 ] ; points [ 0 ] = nPoint ; ...
Legalize triangle by rotating clockwise around oPoint
2,966
public void markNeighborEdges ( ) { for ( int i = 0 ; i < 3 ; i ++ ) { if ( cEdge [ i ] ) { switch ( i ) { case 0 : if ( neighbors [ 0 ] != null ) neighbors [ 0 ] . markConstrainedEdge ( points [ 1 ] , points [ 2 ] ) ; break ; case 1 : if ( neighbors [ 1 ] != null ) neighbors [ 1 ] . markConstrainedEdge ( points [ 0 ] ...
Finalize edge marking
2,967
public void markConstrainedEdge ( TriangulationPoint p , TriangulationPoint q ) { if ( ( q == points [ 0 ] && p == points [ 1 ] ) || ( q == points [ 1 ] && p == points [ 0 ] ) ) { cEdge [ 2 ] = true ; } else if ( ( q == points [ 0 ] && p == points [ 2 ] ) || ( q == points [ 2 ] && p == points [ 0 ] ) ) { cEdge [ 1 ] = ...
Mark edge as constrained
2,968
public int edgeIndex ( TriangulationPoint p1 , TriangulationPoint p2 ) { if ( points [ 0 ] == p1 ) { if ( points [ 1 ] == p2 ) { return 2 ; } else if ( points [ 2 ] == p2 ) { return 1 ; } } else if ( points [ 1 ] == p1 ) { if ( points [ 2 ] == p2 ) { return 0 ; } else if ( points [ 0 ] == p2 ) { return 2 ; } } else if ...
Get the neighbor that share this edge
2,969
public Future < Notice > report ( Throwable e ) { Notice notice = this . buildNotice ( e ) ; return this . send ( notice ) ; }
Asynchronously reports an exception to Airbrake .
2,970
public Future < Notice > send ( Notice notice ) { notice = this . filterNotice ( notice ) ; CompletableFuture < Notice > future = this . asyncSender . send ( notice ) ; final Notice finalNotice = notice ; future . whenComplete ( ( value , exception ) -> { this . applyHooks ( finalNotice ) ; } ) ; return future ; }
Asynchronously sends a Notice to Airbrake .
2,971
public Notice reportSync ( Throwable e ) { Notice notice = this . buildNotice ( e ) ; return this . sendSync ( notice ) ; }
Sychronously reports an exception to Airbrake .
2,972
public Notice sendSync ( Notice notice ) { notice = this . filterNotice ( notice ) ; notice = this . syncSender . send ( notice ) ; this . applyHooks ( notice ) ; return notice ; }
Synchronously sends a Notice to Airbrake .
2,973
protected void updateText ( ) { super . updateText ( ) ; _exampleInfo [ 3 ] . setText ( "[PageUp] Next model" ) ; _exampleInfo [ 4 ] . setText ( "[PageDown] Previous model" ) ; _exampleInfo [ 5 ] . setText ( "[1] Generate polygon type A " ) ; _exampleInfo [ 6 ] . setText ( "[2] Generate polygon type B " ) ; }
Update text information .
2,974
public static void mergeInstances ( Map < TriangulationPoint , TriangulationPoint > uniquePts , List < TriangulationPoint > ptList ) { for ( int idPoint = 0 ; idPoint < ptList . size ( ) ; idPoint ++ ) { TriangulationPoint pt = ptList . get ( idPoint ) ; TriangulationPoint uniquePt = uniquePts . get ( pt ) ; if ( uniqu...
Replace points in ptList for all equals object in uniquePts .
2,975
public static void updateTextureCoordinates ( Mesh mesh , List < DelaunayTriangle > triangles , double scale , double angle ) { TriangulationPoint vertex ; FloatBuffer tcBuf ; float width , maxX , minX , maxY , minY , x , y , xn , yn ; maxX = Float . NEGATIVE_INFINITY ; minX = Float . POSITIVE_INFINITY ; maxY = Float ....
For now very primitive!
2,976
private void buildSkyBox ( ) { _skybox = new Skybox ( "skybox" , 300 , 300 , 300 ) ; try { SimpleResourceLocator sr2 = new SimpleResourceLocator ( ExampleBase . class . getClassLoader ( ) . getResource ( "org/poly2tri/examples/geotools/textures/" ) ) ; ResourceLocatorTool . addResourceLocator ( ResourceLocatorTool . TY...
Builds the sky box .
2,977
public void addSection ( GSection section ) { section . setPosition ( sectionList . size ( ) ) ; LinearLayout . LayoutParams params = new LinearLayout . LayoutParams ( ViewGroup . LayoutParams . MATCH_PARENT , ( int ) ( 48 * density ) ) ; sectionList . add ( section ) ; sections . addView ( section . getView ( ) , para...
Method used for customize layout
2,978
public void setFileSize ( ) { if ( arr [ DatenFilm . FILM_GROESSE ] . isEmpty ( ) ) arr [ DatenFilm . FILM_GROESSE ] = FileSize . laengeString ( arr [ DatenFilm . FILM_URL ] ) ; }
Determine file size from remote location .
2,979
private void processFromFile ( String source , ListeFilme listeFilme ) { notifyProgress ( source , PROGRESS_MAX ) ; try ( InputStream in = selectDecompressor ( source , new FileInputStream ( source ) ) ; JsonParser jp = new JsonFactory ( ) . createParser ( in ) ) { readData ( jp , listeFilme ) ; } catch ( FileNotFoundE...
Read a locally available filmlist .
2,980
private void processFromWeb ( URL source , ListeFilme listeFilme ) { Request . Builder builder = new Request . Builder ( ) . url ( source ) ; builder . addHeader ( "User-Agent" , Config . getUserAgent ( ) ) ; InputStreamProgressMonitor monitor = new InputStreamProgressMonitor ( ) { private int oldProgress = 0 ; public ...
Download a process a filmliste from the web .
2,981
public boolean addWithCheck ( DatenFilmlisteUrl filmliste ) { for ( DatenFilmlisteUrl datenUrlFilmliste : this ) { if ( datenUrlFilmliste . arr [ DatenFilmlisteUrl . FILM_UPDATE_SERVER_URL_NR ] . equals ( filmliste . arr [ DatenFilmlisteUrl . FILM_UPDATE_SERVER_URL_NR ] ) ) { return false ; } } return add ( filmliste )...
ist die Liste mit den URLs zum Download einer Filmliste
2,982
private void insertDefaultActiveServers ( ) { listeFilmlistenUrls_akt . add ( new DatenFilmlisteUrl ( "http://m.picn.de/f/Filmliste-akt.xz" , DatenFilmlisteUrl . SERVER_ART_AKT ) ) ; listeFilmlistenUrls_akt . add ( new DatenFilmlisteUrl ( "http://m1.picn.de/f/Filmliste-akt.xz" , DatenFilmlisteUrl . SERVER_ART_AKT ) ) ;...
Add our default full list servers .
2,983
private void insertDefaultDifferentialListServers ( ) { listeFilmlistenUrls_diff . add ( new DatenFilmlisteUrl ( "http://m.picn.de/f/Filmliste-diff.xz" , DatenFilmlisteUrl . SERVER_ART_DIFF ) ) ; listeFilmlistenUrls_diff . add ( new DatenFilmlisteUrl ( "http://m1.picn.de/f/Filmliste-diff.xz" , DatenFilmlisteUrl . SERVE...
Add our default diff list servers .
2,984
public void updateURLsFilmlisten ( final boolean updateFullList ) { ListeFilmlistenUrls tmp = new ListeFilmlistenUrls ( ) ; if ( updateFullList ) { getDownloadUrlsFilmlisten ( Const . ADRESSE_FILMLISTEN_SERVER_AKT , tmp , Config . getUserAgent ( ) , DatenFilmlisteUrl . SERVER_ART_AKT ) ; if ( ! tmp . isEmpty ( ) ) { li...
Update the download server URLs .
2,985
private void parseServerEntry ( XMLStreamReader parser , ListeFilmlistenUrls listeFilmlistenUrls , String art ) { String serverUrl = "" ; String prio = "" ; int event ; try { while ( parser . hasNext ( ) ) { event = parser . next ( ) ; if ( event == XMLStreamConstants . START_ELEMENT ) { switch ( parser . getLocalName ...
Parse the server XML file .
2,986
private void buildColorMap ( ) { final NodeList styleData = doc . getElementsByTagName ( "tt:style" ) ; for ( int i = 0 ; i < styleData . getLength ( ) ; i ++ ) { final Node subnode = styleData . item ( i ) ; if ( subnode . hasAttributes ( ) ) { final NamedNodeMap attrMap = subnode . getAttributes ( ) ; final Node idNo...
Build a map of used colors within the TTML file .
2,987
public boolean parse ( Path ttmlFilePath ) { boolean ret ; try { final DocumentBuilderFactory dbf = DocumentBuilderFactory . newInstance ( ) ; dbf . setNamespaceAware ( true ) ; final DocumentBuilder db = dbf . newDocumentBuilder ( ) ; doc = db . parse ( ttmlFilePath . toFile ( ) ) ; final NodeList metaData = doc . get...
Parse the TTML file into internal representation .
2,988
public boolean parseXmlFlash ( Path ttmlFilePath ) { boolean ret ; try { final DocumentBuilderFactory dbf = DocumentBuilderFactory . newInstance ( ) ; dbf . setNamespaceAware ( true ) ; final DocumentBuilder db = dbf . newDocumentBuilder ( ) ; doc = db . parse ( ttmlFilePath . toFile ( ) ) ; final NodeList metaData = d...
Parse the XML Subtitle File for Flash Player into internal representation .
2,989
public void toSrt ( Path srtFile ) { try ( FileOutputStream fos = new FileOutputStream ( srtFile . toFile ( ) ) ; OutputStreamWriter osw = new OutputStreamWriter ( fos , Charset . forName ( "UTF-8" ) ) ; PrintWriter writer = new PrintWriter ( osw ) ) { long counter = 1 ; for ( Subtitle title : subtitleList ) { writer ....
Convert internal representation into SubRip Text Format and save to file .
2,990
private static long getFileSizeFromUrl ( String url ) { if ( ! url . toLowerCase ( ) . startsWith ( "http" ) ) { return - 1 ; } final Request request = new Request . Builder ( ) . url ( url ) . head ( ) . build ( ) ; long respLength = - 1 ; try ( Response response = MVHttpClient . getInstance ( ) . getReducedTimeOutCli...
Return the size of a URL in bytes .
2,991
private static String removeWindowsTrailingDots ( String fileName ) { while ( ! fileName . isEmpty ( ) && ( fileName . endsWith ( "." ) || fileName . endsWith ( " " ) ) ) { fileName = fileName . substring ( 0 , fileName . length ( ) - 1 ) ; } return fileName ; }
Remove stray trailing dots from string when we are on Windows OS .
2,992
public static String removeIllegalCharacters ( final String input , boolean isPath ) { String ret = input ; switch ( Functions . getOs ( ) ) { case MAC : case LINUX : ret = removeStartingDots ( ret ) ; ret = ret . replaceAll ( isPath ? REGEXP_ILLEGAL_CHARACTERS_OTHERS_PATH : REGEXP_ILLEGAL_CHARACTERS_OTHERS , "_" ) ; b...
Remove illegal characters from String based on current OS .
2,993
public static String replaceLeerDateiname ( String name , boolean isPath , boolean userReplace , boolean onlyAscii ) { String ret = name ; boolean isWindowsPath = false ; if ( SystemInfo . isWindows ( ) && isPath && ret . length ( ) > 1 && ret . charAt ( 1 ) == ':' ) { isWindowsPath = true ; ret = ret . replaceFirst ( ...
Entferne verbotene Zeichen aus Dateiname .
2,994
public static OperatingSystemType getOs ( ) { OperatingSystemType os = OperatingSystemType . UNKNOWN ; if ( System . getProperty ( "os.name" ) . toLowerCase ( ) . contains ( "windows" ) ) { if ( System . getenv ( "ProgramFiles(x86)" ) != null ) { os = OperatingSystemType . WIN64 ; } else if ( System . getenv ( "Program...
Detect and return the currently used operating system .
2,995
public int diffInSekunden ( ) { final int ret = new Long ( ( this . getTime ( ) - new Datum ( ) . getTime ( ) ) / ( 1000 ) ) . intValue ( ) ; return Math . abs ( ret ) ; }
Liefert den Betrag der Zeitdifferenz zu jetzt .
2,996
public void filmlisteSchreibenJsonCompressed ( String datei , ListeFilme listeFilme ) { final String tempFile = datei + "_temp" ; filmlisteSchreibenJson ( tempFile , listeFilme ) ; try { Log . sysLog ( "Komprimiere Datei: " + datei ) ; if ( datei . endsWith ( Const . FORMAT_XZ ) ) { final Path xz = testNativeXz ( ) ; i...
Write film data and compress with LZMA2 .
2,997
public synchronized void deleteAllFilms ( String sender ) { removeIf ( film -> film . arr [ DatenFilm . FILM_SENDER ] . equalsIgnoreCase ( sender ) ) ; }
Delete all films from specified sender .
2,998
public synchronized boolean isTooOldForDiff ( ) { if ( isEmpty ( ) ) { return true ; } try { final String dateMaxDiff_str = new SimpleDateFormat ( "yyyy.MM.dd__" ) . format ( new Date ( ) ) + Const . TIME_MAX_AGE_FOR_DIFF + ":00:00" ; final Date dateMaxDiff = new SimpleDateFormat ( "yyyy.MM.dd__HH:mm:ss" ) . parse ( da...
Check if Filmlist is too old for using a diff list .
2,999
public boolean isOlderThan ( int sekunden ) { int ret = getAge ( ) ; if ( ret != 0 ) { Log . sysLog ( "Die Filmliste ist " + ret / 60 + " Minuten alt" ) ; } return ret > sekunden ; }
Check if list is older than specified parameter .