method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8c278219-20a8-46a8-9254-808a66398a81 | 1 | public boolean solveQuestion(int answer){
if(checklist.get(currentQuestion).getAnswer() == answer){
checklist.remove(currentQuestion);
answeredQuestions++;
return true;
}
return false;
} |
cafb59f7-da3c-469a-b62e-7ce6176188bd | 0 | public Screen getCurrentScreen() {
return currentScreen;
} |
94721edd-8322-40bd-8ee8-a69add81ab62 | 0 | public Decorator(Component component)
{
this.component = component;
} |
56237b8d-466f-492a-9ff4-58f7124f7ee2 | 2 | public void calculateDeltaFunctionValuesForHiddenNeuron() {
if (this.neuronType != ENeuronType.Hidden)
throw new UnsupportedOperationException(
"This function is only for the use with Hidden-Neurons! This is a "
+ this.neuronType.toString());
for (Axon ax : this.incomingDendrites) {
ax.getSource()... |
555b0d65-ef96-4b05-9e8d-0e7cec0eca0a | 2 | public Object get(String key) throws JSONException {
if (key == null) {
throw new JSONException("Null key.");
}
Object object = this.opt(key);
if (object == null) {
throw new JSONException("JSONObject[" + quote(key) + "] not found.");
}
return obje... |
a01af9c4-cd27-489e-97e1-a92569ba4b66 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TestComponent other = (TestComponent) obj;
if (str == null) {
if (other.str != null)
return false;
} else if (!str.equals(other.str))
... |
547964a0-03a4-4a1a-8981-69f44b26949d | 7 | public static boolean validateHandshake(byte[] recieved_handshake, byte[] sent_handshake, byte[] peer_id){
//Print out the Sent Handshake
/* System.out.println("Print out the return handshake\n");
for(int i=0; i<sent_handshake.length;i++){
System.out.print(sent_handshake[i] + " ");
if(i==19||i==27||i==47)
... |
56d34c24-fdc8-409d-8b69-a4a3bcc1c366 | 4 | private void createNumberUpCombo(PrintRequestAttributeSet set) {
NumberUp[] numUp = (NumberUp[]) mService.getSupportedAttributeValues(NumberUp.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
if (numUp != null && numUp.length > 0) {
NumberUp current = PrintUtilities.getNumberUp(mService, set);
WrappedNumb... |
7f22d8dc-e3e8-4d22-85f8-c2087327df8c | 3 | public Blab getBlab(int id)
{
Connection connection = null;
Blab blab = new Blab();
String query = null;
PreparedStatement statement = null;
try
{
connection = dataSource.getConnection();
query = "SELECT blabs.content, blabs.email, users.username, blabs.timestamp FROM blabs INNER JOIN users... |
2ac5b441-354a-4773-a92b-43f5f6a123af | 3 | CPGreyBmp makeCheckerBoardTexture(int size) {
int textureSize = 2*size;
CPGreyBmp texture = new CPGreyBmp(textureSize, textureSize);
for (int i = 0; i < textureSize; i++) {
for (int j = 0; j < textureSize; j++) {
texture.data[i + j * textureSize] = (((i / size) + (j / size)) % 2 == 0) ? (byte) 0 : (byte) 2... |
6faed638-665e-4c0d-bbff-c5292825a469 | 2 | private ArrayList<Tilausrivi> poistaTuote(ArrayList<Tilausrivi> tilausrivit, String action)
throws IOException {
// otetaan tuotteen id irti valuesta
int tilausriviNumero = Integer.parseInt(action.substring(7));
// etsitään tuoteId:tä vastaava tuote tilausrivit listasta
for (int i = 0; i < tilausriv... |
1c6f0a76-b8a7-4193-9050-5154094ff0ca | 9 | public ColonyTile getVacantColonyTileFor(Unit unit, boolean allowClaim,
GoodsType... goodsTypes) {
ColonyTile best = null;
int bestProd = 0;
for (ColonyTile colonyTile : colonyTiles) {
Tile workTile = colonyTile.getWorkTile();
... |
174b6dbd-7835-405d-9980-aa4fac6c4660 | 4 | public CholeskyDecomposition (Matrix Arg) {
// Initialize.
double[][] A = Arg.getArray();
n = Arg.getRowDimension();
L = new double[n][n];
isspd = (Arg.getColumnDimension() == n);
// Main loop.
for (int j = 0; j < n; j++) {
double[] Lrowj = L[j];
double d = 0... |
ad395ccf-28d9-462f-b394-62798e0af84b | 4 | public boolean estCleValable(String k) {
int i=0;
boolean trouve=false;
while(i<k.length() && !trouve) {
if(!ALPHABET.contains(""+k.charAt(i))&&!ALPHABET.toUpperCase().contains(""+k.charAt(i))) {
trouve=true;
JOptionPane.showMessageDialog(null, "Veuillez saisir une cl constitue uniquement d'une suite d... |
119cfa16-c588-4700-acc6-208535b700f5 | 0 | @Override
public int getRowCount() {
return keys.size();
} |
55dd8653-0f17-4f84-a782-535992b537f0 | 0 | public void setPassword(String password) {
this.password = password;
} |
905b167b-d402-427b-970b-2c3bfaf2f53c | 3 | public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
String strng1=request.getParameter("stdid");
String strng2=request.getParameter("password");
Connection con;
Statement stm;
... |
855fac68-250b-4bc0-b50a-8cd3c2d9d933 | 3 | private Set<Particle> getSingleChunck(Particle current) {
Set<Particle> impacting = new HashSet<Particle>();
impacting.add(current);
while (true) {
Set<Particle> tmp = new HashSet<Particle>();
for (Particle pi : impacting) {
tmp.addAll(pi.impacting);
}
boolean changed = impacting.addAll(tmp);
i... |
e0eb64a5-52ae-46b8-8acc-7f884b8679ca | 2 | public void set(K key, V value) {
if(!super.containsKey(key)){
if(count == capacity){
--count;
K keyDel = super.keySet().iterator().next();
super.remove(keyDel);
}
super.put(key, value);
++count;
}else{
... |
26e312eb-f39e-4793-b48d-e2b5453787ed | 8 | public static List<String> breadthFirstSearch(Graph graph, String startName, String goalName)
{
if(!graph.getVertices().containsKey(startName) || !graph.getVertices().containsKey(goalName))
throw new UnsupportedOperationException();
//CLEAR GRAPH
for(Vertex v : graph.getVertices().values()){
v.setCame... |
4895f55d-5104-4c6a-909b-2e97e2606f59 | 6 | @Override
public void loop() {
switch (step) {
case 0:
if(Motors.m1.isMoving()&&Motors.m2.isMoving()){
if(Motors.tsf.isPressed()){
Motors.m1.backward();
Motors.m2.backward();
reset();
step++;
}
}
else{
Motors.m1.forward();
Motors.m2.forward();
}
break;
case 1:
... |
d27a3f6b-9a03-42de-aaa2-2217b95332c4 | 4 | private List<String> parseClassPath (final String classPath) {
StringTokenizer tokenizer = new StringTokenizer(classPath,":");
List<String> patternList = new ArrayList<String>(tokenizer.countTokens());
while(tokenizer.hasMoreElements()) {
String token = tokenizer.nextToken();
... |
0db59a38-d0b8-4e81-98aa-8d8c5f986929 | 2 | public static boolean isVariableInProduction(String variable,
Production production) {
String[] variables = production.getVariables();
for (int k = 0; k < variables.length; k++) {
if (variables[k].equals(variable))
return true;
}
return false;
} |
bdd2fb82-7fa1-4c8d-a61f-51b6282c9263 | 9 | public void update(){
if(Keyboard.isKeyDown(Keyboard.KEY_F11)){
try {
Display.setVSyncEnabled(!Display.isFullscreen());
Display.setFullscreen(!Display.isFullscreen());
} catch (LWJGLException e) {
e.printStackTrace();
}
}
switch (state) {
case INTRO:
Intro.update();
break;
case ... |
ac1de26e-e567-40d6-97c9-18c825e4373a | 8 | private void calculateDxDy() {
int rDx = 0;
int rDy = 0;
while ((rDx == rDy) && (rDx == 0)) {
rDx = random.nextInt(3);
rDy = random.nextInt(3);
}
switch (rDx) {
case 0:
dx = 0;
break;
case 1:
... |
d9d4f0f7-c8bb-4b77-81d4-4cb1ad7395eb | 6 | public void wdgmsg(Widget sender, String msg, Object... args) {
if (sender == obtn) {
if (msg == "activate")
wdgmsg("make", 0);
return;
}
if (sender == cbtn) {
if (msg == "activate")
wdgmsg("make", 1);
return;
}
if (sender instanceof Item)
return;
if (sender instanceof Inventory)
r... |
d5df7857-88ea-416a-8492-d2d4143469a1 | 8 | private String getBaseFileName () {
String strLevel = null;
String strName = null;
String strPubDate = null;
StringTokenizer st = new StringTokenizer(url.getQuery(), "&");
while (st.hasMoreElements()) {
String[] sa = st.nextToken().split("=");
if ... |
44187b96-7fba-4ae0-a610-3b28ea01ccb3 | 5 | public void DeleteElement(int value) {
if (firstElement == null) {
System.out.print("List is empty; \n");
} else {
if (firstElement.value == value) {
if (firstElement.next != null) {
firstElement = firstElement.next;
} else {
... |
ff2cfc7e-fb50-43fa-90e6-556636a6dc4a | 8 | public static void qsHelpChange( int lo, int hi, LinkedList<Stock> d ) {
if ( lo >= hi )
return;
int tmpLo = lo;
int tmpHi = hi;
double pivot = d.get(lo).getPercentChange();
Stock pivotStock = d.get(lo);
while( tmpLo < tmpHi ) {
//first, slide markers in as far as possible without swaps
while( d... |
8e73c936-de63-4cee-a508-398dcd83f85d | 6 | public TwoWaySerialComm(String[] args, IOMonitor angle, IOMonitor pos,
IOMonitor signal, String serialPort, int baudRate, int bufferSize) {
this.monitor = signal;
for (int i = 0; i < args.length; i++) {
switch (i) {
case 0:
try {
baudRate = Integer.parseInt(args[0]);
System.out.println("[ARG... |
3a29824a-d860-439c-8004-b641c8444ede | 5 | protected void printTopKChild4Stn(String filePrefix, int topK) {
String topKChild4StnFile = filePrefix + "topChild4Stn.txt";
try {
PrintWriter pw = new PrintWriter(new File(topKChild4StnFile));
for (_Doc d : m_trainSet) {
if (d instanceof _ParentDoc4DCM) {
_ParentDoc4DCM pDoc = (_ParentDoc4DCM) d;
... |
d401e4d0-3fe4-438b-a486-f9df53917d45 | 8 | public Image get4BitImage(Image im)
{
int width = im.getWidth(main_frame);
int height = im.getHeight(main_frame);
//////////////////////////////////////////
/////////// Creating the palette /////////
//////////////////////////////////////////
int color_palette[] = ... |
7f858a4a-9039-4ed9-b160-6376b5b374ac | 5 | public void genMSTFast() {
final long startTime = System.currentTimeMillis();
long totalTime = 0;
long tempTime = 0;
System.out.println("Connecting "+nodes.size()+" nodes optimally");
// Generate edges for Graph
if (getCombos()) {
System.out.println("Using all edge combinations...");
... |
2ec9ddd1-8692-4c72-87d1-24b59214a974 | 0 | public void siirra(int dx, int dy) {
this.x += dx;
this.y += dy;
} |
1a1aeb40-305e-4c66-aa07-1b401e030977 | 1 | static void testApproaches(PairManager pman1, PairManager pman2) {
ExecutorService exec = Executors.newCachedThreadPool();
PairManipulator
pm1 = new PairManipulator(pman1),
pm2 = new PairManipulator(pman2);
PairChecker
pcheck1 = new PairChecker(pma... |
dcd1bdd2-563e-4667-8a96-1dd75a05dcfc | 1 | public List<Command> getInheritedCommands()
{
List<Command> list = new ArrayList<>();
if(parent != null)
{
list.addAll(parent.ungroupedCommands.getAllItems());
list.addAll(parent.getInheritedCommands());
}
return list;
} |
f9b588c9-2bee-45ad-8af5-5dcdfa5f2735 | 1 | @Override
public boolean buy() {
if(researched) {
return false;
}
Application.get().getEventManager().queueEvent(event);
researched = true;
return true;
} |
fda67834-c7ca-4987-bb8d-0b7d006aa3d5 | 1 | public String fetchString() throws InputMismatchException {
if(!hasStringArg())
throw new InputMismatchException("There are no string arguments to fetch from.");
else {
String s = pop();
return s.substring(1, s.length() - 1);
}
} |
a9ae48d7-477a-48d2-83e9-e09be8875dc2 | 1 | public static void copyText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) {
String text = textArea.getSelectedText();
if (text != null) {
java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(text), null);
}
} |
7485d7c6-3ccf-4ccc-b4f5-679c07a65ff8 | 6 | private static boolean isValidMove(int x, int y, int[][] board, int number) {
//check if the row or column contains the same number
for( int i=0; i< n; i++) {
if(board[x][i] == number || board[i][y] ==number) {
return false;
}
}
// we want to find... |
e493d7c2-005a-4e57-b714-778c68f08bfe | 5 | public void insertarAntesDeX(T dato, T x){
Nodo<T> q = this.p;
Nodo<T> t = null;
boolean bandera = true;
while(q.getValor() != x && bandera){
if(q.getLiga() != null){
t = q;
q = q.getLiga();
}else{
bandera = false;
}
}
if(bandera){
Nodo<T> nuevo = new Nodo<T>();
nuevo.setVa... |
74f103ef-2d89-48d9-81cf-a7ccbef1eea8 | 2 | public static boolean email(String email){
if(email.matches("(\\w)+(\\.(\\w)+)*@(\\w)+(\\.(\\w)+)*\\.[a-z]{3}")&&email.length()<100)
return true;
return false;
} |
ace35ca7-d9e5-4ec3-8eae-fa715eb524da | 2 | public void join() {
while(alive()) {
try {
me.join();
} catch(InterruptedException e) {
tg.interrupt();
}
}
} |
04c97081-fd16-4af5-8dbf-95bc62b300b5 | 6 | public static void main(String[] args) throws Exception
{
BufferedReader reader=
new BufferedReader( new FileReader(
new File("G:\\RawBurkholderiaSequences\\sequences\\temp.txt")));
BufferedWriter writer= new BufferedWriter(new FileWriter(new File(
"G:\\RawBurkholderiaSequences\\sequences\\tempFas... |
ac7ed657-1914-4b12-9eff-ee12509a0102 | 1 | public String getSimpleCode(){
String str = element.getSimpleCode();
if(program != null)
str += program.getSimpleCode();
return str;
} |
82389595-c519-483e-8890-b303f7bcc4a6 | 9 | public static void Mods() throws IOException {
byte[] dat = new byte[4096];
@SuppressWarnings("resource")
JarFile jar = new JarFile(workingDir + "mods.jar");
Enumeration<?> entries = jar.entries();
while (entries.hasMoreElements()) {
JarEntry entry = (JarEntry) entries.nextElement();
String name = entr... |
35a3c1e3-2032-4674-ac65-d50acfe10959 | 5 | public void replace(String statement) throws CannotCompileException {
thisClass.getClassFile(); // to call checkModify().
final int bytecodeSize = 3;
int pos = newPos;
int newIndex = iterator.u16bitAt(pos + 1);
/* delete the preceding NEW and DUP (or DUP_X1, SWAP) instructio... |
558ed20d-6ff8-4d04-9f4b-4be34bf3521e | 0 | @Test
public void resolve() {
int begin = 1;
int end = 999;
int result = calc(begin, end, 3) + calc(begin, end, 5) - calc(begin, end, 15);
print(result);
} |
00dca644-7a08-4b0a-a382-17d58180ef2c | 6 | public static void main(String[] args) {
String bss[] = {"E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
int ends[] = {32, 67, 109, 111, 13, 37, 69, 87, 180, 37, 26, 109, 4, 91, 164, 61, 8, 43, 69, 1, 8, 17};
for(int m = 0; m < ends.length... |
1d87ab78-f572-4b5f-ae8a-917882c53dc9 | 8 | public void IG(HashMap<String, _stat> featureStat, int[] classMemberNo){
m_selectedFeatures.clear();
double classMemberSum = Utils.sumOfArray(classMemberNo);
double[] PrCi = new double [classMemberNo.length];//I
double[] PrCit = new double [classMemberNo.length];//II
double[] PrCitNot = new double [classMembe... |
63a3f92b-25c9-4140-97dd-bd2a06b1ada6 | 0 | public BuilderController(FiniteStateAutomaton dfa,
FiniteStateAutomaton minDfa, SelectionDrawer drawer,
Minimizer minimizer, DefaultTreeModel tree, Component view) {
this.dfa = dfa;
this.minDfa = minDfa;
this.drawer = drawer;
this.minimizer = minimizer;
this.tree = tree;
this.view = view;
determine... |
c12575c7-829d-4084-a2d5-2faa52407142 | 6 | public Complex Newt(Complex z, double i, double j, int mode) {
if (mode == 1) {
return z.sub(UnityFunction(z, i, j).div(UnityDerivative(z, i, j)));
} else if (mode == 2) {
return z.sub(Poly2Function(z, i, j).div(Poly2Derivative(z, i, j)));
} else if (mode == 3) {
return z.sub(DivZFunction(z, i, j).div(Di... |
1d0a90b8-55ea-4b10-bd3e-c5d051294020 | 2 | public static void call(final String mapping, final String data) throws Exception {
String[] colNames = null;
BuffReaderFixedParser pzparse = null;
try {
pzparse = (BuffReaderFixedParser) BuffReaderParseFactory.getInstance().newFixedLengthParser(new File(mapping), new File(data));
... |
2b2be674-cd17-40f1-aeca-1575ee1499c0 | 0 | public FileProtocol getProtocol() {
return this.protocol;
} |
61982c76-1fbf-4154-87a3-21817038fdcc | 3 | static public void codeFile(String src)
{
byte[] fileBytes;
try {
fileBytes = read(new File(src));
for(int n=0;n<fileBytes.length;n++)
{
fileBytes[n]+=key;
}
write(src, fileBytes);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOEx... |
25a18f1a-725e-46ce-bdbc-ac03dbcf5bd5 | 2 | protected void setUp() throws Exception {
super.setUp();
deckOfAllLands = new String[60];
passiveCreatures = new String[60];
removalHeavy = new String[60];
activeCreatures = new String[60];
game = new GameState(2);
decks = new ArrayList<String[]>();
for (int i = 0; i < 60; i++) {
deckOfAllLands[i] =... |
74cccbe4-c3bc-4d4c-9b2b-d9677552f41c | 1 | @Override
public void start() {
bg1 = new Background(0, 0);
bg2 = new Background(2160, 0);
robot = new Robot();
// Initialize Tiles
try {
loadMap("/data/map1.txt");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
hb = new Heliboy(340, 360);
hb2 = new Heli... |
e747e5b2-ae24-4358-85e4-8328084caf78 | 1 | public void display() {
System.out.println("Welcome to the book:" + courseName);
Scanner s = new Scanner(System.in);
while (counter < 2) {
grade = s.nextInt();
total = total + grade;
counter++;
determinecounter(grade);
}
System.out.println(" Total:" + total);
} |
2a1cd2a8-0488-43e8-b2a0-ea76b5f77ce7 | 9 | private void btn_aceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_aceptarActionPerformed
if (lab_modo.getText().equals("Alta")){
if (camposCompletos()){
ocultar_Msj();
insertar();
menuDisponible(true);
... |
f2c7bf22-04a3-408e-8127-3beae0ad7cc3 | 5 | public void ScanDIR(String in,VraReader b)
{
long l=0x80000000L;
long E1=0,E2=0;
int BASE=(int)DataDir[4];
int POS=0;
String[] fix=new String[2];
fix[0]=in.substring(0,in.indexOf("$"));
fix[1]=in.substring((in.indexOf("$")+1),in.length());
in=fix[0];
POS=Integer.parseInt(fix[1],10);
fix=null;
System.out.println("Sca... |
e7d70d84-4ad0-4f18-a26b-db8decae7ac9 | 1 | @Test
public void findBillByDateTest() throws InstanceNotFoundException{
Household hh = null;
try {
hh = familyService.findHousehold(0);
} catch (InstanceNotFoundException e) {
fail("Household not found");
}
billService.createBill(hh);
Calendar date = Calendar.getInstance();
date.add(Calendar.MO... |
12601ac9-fd5b-42fe-b643-78a2cd384adc | 0 | public Solver(GUI gui) {
this.gui = gui;
} |
c2fe8a1f-18aa-4c04-98ab-03cb4d48a67a | 1 | @Override
public String format(Date fromObject) {
try{
return forFormatting.format(fromObject);
}
catch(Exception e){
}
return null;
} |
4962830f-6e5e-4b92-8338-15d4e6d8c266 | 8 | @Override
public void ParseIn(Connection Main, Server Environment)
{
Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom);
if (Room == null)
{
return;
}
RoomItem Item = Room.GetItem(Main.DecodeInt());
if (Item == null)
{
... |
a5741475-c228-46eb-bbc7-4739dd7b92ad | 5 | public void startFullnessSchedule(final int decrease, final MaplePet pet, int petSlot) {
ScheduledFuture<?> schedule = TimerManager.getInstance().register(new Runnable() {
@Override
public void run() {
int newFullness = pet.getFullness() - decrease;
if (n... |
5b4a5f9b-085b-4f13-bb5f-43b137a2279b | 0 | @Test
public void test_get_file()
{
Assert.assertTrue(getFile("b_remote_host").getAbsolutePath().startsWith(working_directory.getAbsolutePath()));
} |
de1cdb80-ed0b-4868-a5fd-a8b3cb99f068 | 0 | public void dispose() {
this.dispose();
} |
6a09e2f6-22f0-445d-87aa-75c432248187 | 6 | @Override
public void enregistrer() {
// int compsSize = m_tblComps.size();
String compstr = "";
Iterator iter = m_tblComps.keySet().iterator();
while (iter.hasNext()) {
Competence key = (Competence) iter.next();
compstr += key.getNomComp() + Constant.m_c... |
ac92cbdd-659a-4286-9d5a-58b2d57771b9 | 1 | public static boolean isPrimitiveWrapper(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");
return primitiveWrapperTypeMap.containsKey(clazz);
} |
4cfb59a7-63f9-4c4d-bc9e-5a42a09cae5c | 9 | public void createRatingBox()
{
removeAllratingPanelObjects();
int offset = 75;
for (int x = 0; x < 3; x++)
{
ButtonGroup toughGroup = null;
JLabel newLabel = null;
switch (x)
{
case 0:
toughGroup = tough;
newLabel = new JLabel("Toughness");
newLabel.setBounds(10, 10 + offset + 40*x,... |
0e4e199b-40a8-4ebb-96b5-bac4b3de7e51 | 9 | final void setCenter(int iModel) {
Point3f center = new Point3f(0, 0, 0);
int iptlast = -1;
int ipt = 0;
int n = 0;
for (int i = polygonCount; --i >= 0;) {
if (iModel >= 0 && i != iModel)
continue;
iptlast = -1;
for (int iV = polygonIndexes[i].length; --iV >= 0;) {
ipt = polygonIndexes[i][iV]... |
65f18976-86b0-493e-b0dd-ad17e14aeddf | 6 | public History() {
fileHandle = new File(path);
if(!fileHandle.exists()) {
try {
fileHandle.createNewFile();
} catch (IOException e) {
e.printStackTrace();
System.exit(0);
}
}
if(!fileHandle.canRead() || !fileHandle.canWrite()) {
System.err.println("Can't read/write history.da... |
03b65fc9-5b79-4007-a977-b07d320a63b5 | 4 | @Override
public void keyReleased(int key, char c) {
switch(key) {
case Input.KEY_UP:
player.stopMoving(Direction.NORTH);
break;
case Input.KEY_DOWN:
player.stopMoving(Direction.SOUTH);
break;
case Input.KEY_LEFT:
player.stopMoving(Direction.WEST);
break;
case Input.KEY_RIGHT:
player.sto... |
f92779c7-be80-440a-8357-2bbb0c3ba2a6 | 6 | public static void sortNanoPostsOpsByTimestamp(ArrayList<NanoPost> nanoposts) {
ArrayList<NanoPost> nonOps = new ArrayList<>();
// Remove from main list all non-ops and save removed non-ops in other list
for (Iterator<NanoPost> i = nanoposts.listIterator(); i.hasNext();) {
NanoPost ... |
b89f7200-1bc1-44dd-9828-72566f01d0bb | 6 | @Override
public void run(){
int ID = cluster.getID() + 0;
try{
String msg = "";
setThreadName("Msg4"+cluster.getID());
while(alive){
try{
while((msg = getClient().getReader().readLine())!= null){
//getParser().parse(msg);
try{
Bukkit.getServer().getPluginManager().callEvent(ne... |
ea8b2870-4bb8-4d41-adf6-1c3db9af3579 | 0 | @Override
public void setCallObjectId(long id) {
callObjectId = id;
} |
f17ecec8-d651-4fcf-8472-353beb6670d8 | 1 | public static Bitmap loadBitmap(String fileName) throws RuntimeException
{
try
{
//BufferedImage image = ImageIO.read(ResourceLoader.class.getResource("/res/bitmaps/" + fileName));
BufferedImage image = ImageIO.read(new File("./res/bitmaps/" + fileName));
int width = image.getWidth();
int height = imag... |
6fae5bce-3e7f-44a6-985b-6d2a12d5825b | 7 | public final LogReader getLogReader()
{
return new LogReader()
{
BufferedReader reader = null;
@Override
public String nextLine()
{
if(reader==null)
{
try
{
final FileReader F=new FileReader(logName+".log");
reader = new BufferedReader(F);
}
catch(final Exception... |
b1560c4a-91dc-4191-8c90-cbc89c7e4672 | 8 | @SuppressWarnings({ "unchecked", "rawtypes" })
public static void editAssessmentComponentWeightage(){ // edit weightage of components
System.out.println("Choose Course to Update Assessment Component Weightage :");
Course tempCourse = (Course)chooseChoosable((ArrayList)courseList);
System.out.printf("Exam total a... |
89a56195-b183-4df1-8005-43368e099161 | 9 | protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, ContractLineItem__typeInf... |
85c214b7-ccf9-43a5-97ce-33345952a1b4 | 1 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((listeners == null) ? 0 : listeners.hashCode());
result = prime * result + money;
return result;
} |
5f8e5fde-0787-4777-b7c2-5a0dd81a3272 | 4 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int a[] = new int[n];
int diff[]=new int[n];
int sum=0;
HashMap<Integer,Integer> map=new HashMap<Integer,Integer>(n);
for(int... |
8a2493a0-2d03-45ae-8236-021bdb43a40d | 3 | private static String urlPair(Object name, Object val, boolean urlEncode) {
if (val != null) {
return name
+ "="
+ ((urlEncode && val instanceof String) ? UrlUtil.urlEncode(val
.toString()) : val);
} else {
return null;
}
} |
d7d07f00-cdb8-49c3-b87a-1ac34ada1b18 | 3 | private void parseDir() {
for (File file : dir.listFiles()) {
if (file.isDirectory()) {
DirManager manager = new DirManager(file, this);
manager.parseDir();
subDirs.add(manager);
} else {
FileHandler handler = FileHandler.getHandler(file);
if (handler != null) {
handler.parseFile(file, ... |
74781eb9-2727-40a0-8a6f-220bfd0df537 | 4 | public void fill(int i, int x, int y) {
int orig = texture.getRGB(x, y);
if(x < texture.getWidth() && y < texture.getHeight() && x >= 0 && y >= 0) {
this.spread(i, orig, x, y);
}
this.repaint();
} |
d76693bb-f1ae-4315-aaaa-97370aee6f44 | 9 | public JFreeChart MakeChart() {
Object[] column1Data = super.getDataset().GetColumnData(
super.getAttribute1());
Object[] column2Data = super.getDataset().GetColumnData(
super.getAttribute2());
boolean addDataset = true;
String errors = "";
int errorCounter = 0;
DefaultCategoryDataset ... |
3eb41b9d-fd15-41a8-ae60-87d21f5592e0 | 7 | private void rasterise(int i) {
if (aBooleanArray1664[i]) {
method485(i);
return;
}
int x = triangleX[i];
int y = triangleY[i];
int z = triangleZ[i];
Rasterizer.restrictEdges = restrictEdges[i];
if (triangleAlpha == null)
Rasterizer.alpha = 0;
else
Rasterizer.alpha = triangleAlpha[i];
int ... |
80b005f4-7266-4e34-afb3-a84251095209 | 1 | public void uimsg(String msg, Object... args) {
if(msg == "set")
settext((String)args[0]);
} |
5db1fb51-d7a2-46e3-b226-3db500320fbf | 3 | Collection<CollectionAndArtist> extractNames(PageInfo page) {
Set<CollectionAndArtist> names = new TreeSet<CollectionAndArtist>();
// Vereinigung aller gefundenen Namen bilden
for (NameExtractor ne : Extractors.getInstance().getNameExtractors()) {
if (!ne.isSelected() || !ne.isAppli... |
b4faf9d9-a772-4b60-856b-cb3f1ee3da02 | 4 | @Override
public void mouseClicked(MouseEvent e) {
int x = e.getX();
int y = e.getY();
//TODO -- real coords
if( (x >= 845 && x <= 1100) && (y >= 845 && y <= 1000) ){
cl.show(panelContainer, "2");
}
} |
f14fb40b-808a-42f3-8348-ff852a02e8bf | 4 | public void CheckPoint(Double x, Double y)
{
minX = minX < x ? minX : x;
maxX = maxX > x ? maxX : x;
minY = minY < y ? minY : y;
maxY = maxY > y ? maxY : y;
} |
17c2f849-4b51-4b07-af5f-8d4eb0d8e899 | 1 | public static CtConstructor defaultConstructor(CtClass declaring)
throws CannotCompileException
{
CtConstructor cons = new CtConstructor((CtClass[])null, declaring);
ConstPool cp = declaring.getClassFile2().getConstPool();
Bytecode code = new Bytecode(cp, 1, 1);
code.addAloa... |
df129580-3585-4fce-8c6f-7d29621182bb | 4 | public boolean checkAlive(String name){
boolean isalive = false;
// Look through all enemies in a room
for(Enemy e: myEnemies){//split de naam, zodat het werkt op alleen de voornaam
String[] namesplit = e.getName().split(" ");
if (namesplit[0].toLowerCase().equals(name) || e.getName().toLowerCase().equals(n... |
36be7459-a392-416a-b39a-cf1f5ac97205 | 4 | public String createContent() {
StringBuilder HTTPResponse = new StringBuilder();
HTTPResponse.append(" <h2> <p>Number of all requset: " + ServerStatus.getTotalrequest() + " </p> </h2>");
HTTPResponse.append(" <h2> <p>Number of active connections: " + ServerStatus.getActiveConnection() + " </p> ... |
58c263f9-91bf-485f-9be2-2aee07ccb003 | 8 | @Override
public void run() {
super.run();
try {
String s = ConnexionType.BUS.sur_reception_de_init(socket);
if(s.equals("INIT"));
{
ID_LIGNE = server.getIndexLigneFree();
if(ID_LIGNE == 0){ConnexionType.BUS.envoyer_a("REJET", socket);}
else{
server.console("Ligne "+ID_LIGNE +" activé");
... |
22993aef-13c0-4c4d-b1d9-22f5bb35744a | 2 | private final static byte[] getDecodabet( int options ) {
if( (options & URL_SAFE) == URL_SAFE) {
return _URL_SAFE_DECODABET;
} else if ((options & ORDERED) == ORDERED) {
return _ORDERED_DECODABET;
} else {
return _STANDARD_DECODABET;
}
} // end ge... |
ea355090-d411-4b1b-b789-30c9c999e5ef | 0 | @Test
public void test_numberOfPawns(){
when(pawns.size()).thenReturn(2);
System.out.println(pawns.size());
assertEquals(board.numberOfPawns(),2);
verify(pawns).size();
} |
66519e0e-7ca9-498a-8be0-e8d44210185b | 8 | public static void display(Dungeon d) {
EnumArray[][] ara = d.getMap().getArray();
Coordinate partyLoc = d.getPlayer().getLocation();
StringBuilder sb = new StringBuilder();
for (int i = 0; i< ara.length; i++) {
for (int j = 0; j< ara[i].length; j++) {
if (partyLoc.equals(j,... |
92b5fc46-7737-45d8-8354-0e3dcba7c028 | 2 | public String prev() {
if (cmds.size() == 0) {
return null;
}
if (cursor > 0) {
cursor--;
}
return cmds.get(cursor);
} |
aecdfe67-8fe5-4995-aa13-aef6a3c5914c | 5 | public boolean actionHarvest(Actor actor, Actor prey) {
if (type == TYPE_SAMPLE) {
final Item sample = Item.withReference(SAMPLES, prey) ;
actor.gear.addItem(sample) ;
return true ;
}
//
// Determine just how large a chunk you can take out of the prey-
final float
before = p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.