method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2840d109-0c9a-4ce6-aff1-c5a344cc65c3 | 4 | public static DSResults calculate(BufferedImage[] images) {
// Find brightest pixel
BufferedImage chosenImage = images[0];
int x = 0;
int y = 0;
int z = 0;
int intensity = 0;
for (int i = 0; i < images.length; i++) {
byte[] pixels = ((DataBufferByte)... |
395207cd-808c-4bab-aa1b-b35006288598 | 7 | private void resetPosition(Tile current, int row, int col){
if(current == null) return;
int x = getTileX(col);
int y = getTileY(row);
int distX = current.getX() - x;
int distY = current.getY() - y;
if(Math.abs(distX) < Tile.SLIDE_SPEED){
current.setX(current.getX() - distX);
}
if(Math.abs... |
4c36bb46-e012-4263-9b6f-11e538afe41a | 5 | public static Collection<? extends Bean> attachInjectedBeansFromMethods(Set<Bean> beansCollection){
Set<Bean> beansComplete = new HashSet<Bean>();
for (Bean bean : beansCollection) {
Set<Bean> injectedBeans = new HashSet<Bean>();
for (String injectedBeansName : bean.getChildrenNa... |
e8712eaf-5bc5-4346-ab59-195fb5e2a865 | 0 | public void setPINKeyId(String value) {
this.pinKeyId = value;
} |
1ebd48c0-d586-43ed-911f-c77125466494 | 7 | public LineSegmentInt inflateXAlpha(InflateData inflateData) {
final int xpos = inflateData.getPos();
final int inflation = inflateData.getInflation();
if (isHorizontal()) {
return new LineSegmentInt(p1.inflateX(inflateData), p2.inflateX(inflateData));
}
if (getP1().getXint() == xpos && getP2().getXint() ... |
58255b20-95e6-49d7-bb04-c4acaec59f95 | 4 | public void filledRectangle(double x, double y, double halfWidth, double halfHeight) {
if (halfWidth < 0) throw new RuntimeException("half width can't be negative");
if (halfHeight < 0) throw new RuntimeException("half height can't be negative");
double xs = scaleX(x);
double ys = scale... |
daf1129e-eab8-4fe4-814d-258a2df33912 | 2 | private String retrieveQuote(String quote) {
int start = quote.indexOf("\"") + 1; // Get the location of the first quotation mark (") - Add 1 to skip quotation mark when capturing file name
int end = quote.indexOf("\"", start); // Get the location of the second quatation mark
if (start == -1 ||... |
c0de4176-52a3-4a55-b5db-2cbae90c358b | 6 | @EventHandler(priority = EventPriority.NORMAL)
public void onInventoryMoveItem (InventoryMoveItemEvent event)
{
if ( ! (event.getInitiator() instanceof PlayerInventory)
|| ! (event.getDestination() instanceof BrewerInventory))
return;
if (event.getItem().getType() != Mate... |
4f3463c6-6da8-487a-b45c-3b152544554f | 1 | public int getWidth() {
if (image != null)
return image.getWidth(null);
return 0;
} |
8435e8c2-bb8a-49f0-a677-1c643d83b60f | 0 | @Test
public void testGetDiag() {
System.out.println("geDdiag");
double l;
l= Math.sqrt(3);
assertEquals(l, new Cube(1,12,l).getDiag(), 0.00001);
} |
43d05d77-1c03-439d-895f-806815f10259 | 2 | private void doVelocity( String templateName, String outDir, VelocityContext context, VelocityEngine engine )
throws JxrException
{
// output file
File file = new File( outDir, templateName + ".html" );
file.getParentFile().mkdirs();
FileWriter writer = null;
try
... |
7b4de88f-563f-49ba-ba83-1e13982f2be3 | 9 | public boolean isCastlingMove(Piece piece, Field from, Field to) {
int fileDifference = from.distanceBetweenFile(to);
if (piece instanceof King && piece.isFirstMove() && to.inSameRankAs(from) && Math.abs(fileDifference) == 2) {
Field rookField = this.window.board.getField(fileDifference == 2 ? 'h' : 'a', from.ra... |
8306cc7f-0e74-4dbe-97ec-b2dd9a4c0a06 | 6 | @EventHandler
public void GiantRegeneration(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.getGiantConfig().getDouble("Giant.Regen... |
9fbb06b3-7e24-417c-b279-e97868ba3a3c | 2 | static void compress(FrequencyTable freq, InputStream in, BitOutputStream out) throws IOException {
ArithmeticEncoder enc = new ArithmeticEncoder(out);
// int count = 0;
while (true) {
int b = in.read();
if (b == -1)
break;
// System.out.print("\r"+(++count));
enc.write(freq, b);
}
// System.... |
c14a9eb1-a5e9-4aad-b771-d8d080b6f445 | 3 | private void placeLightGrenades() {
while (getLightGrenadeCoverage() < coverage) {
int randomX = (int) Math.round(Math.random() * grid.width);
int randomY = (int) Math.round(Math.random() * grid.height);
LightGrenade lg = new LightGrenade(new Position(randomX, randomY));
if (grid.validPosition(lg.getPosi... |
9072b201-9bc9-428e-a3bc-6d0ff662ad30 | 7 | public static String getPermutationString( final List<LocationList> variations, long variationi ) {
String INVALID = "ø";
if (( null == variations ) || ( 0 == variations.size() )) return INVALID;
if ( 0 > variationi ) return INVALID + "(" + variationi + ")";
long numVariations = getPermutationCount( variati... |
0f9044a3-1f38-4810-babc-0cd7024874ee | 5 | private void readPrefixes(BufferedReader reader, ImageBuilder imgBuilder)
throws IOException {
int tokenCounter = 1;
while (tokenCounter < 5) {
String line = trimLine(reader.readLine());
if (line.equals("")) {
continue;
} else {
String[] tokens = line.split(PIXEL_DELIMITER);
for (int i = 0;... |
bec5d49d-a199-4815-9057-afd97e0bf587 | 4 | public static String[] insertionSort(String[] data, int firstIndex, int numValues)
{
String tempString;
int i;
int j;
int k;
for (i=1; i<numValues; i++)
{
tempString = data[firstIndex+i];
for (j=firstIndex+i; j>firstIndex; j--)
{
if (tempString.compareTo(data[j-1]) >= 0)
break;
... |
1425efdc-32f6-4bd3-acd4-50e36489682d | 2 | @Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_ENTER) {
try {
// login();
} catch (Throwable e1) {
e1.printStackTrace();
}
}
} |
6b3d0c7a-7535-4bd2-89b4-60593122c44d | 5 | @Override
public void render(Graphics g) {
for(int y = 0; y < tiles[0].length; y++)
for(int x = 0; x < tiles.length; x++)
perspective.render(g, tiles[x][y]);
for(int y = 0; y < tiles[0].length; y++)
for(int x = 0; x < tiles.length; x++)
for(Entity entity : tiles[x][y].getEntities())
perspective... |
e0cdfc08-13a4-481a-898e-da9e8b45d1c2 | 4 | public Collection operands() {
if (operands == null) {
return new ArrayList();
}
for (int i = 0; i < operands.size(); i++) {
final LocalExpr ei = (LocalExpr) operands.get(i);
for (int j = operands.size() - 1; j > i; j--) {
final LocalExpr ej = (LocalExpr) operands.get(j);
if (ei.def() == ej.de... |
0016f0e4-3bd3-470b-ba0e-db60c2060e5b | 1 | public static String getRainfall(String date, String state)
{
DB db = _mongo.getDB(DATABASE_NAME);
DBCollection coll = db.getCollection(COLLECTION_RAINFALL);
BasicDBObject query = new BasicDBObject();
query.put("year", "" + getYear(date));
query.put("month", "" + getMonth(date));
query.pu... |
a7c6dc5e-a5a7-4ef7-b26c-bebbf0a8a246 | 1 | public void drawCheckBox(Graphics g, Rectangle box, boolean checked, String name){
g.setColor(Color.GRAY);
g.fillRect(box.x, box.y, box.width, box.height);
if (checked)
g.setColor(Color.RED);
else
g.setColor(Color.WHITE);
g.fillRect(box.x + 3, box.y + 3, box.width - 6, box.height - 6);
g.setColor(new ... |
9e1f462e-f696-449e-a102-997403198571 | 4 | @Override
synchronized
public void train() {
//
this.init();
//
this.notifyStarted();
//
// iterate epochs.
//
final SampleSet tset = this.trainset;
//
double[] minweights = this.net.getWeights().clone();
double minerror = D... |
16ac703c-d9d7-4bc6-bd46-84ffd5559c13 | 5 | public void setImage(File file) {
if (pic != null)
oldpic = new Picture(pic.getImage());
if (file == null || !file.isFile())
return;
try {
pic = new Picture(file.getAbsolutePath());
} catch (IOException e) {
e.printStackTrace();
}
if (!pic.isNull())
repaint();
} |
60bf5501-ec0c-48c8-b304-2cc5ae5de32c | 4 | public static Bookmark getResData(List<Bookmark> lines, int userID, int resID) {
Bookmark returnData = null;
for (Bookmark data : lines) {
if (data.resID == resID) {
returnData = data; // old
if (userID != -1 && data.userID == userID) {
returnData = data;
return returnData;
}
}
}
ret... |
5d543ede-2586-42ee-9eb2-d5abb25c093d | 5 | private int findHeaderEnd(final byte[] buf, int rlen) {
int splitbyte = 0;
while (splitbyte + 3 < rlen) {
if (buf[splitbyte] == '\r' && buf[splitbyte + 1] == '\n' && buf[splitbyte + 2] == '\r' && buf[splitbyte + 3] == '\n') {
return splitbyte + 4;
... |
6a4145c2-9f6a-4b27-8310-36d41785cb5e | 6 | public Set<Light> updateLights(int[][] board) {
Random r = new Random();
for (Light l : lights) {
MoveableLight ml = (MoveableLight)l;
// randomly move it in one direction
// these methods return true if the move is allowed, false otherwise
// a move is not allowed if it would go beyond the world b... |
e830c90f-130c-4fa7-91ca-67f7ad50edbe | 7 | public String extractNouns(String document) {
String output = "";
String word;
if (document.length() > 1) {
try {
workflow.analyze(document);
LinkedList<Sentence> resultList = workflow
.getResultOfDocument(new Sentence(0, 0, false));
for (Sentence s : resultList) {
Eojeol[] eojeolArray ... |
b38e71db-2847-4017-8747-9de16b7054c8 | 0 | public int getDestinationStop() {
return this._destinationStop;
} |
555fd5ab-f0dc-478e-a151-48dfde37bca3 | 2 | @SuppressWarnings("unchecked")
ArrayList new14() /* reduce AAmethoddecl4Methoddecl */
{
@SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
@SuppressWarnings("unused") ArrayList nodeArrayList13 = pop();
@SuppressWarnings("unused") ArrayList nodeArrayList12 = pop();
... |
07c64e7a-426b-48d5-96cd-400f96234fe0 | 1 | @Override
protected void onMessageNotDelivered(int messageId, int resendMessageId, int clientId, String message) {
System.out.println("Message not delivered to client " + clientId + ": \"" + message + "\" Resending...");
try {
resend(clientId, resendMessageId, message);
} catch (CouldNotSendPacketException e)... |
b09cfa4b-0f09-4e25-840c-b51d50b2e1c2 | 4 | public void move()
{
// Move character
setY(getY()+getDy());
setX(getX()+getDx());
// Set the current direction
if(getDx() > 0){
setDirection("right");
} else if(getDx() < 0) {
setDirection("left");
}
if(getDy() > 0){
... |
68cdb71e-c08c-4bca-a260-eb339d809819 | 9 | public static void computeGreedyOpenGoalOrdering(List optimizervariables, int numberofopengoals, List goalsequence, double priorcost, double priorfanout) {
{ Cons goalsequencecheckpoint = null;
int choicepointunbindingoffset = Stella.NULL_INTEGER;
Proposition bestgeneratorgoal = null;
double bestg... |
2bec0195-a039-44cc-b0d0-0cc76d01b7b1 | 2 | public DiscoveredClient getClientForIP(String IP)
{
synchronized(threadLock)
{
Iterator<DiscoveredClient> it = getClients().iterator();
while ( it.hasNext() )
{
DiscoveredClient thisClient = it.next();
if ( thisClient.getAddress().getHostAddress().equals(IP) )
return thisClient;
}
}
re... |
70f3716b-8772-4ae0-8b4f-fea5f663a9df | 0 | public double getLatitude() {
return latitude;
} |
49c90774-0193-4a0c-b718-15ee3ffe55ec | 2 | public void toggleMusic(){
//A musica tá tocando?
if(music.playing())
music.stop();
else{
music.play();
music.loop();
music.setVolume(0.3f);
}
if(!muted)
muted = true;
else
muted = false;
... |
c344bdf0-6833-4213-83ee-919764365db3 | 9 | public void setUp() throws Exception {
log.trace("Node2::setUp()");
context = NodeTool.createContext("/META-INF/spring/node22.xml");
// Paxos Group B
leaderB = (PaxosLeader) context.getBean("protocolBL");
followerB = (PaxosFollower) context.getBean("protocolB2");
followerB.addListener(new ProposalListene... |
74c2b5cb-11db-42c1-aab0-80bdc1746231 | 5 | @Override
protected Integer doInBackground() throws Exception {
try {
if (bi == null || sizeChanged) {
File thumb = new File(realImgPath);
if (thumb.exists()) {
bi = ImageIO.read(thumb);
}
else {
bi = ImageIO.read(new File(image.filepath + "\\" + image.filename));
if (th... |
6c48d380-0385-44ea-aa85-72f1f7ec4a99 | 4 | public String[] getAliveTags(String[] tagArray){
LinkedList<String> list = new LinkedList<>();
StringBuffer sqlRequest = new StringBuffer(TAG_IS_ALIVE);
for(int i = 0; i < tagArray.length -1; i++){
sqlRequest.append(TAG_IS_ALIVE_CONTINUE);
}
try {
PreparedStatement statement = connection.prepareSt... |
774f57fe-22ec-4b5d-99fc-ce6d9d9a0feb | 8 | public void removePhraseStructureEdge(PhraseStructureNode parent, PhraseStructureNode child) throws MaltChainedException {
if (parent == null || child == null) {
throw new MaltChainedException("Parent or child node is missing.");
} else if (parent instanceof NonTerminalNode && !child.isRoot()) {
for (Edge e :... |
9b51fbbe-7920-4533-9ece-04005fa64ea2 | 1 | private String getFourNum(){
if ((this.MsgNum++) >= 10000) this.MsgNum=0;
String returnnum ="000"+ String.valueOf(this.MsgNum);
return returnnum.substring(returnnum.length()-4);
} |
9740bafb-f802-4adc-90a1-4d27c7b279c8 | 9 | protected static boolean isPrimeSqrt(long number) {
if (number == 1) {
return false;
}
if (isEven(number)) {
return (number == 2) ? true : false;
}
if ((number % 3) == 0) {
return (number == 3) ? true : false;
}
if ((number % 5) == 0) {
return (number == 5) ? true : false;
}
... |
6566baab-c3b2-48b5-b1e4-33ffa6d64dac | 7 | public static void playerturn() {
Room2 room2 = new Room2();
EnemyRat playerTurn = new EnemyRat();
@SuppressWarnings("resource")
Scanner userInput = new Scanner(System.in);
Random rnd = new Random();
int playerHitChance;
int playerAttack;
String playerAction;
if (enemyHealth > 0 && Statistics.Heal... |
a04567aa-0e6a-4cc3-8565-bb9ec094c915 | 7 | private void leLabirinto(Scanner arquivo) throws Exception {
String cmd = arquivo.next().toLowerCase();
while (cmd.equals("room")) {
int salaId = arquivo.nextInt();
salas[salaId] = new Sala();
Sala sala = salas[salaId];
countSalas++;
String direcao = arquivo.next();
do {
if (arquivo.hasNextI... |
f334743d-092c-4969-ab17-4d2b53e8bbea | 2 | public void setCast3(String[] src) {
charCast3 = new Image[src.length];
for (int i = 0; i < src.length; i++) {
try {
charCast3[i] = new Image(src[i]);
} catch (SlickException e) {
System.out.println(e);
}
}
} |
c642c886-0a9b-40c5-8b7d-1de4629fea3c | 4 | public static ArrayList<PositionProportion> isOnVectorLine(Position startPosition,
Vector applyVector, List<Position> pos, double APROX)
{
ArrayList<PositionProportion> result = new ArrayList<PositionProportion>();
for (int i = 0; i < pos.size(); i++)
{
Position posTemp = pos.get(i);
double a = appl... |
7192afac-5e26-4f61-a021-f24f2016da38 | 4 | public boolean isYBlocked(int x, int y, int width, int height, float moveY) {
// If there is no movement in y direction.
if (moveY == 0) {
return false;
}
// Calculates the correct y, depending on the move direction.
int yindex1;
if (moveY < 0) {
yindex1 = (int) Math.floor(y / getDimension());
} el... |
3ee62ce5-0a1c-426a-831e-b84d6b9d0e1f | 5 | public boolean validBlockType(Material type) {
// Disable sand and gravel entirely until I can figure out how to listen correctly for the physics events
if (type.equals(Material.SAND) || type.equals(Material.GRAVEL)) {
return false;
}
List<Material> whiteList = Config.getWhiteList();
if (whiteList.size() > ... |
deadb3a8-67e8-4779-b28c-367f3ef58197 | 8 | @EventHandler
public void onBlockBreak(BlockBreakEvent e)
{
Player p = e.getPlayer();
Block block = e.getBlock();
if ((block.getType() == Material.SIGN) || (block.getType() == Material.SIGN_POST))
{
for (int i = 0; i < SignsManager.t.size(); i++)
{
Tabliczka tabli = SignsManag... |
e6c8573a-fdb6-460e-bc46-a807fad68979 | 2 | public void setWalk(String[] src) {
charWalk = new Image[src.length];
for (int i = 0; i < src.length; i++) {
try {
charWalk[i] = new Image(src[i]);
} catch (SlickException e) {
System.out.println(e);
}
}
} |
cac041a6-88f0-4124-add6-d86f5c70b97b | 3 | public List<User> getFollowing(String userEmail)
{
initConnection();
List<User> friendsList = new ArrayList<User>();
String preparedString = null;
PreparedStatement preparedQuery = null;
try
{
//Prepare Statement - Get all user's friends with a JOIN ("Following")
preparedString = "SELECT users.em... |
54d30f06-500e-406e-887b-8133036235ad | 2 | public boolean contains(String itemName){
for(Item i : items){
if(i.getName().equalsIgnoreCase(itemName)){
return true;
}
}
return false;
} |
ebaa64ec-0dea-4374-b4c7-3ba9bffda363 | 2 | void checkCircular() {
if (graph.isEmpty()) {
return;
}
for (Object probe : graph.keySet()) {
check(probe, probe);
}
} |
3be018b0-1fb7-448a-8873-b45f6854a2a5 | 8 | private static int solvePar( long p , int n ) {
int nodoSolucion = -1;
boolean termine = false;
while( !termine ){
if( papasSecciones[n]!=-1 ){
long k = Math.abs(niveles[papasSecciones[n]] - niveles[n]);
if( p-k == 0 ){
termine = true;
nodoSolucion = papasSecciones[n];
}else if( p-k > 0 )... |
20eea005-ae69-4a38-997b-4950f65b3a6b | 5 | public void display() {
System.out.println("## Heap Dump");
DecimalFormat format = new DecimalFormat(",###");
for(int i = 0; i < dumpFiles.size(); i++) {
System.out.println("### Dump " + i + " [" + dumpFiles.get(i).getCounterName()
+ " = " + format.format(dumpFiles.get(i).getCounter()) + "]"
... |
bc9e9bda-9f3e-4d19-9ebb-12c13cc099a7 | 5 | public void actionPerformed(ActionEvent e) {
Object o = e.getSource();
Debug.print("Action performed on: " + o);
if(o == okButton) {
// update everything in the fermDB
db.fermDB = pantryFermTableModel.data;
db.writeFermentables();
db.hopsDB = pantryHopsTableModel.data;
db.writeHops();
... |
a69c505e-2e32-42a4-b337-841b74f710d5 | 5 | public static void agregarArreglo(TipoArreglo tipo){
switch(tipo){
case INTEGER:
arreglos.add( new ArregloEntero("Set"));
break;
case STRING:
arreglos.add( new ArregloString() );
break;
case CHAR:
... |
3c72e86b-4d54-46e2-8b87-9b243f9091a9 | 0 | public JobSchedulerBuilder withRequestRecovery( boolean requestRecovery )
{
this.requestRecovery = requestRecovery;
return this;
} |
304ca50e-2e0a-4c9a-b946-7d9089b293cc | 8 | public String toString()
{
switch(this.typeid)
{
case t_error:
case t_int:
case t_bool:
case t_unit:
case t_nil:
case t_function:
return this.typeid.toString();
case t_pair:
return this.t1.toString()+" * " +this.t2.toString();
case t_list:
return this.t1.toString()+" list";
}
return ""... |
e53021ca-cabd-41ce-948b-8d02a96bc631 | 2 | @Override
public void render(Graphics g) {
if (type == GHOST_IMMORTAL) g.setColor(Color.GREEN);
else if (type == GHOST_KILLABLE) g.setColor(Color.RED);
g.fillRect((int) x, (int) y, 20, 20);
} |
ba0f5a96-16fb-46c1-b74b-3c066899444d | 6 | public static Alignment align(Sequence s1, Sequence s2, Matrix matrix,
float o, float e) {
logger.info("Started...");
long start = System.currentTimeMillis();
float[][] scores = matrix.getScores();
int m = s1.length() + 1;
int n = s2.length() + 1;
byte[] pointers = new byte[m * n];
// Initializes th... |
bbcc8bea-5c4c-4faf-abb5-8cbf2505b3a2 | 6 | public void evaluateFlags(Graphics g) {
if(screen.getScreenType() == Screens.MULTIMENU) {
ipText.setVisible(true);
connectPortText.setVisible(true);
hostPortText.setVisible(true);
}
else {
ipText.setVisible(false);
connectPortText.setVisible(false);
... |
b0c2c689-e027-49c8-b38f-11a974f19c95 | 6 | public String getOutput(int id) {
int givenID = id;
String out = "";
for (int i = 0; i < exterior.length; i++) {
if (exterior[i] != null) {
out += exterior[i].getOutput(givenID);
givenID = givenID + 7; //there are 6 id hits in each spire
... |
653372a7-15e5-4987-99b1-ad9b0be5223d | 0 | @Override
public void setQuestAnswer(ArrayList<String> answ) {
this.questAnswer=answ;
} |
30a8278d-4e07-4112-9823-9b5d7e309040 | 3 | public void sortSampling(int array[]) {
int min;
for(int k=0; k<array.length; k++) {
min = k;
for(int i=k+1; i<array.length; i++)
if (array[i] < array[min])
min = i;
swap(array, k, min);
}
} |
70aada36-4f15-413e-9b5e-cfc3fb16d5bc | 1 | public Bitmap(String file)
{
try
{
image = ImageIO.read(Bitmap.class.getResourceAsStream(file));
} catch (IOException e)
{
e.printStackTrace();
}
width = image.getWidth();
height = image.getHeight();
pixels = image.getRGB(0, 0, width, height, null, 0, width);
} |
861500f7-e220-48f9-a5e3-ecb779f149ef | 1 | public static String identityToString(Object obj) {
if (obj == null) {
return EMPTY_STRING;
}
return obj.getClass().getName() + "@" + getIdentityHexString(obj);
} |
f5b9fe83-1a5b-4790-b431-d48626ac68eb | 0 | public boolean getAutopaint() {
return autopaint;
} |
ef5587b6-1953-4238-bc34-a1763c7e3ffd | 1 | public void run() {
while (true) {
setVal( (int)LogController.getConsumedLogs() );
}
} |
638e11bc-70b7-43ae-a927-8c5a43951ee5 | 3 | @Override
public Map<String, Collection<?>> call() throws Exception {
Collection<Fetcher> fetchers = new ArrayList<Fetcher>();
String url = TBShopExtractUtil.extractUrl(this.getResponseWrapper(),
this.getLogger());
Fetcher itemListFetcher = new TBShopFetcher(new RequestWrapper(url,
new TBItemListCallb... |
67533dfe-6c3c-4ab6-a75a-074146723251 | 1 | public void addRow(Object[] array) {
// data[rowIndex][columnIndex] = (String) aValue;
// add row to database
EntityTransaction userTransaction = manager.getTransaction();
userTransaction.begin();
People newRecord = peopleService.createPeople((String) array[0],
(String) array[1], (String) array[2], (Stri... |
25228c16-f0b5-41da-a906-4052173dee89 | 0 | public void setEncoding(String value) {
this.encoding = value;
} |
08eb16b9-c66d-4aee-95b8-56c232d73ad3 | 4 | public static boolean check_type_exist(Type_table type_table, String name) {
if (name.equals("integer") || name.equals("boolean"))
return true;
for (int i = 0; i < type_table.type_name.size(); i++) {
if (type_table.type_name.get(i).toString().equals(name)) {
retur... |
ff1379d5-8eec-4dc8-aab3-dfcee3bbc908 | 0 | @Test
public void testSchemaPopulation() throws IOException, SQLException, ClassNotFoundException, ParseException {
SqlTester.executeSqlFile("test/resources/createTestDb.sql");
Populator p = new Populator();
p.generators.addAll(this.test1Generators());
p.populateSchema("test1");
... |
bf7daae4-5f51-4dbd-a6e8-8e5d3a67b3f8 | 2 | public static void setPermissions(ChunkyObject object, ChunkyObject permObject, HashMap<PermissionFlag, Boolean> flags) {
if (flags == null) {
ChunkyManager.getPermissions(object, permObject).clearFlags();
DatabaseManager.getDatabase().removePermissions(object, permObject);
r... |
d329a0ce-46d8-4888-aacf-0f110860ad6e | 5 | private void stateRCFill(){
for(int y=0;y<= ymax-1;y++){
for(int x=0;x<= xmax-1;x++){
if( y % 2 == 1 || x % 2 == 1){stateCheckDraw(x,y,true);}
else{stateRandDraw(x,y);}}}
if(mode != 3){mainBrain.refreshState();}
} |
51964b34-4498-422f-8aa3-b96e527861f5 | 4 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = DrawingTools.setupGraphics(g);
Position posa = connection.getA().getPosition();
Position posb = connection.getB().getPosition();
BasicStroke stroke;
switch (connection.getType()) {
case normal:
stroke = new... |
995f4c9f-2c60-4090-9c95-c17de544ca8a | 4 | public TreeBipartition getBipartition(TreeNode node) {
if (! internalNodes.contains(node) && ! externalNodes.contains(node)) {
throw new IllegalArgumentException("that node doesn't seem to be in the tree");
}
Set<TreeNode> outgroup = new HashSet<TreeNode>();
for (JadeNode t : externalNodes) {
out... |
427a22a8-6e7a-42bc-838e-553ec3f95147 | 5 | public void senseDialUp() throws DialErrorException {
if(d.getDialPosition() == 3) {
System.out.println("Already on highest setting");
throw new DialErrorException();
}
else {
d.setDialPosition(d.getDialPosition()+1);
if((l.getLeverPosition()).equals("INT")) {
switch(d.getDialPosition()) {
case 1: {
w.setWi... |
69b57abd-6cea-4b52-8642-dc08bbfbecb1 | 7 | public Parameters(String requestStr) {
int firstLine = requestStr.indexOf("\r");
int spaceIdx = requestStr.indexOf(" ");
int httpIdx = requestStr.indexOf("HTTP/1.");
int queryIdx = requestStr.indexOf("?");
if(firstLine != -1) {
if(spaceIdx != -1 && spaceIdx <= firstLi... |
a19112e3-0a8f-462e-b4d9-6544c87de416 | 5 | public boolean checkGoal(State state) {
for (int k = 0; k < state.getData().size(); k++) {
for(int m = 0; m < state.getData().get(k).size(); m++) {
if (state.getData().get(k).get(m).equals("$") || state.getData().get(k).get(m).equals(".")) {
return false;
}
}
}
endTime = System.nanoTime();
... |
27bf467e-606e-4fad-b114-a13345674086 | 1 | protected String getItemTag() {
switch (type) {
case Atom: return "entry";
default: return "item";
}
} |
ce7a9177-3899-4d9d-984a-78f11a22fce7 | 4 | public static void main(String[] args) {
Stack[] stacks = {new Stack(JAVA), new Stack(MINE), new StackHanoi(JAVA), new StackHanoi(MINE)};
for (int i = 0; i < MAX_LOOPS; ++i) {
int num = (int) (Math.random() * 1000) % MAX_INTEGER;
for (Stack stack : stacks) {
stack... |
455d13d1-2150-4646-85f5-4a513c4f1c65 | 3 | public Color getSquareColor( SquareSelector squareSelector, int roomId, int squareId ) {
if ( roomId < 0 || squareId < 0 ) return null;
if ( isSquareValid(squareSelector, roomId, squareId) )
return validColor;
else
return invalidColor;
} |
5222f84c-88a5-4197-a467-5e62d1853bfe | 5 | @Override
protected void onNickChange(String oldNick, String login, String hostname, String newNick) {
for (ChannelEventsListener listener : channelEventsListeners) {
if ( listener.contains(oldNick) )
listener.userChangesNick(oldNick, newNick);
}
PrivateMessaging... |
a4387f4a-18ce-41ef-9719-74e6ae48b748 | 4 | public String getShipList () {
StringBuilder sb=new StringBuilder();
// No ships logged
if (listLoggedShips.isEmpty()) return "\r\n\r\nNo ships were logged.";
// Show the number of ships logged
if (listLoggedShips.size()==1) sb.append("\r\n\r\nYou logged one ship.");
else sb.append("\r\n\r\nYou logged "+Int... |
a870d615-9f1c-4db7-96e0-d99c2653965f | 7 | public void setOptions(String[] options) throws Exception {
String numFolds = Utils.getOption('F', options);
if (numFolds.length() != 0) {
setNumFolds(Integer.parseInt(numFolds));
} else {
setNumFolds(0);
}
String numRuns = Utils.getOption('R', options);
if (numRuns.length(... |
e369037d-de36-45f2-8d5e-8d900c109872 | 8 | public boolean done(String c)
{
Civilization p = grid.civs[0];
if (c == null || c.equals(""))
{
return true;
}
else
{
if (c.equals("threeUnits"))
{
int n = 0;
for (int i = 0; i < p.units.size(); i++)
if (p.units.get(i).mode == 1)
n++;
return n >= 3;
}
else if (c.equal... |
d20bf9c5-b4e5-4fa7-93c0-9d32bee4e8dd | 7 | @Override
public void actionPerformed(ActionEvent e)
{
JComboBox cb = (JComboBox) e.getSource();
String tool = (String) cb.getSelectedItem();
switch (tool)
{
case "Pencil":
canvas.setDrawListener(new PencilDrawListener(canvas)); // draws with a "pencil"
break;
case "Rectangle":
canvas.setDrawLis... |
99710bdb-5ff3-4759-a2c1-07f1699fb6d6 | 6 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof SkillsforusersPK)) {
return false;
}
SkillsforusersPK other = (SkillsforusersPK) object;
if ((this.userid == nu... |
4b2e1ab6-b9e8-4dbb-adca-cb35b9d24461 | 7 | public void moveOnY(int yMoveSize) {
int casePositionXleft = 0, casePositionXright = 0, casePositionY = 0;
int caseSize = GameVue.getCaseSize();
switch(yMoveSize) {
case -10 :
casePositionXleft = (player.getxPosition() / caseSize);
ca... |
7c0e07c0-9fae-4747-9e17-cf8d20d86ad4 | 1 | public Googlers (String input) {
String[] split = input.split(" ");
int triplets = Integer.parseInt(split[0]);
surprising = new Integer(split[1]);
scoreReference = new Integer(split[2]);
scores = new ArrayList<Integer>();
for (int i = 0; i < triplets; i++) {
scores.add(Integer.parseInt(split[i+3]));
}
... |
5e63298c-0b25-4781-80e7-85087d005197 | 0 | public void testWhiteCount() {
List<AnswerCombination> combinations = generateAnswerCombinationList();
assertEquals(5, combinations.get(0).getWhiteCount());
assertEquals(4, combinations.get(1).getWhiteCount());
assertEquals(1, combinations.get(2).getWhiteCount());
assertEquals(1, combinations.get(3)... |
358a670e-a426-47a4-b57a-034c95b47481 | 8 | public static Date parseWeblogURLDateString(String dateString, TimeZone tz, Locale locale) {
Date ret = new Date();
SimpleDateFormat char8DateFormat = DateUtil.get8charDateFormat();
SimpleDateFormat char6DateFormat = DateUtil.get6charDateFormat();
if (dateString != null... |
4bafb08b-a453-4278-9b92-c86c6faa4028 | 6 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
Tile tile = tiles.get(rowIndex);
ImageIcon tileIcon;
try{
tileIcon = TileIcons.get(tile.getTileID());
} catch(Exception e) {
BufferedImage img = new BufferedImage(16, 16, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = img.createGraphic... |
b0880058-567e-48d1-9994-b729ae168400 | 7 | @SuppressWarnings("unchecked")
void applyLog(List<LogEntry> log, HGSortedSet<E> set)
{
for (LogEntry e : log)
switch (e.op)
{
case ADD: { set.add((E)e.el); break; }
case REMOVE: { set.remove((E)e.el); break; }
case CLEAR: { set.clea... |
bdb0cad3-688a-4ec0-a42e-c6740f564685 | 9 | synchronized public boolean delete(T item) {
if(bucket==null || bucketLen==0) {
return false;
}
Item<T> find = findNode(item);
if(find != null) {
if(find.next==null && find.pre!=null) {
find.pre.next = null;
} else if(find.pre==null && find.next!=null) {
find.hole.last = find.next;
} else... |
2d75896d-ea18-4df6-8df2-8b5b4c2926c2 | 7 | public String getPatientList(String genes){
String ret = "";
String[] t = genes.split(":");
HashSet<String> pats = new HashSet<String>();
for (int i=0; i<t.length; i++){
for (String s : sampleValueHash.get(t[i])){
if (!s.equals("no_sample")){
pats.add(s);
}
}
}
ArrayList<String> as = ... |
f183f49a-e4f0-41e9-af7b-31b3a0555da1 | 0 | @Override
public double access(Balance balance) {
return balance.getBalance();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.