method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5d513a22-e97f-44ba-9dda-d62a9ef959e3 | 0 | @Override
public String toString()
{
return "isStrict()";
} |
52f7e04c-717a-43fb-809c-a8a8a358dec3 | 0 | @Test
public void testFromInternalTestLinkId() {
final TestLinkUriResolver resolver = new TestLinkUriResolver(
URI.create("http://testlink.sourceforge.net/demo/"));
final URI actual = resolver.fromTestLinkId(testLinkId);
assertEquals(expectedUri, actual);
} |
9cc7fe5d-08ae-48c6-967f-b5a5c3f5e585 | 7 | private void processDirectoryResponse(OMMItemEvent event)
{
OMMMsg responseMessage = event.getMsg();
ItemClosure itemClosure = (ItemClosure)event.getClosure();
int itemIdx = itemClosure._idx;
System.out.println(_className + ":* Received Directory Response from consumer - "
... |
2fab4b3b-8ac1-4d8a-a950-14624bc45262 | 2 | public void step() {
for (Particle p : this.p) {
p.interact(this);
}
mergeParticles();//FIXME This should be moved below
for (Particle p : this.p) {
p.move(this);
}
//FIXME mergeParticles() should be placed here
updateGraphicalRepresentation();
} |
02cb1955-f794-4983-8cc6-3a8c5158ab56 | 6 | public static boolean combineObject(SynchronizedBlock synBlock,
StructuredBlock last) {
/* Is there another expression? */
if (!(last.outer instanceof SequentialBlock))
return false;
SequentialBlock sequBlock = (SequentialBlock) last.outer;
if (!(sequBlock.subBlocks[0] instanceof InstructionBlock))
... |
7452b177-7c5b-45b0-862b-7071c2d5d063 | 6 | @Override
public void controlObject(GObject target, Context context) {
// Can we control the target?
if (!canControl(target, context)) {
previousTransforms.clear();
return;
}
// Perform the calculation.
// (This is an abstract method delegated to subclasses.)
Point2D transform = calculateControl(tar... |
12ea33e6-e177-4c9f-8721-b488d8efa5e6 | 8 | public boolean equals(Object par1Obj)
{
if (par1Obj != null && par1Obj instanceof NBTBase)
{
NBTBase var2 = (NBTBase)par1Obj;
return this.getId() != var2.getId() ? false : ((this.name != null || var2.name == null) && (this.name == null || var2.name != null) ? this.name == nul... |
a92a7862-e7b3-4b8c-8236-e78dac54e6dd | 5 | public static PolyTypes swigToEnum(int swigValue) {
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) {
return swigValues[swigValue];
}
for (int i = 0; i < swigValues.length; i++) {
if (swigValues[i].swigValue == swigValu... |
62300d1b-b5bf-4d82-9d2c-4ac0d0adfe8c | 9 | private boolean buildFriendsListMenu(RSInterface class9)
{
int i = class9.contentType;
if(i >= 1 && i <= 200 || i >= 701 && i <= 900)
{
if(i >= 801)
i -= 701;
else
if(i >= 701)
i -= 601;
else
if(i >= 101)
i -= 101;
else
i--;
menuActionName[menuActionRow] = "Remove @whi@" + fr... |
a9aa2c81-7a06-4426-b835-d7603b4d0685 | 4 | public void run() {
long currenttime;
long previoustime = System.nanoTime();
long passedtime;
int frames = 0;
double unprocessedseconds = 0;
double secondspertick = 1 / 60.0;
int tickcount = 0;
boolean ticked = false;
while (isRunning) {
currenttime = System.nanoTime();
passedtime = currenttime... |
77bd24b9-7969-4c42-a000-8dd07b2447c3 | 9 | public IndexedModel ToIndexedModel()
{
IndexedModel result = new IndexedModel();
IndexedModel normalModel = new IndexedModel();
HashMap<OBJIndex, Integer> resultIndexMap = new HashMap<OBJIndex, Integer>();
HashMap<Integer, Integer> normalIndexMap = new HashMap<Integer, Integer>();
HashMap<Integer, Integer> i... |
db39a1fa-cfab-4571-beed-1fd516da815c | 6 | private boolean tradeMoneyIntern(Money wantedType)
{
if (wantedType == Money.FIVE_HUNDRED)
{
return false;
}
for (int i = 0; i < 7; i++)
{
if (Money.values()[i] == wantedType)
{
final Money from = Money.values()[i + 1];
final Money to = Money.values()[i];
if (this.ownedMoney.get(from) ... |
6e846a65-628e-415e-b47a-1835bc999e60 | 3 | @Override
public void ParseIn(Connection Main, Server Environment)
{
Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom);
if(Room == null)
{
return;
}
int index = Main.DecodeInt();
TraxSong Song2 = Room.TraxPlaylist.PlaylistByIndex.get... |
cfd522d7-4f2c-45d0-a91a-f76bb15637be | 5 | private double[] transform(){
// initialize arrays and analyse original data
if(!this.initializationDone)this.initialize();
// Shift data to ensure all values are greater than zero
this.lambdaTwo = 0.1*this.standardizedOriginalRange - this.standardizedOriginalMinimum;
ArrayMath... |
dcd2e1df-c47d-4215-898e-4e7fe999dd12 | 3 | @Override
public int compareTo(ActionHook other) {
if (other == null) {
return 1;
}
if (this.getPriority() > other.getPriority()) {
return -1;
} else if (this.getPriority() == other.getPriority()) {
return 0;
} else {
return 1;
... |
e5caa092-223e-479d-8b92-2c5411bce54b | 2 | public void check() {
try {
for (int i = 0; i < salidas.getLength(); i++) {
CompuertaLogica salida = salidas.get(i);
boolean valor = salida.getInput(0);
listener.actionPerformed(new ActionEvent(this, SET_INOUT, salida.getReference() + "#" + valor));
... |
138e3289-df4c-4c79-979c-8da3f721bc99 | 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... |
0eb999fb-6f57-4b67-b707-c433bba6eaf5 | 3 | public static void main(String[] args) throws InterruptedException
{
requestedReducerThreads = 0;
requestedMapperThreads = 0;
try
{
requestedReducerThreads = Integer.parseInt(args[0]);
//Instantiate Arrays
buffers = new BBMonitor[requestedReducerThreads];
fileNames = new String[args.length-1];... |
d85d27e4-1d2c-4747-836b-11ef8502433b | 1 | private HttpURLConnection set_headers(String url)
throws MalformedURLException {
URL obj = new URL(url);
HttpURLConnection con = null;
try {
con = (HttpURLConnection) obj.openConnection();
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");... |
2e0197ab-ba28-4c90-9e1b-d72b73f28c26 | 0 | protected Automaton createEmptyAutomaton(Document document) {
return new FiniteStateAutomaton();
} |
65a30f06-9423-419c-baa6-744455ca3221 | 7 | @Test
public void builderTestAlternating() {
for(int len = 0; len < 10_000; len++) {
final IntArrayBuilder builder = new IntArrayBuilder();
final int mid = len / 2;
if(len % 2 == 0) {
for(int i = 0; i < len; i++) {
if(i % 2 == 0) builder.prepend(mid - 1 - i / 2);
els... |
c312d7f8-66dc-40d9-8ebd-b0018c6e0a48 | 5 | public static RuleType getRuleType(String str) throws ParserException {
for (RuleType ruleType : RuleType.values()) {
switch (ruleType) {
case LITERAL_VARIABLE_SET:
if (str.startsWith(ruleType.symbol)) return ruleType;
break;
default:
// skip all characters before the rule label
int loc = str... |
4d6f5e1b-0c76-4b3b-9040-064f6629b51c | 7 | public finger_print closest_finger(finger_print fp){
double min_distance=Double.MAX_VALUE;
finger_print fret=null;
fp.comparisons=0;
for(int i=0;i<final_pivot_list.size();i++){
fp.comparisons++;
node n=final_pivot_list.get(i);
... |
2cb62ea3-5a8f-493a-9b96-ccc01b1681af | 0 | @Basic
@Column(name = "CSA_ID_ELEMENTO")
public int getCsaIdElemento() {
return csaIdElemento;
} |
5bb55fd6-8034-4a17-a564-ca1e1afde5cf | 3 | @SuppressWarnings("unchecked")
public ArrayList<Integer> getCorrectChoiceIndexes() {
ArrayList<Integer> indexList = new ArrayList<Integer>();
ArrayList<String> questionList = (ArrayList<String>) question;
ArrayList<String> answerList = (ArrayList<String>) answer;
int N = questionList.size() / 2;
for (int j =... |
65358e42-1f2f-435d-b267-fb1869898584 | 0 | public static String getCpf() {
return cpf;
} |
73e8f4b6-c0e0-45d9-8eda-606d1867e215 | 1 | public void creerTache(PrintWriter out, String [] tache){
try{
Tache t = new Tache(tache[1], tache[2], tache[3], tache[4], nbTaches);
taches.put(nbTaches++, t);
out.println("OK");
out.flush();
}
catch(Exception e){
Tache t = new Tache(tache[1], tache[2], nbTaches);
taches.put(nbTaches++, t);
... |
d3fd90d8-7a8d-4a26-8252-ebf609292f5e | 8 | public static void main(String[] args) throws Throwable {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String linea;
while((linea=bf.readLine())!=null){
int n = Integer.parseInt(linea);
int cantidadDePermutaciones=0;
ArrayList<Integer> numeros = new ArrayList<Integer>();
i... |
6252a760-0645-4786-874c-4fbcb353883c | 2 | public double pdf(double p, int k, int n) {
if ((k < 0) || (k > n)) return 0;
return Math.exp(pdfLog(p, k, n));
} |
72e6c17c-bfe8-4b0b-83f6-0ee929aacb49 | 3 | protected void updateParticlePositions() {
double random = Math.random();
for(int i = 0; i < position.length; i++){
for(int k = 0; k < position[i].length; k++){
if(sigmoidfunction.normalise(velocities[i][k]) > random){
position[i][k] = 1;
}else{
position[i][k] = 0;
}
}
}
} |
c5265d3d-6d90-4992-8c58-20c462dfb7b5 | 1 | public void unselectAll() {
for (Integer opp : list.keySet()) {
list.get(opp).unselect();
}
} |
40fc6d1b-ad29-49cb-9ea2-220c594fdf3f | 9 | public int longestConsecutive(int[] nums) {
// Start typing your Java solution below
// DO NOT write main() function
if (nums == null || nums.length == 0) {
return 0;
} else {
int max = 0;
Map<Integer, Integer> countMap = new HashMap<Integer, Integer>();
for (Integer num : nums) {
Integer numCou... |
731aeefd-d192-4aa0-8d6a-fb8c8589e2db | 7 | private FilterDto parseFilter(String initLine, BufferedReader br) throws IOException {
FilterDto filterDto = new FilterDto();
Parameter param = new Parameter();
Matcher matcher;
String currentLine = initLine;
while ((currentLine = br.readLine()) != null &&
curren... |
77028dc8-2009-4913-8e68-c9b21e5795a8 | 7 | public List<Ability> returnOffensiveAffects(Physical fromMe)
{
final Vector<Ability> offenders=new Vector<Ability>();
for(final Enumeration<Ability> a=fromMe.effects();a.hasMoreElements();)
{
final Ability A=a.nextElement();
if((A!=null)&&((A.classificationCode()&Ability.ALL_ACODES)==Ability.ACODE_POISON)... |
83682ab6-5a45-42f7-9c8b-3f66e9078337 | 4 | public void pawnPromotion(Point p){
if(b.get(p) instanceof Pawn && p.getY() == 8){
b.remove(p);
b.put(p, new Queen(true));
}
else if(b.get(p) instanceof Pawn && p.getY() == 1){
b.remove(p);
b.put(p, new Queen(false));
}
} |
bd361493-ff4a-41b6-8c4f-9c5eff4e426a | 9 | @SuppressWarnings("unchecked")
/**
* Returns the results of calling the specified method from the specified
* class using the specified parameters.
* @param c Class to call the method on.
* @param method Name of the method.
* @param paramTypes Data types of the parameters being passed to the method.
* @param par... |
0fc86059-58df-4d32-a95c-dcb60a4119e9 | 2 | public Vector<Object> getRegressionResultsAsVector(){
if(!this.regressionDone)this.regression();
int n = this.results.size();
Vector<Object> res = new Vector<Object>(n);
for(int i=0; i<n; i++)res.add(this.results.get(i));
return res;
} |
3a0ad2d7-12a0-4da9-969f-3c5f38f3f0bb | 7 | public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
utx.begin();
em = getEntityManager();
User user;
try {
user = em.getReference(Us... |
6a1916f7-9990-4f8c-9240-02bfe422d5e4 | 3 | public void checkCalculationEnabled() {
if (lstDays.getSelectionModel().getSelectedIndex() == -1) {
btnCalculate.setDisable(true);
}else if (!optToday.isSelected() && !optTomorrow.isSelected()) {
btnCalculate.setDisable(true);
}else{
btnCalculate.setDisable(fa... |
7de46c30-736d-4795-b653-484adcc95ca4 | 4 | @Override
public IMazeCell chooseRandomCell(ArrayList<IMazeCell> potentialCells)
{
IMazeCell result;
int r = random.nextInt(potentialCells.size());
System.out.println("Selected cell with index: " + r);
EnumSquareMazeCellDirection positionRelative = getPositionRelative(potentia... |
f9db0bbc-b53f-4ee8-b738-ba444221c59f | 7 | public void run(){
// If we have a list of replies from a previous repetition
// calculate suspected processes
if (started) {
Utils.out(p.pid,"timer tick");
for(int i = 0; i <= p.getNo(); i++) {
if (i != 0 && i != p.pid) {
if (successfulReplies[i-1] <= 0 && !suspe... |
c077238e-e6a8-4146-a347-dbad2ea8dfb2 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Page)) {
return false;
}
Page other = (Page) object;
if ((this.id == null && other.id != null) || (this.id != n... |
aa1ab700-8be1-48c6-9b9a-2b3454ebc4f1 | 0 | public Grille setCell(int x, int y, boolean actif) {
grid[x][y] = actif;
return this;
} |
fd129a27-c92b-43b3-a213-9f9716c429c7 | 8 | private void forStatement() {
beginScope();
lex(); expect(TK_OPENPAREN);
// Decl
if (_token != TK_SEMICOLON)
statementDecl();
expect(TK_SEMICOLON);
int jmppos = _func.getCurrentInstPos();
int jmpfpos = -1;
// Cond
if (_token != TK_SEMICOLON) {
expression();
jmpfpos = _func.addInst(JM... |
78cd0255-4c76-4b5e-9313-5be77186c579 | 4 | protected String getJarName(URL url)
{
String fileName = url.getFile();
if (fileName.contains("?")) {
fileName = fileName.substring(0, fileName.indexOf("?"));
}
if (fileName.endsWith(".pack.lzma"))
fileName = fileName.replaceAll(".pack.lzma", "");
else if (fileName.endsWith(".pack")... |
332638b9-7693-4513-9061-620cd75791d3 | 1 | public String[] getLabels() throws IOException {
if (labels == null) setLabels();
return labels;
} |
d5dbcd5c-a2b2-4529-b8f3-3df8eaf47a78 | 2 | public static InterchangeStatusEnumeration fromValue(String v) {
for (InterchangeStatusEnumeration c: InterchangeStatusEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
a8553f71-809a-4224-b117-3d2ca71187fe | 4 | public void send(Player player, Reward reward) {
if(reward.message != null) {
plugin.sendMessage(player, reward.message);
}
if(reward.money != null) {
plugin.economy.depositPlayer(player.getName(), reward.money);
}
if(reward.action != null && !reward.action.isEmpty()) {
executeAction(reward.... |
6f8cf2ca-d40c-44e2-8821-c1ec0a554def | 8 | public void output(SchemaCollection sc, OutputDirectory od, String[] params, String inputFormat, ErrorHandler eh)
throws SAXException, IOException, OutputFailedException, InvalidParamsException {
final Guide guide = new Guide(DEFAULT_ENABLE_ABSTRACT_ELEMENT);
final BasicOutput.Options outputOptions = ... |
7e01defd-9bda-4eb6-b98d-7839c78e4f2b | 1 | public final Rectangle2D getBounds() {
if (bounds == null)
updateBounds();
return bounds;
} |
1581fd7c-4536-4b28-9fbd-d3849af4bc60 | 4 | @Override
public PropertyFilter getFilterByName(String name) {
for (int i = 0; i < filters.size(); i++) {
PropertyFilter filter = (PropertyFilter) filters.get(i);
String filter_name = filter.getName();
if (filter_name == null && name == null) {
return filter;
} else if (filter_name.equals(name)) {
... |
6519483f-9f04-46f2-93ce-da573d4c1326 | 8 | public static double getChisquarePValue(
List<Double> list1, List<Double> list2) throws Exception
{
if( list1.size() != list2.size())
throw new Exception("No");
List<Double> rowSums = new ArrayList<Double>();
List<Double> colSums= new ArrayList<Double>();
for( int x=0; x <list1.size(); x++)
ro... |
7948d3fb-2207-4f20-81a1-1c27dac7b262 | 3 | public static boolean PointWithRect(float px, float py, float rx, float ry, float rw, float rh) {
return (px >= rx && px <= (rx + rw) && py >= ry && py <= (ry + rh));
} |
0226cef8-7b37-4028-a663-30af22e913d2 | 1 | private void incCount(String featureType, String featureValue) {
if (!featureValueFrequency.containsKey(featureType)) {
MultiSet<String> featureValues = new MultiSet<String>();
featureValueFrequency.put(featureType, featureValues);
}
featureValueFrequency.get(featureType).add(featureValue);
} |
e1a54d0f-561b-4c6c-98c8-613a401d3b5e | 0 | public World()
{
initWorld();
setFocusable(true);
} |
03addcdc-ecde-4f87-a827-b175588c9a12 | 7 | @Override
public InputStream getInputStream(String file) {
final String uri = this.entryMapping.get(file);
if (uri == null) return null;
try {
final JarURLConnection connection = (JarURLConnection) new URI("jar:" + new File(uri).toURI() + "!/").toURL().openConnection();
... |
20af9bae-90fd-489b-a243-8dbaf9da5f04 | 4 | @ Override
public boolean accept(File dir, String name)
{
// Ensure file is not a directory and file contains an extension
if (new File (dir + File.separator + name).isDirectory () || !name.contains ("."))
return false;
String ext = name.substring (name.lastIndexOf ("."));
// Check file extension aga... |
c88ad3f7-383f-49a5-8601-1a20faeb02a4 | 2 | public void push(int in) {
if (!isEmpty() && in > top()) {
++totalRejected;
} else {
super.push(in);
}
} |
78c88568-7e62-4260-af1a-b31168a57a3d | 0 | public BinaryDateTime() {
} |
8f6306d1-47da-4c41-8677-eb0a2fe2d9b2 | 5 | public String getAbsolutePath(Object pkg_obj,String filename) {
if (filename.indexOf("/")==0
|| (filename.indexOf("://")>=0 && filename.indexOf("://")<=5) ) {
// path starts with "/" or protocol: do not change
return filename;
} else {
// path does not start with "/": prepend package name
// with ".... |
c5fbdd0d-44d8-46fd-8a7e-b41c7039d21b | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
daeacbf2-caee-4abf-96db-d74b63e7645a | 4 | public static void main(String args[]) throws IOException {
// startup AD-HOC network
boolean isWindows = System.getProperty("os.name").startsWith("Windows");
if (isWindows) {
System.out.println("Please boot this application on Linux");
//System.exit(0);// even weggehaald omdat ik anders niet kan teste... |
4d2f2241-b148-40ab-880a-707a43457e59 | 8 | private static Packet getNewGamePacket(String packet) {
Scanner sc = new Scanner(packet);
if(!sc.next().equals(Packet.PACKET_CODES.NEW_GAME_CMD)) return null;
Packet res = new Packet(Packet.PACKET_CODES.NEW_GAME_CMD);
GameSettings gs = new GameSettings();
... |
15cff06e-6721-4c0d-9c7a-5697c88a86a7 | 2 | private void insertLineitems(int numInserts, int firstOrderNode,
int numOrders, int firstPartsuppNode, int numPartsupps) {
for (int i = 0; i < numInserts; i++) {
ArrayList<Integer> pk;
int orderNode, linenumber;
do {
pk = new ArrayList<Integer>(2);
orderNode = firstOrderNode + r.nextInt(numOrders)... |
b6bbfbfe-c55e-4ebd-9c96-e5ef3daf011e | 6 | @Override
public void keyPressed(KeyEvent e)
{
int rotation = 0;
if (e.getKeyCode() == KeyEvent.VK_DOWN)
activeTetromino.doMoveDown();
if (e.getKeyCode() == KeyEvent.VK_LEFT)
{
activeTetromino.doMoveLeft();
if (activeTetromino.sideCollision(getXArray(), getYArray()))
activeTetromino.doM... |
a3e5f1e8-7d63-4ecf-9cb5-2760d8481964 | 4 | @Override
public double getYRotation()
{
double lowest = 9001;
double highest = 0;
int y = -20;
if ((((getRotationAngle() / 90)) % 2) != 0)
y = 20;
for (Block block : blockArray)
{
if (block.getYValue() > highest)
highest = block.getYValue();
if (block.getYValue() < lowest)
lowest = bloc... |
197a21be-c981-438b-9105-17438e194662 | 9 | private static String selectATM(BankComputer firstBank, BankComputer secondBank, Scanner in)
throws FileNotFoundException
{
String choice = "";
System.out.println("Please choose an ATM or type quit to exit: ");
choice = in.next();
while(!choice.equals("ATM_A1") && !choice.equals("AT... |
3168c2f8-bd5d-43b0-8d0c-5fc7d6fcb3b5 | 5 | protected boolean checkIfBlockCanMove(Block block) {
for (int i = 0, newCol, newRow; i < block.getWidth(); i++) {
for (int j = 0; j < block.getWidth(); j++) {
if (block.get(j,i) == 1) {
newCol = block.getLocX() + i;
newRow = block.getLocY() + j... |
7a4e861c-e45e-43aa-bcaa-044d66d9077d | 0 | public void setProductID(String productID) {
ProductID = productID;
} |
8b0f1870-7a3d-4171-a68a-a0e6a109d74a | 3 | @Override
public int compareTo(TimeEffect o) {
if (this == o)
return 0;
if (this.nextExecution < o.nextExecution) return -1; //'this' executes first.
if (this.nextExecution > o.nextExecution) return 1; //'this' executes second.
return -1; //by default, with the same... |
e89d32c3-71d2-42e0-95a1-68ed5b892ef2 | 0 | public WindowNouvellePartie() {
this.setTitle("Nouvelle Partie - Jame of Life");
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JPanel contentPane = new JPanel();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS));
vTxtLignes.setText("20");
... |
30b17824-08a9-41e0-a9eb-cf24225ae48d | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Usuario other = (Usuario) obj;
if (login == null) {
if (other.login != null)
return false;
} else if (!login.equals(other.login))
ret... |
464f5fa4-e1aa-458c-a098-3c24c51d0664 | 7 | public static String createHeaders( int response_code )
{
String header = null;
switch ( response_code )
{
case 200:
header = RESPONSE_200;
break;
case 204:
header = RESPONSE_204;
break;
case ... |
63921470-da2a-40e6-9f33-193d7d4ee2d4 | 3 | @Override
public void shoot(Point targetPoint) {
if (actionMode != ActionMode.ATTACKING) {
actionMode = ActionMode.ATTACKING;
}
if (canFire) {
registry.getProjectileManager().createProjectile(this,
"Web",
10,
... |
980352d2-6f94-4441-a788-88442a151de0 | 6 | @SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case statePackage.PLAYER__OWNED_COUNTRIES:
getOwnedCountries().clear();
getOwnedCountries().addAll((Collection<? extends CountryState>)newValue);
return;
case statePackage.PLAYER__OWNED... |
213ee0df-15a2-436e-a922-4c2e2e58cb6e | 3 | private int paragraphHandler(char[] chars, int i) {
String plainWord = "";
i++;
while (chars[i] != '}' && i < chars.length) {
plainWord = plainWord + chars[i];
i++;
}
if (plainWord == " ")
basicText.append("\\par ");
else {
... |
ae73cd8a-3b97-4edc-9fed-4df572c91345 | 9 | private void composeZigZagLevels(Stack<TreeNode> oddLevel, Stack<TreeNode> evenLevel, int level,
List<List<Integer>> results){
if(oddLevel.empty() && evenLevel.empty()){
return;
}
else{
List<Integer> res = new ArrayList<Integer>();
if(level%2==0){
while(!evenLevel.empty()){
... |
49fd5c65-7f72-42ff-9764-562a493692af | 3 | private static void findminimumgreedyscorefortailvertex(int tailvertex) {
// TODO Auto-generated method stub
int temp = 0;
for(int j = 0 ; j<graph.get(tailvertex).size();j++){
if(!(explored.contains(graph.get(tailvertex).get(j)))){
temp = edgewieght[tailvertex][graph.get(tailvertex).get(j)];
if(temp<scor... |
50bcf244-8f17-431e-a200-9b94a8466a62 | 6 | @Test
public void testFlagOnStartingPositionOfEachPlayer() {
int count = 0;
for (PlayerInfo player : game.getPlayers()) {
boolean containsStartingPosition = false;
boolean containsFlag = false;
for (Element e : grid.getElementsOnPosition(player.getPlayerPosition())) {
if (e instanceof PlayerStartPos... |
f36ac10c-c101-4e04-ba2e-58d4761c81b7 | 8 | public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... paramTypes) {
Class<?>[] t = toPrimitiveTypeArray(paramTypes);
for (Constructor<?> c : clazz.getConstructors()) {
Class<?>[] types = toPrimitiveTypeArray(c.getParameterTypes());
if (equalsTypeArray(types, t))... |
e5ebb1e7-e9e0-4c25-97e0-58867bb4ed1f | 8 | protected void checkReg(int reg_code, int val) {
for (int i = 0; i < 8; i++) {
switch (reg_code) {
case 7:
assertTrue(cpu.getControlUnit().getRegAValue(i)==((val & 1<<i) == 1<<i));
break;
case 0:
assertTrue(cpu.getControlUnit().getRegBValue(i)==((val & 1<<i) == 1<<i));
break;
case 1... |
403cbd12-fa4c-48d9-bce8-430dd0c6ca5c | 3 | private static void putSetting(String key, String value) {
if (key != null && value != null && !value.trim().isEmpty()) {
prefs.put(key, value);
}
} |
bdb2dd1a-3e99-4bff-8d92-28bd39766252 | 9 | private void continuePass(GameState state, int result, boolean execute) throws IllegalActionException {
state.setAwaitReroll(false);
Player passer = state.getCurrentPass().getPasser();
Player catcher = state.getCurrentPass().getCatcher();
int success = state.getCurrentPass().getSuccess();
PassRange r... |
5cf4424a-3b4a-4b28-b629-5b83efca2c16 | 8 | public boolean[][] computeTransitiveClosure(AdjacencyMatrixGraph g)
{
int n = g.getCardV();
// Array t is triply indexed. The first index is the
// iteration number, and the last two indices are the vertex
// indices i and j. Think of t as indexed by t[k][i][j].
// Warning: Since i and j index vertices, th... |
7801b5f2-bcb0-4535-80da-cf811c5a546e | 7 | void radb4(final int ido, final int l1, final double in[], final int in_off, final double out[], final int out_off, final int offset) {
final double sqrt2 = 1.41421356237309514547462185873882845;
int i, ic;
double ci2, ci3, ci4, cr2, cr3, cr4;
double ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr... |
c9df192e-5dea-4da2-8d9b-9b5b3c2acb7f | 8 | private boolean inPoly(FastVector ob, double x, double y) {
//brief on how this works
//it draws a line horizontally from the point to the right (infinitly)
//it then sees how many lines of the polygon intersect this,
//if it is even then the point is
// outside the polygon if it's odd th... |
1bcd92a7-72dd-4ca1-b155-08dae6bbae00 | 4 | public String Compose(String sym,int x) {
String tmp;
switch(sym){
case "retrograde":
tmp=retrograde();
break;
case "transpose":
tmp=transpose(x);
break;
case "reflection":
tmp=reflection(x);
break;
case "doNothing":
tmp=doNothing();
break;
default:
tmp="InvalidSymmerty";
}... |
fe7366dd-17aa-456c-9af4-8f7daea0ac8f | 7 | public void load(BufferedReader reader) {
try {
String line = reader.readLine();
String[] temp = line.split(";");
for(int x = 1; x<temp.length; x++) {
swingTimes[x - 1] = Float.parseFloat(temp[x]);
}
if(swingTimes.length > 0)
timeSpinner.setValue(swingTimes[0]);
totalText.setText(temp[0] + "... |
873efddc-ec48-4bd0-9060-44ba0cfe765e | 4 | public int getRed(int x, int y) {
int value = 0;
if ((x >= 0) && (y >= 0) && (x < im.getWidth()) && (y < im.getHeight())) {
value = ((im.getRGB(x, y) >> 16) & 255);
}
return value;
} |
84795386-5a5a-4d84-aecd-c8b2019c5627 | 7 | public ArrayList<Card> reduce(){
ArrayList<Card> toUse = new ArrayList<Card>();
for (int y = 0; y < _hand.size(); y++)
toUse.add(_hand.get(y));
System.out.println("The Table: " + getTable());
boolean anyOfSuit = checkSuit();
for (int x = toUse.size() - 1; x >= 0;... |
442aebae-46eb-45ee-a42e-ed709c83213b | 7 | public void mouseMoved(MouseEvent e) {
if (scrollableTabLayoutEnabled()) {
MouseMotionListener[] mml = tabPane.getMouseMotionListeners();
for (int i = 0; i < mml.length; i++) {
mml[i].mouseMoved(e);
}
}
rolloverIndex... |
0d0bb3dc-a155-4a15-97a2-2ea93aff765e | 0 | public MainWindowModel getMainWindowModel() {
return mainWindowModel;
} |
fae01329-9d9f-4881-a4b6-45c8f15cc4a3 | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the server with glorious data
task = plugin.getServer().getScheduler().runTaskTimerAsynchronous... |
ebc377d3-8fd8-4440-bac1-dc0c70402a3b | 0 | public static void main(String[] args) throws IOException{
Ambient.setupAmbient();
testSeqWrite();
Aux.cleanMemory();
testSeqRead();
Ambient.clearAmbient();
} |
7d5758f6-bf58-48f6-a674-c482e87165d6 | 7 | public double[] distributionForInstance(Instance instance) throws Exception {
double[] probs;
if (m_isLeaf && m_hasConstr) { //leaf
//leaf: use majoraty class or constructor model
probs = modelDistributionForInstance(instance);
} else {
if (m_isLeaf && !m_hasConstr)
{
p... |
27d9ca9f-5777-41e0-b6db-cb1f10ad7f7a | 0 | public int getIdCombinacion() {
return idCombinacion;
} |
1b6ea6ca-6ef5-4e73-bf93-a3c990fe6a4f | 7 | public boolean setNeighboorById(Tile t, int side) {
boolean b = false;
if ((this.neighboors[side%6] == null || this.neighboors[side%6].isFakeTile())) {
if (this.isStart() && t.isStart()) {
b = true;
this.neighboors[side%6] = t;
t.setNeighboorBy... |
fa4c1d04-fb7b-4b15-a518-816b391b67a8 | 7 | public RegisteredEventMonitor(Method monitorMethod, Listener listener){
//Attempt to get the EventMonitor annotation on this method
EventMonitor monitorAnnotation = monitorMethod.getAnnotation(EventMonitor.class);
if(monitorAnnotation == null){
throw new IllegalArgumentException("Monitor method does not have a... |
4f6ceb06-4992-4040-a65a-103a7f0a3419 | 6 | private void filter(String input, String filterElement){
projects = new ArrayList<Project>(backupProjects);
if(filterElement.toLowerCase().equals("status")){
for(int i = 0; i < projects.size(); i++){
if(!projects.get(i).getStatus().toLowerCase().equals(input)){
projects.remove(i);
}
}
}
if... |
600ec96a-b878-46b7-b990-cb6419b2c41f | 8 | public boolean similar(Object other) {
if (!(other instanceof JSONArray)) {
return false;
}
int len = this.length();
if (len != ((JSONArray)other).length()) {
return false;
}
for (int i = 0; i < len; i += 1) {
Object valueThis = this.ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.