method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f24f8aa4-8699-4c6b-8f24-2646bc242e27 | 1 | @Test
public void insertTest() {
for (int i = 1; i < 9; i++) {
System.out.println("");
printTime(testJavaLinkedListInserts(10000 * (int) Math.pow(2, i)));
printTime(testDoublyLinkedListInserts(10000 * (int) Math.pow(2, i)));
}
} |
2792ef30-6788-4b6a-b43d-006b9ed5d37d | 1 | public Node AddOrGetNode(String v) {
Node newNode = new Node(v);
if (!nodes.containsKey(v)) {
nodes.put(v, newNode);
return newNode;
} else {
return nodes.get(v);
}
} |
beeac9c2-102b-474e-bcfb-d9923277df6c | 1 | public Model(AnimatorBuilder builder, TimeServer t) {
if (builder == null) {
builder = new NullAnimatorBuilder();
}
_ts = t;
_ts.addObserver(this);
setup(builder, t, MP.grid.getRow(), MP.grid.getColumn());
_animator = builder.getAnimator();
super.addObserver(_animator);
} |
ce5092ad-8360-4a6b-9ab2-88179725d44f | 4 | public void execute(Joueur jou){
jou.setPositionCourante(super.getMonopoly().getCarreau(caseDest));
if(this.getNumero() == 31){jou .setToursPrison(4);}
if(jou.getLiberationPrison()){
Scanner sc = new Scanner(System.in);
System.out.printf("Vous possédez une carte Libération de Pri... |
99f16f0d-f59d-4271-a4f9-5448dcc07d4f | 2 | /* */ public boolean multiverseInvEnabled()
/* */ {
/* 108 */ if ((getServer().getPluginManager().getPlugin("Multiverse-Inventories") != null) && (getServer().getPluginManager().getPlugin("Multiverse-Inventories").isEnabled()))
/* */ {
/* 110 */ return true;
/* */ }
/* */... |
1b7d0849-f064-4d0f-ad3d-94dfe28233c9 | 3 | public void run(){
running = true;
final int MAIN_PORT = 4714;
try {
ServerSocket mainServerSocket = new ServerSocket(MAIN_PORT);
ServerDataBaseManager sDBM = new ServerDataBaseManager();
while(true){
if(running){
new MainServerExecutionThread(mainServerSocket.accept(), sDBM).start();;
}
... |
c1dcb6f7-5252-45d4-a123-5d76abe1a0dc | 0 | public String getSubjects() {
return subjects;
} |
610af40f-0fc4-4cb7-b898-63ef256ac151 | 1 | public boolean getLocalSideEffects(int paramNr) {
return globalSideEffects || localSideEffects.get(paramNr);
} |
d0500cee-1921-4fdb-bbde-ca8c619e8bfe | 9 | public void onSerialByteReceived(byte byteValue){
if(byteValue == PREAMBLE){
rxFrame.position(0);
return;
}
if(byteValue == ESCAPE){
isLastByteEscape = true;
return;
}
if(isLastByteEscape){
byteValue = (byte) (byteValue ^ 0x20);
isLastByteEscape = false;
}
if(rxFrame.position()==0){
c... |
7d5bbb9b-7a97-4a4a-b39c-aaf13c3134fe | 3 | public String getProducer() {
Object value = library.getObject(entries, "Producer");
if (value != null && value instanceof StringObject) {
StringObject text = (StringObject) value;
return cleanString(text.getDecryptedLiteralString(securityManager));
}
else if (val... |
6813c3dd-b697-4ad5-b9e4-6ecf3374e770 | 5 | private void DecodeBinaryMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DecodeBinaryMenuItemActionPerformed
// TODO add your handling code here:
try {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ON... |
b3917deb-a60a-4b76-82cd-2e79fbcf40c9 | 5 | private String cipher_sub(HashMap<Character,String> map1, HashMap<String,Character> map2,String sub_s)
{
char[][] code=new char[3][sub_s.length()];
for(int i=0;i<sub_s.length();i++)
{
Character c=Character.valueOf(sub_s.charAt(i));
String num_str=map1.get(c);
for(int j=0;j<3;j++)
{
... |
5662b5e3-ec75-4319-9429-1671ba612ab4 | 2 | public static boolean isEnglish(String str) {
for (char c : str.toCharArray()) {
if (!CharUtils.isEnglishLetter(c)) {
return false;
}
}
return true;
} |
71a6be41-a729-468d-a50e-e80a10be8b88 | 1 | public AttributeInfo copy(ConstPool newCp, Map classnames) {
int s = info.length;
byte[] srcInfo = info;
byte[] newInfo = new byte[s];
for (int i = 0; i < s; ++i)
newInfo[i] = srcInfo[i];
return new AttributeInfo(newCp, getName(), newInfo);
} |
d2c2b7fe-e69f-41b9-a6a1-7222ef6f207a | 0 | public String getEncoding() {
return encoding;
} |
9923b6c0-e66e-4ae3-ae58-bcf1ac85fc3a | 1 | public String updateBlogDetails() {
FacesMessage doneMessage = null;
String outcome = null;
Blog blog = new Blog();
blog.setBlogId(this.blogId);
blog.setBlogContent(this.blogContent);
blog.setBlogContentLable(this.blogLabel);
blog.setCreatedDate(this.blogCrea... |
b77b0d4e-481e-4b5d-b0bb-c80bf1843c23 | 1 | public void test_now_nullChronology() throws Throwable {
try {
DateTime.now((Chronology) null);
fail();
} catch (NullPointerException ex) {}
} |
35e06c35-5d82-4ffa-950b-cc1ef0277430 | 7 | private void removeStep(double startPrice, double endPrice) {
if (billingServerSecure == null) {
System.out.println("ERROR: You are currently not logged in");
} else {
try {
billingServerSecure.deletePriceStep(startPrice, endPrice);
System.out.println("Step [" + startPrice + " " + (endPrice == 0 ? "IN... |
b0e2e9aa-b952-478d-add9-ab0c2b25bdd1 | 5 | public <TEvent> void broadcast(TEvent event) throws InvocationTargetException, IllegalAccessException {
for(EventHandler eh : _subscriptions) {
ArrayList<SingleParameterMethodData> methods = getSingleParameterMethodData(eh.getUUID());
boolean calledAny = false;
if(methods !=... |
e274f6bf-b8e0-4749-afdb-99f1a6bcc48a | 7 | @Override
public boolean onCommand(CommandSender cs, Command cmd, String string,
String[] args) {
if (string.equalsIgnoreCase("setboomstick")) {
if (cs.isOp() || cs.hasPermission("explosionman.setboomstick")) {
if (args.length == 0) {
cs.sendMessage(ChatColor.RED + "The proper usage is "
+ Chat... |
5785c91c-69e1-45b6-8104-1753ebf02d60 | 9 | private void solveProbability(int x, int y , int num)
{
boxProbability[x][y].value = num+1;
boxProbability[x][y].isFinal = true;
for(int i=0;i<9;i++)
{
if((boxProbability[x][i].xpectedNum).size() !=1)
{
if((boxProbability[x][i].xpectedNum).contains(num+1))
{
(boxProbability[x][i].xpect... |
f0a9acc9-08c8-42d6-a58e-f31ca9be4998 | 9 | public void setBounds(Rectangle rect) {
int x = bounds.x, y = bounds.y;
boolean resize = (rect.width != bounds.width)
|| (rect.height != bounds.height), translate = (rect.x != x)
|| (rect.y != y);
if ((resize || translate) && isVisible())
erase();
if (translate) {
int dx = rect.x - x;
int dy ... |
daa52447-9a8c-4b84-8706-8ac140d8b56c | 5 | String readProperties(String configFileName) {
properties = new Properties();
try {
// Try to read properties file
File confFile = new File(configFileName);
if (Gpr.canRead(configFileName)) {
properties.load(new FileReader(confFile));
return configFileName;
}
// Build error message
String... |
5a05e7c6-5b2f-45e4-9183-9283ff5caebb | 2 | @Override
public void offerTrade(IPresenter presenter, ResourceHand offer,
int receiver) {
MoveResponse response = presenter.getProxy().offerTrade(presenter.getPlayerInfo().getIndex(), offer, receiver, presenter.getCookie());
if(response != null && response.isSuccessful()) {
//presenter.updateServerModel(... |
91dd5833-205b-40b1-8cce-35992438b749 | 1 | public static void expandAllSubheads(JoeTree tree) {
JoeNodeList nodeList = tree.getSelectedNodes();
for (int i = 0, limit = nodeList.size(); i < limit; i++) {
nodeList.get(i).ExpandAllSubheads();
}
tree.getDocument().panel.layout.redraw();
return;
} |
fb3925eb-f3f7-4510-ac05-ec88b9877177 | 0 | public void reInitJoystickHandler() {
joystickHandler = new ROJoystickHandler();
} |
44824e01-ea2d-41ea-a32c-fad811df6a1c | 7 | private int writeByteArray(BufferedWriter bw, int curAddress, int end) throws Throwable {
for(; rom.type[curAddress] == ROM.DATA_BYTEARRAY && curAddress < end; curAddress += rom.width[curAddress]) {
addLabel(bw, curAddress);
String dataString = "";
for (int i = 0; i < rom.width[curAddress]; i++) {
if (i... |
a22c5f17-2018-4e1f-9247-0c4fe2965e3f | 1 | public double getDouble( String name ){
XAttribute attribute = getAttribute( name );
if( attribute == null )
throw new XException( "no attribute known with name: " + name );
return attribute.getDouble();
} |
d0b1c4b6-2217-4e15-a93c-7966fcb4c116 | 8 | void showTable()
{
String sSumData ="";
String sColHeadings ="";
int nChannel1Pat, nChannel2Pat, nColocNumber;
if(!cddlg.bColocalization)
{
sColHeadings = "Channel\tSlice\tFrame\tNumber_of_Particles";
for(int i = 0;i<cd.nParticlesCount.length; i++)
{
... |
ac0748ce-2d0a-4fae-98a4-2a5c45ec7490 | 8 | @Override
public void run() {
InputStream is = null;
POIFSFileSystem fs = null;
Vector <Vector>v_rows_all = new Vector<Vector>();
int NumOfSh=0;
try {
is = new FileInputStream(file_xls);
fs = new POIFSFileSystem(is);
HSSFWorkbook workBook =... |
8fef0324-059b-4f16-9b56-597421e28849 | 1 | public BufferedReader getBufferedReader( String fileName ) {
File file = new File( fileName );
BufferedReader br = null;
try {
Reader reader = new FileReader( file );
br = new BufferedReader( reader );
}
catch ( FileNotFoundException e ) {
... |
54030927-bb75-494e-9874-020240800cdd | 3 | public List<String> parseCommand(String command)
{
List<String> params = new ArrayList<String>();
Pattern regex = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'");
Matcher regexMatcher = regex.matcher(command);
while (regexMatcher.find()) {
if (regexMatcher.group(1) != null) {
// Add double-quoted s... |
ca447c83-1f09-4333-ae5e-285d5f22a2ad | 3 | public void setEOF(EOF node)
{
if(this._eof_ != null)
{
this._eof_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
... |
08134438-ff57-4a9a-9d90-0af867d8738e | 2 | public List<Node> remove() {
if (linkSimple.getNext() == null || linkSimple == null) {
linkSimple = null;
throw new NoSuchElementException(
"L'element a enlever est inexistant.");
} else {
linkSimple = (LinkSimple) linkSimple.getNext();
listCount--;
return linkSimple.getListNodes();
}
} |
4b9e52a4-338e-4bc1-be7a-dd2ad0a51a99 | 8 | @Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
// SI EL RADIOBUTTON DEL ROBOT ESTA SELECCIONADO Y LO QUE SE CLICA
// ES UNA CELDA...
if (getPanelBotones().getRobotRadioButton().isSelected() == true
&& getMatriz().getComponentAt(
MouseInfo.getPointerInfo(... |
2227926c-51fe-493c-a043-2a11c0e769a3 | 8 | private ArrayList obtainCandidateList(String[] tTokens, String[] uTokens,
double[] tIdfArray, double[] uIdfArray) {
ArrayList candidateList = new ArrayList();
double minStringSize = getMinStringSize(tTokens, uTokens);
for (int t = 0; t < tTokens.length; t++) {
i... |
e7c42185-c3d7-4640-948c-51d730fec74f | 2 | @Override
public int compare(GameObject gameObject1, GameObject gameObject2) {
return gameObject1.getDepth() > gameObject2.getDepth() ? -1
: gameObject1.getDepth() < gameObject2.getDepth() ? 1
: 0;
} |
48ba9611-359f-4ea0-a43c-6a06b24a4760 | 1 | public void addstring2(String str) {
byte[] buf;
try {
buf = str.getBytes("utf-8");
} catch(java.io.UnsupportedEncodingException e) {
throw(new RuntimeException(e));
}
addbytes(buf);
} |
58ac2c91-f885-45dd-bf6a-aead9ce06581 | 5 | public void partieEnCours(){
int vainqueur = -1;
this.joueurCourant = 0;
while ((vainqueur == -1) && !plateau.estPlein()) {
if (plateau.estPlein()) {
vainqueur = -1;
}
// Si on a 4 pions alignés, il y a un gagnant et cela meme si le
// plateau est plein.
if (plateau.recherche4PionsAlignes()) {... |
c12d5af4-c36e-4683-b514-d0ad9d4a6e6b | 0 | public String getExportLineEnding() {
return (String) exportLineEndComboBox.getSelectedItem();
} |
a8ea1043-3ae7-4f0c-8270-1dcf99f57ebc | 8 | public static ReceivablePacket unserialize(ByteBuffer byteBuffer) {
int position = byteBuffer.position();
if(byteBuffer.remaining() > AbstractPacket.PACKET_LENGTH_SIZE) {
int length = byteBuffer.getShort() - AbstractPacket.PACKET_LENGTH_SIZE;
if(length <= 0) return null;
if(byteBuffer.remai... |
6e46a52a-dbe5-496e-bbbc-34a79a897ead | 0 | public Node getParent() {return parent;} |
84d771b6-7f14-4268-aab0-fddbc8707996 | 2 | public String WriteToFile(String str, Boolean writeToScreen)
{
PrintWriter writer = null;
try
{
if (writeToScreen)
{
System.out.println(str);
}
writer = new PrintWriter(
new OutputStreamWriter(
new FileOutputStream(this.FileName), "windows-125... |
c5353d64-53ee-47a3-9e00-77d831565534 | 6 | public final EsperParser.conditionaloperator_return conditionaloperator() throws RecognitionException {
EsperParser.conditionaloperator_return retval = new EsperParser.conditionaloperator_return();
retval.start = input.LT(1);
Object root_0 = null;
Token set41=null;
Object set... |
6669bf0c-a135-4d39-9963-db09e12f9a9c | 4 | @Override
public boolean equals(Object obj) {
if(obj instanceof Node){
Node tmp = (Node) obj;
return ((this.getWeightAlone() == tmp.getWeightAlone()) && (this.fils.size() == tmp.getFils().size()) &&(this.weight == tmp.getWeight())&&(this.fils.equals(tmp.getFils())));
}else{
return false;
}
} |
d4b293b3-b21b-47f7-80b1-2494844f27b9 | 7 | public String getHtml() {
String classes = "";
String html = "";
if(sashie) {
classes += "sashie";
}
if(sashie && width > height) {
classes += " landscape";
}
if(sashie && width < height) {
html += "<div class=\"sashie-wrapper\">";
}
html += String.format("<div class=\"image %s %s\"></div>... |
06e17d09-aa7e-4846-a69f-10a9baa4dcd1 | 6 | public static int[] findKClosest(int[] input, int k, int x ){
//find the crossover index which is less than or equals to the x
int crossoverIndex = findCrossover(input, x, 0 , input.length-1);
//declare the result array
int [] result = new int[k];
//fill the crossover as first re... |
33683762-ba3b-4d54-9438-978f35cb465a | 2 | @Override
public BencodeInteger parse(BufferedInputStream inputStream) throws IOException, BencodeParseException {
readAndCheckFirstByte(inputStream);
StringBuilder stringBuilder = new StringBuilder();
int currentByte;
while ((currentByte = inputStream.read()) > -1) {
ch... |
0e56b34d-9b17-4235-877d-b0d4b38988f8 | 0 | public Case()
{
reset();
} |
bc52a153-ebb4-4dde-b8f5-5fa6e8c6732c | 2 | public boolean found() {
if (this.JSONTransArray == null)
return false;
if (this.JSONTransArray.length() == 0)
return false;
return true;
} |
f27a0fe8-dd17-48c6-9529-87d634bc246e | 7 | private String setInstructions()
{
String instructions = "";
String gameTitle = "";
if(game == 1)
{
gameTitle = "Fruit Game";
instructions += gameTitle + "\n\n";
instructions += "Instructions: \n\n";
instructions += ";liUse the <left> and <right> arrow keys to\n";
instructions += "cat... |
39794af4-a36d-4f31-bd21-4f4f32bdeb43 | 8 | public static boolean isMatch(String s, String p) {
// Note: The Solution object is instantiated only once and is reused by
// each test case.
boolean[][] isMatch = new boolean[s.length() + 1][p.length() + 1];
isMatch[0][0] = true;
for (int i = 1; i <= s.length(); i++) {
for (int j = 1; j <= p.length(); j... |
b392ebe7-67fe-4362-be22-95cd1112225d | 3 | public void testAcceptAndRemove() {
VehicleAcceptor r = new VehicleAcceptorObj();
TimeServer ts = new TimeServerLinked();
Car[] cars = new Car[10];
for (int i=0;i<10;i++) {
cars[i] = (Car)VehicleFactory.newCar(ts, r);
r.accept(cars[i]);
}
Assert.assertTrue(r.getCars().size() == 10);
... |
babcdf2f-69b3-403b-85d4-6af25e853b79 | 6 | public RrdGraphDef getRrdGraphDef() throws RrdException {
// basic check
if(!root.getTagName().equals("rrd_graph_def")) {
throw new RrdException("XML definition must start with <rrd_graph_def>");
}
validateTagsOnlyOnce(root, new String[] {"span", "options", "datasources", "graph"});
rrdGraphDef = new RrdGr... |
c2ff9526-4a09-4a5c-9588-75769a6689f6 | 5 | private static MethodSignature parseMethodSig(String sig)
throws BadBytecode
{
Cursor cur = new Cursor();
TypeParameter[] tp = parseTypeParams(sig, cur);
if (sig.charAt(cur.position++) != '(')
throw error(sig);
ArrayList params = new ArrayList();
while (s... |
e47b24b4-622a-4f93-bf34-dd26da5d58e8 | 5 | public static void main(String[] args) throws Exception
{
int lineNumber = 0;
BlankInterpreter interpreter = new BlankInterpreter();
List<String> lines = null; // Buffer de Linhas
try {
// Cria um buffer das linhas em uma lista
lines = Files.readAllLines(Paths.get(args[0]), Charset.defaultCharset());
... |
61358564-4379-45fe-a3b1-7fd5d4cf3df5 | 4 | public Player(TileMap tm) {
super(tm);
width = 30;
height = 30;
cwidth = 20;
cheight = 20;
moveSpeed = 0.3;
maxSpeed = 1.6;
stopSpeed = 0.4;
fallSpeed = 0.15;
maxFallSpeed = 4.0;
jumpStart = -4.8;
stopJumpSpeed = 0.3;
facingRight = true;
lives = maxLives = 3;
health = maxHealth... |
df9cc679-5bca-44ef-8dde-fee2560a4b18 | 6 | public void makeOneStep() {
// Do the work
xPosition += xDelta;
if (xPosition < 0 || xPosition >= xLimit) {
xPosition = (xPosition < 0)? xPosition + xLimit: xPosition -xLimit;
}
yPosition += yDelta;
if (yPosition < 0 || yPosition >= yLimit) {
yPosi... |
5ff55700-44f6-49f4-8efb-b9f54312991b | 3 | public int getListSize(int number) {
long target = number;
int sequenceSize = 1;
while (target != 1) {
if (hailstoneSequenceSizeList.containsKey(target)) {
sequenceSize = hailstoneSequenceSizeList.get(target) + sequenceSize;
break;
} else ... |
98c01911-6474-4767-890b-03858637797e | 6 | public Bouncer() {
JFrame frame = new JFrame("Bouncer");
JPanel panel = new JPanel(){
@Override
public void paintComponent(Graphics g){
updatePos();
g.setColor(Color.BLACK);
g.fillRect(0, 0, 2000, 2000);
... |
77be453d-83d5-4e31-a156-c8c5724b64e3 | 7 | private boolean processFields() {
//
// Get the split date
//
if (!dateField.isEditValid()) {
JOptionPane.showMessageDialog(this, "You must specify a valid date",
"Error", JOptionPane.ERROR_MESSAGE);
return false;... |
5dd4569a-e0fb-4da5-b97b-0e28187ea3a7 | 4 | public String HapusHuruf(String strQty){
if (strQty.trim().equals("")){
strQty = "0" + getTheSeparator() + "0" + getTheSeparator()+ "0";;
}
char [] data = TitikHanya2(strQty).toCharArray();
//char [] data = strQty.toCharArray();
String newStrQty = "";
for (cha... |
eb20a87a-6fc1-4293-8b0a-f8f46cf3c19a | 7 | boolean DoOps (int lvl) {
if ((level != lvl) || (!sch) || (done))
return false;
System.out.print ("Processing at node " + seqNo + " at level " + level);
double tempValue = 0;
result += tempValue;
int tempCnt = prdCnt;
for (int i = 0; i < tempCnt; i++)
if (predecessors[i] != null)
... |
5e287e01-85f8-435d-839c-1d220bb635bf | 4 | public static void main(String[] args){
for (int i=12; i<28124; i++){
if (isAbundant(i)){
abundant.add(i);
// System.out.println(i);
}
}
long sum=0;
for (int i=1;i<28124;i++){
if(!canBeAbundant(i)){
// System.out.println(i);
sum+=i;
}
}
System.out.println(sum);
} |
e8b9a50b-ddbf-4572-a738-a26dc48c52a7 | 6 | public void parse(Map map) {
try {
m_bufferReader = new BufferedReader(new FileReader(m_fileName));
int[] sizes = new int[2];
try {
// On récupère les dimensions du labyrinthe dans le header du fichier.
// Exception est lancée si l... |
5721a39b-0633-4549-bdad-672ae1e8b76a | 7 | void checkCommands2()
{
int i;
Entity thnStore;
String strStore=null;
for (i=0;i<vctSide2.size();i++)
{
thnStore = (Entity)vctSide2.elementAt(i);
if (!thnStore.vctCommands.isEmpty())
{
strStore = (String)thnStore.vctCommands.elementAt(0);
thnStore.vctCommands.removeElementAt(0);
if (strS... |
4aad15a3-fa7e-45bc-a196-ed4d23210a64 | 5 | @Override
public String toString()
{
String ret = null;
switch (type)
{
case ELEMENT:
ret = "<" + getTagName();
if (getAttribute("id") != null)
ret += " id=" + getAttribute("id");
if (getAttribute("class") !=... |
5be9334f-1009-474f-a92e-75aeec1e2c4f | 6 | public String getMatrix() {
StringBuilder matrixString = new StringBuilder();
int[][] matrix = new int[nodes.size()][nodes.size()];
for (int i = 0 ; i < nodes.size() ; i++){
for (int j = 0 ; j < nodes.size() ; j++){
if(i != j && edgeExistBetween(nodes.get(i), nodes.get(j)) )
++matrix[i][j];
}
... |
b50f8c77-9401-4d88-b909-9603eb2bf591 | 8 | public void keyAction(){
//Conditions: key pressed and left is not AI
if (p1UpPress && userLeft){
p.get(0).moveUp();
}
if (p1DownPress && userLeft){
p.get(0).moveDown();
}
... |
791e0a26-a658-4987-be83-26f3526b310e | 7 | public static String javaHeuristicallyTranslateName(String stellaName, Cons caseConvertedNameList) {
{ StringWrapper pname = null;
Cons iter000 = caseConvertedNameList;
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
pname = ((StringWrapper)(iter000.value));
if (Stella.stringE... |
2f6810cf-a1fc-4135-98e1-6bd16fe1ae76 | 0 | public void addToWorld(int x,int y,int z){
setLocalTranslation(x, y, z);
int[] chunkPos = PositionUtil.getChuk(x, z);
int[] regionPos = PositionUtil.getChunkRegion(chunkPos[0], chunkPos[1]);
currentChunk = ContentManager.getInstance().getMinecraft().getWorld().getDimension().get(regionPo... |
1b3984ae-b7b0-4f46-a4c6-bf6aaf916d65 | 3 | @Override
public void update() {
snow.update();
world.step(1 / 60f, 6, 2);
if (platformerScreenControls.isLeftHeld()) {
body.setLinearVelocity(new Vec2(-10, body.getLinearVelocity().y));
}
if (platformerScreenControls.isJumpPressed()) {
body.setLinea... |
7ffbcb91-64ed-45eb-b37c-a9143654bee9 | 5 | private String removeQuotes( String word ) {
if( word.length() <= 2 ) {
return word;
}
word = word.replaceAll( "\\[\\[(.*?)\\]\\]", "$1" );
char ch1 = word.charAt( 0 );
char ch2 = word.charAt( word.length() - 1 );
if( (ch1 == '\'' && ch2 == '\'') || (ch1 == '(... |
7f369c78-37a8-45ee-9ace-0ee059c4a9ec | 9 | private void postPlugin(final boolean isPing) throws IOException {
// The plugin's description file containg all of the plugin data such as name, version, author, etc
final PluginDescriptionFile description = plugin.getDescription();
// Construct the post data
final StringBuilder data =... |
59bcd7a5-4e04-4632-8e5a-2895675c7c9a | 9 | public void draw() {
if ((falseCounter+okCount)>2000) return;
for (int i=0; i<64;i++) {
frame1[i]=x;//(int)((x&255)<<16 | (x%255)<<8 | (x&255));
}
for (int i=0; i<x/4;i++) {
frame1[i] = 0xffffff;
}
x+=4;
if (x>255) x=4;
long l1 = System.currentTimeMillis();
boolean result5 = r.sendRgbFra... |
233ef2d3-add2-4d8a-90c7-4200949875a2 | 9 | private static void method377(int ai[], int i, int j, int l, int i1) {
int k;// was parameter
if (restrictEdges) {
if (i1 > DrawingArea.centerX)
i1 = DrawingArea.centerX;
if (l < 0)
l = 0;
}
if (l >= i1)
return;
i += l;
k = i1 - l >> 2;
if (alpha == 0) {
while (--k >= 0) {
ai[i++] ... |
9219d1c0-07c8-4f27-a654-fe1ce6d8a875 | 7 | private String oAuthFacebook(HttpServletRequest req,String step){
String oAuthUrl="/index.jsp";
if (step.compareTo("1")==0){
oAuthUrl="https://www.facebook.com/dialog/oauth/?client_id="+Util.FaceBookOAuth.consumer_key +
"&redirect_uri="+ Util.getCallbackDomain() +"/oauth?network=facebook&step=2" +
... |
aee50331-f9e8-41c6-a6e9-9b213ff97a12 | 4 | public LinkedNode getCircularNode(LinkedNode node){
if(node==null){
return null;
}
List<LinkedNode> passedNodes = new ArrayList<LinkedNode>();
passedNodes.add(node);
while(node.getNext()!=null){
node=node.getNext();
for(int i=0; i<passedNodes.s... |
caa31aa4-f2f4-4022-9c0f-53ab37d58a9b | 7 | * @param direction The direction in which the Indian settlement lies.
*/
private void moveLearnSkill(Unit unit, Direction direction) {
clearGotoOrders(unit);
// Refresh knowledge of settlement skill. It may have been
// learned by another player.
if (!askServer().askSkill(unit,... |
80de759d-1d03-4dc2-ab43-10033f783b50 | 2 | @Override
public void update(){
if(counter < 5 && Math.random() < .001){
makeBabies();
}
} |
dcfe8870-6283-4e19-86ac-c4aaaae6acee | 4 | public boolean isInSightRange(int x, int y){
int xStart = Boot.getPlayer().getX();
int yStart = Boot.getPlayer().getY();
int xEnd = xStart + 12;
xStart = xStart - 12;
int yEnd = yStart + 12;
yEnd = yEnd - 12;
if (x >= xStart || x <= xEnd){
if (y >= yStart || y <= yEnd){
return true;
... |
db93ac36-b052-49d8-a83b-cffca794e53c | 5 | public void go(){
if (!goButton.isEnabled())
return;
downloadDir = fileField.getText();
if (StringOps.isEmpty(downloadDir)){
downloadDir = ".";
log("Songs will be downloaded to "+new File(".").getAbsolutePath());
}
File dir = new File(downloadDir);
if (!dir.exists()){
messageBox("Directory \""+d... |
4f79bb37-042e-44ed-b5a2-6a1607a50ad1 | 6 | public static void run(RobotController myRC)
{
rc = myRC;
RobotType t = rc.getType();
try
{
if (t == RobotType.SOLDIER)
{
Soldier.soldierCode(rc);
}
else if(t == RobotType.HQ)
{
HQ.hqCode(rc);
}
else if(t == RobotType.GENERATOR || t == RobotType.SUPPLIER)
{
Supplier.supplie... |
6f60ea4b-afca-4fdd-bae4-71505567c8e5 | 4 | private void createColorMap()
{
colors = new HashMap<Integer, Color>();
if (input != null)
{
int height = input.getHeight(),
width = input.getWidth();
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
int color = input.getRGB(x, y)... |
a8bf9b68-a3c9-431c-8dd8-11c97c2af485 | 0 | protected Automaton createEmptyAutomaton(Document document)
{
return new MooreMachine();
} |
921888a9-3178-4b59-97e1-d2d0af243bca | 3 | public boolean isInBounds(int... coords) {
for (int coord : coords) {
if (coord < 0 || coord >= thisTick.length) {
return false;
}
}
return true;
} |
40dfacd9-e87c-4dfb-8f3a-c0ab09178912 | 0 | public void setRemoteIP(String remoteIP) {
this.remoteIP = remoteIP;
} |
a7f82efd-efb7-41ce-8eec-fbc4e105a976 | 9 | public int getXL(){
if(xl!=-1)return xl;
if(under.isEmpty()){
int minx = Integer.MAX_VALUE;
for(int i=0;i<4;i++){
if(piece[i][0]==h-1)minx = Math.min(minx, piece[i][1]);
}
return xl = minx;
}
int x = Integer.MAX_VALUE;
for(int i=0;i<4;i++){
for(P p:under){
for(int j=0;j<4;j+... |
4f285fb8-6d12-4120-b883-115f0c899407 | 3 | public String getAuthor() {
Object value = library.getObject(entries, "Author");
if (value != null && value instanceof StringObject) {
StringObject text = (StringObject) value;
return cleanString(text.getDecryptedLiteralString(securityManager));
}
else if (value i... |
c4d53f9b-1f71-4e00-8dc7-eef7a85fb554 | 2 | public InfoSerie getDescripcion(){
InfoSerie infoSerie = new InfoSerie();
ArrayList<InfoActor> listaInfoActor = new ArrayList();
ArrayList<InfoCreador> listaInfoCreador = new ArrayList();
// Se añade la información de cada actor.
for (Actor actor : actores) {
... |
51fd2b0a-3540-486d-8b79-72130290252c | 3 | public static int findNumDays(String fileName)
{
int lineNumber = 0;
String line;
try {
BufferedReader br = new BufferedReader( new FileReader(fileName));
while( (line = br.readLine()) != null)
{
lineNumber++; ... |
a9f017b6-e00c-46ed-b539-0c69bd8ef5f9 | 5 | public void paintIcon(Component c, Graphics g, int x, int y)
{
Color color = c == null ? Color.GRAY : c.getBackground();
// In a compound sort, make each succesive triangle 20%
// smaller than the previous one.
int dx = (int) (size / 2 * Math.pow(0.8, priority));
int dy = descending ? dx : -dx;
// A... |
56efc797-61d2-41b2-af7e-7722680a7453 | 4 | public boolean equals(Object arg){
if (this == arg) {
return true;
}
if (this == null ) {
return false;
}
if (getClass() != this.getClass()){
return false;
}
Man other = (Man)arg;
return name.equals(other.getName()) && surname.equals(other.getSurname());
} |
06385dda-0975-4361-a108-bf3391627cb8 | 2 | public static void printMatrix(int[][] img) {
for(int i = 0; i < img.length; i++) {
for(int j = 0; j < img[i].length; j++) {
System.out.print(img[i][j] + " ");
}
System.out.println();
}
} |
91a1c3ad-fe52-4be2-a1eb-9019e9eba609 | 1 | private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
JFileChooser chooser = new JFileChooser("/");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnVal = chooser.showOpenDialog(this);
if(returnVal == JFileCh... |
3e1bf7d6-7cce-4386-8baa-1fa5ceb925d9 | 2 | public static void func(int req, int n, int[]pi, Rojok rj, Integer I, Matrix A){
for(int i=1; i<=n-req+1; i++){
pi[req] = rj.geti(i);
func(req+1, n , pi, rj, I, A);
rj.pop(i);
if(req == n) add(pi,I,A);
}
} |
4743de27-d861-4fbb-8557-cc8872daa4bb | 3 | @Override
public void updateSallary(Position position) throws SQLException {
Connection dbConnection = null;
java.sql.Statement statement = null;
try {
dbConnection = PSQL.getConnection();
statement = dbConnection.createStatement();
String positionUpdate = "UPDATE position SET sallary = "
+ positi... |
aa04b0c3-7d5f-480b-ab2f-d66971ae216f | 0 | public void keyTyped(KeyEvent e) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} |
5602b984-530c-48c4-89dd-e19f281b1145 | 7 | @Override
public String getDescription(Hero hero) {
int healthLoss = SkillConfigManager.getSetting(
hero.getHeroClass(),this, "HealthLossPercentage", 10);
int manaGain = SkillConfigManager.getSetting(
hero.getHeroClass(), this,"Manaregain", 10);
int thresHold = SkillConfi... |
70151c10-1912-4979-9932-73edd52eb0e0 | 0 | public void create(Date paid, double amountPaid) {
this.setPaid(paid);
this.setAmountPaid(amountPaid);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.