method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
928da54f-8f75-49fc-b4f6-b7606b20b349 | 9 | @SuppressWarnings({ "rawtypes", "unchecked" })
void addTypeMapper(String prop, Mapper<? super S, Class> typeMapper,
Map<String, ? extends Collection<Class<?>>> typeFilters)
throws NoSuchFieldException {
if (prop.isEmpty()) {
this.typeMapper = typeMapper;
return;
}
... |
1087b13b-1dbe-481a-a861-643583311c0b | 8 | public ArrayList<Line2D.Double> getLines(JXMapViewer map, Point2D mousePos) {
ArrayList<Line2D.Double> lines = new ArrayList<Line2D.Double>();
if (p1 != null) {
// Initialize variables
Point2D pt1 = null;
Point2D pt2 = null;
Point2D middle = null;
... |
43bb89ce-43b6-4127-ac44-3e99d94a8750 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Block other = (Block) obj;
if (myID != other.myID)
return false;
return true;
} |
2de20bc9-26f2-485d-bacb-99da27572f33 | 3 | public void scaleRect(Vector cursor)
{
if (pModel.hasSelectedObject() && !pModel.hasMultiSelectionObjects() &&
pModel.getSelectedObject() instanceof Square)
{
Square rect = (Square) pModel.getSelectedObject();
Vector localCursor = Util.minus(curs... |
9919d4f8-5118-467e-b99f-ab07d1fdf77d | 8 | void printMenu(){
int op = 0;
boolean accept = false;
do{
try{
Prints.printlnWithColor("CYAN","1- Jugar Connect Four \n"
+ "2- Reportes \n"
+ "3- Mi Perfil \n"
+ "4- Cerrar Sesion \n");
... |
da689682-2d78-4ca3-a953-1510d61ab016 | 1 | public boolean getUndoEnabled() {
return this instanceof UndoInterface && undoEnabled;
} |
7523b406-8857-4af7-aec2-b9538737f34a | 3 | public void launch(final File workflowFile, final List<Variable> inheritedVariables) {
final Workflow workflow;
try {
workflow = (Workflow) UNMARSHALLER.unmarshal(workflowFile);
} catch (final JAXBException e) {
throw new AzotException(e);
}
if (workflow != null)
{
final WorkflowStarter workflowS... |
407b93f9-e4d9-49ba-925d-de2695f728cb | 6 | public void actionPerformed(ActionEvent event) {
String eventName = event.getActionCommand();
switch (eventName) {
case "TicketField":
lookupTicket();
break;
case "LicenseField":
lookupLicense();
break;
case "LostTicket":
lostTicket();
break;
case "PayCash":
exitUI.enableFindTick... |
1f7102c6-1c06-41d0-920c-ad602d403484 | 0 | protected long counter() {
synchronized (this) {
return counter++;
}
} |
4f5eb534-d0a2-4b3e-8512-e24e6a224b17 | 3 | public void exibirMensagensCliente() {
int contador = 1;
Thread tratarRequisição;
try {
socketServidor = new ServerSocket(6000);
while (true) {
//System.out.println("Escutando os clientes na porta 6000...");
socketRecepcao = socketServidor... |
1c03a3ac-2202-4f1f-ae56-2d694b137dbd | 4 | protected static void divide_INT_PACK_Data(WritableRaster wr) {
// System.out.println("Divide Int");
SinglePixelPackedSampleModel sppsm;
sppsm = (SinglePixelPackedSampleModel) wr.getSampleModel();
final int width = wr.getWidth();
final int scanStride = sppsm.getScanlineStride(... |
b69b43c0-9265-4efd-912a-73ee53f35cb7 | 3 | public void deleteTeam() {
if (id != null) {
PreparedStatement st = null;
String q = "DELETE FROM team WHERE id = ?";
try {
conn = dbconn.getConnection();
st = conn.prepareStatement(q);
st.setInt(1, this.id.intValue());
... |
4757aec4-f079-41a3-8eaf-d04eab821365 | 4 | public String GetCodeClasseByIndex(int indexClasse){
//String columnNames[] = { "Lib Classe"};
//defModel.setColumnIdentifiers(columnNames);
Vector<String> VectorClasse= new Vector<String>();
try {
DriverManager.registerDriver(new oracle.jdbc.driver.Ora... |
54b0a7b2-1ec3-4d40-bf9b-b5cf6fd961dd | 6 | public SortedMap<Integer,AbsStatementNode> executeCompiler() throws CompilationException
{
try
{
SortedMap<Integer,AbsStatementNode> code = new TreeMap<Integer,AbsStatementNode>();
this.symbolTable.clear();
statements(code);
return code;
}
catch(Pa... |
e3aff487-889d-4586-8b75-0fe15156801b | 4 | public double train(Collection<_Doc> trainSet){
super.init();
m_classifier.train(m_trainSet);
m_L = m_trainSet.size();
m_U = m_testSet.size();
m_labeled = m_trainSet;
int clusterNo;
//Init hashmap.
for(int i=0; i<m_kmeans; i++)
m_clusterNoDocs.put(i, new ArrayList<_Doc>());
//Split t... |
53355a2f-29bc-4d8e-83bf-e2d9f36fafa1 | 0 | @Test
public void testCalculateAdjacentAnts() throws Exception {
System.out.println("calculateAdjacentAnts");
World world = new World();
world.generateRandomContestWorld();
Cell instance = new Cell(2,2);
Cell cell0 = new Cell(2,3);
AntBrain ab = new AntBrain(... |
e020c709-cc07-415e-9c3b-5b87e1db5989 | 3 | public TypedObject getResult(int id)
{
while (connected && !results.containsKey(id))
{
sleep(10);
}
if (!connected)
return null;
TypedObject ret = results.remove(id);
return ret;
} |
cc58617d-bdb7-4345-986b-ea3804b9ab9a | 0 | private DataLayerManager() {
} |
be903ca4-f949-4f3d-a769-ecdb9e9106dc | 3 | public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
int index = comboBox.getSelectedIndex();
if ((index >= 0) && (index != month)) {
setMonth(index, false);
}
}
} |
f05113aa-2ab2-463b-8ae9-ccb3595b0128 | 9 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((msg.source().location()!=null)
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&((msg.value())>0)
&&(msg.tool()==affected)
&&(!notAgain)
&&(msg.target() instanceof MOB)
&&(!((MOB)msg.target()).a... |
5e14daf7-661d-42bf-8c41-9c504e97fbea | 8 | public static void addToSheet (String input_file_name, String output_file_name) {
// Picks 9 reference points which are along the boundary and the center. (need to know low_x, low_y, max_x, max_y)
//double x_min = 317900;
//double x_max = 317998;
//double y_min = 4367500;
//double y_max = 4367815;
int row... |
38d7ea8c-2de4-41cc-a91a-1b16302f8d57 | 3 | public Menu(){
int op=0;
System.out.println ("Bem Vindo!");
System.out.println("1- Registar Despesas\n2- (...)\n0- Sair\n");
switch(op) {
case 1: new MenuDespesas();break;
case 2: ; break;
case 0: System.exit(0);break;
default:
... |
9b4e817e-39ed-419f-bb8a-07104f24c704 | 6 | private void quicksort(int low, int high) {
int i = low, j = high;
//Get the pivot element from the middle of the list
int pivot = numbers[low + (high-low)/2];
//Divide into two lists
while (i <= j) {
//If the current value from the left list is smaller then the pivot
// element then get the next elem... |
7f848b4b-bdf3-44cc-bd4a-c8de57be436d | 1 | private void renderChosenDirection() {
if (validChosenDirection())
label.setText(getChosenDirection().toString());
} |
cedbd66e-b0fa-42f3-ba0e-c42e436c7d11 | 1 | private void appendComa(final int i) {
if (i != 0) {
buf.append(", ");
}
} |
3344e3be-dfd5-483b-b5fd-158e85f33de7 | 7 | private static <T> Entry<T> mergeLists(Entry<T> one, Entry<T> two) {
/* There are four cases depending on whether the lists are null or not.
* We consider each separately.
*/
if (one == null && two == null) { // Both null, resulting list is null.
return null;
}
... |
6bb71428-eeaa-4063-ac72-94547e63d130 | 2 | public static int fib(int x) {
if ( x ==0) {
return 1;
}
if ( x ==1) {
return x;
}
else {
return fib(x - 1) + fib(x-2);
}
} |
c8746bd0-280d-4867-8485-055556776082 | 1 | public boolean hitBottom()
{
if(nextY() >= yMin+yMax)
return true;
return false;
} |
2c591bec-7a9c-4de2-a933-37e58fda3f36 | 9 | public boolean contains(Mark m) {
if(m.top() && m.right()) {
return m.x*m.x + m.y*m.y < radius*radius / 4;
} else if(m.top() && (m.left() || m.middle())) {
return m.x > -radius && m.y < radius / 2;
} else if((m.bottom() || m.vmiddle()) && m.right()) {
return 2... |
3bfeeb4c-23cf-4e9b-ba4d-4df9cc0b1031 | 3 | public void close() {
// System.out.println("MIDI close called");
if(state == CLOSED) return;
if(state == STARTED) {
deallocate();
}
closeImpl();
state = CLOSED;
if(autoNotify){
startListenerNotification(PlayerListener.CLOSED, null);
}
... |
35c07d1a-0d4c-49b4-bf89-dc195e5afb72 | 9 | public boolean detectAmbiguities(DetectionMethod method) {
IPairGraph pg = createPairGraph(method);
pg.init(nfa, monitor);
if (!pg.detectAmbiguities()) {
return false;
}
if (!pg.potentiallyAmbiguous()) {
if (config.findHarmlessProductions) {
harmlessProductions = nfa.grammar.productions;
h... |
e2de0373-ca1c-446b-b821-0f23c0162e50 | 5 | @Override
/**
* This method will be used by the table component to get
* value of a given cell at [row, column]
*/
public Object getValueAt(int rowIndex, int columnIndex) {
Object value = null;
Submission submission = submissions.get(rowIndex);
switch (columnIndex) {
case COLUMN_PROBLEM:
value = su... |
6bd3e113-3863-4031-aecd-a651c0dcdcaf | 8 | public static Cons yieldSlotValueReaderTree(Symbol slotname, Stella_Object objectref, Surrogate objecttype) {
if ((objecttype == Stella.SGT_STELLA_CONS) &&
((List)(Stella.$CURRENT_STELLA_FEATURES$.get())).membP(Stella.KWD_USE_COMMON_LISP_CONSES)) {
if (slotname == Stella.SYM_STELLA_VALUE) {
re... |
ae614f8e-79bc-4203-9b98-4b71bb3b57be | 0 | public int hashCode() {
return this.laenderMap.hashCode();
} |
f2dc21c3-32b6-4eb5-a6da-c1eaf14e7c76 | 1 | public void setCommands(List<Command> commands) {
rootElement.find("commands command").remove();
Match container = rootElement.find("commands");
container.text("");
for (Command c : commands) {
container.append( $("<command></command>") );
Match element = contain... |
4d355be2-1abd-42c1-8d3e-1f27d5f9709e | 4 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if(rectangles != null) {
Iterator<Map.Entry<Integer, Point>> it = rectangles.entrySet().iterator();
while(it.hasNext()) {
Map.Entry<Integer, Point> entry = it.next();
Point p = entry.getValue();
g.drawRect(p.x - 5, p.y - ... |
1ecdc4d7-098d-4919-94ee-c1db9b0f387b | 1 | private boolean saveWave(byte buf[], int id) {
return buf == null || Signlink.wavesave(buf, id);
} |
650b1ef8-bbc8-42a0-9890-434039d0727a | 3 | public Move chooseMove(State s) {
// remember who we are so we can correctly evaluate states
me = s.whoseTurn();
// The rest of this function looks a lot like evalMove, except
// that it doesn't just track the minimaxvalue, but also the
// best move itself.
// get a list of possible moves
MyList moves = s.find... |
6d48fc20-a644-415f-813f-1816b0b1e163 | 3 | public void movePiece(Position startPos, Position destPos)
throws IllegalPieceMovementException {
int startX = startPos.getX();
int startY = startPos.getY();
int destX = destPos.getX();
int destY = destPos.getY();
if (board[destX][destY] == BOUNDARY) {
th... |
da2b4126-8c58-495a-aea6-fc7424e8070e | 3 | protected boolean isSolidTile(int xa, int ya, int x, int y){
if(level == null) return false;
Tile lastTile = level.getTile((this.x + x)>>3,(this.y+y)>>3);
Tile newTile = level.getTile((this.x + x + xa)>>3, (this.y + y + ya) >> 3);
if(!lastTile.equals(newTile) && newTile.isSolid()){
return true;
}
return ... |
4c058e70-3c67-4dbc-9e26-f9e9c38d5ad0 | 7 | public void unzipFile(String targetPath, String zipFilePath) {
try {
File zipFile = new File(zipFilePath);
InputStream is = new FileInputStream(zipFile);
ZipInputStream zis = new ZipInputStream(is);
ZipEntry entry = null;
System.out.println("开始解压:" + zipFile.getName() + "...");
while ((entry =... |
01a89eed-d946-498c-a134-9099b3125963 | 2 | private void checkIfCanPlay() throws MissingPlayers, MatchIsOver {
if(players.size() < 2) throw new MissingPlayers();
if(null != matchWinner) throw new MatchIsOver();
} |
ad61d74e-1289-4553-8894-6f6b47f7f2e0 | 3 | private void toggle() {
if (Status.DESELECTED == getStatus()) {
setStatus(Status.SELECTED);
} else if (isToggleEnabled() && Status.SELECTED == getStatus()) {
setStatus(Status.DESELECTED);
}
} |
60437fc6-1301-4395-a4ac-f5e1b811f6d5 | 5 | @Override
public RoleSchool addRoleSchool(String json, long id) {
RoleSchool role = trans.fromJson(json, RoleSchool.class);
if (json.contains("Teacher")) {
role = trans.fromJson(json, Teacher.class);
}
if (json.contains("Student")) {
role = trans.fromJson(json... |
cb833c1c-21c1-4ab1-a4f9-93ed0aa0a5a6 | 4 | private static JMenu getTestMenu(EnvironmentFrame frame) {
Environment environment = frame.getEnvironment();
JMenu menu = new JMenu("Test");
Serializable object = environment.getObject();
if (DFAEqualityAction.isApplicable(object))
addItem(menu, new DFAEqualityAction(
(automata.fsa.FiniteStateAutomaton... |
100d36e4-ff18-4005-81f2-d6a14f7b4591 | 9 | @Override
protected Void doInBackground() throws Exception {
//InetAddress addr=InetAddress.getLocalHost();
Socket sock=null;
ServerSocket serverSock=new ServerSocket(PORT);
try {
while (true) {
sock=serverSock.accept();
sockIn=s... |
f38922c2-4b53-4e47-be44-7974e894174d | 5 | @Override
public int addNewBid(String auctionId, String bidPrice, String userName) {
// Declare a bidStatus variable, where 0 = bid accepted. 1 = wrong bid price (too low). 2 = expired bid
int bidStatus = 0;
System.out.println("++++++++ START addNewBid()++++++++++");
TypedQuery<Bid> bidQuery = emgr.createNamed... |
655c381d-f453-4f4b-8b50-6daeaaf9f291 | 5 | @Override
public void mouseWheelMoved(MouseWheelEvent e) {
int notches = e.getWheelRotation();
if (notches > 0) {
if (currentTool == Tool.DOT) {
currentTool = Tool.SPRAY;
} else if (currentTool == Tool.SPRAY) {
curre... |
6d49f496-9475-4bcf-b03d-88d0c214738c | 0 | Rook(int t, boolean w, int x, int y){
super(t,w,x,y);
dist = 7;
int[][] ex = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
moves = ex;
} |
b9737648-622d-4eb2-9205-6dbb9c7cf7e4 | 4 | public void saveGame(JFrame frame) {
JFileChooser fileChooser = new JFileChooser(".");
int result = fileChooser.showSaveDialog(frame);
if (result == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
if (file.exists()
&& JOptionP... |
7c1e6d42-c802-4e85-861b-6006f3e05d13 | 3 | public Image getImage(){
switch(anim){
case 0: return image1;
case 1: return image2;
case 2: return image3;
default: return image4;
}
} |
49a94b9c-ed6a-4b20-9e32-debc8fb6bb3d | 2 | public static boolean isSquare(int number) {
if (number < 0) {
throw new IllegalArgumentException("Error: int cannot be < 0!");
}
if (Math.sqrt(number) % 1 == 0) {
return true;
}
return false;
} |
349d9c7b-df32-4fd1-ba22-d51434fa319e | 0 | protected void extractLZMA(String in, String out) throws Exception
{
File f = new File(in);
File fout = new File(out);
LzmaAlone.decompress(f, fout);
f.delete();
} |
6c5b0bbd-59f9-46fb-a8c8-31e6f2ce3e45 | 0 | public Hurdle getHurdle(int index) {
return hurdleList.get(index);
} |
71b5b8a1-9ac8-47dd-93b7-8668ab830f11 | 4 | public String getParameterString(){
String retString = super.getParameterString();
if(useMetaData!=null) retString+="&useMetaData="+(useMetaData?"1":"0");
if(extractLinks!=null) retString+="&extractLinks="+(extractLinks?"1":"0");
return retString;
} |
ed221a03-8553-4f33-b0f3-759a85e70ce8 | 6 | public void onBlockRemoval(World par1World, int par2, int par3, int par4)
{
TileEntityDispenser var5 = (TileEntityDispenser)par1World.getBlockTileEntity(par2, par3, par4);
if (var5 != null)
{
for (int var6 = 0; var6 < var5.getSizeInventory(); ++var6)
{
... |
7d2a2b14-af48-457d-a3e4-64656c3e2fe8 | 9 | @Override
// Supports in place resampling
public void superSample(int[] input, int[] output)
{
final int st = this.stride;
final int dw = this.width * this.factor;
final int dw2 = dw + dw;
final int dh = this.height * this.factor;
final int sh = this.height;
final int sw = t... |
0d3fdf92-dc40-4e5f-9628-4dc6d02ffd9b | 6 | boolean judge(TreeNode node1, TreeNode node2){
if(node1 == null && node2 == null)
return true;
if(node1 == null || node2 == null || node1.val != node2.val)
return false;
return judge(node1.left, node2.right) && judge(node1.right, node2.left);
} |
a3b358b9-7e03-4af8-b8f4-2318fda3e6ad | 2 | public Deck() {
this.deck = new Card[52];
this.suites = new char[4];
suites[0] = 'h';
suites[1] = 'c';
suites[2] = 'd';
suites[3] = 's';
this.numInDeck = 0;
for (int i = 1; i < 14; i++) {
for (int j = 0; j < 4; j++) {
Card aCard = new Card(i, suites[j]);
deck[numInDeck] = aCard;
numInDeck... |
d41103e3-2968-485e-866b-cb18d6d48f26 | 2 | private void Escalao_ComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_Escalao_ComboBoxItemStateChanged
Equipa_ComboBox.removeAllItems();
String escalao = "Escalao.";
Escola escola = a.getDAOEscola().get(Escola_ComboBox.getSelectedItem().toString());
if (escola !=... |
e7766307-2c95-46df-81d8-692ab7aeb7e9 | 9 | public int compareCS(CharSequence a, CharSequence b) {
int alen = a.length();
int blen = b.length();
int i = 0;
int j = 0;
while (true) {
if (i == alen) {
if (j == blen) {
return 0;
} else {
retur... |
ffefded7-e830-41f3-b2fb-73ba94b2fbc5 | 4 | private static Point2D modTile(final Point2D t) {
final Tile center = getMapCenter();
Player p = Players.getLocal();
if (p == null)
return null;
final Tile me = p.getLocation();
if (me == null || center == null || t == null)
return null;
return new Point2D.Double(t.getX() + me.getX() - center.getX(), ... |
06f0d2d1-afbb-4059-8721-8e5884f5b491 | 1 | private void notifyListeners()
{
for (RoundListener listener : listeners)
listener.onRoundChanged(round, maxRound);
} |
befc6da5-dcb0-4e52-8404-a2737bd83b65 | 5 | public String setRSET() {
int count = 0;
File rsetFile;
String rsetFileName;
for (File box : dir.listFiles()) {
for (File file : box.listFiles()) {
if (file.isFile() && file.getName().endsWith(".mail")) {
count++;
rset... |
d2f72780-d334-4914-9283-99668f6bff99 | 6 | public void draw(Graphics g, int tile) {
int col = -1;
for (int i = 0; i < board.length; i++) {
col = -col;
for (int n = 0; n < board.length; n++) {
//Checkers the board
if (col == 1) {
g.setColor(bBlack);
} else... |
41f3e5c3-f198-4ec7-a733-e09f635f18a7 | 5 | public static void writeRunAllInitScript(ArrayList<String> tl){
ArrayList<String> initScript=rfa.readInputStream(GenerateInitScripts.class.getResourceAsStream("config/init/runAllInit.sh"),"UTF-8");
StringBuffer fileContent=new StringBuffer();
for(int i=0; i<initScript.size(); ++i){
i... |
04fd2945-892b-40bb-b65b-d64f110731fa | 3 | public void verify() throws MVDException
{
if ( data == null && parent == null && versions.nextSetBit(0) != 0 )
throw new MVDException(
"data in pair is null and it is not a child or hint");
} |
db196c7a-c132-4f77-b7f4-5aebe1032f3e | 1 | public Booking find(long id) throws InstanceNotFoundException {
try {
return bookings.get((int) id);
} catch (IndexOutOfBoundsException e) {
throw new InstanceNotFoundException(id, "Booking");
}
} |
ad99cb8b-fba6-4e9c-8df6-c46a10ebc99a | 0 | public FilteredSoundStream(InputStream in,
SoundFilter soundFilter)
{
super(in);
this.soundFilter = soundFilter;
remainingSize = REMAINING_SIZE_UNKNOWN;
} |
69786cbb-ed45-49f9-99d7-6abe4a9b6d0f | 8 | public Emotiv_trial_recorder(){
try {
sender = new OSCPortOut();
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SocketException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-ge... |
c9f86cfa-96a3-46c7-8344-72d28d312b7b | 8 | private void debugPrintMoveList() {
for(int move : moveList) {
switch(move) {
case Move.RIGHT:
System.out.println("right");
break;
case Move.DOWN:
System.out.println("down");
break;
case Move.UP:
System.out.println("up");
break;
case Move.LEFT:
System.out.println("left");
... |
745ebd50-6080-4732-beeb-ca6a34c433f0 | 6 | public void run() {
blocks.add(new Block(50, 50, 0xff00ff));
for (int y = 0; y < 50; y++) {
for (int x = 0; x < 50; x++) {
blocks.add(new Block(25 + x * 25, 25 + y * 25, random.nextInt(0xff)));
}
}
// blocks.add(new Block(250, 250, random.nextInt(0xff)));
// Arrays.binarySearch(blocks.toArray(), bl... |
3e511ed3-a09e-4d54-b748-b5a089a40e41 | 0 | public void request() {
System.out.println("this is in Adapter!");
// 可能转调已经实现了的方法,进行适配
adaptee.specificRequest();
} |
059c1819-3e8b-465b-bc53-23a0285d940a | 8 | public void add(final K key) {
Future<?> future=timer.schedule(new Runnable() {
public void run() {
if(handler != null) {
try {
handler.expired(key);
}
catch(Throwable t) {
}
... |
4247d882-78ef-4827-a92b-5828cf83bbac | 0 | private void menuFichierQuitter() {
System.exit(0);
} |
be13f1b4-77d1-4a2e-b711-6ee2b2db0464 | 7 | public void run(){
try {
Socket connexion = serverSocket.accept(); //Creates the connection.
//System.out.println("server accepted a connexion");
GameManager.gameIsRunning = true;
DataOutputStream output = new DataOutputStream(connexion.getOutputStream());
DataInputStream input = new DataInputStream(c... |
a705f7c4-75c7-4822-9e81-cb772f5b3602 | 3 | private void removeDeadParticles() {
for (int particleIndex = 0; particleIndex < particleArray.length; particleIndex++) {
if (particleArray[particleIndex] != null) {
if (particleArray[particleIndex].isParticleAlive() == false) {
particleArray[particleIndex] = null... |
5d31e577-d7ae-48e3-b643-4f1a1b4e9fb7 | 4 | public boolean faire(Commande nouvCommande) {
if(nouvCommande != null){
if(nouvCommande.faire()){
//Suppression des commandes annul�es
while(this.commandes.size() > this.indiceDerniereCommande+1){
this.commandes.remove(commandes.size()-1);
}
//Suppression des commandes les plus vieilles si l... |
60e3c794-ba0c-4e78-9bb0-1841da3bf0d2 | 3 | private String checkPass(String message) {
String response;
String[] temp = message.split(" ");
if (temp.length >= 2) {
if (userName == null) {
response = "-ERR No User was registered";
} else if (internAccounts.get(userName).equals(temp[1])) {
// Benutzer hat sich erfolgreich eingeloggt. -> Transac... |
f5bc0e0e-39ab-4415-b93e-70930d62b2c5 | 7 | public void initImage(int w, int h, int offset) {
int i, j;
PixelFormat pf = im.getPF();
int[] stride = new int[]{w};
Object data_ = im.getRawPixelsRW(stride);
if (pf.is888() && data_ instanceof int[]) {
int[] data = (int[])data_;
for (j = 0; j < h; j++) {
for (i... |
1090238d-d9cf-4d82-9459-56f217ca7d76 | 5 | public boolean fit(Unit user, Unit target, int userTeam){
if(!targetUnit){
System.out.println("Targeting : fit : Target did not fit as this targeting does not use a unit");
return false;
}
else if(allies && target.team!=userTeam){
System.out.println("Targeting... |
a5ed7e7a-ef13-4f45-945d-e94d6e258a55 | 8 | @Override
public Object evaluate(ArrayList<Context1> pila) throws Exception {
inicio.evaluate(pila);
pila.add(new Context1());
String variable = ((DeclaracionEvaluator) (inicio)).getNombre();
TermEvaluator termino = new TermEvaluator(variable);
StringBuilder output = new StringBuilder();
int conta = 0;
w... |
27e3a96d-aeff-4ade-ae42-92b6b9afed72 | 0 | public static void question9() {
/*
QUESTION PANEL SETUP
*/
questionLabel.setText("You feel more like watching TV or running now?");
questionNumberLabel.setText("9");
/*
ANSWERS PANEL SETUP
*/
//resetting
radioButton1.setSelected(false);
... |
5f14fc74-8b0e-44f8-b69f-0f44e1ef574a | 2 | public static String hash(String algorithm, String str) {
StringBuilder ret = new StringBuilder();
byte[] bytes = null;
try {
MessageDigest hash = MessageDigest.getInstance(algorithm);
bytes = hash.digest(str.getBytes("UTF8"));
} catch (Exception e) {
}
for (byte b : bytes) {
ret.append(toHex(b))... |
e7f9360e-629f-40ea-8e58-25af3e03fa43 | 6 | private boolean readBBFileHeader(long fileOffset) {
BBFileHeader bbHeader = null;
LittleEndianInputStream lbdis = null;
DataInputStream bdis = null;
byte[] buffer = new byte[BBFILE_HEADER_SIZE];
try {
// Read bigBed header into a buffer
fis.seek(fileOf... |
5762bb90-797d-458c-b5f2-20b301237ad7 | 7 | @Override
protected void process(Map<String, Object> jsonrpc2Params) throws Exception {
if (method.equals(Constants.Method.CREATE_REPLY)) {
createReply(jsonrpc2Params);
} else if (method.equals(Constants.Method.MODIFY_REPLY)) {
modifyReply(jsonrpc2Params);
} else if (... |
14456f0e-1601-4e42-aa78-2ace0421885b | 2 | public void draw(Graphics graphics, int x, int y) {
if (isRememberingData()) {
final Color color = graphics.getColor();
graphics.setColor(Color.red);
graphics.drawRect(x - 15, y - 22, 22, 20);
graphics.drawString(rememberedData.toString(), x - 12, y - 5);
... |
2b39acc2-2821-46de-9871-d18da7d96684 | 1 | public void execute(Miner miner){
//deposit the gold
miner.addToWealth(miner.goldCarried());
miner.setGoldCarried(0);
System.out.println(miner.getName() + " Depositing gold. Total savings now: " + miner.wealth());
//wealthy enough to have a well earned rest?
if (miner.wealth() >= Miner.Co... |
2e836e2d-30b2-4e7b-af38-599ad56a3bb2 | 4 | private int getOffsetY(int rowStartOffset, FontMetrics fontMetrics)
throws BadLocationException
{
// Get the bounding rectangle of the row
Rectangle r = component.modelToView( rowStartOffset );
int lineHeight = fontMetrics.getHeight();
int y = r.y + r.height;
int descent = 0;
// The text needs to be ... |
7eb4b5c2-960d-4fad-bd48-6811b1444ea6 | 4 | public void makeTrail() {
if (body.hasTrail){
if (dont > freq) {
for (int i = path.length - 1; i > 0; i--) {
path[i] = path[i - 1];
}
path[0] = body.position.clone();
if (body.parent != null) {
path[0].subtract(body.parent.position);
}
dont = 0;
}
dont += freq;
}
} |
1ed039ad-2bae-4500-9fb1-156ce50786c4 | 3 | public Writer writeTag(Object tag, int componentCount) throws IOException {
Integer shortcutCode = tagToCode.get(tag);
if (shortcutCode != null) {
writeCode(shortcutCode);
} else {
int index = getStructCache().oldIndex(tag);
if (index == -1) {
... |
4e592f6f-0c54-4225-ba03-74e0c55573bd | 4 | public boolean hit(double nx, double ny){
if(getX()+2*getRadius()>nx && getX()-2*getRadius()<nx
&&
getY()+2*getRadius()>ny && getY()-2*getRadius()<ny
){
return true;
}
return false;
} |
afa4f75b-f26a-4c40-9054-7937917d753d | 3 | @Override
public void ParseIn(Connection Main, Server Environment)
{
Environment.InitPacket(36, Main.ClientMessage);
String PetName = Main.DecodeString();
int len = PetName.length();
if(len < 3)
{
Environment.Append(2, Main.ClientMessage);
Environ... |
7d3359b0-ec88-4362-94a6-7b62373f4e62 | 8 | public static void updateMeters() {
for (IMeter meter : currentMeters) {
if (meter.tooltip == null)
continue;
String meter_info = ((String) meter.tooltip).replaceAll(
"[^\\d/%]+", "");
if (meter.name.contains("nrj")) {
playe... |
2cd3df2b-7d1e-4fcd-97ca-8f08a6761a95 | 4 | static BloatContext makeContext(final String classpath,
final String outputDirName) {
final ClassFileLoader loader = new ClassFileLoader();
if (classpath != null) {
loader.prependClassPath(classpath);
}
// if(TRACE) {
// loader.setVerbose(true);
// }
BloatBenchmark.tr(" Creating a BloatContext fo... |
c047348f-3a64-49b5-821d-cd5bc8bc76ef | 8 | public static boolean isValidXmlIdentifier(String s) {
if (s != null) {
int len = s.length();
if (len == 0) {
return false;
}
for (int i = 0; i < len; i++) {
char ch = s.charAt(i);
if ( (i == 0 && !Character.isUnicod... |
c3b228fe-0364-48e4-8395-c09f40ffb2f8 | 7 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == NewGameMenuItem) {
if (confirmQuit("New Game")) {
new Game();
}
}
else if (e.getSource() == OptionsMenuItem) {
Game.pauseGame();
new Options();
}
else if (e.getSource() == ExitMenuItem) {
if (confirmQuit("Exit")) {
Sys... |
b7e9c2ec-a5ca-471d-b909-5e22f897911d | 6 | public static List<String> fetchCloudStorageUris(String bucketName, String startKey, String endKey, HttpRequestFactory requestFactory) throws IOException {
List<String> result = new ArrayList<String>();
String bucketUri = "http://commondatastorage.googleapis.com/" + bucketName;
HttpRequest request = requestFac... |
820737f6-1263-4897-b6cf-7e874816cc7c | 8 | public void deleteFolder(String bucket, List<String> listFolders) throws Exception{
ListObjectsRequest listObjectsRequest;
ObjectListing objectListing;
for(String folderItem : listFolders){
if(!folderItem.trim().equalsIgnoreCase("/") && !folderItem.isEmpty()){
try {
... |
c5fefb08-ae7f-44d5-8ef3-c9beca09f654 | 6 | public boolean existeUser (String Nick) {
//verificar logueo
String nombre="";
boolean flag =false;
try {
String queryString = "Select nick from Usuarios where nick = ?";
connection = getConnection();
ptmt = connection.prepareStatement(queryString);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.