method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9c414cb3-a88c-4ca3-8f3a-9005e236e356 | 9 | @Override
public boolean installPackage(String path) {
boolean result = false;
do {
long now = System.currentTimeMillis();
File tmp = new File(TMPPRE + now);
if(!tmp.exists()) {
tmp.mkdirs();
}
String tmpPath;
try {
tmpPath = tmp.getCanonicalPath();
} catch (IOException e1) {
e1.pr... |
0ffff686-d88c-4fe5-93b0-ec25e75650ee | 3 | public static void main(String[] av) throws IOException {
Dumper c = new Dumper();
switch(av.length) {
case 0: c.dump(new StreamDumpGetter(System.in));
break;
default:
for (int i=0; i<av.length; i++)
try {
c.dump(new StreamDumpGetter(new FileInputStream(av[i])));
} catch (FileNotFoundExceptio... |
6414ed66-248e-4205-8fcb-ae44ae95d07d | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Sexo other = (Sexo) obj;
if (this.idSexo != other.idSexo && (this.idSexo == null || !this.idSexo.equals(o... |
9c0d3dc5-bcd6-4b87-a877-38375f5df1c7 | 0 | public void resume() {
resume_egress();
resume_ingress();
} |
614883c0-b8c5-42a1-aa55-42e8b484d17c | 2 | protected InputMap getInputMap(int condition)
{
InputMap map = super.getInputMap(condition);
if (condition == JComponent.WHEN_FOCUSED && map != null)
{
map.put(KeyStroke.getKeyStroke("control S"), "save");
map.put(KeyStroke.getKeyStroke("control shift S"), "saveAs");
map.put(KeyStroke.getKeyStroke("con... |
d93cfe00-5f58-4905-aab7-c56b89be2f10 | 9 | public static void main(String[] args) throws IOException {
//创建一个文件
//我们首先要构造一个path
String first = "D:/a/b/c.txt";
Path path = FileSystems.getDefault().getPath(first);
//创建文件,这里的父路径不存在,所以他会抛出错误
try {
Path file = Files.createFile(path);
} catch (IOExce... |
2b8017fc-3274-4e76-8661-121c676652bd | 5 | private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
... |
0b6fb7c4-990e-4d00-b9be-219b48c325ab | 2 | public boolean isBlack() {
return r == 0.0 && g == 0.0 && b == 0.0;
} |
495b85f7-4cc3-4107-9e95-9fca11f57ee9 | 7 | public boolean calculateDistribution() {
bDeadline = true;
boolean bUsedNewResource = false;
double tmp = 0, rest = 0;
/* distribute tasks according to the sort */
int k;
double lastAllocation;
for (int i = 0; i < iClass; i++) {
print(iStage + " Distribution[" + i + "]");
tmp = 0;
rest = iaTask[... |
916010de-06a1-4e1b-8bfe-f32d44201264 | 8 | public Node delete(Object value) {
Node node = search(value);
if (node == null) {
return null;
}
Node deleted = node.getSmaller() != null && node.getLarger() != null ? node.successor() : node;
assert deleted != null : "deleted can't be null";
Node replacemen... |
37445622-66e0-427c-a4e3-d03574585e64 | 8 | public List<Float> getFloatList(String path) {
List<?> list = getList(path);
if (list == null) {
return new ArrayList<Float>(0);
}
List<Float> result = new ArrayList<Float>();
for (Object object : list) {
if (object instanceof Float) {
r... |
c7d326d7-298e-4c62-b463-5ee262fd0e85 | 8 | private Vector<Integer> particlesOnPlane(int particle, int cubeRoot) {
Vector<Integer> result = new Vector<Integer>();
if(bottomLeftCorner(particle, cubeRoot)){
result.add(particle + 1);
result.add(particle + cubeRoot);
}else if(bottomRightCorner(particle, cubeRoot)){
result.add(particle - 1);
result.... |
ff53de2c-c4d4-47fb-aa97-7ecff1e059fc | 0 | public static byte[] intToByteArray(int i) {
byte[] bytes = new byte[4];
// 0是高位,3是低位
// 0xFF=255,即8位的1111 1111,亦即32位的0000 0000 0000 0000 0000 0000 1111 1111
// 作用即是抛弃32位的前24位,保留后8位。
bytes[0] = (byte) ((i >> 24) & 0xFF);
bytes[1] = (byte) ((i >> 16) & 0xFF);
bytes[2] = (byte) ((i >> 8) & 0xFF);
bytes[3]... |
b6e21ec3-4929-4afe-8c52-11c21dd4c7d5 | 7 | public void write (Kryo kryo, Output output, T object) {
Class type = object.getClass();
for (int i = 0, n = properties.length; i < n; i++) {
CachedProperty property = properties[i];
try {
if (TRACE) trace("kryo", "Write property: " + property + " (" + type.getName() + ")");
Object value = property.ge... |
61cd3816-c481-48a5-92bb-aeaf107d0ac5 | 0 | public void setPrpUsuario(String prpUsuario) {
this.prpUsuario = prpUsuario;
} |
555a4164-a8e0-40ff-ac0f-a6e7ae6f4faf | 7 | public static void main(String[] arg) {
try {
JSch jsch = new JSch();
String host = null;
if (arg.length > 0) {
host = arg[0];
} else {
host = JOptionPane.showInputDialog("Enter username@hostname", System.getProperty("user.name")
+ "@localhost");
}
String user = host.substring(0, host... |
5f5d926b-7040-4eb8-8743-e4b681e53ecf | 3 | public boolean exists(String value) {
if (!isEmpty()) {
ListElement current = head;
while (current != tail.next()) {
if (current.getValue().equals(value)) {
return true;
}
current = current.next();
}
... |
f58054cd-ad68-4a17-801f-5c2d331e92c1 | 8 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int size = Integer.parseInt(line.trim());
char[... |
9f4af740-8e88-43d1-9d3c-6c8f3f146c84 | 6 | private void verifyDB(){
auctions=auctionDB.checkAuctionDB();
if (auctions==null||auctions.size()==0) return;
for(int i=0;i<auctions.size();i++){
if(!auctions.get(i).getAuctionTime().after(new Timestamp(System.currentTimeMillis()))){
try{
if(auctions.get(i).getCurrentPrice()>auctions.get(i).g... |
a261d776-c654-44e1-9ca8-8b0f6e1a1374 | 1 | public synchronized boolean remover(int i)
{
try
{
new FonteFinanciamentoDAO().remover(list.get(i));
list = new FonteFinanciamentoDAO().listar("");
preencherTabela();
}
catch (Exception e)
{
return false;
}
return true;
} |
616015ec-e9fe-465e-807c-6f1bf330c79a | 0 | public String getAlgorithm() {
return algorithm;
} |
96e0acd3-f07b-4e41-b1c3-246016ac2552 | 3 | @EventHandler
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
if (plugin.getWorlds().get(event.getEntity().getWorld()).isSuppressHealthRegain() &&
(event.getRegainReason() == RegainReason.REGEN || event.getRegainReason() == RegainReason.SATIATED)) {
event.setCancelled(true);
}
} |
c700f311-2884-4b34-934a-9b9f0c71967b | 0 | protected final void setVersion(String version) {
this.version = version;
} |
6bf7e1f0-a189-4b24-819a-3d16b04e835e | 0 | @Basic
@Column(name = "id_pos")
public int getIdPos() {
return idPos;
} |
bc611d1d-8a4a-4767-a295-a8aa416b6f29 | 6 | public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
// Start typing your Java solution below
// DO NOT write main() function
if (l1 == null)
return l2;
if (l2 == null)
return l1;
ListNode res = new ListNode(0);
ListNode cur = res;
while (l1 != null && l2 != null) {
if (l1.val <= l2.val) {
... |
c036bdaf-5a94-459c-8d61-06a2c9045ee5 | 7 | public void addOre(Ore ore) {
switch (ore) {
case STONE: xStone++; break;
case IRON: xIron++; break;
case GOLD: xGold++; break;
case DIAMOND: xDiamond++; break;
case EMERALD: xEmerald++; break;
case LAPIS: xLapis++; break;
default: break;
}
if (xLevelUpdate == XLEVEL_UPDATE_INTERVAL) {
calcXle... |
61112c17-130c-4b15-b1a6-9f4e27555280 | 4 | @Override
public void run(CommandInvocation invocation) throws FilterException
{
boolean restrict = true;
for (Class<?> clazz : this.sources)
{
if (clazz.isAssignableFrom(invocation.getCommandSource().getClass()))
{
restrict = false;
}
... |
69a26201-f9bc-4ccd-b2f7-a289df16904f | 6 | public static String getWinningVote(Proposal proposal) {
// Create an index of options -> numVotes
Map<Integer, Integer> voteCount = new HashMap<Integer, Integer>();
System.out.println(proposal);
VoteModel voteModel = new VoteModel();
for (Integer i : proposal.getVotes()) {
... |
23f53df9-a770-4d5a-b6fe-5561a902c7ee | 4 | private byte[] readBytes(int bytesToWrite) {
int samplesToWrite = bytesToWrite / 2;
float[] buffer = new float[NUM_SAMPLES];
byte[] answer = new byte[2 * NUM_SAMPLES];
synchronized(this) {
Iterator<SoundPlay> iterator = this.buffers.iterator();
while(iterator.hasNext()) {
if(iterator.next().writeSam... |
67d85ba1-95c6-43b6-9ddb-005e1bbde99b | 2 | public void setPrerequisites(String prerequisites) {
if(prerequisites == null || prerequisites.length() == 0) {
JOptionPane.showMessageDialog(null,
"Error: prerequisites cannot be null of empty string");
System.exit(0);
}
this.prerequisites = prerequis... |
2c797ced-d110-4d4e-994c-030669dcaa8c | 9 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 75
replab0: while (true) {
v_1 = cursor;
lab1: do {
// (, line 75
// [, line 77
bra = cursor;
// substring, line 77
among_var = find_among(a_1, 4);
if (among_var == 0) {
break lab1;
}
// ], line 77
... |
b4a96012-a46d-42bc-a1a8-37be570c3214 | 3 | @Override
public void handle(ChannelHandlerContext ctx, FullHttpRequest request) throws Exception {
//Get the correct DynmapServer
String world = request.getUri().split("/")[3].split("\\.")[0];
for (DynmapServer dynmapServer : Main.getDynmapServers()) {
for (DynmapWorld dynmapWor... |
1e3c2f11-90a4-4220-a8e4-c44a457efbe8 | 5 | @EventHandler(priority=EventPriority.MONITOR)
public void onInventoryClick(final InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked();
if(e.isLeftClick() || e.isRightClick() || e.isShiftClick()){
if(DBmanager.menues.containsKey(p.getName())){
e.setCancelled(true... |
87d67e0d-8e51-45f7-8131-639e37f2b47e | 1 | private void walk(MenuElement element, List<MenuElement> list) {
list.add(element);
for (MenuElement data : element.getChildren()) {
walk(data, list);
}
} |
e608aa43-0c4b-47b2-9823-3b73633bedfb | 3 | public void newChatEvent(ActionEvent ae) {
ChatEvent chatEvent = new ChatEvent(getController().getUser(), ae.getActionCommand());
if (chatEvent.getMsgArr().length > 0) {
if (chatEvent.isCommand()) {
if (chatEvent.getCommand() == ChatCommand.PRIV_MSG) {
chatEvent.setRec(Receipient.QUERY, chatEvent.getMsg... |
6c2eccae-9600-4f23-9427-ded2e09ef512 | 3 | public void act(Environment enviro){
int entityAmount = enviro.getEntityAmount();
for(int i = 0; i < entityAmount; i++){
Entity indexedEnt = enviro.getEntity(i);
if(!(this == indexedEnt)){
if(!isCollidedWith(indexedEnt)){
applyPhysics(enviro);
System.out.println(name + " has collided with " + ind... |
a9122261-6b29-4583-b830-dfa4cb4518c9 | 9 | @Override
public void findInitialSolution() throws UnlimitedProblemException {
logger.info("Getting the initial solution through the two-phases method");
// ==> Create the augmented model for the first phase
Collection<Integer> firstPhaseAugmentedVariablesIds = new ArrayList<Integer>();
// Set the va... |
f8c57d9a-c991-43c0-8346-c273698a3eb4 | 5 | private boolean colDectUP() {
if (Controler.up) {
colBox.y -= Game.pSpeed;
yPrev += Game.pSpeed / 4;
}
colBox.setBounds(colBox.x, colBox.y, colBox.width, colBox.height);
for (int i = 0; i < world.tiles.length; i++) {
for (int j = 0; j < world.tiles[0].length; j++) {
if (colBox.intersects(world.tile... |
03a10279-e5a0-452d-9046-904af2bfcd60 | 5 | public String removeDuplicates(String s){
String newString="";
boolean isDuplicate=false;
for(int i=0; i<s.length(); i++){
for(int j=0; j<s.length();j++){
if(i!=j){
//duplicate character
if(Character.toLowerCase(s.charAt(i))==Ch... |
21e24652-1072-4ea9-8aff-4f893f4a4bfe | 6 | @EventHandler
public void EndermanPoison(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getEndermanConfig().getDouble("Enderman.Po... |
11655a7e-f9e8-4563-8eb7-739932619713 | 6 | @SuppressWarnings({ "javadoc", "resource", "unused" })
public static void main(String args[]) throws IOException {
if (args.length != 1) {
System.out.println("Usage: SortCheck <file>");
return;
}
File f = new File(args[0]);
int filelength = (int)f.length();
... |
9a447f21-660d-4a05-94a8-3a75a84e5807 | 9 | @Override
public Subtitles parse(InputStream inputStream, String charset, double fps)
throws UnsupportedSubtitlesFormatException {
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(inputStream,
charset));
Subtitles subtitles = new Subtitles(fps);
String line;
... |
da6ddaf9-e168-4918-8f16-f347102c1034 | 3 | public Shoe(GUI Gui)
{
gui = Gui;
for (int a = 0; a < gui.getNumDecks(); a++)
{
int count = 1;
// Creates a single deck of each card value and rank and shuffles it
for (int i = 12; i >= 0; i--)
{
Value value = Value.values()[i];
for (int j = 0; j < 4; j++)
{
Suit suit... |
41e2e776-5508-47d2-9269-c466af1fc290 | 4 | public void write(char c) {
parent.cells.get(currentSelected).write(c);
if (parent.cells.get(currentSelected).getId().equals("searchAuthor") ||
parent.cells.get(currentSelected).getId().equals("searchTitle")) {
parent.tracksManager.makeTheList(null);
}
if (parent.cells.get(currentSelected).getId().equals(... |
9a63be7f-9ea4-49a7-88d2-769a6c5c60d2 | 0 | public BrowserType getBrowserType() {
return browserType;
} |
c2c36c1a-935e-4a1e-8dea-c0dc5910b806 | 4 | private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
// TODO add your handling code here:
liceu.Administrator admin = new liceu.Administrator();
admin.delMaterie((String)materieDeSters.getSelectedItem());
materieDeSters.removeAll... |
1d3d4483-5ccf-4548-9503-4fb9e2669a39 | 6 | public String VulnerabilityInjection(DatabaseAccess JavaDBAccess, PHPFileOperations PHPFile, String TargetPHPFileSelectedComboBox, Boolean AffectSQLStatic, Boolean AffectSQLDynamic) {
String PHPFileText = null, PHPFileTextClean = ""; //The text of the PHP file where we want to inject the vulnerabilities
... |
8bc92161-40e3-452c-a0e3-ac82e033cb5f | 4 | public void getLongestCommonSubstring(String s1, String s2) {
char[] x = s1.toCharArray();
char[] y = s2.toCharArray();
int[][] c = new int[x.length + 1][y.length + 1];
int max = 0, startIndex = 0;
for (int i = 1; i <= x.length; i++) {
for (int j = 1; j <= y.length; j++) {
// two possiblilities
i... |
c5674240-9a20-4360-a36e-5e23eedb5200 | 4 | private void generateGame() {
if (this.tileSize8.isSelected())
Core.TILESIZE = 8;
else if (this.tileSize16.isSelected())
Core.TILESIZE = 16;
else if (this.tileSize24.isSelected())
Core.TILESIZE = 24;
else if (this.tileSize32.isSelected())
C... |
42094760-0ce5-4955-9658-3fc340571aae | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OsmObjectKey other = (OsmObjectKey) obj;
if (item_id == null) {
if (other.item_id != null)
return false;
} else if (!item_id.equals(othe... |
df1f4b02-09e2-487a-9174-a35aa7c6e92f | 6 | private void saveProblem() {
fileChooser.setDialogTitle("Save Problem File");
fileChooser.setMultiSelectionEnabled(false);
fileChooser.setFileFilter(new FileNameExtensionFilter("PDDL Files",
"pddl"));
fileChooser.setSelectedFile(new File(problemNameField.getText()
+ ".pddl"));
int returnValue = fileCh... |
c87c45aa-f9ac-4268-a74f-074b14fbf6ef | 8 | @Override
public void setMode(Pin pin, PinMode mode) {
// validate
if (!pin.getSupportedPinModes().contains(mode)) {
throw new InvalidPinModeException(pin, "Invalid pin mode [" + mode.getName()
+ "]; pin [" + pin.getName() + "] does not support this mode.");
}... |
f1979dc5-a37b-4e4f-8d8c-73d5b7480968 | 4 | public SimpleRunCPE(String args[]) throws Exception {
mStartTime = System.currentTimeMillis();
// check command line args
if (args.length < 1) {
printUsageMessage();
System.exit(1);
}
// parse CPE descriptor
System.out.println("Parsing CPE Descriptor");
CpeDescription cpeDesc =... |
2bf80815-d4a0-482a-bcaa-ad205b7f1a65 | 4 | public File getRandomContainerPNG() {
File dir = new File(MainClass.CONTAINERS_DIR);
if (!dir.exists()) {
dir.mkdir();
}
if (!dir.exists() || !dir.isDirectory()) {
return null;
}
File[] files = dir.listFiles(new FilenameFilter() {
@O... |
6461f2a6-4728-44a1-a52b-986092908d89 | 9 | int insertKeyRehash(long val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look u... |
907b06a3-ae3d-4633-8dfa-76ad779207c8 | 4 | @Override
public void run() {
this.task.setState(TaskState.RUNNING);
MapTask mapTask = (MapTask) this.task;
String jar = mapTask.getParentJob().getJar();
String mapClassName = mapTask.getParentJob().getMapClass();
Class<?> mapClazz;
try {
logsWriter.write(... |
01a72a53-941e-4d0c-992d-cfef634f858c | 1 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + fuelCapacity;
result = prime * result + fuelLevel;
result = prime * result + (infinite ? 1231 : 1237);
result = prime * result + tier;
return result;
} |
952cc0c8-266f-4b18-a288-3dc6f4a0464d | 1 | public void testSeDurationAfterStart_RI2() {
MutableInterval test = new MutableInterval(TEST_TIME1, TEST_TIME2);
try {
test.setDurationAfterStart(new Duration(-1));
fail();
} catch (IllegalArgumentException ex) {}
} |
adae3c3c-c6ca-4a9b-b789-aac84653a0af | 9 | @Override
public V remove(K key) {
// default: search in old table
int index = Math.abs(key.hashCode() % data.length);
Node<K, V>[] currentTable = data;
// decide whether to search in old or new table
if (index < min) {
index = Math.abs(key.hashCode() % datanew.length);
currentTable = datanew;
... |
8bb7639e-9fbb-42fc-a60f-4154d9e9a075 | 8 | private void getConfigJson(int APIKeyId) {
String configJson = "";
try {
BufferedReader reader = new BufferedReader(new FileReader("/usr/local/skysql/config/manager.json"));
String tmp;
while ( (tmp = reader.readLine()) != null ) {
configJson += tmp;
}
reader.close();
GsonConfig gsonConfig = G... |
30ee260d-77eb-4316-a1bc-7a11af246921 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
d1a62fdc-e032-4d65-951a-8c9776a01be0 | 3 | private void jTextField1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyTyped
ListModel model = jList1.getModel();
if (jTextField1.getText().length() > 5)
for (int i = 0; i < model.getSize(); i++)
if (model.getElementAt(i).toString().contains(jTextFiel... |
ff34d7a9-da3b-49f2-a4f7-5995b3d2c3d3 | 2 | public Boolean isOwner(Player player, SlotMachine slot) {
if(isAdmin(player) || slot.getOwner().equalsIgnoreCase(player.getName())) {
return true;
}
return false;
} |
28c4c770-5593-45fa-b557-6a3d75db942f | 8 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if((ticking instanceof Environmental)
&&(tickID==Tickable.TICKID_MOB)
&&(thingsToSay.size()>0)
&&(canFreelyBehaveNormal(ticking))||(!(ticking instanceof MOB)))
{
final Room R=CMLib.map().roomLocation((Environmental)ticking);
synchronized(th... |
8de4fb3e-d61c-494f-a533-92b93a5b1daa | 3 | private void moverNaves() {
int nNaves = juego.getnNaves();
List<Nave> nav = naves;
List<Nave> list;
try{
list = (nNaves == 2) ? nav : nav.subList(0, 1);
if(moverListSolido(list)<=0)
gameOver();
}catch(java.lang.IndexOutOfBoundsException e){
... |
5891c604-4d1b-4d70-84e5-8d4b1163dc71 | 2 | public void playNextRound() {
setChanged();
for (int i = 0; i < getBoardWidth(); i++) {
for (int j = 0; j < getBoardHeight(); j++) {
board[i][j].updateStatus();
}
}
increaseRound();
notifyObservers();
} |
355bbbc2-d58c-4ee4-9892-34a470a7be50 | 7 | @Override
public int adjustedLevel(MOB caster, int asLevel)
{
if(caster==null)
return 1;
final int lowestQualifyingLevel=CMLib.ableMapper().lowestQualifyingLevel(this.ID());
int adjLevel=lowestQualifyingLevel;
if(asLevel<=0)
{
final int qualifyingLevel=CMLib.ableMapper().qualifyingLevel(caster,this);
... |
1f8692da-ee55-43cc-b57b-a2902b277c1e | 5 | private static Map<String, PropertyDescriptor> getProperties(Class<?> javaType) {
Map<String, PropertyDescriptor> propertyDescriptorMap = new HashMap<>();
for (PropertyDescriptor propertyDescriptor : PropertyUtils.getPropertyDescriptors(javaType)) {
if (propertyDescriptor.getName().equals("class")) {
... |
2ee71e08-ca92-4d3b-9fed-61dcbd1c37f0 | 2 | public static int deltaBetweenSequenceNumbers(int earlierSequenceNumber, int laterSequenceNumber) {
int delta = laterSequenceNumber - earlierSequenceNumber;
if(delta < (Packet.MINIMUM_SEQUENCE_NUMBER - Packet.MAXIMUM_SEQUENCE_NUMBER)/2)
delta += Packet.MAXIMUM_SEQUENCE_NUMBER - Packet.MINIMUM_SEQUENCE_NUMBER + 1... |
b0fb96f8-b084-488d-a456-e92e8dde5948 | 3 | private static void showJobs(ApiAuthorization auth, Connection conn) {
AbstractIndustryJobsParser parser = IndustryJobsParser.getInstance();
IndustryJobsResponse response;
int completed = 0;
try {
response = parser.getResponse(auth);
Collection<ApiIndustryJob> industryJobs = response.getAll();
for (Api... |
1c6bbd3f-cea1-4796-949b-b86934ec48bb | 6 | public void gravarMatricula() {
boolean temMatricula = false;
if (registroSelecionado == null) {
JOptionPane
.showMessageDialog(null,
"É necessário selecionar um registro de aluno para confirmar a matrícula.");
} else {
Matricula matricula = new Matricula();
matricula.setAluno(registroSelecio... |
958c55fe-3b6e-4677-a06a-8181ff14505f | 9 | protected void printAttributeSummary(boolean nominalPredictor,
boolean numericPredictor,
boolean stringPredictor,
boolean datePredictor,
boolean relationalPredi... |
4097e19b-59a9-4e05-a105-ad7df919285f | 9 | public static void daxpy_f77 (int n, double da, double dx[], int incx, double
dy[], int incy) {
int i,ix,iy,m;
if (n <= 0) return;
if (da == 0.0) return;
if ((incx == 1) && (incy == 1)) {
// both increments equal to 1
m = n%4;
for (i = 1; i <= m; i... |
027982ab-2f09-4787-b78b-b95251c4c5ee | 9 | public void addRow(){
if(ConfigurationLoader.MAX_FOURMILIERES > data.size()) {
List<Case> cases_libres = new ArrayList<Case>();
for(Case c : m.get_cases()) {
if(c.getNiveau_obstacle() == 0) {
boolean libre = true;
for(Object[] d :... |
b19a38c7-3026-4db7-ad99-dd6b181bba0c | 6 | private static double[] buildScoreArray(String string, String abbreviation) {
double[] scores = new double[string.length()];
String lower = string.toLowerCase();
String chars = abbreviation.toLowerCase();
int lastIndex = -1;
boolean started = false;
... |
57c69e9b-b2e4-4b1c-b55b-c0c76d9f8567 | 7 | protected synchronized void imdct(final float[] frq, final float[] window, final int[] pcm) {// ,
// float[]
// out){
... |
6ac5f1f8-5679-4945-972b-d668c7fa9535 | 2 | public void set(EntradaBean oEntradaBean) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
oMysql.initTrans();
if (oEntradaBean.getId() == 0) {
oEntradaBean.setId(oMysql.insertOne("entrada"));
}
oMysql.updateOne(oEntradaBean.... |
7f5993e6-2131-44b8-9469-eb2364d697b8 | 3 | private Boolean shouldFilter(final String msg) {
if ((this.filter != null) && (this.filter.filter(msg))) {
return true;
} else if (this.filter == null) {
return true;
}
return false;
} |
57326ee8-d027-4b53-9a96-c7cb8538be5c | 6 | public void printResultSet() {
if (rs != null) {
try {
ResultSetMetaData md = rs.getMetaData();
for (int i = 1; i <= md.getColumnCount(); i++) {
System.out.printf("%-35s\t", md.getColumnName(i));
}
System.out.println... |
c6240171-4f6c-4501-b41a-68fa2b096760 | 3 | private void verifDoublonCooordonnees(List<Noeud> reseau, Noeud nouveauNoeud) throws XmlParserException
{
try {
for (Noeud n:reseau)
{
if (n.memeCordonnes(nouveauNoeud))
{
throw new XmlParserException("Erreur s???mantique:Pr???sence de doublons (Noeuds ayant les m???mes coordonn???es)");
}... |
15087b19-2daa-4190-a5f7-96fce457eb10 | 4 | private String buildSTR() {
int k = 0;
String str = "";
String err = "";
do {
str += (char) c;
k++;
c = getchar();
err += (char) c;
//System.out.println("Log: buildSTR: read in: " + (char)c);
} while ((char)c != '"' && c != -1);
putback = true;
str += '"';
//System.out.println("Log: build... |
734160d2-8a84-422b-a9fb-01334ed12367 | 2 | public CounterPartySelector(Statement statement, Statements statements, CounterParties counterParties) {
super("Select Counterparty");
this.statement = statement;
this.counterParties = counterParties;
oldCounterParty = null;
newCounterParty = null;
// COMPONENTS
oldCounterPartyCombo = n... |
2888a90f-5950-4b5c-8cb4-04ae5dfff2a4 | 4 | public MethodVisitor visitMethod(final int access, final String name,
final String desc, final String signature, final String[] exceptions) {
StringBuffer sb = new StringBuffer();
appendAccess(access, sb);
AttributesImpl att = new AttributesImpl();
att.addAttribute("", "access", "access", "", sb.toString())... |
f8dc543c-43a0-49dc-924e-e026aaa8cbb6 | 1 | public static byte[] bytesOf(Object obj) {
try {
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(byteOut);
oos.writeObject(obj);
return byteOut.toByteArray();
}
catch(IOException e) {
e.printStackTrace();
return null;
}
} |
8dc2fc61-9d97-43b3-91da-be9328b7e1c4 | 5 | public void keyPressed(KeyEvent e)
{
switch(e.getKeyCode())
{
case 27: exitGame=true; break;//ESC
case 40: p.deleteArrow(1); break;//downArrow
case 37: p.deleteArrow(2); break;//leftArrow
case 39: p.deleteArrow(3); break;//rightArrow
case 38: p.deleteArrow(4); break;//UpArrow
}
} |
d861137e-93cc-45eb-808a-7053480f75f9 | 9 | @Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D graphics = (Graphics2D) g;
if(imageWidth == 0 || imageHeight == 0)
{
return;
}
for(int x = 0; x < this.getWidth(); x += imageWidth)
{
for(int y = 0; y < this.getHeight(); y += imageHeight)
{
grap... |
b7f048c2-d402-40c0-b4a1-776f2b74996a | 5 | public void initialise(World world) throws PatternFormatException
{
String[] cellParts = cells.split(" ");
for (int i=0;i<cellParts.length;i++)
{
char[] currCells = cellParts[i].toCharArray();
for (int j=0;j<currCells.length;j++)
{
if (currCells[j] != '1' && currCells[j] != '0') ... |
ad709129-c368-4d50-be81-b64dde7d646f | 1 | public String countAndSay(int n) {
String sta = "1";
String end ="";
for(int i=0;i< n-1;i++){
end = say(sta);
sta = end;
}
return sta;
} |
1922a44c-59ee-4c66-95e1-c4ed1bd57e24 | 8 | @Override
public void add(String str)
{
skipListNode s = head;
skipListNode[] newSkip = new skipListNode[maxLevel + 1];
for (int i = level; i >= 0; i--)
{
while (s.next[i] != null && s.next[i].data.compareTo(str) < 0)
{
s = s.next[i];
// if the str is not... |
4562962d-a0ab-42ed-8f4b-0a2cad6eaade | 5 | /** @see org.lateralgm.joshedit.FindDialog.FindNavigator#findPrevious() */
@Override
public void findPrevious() {
if (FindDialog.wrap.isSelected() && joshText.caret.row == joshText.getLineCount() - 1) {
joshText.caret.col = 0;
joshText.caret.row = 0;
}
String ftext = tFind.getText();
if ... |
4a03a04b-9b87-4ba9-a4d8-0185bbc5aa4b | 9 | private String getChineseNum(int num) {
switch (num) {
case 1: return "一";
case 2: return "二";
case 3: return "三";
case 4: return "四";
case 5: return "五";
case 6: return "六";
case 7: return "七";
case 8: return "八";
... |
713ef130-078c-4125-af87-d2e6906d4b98 | 3 | @SuppressWarnings("nls")
private static final boolean hasBillionsSuffix(String buffer) {
return buffer.endsWith("b") || buffer.endsWith("B") || buffer.endsWith("g") || buffer.endsWith("G");
} |
ba5856c8-da0b-468b-9a1f-658ef429af6f | 4 | public int getHighScore()
{
String path = urlName + "?mode=getHigh";
InputStream in = null;
try {
URL url = new URL(path);
in = url.openStream();
int numRead = in.read(bytes);
if( numRead != -1 )
return Integer.parseInt(new String(bytes).trim());
}
catch (Exception e)
{
System.out.print... |
73d9b567-c007-4636-bde7-82804ce354c8 | 7 | public Vector read(String filename){
Vector sequence_list = new Vector();
pos = 0; char tmp;
data = loadfile(filename);
tmp = getNextToken(); // ">"
do{
String sequence = "";
String organName = "";
//read header name
... |
0d5922b4-0848-416a-b9be-443c7bb84c10 | 9 | public void actionPerformed(ActionEvent evt)
{
double[] value= new double[7];
String[] languages = new String[7];
Color[] partycolours = new Color[7];
String charttitle = "The Parties";
Object source = evt.getSource();
if (source == initBtn)
{
int intizedouble = 0;
for (int d=0; d<7; d+... |
f522af91-40b0-4cd1-bfb3-247fbed46c80 | 5 | public void fadeOut(FilenameURL filenameURL, long milis) {
if (!toStream) {
errorMessage("Method 'fadeOut' may only be used for "
+ "streaming and MIDI sources.");
return;
}
if (milis < 0) {
errorMessage("Miliseconds may not be negative in method "
+ "'fadeOut'.");
return;
}
fadeOutMili... |
baacfb19-818d-4262-9745-0d5e6422ccf6 | 1 | public boolean getIndexNull(int Index){
if(Textures[Index] == null){
return true;
}else{
return false;
}
} |
648b1874-d3d8-42c3-a89c-5d1f1d9b0fa0 | 7 | public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SerialChainFilter)) return false;
SerialChainFilter other = (SerialChainFilter) o;
if (this.chain.length != other.getChain().length ||
this.actionType.length != other.getActionType().length)
... |
50ec4824-4fcc-4f2d-911b-4a4211bdcd47 | 6 | public static Stella_Object accessMemoizableIteratorSlotValue(MemoizableIterator self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Stella.SYM_STELLA_BASE_ITERATOR) {
if (setvalueP) {
self.baseIterator = ((Iterator)(value));
}
else {
value = self.baseI... |
6dca31fd-af5a-4c58-a809-86fd37f2a0a9 | 2 | @Override
public boolean equals (Object vector) {
try {
Vector other = (Vector) vector;
return (fuzzyEquals(getMagnitude(), other.getMagnitude()) &&
fuzzyEquals(getDirection(), other.getDirection()));
}
catch (ClassCastException e) {
r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.