code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public final void splitTo(AbstractNode<E> newNode, List<E> sorting, int splitPoint) {
assert (isLeaf() == newNode.isLeaf());
deleteAllEntries();
StringBuilder msg = LoggingConfiguration.DEBUG ? new StringBuilder(1000) : null;
for(int i = 0; i < splitPoint; i++) {
addEntry(sorting.get(i));
i... | java |
public static void ensureClusteringResult(final Database db, final Result result) {
Collection<Clustering<?>> clusterings = ResultUtil.filterResults(db.getHierarchy(), result, Clustering.class);
if(clusterings.isEmpty()) {
ResultUtil.addChildResult(db, new ByLabelOrAllInOneClustering().run(db));
}
} | java |
public static <A> double[] toPrimitiveDoubleArray(A data, NumberArrayAdapter<?, A> adapter) {
if(adapter == DoubleArrayAdapter.STATIC) {
return ((double[]) data).clone();
}
final int len = adapter.size(data);
double[] x = new double[len];
for(int i = 0; i < len; i++) {
x[i] = adapter.get... | java |
@Override
public void flush() {
try {
out.flush();
}
catch(Exception ex) {
reportError(null, ex, ErrorManager.FLUSH_FAILURE);
}
try {
err.flush();
}
catch(Exception ex) {
reportError(null, ex, ErrorManager.FLUSH_FAILURE);
}
} | java |
@Override
public void publish(final LogRecord record) {
// determine destination
final Writer destination;
if(record.getLevel().intValue() >= Level.WARNING.intValue()) {
destination = this.err;
}
else {
destination = this.out;
}
// format
final String m;
// Progress r... | java |
private boolean checkForNaNs(NumberVector vec) {
for(int i = 0, d = vec.getDimensionality(); i < d; i++) {
double v = vec.doubleValue(i);
if(v != v) { // NaN!
return true;
}
}
return false;
} | java |
public static Relation<String> guessLabelRepresentation(Database database) throws NoSupportedDataTypeException {
try {
Relation<? extends ClassLabel> classrep = database.getRelation(TypeUtil.CLASSLABEL);
if(classrep != null) {
return new ConvertToStringView(classrep);
}
}
catch(NoS... | java |
public static ArrayModifiableDBIDs getObjectsByLabelMatch(Database database, Pattern name_pattern) {
Relation<String> relation = guessLabelRepresentation(database);
if(name_pattern == null) {
return DBIDUtil.newArray();
}
ArrayModifiableDBIDs ret = DBIDUtil.newArray();
for(DBIDIter iditer = re... | java |
@Override
public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out);
out.writeObject(conservativeApproximation);
} | java |
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in);
conservativeApproximation = (ApproximationLine) in.readObject();
} | java |
protected void updateDensities(WritableDoubleDataStore rbod_score, DoubleDBIDList referenceDists) {
DoubleDBIDListIter it = referenceDists.iter();
for(int l = 0; l < referenceDists.size(); l++) {
double density = computeDensity(referenceDists, it, l);
// computeDensity modified the iterator, reset:
... | java |
static void chooseRemaining(Relation<? extends NumberVector> relation, DBIDs ids, DistanceQuery<NumberVector> distQ, int k, List<NumberVector> means, WritableDoubleDataStore weights, double weightsum, Random random) {
while(true) {
if(weightsum > Double.MAX_VALUE) {
throw new IllegalStateException("Co... | java |
private double factor(int dimension) {
return maxima[dimension] > minima[dimension] ? maxima[dimension] - minima[dimension] : maxima[dimension] > 0 ? maxima[dimension] : 1;
} | java |
protected double derivative(int i, NumberVector v) {
final int dim = v.getDimensionality();
if(dim == 1) {
return 0.;
}
// Adjust for boundary conditions, as per the article:
i = (i == 0) ? 1 : (i == dim - 1) ? dim - 2 : i;
return (v.doubleValue(i) - v.doubleValue(i - 1) + (v.doubleValue(i... | java |
@Override
public Assignments<E> split(AbstractMTree<?, N, E, ?> tree, N node) {
final int n = node.getNumEntries();
int pos1 = random.nextInt(n), pos2 = random.nextInt(n - 1);
pos2 = pos2 >= pos1 ? pos2 + 1 : pos2;
// Build distance arrays:
double[] dis1 = new double[n], dis2 = new double[n];
... | java |
public static boolean checkCSSStatements(Collection<Pair<String,String>> statements) {
for (Pair<String, String> pair : statements) {
if (!checkCSSStatement(pair.getFirst(), pair.getSecond())) {
return false;
}
}
return true;
} | java |
public String getStatement(String key) {
for (Pair<String, String> pair : statements) {
if (pair.getFirst().equals(key)) {
return pair.getSecond();
}
}
return null;
} | java |
public void setStatement(String key, String value) {
if (value != null && !checkCSSStatement(key, value)) {
throw new InvalidCSS("Invalid CSS statement.");
}
for (Pair<String, String> pair : statements) {
if (pair.getFirst().equals(key)) {
if (value != null) {
pair.setSecond(va... | java |
public void appendCSSDefinition(StringBuilder buf) {
buf.append("\n.");
buf.append(name);
buf.append('{');
for (Pair<String, String> pair : statements) {
buf.append(pair.getFirst());
buf.append(':');
buf.append(pair.getSecond());
buf.append(";\n");
}
buf.append("}\n");
... | java |
public String inlineCSS() {
StringBuilder buf = new StringBuilder();
for (Pair<String, String> pair : statements) {
buf.append(pair.getFirst());
buf.append(':');
buf.append(pair.getSecond());
buf.append(';');
}
return buf.toString();
} | java |
protected Distribution findBestFit(final List<V> col, Adapter adapter, int d, double[] test) {
if(estimators.size() == 1) {
return estimators.get(0).estimate(col, adapter);
}
Distribution best = null;
double bestq = Double.POSITIVE_INFINITY;
trials: for(DistributionEstimator<?> est : estimator... | java |
protected boolean constantZero(List<V> column, Adapter adapter) {
for(int i = 0, s = adapter.size(column); i < s; i++) {
if(adapter.get(column, i) != 0.) {
return false;
}
}
return true;
} | java |
private StreamTokenizer makeArffTokenizer(BufferedReader br) {
// Setup tokenizer
StreamTokenizer tokenizer = new StreamTokenizer(br);
{
tokenizer.resetSyntax();
tokenizer.whitespaceChars(0, ' ');
tokenizer.ordinaryChars('0', '9'); // Do not parse numbers
tokenizer.ordinaryChar('-');... | java |
private void setupBundleHeaders(ArrayList<String> names, int[] targ, TypeInformation[] etyp, int[] dimsize, MultipleObjectsBundle bundle, boolean sparse) {
for(int in = 0, out = 0; in < targ.length; out++) {
int nin = in + 1;
for(; nin < targ.length; nin++) {
if(targ[nin] != targ[in]) {
... | java |
private void readHeader(BufferedReader br) throws IOException {
String line;
// Locate header line
while(true) {
line = br.readLine();
if(line == null) {
throw new AbortException(ARFF_HEADER_RELATION + " not found in file.");
}
// Skip comments and empty lines
if(ARFF_C... | java |
private void nextToken(StreamTokenizer tokenizer) throws IOException {
tokenizer.nextToken();
if((tokenizer.ttype == '\'') || (tokenizer.ttype == '"')) {
tokenizer.ttype = StreamTokenizer.TT_WORD;
}
else if((tokenizer.ttype == StreamTokenizer.TT_WORD) && (tokenizer.sval.equals("?"))) {
token... | java |
public static <E extends ClusterOrder> Clustering<Model> makeOPTICSCut(E co, double epsilon) {
// Clustering model we are building
Clustering<Model> clustering = new Clustering<>("OPTICS Cut Clustering", "optics-cut");
// Collects noise elements
ModifiableDBIDs noise = DBIDUtil.newHashSet();
double... | java |
public static LabelList make(Collection<String> labels) {
int size = labels.size();
if(size == 0) {
return EMPTY_LABELS;
}
return new LabelList(labels.toArray(new String[size]));
} | java |
public Clustering<SubspaceModel> run(Database db, Relation<V> relation) {
if(mu >= relation.size()) {
throw new AbortException("Parameter mu is chosen unreasonably large. This won't yield meaningful results.");
}
DiSHClusterOrder opticsResult = new Instance(db, relation).run();
if(LOG.isVerbose()... | java |
private Clustering<SubspaceModel> computeClusters(Relation<V> database, DiSHClusterOrder clusterOrder) {
final int dimensionality = RelationUtil.dimensionality(database);
// extract clusters
Object2ObjectOpenCustomHashMap<long[], List<ArrayModifiableDBIDs>> clustersMap = extractClusters(database, clusterOr... | java |
private void logClusterSizes(String m, int dimensionality, Object2ObjectOpenCustomHashMap<long[], List<ArrayModifiableDBIDs>> clustersMap) {
if(LOG.isVerbose()) {
final StringBuilder msg = new StringBuilder(1000).append(m).append('\n');
for(ObjectIterator<Object2ObjectMap.Entry<long[], List<ArrayModifia... | java |
private List<Cluster<SubspaceModel>> sortClusters(Relation<V> relation, Object2ObjectMap<long[], List<ArrayModifiableDBIDs>> clustersMap) {
final int db_dim = RelationUtil.dimensionality(relation);
// int num = 1;
List<Cluster<SubspaceModel>> clusters = new ArrayList<>();
for(long[] pv : clustersMap.key... | java |
private void checkClusters(Relation<V> relation, Object2ObjectMap<long[], List<ArrayModifiableDBIDs>> clustersMap) {
final int dimensionality = RelationUtil.dimensionality(relation);
// check if there are clusters < minpts
// and add them to not assigned
List<Pair<long[], ArrayModifiableDBIDs>> notAssig... | java |
private Pair<long[], ArrayModifiableDBIDs> findParent(Relation<V> relation, Pair<long[], ArrayModifiableDBIDs> child, Object2ObjectMap<long[], List<ArrayModifiableDBIDs>> clustersMap) {
Centroid child_centroid = ProjectedCentroid.make(child.first, relation, child.second);
Pair<long[], ArrayModifiableDBIDs> res... | java |
private int subspaceDimensionality(NumberVector v1, NumberVector v2, long[] pv1, long[] pv2, long[] commonPreferenceVector) {
// number of zero values in commonPreferenceVector
int subspaceDim = v1.getDimensionality() - BitsUtil.cardinality(commonPreferenceVector);
// special case: v1 and v2 are in paralle... | java |
protected static double weightedDistance(NumberVector v1, NumberVector v2, long[] weightVector) {
double sqrDist = 0;
for(int i = BitsUtil.nextSetBit(weightVector, 0); i >= 0; i = BitsUtil.nextSetBit(weightVector, i + 1)) {
double manhattanI = v1.doubleValue(i) - v2.doubleValue(i);
sqrDist += manhat... | java |
@Override
public double[][] processIds(DBIDs ids, Relation<? extends NumberVector> database) {
return CovarianceMatrix.make(database, ids).destroyToPopulationMatrix();
} | java |
private void updateMeta() {
meta = new BundleMeta();
BundleMeta origmeta = source.getMeta();
for(int i = 0; i < origmeta.size(); i++) {
SimpleTypeInformation<?> type = origmeta.get(i);
if(column < 0) {
// Test whether this type matches
if(TypeUtil.NUMBER_VECTOR_VARIABLE_LENGTH.is... | java |
public static double logquantile(double val, double loc, double scale) {
return loc + scale * (val - MathUtil.log1mexp(-val));
} | java |
public static <C extends Model> void logClusterSizes(Clustering<C> c) {
if(!LOG.isStatistics()) {
return;
}
final List<Cluster<C>> clusters = c.getAllClusters();
final int numc = clusters.size();
LOG.statistics(new StringStatistic(PREFIX + "name", c.getLongName()));
LOG.statistics(new Long... | java |
public void addDenseUnit(CLIQUEUnit unit) {
int numdim = unit.dimensionality();
for(int i = 0; i < numdim; i++) {
BitsUtil.setI(getDimensions(), unit.getDimension(i));
}
denseUnits.add(unit);
coverage += unit.numberOfFeatureVectors();
} | java |
public List<Pair<Subspace, ModifiableDBIDs>> determineClusters() {
List<Pair<Subspace, ModifiableDBIDs>> clusters = new ArrayList<>();
for(CLIQUEUnit unit : denseUnits) {
if(!unit.isAssigned()) {
ModifiableDBIDs cluster = DBIDUtil.newHashSet();
CLIQUESubspace model = new CLIQUESubspace(ge... | java |
public void dfs(CLIQUEUnit unit, ModifiableDBIDs cluster, CLIQUESubspace model) {
cluster.addDBIDs(unit.getIds());
unit.markAsAssigned();
model.addDenseUnit(unit);
final long[] dims = getDimensions();
for(int dim = BitsUtil.nextSetBit(dims, 0); dim >= 0; dim = BitsUtil.nextSetBit(dims, dim + 1)) {
... | java |
protected CLIQUEUnit leftNeighbor(CLIQUEUnit unit, int dim) {
for(CLIQUEUnit u : denseUnits) {
if(u.containsLeftNeighbor(unit, dim)) {
return u;
}
}
return null;
} | java |
protected CLIQUEUnit rightNeighbor(CLIQUEUnit unit, int dim) {
for(CLIQUEUnit u : denseUnits) {
if(u.containsRightNeighbor(unit, dim)) {
return u;
}
}
return null;
} | java |
private IntIterator getCommonSplitDimensions(N node) {
Collection<SplitHistory> splitHistories = new ArrayList<>(node.getNumEntries());
for(int i = 0; i < node.getNumEntries(); i++) {
SpatialEntry entry = node.getEntry(i);
if(!(entry instanceof XTreeDirectoryEntry)) {
throw new RuntimeExcept... | java |
private HyperBoundingBox mbr(final int[] entries, final int from, final int to) {
SpatialEntry first = this.node.getEntry(entries[from]);
ModifiableHyperBoundingBox mbr = new ModifiableHyperBoundingBox(first);
for(int i = from + 1; i < to; i++) {
mbr.extend(this.node.getEntry(entries[i]));
}
r... | java |
private void ensureSize(int minsize) {
if(minsize <= store.length) {
return;
}
int asize = store.length;
while(asize < minsize) {
asize = (asize >>> 1) + asize;
}
final int[] prev = store;
store = new int[asize];
System.arraycopy(prev, 0, store, 0, size);
} | java |
private void grow() {
final int newsize = store.length + (store.length >>> 1);
final int[] prev = store;
store = new int[newsize];
System.arraycopy(prev, 0, store, 0, size);
} | java |
public static double sumOfProbabilities(DBIDIter ignore, DBIDArrayIter di, double[] p) {
double s = 0;
for(di.seek(0); di.valid(); di.advance()) {
if(DBIDUtil.equal(ignore, di)) {
continue;
}
final double v = p[di.getOffset()];
if(!(v > 0)) {
break;
}
s += v;
... | java |
public synchronized static Task queue(Listener callback) {
final Task task = new Task(callback);
// TODO: synchronization?
if(THREAD != null && THREAD.isAlive()) {
THREAD.queue.add(task);
return task;
}
THREAD = new ThumbnailThread();
THREAD.queue.add(task);
THREAD.start();
r... | java |
public static void unqueue(Task task) {
if(THREAD != null) {
synchronized(THREAD) {
THREAD.queue.remove(task);
}
}
} | java |
public void beginStep(int step, String stepTitle, Logging logger) {
setProcessed(step - 1);
this.stepTitle = stepTitle;
logger.progress(this);
} | java |
protected static HyperBoundingBox computeBounds(NumberVector[] samples) {
assert(samples.length > 0) : "Cannot compute bounding box of empty set.";
// Compute bounds:
final int dimensions = samples[0].getDimensionality();
final double[] min = new double[dimensions];
final double[] max = new double[d... | java |
@Override
protected void preprocess() {
final Logging log = getLogger(); // Could be subclass
createStorage();
ArrayDBIDs ids = DBIDUtil.ensureArray(relation.getDBIDs());
if(log.isStatistics()) {
log.statistics(new LongStatistic(this.getClass().getName() + ".k", k));
}
Duration duratio... | java |
protected void objectsInserted(DBIDs ids) {
final Logging log = getLogger(); // Could be subclass
StepProgress stepprog = log.isVerbose() ? new StepProgress(3) : null;
ArrayDBIDs aids = DBIDUtil.ensureArray(ids);
// materialize the new kNNs
log.beginStep(stepprog, 1, "New insertions ocurred, materi... | java |
protected void objectsRemoved(DBIDs ids) {
final Logging log = getLogger();
StepProgress stepprog = log.isVerbose() ? new StepProgress(3) : null;
// delete the materialized (old) kNNs
log.beginStep(stepprog, 1, "New deletions ocurred, remove their materialized kNNs.");
for(DBIDIter iter = ids.iter(... | java |
protected void fireKNNsInserted(DBIDs insertions, DBIDs updates) {
KNNChangeEvent e = new KNNChangeEvent(this, KNNChangeEvent.Type.INSERT, insertions, updates);
Object[] listeners = listenerList.getListenerList();
for(int i = listeners.length - 2; i >= 0; i -= 2) {
if(listeners[i] == KNNListener.class... | java |
protected void fireKNNsRemoved(DBIDs removals, DBIDs updates) {
KNNChangeEvent e = new KNNChangeEvent(this, KNNChangeEvent.Type.DELETE, removals, updates);
Object[] listeners = listenerList.getListenerList();
for(int i = listeners.length - 2; i >= 0; i -= 2) {
if(listeners[i] == KNNListener.class) {
... | java |
@Override
public void buildClassifier(Database database, Relation<? extends ClassLabel> labelrep) {
Object2IntOpenHashMap<ClassLabel> count = new Object2IntOpenHashMap<>();
for(DBIDIter iter = labelrep.iterDBIDs(); iter.valid(); iter.advance()) {
count.addTo(labelrep.get(iter), 1);
}
int max = I... | java |
@Override
public Assignments<E> split(AbstractMTree<?, N, E, ?> tree, N node) {
final int n = node.getNumEntries();
double[][] distanceMatrix = computeDistanceMatrix(tree, node);
double miSumCR = Double.POSITIVE_INFINITY;
boolean leaf = node.isLeaf();
Assignments<E> bestAssignment = null;
for... | java |
public static double[][] unboxVectors(List<? extends NumberVector> means) {
double[][] ret = new double[means.size()][];
for(int i = 0; i < ret.length; i++) {
ret[i] = means.get(i).toArray();
}
return ret;
} | java |
public void put(double x, double y, double w) {
if(w == 0.) {
return;
}
if(sumWe <= 0.) {
sumX = x * w;
sumY = y * w;
sumWe = w;
return;
}
// Delta to previous mean
final double deltaX = x * sumWe - sumX;
final double deltaY = y * sumWe - sumY;
final double ... | java |
public double getCorrelation() {
if(!(sumXX > 0. && sumYY > 0.)) {
return (sumXX == sumYY) ? 1. : 0.;
}
return sumXY / FastMath.sqrt(sumXX * sumYY);
} | java |
public static double coefficient(double[] x, double[] y) {
final int xdim = x.length;
final int ydim = y.length;
if(xdim != ydim) {
throw new IllegalArgumentException("Invalid arguments: arrays differ in length.");
}
if(xdim == 0) {
throw new IllegalArgumentException("Empty vector.");
... | java |
public static double weightedCoefficient(NumberVector x, NumberVector y, double[] weights) {
final int xdim = x.getDimensionality();
final int ydim = y.getDimensionality();
if(xdim != ydim) {
throw new IllegalArgumentException("Invalid arguments: number vectors differ in dimensionality.");
}
i... | java |
@SuppressWarnings("unchecked")
public static <T, A> ExtendedArray<T> extend(A array, ArrayAdapter<T, A> getter, T extra) {
return new ExtendedArray<>(array, (ArrayAdapter<T, Object>) getter, extra);
} | java |
public static SelectionResult ensureSelectionResult(final Database db) {
List<SelectionResult> selections = ResultUtil.filterResults(db.getHierarchy(), db, SelectionResult.class);
if(!selections.isEmpty()) {
return selections.get(0);
}
SelectionResult sel = new SelectionResult();
ResultUtil.ad... | java |
@SuppressWarnings("unused")
public void debugRender(GL2 gl) {
if (!DEBUG || (startcamera == null)) {
return;
}
gl.glLineWidth(3f);
gl.glColor4f(1.f, 0.f, 0.f, .66f);
gl.glBegin(GL.GL_LINES);
gl.glVertex3f(0.f, 0.f, 0.f);
double rot = startangle - startcamera.getRotationZ();
gl.gl... | java |
public static List<SettingsResult> getSettingsResults(Result r) {
if(r instanceof SettingsResult) {
List<SettingsResult> ors = new ArrayList<>(1);
ors.add((SettingsResult) r);
return ors;
}
if(r instanceof HierarchicalResult) {
return ResultUtil.filterResults(((HierarchicalResult) r)... | java |
public static String usage(Collection<TrackedParameter> options) {
StringBuilder usage = new StringBuilder(10000);
if(!REFERENCE_VERSION.equals(VERSION)) {
usage.append("ELKI build: ").append(VERSION).append(NEWLINE).append(NEWLINE);
}
usage.append(REFERENCE);
// Collect options
OptionUti... | java |
protected static void printErrorMessage(Exception e) {
if(e instanceof AbortException) {
// ensure we actually show the message:
LoggingConfiguration.setVerbose(Level.VERBOSE);
LOG.verbose(e.getMessage());
}
else if(e instanceof UnspecifiedParameterException) {
LOG.error(e.getMessage... | java |
private static void printDescription(Class<?> descriptionClass) {
if(descriptionClass == null) {
return;
}
try {
LoggingConfiguration.setVerbose(Level.VERBOSE);
LOG.verbose(OptionUtil.describeParameterizable(new StringBuilder(), descriptionClass, FormatUtil.getConsoleWidth(), "").toString(... | java |
public static <T> void processDense(T data, Adapter<T> adapter, Collector collector) {
// Number of nodes
final int n = adapter.size(data);
// Best distance for each node
double[] best = new double[n];
Arrays.fill(best, Double.POSITIVE_INFINITY);
// Best previous node
int[] src = new int[n];... | java |
protected boolean isInputValid(String filename, String line, String id, String msg) {
return !filename.isEmpty() || !line.isEmpty() || !id.isEmpty() || !msg.isEmpty();
} | java |
public void parseVCppLine(String line, String projectPath, String compilationFile) {
this.parseVCppCompilerCLLine(line, projectPath, compilationFile);
} | java |
public Set<ValgrindError> processReport(File report) throws XMLStreamException {
ValgrindReportStreamHandler streamHandler = new ValgrindReportStreamHandler();
new StaxParser(streamHandler).parse(report);
return streamHandler.valgrindErrors;
} | java |
private static boolean isGeneratedNodeExcluded(AstNode astNode) {
AstNode prev = astNode.getPreviousAstNode();
return prev != null
&& prev.getTokenLine() == astNode.getTokenLine()
&& prev.isCopyBookOrGeneratedNode();
} | java |
private boolean isBreakStatementExcluded(AstNode astNode) {
boolean exclude = false;
if (excludeCaseBreak && astNode.getToken().getType().equals(CxxKeyword.BREAK)) {
for (AstNode statement = astNode.getFirstAncestor(CxxGrammarImpl.statement);
statement != null;
statement = statement.getPre... | java |
private boolean isEmptyExpressionStatement(AstNode astNode) {
if (astNode.is(CxxGrammarImpl.expressionStatement) && ";".equals(astNode.getToken().getValue())) {
AstNode statement = astNode.getFirstAncestor(CxxGrammarImpl.selectionStatement);
if (statement != null) {
return astNode.getTokenLine()... | java |
private Map<String, Macro> parsePredefinedUnitMacros(Map<String, Macro> configuredMacros) {
if (!ctorInProgress || (unitMacros != null)) {
throw new IllegalStateException("Preconditions for initial fill-out of predefinedUnitMacros were violated");
}
if (conf.getCompilationUnitSourceFiles().isEmpty() ... | java |
public <G extends Serializable> Metric<G> getMetric(CxxMetricsFactory.Key metricKey) {
Metric<G> metric = (Metric<G>) this.langSpecificMetrics.get(metricKey);
if (metric == null) {
throw new IllegalStateException("Requested metric " + metricKey + " couldn't be found");
}
return metric;
} | java |
public static List<String> getElements(File file, String charset) {
List<String> list = new ArrayList<>();
try (BufferedReader br = new BufferedReader(
new InputStreamReader(java.nio.file.Files.newInputStream(file.toPath()), charset))) {
StringBuilder sb = new StringBuilder(4096);
String line... | java |
public void saveUniqueViolation(SensorContext sensorContext, CxxReportIssue issue) {
if (uniqueIssues.add(issue)) {
saveViolation(sensorContext, issue);
}
} | java |
@SafeVarargs
public static SourceFile scanSingleFile(InputFile file, SensorContext sensorContext, CxxLanguage language,
SquidAstVisitor<Grammar>... visitors) {
return scanSingleFileConfig(language, file, new CxxConfiguration(sensorContext.fileSystem().encoding()),
visitors);
} | java |
public static SourceFile scanSingleFileConfig(CxxLanguage language, InputFile file, CxxConfiguration cxxConfig,
SquidAstVisitor<Grammar>... visitors) {
if (!file.isFile()) {
throw new IllegalArgumentException("File '" + file + "' not found.");
}
AstScanner<Grammar> scanner = create(language, cxxCo... | java |
public static String join(Path path1, Path path2) {
if (path2.toString().isEmpty()) {
return "";
}
if (!path1.isAbsolute()) {
path1 = Paths.get(".", path1.toString());
}
if (!path2.isAbsolute()) {
path2 = Paths.get(".", path2.toString());
}
Path result = path1.resolve(path... | java |
public static void parse(CxxConfiguration config, File compileCommandsFile) throws IOException {
LOG.debug("Parsing 'JSON Compilation Database' format");
ObjectMapper mapper = new ObjectMapper();
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
mapper.enable(DeserializationFeature.US... | java |
private static String getOperatorId(AstNode operatorFunctionId) {
StringBuilder builder = new StringBuilder(
operatorFunctionId.getTokenValue());
AstNode operator = operatorFunctionId
.getFirstDescendant(CxxGrammarImpl.overloadableOperator);
if (operator != null) {
AstNode opNode = oper... | java |
private static List<Token> getInlineDocumentation(Token token, int line) {
List<Token> comments = new ArrayList<>();
for (Trivia trivia : token.getTrivia()) {
if (trivia.isComment()) {
Token triviaToken = trivia.getToken();
if ((triviaToken != null)
&& (triviaToken.getLine() == ... | java |
public static String getContextStringProperty(SensorContext context, String name, String def) {
String s = context.config().get(name).orElse(null);
if (s == null || s.isEmpty()) {
return def;
}
return s;
} | java |
@Nullable
public static String resolveFilename(final String baseDir, @Nullable final String filename) {
if (filename != null) {
// Normalization can return null if path is null, is invalid,
// or is a path with back-ticks outside known directory structure
String normalizedPath = FilenameU... | java |
protected void createMultiLocationViolation(CxxReportIssue message) {
SourceFile sourceFile = getSourceFile();
Set<CxxReportIssue> messages = getMultiLocationCheckMessages(sourceFile);
if (messages == null) {
messages = new HashSet<>();
}
messages.add(message);
setMultiLocationViolation(so... | java |
public List<Epic> getEpics(Object groupIdOrPath, Integer authorId, String labels,
EpicOrderBy orderBy, SortOrder sortOrder, String search, int page, int perPage) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm(page, perPage)
.withParam("author_id", authorId)
... | java |
public Epic getEpic(Object groupIdOrPath, Integer epicIid) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid);
return (response.readEntity(Epic.class));
} | java |
public Optional<Epic> getOptionalEpic(Object groupIdOrPath, Integer epicIid) {
try {
return (Optional.ofNullable(getEpic(groupIdOrPath, epicIid)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
} | java |
public Epic createEpic(Object groupIdOrPath, String title, String labels, String description,
Date startDate, Date endDate) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("title", title, true)
.withParam("labels", labels)
.w... | java |
public Epic updateEpic(Object groupIdOrPath, Integer epicIid, String title, String labels, String description,
Date startDate, Date endDate) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("title", title, true)
.withParam("labels", labels)
... | java |
public void deleteEpic(Object groupIdOrPath, Integer epicIid) throws GitLabApiException {
delete(Response.Status.NO_CONTENT, null, "groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid);
} | java |
public List<Epic> getEpicIssues(Object groupIdOrPath, Integer epicIid) throws GitLabApiException {
return (getEpicIssues(groupIdOrPath, epicIid, getDefaultPerPage()).all());
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.