_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q23200
RuleClassifier.theBestAttributes
train
public void theBestAttributes(Instance instance, AutoExpandVector<AttributeClassObserver> observersParameter) { for(int z = 0; z < instance.numAttributes() - 1; z++){ if(!instance.isMissing(z)){ int instAttIndex = modelAttIndexToInstanceAttIndex(z, instance); ArrayList<Double> attribBest = new ArrayList<...
java
{ "resource": "" }
q23201
RuleClassifier.mainFindBestValEntropy
train
public void mainFindBestValEntropy(Node root) { if (root != null) { DoubleVector parentClassCL = new DoubleVector(); DoubleVector classCountL = root.classCountsLeft; //class count left DoubleVector classCountR = root.classCountsRight; //class count left double numInst = root.classCountsLeft.sumOfValues() ...
java
{ "resource": "" }
q23202
RuleClassifier.findBestValEntropyNominalAtt
train
public void findBestValEntropyNominalAtt(AutoExpandVector<DoubleVector> attrib, int attNumValues) { ArrayList<ArrayList<Double>> distClassValue = new ArrayList<ArrayList<Double>>(); // System.out.print("attrib"+attrib+"\n"); for (int z = 0; z < attrib.size(); z++) { distClassValue.add(new ArrayList<Double>());...
java
{ "resource": "" }
q23203
RuleClassifier.checkBestAttrib
train
public boolean checkBestAttrib(double n, AutoExpandVector<AttributeClassObserver> observerss, DoubleVector observedClassDistribution){ double h0 = entropy(observedClassDistribution); boolean isTheBest = false; double[] entropyValues = getBestSecondBestEntropy(this.saveBestGlobalEntropy); double bestEntropy ...
java
{ "resource": "" }
q23204
RuleClassifier.getBestSecondBestEntropy
train
protected double [] getBestSecondBestEntropy(DoubleVector entropy){ double[] entropyValues = new double[2]; double best = Double.MAX_VALUE; double secondBest = Double.MAX_VALUE; for (int i = 0; i < entropy.numValues(); i++) { if (entropy.getValue(i) < best) { secondBest = best; best = entropy.getValu...
java
{ "resource": "" }
q23205
RuleClassifier.getRuleMajorityClassIndex
train
protected double getRuleMajorityClassIndex(RuleClassification r) { double maxvalue = 0.0; int posMaxValue = 0; for (int i = 0; i < r.obserClassDistrib.numValues(); i++) { if (r.obserClassDistrib.getValue(i) > maxvalue) { maxvalue = r.obserClassDistrib.getValue(i); posMaxValue = i; } } return (do...
java
{ "resource": "" }
q23206
RuleClassifier.oberversDistribProb
train
protected double[] oberversDistribProb(Instance inst, DoubleVector classDistrib) { double[] votes = new double[this.numClass]; double sum = classDistrib.sumOfValues(); for (int z = 0; z < this.numClass; z++) { votes[z] = classDistrib.getValue(z) / sum; } return votes; }
java
{ "resource": "" }
q23207
RuleClassifier.weightedMax
train
protected double[] weightedMax(Instance inst) { int countFired = 0; boolean fired = false; double highest = 0.0; double[] votes = new double[this.numClass]; ArrayList<Double> ruleSetVotes = new ArrayList<Double>(); ArrayList<ArrayList<Double>> majorityProb = new ArrayList<ArrayList<Double>>(); for (int j ...
java
{ "resource": "" }
q23208
RuleClassifier.weightedSum
train
protected double[] weightedSum(Instance inst) { boolean fired = false; int countFired = 0; double[] votes = new double[this.numClass]; ArrayList<Double> weightSum = new ArrayList<Double>(); ArrayList<ArrayList<Double>> majorityProb = new ArrayList<ArrayList<Double>>(); for (int j = 0; j < this.ruleSet.size(...
java
{ "resource": "" }
q23209
MOAClassOptionEditor.closeDialog
train
protected void closeDialog() { if (m_CustomEditor instanceof Container) { Dialog dlg = PropertyDialog.getParentDialog((Container) m_CustomEditor); if (dlg != null) dlg.setVisible(false); } }
java
{ "resource": "" }
q23210
MOAClassOptionEditor.createCustomEditor
train
protected Component createCustomEditor() { JPanel panel; panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); m_EditComponent = (ClassOptionEditComponent) getEditComponent((ClassOption) getValue()); m_EditComponent.addChangeListener(new ChangeListener() { ...
java
{ "resource": "" }
q23211
MOAClassOptionEditor.paintValue
train
public void paintValue(Graphics gfx, Rectangle box) { FontMetrics fm; int vpad; String val; fm = gfx.getFontMetrics(); vpad = (box.height - fm.getHeight()) / 2 ; val = ((ClassOption) getValue()).getValueAsCLIString(); gfx.drawString(val, 2, fm.getHeight() + vpad); }
java
{ "resource": "" }
q23212
Perceptron.prediction
train
private double prediction(Instance inst) { if(this.initialisePerceptron){ return 0; }else{ double[] normalizedInstance = normalizedInstance(inst); double normalizedPrediction = prediction(normalizedInstance); return denormalizedPrediction(normalizedPrediction); } }
java
{ "resource": "" }
q23213
BucketManager.insertPoint
train
void insertPoint(Point p){ //check if there is enough space in the first bucket int cursize = this.buckets[0].cursize; if(cursize >= this.maxBucketsize) { //printf("Bucket 0 full \n"); //start spillover process int curbucket = 0; int nextbucket = 1; //check if the next bucket is empty if(t...
java
{ "resource": "" }
q23214
AccuracyUpdatedEnsemble.processChunk
train
protected void processChunk() { Classifier addedClassifier = null; double mse_r = this.computeMseR(); // Compute weights double candidateClassifierWeight = 1.0 / (mse_r + Double.MIN_VALUE); for (int i = 0; i < this.learners.length; i++) { this.weights[i][0] = 1.0 / (mse_r + this.computeMse(this.l...
java
{ "resource": "" }
q23215
AccuracyUpdatedEnsemble.computeMse
train
protected double computeMse(Classifier learner, Instances chunk) { double mse_i = 0; double f_ci; double voteSum; for (int i = 0; i < chunk.numInstances(); i++) { try { voteSum = 0; for (double element : learner.getVotesForInstance(chunk.instance(i))) { voteSum += element; } ...
java
{ "resource": "" }
q23216
AccuracyUpdatedEnsemble.trainOnChunk
train
private void trainOnChunk(Classifier classifierToTrain) { for (int num = 0; num < this.chunkSizeOption.getValue(); num++) { classifierToTrain.trainOnInstance(this.currentChunk.instance(num)); } }
java
{ "resource": "" }
q23217
Clustering.get
train
public Cluster get(int index){ if(index < clusters.size()){ return clusters.get(index); } return null; }
java
{ "resource": "" }
q23218
HoeffdingAdaptiveTree.filterInstanceToLeaves
train
public FoundNode[] filterInstanceToLeaves(Instance inst, SplitNode parent, int parentBranch, boolean updateSplitterCounts) { List<FoundNode> nodes = new LinkedList<FoundNode>(); ((NewNode) this.treeRoot).filterInstanceToLeaves(inst, parent, parentBranch, nodes, updateSplitter...
java
{ "resource": "" }
q23219
Range.setRange
train
public void setRange(String range) { String single = range.trim(); int hyphenIndex = range.indexOf('-'); if (hyphenIndex > 0) { this.start = rangeSingle(range.substring(0, hyphenIndex)); this.end = rangeSingle(range.substring(hyphenIndex + 1)); } else { ...
java
{ "resource": "" }
q23220
Range.rangeSingle
train
protected /*@pure@*/ int rangeSingle(/*@non_null@*/String singleSelection) { String single = singleSelection.trim(); if (single.toLowerCase().equals("first")) { return 0; } if (single.toLowerCase().equals("last") || single.toLowerCase().equals("-1")) { return -1;...
java
{ "resource": "" }
q23221
Utils.minMax
train
public static <T extends Comparable<T>> Pair<T> minMax(Iterable<T> items) { Iterator<T> iterator = items.iterator(); if(!iterator.hasNext()) { return null; } T min = iterator.next(); T max = min; while(iterator.hasNext()) { T item = iterator.next(); if(item.compareTo(min) < 0) { min = ite...
java
{ "resource": "" }
q23222
Utils.randomSample
train
public static <T> List<T> randomSample(Collection<T> collection, int n) { List<T> list = new ArrayList<T>(collection); List<T> sample = new ArrayList<T>(n); Random random = new Random(); while(n > 0 && !list.isEmpty()) { int index = random.nextInt(list.size()); sample.add(list.get(index)); int indexL...
java
{ "resource": "" }
q23223
GraphCanvas.updateMinMaxValues
train
private boolean updateMinMaxValues() { double min_y_value_new = min_y_value; double max_y_value_new = max_y_value; double max_x_value_new = max_x_value; if (measure0 != null && measure1 != null) { min_y_value_new = Math.min(measure0.getMinValue(measureSelected), measure1.get...
java
{ "resource": "" }
q23224
GraphCanvas.addEvents
train
private void addEvents() { if (clusterEvents != null && clusterEvents.size() > eventCounter) { ClusterEvent ev = clusterEvents.get(eventCounter); eventCounter++; JLabel eventMarker = new JLabel(ev.getType().substring(0, 1)); eventMarker.setPreferredSize(new Dimen...
java
{ "resource": "" }
q23225
BasicMultiTargetPerformanceRelativeMeasuresEvaluator.addResult
train
@Override public void addResult(Example<Instance> example, double[] classVotes) { Prediction p=new MultiLabelPrediction(1); p.setVotes(classVotes); addResult(example, p); }
java
{ "resource": "" }
q23226
ParamGraphCanvas.setGraph
train
public void setGraph(MeasureCollection[] measures, MeasureCollection[] measureStds, double[] variedParamValues, Color[] colors) { this.measures = measures; this.variedParamValues = variedParamValues; ((GraphScatter) this.plotPanel).setGraph(measures, measureStds, vari...
java
{ "resource": "" }
q23227
CobWeb.getVotesForInstance
train
public double[] getVotesForInstance(Instance instance) { //public int clusterInstance(Instance instance) {//throws Exception { CNode host = m_cobwebTree; CNode temp = null; determineNumberOfClusters(); if (this.m_numberOfClusters < 1) { return (new double[0]); ...
java
{ "resource": "" }
q23228
CobWeb.determineNumberOfClusters
train
protected void determineNumberOfClusters() { if (!m_numberOfClustersDetermined && (m_cobwebTree != null)) { int[] numClusts = new int[1]; numClusts[0] = 0; // try { m_cobwebTree.assignClusterNums(numClusts); // } // catch (...
java
{ "resource": "" }
q23229
CobWeb.graph
train
public String graph() {// throws Exception { StringBuffer text = new StringBuffer(); text.append("digraph CobwebTree {\n"); m_cobwebTree.graphTree(text); text.append("}\n"); return text.toString(); }
java
{ "resource": "" }
q23230
EuclideanDistance.sqDifference
train
public double sqDifference(int index, double val1, double val2) { double val = difference(index, val1, val2); return val*val; }
java
{ "resource": "" }
q23231
EuclideanDistance.closestPoint
train
public int closestPoint(Instance instance, Instances allPoints, int[] pointList) throws Exception { double minDist = Integer.MAX_VALUE; int bestPoint = 0; for (int i = 0; i < pointList.length; i++) { double dist = distance(instance, allPoints.instance(pointList[i]), Double.POSITIVE_INFINITY...
java
{ "resource": "" }
q23232
TaskManagerTabPanel.openConfig
train
public void openConfig(String path) { Properties properties = new Properties(); try { properties.load(new FileInputStream(path)); } catch (IOException ex) { JOptionPane.showMessageDialog(this, "Problems reading the properties file", "Error", JOptionPa...
java
{ "resource": "" }
q23233
NormalizableDistance.initializeAttributeIndices
train
protected void initializeAttributeIndices() { //m_AttributeIndices.setUpper(m_Data.numAttributes() - 1); m_ActiveIndices = new boolean[m_Data.numAttributes()]; for (int i = 0; i < m_ActiveIndices.length; i++) m_ActiveIndices[i] = true; //m_AttributeIndices.isInRange(i); }
java
{ "resource": "" }
q23234
NormalizableDistance.norm
train
protected double norm(double x, int i) { if (Double.isNaN(m_Ranges[i][R_MIN]) || (m_Ranges[i][R_MAX] == m_Ranges[i][R_MIN])) return 0; else return (x - m_Ranges[i][R_MIN]) / (m_Ranges[i][R_WIDTH]); }
java
{ "resource": "" }
q23235
NormalizableDistance.difference
train
protected double difference(int index, double val1, double val2) { //switch (m_Data.attribute(index).type()) { //case Attribute.NOMINAL: if (m_Data.attribute(index).isNominal() == true){ if (isMissingValue(val1) || isMissingValue(val2) || ((int) val1 != (int) val2)) { ...
java
{ "resource": "" }
q23236
NormalizableDistance.initializeRanges
train
public double[][] initializeRanges() { if (m_Data == null) { m_Ranges = null; return m_Ranges; } int numAtt = m_Data.numAttributes(); double[][] ranges = new double [numAtt][3]; if (m_Data.numInstances() <= 0) { initializeRangesEmpty(numAtt, ranges); m_Ranges = rang...
java
{ "resource": "" }
q23237
NormalizableDistance.updateRangesFirst
train
public void updateRangesFirst(Instance instance, int numAtt, double[][] ranges) { for (int j = 0; j < numAtt; j++) { if (!instance.isMissing(j)) { ranges[j][R_MIN] = instance.value(j); ranges[j][R_MAX] = instance.value(j); ranges[j][R_WIDTH] = 0.0; } else { // if value was ...
java
{ "resource": "" }
q23238
NormalizableDistance.initializeRangesEmpty
train
public void initializeRangesEmpty(int numAtt, double[][] ranges) { for (int j = 0; j < numAtt; j++) { ranges[j][R_MIN] = Double.POSITIVE_INFINITY; ranges[j][R_MAX] = -Double.POSITIVE_INFINITY; ranges[j][R_WIDTH] = Double.POSITIVE_INFINITY; } }
java
{ "resource": "" }
q23239
NormalizableDistance.updateRanges
train
public double[][] updateRanges(Instance instance, double[][] ranges) { // updateRangesFirst must have been called on ranges for (int j = 0; j < ranges.length; j++) { double value = instance.value(j); if (!instance.isMissing(j)) { if (value < ranges[j][R_MIN]) { ranges[j][R_MIN] = v...
java
{ "resource": "" }
q23240
NormalizableDistance.initializeRanges
train
public double[][] initializeRanges(int[] instList) throws Exception { if (m_Data == null) throw new Exception("No instances supplied."); int numAtt = m_Data.numAttributes(); double[][] ranges = new double [numAtt][3]; if (m_Data.numInstances() <= 0) { initializeRangesEmpty(numAtt, ...
java
{ "resource": "" }
q23241
NormalizableDistance.inRanges
train
public boolean inRanges(Instance instance, double[][] ranges) { boolean isIn = true; // updateRangesFirst must have been called on ranges for (int j = 0; isIn && (j < ranges.length); j++) { if (!instance.isMissing(j)) { double value = instance.value(j); isIn = value <= ranges[j][R...
java
{ "resource": "" }
q23242
Handler.setURLStreamHandlerFactory
train
public static void setURLStreamHandlerFactory ( URLStreamHandlerFactory factory ) { synchronized ( PROTOCOL_HANDLERS ) { if ( Handler.factory != null ) { throw new IllegalStateException("URLStreamHandlerFactory already set."); } PROTOCOL_HANDLERS.clear(); ...
java
{ "resource": "" }
q23243
DcerpcHandle.bind
train
public void bind () throws DcerpcException, IOException { synchronized ( this ) { try { this.state = 1; DcerpcMessage bind = new DcerpcBind(this.binding, this); sendrecv(bind); } catch ( IOException ioe ) { this....
java
{ "resource": "" }
q23244
SmbFile.list
train
public String[] list () throws SmbException { return SmbEnumerationUtil.list(this, "*", ATTR_DIRECTORY | ATTR_HIDDEN | ATTR_SYSTEM, null, null); }
java
{ "resource": "" }
q23245
SMB1SigningDigest.update
train
public void update ( byte[] input, int offset, int len ) { if ( log.isTraceEnabled() ) { log.trace("update: " + this.updates + " " + offset + ":" + len); log.trace(Hexdump.toHexString(input, offset, Math.min(len, 256))); } if ( len == 0 ) { return; /* CRITICAL...
java
{ "resource": "" }
q23246
Type3Message.setupMIC
train
public void setupMIC ( byte[] type1, byte[] type2 ) throws GeneralSecurityException, IOException { byte[] sk = this.masterKey; if ( sk == null ) { return; } MessageDigest mac = Crypto.getHMACT64(sk); mac.update(type1); mac.update(type2); byte[] type3 =...
java
{ "resource": "" }
q23247
Type3Message.getDefaultFlags
train
public static int getDefaultFlags ( CIFSContext tc ) { return NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_VERSION | ( tc.getConfig().isUseUnicode() ? NTLMSSP_NEGOTIATE_UNICODE : NTLMSSP_NEGOTIATE_OEM ); }
java
{ "resource": "" }
q23248
AvPairs.decode
train
public static List<AvPair> decode ( byte[] data ) throws CIFSException { List<AvPair> pairs = new LinkedList<>(); int pos = 0; boolean foundEnd = false; while ( pos + 4 <= data.length ) { int avId = SMBUtil.readInt2(data, pos); int avLen = SMBUtil.readInt2(data, p...
java
{ "resource": "" }
q23249
AvPairs.remove
train
public static void remove ( List<AvPair> pairs, int type ) { Iterator<AvPair> it = pairs.iterator(); while ( it.hasNext() ) { AvPair p = it.next(); if ( p.getType() == type ) { it.remove(); } } }
java
{ "resource": "" }
q23250
AvPairs.replace
train
public static void replace ( List<AvPair> pairs, AvPair rep ) { remove(pairs, rep.getType()); pairs.add(rep); }
java
{ "resource": "" }
q23251
SmbFileOutputStream.close
train
@Override public void close () throws IOException { try { if ( this.handle.isValid() ) { this.handle.close(); } } finally { this.file.clearAttributeCache(); this.tmp = null; } }
java
{ "resource": "" }
q23252
SmbSessionImpl.treeConnectLogon
train
@Override public void treeConnectLogon () throws SmbException { String logonShare = getContext().getConfig().getLogonShare(); if ( logonShare == null || logonShare.isEmpty() ) { throw new SmbException("Logon share is not defined"); } try ( SmbTreeImpl t = getSmbTree(logon...
java
{ "resource": "" }
q23253
Transport.readn
train
public static int readn ( InputStream in, byte[] b, int off, int len ) throws IOException { int i = 0, n = -5; if ( off + len > b.length ) { throw new IOException("Buffer too short, bufsize " + b.length + " read " + len); } while ( i < len ) { n = in.read(b, off...
java
{ "resource": "" }
q23254
Transport.sendrecv
train
public <T extends Response> T sendrecv ( Request request, T response, Set<RequestParam> params ) throws IOException { if ( isDisconnected() && this.state != 5 ) { throw new TransportException("Transport is disconnected " + this.name); } try { long timeout = !params.contai...
java
{ "resource": "" }
q23255
Transport.disconnect
train
public synchronized boolean disconnect ( boolean hard, boolean inUse ) throws IOException { IOException ioe = null; switch ( this.state ) { case 0: /* not connected - just return */ case 5: case 6: return false; case 2: hard = true; case 3...
java
{ "resource": "" }
q23256
SmbTransportImpl.doRecv
train
@Override protected void doRecv ( Response response ) throws IOException { CommonServerMessageBlock resp = (CommonServerMessageBlock) response; this.negotiated.setupResponse(response); try { if ( this.smb2 ) { doRecvSMB2(resp); } else { ...
java
{ "resource": "" }
q23257
UniAddress.isDotQuadIP
train
public static boolean isDotQuadIP ( String hostname ) { if ( Character.isDigit(hostname.charAt(0)) ) { int i, len, dots; char[] data; i = dots = 0; /* quick IP address validation */ len = hostname.length(); data = hostname.toCharArray(); w...
java
{ "resource": "" }
q23258
SingletonContext.init
train
public static synchronized final void init ( Properties props ) throws CIFSException { if ( INSTANCE != null ) { throw new CIFSException("Singleton context is already initialized"); } Properties p = new Properties(); try { String filename = System.getProperty("jci...
java
{ "resource": "" }
q23259
SingletonContext.getInstance
train
public static synchronized final SingletonContext getInstance () { if ( INSTANCE == null ) { try { log.debug("Initializing singleton context"); init(null); } catch ( CIFSException e ) { log.error("Failed to create singleton JCIF...
java
{ "resource": "" }
q23260
NumberUtil.getPowerOf2
train
public static int getPowerOf2(long value) { Preconditions.checkArgument(isPowerOf2(value)); return Long.SIZE-(Long.numberOfLeadingZeros(value)+1); }
java
{ "resource": "" }
q23261
BackendTransaction.rollback
train
@Override public void rollback() throws BackendException { Throwable excep = null; for (IndexTransaction itx : indexTx.values()) { try { itx.rollback(); } catch (Throwable e) { excep = e; } } storeTx.rollback(); ...
java
{ "resource": "" }
q23262
PartitionIDRange.contains
train
public boolean contains(int partitionId) { if (lowerID < upperID) { //"Proper" id range return lowerID <= partitionId && upperID > partitionId; } else { //Id range "wraps around" return (lowerID <= partitionId && partitionId < idUpperBound) || (upperID > parti...
java
{ "resource": "" }
q23263
PartitionIDRange.getRandomID
train
public int getRandomID() { //Compute the width of the partition... int partitionWidth; if (lowerID < upperID) partitionWidth = upperID - lowerID; //... for "proper" ranges else partitionWidth = (idUpperBound - lowerID) + upperID; //... and those that "wrap around" Preconditions.c...
java
{ "resource": "" }
q23264
ObjectAccumulator.incBy
train
public double incBy(K o, double inc) { Counter c = countMap.get(o); if (c == null) { c = new Counter(); countMap.put(o, c); } c.count += inc; return c.count; }
java
{ "resource": "" }
q23265
GraphDatabaseConfiguration.getHomeDirectory
train
public File getHomeDirectory() { if (!configuration.has(STORAGE_DIRECTORY)) throw new UnsupportedOperationException("No home directory specified"); File dir = new File(configuration.get(STORAGE_DIRECTORY)); Preconditions.checkArgument(dir.isDirectory(), "Not a directory"); re...
java
{ "resource": "" }
q23266
KCVSLog.close
train
@Override public synchronized void close() throws BackendException { if (!isOpen) return; this.isOpen = false; if (readExecutor!=null) readExecutor.shutdown(); if (sendThread!=null) sendThread.close(CLOSE_DOWN_WAIT); if (readExecutor!=null) { try { ...
java
{ "resource": "" }
q23267
KCVSLog.sendMessages
train
private void sendMessages(final List<MessageEnvelope> msgEnvelopes) { try { boolean success=BackendOperation.execute(new BackendOperation.Transactional<Boolean>() { @Override public Boolean call(StoreTransaction txh) throws BackendException { ListM...
java
{ "resource": "" }
q23268
Mutation.addition
train
public void addition(E entry) { if (additions==null) additions = new ArrayList<E>(); additions.add(entry); }
java
{ "resource": "" }
q23269
Mutation.deletion
train
public void deletion(K key) { if (deletions==null) deletions = new ArrayList<K>(); deletions.add(key); }
java
{ "resource": "" }
q23270
Mutation.merge
train
public void merge(Mutation<E,K> m) { Preconditions.checkNotNull(m); if (null != m.additions) { if (null == additions) additions = m.additions; else additions.addAll(m.additions); } if (null != m.deletions) { if (null == deletions) deletions = m.delet...
java
{ "resource": "" }
q23271
CTConnectionFactory.makeRawConnection
train
public CTConnection makeRawConnection() throws TTransportException { final Config cfg = cfgRef.get(); String hostname = cfg.getRandomHost(); log.debug("Creating TSocket({}, {}, {}, {}, {})", hostname, cfg.port, cfg.username, cfg.password, cfg.timeoutMS); TSocket socket; if (nu...
java
{ "resource": "" }
q23272
BasicVertexCentricQueryBuilder.profiler
train
public Q profiler(QueryProfiler profiler) { Preconditions.checkNotNull(profiler); this.profiler=profiler; return getThis(); }
java
{ "resource": "" }
q23273
Geoshape.point
train
public static final Geoshape point(final float latitude, final float longitude) { Preconditions.checkArgument(isValidCoordinate(latitude,longitude),"Invalid coordinate provided"); return new Geoshape(new float[][]{ new float[]{latitude}, new float[]{longitude}}); }
java
{ "resource": "" }
q23274
Geoshape.circle
train
public static final Geoshape circle(final float latitude, final float longitude, final float radiusInKM) { Preconditions.checkArgument(isValidCoordinate(latitude,longitude),"Invalid coordinate provided"); Preconditions.checkArgument(radiusInKM>0,"Invalid radius provided [%s]",radiusInKM); return...
java
{ "resource": "" }
q23275
ManagementUtil.awaitGraphIndexUpdate
train
public static void awaitGraphIndexUpdate(TitanGraph g, String indexName, long time, TemporalUnit unit) { awaitIndexUpdate(g,indexName,null,time,unit); }
java
{ "resource": "" }
q23276
TitanCleanup.clear
train
public static final void clear(TitanGraph graph) { Preconditions.checkNotNull(graph); Preconditions.checkArgument(graph instanceof StandardTitanGraph,"Invalid graph instance detected: %s",graph.getClass()); StandardTitanGraph g = (StandardTitanGraph)graph; Preconditions.checkArgument(!g....
java
{ "resource": "" }
q23277
ElementHelper.attachProperties
train
public static void attachProperties(final TitanVertex vertex, final Object... propertyKeyValues) { if (null == vertex) throw Graph.Exceptions.argumentCanNotBeNull("vertex"); for (int i = 0; i < propertyKeyValues.length; i = i + 2) { if (!propertyKeyValues[i].equals(T.id) && !pro...
java
{ "resource": "" }
q23278
OrderList.hasCommonOrder
train
public boolean hasCommonOrder() { Order lastOrder = null; for (OrderEntry oe : list) { if (lastOrder==null) lastOrder=oe.order; else if (lastOrder!=oe.order) return false; } return true; }
java
{ "resource": "" }
q23279
ReadMarker.getStartTime
train
public synchronized Instant getStartTime(TimestampProvider times) { if (startTime==null) { startTime = times.getTime(); } return startTime; }
java
{ "resource": "" }
q23280
CompactMap.deduplicateKeys
train
private static final String[] deduplicateKeys(String[] keys) { synchronized (KEY_CACHE) { KEY_HULL.setKeys(keys); KeyContainer retrieved = KEY_CACHE.get(KEY_HULL); if (retrieved==null) { retrieved = new KeyContainer(keys); KEY_CACHE.put(retriev...
java
{ "resource": "" }
q23281
KCVSUtil.get
train
public static StaticBuffer get(KeyColumnValueStore store, StaticBuffer key, StaticBuffer column, StoreTransaction txh) throws BackendException { KeySliceQuery query = new KeySliceQuery(key, column, BufferUtil.nextBiggerBuffer(column)).setLimit(2); List<Entry> result = store.getSlice(query, txh); ...
java
{ "resource": "" }
q23282
KCVSUtil.containsKeyColumn
train
public static boolean containsKeyColumn(KeyColumnValueStore store, StaticBuffer key, StaticBuffer column, StoreTransaction txh) throws BackendException { return get(store, key, column, txh) != null; }
java
{ "resource": "" }
q23283
KCVSConfiguration.get
train
@Override public <O> O get(final String key, final Class<O> datatype) { StaticBuffer column = string2StaticBuffer(key); final KeySliceQuery query = new KeySliceQuery(rowKey,column, BufferUtil.nextBiggerBuffer(column)); StaticBuffer result = BackendOperation.execute(new BackendOperation.Trans...
java
{ "resource": "" }
q23284
KCVSConfiguration.set
train
@Override public <O> void set(String key, O value) { set(key,value,null,false); }
java
{ "resource": "" }
q23285
HBaseStoreManager.convertToCommands
train
private Map<StaticBuffer, Pair<Put, Delete>> convertToCommands(Map<String, Map<StaticBuffer, KCVMutation>> mutations, final long putTimestamp, final long delTimestamp) throws PermanentBa...
java
{ "resource": "" }
q23286
IndexRepairJob.validateIndexStatus
train
@Override protected void validateIndexStatus() { TitanSchemaVertex schemaVertex = mgmt.getSchemaVertex(index); Set<SchemaStatus> acceptableStatuses = SchemaAction.REINDEX.getApplicableStatus(); boolean isValidIndex = true; String invalidIndexHint; if (index instanceof Relatio...
java
{ "resource": "" }
q23287
SolrIndex.register
train
@Override public void register(String store, String key, KeyInformation information, BaseTransaction tx) throws BackendException { if (mode==Mode.CLOUD) { CloudSolrClient client = (CloudSolrClient) solrClient; try { createCollectionIfNotExists(client, configuration, s...
java
{ "resource": "" }
q23288
SolrIndex.checkIfCollectionExists
train
private static boolean checkIfCollectionExists(CloudSolrClient server, String collection) throws KeeperException, InterruptedException { ZkStateReader zkStateReader = server.getZkStateReader(); zkStateReader.updateClusterState(true); ClusterState clusterState = zkStateReader.getClusterState(); ...
java
{ "resource": "" }
q23289
SolrIndex.waitForRecoveriesToFinish
train
private static void waitForRecoveriesToFinish(CloudSolrClient server, String collection) throws KeeperException, InterruptedException { ZkStateReader zkStateReader = server.getZkStateReader(); try { boolean cont = true; while (cont) { boolean sawLiveRecovering = ...
java
{ "resource": "" }
q23290
AbstractExecMojo.parseCommandlineArgs
train
protected String[] parseCommandlineArgs() throws MojoExecutionException { if ( commandlineArgs == null ) { return null; } else { try { return CommandLineUtils.translateCommandline( commandlineArgs ); } ...
java
{ "resource": "" }
q23291
AbstractExecMojo.registerSourceRoots
train
protected void registerSourceRoots() { if ( sourceRoot != null ) { getLog().info( "Registering compile source root " + sourceRoot ); project.addCompileSourceRoot( sourceRoot.toString() ); } if ( testSourceRoot != null ) { getLog().info( "R...
java
{ "resource": "" }
q23292
TemplateCodeGenerator.genImportCode
train
private void genImportCode() { Set<String> imports = new HashSet<String>(); imports.add("java.util.*"); imports.add("java.io.IOException"); imports.add("java.lang.reflect.*"); imports.add("com.baidu.bjf.remoting.protobuf.code.*"); imports.add("com.baidu.bjf.remoting...
java
{ "resource": "" }
q23293
MiniTemplator.reset
train
public void reset() { if (varValuesTab == null) { varValuesTab = new String[mtp.varTabCnt]; } else { for (int varNo = 0; varNo < mtp.varTabCnt; varNo++) { varValuesTab[varNo] = null; } } if (blockDynTab == null) { b...
java
{ "resource": "" }
q23294
MiniTemplator.getVariables
train
public Map<String, String> getVariables() { HashMap<String, String> map = new HashMap<String, String>(mtp.varTabCnt); for (int varNo = 0; varNo < mtp.varTabCnt; varNo++) map.put(mtp.varTab[varNo], varValuesTab[varNo]); return map; }
java
{ "resource": "" }
q23295
MiniTemplator.registerBlockInstance
train
private int registerBlockInstance() { int blockInstNo = blockInstTabCnt++; if (blockInstTab == null) { blockInstTab = new BlockInstTabRec[64]; } if (blockInstTabCnt > blockInstTab.length) { blockInstTab = (BlockInstTabRec[]) MiniTemplatorParser.resizeArray(b...
java
{ "resource": "" }
q23296
MiniTemplator.generateOutput
train
public void generateOutput(String outputFileName) throws IOException { FileOutputStream stream = null; OutputStreamWriter writer = null; try { stream = new FileOutputStream(outputFileName); writer = new OutputStreamWriter(stream, charset); generateOutput...
java
{ "resource": "" }
q23297
MiniTemplator.generateOutput
train
public void generateOutput(Writer outputWriter) throws IOException { String s = generateOutput(); outputWriter.write(s); }
java
{ "resource": "" }
q23298
MiniTemplator.generateOutput
train
public String generateOutput() { if (blockDynTab[0].instances == 0) { addBlockByNo(0); } // add main block for (int blockNo = 0; blockNo < mtp.blockTabCnt; blockNo++) { BlockDynTabRec bdtr = blockDynTab[blockNo]; bdtr.currBlockInstNo = bdtr.firstBlockIns...
java
{ "resource": "" }
q23299
MiniTemplator.writeBlockInstances
train
private void writeBlockInstances(StringBuilder out, int blockNo, int parentInstLevel) { BlockDynTabRec bdtr = blockDynTab[blockNo]; while (true) { int blockInstNo = bdtr.currBlockInstNo; if (blockInstNo == -1) { break; } BlockInstTab...
java
{ "resource": "" }