method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6f956e1e-d69d-4eab-b0a7-5a513a26ab25 | 5 | private void loopSoundThroughRobots(String paramString)
{
for (int i = 0; i < this.RobotsWereShootingAt.size(); i++)
{
Robot localRobot = (Robot)this.RobotsWereShootingAt.elementAt(i);
Vector localVector = localRobot.getLoopList();
int j = 0;
for (int k = 0; (k < localVector.size()) &... |
6abd40f5-9929-482a-bffa-d9cfa4c450f8 | 4 | static public void receivedBeaconManager(String str){
if(ClientMain.runingRequester==true || ClientMain.runingProvider==true)
{
if(Integer.parseInt(str.split("BEACON DEVICE NUM:")[1]) == ClientMain.myID_Num); //Don't print own beacon
else if (ReceiverThread.ignoreBrokerList.contains(Integer.parseInt(str.sp... |
af50b18f-4388-49c8-8bac-6e7c82f5ef45 | 9 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Please enter a postfix expression: ");
String expression = in.nextLine();
String[] values = expression.split(" ");
Stack<Integer> operands = new Stack<Integer>();
for(String val : values){
i... |
13802075-b562-4ae1-a17d-f9d127bfb823 | 0 | @Override
public String toString() {
return "info.toegepaste.www.entity.Artikel[ id=" + id + " ]";
} |
5fd82053-f45a-4724-ad1c-d46f58175de1 | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return super.okMessage(myHost,msg);
final MOB mob=(MOB)affected;
if((msg.amITarget(mob))
&&(CMath.bset(msg.targetMajor(),CMMsg.MASK_MALICIOUS))
&&(msg.targetMinor()==CMMsg.TYP_CAST_SPELL)
&... |
bff5eb4d-1b2a-4ebc-8440-3679dd85b19f | 3 | public void setEQ(float[] eq0)
{
this.eq = eq0;
if (eq==null)
{
eq = new float[32];
for (int i=0; i<32; i++)
eq[i] = 1.0f;
}
if (eq.length<32)
{
throw new IllegalArgumentException("eq0");
}
} |
f9cb465f-beda-4d6c-beae-4fad4b62dc17 | 8 | @Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
String register = request.getParameter("register");
String loginn = request.getParameter("loginn");
String edit = request.getParameter(... |
e508c455-17af-4a94-97ca-48a35c1294dd | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.... |
3195b5e9-4184-4645-9cdb-ca7c92ed414d | 1 | public void visit_lshl(final Instruction inst) {
stackHeight -= 3;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 2;
} |
09757423-7884-40b5-8d2a-f53e16cb83b4 | 7 | public static void main(String [] args) {
CumulatedRevenue revenues = new CumulatedRevenue();
if (args.length < 1) {
quit("Usage: Main --scheduler [day]");
}
String policy = args[0].substring(2); //get rid of the leading "--"
if (args.length == 1 || args[1].equals("... |
74127179-3ff6-44f6-879c-e27fdf251429 | 6 | public void testKeySet() {
int element_count = 20;
String[] keys = new String[element_count];
int[] vals = new int[element_count];
TObjectIntMap<String> raw_map = new TObjectIntHashMap<String>();
Map<String,Integer> map = TDecorators.wrap( raw_map );
for ( int i = 0; i <... |
b7daea1b-a5ff-4bed-b1b5-e7999ba18d09 | 5 | private void setTactics() throws JSONException {
// Wenn Taktik erwünscht
if (Config.getTactics()) {
if (Config.getFightDebug())
Output.printTab("Suche nach Taktik für " + opponent.getName()
+ ": ", Output.DEBUG);
String[] tactics = TacticsLogFile.getTactics(opponent.getName());
if (tactics !... |
a44494db-2731-4f0f-8c02-41b6ae96a331 | 5 | public void DijkstraAlgorithm() {
int s = startV; // s is the starting vertex
// mark s as explored
exploredNodes.add(s);
// int indexOfS = unexploredNodes.indexOf(s);
// unexploredNodes.remove(indexOfS);
// update the shorted path from s to s to be 0, and add s to the Path
// from s to s
shortestPath... |
ed65d778-48bf-4cee-ab47-67acf837dae2 | 8 | private MoveMessageType getAppropriateMove(Board board, int playerID,
Position playerPos) {
PositionType forbiddenPos = board.getForbidden();
MoveMessageType message = new MoveMessageType();
Position treasurePos = board.getTreasurePos();
if (treasurePos == null) {
// Treasure on shift card
Map<MoveMe... |
18d6b262-eff4-4607-bcbc-19fc838091ca | 2 | public void addDirectory(File file) {
if(file == null || !file.isDirectory()) {
return;
}
exploreDirs.add(file);
} |
966bf9af-f812-43bd-9ab2-dba2dbfe5654 | 8 | @Override
public void run()
{
// only attempt if a) there are 3 unchoked connections and b) there is at least one choked connection
// randomly choose choked peer
// out of active peers, choose one with least amount of pieces downloaded
// trade places with these two chosen peers
// set all the peers in... |
5ada53a7-7cb4-4ea7-bede-75a583c5dd25 | 2 | public synchronized void addUnsearchList(String url){
String filename = unarchedSitesFilePath;
try{
BufferedReader in = new BufferedReader(new FileReader(filename));
String tmpFileName = filename + ".tmp";
BufferedWriter bw = new BufferedWriter(new FileWriter(tmpFileName));
String line = "";
while((l... |
b8ba4d98-eb16-430b-aea4-6ddf937e4063 | 9 | public void sortColorBetter(int[] nums) {
if (nums == null || nums.length <= 1) {
return;
}
int nr = 0, nb = nums.length - 1;
// find the fist element that is not red
while (nr < nums.length && nums[nr]==0) {
nr++;
}
// find the first element from left that is not blue
while (nb >=0 && nu... |
fe5df3ad-cb7b-4900-bc97-ab8a6d7f1a1e | 4 | @SuppressWarnings("unchecked")
Renter(HashMap<String, Object> renter){
this.ID = java.util.UUID.randomUUID().toString().substring(0, 8);
if(renter.containsKey("PICTURE")) this.picture = (String)renter.get("PICTURE");
if(renter.containsKey("NAME")) this.name = (String)renter.get("NAME");
if(renter.containsKe... |
9d68548e-aa2d-41fd-aeb3-408b401661ca | 6 | @Override
public void deserialize(Buffer buf) {
worldX = buf.readShort();
if (worldX < -255 || worldX > 255)
throw new RuntimeException("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255");
worldY = buf.readShor... |
511e7627-5ca1-4b6f-9dc5-ec3e403e5b8b | 3 | private void init() {
setLayout(new AbsoluteLayout());
this.setMinimumSize(new Dimension(161, 226));
this.setMaximumSize(getMinimumSize());
this.setPreferredSize(getMinimumSize());
this.setBorder(new BorderUIResource.EtchedBorderUIResource());
backButton.setFont(smallFon... |
e4a71eb8-674f-4632-b69b-d21b88fa3d29 | 3 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.tour");
try {
Criteria criteria = new Criteria();
Tour currTour = (Tour) request.getSessionAttribute(JSP_CURRENT_TOUR);
... |
aeb89815-1f3b-44cc-9566-b0d3fc1acd08 | 7 | public void paint1(Graphics g) {
g.drawImage(background, 8, 30, this);
g.setFont(new Font("Serif", Font.BOLD, 34));
g.drawString("" + score, 220, 80);
if (avion != null) {
if (!perdio) {
Graphics2D g2d = (Graphics2D) g;
// Rotation informat... |
954b1001-ec09-457d-a08c-890b60012b64 | 9 | public boolean batchFinished() throws Exception {
if (getInputFormat() == null) {
throw new IllegalStateException("No input instance format defined");
}
if (m_removeFilter == null) {
// establish attributes to remove from first batch
Instances toFilter = getInputFormat();
int[] at... |
d84d6e63-7797-448a-9ee8-3fb2bfdd6aec | 9 | private HttpURLConnection getConn(Request request)
throws URISyntaxException, IOException, HmacException {
String path = String.format("%s/%s", request.getPathPrefix(),
subscriberId);
if (request.getPackageId() != null) {
path += "/" + request.getPackageId();
... |
77957ac1-b793-42b0-b561-80a58ea19e52 | 6 | public SearchFilter(ConnectionProcessor connectionProcessor, Properties config) {
super(connectionProcessor, config);
requireConfigKey(KEY_ACTION);
action = config.getProperty(KEY_ACTION);
if (!ACTIONS.contains(action)) {
throw new Error("unrecognized action: '" + action + "'... |
1d9d6793-e7c3-4bd9-b3c4-d7f0c53dee8b | 0 | public void setHoraRecogida(String horaRecogida) {
this.horaRecogida = horaRecogida;
} |
553314bb-a695-40b1-ab9c-6449719987a2 | 0 | @PostConstruct
public void init() {
System.out.println("PostConstruct");
} |
7b5ed6d2-1b23-45ea-a423-9cbf9877e143 | 9 | public GameLevel(String levelConfig) throws Exception
{
System.out.println(levelConfig);
if (levelConfig == null)
return;
entities = new ArrayList();
tiles = new ArrayList();
int currentY = 0;
boolean hasPacman = false;
String[] lines = levelConfig.split("\n");
for (int y = 0; y ... |
14fb3720-13a0-43d7-a315-49d3ff6a0049 | 6 | public static void trade(Player player, String[] args) {
// trade <player> <item> <amount> <money>
if (args.length == 4) {
Player target = Bukkit.getPlayer(args[0]);
if (target != null && target.isOnline()) {
String item = args[1];
int amount = Integer.parseInt(args[2]);
float money = Float.parseF... |
03b9cf23-87cd-4ecb-856e-96889c6a1cd4 | 6 | private void printTimeStamp(int level)
{
switch(level)
{
case ALWAYS:
{
psOut.print(MSG_ALWAYS+LOG_SEP);
break;
}
case ERROR:
{
psOut.print(MSG_ERROR+LOG_SEP);
break;
}
case INFO:
{
psOut.print(MSG_INFO+LOG_SEP);
break;
}
case VERBOSE:
{
psOut.print(MSG_... |
dba2a226-4a24-4e46-b6ae-b25e6d571b77 | 6 | public static ArrayList<Proceso>[] obtenerProcesos(String nombreArch) {
ArrayList<Proceso>[] procesos = new ArrayList[101];
for (int i = 0; i < procesos.length; i++) {
procesos[i] = new ArrayList<Proceso>();
}
try {
File archivo = new File(nombreArch);
... |
24b7d004-62ed-45cd-9f61-a867e08a70de | 1 | @Override
public boolean accept(File file) {
return file.isDirectory() || file.getName().endsWith(".txt");
} |
6bd0c186-d040-4d19-91c6-e6574dcc96e0 | 8 | private void sell(String command) {
currentCommand = "sell";
String[] commandComps = command.split("\\s+");
if (commandComps.length != 3) {
sendToUser("Invalid command");
return;
}
if (commandComps[0].equalsIgnoreCase("SELL")
&& commandComps[1].startsWith("<")
&& commandComps[1].endsWith(">")
... |
dfa84779-fb6e-4e68-8985-28b43f3c4a46 | 0 | @Override
public void removeServerStopListener(ServerStopListener listener) {
serverStopListenerList.remove(ServerStopListener.class, listener);
} |
0b30b13f-62d6-40d3-9603-753cfef5489c | 6 | public ArrayList<Vector> getCollisions(Polygon polygon) {
if(polygon.min.greaterThan(max) || polygon.max.lessThan(min)) {
return null;
}
ArrayList<Vector> intersections = new ArrayList<Vector>();
Vector intersection;
for(Edge edge : edges) {
for(Edge otherEdge : polygon.edges) {
intersection = edge.... |
19801f16-8034-4ede-8189-214710e49c9d | 8 | private boolean formatFilePaths(){
//If the inputFilePath is empty turn result false
boolean result = true;
if(inputFilePath.equals("")){
result = false;
} else {
String findExtension = "(.*)\\.txt$";
String pathName = "(.*)[^\\w+\\.txt]";
String fileName = "\\w+\\.txt$";
//String find... |
700e0715-011a-45e8-8344-6b50fa869ade | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
final Room R=mob.location();
final CMMsg msg=CM... |
7326062d-2161-4c92-a583-47f2ed2b75f4 | 5 | public void update(LineEvent e)
{
if(e.getType().equals(LineEvent.Type.OPEN))
{
playEntireButton.setEnabled(false);
playBeforeButton.setEnabled(false);
playAfterButton.setEnabled(false);
selectionPrevState = playSelectionButton.isEnabled();
playSelectionButton.setEnabled(false);
... |
a9edae69-30e4-4cff-9b02-40b144b2e30e | 3 | private double distanceFromLine(double ax, double ay, double bx, double by, double cx, double cy)
{
double distance;
double r_numerator = (cx - ax) * (bx - ax) + (cy - ay) * (by - ay);
double r_denomenator = (bx - ax) * (bx - ax) + (by - ay) * (by - ay);
double r = r_numerator / r_denomenat... |
abfd876f-1d22-40db-89d1-20d20f1546ff | 3 | public void setSsn(String ssn) throws Exception{
if (ssn.length() <= MIN_INT_VALUE || ssn.toString() == null || ssn.length() > MAX_SSN){
throw new IllegalArgumentException(SSN_ERR);
}
this.ssn = ssn;
} |
f2a09e8b-6e30-4757-be9f-f47f5038ba69 | 4 | public void addAgent() {
Random rand = new Random();
int x;
int y;
for (Integer i = 0; i < ((EnvironnementWator) environment).nb_agent_poisson; i++) {
do {
x = rand.nextInt(environment.taille_envi);
y = rand.nextInt(environment.taille_envi);
} while (((EnvironnementWator) environment).grille[x][y]... |
a8a97be2-5735-40cc-aa9c-ce2a108bfc2e | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Tag other = (Tag) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (val... |
bd97cb01-4f2f-4fe9-a275-8dbed5972bdb | 2 | private void ouverture() {
try{
InputStream in = new FileInputStream(filepath);
InputStreamReader inr = new InputStreamReader(in);
BufferedReader br = new BufferedReader(inr);
String ligne;
while ((ligne=br.readLine())!=null){
fichier +=ligne+" ";
}
br.close();
}
catch (Exception e){
... |
810e711e-80b2-4377-888c-6905b1c2e630 | 2 | public void maj() {
System.out.println("MAJ DE L'INTERFACE");
int i;
Date dateDebut;
dateDebut = new Date(fabrique.getDebut());
Date.setText(dateDebut.toString());
System.out.println(fabrique.getDebut());
//on remet à zàro chaque chaine d'affichage
//chaine contenant tous les messages
chaine_affich =... |
fdebdc1a-e61e-44d5-b0bc-5ce22d13e2c8 | 7 | private void actualizarTabla(){
if (a.getSizeArray() < 15) {
for (int i = 0; i < 15; i++) {
if (i < a.getSizeArray())
tabla.setValueAt(a.getProc(i).getNombre(), i, 0);
else
tabla.setValueAt("", i, 0)... |
67f4eb45-8e48-4027-a7e0-08d07b3061d0 | 0 | @Test
public void testVersionDetection() {
testVersions("Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7d", new Version("2.8.5rel.1","2","8"));
testVersions("Mozilla/6.0 (compatible; Konqueror/4.2; i686 FreeBSD 6.4; 20060308)", new Version("4.2", "4","2"));
testVersions("Mozilla/5.0 (compatible; Konque... |
e4e07c95-e394-4037-82b7-26ad2752a0cb | 0 | public String getReplacement() {return this.replacement;} |
35a5ce98-7cf2-4322-97a5-8c2eb9c26cac | 0 | public String getStato() {
return stato;
} |
c7a00850-9742-411b-af38-ee11b79c180b | 4 | public static int getRandMap() {
String path = mapDir, oldMapName = mapName;
File directory = new File(path);
File[] listOfFiles = directory.listFiles(new FilenameFilter() {
public boolean accept(File directory, String fileName) {
return fileName.endsWith(".txt");
}
});
while(mapName == oldMapNam... |
36901766-1e51-46ab-b5e7-a3af317c004e | 5 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
OpcodeChangedEvent other = (OpcodeChangedEvent) obj;
... |
0c28cc3b-2275-40ef-8878-7f63cc25c638 | 5 | public static ArrayList<Point> jarviz(ArrayList<Point> points) {
ArrayList<Point> copyArray = new ArrayList<Point>();
for (Shapes.Point point : points) {
copyArray.add(point);
}
ArrayList<Point> bestPoints = new ArrayList<Shapes.Point>();
Shapes.Point cP = points.get... |
1a0b6d92-d2d6-4c3d-a9bb-5eb98203050d | 3 | public char nextClean() throws JSONException {
for (;;) {
char c = this.next();
if (c == 0 || c > ' ') {
return c;
}
}
} |
920a4bcb-fb43-4a76-9f27-604030a93658 | 6 | private void paintListLayered(Graphics g, int p0, int p1, Shape viewBounds,
JTextComponent editor, View view, List highlights) {
for (int i=highlights.size()-1; i>=0; i--) {
Object tag = highlights.get(i);
if (tag instanceof LayeredHighlightInfo) {
LayeredHighlightInfo lhi = (LayeredHighlightInfo)tag;... |
c50d3f7d-796a-403b-91e3-14f355f8c32d | 2 | public List<Player> getRunningbackList() throws IOException, ParseException {
List<String> csvPlayers = retriveData(RB_PROJECTION_LINK);
List<Player> players = new ArrayList<Player>();
for (String playerString : csvPlayers) {
String[] split = playerString.split("\t");
i... |
39ad8c09-00e0-4ba6-82f5-fec0f6a11af8 | 4 | public void method454(int arg0) {
for (anInt1570 += arg0; anInt1570 > spotAnimation.sequence.getFrameLength(anInt1569);) {
anInt1570 -= spotAnimation.sequence.getFrameLength(anInt1569) + 1;
anInt1569++;
if (anInt1569 >= spotAnimation.sequence.length && (anInt1569 < 0 || anInt1569 >= spotAnimation.sequence.le... |
4f26de0d-82b3-46a6-a200-5b9f860a8e95 | 9 | private void initRenderables() {
// Init the reflection API
// Look for classes implementing the Renderable interface
Set<Class<? extends Renderable>> renderables = new Reflections("net.carmgate.morph").getSubTypesOf(Renderable.class);
// Iterate over the result set to initialize each renderable
for (Class<?... |
1ad89c97-ec41-4262-857b-41eecc7e8f2f | 0 | public void removeEdge(Object vertex1, Object vertex2) {
adjacent(vertex1).remove(vertex2);
adjacent(vertex2).remove(vertex1);
} |
e88b68ed-2eca-4ebf-a96f-ff51aa21e88e | 1 | public void setLineNumbers(final LineNumberDebugInfo[] lineNumbers) {
if (code != null) {
code.setLineNumbers(lineNumbers);
}
} |
33bde54b-292c-46e1-ab8b-19fd9d41da8a | 6 | public synchronized String decode(byte[] buffer) {
if (buffer == null) {
return null;
}
StringBuffer stringbuffer = new StringBuffer((buffer.length * 100) / 60);
f = buffer;
g = 0;
h = 0;
e = false;
Object aobj[] = b;
do {
if (e) {
break;
}
aobj = (Object[]) aobj[a()];
if (aobj[... |
834b8349-6af0-43cf-ab8f-e00171ab7aed | 0 | @Override
public void display(UserInterface ui) {
ui.signalNeedToDisplayFunction();
} |
fa9f4732-54d3-49d3-a705-904d9fb88cff | 6 | public void actionPerformed(ActionEvent evt)
{
if (evt.getSource() instanceof JButton)
{
JButton bouton = (JButton) evt.getSource() ;
String texte = bouton.getText() ;
if (texte.equals(BTN_SOLO))
modelePanneau.setChoix(MENU_PSEUDO) ;
else if (texte.equals(BTN_MULTI))
modelePanneau.setChoix(MENU... |
18fec841-8011-4897-806f-936fc176ebe8 | 2 | public MetricsLite(Plugin plugin) throws IOException {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
}
this.plugin = plugin;
// load the config
configurationFile = getConfigFile();
configuration = YamlConfiguration.loadCo... |
af005737-03ea-45c5-8317-1e6757cac181 | 8 | public int calculateValue(ArrayList<Card> player) {
if(isStraightFlush(player))
return 8;
else if(isFourOfAKind(player))
return 7;
else if(isFullHouse(player))
return 6;
else if(isFlush(player))
return 5;
else if(isStraight(player))
return 4;
else if(isThreeOfAKind(player))
return 3;... |
03faea95-c152-493d-a37f-9b259c7e4705 | 0 | @Test
public void determineHighestStraight_whenHandContainsAto5_returnsWheelStraight() {
Hand hand = findHighestStraight(FourFlushWithWheelStraight());
assertEquals(HandRank.Straight, hand.handRank);
assertEquals(Rank.Five, hand.ranks.get(0));
} |
187c6424-9d83-4f83-80b0-f7769668ccaa | 3 | public Geometric2DNodeCollection(){
// Immediately stop execution if rMax is not defined in the xml config file.
try {
rMax = Configuration.getDoubleParameter("GeometricNodeCollection/rMax");
} catch(CorruptConfigurationEntryException e) {
Main.fatalError(e.getMessage());
}
double ratio = dimX / rM... |
618f0b3e-5962-4eb3-a06d-bf671d34d000 | 3 | public void updateSubTypes() {
argType = (type instanceof ArrayType) ? Type
.tSubType(((ArrayType) type).getElementType()) : Type.tError;
for (int i = 0; i < subExpressions.length; i++)
if (subExpressions[i] != null)
subExpressions[i].setType(argType);
} |
af977938-995f-4f09-a46e-80d92f3d9040 | 1 | private boolean performOnce() {
if (tick > MAX_TICKS) {
label.setText("Time out!!!");
label.setVisible(true);
// print error message
System.err.println("[ERROR] The player is time out!");
next.setEnabled(false);
... |
ed6e6e34-2569-495c-9e54-4e843ccb4034 | 1 | private void btnSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairActionPerformed
if(JOptionPane.showConfirmDialog(rootPane, "Você tem certeza que deseja "
+ "sair ?","",JOptionPane.OK_CANCEL_OPTION) == 0){
this.dispose();
}
}//GEN-LAST:event_b... |
0c232a90-111e-4d5c-99e5-e7f480d8b2ab | 5 | public void determineVelocity(Ball ball, boolean westCollision, boolean eastCollision){
if(westCollision && eastCollision){
ball.getVelocity().x = ball.getCenterPoint().x > rect.getCenterX() ? Maths.positive(ball.getVelocity().x) : Maths.negative(ball.getVelocity().x);
}
else if(westCollision){
ball.getVe... |
1d66e5d8-780c-46bc-b37f-27e0941d4629 | 2 | public static void main(String[] args)throws Exception {
// TODO Auto-generated method stub
Socket sock = new Socket("127.0.0.1", 3000);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
OutputStream os = sock.getOutputStream();
PrintWriter pw = new PrintWriter(os, true);
I... |
f1e932a9-012b-42ce-9510-6f7ac0a48893 | 2 | private void removeAllUpgrades(BodyPart bodyPart){
for(Upgrade u : bodyPart.getUpgrades()){
if(u != null){
this.removeUpgrade(u, bodyPart);
}
}
} |
6e1cd4c6-f468-4847-ac80-1e2201aa2d98 | 6 | public final void removeLocation(Location location)
{
Location remove = null;
for (Iterator<Location> tocheck = getLocs().iterator(); tocheck.hasNext(); ) {
Location loc = (Location)tocheck.next();
boolean world = loc.getWorld().getName() == location.getWorld().getName();
boolean x = loc.getBlockX() == lo... |
d9794810-fdef-404c-964e-e824c6e01e97 | 9 | public Vector AStarSearch(Agent agent) {
PQ openQ = new PQ();
// initialize a start node
Node startNode = new Node();
startNode.location = startLoc;
startNode.costFromStart = 0;
startNode.costToGoal = pathCostEstimate(startLoc, goalLoc, agent);
startNode.totalCost = startNode.costFromStart + startNode.c... |
f29027a5-611f-4870-a2b4-b35497852055 | 7 | @Override
public int estimateCostToGoal(SearchState state) {
short[] board = state.board.board;
for (int y = 0; y < maxLines - 1; y++) {
boolean beforeCave = true;
boolean inCave = false;
for (int x = 0; x < Board.WIDTH; x++) {
if (isSet(board[y+1], x)) {
if (inCave)
... |
c7c001e8-cb91-4b02-997c-b501172b3527 | 4 | public static void storeChunkInCompound(Chunk var0, World var1, NBTTagCompound var2) {
var1.checkSessionLock();
var2.setInteger("xPos", var0.xPosition);
var2.setInteger("zPos", var0.zPosition);
var2.setLong("LastUpdate", var1.getWorldTime());
var2.setByteArray("Blocks", var0.blocks);
... |
e9d7bd5d-9d78-4a30-805a-29b7a8b5fb1b | 5 | public static void main(String[] args)
{
final float heapSizeMegs = Runtime.getRuntime().maxMemory() / 1024L / 1024L;
boolean start = false;
if (heapSizeMegs > MIN_HEAP || !start)
{
start = true;
}
else
{
try
{
... |
c2994ca4-461b-45f2-a7da-b5a2bbf2c175 | 7 | protected boolean checkSchema() throws NotValidXMLException
{
try
{
if ((xmlFileName != null) && (dtdFileName != null) && (xsdFileName != null))
{
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
File xsdFile = new File(xsdFileName);
Schema schema =... |
5fb1ea64-5e4c-407e-93f3-9390b2259557 | 8 | public void paint(Graphics g, int xMouse, int yMouse){
g.drawImage(frontBG, 0, 0, null);
if(xMouse>33 && xMouse<163 && yMouse>414 && yMouse<454)
g.drawImage(playM, 33, 415, null);
else if(xMouse>33 && xMouse<163 && yMouse>472 && yMouse<512)
g.drawImage(resumeM, 33, 473, null);
} |
0f5bfdd5-4f95-48b4-9cf3-2e894b669406 | 3 | public String data() {
StringBuilder sb = new StringBuilder();
for (Node childNode : childNodes) {
if (childNode instanceof DataNode) {
DataNode data = (DataNode) childNode;
sb.append(data.getWholeData());
} else if (childNode instanceof Element) ... |
7c38e384-6f9c-43b3-be6c-3ab86b3be40f | 4 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Post post = (Post) o;
if (id != post.id) return false;
return true;
} |
e19422c8-8e42-4fc6-9809-394ab400ac6a | 0 | public ArrayList<String> getDoctorateTitles() {
return DoctorateTitles;
} |
5e717a37-ff2b-4c0b-9d86-06acccdc52db | 5 | public boolean optimize() {
init();
int k = 1; // the first step has been explore in init()
double gNorm, xNorm, fx_old, converge;//get the initial function value and gradient
//initial step for gradient descent
double fx = m_func.calcFuncGradient(m_g);
do {
fx_old = fx;
getSearchDirection(... |
47b0734f-5faa-4df1-b1a0-5933dde70f8f | 0 | public String getBrand() {
return brand;
} |
273e966c-2473-406c-95d1-d1744677f6ea | 4 | @Override
public Component getTreeCellRendererComponent(final JTree tree,
final Object value, final boolean sel, final boolean expanded,
final boolean leaf, final int row, final boolean hasFocusCurrently) {
// System.out.println(value);
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf,
... |
b975e9a0-9c03-4402-9719-1b59793c04ac | 7 | protected void resizeDesktop() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
int x = 0;
int y = 0;
JScrollPane scrollPane = getScrollPane();
Insets scrollInsets = getScrollPaneInsets();
if (scrollPane != null) {
JInternalFrame allFrames[] = desktop.getAllFrames();
... |
c0371cb4-58ad-48a4-818c-d4a55524517a | 1 | public void sendFile(final String filePath) {
prepareConnection();
Thread queryThread = new Thread() {
public void run() {
try {
webResource = client.resource(address + "adminPanel/upload/");
webResource.addFilter(new ConnectionListenerFilter(
new SendPackageListenerFactory()));
Client... |
b9c4d03a-74bf-49d3-a8e8-54672446c70e | 1 | public void i() {
currentProgress++;
if(currentProgress < finalProgress) {
bar.setValue((int)((currentProgress/finalProgress)*100));
} else {
bar.setValue(100);
frame.setVisible(false);
}
} |
f1011e2c-ca9f-4a13-a259-16dc849d19e2 | 8 | @Override
public void onEnable() {
setConstant(this);
long time = System.currentTimeMillis();
this.getDataFolder().mkdir();
this.saveDefaultConfig();
FileConfiguration config = getConfig();
log = config.getBoolean("Log.Enabled", true);
if (config.getDouble("Co... |
07b7ea19-f010-4231-8231-0e2c216e821f | 4 | public void run() {
if(inKnowledge(endGoal) && (endGoal.getFrom() == null || endGoal.getFrom().getPremises().isEmpty())) {
Deduction d = new Direct(endGoal);
add(d);
}
if(!proven) {
forward();
backward();
}
} |
874a4b57-97de-4f62-9d80-53d2d354d9dd | 2 | public void makeFrame() {
frame = new JFrame("Word Up");
frame.setMinimumSize(new Dimension(400, 200));
contentPane = frame.getContentPane();
buttonsPanel = new JPanel();
buttonsPanel.setLayout(new GridLayout(1,2));
submit = new JButton("Submit");
submit.addActionListener(new ActionListener()
{ public void ... |
f6b5f27e-6fc3-4ab7-ae77-f8b245eea27d | 5 | public static Direction getMostFittingDirection(int dx, int dy) {
if (dx > 0) {
if (dx > Math.abs(dy)) {
return RIGHT;
} else {
return dy > 0 ? DOWN : UP;
}
} else {
if (-dx > Math.abs(dy)) {
return LEFT;
} else {
return dy > 0 ? DOWN : UP;
}
}
} |
fa7d2b52-7093-49e2-b2d2-3f80b5838bbf | 9 | @Override
public void actionPerformed(ActionEvent ae)
{
for(int i=0;i<tempStudentLinkedList.size();i++)
{
if(ae.getSource()==tempAddButtonList.get(i))
{
System.out.println("You Found A button was clicked in the waiting Dialog For Text");
new GeneralDialogBox(sf, tempStudentLinkedList.get(i... |
96f608df-537b-49af-b635-bf1a08d9ae4d | 0 | public void addArgument(Object argument) {
arguments.add(argument);
} |
7cd27394-54cc-433b-b87a-963c1fc950b2 | 9 | public double comparePhases() {
int cycleListSize = (s1.numCycles() > s2.numCycles()) ? s1.numCycles() : s2.numCycles();
int match = 0;
int size = 0;
for (int i = 0; i < cycleListSize; i++) {
if (i >= s1.numCycles()) {
System.out.println("--CYCLE MISMATCH (IN... |
35264f6c-63e0-4565-ac8c-6bed6e2d99c7 | 3 | public Object getValueAt(int row, int col) {
Journal journal = journals.getBusinessObjects().get(row);
if (col == 0) {
return journal;
} else if (col == 1) {
return journal.getType();
} else if (col == 2) {
return journal.getId();
} else return... |
918c8a11-21d2-43ea-8e3b-306f8b711a67 | 1 | public boolean matches( Class<?> clazz )
{
return Modifier.isPrivate( clazz.getModifiers() );
} |
e421a1f2-8a4a-4350-933f-915906e3bdbe | 3 | @Override
public void preform(int source){
switch(source) {
case(0): openNewGui(References.GUI_JOINSCREEN); break;
case(1): Rocket.getRocket().player.isHost = true; openNewGui(References.GUI_LOBBY); break;
case(3): Rocket.getRocket().isRunning = false; break;
}
} |
1e0ec09a-b42e-423b-a6d5-414a7aa06fb6 | 2 | public void volcarDatos(ArrayList<Prestamos> rows){
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
while(model.getRowCount()>0)model.removeRow(0);
for(Prestamos row : rows){
Object[] fila = {
row.getFecha(),
row.getEstado(), ... |
9d948e3b-74e8-4267-9c63-484ab9b36063 | 8 | public static void printExpressionString(PrintContext p, RDFNode node, boolean nested, boolean force, PrefixMapping prefixMapping, SPINModuleRegistry registry) {
if(node instanceof Resource && SPINFactory.asVariable(node) == null) {
Resource resource = (Resource) node;
Aggregation aggr = SPINFactory.asAggre... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.