method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7fed7e31-3425-4a0b-98b7-003555d51240 | 4 | @Override
public void run() {
boolean forward = false;
Object message;
Subscription subscription = null;
try {
message = this.ois.readObject();
if (message instanceof Message) {
Message msg = (Message) message;
matchSubscription... |
0b1679f9-a87a-4b27-b1d6-ea7b58a7deef | 4 | private TorrentMapping (List<TorrentFileInfo> files, long pieceSize) {
List<Entry> allMappings = new ArrayList<Entry>(files.size());
List<Path> allFiles = new ArrayList<Path>(files.size());
final List<List<Entry>> pToF = new ArrayList<List<Entry>>();
final Map<Path,List<Entry>> fToP = ne... |
8a6f3fa5-070c-45bd-9b18-c176bbcc0bc5 | 8 | private void fillGraph(double[][] graph, BisectionModel model,
BisectionInput input, BisectionOutput correct, double lossWeight) {
int size = input.size();
for (int paper1 = 0; paper1 < size; ++paper1) {
for (int paper2 = 0; paper2 < size; ++paper2) {
// Compute edge weight.
double w = getEdgeWeight(m... |
ffc2f06c-f7e7-4071-ace9-bc7f7994499f | 0 | public Integer getKind() {
return this.kind;
} |
d4062d78-8a40-44a0-a81f-0454aac23696 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Point other = (Point) obj;
if (x != other.x)
return false;
if (y != other.y)
return false;
if (z != other.z)
return false;
return ... |
636dd951-0099-474b-933f-a45a93e91d52 | 9 | private static <T, P extends Trespasser<T>> ProxyWrapper<T,P> validateProxyInterface(
final Class<P> proxy, final ClassLoader loader)
throws NoSuchMethodException, NoSuchFieldException, InvalidSignatureException,
ClassNotFoundException, MissingAnnotationException
{
@SuppressWarnings("u... |
6753394b-bead-4619-8d5b-eb7fca8c8aae | 5 | public boolean validateTimes()
{
errorMessage = "";
if (classicTime)
{
if (!validateClassicTime(textStart.getText()))
{
errorMessage = String.format(
"Start time: %s is in wrong format. Insert value between: 00:00:00:000 - %s:59:59:... |
351fadaa-73d8-4a86-8394-6bcc061bd9cb | 3 | private void randomizeButtonActionPerformed(java.awt.event.ActionEvent evt) {
for(int i = 0;i<myNetwork.getAddedNeurons(); i++){
for(int j = i+1;j<myNetwork.getAddedNeurons();j++){
//only generate edges from one layer to the following
if (myNetwork.calcRel... |
53d0e046-3f27-4293-9659-3f9c9b8d8c6e | 3 | public static boolean isBranch(OpCode code) {
return code == BE || code == BG || code == BL || code == BU;
} |
2d9af102-3001-4e76-bb3e-cd39adb1b08f | 1 | private void hideExitIn(int x, int y, ImageIcon icon) {
if (!isExitSet) {
isExitSet = true;
this.mapGrid[x][y] = new Entity(Entity.EXIT, icon); //create and exit entity
// hide the entity by displaying the path icon
setValueAt(exitIcon, y, x);
doorX = ... |
78d58d9c-9fef-47ad-99d1-5880feb233bd | 3 | public static void loadPlayer( ProxiedPlayer player ) throws SQLException {
String nickname = null;
String channel = null;
boolean muted = false;
boolean chatspying = false;
boolean dnd = false;
boolean tps = true;
if ( playerExists( player.getName() ) ) {
... |
ea65932f-c02b-4609-8774-3c84924bf1cd | 1 | public Task getTaskOrWait() throws InterruptedException {
// Wait while next task appears in queue
Task task = queue.take();
if (isBecomeReady()) {
EventBusFactory.getDefault().fire(new QueueReadyEvent());
}
return task;
} |
ec258eae-7b0a-450c-8237-29565b3b263e | 3 | @Override
public boolean equals(Object arg0) {
if (arg0 != null && arg0 instanceof Vector) {
Vector other = (Vector)arg0;
return (this.x == other.x
&& this.y == other.y);
}
return false;
} |
46300176-f39b-4650-a1a4-cab68c37c3cf | 2 | private static void deletefile(String file) {
try {
File f1 = new File(file);
boolean success = f1.delete();
if (success) {
EIError.debugMsg("File deleted " + file, EIError.ErrorLevel.Notice);
} else {
EIError.debugMsg("Couldn't del... |
4d0aad62-1953-4db7-a4a4-d19ce7293d8c | 2 | public List<Disciplina> getDisciplinasAlocado() {
List<Disciplina> disciplinasAlocadas = new ArrayList<Disciplina>();
for (Turma t : this.turmasAlocado) {
if (!disciplinasAlocadas.contains(t.getDisciplina())) {
disciplinasAlocadas.add(t.getDisciplina());
}
}
return disciplinasAlocadas;
} |
49032570-9977-4d06-9aa4-ae347d8536aa | 0 | public String getFacebookTourDatesUrl() {
return facebookTourDatesUrl;
} |
2c02f70c-c848-4964-866d-2671cade5ac0 | 5 | public void loadLibrary() {
try {
BufferedReader br = new BufferedReader(new FileReader("./ivJava.ini"));
String line = "";
while ((line = br.readLine()) != null) {
if (line.length() > 0) {
int index = line.indexOf("LoadLibrary=");
if (index >= 0) {
String Library = line.substring(index +... |
450df987-f814-48a4-95a5-1384a5081737 | 3 | public static void unregisterWorldAccess(World world) {
try {
Class iWorldAccessClass = Class.forName(ReflectionUtils.getNMSPackageName() + ".IWorldAccess");
Class proxyClass = Proxy.getProxyClass(Bukkit.class.getClassLoader(), new Class[] { iWorldAccessClass });
List accessList = getAccessList(world);
... |
aa34a5b1-fa1b-4b29-8f8a-6d84af189081 | 8 | public static void main(String [] args){
Insertion insert = new Insertion();
Scanner input = new Scanner(System.in);
int numbers;
System.out.print("How many numbers do you want in an array: ");
numbers = input.nextInt();
int[] array = new int[numbers];
int low = 0, high = array.length - 1, mid = ... |
b4d33903-3322-4bcd-9a65-941af356e07a | 6 | public static String findLongestString( HashSet<String> dict ,int len){
System.out.println("FL-len:"+len);
Iterator<String> iterator = dict.iterator();
String longestStr = "";
int i=0;
boolean getOne = false;
while(iterator.hasNext()){
String tmp = (String)iterator.next();
System.out.println("DICT:"+tmp... |
9b68c02d-8687-44c8-9866-e86216585856 | 2 | public void dispose(boolean save) {
if (save) {
save();
}
// Can't really dispose of the global preferences,
// so only do the remaining cleanup for non-global preferences.
if (INSTANCE != this) {
mPrefs = null;
mFile = null;
mNotifier = null;
}
} |
9c17e9bf-1f58-45e6-8527-3f3b4efd9a0d | 2 | public static void main(String[] args){
BigInteger n = new BigInteger("1");
for (int i=0;i<1000;i++){
n = n.multiply(new BigInteger("2"));
}
int sum = 0;
for (char c : n.toString().toCharArray()){
sum+=Integer.parseInt(""+c);
}
System.out.println(sum);
} |
f364e9f6-6c41-4106-b148-e8620d385d4b | 1 | public AnnotationVisitor visitAnnotation(
final String name,
final String desc)
{
checkEnd();
checkName(name);
CheckMethodAdapter.checkDesc(desc, false);
return new CheckAnnotationAdapter(av == null
? null
: av.visitAnnotation(name, des... |
5510cb30-9f01-4fa0-a087-3868599f6b97 | 1 | private void divideTask(Region[][] array, int hij, int loj, int hii, int loi,
int t, boolean irregular) {
if (irregular) {
int midh2 = (loi + hii) >>> 1;
int midh1 = (loi + midh2) >>> 1;
int midh3 = (hii + midh2) >>> 1;
invokeAll(new UpdateTask(array, ... |
85a4f95b-1292-4b83-8716-84db0c2f946c | 8 | private void setCursorToResizeCursor(int aDir)
{
int cursorType = Cursor.DEFAULT_CURSOR;
switch(aDir)
{
case Compass.NORTH:
cursorType = Cursor.N_RESIZE_CURSOR;
break;
case Compass.SOUTH:
cursorType = Cu... |
b010bcf4-f5c8-48b7-9b93-990b8ea04b7f | 1 | public void notifyDel(int a){
reset();
if(a==-1){
hata.setText("Ürün Silinemedi!");
hata.setForeground(Color.RED);
}else{
hata.setText("Ürün Başarıyla Silindi!");
}
} |
90201b16-e2cd-44dd-ba8b-99bf3cd4a69e | 5 | private int checkOnePair(int player) {
int[] hand = new int[players[player].cards.size()];
int i = 0;
for (int card : players[player].cards) {
hand[i++] = card % 13;
}
for (int j = 0; j < hand.length; j++) {
for (int k = 0; k < hand.length; k++) {
if (j != k) {
if (hand[j] == hand[k]) r... |
e982e284-4945-44ac-8777-53ca1220b74c | 6 | private static void Getnextorder() {
// TODO Auto-generated method stub
currentmax = set[set.length-1];
curentmaxindex = set.length-1;
currentminindex = 0;
currentmin = 0;
for (i = 5; i > 0; i--) {
if (set[i] < currentmax) {
currentmin = set[i];
currentminindex = i;
i = -1;
}
}
Syst... |
a2ae937d-1356-46a3-85eb-d234a4b3c967 | 9 | public static void main(String[] args) throws IOException, WavFileException
{
// Debug information
System.out.println("Target number of frames: " + (int)(NUM_BEATS * FRAMES_PER_BEAT));
System.out.println("Ideal number of frames : " + (int)(DURATION * SAMPLE_RATE));
// Open file, determine nu... |
18922683-55f0-4832-bec4-715324b4de27 | 9 | void generate() {
try {
//Randomisation du point de départ
Random randomGenerator = new Random();
int firstRand = randomGenerator.nextInt(4);
if (firstRand == 0) { //Point de départ en haut
this.startY = 0;
this.startX = randomGene... |
52b0178e-0109-44e6-9674-dfa879f0184a | 9 | @Override
public String toString() {
boolean leadingSlash = isAbsolute;
if(isAbsolute && elements.size() > 0 && elements.get(0).matches("[a-zA-Z]\\:")) {
leadingSlash = false;
}
boolean trailingSlash = false;
if(elements.size() == 1 && elements.get(0).matches("[a-zA-Z]... |
d785c61d-ebda-40b3-a2cd-16a42ea4cad8 | 7 | public static Converter getConverter(Class<?> clz) {
for (Class<? extends Object> check = clz; check != null && check != Container.class; check = check.getSuperclass()) {
for (Class<?> key : map.keySet()) {
if (key == check) {
return map.get(key);
}
}
}
return null;
} |
65551a8d-3c4f-42d8-9836-218dbaf6102f | 6 | public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
int var11;
for (boolean var6 = false; ((var11 = par1World.getBlockId(par3, par4, par5)) == 0 || var11 == Block.leaves.blockID) && par4 > 0; --par4)
{
;
}
for (int var7 = ... |
00fe9e1d-185b-49c4-a7f7-4cced9fe8184 | 9 | private void readnotes(Node parent, Automaton root, Document document) {
NodeList allNodes = parent.getChildNodes();
ArrayList noteNodes = new ArrayList();
for (int k = 0; k < allNodes.getLength(); k++) {
if (allNodes.item(k).getNodeName().equals(NOTE_NAME)) {
noteNodes.add(allNodes.item(k));
}
}
f... |
a0f46ee0-e2ba-4f3d-942e-cec3ef6ad77b | 6 | public Point getNeighbor(Point pt, int radius) {
int x = pt.getX();
int y = pt.getY();
boolean found = false;
Iterator<Line> it = lineList.iterator();
Line l = null;
int iptX, iptY, fptX, fptY;
// Iterate hover lines to get the neighbor of point pt
while (it.hasNext() && !found) {
l = it.next();
i... |
4dec6335-f619-4e61-ada8-c9ba8f9fede9 | 5 | private final void writeToDB(final boolean bDisband) {
try {
Connection con = DatabaseConnection.getConnection();
if (!bDisband) {
StringBuilder buf = new StringBuilder("UPDATE guilds SET GP = ?, logo = ?, logoColor = ?, logoBG = ?, logoBGColor = ?, ");
for (int i = 1; i < 6; i++) {
buf.append("ran... |
d04fda5e-323d-4649-8462-36be1d02c109 | 0 | public boolean isUseUUID() {
return useUUID;
} |
09565ae4-11d8-401b-820d-9e0fed84509c | 2 | public Opponent[] getOpponentsFor(Tanq me) {
synchronized (tanqs) {
Opponent[] opponents = new Opponent[tanqs.size() - 1];
int index = 0;
for (Tanq tanq: tanqs)
if (tanq != me)
opponents[index++] = new Opponent(tanq);
return opponents;
}
} |
d397f23b-2a76-42cc-b4c6-955afc479eac | 4 | protected void appendDescriptor(final int type, final String desc) {
if (type == CLASS_SIGNATURE || type == FIELD_SIGNATURE
|| type == METHOD_SIGNATURE)
{
if (desc != null) {
buf.append("// signature ").append(desc).append('\n');
}
} else {... |
16488242-4e8d-41eb-8868-e1af1ce3642d | 2 | public void stop() {
if (this.task != null && !this.task.isDone()) {
this.task.cancel(true);
this.task = null;
BmLog.info("ConnectionController is stopped");
}
} |
8d15d54a-d647-419c-892a-ea1619f08074 | 2 | public ListNode mergeKLists2(ArrayList<ListNode> lists) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
if (lists.size() == 0)
return null;
ListNode head = lists.get(0);
for (int i = 1; i < lists.size(); ++i) {
ListNode sub =... |
2336da5d-d82a-46c6-be10-12f53aaee56e | 4 | public void printValues(){
if(!isBust()){
if(isBlackjack() && cards.size() == 2){
System.out.print("Blackjack!");
}
else{
System.out.print(values.get(0));
for(int i = 1; i < values.size(); i++){
System.out.println(" or " + values.get(i));
}
}
}
else{
System.out.print("Bust!... |
3b6b9ad3-f0ba-4c3e-ba07-1bb5f9f2b0e9 | 3 | private void encode(long value)
{
value = value * 2 - 1;
int numRelevantBits = 64 - Long.numberOfLeadingZeros(value);
int numBytes = (numRelevantBits + 6) / 7;
if (numBytes == 0)
numBytes = 1;
byte[] bytes = new byte[numBytes];
for (int i = numBytes - 1; i >= 0; i--)
{
int cu... |
52583c11-d1c4-4e44-b091-ff5cfd97580a | 1 | void fireFinnish(ComponentAccess w) {
if (shouldFire) {
fire(Type.FINISHED, new ComponentEvent(c, w.getComponent()));
}
} |
25a3fa5e-1f9c-4b80-a9d7-2e92f4c4282a | 7 | private Expression_Boolean ifExpr() {
boolean correct = false;
if (!existError) {
System.out.println("***IfExpr***");
if (checkAtribute("if")){
Expression_Boolean result1 = exp0(true);
correct = result1.isCorrect();
if (correct) {
Expression e1 = e.deepCopy();
if (checkAtribute("then")) ... |
6908f8d3-d6c7-46e6-8e5f-9c25f0367480 | 3 | private static int[] negateNegativeBinary(int[] binary){
int nBin = binary.length;
int[] negate = new int[nBin];
int[] minusOne = new int[nBin];
for(int i=0; i<nBin; i++){
minusOne[i]=1;
negate[i]=0;
}
// subtract one
negate = DtoA.addBinar... |
a752a369-4c97-49ef-b033-9cf8a012910c | 5 | public static boolean areAllLetters(String s){
for(char c : s.toCharArray()){
if(!(c <= 'z' && c >= 'a' || c <= 'Z' && c >= 'A')){
return false;
}
}
return true;
} |
ca1bfd8d-a4d5-4033-acd6-da2753395bab | 3 | public static void main(String[] args) {
RedBlackBST<String, Integer> st = new RedBlackBST<String, Integer>();
int i = 0;
System.out.println("Digite um no");
Scanner key = new Scanner(System.in);
do {
System.out.println("Digite um no");
if(!key.equals(null)) {
... |
ec109c72-d9fa-4920-9c7c-b274cf45e8a0 | 6 | @Override
public void render(float arg0) {
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
batch.begin();
for(int r = 0; r < 4; r++) {
for(int c = 0; c < 25; c++) {
batch.draw(backgroundLight, c * 32, r * 32);
}
}
for(int c = 0; c < 25; c++) {
batch.draw(backgroundTransition, c * 32, 32 * 4);
}
... |
0edbe827-d705-4e97-9eb5-43040235b64a | 1 | private void joinStatus(Player p, String channel) {
if (this.channel.isJoinable(channel)) {
p.sendMessage("Joinable: " + ChatColor.GREEN + "Yes");
} else {
p.sendMessage("Joinable: " + ChatColor.RED + "No");
}
} |
4dbb3c8d-0ada-475a-844c-14e33840fab4 | 9 | public static boolean isSameLocalTime(Calendar cal1, Calendar cal2) {
if (cal1 == null || cal2 == null) {
throw new IllegalArgumentException("The date must not be null");
}
return (cal1.get(Calendar.MILLISECOND) == cal2.get(Calendar.MILLISECOND) &&
cal1.get(Calendar.S... |
bbba91cf-ff4b-45d6-8619-23c7f04c4747 | 7 | public Object down(Event evt) {
switch(evt.getType()) {
case Event.VIEW_CHANGE:
handleViewChange(evt.getArg());
break;
case Event.GET_STATE:
StateTransferInfo info=evt.getArg();
Address target=info.target;
... |
0c78c976-f35f-4f3a-a312-f84aee62bc5f | 2 | @Override
protected void compute() {
if (numbers.size() < 300) {
for (int i = 0; i < numbers.size(); i++) {
numbers.set(i, Math.pow(numbers.get(i), 2));
}
return;
}
int middle = numbers.size() / 2;
SquareTaskForkJoin left = new Sq... |
f6aa3697-6628-4ac7-8233-55331a285701 | 0 | public String getManufacturer() {
return manufacturer;
} |
9841d576-5312-4f6c-9652-268306910fc0 | 6 | @Override
public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isPet)
{
if (!npc.isInCombat())
{
if (player.getActiveWeaponInstance() != null)
{
npc.setTarget(player);
npc.broadcastNpcSay(((player.getAppearance().getSex()) ? "Sister " : "Brother ") + player.getName() + ", move you... |
12abb7b0-d0a1-4f42-87f4-4dbf68967783 | 1 | public void testPlus_int() {
Years test2 = Years.years(2);
Years result = test2.plus(3);
assertEquals(2, test2.getYears());
assertEquals(5, result.getYears());
assertEquals(1, Years.ONE.plus(0).getYears());
try {
Years.MAX_VALUE.plus(1);
... |
ed9ca345-3ef1-4ca0-9fa3-d8e4d73f73fe | 7 | private int calculateUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
int hNew = 10, hTask = 10, increment = 0, currentPosition;
hNew = newTaskPanel.getHeight();
if (guiTaskPanelList != null) hTask = guiTaskPanelList.get(0).panel.getHeight();
currentPosition = visibleRect.y;
if... |
91009f68-a46a-4227-be43-0f057801f41b | 0 | @Override
public void onLoad() {
updateChecker.start(this);
} |
1f61a463-d772-4d08-9870-3802c14ae5fe | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Credentials other = (Credentials) obj;
if (user == null) {
if (other.user != null)
return false;
} else if (!user.equals(other.user))
... |
bf5d51fe-9c61-4368-a6a1-d74d4106882c | 1 | private Teleporter getRandomDestination(Teleporter current, List<Teleporter> teleports) {
int randomIndex = teleports.indexOf(current);
while (randomIndex == teleports.indexOf(current))
randomIndex = (int) (Math.random() * teleports.size());
return teleports.get(randomIndex);
} |
d94607cc-6ac5-4a50-9ae1-59bab3325df7 | 2 | public void withdraw(int value) {
if(value < 0) {
throw new IllegalArgumentException("You can't withdraw a negative number dollars!");
} else if(value > money) {
throw new IllegalArgumentException("You don't have enough money to withdraw " +
value + "dollars!");
} else {
notifyPropertyChangeListener... |
b29dfa57-cbf6-413a-aeaa-c1d83184e64e | 2 | public void setStat(double[] dataValue, int calibrationType, boolean[] calibrate) {
this.data = dataValue;
this.calibrationType = calibrationType;
this.calibrationFlag = calibrate;
calibrationDataSize = 0;
for (int i = 0; i < this.calibrationFlag.length; i++) {
if (c... |
cb3b78f1-7b01-4b21-8c86-cb327f2f6562 | 2 | private static JPanel createStatText() {
JPanel panel = new JPanel();
StringBuilder sb = new StringBuilder();
sb.append("Wins:" + StorageManager.getWins() + " ");
sb.append("Losses: " + StorageManager.getLosses() + " ");
double ratio = StorageManager.getRatio() * 100;
sb.... |
70db28a2-e874-4fc8-b00b-3fff668ec1ec | 2 | @Override
public void keyPressed(KeyEvent arg0) {
int keyCode = arg0.getKeyCode();
if(keyCode==KeyEvent.VK_SPACE) {
if (enabled) {
robotInstance.getPacketTransmitter().setDisabled();
jEnableBtn.setText("Enable");
jRoboStatus.setText("Connected (Disabled)");
enabled = false;
}
}
} |
033c5c95-b188-419f-a78b-7d22ac08b6de | 9 | public void logfile(String recipient, String msg) {
if (server == null)
return;
try {
Calendar now = Calendar.getInstance();
int hour = now.get(Calendar.HOUR_OF_DAY);
int minute = now.get(Calendar.MINUTE);
int second = now.get(Calendar.SECOND);
msg = (hour<10?"0":"") + hour + ":" + (minute<10?"0":... |
a514c330-37ce-46c7-bd7d-d2e9f9ec02b6 | 4 | public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.opt(i... |
be1a1c78-27ff-4b30-9782-9e2a239a737c | 3 | private BSTNode<T> recRemove(T element, BSTNode<T> tree) {
if (tree == null)
found = false;
else if (element.compareTo(tree.getInfo()) == 0) { // remove this node
tree = removeNode(tree);
found = true;
}
else if (element.compareTo(tree.getInfo()) < 0) // remove a left node
tree.setLeft(recRemove... |
04adbaa2-b74e-4232-8c13-0527b870fae3 | 3 | private String processFileExternal()
{
String output_str = "";
Process cmd_proc;
final String cmdline = settings.cur_processor.path + " "
+ settings.cur_processor.options + " "
+ markdown_file.getAbsolutePath();
try
{
cmd_proc = Runtime.getRuntime(... |
f069538f-41fe-4f84-844b-a9133a3c4e59 | 1 | public void deleteItemFromInventory(Item item) {
if(item == null)
throw new NullPointerException("An item can't be null.");
inventory.remove(item);
} |
bc298ff5-e9d6-4ded-8aaa-47c79290040c | 1 | public void visitTryCatchBlock(
Label start,
Label end,
Label handler,
String type)
{
super.visitTryCatchBlock(start, end, handler, //
type == null ? null : remapper.mapType(type));
} |
5dc3cba0-32df-4ccf-840a-36ac9d33b9c8 | 7 | @FXML
private void calculateGN(ActionEvent e) {
try {
Scanner sLine = new Scanner(input.getText());
String line = null;
dataset = new LinkedList<>();
while (sLine.hasNextLine()) {
line = sLine.nextLine();
Scanner scanner = new S... |
a966f9e4-446c-42b7-aa6e-3a7120b2ee83 | 3 | private boolean jj_3R_18()
{
if (jj_3R_20()) return true;
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3R_21()) { jj_scanpos = xsp; break; }
}
return false;
} |
0616714b-b09d-465d-9b74-30a9e4433cb5 | 6 | public Vector collide(PhysicsObject a){
if( !open ){
Vector aPosition = a.getPosition();
Vector aOldPosition = a.getOldPosition();
Vector aSize = a.getSize();
if (a instanceof Player && (aPosition.x + aSize.x > this.currentPosition.x && aPosition.x < this.currentPosition.x + this.size.x) && (aPosition.y +... |
e76ff192-99c0-4978-8b5c-e18ba854125b | 8 | public void setAdjacent(){
Node temp = null;
temp = findNode(x+10, y);
if(temp != null && temp.isWalkable()==true){
rightNode = temp;
adjacentNodes.add(rightNode);
}
//Left adjacent node
temp = findNode(x-10, y);
if(temp != null && temp.isWalkable()==true) {
leftNode = temp;
adjacentNodes.add(... |
53f0c557-2731-405e-ae6e-2d4b090bd46c | 8 | @SuppressWarnings("unused")
private static void getAnnotationInfo(String type) throws Exception{
Class<?> classType = Class.forName(type);
boolean flag = classType.isAnnotationPresent(ClassAnnotation.class);
if (flag)
{
ClassAnnotation annotation = (ClassAnnotation) classType.getAnnotation(Class... |
2f9ebea2-cfcd-4b8e-a05f-3ca585e80491 | 5 | @EventHandler
public void onSignChange(SignChangeEvent event) {
Player player = event.getPlayer();
// Sign sign = (Sign)event.getBlock().getState();
String [] lines = event.getLines();
if (lines[0].equalsIgnoreCase("golf") || lines[0].equalsIgnoreCase("[golf]")) {
if (player.isOp() || player.hasPermission... |
c2f62c19-972b-4b56-b22f-3e793b27e599 | 1 | @Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just did a pulse strike!");
return random.nextInt((int) agility) * 2;
}
return 0;
} |
a7f7d745-47af-440c-9f0e-7f4c1bbf1dc3 | 1 | public Identifier getRepresentative() {
Identifier ptr = this;
while (ptr.left != null)
ptr = ptr.left;
return ptr;
} |
a0d4efee-ff9b-46dc-8ada-c68e08475ff6 | 3 | @Override
public void execute(double t) {
if (input.isConnected()) {
Matrix u = input.getInput();
for (int i = 0; i < input.getDim(); i++) {
xs[i].x.add(u.get(i, 0));
double v = Math.abs(u.get(i, 0));
if (maxv < v)
maxv = v;
}
}
} |
877fe44c-3349-4922-b52d-e5f3fe2621a4 | 1 | public void detectLines() {
for (int i = 5; i > 2; i--) {
detectLine(i);
}
} |
a4ea081f-0d8b-47eb-b7b0-be1d3e64046c | 2 | public static DelaysTypeEnum fromValue(String v) {
for (DelaysTypeEnum c: DelaysTypeEnum.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
0c60e13b-7f80-466d-810a-f854c62151b0 | 8 | * @param settlement The <code>IndianSettlement</code> demanded of.
* @return An <code>Element</code> encapsulating this action.
* TODO: Move TURNS_PER_TRIBUTE magic number to the spec.
*/
public Element demandTribute(ServerPlayer serverPlayer, Unit unit,
IndianSettlem... |
9656df61-a5b4-448d-80aa-107b475c87d2 | 9 | public static void daxpy_f77 (int n, double da, double dx[], int incx, double
dy[], int incy) {
int i,ix,iy,m;
if (n <= 0) return;
if (da == 0.0) return;
if ((incx == 1) && (incy == 1)) {
// both increments equal to 1
m = n%4;
for (i = 1; i <= m; i... |
2d32c070-fd33-4c39-a193-645222167660 | 1 | protected void addChild( GraphItem item ) {
children.add( item );
if( site != null ) {
site.addItem( item );
}
} |
57fa3654-5ce4-4c20-a476-49e1db979545 | 5 | public static void writeHeaderWithImports( OpcodeDefinition[] imports, OutputStream os ) throws InvalidEncoding, IOException {
writeTbbHeader(os);
for( int i=0; i<imports.length && i<256; ++i ) {
if( imports[i] == null ) continue;
if( i == 0x41 && !LoadOpcode.INSTANCE.getUrn().equals(imports[i].getUrn()) ) {... |
32f7e1b5-311e-4fd3-9c9f-55bf9ada1ef2 | 7 | @Override
public MapConnector<String, Integer> putAll(Map<? extends String, ? extends Integer> map) throws Exception {
String stm;
try (Connection con = getConnectorInfo().getConnection()) {
stm = getCreateTableTmp(getConnectorInfo().getTableName());
try (PreparedStatement pr... |
1b32a20b-c6f7-479c-80ae-bae5d2aebb3d | 6 | public static void STARTUP_FETCH_DEMO() {
{ Object OLD_$MODULE$_000 = Stella.$MODULE$.get();
Object OLD_$CONTEXT$_000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/STELLA/XML-OBJECTS/FETCH", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpeci... |
311aa1f0-7eef-48bb-b963-509b4b0fcb80 | 4 | private void searchLastNameField2KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_searchLastNameField2KeyTyped
int strLength = searchLastNameField2.getText().length(); // Vi checker længden på vores String så vi kan begrænse dens max længde i vores IF-statement nedenfor.
char c = evt.getKey... |
e41b5ba8-aaed-4cf4-964b-509c99436a66 | 7 | public void removeEvent(int key, Object aEvent){
LinkedList<Object> temp = days.remove(key);
if (((Event)aEvent).getSib() != 0){
LinkedList<Object> others = days.remove(getNextDay(key));
int firstRun = 0;
for (Object o : others){
if (firstRun == 0){
firstRun = 1;
continue;
}
if (((Eve... |
eea297e2-c2a2-4bbe-9277-62ff0f86a600 | 8 | @Override
public int compare(BThread o1, BThread o2) {
if ((o1 == null) && (o2 == null)) {
return 0;
} else if ((o1 == null) && (o2 != null)) {
return -1;
} else if ((o1 != null) && (o2 == null)) {
return 1;
} else {
// porovname na zaklade priority
if (o1.getPriority() < o2.getPriority()) {
... |
ba86f539-6ab7-451f-87e3-3b885e535d8d | 5 | public List<Author> getAuthors() {
List<Author> list = new ArrayList<>();
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDA... |
ebfcfdae-8a9d-4f97-b6de-c77cb090af6e | 0 | public void addItemToLayer(PathItem pi) {
this.ditems.add(pi);
} |
419aa33d-21b8-4154-975c-ac5c28a120dc | 7 | @Override
public void render(Graphics g) {
if (!isHasTree() && !isHasWall()) {
g.drawImage(game.getRes().tiles[getTileID()], getX(), getY(), game);
} else if (isHasTree()) {
g.drawImage(game.getRes().tiles[GameResourceLoader.Tree], getX(), getY(), game);
} else if (isHasWall()) {
g.drawImage(game.getRes... |
806c5d3c-4920-4052-880f-73e4bd9139e1 | 7 | public final boolean isDisallowed(final OS os) {
if(rules != null) {
final String osName = os.getMinecraftName();
for(final DLRule rule : rules) {
if(rule.os != null) {
final String currentOs = rule.os.get("name");
if(rule.action.equals("disallow") && currentOs.equals(osName)) {
retur... |
0efae34c-cbdf-49f4-b83f-94a95dd2c93c | 1 | public static void main(String[] args) {
int[] array = new int[10];
for(int i=0;i<10;i++)
array[i] = i;
TreeNode root = new Convert_Sorted_Array_to_Binary_Search_Tree().sortedArrayToBST(array);
root =null;
} |
42dd092e-f64a-4a8d-b39d-c9669985e32e | 1 | @Override
public void render() {
super.render();
if(item != null) {
Texture tex = Application.get().getResourceManager().getTextureManager().getTexture(item.getSprite());
Renderer.get().draw(tex, x, y);
Renderer.get().drawText("Cost:" + item.getValue(... |
3cbb1caa-c107-42a9-94c4-d7dce4caa148 | 1 | */
public static void getFlight(int selectedFlight) {
flightList.setSelectedIndex(selectedFlight);
Set<Crew> tempCrewSelectionRemoveSet = (Set<Crew>) map.get(flightList.getSelectedValue().toString());
if (tempCrewSelectionRemoveSet.isEmpty()) {
crewList.removeSelectionInterval(0, data.generateCrews().lengt... |
c3d34eab-bd62-4c4e-9a66-63c95fc38035 | 9 | public static Point2D coordinates(final Rectangle2D rectangle,
final RectangleAnchor anchor) {
Point2D result = new Point2D.Double();
if (anchor == RectangleAnchor.CENTER) {
result.setLocation(rectangle.getCenterX(), rectangle.getCenterY());
}
... |
a1ef7252-adb9-4c6c-8c19-9d5eac7fd3a6 | 6 | private String transformaIntDia(int i){
if (i == 0) return "dilluns";
else if (i == 1) return "dimarts";
else if (i == 2) return "dimecres";
else if (i == 3) return "dijous";
else if (i == 4) return "divendres";
else if (i == 5) return "dissabte";
else return "di... |
fc37cac6-df97-4029-b441-3cdf0af0c5e8 | 2 | @Override
public Host info(Host host) throws CommunicationException {
if (host == null) {
throw new NullPointerException("A null host was given.");
}
try {
SimulationHandle simulationHandle = getRemoteHandle(host);
PeerReference peerReference = simulation... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.