Java Code Examples for java.lang.String

The following examples show how to use java.lang.String. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: netbeans   Source File: PageFlowController.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Replace page name in PageName2Node HasMap. This is general used in a
 * page rename.  In general this removes the old Page and add the new one with
 * the given name.
 * @param page Page that should be added into the map.  If null, NPE thrown
 *             and nothing removed from the map.
 * @param String newName String that you want to assign to the page.
 * @param String oldName String that was assigned to the page.
 * @return true if page was found to replace, false is page was not found.
 **/
public boolean replacePageName2Page(Page page, String newName, String oldName) {

    LOGGER.finest("PageName2Page: replace " + oldName + " to " + newName);
    //assert (newName.length() > 0);
    //assert (oldName.length() > 0);

    if (page == null) {
        throw new NullPointerException("Page can not be null.");
    }

    checkAWTThread();
    synchronized (pageName2Page) {
        WeakReference<Page> page2Ref = pageName2Page.remove(oldName);
        if (page2Ref != null) {
            Page pageFound = page2Ref.get();

            if (pageFound != null) {
                LOGGER.finest("Trying to replace page in map, but page not found:" + page);
            }
            pageName2Page.put(newName, new WeakReference<Page>(page));
            return true;
        }
        return false;
    }
}
 
Example 2
Source Project: iview-android-tv   Source File: Utils.java    License: MIT License 6 votes vote down vote up
/**
 * Formats time in milliseconds to hh:mm:ss string format.
 */
public static String formatMillis(int millis) {
    String result = "";
    int hr = millis / 3600000;
    millis %= 3600000;
    int min = millis / 60000;
    millis %= 60000;
    int sec = millis / 1000;
    if (hr > 0) {
        result += hr + ":";
    }
    if (min >= 0) {
        if (min > 9) {
            result += min + ":";
        } else {
            result += "0" + min + ":";
        }
    }
    if (sec > 9) {
        result += sec;
    } else {
        result += "0" + sec;
    }
    return result;
}
 
Example 3
Source Project: JarBundler   Source File: JarBundler.java    License: Apache License 2.0 6 votes vote down vote up
public void addConfiguredDocumentType(DocumentType documentType) throws BuildException {
	String name = documentType.getName();
	String role = documentType.getRole();
	List osTypes = documentType.getOSTypes();
	List extensions = documentType.getExtensions();
	List mimeTypes = documentType.getMimeTypes();

	if ((name == null) || (role == null))
		throw new BuildException(
				"'<documenttype>' must have both a 'name' and a 'role' attibute");

	if ((osTypes.isEmpty()) && (extensions.isEmpty()) && (mimeTypes.isEmpty()))
		throw new BuildException(
				"'<documenttype>' of \""
						+ name
						+ "\" must have 'osTypes' or 'extensions' or 'mimeTypes'");

	bundleProperties.addDocumentType(documentType);
}
 
Example 4
Source Project: epoxy   Source File: TestManyTypesViewModel_.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public TestManyTypesViewModel_ reset() {
  onModelBoundListener_epoxyGeneratedModel = null;
  onModelUnboundListener_epoxyGeneratedModel = null;
  onModelVisibilityStateChangedListener_epoxyGeneratedModel = null;
  onModelVisibilityChangedListener_epoxyGeneratedModel = null;
  assignedAttributes_epoxyGeneratedModel.clear();
  this.stringValue_String = null;
  this.nullableStringValue_String = (String) null;
  this.intValue_Int = 0;
  this.intValueWithAnnotation_Int = 0;
  this.intValueWithRangeAnnotation_Int = 0;
  this.intValueWithDimenTypeAnnotation_Int = 0;
  this.intWithMultipleAnnotations_Int = 0;
  this.integerValue_Integer = null;
  this.boolValue_Boolean = false;
  this.booleanValue_Boolean = null;
  this.arrayValue_StringArray = null;
  this.listValue_List = null;
  this.clickListener_OnClickListener = null;
  this.title_StringAttributeData =  new StringAttributeData((CharSequence) null);
  super.reset();
  return this;
}
 
Example 5
Source Project: mavlink   Source File: LocalPositionNedCov.java    License: MIT License 5 votes vote down vote up
@Override
public String toString() {
    return "LocalPositionNedCov{timeUsec=" + timeUsec
             + ", estimatorType=" + estimatorType
             + ", x=" + x
             + ", y=" + y
             + ", z=" + z
             + ", vx=" + vx
             + ", vy=" + vy
             + ", vz=" + vz
             + ", ax=" + ax
             + ", ay=" + ay
             + ", az=" + az
             + ", covariance=" + covariance + "}";
}
 
