method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
03938513-2495-4c54-b69a-201df0912b41 | 2 | public static void rethrowRuntimeException(Throwable ex) {
if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
}
if (ex instanceof Error) {
throw (Error) ex;
}
throw new UndeclaredThrowableException(ex);
} |
d4723e0d-f7a2-4799-9425-32587e07c4ec | 7 | @Override
protected void addTransition(ItemPair from, Transition t1, Transition t2, ItemPair to) {
if (to != null) {
final PairTransition pt = new PairTransition(from, t1, t2, to);
transitions.add(pt);
if (to.equalItems() && !from.equalItems() &&
((t1 != null && t1.getType() == Reduce.class) ||
... |
8b59605c-1acb-4ded-aece-b4a3b443c4ea | 6 | public static void main(String[] args) {
Scanner s = new Scanner(System.in);
AudioFormat f= new AudioFormat(44100,8,1,true,true);
try{
SourceDataLine d = AudioSystem.getSourceDataLine(f);
d.open(f);
d.start();
String exitToken;
boolean morenote=true;
while(morenote) {
d.flus... |
540ae1d1-db40-44c5-8c30-8661b762b289 | 0 | public CanonicalizationMethodType getCanonicalizationMethod() {
return canonicalizationMethod;
} |
da5e2902-a974-4305-9ea6-ddf2a329daa9 | 0 | @Test
public void findBestCelsiusOfFive(){
List<ScaledQuantity> quantity_list = new ArrayList<ScaledQuantity>();
quantity_list.add(new ScaledQuantity(32, Temperature.Fahrenheit));
quantity_list.add(new ScaledQuantity(3, Temperature.Celsius));
quantity_list.add(new ScaledQuantity(1, ... |
51f153ea-8a18-417e-b706-3c801a44fc4f | 2 | public void setTransient(final boolean flag) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
int modifiers = fieldInfo.modifiers();
if (flag) {
modifiers |= Modifiers.TRANSIENT;
} else {
modifi... |
dba6f7c7-469c-48f5-bba6-d1f58d9366c1 | 2 | private static String getRandomSentance(int minwords, int maxwords, int maxSyl) {
String result = "";
Random r = new Random();
int nWords = r.nextInt(maxwords - minwords + 1) + minwords;
for(int i = 0; i < nWords; i++) {
result += getRandomWord(maxSyl);
if(i < nWords - 1)
result += " ";
}
... |
f4094874-530f-49b1-be2f-43b5a8ffdadd | 4 | public void move(int x, int y) {
boolean test = false;
if (test || m_test) {
System.out.println("Coordinate :: move() BEGIN");
}
// used by Othello class to iterate in a direction
// when capturing peices or checking if a move
// is valid.
m_X += x;
m_Y += y;
if (test || m_test) {
System.out.pr... |
e4339558-8000-4ffa-ba35-3b3bd8a88ac3 | 5 | @Override
public Class<?> getColumnClass(int columnIndex) {
switch (columnIndex) {
case 0:
return String.class;
case 1:
return String.class;
case 2:
return String.class;
case 3:
return String.clas... |
4d1805b7-e18a-4549-bf38-6ecc773168f6 | 7 | public Type getSpecializedType(Type type) {
/*
* tArray(x), iface -> tArray(x) iff tArray implements iface tArray(x),
* tArray(y) -> tArray(x.intersection(y)) tArray(x), other -> tError
*/
if (type.getTypeCode() == TC_RANGE) {
type = ((RangeType) type).getBottom();
}
if (type == tNull)
return thi... |
5a922586-5512-4d49-a034-2d03797746ac | 3 | private void waitForThread() {
if ((this.thread != null) && this.thread.isAlive()) {
try {
this.thread.join();
} catch (final InterruptedException e) {
plugin.getLogger().log(Level.SEVERE, null, e);
}
}
} |
ef5cdec5-1c50-4a16-b600-62669380e179 | 3 | public void visitForceChildren(final TreeVisitor visitor) {
if (visitor.reverse()) {
for (int i = params.length - 1; i >= 0; i--) {
params[i].visit(visitor);
}
} else {
for (int i = 0; i < params.length; i++) {
params[i].visit(visitor);
}
}
} |
3f5f8bf8-16e5-424b-8977-63dc5ec015a8 | 9 | public void physic() {
target = -1;
if (airID > Value.airCastle) {
for(int i=Screen.enemy.length-1;i>-1;i--) {
if (Screen.enemy[i].inGame && Screen.enemy[i].isDead == false) {
if (towerRange.intersects(Screen.enemy[i])) {
target = i;
}
}
}
}
if (target>=0 && coolDown == 0) {
... |
93fe8090-a1d1-446d-8c61-7dafb84fc9c2 | 2 | public Auto zoekAuto(String kt){
Auto antw = null;
for(Auto a: alleAutos){
if(a.getKenteken().equals(kt)){
antw = a;
break;
}
}
return antw;
} |
81bfaf8e-81c5-4d6b-9a30-831ceab8274f | 4 | boolean diffInOne(String w, String end){
int diff = 0;
for(int i = 0; i < end.length(); ++i){
if(w.charAt(i) != end.charAt(i)){
++diff;
if(diff > 1) return false;
}
}
return diff == 1? true : false;
} |
a5bc0914-b7f8-493b-89da-177ddcc8a5ef | 4 | public void playMusic(){
try {
Clip clip = AudioSystem.getClip();
InputStream is = new URL("http://amigocraft.net/assets/darklullaby.wav").openStream();
BufferedInputStream bIs = new BufferedInputStream(is);
AudioInputStream aIs = AudioSystem.getAudioInputStream(bIs);
clip.open(aIs);
clip.loop(Clip.... |
4102e9b7-6808-4bef-a832-eb5521fe82e4 | 5 | public boolean startsWithVowel()
{
char c=this.type.toString().charAt(0);
switch(c)
{
case 'A':
case 'E':
case 'I':
case 'O':
case 'U':
return true;
default:
return false;
}
} |
9f6d35f2-91bd-4c48-96a9-d84df7ed66f9 | 3 | public JSONWriter array() throws JSONException {
if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') {
this.push(null);
this.append("[");
this.comma = false;
return this;
}
throw new JSONException("Misplaced array.");
} |
4e79741b-24d8-4009-95b6-14caa09f3478 | 1 | private String parseArrayType(String str){
String type = "";
int i = 0;
do {
type = type+str.charAt(i);
i++;
}while(str.charAt(i)!='[');
return type;
} |
6c92a7c1-a233-42a1-9b9f-0b7183fcf6a0 | 8 | public Element handle(FreeColServer server, Player player,
Connection connection) {
ServerPlayer serverPlayer = server.getPlayer(connection);
Game game = server.getGame();
Unit unit;
try {
unit = player.getFreeColGameObject(unitId, Unit.class);
... |
b39d51a6-5c85-4084-b32e-92769f9451a6 | 1 | public LivePane getLivePane() {
if (livePanel != null){
return livePanel;
}
return new LivePane(this);
} |
a653f836-3dab-46a3-8662-6f5840b9dd19 | 7 | public String readTxtFileRangeRow(String filePath) {
StringBuilder contents;
contents = new StringBuilder();
try {
String encoding = "UTF-8";
// filePath = ClearUserByLocalTask.class.getResource("/").getPath() + filePath;
File file = new File(filePath);
// ... |
ca5e8d21-1242-41d6-aa60-fecceba60e0f | 2 | Filter createInstance(final String type, final Properties config, final ConnectionProcessor connectionProcessor) {
Class cl = classFor(type);
Constructor constructor;
try {
constructor = cl.getConstructor(ConnectionProcessor.class, Properties.class);
return (Filter) ... |
6725138a-1ed0-42d5-9516-08fdfa2d8c6c | 6 | public static void main(String[]args){
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
StringBuilder r=new StringBuilder();
boolean b = true;
while(in.hasNextLine()){
char[] e = in.nextLine().toCharArray();
for (char t:e... |
6b052a44-119e-428e-966e-8e5ec8dee322 | 6 | public void playDamageSound(Entity e){
if(e.getBody()==null) return;
String sound;
switch(damageType){
case DARKMAGIC:
sound = "horror";
break;
case ELECTRO:
sound = "noise1";
break;
case FIRE:
sound = "explosion1";
break;
case ICE:
sound = "clap1";
break;
case ROCK:
sound ... |
4a9890f2-072e-46db-8557-a9c3dd1f7072 | 1 | private String createRead() {
String param = "";
for(Column col : keyColumns){
param += col.getColName() + " = #{" + col.getFldName() + "} AND ";
}
param = param.substring( 0, param.length() - 5 );
StringBuilder sb = new StringBuilder();
sb.append( "\n"... |
6f12e42c-5f96-4b37-954e-99c60b933883 | 2 | public Boolean getIsinByOrdernumber(Statement statement,String ordernumber)//根据订单号获取是否进入(状态)
{
Boolean result = null ;
sql = "select isin from ParkRelation where ordernumber = '" + ordernumber +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result = rs.getBoolean("isin");... |
0aa52c9b-a80e-445e-bc7c-74ccdf8c9830 | 8 | public void update(Map userCredentials) throws AuthenticationException {
if (passwordFile == null) {
throw new AuthenticationException("update()", new IllegalStateException());
}
try {
String userName = (String) userCredentials.get(Registry.SASL_USERNAME);
String password = ... |
f648bc9f-10a8-4d44-9495-8b08c1e5a78f | 1 | protected void processKeyEvent(KeyEvent e) {
if(keyListener != null) {
keyListener.keyPress(e);
}
} |
ebdd775e-cfc4-45cf-b510-f27f665d9f7a | 0 | public int length() {
return length;
} |
8799981b-85d7-4d11-9a54-a42d6c178aca | 1 | public void hostMatch(String hostName){
try {
cs = con.prepareCall("{call hostMatch(?)}");
cs.setString(1, hostName);
cs.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
} |
a7b3941e-b363-4b39-a30d-b26627c12e5d | 4 | public static boolean sortVerify(String[] strArray) {
for (int i = 0; i < strArray.length; i++) {
if (strArray.length == 1) {
System.out.println("Array has only one element, so it is sorted. Element is " + strArray[i]);
return true;
} else if (i == 0) {
System.out.println("Skip the compare at the fi... |
d705d135-b6bb-4c27-ae4d-bde65ebd38d4 | 9 | int dijkstra(int start, int arrive, int goal){
dist = new int[ID][FINISH+1];
for(int[]a:dist)Arrays.fill(a, INF);
dist[start][arrive] = 0;
PriorityQueue<int[]> q = new PriorityQueue<int[]>(ID, new Comparator<int[]>() {
public int compare(int[] o1, int[] o2) {
return dist[o1[0]][o1[1]]-dist[o2[0]][o2[1]];... |
72b3ba0f-41ef-40cb-8f2c-eed52e36878a | 2 | @Override
public Connection open() {
if (initialize()) {
try {
this.connection = DriverManager.getConnection("jdbc:sqlite:" + sqlFile.getAbsolutePath());
return this.connection;
} catch (SQLException e) {
this.writeError("SQLite exception on initialize " + e, true);
}
}
return null;
} |
edaff9d7-8691-48d5-ab6c-19cbe02ef45f | 7 | public void actualiza() {
//Determina el tiempo que ha transcurrido desde que el Applet inicio su ejecución
long tiempoTranscurrido = System.currentTimeMillis() - tiempoActual;
//Guarda el tiempo actual
tiempoActual += tiempoTranscurrido;
barra.actualiza(tiempoActual);
... |
81d3ae2d-db5f-45e1-952d-8ac17432dcec | 4 | private static void writeFile(BufferedWriter bw, SignatureFile sf) throws IOException {
bw.newLine();
bw.append("<file>");
bw.newLine();
bw.append("<path>");
bw.append(sf.getFile().getAbsolutePath());
bw.append("</path>");
bw.newLine();
bw.append("<algor... |
261ccd72-36ca-4686-8580-f0966cc5e09e | 7 | Move(char c) {
if (c == 'w' || c == 'a' || c == 's' || c == 'd') {
this.value = c;
move = true;
} else if (c == 'x' || c == 'u' || c == 'r') {
this.value = c;
move = false;
}
} |
c391c3ff-0d0c-404f-ab45-1b34a852b388 | 9 | public boolean mouseClicked(MouseEvent e, Epitmeny epitmeny) {
int x = e.getX();
int y = e.getY();
for (int i = 0; i < paintables.size(); i++) {
if (paintables.get(i).getPositionX() <= x
&& paintables.get(i).getPositionX() + 60 > x
&& paintables.get(i).getPositionY() <= y
&& paintables.get(i).ge... |
81047504-1d07-40bf-9a67-bc376d93e2c3 | 5 | public synchronized void removeBooks(Set<Integer> isbnSet)
throws BookStoreException {
if (isbnSet == null) {
throw new BookStoreException(BookStoreConstants.NULL_INPUT);
}
for (Integer ISBN : isbnSet) {
if (BookStoreUtility.isInvalidISBN(ISBN))
throw new BookStoreException(BookStoreConstants.ISBN +... |
7f798053-a4b2-4273-bd02-85eba1225956 | 6 | public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof LabeledConstituent)) return false;
final LabeledConstituent labeledConstituent = (LabeledConstituent) o;
if (end != labeledConstituent.end) return false;
if (start != labeledConstituent.start) return false;
... |
1722d0e1-5e01-4b7b-a35b-c5907f4a6298 | 5 | private void traitementAjoutLivraison(){
if(vNAAjouter != null){
vNLivraisonAvant = vuePlan.getvNSelectionne();
if(vNLivraisonAvant.getEtatLivraison() == EtatNoeud.LIVRAISON ||
vNLivraisonAvant.getEtatLivraison() == EtatNoeud.RETARD){
conteneurDroite.ge... |
83d92d03-7a4d-4bd1-b8e2-051e241cb695 | 6 | public void actualiza() {
grav = 6 - lives / 3;
if (click) {
balon.setPosY(balon.getPosY() - bVely);
bVely -= grav;
balon.setPosX(balon.getPosX() + bVelx);
long tiempoTranscurrido = System.currentTimeMillis() - tiempoActual;
tiempoActual += tie... |
da5157f2-9cf7-477f-a6ad-728bfdba2103 | 0 | private void createTabPage2() {
userTabPane = new UserOptionsView();
lblOpcjeUserow = new JLabel("Opcje uzytkownikow, listy, dodawanie itd.");
userTabPane.add(lblOpcjeUserow);
getDataToTable();
addTable();
addRowToTable(getDataToTable());
} |
77d27beb-e4ac-416c-b7a5-98f38e2dccd1 | 9 | public void writeClassAndObject (Output output, Object object) {
if (output == null) throw new IllegalArgumentException("output cannot be null.");
beginObject();
try {
if (object == null) {
writeClass(output, null);
return;
}
Registration registration = writeClass(output, object.getClass());
i... |
ad7dca92-b756-48c2-b86d-eaa215a25162 | 7 | protected void determineUnusedIndices(Instances data) {
Vector<Integer> indices;
int i;
int n;
boolean covered;
// traverse all ranges
indices = new Vector<Integer>();
for (i = 0; i < data.numAttributes(); i++) {
if (i == data.classIndex())
continue;
covered = f... |
e5d9110f-ae26-4153-95b9-3102e8cf4538 | 9 | private List<String> returnExpr(List<String> tokenList) {
final int St_START = 1, St_LP_START = 2;
Iterator tokenIt = tokenList.iterator();
int currentState = St_START;
while (tokenIt.hasNext()) {
String nextToken = (String) tokenIt.next();
switch (currentState) {
case St_START:
if (nextToken.equ... |
0e31eee8-4698-4df2-99c5-58ff5fa9179c | 9 | public void update(Game game) {
ballRect.x += velocity.x;
ballRect.y += velocity.y;
ballRect.setRect(ballRect.x, ballRect.y, radius, radius);
ballRect.setBounds(ballRect);
// odbicie pilki od gracza
if (ballRect.getBounds().intersects(Game.player.paddleRect.getBounds())) {
velocity.x = -velocity.x;
... |
a2396134-1343-4bc0-b89e-1c8229a8409a | 3 | * @param offset the offset into base
* @param len the length of the range
* @return an array of vids that share all the chars of the range
*/
public String[] getVersionsOfRange( short base, int offset, int len )
{
try
{
BitSet bs = getVersionSetOfRange( base, offset, l... |
1f110e1e-534e-4243-82e4-884a0853e0f7 | 4 | public void process(){
switch(state){
case 0: //setup spelplan
break;
case 1: //spelarens tur
break;
case 2: //datorns tur
break;
case 3: //slut
break;
}
} |
adea7459-aaaf-433c-a2a8-995db74a7cd2 | 0 | public CheckResultMessage checkDayofMonth1() {
return checkReport1.checkDayofMonth1();
} |
951cc1e3-3ad8-4802-b65d-c3cd17e0981c | 1 | private void botonCargarPersonaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCargarPersonaActionPerformed
//Borrar lo que hay en el modelo
DefaultTableModel modelo = ((DefaultTableModel) jTable.getModel());
modelo.setRowCount(0);
//cargar la nueva lista
... |
f7f7a450-767e-4495-906a-e3eb6143e344 | 0 | public static GsonBuilder getDefaultBuilder() {
return defaultBuilder;
} |
ab3461e7-b726-492e-b824-eccbb930e481 | 5 | private Element generateColumnJustInBase(Document doc, ColumnInfo col) throws ParserConfigurationException {
/** Пример того что должно получится на выходе
* <Column place="base">
* <sTableName>CMS_WF_STATUS</sTableName>
* <sColumnName>ID</sColumnName>
* <sOwner>
... |
889f91d6-8c16-46a1-ac3a-5e3af8ec204c | 2 | public void compileShader() {
glLinkProgram(program);
if (glGetProgram(program, GL_LINK_STATUS) == 0) {
System.err.println(glGetProgramInfoLog(program, 1024));
System.exit(1);
}
glValidateProgram(program);
if (glGetProgram(program, GL_VALIDATE_STATUS) =... |
6793c0fa-3564-45b6-b559-4051a248db20 | 1 | public boolean update(Usuarios u){
PreparedStatement ps;
try {
ps = mycon.prepareStatement(
"UPDATE Usuarios "+
"SET nombre=?, dni=? "+
"WHERE codigo=?"
);
ps.setString(1, u.getNombre());
ps.setString(2, u.... |
b365c9d3-f9ad-448b-8e92-604f66ef5aad | 5 | public BackPropagation(int inputUnits, int hiddenUnits, int outputUnits){
constant = 0.1;
n = inputUnits;
m = hiddenUnits;
s = outputUnits;
double tmp;
// INICIALIZAR PESOS
wij = new double [m][n+1];
for(int i=0; i< m; i++){
... |
3ea1b8d3-9d6c-4acb-b49e-f34411ee768c | 7 | public Location getRepairLocation() {
final Player player = getOwner();
final Tile tile = getTile();
Location bestLocation = player.getEurope();
int bestTurns = (bestLocation == null) ? INFINITY
: getTurnsToReach(bestLocation);
for (Colony colony : player.getColonies(... |
8fecc4c3-dd7c-4cc0-a4b5-ff0a78ea6ca7 | 8 | public void renderProjectile(int xp, int yp, Projectile p) {
// xp -= xOffset;
// yp -= yOffset;
for (int y = 0; y < p.getSpriteSize(); y++) {
int ya = y + yp;
for (int x = 0; x < p.getSpriteSize(); x++) {
int xa = x + xp;
if (xa < -p.getSpriteSize() || xa >= width || ya < 0 || ya >= height) break;
... |
f0067b98-a897-4c6c-a0ac-f6e9d250efc2 | 9 | void backupMap()
{
try
{
StringTokenizer tknStore;
Mob mobStore;
Item itmStore;
Sign sgnStore;
Merchant mrcStore;
Prop prpStore;
synchronized(shrMap)
{
File deleteme = new File("backup/shortmap.backup");
deleteme.delete();
RandomAccessFile rafFile = new RandomAccessFile("backup/sh... |
df8e4798-a88d-4610-b6d4-1e8aa5243ca7 | 7 | private void jBt_IngresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBt_IngresarActionPerformed
// TODO add your handling code here:
ButtonModel bm = this.bG_Motivo.getSelection();
if(bm!=null){
if(this.jRb_Manual.isSelected()) // Si es ingreso manual... |
580da62a-b84d-4e1b-b32b-3ceec5a7795e | 9 | @SuppressWarnings("unchecked")
public void TextWrite() {
T src;
//V dest;
int w;
int count;
char[] ch;
int c;
int cx;
int cy;
// erase the entire screen to a tiled background
src = (T) ((flat_t) W.CacheLumpName(finaleflat, PU_CACHE, fl... |
6c3c7c2f-3fc1-43b0-bed9-7386a3cbe9cc | 8 | public void adjustAir()
{
int currentAir = 0; // current number of air molecules
for(Molecule mole : getMolecules())
if(mole instanceof Air)
currentAir++;
int desiredAir = (int)(pres/100); // desired number of air molecules
if(desiredAir > currentAir) // not enough air
{
for(int i = cur... |
5c698bd5-0e16-4252-b14f-a4a923b6bab5 | 3 | private byte[] getIV() {
if (algName.equalsIgnoreCase("TwoFish")) {
return trimBytes(16);
}else if (algName.equalsIgnoreCase("SkipJack")) {
return trimBytes(8);
}else if (algName.equalsIgnoreCase("Salsa20")) {
return trimBytes(8);
}
return IV;
} |
b2092e3c-eaa7-4373-8ae1-4904f76d3540 | 1 | public void visit_ifne(final Instruction inst) {
if (longBranch) {
final Label tmp = method.newLabel();
addOpcode(Opcode.opc_ifeq);
addBranch(tmp);
addOpcode(Opcode.opc_goto_w);
addLongBranch((Label) inst.operand());
addLabel(tmp);
} else {
addOpcode(Opcode.opc_ifne);
addBranch((Label) inst.... |
a9ad3f0b-9516-44a8-86dc-4290d395cc94 | 8 | public MappedDatParser(File datFile) throws IOException {
this.datFile = datFile;
FileInputStream in = null;
try {
in = new FileInputStream(datFile);
int headerSize = readInt(in);
int[] header = new int[headerSize];
for (int i = 0; i < header.length; i++) {
header[i] = readInt(in);
}
for (... |
aa2acad0-4afa-4433-afc5-3072888df247 | 8 | public Holder(T... a) {
if(a.length == NUM_OF_OBJECTS) {
objects = a;
} else if(a.length > NUM_OF_OBJECTS) {
objects = new Object[NUM_OF_OBJECTS];
for(int i = 0; i < NUM_OF_OBJECTS; ++i) {
objects[i] = a[i];
}
} else if(a.length < N... |
4f54bc4d-b019-4116-b45a-24d14d948166 | 6 | public Token nextToken() {
if (currentPosition == characters.length)
return Token.getTokenInstance("END");
char nextChar = consume();
StringBuilder builder = new StringBuilder();
builder.append(nextChar);
if (isAlpha(nextChar)) {
while (isAlpha(nextCha... |
93a5a598-21a0-4b3c-9d80-27cfc09d4a18 | 8 | private String handleRequest(String input) throws IOException, IllegalArgumentException {
System.out.println(input);
String nameReg = "[a-zA-Z0-9\\.]+";
String regex = "(boards)|(newBoard "+nameReg+")|"
+ "(switch "+nameReg+" "+nameReg+" "+nameReg+")|"
+ "(exit "+nameReg+")|(users "+name... |
666b307a-b515-4fc4-ba95-dfd6e30a7159 | 1 | @Override
public void notify(CollidableObject cObject)
{
if (cObject instanceof gameObjects.RedWhitePlane)
{
//do something
}
} |
0c13165f-bf89-4133-95c4-a6f9c5313905 | 7 | public static void main(String[] args)
{
int numero=0,c=0;
for (int i = 0; i < 2; i++)
{
numero=Integer.parseInt(JOptionPane.showInputDialog(null,"Ingrese un numero entero positivo"));
if (numero>0)
{
i=2;
}
... |
22c10c3e-899e-466f-845e-cba4d258f0b3 | 5 | private int getSyndromeIndex(String recievedi) {
int[] recieved = new int[7];
for(int i = 0; i < 7; ++i)
{
recieved[i] = recievedi.charAt(i) == '0' ? 0 : 1;
}
int[] syndrome = new int[3];
Arrays.fill(syndrome, 0);
// calc syndrome by z=Hr
for(int i = 0; i < 3; ++i)
for(int k = 0; k < 7; ++k... |
2d13105c-419d-4259-9212-b4dc055e2c2a | 8 | private void showEnergyTimeSeries() {
if (model.getKine().isEmpty() || model.getKine().getPointer() <= 0 || model.getPote().isEmpty()
|| model.getPote().getPointer() <= 0 || model.getTote().isEmpty() || model.getTote().getPointer() <= 0) {
JOptionPane.showMessageDialog(JOptionPane.getFrameForComponent(model.ge... |
0d26ac01-5b24-4ad1-9675-172c8d548133 | 1 | public List realsAtBlock(final Block block) {
final int blockIndex = cfg.preOrderIndex(block);
final List r = reals[blockIndex];
if (!realsSorted[blockIndex]) {
sortExprs(r);
realsSorted[blockIndex] = true;
}
return r;
} |
232fd4f0-e57c-48c2-b816-9343f1e91bc0 | 6 | private void drawGrid(Graphics2D g2d) {
g2d.setColor(Color.black);
float lineThickness = Math.max(SIZE / 10f - 1f, 1f);
g2d.setStroke(new BasicStroke(lineThickness));
// draw the normal grid
for (int i=0; i<=height; i++) {
g2d.drawLine(0, i*SIZE, width*SIZE, i*SIZE);
}
for (int i=0; i<=width; i++) {
... |
a7065449-58b0-4743-b9d4-716270c8c9a9 | 3 | public static void main(String [] args) throws Exception {
Connection conn;
String database;
Statement stmt;
if (args.length != 1) {
System.err.println("ERROR: " +
getClassName() + " <SQLITE_DATABASE>");
System.exit(1);
... |
e2fb5889-5489-468f-b48b-535e436eddfa | 6 | private void drawChar(byte text[], int x, int y, int width, int height, int color, int opacity) {
int newOffset = x + y * DrawingArea.width;
int place1 = DrawingArea.width - width;
int place2 = 0;
int oldOffset = 0;
if (y < DrawingArea.topY) {
int Height2 = DrawingArea.topY - y;
height -= Height2;
y ... |
3e336678-255e-4c69-b1ed-ae30efc2036e | 4 | @Override
public boolean equals(Object o){
if(!(o instanceof CSVData)){
return false;
}
CSVData cand = (CSVData) o;
if(cand.size() != this.size()){
return false;
}
for(int i = 0; i < cand.size(); ++i){
if(this.getAttribute(i) != cand.getAttribute(i)){
return false;
}
}
return true;
... |
a5195563-77ef-413d-ba1e-62a3c6cc1fe2 | 9 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String user = t1.getText();
String pass = new String(p1.getPassword());
String username;
pass = Md5Hash.passwordsalted(pass);
if (user.isEmpty())
{
... |
67ea089c-b362-4488-a00b-28c1343b409d | 1 | void run() {
final String listId = "asijdiasA1234";
try {
System.out.println("Subscription");
Subscription subscription = new Subscription(listId, "email@gmail.com");
subscription.setLang("pt");
subscription.putMergeVar("TEL", "11986991237");
subscription.setUpdateExisting(true);
... |
3d8ea527-123a-4e40-8f99-9d8d3a736464 | 4 | private IconEntry getIcon(String id) {
IconEntry ie = null;
for(int i=0; i<icons.size(); i++) {
ie = icons.get(i);
if(ie.appID.equalsIgnoreCase(id)) {
break;
}
}
if(ie!=null) {
if(!ie.appID.equalsIgnoreCase(id)) {
... |
ef7cedd7-acd8-457c-8fa5-a484b101f2ee | 7 | private void drawPanorama(int par1, int par2, float par3)
{
Tessellator var4 = Tessellator.instance;
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GLU.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
GL11.glMatrixMode(GL11.GL_MODELVIEW)... |
6bb45ca2-8cfb-49a1-a287-1cb9c36f9caf | 2 | public int[] BoyerMooreShiftTable(String pattern) {
int[] shiftTable = new int[alphabet]; int patternLength = pattern.length();
for(int aChar = 0; aChar < alphabet; aChar++) shiftTable[aChar] = -1;
for(int patternIndex = 0; patternIndex < patternLength; patternIndex++)
shiftTable[pattern.charAt(patternIndex)]... |
6d448f5f-8138-47f7-8c2c-673af566d3a7 | 4 | public static Shape buscarShapesParaFecha(List<Shape> shapes){
// Lo habitual es que venga ordenado de mas reciente a mas antiguo
Shape s = shapes.get(shapes.size()-1);
long fA = 00000101;
long fechaHasta = Long.parseLong(Config.get("FechaHasta"));
for (int x = shapes.size()-1 ; x >= 0 ; x--){
if (shape... |
48647377-937c-44b3-8b3a-3e49e5f6b931 | 2 | @Override
public void fill(ParametricCommandDescriptor descriptor, InvokableMethod origin)
{
Command annotation = origin.getMethod().getAnnotation(Command.class);
descriptor.setName(annotation.name().isEmpty() ? origin.getMethod().getName() : annotation.name());
descriptor.setDescription... |
acc459a4-e841-4860-b9b7-1fb8817aa685 | 9 | private void optimize(float HL) {
MakeTopo(); // establish temporary neighbouring through a modified delaunay algorithm
boolean[] deletion = new boolean[N];
for (int i=N-1;i>-1;i--)
{
int rem = 0;
double xi = (double)((Balloon)(BallList.get(i))).x0;
double yi = (double)((Balloon)(BallList.g... |
2649bf24-ebc9-4ece-bdcb-091f685e79f7 | 6 | public boolean mutateOrganism(Organism organism4mutation) { // before crossover
boolean changed = false;
int N = organism4mutation.getGenomeSize();
for (int i = 0; i < N; i++) {
double rand = Math.random();
if (rand < AppProperties.coefMutateAddNode()) { // p_mutate_add_n... |
136ae3e7-c684-4c2f-b8cc-5b63c51012e7 | 3 | public boolean isReady() {
for (Set<?> set : this.parametersList) {
if (set.isEmpty()) {
return false;
}
}
return true;
} |
fbc02192-5811-4b94-95a4-7097f91a185c | 8 | public static HbaseCell parseCheck(HTableMetaConfig metaConfig, String tableName, Watcher watcher, String check,
JSONObject jsonObj, boolean operationByQuery) {
byte[] bRowkey = null;
if (!operationByQuery) {
String rowkey = jsonObj.getString("rowkey");
if (Strings.is... |
f162e4b1-7591-4990-9abf-608e091bc1ca | 2 | public static ArrayList<Cliente> leerFichero(){
ArrayList<Cliente> array=new ArrayList<Cliente>();
try{
File fichero=new File("src/Ficheros/Clientes.txt");
FileReader fr=new FileReader(fichero);
BufferedReader br=new BufferedReader(fr);
String linea="";
while((linea=br.readLine())!=null){
Stri... |
20cae175-6478-4875-98d3-157c616c9cf1 | 0 | public int getData( )
{
return data;
} |
50a643f8-811a-4c4e-9019-3b67ed2a8d95 | 8 | public static URL getImageUrl(Map<String, String[]> parameterMap)
throws MalformedURLException {
StringBuffer uriSearch = new StringBuffer(URI_JSON_IMAGE);
for (String key : parameterMap.keySet()) {
if (key != null) {
if (key.equalsIgnoreCase(PARAM_QUERY)) {
uriSearch.append(URI_PARAM_SEP).append(pa... |
9187b8d6-318c-4b9b-9ed7-133d330fc902 | 5 | public static String getCallerCallerClassName() {
StackTraceElement[] stElements = Thread.currentThread().getStackTrace();
String callerClassName = null;
for (int i=1; i<stElements.length; i++) {
StackTraceElement ste = stElements[i];
if (!ste.getClassName().equals(Logge... |
6c5b03d8-5e6b-4e73-b3a0-d8f594db14b7 | 7 | public static int select(List<Integer> list, int index) {
int medianOfMedians = medianOfMedians(list);
int q = medianOfMedians;
List<Integer> partitionList = new ArrayList(list);
int beforeRank = 0;
int i = 0;
int j = partitionList.size() - 1;
do {
... |
76ea4c88-3523-4866-8afb-b12119f1c024 | 1 | public int binaryToDecimal(String binary) {
int decimal = 0;
for (int i = binary.length() - 1; i >= 0; i--) {
decimal += (binary.charAt(i) - '0')
* Math.pow(2, binary.length() - i - 1);
}
return decimal;
} |
54ee9a28-13d7-44d3-aeee-59d06816672d | 5 | private boolean intersectsOtherBlocks(BlockUsedInEditingScreen block) {
Compound<BlockUsedInEditingScreen> root = this.getParent();
List<BlockUsedInEditingScreen> blocks = root.getChildren();
for ( BlockUsedInEditingScreen otherBlock : blocks ) {
if ( otherBlock != this && otherBloc... |
b963f4f1-31c9-4471-bd07-15f778e9eeae | 7 | private void setUpField() throws Exception {
m_fieldIndex = -1;
m_fieldValueIndex = -1;
m_field = null;
if (m_fieldDefs != null) {
m_fieldIndex = getFieldDefIndex(m_fieldName);
if (m_fieldIndex < 0) {
throw new Exception("[NormDiscrete] Can't find field " + m_fieldName
... |
336d34a0-40ce-4608-93fc-c9a7c19fe8e3 | 3 | public List<Blab> getBlabs(String email)
{
Connection connection = null;
List<Blab> blabs = new ArrayList<Blab>();
String query = null;
PreparedStatement statement = null;
try
{
connection = dataSource.getConnection();
query = "SELECT blabs.id, blabs.content, users.username, blabs.timestamp... |
2c52a246-2093-43b2-9d4c-3ea290b88533 | 4 | public boolean check() throws IOException {
for (Map.Entry<String, String> node : old.entrySet()) {
int zeroByte = Math.abs(node.getKey().getBytes(StandardCharsets.UTF_8)[0]);
if (!((zeroByte % 16 == direcotryNumber) && ((zeroByte / 16) % 16 == fileNumber))) {
throw new I... |
09d25bf4-4e16-4cc9-8f01-53dea2366e2a | 2 | public List<RaavareDTO> getRaavareList() throws DALException {
List<RaavareDTO> list = new ArrayList<RaavareDTO>();
ResultSet rs = Connector.doQuery("SELECT * FROM raavare");
try
{
while (rs.next())
{
list.add(new RaavareDTO(rs.getInt(1), rs.getString(2), rs.getString(3)));
}
}
catch (SQLExcep... |
be1f46ca-a9a4-4fcf-967a-d4ea79dd7353 | 4 | protected String get_sub_cipher(String p,int start,int end,HashMap<Character,Pair<Integer>> h_map,char[][] square)
{
StringBuilder sb=new StringBuilder();
for(int i=start;i<end;i++)
{
char cur_c=Character.toUpperCase(p.charAt(i));
if(cur_c=='J')
{
cur_c='I';
}
Pair<Integer> row_col=h_map.get(c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.