method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cb4cdf2e-fea1-45fc-9d7f-b0c29b154422 | 5 | public boolean metodoCompare(Pessoa u ){
if (this.end.equals(u.getEnd()) && this.nome.equals(u.getNome())
&& this.login.equals(u.getLogin()) && this.senha.equals(u.getSenha())
&&(this.id.equals(getId()))){
return true;
}
return false;
} |
7d54e630-ae9a-43f0-bbfc-e30824a63c48 | 0 | public static void printComponent(JComponent c) {
new PrintUtilities(c).print();
} |
15e63f2c-7e3b-4ee9-a37e-f5aaf834784f | 7 | private void traverseTerminalStrings(Item i) {
if (i.shifts != null) {
for (Transition t : i.shifts) {
q.add(t);
traverseTerminalStrings(t.target);
q.pop();
}
} else {
Symbol[] str = new Symbol[q.size()];
for (int j = 0; j < q.size(); ++j) {
str[j] = q.get(j).label;
}
// ad... |
059d39da-7cb8-4154-a733-f78b8a2bc62b | 0 | public void create(T entity) {
getEntityManager().persist(entity);
} |
b1ae947d-1749-4bde-83ea-b440fb8965c2 | 9 | public void act() {
//Check voor victims binnen bereik. Voeg punten toe en verwijder victim wanneer gevonden.
List<Actor> victims = getObjectsInRange(radius, Victim.class);
for (Actor victim : victims) {
HelicopterWorld world = (HelicopterWorld)getWorld();
world.addScore(... |
6b5e473e-97ee-472c-8bf3-c6e7365468a2 | 4 | public static Class<?> resolvePrimitiveClassName(String name) {
Class<?> result = null;
// Most class names will be quite long, considering that they
// SHOULD sit in a package, so a length check is worthwhile.
if (name != null && name.length() <= 8) {
// Could be a primitive - likely.
result = primitiveT... |
66777326-dd5c-4779-af72-6edb6ac005bc | 4 | public void bowSpecc()
{
if(IsAttackingNPC && playerEquipment[playerWeapon] == 861)
{
setAnimation(426);
actionTimer = 4;
SpecDamgNPC(15);
DDS2Damg = true;
DDStimer = 1;
resetAnimation();
teleportToX = absX;
teleportToY = absY;
... |
67aed168-f11f-40ec-a26c-cea50755d8bc | 6 | Verzameling complement() {
universum = new int[100];
complementArray = new int[universum.length - elementen.length];
for(int i = 0; i < 100; i++)
universum[i] = i + 1;
for(int i = 0; i < 100; i++)
for(int j = 0; j < elementen.length; j++)
if(universum[i] == elementen[j])
universum[i] = 0;
... |
76d85fd0-2915-4360-8105-22dcea4aadd9 | 9 | void movePieces(Project2_Move_Thompson m) {
int fromRow = Project2_Board_Thompson.ROW(m.from);
int fromCol = Project2_Board_Thompson.COL(m.from);
int toRow = Project2_Board_Thompson.ROW(m.to);
int toCol = Project2_Board_Thompson.COL(m.to);
square[toRow][toCol].setIcon(new ImageIc... |
ba685f1f-27c7-4199-b826-9ae38f590be1 | 8 | public static Cons allSupportedNamedSubcollections(LogicObject self) {
{ MemoizationTable memoTable000 = null;
Cons memoizedEntry000 = null;
Stella_Object memoizedValue000 = null;
if (Stella.$MEMOIZATION_ENABLEDp$) {
memoTable000 = ((MemoizationTable)(Logic.SGT_LOGIC_F_ALL_SUPPORTED_NAMED... |
a33a552b-e592-43ac-9caa-12c83037bc45 | 6 | public void run() {
System.out.println(LoadBalancer.getCurrentTime() + "::" +"Starting Status checker thread");
serverInfo server;
String status;
while(true) {
try {
//System.out.println("StatusChecker: Before Acquire");
ConnectionTable.serverListLock.acquire();
//System.out.println("StatusCheck... |
167b90e1-3d85-4b96-849b-5430e73f5385 | 2 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
int N = Integer.parseInt(str.split(" ")[0]); // length of freeway
int T = Integer.parseInt(str.split(" ")[1]); // tests
String []wid = sc.nextLine().split(" ");
int []width = new int[N];
// conver... |
68938ca9-834b-41da-994e-d468ac6d1799 | 9 | public void guardarLuminaria() {
verificarSeleccionParametricasLuminaria();
if (puntoLuz.getLuminaria().getId() == null) {
luminariaFacade.create(puntoLuz.getLuminaria());
} else {
if (puntoLuz.getLuminaria().getBalasto().getFabricante() != null) {
punto... |
62805ffc-f347-4ba0-9c77-4ae3d1a76645 | 6 | public ItemStack getPrayItem(Player p) {
for(ItemStack i : p.getInventory()) {
if(i == null) continue;
//material equals
if(!i.getType().equals(ConfigHandler.prayItem) || !i.hasItemMeta())
continue;
//another check -.-
if(!i.getItemMeta().hasDisplayName())
continue;
//has correct name
... |
c00ed934-5f83-4027-b224-12545594abfe | 7 | @Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
String htmltext = getNoQuestMsg();
QuestState st = player.getQuestState(qn);
if (st == null)
return htmltext;
NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
html.setFile(HTML);
StringBuffer sb = new StringBuffer(20);
... |
bfe499b0-facc-461e-8546-1fafd1e84281 | 5 | public void run () {
if (TRACE) trace("kryonet", "Server thread started.");
shutdown = false;
while (!shutdown) {
try {
update(250);
} catch (IOException ex) {
if (ERROR) error("kryonet", "Error updating server connections.", ex);
close();
}
}
if (TRACE) trace("kryonet", "Server thread st... |
037f8b18-39ea-4f9d-9c77-a2e2f40bc980 | 7 | public static void main(String args[]) {
SrtProcessor processor = new SrtProcessor("in/subs/Lecture_1_The_Nature_of_Images.srt");
// for (String p : processor.getParagraphedScript()) {
// System.out.println("<p> " + p);
// }
System.out.println(processor.toXMLFile("lecture1.xml")... |
7cce9e47-b870-49d8-b333-1bd27086dfbd | 9 | public void stateChanged(ChangeEvent e) {
setSpeed(m_slider.getValue());
if((m_isOthello && (m_slider.getValue() < DEFAULT_FLIP_SPEED -
(DEFAULT_FLIP_SPEED/SPEED_ROW))) || (!m_isOthello &&
(m_slider.getValue() < DEFAULT_FALL_SPEED -
... |
0f8bb651-e75b-4536-b738-31e628dcde19 | 3 | public String getDisplayLine(int row, int offset, int length) {
StringBuilder sb = new StringBuilder();
char tmp;
for (int c = offset; c < offset + length; c++) {
if (row < numberOfRows && c < numberOfCols) {
tmp = grid[row][c].getDisplayCharacter();
} el... |
064cc67e-1350-499f-9425-17e47760ab21 | 9 | public void doubleron(String[] split, String command)
{
if (split.length != 9)
{
System.out.println("Syntax:!doubleron [game] [winner1] [hou] [han|y|dy] [winner2] [hou] [han|y|dy] [loser]");
return;
}
TournyGame m = (TournyGame) games.get(split[1]);
if (m == null)
{
PrintMessage(split[1] + " is no... |
dba322dd-d724-4ed7-83be-d6678882d67f | 4 | public int Reserve(int isbn,int user_id) throws IOException {
for(int i=0;i<5;i++){
if( (this.isbn == isbn) && (r == reserved.no) && new Library().store(user_id, isbn)) {
r=reserved.no;
return 1;
} }
return 0;
} |
abf5569b-2311-43f1-a392-72f0360fa862 | 3 | static List updateSprite(List list, List buffer) {
List both = list;
if (resetSprites) {
both.clear();
Gui.clearText();
}
else {
for (Iterator<Sprite> it = both.iterator(); it.hasNext();) {
Sprite sprite = it.next();
spr... |
cb41d080-37ae-4edf-99e2-7ceef58c742b | 3 | public Response service(Client sockector, HashMap<String, String> requestData){
if(requestData == null){
return null;
}
Response responseMessage = null;
try{
if(!MyStringUtil.isBlank(requestData.get(Constants.HANDSHAKE))){
responseMessage = Response.msgOnlyBody(requestData.get(Constants.FILED_MS... |
1e60e88c-209d-4083-8ee2-a75e4671d59a | 3 | BitSet getClique( Arc selected )
{
BitSet bs = new BitSet();
if ( incoming.size() > 0 )
{
ListIterator<Arc> iter = incoming.listIterator();
while ( iter.hasNext() )
{
Arc a = iter.next();
if ( !a.versions.intersects(selected.versions) )
bs.or( a.versions );
}
}
// else it's the start... |
80eb40dd-e7c2-47e3-bb67-2f0588f14eaa | 7 | public boolean wordBreak(String s, Set<String> dict) {
if (s == null || dict.size() == 0)
return false;
boolean dp[] = new boolean[s.length() + 1];
dp[0]=true;
for(int i=1;i<=s.length();i++){
for(int k=0;k<i;k++){
if(dp[k]&&dict.contains(s.substring(k, i)))
dp[i]=true;
}
}
for(in... |
de431338-3c07-4247-add5-7fd545e4926a | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
... |
0ed39587-ec4c-4aa9-9f56-3fa0e87a89fb | 0 | public static ModuleManager getModuleManager(){
return moduleManager;
} |
9a777b5d-1b89-4b7b-a2d3-94d0715af90a | 4 | private boolean isPosable(Polyominos p, int ligne, int col) {
/*
* pour chaque case du tableau du polyominos, on verifie si la somme de
* la case du plateau + la case du polyominos est different de 0 ou 1
*/
for (int lignP = 0; lignP < p.getHauteur(); lignP++) {
for (int colP = 0; colP < p.getLargeur();... |
0856fb9a-8931-4e87-a28e-f65d99afcb93 | 0 | private static void newJavaWay() {
Collections.sort(users,(User u1, User u2) -> u1.id.compareTo(u2.id));
printListNewWay("by ID");
Collections.sort(users, (User u1, User u2) -> u1.firstName.compareTo(u2.firstName));
printListNewWay("by FirstName");
Collections.sort(users, (User... |
0958a97c-4355-4f99-9f2e-2ab3e583cbb2 | 7 | public static void main(String[] args) {
// Option 1: Find all the Pythagorean Triples, find the perimeters, and
// determine which perimeters have only one triple associated
/*
* Pythagorean Triple (a, b, c) is primitive if (a, b, c) are coprime
* If triple is primitive, (ka, kb, kc) are also triples
... |
96be337e-c3ac-4d48-a00a-abc351e25469 | 0 | public static void scheduleWithFixedDelayTest() throws ExecutionException, InterruptedException {
//*1
ScheduledExecutorService service= Executors.newScheduledThreadPool(2);
//*2
Runnable task1=new Runnable()
{
public void run()
{
System.ou... |
9c5fa7f4-01ad-44ca-9436-95faed7cb742 | 5 | private static boolean validatePassword(String enteredPassword, String passwordFromDatabase) {
String[] hexPasswordComponents = passwordFromDatabase.split(":");
int numberOfIterations = Integer.parseInt(hexPasswordComponents[0]);
byte[] saltBytes = readPasswordFromHex(hexPasswordComponents[1]);
... |
95638f03-b028-4365-897e-d560ee79487c | 4 | public int getAgeDifference(Date date) {
int ageDifference;
Calendar theirBirthday = new GregorianCalendar();
Calendar dukesBirthday = new GregorianCalendar(1995, Calendar.MAY, 23);
// Set the Calendar object to the passed in Date
theirBirthday.setTime(date);
// Subtra... |
bf0c5573-8380-4d69-8f55-84b1b99687f0 | 3 | @Override
public final boolean equals(final Object o) {
if (o instanceof Artist) {
if (((Artist) o).getId() > 0 && id > 0)
return ((Artist) o).getId() == id;
else
return this.compareTo((Artist) o) == 0;
} else
return false;
} |
ee7b415f-3500-48d4-bd0c-7da8fe9d8fe8 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TablePart other = (TablePart) obj;
if (!Objects.equals(this.table, other.table)) {
return false;
}
if (this.partId != other.partId) {
retur... |
4adb1ec9-bbc8-44b1-b24a-fbb8f9a86b39 | 7 | public void keyPressed(KeyEvent e)
{
if (this.curState == STATE.KEYSET)
{
if (this.curKeyPanel != null)
{
int key = awtKeyToLWJGL(e);
this.curKeyPanel.setBoundKey(key);
this.setEnterKey = false;
this.setEscapeKey = false;
if (key == Keyboard.KEY_RETURN)
{
this.setEnterKey = true;... |
8cd2cfc1-2f99-423a-b299-820a50ae6b0c | 9 | public void write(TProtocol oprot) throws TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(START_INDEX_FIELD_DESC);
oprot.writeI32(this.startIndex);
oprot.writeFieldEnd();
oprot.writeFieldBegin(TOTAL_NOTES_FIELD_DESC);
oprot.writeI32(this.totalNotes);
... |
7d9e43c8-beed-4ea7-ab4a-57a0f14680bc | 1 | @After
public void stop_tunnel() throws Exception {
if (tunnel_main == null) return;
tunnel_main.stop();
Thread.sleep(2000);
tunnel_main = null;
} |
8261ddd9-2048-496a-9282-881461edf681 | 0 | public void setSize(int size) {
this.size = size;
} |
09889845-f422-4869-ac89-bc5930f7ec41 | 1 | public void visit_l2i(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
b2e8b5ca-b766-4048-b509-981a6a64da89 | 4 | void setup() {
// Font
// PFont font = parent.createFont("arial", 20);
screenObjects = new ArrayList<ImageButton>();
String cwd;
// current working directory
cwd = System.getProperty("user.dir");
//Getting Images
ArrayList<PImage> images = new ArrayList<PImage>();
for(int i = 0; i < 4; i+... |
6722e7fd-1ec5-4654-b851-5bfbf0c7343b | 3 | @Override
public final Customer findCustomer(String custNo){
Customer custFound = null;
for(int i = 0; i < customers.length; i++){
if (custNo.equals(customers[i].getCustNo())){
custFound = customers[i];
break;
}
}
if(custFound =... |
369d9aea-e5c2-4091-aa93-92545fc0fe7b | 0 | @Test
public void itShouldDeserialize() throws Exception
{
Polygon polygon = mapper.fromJson("{\"coordinates\":"
+ "[[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]],"
+ "[[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]],\"type\":\"Polygon\"}", Polygon.class);
assertListEquals(Mo... |
e468685a-ef57-4fa8-847a-6281b7337c76 | 5 | @Override
public void run() {
try {
out = new PrintWriter(socket.getOutputStream(), true);
System.out.println("outstream etablished");
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
System.out.println("instream etablished");
while (name == null) {
setChatName();
}
s... |
6bb3d9d0-c1c8-4b00-9903-8f5d76c16e4a | 1 | public JSONObject optJSONObject(String key) {
Object o = opt(key);
return o instanceof JSONObject ? (JSONObject)o : null;
} |
70bb5bfe-3535-4f13-a9fc-7feb558ff7f6 | 5 | public Placeable getPasture(Rectangle r) {
Placeable placeable = null;
try {
for (String key : placeables.keySet()) {
placeable = (Placeable) placeables.get(key);
if (placeable != null) {
if (placeable.getType().equals("Pasture")) {
... |
6d3204fa-c6fe-4a59-9306-54ff44096c67 | 6 | private void executionPhase(List<Player> orderedPlayerList) {
currentPhase = Phase.EXECUTION;
boolean ordersRemaining = true;
while (ordersRemaining) {
ordersRemaining = false;
ListIterator<Player> it = orderedPlayerList.listIterator();
while (it.hasNext()) {
Player player = it.next();
Set<Or... |
daf4478c-1dbb-4c38-bfbd-21f5f96d82bc | 2 | @Override
public void addComment(IItem comment) {
if (comments!=null) {
if (!comments.contains(comment)) {
comments.add(comment);
}
}
} |
adc8c625-d192-4b20-998e-6ca45796a55c | 7 | @Override public long skip(long n) throws IOException, IllegalArgumentException {
while (true){
synchronized (CircularByteBuffer.this){
if (inputStreamClosed) throw new IOException("InputStream has been closed; cannot skip bytes on a closed InputStream.");
int availabl... |
11830d10-66ea-4ee5-9df9-0bbb8dbddf38 | 0 | public JTextField getyMaxTextField() {
return yMaxTextField;
} |
41101253-7917-41a8-8c77-9c66910012ad | 5 | public static List<NetworkInterface> getPotentialInterfaces() {
ArrayList<NetworkInterface> retVal = new ArrayList<NetworkInterface>();
retVal.ensureCapacity(10);
for (NetworkInterface device : JpcapCaptor.getDeviceList()) {
if (device.loopback || !device.datalink_description.equals("Ethernet"))
continue;
... |
e3398caa-3d70-47c6-b293-a2652fa68c7e | 2 | @Override
public String toString() {
final StringBuffer buffer = new StringBuffer();
for (int i = 0; i < headers.length; i++)
buffer.append(headers[i] + "\t");
buffer.append("\n");
for (final StockItem stockItem : rows) {
buffer.append(stockItem.getId() + "\t");
buffer.append(stockItem.getName() + "... |
0a646971-53ce-4481-b42f-4199d04c3513 | 2 | public static void main(String[] args) {
List<Apple> apples = Main.getApples();
//Created a stream and COLLECTED back to a list
List<Apple> collectedApplesToList = apples.stream()
.collect(Collectors.toList());
Double averageWeight = apples.stream()
... |
c82e9991-803e-4cce-9b67-c334df1da951 | 0 | public int getY() {
return y;
} |
21906a28-4667-400c-98ee-4d1167d3c71f | 0 | public Point getPosition() {
return new Point(
Math.round(exactPostitionX),
Math.round(exactPostitionY)
);
} |
f0a78018-c19a-4902-9669-0e041abec6ad | 1 | public void removeEmails(Email e){
if(emails.contains(e)){
emails.remove(e);
}
} |
eb5d4d56-60a5-4cd8-8476-9137d913e25c | 8 | public void putAll( Map<? extends Short, ? extends Byte> map ) {
Iterator<? extends Entry<? extends Short,? extends Byte>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Short,? extends Byte> e = it.next();
this.put( e.getKey(),... |
fab608dd-127a-4cd9-85de-30bd1a63a038 | 7 | public static String get_WYSIWYG_String( String data )
{
if ( data == null )
{
return "" ;
}
StringBuffer buffer = new StringBuffer( data ) ;
int len = buffer.length() ;
int index = 0 ;
while ( index < len )
{
char zei = buffer.charAt( index ) ;
if ( zei == '\\' ) //... |
390d232b-d3aa-4ee5-9855-1c7305282887 | 8 | protected void appendLink(String text) {
String[] link=split(text, '|');
URI uri=null;
try { // validate URI
uri=new URI(link[0].trim());
}
catch (URISyntaxException e) {
}
if (uri!=null && uri.isAbsolute() && !uri.isOpaque()) {
sb.append("<a href=\""+escapeHTML(uri.toString())+"... |
f244c56e-4894-4f75-a278-177e8464c6dd | 6 | void addGuiComponent(String fieldname) {
String fieldguiname = (String)fieldguinames.get(fieldname)+" ";
String fieldtype = (String)fieldtypes.get(fieldname);
Object fieldval = fieldvalues.get(fieldname);
JPanel subpanel = new JPanel(new GridLayout(1,2));
subpanel.setBackground(bgcolor);
mainpanel.add(subp... |
ee4efd50-cca7-477c-8a02-a09a8dbf2d2d | 9 | public void pickupSymbols()
{
//申请空间
statusSymbols = new SymbolBean[statusCount] ;
eventSymbols = new SymbolBean[eventCount];
int sc =0,ec=0,nsc=0,esc=0;
for (Iterator iterator = symbols.iterator(); iterator.hasNext();) {
SymbolBean sb = (SymbolBean) iterator.next();
if(sb.getType().equals(S... |
f6bf484a-e7c8-4c02-8fb6-61077998f8b2 | 4 | @Override
public boolean retainAll(Collection<?> c)
{
boolean retained = false;
for (int i = 0; i < capacity; i++) {
synchronized (table[i]) {
Node<E> p = table[i], n = p.next;
while (n != null) {
if (!c.contains(n.element)) {
p.next = n.next;
retained = true;
}
else {
... |
f753ed1b-9939-4cb5-a718-eec5ba3c3ebc | 7 | public int alphabeta_min(int currentDepth, int alpha, int beta, Tuple lastMove) {
if (currentDepth >= depth || board.legalMoves.isEmpty()) {
if (currentDepth==0 && board.winStatus != 2) {
// System.out.println("Board state with immediate win:\n" + board);
// System.out.println("Returning highes... |
0cec7dd2-7581-4967-b0a9-86bb6edb2c9b | 7 | public String longestCommonPrefix(String[] strs) {
if (strs == null || strs.length == 0)
return "";
if (strs.length == 1)
return strs[0];
StringBuilder sb = new StringBuilder();
for (int i = 0; i < strs[0].length(); ++i) {
char cur = strs[0].charAt(i);
for (int j = 1; j < strs.length; ++j) {
if ... |
88bfba85-dfd2-4852-9c35-518918c60eb2 | 5 | public void mouseClicked(MouseEvent arg0) {
String command = "mouseClicked-";
// Because I did not want to read the JTableSpecs I have found a
// workaround JTables limits
if (arg0.getSource() instanceof JTable) {
// Cast to JTable
JTable target = (JTable) arg0.getSource();
int row = target.getSelected... |
7efa4d11-6f9b-4194-958f-a3177e8b6b06 | 3 | private void addClass(Class clazz) {
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
addMethod(method);
}
Class[] ifaces = clazz.getInterfaces();
if (ifaces != null) {
for (Class iface : ifaces) {
addClass(if... |
86ad7246-340e-421e-84e1-908aba5602af | 0 | public void mouseClicked(MouseEvent event) {
adapter.mouseClicked(event);
} |
59e947a9-34fa-4065-9b0f-01f058c4df85 | 9 | void checkDsubType( int dsubType)
throws HdfException
{
if (dsubType != HdfGroup.DTYPE_SFIXED08
&& dsubType != HdfGroup.DTYPE_UFIXED08
&& dsubType != HdfGroup.DTYPE_FIXED16
&& dsubType != HdfGroup.DTYPE_FIXED32
&& dsubType != HdfGroup.DTYPE_FIXED64
&& dsubType != HdfGroup.DTYPE_FLOAT32
&& dsub... |
6597d02d-6ca7-4c3a-ae35-cc56f70af161 | 8 | private void BtIncluirServicoTabelaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtIncluirServicoTabelaActionPerformed
boolean inclui = true;
TfQuantidadeServFocusLost(null);
limpar.Limpar(TbProdutos);
if (estoqueok) {
if (!TfCodServico.getText().equals("... |
b2a9979f-f292-4289-b4a7-e1b4f5f9086e | 9 | private void parseBlockIDList(String var1)
{
this.leafClasses = new HashMap();
FMLLog.log(Level.INFO, "Parsing log ID list: %s", new Object[] {var1});
if (var1.trim().length() > 0)
{
String[] var2 = var1.trim().split(";");
String[] var3 = var2;
in... |
f130879b-9c29-4553-b25f-a53ff6afc9e4 | 4 | public static void main(String[] args) throws Exception{
Board board = new Board();
IPlayer humanPlayer = new HumanPlayer();
IPlayer AIPlayer = new AIPlayer();
IPlayer currentPlayer = humanPlayer;
while (!board.isGameOver()) {
if (humanPlayer == currentPlayer) {
HumanBoardGUI gui = new HumanBoardGUI(bo... |
8f995bf7-2376-4af8-85ac-200d4de96283 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Clause))
return false;
Clause other = (Clause) obj;
if (literals == null) {
if (other.literals != null)
return false;
} else if (!literals.equals(other.literals))
... |
2b170d55-d184-4d1c-a311-78e47ee5cc6b | 7 | private void convertRegion(File baseFolder, File regionFile, BiomeSource biomeSource, int currentCount, int totalCount, ProgressListener progress) {
try {
String name = regionFile.getName();
RegionFile regionSource = new RegionFile(regionFile);
RegionFile regionDest = new R... |
71777899-441d-48e0-9e43-905d05332d47 | 9 | public boolean equals(Object o)
{
if (o == this)
{
return true;
}
if (!(o instanceof RSAPrivateCrtKey))
{
return false;
}
RSAPrivateCrtKey key = (RSAPrivateCrtKey)o;
return this.getModulus().equals(key.getModulus())
... |
42a44c83-85ac-4e5f-96dc-60fca3c19983 | 9 | public static void main(String[] args){
String host = "";
int tcpPort = -1;
int udpPort = -1;
ClientModel model = null;
String pathToPublicKey = null;
String pathToPrivateKey = null;
/*--------------Arguments handling--------------------------------*/
if( args.length != 5){ usage(); System.exit(0); }... |
4b5e4f69-0e51-4157-adce-902f38e222ca | 8 | public double[] prob(int[] ps, int pos) {
double[] p = new double[4];
double[] scores = new double[3];
for (int i = 0; i < windowsize; i++) {
// abfangen von as gleich x
if (ps[pos + i - whalf] < 20) {
scores[0] += matrix[0][ps[pos + i - whalf]][i];
scores[1] += matrix[1][ps[pos + i - whalf]][i];
... |
2fa97e41-5375-45e5-b89c-0651a2ecdfdd | 7 | private byte[] encodePapPassword(final byte[] userPass, byte[] sharedSecret) {
// the password must be a multiple of 16 bytes and less than or equal
// to 128 bytes. If it isn't a multiple of 16 bytes fill it out with zeroes
// to make it a multiple of 16 bytes. If it is greater than 128 bytes
// truncate it at... |
6856e6a2-b7ad-4cf8-a04e-5ead6c6b09c6 | 0 | public void setHasTicket(Boolean value) {
this._hasTicket = value;
} |
60a29b2e-5517-489d-ad6b-4816f97ba8c0 | 4 | @Override
public void actionPerformed(ActionEvent e) {
String i,n; float p;
if(e.getSource()==rptbtn) {
System.out.printf("===============================\n");
pr = prod.readdata("product.txt");
System.out.printf(" Product List \n");
Syste... |
81056a51-3d71-4edd-9e6a-f6f812683a5e | 8 | public String asString() {
if (null == responseAsString) {
BufferedReader br = null;
InputStream stream = null;
try {
stream = asStream();
if (null == stream) {
return null;
}
br = new Buffere... |
cf583eaa-715e-4394-8ea6-9dd5b6737b4b | 3 | private void showTitle() {
mode = ZombieMode.TITLE;
if (title == null) {
title = new ZombieTitle(frame.getWidth(), frame.getHeight());
}
assert (title != null);
while (frame == null) {
try {
wait();
} catch (InterruptedException ex) {
... |
f74c4974-c6d9-4587-8316-ddc847af9d30 | 2 | public void KeyDown(int key, char c) {
if(key == 57) { //space
int facingNpc = game.getPlayer().getFacingNPC();
System.out.println("Facing: " + facingNpc);
if(facingNpc != -1)
ScriptManager.executeFunction("talkto_" + facingNpc, game);
}
} |
48f73d18-101c-4daa-bf74-db2b1a06d6c4 | 1 | public void init() {
this.p1.setLife(20);
this.p1.getDeck().shuffle();
try {
this.p1.setHand(this.p1.getDeck().drawN(7));
} catch (Exception e) {
this.p1.setLife(-999);
}
} |
40286ccd-8703-4b65-b0ed-6737e2d33e40 | 4 | @Override
public boolean parseField(String name, String value) {
if (super.parseField(name, value)){
return true;
}
if(name != null && value != null){
RAMFieldHandler handler = EnumUtils.lookup(RAMFieldHandler.class, name);
if (handler != null){
return handler.handle(device, value);
} else{
... |
f58c188c-600b-44e1-b960-4a4436b50937 | 1 | public static byte getBit(byte[] data, int pos) {
int posByte = pos / 8;
int posBit = pos % 8;
byte valByte = data[posByte];
return (byte) (isBitSet(valByte, posBit) ? 1 : 0);
} |
fe594e93-931a-4311-936b-fcbb9aac94db | 5 | public Object showInfoTableHead(String listName) {
String line = null;
String[] head = null;
if (listName.equals("user_list")) {
listName = "login_list";
}
if (!(listName.equals("student_list") || listName.equals("login_list") || listName
.equals("log_list"))) {
listName = "teacher_list";
}
Stri... |
80dd5f20-40d9-4a0b-80d9-1149430d99ea | 0 | PropertyKeys(String name) {
this.name = name;
} |
8e96bb02-de1a-4d95-baa5-b1246fbdbb5b | 4 | public void setObject(Object obj) {
if(obj instanceof Turma){
this.turma = (Turma)obj;
if(turma.getDisciplina() != null){
this.lblDisciplinaValor.setText(turma.getDisciplina().getNome());
}
this.lblPeriodoValor.setText(turma.getPeriodo... |
e5d52626-2fed-4890-9de9-bce2838d87f1 | 3 | private static InputStream getInputStream(final URLConnection con) throws Exception {
final InputStream in = con.getInputStream();
final String encoding = con.getHeaderField("Content-Encoding");
if (encoding != null) {
if (encoding.equalsIgnoreCase("gzip")) {
return new GZIPInputStream(in);
} else if (e... |
00f3f909-cac4-48c0-a6a0-c6977eb3119e | 7 | public Command createCommand(Context context, String... args) {
if (args == null || args.length <= 1) {
return new ErrorCommand("missing authentication method");
}
if ("none".equalsIgnoreCase(args[1])) {
return new AuthCommand(context, Authentication.n... |
1c2d94c6-6bf3-4db5-b101-c10610b7a872 | 4 | private void countCosinus() {
int z =0;
for (wordsDocument doc : webDocs)
for (wordsDocument otherDoc : webDocs)
if (doc != otherDoc) {
Map<Integer, Integer> converslyDocComparer = new HashMap<Integer, Integer>();
converslyDocComparer.put(otherDoc.docName, doc.docName);
... |
1534e211-2e6a-4587-9d9d-2acd0108c502 | 3 | @Test
public void testUpdating() throws InterruptedException {
Discography page = new Discography(Paths.get("test/Homestuck.htm").toUri().toString(),null,null);
DummyProgressReporter pr = new DummyProgressReporter();
try {
assertTrue(page.updateFromNet(pr));
} catch (ProblemsReadingDocumentException e) {
... |
a77fe1d7-b6fe-4d2c-bd04-e716cc42b9a2 | 3 | public int getHigh(int symbol) {
checkSymbolInRange(symbol);
int low = freqTable.getLow (symbol);
int high = freqTable.getHigh(symbol);
int total = freqTable.getTotal();
if (!(0 <= low && low <= high && high <= total))
throw new IllegalStateException("Symbol high cumulative frequency out of range");
r... |
dcf230f6-58ed-46d0-a6c7-31fb8e6b3711 | 0 | @AfterClass
public static void tearDownClass() {
} |
df03d031-0737-4094-a2c1-1c648d02861b | 0 | public int compareTo(Object obj)
{
Scores sobj = (Scores) obj;
int thisHigh = highScore();
int objHigh = sobj.highScore();
return thisHigh - objHigh;
} |
5a73833d-be6d-4c79-bb6b-f6f32c97c2d8 | 8 | public static void main(String[] args){
int op = 0;
do{
System.out.print("\t***MENU***\n1. Agregar barco.\n2. Agregar elemento.\n" +
"3. Vaciar Barco.\n4. Listar pasajeros.\n5. Agregar cardumen.\n6. Salir." +
"\nIngrese su opcion: "... |
1ea322cc-e52b-4a28-a408-e2fb027c61d2 | 3 | public void onUpdate() {
if(health != -100 && health <= 0) {
this.setDead();
}
if(ticksAlive >= ticksToLive) {
this.setDead();
}
ticksAlive++;
} |
55f868d7-7c91-4dfc-a8aa-689497852ef7 | 7 | public void draw(Object obj, Component comp, Graphics2D g2)
{
Color color;
if (obj == null)
color = null;
else
color = (Color) getProperty(obj, "color");
String imageSuffix = (String) getProperty(obj, "imageSuffix");
if (imageSuffix == null)
... |
d883b6a1-3ef3-4472-84ee-581f52d34110 | 3 | public MIDletChooser() {
JadFile jadFile = ApplicationManager.manager.jadFile;
try {
Image img = Image.createImage("/wap3-logo.png");
infoAlert = new Alert(INFO_TITLE, INFO_TEXT, img, AlertType.INFO);
}
catch (IOException ex) {
ex.printStackTrace();
... |
96227522-0389-4882-8e6b-7ddbd4534b0b | 6 | public static int[] base (int ancho_libro,int largo_libro, int ancho_palet,int largo_palet, int empaquetado, int compensacionAncho, int compensacionAlto ) {
/*
* @Descripcion :
* - Miembro para calcular la base de un palet. Calcula el mejor
* aprovechamiento de un palet con una b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.