Example 6
@Override
public final NullPointerException headerNameWasNull() {
    final NullPointerException result = new NullPointerException(String.format(getLoggingLocale(), headerNameWasNull$str()));
    final StackTraceElement[] st = result.getStackTrace();
    result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
    return result;
}
 
Example 7
Source Project: Xamarin-Forms-Shape   Source File: MonoPackageManager.java    License: MIT License 5 votes vote down vote up
public static void LoadApplication (Context context, String runtimeDataDir, String[] apks)
{
	synchronized (lock) {
		if (!initialized) {
			System.loadLibrary("monodroid");
			Locale locale       = Locale.getDefault ();
			String language     = locale.getLanguage () + "-" + locale.getCountry ();
			String filesDir     = context.getFilesDir ().getAbsolutePath ();
			String cacheDir     = context.getCacheDir ().getAbsolutePath ();
			String dataDir      = context.getApplicationInfo ().dataDir + "/lib";
			ClassLoader loader  = context.getClassLoader ();

			Runtime.init (
					language,
					apks,
					runtimeDataDir,
					new String[]{
						filesDir,
						cacheDir,
						dataDir,
					},
					loader,
					new java.io.File (
						android.os.Environment.getExternalStorageDirectory (),
						"Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath (),
					MonoPackageManager_Resources.Assemblies,
					context.getPackageName ());
			initialized = true;
		}
	}
}
 
Example 8
Source Project: Image-Detection-Samples   Source File: Imgcodecs.java    License: Apache License 2.0 5 votes vote down vote up
public static boolean imwrite(String filename, Mat img, MatOfInt params)
{
    Mat params_mat = params;
    boolean retVal = imwrite_0(filename, img.nativeObj, params_mat.nativeObj);
    
    return retVal;
}
 
Example 9
Source Project: apollo-android   Source File: CreateReviewForEpisodeMutation.java    License: MIT License 5 votes vote down vote up
@Override
public String toString() {
  if ($toString == null) {
    $toString = "Data{"
      + "createReview=" + createReview
      + "}";
  }
  return $toString;
}
 
Example 10
Source Project: netbeans   Source File: PageFlowController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Givena pageName, look through the list of predefined webFiles and return the matching fileObject
 * @return FileObject for which the match was found or null of none was found.
 **/
private FileObject getFileObject(String pageName) {
    for (FileObject webFile : webFiles) {
        //DISPLAYNAME:
        String webFileName = Page.getFolderDisplayName(getWebFolder(), webFile);
        //            String webFileName = webFile.getNameExt();
        if (webFileName.equals(pageName)) {
            return webFile;
        }
    }
    return null;
}
 
Example 11
/**
 * Invokes the <code>getDialogTitle</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public String getDialogTitle(JFileChooser a) {
    String returnValue =
        ((FileChooserUI) (uis.elementAt(0))).getDialogTitle(a);
    for (int i = 1; i < uis.size(); i++) {
        ((FileChooserUI) (uis.elementAt(i))).getDialogTitle(a);
    }
    return returnValue;
}
 
Example 12
Source Project: apollo-android   Source File: TestQuery.java    License: MIT License 5 votes vote down vote up
public AsDroid(@NotNull String __typename, @NotNull String name,
    @Nullable String primaryFunction, @Nullable List<Friend1> friends) {
  this.__typename = Utils.checkNotNull(__typename, "__typename == null");
  this.name = Utils.checkNotNull(name, "name == null");
  this.primaryFunction = Optional.fromNullable(primaryFunction);
  this.friends = Optional.fromNullable(friends);
}
 
Example 13
Source Project: consulo   Source File: SdkImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String getVersionString() {
  if (myVersionString == null && !myVersionDefined) {
    String homePath = getHomePath();
    if (homePath != null && !homePath.isEmpty()) {
      setVersionString(getSdkType().getVersionString(this));
    }
  }
  return myVersionString;
}
 
Example 14
Source Project: lams   Source File: FormParameter.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * get the message for this exception
 */
public String getMessage() {
    StringBuffer sb = new StringBuffer( HttpUnitUtils.DEFAULT_TEXT_BUFFER_SIZE );
    sb.append( "Attempted to upload " ).append( _numSupplied ).append( " files using parameter '" ).append( _parameterName );
    if (_numExpected == 0) {
        sb.append( "' which is not a file parameter." );
    } else {
        sb.append( "' which only has room for " ).append( _numExpected ).append( '.' );
    }
    return sb.toString();
}
 
Example 15
Source Project: mavlink   Source File: HighLatency2.java    License: MIT License 5 votes vote down vote up
@Override
public String toString() {
    return "HighLatency2{timestamp=" + timestamp
             + ", type=" + type
             + ", autopilot=" + autopilot
             + ", customMode=" + customMode
             + ", latitude=" + latitude
             + ", longitude=" + longitude
             + ", altitude=" + altitude
             + ", targetAltitude=" + targetAltitude
             + ", heading=" + heading
             + ", targetHeading=" + targetHeading
             + ", targetDistance=" + targetDistance
             + ", throttle=" + throttle
             + ", airspeed=" + airspeed
             + ", airspeedSp=" + airspeedSp
             + ", groundspeed=" + groundspeed
             + ", windspeed=" + windspeed
             + ", windHeading=" + windHeading
             + ", eph=" + eph
             + ", epv=" + epv
             + ", temperatureAir=" + temperatureAir
             + ", climbRate=" + climbRate
             + ", battery=" + battery
             + ", wpNum=" + wpNum
             + ", failureFlags=" + failureFlags
             + ", custom0=" + custom0
             + ", custom1=" + custom1
             + ", custom2=" + custom2 + "}";
}
 
Example 16
Source Project: marvel   Source File: GenericDescriptorMatcher.java    License: MIT License 5 votes vote down vote up
/**
* <p>Writes a match object to a file storage.</p>
*
* @param fileName a fileName
*
* @see <a href="http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_generic_descriptor_matchers.html#genericdescriptormatcher-write">org.opencv.features2d.GenericDescriptorMatcher.write</a>
*/
   public  void write(String fileName)
   {

       write_0(nativeObj, fileName);

       return;
   }
 
Example 17
Source Project: OpenCvFaceDetect   Source File: Net.java    License: Apache License 2.0 5 votes vote down vote up
public  void forward(List<Mat> outputBlobs, String outputName)
{
    Mat outputBlobs_mat = new Mat();
    forward_2(nativeObj, outputBlobs_mat.nativeObj, outputName);
    Converters.Mat_to_vector_Mat(outputBlobs_mat, outputBlobs);
    outputBlobs_mat.release();
    return;
}
 
Example 18
Source Project: netbeans   Source File: AdvancedOptionImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
    * Provides list of options for this category
    * @return list of keywords for each optioncategory sub-panel
    */
   public Set<String> getKeywordsByCategory() {
if (keywords != null) {
    return Collections.singleton(keywords);
} else {
    return Collections.emptySet();
}
   }
 
Example 19
Source Project: LicensePlateDiscern   Source File: Net.java    License: MIT License 5 votes vote down vote up
public  void forward(List<Mat> outputBlobs, List<String> outBlobNames)
{
    Mat outputBlobs_mat = new Mat();
    forward_4(nativeObj, outputBlobs_mat.nativeObj, outBlobNames);
    Converters.Mat_to_vector_Mat(outputBlobs_mat, outputBlobs);
    outputBlobs_mat.release();
    return;
}
 
Example 20
Source Project: apollo-android   Source File: TestQuery.java    License: MIT License 5 votes vote down vote up
public Hero(@NotNull String __typename, @NotNull String name,
    @NotNull @Deprecated String deprecated, @Deprecated boolean deprecatedBool) {
  this.__typename = Utils.checkNotNull(__typename, "__typename == null");
  this.name = Utils.checkNotNull(name, "name == null");
  this.deprecated = Utils.checkNotNull(deprecated, "deprecated == null");
  this.deprecatedBool = deprecatedBool;
}
 
Example 21
Source Project: androidnative.pri   Source File: SystemDispatcher.java    License: Apache License 2.0 5 votes vote down vote up
/** Dispatch a message.
   @threadsafe
   @remarks: The function may not be running from the UI thread. It is listener's duty to handle multiple threading issue.
 */
public static void dispatch(String type,Map message) {
    try {

        Payload payload;

        mutex.acquire();

        if (dispatching) {
            payload = new Payload();
            payload.type = type;
            payload.message = message;
            queue.add(payload);
            mutex.release();
            return;
        }

        dispatching = true;
        mutex.release();

        emit(type,message); // Emit

        mutex.acquire(); // Process queued message

        while (queue.size() > 0 ) {
            payload = queue.poll();
            mutex.release();

            emit(payload.type,payload.message);

            mutex.acquire();
        }
        dispatching = false;
        mutex.release();

    } catch (Exception e) {
        Log.e(TAG,"exception",e);
    }
}
 
Example 22
Source Project: evosql   Source File: JUnit5MediumTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Generates a string map from a list of strings.
 */
private static HashMap<String, String> makeMap(String... strings) {
  HashMap<String, String> result = new HashMap<>();
  for(int i = 0; i < strings.length; i += 2) {
    result.put(strings[i], strings[i + 1]);
  }
  return result;
}
 
Example 23
Source Project: apollo-android   Source File: TestQuery.java    License: MIT License 4 votes vote down vote up
@Override
public String operationId() {
  return OPERATION_ID;
}
 
Example 24
Source Project: apollo-android   Source File: HeroDetails.java    License: MIT License 4 votes vote down vote up
public FriendsConnection1(@NotNull String __typename, @Nullable Integer totalCount,
    @Nullable List<Edge1> edges) {
  this.__typename = Utils.checkNotNull(__typename, "__typename == null");
  this.totalCount = Optional.fromNullable(totalCount);
  this.edges = Optional.fromNullable(edges);
}
 
Example 25
Source Project: monasca-thresh   Source File: StatsdMetricConsumer.java    License: Apache License 2.0 4 votes vote down vote up
private void reportUOM(String s, Double number) {
  String metricName = null;
  StringBuilder results = new StringBuilder();
  Boolean published = false;

  if (whiteList.contains(s)) {

    if (!metricMap.isEmpty() && metricMap.containsKey(s)) {
      metricName = metricMap.get(s);
    }
    /* Send the unmapped uom as the same name storm calls it */
    else {
      metricName = s;
    }

    /* Make sure we don't send metric names that may be null or empty */
    if (metricName != null && !metricName.isEmpty()) {
      published = true;
    }
  }

  /*
   * To enable debug message, you also need to add an entry like this:
   *
   * <logger name="monasca.thresh" additivity="false">
   *   <level value="INFO" />
   *   <appender-ref ref="A1" />
   * </logger>
   *
   * Storm/Thresh logger config file:
   *   /opt/storm/apache-storm-0.9.5/logback/cluster.xml
   *
  */

  if (debugMetrics) {
    String mappedName = new String();

    if (!metricMap.isEmpty() && metricMap.containsKey(s)) {
      mappedName = metricMap.get(s);
    }
    else {
      mappedName = s;
    }

    logger.info(", RawMetricName, {}, MappedMetricName, {}, "
        + "val, {}, {}", new Object[]
        { s, mappedName, number,
            published == true ? "PUBLISHED" : "UNPUBLISHED"});
  }

  if (published) {
    results = results.append(metricName).append(":")
        .append(String.valueOf(number)).append("|c")
        .append(statsdDimensions);

    report(results.toString());
  }
}
 
Example 26
Source Project: CrossBow   Source File: JsonRequestCharsetTest.java    License: Apache License 2.0 4 votes vote down vote up
private static String jsonObjectString() throws Exception {
    JSONObject json = new JSONObject().put(TEXT_NAME, TEXT_VALUE).put(COPY_NAME, COPY_VALUE);
    return json.toString();
}
 
Example 27
Source Project: apollo-android   Source File: TestQuery.java    License: MIT License 4 votes vote down vote up
@Override
public Node map(ResponseReader reader) {
  final String __typename = reader.readString($responseFields[0]);
  final String name = reader.readString($responseFields[1]);
  return new Node(__typename, name);
}
 
Example 28
Source Project: dataenum   Source File: RecursiveValue.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString() {
  StringBuilder builder = new StringBuilder();
  builder.append("TypeParamValue{children=").append(this.children);
  return builder.append('}').toString();
}
 
Example 29
Source Project: apollo-android   Source File: HeroDetails.java    License: MIT License 4 votes vote down vote up
public @NotNull String __typename() {
  return this.__typename;
}
 
Example 30
Source Project: apollo-android   Source File: TestQuery.java    License: MIT License 4 votes vote down vote up
@Override
public AsCharacter map(ResponseReader reader) {
  final String __typename = reader.readString($responseFields[0]);
  final String name = reader.readString($responseFields[1]);
  return new AsCharacter(__typename, name);
}