method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7ccd04cd-36c0-4384-954c-5d410e611db6 | 7 | private boolean versionCheck(String title) {
if (type != UpdateType.NO_VERSION_CHECK) {
String version = plugin.getDescription().getVersion();
if (title != null && title.split("v").length == 2) {
String remoteVersion = title.split("v")[1].split(" ")[0]; // Get the newest ... |
69e703fc-4f3b-4bbc-9360-17e35e65fcd8 | 9 | protected void executeScriptsInDirectory(ConnectionSettings connectionSettings, String operation, DB db,
String[] ignore) throws MojoFailureException, MojoExecutionException, IOException {
BufferedWriter outputFileWriter = null;
try {
File scriptsDirectory = new File(this.scriptsDirectory, connectionSetting... |
cf0c5346-65f0-43a7-99b4-45d3441431ad | 0 | @Test
public void test_moveAttack() throws OutOfBoardException{
when(board.getXSize()).thenReturn(4);
when(board.getYSize()).thenReturn(4);
Pawn pawn1 = new Pawn('e', 3,2,board);
when(board.getSquareContent(3,2)).thenReturn(pawn1);
assertTrue(pawn.move(Direction.Right).con... |
81863fd7-eff9-4312-9786-e44326dbb0a5 | 1 | public void setId(int id) throws ErroValidacaoException{
if (id < 0) {
throw new ErroValidacaoException("O id não pode ser menor que 0 !");
}
else {
this.id = id;
}
} |
f0862de3-0b71-42ee-9000-996007be83ed | 9 | public EntropyEncoder newEncoder(OutputBitStream obs, short entropyType)
{
if (obs == null)
throw new NullPointerException("Invalid null output bitstream parameter");
switch (entropyType)
{
case HUFFMAN_TYPE:
return new HuffmanEncoder(obs);
case ANS_TYPE:
... |
210703ca-e272-4c40-8b94-adb3a5ddc92f | 5 | String[] getFontNames() {
FontData[] fontNames = display.getFontList(null, true);
String[] names = new String[fontNames.length];
int count = 0;
mainfor:
for (int i = 0; i < fontNames.length; i++) {
String fontName = fontNames[i].getName();
if (fontName.startsWith("@")) //$NON-NLS-1$
continue;
for... |
2abdea56-735f-4963-b767-fce49bcfd21e | 8 | public Set<Map.Entry<Short,Long>> entrySet() {
return new AbstractSet<Map.Entry<Short,Long>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TShortLongMapDecorator.this.isEmpty();
}
publ... |
23204246-14a1-417d-a96f-681b2b5bbb2f | 9 | public ChunkyCommand getCommandByAlias(ChunkyCommand parentCommand, String alias) {
ChunkyCommand command = null;
if (parentCommand == null) {
for (Map.Entry<String, ChunkyCommand> registeredCommand : registeredCommands.entrySet()) {
if (registeredCommand.getValue().getName()... |
724187c2-3e9b-47fb-94bb-452bc36cca8d | 3 | public boolean canBuildRoad() {
if(roads>0&&resources.getBrick()>0&&resources.getWood()>0)
return true;
return false;
} |
4223112a-9474-4f0a-9b8a-978432f88759 | 1 | public void sendPlayerCommand(Command command) {
Point playerpos = player.getPos();
int key = genKey(playerpos.getX(), playerpos.getY());
if (entities.containsKey(key)) {
ArrayList<Entity> ents = entities.get(key);
ents.get(0).interact(command);//TODO try to find a better... |
5c39f66b-3cc4-4fbd-9e58-32f6eb87e429 | 6 | @Override
public Polynomial invert(Polynomial polynomial, Polynomial moduloPolynomial) {
if (isZero(polynomial) || isZero(moduloPolynomial)) {
throw new MathIllegalArgumentException("Cannot compute inverse for zero polynomials.");
}
if ((polynomial.getSize() >= moduloPolynomial... |
904293a8-c938-474e-94a6-ef87738361bd | 0 | public boolean isAlive() {
return alive;
} |
c0320932-4ab9-4b9b-bf5e-f703f0f7cb95 | 6 | @Override
public double[] computeValue(final char refBase, FastaWindow window, AlignmentColumn col) {
int refCount = 0;
int altCount = 0;
if (col.getDepth() > 0) {
Iterator<MappedRead> it = col.getIterator();
while(it.hasNext()) {
MappedRead read = it.next();
if (read.hasBaseAtReferencePos(col.getC... |
7b18e5bb-3870-4fb6-a536-e0f044c94d6f | 3 | public int available()
throws IOException {
if( this.isClosed )
return 0;
if( this.emptyStopMarkSet() )
return this.in.available();
// First call?
if( this.currentStreams[0] == null )
initStreamStack();
return this.currentStreams[0].available();
} |
6a439a0c-8d9f-4e1a-8389-f68b68729e10 | 6 | @Override
public boolean equals(Object obj){
IQuote quote= (IQuote) obj;
if ((symbol.equals(quote.getSymbol()))&&(date.equals(quote.getDate()))&&(openPrice.equals(quote.getOpenPrice()))&&(highPrice.equals(quote.getHighPrice()))
&&(lowPrice.equals(quote.getLowPrice()))&&(closePrice.eq... |
e0c0f7d1-98c7-4cda-8648-999389d84188 | 8 | @Override
public void keyReleased(Keys key)
{
switch (key)
{
case KEY_LEFT:
case KEY_RIGHT:
player.getVelocity().x = 0;
break;
case KEY_UP:
case KEY_DOWN:
player.getVelocity().y = 0;
break;
case KEY_W:
case KEY_S:
player.yV = 0;
break;
case KEY_A:
case KEY_D:
pl... |
4968d7ca-b6d2-4b39-b647-f4e5ecc06bd8 | 1 | public String getID(int i)
{
if (i < rows.size())
return (String) rows.get(i)[1];
return null;
} |
a92b1ccd-5ee1-41dc-a9c6-db03873258ff | 4 | public int minPathSum(int[][] grid) {
int m = grid.length;
int n = grid[0].length;
int[][] P = new int[m][n]; // stores dynamic min path sum
// initialize P
P[0][0] = grid[0][0];
for (int i = 1; i < m; i++) {
P[i][0] = P[i-1][0] + grid[i][0];
}
... |
9d63f394-0f2b-47bf-97be-d06a86cff9fd | 6 | private Key importRsaKey(String message, KeyType keytype) {
Console console = System.console();
String input;
while (true) {
try {
System.out.println(message);
input = console.readLine();
switch (keytype) {
case PRIVATE:
return Importer.importRsaPrivateKey(input);
case PUBLIC:
ret... |
81661a1d-f810-4196-8122-409224ff58c5 | 6 | @Override
public void keyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
System.out.println("Stop moving up");
break;
case KeyEvent.VK_DOWN:
currentSprite = anim.getImage();
robot.setDucked(false);
break;
... |
888726eb-6ec9-4534-a768-09fe7634e08f | 8 | public static void invokeSetterMethod(Object target, String name, Object value, Class<?> type) throws Exception {
Class<?>[] paramTypes = (type != null ? new Class<?>[] { type } : null);
String setterMethodName = name;
if (!name.startsWith("set")) {
setterMethodName = "set" + StringUtils.capitalize(name);
... |
2257f3ea-f0a5-4bc9-88b0-aed5281c3ddb | 6 | public static Ranker getRankerByParameter(RankerType rankerType, Index indexer) {
switch(rankerType){
case COSINE:
return new RankerCosine(indexer);
case QL:
return new RankerQL(indexer);
case PHRASE:
return new RankerPhrase(indexer);
case LINEAR:
return new RankerLinear(indexer);
case... |
4bc52af7-bab6-4152-bfdf-36d9d8bacccf | 9 | private void checkReturnType(Method method) throws DaoGenerateException {
isReturnId = (method.getAnnotation(ReturnId.class) != null);
Class<?> returnType = method.getReturnType();
if (isReturnId && returnType != null) {
if (ClassHelper.isTypeList(returnType)) {
isReturnList = true;
} else if (!ClassHe... |
39b83bdb-7f56-48d6-8091-d077aa109f92 | 6 | private int partition(ObservableArray tab, int lo, int hi)
{
int middle = lo;
int i = lo+1;
int j = hi;
while(true)
{
while(tab.Compare(i, middle) <= 0 && i<hi)
{
i++;
}
while(tab.Compare(j, middle) >= 0... |
321bd7f5-30fa-495e-ad31-37c9e327ad1c | 6 | public void itemStateChanged(ItemEvent e){
int checknum = 0;
for(int b = 0; b <= mainchecks.length-1; b++){
if(e.getItemSelectable() == mainchecks[b]){ checknum = b; boolset = mainchecks[b].getState();}
}
switch(checknum){
// check draw
case 0: command = 203; cdoSet(); fireucEvent(); break;
// rand draw
c... |
b46b54cb-0d24-4d0f-8405-97aeae1208df | 9 | public static String convertToHexString(String decimalString, String delimiter)
{
StringBuilder buf = null;
if (decimalString != null)
{
String[] numbers = delimiter != null && delimiter.trim().length() > 0 ? decimalString.split(delimiter)
: new Strin... |
9e373dac-c08c-4692-91a9-2f3494665048 | 7 | public static Type parseType(String message) {
String prefix = message.split(" ")[0];
if(prefix.equals(Message.ID_REQUEST_PREFIX))
return Type.ID_REQUEST;
if(prefix.equals(Message.ID_RESPONSE_PREFIX))
return Type.ID_RESPONSE;
if(prefix.equals(Message.SPAWN_PREFIX))
return Type.SPAWN;
if(prefix.equals... |
8d68a64b-0f6e-4078-b902-737cd05aae86 | 5 | public static OgexRotation create( Kind kind, Object data ) {
switch( kind ) {
case X:
case Y:
case Z:
return new ComponentRotation(kind, (Float)data);
case Axis:
return new AxisRotation(kind, (float[])data);
case Quater... |
6c7a136a-ee2f-4225-9713-868490d7ae86 | 9 | private void cincosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cincosMouseClicked
// TODO add your handling code here:
try {
if (conexion == true && enviando == 0) {
enviando = 1;
int opciones;
if (esinicio != 0 && 5 <= esi... |
880c52d2-785b-4cad-98c3-6d432251b873 | 6 | public static void merge (String[] data, int firstIndex, int numOfValues1, int numOfValues2)
{
//System.out.println("Merging " + numOfValues1 + " and " + numOfValues2);
String[] temp = new String[numOfValues1+numOfValues2];
int numCopied = 0; //data to temp
int leftPointer = 0; //copied f... |
b6327916-17a7-4f86-9fff-6508a2275603 | 9 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
Atracao coisa = dados.get(rowIndex);
String tipo = "";
if (dados.get(rowIndex) instanceof Monumento) {
tipo = "Monumento";
}
if (dados.get(rowIndex) instanceof Hotel) {
tipo = "Hotel"... |
1987fd5b-8c96-4714-848e-48713065a78f | 7 | public void townHoldings() {
if (!towny || !register || !Methods.hasMethod()) {
return;
}
Format sdf = new SimpleDateFormat(larvikGaming.getConfig().getString("TimeFormat", "yyyy-MM-dd HH:mm:ss"));
Date date = new Date();
String timeStamp = sdf.format(date);
File inFile = new File("plugins/Towny/data... |
6e9b51e5-0b3a-4261-ad70-6e9b7e65a87f | 6 | public void SendMessageByPost() {
CloseableHttpClient client=HttpClients.createDefault();
HttpPost post =new HttpPost(url);
List<NameValuePair>nvps=new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("user", user));
nvps.add(new BasicNameValuePair("key", key));
nvps.add(new BasicNameValuePa... |
9dad26a6-a111-4ba5-8ccc-f197ea0b8c4d | 7 | private void sendReissue()
{
String serviceName = CommandLine.variable("serviceName");
String mmt = CommandLine.variable("mmt");
short capability = RDMMsgTypes.msgModelType(mmt);
OMMItemIntSpec ommItemIntSpec = new OMMItemIntSpec();
// Preparing to send batch reissue messag... |
ddf6ea1e-9f64-4776-8563-b78a5ea37902 | 0 | public static void main(String[] args)
{
Coin coin = Coin.penny;
System.out.println(coin.getvalue());
} |
855d1b8c-d561-4317-9fe0-c84968d1ed62 | 4 | public static boolean bigIntIsPrime(BigInteger num) {
BigInteger div, rem;
div = new BigInteger("2");
rem = num.mod(div);
int mod = rem.compareTo(BigInteger.ZERO);
if(mod == 0 && num.compareTo(div) != 0) {
return false;
}
BigInteger zero = BigInteger.ZERO;
for(BigInteger i = BigInteger.valueOf(3); i... |
a0140f73-87e2-4de3-a5eb-a4535051a2c7 | 4 | @Override
public Set<Document> search(String query, Map<String, TreeSet<Document>> dictionary) {
String normalizedQuery = SmartTokenizer.normalize(query);
List<String> words = Arrays.asList(normalizedQuery.split("\\s"));
if (words.size() == 0) {
return new TreeSet<Document>();
... |
3a1c0493-c02a-481c-82fc-716255cd2d0f | 2 | private static double generalRefraction(double H, double T, double P,
int flag) {
final double R = Math.PI / 180.0;
double a, f, ref0, ref;
f = 0.28 * P / (T + 273.0);
a = H / R;
switch (flag) {
case APPARENT:
ref0 = 1.0 / Math.tan((a + 7.31 / (a + 4.4)) * R);
break;
case GEOMETRIC:
ref0 ... |
03cc0bd5-5822-439b-9398-90532078e62f | 8 | public void fallInPit(MOB mob)
{
if(CMLib.flags().isInFlight(mob))
{
mob.location().show(mob,null,CMMsg.MSG_OK_ACTION,L("<S-NAME> trigger(s) a trap door beneath <S-HIS-HER> feet! <S-NAME> pause(s) over it in flight."));
return;
}
else
if(CMLib.dice().rollPercentage()<mob.charStats().getSave(CharStats.S... |
f5d4177b-d180-4c22-aa49-0137fa3e2608 | 0 | @Override
public Object clone() {
PropertyFilterImpl cloned = new PropertyFilterImpl(this.getName());
return cloned;
} |
8a5339de-fec4-433f-a9e9-16f5edfb0f69 | 4 | public void render(Screen screen) {
for (int x = 0; x < 20; x++) {
for (int y = 0; y < 15; y++) {
int dd = (y + x % 2 * 2 + x / 3) - time;
if (dd < 0 && dd > -30) {
// if (dir > 0)
// screen.render(x * 8, y * 8, 0, 0, 0);
// else
// screen.render(x * 8, screen.h - y * 8 - 8, 0, 0, 0);
... |
fb7b78ea-b19e-419a-ad0a-5c2298ebab1d | 7 | public static Board getBoard(String className, Class<?>[] classes, Object[] parameters) {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
Board board = null;
try {
Class<?> clazz = classLoader.loadClass(className);
Constructor constructor = clazz.getConstruc... |
e316d71b-8b07-4a95-8770-809266cf1d64 | 0 | public Vector2f subtract(Vector2f vec2f) {
this.x -= vec2f.getX();
this.y -= vec2f.getY();
return this;
} |
13ebd62e-6deb-48ca-806d-d84872416feb | 0 | @Test
public void retrieveNull() {
Equivalence nullEquivalence = cache.get(cacheKey, Equivalence.class);
assertNull(nullEquivalence);
} |
fc5b28aa-c948-4873-8e83-f5a3f16591df | 8 | public List<WebURL> get(int max) throws DatabaseException {
synchronized (mutex) {
int matches = 0;
List<WebURL> results = new ArrayList<>(max);
Cursor cursor = null;
OperationStatus result;
DatabaseEntry key = new DatabaseEntry();
DatabaseEntry value = new DatabaseEntry();
Transaction txn;
i... |
0a3f23fa-9811-44d2-971f-f2198e6cdad4 | 4 | public static InventoryListObject getInventoryListObject( String listName ) {
InventoryListObject result = null;
ArrayList<InventoryListObject> inventoryLists;
Iterator<InventoryListObject> inventoryListObjectsIter;
InventoryListObject inventoryListObject;
if ( _inventoryObje... |
9c073042-8355-416e-9c0c-9f7e12dd5688 | 9 | public void cellSelected(int column, int row) {
if(column >= gameArea.getColumns() || column < 0 || row >= gameArea.getRows() || row < 0) {
return;
}
if(gameArea.getCellAt(column, row).getType() != Cell.EMPTY) {
return;
}
switch(currentPlayer) {
... |
df70f31c-1e6d-4e8e-929a-b2f7e493056d | 9 | public static MultiCastMessage readMessage(String fileName) {
ArrayList<Message> results = new ArrayList<Message>();
BufferedReader bReader = null;
try {
bReader = new BufferedReader(new FileReader(fileName));
String line = bReader.readLine();
boolean firstLine=true;
while (line != null) {
if(fir... |
177e02bb-d6a8-461f-a6f0-6747a6f00987 | 6 | private static void tagPdf(String path) {
Document pdfDoc = new Document();
try {
pdfDoc.setFile(path);
} catch (Exception e) {
e.printStackTrace();
}
if(Tagger.tagging)
Tagger.setCurrentDocument(pdfDoc);
int numberOfPages = pdfDoc.ge... |
e1450e62-42f6-4bee-8f1e-f6bac4c01982 | 6 | public static final AttackInfo parseDmgR(final LittleEndianAccessor lea) {
final AttackInfo ret = new AttackInfo();
lea.skip(1);
ret.tbyte = lea.readByte();
ret.targets = (byte) ((ret.tbyte >>> 4) & 0xF);
ret.hits = (byte) (ret.tbyte & 0xF);
ret.skill = lea.readInt();
switch (ret.skill) {
case 3121004: //... |
2078d2c5-067b-4ccd-9a25-f70b4a0a8c5c | 5 | public void addWatchForTask(final Task task) throws IOException {
if (task instanceof NodeJsTask) {
NodeJsTask nodeJsTask = (NodeJsTask) task;
Path sourceDir = nodeJsTask.workingDirectory.toPath();
watchTasks.put(sourceDir, task);
if (watchService == null) {
watchService = sourceDir.getFileSystem().n... |
3bd63413-1091-46bf-8982-e6470018f931 | 6 | public static boolean allClassesNextP(AllPurposeIterator self) {
{ int cursor = self.iteratorInteger;
Surrogate surrogate = null;
Stella_Object value = null;
while (cursor < self.iteratorSecondInteger) {
surrogate = ((Surrogate)((Stella.$SURROGATE_ARRAY$.theArray)[cursor]));
if ((... |
4314f8d7-5d89-4900-b410-a511eb6470e1 | 6 | public ReportContinentalCongressPanel(FreeColClient freeColClient, GUI gui) {
super(freeColClient, gui, title);
JTabbedPane tabs = new JTabbedPane(JTabbedPane.TOP);
tabs.setOpaque(false);
Player player = getMyPlayer();
JPanel recruitingPanel = new JPanel(new MigLayout("center,... |
ed7b80af-9d11-472c-8d45-1043a5291ef3 | 4 | void processTexture() {
if (selectedTexture != null) {
processedTexture = new CPGreyBmp(selectedTexture);
if (mirror) {
processedTexture.mirrorHorizontally();
}
CPLookUpTable lut = new CPLookUpTable(brightness, contrast);
if (inverse) {
lut.inverse();
}
processedTexture.apply... |
cb294165-4006-4f20-a8a3-370b9ecf4a4f | 8 | @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
JButton clicked = (JButton) e.getSource();
if (clicked == mostrarInfo){
if(arrayListener!=null)
arrayListener.ArrayEmitted(this.myList);
}
if(clicked == goodbyeButton){
if (textListener != null){
textL... |
47a20934-8cd7-4251-9397-c5a4bd6f24b5 | 9 | public void printBrain() {
for (int i = 0; i < instructions.size(); i++) {
switch (instructions.get(i).getClass().getName()) {
case "Move" :
System.out.print("Move - ");
System.out.print(((Move)instructions.get(i)).getSt1() + " - ");
System.out.print(((Move)instructions.get(i)).getSt2());
S... |
5266898c-5f56-448a-a7c1-f64e300edf7b | 4 | private boolean addWordBruteForceRandomStart(String word) {
// TO IMPLEMENT
int arrayPointer = Utils.random(N);
for(int i=0;i<N;i++) {
if(addWordInRow(word, arrayPointer)) {
return true;
}
arrayPointer = (arrayPointer+1)%N;
}
ar... |
69afbe8d-1210-4fe3-a52e-4b4fb0a6534b | 6 | public void handleOverloadTimers() {
CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
@Override
public void execute(CycleEventContainer b) {
if (c == null)
b.stop();
c.hasOverloadBoost = false;
}
@Override
public void stop() { }
}, 500); //15 minutes
CycleEventHandler.ge... |
5eea6b60-cdb3-4095-8f9b-25c04344f5b6 | 9 | public void butcherSuccess(Player patk, Player pdef){
if(patk.avatar.avatarId.equals(AvatarId.CLYDE) && patk.revealed && !disabledAbility(patk) && !patk.status.containsKey(Card.butcher) && !pdef.dead){
int n = -1;
int lb = -1;
int ub = 2;
String head = "Butcher";
String textBlock = "Take 12 damage and ... |
5f9db05f-7e62-4206-95b4-af96f33dd74f | 0 | public int getXLocation(){
return xLocation;
} |
0c1d10b6-3759-46f0-ac09-ddfd56762c22 | 2 | @Override
public void show() {
if (alwaysCenter || !hasBeenShown) {
hasBeenShown = true;
Rectangle r = Outliner.outliner.getBounds();
setLocation((int) (r.getCenterX() - getWidth()/2), (int) (r.getCenterY() - getHeight()/2));
}
super.show();
} |
132acdd0-75ae-45a0-8e30-4190120a0dc8 | 7 | public static void main(String... args) {
CommandArgs options =
new CommandArgs("--white --ai=([012]) --seed=(\\d+) " +
"--time=([\\d\\.]+) --debug=(\\d+) --display", args);
if (!options.ok()) {
usage();
}
int debugLevel = options.getLast("--... |
e538e641-7828-4ade-8a5d-5e763df232bd | 2 | public static void send() {
while (true) {
Socket socket = null;
byte[] readInput = new byte[80];
DatagramPacket packett = null;
byte[] m = null;
byte[] input = null;
try {
input = new byte[80];
packett = new Da... |
49367a6e-f798-415c-bf5c-f3faaa56006f | 1 | public void addMod(String userid, Rank rank) {
if (modList.containsKey(userid)) {
System.out.println("[Room] This User is alread mod.");
return;
}
modList.put(userid, rank);
} |
4dc4d636-d2c8-46c1-b80c-6c3c207f14e3 | 2 | @Override
public void buildCity(IPresenter presenter, VertexLocation vertLoc) {
MoveResponse response = presenter.getProxy().buildCity(presenter.getPlayerInfo().getIndex(), vertLoc, presenter.getCookie());
if(response != null && response.isSuccessful()) {
presenter.updateServerModel(response.getGameModel());... |
8b50ce7a-ef6a-48f3-b080-94c430e40435 | 8 | private final String relative(final String ref, final String aim) {
if (aim.charAt(0) == '/') {
return aim;
}
String value = ref;
if (value.charAt(0) != '/') {
value = '/' + value;
}
int index = value.lastIndexOf('/');
value = index == -1 ?... |
2a823fb3-4914-49ea-bd6c-c6b7ac3f0f3b | 2 | public void setStatustextFont(String font) {
if ((font == null) || font.equals("")) {
this.statustextFont = UIFontInits.STATUS.getFont();
} else {
this.statustextFont = font;
}
somethingChanged();
} |
80020da8-3662-4f45-b533-bfe8d8c263cf | 6 | @EventHandler
public void BlazeWaterBreathing(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.Wat... |
9d055338-c719-49f8-afd3-70ef0517088b | 3 | public void randDnaSeqGetBasesTest(int numTests, int numTestsPerSeq, int lenMask, long seed) {
Random rand = new Random(seed);
for( int t = 0; t < numTests; t++ ) {
String seq = "";
int len = (rand.nextInt() & lenMask) + 10; // Randomly select sequence length
seq = randSeq(len, rand); // Create a random s... |
58d719a7-3c59-47ed-8a55-8de1c09e56e6 | 8 | public Result execute() {
switch (command.getCommandName()) {
case USER_LOGIN:
serverCommand = new LoginCommand();
break;
case USER_REGISTRATION:
serverCommand = new RegistrationCommand();
break;
case DELETE_L... |
142d5c1e-8b12-4eca-b1f0-be477fc87424 | 8 | private ActionListener e (final int i) {
return new ActionListener() {
public void actionPerformed (ActionEvent e) {
if (buildingupgrading.length() != 0) {
JOptionPane.showMessageDialog(null, "You can only build one building at a time", "ERROR", JOptionPane.ERROR_MESSAGE);
return;
}
buildingp... |
8003d7f3-7851-419b-8abd-c63ee43824d3 | 8 | protected double[] evaluateGradient(double[] x){
double[] grad = new double[x.length];
for(int i=0; i<m_Classes.length; i++){ // ith bag
int nI = m_Data[i][0].length; // numInstances in ith bag
double denom=0.0;
double[] numrt = new double[x.length];
for(int j=0; j<nI; j++... |
7fd97e9f-4064-4d53-be8b-c9ac40fc92aa | 2 | private void makeDeck() {
for(Suit s:Suit.values()) {
for(Rank r:Rank.values()) {
cards.add(new Card(s, r));
}
}
} |
d2043a7d-21ec-4cab-88e5-868d821ea377 | 8 | private void drawHUD(Graphics2D graphics) {
graphics.setFont(smallFont);
graphics.setColor(Color.WHITE);
graphics.drawString(String.format("Score: %s",
new DecimalFormat("#,###").format(score)), 50, 50);
graphics.drawString(String.format("Level %d, Wave %d/%d"... |
ed8fa0f1-fccd-4194-a6b3-bb1f3d156757 | 5 | public static boolean checkSignals(Library library, Scheme scheme, SignalBundle signals) throws ModelingException {
for(Contact contact : signals.signals.keySet()) {
if(scheme.inputs.contains(contact.element) || scheme.outputs.contains(contact.element));
else if(scheme.elements.containsK... |
70323c8d-9080-4b55-8861-829cf8a02f1b | 0 | public void setIsFinished(Boolean isFinished) {
this.isFinished = isFinished;
} |
855e4346-bee5-4459-8403-0e193a73c0dd | 0 | public void clearDirty() {
dirty = false;
} |
96acc0d6-cc1d-4b58-b401-5c9f1ab531b2 | 8 | public Stack<Position> getNeighborPositions(Position pos) {
Stack<Position> retVal = new Stack<Position>();
for(int i = -1 ; i <= 1 ; i++) {
int newX = pos.getNewX() + i;
if(newX >= this.size || newX < 0) continue;
for(int j = -1 ; j <= 1 ; j++) {
int newY = pos.getNewY() + j;
if(newY >= this.size ... |
95f9d164-ac0d-44ed-ab44-de566fb9f1db | 1 | public void delete(Problem persistentInstance) {
log.debug("deleting Problem instance");
try {
Session session = getSession();
Transaction tr = session.beginTransaction();
session.delete(persistentInstance);
tr.commit();
session.flush();
session.close();
log.debug("delete successful");
} ca... |
75a77ade-3b95-43dc-8234-e1c982002896 | 4 | public static void compress() {
String input = BinaryStdIn.readString();
// single char
TST<Integer> st = new TST<Integer>();
for (int i = 0; i < R; i++)
st.put("" + (char) i, i);
int code = R + 1;
while (input.length() > 0) {
String s = st.longestPrefixOf(input);
BinaryStdOut.write(st.get(s... |
9f14ee0e-f0c0-4971-b7d5-72042beea6ae | 2 | private List <Cliente> carregaDadosDoBanco(){
this.dao = new ClienteDAO();
try{
List<Cliente> lista = dao.listarTodos();
// System.out.print(lista);
return lista;
}catch(ErroValidacaoException ex){
JOptionPane.showMessageDialog(rootPane, ex.getMess... |
1bef67c0-4b3d-4a37-93d6-3f24b74f92d8 | 2 | private User processNewUser(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, Base64Exception {
//new user
String encodedLoginEmail = request.getParameter(Constants.RequestParameter.LOGIN_NAME);
String encodedPassword = request.getParameter(Constants.Reque... |
edaab21b-a05c-47c9-93ac-079a551be3ac | 5 | private DockLayout findLayoutInternal(DockContainer dc) {
for (DockLayoutNode child : mChildren) {
if (child instanceof DockContainer) {
if (child == dc) {
return this;
}
} else if (child instanceof DockLayout) {
DockLayout layout = ((DockLayout) child).findLayoutInternal(dc);
if (layout !=... |
603572ce-e3f9-4284-8fdb-efa127b3fd58 | 4 | public void addRolls(int[] rolls) {
//Loop through two first dicerolls, discard last value which is bet
for (int i = 0; i < 2 ; i++) {
diceRolls.add(rolls[i]);
for (int j = 0; j < distrRoll.length ; j++) {
if(distrRoll[j][0] == rolls[i]) distrRoll[j][1]++;
}
}
int sum = 0;
for (int d : dice... |
ebf842ba-4399-43b3-867f-0f0b16da2b99 | 9 | public static boolean NTfuncHead() throws IOException {
boolean success = true;
success = ErrorRecovery(NonTerminal.funcHead);
switch (lookahead) {
case ID:
case INTEGER:
case REAL:
if (!NTtype())
success = false;
if (!match(TokenType.ID))
success = false;
if (!match(TokenType.LPAREN))
... |
c52009ad-fb86-488b-a903-a04b765ad929 | 4 | private void drawEdge2(int x0, int y0, int x1, int y1, int cost, int flow, Color color) {
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(color);
if (color.equals(Color.RED)) {
g2d.setStroke(new BasicStroke(3));
} else {
g2d.setStroke(new BasicStroke(1));
}... |
7909ac73-89d3-418c-86d8-0a4006c5b8b3 | 1 | private int countVertices(Graph g) {
int vertices = 0;
while (g.getVertices().get(vertices) != null) {
vertices++;
}
return vertices;
} |
896ba0e2-a3cd-4e74-8f7b-e6cbd8b59d71 | 2 | @SuppressWarnings("null")
public ArrayList<Cellule> getenv(Cellule c){
ArrayList<Cellule> l = new ArrayList() ;
// Regard d'une unit� "normale" (carr�e de 9)
for (int i =-1 ; i<=1 ; i++){
for (int j = -1 ; j<=1 ; j++ ){
l.add(this.getCellule((c.coord.x+i) , (c.coord.y+j)));
}
}
r... |
ee8d6655-9078-44e3-9cca-a6341dd4c8bd | 6 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
Time time;
if (rowIndex < times.size()) {
// Get the Activity from the indicated row.
time = times.get(rowIndex);
// Get the appropriate field from the columnIndex
if (columnIndex == columnNames.indexOf(ACTIVITY_COL... |
c93d1fb7-2b2a-4969-9390-e2d38b80fcab | 0 | static boolean condition() {
boolean result = Math.random() < 0.99;
System.out.print(result + ", ");
return result;
} |
109d8c1b-0877-4d15-8561-82ac6abc6790 | 8 | public int IDgenerator(HttpServletRequest request, HttpServletResponse response,String Type)
throws ServletException, java.io.IOException
{
int UserID=0;
String query;
String tablename;
if(Type.equals("customer")||Type.equals("supplier"))
tablename=Type+"_info";
else
tablename=Type;
... |
e65d8756-f61e-4e49-8aca-8e85d4d15ad0 | 1 | @Override
@SuppressWarnings("SleepWhileInLoop")
public Object call() throws Exception {
while (!Thread.currentThread().isInterrupted()) {
System.out.println("Очікую нового клієнта...");
Integer client = room.get();
System.out.println("Працюю над клієнтом №" + client ... |
9d73a2c3-f17f-47af-85fb-d702c37fa584 | 4 | private final void displayParamMenu() {
if (this.object.getTargetContainer() != this.state.emptyTarget
.getContainer()) {
this.panelOption = new JPanel();
this.panelOption.setLayout(new GridLayout(0, 2));
for (final BruteParams<?> ps : this.params) {
if (ps == null) {
continue;
}
final J... |
db70d1e0-a5da-4430-aa56-fe0ed137e6ab | 3 | public BlockFace getSignDirection(Block sign) {
// Find any nearby wall sign
if (sign.getType() == Material.WALL_SIGN) {
// So many hoops just to figure out which direction it's facing.
MaterialData md = sign.getType().getNewData(sign.getData());
if (md instanceof or... |
11e8a8a5-50ba-4605-8bbd-c1d361794d54 | 4 | public QuadTree(int minSize) {
size = depth = 1 ;
while (size < minSize) { size *= 2 ; depth++ ; }
nodes = new Node[depth][][] ;
for (int d = 0, s = size ; d < depth ; d++, s /= 2) {
nodes[d] = new Node[s][s] ;
for (int x = 0 ; x < s ; x++)
for (int y = 0 ; y < s ; y++)
(no... |
6d9c74bf-2d05-447b-9019-4e32dad31e7e | 5 | private void execute(String comm) {//dodawanie do tabeli
String log = "Update: " + comm;
if(comm == null) {
logger.log(Level.WARNING, "MySQLHandler: query == null");
return;
}
if(st == null) {
logger.log(Level.WARNING, "MySQLHandler: Statement... |
04fac61f-3376-4de8-9988-83f22c5d9300 | 9 | public static void main(String[] args) throws Exception {
File root = new File(args[0]);
for (final File bank : root.listFiles()) {
FileInputStream file = new FileInputStream(bank);
// Get the workbook instance for XLS file
HSSFWorkbook workbook = new HSSFWorkbook(file);
// Get first sheet from the wor... |
fe1f6462-e868-4c34-933a-61b1c9cf9303 | 0 | public Double getHeight() {
return height;
} |
f3024053-a9c5-4df1-8194-08093d2bd138 | 1 | public int getEmptyNum() {
List<Park> list = getParkList();
int num = 0;
for(Park park : list) {
num += park.getEmptyNum();
}
return num;
} |
11661c4a-f179-42dd-837a-725b136e0987 | 5 | private void setAbarre(Matrice iDansB, Matrice NBarre)
{
int Ncol = 0;
boolean estDansB = false;
for(int j = 0; j<iDansB.getNbLines(); j++)
{
copyColumn(0, (int)iDansB.getValueAt(j, 0), getIdentite(j), this.Abarre);
}
for(int i =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.