method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
785f25ee-6666-444a-8884-4f792b66ef5e | 6 | public int initialize2(byte dataSrc[], int offset)
{
int vertexCount = getVertexCount();
vertexIndexArray = new int[vertexCount];
for (int index = 0; index < vertexIndexArray.length; ++index)
{
vertexIndexArray[index] = ByteConversions.getUnsignedShortInByteArray... |
248015d5-0291-4943-b42f-8f519d8ac485 | 9 | private int busquedaVirus(int i, int j, int l, int maximo) {
for (int k = 0; k < dx.length; k++) {
int temp_dx = i+dx[k];
int temp_dy = j+dy[k];
if(temp_dx>=0 && temp_dx < tablero.filas() && temp_dy>=0 && temp_dy < tablero.columnas() && !visited[temp_dx][temp_dy]
&& tablero.getElemento(temp_dx, temp_dy)... |
439b68a8-627e-488e-baa9-3845669f6c3f | 3 | public Object getValueAt(int row, int column) {
switch (column) {
case 0:
return "" + transitions[row].getFromState().getID();
case 1:
return "" + transitions[row].getToState().getID();
case 2:
return transitions[row].getDescription();
default:
return null;
}
} |
b64d6e7a-190b-42d1-8d30-d5bca08f6971 | 3 | public void fill(Graphics2D g){
if(canMove)doMovement();
if(relative){
centerX=(img.getWidth()/2)-(Display.player.loc.getX()/relXT);
centerY=(img.getHeight()/2)-(Display.player.loc.getY()/relYT);
}
testTouching();
if(textured){
int xl = (int) Math.round(centerX-(width/2));
int yl = (int) Math.roun... |
80aa0c30-77d5-49fa-905d-5f4e8c22e0a9 | 1 | private void sendData( String message )
{
try // send object to client
{
//PrintWriter pw = new PrintWriter(output);
output.writeObject( "SERVER>>> " + message );
output.flush(); // flush output to client
System.out.println( "\nSERVER>>> " + message );
} // end try
catch ( IOException ioException )... |
86884110-7754-4dfc-989e-fb4f1a546ef0 | 8 | static String formatHanyuPinyin(String pinyinStr,
HanyuPinyinOutputFormat outputFormat)
throws BadHanyuPinyinOutputFormatCombination
{
if ((HanyuPinyinToneType.WITH_TONE_MARK == outputFormat.getToneType())
&& ((HanyuPinyinVCharType.WITH_V == outputFormat.getVCharType(... |
66adf1c5-ae7c-4ae3-abc0-0fd610489141 | 4 | private void RealizePorRandomAMutacao () {
cadeiaDeCaminhos = new int[tamanhoTotalDoCaminho];
Caminho caminho;
int numRandomico;
for (int i = 0; i != numeroGenes; i++) {
numRandomico = geradorRandomico.nextInt(populacaoDaPonteControlador... |
c9cf28d0-5a27-4e02-b122-b9f3f40b5555 | 9 | public CgiArguments(String uriQuery) {
String[] params = uriQuery.split("&");
for (String param : params) {
String[] keyval = param.split("=", 2);
if (keyval.length < 2) {
continue;
}
String key = keyval[0].toLowerCase();
String val = keyval[1];
if (key.equals("query")) {
_query = val;
... |
070b3d89-54ec-49c2-a949-09d7bfc1ed4a | 2 | public final static String MD5(String s) {
char hexDigits[] = { '0', '1', '2', '3', '4',
'5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F' };
try {
byte[] btInput = s.getBytes();
//获得MD5摘要算法的 MessageDigest 对象
Mess... |
56c5e37d-cd52-4997-9b7b-4125965a28fa | 7 | private Object readJSON() throws JSONException {
switch (read(3)) {
case zipObject:
return readObject();
case zipArrayString:
return readArray(true);
case zipArrayValue:
return readArray(false);
case zipEmptyObject:
return new JSONO... |
699509ca-288a-4c46-a8e6-38b24a03c738 | 6 | public boolean isFeasible(Coordinate c) {
boolean validI = c.i >= 0 && c.i < size;
boolean validJ = c.j >= 0 && c.j < size;
boolean validCell = false;
if (validI && validJ) {
validCell = (maze.get(c.i).get(c.j).val == 0);
}
return validI && validJ && validCell;
} |
260d5892-831f-4179-bad2-dc6ded36c749 | 7 | public static int charToInt(char c) {
int data = 0;
switch (c) {
case 'I':
data = 1;
break;
case 'V':
data = 5;
break;
case 'X':
data = 10;
... |
442dc85f-2e52-460a-a5be-8f0f11bd652e | 0 | private SaveResults() {} // Es una MAE. |
92c046a6-f498-4ec2-9260-0927bb228fde | 6 | public CustomCanvas()
{
super("Custom Canvas");
// Demonstrates the use of a Swing component for rendering vertices.
// Note: Use the heavyweight feature to allow for event handling in
// the Swing component that is used for rendering the vertex.
mxGraph graph = new mxGraph()
{
public void drawState(m... |
84b4d4c2-00f0-42e7-a4a1-8af12318daa4 | 2 | public void writeControlFile(String controlPath) throws IOException {
Map<String, String> env = System.getenv();
File controlFile = new File(env.get("control_dir"), controlPath);
if (!controlFile.exists())
controlFile.createNewFile();
List<String> envProperties = getPropert... |
b6329c4e-9f6b-4e5d-9a65-fd26b38ecaf3 | 5 | private boolean evaluateCardPlayable(Card c) {
// There are spells that have no cost, and those cannot be played for
// their cost, seeing as they don't have one. Thus, despite not
// implementing those cards for a while, there will be a special case
// where I check to see if their cost is null.
if (c.getCo... |
45f65ddf-da84-4233-a261-f95a15c4752d | 9 | protected static boolean isCommutative(int operator) {
return (operator == Token.AND ||
operator == Token.OR ||
operator == Token.UNION ||
operator == Token.INTERSECT ||
operator == Token.PLUS ||
operator == Token.MULT ||
... |
0001d8ac-b493-4406-8270-401e87a29f69 | 2 | public boolean hasRole(Role role, User user) throws Exception {
try {
boolean itHasRole = false;
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
Query q = session.getNamedQuery(getNamedQueryToHasRole());
... |
6176aca9-371b-4c9e-83dc-9dad2ad502bb | 4 | @Override
public Value evaluate(Value... arguments) throws Exception {
// Check the number of argument
if (arguments.length == 1) {
// get Value
Value value = arguments[0];
// If numerical
if (value.getType().isNumeric()) {
return new Value(new Double(Math.atan(value.getDouble())));
}
if (va... |
dcdf4c95-d070-4e6d-a1a5-d9f10f2a4b5b | 1 | @Test
@SuppressWarnings("unused")
public void testThresholdOfNeighborhood() throws Exception {
// keeping the same implementation as before except that we use a threshold based neighborhood
// how does the threshold of the neighborhood influence the performance (root mean square error) of the recommender?
do... |
3f813538-fdef-46a5-8651-602ceb6f02f3 | 2 | public int getVitality(){
int value = 0;
for (Armor armor : armorList) {
if(armor != null) value += armor.getStats().getVitality();
}
return value;
} |
0949b478-fb41-4073-878a-13115db97bec | 0 | @Column(name = "PRP_ID_ELEMENTO")
@Id
public Integer getPrpIdElemento() {
return prpIdElemento;
} |
d65f5b76-5a56-4368-9075-85482326ba10 | 6 | public static int maxRight() {
int arr[] = new int[1001];
for (int i = 1; i <= 1000; i++) {
for (int j = 1; j < 1000; j++) {
if (i + j + Math.sqrt(i * i + j * j) > 1000) {
break;
}
if (Math.sqrt(i * i + j * j) % 1 == 0)
arr[i + j + (int) Math.sqrt(i * i + j * j)]++;
}
}
int max = 0;... |
27810c46-d1b4-467b-ab4a-73025b38356c | 8 | @Override
public void keyPressed(KeyEvent e) {
super.keyPressed(e);
if (e.getKeyCode() == KeyEvent.VK_A || e.getKeyCode() == KeyEvent.VK_LEFT) {
controlled.move(Direction.WEST);
}
else if (e.getKeyCode() == KeyEvent.VK_D || e.getKeyCode() == KeyEvent.VK_RIGHT) {
... |
185c786d-4ac4-4285-b36c-1e43ab9f656e | 4 | public static void drawVisSquare(GOut g, Coord tc, Coord hsz) {
if(JSBotUtils.playerID == -1)
return;
if(UI.instance.minimap == null) return;
Coord current;
if(JSBotUtils.getPlayerSelf() == null)
current = new Coord(0, 0);
else {
if(JSBotUtils.getPlayerSelf() == null)
current = new Coord(0, 0);
... |
19fefbeb-b4f4-4c68-a24f-40d41a20f283 | 0 | @Override
public Car driverCar() {
return new AudoCar();
} |
19b338c7-870f-49e5-a745-9ef643749ab4 | 7 | public static VaryNode makeVaryNode(int iNode, FastVector nRecords, Instances instances) {
VaryNode _VaryNode = new VaryNode(iNode);
int nValues = instances.attribute(iNode).numValues();
// reserve memory and initialize
FastVector [] nChildRecords = new FastVector[nValues];
for (int iChild =... |
2adc87d1-64b8-4ff8-8ea0-e226d621b894 | 0 | public Long getId() {
return id;
} |
36671f8c-dfb6-4767-8ba8-1bb5a8345840 | 1 | public static JSONObject convertToJSON(Properties properties) throws JSONException {
JSONObject jsonObject = new JSONObject();
Enumeration e = properties.propertyNames();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
jsonObject.put(key, properties... |
acda4ebf-0145-4fd7-98ff-e4cd3498fb56 | 1 | @Test
public void getAllRecipesTest() throws Exception {
Recipe recipe = new Recipe();
recipe.setName("borscht");
recipe.setCategory(CategoryEnum.chicken);
try {
recipe.canSave();
recipeService.createRecipe(recipe);
} catch (SaveError e) {
... |
c075a52a-f858-4228-be44-2124306df1a2 | 2 | private int getDistanceToNearestOpponent() {
nearestOpponent = null;
int distance = LONGDISTANCE;
Opponent[] opponents = getOpponents();
for (int i=0; i<opponents.length; i++) {
int d = (int)Vector3D.getDistance(getLocation(), opponents[i].getLocation());
if (d < distance) {
distance = d;
nearestO... |
31254e80-dbff-4043-930f-8026e9b67777 | 3 | public void update (double elapsedTime, Dimension bounds, List<Force> activeForces) {
for (Force f : activeForces) {
f.applyForce(elapsedTime, bounds, myMasses);
}
for (Spring s : mySprings) {
s.update(elapsedTime, bounds);
}
for (Mass m : myMasses) {
... |
f2b35fd1-02c3-4951-8f3d-bdc280723421 | 0 | public Card DealCard(){
Card newcard = new Card(shuffledDeck.get(getDealCounter()));
decremDealCounter();
return newcard;
} |
8ccbe505-cfda-48bf-8576-7d9e08705b70 | 5 | public void keyReleased(KeyEvent e) {
int keycode = 0;
try {
keycode = e.getKeyCode();
} catch (Exception E) {
//pass
}
if (keycode == KeyEvent.VK_UP) {
dy += 1;
} if (keycode == KeyEvent.VK_DOWN) {
dy -= 1;
} if (keycode == KeyEvent.VK_RIGHT) {
dx -= 1;
} if (keycode == KeyEvent.VK_L... |
bd237beb-269c-45dc-991b-c3d0e5fc622b | 5 | public void typeCounter() {
try {
String line, s[], ss[];
while((line=sortBr.readLine())!=null) {
s = line.split(" ");
sortmap.put(s[0], s[1]);
}
while((line=typeBr.readLine())!=null) {
ss = line.split("... |
fa703222-c37c-4873-b5c5-a1b50fd8d6b5 | 6 | @Override public String nextName() throws IOException {
expect(JsonToken.NAME);
Iterator<?> i = (Iterator<?>) peekStack();
Map.Entry<?, ?> entry = (Map.Entry<?, ?>) i.next();
stack.add(entry.getValue());
return (String) entry.getKey();
} |
72f84654-aad3-4f2e-9f7b-d839c029bde6 | 7 | public void setOptions(String[] options) throws Exception {
String classifierString = Utils.getOption('W', options);
if (classifierString.length() == 0)
classifierString = weka.classifiers.rules.ZeroR.class.getName();
String[] classifierSpec = Utils.splitOptions(classifierString);
if (classifierS... |
c43dda4c-7513-4b7c-b13b-84fe842dc8ba | 0 | private void handleError(String message, Exception e)
{
MessageDialog.getInstance().showError(message);
LOGGER.error(message, e);
} |
3cc2a5ef-e2ab-4ab3-9bff-3c6f7297cf24 | 1 | private void checkMinimumPlayers() {
if (controller.canGameBeStarted()) {
startServerButton.setEnabled(true);
}
addButtonHandlers();
} |
cb812fbb-973a-4d48-aa7e-c1a17f5d72bb | 0 | public LRParseTableChooserPane(LRParseTable table) {
super(table);
} |
f140ad4c-4621-419f-b639-a9dce677a978 | 2 | public static String trimNullSquares(String s)
{
if (s != null && s.indexOf('\u0000') >= 0)
{
s = s.substring(0, s.indexOf('\u0000'));
}
return s;
} |
b5602f85-ff7c-4fba-be28-bb49ff507aae | 4 | public static Set<ITrackTile> getAdjecentTrackTiles(World world, int x, int y, int z) {
Set<ITrackTile> tracks = new HashSet<ITrackTile>();
ITrackTile tile = getTrackFuzzyAt(world, x, y, z - 1);
if (tile != null)
tracks.add(tile);
tile = getTrackFuzzyAt(world, x, y, z + 1);... |
c01a809f-9bf5-4247-b82e-7e128edbf9dd | 6 | public static boolean adjacentCoordinates(Coordinates c1, Coordinates c2, int height, int width) {
// If they are in the same row
if (c1.row == c2.row) {
// If they are one to the left or one to the right of
// each other
... |
34a0eb40-6e02-4c2a-ac0a-4f5e514a537a | 8 | protected void addRandomNucleotide() {
double dr = 4 * Math.random();
Nucleotide nn = null;
if (dr >= 0 && dr < 1)
nn = Nucleotide.ADENINE;
else if (dr >= 1 && dr < 2)
nn = Nucleotide.GUANINE;
else if (dr >= 2 && dr < 3)
nn = Nucleotide.CYTOSINE;
else if (dr >= 3 && dr < 4)
nn = Nucleotide.THYMI... |
447a969a-5b93-469c-a4dd-4aea7df7518f | 6 | public String stComposeEmailForYahooEmailService(int dataId,int ExpVal,String flow )
{
int actVal=1000;
String returnVal=null;
hm.clear();
hm=STFunctionLibrary.stMakeData(dataId, "ExternalEmail");
String to = hm.get("To");
String subject = hm.get("Subject");
String message = hm.get("Message")... |
83b6f481-91de-42f6-9df9-3769c5d1c5a0 | 6 | public static void connect(TreeLinkNode root) {
if (root == null)
return;
//connectHelper1(root);
//connectHelper2(root);
if (root.left != null) {
root.left.next = root.right;
connect(root.left);
connect(root.right);
}
if (root.left != null &&root.right != null) {
TreeLinkNode rootLeft = root... |
903a91aa-19d8-41ab-8094-804350b29591 | 8 | public static void input (String cmd, String args) {
switch (cmd) {
case "/help":
getHelp ();
break;
case "/day":
// Check in debug
LineManager.addDay ();
System.out.println ("Day " + (LineManager.dayNum + 1)... |
d2799496-63ed-466b-af96-57dec09669f2 | 4 | public void remove(WeakReference<Object> wref)
{
Set<Entry<Long, List<WeakReference<Object>>>> entrySet = buckets.entrySet();
// iterate over the buckets
Iterator<Entry<Long, List<WeakReference<Object>>>> iterator = entrySet.iterator();
while (iterator.hasNext())
{
Entry<Long, List<WeakReference<Ob... |
a711e127-fba8-4368-a17a-139b5fe56bd1 | 6 | public static LinkedListNode reverseEveryOtherKNodes(LinkedListNode head,
int k)
{
LinkedListNode prev = null;
LinkedListNode current = head;
LinkedListNode next;
int count = 0;
while (count < k && current != null)
{
next = current.ge... |
c522599f-ff87-4a31-be91-27609ca83d38 | 4 | public void setGender(String gender) {
if (gender.toLowerCase() == "male" && isFemale == true) {
this.isFemale = false;
totalWomen--;
}
else if (gender.toLowerCase() == "female" && isFemale == false){
this.isFemale = true;
totalWomen++;
}
} |
0d01284e-2bcb-457f-9d4d-cf1d9910d928 | 7 | public static Stella_Object accessAlternativeBindingsSetSlotValue(AlternativeBindingsSet self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Logic.SYM_LOGIC_THE_VARIABLE) {
if (setvalueP) {
self.theVariable = ((PatternVariable)(value));
}
else {
value =... |
173dd931-bd61-44fd-9e78-d2491e98c330 | 5 | public static void main(String[] args) {
String s = "国无锡";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(s.getBytes());
byte[] b = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < b.length; offset++) {
... |
09232315-a11e-4b74-b37e-3655f39df901 | 1 | void run() {
// System.out.println("Started " + in2);
for (int i = 0; i < 1000000; i++) {
double f = i + Math.PI * i / 12.3456 * i;
double g = Math.sin(f * f) / (i + 1) * Math.PI;
}
// System.out.println("Done " + in2);
} |
861b557b-bba9-4cd4-b1e0-7db437826e29 | 5 | @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 Applicant)) {
return false;
}
Applicant other = (Applicant) object;
if ((this.id == null && other.id != null) |... |
1a4783ed-2bc6-466f-a37d-a3f175ef0554 | 9 | private ILNode setupNode(final IFPNode fp, final DomainTuple d, final ILNode parent)
throws Exception {
if( ! evaluate( fp.getCondition(), d ) ) {
return new LFalse();
}
final FactorCatalog factCat
= getFactorCatalog(fp.getId());
final GenTuple ... |
ba4d76d2-f267-4fb4-89e8-ecf043be2a23 | 5 | private boolean versionCheck() {
final String title = this.versionName;
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String localVersion = this.plugin.getDescription().getVersion();
if (title.split(DELIMETER).length == 2) {
// Get the newest file's version number
final String remoteVersion = ... |
dc5124ba-4870-4b60-8ada-3a01b3d780a7 | 7 | public static String [] partitionOptions(String [] options) {
for (int i = 0; i < options.length; i++) {
if (options[i].equals("--")) {
// ensure it follows by a -E option
int j = i;
while ((j < options.length) && !(options[j].equals("-E"))) {
j++;
}
/* if (j >= options.length) {
return new... |
31e9ab60-0916-47cc-ac58-1505b6b5830d | 8 | private static String getTaxonomy( String key )
throws Exception
{
key = key.toLowerCase();
for(int x=1; x < NewRDPParserFileLine.TAXA_ARRAY.length; x++)
{
String level = NewRDPParserFileLine.TAXA_ARRAY[x];
if( key.indexOf(level) != -1 )
return level;
}
if( key.endsWith("cla"))
return NewRD... |
1076b971-2aca-484c-8d63-283233aefadf | 3 | public void draw(Graphics2D graphics) {
if (xOffset == -1) {
xOffset = (int) (rect.width - font.getStringBounds(label, graphics.getFontRenderContext()).getWidth()) / 2;
yOffset = (int) (font.getLineMetrics(label, graphics.getFontRenderContext()).getAscent() + rect.height) / 2;
}
... |
c163622e-6ce0-4acb-b8f2-444d4879c746 | 4 | private int makeFieldInitializer(Bytecode code, CtClass[] parameters)
throws CannotCompileException, NotFoundException
{
int stacksize = 0;
Javac jv = new Javac(code, this);
try {
jv.recordParams(parameters, false);
}
catch (CompileError e) {
t... |
89c94ba2-850e-486e-adad-53ffc721e7fb | 5 | private void generateModeConversionRules(List<CtModeConversionRule> modeConversionRules) {
if (null == modeConversionRules || modeConversionRules.size() == 0) return;
for (CtModeConversionRule conversionRule : modeConversionRules) {
List<String> conversionList = conversionRule.getTo();
if (null == conversionL... |
a62a6f33-65d8-406b-a3f7-ba9d4010ef5e | 3 | public void draw(double[] input) {
draw.show(0);
draw.clear(Drawer.BLACK);
double barWidth = 1.0 / input.length;
double width = 0.90 * barWidth;
for (int i = 0; i < input.length; i++) {
if (exch.contains(i)) {
draw.setPenColor(Drawer.RED);
} else if (less.contains(i)) {
draw.setPenColor(Drawe... |
29aa3148-1d92-4b73-9ca1-f62f67dcf0e0 | 0 | public static void main(String[] args) {
ParentProducer producer = new ParentProducer();
ParentReturn ret = producer.process();
System.out.println(ret);
producer = new ChildProducer();
ret = producer.process();
System.out.println(ret);
} |
975435b8-4597-4d6d-8d32-47eb3693edb1 | 3 | private static Location getLocation(String location)
throws NewCustomException {
Session session = null;
Transaction tx = null;
Location loc = null;
try {
session = HibernateUtil.createSessionFactory().openSession();
tx = session.beginTransaction();
Criteria criteria = session.createCriteria(Locati... |
861ca5d3-02ed-4643-9e17-8b866f4c4fd0 | 8 | private static boolean validateMove(PGNMove move) {
String strippedMove = move.getMove();
if (move.isCastle()) {
return true;
} else if (move.isEndGameMarked()) {
return true;
} else if (strippedMove.length() == MOVE_TYPE_1_LENGTH) {
return PGNParseUtils.matchType1(strippedMove);
... |
3e62f53d-b317-4fd3-8fa7-058c28730835 | 1 | @Test
public void testLoadToMemory() { //Test assembled code is loaded to memory
loader.load(testProgram);
loader.loadToMemory();
for (int i = 0; i < testProgram.length; i++) {
assertEquals(testProgram[i].toString(), memory.accessAddress(i).toString());
}
} |
68d0d8a7-659a-46b2-9741-7fd36e8a1c3a | 1 | public static void tokenize(String line, ArrayList<String> tokens) {
StringTokenizer strTok = new StringTokenizer(line);
while (strTok.hasMoreTokens()) {
String token = strTok.nextToken();
tokens.add(token);
}
} |
279a0f60-4022-4625-a267-a60249c706c1 | 7 | public static String shorten(Graphics g, String text, int width, Preference preference) {
if (g.getFontMetrics().stringWidth(text) <= width)
return text;
if (preference == Preference.begin) {
if (g.getFontMetrics().stringWidth("..") > width)
return "";
... |
adf2dc00-6b3e-4b09-8a43-ef469e679199 | 0 | public String getLogin() {
return login;
} |
501b0fc2-fadf-4611-a9bf-de98c4d2b673 | 7 | private String getSelectedExpression()
{
String result="";
switch(Equation.getSelectedIndex()+1)
{
case 1:
result=fx;
break;
case 2:
result=gx;
break;
case 3:
result=ax;
... |
edcb9e14-729a-41f0-a473-0369f337c491 | 4 | public static void saveAdventurer(Adventurer adventurer) throws IOException {
try {
List<Adventurer> adventurers = new ArrayList<>();
adventurers = getAllAdventurer();
boolean found = false;
for (int i = 0, end = adventurers.size(); i < end; i++) {
... |
57e073d4-e5f3-4481-bd2b-55146e16d869 | 8 | String getHanyuPinyinStringWithPolyphones(String string){
for(int i=0; i<string.length(); i++){
String pinyinRecord = getHanyuPinyinRecordFromChar(string.charAt(i));
if(null != pinyinRecord){
int indexOfLeftBracket = pinyinRecord.indexOf(Field.LEFT_BRACKET);
int indexOfRightBracket = pinyin... |
efe9f005-ed26-4756-a12a-53304cf088de | 5 | public Piece[][] generateBoard(){
ArrayList<Piece> figuren = new ArrayList<Piece>();
Piece[][] newBoard = new Piece[8][8];
//Weisse Figuren
figuren.add(new King("weiss"));
figuren.add(new Queen("weiss"));
figuren.add(new Knight("weiss", 1));
figuren.add(new Knight("weiss", 2));
figuren.add(new Bishop("w... |
6d141eaf-e377-4b9c-ba24-7d27d95566c4 | 8 | public void setChecked(int locx, int locy, int setDirec) {
//System.out.println("Set checked called");
switch (setDirec) {
case 0:
traversal[locy][locx] |= 0x10;
if (locy > 0) traversal[locy - 1][locx] |= 0x40;
break;
case 1:
... |
1b716cd8-61d0-4d06-acc7-a41cfce87ee3 | 0 | public void setCostPrice(double costPrice) {
this.costPrice = costPrice;
} |
29d45b58-ec2a-48bc-9dd0-3a8e81565c6d | 7 | public static int discrete(double[] a) {
double EPSILON = 1E-14;
double sum = 0.0;
for (int i = 0; i < a.length; i++) {
if (a[i] < 0.0) throw new IllegalArgumentException("array entry " + i + " is negative: " + a[i]);
sum = sum + a[i];
}
if (sum > 1.0 + EP... |
59b7a670-c0ee-4de9-aee4-d9b03f09909c | 8 | public FontRenderer(GameSettings var1, String var2, TextureManager var3) {
this.settings = var1;
BufferedImage var14;
try {
var14 = ImageIO.read(TextureManager.class.getResourceAsStream(var2));
} catch (IOException var13) {
throw new RuntimeException(var13);
}
int... |
4f1db7c9-8311-4d0b-9590-d08176a99840 | 9 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
NanoPost np;
byte[] parentHash = EncryptionProvider.EMPTY_HASH_SHA256;
String parentHashStr = edParentHash.getText();
if (!parentHashStr.trim().isEmpty()) {
if ((p... |
d5d7a3c2-9fc6-4bb3-a265-79731d3e4f93 | 4 | public static void loadPrefsFile(CommandParser parser, String filename) {
try {
BufferedReader buffer = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
String line = buffer.readLine();
while (line != null) {
try {
parser.parse(line, true, true);
} catch (UnknownCommand... |
6ff9991b-e616-4d5e-a190-3e8351a0c43a | 6 | public void buttonInsertClicked (int xKoordinate, int yKoordinate, String objektName, JComboBox removeBox) {
if (objektName == "Turtle") {
Turtle turtle = new Turtle(xKoordinate, yKoordinate, getNumberOfObjekt(objektName) + " " + objektName, ocean);
removeBox.addItem(getNumberOfObjekt(objektName) + " " + objekt... |
aa1c5398-3989-4499-b975-52142f6a8ef1 | 8 | protected Object instanceToArray(Instance instance) throws Exception {
int index;
int count;
int i;
Object result;
// determine number of non-zero attributes
count = 0;
for (i = 0; i < instance.numValues(); i++) {
if (instance.index(i) == instance.classIndex())
c... |
5595086d-115a-4ead-a4fc-7b0f83b7f89f | 2 | public String[] getGroupNames(){
if(!this.dataEntered)throw new IllegalArgumentException("no data has been entered");
String[] ret = new String[this.nGroups];
for(int i=0; i<this.nGroups; i++)ret[i] = this.groupNames[i];
return ret;
} |
cd19c71e-2aaa-4eda-b352-ab2824d80f74 | 8 | public void declare(JFormatter f) {
if (jdoc != null)
f.nl().g(jdoc);
if (annotations != null){
for (JAnnotationUse annotation : annotations)
f.g(annotation).nl();
}
f.g(mods).p(classType.declarationToken).id(name).d(generifiable);
if (s... |
d052f6e3-1ca1-4fd2-815b-858d05bff75b | 8 | public Image idleImages(int i)
{
Image temp = null;
switch(i)
{
case 1:
temp = new ImageIcon("src/images/idle_north.png").getImage();
break;
case 2:
temp = new ImageIcon("src/images/idle_north_east.png").getImage();
break;
case 3:
... |
caac59b1-8a08-4e75-96f6-59d4932fbe53 | 3 | @Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
diceNum = buf.readShort();
if (diceNum < 0)
throw new RuntimeException("Forbidden value on diceNum = " + diceNum + ", it doesn't respect the following condition : diceNum < 0");
diceSide = buf.readSho... |
258159f3-a70e-401e-957b-b3f4a362f171 | 0 | public RandomIntTest() {
} |
ab7101a4-d242-4a3e-8435-fabe1820fa29 | 5 | private void createEvents() {
btnUploadSong.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
UploadSongFrame frame = new UploadSongFrame(
indexPanel, controller);
frame.setV... |
afd0d300-24be-48ed-8478-996b8ae04992 | 4 | public boolean erTegen(double nx, double ny){
if (nx <= getX()+getWidth() && nx >= getX()
&& ny <= getY()+getHeight() && ny >= getY()){
return true;
}
return false;
} |
d9e3f3cc-3520-4fc7-9182-7dde65e93404 | 4 | private MulticastSocket openUDPBroadcastSocket(
NetworkInterface pNetworkInterface)
{
MulticastSocket socket;
try{
if (!simulateNotchers) {
socket = new MulticastSocket(4445);
if (pNetworkInterface != null) {
try{
... |
625e52d9-909c-44fe-a363-b0a759e0856b | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Block block = (Block) o;
if (initialMoves != block.initialMoves) return false;
if (remainingMoves != block.remainingMoves) return false;
... |
02b47c08-9ec5-4187-833b-964108d959e7 | 3 | public VDKInnerDirectory findChild(int offset) {
for(VDKInnerDirectory d : children) {
if(!(d instanceof VDKInnerFile)) {
if(d.getDotDirectory().getOffset() == offset)
return d;
return d.findChild(offset);
}
}
//TODO - Herestt: Throw exception.
return null;
} |
4fec2528-17de-4e1e-b320-3285c09c09b3 | 5 | protected static String getSorting(Class<?> cls) {
String r = "";
for (Field f : cls.getFields()) {
if (f.isAnnotationPresent(SortBy.class))
r += (r.length() == 0 ? "" : " ,") + f.getName()
+ (f.getAnnotation(SortBy.class).reverse() ? " DESC" : " ASC")... |
1c36600e-eb97-4163-8c6b-be60bb1ff24b | 6 | private void actualizarListaProd() {
abrirBase();
tablaProd.setRowCount(0);
prodlista = Articulo.where("codigo like ? or descripcion like ?", "%" + textcodprod.getText() + "%", "%" + textcodprod.getText() + "%");
Iterator<Articulo> it = prodlista.iterator();
while (it.hasNext()) ... |
2766e785-dbbe-4ecf-bd53-acf25ddf1c6c | 9 | private void displayCreature(Creature currCreature) {
String url = "http://bulbapedia.bulbagarden.net/wiki/"
+ currCreature.getName();
System.out.printf("%s \n[%s]\n", currCreature, url);
for (Ability a : currCreature.getAbilities()) {
if (a == null) {
System.out.println("NULL ABILITY");
System.ex... |
6f124231-45db-441b-bf3e-8191a7276f79 | 5 | public String[] pickValues(int[] thrown) {
Player player = GameEngine.activePlayer;
myBet = thrown[2];
player.addRolls(thrown);
thrownSum = thrown[0]+thrown[1];
ArrayList<String> list = new ArrayList<String>();
for (int i = 1; i <= 6 ; i++) {
for (int j = 1; ... |
39c2aea1-1e06-4b01-b99e-ef206876ef03 | 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... |
35572e7c-f540-44b3-bd7c-d3ebf1632c4d | 4 | private ReflectiveTypeAdapterFactory.BoundField createBoundField(
final Gson context, final Field field, final String name,
final TypeToken<?> fieldType, boolean serialize, boolean deserialize) {
final boolean isPrimitive = Primitives.isPrimitive(fieldType.getRawType());
// special casing primitives... |
e50a8131-d701-4ace-a733-6fabf0fbfc87 | 0 | private int indexCycle(int index, int delta) {
int size = m_Components.length;
int next = (index + delta + size) % size;
return next;
} |
a106eaf4-d1ee-4965-bd58-7af7215e1a2f | 1 | public CtConstructor makeClassInitializer()
throws CannotCompileException
{
CtConstructor clinit = getClassInitializer();
if (clinit != null)
return clinit;
checkModify();
ClassFile cf = getClassFile2();
Bytecode code = new Bytecode(cf.getConstPool(), 0, ... |
ec2eb3d9-1b5f-462c-b36b-c65dc9601bfd | 5 | public void draw(Graphics g) {
if (inMenu()) {
mainMenu.draw(g);
} else {
currentDemo.draw(g);
if (currentDemo != null && !currentDemo.running()) {
g.setColor(new Color(0, 0, 0, 200));
g.fillRect(0, 0, width, height);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.