method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
97988e09-db72-4209-977f-2ae98180f43b | 8 | public static final void GiveFame(final SeekableLittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
final int who = slea.readInt();
final int mode = slea.readByte();
final int famechange = mode == 0 ? -1 : 1;
final MapleCharacter target = (MapleCharacter) chr.getMap().getMapObject(who);
i... |
6bea79fb-58e6-4e18-b6ba-90022585298d | 4 | public static void AddIndividualReportSteps(String testCaseName,String Description,String Keyword,String status)
{
String STestName = System.getProperty("user.dir")+"\\target\\"+testCaseName+".html";
// returntestname(STestName);
FileWriter fstream =null;
BufferedWriter out =null;
try
{
fstream =... |
e7c91de8-84aa-4894-bc82-09388198a9b3 | 1 | private boolean jj_3R_88() {
if (jj_3R_72()) return true;
return false;
} |
de5aa9b2-0b1a-4cbe-81db-b156e73531c7 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final VendorServiceKey other = (VendorServiceKey) obj;
if (serviceNumber == null) {
... |
1b1c0846-475b-442f-be6c-cf5b395d4246 | 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... |
9c8ce416-68c3-42c1-a768-f4c00925c847 | 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... |
0426ef1d-82ac-43f9-bf99-eac3238f772a | 9 | public static void main(String[] args) {
Configuration config = readArgs(args);
String[][] pairs = FileUtils.readPairs(config.pairs);
HashMap<String, Sequence> seqLib = FileUtils.readSeqLib(config.seqlib);
Substitutionmatrix matrix = FileUtils.readSubstitutionMatrix(config.matrix);
StringBuilder falseAlignme... |
8b003040-856e-4606-b794-24d25edc70be | 4 | public final void alert(BlockDispenseEvent event) {
final int xx = (int) event.getBlock().getLocation().getX();
final int yy = (int) event.getBlock().getLocation().getY();
final int zz = (int) event.getBlock().getLocation().getZ();
final String item = event.getItem().getType().toString().toLowerCase();
if (Se... |
8dc6826e-9fa3-4b79-9ca1-16f5bbede96e | 2 | public static void main (String[] args) {
Memorygame memoryGame = null;
/* getCommand();
displayInstructions();
MainMenuView mainMenu = new MainMenuView();*/
try {
memoryGame = new Memorygame();
//mainMenu.executeCommands(null); /*... |
344be8bd-a283-4e87-b227-ca4278bdcf2c | 6 | private static int session() {
boolean reponse; // contient la réponse à une question oui/non
int choix; // contient la réponse à une boîte de dialog multiple
String section[] = {"Non-fumeur", "Fumeur"}; // nom des sections disponibles
// si l'avion est plein, il n'y a aucune rés... |
1f0c2227-3493-4d4e-8487-f37422ea2e3b | 4 | private void connectToUnparsedAddress(String unparsed) {
if(unparsed == null) return;
String[] parsedHost = unparsed.split(":");
if(parsedHost.length == 2) {
try {
if(RecentConnections.addNewConnection(new InetSocketAddress(parsedHost[0], Integer.parseInt(parsedHost[1])))) {
expandRecentConnections... |
6f1358f6-a887-46f2-89d2-ee4ec9026949 | 9 | public void importVocabulary(Iterable<String[]> sl) throws IOException {
if(debug > 0)
System.err.println("LanguageModel.importVocabulary(): Started for "+name);
// initialize the hash table
HashMap<String, Integer> counts = new HashMap<String, Integer>();
// cycle through the sentences counting the vocabul... |
1754e16d-c553-4e34-a289-e0fd8833cc28 | 4 | private void removeCompletedRows() {
for (int row = 0; row < rows; row++) {
boolean rowComplete = true;
for (Cell cell : cellsInRow(row)) {
if (!cell.isPopulated()) rowComplete = false;
}
if (rowComplete) {
removeRow(row);
... |
bb490788-f8ee-4cb1-8401-8b2e94e29526 | 8 | protected void processItem(ResultSet rs) throws SQLException, IOException {
int cmcId = rs.getInt("p_page_id");
String url = null;
String width = null;
String height = null;
// String text = null;
String title = rs.getString("p_title");
String content = rs.getString("p_conten... |
c18b6d56-9a11-4d37-bf08-e83ca7c83e08 | 2 | public static BufferedImage clip(BufferedImage src, int x, int y, int w, int h) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
BufferedImage work = null;
try {
GraphicsDevice screen = ge.getDefaultScreenDevice();
GraphicsConfigurati... |
a8ab2bf1-db8a-46fa-b771-a12863e49830 | 6 | public void quitIfNoSignificantWindowsOpen() {
if (mAllowQuitIfNoSignificantWindowsOpen) {
for (Frame frame : Frame.getFrames()) {
if (frame.isShowing()) {
if (frame instanceof SignificantFrame || BaseWindow.hasOwnedWindowsShowing(frame)) {
return;
}
}
}
mAllowQuitIfNoSignificantWindo... |
7c3a6ca6-93f2-4afa-9187-67cbd1261f92 | 8 | @Override
public void serialize(Object obj, StringBuilder buf){
obj = Bytes.applyEncodingHooks( obj );
if(obj == null) {
buf.append(" null ");
return;
}
ObjectSerializer serializer = null;
List<Class<?>> ancestor... |
8a2ebb0d-5122-45cd-b5ad-e3555c77a284 | 3 | public LogicLargeArray or(LogicLargeArray array)
{
if (array == null || array.length() != length) {
throw new IllegalArgumentException("array == null || array.length() != length");
}
LogicLargeArray out = new LogicLargeArray(array.length(), false);
for (long i = 0; i < l... |
371d86d6-dee3-4fe6-abfb-aa10a1555666 | 3 | public Object getValueAt(int row, int col) {
if(row>-1 && col>-1 && data!=null)
return data[row][col];
else
return null;
} |
183b8521-e1af-4353-b52d-18dece85268c | 0 | public String toString() {
return "Weekly Salary: "+baseWeeklySalary+"; Total Payment:" +totalPaymentToDate+";";
} |
b8094353-560d-4e3b-a7c8-e24278fe1199 | 8 | public static void main(String[] args)
{
long sum = 0;
ArrayList<Long> possibles = new ArrayList<Long>();
for (long i = 1L; i < 10; i++)
possibles.add(i);
for (int i = 0; i < 14; i++)
{
int size = possibles.size();
for (int j = 0; j < size; j++)
{
long current = possibles.remove(0);
... |
20f7a0e5-04c9-472c-8109-931262f312b9 | 3 | public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.LIGHT_GRAY);
g2.fillRect(0, 0, getPreferredSize().width, getPreferredSize().height);
if(sprite != null) {
sprite.draw(g2, null);
g2.setColor(Color.RED);
for(int x = 0; x<maxFrame + 1; x++) {
... |
7ca1f497-b603-4cd0-b5b7-a7907135c496 | 5 | public void run(String[] args){
int rows = 0;
int columns = 0;
List<? extends Piece> piecesToAllocate;
String errorMsg;
if (args.length != 3){
errorMsg = messages.getString("numParametersInvalid");
System.out.println(errorMsg);
}else{... |
87845798-a3b6-4f12-9274-100169bf848a | 8 | public void putAll(Map<? extends K, ? extends V> map) {
int mapSize = map.size();
if (mapSize == 0) {
return;
}
int newSize = (int) ((size + mapSize) / loadFactor + 1);
ensureCapacity(calculateNewCapacity(newSize));
// Have to cast here because of compiler inf... |
891f89f0-cf07-4d7c-b915-3cb51b07b426 | 9 | public int shortestPath(int startIndex, int endIndex) {
if (startIndex < 0 || startIndex >= adjancencyList.length
|| endIndex < 0 || endIndex >= adjancencyList.length) {
System.err.println("satrtIndex and endIndex has to be in range: 0 ~ " + adjancencyList.length);
return -1;
}
if (startIndex == en... |
5c8b1eaa-6315-4ee8-bd88-eab50a07db14 | 7 | public boolean equivalentWasAssociatedWiths (WasAssociatedWith description1, WasAssociatedWith description2) {
return bothNull (description1, description2)
|| (neitherNull (description1, description2)
&& equivalentIdentifiers (description1, description2)
&& e... |
5c96abe3-6b28-47ec-84b5-a7a5ec2d951d | 0 | @Override
public int getCorners() {
return 3;
} |
2606f005-8dd4-4ad0-aa17-e1c331ae1278 | 8 | public void start() throws IOException {
myServerSocket = new ServerSocket();
myServerSocket.bind((hostname != null) ? new InetSocketAddress(hostname, myPort) : new InetSocketAddress(myPort));
myThread = new Thread(new Runnable() {
@Override
public void run() {
... |
cb32e9e7-de5d-4157-ae3f-2664cc7f05de | 0 | public void setScheduler(Scheduler s) {
this.scheduler = s;
nextScheduledRound = -1;
lastScheduledRound = -1;
} |
72fc391c-2a77-4e64-b25e-4467b7f097dd | 4 | public AllPlayerInfoFrame(GameBoard gb, ArrayList<Player> p) {
super("Player Information");
players = p;
gameBoard = gb;
// Vertical panel with info boxes stacked on top of each other
mainPanel = new JPanel(new GridLayout(7, 1));
bankLabel = new JLabel();
innerPanels = new ArrayList<JPanel>();
inn... |
dd1c35d3-c9c6-4c54-b0ac-a2a435560ddf | 3 | public String deletesite() throws Exception {
try {
Map session = ActionContext.getContext().getSession();
setUser((User) session.get("User"));
Publish cdel = (Publish) myDao.getDbsession().get(Publish.class, publishid);
getMyDao().getDbsession().delete(cdel);... |
cf224c7b-9045-4fa0-abbe-f8fe5e128a82 | 7 | public boolean stealPoints(TempNode newAnchor, Vector anchors,
Vector anchorDistances) {
int maxIdx = -1;
double maxDist = Double.NEGATIVE_INFINITY;
double[] distArray = (double[])anchorDistances.lastElement();
for(int i=0; i<distArray.length... |
55b34b4e-1019-4830-93be-3b4082a25c71 | 5 | @Override
public void run()
{
try {
gate.await();
} catch (InterruptedException | BrokenBarrierException e) {
e.printStackTrace();
}
while(theBusiness.timer.getTimeOfDay() < arrivalTime)
{
this.yield();
}
isAtWork = true;
System.out.println... |
4ae900e5-ac4c-4790-9b5f-8469b32f5ebe | 1 | @Override
public boolean equals(Object obj) {
if (obj instanceof ArgPosition) {
return path.equals(((ArgPosition) obj).getPath());
} else {
return false;
}
} |
c8a21488-7488-4928-9840-ca7c4e4ddc70 | 9 | @Override
public Card parse(String name) throws URISyntaxException,
MalformedURLException, NoConnectionException,
CardNotFoundException, NoCardAvailableException
{
String hyperlink = getHyperlink(name);
URL url = new URL(hyperlink);
HtmlPage page = null;
try {
page = client.getPage(url);
... |
d9c199bf-fa87-43f8-89b7-8517fd4bdfd7 | 3 | private void updateDimension() {
Rectangle2D newSize = getBounds();
if(totalSize == null
|| newSize.getWidth() != totalSize.getWidth()
|| newSize.getHeight() != totalSize.getHeight()
) {
totalSize = newSize;
Insets insets = getInsets();
interiorSize = new Dimension(
(int)totalSize.getWidth() - ... |
7a0f7f1a-7b8d-4d98-ba4f-42615605d4f4 | 7 | public int read()
throws IOException {
if( this.isClosed() )
throw new IOException( "Cannot read from a closed stream." );
// No stop marks given?
if( this.emptyStopMarkSet() )
return this.in.read();
if( this.eoiReached() )
return -1;
if( this.stopMarkReached() )
return -1;
// First c... |
acbaf967-88be-4309-a31a-62dd3d8e5702 | 6 | public static GmPlaylist[] parsePlaylist(String data,Gm parent) {
Pattern re=Pattern.compile("\\{playlists:\\[(.*)\\]");
Matcher m=re.matcher(data);
GmPlaylist[] res=new GmPlaylist[1];
if(!m.find()) {
res[0]=null;
return res;
}
String realData=m.group(1);
int size=0;
int pos=0;
for(;;) {
int... |
21b21feb-14bf-4f3a-a626-cda9ab9b7717 | 2 | @Override
public void insertString(int offs, String str, AttributeSet a)
throws BadLocationException {
if (str == null)
return;
if ((getLength() + str.length()) <= limit) {
super.insertString(offs, str, a);
}
} |
a5660998-4ac6-4113-b555-57b6c4cd59fc | 5 | public static void main(String[] varArgs) {
int rows;
do{
Console c = System.console();
System.out.print("How many rows high would you like the pyramid to be? (The number must be between 0 and 23, inclusive.) ");
rows = Integer.parseInt(System.console().readLine());
//rows = c.readLine("How many rows... |
fb119f86-8f69-4479-a3d1-f1ecedf3b8ef | 1 | public int getIndex() {
if (item.length > 0)
return item.length + item[0].length;
else
return 0;
} |
9641041c-098e-4711-857d-45ec3f2b9c77 | 9 | public DataBag exec(Tuple tuple) throws IOException {
DataBag output = mBagFactory.newDefaultBag();
double[] latlon = new double[2];
DateTime date1 = null;
DateTime date2 = null;
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
... |
bd8268c0-901d-4333-adbd-e69e24a01001 | 0 | public SimpleVector getSideVector() {
return cam.getSideVector();
} |
7fc6eb5f-e02c-4629-b2ba-9b83f7c9d4c9 | 1 | @Override
public void draw(Graphics g) {
// If the ball is alive, draw the ball image
if (Alive) {
g.drawImage(img1, pos_x, pos_y, width, height, null);
}
// Otherwise draw the explosion
else {
g.drawImage(img2, pos_x, pos_y, width, height, null);
}
} |
956f5a4e-2b23-4156-9055-c2fc6b0adecc | 1 | public void keyPressed(KeyEvent arg0) {
if(arg0.getKeyCode() == KeyEvent.VK_ESCAPE) {
frame.setVisible(false);
}
} |
1255a8f5-de44-42fe-a2f5-c32a160a862b | 8 | @Test
public void testWrap() throws Exception {
// Initialize the scheduler & the store.
int partitionNum = 10;
IScheduler[] schedulers = new IScheduler[partitionNum];
for (int i = 0; i < partitionNum; i ++) {
// We use multiple threads here.
schedulers[i] = n... |
539db9e1-ff4c-4d47-a600-8030fc6601c4 | 8 | protected static Ptg calcDec2Bin( Ptg[] operands )
{
if( operands.length < 1 )
{
return new PtgErr( PtgErr.ERROR_NULL );
}
debugOperands( operands, "DEC2BIN" );
int dec = operands[0].getIntVal();
int places = 0;
if( operands.length > 1 )
{
places = operands[1].getIntVal();
}
if( (dec < -512)... |
831ff22a-37fe-4025-b167-24373591cb00 | 0 | public double next() {
return rand.nextDouble();
} |
324c2fbf-4334-4270-be53-f928702c75aa | 2 | private static int getIdFromString(String idMeta) {
String data;
if(idMeta.contains(":")) {
String[] s = idMeta.split(":");
if(s.length == 0) {
data = idMeta.replace(":", "");
} else {
data = s[0];
}
} else {
... |
2552ce90-bc30-4017-866d-450d72562098 | 4 | private byte[] internalReadChunkedBytes() throws IOException {
ArrayList<byte[]> chunks = new ArrayList();
int code = Codes.BYTES_CHUNK;
while (code == Codes.BYTES_CHUNK) {
chunks.add(internalReadBytes(readCount()));
code = readNextCode();
}
if (code != Co... |
28fb6255-2b7f-4a5b-8791-096b2203e9ac | 8 | public static final int[] decodeOID(BERInputStream is, MutableByte type)
throws IOException
{
/*
* ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
* subidentifier ::= {leadingbyte}* lastbyte
* leadingbyte ::= 1 7bitvalue
* lastbyte ::= 0 7bitvalue
*/
int subidentif... |
db3deb58-0793-480b-a34c-265036c46526 | 9 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
int cantidadFilas=listadoDePedidos.size();
System.out.println("cantidad de filas "+cantidadFilas);
PedidosParaReparto ped=new PedidosParaReparto();
ExportacionDePedidos exp=new... |
45ddfe48-aade-4975-8d30-9b0d655da176 | 9 | static final public String PostfixIncDecExpression() throws ParseException {
String tmp1,tmp="";Token tmp2;
tmp1 = InstanceOfExpression();
if (jj_2_29(3)) {
label_10:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 110:
tmp2 =... |
f086e3b1-29e0-48b6-98fc-074266963ccf | 6 | public void paint(Graphics g) {
if(main.getSelection().size() == 1) {
if(main.getSelection().getFirst() instanceof Unit) {
Unit selectedUnit = (Unit)main.getSelection().getFirst();
g.drawImage(selectedUnit.getFace(), 10, 10, null);
g.setColor(Color.WHITE);
int y = 0;
for(Bar bar : selectedUnit.... |
8cb269a0-6982-43f7-9ce8-ee4ba659d6d1 | 6 | @Override
public void editarPessoa(String CPF) {
Scanner s = new Scanner(System.in);
String nomeNovo, emailNovo;
int editar;
int indexLista = 0;
boolean verifica = false;
for (int i = 0; i < listPessoas.size(); i++) {
if (listPessoas.get(i).getCPF().equa... |
806608bb-4e3f-479f-92b9-1e788148e1e7 | 2 | public TrackList search(String key, String value)
{
TrackList result = new TrackList();
for(Track tr : this)
{
if(tr.get(key).equals(value))
result.add(tr);
}
return result;
} |
5d88e834-7951-4afc-b23b-433a20882bb7 | 2 | private static void registrarCliente()
{
boolean salir;
String nombre, dni;
Cliente cliente;
do
{
try
{
System.out.print( "Introduce el nombre del cliente: ");
nombre = scanner.nextLine();
System.out.print( "Introduce el dni del cliente: ");
dni = scanner.nextLine();
client... |
d17ae395-9dc3-44a8-ad62-3330b9f6dbf7 | 7 | private void setGonzo(int a){
switch(a){
case 1: gonzo = new onebrush(); break;
case 2: gonzo = new twobrush(); break;
case 3: gonzo = new threebrush(); break;
case 4: gonzo = new gliderbrush(); break;
case 5: gonzo = new rpentbrush(); break;
case 6: gonzo = new evbrush(); break;
case 7: gonzo = ... |
b4b0ee71-22f3-46f4-9530-07dbd5325027 | 7 | static void filePrompt() {
Graph g = null;
while (g == null) {
System.out.println("Which file to read graph from?");
System.out.println("Or alternatively, type 'random size' for randomly "
+ "generated graph, eg. 'random 4' for a graph with 4 vertices, "
... |
c215f0a5-e130-4f11-a888-04dc3d72dfce | 5 | static public String textRead(String a_file_name)
throws FileNotFoundException, IOException
{
// for holding the string read from the file
StringBuffer contents = new StringBuffer();
// for holding the reader; to make visible to finally clause
BufferedReader input_reader = null;
try
{
... |
62704566-6d82-48ca-afac-453b698e379a | 0 | public Hashtable <String, Integer> getAcknowledgement(){
return this.acknowledgement;
} |
800d56a4-ca48-4024-9447-a166405a4d4e | 0 | public float calcualteNiceLng(double inX, double inY) {
x = inX;
y = inY;
lat=RD2lat(x,y);
return Float.parseFloat(printGPS(lng).replace(",", "."));
} |
1e26976e-0e69-4351-858b-116cd17fed1a | 2 | private void gameStartEvent(GameEvent gameEvent) {
gameEvent.sourceGame = this.name;
for (GameListener listener : gameListeners) {
if (listener == null)
continue;
listener.onGameStart(gameEvent);
}
} |
2e852375-cf1d-4303-b20a-500d6d028c68 | 4 | private int explore(int startPostion, int depth, int dicrection, int lastFoundPlayer, LongBoard state,int threatPlacement, int emptyPostions) {
if(depth == 0) {
return threatPlacement;
}
long mask = 1l <<(startPostion + dicrection);
if((state.boards[lastFo... |
2ca86583-92d4-4a9b-a57c-31e34958174c | 1 | void move(MoveApplet m)
{
try
{
Thread.sleep(10);
m.repaint();
}
catch(Exception e)
{}
} |
9cad185a-c9e0-436e-a002-989813666032 | 1 | public void selection() {
//Collections.sort(population, Collections.reverseOrder());
Collections.sort(population, new ChromosomeComparator());
int limit = 50;
if (this.population.size() < limit) {
//limit = this.population.size();
} else {
this.population = this.population.subList(0, limit);
}... |
2a7b98f5-46a9-461e-9e8d-e7db0d28e9e1 | 7 | public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
int k =... |
49da93d3-c582-43a7-bddc-e88e549ee1e8 | 7 | public void insert(Entity e) {
if(nodes[0] != null) {
int index = getIndex(e);
if(index != -1) {
nodes[index].insert(e);
return;
}
}
entities.add(e);
if(entities.size() > MAX_OBJECTS && level < MAX_LEVELS) {
if(nodes[0] == null) {
split();
}
int i = 0;
while(i < entiti... |
7161f46d-2220-48df-bf14-57e4e22cd1f3 | 2 | public Block clone()
{
// Create a new block of random shape
Block newBlock = new Block();
for(int i = 0; i < BLOCK_SIZE; i++)
for(int j = 0; j < BLOCK_SIZE; j++)
newBlock.setValue(i, j, this.getValue(i, j));
return newBlock;
// Will newBlock be garbage collected once it is dereferenced outsi... |
6774447f-dfe9-4639-925c-6dfa94825245 | 1 | @TestDescription("This method tests the web page title.")
@Test
public void testFindFieldsbyName() throws Exception {
try{
getDriver().get("http://www.google.com/webhp?complete=1&hl=en");
// Find the text input element by its name
WebElement element = getDriver().findElement(By.name... |
913ef165-9f00-4d54-a347-ecdb8b18eaea | 3 | protected final void findOppositeEdge() {
Iterator<Edge> edgeIter = endNode.outgoingConnections.iterator();
while(edgeIter.hasNext()){
Edge e = edgeIter.next();
if((e.startNode.ID == endNode.ID)&&(e.endNode.ID == startNode.ID)){
this.oppositeEdge = e;
e.oppositeEdge = this;
return;
}
}
this... |
9100971e-ce9a-4b61-9354-5fda7d613acf | 1 | public void toggleSidebar() {
this.menuHidden = !menuHidden;
if(menuHidden) mainPanel.remove(getMenuPanel());
else {
mainPanel.add(getMenuPanel(), "dock west, width " + menuPanelWidth + "!");
}
getCodePanel().changeHideIcon(menuHidden);
mainPanel.revalidate();... |
c2ff3980-4af1-46fa-9baf-4a2c243c364e | 8 | public static String getColorString(Color color) {
if(color == Color.YELLOW) {
return "Yellow";
}
if(color == Color.RED) {
return "Red";
}
if(color == Color.GREEN) {
return "Green";
}
if(color == Color.PINK) {
return "Pink";
}
if(color == Color.MAGENTA) {
return "Magenta";
}
if(colo... |
a2aaa7d8-fb0d-41b3-9625-8c025722ce88 | 4 | private boolean inMap(Position pos) {
if (pos.getX() < 0 || pos.getX() >= width) {
return false;
}
if (pos.getY() < 0 || pos.getY() >= height) {
return false;
}
return true;
} |
eabae581-9a6f-4196-81e4-93c13363f7bf | 6 | public static List<AnnotatedRegion> annotateRegions(BotState state, List<Region> toRegions) {
List<AnnotatedRegion> annotatedRegions = new ArrayList<>();
// initialize
for (Region region : state.getVisibleMap().getRegions()) {
if (toRegions.contains(region)) {
annotatedRegions.add(new AnnotatedRegion(regi... |
f5e321e5-256a-44df-abb0-88866ca93ffc | 1 | public int getRYAxisValue() {
if (ryaxis == -1) {
return 127;
}
return getAxisValue(ryaxis);
} |
79c7fb09-6e0b-4c5a-a1e6-909871936e70 | 1 | @Test
public void runTestLogNoLeak() throws IOException {
InfoflowResults res = analyzeAPKFile("AndroidSpecific_LogNoLeak.apk");
if (res != null)
Assert.assertEquals(0, res.size());
} |
5092466f-0011-48c4-8c27-0ad4f90fc438 | 8 | private void parseData(byte[] data, InetAddress address, int port) {
String message = new String(data).trim();
PacketType type = Packet.getPacketType(message.substring(0, 2));
Packet packet = null;
switch(type) {
case INVALID:
break;
case LOGIN:
packet = new Packet00Login(data);
handleLogin((Packet0... |
d4e61c42-e85e-4c9d-b948-98c07a70e26a | 9 | @Override
public List<Schedule> mate(List<Schedule> mates) {
List<Schedule> schedules = new ArrayList<Schedule>();
Map<NFLEvent, List<Integer>> eventWeeks = new HashMap<NFLEvent, List<Integer>>();
for(int i = 0; i < this.getWeeks().size(); i++) {
Day d = this.weeks.get(i).getDay(0);
for(NFLEvent e : ... |
c86bab13-84b5-42fb-b0a1-899abac4b5d9 | 9 | private void acao159(Token token) throws SemanticError{
operador = operadorMult;
if(operador.equals("*") || operador.equals("/")){
if(tipoTermo != Tipo.INTEIRO && tipoTermo != Tipo.REAL){
throw new SemanticError("Operador e Operando incompatíveis", token.getPosition());
}
}else if(operador.equals("e")){... |
bb625544-3205-4e59-9714-dd953992649c | 7 | public static void set1msSuspendTime(int ms) {
if (ms < 1)
throw new EngineException("set1msStopTime( " + Integer.toString(ms) + " ) < 1ms");
if (isStart())
pause();
omsSuspendTimeLocker.lock();
try {
if (ms != suspendTimeCalc.omsSuspendTime) {
... |
e34f9d1e-ba51-406b-b5f2-046ce13e447d | 1 | private void unlock( )
{
try
{
SwingUtilities.invokeAndWait(
new Runnable()
{
public void run( )
{
mainFrame.setLock(false);
}
});
}
catch( Exception exc )
{
FastICAApp.exceptionDialog(exc);
}
} |
8012dae7-a7e5-4783-9a91-fc114ac8efe4 | 9 | private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSearchActionPerformed
String verb = txtSearch.getText();
verb = verb.replaceAll("ي", "ی");
lblClusterResult.setText("");
DefaultListModel verbModel =(DefaultListModel) lstVerbResults.getModel();
... |
01720756-fba8-494d-ac30-026c297e08b6 | 4 | public static void fin(Init init) {
String savefilename = init.testmodule.savefileName;
WriteFile cab = new WriteFile("./Results/" + savefilename + ".xrsbxl2x");
String fileContent = "Correct: " + init.correct + "\nIncorrect: " + init.incorrect
+ "\nName: " + init.testmodule.name + ... |
e560e232-8854-435a-8c75-6d3ffa37c6e2 | 1 | void drawGameElement(Graphics2D graphics, List<ElementInfo> elementInfo, Position position) {
for (Image i : findGameElementImage2(elementInfo))
graphics.drawImage(i, position.xCoordinate, position.yCoordinate, 40, 40, null);
} |
cdf5e38d-e2cb-43ce-8737-7d4920c9d26c | 1 | public int getCardAt(int index){
assert(index >= 0 && index < cards.length);
return cards[index];
} |
bcca02f8-17fb-45e0-8351-30f72c6eaeea | 9 | public void CreateVulnerabilityFiles(DatabaseAccess JavaDBAccess, String TargetPHPFileSelectedComboBox) {
int TARGET_PHP_FILES_ID = 0;
PreparedStatement ps = null;
String diffFile = "";
String PHPFileText; //The text of the PHP file where we want to inject the vulnerabilities
Co... |
645f88bd-4a69-47b2-8f5e-6071f37a2999 | 9 | private static void menu() {
Scanner sc = new Scanner(System.in);
int choice = 0;
while(true) {
System.out.println("** Menu **");
System.out.println("1- Programation Dynamique");
System.out.println("2- Floyd-Warshall");
System.out.println("3- Méth... |
02bf8a3e-0786-41d4-b52c-9649b54b9b9c | 7 | public void actionPerformed(ActionEvent e)
{
if (e.getSource() == toggleButton)
{
if(reportPanel.equals(courseReportPanel)) {
middleLeftPanel.remove(reportPanel);
middleRightPanel.remove(detailsPanel);
reportPanel = instructorReportPanel;
middleLeftPanel.a... |
5fdc73a1-b8b7-4991-95ff-20983af77ca1 | 7 | public ArrayList<Actor> getActors()
{
int r = getLocation().getRow();
int c = getLocation().getCol();
ArrayList<Actor> actors = new ArrayList<Actor>();
//so ugly
for(Location loc : getGrid().getOccupiedLocations())
{
Actor actor = getGrid().get(loc);
if(actor.getLocat... |
38783c86-2672-45fe-9018-1a9df1d2dc38 | 9 | public void testConstants() {
System.out.println();
String[] constantsToTest =
{"True", "False", "and", "or", "xor", "not", "equiv", "implies", "forAll",
"thereExists", "thereExistExactly", "thereExistAtMost", "thereExistAtLeast",
"Dog", "Cat", "Collection", "foo:bar", "#$foo:bar",
... |
bdba1119-7269-4ef3-ab26-5064c0f2e31f | 2 | public void pause() {
for(int x = 0; x<soundEffects.size(); x++) {
soundEffects.get(x).getClip().pause();
}
for(int x = 0; x<tracks.size(); x++) {
tracks.get(x).getClip().pause();
}
background.getClip().pause();
} |
6b0702b5-7833-458d-b4f6-437c48691b41 | 0 | public int getLisiantus() {
return lisiantus;
} |
c7e32a93-4af0-4cbf-a3fc-750dbdc681f2 | 6 | public static int getVacationDays (int activeDays) {
if (activeDays < 5)
return 0;
if (activeDays < 7)
return 1;
if (activeDays < 10)
return 2;
if (activeDays < 13)
return 3;
if (activeDays < 16)
return 4;
if (activeDays < 19)
return 5;
return 6;
} |
aba4516d-6f94-494e-a481-60951da22782 | 8 | public void update() {
test.update();
if (fireRate > 0) fireRate--;
int xa = 0, ya = 0;
if (anim < 7500) anim++;
else
anim = 0;
if (input.up) ya--;
if (input.down) ya++;
if (input.left) xa--;
if (input.right) xa++;
if (xa != 0 || ya != 0) {
move(xa, ya);
walking = true;
} else {
walkin... |
b1961e41-ae12-4a72-b78f-4eafdd18aaa6 | 9 | public void onEnable() {
pm = getServer().getPluginManager();
server = getServer();
pluginDirectory = this.getDataFolder();
String singleOptions[] = new String[] {
"auth_off",
"log_time_off",
"staticlocalhost",
"bridge_connection",
"quiet",
"info",
"debug",
... |
b0971582-0c53-46bc-a424-0187daebc411 | 1 | public CtField[] getDeclaredFields() {
CtMember.Cache memCache = getMembers();
CtMember field = memCache.fieldHead();
CtMember tail = memCache.lastField();
int num = CtMember.Cache.count(field, tail);
CtField[] cfs = new CtField[num];
int i = 0;
while (field != ta... |
2ce971ee-42c9-4214-8f6a-7a1d45cd90f3 | 9 | public boolean deleteDirectory(String sPath) {
//如果sPath不以文件分隔符结尾,自动添加文件分隔符
if (!sPath.endsWith(File.separator)) {
sPath = sPath + File.separator;
}
File dirFile = new File(sPath);
//如果dir对应的文件不存在,或者不是一个目录,则退出
if (!dirFile.exists() || !dirFile.isDirectory(... |
776e6165-bf4a-40cf-ac94-7d554535d9ff | 7 | protected FilenameFilter newFilenameFilter() {
final FilenameFilter ff = new FilenameFilter() {
public boolean accept(final File dir, final String name) {
if (name == null || name.length() == 0) {
return false;
}
final boolean hasEx... |
0940e69e-80bf-4475-b777-fd8ea8b6c60b | 1 | private RunListener selectListener(Description description) {
final TestLink testLink = description.getAnnotation(TestLink.class);
if (testLink != null) {
return inTestLinkListener;
} else {
return noTestLinkListener;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.