code
stringlengths
73
34.1k
label
stringclasses
1 value
@Pure public boolean contains(FunctionalPoint3D point) { return containsTrianglePoint( this.getP1().getX(), this.getP1().getY(), this.getP1().getZ(), this.getP2().getX(), this.getP2().getY(), this.getP2().getZ(), this.getP3().getX(), this.getP3().getY(), this.getP3().getZ(), point.getX(), point.get...
java
@Pure public Plane3D<?> getPlane() { return toPlane( getX1(), getY1(), getZ1(), getX1(), getY1(), getZ1(), getX1(), getY1(), getZ1()); }
java
public void writeln(String text) throws IOException { this.writer.write(text); if (text != null && text.length() > 0) { this.writer.write("\n"); //$NON-NLS-1$ } }
java
public static <X, Y> Iterable<ZipPair<X, Y>> zip(final Iterable<X> iter1, final Iterable<Y> iter2) { return new ZipIterable<X, Y>(iter1, iter2); }
java
public static <A, B> B reduce(final Iterable<A> iterable, final B initial, final Function2<A, B> func) { B b = initial; for (final A item : iterable) { b = func.apply(b, item); } return b; }
java
public static <K, V> ImmutableMap<K, V> mapFromPairedKeyValueSequences( final Iterable<K> keys, final Iterable<V> values) { final ImmutableMap.Builder<K, V> builder = ImmutableMap.builder(); for (final ZipPair<K, V> pair : zip(keys, values)) { builder.put(pair.first(), pair.second()); } retu...
java
@Deprecated public static <T> boolean allTheSame(final Iterable<T> iterable) { if (Iterables.isEmpty(iterable)) { return true; } final T reference = Iterables.getFirst(iterable, null); for (final T x : iterable) { if (!x.equals(reference)) { return false; } } return...
java
public static Vector1dfx convert(Tuple1dfx<?> tuple) { if (tuple instanceof Vector1dfx) { return (Vector1dfx) tuple; } return new Vector1dfx(tuple.getSegment(), tuple.getX(), tuple.getY()); }
java
protected boolean buildGetParams(StringBuilder sb, boolean isFirst) { BuilderListener listener = mListener; if (listener != null) { return listener.onBuildGetParams(sb, isFirst); } else { return isFirst; } }
java
private ProxyType extendedProxyTypeAsProxyType(ExtendedProxyType pt) { switch (pt) { case DRAFT_RFC: return ProxyType.DRAFT_RFC; case LEGACY: return ProxyType.LEGACY; case RFC3820: return ProxyType.RFC3820; default: return null; } }
java
@Pure @SuppressWarnings("checkstyle:magicnumber") public static String encodeBase26(int number) { final StringBuilder value = new StringBuilder(); int code = number; do { final int rest = code % 26; value.insert(0, (char) ('A' + rest)); code = code / 26 - 1; } while (code >= 0); return value.toSt...
java
@Pure @SuppressWarnings("checkstyle:npathcomplexity") public static Map<Character, String> getJavaToHTMLTranslationTable() { Map<Character, String> map = null; try { LOCK.lock(); if (javaToHtmlTransTbl != null) { map = javaToHtmlTransTbl.get(); } } finally { LOCK.unlock(); } if (map != null...
java
@Pure @SuppressWarnings("checkstyle:magicnumber") public static String parseHTML(String html) { if (html == null) { return null; } final Map<String, Integer> transTbl = getHtmlToJavaTranslationTable(); assert transTbl != null; if (transTbl.isEmpty()) { return html; } final Pattern pattern = Patter...
java
@Pure public static String toHTML(String text) { if (text == null) { return null; } final Map<Character, String> transTbl = getJavaToHTMLTranslationTable(); assert transTbl != null; if (transTbl.isEmpty()) { return text; } final StringBuilder patternStr = new StringBuilder(); for (final Character...
java
public static void cutStringAsArray(String text, CutStringCritera critera, List<String> output) { cutStringAlgo(text, critera, new CutStringToArray(output)); }
java
@Pure public static char getMnemonicChar(String text) { if (text != null) { final int pos = text.indexOf('&'); if ((pos != -1) && (pos < text.length() - 1)) { return text.charAt(pos + 1); } } return '\0'; }
java
@Pure public static String removeMnemonicChar(String text) { if (text == null) { return text; } return text.replaceFirst("&", ""); //$NON-NLS-1$ //$NON-NLS-2$ }
java
@Pure @SuppressWarnings("checkstyle:npathcomplexity") public static Map<Character, String> getAccentTranslationTable() { Map<Character, String> map = null; try { LOCK.lock(); if (accentTransTbl != null) { map = accentTransTbl.get(); } } finally { LOCK.unlock(); } if (map != null) { retur...
java
@Pure public static String removeAccents(String text) { final Map<Character, String> map = getAccentTranslationTable(); if ((map == null) || (map.isEmpty())) { return text; } return removeAccents(text, map); }
java
@Pure public static String[] split(char leftSeparator, char rightSeparator, String str) { final SplitSeparatorToArrayAlgorithm algo = new SplitSeparatorToArrayAlgorithm(); splitSeparatorAlgorithm(leftSeparator, rightSeparator, str, algo); return algo.toArray(); }
java
@Pure public static <T> String join(char leftSeparator, char rightSeparator, @SuppressWarnings("unchecked") T... strs) { final StringBuilder buffer = new StringBuilder(); for (final Object s : strs) { buffer.append(leftSeparator); if (s != null) { buffer.append(s.toString()); } buffer.append(rightS...
java
@Pure public static String toUpperCaseWithoutAccent(String text, Map<Character, String> map) { final StringBuilder buffer = new StringBuilder(); for (final char c : text.toCharArray()) { final String trans = map.get(c); if (trans != null) { buffer.append(trans.toUpperCase()); } else { buffer.appen...
java
@Pure public static String formatDouble(double amount, int decimalCount) { final int dc = (decimalCount < 0) ? 0 : decimalCount; final StringBuilder str = new StringBuilder("#0"); //$NON-NLS-1$ if (dc > 0) { str.append('.'); for (int i = 0; i < dc; ++i) { str.append('0'); } } final DecimalFor...
java
public static int getLevenshteinDistance(String firstString, String secondString) { final String s0 = firstString == null ? "" : firstString; //$NON-NLS-1$ final String s1 = secondString == null ? "" : secondString; //$NON-NLS-1$ final int len0 = s0.length() + 1; final int len1 = s1.length() + 1; // the arr...
java
@Pure public static String toJavaString(String text) { final StringEscaper escaper = new StringEscaper(); return escaper.escape(text); }
java
@Pure public static String toJsonString(String text) { final StringEscaper escaper = new StringEscaper( StringEscaper.JAVA_ESCAPE_CHAR, StringEscaper.JAVA_STRING_CHAR, StringEscaper.JAVA_ESCAPE_CHAR, StringEscaper.JSON_SPECIAL_ESCAPED_CHAR); return escaper.escape(text); }
java
public static VariableDecls extend(Binder binder) { return new VariableDecls(io.bootique.BQCoreModule.extend(binder)); }
java
public VariableDecls declareVar(String bootiqueVariable) { this.extender.declareVar(bootiqueVariable, VariableNames.toEnvironmentVariableName(bootiqueVariable)); return this; }
java
protected void initializeElements() { final BusItinerary itinerary = getBusItinerary(); if (itinerary != null) { int i = 0; for (final BusItineraryHalt halt : itinerary.busHalts()) { onBusItineraryHaltAdded(halt, i, null); ++i; } } }
java
@Pure @SuppressWarnings("unchecked") protected static <VALUET> VALUET maskNull(VALUET value) { return (value == null) ? (VALUET) NULL_VALUE : value; }
java
@Pure protected static <VALUET> VALUET unmaskNull(VALUET value) { return (value == NULL_VALUE) ? null : value; }
java
@SuppressWarnings("unchecked") static <T> T[] finishToArray(T[] array, Iterator<?> it) { T[] rp = array; int i = rp.length; while (it.hasNext()) { final int cap = rp.length; if (i == cap) { int newCap = ((cap / 2) + 1) * 3; if (newCap <= cap) { // integer overflow if (cap == Integer.MAX_V...
java
protected final ReferencableValue<K, V> makeValue(K key, V value) { return makeValue(key, value, this.queue); }
java
@Pure public static String getFirstFreeBusItineraryName(BusLine busline) { if (busline == null) { return null; } int nb = busline.getBusItineraryCount(); String name; do { ++nb; name = Locale.getString("NAME_TEMPLATE", Integer.toString(nb)); //$NON-NLS-1$ } while (busline.getBusItinerary(name) !...
java
public void invert() { final boolean isEventFirable = isEventFirable(); setEventFirable(false); try { final int count = this.roadSegments.getRoadSegmentCount(); // Invert the segments this.roadSegments.invert(); // Invert the bus halts and their indexes. final int middle = this.validHalts.size() ...
java
@Pure public boolean hasBusHaltOnSegment(RoadSegment segment) { if (this.roadSegments.isEmpty() || this.validHalts.isEmpty()) { return false; } int cIdxSegment; int lIdxSegment = -1; RoadSegment cSegment; for (final BusItineraryHalt bushalt : this.validHalts) { cIdxSegment = bushalt.getRoadSegmentI...
java
@Pure public List<BusItineraryHalt> getBusHaltsOnSegment(RoadSegment segment) { if (this.roadSegments.isEmpty() || this.validHalts.isEmpty()) { return Collections.emptyList(); } int cIdxSegment; int lIdxSegment = -1; int sIdxSegment = -1; RoadSegment cSegment; final List<BusItineraryHalt> halts = ne...
java
@Pure public Map<BusItineraryHalt, Pair<Integer, Double>> getBusHaltBinding() { final Comparator<BusItineraryHalt> comp = (elt1, elt2) -> { if (elt1 == elt2) { return 0; } if (elt1 == null) { return -1; } if (elt2 == null) { return 1; } return elt1.getName().compareTo(elt2.getName())...
java
public void setBusHaltBinding(Map<BusItineraryHalt, Pair<Integer, Float>> binding) { if (binding != null) { BusItineraryHalt halt; boolean shapeChanged = false; for (final Entry<BusItineraryHalt, Pair<Integer, Float>> entry : binding.entrySet()) { halt = entry.getKey(); halt.setRoadSegmentIndex(entry...
java
@Pure public double getLength() { double length = this.roadSegments.getLength(); if (isValidPrimitive()) { BusItineraryHalt halt = this.validHalts.get(0); assert halt != null; RoadSegment sgmt = halt.getRoadSegment(); assert sgmt != null; Direction1D dir = this.roadSegments.getRoadSegmentDirectionAt...
java
@Pure public double getDistanceBetweenBusHalts(int firsthaltIndex, int lasthaltIndex) { if (firsthaltIndex < 0 || firsthaltIndex >= this.validHalts.size() - 1) { throw new ArrayIndexOutOfBoundsException(firsthaltIndex); } if (lasthaltIndex <= firsthaltIndex || lasthaltIndex >= this.validHalts.size()) { thr...
java
boolean addBusHalt(BusItineraryHalt halt, int insertToIndex) { //set index for right ordering when add to invalid list ! if (insertToIndex < 0) { halt.setInvalidListIndex(this.insertionIndex); } else { halt.setInvalidListIndex(insertToIndex); } if (halt.isValidPrimitive()) { ListUtil.addIfAbsent(thi...
java
public void removeAllBusHalts() { for (final BusItineraryHalt bushalt : this.invalidHalts) { bushalt.setContainer(null); bushalt.setRoadSegmentIndex(-1); bushalt.setPositionOnSegment(Float.NaN); bushalt.checkPrimitiveValidity(); } final BusItineraryHalt[] halts = new BusItineraryHalt[this.validHalts...
java
public boolean removeBusHalt(BusItineraryHalt bushalt) { try { int index = ListUtil.indexOf(this.validHalts, VALID_HALT_COMPARATOR, bushalt); if (index >= 0) { return removeBusHalt(index); } index = ListUtil.indexOf(this.invalidHalts, INVALID_HALT_COMPARATOR, bushalt); if (index >= 0) { index +...
java
public boolean removeBusHalt(String name) { Iterator<BusItineraryHalt> iterator = this.validHalts.iterator(); BusItineraryHalt bushalt; int i = 0; while (iterator.hasNext()) { bushalt = iterator.next(); if (name.equals(bushalt.getName())) { return removeBusHalt(i); } ++i; } iterator = this....
java
public boolean removeBusHalt(int index) { try { final BusItineraryHalt removedBushalt; if (index < this.validHalts.size()) { removedBushalt = this.validHalts.remove(index); } else { final int idx = index - this.validHalts.size(); removedBushalt = this.invalidHalts.remove(idx); } removedBush...
java
@Pure public int indexOf(BusItineraryHalt bushalt) { if (bushalt == null) { return -1; } if (bushalt.isValidPrimitive()) { return ListUtil.indexOf(this.validHalts, VALID_HALT_COMPARATOR, bushalt); } int idx = ListUtil.indexOf(this.invalidHalts, INVALID_HALT_COMPARATOR, bushalt); if (idx >= 0) { id...
java
@Pure public boolean contains(BusItineraryHalt bushalt) { if (bushalt == null) { return false; } if (bushalt.isValidPrimitive()) { return ListUtil.contains(this.validHalts, VALID_HALT_COMPARATOR, bushalt); } return ListUtil.contains(this.invalidHalts, INVALID_HALT_COMPARATOR, bushalt); }
java
@Pure public BusItineraryHalt getBusHaltAt(int index) { if (index < this.validHalts.size()) { return this.validHalts.get(index); } return this.invalidHalts.get(index - this.validHalts.size()); }
java
@Pure public BusItineraryHalt getBusHalt(UUID uuid) { if (uuid == null) { return null; } for (final BusItineraryHalt busHalt : this.validHalts) { if (uuid.equals(busHalt.getUUID())) { return busHalt; } } for (final BusItineraryHalt busHalt : this.invalidHalts) { if (uuid.equals(busHalt.getUUI...
java
@Pure public BusItineraryHalt getBusHalt(String name, Comparator<String> nameComparator) { if (name == null) { return null; } final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator; for (final BusItineraryHalt bushalt : this.validHalts) { if (cmp.comp...
java
@Pure public BusItineraryHalt[] toBusHaltArray() { final BusItineraryHalt[] tab = new BusItineraryHalt[this.validHalts.size() + this.invalidHalts.size()]; int i = 0; for (final BusItineraryHalt h : this.validHalts) { tab[i] = h; ++i; } for (final BusItineraryHalt h : this.invalidHalts) { tab[i] = h;...
java
@Pure public BusItineraryHalt[] toInvalidBusHaltArray() { final BusItineraryHalt[] tab = new BusItineraryHalt[this.invalidHalts.size()]; return this.invalidHalts.toArray(tab); }
java
@Pure public BusItineraryHalt[] toValidBusHaltArray() { final BusItineraryHalt[] tab = new BusItineraryHalt[this.validHalts.size()]; return this.validHalts.toArray(tab); }
java
@Pure public RoadSegment getNearestRoadSegment(Point2D<?, ?> point) { assert point != null; double distance = Double.MAX_VALUE; RoadSegment nearestSegment = null; final Iterator<RoadSegment> iterator = this.roadSegments.roadSegments(); RoadSegment segment; while (iterator.hasNext()) { segment = iterator...
java
public boolean addRoadSegments(RoadPath segments, boolean autoConnectHalts, boolean enableLoopAutoBuild) { if (segments == null || segments.isEmpty()) { return false; } BusItineraryHalt halt; RoadSegment sgmt; final Map<BusItineraryHalt, RoadSegment> haltMapping = new TreeMap<>( (obj1, obj2) -> Intege...
java
@SuppressWarnings("checkstyle:nestedifdepth") public boolean putHaltOnRoad(BusItineraryHalt halt, RoadSegment road) { if (contains(halt)) { final BusStop stop = halt.getBusStop(); if (stop != null) { final Point2d stopPosition = stop.getPosition2D(); if (stopPosition != null) { final int idx = ind...
java
public void removeAllRoadSegments() { for (final BusItineraryHalt halt : this.invalidHalts) { halt.setRoadSegmentIndex(-1); halt.setPositionOnSegment(Float.NaN); halt.checkPrimitiveValidity(); } final BusItineraryHalt[] halts = new BusItineraryHalt[this.validHalts.size()]; this.validHalts.toArray(halt...
java
public boolean removeRoadSegment(int segmentIndex) { if (segmentIndex >= 0 && segmentIndex < this.roadSegments.getRoadSegmentCount()) { final RoadSegment segment = this.roadSegments.getRoadSegmentAt(segmentIndex); if (segment != null) { // // Invalidate the bus halts on the segment // final Map<...
java
@Pure public Iterable<RoadSegment> roadSegments() { return new Iterable<RoadSegment>() { @Override public Iterator<RoadSegment> iterator() { return roadSegmentsIterator(); } }; }
java
@SuppressWarnings("unchecked") /** * Creates an aligner given a single function from items to equivalence classes (requires left * and right items to both be of types compatible with this function). */ public static <InT, EqClass> EquivalenceBasedProvenancedAligner<InT, InT, EqClass> forEquivalenceFunction...
java
@Pure public static String getExecutableFilename(String name) { if (OperatingSystem.WIN.isCurrentOS()) { return name + ".exe"; //$NON-NLS-1$ } return name; }
java
@Pure public static String getVMBinary() { final String javaHome = System.getProperty("java.home"); //$NON-NLS-1$ final File binDir = new File(new File(javaHome), "bin"); //$NON-NLS-1$ if (binDir.isDirectory()) { File exec = new File(binDir, getExecutableFilename("javaw")); //$NON-NLS-1$ if (exec.isFile())...
java
@SuppressWarnings("checkstyle:magicnumber") public static Process launchVMWithJar(File jarFile, String... additionalParams) throws IOException { final String javaBin = getVMBinary(); if (javaBin == null) { throw new FileNotFoundException("java"); //$NON-NLS-1$ } final long totalMemory = Runtime.getRuntime()...
java
@Pure @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"}) public static String[] getAllCommandLineParameters() { final int osize = commandLineOptions == null ? 0 : commandLineOptions.size(); final int psize = commandLineParameters == null ? 0 : commandLineParameters.length; fina...
java
public static String shiftCommandLineParameters() { String removed = null; if (commandLineParameters != null) { if (commandLineParameters.length == 0) { commandLineParameters = null; } else if (commandLineParameters.length == 1) { removed = commandLineParameters[0]; commandLineParameters = null; ...
java
@Pure public static Map<String, List<Object>> getCommandLineOptions() { if (commandLineOptions != null) { return Collections.unmodifiableSortedMap(commandLineOptions); } return Collections.emptyMap(); }
java
@Pure public static List<Object> getCommandLineOption(String name) { if (commandLineOptions != null && commandLineOptions.containsKey(name)) { final List<Object> value = commandLineOptions.get(name); return value == null ? Collections.emptyList() : value; } return Collections.emptyList(); }
java
@Pure @SuppressWarnings("static-method") public Object getFirstOptionValue(String optionLabel) { final List<Object> options = getCommandLineOption(optionLabel); if (options == null || options.isEmpty()) { return null; } return options.get(0); }
java
@Pure @SuppressWarnings("static-method") public List<Object> getOptionValues(String optionLabel) { final List<Object> options = getCommandLineOption(optionLabel); if (options == null) { return Collections.emptyList(); } return Collections.unmodifiableList(options); }
java
@Pure @SuppressWarnings("static-method") public boolean isParameterExists(int index) { final String[] params = getCommandLineParameters(); return index >= 0 && index < params.length && params[index] != null; }
java
private int firstInGroup(int groupIndex) { if (this.pointCoordinates == null) { throw new IndexOutOfBoundsException(); } final int count = getGroupCount(); if (groupIndex < 0) { throw new IndexOutOfBoundsException(groupIndex + "<0"); //$NON-NLS-1$ } if (groupIndex >= count) { throw new IndexOutOfBo...
java
private int lastInGroup(int groupIndex) { if (this.pointCoordinates == null) { throw new IndexOutOfBoundsException(); } final int count = getGroupCount(); if (groupIndex < 0) { throw new IndexOutOfBoundsException(groupIndex + "<0"); //$NON-NLS-1$ } if (groupIndex >= count) { throw new IndexOutOfBou...
java
private int groupIndexForPoint(int pointIndex) { if (this.pointCoordinates == null || pointIndex < 0 || pointIndex >= this.pointCoordinates.length) { throw new IndexOutOfBoundsException(); } if (this.partIndexes == null) { return 0; } for (int i = 0; i < this.partIndexes.length; ++i) { if (pointInd...
java
@Pure public int getPointCountInGroup(int groupIndex) { if (groupIndex == 0 && this.pointCoordinates == null) { return 0; } final int firstInGroup = firstInGroup(groupIndex); final int lastInGroup = lastInGroup(groupIndex); return (lastInGroup - firstInGroup) / 2 + 1; }
java
@Pure public int getPointIndex(int groupIndex, int position) { final int groupMemberCount = getPointCountInGroup(groupIndex); final int pos; if (position < 0) { pos = 0; } else if (position >= groupMemberCount) { pos = groupMemberCount - 1; } else { pos = position; } // Move the start/end index...
java
@Pure public int getPointIndex(int groupIndex, Point2D<?, ?> point2d) { if (!this.containsPoint(point2d, groupIndex)) { return -1; } Point2d cur = null; int pos = -1; for (int i = 0; i < getPointCountInGroup(groupIndex); ++i) { cur = getPointAt(groupIndex, i); if (cur.epsilonEquals(point2d, MapEleme...
java
@Pure public PointGroup getGroupAt(int index) { final int count = getGroupCount(); if (index < 0) { throw new IndexOutOfBoundsException(index + "<0"); //$NON-NLS-1$ } if (index >= count) { throw new IndexOutOfBoundsException(index + ">=" + count); //$NON-NLS-1$ } return new PointGroup(index); }
java
@Pure public Iterable<PointGroup> groups() { return new Iterable<PointGroup>() { @Override public Iterator<PointGroup> iterator() { return MapComposedElement.this.groupIterator(); } }; }
java
@Pure public Iterable<Point2d> points() { return new Iterable<Point2d>() { @Override public Iterator<Point2d> iterator() { return MapComposedElement.this.pointIterator(); } }; }
java
public int addPoint(double x, double y) { int pointIndex; if (this.pointCoordinates == null) { this.pointCoordinates = new double[] {x, y}; this.partIndexes = null; pointIndex = 0; } else { double[] pts = new double[this.pointCoordinates.length + 2]; System.arraycopy(this.pointCoordinates, 0, pts,...
java
public int addGroup(double x, double y) { int pointIndex; if (this.pointCoordinates == null) { this.pointCoordinates = new double[] {x, y}; this.partIndexes = null; pointIndex = 0; } else { double[] pts = new double[this.pointCoordinates.length + 2]; System.arraycopy(this.pointCoordinates, 0, pts, ...
java
public MapComposedElement invertPointsIn(int groupIndex) { if (this.pointCoordinates == null) { throw new IndexOutOfBoundsException(); } final int grpCount = getGroupCount(); if (groupIndex < 0) { throw new IndexOutOfBoundsException(groupIndex + "<0"); //$NON-NLS-1$ } if (groupIndex > grpCount) { t...
java
public MapComposedElement invert() { if (this.pointCoordinates == null) { throw new IndexOutOfBoundsException(); } double[] tmp = new double[this.pointCoordinates.length]; for (int i = 0; i < this.pointCoordinates.length; i += 2) { tmp[i] = this.pointCoordinates[this.pointCoordinates.length - 1 - (i + 1)]...
java
@Pure public Point2d getPointAt(int index) { final int count = getPointCount(); int idx = index; if (idx < 0) { idx = count + idx; } if (idx < 0) { throw new IndexOutOfBoundsException(idx + "<0"); //$NON-NLS-1$ } if (idx >= count) { throw new IndexOutOfBoundsException(idx + ">=" + count); //$NON...
java
@Pure public Point2d getPointAt(int groupIndex, int indexInGroup) { final int startIndex = firstInGroup(groupIndex); // Besure that the member's index is in the group index's range final int groupMemberCount = getPointCountInGroup(groupIndex); if (indexInGroup < 0) { throw new IndexOutOfBoundsException(ind...
java
public boolean removeGroupAt(int groupIndex) { try { final int startIndex = firstInGroup(groupIndex); final int lastIndex = lastInGroup(groupIndex); final int ptsToRemoveCount = (lastIndex - startIndex + 2) / 2; int rest = this.pointCoordinates.length / 2 - ptsToRemoveCount; if (rest > 0) { // Rem...
java
public Point2d removePointAt(int groupIndex, int indexInGroup) { final int startIndex = firstInGroup(groupIndex); final int lastIndex = lastInGroup(groupIndex); // Translate local point's coordinate into global point's coordinate final int g = indexInGroup * 2 + startIndex; // Be sure that the member's inde...
java
private boolean canonize(int index) { final int count = getPointCount(); int ix = index; if (ix < 0) { ix = count + ix; } if (ix < 0) { throw new IndexOutOfBoundsException(ix + "<0"); //$NON-NLS-1$ } if (ix >= count) { throw new IndexOutOfBoundsException(ix + ">=" + count); //$NON-NLS-1$ } ...
java
private Optional<IncludeAllPageWithOutput> addOutputInformation(IncludeAllPage pages, FileResource baseResource, Path includeAllBasePath, Locale locale) { // depth = 0 is the file that has the include-all directive if (pages.depth == 0) { return of(new IncludeAllPageWithOutput(pages, pages.files.get(0), ...
java
public Reactor getReactorByIndex(int index) { if (index < 0 || index > reactorSet.length - 1) { throw new ArrayIndexOutOfBoundsException(); } return reactorSet[index]; }
java
@SuppressWarnings("rawtypes") public static CompoundPainter getCompoundPainter(final Color matte, final Color gloss, final GlossPainter.GlossPosition position, final double angle, final Color pinstripe) { final MattePainter mp = new MattePainter(matte); final GlossPainter gp = new GlossPainter(gloss, posit...
java
@SuppressWarnings("rawtypes") public static CompoundPainter getCompoundPainter(final Color color, final GlossPainter.GlossPosition position, final double angle) { final MattePainter mp = new MattePainter(color); final GlossPainter gp = new GlossPainter(color, position); final PinstripePainter pp = new P...
java
public static MattePainter getMattePainter(final int width, final int height, final float[] fractions, final Color... colors) { final LinearGradientPaint gradientPaint = new LinearGradientPaint(0.0f, 0.0f, width, height, fractions, colors); final MattePainter mattePainter = new MattePainter(gradientPaint...
java
@Override public void set(Point3D center, double radius1) { this.cx = center.getX(); this.cy = center.getY(); this.cz = center.getZ(); this.radius = Math.abs(radius1); }
java
public ListProperty<T> elementsProperty() { if (this.elements == null) { this.elements = new SimpleListProperty<>(this, MathFXAttributeNames.ELEMENTS, new InternalObservableList<>()); } return this.elements; }
java
@SuppressWarnings("unchecked") protected static <E> Class<? extends E> extractClassFrom(Collection<? extends E> collection) { Class<? extends E> clazz = null; for (final E elt : collection) { clazz = (Class<? extends E>) ReflectionUtil.getCommonType(clazz, elt.getClass()); } return clazz == null ? (Class<E>...
java
public HelpSet getHelpSet() { HelpSet hs = null; final String filename = "simple-hs.xml"; final String path = "help/" + filename; URL hsURL; hsURL = ClassExtensions.getResource(path); try { if(hsURL != null) { hs = new HelpSet(ClassExtensions.getClassLoader(), hsURL); } else { hs = new Help...
java
protected JMenu newHelpMenu(final ActionListener listener) { // Help menu final JMenu menuHelp = new JMenu(newLabelTextHelp()); menuHelp.setMnemonic('H'); // Help JMenuItems // Help content final JMenuItem mihHelpContent = JComponentFactory.newJMenuItem(newLabelTextContent(), 'c', 'H'); menuHelp.add(...
java
protected JMenu newLookAndFeelMenu(final ActionListener listener) { final JMenu menuLookAndFeel = new JMenu("Look and Feel"); menuLookAndFeel.setMnemonic('L'); // Look and Feel JMenuItems // GTK JMenuItem jmiPlafGTK; jmiPlafGTK = new JMenuItem("GTK", 'g'); //$NON-NLS-1$ MenuExtensions.setCtrlAccelerato...
java