method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
547be3b5-f6c9-4ac1-84ca-3cea4edea438 | 0 | public void setStrategy(Strategy strategy)
{
this.strategy = strategy;
} |
885dd896-53ee-4fc2-8dfb-83303b3591a8 | 8 | protected void printParameter(String parentParameterFile,
String childParameterFile, ArrayList<_Doc> docList) {
System.out.println("printing parameter");
try {
System.out.println(parentParameterFile);
System.out.println(childParameterFile);
PrintWriter parentParaOut = new PrintWriter(new File(
par... |
5ee8bd14-51d9-47d1-9961-bb74db906e4f | 6 | public static void main(String[] args) {
final List ab= new ArrayList();
for(int i=0;i<100;i++){
ab.add(i);
}
ExecutorService ex = Executors.newCachedThreadPool();
for (int i = 0; i < 4; i++) {
final int a = i;
//每一次execute方法,都是向池中放入一个对象
ex.execute(new Runnable() {... |
2144460c-ce64-4804-a2da-ea469657ec8d | 9 | public TradeProposalPopUp(ArrayList<String[]> tradesProposed, Player proposer) {
final ArrayList<String[]> trades = tradesProposed;
final Player proposingPlayer = proposer;
int cash0 = Integer.parseInt(trades.get(0)[0]);
String[] properties0 = trades.get(1);
int cash1 = Integer.parseInt(trades.get(2)[0]);
... |
4c647ef3-a3a2-4e74-a3d6-714e703fa666 | 2 | public boolean isTypedReady(int e){
if(keys[e] && typed[e]){
typed[e]=false;
return true;
}
return false;
} |
e0cdef6a-ca5c-4ea2-a4af-7987ac8583a3 | 2 | public void die(){
if (sound.Manager.enabled) {
sound.Event effect = new sound.Event(getPosition(), getVelocity(),sound.Library.findByName(DEATH_EFFECT));
effect.gain = EFFECT_VOLUME;
sound.Manager.addEvent(effect);
}
velocity.timesEquals(0);
if(Parti... |
27cf109a-f237-4631-af9e-f50c368fdc26 | 9 | public static byte[] decode(String encoded, int length) {
Preconditions.checkArgument(length > 0);
ByteArrayOutputStream os = new ByteArrayOutputStream(length);
int offset = 0, encodedLength = encoded.length(), decodedLength = 0;
while (offset < encodedLength - 1 && decodedLength < length) {
byte first = d... |
df6b946c-2d11-426e-a2db-46fe29857aef | 4 | private boolean filterFile(File file) {
boolean rtnBoolean = false;
if(this.config.getExtensions() != null){
// 파일이 있다면 파일 이름 출력
Set<String> exts = new HashSet<String>();
//해당 확장자만 가져오도록한다.
for(String ext : this.config.getExtensions()){
exts.add("."+ext.toLowerCase().trim());
}
Iterator<St... |
59da36e5-d676-49da-91b5-203faee3ba02 | 5 | private static Collection<String> moeglicheBefehlsnamen(
List<String> geparsteZeile)
{
ArrayList<String> befehlsnamen = new ArrayList<String>();
if(geparsteZeile.size() == 0)
return befehlsnamen;
for(int i = 0; i < geparsteZeile.size(); i++)
befehlsnamen.add("");
for(int i = 0; i < geparsteZeile.si... |
097b9aca-f7a9-445d-81c8-7f21983db36b | 9 | public Player() {
_current = Status.STOP;
_player = null;
_index = -1;
new JFXPanel();
setBackground(Color.WHITE);
SpringLayout layout = new SpringLayout();
setLayout(layout);
//Setting up the list.
_myList = new JList<Song>(new DefaultListMode... |
24289456-f3fe-456a-a2f8-fb67cd3059dd | 7 | public static ArrayList<Entry<Integer, String>> getColInfo(String datapath)
throws IOException {
BufferedReader br = new BufferedReader(new FileReader(datapath));
HashMap<Integer,String> ctgs = new HashMap<Integer,String>();//每列的类型
String line = br.readLine();
int arrcount = line.split(",").length -1;
... |
f3af4e74-4fe3-4a2f-8a39-3d0e429c30e9 | 2 | public static HashMap<Integer, String> ReadName(String filename){
HashMap<Integer, String> udict = new HashMap<Integer, String>();
//Read the input file stream
try{
FileInputStream fstream = new FileInputStream(filename);
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
for(... |
a3275038-4b55-4935-a952-b7a5c6938dbd | 5 | public static void main(String[] args) {
SudokuApp sudokuApp = new SudokuApp(0, "800006304000000000040090001309060000000700006021800050002470000400008700000001040");
// SudokuApp sudokuApp = new SudokuApp(0, "002519436596342871314867290"
// + "001738649937654128648921750"
// + "0004839678732965104691... |
c90c8ad7-0f2c-4794-91cd-b4f8cbf884e8 | 0 | public int getAge() {
return age;
} |
fd1e67a6-b85d-4c8a-acb9-510308a1639a | 7 | public boolean containsMethodAliasDirectly(String methodName,
String paramType, IdentifierMatcher matcher) {
for (Iterator i = methodIdents.iterator(); i.hasNext();) {
Identifier ident = (Identifier) i.next();
if (((Main.stripping & Main.STRIP_UNREACH) == 0 || ident
.isReachable())
&& ident.wasAlia... |
0dcccbcc-3753-4cb9-a406-83b52fe233ef | 7 | public int maxProfit(int[] prices) {
int len = prices.length;
if (len ==0){
return 0;
}
int[] mProL = new int [len];
int[] mProR = new int [len];
for (int i = 0;i<len;i++) {
mProL[i] = mProR[i] = 0;
}
int minL = prices[0],maxR = pri... |
2e605849-e4a1-4e56-925a-d873291c38fa | 7 | public EigenvalueDecomposition (Matrix Arg) {
double[][] A = Arg.getArray();
n = Arg.getColumnDimension();
V = new double[n][n];
d = new double[n];
e = new double[n];
issymmetric = true;
for (int j = 0; (j < n) & issymmetric; j++) {
for (int i = 0; (i < n) & issymmetr... |
d98d62b6-de9d-4bcd-abbe-f312b6c27541 | 5 | public String toUnicode(char ch){
// check bfChar
if (bfChars != null) {
char[] tmp = bfChars.get((int) ch);
if (tmp != null) {
return String.valueOf(tmp);
}
}
// check bfRange for matches, there may be many ranges to check
if (... |
65fcdadd-85ef-46f7-a8b7-a9746d60cadf | 9 | private void postExpansionExecute(final ClientServices client, final EventManager em) throws CommandException,
AuthenticationException {
// processExistingModules(client.getLocalPath());
super.execute(client, em);
//
// moved modules code to the end of the other arg... |
9055824b-daad-4a4d-91a7-73a407831425 | 9 | public ListNode merge2Lists(ListNode list1, ListNode list2) {
if (list1 == null && list2 == null)
return null;
if (list1 == null)
return list2;
if (list2 == null)
return list1;
ListNode head1 = null;
ListNode head2 = null;
if (list1.val <= list2.val) {
head1 = list1;
head2 = list2;
} else {... |
4ed2bd08-aa6e-4b23-89aa-027aa1c02cb2 | 2 | public static void main(String[] args)
{
Algoritmo programa = new Algoritmo();
if (programa.leerFichero(RUTA)){
System.out.println("Se ha cargado correctamente el fichero: "+RUTA);
String solucion = programa.executeDijkstra(origen);
... |
7a1581b4-f97e-4d2d-a658-9f2ee27b9f6f | 1 | public void start() {
Thread thread = new Thread(this);
try {
thread.start();
System.out.println("Thread Start...");
} catch (Exception error) {
}
} |
655bc493-7012-42f9-bfc6-ba7c03982cad | 6 | public boolean hasItemAny(int id, int amount) {
for(int i = 0; i < playerItems.length; i++) {
if(playerItems[i] == id+1 && playerItemsN[i] >= amount)
return true;
}
for(int i2 = 0; i2 < playerBankSize; i2++) {
if(bankItems[i2] == id+1 && bankItemsN[i2] >= amount)
return true;
}
return fals... |
31772e03-be3e-4336-8980-529fa71762fd | 0 | public int getScrollableUnitIncrement(Rectangle visibleRect,
int orientation, int direction) {
return 5;
} |
ff77d5f9-31d8-4a93-b86f-d5e0a02289b4 | 7 | public static String readSqlCmdTemplateVariable(String template, int start, int end, Object [] MV_returnarray) {
{ int cursor = start;
boolean escapedP = false;
if ((cursor >= end) ||
(!(template.charAt(cursor) == '{'))) {
}
else {
loop000 : while (cursor < end) {
... |
3c0291d7-acbe-44db-9f9e-7451410f0315 | 3 | private int putTextBlock (Graphics2D g2d, String t, int x, int startY) {
int y = startY;
if ((t == null) || (t.equals(""))) {
return y;
}
TextLayout tl = new TextLayout(t,
MainWindow.setupData.getPrintElementSetupList().getPrintElementSetup (PrintElementSetupList.FONT_SUMMARY_SHEET).getPrin... |
d1d8d723-f0b3-47b9-abdd-428782e7d0f8 | 6 | private synchronized boolean hasReceivedPacketWithSequenceNumber(int sequenceNumber) {
//if the sequence number isn't specified then we can't tell whether we've received it before--assume we haven't
if(sequenceNumber == Packet.SEQUENCE_NUMBER_NOT_APPLICABLE)
return false;
//if we've NEVER received a packet ev... |
ce970572-3c57-41c3-97df-bc5960255960 | 3 | private String findLine(String containing, boolean throwException) throws IOException {
String line = reader.readLine();
while (line != null) {
if (line.contains(containing)) {
return line;
}
line = reader.readLine();
}
// We've reache... |
4aa06128-c729-49bc-8625-2ffe4a25813c | 3 | public double winPossibility(ActionList history, GameInfo gameInfo, int playerHandStrength) {
// find number of raise actions in history
int numRaises = history.opponentActions(gameInfo).numberOfRaises();
// find histogram and adjusted hand strength
int[] histogram = historyToHandStrength.get(numRaises);
... |
cb3adb7a-cc98-4332-8ea5-753024e1fba2 | 0 | public String getHelpMessage() { return this.helpMessage; } |
3ea778e2-b7c1-4757-9d8b-879ceed477c7 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DefaultPeptideIon that = (DefaultPeptideIon) o;
if (charge != that.charge) return false;
if (Double.compare(that.mass, mass) != 0) return false... |
a4107a01-156b-4ee1-ac5f-43363950ecf7 | 9 | public static void tfmsymtri2(double a[][], int n, double d[], double b[], double bb[], double em[]) {
int i, j, r, r1;
double w, x, a1, b0, bb0, machtol, norm;
norm = 0.0;
for (j = 1; j <= n; j++) {
w = 0.0;
for (i = 1; i <= j; i++)
w += Math.abs(a[i][j]);
for (i = j + 1; i <= n; i++)
w += M... |
ff31fb1a-7284-46eb-8bd9-fa6e98c073b5 | 6 | public ArrayList<BodyPart> getBodypartsByType(UpgradeType type){
ArrayList<BodyPart> bodyparts = new ArrayList<BodyPart>();
switch (type) {
case Head:
for(BodyPart u : allHeads){
bodyparts.add(u);
}
return bodyparts;
case Body:
for(BodyPart u : allBodys){
bodyparts.add(u);
}
return bod... |
4d3fc6dd-fbb5-4889-9b95-5fd613ea54ff | 2 | public void play() {
if (!isLoaded()) {
return;
}
clip.setFramePosition(0);
if (looping) {
clip.loop(Clip.LOOP_CONTINUOUSLY);
} else {
clip.loop(repeat);
}
} |
4ad62012-abd5-4c7f-8eab-20274c8504d5 | 1 | private void initRandomLL(int randomNum) {
for (int i = 0; i < randomNum; i++) {
ll.add(ran.nextInt(20));
}
} |
bb4154ce-eb94-4938-9b8c-2fc74c94493b | 9 | public void removeValue(Comparable rowKey, Comparable columnKey) {
setValue(null, rowKey, columnKey);
// 1. check whether the row is now empty.
boolean allNull = true;
int rowIndex = getRowIndex(rowKey);
DefaultKeyedValues row = this.rows.get(rowIndex);
for (int item = ... |
98e8338f-3646-4bb4-9d96-582f07ef1630 | 5 | private void setModel(String modelName) {
if (modelName.isEmpty())
modelName = this.getClass().getSimpleName().replace("Controller", "");
modelName += modelName.equals("App")? "Model" : "";
try {
model = (Model) Class.forName("app.models." + modelName).newInstance();
model.setController(this);
}
... |
2e2b89da-1b0b-4854-a0a8-60c5ed90907f | 4 | public static void main(String[] args) {
try {
MoodleCallRestWebService.init("http://localhost:7070/moodle/webservice/rest/server.php", "d65f7f717b69f706873dcae6eef08ac7");
MoodleCourse[] allCourses = MoodleRestCourse.getAllCourses();
for (int i=0; i<allCourses.length; i++, Syst... |
39f1b848-d13f-42c7-a3e7-5f20d847764f | 3 | public void removeExtras(){
List<Tile> removeList = new ArrayList<Tile>();
for(Tile tile : tileList ) {
if (tile.getStyle() == 0){
removeList.add(tile);
}
}
for(Tile rTile : removeList){
tileList.remove(rTile);
}
} |
3afdc4f2-d555-4226-bda8-f514935a9279 | 1 | @Override
public void testStarted(Description description) {
resetCurrentFailure();
final String id = getId(description);
logger.info("START Testcase '{}' '{}'.", id, description.getDisplayName());
if (!uri.equals(NULL_URI)) {
logger.info("START Testcase '{}' '{}'.", id,
... |
b9b3c989-3d37-469c-bff7-ce306905903d | 8 | public Dimension getMinimumSize()
{
Dimension localDimension = super.getSize();
int j;
if (this.HeightPacked)
{
j = (this.HardHeight > -1) && (this.HardHeight < this.ActualHeight) ? this.HardHeight : this.ActualHeight;
} else if (this.HardHeight > -1)
j = this.HardHeight;
else
... |
6f94f1c9-f379-4058-85ac-26d336e4b5dd | 2 | public void imprimirTable() {
for (int i = 0; i < this.table_trans.getRowCount(); i++) {
for (int j = 1; j < this.table_trans.getColumnCount(); j++) {
System.out.print(this.table_trans.getValueAt(i, j) + " ");
}
System.out.println("");
}
} |
75df18ef-2f68-49bb-8b5c-0e669d5aeec1 | 1 | private void writeImport() {
ImportGenerator imports = new ImportGenerator( filePath );
if ( date )
imports.addImport( IMPORT_DATE );
sb.append( imports.toString() );
} |
1b103732-bc34-4806-aa5a-3f4239e6c7d0 | 4 | public int[] computePrefix(String pattern) {
int patternLength = pattern.length(); int longestPrefix = 0;
int[] prefixFunction = new int[patternLength];
prefixFunction[0] = 0;
for(int patternIndex = 1; patternIndex < patternLength; patternIndex++) {
while(longestPrefix > 0 && !this.compareTwoChars(pattern.ch... |
243a3288-09d2-4a29-ae5c-f208c58d157a | 4 | protected boolean canItselfContain(ContainableSimWo conSimWo)
{
boolean canContain =
conSimWo != this && // a container cannot contain itself
// only a pot can contain a plant. must be in parentheses
(!(conSimWo instanceof Plant) || (this instanceof Pot)) &&
ma... |
defc045a-9921-47da-9edd-f5e8f76b8630 | 9 | @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 TypeWork)) {
return false;
}
TypeWork other = (TypeWork) object;
if ((this.idTypeWork == null && other.idTypeWo... |
056cd5bd-32e9-45df-8617-4708aea34aa4 | 4 | public String getRandomGeslacht() {
Random rn = new Random();
switch (rn.nextInt(4)) {
case 0:
return "man";
case 1:
return "vrouw";
case 2:
return "onbepaald";
case 3:
return "onbekend";
default:
return "onbekend";
}
} |
354e3aa6-40f5-48f5-88cf-7ad1dc0e59a1 | 2 | public static void deleteUtilisateur(Utilisateur utilisateur) {
Statement stat;
try {
stat = ConnexionDB.getConnection().createStatement();
stat.executeUpdate("delete from utilisateur where id_utilisateur="+ utilisateur.getId_utilisateur());
} catch (SQLException e) {
... |
f9716bb3-e70c-4fad-9bef-db25b30f21fd | 5 | private static void resetOutOfRoi (ImageProcessor ip, int extraX, int extraY) {
int width = ip.getWidth();
int height = ip.getHeight();
Rectangle roiRect = ip.getRoi();
Rectangle temp = (Rectangle)roiRect.clone();
temp.grow(extraX, extraY);
Rectangle outer = temp.intersec... |
3e10ba62-eb7c-4329-a55e-6754096d3be8 | 4 | public void inicializarHuertos(int[][] iniciales) throws TamanosInvalidosInicializacionException
{
Huerto hAsignar=null;
Nodo enCreacion=null;
if(iniciales[0].length==CROP_NUMBER*Huerto.NODOS_POR_HUERTO
&& iniciales[1].length==CROP_NUMBER*Huerto.NODOS_POR_HUERTO )
{
for(int i =0; i<CROP_NUMBER*Huerto.N... |
20435856-471f-4517-8283-54f8aa1806b8 | 4 | public static String removeAllStylenames(String style)
{
StringBuffer buffer = new StringBuffer();
if (style != null)
{
String[] tokens = style.split(";");
for (int i = 0; i < tokens.length; i++)
{
if (tokens[i].indexOf('=') >= 0)
{
buffer.append(tokens[i] + ";");
}
}
}
return... |
66984ac2-3caa-4811-b9e8-0193b589d845 | 7 | public int getTotalFilhos(ArrayList<Byte> contexto, int nivel){
if(nivel > -1){
if(this.isEsc() || (this.getValor() != contexto.get(nivel))) return -1;
}
if(nivel == contexto.size() - 1) {
if(this.isEsc()) return -1;
return filhos.size();
}
for(Contexto c : filhos){
int res = c.g... |
6cc75f62-4728-4749-b09a-e42579652070 | 5 | public PlaceHoldRequestDialog(BorrowerSearchPanel parent, final int BID, Controller session) {
setResizable(false);
setTitle("Return Book");
this.parent = parent;
this.mySession = session;
this.BID = BID;
ImageIcon img = new ImageIcon("res/library-icon.png");
this.setIconImage(img.getImage());
setBound... |
9b9c611b-7b6b-40a7-803d-1f64eaff7ff8 | 6 | Base(String path) {
url = asUrl(path);
StackTraceElement[] elements = Thread.currentThread().getStackTrace();
StackTraceElement callee = elements[4];
String className = callee.getClassName();
String methodName = callee.getMethodName();
try {
@SuppressWarnings("unchecked")
Class<? extends API>... |
60f04854-fdc9-4cd6-b9f8-9a3557807e95 | 4 | protected JComponent initButtons()
{
JPanel q = new JPanel();
q.setLayout(new BoxLayout(q, BoxLayout.Y_AXIS));
myMessage = new JTextArea();
myMessage.setEditable(false);
q.add(myMessage);
JPanel topRow = new JPanel();
JPanel bottomRow = new J... |
cfdec870-8014-4167-869c-4ea873f10072 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
8e83cfe7-28b6-42ac-887d-8b0c61dcb055 | 4 | public StringBuffer format(final CommandSender target) {
// format all dates with time zone for target
TimeZone timeZone = null;
final Format[] formats = this.getFormatsByArgumentIndex();
for(int i = 0; i < formats.length; i++) {
if (!(formats[i] instanceof DateFormat)) conti... |
0d62ddee-d1cb-44a8-8802-479ac64dfbbc | 3 | public void run() {
while (true) {
if (year!=w.year) {
year=w.year;
this.repaint();
}
try {
Thread.sleep(250);
} catch (InterruptedException e) {
}
}
} |
5c70b839-dab3-4dfc-800e-50fd682c8845 | 8 | public void keyPressed(KeyEvent e) {
char keychar = e.getKeyChar();
int keycode = e.getKeyCode();
if (keycode>=0 && keycode < 256) {
keymap[keycode]=true;
lastkey=keycode;
lastkeychar=keychar;
if (wakeup_key==-1 || wakeup_key==keycode) {
if (!eng.isRunning()) {
eng.start();
// key is cle... |
9d1b6fc5-13d9-4f22-99c9-38a6ac19cdc6 | 9 | public int lengthOfLinkedListWithCycle(ListNode head){
if (head == null)
return 0;
ListNode fast = head, slow = head;
int length = 1;
while(true){
if (fast == null || fast.next == null)
break;
slow = slow.next;
head = head.next.next;
if (slow == fast)
... |
e7b21f74-bfba-46f8-84fd-587b26f085e1 | 1 | public static void writeFile(ClassFile cf, String directoryName)
throws CannotCompileException {
try {
writeFile0(cf, directoryName);
}
catch (IOException e) {
throw new CannotCompileException(e);
}
} |
35026bfc-bc06-4a4d-807e-e7be1b168a72 | 1 | private void setFrameLocal(final int local, final Object type) {
int l = newLocals.length;
if (local >= l) {
Object[] a = new Object[Math.max(2 * l, local + 1)];
System.arraycopy(newLocals, 0, a, 0, l);
newLocals = a;
}
newLocals[local] = type;
} |
b9861502-2a40-4a96-a591-d71c40b38c37 | 8 | public void doGet(HttpServletRequest request,
HttpServletResponse res)
throws ServletException, IOException {
// send out the HTML file
res.setContentType("text/html");
PrintWriter out = res.getWriter ();
out.println("<html>");
out.println("<head>");
out.println("<title> Photo List </title>");... |
e0838c60-c3ff-42c8-8b9d-140ea18bcf1b | 1 | private void logRequest(String uri, String res) {
try {
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("log.txt", true)));
out.println(uri);
out.println(res);
out.close();
} catch (IOException e) {
e.printStackTrace();
}
} |
02589982-65f3-4452-aa8f-262e39fa5dc9 | 0 | @Test
public void determineHighestFlush_ifSevenOfSameSuit_returnsSetOfSevenCards() {
assertFlushOfSize(getAllFlushCards(sevenFlush()), 7);
} |
97a4bdeb-5039-4741-9c16-0be1ec3ad7c6 | 0 | public SplitYamlDataHolder(File f) {
folder = f;
userFile = new File(folder, "users.yml");
groupFile = new File(folder, "groups.yml");
worldFile = new File(folder, "worlds.yml");
entityFile = new File(folder, "entities.yml");
specialFile = new File(folder, "specials.yml")... |
847f3a32-5f9c-4bc3-a4bb-23f138b6f646 | 3 | private void login() {
panel = new LoginPanel(this);
centerWindow();
this.add(panel);
panel.updateUI();
((LoginPanel) panel).getSignInBtn().addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
String user = ((JTextField)panel.getComponent(1)).getText();
... |
e751f221-21c1-4ffa-99dd-389b783b74ca | 2 | public Long getAverageStatistical(List<Long> list) {
// parameters check
if (list == null) {
return null;
}
int iterations = list.size();
Long sum = (long) 0;
for (Long result : list) {
sum += result;
}
return sum / iterations;
... |
deaa1db7-4f04-4118-a963-f8555cfcf895 | 8 | private void viewSelectedComment() {
if (table == null)
return;
final int row = table.getSelectedRow();
if (row < 0)
return;
final int id = ((Integer) table.getValueAt(row, 0)).intValue();
URL u = null;
try {
u = new URL(Modeler.getContextRoot() + "comment?client=mw&action=view&primarykey=" + id);
... |
144629fe-c7fd-43f2-a54e-9c10d9a73ec9 | 0 | private void abrirLog() {
routeTable.setModel(new MyTableModel());
initColumnSizes(routeTable);
actionStartRouter.setEnabled(true);
actionStartForwarder.setEnabled(true);
actionSendMessage.setEnabled(true);
} |
2c0a6ef9-e28a-4111-a821-954ba84c2786 | 3 | public void use(BattleFunction iface, PokeInstance user, PokeInstance target, Move move) {
PokeInstance p;
if (this.target == Target.target) {
p = target;
} else {
p = user;
}
p.battleStatus.flags[flag] = true;
if (text != null) {
text = text.replace("$target", p.getName());
if (p.battleStatu... |
f95aafd7-ea30-4803-b2e9-e4fb3aee7358 | 3 | void parseXMPDecl(boolean ignoreEncoding) throws java.lang.Exception
{
String version;
String encodingName = null;
String standalone = null;
// Read the version.
require("version");
parseEq();
version = readLiteral(0);
if (!version.equals("1.0")) {
... |
668a125c-6969-4d11-8bef-d5b3c7f13281 | 9 | public static GoalActionSequence findGoalRoute(Level l, Agent agent,
Box box, Field agentFromField, Field agentToField,
Field boxFromField, Field boxToField,
Collection<Field> blockedFields) {
dir boxDir = null;
GoalSequenceNode root = new GoalSequenceNode(boxFromField,
agentFromField, null);
Linke... |
f090e2d1-23e5-4fb7-b217-e052bfefdc40 | 4 | static void initFeature() {
Random rand = new Random();
for(int i = 0; i < DataInfo.userNumber; i++)
for(int j = 0; j < DataInfo.featureNumber; j++)
DataInfo.userFeature[i][j] = 0.01 * rand.nextDouble();
for(int i = 0; i < DataInfo.itemNumber; i++)
for(int j = 0; j < DataInfo.featureNumber; j++... |
c4266252-ee54-4e94-9c8e-98228ccca20e | 3 | private void paintTextBounds(Graphics g) {
Page currentPage = pageViewComponent.getPageLock(this);
// get page transformation
AffineTransform pageTransform = currentPage.getPageTransform(
documentViewModel.getPageBoundary(),
documentViewModel.getViewRotation(),
... |
f4c47eaa-bc55-475a-87ce-8b93b548eb4c | 5 | private void updateParam(List<Instance> instances) {
Map<Integer, Double> update = new HashMap<Integer, Double>();
for (Instance instance : instances) {
double y = Double.parseDouble(instance.getLabel().toString()) ; //yi
double wx = this.innerProduct(instance);
for (Map.Entry<Integer, Double> entry : inst... |
ae519588-13a1-4c1e-a691-50f56bc57342 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... |
af709fb9-105a-402f-b395-8280acb37401 | 0 | public int getM()
{
return m;
} |
1745d1a7-2835-4168-886d-0386131749d5 | 8 | private void nextMove(int type) {
if (type == 0) {
holdable = true;
generateNextTokens();
} else {
currentType = type;
}
//set currentTokens
switch (currentType) {
case 1:// the I token
setPositionForCase1(currentTok... |
05c542e5-881e-45fb-892f-cb705bc2e54c | 6 | @Override
public void valueChanged(LabelledSpinner source, int value) {
if (source == hpNumerator) {
eventBus.post(new HPNumeratorChanged(value));
} else if (source == hpDenominator) {
eventBus.post(new HPDenominatorChanged(value));
} else if (source == defNumerator) {
eventBus.post(new DefNumeratorChan... |
89187267-8c54-4fc8-af34-563263c05ddd | 7 | @Override
/**
* Encodes a message.
* @param session
* @param message
* @param out
*/
public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception {
try {
Packet p = (Packet) message;
byte[] data = p.getData();
int dataLength = p.getLength();
ByteBuffer buff... |
586035ca-8b9a-4a0b-90e0-4f0910865cc7 | 8 | public static void main(String[] args) throws IOException {
// BufferedReader in = new BufferedReader(new
// InputStreamReader(System.in));
Scanner scan = new Scanner(System.in);
String line[];
int times = 1;
while (scan.hasNext()) {
int n = scan.nextInt();// Integer.parseInt(line[0]);
if(n==0)
... |
d5331485-7a60-4239-b526-be915ed1ca52 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (itItemHasEmpleadoPK != null ? itItemHasEmpleadoPK.hashCode() : 0);
return hash;
} |
fdc10e1e-4a6a-42a3-bc92-5f995ce74144 | 4 | public void openFile() throws Exception {
if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
DrawInternalFrame internalFrame = new DrawInternalFrame(this);
File file = fileChooser.getSelectedFile();
if (file.getName().endsWith(".png")
|| file.getName().endsWith(".PNG")) {
Buffere... |
af5864a7-12a5-49a3-bdf5-bc4683b79135 | 3 | private boolean isSlavoGermanic(String value) {
return value.indexOf('W') > -1 || value.indexOf('K') > -1 ||
value.indexOf("CZ") > -1 || value.indexOf("WITZ") > -1;
} |
e076aba7-9ee7-4f2d-a910-faceeb7b536a | 2 | private boolean isValid() {
if (email.length() > 50 || address.length() > 75)
{
System.err.println("Invalid argument(s) when inserting an availability!");
return false;
}
return true;
} |
e1e95c15-2801-48de-98fe-e9bdb0827711 | 0 | public static void main(String[] args) {
Claire clairette = new Claire();
clairette.play();
} |
90ddaece-63cb-4005-bfb1-64e1b424564d | 1 | private synchronized ExecutorService getExecutor() {
if (service == null) {
service = Executors.newFixedThreadPool(MAX_NUMBER_OF_ENFORCERS);
}
return service;
} |
c5995a31-6efa-44ef-b73a-5bb8f20328a8 | 7 | public static void main(String[] args) throws Exception
{
for( int x=1; x < NewRDPParserFileLine.TAXA_ARRAY.length; x++)
{
System.out.println(NewRDPParserFileLine.TAXA_ARRAY[x]);
File inFile = new File(ConfigReader.getAdenomasReleaseDir() + File.separator +
"spreadsheets" + File.separator + "pivote... |
8a2fc29e-3357-4b34-a5e2-3673e20ed710 | 5 | public void deleteElement(String value) {
ListElement index = head;
if (index.value.equals(value)) {
deleteFromBegin();
} else {
while (index.next != null) {
if (index.next.value.equals(value)) {
index.next = index.next.next;
... |
31d02ed1-89a6-4579-bf6f-914c64376bab | 3 | public int CantPar(int opcion2) {
if (opcion2 == 5 || opcion2 == 8) {
cp++;
}
//if para reiniciar las partidas jugadas en caso de reiniciar el juego
if (opcion2 == 7) {
cp = 0;
}
return cp;
} |
41cd5605-f31d-412a-85f9-7b8d9e10132d | 3 | private boolean jj_3_1()
{
if (jj_scan_token(LEFTB)) return true;
if (jj_3R_9()) return true;
if (jj_scan_token(COMMA)) return true;
return false;
} |
38963749-e2a1-412d-aaed-1381e6519e8a | 2 | * @param notes notes to be added about the contact.
* @throws NullPointerException if the name or the notes are null
*/
public void addNewContact(String name, String notes) throws NullPointerException
{
if(name == null)
{
throw new NullPointerException("name should not be null");
}
if(notes == null)
... |
7e616813-dc34-4236-ae9d-225b996928df | 5 | final int[][] method3047(int i, int i_3_) {
if (i_3_ != -1564599039)
return null;
anInt9353++;
int[][] is = ((Class348_Sub40) this).aClass322_7033
.method2557(i_3_ + 1564598957, i);
if (((Class322) ((Class348_Sub40) this).aClass322_7033).aBoolean4035) {
int[][] is_4_ = this.method3039((byte) -60, i, 0... |
18f8894a-6bff-4a7d-982c-47b5f3679e9f | 3 | @Test
public void test_solvable_matrix_size_2_solve2() throws
ImpossibleSolutionException,UnsquaredMatrixException,
ElementOutOfRangeException{
int height=2;
int width=2;
float[] result;
try{
test_matrix = new Determinant(height,... |
1a9b2f2c-1250-4be2-8df5-c3ade030d8e0 | 4 | public static int atoi2(String str) {
// Note: The Solution object is instantiated only once and is reused by each test case.
int result=0;
for(int i=str.length()-1, w=0;i>=0;--i) {
if(str.charAt(i)=='-') return -result;
if(str.charAt(i)=='+') return result;
if(str.charAt(i)!=' ') {
result += ((int)(... |
d517f229-0025-4ee6-b4e8-4c0e1d1915e5 | 7 | @Override
public boolean equals(Object o )
{
if(o == null)
return false;
if(o == this)
return true;
if(!(o instanceof FertigungsplanDTO))
return false;
FertigungsplanDTO f = (FertigungsplanDTO)o;
if(f.nr != nr || f.id != id || f.auftra... |
d994ec8f-a220-4191-ba52-783d6a99a395 | 7 | public static void main(String[] args) throws Exception {
if (args.length != 4 && args.length != 5) {
System.err.println(USAGE);
System.exit(1);
}
File metadataFile = new File(args[0]);
File outputFile = new File(args[1]);
File pkcs12File = new File(args... |
916d9c72-9ffc-47f9-ba85-073af58ad198 | 5 | private void turnAngle(int index, double change){
switch(index){
case 0:
this.angle[0]+=change;
break;
case 1:
this.angle[1]+=change;
break;
case 2:
this.angle[2]+=change;
}
... |
45511c3a-e65d-4e3f-ad21-293a9f220815 | 2 | public SyncCheckView(final JPanel panel) {
// Top will be button
final JPanel top = new JPanel();
top.setBorder(BorderFactory.createEtchedBorder());
top.setLayout(new BorderLayout());
// Bottom will be text area
final JPanel bottom = new JPanel();
bottom.setBorder(BorderFactory.createEtchedBorder());
b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.