Generates a unique and valid name using {@code base}. If {@code base} has not yet been added,
and is not a Java keyword; it will be returned as-is, otherwise it will have a differentiator
appended.
494586
String getUniqueName(CharSequence base) {
    String name = base.toString();
    for (int differentiator = 1; isInvalidName(name); differentiator++) {
      name = base.toString() + separator + differentiator;
    }
    return name;
  }
941996
public String determineDatabaseName() {
		if (this.generateUniqueName) {
			if (this.uniqueName == null) {
				this.uniqueName = UUID.randomUUID().toString();
			}
			return this.uniqueName;
		}
		if (StringUtils.hasLength(this.name)) {
			return this.name;
		}
		if (this.embeddedDatabaseConnection != EmbeddedDatabaseConnection.NONE) {
			return "testdb";
		}
		return null;
	}
221581
public void reserve(String name) {
    checkName(name);
    // if this is new
    if (reserved.add(name)) {
      // add it to names, so that generateName will still work for reserved names (they will just
      // get suffixes).
      if (!names.add(name)) {
        names.remove(name);
        throw new IllegalArgumentException("newly reserved name: " + name + " was already used!");
      }
    }
  }
809895
@Basic
    @Column(name = "NAME", unique = true, nullable = false, length=255)
	public String getName() 
	{
		return name;
	}
283100
protected static String getBaseName(String name) {
        if (name.endsWith(",Bold"))
            return name.substring(0, name.length() - 5);
        else if (name.endsWith(",Italic"))
            return name.substring(0, name.length() - 7);
        else if (name.endsWith(",BoldItalic"))
            return name.substring(0, name.length() - 11);
        else
            return name;
    }
1312438
public static String getBasename(final File file) {
    final String path = file.getPath();
    // Remove the extension
    String basename = file.getName();
    final int pos = basename.lastIndexOf('.');
    if (pos != -1) {
      basename = basename.substring(0, pos);
    }
    return basename;
  }
614823
private String makePropertyName(String name) {
        if (name.startsWith(beanParser.getFieldPrefix())) {
            return name.substring(beanParser.getFieldPrefix().length());
        }
        return name;
    }
281448
protected void generateNewBasename() {
        Properties localProps = new Properties(); 
        localProps.setProperty("prefix", settings.getPrefix());
        synchronized(this.getClass()) {
            // ensure that serialNo and timestamp are minted together (never inverted sort order)
            String paddedSerialNumber = WriterPoolMember.serialNoFormatter.format(serialNo.getAndIncrement());
            String timestamp17 = ArchiveUtils.getUnique17DigitDate(); 
            String timestamp14 = ArchiveUtils.getUnique14DigitDate(); 
            currentTimestamp = timestamp17;
            localProps.setProperty("serialno", paddedSerialNumber);
            localProps.setProperty("timestamp17", timestamp17);
            localProps.setProperty("timestamp14", timestamp14);
        }
        currentBasename = PropertyUtils.interpolateWithProperties(settings.getTemplate(), 
                localProps, System.getProperties());
    }
340133
public String getBaseName() {
        String n = getName();
        int idx = n.lastIndexOf('.');
        if (idx<0)  return n;
        return n.substring(0,idx);
    }
899214
protected void addName() {
        if (Strings.isNotEmpty(builder)) {
            int endOffset = 0;
            if (Strings.endsWith(builder, tagSeparator)) { // Ends with ','.
                endOffset = 1;
            }
            if (Strings.startsWith(builder, inheritanceMarker)) { // Starts with '.'.
                inherits.add(builder.substring(1, builder.length() - endOffset));
            } else {
                tags.add(builder.substring(0, builder.length() - endOffset));
            }
            Strings.clearBuilder(builder);
        }
    }
76329
private static DefaultNameGenerator createNameGenerator(Iterable<String> reserved) {
    final String namePrefix = "";
    final char[] reservedChars = new char[0];
    return new DefaultNameGenerator(ImmutableSet.copyOf(reserved), namePrefix, reservedChars);
  }
818354
public static String generatedNameOf(Class<?> clazz, String name)
    {
        return builder(clazz, name).build();
    }
190195
@Override
  public String getBaseVarName() {
    return (baseSelectVarName != null)
        ? baseSelectVarName
        : MsgSubstUnitBaseVarNameUtils.genNaiveBaseNameForExpr(
            selectExpr.getRoot(), FALLBACK_BASE_SELECT_VAR_NAME);
  }
1332148
static String[] generateAliases(String base) {
        int length = base.length();
        if (length <= 1) {
            return new String[]{base.toUpperCase(), base.toLowerCase()};
        }

        ArrayList<String> aliases = new ArrayList<String>(4);

        StringBuilder buf = new StringBuilder();

        int i;
        for (i=0; i<length; ) {
            char c = base.charAt(i++);
            if (c == '_' || !Character.isJavaIdentifierPart(c)) {
                // Keep scanning for first letter.
                buf.append(c);
            } else {
                buf.append(Character.toUpperCase(c));
                break;
            }
        }

        boolean canSeparate = false;
        boolean appendedIdentifierPart = false;

        for (; i<length; i++) {
            char c = base.charAt(i);
            if (c == '_' || !Character.isJavaIdentifierPart(c)) {
                canSeparate = false;
                appendedIdentifierPart = false;
            } else if (Character.isLowerCase(c)) {
                canSeparate = true;
                appendedIdentifierPart = true;
            } else {
                if (appendedIdentifierPart &&
                    i + 1 < length && Character.isLowerCase(base.charAt(i + 1))) {
                    canSeparate = true;
                }
                if (canSeparate) {
                    buf.append('_');
                }
                canSeparate = false;
                appendedIdentifierPart = true;
            }
            buf.append(c);
        }

        String derived = buf.toString();

        addToSet(aliases, derived.toUpperCase());
        addToSet(aliases, derived.toLowerCase());
        addToSet(aliases, derived);
        addToSet(aliases, base.toUpperCase());
        addToSet(aliases, base.toLowerCase());
        addToSet(aliases, base);

        return aliases.toArray(new String[aliases.size()]);
    }
845891
private static String generateUniqueId(Set<String> ids, String idBase) {
		String id = idBase;
		int counter = 1;
		while (ids.contains(id)) {
			id = idBase + String.valueOf(counter++);
		}
		
		// put the newly generated one into the set
		ids.add(id);
		return id;
	}
913651
public static boolean isValidFieldName(String fieldName) {
        return fieldName != null &&
               fieldName.length() > 0 &&
               Utils.isLetter(fieldName.charAt(0)) &&
               Utils.allAlphaNumUnderscore(fieldName);
    }
413108
public static String createRandomName(String prefix) {
		Preconditions.checkNotNull(prefix, "Prefix must not be null.");

		long nameOffset;

		// obtain the next name offset by incrementing it atomically
		do {
			nameOffset = nextNameOffset.get();
		} while (!nextNameOffset.compareAndSet(nameOffset, nameOffset + 1L));

		return prefix + '_' + nameOffset;
	}