id
stringlengths
7
14
text
stringlengths
1
106k
209853_78
public void assertValid(String tituloDeEleitor) { List<ValidationMessage> errors = getInvalidValues(tituloDeEleitor); if (!errors.isEmpty()) { throw new InvalidStateException(errors); } }
209853_79
public void assertValid(String tituloDeEleitor) { List<ValidationMessage> errors = getInvalidValues(tituloDeEleitor); if (!errors.isEmpty()) { throw new InvalidStateException(errors); } }
209853_80
public void assertValid(Object object) { base.assertValid(getInvalidValuesFor(object)); }
209853_81
public void assertValid(Object object) { base.assertValid(getInvalidValuesFor(object)); }
209853_82
public void assertValid(Object object) { base.assertValid(getInvalidValuesFor(object)); }
209853_83
public void assertValid(Object object) { base.assertValid(getInvalidValuesFor(object)); }
209853_84
public List<ValidationMessage> invalidMessagesFor(Object object) { List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); messages.addAll(base.generateValidationMessages(getInvalidValuesFor(object))); return messages; }
209853_85
public List<ValidationMessage> invalidMessagesFor(Object object) { List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); messages.addAll(base.generateValidationMessages(getInvalidValuesFor(object))); return messages; }
209853_86
@Override public Object generateRandomValid() { throw new UnsupportedOperationException("Operação não suportada por este validador"); }
209853_87
public void assertValid(String value) { List<ValidationMessage> invalidMessages = invalidMessagesFor(value); if (!invalidMessages.isEmpty()) { throw new InvalidStateException(invalidMessages); } }
209853_88
public void assertValid(String value) { List<ValidationMessage> invalidMessages = invalidMessagesFor(value); if (!invalidMessages.isEmpty()) { throw new InvalidStateException(invalidMessages); } }
209853_89
public List<ValidationMessage> invalidMessagesFor(String value) { List<ValidationMessage> result = new ArrayList<ValidationMessage>(); for (Validator<String> validator : validators) { List<ValidationMessage> messages = validator.invalidMessagesFor(value); if (messages.isEmpty()) { re...
209853_90
public List<ValidationMessage> invalidMessagesFor(String value) { List<ValidationMessage> result = new ArrayList<ValidationMessage>(); for (Validator<String> validator : validators) { List<ValidationMessage> messages = validator.invalidMessagesFor(value); if (messages.isEmpty()) { re...
209853_91
public void assertValid(String value) { List<ValidationMessage> invalidMessages = invalidMessagesFor(value); if (!invalidMessages.isEmpty()) { throw new InvalidStateException(invalidMessages); } }
209853_92
public void assertValid(String value) { List<ValidationMessage> invalidMessages = invalidMessagesFor(value); if (!invalidMessages.isEmpty()) { throw new InvalidStateException(invalidMessages); } }
209853_93
public List<ValidationMessage> invalidMessagesFor(String value) { List<ValidationMessage> result = new ArrayList<ValidationMessage>(); for (Validator<String> validator : validators) { List<ValidationMessage> messages = validator.invalidMessagesFor(value); if (messages.isEmpty()) { re...
209853_94
public List<ValidationMessage> invalidMessagesFor(String value) { List<ValidationMessage> result = new ArrayList<ValidationMessage>(); for (Validator<String> validator : validators) { List<ValidationMessage> messages = validator.invalidMessagesFor(value); if (messages.isEmpty()) { re...
209853_95
public void assertValid(String value) { List<ValidationMessage> invalidMessages = invalidMessagesFor(value); if (!invalidMessages.isEmpty()) { throw new InvalidStateException(invalidMessages); } }
209853_96
public void assertValid(String value) { List<ValidationMessage> invalidMessages = invalidMessagesFor(value); if (!invalidMessages.isEmpty()) { throw new InvalidStateException(invalidMessages); } }
209853_97
public List<ValidationMessage> invalidMessagesFor(String value) { List<ValidationMessage> result = new ArrayList<ValidationMessage>(); for (Validator<String> validator : validators) { List<ValidationMessage> messages = validator.invalidMessagesFor(value); if (messages.isEmpty()) { re...
209853_98
public List<ValidationMessage> invalidMessagesFor(String value) { List<ValidationMessage> result = new ArrayList<ValidationMessage>(); for (Validator<String> validator : validators) { List<ValidationMessage> messages = validator.invalidMessagesFor(value); if (messages.isEmpty()) { re...
209853_99
public boolean isValid() { return new CNPJValidator().invalidMessagesFor(numero).isEmpty(); }
2101910_0
public static int mask(int crc) { // Rotate right by 15 bits and add a constant. return ((crc >>> 15) | (crc << 17)) + MASK_DELTA; }
2101910_1
@Override public int compare(Slice sliceA, Slice sliceB) { return sliceA.compareTo(sliceB); }
2101910_2
public static void writeVariableLengthInt(int value, SliceOutput sliceOutput) { int highBitMask = 0x80; if (value < (1 << 7) && value >= 0) { sliceOutput.writeByte(value); } else if (value < (1 << 14) && value > 0) { sliceOutput.writeByte(value | highBitMask); sliceOutput.writeBy...
2101910_3
public static void writeVariableLengthLong(long value, SliceOutput sliceOutput) { // while value more than the first 7 bits set while ((value & (~0x7f)) != 0) { sliceOutput.writeByte((int) ((value & 0x7f) | 0x80)); value >>>= 7; } sliceOutput.writeByte((int) value); }
2101910_4
public long size() { return block.length(); }
2101910_5
public long size() { return block.length(); }
2101910_6
private void backgroundCompaction() throws IOException { checkState(mutex.isHeldByCurrentThread()); compactMemTableInternal(); Compaction compaction; if (manualCompaction != null) { compaction = versions.compactRange(manualCompaction.level, new InternalKey(manualCompactio...
2101910_7
@Override public void put(byte[] key, byte[] value) throws DBException { put(key, value, new WriteOptions()); }
2101910_8
@Override public byte[] get(byte[] key) throws DBException { return get(key, new ReadOptions()); }
2101910_9
@Override public Snapshot getSnapshot() { checkBackgroundException(); mutex.lock(); try { return new SnapshotImpl(versions.getCurrent(), versions.getLastSequence()); } finally { mutex.unlock(); } }
2111687_0
static String escape(TreeLogger logger, String path) throws UnableToCompleteException { StringBuilder builder = new StringBuilder(path.length()); for (int i = 0; i != path.length(); ++i) { int codePoint = path.codePointAt(i); if (codePoint > 255) { logger.log(TreeLogger.Type.ERROR, "Manifest entry '" ...
2111687_1
@SuppressWarnings("unchecked") public static Function<LessCompilerContext, String> newCompiler() { try { Class compiledClass = Class.forName("com.bedatadriven.rebar.less.rebind.LessImpl"); return (Function<LessCompilerContext, String>) compiledClass.newInstance(); } catch (Exception e) { throw new Runti...
2111687_2
public String compile(URL sourceURL) throws UnableToCompleteException { // TODO: this won't work if the .less file is in a jar... LessCompilerContext context = new LessCompilerContext(logger, sourceURL.getFile()); try { Function<LessCompilerContext, String> compiler = LessCompiler.newCompiler(); return co...
2111687_3
public String compile(URL sourceURL) throws UnableToCompleteException { // TODO: this won't work if the .less file is in a jar... LessCompilerContext context = new LessCompilerContext(logger, sourceURL.getFile()); try { Function<LessCompilerContext, String> compiler = LessCompiler.newCompiler(); return co...
2111687_4
public String compile(URL sourceURL) throws UnableToCompleteException { // TODO: this won't work if the .less file is in a jar... LessCompilerContext context = new LessCompilerContext(logger, sourceURL.getFile()); try { Function<LessCompilerContext, String> compiler = LessCompiler.newCompiler(); return co...
2111687_5
public GssTree compile(TreeLogger logger, String css) throws UnableToCompleteException { TreeLogger branchLogger = logger.branch(TreeLogger.DEBUG, "Parsing LESS output as GSS stylesheet"); SourceCode lessOutput = new SourceCode("less.css", css); try { CssTree tree = new GssParser(lessOutput).parse(); ...
2111687_6
@VisibleForTesting static String styleSheetExpr(IconArtifacts artifacts) { String staticRootPlaceholder = "$$PLACEHOLDER$$"; String escaped = "\"" + Generator.escape( artifacts.getStylesheet(staticRootPlaceholder)) + "\""; escaped = escaped.replace(staticRootPlaceholder, "\" + com.google.gwt.core.clie...
2111687_7
public String write(Path2D path) { StringBuilder d = new StringBuilder(); appendTo(path.getPathIterator(new AffineTransform()), d); return d.toString(); }
2111687_8
@Override public Shape getShape(CoordinateSystem coordinateSystem) { switch (coordinateSystem) { case USER: return source.getShape(); case FONT: return transformToFontCoordinateSystem(); } throw new UnsupportedOperationException(); }
2111687_9
@Override public IconArtifacts execute(TreeLogger logger, IconContext context, List<Icon> icons) { IconArtifacts artifacts = new IconArtifacts(); artifacts.appendToStylesheet(composeStylesheet(icons)); return artifacts; }
2112231_0
public static List<WeightedMobSpawnGroup> fromJson(String originalJson) throws InvalidConfigException { // Example: [{"mob": "Sheep", "weight": 12, "min": 4, "max": 4}] List<WeightedMobSpawnGroup> mobGroups = new ArrayList<WeightedMobSpawnGroup>(); String json = originalJson.trim(); if (json.length() <=...
2112231_1
public void readIntoMap(SettingsMap settings, BufferedReader fileContents) throws IOException { int lineNumber = 0; String thisLine; while ((thisLine = fileContents.readLine()) != null) { lineNumber++; if (thisLine.trim().isEmpty()) { // Empty line, ignore } e...
2112231_2
public static SettingsMap read(String configName, File file) { SettingsMap settingsMap = new SimpleSettingsMap(configName, !file.exists()); new FileSettingsReader().readIntoMap(settingsMap, file); return settingsMap; }
2112231_3
public static void readInto(SettingsMap settingsMap, String rawSettings) { String[] settings = rawSettings.split(";"); for (String setting : settings) { String[] settingParts = setting.split("=", 2); String settingName = settingParts[0].toLowerCase().trim(); if (settingName.isEmpty()...
2112231_4
public static void readInto(SettingsMap settingsMap, String rawSettings) { String[] settings = rawSettings.split(";"); for (String setting : settings) { String[] settingParts = setting.split("=", 2); String settingName = settingParts[0].toLowerCase().trim(); if (settingName.isEmpty()...
2112231_5
@Override public T read(String string) throws InvalidConfigException { for (T enumValue : enumValues) { if (enumValue.name().equalsIgnoreCase(string)) { return enumValue; } } throw new InvalidConfigException(string + " is not an acceptable value"); }
2112231_6
@Override public T read(String string) throws InvalidConfigException { for (T enumValue : enumValues) { if (enumValue.name().equalsIgnoreCase(string)) { return enumValue; } } throw new InvalidConfigException(string + " is not an acceptable value"); }
2112231_7
@Override public Boolean read(String string) throws InvalidConfigException { if (string.equalsIgnoreCase("true")) { return Boolean.TRUE; } if (string.equalsIgnoreCase("false")) { return Boolean.FALSE; } throw new InvalidConfigException(string + " is not a boolean"); }
2112231_8
@Override public Boolean read(String string) throws InvalidConfigException { if (string.equalsIgnoreCase("true")) { return Boolean.TRUE; } if (string.equalsIgnoreCase("false")) { return Boolean.FALSE; } throw new InvalidConfigException(string + " is not a boolean"); }
2112231_9
@Override public Double read(String string) throws InvalidConfigException { return StringHelper.readDouble(string, minValue, maxValue); }
2117797_0
public static Coordinates geoCodeAddress(String country, String city) throws GeoCodingException { final String address = city != null ? city + " , " + country : country; return GeoCoder.geoCodeAddress(address); }
2117797_1
public static Coordinates geoCodeAddress(String country, String city) throws GeoCodingException { final String address = city != null ? city + " , " + country : country; return GeoCoder.geoCodeAddress(address); }
2117797_2
public ThrottleManager(ThrottleProfile inDefaultProfile) { this.mDefaultProfile = inDefaultProfile; this.mDestructionPeriod = this.mDefaultProfile.getPeriod(); this.mTimer.scheduleAtFixedRate(this.theTask, this.mDestructionPeriod, this.mDestructionPeriod); }
2117797_3
public static String cleanControlChars(String inInput, boolean inRemoveTabAndLf, boolean inRemoveSurroundingQuotes) { if (inInput == null) { return net.violet.common.StringShop.EMPTY_STRING; } final Pattern cleanPattern = (inRemoveTabAndLf ? StringTools.ALL_CTL_CHARS : StringTools.CTL_CHARS); final String firstPa...
2117797_4
public static String cleanControlChars(String inInput, boolean inRemoveTabAndLf, boolean inRemoveSurroundingQuotes) { if (inInput == null) { return net.violet.common.StringShop.EMPTY_STRING; } final Pattern cleanPattern = (inRemoveTabAndLf ? StringTools.ALL_CTL_CHARS : StringTools.CTL_CHARS); final String firstPa...
2117797_5
public static String cleanControlChars(String inInput, boolean inRemoveTabAndLf, boolean inRemoveSurroundingQuotes) { if (inInput == null) { return net.violet.common.StringShop.EMPTY_STRING; } final Pattern cleanPattern = (inRemoveTabAndLf ? StringTools.ALL_CTL_CHARS : StringTools.CTL_CHARS); final String firstPa...
2117797_6
public static String getFirstSentence(String text, int maxLength) { final int indexOfPoint = text.indexOf('.'); // the string contains a dot and the potential substring has a good size or there is no size restriction if ((indexOfPoint > 0) && ((indexOfPoint < maxLength) || (maxLength < 0))) { return text.substring...
2117797_7
public static String encodeString(String s) { return new String(SafeBase64.encode(s.getBytes())); }
2117797_8
public static String decodeString(String inStr64, boolean applyUrlSafeMapping) { return new String(SafeBase64.decode(inStr64, applyUrlSafeMapping)); }
2117797_9
public static byte[] decode(String inStr64, boolean applyUrlSafeMapping) { return SafeBase64.decode(inStr64.toCharArray(), applyUrlSafeMapping); }
2118259_0
@Override @Nonnull public List<ContactDetailsDTO> getContactDetails() { initContactsIfRequired(); final ArrayList<ContactDetailsDTO> contactDetails = new ArrayList<ContactDetailsDTO>(); for( final Contact contact : _contactDAO.findAll() ) { contactDetails.add( toLightWeightContactDTO( contact ) ); } ret...
2125451_0
public Iterator<Change> parse(InputStream changesetDownloadStream) throws XMLStreamException { final XMLStreamReader reader; reader = XMLInputFactory.newFactory().createXMLStreamReader(changesetDownloadStream, "UTF-8"); // position reader at first change, if any reader.nextTag(); reader....
2125451_1
public Iterator<Change> parse(InputStream changesetDownloadStream) throws XMLStreamException { final XMLStreamReader reader; reader = XMLInputFactory.newFactory().createXMLStreamReader(changesetDownloadStream, "UTF-8"); // position reader at first change, if any reader.nextTag(); reader....
2125451_2
public Iterator<Change> parse(InputStream changesetDownloadStream) throws XMLStreamException { final XMLStreamReader reader; reader = XMLInputFactory.newFactory().createXMLStreamReader(changesetDownloadStream, "UTF-8"); // position reader at first change, if any reader.nextTag(); reader....
2125451_3
Primitive parsePrimitive(XMLStreamReader reader) throws XMLStreamException { reader.require(START_ELEMENT, null, null); final String primitiveName = reader.getLocalName(); checkArgument(PRIMITIVE_TAGS.contains(primitiveName)); Primitive primitive = inferrPrimitive(reader); primitive.setId(Long.value...
2125451_4
Primitive parsePrimitive(XMLStreamReader reader) throws XMLStreamException { reader.require(START_ELEMENT, null, null); final String primitiveName = reader.getLocalName(); checkArgument(PRIMITIVE_TAGS.contains(primitiveName)); Primitive primitive = inferrPrimitive(reader); primitive.setId(Long.value...
2125451_5
Primitive parsePrimitive(XMLStreamReader reader) throws XMLStreamException { reader.require(START_ELEMENT, null, null); final String primitiveName = reader.getLocalName(); checkArgument(PRIMITIVE_TAGS.contains(primitiveName)); Primitive primitive = inferrPrimitive(reader); primitive.setId(Long.value...
2125451_6
Primitive parsePrimitive(XMLStreamReader reader) throws XMLStreamException { reader.require(START_ELEMENT, null, null); final String primitiveName = reader.getLocalName(); checkArgument(PRIMITIVE_TAGS.contains(primitiveName)); Primitive primitive = inferrPrimitive(reader); primitive.setId(Long.value...
2125451_7
public static long parseDateTime(String xmlDateTime) { try { Calendar cal = DatatypeConverter.parseDateTime(xmlDateTime); cal.set(Calendar.MILLISECOND, 0); long timestamp = cal.getTimeInMillis(); return timestamp; } catch (RuntimeException e) { e.printStackTrace(); ...
2125451_8
public Iterator<Changeset> fetchChangesets() { Range<Long> range = Range.closed(initialChangeset, finalChangeset); ContiguousSet<Long> changesetIds = ContiguousSet.create(range, DiscreteDomain.longs()); final int fetchSize = 100; Iterator<List<Long>> partitions = Iterators.partition(changesetIds.iterato...
2125451_9
public Iterator<Changeset> fetchChangesets() { Range<Long> range = Range.closed(initialChangeset, finalChangeset); ContiguousSet<Long> changesetIds = ContiguousSet.create(range, DiscreteDomain.longs()); final int fetchSize = 100; Iterator<List<Long>> partitions = Iterators.partition(changesetIds.iterato...
2125920_0
@Override public void close() { }
2125920_1
@Override public void close() { }
2125920_2
@Override public void close() { // Intentionally blank. }
2125920_3
@Override public void close() { // Intentionally blank }
2125920_4
@Override public void close() { // Intentionally blank }
2125920_5
@Override public void close() { // Intentionally blank }
2125920_6
@Override public void minimize(float stepSize, float[] consensusValues) { float weight = (float)((WeightedGroundRule)groundRule).getWeight(); for (int i = 0; i < size; i++) { LocalVariable variable = variables[i]; float value = consensusValues[variable.getGlobalId()] - variable.getLagrange() / s...
2125920_7
@Override public void minimize(float stepSize, float[] consensusValues) { // Initializes scratch data. float total = 0.0f; // Minimizes without the quadratic loss, i.e., solves // argmin stepSize/2 * \|x - z + y / stepSize \|_2^2 for (int i = 0; i < size; i++) { LocalVariable variable = vari...
2125920_8
@Override public void minimize(float stepSize, float[] consensusValues) { minWeightedSquaredHyperplane(stepSize, consensusValues); }
2125920_9
@Override public void minimize(float stepSize, float[] consensusValues) { float weight = (float)((WeightedGroundRule)groundRule).getWeight(); float total = 0.0f; // Minimizes without the linear loss, i.e., solves // argmin stepSize/2 * \|x - z + y / stepSize \|_2^2 for (int i = 0; i < size; i++) { ...
2129779_0
@RequestMapping(value = "/", method = RequestMethod.GET) public String home(Model model) { logger.info("Welcome home!"); model.addAttribute("controllerMessage", "This is the message from the controller!"); return "home"; }
2129779_1
@RequestMapping(method=RequestMethod.GET,value="list") public ModelAndView listPeople() { logger.debug("Received request to list persons"); myScopeBean.validateReferences(); ModelAndView mav = new ModelAndView(); List<Person> people = personDao.getPeople(); logger.debug("Person Listing count = "+people.size()); m...
2129779_2
@RequestMapping(method=RequestMethod.GET,value="edit") public ModelAndView editPerson(@RequestParam(value="id",required=false) Long id) { logger.debug("Received request to edit person id : "+id); ModelAndView mav = new ModelAndView(); mav.setViewName("edit"); Person person = null; if (id == null) { p...
2129779_3
public SomeDao getMyDaoByExpression() { return myDaoByExpression; }
213337_10
@Override public String getColumnName(int col) { if (isVariableColumn(col)) { return CategoryKnowledgeFactory.getCategoryKnowledge(d_type).getSingularCapitalized(); } else if (isMeasurementMomentColumn(col)) { return "Measurement moment"; } else if (isOverallColumn(col)) { return "Overall"; } return d_pmf.g...
213337_11
public Object getValueAt(int rowIndex, int columnIndex) { Key key = getKeyAt(rowIndex, columnIndex); if (isVariableColumn(columnIndex)) { return key.v.getValue().getName(); } if (isMeasurementMomentColumn(columnIndex)) { return key.wt; } return d_mmpMap.get(key.getMeasurementKey()); }
213337_12
@Override public boolean isCellEditable(int row, int col) { return false; }
213337_13
public Boolean getValue() { return d_changed; }
213337_14
public Boolean getValue() { return d_changed; }
213337_15
public int getColumnCount() { return 2; }
213337_16
public int getRowCount() { return d_br.getCriteria().size(); }
213337_17
public Object getValueAt(int rowIndex, int columnIndex) { OutcomeMeasure om = d_br.getCriteria().get(rowIndex); if (columnIndex == 0) return om.toString(); else return d_br.getBaselineDistribution(om); }
213337_18
@Override public String getColumnName(int index) { if (index == 0) { return "Criterion"; } return "Baseline"; }
213337_19
public Object getValueAt(int rowIndex, int columnIndex) { OutcomeMeasure om = d_br.getCriteria().get(rowIndex); if (columnIndex == 0) return om.toString(); else return d_br.getBaselineDistribution(om); }
213337_20
public ModifiableHolder<Boolean> getSelectedStudyBooleanModel(Study s) throws IllegalArgumentException{ if (!getAvailableStudies().contains(s)) { throw new IllegalArgumentException(); } return d_selectedStudiesMap.get(s); }
213337_21
public ModifiableHolder<Boolean> getSelectedStudyBooleanModel(Study s) throws IllegalArgumentException{ if (!getAvailableStudies().contains(s)) { throw new IllegalArgumentException(); } return d_selectedStudiesMap.get(s); }
213337_22
public ModifiableHolder<Boolean> getSelectedStudyBooleanModel(Study s) throws IllegalArgumentException{ if (!getAvailableStudies().contains(s)) { throw new IllegalArgumentException(); } return d_selectedStudiesMap.get(s); }