method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3a0681e8-98f5-4313-80d5-4e6bb14c273b | 2 | private void initialiseConnection() throws IOException,
InterruptedException
{
try
{
incoming = bindSocket(DEFAULT_PORT);
}
catch (BindException e1)
{
log.debug("Master already runninng!");
incoming = bindSocket(0);
}
alreadyRunning = true;
log.debug("Listener started as [" + name + "]");
... |
f03acb7b-e86c-4361-8ce8-4da4412e29c7 | 3 | private void loadChi2() throws FileNotFoundException {
chi2 = new HashMap<Integer, Double>();
Scanner s = new Scanner(new File(CHI2_FILE));
s.nextLine();
while (s.hasNext()) {
String line = s.nextLine();
Scanner row = new Scanner(line);
String df = row.next();
String p = row.next();
try {
... |
46d14fd4-9fdc-4a50-a3b7-a1bf693a201a | 1 | public ArrayList<PlayerLocation> getPlayersLocation()
{
ArrayList<PlayerLocation> list = new ArrayList<PlayerLocation>();
list.add(new PlayerLocation(pacMan.getX() - pixels, pacMan.getY() - pixels, pacMan.getImageName()));
for (Phantom phantom : phantoms) {
list... |
664d5763-c78e-4c4e-8ef1-5f6d51c3f271 | 0 | public String getDesc() {
return this.desc;
} |
fc6148d6-30aa-4bf4-81a8-baf4b3cec651 | 5 | public boolean testMovesForCheckMate(boolean owner, Board boardObj){
//hole Brett
Piece[][] board = boardObj.getBoard();
//holt König auf dem Brett
King king = boardObj.getKingOnBoard(owner);
//Mögliche Züge des Königs generieren
ArrayList<String> possMoves = king.getPossibleMoveDestinations(king.getPositio... |
b132951b-f8c6-42e3-9e51-b6ffa9c487a2 | 4 | public void mouseClicked(MouseEvent e) {
// depending on tool state propagate mouse state
if (documentViewModel.getViewToolMode() ==
DocumentViewModel.DISPLAY_TOOL_TEXT_SELECTION) {
textSelectionHandler.mouseClicked(e);
} else if (documentViewModel.getViewToolMode() ... |
9516f814-ea09-4d80-bcc7-d737da089f9f | 4 | public static void insertTag(String hashtag) {
Connection con = null;
try {
Class.forName("org.sqlite.JDBC");
con = DriverManager.getConnection("jdbc:sqlite:" + Parametre.workspace + "/bdd_models");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select tag from hashTags where ... |
89b4cc69-a992-48b8-a783-7196e5154b8f | 5 | public boolean isHydroCarbon()
{
if(elements.length == 2)
if((elements[0].protons == 1 && elements[1].protons == 6) ||
(elements[1].protons == 1 && elements[0].protons == 6))
return true;
return false;
} |
b5270fb6-a218-4485-bd14-b561b00a7497 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... |
bb87f3a5-bdbb-44bc-a843-366de79462c3 | 0 | public T2 getFoo2()
{
return foo2;
} |
199cd20d-8898-45b0-8c29-427364557fe7 | 7 | @Override
public String toString()
{
StringBuilder string = new StringBuilder();
string.append("Original question: ");
string.append(originalText);
string.append("\n");
// string.append("QuestionType: " + questionType + "\n");
string.append("AnswerType: "... |
d7358e2f-81f5-4d17-a0cf-dc8c786939ef | 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... |
48a54e3a-2305-413c-b810-e6de7bf68f45 | 1 | public void createSQL(String s) {
String filename = "bible_chinese.sql";
Path file = Paths.get(CBOL_HOME + filename);
Charset charset = Charset.forName("UTF-8");
try (BufferedWriter writer = Files.newBufferedWriter(file, charset)) {
writer.write(s, 0, s.length());
}... |
bca60e70-9375-4198-9493-957ec14deac8 | 0 | public TurnOnCommand(Receiver receiver) {
this.receiver = receiver;
} |
c4dfe762-1acf-4f72-97da-8316eddd0478 | 2 | public static void drawProfitMinimap(GOut g, Coord tc, Coord hsz) {
if(UI.instance.minimap == null) return;
synchronized (UI.instance.minimap.profits) {
for (Pair<Coord, Color> arg : UI.instance.minimap.profits) {
Coord ptc = arg.fst.div(tileSize).add(tc.inv())
.add(hsz.div(2));
g.chcolor(Color.BLA... |
94a03996-5d51-496d-9c4b-362b6f69b0e9 | 1 | public void wdgmsg(Widget sender, String msg, Object... args) {
if (sender == cbtn) {
close();
return;
}
super.wdgmsg(sender, msg, args);
} |
a8590c81-6de4-4b46-b0d4-f41e42c0bb88 | 8 | Class367 method3832(int i, byte i_61_) {
if (i_61_ > -57)
method3817(22, -65);
anInt7969++;
int i_62_ = i;
while_231_:
do {
while_230_:
do {
do {
if (i_62_ != 6) {
if (i_62_ != 1) {
if (i_62_ != 2) {
if ((i_62_ ^ 0xffffffff) != -8)
break while_231_;
} else
bre... |
b1d03e01-72ab-4c9c-9bc2-21290d69873f | 5 | private static Map<String, Object>[] getParamsets(List<String> fnames, List data) {
int cols = fnames.size();
if (cols<1) {
throw new ComponentException("no field mapping information for test data");
}
int rows = (data.size() / fnames.size()) - 1;
if (rows < 1) {
... |
b50475de-0b71-4219-9cb9-6666c38535e2 | 0 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
} |
feb44528-0e4a-4bf2-a49c-28a5dfea5840 | 8 | private void getMods() {
if (!prefs.get(NSLOACTION, "").equals("")) {
File neoScavengerLocation = new File(prefs.get(NSLOACTION, "") + ".");
List<File> folderList = new ArrayList<File>();
File[] children = neoScavengerLocation.listFiles();
if (children != null) {
for (File child : children) {
if ... |
45648c77-af1c-4e4e-bd74-9e9fca4b2882 | 7 | private Node pickSeed(Set<Node> nodeList, Set<Integer> sampleList){
int N = nodeList.size(); //number of proteins
int setSize = (int)Math.sqrt(N);
//System.out.println("required num of proteins " + setSize);
HashSet<Node> eligibleFeatures = new HashSet();
//eligibleFeatures.addA... |
5496e069-913f-4da6-bcbb-c32708ab5c58 | 9 | protected Vector<Integer> allOkResources()
{
if(allResources==null)
{
allResources=new Vector<Integer>();
if(okResources()!=null)
{
for(int m=0;m<okResources().length;m++)
{
if(!allResources.contains(Integer.valueOf(okResources()[m])))
allResources.addElement(Integer.valueOf(okResourc... |
eecdb90d-857e-45b4-98c1-7e6cdbb2a0cc | 1 | public void testCompareTo() {
Single test1 = new Single(21);
Single test2 = new Single(22);
Single test3 = new Single(23);
assertEquals(true, test1.compareTo(test1) == 0);
assertEquals(true, test1.compareTo(test2) < 0);
assertEquals(true, test1.compareTo(test3) < 0);
... |
129bf91d-8833-440c-a426-3e4353078bee | 1 | private int getMinInd(int pos1, int pos2) {
return heap.get(pos1).compareTo(heap.get(pos2)) >= 0 ? pos2 : pos1;
} |
f289f495-ffa6-4e62-9303-94000d384fa7 | 5 | public void setButtonsNumber(JToggleButton[] buttons) {
if (buttons.length == MAX_NUMEROS_USADOS) {
ArrayList<Integer> listaCompleta = new ArrayList<>();
for (Integer numero : NUMEROS) {
listaCompleta.add(numero);
}
int size = listaCompleta.size... |
a3e8d565-d8c6-4421-9a3f-80637fae3396 | 1 | public void notifyHunterListListeners() {
for (final HunterListListener listener : this.listenersHunter) {
listener.hunterListModelChanged(this.hunters);
}
} |
5abfb2ec-b9c1-4ff5-9ef2-38a804385d45 | 1 | private void handleScore(ScorePacket packet) {
ClientPlayer player = getPlayer(packet.player);
if (player != null) {
player.setScore(packet.score);
}
} |
a960952b-fdc8-4de0-8abf-30dc10935016 | 5 | @Override
public void mousePressed(MouseEvent e){
SimSession session = frame.session;
int mask = e.getModifiers();
int button;
// note that all buttons are mapped as if we were dealing with
// a two button mouse. On systems with 3 buttons (X-Windows)
// the right two buttons are ma... |
07a44645-0fdd-4be9-a817-4cdefa585f87 | 8 | @Override
public boolean puraTiedosto() throws FileNotFoundException, IOException {
System.out.println("LZW purku aloitetaan");
//BufferedInputStream bis = new BufferedInputStream(new FileInputStream(lahde));
BittiInputStream bis = new BittiInputStream(new BufferedInputStream(new FileInputStream(lahde)));
Buff... |
65cd4665-64b3-4ed6-9515-5830268c1b65 | 7 | public static StringBuffer dynImmunities(String ID, Modifiable obj, HTTPRequest httpReq, java.util.Map<String,String> parms, int borderSize, String font)
{
final StringBuffer str=new StringBuffer("");
final List<String> theclasses=new Vector<String>();
if(httpReq.isUrlParameter("IABLE1"))
{
int num=1;
St... |
7cede57b-53d9-46e6-85b6-8066de5d473d | 9 | private Field getField() {
Class<?> propertyType = getPropertyType();
while (field == null && !fieldSearched) {
Class<?> c = clazz;
while (c != null && field == null) {
for (Field f : c.getDeclaredFields()) {
if (f.getName().equals(getPropertyDescriptor().getName())
&& f.getType().equals(prop... |
1120850e-3c85-4024-a80e-c76817f30c10 | 1 | public Boolean comprarProducto(String producto, Integer unidades){
if(!this.stock.containsKey(producto)){
return false;
}
Integer nuevaCantidad = this.stock.get(producto) - unidades;
this.stock.put(producto, nuevaCantidad);
return true;
} |
a9393bbb-1f54-4859-908a-68974fb0a75f | 7 | public void update() {
Graphics2D g = _buffer.createGraphics();
double pixX = DEFAULT_WIDTH / (double)_width;
double pixY = DEFAULT_HEIGHT / (double)_height;
for (int i = 0; i < _height; i++) {
for (int j = 0; j < _width; j++) {
//g.setColor(BACKGROUND_COLOR);
int w = (int)(_wps.getMap().getWeight... |
920b2f9e-5481-4443-8360-e50be98764b7 | 5 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Item) {
Item item = (Item)obj;
if (this.name != item.name) {
if (this.name == null || !this.name.equals(item.name)) {
r... |
673de516-fa41-4d0b-8241-578f121177fe | 3 | public boolean containsAll(Collection<? extends E> c) {
for (E element : c)
if (!contains(element))
return false;
return true;
} |
4280106a-ac7f-47f7-9511-4260f21c2ee5 | 2 | @Override
public int compare(Record record1, Record record2) {
if (record1.timestamp.getTime() > record2.timestamp.getTime())
return -1;
else if (record1.timestamp.getTime() < record2.timestamp.getTime())
return 1;
else
return 0;
} |
46fddc51-cdd8-4357-9b14-d7458bd25731 | 9 | private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed
// TODO add your handling code here:
if(txtNombre.getText().equals("")){
JOptionPane.showMessageDialog(null,"Deve Ingresar unn Nombre para continuar");
txtN... |
fd038d9e-af17-466f-a8e2-16b89f714ed7 | 3 | public void playGame() {
initialize();
shuffle();
boolean run = true;
do {
getCard();
for (User user : users) {
run = play(user);
if (!run)
break;
}
} while (run);
gameOver();
} |
197bd417-299c-4da2-9002-06074533c0b9 | 7 | public int getChannel(int channel) throws Exception, IllegalArgumentException {
int value = 0;
checkChannel(channel);
//write
int wdata[] = {devAdr.getWriteAddress(), controlByte | channel};
writeI2C(wdata);
//read
int rdata[] = {devAdr.getReadAddress()};
... |
97ddce9a-51e6-4303-b524-8421a9f89896 | 0 | public void setOrderCount(String orderCount) {
this.orderCount = orderCount;
} |
2c431f04-3c0a-4c49-b666-aadc504a33ff | 5 | public List<Sword> getSwordPartsByDistance() {
final ArrayList<Sword> list = new ArrayList<Sword>();
for (Sword swordPart : Sword.values()) {
if (swordPart.getHitsNeeded(ctx) > 0) {
list.add(swordPart);
}
}
if (list.size() > 0) {
Collections.sort(list, new SwordComparator(ctx));
HitType hitTy... |
e069deec-a30c-4ce8-bf3e-cf8f915ad663 | 6 | private void destroyWalls() {
final int rows, columns, zombiesNeededToBreakDownAWall;
final double cellWidth, cellHeight;
double cellXMin, cellYMin, cellXMax, cellYMax;
EnvironmentCell cell;
Collection<EnvironmentWall> cellWalls;
Line2D destroyedPart;
row... |
cbfb8121-bcf2-49e0-91a8-7cdeb5686a53 | 3 | public Set<Matcher> noCacheFindSign(Block block) {
for (BlockFace direction : signDirections) {
Block sign = block.getRelative(direction);
// If the WALL_SIGN is NORTH of the hopper and facing NORTH it must
// be attached to the hopper.
if (direction == getSignD... |
5c3badd2-b78a-45b5-b0b8-bf0994f668d6 | 0 | public Upgrade[] getAllUpgrades(){
return this.allUpgrades;
} |
e8ecacbf-53f6-404e-83c8-6adb8780b6b8 | 9 | public void setImage(String image) {
if (image.indexOf('\\') == -1) {
this.image = image;
return;
}
int size = image.length();
StringBuffer buf = new StringBuffer(size);
for (int i = 0; i < size; i++) {
char c = image.charAt(i);
if ... |
29937afa-28df-48b2-8589-da41a83778c7 | 6 | @Override
public void caseAEscrevaExpLogicaDefinicaoComando(AEscrevaExpLogicaDefinicaoComando node)
{
inAEscrevaExpLogicaDefinicaoComando(node);
if(node.getPontoVirgula() != null)
{
node.getPontoVirgula().apply(this);
}
if(node.getRPar() != null)
{
... |
72a0cd4f-427c-4599-b22c-27075c2ca22f | 7 | public static void getRecommendation(int userId, Map<Integer, Map<Integer, Pearson>> pearsons) {
List<Pearson> userList = Pearson.getPearsonsFor(userId, pearsons);
Map<Integer, Double> totalPearson = new TreeMap<Integer, Double>();
Map<Integer, Double> totalWeight = new TreeMap<Integer, Double>();
for... |
584d5246-c06b-45c4-aa6a-0e6f16d74ecd | 6 | public PossibleConnection engageInsideParagraphs(
int i, int j, int firstInParagraph, int positionInParagraph) {
/* Inicijalizacija */
// Slucaj spoja
mostProbable11.setconnectionCase(11);
// Pretpostavimo da je to nemoguc spoj
mostProbable11.setProbability(0.0);
// Ocistimo listu elemen... |
b6a32adc-2e62-4655-b81a-15d75114a344 | 4 | protected void giveOffers()
{
for (ItemStack item : p1inv.getOthersItems()) {
if (item != null) {
p1.getInventory().addItem(new ItemStack[] { item });
}
}
for (ItemStack item : p2inv.getOthersItems())
if (item != null)
p2.getInventory().addItem(new ItemStack[] { item });... |
7a68b3c9-bd75-49ad-93f7-71470fcb7422 | 8 | public static void cutGem(final Client c, final int itemUsed, final int usedWith) {
if (isSkilling[12] == true) {
return;
}
final int itemId = (itemUsed == 1755 ? usedWith : itemUsed);
for (final cutGemData g : cutGemData.values()) {
if (itemId == g.getUncut()) {
if (c.playerLevel[12] < g.getLevel()) ... |
815b3a8e-bccf-438d-a963-7e34d634ecee | 5 | @Override
public void run() {
try {
sleep(2000);
} catch (InterruptedException ex) {
}
int direction = new Random().nextInt(4);
Position firePosition = calculatePosition(direction);
while (isAlive) {
try {
sleep(new ... |
43bee492-6c69-466e-9fe2-136483cb683d | 8 | @Override
public void levelUp() {
this.level++;
this.nextExp *= 1.1;
int total = 0;
while (total == 0) {
if (Math.random() > 0.5) {
this.maxHP += 3;
this.curHP += 3;
total++;
if (Math.random() > 0.8) {
... |
6a6c96de-d291-4e90-b29c-fcf149cb08bb | 8 | public int longestValidParentheses(String s) {
f = new Boolean[s.length() + 1][];
this.s = s;
for (int i = 0; i <= s.length(); i++) {
f[i] = new Boolean[s.length() + 1];
for (int j = i + 2; j <= s.length(); j += 2) {
f[i][j] = null;
}
}
int rst = 0;
for (int i = 0; i < s.length() - 1; i++) {
... |
5573bf7c-3523-42c9-8496-e3621957c348 | 7 | @Override
StatementResult execute0(ScriptScope scope) throws SynsException {
try {
StatementResult tryResult = synTryStatement.execute(scope);
return tryResult;
} catch (ThrowSynsException e) {
//Exception thrown by a script "throw" statement. The original excepti... |
f61cc45a-4f15-46fd-b4e0-41b33555aeb3 | 8 | public void lancerAlgo(Similarite s) {
this.similarite = s;
System.out.println("Lancement de l'algorithme avec la similitude suivante : " + this.similarite.getClass().getSimpleName());
boolean stable=false;
int compteur=0;
while (!stable && compteur<100) {
// Supprime tous les items des groupes p... |
9e561889-58d9-4a26-86f8-b6f0d482c36e | 7 | private void checkForCollisions () {
for (Participant p1: participants) {
Iterator<Participant> iter = participants.descendingIterator();
while (iter.hasNext()) {
Participant p2 = iter.next();
if (p2 == p1) break;
if (pendingRemoves.contains(p1)) break;
if (pendingRemoves.contains(p2)) break;
... |
ca845c3e-d3ea-4d56-9607-44c8d9c8e4f6 | 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... |
6115b743-9d78-4603-9b2b-7fbe608ef03b | 5 | public Network(String server, int port) throws ServerNotFoundException,
SocketBusyException, IOException {
if (server != null) {
Socket output;
try {
output = new Socket(server, port);
} catch (UnknownHostException e) {
throw new ServerNotFoundException();
} catch (IOException e) {
throw n... |
7345b28d-c9cb-423e-969a-6a9c129dcc7e | 3 | public RaumEigenschaftenPanel(Raum raum, EditorBeobachter beobachter)
{
assert raum != null : "Vorbedingung verletzt: raum != null";
Collection<Item> items = raum.getItems();
int kuchen = 0;
int giftkuchen = 0;
for(Item item : items)
{
if(item == Item.UKuchen)
++kuchen;
if(item == Item.UGiftkuch... |
0145d95d-2525-45b6-b2e0-2472c23feb91 | 9 | int insertKeyRehash(double 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... |
1b40f6e3-7f7a-4a62-9c5e-d735936efdf7 | 1 | public boolean fromElement(Element element) {
boolean result = true;
NodeList taskList = element.getElementsByTagName(C.task);
for (int i=0; i<taskList.getLength(); i++) {
Task task = new Task();
task.fromElement((Element)taskList.item(i));
taskStore.put(task.getId(), task);
}
retu... |
64144f26-2135-46ad-8e94-292f2e08439f | 8 | public void paint(Graphics g) {
Color bColor;
if(selected) {
bColor = getBackgroundSelectionColor();
} else {
bColor = getBackgroundNonSelectionColor();
if(bColor == null)
bColor = getBackground();
}
int imageOffset = -1;
... |
e258f27c-c2cd-456f-b231-4a08d4fbffbe | 3 | public List<OrdenDeCompra> getListaNumeroOrden(){
List<OrdenDeCompra> lnumero = new LinkedList();
Conexionbd.conexion bd = new Conexionbd.conexion();
ControladorUsuario cont = new ControladorUsuario();
try{
bd.conectarBase();
ResultSet rs = bd.sentencia.executeQuery("... |
5103ce26-202b-4e61-8cc7-9484d21b7395 | 4 | private JButton getBtnFind() {
if (btnFind == null) {
btnFind = new JButton("Find");
btnFind.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
WikiaXMLHandler xmlHandler = new WikiaXMLHandler();
String artistName = txFieldArtistName.getText();
... |
0abbedb6-751d-4378-a703-d6ad77823d78 | 6 | public void calculateNeighbours() {
for(int x=0; x<xmax; x++) {
for(int y=0; y<ymax; y++) {
Position temp = maze.get(y).get(x);
if(x==0) {
temp.east = maze.get(y).get(x+1);
} else if(x==xmax-1) {
temp.west = maze.get(y).get(x-1);
} else {
temp.east = maze.get(y).get(x+1)... |
ff826d31-535c-4b5c-b9de-65d0ab614b80 | 6 | private boolean validate(char[][] board, int x, int y) {
for(int i = 0; i < board.length; i++) {
for(int j = 0; j < y; j++) {
/**
* x==i,same row
* x+y == i+j,/ diagonal
* x+j == y+i,\ diagonal
*/
if(board[i][j] == 'Q' && ( x + j == y + i || x + y == i + j || x == i ))
return false... |
f68292c1-36ba-42e9-a774-f624d0b27133 | 2 | public void history(boolean isReset)
{
StringBuffer buffer = new StringBuffer();
String nStep = new String();
nStep =("Step: " + step + " ");
for(Color color : stats.keySet()){
Counter info = stats.get(color);
int stringLength = info.getName().length()... |
9f420457-52f9-4f36-b3ca-caf35fd60f4b | 0 | public DataPoint(float lat, float lng, float amount)
{
this.lat = lat;
this.lng = lng;
this.amount = amount;
} |
bbfeba50-3393-4225-a3e6-afa3cfea90b7 | 7 | public Sprite getCurrentCellSprite(int cellID) {
switch (cellID) {
case 1:
case 2:
case 3:
return getTileSprite(cellID - 1);
case 4:
return Stairs.SPRITE;
case 5:
return Turret.SPRITE;
case 6:
return Player.sprites[0][0];
case 7:
return Score.SPRITE;
default:
return new Sprite(tileSi... |
3fdd3a75-10e3-4c79-871b-2ed80619599f | 0 | public static void main(String[] args) throws InterruptedException {
// 同时启动两个线程对queue进行操作!
new MyThread("ta").start();
//Thread.sleep(1000);
new MyThread("tb").start();
} |
3eaadbee-2ab2-449f-9f4e-60d41e434233 | 0 | @Override
public void setCalle(String calle) {
super.setCalle(calle);
} |
9d92fa24-57dc-4719-b833-75ce5a02c061 | 9 | protected void genWeaponAmmo(MOB mob, Weapon W, int showNumber, int showFlag)
throws IOException
{
if((showFlag>0)&&(showFlag!=showNumber))
return;
if(!(W instanceof AmmunitionWeapon))
return;
final AmmunitionWeapon AW=(AmmunitionWeapon)W;
final String defaultAmmo=(AW.requiresAmmunition())?"Y":"N";
i... |
f8ce7fa8-93e3-4b5c-847e-fae094d1a883 | 4 | public double standardizedItemMaximum(int index){
if(!this.dataPreprocessed)this.preprocessData();
if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
if(!this.variancesCal... |
cb565229-327f-43d4-b190-6a001012b7de | 5 | public IVPNumber remainder(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... |
33571d7c-9378-4a7b-9cb7-f286bf26fbed | 4 | public void run(ReentrantLock physicsLock) {
while (!Display.isCloseRequested() && !quit){
// update 1 frame of display
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
GL11.glTranslated(0, 0, -centerDistance);
GL11.glRot... |
53f7e0c8-5ecf-406d-b859-05191e7bcda8 | 6 | public void loadAllQCReports(){
try {
allQCReports = null;
ResultSet dbAllQCReports = null;
Statement statement;
statement = connection.createStatement();
dbAllQCReports = statement.executeQuery("SELECT Q... |
2681103b-b12c-40f5-8ac3-34691f5bb220 | 6 | public RrdExportDef getRrdExportDef() throws RrdException
{
// basic check
if( !root.getTagName().equals("rrd_export_def") )
throw new RrdException("XML definition must start with <rrd_export_def>");
validateTagsOnlyOnce( root, new String[] {"span", "options", "datasources", "exports"} );
def = new RrdExpo... |
ab767622-1bc8-491c-a7fc-8e59d403ee52 | 0 | public final void show() {
StackPane parentRoot = (StackPane) ((Stage) stage.getOwner())
.getScene().getRoot();
parentRoot.getChildren().add(mask);
stage.show();
} |
50faa63a-531c-4376-9179-70ca285b3193 | 4 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
if (onkoKirjautunut(request, response)) {
try {
asetaAsiakkaanTiedot(request);
... |
a3c3e9ae-50ab-4826-bc7b-d0090b55b6a8 | 0 | @Temporal(TemporalType.DATE)
public Date getDataRejestracji() {
return dataRejestracji;
} |
8f5924c2-beb9-4c95-99d6-83d33ac53c48 | 2 | private void close() {
try {
if (lineInputReader != null) lineInputReader.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
} |
ad9994a6-67ae-462a-ac75-d7820f65db85 | 6 | public static void main(String[] args){
Display display = Display.getDefault();
PairOfStrings p=new PairOfStrings();
NickWindow w=new NickWindow(display,p);
w.setSize(400, 200);
w.pack();
w.open();
while (!w.isDisposed())
{
if (!display.readAndDispatch())
display.sleep();
}
if(p.nam... |
37c33a8e-5985-49f2-9a0b-c338ba80497f | 3 | public void deleteAll() {
try {
List<UserDTO> listaUserow = getAllUsers();
List<QuestDTO> listaQuestow = getAllQuests();
for (QuestDTO quest : listaQuestow) {
delete(String.valueOf(quest.getId()), "/deleteQuest");
}
for (UserDTO user : listaUserow) {
delete(user.getLogin(), "/deleteGame");
... |
59600ea9-dc0b-4b0e-8eac-fec0c1d6f63c | 0 | public void setIgnoreColumnIndex(int[] ignoreColumnIndex) {
this.ignoreColumnIndex = ignoreColumnIndex;
} |
5cd4d84b-094c-430d-b695-03bc2df38337 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Point point = (Point) o;
if (point.x != x) return false;
if (point.y != y) return false;
return true;
} |
c7c3ad48-689d-404f-8d8b-ed81fd481c9e | 0 | public ConvertPane(AutomatonEnvironment environment) {
this.environment = environment;
automaton = (FiniteStateAutomaton) environment.getAutomaton().clone();
JFrame frame = Universe.frameForEnvironment(environment);
setLayout(new BorderLayout());
JPanel labels = new JPanel(new BorderLayout());
JLabel main... |
ad74fd94-9c58-45d0-accd-2d5b2c3306b9 | 3 | public void parseVisitShow(Visitor<S, T> interp, Reader reader) {
FractalParser parser;
ASTProgram program = null;
System.out.print(PROMPT);
try {
parser = new FractalParser(new FractalLexer(reader));
program = (ASTProgram) parser.parse().value;
} catch (... |
9828de21-02ae-48e1-aee4-983287723118 | 6 | public void setWeight(int x1, int y1, int x2, int y2, int weight){
if(y2>this.height-1 || y2<0 || x2>this.width-1 || x2<0 || Math.abs(x1-x2)>1 || Math.abs(y1-y2)>1){
return;
}
this.graph.setWeight(this.grid.get(new Coordinate(x1,y1)), this.grid.get(new Coordinate(x2,y2)), weight);
... |
c08cc0d7-90ae-47cf-a83b-6a88caee1758 | 0 | public void setDisabled() {
enabled = false;
} |
2686fe4c-169b-4404-b74a-550ac033c380 | 6 | private Decision makeDecision(GameInfo currentGameInfo) {
int[] myDiceFrequencies = getMyDiceFrequencies(currentGameInfo);
int totalDice = currentGameInfo.getTotalDice();
int othersDice = totalDice - currentGameInfo.getMyDice().size();
Bid currentBid = currentGameInfo.getCurrentBid();
int onesGuess = othersDi... |
2af029d7-4762-4629-812a-8052324c3eb8 | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509Certificate", scope = X509DataType.class)
public JAXBElement<byte[]> createX509DataTypeX509Certificate(byte[] value) {
return new JAXBElement<byte[]>(_X509DataTypeX509Certificate_QNAME, byte[].class, X509DataType.class, ((byte[]) ... |
62b42e2c-c29f-4b98-8c02-50417905bcca | 1 | void removeListener(Listener l) {
if (log.isLoggable(Level.CONFIG)) {
log.config("Removing Notification Listener " + l);
}
ll.remove(Listener.class, l);
shouldFire = ll.getListenerCount() > 0;
} |
0729a1d1-1f1a-40b5-96bf-85c399882aa6 | 7 | public String getRoomDescription() {
String temp = roomDescription;
List<Item> noDescList = new ArrayList<>(); //List for the items with no description (dropped items)
List<Item> descList = new ArrayList<>(); //List for the items that are described (set by the room)
for(Item i: getRoomL... |
7694a1b4-2b2b-4667-99a6-82754517dbcc | 9 | private void deleteOldBackups () {
try {
//
File backupDir = new File(pSystem.getStringProperty(STRING_BACKUP_FOLDER));
// get every zip file in the backup Dir
File[] tempArray = backupDir.listFiles();
File[] array = new File[tempArray.length - 1];
... |
d64e3f27-66ef-4cdd-86f9-26dc1e2fc2e8 | 3 | @Test
public void getNextIsNotNullUntilListIsOver()
{
for (int i = 0; i < 1337; i++)
list.add("bleep");
boolean test = true;
for (int i = 0; i < 1337; i++)
if (list.getNext() == null) test = false;
assertTrue(test);
} |
bac2cc66-af6c-4d03-aa63-231febc5aa2a | 1 | private static String getStringFromDocument(Document doc) {
try {
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
... |
d4c779ac-5f6e-44c0-8932-bcaefc4f0737 | 4 | @Override
public List<User> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException {
int pageSize = 10;
List paramList = new ArrayList<>();
StringBuilder sb = new StringBuilder(WHERE);
String queryStr = new QueryMapper() {
@Overri... |
b55bc6c2-4c9c-483e-bf46-23c1d08b52da | 8 | private TreeNode2<T> delete(TreeNode2<T> root, T value) {
// first find the node that has the value
TreeNode2<T> node = find(root, value);
// not found
if (node == null) { return null; }
// search for a leaf to delete; swap values along the way
while (true) {
... |
468e8ea3-1530-4d75-9d47-d7d8cf95933d | 3 | private static void printDataResult(DataResult result) {
List<SatelliteData> data = result.getData();
if (data == null || data.size() == 0) {
System.out.println("No satellite data");
return;
} else {
System.out.println("data.length = " + data.size());
System.out.println("Satellite Data:");
}
int... |
5d9ee1a1-fddb-4e4e-804c-8e7e46ffa299 | 4 | public void insert (T i) {
if(i == null)
return;
if(root == null) {
root = new Node<T>(i, null, null);
size++;
return;
}
Node<T> cur = root;
while(cur.getNext() != null) {
if(i == cur.getElement() )
return;
cur = cur.getNext();
}
cur.setNext(new Node<T>(i, cur, null));
size+... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.