method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
90cacf03-8712-491a-9efb-f0891615d5c9 | 1 | public void tableChanged(TableModelEvent e)
{
try {
// get the index of the inserted row
//tableModel.getRowSet().moveToCurrentRow();
int firstIndex = e.getFirstRow();
// create a new table model with the new data
tableModel = new FilesTableModel(tableModel.getList(), ta... |
bc3a8af2-617f-48a9-a1cf-c9631372cb5b | 3 | public void mousePress(int x, int y){
for(ImageButton imgs : controlButtons){
imgs.mousePressed(x, y);
}
for(LoopNode node : graphedInputs){
if(node.mouseClicked(x, y)){
movingInputTime = true;
this.node = node;
System.out.println(node);
}
}
} |
7622875c-b513-420d-88b1-c30c9566f200 | 3 | private void initializeLogger() {
this.log = Logger.getLogger(this.getClass().getName());
try {
FileHandler fh = new FileHandler(this.getClass().getName()
.replace("class ", "")
+ ".log");
fh.setFormatter(new SimpleFormatter());
this.log.addHandler(fh);
} catch (SecurityException e1) {
// TO... |
f6e0d1c5-19ae-476d-a9bf-14d2fdc505dd | 7 | void setNodeDegree(ArrayList<Edge> edges){
this.incidentEdges = new ArrayList <Integer>();
//Initialize the array for saving degree over time
for (int i=0;i<this.numTimeSlices;i++){
this.degrees.add(0);
}
//For each time slice, count the number of edges containing the n... |
60bd39ad-b649-4c69-a2a8-8d5bcc524716 | 6 | int possibleMovesNum(Point[] grid, Pair pr) {
int possible = 0;
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
Point currentPoint = pointAtGridIndex(grid, i, j);
if (currentPoint.value == 0) {
continue;
}
for (Pair d : directionsForPair(pr)) {
if (isValidBoardIndex(i + d.p, j ... |
50215464-e277-40c5-b518-cfbf1ad6d954 | 8 | public static boolean download(String url, String toFile) {
// dScreen = new DownloadScreen();
try {
DownloadScreen.downLoadStarted(new File(toFile).getName()
.toString());
url = url.replace(" ", "%20");
URL urll = new URL(url);
System.out.println("Opening connection to " + url + "...");
... |
a253da8c-f002-49fd-999c-f9c0df095f73 | 7 | public String getRoomLetter()
{
if(potion + fragment + trap > 1)
{
return "M";
}
else if(damagePotion == 1)
{
return "D";
}
else if(potion == 1)
{
return "P";
}
else if(trap == 1)
{
return "T";
... |
12091e47-b040-4624-a776-6c8ee2b761e9 | 6 | private static List<PositionEntity> getMovePositionsSilver(final ChessBoardEntity b, final ChessmenEntity c) {
List<PositionEntity> result = null;
if (c.isPromote()) {
result = getMovePositionsGold(b, c);
} else {
result = new ArrayList<PositionEntity>();
PositionEntity p = null;
p = new PositionEntit... |
b1937f03-e784-4fcc-9bc4-3f53207e6403 | 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... |
08309b08-d7c7-4d27-8a41-255513cab714 | 0 | public Teacher1 getTeacher1() {
return teacher1;
} |
91593a36-de16-41ee-a267-98db8b390b20 | 1 | public boolean isInProgress()
{
return "progress".equals(status) || "start".equals(status);
} |
a1533d2c-9b89-4ddf-8783-bc948096c6b0 | 7 | private void setFiles(String[] args) {
// TODO
if (args[0] != "-x") {
if (args.length == 4) {
cipher = args[1];
blockmode = args[2];
infile = args[3];
firstoutfile = args[4] + ".txt";
finaloutfile = args[4] + "_final.txt";
} else if (args.length == 4) {
cipher = args[1];
blockmode ... |
0912645b-d79b-41df-9937-1cdb5e507ff4 | 1 | public void updateUniforms(Matrix4f worldMatrix, Matrix4f projectedMatrix, Material material)
{
if(material.getTexture() != null)
material.getTexture().bind();
else
RenderUtil.unbindTextures();
setUniform("transform", projectedMatrix);
setUniform("baseColor", material.getColor());
setUniform("ambien... |
2e39990b-576c-4f13-9c2a-8b3742a29b12 | 7 | protected void executeMoneyDrop(final MOB source, final MOB conciergeM, final Environmental possibleCoins, final CMMsg addToMsg)
{
if(possibleCoins instanceof Coins)
{
final int destIndex=destinations.indexOfFirst(source);
if(destIndex>=0)
{
Quad<MOB,Room,Double,TrackingFlags> destT=destinations.get(d... |
e4bd6199-96ab-462c-90a6-4cf651be60f6 | 4 | public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[").append(bits()).append("]");
sb.append(" ").append(type());
if (checkHealth()) sb.append(" check health");
if (grown()) sb.append(" grown");
if (grown() && type() == TreeType.WILLOW) sb.append(" branches: ").append(branches());... |
97bab972-1931-4eb9-b9c8-ec68753e766c | 2 | public void setError(String error) {
this.error = error;
try {
int retryIndex = error.indexOf("retry after ");
if (retryIndex > 0) {
int beginIndex = retryIndex + 12;
String substring = error.substring(beginIndex, beginIndex + 19);
retryAfterDate = DateUtils.getGMTConverter().convert(Date.class, s... |
6b798053-2000-4a86-92d4-b259f5a58041 | 9 | protected double generateClassValue(Instances data) throws Exception {
double result = Double.NaN;
switch (m_ClassType) {
case Attribute.NUMERIC:
result = m_Random.nextFloat() * 0.25
+ Math.abs(m_Random.nextInt())
% Math.max(2, m_NumNominal);
break;
... |
919f58cb-c9c4-4d0c-9c4e-0f62847472a2 | 6 | public Remote440 lookup(String objName, String className) throws Remote440Exception{
try {
RemoteObjectReference objRef = null;
Socket s = new Socket(registryIP, registryport);
OutputStreamWriter out = new OutputStreamWriter(s.getOutputStream());
out.write(objName+"\n");
out.flush();
Obje... |
d6b90afe-0e46-4f89-beb6-d3171319a9c9 | 4 | public static ACTIONS reverseACTION(ACTIONS value){
if(value == ACTIONS.ACTION_DOWN){
return ACTIONS.ACTION_UP;
}
if(value == ACTIONS.ACTION_UP){
return ACTIONS.ACTION_DOWN;
}
if(value == ACTIONS.ACTION_RIGHT){
return ACTIONS.ACTION_LEFT;
... |
2b658851-b81c-4961-b5ba-6418f05ac922 | 7 | public String getHtml(WikiContext context) throws ChildContainerException {
try {
if (context.getAction().equals("confirm")) {
startTask();
sendRedirect(context, context.getPath());
return "Unreachable code";
}
boolean showBuff... |
00bf82db-48cb-4d39-b8b9-21aff526c11c | 7 | private static Point[][] get64PlayersPositions() {
int maxPlayers = 64;
Point[][] pos = new Point[8][128];
for(int i = 0; i < maxPlayers;i++ ){
pos [0][i] = new Point(0,2*i);
}
for(int i = 0; i < maxPlayers/2;i++ ){
pos [1][i] = new Point(2 ,1+4*i);
}
for(int i = 0; i < maxPlayers/4;i++ ){
pos [... |
a590e3a4-a936-4791-932c-c3df7b38357b | 3 | public final int getExtendedHeaderSize() {
return ((this.grouping_identity_byte == null ? 0 : 1)
+ (this.encryption_method == null ? 0 : 1) + (this.data_length_indicator == null ? 0
: 4));
} |
ea7d1728-47ba-407a-a1bb-dd3247a1a0e5 | 7 | public boolean isAccepted() {
Iterator it = myConfigurations.iterator();
while (it.hasNext()) {
PDAConfiguration configuration = (PDAConfiguration) it.next();
if (myAcceptance == FINAL_STATE) {
State currentState = configuration.getCurrentState();
if (configuration.getUnprocessedInput() == ""
&&... |
5554a3f4-5890-4e30-890b-ba38d6640f9f | 1 | void addConstructor(CtMember cons) {
cons.next = consTail.next;
consTail.next = cons;
if (consTail == fieldTail)
fieldTail = cons;
consTail = cons;
} |
00cad2ea-0d89-4594-a70a-5732f43e398e | 1 | public QuickUnion(int n){
id = new int[n];
for(int i = 0; i < n; i++)
id[i]=i;
} |
a7dec2da-fbba-4381-9a94-04cc68d8b785 | 1 | private PrintService getPrintService() {
// This method exists since some implementations throw a runtime
// exception if no printer was ever defined on the system.
try {
return mJob.getPrintService();
} catch (Exception exception) {
return null;
}
} |
38353427-7522-4a4f-9d7e-377e14897781 | 0 | public MessageReceiver(BufferedReader inputMessageReceiver,
int fileTransferPort, int verbose) {
this.inputMessageReceiver = inputMessageReceiver;
this.fileReceiverThread = null;
this.fileTransferPort = fileTransferPort;
this.verbose = verbose;
} |
7a53b3be-dd96-46b5-936a-d463689c3218 | 1 | @Override
public void draw(Graphics g) {
// If alive, draw picture of ragnaros
if (Alive) {
g.drawImage(img1, pos_x, pos_y, width, height, null);
}
// If dead, draw explosion
else {
g.drawImage(img2, pos_x, pos_y, width, height, null);
}
} |
d976bf93-61ef-44d4-8cf3-595e96139e21 | 7 | private List<Posicao> capturasPossiveisPeaoPreto(Posicao posicao) {
List<Posicao> capturasPossiveis = new ArrayList<>();
Peca peca;
/* verifica se nao esta na primeira linha */
if (posicao.getLinha() - 1 >= 0) {
/* verifica se nao esta na primeira coluna */
if (... |
9c654cd6-3ce6-4022-8ddf-acb816be6dde | 1 | public Rabbit(boolean randomAge, Field field, Location location)
{
super(field, location);
setAge(0);
if(randomAge) {
setAge(getRandom().nextInt(MAX_AGE));
}
} |
051c546b-2e55-4815-80af-14109cb8fb1e | 1 | public default boolean checkLife() {
if (this.getCurrentHp() > 0) {
return true;
} else {
return false;
}
} |
4aea79cf-5ff3-48fe-a946-2b0720c74465 | 6 | @Override
public void slaOpdrachtOp(OpdrachtCatalogus opdrachtCatalogus,
Opdracht opdracht) {
try {
String vraag = opdracht.getVraag();
String antwoord = opdracht.getAntwoord();
int maxAantalPogingen = opdracht.getMaxAantalPogingen();
String antwoordHint = opdracht.getAntwoordHint();
int maxAntwoor... |
05f058f7-dc95-4fa9-86e4-1ef3019902de | 0 | public String getTag() {
return tag;
} |
e35bf107-04c1-4fd8-bc7e-61299b045c66 | 5 | public ArrayList<Intersection> getNeighbours(Intersection node) {
ArrayList<Intersection> neighbours = new ArrayList<Intersection>();
for (Segment seg : node.getEdges()) {
if (seg.getNodeID1().equals(node)) {
if (seg.getNodeID2() != null) {
neighbours.add(seg.getNodeID2());
}
} else if (seg.getNo... |
3ca63deb-cd09-496d-94a5-a42dd7d952f6 | 7 | public void execute(Joueur jou){
Joueur proprio = this.getProprietaire();
if(jou.equals(proprio)){
return;
}
else if(proprio == null){
Scanner sc = new Scanner(System.in);
if(this.getLoyerBase() <= jou.getCash()){
... |
6f5cd2bf-c8f9-4d34-ac1c-2b86feff575e | 4 | private static AudioFormat audioFormatFromHeaderValue(int audioFormat) {
switch (audioFormat) {
case 0:
return AudioFormat.UNSPECIFIED;
case 1:
return AudioFormat.OGG_VORBIS;
case 2:
return AudioFormat.FLAC;
case 3:
return AudioForm... |
9044caf4-9742-47bb-93f0-26e6d6e57a88 | 0 | public int GetNumberOfPersonsCreated()
{
return personsCreated;
} |
4424e1a9-23b3-4dbe-a964-91e1db1799db | 4 | private final boolean finishOldWork() throws FatalError {
Output.printClockLn("Versuche alte Aufgaben zu beenden.", 2);
boolean returnValue = false;
switch (User.getStatus()) {
case work:
returnValue = PlanArbeiten.finish();
break;
case service:
returnValue = Aussendienst.finish();
break;
cas... |
2d409ad2-7cfa-4d4f-bcda-5029dfabb81a | 8 | public int pwm() {
System.out.println(temperatureRange);
System.out.println(delay_on[temperatureRange]);
System.out.println(delay_off[temperatureRange]);
if(temperatureRange == 0 || temperatureRange == 7){
range();
return 1;
}
try{
while(Interupt == 0)
{
InLo... |
4cf666a5-56b7-4e6b-b91f-b09578e1c4bf | 6 | public boolean method577(int arg0) {
if (objectTypes == null) {
if (modelIds == null) {
return true;
}
if (arg0 != 10) {
return true;
}
boolean flag1 = true;
for (int element : modelIds) {
fla... |
12bde98a-3bba-4800-b1b1-ee07e89a137a | 4 | public void browserMoveObject(String objectName, String targetPath) {
String objectPath;
FileableCmisObject object;
if (browseFolder.isRootFolder()) {
objectPath = browseFolder.getPath() + objectName;
} else {
objectPath = browseFolder.getPath() + "/" + objectName... |
6e8136b1-a9df-41c8-a2df-c5c170bdb009 | 5 | public void act(List<Actor> newRabbits)
{
incrementAge();
incrementHunger();
if(isAlive()) {
infectionChance(newRabbits);
}
if(isAlive()) {
giveBirth(newRabbits);
// Move towards a source of food if found.
Location l... |
f3209be6-3d0a-478f-a5a4-fea53d3aa699 | 7 | @Override
public void eUnset(int featureID) {
switch (featureID) {
case statePackage.STATE__PLAYERS:
getPlayers().clear();
return;
case statePackage.STATE__COUNTRY_STATE:
getCountryState().clear();
return;
case statePackage.STATE__TURN:
setTurn((Player)null);
return;
case statePac... |
e70302b0-7c96-415b-83ff-c2efd124d688 | 9 | @Override
public void delete(Key key) {
Node x = this.root;
Node parent = x, temp;
temp = x;
while (x != null) {
int cmp = key.compareTo(x.key);
if (cmp < 0)
x = x.left;
else if (cmp > 0)
x = x.right;
... |
c0bca379-d6f8-46ee-97af-c6e959d1b693 | 3 | public void newGame(Difficulty difficulty) {
// set difficulty and creates a new board
this.height = difficulty.height();
this.width = difficulty.width();
this.nbMines = difficulty.nbMine();
this.nbFlags = 0;
cells = new Cell[width][height];
for (int i = 0; i < width; i++) {
for (int j = 0; j < heigh... |
a7074013-7800-4c22-9b95-a6ab35eba1cf | 8 | public int generateId() {
int res = 0;
File dir = new File(this.configDirectory);
File[] configs = dir.listFiles();
if (configs == null) {
return 0;
}
for (File file : configs) {
if (file.getName().equals("config.server")) {
FileInputStream fis = null;
BufferedInputStream bis = null;
B... |
fa05c495-8ad5-410a-978a-ab09a28ebd59 | 2 | public void assinar() throws IOException, Exception{
int index = s.getCertificateList().getSelectionModel().getLeadSelectionIndex();
//System.out.println(s.getSigners().get(index));
ICPBrasilSigner signer = s.getSigners().get(index);
// System.out.println(new File("xmls/1.xml").exists());... |
db442de8-047e-4186-a5dd-b04a8706ae94 | 7 | protected static <S> void verifyIsOuterClass(
Class<S> serviceClass, Class<? extends S> providerClass, Scope scope)
throws ServiceInstantiationException {
// If it's an inner class, it must be declared static
Class<?> declaringClass=providerClass.getDeclaringClass();
if (declaringClass!=null) {
Class<?>[]... |
a6a09dcd-7796-4744-ad9f-801d1703c611 | 7 | public MainWindow()
{
/**
* Initialisation des elements graphiques
*/
// Definition de la frame
frame = new JFrame("Automaton cellular");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(1100, 600));
frame.setMinimumSize(new Dimension(1100, 600));
... |
3326ae7f-c9cd-4dbf-9153-2278e27af050 | 8 | public void updateUsks(PrintStream out) throws IOException, InterruptedException {
out.println("----------------------------------------");
out.println("Finding USKs...");
out.println("----------------------------------------");
Map<String, Integer> latest = new HashMap<String, Integer>... |
c4321204-8683-4239-b8e2-c0d41fd63d69 | 1 | public synchronized void disconnectClient (int ID)
{
//Closes the socket in addition to the input and output streams
try
{
((TcpThread) flexclients.get (ID)).Soutput.close ();
((TcpThread) flexclients.get (ID)).Sinput.close ();
((TcpThread) flexclients.get (ID)).socket.close ();
}
catch (Excepti... |
c31a1d0a-9f24-4c0e-90f8-2ba95c79d189 | 7 | public void testErodingPoolKeyedObjectPool() throws Exception {
try {
PoolUtils.erodingPool((KeyedObjectPool<Object, Object>)null);
fail("PoolUtils.erodingPool(KeyedObjectPool) must not allow a null pool.");
} catch(IllegalArgumentException iae) {
// expected
... |
1dc61aef-f871-456d-b1d7-38d20f650621 | 9 | private int jjMoveStringLiteralDfa6_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(4, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(5, active0);
return 6;
}
switch(curChar)
{
case 101:
... |
3314b291-6ae4-4620-ae58-f045fe3dd0e3 | 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... |
fcf56014-eee9-4819-a729-05500e32983d | 1 | private JLabel getJLabel0() {
if (jLabel0 == null) {
jLabel0 = new JLabel();
jLabel0.setText("UPDATE OPERATION");
}
return jLabel0;
} |
a83510bb-a2bf-4352-a055-689e29bae0f7 | 3 | public static boolean[] stepPattern(boolean[] pattern) throws SolvingInitialisiationException{
boolean[] newPattern = new boolean[pattern.length];
for (int i = 0; i < pattern.length; i++){
newPattern[i] = pattern[i];
}
for (int i = 1; i < pattern.length; i++){
if (pattern[i] == false){
newPattern[i... |
66b781ee-8b24-4574-8a64-c93e0c75ab76 | 7 | @Test
public void RunHeursticsSimulator() throws Exception {
populateArray();
System.out.format("\nPerfect Cache is %b, Perfect branch predictor is %b, width is %d\n\n",perfectCache,perfect_bpred,machWidth);
for(int i=2; i<10; i++){
traceName = traceNames[i];
... |
a248d27d-82be-4547-ac9d-eae355701beb | 1 | private void setPlayers(List<Player> players) {
if (players == null)
throw new IllegalArgumentException("Players can't be null!");
this.players = players;
} |
71d37cc5-475e-4222-9841-26defaf20592 | 9 | public synchronized T lookup(String requestURI) {
if (requestURI == null) {
throw new IllegalArgumentException("Request URI may not be null");
}
//Strip away the query part part if found
int index = requestURI.indexOf("?");
if (index != -1) {
requestURI = ... |
f18689be-6145-4b43-bc7a-e4651738bc10 | 2 | public static Boolean dateIncrense(Date staticsDate){
Date d = new Date();
Date d1 = new Date();
Date d2 = new Date();
d1.setHours(0);
d1.setMinutes(0);
d1.setSeconds(0);
d2.setHours(23);
d2.setMinutes(59);
d2.setSeconds(59);
if(staticsDate.after(d1) && staticsDate.before(d2)){
return false... |
fa96af6c-cc9c-47b0-a849-05baa541a490 | 0 | public String getName() {
return this.name;
} |
ad35f13a-e282-4de2-a4fb-975e7b73f51b | 9 | public Matrix solve(Matrix B) {
if (B.getRowDimension() != m) {
throw new IllegalArgumentException("Matrix row dimensions must agree.");
}
if (!this.isNonsingular()) {
throw new RuntimeException("Matrix is singular.");
}
// Copy right hand side with pivoting
int nx = B.getColumnDime... |
edc20cdc-7876-49ab-bb81-f1b9e597cfb3 | 8 | private void generateProfileFromText() {
if (arglist.size() != 1) {
System.err.println("Need to specify text file path");
return;
}
File file = new File(arglist.get(0));
if (!file.exists()) {
System.err.println("Need to specify existing text file path"... |
9e999970-c502-4181-9eae-2ddfea029bd2 | 9 | @Override
public boolean okMessage(Environmental affecting, CMMsg msg)
{
if(!super.okMessage(affecting,msg))
return false;
final MOB source=msg.source();
if(!canFreelyBehaveNormal(affecting))
return true;
final MOB observer=(MOB)affecting;
if((source!=observer)
&&(msg.amITarget(observer))
&&(msg.t... |
78d2b35f-24c1-459f-96ab-2fc1f5498e65 | 7 | private static void possible(ArrayList<String> list, City c, int turns, int times)
{
System.out.print("Called with " + turns + " number of turns, " + times + " iterations, and contents (" + list.size() + "): ");
for (int i = 0; i < list.size(); i++)
System.out.print(list.get(i) + " ");
System.out.println();
... |
d4a19290-5433-4b6b-be83-3924891ca0f2 | 2 | private void calcHeuristic(TrieNode node) {
if (node.isLeaf()) {
node.setHeuristic(node.getDepth());
} else {
for (TrieNode child : node.getChildren().values()) {
calcHeuristic(child);
}
node.setHeuristic(getMaxChildHeuristic(node));
}
} |
c7a0fc88-fd7d-4987-b0f9-748f83a2e4a1 | 9 | private static short[] findStartInstructions(InstructionSequence seq) {
int len = seq.length();
short[] inststates = new short[len];
Set<Integer> excSet = new HashSet<>();
for (ExceptionHandler handler : seq.getExceptionTable().getHandlers()) {
excSet.add(handler.from_instr);
excSet.add(h... |
f48267f0-2191-49a3-a794-78f6681d5dee | 3 | @Override
public void update(ChiVertex<Integer, Float> vertex, GraphChiContext context) {
if (vertex.numOutEdges() == 0) return;
RealVector latent_factor = ProblemSetup.latent_factors_inmem.getRowAsVector(vertex.getId());
try {
double squaredError = 0;
for(int e=0; e... |
d47e0a92-28ad-442f-a880-265f10bbdfd3 | 5 | private void scanFile(String relativePath, File f, List<LessFileStatus> lstAddedLfs) {
if (!f.isFile())
throw new BugError("Bad file: " + f);
if (!f.getName().endsWith(".less") || ignoredList.contains(f))
return;
String lfsKey = getPathAndBaseName(f);
if (mapLessFileStatusByBaseName.containsKey(lfsKey))
... |
45af750c-3667-45d5-80df-3c2828c29681 | 8 | @Override
public void OnTrigger(Connection User, RoomItem Item, int Request, boolean UserHasRights)
{
if(User.Data.TeleporterId != 0) return; // esta usando un teleport
Room Room = Item.Environment.RoomManager.GetRoom(Item.RoomId);
if (Room != null)
{
int[] xy = Ite... |
eac4fa42-2f40-48c2-b27e-86dce7169a90 | 5 | public Object retrieve(Comparable obj, BTNode aNode)
{
Comparable answer = null;
if(obj.compareTo(aNode.getData()) == 0)
answer = (Comparable)aNode.getData();
else if(obj.compareTo(aNode.getData())>0 && !aNode.isLeaf())
answer = (Comparable)retrieve(obj, aNode.getRight());
... |
26f53e50-9a73-49a6-9a71-47b981c323b0 | 0 | public Console() {
this.open = false;
this.cheatsAllowed = false;
this.commands = new ArrayList<Command>();
//Add all the default engine commands
this.addEngineCommands();
} |
c7114a0f-b099-427e-bd26-de0ee0d2b6e5 | 4 | public static boolean downloadFile(String libName, File libPath, String libURL, List<String> checksums)
{
try
{
System.out.println(libURL);
URL url = new URL(libURL);
URLConnection connection = url.openConnection();
connection.setConnectTimeout(5000);
... |
9cc977b0-4fba-4a0a-a3ce-9ade95d321cf | 9 | private void getDijkstra(int x_, int y_) {
PixelCost pixel;
while (queue.compareTo(dijkstra[x_ + w * y_]) < 0
&& (pixel = (PixelCost)queue.pop()) != null) {
int x = pixel.x;
int y = pixel.y;
double cost = pixel.cost;
if (dijkstra[x + w * y] <= cost)
continue;
dijkstra[x + w * y] = cost;
f... |
75e712d6-6157-4d6b-9c05-fbb5c190c8dd | 9 | public static void main(String[] args) {
lerArquivo();
Treno t = new Treno(1000);
System.out.println("Lido todos os presentes");
AlgoritmoGenetico ag = new AlgoritmoGenetico(presentes, 10);
ag.inicializaCromosssomo(presentes);
for (int i = 0; i < 100; ... |
406a9b8e-025e-4988-b610-bfff0ed7d8bf | 9 | @Override
public boolean equals(Object obj) {
boolean result = false;
if (this == obj) {
result = true;
} else if(obj != null) {
DataProviderStatus status = null;
if(obj instanceof String) {
try {
status = DataProviderStatus.parse((String) obj);
} catch(Exception e) {
status = n... |
7149b29d-afc3-4dfe-9983-844c4a8a4ff9 | 8 | public void readUntil() {
try {
// String line;
while (in.readUnsignedByte() == 0) {// gets 1 byte starter
int control;
int size;
byte[] data = null;
control = in.readUnsignedShort();// gets 2 byte control
size = in.readUnsignedShort();// gets 2 byte size of data(may
// increase ... |
33eca268-d169-40c0-9e6b-e41d07b555a2 | 8 | private Object readArgument(char c) {
switch (c) {
case 'i' :
return readInteger();
case 'h' :
return readBigInteger();
case 'f' :
return readFloat();
case 'd' :
return readDouble();
case 's' :
return readString();
case 'c' :
return readChar();
case 'T' :
return Boolea... |
8889726c-f19e-4026-aa90-e8a1512ed8b3 | 0 | public ClientSocketHandler(Socket s, ClientListManager t_list) {
csocket = s;
list = t_list;
} |
d9df28c5-d400-4180-ab4b-c5b0792e827c | 9 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final MavenVersion other = (MavenVersion) obj;
if ((this.majorVersion == null) ? (other.majorVersion != null) :... |
fc6e7c4a-8ad8-4e4f-a424-f8d596f133a9 | 0 | public static void main(String[] args) {
//wap to find square of 128 without using arithmetic operator and inbuilt functions
int y=128;
int z= y<<7;
System.out.println(z);
} |
8ba7e1df-2323-440b-bd7a-2925bb4b3428 | 3 | public void sortColors(int[] A) {
int left = 0;
int right = A.length - 1;
int current = 0;
while (current <= right) {
if (A[current] == 0) {
swap(A, current, left);
left++;
current++;
}
else if (A[curren... |
fa10b66a-7f07-4f43-a846-680021ba4a89 | 4 | public void onEnable() {
persist = new Persistence(this);
persist.saveDefault();
saveDefaultConfig();
// whew all the handlers and managers...mostly
name = getConfig().getString("name");
longname = getConfig().getString("longname");
pHandler = new PlayerListener(this);
chat = new ChatManager(this);
c... |
de407732-29b3-4d18-abc0-c5e7629ad1a3 | 3 | * @param item The item to add to the queue.
* @throws FullQueueException if the queue is full
*/
public void enqueue(E item) throws FullQueueException {
if (this.isFull())
throw new FullQueueException();
array.add(null);
int index = array.size() - 1;
// Reheapify.
while (index > 1 && comp.compare(get... |
a9265c77-8992-4de7-aadf-64b732a7838e | 4 | public static void DoTurn(PlanetWars pw) {
//Retrieve environment characteristics
//Are there characteristics you want to use instead, or are there more you'd like to use? Try it out!
int neutralPlanets = pw.NeutralPlanets().size();
int totalPlanetSize = 0;
for (Planet p : pw.NeutralPlanets()) {
total... |
4db8b6d7-404f-4893-b884-0f1ea99a7ee1 | 3 | public static void main(String[] args)
{
long startTime = System.currentTimeMillis();
if(args.length == 0){
System.out.println("Please provide the location of the trace files (Workload_trace_filename FTA_Path)!");
System.exit(1);
}
try {
... |
027a0c4e-c5f5-4c52-8645-a1042078b2fe | 1 | public JPanel getCommandBtnMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.comBtn;
} |
33298044-ac17-4b5d-ad8e-b904d7900462 | 4 | public static void printDataItems(StringBuilder sb, List<? extends DataItem> items) {
for (DataItem item : items) {
printTypeRef(sb, item.getType());
sb.append(" ");
sb.append(item.getName());
if (item.isOptional()) {
sb.append("?");
}
sb.append(", ");
}
if (!ite... |
2679319f-d6cb-44c2-a10d-d04109026d88 | 2 | public Class<? extends Annotation> annotationOf(Field field) {
FieldStoreItem item = store.get(FieldStoreItem.createKey(field));
if(item != null) {
return item.getAnnotation();
}
return null;
} |
3fa64356-9c7a-4d84-9bed-74e38b947250 | 7 | @Override
public void infoSeePlayerOther(int number, boolean goalie, double distance, double direction, double distChange,
double dirChange, double bodyFacingDirection, double headFacingDirection) {
//Switch statement for custom operation of the Attackers
switch (t... |
8e1afed4-aa29-4056-b842-a713e3865bb4 | 4 | public static DatabaseEnvironment createTestEnvironment( String environment ) {
String[] temp = null;
String[] dbEnvironment = null;
if ( "H2".equalsIgnoreCase( environment ) ) {
temp = h2Parameters;
}
else if ( "ORACLE".equalsIgnoreCase( environment ) ) {
... |
169a1fc7-92e7-459f-b494-93dd94b19363 | 2 | @Override
public void Initialize()
{
super.Initialize();
instantiator = new int[sudokuSize][sudokuSize];
for (int i = 0; i < sudokuSize; i++) {
for (int j = 0; j < sudokuSize; j++) {
instantiator[i][j] = -1;
}
}
} |
d51db728-148c-471f-909c-ba5ba497e6bf | 4 | @Override
public ValueType returnedType(ValueType... types) throws Exception {
// Check the number of argument
if (types.length == 1) {
// if array
if (types[0] == ValueType.NONE) {
return ValueType.NONE;
}
// If numerical
if (types[0].isNumeric()) {
return ValueType.DOUBLE;
}
// if ... |
a674935f-493e-4821-b5c0-b8fce9582a35 | 7 | private void modelsFromGrid(Grid grid, double[][] heightMap)
{
for (int r = 0; r < grid.rows; r++)
{
for (int c = 0; c < grid.cols; c++)
{
Tile t = grid.getTile(r,c);
for (BaseEntity en: t.occupants)
{
Group candidate = LevelManager.loadFromXML(EntityData.getUniqueModel(en.name), "partTextur... |
31f852e8-a650-4e82-9a90-cb4bc34dbf79 | 0 | public int getDv() {
return dv;
} |
228de7c9-8ec2-4983-ad7d-5e9ddb93ec17 | 4 | public static String lTrimKeepTabs(final String value) {
if (value == null) {
return null;
}
String trimmed = value;
int offset = 0;
final int maxLength = value.length();
while (offset < maxLength && value.charAt(offset) == ' ') {
offset++;
... |
f6ec596f-8192-49bf-9e14-5e010ea5335a | 6 | @Override
public void run()
{
while ( !socket.isClosed() )
{
try
{
Socket connection = socket.accept();
try
{
requestHandler( connection );
}
finally
{
try
{
if ( !connection.isClosed() )
connection.close();
}
catch ( IOException e )
{
... |
7b53407c-7069-462b-bc28-348c37133e99 | 4 | public void moveParticle(Random rand) {
int[] copyProjectWorkUnitIndexes =
new int[projectWorkUnitIndexes.length];
System.arraycopy(
projectWorkUnitIndexes,
0,
copyProjectWorkUnitIndexes,
0,
projectWorkUnitIndexes.length
);
List<Integer> mutationIndexes = new ArrayList<Integer>... |
64bdec03-727d-4fe3-b8f7-5359bf11670d | 7 | private static boolean isGeometricallyConnectedAtOnlyOneEnd(Spring spring1, Spring spring2) {
Point2D spring1Point1 = spring1.getLine().getP1();
Point2D spring1Point2 = spring1.getLine().getP2();
Point2D spring2Point1 = spring2.getLine().getP1();
Point2D spring2Point2 = spring2.getLine()... |
1b3790f6-4e85-4461-83a5-2d502471b6c1 | 8 | private void handleHeaderField(Field field) throws HaltProcessingException, ParseException {
// If we don't have a field, no point continuing.
if (field == null) {
return;
}
Header header = Header.findHeader(field.getName());
// If we didn't resolve the header, then... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.