Check if a sequence is blank

@param sourceSequence to check
@return true is sourceSequence is blank
557530
public static boolean isBlank(CharSequence sourceSequence) {
        int sequenceLength;
        if (sourceSequence == null || (sequenceLength = sourceSequence.length()) == 0) {
            return true;
        }
        for (int i = 0; i < sequenceLength; i++) {
            if ((Character.isWhitespace(sourceSequence.charAt(i)) == false)) {
                return false;
            }
        }
        return true;
    }
428132
protected static int findSequence(byte[] sequence, byte[] buffer) {
        int pos = -1;
        for (int i = 0; i < buffer.length - sequence.length + 1; i++) {
            if (buffer[i] == sequence[0] && testRemaining(sequence, buffer, i)) {
                pos = i;
                break;
            }
        }
        return pos;
    }
1228603
public void setInitialSequence(int[] sequence) {
    if(models != null){
      for(int i = 0; i < models.length; i++)
        models[i].setInitialSequence(sequence);
      return;
    }
    model1.setInitialSequence(sequence);
    model2.setInitialSequence(sequence);
  }
570326
public boolean matches(String seq) {
        return queue.regionMatches(true, pos, seq, 0, seq.length());
    }
278774
public S getEmptySequence() {
        if (empty == null)
            synchronized (this) {
                if (empty == null)
                    empty = createBuilder().createAndDestroy();
            }
        return empty;
    }
277154
@Override
	public AbstractSequence<AminoAcidCompound> getSequence(String sequence, long index) throws CompoundNotFoundException, IOException {
		SequenceFileProxyLoader<AminoAcidCompound> sequenceFileProxyLoader =
				new SequenceFileProxyLoader<AminoAcidCompound>(
						file,
						sequenceParser,
						index,
						sequence.length(),
						compoundSet
						);
		return new ProteinSequence(sequenceFileProxyLoader, compoundSet);
	}
247579
public static boolean isNotEmpty(CharSequence... css) {
        for (CharSequence cs : css) {
            if (StringUtils.isNullOrEmpty(cs)) {
                return false;
            }
        }
        return true;
    }
301546
public static boolean isNullOrEmptyOrBlank(final CharSequence s) {
        if (N.isNullOrEmpty(s)) {
            return true;
        }

        for (int i = 0, len = s.length(); i < len; i++) {
            if (Character.isWhitespace(s.charAt(i)) == false) {
                return false;
            }
        }

        return true;
    }
1312138
private void createSequencesConstraintsStatements(List<Statement> statements, Iterable<Sequence> sequences) {
		Statement statement = createUniqueConstraintStatement( SEQUENCE_NAME_PROPERTY, NodeLabel.SEQUENCE.name() );
		statements.add( statement );
	}
59375
protected void checkType(Object object) {
        if (object == null) {
            throw new NullPointerException("Sequences cannot contain null, use a List instead");
        }
        if (type != null) {
            if (!type.isInstance(object)) {
                throw new IllegalArgumentException(
                        "Invalid type of argument for sequence of type: "
                                + type.getName()
                                + " cannot add object: "
                                + object);
            }
        }
    }
1041538
boolean isEmpty(Map<String, List<List<RepositoryResource>>> installResources) {
        if (installResources == null)
            return true;
        for (List<List<RepositoryResource>> targetList : installResources.values()) {
            for (List<RepositoryResource> mrList : targetList) {
                if (!mrList.isEmpty())
                    return false;
            }
        }
        return true;
    }
