method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
bd80bff5-579e-4cc1-beac-1058caabd89c | 7 | public void mouseButtonEvent(MouseEvent event) {
if (event.isConsumed())
return;
int m = event.getModifiersEx() & MODIFIER_MASK;
if (event.getButton() == MouseEvent.BUTTON2)
m &= ~MouseEvent.ALT_DOWN_MASK;
if (event.getButton() == MouseEvent.BUTTON3)
m &= ~MouseEvent.META_DOWN_MASK;... |
5297eb8e-ead3-40bb-b10f-00618d21f6e7 | 5 | private boolean isGewonnen(Figur[] figurenArray, int[][] zielPos) {
boolean besetzt;
for (int zielNr = 0; zielNr < zielPos.length; zielNr++) {
besetzt = false;
for (Figur figur : figurenArray) {
if (figur.getZeile() == zielPos[zielNr][0]
&& figur.getSpalte() == zielPos[zielNr][1]) {
besetzt ... |
eb3d13fd-2731-4d40-b8ed-41a9e07a4500 | 2 | public void startClient() {
localPlayer = new Player("O", this.nextMove);
final Client gameClient = new Client(localPlayer, nextMove, this.whoseTurn);
gameClient.addGameEventListener(this);
try {
gameClient.connect();
remotePlayer = gameClient.waitForServerPlayer... |
befa5347-046c-4a13-98f7-347a99ee64f7 | 8 | private int checkState() {
int win = -1;
if (checkDiagonal(0)) {
win = board[0][0];
} else if (checkDiagonal(2)) {
win = board[0][2];
}
//проверка остальных линий
if (win == -1)
for (int i = 0; i < board.length; i++) {
... |
30cb971e-e27e-41e7-b6cf-79555bd2c029 | 9 | public void applyGravity(List<GameObject> nearby) {
boolean[] surroundings = checkSurroundings(nearby);
// array[0] = north, surroundings[1] = south, surroundings[2] = east, surroundings[3] = west
boolean north = surroundings[0];
boolean south = surroundings[1];
boolean east = surroundings[2];
boolean west ... |
5994ddba-568c-499f-9657-a9f6112b2ef2 | 7 | private String establishSocks5UploadConnection(Socket connection) throws XMPPException, IOException {
OutputStream out = new DataOutputStream(connection.getOutputStream());
InputStream in = new DataInputStream(connection.getInputStream());
// first byte is version should be 5
... |
56aba9d5-74ae-44a8-8f4f-a1f921abc2f6 | 5 | public void testJIoSocket() throws Exception
{
ServerSocket serverSocket = new ServerSocket(10002);
Socket socket = null;
try
{
while (true)
{
socket = serverSocket.accept();
System.out.println("socket连接:" + socket.getRemoteSock... |
d95e9b8b-5314-44e1-b1d4-3595d5b456d7 | 1 | @Override
public boolean action() throws JSONException {
Output.printClockLn("HopTop-Feld", Output.INFO);
Control.sleep(10);
JSONObject set = Utils.getJSON("bundesklatsche/set_hoptop/"
+ getResult().getJSONObject("char").getInt("beute"));
int code = Math.round(((set.getInt("srn") * 5 + 234) * 2 - 1104) /... |
0ac53c47-3e93-4374-9eb0-9ccd097c8dae | 2 | @Override
public boolean addItemToInventory(Item item) {
for (int i = 0; i < contains.length; i++){
if (contains[i] == null){
contains[i] = item;
return true;
}
}
return false;
} |
32596cd9-0a16-4c43-9e5d-57b9576f12b1 | 8 | public boolean istGroesseAendernUnproblematisch(int breite, int hoehe)
{
assert breite > 0 : "Vorbedingung verletzt: breite > 0";
assert hoehe > 0 : "Vorbedingung verletzt: hoehe > 0";
if(breite < _buttons.length)
{
for(int y = 0; y < getHoehe(); ++y)
{
for(int x = breite; x < getBreite(); ++x)
... |
8a35905a-5d5c-4502-9a2a-c263d0e34592 | 6 | private void addCrew() {
squareSelector.reset();
squareSelector.setCriteria(new SquareCriteria() {
private final String desc = "Add: Crew";
public String getDescription() { return desc; }
public boolean isSquareValid( SquareSelector squareSelector, int roomId, int squareId ) {
if ( roomId < 0 || squa... |
6a0a4ff6-6324-407d-a053-b92932c003be | 3 | public void stockShelves() {
if (level == 1 || level ==2 || level ==3) {
merchandise[0] = new Weapon(10, 50, "Shitty Axe", 1);
merchandise[1] = new Armor(5, 40, "Cardboard Chest Plate", 2);
merchandise[2] = new Shield(2, 2, "Basic Shield", 2, 2);
merchandise[3] = new Consumable(10, "Weak Healing Potion", ... |
954c5ef3-4d67-4042-b46a-444fb0b0bbe0 | 7 | public void spawnWave(Client c) {
if (c != null && c.inBarbDef) {
c.getCombat().resetPrayers();
if (c.barbWave >= WAVES.length) {
endGame(c, true);
c.barbWave = 0;
return;
}
if (c.barbWave < 0)
return;
int npcAmount = WAVES[c.barbWave].length;
for (int j = 0; j < npcAmount; j++) ... |
0129fa83-6b7f-442f-964b-ea5421d40f9b | 8 | static int Load() {
try {
javaPath = new JavaPathMgmt(configBean);
if (!Load.It().InitNative(javaPath, "")) {
return 0; // user cancelled
}
if (Load.It().Init()) {
passwordImageMgmt = new PasswordImageM... |
7e47166c-a15e-4397-9ec6-8266d2e692fd | 1 | private void refreshFootprints() {
for (int i = 0; i < numSlots; i++) {
refreshFootprint(i);
}
} |
fe767ae7-e5ad-4ffc-84f1-6ac731aaf96f | 2 | public final synchronized Phasor readPhasor(){
this.inputType = true;
String word="";
Phasor ph = null;
if(!this.testFullLineT) this.enterLine();
word = nextWord();
if(!eof)ph = Phasor.parsePhasor(word.trim());
... |
4b53d955-d7b6-4125-a9a7-09b30de4f661 | 0 | public void visiteurSelectionner (){
Visiteur visiteurSelect = (Visiteur) getVue().getjComboBoxVisiteur().getSelectedItem();
getVue().getTxtNom().setText(visiteurSelect.getNom());
getVue().getTxtPrenom().setText(visiteurSelect.getPrenom());
getVue().getTxtAdrs().setText(visiteurSelect.ge... |
ef2bb976-4960-4df1-ae7d-2f67d6acb882 | 1 | private RouteLength currentShortestLength()
{
RouteLength shortestRouteLength = new RouteLength();
if (routes.size() > 0)
{
shortestRouteLength = routes.get(0).getLength();
}
return shortestRouteLength;
} |
a9f513d3-d825-4977-ad8a-e39e063e5990 | 9 | public Grid extend(PointDouble values) {
double minX;
double maxX;
double minY;
double maxY;
double distance;
Grid result;
// left
if (Utils.smOrEq(values.getX(), getMinX())) {
distance = getMinX() - values.getX();
// exactly on grid point?
if (Utils.eq(distance... |
3a0b7a58-38cc-4e25-8711-3b594dd8c8d4 | 2 | public static void main(String[] args) {
// we use Integer wrapper class because
// the parameter expects a subclass of Object, and
// not a primitive type
HashMap<Integer, String> mapOfPlanets = new HashMap<Integer, String>();
mapOfPlanets.put(1, "Mercury");
mapOfPlanets.put(2, "Venus");
mapOfPlanets.pu... |
57dce441-dba3-4397-8980-9ddcce5c238a | 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... |
53de2d7b-a77b-450a-9243-364308061a19 | 1 | public boolean needsBraces() {
return declare != null && !declare.isEmpty();
} |
095cd50d-7260-4088-890f-60579f7511ed | 3 | public void merge(VariableSet vs) {
for (int i = 0; i < count; i++) {
LocalInfo li = locals[i];
int slot = li.getSlot();
for (int j = 0; j < vs.count; j++) {
if (li.getSlot() == vs.locals[j].getSlot())
li.combineWith(vs.locals[j]);
}
}
} |
d83a1fd1-3b56-4d71-89cb-dac85b546626 | 3 | public static Texture loadTexture(final String textureLocation)
throws IOException
{
if (!FILE_NAME_TO_TEXTURE.containsKey(textureLocation))
{
final BufferedImage bufferedImage = ImageIO.read(new File(
textureLocation));
final int[] pixels = new int[bufferedImage.getWidth()
* bufferedImage.getHe... |
cc1bc749-e8b6-4df6-8d59-f31641a3c15f | 5 | public Point getTileCollision(Sprite sprite,
float newX, float newY)
{
float fromX = Math.min(sprite.getX(), newX);
float fromY = Math.min(sprite.getY(), newY);
float toX = Math.max(sprite.getX(), newX);
float toY = Math.max(sprite.getY(), newY);
// get the tile loca... |
4686a8e4-5cbc-4ae1-80b8-9bd7579474c3 | 7 | public static void main(String[] args) {
int count;
String message = "";
String result = "";
checking = new Account("",200,Account.ACCOUNT_CHECKING);
savings = new Account("",1000,Account.ACCOUNT_SAVINGS);
// Set up name database, normally this ould be done in a ... |
87708272-a8a7-4f2c-9bbf-17d47a4f0c2b | 6 | @EventHandler
public void BlazeWither(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.getBlazeConfig().getDouble("Blaze.Wither.Dodg... |
c148be83-1d27-4f83-a598-897b075625fc | 7 | private Color getSolulleVari(int miinoja) {
switch (miinoja) {
case 1:
return Color.BLUE;
case 2:
return Color.GREEN;
case 3:
return Color.RED;
case 4:
return Color.BLACK;
case 5:
... |
a4b069fd-b6c8-49f6-8dba-2602248c843a | 7 | public void generateTable(int n) {
table = new JTable(n, n);
scrollPane = new JScrollPane(table);
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
renderer.setHorizontalAlignment(JLabel.CENTER);
for (int i = 0; i < table.getColumnCount(); i++) {
ta... |
921f4104-a236-490c-a7fa-eb3ce433e259 | 3 | @Override
public Iterator<T> iterator() {
return new Iterator<T>() {
private int next = -1;
@Override
public boolean hasNext() {
return (top != -1 && next != top);
}
@Override
public T next() {
if (isEmpty() || next == top) {
throw new NoSuchElementException();
}
next++;
... |
2a64693b-dc36-439f-999e-c5e0a4c6fcfe | 2 | public ZLien chercheLien(int x, int y)
{
for (int i = 0; i < zliens.size(); i++)
if (getLien(i).isSelected(x, y))
return getLien(i);
return null;
} |
ebc95385-a53a-4134-9180-38c494213d62 | 8 | private char getEscapeChar(char ch) {
switch (ch) {
case 'b':
ch = '\b';
break;
case 't':
ch = '\t';
break;
case 'n':
ch = '\n';
break;
case 'f':
ch = '\f';
break;
case 'r':
ch = '\r';
break;
// do nothing - ch already contains correct character
case '"':
case '\'':
... |
01ccd710-4616-45d5-bf73-493f80755b10 | 7 | public void run () {
while (running) {
long now = System.currentTimeMillis();
clientLock.lock();
try {
for (ServerThread t : clients) {
if(now - t.lastAction > SOFT_TIMEOUT && !t.softTimeout) {
System.out.println("Cl... |
43a64b1b-f54b-4e8d-aa31-ed532b7c95cf | 8 | public void vizConceptLinksToDotEdges(LogicObject concept, Module module) {
{ VizInfo self = this;
{ OutputStream stream = self.stream;
int count = 0;
{ LogicObject renamed_Super = null;
edu.isi.powerloom.PlIterator iter000 = edu.isi.powerloom.PLI.getDirectSuperrelations(concept, m... |
7b9e9e90-a0f8-4c01-aaf6-3a5e69c058cc | 1 | public void setAlwaysDrawGrouting(boolean always) {
if (alwaysDrawGrouting != always) {
alwaysDrawGrouting = always;
forceRedraw();
}
} |
0395d1b7-4941-4725-9ebd-1461a83698dd | 0 | public int getType() {
return type;
} |
66940791-660e-469b-b59f-e0e49407ccb6 | 9 | public File writeExcelFile(String nombreArchivo) throws IOException{
ArrayList credencialTemaAr=new ArrayList();
credencialTemaAr=ctDAO.getCredencialTema();
Iterator itcredencialTema=credencialTemaAr.iterator();
Credencial_Tema credencialTema=new Credencial_Tema();
String credenc... |
e055109a-e0c9-47cd-857a-7b5008345d9c | 3 | public static String toString(JSONObject jo) throws JSONException {
boolean b = false;
Iterator keys = jo.keys();
String string;
StringBuffer sb = new StringBuffer();
while (keys.hasNext()) {
string = keys.next().toString();
if (!jo.isNull(s... |
60e09fec-646a-4a7d-bc70-ff20d35e6fb8 | 0 | @Override
public void mouseEntered(MouseEvent e)
{
Game.gui.update(true);
} |
27442eb2-671c-4220-bf13-3ea3d332f385 | 4 | private void submitAction() {
if (this.findRadioButton.isSelected()) {
System.out.println("Find :\t" + StringDemo.find(this.mainTextField.getText(), this.searchTextField.getText()));
} else if (this.replaceRadioButton.isSelected()) {
System.out.println("Replace :\t" + StringDemo.replace(this.mainTextField.ge... |
13ec83ef-53ed-4a3c-90d0-e2977f715e0e | 1 | public static void setPropertyAsBoolean(PropertyContainer container, String key, boolean value) {
if (container != null) {
container.setProperty(key, new Boolean(value));
} else {
throw new IllegalArgumentException("Provided PropertyContainer was null.");
}
} |
4577d88e-34a2-4fa1-a6f7-a2323a42e1c0 | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
257c4a96-66ad-4b98-8cdd-04832994a5a3 | 5 | public void characters(char[] ch, int start, int length) throws SAXException {
// we're only interested in this inside a <phone.../> tag
if (currentFacture != null) {
// don't forget to trim excess spaces from the ends of the string
if (id_factureT.equals("open")) {
... |
11f1402e-180c-4170-8490-485977cd4884 | 3 | public static void main (String [] args) {
Display display = new Display();
Shell shell = new HoverHelp().open(display);
// Event loop
while (shell != null && ! shell.isDisposed()) {
if (! display.readAndDispatch()) display.sleep();
}
// Cleanup
display.dispose();
} |
e71e6a8b-668f-4785-a239-73f1a038764a | 1 | public void removeValueChangeListener(ValueChangeListener l) {
if(l == null) {
return;
}
valueChangeListener = null;
} |
996ba769-0962-4635-af53-a3f5465fcf23 | 1 | public void actualizaTabla(){
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
for (Segmento seg : ticket.getSegmentos()) {
addRow(new Object[]{seg.getNumeroSegmento(),seg.getNomSalida(),seg.getNomLlegada()... |
1ed036da-5201-4341-b8cf-7fa02ab8e105 | 4 | public void test_01() throws IOException {
String dirName = "./tests/";
File dir = new File(dirName);
for (String fileName : dir.list()) {
if (fileName.endsWith(".txt") || fileName.endsWith(".vcf")) {
if (fileName.equals("testLukas.vcf")) {
fileName = dirName + fileName;
long hashExp = calcHashB... |
d05728ab-f6cf-428f-9031-bcdce809dcb0 | 9 | public boolean getPath1(int x, int y, ArrayList<Point> path,
Hashtable<Point, Boolean> cache) {
Point p = new Point(x, y);
if (cache.containsKey(p)) {// alrady visited thsi cell
return cache.get(p);
}
if (x == 0 && y == 0) {
return true;// found a pth
}
boolean success = false;
if (x >= 1 && is... |
c4c021a0-5179-4c3d-932e-8a83893e8996 | 5 | private void clueFiles(List<Path> sortedChunks, Path outputFile, ByteBuffer bb) throws IOException {
try (ByteChannel output = Files.newByteChannel(outputFile, WRITE, CREATE)) {
for (Path path : sortedChunks) {
try (ByteChannel input = Files.newByteChannel(path)) {
... |
0c20c713-0bbc-43b0-8bc7-06405f1a46f5 | 2 | public ArrayList<Molecule> sortIntoArray(ArrayList<Molecule> arrList){
arrList.add(this);
if( !((children.get(0).getID() == 0) || (children.get(1).getID()==0)) ){
children.get(0).sortIntoArray(arrList);
children.get(1).sortIntoArray(arrList);
}
return arrList;
} |
40c6a3bf-cf9d-41f3-95a4-b5ff8db2bc86 | 1 | Message receive() {
try {
// first sort the input queue for multicast message
sortInputQueue();
return inputQueue.remove(0);
} catch (Exception e) {
return null;
}
} |
a1a070f7-bd1b-4e08-85a1-b6657c61b85d | 2 | private static int addHelper( LinkedListNode l1, LinkedListNode l2, Stack<Integer> head ) {
if ( l1.next == null && l2.next == null ) {
int sum = l1.data + l2.data ;
head.push( sum % 10 );
return sum / 10;
}
int carry = addHelper( l1.next, l2.next, head );
int sum = l1.data + l2.data + carry;
... |
64ae1ae2-a1f7-43c3-8f19-db970a6e4fd7 | 4 | Grapher( RrdGraphDef graphDef, RrdGraph rrdGraph )
{
super( graphDef, rrdGraph );
this.graphDef = graphDef;
// Set font dimension specifics
if ( graphDef.getDefaultFont() != null )
normal_font = graphDef.getDefaultFont();
if ( graphDef.getTitleFont() != null )
title_font = graphDef.getTitleFont();
... |
a17c997f-c4c2-4f74-9606-572b061de8dd | 3 | public List<MessageDTO> getMessagesFromFolder(FolderDTO folderDTO) throws DataProcessingException {
Folder folder = folderDAO.getFolder(folderDTO.getId());
if (folder == null) {
logger.warn("Folder with name " + folderDTO.getFolderName() + " does not exist");
throw new DataProcessingException(ExceptionType.f... |
4773a398-c2b2-4491-9fd1-a874bf1f3ebc | 2 | public void setAnimationToStartNextMove(String direction) {
animationShiftCount = 50;
if (direction.equals("right")) {
drawImage = 1;
}
if (direction.equals("left")) {
drawImage = 7;
}
} |
d51f3fce-5995-4120-befd-f3a9271f995e | 1 | private void processMoveToBoard(MouseEvent e) {
int col = findCol(e.getX());
List<Card> possibleCards = game.getBoard().get(col);
if (activeMove != null) {
activeMove.cardReleased(col, false);
System.out.println("Moving:" + activeMove);
String result = active... |
9e17998e-c218-476a-ba9e-056986cf1097 | 4 | public static String readTextFile(String fileName) {
try {
File f = new File(fileName);
WebServer.logDebug(f.getPath());
if (f.exists() && !f.isDirectory()) {
FileInputStream fstream = new FileInputStream(fileName);
// Create a stream and re... |
d7dd02a3-1657-4e71-bce7-fa3c2dcbaa75 | 2 | public void saveGuiState() {
try {
fos = new FileOutputStream(filename);
out = new ObjectOutputStream(fos);
out.writeObject(model);
out.close();
} catch (FileNotFoundException ex) {
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logg... |
3d98e95f-3d5b-4d7b-a10f-e27c25966d8c | 8 | void createExampleWidgets () {
/* Compute the widget style */
int style = getDefaultStyle();
if (dateButton.getSelection ()) style |= SWT.DATE;
if (timeButton.getSelection ()) style |= SWT.TIME;
if (calendarButton.getSelection ()) style |= SWT.CALENDAR;
if (shortButton.getSelection ()) style |= SWT.SHORT... |
40924244-f955-449d-822a-badc0495f9dd | 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... |
a4e99d83-fa3e-4af1-8880-3564ee8d8ce8 | 2 | public Result execute(Command command) {
Set<AccountDTO> accountDTOgetsend = (Set<AccountDTO>) command.getCommandSource();
Set<MessageStatuss> messageStatusssend = new HashSet<MessageStatuss>();
List<Account> accountIdsend = new ArrayList<Account>();
for (Iterator<AccountDTO> it = accou... |
a1e4abb3-61a8-4a37-8457-480a9a111b0b | 2 | public boolean getBackupFile(String sourceURL, String HTTPuser, String HTTPpassword, String filePath, String fileName, String fileExt, String fileDate) throws IOException{
FileOutputStream fout = null;
boolean success = false;
URL url = new URL (sourceURL);
Strin... |
15c67ea1-d986-4ba7-85c6-836b6c910bca | 7 | private JButton createGameBoardButton(Tile t, Set<Map.Entry<Location, Integer>> bonusSquares, int i, int j){
JButton button;
String label = "";
Color c =EMPTY_SQUARE_COLOR;
for(Map.Entry<Location, Integer> e : bonusSquares){
Location loc = e.getKey();
if(loc.getX()== i && loc.getY() == j){
int bonu... |
99a08bcb-687a-4741-a6e9-7d643612157d | 0 | public boolean isLL1() {
return Operations.isLL1(grammar);
} |
390502a0-20c9-4d1c-b05d-b18a9133c1f1 | 7 | public boolean match() {
int matchIndex = 0;
boolean anyMatches = false;
AbstractInsnNode currentNode = nodes.getFirst();
while (currentNode != null) {
if (matchIndex == opcodes.length) {
//found a fully matching pattern, add a new index to the list and keep searching
matches.add(new AbstractInsnN... |
ffa40feb-a696-4c5a-9e8c-ebe4ccbad7cb | 1 | public static void asm_comf(Integer akt_Befehl, Prozessor cpu) {
Integer f = getOpcodeFromToBit(akt_Befehl, 0, 6);
Integer result = 255 - cpu.getSpeicherzellenWert(f);
// Speicherort abfragen
if(getOpcodeFromToBit(akt_Befehl, 7, 7) == 1) {
// in f Register speichern
cpu.setSpeicherzellenWert(f, result, ... |
1d87d888-97da-4fbe-a200-dc103a66141a | 2 | RegulationFileConsensus readBeds(List<String> bedFiles, String cellType) {
RegulationFileConsensus regCons = new RegulationFileConsensus(true);
// Read all files, creating a consensus for each
for (String bedFile : bedFiles) {
if (verbose) Timer.showStdErr("Reading file '" + bedFile + "'");
String epigene... |
486d0f8d-f478-4786-9187-fcb8158c208a | 2 | private static void mergeWithNextVisibleNode(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) {
Node currentNode = textArea.node;
Node nextNode = tree.getNextNode(currentNode);
if (nextNode == null) {
return;
}
// Abort if nextNode is not editable
if (!nextNode.isEditable(... |
2a555c5e-679c-440c-ad0c-0ccec13a7153 | 0 | public void setWidth(double _width) {
width = _width;
} |
ba6e47b6-a4b9-4100-b994-e3ddb8b74de1 | 2 | public ImplCurlConnection(String curlURL, String user, String pwd, String authType, HashMap<String, String> props) {
this.curlURL = curlURL;
this.user=user;
this.pwd=pwd;
Logger log = Logger.getLogger(this.getClass().getName());
log.setLevel(Level.FINE);
this.setLogger(log);
LogHandler.initLogFileHandler(... |
96092fc7-3578-40b6-b90f-c81910c1247d | 0 | public void setPage(int page) {
this.page = page;
} |
2a4618a9-19ea-45e1-8105-eec968978f18 | 9 | protected void update(CheckedFrequencyTable freqs, int symbol) throws IOException {
// State check
if (low >= high || (low & MASK) != low || (high & MASK) != high)
throw new AssertionError("Low or high out of range");
long range = high - low + 1;
if (range < MIN_RANGE || range > MAX_RANGE)
throw new Asser... |
e40127f5-19b8-4b46-a7b9-cb412096af7b | 5 | public IVPNumber multiply(IVPNumber number, Context context, DataFactory factory, HashMap map) {
IVPNumber result = factory.createIVPNumber();
map.put(result.getUniqueID(), result);
if(getValueType().equals(IVPValue.INTEGER_TYPE) && number.getValueType().equals(IVPValue.INTEGER_TYPE)){
int resultInt = context.... |
c75ca672-7089-4fc9-8c01-145acb9edd5a | 2 | private void create(Color bg, String title, String initialFont, int initialSize, final Color initialColor, boolean bold,
boolean underline, boolean shadow) {
setPreferredSize(new Dimension(GUIConstants.DEFAULT_FIELD_WIDTH, FIELDHEIGHT));
setBackground(bg);
setLayout(new VerticalLayou... |
202dd6e2-0d89-4b59-aabf-98c995b30848 | 5 | private int nextElement(int above, int index){
boolean hasNext = true;
int n = above;
while(hasNext){
if(n == map.lastKey()){
return Integer.MIN_VALUE;
}
n = map.higherKey(n);
int currentN = 0;
boolean good = true;
int maxN = map.get(n);
for(int i = 0; i < index; i++... |
ec0cd21e-17de-4076-aead-b3ef790e811e | 4 | private void doNew(String[] messageParts, InetAddress hostName)
throws IOException {
if (!isLoggedIn) {
if(true){
if (messageParts.length == 2) { // dann hat der username keine
// leerzeichen, da er nicht zerlegt
// wurde.
String userName = messageParts[1]; // username kommt nach de... |
419e185c-406e-418a-8928-2ec3060d9e43 | 7 | public static void sortTexturePacks() {
texturePackPanels.clear();
texturePacks.removeAll();
currentTexturePacks.clear();
int counter = 0;
selectedTexturePack = 0;
texturePacks.repaint();
HashMap<Integer, List<TexturePack>> sorted = new HashMap<Integer, List<TexturePack>>();
sorted.put(0, new ArrayLi... |
8ae77b9a-e622-4562-87b0-e452859d4bd7 | 0 | @Override
public AbstractPlay mkRandom() {
return bestPlays.get(rnd.nextInt(bestPlays.size()));
} |
74e602d0-2156-4629-bd6b-cf1b1f519e26 | 2 | private void readall(InputStream in, byte[] buf) throws IOException {
int ret, off = 0;
while (off < buf.length) {
ret = in.read(buf, off, buf.length - off);
if (ret < 0)
throw (new LoadException("Incomplete resource at " + name, this));
off += ret;
}
} |
a267c6f2-8eac-4209-9229-fe3f7ee5717f | 0 | @Override
public void connect() throws IOException {
checkInitiate();
super.connect();
sync.clear();
prevCallId = 0;
keepAliveThread = new KeepAliveThread();
keepAliveThread.start();
} |
20ae46bc-31b6-445b-81c1-3157a6698021 | 2 | public int amountCaught() {
int num = 0;
for (Iterator<Integer> i = data.keySet().iterator(); i.hasNext();) {
if (data.get(i.next()) == State.caught)
num++;
}
return num;
} |
6b2b2d76-b593-4da9-8ccd-4658847e0858 | 3 | public void encryptFile() {
try {
if (_path.isEmpty()) {
Logger.addMessage("Select file to encrypt.");
return;
}
this.setSecretKeyFromProvider(_keyProvider);
if (!_properies.mode.equalsIgnoreCase("ECB")) {
SecureRa... |
01e4996d-d1d0-4529-936e-e32de0d487bc | 6 | static final void method721(SubNode class348_sub42,
SubNode class348_sub42_1_, int i) {
do {
try {
if (((SubNode) class348_sub42_1_).subnodeChild
!= null)
class348_sub42_1_.removeSubnode();
anInt1194++;
((SubNode) class348_sub42_1_).subnodeParent
= class348_sub42;
((SubNode) class348... |
c7a5f21c-9bd8-47c9-992d-eb22a6e0125f | 6 | protected void attemptConnection()
{
if (loadingLabel.isVisible())
return; // If the loading label is visible, we are already attempting a connection.
loadingLabel.setVisible(true);
/* Reset error messages to hidden. */
addressErrorLabel.setVisible(false);;
nameErrorLabel.setVisible(false);
passwo... |
b2de4d72-b3cb-4b45-8911-5fcc87035bc0 | 0 | public void removeDocumentRepositoryListener(DocumentRepositoryListener l) {
documentRepositoryListeners.remove(l);
} |
b1bca4ad-1964-4b94-892e-e4281cd88451 | 5 | public void run() {
boolean current = false;
if (!this.choice.equals(Choice.NO_UPDATE)) {
this.getJSON();
if (this.latest != null) {
if (this.choice.doCheck()) {
this.checkVersion();
}
if (this.choice.doDownload(... |
ccdcebe9-1879-4ba2-bad1-83ca7115458d | 7 | @Override
final protected CommandExecutionResult executeArg(List<String> arg) {
final String arrow = StringUtils.manageArrowForSequence(arg.get(posArrow));
final Participant p = getSystem().getOrCreateParticipant(
StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(posParticipant)));
final bool... |
2fdbc037-5ad4-465c-9e90-54e32caa3c47 | 3 | protected String buildSqlQuery(Query query) throws IOException {
StringBuilder sql = new StringBuilder("SELECT ");
//column names
selectColumns(getSchema(), null, query, sql);
sql.setLength(sql.length() - 1);
// from
sql.append(" FROM ");
sql.app... |
9e213099-f8f9-4bf8-b607-3dce5156e149 | 6 | @Override
public CommandLog visit(Robot robot) {
if(!robot.isAlreadyStarted()) { // ignore if robot has not yet initiated
String message = "Robot has not been PLACED. MOVE command ignored";
CommandLog ignoredCommand = new CommandLog(true, message);
return ignoredCommand;
}
Position robotPos = robot.g... |
7bf246fc-d3e2-4222-921a-d0ac680afec7 | 5 | public SimpleHelper(final String func, final List<String> args) {
if (func==null || func.length()==0) throw new NullPointerException(); //TODO: message
this.func = func;
if (args!=null && args.size()>0) {
this.args = (String[]) args.toArray(new String[0]);
for (int i=0; i... |
9376fc21-26e0-4f5c-8a72-d4edbf62730b | 8 | public static Object[][] getRegisterData(String csvFile) throws Exception {
int numberOfLines = countLines(new File(csvFile));
if (numberOfLines == -1) {
throw new Exception("File not found exception");
}
BufferedReader br = null;
String line = "", csvSplitBy = ",";
... |
6034347c-41c8-4a40-a3fe-b2ed43706dd5 | 4 | public void draw() {
// Iterate over the atoms and draw them one by one
// TODO: sort them by layer
for (Atom a : atoms) {
// Try to get a texture for our atom from its sprite
BufferedImage buf = a.getCurrentImage();
// Check if the image exists
if(buf == null) continue;
// Do we have the text... |
2b689ad2-358b-4cdc-b561-de55a0d6a3ca | 3 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
final Player s = (Player)sender;
if (plugin.getLookup().isEnabled()) {
String target = null;
if (args.length == 0 && sender instanceof Player) {
target = sender.getName();
}
else {
target = arg... |
c58f4b76-d4aa-4d77-bad3-cd756a9d5603 | 9 | public void displayChunks(File filelocation) {
int mask = 1 << 13;
mask--; // 13 bit of '1's
File f = filelocation;
FileInputStream fs = null; // For sliding window
FileInputStream fsChunk = null; // For chunking the input stream
BufferedInputStream bis = null;
try {
fs = new FileInputStream(f);
fs... |
c015ff78-603b-41ee-9f19-a2b79392be00 | 1 | public Timeline(String[] names, StatDB db) {
this.names = names;
List<List<Stat>> stats = new ArrayList<List<Stat>>();
for (String name: names) {
stats.add(getStats(name, db));
}
merge(stats);
} |
1a517196-f634-40f4-83b5-2116bffcf1ad | 7 | public boolean next() {
int[] toff = this.roff.getShape();
int l = itr.length - 1;
if (itr[l] >= roff.getShape()[l]) {
return false;
}
int j = 0;
int len = toff.length - 1;
while (j <= len) {
itr[j]++;
if (j != 0) {
pos += jump[j - 1];
} else {
pos++;
}
if (itr[j] < toff[j]) {
... |
1cf25cc0-1b58-4c11-b216-888aac93fbbc | 6 | /* */ protected ROElement(Node n)
/* */ throws RIFCSException
/* */ {
/* 55 */ if (n == null)
/* */ {
/* 57 */ throw new RIFCSException("Null Node passed to constructor");
/* */ }
/* */
/* 60 */ if (!(n instanceof Element))
/* */ {
/* 62 */ throw ... |
c6569885-93aa-4c96-b31c-3ae11dd0981d | 9 | public void action() {
switch (step) {
case 0:
//enviar cfp a las agencias
ACLMessage cfp = new ACLMessage(ACLMessage.CFP);
for (int i = 0; i < agencias.length; ++i) {
cfp.addReceiver(agencias[i]);
}
//renombro por facilidad
String[] r1 = requerimientoTuristaLugar;
String[] r2 =... |
e534d745-98a6-4358-94aa-73526932d948 | 9 | public static void main(String[] args) throws Exception {
display = new Display();
System.out.println("\nRepDev " + VERSION + " Copyright (C) 2008-2014 RepDev.org Team\n"
+"This program comes with ABSOLUTELY NO WARRANTY.\n"
+"This is free software, and you are welcome to redistribute it \n"
+"under ce... |
f52a298c-fb40-45a8-bf51-6664ced7268b | 0 | public JCheckListBox(Object[] items) {
setModel(new CheckListBoxModel(items));
init();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.