repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java | TimeFinder.interpolateTimeFromUpdate | private long interpolateTimeFromUpdate(TrackPositionUpdate lastTrackUpdate, CdjStatus newDeviceUpdate,
BeatGrid beatGrid) {
final int beatNumber = newDeviceUpdate.getBeatNumber();
final boolean noLongerPlaying = !newDeviceUpdate.isPlaying();
// If we h... | java | private long interpolateTimeFromUpdate(TrackPositionUpdate lastTrackUpdate, CdjStatus newDeviceUpdate,
BeatGrid beatGrid) {
final int beatNumber = newDeviceUpdate.getBeatNumber();
final boolean noLongerPlaying = !newDeviceUpdate.isPlaying();
// If we h... | [
"private",
"long",
"interpolateTimeFromUpdate",
"(",
"TrackPositionUpdate",
"lastTrackUpdate",
",",
"CdjStatus",
"newDeviceUpdate",
",",
"BeatGrid",
"beatGrid",
")",
"{",
"final",
"int",
"beatNumber",
"=",
"newDeviceUpdate",
".",
"getBeatNumber",
"(",
")",
";",
"final... | Sanity-check a new non-beat update, make sure we are still interpolating a sensible position, and correct
as needed.
@param lastTrackUpdate the most recent digested update received from a player
@param newDeviceUpdate a new status update from the player
@param beatGrid the beat grid for the track that is playing, in c... | [
"Sanity",
"-",
"check",
"a",
"new",
"non",
"-",
"beat",
"update",
"make",
"sure",
"we",
"are",
"still",
"interpolating",
"a",
"sensible",
"position",
"and",
"correct",
"as",
"needed",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java#L199-L241 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java | TimeFinder.getTimeFor | public long getTimeFor(int player) {
TrackPositionUpdate update = positions.get(player);
if (update != null) {
return interpolateTimeSinceUpdate(update, System.nanoTime());
}
return -1; // We don't know.
} | java | public long getTimeFor(int player) {
TrackPositionUpdate update = positions.get(player);
if (update != null) {
return interpolateTimeSinceUpdate(update, System.nanoTime());
}
return -1; // We don't know.
} | [
"public",
"long",
"getTimeFor",
"(",
"int",
"player",
")",
"{",
"TrackPositionUpdate",
"update",
"=",
"positions",
".",
"get",
"(",
"player",
")",
";",
"if",
"(",
"update",
"!=",
"null",
")",
"{",
"return",
"interpolateTimeSinceUpdate",
"(",
"update",
",",
... | Get the best guess we have for the current track position on the specified player.
@param player the player number whose position is desired
@return the milliseconds into the track that we believe playback has reached, or -1 if we don't know
@throws IllegalStateException if the TimeFinder is not running | [
"Get",
"the",
"best",
"guess",
"we",
"have",
"for",
"the",
"current",
"track",
"position",
"on",
"the",
"specified",
"player",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java#L252-L258 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java | TimeFinder.interpolationsDisagree | private boolean interpolationsDisagree(TrackPositionUpdate lastUpdate, TrackPositionUpdate currentUpdate) {
long now = System.nanoTime();
return Math.abs(interpolateTimeSinceUpdate(lastUpdate, now) - interpolateTimeSinceUpdate(currentUpdate, now)) >
slack.get();
} | java | private boolean interpolationsDisagree(TrackPositionUpdate lastUpdate, TrackPositionUpdate currentUpdate) {
long now = System.nanoTime();
return Math.abs(interpolateTimeSinceUpdate(lastUpdate, now) - interpolateTimeSinceUpdate(currentUpdate, now)) >
slack.get();
} | [
"private",
"boolean",
"interpolationsDisagree",
"(",
"TrackPositionUpdate",
"lastUpdate",
",",
"TrackPositionUpdate",
"currentUpdate",
")",
"{",
"long",
"now",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"return",
"Math",
".",
"abs",
"(",
"interpolateTimeSinceUpd... | Check whether we have diverged from what we would predict from the last update that was sent to a particular
track position listener.
@param lastUpdate the last update that was sent to the listener
@param currentUpdate the latest update available for the same player
@return {@code true }if the listener will have dive... | [
"Check",
"whether",
"we",
"have",
"diverged",
"from",
"what",
"we",
"would",
"predict",
"from",
"the",
"last",
"update",
"that",
"was",
"sent",
"to",
"a",
"particular",
"track",
"position",
"listener",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java#L363-L367 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java | TimeFinder.stop | @SuppressWarnings("WeakerAccess")
public synchronized void stop() {
if (isRunning()) {
BeatFinder.getInstance().removeBeatListener(beatListener);
VirtualCdj.getInstance().removeUpdateListener(updateListener);
running.set(false);
positions.clear();
... | java | @SuppressWarnings("WeakerAccess")
public synchronized void stop() {
if (isRunning()) {
BeatFinder.getInstance().removeBeatListener(beatListener);
VirtualCdj.getInstance().removeUpdateListener(updateListener);
running.set(false);
positions.clear();
... | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"isRunning",
"(",
")",
")",
"{",
"BeatFinder",
".",
"getInstance",
"(",
")",
".",
"removeBeatListener",
"(",
"beatListener",
")",
";",
... | Stop interpolating playback position for all active players. | [
"Stop",
"interpolating",
"playback",
"position",
"for",
"all",
"active",
"players",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java#L598-L608 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/DeckReference.java | DeckReference.getDeckReference | public static synchronized DeckReference getDeckReference(int player, int hotCue) {
Map<Integer, DeckReference> playerMap = instances.get(player);
if (playerMap == null) {
playerMap = new HashMap<Integer, DeckReference>();
instances.put(player, playerMap);
}
DeckR... | java | public static synchronized DeckReference getDeckReference(int player, int hotCue) {
Map<Integer, DeckReference> playerMap = instances.get(player);
if (playerMap == null) {
playerMap = new HashMap<Integer, DeckReference>();
instances.put(player, playerMap);
}
DeckR... | [
"public",
"static",
"synchronized",
"DeckReference",
"getDeckReference",
"(",
"int",
"player",
",",
"int",
"hotCue",
")",
"{",
"Map",
"<",
"Integer",
",",
"DeckReference",
">",
"playerMap",
"=",
"instances",
".",
"get",
"(",
"player",
")",
";",
"if",
"(",
... | Get a unique reference to a place where a track is currently loaded in a player.
@param player the player in which the track is loaded
@param hotCue hot cue number in which the track is loaded, or 0 if it is actively loaded on the playback deck
@return the instance that will always represent a reference to the specif... | [
"Get",
"a",
"unique",
"reference",
"to",
"a",
"place",
"where",
"a",
"track",
"is",
"currently",
"loaded",
"in",
"a",
"player",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/DeckReference.java#L50-L62 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.setDeviceName | public synchronized void setDeviceName(String name) {
if (name.getBytes().length > DEVICE_NAME_LENGTH) {
throw new IllegalArgumentException("name cannot be more than " + DEVICE_NAME_LENGTH + " bytes long");
}
Arrays.fill(announcementBytes, DEVICE_NAME_OFFSET, DEVICE_NAME_LENGTH, (byt... | java | public synchronized void setDeviceName(String name) {
if (name.getBytes().length > DEVICE_NAME_LENGTH) {
throw new IllegalArgumentException("name cannot be more than " + DEVICE_NAME_LENGTH + " bytes long");
}
Arrays.fill(announcementBytes, DEVICE_NAME_OFFSET, DEVICE_NAME_LENGTH, (byt... | [
"public",
"synchronized",
"void",
"setDeviceName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
".",
"getBytes",
"(",
")",
".",
"length",
">",
"DEVICE_NAME_LENGTH",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"name cannot be more than \"",
... | Set the name to be used in announcing our presence on the network. The name can be no longer than twenty
bytes, and should be normal ASCII, no Unicode.
@param name the device name to report in our presence announcement packets. | [
"Set",
"the",
"name",
"to",
"be",
"used",
"in",
"announcing",
"our",
"presence",
"on",
"the",
"network",
".",
"The",
"name",
"can",
"be",
"no",
"longer",
"than",
"twenty",
"bytes",
"and",
"should",
"be",
"normal",
"ASCII",
"no",
"Unicode",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L233-L239 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.setTempoMaster | private void setTempoMaster(DeviceUpdate newMaster) {
DeviceUpdate oldMaster = tempoMaster.getAndSet(newMaster);
if ((newMaster == null && oldMaster != null) ||
(newMaster != null && ((oldMaster == null) || !newMaster.getAddress().equals(oldMaster.getAddress())))) {
// This i... | java | private void setTempoMaster(DeviceUpdate newMaster) {
DeviceUpdate oldMaster = tempoMaster.getAndSet(newMaster);
if ((newMaster == null && oldMaster != null) ||
(newMaster != null && ((oldMaster == null) || !newMaster.getAddress().equals(oldMaster.getAddress())))) {
// This i... | [
"private",
"void",
"setTempoMaster",
"(",
"DeviceUpdate",
"newMaster",
")",
"{",
"DeviceUpdate",
"oldMaster",
"=",
"tempoMaster",
".",
"getAndSet",
"(",
"newMaster",
")",
";",
"if",
"(",
"(",
"newMaster",
"==",
"null",
"&&",
"oldMaster",
"!=",
"null",
")",
"... | Establish a new tempo master, and if it is a change from the existing one, report it to the listeners.
@param newMaster the packet which caused the change of masters, or {@code null} if there is now no master. | [
"Establish",
"a",
"new",
"tempo",
"master",
"and",
"if",
"it",
"is",
"a",
"change",
"from",
"the",
"existing",
"one",
"report",
"it",
"to",
"the",
"listeners",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L266-L273 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.setMasterTempo | private void setMasterTempo(double newTempo) {
double oldTempo = Double.longBitsToDouble(masterTempo.getAndSet(Double.doubleToLongBits(newTempo)));
if ((getTempoMaster() != null) && (Math.abs(newTempo - oldTempo) > getTempoEpsilon())) {
// This is a change in tempo, so report it to any regis... | java | private void setMasterTempo(double newTempo) {
double oldTempo = Double.longBitsToDouble(masterTempo.getAndSet(Double.doubleToLongBits(newTempo)));
if ((getTempoMaster() != null) && (Math.abs(newTempo - oldTempo) > getTempoEpsilon())) {
// This is a change in tempo, so report it to any regis... | [
"private",
"void",
"setMasterTempo",
"(",
"double",
"newTempo",
")",
"{",
"double",
"oldTempo",
"=",
"Double",
".",
"longBitsToDouble",
"(",
"masterTempo",
".",
"getAndSet",
"(",
"Double",
".",
"doubleToLongBits",
"(",
"newTempo",
")",
")",
")",
";",
"if",
"... | Establish a new master tempo, and if it is a change from the existing one, report it to the listeners.
@param newTempo the newly reported master tempo. | [
"Establish",
"a",
"new",
"master",
"tempo",
"and",
"if",
"it",
"is",
"a",
"change",
"from",
"the",
"existing",
"one",
"report",
"it",
"to",
"the",
"listeners",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L319-L329 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.processUpdate | private void processUpdate(DeviceUpdate update) {
updates.put(update.getAddress(), update);
// Keep track of the largest sync number we see.
if (update instanceof CdjStatus) {
int syncNumber = ((CdjStatus)update).getSyncNumber();
if (syncNumber > this.largestSyncCounter.... | java | private void processUpdate(DeviceUpdate update) {
updates.put(update.getAddress(), update);
// Keep track of the largest sync number we see.
if (update instanceof CdjStatus) {
int syncNumber = ((CdjStatus)update).getSyncNumber();
if (syncNumber > this.largestSyncCounter.... | [
"private",
"void",
"processUpdate",
"(",
"DeviceUpdate",
"update",
")",
"{",
"updates",
".",
"put",
"(",
"update",
".",
"getAddress",
"(",
")",
",",
"update",
")",
";",
"// Keep track of the largest sync number we see.",
"if",
"(",
"update",
"instanceof",
"CdjStat... | Process a device update once it has been received. Track it as the most recent update from its address,
and notify any registered listeners, including master listeners if it results in changes to tracked state,
such as the current master player and tempo. Also handles the Baroque dance of handing off the tempo master
r... | [
"Process",
"a",
"device",
"update",
"once",
"it",
"has",
"been",
"received",
".",
"Track",
"it",
"as",
"the",
"most",
"recent",
"update",
"from",
"its",
"address",
"and",
"notify",
"any",
"registered",
"listeners",
"including",
"master",
"listeners",
"if",
"... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L394-L456 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.processBeat | void processBeat(Beat beat) {
if (isRunning() && beat.isTempoMaster()) {
setMasterTempo(beat.getEffectiveTempo());
deliverBeatAnnouncement(beat);
}
} | java | void processBeat(Beat beat) {
if (isRunning() && beat.isTempoMaster()) {
setMasterTempo(beat.getEffectiveTempo());
deliverBeatAnnouncement(beat);
}
} | [
"void",
"processBeat",
"(",
"Beat",
"beat",
")",
"{",
"if",
"(",
"isRunning",
"(",
")",
"&&",
"beat",
".",
"isTempoMaster",
"(",
")",
")",
"{",
"setMasterTempo",
"(",
"beat",
".",
"getEffectiveTempo",
"(",
")",
")",
";",
"deliverBeatAnnouncement",
"(",
"... | Process a beat packet, potentially updating the master tempo and sending our listeners a master
beat notification. Does nothing if we are not active. | [
"Process",
"a",
"beat",
"packet",
"potentially",
"updating",
"the",
"master",
"tempo",
"and",
"sending",
"our",
"listeners",
"a",
"master",
"beat",
"notification",
".",
"Does",
"nothing",
"if",
"we",
"are",
"not",
"active",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L462-L467 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.findMatchingAddress | private InterfaceAddress findMatchingAddress(DeviceAnnouncement aDevice, NetworkInterface networkInterface) {
for (InterfaceAddress address : networkInterface.getInterfaceAddresses()) {
if ((address.getBroadcast() != null) &&
Util.sameNetwork(address.getNetworkPrefixLength(), aDe... | java | private InterfaceAddress findMatchingAddress(DeviceAnnouncement aDevice, NetworkInterface networkInterface) {
for (InterfaceAddress address : networkInterface.getInterfaceAddresses()) {
if ((address.getBroadcast() != null) &&
Util.sameNetwork(address.getNetworkPrefixLength(), aDe... | [
"private",
"InterfaceAddress",
"findMatchingAddress",
"(",
"DeviceAnnouncement",
"aDevice",
",",
"NetworkInterface",
"networkInterface",
")",
"{",
"for",
"(",
"InterfaceAddress",
"address",
":",
"networkInterface",
".",
"getInterfaceAddresses",
"(",
")",
")",
"{",
"if",... | Scan a network interface to find if it has an address space which matches the device we are trying to reach.
If so, return the address specification.
@param aDevice the DJ Link device we are trying to communicate with
@param networkInterface the network interface we are testing
@return the address which can be used to... | [
"Scan",
"a",
"network",
"interface",
"to",
"find",
"if",
"it",
"has",
"an",
"address",
"space",
"which",
"matches",
"the",
"device",
"we",
"are",
"trying",
"to",
"reach",
".",
"If",
"so",
"return",
"the",
"address",
"specification",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L477-L485 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.findUnreachablePlayers | public Set<DeviceAnnouncement> findUnreachablePlayers() {
ensureRunning();
Set<DeviceAnnouncement> result = new HashSet<DeviceAnnouncement>();
for (DeviceAnnouncement candidate: DeviceFinder.getInstance().getCurrentDevices()) {
if (!Util.sameNetwork(matchedAddress.getNetworkPrefixLen... | java | public Set<DeviceAnnouncement> findUnreachablePlayers() {
ensureRunning();
Set<DeviceAnnouncement> result = new HashSet<DeviceAnnouncement>();
for (DeviceAnnouncement candidate: DeviceFinder.getInstance().getCurrentDevices()) {
if (!Util.sameNetwork(matchedAddress.getNetworkPrefixLen... | [
"public",
"Set",
"<",
"DeviceAnnouncement",
">",
"findUnreachablePlayers",
"(",
")",
"{",
"ensureRunning",
"(",
")",
";",
"Set",
"<",
"DeviceAnnouncement",
">",
"result",
"=",
"new",
"HashSet",
"<",
"DeviceAnnouncement",
">",
"(",
")",
";",
"for",
"(",
"Devi... | Checks if we can see any players that are on a different network than the one we chose for the Virtual CDJ.
If so, we are not going to be able to communicate with them, and they should all be moved onto a single
network.
@return the device announcements of any players which are on unreachable networks, or hopefully an... | [
"Checks",
"if",
"we",
"can",
"see",
"any",
"players",
"that",
"are",
"on",
"a",
"different",
"network",
"than",
"the",
"one",
"we",
"chose",
"for",
"the",
"Virtual",
"CDJ",
".",
"If",
"so",
"we",
"are",
"not",
"going",
"to",
"be",
"able",
"to",
"comm... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L672-L681 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.stop | public synchronized void stop() {
if (isRunning()) {
try {
setSendingStatus(false);
} catch (Throwable t) {
logger.error("Problem stopping sending status during shutdown", t);
}
DeviceFinder.getInstance().removeIgnoredAddress(socket... | java | public synchronized void stop() {
if (isRunning()) {
try {
setSendingStatus(false);
} catch (Throwable t) {
logger.error("Problem stopping sending status during shutdown", t);
}
DeviceFinder.getInstance().removeIgnoredAddress(socket... | [
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"isRunning",
"(",
")",
")",
"{",
"try",
"{",
"setSendingStatus",
"(",
"false",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"logger",
".",
"error",
"(",
"\"Problem stopping... | Stop announcing ourselves and listening for status updates. | [
"Stop",
"announcing",
"ourselves",
"and",
"listening",
"for",
"status",
"updates",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L739-L755 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.sendAnnouncement | private void sendAnnouncement(InetAddress broadcastAddress) {
try {
DatagramPacket announcement = new DatagramPacket(announcementBytes, announcementBytes.length,
broadcastAddress, DeviceFinder.ANNOUNCEMENT_PORT);
socket.get().send(announcement);
Thread.sle... | java | private void sendAnnouncement(InetAddress broadcastAddress) {
try {
DatagramPacket announcement = new DatagramPacket(announcementBytes, announcementBytes.length,
broadcastAddress, DeviceFinder.ANNOUNCEMENT_PORT);
socket.get().send(announcement);
Thread.sle... | [
"private",
"void",
"sendAnnouncement",
"(",
"InetAddress",
"broadcastAddress",
")",
"{",
"try",
"{",
"DatagramPacket",
"announcement",
"=",
"new",
"DatagramPacket",
"(",
"announcementBytes",
",",
"announcementBytes",
".",
"length",
",",
"broadcastAddress",
",",
"Devic... | Send an announcement packet so the other devices see us as being part of the DJ Link network and send us
updates. | [
"Send",
"an",
"announcement",
"packet",
"so",
"the",
"other",
"devices",
"see",
"us",
"as",
"being",
"part",
"of",
"the",
"DJ",
"Link",
"network",
"and",
"send",
"us",
"updates",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L761-L771 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.deliverMasterChangedAnnouncement | private void deliverMasterChangedAnnouncement(final DeviceUpdate update) {
for (final MasterListener listener : getMasterListeners()) {
try {
listener.masterChanged(update);
} catch (Throwable t) {
logger.warn("Problem delivering master changed announcemen... | java | private void deliverMasterChangedAnnouncement(final DeviceUpdate update) {
for (final MasterListener listener : getMasterListeners()) {
try {
listener.masterChanged(update);
} catch (Throwable t) {
logger.warn("Problem delivering master changed announcemen... | [
"private",
"void",
"deliverMasterChangedAnnouncement",
"(",
"final",
"DeviceUpdate",
"update",
")",
"{",
"for",
"(",
"final",
"MasterListener",
"listener",
":",
"getMasterListeners",
"(",
")",
")",
"{",
"try",
"{",
"listener",
".",
"masterChanged",
"(",
"update",
... | Send a master changed announcement to all registered master listeners.
@param update the message announcing the new tempo master | [
"Send",
"a",
"master",
"changed",
"announcement",
"to",
"all",
"registered",
"master",
"listeners",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L909-L917 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.deliverTempoChangedAnnouncement | private void deliverTempoChangedAnnouncement(final double tempo) {
for (final MasterListener listener : getMasterListeners()) {
try {
listener.tempoChanged(tempo);
} catch (Throwable t) {
logger.warn("Problem delivering tempo changed announcement to listen... | java | private void deliverTempoChangedAnnouncement(final double tempo) {
for (final MasterListener listener : getMasterListeners()) {
try {
listener.tempoChanged(tempo);
} catch (Throwable t) {
logger.warn("Problem delivering tempo changed announcement to listen... | [
"private",
"void",
"deliverTempoChangedAnnouncement",
"(",
"final",
"double",
"tempo",
")",
"{",
"for",
"(",
"final",
"MasterListener",
"listener",
":",
"getMasterListeners",
"(",
")",
")",
"{",
"try",
"{",
"listener",
".",
"tempoChanged",
"(",
"tempo",
")",
"... | Send a tempo changed announcement to all registered master listeners.
@param tempo the new master tempo | [
"Send",
"a",
"tempo",
"changed",
"announcement",
"to",
"all",
"registered",
"master",
"listeners",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L924-L932 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.deliverBeatAnnouncement | private void deliverBeatAnnouncement(final Beat beat) {
for (final MasterListener listener : getMasterListeners()) {
try {
listener.newBeat(beat);
} catch (Throwable t) {
logger.warn("Problem delivering master beat announcement to listener", t);
... | java | private void deliverBeatAnnouncement(final Beat beat) {
for (final MasterListener listener : getMasterListeners()) {
try {
listener.newBeat(beat);
} catch (Throwable t) {
logger.warn("Problem delivering master beat announcement to listener", t);
... | [
"private",
"void",
"deliverBeatAnnouncement",
"(",
"final",
"Beat",
"beat",
")",
"{",
"for",
"(",
"final",
"MasterListener",
"listener",
":",
"getMasterListeners",
"(",
")",
")",
"{",
"try",
"{",
"listener",
".",
"newBeat",
"(",
"beat",
")",
";",
"}",
"cat... | Send a beat announcement to all registered master listeners.
@param beat the beat sent by the tempo master | [
"Send",
"a",
"beat",
"announcement",
"to",
"all",
"registered",
"master",
"listeners",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L939-L947 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.deliverDeviceUpdate | private void deliverDeviceUpdate(final DeviceUpdate update) {
for (DeviceUpdateListener listener : getUpdateListeners()) {
try {
listener.received(update);
} catch (Throwable t) {
logger.warn("Problem delivering device update to listener", t);
... | java | private void deliverDeviceUpdate(final DeviceUpdate update) {
for (DeviceUpdateListener listener : getUpdateListeners()) {
try {
listener.received(update);
} catch (Throwable t) {
logger.warn("Problem delivering device update to listener", t);
... | [
"private",
"void",
"deliverDeviceUpdate",
"(",
"final",
"DeviceUpdate",
"update",
")",
"{",
"for",
"(",
"DeviceUpdateListener",
"listener",
":",
"getUpdateListeners",
"(",
")",
")",
"{",
"try",
"{",
"listener",
".",
"received",
"(",
"update",
")",
";",
"}",
... | Send a device update to all registered update listeners.
@param update the device update that has just arrived | [
"Send",
"a",
"device",
"update",
"to",
"all",
"registered",
"update",
"listeners",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1006-L1014 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.deliverMediaDetailsUpdate | private void deliverMediaDetailsUpdate(final MediaDetails details) {
for (MediaDetailsListener listener : getMediaDetailsListeners()) {
try {
listener.detailsAvailable(details);
} catch (Throwable t) {
logger.warn("Problem delivering media details response... | java | private void deliverMediaDetailsUpdate(final MediaDetails details) {
for (MediaDetailsListener listener : getMediaDetailsListeners()) {
try {
listener.detailsAvailable(details);
} catch (Throwable t) {
logger.warn("Problem delivering media details response... | [
"private",
"void",
"deliverMediaDetailsUpdate",
"(",
"final",
"MediaDetails",
"details",
")",
"{",
"for",
"(",
"MediaDetailsListener",
"listener",
":",
"getMediaDetailsListeners",
"(",
")",
")",
"{",
"try",
"{",
"listener",
".",
"detailsAvailable",
"(",
"details",
... | Send a media details response to all registered listeners.
@param details the response that has just arrived | [
"Send",
"a",
"media",
"details",
"response",
"to",
"all",
"registered",
"listeners",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1072-L1080 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.assembleAndSendPacket | @SuppressWarnings("SameParameterValue")
private void assembleAndSendPacket(Util.PacketType kind, byte[] payload, InetAddress destination, int port) throws IOException {
DatagramPacket packet = Util.buildPacket(kind,
ByteBuffer.wrap(announcementBytes, DEVICE_NAME_OFFSET, DEVICE_NAME_LENGTH).a... | java | @SuppressWarnings("SameParameterValue")
private void assembleAndSendPacket(Util.PacketType kind, byte[] payload, InetAddress destination, int port) throws IOException {
DatagramPacket packet = Util.buildPacket(kind,
ByteBuffer.wrap(announcementBytes, DEVICE_NAME_OFFSET, DEVICE_NAME_LENGTH).a... | [
"@",
"SuppressWarnings",
"(",
"\"SameParameterValue\"",
")",
"private",
"void",
"assembleAndSendPacket",
"(",
"Util",
".",
"PacketType",
"kind",
",",
"byte",
"[",
"]",
"payload",
",",
"InetAddress",
"destination",
",",
"int",
"port",
")",
"throws",
"IOException",
... | Finish the work of building and sending a protocol packet.
@param kind the type of packet to create and send
@param payload the content which will follow our device name in the packet
@param destination where the packet should be sent
@param port the port to which the packet should be sent
@throws IOException if ther... | [
"Finish",
"the",
"work",
"of",
"building",
"and",
"sending",
"a",
"protocol",
"packet",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1092-L1100 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.sendSyncControlCommand | private void sendSyncControlCommand(DeviceUpdate target, byte command) throws IOException {
ensureRunning();
byte[] payload = new byte[SYNC_CONTROL_PAYLOAD.length];
System.arraycopy(SYNC_CONTROL_PAYLOAD, 0, payload, 0, SYNC_CONTROL_PAYLOAD.length);
payload[2] = getDeviceNumber();
... | java | private void sendSyncControlCommand(DeviceUpdate target, byte command) throws IOException {
ensureRunning();
byte[] payload = new byte[SYNC_CONTROL_PAYLOAD.length];
System.arraycopy(SYNC_CONTROL_PAYLOAD, 0, payload, 0, SYNC_CONTROL_PAYLOAD.length);
payload[2] = getDeviceNumber();
... | [
"private",
"void",
"sendSyncControlCommand",
"(",
"DeviceUpdate",
"target",
",",
"byte",
"command",
")",
"throws",
"IOException",
"{",
"ensureRunning",
"(",
")",
";",
"byte",
"[",
"]",
"payload",
"=",
"new",
"byte",
"[",
"SYNC_CONTROL_PAYLOAD",
".",
"length",
... | Assemble and send a packet that performs sync control, turning a device's sync mode on or off, or telling it
to become the tempo master.
@param target an update from the device whose sync state is to be set
@param command the byte identifying the specific sync command to be sent
@throws IOException if there is a prob... | [
"Assemble",
"and",
"send",
"a",
"packet",
"that",
"performs",
"sync",
"control",
"turning",
"a",
"device",
"s",
"sync",
"mode",
"on",
"or",
"off",
"or",
"telling",
"it",
"to",
"become",
"the",
"tempo",
"master",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1146-L1154 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.sendSyncModeCommand | public void sendSyncModeCommand(int deviceNumber, boolean synced) throws IOException {
final DeviceUpdate update = getLatestStatusFor(deviceNumber);
if (update == null) {
throw new IllegalArgumentException("Device " + deviceNumber + " not found on network.");
}
sendSyncModeCo... | java | public void sendSyncModeCommand(int deviceNumber, boolean synced) throws IOException {
final DeviceUpdate update = getLatestStatusFor(deviceNumber);
if (update == null) {
throw new IllegalArgumentException("Device " + deviceNumber + " not found on network.");
}
sendSyncModeCo... | [
"public",
"void",
"sendSyncModeCommand",
"(",
"int",
"deviceNumber",
",",
"boolean",
"synced",
")",
"throws",
"IOException",
"{",
"final",
"DeviceUpdate",
"update",
"=",
"getLatestStatusFor",
"(",
"deviceNumber",
")",
";",
"if",
"(",
"update",
"==",
"null",
")",... | Tell a device to turn sync on or off.
@param deviceNumber the device whose sync state is to be set
@param synced {@code} true if sync should be turned on, else it will be turned off
@throws IOException if there is a problem sending the command to the device
@throws IllegalStateException if the {@code VirtualCdj} is n... | [
"Tell",
"a",
"device",
"to",
"turn",
"sync",
"on",
"or",
"off",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1166-L1172 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.appointTempoMaster | public void appointTempoMaster(int deviceNumber) throws IOException {
final DeviceUpdate update = getLatestStatusFor(deviceNumber);
if (update == null) {
throw new IllegalArgumentException("Device " + deviceNumber + " not found on network.");
}
appointTempoMaster(update);
... | java | public void appointTempoMaster(int deviceNumber) throws IOException {
final DeviceUpdate update = getLatestStatusFor(deviceNumber);
if (update == null) {
throw new IllegalArgumentException("Device " + deviceNumber + " not found on network.");
}
appointTempoMaster(update);
... | [
"public",
"void",
"appointTempoMaster",
"(",
"int",
"deviceNumber",
")",
"throws",
"IOException",
"{",
"final",
"DeviceUpdate",
"update",
"=",
"getLatestStatusFor",
"(",
"deviceNumber",
")",
";",
"if",
"(",
"update",
"==",
"null",
")",
"{",
"throw",
"new",
"Il... | Tell a device to become tempo master.
@param deviceNumber the device we want to take over the role of tempo master
@throws IOException if there is a problem sending the command to the device
@throws IllegalStateException if the {@code VirtualCdj} is not active
@throws IllegalArgumentException if {@code deviceNumber} ... | [
"Tell",
"a",
"device",
"to",
"become",
"tempo",
"master",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1197-L1203 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.sendFaderStartCommand | public void sendFaderStartCommand(Set<Integer> deviceNumbersToStart, Set<Integer> deviceNumbersToStop) throws IOException {
ensureRunning();
byte[] payload = new byte[FADER_START_PAYLOAD.length];
System.arraycopy(FADER_START_PAYLOAD, 0, payload, 0, FADER_START_PAYLOAD.length);
payload[2]... | java | public void sendFaderStartCommand(Set<Integer> deviceNumbersToStart, Set<Integer> deviceNumbersToStop) throws IOException {
ensureRunning();
byte[] payload = new byte[FADER_START_PAYLOAD.length];
System.arraycopy(FADER_START_PAYLOAD, 0, payload, 0, FADER_START_PAYLOAD.length);
payload[2]... | [
"public",
"void",
"sendFaderStartCommand",
"(",
"Set",
"<",
"Integer",
">",
"deviceNumbersToStart",
",",
"Set",
"<",
"Integer",
">",
"deviceNumbersToStop",
")",
"throws",
"IOException",
"{",
"ensureRunning",
"(",
")",
";",
"byte",
"[",
"]",
"payload",
"=",
"ne... | Broadcast a packet that tells some players to start playing and others to stop. If a player number is in
both sets, it will be told to stop. Numbers outside the range 1 to 4 are ignored.
@param deviceNumbersToStart the players that should start playing if they aren't already
@param deviceNumbersToStop the players that... | [
"Broadcast",
"a",
"packet",
"that",
"tells",
"some",
"players",
"to",
"start",
"playing",
"and",
"others",
"to",
"stop",
".",
"If",
"a",
"player",
"number",
"is",
"in",
"both",
"sets",
"it",
"will",
"be",
"told",
"to",
"stop",
".",
"Numbers",
"outside",
... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1234-L1250 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.sendLoadTrackCommand | public void sendLoadTrackCommand(int targetPlayer, int rekordboxId,
int sourcePlayer, CdjStatus.TrackSourceSlot sourceSlot, CdjStatus.TrackType sourceType)
throws IOException {
final DeviceUpdate update = getLatestStatusFor(targetPlayer);
if (update == nu... | java | public void sendLoadTrackCommand(int targetPlayer, int rekordboxId,
int sourcePlayer, CdjStatus.TrackSourceSlot sourceSlot, CdjStatus.TrackType sourceType)
throws IOException {
final DeviceUpdate update = getLatestStatusFor(targetPlayer);
if (update == nu... | [
"public",
"void",
"sendLoadTrackCommand",
"(",
"int",
"targetPlayer",
",",
"int",
"rekordboxId",
",",
"int",
"sourcePlayer",
",",
"CdjStatus",
".",
"TrackSourceSlot",
"sourceSlot",
",",
"CdjStatus",
".",
"TrackType",
"sourceType",
")",
"throws",
"IOException",
"{",
... | Send a packet to the target player telling it to load the specified track from the specified source player.
@param targetPlayer the device number of the player that you want to have load a track
@param rekordboxId the identifier of a track within the source player's rekordbox database
@param sourcePlayer the device nu... | [
"Send",
"a",
"packet",
"to",
"the",
"target",
"player",
"telling",
"it",
"to",
"load",
"the",
"specified",
"track",
"from",
"the",
"specified",
"source",
"player",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1306-L1314 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.sendLoadTrackCommand | public void sendLoadTrackCommand(DeviceUpdate target, int rekordboxId,
int sourcePlayer, CdjStatus.TrackSourceSlot sourceSlot, CdjStatus.TrackType sourceType)
throws IOException {
ensureRunning();
byte[] payload = new byte[LOAD_TRACK_PAYLOAD.length];
... | java | public void sendLoadTrackCommand(DeviceUpdate target, int rekordboxId,
int sourcePlayer, CdjStatus.TrackSourceSlot sourceSlot, CdjStatus.TrackType sourceType)
throws IOException {
ensureRunning();
byte[] payload = new byte[LOAD_TRACK_PAYLOAD.length];
... | [
"public",
"void",
"sendLoadTrackCommand",
"(",
"DeviceUpdate",
"target",
",",
"int",
"rekordboxId",
",",
"int",
"sourcePlayer",
",",
"CdjStatus",
".",
"TrackSourceSlot",
"sourceSlot",
",",
"CdjStatus",
".",
"TrackType",
"sourceType",
")",
"throws",
"IOException",
"{... | Send a packet to the target device telling it to load the specified track from the specified source player.
@param target an update from the player that you want to have load a track
@param rekordboxId the identifier of a track within the source player's rekordbox database
@param sourcePlayer the device number of the ... | [
"Send",
"a",
"packet",
"to",
"the",
"target",
"device",
"telling",
"it",
"to",
"load",
"the",
"specified",
"track",
"from",
"the",
"specified",
"source",
"player",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1328-L1341 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.setSendingStatus | public synchronized void setSendingStatus(boolean send) throws IOException {
if (isSendingStatus() == send) {
return;
}
if (send) { // Start sending status packets.
ensureRunning();
if ((getDeviceNumber() < 1) || (getDeviceNumber() > 4)) {
th... | java | public synchronized void setSendingStatus(boolean send) throws IOException {
if (isSendingStatus() == send) {
return;
}
if (send) { // Start sending status packets.
ensureRunning();
if ((getDeviceNumber() < 1) || (getDeviceNumber() > 4)) {
th... | [
"public",
"synchronized",
"void",
"setSendingStatus",
"(",
"boolean",
"send",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isSendingStatus",
"(",
")",
"==",
"send",
")",
"{",
"return",
";",
"}",
"if",
"(",
"send",
")",
"{",
"// Start sending status packets."... | Control whether the Virtual CDJ sends status packets to the other players. Most uses of Beat Link will not
require this level of activity. However, if you want to be able to take over the tempo master role, and control
the tempo and beat alignment of other players, you will need to turn on this feature, which also requ... | [
"Control",
"whether",
"the",
"Virtual",
"CDJ",
"sends",
"status",
"packets",
"to",
"the",
"other",
"players",
".",
"Most",
"uses",
"of",
"Beat",
"Link",
"will",
"not",
"require",
"this",
"level",
"of",
"activity",
".",
"However",
"if",
"you",
"want",
"to",... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1494-L1546 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.setPlaying | public void setPlaying(boolean playing) {
if (this.playing.get() == playing) {
return;
}
this.playing.set(playing);
if (playing) {
metronome.jumpToBeat(whereStopped.get().getBeat());
if (isSendingStatus()) { // Need to also start the beat sender.
... | java | public void setPlaying(boolean playing) {
if (this.playing.get() == playing) {
return;
}
this.playing.set(playing);
if (playing) {
metronome.jumpToBeat(whereStopped.get().getBeat());
if (isSendingStatus()) { // Need to also start the beat sender.
... | [
"public",
"void",
"setPlaying",
"(",
"boolean",
"playing",
")",
"{",
"if",
"(",
"this",
".",
"playing",
".",
"get",
"(",
")",
"==",
"playing",
")",
"{",
"return",
";",
"}",
"this",
".",
"playing",
".",
"set",
"(",
"playing",
")",
";",
"if",
"(",
... | Controls whether we report that we are playing. This will only have an impact when we are sending status and
beat packets.
@param playing {@code true} if we should seem to be playing | [
"Controls",
"whether",
"we",
"report",
"that",
"we",
"are",
"playing",
".",
"This",
"will",
"only",
"have",
"an",
"impact",
"when",
"we",
"are",
"sending",
"status",
"and",
"beat",
"packets",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1582-L1603 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.becomeTempoMaster | public synchronized void becomeTempoMaster() throws IOException {
logger.debug("Trying to become master.");
if (!isSendingStatus()) {
throw new IllegalStateException("Must be sending status updates to become the tempo master.");
}
// Is there someone we need to ask to yield ... | java | public synchronized void becomeTempoMaster() throws IOException {
logger.debug("Trying to become master.");
if (!isSendingStatus()) {
throw new IllegalStateException("Must be sending status updates to become the tempo master.");
}
// Is there someone we need to ask to yield ... | [
"public",
"synchronized",
"void",
"becomeTempoMaster",
"(",
")",
"throws",
"IOException",
"{",
"logger",
".",
"debug",
"(",
"\"Trying to become master.\"",
")",
";",
"if",
"(",
"!",
"isSendingStatus",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
... | Arrange to become the tempo master. Starts a sequence of interactions with the other players that should end
up with us in charge of the group tempo and beat alignment.
@throws IllegalStateException if we are not sending status updates
@throws IOException if there is a problem sending the master yield request | [
"Arrange",
"to",
"become",
"the",
"tempo",
"master",
".",
"Starts",
"a",
"sequence",
"of",
"interactions",
"with",
"the",
"other",
"players",
"that",
"should",
"end",
"up",
"with",
"us",
"in",
"charge",
"of",
"the",
"group",
"tempo",
"and",
"beat",
"alignm... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1670-L1695 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.setSynced | public synchronized void setSynced(boolean sync) {
if (synced.get() != sync) {
// We are changing sync state, so add or remove our master listener as appropriate.
if (sync && isSendingStatus()) {
addMasterListener(ourSyncMasterListener);
} else {
... | java | public synchronized void setSynced(boolean sync) {
if (synced.get() != sync) {
// We are changing sync state, so add or remove our master listener as appropriate.
if (sync && isSendingStatus()) {
addMasterListener(ourSyncMasterListener);
} else {
... | [
"public",
"synchronized",
"void",
"setSynced",
"(",
"boolean",
"sync",
")",
"{",
"if",
"(",
"synced",
".",
"get",
"(",
")",
"!=",
"sync",
")",
"{",
"// We are changing sync state, so add or remove our master listener as appropriate.",
"if",
"(",
"sync",
"&&",
"isSen... | Controls whether we are currently staying in sync with the tempo master. Will only be meaningful if we are
sending status packets.
@param sync if {@code true}, our status packets will be tempo and beat aligned with the tempo master | [
"Controls",
"whether",
"we",
"are",
"currently",
"staying",
"in",
"sync",
"with",
"the",
"tempo",
"master",
".",
"Will",
"only",
"be",
"meaningful",
"if",
"we",
"are",
"sending",
"status",
"packets",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1742-L1757 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java | VirtualCdj.jumpToBeat | public synchronized void jumpToBeat(int beat) {
if (beat < 1) {
beat = 1;
} else {
beat = wrapBeat(beat);
}
if (playing.get()) {
metronome.jumpToBeat(beat);
} else {
whereStopped.set(metronome.getSnapshot(metronome.getTimeOfBeat(b... | java | public synchronized void jumpToBeat(int beat) {
if (beat < 1) {
beat = 1;
} else {
beat = wrapBeat(beat);
}
if (playing.get()) {
metronome.jumpToBeat(beat);
} else {
whereStopped.set(metronome.getSnapshot(metronome.getTimeOfBeat(b... | [
"public",
"synchronized",
"void",
"jumpToBeat",
"(",
"int",
"beat",
")",
"{",
"if",
"(",
"beat",
"<",
"1",
")",
"{",
"beat",
"=",
"1",
";",
"}",
"else",
"{",
"beat",
"=",
"wrapBeat",
"(",
"beat",
")",
";",
"}",
"if",
"(",
"playing",
".",
"get",
... | Moves our current playback position to the specified beat; this will be reflected in any status and beat packets
that we are sending. An incoming value less than one will jump us to the first beat.
@param beat the beat that we should pretend to be playing | [
"Moves",
"our",
"current",
"playback",
"position",
"to",
"the",
"specified",
"beat",
";",
"this",
"will",
"be",
"reflected",
"in",
"any",
"status",
"and",
"beat",
"packets",
"that",
"we",
"are",
"sending",
".",
"An",
"incoming",
"value",
"less",
"than",
"o... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1852-L1865 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.getPlaybackState | public Set<PlaybackState> getPlaybackState() {
Set<PlaybackState> result = new HashSet<PlaybackState>(playbackStateMap.values());
return Collections.unmodifiableSet(result);
} | java | public Set<PlaybackState> getPlaybackState() {
Set<PlaybackState> result = new HashSet<PlaybackState>(playbackStateMap.values());
return Collections.unmodifiableSet(result);
} | [
"public",
"Set",
"<",
"PlaybackState",
">",
"getPlaybackState",
"(",
")",
"{",
"Set",
"<",
"PlaybackState",
">",
"result",
"=",
"new",
"HashSet",
"<",
"PlaybackState",
">",
"(",
"playbackStateMap",
".",
"values",
"(",
")",
")",
";",
"return",
"Collections",
... | Look up all recorded playback state information.
@return the playback state recorded for any player
@since 0.5.0 | [
"Look",
"up",
"all",
"recorded",
"playback",
"state",
"information",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L260-L263 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.setPlaybackPosition | private void setPlaybackPosition(long milliseconds) {
PlaybackState oldState = currentSimpleState();
if (oldState != null && oldState.position != milliseconds) {
setPlaybackState(oldState.player, milliseconds, oldState.playing);
}
} | java | private void setPlaybackPosition(long milliseconds) {
PlaybackState oldState = currentSimpleState();
if (oldState != null && oldState.position != milliseconds) {
setPlaybackState(oldState.player, milliseconds, oldState.playing);
}
} | [
"private",
"void",
"setPlaybackPosition",
"(",
"long",
"milliseconds",
")",
"{",
"PlaybackState",
"oldState",
"=",
"currentSimpleState",
"(",
")",
";",
"if",
"(",
"oldState",
"!=",
"null",
"&&",
"oldState",
".",
"position",
"!=",
"milliseconds",
")",
"{",
"set... | Set the current playback position. This method can only be used in situations where the component is
tied to a single player, and therefore always has a single playback position.
Will cause part of the component to be redrawn if the position has
changed. This will be quickly overruled if a player is being monitored, b... | [
"Set",
"the",
"current",
"playback",
"position",
".",
"This",
"method",
"can",
"only",
"be",
"used",
"in",
"situations",
"where",
"the",
"component",
"is",
"tied",
"to",
"a",
"single",
"player",
"and",
"therefore",
"always",
"has",
"a",
"single",
"playback",... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L289-L294 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.setPlaying | private void setPlaying(boolean playing) {
PlaybackState oldState = currentSimpleState();
if (oldState != null && oldState.playing != playing) {
setPlaybackState(oldState.player, oldState.position, playing);
}
} | java | private void setPlaying(boolean playing) {
PlaybackState oldState = currentSimpleState();
if (oldState != null && oldState.playing != playing) {
setPlaybackState(oldState.player, oldState.position, playing);
}
} | [
"private",
"void",
"setPlaying",
"(",
"boolean",
"playing",
")",
"{",
"PlaybackState",
"oldState",
"=",
"currentSimpleState",
"(",
")",
";",
"if",
"(",
"oldState",
"!=",
"null",
"&&",
"oldState",
".",
"playing",
"!=",
"playing",
")",
"{",
"setPlaybackState",
... | Set whether the player holding the waveform is playing, which changes the indicator color to white from red.
This method can only be used in situations where the component is tied to a single player, and therefore has
a single playback position.
@param playing if {@code true}, draw the position marker in white, otherw... | [
"Set",
"whether",
"the",
"player",
"holding",
"the",
"waveform",
"is",
"playing",
"which",
"changes",
"the",
"indicator",
"color",
"to",
"white",
"from",
"red",
".",
"This",
"method",
"can",
"only",
"be",
"used",
"in",
"situations",
"where",
"the",
"componen... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L326-L331 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.setMonitoredPlayer | public synchronized void setMonitoredPlayer(final int player) {
if (player < 0) {
throw new IllegalArgumentException("player cannot be negative");
}
clearPlaybackState();
monitoredPlayer.set(player);
if (player > 0) { // Start monitoring the specified player
... | java | public synchronized void setMonitoredPlayer(final int player) {
if (player < 0) {
throw new IllegalArgumentException("player cannot be negative");
}
clearPlaybackState();
monitoredPlayer.set(player);
if (player > 0) { // Start monitoring the specified player
... | [
"public",
"synchronized",
"void",
"setMonitoredPlayer",
"(",
"final",
"int",
"player",
")",
"{",
"if",
"(",
"player",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"player cannot be negative\"",
")",
";",
"}",
"clearPlaybackState",
"(",
... | Configures the player whose current track waveforms and status will automatically be reflected. Whenever a new
track is loaded on that player, the waveform and metadata will be updated, and the current playback position and
state of the player will be reflected by the component.
@param player the player number to moni... | [
"Configures",
"the",
"player",
"whose",
"current",
"track",
"waveforms",
"and",
"status",
"will",
"automatically",
"be",
"reflected",
".",
"Whenever",
"a",
"new",
"track",
"is",
"loaded",
"on",
"that",
"player",
"the",
"waveform",
"and",
"metadata",
"will",
"b... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L387-L452 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.getFurthestPlaybackState | public PlaybackState getFurthestPlaybackState() {
PlaybackState result = null;
for (PlaybackState state : playbackStateMap.values()) {
if (result == null || (!result.playing && state.playing) ||
(result.position < state.position) && (state.playing || !result.playing)) {
... | java | public PlaybackState getFurthestPlaybackState() {
PlaybackState result = null;
for (PlaybackState state : playbackStateMap.values()) {
if (result == null || (!result.playing && state.playing) ||
(result.position < state.position) && (state.playing || !result.playing)) {
... | [
"public",
"PlaybackState",
"getFurthestPlaybackState",
"(",
")",
"{",
"PlaybackState",
"result",
"=",
"null",
";",
"for",
"(",
"PlaybackState",
"state",
":",
"playbackStateMap",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"result",
"==",
"null",
"||",
"(",... | Look up the playback state that has reached furthest in the track, but give playing players priority over stopped players.
This is used to choose the scroll center when auto-scrolling is active.
@return the playback state, if any, with the highest playing {@link PlaybackState#position} value | [
"Look",
"up",
"the",
"playback",
"state",
"that",
"has",
"reached",
"furthest",
"in",
"the",
"track",
"but",
"give",
"playing",
"players",
"priority",
"over",
"stopped",
"players",
".",
"This",
"is",
"used",
"to",
"choose",
"the",
"scroll",
"center",
"when",... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L587-L596 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.getSegmentForX | private int getSegmentForX(int x) {
if (autoScroll.get()) {
int playHead = (x - (getWidth() / 2));
int offset = Util.timeToHalfFrame(getFurthestPlaybackPosition()) / scale.get();
return (playHead + offset) * scale.get();
}
return x * scale.get();
} | java | private int getSegmentForX(int x) {
if (autoScroll.get()) {
int playHead = (x - (getWidth() / 2));
int offset = Util.timeToHalfFrame(getFurthestPlaybackPosition()) / scale.get();
return (playHead + offset) * scale.get();
}
return x * scale.get();
} | [
"private",
"int",
"getSegmentForX",
"(",
"int",
"x",
")",
"{",
"if",
"(",
"autoScroll",
".",
"get",
"(",
")",
")",
"{",
"int",
"playHead",
"=",
"(",
"x",
"-",
"(",
"getWidth",
"(",
")",
"/",
"2",
")",
")",
";",
"int",
"offset",
"=",
"Util",
"."... | Figure out the starting waveform segment that corresponds to the specified coordinate in the window.
@param x the column being drawn
@return the offset into the waveform at the current scale and playback time that should be drawn there | [
"Figure",
"out",
"the",
"starting",
"waveform",
"segment",
"that",
"corresponds",
"to",
"the",
"specified",
"coordinate",
"in",
"the",
"window",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L619-L626 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.getXForBeat | public int getXForBeat(int beat) {
BeatGrid grid = beatGrid.get();
if (grid != null) {
return millisecondsToX(grid.getTimeWithinTrack(beat));
}
return 0;
} | java | public int getXForBeat(int beat) {
BeatGrid grid = beatGrid.get();
if (grid != null) {
return millisecondsToX(grid.getTimeWithinTrack(beat));
}
return 0;
} | [
"public",
"int",
"getXForBeat",
"(",
"int",
"beat",
")",
"{",
"BeatGrid",
"grid",
"=",
"beatGrid",
".",
"get",
"(",
")",
";",
"if",
"(",
"grid",
"!=",
"null",
")",
"{",
"return",
"millisecondsToX",
"(",
"grid",
".",
"getTimeWithinTrack",
"(",
"beat",
"... | Determine the X coordinate within the component at which the specified beat begins.
@param beat the beat number whose position is desired
@return the horizontal position within the component coordinate space where that beat begins
@throws IllegalArgumentException if the beat number exceeds the number of beats in the t... | [
"Determine",
"the",
"X",
"coordinate",
"within",
"the",
"component",
"at",
"which",
"the",
"specified",
"beat",
"begins",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L661-L667 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.millisecondsToX | public int millisecondsToX(long milliseconds) {
if (autoScroll.get()) {
int playHead = (getWidth() / 2) + 2;
long offset = milliseconds - getFurthestPlaybackPosition();
return playHead + (Util.timeToHalfFrame(offset) / scale.get());
}
return Util.timeToHalfFra... | java | public int millisecondsToX(long milliseconds) {
if (autoScroll.get()) {
int playHead = (getWidth() / 2) + 2;
long offset = milliseconds - getFurthestPlaybackPosition();
return playHead + (Util.timeToHalfFrame(offset) / scale.get());
}
return Util.timeToHalfFra... | [
"public",
"int",
"millisecondsToX",
"(",
"long",
"milliseconds",
")",
"{",
"if",
"(",
"autoScroll",
".",
"get",
"(",
")",
")",
"{",
"int",
"playHead",
"=",
"(",
"getWidth",
"(",
")",
"/",
"2",
")",
"+",
"2",
";",
"long",
"offset",
"=",
"milliseconds"... | Converts a time in milliseconds to the appropriate x coordinate for drawing something at that time.
@param milliseconds the time at which something should be drawn
@return the component x coordinate at which it should be drawn | [
"Converts",
"a",
"time",
"in",
"milliseconds",
"to",
"the",
"appropriate",
"x",
"coordinate",
"for",
"drawing",
"something",
"at",
"that",
"time",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L676-L683 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.cueColor | public static Color cueColor(CueList.Entry entry) {
if (entry.hotCueNumber > 0) {
return Color.GREEN;
}
if (entry.isLoop) {
return Color.ORANGE;
}
return Color.RED;
} | java | public static Color cueColor(CueList.Entry entry) {
if (entry.hotCueNumber > 0) {
return Color.GREEN;
}
if (entry.isLoop) {
return Color.ORANGE;
}
return Color.RED;
} | [
"public",
"static",
"Color",
"cueColor",
"(",
"CueList",
".",
"Entry",
"entry",
")",
"{",
"if",
"(",
"entry",
".",
"hotCueNumber",
">",
"0",
")",
"{",
"return",
"Color",
".",
"GREEN",
";",
"}",
"if",
"(",
"entry",
".",
"isLoop",
")",
"{",
"return",
... | Determine the color to use to draw a cue list entry. Hot cues are green, ordinary memory points are red,
and loops are orange.
@param entry the entry being drawn
@return the color with which it should be represented. | [
"Determine",
"the",
"color",
"to",
"use",
"to",
"draw",
"a",
"cue",
"list",
"entry",
".",
"Hot",
"cues",
"are",
"green",
"ordinary",
"memory",
"points",
"are",
"red",
"and",
"loops",
"are",
"orange",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L698-L706 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/DeviceUpdate.java | DeviceUpdate.getPacketBytes | public byte[] getPacketBytes() {
byte[] result = new byte[packetBytes.length];
System.arraycopy(packetBytes, 0, result, 0, packetBytes.length);
return result;
} | java | public byte[] getPacketBytes() {
byte[] result = new byte[packetBytes.length];
System.arraycopy(packetBytes, 0, result, 0, packetBytes.length);
return result;
} | [
"public",
"byte",
"[",
"]",
"getPacketBytes",
"(",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"packetBytes",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"packetBytes",
",",
"0",
",",
"result",
",",
"0",
",",
"packetB... | Get the raw data bytes of the device update packet.
@return the data sent by the device to update its status | [
"Get",
"the",
"raw",
"data",
"bytes",
"of",
"the",
"device",
"update",
"packet",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/DeviceUpdate.java#L100-L104 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/Util.java | Util.buildPacket | public static DatagramPacket buildPacket(PacketType type, ByteBuffer deviceName, ByteBuffer payload) {
ByteBuffer content = ByteBuffer.allocate(0x1f + payload.remaining());
content.put(getMagicHeader());
content.put(type.protocolValue);
content.put(deviceName);
content.put(payloa... | java | public static DatagramPacket buildPacket(PacketType type, ByteBuffer deviceName, ByteBuffer payload) {
ByteBuffer content = ByteBuffer.allocate(0x1f + payload.remaining());
content.put(getMagicHeader());
content.put(type.protocolValue);
content.put(deviceName);
content.put(payloa... | [
"public",
"static",
"DatagramPacket",
"buildPacket",
"(",
"PacketType",
"type",
",",
"ByteBuffer",
"deviceName",
",",
"ByteBuffer",
"payload",
")",
"{",
"ByteBuffer",
"content",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"0x1f",
"+",
"payload",
".",
"remaining",
"... | Build a standard-format UDP packet for sending to port 50001 or 50002 in the protocol.
@param type the type of packet to create.
@param deviceName the 0x14 (twenty) bytes of the device name to send in the packet.
@param payload the remaining bytes which come after the device name.
@return the packet to send. | [
"Build",
"a",
"standard",
"-",
"format",
"UDP",
"packet",
"for",
"sending",
"to",
"port",
"50001",
"or",
"50002",
"in",
"the",
"protocol",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/Util.java#L176-L183 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/Util.java | Util.validateHeader | public static PacketType validateHeader(DatagramPacket packet, int port) {
byte[] data = packet.getData();
if (data.length < PACKET_TYPE_OFFSET) {
logger.warn("Packet is too short to be a Pro DJ Link packet; must be at least " + PACKET_TYPE_OFFSET +
" bytes long, was onl... | java | public static PacketType validateHeader(DatagramPacket packet, int port) {
byte[] data = packet.getData();
if (data.length < PACKET_TYPE_OFFSET) {
logger.warn("Packet is too short to be a Pro DJ Link packet; must be at least " + PACKET_TYPE_OFFSET +
" bytes long, was onl... | [
"public",
"static",
"PacketType",
"validateHeader",
"(",
"DatagramPacket",
"packet",
",",
"int",
"port",
")",
"{",
"byte",
"[",
"]",
"data",
"=",
"packet",
".",
"getData",
"(",
")",
";",
"if",
"(",
"data",
".",
"length",
"<",
"PACKET_TYPE_OFFSET",
")",
"... | Check to see whether a packet starts with the standard header bytes, followed by a known byte identifying it.
If so, return the kind of packet that has been recognized.
@param packet a packet that has just been received
@param port the port on which the packet has been received
@return the type of packet that was rec... | [
"Check",
"to",
"see",
"whether",
"a",
"packet",
"starts",
"with",
"the",
"standard",
"header",
"bytes",
"followed",
"by",
"a",
"known",
"byte",
"identifying",
"it",
".",
"If",
"so",
"return",
"the",
"kind",
"of",
"packet",
"that",
"has",
"been",
"recognize... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/Util.java#L194-L221 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/Util.java | Util.bytesToNumber | public static long bytesToNumber(byte[] buffer, int start, int length) {
long result = 0;
for (int index = start; index < start + length; index++) {
result = (result << 8) + unsign(buffer[index]);
}
return result;
} | java | public static long bytesToNumber(byte[] buffer, int start, int length) {
long result = 0;
for (int index = start; index < start + length; index++) {
result = (result << 8) + unsign(buffer[index]);
}
return result;
} | [
"public",
"static",
"long",
"bytesToNumber",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"long",
"result",
"=",
"0",
";",
"for",
"(",
"int",
"index",
"=",
"start",
";",
"index",
"<",
"start",
"+",
"length",
... | Reconstructs a number that is represented by more than one byte in a network packet in big-endian order.
@param buffer the byte array containing the packet data
@param start the index of the first byte containing a numeric value
@param length the number of bytes making up the value
@return the reconstructed number | [
"Reconstructs",
"a",
"number",
"that",
"is",
"represented",
"by",
"more",
"than",
"one",
"byte",
"in",
"a",
"network",
"packet",
"in",
"big",
"-",
"endian",
"order",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/Util.java#L242-L248 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/Util.java | Util.bytesToNumberLittleEndian | @SuppressWarnings("SameParameterValue")
public static long bytesToNumberLittleEndian(byte[] buffer, int start, int length) {
long result = 0;
for (int index = start + length - 1; index >= start; index--) {
result = (result << 8) + unsign(buffer[index]);
}
return result;
... | java | @SuppressWarnings("SameParameterValue")
public static long bytesToNumberLittleEndian(byte[] buffer, int start, int length) {
long result = 0;
for (int index = start + length - 1; index >= start; index--) {
result = (result << 8) + unsign(buffer[index]);
}
return result;
... | [
"@",
"SuppressWarnings",
"(",
"\"SameParameterValue\"",
")",
"public",
"static",
"long",
"bytesToNumberLittleEndian",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"long",
"result",
"=",
"0",
";",
"for",
"(",
"int",
... | Reconstructs a number that is represented by more than one byte in a network packet in little-endian order, for
the very few protocol values that are sent in this quirky way.
@param buffer the byte array containing the packet data
@param start the index of the first byte containing a numeric value
@param length the nu... | [
"Reconstructs",
"a",
"number",
"that",
"is",
"represented",
"by",
"more",
"than",
"one",
"byte",
"in",
"a",
"network",
"packet",
"in",
"little",
"-",
"endian",
"order",
"for",
"the",
"very",
"few",
"protocol",
"values",
"that",
"are",
"sent",
"in",
"this",... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/Util.java#L259-L266 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/Util.java | Util.numberToBytes | public static void numberToBytes(int number, byte[] buffer, int start, int length) {
for (int index = start + length - 1; index >= start; index--) {
buffer[index] = (byte)(number & 0xff);
number = number >> 8;
}
} | java | public static void numberToBytes(int number, byte[] buffer, int start, int length) {
for (int index = start + length - 1; index >= start; index--) {
buffer[index] = (byte)(number & 0xff);
number = number >> 8;
}
} | [
"public",
"static",
"void",
"numberToBytes",
"(",
"int",
"number",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"start",
"+",
"length",
"-",
"1",
";",
"index",
">=",
"start",
... | Writes a number to the specified byte array field, breaking it into its component bytes in big-endian order.
If the number is too large to fit in the specified number of bytes, only the low-order bytes are written.
@param number the number to be written to the array
@param buffer the buffer to which the number should ... | [
"Writes",
"a",
"number",
"to",
"the",
"specified",
"byte",
"array",
"field",
"breaking",
"it",
"into",
"its",
"component",
"bytes",
"in",
"big",
"-",
"endian",
"order",
".",
"If",
"the",
"number",
"is",
"too",
"large",
"to",
"fit",
"in",
"the",
"specifie... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/Util.java#L277-L282 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/Util.java | Util.addressToLong | public static long addressToLong(InetAddress address) {
long result = 0;
for (byte element : address.getAddress()) {
result = (result << 8) + unsign(element);
}
return result;
} | java | public static long addressToLong(InetAddress address) {
long result = 0;
for (byte element : address.getAddress()) {
result = (result << 8) + unsign(element);
}
return result;
} | [
"public",
"static",
"long",
"addressToLong",
"(",
"InetAddress",
"address",
")",
"{",
"long",
"result",
"=",
"0",
";",
"for",
"(",
"byte",
"element",
":",
"address",
".",
"getAddress",
"(",
")",
")",
"{",
"result",
"=",
"(",
"result",
"<<",
"8",
")",
... | Converts the bytes that make up an internet address into the corresponding integer value to make
it easier to perform bit-masking operations on them.
@param address an address whose integer equivalent is desired
@return the integer corresponding to that address | [
"Converts",
"the",
"bytes",
"that",
"make",
"up",
"an",
"internet",
"address",
"into",
"the",
"corresponding",
"integer",
"value",
"to",
"make",
"it",
"easier",
"to",
"perform",
"bit",
"-",
"masking",
"operations",
"on",
"them",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/Util.java#L292-L298 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/Util.java | Util.sameNetwork | public static boolean sameNetwork(int prefixLength, InetAddress address1, InetAddress address2) {
if (logger.isDebugEnabled()) {
logger.debug("Comparing address " + address1.getHostAddress() + " with " + address2.getHostAddress() + ", prefixLength=" + prefixLength);
}
long prefixMask... | java | public static boolean sameNetwork(int prefixLength, InetAddress address1, InetAddress address2) {
if (logger.isDebugEnabled()) {
logger.debug("Comparing address " + address1.getHostAddress() + " with " + address2.getHostAddress() + ", prefixLength=" + prefixLength);
}
long prefixMask... | [
"public",
"static",
"boolean",
"sameNetwork",
"(",
"int",
"prefixLength",
",",
"InetAddress",
"address1",
",",
"InetAddress",
"address2",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Comparing addres... | Checks whether two internet addresses are on the same subnet.
@param prefixLength the number of bits within an address that identify the network
@param address1 the first address to be compared
@param address2 the second address to be compared
@return true if both addresses share the same network bits | [
"Checks",
"whether",
"two",
"internet",
"addresses",
"are",
"on",
"the",
"same",
"subnet",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/Util.java#L309-L315 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/Util.java | Util.writeFully | public static void writeFully(ByteBuffer buffer, WritableByteChannel channel) throws IOException {
while (buffer.hasRemaining()) {
channel.write(buffer);
}
} | java | public static void writeFully(ByteBuffer buffer, WritableByteChannel channel) throws IOException {
while (buffer.hasRemaining()) {
channel.write(buffer);
}
} | [
"public",
"static",
"void",
"writeFully",
"(",
"ByteBuffer",
"buffer",
",",
"WritableByteChannel",
"channel",
")",
"throws",
"IOException",
"{",
"while",
"(",
"buffer",
".",
"hasRemaining",
"(",
")",
")",
"{",
"channel",
".",
"write",
"(",
"buffer",
")",
";"... | Writes the entire remaining contents of the buffer to the channel. May complete in one operation, but the
documentation is vague, so this keeps going until we are sure.
@param buffer the data to be written
@param channel the channel to which we want to write data
@throws IOException if there is a problem writing to t... | [
"Writes",
"the",
"entire",
"remaining",
"contents",
"of",
"the",
"buffer",
"to",
"the",
"channel",
".",
"May",
"complete",
"in",
"one",
"operation",
"but",
"the",
"documentation",
"is",
"vague",
"so",
"this",
"keeps",
"going",
"until",
"we",
"are",
"sure",
... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/Util.java#L348-L352 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java | SignatureFinder.getSignatures | public Map<Integer, String> getSignatures() {
ensureRunning();
// Make a copy so callers get an immutable snapshot of the current state.
return Collections.unmodifiableMap(new HashMap<Integer, String>(signatures));
} | java | public Map<Integer, String> getSignatures() {
ensureRunning();
// Make a copy so callers get an immutable snapshot of the current state.
return Collections.unmodifiableMap(new HashMap<Integer, String>(signatures));
} | [
"public",
"Map",
"<",
"Integer",
",",
"String",
">",
"getSignatures",
"(",
")",
"{",
"ensureRunning",
"(",
")",
";",
"// Make a copy so callers get an immutable snapshot of the current state.",
"return",
"Collections",
".",
"unmodifiableMap",
"(",
"new",
"HashMap",
"<",... | Get the signatures that have been computed for all tracks currently loaded in any player for which we have
been able to obtain all necessary metadata.
@return the signatures that uniquely identify the tracks loaded in each player
@throws IllegalStateException if the SignatureFinder is not running | [
"Get",
"the",
"signatures",
"that",
"have",
"been",
"computed",
"for",
"all",
"tracks",
"currently",
"loaded",
"in",
"any",
"player",
"for",
"which",
"we",
"have",
"been",
"able",
"to",
"obtain",
"all",
"necessary",
"metadata",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java#L143-L147 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java | SignatureFinder.checkExistingTracks | private void checkExistingTracks() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
for (Map.Entry<DeckReference, TrackMetadata> entry : MetadataFinder.getInstance().getLoadedTracks().entrySet()) {
if (entry.getKey().hotCue =... | java | private void checkExistingTracks() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
for (Map.Entry<DeckReference, TrackMetadata> entry : MetadataFinder.getInstance().getLoadedTracks().entrySet()) {
if (entry.getKey().hotCue =... | [
"private",
"void",
"checkExistingTracks",
"(",
")",
"{",
"SwingUtilities",
".",
"invokeLater",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"DeckReference",
",",
"Tr... | Send ourselves "updates" about any tracks that were loaded before we started, since we missed them. | [
"Send",
"ourselves",
"updates",
"about",
"any",
"tracks",
"that",
"were",
"loaded",
"before",
"we",
"started",
"since",
"we",
"missed",
"them",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java#L267-L278 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java | SignatureFinder.digestInteger | private void digestInteger(MessageDigest digest, int value) {
byte[] valueBytes = new byte[4];
Util.numberToBytes(value, valueBytes, 0, 4);
digest.update(valueBytes);
} | java | private void digestInteger(MessageDigest digest, int value) {
byte[] valueBytes = new byte[4];
Util.numberToBytes(value, valueBytes, 0, 4);
digest.update(valueBytes);
} | [
"private",
"void",
"digestInteger",
"(",
"MessageDigest",
"digest",
",",
"int",
"value",
")",
"{",
"byte",
"[",
"]",
"valueBytes",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"Util",
".",
"numberToBytes",
"(",
"value",
",",
"valueBytes",
",",
"0",
",",
"4"... | Helper method to add a Java integer value to a message digest.
@param digest the message digest being built
@param value the integer whose bytes should be included in the digest | [
"Helper",
"method",
"to",
"add",
"a",
"Java",
"integer",
"value",
"to",
"a",
"message",
"digest",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java#L286-L290 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java | SignatureFinder.computeTrackSignature | public String computeTrackSignature(final String title, final SearchableItem artist, final int duration,
final WaveformDetail waveformDetail, final BeatGrid beatGrid) {
final String safeTitle = (title == null)? "" : title;
final String artistName = (artist == null... | java | public String computeTrackSignature(final String title, final SearchableItem artist, final int duration,
final WaveformDetail waveformDetail, final BeatGrid beatGrid) {
final String safeTitle = (title == null)? "" : title;
final String artistName = (artist == null... | [
"public",
"String",
"computeTrackSignature",
"(",
"final",
"String",
"title",
",",
"final",
"SearchableItem",
"artist",
",",
"final",
"int",
"duration",
",",
"final",
"WaveformDetail",
"waveformDetail",
",",
"final",
"BeatGrid",
"beatGrid",
")",
"{",
"final",
"Str... | Calculate the signature by which we can reliably recognize a loaded track.
@param title the track title
@param artist the track artist, or {@code null} if there is no artist
@param duration the duration of the track in seconds
@param waveformDetail the monochrome waveform detail of the track
@param beatGrid the beat g... | [
"Calculate",
"the",
"signature",
"by",
"which",
"we",
"can",
"reliably",
"recognize",
"a",
"loaded",
"track",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java#L303-L338 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java | SignatureFinder.handleUpdate | private void handleUpdate(final int player) {
final TrackMetadata metadata = MetadataFinder.getInstance().getLatestMetadataFor(player);
final WaveformDetail waveformDetail = WaveformFinder.getInstance().getLatestDetailFor(player);
final BeatGrid beatGrid = BeatGridFinder.getInstance().getLatestB... | java | private void handleUpdate(final int player) {
final TrackMetadata metadata = MetadataFinder.getInstance().getLatestMetadataFor(player);
final WaveformDetail waveformDetail = WaveformFinder.getInstance().getLatestDetailFor(player);
final BeatGrid beatGrid = BeatGridFinder.getInstance().getLatestB... | [
"private",
"void",
"handleUpdate",
"(",
"final",
"int",
"player",
")",
"{",
"final",
"TrackMetadata",
"metadata",
"=",
"MetadataFinder",
".",
"getInstance",
"(",
")",
".",
"getLatestMetadataFor",
"(",
"player",
")",
";",
"final",
"WaveformDetail",
"waveformDetail"... | We have reason to believe we might have enough information to calculate a signature for the track loaded on a
player. Verify that, and if so, perform the computation and record and report the new signature. | [
"We",
"have",
"reason",
"to",
"believe",
"we",
"might",
"have",
"enough",
"information",
"to",
"calculate",
"a",
"signature",
"for",
"the",
"track",
"loaded",
"on",
"a",
"player",
".",
"Verify",
"that",
"and",
"if",
"so",
"perform",
"the",
"computation",
"... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java#L344-L356 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java | SignatureFinder.stop | public synchronized void stop () {
if (isRunning()) {
MetadataFinder.getInstance().removeTrackMetadataListener(metadataListener);
WaveformFinder.getInstance().removeWaveformListener(waveformListener);
BeatGridFinder.getInstance().removeBeatGridListener(beatGridListener);
... | java | public synchronized void stop () {
if (isRunning()) {
MetadataFinder.getInstance().removeTrackMetadataListener(metadataListener);
WaveformFinder.getInstance().removeWaveformListener(waveformListener);
BeatGridFinder.getInstance().removeBeatGridListener(beatGridListener);
... | [
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"isRunning",
"(",
")",
")",
"{",
"MetadataFinder",
".",
"getInstance",
"(",
")",
".",
"removeTrackMetadataListener",
"(",
"metadataListener",
")",
";",
"WaveformFinder",
".",
"getInstance",
"(... | Stop finding signatures for all active players. | [
"Stop",
"finding",
"signatures",
"for",
"all",
"active",
"players",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/SignatureFinder.java#L406-L429 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/DeviceFinder.java | DeviceFinder.expireDevices | private void expireDevices() {
long now = System.currentTimeMillis();
// Make a copy so we don't have to worry about concurrent modification.
Map<InetAddress, DeviceAnnouncement> copy = new HashMap<InetAddress, DeviceAnnouncement>(devices);
for (Map.Entry<InetAddress, DeviceAnnouncement>... | java | private void expireDevices() {
long now = System.currentTimeMillis();
// Make a copy so we don't have to worry about concurrent modification.
Map<InetAddress, DeviceAnnouncement> copy = new HashMap<InetAddress, DeviceAnnouncement>(devices);
for (Map.Entry<InetAddress, DeviceAnnouncement>... | [
"private",
"void",
"expireDevices",
"(",
")",
"{",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"// Make a copy so we don't have to worry about concurrent modification.",
"Map",
"<",
"InetAddress",
",",
"DeviceAnnouncement",
">",
"copy",
"=",
... | Remove any device announcements that are so old that the device seems to have gone away. | [
"Remove",
"any",
"device",
"announcements",
"that",
"are",
"so",
"old",
"that",
"the",
"device",
"seems",
"to",
"have",
"gone",
"away",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/DeviceFinder.java#L98-L111 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/DeviceFinder.java | DeviceFinder.updateDevices | private void updateDevices(DeviceAnnouncement announcement) {
firstDeviceTime.compareAndSet(0, System.currentTimeMillis());
devices.put(announcement.getAddress(), announcement);
} | java | private void updateDevices(DeviceAnnouncement announcement) {
firstDeviceTime.compareAndSet(0, System.currentTimeMillis());
devices.put(announcement.getAddress(), announcement);
} | [
"private",
"void",
"updateDevices",
"(",
"DeviceAnnouncement",
"announcement",
")",
"{",
"firstDeviceTime",
".",
"compareAndSet",
"(",
"0",
",",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"devices",
".",
"put",
"(",
"announcement",
".",
"getAddress"... | Record a device announcement in the devices map, so we know whe saw it.
@param announcement the announcement to be recorded | [
"Record",
"a",
"device",
"announcement",
"in",
"the",
"devices",
"map",
"so",
"we",
"know",
"whe",
"saw",
"it",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/DeviceFinder.java#L118-L121 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/DeviceFinder.java | DeviceFinder.start | public synchronized void start() throws SocketException {
if (!isRunning()) {
socket.set(new DatagramSocket(ANNOUNCEMENT_PORT));
startTime.set(System.currentTimeMillis());
deliverLifecycleAnnouncement(logger, true);
final byte[] buffer = new byte[512];
... | java | public synchronized void start() throws SocketException {
if (!isRunning()) {
socket.set(new DatagramSocket(ANNOUNCEMENT_PORT));
startTime.set(System.currentTimeMillis());
deliverLifecycleAnnouncement(logger, true);
final byte[] buffer = new byte[512];
... | [
"public",
"synchronized",
"void",
"start",
"(",
")",
"throws",
"SocketException",
"{",
"if",
"(",
"!",
"isRunning",
"(",
")",
")",
"{",
"socket",
".",
"set",
"(",
"new",
"DatagramSocket",
"(",
"ANNOUNCEMENT_PORT",
")",
")",
";",
"startTime",
".",
"set",
... | Start listening for device announcements and keeping track of the DJ Link devices visible on the network.
If already listening, has no effect.
@throws SocketException if the socket to listen on port 50000 cannot be created | [
"Start",
"listening",
"for",
"device",
"announcements",
"and",
"keeping",
"track",
"of",
"the",
"DJ",
"Link",
"devices",
"visible",
"on",
"the",
"network",
".",
"If",
"already",
"listening",
"has",
"no",
"effect",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/DeviceFinder.java#L180-L245 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/DeviceFinder.java | DeviceFinder.stop | @SuppressWarnings("WeakerAccess")
public synchronized void stop() {
if (isRunning()) {
final Set<DeviceAnnouncement> lastDevices = getCurrentDevices();
socket.get().close();
socket.set(null);
devices.clear();
firstDeviceTime.set(0);
// ... | java | @SuppressWarnings("WeakerAccess")
public synchronized void stop() {
if (isRunning()) {
final Set<DeviceAnnouncement> lastDevices = getCurrentDevices();
socket.get().close();
socket.set(null);
devices.clear();
firstDeviceTime.set(0);
// ... | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"isRunning",
"(",
")",
")",
"{",
"final",
"Set",
"<",
"DeviceAnnouncement",
">",
"lastDevices",
"=",
"getCurrentDevices",
"(",
")",
";"... | Stop listening for device announcements. Also discard any announcements which had been received, and
notify any registered listeners that those devices have been lost. | [
"Stop",
"listening",
"for",
"device",
"announcements",
".",
"Also",
"discard",
"any",
"announcements",
"which",
"had",
"been",
"received",
"and",
"notify",
"any",
"registered",
"listeners",
"that",
"those",
"devices",
"have",
"been",
"lost",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/DeviceFinder.java#L251-L270 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/DeviceFinder.java | DeviceFinder.deliverFoundAnnouncement | private void deliverFoundAnnouncement(final DeviceAnnouncement announcement) {
for (final DeviceAnnouncementListener listener : getDeviceAnnouncementListeners()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
... | java | private void deliverFoundAnnouncement(final DeviceAnnouncement announcement) {
for (final DeviceAnnouncementListener listener : getDeviceAnnouncementListeners()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
... | [
"private",
"void",
"deliverFoundAnnouncement",
"(",
"final",
"DeviceAnnouncement",
"announcement",
")",
"{",
"for",
"(",
"final",
"DeviceAnnouncementListener",
"listener",
":",
"getDeviceAnnouncementListeners",
"(",
")",
")",
"{",
"SwingUtilities",
".",
"invokeLater",
"... | Send a device found announcement to all registered listeners.
@param announcement the message announcing the new device | [
"Send",
"a",
"device",
"found",
"announcement",
"to",
"all",
"registered",
"listeners",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/DeviceFinder.java#L362-L375 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/DeviceFinder.java | DeviceFinder.deliverLostAnnouncement | private void deliverLostAnnouncement(final DeviceAnnouncement announcement) {
for (final DeviceAnnouncementListener listener : getDeviceAnnouncementListeners()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
... | java | private void deliverLostAnnouncement(final DeviceAnnouncement announcement) {
for (final DeviceAnnouncementListener listener : getDeviceAnnouncementListeners()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
... | [
"private",
"void",
"deliverLostAnnouncement",
"(",
"final",
"DeviceAnnouncement",
"announcement",
")",
"{",
"for",
"(",
"final",
"DeviceAnnouncementListener",
"listener",
":",
"getDeviceAnnouncementListeners",
"(",
")",
")",
"{",
"SwingUtilities",
".",
"invokeLater",
"(... | Send a device lost announcement to all registered listeners.
@param announcement the last message received from the vanished device | [
"Send",
"a",
"device",
"lost",
"announcement",
"to",
"all",
"registered",
"listeners",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/DeviceFinder.java#L382-L395 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java | Client.performSetupExchange | private void performSetupExchange() throws IOException {
Message setupRequest = new Message(0xfffffffeL, Message.KnownType.SETUP_REQ, new NumberField(posingAsPlayer, 4));
sendMessage(setupRequest);
Message response = Message.read(is);
if (response.knownType != Message.KnownType.MENU_AVAI... | java | private void performSetupExchange() throws IOException {
Message setupRequest = new Message(0xfffffffeL, Message.KnownType.SETUP_REQ, new NumberField(posingAsPlayer, 4));
sendMessage(setupRequest);
Message response = Message.read(is);
if (response.knownType != Message.KnownType.MENU_AVAI... | [
"private",
"void",
"performSetupExchange",
"(",
")",
"throws",
"IOException",
"{",
"Message",
"setupRequest",
"=",
"new",
"Message",
"(",
"0xfffffffe",
"L",
",",
"Message",
".",
"KnownType",
".",
"SETUP_REQ",
",",
"new",
"NumberField",
"(",
"posingAsPlayer",
","... | Exchanges the initial fully-formed messages which establishes the transaction context for queries to
the dbserver.
@throws IOException if there is a problem during the exchange | [
"Exchanges",
"the",
"initial",
"fully",
"-",
"formed",
"messages",
"which",
"establishes",
"the",
"transaction",
"context",
"for",
"queries",
"to",
"the",
"dbserver",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java#L117-L135 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java | Client.performTeardownExchange | private void performTeardownExchange() throws IOException {
Message teardownRequest = new Message(0xfffffffeL, Message.KnownType.TEARDOWN_REQ);
sendMessage(teardownRequest);
// At this point, the server closes the connection from its end, so we can’t read any more.
} | java | private void performTeardownExchange() throws IOException {
Message teardownRequest = new Message(0xfffffffeL, Message.KnownType.TEARDOWN_REQ);
sendMessage(teardownRequest);
// At this point, the server closes the connection from its end, so we can’t read any more.
} | [
"private",
"void",
"performTeardownExchange",
"(",
")",
"throws",
"IOException",
"{",
"Message",
"teardownRequest",
"=",
"new",
"Message",
"(",
"0xfffffffe",
"L",
",",
"Message",
".",
"KnownType",
".",
"TEARDOWN_REQ",
")",
";",
"sendMessage",
"(",
"teardownRequest... | Exchanges the final messages which politely report our intention to disconnect from the dbserver. | [
"Exchanges",
"the",
"final",
"messages",
"which",
"politely",
"report",
"our",
"intention",
"to",
"disconnect",
"from",
"the",
"dbserver",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java#L140-L144 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java | Client.close | void close() {
try {
performTeardownExchange();
} catch (IOException e) {
logger.warn("Problem reporting our intention to close the dbserver connection", e);
}
try {
channel.close();
} catch (IOException e) {
logger.warn("Problem cl... | java | void close() {
try {
performTeardownExchange();
} catch (IOException e) {
logger.warn("Problem reporting our intention to close the dbserver connection", e);
}
try {
channel.close();
} catch (IOException e) {
logger.warn("Problem cl... | [
"void",
"close",
"(",
")",
"{",
"try",
"{",
"performTeardownExchange",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Problem reporting our intention to close the dbserver connection\"",
",",
"e",
")",
";",
"}",
... | Closes the connection to the dbserver. This instance can no longer be used after this action. | [
"Closes",
"the",
"connection",
"to",
"the",
"dbserver",
".",
"This",
"instance",
"can",
"no",
"longer",
"be",
"used",
"after",
"this",
"action",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java#L160-L186 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java | Client.sendField | @SuppressWarnings("SameParameterValue")
private void sendField(Field field) throws IOException {
if (isConnected()) {
try {
field.write(channel);
} catch (IOException e) {
logger.warn("Problem trying to write field to dbserver, closing connection", e);... | java | @SuppressWarnings("SameParameterValue")
private void sendField(Field field) throws IOException {
if (isConnected()) {
try {
field.write(channel);
} catch (IOException e) {
logger.warn("Problem trying to write field to dbserver, closing connection", e);... | [
"@",
"SuppressWarnings",
"(",
"\"SameParameterValue\"",
")",
"private",
"void",
"sendField",
"(",
"Field",
"field",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isConnected",
"(",
")",
")",
"{",
"try",
"{",
"field",
".",
"write",
"(",
"channel",
")",
";"... | Attempt to send the specified field to the dbserver.
This low-level function is available only to the package itself for use in setting up the connection. It was
previously also used for sending parts of larger-scale messages, but because that sometimes led to them being
fragmented into multiple network packets, and Wi... | [
"Attempt",
"to",
"send",
"the",
"specified",
"field",
"to",
"the",
"dbserver",
".",
"This",
"low",
"-",
"level",
"function",
"is",
"available",
"only",
"to",
"the",
"package",
"itself",
"for",
"use",
"in",
"setting",
"up",
"the",
"connection",
".",
"It",
... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java#L199-L212 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java | Client.sendMessage | private void sendMessage(Message message) throws IOException {
logger.debug("Sending> {}", message);
int totalSize = 0;
for (Field field : message.fields) {
totalSize += field.getBytes().remaining();
}
ByteBuffer combined = ByteBuffer.allocate(totalSize);
for ... | java | private void sendMessage(Message message) throws IOException {
logger.debug("Sending> {}", message);
int totalSize = 0;
for (Field field : message.fields) {
totalSize += field.getBytes().remaining();
}
ByteBuffer combined = ByteBuffer.allocate(totalSize);
for ... | [
"private",
"void",
"sendMessage",
"(",
"Message",
"message",
")",
"throws",
"IOException",
"{",
"logger",
".",
"debug",
"(",
"\"Sending> {}\"",
",",
"message",
")",
";",
"int",
"totalSize",
"=",
"0",
";",
"for",
"(",
"Field",
"field",
":",
"message",
".",
... | Sends a message to the dbserver, first assembling it into a single byte buffer so that it can be sent as
a single packet.
@param message the message to be sent
@throws IOException if there is a problem sending it | [
"Sends",
"a",
"message",
"to",
"the",
"dbserver",
"first",
"assembling",
"it",
"into",
"a",
"single",
"byte",
"buffer",
"so",
"that",
"it",
"can",
"be",
"sent",
"as",
"a",
"single",
"packet",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java#L231-L244 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java | Client.simpleRequest | public synchronized Message simpleRequest(Message.KnownType requestType, Message.KnownType responseType,
Field... arguments)
throws IOException {
final NumberField transaction = assignTransactionNumber();
final Message request = new Message(trans... | java | public synchronized Message simpleRequest(Message.KnownType requestType, Message.KnownType responseType,
Field... arguments)
throws IOException {
final NumberField transaction = assignTransactionNumber();
final Message request = new Message(trans... | [
"public",
"synchronized",
"Message",
"simpleRequest",
"(",
"Message",
".",
"KnownType",
"requestType",
",",
"Message",
".",
"KnownType",
"responseType",
",",
"Field",
"...",
"arguments",
")",
"throws",
"IOException",
"{",
"final",
"NumberField",
"transaction",
"=",
... | Send a request that expects a single message as its response, then read and return that response.
@param requestType identifies what kind of request to send
@param responseType identifies the type of response we expect, or {@code null} if we’ll accept anything
@param arguments The argument fields to send in the reques... | [
"Send",
"a",
"request",
"that",
"expects",
"a",
"single",
"message",
"as",
"its",
"response",
"then",
"read",
"and",
"return",
"that",
"response",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java#L345-L361 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java | Client.menuRequestTyped | public synchronized Message menuRequestTyped(Message.KnownType requestType, Message.MenuIdentifier targetMenu,
CdjStatus.TrackSourceSlot slot, CdjStatus.TrackType trackType, Field... arguments)
throws IOException {
if (!menuLock.isHeldByCurrentThread... | java | public synchronized Message menuRequestTyped(Message.KnownType requestType, Message.MenuIdentifier targetMenu,
CdjStatus.TrackSourceSlot slot, CdjStatus.TrackType trackType, Field... arguments)
throws IOException {
if (!menuLock.isHeldByCurrentThread... | [
"public",
"synchronized",
"Message",
"menuRequestTyped",
"(",
"Message",
".",
"KnownType",
"requestType",
",",
"Message",
".",
"MenuIdentifier",
"targetMenu",
",",
"CdjStatus",
".",
"TrackSourceSlot",
"slot",
",",
"CdjStatus",
".",
"TrackType",
"trackType",
",",
"Fi... | Send a request for a menu that we will retrieve items from in subsequent requests, when the request must reflect
the actual type of track being asked about.
@param requestType identifies what kind of menu request to send
@param targetMenu the destination for the response to this query
@param slot the media library of ... | [
"Send",
"a",
"request",
"for",
"a",
"menu",
"that",
"we",
"will",
"retrieve",
"items",
"from",
"in",
"subsequent",
"requests",
"when",
"the",
"request",
"must",
"reflect",
"the",
"actual",
"type",
"of",
"track",
"being",
"asked",
"about",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/Client.java#L403-L422 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/SlotReference.java | SlotReference.getSlotReference | @SuppressWarnings("WeakerAccess")
public static synchronized SlotReference getSlotReference(int player, CdjStatus.TrackSourceSlot slot) {
Map<CdjStatus.TrackSourceSlot, SlotReference> playerMap = instances.get(player);
if (playerMap == null) {
playerMap = new HashMap<CdjStatus.TrackSourc... | java | @SuppressWarnings("WeakerAccess")
public static synchronized SlotReference getSlotReference(int player, CdjStatus.TrackSourceSlot slot) {
Map<CdjStatus.TrackSourceSlot, SlotReference> playerMap = instances.get(player);
if (playerMap == null) {
playerMap = new HashMap<CdjStatus.TrackSourc... | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"static",
"synchronized",
"SlotReference",
"getSlotReference",
"(",
"int",
"player",
",",
"CdjStatus",
".",
"TrackSourceSlot",
"slot",
")",
"{",
"Map",
"<",
"CdjStatus",
".",
"TrackSourceSlot",
",",
... | Get a unique reference to a media slot on the network from which tracks can be loaded.
@param player the player in which the slot is found
@param slot the specific type of the slot
@return the instance that will always represent the specified slot
@throws NullPointerException if {@code slot} is {@code null} | [
"Get",
"a",
"unique",
"reference",
"to",
"a",
"media",
"slot",
"on",
"the",
"network",
"from",
"which",
"tracks",
"can",
"be",
"loaded",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/SlotReference.java#L56-L69 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/SlotReference.java | SlotReference.getSlotReference | @SuppressWarnings("WeakerAccess")
public static SlotReference getSlotReference(DataReference dataReference) {
return getSlotReference(dataReference.player, dataReference.slot);
} | java | @SuppressWarnings("WeakerAccess")
public static SlotReference getSlotReference(DataReference dataReference) {
return getSlotReference(dataReference.player, dataReference.slot);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"static",
"SlotReference",
"getSlotReference",
"(",
"DataReference",
"dataReference",
")",
"{",
"return",
"getSlotReference",
"(",
"dataReference",
".",
"player",
",",
"dataReference",
".",
"slot",
")",
... | Get a unique reference to the media slot on the network from which the specified data was loaded.
@param dataReference the data whose media slot is of interest
@return the instance that will always represent the slot associated with the specified data | [
"Get",
"a",
"unique",
"reference",
"to",
"the",
"media",
"slot",
"on",
"the",
"network",
"from",
"which",
"the",
"specified",
"data",
"was",
"loaded",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/SlotReference.java#L78-L81 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/Beat.java | Beat.isTempoMaster | @Override
public boolean isTempoMaster() {
DeviceUpdate master = VirtualCdj.getInstance().getTempoMaster();
return (master != null) && master.getAddress().equals(address);
} | java | @Override
public boolean isTempoMaster() {
DeviceUpdate master = VirtualCdj.getInstance().getTempoMaster();
return (master != null) && master.getAddress().equals(address);
} | [
"@",
"Override",
"public",
"boolean",
"isTempoMaster",
"(",
")",
"{",
"DeviceUpdate",
"master",
"=",
"VirtualCdj",
".",
"getInstance",
"(",
")",
".",
"getTempoMaster",
"(",
")",
";",
"return",
"(",
"master",
"!=",
"null",
")",
"&&",
"master",
".",
"getAddr... | Was this beat sent by the current tempo master?
@return {@code true} if the device that sent this beat is the master
@throws IllegalStateException if the {@link VirtualCdj} is not running | [
"Was",
"this",
"beat",
"sent",
"by",
"the",
"current",
"tempo",
"master?"
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/Beat.java#L106-L110 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/LifecycleParticipant.java | LifecycleParticipant.deliverLifecycleAnnouncement | protected void deliverLifecycleAnnouncement(final Logger logger, final boolean starting) {
new Thread(new Runnable() {
@Override
public void run() {
for (final LifecycleListener listener : getLifecycleListeners()) {
try {
if (st... | java | protected void deliverLifecycleAnnouncement(final Logger logger, final boolean starting) {
new Thread(new Runnable() {
@Override
public void run() {
for (final LifecycleListener listener : getLifecycleListeners()) {
try {
if (st... | [
"protected",
"void",
"deliverLifecycleAnnouncement",
"(",
"final",
"Logger",
"logger",
",",
"final",
"boolean",
"starting",
")",
"{",
"new",
"Thread",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"for",
"(... | Send a lifecycle announcement to all registered listeners.
@param logger the logger to use, so the log entry shows as belonging to the proper subclass.
@param starting will be {@code true} if the DeviceFinder is starting, {@code false} if it is stopping. | [
"Send",
"a",
"lifecycle",
"announcement",
"to",
"all",
"registered",
"listeners",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/LifecycleParticipant.java#L69-L86 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/CrateDigger.java | CrateDigger.mountPath | private String mountPath(CdjStatus.TrackSourceSlot slot) {
switch (slot) {
case SD_SLOT: return "/B/";
case USB_SLOT: return "/C/";
}
throw new IllegalArgumentException("Don't know how to NFS mount filesystem for slot " + slot);
} | java | private String mountPath(CdjStatus.TrackSourceSlot slot) {
switch (slot) {
case SD_SLOT: return "/B/";
case USB_SLOT: return "/C/";
}
throw new IllegalArgumentException("Don't know how to NFS mount filesystem for slot " + slot);
} | [
"private",
"String",
"mountPath",
"(",
"CdjStatus",
".",
"TrackSourceSlot",
"slot",
")",
"{",
"switch",
"(",
"slot",
")",
"{",
"case",
"SD_SLOT",
":",
"return",
"\"/B/\"",
";",
"case",
"USB_SLOT",
":",
"return",
"\"/C/\"",
";",
"}",
"throw",
"new",
"Illega... | Return the filesystem path needed to mount the NFS filesystem associated with a particular media slot.
@param slot the slot whose filesystem is desired
@return the path to use in the NFS mount request to access the files mounted in that slot
@throws IllegalArgumentException if it is a slot that we don't know how to ... | [
"Return",
"the",
"filesystem",
"path",
"needed",
"to",
"mount",
"the",
"NFS",
"filesystem",
"associated",
"with",
"a",
"particular",
"media",
"slot",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/CrateDigger.java#L189-L195 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/CrateDigger.java | CrateDigger.deliverDatabaseUpdate | private void deliverDatabaseUpdate(SlotReference slot, Database database, boolean available) {
for (final DatabaseListener listener : getDatabaseListeners()) {
try {
if (available) {
listener.databaseMounted(slot, database);
} else {
... | java | private void deliverDatabaseUpdate(SlotReference slot, Database database, boolean available) {
for (final DatabaseListener listener : getDatabaseListeners()) {
try {
if (available) {
listener.databaseMounted(slot, database);
} else {
... | [
"private",
"void",
"deliverDatabaseUpdate",
"(",
"SlotReference",
"slot",
",",
"Database",
"database",
",",
"boolean",
"available",
")",
"{",
"for",
"(",
"final",
"DatabaseListener",
"listener",
":",
"getDatabaseListeners",
"(",
")",
")",
"{",
"try",
"{",
"if",
... | Send a database announcement to all registered listeners.
@param slot the media slot whose database availability has changed
@param database the database whose relevance has changed
@param available if {@code} true, the database is newly available, otherwise it is no longer relevant | [
"Send",
"a",
"database",
"announcement",
"to",
"all",
"registered",
"listeners",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/CrateDigger.java#L726-L738 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java | WaveformPreviewComponent.delegatingRepaint | @SuppressWarnings("SameParameterValue")
private void delegatingRepaint(int x, int y, int width, int height) {
final RepaintDelegate delegate = repaintDelegate.get();
if (delegate != null) {
//logger.info("Delegating repaint: " + x + ", " + y + ", " + width + ", " + height);
d... | java | @SuppressWarnings("SameParameterValue")
private void delegatingRepaint(int x, int y, int width, int height) {
final RepaintDelegate delegate = repaintDelegate.get();
if (delegate != null) {
//logger.info("Delegating repaint: " + x + ", " + y + ", " + width + ", " + height);
d... | [
"@",
"SuppressWarnings",
"(",
"\"SameParameterValue\"",
")",
"private",
"void",
"delegatingRepaint",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"final",
"RepaintDelegate",
"delegate",
"=",
"repaintDelegate",
".",
"ge... | Determine whether we should use the normal repaint process, or delegate that to another component that is
hosting us in a soft-loaded manner to save memory.
@param x the left edge of the region that we want to have redrawn
@param y the top edge of the region that we want to have redrawn
@param width the width of the r... | [
"Determine",
"whether",
"we",
"should",
"use",
"the",
"normal",
"repaint",
"process",
"or",
"delegate",
"that",
"to",
"another",
"component",
"that",
"is",
"hosting",
"us",
"in",
"a",
"soft",
"-",
"loaded",
"manner",
"to",
"save",
"memory",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java#L225-L235 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java | WaveformPreviewComponent.updateWaveform | private void updateWaveform(WaveformPreview preview) {
this.preview.set(preview);
if (preview == null) {
waveformImage.set(null);
} else {
BufferedImage image = new BufferedImage(preview.segmentCount, preview.maxHeight, BufferedImage.TYPE_INT_RGB);
Graphics g ... | java | private void updateWaveform(WaveformPreview preview) {
this.preview.set(preview);
if (preview == null) {
waveformImage.set(null);
} else {
BufferedImage image = new BufferedImage(preview.segmentCount, preview.maxHeight, BufferedImage.TYPE_INT_RGB);
Graphics g ... | [
"private",
"void",
"updateWaveform",
"(",
"WaveformPreview",
"preview",
")",
"{",
"this",
".",
"preview",
".",
"set",
"(",
"preview",
")",
";",
"if",
"(",
"preview",
"==",
"null",
")",
"{",
"waveformImage",
".",
"set",
"(",
"null",
")",
";",
"}",
"else... | Create an image of the proper size to hold a new waveform preview image and draw it. | [
"Create",
"an",
"image",
"of",
"the",
"proper",
"size",
"to",
"hold",
"a",
"new",
"waveform",
"preview",
"image",
"and",
"draw",
"it",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java#L420-L439 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformPreview.java | WaveformPreview.getMaxHeight | private int getMaxHeight() {
int result = 0;
for (int i = 0; i < segmentCount; i++) {
result = Math.max(result, segmentHeight(i, false));
}
return result;
} | java | private int getMaxHeight() {
int result = 0;
for (int i = 0; i < segmentCount; i++) {
result = Math.max(result, segmentHeight(i, false));
}
return result;
} | [
"private",
"int",
"getMaxHeight",
"(",
")",
"{",
"int",
"result",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"segmentCount",
";",
"i",
"++",
")",
"{",
"result",
"=",
"Math",
".",
"max",
"(",
"result",
",",
"segmentHeight",
"(... | Scan the segments to find the largest height value present.
@return the largest waveform height anywhere in the preview. | [
"Scan",
"the",
"segments",
"to",
"find",
"the",
"largest",
"height",
"value",
"present",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformPreview.java#L110-L116 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformPreview.java | WaveformPreview.segmentHeight | @SuppressWarnings("WeakerAccess")
public int segmentHeight(final int segment, final boolean front) {
final ByteBuffer bytes = getData();
if (isColor) {
final int base = segment * 6;
final int frontHeight = Util.unsign(bytes.get(base + 5));
if (front) {
... | java | @SuppressWarnings("WeakerAccess")
public int segmentHeight(final int segment, final boolean front) {
final ByteBuffer bytes = getData();
if (isColor) {
final int base = segment * 6;
final int frontHeight = Util.unsign(bytes.get(base + 5));
if (front) {
... | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"int",
"segmentHeight",
"(",
"final",
"int",
"segment",
",",
"final",
"boolean",
"front",
")",
"{",
"final",
"ByteBuffer",
"bytes",
"=",
"getData",
"(",
")",
";",
"if",
"(",
"isColor",
")",
"... | Determine the height of the preview given an index into it.
@param segment the index of the waveform preview segment to examine
@param front if {@code true} the height of the front (brighter) segment of a color waveform preview is returned,
otherwise the height of the back (dimmer) segment is returned. Has no effect f... | [
"Determine",
"the",
"height",
"of",
"the",
"preview",
"given",
"an",
"index",
"into",
"it",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformPreview.java#L218-L232 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformPreview.java | WaveformPreview.segmentColor | @SuppressWarnings("WeakerAccess")
public Color segmentColor(final int segment, final boolean front) {
final ByteBuffer bytes = getData();
if (isColor) {
final int base = segment * 6;
final int backHeight = segmentHeight(segment, false);
if (backHeight == 0) {
... | java | @SuppressWarnings("WeakerAccess")
public Color segmentColor(final int segment, final boolean front) {
final ByteBuffer bytes = getData();
if (isColor) {
final int base = segment * 6;
final int backHeight = segmentHeight(segment, false);
if (backHeight == 0) {
... | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"Color",
"segmentColor",
"(",
"final",
"int",
"segment",
",",
"final",
"boolean",
"front",
")",
"{",
"final",
"ByteBuffer",
"bytes",
"=",
"getData",
"(",
")",
";",
"if",
"(",
"isColor",
")",
... | Determine the color of the waveform given an index into it.
@param segment the index of the first waveform byte to examine
@param front if {@code true} the front (brighter) segment of a color waveform preview is returned,
otherwise the back (dimmer) segment is returned. Has no effect for blue previews.
@return the co... | [
"Determine",
"the",
"color",
"of",
"the",
"waveform",
"given",
"an",
"index",
"into",
"it",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformPreview.java#L244-L262 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/MediaDetails.java | MediaDetails.hasChanged | public boolean hasChanged(MediaDetails originalMedia) {
if (!hashKey().equals(originalMedia.hashKey())) {
throw new IllegalArgumentException("Can't compare media details with different hashKey values");
}
return playlistCount != originalMedia.playlistCount || trackCount != originalMe... | java | public boolean hasChanged(MediaDetails originalMedia) {
if (!hashKey().equals(originalMedia.hashKey())) {
throw new IllegalArgumentException("Can't compare media details with different hashKey values");
}
return playlistCount != originalMedia.playlistCount || trackCount != originalMe... | [
"public",
"boolean",
"hasChanged",
"(",
"MediaDetails",
"originalMedia",
")",
"{",
"if",
"(",
"!",
"hashKey",
"(",
")",
".",
"equals",
"(",
"originalMedia",
".",
"hashKey",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Can't co... | Check whether the media seems to have changed since a saved version of it was used. We ignore changes in
free space because those probably just reflect history entries being added.
@param originalMedia the media details when information about it was saved
@return true if there have been detectable significant change... | [
"Check",
"whether",
"the",
"media",
"seems",
"to",
"have",
"changed",
"since",
"a",
"saved",
"version",
"of",
"it",
"was",
"used",
".",
"We",
"ignore",
"changes",
"in",
"free",
"space",
"because",
"those",
"probably",
"just",
"reflect",
"history",
"entries",... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/MediaDetails.java#L183-L188 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/dbserver/BinaryField.java | BinaryField.getValueAsArray | public byte[] getValueAsArray() {
ByteBuffer buffer = getValue();
byte[] result = new byte[buffer.remaining()];
buffer.get(result);
return result;
} | java | public byte[] getValueAsArray() {
ByteBuffer buffer = getValue();
byte[] result = new byte[buffer.remaining()];
buffer.get(result);
return result;
} | [
"public",
"byte",
"[",
"]",
"getValueAsArray",
"(",
")",
"{",
"ByteBuffer",
"buffer",
"=",
"getValue",
"(",
")",
";",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"buffer",
".",
"remaining",
"(",
")",
"]",
";",
"buffer",
".",
"get",
"(",
"r... | Get the bytes which represent the payload of this field, without the leading type tag and length header, as
a newly-allocated byte array.
@return a new byte array containing a copy of the bytes this field contains | [
"Get",
"the",
"bytes",
"which",
"represent",
"the",
"payload",
"of",
"this",
"field",
"without",
"the",
"leading",
"type",
"tag",
"and",
"length",
"header",
"as",
"a",
"newly",
"-",
"allocated",
"byte",
"array",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/BinaryField.java#L69-L74 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/CueList.java | CueList.getHotCueCount | public int getHotCueCount() {
if (rawMessage != null) {
return (int) ((NumberField) rawMessage.arguments.get(5)).getValue();
}
int total = 0;
for (Entry entry : entries) {
if (entry.hotCueNumber > 0) {
++total;
}
}
retur... | java | public int getHotCueCount() {
if (rawMessage != null) {
return (int) ((NumberField) rawMessage.arguments.get(5)).getValue();
}
int total = 0;
for (Entry entry : entries) {
if (entry.hotCueNumber > 0) {
++total;
}
}
retur... | [
"public",
"int",
"getHotCueCount",
"(",
")",
"{",
"if",
"(",
"rawMessage",
"!=",
"null",
")",
"{",
"return",
"(",
"int",
")",
"(",
"(",
"NumberField",
")",
"rawMessage",
".",
"arguments",
".",
"get",
"(",
"5",
")",
")",
".",
"getValue",
"(",
")",
"... | Return the number of entries in the cue list that represent hot cues.
@return the number of cue list entries that are hot cues | [
"Return",
"the",
"number",
"of",
"entries",
"in",
"the",
"cue",
"list",
"that",
"represent",
"hot",
"cues",
"."
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/CueList.java#L42-L53 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/CueList.java | CueList.sortEntries | private List<Entry> sortEntries(List<Entry> loadedEntries) {
Collections.sort(loadedEntries, new Comparator<Entry>() {
@Override
public int compare(Entry entry1, Entry entry2) {
int result = (int) (entry1.cuePosition - entry2.cuePosition);
if (result == 0)... | java | private List<Entry> sortEntries(List<Entry> loadedEntries) {
Collections.sort(loadedEntries, new Comparator<Entry>() {
@Override
public int compare(Entry entry1, Entry entry2) {
int result = (int) (entry1.cuePosition - entry2.cuePosition);
if (result == 0)... | [
"private",
"List",
"<",
"Entry",
">",
"sortEntries",
"(",
"List",
"<",
"Entry",
">",
"loadedEntries",
")",
"{",
"Collections",
".",
"sort",
"(",
"loadedEntries",
",",
"new",
"Comparator",
"<",
"Entry",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int"... | Sorts the entries into the order we want to present them in, which is by position, with hot cues coming after
ordinary memory points if both exist at the same position, which often happens.
@param loadedEntries the unsorted entries we have loaded from a dbserver message, metadata cache, or rekordbox
database export
@r... | [
"Sorts",
"the",
"entries",
"into",
"the",
"order",
"we",
"want",
"to",
"present",
"them",
"in",
"which",
"is",
"by",
"position",
"with",
"hot",
"cues",
"coming",
"after",
"ordinary",
"memory",
"points",
"if",
"both",
"exist",
"at",
"the",
"same",
"position... | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/CueList.java#L204-L218 | train |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/CueList.java | CueList.addEntriesFromTag | private void addEntriesFromTag(List<Entry> entries, RekordboxAnlz.CueTag tag) {
for (RekordboxAnlz.CueEntry cueEntry : tag.cues()) { // TODO: Need to figure out how to identify deleted entries to ignore.
if (cueEntry.type() == RekordboxAnlz.CueEntryType.LOOP) {
entries.add(new Entry... | java | private void addEntriesFromTag(List<Entry> entries, RekordboxAnlz.CueTag tag) {
for (RekordboxAnlz.CueEntry cueEntry : tag.cues()) { // TODO: Need to figure out how to identify deleted entries to ignore.
if (cueEntry.type() == RekordboxAnlz.CueEntryType.LOOP) {
entries.add(new Entry... | [
"private",
"void",
"addEntriesFromTag",
"(",
"List",
"<",
"Entry",
">",
"entries",
",",
"RekordboxAnlz",
".",
"CueTag",
"tag",
")",
"{",
"for",
"(",
"RekordboxAnlz",
".",
"CueEntry",
"cueEntry",
":",
"tag",
".",
"cues",
"(",
")",
")",
"{",
"// TODO: Need t... | Helper method to add cue list entries from a parsed ANLZ cue tag
@param entries the list of entries being accumulated
@param tag the tag whose entries are to be added | [
"Helper",
"method",
"to",
"add",
"cue",
"list",
"entries",
"from",
"a",
"parsed",
"ANLZ",
"cue",
"tag"
] | f958a2a70e8a87a31a75326d7b4db77c2f0b4212 | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/CueList.java#L226-L235 | train |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Processor.java | Processor.process | public final static String process(final String input, final Configuration configuration)
{
try
{
return process(new StringReader(input), configuration);
}
catch (final IOException e)
{
// This _can never_ happen
return null;
}
... | java | public final static String process(final String input, final Configuration configuration)
{
try
{
return process(new StringReader(input), configuration);
}
catch (final IOException e)
{
// This _can never_ happen
return null;
}
... | [
"public",
"final",
"static",
"String",
"process",
"(",
"final",
"String",
"input",
",",
"final",
"Configuration",
"configuration",
")",
"{",
"try",
"{",
"return",
"process",
"(",
"new",
"StringReader",
"(",
"input",
")",
",",
"configuration",
")",
";",
"}",
... | Transforms an input String into HTML using the given Configuration.
@param input
The String to process.
@param configuration
The Configuration.
@return The processed String.
@since 0.7
@see Configuration | [
"Transforms",
"an",
"input",
"String",
"into",
"HTML",
"using",
"the",
"given",
"Configuration",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Processor.java#L97-L108 | train |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Processor.java | Processor.process | public final static String process(final File file, final Configuration configuration) throws IOException
{
final FileInputStream input = new FileInputStream(file);
final String ret = process(input, configuration);
input.close();
return ret;
} | java | public final static String process(final File file, final Configuration configuration) throws IOException
{
final FileInputStream input = new FileInputStream(file);
final String ret = process(input, configuration);
input.close();
return ret;
} | [
"public",
"final",
"static",
"String",
"process",
"(",
"final",
"File",
"file",
",",
"final",
"Configuration",
"configuration",
")",
"throws",
"IOException",
"{",
"final",
"FileInputStream",
"input",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"final",... | Transforms an input file into HTML using the given Configuration.
@param file
The File to process.
@param configuration
the Configuration
@return The processed String.
@throws IOException
if an IO error occurs
@since 0.7
@see Configuration | [
"Transforms",
"an",
"input",
"file",
"into",
"HTML",
"using",
"the",
"given",
"Configuration",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Processor.java#L123-L129 | train |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Processor.java | Processor.process | public final static String process(final File file, final boolean safeMode) throws IOException
{
return process(file, Configuration.builder().setSafeMode(safeMode).build());
} | java | public final static String process(final File file, final boolean safeMode) throws IOException
{
return process(file, Configuration.builder().setSafeMode(safeMode).build());
} | [
"public",
"final",
"static",
"String",
"process",
"(",
"final",
"File",
"file",
",",
"final",
"boolean",
"safeMode",
")",
"throws",
"IOException",
"{",
"return",
"process",
"(",
"file",
",",
"Configuration",
".",
"builder",
"(",
")",
".",
"setSafeMode",
"(",... | Transforms an input file into HTML.
@param file
The File to process.
@param safeMode
Set to <code>true</code> to escape unsafe HTML tags.
@return The processed String.
@throws IOException
if an IO error occurs
@see Configuration#DEFAULT | [
"Transforms",
"an",
"input",
"file",
"into",
"HTML",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Processor.java#L238-L241 | train |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Run.java | Run.main | public static void main(final String[] args) throws IOException
{
// This is just a _hack_ ...
BufferedReader reader = null;
if (args.length == 0)
{
System.err.println("No input file specified.");
System.exit(-1);
}
if (args.length > 1)
... | java | public static void main(final String[] args) throws IOException
{
// This is just a _hack_ ...
BufferedReader reader = null;
if (args.length == 0)
{
System.err.println("No input file specified.");
System.exit(-1);
}
if (args.length > 1)
... | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"// This is just a _hack_ ...",
"BufferedReader",
"reader",
"=",
"null",
";",
"if",
"(",
"args",
".",
"length",
"==",
"0",
")",
"{",
"System",
... | Static main.
@param args
Program arguments.
@throws IOException
If an IO error occurred. | [
"Static",
"main",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Run.java#L75-L105 | train |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/cmd/CmdLineParser.java | CmdLineParser.parse | public static List<String> parse(final String[] args, final Object... objs) throws IOException
{
final List<String> ret = Colls.list();
final List<Arg> allArgs = Colls.list();
final HashMap<String, Arg> shortArgs = new HashMap<String, Arg>();
final HashMap<String, Arg> longArgs = ne... | java | public static List<String> parse(final String[] args, final Object... objs) throws IOException
{
final List<String> ret = Colls.list();
final List<Arg> allArgs = Colls.list();
final HashMap<String, Arg> shortArgs = new HashMap<String, Arg>();
final HashMap<String, Arg> longArgs = ne... | [
"public",
"static",
"List",
"<",
"String",
">",
"parse",
"(",
"final",
"String",
"[",
"]",
"args",
",",
"final",
"Object",
"...",
"objs",
")",
"throws",
"IOException",
"{",
"final",
"List",
"<",
"String",
">",
"ret",
"=",
"Colls",
".",
"list",
"(",
"... | Parses command line arguments.
@param args
Array of arguments, like the ones provided by
{@code void main(String[] args)}
@param objs
One or more objects with annotated public fields.
@return A {@code List} containing all unparsed arguments (i.e. arguments
that are no switches)
@throws IOException
if a parsing error o... | [
"Parses",
"command",
"line",
"arguments",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/cmd/CmdLineParser.java#L312-L390 | train |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Utils.java | Utils.readUntil | public final static int readUntil(final StringBuilder out, final String in, final int start, final char end)
{
int pos = start;
while (pos < in.length())
{
final char ch = in.charAt(pos);
if (ch == '\\' && pos + 1 < in.length())
{
pos = esc... | java | public final static int readUntil(final StringBuilder out, final String in, final int start, final char end)
{
int pos = start;
while (pos < in.length())
{
final char ch = in.charAt(pos);
if (ch == '\\' && pos + 1 < in.length())
{
pos = esc... | [
"public",
"final",
"static",
"int",
"readUntil",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"String",
"in",
",",
"final",
"int",
"start",
",",
"final",
"char",
"end",
")",
"{",
"int",
"pos",
"=",
"start",
";",
"while",
"(",
"pos",
"<",
"in",
... | Reads characters until the 'end' character is encountered.
@param out
The StringBuilder to write to.
@param in
The Input String.
@param start
Starting position.
@param end
End characters.
@return The new position or -1 if no 'end' char was found. | [
"Reads",
"characters",
"until",
"the",
"end",
"character",
"is",
"encountered",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L159-L181 | train |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Utils.java | Utils.readMdLink | public final static int readMdLink(final StringBuilder out, final String in, final int start)
{
int pos = start;
int counter = 1;
while (pos < in.length())
{
final char ch = in.charAt(pos);
if (ch == '\\' && pos + 1 < in.length())
{
... | java | public final static int readMdLink(final StringBuilder out, final String in, final int start)
{
int pos = start;
int counter = 1;
while (pos < in.length())
{
final char ch = in.charAt(pos);
if (ch == '\\' && pos + 1 < in.length())
{
... | [
"public",
"final",
"static",
"int",
"readMdLink",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"String",
"in",
",",
"final",
"int",
"start",
")",
"{",
"int",
"pos",
"=",
"start",
";",
"int",
"counter",
"=",
"1",
";",
"while",
"(",
"pos",
"<",
... | Reads a markdown link.
@param out
The StringBuilder to write to.
@param in
Input String.
@param start
Starting position.
@return The new position or -1 if this is no valid markdown link. | [
"Reads",
"a",
"markdown",
"link",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L194-L237 | train |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Utils.java | Utils.readMdLinkId | public final static int readMdLinkId(final StringBuilder out, final String in, final int start)
{
int pos = start;
int counter = 1;
while (pos < in.length())
{
final char ch = in.charAt(pos);
boolean endReached = false;
switch (ch)
{
... | java | public final static int readMdLinkId(final StringBuilder out, final String in, final int start)
{
int pos = start;
int counter = 1;
while (pos < in.length())
{
final char ch = in.charAt(pos);
boolean endReached = false;
switch (ch)
{
... | [
"public",
"final",
"static",
"int",
"readMdLinkId",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"String",
"in",
",",
"final",
"int",
"start",
")",
"{",
"int",
"pos",
"=",
"start",
";",
"int",
"counter",
"=",
"1",
";",
"while",
"(",
"pos",
"<",
... | Reads a markdown link ID.
@param out
The StringBuilder to write to.
@param in
Input String.
@param start
Starting position.
@return The new position or -1 if this is no valid markdown link ID. | [
"Reads",
"a",
"markdown",
"link",
"ID",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L250-L290 | train |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Utils.java | Utils.readXMLUntil | public final static int readXMLUntil(final StringBuilder out, final String in, final int start, final char... end)
{
int pos = start;
boolean inString = false;
char stringChar = 0;
while (pos < in.length())
{
final char ch = in.charAt(pos);
if (inStrin... | java | public final static int readXMLUntil(final StringBuilder out, final String in, final int start, final char... end)
{
int pos = start;
boolean inString = false;
char stringChar = 0;
while (pos < in.length())
{
final char ch = in.charAt(pos);
if (inStrin... | [
"public",
"final",
"static",
"int",
"readXMLUntil",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"String",
"in",
",",
"final",
"int",
"start",
",",
"final",
"char",
"...",
"end",
")",
"{",
"int",
"pos",
"=",
"start",
";",
"boolean",
"inString",
"=... | Reads characters until any 'end' character is encountered, ignoring
escape sequences.
@param out
The StringBuilder to write to.
@param in
The Input String.
@param start
Starting position.
@param end
End characters.
@return The new position or -1 if no 'end' char was found. | [
"Reads",
"characters",
"until",
"any",
"end",
"character",
"is",
"encountered",
"ignoring",
"escape",
"sequences",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L377-L435 | train |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Utils.java | Utils.appendCode | public final static void appendCode(final StringBuilder out, final String in, final int start, final int end)
{
for (int i = start; i < end; i++)
{
final char c;
switch (c = in.charAt(i))
{
case '&':
out.append("&");
... | java | public final static void appendCode(final StringBuilder out, final String in, final int start, final int end)
{
for (int i = start; i < end; i++)
{
final char c;
switch (c = in.charAt(i))
{
case '&':
out.append("&");
... | [
"public",
"final",
"static",
"void",
"appendCode",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"String",
"in",
",",
"final",
"int",
"start",
",",
"final",
"int",
"end",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";"... | Appends the given string encoding special HTML characters.
@param out
The StringBuilder to write to.
@param in
Input String.
@param start
Input String starting position.
@param end
Input String end position. | [
"Appends",
"the",
"given",
"string",
"encoding",
"special",
"HTML",
"characters",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L449-L470 | train |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Utils.java | Utils.appendDecEntity | public final static void appendDecEntity(final StringBuilder out, final char value)
{
out.append("&#");
out.append((int)value);
out.append(';');
} | java | public final static void appendDecEntity(final StringBuilder out, final char value)
{
out.append("&#");
out.append((int)value);
out.append(';');
} | [
"public",
"final",
"static",
"void",
"appendDecEntity",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"char",
"value",
")",
"{",
"out",
".",
"append",
"(",
"\"&#\"",
")",
";",
"out",
".",
"append",
"(",
"(",
"int",
")",
"value",
")",
";",
"out",
... | Append the given char as a decimal HTML entity.
@param out
The StringBuilder to write to.
@param value
The character. | [
"Append",
"the",
"given",
"char",
"as",
"a",
"decimal",
"HTML",
"entity",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L522-L527 | train |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Utils.java | Utils.codeEncode | public final static void codeEncode(final StringBuilder out, final String value, final int offset)
{
for (int i = offset; i < value.length(); i++)
{
final char c = value.charAt(i);
switch (c)
{
case '&':
out.append("&");
... | java | public final static void codeEncode(final StringBuilder out, final String value, final int offset)
{
for (int i = offset; i < value.length(); i++)
{
final char c = value.charAt(i);
switch (c)
{
case '&':
out.append("&");
... | [
"public",
"final",
"static",
"void",
"codeEncode",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"String",
"value",
",",
"final",
"int",
"offset",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"offset",
";",
"i",
"<",
"value",
".",
"length",
"(",
")",
... | Appends the given string to the given StringBuilder, replacing '&',
'<' and '>' by their respective HTML entities.
@param out
The StringBuilder to append to.
@param value
The string to append.
@param offset
The character offset into value from where to start | [
"Appends",
"the",
"given",
"string",
"to",
"the",
"given",
"StringBuilder",
"replacing",
"&",
";",
"<",
";",
"and",
">",
";",
"by",
"their",
"respective",
"HTML",
"entities",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L743-L763 | train |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Line.java | Line.countCharsStart | private int countCharsStart(final char ch, final boolean allowSpaces)
{
int count = 0;
for (int i = 0; i < this.value.length(); i++)
{
final char c = this.value.charAt(i);
if (c == ' ' && allowSpaces)
{
continue;
}
i... | java | private int countCharsStart(final char ch, final boolean allowSpaces)
{
int count = 0;
for (int i = 0; i < this.value.length(); i++)
{
final char c = this.value.charAt(i);
if (c == ' ' && allowSpaces)
{
continue;
}
i... | [
"private",
"int",
"countCharsStart",
"(",
"final",
"char",
"ch",
",",
"final",
"boolean",
"allowSpaces",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"value",
".",
"length",
"(",
")",
";",
... | Counts the amount of 'ch' at the start of this line optionally ignoring
spaces.
@param ch
The char to count.
@param allowSpaces
Whether to allow spaces or not
@return Number of characters found.
@since 0.12 | [
"Counts",
"the",
"amount",
"of",
"ch",
"at",
"the",
"start",
"of",
"this",
"line",
"optionally",
"ignoring",
"spaces",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Line.java#L247-L267 | train |
iwgang/SimplifySpan | library/src/main/java/cn/iwgang/simplifyspan/SimplifySpanBuild.java | SimplifySpanBuild.append | public SimplifySpanBuild append(String text) {
if (TextUtils.isEmpty(text)) return this;
mNormalSizeText.append(text);
mStringBuilder.append(text);
return this;
} | java | public SimplifySpanBuild append(String text) {
if (TextUtils.isEmpty(text)) return this;
mNormalSizeText.append(text);
mStringBuilder.append(text);
return this;
} | [
"public",
"SimplifySpanBuild",
"append",
"(",
"String",
"text",
")",
"{",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"text",
")",
")",
"return",
"this",
";",
"mNormalSizeText",
".",
"append",
"(",
"text",
")",
";",
"mStringBuilder",
".",
"append",
"(",
... | append normal text
@param text normal text
@return SimplifySpanBuild | [
"append",
"normal",
"text"
] | 34e917cd5497215c8abc07b3d8df187949967283 | https://github.com/iwgang/SimplifySpan/blob/34e917cd5497215c8abc07b3d8df187949967283/library/src/main/java/cn/iwgang/simplifyspan/SimplifySpanBuild.java#L191-L197 | train |
iwgang/SimplifySpan | library/src/main/java/cn/iwgang/simplifyspan/SimplifySpanBuild.java | SimplifySpanBuild.appendMultiClickable | public SimplifySpanBuild appendMultiClickable(SpecialClickableUnit specialClickableUnit, Object... specialUnitOrStrings) {
processMultiClickableSpecialUnit(false, specialClickableUnit, specialUnitOrStrings);
return this;
} | java | public SimplifySpanBuild appendMultiClickable(SpecialClickableUnit specialClickableUnit, Object... specialUnitOrStrings) {
processMultiClickableSpecialUnit(false, specialClickableUnit, specialUnitOrStrings);
return this;
} | [
"public",
"SimplifySpanBuild",
"appendMultiClickable",
"(",
"SpecialClickableUnit",
"specialClickableUnit",
",",
"Object",
"...",
"specialUnitOrStrings",
")",
"{",
"processMultiClickableSpecialUnit",
"(",
"false",
",",
"specialClickableUnit",
",",
"specialUnitOrStrings",
")",
... | append multi clickable SpecialUnit or String
@param specialClickableUnit SpecialClickableUnit
@param specialUnitOrStrings Unit Or String
@return | [
"append",
"multi",
"clickable",
"SpecialUnit",
"or",
"String"
] | 34e917cd5497215c8abc07b3d8df187949967283 | https://github.com/iwgang/SimplifySpan/blob/34e917cd5497215c8abc07b3d8df187949967283/library/src/main/java/cn/iwgang/simplifyspan/SimplifySpanBuild.java#L240-L243 | train |
erizet/SignalA | SignalA/src/main/java/com/zsoft/signala/Hubs/HubProxy.java | HubProxy.Invoke | @Override
public void Invoke(final String method, JSONArray args,
HubInvokeCallback callback) {
if (method == null)
{
throw new IllegalArgumentException("method");
}
if (args == null)
{
throw new IllegalArgumentException("args");
}
final S... | java | @Override
public void Invoke(final String method, JSONArray args,
HubInvokeCallback callback) {
if (method == null)
{
throw new IllegalArgumentException("method");
}
if (args == null)
{
throw new IllegalArgumentException("args");
}
final S... | [
"@",
"Override",
"public",
"void",
"Invoke",
"(",
"final",
"String",
"method",
",",
"JSONArray",
"args",
",",
"HubInvokeCallback",
"callback",
")",
"{",
"if",
"(",
"method",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"method\"",... | Executes a method on the server asynchronously | [
"Executes",
"a",
"method",
"on",
"the",
"server",
"asynchronously"
] | d33bf49dbcf7249f826c5dbb3411cfe4f5d97dd4 | https://github.com/erizet/SignalA/blob/d33bf49dbcf7249f826c5dbb3411cfe4f5d97dd4/SignalA/src/main/java/com/zsoft/signala/Hubs/HubProxy.java#L34-L70 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.