method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4ef79544-9e4a-4f89-a894-9f0ffc17b3ca | 9 | static final void method1127(boolean bool) {
anInt1374++;
for (Node_Sub19 node_sub19 = (Node_Sub19) Class89.aClass312_1199.method3613(65280); node_sub19 != null; node_sub19 = (Node_Sub19) Class89.aClass312_1199.method3620(16776960)) {
if (node_sub19.aBoolean7156) {
node_sub19.method2160((byte) 97);
} else... |
205c8329-1d50-46f1-9fbe-1650279fa021 | 2 | public final boolean isAlive() {
return wasStarted() && !myServerSocket.isClosed() && myThread.isAlive();
} |
3eb060b0-eb5a-413d-bb09-4060315bf7a2 | 2 | public static void startGame()
{
System.out.println("Game started");
game = new BattleShipGame(0, 0, pixel.width, pixel.height, gridSize);
if(manualAdding)
{
editingMode = true;
game.editNextShip();
}
if(debugMode)
changeDelaySeconds = 1;
timerLength = changeDelaySeconds * (1000/(tickTi... |
d5f78579-c71c-4399-899b-2a6e9e7ba947 | 5 | public void altaInscripcion(Inscripcion inscripcion) {
if(this.getEquiposConfirmados())
throw new EquiposConfirmadosException("No se puede realizar la inscripcion porque los equipos ya fueron confirmados");
if(cantidadInscriptosEstandar()>=10)
throw new Hay10EstandarException("No se puede realizar la inscripc... |
cefd6303-fdb0-4d8f-bb48-80b545c31ab9 | 2 | @Override
public int compareTo(AstronomicalObject o) {
return (this.mass < o.mass) ? -1 : (this.mass > o.mass) ? 1 : 0;
} |
b37d97fb-4940-4f88-aac7-47871395cfad | 6 | private static void getCollectionFrequency(String dirName, Normalizer stemmer) throws IOException {
// Création de la table des mots
HashMap<String, Integer> hits = new HashMap<String, Integer>();
File dir = new File(dirName);
//Normalizer stemmer = new FrenchStemmer();
if (dir.isDirectory()) {
// Liste de... |
b13bfefe-fe32-42e0-b77b-fabcca890d3e | 7 | public Symbol parse() throws java.lang.Exception
{
/* the current action code */
int act;
/* the Symbol/stack element returned by a reduce */
Symbol lhs_sym = null;
/* information about production being reduced with */
short handle_size, lhs_sym_num;
/* set up direct ref... |
196aeeb5-ede2-42d6-b2e4-35e78fbfd47f | 8 | private String doNext(boolean remove, int lookAhead) {
prevPos = pos;
String res = null;
for (int i = 0; i < lookAhead; i ++) {
if (pos == str.length()) {
throw new IllegalStateException("End of stream");
}
StringBuilder tmp = new StringBuilder();
String c = read();
if (... |
d35cc20f-e2b8-4ffd-834f-0044e116114d | 7 | @GET
@Path("/search")
@Produces(MediaType.LIBROS_API_LIBRO_COLLECTION)
public LibroCollection getLibroparametros(@QueryParam("autor") String autor,
@QueryParam("titulo") String titulo) {
LibroCollection libros = new LibroCollection();
Connection conn = null;
Statement stmt = null;
String sql;
try {
c... |
ed640f1b-3881-49de-8417-84e8a826e992 | 7 | private static void newElements() {
for (int i = 0; i < (FieldGame.size_x + 2); i++) {
for (int p = 0; p < (FieldGame.size_y + 2); p++) {
int[] neu = new int[5];
neu[0] = getRightImageNumber(i, p);
neu[1] = i * scale_x;
neu[2] = (FieldGame.size_y + 1) * scale_y - scale_y * p;
neu[3] = scale_x;... |
7a77ab04-158e-4a67-88de-ad091f6fe8a3 | 6 | public static TileImprovementType getBestTileImprovementType(Tile tile,
GoodsType goodsType) {
int bestValue = 0;
TileImprovementType bestType = null;
for (TileImprovementType impType
: tile.getSpecification().getTileImprovementTypeList()) {
if (!impType.isNa... |
f430d570-2b77-4393-bc10-d8c148d2131f | 8 | protected void despawnEntity()
{
EntityPlayer var1 = this.worldObj.getClosestPlayerToEntity(this, -1.0D);
if (var1 != null)
{
double var2 = var1.posX - this.posX;
double var4 = var1.posY - this.posY;
double var6 = var1.posZ - this.posZ;
double... |
149a7bb8-5615-4bf7-8cb0-2497fce35bea | 6 | public void loadMusic(){
while(true){
while(shallRun){
File soundFile = new File(theme);
try {
audioInputStream = AudioSystem.getAudioInputStream(soundFile);
} catch (UnsupportedAudioFileException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Audi... |
4897ac3f-6e20-4306-aec8-71a76b29358d | 7 | public void render(Graphics2D g)
{
for(int x = 0; x < WORLD_WIDTH; x++)
{
for(int y = 0; y < WORLD_HEIGHT; y++)
{
if(tiles[x][y] != null)
tiles[x][y].render(g);
}
}
for(int x = 0; x < WORLD_WIDTH; x++)
{
for(int y = 0; y < WORLD_HEIGHT; y++)
{
if(collectables[x][y] != null)
c... |
70afe238-3bc1-423c-8bd0-e68e6797cdf0 | 5 | public static void main(String[] args) {
//String filename = "fluxoCustoMinimo";
String filename = "fluxoMaximoComMaximizacao";
try {
Data data = new Data(filename);
//data.print(System.out);
Modelo modelo = new Modelo(data);
if (modelo.solveModel()) {
modelo.exportSolution();
}
modelo... |
be535dd7-615b-416a-a2cd-681b17889bf2 | 7 | public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
if ("JavacLocation.Browse".equals(command)) {
handleBrowseForJavac();
return;
}
else if ("SourceOutputDir.Browse".equals(command)) {
if (dirChooser == null) {
dirChooser = new RDirectoryChooser(getOptionsDialog()... |
10ba81a6-b7c4-4160-996d-9724a20e8bcd | 7 | @Override
public void execute() {
if (isAnswering()) {
System.out.println("Answering");
if (Widgets.get(1188, 3).getText().equals("I can't afford that.")) {
System.out.println("Broke");
BearFurs.stop = -1;
} else {
while (isAnswering()) {
Keyboard.sendText("1", false);
Ta... |
35e65821-4ec1-4e44-b206-e3082311849f | 3 | public static DHCPOption newOptionAsShorts(byte code, short[] arr) {
if (!isOptionAsShorts(code)) {
throw new IllegalArgumentException("DHCP option type ("+code+") is not shorts");
}
byte[] buf = null;
if (arr != null) {
buf = new byte[arr.length * 2];
for (int i=0; i<arr.len... |
d95c3744-ee64-4d54-b6c3-4fc292455860 | 4 | public static boolean itemExists(int itemID, int itemX, int itemY) {
for (int i = 0; i <= 5000; i++) { // Phate: Loop through all item spots
if(globalItemID[i] == itemID && globalItemX[i] == itemX && globalItemY[i] == itemY) // Phate: Found item
return true;
}
return false; // Phate: Item doesnt exis... |
cbbee333-5ada-4abc-8f65-593563a41336 | 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... |
a0c84aa1-c06a-46fb-bc00-eb74d3cc9d7f | 0 | public static void main(String[] args) {
// float f = 1.0; <-- Error
float x = (float) 1.0;
float y = 1.0F;
} |
be79aa54-b968-4791-84eb-20d0020071d9 | 2 | @Override
public void timeStep(TimeEvent e) {
if(getState() == ENABLED) {
flash += e.getDelta();
if(flash > 1f) {
flash = 0;
}
}
} |
c519d08c-842d-4a21-b66d-b4be8375036c | 1 | public static void assertNotNull(Object object) {
if (object == null) {
throw new CsvException("object can't be null.");
}
} |
3fb2e27f-9c4e-438d-86ac-7617171406eb | 8 | static String toCSVString(String s) {
if (s == null)
return "";
StringBuilder sb = new StringBuilder(s.length()+1);
sb.append('\'');
int len = s.length();
for (int i = 0; i < len; i++) {
char c = s.charAt(i);
switch(c) {
case '... |
17794b63-a8f4-4d1d-8361-ae96b7968c7a | 2 | public synchronized boolean isRegrowColor(DyeColor dyeColor) {
List<String> regrowColors = sheepFeedPlugin.getConfig().getStringList("regrowcolors");
if ( regrowColors == null || regrowColors.size() == 0 ) {
SheepFeed.log("Config does not contain any regrowColor entries, while the plugin should have populated th... |
56021524-93de-42d9-b3c7-842aca242fa5 | 7 | public boolean isCollision(Pacman p) {
// If Pacman collides with a ghost and isn't powered, he dies.
if ((isGhost() == 1 || isGhost() == 2) && !pacman.isPowered()) {
sounds.playDeath();
lives--;
pacman.initializePos(450, 550, 0);
evil1.initializePos(350,... |
46920d43-8d18-47a9-8168-d5d38c3260aa | 4 | public boolean isInMap(){
if(x<0)
return false;
if(x>Alpha.mapsize)
return false;
if(y<-Alpha.mapsize/2)
return false;
if(y>Alpha.mapsize/2)
return false;
return true;
} |
bd804f6b-1984-4314-a77e-ef0e5ef4818d | 1 | public String getWeaponSound(String weapon) {
if(weapon.equals("assets/data/actors/bullet.xml")) {
return "bullet";
}
return null;
} |
0c570ad2-8c33-4e64-b444-c37d2ccaed32 | 6 | public Expression3 expression(boolean isExpressionInBrackets) throws ParsingException {
Expression3 left = summand();
while (true) {
if (tryConsume("+"))
left = new BinaryOperation<T>(left, summand(), arithmetics.get("+"));
else if (tryConsume("-"))
... |
92d1ffdf-b3b3-4d0a-ac7e-5de1f0b9dc88 | 9 | public void checkFanCollisions()
{
int index=0;
fanIDs = tileMap.getFanIDs();
fanTileX = tileMap.getFanXCoords();
fanTileY = tileMap.getFanYCoords();
for(int i=0;i<fanTileX.size();i++)
{
fanDist = tileMap.getTile(fanIDs.get(i)).getFanHeight();
if(640+20>fanTileX.get(i) && 640+8<fanTileX.get(i)+32)
... |
3f28f943-8ebb-4616-b2dd-f5326889365e | 9 | public void remove(SurfaceSelection selection) {
Range range = selection.getSelection().getRange();
Element ancestor = getCommonMatchingAncestor(selection);
if (ancestor != null && ancestor.getParentElement() != null) {
Node startNode = range.getStartContainer();
Node endNode = range.getEndCont... |
b66e8436-32fb-42a0-ac9e-4e58e8f86327 | 8 | public void createETables(Connection cCon, Connection eCon) throws SQLException {
//---------CREATE ETABLES--------------
DatabaseMetaData md = cCon.getMetaData();
Statement eStatement = eCon.createStatement();
Statement cStatement = cCon.createStatement();
ResultSet tables = md... |
fc2e1a25-be51-4821-a8d5-a5ed5d6e21e2 | 7 | public double fisher2c(){
double p = 0;
int nRows = thisMatrix.length;
int nColumns = thisMatrix[0].length;
int[] rowTotals = new int[nRows];
int[] columnTotals = new int[nColumns];
for (int i=0; i<nRows; i++){
rowTotals[i]=findSumRow(i, nColumns);
}
for (int i=0; i<nColumns; i++){
column... |
593a8bd8-f39c-4c22-a460-edc190396ca3 | 9 | public ByteBuffer toBuffer() {
byte fixed = 0x00;
int length;
fixed |= (TypeValues.indexOf(type) << Shift.TYPE);
if (duplicate) {
fixed |= OrMask.DUPLICATE;
}
if (qos > 0) {
fixed |= (qos << Shift.QOS);
}
if (retain) {
fixed |= OrMask.RETAIN;
}
if (changed) {
generate();
}
le... |
793961b3-0f25-42ba-b26e-711470dcf53d | 8 | private static double[] handleNegativity(double[][] table, boolean[] canBeNeg, int rows, int cols) {
//TODO: false
double[] maxima = new double[canBeNeg.length];
for (int i = 0; i < canBeNeg.length; i++) {
if (!canBeNeg[i]) {
for (int j = 0; j < rows - 1; j++) {
double current = Math.abs(table[j][cols... |
79db71dc-ef21-4054-8dc5-edc451d4e6b6 | 2 | public void skipRemaining() throws IOException {
while (length > 0) {
int skipped = (int) skip(length);
if (skipped == 0)
throw new EOFException();
length -= skipped;
}
} |
d18583a5-1d38-4647-baed-9c5d485219f1 | 5 | public boolean hasPathSum(TreeNode root, int sum) {
// Start typing your Java solution below
// DO NOT write main() function
if (root == null)
return false;
if (root.left == null && root.right == null && root.val == sum)
return true; // 成功条件
return (hasPathSum(root.left, sum - root.val) || hasPathSum(ro... |
bf0eaeed-a2d1-46a4-901d-5c6e9a5b77f3 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
bbd1954f-1309-4f44-97cb-0c30a8821ca4 | 4 | private void performTroubleShooting(){
int length = decrementLocator(locator).toString().length();
try {
info("---------------- Troubleshooting starting --------------------");
for (int i = 0; i < length; i++) {
decrementLocator(locator);
Boolean result = isPresent(TIMEOUT_WAIT_0);
info("Re-try wi... |
98066f54-c607-4358-a06d-560badd5ee58 | 1 | private void savePreferences()
{
Preferences preferences = BrainPreferences.getPreferences();
preferences.put(PreferencesNames.LEFT_NAME, this.leftNameField.getText());
preferences.put(PreferencesNames.RIGHT_NAME, this.rightNameField.getText());
preferences.put(PreferencesNames.MAX_S... |
74a20f1f-00a6-4992-b992-ec898d5e9e56 | 1 | public static String[] getVersions() throws IOException {
String version = get("version.txt");
String[] versions = version.split("\n");
for (int i = 0; i < versions.length; i++) {
versions[i] = versions[i].substring(
version.indexOf("[version]") + 9,
version.indexOf("[/version]"));
}
return versi... |
7b9dcfb9-1c04-4fd0-82e0-46e17f84d26d | 4 | private void adjust() {
boolean left = x < PLAYER_RADIUS;
boolean right = x > (WINDOW_WIDTH - PLAYER_RADIUS);
boolean top = y < PLAYER_RADIUS;
boolean bot = y > WINDOW_HEIGHT - PLAYER_RADIUS * 2;
if (right) x = (WINDOW_WIDTH - PLAYER_RADIUS) - 1;
if (left) x = PLAYER_RAD... |
ab233d4d-1c6f-4e5a-92e8-1e4d5b7f842c | 3 | public void forward(double steps){
double angle = this.angle * Math.PI / 180.0;
double dx = x + steps * Math.cos(angle);
double dy = y + steps * Math.sin(angle);
if (draw){
Graphics2D g = (Graphics2D)image.getGraphics();
g.setColor(color);
g.draw(new Line2D.Double(x, y, dx, dy));
}
if (curre... |
f1155376-bd5d-4ae3-be60-9dc75da517ed | 4 | private static int method515(char ac[], int i) {
for (int k = i; k < ac.length && k >= 0; k++)
if (ac[k] >= '0' && ac[k] <= '9')
return k;
return -1;
} |
35c1e39e-34f4-4afc-a199-db28cc309a2e | 6 | public void dagDistances(Graph g, Vertex start) {
List<Vertex> vertexList = g.vertices();
for (Vertex v : vertexList)
if (v.equals(start))
v.setDistance(0);
else
v.setDistance(Integer.MAX_VALUE);
Vertex[] sortedVertices = topologicalDFS(g);
for (Vertex u : sortedVertices) {
List<EdgeListObjec... |
ed31dee5-6933-4297-8e93-258446790f6e | 4 | public Queue createQueue(int queueId) throws QueueCreateException, QueueAlreadyExistsException {
try {
_out.writeInt(8); //Size
_out.writeInt(Response.MSG_QUEUE_CREATE);
_out.writeInt(queueId);
_out.flush();
int messageType = _in.readInt();
... |
32aecfa3-7db5-48df-bd71-fd41d30067a7 | 7 | private String normalizedName(Object o) {
if (!(o instanceof Class)) { return o.toString(); }
Class c = (Class)o;
String name = c.toString();
if (name.indexOf(' ') >= 0 && name.indexOf(' ') < name.length()-1) {
name = name.substring(name.lastIndexOf(' ')+1);
}
if (name.indexOf('.') >= 0 && name.indexOf('... |
72547b21-5fd1-4517-88c1-1a800a05f2b4 | 4 | @Override
public boolean equals(Object o) {
if (!(o instanceof Polynomial)) {
return false;
}
Polynomial other = (Polynomial) o;
Set<Integer> a = this.terms.keySet();
Set<Integer> b = other.terms.keySet();
if (!(a.equals(b))) {
return false;
... |
b424b982-b679-4837-9bc8-3e133fc578a7 | 2 | public boolean canBeKilledInstantly(Hero h){
int coefficient = h.level * 1;
if(coefficient > 20)
coefficient = 20 ;
if(this.HP < Percent.getPercent(coefficient, this.maxHP))
return true ;
return false ;
} |
47e78799-480b-4cbe-90e9-dbcd73824f36 | 3 | void createComboEditor (CCombo combo, TableEditor comboEditor) {
combo.setItems (OPTIONS);
combo.setText (newItem.getText (1));
/* Set up editor */
comboEditor.horizontalAlignment = SWT.LEFT;
comboEditor.grabHorizontal = true;
comboEditor.minimumWidth = 50;
comboEditor.setEditor (combo, newItem, 1);
... |
6c4c265f-3885-4c1d-a8f0-59e2ab1ada28 | 6 | public List<String> ExtractFromStream(InputStream is, int minLength) throws XMLStreamException, IOException {
List<String> lines = Lists.newArrayList();
XMLStreamReader staxXmlReader = XMLInputFactory.newInstance().createXMLStreamReader(is);
List<String> line = Lists.newArrayList();
for ... |
6c67bf10-6725-422c-b220-1689669b2f46 | 8 | public static boolean checkAnagrams(String s1, String s2) {
if (s1 == null || s2 == null || (s1.length() != s2.length()) || s1.length() == 0) {
return false;
}
int[] charCount = new int[256];
for (int i=0;i<256;i++) {
charCount[i] = 0;
}
char[] str1chars = s1.toCharArray();
char[] str2chars = s2.toC... |
eb67c32f-421a-4d81-9cab-60c1bd1aa339 | 8 | public void viewTicket(int ticketID) {
//===================== Local Data ======================//
Ticket ticket; //ticket to view details from
try {
ticket = tickets.fetch(ticketID);
} catch (Exception e) {
System.out.println("Unable to display info for this... |
da5c15f7-8166-4ae1-9064-348b4fe91c6b | 7 | protected HttpResponse sendRequestWithRetry(HttpRequest httpRequest) throws HttpException {
int retryCounter = 0;
int maxRetries = httpRequest.getHttpMethod().isIdemponent() ? config.getMaxRetryTimes() : 0;
if (httpRequest instanceof HttpStreamingRequest) {
maxRetries = 1; // for str... |
be2e6195-7fb4-4c28-b078-4c22c6e8ccc3 | 7 | boolean inBlockComment(int start, int end) {
for (int i=0; i<blockComments.size(); i++) {
int[] offsets = (int[])blockComments.elementAt(i);
// start of comment in the line
if ((offsets[0] >= start) && (offsets[0] <= end)) return true;
// end of comment in the line
if ((offsets[1] >= start) && (offsets[1] <=... |
ee81e35c-319a-4c40-aaa9-26e73ea557ab | 3 | public void selectPrevious() {
selectedIndex--;
if(selectedItem != null)
selectedItem.deselect();
if(selectedIndex < 0) {
boolean selectionRolloverHandled = handleSelectionRollover(SelectionRolloverDirection.Top);
if(selectionRolloverHandled)
return;
else
selectedIndex = listItems.size()... |
d0ca4b46-9362-41aa-9658-9f4fdd19ea60 | 8 | public void writeSentence(TokenStructure syntaxGraph) throws MaltChainedException {
if (syntaxGraph == null || dataFormatInstance == null || !(syntaxGraph instanceof PhraseStructure) || !syntaxGraph.hasTokens()) {
return;
}
PhraseStructure phraseStructure = (PhraseStructure)syntaxGraph;
sentenceCount++;
tr... |
bfef74e2-e82f-40c5-897c-192ef81d0942 | 2 | public void testFactory_parseMonths_String() {
assertEquals(0, Months.parseMonths((String) null).getMonths());
assertEquals(0, Months.parseMonths("P0M").getMonths());
assertEquals(1, Months.parseMonths("P1M").getMonths());
assertEquals(-3, Months.parseMonths("P-3M").getMonths());
... |
401016aa-d3a4-4da1-9543-8cc761f00e30 | 4 | public FindReplaceModel() {
super();
try {
super.process(Outliner.FIND_REPLACE_FILE);
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
// Make sure size is at least 1.
if (getSize() <= 0) {
... |
fd47e989-8836-4c8b-aac8-5fce2362f5d9 | 6 | public static void startupBacklinks() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Mo... |
086ddb5d-1845-4191-923c-92202bcaa1f5 | 7 | @Override
public void insert(String dataBaseName, String tableName,
ArrayList<Field> entries) {
// get the array of col from load
XMLParser obj = new XMLParser();
ArrayList<Col>table=obj.load(dataBaseName, tableName);
//ArrayList<Col> table = intialize();
if (table == null){
System.out.println("NULL ... |
0b69b30c-1476-4993-a34a-bba42ffc7242 | 5 | public void initUI() {
if(initiated){
w.setSize(500, 200);
return;
}
//setting self up
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
//setting up MenuDialog
md = new MenuDialog(this);
//setting language-specific strings
if(Locale.getDefault() == Locale.GERMAN || Locale.getDefault() == Local... |
c1cccb6b-f814-4980-8d80-7993aacf0b7b | 1 | public void initialize() {
configuration = new HashMap<String, String>();
try {
createSettings();
load();
} catch(FileNotFoundException e) {
Logger.log(" No settings found. Using from default.");
}
//Set all the settings TODO Improve this
Settings.fullscreen = configuration.get(Strings.FULLSC... |
a38c85d6-11c2-4a78-a6c9-a20dae0a0559 | 3 | public void toFtanMLContent(Writer writer) {
Iterator<FtanValue> iterator=values.iterator();
while(iterator.hasNext()) {
FtanValue next=iterator.next();
if(next instanceof FtanString)
((FtanString)next).toFtanMLContent(writer);
else if(next instanceof FtanElement)
((FtanElement)next).toFtanMLConten... |
92bf31c1-4884-4b20-ad83-f30cd1393f5b | 5 | public static void copyRow(Row row, Row newRow) {
Cell cell = null;
Cell newCell = null;
int cellType;
Iterator<Cell> iterator = row.iterator();
int count = 0;
// 遍历单元格,完成复制
while (iterator.hasNext()) {
cell = iterator.next();
cellType = cell.getCellType();
newCell = newRow.createCell(count);
... |
f752b904-8e21-4f7f-8e34-9b781fd8cdc4 | 2 | public int getPageLastItem() {
int i = getPageFirstItem() + pageSize - 1;
int count = getItemsCount() - 1;
if (i > count) {
i = count;
}
if (i < 0) {
i = 0;
}
return i;
} |
9c5ee102-cc64-4853-abbb-2420ea74de18 | 8 | static double grad(int hash, double x, double y, double z) {
int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE
double u = h<8||h==12||h==13 ? x : y, // INTO 12 GRADIENT DIRECTIONS.
v = h<4||h==12||h==13 ? y : z;
return ((h&1) == 0 ? u : -u) + ((h&2) == 0 ? v : -v... |
9e6c47fc-310e-4fd0-b79d-4cdcc720c67e | 4 | public int getSquareWidth() {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: getSquareWidth() BEGIN");
}
if (test || m_test) {
System.out.println("GameBoardGraphics :: getSquareWidth() END");
}
return SQUARE_WIDTH;
} |
4acb1bad-5b2d-4c2c-a6b1-fb21c5489002 | 7 | private ArrayList<Game> getGames(String from, String to) {
DatastoreService datastore = DatastoreServiceFactory
.getDatastoreService();
Filter fromFilter = new FilterPredicate("gameId",
FilterOperator.GREATER_THAN_OR_EQUAL, from);
Filter toFilter = new FilterPredicate("gameId",
FilterOperator.LESS_TH... |
8531f477-450d-4620-bdf4-4e7062bd111e | 5 | @Test(expected=BadPostfixException.class)
public void evaluatePostfix3() throws DAIndexOutOfBoundsException, DAIllegalArgumentException, NumberFormatException, NotEnoughOperandsException, BadPostfixException
{
try
{
postfix.addLast("^");
String result = calc.evaluatePostfix(postfix);
}
catch (... |
96d3bc0c-cc93-4c81-94d8-e84545107584 | 5 | private void fireKeyEvent(KeyEvent e) {
super.processKeyEvent(e);
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == KeyListener.class) {
KeyListener listener = ((KeyListener) listeners[i + 1])... |
8cfa9dc1-93fd-4046-9a52-aed4860c9222 | 9 | public static int[] rotationArray() {
int n = cad.length;
Integer[] order = new Integer[n];
for (int i = 0; i < n; i++)
order[i] = i;
Arrays.sort(order, comp);
int[] sa = new int[n];
int[] classes = new int[n];
for (int i = 0; i < n; i++) {
sa[i] = order[i];
classes[i] = cad[i];
}
for (int le... |
83b4181c-e17d-4109-8e3f-e2be92ad486a | 9 | public static void burnCard(Player p){
if(p == null || p.deck == null || pile == null || pile.isEmpty()){
return;
}
if(p.lives < 1)
return;
if(p.deck.isEmpty() || pile.isEmpty()){
p.lives--;
if(currentState == State.inGame){
p.addNotification("-1 Life", Color.RED);
}
return;
}
... |
d7b7975b-44ea-4469-9c11-c31fb7ab1d30 | 6 | public double score(StringWrapper s, StringWrapper t) {
checkTrainingHasHappened(s, t);
UnitVector sBag = asUnitVector(s);
UnitVector tBag = asUnitVector(t);
List<Similarity> similarities = new ArrayList<Similarity>(sBag.size());
double sim = 0.0;
int i = 0;
for (... |
01a57887-745f-4e8f-86c6-aa51a39940b6 | 2 | private Comparator<SharingPeer> getPeerRateComparator() {
if (ClientState.SHARING.equals(this.state)) {
return new SharingPeer.DLRateComparator();
} else if (ClientState.SEEDING.equals(this.state)) {
return new SharingPeer.ULRateComparator();
} else {
throw new IllegalStateException("Client is neither sh... |
4371b0a8-d32f-435a-83ac-3299dcaf6b29 | 6 | public static void create(CommandSender sender, String [] args){
if(sender.hasPermission("battlegrounds.team.create")){
//If missing parameters
if(args.length < 2+1){
sender.sendMessage(ErrorMessage.MissingParameters);
sender.sendMessage(ChatColor.YELLOW + usage);
}
else if(args.length > 2+1+1)... |
9e926694-9ad5-4156-8b41-31fa7be66a1a | 6 | public String subCount(String root) {
int n = root.length();
StringBuilder sb = new StringBuilder();
char prev = 0;
int cnt = 0;
for (int i = 0; i < n; i++) {
char cur = root.charAt(i);
if (cur == prev)
cnt++;
else {
if (prev != 0) { // 第一条是空
StringBuilder tmp = new StringBuilder();
... |
9a9d7994-4a58-4fc3-aa7a-50901620c754 | 5 | protected String getPlayerTextField(int playerNum)
{
if (playerNum == 1)
{
return player1TextField.getText();
}
else if (playerNum == 2)
{
return player2TextField.getText();
}
else if (playerNum == 3)
{
return player3TextField.getText();
}
else if (playerNum == 4)
{
return player4Text... |
75ee6082-7219-4800-85bc-2c28f280b2f9 | 7 | public Wave32(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 1250; i++){
if(i % 17 == 0)
add(m.buildMob(MobID.TENTACRUEL));
else if(i % 6 == 0)
add(m.buildMob(MobID.HORSEA));
else if(i % 5 == 0)
add(m.buildMob(MobID.TENTACOOL));
else if(i % 4 == 0)
add(m.buildMob(MobID... |
082b2b36-1a8a-4376-bdbf-4ae8e03f8e92 | 0 | public void setIndirizzo(Address indirizzo) {
this.indirizzo = indirizzo;
} |
81773dac-35eb-4493-a132-830fa2fe801a | 2 | public static List<ParisModel> getAllTeamParisBySchedule(String schedId) {
List<ParisModel> result = new ArrayList<ParisModel>();
List<ParisVictoryModel> parisVict = getAllVictoryParisBySchedule(schedId);
for(ParisVictoryModel paris : parisVict) {
result.add(paris);
}
List<ParisScoreModel> parisScor = getA... |
2ab60215-cd40-4e09-92b9-cd4ab15bdd1d | 3 | @Override
public int compare(byte[] left, byte[] right) {
for (int i = 0, j = 0; i < left.length && j < right.length; i++, j++) {
int a = (left[i] & 0xff);
int b = (right[j] & 0xff);
if (a != b) {
return a - b;
}
... |
ac9b2baa-4e0f-426c-af9a-748874247a81 | 0 | public int kitSize(){
return kit.size();
} |
140f2200-1fd8-4b69-b967-eaa929c466fb | 2 | @Override
public String toString() {
return isNull() ? "NULL" : isVoid() ? "VOID" : String.valueOf(value);
} |
f9960982-7fde-408a-b4b0-217e4540924c | 4 | public void makeHolierHole() {
for(int y = 0; y < getHeight(); y++) {
for(int x = 0; x < getWidth(); x++) {
if((x >= 1+y%2) && (x <= 5+y%2)) {
array[x][y].visible = false;
}
}
}
} |
0ebde52c-7173-4515-b13a-6c5817ba5da6 | 1 | public void requestImport(ImportReference reference) {
if (!imports.contains(reference))
imports.add(reference);
} |
a45aed4e-0105-4dac-9b00-e768bd00cfc2 | 3 | public void run()
{
DatagramPacket dp = null;
byte[] arrBytes = null;
try
{
if (null == EzimAckSender.ms)
throw new Exception("Ack socket not prepared yet.");
arrBytes = this.msg.getBytes(EzimNetwork.dtxMsgEnc);
if (arrBytes.length > EzimNetwork.inBuf)
throw new Exception("Ack message too l... |
ea3a8353-a1ae-49f9-a036-2b1391134ff4 | 9 | private void updateAlerts() {
try {
update(AlertNotifier.settings.alertURL);
}
catch(NumberFormatException e) {
AlertNotifier.console.writeLine("Encountered an improperly formatted number while updating alerts: " + e.getMessage());
}
catch(MalformedURLException e) {
AlertNotifier.console.writeLine("A... |
dfcf2e2b-8da3-4756-9da7-0e8d2ba2d609 | 0 | public void setDescription(String description) {
this.description = description;
} |
86be5e30-4a00-45ea-a001-512205e87237 | 0 | static void store_littleendian(byte[] x, int offset, int u)
{
x[offset] = (byte) u; u >>>= 8;
x[offset + 1] = (byte) u; u >>>= 8;
x[offset + 2] = (byte) u; u >>>= 8;
x[offset + 3] = (byte) u;
} |
af8acf17-5e74-47d6-be85-ea52031fcd83 | 6 | public void writeValue(JTextFieldUnit othertext, JTextFieldUnit thistext,
JComboBoxUnit lefte, JComboBoxUnit righte) {
if(!thistext.getText().equals("")){
if (lefte.getSelectedItem() != null && righte.getSelectedItem() != null)
try {
othertext.setText(Double.toString(Converter.convert(Double
.parseD... |
f079bda0-c44c-4b4e-80e2-8d579a12e2b0 | 0 | public int getId() {
return id;
} |
bbe0dd2c-b5f2-40d8-8ea3-38b2d886b2da | 8 | public byte [] getPowerSpectrum(float[] BIJfht)
{
float[] fps = new float[maxN*maxN];
float min = Float.MAX_VALUE;
float max = Float.MIN_VALUE;
for (int row=0; row<maxN; row++)
{
fhtps(row, maxN, BIJfht, fps);
int base = row * maxN;
for (int col=0; col<maxN; col++)
{
float r = fps[base... |
25e958f8-8fcc-4ffb-beea-c10c63d5b5a0 | 1 | public void testConstructor_RP_RP_PeriodType8() throws Throwable {
Partial dt1 = new Partial().with(DateTimeFieldType.year(), 2005).with(DateTimeFieldType.hourOfDay(), 12);
Partial dt2 = new Partial().with(DateTimeFieldType.year(), 2005).with(DateTimeFieldType.hourOfDay(), 14);
try {
... |
d92e4285-57a6-4f9f-b28c-d82b92098da3 | 9 | public PixelMap or(PixelMap rhs) {
int width = pixels.length;
int height = pixels[0].length;
int rhsWidth = rhs.pixels.length;
int rhsHeight = rhs.pixels[0].length;
int maxWidth = Math.max(pixels.length, rhs.pixels.length);
int maxHeight = Math.max(pixels[0].length, rhs.pixels[0].length);
boolean[][... |
d85e828c-85a8-4630-b09d-d6ca992d3d41 | 0 | void performSchedule() {
synchronized(this) {
// TODO: scan for notification and put it into buffer
//this.aNotification.add(null);
//this.notifyAll();
}
} |
2103432c-79df-4016-a1f8-697ae7af7c38 | 6 | @Override
public void itemStateChanged(ItemEvent event) {
if (event.getStateChange() == ItemEvent.SELECTED) {
if (event.getItemSelectable().equals(comboBox)) {
automaticItemSelection = true;
if (getIndex(driver.getPersonDB().getCustomerList()) != -1) {
setTextField(getIndex(driver.getPersonDB().getCu... |
21abc05a-13de-4999-9b5b-3f1376c3c08c | 0 | public static void Warning(String s){ log.info("[AprilonIRC] " + s); } |
c7e4fd30-0df9-48b6-ad28-98066f7f1e39 | 4 | @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerConsoleCommand(ServerCommandEvent event) {
String msg = event.getCommand();
if (getConfig.ConsoleCommands() && getConfig.logFilesEnabled()) {
filehandler.logConsole(msg);
}
if (getConfig.ConsoleCommands() && getConfig.MySQLEnabled()) {
a... |
f9ac9fba-cd61-4692-9f43-0a27489345f7 | 0 | public String toString(String input) {
return "u("+input+")";
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.