id
stringlengths
7
14
text
stringlengths
1
106k
726694_1
public boolean intersects(Box2D bb) { return Math.max(min.getX(), bb.getMin().getX()) <= Math.min(max.getX(), bb.getMax().getX()) && Math.max(min.getY(), bb.getMin().getY()) <= Math.min(max.getY(), bb.getMax().getY()); }
726694_2
public boolean contains(Vector2 position) { return this.valid() && (position.getX() >= this.getMin().getX() && position.getX() <= this.getMax().getX() && position.getY() >= this.getMin().getY() && position.getY() <= this.getMax() .getY()); }
726694_3
public Vector2 subtract(Vector2 nodePosition) { return new Vector2(this.getX() - nodePosition.getX(), this.getY() - nodePosition.getY()); }
726694_4
public Vector2 add(Vector2 rhs) { return new Vector2(this.getX() + rhs.getX(), this.getY() + rhs.getY()); }
726694_5
public Vector2 rotate(double angle) { double x = this.getX() * Math.cos(angle) - this.getY() * Math.sin(angle); double y = this.getX() * Math.sin(angle) + this.getY() * Math.cos(angle); return new Vector2(x, y); }
726694_6
public double distance(Vector2 other) { return Math.sqrt(this.distanceSquared(other)); }
726694_7
public double distanceSquared(Vector2 other) { return ((this.getX() - other.getX()) * (this.getX() - other.getX())) + ((this.getY() - other.getY()) * (this.getY() - other.getY())); }
726694_8
public double dot(Vector2 v) { return this.x * v.x + this.y * v.y; }
726694_9
}
74217_10
public ReflectionField locateById(Class<?> clazz, String id) { for (java.lang.reflect.Field field : locateAnnotated(clazz, Field.class)) { String annotationValue = field.getAnnotation(Field.class).value(); if (!isEmpty(annotationValue) && id.equals(annotationValue)) { return new ReflectionField(field); } else if (isEmpty(annotationValue) && (field.getName().equals(id) || field.getName().equals(convertIdIntoJavaFieldName(id)))) { return new ReflectionField(field); } } return null; }
74217_11
public ReflectionField locateById(Class<?> clazz, String id) { for (java.lang.reflect.Field field : locateAnnotated(clazz, Field.class)) { String annotationValue = field.getAnnotation(Field.class).value(); if (!isEmpty(annotationValue) && id.equals(annotationValue)) { return new ReflectionField(field); } else if (isEmpty(annotationValue) && (field.getName().equals(id) || field.getName().equals(convertIdIntoJavaFieldName(id)))) { return new ReflectionField(field); } } return null; }
74217_12
public ReflectionField locateById(Class<?> clazz, String id) { for (java.lang.reflect.Field field : locateAnnotated(clazz, Field.class)) { String annotationValue = field.getAnnotation(Field.class).value(); if (!isEmpty(annotationValue) && id.equals(annotationValue)) { return new ReflectionField(field); } else if (isEmpty(annotationValue) && (field.getName().equals(id) || field.getName().equals(convertIdIntoJavaFieldName(id)))) { return new ReflectionField(field); } } return null; }
74217_13
public ReflectionField locateById(Class<?> clazz, String id) { for (java.lang.reflect.Field field : locateAnnotated(clazz, Field.class)) { String annotationValue = field.getAnnotation(Field.class).value(); if (!isEmpty(annotationValue) && id.equals(annotationValue)) { return new ReflectionField(field); } else if (isEmpty(annotationValue) && (field.getName().equals(id) || field.getName().equals(convertIdIntoJavaFieldName(id)))) { return new ReflectionField(field); } } return null; }
74217_14
public List<String> gatherFieldIds(Class<?> clazz) { List<String> fieldNames = new ArrayList<String>(); for (java.lang.reflect.Field field : locateAnnotated(clazz, Field.class)) { String id = field.getAnnotation(Field.class).value(); if (id == null || id.trim().length() == 0) { id = field.getName(); } fieldNames.add(id); } return fieldNames; }
74217_15
public int parseDecimalPlaces(String pattern) { if (pattern.toLowerCase().indexOf("v") == -1) { throw new IllegalArgumentException(MessageFormat.format(NOT_A_DECIMAL_PATTERN, new Object[]{pattern})); } String decimal = pattern.split("v|V")[1]; if (Pattern.matches(NO_MULTIPLIER.pattern(), decimal)) { return decimal.length(); } Matcher matcher = MULTIPLIER.matcher(decimal); matcher.find(); return Integer.parseInt(matcher.group(1)); }
74217_16
public CobolFieldType resolve(String pattern) { if (Pattern.matches(CobolFieldPatternValidator.ALPHANUMERIC_PATTERN, pattern)) { return CobolFieldType.ALPHA_NUMERIC; } else if (Pattern.matches(CobolFieldPatternValidator.INTEGER_PATTERN, pattern)) { return CobolFieldType.INTEGER; } else if (Pattern.matches(CobolFieldPatternValidator.DECIMAL_PATTERN, pattern)) { return CobolFieldType.DECIMAL; } return null; }
74217_17
public CobolFieldDefinition build(CobolFieldInfo fieldInfo, PaddingDescriptor paddingDescriptor) { if (fieldInfo.getType() == CobolFieldType.DECIMAL) return new DecimalFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else if (fieldInfo.getType() == CobolFieldType.INTEGER) return new IntegerFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else return new AlphaNumericFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); }
74217_18
public CobolFieldDefinition build(CobolFieldInfo fieldInfo, PaddingDescriptor paddingDescriptor) { if (fieldInfo.getType() == CobolFieldType.DECIMAL) return new DecimalFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else if (fieldInfo.getType() == CobolFieldType.INTEGER) return new IntegerFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else return new AlphaNumericFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); }
74217_19
public CobolFieldDefinition build(CobolFieldInfo fieldInfo, PaddingDescriptor paddingDescriptor) { if (fieldInfo.getType() == CobolFieldType.DECIMAL) return new DecimalFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else if (fieldInfo.getType() == CobolFieldType.INTEGER) return new IntegerFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); else return new AlphaNumericFieldDefinition(fieldInfo.getName(), fieldInfo.getPosition(), fieldInfo.getPattern(), paddingDescriptor); }
74217_20
public boolean validate(String pattern) { List patterns = Arrays.asList(new String[]{ALPHANUMERIC_PATTERN, INTEGER_PATTERN, DECIMAL_PATTERN}); Iterator it = patterns.iterator(); while (it.hasNext()) { if (Pattern.matches((String) it.next(), pattern)) { return true; } } return false; }
747707_0
public static String createLine(RecordType recordType, int address, byte[] data) { if(recordType != DATA && recordType != END_OF_FILE) { throw new RuntimeException("Un-supported record type: " + recordType + "."); } StringBuilder builder = new StringBuilder(9 + data.length * 2); builder.append(':') .append(UsbUtil.toHexString((byte) data.length)) .append(UsbUtil.toHexString((short) address)) .append('0') .append(recordType.id); int checksum = (byte) data.length + (short) address + recordType.id; for (byte b : data) { builder.append(UsbUtil.toHexString(b)); checksum += b; } return builder.append(UsbUtil.toHexString((byte) -(checksum & 0xff))).toString().toUpperCase(); }
747707_1
public static IntelHexPacket parseLine(int lineNo, String line) throws IOException { if (line.length() < 9) { throw new IOException("line " + lineNo + ": the line must contain at least 9 characters."); } lineNo++; char startCode = line.charAt(0); int count = parseInt(line.substring(1, 3), 16); int address = parseInt(line.substring(3, 7), 16); int r = parseInt(line.substring(7, 9), 16); if (startCode != ':') { throw new IOException("line " + lineNo + ": The first character must be ':'."); } RecordType recordType = lookup(r); if (recordType == DATA) { int expectedLineLength = 9 + count * 2 + 2; if (line.length() != expectedLineLength) { throw new IOException("line " + lineNo + ": Expected line to be " + expectedLineLength + " characters, was " + line.length() + "."); } byte data[] = new byte[count]; int x = 9; for (int i = 0; i < count; i++) { data[i] = (byte) parseInt(line.substring(x, x + 2), 16); x += 2; } return new IntelHexPacket(lineNo, recordType, address, data); } else if(recordType == END_OF_FILE) { return new IntelHexPacket(lineNo, recordType, address, new byte[0]); } throw new IOException("line " + lineNo + ": Unknown record type: 0x" + Long.toHexString(r) + "."); }
747707_2
public static IntelHexPacket parseLine(int lineNo, String line) throws IOException { if (line.length() < 9) { throw new IOException("line " + lineNo + ": the line must contain at least 9 characters."); } lineNo++; char startCode = line.charAt(0); int count = parseInt(line.substring(1, 3), 16); int address = parseInt(line.substring(3, 7), 16); int r = parseInt(line.substring(7, 9), 16); if (startCode != ':') { throw new IOException("line " + lineNo + ": The first character must be ':'."); } RecordType recordType = lookup(r); if (recordType == DATA) { int expectedLineLength = 9 + count * 2 + 2; if (line.length() != expectedLineLength) { throw new IOException("line " + lineNo + ": Expected line to be " + expectedLineLength + " characters, was " + line.length() + "."); } byte data[] = new byte[count]; int x = 9; for (int i = 0; i < count; i++) { data[i] = (byte) parseInt(line.substring(x, x + 2), 16); x += 2; } return new IntelHexPacket(lineNo, recordType, address, data); } else if(recordType == END_OF_FILE) { return new IntelHexPacket(lineNo, recordType, address, new byte[0]); } throw new IOException("line " + lineNo + ": Unknown record type: 0x" + Long.toHexString(r) + "."); }
747707_3
public static List<IntelHexPacket> openIntelHexFile(final File file) throws IOException { return openIntelHexFile(new FileInputStream(file)); }
747707_4
public static void writeBytes(PrintStream print, byte[] bytes) { writeBytes(print, bytes, 0, bytes.length); }
747707_5
public static void writeBytes(PrintStream print, byte[] bytes) { writeBytes(print, bytes, 0, bytes.length); }
747707_6
public static void writeBytes(PrintStream print, byte[] bytes) { writeBytes(print, bytes, 0, bytes.length); }
747707_7
public static void writeBytes(PrintStream print, byte[] bytes) { writeBytes(print, bytes, 0, bytes.length); }
747707_8
public static void writeBytes(PrintStream print, byte[] bytes) { writeBytes(print, bytes, 0, bytes.length); }
747707_9
public static void writeBytes(PrintStream print, byte[] bytes) { writeBytes(print, bytes, 0, bytes.length); }
749137_0
public static String getCleanedServletPath(String fullServletPath) { if (fullServletPath.equalsIgnoreCase("/*")) return ""; Matcher matcher = SERVLET_PATH_PATTERN.matcher(fullServletPath); // It should not happen if the servlet path is valid if (!matcher.find()) return fullServletPath; String servletPath = matcher.group(0); if (!servletPath.startsWith("/")) { servletPath = "/" + servletPath; } return servletPath; }
749137_1
public AtmosphereInterceptorWriter interceptor(AsyncIOInterceptor filter) { if (!filters.contains(filter)) { logger.trace("Adding AsyncIOInterceptor {}", filter.getClass().getName()); filters.addLast(filter); reversedFilters.addFirst(filter); } return this; }
749137_2
@Override public synchronized Broadcaster get() { return get(clazz.getSimpleName() + "-" + config.uuidProvider().generateUuid()); }
749137_3
@Override public synchronized Broadcaster get() { return get(clazz.getSimpleName() + "-" + config.uuidProvider().generateUuid()); }
749137_4
@Override public synchronized Broadcaster get() { return get(clazz.getSimpleName() + "-" + config.uuidProvider().generateUuid()); }
749137_5
@Override public boolean add(Broadcaster b, Object id) { return (store.put(id, b) == null); }
749137_6
@Override public boolean remove(Broadcaster b, Object id) { boolean removed = store.remove(id, b); if (removed && logger.isDebugEnabled()) { logger.debug("Removing Broadcaster {} factory size now {} ", id, store.size()); } return removed; }
749137_7
@Override public <T extends Broadcaster> T lookup(Class<T> c, Object id) { return lookup(c, id, false); }
749137_8
@Override public <T extends Broadcaster> T lookup(Class<T> c, Object id) { return lookup(c, id, false); }
749137_9
@Override public <T extends Broadcaster> T lookup(Class<T> c, Object id) { return lookup(c, id, false); }
762097_0
public synchronized Serializable generate(final SessionImplementor session, Object obj) { // maxLo < 1 indicates a hilo generator with no hilo :? if ( maxLo < 1 ) { //keep the behavior consistent even for boundary usages IntegralDataTypeHolder value = null; while ( value == null || value.lt( 0 ) ) { value = super.generateHolder( session ); } return value.makeValue(); } return hiloOptimizer.generate( new AccessCallback() { public IntegralDataTypeHolder getNextValue() { return generateHolder( session ); } } ); }
762097_1
public synchronized Serializable generate(final SessionImplementor session, Object obj) { // maxLo < 1 indicates a hilo generator with no hilo :? if ( maxLo < 1 ) { //keep the behavior consistent even for boundary usages IntegralDataTypeHolder value = null; while ( value == null || value.lt( 0 ) ) { value = generateHolder( session ); } return value.makeValue(); } return hiloOptimizer.generate( new AccessCallback() { public IntegralDataTypeHolder getNextValue() { return generateHolder( session ); } } ); }
762097_2
public static String renderWhereStringTemplate(String sqlWhereString, Dialect dialect, SQLFunctionRegistry functionRegistry) { return renderWhereStringTemplate(sqlWhereString, TEMPLATE, dialect, functionRegistry); }
762097_3
public static String renderWhereStringTemplate(String sqlWhereString, Dialect dialect, SQLFunctionRegistry functionRegistry) { return renderWhereStringTemplate(sqlWhereString, TEMPLATE, dialect, functionRegistry); }
762097_4
@Override public SessionFactory buildSessionFactory() { return new SessionFactoryImpl(metadata, options, null ); }
762097_5
void applyDefaults(SchemaAware schemaAware, EntityMappingsMocker.Default defaults) { if ( hasSchemaOrCatalogDefined( defaults ) ) { if ( StringHelper.isEmpty( schemaAware.getSchema() ) ) { schemaAware.setSchema( defaults.getSchema() ); } if ( StringHelper.isEmpty( schemaAware.getCatalog() ) ) { schemaAware.setCatalog( defaults.getCatalog() ); } } }
762097_6
void applyDefaults(SchemaAware schemaAware, EntityMappingsMocker.Default defaults) { if ( hasSchemaOrCatalogDefined( defaults ) ) { if ( StringHelper.isEmpty( schemaAware.getSchema() ) ) { schemaAware.setSchema( defaults.getSchema() ); } if ( StringHelper.isEmpty( schemaAware.getCatalog() ) ) { schemaAware.setCatalog( defaults.getCatalog() ); } } }
762097_7
void applyDefaults(SchemaAware schemaAware, EntityMappingsMocker.Default defaults) { if ( hasSchemaOrCatalogDefined( defaults ) ) { if ( StringHelper.isEmpty( schemaAware.getSchema() ) ) { schemaAware.setSchema( defaults.getSchema() ); } if ( StringHelper.isEmpty( schemaAware.getCatalog() ) ) { schemaAware.setCatalog( defaults.getCatalog() ); } } }
762097_8
void applyDefaults(SchemaAware schemaAware, EntityMappingsMocker.Default defaults) { if ( hasSchemaOrCatalogDefined( defaults ) ) { if ( StringHelper.isEmpty( schemaAware.getSchema() ) ) { schemaAware.setSchema( defaults.getSchema() ); } if ( StringHelper.isEmpty( schemaAware.getCatalog() ) ) { schemaAware.setCatalog( defaults.getCatalog() ); } } }
762097_9
public static void bind(AnnotationBindingContext bindingContext) { List<AnnotationInstance> annotations = bindingContext.getIndex() .getAnnotations( HibernateDotNames.FETCH_PROFILE ); for ( AnnotationInstance fetchProfile : annotations ) { bind( bindingContext.getMetadataImplementor(), fetchProfile ); } annotations = bindingContext.getIndex().getAnnotations( HibernateDotNames.FETCH_PROFILES ); for ( AnnotationInstance fetchProfiles : annotations ) { AnnotationInstance[] fetchProfileAnnotations = JandexHelper.getValue( fetchProfiles, "value", AnnotationInstance[].class ); for ( AnnotationInstance fetchProfile : fetchProfileAnnotations ) { bind( bindingContext.getMetadataImplementor(), fetchProfile ); } } }
763770_0
@Override public AssocModelImpl fetchAssoc(long assocId) { return buildAssoc(fetchAssocNode(assocId)); }
763770_1
@Override public void deleteAssoc(long assocId) { // 1) update DB Node assocNode = fetchAssocNode(assocId); // delete the 2 player relationships for (Relationship rel : fetchRelationships(assocNode)) { rel.delete(); } // assocNode.delete(); // // 2) update index removeAssocFromIndex(assocNode); }
763770_2
@Override public List<TopicModelImpl> queryTopicsFulltext(String key, Object value) { if (key == null) { key = KEY_FULLTEXT; } if (value == null) { throw new IllegalArgumentException("Tried to call queryTopicsFulltext() with a null value Object (key=\"" + key + "\")"); } // return buildTopics(topicFulltextIndex.query(key, value)); }
763770_3
@Override public List<TopicModelImpl> queryTopicsFulltext(String key, Object value) { if (key == null) { key = KEY_FULLTEXT; } if (value == null) { throw new IllegalArgumentException("Tried to call queryTopicsFulltext() with a null value Object (key=\"" + key + "\")"); } // return buildTopics(topicFulltextIndex.query(key, value)); }
763770_4
@Override public List<TopicModelImpl> queryTopics(String key, Object value) { return buildTopics(topicIndex.query(key, value)); }
763770_5
@Override public TopicModelImpl fetchTopic(long topicId) { return buildTopic(fetchTopicNode(topicId)); }
763770_6
@Override public Iterable<TopicModelImpl> fetchAllTopics() { return new TopicModelIterable(this); }
763770_7
@Override public Iterable<AssocModelImpl> fetchAllAssocs() { return new AssocModelIterable(this); }
763770_8
@Override public List<TopicModelImpl> fetchTopicsByProperty(String propUri, Object propValue) { return buildTopics(queryIndexByProperty(topicIndex, propUri, propValue)); }
763770_9
@Override public List<TopicModelImpl> fetchTopicsByPropertyRange(String propUri, Number from, Number to) { return buildTopics(queryIndexByPropertyRange(topicIndex, propUri, from, to)); }
766240_0
@Override public V getView() { // Previously we enforced that the presenter was bound, but this led to a lot // of false positives where: // 1. Presenter is bound, AJAX request fires in onBind() // 2. User clicks back, presenter is unbound // 3. AJAX response, fires onResult(), which tries to call getView() // 4. IllegalStateException on the presenter the user no longer cares about // // Perhaps ideally the AJAX command objects could be tied into the presenter // life cycle, and just immediately drop responses on the floor when on longer // bound. But it doesn't seem very harmful to let the now-disconnected onResult // update it's view, and then fairly soon get GC'd anyway. E.g. it should not // actively cause leaks. return view; }
766240_1
public void add(FormLine line) { formLines.add(line); line.bind(this, all, binder); renderNeeded(); }
766240_2
public PropertyGroup allValid() { return all; }
766240_3
public void focusFirstLine() { if (formLines.size() > 0) { formLines.get(0).focus(); } }
766240_4
public void add(FormLine line) { formLines.add(line); line.bind(this, all, binder); renderNeeded(); }
766240_5
public void add(FormLine line) { formLines.add(line); line.bind(this, all, binder); renderNeeded(); }
766240_6
public void add(FormLine line) { formLines.add(line); line.bind(this, all, binder); renderNeeded(); }
766240_7
public void fireAttached() { attached = true; AttachEvent.fire(this, true); }
766240_8
public static String humanize(final String camelCased) { String name = ""; for (final Iterator<String> i = split(camelCased).iterator(); i.hasNext();) { String part = capitalize(i.next().toLowerCase()); if (!part.isEmpty()) { name += part; if (i.hasNext()) { name += " "; } } } return name; }
766240_9
public static String camelize(final String humanCased) { String name = ""; for (final Iterator<String> i = split(humanCased).iterator(); i.hasNext();) { name += capitalize(i.next().toLowerCase()); } return uncapitalize(name); }
766548_0
public boolean isWeekday(final Date inDate) { Calendar date = Calendar.getInstance(); date.setTime(inDate); return date.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && date.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY; }
766548_1
public boolean isWeekday(final Date inDate) { Calendar date = Calendar.getInstance(); date.setTime(inDate); return date.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && date.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY; }
766548_2
public boolean isWeekday(final Date inDate) { Calendar date = Calendar.getInstance(); date.setTime(inDate); return date.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && date.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY; }
766548_3
public boolean isWeekday(final Date inDate) { Calendar date = Calendar.getInstance(); date.setTime(inDate); return date.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && date.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY; }
766548_4
public boolean isWeekday(final Date inDate) { Calendar date = Calendar.getInstance(); date.setTime(inDate); return date.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && date.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY; }
766548_5
public boolean isWeekday(final Date inDate) { Calendar date = Calendar.getInstance(); date.setTime(inDate); return date.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && date.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY; }
766548_6
public boolean isWeekday(final Date inDate) { Calendar date = Calendar.getInstance(); date.setTime(inDate); return date.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && date.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY; }
766548_7
public int getWeekdayCountBetweenDates(final Date startDate, final Date endDate) { Calendar cal; Date start, end; long startMs, endMs; // normalize start date start = DateDayExtractor.getStartOfDay(startDate); // get and normalize the day before the end date cal = Calendar.getInstance(); cal.setTime(endDate); cal.add(Calendar.DATE, -1); end = DateDayExtractor.getStartOfDay(cal.getTime()); startMs = start.getTime(); endMs = end.getTime(); int weekdayCount = 0; while (startMs <= endMs) { cal.setTimeInMillis(startMs); if (cal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && cal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) { weekdayCount++; } startMs += MS_IN_DAY; } return weekdayCount; }
766548_8
public int getWeekdayCountBetweenDates(final Date startDate, final Date endDate) { Calendar cal; Date start, end; long startMs, endMs; // normalize start date start = DateDayExtractor.getStartOfDay(startDate); // get and normalize the day before the end date cal = Calendar.getInstance(); cal.setTime(endDate); cal.add(Calendar.DATE, -1); end = DateDayExtractor.getStartOfDay(cal.getTime()); startMs = start.getTime(); endMs = end.getTime(); int weekdayCount = 0; while (startMs <= endMs) { cal.setTimeInMillis(startMs); if (cal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && cal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) { weekdayCount++; } startMs += MS_IN_DAY; } return weekdayCount; }
766548_9
public int getWeekdayCountBetweenDates(final Date startDate, final Date endDate) { Calendar cal; Date start, end; long startMs, endMs; // normalize start date start = DateDayExtractor.getStartOfDay(startDate); // get and normalize the day before the end date cal = Calendar.getInstance(); cal.setTime(endDate); cal.add(Calendar.DATE, -1); end = DateDayExtractor.getStartOfDay(cal.getTime()); startMs = start.getTime(); endMs = end.getTime(); int weekdayCount = 0; while (startMs <= endMs) { cal.setTimeInMillis(startMs); if (cal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && cal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) { weekdayCount++; } startMs += MS_IN_DAY; } return weekdayCount; }
771158_0
@Override public int compare(Statement first, Statement second) { // Cannot use Statement.equals as it does not take Context into account, // but can check for reference equality (==) if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { // Context is the only part of a statement that should legitimately be null if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }
771158_1
@Override public int compare(Statement first, Statement second) { // Cannot use Statement.equals as it does not take Context into account, // but can check for reference equality (==) if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { // Context is the only part of a statement that should legitimately be null if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }
771158_2
@Override public int compare(Statement first, Statement second) { // Cannot use Statement.equals as it does not take Context into account, // but can check for reference equality (==) if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { // Context is the only part of a statement that should legitimately be null if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }
771158_3
@Override public int compare(Statement first, Statement second) { // Cannot use Statement.equals as it does not take Context into account, // but can check for reference equality (==) if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { // Context is the only part of a statement that should legitimately be null if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }
771158_4
@Override public int compare(Statement first, Statement second) { // Cannot use Statement.equals as it does not take Context into account, // but can check for reference equality (==) if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { // Context is the only part of a statement that should legitimately be null if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }
771158_5
@Override public int compare(Statement first, Statement second) { // Cannot use Statement.equals as it does not take Context into account, // but can check for reference equality (==) if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { // Context is the only part of a statement that should legitimately be null if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }
771158_6
@Override public int compare(Statement first, Statement second) { // Cannot use Statement.equals as it does not take Context into account, // but can check for reference equality (==) if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { // Context is the only part of a statement that should legitimately be null if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }
771158_7
@Override public int compare(Statement first, Statement second) { // Cannot use Statement.equals as it does not take Context into account, // but can check for reference equality (==) if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { // Context is the only part of a statement that should legitimately be null if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }
771158_8
@Override public int compare(Statement first, Statement second) { // Cannot use Statement.equals as it does not take Context into account, // but can check for reference equality (==) if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { // Context is the only part of a statement that should legitimately be null if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }
771158_9
@Override public int compare(Statement first, Statement second) { // Cannot use Statement.equals as it does not take Context into account, // but can check for reference equality (==) if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { // Context is the only part of a statement that should legitimately be null if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }
774619_0
@SuppressWarnings("unchecked") public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { GeneralEnvelope requestedEnvelope = null; Rectangle dim = null; OverviewPolicy overviewPolicy=null; if (params != null) { // ///////////////////////////////////////////////////////////////////// // // Checking params // // ///////////////////////////////////////////////////////////////////// if (params != null) { for (int i = 0; i < params.length; i++) { final ParameterValue param = (ParameterValue) params[i]; if (param == null){ continue; } final String name = param.getDescriptor().getName().getCode(); if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString())) { final GridGeometry2D gg = (GridGeometry2D) param.getValue(); requestedEnvelope = new GeneralEnvelope((Envelope)gg.getEnvelope2D()); dim = gg.getGridRange2D().getBounds(); continue; } if (name.equals(AbstractGridFormat.OVERVIEW_POLICY.getName().toString())) { overviewPolicy = (OverviewPolicy) param.getValue(); continue; } } } } // ///////////////////////////////////////////////////////////////////// // // Loading tiles // // ///////////////////////////////////////////////////////////////////// return loadTiles(requestedEnvelope, dim, params, overviewPolicy); }
774619_1
@SuppressWarnings("unchecked") public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { GeneralEnvelope requestedEnvelope = null; Rectangle dim = null; OverviewPolicy overviewPolicy=null; if (params != null) { // ///////////////////////////////////////////////////////////////////// // // Checking params // // ///////////////////////////////////////////////////////////////////// if (params != null) { for (int i = 0; i < params.length; i++) { final ParameterValue param = (ParameterValue) params[i]; if (param == null){ continue; } final String name = param.getDescriptor().getName().getCode(); if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString())) { final GridGeometry2D gg = (GridGeometry2D) param.getValue(); requestedEnvelope = new GeneralEnvelope((Envelope)gg.getEnvelope2D()); dim = gg.getGridRange2D().getBounds(); continue; } if (name.equals(AbstractGridFormat.OVERVIEW_POLICY.getName().toString())) { overviewPolicy = (OverviewPolicy) param.getValue(); continue; } } } } // ///////////////////////////////////////////////////////////////////// // // Loading tiles // // ///////////////////////////////////////////////////////////////////// return loadTiles(requestedEnvelope, dim, params, overviewPolicy); }
774619_2
@SuppressWarnings("unchecked") public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { GeneralEnvelope requestedEnvelope = null; Rectangle dim = null; OverviewPolicy overviewPolicy=null; if (params != null) { // ///////////////////////////////////////////////////////////////////// // // Checking params // // ///////////////////////////////////////////////////////////////////// if (params != null) { for (int i = 0; i < params.length; i++) { final ParameterValue param = (ParameterValue) params[i]; if (param == null){ continue; } final String name = param.getDescriptor().getName().getCode(); if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString())) { final GridGeometry2D gg = (GridGeometry2D) param.getValue(); requestedEnvelope = new GeneralEnvelope((Envelope)gg.getEnvelope2D()); dim = gg.getGridRange2D().getBounds(); continue; } if (name.equals(AbstractGridFormat.OVERVIEW_POLICY.getName().toString())) { overviewPolicy = (OverviewPolicy) param.getValue(); continue; } } } } // ///////////////////////////////////////////////////////////////////// // // Loading tiles // // ///////////////////////////////////////////////////////////////////// return loadTiles(requestedEnvelope, dim, params, overviewPolicy); }
774619_3
@SuppressWarnings("unchecked") public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { GeneralEnvelope requestedEnvelope = null; Rectangle dim = null; OverviewPolicy overviewPolicy=null; if (params != null) { // ///////////////////////////////////////////////////////////////////// // // Checking params // // ///////////////////////////////////////////////////////////////////// if (params != null) { for (int i = 0; i < params.length; i++) { final ParameterValue param = (ParameterValue) params[i]; if (param == null){ continue; } final String name = param.getDescriptor().getName().getCode(); if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString())) { final GridGeometry2D gg = (GridGeometry2D) param.getValue(); requestedEnvelope = new GeneralEnvelope((Envelope)gg.getEnvelope2D()); dim = gg.getGridRange2D().getBounds(); continue; } if (name.equals(AbstractGridFormat.OVERVIEW_POLICY.getName().toString())) { overviewPolicy = (OverviewPolicy) param.getValue(); continue; } } } } // ///////////////////////////////////////////////////////////////////// // // Loading tiles // // ///////////////////////////////////////////////////////////////////// return loadTiles(requestedEnvelope, dim, params, overviewPolicy); }
774619_4
@SuppressWarnings("unchecked") public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { GeneralEnvelope requestedEnvelope = null; Rectangle dim = null; OverviewPolicy overviewPolicy=null; if (params != null) { // ///////////////////////////////////////////////////////////////////// // // Checking params // // ///////////////////////////////////////////////////////////////////// if (params != null) { for (int i = 0; i < params.length; i++) { final ParameterValue param = (ParameterValue) params[i]; if (param == null){ continue; } final String name = param.getDescriptor().getName().getCode(); if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString())) { final GridGeometry2D gg = (GridGeometry2D) param.getValue(); requestedEnvelope = new GeneralEnvelope((Envelope)gg.getEnvelope2D()); dim = gg.getGridRange2D().getBounds(); continue; } if (name.equals(AbstractGridFormat.OVERVIEW_POLICY.getName().toString())) { overviewPolicy = (OverviewPolicy) param.getValue(); continue; } } } } // ///////////////////////////////////////////////////////////////////// // // Loading tiles // // ///////////////////////////////////////////////////////////////////// return loadTiles(requestedEnvelope, dim, params, overviewPolicy); }
774619_5
@SuppressWarnings("unchecked") public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { GeneralEnvelope requestedEnvelope = null; Rectangle dim = null; OverviewPolicy overviewPolicy=null; if (params != null) { // ///////////////////////////////////////////////////////////////////// // // Checking params // // ///////////////////////////////////////////////////////////////////// if (params != null) { for (int i = 0; i < params.length; i++) { final ParameterValue param = (ParameterValue) params[i]; if (param == null){ continue; } final String name = param.getDescriptor().getName().getCode(); if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString())) { final GridGeometry2D gg = (GridGeometry2D) param.getValue(); requestedEnvelope = new GeneralEnvelope((Envelope)gg.getEnvelope2D()); dim = gg.getGridRange2D().getBounds(); continue; } if (name.equals(AbstractGridFormat.OVERVIEW_POLICY.getName().toString())) { overviewPolicy = (OverviewPolicy) param.getValue(); continue; } } } } // ///////////////////////////////////////////////////////////////////// // // Loading tiles // // ///////////////////////////////////////////////////////////////////// return loadTiles(requestedEnvelope, dim, params, overviewPolicy); }
774619_6
@SuppressWarnings("unchecked") public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { GeneralEnvelope requestedEnvelope = null; Rectangle dim = null; OverviewPolicy overviewPolicy=null; if (params != null) { // ///////////////////////////////////////////////////////////////////// // // Checking params // // ///////////////////////////////////////////////////////////////////// if (params != null) { for (int i = 0; i < params.length; i++) { final ParameterValue param = (ParameterValue) params[i]; if (param == null){ continue; } final String name = param.getDescriptor().getName().getCode(); if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString())) { final GridGeometry2D gg = (GridGeometry2D) param.getValue(); requestedEnvelope = new GeneralEnvelope((Envelope)gg.getEnvelope2D()); dim = gg.getGridRange2D().getBounds(); continue; } if (name.equals(AbstractGridFormat.OVERVIEW_POLICY.getName().toString())) { overviewPolicy = (OverviewPolicy) param.getValue(); continue; } } } } // ///////////////////////////////////////////////////////////////////// // // Loading tiles // // ///////////////////////////////////////////////////////////////////// return loadTiles(requestedEnvelope, dim, params, overviewPolicy); }
774619_7
@SuppressWarnings("unchecked") public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { GeneralEnvelope requestedEnvelope = null; Rectangle dim = null; OverviewPolicy overviewPolicy=null; if (params != null) { // ///////////////////////////////////////////////////////////////////// // // Checking params // // ///////////////////////////////////////////////////////////////////// if (params != null) { for (int i = 0; i < params.length; i++) { final ParameterValue param = (ParameterValue) params[i]; if (param == null){ continue; } final String name = param.getDescriptor().getName().getCode(); if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString())) { final GridGeometry2D gg = (GridGeometry2D) param.getValue(); requestedEnvelope = new GeneralEnvelope((Envelope)gg.getEnvelope2D()); dim = gg.getGridRange2D().getBounds(); continue; } if (name.equals(AbstractGridFormat.OVERVIEW_POLICY.getName().toString())) { overviewPolicy = (OverviewPolicy) param.getValue(); continue; } } } } // ///////////////////////////////////////////////////////////////////// // // Loading tiles // // ///////////////////////////////////////////////////////////////////// return loadTiles(requestedEnvelope, dim, params, overviewPolicy); }
774619_8
@SuppressWarnings("unchecked") public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { GeneralEnvelope requestedEnvelope = null; Rectangle dim = null; OverviewPolicy overviewPolicy=null; if (params != null) { // ///////////////////////////////////////////////////////////////////// // // Checking params // // ///////////////////////////////////////////////////////////////////// if (params != null) { for (int i = 0; i < params.length; i++) { final ParameterValue param = (ParameterValue) params[i]; if (param == null){ continue; } final String name = param.getDescriptor().getName().getCode(); if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString())) { final GridGeometry2D gg = (GridGeometry2D) param.getValue(); requestedEnvelope = new GeneralEnvelope((Envelope)gg.getEnvelope2D()); dim = gg.getGridRange2D().getBounds(); continue; } if (name.equals(AbstractGridFormat.OVERVIEW_POLICY.getName().toString())) { overviewPolicy = (OverviewPolicy) param.getValue(); continue; } } } } // ///////////////////////////////////////////////////////////////////// // // Loading tiles // // ///////////////////////////////////////////////////////////////////// return loadTiles(requestedEnvelope, dim, params, overviewPolicy); }
774619_9
@SuppressWarnings("unchecked") public GridCoverage2D read(GeneralParameterValue[] params) throws IOException { GeneralEnvelope requestedEnvelope = null; Rectangle dim = null; OverviewPolicy overviewPolicy=null; if (params != null) { // ///////////////////////////////////////////////////////////////////// // // Checking params // // ///////////////////////////////////////////////////////////////////// if (params != null) { for (int i = 0; i < params.length; i++) { final ParameterValue param = (ParameterValue) params[i]; if (param == null){ continue; } final String name = param.getDescriptor().getName().getCode(); if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString())) { final GridGeometry2D gg = (GridGeometry2D) param.getValue(); requestedEnvelope = new GeneralEnvelope((Envelope)gg.getEnvelope2D()); dim = gg.getGridRange2D().getBounds(); continue; } if (name.equals(AbstractGridFormat.OVERVIEW_POLICY.getName().toString())) { overviewPolicy = (OverviewPolicy) param.getValue(); continue; } } } } // ///////////////////////////////////////////////////////////////////// // // Loading tiles // // ///////////////////////////////////////////////////////////////////// return loadTiles(requestedEnvelope, dim, params, overviewPolicy); }