code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public static Function<EREEventMention, TYPE> typeFunction() {
return new Function<EREEventMention, TYPE>() {
@Override
public TYPE apply(final EREEventMention input) {
return input.getType();
}
};
} | java |
public static Object displayURLonStandardBrowser(final Component parentComponent,
final String url)
{
Object obj = null;
try
{
if (System.getProperty(SYSTEM_PROPERTY_OS_NAME).startsWith(OS.MAC.getOs()))
{
obj = openURLinMacOS(url);
}
else if (System.getProperty(SYSTEM_PROPERTY_OS_NAME).startsWi... | java |
private static Object openURLinMacOS(final String url) throws ClassNotFoundException,
NoSuchMethodException, IllegalAccessException, InvocationTargetException
{
final Class<?> fileManagerClass = Class.forName(MAC_FILE_MANAGER);
final Method openURL = fileManagerClass.getDeclaredMethod("openURL",
new Class[] {... | java |
private static Boolean openURLinUnixOS(final String url)
throws InterruptedException, IOException, Exception
{
Boolean executed = false;
for (final Browsers browser : Browsers.values())
{
if (!executed)
{
executed = Runtime.getRuntime()
.exec(new String[] { UNIX_COMMAND_WHICH, browser.getBrowser... | java |
private static Process openURLinWindowsOS(final String url) throws IOException
{
String cmd = null;
cmd = WINDOWS_PATH + " " + WINDOWS_FLAG + " ";
return Runtime.getRuntime().exec(cmd + url);
} | java |
protected void onInitializeGroupLayout()
{
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup().addContainerGap()
.addCompon... | java |
public static void displayVersionInfo(String command) {
String version = ProxyInitStrategy.class.getPackage()
.getImplementationVersion();
if (version == null) {
version = "N/A";
}
System.out.format("%s v. %s (%s)\n", command, version,
getAPIVersionString());
} | java |
@Pure
public static boolean intersectsOrientedBoxCapsule(
double centerx,double centery,double centerz,
double axis1x, double axis1y, double axis1z,
double axis2x, double axis2y, double axis2z,
double axis3x, double axis3y, double axis3z,
double extentAxis1, double extentAxis2, double extentAxis3,
... | java |
public void setFromPointCloud(Iterable<? extends Point3D> pointCloud) {
Vector3f r = new Vector3f();
Vector3f s = new Vector3f();
Vector3f t = new Vector3f();
Point3f c = new Point3f();
double[] extents = new double[3];
computeOBBCenterAxisExtents(
pointCloud,
r, s, t,
c,
extents);
set(c.g... | java |
public void rotate(Quaternion rotation) {
Transform3D m = new Transform3D();
m.transform(this.getFirstAxis());
m.transform(this.getSecondAxis());
m.transform(this.getThirdAxis());
this.setFirstAxisExtent(this.getFirstAxis().length());
this.setSecondAxisExtent(this.getSecondAxis().length());
this.setThirdA... | java |
public void rotate(Quaternion rotation, Point3D pivot) {
if (pivot!=null) {
// Change the center
Transform3D m1 = new Transform3D();
m1.setTranslation(-pivot.getX(), -pivot.getY(), -pivot.getZ());
Transform3D m2 = new Transform3D();
m2.setRotation(rotation);
Transform3D m3 = new Transform3D();
m3... | java |
protected void definePath(ZoomableGraphicsContext gc, T element) {
gc.beginPath();
final PathIterator2afp<PathElement2d> pathIterator = element.toPath2D().getPathIterator();
switch (pathIterator.getWindingRule()) {
case EVEN_ODD:
gc.setFillRule(FillRule.EVEN_ODD);
break;
case NON_ZERO:
gc.setFillRule... | java |
@Pure
public static String getFirstFreeBusStopName(BusNetwork busNetwork) {
if (busNetwork == null) {
return null;
}
int nb = busNetwork.getBusStopCount();
String name;
do {
++nb;
name = Locale.getString("NAME_TEMPLATE", Integer.toString(nb)); //$NON-NLS-1$
}
while (busNetwork.getBusStop(name) !... | java |
private void notifyDependencies() {
if (getContainer() != null) {
for (final BusHub hub : busHubs()) {
hub.checkPrimitiveValidity();
}
for (final BusItineraryHalt halt : getBindedBusHalts()) {
halt.checkPrimitiveValidity();
}
}
} | java |
public void setPosition(GeoLocationPoint position) {
if ((this.position == null && position != null)
|| (this.position != null && !this.position.equals(position))) {
this.position = position;
fireShapeChanged();
checkPrimitiveValidity();
}
} | java |
@Pure
public double distance(double x, double y) {
if (isValidPrimitive()) {
final GeoLocationPoint p = getGeoPosition();
return Point2D.getDistancePointPoint(p.getX(), p.getY(), x, y);
}
return Double.NaN;
} | java |
@Pure
public double distance(BusStop stop) {
if (isValidPrimitive() && stop.isValidPrimitive()) {
final GeoLocationPoint p = getGeoPosition();
final GeoLocationPoint p2 = stop.getGeoPosition();
return Point2D.getDistancePointPoint(p.getX(), p.getY(), p2.getX(), p2.getY());
}
return Double.NaN;
} | java |
void addBusHub(BusHub hub) {
if (this.hubs == null) {
this.hubs = new WeakArrayList<>();
}
this.hubs.add(hub);
} | java |
void removeBusHub(BusHub hub) {
if (this.hubs != null) {
this.hubs.remove(hub);
if (this.hubs.isEmpty()) {
this.hubs = null;
}
}
} | java |
void addBusHalt(BusItineraryHalt halt) {
if (this.halts == null) {
this.halts = new WeakArrayList<>();
}
this.halts.add(halt);
} | java |
void removeBusHalt(BusItineraryHalt halt) {
if (this.halts != null) {
this.halts.remove(halt);
if (this.halts.isEmpty()) {
this.halts = null;
}
}
} | java |
@Pure
public Iterable<BusItineraryHalt> getBindedBusHalts() {
if (this.halts == null) {
return Collections.emptyList();
}
return Collections.unmodifiableCollection(this.halts);
} | java |
public static Vector2ifx convert(Tuple2D<?> tuple) {
if (tuple instanceof Vector2ifx) {
return (Vector2ifx) tuple;
}
return new Vector2ifx(tuple.getX(), tuple.getY());
} | java |
@Pure
public static int compareAttrs(Attribute arg0, Attribute arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return 1;
}
if (arg1 == null) {
return -1;
}
final String n0 = arg0.getName();
final String n1 = arg1.getName();
final int cmp = compareAttrNames(n0, n1);
if (cmp ==... | java |
@Pure
public static int compareAttrNames(String arg0, String arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return Integer.MAX_VALUE;
}
if (arg1 == null) {
return Integer.MIN_VALUE;
}
return arg0.compareToIgnoreCase(arg1);
} | java |
@Pure
public boolean isTemporaryChange() {
final Object src = getSource();
if (src instanceof MapLayer) {
return ((MapLayer) src).isTemporaryLayer();
}
return false;
} | java |
@Pure
protected final Graph<ST, PT> getParentGraph() {
return this.parentGraph == null ? null : this.parentGraph.get();
} | java |
public final void build(GraphIterator<ST, PT> iterator, SubGraphBuildListener<ST, PT> listener) {
assert iterator != null;
final Set<ComparableWeakReference<PT>> reachedPoints = new TreeSet<>();
GraphIterationElement<ST, PT> element;
ST segment;
PT point;
PT firstPoint = null;
this.parentGraph = new Weak... | java |
@Pure
public List<Object> getAddedValues() {
if (this.newValues == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.newValues);
} | java |
@Pure
public List<Object> getRemovedValues() {
if (this.oldValues == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.oldValues);
} | java |
@Pure
public List<Object> getCurrentValues() {
if (this.allValues == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.allValues);
} | java |
public static <A, B> ImmutableMultiset<B> transformedCopy(Multiset<A> ms,
Function<A, B> func) {
final ImmutableMultiset.Builder<B> ret = ImmutableMultiset.builder();
for (final Multiset.Entry<A> entry : ms.entrySet()) {
final B transformedElement = func.apply(entry.getElement());
ret.addCopi... | java |
public static <A, B> Multiset<B> mutableTransformedCopy(Multiset<A> ms,
Function<A, B> func) {
final Multiset<B> ret = HashMultiset.create();
for (final Multiset.Entry<A> entry : ms.entrySet()) {
final B transformedElement = func.apply(entry.getElement());
ret.add(transformedElement, entry.ge... | java |
public static boolean allSameSize(List<Collection<?>> collections) {
if (collections.isEmpty()) {
return true;
}
final int referenceSize = collections.get(0).size();
for (final Collection<?> col : collections) {
if (col.size() != referenceSize) {
return false;
}
}
retur... | java |
public static <T> List<T> coerceNullToEmpty(List<T> list) {
return MoreObjects.firstNonNull(list, ImmutableList.<T>of());
} | java |
protected void update(DocumentEvent event)
{
String text;
try
{
text = event.getDocument().getText(event.getDocument().getStartPosition().getOffset(),
event.getDocument().getEndPosition().getOffset() - 1);
model.setObject(text);
}
catch (BadLocationException e1)
{
log.log(Level.SEVERE,
"so... | java |
@Pure
public static String makeAndroidApplicationName(String applicationName) {
final String fullName;
if (applicationName.indexOf('.') >= 0) {
fullName = applicationName;
} else {
fullName = "org.arakhne.partnership." + applicationName; //$NON-NLS-1$
}
return fullName;
} | java |
@Pure
public static ClassLoader getContextClassLoader() throws AndroidException {
synchronized (Android.class) {
final ClassLoader cl = (contextClassLoader == null) ? null : contextClassLoader.get();
if (cl != null) {
return cl;
}
}
final Object context = getContext();
try {
final Method method... | java |
public static void showExceptionDialog(Exception exception, Component parentComponent,
String... additionalMessages)
{
String title = exception.getLocalizedMessage();
StringBuilder sb = new StringBuilder();
sb.append("<html><body width='650'>");
sb.append("<h2>");
sb.append(exception.getLocalizedMessage())... | java |
@SuppressWarnings("unchecked")
public static <ObsT, SummaryT> Builder<ObsT, SummaryT> forSummarizer(
final ObservationSummarizer<? super ObsT, ? extends SummaryT> observationSummarizer,
int numSamples,
final Random rng) {
return new Builder<ObsT, SummaryT>(
(ObservationSummarizer<ObsT, S... | java |
@SuppressWarnings("static-method")
@Provides
@Singleton
public PrintConfigCommand providePrintConfigCommand(
Provider<BootLogger> bootLogger,
Provider<ModulesMetadata> modulesMetadata,
Injector injector) {
return new PrintConfigCommand(bootLogger, modulesMetadata, injector);
} | java |
protected final void fireShapeChanged() {
resetBoundingBox();
if (isEventFirable()) {
final GISElementContainer<?> container = getContainer();
if (container != null) {
container.onMapElementGraphicalAttributeChanged();
}
}
} | java |
@Pure
protected final boolean boundsIntersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) {
final Rectangle2d bounds = getBoundingBox();
assert bounds != null;
return bounds.intersects(rectangle);
} | java |
@Pure
public boolean isContainerColorUsed() {
final AttributeValue val = getAttributeCollection().getAttribute(ATTR_USE_CONTAINER_COLOR);
if (val != null) {
try {
return val.getBoolean();
} catch (AttributeException e) {
//
}
}
return false;
} | java |
@Pure
public VisualizationType getVisualizationType() {
if (this.vizualizationType == null) {
final AttributeValue val = getAttributeCollection().getAttribute(ATTR_VISUALIZATION_TYPE);
if (val != null) {
try {
this.vizualizationType = val.getJavaObject();
} catch (Exception e) {
//
}
}... | java |
public void setVisualizationType(VisualizationType type) {
try {
if (getVisualizationType() != type) {
this.vizualizationType = type;
getAttributeCollection().setAttribute(ATTR_VISUALIZATION_TYPE, new AttributeValueImpl(type));
}
} catch (AttributeException e) {
//
}
} | java |
@SuppressWarnings("static-method")
public Vector1dfx newVector(ObjectProperty<WeakReference<Segment1D<?, ?>>> segment, DoubleProperty x, DoubleProperty y) {
return new Vector1dfx(segment, x, y);
} | java |
public static final boolean isBlank(String s) {
if (s == null || s.trim().length() == 0) {
return true;
}
return false;
} | java |
public T set(T newValue) {
final T obj = this.object;
this.object = newValue;
return obj;
} | java |
@Pure
public static String getPreferredAttributeNameForRoadWidth() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_WIDTH_ATTR_NAME", DEFAULT_ATTR_ROAD_WIDTH); //$NON-NLS-1$
}
return DEFAULT_ATTR_ROAD_WIDTH;
} | java |
public static void setPreferredAttributeNameForRoadWidth(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_ROAD_WIDTH.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("ROAD_WIDTH_AT... | java |
@Pure
public static String getPreferredAttributeNameForLaneCount() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("LANE_COUNT_ATTR_NAME", DEFAULT_ATTR_LANE_COUNT); //$NON-NLS-1$
}
return DEFAULT_ATTR_LANE_COUNT;
} | java |
public static void setPreferredAttributeNameForLaneCount(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_LANE_COUNT.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("LANE_COUNT_AT... | java |
@Pure
public static int getPreferredLaneCount() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.getInt("LANE_COUNT", DEFAULT_LANE_COUNT); //$NON-NLS-1$
}
return DEFAULT_LANE_COUNT;
} | java |
public static void setPreferredLaneCount(int count) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (count < 0) {
prefs.remove("LANE_COUNT"); //$NON-NLS-1$
} else {
prefs.putInt("LANE_COUNT", count); //$NON-NLS-1$
}
}
} | java |
@Pure
public static double getPreferredLaneWidth() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.getDouble("LANE_WIDTH", DEFAULT_LANE_WIDTH); //$NON-NLS-1$
}
return DEFAULT_LANE_WIDTH;
} | java |
public static void setPreferredLaneWidth(double width) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (width <= 0) {
prefs.remove("LANE_WIDTH"); //$NON-NLS-1$
} else {
prefs.putDouble("LANE_WIDTH", width); //$NON-NLS-1$
}
}
} | java |
@Pure
public static LegalTrafficSide getPreferredLegalTrafficSide() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
String name = null;
if (prefs != null) {
name = prefs.get("LEGAL_TRAFFIC_SIDE", null); //$NON-NLS-1$
}
if (name != null) {
LegalTrafficSide side;
... | java |
public static void setPreferredLegalTrafficSide(LegalTrafficSide side) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (side == null) {
prefs.remove("LEGAL_TRAFFIC_SIDE"); //$NON-NLS-1$
} else {
prefs.put("LEGAL_TRAFFIC_SIDE", side.name()... | java |
@Pure
public static String getPreferredAttributeNameForTrafficDirection() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("TRAFFIC_DIRECTION_ATTR_NAME", DEFAULT_ATTR_TRAFFIC_DIRECTION); //$NON-NLS-1$
}
return DEFAULT_ATTR_TRAFFIC_... | java |
public static void setPreferredAttributeNameForTrafficDirection(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_TRAFFIC_DIRECTION.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove(... | java |
@Pure
public static String getPreferredAttributeValueForTrafficDirection(TrafficDirection direction, int index) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final StringBuilder b = new StringBuilder();
b.append("TRAFFIC_DIRECTION_VALUE_"); //$NO... | java |
@Pure
public static List<String> getPreferredAttributeValuesForTrafficDirection(TrafficDirection direction) {
final List<String> array = new ArrayList<>();
int i = 0;
String value = getPreferredAttributeValueForTrafficDirection(direction, i);
while (value != null) {
array.add(value);
value = getPreferred... | java |
@Pure
public static String getSystemDefault(TrafficDirection direction, int valueIndex) {
// Values from the IGN-BDCarto standard
switch (direction) {
case DOUBLE_WAY:
switch (valueIndex) {
case 0:
return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION... | java |
@Pure
public static String getSystemDefault(RoadType type) {
switch (type) {
case OTHER:
return DEFAULT_OTHER_ROAD_TYPE;
case PRIVACY_PATH:
return DEFAULT_PRIVACY_ROAD_TYPE;
case TRACK:
return DEFAULT_TRACK_ROAD_TYPE;
case BIKEWAY:
return DEFAULT_BIKEWAY_ROAD_TYPE;
case LOCAL_ROAD:
return DE... | java |
@Pure
public static List<String> getSystemDefaults(TrafficDirection direction) {
final List<String> array = new ArrayList<>();
try {
int i = 0;
while (true) {
array.add(getSystemDefault(direction, i));
++i;
}
} catch (AssertionError e) {
throw e;
} catch (Throwable exception) {
//
}
... | java |
public static void setPreferredAttributeValueForTrafficDirection(TrafficDirection direction, int index, String value) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final StringBuilder keyName = new StringBuilder();
keyName.append("TRAFFIC_DIRECTIO... | java |
@Pure
public static double getPreferredRoadConnectionDistance() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.getDouble("ROAD_CONNECTION_DISTANCE", DEFAULT_ROAD_CONNECTION_DISTANCE); //$NON-NLS-1$
}
return DEFAULT_ROAD_CONNECTION_DI... | java |
public static void setPreferredRoadConnectionDistance(double distance) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (distance <= 0.) {
prefs.remove("ROAD_CONNECTION_DISTANCE"); //$NON-NLS-1$
} else {
prefs.putDouble("ROAD_CONNECTION_DI... | java |
@Pure
public static RoadType getPreferredRoadType() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
String name = null;
if (prefs != null) {
name = prefs.get("ROAD_TYPE", null); //$NON-NLS-1$
}
if (name != null) {
RoadType type;
try {
type = RoadType.value... | java |
public static void setPreferredRoadType(RoadType type) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (type == null) {
prefs.remove("ROAD_TYPE"); //$NON-NLS-1$
} else {
prefs.put("ROAD_TYPE", type.name()); //$NON-NLS-1$
}
}
} | java |
@Pure
public static String getPreferredAttributeNameForRoadType() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_TYPE_ATTR_NAME", DEFAULT_ATTR_ROAD_TYPE); //$NON-NLS-1$
}
return DEFAULT_ATTR_ROAD_TYPE;
} | java |
public static void setPreferredAttributeNameForRoadType(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_ROAD_TYPE.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("ROAD_TYPE_ATTR_... | java |
@Pure
public static String getPreferredAttributeValueForRoadType(RoadType type) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final String v = prefs.get("ROAD_TYPE_VALUE_" + type.name(), null); //$NON-NLS-1$
if (v != null && !"".equals(v)) { //$N... | java |
public static void setPreferredAttributeValueForRoadType(RoadType type, String value) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final String sysDef = getSystemDefault(type);
if (value == null || "".equals(value) || sysDef.equalsIgnoreCase(valu... | java |
@Pure
public static String getPreferredAttributeNameForRoadName() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_NAME_ATTR_NAME", DEFAULT_ATTR_ROAD_NAME); //$NON-NLS-1$
}
return DEFAULT_ATTR_ROAD_NAME;
} | java |
public static void setPreferredAttributeNameForRoadName(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_ROAD_NAME.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("ROAD_NAME_ATTR_... | java |
@Pure
public static String getPreferredAttributeNameForRoadNumber() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_NUMBER_ATTR_NAME", DEFAULT_ATTR_ROAD_NUMBER); //$NON-NLS-1$
}
return DEFAULT_ATTR_ROAD_NUMBER;
} | java |
public static void setPreferredAttributeNameForRoadNumber(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_ROAD_NUMBER.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("ROAD_NUMBER... | java |
@SuppressWarnings("checkstyle:magicnumber")
public void readDBFHeader() throws IOException {
if (this.finished) {
throw new EOFDBaseFileException();
}
if (this.fieldCount != -1) {
// The header was already red
return;
}
//-----------------------------------------------------------
// Bytes ... | java |
@Pure
public String getDBFFieldName(int index) {
if (this.fieldCount != -1) {
try {
final DBaseFileField field = this.fields.get(index);
if (field != null) {
return field.getName();
}
} catch (Exception exception) {
//
}
}
return null;
} | java |
@Pure
public int getDBFFieldIndex(String name) {
assert name != null;
if (this.fieldCount != -1) {
try {
int i = 0;
for (final DBaseFileField field : this.fields) {
if (field != null && name.equals(field.getName())) {
return i;
}
++i;
}
} catch (Exception exception) {
//
... | java |
@Pure
public DBaseFieldType getDBFFieldType(int index) {
if (this.fieldCount != -1) {
try {
final DBaseFileField field = this.fields.get(index);
if (field != null) {
return field.getType();
}
} catch (Exception exception) {
//
}
}
return null;
} | java |
@SuppressWarnings({"checkstyle:npathcomplexity", "checkstyle:magicnumber"})
public List<DBaseFileField> readDBFFields() throws IOException, EOFException {
if (this.fields != null) {
return this.fields;
}
if (this.finished) {
throw new EOFDBaseFileException();
}
if (this.fieldCount == -1) {
throw new... | java |
public void skip(int skipAmount) throws IOException {
if (this.recordCount == -1) {
throw new MustCallReadHeaderFunctionException();
}
if ((this.readingPosition + skipAmount) >= this.recordCount) {
throw new EOFException();
}
if (skipAmount > 0) {
this.readingPosition += skipAmount;
//this.stream.... | java |
public List<DBaseFileRecord> readRestOfDBFRecords() throws IOException {
if (this.finished) {
throw new EOFDBaseFileException();
}
if (this.recordCount == -1) {
throw new MustCallReadHeaderFunctionException();
}
final Vector<DBaseFileRecord> records = new Vector<>();
try {
while (this.readingPosit... | java |
private int readStringRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData,
int rawOffset, OutputParameter<String> value) throws IOException {
final byte[] recordData = new byte[field.getLength()];
System.arraycopy(rawData, rawOffset, recordData, 0, recordData.length);
String data;
if (... | java |
@SuppressWarnings("checkstyle:magicnumber")
private static int readDateRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData,
int rawOffset, OutputParameter<Date> value) throws IOException {
final GregorianCalendar cal = new GregorianCalendar();
final int year = ((rawData[rawOffset] & 0xFF) ... | java |
private static int readNumberRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData,
int rawOffset, OutputParameter<Double> value) throws IOException {
final String buffer = new String(rawData, rawOffset, field.getLength());
try {
final String b = buffer.trim();
if (b != null && b.length... | java |
@SuppressWarnings("checkstyle:magicnumber")
private static int readBooleanRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData,
int rawOffset, OutputParameter<Boolean> value) throws IOException {
final int byteCode = rawData[rawOffset] & 0xFF;
if (TRUE_CHARS.indexOf(byteCode) != -1) {
v... | java |
private static int read2ByteIntegerRecordValue(DBaseFileField field, int nrecord, int nfield,
byte[] rawData, int rawOffset, OutputParameter<Integer> value) throws IOException {
final short rawNumber = EndianNumbers.toLEShort(rawData[rawOffset], rawData[rawOffset + 1]);
try {
value.set(new Integer(rawNumber))... | java |
@SuppressWarnings("checkstyle:magicnumber")
private static int read4ByteIntegerRecordValue(DBaseFileField field, int nrecord, int nfield,
byte[] rawData, int rawOffset, OutputParameter<Long> value) throws IOException {
final int rawNumber = EndianNumbers.toLEInt(
rawData[rawOffset], rawData[rawOffset + 1],
... | java |
@SuppressWarnings("checkstyle:magicnumber")
private static int read8ByteDoubleRecordValue(DBaseFileField field, int nrecord, int nfield,
byte[] rawData, int rawOffset, OutputParameter<Double> value) throws IOException {
final double rawNumber = EndianNumbers.toLEDouble(
rawData[rawOffset], rawData[rawOffset +... | java |
@Pure
public boolean isColumnSelectable(DBaseFileField column) {
return column != null && (this.selectedColumns.isEmpty()
|| this.selectedColumns.contains(column));
} | java |
public static void loadDefaultEncryptionModule() {
// Be sure that the cryptographical algorithms are loaded
final Provider[] providers = Security.getProviders();
boolean found = false;
for (final Provider provider : providers) {
if (provider instanceof SunJCE) {
found = true;
break;
}
}
if (!... | java |
public static String md5(String str) {
if (str == null) {
return ""; //$NON-NLS-1$
}
final byte[] uniqueKey = str.getBytes();
byte[] hash = null;
try {
hash = MessageDigest.getInstance("MD5").digest(uniqueKey); //$NON-NLS-1$
} catch (NoSuchAlgorithmException e) {
throw new Error(Locale.getString(... | java |
public BooleanProperty isMultiPartsProperty() {
if (this.isMultipart == null) {
this.isMultipart = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.IS_MULTIPARTS, false);
this.isMultipart.bind(Bindings.createBooleanBinding(() -> {
boolean foundOne = false;
for (final PathElementType type : innerTyp... | java |
private String getWthInsiCodeOr(Map wthData) {
String insiName = getWthInsiCode(wthData);
if (insiName.equals("")) {
return getNextDefName();
} else {
return insiName;
}
} | java |
public static String getWthInsiCode(Map wthData) {
String wst_name = getValueOr(wthData, "wst_name", "");
if (wst_name.matches("(\\w{4})|(\\w{8})")) {
return wst_name;
}
String wst_id = getValueOr(wthData, "wst_id", "");
if (wst_id.matches("(\\w{4})|(\\w{8})")) {
... | java |
public static String getWthYearDuration(Map wthData) {
String yearDur = "";
ArrayList<Map> wthRecords = (ArrayList) getObjectOr(wthData, "dailyWeather", new ArrayList());
if (!wthRecords.isEmpty()) {
// Get the year of starting date and end date
String startYear = getValu... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.