method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
400cccff-8ba1-4a28-80e4-38421513e7b2 | 2 | public static void updateKingCoor(String color, int xCoor, int yCoor){
if (color.equals("W")){
whiteKingXCoor = xCoor;
whiteKingYCoor = yCoor;
}
else if (color.equals("B")){
blackKingXCoor = xCoor;
blackKingYCoor = yCoor;
}
} |
0957af27-5417-4567-b423-363b94d0c0ce | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TabelProdSize other = (TabelProdSize) obj;
if (!Objects.equals(this.sizeId, other.sizeId)) {
... |
013be992-5ebb-49e4-bc91-f2376793415d | 3 | public void chooseDirection()
{
if (this.walkType == 0)
{
if (probabiltyA >= (Math.random() * 100))
{
// chooses a random direction to move in
}
else
{
// no movement
chosenDirection = 0;
}
}
else
{
// line walk type movement
... |
5f185ba7-bba3-4db0-8cc6-1040877ecc61 | 4 | public int getPixel(int x, int y) {
if (x < 0 || x >= width || y < 0 || y >= height) {
throw new RuntimeException("That escalated quickly...");
}
return pixels[x + y*width];
} |
a7708327-bad1-47c7-ac05-7fa0b18da4e1 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AUsersFacade other = (AUsersFacade) obj;
if (users == null) {
if (other.users != null)
return false;
} else if (!users.equals(other.user... |
aea14737-48f8-4bb6-bd96-61180e72ade9 | 8 | private double findSplitNominalNumeric(int index) throws Exception {
double bestVal = Double.MAX_VALUE, currVal;
double[] sumsSquaresPerValue =
new double[m_Instances.attribute(index).numValues()],
sumsPerValue = new double[m_Instances.attribute(index).numValues()],
weightsPerValue = new d... |
2eccfa45-ad08-44e5-a614-21a11b0c9a4c | 0 | public String getDotSource() {
return graph.toString();
} |
24b17f3d-b40c-46c5-8160-673c73701ea9 | 2 | private void writeStringAMF0(List<Byte> ret, String val) throws EncodingException
{
byte[] temp = null;
try
{
temp = val.getBytes("UTF-8");
}
catch (UnsupportedEncodingException e)
{
throw new EncodingException("Unable to encode string as UTF-8: " + val);
}
ret.add((byte)0x02);
ret.add((byte)... |
75d80280-4dea-4c60-b4b7-cc7d11e86be4 | 4 | public static void main(String[] args) {
serverConsole = new ServerConsole(PORT);
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
frame = new MainFrame();
frame.setVisible(true);
frame.getLoginPanel().setVisible(true);
} catch (Exception e) {
e.printStackTrace();
... |
8b030588-c5ab-4cd4-a76e-0784d323832d | 5 | @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void handleItemFrameRotation(PlayerInteractEntityEvent event) {
Player player = event.getPlayer();
User user = EdgeCoreAPI.userAPI().getUser(player.getName());
if (user == null)
return;
if (event.getRightClicked().getType... |
50372f76-0d67-4141-a9c5-a82255b63feb | 9 | private void serveTheClient()
{ // обслуживание клиента (прием/отправка сообщений)
String inMsg = new String();
ReadyToSendMessage msgToSend = null;
while (true)
{
/*Отправка сообщения из общей рассылки чата*/
msgToSend = serverController_.getMessageToSend(handlerThreadId_);
if (msgToSend != null)
... |
38c23689-ed23-426b-92db-df05d944adf1 | 2 | public Alien(int courtWidth, int courtHeight, int INIT_X, int INIT_Y) {
super(INIT_VEL_X, INIT_VEL_Y, INIT_X, INIT_Y, SIZE, SIZE, courtWidth,
courtHeight);
// Set img1 to the alien ship file
try {
img1 = ImageIO.read(new File(img_file1));
} catch (IOException e) {
System.out.println("Internal Error:" ... |
50e1b72e-18e7-496f-999f-5efb65d967c5 | 9 | public static void main(String[] args) {
// TODO Auto-generated method stub
LLint op1=new LLint(6);
op1.insert(1);
op1.insert(7);
LLint op2=new LLint(2);
op2.insert(9);
op2.insert(5);
LLint ans=null;
Stack<Integer> st1=new Stack<Integer>();
Stack<Integer> st2=new Stack<Integer>();
Stack<I... |
a4743938-5b28-4aaa-8d1e-18fca6e261ca | 5 | @Override
public void updateAll(MiniGame game)
{
try
{
game.beginUsingData();
// MOVE THE PLAYER ACCORDING TO ITS PATH
player.update(game);
if (player.getCurrentIntersection() == level.destination)
{
endGame... |
af06f3b3-dbed-4753-821b-f01b9169bdb1 | 3 | static String randomTime() {
String hours = random(0,23);
if (hours.length() == 1) {
hours = "0" + hours;
}
String minutes = random(0,59);
if (minutes.length() == 1) {
minutes = "0" + minutes;
}
String seconds = random(0,59);
if (se... |
3a4dd509-bf9c-4780-82f7-8b7e850ec9fd | 7 | private Match getBestMatch()
{
Set<Match> keys = table.keySet();
Iterator<Match> iter = keys.iterator();
Match biggest = null;
Match other = null;
while ( iter.hasNext() )
{
Match m = iter.next();
if ( m.freq == 1 && (biggest==null||m.length>biggest.length) )
biggest = m;
else if ( m.freq > 1 ... |
a46d456a-055a-483c-8150-ea0c67fc2d66 | 9 | @Override
public void executeTask() {
try {
System.out.println("preparing UDP broadcast");
byte senddata[] = "$$$".getBytes();
DatagramSocket clientN = new DatagramSocket();
clientN.setBroadcast(true);
try {
DatagramPacket sendPacket = new DatagramPacket(senddata,
senddata.length,
Inet... |
7916fedf-4783-4db5-b531-647b61db82bc | 5 | public int maxDepth(TreeNode root) {
// Start typing your Java solution below
// DO NOT write main() function
if (root == null)
return 0;
Queue<TreeNode> q = new LinkedList<TreeNode>();
q.offer(root);
int depth = 0;
while (!q.isEmpty()) {
int n = q.size();
while ((n--) > 0) {
TreeNode tmpNode... |
ac5abf9f-a0a8-49c1-8687-e1a065e135c1 | 8 | public Dispatcher(Vector<GPRMC> myQueue, Vector<String> myLogQueue, Vector<GPRMC> myInsertQueue, Vector<GPRMC> myPushQueue)
{
packetQueue=myQueue;
logQueue=myLogQueue;
insertQueue=myInsertQueue;
pushQueue=myPushQueue;
Properties prop = new Properties();
try {
//load a properties fi... |
5eed343f-4d6e-424c-bf20-7fc83e88f534 | 7 | @Override
public void surveySucces(EventObject e) {
jTextArea1.setText("");
if (Stale.question1 == 5) {
jTextArea1.append(Stale.answers[Stale.type][0]);
jTextArea1.append("\n");
}
if (Stale.question2 == 5) {
jTextAre... |
1206482f-db19-4ad6-8292-b9604ace0ab7 | 9 | public int evalRPN(String[] tokens) {
int len=tokens.length;
Stack<Integer> stack=new Stack<Integer>();
for(int i=0;i<len;i++){
if(!tokens[i].equals("+")&&!tokens[i].equals("-")&&!tokens[i].equals("*")&&!tokens[i].equals("/")){
stack.push(Integer.valueOf(tokens[i]));
}else{
... |
0d89e5fe-bc0e-4a57-9b60-3c5ada25399d | 2 | @Override
public State nextState(Random random) {
State newState;
int value = random.nextInt(10000);
if (Utils.isBetween(value, 0, P_UM)) {
newState = new Modified();
} else if (Utils.isBetween(value, P_UM, P_UD)) {
newState = new Deleted();
} else {
newState = new Unmodified();
}
return n... |
ae2dfff5-0678-4bfe-99e9-70a0163e464d | 4 | public Object getObject(String id)
{
Object obj = null;
if (id != null)
{
obj = objects.get(id);
if (obj == null)
{
obj = lookup(id);
if (obj == null)
{
Node node = getElementById(id);
if (node != null)
{
obj = decode(node);
}
}
}
}
return obj;
} |
90575d2b-32ff-4efc-9d0c-fb9253a34f55 | 9 | public boolean isMatch(String s, String p) {
int i = 0;
int j = 0;
int star = -1;
int mark = -1;
while (i < s.length()) {
if (j < p.length()
&& (p.charAt(j) == '?' || p.charAt(j) == s.charAt(i))) {
++i;
... |
107f8730-94fd-4849-9807-7828b18bc437 | 6 | public void insert(SkipListsNode searchKey)
{
int i, lvl=0;
ArrayList<SkipListsNode> update = new ArrayList<SkipListsNode>();
SkipListsNode x = header;
for(i=topLevel; i>-1; i--)
{
while(x.forwards.get(i).key.compareTo(searchKey.key) < 0)
x = x.forwards.get(i);
update.add(0, x);
}
x ... |
20ba5588-6c16-493d-a05b-7b94b8d7f588 | 8 | public static <T extends Comparable<? super T>> T[] merge(T[] ls, T[] hs,
T[] t) {
int i = 0;
int j = 0;
int pos = 0;
while (i < ls.length && j < hs.length) {
if (ls[i].compareTo(hs[j]) <= 0) {
t[pos] = ls[i];
i++;
} else {
t[pos] = hs[j];
j++;
}
pos++;
}
if (i == ls.length &... |
0ad4664a-ba40-4fbd-9732-919d901064dc | 3 | public List<Recipe> getSearchListFromIndex() {
if (searchList.isEmpty()) {
return searchList;
}
int toIndex = searchIndex + 4;
if (toIndex > searchList.size()) {
toIndex = searchList.size();
}
List<Recipe> returnlist = searchList.subList(searchInde... |
a99ae851-8d30-4d14-aea0-bf03af154728 | 7 | private static void lsschedule() {
Registry jobTrackerRegistry;
try {
jobTrackerRegistry = LocateRegistry.getRegistry(MapReduce.Core.JOB_TRACKER_IP,
MapReduce.Core.JOB_TRACKER_REGISTRY_PORT);
JobTrackerRemoteInterface jobTrackerStub =
(JobTrackerRemoteInterface) jobTrackerRegistry.lo... |
f43d6e6c-dd1f-4180-821e-3144aac5e280 | 2 | public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
super.paintComponent(g2);
if (grid == null)
return;
Insets insets = getInsets();
g2.setColor(backgroundColor);
g2.fillRect(insets.left, insets.top, numCols * (cellSize + 1) + 1, nu... |
8db37d13-5d65-4a4e-8c46-b882da0c8b32 | 3 | public boolean imageUpdate(Image img, int infoflags, int x, int y, int w,
int h) {
if ((infoflags & (ALLBITS | ABORT)) == 0) {
return true;
} else {
if ((infoflags & ALLBITS) != 0) {
if (clip != null) {
synchronized(clip) {
Graphics2D graphi... |
c8bbc2ee-28b8-410a-b465-30819ac65871 | 7 | private static Holder findInListOrNull(List<Holder> list, String contig, int startPos, int endPos)
throws Exception
{
Holder h = null;
int overlap =0;
for(Holder h2 : list)
{
if( h2.conting.equals(contig) && startPos >= h2.startPos && endPos <= h2.endPos )
{
if( h != null )
{
System.... |
dd01264f-a8bc-4ae0-817d-9b1c965ba380 | 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... |
afcd26ed-3e75-48ea-988f-384ccf5a82f4 | 9 | public void run() { // run method for Graph
// stops after 5 changes
int runCount = 0;
while (! isEmpty() && runCount<5) {
Random rand2 = new Random(); int nextFunction = rand2.nextInt(4);
// 3/4 chance the government will add a new road, 1/4 chance it will restructure graph (delete road not in min span t... |
73ae1948-45fc-4435-9bb4-a48541744483 | 0 | private void getContent() {
totalnum.setText("48892");
tcpnum.setText("22009");
udpnum.setText("25002");
} |
58dea0ef-bad9-4190-986d-11077acf9827 | 8 | public boolean loadFromJsonStream(InputStream is) {
BufferedReader br;
try {
br = new BufferedReader(new InputStreamReader(is));
StringBuffer buf = new StringBuffer();
String line = null;
while ((line = br.readLine()) != null) {
buf.append(line);
}
JSONObject obj = new JSONObject(buf.toStr... |
5fa91d91-a435-4d3b-b33b-a3f2cff3c871 | 5 | private boolean func_151634_b(int p_151634_1_, int p_151634_2_)
{
if (compareBiomesById(p_151634_1_, p_151634_2_))
{
return true;
}
else if (BiomeGenBase.getBiome(p_151634_1_) != null && BiomeGenBase.getBiome(p_151634_2_) != null)
{
BiomeGenBase.TempCa... |
eee964ca-0b88-443e-a1cc-713fa5f8cc02 | 3 | private void addRowToChoiceWindow(TreePath selPath){
String name = selPath.getPathComponent(selPath.getPathCount()-1).toString();
AlgorythmFile currentAlgorithm = null;
for(int i = 0; i<Main.getFileBase().getLength(); i++){
if (Main.getFileBase().getFile(i).getAlgorythmName().equals(... |
32c46ba3-f3e6-4ca6-ac3e-235be69bf96d | 7 | @Override
public int search(int l, int r) {
if (l <= r) {
_count++;
int k = interpolatePosition(l, r);
int locelem = _list[k];
if (locelem == _element) {
_count++;
return k;
} else {
int m = (int) Math.ceil(Math.sqrt(r - l + 1));
int i = 1;
_count += 2;
if (locelem > _element) ... |
f29d1d4e-38ef-47ad-9bdb-eabffc243c12 | 9 | private boolean execUpdateProfile(VectorMap queryParam, StringBuffer respBody, DBAccess dbAccess) {
try {
boolean success = true;
int clntIdx = queryParam.qpIndexOfKeyNoCase("clnt");
String clientName = (String) queryParam.getVal(clntIdx);
int t0, t;
... |
65c9cf86-2f3d-48a6-9ee7-d06ca1654bd2 | 7 | @Override
final public void compute() {
//
// reset time.
//
final int last = this.frameidx;
//
// from first to last layer.
//
for (int l = 0; l < this.structure.layers.length; l++) {
//
if (l == this.structure.inputlayer) cont... |
4659e92c-a2d2-49ce-bf52-32f282536e0f | 4 | public Object put(Object key, Object value) {
// check for nulls, ensuring symantics match superclass
if (key == null) {
throw new NullPointerException("Null keys are not allowed");
}
if (value == null) {
throw new NullPointerException("Null values are not allowed... |
77278968-e299-46ba-9126-267855419549 | 7 | public void checkInitialization(){
if(addEntityStateObj)
temporary=new AddEntityStateObjectView();
if(removeEntityStateObj)
temporary=new RemoveEntityStateObjectView();
if(addEntityState)
temporary=new AddEntityStateView();
if(removeEntityState)
... |
d65579ed-3cdb-4af8-a6ff-56a399d7c69d | 4 | private String textToString(AbstractComponent component)
throws BookException {
StringBuilder sb = new StringBuilder();
try {
Iterator<AbstractComponent> iterator = component.getIterator();
while (iterator.hasNext()) {
AbstractComponent c = iterator.next();
if (c.getType() == EComponentType.PARAGRA... |
1a914a0e-451a-4212-9ccc-5a5e64ed20de | 7 | public static long compareKeys(int[] key1, int[] key2) throws pval_error, make_key_error
{
int i=keyLength-1;
long pval=1,dist=0;
if (i==-1) return 0;
long dec=(long)Math.pow(2,b);
pval=(long)Math.pow(2,keyLength*b);
//outputtoScreen("\nStarting pval="+pval);
for (int j=0;j<=i;j++)
{
pval=pval/dec;
... |
3f5dc601-f173-4bdc-aede-269b08a94f6f | 4 | public void setMatrix(String str) {
String[] row_strings = str.split(";");
if (row_strings.length != height)
return;
int[][] new_array2d = new int[height][width];
String[] row_list;
for (int j=0; j<height; j++) {
row_list = row_st... |
b2dc834a-0136-4515-b8d9-fbc610bd0269 | 2 | public static PyschosensoryNeedEnumeration fromValue(String v) {
for (PyschosensoryNeedEnumeration c: PyschosensoryNeedEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
be9eafa4-7ae0-430c-9dc3-e4e5b766c37e | 6 | @Override
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
Map<String, Object> pageVariables = new HashMap<>();
HttpSession httpSession = request.getSession();
UserSession session = sessions.get(httpSessi... |
131bd35a-296a-432e-bd05-094e4be47fdb | 2 | public Node remove() {
if (linkSimple.getNext() == null || linkSimple == null) {
linkSimple = null;
throw new NoSuchElementException(
"L'element a enlever est inexistant.");
} else {
linkSimple = (LinkSimpleNode) linkSimple.getNext();
listCount--;
return linkSimple.getNode();
}
} |
a9061d9a-8ad2-43c5-a51e-c1b186f31986 | 6 | int startGoalCount(int col){
int count = 0;
if (col == Chip.WHITE) {
for (int i = 1; i<7; i++) {
if(board[0][i].returnColor() == Chip.WHITE)
count++;;
}
}
if (col == Chip.BLACK) {
for (int i = 1; i<7; i++) {
if(board[i][0].returnColor() == Chip.BLACK)
... |
d54802ed-1794-4908-abf3-fe757a192820 | 6 | public static void collectSubsumingParentsBelow(LogicObject self, Description renamed_Super, List newparentdescriptions, MarkerTable alreadyvisitedtable, MarkerTable selfisbelowtable, java.lang.reflect.Method subsumptiontest) {
if ((Stella.$TRACED_KEYWORDS$ != null) &&
Stella.$TRACED_KEYWORDS$.membP(Logic.K... |
78b81902-b8bc-4742-b66e-17af5832c4d9 | 7 | public boolean nextStep() {
if (!done())
return false;
step++;
switch (step) {
case FIRST_SETS:
parseAction.setEnabled(false);
firstFollow.getFFModel().setCanEditFirst(true);
firstFollow.getFFModel().setCanEditFollow(false);
directions
.setText("Define FIRST sets. ! is the lambda characte... |
160139e2-d378-49a9-ae3b-9815c440cdd8 | 2 | public Gebruiker zoekGebruiker(String nm, ArrayList<Gebruiker> a){
Gebruiker antw = null;
for(Gebruiker g: a){
if(g.getNaam().equals(nm)){
antw = g;
break;
}
}
return antw;
} |
dd4c7544-7c55-4b2d-8b4d-6f5426028862 | 8 | public void buildSettingsWindow(){
getCurrentSettings();
final JFrame settingsFrame = new JFrame("Settings");
JPanel settingsPanel = new JPanel();
ButtonGroup buttonGroup = new ButtonGroup();
rndCheck = new JRadioButton("Set random order");
allWordsCheck = new JRadioButt... |
219a7f12-01f7-4d52-a54b-9b93bfe35d8b | 6 | private static <T> T showMenu(String menuName, List<T> options, Function<T, String> toString) {
while (true) {
try {
int selection;
System.out.println("*** " + menuName + " ***");
for (int i = 0; i < options.size(); ++i) {
System.out.println((i + 1) + ".) " + toString.apply(options.get(i)));
}... |
d15b33b6-f7f5-4f6c-b15f-142606f6707b | 2 | public void startTimer(){
Integer defaultTime = 120;
Timer timer = new Timer();
String timeString = timerText.getText();
int time = 5;
try {
time = Integer.parseInt(timeString);
} catch (NumberFormatException e){
JOptionPane.showMessageDialog(this,
"Bitte eine vern���������nftige Zahl angeben!")... |
4c19ddfc-ddc5-4144-b4a3-e2f4f23f2f22 | 5 | @Override
public void keyPressed(int key, char c) {
boolean tileWasMoved = false;
switch (key) {
case KEY_RIGHT:
tileWasMoved = gameBoardManipulator.moveRight();
break;
case KEY_LEFT:
tileWasMoved = gameBoardManipulator.moveLef... |
67c41248-53e7-40a0-bdcb-caea9cca851b | 4 | public static boolean isReverse(String string1, String string2) {
/* not the same length */
if (string1.length() != string2.length()) {
return false;
}
if (string1.length() == 0 && string2.length() == 0) {
return true;
}
/* compare two substrings */
if (string1.charAt(0) == string2.charAt(string2.l... |
a550e661-7150-4c51-a35c-2e58f192361d | 7 | @Override
protected void checkingNorms()
{
for ( Action action : getAllActions().values() )
action.setNormType(null);
for( Belief belief : getAllBeliefs().values() )
belief.setNormType(null);
for( Norm norm : getAllRestrictNorms().values() )
{
getPlayer().addRestrictNorm(norm.getName(), norm);
... |
a27c4c2a-120e-484e-b6d8-d0b9ff9cf69f | 6 | public static void main(String[] args){
//given a CDC network, output a x-IA and a y-IA solution.
//get an input CDC network
//int type,n,i,j;
String inputFile = "input.csv";
String outputFile = "output.html";
BufferedReader br = null;
String line = "";
CDCNetwork aCDCNetwork = new CDCNetwork();
tr... |
50d322cb-a3a6-4d79-bc67-7bbc1a30436f | 4 | public static boolean edgeAdjacent(Tile a, Tile b) {
if (a.x == b.x) return a.y == b.y + 1 || a.y == b.y - 1 ;
if (a.y == b.y) return a.x == b.x + 1 || a.x == b.x - 1 ;
return false ;
} |
24e3506d-058a-4d06-93d1-5192d357bda6 | 1 | public static boolean isEnd(Point p) {
if (p.equals(_end)) {
return true;
}
return false;
} |
1291428b-4f61-454c-8aaa-cd8199fae2ce | 7 | 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://dow... |
4b265460-0c29-402a-9b34-9495d0ea229e | 0 | @BeforeClass
public static void setUpClass() {
} |
4e71615c-bcc2-4523-8e5b-8128009fefde | 5 | @Override
public E set(int index, E element) {
if (index < 0 || index > count) {
throw new IndexOutOfBoundsException();
}
Node<E> aux = null;
if (index < count / 2) {
aux = header.next;
for (int i = 0; i < index; i++) {
aux = aux.ne... |
f40d6c5b-a722-4b89-bdcf-8eae7b70904d | 0 | public void setSecret(BinaryDataType value) {
this.secret = value;
} |
75df5a68-6a0b-4499-9e73-362840f334d5 | 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) & issymmetric; i++) {
... |
ab581ed5-0023-4665-aec5-526288631d34 | 2 | public void testRemovePartialConverterSecurity() {
if (OLD_JDK) {
return;
}
try {
Policy.setPolicy(RESTRICT);
System.setSecurityManager(new SecurityManager());
ConverterManager.getInstance().removeInstantConverter(StringConverter.INSTANCE);
... |
c80a8557-3d05-45fd-b9fe-855caa94ddc6 | 7 | public void interact(Particle p) {
if (contains(p.rx, p.ry)) {
if (viscosity > Particle.ZERO) {
double dmp = MDModel.GF_CONVERSION_CONSTANT * viscosity / p.getMass();
p.fx -= dmp * p.vx;
p.fy -= dmp * p.vy;
}
if (reflection) {
if (p instanceof Atom) {
internalReflection((Atom) p);
}
... |
392f8e74-0d0c-4528-b321-27cbc4c8d97c | 4 | protected void takeDown() {
if(log.isLoggable(Logger.INFO))
log.log(Logger.INFO, "takeDown() WumpusAgent");
try {
if(log.isLoggable(Logger.INFO))
log.log(Logger.INFO, "DEregister game '" + WumpusConsts.GAME_SERVICE_TYPE + "'");
DFService.deregister(this, dfd);
} catch (FIPAException e)... |
975d4412-e8e6-4622-886e-4754573b61ca | 6 | public static final int getShadedColor(int color, int lightness, int flag) {
if (color == 65535) {
return 0;
}
if ((flag & 2) == 2) {
if (lightness < 0) {
lightness = 0;
} else if (lightness > 127) {
lightness = 127;
}
lightness = 127 - lightness;
return lightness;
}
lightness = ligh... |
2f3cba19-0570-474e-9269-0e17db767cd0 | 6 | @Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
switch (COLUMNS.values()[columnIndex]) {
case ID:
case CUSTOMER:
case CAR:
return false;
case FROM:
case TO:
case COST:
return true;
default:
throw new IllegalArgumentException("columnIndex");
}
} |
dfc67593-2d5f-4ea6-9707-7c34343d6745 | 6 | public int getDef(int npc) {
switch (npc) {
case 2627:
return 30;
case 2630:
return 50;
case 2631:
return 100;
case 2741:
return 150;
case 2743:
return 300;
case 2745:
return 500;
}
return 100;
} |
04d95822-89e3-419e-80ad-251b275fdd75 | 0 | public static void main(String[] args) {
PairManager
pman1 = new PairManager1(),
pman2 = new PairManager2();
testApproaches(pman1, pman2);
} |
c7fbdfb9-afbc-4cd6-8acc-23002bfdbf6b | 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... |
aab273f6-0f74-402a-a057-1c5272c43473 | 5 | public void addTokens(String... tks)
{
for (String tk : tks)
{
if (tk == null || tk.equalsIgnoreCase("") || tk.contains("\n") || this.tokens.contains(tk))
{
continue;
}
this.tokens.add(tk);
}
} |
e0f60e3f-352b-4a07-a305-1dfcc0cea4d5 | 7 | public float priorityFor(Actor actor) {
if (GameSettings.hardCore && ! hasNeeded()) return 0 ;
//
// Don't work on this outside your shift (or at least make it more
// casual.)
final int shift = venue.personnel.shiftFor(actor) ;
if (shift == Venue.OFF_DUTY) return 0 ;
if (shift == Venue.SE... |
fe4992c9-c94a-457e-8cae-10f55e7b44d6 | 9 | private void collision(){
Rectangle r1 = pika1.getBounds();
Rectangle r2 = pikaBall.getBounds();
Rectangle r4 = pika2.getBounds();
Line2D.Double leftLine = new Line2D.Double(0, 600, 410, 600);
Line2D.Double rightLine = new Line2D.Double(410, 600, 800, 600);
Line2D.Double leftStickLine = new Line2D.Double(40... |
0a8f41f2-65ae-4a96-8940-9224bad9fd61 | 6 | @EventHandler
public void SnowmanBlindness(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getsnowgolemConfig().getDouble("Snowman.... |
2ab4ccbd-2f71-4cd5-9f67-a85dbfe0df0a | 0 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
programmerThread.stop();
lastPane = buttonPanel;
hidePanels(lastPane);
}//GEN-LAST:event_jButton3ActionPerformed |
79d113aa-1ba0-4a37-9941-2e75dde0769b | 9 | public void init()
{
canvas = new MinecraftApplet$1(this);
boolean fullscreen = false;
if(getParameter("fullscreen") != null)
{
fullscreen = getParameter("fullscreen").equalsIgnoreCase("true");
}
minecraft = new Minecraft(canvas, this, getWidth(), getHeight(), fullscreen);
minecraft.host = getDocu... |
114025d2-2c5a-475a-b72f-3a8bba4c0b85 | 6 | public void menuTextCrypt() {
int choice;
do {
System.out.println("\n");
System.out.println("Text Cryption Menu");
System.out.println("Select Cryptology Type");
System.out.println("----------------------\n");
System.out.println("1 - Asymmetric... |
adfc4aff-2923-4b50-a8f9-461177ee2684 | 7 | private byte[] getHash(byte[] data, boolean nullData) {
int byteLen = data.length;
int intLen = ((byteLen + 9 + 63) / 64) * 16;
byte[] bytes = new byte[intLen * 4];
System.arraycopy(data, 0, bytes, 0, byteLen);
if (nullData) {
Arrays.fill(data, (byte) 0);
}
... |
908be225-03da-49f0-a759-292e25cf08b7 | 8 | public void onBlockPhysics(BlockPhysicsEvent e) {
if (e.isCancelled()) return;
CBlock conBlock = parent.getControllerBlockFor(null, e.getBlock().getLocation(), null, true);
if (conBlock == null) return;
if (conBlock.isBeingEdited()) {
// Scheduled event should normally do this for us
if (!parent.blockPhys... |
bf656a2a-c2d9-4b10-8a5d-a8cdae9afa03 | 5 | @EventHandler(priority = EventPriority.HIGHEST)
public void onStop(PlayerCommandPreprocessEvent event) {
if((event.getMessage().equalsIgnoreCase("/stop") || event.getMessage().equalsIgnoreCase("stop")) && event.getPlayer().isOp()) {
plugin.getLogger().info(ChatColor.AQUA + "Server is stopping, sync everyone's inv... |
9635dd20-d4f9-45d1-8d60-e9078d940096 | 8 | public String treeToString(int level) {
int i;
StringBuffer text = new StringBuffer();
if (!m_isLeaf) {
text.append("\n");
for (i = 1; i <= level; i++) {
text.append("| ");
}
if (m_instances.attribute(m_splitAtt).name().charAt(0) != '[') {
text.append(m_instances.attribute(... |
9f359ac2-0646-49d1-8ea6-31208aa3b5ac | 1 | public void testGetInstantConverterRemovedNull() {
try {
ConverterManager.getInstance().removeInstantConverter(NullConverter.INSTANCE);
try {
ConverterManager.getInstance().getInstantConverter(null);
fail();
} catch (IllegalArgumentException ex... |
b67d0632-3f3e-4839-99bd-54bca5991f34 | 2 | public void printDungeon() {
for (int i = 0; i < dungeon.length; i++) {
for (int j = 0; j < dungeon[0].length; j++) {
System.out.print(dungeon[i][j].getGlyph());
}
System.out.println();
}
} |
25a4b32f-39dc-496f-8588-a26a52b2811b | 3 | @Override
public void render(GameContainer gc, Graphics g) throws SlickException {
g.setBackground(new Color(20, 20, 20));
g.setColor(new Color(230, 230, 230));
g.setAntiAlias(true);
switch (state) {
default:
case MENU:
menu.render(gc, g);
break;
case PAUSED:
break;
case PLAYING:
... |
48b8c642-8602-46d6-aed9-9b5f965980cb | 4 | private void fillCities(List<City> cities, AbstractDao dao) throws DaoException {
if (cities != null) {
for (City city : cities) {
Criteria descCrit = new Criteria();
descCrit.addParam(DAO_ID_DESCRIPTION, city.getDescription().getIdDescription());
List... |
e21288c2-3c6e-4ea5-85b1-1442943265a9 | 9 | public MelhorRotaDTO encontrarMelhorRota() throws NenhumaRotaEncontradaException {
procurarRotas();
List<Rota> melhorRotaEncontrada = null;
Integer distanciaMenorRotaEncontrada = null;
for (List<Rota> list : rotasEncontradas) {
int index = 1;
Integer distanciaDestaRota = 0;
for (Rota rota : list) {... |
5bf17085-3ea9-4f47-b425-0cc476711813 | 4 | public float[] toAngles(float[] angles) {
if (angles == null)
angles = new float[3];
else if (angles.length != 3)
throw new IllegalArgumentException("Angles array must have three elements");
float sqw = w * w;
float sqx = x * x;
float sqy = y * y;
float sqz = z * z;
float unit = sqx + sqy + sqz + s... |
faebdccf-606c-4d92-896c-c19e2005d637 | 0 | public CloseWindowAction(EnvironmentFrame frame) {
super("Close", null);
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_W,
MAIN_MENU_MASK));
this.frame = frame;
} |
13de9718-aeb4-4dd2-b85f-e2a5c2c07e0a | 9 | public static void evalStates(BoolExpTree tree)
{
LinkedHashSet<String> table = tree.getTable();
boolean sat = false; // satisfiability
boolean fal = false; // falseability
printTable(table);
System.out.println();
for(int i = 0; i < Math.pow(2, table.size()); i++)
{
HashMap<String, Boolean> state = U... |
38e1fa4f-fdee-4cde-9cec-06d9baa2a13c | 0 | public static void main(String args[]){
play();
} |
bb6fab7a-cd1f-49f1-bc94-d500e6367490 | 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 s... |
a050a03c-f267-4615-b00b-a4906837c699 | 5 | public void saveRanking(String player){
if( player == null || player.equals(""))
player = "无名";
int score = Game.enemy_killed * 100 + Game.propScore ;
PreparedStatement pstmt = null ;
try{
pstmt = ConnectionUtil.getInstance().prepareStatement(""
+ "insert into t_ranking(id, player, score, stage, tim... |
7c2afcd2-8b10-4a66-8527-6072501e3ca3 | 9 | public TreeRow selectDown(boolean extend) {
TreeRow scrollTo = null;
if (mRoot.getChildCount() > 0) {
int count = mSelectedRows.size();
if (extend && count > 0) {
scrollTo = getFirstSelectedRow();
if (scrollTo == mAnchorRow) {
scrollTo = getAfterLastSelectedRow();
if (scrollTo != null) {
... |
2d61dcc8-fbb2-43dd-ac45-22ec396a9c03 | 6 | public boolean existsConnection(Neuron other){
for(int i=0;i<outputs.size();i++)
if(outputs.get(i).getGiveNeuron()==other||outputs.get(i).getRecieveNeuron()==other)
return true;
for(int i=0;i<inputs.size();i++)
if(inputs.get(i).getGiveNeuron()==other||inputs.get(i... |
bb06d82a-0ae9-41e2-a922-b0bc51e7a11a | 8 | public Tabla(ArrayList<Computador> computadores, Encuesta encuesta) {
this.encuesta=encuesta;
String[] nombres = {"Marca", "Disco Duro", "Procesador", "RAM", "GPU", "Valor"};
String [][] data = new String[computadores.size()][6];
initComponents();
for (int i = 0; i < dat... |
b9b96417-31d7-4621-a0bf-d276a289680f | 0 | protected Stage getStage() {
return this.stage;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.