method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9d07edaa-0c43-4201-aab6-637e1b62cad1 | 1 | @Override
public void onDisable() {
// plugin disable stuff
getLogger().info("CreeperWarning is disabled!");
for (Player p : Bukkit.getOnlinePlayers()){
pds.editDataLevel(p.getName(), WarnLevel.getPoints(p));
}
} |
ea7edb5f-a75d-4d43-a416-845196cf7d72 | 5 | public void paint(GC gc, int width, int height) {
if (!example.checkAdvancedGraphics()) return;
Device device = gc.getDevice();
Pattern pattern = null;
if (background.getBgColor1() != null) {
gc.setBackground(background.getBgColor1());
} else if (background.getBgImage() != null) {
pattern = new Pattern(device... |
7426450e-cbae-4c4e-aa6c-db813aa1f70e | 0 | @Test
public void cannotGetWord_whenGettingSubstringOfExistingWord() {
trie.add("abc");
assertFalse(trie.contains("ab"));
} |
19ae54a5-bb2d-41c6-a463-5164f4fe73c2 | 7 | private void renderBehavior(int glMode, RenderStyle drawType, Behavior<?> behavior, boolean preMorphRendering) {
BehaviorRenderer<?> behaviorRenderer = behaviorRenderersMap.get(behavior.getClass());
if (behavior.getState() == State.ACTIVE || behaviorRenderer != null && (behaviorRenderer.isActive() || behaviorRender... |
2ab88f97-7bd6-42b6-a9a1-9148dc91a771 | 0 | public void setFaultCode(String faultCode) {
this.faultCode = faultCode;
} |
5d9f6dfa-4f6b-46ca-8629-e146fef50ab2 | 2 | public byte getMaximumDifference_as_byte(){
byte diff = (byte) 0;
if(this.type==10 || this.type==11){
byte max = this.getMaximum_as_byte();
byte min = this.getMinimum_as_byte();
diff = (byte)(max - min);
}
else{
throw new IllegalArgumentExc... |
e8c81a67-4f72-492a-bde5-18d134a25aa1 | 8 | public static List<Poi> loadFromRdfFile(File rdfFile){
List<Poi> poiList = new ArrayList<Poi>();
BasicConfigurator.configure();
try {
BufferedReader br = new BufferedReader(new FileReader(rdfFile));
char delimiter = '\t';
for (String line = br.readLine(); line != null; line = br.readLine()) {
i... |
e3f2e925-bbf8-4980-86cb-4f0ddc511020 | 1 | public static NormalDistributedStochasticLotsizingProblem generate(
int T, double firstMean, double lastMean, double cv,
double setupCost, double inventoryHoldingCost,
float alpha, AbstractNormalLikeOrdersGenerator orderGenerator){
//Calculate the step for the mean
double step = (lastMean-firstMean)/(T-... |
d86549e3-c345-4904-95a1-de731ed1da42 | 8 | private static String[] getPathStrings(String commaSeparatedPaths) {
int length = commaSeparatedPaths.length();
int curlyOpen = 0;
int pathStart = 0;
boolean globPattern = false;
List<String> pathStrings = new ArrayList<String>();
for (int i = 0; i < length; i++) {
... |
470cd0d3-17ff-4a69-b7fc-ec5bb86655d6 | 9 | public boolean travel(int startX, int startY) {
// 当前出口的位置集
Point[] nexts;
// 记录每个出口的可用出口個數
int[] exits;
//当前位置
Point current = new Point(startX, startY);
board[current.x][current.y] = 1;
//当前步的编号
for(int m = 2; m <= Math.pow(board.length, 2);... |
9640cce2-e2c3-42d1-aafb-fe804df2ed21 | 3 | private TreeNode findNodeInTaskTrees(Object nodeDatum) {
if (taskTrees == null) {
return null;
}
TreeNode node = null;
for (Iterator iter = taskTrees.iterator(); iter.hasNext(); ) {
Tree nextTree = (Tree)iter.next();
node = Tree.findNode(nextTree, nodeDatum);
if (node instanceof ... |
003c676e-28bf-4299-bea4-2833b6b58ccb | 8 | private List<Result> ComputeAdvance(String movieId)
{
System.out.println("ComputeAdvance");
ArrayList<Result> a = new ArrayList<Result>();
for(String movieY : _mapMovies.keySet())
{
if(movieY.equals(movieId) == false)
{
Movie y = _mapMovies.get(movieY);
Map<String,User... |
b77d2dd0-d7d6-41c4-a694-4cce439712da | 2 | void eulerLoopPath(int[][] graph, int start, List<Integer> path) {
for (int i = 0; i < graph.length; i++) {
if (graph[start][i] > 0) {
graph[start][i]--;
graph[i][start]--;
eulerLoopPath(graph, i, path);
}
}
path.add(start);
} |
3ba3fb23-2fcb-4c7d-8e76-ab88e9d865de | 2 | public static void main(String[] args) {
if (args == null || args.length == 0) {
server = ServerFactory.getServer();
server.start();
}
else {
String webAppDir = args[1];
int port = Integer.parseInt(args[2]);
String context = args[3];
int scanIntervalSeconds = Integer.parseInt(args[4]);
serve... |
e65bbf4b-6698-4a7d-9ff0-09132246a3a4 | 1 | @Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (isSelected) {
c.setBackground(Color.RED);
}... |
87b0f28a-f744-4c4d-b389-4f6bbfbd8efa | 2 | public boolean creationFichier(ObjectInputStream input, ObjectOutputStream output) throws IOException
{
String dir = input.readUTF();
String[] tab = dir.split("/\\\\");
File parent = root;
for (String child : tab)
parent = new File(parent,child);
... |
a0a17eee-85f1-4fce-86cd-66c7d8b3df92 | 1 | public void refreshScale() {
if(scale != 1.0)
this.setIcon(new ImageIcon(bi.getScaledInstance((int)(size.width*scale), (int)(size.height*scale), Image.SCALE_SMOOTH)));
else
this.setIcon(new ImageIcon(bi));
this.validate();
} |
22983cf0-540e-4b5b-952b-badcd7b78142 | 5 | private void updateShots2() {
for (int i = 0; i < shotList2.size(); i++ ) {
Shot shot = shotList2.get(i);
shot.Update();
Rectangle shotRectangle = new Rectangle(shot.x, shot.y, shot.shotWidth, shot.shotHeight);
if (tank.tankArea.intersects(shotRectangle)) {
... |
084d677a-ad56-4697-a22a-8311d3d7f680 | 0 | public AlgorithmParametersType.ChallengeFormat getChallengeFormat() {
return challengeFormat;
} |
0c0bcbf1-7e6c-4722-9177-9263ea998e35 | 2 | public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
DataAccessExecutor executor = EXECUTOR_CACHE.get(method);
if (executor != null) {
return executor.execute(obj, args);
} else {
if(LOGGER.isDebugEnabled()) {
LOGGER.debug("方法[" + method + "]无对应的DataAcc... |
48bee8dd-1cc3-4399-b7be-d93b71c7b597 | 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 ht... |
52532814-e8f9-44d4-8485-495cf662a2ef | 1 | public static ImageIcon getImageIcon(String name)
{
Toolkit toolkit = Toolkit.getDefaultToolkit();
URL url;
/*if (hashtable.containsKey(name) == true)
return (ImageIcon) hashtable.get(name);
ImageIcon icon = new ImageIcon(toolkit.getImage(AnalyseFrame.class.getResour... |
d53f8c52-3e65-4407-9830-2c85f0ad59b3 | 4 | private StaticSprite(Owner owner, Resource res, Message sdt) {
super(owner, res, sdt);
Collection<Part> f = new LinkedList<Part>();
boolean[] flags = decflags(sdt);
for(Resource.Image img : res.layers(Resource.imgc)) {
if((img.id < 0) || ((flags.length > img.id) && flags[img.id]))
f.add(new ImagePart(img));
... |
17debc76-8a78-4171-ad28-cd5329787566 | 9 | void storeInit() {
localstorefile = getConfigPath(eng.getClass().getName()+".store");
if (localstorefile==null) return;
try {
BufferedReader reader;
try {
File file = new File(localstorefile);
// do nothing if file does not yet exist
if (!file.exists()) return;
reader = new BufferedReader(ne... |
30c22875-20a1-4488-9f49-0e3798d05435 | 0 | public void open() {
setVisible(true);
} |
fdac504e-0d45-46ed-b606-ed94c0f63ac5 | 0 | @Override
protected void configure() {
bind(HadoopContext.class).to(UbuntuHomeHadoopContext.class);
} |
8698b21b-ca56-4436-8f43-c16300717b80 | 4 | private void checkState()
{
boolean state = false ;
String str = nameField.getText() ;
if (str != null)
{
if (str.length() > 0) // nameField ok
{
str = pathField.getText() ;
if (str != null)
{
if (str.length() > 0) // pathField ok
{
... |
99d668a4-ebf0-4d0d-8fc5-e91d36cdc5e4 | 2 | * StackManipStmt.DUP_X1)
*
* @see StackManipStmt
*/
private void manip(final StackExpr[] source, final int[] s, final int kind) {
Assert.isTrue(Tree.USE_STACK);
int height = 0; // Height of the stack
// Calculate current height of the stack. Recall that the stack
// elements in source have ... |
a3a402eb-ba5e-42ef-bda7-09b558799069 | 4 | public boolean checkWin() {
int x, y;
x = 0;
while (x < 10) {
y = 0;
while (y < 10) {
if (!field[x][y].checkForBomb() && !field[x][y].checkOpen())
return false;
y++;
}
x++;
}
return true;
} |
81fca0dd-f257-46ee-831c-33976274e761 | 6 | static final void method527(Frame frame, Signlink class297, boolean bool) {
try {
anInt1020++;
for (;;) {
SignlinkRequest class144 = class297.method2248((byte) 89, frame);
while ((class144.state ^ 0xffffffff) == -1)
Class286_Sub5.method2161((byte) -124, 10L);
if ((class144.state ^ 0xffffffff) == ... |
ef65ab3e-113a-4a18-b526-80f5a7e4c881 | 9 | private static void improved_range_search(finger_print fp, double dis,
Data data) {
//System.out.println(fp.id);
ArrayList<Integer> lst1 = new ArrayList<Integer>();
HashMap<Integer, Integer> potent = new HashMap<Integer, Integer>();
ArrayList<Integer> lst2 = new ArrayList<Integer>();
// to be commented
//... |
e1423e15-e2d8-4bef-96dd-0b98020c7e66 | 2 | public static void iterateOverADirectoryWithoutPreloadingItsContentIntoMemory() {
// ConcurrentModificationException is not thrown
// we should not rely on the behaviour when one or more files are created during the execution
try (DirectoryStream<Path> ds = Files.newDirectoryStream(Paths.get("/h... |
868c39f4-dda8-4812-a8bc-60d732d9db49 | 2 | public Color[] getColorArray(String id) {
List<Color> color_list = new ArrayList<Color>();
Color[] color_array;
Color color;
for(int i=0;i<identity.size();i++) {
if(identity.get(i).contains(id)) {
color = colors.get(i)[0];
color_list.add(color);
}
}
color_arra... |
39ce64bb-6702-4fa2-aa4e-9f5035c910e5 | 5 | public HowOldAreYou(){
Scanner keyboard = new Scanner(System.in);
String cantDrive = "You can't drive.";
String canDriveNotVote ="You can drive but not vote.";
String VoteButNoRentCar = "You can vote but not rent a car.";
String youCanDoAnything = "You can do pretty much anything.";
String name;
i... |
d4f60a51-7ccf-4a7e-9e42-396470227cc4 | 0 | @Override
public void keyReleased(KeyEvent e)
{
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} |
ec796101-34b3-4973-8c57-727f2d01718e | 5 | public void validateModel() {
for (TVC c : connectionsSortedUp) {
if (!c.validate()) {
throw new RuntimeException("Validation failed: connection is managed by wrong firewall, c=" + c);
}
int managedFw = c.getManagerFirewallId();
for (Firewall fw : firewalls) {
if (fw.getId()... |
edb4aa8e-1368-4cb5-8528-7d6383fa85d3 | 2 | private void bubbleUp(int pos) {
Integer parentPos = parent(pos);
if (parentPos != null && swapIfFirstIsLess(parentPos, pos)) {
bubbleUp(parentPos);
}
} |
09ac1a16-0159-4387-be6c-381c916b3e4f | 6 | public synchronized void agree(String x){
int r = 0;
int m = 0;
int n = getNo();
while( true) {
r++;
int c = ( r % n) + 1;
unicast(new Message(pid,c,VAL,x+SEP+r));
if ( pid == c ) {
String v = handleRecv();
continue;
//the d thing is done in handleRecv
}
Cont cont =... |
124c2afe-49bc-45a9-88d0-fd372eeb1aad | 4 | public boolean installForLinux() {
boolean result = false;
File installer = extractInstaller();
if(installer!=null) {
if(label!=null) {
label.setText("<html>Installing driver...");
}
if(installer!=null) {
try {
... |
ad6d9c37-974a-40eb-ac57-a3031029ddff | 6 | private boolean isPositionClear(int par1, int par2, int par3, int par4, int par5, int par6, Vec3D par7Vec3D, double par8, double par10)
{
for (int var12 = par1; var12 < par1 + par4; ++var12)
{
for (int var13 = par2; var13 < par2 + par5; ++var13)
{
for (int var... |
99843514-eafc-4154-aa14-a50879554927 | 2 | public void dbConnect(String db_connect_string,
String db_userid,
String db_password) {
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection conn = DriverManager.getConnection(db_connect_string, db_userid, db_password);
System.out.println(... |
5b0202de-77c1-4476-8452-89cea789922a | 6 | private void playSound(String fileName)
{
File soundFile = new File(fileName);
AudioInputStream audioInputStream = null;
try
{
audioInputStream = AudioSystem.getAudioInputStream(soundFile);
}
... |
5ec4184a-c9c6-45ca-8737-338d039bc37e | 2 | private void initMove( int x, int y ){
site.triggered();
for( MoveableCapability item : site.getCapabilities() ){
if( item.isMovingEnabledAt( x, y )){
items.add( item );
item.startMoveAt( x, y );
}
}
moving = true;
} |
526f7ebc-02cc-41fe-9b83-a17968f7b9e1 | 3 | private String[] getNamesForComboBox()
{
int realValues = 0;
for (int count = 0; count < baseController.getCubicleHipster().length; count++)
{
if (baseController.getCubicleHipster()[count] != null)
{
realValues++;
}
}
String[] tempNames = new String[realValues];
for (int realSize = 0; realS... |
e82a942c-9044-414d-bc71-d79ebcabde27 | 7 | public static void setzero(int[][] matrix){
boolean[] row= new boolean[matrix.length];
boolean[] column=new boolean[matrix[0].length];
//tag every position which has 0
for(int i=0;i<matrix.length;i++){
for(int j=0;j<matrix[0].length;j++){
if(matrix[i][j]==0){
row[i]=true;
column[j]=true;
... |
3c387414-e40c-4c38-b485-cde538340ab5 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
FunctionDefinition other = (FunctionDefinition) obj;
if (parameters == null) {
... |
301d4deb-e707-4f3a-955e-f21438dad52f | 2 | public int getPDef(){
int value = 0;
for (Armor armor : armorList) {
if(armor != null) value += armor.getStats().getpDef();
}
return value;
} |
a17bbcc7-63b0-4125-9566-19a3c3190a68 | 1 | @Override
public void update(Graphics g) {
if (image == null) {
image = createImage(this.getWidth(), this.getHeight());
second = image.getGraphics();
}
second.setColor(getBackground());
second.fillRect(0, 0, getWidth(), getHeight());
second.setColor(getForeground());
paint(second);
g.drawImage(im... |
58f67214-f5c1-4dd4-b71e-2841870cbdb4 | 7 | protected void mergeNextSmallSublists() {
if (smallSublistCount >= 2) {
CircularListInternal<T> small2 = sublists.remove(--smallSublistCount);
CircularListInternal<T> small1 = sublists.get(--smallSublistCount);
sublists.set(smallSublistCount,
merge(small1,
... |
ad00685c-0329-4e85-afa8-12332c67c708 | 7 | @Override
public synchronized void returnObject(T obj) throws Exception {
boolean success = !isClosed();
if(null != _factory) {
if(!_factory.validateObject(obj)) {
success = false;
} else {
try {
_factory.passivateObject(obj... |
efaf4a7b-5061-443d-bacf-16bc3beb7cfd | 9 | public int accessMemExcBufferCache(int smpIndexFrom, int numCPUFrom, int smpIndexTo, int numCPUTo, int startTime){
int n = getNumberSyncObjectsUntil(smpIndexTo);
SMPNodeConfig smpNodeCfg=Configuration.getInstance().smpNodeConfigs.get(smpIndexTo);
n+=1 + smpNodeCfg.cacheConfigsPT.size() +smpNodeCfg.cacheConfigsMem... |
2caecc46-5414-40ed-a930-cb865d0ca124 | 7 | public static void main(String[] args)
{
Connection conn = null;
Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
FileReader fr = null;
BufferedReader br = null;
String line = null;
Hashtable<Integer, RecPair> recs = n... |
09b8f261-09f1-46f9-ba53-1e49fda8bde6 | 3 | public void render(Screen screen) {
screen.blit(iconSprite, x, y, this);
if (player.quickInv[index] != null) {
//848484
screen.fill(x+1, y+1, 14, 14, 0x848484);
screen.blit(player.quickInv[index].icon, x, y, this);
//Art.itemSheet[0 + 0 * 10]
}
i... |
b03e1e3c-3862-40c7-8fc3-a1c15cab1160 | 7 | protected Junction split(Junction parent){
int halfPointers; //sets pointers to middle of this junction
if (this.pointers.size()%2 == 0)
halfPointers= this.pointers.size() - this.pointers.size()/2;
else
halfPointers= this.pointers.size() - this.pointers.size()/2 - 1;
int halfElements= this.elements.size... |
3b295719-7ddd-467a-8122-764d506e3b01 | 5 | @EventHandler
public void handleChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
User user = EdgeCoreAPI.userAPI().getUser(player.getName());
if (user != null) {
Cuboid cuboid = Cuboid.getCuboid(player.getLocation());
if (cuboid != null) {
if (cuboid.hasEvent... |
4fda40f2-2640-4bde-b8b1-756716445556 | 1 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Search frame = new Search();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} |
9bdca1de-7d95-4029-8473-1e830b3d3326 | 7 | private ArrayList<String[]> compareSets(ArrayList<String[]> setOne, ArrayList<String[]> setTwo, int checkingRound) {
int progress = 0;
boolean rowFound;
ArrayList<Integer> foundRecords = new ArrayList<Integer>();
ArrayList<String[]> disputes = new ArrayList<String[]>();
for(int i = 0; i < setOne.size(); i++) {... |
2607833f-4162-4dc6-8ef4-423f058e1d9f | 3 | private void renderEmptyGrid(Graphics2D graphics) {
int startPointGridXCoordinate = 150;
int startPointGridYCoordinate = 20;
List<Position> effectposlist = objectTron.getEffectPositions();
for (int i = 0; i < objectTron.getGridWidth(); i++) {
for (int j = 0; j < objectTron.getGridHeight(); j++) {
if (ef... |
05dc32a4-a9d2-4a54-b554-31bbfd74e99b | 3 | public static Connection getInstance(){
if(connection != null
&& Database.conectionIsValid(connection) == false) connection = null;
if(connection != null) return connection;
synchronized (Connector.class) {
return getConnection();
}
} |
c509d06d-be22-4497-a03f-330be5e4c686 | 4 | public static Class load(byte[] image) {
if (Debug.enabled)
Debug.check(image[10]==1,
"Attempt to load non-JEL generated class file");
// JEL generated class file never have UNICODE class name
// although they might reference UNICODE methods, etc...
int len=(image[11]<<8)... |
d205a5b6-11c0-4290-9f25-acc1e56d4cc9 | 9 | public void startReceivingData() {
headDataTimer.scheduleAtFixedRate(new TimerTask() {
private int lastYAW = 0;
// private float lastPitch = 0;
public void run() {
byte[] receiveData = new byte[1024];
DatagramPacket receivePacket = new DatagramPacket(receiveData,
receiveData.length);
tr... |
8d745126-9c86-4c56-808f-4248812ca912 | 7 | public ArrayList<Copy> getCopies() {
BookDAL objBookDAL = new BookDAL();
ArrayList<Book> listBooks = objBookDAL.getBooks();
ArrayList<Copy> copyList = new ArrayList();
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder ... |
f797f58e-8b14-49f9-a2ee-cdf256a8b946 | 1 | protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
//TODO implement logic to process data that client sent to server with POST method.
//It could include adding employee to repository,
//validating email, redirecting client to a page where emp... |
42a71113-f235-4c5e-9799-d1a4d928417f | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Room target=mob.location();
if(target==null)
return false;
if(target.fetchEffect(ID())!=null)
{
mob.tell(L("This place is already blighted."));
return false;
}
if(!super.invok... |
e2ced5c5-1c4b-4c76-b862-202860b36d04 | 6 | public void add(Message message) {
message.setId(null);
message.setCreatedAt(new Date());
try {
utx.begin();
} catch (NotSupportedException e) {
e.printStackTrace();
} catch (SystemException e) {
e.printStackTrace();
}
em.pers... |
c96c9961-4dd2-411b-b5aa-9fcd63f51ab7 | 6 | public void loadGroupsAndPlayers(){
FileInputStream fi = null;
BufferedReader br = null;
try {
fi = new FileInputStream(new File(this.playersDataFilePath));
br = new BufferedReader(new InputStreamReader(fi));
String line = br.readLine();
loadGroups... |
7c8b93f0-6ee7-4e08-8d63-a7d932454dd4 | 2 | public void shootAtShips(BaseView v) {
AlienShipModel m = (AlienShipModel)v.model;
double tx, ty;
if (player2 != null) {
if (Math.random() > 0.5) {
tx = player1.getX();
ty = player1.getY();
} else {
tx = player2.getX();
ty = player2.getY();
}
} else {
tx = player1.getX();
ty = player1... |
fbb7ab2c-110b-4b2d-bdaa-f11779594fff | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Tag)) return false;
Tag tag = (Tag) o;
if (lastPurchase != null ? !lastPurchase.equals(tag.lastPurchase) : tag.lastPurchase != null)
return false;
if (timestamp != null ? ... |
094ca3c3-5e06-4711-b8df-7067604ff15e | 3 | protected TreeNode<E> findNode(E target, TreeNode<E> current) {
if(current == null) return null;
else if(current.value.compareTo(target) < 0)
return findNode(target, current.getRightTree());
else if(current.value.compareTo(target) > 0)
return findNode(target, current.getLeftTree());
else
return curren... |
3f82f9ed-aeea-4e2a-91fe-53185ebf8c5c | 8 | private void addStep(double startPrice, double endPrice, double fixedPrice, double variablePricePercent) {
if (billingServerSecure == null) {
System.out.println("ERROR: You are currently not logged in");
} // Checking for positive interval range
else if (endPrice != 0 && startPrice >= endPrice) {
System.out... |
73728993-512e-411e-92d5-db5ad68ba958 | 8 | public void insertSorted(double distance, Instance bag, int position) {
if (isEmpty()) {
mFirst = mLast = new NeighborNode(distance, bag, position);
} else {
NeighborNode current = mFirst;
if (distance < mFirst.mDistance) {// Insert at head
mFirst = new NeighborNode(distan... |
28d884d0-c135-4b3d-aba0-6776b83b888e | 3 | private void shoot() {
if (m.clicked && t.Ring() && mana > 5) {
new Energy((int) x + 24, (int) y + 24, m.getX() + getOffset()[0] - 8, m.getY() + getOffset()[1] - 8, world, game, lvl,true);
mana -= 5;
t.reset();
}
} |
5e190fad-5d74-4244-afbd-408e189d7435 | 3 | public void destroyFood(Food item){
synchronized(lock_food){
ListIterator<Food> iter = food_list.listIterator();
Food kill = null;
while(iter.hasNext()){
Food temp = iter.next();
if(temp.equals(item)){
kill = item;
break;
}
}
if (kill != null){
food_list.remove(kill);
}
}... |
f4a1aa82-638f-4f7a-bb79-b9322dec60fa | 3 | public static int[] getUnicodeValues(String glyphName) {
while (glyphLoaderThread != null && glyphLoaderThread.isAlive()) {
synchronized (glyphToUnicodes) {
try {
glyphToUnicodes.wait(250);
} catch (InterruptedException ex) {
//... |
d0239222-d5e0-466b-9d61-1374b6fef471 | 1 | @Test
public void hello() {
List<PersonService> person = new ArrayList<PersonService>();
person.add(new PersonServiceImpl());
person.add(new Librarian());
person.add(new Owner());
for(PersonService p : person)
p.name(null);
Assert.assertNotNull(pe... |
c8d48ce3-1dba-4880-80cd-a42bc26c398e | 1 | public void initializeArray(){
for(int ii=0;ii<36;ii++){
int[] array = new int[6];
array[0]=-1;//raum vorhanden 1=ja /-1=nein
array[1]=-1;//freie nachbarn 1=ja /-1=nein
array[2]=-1;//obere tuer
array[3]=-1;//rechte tuer
array[4]=-1;//untere tuer
array[5]=-1;//linke tuer
map.put(ii, array);
... |
f417a16d-e22c-486c-898f-33ffaea3523d | 1 | public Contexto loadSession(Contexto oContexto) {
oContexto.setHaySesion(request.getSession().getAttribute("usuarioBean") != null);
if (oContexto.getHaySesion()) {
oContexto.setUserBeanSession((UsuarioBean) request.getSession().getAttribute("usuarioBean"));
} else {
oCont... |
af9a91e5-e3cd-4c3f-b4e6-481132c13818 | 9 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
ccbd0248-f74d-401e-81b1-ac50361969bd | 1 | public boolean indexIsOutOfBounds(int index) {
return index < 0 || index >= boardArray.length;
} |
dc4c1e3c-786b-49b6-bccd-4b50f21af3ac | 9 | public void sendBuilder(DataBuilder b, InetAddress destination){
PacketBuilder pb = new PacketBuilder();
pb.setSourceAddress(this.iface_addr);
pb.setDestinationAddress(destination);
pb.setDataType(b.getDataType());
pb.setData(b);
if(Datatype.getDataTypeAsInt(b.getDataTyp... |
221abb1f-45e2-4cf9-83ff-08eb4c51f69e | 3 | public void EliminaInicio()
{
if ( VaciaLista())
System.out.println ("No hay elementos");
else
{
if (PrimerNodo.siguiente==PrimerNodo)
PrimerNodo = null;
else
{
PrimerNodo = PrimerNodo.siguiente;
NodosProcesos Aux = PrimerNodo;
while (Aux.siguiente!=PrimerNodo)
Au... |
0199900c-f0b0-4379-bfda-3ef3a15695a6 | 7 | public void parse(File f) {
try {
String manifestDir=f.getParent();
Document doc=XML.docBuilder.parse(f);
Element root=doc.getDocumentElement();
if(root.getTagName().equals("manifest")) {
NodeList moduleMap=XML.getElements(root,XML.xp_mf_modulemap)... |
14f9e275-d066-4b08-a713-a9df4cb2f78a | 8 | private int jjMoveStringLiteralDfa2_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(0, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(1, active0);
return 2;
}
switch(curChar)
{
case 97:
... |
2744f32c-02b1-47d7-8700-1942b2ad3188 | 9 | void requestCompleted(QueryHandle qryh)
{
activereqs.remove(qryh);
if (qryh.qtype == Resolver.QTYPE_PTR) {
pendingdoms_ptr.remove(qryh.qip);
} else if (qryh.qtype == Resolver.QTYPE_NS) {
pendingdoms_ns.remove(qryh.qname);
} else if (qryh.qtype == Resolver.QTYPE_MX) {
pendingdoms_mx.remove(qryh.qname);... |
3464937c-bae2-4257-84a7-34cec6bd977f | 8 | protected void cloneFix(Item I)
{
destroyed=false;
me=this;
basePhyStats=(PhyStats)I.basePhyStats().copyOf();
phyStats=(PhyStats)I.phyStats().copyOf();
affectPhyStats = new ApplyAffectPhyStats(this);
affects=null;
behaviors=null;
scripts=null;
for(final Enumeration<Behavior> e=I.behaviors();e.has... |
cf8fdba3-4d5b-42b4-ae68-70121ccacbb3 | 3 | private void rebuildUI(Class<?> name) {
inputPane.removeAll();
text.clear();
textField.clear();
field = name.getDeclaredFields();
for (int i = 0; i < field.length; i++) {
if (!hiddenField(field[i].getName().toString())) {
text.add(new JLabel(field[i].getName().toString()));
text.get(text.size() - ... |
643a99ab-e649-435c-abd2-39d4954951d6 | 0 | @Test
public void testTurn() throws IOException {
System.out.println("turn");
AntBrain b = new AntBrain("cleverbrain1.brain");
Ant instance = new Ant(b,true,0);
Turn.direction dir = Turn.dirFromString("left");
int expResult = 5;
int result = instance... |
0ae448ab-0d6a-4e18-a49f-6c422d86b8a1 | 5 | void processGeometry(RsWall wall) throws RsParsingException {
double [] a = processRealSpec();
if(a==null || a.length!=5)
throw reader.gripe("Invalid number of parameters in geometry specification");
RsUnits units=wall.plan.getUnits();
for(int i=0; i<5; i++)
a[i] = units.use... |
259ec465-51dc-4592-9106-d538bf98690a | 1 | public static ImageIcon loadIcon(String spriteFilename) {
try {
return new ImageIcon(ImageIO.read(new File("Resources/Icons/" + spriteFilename)));
} catch (IOException e) {
System.out.println("File not found");
e.printStackTrace();
}
return null;
} |
fd51af0f-2143-4903-bee4-41deb800fba0 | 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... |
37249c37-5ade-4c3e-92f5-6fbb7d8bec6a | 8 | private void expand1(byte[] src, byte[] dst) {
for(int i=1,n=dst.length ; i<n ; i+=8) {
int val = src[1 + (i >> 3)] & 255;
switch(n-i) {
default: dst[i+7] = (byte)((val ) & 1);
case 7: dst[i+6] = (byte)((val >> 1) & 1);
case 6: dst[i+... |
0908432c-0d26-4146-a3ff-46d69a9b7fe5 | 4 | @Override
public void run()
{
while( true )
{
System.out.println("waiting for server connection");
try
{
serverConnection = serverState.accept();
}
catch( Exception ex )
{
ex.printStackTrace();
}
try
{
in = new BufferedReader( new InputStreamReader( serverConnection.
g... |
56386e77-a20a-46bc-91c3-346f7960885b | 0 | UnicodeInputStream(InputStream in, String defaultEnc) {
internalIn = new PushbackInputStream(in, BOM_SIZE);
this.defaultEnc = defaultEnc;
} |
9e1237c8-a8dd-4dc5-9c1c-d6ae643cb172 | 3 | private void jSlide2MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jSlide2MouseReleased
ASCII_Tiles t = new ASCII_Tiles();
try
{
setT2_slider_position(jSlide2.getValue()); //Slider position minus one for array compatibility
int tilePairsPlus1 = j... |
fbd1ab0e-ea92-450f-bcb2-b0ea4a590ffa | 8 | private void advance() throws IOException {
next = null;
while((next==null)&&(null!=rdr)) {
final String line = rdr.readLine();
if(null==line) {
rdr.close();
rdr = null;
} else {
if(line.trim().length()>0) {
final Map<String,Object> map = new LinkedHashMap<String,Object>(... |
fa9d578f-76f0-4b63-a465-215066c7a1b9 | 3 | public boolean has(Class<? extends Element> type ){
Iterator<Element> it = this.elements.iterator();
while( it.hasNext() ){
Element ele = it.next();
if( type.isInstance(ele) )
return true;
}
return false;
} |
208e2aae-a505-4f2d-b1fc-1691bc13243b | 5 | @Override
public void actionOnPChoice(int choice, int player) {
switch(choice){
case PlayersChoices.REMOVE_SHIP :
territories[getPlaceOnTrack(player)].getTroup().rmToop(1, 0, 0, 0);
units[getPlaceOnTrack(player)]--;
break;
case PlayersChoices.REMOVE_FOOT :
territories[getPlaceOnTrack(player)].getTrou... |
929b86d3-93a6-4e00-ae29-da0cead90a3e | 0 | private OperatingSystemType(int value) {
this.value = value;
} |
f6758974-6fb9-4a82-8346-227a08f43cdf | 6 | public static int pressureUnitStringToIndex(String unit) {
switch (unit) {
case "hPa":
return 0;
case "kPa":
return 1;
case "psi":
return 2;
case "bar":
return 3;
case "millibar":
... |
19eb133b-fb78-4564-9f37-d0a2baf731df | 4 | public void loadModel(String filename)
{
if(!loadedMeshes.containsKey(filename))
{
HashMap<String, Object> modelData = ColladaLoader.load(filename);
//HACK
if(filename.equals("temp/two.dae")){
Game.skeleton = (Skeleton)modelData.get("skeleton");
Game.animation = (Animation)modelData.get("anim... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.