code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@SuppressWarnings("unchecked")
public <T> Serializer<T> getSerializer(Class<T> type, String mediaType) throws SerializationException {
checkNotNull(type, "Type (Class<T>) cannot be null.");
checkNotNull(mediaType, "Media-Type cannot be null.");
final String typeName = getClassName(type);
... | java |
private RecordList loadData(AbstractDataTable table, DataSchema schema) {
RecordListBuilder recordListBuilder = new RecordListBuilder(RecordListBuilder.CompressionMode.CANONICAL, schema);
// simple check to ensure schema and table definitions are aligned
if(schema.size()!= table.getNumberOfColum... | java |
private static TrustManager createNaiveTrustManager() {
return new X509TrustManager() {
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] chain, String authType) throws Ce... | java |
@Override
protected void onLoad() {
mainAbsolutePanel.setSize(
String.valueOf(yuiSliderGwtWidget.getOffsetWidth()),
String.valueOf(yuiSliderGwtWidget.getOffsetHeight())
);
setupMarkerLabels();
} | java |
public void urlCheckAndSave(BasicCheckInfo basicCheckInfo, ParamType paramType, ReqUrl reqUrl, Class<?> type) {
if (!this.validationConfig.isFreshUrlSave() || !basicCheckInfo.isUrlMapping()) {
return;
}
List<ValidationData> datas = this.validationDataRepository.findByParamTypeAndMet... | java |
public MapBuilder configureMapDimension(Integer width, Integer height) {
this.mapHeight = height;
this.mapWidth = width;
return this;
} | java |
protected void detectTypes(ImportMatrix matrix) {
for (int row = 0; row < matrix.getNumberOfRows(); row++) {
for (int column = 0; column < matrix.getNumberOfColumns(); column++) {
ImportCell cell = matrix.getCell(row, column);
if (cell != null && cell.getInterpretatio... | java |
protected PCMDirection detectDirection(ImportMatrix matrix) {
// Compute homogeneity of rows
double sumHomogeneityOfRow = 0;
for (int row = 0; row < matrix.getNumberOfRows(); row++) {
Map<String, Integer> types = new HashMap<>();
// Retrieve types of values
... | java |
protected IONode<String> detectFeatures(ImportMatrix matrix, PCMContainer pcmContainer) {
IONode<String> root = new IONode<>(null);
List<IONode<String>> parents = new ArrayList<>();
// Init parents
for (int column = 0; column < matrix.getNumberOfColumns(); column++) {
paren... | java |
protected void createProducts(ImportMatrix matrix, PCMContainer pcmContainer, Map<Integer, Feature> positionToFeature) {
int featuresDepth = pcmContainer.getPcm().getFeaturesDepth();
for (int row = featuresDepth; row < matrix.getNumberOfRows(); row++) {
Product product = factory.createProd... | java |
public static String readBody(HttpServletRequest request) {
BufferedReader input = null;
try {
input = new BufferedReader(new InputStreamReader(request.getInputStream()));
StringBuilder builder = new StringBuilder();
String buffer;
while ((buffer = input.... | java |
private RecordList convertDataTable(AbstractDataTable table, DataSchema schema) {
return dataTableConversionUtility.convertDataTableToRecordList(schema, table);
} | java |
private List<Integer> calculateRowsToFilter(DataView dataView, FilterQuery filterQuery, DataSchema schema) {
JsArray<JavaScriptObject> propertiesJsArray = convertToColumnIndexAndValueArray(filterQuery, schema);
JsArrayInteger jsArrayInteger = getFilteredRows(dataView, propertiesJsArray);
return ... | java |
public static ObjectMapper getDefaultObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
mapper.configure(SerializationFe... | java |
public static boolean isNumberObj(Object type) {
try {
Double.valueOf(type + "");
} catch (NumberFormatException e) {
return false;
}
return true;
} | java |
public static boolean isDoubleType(Class<?> type) {
return (type.isPrimitive() && type == float.class) || (type.isPrimitive() && type == double.class)
|| (!type.isPrimitive() && type == Float.class) || (!type.isPrimitive() && type == Double.class);
} | java |
public static boolean isIntType(Class<?> type) {
return (type.isPrimitive() && type == int.class) || (type.isPrimitive() && type == long.class)
|| (!type.isPrimitive() && type == Integer.class) || (!type.isPrimitive() && type == Long.class);
} | java |
public static Method getSetterMethodNotCheckParamType(Class<?> cType, String fieldName) {
String methodName = getMethodName(fieldName, SET_METHOD_PREFIX);
Method[] methods = cType.getMethods();
for (Method m : methods) {
if (m.getName().equals(methodName) && m.getParameterCount() == ... | java |
public static Method getSetterMethod(Class<?> cType, String fieldName, Class<?> paramType) {
Class<?> subType = getSubType(paramType);
String methodName = getMethodName(fieldName, SET_METHOD_PREFIX);
try {
return cType.getMethod(methodName, paramType);
} catch (NoSuchMethod... | java |
public static String getMethodName(String name, String prefix) {
return prefix + name.substring(0, 1).toUpperCase() + name.substring(1);
} | java |
public static String getFieldNameFromMethod(Method m) {
String methodName = m.getName();
if (methodName.startsWith(GET_METHOD_PREFIX)) {
methodName = methodName.replaceFirst(GET_METHOD_PREFIX, "");
} else if (methodName.startsWith(IS_METHOD_PREFIX)) {
methodName = method... | java |
public static Method getGetterMethod(Class<?> c, String field) {
try {
return c.getMethod(getMethodName(field, GET_METHOD_PREFIX), EMPTY_CLASS);
} catch (NoSuchMethodException e) {
try {
return c.getMethod(getMethodName(field, IS_METHOD_PREFIX), EMPTY_CLASS);
... | java |
public static Object getValue(Object obj, String field) {
Method getter = getGetterMethod(obj.getClass(), field);
try {
return getter.invoke(obj);
} catch (IllegalAccessException | InvocationTargetException e) {
return null;
}
} | java |
public static Object objDeepCopy(Object from, Object to, String... copyFields) {
if (from == null || to == null) {
log.error("object deep copy from or to is null ");
return to;
}
for (String field : copyFields) {
copyFromTo(from, to, field);
}
... | java |
public static <T> T objectDeepCopyWithWhiteList(Object from, Object to, String... copyFields) {
return (T) to.getClass().cast(objDeepCopy(from, to, copyFields));
} | java |
public static boolean isGetterMethod(Method m) {
String methodName = m.getName();
if (methodName.equals("getClass")) {
return false;
}
if (!methodName.startsWith(GET_METHOD_PREFIX) && !methodName.startsWith(IS_METHOD_PREFIX)) {
return false;
}
i... | java |
public static Double getObjectSize(Object value) {
double v = 1;
if (value instanceof String) {
v = ((String) value).length();
if (v < 1) {
return null;
}
} else if (value instanceof List) {
v = ((List) value).size();
} el... | java |
public static Class<?> getListInnerClassFromGenericType(Type genericType) {
ParameterizedType innerClass = (ParameterizedType) genericType;
return (Class<?>) innerClass.getActualTypeArguments()[0];
} | java |
public MsgChecker replaceCallback(BasicCheckRule type, ValidationInvalidCallback cb) {
this.callbackMap.put(type.name(), cb);
return this;
} | java |
public void checkPoint(ValidationData param, ValidationRule rule, Object bodyObj, Object standardValue) {
//check
Object value = param.getValue(bodyObj);
BaseValidationCheck checker = this.validationRuleStore.getValidationChecker(rule);
if ((value != null && standardValue != null) || rul... | java |
public void checkPointListChild(ValidationData param, ValidationRule rule, Object bodyObj, Object standardValue) {
ValidationData listParent = param.findListParent();
List list = (List) listParent.getValue(bodyObj);
if (list == null || list.isEmpty()) {
return;
}
lis... | java |
public void checkDataInnerRules(ValidationData data, Object bodyObj) {
data.getValidationRules().stream().filter(vr -> vr.isUse()).forEach(rule -> {
if (data.isListChild()) {
this.checkPointListChild(data, rule, bodyObj, rule.getStandardValue());
} else {
... | java |
public void checkRequest(BasicCheckInfo basicCheckInfo, Object bodyObj) {
String key = basicCheckInfo.getUniqueKey();
List<ValidationData> checkData = this.validationStore.getValidationDatas(basicCheckInfo.getParamType(), key);
if (checkData == null || checkData.isEmpty()) {
return... | java |
private void applyDefaultValues(Map<String, Object> parameterValues) {
for (Parameter<?> parameter : allParameters) {
parameterValues.put(parameter.getName(), getParameterDefaultValue(parameter));
}
} | java |
private <T> T getParameterDefaultValue(Parameter<T> parameter) {
String defaultOsgiConfigProperty = parameter.getDefaultOsgiConfigProperty();
if (StringUtils.isNotBlank(defaultOsgiConfigProperty)) {
String[] parts = StringUtils.split(defaultOsgiConfigProperty, ":");
String className = parts[0];
... | java |
private void applyOverrideSystemDefault(Map<String, Object> parameterValues) {
for (Parameter<?> parameter : allParameters) {
Object overrideValue = parameterOverride.getOverrideSystemDefault(parameter);
if (overrideValue != null) {
parameterValues.put(parameter.getName(), overrideValue);
... | java |
private Map<String, Object> ensureValidValueTypes(Map<String, Object> parameterValues) {
Map<String, Object> transformedParameterValues = new HashMap<>();
for (Map.Entry<String, Object> entry : parameterValues.entrySet()) {
if (entry.getKey() == null || entry.getValue() == null) {
continue;
... | java |
private SortedSet<String> applyOverrideForce(String configurationId, Map<String, Object> parameterValues,
SortedSet<String> ancestorLockedParameterNames) {
for (Parameter<?> parameter : allParameters) {
Object overrideValue = parameterOverride.getOverrideForce(configurationId, parameter);
if (over... | java |
private void validateParameterProviders() {
Set<String> parameterNames = new HashSet<>();
for (ParameterProvider provider : this.parameterProviders) {
Set<String> applicationIdsOfThisProvider = new HashSet<>();
for (Parameter<?> parameter : provider.getParameters()) {
if (StringUtils.isNotEm... | java |
private SortedSet<String> mergeSets(SortedSet<String> primary, Set<String> secondary) {
SortedSet<String> result = primary;
if (!secondary.isEmpty()) {
result = new TreeSet<>();
result.addAll(primary);
result.addAll(secondary);
}
return result;
} | java |
public boolean equalUrl(ReqUrl url) {
return url.getMethod().equalsIgnoreCase(this.method) && url.getUrl().equalsIgnoreCase(this.url);
} | java |
public void replaceValue(Object bodyObj, Object replaceValue) {
Object parentObj = bodyObj;
if(this.listChild) {
ValidationData rootListParent = this.findListParent();
if(this.deepLevel - rootListParent.deepLevel > 1 ){
parentObj = this.parent.getValue(bodyObj);
... | java |
public ValidationData updateKey(DetailParam detailParam) {
if (detailParam == null) {
return this;
}
this.methodKey = detailParam.getMethodKey();
this.parameterKey = this.paramType.getUniqueKey(this.methodKey);
this.urlMapping = detailParam.isUrlMapping();
re... | java |
public boolean diffKey(DetailParam detailParam){
if (detailParam == null) {
return false;
}
if(!detailParam.getMethodKey().equals(this.methodKey)){
return true;
}
return detailParam.isUrlMapping() != this.isUrlMapping();
} | java |
public void updateField(Field field) {
this.name = field.getName();
this.obj = TypeCheckUtil.isObjClass(field);
this.list = TypeCheckUtil.isListClass(field);
this.number = TypeCheckUtil.isNumberClass(field);
this.enumType = field.getType().isEnum();
this.typeClass = field... | java |
public ValidationData minimalize() {
this.setValidationRules(this.validationRules.stream().filter(vr -> vr.isUse()).collect(Collectors.toList()));
return this;
} | java |
public ValidationData ruleSync(List<ValidationRule> rules) {
List<ValidationRule> ruleList = new ArrayList<>();
rules.forEach(rule -> {
ValidationRule existRule = this.getExistRule(rule);
ruleList.add(existRule != null ? existRule : rule);
});
this.validationRul... | java |
public ValidationData findListParent() {
if (!this.listChild) {
return null;
}
ValidationData parent = this.parent;
while (parent != null && !parent.isList()) {
parent = parent.parent;
}
return parent;
} | java |
public RecordList getUniqueRecordsBy(String fieldName) {
Set<String> uniqueKeys = new HashSet<String>();
final RecordListBuilder uniqueRecordListBuilder = new RecordListBuilder(schema);
for (int rowIndex = 0; rowIndex < this.size(); rowIndex++) {
final Record currentRecord = this.rec... | java |
public static void main(String[] args) throws IOException {
// TODO : le pcm mutate est bien différent du pcm de base, mais les changements ne sont pas pris en compte. A travailler !
// inputpath = args[0];
inputpath = "off_output/pcms/test_paget/input";
outputpath = "off_output/pcms/test_paget/output";
... | java |
public void writeFile(String fn, HttpServletResponse res) {
ValidationFileUtil.initFileSendHeader(res, ValidationFileUtil.getEncodingFileName(fn + ".xls"), null);
try {
this.workBook.write(res.getOutputStream());
} catch (IOException e) {
throw new ValidationLibExceptio... | java |
@EventHandler
public void onSelectFilter(SelectFilterEvent selectFilterEvent){
for (FacetWidget facetWidget : filterList) {
if(facetWidget.getFacetField().equals(selectFilterEvent.getFilterName())){
for (FacetWidgetItem facetWidgetItem : facetWidget.getFacetWidgetItems()) {
... | java |
public <T> GenericMarker<T> createMarker(T markerContext, GenericMapWidget mapWidget) {
this.map = mapWidget;
validateRequiredParameters();
if(map instanceof GoogleV3MapWidget){
return new GoogleV3Marker<T>(this, markerContext);
}
if(map instanceof OfflineMapWidget){
... | java |
public static Resource getResource(Object adaptable) {
if (adaptable instanceof Resource) {
return (Resource)adaptable;
}
else if (adaptable instanceof SlingHttpServletRequest) {
SlingHttpServletRequest request = (SlingHttpServletRequest)adaptable;
return request.getResource();
}
r... | java |
public void readState(DataInputStream stream) throws IOException
{
int len = mt.length;
for(int x=0;x<len;x++) mt[x] = stream.readInt();
len = mag01.length;
for(int x=0;x<len;x++) mag01[x] = stream.readInt();
mti = stream.readInt();
__nextNextGau... | java |
public void writeState(DataOutputStream stream) throws IOException
{
int len = mt.length;
for(int x=0;x<len;x++) stream.writeInt(mt[x]);
len = mag01.length;
for(int x=0;x<len;x++) stream.writeInt(mag01[x]);
stream.writeInt(mti);
stream.writeDoubl... | java |
synchronized public void setSeed(final int[] array)
{
if (array.length == 0)
throw new IllegalArgumentException("Array length must be greater than zero");
int i, j, k;
setSeed(19650218);
i=1; j=0;
k = (N>array.length ? N : array.length);
for (; k!=0; k... | java |
public void lire()
{
try
{
String adressedufichier = System.getProperty("user.dir") + "\\monfichier.txt";
FileReader fr = new FileReader(adressedufichier);
BufferedReader br = new BufferedReader(fr);
String texte = "";
int a = 0;
while(a<2) //petite boucle 2 fois
{
text... | java |
public <T> T deserialize(Class<T> clazz, String stringContainingSerialisedInput) {
T instance;
try {
instance = storageSerializer.deserialize(clazz, stringContainingSerialisedInput);
} catch (SerializationException e) {
throw new IllegalStateException("unable to serialise... | java |
private BitSet parseQuery(FilterQuery filterQuery, DataSchema schema) {
BitSet queryBitSet = new BitSet();
if(filterQuery instanceof MatchAllQuery || filterQuery.getFilterQueries().size() < 1) return queryBitSet;
//facet drill down happens here
for (String filterField : filterQuery.getF... | java |
@Override
public ResultMetadata[] getResultMetadata() throws LightblueParseException {
JsonNode node=getJson().get("resultMetadata");
if(node instanceof ArrayNode) {
try {
return getMapper().readValue(node.traverse(),ResultMetadata[].class);
} catch (IOExcepti... | java |
private Map<Feature, Feature> diffFeatures(List<Feature> pcm1Features, List<Feature> pcm2Features, PCMElementComparator comparator, DiffResult result) {
List<Feature> commonFeatures = new ArrayList<Feature>();
List<Feature> featuresOnlyInPCM1 = new ArrayList<Feature>();
List<Feature> featuresOnl... | java |
private Map<Product, Product> diffProducts(List<Product> pcm1Products, List<Product> pcm2Products, PCMElementComparator comparator, DiffResult result) {
List<Product> commonProducts = new ArrayList<Product>();
List<Product> productsOnlyInPCM1 = new ArrayList<Product>();
List<Product> productsOnl... | java |
public static Object toPersistenceType(Object value, Class<?> parameterType) {
if (!isTypeConversionRequired(parameterType)) {
return value;
}
if (Map.class.isAssignableFrom(parameterType) && (value instanceof Map)) {
Map<?, ?> map = (Map<?, ?>)value;
Map.Entry<?, ?>[] entries = Iterators.... | java |
public static Object fromPersistenceType(Object value, Class<?> parameterType) {
if (!isTypeConversionRequired(parameterType)) {
return value;
}
if (Map.class.isAssignableFrom(parameterType) && (value instanceof String[])) {
String[] rows = (String[])value;
Map<String, String> map = new Li... | java |
public void addFilter(String field, String valueToFilter){
if(StringUtils.isEmpty(field) || StringUtils.isEmpty(valueToFilter)){
throw new IllegalArgumentException("Expected all attributes to be non empty");
}
Set<String> valuesToFilter = new HashSet<String>();
valuesToFilter... | java |
public void addMultipleValuesFilter(String field, Set<String> valueToFilter){
if(!valueToFilter.isEmpty()){
filterQueries.put(field, new FilterFieldValue(field, valueToFilter));
}
} | java |
public long nextLong(final long n)
{
if (n<=0)
throw new IllegalArgumentException("n must be > 0");
long bits, val;
do
{
bits = (nextLong() >>> 1);
val = bits % n;
}
while(bits - val + (n-1) < 0);
ret... | java |
public void addDocument(String... fields){
for (int i = 0; i < fields.length; i++) {
final DataType type = schema.getType(i);
String field = fields[i];
final Map<String, Set<Integer>> stringSetMap = this.fields.get(i);
if(type == DataType.DateYear){ // reformat fi... | java |
public void print(PCM pcm) {
// We start by listing the names of the products
System.out.println("--- Products ---");
for (Product product : pcm.getProducts()) {
System.out.println(product.getKeyContent());
}
// Then, we use a visitor to print the content of the cel... | java |
@Override
public void visit(PCM pcm) {
for (Product product : pcm.getProducts()) {
product.accept(this);
}
} | java |
public String getSheetName(int idx) {
String name = method + "|" + url.replace("/", "|");
if (name.length() > 30) {
return name.substring(0, 29) + idx;
}
return name;
} | java |
private void setupIndexMonitor(final DataSchema dataSchema, final GenericDataSource dataSource) {
logger.log(FINE,"LuceneSearchServiceImpl::setupIndexMonitor Attempting to setup Index monitor...");
try {
if(GoogleAppEngineUtil.isGaeEnv()){
return; // only use for pure lucene... | java |
public static List<ReqUrl> getUrlListFromValidationDatas(List<ValidationData> datas) {
Map<String, ReqUrl> urlMap = new HashMap<>();
datas.stream().forEach(data -> {
ReqUrl url = new ReqUrl(data);
urlMap.put(url.getUniqueKey(), url);
});
return urlMap.entrySet().... | java |
private void appendLiteral(int word)
{
// when we have a zero sequence of the maximum lenght (that is,
// 00.00000.1111111111111111111111111 = 0x01FFFFFF), it could happen
// that we try to append a zero literal because the result of the given operation must be an
// empty set. Whitout the follow... | java |
public static void addIndexData(ValidationData data, ValidationDataIndex index) {
String key = index.getKey(data);
List<ValidationData> datas = index.get(key);
if (datas == null) {
datas = new ArrayList<>();
}
datas.add(data);
index.getMap().put(key, datas);
... | java |
public static void removeIndexData(ValidationData data, ValidationDataIndex index) {
String key = index.getKey(data);
List<ValidationData> datas = index.get(key);
if (!datas.isEmpty()) {
datas = datas.stream().filter(d -> !d.getId().equals(data.getId())).collect(Collectors.toList()... | java |
public static String makeKey(String... keys) {
StringBuffer keyBuffer = new StringBuffer();
for (String s : keys) {
keyBuffer.append(s);
keyBuffer.append(":");
}
return keyBuffer.toString();
} | java |
public static Method findMethod(Class<?> c, String methodName) {
for (Method m : c.getMethods()) {
if (!m.getName().equalsIgnoreCase(methodName)) {
continue;
}
if (m.getParameterCount() != 1) {
continue;
}
return m;
... | java |
@SuppressWarnings("PMD.LooseCoupling")
public static Object castValue(Method m, Class<?> castType, String value) {
try {
if (castType.isEnum()) {
Method valueOf;
try {
valueOf = castType.getMethod("valueOf", String.class);
... | java |
public static Object mapToObject(Map<String, String> map, Class<?> c) {
Method m = null;
Object obj = null;
try {
obj = c.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
log.info("instance create fail : " + c.getName());
... | java |
public List<ValidationData> findByIds(List<Long> ids) {
return this.datas.stream().filter(d -> ids.contains(d.getId())).collect(Collectors.toList());
} | java |
public List<ValidationData> findAll(boolean referenceCache) {
if (referenceCache && this.datas != null) {
return this.datas;
}
List<ValidationData> list = null;
File repositroyFile = new File(this.validationConfig.getRepositoryPath());
try {
String jsonS... | java |
public List<ValidationData> findByParamTypeAndMethodAndUrl(ParamType paramType, String method, String url) {
return this.findByMethodAndUrl(method, url).stream().filter(d -> d.getParamType().equals(paramType)).collect(Collectors.toList());
} | java |
public List<ValidationData> findByParamTypeAndMethodAndUrlAndName(ParamType paramType, String method, String url, String name) {
return this.findByMethodAndUrlAndName(method, url, name).stream().filter(vd -> vd.getParamType().equals(paramType)).collect(Collectors.toList());
} | java |
public ValidationData findByParamTypeAndMethodAndUrlAndNameAndParentId(ParamType paramType, String method, String url, String name, Long parentId) {
if (parentId == null) {
return this.findByParamTypeAndMethodAndUrlAndName(paramType, method, url, name).stream().filter(d -> d.getParentId() == null).f... | java |
public List<ValidationData> findByMethodAndUrlAndName(String method, String url, String name) {
return this.findByMethodAndUrl(method, url).stream().filter(d -> d.getName().equalsIgnoreCase(name)).collect(Collectors.toList());
} | java |
public List<ValidationData> findByParentId(Long id) {
return this.datas.stream().filter(d -> d.getParentId() != null && d.getParentId().equals(id)).collect(Collectors.toList());
} | java |
public ValidationData findByMethodAndUrlAndNameAndParentId(String method, String url, String name, Long parentId) {
if (parentId == null) {
return this.findByMethodAndUrlAndName(method, url, name).stream().filter(d -> d.getParentId() == null).findAny().orElse(null);
}
return this.fin... | java |
public List<ValidationData> saveAll(List<ValidationData> pDatas) {
pDatas.forEach(this::save);
return pDatas;
} | java |
public ValidationData save(ValidationData data) {
if (data.getParamType() == null || data.getUrl() == null || data.getMethod() == null || data.getType() == null || data.getTypeClass() == null) {
throw new ValidationLibException("mandatory field is null ", HttpStatus.BAD_REQUEST);
}
... | java |
public static UriBuilder fromPath(String path) {
if (path == null)
throw new IllegalArgumentException("Path cannot be null");
final UriBuilder builder = newInstance();
builder.path(path);
return builder;
} | java |
public static String toJson(Object obj) {
StringWriter sw = new StringWriter();
ObjectMapper mapper = getDefaultObjectMapper();
try {
JsonGenerator jg = mapper.getFactory().createGenerator(sw);
mapper.writeValue(jg, obj);
} catch (JsonMappingException e) {
... | java |
@Override
public boolean remove(int element)
{
if (element < 0) {
throw new IndexOutOfBoundsException("element < 0: " + element);
}
int index = findElementOrEmpty(element);
if (index < 0) {
return false;
}
cells[index] = REMOVED;
modCount++;
size--;
ret... | java |
@Override
public void clear()
{
size = 0;
Arrays.fill(cells, EMPTY);
freecells = cells.length;
modCount++;
} | java |
protected void rehash()
{
// do we need to increase capacity, or are there so many
// deleted objects hanging around that rehashing to the same
// size is sufficient? if 5% (arbitrarily chosen number) of
// cells can be freed up by a rehash, we do it.
int gargagecells = cells.length - (siz... | java |
protected void rehash(int newCapacity)
{
HashIntSet rehashed = new HashIntSet(newCapacity);
@SuppressWarnings("hiding")
int[] cells = rehashed.cells;
for (int element : this.cells) {
if (element < 0)
// removed or empty
{
continue;
}
// add the elemen... | java |
public CheckPointHelper replaceExceptionCallback(BasicCheckRule checkRule, ValidationInvalidCallback cb) {
this.msgChecker.replaceCallback(checkRule, cb);
return this;
} | java |
public CheckPointHelper addValidationRule(String ruleName, StandardValueType standardValueType, BaseValidationCheck validationCheck, AssistType assistType) {
ValidationRule rule = new ValidationRule(ruleName, standardValueType, validationCheck);
if (assistType == null) {
assistType = AssistT... | java |
private static void track(String historyToken) {
if (historyToken == null) {
historyToken = "historyToken_null";
}
historyToken = URL.encode("/WWARN-GWT-Analytics/V1.0/" + historyToken);
boolean hasErrored = false;
try{
trackGoogleAnalytics(historyToken)... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.