id
stringlengths
7
14
text
stringlengths
1
37.2k
5445246_4
public LiteralExtractor() { }
5449213_0
public long round(final long timestamp) { final long rounded = _cache.get(timestamp); if(rounded == _noEntryKey) return roundAndCache(timestamp); else return rounded; }
5455271_0
public void loadSubclusters(String subclustersString) { ConcurrentHashMap<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); if(subclustersString != null) { subclustersString = subclustersString.replaceAll(" ", ""); String[] groups = subclustersString.split("\\)\\("); for(int q=0; q<grou...
5455433_389
@Override public boolean equals(Object other) { if (other == null) { return false; } if (!(other instanceof Text)) { return false; } Text t = (Text) other; if (this.len != t.len) { return false; } //return this.hashCode() == t.hashCode(); return compareChar...
5455441_14
public String getSerializedData() { if (this.data == null) return ""; else { boolean isFirst = true; StringBuilder sb = new StringBuilder(); for (long l : data) { if (isFirst) isFirst = false; else sb.append("."); ...
5455452_5
public byte[] readIndefinite() throws AsnException, IOException { int startPos = this.pos; this.advanceIndefiniteLength(); byte[] res = new byte[this.pos - startPos - 2]; System.arraycopy(this.buffer, this.start + startPos, res, 0, this.pos - startPos - 2); return res; }
5455458_5
@Override public String toString() { final StringBuilder buffer = new StringBuilder(); if (!initialPrompts.isEmpty()) { buffer.append("ip="); for (int index = 0; index < initialPrompts.size(); index++) { buffer.append(initialPrompts.get(index)); if (index < initialPrompts...
5455474_2
@Override public void addCcMccmnc(String countryCode, String mccMnc, String smsc) throws Exception { CcMccmncImpl ccMccmnc = new CcMccmncImpl(countryCode, mccMnc, smsc); ccMccmncCollection.addCcMccmnc(ccMccmnc); this.store(); }
5455483_0
public String getUssdString() { return ussdString; }
5473913_0
public TransactionManager() { final File dir = new File("data"); dir.mkdirs(); timer = new Timer("TransactionTimeoutThread", false); timer.schedule(new TimerTask() { @Override public void run() { lock.lock(); try { long start = System.currentTimeM...
5487921_15
public static int compare(String oneVersion, String anotherVersion) { return new Version(oneVersion).compareTo(new Version(anotherVersion)); }
5495870_6
protected static boolean installedFromMarket(WeakReference<? extends Context> weakContext) { boolean result = false; Context context = weakContext.get(); if (context != null) { try { String installer = context.getPackageManager().getInstallerPackageName(context.getPackageName()); ...
5502061_0
@Override public org.slf4j.Logger getLogger(String name) { LoggerAdapter logger = loggers.get(name); if (logger == null) { logger = createLogger(name); LoggerAdapter logger2 = loggers.putIfAbsent(name, logger); if (logger2 != null) logger = logger2; } return logger; }
5509523_13
@Override public Stats stats() { return this.statistics; }
5510832_6
@Override public boolean write(boolean isByteMode, int address, int value) { return false; }
5517956_3
@Override public int compare( final ProjectRelationship<?, ?> one, final ProjectRelationship<?, ?> two ) { if ( one.getType() == two.getType() ) { if ( one.getPomLocation() .equals( RelationshipConstants.POM_ROOT_URI ) && !two.getPomLocation() ...
5529658_109
protected List<ModuleBuildFuture> collectFutures(ModuleList moduleList, HttpServletRequest request) throws IOException { final String sourceMethod = "collectFutures"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Objec...
5551767_0
public static void main(String[] args) { String file = "C:/Users/Kerwyn/Desktop/pg17989.txt"; String preprocessed_file = ""; try { preprocessed_file = preprocess(file); } catch (FileNotFoundException e) { /* file doesn't exist */ System.err.println(file + " doesn't exists. Pick one instead."); JFileChooser...
5561881_3
public Object run(final String functionReference, final Object... values) { // Create a local copy of the bindings so we can multi-thread. Context context = enterContext(); try { Scriptable object = this.localScope; Iterator<String> parts = Splitter.on('.').split(functionReference).iterator(); while (...
5590873_13
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalNotContainedArgumentException.class }) public static <T extends Object> void contains(final boolean condition, @Nonnull final Collection<T> haystack, @Nonnull final T needle) { if (condition) { Check.contains(haystack, needle); } }
5598875_74
public synchronized boolean cancel(boolean block) { switch (state) { case COMPLETED: case CANCELLED: // the task has already completed or been cancelled return false; case RUNNING: if (block) { while (state == State.RUNNING) { ...
5601676_139
public String getApplicationDescription() { return applicationDescription; }
5610434_1
public static Page createPage(String rawJSON) throws FacebookException { try { JSONObject json = new JSONObject(rawJSON); return pageConstructor.newInstance(json); } catch (InstantiationException e) { throw new FacebookException(e); } catch (IllegalAccessException e) { throw ...
5615967_1
protected ModelEvent remove(EditorModel em, String key) { elementMap.remove(key); return new DefaultModelEvent(commandName, this, null, null, changed); }
5626414_3
@Override protected HandlerMethod lookupHandlerMethod(String lookupPath, HttpServletRequest request) throws Exception { if (lookupPath.startsWith(serviceRootPathWithSlash)) { doHandleMatch(doCreateRequestMappingInfo(), lookupPath, request); return new HandlerMethod(handler, handlerMethod); } return super.looku...
5632139_73
public String getInstanceId() { return instanceId; }
5634637_2
private Schema getSchema() { try { return Utils.getSchemaFromString(getProperties().getProperty(SCHEMA)); } catch (ParserException e) { throw new RuntimeException("can not get schema from context", e); } }
5643380_43
@Override public int hashCode() { int hash = 7; hash = 89 * hash + fileIssue.hashCode(); return hash; }
5661262_0
public boolean changeCallSiteTarget(String methodType, String oldTarget, String newTarget) throws IOException { Map obj = new LinkedHashMap(); obj.put("call", "changeCallSiteTarget"); obj.put("methodType", methodType); obj.put("oldTarget", oldTarget); obj.put("newTarget", newTarget); String str...
5674787_263
public static CFG buildCFG(List<? extends Tree> trees, boolean ignoreBreak) { return new CFG(trees, null, ignoreBreak); }
5675901_29
@Override public <A extends RestAction<R>, R> R deserialize(A action, Response response) throws ActionException { if (isSuccessStatusCode(response)) { return getDeserializedResponse(action, response); } else { throw new ActionException(response.getStatusText()); } }
5683980_4
@SuppressWarnings("unchecked") @Override public void execute() { log(Main.getAntVersion()); log("SonarQube Ant Task version: " + SonarQubeTaskUtils.getTaskVersion()); log("Loaded from: " + SonarQubeTaskUtils.getJarPath()); Map<String, String> allProps = new HashMap<>(); allProps.put(PROJECT_BASEDIR_PROPERTY,...
5686301_34
@CheckForNull public File get(String filename, String hash) { Path cachedFile = dir.resolve(hash).resolve(filename); if (Files.exists(cachedFile)) { return cachedFile.toFile(); } logger.debug(String.format("No file found in the cache with name %s and hash %s", filename, hash)); return null; }
5704054_2
@Override public void update(final Entity e) throws URISyntaxException, MessageProcessingException, IOException, SLIClientException { URL url = URLBuilder.create(restClient.getBaseURL()).entityType(e.getEntityType()).id(e.getId()).build(); Response response = restClient.putRequest(url, mapper.writeValue...
5706983_1
static public int findSampleLessOrEqual(ChartSampleSequence samples, double x) { synchronized (samples) { ChartSampleSearch binary = new ChartSampleSearch(); if (binary.search(samples, x)) return binary.mid; // Didn't find exact match. if (binary.cmp < 0) // 'mid' sam...
5710819_3
protected void setNumTTVMsForCluster(VHMInputMessage input) { CompoundStatus thisStatus = new CompoundStatus("setNumTTVMsForCluster"); CompoundStatus vmChooserStatus = null; CompoundStatus edPolicyStatus = null; try { HadoopCluster cluster = new HadoopCluster(input.getClusterName(), input.getJobTracke...
5722110_54
@Override public <T> T convert(Object source, T target, String... tags) { if (null == source || null == target) { throw new JTransfoException("Source and target are required to be not-null."); } source = replaceObject(source); boolean targetIsTo = false; if (!toHelper.isTo(source)) { ...
5726012_9
public DeviceControllerDeviceStatus getDeviceStatus() throws IOException { // get status from device int deviceStatus = read(MEMADDR_STATUS); // check formal criterias int reservedValue = deviceStatus & STATUS_RESERVED_MASK; if (reservedValue != STATUS_RESERVED_VALUE) { throw new IOException( "status-bits ...
5740378_0
@Override public final int compareTo(final StorageUnit<?> that) { return this.bytes.compareTo(that.bytes); }
5745625_3
;
5754848_4
@DELETE public void deleteAll() { dao.deleteAll(); }
5770443_0
public JDefinedClass build() { JPackage _package = determinePackage(); try { definedClass = _package._enum(typeName); } catch (JClassAlreadyExistsException e) { throw new RuntimeException(e.getExistingClass().fullName() + " is already defined in the code model.", e); } addJavadocs(...
5793618_42
public Collection<T> createAll(final Object... arguments) { Collection<T> instances = new ArrayList<T>(classes.size()); for (String className : classes) { T instance = createInstance(className, arguments); if (instance != null) { instances.add(instance); } } return instances; }
5793738_15
public CreateTaskVariablePayload handleCreateTaskVariablePayload(CreateTaskVariablePayload createTaskVariablePayload) { checkNotValidCharactersInVariableName(createTaskVariablePayload.getName(), "Variable has not a valid name: "); Object value = createTaskVariablePay...
5832036_1
@Override public void add(Network network) { switch (network.getType()) { case WIFI: addWiFi( network ); break; case CDMA: case GSM: case WCDMA: case LTE: addCell(network); break; case BT: addBluetooth(networ...
5839179_20
public String getForegroundColor() { return foregroundColor; }
5841522_1
public void updateIndex() { long startTime = System.currentTimeMillis(); try { if (searchStatusHolder.getStatus() != SearchStatus.WAITING) { throw new IndexingUnderwayException(); } JochreSearchManager manager = JochreSearchManager.getInstance(configId); searchStatusHolder.setStatus(SearchSt...
5853673_2
@Override public String classToTableName(String className) { return super.classToTableName(className).toUpperCase(); }
5861549_2
boolean renderMarker(List<Point3D_F64> marker, Se3_F64 BodyToCamera, List<Point2D_F64> pixels) { Point3D_F64 p3 = new Point3D_F64(); for (int indexCorner = 0; indexCorner < marker.size(); indexCorner++) { BodyToCamera.transform(marker.get(indexCorner), p3); if( p3.z <= 0 ) return fa...
5874016_2
@Override public void annotate(JCas aJCas) throws AlignmentComponentException { // get T lemma sequence as one single string String tLemmaSeq = null; // TEXTVIEW Lemma sequences (ordered) as one string, for quick existence check / String hLemmaSeq = null; // HYPOTHESISVIEW Lemma sequences (ordered) as one stri...
5887512_0
@Override public boolean matches(RenderContext context) { if (expression == null) { throw new IllegalStateException("Missing expression statement."); } ExpressionEvaluator evaluator = context.getExpressionEvaluator(); Object result = evaluator.evaluate(expression, context.getExpressionContext()); if (resul...
5947247_22
public void setOrdinate(int index, int ordinateIndex, double value) { switch (ordinateIndex) { case 0: x[index] = value; break; case 1: y[index] = value; break; default: throw new IllegalArgumentException("invalid ordinate index: ...
5970660_5
public String createDate(Date d) { // Shift the timezone to UTC SimpleDateFormat dateFormatter = new SimpleDateFormat(YEAR_MONTH_DAY_FORMAT); dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); // ICal DATE pattern: <yyyyMMdd> return dateFormatter.format(d); }
5973879_0
@Override public void beforeSave(StorageItem storageItem, StorageItemUploadPart part) throws IOException { if (part == null) { return; } String fileContentType = part.getContentType(); if (fileContentType == null) { return; } String groupsPattern = Settings.get(String.class, ...
5999841_31
public List<LogEntry> getLogEntriesForTenant(int tenantId, int offset, int limit) { Preconditions.checkArgument(offset >= 0, "offset must be greater than or equal to 0"); Preconditions.checkArgument(limit >= 0, "limit must be greater than or equal to 0"); return getLogEntriesForTenant.execute(tenantId, off...
6002930_4
@Override protected void check(MappedClass mc, MappedField mf, Set<ConstraintViolation> ve) { if (mf.isMap()) { if (mf.hasAnnotation(Serialized.class)) { Class<?> keyClass = ReflectionUtils.getParameterizedClass(mf.getField(), 0); Class<?> valueClass = ReflectionUtils.getParameterize...
6010090_33
public Collection<Link> getAll() { return links; }
6017453_1
public static <T extends Throwable> T anyCauseOf(Throwable ex, Class<T> type) { if (type.isInstance(ex)) { return (T) ex; } Throwable cause = ex.getCause(); if (cause != null) { return anyCauseOf(cause, type); } return null; }
6018023_3
@Override public void authenticate(final String username, final String passwdOrToken) throws UnauthorizedException { try { userService.checkUserAndHash(username, passwdOrToken); LOG.info(String.format("User \'%s\' logged", username)); } catch (final Exception e) { final String msg = String.format(US...
6022685_4
public static Picture fromBitmap(Bitmap src) { return inst().fromBitmapImpl(src); }
6051489_17
@Override public void onOpen(ResourceContext context) throws ItemStreamException { context.setRowsToSkip(rowsToSkip); }
6064729_0
@Override public void outgoingBroadcast(Object message) { getTopic().publish(message); }
6084210_1
@Override public boolean add(E e) { checkSize( 1 ); return super.add( e ); }
6090885_1
public static List<String> getGroups(String path, String regex) { List<String> captures = new ArrayList<String>(); Matcher m = Pattern.compile(regex).matcher(path); if (m.lookingAt()) { for (int i = 1; i <= m.groupCount(); i++) { if (m.group(i) != null) captures.add(m.group(i)); ...
6092163_487
@Override public synchronized <T> T getService(Class<T> iface) { Object service = this.serviceMap.get(iface); if (service == null) { service = Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {iface}, new RemoteInvocationHandler(iface, false) { @Override prote...
6104876_0
@Override public String toString() { StringBuffer outBuf = new StringBuffer(); outBuf.append(this.DeviceType.name()); outBuf.append(": MAC(" + this.GetMacAddressString() + "), "); outBuf.append("IP(" + this.IpAddress.toString() + "), "); outBuf.append("Protocol Ver(" + this.ProtocolVersion + "), "); outBuf....
6114161_12
public static long getPercentile(List<Long> longList, int p, long defaultValue) { if (longList == null || longList.isEmpty()) { return defaultValue; } if (p < 0 || p > 100) { return defaultValue; } int size = longList.size(); if (((long) size * (long) p) % 100L == 0) { // 割り切れる→二値の平均 int n = (int) (((...
6123097_32
@Override public void calculateFeatures(DocumentAffiliation affiliation) { List<Token<AffiliationLabel>> tokens = affiliation.getTokens(); for (Token<AffiliationLabel> token : tokens) { for (BinaryTokenFeatureCalculator binaryFeatureCalculator : binaryFeatures) { if (binaryFeatureCalculator...
6123437_2
public static String getPropertyFromClassPath(String propertyFileResourcePath,String propertyName ) throws Exception { Properties p = new Properties(); InputStream inStream = null; try { inStream = ClassSearchUtil.class.getClassLoader().getResourceAsStream(propertyFileResourcePath); if (inStream == null){ thr...
6154058_11
@Deprecated public static void assemble(GraphCollection namedSignedGraph, Dataset graphOrigin) throws Exception { Ontology o = prepareSignatureOntology(namedSignedGraph); verifyGraphCollectionContainsExactlyOneNamedGraph(namedSignedGraph); addSignatureTriplesToOrigin(namedSignedGraph, o, graphOrigin); }
6161685_14
public Genotype asGenotype() { return asGenotype(Locations.locations()); }
6172406_648
@Transactional public void approve(Report report, Long requisitionId, Long userId) { Rnr requisition = report.getRequisition(requisitionId, userId); Rnr savedRequisition = requisitionService.getFullRequisitionById(requisition.getId()); if (!savedRequisition.getFacility().getVirtualFacility()) { throw new Da...
6179560_1
public KeySet(byte[] key, byte[] nonce) throws NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, NoSuchPaddingException, InvalidAlgorithmParameterException { MaskGenerationFunction mgf = null; mgf = new MaskGenerationFunction(MessageDigest.getInstance("SHA256")); byte[] seed = new byte[key.le...
6179800_6
public T variable(String name, Object value) { return param(name, value); }
6187281_10
@Override public TaskRegistration scheduleTask(TaskConfiguration config, Object bean) throws TaskSchedulerException { if (config == null) { throw new IllegalArgumentException("config is null"); } if (bean == null) { throw new IllegalArgumentException("bean is null"); } if (this.sche...
6212860_2
public Object[] getValues() { final List<Object> arr = new ArrayList<Object>(); this.traverse_(this.root_, new Func() { @Override public void call(QuadTree quadTree, Node node) { arr.add(node.getPoint().getValue()); } }); return arr.toArray(new Object[arr.size()]); }
6215833_5
public void insert(KeyClass key, ValueClass value) { if (root == null) { root = BTreeNode.createLeaf(null, null); } if (root.ckeckExists(key)) { throw new DuplicateKeyException(); } BTreeNode.InsertResult insertResult = root.insert(key, value, this); if (insertRes...
6257768_8
static Vector splitSpace(String triple){ final Vector results = new Vector(); String remaining = triple; int nextPos; do{ nextPos = remaining.indexOf(' '); if(nextPos >= 0){ results.addElement(remaining.substring(0, nextPos)); remaining = remaining.substring(nextPos + 1); } }while(nextPos >= 0); r...
6269725_1
public static final boolean isNullOrEmpty(final StringValue stringValue) { return (stringValue == null) || stringValue.isNull() || stringValue.isEmpty(); }
6275822_36
public static ImmutableList<String> glob(final String glob) { Path path = getGlobPath(glob); int globIndex = getGlobIndex(path); if (globIndex < 0) { return of(glob); } return doGlob(path, searchPath(path, globIndex)); }
6278839_0
public Connection getConnection() { return this.connection; }
6280863_22
public static String parseFromPath(final String path) { try { return fromPathToStringCache.get(path, new Callable<String>() { @Override public String call() throws Exception { return _parseFromPath(path); } }); } catch (ExecutionException e) { throw new RuntimeException(e); } catch (UncheckedEx...
6281707_79
@Override public void cacheToken(Token requestToken) { if (requestToken == null || requestToken.getToken() == null) { return; } tokenCache.put(requestToken.getToken(), requestToken); }
6290993_103
public static <K, U, V, T> PCollection<T> oneToManyJoin(PTable<K, U> left, PTable<K, V> right, DoFn<Pair<U, Iterable<V>>, T> postProcessFn, PType<T> ptype) { return oneToManyJoin(left, right, postProcessFn, ptype, -1); }
6293402_212
public static <C extends Comparable<? super C>> RangeValidator<C> of( String errorMessage, C minValue, C maxValue) { return new RangeValidator<>(errorMessage, Comparator.nullsFirst(Comparator.naturalOrder()), minValue, maxValue); }
6331476_36
public Aspect.Builder getAspect() { final Aspect.Builder aspect = Aspect.all(); final All all = ClassReflection.getAnnotation(c, All.class); if (all != null) { aspect.all(all.value()); } final One one = ClassReflection.getAnnotation(c, One.class); if (one != null) { aspect.one(on...
6332635_3
public String getContentType() { return getFirstValue(CONTENT_TYPE); }
6357227_0
public float evaluate( final int numberOfUnits, final Text key, final float value) { LinkedList<Float> list = map.get(key); if (list == null) { list = new LinkedList<Float>(); map.put(key, list); } list.add(value); if (list.size() > numberOfUnits) { list.removeFirst(); } if (numberOfUnits == 0) { retur...
6358188_343
@Override public VectorAggregator factorizeVector(VectorColumnSelectorFactory selectorFactory) { ColumnCapabilities capabilities = selectorFactory.getColumnCapabilities(fieldName); if (capabilities == null || capabilities.getType().isNumeric()) { return new FloatAnyVectorAggregator(selectorFactory.makeValueSele...
6370211_54
public List<StageTransition> getStageTransitions(Interview interview, Stage stage) { StageTransition template = new StageTransition(); template.setInterview(interview); template.setStage(stage.getName()); List<StageTransition> stageTransitions = getPersistenceManager().match(template, new SortingClause("action...
6405716_25
@Override public Character convert(String value) { if (value != null && value.length() > 0) { return value.charAt(0); } return null; }
6426016_1
public String getXMLAsString(Store store) throws UnsupportedEncodingException, JAXBException { String xml = null; ByteArrayOutputStream xmlOutput = null; xmlOutput = getXMLAsByteArrayOutputStream(store); if (xmlOutput != null) { xml = xmlOutput.toString("UTF-8"); } return xml; }
6434628_5
public static Set<String> permutateSQL(String delimiter, String... frag) { return new PermutationGenerator(frag).setDelimiter(delimiter).permutateSQL(); }
6437134_0
public Route parse() throws IOException { Route route = new Route(); try { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); Document doc = docBuilder.parse(new InputSource(reader)); ...
6444116_54
@Override public boolean onCommand(final CommonSender sender, CommandParser parser) { final boolean isSilent = parser.isSilent(); if (isSilent && !sender.hasPermission(getPermission() + ".silent")) { sender.sendMessage(Message.getString("sender.error.noPermission")); return true; } if (parser.args.len...
6448810_170
public QueryHolder bindToUri(String name, String uri) { String regex = "\\?" + name + "\\b"; String replacement = "<" + uri + ">"; String bound = replaceWithinBraces(regex, replacement); return new QueryHolder(bound); }
6454766_0
public boolean isLeader() { boolean leader = false; for (Member member : hazelcast.getCluster().getMembers()) { String zone = member.getStringAttribute("zone"); if (zone == null) { continue; } if (info.getZoneName().equals(zone)) { if (member.localMember()...
6457784_0
public static <A> boolean analyse(A analysedObject, Matcher assertion) { return assertion.matches(analysedObject); }
6476959_9
static String run(File file, String fileTitle, boolean renderHtml) throws IOException, LinkTargetException, EngineException { // Set-up a simple wiki configuration WikiConfig config = DefaultConfigEnWp.generate(); final int wrapCol = 80; // Instantiate a compiler for wiki pages WtEngineImpl engine = new WtEngine...
6489406_31
static boolean isTrackStale(long lastAnyUpdate, long lastPositionUpdate, long currentUpdate) { long lastUpdate = Math.max(lastAnyUpdate, lastPositionUpdate); boolean trackStale = lastUpdate > 0L && currentUpdate - lastUpdate >= TRACK_STALE_MILLIS; if (trackStale) { LOG.debug("Track is stale (" + cur...