274601
public ValidationResult check(Entry entry) {
		result = new ValidationResult();

		if(entry == null || entry.getSequence() == null) {
			return result;
		}
		// checks the CONTIG/CO line locations cover the sequence length
		if (entry.getSequence().getContigs() != null && entry.getSequence().getContigs().size() != 0) {
			result = checkContigLocation(entry);
		}

		//collect all sources
		List<SourceFeature> sources = new ArrayList<SourceFeature>();
		for (Feature feature : entry.getFeatures()) {
			if (feature instanceof SourceFeature) {
				sources.add((SourceFeature) feature);
			}
		}

		if (sources.isEmpty()) {
			return result;
		}

		//checks sequence
		Sequence sequence = entry.getSequence();
		if (sequence == null) {
			return result;
		}
		Long sequenceSize = sequence.getLength();

		//collection sources' locations
		boolean hasTransgenic = false;
		List<Location> sourceLocations = new ArrayList<>();
		boolean isSourceFocuswithFullSequenceCoverage = false;
		Origin firstSourceOrigin = sources.get(0).getOrigin();

		for (SourceFeature source : sources) {
			List<Location> locations = source.getLocations().getLocations();

			if (!source.isTransgenic() && !source.isFocus()) {
				if (!locations.isEmpty()) {
					sourceLocations.add(locations.iterator().next());
				}
			} else {
				if (hasTransgenic || isSourceFocuswithFullSequenceCoverage) {
					reportError(source.getOrigin(), MESSAGE_ID_TRANSGENIC_FOCUS_OCCURRENCE);
				}

				if (source.isTransgenic()) {
					hasTransgenic = true;
					if(sequenceSize > source.getLength())
						reportError(source.getOrigin(), MESSAGE_ID_TRANSGENIC_SEQUENCE_COVERAGE);
				}

				if (source.isFocus() && sequenceSize == source.getLength()) {
					isSourceFocuswithFullSequenceCoverage = true;
				}
			}

		}

		if (sourceLocations.isEmpty() && !isSourceFocuswithFullSequenceCoverage) {
			reportCoverageError(result, entry.getOrigin(), MESSAGE_ID_NO_LOCATIONS, 0, sequenceSize);
			return result;
		}

		//sorts location so they will be checked in proper order
		Collections.sort(sourceLocations, (o1, o2) -> o1.getBeginPosition().compareTo(o2.getBeginPosition()));

		Iterator<Location> locationIter = sourceLocations.iterator();
		Location location = locationIter.next();
		Long[] firstLocation = checkLocation(location);

		//checks first location
		if (firstLocation[0] != 1 && !hasTransgenic) {
			result.append(EntryValidations.createMessage(firstSourceOrigin, Severity.ERROR, MESSAGE_ID_FIRST_BASE_ERROR, firstLocation[0]));
			return result;
		}

		Long[] lastLocationPositions = null;
		if (sourceLocations.size() == 1) {
			lastLocationPositions = firstLocation;
		} else {
			//check further locations
			for (; locationIter.hasNext(); ) {
				location = locationIter.next();
				lastLocationPositions = checkLocation(location);

				if ((firstLocation[1] + 1) != lastLocationPositions[0]) {//not contiguous
					if ((firstLocation[1] + 1) > lastLocationPositions[0]) {
						//there is an overlap, add error
						reportCoverageError(result, firstSourceOrigin, MESSAGE_ID_LOCATIONS_OVERLAP, 0, sequenceSize);
					} else if (!isSourceFocuswithFullSequenceCoverage && !hasTransgenic){
						reportCoverageError(result, firstSourceOrigin, MESSAGE_ID_GAPS_IN_LOCATIONS, 0, sequenceSize);
					}
					return result;
				}

				firstLocation[1] = lastLocationPositions[1];
			}

		}

		if(lastLocationPositions!= null && lastLocationPositions[0] != null && lastLocationPositions[1] != null) {
			if (lastLocationPositions[1] > sequenceSize) {//longer than
				reportCoverageError(result, firstSourceOrigin, MESSAGE_ID_LONG, firstLocation[1], sequenceSize);
			} else if (lastLocationPositions[1] < sequenceSize && !hasTransgenic && !isSourceFocuswithFullSequenceCoverage) {
				reportCoverageError(result, firstSourceOrigin, MESSAGE_ID_SHORT, firstLocation[1], sequenceSize);
			}
		}
        return result;
    }
1052105
public void checkOrRepairSequence(final int partition, final long nextSequence, final boolean viaAntiEntropy) {
        assert nextSequence > 0;

        MetaDataContainer metaData = getMetaDataContainer(partition);
        while (true) {
            final long currentSequence = metaData.getSequence();
            if (currentSequence >= nextSequence) {
                break;
            }
            if (metaData.casSequence(currentSequence, nextSequence)) {
                final long sequenceDiff = nextSequence - currentSequence;
                if (viaAntiEntropy || sequenceDiff > 1L) {
                    // we have found at least one missing sequence between current and next sequences. if miss is detected by
                    // anti-entropy, number of missed sequences will be `miss = next - current`, otherwise it means miss is
                    // detected by observing received invalidation event sequence numbers and number of missed sequences will be
                    // `miss = next - current - 1`.
                    final long missCount = viaAntiEntropy ? sequenceDiff : sequenceDiff - 1;
                    final long totalMissCount = metaData.addAndGetMissedSequenceCount(missCount);

                    if (logger.isFinestEnabled()) {
                        logger.finest(format("%s:[map=%s,partition=%d,currentSequence=%d,nextSequence=%d,totalMissCount=%d]",
                                "Invalid sequence", name, partition, currentSequence, nextSequence, totalMissCount));
                    }
                }
                break;
            }
        }
    }
852677
public boolean isEmpty() {
        boolean empty = true;
        boolean done = false;
        while (empty && !done) {
            for (ConcurrentServiceReferenceSet<V> s : elementMap.values()) {
                empty &= s.isEmpty();
            }
            done = true;
        }
        return empty;
    }
826438
public void checkDefaultGroupSequenceIsExpandable(final List<Class<?>> defaultGroupSequence)
      throws GroupDefinitionException {
    for (final Map.Entry<Class<?>, List<Group>> entry : sequenceMap.entrySet()) {
      final Class<?> sequence = entry.getKey();
      final List<Group> groups = entry.getValue();
      final List<Group> defaultGroupList = buildTempGroupList(defaultGroupSequence, sequence);
      final int defaultGroupIndex = containsDefaultGroupAtIndex(sequence, groups);
      if (defaultGroupIndex != -1) {
        ensureDefaultGroupSequenceIsExpandable(groups, defaultGroupList, defaultGroupIndex);
      }
    }
  }
931328
public static boolean isNonAmbNucleotideSequence(String sequence) {
	sequence = SequenceUtil.cleanSequence(sequence);
	if (SequenceUtil.DIGIT.matcher(sequence).find()) {
		return false;
	}
	if (SequenceUtil.NON_NUCLEOTIDE.matcher(sequence).find()) {
		return false;
		/*
		 * System.out.format("I found the text starting at " +
		 * "index %d and ending at index %d.%n", nonDNAmatcher .start(),
		 * nonDNAmatcher.end());
		 */
	}
	final Matcher DNAmatcher = SequenceUtil.NUCLEOTIDE.matcher(sequence);
	return DNAmatcher.find();
	}
1328987
def is_empty(self):
        
        if len(self.data) == 0:
            return True
        for v in self.data.values():
            if is_sequence(v):
                if len(v) == 0:
                    return True
                else:
                    return False
            elif bool(np.isreal(v)):
                return False
        return True