method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a0563d49-e099-4656-97f1-90504b70fc47 | 6 | public void selectMethod(int method){
//the methods to use
if(method==1) new FCFS(r.getRawSequence(),r);
if(method==2) new SSTF(r.getCurrent(),r.getRawSequence(),r);
if(method==3) new Scan(r.getCurrent(),r.getPrevious(),r.getRawSequence(),r);
if(method==4) new CScan(r.getCurrent(),r.getPrevious(),r.getRawSequ... |
bde0acbb-827f-44bb-97dd-2dc16076f4f1 | 0 | public void setLastReceiptTime(long lastReceiptTime) {
this.lastReceiptTime = lastReceiptTime;
} |
881e1f3b-8650-457d-8698-153835d9ab87 | 2 | public static boolean columnExist(CSTable table, String name) {
for (int i = 1; i <= table.getColumnCount(); i++) {
if (table.getColumnName(i).startsWith(name)) {
return true;
}
}
return false;
} |
f846ab42-b509-4394-a619-e24af8c62a97 | 6 | public void takeStep(Graphics2D graphics) {
long now = System.nanoTime();
double delta = this.getLastUpdateTime() > 0 ? (now - this.getLastUpdateTime()) / 1000000000L : 0;
if(delta > 1) {
delta = 0;
}
this.setLastUpdateTime(now);
DeltaState state = this.getEventQueue().takeState(delta);
for(GameCompo... |
3c547c25-c4d1-4830-8659-5112db95f10d | 7 | protected String[] splitIntoLines(String image) {
LinkedList lines = new LinkedList();
int index = 0;
int start = 0;
while (index < image.length()) {
switch (image.charAt(index)) {
case '\r':
lines.add(image.substring(start, index));
if (index + 1 < imag... |
6d32e392-f355-460c-9e26-4492639eb5b0 | 4 | public Transition setOutgoingTransitionInput(Transition t, ArrayList<String> input) throws NoSuchTransitionException, Exception{
if(outgoingTransitions.contains(t)) {
t.setInput(null);
for(String label:input) {
addLabelToOutgoingTransition(t, label);
}
... |
14f6beb2-7e42-481e-80fb-58961ffc92e6 | 6 | private static int countGem(String[] rocks) {
boolean[][] flags = new boolean[rocks.length][26];
for (int i = 0; i < rocks.length; i++) {
String rock = rocks[i];
for (int j = 0; j < rock.length(); j++) {
flags[i][rock.charAt(j) - 'a'] = true... |
15af0b30-40ce-46fb-a7f7-d1616d679c19 | 1 | public int getHeight(){
Window w = vc.getFullScreenWindow();
if(w != null){
return w.getHeight();
}else{
return 0;
}
} |
dfe6d3a3-0377-48ca-9ce7-6aab1362be64 | 9 | public void setTooltipZeroText(String zeroTip)
throws IllegalStateException
{
if ((ttip_text == null) && (zeroTip != null))
throw new IllegalStateException("Must call setTooltipText first");
boolean isZero = (intValue == 0);
ttip_text_zero = zeroTip; // Remember new ze... |
34381117-95f8-4a8d-a03f-81060557df2d | 4 | public boolean setChooseFrame(JFrame newChoose) {
boolean test = false;
if (test || m_test) {
System.out.println("GameSelecter :: setChooseFrame() BEGIN");
}
m_choose = newChoose;
if (test || m_test) {
System.out.println("GameSelecter :: setChooseFrame(... |
b3a06e2d-b562-4675-99a8-a5228125ea46 | 3 | public void runServer()
{
try // set up server to receive connections; process connections
{
server = new ServerSocket( 12345, 100 ); // create ServerSocket
while ( true )
{
try
{
waitForConnection(); // wait for a connection
getStreams(); // get input & output streams
processCon... |
bc8fa8a8-d70b-4df9-9aa5-2a762867a8a0 | 7 | private List<BigInteger> factorize(BigInteger n){
List<BigInteger> factors = new LinkedList<BigInteger>();
BigInteger a = BigInteger.valueOf(2);
Boolean test_n_if_prime=true;
do {
if(n.remainder(a).equals(BigInteger.ZERO)) {factors.add(a); test_n_if_prime=true;}
while(n.remainder(a).equals(BigInteger.ZERO... |
1753a02c-d555-451f-bcb2-0bcdef73b3c2 | 1 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// luodaan tyhjä lista juomille
List<Juoma> juomat = new ArrayList<Juoma>();
// luodaan olio businessluokasta
JuomaService service = new JuomaService();
... |
deb764f2-f717-44b4-b1d1-ef971e06d46a | 2 | @Override
public void actionPerformed(GUIComponent source) {
if (source == yesButton) {
selection = SELECTION_YES;
this.deactivate();
super.actionPerformed();
}
else if (source == noButton) {
selection = SELECTION_NO;
this.deactivat... |
ae3ce6a7-708a-468a-a167-6acab4f64ad9 | 7 | public int recursiveEmitLine(final StringBuilder out, final String in, int start, MarkToken token) {
int pos = start, idx;
final StringBuilder temp = new StringBuilder();
while(pos < in.length()) {
final MarkToken mt = this.getToken(in, pos);
if (token != MarkToken.NONE) ... |
97f8e742-300f-47c9-a47d-dcf9965c30e7 | 9 | public static int[] maxSumIncreasingSubsequence(int[] input, int length){
int[] response = new int[length];
/**
* sum[n][l] is responsible for keeping max sums of
* sum[i][3] means from i = 0 ..i in input[] , maximum sum of a subsequence of 3 length
* till i
*/
... |
7e686d6e-35a6-4685-8bb5-9a352d88d9ed | 6 | public String playSong(Song song) throws MalformedURLException {
if (paused && song.getName().equals(getCurrentSongName())) {
unpause();
return PLAYING;
} else if (!paused && song.getName().equals(getCurrentSongName())) {
pauseSong();
return PAUSED;
... |
99d56f0a-7131-4571-871d-44d0d058eb7a | 0 | public static void main(String[] args)
{
StackList stackList = new StackList();
stackList.put("one!");
stackList.put("two!");
stackList.put("three");
System.out.println(stackList.get());
System.out.println(stackList.get());
System.out.println(stackList.get());
} |
ff57d866-cfb3-4317-8268-a1c2b7b66960 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Physical target=mob.location();
if(target==null)
return false;
if(target.fetchEffect(ID())!=null)
{
mob.tell(L("This place is already a guarded hearth."));
return false;
}
if(... |
37f21e86-690c-46a7-b992-5e4847edcded | 6 | public Node insertNewNode(Node root, int element) {
if (root == null) {
// create new node for element
Node newNode = new Node(element);
return newNode;
}
Node temp = root;
while (temp != null) {
if (temp.data < element) {
if (temp.right == null) {
temp.right = new Node(element);
break... |
2f3aaa4c-ad95-4985-b379-d372f7791c82 | 6 | public static byte[] getSolution()
{
System.out.println("Genjector: Request to bind to project received. Starting...");
// Prepare messenger
Messenger messenger = new Messenger(Settings.COMMUNICATIONS_PORT_PROJECT);
try
{
// Awake Dwayna and wait for her to return a solution
// TODO: Pass on original... |
07612d01-f1e6-4460-84cf-0b5610b4e46c | 6 | @Override
public void paint(Graphics g) {
if (MainChar != null && MainChar.isAlive()) {
g.setColor(Color.red);
g.drawOval(MainChar.getX(), MainChar.getY(), 25, 25);
g.setColor(Color.red);
g.drawRect(0, 370, 100, 20);
g.fillRect(0, 370, MainChar.getHealth(), 20);
g.setColor(Color.yellow);
... |
d95466ea-e108-4e42-8890-96f5843098d1 | 4 | private void paste(){
// Paste from clipboard
Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
try {
if( t!=null && t.isDataFlavorSupported(DataFlavor.stringFlavor) ) {
String txt = (String)t.getTransferData(DataFlavor.stringFlavor)... |
dbdc5152-a779-4482-b505-af77c43b4655 | 1 | @Override
public void Handle(byte[] message, Server server, IOClient player) {
Player p = null;
if (player instanceof Player)
p = (Player)player;
else
return;
ByteBuffer bb = ByteBuffer.allocate(9);
bb.put(message);
short X = bb.getShort(0);
short Y = bb.getShort(2);
short Z = bb.getShort(4);
P... |
bdb3805c-f8fa-49ba-b774-90cfb2a04882 | 3 | private final JSONWriter end(char m, char c) throws JSONException {
if (this.mode != m) {
throw new JSONException(m == 'o' ? "Misplaced endObject." :
"Misplaced endArray.");
}
this.pop(m);
try {
this.writer.write(c);
} catch (IOException e)... |
e9dba096-9ff4-4581-bf04-9dbf42ecf1c5 | 0 | public void setPcaSecuen(Integer pcaSecuen) {
this.pcaSecuen = pcaSecuen;
} |
80149baf-99d0-46e9-8cca-f18076dcecd5 | 3 | @Override
public List<Usuario> ListByNome(String nome) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Usuario> usuarios = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement... |
89f936ef-3007-4caf-988f-c13d2d7a5b87 | 5 | private Arduino()
{
CommPortIdentifier puertoID = null;
Enumeration<?> puertoEnum = CommPortIdentifier.getPortIdentifiers();
while(puertoEnum.hasMoreElements())
{
CommPortIdentifier actualPuertoID = (CommPortIdentifier) puertoEnum.nextElement();
if(PORT.... |
30ef5928-3cf5-4cd0-a753-953e0101c1d3 | 0 | public String getName() {
return name;
} |
c8a316e8-846c-4d52-aafe-d24f985f8442 | 0 | public void update(boolean shade, boolean pressed)
{
this.shade = shade;
this.pressed = pressed;
} |
00e7602a-b60f-40d4-b830-8f8956b84423 | 2 | private List<Tile> getTileCollisions(GameObject object){
List<Tile> collisions = new ArrayList<Tile>();
for (Tile tile : map){
if (overlappingBoundingBox(object,tile)) collisions.add(tile);
}
return collisions;
} |
691801b1-3328-4a5d-a16d-84a7e898d188 | 6 | public void setSolution(Solution solution) {
this.setBackground(new Color(240, 240, 240)); // #f0f0f0
//remove any elements that may be on the panel from a previous solutions
this.removeAll();
//vertical box layout with one column and any number of rows
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXI... |
eeef79e0-6133-4307-ad51-c9a58a93ff24 | 7 | private void DisplayListOfUsers() {
String list;
list = Global.gPendingTable.GetListOfLoggedInUsers();
if (list.length() > 0) {
Global.gUserIO.print("\n" + Global.LINE + "Users now logged in are:- \n\n");
if (list.length() > 1) {
for (int x = 0; x < lis... |
460521ff-368f-4d00-ba35-8c53d64fe01e | 2 | private void upd_reccount()
{
if(isReadOnly()) return;
try { fdbf.seek(4); } catch (IOException e) {}
writeNumber(0,4, reccount );
} |
21cd1794-258d-4095-8d57-2e8abc0c760d | 3 | public void load (Model model, File modelFile) {
try {
Scanner input = new Scanner(modelFile);
while (input.hasNext()) {
Scanner line = new Scanner(input.nextLine());
if (line.hasNext()) {
Command command = myCommands.get(line.next());
... |
a61a9e91-59ea-4190-bc43-416b8033588d | 3 | public Tree multiplicativeExpressionDashPro(Tree firstConditionalExpression){
Tree secondConditionalExpression = null;
Symbol operator = null;
if((operator = accept(Symbol.Id.PUNCTUATORS,"(\\*|/)")) != null){
if((secondConditionalExpression = unaryExpressionPro()) != null){
firstConditionalExpression = n... |
fd0048e3-100d-46bd-a6d8-fad4658fbf2a | 5 | public void setPlayer2HandAtIndex(ImageIcon icon, int index){
switch(index){
case 1:
jlPlayer2Hand1.setIcon(icon);
break;
case 2:
jlPlayer2Hand2.setIcon(icon);
break;
case 3:
jlPlayer2Hand3.setIcon(icon);
break;
case 4:
jlPlayer2Hand4.setIcon(icon);
break;
case 5:
jl... |
38e38230-e1bb-480f-ba43-b22c40a6209f | 3 | @Override
public void onTestInfoChanged(TestInfo testInfo) {
if (testInfo == null) {
return;
}
if (testInfo.getStatus() == TestStatus.Running) {
Utils.enableElements(this.cloudPanel, false);
cloudPanel.getRunInTheCloud().setEnabled(true);
}
... |
c4ce7415-29d9-4eb5-a63b-22271d6d47dc | 4 | private double[] calculateMemoryConsumptionW(Component component, HardwareAlternative hardwareAlternative) {
double consumption[] = { 0, -1 };
for (HardwareComponent memory : hardwareAlternative.getHardwareComponents()) {
double temp[] = Utils.consumptionMemory((Memory) memory, component.getUsageMemory());
if... |
89351fbb-f50e-49c1-a12b-81f7f0f1ab31 | 0 | public String getIRCColor() {
return IRCColor;
} |
f16494ee-f87b-4ea5-a300-0043407ae804 | 4 | private boolean isHelpOptionPresent( OptionSet options ) {
boolean helpOptionPresent = false;
for ( AbstractOptionSpec<?> each : recognizedOptions.toJavaUtilMap().values() ) {
if ( each.isForHelp() && options.has( each ) ) {
helpOptionPresent = true;
break;
... |
1fb89fbc-66d5-48a0-a344-18a33d90520f | 3 | private boolean fitsVessel(EnumLine line, EnumColumn column,
boolean vertical, EnumElement vessel) {
final int lengthVessel = vessel.getLength();
if (vertical) {
return (column.getPosition() + lengthVessel) > this.LENGHTMAP ? false
: true;
} else {
return (line.getPosition() + lengthVessel) > this... |
c39bb4eb-ebdb-4884-a47c-ff2a47bdb978 | 3 | private static void onePlayer(int numOfCards) {
frame.setLayout(new BorderLayout());
// If a game has already been started
// cardHolderPanel has to be cleared before
// it can be used properly again.
cardHolderPanel.removeAll();
// Adds the cardHolderPanel to the frame.
frame.add(cardHolderPanel, Bord... |
9b6001de-3d34-4ca1-9556-6c7fcb4c143f | 4 | public void act(){
if (map.getObjects (ChatBox.class) != null){
if (show){
if (bg.getTransparency() > 0){
trans -= 5;
}
else{
show = false;
trans = 0;
map.removeObject (thi... |
a86980d4-ae49-40f9-bdc7-0343119326a0 | 0 | public ServerStartEvent(Object aServer) {
super(aServer);
} |
be56a9e4-2384-4caf-8766-197d94f2189a | 5 | public List<E> search(Domain<E> domain, Collection<E> frontier) {
frontier.add(domain.initial());
Map<E, E> visited = new HashMap<E, E>();
visited.put(domain.initial(), null);
while(!frontier.isEmpty()) {
E current = Groups.first(frontier);
frontier.remove(current);
if(domain.isGoal(current)) {
... |
3763e141-2710-462e-96eb-61e405a50891 | 5 | public static double[] polinomioGradoNCM(Punto[] puntos, int grado) {
// Armo dos arreglos con los xi y los yi separados para despues usarlos en el producto escalar
double[] xi = new double[puntos.length];
double[] yi = new double[puntos.length];
for (int i = 0; i < puntos.length; i++) {... |
68cb1478-8d60-44d3-a856-745f95b5fbf4 | 6 | private void field_codigoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_codigoFocusLost
// TODO add your handling code here:
//if (field_codigo.isEditable()){
if (field_codigo.isEditable() && (lab_modo.getText().equals("Alta"))){
if ((evt.getOppositeComponent()!=... |
50616c5d-7664-4bd7-a577-75c81fbaaa14 | 8 | public static String encode(byte[] data) {
if (data == null) return null;
char[] buffer = new char[data.length / 3 * 4 + ((data.length % 3 == 0) ? 0 : 4)];
int buf = 0;
for (int i = 0; i < data.length; i++) {
switch (i % 3) {
case 0 :
buffer[i / 3 * 4] = BASE64_MAP.charAt((data[i] & 0xFC) >> 2... |
2f29db95-7856-4ca6-922b-8a15765528f5 | 6 | public void writeAllAssets(String rootDirPath) {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder docB;
try {
docB = documentBuilderFactory.newDocumentBuilder();
Document document = docB.newDocument();
Element root = document.createElement("assets... |
ef5dd28e-e681-4ad1-bba6-565c2d89086e | 8 | public static void main(String[] args) {
// TODO code application logic here
boolean validar=true;
int opcion;
char continuar;
double monto;
CuentaBancaria oCuentaBancaria=new CuentaBancaria();
Scanner teclado=new Scanner(System.in);
while(validar... |
eac6dd96-67a1-4fe9-bb8f-c0a1f7b269e0 | 7 | @Override
public void run() throws Exception {
try {
ConfigFile importFile = new ConfigFile(plugin);
ConfigSQL importSQL = new ConfigSQL(plugin);
if (!importSQL.checkDatabase()) {
throw new Exception("Could not connect to database !");
}
for (String player : importSQL.getAllPlayers()) {
for (... |
0bb210a5-d31d-47c0-af7b-017148879c12 | 9 | public void clear() {
super.clear();
resetBondTable();
destroyBonds();
setSolvent(null);
if (vdwLines != null && !vdwLines.isEmpty())
vdwLines.clear();
if (chargeLines != null && !chargeLines.isEmpty())
chargeLines.clear();
if (ssLines != null && !ssLines.isEmpty())
ssLines.clear();
if (bpLines... |
189cd1c6-1c5f-4caa-a12c-ced6edd7fce2 | 4 | @Override
public final void clearTargets() {
for (final DropTarget<?, ?, ?> part : this.parts) {
part.getDisplayableComponent().getParent()
.remove(part.getDisplayableComponent());
}
this.parts.clear();
} |
c58b8b9e-93a1-4e58-9810-2765fba45d3f | 4 | public static Properties get(String filePath) {
if (! filePath.endsWith(".properties")) {
filePath += ".properties";
}
if (propertiesMap.containsKey(filePath)) { // Check if the file is cached.
// If so, return the cached version of the file.
return propertiesMap.get(filePath);
} else {
try {
... |
ebf1d5d8-25da-4c94-9f27-89a7586ec50c | 2 | public void remindBuyerMarkReceived() {
if ((itemReceivedInt.equals("1") == false) && this.isEnded()){
this.getBuyer().sendEmail("Remind buyer msg");
}
} |
1c55f476-60a6-4247-8397-191f7fc16623 | 6 | private void hsvToRgb(float h, float s, float v) {
int hh = (int) (h * 6);
float f = (h * 6 - hh);
float p = (v * (1 - s));
float q = (v * (1 - f * s));
float t = (v * (1 - (1 - f) * s));
switch (hh) {
case 0:
r = v;
g = t;
... |
ea6b5662-ebd0-4d90-a874-7864e345eeb9 | 2 | @Override
public void disconnected(Connection c){
User u = Users.findUser(c);
if(u != null && u.loaded)
u.logout();
else
System.out.println("Connection dropped.");
} |
ef4a50ff-7399-4372-9840-15fc5c9d03c7 | 4 | private void removeNodeWithoutChildren(Node u)
{
if (root == u)
{
root = null;
return;
}
if (!u.isRed) balanceOnRemoval(u);
if (u.parent.left == u) u.parent.left = null;
else if (u.parent.right == u) u.parent.right = null;
u.parent... |
bd275ef2-db5f-4dd9-9ed5-d31932192a51 | 3 | public void writeExternal(ObjectOutput paramObjectOutput) throws IOException {
if (this.Cells == null) {
paramObjectOutput.writeObject(null);
}
else {
String[] arrayOfString = new String[this.Cells.length];
for (int i = 0; i < this.Cells.length; i++)
if (this.Cells[i] != null)
... |
3058b51f-4651-40d5-b23b-951394ba1e43 | 9 | public boolean allowMove(int dx, int dy) {
int nx = x + dx;
int ny = y + dy;
int nx2 = x2 + dx;
int ny2 = y2 + dy;
int i;
for (i = 0; i != sim.elmListSize(); i++) {
CircuitElm ce = sim.getElm(i);
if (ce.x == nx && ce.y == ny && ce.x2 == nx2 && ce.y... |
e6e2b03e-6b12-4f5f-b4d9-be54c7e5dad1 | 7 | public static boolean isMatch(Method lhs, Method rhs){
if(!lhs.getName().equals(rhs.getName())
|| !Modifier.isPublic(lhs.getDeclaringClass().getModifiers())){
return false;
}
Class<?>[] types1 = lhs.getParameterTypes();
Class<?>[] types2 = rhs.getParameterTypes();
if(types1.length != ... |
3702a74f-1b29-4df5-bd47-5d4ed232f8eb | 0 | public void setCode(String code) {
this.code = code;
} |
1e9fee80-686d-4ab9-b40f-9945b3445ae2 | 3 | private void updateUIState() {
if(!mediaPlayer.isPlaying()) {
// Resume play or play a few frames then pause to show current position in video
mediaPlayer.play();
if(!mousePressedPlaying) {
try {
// Half a second probably gets an iframe
... |
00bfd806-9090-4a4f-b3ec-b0715969d8a4 | 9 | @Override
public boolean equals(Object object) {
if (object == this ) {
return true;
}
if (object instanceof ResizableDoubleArray == false) {
return false;
}
synchronized(this) {
synchronized(object) {
boolean result = true;
... |
59a4370d-fdca-453b-9b9b-f982e07fc862 | 4 | public void render(Graphics g){
g.setColor(Color.WHITE);
g.setFont(JudokaComponent.bigFont);
for (int i = 0; i < items.length; i++) {
if(selectedItem == 1){
if(i == selectedItem)
g.drawString("> " + items[i] + " " + dojo + " <" , JudokaComponent.WIDTH / 2 - (items[i].length() + 6) * 10 + 200, 50 + Ju... |
b5779fea-080f-4af2-b6a7-461cc9189580 | 7 | public void draw(Graphics2D g, TileMap map,
int screenWidth, int screenHeight)
{
Jugador p = map.getJugador();
int mapWidth = tilesToPixels(map.getWidth());
// get the scrolling position of the map
// based on player's position
int offsetX = screenWidth / 2 -
... |
e93223ff-4212-4769-9d40-d997071689d2 | 6 | protected final void onButtonClick(Button var1) {
if(var1.id == 0) {
this.minecraft.setCurrentScreen(new OptionsScreen(this, this.minecraft.settings));
}
if(var1.id == 1) {
this.minecraft.setCurrentScreen(new GenerateLevelScreen(this));
}
if(this.minecraft.session != nu... |
0626f5ac-a28b-460b-9d56-cc3ca15ac039 | 3 | public static boolean IsPrime(int n)
{
double upper = Math.sqrt(n);
if (upper < 2)
return false;
for (int i = 2; i <= upper; i++)
if (n % i == 0)
return false;
return true;
} |
199c84a2-dbbd-4c88-b14a-1f08e7d59233 | 3 | public String obtenFormularioSinCatalogos(String formulario) {
String form = "";
ServletContext context = getServletContext();
InputStream is = context.getResourceAsStream("/WEB-INF/formularios/" + formulario + ".html");
if (is != null) {
InputStreamReader isr = new InputStre... |
0d69d02e-f83e-4663-8847-33e96a0b6de7 | 4 | public void transpose ()
{
for (int k = 0; k < dim/32; k++) {
for (int l = 0; l < dim/32; l++) {
for (int j = 0; j < 32; j++) {
for (int i = 0; i < 32; i++) {
result[l*32 + j][k*32 + i] = source[k*32 + i][l*32 + j];
... |
8e775137-b24f-42a9-bff0-f31d40d7c4f9 | 4 | public static List<Person> LCS(List<Person> lop1, List<Person> lop2) {
// trivial case
if ( lop1.isEmpty() || lop2.isEmpty()) {
return new ArrayList<Person>();
}
// non trivial case
int size1 = lop1.size();
int size2 = lop2.size();
if ( lop1.get(size1-1) == lop2.get(size2-1)){
List<Person... |
39083da6-609c-4119-a4e6-a7e1cc15a984 | 1 | public String getExceptions() {
return exceptions == null ? null : exceptions.toString();
} |
cca867f7-4484-4086-b9d5-f4bbe405a2ed | 8 | private void drawCollider(Graphics g, Enemy[][] enemys, Player player) {
g.setColor(Color.GREEN);
//Players collider
g.drawRect(player.getCollider().getX(),
player.getCollider().getY(),
player.getCollider().getWidth(),
player.getCollider().getHeith());
//Enemys collider
for(int i = 0; i <... |
64536f22-8499-4a8d-85e0-94cc32619388 | 7 | @Test public void testIterator() throws Exception {
// first, populate the aggregator via sum over scan1
scan1.open();
IntegerAggregator agg = new IntegerAggregator(0, Type.INT_TYPE, 1, Aggregator.Op.SUM);
try {
while (true)
agg.mergeTupleIntoGroup(scan1.next());
} catch (NoSuchElement... |
f180ff3c-29e7-4246-a7eb-8fe935ca83e0 | 8 | private void checkRemovalGroup(int r, int c, Intersection[][] b,
boolean[][] checked, Intersection.Piece p) {
if (r >= 0 && r < 9 && c >= 0 && c < 9) {
if (b[r][c].getContents() != p
&& b[r][c].getContents() != Intersection.Piece.EMPTY
&& checked[r][c] == false) {
List<Coord> group = new ArrayList... |
46ac910f-32e8-47ba-8bf0-628a6c954696 | 4 | private void computeBinExprType(BinExpr expr, int token, int type1)
throws CompileError
{
// arrayDim should be 0.
int type2 = exprType;
if (token == LSHIFT || token == RSHIFT || token == ARSHIFT)
exprType = type1;
else
insertCast(expr, type1, type2);
... |
d7f6fc00-4a3c-466e-bbd5-5fe0dcb2c24d | 6 | @Override
public void actionPerformed(ActionEvent arg0)
{
System.out.println("Login button clicked.");
if (username == null || username.getText().isEmpty() || password == null || password.getPassword().length == 0)
{
loginView.printLoginError();
}
else if (arg0.getSource() instanceof JButton)
{
J... |
d908d19e-2053-46dc-911c-c4626f5ac944 | 3 | @Override
public boolean accept(File file) {
if (file.isDirectory()) {
return true;
} else {
String path = file.getAbsolutePath().toLowerCase();
for (int i = 0, n = extensions.length; i < n; i++) {
String extension = extensions[i];
... |
6c57ab59-ce14-42a8-b6f5-86f16e89de9b | 0 | @Override
public synchronized DataFlavor[] getTransferDataFlavors() {
return flavors;
} |
af4a53f7-91eb-46b7-aa1b-aeef09fc6cf9 | 9 | private void refreshMonLocsAtRiskRand() {
double base = 0.05;
TreeMap<Integer,Integer> atRiskLocs = new TreeMap<Integer,Integer>();
Iterator<Integer> atRiskPeople = this.mySim.getAtRiskPeople().iterator();
Iterator<Integer> implocs = this.trackLocations.keySet().iterator();
while (implocs.hasNext()) {
atRi... |
2b18cfbb-0d65-49a5-8b54-2c904fd34810 | 3 | private void calculateDownslopes() {
for (Corner c : corners) {
Corner down = c;
//System.out.println("ME: " + c.elevation);
for (Corner a : c.adjacent) {
//System.out.println(a.elevation);
if (a.elevation <= down.elevation) {
... |
12aa5456-0c2b-4f84-b3de-2564c80e064b | 6 | @Override
protected boolean onSettingParsed(int lineNr, String group, String key,
String value, String comment) throws ParsingException {
// only [NODE] so far
// System.out.println(group);
// System.out.println(key);
// System.out.println(value);
if(group.equals("Node")) {
// if we detect new nod... |
7987e913-02a9-4ed2-9ee5-c9932b6683e9 | 3 | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
thisElement = qName;
String temperature = "";
if (qName.equals("yweather:location")) {
Location location = new Location();
location.setCity(att... |
1836f22a-ece2-49ee-9133-6e37bea55b35 | 3 | private int getDistance(Vertex node, Vertex target) {
for (Edge edge : edges) {
if (edge.getSource().equals(node)
&& edge.getDestination().equals(target)) {
return edge.getWeight();
}
}
throw new RuntimeException("Should not happen");
... |
d0ce6243-3ede-4e78-b272-813a44bc9602 | 2 | public void output() {
if (!isEmpty()) {
for (ValueType current : this) {
System.out.print(current + " ");
}
System.out.println();
}
} |
42eeff98-e312-4569-b77c-8803cd03942e | 1 | public AbstractInsnNode[] toArray() {
int i = 0;
AbstractInsnNode elem = first;
AbstractInsnNode[] insns = new AbstractInsnNode[size];
while (elem != null) {
insns[i] = elem;
elem.index = i++;
elem = elem.next;
}
return insns;
} |
48c98261-a4cc-4659-a2a3-b0b13853cec0 | 4 | public int checkForRows() {
// scan for completed rows and remove them
ArrayList<Integer> rowsToBeCleared = new ArrayList<Integer>();
boolean test = true;
for(int i = 0; i < 20; ++i){
for(int j = 0; j < 10; ++j){
if(screen[i][j].isEmpty())
test = false;
}
if(test){
rowsToBeCleared.add(i);... |
e7c1d8a2-5728-4473-9354-a9b6583e0c5a | 6 | public void paint(boolean bands)
{
for (int i = 0; i < getWidth(); i++)
{
for (int j = 0; j < getHeight(); j++)
{
double re = centerX - sizeX / 2 + sizeX * i / getWidth();
double im = sizeY * j / getHeight() - centerX - sizeY / 2;
if(re < - 1.0 && re > - 1.1 && im < .05 && im > -.05)
{
... |
5e983c80-c776-43e8-9675-f43552e5557c | 9 | public String canShoot()
{
if (agent.getArrow())
{
boolean flag = false;
int[] pos = new int[2];
// Verifica se o Wumpus esta no mesmo X ou Y do agente
// (baseado no conhecimento do agente)
// !---!---!---!---!---!---!---!---!---!---!---!---!---!---!---!---!---!---!
// A princi... |
489d8ed9-a27c-41ee-b43b-0fbe6f6e0c7c | 1 | public SchlangenGlied getLastGlied() {
if (nextGlied != null) {
return nextGlied.getLastGlied();
} else {
return this;
}
} |
1c1da161-eb59-48d1-9ba2-0ad6fc4ec472 | 5 | final void method2134(boolean bool, boolean bool_11_) {
anInt6232++;
if (aClass61_6222 != null) {
aClass61_6222.method594('\0', 28666);
((Class286) this).aHa_Sub2_3684.method3738(-15039, 1);
OpenGL.glMatrixMode(5890);
if (bool_11_ == false) {
OpenGL.glLoadMatrixf(((OpenGlToolkit)
((Cla... |
3e92ce9d-8736-4431-9fcb-b3de7c98515e | 4 | public void showTournament()
{
amountOfPlayersFrame.dispose();
for (int i = 0; i < amountOfPlayers; i++)
{
buttonArray.add(new JButton("Player"+(i+1)));
buttonArray.get(i).setName("" + i);
buttonArray.get(i).addMouseListener(new MouseListener(){
public void mouseClicked(MouseEvent e) {
JButton ... |
69e2b783-6060-4d24-8eb3-2b6ca8ce4057 | 5 | public int getMinNumCoins() {
HashMap<Integer, Integer> minNumCoins = new HashMap<Integer, Integer>();
minNumCoins.put(0, 0);
for (int money = 1; money <= this.money; money++) {
int minNumber = 100000000;
for (int j = 0; j < denominations.size(); j++) {
i... |
445bd198-377f-43c5-896c-c410ebe22cc5 | 6 | public void keyPressed(int k) {
if(player.getMovable()){
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_W) player.setJumping(true);
if(k == KeyEvent.VK_R) player.setScratching();
if(k == KeyEvent.VK_F) player.setFiring();
}
} |
ae3f6c3b-bf59-47c7-8674-a4eb505e3967 | 4 | @Override
public boolean isLegal(Model model) {
if(model instanceof HyeneModel){
HyeneModel hmod = (HyeneModel) model;
HyenePlayer p = (HyenePlayer) hmod.m_current_player;
int PlayerPosition = -1;
int k = -1;
while(PlayerPosition == -1){
k++;
PlayerPosition = hmod.findElement(k,p.token);
}
... |
784964d4-b695-463d-a3cb-607ae02ab8ec | 5 | public void renderMainPage(){
int x = 40;
int y = Main.HEIGHT / 2 - 128;
glColor4d(1, 1, 1, 1);
textures[0].bind();
glBegin(GL_TRIANGLES); {
glTexCoord2f(0, 0);
glVertex2i(x, y);
glTexCoord2f(1, 0);
glVertex2i(x + 256, y);
glTexCoord2f(0, 1);
glVertex2i(x, y + 256);
glTexCoord2f(1, 0);
... |
9e3cbba4-a363-4c48-b8ad-f6d154570193 | 6 | protected void readOggHeader() throws Exception {
byte[] header = new byte[27];
raf.readFully(header);
if(!(header[0] == 'O' &&
header[1] == 'g' &&
header[2] == 'g' &&
header[3] == 'S')) {
// this is not an ogg! abort...
//System.out.println("not an ogg header at " + raf.getFilePointer... |
eefb7aa3-f6e5-40f6-9b1e-fbba919073e4 | 0 | private Card createACard(String info, int width, int height) {
Card card;
int suit, value, x, y;
boolean removed, faceUp;
Scanner scanInfo = new Scanner(info);
value = scanInfo.nextInt();
suit = scanInfo.nextInt();
x = scanInfo.nextInt();
y = scanInfo.nextInt();
removed = scanInfo.nextBoolean();
fa... |
2cfd5dcc-fcf7-4cda-959e-65f0eb5076fe | 0 | public int getDlc() {
return dlc;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.