code
stringlengths
10
174k
nl
stringlengths
3
129k
private static String logToXml(final String manufacturer,final String model,final String revision,final String swid,final String swVersion,final String exportVersion){ return String.format(LOG_XML,manufacturer,model,revision,swid,swVersion,exportVersion); }
Generates log file header
public static void dropTable(Database db,boolean ifExists){ String sql="DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TEST_DATA\""; db.execSQL(sql); }
Drops the underlying database table.
public byte readByte(){ return code[curBCI + 1]; }
Reads a signed, 1-byte value for the current instruction (e.g. BIPUSH).
public static void frequencies(DoubleArrayList sortedData,DoubleArrayList distinctValues,IntArrayList frequencies){ distinctValues.clear(); if (frequencies != null) frequencies.clear(); double[] sortedElements=sortedData.elements(); int size=sortedData.size(); int i=0; while (i < size) { double elemen...
Computes the frequency (number of occurances, count) of each distinct value in the given sorted data. After this call returns both <tt>distinctValues</tt> and <tt>frequencies</tt> have a new size (which is equal for both), which is the number of distinct values in the sorted data. <p> Distinct values are filled into <t...
public void removeStatementEventListener(StatementEventListener listener){ synchronized (this.statementEventListeners) { this.statementEventListeners.remove(listener); } }
Removes the specified <code>StatementEventListener</code> from the list of components that will be notified when the driver detects that a <code>PreparedStatement</code> has been closed or is invalid.
private void storeRequestId(String requestId,String key){ requestIds.put(requestId,key); }
Helper method to associate request ids to shared preference keys
public GitlabHTTPRequestor method(String method){ try { this.method=METHOD.valueOf(method).toString(); } catch ( IllegalArgumentException e) { throw new IllegalArgumentException("Invalid HTTP Method: " + method + ". Must be one of "+ METHOD.prettyValues()); } return this; }
Sets the HTTP Request method for the request. Has a fluent api for method chaining.
public static ValueTime fromNanos(long nanos){ return (ValueTime)Value.cache(new ValueTime(nanos)); }
Get or create a time value.
@SuppressWarnings({"ConstantConditions"}) public final void changeVariable(Node from,Node to){ if (!(from instanceof DiscreteVariable && to instanceof DiscreteVariable)) { throw new IllegalArgumentException("Only discrete variables supported."); } DiscreteVariable _from=(DiscreteVariable)from; DiscreteVaria...
Changes the variable for the given column from <code>from</code> to <code>to</code>. Supported currently only for discrete variables.
public void insertAttributeAt(Attribute att,int position){ if ((position < 0) || (position > m_Attributes.size())) { throw new IllegalArgumentException("Index out of range"); } att=(Attribute)att.copy(); freshAttributeInfo(); att.setIndex(position); m_Attributes.insertElementAt(att,position); for (int...
Inserts an attribute at the given position (0 to numAttributes()) and sets all values to be missing. Shallow copies the attribute before it is inserted, and performs a deep copy of the existing attribute information.
public static void murmurhash3_x64_128(byte[] key,int offset,int len,int seed,LongPair out){ long h1=seed & 0x00000000FFFFFFFFL; long h2=seed & 0x00000000FFFFFFFFL; final long c1=0x87c37b91114253d5L; final long c2=0x4cf5ad432745937fL; int roundedEnd=offset + (len & 0xFFFFFFF0); for (int i=offset; i < rounde...
Returns the MurmurHash3_x64_128 hash, placing the result in "out".
@Override public synchronized boolean previous() throws SQLException { return super.previous(); }
JDBC 2.0 <p> Moves to the previous row in the result set. </p> <p> Note: previous() is not the same as relative(-1) since it makes sense to call previous() when there is no current row. </p>
public void writeToLog(){ if (isThereNewErrors) { if (m_msgRepToMsgStatsMap.size() == 0) { statslogger.info("No Parser Errors on: " + s_dateTimeFormatter.print(DateTime.now())); } else { final List<MessageStats> statsArray=new ArrayList<MessageStats>(m_msgRepToMsgStatsMap.values()); Collect...
Write the content of this to a log file.
public static boolean isCacheSafe(Class<?> clazz,ClassLoader classLoader){ Assert.notNull(clazz,"Class must not be null"); ClassLoader target=clazz.getClassLoader(); if (target == null) { return false; } ClassLoader cur=classLoader; if (cur == target) { return true; } while (cur != null) { c...
Check whether the given class is cache-safe in the given context, i.e. whether it is loaded by the given ClassLoader or a parent of it.
private char[] fFormatDigits(double x){ String sx, sxOut; int i, j, k; int n1In, n2In; int expon=0; boolean minusSign=false; if (x > 0.0) sx=Double.toString(x); else if (x < 0.0) { sx=Double.toString(-x); minusSign=true; } else { sx=Double.toString(x); if (sx.charAt(0) == '-') { ...
For f format, the flag character '-', means that the output should be left justified within the field. The default is to pad with blanks on the left. '+' character means that the conversion will always begin with a sign (+ or -). The blank flag character means that a non-negative input will be preceded with a blank....
public Constants.ExecutionMode executionMode(){ return executionMode; }
Returns the execution mode of this Interpreter.
public void deleteTag(){ for ( final ITagListener listener : m_listeners) { try { listener.deletedTag(this); } catch ( final Exception exception) { CUtilityFunctions.logException(exception); } } }
Deletes a tag from the database.
public static void main(String[] args){ SimpleCommandLineParser parser=new SimpleCommandLineParser(args); String userName=parser.getValue("username","user","u"); String userPassword=parser.getValue("password","pass","p"); boolean help=parser.containsKey("help","h"); if (help || (userName == null) || (userPass...
Uses the command line arguments to authenticate the GoogleService and build the basic feed URI, then invokes all the other methods to demonstrate how to interface with the Blogger service.
@Override public void authorizeRequest(Operation op){ op.complete(); }
Authorization processing happens during the state loading phase of request handling. This method always immediately completes the operation
public void accumulateAll(List<TaggedLogAPIEntity> entities) throws Exception { for ( TaggedLogAPIEntity entity : entities) { accumulate(entity); } }
accumulate a list of entities
public static void skipFields(@Nonnull DexReader reader,int count){ for (int i=0; i < count; i++) { reader.skipUleb128(); reader.skipUleb128(); } }
Skips the reader over the specified number of encoded_field structures
public void writeSI16(short value) throws IOException { flushBits(); out.write(value & 0xff); out.write(value >> 8); bytesWritten+=2; }
Write a 16 bit signed value to the out stream
public static Cursor convertCursor(Element e,BridgeContext ctx){ return ctx.getCursorManager().convertCursor(e); }
Returns the Cursor corresponding to the input element's cursor property
public synchronized void processResponse(StunResponseEvent response){ receivedResponses.add(response); notifyAll(); }
Stores incoming responses.
private void initRange(){ mMinValue=MathHelper.NULL_VALUE; mMaxValue=-MathHelper.NULL_VALUE; int length=getItemCount(); for (int k=0; k < length; k++) { updateRange(getValue(k)); } }
Initializes the values range.
public VCard(VCard original){ version=original.version; for ( VCardProperty property : original.getProperties()) { addProperty(property.copy()); } }
Creates a deep copy of the given vCard.
public static CommandResult execCommand(List<String> commands,boolean isRoot){ return execCommand(commands == null ? null : commands.toArray(new String[]{}),isRoot,true); }
execute shell commands, default return result msg
public List put(String parsedModule,List listOfParsedModules){ if (parsedModule == null || listOfParsedModules == null) { return new Vector(0); } List oldValues=parseFailed(parsedModule); moduleStore.put(parsedModule,listOfParsedModules); return oldValues; }
Saves the new module dependency list, returns the old list.
@Override public String toString(){ if (jar != null) { init(); } return "package " + name + (specTitle != null ? " " + specTitle : "")+ (specVersion != null ? " " + specVersion : ""); }
Answers a string containing a concise, human-readable description of the receiver.
boolean isHot(){ return queueNext == null; }
Whether this entry is hot. Cold entries are in one of the two queues.
public void toEPL(StringWriter writer){ if (numRowsVariable != null) { writer.write(numRowsVariable); } else { if (numRows != null) { writer.write(Integer.toString(numRows)); } else { writer.write(Integer.toString(Integer.MAX_VALUE)); } } if (optionalOffsetRowsVariable != null) { ...
Renders the clause in textual representation.
public GridByteArrayOutputStream(){ this(32); }
Creates a new byte array output stream. The buffer capacity is initially 32 bytes, though its size increases if necessary.
private Queue configureMQQueue(MQQueue queue) throws JMSException { if (Config.parms.getBoolean("jg")) { queue.setTargetClient(CommonConstants.WMQ_CLIENT_NONJMS_MQ); } if (Config.parms.getBoolean("jf")) { setPutAsyncAllowed(queue); } if (Config.parms.getBoolean("jy")) { setReadAheadAllowed(queue);...
Apply vendor-specific settings to all queues.
public static MemberExistsResult methodExists(String methodName,JavacNode node,boolean caseSensitive,int params){ node=upToTypeNode(node); if (node != null && node.get() instanceof JCClassDecl) { top: for ( JCTree def : ((JCClassDecl)node.get()).defs) { if (def instanceof JCMethodDecl) { JC...
Checks if there is a method with the provided name. In case of multiple methods (overloading), only the first method decides if EXISTS_BY_USER or EXISTS_BY_LOMBOK is returned.
public static int compile(String[] args){ com.redhat.ceylon.compiler.java.launcher.Main compiler=new com.redhat.ceylon.compiler.java.launcher.Main("ceylonc"); return compiler.compile(args).exitCode; }
Programmatic interface to the Java Programming Language compiler, javac.
private static DataRefType dataRef(String fileName,byte[] digest){ DataRefType dataRef=new DataRefType(); dataRef.setURI(fileName); dataRef.setDigestValue(digest); return dataRef; }
Creates reference to input data with given file name.
void encryptBlock(byte[] in,int inOfs,byte[] out,int outOfs){ int R0=(in[inOfs] & 0xff) + ((in[inOfs + 1] & 0xff) << 8); int R1=(in[inOfs + 2] & 0xff) + ((in[inOfs + 3] & 0xff) << 8); int R2=(in[inOfs + 4] & 0xff) + ((in[inOfs + 5] & 0xff) << 8); int R3=(in[inOfs + 6] & 0xff) + ((in[inOfs + 7] & 0xff) << 8); ...
Encrypt a single block. Note that in a few places we omit a "& 0xffff" and allow variables to become larger than 16 bit. This still works because there is never a 32 bit overflow.
protected void closeFrame(JInternalFrame f){ BasicLookAndFeel.playSound(frame,"InternalFrame.closeSound"); getDesktopManager().closeFrame(f); }
This method is called when the user wants to close the frame. The <code>playCloseSound</code> Action is fired. This action is delegated to the desktopManager.
public CTraceEventsTableFilterMenu(final JTextField filterField){ add(new CFilterByMemoryAction(filterField)); add(new CFilterByRegisterAction(filterField)); }
Creates a new menu object.
public int hashCode(){ int myPosition=position; int hash=0; while (myPosition < limit) { hash=hash + get(myPosition++); } return hash; }
Calculates this buffer's hash code from the remaining chars. The position, limit, capacity and mark don't affect the hash code.
protected boolean convertToUppercase(){ return false; }
Method convertToUppercase.
@action(name="request",args={@arg(name=GamaMessageType.MESSAGE_STR,type=IType.MESSAGE,optional=false,doc=@doc("The message to be replied")),@arg(name=GamaMessage.CONTENTS,type=IType.LIST,optional=false,doc=@doc("The content of the replying message"))},doc=@doc("Replies a message with a 'request' performative message.")...
Prim request.
public static void updateCommit(CommitUpdateCommand cmd,SolrParams params){ if (params == null) return; cmd.openSearcher=params.getBool(UpdateParams.OPEN_SEARCHER,cmd.openSearcher); cmd.waitSearcher=params.getBool(UpdateParams.WAIT_SEARCHER,cmd.waitSearcher); cmd.softCommit=params.getBool(UpdateParams.SOFT_CO...
Modify UpdateCommand based on request parameters
public Cursor newCursor(String storeName) throws UnknownStoreException { IStore<ByteArray,byte[]> store=getStore(storeName); int cursorId=rpcService.getTransactionId(); Cursor cursor=new Cursor(cursorId,store.entries()); cursorMap.put(Integer.valueOf(cursorId),cursor); return cursor; }
Allocate a new cursor for the given store name
public int equivHashCode(){ if (sourcename instanceof Value) return ((Value)sourcename).equivHashCode(); return sourcename.hashCode(); }
Returns a hash code consistent with structural equality for this object.
public void removed(java.awt.Container cont){ if (dataHandlers != null) { for ( LocationHandler dataHandler : dataHandlers) { dataHandler.removed(cont); } } }
Let the LocationHandlers know that the layer has been removed.
public ModuleTargetSettings(final INaviModule module){ this.module=module; }
Creates a new module target object.
public MAttributeInstance(Properties ctx,int M_Attribute_ID,int M_AttributeSetInstance_ID,int M_AttributeValue_ID,String Value,String trxName){ super(ctx,0,trxName); setM_Attribute_ID(M_Attribute_ID); setM_AttributeSetInstance_ID(M_AttributeSetInstance_ID); setM_AttributeValue_ID(M_AttributeValue_ID); setValu...
Selection Value Constructior
public void runTest() throws Throwable { Document doc; NodeList elementList; Element testEmployee; Attr streetAttr; String attribute; Attr removedAttr; doc=(Document)load("staff",true); elementList=doc.getElementsByTagName("address"); testEmployee=(Element)elementList.item(2); streetAttr=testEmploye...
Runs the test case.
public static void waitElementToNotBeVisible(SearchContext parent,By by,int waitInSeconds){ Preconditions.checkNotNull(parent); Preconditions.checkNotNull(by); try { WebElementWait wait=new WebElementWait(parent,waitInSeconds); wait.until(null); } catch ( TimeoutException e) { throw new TimeoutExc...
Will wait until no element identified by the by is visible.
public static boolean lock() throws IOException { if (locked) return true; if (lock.exists()) return false; lock.createNewFile(); lock.deleteOnExit(); locked=true; return true; }
Creates the lock file if it's not present and requests its deletion on program termination or informs that the program is already running if that's the case.
public AddressSpaceCallResolverTarget(final AddressSpace addressSpace){ this.addressSpace=addressSpace; addressSpace.addListener(internalAddressSpaceListener); }
Creates a new call resolver target.
public static AST Explode(AST ast,PcalSymTab symtab) throws PcalTranslateException { st=symtab; currentProcedure=null; if (ast.getClass().equals(AST.UniprocessObj.getClass())) return ExplodeUniprocess((AST.Uniprocess)ast); else if (ast.getClass().equals(AST.MultiprocessObj.getClass())) return ExplodeMultip...
Explode
public static JavaPairRDD<MatrixIndexes,MatrixBlock> copyBinaryBlockMatrix(JavaPairRDD<MatrixIndexes,MatrixBlock> in,boolean deep){ if (!deep) return in.mapValues(new CopyBlockFunction(false)); else return in.mapPartitionsToPair(new CopyBlockPairFunction(deep),true); }
Creates a partitioning-preserving copy of the input matrix RDD. If a deep copy is requested, indexes and values are copied, otherwise they are simply passed through.
private static ICloseableIterator<IBindingSet> iterator(final IRunningQuery runningQuery){ final ICloseableIterator<IBindingSet[]> it1=runningQuery.iterator(); final ICloseableIterator<IBindingSet> it2=new Dechunkerator<IBindingSet>(it1); final ICloseableIterator<IBindingSet> it3=new RunningQueryCloseableIterator...
Dechunkify the running query and monitor the Sesame iterator.
@Override public void init(final FilterConfig config){ LOG.info("Starting Session Filter initialization"); this.filterConfig=config; if (started.getAndDecrement() > 0) { String managerClassStr=config.getInitParameter("session-manager-class"); if (managerClassStr == null) { managerClassStr=GemfireSes...
This is where all the initialization happens.
private void testStringMissingSortedFirst(SortField.Type sortType) throws IOException { Directory dir=newDirectory(); RandomIndexWriter writer=new RandomIndexWriter(random(),dir); Document doc=new Document(); writer.addDocument(doc); doc=new Document(); doc.add(newStringField("value","foo",Field.Store.YES))...
Tests sorting on type string with a missing value sorted first
public void testEnablePan(){ int iterations=BluetoothTestRunner.sEnablePanIterations; if (iterations == 0) { return; } BluetoothAdapter adapter=BluetoothAdapter.getDefaultAdapter(); mTestUtils.disable(adapter); mTestUtils.enable(adapter); mTestUtils.disablePan(adapter); for (int i=0; i < iterations;...
Stress test for enabling and disabling the PAN NAP profile.
public NoWhitespaceValidator(@NonNull final Context context,@StringRes final int resourceId){ super(context,resourceId); }
Creates a new validator, which allows to validate texts to ensure, that they contain no whitespace.
private void updateInternalMask() throws ParseException { String mask=getMask(); ArrayList<MaskCharacter> fixed=new ArrayList<MaskCharacter>(); ArrayList<MaskCharacter> temp=fixed; if (mask != null) { for (int counter=0, maxCounter=mask.length(); counter < maxCounter; counter++) { char maskChar=mask.c...
Updates the internal representation of the mask.
public Constant(boolean value){ this(Boolean.class,value); }
Constructs a new node for defining a constant boolean value.
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE",justification="CarManager only provides Car Objects") public void buildSwitchList(Location location){ boolean newTrainsOnly=!Setup.isSwitchListRealTime(); boolean append=false; boolean checkFormFeed=true; if (newTrai...
Builds a switch list for a location showing the work by train arrival time. If not running in real time, new train work is appended to the end of the file. User has the ability to modify the text of the messages which can cause an IllegalArgumentException. Some messages have more arguments than the default message allo...
@Override public boolean execute(final String[] params,final String remainder){ final String[] lines={"For a detailed reference, visit #http://stendhalgame.org/wiki/Stendhal_Manual","Here are the most-used commands:","* Chatting: ","- /me <action> \t\tShow a message about what you are doing","- /tell <player> <messag...
Execute a chat command.
private PathPoint func_186328_b(int x,int y,int z){ int i=this.func_186327_c(x,y,z); return i == -1 ? this.openPoint(x,y,z) : null; }
Returns a point that the entity can safely move to
public static String formatPeriod(final long startMillis,final long endMillis,final String format){ return formatPeriod(startMillis,endMillis,format,true,TimeZone.getDefault()); }
<p>Formats the time gap as a string, using the specified format. Padding the left hand side of numbers with zeroes is optional.
protected long unwrapValue(Object value){ return ((Long)value).longValue(); }
Unwraps a value
private void fillAddress(String address) throws Exception { AmqpClient client=new AmqpClient(new URI(tcpAmqpConnectionUri),userName,password); AmqpConnection amqpConnection=client.connect(); Exception exception=null; try { AmqpSession session=amqpConnection.createSession(); AmqpSender sender=session.cre...
Fills an address. Careful when using this method. Only use when rejected messages are switched on.
@Override public void parse(InputStream in,String baseURI) throws IOException, RDFParseException, RDFHandlerException { if (in == null) { throw new IllegalArgumentException("Input stream cannot be 'null'"); } if (baseURI == null) { throw new IllegalArgumentException("Base URI cannot be 'null'"); } Inp...
Parses the data from the supplied InputStream, using the supplied baseURI to resolve any relative URI references.
public boolean isWhitespaceInElementContent(){ return false; }
DOM Level 3 Returns whether this text node contains whitespace in element content, often abusively called "ignorable whitespace".
protected void exportArcs1(){ PrintStream out=null; double lt; double ln; double ll[]; int llsize; int n; File f=chooseFile(1); if (arcs == null) return; if (f == null) return; try { out=new PrintStream(new FileOutputStream(f)); } catch ( IOException e) { System.out.println(e); r...
Description of the Method
public InternalListener(final ConfigManager configFile){ this.configFile=configFile; }
Creates a new listener object.
public List<CustomFormatter> customFormatters(){ return subresources().customFormatters(); }
Get the list of CustomFormatter configurations
public static strictfp double pow3_strict(final double a){ return a * a * a; }
Strict version.
@SuppressWarnings("unchecked") public String strLabeling(String data){ List lblSeqs=seqLabeling(data); String ret=dataWriter.writeString(lblSeqs); return ret; }
labeling observation sequences.
public int rhs_length(){ return _rhs_length; }
How much of the right hand side array we are presently using.
private static final int checkDirection(Position pos,int sq,int maxSteps,int delta){ while (maxSteps > 0) { sq+=delta; int p=pos.getPiece(sq); if (p != Piece.EMPTY) return p; maxSteps--; } return Piece.EMPTY; }
Check if there is an attacking piece in a given direction starting from sq. The direction is given by delta.
void addDepType(int type){ flags|=type; }
Augment the type of the dependence edge.
public boolean isEnabled(){ return mDrawable != null && mEnabled; }
Returns true if this target is enabled. Typically an enabled target contains a valid drawable in a valid state. Currently all targets with valid drawables are valid.
public Name findName(int firstQuad){ int hash=calcHash(firstQuad); int ix=(hash & _mainHashMask); int val=_mainHash[ix]; if ((((val >> 8) ^ hash) << 8) == 0) { Name name=_mainNames[ix]; if (name == null) { return null; } if (name.equals(firstQuad)) { return name; } } else if...
Finds and returns name matching the specified symbol, if such name already exists in the table. If not, will return null. <p> Note: separate methods to optimize common case of short element/attribute names (4 or less ascii characters)
public JailAction(final int minutes,final String reason){ this.minutes=minutes; this.reason=checkNotNull(reason); }
Creates a new JailAction.
public XmlHandler addAnnotatedClass(){ try { List<Class<?>> annotatedClasses=FilesManager.annotatedClasses(); addClasses(true,annotatedClasses.toArray(new Class[annotatedClasses.size()])); } catch ( Exception e) { JmapperLog.ERROR(e); } return this; }
Add all Annotated classes to Xml Configuration.
private void returnData(Object ret){ if (myHost != null) { myHost.returnData(ret); } }
Used to communicate a return object from a plugin tool to the main Whitebox user-interface.
protected void computeAxisValues(float min,float max){ float yMin=min; float yMax=max; int labelCount=mYAxis.getLabelCount(); double range=Math.abs(yMax - yMin); if (labelCount == 0 || range <= 0) { mYAxis.mEntries=new float[]{}; mYAxis.mEntryCount=0; return; } double rawInterval=range / label...
Sets up the y-axis labels. Computes the desired number of labels between the two given extremes. Unlike the papareXLabels() method, this method needs to be called upon every refresh of the view.
public synchronized void addYTextLabel(double y,String text,int scale){ mYTextLabels.get(scale).put(y,text); }
Adds a new text label for the specified Y axis value.
@Override public void JSR(){ throw new UnsupportedOperationException("Implement ME!"); }
Unconditional jump (to sub-routine, finally block) Pushes address onto operand stack, which finally block will astore. ... ==> ..., address http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2. doc7.html#jsr
public static List<Long> grubbsTest(GeoTimeSerie gts,boolean useMedian,double alpha) throws WarpScriptException { doubleCheck(gts); List<Long> anomalous_ticks=new ArrayList<Long>(); int N=gts.values; if (N < 3) { return anomalous_ticks; } double[] musigma=madsigma(gts,useMedian); double m=musigma[0]; ...
Applying Grubbs' test using mean/std or median/mad
public static final void devicePermissionAuth(Context context,String productKey,String accessToken,String identifier,String userPhone,int privilege,AsyncHttpResponseHandler responseHandler){ List<Header> headerList=new ArrayList<Header>(); headerList.add(new BasicHeader(ApiKey.HeadKey.PRODUCT_KEY,productKey)); he...
add device access authorization (/v1/devices/{identifier}/permissions)
protected int lookupState(int state,int category){ return stateTable[state * numCategories + category]; }
Given a current state and a character category, looks up the next state to transition to in the state table.
public AccountNotFoundException(){ super(); }
Constructs a AccountNotFoundException with no detail message. A detail message is a String that describes this particular exception.
@Override public void checkRights(T entity){ }
Empty by default. Override this in subclasses to check user rights.
public boolean isProcessing(){ Object oo=get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
Get Process Now.
public static long safeMultiply(long val1,long val2){ if (val2 == 1) { return val1; } if (val1 == 1) { return val2; } if (val1 == 0 || val2 == 0) { return 0; } long total=val1 * val2; if (total / val2 != val1 || val1 == Long.MIN_VALUE && val2 == -1 || val2 == Long.MIN_VALUE && val1 == -1) { ...
Multiply two values throwing an exception if overflow occurs.
public static String replace(String text,char repl,char with,int max){ return replace(text,String.valueOf(repl),String.valueOf(with),max); }
<p> Replace a char with another char inside a larger String, for the first <code>max</code> values of the search char. </p> <p/> <p> A <code>null</code> reference passed to this method is a no-op. </p>
protected void testCopy(FileConfig fileConfig,String expectedFilePath,String expectedFileContents) throws Exception { configuration.setFileProperty(fileConfig); configuration.doConfigure(null); File copiedFile=new File(configuration.getHome() + "/" + expectedFilePath); assertTrue("Cannot find the expected copie...
Test file copy.
public int countNumberOfLines() throws IOException { if (lineCount == -1) { int count=0; try (FileChannel fc=new RandomAccessFile(dataFile.toFile(),"r").getChannel()){ MappedByteBuffer buffer=fc.map(FileChannel.MapMode.READ_ONLY,0,fc.size()); byte prevChar=NEW_LINE; while (buffer.hasRemainin...
Count number of lines that contain data.
public void useProject(String projectName){ removeProject(projectName); recentProjectsList.addFirst(projectName); while (recentProjectsList.size() > MAX_RECENT_FILES) { recentProjectsList.removeLast(); } }
Add given project filename to the front of the recently-used project list.
public Long removeClientFromChatNotification(){ try { IConnection current=Red5.getConnectionLocal(); RoomClient currentClient=this.clientListManager.getClientByStreamId(current.getClient().getId()); String streamid=currentClient.getStreamid(); currentClient.setIsChatNotification(false); currentCli...
remove's a Client from the additional List of users to chat
public boolean zoneExportMasksCreate(URI exportGroupURI,List<URI> exportMaskURIs,Collection<URI> volumeURIs,String token){ ExportGroup exportGroup=null; try { exportGroup=_dbClient.queryObject(ExportGroup.class,exportGroupURI); _log.info(String.format("Entering zoneExportMasksCreate for ExportGroup: %s (%s)...
Creates zones for one or more newly created ExportMasks. Each ExportMask is assumed to have a zoningMap that indicates which initiators should be zoned to which ports. This routine will create zones for each of the ExportMasks according to their zoningMap. The zones will assume to be used to access the Volumes in the i...
public static String replace(String text,char repl,char with){ return replace(text,repl,with,-1); }
<p> Replace all occurances of a char within another char. </p> <p/> <p> A <code>null</code> reference passed to this method is a no-op. </p>
private boolean isTarget(TypedBlock cur,TypedBlock prev){ int in=cur.incoming; if (in > 1) return true; else if (in < 1) return false; return prev.stop; }
Returns true if cur is a branch target.