code stringlengths 10 174k | nl stringlengths 3 129k |
|---|---|
public static XContentBuilder yamlBuilder(OutputStream os) throws IOException {
return new XContentBuilder(YamlXContent.yamlXContent,os);
}
| Constructs a new yaml builder that will output the result into the provided output stream. |
public boolean isAttribute(String s){
if (name.length == s.length()) {
for (int i=0; i < name.length; i++) {
if (name[i] != s.charAt(i)) {
return false;
}
}
return true;
}
return false;
}
| Tells whether the name of the attribute represented by this class equals the given string. |
void selectTab(Tab t){
Component[] components=getComponents();
JPanel buttonContainer=(JPanel)components[1];
Component[] buttons=buttonContainer.getComponents();
for ( Component c : buttons) {
if (c instanceof AbstractButton) {
AbstractButton b=(AbstractButton)c;
if (b.getClientProperty("tab").... | Given a Tab mark that button as selected Since we don't keep explicit references to the buttons this method walks over the components in the ApplicationHeader until it finds the AbstractButton that has the Tab object as a client property named "tab" |
public tbody addElement(String hashcode,String element){
addElementToRegistry(hashcode,element);
return (this);
}
| Adds an Element to the element. |
public static void showGraphSettingsDialog(final JFrame parent,final ZyGraph graph){
final CGraphSettingsDialog dlg=new CGraphSettingsDialog(parent,"Graph Settings",graph.getSettings(),false,false);
dlg.setVisible(true);
if (!dlg.wasCanceled()) {
if (graph.getSettings().getLayoutSettings().getCurrentLayouter(... | Shows the graph settings dialog for a given graph. |
public void remove(){
if (this.lastReturned == null) {
throw new IllegalStateException();
}
if (this.lastReturned == SimpleList.this.root) {
SimpleList.this.removeFirst();
}
else {
SimpleList.this.remove(this.lastReturned);
}
}
| Remove the last returned element. |
public static void logError(final Logger logger,final Error e){
logger.logError(Level.SEVERE,"Unexpected Error",e);
}
| Logs an error. |
public DenseDoubleMatrix2D(double[][] values){
this(values.length,values.length == 0 ? 0 : values[0].length);
assign(values);
}
| Constructs a matrix with a copy of the given values. <tt>values</tt> is required to have the form <tt>values[row][column]</tt> and have exactly the same number of columns in every row. <p> The values are copied. So subsequent changes in <tt>values</tt> are not reflected in the matrix, and vice-versa. |
public DoubleMatrix2D like2D(int rows,int columns){
return content.like2D(rows,columns);
}
| Construct and returns a new 2-d matrix <i>of the corresponding dynamic type</i>, entirelly independent of the receiver. For example, if the receiver is an instance of type <tt>DenseDoubleMatrix1D</tt> the new matrix must be of type <tt>DenseDoubleMatrix2D</tt>, if the receiver is an instance of type <tt>SparseDoubleMat... |
public void removeAllListeners(){
clientgui.getClient().getGame().removeGameListener(this);
clientgui.getBoardView().removeBoardViewListener(this);
clientgui.mechD.wPan.weaponList.removeListSelectionListener(this);
}
| Stop just ignoring events and actually stop listening to them. |
public static String rawToAsciiString(byte[] quality,int length){
return rawToAsciiString(quality,0,length);
}
| Converts an array of bytes into a sanger-encoded quality string |
public void testNoHotBackupAvailable() throws Exception {
TungstenProperties props=createProperties("testConfig",false);
BackupManager bmgr=new BackupManager(new MockEventDispatcher());
bmgr.initialize(props);
try {
bmgr.spawnBackup("foo","file",true);
throw new Exception("Backup spawned when online");
... | Verify that backups that are not enabled for hot backup fail if we try to run them hot. |
static void addTimestampReturningFormat(StringBuilder sb){
OracleDatabaseImpl.addTimestampFormat(sb,JDBC_WORKAROUND);
}
| Add a RETURNING statement timestamp format which may use a work-around. This then requires using getTimestamp() to get a proper string. |
public Attendee addAttendee(String email){
Attendee prop=new Attendee(null,email,null);
addAttendee(prop);
return prop;
}
| Adds a person who is involved in the to-do task. |
public static Font showDialog(Dialog owner,String title,Font initFont){
Font retValue=initFont;
FontChooser fc=new FontChooser(owner,title,initFont);
retValue=fc.getFont();
fc=null;
return retValue;
}
| Show Dialog with initial font and return selected font |
private void createNotification(final int messageResId,final int defaults){
final Intent parentIntent=new Intent(this,FeaturesActivity.class);
parentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
final Intent targetIntent=new Intent(this,HTSActivity.class);
final Intent disconnect=new Intent(ACTION_DISCONNECT)... | Creates the notification |
private int measureLong(int measureSpec){
int result;
int specMode=MeasureSpec.getMode(measureSpec);
int specSize=MeasureSpec.getSize(measureSpec);
if ((specMode == MeasureSpec.EXACTLY) || (mViewPager == null)) {
result=specSize;
}
else {
final int count=mViewPager.getAdapter().getCount();
result... | Determines the width of this view |
protected production_part add_lab(production_part part,String lab) throws internal_error {
if (lab == null || part.is_action()) return part;
return new symbol_part(((symbol_part)part).the_symbol(),lab);
}
| helper routine to clone a new production part adding a given label |
public OMGraphicList init(){
OMGraphicList omList=new OMGraphicList();
OMLine line=new OMLine(40f,-75f,42f,-70f,OMGraphic.LINETYPE_GREATCIRCLE);
line.setStroke(new BasicStroke(2));
line.putAttribute(OMGraphicConstants.LABEL,new OMTextLabeler("Line Label"));
line.setLinePaint(Color.red);
line.setSelectPaint(... | Called from the prepare() method if the layer discovers that its OMGraphicList is null. This method is being overridden so that TOOLTIPS can be set as attributes on the OMGraphics, and retrieved later in the gesturing queries. |
Cursor find(Session session,ValueLong first,ValueLong last){
TransactionMap<Value,Value> map=getMap(session);
return new MVStoreCursor(session,map.entryIterator(first),last);
}
| Search for a specific row or a set of rows. |
private InputStream openStream() throws IOException, MalformedURLException {
InputStream inputStream=null;
if (DataUri.isDataUri(mUrl)) {
DataUri dataUri=new DataUri(mUrl);
inputStream=new ByteArrayInputStream(dataUri.getData());
}
else {
URL url=new URL(mUrl);
inputStream=url.openStream();
}
... | Opens the input stream for the URL that the class should use to set the wallpaper. Abstracts the difference between standard URLs and data URLs. |
@Override public void translate(final ITranslationEnvironment environment,final IInstruction instruction,final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment,instruction,instructions,"SXTH");
translateAll(environment,instruction,"SX... | SXTH{<cond>} <Rd>, <Rm>{, <rotation>} Operation: if ConditionPassed(cond) then operand2 = Rm Rotate_Right(8 * rotate) Rd[31:0] = SignExtend(operand2[15:0]) |
public boolean writeComment(String taskId,ReviewComment comment){
if (!displayWriteWarning(WRITE_COMMENTS_WARNING)) {
return false;
}
try {
gitClient.writeComment(taskId,comment);
}
catch ( GitClientException e) {
AppraiseConnectorPlugin.logError("Error writing comment for " + taskId,e);
retur... | Writes a comment to the specified review. |
public boolean hasBlueLine(){
return this.hasExtraFeatures();
}
| Check if the SPROG has blueline decoder mode. |
public SVGPath drawTo(double x,double y){
return !isStarted() ? moveTo(x,y) : lineTo(x,y);
}
| Draw a line given a series of coordinates. Helper function that will use "move" for the first point, "lineto" for the remaining. |
public CorsServiceBuilder disablePreflightResponseHeaders(){
preflightResponseHeadersDisabled=true;
return this;
}
| Specifies that no preflight response headers should be added to a preflight response. |
public JSONArray put(int index,boolean value) throws JSONException {
this.put(index,value ? Boolean.TRUE : Boolean.FALSE);
return this;
}
| Put or replace a boolean value in the JSONArray. If the index is greater than the length of the JSONArray, then null elements will be added as necessary to pad it out. |
public BootstrapService(){
this.username=null;
this.password=null;
this.apiKey=null;
}
| Create bootstrap service |
private void displayAllStringDefinedInStringXml(){
SimpleIconFontTextView textView=(SimpleIconFontTextView)findViewById(R.id.text_view_2);
List<String> list=new ArrayList<>();
list.add(getString(R.string.cubeicon_gems_logo));
list.add(getString(R.string.cubeicon_android));
list.add(getString(R.string.cubeicon... | display the string defined in the string xml file: iconfont_string.xml |
public void execute(TransformerImpl transformer) throws TransformerException {
if (transformer.getStylesheet().isSecureProcessing()) throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING,new Object[]{getRawName()}));
try {
transformer... | Execute an extension. |
public void importPackage(String packageName){
importedPackages.add(packageName);
}
| Record a package name so that the Javassist compiler searches the package to resolve a class name. Don't record the <code>java.lang</code> package, which has been implicitly recorded by default. <p>Since version 3.14, <code>packageName</code> can be a fully-qualified class name. <p>Note that <code>get()</code> in <code... |
public static boolean isLocalAddress(Socket socket) throws UnknownHostException {
InetAddress test=socket.getInetAddress();
if (test.isLoopbackAddress()) {
return true;
}
InetAddress localhost=InetAddress.getLocalHost();
String host=localhost.getHostAddress();
for ( InetAddress addr : InetAddress.getAl... | Check if a socket is connected to a local address. |
@Override public boolean execute(String sql,int autoGeneratedKeys) throws SQLException {
try {
if (isDebugEnabled()) {
debugCode("execute(" + quote(sql) + ", "+ autoGeneratedKeys+ ");");
}
return executeInternal(sql);
}
catch ( Exception e) {
throw logAndConvert(e);
}
}
| Executes a statement and returns the update count. This method just calls execute(String sql) internally. The method getGeneratedKeys supports at most one columns and row. |
@Override public String toString(){
if (m_bagger == null) {
return "Random forest not built yet";
}
else {
StringBuffer temp=new StringBuffer();
temp.append("Random forest of " + m_numTrees + " trees, each constructed while considering "+ m_KValue+ " random feature"+ (m_KValue == 1 ? "" : "s")+ ".\n"+ ... | Outputs a description of this classifier. |
private static int capAtMaximumSize(int queueSize,int maximumSize){
return Math.min(queueSize - 1,maximumSize) + 1;
}
| There's no reason for the queueSize to ever be more than maxSize + 1 |
public boolean removeDataChannel(){
if (TextUtils.isEmpty(mDataNamespace)) {
return false;
}
try {
if (null != Cast.CastApi && null != mApiClient) {
Cast.CastApi.removeMessageReceivedCallbacks(mApiClient,mDataNamespace);
}
mDataChannel=null;
Utils.saveStringToPreference(mContext,PREFS_KE... | Remove the custom data channel, if any. It returns <code>true</code> if it succeeds otherwise if it encounters an error or if no connection exists or if no custom data channel exists, then it returns <code>false</code> |
protected OpenReplicatorPlugin loadAndConfigurePlugin(String prefix,String name) throws ReplicatorException {
String pluginPrefix=prefix + "." + name.trim();
String rawClassName=properties.getString(pluginPrefix);
if (rawClassName == null) throw new ReplicatorException("Plugin class name property is missing or ... | Generic code to load and configure a plugin. |
public void synchronizeWith(UpdateSynchronizer sync){
runner.synchronizeWith(sync);
}
| Assign an update synchronizer. |
static boolean equals(Object o1,Object o2){
return o1 == o2 || (o1 != null && o2 != null && o1.equals(o2));
}
| Safe equals. null == null, but null never equals anything else. |
public static void main(String[] args) throws ParseException, IOException, InterruptedException {
CommandLineParser parser=new PosixParser();
CommandLine commandLine=parser.parse(getOptions(),args);
if (commandLine.hasOption(CFG_HELP)) {
new HelpFormatter().printHelp("spqr-websocket-server",getOptions());
... | Checks the command-line settings and ramps up the server |
public void testFailedNodes3() throws Exception {
try {
nodeSpi.set(new TestFailedNodesSpi(-1));
Ignite ignite0=startGrid(0);
nodeSpi.set(new TestFailedNodesSpi(2));
Ignite ignite1=startGrid(1);
assertEquals(1,ignite1.cluster().nodes().size());
waitNodeStop(ignite0.name());
ignite1.getOrCr... | Coordinator is added in failed list during node start, test with two nodes. |
public static String ask(final Shell shell,final String title,final String text,final String defaultValue){
final Dialog dialog=new Dialog(shell);
dialog.setTitle(ResourceManager.getLabel(ResourceManager.INPUT));
dialog.getMessageArea().setTitle(title).setText(text).setIcon(Display.getCurrent().getSystemImage(SWT... | Create a dialog box that asks a question |
private void processDelete(){
T deletedObject=(T)this.comboBox.getSelectedItem();
if (deletedObject != null) {
this.comboBox.removeItem(deletedObject);
this.listener.itemDeleted(this,deletedObject);
}
}
| Deletes the selected item from the component |
public void push(final double value){
long bits=Double.doubleToLongBits(value);
if (bits == 0L || bits == 0x3ff0000000000000L) {
mv.visitInsn(Opcodes.DCONST_0 + (int)value);
}
else {
mv.visitLdcInsn(value);
}
}
| Generates the instruction to push the given value on the stack. |
public static boolean isConnectedFast(Context context){
NetworkInfo info=Connectivity.getNetworkInfo(context);
return (info != null && info.isConnected() && Connectivity.isConnectionFast(info.getType(),info.getSubtype()));
}
| Check if there is fast connectivity |
private static final String toXml(Joint joint){
StringBuilder sb=new StringBuilder();
sb.append("<Joint Id=\"").append(joint.getId()).append("\" Name=\"").append(joint.getUserData()).append("\" xsi:type=\"").append(joint.getClass().getSimpleName()).append("\">");
sb.append("<BodyId1>").append(joint.getBody1().get... | Returns the xml for the given joint. |
public final char yycharat(int pos){
return zzBuffer[zzStartRead + pos];
}
| Returns the character at position <tt>pos</tt> from the matched text. It is equivalent to yytext().charAt(pos), but faster |
public final DD selfAdd(DD y){
return selfAdd(y.hi,y.lo);
}
| Adds the argument to the value of <tt>this</tt>. To prevent altering constants, this method <b>must only</b> be used on values known to be newly created. |
public void onReceivedCapabilities(ContactId contact,Capabilities capabilities){
if (sLogger.isActivated()) {
sLogger.debug("Handle capabilities update notification for " + contact + " ("+ capabilities.toString()+ ")");
}
mCapabilityService.receiveCapabilities(contact,capabilities);
}
| Capabilities update notification has been received |
public void createPerUnitWeekSteppedScenario() throws Exception {
setDateFactory("2013-04-01 00:00:00");
VOServiceDetails serviceDetails=serviceSetup.createPublishAndActivateMarketableService(basicSetup.getSupplierAdminKey(),"PER_UNIT_WEEK_STEPPED_SERVICE",TestService.EXAMPLE,TestPriceModel.EXAMPLE_PERUNIT_WEEK_EVE... | Test for per unit/week price model with stepped event prices, stepped user assignment costs and stepped parameter period fees |
@Override public void addFitnessFunction(FitnessFunction<? extends Chromosome> fitness){
throw new NotImplementedException("This should not be called");
}
| Since the fitness is governed by the underlying suite associated to this goal, this function should never be invoked. |
public synchronized boolean repeatRequest(){
return repeatRequest(false);
}
| Sends a message to repeat current request. |
public boolean createRedundantBucketForRegion(InternalDistributedMember target,int bucketId){
return getLeaderRegion().getRedundancyProvider().createBackupBucketOnMember(bucketId,target,isRebalance,replaceOfflineData,null,true);
}
| Create a redundant bucket on the target member |
public ArraySpliterator(Object[] array,int additionalCharacteristics){
this(array,0,array.length,additionalCharacteristics);
}
| Creates a spliterator covering all of the given array. |
public static int calcTextWidth(Paint paint,String demoText){
return (int)paint.measureText(demoText);
}
| calculates the approximate width of a text, depending on a demo text avoid repeated calls (e.g. inside drawing methods) |
public SessionEvent(Object source,SessionEvent event){
super(source);
this.node=event.getNode();
this.parent=event.getParent();
this.child=event.getChild();
this.type=event.getType();
}
| Creates a new SessionEvent with the same information as the given event but with a new source. |
private void yy_ScanError(int errorCode){
String message;
try {
message=YY_ERROR_MSG[errorCode];
}
catch ( ArrayIndexOutOfBoundsException e) {
message=YY_ERROR_MSG[YY_UNKNOWN_ERROR];
}
throw new Error(message);
}
| Reports an error that occured while scanning. In a wellformed scanner (no or only correct usage of yypushback(int) and a match-all fallback rule) this method will only be called with things that "Can't Possibly Happen". If this method is called, something is seriously wrong (e.g. a JFlex bug producing a faulty scanner ... |
private static String makeWatchLink(String id){
return "http://mover.uz/watch/{id}".replace("{id}",id);
}
| Generates url to movie first frame generated in mover.uz system |
public void valueChanged(TreeSelectionEvent e){
if (!updatingSelection && tree.getSelectionCount() == 1) {
TreePath selPath=tree.getSelectionPath();
Object lastPathComponent=selPath.getLastPathComponent();
if (!(lastPathComponent instanceof DefaultMutableTreeNode)) {
Element selElement=(Element)last... | Called whenever the value of the selection changes. |
private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
s.defaultReadObject();
int numBuckets=s.readInt();
table=new Entry[numBuckets];
init();
int size=s.readInt();
for (int i=0; i < size; i++) {
K key=(K)s.readObject();
V value=(V)s.readObject();
putFo... | Reconstitute the <tt>MyIdentityHashMap</tt> instance from a stream (i.e., deserialize it). |
public JavaContext(TemplateContextType type,IDocument document,int completionOffset,int completionLength,ICompilationUnit compilationUnit){
super(type,document,completionOffset,completionLength,compilationUnit);
}
| Creates a java template context. |
protected void add(int idx,FolderTokenDocTreeNode node){
m_nodes.add(idx,node);
}
| Agrega un nuevo nodo a la lista |
public Contact(String contact){
super(contact);
}
| Creates a contact property. |
public int size(){
return this.stream.size();
}
| Return the current size of the encoded data. |
public static final List toSubIndicesSet(Instance x,int sub_indices[]){
List<Integer> y_list=new ArrayList<Integer>();
for ( int j : sub_indices) {
if (x.value(j) > 0.) {
y_list.add(j);
}
}
return y_list;
}
| To Sub Indices Set - return the indices out of 'sub_indices', in x, whose values are greater than 1. |
public boolean isWriteLockedByCurrentThread(){
return locks[locks.length - 1].isWriteLockedByCurrentThread();
}
| Queries if the write lock is held by the current thread. |
public AudioCapabilities(int[] supportedEncodings,int maxChannelCount){
this.supportedEncodings=new HashSet<Integer>();
if (supportedEncodings != null) {
for ( int i : supportedEncodings) {
this.supportedEncodings.add(i);
}
}
this.maxChannelCount=maxChannelCount;
}
| Constructs new audio capabilities based on a set of supported encodings and a maximum channel count. |
public double norm(){
if (m_Elements != null) {
int n=m_Elements.length;
double sum=0.0;
for (int i=0; i < n; i++) {
sum+=m_Elements[i] * m_Elements[i];
}
return Math.pow(sum,0.5);
}
else return 0.0;
}
| Returns the norm of the vector |
public DictionaryPropertyType createDictionaryPropertyType(){
DictionaryPropertyTypeImpl dictionaryPropertyType=new DictionaryPropertyTypeImpl();
return dictionaryPropertyType;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public void notationDecl(StylesheetHandler handler,String name,String publicId,String systemId){
}
| Receive notification of a notation declaration. |
public void closeSearchBar(){
routeTo(backup);
if (listener != null) {
listener.onCloseSearchActionBar(ab);
}
}
| close the display from the search bar |
public default void onStall(RPCCall c){
}
| The call has not timed out yet but is estimated to be unlikely to succeed |
public OnClickWrapper(String tag,SuperToast.OnClickListener onClickListener){
this.mTag=tag;
this.mOnClickListener=onClickListener;
}
| Creates an OnClickWrapper. |
public IconFactory(Resources resources,Drawable background){
this(resources,((BitmapDrawable)background).getBitmap());
}
| must be called from the gui-Thread |
public void declineDefaultList() throws XMPPException {
Privacy request=new Privacy();
request.setDeclineDefaultList(true);
setRequest(request);
}
| Client declines the use of default lists. |
public boolean canUserSeeEntry(User user,Entry entry,boolean isAdmin){
if (isAdmin) {
return true;
}
if (user == null) {
return false;
}
return entry.getUserId() != null && entry.getUserId().equals(user.getId());
}
| API method. Checks if the user is entitled to see the entry. |
public CFilterByMemoryAction(final JTextField filterField){
super("Filter by memory content");
m_filterField=filterField;
}
| Creates a new action object. |
public static List<File> annotatedFiles() throws FileNotFoundException, LoadingFileException, IOException {
List<File> annotatedFiles=new ArrayList<File>();
for ( File javaFile : getJavaFiles()) if (isFileAnnotated(javaFile)) annotatedFiles.add(javaFile);
return annotatedFiles;
}
| Returns a list with all annotated files. |
public DiscreteAABB copy(){
return getBoundingBox(this.minX,this.minY,this.minZ,this.maxX,this.maxY,this.maxZ);
}
| Returns a copy of the bounding box. |
private boolean updateHeader(){
String sql="UPDATE C_BankStatement bs" + " SET StatementDifference=(SELECT COALESCE(SUM(StmtAmt),0) FROM C_BankStatementLine bsl " + "WHERE bsl.C_BankStatement_ID=bs.C_BankStatement_ID AND bsl.IsActive='Y') "+ "WHERE C_BankStatement_ID="+ getC_BankStatement_ID();
int no=DB.executeUpd... | Update Header |
public String paramString(){
String typeStr;
switch (id) {
case ANCESTOR_MOVED:
typeStr="ANCESTOR_MOVED (" + changed + ","+ changedParent+ ")";
break;
case ANCESTOR_RESIZED:
typeStr="ANCESTOR_RESIZED (" + changed + ","+ changedParent+ ")";
break;
case HIERARCHY_CHANGED:
{
typeStr="HIERARCHY_CHANGED (";
boolean ... | Returns a parameter string identifying this event. This method is useful for event-logging and for debugging. |
private void generate(String kind,PartitionResolver rr) throws SAXException {
if (rr == null) return;
handler.startElement("",kind,kind,EMPTY);
String className=rr.getClass().getName();
handler.startElement("",CLASS_NAME,CLASS_NAME,EMPTY);
handler.characters(className.toCharArray(),0,className.length());
... | Generate XML for partition-resolver element in PartitionedRegion Attributes |
private void findAfterLocal(Result<Cursor> result,RowCursor cursor,Object[] args,Cursor cursorLocal){
long version=0;
if (cursorLocal != null) {
version=cursorLocal.getVersion();
long time=cursorLocal.getUpdateTime();
long timeout=cursorLocal.getTimeout();
long now=CurrentTime.currentTime();
if ... | After finding the local cursor, if it's expired, check with the cluster to find the most recent value. |
private Solution select(Population population){
Solution winner=population.get(PRNG.nextInt(population.size()));
for (int i=1; i < size; i++) {
Solution candidate=population.get(PRNG.nextInt(population.size()));
int flag=comparator.compare(winner,candidate);
if (flag > 0) {
winner=candidate;
}... | Performs deterministic tournament selection with the specified population, returning the tournament winner. If more than one solution is a winner, one of the winners is returned with equal probability. |
public static Number sin(Number a){
return Math.sin(a.doubleValue());
}
| Returns the trigonometric sine of the number. |
private static int computePointerSize(){
String bits=System.getProperty("sun.arch.data.model");
if (bits.equals("32")) {
return 4;
}
else if (bits.equals("64")) {
return 8;
}
else {
System.err.println("Unknown value for sun.arch.data.model - assuming 32 bits");
return 4;
}
}
| Computes the size of a pointer, in bytes |
public void testDynamicMergeFrom() throws Exception {
DynamicMessage result=DynamicMessage.newBuilder(MERGE_DEST).mergeFrom(DynamicMessage.newBuilder(MERGE_SOURCE).build()).build();
assertEquals(MERGE_RESULT_TEXT,result.toString());
}
| Test merging two DynamicMessages. |
private long makeMGRSString(long Zone,long[] Letters,double Easting,double Northing,long Precision){
int j;
double divisor;
long east;
long north;
long error_code=MGRS_NO_ERROR;
if (Zone != 0) MGRSString=String.format("%02d",Zone);
else MGRSString=" ";
for (j=0; j < 3; j++) {
if (Letters[j] < 0 ... | The function Make_MGRS_String constructs an MGRS string from its component parts. |
private void initResourcesIfNecessary(){
if (centerDrawable == null) {
centerDrawable=getContext().getResources().getDrawable(wheelForeground);
}
if (topShadow == null) {
topShadow=new GradientDrawable(Orientation.TOP_BOTTOM,SHADOWS_COLORS);
}
if (bottomShadow == null) {
bottomShadow=new GradientD... | Initializes resources |
public boolean undo(){
return model.undo();
}
| Tries to undo the last action. |
public SparseSensorMatrixEditor(){
super();
initComponents();
layoutComponents();
}
| Create a new sparse sensor matrix editor. |
public Iterator<E> iterator(){
return new Itr();
}
| Returns an iterator over the elements in this queue. The iterator does not return the elements in any particular order. |
public void addObservations(double[] observations,int startTime,int numTimeSteps) throws Exception {
if (vectorOfObservations == null) {
throw new RuntimeException("User did not call startAddObservations before addObservations");
}
if (numTimeSteps <= k) {
return;
}
double[] obsToAdd=new double[numTim... | Add some more observations. |
public void prepare(boolean gcWholeMS){
if (HEADER_MARK_BITS && Options.eagerCompleteSweep.getValue()) {
consumeBlocks();
}
else {
flushAvailableBlocks();
}
if (HEADER_MARK_BITS) {
if (gcWholeMS) {
allocState=markState;
if (usingStickyMarkBits && !isAgeSegregated) allocState|=Head... | Prepare for a new collection increment. For the mark-sweep collector we must flip the state of the mark bit between collections. |
public Matrix4x3f m20(float m20){
this.m20=m20;
properties&=~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION);
return this;
}
| Set the value of the matrix element at column 2 and row 0 |
public StringRequest(int method,String url,Listener<String> listener,ErrorListener errorListener){
super(method,url,errorListener);
mListener=listener;
}
| Creates a new request with the given method. |
public SDKConnection(Credentials credentials){
this.credentials=credentials;
this.url=credentials.url;
}
| Create an SDK connection with the credentials. Use the Credentials subclass specific to your server. |
private void writeAttribute(java.lang.String namespace,java.lang.String attName,java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
}
else {
registerPrefix(xmlWriter,namesp... | Util method to write an attribute without the ns prefix |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private boolean isRestartNeeded(boolean optOut){
if (optOut) return true;
boolean isFromFre=getActivity().getIntent() != null && getActivity().getIntent().getBooleanExtra(IntentHandler.EXTRA_INVOKED_FROM_FRE,false);
if (!isFromFre) return true;
ActivityManager am=(Ac... | Figure out whether we need to restart the application after the tab migration is complete. We don't need to restart if this is being accessed from FRE and no document activities have been created yet. |
public void runTest() throws Throwable {
Document doc;
NodeList elementList;
Node employeeNode;
NodeList employeeList;
Node secondChildNode;
Node textNode;
Node noChildNode;
doc=(Document)load("staff",false);
elementList=doc.getElementsByTagName("employee");
employeeNode=elementList.item(0);
emplo... | Runs the test case. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.