method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
44b38d44-e5cd-4cda-abee-2fe6bba2706b | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetc... |
37980939-6ee8-4221-8193-4d0336cc9a29 | 0 | @After
public void tearDown() {
} |
1979bca8-bdd8-433c-9894-c60259740068 | 2 | public String getFirstPropertyValue(String name){
Property<String> prop = getFirstProperty(name);
if(prop == null){
return null;
}
if(prop.getValue() == null){
return null;
}
return prop.getValue();
} |
539cf85a-b37a-4c58-b14b-2af9540e2f7e | 1 | public void setup(Sprite.Drawer d, Coord cc, Coord off) {
init();
if (spr != null)
spr.setup(d, cc, off);
} |
430dc4e6-072f-4421-a7c3-416481a3a1b4 | 2 | @RequestMapping(value = {"/MovimientosBancarios"}, method = RequestMethod.GET)
public void readAll(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse) {
try {
ObjectMapper jackson = new ObjectMapper();
String json = jackson.writeValueAsString(movimientoBancarioD... |
402fcf21-4419-464b-b5eb-9ca6d99570ad | 7 | protected static SuperString findWordAndPos(String s, int caretPos) {
caretPos--;
if (s.length() != 0 && containsSeparator(s, caretPos)) {
caretPos--;
} else if (caretPos > 0) {
int front;
int end;
do {
front = caretPos--;
} while (caretPos != -1 && !containsSeparator(s, caretPos));
do {
... |
48a3d912-edcc-40f8-9e92-060f1e4e9dac | 4 | public void recordRep(long zobrist) {
// TODO: Make this smoother with a better looking for empty places
int hashkey = (int) (zobrist % HASHSIZE);
if (hashtable[hashkey] == 0 || hashtable[hashkey] == zobrist) {
hashtable[hashkey] = zobrist;
return;
}
for (int i = 1; i < HASHSIZE; i++) {
if (hashtab... |
91c73469-ecec-4d8e-908d-94d578db565d | 5 | @Override
public void refresh(RefreshEvent event) {
Class eventClass = event.getClass();
if (eventClass == LocalGameRefreshEvent.class) {
mainPanel.refreshGrid(event);
} else if (eventClass == TotalGameRefreshEvent.class) {
mainPanel.refreshRemainingMines(event);
... |
0bb33d77-c881-49c1-8a6f-9f1ffc22dacb | 5 | public static List<Map<String,String>> getValueAsMapList(String headerLine, List<String> followingLines, MassBankRecordLine recordLine) {
List<Map<String, String>> result = new ArrayList<Map<String,String>>();
String headerValue = getValueAsString(headerLine, recordLine);
String[] headerValues = headerValue.split... |
2570a79e-b9c1-44c8-8a6b-060333d58536 | 9 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Book other = (Book) obj;
if (!Objects.equals(this.id, other.id)) {
return false;
}
... |
93d90e33-a75e-47d3-ad10-70ac39e2933a | 1 | @Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
return DATA_FLAVOR.equals(flavor) || DataFlavor.stringFlavor.equals(flavor);
} |
b4aead98-9421-481e-8937-3dcfbc91e006 | 7 | private void SetState(int state) {
if (state == token_source.curLexState)
return;
Token root = new Token(), last=root;
root.next = null;
// First, we build a list of tokens to push back, in backwards order
while (t... |
3a4cfc15-650d-4092-b801-8c7de7cb5d69 | 9 | public List formatResults(){
List results = new ArrayList();
Iterator i = searchResults.iterator();
String lastSampleId = "";
String preSampleId = "";
String preAssay = "";
List oneSampleRows = new ArrayList();
int dupResult = 0;
boolean newSample = false;
while(i.hasNext()){
Result r = (Result)i.n... |
1190e893-f8ce-4326-b943-32ba23284655 | 0 | public void setPassCriteria(String passCriteria)
{
this.passCriteria = passCriteria;
} |
66ba5723-2ca1-4e71-bf9a-4050c39cd806 | 3 | protected void progressTask()
{
if(getTask().equals("eat"))
{
attemptToEat();
return;
}
if(getTask().equals("reproduce"))
{
attemptToReproduce();
return;
}
if(getTask().equals("wear backpack"))
{
attemptToWearBackpack();
r... |
ef2521eb-e8f1-41fb-81b8-a5fa0641d765 | 7 | public void testMany () throws IOException {
Server server = new Server();
Kryo serverKryo = server.getKryo();
register(serverKryo);
startEndPoint(server);
server.bind(tcpPort);
final TestObjectImpl serverTestObject = new TestObjectImpl(4321);
final ObjectSpace serverObjectSpace = new ObjectSpace();
... |
2a86e799-1b29-487d-9090-0056114db447 | 5 | final void method1348(int i, Object object, Interface14 interface14) {
do {
try {
anInt2318++;
method1341(object, interface14, -114, 1);
if (i > 62)
break;
aClass107_2316 = null;
} catch (RuntimeException runtimeexception) {
throw Class348_Sub17.method2929(runtimeexception,
("pq.K(" + i... |
a282d60b-a7e1-4a9a-bc8f-3e1af33ddc35 | 6 | @Override
public void keyTyped(KeyEvent e)
{
if (e.getSource() == textWidth || e.getSource() == textHeight)
{
if (e.getKeyChar() > '9' || e.getKeyChar() < '0')
{
e.consume();
}
else if (Integer.parseInt(((JTextField) e.getSource()).getText()
+ e.getKeyChar()) > 254)
{
((JTextField) e.get... |
05cd3cea-d583-404f-8744-37b4db4d61ad | 9 | public JPanelRender(JFrame window, final EventosDoTeclado evt, EventosDoRender imgevt){
this.window = window;
this.imgEvt = imgevt;
this.evt = evt;
window.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent e) {
... |
f0240616-5065-491d-9f60-b4b8d388aecc | 7 | public void randomColor() {
int randomInt = (new Random().nextInt(6) + 1);
switch (randomInt) {
case 1:
robot.setBodyColor(Color.GREEN);
robot.setBulletColor(Color.GREEN);
break;
case 2:
robot.setBodyColor(Color.GR... |
2fcb585c-05e5-404a-94e3-3983ca653646 | 3 | public int searchInsert(int[] A, int target) {
int sta = 0;
int end = A.length;
while (sta <= end){
int mid = (sta + end)/2;
if(A[mid] == target)
return mid;
else if(A[mid] < target)
sta = mid +1;
else
... |
43cc1eb1-87e9-4acf-a838-d98fe48db265 | 8 | private void render(byte input[], int inputPosition, int inputWidth,
int output[], int outputPosition, int outputWidth,
int width, int height, int colour) {
int _width = -(width >> 2);
width = -(width & 3);
/*
* Iterate through the pixels.
*/
for (int row = -height; row < 0; row++) {
for (int... |
20caaa8e-9de9-478c-9542-33287fcba2a8 | 2 | private void actionDelete( )
{
DefaultMutableTreeNode
selNd = getSelectedNode();
if ( selNd != null )
{
int[] selIdxs = getNodeIndexList(selNd);
if ( selIdxs.length == 1 )
{
audioVectors.remove(selIdxs[0]);
dataRootNd.remove(selIdxs[0]);
dataTr.updateUI();
}
else
{
((DefaultMutableTreeNo... |
7f079e76-077e-4ac5-adb5-8ec38551982a | 0 | void setTotalForce(SimpleVector totalForce) {
this.totalForce = totalForce;
} |
152abca1-0350-44c3-b9ba-e58a21682526 | 9 | public void agregarLinea(int p1,int p2,Color pColor,int pStroke)
{ int i=nConexiones;
if(p1>=nVertices||p2>=nVertices) return;
if(i>=MAXConexiones) if(aConexiones==null)
{ MAXConexiones=100;
aConexiones=new int[MAXConexiones];
aColores=new Color[MAXConexiones];
aStrokes... |
956d7399-0243-4ac8-89c7-206496940c91 | 2 | @Override
public void startSetup(Attributes atts) {
table.setModel(model);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setPreferredScrollableViewportSize(new Dimension(100,100));
// Get Column Labels
ArrayList colLabels = new ArrayList();
String colLabelsString = atts.getValu... |
44232b22-b636-43e0-a547-4634c4790274 | 2 | @Override
public void addcomment(User user, Book book, MediadComment comment) {
// TODO Auto-generated method stub
for (Book book1 : fdb.getBooks()) {
if (book1==book){
book1.addComment(comment);
break;
}
}
} |
4588bc40-b64e-4427-8618-6861b8b77dc0 | 9 | private void toggleControls(){
String[] controls = new String[]{"Dir", "Orient", "Reflect", "XFact"};
boolean[] constate = new boolean[controls.length];
for(int abc = 0; abc < controls.length; abc++){
constate[abc] = gonzo.getControls(controls[abc]);}
bdlabel.setVisible(false);
for(int def = 0... |
629eb746-ca14-4e0e-9486-13ce9b5143c4 | 9 | private Object[] getNewAndArgs(Node nodeTest, List<Node> predResult,
String op) {
// TODO Auto-generated method stub
NodeTest[] args = ((NodeTest) nodeTest).getFunctionCalls().get(op);
List<NodeTest> newArgs = new ArrayList<>();
List<Node> predResultBackList = new ArrayList<>();
for (NodeTest arg : args) {... |
4acfafb5-8e61-41d9-ad96-2ed2fb2fa2a8 | 4 | public static void sendPlayerToNewPlayerSpawn(BSPlayer player, boolean silent) {
if(!doesNewPlayerSpawnExist()){
player.sendMessage(Messages.SPAWN_DOES_NOT_EXIST);
return;
}
if(player==null){
return;
}
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new Dat... |
adaba9e8-d95f-4823-a531-881f54a371c7 | 1 | public Graphics2D getGraphics(){
Window w = vc.getFullScreenWindow();
if(w != null){
BufferStrategy s = w.getBufferStrategy();
return (Graphics2D)s.getDrawGraphics();
}else{
return null;
}
} |
9b06679e-0a5f-4fdc-a316-5b2783ed54f8 | 2 | public boolean checkUserId(int uid) {
for(int i=1;i<=3;i++)
if( new User().checkUserId(uid))
{
return true;
}
return false;
} |
def26cd3-44ea-4353-a81a-1af29c5cfdd5 | 3 | public static void abrirURL(String url) {
try {
URI uri = new URI(url);
Desktop desktop = null;
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
}
if (desktop != null) {
desktop.browse(uri);
... |
4453f7f4-32d2-4e2d-94eb-b05046a717d0 | 9 | public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
if (l1 == null) {
return l2;
}
if (l2 == null) {
return l1;
}
ListNode head = null;
ListNode cur = null;
while (l1 != null || l2 != null) {
if (l1 == null) {
ListNode nc = new ListNode(l2.val);
cur.next = nc;
cur = nc;
l2 ... |
39765072-fc95-4cb5-89b1-dbe512b84b35 | 8 | @Override
public void unInvoke()
{
final Physical affected=this.affected;
super.unInvoke();
if((affected instanceof Room)&&(this.unInvoked))
{
final Room R=(Room)affected;
final Room downR=R.getRoomInDir(Directions.DOWN);
if((downR!=null)
&&(R.roomID().length()==0)
&&(downR.roomID().length()>0)... |
53458c2a-2e76-4ae3-adef-12cb517b4a4f | 4 | public static Object getPrimaryKeyValue(Field f, Object obj)
{
try
{
if ( Proxy.isProxyClass (obj.getClass()))
{
try
{
return ((DeferedLoadMethodInterceptor) Proxy.getInvocationHandler(obj)).getpKey();
} catc... |
328bc4cf-9292-4869-a5ae-294d792bba99 | 7 | public void save(PrintWriter writer, String modifier)
{
try
{
if(parentAnimation == null)
{
writer.println(modifier + "Animation " + name);
writer.println(modifier + "Duration: " + duration + " frames");
}
else
{
writer.println(modifier + "Add Animation " + name + " at frame " + (frame =... |
33d69568-c619-4c32-ac53-0444902f7174 | 3 | public void removeEdge( Vertex<T> v1, Vertex<T> v2 ) {
v1Pos = getVerticesIndexFor( v1 );
v2Pos = getVerticesIndexFor( v2 );
if ( v1Pos == -1 || v2Pos == -1 ) {
throw new IllegalArgumentException( "vertex not found" );
}
if ( this.adjMatrix[v1Pos][v2Pos] == 1 ) {
this.adjMatrix[v1Pos][v... |
3699cf3a-c407-4e04-9037-5473a0c43fa0 | 4 | public static void main(String[] args) throws Exception {
File indir = new File("/srv/haven/errors");
File outdir = new File("/srv/www/haven/errors");
Map<File, Report> reports = new HashMap<File, Report>();
Map<File, Exception> failed = new HashMap<File, Exception>();
for(File f : indir.listFiles()) {
if(f... |
5526d33f-1fa8-4180-b1c4-43940c47eaae | 0 | public VueMenu(CtrlAbstrait ctrlA) {
super(ctrlA);
initComponents();
VueAbstrait vueA = null;
this.ctrlM = new CtrlMenu(this, vueA);
} |
24f4adbc-c8e5-4baa-8ae3-343cbc6a6ba1 | 9 | public RegImmInd(RegImmIndOp operation, Register sourceOperand, long immediateOffset, Register baseOperand) {
switch(sourceOperand.width()) {
case Byte:
if(immediateOffset < Byte.MIN_VALUE || immediateOffset > Byte.MAX_VALUE) {
throw new IllegalArgumentException("immediate operand does not fit into byte"... |
b38af7b0-2ccd-4b85-8af6-2cce0d755de7 | 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... |
e0be4a3f-3b88-4e13-a61e-7c95e2381d23 | 1 | private void disableVoteButtons(JButton confirmButton) {
voteList.removeAll();
confirmButton.setVisible(false);
Enumeration<AbstractButton> allButtons = buttonGroup.getElements();
while (allButtons.hasMoreElements()) {
allButtons.nextElement().setVisible(false);
}
... |
a041b89e-ae5a-466b-95fa-625a6e2e16c8 | 9 | public void marcarBoton(int numboton, Ficha ficha)
{
if(numboton==1)b1.setLabel(Character.toString(ficha.getFicha()));
if(numboton==2)b2.setLabel(Character.toString(ficha.getFicha()));
if(numboton==3)b3.setLabel(Character.toString(ficha.getFicha()));
if(numboton==4)b4.setLabel(Character.toString... |
024fe45c-1358-4278-8616-51d005e0413e | 9 | Tree decisionTreeLearning(List<List<Integer>> examples, List<Integer> attributes,
List<List<Integer>> parentExamples, boolean randImp) {
Tree tree;
// if examples is empty then return PLURALITY-VALUE(parent examples)
if (examples == null || examples.size() == 0) return new Tree(pl... |
eb9c27cb-b457-4c7b-89f8-9460800ccc97 | 1 | protected void endGameTimer() {
if (colorChanged == true) {
gameOverColor = Color.BLUE;
colorChanged = false;
} else {
gameOverColor = Color.RED;
colorChanged = true;
}
Graphics g = this.getGraphics();
drawSomebodyWon(g);
} |
7fe9dc8b-7535-4c44-9729-efc47bd94f6a | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
c0331b13-de02-4e1b-be7b-629ed9fc94c3 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Sexo other = (Sexo) obj;
if (this.idSexo != other.idSexo && (this.idSexo == null || !this.idSexo.equals(o... |
7182be6b-bff2-4c9a-a63e-9b4ed4019c81 | 0 | public static void println(String str) {
memo.append(str);
memo.append("\n");
} |
adb6a4e5-6b5e-4ce7-b4af-50ff113eaac5 | 5 | private double kernel(FeatureNode [] x, FeatureNode [] z) {
double ret = 0;
switch (model.params.kernel) {
case 0: //user defined
break;
case 1: //linear
ret = Kernel.kLinear(x, z);
br... |
6aa8b072-80d7-46de-82ec-969f1c86b7cb | 3 | public void visitPhiJoinStmt(final PhiJoinStmt stmt) {
if (stmt.target == from) {
stmt.target = (VarExpr) to;
((VarExpr) to).setParent(stmt);
} else {
final Iterator e = stmt.operands.keySet().iterator();
while (e.hasNext()) {
final Block block = (Block) e.next();
if (stmt.operandAt(block) == ... |
7a4decaa-9095-41c0-bfd5-91090c8e12a7 | 2 | public static void main(String[] args) {
rosterDB = readCSV ("/home/arno/workspace/CampPlaner/data/roster.csv");
System.out.println (rosterDB);
try {
System.out.println ("saving...");
rosterDB.write ("rosterdb.xml");
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace(... |
4c7f18dd-28b2-4ec6-b763-a63aad3e5290 | 7 | public boolean init()
{
// dump command line arguments
ExampleUtil.dumpCommandArgs();
// read config
boolean debug = CommandLine.booleanVariable("debug");
if (debug)
{
// Enable debug logging
Logger logger = Logger.getLogger("com.reuters.rfa")... |
a11ad6ae-3f08-4704-b46b-906ce3111c07 | 4 | public String generate(List<String> joinTables, List<String> joinTableIds)
{
StringBuilder sb = new StringBuilder();
List<String> added = new ArrayList<String>();
for (int x = 0; x < joinTables.size(); x++)
{
if (!added.contains(joinTableIds.get(x)))
{
added.add(joinTableIds.get(x));
if (sb.leng... |
4a3270a9-df00-4738-b992-21633c64fb82 | 9 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final UsuarioMapeo other = (UsuarioMapeo) obj;
if ((this.login == null) ? (other.login != null) : !this.login.e... |
a27d0cdd-ee2d-4d54-9206-68f4597758e3 | 6 | public RobbEffect(BattlePvP battle, boolean defender) {
super(battle, defender);
if(defender){
//suppress the siege machines of the battle looser
battle.getAttTroops()[3]=0;
// if there is no more troops, don't do anything
if(battle.getAttTroops()[0]>0 || battle.getAttTroops()[1]>0 || battle.getAttTroop... |
0ff6f76d-afec-4ecf-a298-00135c2164c0 | 8 | @Override
public boolean isValidClassDivider(MOB killer, MOB killed, MOB mob, Set<MOB> followers)
{
if((mob!=null)
&&(mob!=killed)
&&(!mob.amDead())
&&((!mob.isMonster())||(!mob.charStats().getMyRace().racialCategory().endsWith("Elemental")))
&&((mob.getVictim()==killed)
||(followers.contains(mob))
||... |
a80a8817-3dd3-4aa5-8632-4c2961203f28 | 4 | @Override
public Tipo validarSemantica() throws Exception {
Tipo izq,der;
izq=izquierdo.validarSemantica();
der=derecho.validarSemantica();
if (izq instanceof TipoInt || der instanceof TipoFloat){
if (der instanceof TipoInt || der instanceof TipoFloat ){
r... |
dcd5e942-1568-48e0-abad-0c8fcba4dc78 | 8 | public BufferedImage parseUserSkin(BufferedImage var1) {
if(var1 == null) {
return null;
} else {
this.imageWidth = 64;
this.imageHeight = 32;
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageHeight, 2);
Graphics var3 = var2.getGraphics();
... |
353524f8-725e-43dd-bd0e-45c10278a832 | 6 | public void auto()
{
switch(nivel)
{
case 1:
break;
case 2:
if( defesa() ) return;
break;
case 3:
if( defesa() ) return;
if( ataque() ) return;
break;
default:
break;
}
random();
} |
6a8e2b6c-6338-41ce-94c3-41a2539db32c | 5 | public int increaseHandicap(int minX, int minY, int ex, int ey) {
if (ex > 90 && ex < 90 + minX) {
if (ey > 210 && ey < 210 + minY) {
if (handicap < 9) {
handicap++;
return handicap;
}
}
}
return hand... |
48411688-1b95-4a9f-b25f-579256a1b3d0 | 8 | public static long countSplitInversionsAndMerge(int start, int end, int leftStart, int leftEnd, int rightStart, int rightEnd) {
int subArray1[] = new int[leftEnd - leftStart + 1];
int subArray2[] = new int[rightEnd - rightStart + 1];
int count = 0;
for (int i = leftStart; i <= leftEnd; i++) {
subArray1[co... |
66a8e579-114b-4cfd-8959-e4acc0e92364 | 6 | public void run() {
if (client_socket != null && os != null && is != null) {
try {
String responseLine;
while ((responseLine = is.readLine()) != null) {
System.out.println(responseLine);
if (client_socket.isClosed())
... |
c9a2cc00-facd-4c4b-a9a0-7c94dfe0a8e4 | 6 | @Override
public String toString() {
String result = "Student [name=" + getName() + ", average=" + getAverage()
+ ", program=" + getProgram() + ", universities=[";
if (this.universityOne != null)
result += this.universityOne + ": " + (this.universityOneAccept ? "accepted" : "rejected") ;
if (this... |
af461fa2-c282-43b7-841a-6f73da7b5d3f | 4 | public void handleDamage(EnemyClass enem)
{
if(enem.getWeapon().size() > 0)
{
for(int i = 0; i < enem.getWeapon().size(); i++)
{
if(enem.getGun().getBulletSize() == 0)
{
//do Nothing
}
else
... |
8f6b400e-493d-40b7-bada-19708997c9ad | 9 | public static ListNode rotateRight(ListNode head, int n) {
if (head == null)
return null;
if (n == 0)
return head;
int length = 1;
ListNode countLength = head;
while (countLength.next != null) {
length++;
countLength = countLength.next;
}
if (n % length == 0)
return head;
int newHeadPos =... |
a7eb52cf-4e06-4233-8b3b-27e0cca1bf1c | 6 | public PagePanel(Page page) {
this.page = page;
setLayout(null);
if (page.getFile() != null) {
try {
Scanner scanner = new Scanner(page.getFile());
StringBuilder contentBuilder = new StringBuilder();
while (scanner.hasNextLine()) {
contentBuilder.append(scanner.nextLine());
contentBuilder... |
c45bbdac-3da2-40f8-b687-465f588a3a6a | 1 | public void mmousedown(Coord mc, int button) {
Coord tc = mc.div(MCache.tileSize);
if(ol != null)
ol.destroy();
ol = map.new Overlay(tc, tc, 1 << 17);
sc = tc;
dm = true;
ui.grabmouse(ui.mapview);
} |
37432500-fddd-4a2b-95af-165467d25c7e | 9 | public static boolean hasCycle(ListNode head) {
if(null==head) return false;
ListNode pointerOne=head.next;
if(null==pointerOne) return false;
ListNode pointerTwo=head.next.next;
while (pointerOne!=null&&pointerTwo!=null&&pointerOne!=pointerTwo){
pointerOne=pointerOne... |
98e363a5-6528-44f3-b2b8-2e08cf6d356f | 6 | public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = ... |
d0a52a0e-5ee3-40b7-9de5-99b540573d98 | 6 | public void setUpText(String text, MinuetoFont font, MinuetoColor color, boolean antiAliased) {
/* The hardest part of build the image with the text string is
* figuring out the size of the string itself. **/
if (text == null) new NullPointerException();
if (font == null) new NullPointerException();
if... |
d299d307-385a-419a-8a5a-942fd2e2bb7b | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AbstractQualifiedMetadata other = (AbstractQualifiedMetadata) obj;
if (qualifiedName == null) {
if (other.qualifiedName != null)
return fa... |
77845b40-107c-4402-ab93-352169020d9b | 8 | public void computeSALSA(int nIterations) {
for(int iter=0; iter < nIterations; iter++) {
// Hubs: sum of authority-neighbors values divided by their degree
for(SalsaVertex hub: hubs.values()) {
double nbSum = 0.0;
// Update the degree because not all auth... |
0fb93442-a4e5-4d4f-9459-cdc7e9e75d92 | 4 | void damagePlayer(int hitpoints, AIConnection dealingPlayer){
if(health <= 0){
Debug.warn("Player is already dead.");
return;
}
Debug.stub("'" + this.username + "' received " + hitpoints
+ " damage from '" + dealingPlayer.username + "'!");
health -= hitpoints;
if(!(dealingPlayer.username.equals(th... |
41275c7e-9637-434d-86ed-b5cce558bc37 | 1 | public void visit_l2f(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
c108864d-ad3d-4780-9a4b-317174588302 | 0 | public CtrlComptesRendus getCtrl() {
return ctrlCR;
} |
ce2a1e30-f24f-43ea-84f9-d7f6e8de37d9 | 7 | public void mouseEntered(MouseEvent mouseEvent) {
Iterator<PComponent> it = components.iterator();
while (it.hasNext()) {
PComponent comp = it.next();
if (shouldHandleMouse) {
if (comp.shouldHandleMouse())
comp.mouseEntered(mouseEvent);
... |
c649b4c4-ee3c-46a6-a53e-700ff4dcb75e | 6 | public void setField(Field f) {
if (neighbours == null)
neighbours=new ArrayList<Road>();
if (closeNeighbours == null)
closeNeighbours=new ArrayList<Road>();
this.field = f;
field.setTower(this);
for (Tile tl : field.getNeighbours()) {
if (tl.getClass() == Road.class) {
neighbours.add((Road... |
68a0fc11-1530-4693-83b2-47ec10d05dab | 1 | public void testMinus_int() {
Days test2 = Days.days(2);
Days result = test2.minus(3);
assertEquals(2, test2.getDays());
assertEquals(-1, result.getDays());
assertEquals(1, Days.ONE.minus(0).getDays());
try {
Days.MIN_VALUE.minus(1);
... |
5a0e3a56-271c-4ed7-aff2-85d656ee4b51 | 5 | public String[] resolveColumns(String[] columns) throws SQLException {
String[] cols;
if (columns.length == 1 && columns[0].equals("*")) {
cols = new String[fields.length];
for (int i=0;i<fields.length;i++) {
cols[i] = fields[i].name();
}
} else {
cols = new String[columns.length];
for (int i=0... |
aa3f8d4a-5ec2-4360-b168-aeacbbc4c69e | 2 | private void copySelectedText() {
Point selection = editor.getSelection();
System.out.println("copy-" + (System.currentTimeMillis() - lastClipboardTime));
if (selection.x < selection.y && System.currentTimeMillis() - lastClipboardTime > 400) {
lastClipboardText = (String)clipboard.getContents(TextTransfe... |
6968b034-fb6b-477a-b3c3-4394f0eeaec3 | 7 | public static void warWithTwoCardsLeft(Hand p1, Hand p2, Hand extras)
{
int flag = 0;
// draw facedown cards
Card p1_facedown = p1.drawCard();
Card p2_facedown = p2.drawCard();
// add facedown cards to extras pile
extras.addCard(p1_facedown);
extras.addCard(p2_facedown);
Card p1_battleCard = p1.draw... |
d1b08b5b-358c-4fa6-9711-cd55aa2e5499 | 7 | private void changeRanges() {
boolean flag = false;
try {
int x = Integer.parseInt(a.getText());
if (x <= 0)
throw new IllegalArgumentException();
flag = true;
int y = Integer.parseInt(b.getText());
if (y <= 0)
throw new IllegalArgumentException();
if (x != drawingPanel.getXRange()... |
91cae9d5-4133-4ba1-b7a0-f5f333140161 | 4 | public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g... |
1a9afe4d-40d2-4ed1-b98d-22e13b4b8d0c | 5 | public void avaliarCodigoFonte() {
try {
//Compilação do código-fonte
String nameCommand = "gcc " + nameTestFile + ".c" + " -lcunit -o " + nameTestFile;
Process process = Runtime.getRuntime().exec(nameCommand);
BufferedReader entrada = new BufferedReader(new Inpu... |
add2a9f6-f0f3-497a-a80c-c0fbd605d355 | 9 | public String getMergedfile(SmartlingKeyEntry updateEntry) throws IOException, JSONException {
// for each locale (for the specific project) , get translated file from smartling
updateEntry.setLocale("es");
String responseHtml = SmartlingRequestApi.getFileFromSmartling(updateEntry.getFileUri()... |
a86865f7-cb16-4076-b746-617ac9aeab3d | 4 | public void GetInput() {
if (Keyboard.isKeyDown(Keyboard.KEY_W))
Move(0, -4);
if (Keyboard.isKeyDown(Keyboard.KEY_S))
Move(0, 4);
if (Keyboard.isKeyDown(Keyboard.KEY_D))
Move(-4, 0);
if (Keyboard.isKeyDown(Keyboard.KEY_A))
Move(4, 0);
} |
be874327-622c-42ba-8496-b7f5b29c71a6 | 7 | public Wave18(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 330; i++){
if(i % 17 == 0)
add(m.buildMob(MobID.JIGGLYPUFF));
else if(i % 27 == 0)
add(m.buildMob(MobID.KADABRA));
else if(i % 5 == 0)
add(m.buildMob(MobID.PIDGEY));
else if (i % 4 == 0)
add(m.buildMob(MobID.... |
ae43d7a4-ea9b-4057-99ad-6c5d78ea62b5 | 0 | public MultipartFile getFile() {
return file;
} |
c85abcee-6c36-49f6-a19c-6b55b1e01549 | 2 | private short parseTLVLength(byte[] data, short dataOffset, short[] result) {
if (data[dataOffset] == (byte) 0x81) {
result[0] = data[(short) (dataOffset + 1)];
return (short) (dataOffset + 2);
}
else {
if (data[dataOffset] == (byte) 0x82) {
re... |
168ab202-c21e-431b-8209-78588ec8f6fa | 3 | public static void main(String[] args) {
Motor testMotor = new Motor();
boolean goON = true;
while (goON) {
System.out
.println("Input RPM (1=49 2=50 ...) or simply Return to continue");
int read = 0;
try {
read = System.in.read();
/** lol at flush */
System.in.skip(System.in.availabl... |
1f1f2350-c2e5-401f-bdb6-4282900d12fc | 6 | private void selectPiece(Point p)
{
chosenPiece=null;
possibleMoves=null;
if(!myBoard.isOnBoard(p))//it isn't on the board
{
return;//chosenPiece and possible moves should be null
}
Piece thePiece = myBoard.getPiece(p);
if(thePiece==null)
{
return;//if the point doesn't have any piece in it, t... |
0e23d1a0-8ec4-4300-b3aa-476dfa0ad0a6 | 1 | public static void insertUtilisateur(int idfonction, int idville, String nom, String prenom, String identifiant, String password) throws SQLException {
String query;
try {
query = "INSERT INTO UTILISATEUR (ID_FONCTION,ID_VILLE,UTILNOM,UTILPRENOM,IDENTIFIANT,PASSWORD) VALUES (?,?,?,?,?,?) ... |
4503ad6e-2e02-4576-a710-ec71db0735ea | 3 | private boolean isRepeatSubmit(HttpServletRequest request) {
String serverToken = (String) request.getSession(false).getAttribute(SUBMIT_TOKEN_NAME);
if (serverToken == null) {
return true;
}
String clinetToken = request.getParameter(SUBMIT_TOKEN_NAME);
if (clinetToke... |
ef41b3ca-6b63-4f5b-8db7-d0170395051e | 3 | @Override
public void paint( Graphics2D g ) {
if( selection != null && selection.isSelected() ) {
g.setColor( color );
Rectangle bounds = item.getBoundaries();
int x = bounds.x-1;
int y = bounds.y-1;
int w = bounds.width+1;
int h = bounds.height+1;
for(int i = 0; i < thickness; i++ ){
... |
15972713-37dc-4d9d-826c-5372515ac5a1 | 1 | public TiarUserMessage tiarUserMessageDecode(String enc)
throws JSONException {
JSONObject obj = new JSONObject(enc);
TiarUserMessage TiarMessage = new TiarUserMessage();
JSONArray JArray = obj.getJSONArray(("GameBoard"));
int[] array = new int[9];
for (int i = 0; i < array.length; i++) {
array[i] = J... |
837aa6b7-13e2-4cb3-8b80-9a3dea9402b7 | 5 | private void startClientMonitor(){
while(noStopRequested){
try {
if(this.timeOut > 0){// 超时阀值
Iterator<Object> it = clients.keySet().iterator();
while(it.hasNext()){
Object key = it.next();
Client client = clients.get(key);
if(!client.isReadDataFlag()){// 超时没有收到数据
clie... |
389bb97f-0f60-4573-98b0-c800bfa9e32b | 9 | public void update(double deltaTime){
if(animate){
// Perform sprite animation:
currentTime+=deltaTime;
// If the time has passed time for next frame:
if(currentTime > frameTime){
// Find out how many frames have passed in this time:
float frameAdvance = (float) Math.floor(currentTime/frameTim... |
8acc7f41-70a7-43a8-82b5-0040c80ec6dc | 6 | public void updateType(int id, String string) {
type = string;
if(string == "Blank") {
updateImage(Database_Tiles.tiles[id], ImageLoader.blank);
}
if(string == "Field") {
updateImage(Database_Tiles.tiles[id], ImageLoader.field);
}
if(string == "Forest") {
updateImage(Database_Tiles.tiles[id], Im... |
79e72d7a-adad-4bbb-8ff6-62a1ef5c048c | 9 | private void updateStateTellCreator(List<Keyword> keywords, List<String> terms) {
//We should have come here by a keyword jump and the recipe shouldve been passed or set
if (keywords != null && !keywords.isEmpty()) {
for (Keyword kw : keywords) {
if (kw.getKeywordData().getType() == KeywordType.RECIPE) {
cur... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.