id
stringlengths
7
14
text
stringlengths
1
106k
3456296_3
@Override public ValueResult resolve(MethodParameter methodParameter, List<String> wordsBuffer) { String prefix = prefixForMethod(methodParameter.getMethod()); List<String> words = wordsBuffer.stream().filter(w -> !w.isEmpty()).collect(Collectors.toList()); CacheKey cacheKey = new CacheKey(methodParameter.getMethod(...
3456296_4
@Override public ValueResult resolve(MethodParameter methodParameter, List<String> wordsBuffer) { String prefix = prefixForMethod(methodParameter.getMethod()); List<String> words = wordsBuffer.stream().filter(w -> !w.isEmpty()).collect(Collectors.toList()); CacheKey cacheKey = new CacheKey(methodParameter.getMethod(...
3456296_5
@Override public ValueResult resolve(MethodParameter methodParameter, List<String> wordsBuffer) { String prefix = prefixForMethod(methodParameter.getMethod()); List<String> words = wordsBuffer.stream().filter(w -> !w.isEmpty()).collect(Collectors.toList()); CacheKey cacheKey = new CacheKey(methodParameter.getMethod(...
3456296_6
@Override public ValueResult resolve(MethodParameter methodParameter, List<String> wordsBuffer) { String prefix = prefixForMethod(methodParameter.getMethod()); List<String> words = wordsBuffer.stream().filter(w -> !w.isEmpty()).collect(Collectors.toList()); CacheKey cacheKey = new CacheKey(methodParameter.getMethod(...
3456296_7
@Override public ValueResult resolve(MethodParameter methodParameter, List<String> wordsBuffer) { String prefix = prefixForMethod(methodParameter.getMethod()); List<String> words = wordsBuffer.stream().filter(w -> !w.isEmpty()).collect(Collectors.toList()); CacheKey cacheKey = new CacheKey(methodParameter.getMethod(...
3456296_8
@Override public List<CompletionProposal> complete(MethodParameter methodParameter, CompletionContext context) { boolean set; Exception unfinished = null; // First try to see if this parameter has been set, even to some unfinished value ParameterRawValue parameterRawValue = null; int arity = 1; try { resolve(me...
3456296_9
@Override public List<CompletionProposal> complete(MethodParameter methodParameter, CompletionContext context) { boolean set; Exception unfinished = null; // First try to see if this parameter has been set, even to some unfinished value ParameterRawValue parameterRawValue = null; int arity = 1; try { resolve(me...
3460824_0
void runWithinPeriod(Runnable runnable, ExecuteStepMessage executeStepMessage) { runWithinPeriod( runnable, executeStepMessage, executeStepMessage.getTimeoutPeriodSeconds(), TimeUnit.SECONDS ); }
3460824_1
public HashMap<String, Class> discoverSubsystems(List<String> basePackages) { return discoverSubsystems(basePackages, log); }
3460824_2
public HashMap<String, Class> discoverSubsystems(List<String> basePackages) { return discoverSubsystems(basePackages, log); }
3460824_3
public HashMap<String, Class> discoverSubsystems(List<String> basePackages) { return discoverSubsystems(basePackages, log); }
3460824_4
public HashMap<String, Class> discoverSubsystems(List<String> basePackages) { return discoverSubsystems(basePackages, log); }
3460824_5
public HashMap<String, Class> discoverSubsystems(List<String> basePackages) { return discoverSubsystems(basePackages, log); }
3460824_6
public HashMap<String, Class> discoverSubsystems(List<String> basePackages) { return discoverSubsystems(basePackages, log); }
3460824_7
public HashMap<String, Class> discoverSubsystems(List<String> basePackages) { return discoverSubsystems(basePackages, log); }
3460824_8
public HashMap<String, Class> discoverSubsystems(List<String> basePackages) { return discoverSubsystems(basePackages, log); }
3460824_9
public List<JmxInvokerResult> getStepInvokers() { List<JmxInvokerResult> invokers = new ArrayList<>(); for ( StepInvoker s : stepInvokers.values() ) { JmxInvokerResult jmxInvoker = new JmxInvokerResult(s); invokers.add(jmxInvoker); } return invokers; }
3468420_0
public <U> U getStateOfType(Class<U> type) { for (final State<T, C> state : getStates()) { if (type.isInstance(state)) { return type.cast(state); } } throw new IllegalArgumentException("There is no instance of " + type + " in this state machine."); }
3468420_1
public void handle(C context) { handle(null, context); }
3468420_2
public static Builder builder() { return new Builder(); }
3468420_3
public Gendreau06Parser offline() { online = false; return this; }
3468420_4
public Gendreau06Parser allowDiversion() { allowDiversion = true; return this; }
3468420_5
public Gendreau06Parser setTickSize(long tick) { checkArgument(tick > 0L, "Tick size must be positive."); tickSize = tick; return this; }
3468420_6
public Gendreau06Parser filter(GendreauProblemClass... classes) { problemClasses = Optional.of(ImmutableList.<ProblemClass>copyOf(classes)); return this; }
3468420_7
public static Gendreau06Scenario parse(File file) { return parser().addFile(file).parse().get(0); }
3468420_8
public static Gendreau06Scenario parse(File file) { return parser().addFile(file).parse().get(0); }
3468420_9
static void checkValidFileName(Matcher m, String name) { checkArgument(m.matches(), "The filename must conform to the following regex: %s input was: %s", REGEX, name); }
3471752_0
void addStyleParts(final List<NotebookConfig> notebookConfigs, final BodyTrackHelper.ChannelStyle channelStyle) { int nNotebooks = getNumberOfVisibleNotebooks(notebookConfigs); double rowHeight = 1.f/(nNotebooks*2+1); int i=0; for (NotebookConfig config: notebookConfigs) { if ...
3471752_1
@Override public int importFile(final ApiKey apiKey, final File f) throws Exception { try { ZipFile zipFile = new ZipFile(f); final Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { final ZipEntry zipEntry = entries.nextElement(); ...
3471752_2
void parseLocation(final ApiKey apiKey, final JsonParser jParser, final List<LocationFacet> locations) throws IOException { LocationFacet locationFacet = new LocationFacet(); if (apiKey!=null) { locationFacet.apiKeyId = apiKey.getId(); locationFacet.guestId = apiKey.getGuestId(); } locat...
3471752_3
public static boolean isSupportedImage(@Nullable final byte[] imageBytes) { return getImageType(imageBytes) != null; }
3471752_4
@Nullable public static Image createJpegThumbnail(@Nullable final byte[] imageBytes, final int lengthOfLongestSideInPixels) throws IOException { if (imageBytes != null && imageBytes.length > 0 && lengthOfLongestSideInPixels > 0) { ImageOrientation orientation = ImageOrientation.getOrientation(new ByteArrayI...
3471752_5
@Nullable public static Geolocation getGeolocation(@Nullable final byte[] imageBytes) throws ImageProcessingException, IOException { if (imageBytes != null && imageBytes.length > 0) { final Metadata metadata = ImageMetadataReader.readMetadata(new BufferedInputStream(new ByteArrayInputStream(imageBytes)), fa...
3471752_6
@Nullable public static ImageType getImageType(@Nullable final byte[] imageBytes) { if ((imageBytes != null) && (imageBytes.length > 0)) { try { final ImageInputStream iis = ImageIO.createImageInputStream(new ByteArrayInputStream(imageBytes)); final Iterator<ImageReader> imageReaders...
3471752_7
@NotNull public static String computeSha256Hash(@NotNull final byte[] bytes) throws NoSuchAlgorithmException { return computeHash(bytes, "SHA-256"); }
3471752_8
@NotNull public static String computeMd5Hash(final byte[] bytes) throws NoSuchAlgorithmException { return computeHash(bytes, "MD5"); }
3471752_9
@Nullable public static TagFilter create(@Nullable final Collection<String> tags, @Nullable final FilteringStrategy requestedFilteringStrategy) { // make sure the filtering strategy is non-null, choosing the default if necessary final FilteringStrategy filteringStrategy = requeste...
3472718_0
public XmlLocalConfiguration getConfiguration(CtClass clazz) { return getConfiguration(clazz.getName()); }
3472718_1
public XmlGlobalConfiguration getGlobalConfiguration() { return globalConfiguration; }
3472718_2
public CtBehavior getAffectedBehavior(ContractInfo contractInfo, CtClass affectedClass, CtBehavior contractBehavior) throws NotFoundException, CannotCompileException { if (isClassInvariant(contractBehavior) || isBeforeInvariantHelperMethod(contractBehavior)) { return null; } if (isContractConstructor(contractBeh...
3472718_3
public CtBehavior getAffectedBehavior(ContractInfo contractInfo, CtClass affectedClass, CtBehavior contractBehavior) throws NotFoundException, CannotCompileException { if (isClassInvariant(contractBehavior) || isBeforeInvariantHelperMethod(contractBehavior)) { return null; } if (isContractConstructor(contractBeh...
3472718_4
CtMethod getAffectedMethod(ContractInfo contractInfo, CtClass affectedClass, CtBehavior contractBehavior) throws NotFoundException, CannotCompileException { CtMethod affectedMethod = getAffectedMethodFromExtendedClasses(contractBehavior, affectedClass); if (affectedMethod == null) { LOGGER.warn("could not find a ...
3472718_5
CtMethod getAffectedMethod(ContractInfo contractInfo, CtClass affectedClass, CtBehavior contractBehavior) throws NotFoundException, CannotCompileException { CtMethod affectedMethod = getAffectedMethodFromExtendedClasses(contractBehavior, affectedClass); if (affectedMethod == null) { LOGGER.warn("could not find a ...
3472718_6
CtMethod getAffectedMethod(ContractInfo contractInfo, CtClass affectedClass, CtBehavior contractBehavior) throws NotFoundException, CannotCompileException { CtMethod affectedMethod = getAffectedMethodFromExtendedClasses(contractBehavior, affectedClass); if (affectedMethod == null) { LOGGER.warn("could not find a ...
3472718_7
CtConstructor getAffectedConstructor(ContractInfo contractInfo, CtClass affectedClass, CtBehavior contractBehavior) throws NotFoundException { if (contractInfo.getTargetClass().isInterface()) { return null; } if (!affectedClass.equals(contractInfo.getTargetClass())) { return null; } CtConstructor affectedCon...
3472718_8
CtConstructor getAffectedConstructor(ContractInfo contractInfo, CtClass affectedClass, CtBehavior contractBehavior) throws NotFoundException { if (contractInfo.getTargetClass().isInterface()) { return null; } if (!affectedClass.equals(contractInfo.getTargetClass())) { return null; } CtConstructor affectedCon...
3472718_9
CtConstructor getAffectedConstructor(ContractInfo contractInfo, CtClass affectedClass, CtBehavior contractBehavior) throws NotFoundException { if (contractInfo.getTargetClass().isInterface()) { return null; } if (!affectedClass.equals(contractInfo.getTargetClass())) { return null; } CtConstructor affectedCon...
3477759_0
public void nextStepForAllGames() { lock.writeLock().lock(); try { for (int i = 0; i < games.size(); i++) { TetrisAdvancedGame game = games.get(i); game.tick(); logger.debug("Next step. {} - {} ({},{})", new Object[]{players.get(i).getName(), game.getCurrentFigureType...
3477759_1
public void nextStepForAllGames() { lock.writeLock().lock(); try { for (int i = 0; i < games.size(); i++) { TetrisAdvancedGame game = games.get(i); game.tick(); logger.debug("Next step. {} - {} ({},{})", new Object[]{players.get(i).getName(), game.getCurrentFigureType...
3477759_2
public void nextStepForAllGames() { lock.writeLock().lock(); try { for (int i = 0; i < games.size(); i++) { TetrisAdvancedGame game = games.get(i); game.tick(); logger.debug("Next step. {} - {} ({},{})", new Object[]{players.get(i).getName(), game.getCurrentFigureType...
3477759_3
public void nextStepForAllGames() { lock.writeLock().lock(); try { for (int i = 0; i < games.size(); i++) { TetrisAdvancedGame game = games.get(i); game.tick(); logger.debug("Next step. {} - {} ({},{})", new Object[]{players.get(i).getName(), game.getCurrentFigureType...
3477759_4
public void nextStepForAllGames() { lock.writeLock().lock(); try { for (int i = 0; i < games.size(); i++) { TetrisAdvancedGame game = games.get(i); game.tick(); logger.debug("Next step. {} - {} ({},{})", new Object[]{players.get(i).getName(), game.getCurrentFigureType...
3477759_5
public void nextStepForAllGames() { lock.writeLock().lock(); try { for (int i = 0; i < games.size(); i++) { TetrisAdvancedGame game = games.get(i); game.tick(); logger.debug("Next step. {} - {} ({},{})", new Object[]{players.get(i).getName(), game.getCurrentFigureType...
3477759_6
public Player findPlayerByIp(String ip) { lock.readLock().lock(); try { for (Player player : players) { if (player.getCallbackUrl().contains(ip)) { return player; } } return new NullPlayer(); } finally { lock.readLock().unlock(); } ...
3477759_7
public Player findPlayerByIp(String ip) { lock.readLock().lock(); try { for (Player player : players) { if (player.getCallbackUrl().contains(ip)) { return player; } } return new NullPlayer(); } finally { lock.readLock().unlock(); } ...
3477759_8
public void nextStepForAllGames() { lock.writeLock().lock(); try { for (int i = 0; i < games.size(); i++) { TetrisAdvancedGame game = games.get(i); game.tick(); logger.debug("Next step. {} - {} ({},{})", new Object[]{players.get(i).getName(), game.getCurrentFigureType...
3477759_9
public void savePlayerGame(String name) { lock.readLock().lock(); try { Player player = getPlayer(name); if (player != null) { saver.saveGame(player); } } finally { lock.readLock().unlock(); } }
3510405_0
public String encode(int number) { int i = number; if(i == 0) { return Character.toString(CHARSET[0]); } StringBuilder stringBuilder = new StringBuilder(); while(i > 0) { int remainder = i % ALPHABET_LENGTH; i /= ALPHABET_LENGTH; stringBuilder.append(CHARSET[remainder]); } return stringBuilder.reverse(...
3510405_1
public String encode(int number) { int i = number; if(i == 0) { return Character.toString(CHARSET[0]); } StringBuilder stringBuilder = new StringBuilder(); while(i > 0) { int remainder = i % ALPHABET_LENGTH; i /= ALPHABET_LENGTH; stringBuilder.append(CHARSET[remainder]); } return stringBuilder.reverse(...
3510405_2
public String encode(int number) { int i = number; if(i == 0) { return Character.toString(CHARSET[0]); } StringBuilder stringBuilder = new StringBuilder(); while(i > 0) { int remainder = i % ALPHABET_LENGTH; i /= ALPHABET_LENGTH; stringBuilder.append(CHARSET[remainder]); } return stringBuilder.reverse(...
3510405_3
public String encode(int number) { int i = number; if(i == 0) { return Character.toString(CHARSET[0]); } StringBuilder stringBuilder = new StringBuilder(); while(i > 0) { int remainder = i % ALPHABET_LENGTH; i /= ALPHABET_LENGTH; stringBuilder.append(CHARSET[remainder]); } return stringBuilder.reverse(...
3510405_4
public String encode(int number) { int i = number; if(i == 0) { return Character.toString(CHARSET[0]); } StringBuilder stringBuilder = new StringBuilder(); while(i > 0) { int remainder = i % ALPHABET_LENGTH; i /= ALPHABET_LENGTH; stringBuilder.append(CHARSET[remainder]); } return stringBuilder.reverse(...
3510405_5
public String encode(int number) { int i = number; if(i == 0) { return Character.toString(CHARSET[0]); } StringBuilder stringBuilder = new StringBuilder(); while(i > 0) { int remainder = i % ALPHABET_LENGTH; i /= ALPHABET_LENGTH; stringBuilder.append(CHARSET[remainder]); } return stringBuilder.reverse(...
3510405_6
public String encode(int number) { int i = number; if(i == 0) { return Character.toString(CHARSET[0]); } StringBuilder stringBuilder = new StringBuilder(); while(i > 0) { int remainder = i % ALPHABET_LENGTH; i /= ALPHABET_LENGTH; stringBuilder.append(CHARSET[remainder]); } return stringBuilder.reverse(...
3510405_7
public String encode(int number) { int i = number; if(i == 0) { return Character.toString(CHARSET[0]); } StringBuilder stringBuilder = new StringBuilder(); while(i > 0) { int remainder = i % ALPHABET_LENGTH; i /= ALPHABET_LENGTH; stringBuilder.append(CHARSET[remainder]); } return stringBuilder.reverse(...
3510405_8
public String encode(int number) { int i = number; if(i == 0) { return Character.toString(CHARSET[0]); } StringBuilder stringBuilder = new StringBuilder(); while(i > 0) { int remainder = i % ALPHABET_LENGTH; i /= ALPHABET_LENGTH; stringBuilder.append(CHARSET[remainder]); } return stringBuilder.reverse(...
3510405_9
@Override public int decode(String s) { int i = 0; char[] chars = s.toCharArray(); for(char c : chars) { i = i * ALPHABET_LENGTH + ALPHABET.indexOf(c); } return i; }
3513191_0
ServerConfig configureFromProperties(String filename) throws IOException { Properties props = loadProperties(filename); return new ServerConfig() .setPort(parseServerPort(props)) .setDefaultConfigFileName(props.getProperty("jetty.config.location")); }
3513191_1
public static void fixEhourHome() throws IOException { convertBackwardSlashesInEhourHome(); setDefaultEhourHome(); defineDerbyHome(); }
3513191_2
public static void fixEhourHome() throws IOException { convertBackwardSlashesInEhourHome(); setDefaultEhourHome(); defineDerbyHome(); }
3513191_3
public static void fixEhourHome() throws IOException { convertBackwardSlashesInEhourHome(); setDefaultEhourHome(); defineDerbyHome(); }
3513191_4
public static <PK extends Serializable> List<PK> getIdsFromDomainObjects(Collection<? extends DomainObject<PK, ?>> domainObjects) { List<PK> pks = Lists.newArrayList(); if (domainObjects == null) { return pks; } for (DomainObject<PK, ?> domainObject : domainObjects) { pks.add(domainObjec...
3513191_5
public static DateRange calendarToMonthRange(Calendar calendar) { DateTime date = new DateTime(calendar); return new DateRange(new Interval(date.withDayOfMonth(1), date.withDayOfMonth(getDaysInMonth(date)))); }
3513191_6
public static int getDaysInMonth(Calendar calendar) { return getDaysInMonth(new DateTime(calendar)); }
3513191_7
public static int getDaysInMonth(Calendar calendar) { return getDaysInMonth(new DateTime(calendar)); }
3513191_8
public static boolean isDateWithinRange(Date date, DateRange dateRange) { return dateRange.isOpenEnded() || isDateWithinRange(new DateTime(date), dateRange); }
3513191_9
public static boolean isDateRangeOverlaps(DateRange rangeA, DateRange rangeB) { boolean overlaps; boolean includeStart; boolean includeEnd; includeStart = rangeA.getDateStart() != null; includeEnd = rangeA.getDateEnd() != null; if (includeStart && includeEnd) { overlaps = rangeA.toInterv...
3513261_0
public String transform(String version) throws NumberFormatException { final String originalVersion = version; if (version == null) throw new NullPointerException("Version was null."); String[] parts = version.split("\\."); List<String> result = new ArrayList<String>(); int length = (limit == -1 ? parts.l...
3513261_1
public String transform(String version) throws NumberFormatException { final String originalVersion = version; if (version == null) throw new NullPointerException("Version was null."); String[] parts = version.split("\\."); List<String> result = new ArrayList<String>(); int length = (limit == -1 ? parts.l...
3513261_2
public String transform(String version) throws NumberFormatException { final String originalVersion = version; if (version == null) throw new NullPointerException("Version was null."); String[] parts = version.split("\\."); List<String> result = new ArrayList<String>(); int length = (limit == -1 ? parts.l...
3513261_3
public String transform(String version) throws NumberFormatException { final String originalVersion = version; if (version == null) throw new NullPointerException("Version was null."); String[] parts = version.split("\\."); List<String> result = new ArrayList<String>(); int length = (limit == -1 ? parts.l...
3513261_4
public String transform(String version) throws NumberFormatException { final String originalVersion = version; if (version == null) throw new NullPointerException("Version was null."); String[] parts = version.split("\\."); List<String> result = new ArrayList<String>(); int length = (limit == -1 ? parts.l...
3513261_5
public String transform(String version) throws NumberFormatException { final String originalVersion = version; if (version == null) throw new NullPointerException("Version was null."); String[] parts = version.split("\\."); List<String> result = new ArrayList<String>(); int length = (limit == -1 ? parts.l...
3513261_6
public String transform(String version) throws NumberFormatException { final String originalVersion = version; if (version == null) throw new NullPointerException("Version was null."); String[] parts = version.split("\\."); List<String> result = new ArrayList<String>(); int length = (limit == -1 ? parts.l...
3513261_7
public String transform(String version) throws NumberFormatException { final String originalVersion = version; if (version == null) throw new NullPointerException("Version was null."); String[] parts = version.split("\\."); List<String> result = new ArrayList<String>(); int length = (limit == -1 ? parts.l...
3513261_8
public String transform(String version) throws NumberFormatException { final String originalVersion = version; if (version == null) throw new NullPointerException("Version was null."); String[] parts = version.split("\\."); List<String> result = new ArrayList<String>(); int length = (limit == -1 ? parts.l...
3513261_9
public String transform(String version) throws NumberFormatException { final String originalVersion = version; if (version == null) throw new NullPointerException("Version was null."); String[] parts = version.split("\\."); List<String> result = new ArrayList<String>(); int length = (limit == -1 ? parts.l...
3523632_0
public Counter counter(String name) { if (counters.containsKey(name)) { return counters.get(name); } else { Counter counter = new Counter(); return register(counters, name, counter); } }
3523632_1
public Histogram histogram(String name, Double... pcts) { if (histograms.containsKey(name)) { return histograms.get(name); } else { Histogram histogram = new Histogram(((pcts != null) && (pcts.length > 0)) ? pcts : defaultPcts); return register(histograms, name, histogram); } }
3523632_2
public static InputStream asInputStream(String fileName) throws IOException { return asInputStream(getPath(fileName)); }
3523632_3
public static OutputStream asOututStream(String fileName) throws IOException { return asOututStream(getPath(fileName)); }
3523632_4
public static BufferedReader asBufferedReader(String fileName) throws IOException { Validate.notBlank(fileName, "filename is blank"); return asBufferedReader(getPath(fileName)); }
3523632_5
public static BufferedWriter asBufferedWriter(String fileName) throws IOException { Validate.notBlank(fileName, "filename is blank"); return Files.newBufferedWriter(getPath(fileName), Charsets.UTF_8); }
3523632_6
public static void copy(@NotNull File from, @NotNull File to) throws IOException { Validate.notNull(from); Validate.notNull(to); copy(from.toPath(), to.toPath()); }
3523632_7
public static void makesureDirExists(String dirPath) throws IOException { makesureDirExists(getPath(dirPath)); }
3523632_8
public static boolean isFileExists(String fileName) { if (fileName == null) { return false; } return isFileExists(getPath(fileName)); }
3523632_9
public static String getFileExtension(File file) { return com.google.common.io.Files.getFileExtension(file.getName()); }
3526892_0
public Collection<String> generateCategoryNames(int categoryCount) { ArrayList<String> categories = new ArrayList<String>(); for (int i = 0; i < categoryCount; i++) { categories.add("Category-" + i); } return categories; }
3526892_1
public Collection<AssignedLabel<String>> generateLabels(Collection<ArtificialWorker> workers, TroiaObjectCollection objects, int workersPerObject) { Collection<AssignedLabel<String>> labels = new ArrayList<AssignedLabel<String>>(); Map<ArtificialWorker, NoisedLabelGenerator> generators = NoisedLabelGeneratorFactory ...
3526892_2
public Collection<LObject<String>> generateGoldLabels( TroiaObjectCollection objects, double goldCoverage) { int goldCount = (int) (objects.size() * goldCoverage); Collection<LObject<String>> goldLabels = new ArrayList<LObject<String>>(); Iterator<String> objectsIterator = objects.iterator(); for (int i = 0; i < g...