method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
229070a5-7d2b-4811-aef4-1a551f4a7435 | 0 | private PreparingNewAlgos(){
/* NOP */
}; |
9055793d-1546-44f7-98a8-e717b233032b | 9 | private String createUsageList(String className, String parentClass) {
String sHtmlPreMethodList = "";
if (alItemUsage.size() <= 0) {
return sHtmlPreMethodList;
}
//Build a list containing all of the things that refer to the item we're looking for
List<String> usage... |
69fd6699-32bc-47a1-ba36-47c5f338c301 | 5 | public ArrayList<Residue> turnIntoResidueArray(ArrayList<Atom> atomList,
ArrayList<String> dsspFile, double bFactorMean, double bFactorSTD) {
int residueAtoms=1, curResNum, oldResNum;
double currentResidueBFactor=0, meanOfCurrentResidue, zScore;
boolean cTerm = false, nTerm = false;
Atom curAtom, oldAt... |
946d044c-5bd7-4d71-8aa6-51eb26e2fba8 | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
// when this spell is on a MOBs Affected list,
// it should consistantly prevent the mob
// from trying to do ANYTHING except sleep
if((msg.amISou... |
faa2c619-c53f-4a6b-b0bc-644bf1d39f4a | 1 | public static float[] scale(float[] arr, float factor){
for (int i = 0 ; i < arr.length; i++){
arr[i] = arr[i] * factor;
}
return arr;
} |
e44bc8a0-de09-42c8-8905-21dc842ee68a | 3 | private void transpose(int[][] board) {
if (board.length != board[0].length) {
throw new UnsupportedOperationException();
}
int n = board.length;
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
int buf = board[i][j];
... |
6911af98-beb1-4e98-8f7f-6fb0e25be268 | 6 | public static String getCMDKeyForDelimitedFile(final MetaData columnMD, final List<String> lineElements) {
if (!columnMD.isAnyRecordFormatSpecified()) {
// no <RECORD> elments were specifed for this parse, just return the
// detail id
return FPConstants.DETAIL_ID;
}
... |
70ae15a2-a8cb-43af-b7b9-6acfbbebeb84 | 8 | public boolean almostEquals(Object obj){
if (this == obj)
return true;
if (getClass() != obj.getClass())
return false;
MixedNumber other = (MixedNumber) obj;
if (fraction == null) {
if (other.fraction != null)
return false;
} else if (!fraction.equals(other.fraction))
return false;
if (numer... |
d9d4ba8a-56a3-46e2-b57e-4caeaef9d0c5 | 9 | public static boolean networkFinder(Board board, BoardNode node, int numNodes, int prevDir){
//base case - node is a goal and numNodes of that color >= 6
if(Board.isEndingNode(node, node.getColor()) && numNodes >= 6){
return true;
}
node.changeVi... |
ed871fd7-402d-414a-bbc8-df60f19c417c | 0 | public Object clone() {
return new Sprite(anim);
} |
a8b5d9cd-395d-44a3-9710-48d0e00e473e | 7 | static void test3()
{
try
{
Reader in = new StringReader(
"<P><B>Please contact Public Affairs Division for the text of the paper " +
"& the authors for further comment</B> </P> " +
"a & b" +
"a AT&T& b" +
"a && b" +
"a <& b" +
"a &> b" +
""
);
... |
0bf32ccd-b936-406f-875a-dd4019f0df83 | 3 | @Override
public boolean execute(CommandSender sender, String identifier,
String[] args) {
try {
ArrayList<String> list = new ArrayList<String>();
String titles = "";
list = DBManager.getAllTitles();
if (list.size() >= 1) {
for (String id : list) {
titles += id + ", ";
}
titles = ti... |
b1fa45a1-36aa-41a6-97a3-0f149c8770bd | 9 | public CostFunction add(CostFunction cf){
SortedMap<Integer, Integer> result = new TreeMap<Integer, Integer>();
// list of all costs
SortedSet<Integer> values = new TreeSet<Integer>();
values.addAll(this.costByDemandMap.values());
values.addAll(cf.costByDemandMap.values());
// add to result
for(in... |
1377b722-b7c6-4117-96b2-be61458a57e7 | 5 | StringBuffer generateLayoutCode () {
StringBuffer code = new StringBuffer ();
code.append ("\t\tFillLayout fillLayout = new FillLayout ();\n");
if (fillLayout.type == SWT.VERTICAL) {
code.append ("\t\tfillLayout.type = SWT.VERTICAL;\n");
}
if (fillLayout.marginWidth != 0) {
code.append("\t\tfillLayout.m... |
69911c14-a221-4438-8967-838e31e2322b | 3 | public void push(Move m) {
if (this.numUndo == UndoStack.UNDO_MAX) {
for(int i = 1; i <= this.numUndo - 1; i++) {
this.undoStack[i - 1] = this.undoStack[i];
}
this.numUndo--;
}
this.undoStack[this.numUndo] = m;
if (this.numUndo < UndoStack.UNDO_MAX) {
this.numUndo++;
}
} |
d8119c9c-9340-4f0d-8692-74332d83e78d | 2 | @Override
public boolean reachesDestination(Packet p) {
// TODO Auto-generated method stub
Iterator<Edge> edgeIt = p.origin.outgoingConnections.iterator();
EdgeRate e;
while(edgeIt.hasNext()){
e = (EdgeRate) edgeIt.next();
if(e.endNode.equals(p.destination)){
etxLink = e.getEtx();
}
}
doubl... |
1ba79429-cf38-4753-9360-bc5cec93be1d | 2 | public void addBranch(final Label label) {
if (ClassEditor.DEBUG || CodeArray.DEBUG) {
System.out.println(" " + codeLength + ": " + "branch to "
+ label);
}
branchInsts.put(new Integer(codeLength), new Integer(lastInst));
branches.put(new Integer(codeLength), label);
addByte(0);
addByte(0);
} |
4a2196dd-2814-404f-84ee-e57b2526eded | 3 | public boolean attachNext(Linkable paramLinkable)
{
boolean b = false;
if ((paramLinkable instanceof Instruction))
{
Instruction localInstruction = (Instruction)paramLinkable;
if ((localInstruction.getPreviousInstruction() == null) && (getNextInstruction() == null))
{
localInstr... |
334af9f1-f338-4265-8c28-fc32c30c2304 | 2 | private void formTourSearchList(SessionRequestContent request) throws ServletLogicException {
Criteria criteria = new Criteria();
criteria.addParam(DAO_ID_DIRECTION, request.getAttribute(JSP_ID_DIRECTION));
User user = (User) request.getSessionAttribute(JSP_USER);
if (user != null) {
... |
d841182b-a1c0-42af-9f99-ae0ddbec1aba | 0 | public void onDisable(){
} |
740707ca-7986-43c7-b786-5db2bd514696 | 9 | @Override
public final boolean incrementToken() throws IOException {
clearAttributes();
int length = 0;
int start = bufferIndex;
char[] buffer = termAtt.termBuffer();
while (true) {
if (bufferIndex >= dataLen) {
offset += dataLen;
dataLen = input.read(ioBuffer);
if (... |
72abbbaf-e3db-4526-8c0b-a8f7b7067ebb | 6 | public terrain.Base getTile(int i) {
switch(i) {
case 0:return new terrain.Dirt();
case 1:return new terrain.Forest();
case 2:return new terrain.Mountain();
case 3:return new terrain.Water();
case 4:return new terrain.City();
case 5:return new terrain.Road();
default:return null;
}
} |
39df1544-1ba9-406c-914c-56a1548957c8 | 5 | public void checkType(Symtab st) {
exp1.setScope(scope);
exp1.checkType(st);
exp2.setScope(scope);
exp2.checkType(st);
if (!exp1.getType(st).equals(exp2.getType(st))) {
if (!exp1.getType(st).equals("int")
&& !exp1.getType(st).equals("decimal")) {
Main.error("type error in eqeq!");
}
if (!exp... |
c683ead4-c6c0-4a05-8170-a477025f073d | 0 | public void setType(String type) {
this.type = type;
setDirty();
} |
fc4dd3f5-4f2b-4351-8602-f0659effa557 | 4 | private Configuration() {
paths = new HashMap<String, String>();
Yaml c = new Yaml();
try {
conf = c.loadAs(new FileReader("main_conf.yaml"),
ConfigurationBean.class);
} catch (FileNotFoundException e) {
//Logger.e("Impossible de charger la configuration principale"
// +... |
9f6998ce-3e36-4fac-a0bc-aecda273cf66 | 1 | public int columnForSymbol(String symbol) {
Integer in = (Integer) symbolsToColumn.get(symbol);
if (in == null) {
throw new IllegalArgumentException(symbol
+ " is not in the grammar!");
}
return in.intValue();
} |
f466d65a-77b0-45f7-bbe7-f48da5432667 | 4 | public void process(char c)
{
if (output == null || lastChar != c)
{
createOutputImage(c);
lastChar = c;
}
Graphics2D g = output.createGraphics();
int height = input.getHeight(),
width = input.getWidth(),
ascent = metrics.getAscent(),
charWidth = metri... |
e8c1a0a2-aa1a-486c-b61d-9fab000b1a90 | 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... |
0426a20b-48d1-497a-8e74-3af443b515ba | 4 | @EventHandler
public void onButtonClick(ButtonClickEvent event)
{
SpoutPlayer sPlayer = event.getPlayer();
friendsList list = new friendsList(sPlayer, plugin);
levels stats = new levels(sPlayer, plugin);
if (event.getButton() instanceof friendsListButton)
{
sPlayer.getMainScreen().closePopup();
sP... |
07b508f4-a581-425e-8897-98f5a803f83a | 9 | private void startListenerThread()
{
new Thread(){
@Override
public void run()
{
String packetData = null;
RadiogramConnection dgConnection = null;
DatagramConnection dgSendConnection = null;
Dat... |
99789616-c0d3-458f-bd15-262abd10b4eb | 6 | @Override
public void action() {
if(agente.getPasso() == 4){
Iterator<AID> itTMP = agente.getAgentesVendedores();
int cont = 0;
while(itTMP.hasNext()){
itTMP.next();
cont++;
}
if(agente.getPropostas().size() > 0 && agente.getPropostas().size() == cont){
System.out.printl... |
3989c834-a6e0-4cc5-999b-ee890446860b | 3 | static int gcd(int p, int q) throws IllegalArgumentException {
if (q < 0 || p < 0) throw new IllegalArgumentException("Integers must be non-negative");
if (q == 0) return p; // base case
int r = p % q;
return gcd(q, r);
} |
2bf1c683-a941-444f-9f79-43c893800a28 | 2 | @Test
public void testExpand() {
IntListHashMap m = new IntListHashMap(10);
for(int i=1; i<=1000; i++) {
m.put(1, i);
}
IntIterator ii = m.getReverse(1);
assertNotNull(ii);
for(int i=1000; i>=1; i--) {
assertTrue(ii.next());
assertEquals(i, ii.get());
}
assertFalse(ii.next());
} |
d81d58eb-2252-4135-a84b-ec92a052a411 | 0 | @Override
protected void doOperate1() {
System.out.println("doOperate 1");
} |
3008f091-39bc-43b1-98e2-b86bc5a571de | 1 | public void setij(int i, int j, int x)
{
assert (i<n) && (j<m);
A[i][j] = x;
strize();
} |
cd8e975f-7503-4d24-b997-caf6bf9104d6 | 3 | public void saveDataToFile()
{
FileConfiguration config = getConfig();
/*
* save cache data to file
*/
for(AGPlayer p : pH.getPlayers())
{
//remove old saves
config.set(p.getName(), null);
List<String> shrineNames = new ArrayList<String>();
for(Shrine s : p.getFoundShrines())
... |
642422e9-551d-4a8f-afff-80d433a47403 | 2 | public void setPathAndType(String path) {
this.path = path;
if (path != null && path.lastIndexOf(".") != -1) {
this.type = path.substring(path.lastIndexOf("."));
} else {
this.type = "";
}
} |
ba6d666d-6f91-4593-a852-b816aaeaf382 | 8 | protected void destroy()
{
try{close();}
catch (IOException e){LogSupport.ignore(log,e);}
catch (Exception e){log.warn(LogSupport.EXCEPTION,e);}
// Destroy request and response
if (_request!=null)
_request.destroy();
if (_response!=null)
... |
6eb3c46a-c52e-4338-88db-53c50cdff378 | 2 | public Map<String, Row> getAll(String tableName) throws DataBaseTableException {
Map<String, Row> resultMap = new HashMap<String, Row>();
for (DataBase db : databases.values()) {
Map<String, Row> allInCurrentDB = db.getAll(tableName);
for (String key : allInCurrentDB.keySet()) {... |
2acf3658-7578-4ef8-8bf4-98e360c80659 | 9 | private final void method2592(byte[] is, int[] is_24_, int i, int i_25_,
int i_26_, int i_27_, int i_28_, int i_29_,
int i_30_, int i_31_, int i_32_, int i_33_,
aa var_aa, int i_34_, int i_35_) {
aa_Sub3 var_aa_Sub3 = (aa_Sub3) var_aa;
int[] is_36_ = ((aa_Sub3) var_aa_Sub3).anIntArray5201;
int[] is... |
d620819c-e6b2-4755-8d8d-99d16b188ccc | 0 | private int getVersion(String version){
return Integer.parseInt(version.substring(0,version.indexOf(".")))*16+Integer.parseInt(version.substring(version.indexOf(".")+1));
} |
31058c60-03d6-4686-a7aa-58126840231b | 7 | public String toString() {
StringBuffer result;
int i;
result = new StringBuffer();
// title
result.append(this.getClass().getName().replaceAll(".*\\.", "") + "\n");
result.append(this.getClass().getName().replaceAll(".*\\.", "").replaceAll(".", "=") + "\n\n");
if (m_Citers == n... |
fabaad14-401a-432d-b951-5f615f6cf178 | 6 | public final long nextLong()
{
if(mti >= 624)
{
int i2;
for(i2 = 0; i2 < 227; i2++)
{
int i = mt[i2] & 0x80000000 | mt[i2 + 1] & 0x7fffffff;
mt[i2] = mt[i2 + 397] ^ i >>> 1 ^ mag01[i & 1];
}
for(; i2 < 623; ... |
553f11e7-d445-4c6d-b8ae-f6578e224905 | 7 | public int numDecodings(String s) {
if (s == null || s.length() == 0 || s.charAt(0) == '0') return 0;
int f0 = 1, f1 = 1;
for (int i = 1; i < s.length(); i++) {
int d1 = s.charAt(i) - '0';
int d0 = s.charAt(i - 1) - '0';
// in normal case, f1 = f1 + f0;
... |
f2f3dcfa-cda7-400d-b197-ed61023136b7 | 6 | public static int getDiceNum(ImageIcon icon)
{
if (icon == diceImage1)
return 1;
else if (icon == diceImage2)
return 2;
else if (icon == diceImage3)
return 3;
else if (icon == diceImage4)
return 4;
else if (icon == diceImage5)
return 5;
else if (icon == diceImage6)
return 6;
else
ret... |
d0312517-955d-4bc1-8b6f-0b11bc0d732c | 6 | @SuppressWarnings("static-access")
public void exit() throws IOException, InterruptedException {
tracker.setEvent(tracker.EVENT_STOPPED);
stopThreads = true;
trackerThread.interrupt();
socketListener.disconnect();
paThread.interrupt();
peerDisplay.interrupt();
for (Peer p : peers)
{
if (p.amConn... |
7e13f8aa-e925-41bc-99f1-639911c7dbef | 2 | RelatedSearchResponse(JSONObject jsonObject) {
super(jsonObject);
if (this.Count > 0) {
JSONArray results = (JSONArray)jsonObject.get("results");
@SuppressWarnings("unchecked") Iterator<JSONObject> iterator = results.iterator();
while (iterator.hasNext()) {
JSONObject suggestionObject = (JSONObject)... |
d3676a46-f8a3-402f-b544-6710ca3bbb68 | 1 | public static ArrayList<Excel> scale(int coeff, ArrayList<Excel> toScale)
{
ArrayList<Excel> result = new ArrayList<Excel>();
double matrix[][] = { {coeff, 0,0,0},
{0, coeff,0,0},
{0, 0,coeff,0},
{0, 0, 0, 1}
};
Matrix scaleMatrix = new Matrix(4,4);
scaleMatr... |
f53a8ef6-d347-41a4-a73b-e71c4a6f36a4 | 3 | private void initializeGUI() {
GraphicsEnvironment env = GraphicsEnvironment
.getLocalGraphicsEnvironment();
if (env.isHeadlessInstance()) {
System.out.println("Graphics not supported");
System.exit(0);
}
this.window = new JFrame("Worms");
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
wi... |
abf2f7b3-4c00-4a62-9665-2b8688db0515 | 3 | public Entity createEnemySpawner(double threshold){
Entity spawner = new Entity(NullRenderer.NULL_RENDERER, NullControl.NULL_CONTROL);
switch(config.getEnemyDirections()){
case RANDOM:
addRandomDirectionComponents(spawner, threshold);
break;
case MAIN_AXES:
addMainAxesComponents(spawner, threshold... |
9a82646e-d9f5-494f-8826-a8c8eb87d469 | 6 | public static JButton getAttackThrowButton() {
if (attackThrowButton == null) {
attackThrowButton = new JButton("Throw");
attackThrowButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int dice = ((Dice) attackSpinner.getValue())
.getDiceNumber();
... |
72e92397-23e6-46ae-b4c1-2150e8560bc4 | 3 | @Override
public boolean equals(final Object o) {
if (!(o instanceof Vector))
return false;
final Vector v = (Vector) o;
return x == v.x && y == v.y && z == v.z;
} |
a0773aab-cd3c-478d-b721-117fa093de75 | 5 | public static final void itemSort2(SeekableLittleEndianAccessor slea, MapleClient c) {
slea.readInt(); // timestamp
byte mode = slea.readByte();
if (mode < 0 || mode > 5) {
return;
}
MapleInventory Inv = c.getPlayer().getInventory(MapleInventoryType.getByType(mode));
... |
abb38fbc-dbbe-4b5d-be07-542f935a1274 | 1 | public boolean canReceive() {
boolean isAvailable = inputAvailable.tryAcquire();
if(isAvailable) {
inputAvailable.release();
return true;
} else {
return false;
}
} |
34403726-83f9-4dbe-8228-0e7a399acdfd | 5 | public String guessContentType() {
for (int idx = 0 ; idx < body.length() ; idx++) {
char c = body.charAt(idx);
switch (c) {
case ' ':
continue;
case '<':
return "application/xml;charset=UTF-8";
case '{':
return "application/json;charset=UTF-8";
case '[':
return "application/... |
50a1b3ea-88fa-417b-abdc-304326eacf95 | 3 | public void inputEndOfHand(ActionList history, GameState gameState) {
int handStrength = gameState.knownCards.evaluateOpponentHand();
GameInfo gameInfo = gameState.gameInfo;
if(handStrength != -1) {
int numRaises = history.numberOfRaises();
// calculate adjusted hand strength
int ahs = adjustedHan... |
bca2ca4f-ca42-4cfc-b395-648910f3dfb1 | 4 | private String handleCanteenInformation(Dialog currentDialog) {
CanteenDialog dialog = (CanteenDialog) currentDialog;
CanteenData canteenData = dialog.getCurrentCanteen().getCanteenData();
ArrayList<MealData> todayMeals = new ArrayList<MealData>();
for( LineData line : canteenData.getLines()) {
todayMeals.ad... |
84201105-3e2a-4c4b-a591-8c7c300e582a | 0 | RLOGObjectProperties() {
this.uri = "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/rlog#" + name();
} |
30d3a615-24a2-4b16-89f1-2aa80c5a22ad | 0 | public void setNeedReport(int needReport) {
NeedReport = needReport;
} |
e01fe2a7-e33e-46b7-abfb-15f6efd54253 | 2 | @Override
public void run() {
try {
InputStream input = socket.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
String line;
while ((line = reader.readLine()) != null) {
window.setChatHistoryText(line);
}
} catch (IOException e) {
e.printStackTrace(... |
14444535-ffcb-4641-a738-2db9c74de7c1 | 9 | public Block randomBlock () {
int counter = 0;
for (int i = 0 ; i < blocks.length ; i++)
for (int j = 0 ; j < blocks[0].length ; j++)
if (blocks[i][j].lifeform == null && blocks[i][j].value== LAND)
counter++;
//Choose a block, any block
int x = (int)(Math.random () * counter);
for (int i = 0 ; ... |
76707786-7635-4442-ab6a-047c8cb828b2 | 3 | private static boolean send(String command) {
try (Socket client = new Socket();) {
client.setSoTimeout(SOCKET_TIMEOUT);
SocketAddress address = new InetSocketAddress(InetAddress.getByName("localhost"), DaemonEventServer.PORT);
client.connect(address, SOCKET_TIMEOUT);
PrintStream out = new PrintStream(cl... |
37f8b896-2eeb-4f43-9945-65e85ed989da | 1 | public void printBoard(String[] board){
for(int i =0 ;i< board.length;i++)
System.out.println(board[i]);
} |
09535b3d-63ba-4be0-9c7d-486593cf8460 | 2 | static X509Certificate generateCertificate(String issuee, String issuer, int days, String algorithm)
throws GeneralSecurityException, IOException {
//need to impose a 16 character minimum
if(issuee.length()<16||issuer.length()<16){
System.out.println("Issuee/ issuer names not long enough. There is a 16 cha... |
f6266e61-a3ce-4b9d-8dd7-d592d3e46b7b | 8 | protected Defuzzifier extractDefuzzifier(String line) {
List<String> token = Op.split(line, ":");
if (token.size() != 2) {
throw new RuntimeException("[syntax error] "
+ "expected property of type (key : value) in line: " + line);
}
String name = token.get... |
0e9ab8dd-685e-4d9a-bd4c-779db9e3b654 | 2 | public static void main(String[] args) {
Sequence sequence = new Sequence(10);
for (int i = 0; i < 10; i++)
sequence.add(Integer.toString(i));
Selector selector = sequence.selector();
while (!selector.end()) {
System.out.print(selector.current() + " ");
selector.next();
}
} |
00030729-6048-4fe3-8caa-3dba474ecf89 | 0 | public WhereIterator(Iterable<T> source, Predicate<T> predicate)
{
this._predicate = predicate;
this._source = source.iterator();
} |
889a84ce-0736-47fd-b51a-25db3bed15f1 | 4 | public void retry(String query) {
boolean passed = false;
Connection connection = open();
Statement statement = null;
while (!passed) {
try {
statement = connection.createStatement();
statement.executeQuery(query);
passed = true;
} catch (SQLException ex) {
if (ex.getMessage().toLowerCa... |
88ba61ad-abf3-48e0-ba91-caa48d24a4d4 | 5 | public String getDescription() {
if (environment.getFile() == null)
return "<untitled" + myNumber + ">";
else if(environment.myObjects!=null && environment.getActive()!=null && (environment.getActive() instanceof EditorPane || environment.getActive() instanceof GrammarInputPane)){
return envir... |
5adfb4dd-e01f-4d7c-bd89-547b1bfdfba4 | 7 | public static Rule_dirSource parse(ParserContext context)
{
context.push("dirSource");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList<Rule>();
... |
d10b3b6c-dd43-4109-b89f-bbdca7646ab9 | 2 | private static void saveImage(JFrame f){
BufferedImage img = new BufferedImage(f.getContentPane().getWidth(),f.getContentPane().getHeight(),BufferedImage.TYPE_INT_RGB);
Graphics g = img.getGraphics();
f.getContentPane().printAll(g);
try {
FTPConfig config = FTPConfig.LoadConfig(... |
0a59e44e-0533-4bf8-9d02-1f0ca12d733c | 3 | public String getAnswersName()
{
if (answerSide == null)
return null;
switch (answerSide)
{
case LEFT:
return namesManager.getLeftName();
case RIGHT:
return namesManager.getRightName();
default:
... |
db1c2189-c9de-4edc-87e9-95f56676f99f | 8 | public Lista getCandidato(double pRandom)
{
System.out.printf("Numero entre 0 y 1: " + "%3.2f",pRandom);
System.out.println();
double Porcentaje = -1;
for(int i = 0; i < _ListaDePorcentajes.size()-1 && Porcentaje == -1; i++)
{
if(_ListaDePorcentajes.get(i) <= pRan... |
434f43b6-d625-479f-9311-f974d8a729ae | 7 | public ConfigurationSerializable deserialize(Map<String, Object> args) {
ConfigurationSerializable result = null;
Method method = null;
if (result == null) {
method = getMethod("deserialize", true);
if (method != null) {
result = deserializeViaMethod(me... |
faaead89-991f-4cda-aa63-09fc2983bdf1 | 8 | public Shot(Entity shooterEntity, int theta, GameState gs, Player shooter, int weaponType) {
this.gs = gs;
this.weaponType = weaponType;
this.theta = theta;
this.player = shooter;
if (this.weaponType == Settings.DEFAULT_WEAPON) {
this.weapon = new DefaultWeapon(theta);
} else if (this.weaponType == Sett... |
baad60d6-b7e1-4f38-bfe0-6187330a4e99 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficien... |
fadb1d7c-a340-49f4-8b48-4052d24b141b | 6 | public void run(){
if (udpClient == null){
switch(client.getLocalPort()){
case 8080:
tcpUpload();
break;
case 8000:
tcpDownload();
break;
case 3962:
httpHandler();
break;
}
}
else{
switch(udpClient.getLocalPort()){
case 6001:
udpUpload(... |
ced8ec36-6132-48f4-9c57-55e4f31ff13c | 5 | @Override
public void run() {
try{
while(true){
Object ob = null;
if(stop)
break;
if((ob = in.readObject()) != null){
Message m = (Message)ob;
if(m.getType... |
e963ba31-31a6-4641-a97f-d629f12a6aff | 2 | @Test
public void testConversion()
{
try
{
Time time = new Time(1,2,3);
byte[] data = Utils.object2Bytes(time);
Time newTime = (Time) Utils.bytes2Object(data);
Time badTime = new Time(3,2,1);
assertEquals(newTime, time);
ass... |
b988a851-962d-4af7-873b-4d418195769b | 4 | @Test
public void getequal2test() throws Exception{
membercollectm.getequal2("1123158","00000000");
try{
int count =0;
@SuppressWarnings("resource")
ObjectInputStream osi = new ObjectInputStream(new FileInputStream("membercollectiontest.txt"));///óϾ , Ͼ׳ϴ° ҽ߰
membercollectm.setMemberCount(osi.readInt(... |
ae38dca7-d356-43c6-b11b-dfd6b2d45713 | 4 | public boolean isRegistered(String name, String password) {
boolean isRegistered = false;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
conn = ConnectionPool.getInstance();
String query = "select count(*) from users where name=? and password=?";
// creat... |
71f7ab94-1f34-4407-bc19-90502250cebd | 8 | private void populate()
{
Random rand = Randomizer.getRandom();
field.clear();
for(int row = 0; row < field.getDepth(); row++) {
for(int col = 0; col < field.getWidth(); col++) {
if(rand.nextDouble() <= fox_creation_probability) {
Location loca... |
352620cb-71b2-45f0-9d66-6de5bbea26eb | 7 | public static TreeMap<Pilot, Integer> findMostFrequentAssistants(
ArrayList<Kill> killboard, String nameOfPilot) {
TreeMap<Pilot, Integer> occurrence = new TreeMap<Pilot, Integer>();
if (killboard.isEmpty()) {
return null;
}
for (Kill K : killboard) {
if (K.getVictim().getPilot().getCharacterName()
... |
941593c9-1f55-4753-b9f7-0fcf7040af47 | 2 | public FieldOperator(MethodAnalyzer methodAnalyzer, boolean staticFlag,
Reference ref) {
super(Type.tType(ref.getType()));
this.methodAnalyzer = methodAnalyzer;
this.staticFlag = staticFlag;
this.classType = Type.tType(ref.getClazz());
this.ref = ref;
if (staticFlag)
methodAnalyzer.useType(classType);... |
a0973a10-a63a-40ac-aca8-de1f7844965f | 6 | public void print() {
int nblock = 0;
for (int i = 5; i >= -5; i--) {
for (int j = -5; j <= 5; j++) {
if (this.exist(j - this.getMovedX(), i - this.getMovedY())) {
System.out.print("X");
if (nblock < blocks.length-1)
... |
aa12ece6-c7eb-493a-945d-64f4b736f30b | 5 | @Override
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass())
return false;
final Currency other = (Currency) obj;
if (!this.code.equalsIgnoreCase(other.code)) return false;
if (!this.name.equalsIgnoreCase(other.name)) re... |
5a654099-e76f-4868-9713-e5d8a3cad2b5 | 7 | boolean find(int[] Y1, int[] Y2){
visited[value(Y1)] = true;
int n=Y1.length;
boolean found=true;
for(int i=0; i<n; i++){
if(Y1[i]!=Y2[i]) found=false;
}
if(found) return true;
for(int i=0; i<n-1; i++){
for(int j=i+1; j<n; j++){
... |
61f818be-7df2-419e-be80-a3ed81ababcb | 6 | @SuppressWarnings("deprecation")
@EventHandler
public void onQuit(PlayerQuitEvent e) {
Player p = e.getPlayer();
if (Frozen.gameStarted) {
if(Frozen.players.contains(p.getName())){
Frozen.totalAlive--;
Frozen.players.remove(p.getName());
Frozen.gameScoreboard();
}
if (Frozen.totalAlive == 1)... |
e0b4d994-36b4-4217-8b6e-b947f8c440e0 | 4 | private void heapify(int indexOfParent) {
/**
* First declare all relevant variables for clarity
*/
int indexOfLeftChild = left(indexOfParent);
int indexOfRightChild = right(indexOfParent);
int indexOfSmallerChild;
E parent = heap.get(indexOfParent);
E l... |
d22cfb8f-c980-4878-bbed-e2d7872d6db2 | 0 | public String getAihao() {
return aihao;
} |
f4dd214c-bb71-4578-9e42-c2409531ac04 | 4 | public void displayUnassignedAssets(){
try {
SetOfAssets unassignedAssets = new SetOfAssets();
ResultSet dbAssetResults = null;
Statement statement;
statement = connection.createStatement();
dbAssetResult... |
91616ff7-3097-4258-a3f2-57632da20260 | 2 | public void addRecord(String data) throws Exception {
Record rec = new Record(data);
if (isNameExists(rec.name)) {
remove(rec.name);
throw new Exception("This name already exists.");
}
String content = "";
String lineSeparator = System.getProperty("line.se... |
a65a1dbe-3e28-4b30-bd4b-7a70d12a6712 | 4 | private synchronized void makeTurn(Packet packet) {
if(!gameIsRun || !playerState.isActive() || players.indexOf(playerState) == currectPlayer) {
sendToClient(Packet.getIncorrectTurnPacket());
return;
}
TurnCoordinate tc = (Tur... |
4143071b-a5db-41e8-9f47-482915d5e6ac | 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://download.ora... |
0abb4bae-be59-4dc8-98bd-53158584229b | 8 | private static boolean solveStage(Field f, int area) {
if (area == 9)
return true;
Set<Integer> addable = new HashSet<Integer>(defElems);
for (FieldSlot s : f.areas.get(area)) {
addable.remove(s.getValue());
}
Permutation p = new Permutation(addable);
Stack<Integer> first = p.getNext();
if (first.is... |
e7f159ca-1503-4603-b154-271f4b7e5184 | 4 | public static void main(String[] args) {
Random prng = new Random();
Integer[] test_array1 = new Integer[30];
Integer[] test_array2 = new Integer[30];
Integer[] test_array3 = new Integer[30];
for (int i = 0; i < 30; i++) {
int temp = prng.nextInt(50);
test... |
dd05bb69-4051-4c57-bb42-2b76b3294640 | 3 | public boolean makeMove () {
/* Uses nested else and if statements to either fix a mistake or fill in an empty space */
if (findMistake() == false) {
if (addNumberToBoard()) {
return true;
} else {
if (updateEmptySpace()) {
return true;
}
return false;
}
} else {
return true... |
cd8c4da6-8b8c-406c-a68f-c01f0d6df385 | 2 | public void loadFile() {
try {
FileReader fr = new FileReader(file);
char[] buff = new char[(int) file.length()];
if (Compiler.verbose())
System.out.println("Reading file...");
fr.read(buff);
fr.close();
text = new String(buff);
} catch (IOException e) {
e.printStackTrace();
}
} |
502345ac-8599-4964-8c61-cd8a62d2129f | 0 | public int getYSize() {
return ySize;
} |
e384c74d-e4a7-40e8-98d6-d74d4c713f90 | 1 | private void reset() {
clear(11);
clear(16);
for (int i=27; i<32; i++)
clear(i);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.